Current implementations of std::generator for both MSVC and libstdc++/GCC introduce some overhead. In the above xorshift sample, the generator version shows around a 3x slowdown with MSVC and 2x slowdown with GCC. We hope to improve on this in future versions of the compiler by, for example...
std::experimental::generator<int> generateInts() { for (int i = 0; i < 10; ++i) { co_await some_async_func(); co_yield i; } }; 使用MSVC时,我发现编译器错误: error C2338: co_await is not supported in coroutines of type std::experimental::generator EDIT1: 错误来自它的await_t...