samedi 6 février 2021

Type aliasing specialization

Is it possible to specialize alias templates? Something like this:

template<typename T> ??? TypeAlias;

template<>
using TypeAlias<float> = ConcreteType1; 

template<>
using TypeAlias<double> = ConcreteType2; 

PS. I know it can be done with wrapper struct and specialization:

template<typename T> struct TypeAlias;

template<> struct TypeAlias<float>
{
    using type = ConcreteType1;
};

template<> struct TypeAlias<double>
{
    using type = ConcreteType2;
};

Aucun commentaire:

Enregistrer un commentaire