-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support both <coroutine> and <experimental/coroutine>
Starting with GCC 10.1, GCC/libstdc++ supports coroutines, but includes them in their final location in <coroutine>. This commit generalizes the location of the header, and the name of the types (either in the std or std::experimental namespace), so that both the current Clang/MSVC and the GCC approach can be supported. This should also guarantee that both current and later Clang/MSVC releases will be supported by the library.
- Loading branch information
Showing
43 changed files
with
213 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef CPPCORO_COROUTINE_HPP_INCLUDED | ||
#define CPPCORO_COROUTINE_HPP_INCLUDED | ||
|
||
#if __has_include(<coroutine>) | ||
|
||
#include <coroutine> | ||
|
||
namespace cppcoro { | ||
template<typename Promise=void> | ||
using coroutine_handle = std::coroutine_handle<Promise>; | ||
|
||
using suspend_always = std::suspend_always; | ||
using suspend_never = std::suspend_never; | ||
} | ||
|
||
#elif __has_include(<experimental/coroutine>) | ||
|
||
#include <experimental/coroutine> | ||
|
||
namespace cppcoro { | ||
template<typename Promise=void> | ||
using coroutine_handle = std::experimental::coroutine_handle<Promise>; | ||
|
||
using suspend_always = std::experimental::suspend_always; | ||
using suspend_never = std::experimental::suspend_never; | ||
} | ||
|
||
#else | ||
#error Cppcoro requires a C++20 compiler with coroutine support | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.