Template Metaprogramming – Difference Between Using Enum Hack and Static Const
Enums aren’t lvals, static member values are and if passed by reference the template will be instanciated: void f(const int&); f(TMPFib<1>::value); If you want to do pure compile time calculations etc. this is an undesired side-effect. The main historic difference is that enums also work for compilers where in-class-initialization of member values is not supported, … Read more