Why is it considered better practice to use enum not static const bool in template metaprogramming?
I’ve read that somewhere in Alexandrescu’s book but cannot find it and really would like to know it.
Why is it considered better practice to use enum not static const bool in
Share
The key reason is that a static bool is a variable after all and a enum is a type – hence in case of enum no variable is ever instantiated and it’s thus guaranteed to be a compile-time evaluation.
Also see this question for more details.