Files
2025-10-25 03:02:53 +03:00

1.3 KiB

[temp.static]

13 Templates [temp]

13.7 Template declarations [temp.decls]

13.7.2 Class templates [temp.class]

13.7.2.5 Static data members of class templates [temp.static]

1

#

A definition for a static data member or static data member template may be provided in a namespace scope enclosing the definition of the static member's class template.

[Example 1: template class X {static T s;};template T X::s = 0;

struct limits {templatestatic const T min; // declaration};

templateconst T limits::min = { }; // definition — end example]

2

#

An explicit specialization of a static data member declared as an array of unknown bound can have a different bound from its definition, if any.

[Example 2: template struct A {static int i[];};template int A::i[4]; // 4 elementstemplate <> int A::i[] = { 1 }; // OK, 1 element — end example]