Hello,
Eigen does this for storing integer constants on a class:
class C {
enum { SomeConstant = SomeValue };
};
Most other C++ code (including libstdc++ and libc++) do this instead:
class C {
static const some_integer_type SomeConstant = SomeValue;
};
I think we should switch to that too. The upside is clear: being able to explicitly choose a specific integer type or bool.
I don't think there is a significiant downside (anymore). Early _expression_ templates libraries tended to use enums (in particular, TVMET, on which the early attempt at Eigen2 found in the 35 first csets of the repo was based, uses enums). In theory, enums are the only true compile-time constants in C++, aside from literals. In practice, because C++ says it's undefined behavior to overwrite a static-storage constant, the compiler is free to always assume that static-storage constants always have the same value as the literal value that was originally assigned to them, and so in practice reading from a static-storage constant is never a memory access.
If you agree with the general idea, the next question is: do you prefer small incremental patches or a big bulky patch? What would be less disruptive to your workflow? Or... maybe I should instead make a parser that does this replacement automatically so one can also apply it to local branches.
Benoit