From Jason Turner

[pair.astuple]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_lpl9fel/{from.md → to.md} +53 -8
tmp/tmp_lpl9fel/{from.md → to.md} RENAMED
@@ -1,15 +1,13 @@
1
  ### Tuple-like access to pair <a id="pair.astuple">[[pair.astuple]]</a>
2
 
3
  ``` cpp
4
- tuple_size<pair<T1, T2> >::value
 
 
5
  ```
6
 
7
- *Returns:* Integral constant expression.
8
-
9
- *Value:* 2.
10
-
11
  ``` cpp
12
  tuple_element<0, pair<T1, T2> >::type
13
  ```
14
 
15
  *Value:* the type `T1`.
@@ -20,22 +18,69 @@ tuple_element<1, pair<T1, T2> >::type
20
 
21
  *Value:* the type T2.
22
 
23
  ``` cpp
24
  template<size_t I, class T1, class T2>
25
- typename tuple_element<I, std::pair<T1, T2> >::type& get(pair<T1, T2>&) noexcept;
 
26
  template<size_t I, class T1, class T2>
27
- const typename tuple_element<I, std::pair<T1, T2> >::type& get(const pair<T1, T2>&) noexcept;
 
28
  ```
29
 
30
  *Returns:* If `I == 0` returns `p.first`; if `I == 1` returns
31
  `p.second`; otherwise the program is ill-formed.
32
 
33
  ``` cpp
34
  template<size_t I, class T1, class T2>
35
- typename tuple_element<I, std::pair<T1, T2> >::type&& get(std::pair<T1, T2>&&) noexcept;
 
36
  ```
37
 
38
  *Returns:* If `I == 0` returns `std::forward<T1&&>(p.first)`; if
39
  `I == 1` returns `std::forward<T2&&>(p.second)`; otherwise the program
40
  is ill-formed.
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ### Tuple-like access to pair <a id="pair.astuple">[[pair.astuple]]</a>
2
 
3
  ``` cpp
4
+ template <class T1, class T2>
5
+ struct tuple_size<pair<T1, T2>>
6
+ : integral_constant<size_t, 2> { };
7
  ```
8
 
 
 
 
 
9
  ``` cpp
10
  tuple_element<0, pair<T1, T2> >::type
11
  ```
12
 
13
  *Value:* the type `T1`.
 
18
 
19
  *Value:* the type T2.
20
 
21
  ``` cpp
22
  template<size_t I, class T1, class T2>
23
+ constexpr tuple_element_t<I, pair<T1, T2>>&
24
+ get(pair<T1, T2>& p) noexcept;
25
  template<size_t I, class T1, class T2>
26
+ constexpr const tuple_element_t<I, pair<T1, T2>>&
27
+ get(const pair<T1, T2>& p) noexcept;
28
  ```
29
 
30
  *Returns:* If `I == 0` returns `p.first`; if `I == 1` returns
31
  `p.second`; otherwise the program is ill-formed.
32
 
33
  ``` cpp
34
  template<size_t I, class T1, class T2>
35
+ constexpr tuple_element_t<I, pair<T1, T2>>&&
36
+ get(pair<T1, T2>&& p) noexcept;
37
  ```
38
 
39
  *Returns:* If `I == 0` returns `std::forward<T1&&>(p.first)`; if
40
  `I == 1` returns `std::forward<T2&&>(p.second)`; otherwise the program
41
  is ill-formed.
42
 
43
+ ``` cpp
44
+ template <class T, class U>
45
+ constexpr T& get(pair<T, U>& p) noexcept;
46
+ template <class T, class U>
47
+ constexpr const T& get(const pair<T, U>& p) noexcept;
48
+ ```
49
+
50
+ *Requires:* `T` and `U` are distinct types. Otherwise, the program is
51
+ ill-formed.
52
+
53
+ *Returns:* `get<0>(p);`
54
+
55
+ ``` cpp
56
+ template <class T, class U>
57
+ constexpr T&& get(pair<T, U>&& p) noexcept;
58
+ ```
59
+
60
+ *Requires:* `T` and `U` are distinct types. Otherwise, the program is
61
+ ill-formed.
62
+
63
+ *Returns:* `get<0>(std::move(p));`
64
+
65
+ ``` cpp
66
+ template <class T, class U>
67
+ constexpr T& get(pair<U, T>& p) noexcept;
68
+ template <class T, class U>
69
+ constexpr const T& get(const pair<U, T>& p) noexcept;
70
+ ```
71
+
72
+ *Requires:* `T` and `U` are distinct types. Otherwise, the program is
73
+ ill-formed.
74
+
75
+ *Returns:* `get<1>(p);`
76
+
77
+ ``` cpp
78
+ template <class T, class U>
79
+ constexpr T&& get(pair<U, T>&& p) noexcept;
80
+ ```
81
+
82
+ *Requires:* `T` and `U` are distinct types. Otherwise, the program is
83
+ ill-formed.
84
+
85
+ *Returns:* `get<1>(std::move(p));`
86
+