C++ Coroutine in Action. Wiki
The main goal of this library is ...
- Help understanding of the C++ coroutine
- Provide meaningful design example with the feature
In that perspective, the library will be maintained as small as possible. Have fun with them. And try your own coroutines !
To support multiple compilers, this library replaces <experimental/coroutine>
. This might lead to conflict with existing library like libcxx and VC++.
Prefer what you like. If the issue is severe, please create an issue.
// You can replace this header to <experimental/coroutine>
#include <coroutine/frame.h>
Generator and async generator
#include <coroutine/yield.hpp> // enumerable<T> & sequence<T>
Utility types are in the following headers
#include <coroutine/return.h> // return type for coroutine
#include <coroutine/suspend.h> // helper type for suspend / await
#include <coroutine/concrt.h> // synchronization utilities
Go language style channel to deliver data between coroutines
#include <coroutine/channel.hpp> // channel<T, Lockable>
Network Asnyc I/O and some helper functions are placed in one header.
#include <coroutine/net.h> // async i/o for sockets
Please reference .travis.yml
and appveyor.yml
to see build steps.
- Visual Studio 2017 or later
msvc
(vc141)
- CMake
msvc
clang-cl
: Windows with VC++ headers. Requires static linkingclang
: LinuxAppleClang
: Mac
This library only supports x64
Expect Clang 6 or later versions. Notice that the feature, c++ coroutine, was available since Clang 5
Exploring test(example) codes will be helpful.
- Visual Studio Native Testing Tool
- CMake generated project with Catch2
For Visual Studio users,
I recommend you to import(add reference) win32.vcxproj in modules.
Expect there is a higher CMake project which uses this library.
cmake_minimum_required(VERSION 3.8)
# ...
add_subdirectory(coroutine)
# ...
target_link_libraries(your_project
PUBLIC
coroutine
)
Following package managers and build options are available.
- vcpkg
- x64-windows
- x64-linux
- x64-osx
This work is licensed under a Creative Commons Attribution 4.0 International License.