The classic first application "Hello, World!" with coroutine and task.
#include <xtd/xtd>
#include <xtd/xtd>
class example {
public:
static auto main() async_ {
println("[main], thread {}] -> start", thread::current_thread().managed_thread_id());
auto message = co_await get_message();
auto length = co_await get_size(message);
println("length : {}", length);
println("[main, thread {}] -> end", thread::current_thread().managed_thread_id());
}
private:
static auto get_message() -> task<string> {
co_return "Hello, World!";
}
static auto get_size(auto message) -> task<usize> {
co_return message.length();
}
};
#define startup_(...)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:278