Why should I prefer static constexpr int in a class over enum for class-level integral constants?
C++17 Update: static constexpr variables are implicitly inline so there's no external definition necessary. Original question: Let's say I have a list of constants such as struct Cls { static constexpr int N = 32; static constexpr int M = 64; }; This of course suggests that I add definitions for these to avoid ODR-usage issues that may occur so I need: constexpr int Cls::N; constexpr int Cls::M; Why should I prefer this over struct Cls { enum : int { N = 32, M = 64 }; }; Which saves me of the ODR-usage headaches since N and M are more truly just constants and not objects in their own right (a