From Jason Turner

[tuple.cnstr]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3udrngsc/{from.md → to.md} +88 -63
tmp/tmp3udrngsc/{from.md → to.md} RENAMED
@@ -2,149 +2,174 @@
2
 
3
  For each `tuple` constructor, an exception is thrown only if the
4
  construction of one of the types in `Types` throws an exception.
5
 
6
  The defaulted move and copy constructor, respectively, of `tuple` shall
7
- be a `constexpr` function if and only if all required element-wise
8
  initializations for copy and move, respectively, would satisfy the
9
- requirements for a `constexpr` function. The defaulted move and copy
10
- constructor of `tuple<>` shall be `constexpr` functions.
 
 
 
11
 
12
  In the constructor descriptions that follow, let i be in the range
13
- \[`0`, `sizeof...(Types)`) in order, Tᵢ be the iᵗʰ type in `Types`, and
14
- Uᵢ be the iᵗʰ type in a template parameter pack named `UTypes`, where
15
- indexing is zero-based.
16
 
17
  ``` cpp
18
- constexpr tuple();
19
  ```
20
 
21
- *Requires:* `is_default_constructible<`Tᵢ`>::value` is true for all i.
22
 
23
- *Effects:* Value initializes each element.
 
 
 
 
 
 
 
 
 
 
24
 
25
  ``` cpp
26
- constexpr explicit tuple(const Types&...);
27
  ```
28
 
29
- *Requires:* `is_copy_constructible<`Tᵢ`>::value` is true for all i.
30
-
31
  *Effects:* Initializes each element with the value of the corresponding
32
  parameter.
33
 
 
 
 
 
 
34
  ``` cpp
35
- template <class... UTypes>
36
- constexpr explicit tuple(UTypes&&... u);
37
  ```
38
 
39
- *Requires:* `sizeof...(Types)` `==` `sizeof...(UTypes)`.
40
- `is_constructible<`Tᵢ`, `Uᵢ`&&>::value` is `true` for all i.
41
-
42
  *Effects:* Initializes the elements in the tuple with the corresponding
43
  value in `std::forward<UTypes>(u)`.
44
 
45
- This constructor shall not participate in overload resolution unless
46
- each type in `UTypes` is implicitly convertible to its corresponding
47
- type in `Types`.
 
 
48
 
49
  ``` cpp
50
  tuple(const tuple& u) = default;
51
  ```
52
 
53
- *Requires:* `is_copy_constructible<`Tᵢ`>::value` is `true` for all i.
54
 
55
  *Effects:* Initializes each element of `*this` with the corresponding
56
  element of `u`.
57
 
58
  ``` cpp
59
  tuple(tuple&& u) = default;
60
  ```
61
 
62
- *Requires:* `is_move_constructible<`Tᵢ`>::value` is `true` for all i.
63
 
64
  *Effects:* For all i, initializes the iᵗʰ element of `*this` with
65
- `std::forward<`Tᵢ`>(get<`i`>(u))`.
66
 
67
  ``` cpp
68
- template <class... UTypes> constexpr tuple(const tuple<UTypes...>& u);
69
  ```
70
 
71
- *Requires:* `sizeof...(Types)` `==` `sizeof...(UTypes)`.
72
- `is_constructible<`Tᵢ`, const `Uᵢ`&>::value` is `true` for all i.
73
-
74
- *Effects:* Constructs each element of `*this` with the corresponding
75
  element of `u`.
76
 
77
- This constructor shall not participate in overload resolution unless
78
- `const `Uᵢ`&` is implicitly convertible to Tᵢ for all i.
 
 
 
 
 
 
 
 
 
 
79
 
80
  ``` cpp
81
- template <class... UTypes> constexpr tuple(tuple<UTypes...>&& u);
82
  ```
83
 
