Three things I’ve come to believe about post modern C++

In no particular order:

  • Template metaprogramming is still evil, and C++11/14 hasn’t fixed anything about it. People argue metaprogramming enables “clean, elegant code,” as if a home built on a garbage dump won’t smell like garbage. If anyone else needs to repair or extend the foundation of your home they’ll need to parse through your garbage pile to make changes. Template metaprogramming as a rule should simply never be done outside low-level libraries.
  • auto is too easy to abuse. Oh but, “the IDE makes auto easier to read!” Go back to Java. auto does have a few good uses, clang-tidy provides excellent guidance on where its effective, its guidance should be followed.
  • Large lambdas harm readability. They make the control flow of the program harder to parse and discourage self documenting code. Lambdas should be limited to 2-3 statements. And please, if you write a lambda, mean it: don’t write a lambda where you could have just as easily written a standalone function.