Lords Of Tech

You can define template methods in .cpp files without explicit instantiation, as long as they are private

For years I’ve been programming in C++ with the belief that the bodies of template methods had to be in headers. Only recently I learned that splitting template methods between header and source is, in fact, often perfectly fine.

C++20 Resumable functions: Goodbye state machines, no one will mourn you

C++20 allows writing functions that suspend and can continue at the next line. This has an amazing application at avoiding writing annoying and error-prone state machines. This article showcases how coroutines can clean up a function that would usually need an ugly state machine.