Use template metaprogramming only when you really need to
Reason
Template metaprogramming is hard to get right, slows down compilation, and is often very hard to maintain. However, there are real-world examples where template metaprogramming provides better performance than any alternative short of expert-level assembly code. Also, there are real-world examples where template metaprogramming expresses the fundamental ideas better than run-time code. For example, if you really need AST manipulation at compile time (e.g., for optional matrix operation folding) there might be no other way in C++.
Example, bad
???
Example, bad
enable_if
Instead, use concepts. But see How to emulate concepts if you don't have language support.
Example
??? good
Alternative: If the result is a value, rather than a type, use a constexpr function.
Note
If you feel the need to hide your template metaprogramming in macros, you have probably gone too far.