jeudi 26 décembre 2019

Reverse variadic template arguments in hierarchy

I currently have this class which uses typelist:

template<class AbstractF, template<class, class > class Creator, class TList>
class A: public B<typename Reverse<TList>::Result, Creator, AbstractF> {
};

I'm trying to make the code more c++11 friendly replacing the typelist with variadic template arguments.

template<class AbstractF, template<class, class > class Creator, class TList...>
class A: public B<Creator, AbstractF, TList...> { //<---how to revert here?
};

The problem is: how to reverse a variadic list? Looking at other questions I saw the use of std::tuple, but in this case I'm not able to understand how to "unpack" it since the variadic arguments are not part of simple templated function but they are used as arguments in a class hierarchy.

Aucun commentaire:

Enregistrer un commentaire