84
- *Requires:* `sizeof...(Types)` `==` `sizeof...(UTypes)`.
85
- `is_constructible<`Tᵢ`, `Uᵢ`&&>::value` is `true` for all i.
86
-
87
  *Effects:* For all i, initializes the iᵗʰ element of `*this` with
88
- `std::forward<`Uᵢ`>(get<`i`>(u))`.
89
 
90
- This constructor shall not participate in overload resolution unless
91
- each type in `UTypes` is implicitly convertible to its corresponding
92
- type in `Types`.
 
 
 
 
 
 
 
 
 
93
 
94
  ``` cpp
95
- template <class U1, class U2> constexpr tuple(const pair<U1, U2>& u);
96
  ```
97
 
98
- *Requires:* `sizeof...(Types) == 2`.
99
- `is_constructible<`T₀`, const U1&>::value` is `true` for the first type
100
- T₀ in `Types` and `is_constructible<`T₁`, const U2&>::value` is `true`
101
- for the second type T₁ in `Types`.
102
-
103
- *Effects:* Constructs the first element with `u.first` and the second
104
  element with `u.second`.
105
 
106
- This constructor shall not participate in overload resolution unless
107
- `const U1&` is implicitly convertible to T₀ and `const U2&` is
108
- implicitly convertible to T₁.
 
 
 
 
109
 
110
  ``` cpp
111
- template <class U1, class U2> constexpr tuple(pair<U1, U2>&& u);
112
  ```
113
 
114
- *Requires:* `sizeof...(Types) == 2`.
115
- `is_constructible<`T₀`, U1&&>::value` is `true` for the first type T₀ in
116
- `Types` and `is_constructible<`T₁`, U2&&>::value` is `true` for the
117
- second type T₁ in `Types`.
118
-
119
  *Effects:* Initializes the first element with
120
  `std::forward<U1>(u.first)` and the second element with
121
  `std::forward<U2>(u.second)`.
122
 
123
- This constructor shall not participate in overload resolution unless
124
- `U1` is implicitly convertible to T₀ and `U2` is implicitly convertible
125
- to T₁.
 
 
 
 
126
 
127
  ``` cpp
128
  template <class Alloc>
129
  tuple(allocator_arg_t, const Alloc& a);
130
  template <class Alloc>
131
- tuple(allocator_arg_t, const Alloc& a, const Types&...);
132
  template <class Alloc, class... UTypes>
133
- tuple(allocator_arg_t, const Alloc& a, UTypes&&...);
134
  template <class Alloc>
135
  tuple(allocator_arg_t, const Alloc& a, const tuple&);
136
  template <class Alloc>
137
  tuple(allocator_arg_t, const Alloc& a, tuple&&);
138
  template <class Alloc, class... UTypes>
139
- tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&);
140
  template <class Alloc, class... UTypes>
141
- tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&&);
142
  template <class Alloc, class U1, class U2>
143
- tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
144
  template <class Alloc, class U1, class U2>
145
- tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
146
  ```
147
 
148
  *Requires:* `Alloc` shall meet the requirements for an
149
  `Allocator` ([[allocator.requirements]]).
150
 
 
2
 
3
  For each `tuple` constructor, an exception is thrown only if the
4
  construction of one of the types in `Types` throws an exception.
5
 
6
  The defaulted move and copy constructor, respectively, of `tuple` shall
7
+ be a constexpr function if and only if all required element-wise
8
  initializations for copy and move, respectively, would satisfy the
9
+ requirements for a constexpr function. The defaulted move and copy
10
+ constructor of `tuple<>` shall be constexpr functions.
11
+
12
+ The destructor of tuple shall be a trivial destructor if
13
+ `(is_trivially_destructible_v<Types> && ...)` is `true`.
14
 
15
  In the constructor descriptions that follow, let i be in the range
16
+ \[`0`, `sizeof...(Types)`) in order, `Tᵢ` be the iᵗʰ type in `Types`,
17
+ and `Uᵢ` be the iᵗʰ type in a template parameter pack named `UTypes`,
18
+ where indexing is zero-based.
19
 
