You're missing the point. The system as I presented it will automatically update the flags field when a feature is by some compile-time means included or excluded. Your way requires an explicit...
Type: Posts; User: CornedBee
You're missing the point. The system as I presented it will automatically update the flags field when a feature is by some compile-time means included or excluded. Your way requires an explicit...
Good point. I originally meant to have this hidden in a .cpp, but of course that's not possible since the changers are template instantiations.
As with template functions, template static...
1) Compare:
class NonTemplate {
static int var;
};
int NonTemplate::var;
template <typename T>
class Template {
static int var;
Yep, my fault. If the static member isn't referenced, it isn't instantiated. Here's something that works.
static unsigned featureField = 0;
template <int N> struct FeatureRegisterer {
...
Something like this:
static unsigned featureField = 0;
template <int N> struct FeatureRegisterer {
FeatureRegisterer() { featureField |= 1 << N; }
};
enum Features {
FeatureA, FeatureB,...