From Jason Turner

[pairs.pair]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpzjuf78je/{from.md → to.md} +18 -14
tmp/tmpzjuf78je/{from.md → to.md} RENAMED
@@ -12,14 +12,14 @@ namespace std {
12
  T1 first;
13
  T2 second;
14
  pair(const pair&) = default;
15
  pair(pair&&) = default;
16
  constexpr pair();
17
- pair(const T1& x, const T2& y);
18
- template<class U, class V> pair(U&& x, V&& y);
19
- template<class U, class V> pair(const pair<U, V>& p);
20
- template<class U, class V> pair(pair<U, V>&& p);
21
  template <class... Args1, class... Args2>
22
  pair(piecewise_construct_t,
23
  tuple<Args1...> first_args, tuple<Args2...> second_args);
24
 
25
  pair& operator=(const pair& p);
@@ -30,14 +30,19 @@ namespace std {
30
  void swap(pair& p) noexcept(see below);
31
  };
32
  }
33
  ```
34
 
35
- Constructors and member function of `pair` shall not throw exceptions
36
  unless one of the element-wise operations specified to be called for
37
  that operation throws an exception.
38
 
 
 
 
 
 
39
  ``` cpp
40
  constexpr pair();
41
  ```
42
 
43
  *Requires:* `is_default_constructible<first_type>::value` is `true` and
@@ -45,21 +50,21 @@ constexpr pair();
45
  `ible<second_type>::value` is `true`.
46
 
47
  *Effects:* Value-initializes `first` and `second`.
48
 
49
  ``` cpp
50
- pair(const T1& x, const T2& y);
51
  ```
52
 
53
  *Requires:* `is_copy_constructible<first_type>::value` is `true` and
54
  `is_copy_constructible<second_type>::value` is `true`.
55
 
56
  *Effects:* The constructor initializes `first` with `x` and `second`
57
  with `y`.
58
 
59
  ``` cpp
60
- template<class U, class V> pair(U&& x, V&& y);
61
  ```
62
 
63
  *Requires:* `is_constructible<first_type, U&&>::value` is `true` and
64
  `is_constructible<second_type, V&&>::value` is `true`.
65
 
@@ -69,11 +74,11 @@ and `second` with `std::forward<V>(y)`.
69
  *Remarks:* If `U` is not implicitly convertible to `first_type` or `V`
70
  is not implicitly convertible to `second_type` this constructor shall
71
  not participate in overload resolution.
72
 
73
  ``` cpp
74
- template<class U, class V> pair(const pair<U, V>& p);
75
  ```
76
 
77
  *Requires:* `is_constructible<first_type, const U&>::value` is `true`
78
  and `is_constructible<second_type, const V&>::value` is `true`.
79
 
@@ -83,11 +88,11 @@ argument.
83
  This constructor shall not participate in overload resolution unless
84
  `const U&` is implicitly convertible to `first_type` and `const V&` is
85
  implicitly convertible to `second_type`.
86
 
87
  ``` cpp
88
- template<class U, class V> pair(pair<U, V>&& p);
89
  ```
90
 
91
  *Requires:* `is_constructible<first_type, U&&>::value` is `true` and
92
  `is_constructible<second_type, V&&>::value` is `true`.
93
 
@@ -103,13 +108,12 @@ convertible to `second_type`.
103
  template<class... Args1, class... Args2>
104
  pair(piecewise_construct_t,
105
  tuple<Args1...> first_args, tuple<Args2...> second_args);
106
  ```
107
 
108
- *Requires:* *Requires:*
109
- `is_constructible<first_type, Args1&&...>::value` is `true` and
110
- `is_constructible<second_type, Args2&&...>::value` is `true`.
111
 
112
  *Effects:* The constructor initializes `first` with arguments of types
113
  `Args1...` obtained by forwarding the elements of `first_args` and
114
  initializes `second` with arguments of types `Args2...` obtained by
