lundi 25 mai 2015

How to access template template parameters in type alias?

Is it possible to use template template arguments inside a type alias? For example is it possible to write a type alias similar to this:

#include "tuple"

template<
    template<class... Types> class Container,
    class... Types
> using another_tuple = std::tuple<Types...>;

another_tuple<std::tuple<int>> t;

which, when given e.g. std::tuple, uses its Types for something else? Both GCC and Clang mention class templates in their errors, how do I avoid needing a class template? If I remove all ...s GCC error changes to:

error: wrong number of template arguments (1, should be 2)
another_tuple<std::tuple<int>> t;
                            ^

which I don't understand. Container itself doesn't have to be a template but I couldn't figure out how to use std::tuple in its place.

Aucun commentaire:

Enregistrer un commentaire