20
  ``` cpp
21
+ \EXPLICIT constexpr tuple();
22
  ```
23
 
24
+ *Effects:* Value-initializes each element.
25
 
26
+ *Remarks:* This constructor shall not participate in overload resolution
27
+ unless `is_default_constructible_v<``Tᵢ``>` is `true` for all i.
28
+
29
+ [*Note 1*: This behavior can be implemented by a constructor template
30
+ with default template arguments. — *end note*]
31
+
32
+ The constructor is explicit if and only if `Tᵢ` is not implicitly
33
+ default-constructible for at least one i.
34
+
35
+ [*Note 2*: This behavior can be implemented with a trait that checks
36
+ whether a `const ``Tᵢ``&` can be initialized with `{}`. — *end note*]
37
 
38
  ``` cpp
39
+ \EXPLICIT constexpr tuple(const Types&...);
40
  ```
41
 
 
 
42
  *Effects:* Initializes each element with the value of the corresponding
43
  parameter.
44
 
45
+ *Remarks:* This constructor shall not participate in overload resolution
46
+ unless `sizeof...(Types) >= 1` and `is_copy_constructible_v<``Tᵢ``>` is
47
+ `true` for all i. The constructor is explicit if and only if
48
+ `is_convertible_v<const ``Tᵢ``&, ``Tᵢ``>` is `false` for at least one i.
49
+
50
  ``` cpp
51
+ template <class... UTypes> \EXPLICIT constexpr tuple(UTypes&&... u);
 
52
  ```
53
 
 
 
 
54
  *Effects:* Initializes the elements in the tuple with the corresponding
55
  value in `std::forward<UTypes>(u)`.
56
 
57
+ *Remarks:* This constructor shall not participate in overload resolution
58
+ unless `sizeof...(Types)` `==` `sizeof...(UTypes)` and
59
+ `sizeof...(Types) >= 1` and `is_constructible_v<``Tᵢ``, ``Uᵢ``&&>` is
60
+ `true` for all i. The constructor is explicit if and only if
61
+ `is_convertible_v<``Uᵢ``&&, ``Tᵢ``>` is `false` for at least one i.
62
 
63
  ``` cpp
64
  tuple(const tuple& u) = default;
65
  ```
66
 
67
+ *Requires:* `is_copy_constructible_v<``Tᵢ``>` is `true` for all i.
68
 
69
  *Effects:* Initializes each element of `*this` with the corresponding
70
  element of `u`.
71
 
72
  ``` cpp
73
  tuple(tuple&& u) = default;
74
  ```
75
 
76
+ *Requires:* `is_move_constructible_v<``Tᵢ``>` is `true` for all i.
77
 
78
  *Effects:* For all i, initializes the iᵗʰ element of `*this` with
79
+ `std::forward<``Tᵢ``>(get<`i`>(u))`.
80
 
81
  ``` cpp
82
+ template <class... UTypes> \EXPLICIT constexpr tuple(const tuple<UTypes...>& u);
83
  ```
84
 
85
+ *Effects:* Initializes each element of `*this` with the corresponding
 
 
 
86
  element of `u`.
87
 
88
+ *Remarks:* This constructor shall not participate in overload resolution
89
+ unless
90
+
91
+ - `sizeof...(Types)` `==` `sizeof...(UTypes)` and
92
+ - `is_constructible_v<``Tᵢ``, const ``Uᵢ``&>` is `true` for all i, and
93
+ - `sizeof...(Types) != 1`, or (when `Types...` expands to `T` and
94
+ `UTypes...` expands to `U`)
95
+ `!is_convertible_v<const tuple<U>&, T> && !is_constructible_v<T, const tuple<U>&>&& !is_same_v<T, U>`
96
+ is `true`.
97
+
98
+ The constructor is explicit if and only if
99
+ `is_convertible_v<const ``Uᵢ``&, ``Tᵢ``>` is `false` for at least one i.
100
 
