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