FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cppgraphqlgen/cmake/test_coroutine.cpp.in at main · gitmodimo/cppgraphqlgen · GitHub
gitmodimo
cppgraphqlgen
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cppgraphqlgen
/
cmake
/
test_coroutine.cpp.in
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (48 loc) · 1.18 KB
Breadcrumbs
cppgraphqlgen
/
cmake
/
test_coroutine.cpp.in
Copy path
File metadata and controls
59 lines (48 loc) · 1.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// This is a dummy program that just needs to compile and link to tell us if
// the C++20 coroutine API is available. Use CMake's configure_file command
// to replace the COROUTINE_HEADER and COROUTINE_NAMESPACE tokens for each
// combination of headers and namespaces which we want to pass to the CMake
// try_compile command.
#include <@COROUTINE_HEADER@>
#include <future>
struct task
{
struct promise_type
{
task get_return_object() noexcept
{
return {};
}
@COROUTINE_NAMESPACE@::suspend_never initial_suspend() noexcept
{
return {};
}
@COROUTINE_NAMESPACE@::suspend_never final_suspend() noexcept
{
return {};
}
void return_void() noexcept
{
promise.set_value();
}
void unhandled_exception()
{
promise.set_exception(std::current_exception());
}
std::promise<void> promise;
};
constexpr bool await_ready() const noexcept
{
return true;
}
std::future<void> future;
};
task test_co_return()
{
co_return;
}
int main()
{
test_co_return().future.get();
return 0;
}
Back
|
FazBrowse Home
|
New Git URL