3 ms·
This is exactly why I don't like C++: it is just too complicated, and it encourages to write complicated code, usually opaque boilerplate template hacks for wha
by beeforpork 9y ago
This is exactly why I don't like C++: it is just too complicated, and it encourages to write complicated code, usually opaque boilerplate template hacks for what would seem a simple concept. This is difficult to read, review, understand, and hence error-prone. No, not only error-prone, but bug-encouraging.
BTW, you can also enforce compile time evaluation like this:
enum { aux1 = X };
use(aux1);
But that's two lines, I know. And, of course, it is still a hack ('enum'? What?).
- ben-schaaf 9y agoInterestingly D actually used `enum` to define compile time values (as opposed to `alias` which is used for types). If you want a compile time value you can do this: enum aux1 = X;