I have a class:
template <class type>
class sysbase : public base
{
public:
static type* Spawn(int Config = 0) { … }
…
};
And about 50 enums in the global namespace:
enum a_config { A1, A2, … };
enum b_config { B1, B2, … };
etc.
Classes a, b, etc. (derived from sysbase) will be passed as the type template argument to sysbase.
Now I would like to change the Config parameter to be of one of those enum types instead of just a plain int to improve type safety, so that:
- when
typeis classa, then the type ofConfigwould bea_config - when
typeis classb, then the type ofConfigwould beb_config - etc.
The enums should preferably stay in the global namespace to not break the existing code which uses e.g. a::Spawn(A1).
Is there a way to accomplish this?
Aucun commentaire:
Enregistrer un commentaire