Comment by jandrewrogers

9 months ago

C++17/20 are light-years beyond C++11 in terms of ergonomics and usability. Metaprogramming in C++11 is unrecognizable from C++20 things have improved so much. I hated C++ before C++11 but now C++11 feels quite legacy compared to even C++17. The ability to write almost anything, like a logging library, without C macros is a huge improvement for maintainability and robustness.

Most of the features in modern C++ are designed to enable writing really flexible and highly optimized libraries. C++ rarely writes those libraries for you.

Heh, mentioning metaprogramming and logging is not exactly how you convince anybody of superior ergonomics and usability.

  • Metaprogramming is required to get typesafe easy to use code. The problem of most template code is that the implementation gets horrendously complicated but for the user it can create A LOT of comfort. At work for example, I wrote a function that calls an rpc-method and it has a few neat features like:

    An rpc call with a result looks like this:

    call(<methodinfo>, <param>, [](Result r) {});

    vs one which returns void:

    call(<methodinfo>, <param>, []() {});

    It's neat that the callback reflects that, but this wouldn't be possible without some compiletime magic.