What Happens When You Port a 2001 C++ Library to C++20
Andrei Alexandrescu's Loki library shipped in 2001 alongside his book Modern C++ Design. It was groundbreaking — policy-based design, typelists, smart pointers, abstract factories, visitors, all bu...

Source: DEV Community
Andrei Alexandrescu's Loki library shipped in 2001 alongside his book Modern C++ Design. It was groundbreaking — policy-based design, typelists, smart pointers, abstract factories, visitors, all built with template metaprogramming that pushed C++98 to its absolute limit. Twenty-five years later, I rewrote the whole thing in C++20. Repo: github.com/skillman1337/modern-loki Why bother? The original Loki was held together with recursive template inheritance and prayer. It predates variadic templates, constexpr, concepts, std::variant, std::tuple, and standard threading. Every pattern in the book can be expressed more clearly with modern C++. I wanted to see what Modern C++ Design looks like when you actually have modern C++. What changed 2001 (original Loki) 2025 (Modern Loki) C++20 feature Recursive Typelist<H, T> Variadic typelist<Ts...> Parameter packs, fold expressions SingletonHolder with OS locks singleton_holder with DCLP std::atomic, policy-based threading Manual Smart