3

Minimal example:

template<template<class ...> class>
struct templ {};

template<class T>
using special = templ<T::type>;

int main() {}

clang++:

test.cpp:5:23: error: template argument for template template parameter must be a class template or type alias template
using special = templ<T::type>;

Indeed, I mean to say that T::type is a class template, e.g.

struct detail1 {
    template <class T>
    using type = std::vector<T>;
};

struct detail2 {
    template <class T>
    struct type {};
};

But how can one say this? g++ suggests to use typename T::type, but this seams wrong to me, and indeed, this does not solve the error.

iglesias
  • 57
  • 11
Johannes
  • 2,901
  • 5
  • 30
  • 50

1 Answers1

7

You need to specify that type is a template:

template<class T>
using special = templ< T::template type>;

This is needed because T::type is dependent on the template parameter T.

See also Where and why do I have to put the “template” and “typename” keywords?

Community
  • 1
  • 1
interjay
  • 107,303
  • 21
  • 270
  • 254