TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 229 subscribers
Post #24881 20
Modern Loki: C++20 header-only port of Alexandrescu's classic, with 150 compiled & tested documentation examples

I rewrote Alexandrescu's Loki library from *Modern C++ Design* (2001) in C++20. Header-only, zero dependencies, full test suite.

What's different from the original:

* `typelist<Ts...>` using variadic templates instead of recursive `Typelist<H, T>`
* `abstract_factory` built on `std::tuple` instead of virtual multiple inheritance
* Threading policies using `std::mutex`/`std::shared_mutex`/`std::atomic`
* Visitors via `std::variant` \+ `overloaded` pattern alongside classic acyclic
* Concepts for policy constraints instead of SFINAE

The documentation is the part I'm most proud of: every single component has 10 real-world examples that are extracted from the Markdown by a Python script and compiled against MSVC as part of CI. If the docs lie, CI fails.

This is a teaching/reference library, not a "replace std::" library. If you're studying *Modern C++ Design* or teaching generic programming, this might be useful.

GitHub: [https://github.com/skillman1337/modern-loki](https://github.com/skillman1337/modern-loki) CI: MSVC 2022, GCC 13, Clang 17

https://redd.it/1s5lno0
@r_cpp
GitHub GitHub - skillman1337/modern-loki: C++20 header-only port of Alexandrescu's Loki library — policy-based design patterns with concepts… C++20 header-only port of Alexandrescu's Loki library — policy-based design patterns with concepts, std::variant, and standard threading - skillman1337/modern-loki
More from @r_cpp
  1. Oct 7, 2026Bugbusters #1 | C++ in 2026: worth it? | Nathan Baggs https://youtube.com/watch?v=kd-5hJHv…
  2. Oct 6, 2026Implementation of GCC's Nested Functions (vs. C++ Lambdas) https://uecker.codeberg.page/20…
  3. Oct 6, 2026C++26: Module improvements https://www.sandordargo.com/blog/2026/09/09/cpp26-modules https…
  4. Oct 6, 2026Tuning a Server for Benchmarking https://david.alvarezrosa.com/posts/tuning-a-server-for-b…
  5. Oct 6, 2026boost.org has been rebuilt: new profiles, badges, search, and library filtering The Boost…
  6. Oct 6, 2026When (Not) to Use alloca() https://voithos.io/articles/when-not-to-use-alloca/ https://red…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →