https://meetingcpp.com/mcpp/books/book.php?hash=7054fe7151d008a4c29fb2fd7a7c43a214c225e6
#cplusplus
#cpp
Vro C++ coroutines are kind of bullshit like what do you mean you gotta do hacks like this to keep track of what coroutine is currently running
#include <coroutine>
#include <exception>
#include <cstdio>
struct task;
struct pretask;
struct promise;
struct task {
using promise_type = promise;
task() = default;
task(pretask&& o);
};
struct pretask {
task x;
pretask() = default;
};
task::task(pretask&& o) : task(o.x) { printf("]] Leave coro (initial)\n"); }
struct promise {
pretask get_return_object() { return {}; }
std::suspend_never initial_suspend() noexcept {
printf("Enter coro (initial) [[\n");
return {};
}
std::suspend_always final_suspend() noexcept { return {}; }
void return_void() {}
void unhandled_exception() { std::terminate(); }
};
struct awaiter {
std::coroutine_handle<> handle;
bool await_ready() { return false; }
void await_suspend(std::coroutine_handle<> h) { handle=h; }
void await_resume() { }
void resume() {
printf("Enter coro (resume) [[\n");
if (handle)
handle.resume();
handle = {};
printf("]] Leave coro (resume)\n");
}
};
task nya(awaiter& awa) {
printf(" Meow\n");
co_await awa;
printf(" Meow2\n");
co_return;
}
int main() {
awaiter awa;
printf("== Begin Nya ==\n");
auto x = nya(awa);
printf("== Resume Nya ==\n");
awa.resume();
printf("== End Nya ==\n");
}
C++Now 2026 SESSION ANNOUNCEMENT: Compile-Time Borrow Checker with Stateful Metaprogramming by Alon Wolf
https://schedule.cppnow.org/session/2026/compile-time-borrow-checker-with-stateful-metaprogramming/
Register now at https://cppnow.org/registration/
C++Now 2026 SESSION ANNOUNCEMENT: Making C++ Standard Parallelism Multidimensional by Mark Hoemmen
https://schedule.cppnow.org/session/2026/making-cpp-standard-parallelism-multidimensional/
Register now at https://cppnow.org/registration/
Four hours streaming, merged a new KNotification tutorial: https://develop.kde.org/docs/features/knotification/
Also reorganized Develop a bit to focus on libraries, and started work on the KNotification API.
Calling all C++ developers! Register for C++Now, the premier onsite conference happening in Aspen, Colorado. From May 4th to May 8th
Immerse yourself in C++ with talks, group chats, and lightning sessions.
Register today! https://cppnow.org/registration/
Big Thanks to think-cell for supporting C++Now 2026 as our YouTube Channel Sponsor.
Find out more about how they use C++: https://www.think-cell.com/en/career/talks?utm_source=tech-event&utm_medium=display&utm_campaign=cppnow&utm_content=talks
C++Now wouldn't be possible without the support of our sponsors!
Register for C++Now 2026 today: https://cppnow.org/registration/