It's good to be back in C++ land.
I've got a frustrating set of requirements that I'm trying to fulfill. For the sake of this discussion, it boils down to two:
There are numerous features that may or may not appear in the compiled product. There is a need for a function to return a bitfield with each bit set depending upon the features in the compiled product.
- Minimize the amount of code in the compiled product as much as possible.
- Minimize the amount of logic handled at run-time as much as possible i.e. maximize the amount of logic that can be completed during compile-time.
So far, I've been designing as much as possible using templates since unused templates won't be included in the compiled product. I'm trying to avoid requiring a programmer to manually update the feature bitfield, since that could be a bit of a maintenance nightmare; it's all too easy to forget that you need to do it. Is there a way for a template being used at compile time to set its own feature bit in the bitfield?