Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Defining Member Templates Outside a Class

In Visual C++ .NET 2003 and later, it is possible to define member templates outside a class, as described in Member Function Templates and Nested Class Templates.

The following sample works in Visual C++ .NET 2003 as specified in the standard:

// defining_member_templates_outside_a_class.cpp
// compile with: /LD
template <class T>
struct S
   template<class U> void f(U);

template<class T> template <class U> void S<T>::f(U)
{   //defined out of line

Community Additions

© 2015 Microsoft