115
  forwarding the elements of `second_args`. (Here, forwarding an element
@@ -131,12 +135,12 @@ pair& operator=(const pair& p);
131
 
132
  ``` cpp
133
  template<class U, class V> pair& operator=(const pair<U, V>& p);
134
  ```
135
 
136
- *Requires:* is_assignable\<first_type&, const U&\>::value is `true` and
137
- is_assignable\<second_type&, const V&\>::value is `true`.
138
 
139
  *Effects:* Assigns `p.first` to `first` and `p.second` to `second`.
140
 
141
  *Returns:* `*this`.
142
 
 
12
  T1 first;
13
  T2 second;
14
  pair(const pair&) = default;
15
  pair(pair&&) = default;
16
  constexpr pair();
17
+ constexpr pair(const T1& x, const T2& y);
18
+ template<class U, class V> constexpr pair(U&& x, V&& y);
19
+ template<class U, class V> constexpr pair(const pair<U, V>& p);
20
+ template<class U, class V> constexpr pair(pair<U, V>&& p);
21
  template <class... Args1, class... Args2>
22
  pair(piecewise_construct_t,
23
  tuple<Args1...> first_args, tuple<Args2...> second_args);
24
 
25
  pair& operator=(const pair& p);
 
30
  void swap(pair& p) noexcept(see below);
31
  };
32
  }
33
  ```
34
 
35
+ Constructors and member functions of `pair` shall not throw exceptions
36
  unless one of the element-wise operations specified to be called for
37
  that operation throws an exception.
38
 
39
+ The defaulted move and copy constructor, respectively, of pair shall be
40
+ a `constexpr` function if and only if all required element-wise
41
+ initializations for copy and move, respectively, would satisfy the
42
+ requirements for a `constexpr` function.
43
+
44
  ``` cpp
45
  constexpr pair();
46
  ```
47
 
48
  *Requires:* `is_default_constructible<first_type>::value` is `true` and
 
50
  `ible<second_type>::value` is `true`.
51
 
52
  *Effects:* Value-initializes `first` and `second`.
53
 
54
  ``` cpp
55
+ constexpr pair(const T1& x, const T2& y);
56
  ```
57
 
58
  *Requires:* `is_copy_constructible<first_type>::value` is `true` and
59
  `is_copy_constructible<second_type>::value` is `true`.
60
 
61
  *Effects:* The constructor initializes `first` with `x` and `second`
62
  with `y`.
63
 
64
  ``` cpp
65
+ template<class U, class V> constexpr pair(U&& x, V&& y);
66
  ```
67
 
68
  *Requires:* `is_constructible<first_type, U&&>::value` is `true` and
69
  `is_constructible<second_type, V&&>::value` is `true`.
70
 
 
74
  *Remarks:* If `U` is not implicitly convertible to `first_type` or `V`
75
  is not implicitly convertible to `second_type` this constructor shall
76
  not participate in overload resolution.
77
 
78
  ``` cpp
79
+ template<class U, class V> constexpr pair(const pair<U, V>& p);
80
  ```
81
 
82
  *Requires:* `is_constructible<first_type, const U&>::value` is `true`
83
  and `is_constructible<second_type, const V&>::value` is `true`.
84
 
 
88
  This constructor shall not participate in overload resolution unless
89
  `const U&` is implicitly convertible to `first_type` and `const V&` is
90
  implicitly convertible to `second_type`.
91
 
92
  ``` cpp
93
+ template<class U, class V> constexpr pair(pair<U, V>&& p);
94
  ```
95
 
96
  *Requires:* `is_constructible<first_type, U&&>::value` is `true` and
97
  `is_constructible<second_type, V&&>::value` is `true`.
98
 
 
108
  template<class... Args1, class... Args2>
109
  pair(piecewise_construct_t,
110
  tuple<Args1...> first_args, tuple<Args2...> second_args);
111
  ```
112
 
113
+ *Requires:* `is_constructible<first_type, Args1&&...>::value` is `true`
114
+ and `is_constructible<second_type, Args2&&...>::value` is `true`.
 
115
 
116
  *Effects:* The constructor initializes `first` with arguments of types
117
  `Args1...` obtained by forwarding the elements of `first_args` and
118
  initializes `second` with arguments of types `Args2...` obtained by
119
  forwarding the elements of `second_args`. (Here, forwarding an element
 
135
 
136
  ``` cpp
137
  template<class U, class V> pair& operator=(const pair<U, V>& p);
138
  ```
139
 
140
+ *Requires:* `is_assignable<first_type&, const U&>::value` is `true` and
141
+ `is_assignable<second_type&, const V&>::value` is `true`.
142
 
143
  *Effects:* Assigns `p.first` to `first` and `p.second` to `second`.
144
 
145
  *Returns:* `*this`.
146