wwa-coro 0.0.1
Yet Another C++20 Coroutine Library
task.cpp

Example of how to use tasks.

#include <iostream>
#include "eager_task.h"
#include "task.h"
namespace {
{
co_return 123;
}
{
co_return 456;
}
{
const auto a = co_await task1();
const auto b = co_await task2();
co_return a + b;
}
{
std::cout << "The result is " << co_await sum() << "\n";
}
} // namespace
int main()
{
// Expected output:
// The result is 579
return 0;
}
A coroutine task.
Definition task.h:196
Eager coroutine.
eager_task run_awaitable(Awaitable &&f, Args &&... args)
Turns any awaitable into an eager fire-and-forget coroutine.
Definition eager_task.h:130
Coroutine-based task.