Introduction to C++ Template Metaprogramming
Explore C++ Template Metaprogramming techniques in this comprehensive conference talk. Learn how to use TMP as a precursor to C++17 Concepts for checking constraints and producing clear error messages. Discover how to optimize algorithm implementations based on specific template types. Delve into introspecting C++ types at compile-time and generating compile-time constructs for time-saving and fully-compile-time computation. Cover topics including type constraints, algorithm selection, compile-time computation, class template specialization, type traits, static assert, member detection with void_t, expression SFINAE, template specialization based on traits, tag dispatch, std::enable_if, recursive templates, constexpr over types, and compile-time safe printf. Gain practical knowledge to apply TMP techniques in libraries and application code, building upon basic template syntax and specialization understanding.