MODERN C++ A "modern" approach to writing "modern" C++. 2022-06-06 Avoid inheritance, instead prefer tagged unions. struct queen { uint32_t health; }; struct king { bool dead; }; enum piece_kind { QUEEN, KING, }; struct piece { piece_kind kind; union { queen q; king k; }; }; Use methods only if necessary. Often free functions work just fine. Prefer structs over classes. Avoid visibility modifiers. Limit amount of global namespaces. Avoid nested namespaces if possible. Prefer static methods and free functions over constructors. Don't overload constructors - use differently named functions instead. Use aggregate initialization. If you have a constructor, use uniform initialization. Prefer free functions over destructors. Avoid template metaprogramming, especially the "type_traits" header. Many standard library functions can be expressed in a simpler way. T a = std::move(b); T a = static_cast(b);