MSVC now supports symmetric transfer, and I think gcc has since it introduced coroutines support. However, cppcoro currently only uses symmetric transfer for clang >= 7.
|
/// \def CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER |
|
/// Defined to 1 if the compiler supports returning a coroutine_handle from |
|
/// the await_suspend() method as a way of transferring execution |
|
/// to another coroutine with a guaranteed tail-call. |
|
#if CPPCORO_COMPILER_CLANG |
|
# if __clang_major__ >= 7 |
|
# define CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER 1 |
|
# endif |
|
#endif |
|
#ifndef CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER |
|
# define CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER 0 |
|
#endif |
Rather than hard-coding a bunch more compiler versions, it may make more sense to check for __cpp_impl_coroutine >= 201902 to automatically use symmetric transfer for any compiler that claims compliant support of the final coroutine spec (probably with || __clang_minor__ >= 7 to keep working with old clang).
MSVC now supports symmetric transfer, and I think gcc has since it introduced coroutines support. However, cppcoro currently only uses symmetric transfer for clang >= 7.
cppcoro/include/cppcoro/config.hpp
Lines 33 to 44 in 3912152
Rather than hard-coding a bunch more compiler versions, it may make more sense to check for
__cpp_impl_coroutine >= 201902to automatically use symmetric transfer for any compiler that claims compliant support of the final coroutine spec (probably with|| __clang_minor__ >= 7to keep working with old clang).