RAD Studio
ContentsIndex
PreviousUpNext
E2102: Cannot use template 'template' without specifying specialization parameters

The generic form of a template must be referenced using specialization parameters. For example, for a template class named foo, taking two template parameters, then a legal reference might have the form

foo<int, char>

Referring to the template as just foo is legal in only two circumstances:

  • When passing the template name as a template template argument
  • While declaring the members of that class template, to refer to the enclosing template type
For example:

template<class T>
class foo
{
public:
    foo();       // legal use of bare template name
    foo& operator=(const foo&);
};
foo<foo> x;   // error: not a template template argument
foo y;    // error: needs specialization parameters
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!