You will need the template keyword:
using doInvert = typename InvTuple<T...>::template doInvert < U..., T1 > ;
and you also need to switch U... and T1 on the same line so that they work correctly:
#include <iostream> #include <tuple> #include <typeinfo> using namespace std; // Don't try this at home template<class...T> struct InvTuple; template<class T1, class...T> struct InvTuple < T1, T... > { template<class... U> using doInvert = typename InvTuple<T...>::template doInvert < T1, U... >; using type = doInvert<>; }; template<> struct InvTuple <> { template<class... U> using doInvert = tuple<U...>; using type = doInvert < > ; }; int main() { InvTuple<int,char,bool> obj; InvTuple<int,char,bool>::type obj2; cout << typeid(obj).name() << endl; // InvTuple<int, char, bool> cout << typeid(obj2).name() << endl; // std::tuple<bool, char, int> }
Example
source share