tmp/tmpsnzeywxk/{from.md → to.md}
RENAMED
|
@@ -2,25 +2,24 @@
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template <class T> struct tuple_size;
|
| 5 |
```
|
| 6 |
|
| 7 |
-
*Remarks:* All specializations of `tuple_size
|
| 8 |
-
`UnaryTypeTrait` requirements ([[meta.rqmts]]) with a
|
| 9 |
-
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
template <class... Types>
|
| 13 |
-
class tuple_size<tuple<Types...> >
|
| 14 |
-
: public integral_constant<size_t, sizeof...(Types)> { };
|
| 15 |
```
|
| 16 |
|
| 17 |
``` cpp
|
| 18 |
template <size_t I, class... Types>
|
| 19 |
class tuple_element<I, tuple<Types...>> {
|
| 20 |
public:
|
| 21 |
-
|
| 22 |
};
|
| 23 |
```
|
| 24 |
|
| 25 |
*Requires:* `I < sizeof...(Types)`. The program is ill-formed if `I` is
|
| 26 |
out of bounds.
|
|
@@ -32,28 +31,50 @@ is zero-based.
|
|
| 32 |
template <class T> class tuple_size<const T>;
|
| 33 |
template <class T> class tuple_size<volatile T>;
|
| 34 |
template <class T> class tuple_size<const volatile T>;
|
| 35 |
```
|
| 36 |
|
| 37 |
-
Let *TS* denote `tuple_size<T>` of the cv-unqualified type `T`.
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
| 40 |
|
| 41 |
``` cpp
|
| 42 |
integral_constant<size_t, TS::value>
|
| 43 |
```
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
``` cpp
|
| 46 |
template <size_t I, class T> class tuple_element<I, const T>;
|
| 47 |
template <size_t I, class T> class tuple_element<I, volatile T>;
|
| 48 |
template <size_t I, class T> class tuple_element<I, const volatile T>;
|
| 49 |
```
|
| 50 |
|
| 51 |
-
Let *TE* denote `
|
| 52 |
-
Then each of the three templates shall meet the
|
| 53 |
-
requirements ([[meta.rqmts]]) with a member
|
| 54 |
-
the following type:
|
| 55 |
|
| 56 |
-
- for the first specialization, `add_const_t<`*`TE`*`
|
| 57 |
-
- for the second specialization, `add_volatile_t<`*`TE`*`
|
| 58 |
-
- for the third specialization, `add_cv_t<`*`TE`*`
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
|
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template <class T> struct tuple_size;
|
| 5 |
```
|
| 6 |
|
| 7 |
+
*Remarks:* All specializations of `tuple_size` shall meet the
|
| 8 |
+
`UnaryTypeTrait` requirements ([[meta.rqmts]]) with a base
|
| 9 |
+
characteristic of `integral_constant<size_t, N>` for some `N`.
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
template <class... Types>
|
| 13 |
+
class tuple_size<tuple<Types...>> : public integral_constant<size_t, sizeof...(Types)> { };
|
|
|
|
| 14 |
```
|
| 15 |
|
| 16 |
``` cpp
|
| 17 |
template <size_t I, class... Types>
|
| 18 |
class tuple_element<I, tuple<Types...>> {
|
| 19 |
public:
|
| 20 |
+
using type = TI;
|
| 21 |
};
|
| 22 |
```
|
| 23 |
|
| 24 |
*Requires:* `I < sizeof...(Types)`. The program is ill-formed if `I` is
|
| 25 |
out of bounds.
|
|
|
|
| 31 |
template <class T> class tuple_size<const T>;
|
| 32 |
template <class T> class tuple_size<volatile T>;
|
| 33 |
template <class T> class tuple_size<const volatile T>;
|
| 34 |
```
|
| 35 |
|
| 36 |
+
Let *`TS`* denote `tuple_size<T>` of the cv-unqualified type `T`. If the
|
| 37 |
+
expression *`TS`*`::value` is well-formed when treated as an unevaluated
|
| 38 |
+
operand, then each of the three templates shall meet the
|
| 39 |
+
`UnaryTypeTrait` requirements ([[meta.rqmts]]) with a base
|
| 40 |
+
characteristic of
|
| 41 |
|
| 42 |
``` cpp
|
| 43 |
integral_constant<size_t, TS::value>
|
| 44 |
```
|
| 45 |
|
| 46 |
+
Otherwise, they shall have no member `value`.
|
| 47 |
+
|
| 48 |
+
Access checking is performed as if in a context unrelated to *`TS`* and
|
| 49 |
+
`T`. Only the validity of the immediate context of the expression is
|
| 50 |
+
considered.
|
| 51 |
+
|
| 52 |
+
[*Note 1*: The compilation of the expression can result in side effects
|
| 53 |
+
such as the instantiation of class template specializations and function
|
| 54 |
+
template specializations, the generation of implicitly-defined
|
| 55 |
+
functions, and so on. Such side effects are not in the “immediate
|
| 56 |
+
context” and can result in the program being ill-formed. — *end note*]
|
| 57 |
+
|
| 58 |
+
In addition to being available via inclusion of the `<tuple>` header,
|
| 59 |
+
the three templates are available when either of the headers `<array>`
|
| 60 |
+
or `<utility>` are included.
|
| 61 |
+
|
| 62 |
``` cpp
|
| 63 |
template <size_t I, class T> class tuple_element<I, const T>;
|
| 64 |
template <size_t I, class T> class tuple_element<I, volatile T>;
|
| 65 |
template <size_t I, class T> class tuple_element<I, const volatile T>;
|
| 66 |
```
|
| 67 |
|
| 68 |
+
Let *`TE`* denote `tuple_element_t<I, T>` of the cv-unqualified type
|
| 69 |
+
`T`. Then each of the three templates shall meet the
|
| 70 |
+
`TransformationTrait` requirements ([[meta.rqmts]]) with a member
|
| 71 |
+
typedef `type` that names the following type:
|
| 72 |
|
| 73 |
+
- for the first specialization, `add_const_t<`*`TE`*`>`,
|
| 74 |
+
- for the second specialization, `add_volatile_t<`*`TE`*`>`, and
|
| 75 |
+
- for the third specialization, `add_cv_t<`*`TE`*`>`.
|
| 76 |
+
|
| 77 |
+
In addition to being available via inclusion of the `<tuple>` header,
|
| 78 |
+
the three templates are available when either of the headers `<array>`
|
| 79 |
+
or `<utility>` are included.
|
| 80 |
|