Stay up-to-date with everything C++!
Content directly fetched from the subreddit just for you.
Join our group for discussions : @programminginc
Powered by : @r_channels
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
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