I want to have a type which is either a typedef or a class. Thus, something like this
template< typename T > class A { };
template< typename T > using X< T, true > = T;
template< typename T > using X< T, false > = A< T >;
Obviously, this does not compile.
To overcome this problem I "invented" the following construct, which seems quite complicated in my eyes:
template< typename T > class A { };
template< typename T, bool E > struct make_X;
template< typename T >
struct make_X< T, true > {
T make();
};
template< typename T >
struct make_X< T, false > {
A< T > make();
};
template< typename T, bool E > using X = decltype( make_X<T,E>::make() );
Is there an easier way to achieve my goal?