E2102 Cannot use template 'template' without specifying specialization parameters (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

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