This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

32
cppdraft/temp/static.md Normal file
View File

@@ -0,0 +1,32 @@
[temp.static]
# 13 Templates [[temp]](./#temp)
## 13.7 Template declarations [[temp.decls]](temp.decls#temp.static)
### 13.7.2 Class templates [[temp.class]](temp.class#temp.static)
#### 13.7.2.5 Static data members of class templates [temp.static]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L2899)
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[.](#1.sentence-1)
[*Example [1](#example-1)*: template<class T> class X {static T s;};template<class T> T X<T>::s = 0;
struct limits {template<class T>static const T min; // declaration};
template<class T>const T limits::min = { }; // definition — *end example*]
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L2921)
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[.](#2.sentence-1)
[*Example [2](#example-2)*: template <class T> struct A {static int i[];};template <class T> int A<T>::i[4]; // 4 elementstemplate <> int A<int>::i[] = { 1 }; // OK, 1 element — *end example*]