Consider the simple following:
#ifndef TEST_H
#define TEST_H
class Test {
public:
static constexpr int a = 1;
}
#endif
Note:
- There's no ODR violation due to the macro.
- Why the constexpr static int a not considered a definition since it's defined in the class Test? Because it's not a definition, hence it needs the below outside of the class. Why?
constexpr int Test::a;