tmp/tmp9oj2ns8r/{from.md → to.md}
RENAMED
|
@@ -99,12 +99,12 @@ v1[3] = 7; // Array<int>::operator[]()
|
|
| 99 |
v2[3] = dcomplex(7,8); // Array<dcomplex>::operator[]()
|
| 100 |
```
|
| 101 |
|
| 102 |
#### Member classes of class templates <a id="temp.mem.class">[[temp.mem.class]]</a>
|
| 103 |
|
| 104 |
-
A
|
| 105 |
-
template definition in which it is declared. The
|
| 106 |
defined before its first use that requires an instantiation (
|
| 107 |
[[temp.inst]]). For example,
|
| 108 |
|
| 109 |
``` cpp
|
| 110 |
template<class T> struct A {
|
|
@@ -115,18 +115,27 @@ template<class T> class A<T>::B { };
|
|
| 115 |
A<int>::B b2; // OK: requires A::B to be defined
|
| 116 |
```
|
| 117 |
|
| 118 |
#### Static data members of class templates <a id="temp.static">[[temp.static]]</a>
|
| 119 |
|
| 120 |
-
A definition for a static data member
|
| 121 |
-
scope enclosing the definition of the static
|
|
|
|
| 122 |
|
| 123 |
``` cpp
|
| 124 |
template<class T> class X {
|
| 125 |
static T s;
|
| 126 |
};
|
| 127 |
template<class T> T X<T>::s = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
```
|
| 129 |
|
| 130 |
An explicit specialization of a static data member declared as an array
|
| 131 |
of unknown bound can have a different bound from its definition, if any.
|
| 132 |
|
|
|
|
| 99 |
v2[3] = dcomplex(7,8); // Array<dcomplex>::operator[]()
|
| 100 |
```
|
| 101 |
|
| 102 |
#### Member classes of class templates <a id="temp.mem.class">[[temp.mem.class]]</a>
|
| 103 |
|
| 104 |
+
A member class of a class template may be defined outside the class
|
| 105 |
+
template definition in which it is declared. The member class must be
|
| 106 |
defined before its first use that requires an instantiation (
|
| 107 |
[[temp.inst]]). For example,
|
| 108 |
|
| 109 |
``` cpp
|
| 110 |
template<class T> struct A {
|
|
|
|
| 115 |
A<int>::B b2; // OK: requires A::B to be defined
|
| 116 |
```
|
| 117 |
|
| 118 |
#### Static data members of class templates <a id="temp.static">[[temp.static]]</a>
|
| 119 |
|
| 120 |
+
A definition for a static data member or static data member template may
|
| 121 |
+
be provided in a namespace scope enclosing the definition of the static
|
| 122 |
+
member’s class template.
|
| 123 |
|
| 124 |
``` cpp
|
| 125 |
template<class T> class X {
|
| 126 |
static T s;
|
| 127 |
};
|
| 128 |
template<class T> T X<T>::s = 0;
|
| 129 |
+
|
| 130 |
+
struct limits {
|
| 131 |
+
template<class T>
|
| 132 |
+
static const T min; // declaration
|
| 133 |
+
};
|
| 134 |
+
|
| 135 |
+
template<class T>
|
| 136 |
+
const T limits::min = { }; // definition
|
| 137 |
```
|
| 138 |
|
| 139 |
An explicit specialization of a static data member declared as an array
|
| 140 |
of unknown bound can have a different bound from its definition, if any.
|
| 141 |
|