0

Trying to use a template defined in a class that is being passed as a template parameter itself. The typename specifier is obviously incorrect but i just get other errors if i try to use template there.

struct Tee
{
    template<typename T = int> class Bar { };
};

template<typename T>
struct Foo
{
    typename T::Bar<> f; // *error non-template used as template
};

int main() {
    Foo<Tee> foo;

    return 0;
}
johndoe
  • 303
  • 2
  • 13
  • Have you read the Q/A [Where and why do I have to put the “template” and “typename” keywords?](http://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords?rq=1) that also appears in the side bar? ----> – dyp Apr 04 '14 at 19:42
  • 1
    `typename T::template Bar<> f;` will work. Explanation is in the Q/A I mentioned. – dyp Apr 04 '14 at 19:43

0 Answers0