101
  ``` cpp
102
+ template <class... UTypes> \EXPLICIT constexpr tuple(tuple<UTypes...>&& u);
103
  ```
104
 
 
 
 
105
  *Effects:* For all i, initializes the iᵗʰ element of `*this` with
106
+ `std::forward<``Uᵢ``>(get<`i`>(u))`.
107
 
108
+ *Remarks:* This constructor shall not participate in overload resolution
109
+ unless
110
+
111
+ - `sizeof...(Types)` `==` `sizeof...(UTypes)`, and
112
+ - `is_constructible_v<``Tᵢ``, ``Uᵢ``&&>` is `true` for all i, and
113
+ - `sizeof...(Types) != 1`, or (when `Types...` expands to `T` and
114
+ `UTypes...` expands to `U`)
115
+ `!is_convertible_v<tuple<U>, T> && !is_constructible_v<T, tuple<U>> &&!is_same_v<T, U>`
116
+ is `true`.
117
+
118
+ The constructor is explicit if and only if
119
+ `is_convertible_v<``Uᵢ``&&, ``Tᵢ``>` is `false` for at least one i.
120
 
121
  ``` cpp
122
+ template <class U1, class U2> \EXPLICIT constexpr tuple(const pair<U1, U2>& u);
123
  ```
124
 
125
+ *Effects:* Initializes the first element with `u.first` and the second
 
 
 
 
 
126
  element with `u.second`.
127
 
128
+ *Remarks:* This constructor shall not participate in overload resolution
129
+ unless `sizeof...(Types) == 2`, `is_constructible_v<``T₀``, const U1&>`
130
+ is `true` and `is_constructible_v<``T₁``, const U2&>` is `true`.
131
+
132
+ The constructor is explicit if and only if
133
+ `is_convertible_v<const U1&, ``T₀``>` is `false` or
134
+ `is_convertible_v<const U2&, ``T₁``>` is `false`.
135
 
136
  ``` cpp
137
+ template <class U1, class U2> \EXPLICIT constexpr tuple(pair<U1, U2>&& u);
138
  ```
139
 
 
 
 
 
 
140
  *Effects:* Initializes the first element with
141
  `std::forward<U1>(u.first)` and the second element with
142
  `std::forward<U2>(u.second)`.
143
 
144
+ *Remarks:* This constructor shall not participate in overload resolution
145
+ unless `sizeof...(Types) == 2`, `is_constructible_v<``T₀``, U1&&>` is
146
+ `true` and `is_constructible_v<``T₁``, U2&&>` is `true`.
147
+
148
+ The constructor is explicit if and only if
149
+ `is_convertible_v<U1&&, ``T₀``>` is `false` or
150
+ `is_convertible_v<U2&&, ``T₁``>` is `false`.
151
 
152
  ``` cpp
153
  template <class Alloc>
154
  tuple(allocator_arg_t, const Alloc& a);
155
  template <class Alloc>
156
+ \EXPLICIT tuple(allocator_arg_t, const Alloc& a, const Types&...);
157
  template <class Alloc, class... UTypes>
158
+ \EXPLICIT tuple(allocator_arg_t, const Alloc& a, UTypes&&...);
159
  template <class Alloc>
160
  tuple(allocator_arg_t, const Alloc& a, const tuple&);
161
  template <class Alloc>
162
  tuple(allocator_arg_t, const Alloc& a, tuple&&);
163
  template <class Alloc, class... UTypes>
164
+ \EXPLICIT tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&);
165
  template <class Alloc, class... UTypes>
166
+ \EXPLICIT tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&&);
167
  template <class Alloc, class U1, class U2>
168
+ \EXPLICIT tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
169
  template <class Alloc, class U1, class U2>
170
+ \EXPLICIT tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
171
  ```
172
 
173
  *Requires:* `Alloc` shall meet the requirements for an
174
  `Allocator` ([[allocator.requirements]]).
175