Name

export specifier — Exported template specifier

Synopsis

               template-decl ::= [export] template < template-parm-list > declaration
            

The export specifier declares a template to be exported. An exported template lets you compile the definitions of a function template, or the member definitions of a class template, separately from the template’s declaration.

image with no caption

Most compilers do not support export.

Example

export template<typename T>
class point {
public:
  point(T x, T y);
};
export template<typename T>
point::point(T x, T y) {
  ...
}

See Also

template, Chapter 7

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.