tmp/tmpkvy1z6cg/{from.md → to.md}
RENAMED
|
@@ -2,10 +2,11 @@
|
|
| 2 |
|
| 3 |
The header `<utility>` contains some basic function and class templates
|
| 4 |
that are used throughout the rest of the library.
|
| 5 |
|
| 6 |
``` cpp
|
|
|
|
| 7 |
#include <compare> // see [compare.syn]
|
| 8 |
#include <initializer_list> // see [initializer.list.syn]
|
| 9 |
|
| 10 |
namespace std {
|
| 11 |
// [utility.swap], swap
|
|
@@ -14,17 +15,19 @@ namespace std {
|
|
| 14 |
template<class T, size_t N>
|
| 15 |
constexpr void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
|
| 16 |
|
| 17 |
// [utility.exchange], exchange
|
| 18 |
template<class T, class U = T>
|
| 19 |
-
constexpr T exchange(T& obj, U&& new_val);
|
| 20 |
|
| 21 |
// [forward], forward/move
|
| 22 |
template<class T>
|
| 23 |
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
|
| 24 |
template<class T>
|
| 25 |
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
|
|
|
|
|
|
|
| 26 |
template<class T>
|
| 27 |
constexpr remove_reference_t<T>&& move(T&&) noexcept;
|
| 28 |
template<class T>
|
| 29 |
constexpr conditional_t<
|
| 30 |
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>, const T&, T&&>
|
|
@@ -56,10 +59,17 @@ namespace std {
|
|
| 56 |
constexpr bool cmp_greater_equal(T t, U u) noexcept;
|
| 57 |
|
| 58 |
template<class R, class T>
|
| 59 |
constexpr bool in_range(T t) noexcept;
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
// [intseq], compile-time integer sequences%
|
| 62 |
%
|
| 63 |
%
|
| 64 |
|
| 65 |
template<class T, T...>
|
|
@@ -77,20 +87,38 @@ namespace std {
|
|
| 77 |
|
| 78 |
// [pairs], class template pair
|
| 79 |
template<class T1, class T2>
|
| 80 |
struct pair;
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
// [pairs.spec], pair specialized algorithms
|
| 83 |
-
template<class T1, class T2>
|
| 84 |
-
constexpr bool operator==(const pair<T1, T2>&, const pair<
|
| 85 |
-
template<class T1, class T2>
|
| 86 |
-
constexpr common_comparison_category_t<synth-three-way-result<T1>,
|
| 87 |
-
synth-three-way-result<T2>>
|
| 88 |
-
operator<=>(const pair<T1, T2>&, const pair<
|
| 89 |
|
| 90 |
template<class T1, class T2>
|
| 91 |
constexpr void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
template<class T1, class T2>
|
| 94 |
constexpr see below make_pair(T1&&, T2&&);
|
| 95 |
|
| 96 |
// [pair.astuple], tuple-like access to pair
|
|
@@ -146,15 +174,15 @@ namespace std {
|
|
| 146 |
|
| 147 |
template<class T>
|
| 148 |
struct in_place_type_t {
|
| 149 |
explicit in_place_type_t() = default;
|
| 150 |
};
|
| 151 |
-
template<class T>
|
| 152 |
|
| 153 |
template<size_t I>
|
| 154 |
struct in_place_index_t {
|
| 155 |
explicit in_place_index_t() = default;
|
| 156 |
};
|
| 157 |
-
template<size_t I>
|
| 158 |
}
|
| 159 |
```
|
| 160 |
|
|
|
|
| 2 |
|
| 3 |
The header `<utility>` contains some basic function and class templates
|
| 4 |
that are used throughout the rest of the library.
|
| 5 |
|
| 6 |
``` cpp
|
| 7 |
+
// all freestanding
|
| 8 |
#include <compare> // see [compare.syn]
|
| 9 |
#include <initializer_list> // see [initializer.list.syn]
|
| 10 |
|
| 11 |
namespace std {
|
| 12 |
// [utility.swap], swap
|
|
|
|
| 15 |
template<class T, size_t N>
|
| 16 |
constexpr void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
|
| 17 |
|
| 18 |
// [utility.exchange], exchange
|
| 19 |
template<class T, class U = T>
|
| 20 |
+
constexpr T exchange(T& obj, U&& new_val) noexcept(see below);
|
| 21 |
|
| 22 |
// [forward], forward/move
|
| 23 |
template<class T>
|
| 24 |
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
|
| 25 |
template<class T>
|
| 26 |
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
|
| 27 |
+
template<class T, class U>
|
| 28 |
+
[[nodiscard]] constexpr auto forward_like(U&& x) noexcept -> see below;
|
| 29 |
template<class T>
|
| 30 |
constexpr remove_reference_t<T>&& move(T&&) noexcept;
|
| 31 |
template<class T>
|
| 32 |
constexpr conditional_t<
|
| 33 |
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>, const T&, T&&>
|
|
|
|
| 59 |
constexpr bool cmp_greater_equal(T t, U u) noexcept;
|
| 60 |
|
| 61 |
template<class R, class T>
|
| 62 |
constexpr bool in_range(T t) noexcept;
|
| 63 |
|
| 64 |
+
// [utility.underlying], to_underlying
|
| 65 |
+
template<class T>
|
| 66 |
+
constexpr underlying_type_t<T> to_underlying(T value) noexcept;
|
| 67 |
+
|
| 68 |
+
// [utility.unreachable], unreachable
|
| 69 |
+
[[noreturn]] void unreachable();
|
| 70 |
+
|
| 71 |
// [intseq], compile-time integer sequences%
|
| 72 |
%
|
| 73 |
%
|
| 74 |
|
| 75 |
template<class T, T...>
|
|
|
|
| 87 |
|
| 88 |
// [pairs], class template pair
|
| 89 |
template<class T1, class T2>
|
| 90 |
struct pair;
|
| 91 |
|
| 92 |
+
template<class T1, class T2, class U1, class U2,
|
| 93 |
+
template<class> class TQual, template<class> class UQual>
|
| 94 |
+
requires requires { typename pair<common_reference_t<TQual<T1>, UQual<U1>>,
|
| 95 |
+
common_reference_t<TQual<T2>, UQual<U2>>>; }
|
| 96 |
+
struct basic_common_reference<pair<T1, T2>, pair<U1, U2>, TQual, UQual> {
|
| 97 |
+
using type = pair<common_reference_t<TQual<T1>, UQual<U1>>,
|
| 98 |
+
common_reference_t<TQual<T2>, UQual<U2>>>;
|
| 99 |
+
};
|
| 100 |
+
|
| 101 |
+
template<class T1, class T2, class U1, class U2>
|
| 102 |
+
requires requires { typename pair<common_type_t<T1, U1>, common_type_t<T2, U2>>; }
|
| 103 |
+
struct common_type<pair<T1, T2>, pair<U1, U2>> {
|
| 104 |
+
using type = pair<common_type_t<T1, U1>, common_type_t<T2, U2>>;
|
| 105 |
+
};
|
| 106 |
+
|
| 107 |
// [pairs.spec], pair specialized algorithms
|
| 108 |
+
template<class T1, class T2, class U1, class U2>
|
| 109 |
+
constexpr bool operator==(const pair<T1, T2>&, const pair<U1, U2>&);
|
| 110 |
+
template<class T1, class T2, class U1, class U2>
|
| 111 |
+
constexpr common_comparison_category_t<synth-three-way-result<T1, U1>,
|
| 112 |
+
synth-three-way-result<T2, U2>>
|
| 113 |
+
operator<=>(const pair<T1, T2>&, const pair<U1, U2>&);
|
| 114 |
|
| 115 |
template<class T1, class T2>
|
| 116 |
constexpr void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
|
| 117 |
+
template<class T1, class T2>
|
| 118 |
+
constexpr void swap(const pair<T1, T2>& x, const pair<T1, T2>& y)
|
| 119 |
+
noexcept(noexcept(x.swap(y)));
|
| 120 |
|
| 121 |
template<class T1, class T2>
|
| 122 |
constexpr see below make_pair(T1&&, T2&&);
|
| 123 |
|
| 124 |
// [pair.astuple], tuple-like access to pair
|
|
|
|
| 174 |
|
| 175 |
template<class T>
|
| 176 |
struct in_place_type_t {
|
| 177 |
explicit in_place_type_t() = default;
|
| 178 |
};
|
| 179 |
+
template<class T> constexpr in_place_type_t<T> in_place_type{};
|
| 180 |
|
| 181 |
template<size_t I>
|
| 182 |
struct in_place_index_t {
|
| 183 |
explicit in_place_index_t() = default;
|
| 184 |
};
|
| 185 |
+
template<size_t I> constexpr in_place_index_t<I> in_place_index{};
|
| 186 |
}
|
| 187 |
```
|
| 188 |
|