jeudi 22 janvier 2015

using declaration of a specialized variadic template class

Is it possible to define FloatType in such a way that I can declare a f1 as



FloatType f1;


instead of



FloatType<> f1;


If i try to use the former i get a


error: use of class template 'FloatType' requires template arguments



template <typename T, typename... Args>
class Type
{
};

template <typename... Args>
class Type<float, Args...>
{
};

template <typename... Args>
using FloatType = Type<float, Args...>;

int
main(int, char **)
{
FloatType<> f1;
FloatType<float> f2;

return 0;
}

Aucun commentaire:

Enregistrer un commentaire