tmp/tmpif062e5q/{from.md → to.md}
RENAMED
|
@@ -2,10 +2,12 @@
|
|
| 2 |
|
| 3 |
A definition for a static data member or static data member template may
|
| 4 |
be provided in a namespace scope enclosing the definition of the static
|
| 5 |
member’s class template.
|
| 6 |
|
|
|
|
|
|
|
| 7 |
``` cpp
|
| 8 |
template<class T> class X {
|
| 9 |
static T s;
|
| 10 |
};
|
| 11 |
template<class T> T X<T>::s = 0;
|
|
@@ -17,16 +19,22 @@ struct limits {
|
|
| 17 |
|
| 18 |
template<class T>
|
| 19 |
const T limits::min = { }; // definition
|
| 20 |
```
|
| 21 |
|
|
|
|
|
|
|
| 22 |
An explicit specialization of a static data member declared as an array
|
| 23 |
of unknown bound can have a different bound from its definition, if any.
|
| 24 |
|
|
|
|
|
|
|
| 25 |
``` cpp
|
| 26 |
template <class T> struct A {
|
| 27 |
static int i[];
|
| 28 |
};
|
| 29 |
template <class T> int A<T>::i[4]; // 4 elements
|
| 30 |
template <> int A<int>::i[] = { 1 }; // OK: 1 element
|
| 31 |
```
|
| 32 |
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
A definition for a static data member or static data member template may
|
| 4 |
be provided in a namespace scope enclosing the definition of the static
|
| 5 |
member’s class template.
|
| 6 |
|
| 7 |
+
[*Example 1*:
|
| 8 |
+
|
| 9 |
``` cpp
|
| 10 |
template<class T> class X {
|
| 11 |
static T s;
|
| 12 |
};
|
| 13 |
template<class T> T X<T>::s = 0;
|
|
|
|
| 19 |
|
| 20 |
template<class T>
|
| 21 |
const T limits::min = { }; // definition
|
| 22 |
```
|
| 23 |
|
| 24 |
+
— *end example*]
|
| 25 |
+
|
| 26 |
An explicit specialization of a static data member declared as an array
|
| 27 |
of unknown bound can have a different bound from its definition, if any.
|
| 28 |
|
| 29 |
+
[*Example 2*:
|
| 30 |
+
|
| 31 |
``` cpp
|
| 32 |
template <class T> struct A {
|
| 33 |
static int i[];
|
| 34 |
};
|
| 35 |
template <class T> int A<T>::i[4]; // 4 elements
|
| 36 |
template <> int A<int>::i[] = { 1 }; // OK: 1 element
|
| 37 |
```
|
| 38 |
|
| 39 |
+
— *end example*]
|
| 40 |
+
|