A name prefixed by the keyword
template
shall be followed by a template argument list or
refer to a class template or an alias template
. The keyword
template shall not appear immediately
before a
~ token (as to name a destructor)
. [
Note 3:
The keyword
template
cannot be applied to non-template members of class templates
. —
end note]
[
Note 4:
As is the case with the
typename
prefix, the
template
prefix is well-formed
even when lookup for the name would already find a template
. —
end note]
[
Example 4:
template <class T> struct A {
void f(int);
template <class U> void f(U);
};
template <class T> void f(T t) {
A<T> a;
a.template f<>(t);
a.template f(t);
}
template <class T> struct B {
template <class T2> struct C { };
};
template <class T, template <class X> class TT = T::template C> struct D { };
D<B<int> > db;
—
end example]