Make empty structs as tags.
1 2 3 4 5 6 7 8
|
struct RunPartA {};
struct RunPartB {};
template< typename T >
class SomeClass
{
// ...
}
|
Though I'd consider moving as much of the functionality from SomeClass's constructor into functions within RunPartA and RunPartB as I could without duplicating code. It is probably OK even to tightly couple RunPartA, etc to SomeClass at that point because users probably won't instantiate RunPartA etc directly.
Or so I'm conjecturing based on the limited info available.
Just a thought.
To quirkyusername: yes, there is, if it is to be a template parameter, since template parameters must be constants. The std::string approach won't compile with it as a template parameter.
EDIT: on second thought, I still don't like the idea. It basically means checking typeof(T) for each possible value of T in the constructor. This smacks of either runtime polymorphism (derivation) or of template class specialization, however in the specialization case, you'll end up with a lot of code duplication if the class is big, unless you can factor most of it into say, a base class, or some other class.