|
22 | 22 |
|
23 | 23 | namespace hpx::experimental::util {
|
24 | 24 |
|
25 |
| -#if defined(__cpp_lib_trivially_relocatable) |
26 |
| - using std::uninitialized_relocate; |
27 |
| -#else |
| 25 | + namespace detail { // Utility metafunctions |
28 | 26 |
|
29 |
| - namespace detail { |
30 | 27 | struct buffer_memcpy_tag
|
31 | 28 | {
|
32 | 29 | };
|
@@ -81,7 +78,96 @@ namespace hpx::experimental::util {
|
81 | 78 | >;
|
82 | 79 | // clang-format on
|
83 | 80 | };
|
| 81 | + } // namespace detail |
| 82 | + |
| 83 | +#if defined(HPX_HAVE_P1144_RELOCATE_AT) |
| 84 | + ////////////////////////////// |
| 85 | + // uninitialized_relocate_n // |
| 86 | + ////////////////////////////// |
| 87 | + template <typename InIter, typename FwdIter, typename Size, |
| 88 | + typename Dummy> // Dummy is used retain the same signature |
| 89 | + // as the implementation before P1144 |
| 90 | + // clang-format off |
| 91 | + std::tuple<InIter, FwdIter> uninitialized_relocate_n_primitive(InIter first, Size n, |
| 92 | + FwdIter dst, Dummy) noexcept( |
| 93 | + detail::relocation_traits<InIter, FwdIter>::is_noexcept_relocatable_v) |
| 94 | + // clang-format on |
| 95 | + { |
| 96 | + static_assert( |
| 97 | + detail::relocation_traits<InIter, FwdIter>::valid_relocation, |
| 98 | + "uninitialized_move(first, last, dst) must be well-formed"); |
| 99 | + |
| 100 | + return std::uninitialized_relocate_n(first, n, dst); |
| 101 | + } |
| 102 | + |
| 103 | + template <typename InIter, typename Size, typename FwdIter> |
| 104 | + std::tuple<InIter, FwdIter> uninitialized_relocate_n_primitive(InIter first, |
| 105 | + Size n, FwdIter dst) noexcept(detail::relocation_traits<InIter, |
| 106 | + FwdIter>::is_noexcept_relocatable_v) |
| 107 | + { |
| 108 | + return uninitialized_relocate_n_primitive(first, n, dst, bool{}); |
| 109 | + } |
| 110 | + |
| 111 | + //////////////////////////// |
| 112 | + // uninitialized_relocate // |
| 113 | + //////////////////////////// |
| 114 | + template <typename InIter, typename Sent, typename FwdIter, |
| 115 | + typename Dummy> // Dummy is used retain the same signature |
| 116 | + // as the implementation before P1144 |
| 117 | + // clang-format off |
| 118 | + std::tuple<InIter, FwdIter> uninitialized_relocate_primitive(InIter first, Sent last, |
| 119 | + FwdIter dst, Dummy) noexcept( |
| 120 | + detail::relocation_traits<InIter, FwdIter>::is_noexcept_relocatable_v) |
| 121 | + // clang-format on |
| 122 | + { |
| 123 | + // TODO CHECK SENT |
| 124 | + static_assert( |
| 125 | + detail::relocation_traits<InIter, FwdIter>::valid_relocation, |
| 126 | + "uninitialized_move(first, last, dst) must be well-formed"); |
| 127 | + |
| 128 | + return std::uninitialized_relocate(first, last, dst); |
| 129 | + } |
| 130 | + |
| 131 | + template <typename InIter, typename Sent, typename FwdIter> |
| 132 | + std::tuple<InIter, FwdIter> uninitialized_relocate_primitive(InIter first, |
| 133 | + Sent last, FwdIter dst) noexcept(detail::relocation_traits<InIter, |
| 134 | + FwdIter>::is_noexcept_relocatable_v) |
| 135 | + { |
| 136 | + return uninitialized_relocate_primitive(first, last, dst, bool{}); |
| 137 | + } |
| 138 | + |
| 139 | + ///////////////////////////////////// |
| 140 | + // uninitialized_relocate_backward // |
| 141 | + ///////////////////////////////////// |
| 142 | + template <typename BiIter1, typename BiIter2, |
| 143 | + typename Dummy> // Dummy is used retain the same signature |
| 144 | + // as the implementation before P1144 |
| 145 | + // clang-format off |
| 146 | + std::tuple<BiIter1, BiIter2> uninitialized_relocate_backward_primitive(BiIter1 first, BiIter1 last, |
| 147 | + BiIter2 dst_last, Dummy) noexcept( |
| 148 | + detail::relocation_traits<BiIter1, BiIter2>::is_noexcept_relocatable_v) |
| 149 | + // clang-format on |
| 150 | + { |
| 151 | + // TODO CHECK SENT |
| 152 | + static_assert( |
| 153 | + detail::relocation_traits<BiIter1, BiIter2>::valid_relocation, |
| 154 | + "uninitialized_move(first, last, dst) must be well-formed"); |
| 155 | + |
| 156 | + return std::uninitialized_relocate_backward(first, last, dst_last); |
| 157 | + } |
84 | 158 |
|
| 159 | + template <typename BiIter1, typename BiIter2> |
| 160 | + std::tuple<BiIter1, BiIter2> uninitialized_relocate_backward_primitive( |
| 161 | + BiIter1 first, BiIter1 last, |
| 162 | + BiIter2 dst_last) noexcept(detail::relocation_traits<BiIter1, |
| 163 | + BiIter2>::is_noexcept_relocatable_v) |
| 164 | + { |
| 165 | + return uninitialized_relocate_backward_primitive( |
| 166 | + first, last, dst_last, bool{}); |
| 167 | + } |
| 168 | +#else |
| 169 | + |
| 170 | + namespace detail { |
85 | 171 | //////////////////////////////
|
86 | 172 | // uninitialized_relocate_n //
|
87 | 173 | //////////////////////////////
|
|
0 commit comments