What is the most convenient and clear way to define variables of type declared inside some complex class. For example:
template<class T1, class T2>
class ClassA
{
enum ENUM_A { A1, A2 };
//constructor
ClassA(const ENUM_A& x);
}
Then when you want to use this object somewhere else, you'll have to write long type definitions like:
ClassA<ClassT1, ClassT2>::ENUM_A var = ClassA<ClassT1, ClassT2>::A1;
ClassA<ClassT1, ClassT2> obj(var);
Is there any safe and convenient way to avoid such long declarations? (I've thought about typedef
, but maybe it)
The solutions have already been named:
typedef
(orusing
), andauto
to skip naming the type entirely.