| author | |
| committer | |
| log | 619fd6c518c3d5a9f7189de479532526f253c805 |
| tree | 1e600435f57897293ebf332b62b9532ba32463e7 |
| parent | a072d6021653db952bffd93e7c8704ead9ac106d |
| signature |
623 files changed, 13815 insertions(+), 9409 deletions(-)
lib/libcxx/include/__algorithm/clamp.h+4-2| ... | @@ -17,9 +17,10 @@ | ... | @@ -17,9 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | #if _LIBCPP_STD_VER >= 17 | ||
| 21 | |||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 23 | ||
| 22 | #if _LIBCPP_STD_VER >= 17 | ||
| 23 | template <class _Tp, class _Compare> | 24 | template <class _Tp, class _Compare> |
| 24 | [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& | 25 | [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& |
| 25 | clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v, | 26 | clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v, |
| ... | @@ -37,8 +38,9 @@ clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v, | ... | @@ -37,8 +38,9 @@ clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v, |
| 37 | _LIBCPP_LIFETIMEBOUND const _Tp& __hi) { | 38 | _LIBCPP_LIFETIMEBOUND const _Tp& __hi) { |
| 38 | return std::clamp(__v, __lo, __hi, __less<>()); | 39 | return std::clamp(__v, __lo, __hi, __less<>()); |
| 39 | } | 40 | } |
| 40 | #endif | ||
| 41 | 41 | ||
| 42 | _LIBCPP_END_NAMESPACE_STD | 42 | _LIBCPP_END_NAMESPACE_STD |
| 43 | 43 | ||
| 44 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 45 | |||
| 44 | #endif // _LIBCPP___ALGORITHM_CLAMP_H | 46 | #endif // _LIBCPP___ALGORITHM_CLAMP_H |
lib/libcxx/include/__algorithm/copy.h+16-15| ... | @@ -11,6 +11,7 @@ | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | ||
| 12 | #include <__algorithm/copy_move_common.h> | 12 | #include <__algorithm/copy_move_common.h> |
| 13 | #include <__algorithm/for_each_segment.h> | 13 | #include <__algorithm/for_each_segment.h> |
| 14 | #include <__algorithm/in_out_result.h> | ||
| 14 | #include <__algorithm/min.h> | 15 | #include <__algorithm/min.h> |
| 15 | #include <__algorithm/specialized_algorithms.h> | 16 | #include <__algorithm/specialized_algorithms.h> |
| 16 | #include <__config> | 17 | #include <__config> |
| ... | @@ -19,7 +20,6 @@ | ... | @@ -19,7 +20,6 @@ |
| 19 | #include <__type_traits/common_type.h> | 20 | #include <__type_traits/common_type.h> |
| 20 | #include <__type_traits/enable_if.h> | 21 | #include <__type_traits/enable_if.h> |
| 21 | #include <__utility/move.h> | 22 | #include <__utility/move.h> |
| 22 | #include <__utility/pair.h> | ||
| 23 | 23 | ||
| 24 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 24 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 25 | # pragma GCC system_header | 25 | # pragma GCC system_header |
| ... | @@ -35,7 +35,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | ... | @@ -35,7 +35,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator |
| 35 | copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result); | 35 | copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result); |
| 36 | 36 | ||
| 37 | template <class _InIter, class _Sent, class _OutIter> | 37 | template <class _InIter, class _Sent, class _OutIter> |
| 38 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> __copy(_InIter, _Sent, _OutIter); | 38 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 39 | __copy(_InIter, _Sent, _OutIter); | ||
| 39 | 40 | ||
| 40 | struct __copy_impl { | 41 | struct __copy_impl { |
| 41 | template <class _InIter, | 42 | template <class _InIter, |
| ... | @@ -45,7 +46,7 @@ struct __copy_impl { | ... | @@ -45,7 +46,7 @@ struct __copy_impl { |
| 45 | __iterator_pair<_InIter, _Sent>, | 46 | __iterator_pair<_InIter, _Sent>, |
| 46 | __single_iterator<_OutIter> >::__has_algorithm, | 47 | __single_iterator<_OutIter> >::__has_algorithm, |
| 47 | int> = 0> | 48 | int> = 0> |
| 48 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 49 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 49 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { | 50 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { |
| 50 | while (__first != __last) { | 51 | while (__first != __last) { |
| 51 | *__result = *__first; | 52 | *__result = *__first; |
| ... | @@ -53,7 +54,7 @@ struct __copy_impl { | ... | @@ -53,7 +54,7 @@ struct __copy_impl { |
| 53 | ++__result; | 54 | ++__result; |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | return std::make_pair(std::move(__first), std::move(__result)); | 57 | return {std::move(__first), std::move(__result)}; |
| 57 | } | 58 | } |
| 58 | 59 | ||
| 59 | template <class _InIter, | 60 | template <class _InIter, |
| ... | @@ -63,20 +64,20 @@ struct __copy_impl { | ... | @@ -63,20 +64,20 @@ struct __copy_impl { |
| 63 | __iterator_pair<_InIter, _Sent>, | 64 | __iterator_pair<_InIter, _Sent>, |
| 64 | __single_iterator<_OutIter> >::__has_algorithm, | 65 | __single_iterator<_OutIter> >::__has_algorithm, |
| 65 | int> = 0> | 66 | int> = 0> |
| 66 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static pair<_InIter, _OutIter> | 67 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static __in_out_result<_InIter, _OutIter> |
| 67 | operator()(_InIter __first, _Sent __last, _OutIter __result) { | 68 | operator()(_InIter __first, _Sent __last, _OutIter __result) { |
| 68 | return __specialized_algorithm<_Algorithm::__copy, __iterator_pair<_InIter, _Sent>, __single_iterator<_OutIter> >()( | 69 | return __specialized_algorithm<_Algorithm::__copy, __iterator_pair<_InIter, _Sent>, __single_iterator<_OutIter> >()( |
| 69 | std::move(__first), std::move(__last), std::move(__result)); | 70 | std::move(__first), std::move(__last), std::move(__result)); |
| 70 | } | 71 | } |
| 71 | 72 | ||
| 72 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0> | 73 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0> |
| 73 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 74 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 74 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | 75 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { |
| 75 | using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator; | 76 | using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator; |
| 76 | std::__for_each_segment(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) { | 77 | std::__for_each_segment(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) { |
| 77 | __result = std::__copy(std::move(__lfirst), std::move(__llast), std::move(__result)).second; | 78 | __result = std::__copy(std::move(__lfirst), std::move(__llast), std::move(__result)).__out_; |
| 78 | }); | 79 | }); |
| 79 | return std::make_pair(__last, std::move(__result)); | 80 | return {__last, std::move(__result)}; |
| 80 | } | 81 | } |
| 81 | 82 | ||
| 82 | template <class _InIter, | 83 | template <class _InIter, |
| ... | @@ -84,14 +85,14 @@ struct __copy_impl { | ... | @@ -84,14 +85,14 @@ struct __copy_impl { |
| 84 | __enable_if_t<__has_random_access_iterator_category<_InIter>::value && | 85 | __enable_if_t<__has_random_access_iterator_category<_InIter>::value && |
| 85 | !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>, | 86 | !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>, |
| 86 | int> = 0> | 87 | int> = 0> |
| 87 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 88 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 88 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | 89 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { |
| 89 | using _Traits = __segmented_iterator_traits<_OutIter>; | 90 | using _Traits = __segmented_iterator_traits<_OutIter>; |
| 90 | using _DiffT = | 91 | using _DiffT = |
| 91 | typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type; | 92 | typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type; |
| 92 | 93 | ||
| 93 | if (__first == __last) | 94 | if (__first == __last) |
| 94 | return std::make_pair(std::move(__first), std::move(__result)); | 95 | return {std::move(__first), std::move(__result)}; |
| 95 | 96 | ||
| 96 | auto __local_first = _Traits::__local(__result); | 97 | auto __local_first = _Traits::__local(__result); |
| 97 | auto __segment_iterator = _Traits::__segment(__result); | 98 | auto __segment_iterator = _Traits::__segment(__result); |
| ... | @@ -99,10 +100,10 @@ struct __copy_impl { | ... | @@ -99,10 +100,10 @@ struct __copy_impl { |
| 99 | auto __local_last = _Traits::__end(__segment_iterator); | 100 | auto __local_last = _Traits::__end(__segment_iterator); |
| 100 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); | 101 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); |
| 101 | auto __iters = std::__copy(__first, __first + __size, __local_first); | 102 | auto __iters = std::__copy(__first, __first + __size, __local_first); |
| 102 | __first = std::move(__iters.first); | 103 | __first = std::move(__iters.__in_); |
| 103 | 104 | ||
| 104 | if (__first == __last) | 105 | if (__first == __last) |
| 105 | return std::make_pair(std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.second))); | 106 | return {std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.__out_))}; |
| 106 | 107 | ||
| 107 | __local_first = _Traits::__begin(++__segment_iterator); | 108 | __local_first = _Traits::__begin(++__segment_iterator); |
| 108 | } | 109 | } |
| ... | @@ -110,14 +111,14 @@ struct __copy_impl { | ... | @@ -110,14 +111,14 @@ struct __copy_impl { |
| 110 | 111 | ||
| 111 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. | 112 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. |
| 112 | template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0> | 113 | template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0> |
| 113 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*> | 114 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*> |
| 114 | operator()(_In* __first, _In* __last, _Out* __result) const { | 115 | operator()(_In* __first, _In* __last, _Out* __result) const { |
| 115 | return std::__copy_trivial_impl(__first, __last, __result); | 116 | return std::__copy_trivial_impl(__first, __last, __result); |
| 116 | } | 117 | } |
| 117 | }; | 118 | }; |
| 118 | 119 | ||
| 119 | template <class _InIter, class _Sent, class _OutIter> | 120 | template <class _InIter, class _Sent, class _OutIter> |
| 120 | pair<_InIter, _OutIter> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | 121 | __in_out_result<_InIter, _OutIter> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 |
| 121 | __copy(_InIter __first, _Sent __last, _OutIter __result) { | 122 | __copy(_InIter __first, _Sent __last, _OutIter __result) { |
| 122 | return std::__copy_move_unwrap_iters<__copy_impl>(std::move(__first), std::move(__last), std::move(__result)); | 123 | return std::__copy_move_unwrap_iters<__copy_impl>(std::move(__first), std::move(__last), std::move(__result)); |
| 123 | } | 124 | } |
| ... | @@ -125,7 +126,7 @@ __copy(_InIter __first, _Sent __last, _OutIter __result) { | ... | @@ -125,7 +126,7 @@ __copy(_InIter __first, _Sent __last, _OutIter __result) { |
| 125 | template <class _InputIterator, class _OutputIterator> | 126 | template <class _InputIterator, class _OutputIterator> |
| 126 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | 127 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator |
| 127 | copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { | 128 | copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { |
| 128 | return std::__copy(__first, __last, __result).second; | 129 | return std::__copy(__first, __last, __result).__out_; |
| 129 | } | 130 | } |
| 130 | 131 | ||
| 131 | _LIBCPP_END_NAMESPACE_STD | 132 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/copy_backward.h+18-17| ... | @@ -12,6 +12,7 @@ | ... | @@ -12,6 +12,7 @@ |
| 12 | #include <__algorithm/copy_move_common.h> | 12 | #include <__algorithm/copy_move_common.h> |
| 13 | #include <__algorithm/copy_n.h> | 13 | #include <__algorithm/copy_n.h> |
| 14 | #include <__algorithm/for_each_segment.h> | 14 | #include <__algorithm/for_each_segment.h> |
| 15 | #include <__algorithm/in_out_result.h> | ||
| 15 | #include <__algorithm/iterator_operations.h> | 16 | #include <__algorithm/iterator_operations.h> |
| 16 | #include <__algorithm/min.h> | 17 | #include <__algorithm/min.h> |
| 17 | #include <__config> | 18 | #include <__config> |
| ... | @@ -23,7 +24,6 @@ | ... | @@ -23,7 +24,6 @@ |
| 23 | #include <__type_traits/enable_if.h> | 24 | #include <__type_traits/enable_if.h> |
| 24 | #include <__type_traits/is_constructible.h> | 25 | #include <__type_traits/is_constructible.h> |
| 25 | #include <__utility/move.h> | 26 | #include <__utility/move.h> |
| 26 | #include <__utility/pair.h> | ||
| 27 | 27 | ||
| 28 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 28 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 29 | # pragma GCC system_header | 29 | # pragma GCC system_header |
| ... | @@ -35,7 +35,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -35,7 +35,7 @@ _LIBCPP_PUSH_MACROS |
| 35 | _LIBCPP_BEGIN_NAMESPACE_STD | 35 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 36 | 36 | ||
| 37 | template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter> | 37 | template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter> |
| 38 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InIter, _OutIter> | 38 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_InIter, _OutIter> |
| 39 | __copy_backward(_InIter __first, _Sent __last, _OutIter __result); | 39 | __copy_backward(_InIter __first, _Sent __last, _OutIter __result); |
| 40 | 40 | ||
| 41 | template <class _Cp, bool _IsConst> | 41 | template <class _Cp, bool _IsConst> |
| ... | @@ -159,7 +159,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false> _ | ... | @@ -159,7 +159,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false> _ |
| 159 | template <class _AlgPolicy> | 159 | template <class _AlgPolicy> |
| 160 | struct __copy_backward_impl { | 160 | struct __copy_backward_impl { |
| 161 | template <class _InIter, class _Sent, class _OutIter> | 161 | template <class _InIter, class _Sent, class _OutIter> |
| 162 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 162 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 163 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { | 163 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { |
| 164 | auto __last_iter = _IterOps<_AlgPolicy>::next(__first, __last); | 164 | auto __last_iter = _IterOps<_AlgPolicy>::next(__first, __last); |
| 165 | auto __original_last_iter = __last_iter; | 165 | auto __original_last_iter = __last_iter; |
| ... | @@ -168,17 +168,17 @@ struct __copy_backward_impl { | ... | @@ -168,17 +168,17 @@ struct __copy_backward_impl { |
| 168 | *--__result = *--__last_iter; | 168 | *--__result = *--__last_iter; |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | return std::make_pair(std::move(__original_last_iter), std::move(__result)); | 171 | return {std::move(__original_last_iter), std::move(__result)}; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0> | 174 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0> |
| 175 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 175 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 176 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | 176 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { |
| 177 | using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator; | 177 | using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator; |
| 178 | std::__for_each_segment_backward(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) { | 178 | std::__for_each_segment_backward(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) { |
| 179 | __result = std::__copy_backward<_AlgPolicy>(std::move(__lfirst), std::move(__llast), std::move(__result)).second; | 179 | __result = std::__copy_backward<_AlgPolicy>(std::move(__lfirst), std::move(__llast), std::move(__result)).__out_; |
| 180 | }); | 180 | }); |
| 181 | return std::make_pair(__last, std::move(__result)); | 181 | return {__last, std::move(__result)}; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | template <class _InIter, | 184 | template <class _InIter, |
| ... | @@ -186,7 +186,7 @@ struct __copy_backward_impl { | ... | @@ -186,7 +186,7 @@ struct __copy_backward_impl { |
| 186 | __enable_if_t<__has_random_access_iterator_category<_InIter>::value && | 186 | __enable_if_t<__has_random_access_iterator_category<_InIter>::value && |
| 187 | !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>, | 187 | !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>, |
| 188 | int> = 0> | 188 | int> = 0> |
| 189 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 189 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 190 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | 190 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { |
| 191 | using _Traits = __segmented_iterator_traits<_OutIter>; | 191 | using _Traits = __segmented_iterator_traits<_OutIter>; |
| 192 | auto __orig_last = __last; | 192 | auto __orig_last = __last; |
| ... | @@ -194,7 +194,7 @@ struct __copy_backward_impl { | ... | @@ -194,7 +194,7 @@ struct __copy_backward_impl { |
| 194 | 194 | ||
| 195 | // When the range contains no elements, __result might not be a valid iterator | 195 | // When the range contains no elements, __result might not be a valid iterator |
| 196 | if (__first == __last) | 196 | if (__first == __last) |
| 197 | return std::make_pair(__first, __result); | 197 | return {__first, __result}; |
| 198 | 198 | ||
| 199 | auto __local_last = _Traits::__local(__result); | 199 | auto __local_last = _Traits::__local(__result); |
| 200 | while (true) { | 200 | while (true) { |
| ... | @@ -203,36 +203,37 @@ struct __copy_backward_impl { | ... | @@ -203,36 +203,37 @@ struct __copy_backward_impl { |
| 203 | 203 | ||
| 204 | auto __local_first = _Traits::__begin(__segment_iterator); | 204 | auto __local_first = _Traits::__begin(__segment_iterator); |
| 205 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); | 205 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); |
| 206 | auto __iter = std::__copy_backward<_AlgPolicy>(__last - __size, __last, __local_last).second; | 206 | auto __iter = std::__copy_backward<_AlgPolicy>(__last - __size, __last, __local_last).__out_; |
| 207 | __last -= __size; | 207 | __last -= __size; |
| 208 | 208 | ||
| 209 | if (__first == __last) | 209 | if (__first == __last) |
| 210 | return std::make_pair(std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter))); | 210 | return {std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter))}; |
| 211 | --__segment_iterator; | 211 | --__segment_iterator; |
| 212 | __local_last = _Traits::__end(__segment_iterator); | 212 | __local_last = _Traits::__end(__segment_iterator); |
| 213 | } | 213 | } |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | template <class _Cp, bool _IsConst> | 216 | template <class _Cp, bool _IsConst> |
| 217 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> > | 217 | _LIBCPP_HIDE_FROM_ABI |
| 218 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> > | ||
| 218 | operator()(__bit_iterator<_Cp, _IsConst> __first, | 219 | operator()(__bit_iterator<_Cp, _IsConst> __first, |
| 219 | __bit_iterator<_Cp, _IsConst> __last, | 220 | __bit_iterator<_Cp, _IsConst> __last, |
| 220 | __bit_iterator<_Cp, false> __result) { | 221 | __bit_iterator<_Cp, false> __result) { |
| 221 | if (__last.__ctz_ == __result.__ctz_) | 222 | if (__last.__ctz_ == __result.__ctz_) |
| 222 | return std::make_pair(__last, std::__copy_backward_aligned(__first, __last, __result)); | 223 | return {__last, std::__copy_backward_aligned(__first, __last, __result)}; |
| 223 | return std::make_pair(__last, std::__copy_backward_unaligned(__first, __last, __result)); | 224 | return {__last, std::__copy_backward_unaligned(__first, __last, __result)}; |
| 224 | } | 225 | } |
| 225 | 226 | ||
| 226 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. | 227 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. |
| 227 | template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0> | 228 | template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0> |
| 228 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*> | 229 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*> |
| 229 | operator()(_In* __first, _In* __last, _Out* __result) const { | 230 | operator()(_In* __first, _In* __last, _Out* __result) const { |
| 230 | return std::__copy_backward_trivial_impl(__first, __last, __result); | 231 | return std::__copy_backward_trivial_impl(__first, __last, __result); |
| 231 | } | 232 | } |
| 232 | }; | 233 | }; |
| 233 | 234 | ||
| 234 | template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2> | 235 | template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2> |
| 235 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2> | 236 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_BidirectionalIterator1, _BidirectionalIterator2> |
| 236 | __copy_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) { | 237 | __copy_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) { |
| 237 | return std::__copy_move_unwrap_iters<__copy_backward_impl<_AlgPolicy> >( | 238 | return std::__copy_move_unwrap_iters<__copy_backward_impl<_AlgPolicy> >( |
| 238 | std::move(__first), std::move(__last), std::move(__result)); | 239 | std::move(__first), std::move(__last), std::move(__result)); |
| ... | @@ -245,7 +246,7 @@ copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _ | ... | @@ -245,7 +246,7 @@ copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _ |
| 245 | std::is_copy_constructible<_BidirectionalIterator1>::value, | 246 | std::is_copy_constructible<_BidirectionalIterator1>::value, |
| 246 | "Iterators must be copy constructible."); | 247 | "Iterators must be copy constructible."); |
| 247 | 248 | ||
| 248 | return std::__copy_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second; | 249 | return std::__copy_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).__out_; |
| 249 | } | 250 | } |
| 250 | 251 | ||
| 251 | _LIBCPP_END_NAMESPACE_STD | 252 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/copy_if.h+4-3| ... | @@ -9,6 +9,7 @@ | ... | @@ -9,6 +9,7 @@ |
| 9 | #ifndef _LIBCPP___ALGORITHM_COPY_IF_H | 9 | #ifndef _LIBCPP___ALGORITHM_COPY_IF_H |
| 10 | #define _LIBCPP___ALGORITHM_COPY_IF_H | 10 | #define _LIBCPP___ALGORITHM_COPY_IF_H |
| 11 | 11 | ||
| 12 | #include <__algorithm/in_out_result.h> | ||
| 12 | #include <__config> | 13 | #include <__config> |
| 13 | #include <__functional/identity.h> | 14 | #include <__functional/identity.h> |
| 14 | #include <__type_traits/invoke.h> | 15 | #include <__type_traits/invoke.h> |
| ... | @@ -25,7 +26,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -25,7 +26,7 @@ _LIBCPP_PUSH_MACROS |
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 27 | ||
| 27 | template <class _InIter, class _Sent, class _OutIter, class _Proj, class _Pred> | 28 | template <class _InIter, class _Sent, class _OutIter, class _Proj, class _Pred> |
| 28 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 29 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 29 | __copy_if(_InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, _Proj& __proj) { | 30 | __copy_if(_InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, _Proj& __proj) { |
| 30 | for (; __first != __last; ++__first) { | 31 | for (; __first != __last; ++__first) { |
| 31 | if (std::__invoke(__pred, std::__invoke(__proj, *__first))) { | 32 | if (std::__invoke(__pred, std::__invoke(__proj, *__first))) { |
| ... | @@ -33,14 +34,14 @@ __copy_if(_InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, _Proj | ... | @@ -33,14 +34,14 @@ __copy_if(_InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, _Proj |
| 33 | ++__result; | 34 | ++__result; |
| 34 | } | 35 | } |
| 35 | } | 36 | } |
| 36 | return std::make_pair(std::move(__first), std::move(__result)); | 37 | return {std::move(__first), std::move(__result)}; |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | template <class _InputIterator, class _OutputIterator, class _Predicate> | 40 | template <class _InputIterator, class _OutputIterator, class _Predicate> |
| 40 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | 41 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator |
| 41 | copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) { | 42 | copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) { |
| 42 | __identity __proj; | 43 | __identity __proj; |
| 43 | return std::__copy_if(__first, __last, __result, __pred, __proj).second; | 44 | return std::__copy_if(__first, __last, __result, __pred, __proj).__out_; |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | _LIBCPP_END_NAMESPACE_STD | 47 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/copy_move_common.h+9-12| ... | @@ -9,21 +9,18 @@ | ... | @@ -9,21 +9,18 @@ |
| 9 | #ifndef _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H | 9 | #ifndef _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H |
| 10 | #define _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H | 10 | #define _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H |
| 11 | 11 | ||
| 12 | #include <__algorithm/in_out_result.h> | ||
| 12 | #include <__algorithm/unwrap_iter.h> | 13 | #include <__algorithm/unwrap_iter.h> |
| 13 | #include <__algorithm/unwrap_range.h> | 14 | #include <__algorithm/unwrap_range.h> |
| 14 | #include <__config> | 15 | #include <__config> |
| 15 | #include <__cstddef/size_t.h> | 16 | #include <__cstddef/size_t.h> |
| 16 | #include <__iterator/iterator_traits.h> | ||
| 17 | #include <__memory/pointer_traits.h> | ||
| 18 | #include <__string/constexpr_c_functions.h> | 17 | #include <__string/constexpr_c_functions.h> |
| 19 | #include <__type_traits/enable_if.h> | 18 | #include <__type_traits/enable_if.h> |
| 20 | #include <__type_traits/is_always_bitcastable.h> | 19 | #include <__type_traits/is_always_bitcastable.h> |
| 21 | #include <__type_traits/is_constant_evaluated.h> | ||
| 22 | #include <__type_traits/is_constructible.h> | 20 | #include <__type_traits/is_constructible.h> |
| 23 | #include <__type_traits/is_trivially_assignable.h> | 21 | #include <__type_traits/is_trivially_assignable.h> |
| 24 | #include <__type_traits/is_volatile.h> | 22 | #include <__type_traits/is_volatile.h> |
| 25 | #include <__utility/move.h> | 23 | #include <__utility/move.h> |
| 26 | #include <__utility/pair.h> | ||
| 27 | 24 | ||
| 28 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 25 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 29 | # pragma GCC system_header | 26 | # pragma GCC system_header |
| ... | @@ -57,24 +54,24 @@ struct __can_lower_move_assignment_to_memmove { | ... | @@ -57,24 +54,24 @@ struct __can_lower_move_assignment_to_memmove { |
| 57 | // `memmove` algorithms implementation. | 54 | // `memmove` algorithms implementation. |
| 58 | 55 | ||
| 59 | template <class _In, class _Out> | 56 | template <class _In, class _Out> |
| 60 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*> | 57 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*> |
| 61 | __copy_trivial_impl(_In* __first, _In* __last, _Out* __result) { | 58 | __copy_trivial_impl(_In* __first, _In* __last, _Out* __result) { |
| 62 | const size_t __n = static_cast<size_t>(__last - __first); | 59 | const size_t __n = static_cast<size_t>(__last - __first); |
| 63 | 60 | ||
| 64 | std::__constexpr_memmove(__result, __first, __element_count(__n)); | 61 | std::__constexpr_memmove(__result, __first, __element_count(__n)); |
| 65 | 62 | ||
| 66 | return std::make_pair(__last, __result + __n); | 63 | return {__last, __result + __n}; |
| 67 | } | 64 | } |
| 68 | 65 | ||
| 69 | template <class _In, class _Out> | 66 | template <class _In, class _Out> |
| 70 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*> | 67 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*> |
| 71 | __copy_backward_trivial_impl(_In* __first, _In* __last, _Out* __result) { | 68 | __copy_backward_trivial_impl(_In* __first, _In* __last, _Out* __result) { |
| 72 | const size_t __n = static_cast<size_t>(__last - __first); | 69 | const size_t __n = static_cast<size_t>(__last - __first); |
| 73 | __result -= __n; | 70 | __result -= __n; |
| 74 | 71 | ||
| 75 | std::__constexpr_memmove(__result, __first, __element_count(__n)); | 72 | std::__constexpr_memmove(__result, __first, __element_count(__n)); |
| 76 | 73 | ||
| 77 | return std::make_pair(__last, __result); | 74 | return {__last, __result}; |
| 78 | } | 75 | } |
| 79 | 76 | ||
| 80 | // Iterator unwrapping and dispatching to the correct overload. | 77 | // Iterator unwrapping and dispatching to the correct overload. |
| ... | @@ -88,12 +85,12 @@ template <class _Algorithm, | ... | @@ -88,12 +85,12 @@ template <class _Algorithm, |
| 88 | class _Sent, | 85 | class _Sent, |
| 89 | class _OutIter, | 86 | class _OutIter, |
| 90 | __enable_if_t<__can_rewrap<_InIter, _OutIter>::value, int> = 0> | 87 | __enable_if_t<__can_rewrap<_InIter, _OutIter>::value, int> = 0> |
| 91 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter> | 88 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 __in_out_result<_InIter, _OutIter> |
| 92 | __copy_move_unwrap_iters(_InIter __first, _Sent __last, _OutIter __out_first) { | 89 | __copy_move_unwrap_iters(_InIter __first, _Sent __last, _OutIter __out_first) { |
| 93 | auto __range = std::__unwrap_range(__first, std::move(__last)); | 90 | auto __range = std::__unwrap_range(__first, std::move(__last)); |
| 94 | auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first)); | 91 | auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first)); |
| 95 | return std::make_pair(std::__rewrap_range<_Sent>(std::move(__first), std::move(__result.first)), | 92 | return {std::__rewrap_range<_Sent>(std::move(__first), std::move(__result.__in_)), |
| 96 | std::__rewrap_iter(std::move(__out_first), std::move(__result.second))); | 93 | std::__rewrap_iter(std::move(__out_first), std::move(__result.__out_))}; |
| 97 | } | 94 | } |
| 98 | 95 | ||
| 99 | template <class _Algorithm, | 96 | template <class _Algorithm, |
| ... | @@ -101,7 +98,7 @@ template <class _Algorithm, | ... | @@ -101,7 +98,7 @@ template <class _Algorithm, |
| 101 | class _Sent, | 98 | class _Sent, |
| 102 | class _OutIter, | 99 | class _OutIter, |
| 103 | __enable_if_t<!__can_rewrap<_InIter, _OutIter>::value, int> = 0> | 100 | __enable_if_t<!__can_rewrap<_InIter, _OutIter>::value, int> = 0> |
| 104 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter> | 101 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 __in_out_result<_InIter, _OutIter> |
| 105 | __copy_move_unwrap_iters(_InIter __first, _Sent __last, _OutIter __out_first) { | 102 | __copy_move_unwrap_iters(_InIter __first, _Sent __last, _OutIter __out_first) { |
| 106 | return _Algorithm()(std::move(__first), std::move(__last), std::move(__out_first)); | 103 | return _Algorithm()(std::move(__first), std::move(__last), std::move(__out_first)); |
| 107 | } | 104 | } |
lib/libcxx/include/__algorithm/copy_n.h+5-5| ... | @@ -10,13 +10,13 @@ | ... | @@ -10,13 +10,13 @@ |
| 10 | #define _LIBCPP___ALGORITHM_COPY_N_H | 10 | #define _LIBCPP___ALGORITHM_COPY_N_H |
| 11 | 11 | ||
| 12 | #include <__algorithm/copy.h> | 12 | #include <__algorithm/copy.h> |
| 13 | #include <__algorithm/in_out_result.h> | ||
| 13 | #include <__algorithm/iterator_operations.h> | 14 | #include <__algorithm/iterator_operations.h> |
| 14 | #include <__config> | 15 | #include <__config> |
| 15 | #include <__iterator/iterator_traits.h> | 16 | #include <__iterator/iterator_traits.h> |
| 16 | #include <__type_traits/enable_if.h> | 17 | #include <__type_traits/enable_if.h> |
| 17 | #include <__utility/convert_to_integral.h> | 18 | #include <__utility/convert_to_integral.h> |
| 18 | #include <__utility/move.h> | 19 | #include <__utility/move.h> |
| 19 | #include <__utility/pair.h> | ||
| 20 | 20 | ||
| 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 22 | # pragma GCC system_header | 22 | # pragma GCC system_header |
| ... | @@ -31,7 +31,7 @@ template <class _AlgPolicy, | ... | @@ -31,7 +31,7 @@ template <class _AlgPolicy, |
| 31 | class _InIter, | 31 | class _InIter, |
| 32 | class _OutIter, | 32 | class _OutIter, |
| 33 | __enable_if_t<__has_random_access_iterator_category<_InIter>::value, int> = 0> | 33 | __enable_if_t<__has_random_access_iterator_category<_InIter>::value, int> = 0> |
| 34 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InIter, _OutIter> | 34 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_InIter, _OutIter> |
| 35 | __copy_n(_InIter __first, typename _IterOps<_AlgPolicy>::template __difference_type<_InIter> __n, _OutIter __result) { | 35 | __copy_n(_InIter __first, typename _IterOps<_AlgPolicy>::template __difference_type<_InIter> __n, _OutIter __result) { |
| 36 | return std::__copy(__first, __first + __n, std::move(__result)); | 36 | return std::__copy(__first, __first + __n, std::move(__result)); |
| 37 | } | 37 | } |
| ... | @@ -40,7 +40,7 @@ template <class _AlgPolicy, | ... | @@ -40,7 +40,7 @@ template <class _AlgPolicy, |
| 40 | class _InIter, | 40 | class _InIter, |
| 41 | class _OutIter, | 41 | class _OutIter, |
| 42 | __enable_if_t<!__has_random_access_iterator_category<_InIter>::value, int> = 0> | 42 | __enable_if_t<!__has_random_access_iterator_category<_InIter>::value, int> = 0> |
| 43 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InIter, _OutIter> | 43 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_InIter, _OutIter> |
| 44 | __copy_n(_InIter __first, typename _IterOps<_AlgPolicy>::template __difference_type<_InIter> __n, _OutIter __result) { | 44 | __copy_n(_InIter __first, typename _IterOps<_AlgPolicy>::template __difference_type<_InIter> __n, _OutIter __result) { |
| 45 | while (__n != 0) { | 45 | while (__n != 0) { |
| 46 | *__result = *__first; | 46 | *__result = *__first; |
| ... | @@ -48,7 +48,7 @@ __copy_n(_InIter __first, typename _IterOps<_AlgPolicy>::template __difference_t | ... | @@ -48,7 +48,7 @@ __copy_n(_InIter __first, typename _IterOps<_AlgPolicy>::template __difference_t |
| 48 | ++__result; | 48 | ++__result; |
| 49 | --__n; | 49 | --__n; |
| 50 | } | 50 | } |
| 51 | return std::make_pair(std::move(__first), std::move(__result)); | 51 | return {std::move(__first), std::move(__result)}; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | // The InputIterator case is handled specially here because it's been written in a way to avoid incrementing __first | 54 | // The InputIterator case is handled specially here because it's been written in a way to avoid incrementing __first |
| ... | @@ -84,7 +84,7 @@ copy_n(_InputIterator __first, _Size __n, _OutputIterator __result) { | ... | @@ -84,7 +84,7 @@ copy_n(_InputIterator __first, _Size __n, _OutputIterator __result) { |
| 84 | using _IntegralSize = decltype(std::__convert_to_integral(__n)); | 84 | using _IntegralSize = decltype(std::__convert_to_integral(__n)); |
| 85 | _IntegralSize __converted = __n; | 85 | _IntegralSize __converted = __n; |
| 86 | return std::__copy_n<_ClassicAlgPolicy>(__first, __iterator_difference_type<_InputIterator>(__converted), __result) | 86 | return std::__copy_n<_ClassicAlgPolicy>(__first, __iterator_difference_type<_InputIterator>(__converted), __result) |
| 87 | .second; | 87 | .__out_; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | _LIBCPP_END_NAMESPACE_STD | 90 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/equal.h+58-13| ... | @@ -11,15 +11,16 @@ | ... | @@ -11,15 +11,16 @@ |
| 11 | #define _LIBCPP___ALGORITHM_EQUAL_H | 11 | #define _LIBCPP___ALGORITHM_EQUAL_H |
| 12 | 12 | ||
| 13 | #include <__algorithm/comp.h> | 13 | #include <__algorithm/comp.h> |
| 14 | #include <__algorithm/find_segment_if.h> | ||
| 14 | #include <__algorithm/min.h> | 15 | #include <__algorithm/min.h> |
| 15 | #include <__algorithm/unwrap_iter.h> | 16 | #include <__algorithm/unwrap_iter.h> |
| 16 | #include <__config> | 17 | #include <__config> |
| 17 | #include <__functional/identity.h> | 18 | #include <__functional/identity.h> |
| 18 | #include <__fwd/bit_reference.h> | 19 | #include <__fwd/bit_reference.h> |
| 19 | #include <__iterator/distance.h> | ||
| 20 | #include <__iterator/iterator_traits.h> | 20 | #include <__iterator/iterator_traits.h> |
| 21 | #include <__memory/pointer_traits.h> | 21 | #include <__iterator/segmented_iterator.h> |
| 22 | #include <__string/constexpr_c_functions.h> | 22 | #include <__string/constexpr_c_functions.h> |
| 23 | #include <__type_traits/common_type.h> | ||
| 23 | #include <__type_traits/desugars_to.h> | 24 | #include <__type_traits/desugars_to.h> |
| 24 | #include <__type_traits/enable_if.h> | 25 | #include <__type_traits/enable_if.h> |
| 25 | #include <__type_traits/invoke.h> | 26 | #include <__type_traits/invoke.h> |
| ... | @@ -27,6 +28,7 @@ | ... | @@ -27,6 +28,7 @@ |
| 27 | #include <__type_traits/is_same.h> | 28 | #include <__type_traits/is_same.h> |
| 28 | #include <__type_traits/is_volatile.h> | 29 | #include <__type_traits/is_volatile.h> |
| 29 | #include <__utility/move.h> | 30 | #include <__utility/move.h> |
| 31 | #include <__utility/unreachable.h> | ||
| 30 | 32 | ||
| 31 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 33 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 32 | # pragma GCC system_header | 34 | # pragma GCC system_header |
| ... | @@ -177,15 +179,6 @@ template <class _Cp, | ... | @@ -177,15 +179,6 @@ template <class _Cp, |
| 177 | return std::__equal_unaligned(__first1, __last1, __first2); | 179 | return std::__equal_unaligned(__first1, __last1, __first2); |
| 178 | } | 180 | } |
| 179 | 181 | ||
| 180 | template <class _InIter1, class _Sent1, class _InIter2, class _Pred, class _Proj1, class _Proj2> | ||
| 181 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_iter_impl( | ||
| 182 | _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { | ||
| 183 | for (; __first1 != __last1; ++__first1, (void)++__first2) | ||
| 184 | if (!std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2))) | ||
| 185 | return false; | ||
| 186 | return true; | ||
| 187 | } | ||
| 188 | |||
| 189 | template <class _Tp, | 182 | template <class _Tp, |
| 190 | class _Up, | 183 | class _Up, |
| 191 | class _BinaryPredicate, | 184 | class _BinaryPredicate, |
| ... | @@ -200,6 +193,58 @@ __equal_iter_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _BinaryPredicate&, | ... | @@ -200,6 +193,58 @@ __equal_iter_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _BinaryPredicate&, |
| 200 | return std::__constexpr_memcmp_equal(__first1, __first2, __element_count(__last1 - __first1)); | 193 | return std::__constexpr_memcmp_equal(__first1, __first2, __element_count(__last1 - __first1)); |
| 201 | } | 194 | } |
| 202 | 195 | ||
| 196 | template <class _InIter1, class _Sent1, class _InIter2, class _Pred, class _Proj1, class _Proj2> | ||
| 197 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_iter_impl( | ||
| 198 | _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { | ||
| 199 | #ifndef _LIBCPP_CXX03_LANG | ||
| 200 | if constexpr (__has_random_access_iterator_category<_InIter1>::value && | ||
| 201 | __has_random_access_iterator_category<_InIter2>::value) { | ||
| 202 | if constexpr (is_same<_InIter1, _Sent1>::value && __is_segmented_iterator_v<_InIter1>) { | ||
| 203 | using __local_iterator_t = typename __segmented_iterator_traits<_InIter1>::__local_iterator; | ||
| 204 | bool __is_equal = true; | ||
| 205 | std::__find_segment_if(__first1, __last1, [&](__local_iterator_t __lfirst, __local_iterator_t __llast) { | ||
| 206 | if (std::__equal_iter_impl( | ||
| 207 | std::__unwrap_iter(__lfirst), std::__unwrap_iter(__llast), __first2, __pred, __proj1, __proj2)) { | ||
| 208 | __first2 += __llast - __lfirst; | ||
| 209 | return __llast; | ||
| 210 | } | ||
| 211 | __is_equal = false; | ||
| 212 | return __lfirst; | ||
| 213 | }); | ||
| 214 | return __is_equal; | ||
| 215 | } else if constexpr (__is_segmented_iterator_v<_InIter2>) { | ||
| 216 | using _Traits = __segmented_iterator_traits<_InIter2>; | ||
| 217 | using _DiffT = | ||
| 218 | typename common_type<__iterator_difference_type<_InIter1>, __iterator_difference_type<_InIter2> >::type; | ||
| 219 | |||
| 220 | if (__first1 == __last1) | ||
| 221 | return true; | ||
| 222 | |||
| 223 | auto __local_first = _Traits::__local(__first2); | ||
| 224 | auto __segment_iterator = _Traits::__segment(__first2); | ||
| 225 | |||
| 226 | while (true) { | ||
| 227 | auto __local_last = _Traits::__end(__segment_iterator); | ||
| 228 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last1 - __first1); | ||
| 229 | if (!std::__equal_iter_impl( | ||
| 230 | __first1, __first1 + __size, std::__unwrap_iter(__local_first), __pred, __proj1, __proj2)) | ||
| 231 | return false; | ||
| 232 | |||
| 233 | __first1 += __size; | ||
| 234 | if (__first1 == __last1) | ||
| 235 | return true; | ||
| 236 | |||
| 237 | __local_first = _Traits::__begin(++__segment_iterator); | ||
| 238 | } | ||
| 239 | } | ||
| 240 | } | ||
| 241 | #endif | ||
| 242 | for (; __first1 != __last1; ++__first1, (void)++__first2) | ||
| 243 | if (!std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2))) | ||
| 244 | return false; | ||
| 245 | return true; | ||
| 246 | } | ||
| 247 | |||
| 203 | template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> | 248 | template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> |
| 204 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | 249 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool |
| 205 | equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { | 250 | equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { |
| ... | @@ -247,11 +292,11 @@ equal(_InputIterator1 __first1, | ... | @@ -247,11 +292,11 @@ equal(_InputIterator1 __first1, |
| 247 | _InputIterator2 __first2, | 292 | _InputIterator2 __first2, |
| 248 | _InputIterator2 __last2, | 293 | _InputIterator2 __last2, |
| 249 | _BinaryPredicate __pred) { | 294 | _BinaryPredicate __pred) { |
| 250 | static constexpr bool __both_random_access = | 295 | constexpr bool __both_random_access = |
| 251 | __has_random_access_iterator_category<_InputIterator1>::value && | 296 | __has_random_access_iterator_category<_InputIterator1>::value && |
| 252 | __has_random_access_iterator_category<_InputIterator2>::value; | 297 | __has_random_access_iterator_category<_InputIterator2>::value; |
| 253 | if constexpr (__both_random_access) { | 298 | if constexpr (__both_random_access) { |
| 254 | if (std::distance(__first1, __last1) != std::distance(__first2, __last2)) | 299 | if (__last1 - __first1 != __last2 - __first2) |
| 255 | return false; | 300 | return false; |
| 256 | } | 301 | } |
| 257 | __identity __proj; | 302 | __identity __proj; |
lib/libcxx/include/__algorithm/find.h+13-14| ... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
| 10 | #ifndef _LIBCPP___ALGORITHM_FIND_H | 10 | #ifndef _LIBCPP___ALGORITHM_FIND_H |
| 11 | #define _LIBCPP___ALGORITHM_FIND_H | 11 | #define _LIBCPP___ALGORITHM_FIND_H |
| 12 | 12 | ||
| 13 | #include <__algorithm/find_if.h> | ||
| 13 | #include <__algorithm/find_segment_if.h> | 14 | #include <__algorithm/find_segment_if.h> |
| 14 | #include <__algorithm/min.h> | 15 | #include <__algorithm/min.h> |
| 15 | #include <__algorithm/simd_utils.h> | 16 | #include <__algorithm/simd_utils.h> |
| ... | @@ -47,17 +48,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -47,17 +48,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 47 | // generic implementation | 48 | // generic implementation |
| 48 | template <class _Iter, class _Sent, class _Tp, class _Proj> | 49 | template <class _Iter, class _Sent, class _Tp, class _Proj> |
| 49 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter | 50 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter |
| 50 | __find_loop(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) { | 51 | __find_generic(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) { |
| 51 | for (; __first != __last; ++__first) | 52 | return std::__find_if( |
| 52 | if (std::__invoke(__proj, *__first) == __value) | 53 | std::move(__first), |
| 53 | break; | 54 | std::move(__last), |
| 54 | return __first; | 55 | [&]<class _ValT>(_ValT&& __val) -> bool { return __val == __value; }, |
| 56 | __proj); | ||
| 55 | } | 57 | } |
| 56 | 58 | ||
| 57 | template <class _Iter, class _Sent, class _Tp, class _Proj> | 59 | template <class _Iter, class _Sent, class _Tp, class _Proj> |
| 58 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter | 60 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter |
| 59 | __find(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) { | 61 | __find(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) { |
| 60 | return std::__find_loop(std::move(__first), std::move(__last), __value, __proj); | 62 | return std::__find_generic(std::move(__first), std::move(__last), __value, __proj); |
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | #if _LIBCPP_VECTORIZE_ALGORITHMS | 65 | #if _LIBCPP_VECTORIZE_ALGORITHMS |
| ... | @@ -108,7 +110,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find_vectorized(_Tp* __first, _Tp* __last, | ... | @@ -108,7 +110,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find_vectorized(_Tp* __first, _Tp* __last, |
| 108 | } | 110 | } |
| 109 | 111 | ||
| 110 | __identity __proj; | 112 | __identity __proj; |
| 111 | return std::__find_loop(__first, __last, __value, __proj); | 113 | return std::__find_generic(__first, __last, __value, __proj); |
| 112 | } | 114 | } |
| 113 | #endif | 115 | #endif |
| 114 | 116 | ||
| ... | @@ -138,7 +140,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _T | ... | @@ -138,7 +140,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _T |
| 138 | # endif | 140 | # endif |
| 139 | else { | 141 | else { |
| 140 | __identity __proj; | 142 | __identity __proj; |
| 141 | return std::__find_loop(__first, __last, __value, __proj); | 143 | return std::__find_generic(__first, __last, __value, __proj); |
| 142 | } | 144 | } |
| 143 | } | 145 | } |
| 144 | #endif | 146 | #endif |
| ... | @@ -216,13 +218,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _SegmentedIterator | ... | @@ -216,13 +218,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _SegmentedIterator |
| 216 | __find(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value, _Proj& __proj) { | 218 | __find(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value, _Proj& __proj) { |
| 217 | using __local_iterator = typename __segmented_iterator_traits<_SegmentedIterator>::__local_iterator; | 219 | using __local_iterator = typename __segmented_iterator_traits<_SegmentedIterator>::__local_iterator; |
| 218 | return std::__find_segment_if( | 220 | return std::__find_segment_if( |
| 219 | std::move(__first), | 221 | std::move(__first), std::move(__last), [&__value, &__proj](__local_iterator __lfirst, __local_iterator __llast) { |
| 220 | std::move(__last), | ||
| 221 | [&__value](__local_iterator __lfirst, __local_iterator __llast, _Proj& __lproj) { | ||
| 222 | return std::__rewrap_iter( | 222 | return std::__rewrap_iter( |
| 223 | __lfirst, std::__find(std::__unwrap_iter(__lfirst), std::__unwrap_iter(__llast), __value, __lproj)); | 223 | __lfirst, std::__find(std::__unwrap_iter(__lfirst), std::__unwrap_iter(__llast), __value, __proj)); |
| 224 | }, | 224 | }); |
| 225 | __proj); | ||
| 226 | } | 225 | } |
| 227 | 226 | ||
| 228 | // public API | 227 | // public API |
lib/libcxx/include/__algorithm/find_if.h+15-4| ... | @@ -11,6 +11,9 @@ | ... | @@ -11,6 +11,9 @@ |
| 11 | #define _LIBCPP___ALGORITHM_FIND_IF_H | 11 | #define _LIBCPP___ALGORITHM_FIND_IF_H |
| 12 | 12 | ||
| 13 | #include <__config> | 13 | #include <__config> |
| 14 | #include <__functional/identity.h> | ||
| 15 | #include <__memory/valid_range.h> | ||
| 16 | #include <__type_traits/invoke.h> | ||
| 14 | 17 | ||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| ... | @@ -18,15 +21,23 @@ | ... | @@ -18,15 +21,23 @@ |
| 18 | 21 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 23 | ||
| 21 | template <class _InputIterator, class _Predicate> | 24 | template <class _Iter, class _Sent, class _Pred, class _Proj> |
| 22 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator | 25 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter |
| 23 | find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { | 26 | __find_if(_Iter __first, _Sent __last, _Pred&& __pred, _Proj&& __proj) { |
| 27 | std::__assume_valid_range(__first, __last); | ||
| 28 | |||
| 24 | for (; __first != __last; ++__first) | 29 | for (; __first != __last; ++__first) |
| 25 | if (__pred(*__first)) | 30 | if (std::__invoke(__pred, std::__invoke(__proj, *__first))) |
| 26 | break; | 31 | break; |
| 27 | return __first; | 32 | return __first; |
| 28 | } | 33 | } |
| 29 | 34 | ||
| 35 | template <class _InputIterator, class _Predicate> | ||
| 36 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator | ||
| 37 | find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { | ||
| 38 | return std::__find_if(__first, __last, __pred, __identity()); | ||
| 39 | } | ||
| 40 | |||
| 30 | _LIBCPP_END_NAMESPACE_STD | 41 | _LIBCPP_END_NAMESPACE_STD |
| 31 | 42 | ||
| 32 | #endif // _LIBCPP___ALGORITHM_FIND_IF_H | 43 | #endif // _LIBCPP___ALGORITHM_FIND_IF_H |
lib/libcxx/include/__algorithm/find_if_not.h+20-4| ... | @@ -10,23 +10,39 @@ | ... | @@ -10,23 +10,39 @@ |
| 10 | #ifndef _LIBCPP___ALGORITHM_FIND_IF_NOT_H | 10 | #ifndef _LIBCPP___ALGORITHM_FIND_IF_NOT_H |
| 11 | #define _LIBCPP___ALGORITHM_FIND_IF_NOT_H | 11 | #define _LIBCPP___ALGORITHM_FIND_IF_NOT_H |
| 12 | 12 | ||
| 13 | #include <__algorithm/find_if.h> | ||
| 13 | #include <__config> | 14 | #include <__config> |
| 15 | #include <__functional/identity.h> | ||
| 16 | #include <__type_traits/invoke.h> | ||
| 17 | #include <__utility/move.h> | ||
| 14 | 18 | ||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| 17 | #endif | 21 | #endif |
| 18 | 22 | ||
| 23 | _LIBCPP_PUSH_MACROS | ||
| 24 | #include <__undef_macros> | ||
| 25 | |||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 27 | ||
| 28 | template <class _Iter, class _Sent, class _Pred, class _Proj> | ||
| 29 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter | ||
| 30 | __find_if_not(_Iter __first, _Sent __last, _Pred&& __pred, _Proj&& __proj) { | ||
| 31 | return std::__find_if( | ||
| 32 | std::move(__first), | ||
| 33 | std::move(__last), | ||
| 34 | [&]<class _ValT>(_ValT&& __val) -> bool { return !std::__invoke(__pred, __val); }, | ||
| 35 | __proj); | ||
| 36 | } | ||
| 37 | |||
| 21 | template <class _InputIterator, class _Predicate> | 38 | template <class _InputIterator, class _Predicate> |
| 22 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator | 39 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator |
| 23 | find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) { | 40 | find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) { |
| 24 | for (; __first != __last; ++__first) | 41 | return std::__find_if_not(__first, __last, __pred, __identity()); |
| 25 | if (!__pred(*__first)) | ||
| 26 | break; | ||
| 27 | return __first; | ||
| 28 | } | 42 | } |
| 29 | 43 | ||
| 30 | _LIBCPP_END_NAMESPACE_STD | 44 | _LIBCPP_END_NAMESPACE_STD |
| 31 | 45 | ||
| 46 | _LIBCPP_POP_MACROS | ||
| 47 | |||
| 32 | #endif // _LIBCPP___ALGORITHM_FIND_IF_NOT_H | 48 | #endif // _LIBCPP___ALGORITHM_FIND_IF_NOT_H |
lib/libcxx/include/__algorithm/find_segment_if.h+8-9| ... | @@ -19,14 +19,13 @@ | ... | @@ -19,14 +19,13 @@ |
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | ||
| 21 | // __find_segment_if is a utility function for optimizing iteration over segmented iterators linearly. | 21 | // __find_segment_if is a utility function for optimizing iteration over segmented iterators linearly. |
| 22 | // [__first, __last) has to be a segmented range. __pred is expected to take a range of local iterators and the __proj. | 22 | // [__first, __last) has to be a segmented range. __pred is expected to take a range of local iterators. |
| 23 | // It returns an iterator to the first element that satisfies the predicate, or a one-past-the-end iterator if there was | 23 | // It returns an iterator to the first element that satisfies the predicate, or a one-past-the-end iterator if there was |
| 24 | // no match. __proj may be anything that should be passed to __pred, but is expected to be a projection to support | 24 | // no match. |
| 25 | // ranges algorithms, or __identity for classic algorithms. | ||
| 26 | 25 | ||
| 27 | template <class _SegmentedIterator, class _Pred, class _Proj> | 26 | template <class _SegmentedIterator, class _Pred> |
| 28 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _SegmentedIterator | 27 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _SegmentedIterator |
| 29 | __find_segment_if(_SegmentedIterator __first, _SegmentedIterator __last, _Pred __pred, _Proj& __proj) { | 28 | __find_segment_if(_SegmentedIterator __first, _SegmentedIterator __last, _Pred __pred) { |
| 30 | using _Traits = __segmented_iterator_traits<_SegmentedIterator>; | 29 | using _Traits = __segmented_iterator_traits<_SegmentedIterator>; |
| 31 | 30 | ||
| 32 | auto __sfirst = _Traits::__segment(__first); | 31 | auto __sfirst = _Traits::__segment(__first); |
| ... | @@ -34,11 +33,11 @@ __find_segment_if(_SegmentedIterator __first, _SegmentedIterator __last, _Pred _ | ... | @@ -34,11 +33,11 @@ __find_segment_if(_SegmentedIterator __first, _SegmentedIterator __last, _Pred _ |
| 34 | 33 | ||
| 35 | // We are in a single segment, so we might not be at the beginning or end | 34 | // We are in a single segment, so we might not be at the beginning or end |
| 36 | if (__sfirst == __slast) | 35 | if (__sfirst == __slast) |
| 37 | return _Traits::__compose(__sfirst, __pred(_Traits::__local(__first), _Traits::__local(__last), __proj)); | 36 | return _Traits::__compose(__sfirst, __pred(_Traits::__local(__first), _Traits::__local(__last))); |
| 38 | 37 | ||
| 39 | { // We have more than one segment. Iterate over the first segment, since we might not start at the beginning | 38 | { // We have more than one segment. Iterate over the first segment, since we might not start at the beginning |
| 40 | auto __llast = _Traits::__end(__sfirst); | 39 | auto __llast = _Traits::__end(__sfirst); |
| 41 | auto __liter = __pred(_Traits::__local(__first), __llast, __proj); | 40 | auto __liter = __pred(_Traits::__local(__first), __llast); |
| 42 | if (__liter != __llast) | 41 | if (__liter != __llast) |
| 43 | return _Traits::__compose(__sfirst, __liter); | 42 | return _Traits::__compose(__sfirst, __liter); |
| 44 | } | 43 | } |
| ... | @@ -47,14 +46,14 @@ __find_segment_if(_SegmentedIterator __first, _SegmentedIterator __last, _Pred _ | ... | @@ -47,14 +46,14 @@ __find_segment_if(_SegmentedIterator __first, _SegmentedIterator __last, _Pred _ |
| 47 | // Iterate over the segments which are guaranteed to be completely in the range | 46 | // Iterate over the segments which are guaranteed to be completely in the range |
| 48 | while (__sfirst != __slast) { | 47 | while (__sfirst != __slast) { |
| 49 | auto __llast = _Traits::__end(__sfirst); | 48 | auto __llast = _Traits::__end(__sfirst); |
| 50 | auto __liter = __pred(_Traits::__begin(__sfirst), _Traits::__end(__sfirst), __proj); | 49 | auto __liter = __pred(_Traits::__begin(__sfirst), _Traits::__end(__sfirst)); |
| 51 | if (__liter != __llast) | 50 | if (__liter != __llast) |
| 52 | return _Traits::__compose(__sfirst, __liter); | 51 | return _Traits::__compose(__sfirst, __liter); |
| 53 | ++__sfirst; | 52 | ++__sfirst; |
| 54 | } | 53 | } |
| 55 | 54 | ||
| 56 | // Iterate over the last segment | 55 | // Iterate over the last segment |
| 57 | return _Traits::__compose(__sfirst, __pred(_Traits::__begin(__sfirst), _Traits::__local(__last), __proj)); | 56 | return _Traits::__compose(__sfirst, __pred(_Traits::__begin(__sfirst), _Traits::__local(__last))); |
| 58 | } | 57 | } |
| 59 | 58 | ||
| 60 | _LIBCPP_END_NAMESPACE_STD | 59 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/for_each.h+1-1| ... | @@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | ||
| 27 | template <class _InputIterator, class _Sent, class _Func, class _Proj> | 27 | template <class _InputIterator, class _Sent, class _Func, class _Proj> |
| 28 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator | 28 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator |
| 29 | __for_each(_InputIterator __first, _Sent __last, _Func& __func, _Proj& __proj) { | 29 | __for_each(_InputIterator __first, _Sent __last, _Func&& __func, _Proj& __proj) { |
| 30 | #ifndef _LIBCPP_CXX03_LANG | 30 | #ifndef _LIBCPP_CXX03_LANG |
| 31 | if constexpr (using _SpecialAlg = | 31 | if constexpr (using _SpecialAlg = |
| 32 | __specialized_algorithm<_Algorithm::__for_each, __iterator_pair<_InputIterator, _Sent>>; | 32 | __specialized_algorithm<_Algorithm::__for_each, __iterator_pair<_InputIterator, _Sent>>; |
lib/libcxx/include/__algorithm/for_each_n.h+3-2| ... | @@ -18,6 +18,7 @@ | ... | @@ -18,6 +18,7 @@ |
| 18 | #include <__iterator/segmented_iterator.h> | 18 | #include <__iterator/segmented_iterator.h> |
| 19 | #include <__type_traits/invoke.h> | 19 | #include <__type_traits/invoke.h> |
| 20 | #include <__utility/convert_to_integral.h> | 20 | #include <__utility/convert_to_integral.h> |
| 21 | #include <__utility/forward.h> | ||
| 21 | #include <__utility/move.h> | 22 | #include <__utility/move.h> |
| 22 | 23 | ||
| 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 24 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | @@ -31,7 +32,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -31,7 +32,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 32 | ||
| 32 | template <class _InputIterator, class _Size, class _Func, class _Proj> | 33 | template <class _InputIterator, class _Size, class _Func, class _Proj> |
| 33 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator | 34 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator |
| 34 | __for_each_n(_InputIterator __first, _Size __orig_n, _Func& __f, _Proj& __proj) { | 35 | __for_each_n(_InputIterator __first, _Size __orig_n, _Func&& __f, _Proj& __proj) { |
| 35 | typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize; | 36 | typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize; |
| 36 | _IntegralSize __n = __orig_n; | 37 | _IntegralSize __n = __orig_n; |
| 37 | 38 | ||
| ... | @@ -43,7 +44,7 @@ __for_each_n(_InputIterator __first, _Size __orig_n, _Func& __f, _Proj& __proj) | ... | @@ -43,7 +44,7 @@ __for_each_n(_InputIterator __first, _Size __orig_n, _Func& __f, _Proj& __proj) |
| 43 | std::__for_each(__lfirst, __llast, __f, __proj); | 44 | std::__for_each(__lfirst, __llast, __f, __proj); |
| 44 | }); | 45 | }); |
| 45 | } else { | 46 | } else { |
| 46 | return std::__for_each(__first, __first + __n, __f, __proj); | 47 | return std::__for_each(__first, __first + __n, std::forward<_Func>(__f), __proj); |
| 47 | } | 48 | } |
| 48 | } else | 49 | } else |
| 49 | #endif | 50 | #endif |
lib/libcxx/include/__algorithm/generate_n.h+5-2| ... | @@ -29,8 +29,11 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | ... | @@ -29,8 +29,11 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator |
| 29 | __generate_n(_OutputIterator __first, _Size __orig_n, _Generator& __gen) { | 29 | __generate_n(_OutputIterator __first, _Size __orig_n, _Generator& __gen) { |
| 30 | using __iter_ref = decltype(*__first); | 30 | using __iter_ref = decltype(*__first); |
| 31 | __identity __proj; | 31 | __identity __proj; |
| 32 | auto __f = [&](__iter_ref __element) { std::forward<__iter_ref>(__element) = __gen(); }; | 32 | return std::__for_each_n( |
| 33 | return std::__for_each_n(std::move(__first), __orig_n, __f, __proj); | 33 | std::move(__first), |
| 34 | __orig_n, | ||
| 35 | [&](__iter_ref __element) { std::forward<__iter_ref>(__element) = __gen(); }, | ||
| 36 | __proj); | ||
| 34 | } | 37 | } |
| 35 | 38 | ||
| 36 | template <class _OutputIterator, class _Size, class _Generator> | 39 | template <class _OutputIterator, class _Size, class _Generator> |
lib/libcxx/include/__algorithm/in_out_result.h+14| ... | @@ -49,6 +49,20 @@ struct in_out_result { | ... | @@ -49,6 +49,20 @@ struct in_out_result { |
| 49 | 49 | ||
| 50 | #endif // _LIBCPP_STD_VER >= 20 | 50 | #endif // _LIBCPP_STD_VER >= 20 |
| 51 | 51 | ||
| 52 | template <class _InIter, class _OutIter> | ||
| 53 | struct __in_out_result { | ||
| 54 | _InIter __in_; | ||
| 55 | _OutIter __out_; | ||
| 56 | |||
| 57 | #if _LIBCPP_STD_VER >= 20 | ||
| 58 | template <class _InIter2, class _OutIter2> | ||
| 59 | requires convertible_to<_InIter, _InIter2> && convertible_to<_OutIter, _OutIter2> | ||
| 60 | constexpr operator ranges::in_out_result<_InIter2, _OutIter2>() && { | ||
| 61 | return {std::move(__in_), std::move(__out_)}; | ||
| 62 | } | ||
| 63 | #endif | ||
| 64 | }; | ||
| 65 | |||
| 52 | _LIBCPP_END_NAMESPACE_STD | 66 | _LIBCPP_END_NAMESPACE_STD |
| 53 | 67 | ||
| 54 | _LIBCPP_POP_MACROS | 68 | _LIBCPP_POP_MACROS |
lib/libcxx/include/__algorithm/lexicographical_compare_three_way.h+4-4| ... | @@ -27,10 +27,10 @@ | ... | @@ -27,10 +27,10 @@ |
| 27 | _LIBCPP_PUSH_MACROS | 27 | _LIBCPP_PUSH_MACROS |
| 28 | #include <__undef_macros> | 28 | #include <__undef_macros> |
| 29 | 29 | ||
| 30 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 31 | |||
| 32 | #if _LIBCPP_STD_VER >= 20 | 30 | #if _LIBCPP_STD_VER >= 20 |
| 33 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | |||
| 34 | // Fast path for random access iterators which computes the number of loop iterations up-front and | 34 | // Fast path for random access iterators which computes the number of loop iterations up-front and |
| 35 | // then skips the iterator comparisons inside the loop. | 35 | // then skips the iterator comparisons inside the loop. |
| 36 | template <class _InputIterator1, class _InputIterator2, class _Cmp> | 36 | template <class _InputIterator1, class _InputIterator2, class _Cmp> |
| ... | @@ -116,10 +116,10 @@ template <class _InputIterator1, class _InputIterator2> | ... | @@ -116,10 +116,10 @@ template <class _InputIterator1, class _InputIterator2> |
| 116 | std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), std::compare_three_way()); | 116 | std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), std::compare_three_way()); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 120 | |||
| 121 | _LIBCPP_END_NAMESPACE_STD | 119 | _LIBCPP_END_NAMESPACE_STD |
| 122 | 120 | ||
| 121 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 122 | |||
| 123 | _LIBCPP_POP_MACROS | 123 | _LIBCPP_POP_MACROS |
| 124 | 124 | ||
| 125 | #endif // _LIBCPP___ALGORITHM_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H | 125 | #endif // _LIBCPP___ALGORITHM_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H |
lib/libcxx/include/__algorithm/lower_bound.h+5-4| ... | @@ -56,11 +56,11 @@ template <class _AlgPolicy, class _Iter, class _Type, class _Proj, class _Comp> | ... | @@ -56,11 +56,11 @@ template <class _AlgPolicy, class _Iter, class _Type, class _Proj, class _Comp> |
| 56 | // would yield \Omega(n*log(n)) comparisons and, for non-random-access iterators, \Omega(n^2) iterator increments, | 56 | // would yield \Omega(n*log(n)) comparisons and, for non-random-access iterators, \Omega(n^2) iterator increments, |
| 57 | // whereas the one-sided version will yield O(n) operations on both counts, with a \Omega(log(n)) bound on the number of | 57 | // whereas the one-sided version will yield O(n) operations on both counts, with a \Omega(log(n)) bound on the number of |
| 58 | // comparisons. | 58 | // comparisons. |
| 59 | template <class _AlgPolicy, class _ForwardIterator, class _Sent, class _Type, class _Proj, class _Comp> | 59 | template <class _AlgPolicy, class _ForwardIterator, class _Sent, class _Type, class _Comp> |
| 60 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | 60 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator |
| 61 | __lower_bound_onesided(_ForwardIterator __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) { | 61 | __lower_bound_onesided(_ForwardIterator __first, _Sent __last, const _Type& __value, _Comp& __comp) { |
| 62 | // step = 0, ensuring we can always short-circuit when distance is 1 later on | 62 | // step = 0, ensuring we can always short-circuit when distance is 1 later on |
| 63 | if (__first == __last || !std::__invoke(__comp, std::__invoke(__proj, *__first), __value)) | 63 | if (__first == __last || !std::__invoke(__comp, *__first, __value)) |
| 64 | return __first; | 64 | return __first; |
| 65 | 65 | ||
| 66 | using _Distance = typename iterator_traits<_ForwardIterator>::difference_type; | 66 | using _Distance = typename iterator_traits<_ForwardIterator>::difference_type; |
| ... | @@ -69,11 +69,12 @@ __lower_bound_onesided(_ForwardIterator __first, _Sent __last, const _Type& __va | ... | @@ -69,11 +69,12 @@ __lower_bound_onesided(_ForwardIterator __first, _Sent __last, const _Type& __va |
| 69 | auto __dist = __step - _IterOps<_AlgPolicy>::__advance_to(__it, __step, __last); | 69 | auto __dist = __step - _IterOps<_AlgPolicy>::__advance_to(__it, __step, __last); |
| 70 | // once we reach the last range where needle can be we must start | 70 | // once we reach the last range where needle can be we must start |
| 71 | // looking inwards, bisecting that range | 71 | // looking inwards, bisecting that range |
| 72 | if (__it == __last || !std::__invoke(__comp, std::__invoke(__proj, *__it), __value)) { | 72 | if (__it == __last || !std::__invoke(__comp, *__it, __value)) { |
| 73 | // we've already checked the previous value and it was less, we can save | 73 | // we've already checked the previous value and it was less, we can save |
| 74 | // one comparison by skipping bisection | 74 | // one comparison by skipping bisection |
| 75 | if (__dist == 1) | 75 | if (__dist == 1) |
| 76 | return __it; | 76 | return __it; |
| 77 | __identity __proj; | ||
| 77 | return std::__lower_bound_bisecting<_AlgPolicy>(__first, __value, __dist, __comp, __proj); | 78 | return std::__lower_bound_bisecting<_AlgPolicy>(__first, __value, __dist, __comp, __proj); |
| 78 | } | 79 | } |
| 79 | // range not found, move forward! | 80 | // range not found, move forward! |
lib/libcxx/include/__algorithm/move.h+16-15| ... | @@ -12,6 +12,7 @@ | ... | @@ -12,6 +12,7 @@ |
| 12 | #include <__algorithm/copy.h> | 12 | #include <__algorithm/copy.h> |
| 13 | #include <__algorithm/copy_move_common.h> | 13 | #include <__algorithm/copy_move_common.h> |
| 14 | #include <__algorithm/for_each_segment.h> | 14 | #include <__algorithm/for_each_segment.h> |
| 15 | #include <__algorithm/in_out_result.h> | ||
| 15 | #include <__algorithm/iterator_operations.h> | 16 | #include <__algorithm/iterator_operations.h> |
| 16 | #include <__algorithm/min.h> | 17 | #include <__algorithm/min.h> |
| 17 | #include <__config> | 18 | #include <__config> |
| ... | @@ -22,7 +23,6 @@ | ... | @@ -22,7 +23,6 @@ |
| 22 | #include <__type_traits/enable_if.h> | 23 | #include <__type_traits/enable_if.h> |
| 23 | #include <__type_traits/is_constructible.h> | 24 | #include <__type_traits/is_constructible.h> |
| 24 | #include <__utility/move.h> | 25 | #include <__utility/move.h> |
| 25 | #include <__utility/pair.h> | ||
| 26 | 26 | ||
| 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 28 | # pragma GCC system_header | 28 | # pragma GCC system_header |
| ... | @@ -34,30 +34,30 @@ _LIBCPP_PUSH_MACROS | ... | @@ -34,30 +34,30 @@ _LIBCPP_PUSH_MACROS |
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | 34 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 35 | 35 | ||
| 36 | template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter> | 36 | template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter> |
| 37 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 37 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 38 | __move(_InIter __first, _Sent __last, _OutIter __result); | 38 | __move(_InIter __first, _Sent __last, _OutIter __result); |
| 39 | 39 | ||
| 40 | template <class _AlgPolicy> | 40 | template <class _AlgPolicy> |
| 41 | struct __move_impl { | 41 | struct __move_impl { |
| 42 | template <class _InIter, class _Sent, class _OutIter> | 42 | template <class _InIter, class _Sent, class _OutIter> |
| 43 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 43 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 44 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { | 44 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { |
| 45 | while (__first != __last) { | 45 | while (__first != __last) { |
| 46 | *__result = _IterOps<_AlgPolicy>::__iter_move(__first); | 46 | *__result = _IterOps<_AlgPolicy>::__iter_move(__first); |
| 47 | ++__first; | 47 | ++__first; |
| 48 | ++__result; | 48 | ++__result; |
| 49 | } | 49 | } |
| 50 | return std::make_pair(std::move(__first), std::move(__result)); | 50 | return {std::move(__first), std::move(__result)}; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0> | 53 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0> |
| 54 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 54 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 55 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | 55 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { |
| 56 | using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator; | 56 | using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator; |
| 57 | std::__for_each_segment(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) { | 57 | std::__for_each_segment(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) { |
| 58 | __result = std::__move<_AlgPolicy>(__lfirst, __llast, std::move(__result)).second; | 58 | __result = std::__move<_AlgPolicy>(__lfirst, __llast, std::move(__result)).__out_; |
| 59 | }); | 59 | }); |
| 60 | return std::make_pair(__last, std::move(__result)); | 60 | return {__last, std::move(__result)}; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | template <class _InIter, | 63 | template <class _InIter, |
| ... | @@ -65,14 +65,14 @@ struct __move_impl { | ... | @@ -65,14 +65,14 @@ struct __move_impl { |
| 65 | __enable_if_t<__has_random_access_iterator_category<_InIter>::value && | 65 | __enable_if_t<__has_random_access_iterator_category<_InIter>::value && |
| 66 | !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>, | 66 | !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>, |
| 67 | int> = 0> | 67 | int> = 0> |
| 68 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 68 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 69 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | 69 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { |
| 70 | using _Traits = __segmented_iterator_traits<_OutIter>; | 70 | using _Traits = __segmented_iterator_traits<_OutIter>; |
| 71 | using _DiffT = | 71 | using _DiffT = |
| 72 | typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type; | 72 | typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type; |
| 73 | 73 | ||
| 74 | if (__first == __last) | 74 | if (__first == __last) |
| 75 | return std::make_pair(std::move(__first), std::move(__result)); | 75 | return {std::move(__first), std::move(__result)}; |
| 76 | 76 | ||
| 77 | auto __local_first = _Traits::__local(__result); | 77 | auto __local_first = _Traits::__local(__result); |
| 78 | auto __segment_iterator = _Traits::__segment(__result); | 78 | auto __segment_iterator = _Traits::__segment(__result); |
| ... | @@ -80,17 +80,18 @@ struct __move_impl { | ... | @@ -80,17 +80,18 @@ struct __move_impl { |
| 80 | auto __local_last = _Traits::__end(__segment_iterator); | 80 | auto __local_last = _Traits::__end(__segment_iterator); |
| 81 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); | 81 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); |
| 82 | auto __iters = std::__move<_AlgPolicy>(__first, __first + __size, __local_first); | 82 | auto __iters = std::__move<_AlgPolicy>(__first, __first + __size, __local_first); |
| 83 | __first = std::move(__iters.first); | 83 | __first = std::move(__iters.__in_); |
| 84 | 84 | ||
| 85 | if (__first == __last) | 85 | if (__first == __last) |
| 86 | return std::make_pair(std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.second))); | 86 | return {std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.__out_))}; |
| 87 | 87 | ||
| 88 | __local_first = _Traits::__begin(++__segment_iterator); | 88 | __local_first = _Traits::__begin(++__segment_iterator); |
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | template <class _Cp, bool _IsConst> | 92 | template <class _Cp, bool _IsConst> |
| 93 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> > | 93 | _LIBCPP_HIDE_FROM_ABI |
| 94 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> > | ||
| 94 | operator()(__bit_iterator<_Cp, _IsConst> __first, | 95 | operator()(__bit_iterator<_Cp, _IsConst> __first, |
| 95 | __bit_iterator<_Cp, _IsConst> __last, | 96 | __bit_iterator<_Cp, _IsConst> __last, |
| 96 | __bit_iterator<_Cp, false> __result) { | 97 | __bit_iterator<_Cp, false> __result) { |
| ... | @@ -99,14 +100,14 @@ struct __move_impl { | ... | @@ -99,14 +100,14 @@ struct __move_impl { |
| 99 | 100 | ||
| 100 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. | 101 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. |
| 101 | template <class _In, class _Out, __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0> | 102 | template <class _In, class _Out, __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0> |
| 102 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*> | 103 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*> |
| 103 | operator()(_In* __first, _In* __last, _Out* __result) const { | 104 | operator()(_In* __first, _In* __last, _Out* __result) const { |
| 104 | return std::__copy_trivial_impl(__first, __last, __result); | 105 | return std::__copy_trivial_impl(__first, __last, __result); |
| 105 | } | 106 | } |
| 106 | }; | 107 | }; |
| 107 | 108 | ||
| 108 | template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter> | 109 | template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter> |
| 109 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 110 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 110 | __move(_InIter __first, _Sent __last, _OutIter __result) { | 111 | __move(_InIter __first, _Sent __last, _OutIter __result) { |
| 111 | return std::__copy_move_unwrap_iters<__move_impl<_AlgPolicy> >( | 112 | return std::__copy_move_unwrap_iters<__move_impl<_AlgPolicy> >( |
| 112 | std::move(__first), std::move(__last), std::move(__result)); | 113 | std::move(__first), std::move(__last), std::move(__result)); |
| ... | @@ -118,7 +119,7 @@ move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { | ... | @@ -118,7 +119,7 @@ move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { |
| 118 | static_assert(is_copy_constructible<_InputIterator>::value, "Iterators has to be copy constructible."); | 119 | static_assert(is_copy_constructible<_InputIterator>::value, "Iterators has to be copy constructible."); |
| 119 | static_assert(is_copy_constructible<_OutputIterator>::value, "The output iterator has to be copy constructible."); | 120 | static_assert(is_copy_constructible<_OutputIterator>::value, "The output iterator has to be copy constructible."); |
| 120 | 121 | ||
| 121 | return std::__move<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second; | 122 | return std::__move<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).__out_; |
| 122 | } | 123 | } |
| 123 | 124 | ||
| 124 | _LIBCPP_END_NAMESPACE_STD | 125 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/move_backward.h+16-14| ... | @@ -12,6 +12,7 @@ | ... | @@ -12,6 +12,7 @@ |
| 12 | #include <__algorithm/copy_backward.h> | 12 | #include <__algorithm/copy_backward.h> |
| 13 | #include <__algorithm/copy_move_common.h> | 13 | #include <__algorithm/copy_move_common.h> |
| 14 | #include <__algorithm/for_each_segment.h> | 14 | #include <__algorithm/for_each_segment.h> |
| 15 | #include <__algorithm/in_out_result.h> | ||
| 15 | #include <__algorithm/iterator_operations.h> | 16 | #include <__algorithm/iterator_operations.h> |
| 16 | #include <__algorithm/min.h> | 17 | #include <__algorithm/min.h> |
| 17 | #include <__config> | 18 | #include <__config> |
| ... | @@ -34,13 +35,13 @@ _LIBCPP_PUSH_MACROS | ... | @@ -34,13 +35,13 @@ _LIBCPP_PUSH_MACROS |
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | 35 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 35 | 36 | ||
| 36 | template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2> | 37 | template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2> |
| 37 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2> | 38 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_BidirectionalIterator1, _BidirectionalIterator2> |
| 38 | __move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result); | 39 | __move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result); |
| 39 | 40 | ||
| 40 | template <class _AlgPolicy> | 41 | template <class _AlgPolicy> |
| 41 | struct __move_backward_impl { | 42 | struct __move_backward_impl { |
| 42 | template <class _InIter, class _Sent, class _OutIter> | 43 | template <class _InIter, class _Sent, class _OutIter> |
| 43 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 44 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 44 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { | 45 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { |
| 45 | auto __last_iter = _IterOps<_AlgPolicy>::next(__first, __last); | 46 | auto __last_iter = _IterOps<_AlgPolicy>::next(__first, __last); |
| 46 | auto __original_last_iter = __last_iter; | 47 | auto __original_last_iter = __last_iter; |
| ... | @@ -49,17 +50,17 @@ struct __move_backward_impl { | ... | @@ -49,17 +50,17 @@ struct __move_backward_impl { |
| 49 | *--__result = _IterOps<_AlgPolicy>::__iter_move(--__last_iter); | 50 | *--__result = _IterOps<_AlgPolicy>::__iter_move(--__last_iter); |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | return std::make_pair(std::move(__original_last_iter), std::move(__result)); | 53 | return {std::move(__original_last_iter), std::move(__result)}; |
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0> | 56 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0> |
| 56 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 57 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 57 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | 58 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { |
| 58 | using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator; | 59 | using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator; |
| 59 | std::__for_each_segment_backward(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) { | 60 | std::__for_each_segment_backward(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) { |
| 60 | __result = std::__move_backward<_AlgPolicy>(std::move(__lfirst), std::move(__llast), std::move(__result)).second; | 61 | __result = std::__move_backward<_AlgPolicy>(std::move(__lfirst), std::move(__llast), std::move(__result)).__out_; |
| 61 | }); | 62 | }); |
| 62 | return std::make_pair(__last, std::move(__result)); | 63 | return {__last, std::move(__result)}; |
| 63 | } | 64 | } |
| 64 | 65 | ||
| 65 | template <class _InIter, | 66 | template <class _InIter, |
| ... | @@ -67,7 +68,7 @@ struct __move_backward_impl { | ... | @@ -67,7 +68,7 @@ struct __move_backward_impl { |
| 67 | __enable_if_t<__has_random_access_iterator_category<_InIter>::value && | 68 | __enable_if_t<__has_random_access_iterator_category<_InIter>::value && |
| 68 | !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>, | 69 | !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>, |
| 69 | int> = 0> | 70 | int> = 0> |
| 70 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | 71 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter> |
| 71 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | 72 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { |
| 72 | using _Traits = __segmented_iterator_traits<_OutIter>; | 73 | using _Traits = __segmented_iterator_traits<_OutIter>; |
| 73 | using _DiffT = | 74 | using _DiffT = |
| ... | @@ -75,7 +76,7 @@ struct __move_backward_impl { | ... | @@ -75,7 +76,7 @@ struct __move_backward_impl { |
| 75 | 76 | ||
| 76 | // When the range contains no elements, __result might not be a valid iterator | 77 | // When the range contains no elements, __result might not be a valid iterator |
| 77 | if (__first == __last) | 78 | if (__first == __last) |
| 78 | return std::make_pair(__first, __result); | 79 | return {__first, __result}; |
| 79 | 80 | ||
| 80 | auto __orig_last = __last; | 81 | auto __orig_last = __last; |
| 81 | 82 | ||
| ... | @@ -84,18 +85,19 @@ struct __move_backward_impl { | ... | @@ -84,18 +85,19 @@ struct __move_backward_impl { |
| 84 | while (true) { | 85 | while (true) { |
| 85 | auto __local_first = _Traits::__begin(__segment_iterator); | 86 | auto __local_first = _Traits::__begin(__segment_iterator); |
| 86 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); | 87 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); |
| 87 | auto __iter = std::__move_backward<_AlgPolicy>(__last - __size, __last, __local_last).second; | 88 | auto __iter = std::__move_backward<_AlgPolicy>(__last - __size, __last, __local_last).__out_; |
| 88 | __last -= __size; | 89 | __last -= __size; |
| 89 | 90 | ||
| 90 | if (__first == __last) | 91 | if (__first == __last) |
| 91 | return std::make_pair(std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter))); | 92 | return {std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter))}; |
| 92 | 93 | ||
| 93 | __local_last = _Traits::__end(--__segment_iterator); | 94 | __local_last = _Traits::__end(--__segment_iterator); |
| 94 | } | 95 | } |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | template <class _Cp, bool _IsConst> | 98 | template <class _Cp, bool _IsConst> |
| 98 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> > | 99 | _LIBCPP_HIDE_FROM_ABI |
| 100 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> > | ||
| 99 | operator()(__bit_iterator<_Cp, _IsConst> __first, | 101 | operator()(__bit_iterator<_Cp, _IsConst> __first, |
| 100 | __bit_iterator<_Cp, _IsConst> __last, | 102 | __bit_iterator<_Cp, _IsConst> __last, |
| 101 | __bit_iterator<_Cp, false> __result) { | 103 | __bit_iterator<_Cp, false> __result) { |
| ... | @@ -104,14 +106,14 @@ struct __move_backward_impl { | ... | @@ -104,14 +106,14 @@ struct __move_backward_impl { |
| 104 | 106 | ||
| 105 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. | 107 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. |
| 106 | template <class _In, class _Out, __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0> | 108 | template <class _In, class _Out, __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0> |
| 107 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*> | 109 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*> |
| 108 | operator()(_In* __first, _In* __last, _Out* __result) const { | 110 | operator()(_In* __first, _In* __last, _Out* __result) const { |
| 109 | return std::__copy_backward_trivial_impl(__first, __last, __result); | 111 | return std::__copy_backward_trivial_impl(__first, __last, __result); |
| 110 | } | 112 | } |
| 111 | }; | 113 | }; |
| 112 | 114 | ||
| 113 | template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2> | 115 | template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2> |
| 114 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2> | 116 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_BidirectionalIterator1, _BidirectionalIterator2> |
| 115 | __move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) { | 117 | __move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) { |
| 116 | static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value && | 118 | static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value && |
| 117 | std::is_copy_constructible<_BidirectionalIterator1>::value, | 119 | std::is_copy_constructible<_BidirectionalIterator1>::value, |
| ... | @@ -124,7 +126,7 @@ __move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _Bidirectiona | ... | @@ -124,7 +126,7 @@ __move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _Bidirectiona |
| 124 | template <class _BidirectionalIterator1, class _BidirectionalIterator2> | 126 | template <class _BidirectionalIterator1, class _BidirectionalIterator2> |
| 125 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator2 | 127 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator2 |
| 126 | move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) { | 128 | move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) { |
| 127 | return std::__move_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second; | 129 | return std::__move_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).__out_; |
| 128 | } | 130 | } |
| 129 | 131 | ||
| 130 | _LIBCPP_END_NAMESPACE_STD | 132 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/out_value_result.h+4-4| ... | @@ -21,10 +21,10 @@ | ... | @@ -21,10 +21,10 @@ |
| 21 | _LIBCPP_PUSH_MACROS | 21 | _LIBCPP_PUSH_MACROS |
| 22 | #include <__undef_macros> | 22 | #include <__undef_macros> |
| 23 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | #if _LIBCPP_STD_VER >= 23 | 24 | #if _LIBCPP_STD_VER >= 23 |
| 27 | 25 | ||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 27 | |||
| 28 | namespace ranges { | 28 | namespace ranges { |
| 29 | 29 | ||
| 30 | template <class _OutIter1, class _ValType1> | 30 | template <class _OutIter1, class _ValType1> |
| ... | @@ -47,10 +47,10 @@ struct out_value_result { | ... | @@ -47,10 +47,10 @@ struct out_value_result { |
| 47 | 47 | ||
| 48 | } // namespace ranges | 48 | } // namespace ranges |
| 49 | 49 | ||
| 50 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 51 | |||
| 52 | _LIBCPP_END_NAMESPACE_STD | 50 | _LIBCPP_END_NAMESPACE_STD |
| 53 | 51 | ||
| 52 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 53 | |||
| 54 | _LIBCPP_POP_MACROS | 54 | _LIBCPP_POP_MACROS |
| 55 | 55 | ||
| 56 | #endif // _LIBCPP___ALGORITHM_OUT_VALUE_RESULT_H | 56 | #endif // _LIBCPP___ALGORITHM_OUT_VALUE_RESULT_H |
lib/libcxx/include/__algorithm/partial_sort_copy.h+5-4| ... | @@ -11,6 +11,7 @@ | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | ||
| 12 | #include <__algorithm/comp.h> | 12 | #include <__algorithm/comp.h> |
| 13 | #include <__algorithm/comp_ref_type.h> | 13 | #include <__algorithm/comp_ref_type.h> |
| 14 | #include <__algorithm/in_out_result.h> | ||
| 14 | #include <__algorithm/iterator_operations.h> | 15 | #include <__algorithm/iterator_operations.h> |
| 15 | #include <__algorithm/make_heap.h> | 16 | #include <__algorithm/make_heap.h> |
| 16 | #include <__algorithm/make_projected.h> | 17 | #include <__algorithm/make_projected.h> |
| ... | @@ -41,7 +42,8 @@ template <class _AlgPolicy, | ... | @@ -41,7 +42,8 @@ template <class _AlgPolicy, |
| 41 | class _Sentinel2, | 42 | class _Sentinel2, |
| 42 | class _Proj1, | 43 | class _Proj1, |
| 43 | class _Proj2> | 44 | class _Proj2> |
| 44 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _RandomAccessIterator> __partial_sort_copy( | 45 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_InputIterator, _RandomAccessIterator> |
| 46 | __partial_sort_copy( | ||
| 45 | _InputIterator __first, | 47 | _InputIterator __first, |
| 46 | _Sentinel1 __last, | 48 | _Sentinel1 __last, |
| 47 | _RandomAccessIterator __result_first, | 49 | _RandomAccessIterator __result_first, |
| ... | @@ -65,8 +67,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _Random | ... | @@ -65,8 +67,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _Random |
| 65 | std::__sort_heap<_AlgPolicy>(__result_first, __r, __projected_comp); | 67 | std::__sort_heap<_AlgPolicy>(__result_first, __r, __projected_comp); |
| 66 | } | 68 | } |
| 67 | 69 | ||
| 68 | return pair<_InputIterator, _RandomAccessIterator>( | 70 | return {_IterOps<_AlgPolicy>::next(std::move(__first), std::move(__last)), std::move(__r)}; |
| 69 | _IterOps<_AlgPolicy>::next(std::move(__first), std::move(__last)), std::move(__r)); | ||
| 70 | } | 71 | } |
| 71 | 72 | ||
| 72 | template <class _InputIterator, class _RandomAccessIterator, class _Compare> | 73 | template <class _InputIterator, class _RandomAccessIterator, class _Compare> |
| ... | @@ -87,7 +88,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator | ... | @@ -87,7 +88,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator |
| 87 | static_cast<__comp_ref_type<_Compare> >(__comp), | 88 | static_cast<__comp_ref_type<_Compare> >(__comp), |
| 88 | __identity(), | 89 | __identity(), |
| 89 | __identity()); | 90 | __identity()); |
| 90 | return __result.second; | 91 | return __result.__out_; |
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | template <class _InputIterator, class _RandomAccessIterator> | 94 | template <class _InputIterator, class _RandomAccessIterator> |
lib/libcxx/include/__algorithm/pstl.h+90| ... | @@ -293,6 +293,54 @@ find(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __l | ... | @@ -293,6 +293,54 @@ find(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __l |
| 293 | std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), __value); | 293 | std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), __value); |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | template <class _ExecutionPolicy, | ||
| 297 | class _ForwardIterator1, | ||
| 298 | class _ForwardIterator2, | ||
| 299 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, | ||
| 300 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> | ||
| 301 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ForwardIterator1 find_first_of( | ||
| 302 | _ExecutionPolicy&& __policy, | ||
| 303 | _ForwardIterator1 __first1, | ||
| 304 | _ForwardIterator1 __last1, | ||
| 305 | _ForwardIterator2 __first2, | ||
| 306 | _ForwardIterator2 __last2) { | ||
| 307 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "find_first_of requires ForwardIterators"); | ||
| 308 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "find_first_of requires ForwardIterators"); | ||
| 309 | using _Implementation = __pstl::__dispatch<__pstl::__find_first_of, __pstl::__current_configuration, _RawPolicy>; | ||
| 310 | return __pstl::__handle_exception<_Implementation>( | ||
| 311 | std::forward<_ExecutionPolicy>(__policy), | ||
| 312 | std::move(__first1), | ||
| 313 | std::move(__last1), | ||
| 314 | std::move(__first2), | ||
| 315 | std::move(__last2), | ||
| 316 | std::equal_to<>{}); | ||
| 317 | } | ||
| 318 | |||
| 319 | template <class _ExecutionPolicy, | ||
| 320 | class _ForwardIterator1, | ||
| 321 | class _ForwardIterator2, | ||
| 322 | class _BinaryPredicate, | ||
| 323 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, | ||
| 324 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> | ||
| 325 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ForwardIterator1 find_first_of( | ||
| 326 | _ExecutionPolicy&& __policy, | ||
| 327 | _ForwardIterator1 __first1, | ||
| 328 | _ForwardIterator1 __last1, | ||
| 329 | _ForwardIterator2 __first2, | ||
| 330 | _ForwardIterator2 __last2, | ||
| 331 | _BinaryPredicate __pred) { | ||
| 332 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "find_first_of requires ForwardIterators"); | ||
| 333 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "find_first_of requires ForwardIterators"); | ||
| 334 | using _Implementation = __pstl::__dispatch<__pstl::__find_first_of, __pstl::__current_configuration, _RawPolicy>; | ||
| 335 | return __pstl::__handle_exception<_Implementation>( | ||
| 336 | std::forward<_ExecutionPolicy>(__policy), | ||
| 337 | std::move(__first1), | ||
| 338 | std::move(__last1), | ||
| 339 | std::move(__first2), | ||
| 340 | std::move(__last2), | ||
| 341 | std::move(__pred)); | ||
| 342 | } | ||
| 343 | |||
| 296 | template <class _ExecutionPolicy, | 344 | template <class _ExecutionPolicy, |
| 297 | class _ForwardIterator, | 345 | class _ForwardIterator, |
| 298 | class _Function, | 346 | class _Function, |
| ... | @@ -347,6 +395,23 @@ generate_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _Size __n, _Ge | ... | @@ -347,6 +395,23 @@ generate_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _Size __n, _Ge |
| 347 | std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__n), std::move(__gen)); | 395 | std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__n), std::move(__gen)); |
| 348 | } | 396 | } |
| 349 | 397 | ||
| 398 | template <class _ExecutionPolicy, | ||
| 399 | class _BidirectionalIterator, | ||
| 400 | class _ForwardIterator, | ||
| 401 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, | ||
| 402 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> | ||
| 403 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ForwardIterator reverse_copy( | ||
| 404 | _ExecutionPolicy&& __policy, | ||
| 405 | _BidirectionalIterator __first, | ||
| 406 | _BidirectionalIterator __last, | ||
| 407 | _ForwardIterator __result) { | ||
| 408 | _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(_BidirectionalIterator, "reverse_copy requires a BidirectionalIterator"); | ||
| 409 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reverse_copy requires a ForwardIterator"); | ||
| 410 | using _Implementation = __pstl::__dispatch<__pstl::__reverse_copy, __pstl::__current_configuration, _RawPolicy>; | ||
| 411 | return __pstl::__handle_exception<_Implementation>( | ||
| 412 | std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__result)); | ||
| 413 | } | ||
| 414 | |||
| 350 | template <class _ExecutionPolicy, | 415 | template <class _ExecutionPolicy, |
| 351 | class _ForwardIterator, | 416 | class _ForwardIterator, |
| 352 | class _Predicate, | 417 | class _Predicate, |
| ... | @@ -654,6 +719,31 @@ _LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform( | ... | @@ -654,6 +719,31 @@ _LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform( |
| 654 | std::move(__op)); | 719 | std::move(__op)); |
| 655 | } | 720 | } |
| 656 | 721 | ||
| 722 | template <class _ExecutionPolicy, | ||
| 723 | class _ForwardIterator, | ||
| 724 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, | ||
| 725 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> | ||
| 726 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool | ||
| 727 | is_sorted(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last) { | ||
| 728 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "is_sorted requires ForwardIterators"); | ||
| 729 | using _Implementation = __pstl::__dispatch<__pstl::__is_sorted, __pstl::__current_configuration, _RawPolicy>; | ||
| 730 | return __pstl::__handle_exception<_Implementation>( | ||
| 731 | std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), less{}); | ||
| 732 | } | ||
| 733 | |||
| 734 | template <class _ExecutionPolicy, | ||
| 735 | class _ForwardIterator, | ||
| 736 | class _Comp, | ||
| 737 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, | ||
| 738 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> | ||
| 739 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool | ||
| 740 | is_sorted(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Comp __comp) { | ||
| 741 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "is_sorted requires ForwardIterators"); | ||
| 742 | using _Implementation = __pstl::__dispatch<__pstl::__is_sorted, __pstl::__current_configuration, _RawPolicy>; | ||
| 743 | return __pstl::__handle_exception<_Implementation>( | ||
| 744 | std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__comp)); | ||
| 745 | } | ||
| 746 | |||
| 657 | _LIBCPP_END_NAMESPACE_STD | 747 | _LIBCPP_END_NAMESPACE_STD |
| 658 | 748 | ||
| 659 | #endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 | 749 | #endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 |
lib/libcxx/include/__algorithm/radix_sort.h+4-4| ... | @@ -67,10 +67,10 @@ | ... | @@ -67,10 +67,10 @@ |
| 67 | _LIBCPP_PUSH_MACROS | 67 | _LIBCPP_PUSH_MACROS |
| 68 | #include <__undef_macros> | 68 | #include <__undef_macros> |
| 69 | 69 | ||
| 70 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 71 | |||
| 72 | #if _LIBCPP_STD_VER >= 14 | 70 | #if _LIBCPP_STD_VER >= 14 |
| 73 | 71 | ||
| 72 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 73 | |||
| 74 | template <class _InputIterator, class _OutputIterator> | 74 | template <class _InputIterator, class _OutputIterator> |
| 75 | _LIBCPP_HIDE_FROM_ABI constexpr pair<_OutputIterator, __iterator_value_type<_InputIterator>> | 75 | _LIBCPP_HIDE_FROM_ABI constexpr pair<_OutputIterator, __iterator_value_type<_InputIterator>> |
| 76 | __partial_sum_max(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { | 76 | __partial_sum_max(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { |
| ... | @@ -422,10 +422,10 @@ __radix_sort(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _Ran | ... | @@ -422,10 +422,10 @@ __radix_sort(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _Ran |
| 422 | std::__radix_sort(__first, __last, __buffer, __identity{}, __low_byte_fn{}); | 422 | std::__radix_sort(__first, __last, __buffer, __identity{}, __low_byte_fn{}); |
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | #endif // _LIBCPP_STD_VER >= 14 | ||
| 426 | |||
| 427 | _LIBCPP_END_NAMESPACE_STD | 425 | _LIBCPP_END_NAMESPACE_STD |
| 428 | 426 | ||
| 427 | #endif // _LIBCPP_STD_VER >= 14 | ||
| 428 | |||
| 429 | _LIBCPP_POP_MACROS | 429 | _LIBCPP_POP_MACROS |
| 430 | 430 | ||
| 431 | #endif // _LIBCPP___ALGORITHM_RADIX_SORT_H | 431 | #endif // _LIBCPP___ALGORITHM_RADIX_SORT_H |
lib/libcxx/include/__algorithm/ranges_copy.h+2-4| ... | @@ -41,16 +41,14 @@ struct __copy { | ... | @@ -41,16 +41,14 @@ struct __copy { |
| 41 | requires indirectly_copyable<_InIter, _OutIter> | 41 | requires indirectly_copyable<_InIter, _OutIter> |
| 42 | _LIBCPP_HIDE_FROM_ABI constexpr copy_result<_InIter, _OutIter> | 42 | _LIBCPP_HIDE_FROM_ABI constexpr copy_result<_InIter, _OutIter> |
| 43 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { | 43 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { |
| 44 | auto __ret = std::__copy(std::move(__first), std::move(__last), std::move(__result)); | 44 | return std::__copy(std::move(__first), std::move(__last), std::move(__result)); |
| 45 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 46 | } | 45 | } |
| 47 | 46 | ||
| 48 | template <input_range _Range, weakly_incrementable _OutIter> | 47 | template <input_range _Range, weakly_incrementable _OutIter> |
| 49 | requires indirectly_copyable<iterator_t<_Range>, _OutIter> | 48 | requires indirectly_copyable<iterator_t<_Range>, _OutIter> |
| 50 | _LIBCPP_HIDE_FROM_ABI constexpr copy_result<borrowed_iterator_t<_Range>, _OutIter> | 49 | _LIBCPP_HIDE_FROM_ABI constexpr copy_result<borrowed_iterator_t<_Range>, _OutIter> |
| 51 | operator()(_Range&& __r, _OutIter __result) const { | 50 | operator()(_Range&& __r, _OutIter __result) const { |
| 52 | auto __ret = std::__copy(ranges::begin(__r), ranges::end(__r), std::move(__result)); | 51 | return std::__copy(ranges::begin(__r), ranges::end(__r), std::move(__result)); |
| 53 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 54 | } | 52 | } |
| 55 | }; | 53 | }; |
| 56 | 54 |
lib/libcxx/include/__algorithm/ranges_copy_backward.h+2-4| ... | @@ -40,16 +40,14 @@ struct __copy_backward { | ... | @@ -40,16 +40,14 @@ struct __copy_backward { |
| 40 | requires indirectly_copyable<_InIter1, _InIter2> | 40 | requires indirectly_copyable<_InIter1, _InIter2> |
| 41 | _LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<_InIter1, _InIter2> | 41 | _LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<_InIter1, _InIter2> |
| 42 | operator()(_InIter1 __first, _Sent1 __last, _InIter2 __result) const { | 42 | operator()(_InIter1 __first, _Sent1 __last, _InIter2 __result) const { |
| 43 | auto __ret = std::__copy_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)); | 43 | return std::__copy_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)); |
| 44 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 45 | } | 44 | } |
| 46 | 45 | ||
| 47 | template <bidirectional_range _Range, bidirectional_iterator _Iter> | 46 | template <bidirectional_range _Range, bidirectional_iterator _Iter> |
| 48 | requires indirectly_copyable<iterator_t<_Range>, _Iter> | 47 | requires indirectly_copyable<iterator_t<_Range>, _Iter> |
| 49 | _LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<borrowed_iterator_t<_Range>, _Iter> | 48 | _LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<borrowed_iterator_t<_Range>, _Iter> |
| 50 | operator()(_Range&& __r, _Iter __result) const { | 49 | operator()(_Range&& __r, _Iter __result) const { |
| 51 | auto __ret = std::__copy_backward<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), std::move(__result)); | 50 | return std::__copy_backward<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), std::move(__result)); |
| 52 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 53 | } | 51 | } |
| 54 | }; | 52 | }; |
| 55 | 53 |
lib/libcxx/include/__algorithm/ranges_copy_if.h+2-4| ... | @@ -46,8 +46,7 @@ struct __copy_if { | ... | @@ -46,8 +46,7 @@ struct __copy_if { |
| 46 | requires indirectly_copyable<_Iter, _OutIter> | 46 | requires indirectly_copyable<_Iter, _OutIter> |
| 47 | _LIBCPP_HIDE_FROM_ABI constexpr copy_if_result<_Iter, _OutIter> | 47 | _LIBCPP_HIDE_FROM_ABI constexpr copy_if_result<_Iter, _OutIter> |
| 48 | operator()(_Iter __first, _Sent __last, _OutIter __result, _Pred __pred, _Proj __proj = {}) const { | 48 | operator()(_Iter __first, _Sent __last, _OutIter __result, _Pred __pred, _Proj __proj = {}) const { |
| 49 | auto __res = std::__copy_if(std::move(__first), std::move(__last), std::move(__result), __pred, __proj); | 49 | return std::__copy_if(std::move(__first), std::move(__last), std::move(__result), __pred, __proj); |
| 50 | return {std::move(__res.first), std::move(__res.second)}; | ||
| 51 | } | 50 | } |
| 52 | 51 | ||
| 53 | template <input_range _Range, | 52 | template <input_range _Range, |
| ... | @@ -57,8 +56,7 @@ struct __copy_if { | ... | @@ -57,8 +56,7 @@ struct __copy_if { |
| 57 | requires indirectly_copyable<iterator_t<_Range>, _OutIter> | 56 | requires indirectly_copyable<iterator_t<_Range>, _OutIter> |
| 58 | _LIBCPP_HIDE_FROM_ABI constexpr copy_if_result<borrowed_iterator_t<_Range>, _OutIter> | 57 | _LIBCPP_HIDE_FROM_ABI constexpr copy_if_result<borrowed_iterator_t<_Range>, _OutIter> |
| 59 | operator()(_Range&& __r, _OutIter __result, _Pred __pred, _Proj __proj = {}) const { | 58 | operator()(_Range&& __r, _OutIter __result, _Pred __pred, _Proj __proj = {}) const { |
| 60 | auto __res = std::__copy_if(ranges::begin(__r), ranges::end(__r), std::move(__result), __pred, __proj); | 59 | return std::__copy_if(ranges::begin(__r), ranges::end(__r), std::move(__result), __pred, __proj); |
| 61 | return {std::move(__res.first), std::move(__res.second)}; | ||
| 62 | } | 60 | } |
| 63 | }; | 61 | }; |
| 64 | 62 |
lib/libcxx/include/__algorithm/ranges_copy_n.h+5-6| ... | @@ -24,10 +24,10 @@ | ... | @@ -24,10 +24,10 @@ |
| 24 | _LIBCPP_PUSH_MACROS | 24 | _LIBCPP_PUSH_MACROS |
| 25 | #include <__undef_macros> | 25 | #include <__undef_macros> |
| 26 | 26 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 28 | |||
| 29 | #if _LIBCPP_STD_VER >= 20 | 27 | #if _LIBCPP_STD_VER >= 20 |
| 30 | 28 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 30 | |||
| 31 | namespace ranges { | 31 | namespace ranges { |
| 32 | 32 | ||
| 33 | template <class _Ip, class _Op> | 33 | template <class _Ip, class _Op> |
| ... | @@ -38,8 +38,7 @@ struct __copy_n { | ... | @@ -38,8 +38,7 @@ struct __copy_n { |
| 38 | requires indirectly_copyable<_Ip, _Op> | 38 | requires indirectly_copyable<_Ip, _Op> |
| 39 | _LIBCPP_HIDE_FROM_ABI constexpr copy_n_result<_Ip, _Op> | 39 | _LIBCPP_HIDE_FROM_ABI constexpr copy_n_result<_Ip, _Op> |
| 40 | operator()(_Ip __first, iter_difference_t<_Ip> __n, _Op __result) const { | 40 | operator()(_Ip __first, iter_difference_t<_Ip> __n, _Op __result) const { |
| 41 | auto __res = std::__copy_n<_RangeAlgPolicy>(std::move(__first), __n, std::move(__result)); | 41 | return std::__copy_n<_RangeAlgPolicy>(std::move(__first), __n, std::move(__result)); |
| 42 | return {std::move(__res.first), std::move(__res.second)}; | ||
| 43 | } | 42 | } |
| 44 | }; | 43 | }; |
| 45 | 44 | ||
| ... | @@ -48,10 +47,10 @@ inline constexpr auto copy_n = __copy_n{}; | ... | @@ -48,10 +47,10 @@ inline constexpr auto copy_n = __copy_n{}; |
| 48 | } // namespace __cpo | 47 | } // namespace __cpo |
| 49 | } // namespace ranges | 48 | } // namespace ranges |
| 50 | 49 | ||
| 51 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 52 | |||
| 53 | _LIBCPP_END_NAMESPACE_STD | 50 | _LIBCPP_END_NAMESPACE_STD |
| 54 | 51 | ||
| 52 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 53 | |||
| 55 | _LIBCPP_POP_MACROS | 54 | _LIBCPP_POP_MACROS |
| 56 | 55 | ||
| 57 | #endif // _LIBCPP___ALGORITHM_RANGES_COPY_N_H | 56 | #endif // _LIBCPP___ALGORITHM_RANGES_COPY_N_H |
lib/libcxx/include/__algorithm/ranges_equal.h+2-2| ... | @@ -50,7 +50,7 @@ struct __equal { | ... | @@ -50,7 +50,7 @@ struct __equal { |
| 50 | _Pred __pred = {}, | 50 | _Pred __pred = {}, |
| 51 | _Proj1 __proj1 = {}, | 51 | _Proj1 __proj1 = {}, |
| 52 | _Proj2 __proj2 = {}) const { | 52 | _Proj2 __proj2 = {}) const { |
| 53 | static constexpr bool __both_sized = sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2>; | 53 | constexpr bool __both_sized = sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2>; |
| 54 | if constexpr (__both_sized) { | 54 | if constexpr (__both_sized) { |
| 55 | if (__last1 - __first1 != __last2 - __first2) | 55 | if (__last1 - __first1 != __last2 - __first2) |
| 56 | return false; | 56 | return false; |
| ... | @@ -71,7 +71,7 @@ struct __equal { | ... | @@ -71,7 +71,7 @@ struct __equal { |
| 71 | requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> | 71 | requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> |
| 72 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()( | 72 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()( |
| 73 | _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { | 73 | _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { |
| 74 | static constexpr bool __both_sized = sized_range<_Range1> && sized_range<_Range2>; | 74 | constexpr bool __both_sized = sized_range<_Range1> && sized_range<_Range2>; |
| 75 | if constexpr (__both_sized) { | 75 | if constexpr (__both_sized) { |
| 76 | if (ranges::size(__range1) != ranges::size(__range2)) | 76 | if (ranges::size(__range1) != ranges::size(__range2)) |
| 77 | return false; | 77 | return false; |
lib/libcxx/include/__algorithm/ranges_find_if.h+3-12| ... | @@ -9,10 +9,10 @@ | ... | @@ -9,10 +9,10 @@ |
| 9 | #ifndef _LIBCPP___ALGORITHM_RANGES_FIND_IF_H | 9 | #ifndef _LIBCPP___ALGORITHM_RANGES_FIND_IF_H |
| 10 | #define _LIBCPP___ALGORITHM_RANGES_FIND_IF_H | 10 | #define _LIBCPP___ALGORITHM_RANGES_FIND_IF_H |
| 11 | 11 | ||
| 12 | #include <__algorithm/find_if.h> | ||
| 12 | #include <__config> | 13 | #include <__config> |
| 13 | #include <__functional/identity.h> | 14 | #include <__functional/identity.h> |
| 14 | #include <__functional/invoke.h> | 15 | #include <__functional/invoke.h> |
| 15 | #include <__functional/ranges_operations.h> | ||
| 16 | #include <__iterator/concepts.h> | 16 | #include <__iterator/concepts.h> |
| 17 | #include <__iterator/projected.h> | 17 | #include <__iterator/projected.h> |
| 18 | #include <__ranges/access.h> | 18 | #include <__ranges/access.h> |
| ... | @@ -33,15 +33,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -33,15 +33,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 33 | ||
| 34 | namespace ranges { | 34 | namespace ranges { |
| 35 | 35 | ||
| 36 | template <class _Ip, class _Sp, class _Pred, class _Proj> | ||
| 37 | _LIBCPP_HIDE_FROM_ABI constexpr _Ip __find_if_impl(_Ip __first, _Sp __last, _Pred& __pred, _Proj& __proj) { | ||
| 38 | for (; __first != __last; ++__first) { | ||
| 39 | if (std::invoke(__pred, std::invoke(__proj, *__first))) | ||
| 40 | break; | ||
| 41 | } | ||
| 42 | return __first; | ||
| 43 | } | ||
| 44 | |||
| 45 | struct __find_if { | 36 | struct __find_if { |
| 46 | template <input_iterator _Ip, | 37 | template <input_iterator _Ip, |
| 47 | sentinel_for<_Ip> _Sp, | 38 | sentinel_for<_Ip> _Sp, |
| ... | @@ -49,13 +40,13 @@ struct __find_if { | ... | @@ -49,13 +40,13 @@ struct __find_if { |
| 49 | indirect_unary_predicate<projected<_Ip, _Proj>> _Pred> | 40 | indirect_unary_predicate<projected<_Ip, _Proj>> _Pred> |
| 50 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip | 41 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip |
| 51 | operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const { | 42 | operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const { |
| 52 | return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj); | 43 | return std::__find_if(std::move(__first), std::move(__last), __pred, __proj); |
| 53 | } | 44 | } |
| 54 | 45 | ||
| 55 | template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred> | 46 | template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred> |
| 56 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> | 47 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> |
| 57 | operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const { | 48 | operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const { |
| 58 | return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj); | 49 | return std::__find_if(ranges::begin(__r), ranges::end(__r), __pred, __proj); |
| 59 | } | 50 | } |
| 60 | }; | 51 | }; |
| 61 | 52 |
lib/libcxx/include/__algorithm/ranges_find_if_not.h+3-8| ... | @@ -9,17 +9,14 @@ | ... | @@ -9,17 +9,14 @@ |
| 9 | #ifndef _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H | 9 | #ifndef _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H |
| 10 | #define _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H | 10 | #define _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H |
| 11 | 11 | ||
| 12 | #include <__algorithm/ranges_find_if.h> | 12 | #include <__algorithm/find_if_not.h> |
| 13 | #include <__config> | 13 | #include <__config> |
| 14 | #include <__functional/identity.h> | 14 | #include <__functional/identity.h> |
| 15 | #include <__functional/invoke.h> | ||
| 16 | #include <__functional/ranges_operations.h> | ||
| 17 | #include <__iterator/concepts.h> | 15 | #include <__iterator/concepts.h> |
| 18 | #include <__iterator/projected.h> | 16 | #include <__iterator/projected.h> |
| 19 | #include <__ranges/access.h> | 17 | #include <__ranges/access.h> |
| 20 | #include <__ranges/concepts.h> | 18 | #include <__ranges/concepts.h> |
| 21 | #include <__ranges/dangling.h> | 19 | #include <__ranges/dangling.h> |
| 22 | #include <__utility/forward.h> | ||
| 23 | #include <__utility/move.h> | 20 | #include <__utility/move.h> |
| 24 | 21 | ||
| 25 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | @@ -41,15 +38,13 @@ struct __find_if_not { | ... | @@ -41,15 +38,13 @@ struct __find_if_not { |
| 41 | indirect_unary_predicate<projected<_Ip, _Proj>> _Pred> | 38 | indirect_unary_predicate<projected<_Ip, _Proj>> _Pred> |
| 42 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip | 39 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip |
| 43 | operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const { | 40 | operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const { |
| 44 | auto __pred2 = [&](auto&& __e) -> bool { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); }; | 41 | return std::__find_if_not(std::move(__first), std::move(__last), __pred, __proj); |
| 45 | return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred2, __proj); | ||
| 46 | } | 42 | } |
| 47 | 43 | ||
| 48 | template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred> | 44 | template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred> |
| 49 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> | 45 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> |
| 50 | operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const { | 46 | operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const { |
| 51 | auto __pred2 = [&](auto&& __e) -> bool { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); }; | 47 | return std::__find_if_not(ranges::begin(__r), ranges::end(__r), __pred, __proj); |
| 52 | return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred2, __proj); | ||
| 53 | } | 48 | } |
| 54 | }; | 49 | }; |
| 55 | 50 |
lib/libcxx/include/__algorithm/ranges_fold.h+145-4| ... | @@ -10,17 +10,21 @@ | ... | @@ -10,17 +10,21 @@ |
| 10 | #ifndef _LIBCPP___ALGORITHM_RANGES_FOLD_H | 10 | #ifndef _LIBCPP___ALGORITHM_RANGES_FOLD_H |
| 11 | #define _LIBCPP___ALGORITHM_RANGES_FOLD_H | 11 | #define _LIBCPP___ALGORITHM_RANGES_FOLD_H |
| 12 | 12 | ||
| 13 | #include <__algorithm/for_each.h> | ||
| 13 | #include <__concepts/assignable.h> | 14 | #include <__concepts/assignable.h> |
| 14 | #include <__concepts/constructible.h> | 15 | #include <__concepts/constructible.h> |
| 15 | #include <__concepts/convertible_to.h> | 16 | #include <__concepts/convertible_to.h> |
| 16 | #include <__concepts/invocable.h> | 17 | #include <__concepts/invocable.h> |
| 17 | #include <__concepts/movable.h> | 18 | #include <__concepts/movable.h> |
| 18 | #include <__config> | 19 | #include <__config> |
| 20 | #include <__functional/identity.h> | ||
| 19 | #include <__functional/invoke.h> | 21 | #include <__functional/invoke.h> |
| 20 | #include <__functional/reference_wrapper.h> | 22 | #include <__functional/reference_wrapper.h> |
| 21 | #include <__iterator/concepts.h> | 23 | #include <__iterator/concepts.h> |
| 22 | #include <__iterator/iterator_traits.h> | 24 | #include <__iterator/iterator_traits.h> |
| 23 | #include <__iterator/next.h> | 25 | #include <__iterator/next.h> |
| 26 | #include <__iterator/prev.h> | ||
| 27 | #include <__iterator/reverse_iterator.h> | ||
| 24 | #include <__ranges/access.h> | 28 | #include <__ranges/access.h> |
| 25 | #include <__ranges/concepts.h> | 29 | #include <__ranges/concepts.h> |
| 26 | #include <__ranges/dangling.h> | 30 | #include <__ranges/dangling.h> |
| ... | @@ -28,6 +32,7 @@ | ... | @@ -28,6 +32,7 @@ |
| 28 | #include <__type_traits/invoke.h> | 32 | #include <__type_traits/invoke.h> |
| 29 | #include <__utility/forward.h> | 33 | #include <__utility/forward.h> |
| 30 | #include <__utility/move.h> | 34 | #include <__utility/move.h> |
| 35 | #include <optional> | ||
| 31 | 36 | ||
| 32 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 37 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 33 | # pragma GCC system_header | 38 | # pragma GCC system_header |
| ... | @@ -62,6 +67,9 @@ struct in_value_result { | ... | @@ -62,6 +67,9 @@ struct in_value_result { |
| 62 | template <class _Ip, class _Tp> | 67 | template <class _Ip, class _Tp> |
| 63 | using fold_left_with_iter_result = in_value_result<_Ip, _Tp>; | 68 | using fold_left_with_iter_result = in_value_result<_Ip, _Tp>; |
| 64 | 69 | ||
| 70 | template <class _Ip, class _Tp> | ||
| 71 | using fold_left_first_with_iter_result = in_value_result<_Ip, _Tp>; | ||
| 72 | |||
| 65 | template <class _Fp, class _Tp, class _Ip, class _Rp, class _Up = decay_t<_Rp>> | 73 | template <class _Fp, class _Tp, class _Ip, class _Rp, class _Up = decay_t<_Rp>> |
| 66 | concept __indirectly_binary_left_foldable_impl = | 74 | concept __indirectly_binary_left_foldable_impl = |
| 67 | convertible_to<_Rp, _Up> && // | 75 | convertible_to<_Rp, _Up> && // |
| ... | @@ -77,6 +85,22 @@ concept __indirectly_binary_left_foldable = | ... | @@ -77,6 +85,22 @@ concept __indirectly_binary_left_foldable = |
| 77 | invocable<_Fp&, _Tp, iter_reference_t<_Ip>> && // | 85 | invocable<_Fp&, _Tp, iter_reference_t<_Ip>> && // |
| 78 | __indirectly_binary_left_foldable_impl<_Fp, _Tp, _Ip, invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>; | 86 | __indirectly_binary_left_foldable_impl<_Fp, _Tp, _Ip, invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>; |
| 79 | 87 | ||
| 88 | template <class _Func> | ||
| 89 | struct __flipped { | ||
| 90 | _Func __func; | ||
| 91 | |||
| 92 | template <class _Tp, class _Up> | ||
| 93 | requires invocable<_Func&, _Up, _Tp> | ||
| 94 | invoke_result_t<_Func&, _Up, _Tp> operator()(_Tp&&, _Up&&); | ||
| 95 | }; | ||
| 96 | |||
| 97 | template <class _Func, class _Tp, class _Iter> | ||
| 98 | concept __indirectly_binary_right_foldable = | ||
| 99 | __indirectly_binary_left_foldable_impl<__flipped<_Func>, | ||
| 100 | _Tp, | ||
| 101 | _Iter, | ||
| 102 | invoke_result_t<_Func&, _Tp, iter_reference_t<_Iter>>>; | ||
| 103 | |||
| 80 | struct __fold_left_with_iter { | 104 | struct __fold_left_with_iter { |
| 81 | template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp> | 105 | template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp> |
| 82 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) { | 106 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) { |
| ... | @@ -87,11 +111,17 @@ struct __fold_left_with_iter { | ... | @@ -87,11 +111,17 @@ struct __fold_left_with_iter { |
| 87 | } | 111 | } |
| 88 | 112 | ||
| 89 | _Up __result = std::invoke(__f, std::move(__init), *__first); | 113 | _Up __result = std::invoke(__f, std::move(__init), *__first); |
| 90 | for (++__first; __first != __last; ++__first) { | 114 | ++__first; |
| 91 | __result = std::invoke(__f, std::move(__result), *__first); | 115 | __identity __proj; |
| 92 | } | 116 | auto __end = std::__for_each( |
| 117 | std::move(__first), | ||
| 118 | std::move(__last), | ||
| 119 | [&](auto&& __element) { | ||
| 120 | __result = std::invoke(__f, std::move(__result), std::forward<decltype(__element)>(__element)); | ||
| 121 | }, | ||
| 122 | __proj); | ||
| 93 | 123 | ||
| 94 | return fold_left_with_iter_result<_Ip, _Up>{std::move(__first), std::move(__result)}; | 124 | return fold_left_with_iter_result<_Ip, _Up>{std::move(__end), std::move(__result)}; |
| 95 | } | 125 | } |
| 96 | 126 | ||
| 97 | template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp> | 127 | template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp> |
| ... | @@ -118,6 +148,117 @@ struct __fold_left { | ... | @@ -118,6 +148,117 @@ struct __fold_left { |
| 118 | }; | 148 | }; |
| 119 | 149 | ||
| 120 | inline constexpr auto fold_left = __fold_left(); | 150 | inline constexpr auto fold_left = __fold_left(); |
| 151 | |||
| 152 | struct __fold_left_first_with_iter { | ||
| 153 | template <input_iterator _Iter, | ||
| 154 | sentinel_for<_Iter> _Sent, | ||
| 155 | __indirectly_binary_left_foldable<iter_value_t<_Iter>, _Iter> _Func> | ||
| 156 | requires constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>> | ||
| 157 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Iter __first, _Sent __last, _Func __func) { | ||
| 158 | using _Up = decltype(fold_left(std::move(__first), __last, iter_value_t<_Iter>(*__first), __func)); | ||
| 159 | |||
| 160 | if (__first == __last) | ||
| 161 | return fold_left_first_with_iter_result<_Iter, optional<_Up>>{std::move(__first), optional<_Up>()}; | ||
| 162 | |||
| 163 | _Up __result(*__first); | ||
| 164 | ++__first; | ||
| 165 | __identity __proj; | ||
| 166 | auto __end = std::__for_each( | ||
| 167 | std::move(__first), | ||
| 168 | std::move(__last), | ||
| 169 | [&](auto&& __element) { | ||
| 170 | __result = std::invoke(__func, std::move(__result), std::forward<decltype(__element)>(__element)); | ||
| 171 | }, | ||
| 172 | __proj); | ||
| 173 | |||
| 174 | return fold_left_first_with_iter_result<_Iter, optional<_Up>>{std::move(__end), optional<_Up>(std::move(__result))}; | ||
| 175 | } | ||
| 176 | |||
| 177 | template <input_range _Range, __indirectly_binary_left_foldable<range_value_t<_Range>, iterator_t<_Range>> _Func> | ||
| 178 | requires constructible_from<range_value_t<_Range>, range_reference_t<_Range>> | ||
| 179 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Func __func) { | ||
| 180 | auto __result = operator()(ranges::begin(__range), ranges::end(__range), std::ref(__func)); | ||
| 181 | |||
| 182 | using _Up = decltype(fold_left( | ||
| 183 | ranges::begin(__range), ranges::end(__range), range_value_t<_Range>(*ranges::begin(__range)), __func)); | ||
| 184 | return fold_left_first_with_iter_result<borrowed_iterator_t<_Range>, optional<_Up>>{ | ||
| 185 | std::move(__result.in), std::move(__result.value)}; | ||
| 186 | } | ||
| 187 | }; | ||
| 188 | |||
| 189 | inline constexpr auto fold_left_first_with_iter = __fold_left_first_with_iter(); | ||
| 190 | |||
| 191 | struct __fold_left_first { | ||
| 192 | template <input_iterator _Iter, | ||
| 193 | sentinel_for<_Iter> _Sent, | ||
| 194 | __indirectly_binary_left_foldable<iter_value_t<_Iter>, _Iter> _Func> | ||
| 195 | requires constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>> | ||
| 196 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Iter __first, _Sent __last, _Func __func) { | ||
| 197 | return fold_left_first_with_iter(std::move(__first), std::move(__last), std::ref(__func)).value; | ||
| 198 | } | ||
| 199 | |||
| 200 | template <input_range _Range, __indirectly_binary_left_foldable<range_value_t<_Range>, iterator_t<_Range>> _Func> | ||
| 201 | requires constructible_from<range_value_t<_Range>, range_reference_t<_Range>> | ||
| 202 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Func __func) { | ||
| 203 | return fold_left_first_with_iter(ranges::begin(__range), ranges::end(__range), std::ref(__func)).value; | ||
| 204 | } | ||
| 205 | }; | ||
| 206 | |||
| 207 | inline constexpr auto fold_left_first = __fold_left_first(); | ||
| 208 | |||
| 209 | struct __fold_right { | ||
| 210 | template <bidirectional_iterator _Iter, | ||
| 211 | sentinel_for<_Iter> _Sp, | ||
| 212 | class _Tp, | ||
| 213 | __indirectly_binary_right_foldable<_Tp, _Iter> _Func> | ||
| 214 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto | ||
| 215 | operator()(_Iter __first, _Sp __last, _Tp __init, _Func __func) { | ||
| 216 | using _Up = decay_t<invoke_result_t<_Func&, iter_reference_t<_Iter>, _Tp>>; | ||
| 217 | |||
| 218 | if (__first == __last) | ||
| 219 | return _Up(std::move(__init)); | ||
| 220 | |||
| 221 | _Iter __tail = ranges::next(__first, __last); | ||
| 222 | --__tail; | ||
| 223 | _Up __result = std::invoke(__func, *__tail, std::move(__init)); | ||
| 224 | std::for_each(std::make_reverse_iterator(__tail), std::make_reverse_iterator(__first), [&](auto&& __element) { | ||
| 225 | __result = std::invoke(__func, std::forward<decltype(__element)>(__element), std::move(__result)); | ||
| 226 | }); | ||
| 227 | |||
| 228 | return __result; | ||
| 229 | } | ||
| 230 | |||
| 231 | template <bidirectional_range _Range, class _Tp, __indirectly_binary_right_foldable<_Tp, iterator_t<_Range>> _Func> | ||
| 232 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Tp __init, _Func __func) { | ||
| 233 | return operator()(ranges::begin(__range), ranges::end(__range), std::move(__init), std::ref(__func)); | ||
| 234 | } | ||
| 235 | }; | ||
| 236 | |||
| 237 | inline constexpr auto fold_right = __fold_right(); | ||
| 238 | |||
| 239 | struct __fold_right_last { | ||
| 240 | template <bidirectional_iterator _Iter, | ||
| 241 | sentinel_for<_Iter> _Sp, | ||
| 242 | __indirectly_binary_right_foldable<iter_value_t<_Iter>, _Iter> _Func> | ||
| 243 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Iter __first, _Sp __last, _Func __func) { | ||
| 244 | using _Up = decltype(fold_right(__first, __last, iter_value_t<_Iter>(*__first), __func)); | ||
| 245 | |||
| 246 | if (__first == __last) | ||
| 247 | return optional<_Up>(); | ||
| 248 | |||
| 249 | _Iter __tail = ranges::prev(ranges::next(__first, __last)); | ||
| 250 | return optional<_Up>( | ||
| 251 | in_place, ranges::fold_right(std::move(__first), __tail, iter_value_t<_Iter>(*__tail), std::move(__func))); | ||
| 252 | } | ||
| 253 | |||
| 254 | template <bidirectional_range _Range, | ||
| 255 | __indirectly_binary_right_foldable<range_value_t<_Range>, iterator_t<_Range>> _Func> | ||
| 256 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Func __func) { | ||
| 257 | return operator()(ranges::begin(__range), ranges::end(__range), std::ref(__func)); | ||
| 258 | } | ||
| 259 | }; | ||
| 260 | |||
| 261 | inline constexpr auto fold_right_last = __fold_right_last(); | ||
| 121 | } // namespace ranges | 262 | } // namespace ranges |
| 122 | 263 | ||
| 123 | #endif // _LIBCPP_STD_VER >= 23 | 264 | #endif // _LIBCPP_STD_VER >= 23 |
lib/libcxx/include/__algorithm/ranges_move.h+2-9| ... | @@ -36,25 +36,18 @@ template <class _InIter, class _OutIter> | ... | @@ -36,25 +36,18 @@ template <class _InIter, class _OutIter> |
| 36 | using move_result = in_out_result<_InIter, _OutIter>; | 36 | using move_result = in_out_result<_InIter, _OutIter>; |
| 37 | 37 | ||
| 38 | struct __move { | 38 | struct __move { |
| 39 | template <class _InIter, class _Sent, class _OutIter> | ||
| 40 | _LIBCPP_HIDE_FROM_ABI constexpr static move_result<_InIter, _OutIter> | ||
| 41 | __move_impl(_InIter __first, _Sent __last, _OutIter __result) { | ||
| 42 | auto __ret = std::__move<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)); | ||
| 43 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 44 | } | ||
| 45 | |||
| 46 | template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter> | 39 | template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter> |
| 47 | requires indirectly_movable<_InIter, _OutIter> | 40 | requires indirectly_movable<_InIter, _OutIter> |
| 48 | _LIBCPP_HIDE_FROM_ABI constexpr move_result<_InIter, _OutIter> | 41 | _LIBCPP_HIDE_FROM_ABI constexpr move_result<_InIter, _OutIter> |
| 49 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { | 42 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { |
| 50 | return __move_impl(std::move(__first), std::move(__last), std::move(__result)); | 43 | return std::__move<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)); |
| 51 | } | 44 | } |
| 52 | 45 | ||
| 53 | template <input_range _Range, weakly_incrementable _OutIter> | 46 | template <input_range _Range, weakly_incrementable _OutIter> |
| 54 | requires indirectly_movable<iterator_t<_Range>, _OutIter> | 47 | requires indirectly_movable<iterator_t<_Range>, _OutIter> |
| 55 | _LIBCPP_HIDE_FROM_ABI constexpr move_result<borrowed_iterator_t<_Range>, _OutIter> | 48 | _LIBCPP_HIDE_FROM_ABI constexpr move_result<borrowed_iterator_t<_Range>, _OutIter> |
| 56 | operator()(_Range&& __range, _OutIter __result) const { | 49 | operator()(_Range&& __range, _OutIter __result) const { |
| 57 | return __move_impl(ranges::begin(__range), ranges::end(__range), std::move(__result)); | 50 | return std::__move<_RangeAlgPolicy>(ranges::begin(__range), ranges::end(__range), std::move(__result)); |
| 58 | } | 51 | } |
| 59 | }; | 52 | }; |
| 60 | 53 |
lib/libcxx/include/__algorithm/ranges_move_backward.h+2-9| ... | @@ -38,25 +38,18 @@ template <class _InIter, class _OutIter> | ... | @@ -38,25 +38,18 @@ template <class _InIter, class _OutIter> |
| 38 | using move_backward_result = in_out_result<_InIter, _OutIter>; | 38 | using move_backward_result = in_out_result<_InIter, _OutIter>; |
| 39 | 39 | ||
| 40 | struct __move_backward { | 40 | struct __move_backward { |
| 41 | template <class _InIter, class _Sent, class _OutIter> | ||
| 42 | _LIBCPP_HIDE_FROM_ABI constexpr static move_backward_result<_InIter, _OutIter> | ||
| 43 | __move_backward_impl(_InIter __first, _Sent __last, _OutIter __result) { | ||
| 44 | auto __ret = std::__move_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)); | ||
| 45 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 46 | } | ||
| 47 | |||
| 48 | template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, bidirectional_iterator _OutIter> | 41 | template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, bidirectional_iterator _OutIter> |
| 49 | requires indirectly_movable<_InIter, _OutIter> | 42 | requires indirectly_movable<_InIter, _OutIter> |
| 50 | _LIBCPP_HIDE_FROM_ABI constexpr move_backward_result<_InIter, _OutIter> | 43 | _LIBCPP_HIDE_FROM_ABI constexpr move_backward_result<_InIter, _OutIter> |
| 51 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { | 44 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { |
| 52 | return __move_backward_impl(std::move(__first), std::move(__last), std::move(__result)); | 45 | return std::__move_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)); |
| 53 | } | 46 | } |
| 54 | 47 | ||
| 55 | template <bidirectional_range _Range, bidirectional_iterator _Iter> | 48 | template <bidirectional_range _Range, bidirectional_iterator _Iter> |
| 56 | requires indirectly_movable<iterator_t<_Range>, _Iter> | 49 | requires indirectly_movable<iterator_t<_Range>, _Iter> |
| 57 | _LIBCPP_HIDE_FROM_ABI constexpr move_backward_result<borrowed_iterator_t<_Range>, _Iter> | 50 | _LIBCPP_HIDE_FROM_ABI constexpr move_backward_result<borrowed_iterator_t<_Range>, _Iter> |
| 58 | operator()(_Range&& __range, _Iter __result) const { | 51 | operator()(_Range&& __range, _Iter __result) const { |
| 59 | return __move_backward_impl(ranges::begin(__range), ranges::end(__range), std::move(__result)); | 52 | return std::__move_backward<_RangeAlgPolicy>(ranges::begin(__range), ranges::end(__range), std::move(__result)); |
| 60 | } | 53 | } |
| 61 | }; | 54 | }; |
| 62 | 55 |
lib/libcxx/include/__algorithm/ranges_partial_sort_copy.h+2-4| ... | @@ -60,7 +60,7 @@ struct __partial_sort_copy { | ... | @@ -60,7 +60,7 @@ struct __partial_sort_copy { |
| 60 | _Comp __comp = {}, | 60 | _Comp __comp = {}, |
| 61 | _Proj1 __proj1 = {}, | 61 | _Proj1 __proj1 = {}, |
| 62 | _Proj2 __proj2 = {}) const { | 62 | _Proj2 __proj2 = {}) const { |
| 63 | auto __result = std::__partial_sort_copy<_RangeAlgPolicy>( | 63 | return std::__partial_sort_copy<_RangeAlgPolicy>( |
| 64 | std::move(__first), | 64 | std::move(__first), |
| 65 | std::move(__last), | 65 | std::move(__last), |
| 66 | std::move(__result_first), | 66 | std::move(__result_first), |
| ... | @@ -68,7 +68,6 @@ struct __partial_sort_copy { | ... | @@ -68,7 +68,6 @@ struct __partial_sort_copy { |
| 68 | __comp, | 68 | __comp, |
| 69 | __proj1, | 69 | __proj1, |
| 70 | __proj2); | 70 | __proj2); |
| 71 | return {std::move(__result.first), std::move(__result.second)}; | ||
| 72 | } | 71 | } |
| 73 | 72 | ||
| 74 | template <input_range _Range1, | 73 | template <input_range _Range1, |
| ... | @@ -84,7 +83,7 @@ struct __partial_sort_copy { | ... | @@ -84,7 +83,7 @@ struct __partial_sort_copy { |
| 84 | _LIBCPP_HIDE_FROM_ABI constexpr partial_sort_copy_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>> | 83 | _LIBCPP_HIDE_FROM_ABI constexpr partial_sort_copy_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>> |
| 85 | operator()( | 84 | operator()( |
| 86 | _Range1&& __range, _Range2&& __result_range, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { | 85 | _Range1&& __range, _Range2&& __result_range, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { |
| 87 | auto __result = std::__partial_sort_copy<_RangeAlgPolicy>( | 86 | return std::__partial_sort_copy<_RangeAlgPolicy>( |
| 88 | ranges::begin(__range), | 87 | ranges::begin(__range), |
| 89 | ranges::end(__range), | 88 | ranges::end(__range), |
| 90 | ranges::begin(__result_range), | 89 | ranges::begin(__result_range), |
| ... | @@ -92,7 +91,6 @@ struct __partial_sort_copy { | ... | @@ -92,7 +91,6 @@ struct __partial_sort_copy { |
| 92 | __comp, | 91 | __comp, |
| 93 | __proj1, | 92 | __proj1, |
| 94 | __proj2); | 93 | __proj2); |
| 95 | return {std::move(__result.first), std::move(__result.second)}; | ||
| 96 | } | 94 | } |
| 97 | }; | 95 | }; |
| 98 | 96 |
lib/libcxx/include/__algorithm/ranges_remove_if.h+2-3| ... | @@ -10,10 +10,9 @@ | ... | @@ -10,10 +10,9 @@ |
| 10 | #define _LIBCPP___ALGORITHM_RANGES_REMOVE_IF_H | 10 | #define _LIBCPP___ALGORITHM_RANGES_REMOVE_IF_H |
| 11 | #include <__config> | 11 | #include <__config> |
| 12 | 12 | ||
| 13 | #include <__algorithm/ranges_find_if.h> | 13 | #include <__algorithm/find_if.h> |
| 14 | #include <__functional/identity.h> | 14 | #include <__functional/identity.h> |
| 15 | #include <__functional/invoke.h> | 15 | #include <__functional/invoke.h> |
| 16 | #include <__functional/ranges_operations.h> | ||
| 17 | #include <__iterator/concepts.h> | 16 | #include <__iterator/concepts.h> |
| 18 | #include <__iterator/iter_move.h> | 17 | #include <__iterator/iter_move.h> |
| 19 | #include <__iterator/permutable.h> | 18 | #include <__iterator/permutable.h> |
| ... | @@ -39,7 +38,7 @@ namespace ranges { | ... | @@ -39,7 +38,7 @@ namespace ranges { |
| 39 | template <class _Iter, class _Sent, class _Proj, class _Pred> | 38 | template <class _Iter, class _Sent, class _Proj, class _Pred> |
| 40 | _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter> | 39 | _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter> |
| 41 | __remove_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { | 40 | __remove_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { |
| 42 | auto __new_end = ranges::__find_if_impl(__first, __last, __pred, __proj); | 41 | auto __new_end = std::__find_if(__first, __last, __pred, __proj); |
| 43 | if (__new_end == __last) | 42 | if (__new_end == __last) |
| 44 | return {__new_end, __new_end}; | 43 | return {__new_end, __new_end}; |
| 45 | 44 |
lib/libcxx/include/__algorithm/ranges_reverse_copy.h+2-1| ... | @@ -18,6 +18,7 @@ | ... | @@ -18,6 +18,7 @@ |
| 18 | #include <__ranges/access.h> | 18 | #include <__ranges/access.h> |
| 19 | #include <__ranges/concepts.h> | 19 | #include <__ranges/concepts.h> |
| 20 | #include <__ranges/dangling.h> | 20 | #include <__ranges/dangling.h> |
| 21 | #include <__ranges/reverse_view.h> | ||
| 21 | #include <__ranges/subrange.h> | 22 | #include <__ranges/subrange.h> |
| 22 | #include <__utility/move.h> | 23 | #include <__utility/move.h> |
| 23 | 24 | ||
| ... | @@ -49,7 +50,7 @@ struct __reverse_copy { | ... | @@ -49,7 +50,7 @@ struct __reverse_copy { |
| 49 | requires indirectly_copyable<iterator_t<_Range>, _OutIter> | 50 | requires indirectly_copyable<iterator_t<_Range>, _OutIter> |
| 50 | _LIBCPP_HIDE_FROM_ABI constexpr reverse_copy_result<borrowed_iterator_t<_Range>, _OutIter> | 51 | _LIBCPP_HIDE_FROM_ABI constexpr reverse_copy_result<borrowed_iterator_t<_Range>, _OutIter> |
| 51 | operator()(_Range&& __range, _OutIter __result) const { | 52 | operator()(_Range&& __range, _OutIter __result) const { |
| 52 | auto __ret = ranges::copy(std::__reverse_range(__range), std::move(__result)); | 53 | auto __ret = ranges::copy(__range | views::reverse, std::move(__result)); |
| 53 | return {ranges::next(ranges::begin(__range), ranges::end(__range)), std::move(__ret.out)}; | 54 | return {ranges::next(ranges::begin(__range), ranges::end(__range)), std::move(__ret.out)}; |
| 54 | } | 55 | } |
| 55 | }; | 56 | }; |
lib/libcxx/include/__algorithm/ranges_set_difference.h+2-7| ... | @@ -14,16 +14,13 @@ | ... | @@ -14,16 +14,13 @@ |
| 14 | #include <__algorithm/set_difference.h> | 14 | #include <__algorithm/set_difference.h> |
| 15 | #include <__config> | 15 | #include <__config> |
| 16 | #include <__functional/identity.h> | 16 | #include <__functional/identity.h> |
| 17 | #include <__functional/invoke.h> | ||
| 18 | #include <__functional/ranges_operations.h> | 17 | #include <__functional/ranges_operations.h> |
| 19 | #include <__iterator/concepts.h> | 18 | #include <__iterator/concepts.h> |
| 20 | #include <__iterator/mergeable.h> | 19 | #include <__iterator/mergeable.h> |
| 21 | #include <__ranges/access.h> | 20 | #include <__ranges/access.h> |
| 22 | #include <__ranges/concepts.h> | 21 | #include <__ranges/concepts.h> |
| 23 | #include <__ranges/dangling.h> | 22 | #include <__ranges/dangling.h> |
| 24 | #include <__type_traits/decay.h> | ||
| 25 | #include <__utility/move.h> | 23 | #include <__utility/move.h> |
| 26 | #include <__utility/pair.h> | ||
| 27 | 24 | ||
| 28 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 25 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 29 | # pragma GCC system_header | 26 | # pragma GCC system_header |
| ... | @@ -60,9 +57,8 @@ struct __set_difference { | ... | @@ -60,9 +57,8 @@ struct __set_difference { |
| 60 | _Comp __comp = {}, | 57 | _Comp __comp = {}, |
| 61 | _Proj1 __proj1 = {}, | 58 | _Proj1 __proj1 = {}, |
| 62 | _Proj2 __proj2 = {}) const { | 59 | _Proj2 __proj2 = {}) const { |
| 63 | auto __ret = std::__set_difference( | 60 | return std::__set_difference( |
| 64 | __first1, __last1, __first2, __last2, __result, ranges::__make_projected_comp(__comp, __proj1, __proj2)); | 61 | __first1, __last1, __first2, __last2, __result, ranges::__make_projected_comp(__comp, __proj1, __proj2)); |
| 65 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 66 | } | 62 | } |
| 67 | 63 | ||
| 68 | template <input_range _Range1, | 64 | template <input_range _Range1, |
| ... | @@ -79,14 +75,13 @@ struct __set_difference { | ... | @@ -79,14 +75,13 @@ struct __set_difference { |
| 79 | _Comp __comp = {}, | 75 | _Comp __comp = {}, |
| 80 | _Proj1 __proj1 = {}, | 76 | _Proj1 __proj1 = {}, |
| 81 | _Proj2 __proj2 = {}) const { | 77 | _Proj2 __proj2 = {}) const { |
| 82 | auto __ret = std::__set_difference( | 78 | return std::__set_difference( |
| 83 | ranges::begin(__range1), | 79 | ranges::begin(__range1), |
| 84 | ranges::end(__range1), | 80 | ranges::end(__range1), |
| 85 | ranges::begin(__range2), | 81 | ranges::begin(__range2), |
| 86 | ranges::end(__range2), | 82 | ranges::end(__range2), |
| 87 | __result, | 83 | __result, |
| 88 | ranges::__make_projected_comp(__comp, __proj1, __proj2)); | 84 | ranges::__make_projected_comp(__comp, __proj1, __proj2)); |
| 89 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 90 | } | 85 | } |
| 91 | }; | 86 | }; |
| 92 | 87 |
lib/libcxx/include/__algorithm/ranges_shift_left.h created+73| ... | @@ -0,0 +1,73 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___ALGORITHM_RANGES_SHIFT_LEFT_H | ||
| 10 | #define _LIBCPP___ALGORITHM_RANGES_SHIFT_LEFT_H | ||
| 11 | |||
| 12 | #include <__algorithm/iterator_operations.h> | ||
| 13 | #include <__algorithm/shift_left.h> | ||
| 14 | #include <__config> | ||
| 15 | #include <__iterator/concepts.h> | ||
| 16 | #include <__iterator/distance.h> | ||
| 17 | #include <__iterator/incrementable_traits.h> | ||
| 18 | #include <__iterator/permutable.h> | ||
| 19 | #include <__ranges/access.h> | ||
| 20 | #include <__ranges/concepts.h> | ||
| 21 | #include <__ranges/subrange.h> | ||
| 22 | #include <__utility/move.h> | ||
| 23 | |||
| 24 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 25 | # pragma GCC system_header | ||
| 26 | #endif | ||
| 27 | |||
| 28 | _LIBCPP_PUSH_MACROS | ||
| 29 | #include <__undef_macros> | ||
| 30 | |||
| 31 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 32 | |||
| 33 | #if _LIBCPP_STD_VER >= 23 | ||
| 34 | |||
| 35 | namespace ranges { | ||
| 36 | namespace __shift_left { | ||
| 37 | |||
| 38 | struct __fn { | ||
| 39 | template <permutable _Iter, sentinel_for<_Iter> _Sent> | ||
| 40 | _LIBCPP_HIDE_FROM_ABI static constexpr subrange<_Iter> | ||
| 41 | operator()(_Iter __first, _Sent __last, iter_difference_t<_Iter> __n) { | ||
| 42 | auto __ret = std::__shift_left<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__n)); | ||
| 43 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 44 | } | ||
| 45 | |||
| 46 | template <forward_range _Range> | ||
| 47 | requires permutable<iterator_t<_Range>> | ||
| 48 | _LIBCPP_HIDE_FROM_ABI static constexpr borrowed_subrange_t<_Range> | ||
| 49 | operator()(_Range&& __range, range_difference_t<_Range> __n) { | ||
| 50 | if constexpr (sized_range<_Range>) { | ||
| 51 | if (__n >= ranges::distance(__range)) { | ||
| 52 | return {ranges::begin(__range), ranges::begin(__range)}; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | auto __ret = std::__shift_left<_RangeAlgPolicy>(ranges::begin(__range), ranges::end(__range), std::move(__n)); | ||
| 57 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 58 | } | ||
| 59 | }; | ||
| 60 | } // namespace __shift_left | ||
| 61 | |||
| 62 | inline namespace __cpo { | ||
| 63 | inline constexpr auto shift_left = __shift_left::__fn{}; | ||
| 64 | } // namespace __cpo | ||
| 65 | } // namespace ranges | ||
| 66 | |||
| 67 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 68 | |||
| 69 | _LIBCPP_END_NAMESPACE_STD | ||
| 70 | |||
| 71 | _LIBCPP_POP_MACROS | ||
| 72 | |||
| 73 | #endif // _LIBCPP___ALGORITHM_RANGES_SHIFT_LEFT_H | ||
lib/libcxx/include/__algorithm/ranges_shift_right.h created+76| ... | @@ -0,0 +1,76 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___ALGORITHM_RANGES_SHIFT_RIGHT_H | ||
| 10 | #define _LIBCPP___ALGORITHM_RANGES_SHIFT_RIGHT_H | ||
| 11 | |||
| 12 | #include <__algorithm/iterator_operations.h> | ||
| 13 | #include <__algorithm/shift_right.h> | ||
| 14 | #include <__config> | ||
| 15 | #include <__iterator/concepts.h> | ||
| 16 | #include <__iterator/distance.h> | ||
| 17 | #include <__iterator/incrementable_traits.h> | ||
| 18 | #include <__iterator/permutable.h> | ||
| 19 | #include <__ranges/access.h> | ||
| 20 | #include <__ranges/concepts.h> | ||
| 21 | #include <__ranges/subrange.h> | ||
| 22 | #include <__utility/move.h> | ||
| 23 | |||
| 24 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 25 | # pragma GCC system_header | ||
| 26 | #endif | ||
| 27 | |||
| 28 | _LIBCPP_PUSH_MACROS | ||
| 29 | #include <__undef_macros> | ||
| 30 | |||
| 31 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 32 | |||
| 33 | #if _LIBCPP_STD_VER >= 23 | ||
| 34 | |||
| 35 | namespace ranges { | ||
| 36 | namespace __shift_right { | ||
| 37 | |||
| 38 | struct __fn { | ||
| 39 | template <permutable _Iter, sentinel_for<_Iter> _Sent> | ||
| 40 | _LIBCPP_HIDE_FROM_ABI static constexpr subrange<_Iter> | ||
| 41 | operator()(_Iter __first, _Sent __last, iter_difference_t<_Iter> __n) { | ||
| 42 | auto __ret = std::__shift_right<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__n)); | ||
| 43 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 44 | } | ||
| 45 | |||
| 46 | template <forward_range _Range> | ||
| 47 | requires permutable<iterator_t<_Range>> | ||
| 48 | _LIBCPP_HIDE_FROM_ABI static constexpr borrowed_subrange_t<_Range> | ||
| 49 | operator()(_Range&& __range, range_difference_t<_Range> __n) { | ||
| 50 | if constexpr (sized_range<_Range>) { | ||
| 51 | if (__n >= ranges::distance(__range)) { | ||
| 52 | auto __iter = ranges::begin(__range); | ||
| 53 | auto __end = ranges::end(__range); | ||
| 54 | ranges::advance(__iter, __end); | ||
| 55 | return {__iter, std::move(__iter)}; | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | auto __ret = std::__shift_right<_RangeAlgPolicy>(ranges::begin(__range), ranges::end(__range), std::move(__n)); | ||
| 60 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 61 | } | ||
| 62 | }; | ||
| 63 | } // namespace __shift_right | ||
| 64 | |||
| 65 | inline namespace __cpo { | ||
| 66 | inline constexpr auto shift_right = __shift_right::__fn{}; | ||
| 67 | } // namespace __cpo | ||
| 68 | } // namespace ranges | ||
| 69 | |||
| 70 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 71 | |||
| 72 | _LIBCPP_END_NAMESPACE_STD | ||
| 73 | |||
| 74 | _LIBCPP_POP_MACROS | ||
| 75 | |||
| 76 | #endif // _LIBCPP___ALGORITHM_RANGES_SHIFT_RIGHT_H | ||
lib/libcxx/include/__algorithm/ranges_swap_ranges.h+30-3| ... | @@ -11,6 +11,7 @@ | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | ||
| 12 | #include <__algorithm/in_in_result.h> | 12 | #include <__algorithm/in_in_result.h> |
| 13 | #include <__algorithm/iterator_operations.h> | 13 | #include <__algorithm/iterator_operations.h> |
| 14 | #include <__algorithm/min.h> | ||
| 14 | #include <__algorithm/swap_ranges.h> | 15 | #include <__algorithm/swap_ranges.h> |
| 15 | #include <__config> | 16 | #include <__config> |
| 16 | #include <__iterator/concepts.h> | 17 | #include <__iterator/concepts.h> |
| ... | @@ -18,7 +19,9 @@ | ... | @@ -18,7 +19,9 @@ |
| 18 | #include <__ranges/access.h> | 19 | #include <__ranges/access.h> |
| 19 | #include <__ranges/concepts.h> | 20 | #include <__ranges/concepts.h> |
| 20 | #include <__ranges/dangling.h> | 21 | #include <__ranges/dangling.h> |
| 22 | #include <__type_traits/is_same.h> | ||
| 21 | #include <__utility/move.h> | 23 | #include <__utility/move.h> |
| 24 | #include <__utility/pair.h> | ||
| 22 | 25 | ||
| 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 26 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 24 | # pragma GCC system_header | 27 | # pragma GCC system_header |
| ... | @@ -41,9 +44,33 @@ struct __swap_ranges { | ... | @@ -41,9 +44,33 @@ struct __swap_ranges { |
| 41 | requires indirectly_swappable<_I1, _I2> | 44 | requires indirectly_swappable<_I1, _I2> |
| 42 | _LIBCPP_HIDE_FROM_ABI constexpr swap_ranges_result<_I1, _I2> | 45 | _LIBCPP_HIDE_FROM_ABI constexpr swap_ranges_result<_I1, _I2> |
| 43 | operator()(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2) const { | 46 | operator()(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2) const { |
| 44 | auto __ret = std::__swap_ranges<_RangeAlgPolicy>( | 47 | if constexpr (sized_sentinel_for<_I1, _S1> && sized_sentinel_for<_I2, _S2> && |
| 45 | std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2)); | 48 | (random_access_iterator<_I1> || random_access_iterator<_I2> || |
| 46 | return {std::move(__ret.first), std::move(__ret.second)}; | 49 | (is_same_v<_I1, _S1> && is_same_v<_I2, _S2>))) { |
| 50 | auto __offset = std::min(__last1 - __first1, __last2 - __first2); | ||
| 51 | |||
| 52 | auto __ret = [&] { | ||
| 53 | if constexpr (random_access_iterator<_I1>) | ||
| 54 | return std::__swap_ranges<_RangeAlgPolicy>(__first1, __first1 + __offset, std::move(__first2)); | ||
| 55 | else if constexpr (random_access_iterator<_I2>) | ||
| 56 | return std::__swap_ranges<_RangeAlgPolicy>(__first2, __first2 + __offset, std::move(__first1)); | ||
| 57 | else if (__last2 - __first2 < __last1 - __first1) { | ||
| 58 | auto __reversed = | ||
| 59 | std::__swap_ranges<_RangeAlgPolicy>(std::move(__first2), std::move(__last2), std::move(__first1)); | ||
| 60 | return std::pair<_I1, _I2>(std::move(__reversed.second), std::move(__reversed.first)); | ||
| 61 | } else | ||
| 62 | return std::__swap_ranges<_RangeAlgPolicy>(std::move(__first1), std::move(__last1), std::move(__first2)); | ||
| 63 | }(); | ||
| 64 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 65 | } else { | ||
| 66 | while (__first1 != __last1 && __first2 != __last2) { | ||
| 67 | ranges::iter_swap(__first1, __first2); | ||
| 68 | ++__first1; | ||
| 69 | ++__first2; | ||
| 70 | } | ||
| 71 | |||
| 72 | return {std::move(__first1), std::move(__first2)}; | ||
| 73 | } | ||
| 47 | } | 74 | } |
| 48 | 75 | ||
| 49 | template <input_range _R1, input_range _R2> | 76 | template <input_range _R1, input_range _R2> |
lib/libcxx/include/__algorithm/ranges_unique_copy.h+2-5| ... | @@ -26,7 +26,6 @@ | ... | @@ -26,7 +26,6 @@ |
| 26 | #include <__ranges/dangling.h> | 26 | #include <__ranges/dangling.h> |
| 27 | #include <__utility/forward.h> | 27 | #include <__utility/forward.h> |
| 28 | #include <__utility/move.h> | 28 | #include <__utility/move.h> |
| 29 | #include <__utility/pair.h> | ||
| 30 | 29 | ||
| 31 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 30 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 32 | # pragma GCC system_header | 31 | # pragma GCC system_header |
| ... | @@ -73,13 +72,12 @@ struct __unique_copy { | ... | @@ -73,13 +72,12 @@ struct __unique_copy { |
| 73 | indirectly_copyable_storable<_InIter, _OutIter>) | 72 | indirectly_copyable_storable<_InIter, _OutIter>) |
| 74 | _LIBCPP_HIDE_FROM_ABI constexpr unique_copy_result<_InIter, _OutIter> | 73 | _LIBCPP_HIDE_FROM_ABI constexpr unique_copy_result<_InIter, _OutIter> |
| 75 | operator()(_InIter __first, _Sent __last, _OutIter __result, _Comp __comp = {}, _Proj __proj = {}) const { | 74 | operator()(_InIter __first, _Sent __last, _OutIter __result, _Comp __comp = {}, _Proj __proj = {}) const { |
| 76 | auto __ret = std::__unique_copy<_RangeAlgPolicy>( | 75 | return std::__unique_copy<_RangeAlgPolicy>( |
| 77 | std::move(__first), | 76 | std::move(__first), |
| 78 | std::move(__last), | 77 | std::move(__last), |
| 79 | std::move(__result), | 78 | std::move(__result), |
| 80 | std::__make_projected(__comp, __proj), | 79 | std::__make_projected(__comp, __proj), |
| 81 | __algo_tag_t<_InIter, _OutIter>()); | 80 | __algo_tag_t<_InIter, _OutIter>()); |
| 82 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 83 | } | 81 | } |
| 84 | 82 | ||
| 85 | template <input_range _Range, | 83 | template <input_range _Range, |
| ... | @@ -92,13 +90,12 @@ struct __unique_copy { | ... | @@ -92,13 +90,12 @@ struct __unique_copy { |
| 92 | indirectly_copyable_storable<iterator_t<_Range>, _OutIter>) | 90 | indirectly_copyable_storable<iterator_t<_Range>, _OutIter>) |
| 93 | _LIBCPP_HIDE_FROM_ABI constexpr unique_copy_result<borrowed_iterator_t<_Range>, _OutIter> | 91 | _LIBCPP_HIDE_FROM_ABI constexpr unique_copy_result<borrowed_iterator_t<_Range>, _OutIter> |
| 94 | operator()(_Range&& __range, _OutIter __result, _Comp __comp = {}, _Proj __proj = {}) const { | 92 | operator()(_Range&& __range, _OutIter __result, _Comp __comp = {}, _Proj __proj = {}) const { |
| 95 | auto __ret = std::__unique_copy<_RangeAlgPolicy>( | 93 | return std::__unique_copy<_RangeAlgPolicy>( |
| 96 | ranges::begin(__range), | 94 | ranges::begin(__range), |
| 97 | ranges::end(__range), | 95 | ranges::end(__range), |
| 98 | std::move(__result), | 96 | std::move(__result), |
| 99 | std::__make_projected(__comp, __proj), | 97 | std::__make_projected(__comp, __proj), |
| 100 | __algo_tag_t<iterator_t<_Range>, _OutIter>()); | 98 | __algo_tag_t<iterator_t<_Range>, _OutIter>()); |
| 101 | return {std::move(__ret.first), std::move(__ret.second)}; | ||
| 102 | } | 99 | } |
| 103 | }; | 100 | }; |
| 104 | 101 |
lib/libcxx/include/__algorithm/rotate.h+2-2| ... | @@ -39,7 +39,7 @@ __rotate_left(_ForwardIterator __first, _ForwardIterator __last) { | ... | @@ -39,7 +39,7 @@ __rotate_left(_ForwardIterator __first, _ForwardIterator __last) { |
| 39 | using _Ops = _IterOps<_AlgPolicy>; | 39 | using _Ops = _IterOps<_AlgPolicy>; |
| 40 | 40 | ||
| 41 | value_type __tmp = _Ops::__iter_move(__first); | 41 | value_type __tmp = _Ops::__iter_move(__first); |
| 42 | _ForwardIterator __lm1 = std::__move<_AlgPolicy>(_Ops::next(__first), __last, __first).second; | 42 | _ForwardIterator __lm1 = std::__move<_AlgPolicy>(_Ops::next(__first), __last, __first).__out_; |
| 43 | *__lm1 = std::move(__tmp); | 43 | *__lm1 = std::move(__tmp); |
| 44 | return __lm1; | 44 | return __lm1; |
| 45 | } | 45 | } |
| ... | @@ -52,7 +52,7 @@ __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) { | ... | @@ -52,7 +52,7 @@ __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) { |
| 52 | 52 | ||
| 53 | _BidirectionalIterator __lm1 = _Ops::prev(__last); | 53 | _BidirectionalIterator __lm1 = _Ops::prev(__last); |
| 54 | value_type __tmp = _Ops::__iter_move(__lm1); | 54 | value_type __tmp = _Ops::__iter_move(__lm1); |
| 55 | _BidirectionalIterator __fp1 = std::__move_backward<_AlgPolicy>(__first, __lm1, std::move(__last)).second; | 55 | _BidirectionalIterator __fp1 = std::__move_backward<_AlgPolicy>(__first, __lm1, std::move(__last)).__out_; |
| 56 | *__first = std::move(__tmp); | 56 | *__first = std::move(__tmp); |
| 57 | return __fp1; | 57 | return __fp1; |
| 58 | } | 58 | } |
lib/libcxx/include/__algorithm/set_difference.h+5-6| ... | @@ -12,12 +12,10 @@ | ... | @@ -12,12 +12,10 @@ |
| 12 | #include <__algorithm/comp.h> | 12 | #include <__algorithm/comp.h> |
| 13 | #include <__algorithm/comp_ref_type.h> | 13 | #include <__algorithm/comp_ref_type.h> |
| 14 | #include <__algorithm/copy.h> | 14 | #include <__algorithm/copy.h> |
| 15 | #include <__algorithm/in_out_result.h> | ||
| 15 | #include <__config> | 16 | #include <__config> |
| 16 | #include <__functional/identity.h> | ||
| 17 | #include <__iterator/iterator_traits.h> | ||
| 18 | #include <__type_traits/remove_cvref.h> | 17 | #include <__type_traits/remove_cvref.h> |
| 19 | #include <__utility/move.h> | 18 | #include <__utility/move.h> |
| 20 | #include <__utility/pair.h> | ||
| 21 | 19 | ||
| 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | # pragma GCC system_header | 21 | # pragma GCC system_header |
| ... | @@ -29,7 +27,8 @@ _LIBCPP_PUSH_MACROS | ... | @@ -29,7 +27,8 @@ _LIBCPP_PUSH_MACROS |
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 28 | ||
| 31 | template <class _Comp, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> | 29 | template <class _Comp, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> |
| 32 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__remove_cvref_t<_InIter1>, __remove_cvref_t<_OutIter> > | 30 | _LIBCPP_HIDE_FROM_ABI |
| 31 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<__remove_cvref_t<_InIter1>, __remove_cvref_t<_OutIter> > | ||
| 33 | __set_difference( | 32 | __set_difference( |
| 34 | _InIter1&& __first1, _Sent1&& __last1, _InIter2&& __first2, _Sent2&& __last2, _OutIter&& __result, _Comp&& __comp) { | 33 | _InIter1&& __first1, _Sent1&& __last1, _InIter2&& __first2, _Sent2&& __last2, _OutIter&& __result, _Comp&& __comp) { |
| 35 | while (__first1 != __last1 && __first2 != __last2) { | 34 | while (__first1 != __last1 && __first2 != __last2) { |
| ... | @@ -56,7 +55,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_d | ... | @@ -56,7 +55,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_d |
| 56 | _OutputIterator __result, | 55 | _OutputIterator __result, |
| 57 | _Compare __comp) { | 56 | _Compare __comp) { |
| 58 | return std::__set_difference<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __result, __comp) | 57 | return std::__set_difference<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __result, __comp) |
| 59 | .second; | 58 | .__out_; |
| 60 | } | 59 | } |
| 61 | 60 | ||
| 62 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> | 61 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| ... | @@ -66,7 +65,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_d | ... | @@ -66,7 +65,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_d |
| 66 | _InputIterator2 __first2, | 65 | _InputIterator2 __first2, |
| 67 | _InputIterator2 __last2, | 66 | _InputIterator2 __last2, |
| 68 | _OutputIterator __result) { | 67 | _OutputIterator __result) { |
| 69 | return std::__set_difference(__first1, __last1, __first2, __last2, __result, __less<>()).second; | 68 | return std::__set_difference(__first1, __last1, __first2, __last2, __result, __less<>()).__out_; |
| 70 | } | 69 | } |
| 71 | 70 | ||
| 72 | _LIBCPP_END_NAMESPACE_STD | 71 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/set_intersection.h+2-5| ... | @@ -96,12 +96,10 @@ __set_intersection( | ... | @@ -96,12 +96,10 @@ __set_intersection( |
| 96 | _Compare&& __comp, | 96 | _Compare&& __comp, |
| 97 | std::forward_iterator_tag, | 97 | std::forward_iterator_tag, |
| 98 | std::forward_iterator_tag) { | 98 | std::forward_iterator_tag) { |
| 99 | _LIBCPP_CONSTEXPR std::__identity __proj; | ||
| 100 | bool __prev_may_be_equal = false; | 99 | bool __prev_may_be_equal = false; |
| 101 | 100 | ||
| 102 | while (__first2 != __last2) { | 101 | while (__first2 != __last2) { |
| 103 | _InForwardIter1 __first1_next = | 102 | _InForwardIter1 __first1_next = std::__lower_bound_onesided<_AlgPolicy>(__first1, __last1, *__first2, __comp); |
| 104 | std::__lower_bound_onesided<_AlgPolicy>(__first1, __last1, *__first2, __comp, __proj); | ||
| 105 | std::swap(__first1_next, __first1); | 103 | std::swap(__first1_next, __first1); |
| 106 | // keeping in mind that a==b iff !(a<b) && !(b<a): | 104 | // keeping in mind that a==b iff !(a<b) && !(b<a): |
| 107 | // if we can't advance __first1, that means !(*__first1 < *_first2), therefore __may_be_equal==true | 105 | // if we can't advance __first1, that means !(*__first1 < *_first2), therefore __may_be_equal==true |
| ... | @@ -110,8 +108,7 @@ __set_intersection( | ... | @@ -110,8 +108,7 @@ __set_intersection( |
| 110 | if (__first1 == __last1) | 108 | if (__first1 == __last1) |
| 111 | break; | 109 | break; |
| 112 | 110 | ||
| 113 | _InForwardIter2 __first2_next = | 111 | _InForwardIter2 __first2_next = std::__lower_bound_onesided<_AlgPolicy>(__first2, __last2, *__first1, __comp); |
| 114 | std::__lower_bound_onesided<_AlgPolicy>(__first2, __last2, *__first1, __comp, __proj); | ||
| 115 | std::swap(__first2_next, __first2); | 112 | std::swap(__first2_next, __first2); |
| 116 | std::__set_intersection_add_output_if_equal( | 113 | std::__set_intersection_add_output_if_equal( |
| 117 | __first2 == __first2_next, __first1, __first2, __result, __prev_may_be_equal); | 114 | __first2 == __first2_next, __first1, __first2, __result, __prev_may_be_equal); |
lib/libcxx/include/__algorithm/set_symmetric_difference.h+2-2| ... | @@ -46,7 +46,7 @@ __set_symmetric_difference( | ... | @@ -46,7 +46,7 @@ __set_symmetric_difference( |
| 46 | if (__first2 == __last2) { | 46 | if (__first2 == __last2) { |
| 47 | auto __ret1 = std::__copy(std::move(__first1), std::move(__last1), std::move(__result)); | 47 | auto __ret1 = std::__copy(std::move(__first1), std::move(__last1), std::move(__result)); |
| 48 | return __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter>( | 48 | return __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter>( |
| 49 | std::move(__ret1.first), std::move(__first2), std::move((__ret1.second))); | 49 | std::move(__ret1.__in_), std::move(__first2), std::move((__ret1.__out_))); |
| 50 | } | 50 | } |
| 51 | if (__comp(*__first1, *__first2)) { | 51 | if (__comp(*__first1, *__first2)) { |
| 52 | *__result = *__first1; | 52 | *__result = *__first1; |
| ... | @@ -64,7 +64,7 @@ __set_symmetric_difference( | ... | @@ -64,7 +64,7 @@ __set_symmetric_difference( |
| 64 | } | 64 | } |
| 65 | auto __ret2 = std::__copy(std::move(__first2), std::move(__last2), std::move(__result)); | 65 | auto __ret2 = std::__copy(std::move(__first2), std::move(__last2), std::move(__result)); |
| 66 | return __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter>( | 66 | return __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter>( |
| 67 | std::move(__first1), std::move(__ret2.first), std::move((__ret2.second))); | 67 | std::move(__first1), std::move(__ret2.__in_), std::move((__ret2.__out_))); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> | 70 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> |
lib/libcxx/include/__algorithm/set_union.h+2-2| ... | @@ -45,7 +45,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __set_union_result<_InIter1, | ... | @@ -45,7 +45,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __set_union_result<_InIter1, |
| 45 | if (__first2 == __last2) { | 45 | if (__first2 == __last2) { |
| 46 | auto __ret1 = std::__copy(std::move(__first1), std::move(__last1), std::move(__result)); | 46 | auto __ret1 = std::__copy(std::move(__first1), std::move(__last1), std::move(__result)); |
| 47 | return __set_union_result<_InIter1, _InIter2, _OutIter>( | 47 | return __set_union_result<_InIter1, _InIter2, _OutIter>( |
| 48 | std::move(__ret1.first), std::move(__first2), std::move((__ret1.second))); | 48 | std::move(__ret1.__in_), std::move(__first2), std::move((__ret1.__out_))); |
| 49 | } | 49 | } |
| 50 | if (__comp(*__first2, *__first1)) { | 50 | if (__comp(*__first2, *__first1)) { |
| 51 | *__result = *__first2; | 51 | *__result = *__first2; |
| ... | @@ -60,7 +60,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __set_union_result<_InIter1, | ... | @@ -60,7 +60,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __set_union_result<_InIter1, |
| 60 | } | 60 | } |
| 61 | auto __ret2 = std::__copy(std::move(__first2), std::move(__last2), std::move(__result)); | 61 | auto __ret2 = std::__copy(std::move(__first2), std::move(__last2), std::move(__result)); |
| 62 | return __set_union_result<_InIter1, _InIter2, _OutIter>( | 62 | return __set_union_result<_InIter1, _InIter2, _OutIter>( |
| 63 | std::move(__first1), std::move(__ret2.first), std::move((__ret2.second))); | 63 | std::move(__first1), std::move(__ret2.__in_), std::move((__ret2.__out_))); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> | 66 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> |
lib/libcxx/include/__algorithm/shift_left.h+30-13| ... | @@ -9,9 +9,14 @@ | ... | @@ -9,9 +9,14 @@ |
| 9 | #ifndef _LIBCPP___ALGORITHM_SHIFT_LEFT_H | 9 | #ifndef _LIBCPP___ALGORITHM_SHIFT_LEFT_H |
| 10 | #define _LIBCPP___ALGORITHM_SHIFT_LEFT_H | 10 | #define _LIBCPP___ALGORITHM_SHIFT_LEFT_H |
| 11 | 11 | ||
| 12 | #include <__algorithm/iterator_operations.h> | ||
| 12 | #include <__algorithm/move.h> | 13 | #include <__algorithm/move.h> |
| 14 | #include <__assert> | ||
| 13 | #include <__config> | 15 | #include <__config> |
| 16 | #include <__iterator/concepts.h> | ||
| 14 | #include <__iterator/iterator_traits.h> | 17 | #include <__iterator/iterator_traits.h> |
| 18 | #include <__utility/move.h> | ||
| 19 | #include <__utility/pair.h> | ||
| 15 | 20 | ||
| 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | # pragma GCC system_header | 22 | # pragma GCC system_header |
| ... | @@ -24,30 +29,42 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -24,30 +29,42 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 29 | ||
| 25 | #if _LIBCPP_STD_VER >= 20 | 30 | #if _LIBCPP_STD_VER >= 20 |
| 26 | 31 | ||
| 27 | template <class _ForwardIterator> | 32 | template <class _AlgPolicy, class _Iter, class _Sent> |
| 28 | inline _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator | 33 | _LIBCPP_HIDE_FROM_ABI constexpr pair<_Iter, _Iter> |
| 29 | shift_left(_ForwardIterator __first, | 34 | __shift_left(_Iter __first, _Sent __last, typename _IterOps<_AlgPolicy>::template __difference_type<_Iter> __n) { |
| 30 | _ForwardIterator __last, | 35 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n >= 0, "n must be greater than or equal to 0"); |
| 31 | typename iterator_traits<_ForwardIterator>::difference_type __n) { | 36 | |
| 32 | if (__n == 0) { | 37 | if (__n == 0) { |
| 33 | return __last; | 38 | _Iter __end = _IterOps<_AlgPolicy>::next(__first, __last); |
| 39 | return {std::move(__first), std::move(__end)}; | ||
| 34 | } | 40 | } |
| 35 | 41 | ||
| 36 | _ForwardIterator __m = __first; | 42 | _Iter __m = __first; |
| 37 | if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) { | 43 | if constexpr (sized_sentinel_for<_Sent, _Iter>) { |
| 38 | if (__n >= __last - __first) { | 44 | auto __size = _IterOps<_AlgPolicy>::distance(__first, __last); |
| 39 | return __first; | 45 | if (__n >= __size) { |
| 46 | return {__first, std::move(__first)}; | ||
| 40 | } | 47 | } |
| 41 | __m += __n; | 48 | _IterOps<_AlgPolicy>::advance(__m, __n); |
| 42 | } else { | 49 | } else { |
| 43 | for (; __n > 0; --__n) { | 50 | for (; __n > 0; --__n) { |
| 44 | if (__m == __last) { | 51 | if (__m == __last) { |
| 45 | return __first; | 52 | return {__first, std::move(__first)}; |
| 46 | } | 53 | } |
| 47 | ++__m; | 54 | ++__m; |
| 48 | } | 55 | } |
| 49 | } | 56 | } |
| 50 | return std::move(__m, __last, __first); | 57 | |
| 58 | _Iter __result = std::__move<_AlgPolicy>(__m, __last, __first).__out_; | ||
| 59 | return {std::move(__first), std::move(__result)}; | ||
| 60 | } | ||
| 61 | |||
| 62 | template <class _ForwardIterator> | ||
| 63 | _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator | ||
| 64 | shift_left(_ForwardIterator __first, | ||
| 65 | _ForwardIterator __last, | ||
| 66 | typename iterator_traits<_ForwardIterator>::difference_type __n) { | ||
| 67 | return std::__shift_left<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __n).second; | ||
| 51 | } | 68 | } |
| 52 | 69 | ||
| 53 | #endif // _LIBCPP_STD_VER >= 20 | 70 | #endif // _LIBCPP_STD_VER >= 20 |
lib/libcxx/include/__algorithm/shift_right.h+53-27| ... | @@ -9,11 +9,17 @@ | ... | @@ -9,11 +9,17 @@ |
| 9 | #ifndef _LIBCPP___ALGORITHM_SHIFT_RIGHT_H | 9 | #ifndef _LIBCPP___ALGORITHM_SHIFT_RIGHT_H |
| 10 | #define _LIBCPP___ALGORITHM_SHIFT_RIGHT_H | 10 | #define _LIBCPP___ALGORITHM_SHIFT_RIGHT_H |
| 11 | 11 | ||
| 12 | #include <__algorithm/iterator_operations.h> | ||
| 12 | #include <__algorithm/move.h> | 13 | #include <__algorithm/move.h> |
| 13 | #include <__algorithm/move_backward.h> | 14 | #include <__algorithm/move_backward.h> |
| 14 | #include <__algorithm/swap_ranges.h> | 15 | #include <__algorithm/swap_ranges.h> |
| 16 | #include <__assert> | ||
| 17 | #include <__concepts/derived_from.h> | ||
| 15 | #include <__config> | 18 | #include <__config> |
| 19 | #include <__iterator/concepts.h> | ||
| 16 | #include <__iterator/iterator_traits.h> | 20 | #include <__iterator/iterator_traits.h> |
| 21 | #include <__utility/move.h> | ||
| 22 | #include <__utility/pair.h> | ||
| 17 | #include <__utility/swap.h> | 23 | #include <__utility/swap.h> |
| 18 | 24 | ||
| 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 25 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | @@ -27,36 +33,48 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -27,36 +33,48 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 33 | ||
| 28 | #if _LIBCPP_STD_VER >= 20 | 34 | #if _LIBCPP_STD_VER >= 20 |
| 29 | 35 | ||
| 30 | template <class _ForwardIterator> | 36 | template <class _AlgPolicy, class _Iter, class _Sent> |
| 31 | inline _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator | 37 | _LIBCPP_HIDE_FROM_ABI constexpr pair<_Iter, _Iter> |
| 32 | shift_right(_ForwardIterator __first, | 38 | __shift_right(_Iter __first, _Sent __last, typename _IterOps<_AlgPolicy>::template __difference_type<_Iter> __n) { |
| 33 | _ForwardIterator __last, | 39 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n >= 0, "Providing a negative shift amount to shift_right is UB"); |
| 34 | typename iterator_traits<_ForwardIterator>::difference_type __n) { | ||
| 35 | if (__n == 0) { | 40 | if (__n == 0) { |
| 36 | return __first; | 41 | _Iter __end = _IterOps<_AlgPolicy>::next(__first, __last); |
| 42 | return pair<_Iter, _Iter>(std::move(__first), std::move(__end)); | ||
| 37 | } | 43 | } |
| 38 | 44 | ||
| 39 | if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) { | 45 | using _IterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_Iter>; |
| 40 | decltype(__n) __d = __last - __first; | 46 | |
| 41 | if (__n >= __d) { | 47 | if constexpr (derived_from<_IterCategory, random_access_iterator_tag>) { |
| 42 | return __last; | 48 | _Iter __end = _IterOps<_AlgPolicy>::next(__first, __last); |
| 49 | auto __size = __end - __first; | ||
| 50 | if (__n >= __size) { | ||
| 51 | return pair<_Iter, _Iter>(__end, std::move(__end)); | ||
| 52 | } | ||
| 53 | _Iter __m = __first; | ||
| 54 | _IterOps<_AlgPolicy>::advance(__m, (__size - __n)); | ||
| 55 | auto __ret = std::__move_backward<_AlgPolicy>(std::move(__first), std::move(__m), __end); | ||
| 56 | return pair<_Iter, _Iter>(std::move(__ret.__out_), std::move(__end)); | ||
| 57 | } else if constexpr (derived_from<_IterCategory, bidirectional_iterator_tag>) { | ||
| 58 | _Iter __end = _IterOps<_AlgPolicy>::next(__first, __last); | ||
| 59 | if constexpr (sized_sentinel_for<_Sent, _Iter>) { | ||
| 60 | if (__n >= ranges::distance(__first, __last)) { | ||
| 61 | return pair<_Iter, _Iter>(__end, std::move(__end)); | ||
| 62 | } | ||
| 43 | } | 63 | } |
| 44 | _ForwardIterator __m = __first + (__d - __n); | 64 | _Iter __m = __end; |
| 45 | return std::move_backward(__first, __m, __last); | ||
| 46 | } else if constexpr (__has_bidirectional_iterator_category<_ForwardIterator>::value) { | ||
| 47 | _ForwardIterator __m = __last; | ||
| 48 | for (; __n > 0; --__n) { | 65 | for (; __n > 0; --__n) { |
| 49 | if (__m == __first) { | 66 | if (__m == __first) { |
| 50 | return __last; | 67 | return pair<_Iter, _Iter>(__end, std::move(__end)); |
| 51 | } | 68 | } |
| 52 | --__m; | 69 | --__m; |
| 53 | } | 70 | } |
| 54 | return std::move_backward(__first, __m, __last); | 71 | auto __ret = std::__move_backward<_AlgPolicy>(std::move(__first), std::move(__m), __end); |
| 72 | return pair<_Iter, _Iter>(std::move(__ret.__out_), std::move(__end)); | ||
| 55 | } else { | 73 | } else { |
| 56 | _ForwardIterator __ret = __first; | 74 | _Iter __ret = __first; |
| 57 | for (; __n > 0; --__n) { | 75 | for (; __n > 0; --__n) { |
| 58 | if (__ret == __last) { | 76 | if (__ret == __last) { |
| 59 | return __last; | 77 | return pair<_Iter, _Iter>(__ret, std::move(__ret)); |
| 60 | } | 78 | } |
| 61 | ++__ret; | 79 | ++__ret; |
| 62 | } | 80 | } |
| ... | @@ -64,28 +82,28 @@ shift_right(_ForwardIterator __first, | ... | @@ -64,28 +82,28 @@ shift_right(_ForwardIterator __first, |
| 64 | // We have an __n-element scratch space from __first to __ret. | 82 | // We have an __n-element scratch space from __first to __ret. |
| 65 | // Slide an __n-element window [__trail, __lead) from left to right. | 83 | // Slide an __n-element window [__trail, __lead) from left to right. |
| 66 | // We're essentially doing swap_ranges(__first, __ret, __trail, __lead) | 84 | // We're essentially doing swap_ranges(__first, __ret, __trail, __lead) |
| 67 | // over and over; but once __lead reaches __last we needn't bother | 85 | // over and over; but once __lead reaches __end we needn't bother |
| 68 | // to save the values of elements [__trail, __last). | 86 | // to save the values of elements [__trail, __end). |
| 69 | 87 | ||
| 70 | auto __trail = __first; | 88 | auto __trail = __first; |
| 71 | auto __lead = __ret; | 89 | auto __lead = __ret; |
| 72 | while (__trail != __ret) { | 90 | while (__trail != __ret) { |
| 73 | if (__lead == __last) { | 91 | if (__lead == __last) { |
| 74 | std::move(__first, __trail, __ret); | 92 | std::__move<_AlgPolicy>(std::move(__first), std::move(__trail), __ret); |
| 75 | return __ret; | 93 | return pair<_Iter, _Iter>(__ret, std::move(__lead)); |
| 76 | } | 94 | } |
| 77 | ++__trail; | 95 | ++__trail; |
| 78 | ++__lead; | 96 | ++__lead; |
| 79 | } | 97 | } |
| 80 | 98 | ||
| 81 | _ForwardIterator __mid = __first; | 99 | _Iter __mid = __first; |
| 82 | while (true) { | 100 | while (true) { |
| 83 | if (__lead == __last) { | 101 | if (__lead == __last) { |
| 84 | __trail = std::move(__mid, __ret, __trail); | 102 | __trail = std::__move<_AlgPolicy>(__mid, __ret, __trail).__out_; |
| 85 | std::move(__first, __mid, __trail); | 103 | std::__move<_AlgPolicy>(std::move(__first), std::move(__mid), std::move(__trail)); |
| 86 | return __ret; | 104 | return pair<_Iter, _Iter>(__ret, std::move(__lead)); |
| 87 | } | 105 | } |
| 88 | swap(*__mid, *__trail); | 106 | _IterOps<_AlgPolicy>::iter_swap(__mid, __trail); |
| 89 | ++__mid; | 107 | ++__mid; |
| 90 | ++__trail; | 108 | ++__trail; |
| 91 | ++__lead; | 109 | ++__lead; |
| ... | @@ -96,6 +114,14 @@ shift_right(_ForwardIterator __first, | ... | @@ -96,6 +114,14 @@ shift_right(_ForwardIterator __first, |
| 96 | } | 114 | } |
| 97 | } | 115 | } |
| 98 | 116 | ||
| 117 | template <class _ForwardIterator> | ||
| 118 | _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator | ||
| 119 | shift_right(_ForwardIterator __first, | ||
| 120 | _ForwardIterator __last, | ||
| 121 | typename iterator_traits<_ForwardIterator>::difference_type __n) { | ||
| 122 | return std::__shift_right<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __n).first; | ||
| 123 | } | ||
| 124 | |||
| 99 | #endif // _LIBCPP_STD_VER >= 20 | 125 | #endif // _LIBCPP_STD_VER >= 20 |
| 100 | 126 | ||
| 101 | _LIBCPP_END_NAMESPACE_STD | 127 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/shuffle.h+2| ... | @@ -28,6 +28,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -28,6 +28,7 @@ _LIBCPP_PUSH_MACROS |
| 28 | 28 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | ||
| 31 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 31 | class _LIBCPP_EXPORTED_FROM_ABI __libcpp_debug_randomizer { | 32 | class _LIBCPP_EXPORTED_FROM_ABI __libcpp_debug_randomizer { |
| 32 | public: | 33 | public: |
| 33 | _LIBCPP_HIDE_FROM_ABI __libcpp_debug_randomizer() { | 34 | _LIBCPP_HIDE_FROM_ABI __libcpp_debug_randomizer() { |
| ... | @@ -160,6 +161,7 @@ shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _UniformRan | ... | @@ -160,6 +161,7 @@ shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _UniformRan |
| 160 | std::move(__first), std::move(__last), std::forward<_UniformRandomNumberGenerator>(__g)); | 161 | std::move(__first), std::move(__last), std::forward<_UniformRandomNumberGenerator>(__g)); |
| 161 | } | 162 | } |
| 162 | 163 | ||
| 164 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 163 | _LIBCPP_END_NAMESPACE_STD | 165 | _LIBCPP_END_NAMESPACE_STD |
| 164 | 166 | ||
| 165 | _LIBCPP_POP_MACROS | 167 | _LIBCPP_POP_MACROS |
lib/libcxx/include/__algorithm/simd_utils.h+4-12| ... | @@ -90,6 +90,9 @@ inline constexpr size_t __native_vector_size = 1; | ... | @@ -90,6 +90,9 @@ inline constexpr size_t __native_vector_size = 1; |
| 90 | template <class _ArithmeticT, size_t _Np> | 90 | template <class _ArithmeticT, size_t _Np> |
| 91 | using __simd_vector __attribute__((__ext_vector_type__(_Np))) _LIBCPP_NODEBUG = _ArithmeticT; | 91 | using __simd_vector __attribute__((__ext_vector_type__(_Np))) _LIBCPP_NODEBUG = _ArithmeticT; |
| 92 | 92 | ||
| 93 | _LIBCPP_DIAGNOSTIC_PUSH | ||
| 94 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpsabi") | ||
| 95 | |||
| 93 | template <class _VecT> | 96 | template <class _VecT> |
| 94 | inline constexpr size_t __simd_vector_size_v = []<bool _False = false>() -> size_t { | 97 | inline constexpr size_t __simd_vector_size_v = []<bool _False = false>() -> size_t { |
| 95 | static_assert(_False, "Not a vector!"); | 98 | static_assert(_False, "Not a vector!"); |
| ... | @@ -115,8 +118,6 @@ template <class _VecT, class _Iter> | ... | @@ -115,8 +118,6 @@ template <class _VecT, class _Iter> |
| 115 | } | 118 | } |
| 116 | 119 | ||
| 117 | // Load the first _Np elements, zero the rest | 120 | // Load the first _Np elements, zero the rest |
| 118 | _LIBCPP_DIAGNOSTIC_PUSH | ||
| 119 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpsabi") | ||
| 120 | template <class _VecT, size_t _Np, class _Iter> | 121 | template <class _VecT, size_t _Np, class _Iter> |
| 121 | [[__nodiscard__]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _VecT __partial_load(_Iter __iter) noexcept { | 122 | [[__nodiscard__]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _VecT __partial_load(_Iter __iter) noexcept { |
| 122 | return [=]<size_t... _LoadIndices, size_t... _ZeroIndices>( | 123 | return [=]<size_t... _LoadIndices, size_t... _ZeroIndices>( |
| ... | @@ -125,16 +126,6 @@ template <class _VecT, size_t _Np, class _Iter> | ... | @@ -125,16 +126,6 @@ template <class _VecT, size_t _Np, class _Iter> |
| 125 | }(make_index_sequence<_Np>{}, make_index_sequence<__simd_vector_size_v<_VecT> - _Np>{}); | 126 | }(make_index_sequence<_Np>{}, make_index_sequence<__simd_vector_size_v<_VecT> - _Np>{}); |
| 126 | } | 127 | } |
| 127 | 128 | ||
| 128 | // Create a vector where every elements is __val | ||
| 129 | template <class _VecT> | ||
| 130 | [[__nodiscard__]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _VecT | ||
| 131 | __broadcast(__simd_vector_underlying_type_t<_VecT> __val) { | ||
| 132 | return [&]<std::size_t... _Indices>(index_sequence<_Indices...>) { | ||
| 133 | return _VecT{((void)_Indices, __val)...}; | ||
| 134 | }(make_index_sequence<__simd_vector_size_v<_VecT>>()); | ||
| 135 | } | ||
| 136 | _LIBCPP_DIAGNOSTIC_POP | ||
| 137 | |||
| 138 | template <class _Tp, size_t _Np> | 129 | template <class _Tp, size_t _Np> |
| 139 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool __any_of(__simd_vector<_Tp, _Np> __vec) noexcept { | 130 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool __any_of(__simd_vector<_Tp, _Np> __vec) noexcept { |
| 140 | return __builtin_reduce_or(__builtin_convertvector(__vec, __simd_vector<bool, _Np>)); | 131 | return __builtin_reduce_or(__builtin_convertvector(__vec, __simd_vector<bool, _Np>)); |
| ... | @@ -183,6 +174,7 @@ template <class _Tp, size_t _Np> | ... | @@ -183,6 +174,7 @@ template <class _Tp, size_t _Np> |
| 183 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t __find_first_not_set(__simd_vector<_Tp, _Np> __vec) noexcept { | 174 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t __find_first_not_set(__simd_vector<_Tp, _Np> __vec) noexcept { |
| 184 | return std::__find_first_set(~__vec); | 175 | return std::__find_first_set(~__vec); |
| 185 | } | 176 | } |
| 177 | _LIBCPP_DIAGNOSTIC_POP | ||
| 186 | 178 | ||
| 187 | _LIBCPP_END_NAMESPACE_STD | 179 | _LIBCPP_END_NAMESPACE_STD |
| 188 | 180 |
lib/libcxx/include/__algorithm/sort.h+2| ... | @@ -828,6 +828,7 @@ void __introsort(_RandomAccessIterator __first, | ... | @@ -828,6 +828,7 @@ void __introsort(_RandomAccessIterator __first, |
| 828 | } | 828 | } |
| 829 | } | 829 | } |
| 830 | 830 | ||
| 831 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 831 | template <class _Comp, class _RandomAccessIterator> | 832 | template <class _Comp, class _RandomAccessIterator> |
| 832 | void __sort(_RandomAccessIterator, _RandomAccessIterator, _Comp); | 833 | void __sort(_RandomAccessIterator, _RandomAccessIterator, _Comp); |
| 833 | 834 | ||
| ... | @@ -856,6 +857,7 @@ extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<float>&, float*>(fl | ... | @@ -856,6 +857,7 @@ extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<float>&, float*>(fl |
| 856 | extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<double>&, double*>(double*, double*, __less<double>&); | 857 | extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<double>&, double*>(double*, double*, __less<double>&); |
| 857 | extern template _LIBCPP_EXPORTED_FROM_ABI void | 858 | extern template _LIBCPP_EXPORTED_FROM_ABI void |
| 858 | __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&); | 859 | __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&); |
| 860 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 859 | 861 | ||
| 860 | template <class _AlgPolicy, class _RandomAccessIterator, class _Comp> | 862 | template <class _AlgPolicy, class _RandomAccessIterator, class _Comp> |
| 861 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void | 863 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void |
lib/libcxx/include/__algorithm/specialized_algorithms.h+1| ... | @@ -21,6 +21,7 @@ namespace _Algorithm { | ... | @@ -21,6 +21,7 @@ namespace _Algorithm { |
| 21 | struct __copy {}; | 21 | struct __copy {}; |
| 22 | struct __fill_n {}; | 22 | struct __fill_n {}; |
| 23 | struct __for_each {}; | 23 | struct __for_each {}; |
| 24 | struct __swap_ranges {}; | ||
| 24 | } // namespace _Algorithm | 25 | } // namespace _Algorithm |
| 25 | 26 | ||
| 26 | template <class> | 27 | template <class> |
lib/libcxx/include/__algorithm/swap_ranges.h+24-178| ... | @@ -10,12 +10,11 @@ | ... | @@ -10,12 +10,11 @@ |
| 10 | #define _LIBCPP___ALGORITHM_SWAP_RANGES_H | 10 | #define _LIBCPP___ALGORITHM_SWAP_RANGES_H |
| 11 | 11 | ||
| 12 | #include <__algorithm/iterator_operations.h> | 12 | #include <__algorithm/iterator_operations.h> |
| 13 | #include <__algorithm/min.h> | 13 | #include <__algorithm/specialized_algorithms.h> |
| 14 | #include <__config> | 14 | #include <__config> |
| 15 | #include <__fwd/bit_reference.h> | 15 | #include <__type_traits/enable_if.h> |
| 16 | #include <__utility/move.h> | 16 | #include <__utility/move.h> |
| 17 | #include <__utility/pair.h> | 17 | #include <__utility/pair.h> |
| 18 | #include <__utility/swap.h> | ||
| 19 | 18 | ||
| 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 21 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| ... | @@ -26,189 +25,36 @@ _LIBCPP_PUSH_MACROS | ... | @@ -26,189 +25,36 @@ _LIBCPP_PUSH_MACROS |
| 26 | 25 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 27 | ||
| 29 | template <class _Cl, class _Cr> | 28 | template < |
| 30 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cr, false> __swap_ranges_aligned( | 29 | class _AlgPolicy, |
| 31 | __bit_iterator<_Cl, false> __first, __bit_iterator<_Cl, false> __last, __bit_iterator<_Cr, false> __result) { | 30 | class _Iter1, |
| 32 | using _I1 = __bit_iterator<_Cl, false>; | 31 | class _Sent1, |
| 33 | using difference_type = typename _I1::difference_type; | 32 | class _Iter2, |
| 34 | using __storage_type = typename _I1::__storage_type; | 33 | class _SpecialAlg = |
| 35 | 34 | __specialized_algorithm<_Algorithm::__swap_ranges, __iterator_pair<_Iter1, _Sent1>, __single_iterator<_Iter2> >, | |
| 36 | const int __bits_per_word = _I1::__bits_per_word; | 35 | __enable_if_t<_SpecialAlg::__has_algorithm, int> = 0> |
| 37 | difference_type __n = __last - __first; | 36 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter2> |
| 38 | if (__n > 0) { | 37 | __swap_ranges(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2) { |
| 39 | // do first word | 38 | return _SpecialAlg()(std::move(__first1), std::move(__last1), std::move(__first2)); |
| 40 | if (__first.__ctz_ != 0) { | ||
| 41 | unsigned __clz = __bits_per_word - __first.__ctz_; | ||
| 42 | difference_type __dn = std::min(static_cast<difference_type>(__clz), __n); | ||
| 43 | __n -= __dn; | ||
| 44 | __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn)); | ||
| 45 | __storage_type __b1 = *__first.__seg_ & __m; | ||
| 46 | *__first.__seg_ &= ~__m; | ||
| 47 | __storage_type __b2 = *__result.__seg_ & __m; | ||
| 48 | *__result.__seg_ &= ~__m; | ||
| 49 | *__result.__seg_ |= __b1; | ||
| 50 | *__first.__seg_ |= __b2; | ||
| 51 | __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; | ||
| 52 | __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word); | ||
| 53 | ++__first.__seg_; | ||
| 54 | // __first.__ctz_ = 0; | ||
| 55 | } | ||
| 56 | // __first.__ctz_ == 0; | ||
| 57 | // do middle words | ||
| 58 | for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_, ++__result.__seg_) | ||
| 59 | swap(*__first.__seg_, *__result.__seg_); | ||
| 60 | // do last word | ||
| 61 | if (__n > 0) { | ||
| 62 | __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); | ||
| 63 | __storage_type __b1 = *__first.__seg_ & __m; | ||
| 64 | *__first.__seg_ &= ~__m; | ||
| 65 | __storage_type __b2 = *__result.__seg_ & __m; | ||
| 66 | *__result.__seg_ &= ~__m; | ||
| 67 | *__result.__seg_ |= __b1; | ||
| 68 | *__first.__seg_ |= __b2; | ||
| 69 | __result.__ctz_ = static_cast<unsigned>(__n); | ||
| 70 | } | ||
| 71 | } | ||
| 72 | return __result; | ||
| 73 | } | ||
| 74 | |||
| 75 | template <class _Cl, class _Cr> | ||
| 76 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cr, false> __swap_ranges_unaligned( | ||
| 77 | __bit_iterator<_Cl, false> __first, __bit_iterator<_Cl, false> __last, __bit_iterator<_Cr, false> __result) { | ||
| 78 | using _I1 = __bit_iterator<_Cl, false>; | ||
| 79 | using difference_type = typename _I1::difference_type; | ||
| 80 | using __storage_type = typename _I1::__storage_type; | ||
| 81 | |||
| 82 | const int __bits_per_word = _I1::__bits_per_word; | ||
| 83 | difference_type __n = __last - __first; | ||
| 84 | if (__n > 0) { | ||
| 85 | // do first word | ||
| 86 | if (__first.__ctz_ != 0) { | ||
| 87 | unsigned __clz_f = __bits_per_word - __first.__ctz_; | ||
| 88 | difference_type __dn = std::min(static_cast<difference_type>(__clz_f), __n); | ||
| 89 | __n -= __dn; | ||
| 90 | __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); | ||
| 91 | __storage_type __b1 = *__first.__seg_ & __m; | ||
| 92 | *__first.__seg_ &= ~__m; | ||
| 93 | unsigned __clz_r = __bits_per_word - __result.__ctz_; | ||
| 94 | __storage_type __ddn = std::min<__storage_type>(__dn, __clz_r); | ||
| 95 | __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); | ||
| 96 | __storage_type __b2 = *__result.__seg_ & __m; | ||
| 97 | *__result.__seg_ &= ~__m; | ||
| 98 | if (__result.__ctz_ > __first.__ctz_) { | ||
| 99 | unsigned __s = __result.__ctz_ - __first.__ctz_; | ||
| 100 | *__result.__seg_ |= __b1 << __s; | ||
| 101 | *__first.__seg_ |= __b2 >> __s; | ||
| 102 | } else { | ||
| 103 | unsigned __s = __first.__ctz_ - __result.__ctz_; | ||
| 104 | *__result.__seg_ |= __b1 >> __s; | ||
| 105 | *__first.__seg_ |= __b2 << __s; | ||
| 106 | } | ||
| 107 | __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word; | ||
| 108 | __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_) % __bits_per_word); | ||
| 109 | __dn -= __ddn; | ||
| 110 | if (__dn > 0) { | ||
| 111 | __m = ~__storage_type(0) >> (__bits_per_word - __dn); | ||
| 112 | __b2 = *__result.__seg_ & __m; | ||
| 113 | *__result.__seg_ &= ~__m; | ||
| 114 | unsigned __s = __first.__ctz_ + __ddn; | ||
| 115 | *__result.__seg_ |= __b1 >> __s; | ||
| 116 | *__first.__seg_ |= __b2 << __s; | ||
| 117 | __result.__ctz_ = static_cast<unsigned>(__dn); | ||
| 118 | } | ||
| 119 | ++__first.__seg_; | ||
| 120 | // __first.__ctz_ = 0; | ||
| 121 | } | ||
| 122 | // __first.__ctz_ == 0; | ||
| 123 | // do middle words | ||
| 124 | __storage_type __m = ~__storage_type(0) << __result.__ctz_; | ||
| 125 | unsigned __clz_r = __bits_per_word - __result.__ctz_; | ||
| 126 | for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) { | ||
| 127 | __storage_type __b1 = *__first.__seg_; | ||
| 128 | __storage_type __b2 = *__result.__seg_ & __m; | ||
| 129 | *__result.__seg_ &= ~__m; | ||
| 130 | *__result.__seg_ |= __b1 << __result.__ctz_; | ||
| 131 | *__first.__seg_ = __b2 >> __result.__ctz_; | ||
| 132 | ++__result.__seg_; | ||
| 133 | __b2 = *__result.__seg_ & ~__m; | ||
| 134 | *__result.__seg_ &= __m; | ||
| 135 | *__result.__seg_ |= __b1 >> __clz_r; | ||
| 136 | *__first.__seg_ |= __b2 << __clz_r; | ||
| 137 | } | ||
| 138 | // do last word | ||
| 139 | if (__n > 0) { | ||
| 140 | __m = ~__storage_type(0) >> (__bits_per_word - __n); | ||
| 141 | __storage_type __b1 = *__first.__seg_ & __m; | ||
| 142 | *__first.__seg_ &= ~__m; | ||
| 143 | __storage_type __dn = std::min<__storage_type>(__n, __clz_r); | ||
| 144 | __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn)); | ||
| 145 | __storage_type __b2 = *__result.__seg_ & __m; | ||
| 146 | *__result.__seg_ &= ~__m; | ||
| 147 | *__result.__seg_ |= __b1 << __result.__ctz_; | ||
| 148 | *__first.__seg_ |= __b2 >> __result.__ctz_; | ||
| 149 | __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; | ||
| 150 | __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word); | ||
| 151 | __n -= __dn; | ||
| 152 | if (__n > 0) { | ||
| 153 | __m = ~__storage_type(0) >> (__bits_per_word - __n); | ||
| 154 | __b2 = *__result.__seg_ & __m; | ||
| 155 | *__result.__seg_ &= ~__m; | ||
| 156 | *__result.__seg_ |= __b1 >> __dn; | ||
| 157 | *__first.__seg_ |= __b2 << __dn; | ||
| 158 | __result.__ctz_ = static_cast<unsigned>(__n); | ||
| 159 | } | ||
| 160 | } | ||
| 161 | } | ||
| 162 | return __result; | ||
| 163 | } | ||
| 164 | |||
| 165 | // 2+1 iterators: size2 >= size1; used by std::swap_ranges. | ||
| 166 | template <class, class _Cl, class _Cr> | ||
| 167 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cl, false>, __bit_iterator<_Cr, false> > | ||
| 168 | __swap_ranges(__bit_iterator<_Cl, false> __first1, | ||
| 169 | __bit_iterator<_Cl, false> __last1, | ||
| 170 | __bit_iterator<_Cr, false> __first2) { | ||
| 171 | if (__first1.__ctz_ == __first2.__ctz_) | ||
| 172 | return std::make_pair(__last1, std::__swap_ranges_aligned(__first1, __last1, __first2)); | ||
| 173 | return std::make_pair(__last1, std::__swap_ranges_unaligned(__first1, __last1, __first2)); | ||
| 174 | } | ||
| 175 | |||
| 176 | // 2+2 iterators: used by std::ranges::swap_ranges. | ||
| 177 | template <class _AlgPolicy, class _Cl, class _Cr> | ||
| 178 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cl, false>, __bit_iterator<_Cr, false> > | ||
| 179 | __swap_ranges(__bit_iterator<_Cl, false> __first1, | ||
| 180 | __bit_iterator<_Cl, false> __last1, | ||
| 181 | __bit_iterator<_Cr, false> __first2, | ||
| 182 | __bit_iterator<_Cr, false> __last2) { | ||
| 183 | if (__last1 - __first1 < __last2 - __first2) | ||
| 184 | return std::make_pair(__last1, std::__swap_ranges<_AlgPolicy>(__first1, __last1, __first2).second); | ||
| 185 | return std::make_pair(std::__swap_ranges<_AlgPolicy>(__first2, __last2, __first1).second, __last2); | ||
| 186 | } | ||
| 187 | |||
| 188 | // 2+2 iterators: the shorter size will be used. | ||
| 189 | template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2, class _Sentinel2> | ||
| 190 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator1, _ForwardIterator2> | ||
| 191 | __swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2, _Sentinel2 __last2) { | ||
| 192 | while (__first1 != __last1 && __first2 != __last2) { | ||
| 193 | _IterOps<_AlgPolicy>::iter_swap(__first1, __first2); | ||
| 194 | ++__first1; | ||
| 195 | ++__first2; | ||
| 196 | } | ||
| 197 | |||
| 198 | return pair<_ForwardIterator1, _ForwardIterator2>(std::move(__first1), std::move(__first2)); | ||
| 199 | } | 39 | } |
| 200 | 40 | ||
| 201 | // 2+1 iterators: size2 >= size1. | 41 | template < |
| 202 | template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2> | 42 | class _AlgPolicy, |
| 203 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator1, _ForwardIterator2> | 43 | class _Iter1, |
| 204 | __swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2) { | 44 | class _Sent1, |
| 45 | class _Iter2, | ||
| 46 | class _SpecialAlg = | ||
| 47 | __specialized_algorithm<_Algorithm::__swap_ranges, __iterator_pair<_Iter1, _Sent1>, __single_iterator<_Iter2> >, | ||
| 48 | __enable_if_t<!_SpecialAlg::__has_algorithm, int> = 0> | ||
| 49 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter2> | ||
| 50 | __swap_ranges(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2) { | ||
| 205 | while (__first1 != __last1) { | 51 | while (__first1 != __last1) { |
| 206 | _IterOps<_AlgPolicy>::iter_swap(__first1, __first2); | 52 | _IterOps<_AlgPolicy>::iter_swap(__first1, __first2); |
| 207 | ++__first1; | 53 | ++__first1; |
| 208 | ++__first2; | 54 | ++__first2; |
| 209 | } | 55 | } |
| 210 | 56 | ||
| 211 | return pair<_ForwardIterator1, _ForwardIterator2>(std::move(__first1), std::move(__first2)); | 57 | return pair<_Iter1, _Iter2>(std::move(__first1), std::move(__first2)); |
| 212 | } | 58 | } |
| 213 | 59 | ||
| 214 | template <class _ForwardIterator1, class _ForwardIterator2> | 60 | template <class _ForwardIterator1, class _ForwardIterator2> |
lib/libcxx/include/__algorithm/three_way_comp_ref_type.h+4-4| ... | @@ -19,10 +19,10 @@ | ... | @@ -19,10 +19,10 @@ |
| 19 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 20 | 22 | #if _LIBCPP_STD_VER >= 20 |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | template <class _Comp> | 26 | template <class _Comp> |
| 27 | struct __debug_three_way_comp { | 27 | struct __debug_three_way_comp { |
| 28 | _Comp& __comp_; | 28 | _Comp& __comp_; |
| ... | @@ -67,8 +67,8 @@ template <class _Comp> | ... | @@ -67,8 +67,8 @@ template <class _Comp> |
| 67 | using __three_way_comp_ref_type _LIBCPP_NODEBUG = _Comp&; | 67 | using __three_way_comp_ref_type _LIBCPP_NODEBUG = _Comp&; |
| 68 | # endif | 68 | # endif |
| 69 | 69 | ||
| 70 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 71 | |||
| 72 | _LIBCPP_END_NAMESPACE_STD | 70 | _LIBCPP_END_NAMESPACE_STD |
| 73 | 71 | ||
| 72 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 73 | |||
| 74 | #endif // _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H | 74 | #endif // _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H |
lib/libcxx/include/__algorithm/unique_copy.h+8-8| ... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
| 10 | #define _LIBCPP___ALGORITHM_UNIQUE_COPY_H | 10 | #define _LIBCPP___ALGORITHM_UNIQUE_COPY_H |
| 11 | 11 | ||
| 12 | #include <__algorithm/comp.h> | 12 | #include <__algorithm/comp.h> |
| 13 | #include <__algorithm/in_out_result.h> | ||
| 13 | #include <__algorithm/iterator_operations.h> | 14 | #include <__algorithm/iterator_operations.h> |
| 14 | #include <__config> | 15 | #include <__config> |
| 15 | #include <__iterator/iterator_traits.h> | 16 | #include <__iterator/iterator_traits.h> |
| ... | @@ -17,7 +18,6 @@ | ... | @@ -17,7 +18,6 @@ |
| 17 | #include <__type_traits/is_base_of.h> | 18 | #include <__type_traits/is_base_of.h> |
| 18 | #include <__type_traits/is_same.h> | 19 | #include <__type_traits/is_same.h> |
| 19 | #include <__utility/move.h> | 20 | #include <__utility/move.h> |
| 20 | #include <__utility/pair.h> | ||
| 21 | 21 | ||
| 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | # pragma GCC system_header | 23 | # pragma GCC system_header |
| ... | @@ -37,7 +37,7 @@ struct __read_from_tmp_value_tag {}; | ... | @@ -37,7 +37,7 @@ struct __read_from_tmp_value_tag {}; |
| 37 | } // namespace __unique_copy_tags | 37 | } // namespace __unique_copy_tags |
| 38 | 38 | ||
| 39 | template <class _AlgPolicy, class _BinaryPredicate, class _InputIterator, class _Sent, class _OutputIterator> | 39 | template <class _AlgPolicy, class _BinaryPredicate, class _InputIterator, class _Sent, class _OutputIterator> |
| 40 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _OutputIterator> | 40 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __in_out_result<_InputIterator, _OutputIterator> |
| 41 | __unique_copy(_InputIterator __first, | 41 | __unique_copy(_InputIterator __first, |
| 42 | _Sent __last, | 42 | _Sent __last, |
| 43 | _OutputIterator __result, | 43 | _OutputIterator __result, |
| ... | @@ -55,11 +55,11 @@ __unique_copy(_InputIterator __first, | ... | @@ -55,11 +55,11 @@ __unique_copy(_InputIterator __first, |
| 55 | } | 55 | } |
| 56 | } | 56 | } |
| 57 | } | 57 | } |
| 58 | return pair<_InputIterator, _OutputIterator>(std::move(__first), std::move(__result)); | 58 | return {std::move(__first), std::move(__result)}; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | template <class _AlgPolicy, class _BinaryPredicate, class _ForwardIterator, class _Sent, class _OutputIterator> | 61 | template <class _AlgPolicy, class _BinaryPredicate, class _ForwardIterator, class _Sent, class _OutputIterator> |
| 62 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pair<_ForwardIterator, _OutputIterator> | 62 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __in_out_result<_ForwardIterator, _OutputIterator> |
| 63 | __unique_copy(_ForwardIterator __first, | 63 | __unique_copy(_ForwardIterator __first, |
| 64 | _Sent __last, | 64 | _Sent __last, |
| 65 | _OutputIterator __result, | 65 | _OutputIterator __result, |
| ... | @@ -77,11 +77,11 @@ __unique_copy(_ForwardIterator __first, | ... | @@ -77,11 +77,11 @@ __unique_copy(_ForwardIterator __first, |
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | return pair<_ForwardIterator, _OutputIterator>(std::move(__first), std::move(__result)); | 80 | return {std::move(__first), std::move(__result)}; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | template <class _AlgPolicy, class _BinaryPredicate, class _InputIterator, class _Sent, class _InputAndOutputIterator> | 83 | template <class _AlgPolicy, class _BinaryPredicate, class _InputIterator, class _Sent, class _InputAndOutputIterator> |
| 84 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _InputAndOutputIterator> | 84 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __in_out_result<_InputIterator, _InputAndOutputIterator> |
| 85 | __unique_copy(_InputIterator __first, | 85 | __unique_copy(_InputIterator __first, |
| 86 | _Sent __last, | 86 | _Sent __last, |
| 87 | _InputAndOutputIterator __result, | 87 | _InputAndOutputIterator __result, |
| ... | @@ -94,7 +94,7 @@ __unique_copy(_InputIterator __first, | ... | @@ -94,7 +94,7 @@ __unique_copy(_InputIterator __first, |
| 94 | *++__result = *__first; | 94 | *++__result = *__first; |
| 95 | ++__result; | 95 | ++__result; |
| 96 | } | 96 | } |
| 97 | return pair<_InputIterator, _InputAndOutputIterator>(std::move(__first), std::move(__result)); | 97 | return {std::move(__first), std::move(__result)}; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | template <class _InputIterator, class _OutputIterator, class _BinaryPredicate> | 100 | template <class _InputIterator, class _OutputIterator, class _BinaryPredicate> |
| ... | @@ -111,7 +111,7 @@ unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __res | ... | @@ -111,7 +111,7 @@ unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __res |
| 111 | __unique_copy_tags::__read_from_tmp_value_tag> >; | 111 | __unique_copy_tags::__read_from_tmp_value_tag> >; |
| 112 | return std::__unique_copy<_ClassicAlgPolicy>( | 112 | return std::__unique_copy<_ClassicAlgPolicy>( |
| 113 | std::move(__first), std::move(__last), std::move(__result), __pred, __algo_tag()) | 113 | std::move(__first), std::move(__last), std::move(__result), __pred, __algo_tag()) |
| 114 | .second; | 114 | .__out_; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | template <class _InputIterator, class _OutputIterator> | 117 | template <class _InputIterator, class _OutputIterator> |
lib/libcxx/include/__algorithm/unwrap_iter.h+8-10| ... | @@ -57,21 +57,19 @@ struct __unwrap_iter_impl<_Iter, true> { | ... | @@ -57,21 +57,19 @@ struct __unwrap_iter_impl<_Iter, true> { |
| 57 | } | 57 | } |
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | template <class _Iter, | 60 | template <class _Iter, class _Impl = __unwrap_iter_impl<_Iter> > |
| 61 | class _Impl = __unwrap_iter_impl<_Iter>, | ||
| 62 | __enable_if_t<is_copy_constructible<_Iter>::value, int> = 0> | ||
| 63 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 decltype(_Impl::__unwrap(std::declval<_Iter>())) | 61 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 decltype(_Impl::__unwrap(std::declval<_Iter>())) |
| 64 | __unwrap_iter(_Iter __i) _NOEXCEPT { | 62 | __unwrap_iter(_Iter __i) _NOEXCEPT { |
| 65 | return _Impl::__unwrap(__i); | ||
| 66 | } | ||
| 67 | |||
| 68 | // Allow input_iterators to be passed to __unwrap_iter (but not __rewrap_iter) | 63 | // Allow input_iterators to be passed to __unwrap_iter (but not __rewrap_iter) |
| 69 | #if _LIBCPP_STD_VER >= 20 | 64 | #if _LIBCPP_STD_VER >= 20 |
| 70 | template <class _Iter, __enable_if_t<!is_copy_constructible<_Iter>::value, int> = 0> | 65 | if constexpr (!is_copy_constructible_v<_Iter>) { |
| 71 | inline _LIBCPP_HIDE_FROM_ABI constexpr _Iter __unwrap_iter(_Iter __i) noexcept { | 66 | return __i; |
| 72 | return __i; | 67 | } else |
| 73 | } | ||
| 74 | #endif | 68 | #endif |
| 69 | { | ||
| 70 | return _Impl::__unwrap(__i); | ||
| 71 | } | ||
| 72 | } | ||
| 75 | 73 | ||
| 76 | template <class _OrigIter, class _Iter, class _Impl = __unwrap_iter_impl<_OrigIter> > | 74 | template <class _OrigIter, class _Iter, class _Impl = __unwrap_iter_impl<_OrigIter> > |
| 77 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _OrigIter __rewrap_iter(_OrigIter __orig_iter, _Iter __iter) _NOEXCEPT { | 75 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _OrigIter __rewrap_iter(_OrigIter __orig_iter, _Iter __iter) _NOEXCEPT { |
lib/libcxx/include/__algorithm/unwrap_range.h+13-42| ... | @@ -10,10 +10,9 @@ | ... | @@ -10,10 +10,9 @@ |
| 10 | #define _LIBCPP___ALGORITHM_UNWRAP_RANGE_H | 10 | #define _LIBCPP___ALGORITHM_UNWRAP_RANGE_H |
| 11 | 11 | ||
| 12 | #include <__algorithm/unwrap_iter.h> | 12 | #include <__algorithm/unwrap_iter.h> |
| 13 | #include <__concepts/constructible.h> | ||
| 14 | #include <__config> | 13 | #include <__config> |
| 15 | #include <__iterator/concepts.h> | 14 | #include <__iterator/concepts.h> |
| 16 | #include <__iterator/next.h> | 15 | #include <__type_traits/is_same.h> |
| 17 | #include <__utility/declval.h> | 16 | #include <__utility/declval.h> |
| 18 | #include <__utility/move.h> | 17 | #include <__utility/move.h> |
| 19 | #include <__utility/pair.h> | 18 | #include <__utility/pair.h> |
| ... | @@ -33,52 +32,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -33,52 +32,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 32 | ||
| 34 | #if _LIBCPP_STD_VER >= 20 | 33 | #if _LIBCPP_STD_VER >= 20 |
| 35 | template <class _Iter, class _Sent> | 34 | template <class _Iter, class _Sent> |
| 36 | struct __unwrap_range_impl { | 35 | _LIBCPP_HIDE_FROM_ABI constexpr auto __unwrap_range(_Iter __first, _Sent __last) { |
| 37 | _LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Sent __sent) | 36 | if constexpr (is_same_v<_Iter, _Sent>) |
| 38 | requires random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter> | ||
| 39 | { | ||
| 40 | auto __last = ranges::next(__first, __sent); | ||
| 41 | return pair{std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__last))}; | 37 | return pair{std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__last))}; |
| 42 | } | 38 | else if constexpr (random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) { |
| 43 | 39 | auto __iter_last = __first + (__last - __first); | |
| 44 | _LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Sent __last) { | 40 | return pair{std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__iter_last))}; |
| 41 | } else | ||
| 45 | return pair{std::move(__first), std::move(__last)}; | 42 | return pair{std::move(__first), std::move(__last)}; |
| 46 | } | ||
| 47 | |||
| 48 | _LIBCPP_HIDE_FROM_ABI static constexpr auto | ||
| 49 | __rewrap(_Iter __orig_iter, decltype(std::__unwrap_iter(std::move(__orig_iter))) __iter) | ||
| 50 | requires random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter> | ||
| 51 | { | ||
| 52 | return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter)); | ||
| 53 | } | ||
| 54 | |||
| 55 | _LIBCPP_HIDE_FROM_ABI static constexpr auto __rewrap(const _Iter&, _Iter __iter) | ||
| 56 | requires(!(random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>)) | ||
| 57 | { | ||
| 58 | return __iter; | ||
| 59 | } | ||
| 60 | }; | ||
| 61 | |||
| 62 | template <class _Iter> | ||
| 63 | struct __unwrap_range_impl<_Iter, _Iter> { | ||
| 64 | _LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Iter __last) { | ||
| 65 | return pair{std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__last))}; | ||
| 66 | } | ||
| 67 | |||
| 68 | _LIBCPP_HIDE_FROM_ABI static constexpr auto | ||
| 69 | __rewrap(_Iter __orig_iter, decltype(std::__unwrap_iter(__orig_iter)) __iter) { | ||
| 70 | return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter)); | ||
| 71 | } | ||
| 72 | }; | ||
| 73 | |||
| 74 | template <class _Iter, class _Sent> | ||
| 75 | _LIBCPP_HIDE_FROM_ABI constexpr auto __unwrap_range(_Iter __first, _Sent __last) { | ||
| 76 | return __unwrap_range_impl<_Iter, _Sent>::__unwrap(std::move(__first), std::move(__last)); | ||
| 77 | } | 43 | } |
| 78 | 44 | ||
| 79 | template < class _Sent, class _Iter, class _Unwrapped> | 45 | template < class _Sent, class _Iter, class _Unwrapped> |
| 80 | _LIBCPP_HIDE_FROM_ABI constexpr _Iter __rewrap_range(_Iter __orig_iter, _Unwrapped __iter) { | 46 | _LIBCPP_HIDE_FROM_ABI constexpr _Iter __rewrap_range(_Iter __orig_iter, _Unwrapped __iter) { |
| 81 | return __unwrap_range_impl<_Iter, _Sent>::__rewrap(std::move(__orig_iter), std::move(__iter)); | 47 | if constexpr (is_same_v<_Iter, _Sent>) |
| 48 | return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter)); | ||
| 49 | else if constexpr (random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) | ||
| 50 | return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter)); | ||
| 51 | else | ||
| 52 | return __iter; | ||
| 82 | } | 53 | } |
| 83 | #else // _LIBCPP_STD_VER >= 20 | 54 | #else // _LIBCPP_STD_VER >= 20 |
| 84 | template <class _Iter, class _Unwrapped = decltype(std::__unwrap_iter(std::declval<_Iter>()))> | 55 | template <class _Iter, class _Unwrapped = decltype(std::__unwrap_iter(std::declval<_Iter>()))> |
lib/libcxx/include/__assert+1-1| ... | @@ -20,7 +20,7 @@ | ... | @@ -20,7 +20,7 @@ |
| 20 | #define _LIBCPP_ASSERT(expression, message) \ | 20 | #define _LIBCPP_ASSERT(expression, message) \ |
| 21 | (__builtin_expect(static_cast<bool>(expression), 1) \ | 21 | (__builtin_expect(static_cast<bool>(expression), 1) \ |
| 22 | ? (void)0 \ | 22 | ? (void)0 \ |
| 23 | : _LIBCPP_ASSERTION_HANDLER(__FILE__ ":" _LIBCPP_TOSTRING( \ | 23 | : _LIBCPP_ASSERTION_HANDLER(__FILE_NAME__ ":" _LIBCPP_TOSTRING( \ |
| 24 | __LINE__) ": libc++ Hardening assertion " _LIBCPP_TOSTRING(expression) " failed: " message "\n")) | 24 | __LINE__) ": libc++ Hardening assertion " _LIBCPP_TOSTRING(expression) " failed: " message "\n")) |
| 25 | 25 | ||
| 26 | // WARNING: __builtin_assume can currently inhibit optimizations. Only add assumptions with a clear | 26 | // WARNING: __builtin_assume can currently inhibit optimizations. Only add assumptions with a clear |
lib/libcxx/include/__atomic/atomic.h+2-4| ... | @@ -26,9 +26,7 @@ | ... | @@ -26,9 +26,7 @@ |
| 26 | #include <__type_traits/is_nothrow_constructible.h> | 26 | #include <__type_traits/is_nothrow_constructible.h> |
| 27 | #include <__type_traits/is_same.h> | 27 | #include <__type_traits/is_same.h> |
| 28 | #include <__type_traits/is_trivially_copyable.h> | 28 | #include <__type_traits/is_trivially_copyable.h> |
| 29 | #include <__type_traits/remove_const.h> | ||
| 30 | #include <__type_traits/remove_pointer.h> | 29 | #include <__type_traits/remove_pointer.h> |
| 31 | #include <__type_traits/remove_volatile.h> | ||
| 32 | #include <__utility/forward.h> | 30 | #include <__utility/forward.h> |
| 33 | #include <cstring> | 31 | #include <cstring> |
| 34 | 32 | ||
| ... | @@ -297,13 +295,13 @@ struct atomic<_Tp*> : public __atomic_base<_Tp*> { | ... | @@ -297,13 +295,13 @@ struct atomic<_Tp*> : public __atomic_base<_Tp*> { |
| 297 | } | 295 | } |
| 298 | 296 | ||
| 299 | _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { | 297 | _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { |
| 300 | // __atomic_fetch_add accepts function pointers, guard against them. | 298 | // __atomic_fetch_sub accepts function pointers, guard against them. |
| 301 | static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); | 299 | static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); |
| 302 | return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m); | 300 | return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m); |
| 303 | } | 301 | } |
| 304 | 302 | ||
| 305 | _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { | 303 | _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { |
| 306 | // __atomic_fetch_add accepts function pointers, guard against them. | 304 | // __atomic_fetch_sub accepts function pointers, guard against them. |
| 307 | static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); | 305 | static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); |
| 308 | return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m); | 306 | return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m); |
| 309 | } | 307 | } |
lib/libcxx/include/__atomic/atomic_flag.h+14-20| ... | @@ -11,14 +11,10 @@ | ... | @@ -11,14 +11,10 @@ |
| 11 | 11 | ||
| 12 | #include <__atomic/atomic_sync.h> | 12 | #include <__atomic/atomic_sync.h> |
| 13 | #include <__atomic/atomic_waitable_traits.h> | 13 | #include <__atomic/atomic_waitable_traits.h> |
| 14 | #include <__atomic/contention_t.h> | ||
| 15 | #include <__atomic/memory_order.h> | 14 | #include <__atomic/memory_order.h> |
| 16 | #include <__atomic/support.h> | 15 | #include <__atomic/support.h> |
| 17 | #include <__chrono/duration.h> | ||
| 18 | #include <__config> | 16 | #include <__config> |
| 19 | #include <__memory/addressof.h> | 17 | #include <__memory/addressof.h> |
| 20 | #include <__thread/support.h> | ||
| 21 | #include <cstdint> | ||
| 22 | 18 | ||
| 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 24 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| ... | @@ -27,34 +23,34 @@ | ... | @@ -27,34 +23,34 @@ |
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 24 | ||
| 29 | struct atomic_flag { | 25 | struct atomic_flag { |
| 30 | __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_; | 26 | __cxx_atomic_impl<bool> __a_; |
| 31 | 27 | ||
| 32 | _LIBCPP_HIDE_FROM_ABI bool test(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT { | 28 | _LIBCPP_HIDE_FROM_ABI bool test(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT { |
| 33 | return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m); | 29 | return __cxx_atomic_load(&__a_, __m); |
| 34 | } | 30 | } |
| 35 | _LIBCPP_HIDE_FROM_ABI bool test(memory_order __m = memory_order_seq_cst) const _NOEXCEPT { | 31 | _LIBCPP_HIDE_FROM_ABI bool test(memory_order __m = memory_order_seq_cst) const _NOEXCEPT { |
| 36 | return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m); | 32 | return __cxx_atomic_load(&__a_, __m); |
| 37 | } | 33 | } |
| 38 | 34 | ||
| 39 | _LIBCPP_HIDE_FROM_ABI bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { | 35 | _LIBCPP_HIDE_FROM_ABI bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { |
| 40 | return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m); | 36 | return __cxx_atomic_exchange(&__a_, true, __m); |
| 41 | } | 37 | } |
| 42 | _LIBCPP_HIDE_FROM_ABI bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT { | 38 | _LIBCPP_HIDE_FROM_ABI bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT { |
| 43 | return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m); | 39 | return __cxx_atomic_exchange(&__a_, true, __m); |
| 44 | } | 40 | } |
| 45 | _LIBCPP_HIDE_FROM_ABI void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { | 41 | _LIBCPP_HIDE_FROM_ABI void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { |
| 46 | __cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m); | 42 | __cxx_atomic_store(&__a_, false, __m); |
| 47 | } | 43 | } |
| 48 | _LIBCPP_HIDE_FROM_ABI void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT { | 44 | _LIBCPP_HIDE_FROM_ABI void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT { |
| 49 | __cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m); | 45 | __cxx_atomic_store(&__a_, false, __m); |
| 50 | } | 46 | } |
| 51 | 47 | ||
| 52 | #if _LIBCPP_STD_VER >= 20 | 48 | #if _LIBCPP_STD_VER >= 20 |
| 53 | _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT { | 49 | _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT { |
| 54 | std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m); | 50 | std::__atomic_wait(*this, __v, __m); |
| 55 | } | 51 | } |
| 56 | _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT { | 52 | _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT { |
| 57 | std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m); | 53 | std::__atomic_wait(*this, __v, __m); |
| 58 | } | 54 | } |
| 59 | _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { std::__atomic_notify_one(*this); } | 55 | _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { std::__atomic_notify_one(*this); } |
| 60 | _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { std::__atomic_notify_one(*this); } | 56 | _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { std::__atomic_notify_one(*this); } |
| ... | @@ -78,23 +74,21 @@ struct atomic_flag { | ... | @@ -78,23 +74,21 @@ struct atomic_flag { |
| 78 | #if _LIBCPP_STD_VER >= 20 | 74 | #if _LIBCPP_STD_VER >= 20 |
| 79 | template <> | 75 | template <> |
| 80 | struct __atomic_waitable_traits<atomic_flag> { | 76 | struct __atomic_waitable_traits<atomic_flag> { |
| 81 | using __value_type _LIBCPP_NODEBUG = _LIBCPP_ATOMIC_FLAG_TYPE; | 77 | using __value_type _LIBCPP_NODEBUG = bool; |
| 82 | 78 | ||
| 83 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATOMIC_FLAG_TYPE __atomic_load(const atomic_flag& __a, memory_order __order) { | 79 | static _LIBCPP_HIDE_FROM_ABI bool __atomic_load(const atomic_flag& __a, memory_order __order) { |
| 84 | return std::__cxx_atomic_load(&__a.__a_, __order); | 80 | return std::__cxx_atomic_load(&__a.__a_, __order); |
| 85 | } | 81 | } |
| 86 | 82 | ||
| 87 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATOMIC_FLAG_TYPE | 83 | static _LIBCPP_HIDE_FROM_ABI bool __atomic_load(const volatile atomic_flag& __a, memory_order __order) { |
| 88 | __atomic_load(const volatile atomic_flag& __a, memory_order __order) { | ||
| 89 | return std::__cxx_atomic_load(&__a.__a_, __order); | 84 | return std::__cxx_atomic_load(&__a.__a_, __order); |
| 90 | } | 85 | } |
| 91 | 86 | ||
| 92 | static _LIBCPP_HIDE_FROM_ABI const __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE>* | 87 | static _LIBCPP_HIDE_FROM_ABI const __cxx_atomic_impl<bool>* __atomic_contention_address(const atomic_flag& __a) { |
| 93 | __atomic_contention_address(const atomic_flag& __a) { | ||
| 94 | return std::addressof(__a.__a_); | 88 | return std::addressof(__a.__a_); |
| 95 | } | 89 | } |
| 96 | 90 | ||
| 97 | static _LIBCPP_HIDE_FROM_ABI const volatile __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE>* | 91 | static _LIBCPP_HIDE_FROM_ABI const volatile __cxx_atomic_impl<bool>* |
| 98 | __atomic_contention_address(const volatile atomic_flag& __a) { | 92 | __atomic_contention_address(const volatile atomic_flag& __a) { |
| 99 | return std::addressof(__a.__a_); | 93 | return std::addressof(__a.__a_); |
| 100 | } | 94 | } |
lib/libcxx/include/__atomic/atomic_ref.h+14-5| ... | @@ -30,9 +30,10 @@ | ... | @@ -30,9 +30,10 @@ |
| 30 | #include <__cstddef/byte.h> | 30 | #include <__cstddef/byte.h> |
| 31 | #include <__cstddef/ptrdiff_t.h> | 31 | #include <__cstddef/ptrdiff_t.h> |
| 32 | #include <__memory/addressof.h> | 32 | #include <__memory/addressof.h> |
| 33 | #include <__memory/is_sufficiently_aligned.h> | ||
| 34 | #include <__type_traits/copy_cv.h> | ||
| 33 | #include <__type_traits/has_unique_object_representation.h> | 35 | #include <__type_traits/has_unique_object_representation.h> |
| 34 | #include <__type_traits/is_trivially_copyable.h> | 36 | #include <__type_traits/is_trivially_copyable.h> |
| 35 | #include <cstdint> | ||
| 36 | #include <cstring> | 37 | #include <cstring> |
| 37 | 38 | ||
| 38 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 39 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | @@ -224,7 +225,7 @@ public: | ... | @@ -224,7 +225,7 @@ public: |
| 224 | _LIBCPP_HIDE_FROM_ABI void notify_one() const noexcept { std::__atomic_notify_one(*this); } | 225 | _LIBCPP_HIDE_FROM_ABI void notify_one() const noexcept { std::__atomic_notify_one(*this); } |
| 225 | _LIBCPP_HIDE_FROM_ABI void notify_all() const noexcept { std::__atomic_notify_all(*this); } | 226 | _LIBCPP_HIDE_FROM_ABI void notify_all() const noexcept { std::__atomic_notify_all(*this); } |
| 226 | # if _LIBCPP_STD_VER >= 26 | 227 | # if _LIBCPP_STD_VER >= 26 |
| 227 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* address() const noexcept { return __ptr_; } | 228 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __copy_cv_t<_Tp, void>* address() const noexcept { return __ptr_; } |
| 228 | # endif | 229 | # endif |
| 229 | 230 | ||
| 230 | protected: | 231 | protected: |
| ... | @@ -254,10 +255,12 @@ struct atomic_ref : public __atomic_ref_base<_Tp> { | ... | @@ -254,10 +255,12 @@ struct atomic_ref : public __atomic_ref_base<_Tp> { |
| 254 | 255 | ||
| 255 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) { | 256 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) { |
| 256 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( | 257 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( |
| 257 | reinterpret_cast<uintptr_t>(std::addressof(__obj)) % __base::required_alignment == 0, | 258 | std::__is_sufficiently_aligned<__base::required_alignment>(std::addressof(__obj)), |
| 258 | "atomic_ref ctor: referenced object must be aligned to required_alignment"); | 259 | "atomic_ref ctor: referenced object must be aligned to required_alignment"); |
| 259 | } | 260 | } |
| 260 | 261 | ||
| 262 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp&&) = delete; | ||
| 263 | |||
| 261 | _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default; | 264 | _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default; |
| 262 | 265 | ||
| 263 | _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); } | 266 | _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); } |
| ... | @@ -274,10 +277,12 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> { | ... | @@ -274,10 +277,12 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> { |
| 274 | 277 | ||
| 275 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) { | 278 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) { |
| 276 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( | 279 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( |
| 277 | reinterpret_cast<uintptr_t>(std::addressof(__obj)) % __base::required_alignment == 0, | 280 | std::__is_sufficiently_aligned<__base::required_alignment>(std::addressof(__obj)), |
| 278 | "atomic_ref ctor: referenced object must be aligned to required_alignment"); | 281 | "atomic_ref ctor: referenced object must be aligned to required_alignment"); |
| 279 | } | 282 | } |
| 280 | 283 | ||
| 284 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp&&) = delete; | ||
| 285 | |||
| 281 | _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default; | 286 | _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default; |
| 282 | 287 | ||
| 283 | _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); } | 288 | _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); } |
| ... | @@ -320,10 +325,12 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> { | ... | @@ -320,10 +325,12 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> { |
| 320 | 325 | ||
| 321 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) { | 326 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) { |
| 322 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( | 327 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( |
| 323 | reinterpret_cast<uintptr_t>(std::addressof(__obj)) % __base::required_alignment == 0, | 328 | std::__is_sufficiently_aligned<__base::required_alignment>(std::addressof(__obj)), |
| 324 | "atomic_ref ctor: referenced object must be aligned to required_alignment"); | 329 | "atomic_ref ctor: referenced object must be aligned to required_alignment"); |
| 325 | } | 330 | } |
| 326 | 331 | ||
| 332 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp&&) = delete; | ||
| 333 | |||
| 327 | _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default; | 334 | _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default; |
| 328 | 335 | ||
| 329 | _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); } | 336 | _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); } |
| ... | @@ -367,6 +374,8 @@ struct atomic_ref<_Tp*> : public __atomic_ref_base<_Tp*> { | ... | @@ -367,6 +374,8 @@ struct atomic_ref<_Tp*> : public __atomic_ref_base<_Tp*> { |
| 367 | 374 | ||
| 368 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp*& __ptr) : __base(__ptr) {} | 375 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp*& __ptr) : __base(__ptr) {} |
| 369 | 376 | ||
| 377 | _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp*&&) = delete; | ||
| 378 | |||
| 370 | _LIBCPP_HIDE_FROM_ABI _Tp* operator=(_Tp* __desired) const noexcept { return __base::operator=(__desired); } | 379 | _LIBCPP_HIDE_FROM_ABI _Tp* operator=(_Tp* __desired) const noexcept { return __base::operator=(__desired); } |
| 371 | 380 | ||
| 372 | atomic_ref& operator=(const atomic_ref&) = delete; | 381 | atomic_ref& operator=(const atomic_ref&) = delete; |
lib/libcxx/include/__atomic/atomic_sync.h+8-9| ... | @@ -12,28 +12,25 @@ | ... | @@ -12,28 +12,25 @@ |
| 12 | #include <__atomic/atomic_waitable_traits.h> | 12 | #include <__atomic/atomic_waitable_traits.h> |
| 13 | #include <__atomic/contention_t.h> | 13 | #include <__atomic/contention_t.h> |
| 14 | #include <__atomic/memory_order.h> | 14 | #include <__atomic/memory_order.h> |
| 15 | #include <__atomic/to_gcc_order.h> | ||
| 16 | #include <__chrono/duration.h> | 15 | #include <__chrono/duration.h> |
| 17 | #include <__config> | 16 | #include <__config> |
| 18 | #include <__memory/addressof.h> | 17 | #include <__memory/addressof.h> |
| 19 | #include <__thread/poll_with_backoff.h> | 18 | #include <__thread/poll_with_backoff.h> |
| 20 | #include <__type_traits/conjunction.h> | ||
| 21 | #include <__type_traits/decay.h> | 19 | #include <__type_traits/decay.h> |
| 22 | #include <__type_traits/invoke.h> | ||
| 23 | #include <__type_traits/is_same.h> | ||
| 24 | #include <__type_traits/void_t.h> | ||
| 25 | #include <__utility/declval.h> | ||
| 26 | #include <cstring> | 20 | #include <cstring> |
| 27 | 21 | ||
| 28 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 29 | # pragma GCC system_header | 23 | # pragma GCC system_header |
| 30 | #endif | 24 | #endif |
| 31 | 25 | ||
| 26 | #if _LIBCPP_STD_VER >= 20 | ||
| 27 | |||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 29 | ||
| 34 | #if _LIBCPP_STD_VER >= 20 | ||
| 35 | # if _LIBCPP_HAS_THREADS | 30 | # if _LIBCPP_HAS_THREADS |
| 36 | 31 | ||
| 32 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 33 | |||
| 37 | # if !_LIBCPP_AVAILABILITY_HAS_NEW_SYNC | 34 | # if !_LIBCPP_AVAILABILITY_HAS_NEW_SYNC |
| 38 | 35 | ||
| 39 | // old dylib interface kept for backwards compatibility | 36 | // old dylib interface kept for backwards compatibility |
| ... | @@ -79,6 +76,8 @@ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one | ... | @@ -79,6 +76,8 @@ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one |
| 79 | template <std::size_t _Size> | 76 | template <std::size_t _Size> |
| 80 | _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_native(const void*) _NOEXCEPT; | 77 | _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_native(const void*) _NOEXCEPT; |
| 81 | 78 | ||
| 79 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 80 | |||
| 82 | # if _LIBCPP_AVAILABILITY_HAS_NEW_SYNC | 81 | # if _LIBCPP_AVAILABILITY_HAS_NEW_SYNC |
| 83 | 82 | ||
| 84 | template <class _AtomicWaitable, class _Poll> | 83 | template <class _AtomicWaitable, class _Poll> |
| ... | @@ -260,8 +259,8 @@ _LIBCPP_HIDE_FROM_ABI void __atomic_wait(_AtomicWaitable& __a, _Tp __val, memory | ... | @@ -260,8 +259,8 @@ _LIBCPP_HIDE_FROM_ABI void __atomic_wait(_AtomicWaitable& __a, _Tp __val, memory |
| 260 | }); | 259 | }); |
| 261 | } | 260 | } |
| 262 | 261 | ||
| 263 | #endif // C++20 | ||
| 264 | |||
| 265 | _LIBCPP_END_NAMESPACE_STD | 262 | _LIBCPP_END_NAMESPACE_STD |
| 266 | 263 | ||
| 264 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 265 | |||
| 267 | #endif // _LIBCPP___ATOMIC_ATOMIC_SYNC_H | 266 | #endif // _LIBCPP___ATOMIC_ATOMIC_SYNC_H |
lib/libcxx/include/__atomic/atomic_sync_timed.h+9-14| ... | @@ -12,20 +12,12 @@ | ... | @@ -12,20 +12,12 @@ |
| 12 | #include <__atomic/atomic_waitable_traits.h> | 12 | #include <__atomic/atomic_waitable_traits.h> |
| 13 | #include <__atomic/contention_t.h> | 13 | #include <__atomic/contention_t.h> |
| 14 | #include <__atomic/memory_order.h> | 14 | #include <__atomic/memory_order.h> |
| 15 | #include <__atomic/to_gcc_order.h> | ||
| 16 | #include <__chrono/duration.h> | 15 | #include <__chrono/duration.h> |
| 17 | #include <__config> | 16 | #include <__config> |
| 18 | #include <__memory/addressof.h> | 17 | #include <__memory/addressof.h> |
| 19 | #include <__thread/poll_with_backoff.h> | 18 | #include <__thread/poll_with_backoff.h> |
| 20 | #include <__thread/timed_backoff_policy.h> | 19 | #include <__thread/timed_backoff_policy.h> |
| 21 | #include <__type_traits/conjunction.h> | ||
| 22 | #include <__type_traits/decay.h> | 20 | #include <__type_traits/decay.h> |
| 23 | #include <__type_traits/has_unique_object_representation.h> | ||
| 24 | #include <__type_traits/invoke.h> | ||
| 25 | #include <__type_traits/is_same.h> | ||
| 26 | #include <__type_traits/is_trivially_copyable.h> | ||
| 27 | #include <__type_traits/void_t.h> | ||
| 28 | #include <__utility/declval.h> | ||
| 29 | #include <cstdint> | 21 | #include <cstdint> |
| 30 | #include <cstring> | 22 | #include <cstring> |
| 31 | 23 | ||
| ... | @@ -33,11 +25,13 @@ | ... | @@ -33,11 +25,13 @@ |
| 33 | # pragma GCC system_header | 25 | # pragma GCC system_header |
| 34 | #endif | 26 | #endif |
| 35 | 27 | ||
| 28 | #if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | ||
| 29 | |||
| 36 | _LIBCPP_BEGIN_NAMESPACE_STD | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 37 | 31 | ||
| 38 | #if _LIBCPP_STD_VER >= 20 | 32 | # if _LIBCPP_AVAILABILITY_HAS_NEW_SYNC |
| 39 | # if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_NEW_SYNC | ||
| 40 | 33 | ||
| 34 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 41 | _LIBCPP_AVAILABILITY_NEW_SYNC | 35 | _LIBCPP_AVAILABILITY_NEW_SYNC |
| 42 | _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __atomic_monitor_global(void const* __address) _NOEXCEPT; | 36 | _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __atomic_monitor_global(void const* __address) _NOEXCEPT; |
| 43 | 37 | ||
| ... | @@ -49,6 +43,7 @@ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_globa | ... | @@ -49,6 +43,7 @@ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_globa |
| 49 | template <std::size_t _Size> | 43 | template <std::size_t _Size> |
| 50 | _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void | 44 | _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void |
| 51 | __atomic_wait_native_with_timeout(void const* __address, void const* __old_value, uint64_t __timeout_ns) _NOEXCEPT; | 45 | __atomic_wait_native_with_timeout(void const* __address, void const* __old_value, uint64_t __timeout_ns) _NOEXCEPT; |
| 46 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 52 | 47 | ||
| 53 | template <class _AtomicWaitable, class _Poll, class _Rep, class _Period> | 48 | template <class _AtomicWaitable, class _Poll, class _Rep, class _Period> |
| 54 | struct __atomic_wait_timed_backoff_impl { | 49 | struct __atomic_wait_timed_backoff_impl { |
| ... | @@ -116,7 +111,7 @@ _LIBCPP_HIDE_FROM_ABI bool __atomic_wait_unless_with_timeout( | ... | @@ -116,7 +111,7 @@ _LIBCPP_HIDE_FROM_ABI bool __atomic_wait_unless_with_timeout( |
| 116 | return __poll_result == __poll_with_backoff_results::__poll_success; | 111 | return __poll_result == __poll_with_backoff_results::__poll_success; |
| 117 | } | 112 | } |
| 118 | 113 | ||
| 119 | # elif _LIBCPP_HAS_THREADS // _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_NEW_SYNC | 114 | # else // _LIBCPP_AVAILABILITY_HAS_NEW_SYNC |
| 120 | 115 | ||
| 121 | template <class _AtomicWaitable, class _Poll, class _Rep, class _Period> | 116 | template <class _AtomicWaitable, class _Poll, class _Rep, class _Period> |
| 122 | _LIBCPP_HIDE_FROM_ABI bool __atomic_wait_unless_with_timeout( | 117 | _LIBCPP_HIDE_FROM_ABI bool __atomic_wait_unless_with_timeout( |
| ... | @@ -135,10 +130,10 @@ _LIBCPP_HIDE_FROM_ABI bool __atomic_wait_unless_with_timeout( | ... | @@ -135,10 +130,10 @@ _LIBCPP_HIDE_FROM_ABI bool __atomic_wait_unless_with_timeout( |
| 135 | return __res == __poll_with_backoff_results::__poll_success; | 130 | return __res == __poll_with_backoff_results::__poll_success; |
| 136 | } | 131 | } |
| 137 | 132 | ||
| 138 | # endif // _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_NEW_SYNC | 133 | # endif // _LIBCPP_AVAILABILITY_HAS_NEW_SYNC |
| 139 | |||
| 140 | #endif // C++20 | ||
| 141 | 134 | ||
| 142 | _LIBCPP_END_NAMESPACE_STD | 135 | _LIBCPP_END_NAMESPACE_STD |
| 143 | 136 | ||
| 137 | #endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | ||
| 138 | |||
| 144 | #endif // _LIBCPP___ATOMIC_ATOMIC_SYNC_TIMED_H | 139 | #endif // _LIBCPP___ATOMIC_ATOMIC_SYNC_TIMED_H |
lib/libcxx/include/__atomic/atomic_waitable_traits.h+4-6| ... | @@ -16,18 +16,16 @@ | ... | @@ -16,18 +16,16 @@ |
| 16 | #include <__type_traits/has_unique_object_representation.h> | 16 | #include <__type_traits/has_unique_object_representation.h> |
| 17 | #include <__type_traits/is_same.h> | 17 | #include <__type_traits/is_same.h> |
| 18 | #include <__type_traits/is_trivially_copyable.h> | 18 | #include <__type_traits/is_trivially_copyable.h> |
| 19 | #include <__type_traits/void_t.h> | ||
| 20 | #include <__utility/declval.h> | ||
| 21 | #include <cstring> | 19 | #include <cstring> |
| 22 | 20 | ||
| 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 24 | # pragma GCC system_header | 22 | # pragma GCC system_header |
| 25 | #endif | 23 | #endif |
| 26 | 24 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 28 | |||
| 29 | #if _LIBCPP_STD_VER >= 20 | 25 | #if _LIBCPP_STD_VER >= 20 |
| 30 | 26 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 28 | |||
| 31 | // The customisation points to enable the following functions: | 29 | // The customisation points to enable the following functions: |
| 32 | // - __atomic_wait | 30 | // - __atomic_wait |
| 33 | // - __atomic_wait_unless | 31 | // - __atomic_wait_unless |
| ... | @@ -96,8 +94,8 @@ concept __has_native_atomic_wait = is_same_v<_Tp, __cxx_contention_t>; | ... | @@ -96,8 +94,8 @@ concept __has_native_atomic_wait = is_same_v<_Tp, __cxx_contention_t>; |
| 96 | 94 | ||
| 97 | # endif // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE | 95 | # endif // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE |
| 98 | 96 | ||
| 99 | #endif // C++20 | ||
| 100 | |||
| 101 | _LIBCPP_END_NAMESPACE_STD | 97 | _LIBCPP_END_NAMESPACE_STD |
| 102 | 98 | ||
| 99 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 100 | |||
| 103 | #endif // _LIBCPP___ATOMIC_ATOMIC_WAITABLE_TRAITS_H | 101 | #endif // _LIBCPP___ATOMIC_ATOMIC_WAITABLE_TRAITS_H |
lib/libcxx/include/__atomic/contention_t.h+4-4| ... | @@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | // instead. | 25 | // instead. |
| 26 | #if defined(_LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE) | 26 | #if defined(_LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE) |
| 27 | 27 | ||
| 28 | # ifdef __linux__ | 28 | # if defined(__linux__) || defined(__Fuchsia__) |
| 29 | using __cxx_contention_t _LIBCPP_NODEBUG = int32_t; | 29 | using __cxx_contention_t _LIBCPP_NODEBUG = int32_t; |
| 30 | # elif defined(__APPLE__) | 30 | # elif defined(__APPLE__) |
| 31 | using __cxx_contention_t _LIBCPP_NODEBUG = int64_t; | 31 | using __cxx_contention_t _LIBCPP_NODEBUG = int64_t; |
| ... | @@ -37,15 +37,15 @@ using __cxx_contention_t _LIBCPP_NODEBUG = int32_t; | ... | @@ -37,15 +37,15 @@ using __cxx_contention_t _LIBCPP_NODEBUG = int32_t; |
| 37 | using __cxx_contention_t _LIBCPP_NODEBUG = int64_t; | 37 | using __cxx_contention_t _LIBCPP_NODEBUG = int64_t; |
| 38 | # else | 38 | # else |
| 39 | using __cxx_contention_t _LIBCPP_NODEBUG = int64_t; | 39 | using __cxx_contention_t _LIBCPP_NODEBUG = int64_t; |
| 40 | # endif // __linux__ | 40 | # endif // __linux__ || __Fuchsia__ |
| 41 | 41 | ||
| 42 | #else // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE | 42 | #else // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE |
| 43 | 43 | ||
| 44 | # if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__)) | 44 | # if defined(__linux__) || defined(__Fuchsia__) || (defined(_AIX) && !defined(__64BIT__)) |
| 45 | using __cxx_contention_t _LIBCPP_NODEBUG = int32_t; | 45 | using __cxx_contention_t _LIBCPP_NODEBUG = int32_t; |
| 46 | # else | 46 | # else |
| 47 | using __cxx_contention_t _LIBCPP_NODEBUG = int64_t; | 47 | using __cxx_contention_t _LIBCPP_NODEBUG = int64_t; |
| 48 | # endif // __linux__ || (_AIX && !__64BIT__) | 48 | # endif // __linux__ || __Fuchsia__ || (_AIX && !__64BIT__) |
| 49 | 49 | ||
| 50 | #endif // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE | 50 | #endif // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE |
| 51 | 51 |
lib/libcxx/include/__atomic/floating_point_helper.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _Tp> | 24 | template <class _Tp> |
| 25 | _LIBCPP_HIDE_FROM_ABI constexpr bool __is_fp80_long_double() { | 25 | _LIBCPP_HIDE_FROM_ABI constexpr bool __is_fp80_long_double() { |
| 26 | // Only x87-fp80 long double has 64-bit mantissa | 26 | // Only x87-fp80 long double has 64-bit mantissa |
| ... | @@ -48,8 +48,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __has_rmw_builtin() { | ... | @@ -48,8 +48,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __has_rmw_builtin() { |
| 48 | # endif | 48 | # endif |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | #endif | ||
| 52 | |||
| 53 | _LIBCPP_END_NAMESPACE_STD | 51 | _LIBCPP_END_NAMESPACE_STD |
| 54 | 52 | ||
| 53 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 54 | |||
| 55 | #endif // _LIBCPP___ATOMIC_FLOATING_POINT_HELPER_H | 55 | #endif // _LIBCPP___ATOMIC_FLOATING_POINT_HELPER_H |
lib/libcxx/include/__atomic/support.h+2-2| ... | @@ -102,9 +102,9 @@ | ... | @@ -102,9 +102,9 @@ |
| 102 | // clang-format on | 102 | // clang-format on |
| 103 | // | 103 | // |
| 104 | 104 | ||
| 105 | #if _LIBCPP_HAS_GCC_ATOMIC_IMP | 105 | #ifdef _LIBCPP_COMPILER_GCC |
| 106 | # include <__atomic/support/gcc.h> | 106 | # include <__atomic/support/gcc.h> |
| 107 | #elif _LIBCPP_HAS_C_ATOMIC_IMP | 107 | #else |
| 108 | # include <__atomic/support/c11.h> | 108 | # include <__atomic/support/c11.h> |
| 109 | #endif | 109 | #endif |
| 110 | 110 |
lib/libcxx/include/__bit/bit_cast.h+6-6| ... | @@ -17,18 +17,16 @@ | ... | @@ -17,18 +17,16 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #ifndef _LIBCPP_CXX03_LANG | 20 | #ifndef _LIBCPP_CXX03_LANG |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _ToType, class _FromType> | 24 | template <class _ToType, class _FromType> |
| 25 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr _ToType __bit_cast(const _FromType& __from) noexcept { | 25 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr _ToType __bit_cast(const _FromType& __from) noexcept { |
| 26 | return __builtin_bit_cast(_ToType, __from); | 26 | return __builtin_bit_cast(_ToType, __from); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | #endif // _LIBCPP_CXX03_LANG | 29 | # if _LIBCPP_STD_VER >= 20 |
| 30 | |||
| 31 | #if _LIBCPP_STD_VER >= 20 | ||
| 32 | 30 | ||
| 33 | template <class _ToType, class _FromType> | 31 | template <class _ToType, class _FromType> |
| 34 | requires(sizeof(_ToType) == sizeof(_FromType) && is_trivially_copyable_v<_ToType> && | 32 | requires(sizeof(_ToType) == sizeof(_FromType) && is_trivially_copyable_v<_ToType> && |
| ... | @@ -37,8 +35,10 @@ template <class _ToType, class _FromType> | ... | @@ -37,8 +35,10 @@ template <class _ToType, class _FromType> |
| 37 | return __builtin_bit_cast(_ToType, __from); | 35 | return __builtin_bit_cast(_ToType, __from); |
| 38 | } | 36 | } |
| 39 | 37 | ||
| 40 | #endif // _LIBCPP_STD_VER >= 20 | 38 | # endif // _LIBCPP_STD_VER >= 20 |
| 41 | 39 | ||
| 42 | _LIBCPP_END_NAMESPACE_STD | 40 | _LIBCPP_END_NAMESPACE_STD |
| 43 | 41 | ||
| 42 | #endif // _LIBCPP_CXX03_LANG | ||
| 43 | |||
| 44 | #endif // _LIBCPP___BIT_BIT_CAST_H | 44 | #endif // _LIBCPP___BIT_BIT_CAST_H |
lib/libcxx/include/__bit/bit_ceil.h+4-3| ... | @@ -19,10 +19,10 @@ | ... | @@ -19,10 +19,10 @@ |
| 19 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 17 | 22 | #if _LIBCPP_STD_VER >= 17 |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | template <class _Tp> | 26 | template <class _Tp> |
| 27 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp __bit_ceil(_Tp __t) noexcept { | 27 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp __bit_ceil(_Tp __t) noexcept { |
| 28 | if (__t < 2) | 28 | if (__t < 2) |
| ... | @@ -47,8 +47,9 @@ template <__unsigned_integer _Tp> | ... | @@ -47,8 +47,9 @@ template <__unsigned_integer _Tp> |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | # endif // _LIBCPP_STD_VER >= 20 | 49 | # endif // _LIBCPP_STD_VER >= 20 |
| 50 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 51 | 50 | ||
| 52 | _LIBCPP_END_NAMESPACE_STD | 51 | _LIBCPP_END_NAMESPACE_STD |
| 53 | 52 | ||
| 53 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 54 | |||
| 54 | #endif // _LIBCPP___BIT_BIT_CEIL_H | 55 | #endif // _LIBCPP___BIT_BIT_CEIL_H |
lib/libcxx/include/__bit/byteswap.h+25-6| ... | @@ -12,7 +12,11 @@ | ... | @@ -12,7 +12,11 @@ |
| 12 | 12 | ||
| 13 | #include <__concepts/arithmetic.h> | 13 | #include <__concepts/arithmetic.h> |
| 14 | #include <__config> | 14 | #include <__config> |
| 15 | #include <__type_traits/is_same.h> | ||
| 16 | #include <__type_traits/remove_cv.h> | ||
| 17 | #include <climits> | ||
| 15 | #include <cstdint> | 18 | #include <cstdint> |
| 19 | #include <limits> | ||
| 16 | 20 | ||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | # pragma GCC system_header | 22 | # pragma GCC system_header |
| ... | @@ -24,26 +28,41 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -24,26 +28,41 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 28 | ||
| 25 | template <integral _Tp> | 29 | template <integral _Tp> |
| 26 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept { | 30 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept { |
| 31 | // [bit.byteswap]/Mandates: T does not have padding bits. | ||
| 32 | // bool is grandfathered: every shipping implementation admits it and the | ||
| 33 | // size-1 identity path can't shuffle padding bits into value positions. | ||
| 34 | // LWG 4583 proposes relaxing this to allow byte-aligned padding (e.g. | ||
| 35 | // _BitInt(48) where 2 whole bytes are padding); revisit once it resolves. | ||
| 36 | static_assert(is_same_v<remove_cv_t<_Tp>, bool> || | ||
| 37 | numeric_limits<_Tp>::digits + numeric_limits<_Tp>::is_signed == sizeof(_Tp) * CHAR_BIT, | ||
| 38 | "std::byteswap requires T to have no padding bits"); | ||
| 39 | |||
| 27 | if constexpr (sizeof(_Tp) == 1) { | 40 | if constexpr (sizeof(_Tp) == 1) { |
| 28 | return __val; | 41 | return __val; |
| 42 | # if __has_builtin(__builtin_bswapg) | ||
| 43 | } else { | ||
| 44 | return __builtin_bswapg(__val); | ||
| 45 | } | ||
| 46 | # else | ||
| 29 | } else if constexpr (sizeof(_Tp) == 2) { | 47 | } else if constexpr (sizeof(_Tp) == 2) { |
| 30 | return __builtin_bswap16(__val); | 48 | return __builtin_bswap16(__val); |
| 31 | } else if constexpr (sizeof(_Tp) == 4) { | 49 | } else if constexpr (sizeof(_Tp) == 4) { |
| 32 | return __builtin_bswap32(__val); | 50 | return __builtin_bswap32(__val); |
| 33 | } else if constexpr (sizeof(_Tp) == 8) { | 51 | } else if constexpr (sizeof(_Tp) == 8) { |
| 34 | return __builtin_bswap64(__val); | 52 | return __builtin_bswap64(__val); |
| 35 | # if _LIBCPP_HAS_INT128 | 53 | # if _LIBCPP_HAS_INT128 |
| 36 | } else if constexpr (sizeof(_Tp) == 16) { | 54 | } else if constexpr (sizeof(_Tp) == 16) { |
| 37 | # if __has_builtin(__builtin_bswap128) | 55 | # if __has_builtin(__builtin_bswap128) |
| 38 | return __builtin_bswap128(__val); | 56 | return __builtin_bswap128(__val); |
| 39 | # else | 57 | # else |
| 40 | return static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val))) << 64 | | 58 | return (static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val))) << 64) | |
| 41 | static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val >> 64))); | 59 | static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val >> 64))); |
| 42 | # endif // __has_builtin(__builtin_bswap128) | 60 | # endif // __has_builtin(__builtin_bswap128) |
| 43 | # endif // _LIBCPP_HAS_INT128 | 61 | # endif // _LIBCPP_HAS_INT128 |
| 44 | } else { | 62 | } else { |
| 45 | static_assert(sizeof(_Tp) == 0, "byteswap is unimplemented for integral types of this size"); | 63 | static_assert(sizeof(_Tp) == 0, "byteswap is unimplemented for integral types of this size"); |
| 46 | } | 64 | } |
| 65 | # endif // __has_builtin(__builtin_bswapg) | ||
| 47 | } | 66 | } |
| 48 | 67 | ||
| 49 | #endif // _LIBCPP_STD_VER >= 23 | 68 | #endif // _LIBCPP_STD_VER >= 23 |
lib/libcxx/include/__bit_reference+164-23| ... | @@ -16,10 +16,10 @@ | ... | @@ -16,10 +16,10 @@ |
| 16 | #include <__algorithm/copy_n.h> | 16 | #include <__algorithm/copy_n.h> |
| 17 | #include <__algorithm/equal.h> | 17 | #include <__algorithm/equal.h> |
| 18 | #include <__algorithm/fill_n.h> | 18 | #include <__algorithm/fill_n.h> |
| 19 | #include <__algorithm/in_out_result.h> | ||
| 19 | #include <__algorithm/min.h> | 20 | #include <__algorithm/min.h> |
| 20 | #include <__algorithm/rotate.h> | 21 | #include <__algorithm/rotate.h> |
| 21 | #include <__algorithm/specialized_algorithms.h> | 22 | #include <__algorithm/specialized_algorithms.h> |
| 22 | #include <__algorithm/swap_ranges.h> | ||
| 23 | #include <__assert> | 23 | #include <__assert> |
| 24 | #include <__bit/countr.h> | 24 | #include <__bit/countr.h> |
| 25 | #include <__compare/ordering.h> | 25 | #include <__compare/ordering.h> |
| ... | @@ -35,7 +35,6 @@ | ... | @@ -35,7 +35,6 @@ |
| 35 | #include <__type_traits/desugars_to.h> | 35 | #include <__type_traits/desugars_to.h> |
| 36 | #include <__type_traits/enable_if.h> | 36 | #include <__type_traits/enable_if.h> |
| 37 | #include <__type_traits/is_constant_evaluated.h> | 37 | #include <__type_traits/is_constant_evaluated.h> |
| 38 | #include <__type_traits/is_same.h> | ||
| 39 | #include <__type_traits/is_unsigned.h> | 38 | #include <__type_traits/is_unsigned.h> |
| 40 | #include <__type_traits/void_t.h> | 39 | #include <__type_traits/void_t.h> |
| 41 | #include <__utility/pair.h> | 40 | #include <__utility/pair.h> |
| ... | @@ -166,9 +165,6 @@ public: | ... | @@ -166,9 +165,6 @@ public: |
| 166 | } | 165 | } |
| 167 | 166 | ||
| 168 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void flip() _NOEXCEPT { *__seg_ ^= __mask_; } | 167 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void flip() _NOEXCEPT { *__seg_ ^= __mask_; } |
| 169 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cp, false> operator&() const _NOEXCEPT { | ||
| 170 | return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(std::__countr_zero(__mask_))); | ||
| 171 | } | ||
| 172 | 168 | ||
| 173 | private: | 169 | private: |
| 174 | _LIBCPP_HIDE_FROM_ABI | 170 | _LIBCPP_HIDE_FROM_ABI |
| ... | @@ -340,7 +336,7 @@ public: | ... | @@ -340,7 +336,7 @@ public: |
| 340 | } | 336 | } |
| 341 | #endif | 337 | #endif |
| 342 | 338 | ||
| 343 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator*() const _NOEXCEPT { | 339 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator*() const _NOEXCEPT { |
| 344 | _LIBCPP_ASSERT_INTERNAL(__ctz_ < __bits_per_word, "Dereferencing an invalid __bit_iterator."); | 340 | _LIBCPP_ASSERT_INTERNAL(__ctz_ < __bits_per_word, "Dereferencing an invalid __bit_iterator."); |
| 345 | return __conditional_t<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >( | 341 | return __conditional_t<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >( |
| 346 | __seg_, __storage_type(1) << __ctz_); | 342 | __seg_, __storage_type(1) << __ctz_); |
| ... | @@ -393,29 +389,32 @@ public: | ... | @@ -393,29 +389,32 @@ public: |
| 393 | return *this += -__n; | 389 | return *this += -__n; |
| 394 | } | 390 | } |
| 395 | 391 | ||
| 396 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator operator+(difference_type __n) const { | 392 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator |
| 393 | operator+(difference_type __n) const { | ||
| 397 | __bit_iterator __t(*this); | 394 | __bit_iterator __t(*this); |
| 398 | __t += __n; | 395 | __t += __n; |
| 399 | return __t; | 396 | return __t; |
| 400 | } | 397 | } |
| 401 | 398 | ||
| 402 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator operator-(difference_type __n) const { | 399 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator |
| 400 | operator-(difference_type __n) const { | ||
| 403 | __bit_iterator __t(*this); | 401 | __bit_iterator __t(*this); |
| 404 | __t -= __n; | 402 | __t -= __n; |
| 405 | return __t; | 403 | return __t; |
| 406 | } | 404 | } |
| 407 | 405 | ||
| 408 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator | 406 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator |
| 409 | operator+(difference_type __n, const __bit_iterator& __it) { | 407 | operator+(difference_type __n, const __bit_iterator& __it) { |
| 410 | return __it + __n; | 408 | return __it + __n; |
| 411 | } | 409 | } |
| 412 | 410 | ||
| 413 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend difference_type | 411 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend difference_type |
| 414 | operator-(const __bit_iterator& __x, const __bit_iterator& __y) { | 412 | operator-(const __bit_iterator& __x, const __bit_iterator& __y) { |
| 415 | return (__x.__seg_ - __y.__seg_) * __bits_per_word + __x.__ctz_ - __y.__ctz_; | 413 | return (__x.__seg_ - __y.__seg_) * __bits_per_word + __x.__ctz_ - __y.__ctz_; |
| 416 | } | 414 | } |
| 417 | 415 | ||
| 418 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](difference_type __n) const { | 416 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference |
| 417 | operator[](difference_type __n) const { | ||
| 419 | return *(*this + __n); | 418 | return *(*this + __n); |
| 420 | } | 419 | } |
| 421 | 420 | ||
| ... | @@ -487,15 +486,6 @@ private: | ... | @@ -487,15 +486,6 @@ private: |
| 487 | __bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result); | 486 | __bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result); |
| 488 | template <class _AlgPolicy> | 487 | template <class _AlgPolicy> |
| 489 | friend struct __copy_backward_impl; | 488 | friend struct __copy_backward_impl; |
| 490 | template <class _Cl, class _Cr> | ||
| 491 | _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator<_Cr, false> | ||
| 492 | __swap_ranges_aligned(__bit_iterator<_Cl, false>, __bit_iterator<_Cl, false>, __bit_iterator<_Cr, false>); | ||
| 493 | template <class _Cl, class _Cr> | ||
| 494 | _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator<_Cr, false> | ||
| 495 | __swap_ranges_unaligned(__bit_iterator<_Cl, false>, __bit_iterator<_Cl, false>, __bit_iterator<_Cr, false>); | ||
| 496 | template <class, class _Cl, class _Cr> | ||
| 497 | _LIBCPP_CONSTEXPR_SINCE_CXX20 friend pair<__bit_iterator<_Cl, false>, __bit_iterator<_Cr, false> > | ||
| 498 | __swap_ranges(__bit_iterator<_Cl, false>, __bit_iterator<_Cl, false>, __bit_iterator<_Cr, false>); | ||
| 499 | template <class, class _Dp> | 489 | template <class, class _Dp> |
| 500 | _LIBCPP_CONSTEXPR_SINCE_CXX20 friend pair<__bit_iterator<_Dp, false>, __bit_iterator<_Dp, false> > | 490 | _LIBCPP_CONSTEXPR_SINCE_CXX20 friend pair<__bit_iterator<_Dp, false>, __bit_iterator<_Dp, false> > |
| 501 | __rotate(__bit_iterator<_Dp, false>, __bit_iterator<_Dp, false>, __bit_iterator<_Dp, false>); | 491 | __rotate(__bit_iterator<_Dp, false>, __bit_iterator<_Dp, false>, __bit_iterator<_Dp, false>); |
| ... | @@ -718,13 +708,164 @@ struct __specialized_algorithm<_Algorithm::__copy, | ... | @@ -718,13 +708,164 @@ struct __specialized_algorithm<_Algorithm::__copy, |
| 718 | } | 708 | } |
| 719 | 709 | ||
| 720 | _LIBCPP_HIDE_FROM_ABI | 710 | _LIBCPP_HIDE_FROM_ABI |
| 721 | _LIBCPP_CONSTEXPR_SINCE_CXX20 static pair<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> > | 711 | _LIBCPP_CONSTEXPR_SINCE_CXX20 static __in_out_result<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> > |
| 722 | operator()(__bit_iterator<_Cp, _IsConst> __first, | 712 | operator()(__bit_iterator<_Cp, _IsConst> __first, |
| 723 | __bit_iterator<_Cp, _IsConst> __last, | 713 | __bit_iterator<_Cp, _IsConst> __last, |
| 724 | __bit_iterator<_Cp, false> __result) { | 714 | __bit_iterator<_Cp, false> __result) { |
| 725 | if (__first.__ctz_ == __result.__ctz_) | 715 | if (__first.__ctz_ == __result.__ctz_) |
| 726 | return std::make_pair(__last, __aligned_impl(__first, __last, __result)); | 716 | return {__last, __aligned_impl(__first, __last, __result)}; |
| 727 | return std::make_pair(__last, __unaligned_impl(__first, __last, __result)); | 717 | return {__last, __unaligned_impl(__first, __last, __result)}; |
| 718 | } | ||
| 719 | }; | ||
| 720 | |||
| 721 | template <class _Cl, class _Cr> | ||
| 722 | struct __specialized_algorithm<_Algorithm::__swap_ranges, | ||
| 723 | __iterator_pair<__bit_iterator<_Cl, false>, __bit_iterator<_Cl, false> >, | ||
| 724 | __single_iterator<__bit_iterator<_Cr, false> > > { | ||
| 725 | static const bool __has_algorithm = true; | ||
| 726 | |||
| 727 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cr, false> __aligned_impl( | ||
| 728 | __bit_iterator<_Cl, false> __first, __bit_iterator<_Cl, false> __last, __bit_iterator<_Cr, false> __result) { | ||
| 729 | using _I1 = __bit_iterator<_Cl, false>; | ||
| 730 | using difference_type = typename _I1::difference_type; | ||
| 731 | using __storage_type = typename _I1::__storage_type; | ||
| 732 | |||
| 733 | const int __bits_per_word = _I1::__bits_per_word; | ||
| 734 | difference_type __n = __last - __first; | ||
| 735 | if (__n > 0) { | ||
| 736 | // do first word | ||
| 737 | if (__first.__ctz_ != 0) { | ||
| 738 | unsigned __clz = __bits_per_word - __first.__ctz_; | ||
| 739 | difference_type __dn = std::min(static_cast<difference_type>(__clz), __n); | ||
| 740 | __n -= __dn; | ||
| 741 | __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn)); | ||
| 742 | __storage_type __b1 = *__first.__seg_ & __m; | ||
| 743 | *__first.__seg_ &= ~__m; | ||
| 744 | __storage_type __b2 = *__result.__seg_ & __m; | ||
| 745 | *__result.__seg_ &= ~__m; | ||
| 746 | *__result.__seg_ |= __b1; | ||
| 747 | *__first.__seg_ |= __b2; | ||
| 748 | __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; | ||
| 749 | __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word); | ||
| 750 | ++__first.__seg_; | ||
| 751 | // __first.__ctz_ = 0; | ||
| 752 | } | ||
| 753 | // __first.__ctz_ == 0; | ||
| 754 | // do middle words | ||
| 755 | for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_, ++__result.__seg_) | ||
| 756 | swap(*__first.__seg_, *__result.__seg_); | ||
| 757 | // do last word | ||
| 758 | if (__n > 0) { | ||
| 759 | __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); | ||
| 760 | __storage_type __b1 = *__first.__seg_ & __m; | ||
| 761 | *__first.__seg_ &= ~__m; | ||
| 762 | __storage_type __b2 = *__result.__seg_ & __m; | ||
| 763 | *__result.__seg_ &= ~__m; | ||
| 764 | *__result.__seg_ |= __b1; | ||
| 765 | *__first.__seg_ |= __b2; | ||
| 766 | __result.__ctz_ = static_cast<unsigned>(__n); | ||
| 767 | } | ||
| 768 | } | ||
| 769 | return __result; | ||
| 770 | } | ||
| 771 | |||
| 772 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cr, false> __unaligned_impl( | ||
| 773 | __bit_iterator<_Cl, false> __first, __bit_iterator<_Cl, false> __last, __bit_iterator<_Cr, false> __result) { | ||
| 774 | using _I1 = __bit_iterator<_Cl, false>; | ||
| 775 | using difference_type = typename _I1::difference_type; | ||
| 776 | using __storage_type = typename _I1::__storage_type; | ||
| 777 | |||
| 778 | const int __bits_per_word = _I1::__bits_per_word; | ||
| 779 | difference_type __n = __last - __first; | ||
| 780 | if (__n > 0) { | ||
| 781 | // do first word | ||
| 782 | if (__first.__ctz_ != 0) { | ||
| 783 | unsigned __clz_f = __bits_per_word - __first.__ctz_; | ||
| 784 | difference_type __dn = std::min(static_cast<difference_type>(__clz_f), __n); | ||
| 785 | __n -= __dn; | ||
| 786 | __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); | ||
| 787 | __storage_type __b1 = *__first.__seg_ & __m; | ||
| 788 | *__first.__seg_ &= ~__m; | ||
| 789 | unsigned __clz_r = __bits_per_word - __result.__ctz_; | ||
| 790 | __storage_type __ddn = std::min<__storage_type>(__dn, __clz_r); | ||
| 791 | __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); | ||
| 792 | __storage_type __b2 = *__result.__seg_ & __m; | ||
| 793 | *__result.__seg_ &= ~__m; | ||
| 794 | if (__result.__ctz_ > __first.__ctz_) { | ||
| 795 | unsigned __s = __result.__ctz_ - __first.__ctz_; | ||
| 796 | *__result.__seg_ |= __b1 << __s; | ||
| 797 | *__first.__seg_ |= __b2 >> __s; | ||
| 798 | } else { | ||
| 799 | unsigned __s = __first.__ctz_ - __result.__ctz_; | ||
| 800 | *__result.__seg_ |= __b1 >> __s; | ||
| 801 | *__first.__seg_ |= __b2 << __s; | ||
| 802 | } | ||
| 803 | __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word; | ||
| 804 | __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_) % __bits_per_word); | ||
| 805 | __dn -= __ddn; | ||
| 806 | if (__dn > 0) { | ||
| 807 | __m = ~__storage_type(0) >> (__bits_per_word - __dn); | ||
| 808 | __b2 = *__result.__seg_ & __m; | ||
| 809 | *__result.__seg_ &= ~__m; | ||
| 810 | unsigned __s = __first.__ctz_ + __ddn; | ||
| 811 | *__result.__seg_ |= __b1 >> __s; | ||
| 812 | *__first.__seg_ |= __b2 << __s; | ||
| 813 | __result.__ctz_ = static_cast<unsigned>(__dn); | ||
| 814 | } | ||
| 815 | ++__first.__seg_; | ||
| 816 | // __first.__ctz_ = 0; | ||
| 817 | } | ||
| 818 | // __first.__ctz_ == 0; | ||
| 819 | // do middle words | ||
| 820 | __storage_type __m = ~__storage_type(0) << __result.__ctz_; | ||
| 821 | unsigned __clz_r = __bits_per_word - __result.__ctz_; | ||
| 822 | for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) { | ||
| 823 | __storage_type __b1 = *__first.__seg_; | ||
| 824 | __storage_type __b2 = *__result.__seg_ & __m; | ||
| 825 | *__result.__seg_ &= ~__m; | ||
| 826 | *__result.__seg_ |= __b1 << __result.__ctz_; | ||
| 827 | *__first.__seg_ = __b2 >> __result.__ctz_; | ||
| 828 | ++__result.__seg_; | ||
| 829 | __b2 = *__result.__seg_ & ~__m; | ||
| 830 | *__result.__seg_ &= __m; | ||
| 831 | *__result.__seg_ |= __b1 >> __clz_r; | ||
| 832 | *__first.__seg_ |= __b2 << __clz_r; | ||
| 833 | } | ||
| 834 | // do last word | ||
| 835 | if (__n > 0) { | ||
| 836 | __m = ~__storage_type(0) >> (__bits_per_word - __n); | ||
| 837 | __storage_type __b1 = *__first.__seg_ & __m; | ||
| 838 | *__first.__seg_ &= ~__m; | ||
| 839 | __storage_type __dn = std::min<__storage_type>(__n, __clz_r); | ||
| 840 | __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn)); | ||
| 841 | __storage_type __b2 = *__result.__seg_ & __m; | ||
| 842 | *__result.__seg_ &= ~__m; | ||
| 843 | *__result.__seg_ |= __b1 << __result.__ctz_; | ||
| 844 | *__first.__seg_ |= __b2 >> __result.__ctz_; | ||
| 845 | __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; | ||
| 846 | __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word); | ||
| 847 | __n -= __dn; | ||
| 848 | if (__n > 0) { | ||
| 849 | __m = ~__storage_type(0) >> (__bits_per_word - __n); | ||
| 850 | __b2 = *__result.__seg_ & __m; | ||
| 851 | *__result.__seg_ &= ~__m; | ||
| 852 | *__result.__seg_ |= __b1 >> __dn; | ||
| 853 | *__first.__seg_ |= __b2 << __dn; | ||
| 854 | __result.__ctz_ = static_cast<unsigned>(__n); | ||
| 855 | } | ||
| 856 | } | ||
| 857 | } | ||
| 858 | return __result; | ||
| 859 | } | ||
| 860 | |||
| 861 | _LIBCPP_HIDE_FROM_ABI static | ||
| 862 | _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cl, false>, __bit_iterator<_Cr, false> > | ||
| 863 | operator()(__bit_iterator<_Cl, false> __first1, | ||
| 864 | __bit_iterator<_Cl, false> __last1, | ||
| 865 | __bit_iterator<_Cr, false> __first2) { | ||
| 866 | if (__first1.__ctz_ == __first2.__ctz_) | ||
| 867 | return std::make_pair(__last1, __aligned_impl(__first1, __last1, __first2)); | ||
| 868 | return std::make_pair(__last1, __unaligned_impl(__first1, __last1, __first2)); | ||
| 728 | } | 869 | } |
| 729 | }; | 870 | }; |
| 730 | 871 |
lib/libcxx/include/__charconv/from_chars_floating_point.h+2| ... | @@ -35,6 +35,7 @@ struct __from_chars_result { | ... | @@ -35,6 +35,7 @@ struct __from_chars_result { |
| 35 | errc __ec; | 35 | errc __ec; |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 38 | template <class _Fp> | 39 | template <class _Fp> |
| 39 | _LIBCPP_EXPORTED_FROM_ABI __from_chars_result<_Fp> __from_chars_floating_point( | 40 | _LIBCPP_EXPORTED_FROM_ABI __from_chars_result<_Fp> __from_chars_floating_point( |
| 40 | _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt); | 41 | _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt); |
| ... | @@ -44,6 +45,7 @@ extern template __from_chars_result<float> __from_chars_floating_point( | ... | @@ -44,6 +45,7 @@ extern template __from_chars_result<float> __from_chars_floating_point( |
| 44 | 45 | ||
| 45 | extern template __from_chars_result<double> __from_chars_floating_point( | 46 | extern template __from_chars_result<double> __from_chars_floating_point( |
| 46 | _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt); | 47 | _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt); |
| 48 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 47 | 49 | ||
| 48 | template <class _Fp> | 50 | template <class _Fp> |
| 49 | _LIBCPP_HIDE_FROM_ABI from_chars_result | 51 | _LIBCPP_HIDE_FROM_ABI from_chars_result |
lib/libcxx/include/__charconv/from_chars_integral.h+1-4| ... | @@ -10,12 +10,10 @@ | ... | @@ -10,12 +10,10 @@ |
| 10 | #ifndef _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H | 10 | #ifndef _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H |
| 11 | #define _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H | 11 | #define _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H |
| 12 | 12 | ||
| 13 | #include <__algorithm/copy_n.h> | ||
| 14 | #include <__assert> | 13 | #include <__assert> |
| 15 | #include <__charconv/from_chars_result.h> | 14 | #include <__charconv/from_chars_result.h> |
| 16 | #include <__charconv/traits.h> | 15 | #include <__charconv/traits.h> |
| 17 | #include <__config> | 16 | #include <__config> |
| 18 | #include <__memory/addressof.h> | ||
| 19 | #include <__system_error/errc.h> | 17 | #include <__system_error/errc.h> |
| 20 | #include <__type_traits/enable_if.h> | 18 | #include <__type_traits/enable_if.h> |
| 21 | #include <__type_traits/is_integral.h> | 19 | #include <__type_traits/is_integral.h> |
| ... | @@ -56,8 +54,7 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) | ... | @@ -56,8 +54,7 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) |
| 56 | 54 | ||
| 57 | if (__neg) { | 55 | if (__neg) { |
| 58 | if (__x <= std::__complement(std::__to_unsigned_like(__tl::min()))) { | 56 | if (__x <= std::__complement(std::__to_unsigned_like(__tl::min()))) { |
| 59 | __x = std::__complement(__x); | 57 | __value = std::__complement(__x); |
| 60 | std::copy_n(std::addressof(__x), 1, std::addressof(__value)); | ||
| 61 | return __r; | 58 | return __r; |
| 62 | } | 59 | } |
| 63 | } else { | 60 | } else { |
lib/libcxx/include/__charconv/to_chars.h-4| ... | @@ -18,8 +18,4 @@ | ... | @@ -18,8 +18,4 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | _LIBCPP_END_NAMESPACE_STD | ||
| 24 | |||
| 25 | #endif // _LIBCPP___CHARCONV_TO_CHARS | 21 | #endif // _LIBCPP___CHARCONV_TO_CHARS |
lib/libcxx/include/__charconv/to_chars_floating_point.h+2| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 22 | 23 | ||
| 23 | #if _LIBCPP_STD_VER >= 17 | 24 | #if _LIBCPP_STD_VER >= 17 |
| 24 | 25 | ||
| ... | @@ -50,6 +51,7 @@ _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_ | ... | @@ -50,6 +51,7 @@ _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_ |
| 50 | to_chars(char* __first, char* __last, long double __value, chars_format __fmt, int __precision); | 51 | to_chars(char* __first, char* __last, long double __value, chars_format __fmt, int __precision); |
| 51 | #endif // _LIBCPP_STD_VER >= 17 | 52 | #endif // _LIBCPP_STD_VER >= 17 |
| 52 | 53 | ||
| 54 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 53 | _LIBCPP_END_NAMESPACE_STD | 55 | _LIBCPP_END_NAMESPACE_STD |
| 54 | 56 | ||
| 55 | #endif // _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H | 57 | #endif // _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H |
lib/libcxx/include/__chrono/convert_to_tm.h+4-1| ... | @@ -127,7 +127,10 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(chrono::tai_time<_Duration> __tp) { | ... | @@ -127,7 +127,10 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(chrono::tai_time<_Duration> __tp) { |
| 127 | 127 | ||
| 128 | template <class _Tm, class _Duration> | 128 | template <class _Tm, class _Duration> |
| 129 | _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(chrono::gps_time<_Duration> __tp) { | 129 | _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(chrono::gps_time<_Duration> __tp) { |
| 130 | return std::__convert_to_tm<_Tm>(chrono::utc_clock::to_sys(chrono::gps_clock::to_utc(__tp))); | 130 | using _Rp = common_type_t<_Duration, chrono::seconds>; |
| 131 | // The time between the GPS epoch (1980-01-06) and UNIX epoch (1970-01-01). | ||
| 132 | constexpr chrono::seconds __offset{3657 * 24 * 60 * 60}; | ||
| 133 | return std::__convert_to_tm<_Tm>(chrono::sys_time<_Rp>{__tp.time_since_epoch() + __offset}); | ||
| 131 | } | 134 | } |
| 132 | 135 | ||
| 133 | # endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB | 136 | # endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB |
lib/libcxx/include/__chrono/day.h+8-6| ... | @@ -55,7 +55,7 @@ public: | ... | @@ -55,7 +55,7 @@ public: |
| 55 | _LIBCPP_HIDE_FROM_ABI constexpr day& operator+=(const days& __dd) noexcept; | 55 | _LIBCPP_HIDE_FROM_ABI constexpr day& operator+=(const days& __dd) noexcept; |
| 56 | _LIBCPP_HIDE_FROM_ABI constexpr day& operator-=(const days& __dd) noexcept; | 56 | _LIBCPP_HIDE_FROM_ABI constexpr day& operator-=(const days& __dd) noexcept; |
| 57 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __d_; } | 57 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __d_; } |
| 58 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d_ >= 1 && __d_ <= 31; } | 58 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d_ >= 1 && __d_ <= 31; } |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const day& __lhs, const day& __rhs) noexcept { | 61 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const day& __lhs, const day& __rhs) noexcept { |
| ... | @@ -66,19 +66,19 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const day& __ | ... | @@ -66,19 +66,19 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const day& __ |
| 66 | return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs); | 66 | return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | _LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const day& __lhs, const days& __rhs) noexcept { | 69 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const day& __lhs, const days& __rhs) noexcept { |
| 70 | return day(static_cast<unsigned>(__lhs) + __rhs.count()); | 70 | return day(static_cast<unsigned>(__lhs) + __rhs.count()); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | _LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const days& __lhs, const day& __rhs) noexcept { | 73 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const days& __lhs, const day& __rhs) noexcept { |
| 74 | return __rhs + __lhs; | 74 | return __rhs + __lhs; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | _LIBCPP_HIDE_FROM_ABI inline constexpr day operator-(const day& __lhs, const days& __rhs) noexcept { | 77 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr day operator-(const day& __lhs, const days& __rhs) noexcept { |
| 78 | return __lhs + -__rhs; | 78 | return __lhs + -__rhs; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | _LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const day& __lhs, const day& __rhs) noexcept { | 81 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const day& __lhs, const day& __rhs) noexcept { |
| 82 | return days(static_cast<int>(static_cast<unsigned>(__lhs)) - static_cast<int>(static_cast<unsigned>(__rhs))); | 82 | return days(static_cast<int>(static_cast<unsigned>(__lhs)) - static_cast<int>(static_cast<unsigned>(__rhs))); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| ... | @@ -98,7 +98,9 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator-=(const days& __dd) no | ... | @@ -98,7 +98,9 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator-=(const days& __dd) no |
| 98 | 98 | ||
| 99 | template <> | 99 | template <> |
| 100 | struct hash<chrono::day> { | 100 | struct hash<chrono::day> { |
| 101 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::day& __d) noexcept { return static_cast<unsigned>(__d); } | 101 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::day& __d) noexcept { |
| 102 | return static_cast<unsigned>(__d); | ||
| 103 | } | ||
| 102 | }; | 104 | }; |
| 103 | 105 | ||
| 104 | # endif // _LIBCPP_STD_VER >= 26 | 106 | # endif // _LIBCPP_STD_VER >= 26 |
lib/libcxx/include/__chrono/duration.h+12-38| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | #include <__type_traits/enable_if.h> | 19 | #include <__type_traits/enable_if.h> |
| 20 | #include <__type_traits/is_convertible.h> | 20 | #include <__type_traits/is_convertible.h> |
| 21 | #include <__type_traits/is_floating_point.h> | 21 | #include <__type_traits/is_floating_point.h> |
| 22 | #include <__type_traits/is_unqualified.h> | ||
| 22 | #include <limits> | 23 | #include <limits> |
| 23 | #include <ratio> | 24 | #include <ratio> |
| 24 | 25 | ||
| ... | @@ -164,6 +165,7 @@ template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duratio | ... | @@ -164,6 +165,7 @@ template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duratio |
| 164 | 165 | ||
| 165 | template <class _Rep, class _Period> | 166 | template <class _Rep, class _Period> |
| 166 | class duration { | 167 | class duration { |
| 168 | static_assert(__is_unqualified_v<_Rep>, "A duration representation cannot be qualified"); | ||
| 167 | static_assert(!__is_duration_v<_Rep>, "A duration representation can not be a duration"); | 169 | static_assert(!__is_duration_v<_Rep>, "A duration representation can not be a duration"); |
| 168 | static_assert(__is_ratio_v<_Period>, "Second template parameter of duration must be a std::ratio"); | 170 | static_assert(__is_ratio_v<_Period>, "Second template parameter of duration must be a std::ratio"); |
| 169 | static_assert(_Period::num > 0, "duration period must be positive"); | 171 | static_assert(_Period::num > 0, "duration period must be positive"); |
| ... | @@ -291,35 +293,21 @@ typedef duration<long long, nano> nanoseconds; | ... | @@ -291,35 +293,21 @@ typedef duration<long long, nano> nanoseconds; |
| 291 | typedef duration<long long, micro> microseconds; | 293 | typedef duration<long long, micro> microseconds; |
| 292 | typedef duration<long long, milli> milliseconds; | 294 | typedef duration<long long, milli> milliseconds; |
| 293 | typedef duration<long long > seconds; | 295 | typedef duration<long long > seconds; |
| 294 | typedef duration< long, ratio< 60> > minutes; | 296 | typedef duration<long, ratio<60> > minutes; |
| 295 | typedef duration< long, ratio<3600> > hours; | 297 | typedef duration<long, ratio<60 * 60> > hours; |
| 296 | #if _LIBCPP_STD_VER >= 20 | 298 | #if _LIBCPP_STD_VER >= 20 |
| 297 | typedef duration< int, ratio_multiply<ratio<24>, hours::period>> days; | 299 | typedef duration<int, ratio<60 * 60 * 24>> days; |
| 298 | typedef duration< int, ratio_multiply<ratio<7>, days::period>> weeks; | 300 | typedef duration<int, ratio<60 * 60 * 24 * 7>> weeks; |
| 299 | typedef duration< int, ratio_multiply<ratio<146097, 400>, days::period>> years; | 301 | typedef duration<int, ratio<static_cast<int>(365.2425 * 60 * 60 * 24)>> years; |
| 300 | typedef duration< int, ratio_divide<years::period, ratio<12>>> months; | 302 | typedef duration<int, ratio<static_cast<int>(365.2425 * 60 * 60 * 24) / 12>> months; |
| 301 | #endif | 303 | #endif |
| 302 | // Duration == | 304 | // Duration == |
| 303 | 305 | ||
| 304 | template <class _LhsDuration, class _RhsDuration> | ||
| 305 | struct __duration_eq { | ||
| 306 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const { | ||
| 307 | typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; | ||
| 308 | return _Ct(__lhs).count() == _Ct(__rhs).count(); | ||
| 309 | } | ||
| 310 | }; | ||
| 311 | |||
| 312 | template <class _LhsDuration> | ||
| 313 | struct __duration_eq<_LhsDuration, _LhsDuration> { | ||
| 314 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const { | ||
| 315 | return __lhs.count() == __rhs.count(); | ||
| 316 | } | ||
| 317 | }; | ||
| 318 | |||
| 319 | template <class _Rep1, class _Period1, class _Rep2, class _Period2> | 306 | template <class _Rep1, class _Period1, class _Rep2, class _Period2> |
| 320 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | 307 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool |
| 321 | operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { | 308 | operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { |
| 322 | return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs); | 309 | using _Ct = typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type; |
| 310 | return _Ct(__lhs).count() == _Ct(__rhs).count(); | ||
| 323 | } | 311 | } |
| 324 | 312 | ||
| 325 | #if _LIBCPP_STD_VER <= 17 | 313 | #if _LIBCPP_STD_VER <= 17 |
| ... | @@ -336,25 +324,11 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period | ... | @@ -336,25 +324,11 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period |
| 336 | 324 | ||
| 337 | // Duration < | 325 | // Duration < |
| 338 | 326 | ||
| 339 | template <class _LhsDuration, class _RhsDuration> | ||
| 340 | struct __duration_lt { | ||
| 341 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const { | ||
| 342 | typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; | ||
| 343 | return _Ct(__lhs).count() < _Ct(__rhs).count(); | ||
| 344 | } | ||
| 345 | }; | ||
| 346 | |||
| 347 | template <class _LhsDuration> | ||
| 348 | struct __duration_lt<_LhsDuration, _LhsDuration> { | ||
| 349 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const { | ||
| 350 | return __lhs.count() < __rhs.count(); | ||
| 351 | } | ||
| 352 | }; | ||
| 353 | |||
| 354 | template <class _Rep1, class _Period1, class _Rep2, class _Period2> | 327 | template <class _Rep1, class _Period1, class _Rep2, class _Period2> |
| 355 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | 328 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool |
| 356 | operator<(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { | 329 | operator<(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { |
| 357 | return __duration_lt<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs); | 330 | using _Ct = typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type; |
| 331 | return _Ct(__lhs).count() < _Ct(__rhs).count(); | ||
| 358 | } | 332 | } |
| 359 | 333 | ||
| 360 | // Duration > | 334 | // Duration > |
lib/libcxx/include/__chrono/exception.h+2| ... | @@ -31,6 +31,7 @@ | ... | @@ -31,6 +31,7 @@ |
| 31 | # endif | 31 | # endif |
| 32 | 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | 33 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 34 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 34 | 35 | ||
| 35 | # if _LIBCPP_STD_VER >= 20 | 36 | # if _LIBCPP_STD_VER >= 20 |
| 36 | 37 | ||
| ... | @@ -128,6 +129,7 @@ template <class _Duration> | ... | @@ -128,6 +129,7 @@ template <class _Duration> |
| 128 | 129 | ||
| 129 | # endif // _LIBCPP_STD_VER >= 20 | 130 | # endif // _LIBCPP_STD_VER >= 20 |
| 130 | 131 | ||
| 132 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 131 | _LIBCPP_END_NAMESPACE_STD | 133 | _LIBCPP_END_NAMESPACE_STD |
| 132 | 134 | ||
| 133 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB | 135 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB |
lib/libcxx/include/__chrono/file_clock.h+4| ... | @@ -46,6 +46,8 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -46,6 +46,8 @@ _LIBCPP_END_NAMESPACE_STD |
| 46 | 46 | ||
| 47 | #ifndef _LIBCPP_CXX03_LANG | 47 | #ifndef _LIBCPP_CXX03_LANG |
| 48 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 48 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 49 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 50 | |||
| 49 | struct _FilesystemClock { | 51 | struct _FilesystemClock { |
| 50 | # if _LIBCPP_HAS_INT128 | 52 | # if _LIBCPP_HAS_INT128 |
| 51 | typedef __int128_t rep; | 53 | typedef __int128_t rep; |
| ... | @@ -76,6 +78,8 @@ struct _FilesystemClock { | ... | @@ -76,6 +78,8 @@ struct _FilesystemClock { |
| 76 | } | 78 | } |
| 77 | # endif // _LIBCPP_STD_VER >= 20 | 79 | # endif // _LIBCPP_STD_VER >= 20 |
| 78 | }; | 80 | }; |
| 81 | |||
| 82 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 79 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 83 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
| 80 | #endif // !_LIBCPP_CXX03_LANG | 84 | #endif // !_LIBCPP_CXX03_LANG |
| 81 | 85 |
lib/libcxx/include/__chrono/gps_clock.h+4-4| ... | @@ -28,10 +28,10 @@ | ... | @@ -28,10 +28,10 @@ |
| 28 | _LIBCPP_PUSH_MACROS | 28 | _LIBCPP_PUSH_MACROS |
| 29 | # include <__undef_macros> | 29 | # include <__undef_macros> |
| 30 | 30 | ||
| 31 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 32 | |||
| 33 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION | 31 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION |
| 34 | 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 34 | |||
| 35 | namespace chrono { | 35 | namespace chrono { |
| 36 | 36 | ||
| 37 | class gps_clock; | 37 | class gps_clock; |
| ... | @@ -78,11 +78,11 @@ public: | ... | @@ -78,11 +78,11 @@ public: |
| 78 | 78 | ||
| 79 | } // namespace chrono | 79 | } // namespace chrono |
| 80 | 80 | ||
| 81 | _LIBCPP_END_NAMESPACE_STD | ||
| 82 | |||
| 81 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && | 83 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && |
| 82 | // _LIBCPP_HAS_LOCALIZATION | 84 | // _LIBCPP_HAS_LOCALIZATION |
| 83 | 85 | ||
| 84 | _LIBCPP_END_NAMESPACE_STD | ||
| 85 | |||
| 86 | _LIBCPP_POP_MACROS | 86 | _LIBCPP_POP_MACROS |
| 87 | 87 | ||
| 88 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB | 88 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB |
lib/libcxx/include/__chrono/hh_mm_ss.h+10-10| ... | @@ -59,13 +59,13 @@ public: | ... | @@ -59,13 +59,13 @@ public: |
| 59 | __s_(chrono::duration_cast<chrono::seconds>(chrono::abs(__d) - hours() - minutes())), | 59 | __s_(chrono::duration_cast<chrono::seconds>(chrono::abs(__d) - hours() - minutes())), |
| 60 | __f_(chrono::duration_cast<precision>(chrono::abs(__d) - hours() - minutes() - seconds())) {} | 60 | __f_(chrono::duration_cast<precision>(chrono::abs(__d) - hours() - minutes() - seconds())) {} |
| 61 | 61 | ||
| 62 | _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; } | 62 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; } |
| 63 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h_; } | 63 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h_; } |
| 64 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m_; } | 64 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m_; } |
| 65 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s_; } | 65 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s_; } |
| 66 | _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f_; } | 66 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f_; } |
| 67 | 67 | ||
| 68 | _LIBCPP_HIDE_FROM_ABI constexpr precision to_duration() const noexcept { | 68 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr precision to_duration() const noexcept { |
| 69 | auto __dur = __h_ + __m_ + __s_ + __f_; | 69 | auto __dur = __h_ + __m_ + __s_ + __f_; |
| 70 | return __is_neg_ ? -__dur : __dur; | 70 | return __is_neg_ ? -__dur : __dur; |
| 71 | } | 71 | } |
| ... | @@ -81,14 +81,14 @@ private: | ... | @@ -81,14 +81,14 @@ private: |
| 81 | }; | 81 | }; |
| 82 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(hh_mm_ss); | 82 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(hh_mm_ss); |
| 83 | 83 | ||
| 84 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_am(const hours& __h) noexcept { | 84 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_am(const hours& __h) noexcept { |
| 85 | return __h >= hours(0) && __h < hours(12); | 85 | return __h >= hours(0) && __h < hours(12); |
| 86 | } | 86 | } |
| 87 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_pm(const hours& __h) noexcept { | 87 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_pm(const hours& __h) noexcept { |
| 88 | return __h >= hours(12) && __h < hours(24); | 88 | return __h >= hours(12) && __h < hours(24); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | _LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept { | 91 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept { |
| 92 | if (__h == hours(0)) | 92 | if (__h == hours(0)) |
| 93 | return hours(12); | 93 | return hours(12); |
| 94 | else if (__h <= hours(12)) | 94 | else if (__h <= hours(12)) |
| ... | @@ -97,7 +97,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept { | ... | @@ -97,7 +97,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept { |
| 97 | return __h - hours(12); | 97 | return __h - hours(12); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | _LIBCPP_HIDE_FROM_ABI inline constexpr hours make24(const hours& __h, bool __is_pm) noexcept { | 100 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr hours make24(const hours& __h, bool __is_pm) noexcept { |
| 101 | if (__is_pm) | 101 | if (__is_pm) |
| 102 | return __h == hours(12) ? __h : __h + hours(12); | 102 | return __h == hours(12) ? __h : __h + hours(12); |
| 103 | else | 103 | else |
lib/libcxx/include/__chrono/literals.h+2-2| ... | @@ -24,11 +24,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -24,11 +24,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | ||
| 25 | inline namespace literals { | 25 | inline namespace literals { |
| 26 | inline namespace chrono_literals { | 26 | inline namespace chrono_literals { |
| 27 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::day operator""d(unsigned long long __d) noexcept { | 27 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::day operator""d(unsigned long long __d) noexcept { |
| 28 | return chrono::day(static_cast<unsigned>(__d)); | 28 | return chrono::day(static_cast<unsigned>(__d)); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::year operator""y(unsigned long long __y) noexcept { | 31 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::year operator""y(unsigned long long __y) noexcept { |
| 32 | return chrono::year(static_cast<int>(__y)); | 32 | return chrono::year(static_cast<int>(__y)); |
| 33 | } | 33 | } |
| 34 | } // namespace chrono_literals | 34 | } // namespace chrono_literals |
lib/libcxx/include/__chrono/month.h+6-6| ... | @@ -55,7 +55,7 @@ public: | ... | @@ -55,7 +55,7 @@ public: |
| 55 | _LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept; | 55 | _LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept; |
| 56 | _LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept; | 56 | _LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept; |
| 57 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; } | 57 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; } |
| 58 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; } | 58 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; } |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month& __lhs, const month& __rhs) noexcept { | 61 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month& __lhs, const month& __rhs) noexcept { |
| ... | @@ -66,21 +66,21 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const month& | ... | @@ -66,21 +66,21 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const month& |
| 66 | return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs); | 66 | return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | _LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const month& __lhs, const months& __rhs) noexcept { | 69 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const month& __lhs, const months& __rhs) noexcept { |
| 70 | auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + (__rhs.count() - 1); | 70 | auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + (__rhs.count() - 1); |
| 71 | auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12; | 71 | auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12; |
| 72 | return month{static_cast<unsigned>(__mu - __yr * 12 + 1)}; | 72 | return month{static_cast<unsigned>(__mu - __yr * 12 + 1)}; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | _LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const months& __lhs, const month& __rhs) noexcept { | 75 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const months& __lhs, const month& __rhs) noexcept { |
| 76 | return __rhs + __lhs; | 76 | return __rhs + __lhs; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | _LIBCPP_HIDE_FROM_ABI inline constexpr month operator-(const month& __lhs, const months& __rhs) noexcept { | 79 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month operator-(const month& __lhs, const months& __rhs) noexcept { |
| 80 | return __lhs + -__rhs; | 80 | return __lhs + -__rhs; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | _LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const month& __lhs, const month& __rhs) noexcept { | 83 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const month& __lhs, const month& __rhs) noexcept { |
| 84 | auto const __dm = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs); | 84 | auto const __dm = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs); |
| 85 | return months(__dm <= 11 ? __dm : __dm + 12); | 85 | return months(__dm <= 11 ? __dm : __dm + 12); |
| 86 | } | 86 | } |
| ... | @@ -114,7 +114,7 @@ inline constexpr month December{12}; | ... | @@ -114,7 +114,7 @@ inline constexpr month December{12}; |
| 114 | 114 | ||
| 115 | template <> | 115 | template <> |
| 116 | struct hash<chrono::month> { | 116 | struct hash<chrono::month> { |
| 117 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month& __m) noexcept { | 117 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month& __m) noexcept { |
| 118 | return static_cast<unsigned>(__m); | 118 | return static_cast<unsigned>(__m); |
| 119 | } | 119 | } |
| 120 | }; | 120 | }; |
lib/libcxx/include/__chrono/month_weekday.h+24-16| ... | @@ -35,9 +35,11 @@ public: | ... | @@ -35,9 +35,11 @@ public: |
| 35 | _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval, | 35 | _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval, |
| 36 | const chrono::weekday_indexed& __wdival) noexcept | 36 | const chrono::weekday_indexed& __wdival) noexcept |
| 37 | : __m_{__mval}, __wdi_{__wdival} {} | 37 | : __m_{__mval}, __wdi_{__wdival} {} |
| 38 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | 38 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } |
| 39 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; } | 39 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { |
| 40 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); } | 40 | return __wdi_; |
| 41 | } | ||
| 42 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); } | ||
| 41 | }; | 43 | }; |
| 42 | 44 | ||
| 43 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool | 45 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool |
| ... | @@ -45,21 +47,23 @@ operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept { | ... | @@ -45,21 +47,23 @@ operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept { |
| 45 | return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed(); | 47 | return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed(); |
| 46 | } | 48 | } |
| 47 | 49 | ||
| 48 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday | 50 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday |
| 49 | operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept { | 51 | operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept { |
| 50 | return month_weekday{__lhs, __rhs}; | 52 | return month_weekday{__lhs, __rhs}; |
| 51 | } | 53 | } |
| 52 | 54 | ||
| 53 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept { | 55 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday |
| 56 | operator/(int __lhs, const weekday_indexed& __rhs) noexcept { | ||
| 54 | return month_weekday{month(__lhs), __rhs}; | 57 | return month_weekday{month(__lhs), __rhs}; |
| 55 | } | 58 | } |
| 56 | 59 | ||
| 57 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday | 60 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday |
| 58 | operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept { | 61 | operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept { |
| 59 | return month_weekday{__rhs, __lhs}; | 62 | return month_weekday{__rhs, __lhs}; |
| 60 | } | 63 | } |
| 61 | 64 | ||
| 62 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept { | 65 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday |
| 66 | operator/(const weekday_indexed& __lhs, int __rhs) noexcept { | ||
| 63 | return month_weekday{month(__rhs), __lhs}; | 67 | return month_weekday{month(__rhs), __lhs}; |
| 64 | } | 68 | } |
| 65 | 69 | ||
| ... | @@ -71,9 +75,11 @@ public: | ... | @@ -71,9 +75,11 @@ public: |
| 71 | _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval, | 75 | _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval, |
| 72 | const chrono::weekday_last& __wdlval) noexcept | 76 | const chrono::weekday_last& __wdlval) noexcept |
| 73 | : __m_{__mval}, __wdl_{__wdlval} {} | 77 | : __m_{__mval}, __wdl_{__wdlval} {} |
| 74 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | 78 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } |
| 75 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; } | 79 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { |
| 76 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); } | 80 | return __wdl_; |
| 81 | } | ||
| 82 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); } | ||
| 77 | }; | 83 | }; |
| 78 | 84 | ||
| 79 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool | 85 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool |
| ... | @@ -81,21 +87,23 @@ operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noe | ... | @@ -81,21 +87,23 @@ operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noe |
| 81 | return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); | 87 | return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); |
| 82 | } | 88 | } |
| 83 | 89 | ||
| 84 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last | 90 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last |
| 85 | operator/(const month& __lhs, const weekday_last& __rhs) noexcept { | 91 | operator/(const month& __lhs, const weekday_last& __rhs) noexcept { |
| 86 | return month_weekday_last{__lhs, __rhs}; | 92 | return month_weekday_last{__lhs, __rhs}; |
| 87 | } | 93 | } |
| 88 | 94 | ||
| 89 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept { | 95 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last |
| 96 | operator/(int __lhs, const weekday_last& __rhs) noexcept { | ||
| 90 | return month_weekday_last{month(__lhs), __rhs}; | 97 | return month_weekday_last{month(__lhs), __rhs}; |
| 91 | } | 98 | } |
| 92 | 99 | ||
| 93 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last | 100 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last |
| 94 | operator/(const weekday_last& __lhs, const month& __rhs) noexcept { | 101 | operator/(const weekday_last& __lhs, const month& __rhs) noexcept { |
| 95 | return month_weekday_last{__rhs, __lhs}; | 102 | return month_weekday_last{__rhs, __lhs}; |
| 96 | } | 103 | } |
| 97 | 104 | ||
| 98 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept { | 105 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last |
| 106 | operator/(const weekday_last& __lhs, int __rhs) noexcept { | ||
| 99 | return month_weekday_last{month(__rhs), __lhs}; | 107 | return month_weekday_last{month(__rhs), __lhs}; |
| 100 | } | 108 | } |
| 101 | } // namespace chrono | 109 | } // namespace chrono |
| ... | @@ -104,7 +112,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekda | ... | @@ -104,7 +112,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekda |
| 104 | 112 | ||
| 105 | template <> | 113 | template <> |
| 106 | struct hash<chrono::month_weekday> { | 114 | struct hash<chrono::month_weekday> { |
| 107 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday& __mw) noexcept { | 115 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday& __mw) noexcept { |
| 108 | return std::__hash_combine( | 116 | return std::__hash_combine( |
| 109 | hash<chrono::month>{}(__mw.month()), hash<chrono::weekday_indexed>{}(__mw.weekday_indexed())); | 117 | hash<chrono::month>{}(__mw.month()), hash<chrono::weekday_indexed>{}(__mw.weekday_indexed())); |
| 110 | } | 118 | } |
| ... | @@ -112,7 +120,7 @@ struct hash<chrono::month_weekday> { | ... | @@ -112,7 +120,7 @@ struct hash<chrono::month_weekday> { |
| 112 | 120 | ||
| 113 | template <> | 121 | template <> |
| 114 | struct hash<chrono::month_weekday_last> { | 122 | struct hash<chrono::month_weekday_last> { |
| 115 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday_last& __mwl) noexcept { | 123 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday_last& __mwl) noexcept { |
| 116 | return std::__hash_combine( | 124 | return std::__hash_combine( |
| 117 | hash<chrono::month>{}(__mwl.month()), hash<chrono::weekday_last>{}(__mwl.weekday_last())); | 125 | hash<chrono::month>{}(__mwl.month()), hash<chrono::weekday_last>{}(__mwl.weekday_last())); |
| 118 | } | 126 | } |
lib/libcxx/include/__chrono/monthday.h+18-16| ... | @@ -37,9 +37,9 @@ public: | ... | @@ -37,9 +37,9 @@ public: |
| 37 | month_day() = default; | 37 | month_day() = default; |
| 38 | _LIBCPP_HIDE_FROM_ABI constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept | 38 | _LIBCPP_HIDE_FROM_ABI constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept |
| 39 | : __m_{__mval}, __d_{__dval} {} | 39 | : __m_{__mval}, __d_{__dval} {} |
| 40 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | 40 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } |
| 41 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; } | 41 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; } |
| 42 | _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept; | 42 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept; |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool month_day::ok() const noexcept { | 45 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool month_day::ok() const noexcept { |
| ... | @@ -70,23 +70,25 @@ operator<=>(const month_day& __lhs, const month_day& __rhs) noexcept { | ... | @@ -70,23 +70,25 @@ operator<=>(const month_day& __lhs, const month_day& __rhs) noexcept { |
| 70 | return __lhs.day() <=> __rhs.day(); | 70 | return __lhs.day() <=> __rhs.day(); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, const day& __rhs) noexcept { | 73 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day |
| 74 | operator/(const month& __lhs, const day& __rhs) noexcept { | ||
| 74 | return month_day{__lhs, __rhs}; | 75 | return month_day{__lhs, __rhs}; |
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, const month& __rhs) noexcept { | 78 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day |
| 79 | operator/(const day& __lhs, const month& __rhs) noexcept { | ||
| 78 | return __rhs / __lhs; | 80 | return __rhs / __lhs; |
| 79 | } | 81 | } |
| 80 | 82 | ||
| 81 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, int __rhs) noexcept { | 83 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, int __rhs) noexcept { |
| 82 | return __lhs / day(__rhs); | 84 | return __lhs / day(__rhs); |
| 83 | } | 85 | } |
| 84 | 86 | ||
| 85 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(int __lhs, const day& __rhs) noexcept { | 87 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(int __lhs, const day& __rhs) noexcept { |
| 86 | return month(__lhs) / __rhs; | 88 | return month(__lhs) / __rhs; |
| 87 | } | 89 | } |
| 88 | 90 | ||
| 89 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, int __rhs) noexcept { | 91 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, int __rhs) noexcept { |
| 90 | return month(__rhs) / __lhs; | 92 | return month(__rhs) / __lhs; |
| 91 | } | 93 | } |
| 92 | 94 | ||
| ... | @@ -96,8 +98,8 @@ private: | ... | @@ -96,8 +98,8 @@ private: |
| 96 | 98 | ||
| 97 | public: | 99 | public: |
| 98 | _LIBCPP_HIDE_FROM_ABI explicit constexpr month_day_last(const chrono::month& __val) noexcept : __m_{__val} {} | 100 | _LIBCPP_HIDE_FROM_ABI explicit constexpr month_day_last(const chrono::month& __val) noexcept : __m_{__val} {} |
| 99 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | 101 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } |
| 100 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok(); } | 102 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok(); } |
| 101 | }; | 103 | }; |
| 102 | 104 | ||
| 103 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool | 105 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool |
| ... | @@ -110,19 +112,19 @@ operator<=>(const month_day_last& __lhs, const month_day_last& __rhs) noexcept { | ... | @@ -110,19 +112,19 @@ operator<=>(const month_day_last& __lhs, const month_day_last& __rhs) noexcept { |
| 110 | return __lhs.month() <=> __rhs.month(); | 112 | return __lhs.month() <=> __rhs.month(); |
| 111 | } | 113 | } |
| 112 | 114 | ||
| 113 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(const month& __lhs, last_spec) noexcept { | 115 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(const month& __lhs, last_spec) noexcept { |
| 114 | return month_day_last{__lhs}; | 116 | return month_day_last{__lhs}; |
| 115 | } | 117 | } |
| 116 | 118 | ||
| 117 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, const month& __rhs) noexcept { | 119 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, const month& __rhs) noexcept { |
| 118 | return month_day_last{__rhs}; | 120 | return month_day_last{__rhs}; |
| 119 | } | 121 | } |
| 120 | 122 | ||
| 121 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(int __lhs, last_spec) noexcept { | 123 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(int __lhs, last_spec) noexcept { |
| 122 | return month_day_last{month(__lhs)}; | 124 | return month_day_last{month(__lhs)}; |
| 123 | } | 125 | } |
| 124 | 126 | ||
| 125 | _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int __rhs) noexcept { | 127 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int __rhs) noexcept { |
| 126 | return month_day_last{month(__rhs)}; | 128 | return month_day_last{month(__rhs)}; |
| 127 | } | 129 | } |
| 128 | 130 | ||
| ... | @@ -132,14 +134,14 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int _ | ... | @@ -132,14 +134,14 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int _ |
| 132 | 134 | ||
| 133 | template <> | 135 | template <> |
| 134 | struct hash<chrono::month_day> { | 136 | struct hash<chrono::month_day> { |
| 135 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day& __md) noexcept { | 137 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day& __md) noexcept { |
| 136 | return std::__hash_combine(hash<chrono::month>{}(__md.month()), hash<chrono::day>{}(__md.day())); | 138 | return std::__hash_combine(hash<chrono::month>{}(__md.month()), hash<chrono::day>{}(__md.day())); |
| 137 | } | 139 | } |
| 138 | }; | 140 | }; |
| 139 | 141 | ||
| 140 | template <> | 142 | template <> |
| 141 | struct hash<chrono::month_day_last> { | 143 | struct hash<chrono::month_day_last> { |
| 142 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day_last& __mdl) noexcept { | 144 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day_last& __mdl) noexcept { |
| 143 | return hash<chrono::month>{}(__mdl.month()); | 145 | return hash<chrono::month>{}(__mdl.month()); |
| 144 | } | 146 | } |
| 145 | }; | 147 | }; |
lib/libcxx/include/__chrono/steady_clock.h+6-2| ... | @@ -18,11 +18,13 @@ | ... | @@ -18,11 +18,13 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | #if _LIBCPP_HAS_MONOTONIC_CLOCK | ||
| 22 | |||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 22 | 25 | ||
| 23 | namespace chrono { | 26 | namespace chrono { |
| 24 | 27 | ||
| 25 | #if _LIBCPP_HAS_MONOTONIC_CLOCK | ||
| 26 | class _LIBCPP_EXPORTED_FROM_ABI steady_clock { | 28 | class _LIBCPP_EXPORTED_FROM_ABI steady_clock { |
| 27 | public: | 29 | public: |
| 28 | typedef nanoseconds duration; | 30 | typedef nanoseconds duration; |
| ... | @@ -33,10 +35,12 @@ public: | ... | @@ -33,10 +35,12 @@ public: |
| 33 | 35 | ||
| 34 | [[__nodiscard__]] static time_point now() _NOEXCEPT; | 36 | [[__nodiscard__]] static time_point now() _NOEXCEPT; |
| 35 | }; | 37 | }; |
| 36 | #endif | ||
| 37 | 38 | ||
| 38 | } // namespace chrono | 39 | } // namespace chrono |
| 39 | 40 | ||
| 41 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 40 | _LIBCPP_END_NAMESPACE_STD | 42 | _LIBCPP_END_NAMESPACE_STD |
| 41 | 43 | ||
| 44 | #endif | ||
| 45 | |||
| 42 | #endif // _LIBCPP___CHRONO_STEADY_CLOCK_H | 46 | #endif // _LIBCPP___CHRONO_STEADY_CLOCK_H |
lib/libcxx/include/__chrono/system_clock.h+2| ... | @@ -20,6 +20,7 @@ | ... | @@ -20,6 +20,7 @@ |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 23 | 24 | ||
| 24 | namespace chrono { | 25 | namespace chrono { |
| 25 | 26 | ||
| ... | @@ -47,6 +48,7 @@ using sys_days = sys_time<days>; | ... | @@ -47,6 +48,7 @@ using sys_days = sys_time<days>; |
| 47 | 48 | ||
| 48 | } // namespace chrono | 49 | } // namespace chrono |
| 49 | 50 | ||
| 51 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 50 | _LIBCPP_END_NAMESPACE_STD | 52 | _LIBCPP_END_NAMESPACE_STD |
| 51 | 53 | ||
| 52 | #endif // _LIBCPP___CHRONO_SYSTEM_CLOCK_H | 54 | #endif // _LIBCPP___CHRONO_SYSTEM_CLOCK_H |
lib/libcxx/include/__chrono/tai_clock.h+4-4| ... | @@ -28,10 +28,10 @@ | ... | @@ -28,10 +28,10 @@ |
| 28 | _LIBCPP_PUSH_MACROS | 28 | _LIBCPP_PUSH_MACROS |
| 29 | # include <__undef_macros> | 29 | # include <__undef_macros> |
| 30 | 30 | ||
| 31 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 32 | |||
| 33 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION | 31 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION |
| 34 | 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 34 | |||
| 35 | namespace chrono { | 35 | namespace chrono { |
| 36 | 36 | ||
| 37 | class tai_clock; | 37 | class tai_clock; |
| ... | @@ -96,11 +96,11 @@ public: | ... | @@ -96,11 +96,11 @@ public: |
| 96 | 96 | ||
| 97 | } // namespace chrono | 97 | } // namespace chrono |
| 98 | 98 | ||
| 99 | _LIBCPP_END_NAMESPACE_STD | ||
| 100 | |||
| 99 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && | 101 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && |
| 100 | // _LIBCPP_HAS_LOCALIZATION | 102 | // _LIBCPP_HAS_LOCALIZATION |
| 101 | 103 | ||
| 102 | _LIBCPP_END_NAMESPACE_STD | ||
| 103 | |||
| 104 | _LIBCPP_POP_MACROS | 104 | _LIBCPP_POP_MACROS |
| 105 | 105 | ||
| 106 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB | 106 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB |
lib/libcxx/include/__chrono/time_zone.h+6-4| ... | @@ -35,10 +35,11 @@ | ... | @@ -35,10 +35,11 @@ |
| 35 | _LIBCPP_PUSH_MACROS | 35 | _LIBCPP_PUSH_MACROS |
| 36 | # include <__undef_macros> | 36 | # include <__undef_macros> |
| 37 | 37 | ||
| 38 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 39 | |||
| 40 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION | 38 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION |
| 41 | 39 | ||
| 40 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 41 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 42 | |||
| 42 | namespace chrono { | 43 | namespace chrono { |
| 43 | 44 | ||
| 44 | enum class choose { earliest, latest }; | 45 | enum class choose { earliest, latest }; |
| ... | @@ -173,11 +174,12 @@ operator<=>(const time_zone& __x, const time_zone& __y) noexcept { | ... | @@ -173,11 +174,12 @@ operator<=>(const time_zone& __x, const time_zone& __y) noexcept { |
| 173 | 174 | ||
| 174 | } // namespace chrono | 175 | } // namespace chrono |
| 175 | 176 | ||
| 177 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 178 | _LIBCPP_END_NAMESPACE_STD | ||
| 179 | |||
| 176 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && | 180 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && |
| 177 | // _LIBCPP_HAS_LOCALIZATION | 181 | // _LIBCPP_HAS_LOCALIZATION |
| 178 | 182 | ||
| 179 | _LIBCPP_END_NAMESPACE_STD | ||
| 180 | |||
| 181 | _LIBCPP_POP_MACROS | 183 | _LIBCPP_POP_MACROS |
| 182 | 184 | ||
| 183 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB | 185 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB |
lib/libcxx/include/__chrono/time_zone_link.h+4-4| ... | @@ -29,10 +29,10 @@ | ... | @@ -29,10 +29,10 @@ |
| 29 | _LIBCPP_PUSH_MACROS | 29 | _LIBCPP_PUSH_MACROS |
| 30 | # include <__undef_macros> | 30 | # include <__undef_macros> |
| 31 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | |||
| 34 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION | 32 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION |
| 35 | 33 | ||
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 35 | |||
| 36 | namespace chrono { | 36 | namespace chrono { |
| 37 | 37 | ||
| 38 | class time_zone_link { | 38 | class time_zone_link { |
| ... | @@ -67,11 +67,11 @@ operator<=>(const time_zone_link& __x, const time_zone_link& __y) noexcept { | ... | @@ -67,11 +67,11 @@ operator<=>(const time_zone_link& __x, const time_zone_link& __y) noexcept { |
| 67 | 67 | ||
| 68 | } // namespace chrono | 68 | } // namespace chrono |
| 69 | 69 | ||
| 70 | _LIBCPP_END_NAMESPACE_STD | ||
| 71 | |||
| 70 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && | 72 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && |
| 71 | // _LIBCPP_HAS_LOCALIZATION | 73 | // _LIBCPP_HAS_LOCALIZATION |
| 72 | 74 | ||
| 73 | _LIBCPP_END_NAMESPACE_STD | ||
| 74 | |||
| 75 | _LIBCPP_POP_MACROS | 75 | _LIBCPP_POP_MACROS |
| 76 | 76 | ||
| 77 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB | 77 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB |
lib/libcxx/include/__chrono/tzdb.h+6-4| ... | @@ -34,10 +34,11 @@ | ... | @@ -34,10 +34,11 @@ |
| 34 | _LIBCPP_PUSH_MACROS | 34 | _LIBCPP_PUSH_MACROS |
| 35 | # include <__undef_macros> | 35 | # include <__undef_macros> |
| 36 | 36 | ||
| 37 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 38 | |||
| 39 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION | 37 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION |
| 40 | 38 | ||
| 39 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 40 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 41 | |||
| 41 | namespace chrono { | 42 | namespace chrono { |
| 42 | 43 | ||
| 43 | struct tzdb { | 44 | struct tzdb { |
| ... | @@ -84,11 +85,12 @@ private: | ... | @@ -84,11 +85,12 @@ private: |
| 84 | 85 | ||
| 85 | } // namespace chrono | 86 | } // namespace chrono |
| 86 | 87 | ||
| 88 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 89 | _LIBCPP_END_NAMESPACE_STD | ||
| 90 | |||
| 87 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && | 91 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && |
| 88 | // _LIBCPP_HAS_LOCALIZATION | 92 | // _LIBCPP_HAS_LOCALIZATION |
| 89 | 93 | ||
| 90 | _LIBCPP_END_NAMESPACE_STD | ||
| 91 | |||
| 92 | _LIBCPP_POP_MACROS | 94 | _LIBCPP_POP_MACROS |
| 93 | 95 | ||
| 94 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB | 96 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB |
lib/libcxx/include/__chrono/tzdb_list.h+6-4| ... | @@ -27,10 +27,11 @@ | ... | @@ -27,10 +27,11 @@ |
| 27 | # pragma GCC system_header | 27 | # pragma GCC system_header |
| 28 | # endif | 28 | # endif |
| 29 | 29 | ||
| 30 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 31 | |||
| 32 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION | 30 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION |
| 33 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 34 | |||
| 34 | namespace chrono { | 35 | namespace chrono { |
| 35 | 36 | ||
| 36 | // TODO TZDB | 37 | // TODO TZDB |
| ... | @@ -98,11 +99,12 @@ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb(); | ... | @@ -98,11 +99,12 @@ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb(); |
| 98 | 99 | ||
| 99 | } // namespace chrono | 100 | } // namespace chrono |
| 100 | 101 | ||
| 102 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 103 | _LIBCPP_END_NAMESPACE_STD | ||
| 104 | |||
| 101 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && | 105 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && |
| 102 | // _LIBCPP_HAS_LOCALIZATION | 106 | // _LIBCPP_HAS_LOCALIZATION |
| 103 | 107 | ||
| 104 | _LIBCPP_END_NAMESPACE_STD | ||
| 105 | |||
| 106 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB | 108 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB |
| 107 | 109 | ||
| 108 | #endif // _LIBCPP___CHRONO_TZDB_LIST_H | 110 | #endif // _LIBCPP___CHRONO_TZDB_LIST_H |
lib/libcxx/include/__chrono/utc_clock.h+4-4| ... | @@ -27,10 +27,10 @@ | ... | @@ -27,10 +27,10 @@ |
| 27 | # pragma GCC system_header | 27 | # pragma GCC system_header |
| 28 | # endif | 28 | # endif |
| 29 | 29 | ||
| 30 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 31 | |||
| 32 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION | 30 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION |
| 33 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | |||
| 34 | namespace chrono { | 34 | namespace chrono { |
| 35 | 35 | ||
| 36 | class utc_clock; | 36 | class utc_clock; |
| ... | @@ -153,11 +153,11 @@ utc_clock::to_sys(const utc_time<_Duration>& __time) { | ... | @@ -153,11 +153,11 @@ utc_clock::to_sys(const utc_time<_Duration>& __time) { |
| 153 | 153 | ||
| 154 | } // namespace chrono | 154 | } // namespace chrono |
| 155 | 155 | ||
| 156 | _LIBCPP_END_NAMESPACE_STD | ||
| 157 | |||
| 156 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && | 158 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && |
| 157 | // _LIBCPP_HAS_LOCALIZATION | 159 | // _LIBCPP_HAS_LOCALIZATION |
| 158 | 160 | ||
| 159 | _LIBCPP_END_NAMESPACE_STD | ||
| 160 | |||
| 161 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB | 161 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB |
| 162 | 162 | ||
| 163 | #endif // _LIBCPP___CHRONO_UTC_CLOCK_H | 163 | #endif // _LIBCPP___CHRONO_UTC_CLOCK_H |
lib/libcxx/include/__chrono/weekday.h+27-17| ... | @@ -65,11 +65,13 @@ public: | ... | @@ -65,11 +65,13 @@ public: |
| 65 | } | 65 | } |
| 66 | _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator+=(const days& __dd) noexcept; | 66 | _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator+=(const days& __dd) noexcept; |
| 67 | _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator-=(const days& __dd) noexcept; | 67 | _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator-=(const days& __dd) noexcept; |
| 68 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd_; } | 68 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd_; } |
| 69 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned iso_encoding() const noexcept { return __wd_ == 0u ? 7 : __wd_; } | 69 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned iso_encoding() const noexcept { |
| 70 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_ <= 6; } | 70 | return __wd_ == 0u ? 7 : __wd_; |
| 71 | _LIBCPP_HIDE_FROM_ABI constexpr weekday_indexed operator[](unsigned __index) const noexcept; | 71 | } |
| 72 | _LIBCPP_HIDE_FROM_ABI constexpr weekday_last operator[](last_spec) const noexcept; | 72 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_ <= 6; } |
| 73 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr weekday_indexed operator[](unsigned __index) const noexcept; | ||
| 74 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr weekday_last operator[](last_spec) const noexcept; | ||
| 73 | }; | 75 | }; |
| 74 | 76 | ||
| 75 | // https://howardhinnant.github.io/date_algorithms.html#weekday_from_days | 77 | // https://howardhinnant.github.io/date_algorithms.html#weekday_from_days |
| ... | @@ -81,21 +83,25 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday& __lhs, con | ... | @@ -81,21 +83,25 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday& __lhs, con |
| 81 | return __lhs.c_encoding() == __rhs.c_encoding(); | 83 | return __lhs.c_encoding() == __rhs.c_encoding(); |
| 82 | } | 84 | } |
| 83 | 85 | ||
| 84 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept { | 86 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr weekday |
| 87 | operator+(const weekday& __lhs, const days& __rhs) noexcept { | ||
| 85 | auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count(); | 88 | auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count(); |
| 86 | auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7; | 89 | auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7; |
| 87 | return weekday{static_cast<unsigned>(__mu - __yr * 7)}; | 90 | return weekday{static_cast<unsigned>(__mu - __yr * 7)}; |
| 88 | } | 91 | } |
| 89 | 92 | ||
| 90 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const days& __lhs, const weekday& __rhs) noexcept { | 93 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr weekday |
| 94 | operator+(const days& __lhs, const weekday& __rhs) noexcept { | ||
| 91 | return __rhs + __lhs; | 95 | return __rhs + __lhs; |
| 92 | } | 96 | } |
| 93 | 97 | ||
| 94 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept { | 98 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr weekday |
| 99 | operator-(const weekday& __lhs, const days& __rhs) noexcept { | ||
| 95 | return __lhs + -__rhs; | 100 | return __lhs + -__rhs; |
| 96 | } | 101 | } |
| 97 | 102 | ||
| 98 | _LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept { | 103 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr days |
| 104 | operator-(const weekday& __lhs, const weekday& __rhs) noexcept { | ||
| 99 | const int __wdu = __lhs.c_encoding() - __rhs.c_encoding(); | 105 | const int __wdu = __lhs.c_encoding() - __rhs.c_encoding(); |
| 100 | const int __wk = (__wdu >= 0 ? __wdu : __wdu - 6) / 7; | 106 | const int __wk = (__wdu >= 0 ? __wdu : __wdu - 6) / 7; |
| 101 | return days{__wdu - __wk * 7}; | 107 | return days{__wdu - __wk * 7}; |
| ... | @@ -120,9 +126,11 @@ public: | ... | @@ -120,9 +126,11 @@ public: |
| 120 | weekday_indexed() = default; | 126 | weekday_indexed() = default; |
| 121 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed(const chrono::weekday& __wdval, unsigned __idxval) noexcept | 127 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed(const chrono::weekday& __wdval, unsigned __idxval) noexcept |
| 122 | : __wd_{__wdval}, __idx_(__idxval) {} | 128 | : __wd_{__wdval}, __idx_(__idxval) {} |
| 123 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd_; } | 129 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd_; } |
| 124 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx_; } | 130 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx_; } |
| 125 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_.ok() && __idx_ >= 1 && __idx_ <= 5; } | 131 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { |
| 132 | return __wd_.ok() && __idx_ >= 1 && __idx_ <= 5; | ||
| 133 | } | ||
| 126 | }; | 134 | }; |
| 127 | 135 | ||
| 128 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool | 136 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool |
| ... | @@ -136,8 +144,8 @@ private: | ... | @@ -136,8 +144,8 @@ private: |
| 136 | 144 | ||
| 137 | public: | 145 | public: |
| 138 | _LIBCPP_HIDE_FROM_ABI explicit constexpr weekday_last(const chrono::weekday& __val) noexcept : __wd_{__val} {} | 146 | _LIBCPP_HIDE_FROM_ABI explicit constexpr weekday_last(const chrono::weekday& __val) noexcept : __wd_{__val} {} |
| 139 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd_; } | 147 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd_; } |
| 140 | _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd_.ok(); } | 148 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd_.ok(); } |
| 141 | }; | 149 | }; |
| 142 | 150 | ||
| 143 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday_last& __lhs, const weekday_last& __rhs) noexcept { | 151 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday_last& __lhs, const weekday_last& __rhs) noexcept { |
| ... | @@ -166,19 +174,21 @@ inline constexpr weekday Saturday{6}; | ... | @@ -166,19 +174,21 @@ inline constexpr weekday Saturday{6}; |
| 166 | 174 | ||
| 167 | template <> | 175 | template <> |
| 168 | struct hash<chrono::weekday> { | 176 | struct hash<chrono::weekday> { |
| 169 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday& __w) noexcept { return __w.c_encoding(); } | 177 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday& __w) noexcept { |
| 178 | return __w.c_encoding(); | ||
| 179 | } | ||
| 170 | }; | 180 | }; |
| 171 | 181 | ||
| 172 | template <> | 182 | template <> |
| 173 | struct hash<chrono::weekday_indexed> { | 183 | struct hash<chrono::weekday_indexed> { |
| 174 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_indexed& __wi) noexcept { | 184 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_indexed& __wi) noexcept { |
| 175 | return std::__hash_combine(hash<chrono::weekday>{}(__wi.weekday()), __wi.index()); | 185 | return std::__hash_combine(hash<chrono::weekday>{}(__wi.weekday()), __wi.index()); |
| 176 | } | 186 | } |
| 177 | }; | 187 | }; |
| 178 | 188 | ||
| 179 | template <> | 189 | template <> |
| 180 | struct hash<chrono::weekday_last> { | 190 | struct hash<chrono::weekday_last> { |
| 181 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_last& __wl) noexcept { | 191 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_last& __wl) noexcept { |
| 182 | return hash<chrono::weekday>{}(__wl.weekday()); | 192 | return hash<chrono::weekday>{}(__wl.weekday()); |
| 183 | } | 193 | } |
| 184 | }; | 194 | }; |
lib/libcxx/include/__chrono/year.h+13-11| ... | @@ -58,16 +58,16 @@ public: | ... | @@ -58,16 +58,16 @@ public: |
| 58 | } | 58 | } |
| 59 | _LIBCPP_HIDE_FROM_ABI constexpr year& operator+=(const years& __dy) noexcept; | 59 | _LIBCPP_HIDE_FROM_ABI constexpr year& operator+=(const years& __dy) noexcept; |
| 60 | _LIBCPP_HIDE_FROM_ABI constexpr year& operator-=(const years& __dy) noexcept; | 60 | _LIBCPP_HIDE_FROM_ABI constexpr year& operator-=(const years& __dy) noexcept; |
| 61 | _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+() const noexcept { return *this; } | 61 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+() const noexcept { return *this; } |
| 62 | _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y_}; } | 62 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y_}; } |
| 63 | 63 | ||
| 64 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept { | 64 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept { |
| 65 | return __y_ % 4 == 0 && (__y_ % 100 != 0 || __y_ % 400 == 0); | 65 | return __y_ % 4 == 0 && (__y_ % 100 != 0 || __y_ % 400 == 0); |
| 66 | } | 66 | } |
| 67 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator int() const noexcept { return __y_; } | 67 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator int() const noexcept { return __y_; } |
| 68 | _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept; | 68 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept; |
| 69 | _LIBCPP_HIDE_FROM_ABI static inline constexpr year min() noexcept { return year{-32767}; } | 69 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static inline constexpr year min() noexcept { return year{-32767}; } |
| 70 | _LIBCPP_HIDE_FROM_ABI static inline constexpr year max() noexcept { return year{32767}; } | 70 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static inline constexpr year max() noexcept { return year{32767}; } |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const year& __lhs, const year& __rhs) noexcept { | 73 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const year& __lhs, const year& __rhs) noexcept { |
| ... | @@ -78,19 +78,19 @@ _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const year& __lhs, c | ... | @@ -78,19 +78,19 @@ _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const year& __lhs, c |
| 78 | return static_cast<int>(__lhs) <=> static_cast<int>(__rhs); | 78 | return static_cast<int>(__lhs) <=> static_cast<int>(__rhs); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const year& __lhs, const years& __rhs) noexcept { | 81 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const year& __lhs, const years& __rhs) noexcept { |
| 82 | return year(static_cast<int>(__lhs) + __rhs.count()); | 82 | return year(static_cast<int>(__lhs) + __rhs.count()); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const years& __lhs, const year& __rhs) noexcept { | 85 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const years& __lhs, const year& __rhs) noexcept { |
| 86 | return __rhs + __lhs; | 86 | return __rhs + __lhs; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-(const year& __lhs, const years& __rhs) noexcept { | 89 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-(const year& __lhs, const years& __rhs) noexcept { |
| 90 | return __lhs + -__rhs; | 90 | return __lhs + -__rhs; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | _LIBCPP_HIDE_FROM_ABI inline constexpr years operator-(const year& __lhs, const year& __rhs) noexcept { | 93 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr years operator-(const year& __lhs, const year& __rhs) noexcept { |
| 94 | return years{static_cast<int>(__lhs) - static_cast<int>(__rhs)}; | 94 | return years{static_cast<int>(__lhs) - static_cast<int>(__rhs)}; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| ... | @@ -115,7 +115,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool year::ok() const noexcept { | ... | @@ -115,7 +115,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool year::ok() const noexcept { |
| 115 | 115 | ||
| 116 | template <> | 116 | template <> |
| 117 | struct hash<chrono::year> { | 117 | struct hash<chrono::year> { |
| 118 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year& __y) noexcept { return static_cast<int>(__y); } | 118 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year& __y) noexcept { |
| 119 | return static_cast<int>(__y); | ||
| 120 | } | ||
| 119 | }; | 121 | }; |
| 120 | 122 | ||
| 121 | # endif // _LIBCPP_STD_VER >= 26 | 123 | # endif // _LIBCPP_STD_VER >= 26 |
lib/libcxx/include/__chrono/year_month.h+20-13| ... | @@ -36,20 +36,20 @@ public: | ... | @@ -36,20 +36,20 @@ public: |
| 36 | year_month() = default; | 36 | year_month() = default; |
| 37 | _LIBCPP_HIDE_FROM_ABI constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept | 37 | _LIBCPP_HIDE_FROM_ABI constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept |
| 38 | : __y_{__yval}, __m_{__mval} {} | 38 | : __y_{__yval}, __m_{__mval} {} |
| 39 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } | 39 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } |
| 40 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | 40 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } |
| 41 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const months& __dm) noexcept; | 41 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const months& __dm) noexcept; |
| 42 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const months& __dm) noexcept; | 42 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const months& __dm) noexcept; |
| 43 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const years& __dy) noexcept; | 43 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const years& __dy) noexcept; |
| 44 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const years& __dy) noexcept; | 44 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const years& __dy) noexcept; |
| 45 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok(); } | 45 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok(); } |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, const month& __m) noexcept { | 48 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, const month& __m) noexcept { |
| 49 | return year_month{__y, __m}; | 49 | return year_month{__y, __m}; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, int __m) noexcept { | 52 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, int __m) noexcept { |
| 53 | return year_month{__y, month(__m)}; | 53 | return year_month{__y, month(__m)}; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| ... | @@ -64,35 +64,42 @@ operator<=>(const year_month& __lhs, const year_month& __rhs) noexcept { | ... | @@ -64,35 +64,42 @@ operator<=>(const year_month& __lhs, const year_month& __rhs) noexcept { |
| 64 | return __lhs.month() <=> __rhs.month(); | 64 | return __lhs.month() <=> __rhs.month(); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const year_month& __lhs, const months& __rhs) noexcept { | 67 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month |
| 68 | operator+(const year_month& __lhs, const months& __rhs) noexcept { | ||
| 68 | int __dmi = static_cast<int>(static_cast<unsigned>(__lhs.month())) - 1 + __rhs.count(); | 69 | int __dmi = static_cast<int>(static_cast<unsigned>(__lhs.month())) - 1 + __rhs.count(); |
| 69 | const int __dy = (__dmi >= 0 ? __dmi : __dmi - 11) / 12; | 70 | const int __dy = (__dmi >= 0 ? __dmi : __dmi - 11) / 12; |
| 70 | __dmi = __dmi - __dy * 12 + 1; | 71 | __dmi = __dmi - __dy * 12 + 1; |
| 71 | return (__lhs.year() + years(__dy)) / month(static_cast<unsigned>(__dmi)); | 72 | return (__lhs.year() + years(__dy)) / month(static_cast<unsigned>(__dmi)); |
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const months& __lhs, const year_month& __rhs) noexcept { | 75 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month |
| 76 | operator+(const months& __lhs, const year_month& __rhs) noexcept { | ||
| 75 | return __rhs + __lhs; | 77 | return __rhs + __lhs; |
| 76 | } | 78 | } |
| 77 | 79 | ||
| 78 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const year_month& __lhs, const years& __rhs) noexcept { | 80 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month |
| 81 | operator+(const year_month& __lhs, const years& __rhs) noexcept { | ||
| 79 | return (__lhs.year() + __rhs) / __lhs.month(); | 82 | return (__lhs.year() + __rhs) / __lhs.month(); |
| 80 | } | 83 | } |
| 81 | 84 | ||
| 82 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const years& __lhs, const year_month& __rhs) noexcept { | 85 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month |
| 86 | operator+(const years& __lhs, const year_month& __rhs) noexcept { | ||
| 83 | return __rhs + __lhs; | 87 | return __rhs + __lhs; |
| 84 | } | 88 | } |
| 85 | 89 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const year_month& __lhs, const year_month& __rhs) noexcept { | 90 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr months |
| 91 | operator-(const year_month& __lhs, const year_month& __rhs) noexcept { | ||
| 87 | return (__lhs.year() - __rhs.year()) + | 92 | return (__lhs.year() - __rhs.year()) + |
| 88 | months(static_cast<unsigned>(__lhs.month()) - static_cast<unsigned>(__rhs.month())); | 93 | months(static_cast<unsigned>(__lhs.month()) - static_cast<unsigned>(__rhs.month())); |
| 89 | } | 94 | } |
| 90 | 95 | ||
| 91 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator-(const year_month& __lhs, const months& __rhs) noexcept { | 96 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month |
| 97 | operator-(const year_month& __lhs, const months& __rhs) noexcept { | ||
| 92 | return __lhs + -__rhs; | 98 | return __lhs + -__rhs; |
| 93 | } | 99 | } |
| 94 | 100 | ||
| 95 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator-(const year_month& __lhs, const years& __rhs) noexcept { | 101 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month |
| 102 | operator-(const year_month& __lhs, const years& __rhs) noexcept { | ||
| 96 | return __lhs + -__rhs; | 103 | return __lhs + -__rhs; |
| 97 | } | 104 | } |
| 98 | 105 | ||
| ... | @@ -122,7 +129,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator-=(const | ... | @@ -122,7 +129,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator-=(const |
| 122 | 129 | ||
| 123 | template <> | 130 | template <> |
| 124 | struct hash<chrono::year_month> { | 131 | struct hash<chrono::year_month> { |
| 125 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month& __ym) noexcept { | 132 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month& __ym) noexcept { |
| 126 | return std::__hash_combine(hash<chrono::year>{}(__ym.year()), hash<chrono::month>{}(__ym.month())); | 133 | return std::__hash_combine(hash<chrono::year>{}(__ym.year()), hash<chrono::month>{}(__ym.month())); |
| 127 | } | 134 | } |
| 128 | }; | 135 | }; |
lib/libcxx/include/__chrono/year_month_day.h+45-34| ... | @@ -59,15 +59,15 @@ public: | ... | @@ -59,15 +59,15 @@ public: |
| 59 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const years& __dy) noexcept; | 59 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const years& __dy) noexcept; |
| 60 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const years& __dy) noexcept; | 60 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const years& __dy) noexcept; |
| 61 | 61 | ||
| 62 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } | 62 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } |
| 63 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | 63 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } |
| 64 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; } | 64 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; } |
| 65 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } | 65 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } |
| 66 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { | 66 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { |
| 67 | return local_days{__to_days()}; | 67 | return local_days{__to_days()}; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept; | 70 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept; |
| 71 | 71 | ||
| 72 | _LIBCPP_HIDE_FROM_ABI static constexpr year_month_day __from_days(days __d) noexcept; | 72 | _LIBCPP_HIDE_FROM_ABI static constexpr year_month_day __from_days(days __d) noexcept; |
| 73 | _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept; | 73 | _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept; |
| ... | @@ -119,56 +119,62 @@ operator<=>(const year_month_day& __lhs, const year_month_day& __rhs) noexcept { | ... | @@ -119,56 +119,62 @@ operator<=>(const year_month_day& __lhs, const year_month_day& __rhs) noexcept { |
| 119 | return __lhs.day() <=> __rhs.day(); | 119 | return __lhs.day() <=> __rhs.day(); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year_month& __lhs, const day& __rhs) noexcept { | 122 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 123 | operator/(const year_month& __lhs, const day& __rhs) noexcept { | ||
| 123 | return year_month_day{__lhs.year(), __lhs.month(), __rhs}; | 124 | return year_month_day{__lhs.year(), __lhs.month(), __rhs}; |
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year_month& __lhs, int __rhs) noexcept { | 127 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 128 | operator/(const year_month& __lhs, int __rhs) noexcept { | ||
| 127 | return __lhs / day(__rhs); | 129 | return __lhs / day(__rhs); |
| 128 | } | 130 | } |
| 129 | 131 | ||
| 130 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year& __lhs, const month_day& __rhs) noexcept { | 132 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 133 | operator/(const year& __lhs, const month_day& __rhs) noexcept { | ||
| 131 | return __lhs / __rhs.month() / __rhs.day(); | 134 | return __lhs / __rhs.month() / __rhs.day(); |
| 132 | } | 135 | } |
| 133 | 136 | ||
| 134 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(int __lhs, const month_day& __rhs) noexcept { | 137 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 138 | operator/(int __lhs, const month_day& __rhs) noexcept { | ||
| 135 | return year(__lhs) / __rhs; | 139 | return year(__lhs) / __rhs; |
| 136 | } | 140 | } |
| 137 | 141 | ||
| 138 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const month_day& __lhs, const year& __rhs) noexcept { | 142 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 143 | operator/(const month_day& __lhs, const year& __rhs) noexcept { | ||
| 139 | return __rhs / __lhs; | 144 | return __rhs / __lhs; |
| 140 | } | 145 | } |
| 141 | 146 | ||
| 142 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const month_day& __lhs, int __rhs) noexcept { | 147 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 148 | operator/(const month_day& __lhs, int __rhs) noexcept { | ||
| 143 | return year(__rhs) / __lhs; | 149 | return year(__rhs) / __lhs; |
| 144 | } | 150 | } |
| 145 | 151 | ||
| 146 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day | 152 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 147 | operator+(const year_month_day& __lhs, const months& __rhs) noexcept { | 153 | operator+(const year_month_day& __lhs, const months& __rhs) noexcept { |
| 148 | return (__lhs.year() / __lhs.month() + __rhs) / __lhs.day(); | 154 | return (__lhs.year() / __lhs.month() + __rhs) / __lhs.day(); |
| 149 | } | 155 | } |
| 150 | 156 | ||
| 151 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day | 157 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 152 | operator+(const months& __lhs, const year_month_day& __rhs) noexcept { | 158 | operator+(const months& __lhs, const year_month_day& __rhs) noexcept { |
| 153 | return __rhs + __lhs; | 159 | return __rhs + __lhs; |
| 154 | } | 160 | } |
| 155 | 161 | ||
| 156 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day | 162 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 157 | operator-(const year_month_day& __lhs, const months& __rhs) noexcept { | 163 | operator-(const year_month_day& __lhs, const months& __rhs) noexcept { |
| 158 | return __lhs + -__rhs; | 164 | return __lhs + -__rhs; |
| 159 | } | 165 | } |
| 160 | 166 | ||
| 161 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day | 167 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 162 | operator+(const year_month_day& __lhs, const years& __rhs) noexcept { | 168 | operator+(const year_month_day& __lhs, const years& __rhs) noexcept { |
| 163 | return (__lhs.year() + __rhs) / __lhs.month() / __lhs.day(); | 169 | return (__lhs.year() + __rhs) / __lhs.month() / __lhs.day(); |
| 164 | } | 170 | } |
| 165 | 171 | ||
| 166 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day | 172 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 167 | operator+(const years& __lhs, const year_month_day& __rhs) noexcept { | 173 | operator+(const years& __lhs, const year_month_day& __rhs) noexcept { |
| 168 | return __rhs + __lhs; | 174 | return __rhs + __lhs; |
| 169 | } | 175 | } |
| 170 | 176 | ||
| 171 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day | 177 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day |
| 172 | operator-(const year_month_day& __lhs, const years& __rhs) noexcept { | 178 | operator-(const year_month_day& __lhs, const years& __rhs) noexcept { |
| 173 | return __lhs + -__rhs; | 179 | return __lhs + -__rhs; |
| 174 | } | 180 | } |
| ... | @@ -204,17 +210,19 @@ public: | ... | @@ -204,17 +210,19 @@ public: |
| 204 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const years& __y) noexcept; | 210 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const years& __y) noexcept; |
| 205 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const years& __y) noexcept; | 211 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const years& __y) noexcept; |
| 206 | 212 | ||
| 207 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } | 213 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } |
| 208 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl_.month(); } | 214 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl_.month(); } |
| 209 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept { return __mdl_; } | 215 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept { |
| 210 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::day day() const noexcept; | 216 | return __mdl_; |
| 217 | } | ||
| 218 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::day day() const noexcept; | ||
| 211 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { | 219 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { |
| 212 | return sys_days{year() / month() / day()}; | 220 | return sys_days{year() / month() / day()}; |
| 213 | } | 221 | } |
| 214 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { | 222 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { |
| 215 | return local_days{year() / month() / day()}; | 223 | return local_days{year() / month() / day()}; |
| 216 | } | 224 | } |
| 217 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __mdl_.ok(); } | 225 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __mdl_.ok(); } |
| 218 | }; | 226 | }; |
| 219 | 227 | ||
| 220 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day year_month_day_last::day() const noexcept { | 228 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day year_month_day_last::day() const noexcept { |
| ... | @@ -248,54 +256,57 @@ operator<=>(const year_month_day_last& __lhs, const year_month_day_last& __rhs) | ... | @@ -248,54 +256,57 @@ operator<=>(const year_month_day_last& __lhs, const year_month_day_last& __rhs) |
| 248 | return __lhs.month_day_last() <=> __rhs.month_day_last(); | 256 | return __lhs.month_day_last() <=> __rhs.month_day_last(); |
| 249 | } | 257 | } |
| 250 | 258 | ||
| 251 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(const year_month& __lhs, last_spec) noexcept { | 259 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last |
| 260 | operator/(const year_month& __lhs, last_spec) noexcept { | ||
| 252 | return year_month_day_last{__lhs.year(), month_day_last{__lhs.month()}}; | 261 | return year_month_day_last{__lhs.year(), month_day_last{__lhs.month()}}; |
| 253 | } | 262 | } |
| 254 | 263 | ||
| 255 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last | 264 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last |
| 256 | operator/(const year& __lhs, const month_day_last& __rhs) noexcept { | 265 | operator/(const year& __lhs, const month_day_last& __rhs) noexcept { |
| 257 | return year_month_day_last{__lhs, __rhs}; | 266 | return year_month_day_last{__lhs, __rhs}; |
| 258 | } | 267 | } |
| 259 | 268 | ||
| 260 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(int __lhs, const month_day_last& __rhs) noexcept { | 269 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last |
| 270 | operator/(int __lhs, const month_day_last& __rhs) noexcept { | ||
| 261 | return year_month_day_last{year{__lhs}, __rhs}; | 271 | return year_month_day_last{year{__lhs}, __rhs}; |
| 262 | } | 272 | } |
| 263 | 273 | ||
| 264 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last | 274 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last |
| 265 | operator/(const month_day_last& __lhs, const year& __rhs) noexcept { | 275 | operator/(const month_day_last& __lhs, const year& __rhs) noexcept { |
| 266 | return __rhs / __lhs; | 276 | return __rhs / __lhs; |
| 267 | } | 277 | } |
| 268 | 278 | ||
| 269 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(const month_day_last& __lhs, int __rhs) noexcept { | 279 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last |
| 280 | operator/(const month_day_last& __lhs, int __rhs) noexcept { | ||
| 270 | return year{__rhs} / __lhs; | 281 | return year{__rhs} / __lhs; |
| 271 | } | 282 | } |
| 272 | 283 | ||
| 273 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last | 284 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last |
| 274 | operator+(const year_month_day_last& __lhs, const months& __rhs) noexcept { | 285 | operator+(const year_month_day_last& __lhs, const months& __rhs) noexcept { |
| 275 | return (__lhs.year() / __lhs.month() + __rhs) / last; | 286 | return (__lhs.year() / __lhs.month() + __rhs) / last; |
| 276 | } | 287 | } |
| 277 | 288 | ||
| 278 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last | 289 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last |
| 279 | operator+(const months& __lhs, const year_month_day_last& __rhs) noexcept { | 290 | operator+(const months& __lhs, const year_month_day_last& __rhs) noexcept { |
| 280 | return __rhs + __lhs; | 291 | return __rhs + __lhs; |
| 281 | } | 292 | } |
| 282 | 293 | ||
| 283 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last | 294 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last |
| 284 | operator-(const year_month_day_last& __lhs, const months& __rhs) noexcept { | 295 | operator-(const year_month_day_last& __lhs, const months& __rhs) noexcept { |
| 285 | return __lhs + (-__rhs); | 296 | return __lhs + (-__rhs); |
| 286 | } | 297 | } |
| 287 | 298 | ||
| 288 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last | 299 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last |
| 289 | operator+(const year_month_day_last& __lhs, const years& __rhs) noexcept { | 300 | operator+(const year_month_day_last& __lhs, const years& __rhs) noexcept { |
| 290 | return year_month_day_last{__lhs.year() + __rhs, __lhs.month_day_last()}; | 301 | return year_month_day_last{__lhs.year() + __rhs, __lhs.month_day_last()}; |
| 291 | } | 302 | } |
| 292 | 303 | ||
| 293 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last | 304 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last |
| 294 | operator+(const years& __lhs, const year_month_day_last& __rhs) noexcept { | 305 | operator+(const years& __lhs, const year_month_day_last& __rhs) noexcept { |
| 295 | return __rhs + __lhs; | 306 | return __rhs + __lhs; |
| 296 | } | 307 | } |
| 297 | 308 | ||
| 298 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last | 309 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last |
| 299 | operator-(const year_month_day_last& __lhs, const years& __rhs) noexcept { | 310 | operator-(const year_month_day_last& __lhs, const years& __rhs) noexcept { |
| 300 | return __lhs + (-__rhs); | 311 | return __lhs + (-__rhs); |
| 301 | } | 312 | } |
| ... | @@ -336,7 +347,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool year_month_day::ok() const noexcept | ... | @@ -336,7 +347,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool year_month_day::ok() const noexcept |
| 336 | 347 | ||
| 337 | template <> | 348 | template <> |
| 338 | struct hash<chrono::year_month_day> { | 349 | struct hash<chrono::year_month_day> { |
| 339 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day& __ymd) noexcept { | 350 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day& __ymd) noexcept { |
| 340 | return std::__hash_combine( | 351 | return std::__hash_combine( |
| 341 | hash<chrono::year>{}(__ymd.year()), | 352 | hash<chrono::year>{}(__ymd.year()), |
| 342 | std::__hash_combine(hash<chrono::month>{}(__ymd.month()), hash<chrono::day>{}(__ymd.day()))); | 353 | std::__hash_combine(hash<chrono::month>{}(__ymd.month()), hash<chrono::day>{}(__ymd.day()))); |
| ... | @@ -345,7 +356,7 @@ struct hash<chrono::year_month_day> { | ... | @@ -345,7 +356,7 @@ struct hash<chrono::year_month_day> { |
| 345 | 356 | ||
| 346 | template <> | 357 | template <> |
| 347 | struct hash<chrono::year_month_day_last> { | 358 | struct hash<chrono::year_month_day_last> { |
| 348 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day_last& __ymdl) noexcept { | 359 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day_last& __ymdl) noexcept { |
| 349 | return std::__hash_combine( | 360 | return std::__hash_combine( |
| 350 | hash<chrono::year>{}(__ymdl.year()), hash<chrono::month_day_last>{}(__ymdl.month_day_last())); | 361 | hash<chrono::year>{}(__ymdl.year()), hash<chrono::month_day_last>{}(__ymdl.month_day_last())); |
| 351 | } | 362 | } |
lib/libcxx/include/__chrono/year_month_weekday.h+47-35| ... | @@ -54,17 +54,21 @@ public: | ... | @@ -54,17 +54,21 @@ public: |
| 54 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const years&) noexcept; | 54 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const years&) noexcept; |
| 55 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const years&) noexcept; | 55 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const years&) noexcept; |
| 56 | 56 | ||
| 57 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } | 57 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } |
| 58 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | 58 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } |
| 59 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdi_.weekday(); } | 59 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { |
| 60 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi_.index(); } | 60 | return __wdi_.weekday(); |
| 61 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; } | 61 | } |
| 62 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi_.index(); } | ||
| 63 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { | ||
| 64 | return __wdi_; | ||
| 65 | } | ||
| 62 | 66 | ||
| 63 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } | 67 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } |
| 64 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { | 68 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { |
| 65 | return local_days{__to_days()}; | 69 | return local_days{__to_days()}; |
| 66 | } | 70 | } |
| 67 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { | 71 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { |
| 68 | if (!__y_.ok() || !__m_.ok() || !__wdi_.ok()) | 72 | if (!__y_.ok() || !__m_.ok() || !__wdi_.ok()) |
| 69 | return false; | 73 | return false; |
| 70 | if (__wdi_.index() <= 4) | 74 | if (__wdi_.index() <= 4) |
| ... | @@ -96,55 +100,57 @@ operator==(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noe | ... | @@ -96,55 +100,57 @@ operator==(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noe |
| 96 | __lhs.weekday_indexed() == __rhs.weekday_indexed(); | 100 | __lhs.weekday_indexed() == __rhs.weekday_indexed(); |
| 97 | } | 101 | } |
| 98 | 102 | ||
| 99 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday | 103 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday |
| 100 | operator/(const year_month& __lhs, const weekday_indexed& __rhs) noexcept { | 104 | operator/(const year_month& __lhs, const weekday_indexed& __rhs) noexcept { |
| 101 | return year_month_weekday{__lhs.year(), __lhs.month(), __rhs}; | 105 | return year_month_weekday{__lhs.year(), __lhs.month(), __rhs}; |
| 102 | } | 106 | } |
| 103 | 107 | ||
| 104 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday | 108 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday |
| 105 | operator/(const year& __lhs, const month_weekday& __rhs) noexcept { | 109 | operator/(const year& __lhs, const month_weekday& __rhs) noexcept { |
| 106 | return year_month_weekday{__lhs, __rhs.month(), __rhs.weekday_indexed()}; | 110 | return year_month_weekday{__lhs, __rhs.month(), __rhs.weekday_indexed()}; |
| 107 | } | 111 | } |
| 108 | 112 | ||
| 109 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday operator/(int __lhs, const month_weekday& __rhs) noexcept { | 113 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday |
| 114 | operator/(int __lhs, const month_weekday& __rhs) noexcept { | ||
| 110 | return year(__lhs) / __rhs; | 115 | return year(__lhs) / __rhs; |
| 111 | } | 116 | } |
| 112 | 117 | ||
| 113 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday | 118 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday |
| 114 | operator/(const month_weekday& __lhs, const year& __rhs) noexcept { | 119 | operator/(const month_weekday& __lhs, const year& __rhs) noexcept { |
| 115 | return __rhs / __lhs; | 120 | return __rhs / __lhs; |
| 116 | } | 121 | } |
| 117 | 122 | ||
| 118 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday operator/(const month_weekday& __lhs, int __rhs) noexcept { | 123 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday |
| 124 | operator/(const month_weekday& __lhs, int __rhs) noexcept { | ||
| 119 | return year(__rhs) / __lhs; | 125 | return year(__rhs) / __lhs; |
| 120 | } | 126 | } |
| 121 | 127 | ||
| 122 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday | 128 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday |
| 123 | operator+(const year_month_weekday& __lhs, const months& __rhs) noexcept { | 129 | operator+(const year_month_weekday& __lhs, const months& __rhs) noexcept { |
| 124 | return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_indexed(); | 130 | return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_indexed(); |
| 125 | } | 131 | } |
| 126 | 132 | ||
| 127 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday | 133 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday |
| 128 | operator+(const months& __lhs, const year_month_weekday& __rhs) noexcept { | 134 | operator+(const months& __lhs, const year_month_weekday& __rhs) noexcept { |
| 129 | return __rhs + __lhs; | 135 | return __rhs + __lhs; |
| 130 | } | 136 | } |
| 131 | 137 | ||
| 132 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday | 138 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday |
| 133 | operator-(const year_month_weekday& __lhs, const months& __rhs) noexcept { | 139 | operator-(const year_month_weekday& __lhs, const months& __rhs) noexcept { |
| 134 | return __lhs + (-__rhs); | 140 | return __lhs + (-__rhs); |
| 135 | } | 141 | } |
| 136 | 142 | ||
| 137 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday | 143 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday |
| 138 | operator+(const year_month_weekday& __lhs, const years& __rhs) noexcept { | 144 | operator+(const year_month_weekday& __lhs, const years& __rhs) noexcept { |
| 139 | return year_month_weekday{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_indexed()}; | 145 | return year_month_weekday{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_indexed()}; |
| 140 | } | 146 | } |
| 141 | 147 | ||
| 142 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday | 148 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday |
| 143 | operator+(const years& __lhs, const year_month_weekday& __rhs) noexcept { | 149 | operator+(const years& __lhs, const year_month_weekday& __rhs) noexcept { |
| 144 | return __rhs + __lhs; | 150 | return __rhs + __lhs; |
| 145 | } | 151 | } |
| 146 | 152 | ||
| 147 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday | 153 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday |
| 148 | operator-(const year_month_weekday& __lhs, const years& __rhs) noexcept { | 154 | operator-(const year_month_weekday& __lhs, const years& __rhs) noexcept { |
| 149 | return __lhs + (-__rhs); | 155 | return __lhs + (-__rhs); |
| 150 | } | 156 | } |
| ... | @@ -181,15 +187,21 @@ public: | ... | @@ -181,15 +187,21 @@ public: |
| 181 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept; | 187 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept; |
| 182 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept; | 188 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept; |
| 183 | 189 | ||
| 184 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } | 190 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } |
| 185 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | 191 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } |
| 186 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdl_.weekday(); } | 192 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { |
| 187 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; } | 193 | return __wdl_.weekday(); |
| 194 | } | ||
| 195 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { | ||
| 196 | return __wdl_; | ||
| 197 | } | ||
| 188 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } | 198 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } |
| 189 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { | 199 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { |
| 190 | return local_days{__to_days()}; | 200 | return local_days{__to_days()}; |
| 191 | } | 201 | } |
| 192 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok() && __wdl_.ok(); } | 202 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { |
| 203 | return __y_.ok() && __m_.ok() && __wdl_.ok(); | ||
| 204 | } | ||
| 193 | 205 | ||
| 194 | _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept; | 206 | _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept; |
| 195 | }; | 207 | }; |
| ... | @@ -204,57 +216,57 @@ operator==(const year_month_weekday_last& __lhs, const year_month_weekday_last& | ... | @@ -204,57 +216,57 @@ operator==(const year_month_weekday_last& __lhs, const year_month_weekday_last& |
| 204 | return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); | 216 | return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); |
| 205 | } | 217 | } |
| 206 | 218 | ||
| 207 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last | 219 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last |
| 208 | operator/(const year_month& __lhs, const weekday_last& __rhs) noexcept { | 220 | operator/(const year_month& __lhs, const weekday_last& __rhs) noexcept { |
| 209 | return year_month_weekday_last{__lhs.year(), __lhs.month(), __rhs}; | 221 | return year_month_weekday_last{__lhs.year(), __lhs.month(), __rhs}; |
| 210 | } | 222 | } |
| 211 | 223 | ||
| 212 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last | 224 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last |
| 213 | operator/(const year& __lhs, const month_weekday_last& __rhs) noexcept { | 225 | operator/(const year& __lhs, const month_weekday_last& __rhs) noexcept { |
| 214 | return year_month_weekday_last{__lhs, __rhs.month(), __rhs.weekday_last()}; | 226 | return year_month_weekday_last{__lhs, __rhs.month(), __rhs.weekday_last()}; |
| 215 | } | 227 | } |
| 216 | 228 | ||
| 217 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last | 229 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last |
| 218 | operator/(int __lhs, const month_weekday_last& __rhs) noexcept { | 230 | operator/(int __lhs, const month_weekday_last& __rhs) noexcept { |
| 219 | return year(__lhs) / __rhs; | 231 | return year(__lhs) / __rhs; |
| 220 | } | 232 | } |
| 221 | 233 | ||
| 222 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last | 234 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last |
| 223 | operator/(const month_weekday_last& __lhs, const year& __rhs) noexcept { | 235 | operator/(const month_weekday_last& __lhs, const year& __rhs) noexcept { |
| 224 | return __rhs / __lhs; | 236 | return __rhs / __lhs; |
| 225 | } | 237 | } |
| 226 | 238 | ||
| 227 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last | 239 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last |
| 228 | operator/(const month_weekday_last& __lhs, int __rhs) noexcept { | 240 | operator/(const month_weekday_last& __lhs, int __rhs) noexcept { |
| 229 | return year(__rhs) / __lhs; | 241 | return year(__rhs) / __lhs; |
| 230 | } | 242 | } |
| 231 | 243 | ||
| 232 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last | 244 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last |
| 233 | operator+(const year_month_weekday_last& __lhs, const months& __rhs) noexcept { | 245 | operator+(const year_month_weekday_last& __lhs, const months& __rhs) noexcept { |
| 234 | return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_last(); | 246 | return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_last(); |
| 235 | } | 247 | } |
| 236 | 248 | ||
| 237 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last | 249 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last |
| 238 | operator+(const months& __lhs, const year_month_weekday_last& __rhs) noexcept { | 250 | operator+(const months& __lhs, const year_month_weekday_last& __rhs) noexcept { |
| 239 | return __rhs + __lhs; | 251 | return __rhs + __lhs; |
| 240 | } | 252 | } |
| 241 | 253 | ||
| 242 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last | 254 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last |
| 243 | operator-(const year_month_weekday_last& __lhs, const months& __rhs) noexcept { | 255 | operator-(const year_month_weekday_last& __lhs, const months& __rhs) noexcept { |
| 244 | return __lhs + (-__rhs); | 256 | return __lhs + (-__rhs); |
| 245 | } | 257 | } |
| 246 | 258 | ||
| 247 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last | 259 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last |
| 248 | operator+(const year_month_weekday_last& __lhs, const years& __rhs) noexcept { | 260 | operator+(const year_month_weekday_last& __lhs, const years& __rhs) noexcept { |
| 249 | return year_month_weekday_last{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_last()}; | 261 | return year_month_weekday_last{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_last()}; |
| 250 | } | 262 | } |
| 251 | 263 | ||
| 252 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last | 264 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last |
| 253 | operator+(const years& __lhs, const year_month_weekday_last& __rhs) noexcept { | 265 | operator+(const years& __lhs, const year_month_weekday_last& __rhs) noexcept { |
| 254 | return __rhs + __lhs; | 266 | return __rhs + __lhs; |
| 255 | } | 267 | } |
| 256 | 268 | ||
| 257 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last | 269 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last |
| 258 | operator-(const year_month_weekday_last& __lhs, const years& __rhs) noexcept { | 270 | operator-(const year_month_weekday_last& __lhs, const years& __rhs) noexcept { |
| 259 | return __lhs + (-__rhs); | 271 | return __lhs + (-__rhs); |
| 260 | } | 272 | } |
| ... | @@ -286,7 +298,7 @@ year_month_weekday_last::operator-=(const years& __dy) noexcept { | ... | @@ -286,7 +298,7 @@ year_month_weekday_last::operator-=(const years& __dy) noexcept { |
| 286 | 298 | ||
| 287 | template <> | 299 | template <> |
| 288 | struct hash<chrono::year_month_weekday> { | 300 | struct hash<chrono::year_month_weekday> { |
| 289 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday& __ymw) noexcept { | 301 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday& __ymw) noexcept { |
| 290 | return std::__hash_combine( | 302 | return std::__hash_combine( |
| 291 | hash<chrono::year>{}(__ymw.year()), | 303 | hash<chrono::year>{}(__ymw.year()), |
| 292 | std::__hash_combine( | 304 | std::__hash_combine( |
| ... | @@ -296,7 +308,7 @@ struct hash<chrono::year_month_weekday> { | ... | @@ -296,7 +308,7 @@ struct hash<chrono::year_month_weekday> { |
| 296 | 308 | ||
| 297 | template <> | 309 | template <> |
| 298 | struct hash<chrono::year_month_weekday_last> { | 310 | struct hash<chrono::year_month_weekday_last> { |
| 299 | _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday_last& __ymwl) noexcept { | 311 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday_last& __ymwl) noexcept { |
| 300 | return std::__hash_combine( | 312 | return std::__hash_combine( |
| 301 | hash<chrono::year>{}(__ymwl.year()), | 313 | hash<chrono::year>{}(__ymwl.year()), |
| 302 | std::__hash_combine( | 314 | std::__hash_combine( |
lib/libcxx/include/__chrono/zoned_time.h+4-4| ... | @@ -40,10 +40,10 @@ | ... | @@ -40,10 +40,10 @@ |
| 40 | _LIBCPP_PUSH_MACROS | 40 | _LIBCPP_PUSH_MACROS |
| 41 | # include <__undef_macros> | 41 | # include <__undef_macros> |
| 42 | 42 | ||
| 43 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 44 | |||
| 45 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION | 43 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION |
| 46 | 44 | ||
| 45 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 46 | |||
| 47 | namespace chrono { | 47 | namespace chrono { |
| 48 | 48 | ||
| 49 | template <class> | 49 | template <class> |
| ... | @@ -232,11 +232,11 @@ struct hash<chrono::zoned_time<_Duration, _TimeZonePtr>> { | ... | @@ -232,11 +232,11 @@ struct hash<chrono::zoned_time<_Duration, _TimeZonePtr>> { |
| 232 | 232 | ||
| 233 | # endif // _LIBCPP_STD_VER >= 26 | 233 | # endif // _LIBCPP_STD_VER >= 26 |
| 234 | 234 | ||
| 235 | _LIBCPP_END_NAMESPACE_STD | ||
| 236 | |||
| 235 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && | 237 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && |
| 236 | // _LIBCPP_HAS_LOCALIZATION | 238 | // _LIBCPP_HAS_LOCALIZATION |
| 237 | 239 | ||
| 238 | _LIBCPP_END_NAMESPACE_STD | ||
| 239 | |||
| 240 | _LIBCPP_POP_MACROS | 240 | _LIBCPP_POP_MACROS |
| 241 | 241 | ||
| 242 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB | 242 | #endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB |
lib/libcxx/include/__compare/common_comparison_category.h+4-4| ... | @@ -18,10 +18,10 @@ | ... | @@ -18,10 +18,10 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 20 | 21 | #if _LIBCPP_STD_VER >= 20 |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | namespace __comp_detail { | 25 | namespace __comp_detail { |
| 26 | 26 | ||
| 27 | enum _ClassifyCompCategory : unsigned { _None, _PartialOrd, _WeakOrd, _StrongOrd, _CCC_Size }; | 27 | enum _ClassifyCompCategory : unsigned { _None, _PartialOrd, _WeakOrd, _StrongOrd, _CCC_Size }; |
| ... | @@ -79,8 +79,8 @@ struct common_comparison_category { | ... | @@ -79,8 +79,8 @@ struct common_comparison_category { |
| 79 | template <class... _Ts> | 79 | template <class... _Ts> |
| 80 | using common_comparison_category_t = typename common_comparison_category<_Ts...>::type; | 80 | using common_comparison_category_t = typename common_comparison_category<_Ts...>::type; |
| 81 | 81 | ||
| 82 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 83 | |||
| 84 | _LIBCPP_END_NAMESPACE_STD | 82 | _LIBCPP_END_NAMESPACE_STD |
| 85 | 83 | ||
| 84 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 85 | |||
| 86 | #endif // _LIBCPP___COMPARE_COMMON_COMPARISON_CATEGORY_H | 86 | #endif // _LIBCPP___COMPARE_COMMON_COMPARISON_CATEGORY_H |
lib/libcxx/include/__compare/compare_three_way.h+4-4| ... | @@ -18,10 +18,10 @@ | ... | @@ -18,10 +18,10 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 20 | 21 | #if _LIBCPP_STD_VER >= 20 |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | struct compare_three_way { | 25 | struct compare_three_way { |
| 26 | template <class _T1, class _T2> | 26 | template <class _T1, class _T2> |
| 27 | requires three_way_comparable_with<_T1, _T2> | 27 | requires three_way_comparable_with<_T1, _T2> |
| ... | @@ -33,8 +33,8 @@ struct compare_three_way { | ... | @@ -33,8 +33,8 @@ struct compare_three_way { |
| 33 | using is_transparent = void; | 33 | using is_transparent = void; |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 37 | |||
| 38 | _LIBCPP_END_NAMESPACE_STD | 36 | _LIBCPP_END_NAMESPACE_STD |
| 39 | 37 | ||
| 38 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 39 | |||
| 40 | #endif // _LIBCPP___COMPARE_COMPARE_THREE_WAY_H | 40 | #endif // _LIBCPP___COMPARE_COMPARE_THREE_WAY_H |
lib/libcxx/include/__compare/compare_three_way_result.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class, class, class> | 24 | template <class, class, class> |
| 25 | struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result {}; | 25 | struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result {}; |
| 26 | 26 | ||
| ... | @@ -39,8 +39,8 @@ struct _LIBCPP_NO_SPECIALIZATIONS compare_three_way_result : __compare_three_way | ... | @@ -39,8 +39,8 @@ struct _LIBCPP_NO_SPECIALIZATIONS compare_three_way_result : __compare_three_way |
| 39 | template <class _Tp, class _Up = _Tp> | 39 | template <class _Tp, class _Up = _Tp> |
| 40 | using compare_three_way_result_t = typename compare_three_way_result<_Tp, _Up>::type; | 40 | using compare_three_way_result_t = typename compare_three_way_result<_Tp, _Up>::type; |
| 41 | 41 | ||
| 42 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 43 | |||
| 44 | _LIBCPP_END_NAMESPACE_STD | 42 | _LIBCPP_END_NAMESPACE_STD |
| 45 | 43 | ||
| 44 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 45 | |||
| 46 | #endif // _LIBCPP___COMPARE_COMPARE_THREE_WAY_RESULT_H | 46 | #endif // _LIBCPP___COMPARE_COMPARE_THREE_WAY_RESULT_H |
lib/libcxx/include/__compare/ordering.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | // exposition only | 24 | // exposition only |
| 25 | enum class _OrdResult : signed char { __less = -1, __equiv = 0, __greater = 1 }; | 25 | enum class _OrdResult : signed char { __less = -1, __equiv = 0, __greater = 1 }; |
| 26 | 26 | ||
| ... | @@ -275,8 +275,8 @@ template <class _Tp> | ... | @@ -275,8 +275,8 @@ template <class _Tp> |
| 275 | concept __comparison_category = | 275 | concept __comparison_category = |
| 276 | is_same_v<_Tp, partial_ordering> || is_same_v<_Tp, weak_ordering> || is_same_v<_Tp, strong_ordering>; | 276 | is_same_v<_Tp, partial_ordering> || is_same_v<_Tp, weak_ordering> || is_same_v<_Tp, strong_ordering>; |
| 277 | 277 | ||
| 278 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 279 | |||
| 280 | _LIBCPP_END_NAMESPACE_STD | 278 | _LIBCPP_END_NAMESPACE_STD |
| 281 | 279 | ||
| 280 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 281 | |||
| 282 | #endif // _LIBCPP___COMPARE_ORDERING_H | 282 | #endif // _LIBCPP___COMPARE_ORDERING_H |
lib/libcxx/include/__compare/synth_three_way.h+4-4| ... | @@ -19,10 +19,10 @@ | ... | @@ -19,10 +19,10 @@ |
| 19 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 20 | 22 | #if _LIBCPP_STD_VER >= 20 |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | // [expos.only.func] | 26 | // [expos.only.func] |
| 27 | 27 | ||
| 28 | _LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way = []<class _Tp, class _Up>(const _Tp& __t, const _Up& __u) | 28 | _LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way = []<class _Tp, class _Up>(const _Tp& __t, const _Up& __u) |
| ... | @@ -46,8 +46,8 @@ template <class _Tp, class _Up = _Tp> | ... | @@ -46,8 +46,8 @@ template <class _Tp, class _Up = _Tp> |
| 46 | using __synth_three_way_result _LIBCPP_NODEBUG = | 46 | using __synth_three_way_result _LIBCPP_NODEBUG = |
| 47 | decltype(std::__synth_three_way(std::declval<_Tp&>(), std::declval<_Up&>())); | 47 | decltype(std::__synth_three_way(std::declval<_Tp&>(), std::declval<_Up&>())); |
| 48 | 48 | ||
| 49 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 50 | |||
| 51 | _LIBCPP_END_NAMESPACE_STD | 49 | _LIBCPP_END_NAMESPACE_STD |
| 52 | 50 | ||
| 51 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 52 | |||
| 53 | #endif // _LIBCPP___COMPARE_SYNTH_THREE_WAY_H | 53 | #endif // _LIBCPP___COMPARE_SYNTH_THREE_WAY_H |
lib/libcxx/include/__compare/three_way_comparable.h+4-4| ... | @@ -24,10 +24,10 @@ | ... | @@ -24,10 +24,10 @@ |
| 24 | # pragma GCC system_header | 24 | # pragma GCC system_header |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 28 | |||
| 29 | #if _LIBCPP_STD_VER >= 20 | 27 | #if _LIBCPP_STD_VER >= 20 |
| 30 | 28 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 30 | |||
| 31 | template <class _Tp, class _Cat> | 31 | template <class _Tp, class _Cat> |
| 32 | concept __compares_as = same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>; | 32 | concept __compares_as = same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>; |
| 33 | 33 | ||
| ... | @@ -48,8 +48,8 @@ concept three_way_comparable_with = | ... | @@ -48,8 +48,8 @@ concept three_way_comparable_with = |
| 48 | { __u <=> __t } -> __compares_as<_Cat>; | 48 | { __u <=> __t } -> __compares_as<_Cat>; |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 52 | |||
| 53 | _LIBCPP_END_NAMESPACE_STD | 51 | _LIBCPP_END_NAMESPACE_STD |
| 54 | 52 | ||
| 53 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 54 | |||
| 55 | #endif // _LIBCPP___COMPARE_THREE_WAY_COMPARABLE_H | 55 | #endif // _LIBCPP___COMPARE_THREE_WAY_COMPARABLE_H |
lib/libcxx/include/__concepts/arithmetic.h+4-4| ... | @@ -18,10 +18,10 @@ | ... | @@ -18,10 +18,10 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 20 | 21 | #if _LIBCPP_STD_VER >= 20 |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | // [concepts.arithmetic], arithmetic concepts | 25 | // [concepts.arithmetic], arithmetic concepts |
| 26 | 26 | ||
| 27 | template <class _Tp> | 27 | template <class _Tp> |
| ... | @@ -36,8 +36,8 @@ concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>; | ... | @@ -36,8 +36,8 @@ concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>; |
| 36 | template <class _Tp> | 36 | template <class _Tp> |
| 37 | concept floating_point = is_floating_point_v<_Tp>; | 37 | concept floating_point = is_floating_point_v<_Tp>; |
| 38 | 38 | ||
| 39 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 40 | |||
| 41 | _LIBCPP_END_NAMESPACE_STD | 39 | _LIBCPP_END_NAMESPACE_STD |
| 42 | 40 | ||
| 41 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 42 | |||
| 43 | #endif // _LIBCPP___CONCEPTS_ARITHMETIC_H | 43 | #endif // _LIBCPP___CONCEPTS_ARITHMETIC_H |
lib/libcxx/include/__concepts/assignable.h+4-4| ... | @@ -20,10 +20,10 @@ | ... | @@ -20,10 +20,10 @@ |
| 20 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | #if _LIBCPP_STD_VER >= 20 | 23 | #if _LIBCPP_STD_VER >= 20 |
| 26 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 26 | |||
| 27 | // [concept.assignable] | 27 | // [concept.assignable] |
| 28 | 28 | ||
| 29 | template <class _Lhs, class _Rhs> | 29 | template <class _Lhs, class _Rhs> |
| ... | @@ -34,8 +34,8 @@ concept assignable_from = | ... | @@ -34,8 +34,8 @@ concept assignable_from = |
| 34 | { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>; | 34 | { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>; |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 38 | |||
| 39 | _LIBCPP_END_NAMESPACE_STD | 37 | _LIBCPP_END_NAMESPACE_STD |
| 40 | 38 | ||
| 39 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 40 | |||
| 41 | #endif // _LIBCPP___CONCEPTS_ASSIGNABLE_H | 41 | #endif // _LIBCPP___CONCEPTS_ASSIGNABLE_H |
lib/libcxx/include/__concepts/boolean_testable.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | // [concepts.booleantestable] | 24 | // [concepts.booleantestable] |
| 25 | 25 | ||
| 26 | template <class _Tp> | 26 | template <class _Tp> |
| ... | @@ -31,8 +31,8 @@ concept __boolean_testable = __boolean_testable_impl<_Tp> && requires(_Tp&& __t) | ... | @@ -31,8 +31,8 @@ concept __boolean_testable = __boolean_testable_impl<_Tp> && requires(_Tp&& __t) |
| 31 | { !std::forward<_Tp>(__t) } -> __boolean_testable_impl; | 31 | { !std::forward<_Tp>(__t) } -> __boolean_testable_impl; |
| 32 | }; | 32 | }; |
| 33 | 33 | ||
| 34 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 35 | |||
| 36 | _LIBCPP_END_NAMESPACE_STD | 34 | _LIBCPP_END_NAMESPACE_STD |
| 37 | 35 | ||
| 36 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 37 | |||
| 38 | #endif // _LIBCPP___CONCEPTS_BOOLEAN_TESTABLE_H | 38 | #endif // _LIBCPP___CONCEPTS_BOOLEAN_TESTABLE_H |
lib/libcxx/include/__concepts/class_or_enum.h+4-4| ... | @@ -18,17 +18,17 @@ | ... | @@ -18,17 +18,17 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 20 | 21 | #if _LIBCPP_STD_VER >= 20 |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | // Whether a type is a class type or enumeration type according to the Core wording. | 25 | // Whether a type is a class type or enumeration type according to the Core wording. |
| 26 | 26 | ||
| 27 | template <class _Tp> | 27 | template <class _Tp> |
| 28 | concept __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>; | 28 | concept __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>; |
| 29 | 29 | ||
| 30 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 31 | |||
| 32 | _LIBCPP_END_NAMESPACE_STD | 30 | _LIBCPP_END_NAMESPACE_STD |
| 33 | 31 | ||
| 32 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 33 | |||
| 34 | #endif // _LIBCPP___CONCEPTS_CLASS_OR_ENUM_H | 34 | #endif // _LIBCPP___CONCEPTS_CLASS_OR_ENUM_H |
lib/libcxx/include/__concepts/common_reference_with.h+4-4| ... | @@ -18,10 +18,10 @@ | ... | @@ -18,10 +18,10 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 20 | 21 | #if _LIBCPP_STD_VER >= 20 |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | // [concept.commonref] | 25 | // [concept.commonref] |
| 26 | 26 | ||
| 27 | template <class _Tp, class _Up> | 27 | template <class _Tp, class _Up> |
| ... | @@ -29,8 +29,8 @@ concept common_reference_with = | ... | @@ -29,8 +29,8 @@ concept common_reference_with = |
| 29 | same_as<common_reference_t<_Tp, _Up>, common_reference_t<_Up, _Tp>> && | 29 | same_as<common_reference_t<_Tp, _Up>, common_reference_t<_Up, _Tp>> && |
| 30 | convertible_to<_Tp, common_reference_t<_Tp, _Up>> && convertible_to<_Up, common_reference_t<_Tp, _Up>>; | 30 | convertible_to<_Tp, common_reference_t<_Tp, _Up>> && convertible_to<_Up, common_reference_t<_Tp, _Up>>; |
| 31 | 31 | ||
| 32 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 33 | |||
| 34 | _LIBCPP_END_NAMESPACE_STD | 32 | _LIBCPP_END_NAMESPACE_STD |
| 35 | 33 | ||
| 34 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 35 | |||
| 36 | #endif // _LIBCPP___CONCEPTS_COMMON_REFERENCE_WITH_H | 36 | #endif // _LIBCPP___CONCEPTS_COMMON_REFERENCE_WITH_H |
lib/libcxx/include/__concepts/comparison_common_type.h+4-4| ... | @@ -19,10 +19,10 @@ | ... | @@ -19,10 +19,10 @@ |
| 19 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 20 | 22 | #if _LIBCPP_STD_VER >= 20 |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | template <class _Tp, class _Up, class _CommonRef = common_reference_t<const _Tp&, const _Up&>> | 26 | template <class _Tp, class _Up, class _CommonRef = common_reference_t<const _Tp&, const _Up&>> |
| 27 | concept __comparison_common_type_with_impl = | 27 | concept __comparison_common_type_with_impl = |
| 28 | same_as<common_reference_t<const _Tp&, const _Up&>, common_reference_t<const _Up&, const _Tp&>> && requires { | 28 | same_as<common_reference_t<const _Tp&, const _Up&>, common_reference_t<const _Up&, const _Tp&>> && requires { |
| ... | @@ -33,8 +33,8 @@ concept __comparison_common_type_with_impl = | ... | @@ -33,8 +33,8 @@ concept __comparison_common_type_with_impl = |
| 33 | template <class _Tp, class _Up> | 33 | template <class _Tp, class _Up> |
| 34 | concept __comparison_common_type_with = __comparison_common_type_with_impl<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>; | 34 | concept __comparison_common_type_with = __comparison_common_type_with_impl<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>; |
| 35 | 35 | ||
| 36 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 37 | |||
| 38 | _LIBCPP_END_NAMESPACE_STD | 36 | _LIBCPP_END_NAMESPACE_STD |
| 39 | 37 | ||
| 38 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 39 | |||
| 40 | #endif // _LIBCPP___CONCEPTS_COMPARISON_COMMON_TYPE_H | 40 | #endif // _LIBCPP___CONCEPTS_COMPARISON_COMMON_TYPE_H |
lib/libcxx/include/__concepts/constructible.h+4-4| ... | @@ -18,10 +18,10 @@ | ... | @@ -18,10 +18,10 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 20 | 21 | #if _LIBCPP_STD_VER >= 20 |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | // [concept.constructible] | 25 | // [concept.constructible] |
| 26 | template <class _Tp, class... _Args> | 26 | template <class _Tp, class... _Args> |
| 27 | concept constructible_from = destructible<_Tp> && is_constructible_v<_Tp, _Args...>; | 27 | concept constructible_from = destructible<_Tp> && is_constructible_v<_Tp, _Args...>; |
| ... | @@ -48,8 +48,8 @@ concept copy_constructible = | ... | @@ -48,8 +48,8 @@ concept copy_constructible = |
| 48 | constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>; | 48 | constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>; |
| 49 | // clang-format on | 49 | // clang-format on |
| 50 | 50 | ||
| 51 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 52 | |||
| 53 | _LIBCPP_END_NAMESPACE_STD | 51 | _LIBCPP_END_NAMESPACE_STD |
| 54 | 52 | ||
| 53 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 54 | |||
| 55 | #endif // _LIBCPP___CONCEPTS_CONSTRUCTIBLE_H | 55 | #endif // _LIBCPP___CONCEPTS_CONSTRUCTIBLE_H |
lib/libcxx/include/__concepts/convertible_to.h+4-4| ... | @@ -17,17 +17,17 @@ | ... | @@ -17,17 +17,17 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | // [concept.convertible] | 24 | // [concept.convertible] |
| 25 | 25 | ||
| 26 | template <class _From, class _To> | 26 | template <class _From, class _To> |
| 27 | concept convertible_to = is_convertible_v<_From, _To> && requires { static_cast<_To>(std::declval<_From>()); }; | 27 | concept convertible_to = is_convertible_v<_From, _To> && requires { static_cast<_To>(std::declval<_From>()); }; |
| 28 | 28 | ||
| 29 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 30 | |||
| 31 | _LIBCPP_END_NAMESPACE_STD | 29 | _LIBCPP_END_NAMESPACE_STD |
| 32 | 30 | ||
| 31 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 32 | |||
| 33 | #endif // _LIBCPP___CONCEPTS_CONVERTIBLE_TO_H | 33 | #endif // _LIBCPP___CONCEPTS_CONVERTIBLE_TO_H |
lib/libcxx/include/__concepts/copyable.h+4-4| ... | @@ -18,10 +18,10 @@ | ... | @@ -18,10 +18,10 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 20 | 21 | #if _LIBCPP_STD_VER >= 20 |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | // [concepts.object] | 25 | // [concepts.object] |
| 26 | 26 | ||
| 27 | // clang-format off | 27 | // clang-format off |
| ... | @@ -34,8 +34,8 @@ concept copyable = | ... | @@ -34,8 +34,8 @@ concept copyable = |
| 34 | assignable_from<_Tp&, const _Tp>; | 34 | assignable_from<_Tp&, const _Tp>; |
| 35 | // clang-format on | 35 | // clang-format on |
| 36 | 36 | ||
| 37 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 38 | |||
| 39 | _LIBCPP_END_NAMESPACE_STD | 37 | _LIBCPP_END_NAMESPACE_STD |
| 40 | 38 | ||
| 39 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 40 | |||
| 41 | #endif // _LIBCPP___CONCEPTS_COPYABLE_H | 41 | #endif // _LIBCPP___CONCEPTS_COPYABLE_H |
lib/libcxx/include/__concepts/derived_from.h+4-4| ... | @@ -17,17 +17,17 @@ | ... | @@ -17,17 +17,17 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | // [concept.derived] | 24 | // [concept.derived] |
| 25 | 25 | ||
| 26 | template <class _Dp, class _Bp> | 26 | template <class _Dp, class _Bp> |
| 27 | concept derived_from = is_base_of_v<_Bp, _Dp> && is_convertible_v<const volatile _Dp*, const volatile _Bp*>; | 27 | concept derived_from = is_base_of_v<_Bp, _Dp> && is_convertible_v<const volatile _Dp*, const volatile _Bp*>; |
| 28 | 28 | ||
| 29 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 30 | |||
| 31 | _LIBCPP_END_NAMESPACE_STD | 29 | _LIBCPP_END_NAMESPACE_STD |
| 32 | 30 | ||
| 31 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 32 | |||
| 33 | #endif // _LIBCPP___CONCEPTS_DERIVED_FROM_H | 33 | #endif // _LIBCPP___CONCEPTS_DERIVED_FROM_H |
lib/libcxx/include/__concepts/destructible.h+4-4| ... | @@ -16,17 +16,17 @@ | ... | @@ -16,17 +16,17 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | #if _LIBCPP_STD_VER >= 20 | 19 | #if _LIBCPP_STD_VER >= 20 |
| 22 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | // [concept.destructible] | 23 | // [concept.destructible] |
| 24 | 24 | ||
| 25 | template <class _Tp> | 25 | template <class _Tp> |
| 26 | concept destructible = is_nothrow_destructible_v<_Tp>; | 26 | concept destructible = is_nothrow_destructible_v<_Tp>; |
| 27 | 27 | ||
| 28 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 29 | |||
| 30 | _LIBCPP_END_NAMESPACE_STD | 28 | _LIBCPP_END_NAMESPACE_STD |
| 31 | 29 | ||
| 30 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 31 | |||
| 32 | #endif // _LIBCPP___CONCEPTS_DESTRUCTIBLE_H | 32 | #endif // _LIBCPP___CONCEPTS_DESTRUCTIBLE_H |
lib/libcxx/include/__concepts/different_from.h+4-4| ... | @@ -17,15 +17,15 @@ | ... | @@ -17,15 +17,15 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _Tp, class _Up> | 24 | template <class _Tp, class _Up> |
| 25 | concept __different_from = !same_as<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>; | 25 | concept __different_from = !same_as<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>; |
| 26 | 26 | ||
| 27 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 28 | |||
| 29 | _LIBCPP_END_NAMESPACE_STD | 27 | _LIBCPP_END_NAMESPACE_STD |
| 30 | 28 | ||
| 29 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 30 | |||
| 31 | #endif // _LIBCPP___CONCEPTS_DIFFERENT_FROM_H | 31 | #endif // _LIBCPP___CONCEPTS_DIFFERENT_FROM_H |
lib/libcxx/include/__concepts/equality_comparable.h+4-4| ... | @@ -20,10 +20,10 @@ | ... | @@ -20,10 +20,10 @@ |
| 20 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | #if _LIBCPP_STD_VER >= 20 | 23 | #if _LIBCPP_STD_VER >= 20 |
| 26 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 26 | |||
| 27 | // [concept.equalitycomparable] | 27 | // [concept.equalitycomparable] |
| 28 | 28 | ||
| 29 | template <class _Tp, class _Up> | 29 | template <class _Tp, class _Up> |
| ... | @@ -50,8 +50,8 @@ concept equality_comparable_with = | ... | @@ -50,8 +50,8 @@ concept equality_comparable_with = |
| 50 | __weakly_equality_comparable_with<_Tp, _Up>; | 50 | __weakly_equality_comparable_with<_Tp, _Up>; |
| 51 | // clang-format on | 51 | // clang-format on |
| 52 | 52 | ||
| 53 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 54 | |||
| 55 | _LIBCPP_END_NAMESPACE_STD | 53 | _LIBCPP_END_NAMESPACE_STD |
| 56 | 54 | ||
| 55 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 56 | |||
| 57 | #endif // _LIBCPP___CONCEPTS_EQUALITY_COMPARABLE_H | 57 | #endif // _LIBCPP___CONCEPTS_EQUALITY_COMPARABLE_H |
lib/libcxx/include/__concepts/invocable.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | // [concept.invocable] | 24 | // [concept.invocable] |
| 25 | 25 | ||
| 26 | template <class _Fn, class... _Args> | 26 | template <class _Fn, class... _Args> |
| ... | @@ -33,8 +33,8 @@ concept invocable = requires(_Fn&& __fn, _Args&&... __args) { | ... | @@ -33,8 +33,8 @@ concept invocable = requires(_Fn&& __fn, _Args&&... __args) { |
| 33 | template <class _Fn, class... _Args> | 33 | template <class _Fn, class... _Args> |
| 34 | concept regular_invocable = invocable<_Fn, _Args...>; | 34 | concept regular_invocable = invocable<_Fn, _Args...>; |
| 35 | 35 | ||
| 36 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 37 | |||
| 38 | _LIBCPP_END_NAMESPACE_STD | 36 | _LIBCPP_END_NAMESPACE_STD |
| 39 | 37 | ||
| 38 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 39 | |||
| 40 | #endif // _LIBCPP___CONCEPTS_INVOCABLE_H | 40 | #endif // _LIBCPP___CONCEPTS_INVOCABLE_H |
lib/libcxx/include/__concepts/movable.h+4-4| ... | @@ -19,17 +19,17 @@ | ... | @@ -19,17 +19,17 @@ |
| 19 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 20 | 22 | #if _LIBCPP_STD_VER >= 20 |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | // [concepts.object] | 26 | // [concepts.object] |
| 27 | 27 | ||
| 28 | template <class _Tp> | 28 | template <class _Tp> |
| 29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>; | 29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>; |
| 30 | 30 | ||
| 31 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 32 | |||
| 33 | _LIBCPP_END_NAMESPACE_STD | 31 | _LIBCPP_END_NAMESPACE_STD |
| 34 | 32 | ||
| 33 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 34 | |||
| 35 | #endif // _LIBCPP___CONCEPTS_MOVABLE_H | 35 | #endif // _LIBCPP___CONCEPTS_MOVABLE_H |
lib/libcxx/include/__concepts/predicate.h+4-4| ... | @@ -18,17 +18,17 @@ | ... | @@ -18,17 +18,17 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 20 | 21 | #if _LIBCPP_STD_VER >= 20 |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | // [concept.predicate] | 25 | // [concept.predicate] |
| 26 | 26 | ||
| 27 | template <class _Fn, class... _Args> | 27 | template <class _Fn, class... _Args> |
| 28 | concept predicate = regular_invocable<_Fn, _Args...> && __boolean_testable<invoke_result_t<_Fn, _Args...>>; | 28 | concept predicate = regular_invocable<_Fn, _Args...> && __boolean_testable<invoke_result_t<_Fn, _Args...>>; |
| 29 | 29 | ||
| 30 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 31 | |||
| 32 | _LIBCPP_END_NAMESPACE_STD | 30 | _LIBCPP_END_NAMESPACE_STD |
| 33 | 31 | ||
| 32 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 33 | |||
| 34 | #endif // _LIBCPP___CONCEPTS_PREDICATE_H | 34 | #endif // _LIBCPP___CONCEPTS_PREDICATE_H |
lib/libcxx/include/__concepts/primary_template.h created+33| ... | @@ -0,0 +1,33 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H | ||
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__type_traits/is_same.h> | ||
| 14 | |||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 16 | # pragma GCC system_header | ||
| 17 | #endif | ||
| 18 | |||
| 19 | #if _LIBCPP_STD_VER >= 20 | ||
| 20 | |||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | template <class _Tp> | ||
| 24 | concept __primary_template = requires { | ||
| 25 | typename _Tp::__primary_template; | ||
| 26 | requires _IsSame<typename _Tp::__primary_template, _Tp>::value; | ||
| 27 | }; | ||
| 28 | |||
| 29 | _LIBCPP_END_NAMESPACE_STD | ||
| 30 | |||
| 31 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 32 | |||
| 33 | #endif // _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H | ||
lib/libcxx/include/__concepts/referenceable.h created+30| ... | @@ -0,0 +1,30 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H | ||
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__type_traits/void_t.h> | ||
| 14 | |||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 16 | # pragma GCC system_header | ||
| 17 | #endif | ||
| 18 | |||
| 19 | #if _LIBCPP_STD_VER >= 20 | ||
| 20 | |||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | template <class _Tp> | ||
| 24 | concept __referenceable = requires { typename __void_t<_Tp&>; }; | ||
| 25 | |||
| 26 | _LIBCPP_END_NAMESPACE_STD | ||
| 27 | |||
| 28 | #endif | ||
| 29 | |||
| 30 | #endif // _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H | ||
lib/libcxx/include/__concepts/regular.h+4-4| ... | @@ -17,17 +17,17 @@ | ... | @@ -17,17 +17,17 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | // [concept.object] | 24 | // [concept.object] |
| 25 | 25 | ||
| 26 | template <class _Tp> | 26 | template <class _Tp> |
| 27 | concept regular = semiregular<_Tp> && equality_comparable<_Tp>; | 27 | concept regular = semiregular<_Tp> && equality_comparable<_Tp>; |
| 28 | 28 | ||
| 29 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 30 | |||
| 31 | _LIBCPP_END_NAMESPACE_STD | 29 | _LIBCPP_END_NAMESPACE_STD |
| 32 | 30 | ||
| 31 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 32 | |||
| 33 | #endif // _LIBCPP___CONCEPTS_REGULAR_H | 33 | #endif // _LIBCPP___CONCEPTS_REGULAR_H |
lib/libcxx/include/__concepts/relation.h+4-4| ... | @@ -16,10 +16,10 @@ | ... | @@ -16,10 +16,10 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | #if _LIBCPP_STD_VER >= 20 | 19 | #if _LIBCPP_STD_VER >= 20 |
| 22 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | // [concept.relation] | 23 | // [concept.relation] |
| 24 | 24 | ||
| 25 | template <class _Rp, class _Tp, class _Up> | 25 | template <class _Rp, class _Tp, class _Up> |
| ... | @@ -36,8 +36,8 @@ concept equivalence_relation = relation<_Rp, _Tp, _Up>; | ... | @@ -36,8 +36,8 @@ concept equivalence_relation = relation<_Rp, _Tp, _Up>; |
| 36 | template <class _Rp, class _Tp, class _Up> | 36 | template <class _Rp, class _Tp, class _Up> |
| 37 | concept strict_weak_order = relation<_Rp, _Tp, _Up>; | 37 | concept strict_weak_order = relation<_Rp, _Tp, _Up>; |
| 38 | 38 | ||
| 39 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 40 | |||
| 41 | _LIBCPP_END_NAMESPACE_STD | 39 | _LIBCPP_END_NAMESPACE_STD |
| 42 | 40 | ||
| 41 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 42 | |||
| 43 | #endif // _LIBCPP___CONCEPTS_RELATION_H | 43 | #endif // _LIBCPP___CONCEPTS_RELATION_H |
lib/libcxx/include/__concepts/same_as.h+4-4| ... | @@ -16,10 +16,10 @@ | ... | @@ -16,10 +16,10 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | #if _LIBCPP_STD_VER >= 20 | 19 | #if _LIBCPP_STD_VER >= 20 |
| 22 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | // [concept.same] | 23 | // [concept.same] |
| 24 | 24 | ||
| 25 | template <class _Tp, class _Up> | 25 | template <class _Tp, class _Up> |
| ... | @@ -28,8 +28,8 @@ concept __same_as_impl = _IsSame<_Tp, _Up>::value; | ... | @@ -28,8 +28,8 @@ concept __same_as_impl = _IsSame<_Tp, _Up>::value; |
| 28 | template <class _Tp, class _Up> | 28 | template <class _Tp, class _Up> |
| 29 | concept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>; | 29 | concept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>; |
| 30 | 30 | ||
| 31 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 32 | |||
| 33 | _LIBCPP_END_NAMESPACE_STD | 31 | _LIBCPP_END_NAMESPACE_STD |
| 34 | 32 | ||
| 33 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 34 | |||
| 35 | #endif // _LIBCPP___CONCEPTS_SAME_AS_H | 35 | #endif // _LIBCPP___CONCEPTS_SAME_AS_H |
lib/libcxx/include/__concepts/semiregular.h+4-4| ... | @@ -17,17 +17,17 @@ | ... | @@ -17,17 +17,17 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | // [concept.object] | 24 | // [concept.object] |
| 25 | 25 | ||
| 26 | template <class _Tp> | 26 | template <class _Tp> |
| 27 | concept semiregular = copyable<_Tp> && default_initializable<_Tp>; | 27 | concept semiregular = copyable<_Tp> && default_initializable<_Tp>; |
| 28 | 28 | ||
| 29 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 30 | |||
| 31 | _LIBCPP_END_NAMESPACE_STD | 29 | _LIBCPP_END_NAMESPACE_STD |
| 32 | 30 | ||
| 31 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 32 | |||
| 33 | #endif // _LIBCPP___CONCEPTS_SEMIREGULAR_H | 33 | #endif // _LIBCPP___CONCEPTS_SEMIREGULAR_H |
lib/libcxx/include/__concepts/swappable.h+4-4| ... | @@ -30,10 +30,10 @@ | ... | @@ -30,10 +30,10 @@ |
| 30 | _LIBCPP_PUSH_MACROS | 30 | _LIBCPP_PUSH_MACROS |
| 31 | #include <__undef_macros> | 31 | #include <__undef_macros> |
| 32 | 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 34 | |||
| 35 | #if _LIBCPP_STD_VER >= 20 | 33 | #if _LIBCPP_STD_VER >= 20 |
| 36 | 34 | ||
| 35 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 36 | |||
| 37 | // [concept.swappable] | 37 | // [concept.swappable] |
| 38 | 38 | ||
| 39 | namespace ranges { | 39 | namespace ranges { |
| ... | @@ -113,10 +113,10 @@ concept swappable_with = common_reference_with<_Tp, _Up> && requires(_Tp&& __t, | ... | @@ -113,10 +113,10 @@ concept swappable_with = common_reference_with<_Tp, _Up> && requires(_Tp&& __t, |
| 113 | ranges::swap(std::forward<_Up>(__u), std::forward<_Tp>(__t)); | 113 | ranges::swap(std::forward<_Up>(__u), std::forward<_Tp>(__t)); |
| 114 | }; | 114 | }; |
| 115 | 115 | ||
| 116 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 117 | |||
| 118 | _LIBCPP_END_NAMESPACE_STD | 116 | _LIBCPP_END_NAMESPACE_STD |
| 119 | 117 | ||
| 118 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 119 | |||
| 120 | _LIBCPP_POP_MACROS | 120 | _LIBCPP_POP_MACROS |
| 121 | 121 | ||
| 122 | #endif // _LIBCPP___CONCEPTS_SWAPPABLE_H | 122 | #endif // _LIBCPP___CONCEPTS_SWAPPABLE_H |
lib/libcxx/include/__concepts/totally_ordered.h+4-4| ... | @@ -19,10 +19,10 @@ | ... | @@ -19,10 +19,10 @@ |
| 19 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 20 | 22 | #if _LIBCPP_STD_VER >= 20 |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | // [concept.totallyordered] | 26 | // [concept.totallyordered] |
| 27 | 27 | ||
| 28 | template <class _Tp, class _Up> | 28 | template <class _Tp, class _Up> |
| ... | @@ -52,8 +52,8 @@ concept totally_ordered_with = | ... | @@ -52,8 +52,8 @@ concept totally_ordered_with = |
| 52 | __partially_ordered_with<_Tp, _Up>; | 52 | __partially_ordered_with<_Tp, _Up>; |
| 53 | // clang-format on | 53 | // clang-format on |
| 54 | 54 | ||
| 55 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 56 | |||
| 57 | _LIBCPP_END_NAMESPACE_STD | 55 | _LIBCPP_END_NAMESPACE_STD |
| 58 | 56 | ||
| 57 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 58 | |||
| 59 | #endif // _LIBCPP___CONCEPTS_TOTALLY_ORDERED_H | 59 | #endif // _LIBCPP___CONCEPTS_TOTALLY_ORDERED_H |
lib/libcxx/include/__condition_variable/condition_variable.h+6-4| ... | @@ -31,10 +31,11 @@ | ... | @@ -31,10 +31,11 @@ |
| 31 | _LIBCPP_PUSH_MACROS | 31 | _LIBCPP_PUSH_MACROS |
| 32 | #include <__undef_macros> | 32 | #include <__undef_macros> |
| 33 | 33 | ||
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 35 | |||
| 36 | #if _LIBCPP_HAS_THREADS | 34 | #if _LIBCPP_HAS_THREADS |
| 37 | 35 | ||
| 36 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 37 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 38 | |||
| 38 | // enum class cv_status | 39 | // enum class cv_status |
| 39 | _LIBCPP_DECLARE_STRONG_ENUM(cv_status){no_timeout, timeout}; | 40 | _LIBCPP_DECLARE_STRONG_ENUM(cv_status){no_timeout, timeout}; |
| 40 | _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status) | 41 | _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status) |
| ... | @@ -223,10 +224,11 @@ inline void condition_variable::__do_timed_wait(unique_lock<mutex>& __lk, | ... | @@ -223,10 +224,11 @@ inline void condition_variable::__do_timed_wait(unique_lock<mutex>& __lk, |
| 223 | wait_for(__lk, __tp - _Clock::now()); | 224 | wait_for(__lk, __tp - _Clock::now()); |
| 224 | } | 225 | } |
| 225 | 226 | ||
| 226 | #endif // _LIBCPP_HAS_THREADS | 227 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS |
| 227 | |||
| 228 | _LIBCPP_END_NAMESPACE_STD | 228 | _LIBCPP_END_NAMESPACE_STD |
| 229 | 229 | ||
| 230 | #endif // _LIBCPP_HAS_THREADS | ||
| 231 | |||
| 230 | _LIBCPP_POP_MACROS | 232 | _LIBCPP_POP_MACROS |
| 231 | 233 | ||
| 232 | #endif // _LIBCPP___CONDITION_VARIABLE_CONDITION_VARIABLE_H | 234 | #endif // _LIBCPP___CONDITION_VARIABLE_CONDITION_VARIABLE_H |
lib/libcxx/include/__config+26-696| ... | @@ -25,61 +25,30 @@ | ... | @@ -25,61 +25,30 @@ |
| 25 | 25 | ||
| 26 | #ifdef __cplusplus | 26 | #ifdef __cplusplus |
| 27 | 27 | ||
| 28 | # include <__configuration/abi.h> | ||
| 29 | # include <__configuration/attributes.h> | ||
| 30 | # include <__configuration/availability.h> | ||
| 31 | # include <__configuration/compiler.h> | ||
| 32 | # include <__configuration/diagnostic_suppression.h> | ||
| 33 | # include <__configuration/experimental.h> | ||
| 34 | # include <__configuration/hardening.h> | ||
| 35 | # include <__configuration/language.h> | ||
| 36 | # include <__configuration/namespace.h> | ||
| 37 | # include <__configuration/platform.h> | ||
| 38 | # include <__configuration/pstl.h> | ||
| 39 | # include <__configuration/utility.h> | ||
| 40 | |||
| 28 | // The attributes supported by clang are documented at https://clang.llvm.org/docs/AttributeReference.html | 41 | // The attributes supported by clang are documented at https://clang.llvm.org/docs/AttributeReference.html |
| 29 | 42 | ||
| 30 | // _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM. | 43 | // _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM. |
| 31 | // Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is | 44 | // Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is |
| 32 | // defined to XXYYZZ. | 45 | // defined to XXYYZZ. |
| 33 | # define _LIBCPP_VERSION 220108 | 46 | # define _LIBCPP_VERSION 230100 |
| 34 | |||
| 35 | # define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y | ||
| 36 | # define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) | ||
| 37 | # define _LIBCPP_CONCAT3(X, Y, Z) _LIBCPP_CONCAT(X, _LIBCPP_CONCAT(Y, Z)) | ||
| 38 | |||
| 39 | # if __STDC_HOSTED__ == 0 | ||
| 40 | # define _LIBCPP_FREESTANDING | ||
| 41 | # endif | ||
| 42 | |||
| 43 | # define _LIBCPP_TOSTRING2(x) #x | ||
| 44 | # define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) | ||
| 45 | |||
| 46 | # ifndef __has_constexpr_builtin | ||
| 47 | # define __has_constexpr_builtin(x) 0 | ||
| 48 | # endif | ||
| 49 | |||
| 50 | // This checks wheter a Clang module is built | ||
| 51 | # ifndef __building_module | ||
| 52 | # define __building_module(...) 0 | ||
| 53 | # endif | ||
| 54 | |||
| 55 | // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by | ||
| 56 | // the compiler and '1' otherwise. | ||
| 57 | # ifndef __is_identifier | ||
| 58 | # define __is_identifier(__x) 1 | ||
| 59 | # endif | ||
| 60 | |||
| 61 | # ifndef __has_declspec_attribute | ||
| 62 | # define __has_declspec_attribute(__x) 0 | ||
| 63 | # endif | ||
| 64 | |||
| 65 | # define __has_keyword(__x) !(__is_identifier(__x)) | ||
| 66 | |||
| 67 | # ifndef __has_warning | ||
| 68 | # define __has_warning(...) 0 | ||
| 69 | # endif | ||
| 70 | |||
| 71 | # if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L | ||
| 72 | # error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11" | ||
| 73 | # endif | ||
| 74 | 47 | ||
| 75 | # if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME) | 48 | # if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME) |
| 76 | # define _LIBCPP_ABI_VCRUNTIME | 49 | # define _LIBCPP_ABI_VCRUNTIME |
| 77 | # endif | 50 | # endif |
| 78 | 51 | ||
| 79 | # if defined(__MVS__) | ||
| 80 | # include <features.h> // for __NATIVE_ASCII_F | ||
| 81 | # endif | ||
| 82 | |||
| 83 | # if defined(_WIN32) | 52 | # if defined(_WIN32) |
| 84 | # define _LIBCPP_WIN32API | 53 | # define _LIBCPP_WIN32API |
| 85 | # define _LIBCPP_SHORT_WCHAR 1 | 54 | # define _LIBCPP_SHORT_WCHAR 1 |
| ... | @@ -90,15 +59,9 @@ | ... | @@ -90,15 +59,9 @@ |
| 90 | # if defined(_MSC_VER) && !defined(__MINGW32__) | 59 | # if defined(_MSC_VER) && !defined(__MINGW32__) |
| 91 | # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library | 60 | # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library |
| 92 | # endif | 61 | # endif |
| 93 | # if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__)) | ||
| 94 | # define _LIBCPP_HAS_BITSCAN64 1 | ||
| 95 | # else | ||
| 96 | # define _LIBCPP_HAS_BITSCAN64 0 | ||
| 97 | # endif | ||
| 98 | # define _LIBCPP_HAS_OPEN_WITH_WCHAR 1 | 62 | # define _LIBCPP_HAS_OPEN_WITH_WCHAR 1 |
| 99 | # else | 63 | # else |
| 100 | # define _LIBCPP_HAS_OPEN_WITH_WCHAR 0 | 64 | # define _LIBCPP_HAS_OPEN_WITH_WCHAR 0 |
| 101 | # define _LIBCPP_HAS_BITSCAN64 0 | ||
| 102 | # endif // defined(_WIN32) | 65 | # endif // defined(_WIN32) |
| 103 | 66 | ||
| 104 | # if defined(_AIX) && !defined(__64BIT__) | 67 | # if defined(_AIX) && !defined(__64BIT__) |
| ... | @@ -184,259 +147,6 @@ typedef __char32_t char32_t; | ... | @@ -184,259 +147,6 @@ typedef __char32_t char32_t; |
| 184 | # define _LIBCPP_HAS_BLOCKS_RUNTIME 0 | 147 | # define _LIBCPP_HAS_BLOCKS_RUNTIME 0 |
| 185 | # endif | 148 | # endif |
| 186 | 149 | ||
| 187 | # define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) | ||
| 188 | |||
| 189 | # if defined(_LIBCPP_OBJECT_FORMAT_COFF) | ||
| 190 | |||
| 191 | # ifdef _DLL | ||
| 192 | # define _LIBCPP_CRT_FUNC __declspec(dllimport) | ||
| 193 | # else | ||
| 194 | # define _LIBCPP_CRT_FUNC | ||
| 195 | # endif | ||
| 196 | |||
| 197 | # if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY)) | ||
| 198 | # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS | ||
| 199 | # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS | ||
| 200 | # define _LIBCPP_OVERRIDABLE_FUNC_VIS | ||
| 201 | # define _LIBCPP_EXPORTED_FROM_ABI | ||
| 202 | # elif defined(_LIBCPP_BUILDING_LIBRARY) | ||
| 203 | # if defined(__MINGW32__) | ||
| 204 | # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllexport) | ||
| 205 | # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS | ||
| 206 | # else | ||
| 207 | # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS | ||
| 208 | # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __declspec(dllexport) | ||
| 209 | # endif | ||
| 210 | # define _LIBCPP_OVERRIDABLE_FUNC_VIS __declspec(dllexport) | ||
| 211 | # define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport) | ||
| 212 | # else | ||
| 213 | # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllimport) | ||
| 214 | # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS | ||
| 215 | # define _LIBCPP_OVERRIDABLE_FUNC_VIS | ||
| 216 | # define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport) | ||
| 217 | # endif | ||
| 218 | |||
| 219 | # define _LIBCPP_HIDDEN | ||
| 220 | # define _LIBCPP_TEMPLATE_DATA_VIS | ||
| 221 | # define _LIBCPP_NAMESPACE_VISIBILITY | ||
| 222 | |||
| 223 | # else | ||
| 224 | |||
| 225 | # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) | ||
| 226 | # define _LIBCPP_VISIBILITY(vis) __attribute__((__visibility__(vis))) | ||
| 227 | # else | ||
| 228 | # define _LIBCPP_VISIBILITY(vis) | ||
| 229 | # endif | ||
| 230 | |||
| 231 | # define _LIBCPP_HIDDEN _LIBCPP_VISIBILITY("hidden") | ||
| 232 | # define _LIBCPP_TEMPLATE_DATA_VIS _LIBCPP_VISIBILITY("default") | ||
| 233 | # define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default") | ||
| 234 | # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default") | ||
| 235 | # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS | ||
| 236 | |||
| 237 | // TODO: Make this a proper customization point or remove the option to override it. | ||
| 238 | # ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS | ||
| 239 | # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default") | ||
| 240 | # endif | ||
| 241 | |||
| 242 | # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) | ||
| 243 | # define _LIBCPP_NAMESPACE_VISIBILITY __attribute__((__type_visibility__("default"))) | ||
| 244 | # elif !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) | ||
| 245 | # define _LIBCPP_NAMESPACE_VISIBILITY __attribute__((__visibility__("default"))) | ||
| 246 | # else | ||
| 247 | # define _LIBCPP_NAMESPACE_VISIBILITY | ||
| 248 | # endif | ||
| 249 | |||
| 250 | # endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) | ||
| 251 | |||
| 252 | # if __has_attribute(exclude_from_explicit_instantiation) | ||
| 253 | # define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((__exclude_from_explicit_instantiation__)) | ||
| 254 | # else | ||
| 255 | // Try to approximate the effect of exclude_from_explicit_instantiation | ||
| 256 | // (which is that entities are not assumed to be provided by explicit | ||
| 257 | // template instantiations in the dylib) by always inlining those entities. | ||
| 258 | # define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE | ||
| 259 | # endif | ||
| 260 | |||
| 261 | # ifdef _LIBCPP_COMPILER_CLANG_BASED | ||
| 262 | # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") | ||
| 263 | # define _LIBCPP_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") | ||
| 264 | # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(clang diagnostic ignored str)) | ||
| 265 | # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) | ||
| 266 | # elif defined(_LIBCPP_COMPILER_GCC) | ||
| 267 | # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") | ||
| 268 | # define _LIBCPP_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") | ||
| 269 | # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) | ||
| 270 | # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(GCC diagnostic ignored str)) | ||
| 271 | # else | ||
| 272 | # define _LIBCPP_DIAGNOSTIC_PUSH | ||
| 273 | # define _LIBCPP_DIAGNOSTIC_POP | ||
| 274 | # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) | ||
| 275 | # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) | ||
| 276 | # endif | ||
| 277 | |||
| 278 | // Macros to enter and leave a state where deprecation warnings are suppressed. | ||
| 279 | # define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ | ||
| 280 | _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated") \ | ||
| 281 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") | ||
| 282 | # define _LIBCPP_SUPPRESS_DEPRECATED_POP _LIBCPP_DIAGNOSTIC_POP | ||
| 283 | |||
| 284 | # if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST | ||
| 285 | # define _LIBCPP_HARDENING_SIG f | ||
| 286 | # elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE | ||
| 287 | # define _LIBCPP_HARDENING_SIG s | ||
| 288 | # elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG | ||
| 289 | # define _LIBCPP_HARDENING_SIG d | ||
| 290 | # else | ||
| 291 | # define _LIBCPP_HARDENING_SIG n // "none" | ||
| 292 | # endif | ||
| 293 | |||
| 294 | # if _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_OBSERVE | ||
| 295 | # define _LIBCPP_ASSERTION_SEMANTIC_SIG o | ||
| 296 | # elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE | ||
| 297 | # define _LIBCPP_ASSERTION_SEMANTIC_SIG q | ||
| 298 | # elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_ENFORCE | ||
| 299 | # define _LIBCPP_ASSERTION_SEMANTIC_SIG e | ||
| 300 | # else | ||
| 301 | # define _LIBCPP_ASSERTION_SEMANTIC_SIG i // `ignore` | ||
| 302 | # endif | ||
| 303 | |||
| 304 | # if !_LIBCPP_HAS_EXCEPTIONS | ||
| 305 | # define _LIBCPP_EXCEPTIONS_SIG n | ||
| 306 | # else | ||
| 307 | # define _LIBCPP_EXCEPTIONS_SIG e | ||
| 308 | # endif | ||
| 309 | |||
| 310 | # define _LIBCPP_ODR_SIGNATURE \ | ||
| 311 | _LIBCPP_CONCAT( \ | ||
| 312 | _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_ASSERTION_SEMANTIC_SIG), _LIBCPP_EXCEPTIONS_SIG), \ | ||
| 313 | _LIBCPP_VERSION) | ||
| 314 | |||
| 315 | // This macro marks a symbol as being hidden from libc++'s ABI. This is achieved | ||
| 316 | // on two levels: | ||
| 317 | // 1. The symbol is given hidden visibility, which ensures that users won't start exporting | ||
| 318 | // symbols from their dynamic library by means of using the libc++ headers. This ensures | ||
| 319 | // that those symbols stay private to the dynamic library in which it is defined. | ||
| 320 | // | ||
| 321 | // 2. The symbol is given an ABI tag that encodes the ODR-relevant properties of the library. | ||
| 322 | // This ensures that no ODR violation can arise from mixing two TUs compiled with different | ||
| 323 | // versions or configurations of libc++ (such as exceptions vs no-exceptions). Indeed, if the | ||
| 324 | // program contains two definitions of a function, the ODR requires them to be token-by-token | ||
| 325 | // equivalent, and the linker is allowed to pick either definition and discard the other one. | ||
| 326 | // | ||
| 327 | // For example, if a program contains a copy of `vector::at()` compiled with exceptions enabled | ||
| 328 | // *and* a copy of `vector::at()` compiled with exceptions disabled (by means of having two TUs | ||
| 329 | // compiled with different settings), the two definitions are both visible by the linker and they | ||
| 330 | // have the same name, but they have a meaningfully different implementation (one throws an exception | ||
| 331 | // and the other aborts the program). This violates the ODR and makes the program ill-formed, and in | ||
| 332 | // practice what will happen is that the linker will pick one of the definitions at random and will | ||
| 333 | // discard the other one. This can quite clearly lead to incorrect program behavior. | ||
| 334 | // | ||
| 335 | // A similar reasoning holds for many other properties that are ODR-affecting. Essentially any | ||
| 336 | // property that causes the code of a function to differ from the code in another configuration | ||
| 337 | // can be considered ODR-affecting. In practice, we don't encode all such properties in the ABI | ||
| 338 | // tag, but we encode the ones that we think are most important: library version, exceptions, and | ||
| 339 | // hardening mode. | ||
| 340 | // | ||
| 341 | // Note that historically, solving this problem has been achieved in various ways, including | ||
| 342 | // force-inlining all functions or giving internal linkage to all functions. Both these previous | ||
| 343 | // solutions suffer from drawbacks that lead notably to code bloat. | ||
| 344 | // | ||
| 345 | // Note that we use _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION to ensure that we don't depend | ||
| 346 | // on _LIBCPP_HIDE_FROM_ABI methods of classes explicitly instantiated in the dynamic library. | ||
| 347 | // | ||
| 348 | // Also note that the _LIBCPP_HIDE_FROM_ABI_VIRTUAL macro should be used on virtual functions | ||
| 349 | // instead of _LIBCPP_HIDE_FROM_ABI. That macro does not use an ABI tag. Indeed, the mangled | ||
| 350 | // name of a virtual function is part of its ABI, since some architectures like arm64e can sign | ||
| 351 | // the virtual function pointer in the vtable based on the mangled name of the function. Since | ||
| 352 | // we use an ABI tag that changes with each released version, the mangled name of the virtual | ||
| 353 | // function would change, which is incorrect. Note that it doesn't make much sense to change | ||
| 354 | // the implementation of a virtual function in an ABI-incompatible way in the first place, | ||
| 355 | // since that would be an ABI break anyway. Hence, the lack of ABI tag should not be noticeable. | ||
| 356 | // | ||
| 357 | // The macro can be applied to record and enum types. When the tagged type is nested in | ||
| 358 | // a record this "parent" record needs to have the macro too. Another use case for applying | ||
| 359 | // this macro to records and unions is to apply an ABI tag to inline constexpr variables. | ||
| 360 | // This can be useful for inline variables that are implementation details which are expected | ||
| 361 | // to change in the future. | ||
| 362 | // | ||
| 363 | // TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing | ||
| 364 | // the length of symbols with an ABI tag. In practice, we should remove the escape hatch and | ||
| 365 | // use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70. | ||
| 366 | # ifndef _LIBCPP_NO_ABI_TAG | ||
| 367 | # define _LIBCPP_HIDE_FROM_ABI \ | ||
| 368 | _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION \ | ||
| 369 | __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE)))) | ||
| 370 | # else | ||
| 371 | # define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION | ||
| 372 | # endif | ||
| 373 | # define _LIBCPP_HIDE_FROM_ABI_VIRTUAL _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION | ||
| 374 | |||
| 375 | // Clang modules take a significant compile time hit when pushing and popping diagnostics. | ||
| 376 | // Since all the headers are marked as system headers unless _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER is defined, we can | ||
| 377 | // simply disable this pushing and popping when _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER isn't defined. | ||
| 378 | # ifdef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER | ||
| 379 | # define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS \ | ||
| 380 | _LIBCPP_DIAGNOSTIC_PUSH \ | ||
| 381 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++11-extensions") \ | ||
| 382 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \ | ||
| 383 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \ | ||
| 384 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \ | ||
| 385 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++23-extensions") \ | ||
| 386 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \ | ||
| 387 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \ | ||
| 388 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \ | ||
| 389 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++23-extensions") | ||
| 390 | # define _LIBCPP_POP_EXTENSION_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP | ||
| 391 | # else | ||
| 392 | # define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS | ||
| 393 | # define _LIBCPP_POP_EXTENSION_DIAGNOSTICS | ||
| 394 | # endif | ||
| 395 | |||
| 396 | // clang-format off | ||
| 397 | |||
| 398 | // The unversioned namespace is used when we want to be ABI compatible with other standard libraries in some way. There | ||
| 399 | // are two main categories where that's the case: | ||
| 400 | // - Historically, we have made exception types ABI compatible with libstdc++ to allow throwing them between libstdc++ | ||
| 401 | // and libc++. This is not used anymore for new exception types, since there is no use-case for it anymore. | ||
| 402 | // - Types and functions which are used by the compiler are in the unversioned namespace, since the compiler has to know | ||
| 403 | // their mangling without the appropriate declaration in some cases. | ||
| 404 | // If it's not clear whether using the unversioned namespace is the correct thing to do, it's not. The versioned | ||
| 405 | // namespace (_LIBCPP_BEGIN_NAMESPACE_STD) should almost always be used. | ||
| 406 | # define _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD \ | ||
| 407 | _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS namespace _LIBCPP_NAMESPACE_VISIBILITY std { | ||
| 408 | |||
| 409 | # define _LIBCPP_END_UNVERSIONED_NAMESPACE_STD } _LIBCPP_POP_EXTENSION_DIAGNOSTICS | ||
| 410 | |||
| 411 | # define _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD inline namespace _LIBCPP_ABI_NAMESPACE { | ||
| 412 | # define _LIBCPP_END_NAMESPACE_STD } _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | ||
| 413 | |||
| 414 | // TODO: This should really be in the versioned namespace | ||
| 415 | #define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD namespace experimental { | ||
| 416 | #define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | ||
| 417 | |||
| 418 | #define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 { | ||
| 419 | #define _LIBCPP_END_NAMESPACE_LFTS } _LIBCPP_END_NAMESPACE_EXPERIMENTAL | ||
| 420 | |||
| 421 | #define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 { | ||
| 422 | #define _LIBCPP_END_NAMESPACE_LFTS_V2 } _LIBCPP_END_NAMESPACE_EXPERIMENTAL | ||
| 423 | |||
| 424 | #ifdef _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE | ||
| 425 | # define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD namespace filesystem { | ||
| 426 | # define _LIBCPP_END_NAMESPACE_FILESYSTEM } _LIBCPP_END_NAMESPACE_STD | ||
| 427 | #else | ||
| 428 | # define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD \ | ||
| 429 | inline namespace __fs { namespace filesystem { | ||
| 430 | |||
| 431 | # define _LIBCPP_END_NAMESPACE_FILESYSTEM }} _LIBCPP_END_NAMESPACE_STD | ||
| 432 | #endif | ||
| 433 | |||
| 434 | // clang-format on | ||
| 435 | |||
| 436 | # if __has_attribute(__enable_if__) | ||
| 437 | # define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, ""))) | ||
| 438 | # endif | ||
| 439 | |||
| 440 | # if !defined(__SIZEOF_INT128__) || defined(_MSC_VER) | 150 | # if !defined(__SIZEOF_INT128__) || defined(_MSC_VER) |
| 441 | # define _LIBCPP_HAS_INT128 0 | 151 | # define _LIBCPP_HAS_INT128 0 |
| 442 | # else | 152 | # else |
| ... | @@ -488,34 +198,14 @@ typedef __char32_t char32_t; | ... | @@ -488,34 +198,14 @@ typedef __char32_t char32_t; |
| 488 | # endif | 198 | # endif |
| 489 | # endif | 199 | # endif |
| 490 | 200 | ||
| 491 | # if defined(__APPLE__) || defined(__FreeBSD__) | 201 | # if !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606) |
| 492 | # define _LIBCPP_WCTYPE_IS_MASK | 202 | # define _LIBCPP_HAS_ALIGNED_ALLOCATION 0 |
| 493 | # endif | ||
| 494 | |||
| 495 | # if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t) | ||
| 496 | # define _LIBCPP_HAS_CHAR8_T 0 | ||
| 497 | # else | 203 | # else |
| 498 | # define _LIBCPP_HAS_CHAR8_T 1 | 204 | # define _LIBCPP_HAS_ALIGNED_ALLOCATION 1 |
| 499 | # endif | 205 | # endif |
| 500 | 206 | ||
| 501 | // Deprecation macros. | 207 | # if defined(__APPLE__) || defined(__FreeBSD__) |
| 502 | // | 208 | # define _LIBCPP_WCTYPE_IS_MASK |
| 503 | // Deprecations warnings are always enabled, except when users explicitly opt-out | ||
| 504 | // by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS. | ||
| 505 | # if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) | ||
| 506 | # if __has_attribute(__deprecated__) | ||
| 507 | # define _LIBCPP_DEPRECATED __attribute__((__deprecated__)) | ||
| 508 | # define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m))) | ||
| 509 | # elif _LIBCPP_STD_VER >= 14 | ||
| 510 | # define _LIBCPP_DEPRECATED [[deprecated]] | ||
| 511 | # define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]] | ||
| 512 | # else | ||
| 513 | # define _LIBCPP_DEPRECATED | ||
| 514 | # define _LIBCPP_DEPRECATED_(m) | ||
| 515 | # endif | ||
| 516 | # else | ||
| 517 | # define _LIBCPP_DEPRECATED | ||
| 518 | # define _LIBCPP_DEPRECATED_(m) | ||
| 519 | # endif | 209 | # endif |
| 520 | 210 | ||
| 521 | // FIXME: using `#warning` causes diagnostics from system headers which include deprecated headers. This can only be | 211 | // FIXME: using `#warning` causes diagnostics from system headers which include deprecated headers. This can only be |
| ... | @@ -527,102 +217,13 @@ typedef __char32_t char32_t; | ... | @@ -527,102 +217,13 @@ typedef __char32_t char32_t; |
| 527 | # define _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS 0 | 217 | # define _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS 0 |
| 528 | # endif | 218 | # endif |
| 529 | 219 | ||
| 530 | # if !defined(_LIBCPP_CXX03_LANG) | ||
| 531 | # define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED | ||
| 532 | # else | ||
| 533 | # define _LIBCPP_DEPRECATED_IN_CXX11 | ||
| 534 | # endif | ||
| 535 | |||
| 536 | # if _LIBCPP_STD_VER >= 14 | ||
| 537 | # define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED | ||
| 538 | # else | ||
| 539 | # define _LIBCPP_DEPRECATED_IN_CXX14 | ||
| 540 | # endif | ||
| 541 | |||
| 542 | # if _LIBCPP_STD_VER >= 17 | ||
| 543 | # define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED | ||
| 544 | # else | ||
| 545 | # define _LIBCPP_DEPRECATED_IN_CXX17 | ||
| 546 | # endif | ||
| 547 | |||
| 548 | # if _LIBCPP_STD_VER >= 20 | ||
| 549 | # define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED | ||
| 550 | # else | ||
| 551 | # define _LIBCPP_DEPRECATED_IN_CXX20 | ||
| 552 | # endif | ||
| 553 | |||
| 554 | # if _LIBCPP_STD_VER >= 23 | ||
| 555 | # define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED | ||
| 556 | # else | ||
| 557 | # define _LIBCPP_DEPRECATED_IN_CXX23 | ||
| 558 | # endif | ||
| 559 | |||
| 560 | # if _LIBCPP_STD_VER >= 26 | ||
| 561 | # define _LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_DEPRECATED | ||
| 562 | # define _LIBCPP_DEPRECATED_IN_CXX26_(m) _LIBCPP_DEPRECATED_(m) | ||
| 563 | # else | ||
| 564 | # define _LIBCPP_DEPRECATED_IN_CXX26 | ||
| 565 | # define _LIBCPP_DEPRECATED_IN_CXX26_(m) | ||
| 566 | # endif | ||
| 567 | |||
| 568 | # if _LIBCPP_HAS_CHAR8_T | ||
| 569 | # define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED | ||
| 570 | # else | ||
| 571 | # define _LIBCPP_DEPRECATED_WITH_CHAR8_T | ||
| 572 | # endif | ||
| 573 | |||
| 574 | # if _LIBCPP_STD_VER <= 11 | ||
| 575 | # define _LIBCPP_EXPLICIT_SINCE_CXX14 | ||
| 576 | # else | ||
| 577 | # define _LIBCPP_EXPLICIT_SINCE_CXX14 explicit | ||
| 578 | # endif | ||
| 579 | |||
| 580 | # if _LIBCPP_STD_VER >= 23 | ||
| 581 | # define _LIBCPP_EXPLICIT_SINCE_CXX23 explicit | ||
| 582 | # else | ||
| 583 | # define _LIBCPP_EXPLICIT_SINCE_CXX23 | ||
| 584 | # endif | ||
| 585 | |||
| 586 | # if _LIBCPP_STD_VER >= 14 | ||
| 587 | # define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr | ||
| 588 | # else | ||
| 589 | # define _LIBCPP_CONSTEXPR_SINCE_CXX14 | ||
| 590 | # endif | ||
| 591 | |||
| 592 | # if _LIBCPP_STD_VER >= 17 | ||
| 593 | # define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr | ||
| 594 | # else | ||
| 595 | # define _LIBCPP_CONSTEXPR_SINCE_CXX17 | ||
| 596 | # endif | ||
| 597 | |||
| 598 | # if _LIBCPP_STD_VER >= 20 | ||
| 599 | # define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr | ||
| 600 | # else | ||
| 601 | # define _LIBCPP_CONSTEXPR_SINCE_CXX20 | ||
| 602 | # endif | ||
| 603 | |||
| 604 | # if _LIBCPP_STD_VER >= 23 | ||
| 605 | # define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr | ||
| 606 | # else | ||
| 607 | # define _LIBCPP_CONSTEXPR_SINCE_CXX23 | ||
| 608 | # endif | ||
| 609 | |||
| 610 | # if _LIBCPP_STD_VER >= 26 | ||
| 611 | # define _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr | ||
| 612 | # else | ||
| 613 | # define _LIBCPP_CONSTEXPR_SINCE_CXX26 | ||
| 614 | # endif | ||
| 615 | |||
| 616 | # ifndef _LIBCPP_WEAK | ||
| 617 | # define _LIBCPP_WEAK __attribute__((__weak__)) | ||
| 618 | # endif | ||
| 619 | |||
| 620 | // Thread API | 220 | // Thread API |
| 621 | // clang-format off | 221 | // clang-format off |
| 622 | # if _LIBCPP_HAS_THREADS && \ | 222 | # if _LIBCPP_HAS_THREADS && \ |
| 623 | !_LIBCPP_HAS_THREAD_API_PTHREAD && \ | 223 | !_LIBCPP_HAS_THREAD_API_PTHREAD && \ |
| 624 | !_LIBCPP_HAS_THREAD_API_WIN32 && \ | 224 | !_LIBCPP_HAS_THREAD_API_WIN32 && \ |
| 625 | !_LIBCPP_HAS_THREAD_API_EXTERNAL | 225 | !_LIBCPP_HAS_THREAD_API_EXTERNAL && \ |
| 226 | !_LIBCPP_HAS_THREAD_API_C11 | ||
| 626 | 227 | ||
| 627 | # if defined(__FreeBSD__) || \ | 228 | # if defined(__FreeBSD__) || \ |
| 628 | defined(__wasi__) || \ | 229 | defined(__wasi__) || \ |
| ... | @@ -666,6 +267,10 @@ typedef __char32_t char32_t; | ... | @@ -666,6 +267,10 @@ typedef __char32_t char32_t; |
| 666 | # error _LIBCPP_HAS_THREAD_API_EXTERNAL may only be true when _LIBCPP_HAS_THREADS is true. | 267 | # error _LIBCPP_HAS_THREAD_API_EXTERNAL may only be true when _LIBCPP_HAS_THREADS is true. |
| 667 | # endif | 268 | # endif |
| 668 | 269 | ||
| 270 | # if !_LIBCPP_HAS_THREADS && _LIBCPP_HAS_THREAD_API_C11 | ||
| 271 | # error _LIBCPP_HAS_THREAD_API_C11 may only be true when _LIBCPP_HAS_THREADS is true. | ||
| 272 | # endif | ||
| 273 | |||
| 669 | # if !_LIBCPP_HAS_MONOTONIC_CLOCK && _LIBCPP_HAS_THREADS | 274 | # if !_LIBCPP_HAS_MONOTONIC_CLOCK && _LIBCPP_HAS_THREADS |
| 670 | # error _LIBCPP_HAS_MONOTONIC_CLOCK may only be false when _LIBCPP_HAS_THREADS is false. | 275 | # error _LIBCPP_HAS_MONOTONIC_CLOCK may only be false when _LIBCPP_HAS_THREADS is false. |
| 671 | # endif | 276 | # endif |
| ... | @@ -709,60 +314,10 @@ typedef __char32_t char32_t; | ... | @@ -709,60 +314,10 @@ typedef __char32_t char32_t; |
| 709 | # endif | 314 | # endif |
| 710 | 315 | ||
| 711 | # if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \ | 316 | # if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \ |
| 712 | _LIBCPP_HAS_MUSL_LIBC || defined(__OpenBSD__) || defined(__LLVM_LIBC__) | 317 | _LIBCPP_HAS_MUSL_LIBC || defined(__OpenBSD__) || _LIBCPP_LIBC_LLVM_LIBC |
| 713 | # define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE | 318 | # define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE |
| 714 | # endif | 319 | # endif |
| 715 | 320 | ||
| 716 | # if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) | ||
| 717 | # define _LIBCPP_HAS_C_ATOMIC_IMP 1 | ||
| 718 | # define _LIBCPP_HAS_GCC_ATOMIC_IMP 0 | ||
| 719 | # define _LIBCPP_HAS_EXTERNAL_ATOMIC_IMP 0 | ||
| 720 | # elif defined(_LIBCPP_COMPILER_GCC) | ||
| 721 | # define _LIBCPP_HAS_C_ATOMIC_IMP 0 | ||
| 722 | # define _LIBCPP_HAS_GCC_ATOMIC_IMP 1 | ||
| 723 | # define _LIBCPP_HAS_EXTERNAL_ATOMIC_IMP 0 | ||
| 724 | # endif | ||
| 725 | |||
| 726 | # if !_LIBCPP_HAS_C_ATOMIC_IMP && !_LIBCPP_HAS_GCC_ATOMIC_IMP && !_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP | ||
| 727 | # define _LIBCPP_HAS_ATOMIC_HEADER 0 | ||
| 728 | # else | ||
| 729 | # define _LIBCPP_HAS_ATOMIC_HEADER 1 | ||
| 730 | # ifndef _LIBCPP_ATOMIC_FLAG_TYPE | ||
| 731 | # define _LIBCPP_ATOMIC_FLAG_TYPE bool | ||
| 732 | # endif | ||
| 733 | # endif | ||
| 734 | |||
| 735 | # if __has_cpp_attribute(_Clang::__no_thread_safety_analysis__) | ||
| 736 | # define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS [[_Clang::__no_thread_safety_analysis__]] | ||
| 737 | # else | ||
| 738 | # define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS | ||
| 739 | # endif | ||
| 740 | |||
| 741 | # if _LIBCPP_STD_VER >= 20 | ||
| 742 | # define _LIBCPP_CONSTINIT constinit | ||
| 743 | # elif __has_attribute(__require_constant_initialization__) | ||
| 744 | # define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__)) | ||
| 745 | # else | ||
| 746 | # define _LIBCPP_CONSTINIT | ||
| 747 | # endif | ||
| 748 | |||
| 749 | # if defined(__CUDACC__) || defined(__CUDA_ARCH__) || defined(__CUDA_LIBDEVICE__) | ||
| 750 | // The CUDA SDK contains an unfortunate definition for the __noinline__ macro, | ||
| 751 | // which breaks the regular __attribute__((__noinline__)) syntax. Therefore, | ||
| 752 | // when compiling for CUDA we use the non-underscored version of the noinline | ||
| 753 | // attribute. | ||
| 754 | // | ||
| 755 | // This is a temporary workaround and we still expect the CUDA SDK team to solve | ||
| 756 | // this issue properly in the SDK headers. | ||
| 757 | // | ||
| 758 | // See https://github.com/llvm/llvm-project/pull/73838 for more details. | ||
| 759 | # define _LIBCPP_NOINLINE __attribute__((noinline)) | ||
| 760 | # elif __has_attribute(__noinline__) | ||
| 761 | # define _LIBCPP_NOINLINE __attribute__((__noinline__)) | ||
| 762 | # else | ||
| 763 | # define _LIBCPP_NOINLINE | ||
| 764 | # endif | ||
| 765 | |||
| 766 | // We often repeat things just for handling wide characters in the library. | 321 | // We often repeat things just for handling wide characters in the library. |
| 767 | // When wide characters are disabled, it can be useful to have a quick way of | 322 | // When wide characters are disabled, it can be useful to have a quick way of |
| 768 | // disabling it without having to resort to #if-#endif, which has a larger | 323 | // disabling it without having to resort to #if-#endif, which has a larger |
| ... | @@ -788,27 +343,6 @@ typedef __char32_t char32_t; | ... | @@ -788,27 +343,6 @@ typedef __char32_t char32_t; |
| 788 | # endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) | 343 | # endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) |
| 789 | # endif // _LIBCPP_NO_AUTO_LINK | 344 | # endif // _LIBCPP_NO_AUTO_LINK |
| 790 | 345 | ||
| 791 | // Configures the fopen close-on-exec mode character, if any. This string will | ||
| 792 | // be appended to any mode string used by fstream for fopen/fdopen. | ||
| 793 | // | ||
| 794 | // Not all platforms support this, but it helps avoid fd-leaks on platforms that | ||
| 795 | // do. | ||
| 796 | # if defined(__BIONIC__) | ||
| 797 | # define _LIBCPP_FOPEN_CLOEXEC_MODE "e" | ||
| 798 | # else | ||
| 799 | # define _LIBCPP_FOPEN_CLOEXEC_MODE | ||
| 800 | # endif | ||
| 801 | |||
| 802 | # if __has_cpp_attribute(msvc::no_unique_address) | ||
| 803 | // MSVC implements [[no_unique_address]] as a silent no-op currently. | ||
| 804 | // (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.) | ||
| 805 | // However, MSVC implements [[msvc::no_unique_address]] which does what | ||
| 806 | // [[no_unique_address]] is supposed to do, in general. | ||
| 807 | # define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] | ||
| 808 | # else | ||
| 809 | # define _LIBCPP_NO_UNIQUE_ADDRESS [[__no_unique_address__]] | ||
| 810 | # endif | ||
| 811 | |||
| 812 | // c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these | 346 | // c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these |
| 813 | // functions is gradually being added to existing C libraries. The conditions | 347 | // functions is gradually being added to existing C libraries. The conditions |
| 814 | // below check for known C library versions and conditions under which these | 348 | // below check for known C library versions and conditions under which these |
| ... | @@ -844,210 +378,6 @@ typedef __char32_t char32_t; | ... | @@ -844,210 +378,6 @@ typedef __char32_t char32_t; |
| 844 | # define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") | 378 | # define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") |
| 845 | # endif | 379 | # endif |
| 846 | 380 | ||
| 847 | # if defined(__OBJC__) && defined(_LIBCPP_APPLE_CLANG_VER) | ||
| 848 | # define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS | ||
| 849 | # endif | ||
| 850 | |||
| 851 | # define _PSTL_PRAGMA(x) _Pragma(#x) | ||
| 852 | |||
| 853 | // Enable SIMD for compilers that support OpenMP 4.0 | ||
| 854 | # if (defined(_OPENMP) && _OPENMP >= 201307) | ||
| 855 | |||
| 856 | # define _PSTL_UDR_PRESENT | ||
| 857 | # define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd) | ||
| 858 | # define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd) | ||
| 859 | # define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM)) | ||
| 860 | # define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM)) | ||
| 861 | # define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM)) | ||
| 862 | # define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM)) | ||
| 863 | |||
| 864 | // Declaration of reduction functor, where | ||
| 865 | // NAME - the name of the functor | ||
| 866 | // OP - type of the callable object with the reduction operation | ||
| 867 | // omp_in - refers to the local partial result | ||
| 868 | // omp_out - refers to the final value of the combiner operator | ||
| 869 | // omp_priv - refers to the private copy of the initial value | ||
| 870 | // omp_orig - refers to the original variable to be reduced | ||
| 871 | # define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \ | ||
| 872 | _PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig)) | ||
| 873 | |||
| 874 | # elif defined(_LIBCPP_COMPILER_CLANG_BASED) | ||
| 875 | |||
| 876 | # define _PSTL_PRAGMA_SIMD _Pragma("clang loop vectorize(enable) interleave(enable)") | ||
| 877 | # define _PSTL_PRAGMA_DECLARE_SIMD | ||
| 878 | # define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _Pragma("clang loop vectorize(enable) interleave(enable)") | ||
| 879 | # define _PSTL_PRAGMA_SIMD_SCAN(PRM) _Pragma("clang loop vectorize(enable) interleave(enable)") | ||
| 880 | # define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) | ||
| 881 | # define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) | ||
| 882 | # define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) | ||
| 883 | |||
| 884 | # else // (defined(_OPENMP) && _OPENMP >= 201307) | ||
| 885 | |||
| 886 | # define _PSTL_PRAGMA_SIMD | ||
| 887 | # define _PSTL_PRAGMA_DECLARE_SIMD | ||
| 888 | # define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) | ||
| 889 | # define _PSTL_PRAGMA_SIMD_SCAN(PRM) | ||
| 890 | # define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) | ||
| 891 | # define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) | ||
| 892 | # define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) | ||
| 893 | |||
| 894 | # endif // (defined(_OPENMP) && _OPENMP >= 201307) | ||
| 895 | |||
| 896 | # define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED | ||
| 897 | |||
| 898 | // Optional attributes - these are useful for a better QoI, but not required to be available | ||
| 899 | |||
| 900 | # define _LIBCPP_NOALIAS __attribute__((__malloc__)) | ||
| 901 | # define _LIBCPP_NODEBUG [[__gnu__::__nodebug__]] | ||
| 902 | # define _LIBCPP_NO_SANITIZE(...) __attribute__((__no_sanitize__(__VA_ARGS__))) | ||
| 903 | # define _LIBCPP_INIT_PRIORITY_MAX __attribute__((__init_priority__(100))) | ||
| 904 | # define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \ | ||
| 905 | __attribute__((__format__(archetype, format_string_index, first_format_arg_index))) | ||
| 906 | # define _LIBCPP_PACKED __attribute__((__packed__)) | ||
| 907 | |||
| 908 | # if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) | ||
| 909 | # define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) | ||
| 910 | # else | ||
| 911 | # define _LIBCPP_NO_CFI | ||
| 912 | # endif | ||
| 913 | |||
| 914 | # if __has_attribute(__using_if_exists__) | ||
| 915 | # define _LIBCPP_USING_IF_EXISTS __attribute__((__using_if_exists__)) | ||
| 916 | # else | ||
| 917 | # define _LIBCPP_USING_IF_EXISTS | ||
| 918 | # endif | ||
| 919 | |||
| 920 | # if __has_cpp_attribute(_Clang::__no_destroy__) | ||
| 921 | # define _LIBCPP_NO_DESTROY [[_Clang::__no_destroy__]] | ||
| 922 | # else | ||
| 923 | # define _LIBCPP_NO_DESTROY | ||
| 924 | # endif | ||
| 925 | |||
| 926 | # if __has_attribute(__diagnose_if__) | ||
| 927 | # define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning"))) | ||
| 928 | # else | ||
| 929 | # define _LIBCPP_DIAGNOSE_WARNING(...) | ||
| 930 | # endif | ||
| 931 | |||
| 932 | # if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_APPLE_CLANG_VER) && \ | ||
| 933 | (!defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 2001) | ||
| 934 | # define _LIBCPP_DIAGNOSE_IF(...) __attribute__((__diagnose_if__(__VA_ARGS__))) | ||
| 935 | # else | ||
| 936 | # define _LIBCPP_DIAGNOSE_IF(...) | ||
| 937 | # endif | ||
| 938 | |||
| 939 | # define _LIBCPP_DIAGNOSE_NULLPTR_IF(condition, condition_description) \ | ||
| 940 | _LIBCPP_DIAGNOSE_IF( \ | ||
| 941 | condition, \ | ||
| 942 | "null passed to callee that requires a non-null argument" condition_description, \ | ||
| 943 | "warning", \ | ||
| 944 | "nonnull") | ||
| 945 | |||
| 946 | # if __has_cpp_attribute(_Clang::__lifetimebound__) | ||
| 947 | # define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]] | ||
| 948 | # else | ||
| 949 | # define _LIBCPP_LIFETIMEBOUND | ||
| 950 | # endif | ||
| 951 | |||
| 952 | // This is to work around https://llvm.org/PR156809 | ||
| 953 | # ifndef _LIBCPP_CXX03_LANG | ||
| 954 | # define _LIBCPP_CTOR_LIFETIMEBOUND _LIBCPP_LIFETIMEBOUND | ||
| 955 | # else | ||
| 956 | # define _LIBCPP_CTOR_LIFETIMEBOUND | ||
| 957 | # endif | ||
| 958 | |||
| 959 | # if __has_cpp_attribute(_Clang::__noescape__) | ||
| 960 | # define _LIBCPP_NOESCAPE [[_Clang::__noescape__]] | ||
| 961 | # else | ||
| 962 | # define _LIBCPP_NOESCAPE | ||
| 963 | # endif | ||
| 964 | |||
| 965 | # if __has_cpp_attribute(_Clang::__no_specializations__) | ||
| 966 | # define _LIBCPP_NO_SPECIALIZATIONS \ | ||
| 967 | [[_Clang::__no_specializations__("Users are not allowed to specialize this standard library entity")]] | ||
| 968 | # else | ||
| 969 | # define _LIBCPP_NO_SPECIALIZATIONS | ||
| 970 | # endif | ||
| 971 | |||
| 972 | # if __has_cpp_attribute(_Clang::__preferred_name__) | ||
| 973 | # define _LIBCPP_PREFERRED_NAME(x) [[_Clang::__preferred_name__(x)]] | ||
| 974 | # else | ||
| 975 | # define _LIBCPP_PREFERRED_NAME(x) | ||
| 976 | # endif | ||
| 977 | |||
| 978 | # if __has_cpp_attribute(_Clang::__scoped_lockable__) | ||
| 979 | # define _LIBCPP_SCOPED_LOCKABLE [[_Clang::__scoped_lockable__]] | ||
| 980 | # else | ||
| 981 | # define _LIBCPP_SCOPED_LOCKABLE | ||
| 982 | # endif | ||
| 983 | |||
| 984 | # if __has_cpp_attribute(_Clang::__capability__) | ||
| 985 | # define _LIBCPP_CAPABILITY(...) [[_Clang::__capability__(__VA_ARGS__)]] | ||
| 986 | # else | ||
| 987 | # define _LIBCPP_CAPABILITY(...) | ||
| 988 | # endif | ||
| 989 | |||
| 990 | # if __has_attribute(__acquire_capability__) | ||
| 991 | # define _LIBCPP_ACQUIRE_CAPABILITY(...) __attribute__((__acquire_capability__(__VA_ARGS__))) | ||
| 992 | # else | ||
| 993 | # define _LIBCPP_ACQUIRE_CAPABILITY(...) | ||
| 994 | # endif | ||
| 995 | |||
| 996 | # if __has_cpp_attribute(_Clang::__try_acquire_capability__) | ||
| 997 | # define _LIBCPP_TRY_ACQUIRE_CAPABILITY(...) [[_Clang::__try_acquire_capability__(__VA_ARGS__)]] | ||
| 998 | # else | ||
| 999 | # define _LIBCPP_TRY_ACQUIRE_CAPABILITY(...) | ||
| 1000 | # endif | ||
| 1001 | |||
| 1002 | # if __has_cpp_attribute(_Clang::__acquire_shared_capability__) | ||
| 1003 | # define _LIBCPP_ACQUIRE_SHARED_CAPABILITY [[_Clang::__acquire_shared_capability__]] | ||
| 1004 | # else | ||
| 1005 | # define _LIBCPP_ACQUIRE_SHARED_CAPABILITY | ||
| 1006 | # endif | ||
| 1007 | |||
| 1008 | # if __has_cpp_attribute(_Clang::__try_acquire_shared_capability__) | ||
| 1009 | # define _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(...) [[_Clang::__try_acquire_shared_capability__(__VA_ARGS__)]] | ||
| 1010 | # else | ||
| 1011 | # define _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(...) | ||
| 1012 | # endif | ||
| 1013 | |||
| 1014 | # if __has_cpp_attribute(_Clang::__release_capability__) | ||
| 1015 | # define _LIBCPP_RELEASE_CAPABILITY [[_Clang::__release_capability__]] | ||
| 1016 | # else | ||
| 1017 | # define _LIBCPP_RELEASE_CAPABILITY | ||
| 1018 | # endif | ||
| 1019 | |||
| 1020 | # if __has_cpp_attribute(_Clang::__release_shared_capability__) | ||
| 1021 | # define _LIBCPP_RELEASE_SHARED_CAPABILITY [[_Clang::__release_shared_capability__]] | ||
| 1022 | # else | ||
| 1023 | # define _LIBCPP_RELEASE_SHARED_CAPABILITY | ||
| 1024 | # endif | ||
| 1025 | |||
| 1026 | # if __has_attribute(__requires_capability__) | ||
| 1027 | # define _LIBCPP_REQUIRES_CAPABILITY(...) __attribute__((__requires_capability__(__VA_ARGS__))) | ||
| 1028 | # else | ||
| 1029 | # define _LIBCPP_REQUIRES_CAPABILITY(...) | ||
| 1030 | # endif | ||
| 1031 | |||
| 1032 | # if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases) | ||
| 1033 | # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) | ||
| 1034 | # else | ||
| 1035 | # define _LIBCPP_DECLSPEC_EMPTY_BASES | ||
| 1036 | # endif | ||
| 1037 | |||
| 1038 | // Allow for build-time disabling of unsigned integer sanitization | ||
| 1039 | # if __has_attribute(no_sanitize) && !defined(_LIBCPP_COMPILER_GCC) | ||
| 1040 | # define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) | ||
| 1041 | # else | ||
| 1042 | # define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK | ||
| 1043 | # endif | ||
| 1044 | |||
| 1045 | # if __has_feature(nullability) | ||
| 1046 | # define _LIBCPP_DIAGNOSE_NULLPTR _Nonnull | ||
| 1047 | # else | ||
| 1048 | # define _LIBCPP_DIAGNOSE_NULLPTR | ||
| 1049 | # endif | ||
| 1050 | |||
| 1051 | #endif // __cplusplus | 381 | #endif // __cplusplus |
| 1052 | 382 | ||
| 1053 | #endif // _LIBCPP___CONFIG | 383 | #endif // _LIBCPP___CONFIG |
lib/libcxx/include/__configuration/abi.h+4-16| ... | @@ -52,12 +52,6 @@ | ... | @@ -52,12 +52,6 @@ |
| 52 | #if _LIBCPP_ABI_VERSION >= 2 | 52 | #if _LIBCPP_ABI_VERSION >= 2 |
| 53 | // TODO: Move the description of the remaining ABI flags to ABIGuarantees.rst or remove them. | 53 | // TODO: Move the description of the remaining ABI flags to ABIGuarantees.rst or remove them. |
| 54 | 54 | ||
| 55 | // Override the default return value of exception::what() for bad_function_call::what() | ||
| 56 | // with a string that is specific to bad_function_call (see http://wg21.link/LWG2233). | ||
| 57 | // This is an ABI break on platforms that sign and authenticate vtable function pointers | ||
| 58 | // because it changes the mangling of the virtual function located in the vtable, which | ||
| 59 | // changes how it gets signed. | ||
| 60 | # define _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE | ||
| 61 | // According to the Standard, `bitset::operator[] const` returns bool | 55 | // According to the Standard, `bitset::operator[] const` returns bool |
| 62 | # define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL | 56 | # define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL |
| 63 | 57 | ||
| ... | @@ -77,11 +71,14 @@ | ... | @@ -77,11 +71,14 @@ |
| 77 | # define _LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER | 71 | # define _LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER |
| 78 | # define _LIBCPP_ABI_OPTIMIZED_FUNCTION | 72 | # define _LIBCPP_ABI_OPTIMIZED_FUNCTION |
| 79 | # define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO | 73 | # define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO |
| 74 | # define _LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED | ||
| 80 | # define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION | 75 | # define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION |
| 81 | # define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY | 76 | # define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY |
| 82 | # define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW | 77 | # define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW |
| 83 | # define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION | 78 | # define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION |
| 84 | # define _LIBCPP_ABI_TRIVIALLY_COPYABLE_BIT_ITERATOR | 79 | # define _LIBCPP_ABI_TRIVIALLY_COPYABLE_BIT_ITERATOR |
| 80 | # define _LIBCPP_ABI_USE_SMALL_DEQUE_BLOCK_SIZE | ||
| 81 | # define _LIBCPP_ABI_VECTORIZED_MERSENNE_TWISTER_ENGINE | ||
| 85 | 82 | ||
| 86 | #elif _LIBCPP_ABI_VERSION == 1 | 83 | #elif _LIBCPP_ABI_VERSION == 1 |
| 87 | // Feature macros for disabling pre ABI v1 features. All of these options | 84 | // Feature macros for disabling pre ABI v1 features. All of these options |
| ... | @@ -91,15 +88,6 @@ | ... | @@ -91,15 +88,6 @@ |
| 91 | # endif | 88 | # endif |
| 92 | #endif | 89 | #endif |
| 93 | 90 | ||
| 94 | // TODO(LLVM 22): Remove this check | ||
| 95 | #if defined(_LIBCPP_ABI_NO_ITERATOR_BASES) && !defined(_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER) | ||
| 96 | # ifndef _LIBCPP_ONLY_NO_ITERATOR_BASES | ||
| 97 | # error "You probably want to define _LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER. This has been split out from" \ | ||
| 98 | " _LIBCPP_ABI_NO_ITERATOR_BASES to allow only removing the second iterator member, since they aren't really related." \ | ||
| 99 | "If you actually want this ABI configuration, please define _LIBCPP_ONLY_NO_ITERATOR_BASES instead." | ||
| 100 | # endif | ||
| 101 | #endif | ||
| 102 | |||
| 103 | // We had some bugs where we use [[no_unique_address]] together with construct_at, | 91 | // We had some bugs where we use [[no_unique_address]] together with construct_at, |
| 104 | // which causes UB as the call on construct_at could write to overlapping subobjects | 92 | // which causes UB as the call on construct_at could write to overlapping subobjects |
| 105 | // | 93 | // |
| ... | @@ -108,7 +96,7 @@ | ... | @@ -108,7 +96,7 @@ |
| 108 | // | 96 | // |
| 109 | // To fix the bug we had to change the ABI of some classes to remove [[no_unique_address]] under certain conditions. | 97 | // To fix the bug we had to change the ABI of some classes to remove [[no_unique_address]] under certain conditions. |
| 110 | // The macro below is used for all classes whose ABI have changed as part of fixing these bugs. | 98 | // The macro below is used for all classes whose ABI have changed as part of fixing these bugs. |
| 111 | #define _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS __attribute__((__abi_tag__("llvm18_nua"))) | 99 | #define _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG __attribute__((__abi_tag__("llvm18_nua"))) |
| 112 | 100 | ||
| 113 | // [[msvc::no_unique_address]] seems to mostly affect empty classes, so the padding scheme for Itanium doesn't work. | 101 | // [[msvc::no_unique_address]] seems to mostly affect empty classes, so the padding scheme for Itanium doesn't work. |
| 114 | #if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING) | 102 | #if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING) |
lib/libcxx/include/__configuration/attributes.h created+476| ... | @@ -0,0 +1,476 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___CONFIGURATION_ATTRIBUTES_H | ||
| 10 | #define _LIBCPP___CONFIGURATION_ATTRIBUTES_H | ||
| 11 | |||
| 12 | /* zig patch: instead of including __config_site, zig adds -D flags when compiling */ | ||
| 13 | #include <__configuration/hardening.h> | ||
| 14 | #include <__configuration/language.h> | ||
| 15 | #include <__configuration/utility.h> | ||
| 16 | |||
| 17 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER | ||
| 18 | # pragma GCC system_header | ||
| 19 | #endif | ||
| 20 | |||
| 21 | #ifndef __has_declspec_attribute | ||
| 22 | # define __has_declspec_attribute(__x) 0 | ||
| 23 | #endif | ||
| 24 | |||
| 25 | // Attributes relevant for layout ABI | ||
| 26 | // ---------------------------------- | ||
| 27 | |||
| 28 | #if __has_cpp_attribute(msvc::no_unique_address) | ||
| 29 | // MSVC implements [[no_unique_address]] as a silent no-op currently. | ||
| 30 | // (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.) | ||
| 31 | // However, MSVC implements [[msvc::no_unique_address]] which does what | ||
| 32 | // [[no_unique_address]] is supposed to do, in general. | ||
| 33 | # define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] | ||
| 34 | #else | ||
| 35 | # define _LIBCPP_NO_UNIQUE_ADDRESS [[__no_unique_address__]] | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #define _LIBCPP_PACKED __attribute__((__packed__)) | ||
| 39 | |||
| 40 | // Attributes affecting overload resolution | ||
| 41 | // ---------------------------------------- | ||
| 42 | |||
| 43 | #if __has_attribute(__enable_if__) | ||
| 44 | # define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, ""))) | ||
| 45 | #endif | ||
| 46 | |||
| 47 | // Visibility attributes | ||
| 48 | // --------------------- | ||
| 49 | |||
| 50 | #if defined(_LIBCPP_OBJECT_FORMAT_COFF) | ||
| 51 | |||
| 52 | # ifdef _DLL | ||
| 53 | # define _LIBCPP_CRT_FUNC __declspec(dllimport) | ||
| 54 | # else | ||
| 55 | # define _LIBCPP_CRT_FUNC | ||
| 56 | # endif | ||
| 57 | |||
| 58 | # if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY)) | ||
| 59 | # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS | ||
| 60 | # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS | ||
| 61 | # define _LIBCPP_OVERRIDABLE_FUNC_VIS | ||
| 62 | # define _LIBCPP_EXPORTED_FROM_ABI | ||
| 63 | # elif defined(_LIBCPP_BUILDING_LIBRARY) | ||
| 64 | # if defined(__MINGW32__) | ||
| 65 | # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllexport) | ||
| 66 | # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS | ||
| 67 | # else | ||
| 68 | # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS | ||
| 69 | # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __declspec(dllexport) | ||
| 70 | # endif | ||
| 71 | # define _LIBCPP_OVERRIDABLE_FUNC_VIS __declspec(dllexport) | ||
| 72 | # define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport) | ||
| 73 | # else | ||
| 74 | # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllimport) | ||
| 75 | # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS | ||
| 76 | # define _LIBCPP_OVERRIDABLE_FUNC_VIS | ||
| 77 | # define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport) | ||
| 78 | # endif | ||
| 79 | |||
| 80 | # define _LIBCPP_HIDDEN | ||
| 81 | # define _LIBCPP_TEMPLATE_DATA_VIS | ||
| 82 | # define _LIBCPP_NAMESPACE_VISIBILITY | ||
| 83 | |||
| 84 | #else | ||
| 85 | |||
| 86 | # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) | ||
| 87 | # define _LIBCPP_VISIBILITY(vis) __attribute__((__visibility__(vis))) | ||
| 88 | # else | ||
| 89 | # define _LIBCPP_VISIBILITY(vis) | ||
| 90 | # endif | ||
| 91 | |||
| 92 | # define _LIBCPP_HIDDEN _LIBCPP_VISIBILITY("hidden") | ||
| 93 | # define _LIBCPP_TEMPLATE_DATA_VIS _LIBCPP_VISIBILITY("default") | ||
| 94 | # define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default") | ||
| 95 | # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default") | ||
| 96 | # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS | ||
| 97 | |||
| 98 | // TODO: Make this a proper customization point or remove the option to override it. | ||
| 99 | # ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS | ||
| 100 | # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default") | ||
| 101 | # endif | ||
| 102 | |||
| 103 | # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) | ||
| 104 | # define _LIBCPP_NAMESPACE_VISIBILITY __attribute__((__type_visibility__("default"))) | ||
| 105 | # elif !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) | ||
| 106 | # define _LIBCPP_NAMESPACE_VISIBILITY __attribute__((__visibility__("default"))) | ||
| 107 | # else | ||
| 108 | # define _LIBCPP_NAMESPACE_VISIBILITY | ||
| 109 | # endif | ||
| 110 | |||
| 111 | #endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) | ||
| 112 | |||
| 113 | // hide_from_abi | ||
| 114 | // ------------- | ||
| 115 | |||
| 116 | #define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) | ||
| 117 | |||
| 118 | #if __has_attribute(exclude_from_explicit_instantiation) | ||
| 119 | # define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((__exclude_from_explicit_instantiation__)) | ||
| 120 | #else | ||
| 121 | // Try to approximate the effect of exclude_from_explicit_instantiation | ||
| 122 | // (which is that entities are not assumed to be provided by explicit | ||
| 123 | // template instantiations in the dylib) by always inlining those entities. | ||
| 124 | # define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE | ||
| 125 | #endif | ||
| 126 | |||
| 127 | #if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST | ||
| 128 | # define _LIBCPP_HARDENING_SIG f | ||
| 129 | #elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE | ||
| 130 | # define _LIBCPP_HARDENING_SIG s | ||
| 131 | #elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG | ||
| 132 | # define _LIBCPP_HARDENING_SIG d | ||
| 133 | #else | ||
| 134 | # define _LIBCPP_HARDENING_SIG n // "none" | ||
| 135 | #endif | ||
| 136 | |||
| 137 | #if _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_OBSERVE | ||
| 138 | # define _LIBCPP_ASSERTION_SEMANTIC_SIG o | ||
| 139 | #elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE | ||
| 140 | # define _LIBCPP_ASSERTION_SEMANTIC_SIG q | ||
| 141 | #elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_ENFORCE | ||
| 142 | # define _LIBCPP_ASSERTION_SEMANTIC_SIG e | ||
| 143 | #else | ||
| 144 | # define _LIBCPP_ASSERTION_SEMANTIC_SIG i // `ignore` | ||
| 145 | #endif | ||
| 146 | |||
| 147 | #if !_LIBCPP_HAS_EXCEPTIONS | ||
| 148 | # define _LIBCPP_EXCEPTIONS_SIG n | ||
| 149 | #else | ||
| 150 | # define _LIBCPP_EXCEPTIONS_SIG e | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #define _LIBCPP_ODR_SIGNATURE \ | ||
| 154 | _LIBCPP_CONCAT( \ | ||
| 155 | _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_ASSERTION_SEMANTIC_SIG), _LIBCPP_EXCEPTIONS_SIG), \ | ||
| 156 | _LIBCPP_VERSION) | ||
| 157 | |||
| 158 | // This macro marks a symbol as being hidden from libc++'s ABI. This is achieved | ||
| 159 | // on two levels: | ||
| 160 | // 1. The symbol is given hidden visibility, which ensures that users won't start exporting | ||
| 161 | // symbols from their dynamic library by means of using the libc++ headers. This ensures | ||
| 162 | // that those symbols stay private to the dynamic library in which it is defined. | ||
| 163 | // | ||
| 164 | // 2. The symbol is given an ABI tag that encodes the ODR-relevant properties of the library. | ||
| 165 | // This ensures that no ODR violation can arise from mixing two TUs compiled with different | ||
| 166 | // versions or configurations of libc++ (such as exceptions vs no-exceptions). Indeed, if the | ||
| 167 | // program contains two definitions of a function, the ODR requires them to be token-by-token | ||
| 168 | // equivalent, and the linker is allowed to pick either definition and discard the other one. | ||
| 169 | // | ||
| 170 | // For example, if a program contains a copy of `vector::at()` compiled with exceptions enabled | ||
| 171 | // *and* a copy of `vector::at()` compiled with exceptions disabled (by means of having two TUs | ||
| 172 | // compiled with different settings), the two definitions are both visible by the linker and they | ||
| 173 | // have the same name, but they have a meaningfully different implementation (one throws an exception | ||
| 174 | // and the other aborts the program). This violates the ODR and makes the program ill-formed, and in | ||
| 175 | // practice what will happen is that the linker will pick one of the definitions at random and will | ||
| 176 | // discard the other one. This can quite clearly lead to incorrect program behavior. | ||
| 177 | // | ||
| 178 | // A similar reasoning holds for many other properties that are ODR-affecting. Essentially any | ||
| 179 | // property that causes the code of a function to differ from the code in another configuration | ||
| 180 | // can be considered ODR-affecting. In practice, we don't encode all such properties in the ABI | ||
| 181 | // tag, but we encode the ones that we think are most important: library version, exceptions, and | ||
| 182 | // hardening mode. | ||
| 183 | // | ||
| 184 | // Note that historically, solving this problem has been achieved in various ways, including | ||
| 185 | // force-inlining all functions or giving internal linkage to all functions. Both these previous | ||
| 186 | // solutions suffer from drawbacks that lead notably to code bloat. | ||
| 187 | // | ||
| 188 | // Note that we use _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION to ensure that we don't depend | ||
| 189 | // on _LIBCPP_HIDE_FROM_ABI methods of classes explicitly instantiated in the dynamic library. | ||
| 190 | // | ||
| 191 | // Also note that the _LIBCPP_HIDE_FROM_ABI_VIRTUAL macro should be used on virtual functions | ||
| 192 | // instead of _LIBCPP_HIDE_FROM_ABI. That macro does not use an ABI tag. Indeed, the mangled | ||
| 193 | // name of a virtual function is part of its ABI, since some architectures like arm64e can sign | ||
| 194 | // the virtual function pointer in the vtable based on the mangled name of the function. Since | ||
| 195 | // we use an ABI tag that changes with each released version, the mangled name of the virtual | ||
| 196 | // function would change, which is incorrect. Note that it doesn't make much sense to change | ||
| 197 | // the implementation of a virtual function in an ABI-incompatible way in the first place, | ||
| 198 | // since that would be an ABI break anyway. Hence, the lack of ABI tag should not be noticeable. | ||
| 199 | // | ||
| 200 | // The macro can be applied to record and enum types. When the tagged type is nested in | ||
| 201 | // a record this "parent" record needs to have the macro too. Another use case for applying | ||
| 202 | // this macro to records and unions is to apply an ABI tag to inline constexpr variables. | ||
| 203 | // This can be useful for inline variables that are implementation details which are expected | ||
| 204 | // to change in the future. | ||
| 205 | // | ||
| 206 | // TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing | ||
| 207 | // the length of symbols with an ABI tag. In practice, we should remove the escape hatch and | ||
| 208 | // use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70. | ||
| 209 | #ifndef _LIBCPP_NO_ABI_TAG | ||
| 210 | # define _LIBCPP_HIDE_FROM_ABI \ | ||
| 211 | _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION \ | ||
| 212 | __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE)))) | ||
| 213 | #else | ||
| 214 | # define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION | ||
| 215 | #endif | ||
| 216 | #define _LIBCPP_HIDE_FROM_ABI_VIRTUAL _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION | ||
| 217 | |||
| 218 | // This macro makes sure that private classes which aren't necessarily part of the ABI change their name every release. | ||
| 219 | // The intention is _not_ to put it on every private class, but only on classes where type name stability implies ABI | ||
| 220 | // stability. This is essentially the case for classes that are only accessed through the vtable after instantiation, | ||
| 221 | // for example the control blocks of `shared_ptr`. These classes can change in ABI breaking ways as long as their name | ||
| 222 | // (and hence their vtable symbol) changes too. Note that the vtable and RTTI are not marked with | ||
| 223 | // [[gnu::visibility("hidden")]], since the vtable and RTTI should still be deduplicated across dylibs with the same | ||
| 224 | // instatiations. | ||
| 225 | #define _LIBCPP_HIDE_STRUCT_FROM_ABI [[__gnu__::__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))]] | ||
| 226 | |||
| 227 | // Optional attributes | ||
| 228 | // ------------------- | ||
| 229 | |||
| 230 | // these are useful for a better QoI, but not required to be available | ||
| 231 | |||
| 232 | #define _LIBCPP_NOALIAS __attribute__((__malloc__)) | ||
| 233 | #define _LIBCPP_NODEBUG [[__gnu__::__nodebug__]] | ||
| 234 | #define _LIBCPP_NO_SANITIZE(...) __attribute__((__no_sanitize__(__VA_ARGS__))) | ||
| 235 | #define _LIBCPP_INIT_PRIORITY_MAX __attribute__((__init_priority__(100))) | ||
| 236 | #define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \ | ||
| 237 | __attribute__((__format__(archetype, format_string_index, first_format_arg_index))) | ||
| 238 | |||
| 239 | #if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) | ||
| 240 | # define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) | ||
| 241 | #else | ||
| 242 | # define _LIBCPP_NO_CFI | ||
| 243 | #endif | ||
| 244 | |||
| 245 | #if __has_attribute(__using_if_exists__) | ||
| 246 | # define _LIBCPP_USING_IF_EXISTS __attribute__((__using_if_exists__)) | ||
| 247 | #else | ||
| 248 | # define _LIBCPP_USING_IF_EXISTS | ||
| 249 | #endif | ||
| 250 | |||
| 251 | #if __has_cpp_attribute(_Clang::__no_destroy__) | ||
| 252 | # define _LIBCPP_NO_DESTROY [[_Clang::__no_destroy__]] | ||
| 253 | #else | ||
| 254 | # define _LIBCPP_NO_DESTROY | ||
| 255 | #endif | ||
| 256 | |||
| 257 | #if __has_attribute(__diagnose_if__) | ||
| 258 | # define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning"))) | ||
| 259 | #else | ||
| 260 | # define _LIBCPP_DIAGNOSE_WARNING(...) | ||
| 261 | #endif | ||
| 262 | |||
| 263 | #if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_APPLE_CLANG_VER) && \ | ||
| 264 | (!defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 2001) | ||
| 265 | # define _LIBCPP_DIAGNOSE_IF(...) __attribute__((__diagnose_if__(__VA_ARGS__))) | ||
| 266 | #else | ||
| 267 | # define _LIBCPP_DIAGNOSE_IF(...) | ||
| 268 | #endif | ||
| 269 | |||
| 270 | #define _LIBCPP_DIAGNOSE_NULLPTR_IF(condition, condition_description) \ | ||
| 271 | _LIBCPP_DIAGNOSE_IF( \ | ||
| 272 | condition, \ | ||
| 273 | "null passed to callee that requires a non-null argument" condition_description, \ | ||
| 274 | "warning", \ | ||
| 275 | "nonnull") | ||
| 276 | |||
| 277 | #if __has_cpp_attribute(_Clang::__lifetimebound__) | ||
| 278 | # define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]] | ||
| 279 | #else | ||
| 280 | # define _LIBCPP_LIFETIMEBOUND | ||
| 281 | #endif | ||
| 282 | |||
| 283 | // This is to work around https://llvm.org/PR156809 | ||
| 284 | #ifndef _LIBCPP_CXX03_LANG | ||
| 285 | # define _LIBCPP_CTOR_LIFETIMEBOUND _LIBCPP_LIFETIMEBOUND | ||
| 286 | #else | ||
| 287 | # define _LIBCPP_CTOR_LIFETIMEBOUND | ||
| 288 | #endif | ||
| 289 | |||
| 290 | #if __has_cpp_attribute(_Clang::__noescape__) | ||
| 291 | # define _LIBCPP_NOESCAPE [[_Clang::__noescape__]] | ||
| 292 | #else | ||
| 293 | # define _LIBCPP_NOESCAPE | ||
| 294 | #endif | ||
| 295 | |||
| 296 | #if __has_cpp_attribute(_Clang::__no_specializations__) | ||
| 297 | # define _LIBCPP_NO_SPECIALIZATIONS \ | ||
| 298 | [[_Clang::__no_specializations__("Users are not allowed to specialize this standard library entity")]] | ||
| 299 | #else | ||
| 300 | # define _LIBCPP_NO_SPECIALIZATIONS | ||
| 301 | #endif | ||
| 302 | |||
| 303 | #if __has_cpp_attribute(_Clang::__preferred_name__) | ||
| 304 | # define _LIBCPP_PREFERRED_NAME(x) [[_Clang::__preferred_name__(x)]] | ||
| 305 | #else | ||
| 306 | # define _LIBCPP_PREFERRED_NAME(x) | ||
| 307 | #endif | ||
| 308 | |||
| 309 | #if __has_cpp_attribute(_Clang::__scoped_lockable__) | ||
| 310 | # define _LIBCPP_SCOPED_LOCKABLE [[_Clang::__scoped_lockable__]] | ||
| 311 | #else | ||
| 312 | # define _LIBCPP_SCOPED_LOCKABLE | ||
| 313 | #endif | ||
| 314 | |||
| 315 | #if __has_cpp_attribute(_Clang::__capability__) | ||
| 316 | # define _LIBCPP_CAPABILITY(...) [[_Clang::__capability__(__VA_ARGS__)]] | ||
| 317 | #else | ||
| 318 | # define _LIBCPP_CAPABILITY(...) | ||
| 319 | #endif | ||
| 320 | |||
| 321 | #if __has_attribute(__acquire_capability__) | ||
| 322 | # define _LIBCPP_ACQUIRE_CAPABILITY(...) __attribute__((__acquire_capability__(__VA_ARGS__))) | ||
| 323 | #else | ||
| 324 | # define _LIBCPP_ACQUIRE_CAPABILITY(...) | ||
| 325 | #endif | ||
| 326 | |||
| 327 | #if __has_cpp_attribute(_Clang::__try_acquire_capability__) | ||
| 328 | # define _LIBCPP_TRY_ACQUIRE_CAPABILITY(...) [[_Clang::__try_acquire_capability__(__VA_ARGS__)]] | ||
| 329 | #else | ||
| 330 | # define _LIBCPP_TRY_ACQUIRE_CAPABILITY(...) | ||
| 331 | #endif | ||
| 332 | |||
| 333 | #if __has_cpp_attribute(_Clang::__acquire_shared_capability__) | ||
| 334 | # define _LIBCPP_ACQUIRE_SHARED_CAPABILITY [[_Clang::__acquire_shared_capability__]] | ||
| 335 | #else | ||
| 336 | # define _LIBCPP_ACQUIRE_SHARED_CAPABILITY | ||
| 337 | #endif | ||
| 338 | |||
| 339 | #if __has_cpp_attribute(_Clang::__try_acquire_shared_capability__) | ||
| 340 | # define _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(...) [[_Clang::__try_acquire_shared_capability__(__VA_ARGS__)]] | ||
| 341 | #else | ||
| 342 | # define _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(...) | ||
| 343 | #endif | ||
| 344 | |||
| 345 | #if __has_attribute(__release_capability__) | ||
| 346 | # define _LIBCPP_RELEASE_CAPABILITY(...) __attribute__((__release_capability__(__VA_ARGS__))) | ||
| 347 | #else | ||
| 348 | # define _LIBCPP_RELEASE_CAPABILITY(...) | ||
| 349 | #endif | ||
| 350 | |||
| 351 | #if __has_cpp_attribute(_Clang::__release_shared_capability__) | ||
| 352 | # define _LIBCPP_RELEASE_SHARED_CAPABILITY [[_Clang::__release_shared_capability__]] | ||
| 353 | #else | ||
| 354 | # define _LIBCPP_RELEASE_SHARED_CAPABILITY | ||
| 355 | #endif | ||
| 356 | |||
| 357 | #if __has_attribute(__requires_capability__) | ||
| 358 | # define _LIBCPP_REQUIRES_CAPABILITY(...) __attribute__((__requires_capability__(__VA_ARGS__))) | ||
| 359 | #else | ||
| 360 | # define _LIBCPP_REQUIRES_CAPABILITY(...) | ||
| 361 | #endif | ||
| 362 | |||
| 363 | #if __has_cpp_attribute(_Clang::__no_thread_safety_analysis__) | ||
| 364 | # define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS [[_Clang::__no_thread_safety_analysis__]] | ||
| 365 | #else | ||
| 366 | # define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS | ||
| 367 | #endif | ||
| 368 | |||
| 369 | #if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases) | ||
| 370 | # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) | ||
| 371 | #else | ||
| 372 | # define _LIBCPP_DECLSPEC_EMPTY_BASES | ||
| 373 | #endif | ||
| 374 | |||
| 375 | // Allow for build-time disabling of unsigned integer sanitization | ||
| 376 | #if __has_attribute(no_sanitize) && !defined(_LIBCPP_COMPILER_GCC) | ||
| 377 | # define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) | ||
| 378 | #else | ||
| 379 | # define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK | ||
| 380 | #endif | ||
| 381 | |||
| 382 | #if __has_feature(nullability) | ||
| 383 | # define _LIBCPP_DIAGNOSE_NULLPTR _Nonnull | ||
| 384 | #else | ||
| 385 | # define _LIBCPP_DIAGNOSE_NULLPTR | ||
| 386 | #endif | ||
| 387 | |||
| 388 | #if defined(__CUDACC__) || defined(__CUDA_ARCH__) || defined(__CUDA_LIBDEVICE__) | ||
| 389 | // The CUDA SDK contains an unfortunate definition for the __noinline__ macro, | ||
| 390 | // which breaks the regular __attribute__((__noinline__)) syntax. Therefore, | ||
| 391 | // when compiling for CUDA we use the non-underscored version of the noinline | ||
| 392 | // attribute. | ||
| 393 | // | ||
| 394 | // This is a temporary workaround and we still expect the CUDA SDK team to solve | ||
| 395 | // this issue properly in the SDK headers. | ||
| 396 | // | ||
| 397 | // See https://github.com/llvm/llvm-project/pull/73838 for more details. | ||
| 398 | # define _LIBCPP_NOINLINE __attribute__((noinline)) | ||
| 399 | #elif __has_attribute(__noinline__) | ||
| 400 | # define _LIBCPP_NOINLINE __attribute__((__noinline__)) | ||
| 401 | #else | ||
| 402 | # define _LIBCPP_NOINLINE | ||
| 403 | #endif | ||
| 404 | |||
| 405 | // Deprecation macros | ||
| 406 | // ------------------ | ||
| 407 | |||
| 408 | // Deprecations warnings are always enabled, except when users explicitly opt-out | ||
| 409 | // by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS. | ||
| 410 | #if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) | ||
| 411 | # if __has_attribute(__deprecated__) | ||
| 412 | # define _LIBCPP_DEPRECATED __attribute__((__deprecated__)) | ||
| 413 | # define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m))) | ||
| 414 | # elif _LIBCPP_STD_VER >= 14 | ||
| 415 | # define _LIBCPP_DEPRECATED [[deprecated]] | ||
| 416 | # define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]] | ||
| 417 | # else | ||
| 418 | # define _LIBCPP_DEPRECATED | ||
| 419 | # define _LIBCPP_DEPRECATED_(m) | ||
| 420 | # endif | ||
| 421 | #else | ||
| 422 | # define _LIBCPP_DEPRECATED | ||
| 423 | # define _LIBCPP_DEPRECATED_(m) | ||
| 424 | #endif | ||
| 425 | |||
| 426 | #if !defined(_LIBCPP_CXX03_LANG) | ||
| 427 | # define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED | ||
| 428 | #else | ||
| 429 | # define _LIBCPP_DEPRECATED_IN_CXX11 | ||
| 430 | #endif | ||
| 431 | |||
| 432 | #if _LIBCPP_STD_VER >= 14 | ||
| 433 | # define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED | ||
| 434 | #else | ||
| 435 | # define _LIBCPP_DEPRECATED_IN_CXX14 | ||
| 436 | #endif | ||
| 437 | |||
| 438 | #if _LIBCPP_STD_VER >= 17 | ||
| 439 | # define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED | ||
| 440 | #else | ||
| 441 | # define _LIBCPP_DEPRECATED_IN_CXX17 | ||
| 442 | #endif | ||
| 443 | |||
| 444 | #if _LIBCPP_STD_VER >= 20 | ||
| 445 | # define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED | ||
| 446 | #else | ||
| 447 | # define _LIBCPP_DEPRECATED_IN_CXX20 | ||
| 448 | #endif | ||
| 449 | |||
| 450 | #if _LIBCPP_STD_VER >= 23 | ||
| 451 | # define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED | ||
| 452 | #else | ||
| 453 | # define _LIBCPP_DEPRECATED_IN_CXX23 | ||
| 454 | #endif | ||
| 455 | |||
| 456 | #if _LIBCPP_STD_VER >= 26 | ||
| 457 | # define _LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_DEPRECATED | ||
| 458 | # define _LIBCPP_DEPRECATED_IN_CXX26_(m) _LIBCPP_DEPRECATED_(m) | ||
| 459 | #else | ||
| 460 | # define _LIBCPP_DEPRECATED_IN_CXX26 | ||
| 461 | # define _LIBCPP_DEPRECATED_IN_CXX26_(m) | ||
| 462 | #endif | ||
| 463 | |||
| 464 | #if _LIBCPP_HAS_CHAR8_T | ||
| 465 | # define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED | ||
| 466 | #else | ||
| 467 | # define _LIBCPP_DEPRECATED_WITH_CHAR8_T | ||
| 468 | #endif | ||
| 469 | |||
| 470 | #if __has_cpp_attribute(_Clang::__no_field_protection__) | ||
| 471 | # define _LIBCPP_DISABLE_POINTER_FIELD_PROTECTION [[_Clang::__no_field_protection__]] | ||
| 472 | #else | ||
| 473 | # define _LIBCPP_DISABLE_POINTER_FIELD_PROTECTION | ||
| 474 | #endif | ||
| 475 | |||
| 476 | #endif // _LIBCPP___CONFIGURATION_ATTRIBUTES_H | ||
lib/libcxx/include/__configuration/availability.h+93-68| ... | @@ -38,6 +38,11 @@ | ... | @@ -38,6 +38,11 @@ |
| 38 | // When availability annotations are disabled, we take for granted that features introduced | 38 | // When availability annotations are disabled, we take for granted that features introduced |
| 39 | // in all versions of the library are available. | 39 | // in all versions of the library are available. |
| 40 | #if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS | 40 | #if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS |
| 41 | # define _LIBCPP_INTRODUCED_IN_LLVM_23 1 | ||
| 42 | # define _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE /* nothing */ | ||
| 43 | |||
| 44 | # define _LIBCPP_INTRODUCED_IN_LLVM_23 1 | ||
| 45 | # define _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE /* nothing */ | ||
| 41 | 46 | ||
| 42 | # define _LIBCPP_INTRODUCED_IN_LLVM_22 1 | 47 | # define _LIBCPP_INTRODUCED_IN_LLVM_22 1 |
| 43 | # define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE /* nothing */ | 48 | # define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE /* nothing */ |
| ... | @@ -70,15 +75,34 @@ | ... | @@ -70,15 +75,34 @@ |
| 70 | 75 | ||
| 71 | // clang-format off | 76 | // clang-format off |
| 72 | 77 | ||
| 78 | // LLVM 23 | ||
| 79 | // TODO: Fill this in | ||
| 80 | # define _LIBCPP_INTRODUCED_IN_LLVM_23 0 | ||
| 81 | # define _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE __attribute__((unavailable)) | ||
| 82 | |||
| 73 | // LLVM 22 | 83 | // LLVM 22 |
| 74 | // TODO: Fill this in | 84 | // TODO: Fill this in |
| 75 | # define _LIBCPP_INTRODUCED_IN_LLVM_22 0 | 85 | # define _LIBCPP_INTRODUCED_IN_LLVM_22 0 |
| 76 | # define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE __attribute__((unavailable)) | 86 | # define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE __attribute__((unavailable)) |
| 77 | 87 | ||
| 78 | // LLVM 21 | 88 | // LLVM 21 |
| 79 | // TODO: Fill this in | 89 | # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 260400) || \ |
| 80 | # define _LIBCPP_INTRODUCED_IN_LLVM_21 0 | 90 | (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 260400) || \ |
| 81 | # define _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE __attribute__((unavailable)) | 91 | (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 260400) || \ |
| 92 | (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 260400) || \ | ||
| 93 | (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 100400) || \ | ||
| 94 | (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 250400) | ||
| 95 | # define _LIBCPP_INTRODUCED_IN_LLVM_21 0 | ||
| 96 | # else | ||
| 97 | # define _LIBCPP_INTRODUCED_IN_LLVM_21 1 | ||
| 98 | # endif | ||
| 99 | # define _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE \ | ||
| 100 | __attribute__((availability(macos, strict, introduced = 26.4))) \ | ||
| 101 | __attribute__((availability(ios, strict, introduced = 26.4))) \ | ||
| 102 | __attribute__((availability(tvos, strict, introduced = 26.4))) \ | ||
| 103 | __attribute__((availability(watchos, strict, introduced = 26.4))) \ | ||
| 104 | __attribute__((availability(bridgeos, strict, introduced = 10.4))) \ | ||
| 105 | __attribute__((availability(driverkit, strict, introduced = 25.4))) | ||
| 82 | 106 | ||
| 83 | // LLVM 20 | 107 | // LLVM 20 |
| 84 | // | 108 | // |
| ... | @@ -87,7 +111,8 @@ | ... | @@ -87,7 +111,8 @@ |
| 87 | (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 260000) || \ | 111 | (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 260000) || \ |
| 88 | (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 260000) || \ | 112 | (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 260000) || \ |
| 89 | (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 260000) || \ | 113 | (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 260000) || \ |
| 90 | (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 100000) | 114 | (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 100000) || \ |
| 115 | (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 250000) | ||
| 91 | # define _LIBCPP_INTRODUCED_IN_LLVM_20 0 | 116 | # define _LIBCPP_INTRODUCED_IN_LLVM_20 0 |
| 92 | # else | 117 | # else |
| 93 | # define _LIBCPP_INTRODUCED_IN_LLVM_20 1 | 118 | # define _LIBCPP_INTRODUCED_IN_LLVM_20 1 |
| ... | @@ -97,14 +122,16 @@ | ... | @@ -97,14 +122,16 @@ |
| 97 | __attribute__((availability(ios, strict, introduced = 26.0))) \ | 122 | __attribute__((availability(ios, strict, introduced = 26.0))) \ |
| 98 | __attribute__((availability(tvos, strict, introduced = 26.0))) \ | 123 | __attribute__((availability(tvos, strict, introduced = 26.0))) \ |
| 99 | __attribute__((availability(watchos, strict, introduced = 26.0))) \ | 124 | __attribute__((availability(watchos, strict, introduced = 26.0))) \ |
| 100 | __attribute__((availability(bridgeos, strict, introduced = 10.0))) | 125 | __attribute__((availability(bridgeos, strict, introduced = 10.0))) \ |
| 126 | __attribute__((availability(driverkit, strict, introduced = 25.0))) | ||
| 101 | 127 | ||
| 102 | // LLVM 19 | 128 | // LLVM 19 |
| 103 | # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150400) || \ | 129 | # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150400) || \ |
| 104 | (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 180400) || \ | 130 | (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 180400) || \ |
| 105 | (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 180400) || \ | 131 | (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 180400) || \ |
| 106 | (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 110400) || \ | 132 | (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 110400) || \ |
| 107 | (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 90400) | 133 | (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 90400) || \ |
| 134 | (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 240400) | ||
| 108 | # define _LIBCPP_INTRODUCED_IN_LLVM_19 0 | 135 | # define _LIBCPP_INTRODUCED_IN_LLVM_19 0 |
| 109 | # else | 136 | # else |
| 110 | # define _LIBCPP_INTRODUCED_IN_LLVM_19 1 | 137 | # define _LIBCPP_INTRODUCED_IN_LLVM_19 1 |
| ... | @@ -114,7 +141,8 @@ | ... | @@ -114,7 +141,8 @@ |
| 114 | __attribute__((availability(ios, strict, introduced = 18.4))) \ | 141 | __attribute__((availability(ios, strict, introduced = 18.4))) \ |
| 115 | __attribute__((availability(tvos, strict, introduced = 18.4))) \ | 142 | __attribute__((availability(tvos, strict, introduced = 18.4))) \ |
| 116 | __attribute__((availability(watchos, strict, introduced = 11.4))) \ | 143 | __attribute__((availability(watchos, strict, introduced = 11.4))) \ |
| 117 | __attribute__((availability(bridgeos, strict, introduced = 9.4))) | 144 | __attribute__((availability(bridgeos, strict, introduced = 9.4))) \ |
| 145 | __attribute__((availability(driverkit, strict, introduced = 24.4))) | ||
| 118 | 146 | ||
| 119 | // LLVM 18 | 147 | // LLVM 18 |
| 120 | # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150000) || \ | 148 | # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150000) || \ |
| ... | @@ -220,51 +248,28 @@ | ... | @@ -220,51 +248,28 @@ |
| 220 | #define _LIBCPP_AVAILABILITY_HAS_NEW_SYNC _LIBCPP_INTRODUCED_IN_LLVM_22 | 248 | #define _LIBCPP_AVAILABILITY_HAS_NEW_SYNC _LIBCPP_INTRODUCED_IN_LLVM_22 |
| 221 | #define _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE | 249 | #define _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE |
| 222 | 250 | ||
| 223 | // Enable additional explicit instantiations of iostreams components. This | 251 | // This controls whether `std::__hash_memory` is available in the dylib, which |
| 224 | // reduces the number of weak definitions generated in programs that use | 252 | // is used for some `std::hash` specializations. |
| 225 | // iostreams by providing a single strong definition in the shared library. | 253 | #define _LIBCPP_AVAILABILITY_HAS_HASH_MEMORY _LIBCPP_INTRODUCED_IN_LLVM_21 |
| 226 | // | 254 | // No attribute, since we've had hash in the headers before |
| 227 | // TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation, | ||
| 228 | // or once libc++ doesn't use the attribute anymore. | ||
| 229 | // TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed. | ||
| 230 | #if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32) | ||
| 231 | # define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 _LIBCPP_INTRODUCED_IN_LLVM_12 | ||
| 232 | #else | ||
| 233 | # define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0 | ||
| 234 | #endif | ||
| 235 | |||
| 236 | // This controls the availability of floating-point std::to_chars functions. | ||
| 237 | // These overloads were added later than the integer overloads. | ||
| 238 | #define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14 | ||
| 239 | #define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE | ||
| 240 | |||
| 241 | // This controls whether the library claims to provide a default verbose | ||
| 242 | // termination function, and consequently whether the headers will try | ||
| 243 | // to use it when the mechanism isn't overriden at compile-time. | ||
| 244 | #define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15 | ||
| 245 | #define _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE | ||
| 246 | 255 | ||
| 247 | // This controls the availability of the C++17 std::pmr library, | 256 | // This controls whether we provide a message for `bad_function_call::what()` that specific to `std::bad_function_call`. |
| 248 | // which is implemented in large part in the built library. | 257 | // See https://wg21.link/LWG2233. This requires `std::bad_function_call::what()` to be available in the dylib. |
| 249 | // | 258 | #define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE _LIBCPP_INTRODUCED_IN_LLVM_21 |
| 250 | // TODO: Enable std::pmr markup once https://llvm.org/PR40340 has been fixed | 259 | // No attribute, since we've had bad_function_call::what() in the headers before |
| 251 | // Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support | ||
| 252 | // it and it'll be a load-time error, but we don't have a good alternative because the library won't compile if we | ||
| 253 | // use availability annotations until that bug has been fixed. | ||
| 254 | #define _LIBCPP_AVAILABILITY_HAS_PMR _LIBCPP_INTRODUCED_IN_LLVM_16 | ||
| 255 | #define _LIBCPP_AVAILABILITY_PMR | ||
| 256 | 260 | ||
| 257 | // These macros controls the availability of __cxa_init_primary_exception | 261 | // This determines whether we assume that the internal std::__bad_variant_access_with_msg class |
| 258 | // in the built library, which std::make_exception_ptr might use | 262 | // (which carries a message describing the cause of the failure in bad_variant_access::what()) |
| 259 | // (see libcxx/include/__exception/exception_ptr.h). | 263 | // provides a key function in the dylib. This allows centralizing its vtable and typeinfo instead |
| 260 | #define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18 | 264 | // of having all TUs provide a weak definition that then gets deduplicated. When it is not available |
| 261 | #define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE | 265 | // in the dylib, what() is defined inline instead, so the descriptive message is provided regardless. |
| 266 | #define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS_WITH_MSG_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_23 | ||
| 267 | // No attribute, since we've had bad_variant_access in the headers before | ||
| 262 | 268 | ||
| 263 | // This controls the availability of C++23 <print>, which | 269 | // This controls the availability of floating-point std::from_chars functions. |
| 264 | // has a dependency on the built library (it needs access to | 270 | // These overloads were added later than the integer overloads. |
| 265 | // the underlying buffer types of std::cout, std::cerr, and std::clog. | 271 | #define _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20 |
| 266 | #define _LIBCPP_AVAILABILITY_HAS_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18 | 272 | #define _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE |
| 267 | #define _LIBCPP_AVAILABILITY_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE | ||
| 268 | 273 | ||
| 269 | // This controls the availability of the C++20 time zone database. | 274 | // This controls the availability of the C++20 time zone database. |
| 270 | // The parser code is built in the library. | 275 | // The parser code is built in the library. |
| ... | @@ -280,30 +285,50 @@ | ... | @@ -280,30 +285,50 @@ |
| 280 | #define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19 | 285 | #define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19 |
| 281 | #define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE | 286 | #define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE |
| 282 | 287 | ||
| 283 | // This controls the availability of floating-point std::from_chars functions. | 288 | // These macros controls the availability of __cxa_init_primary_exception |
| 284 | // These overloads were added later than the integer overloads. | 289 | // in the built library, which std::make_exception_ptr might use |
| 285 | #define _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20 | 290 | // (see libcxx/include/__exception/exception_ptr.h). |
| 286 | #define _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE | 291 | #define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18 |
| 292 | #define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE | ||
| 287 | 293 | ||
| 288 | // This controls whether `std::__hash_memory` is available in the dylib, which | 294 | // This controls the availability of the C++17 std::pmr library, |
| 289 | // is used for some `std::hash` specializations. | 295 | // which is implemented in large part in the built library. |
| 290 | #define _LIBCPP_AVAILABILITY_HAS_HASH_MEMORY _LIBCPP_INTRODUCED_IN_LLVM_21 | 296 | // |
| 291 | // No attribute, since we've had hash in the headers before | 297 | // TODO: Enable std::pmr markup once https://llvm.org/PR40340 has been fixed |
| 298 | // Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support | ||
| 299 | // it and it'll be a load-time error, but we don't have a good alternative because the library won't compile if we | ||
| 300 | // use availability annotations until that bug has been fixed. | ||
| 301 | #define _LIBCPP_AVAILABILITY_HAS_PMR _LIBCPP_INTRODUCED_IN_LLVM_16 | ||
| 302 | #define _LIBCPP_AVAILABILITY_PMR | ||
| 292 | 303 | ||
| 293 | // This controls whether we provide a message for `bad_function_call::what()` that specific to `std::bad_function_call`. | 304 | // This controls whether the library claims to provide a default verbose |
| 294 | // See https://wg21.link/LWG2233. This requires `std::bad_function_call::what()` to be available in the dylib. | 305 | // termination function, and consequently whether the headers will try |
| 295 | #define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE _LIBCPP_INTRODUCED_IN_LLVM_21 | 306 | // to use it when the mechanism isn't overriden at compile-time. |
| 296 | // No attribute, since we've had bad_function_call::what() in the headers before | 307 | #define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15 |
| 308 | #define _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE | ||
| 309 | |||
| 310 | // This controls the availability of floating-point std::to_chars functions. | ||
| 311 | // These overloads were added later than the integer overloads. | ||
| 312 | #define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14 | ||
| 313 | #define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE | ||
| 297 | 314 | ||
| 298 | // Define availability attributes that depend on both | 315 | // Enable additional explicit instantiations of iostreams components. This |
| 299 | // _LIBCPP_HAS_EXCEPTIONS and _LIBCPP_HAS_RTTI. | 316 | // reduces the number of weak definitions generated in programs that use |
| 300 | #if !_LIBCPP_HAS_EXCEPTIONS || !_LIBCPP_HAS_RTTI | 317 | // iostreams by providing a single strong definition in the shared library. |
| 301 | # undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION | 318 | // |
| 302 | # undef _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION | 319 | // TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation, |
| 303 | # define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0 | 320 | // or once libc++ doesn't use the attribute anymore. |
| 304 | # define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION | 321 | // TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed. |
| 322 | #if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32) | ||
| 323 | # define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 _LIBCPP_INTRODUCED_IN_LLVM_12 | ||
| 324 | #else | ||
| 325 | # define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0 | ||
| 305 | #endif | 326 | #endif |
| 306 | 327 | ||
| 328 | // Controls whether the implementation for text_encoding::environment() is available | ||
| 329 | #define _LIBCPP_AVAILABILITY_HAS_TEXT_ENCODING_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_23 | ||
| 330 | #define _LIBCPP_AVAILABILITY_TEXT_ENCODING_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE | ||
| 331 | |||
| 307 | // Only define a bunch of symbols in the dylib if we need to be compatible with LLVM 7 headers or older | 332 | // Only define a bunch of symbols in the dylib if we need to be compatible with LLVM 7 headers or older |
| 308 | # if defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 8 | 333 | # if defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 8 |
| 309 | # define _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 | 334 | # define _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 |
lib/libcxx/include/__configuration/compiler.h+29-4| ... | @@ -33,12 +33,12 @@ | ... | @@ -33,12 +33,12 @@ |
| 33 | // Warn if a compiler version is used that is not supported anymore | 33 | // Warn if a compiler version is used that is not supported anymore |
| 34 | // LLVM RELEASE Update the minimum compiler versions | 34 | // LLVM RELEASE Update the minimum compiler versions |
| 35 | # if defined(_LIBCPP_CLANG_VER) | 35 | # if defined(_LIBCPP_CLANG_VER) |
| 36 | # if _LIBCPP_CLANG_VER < 2001 | 36 | # if _LIBCPP_CLANG_VER < 2101 |
| 37 | # warning "Libc++ only supports Clang 20 and later" | 37 | # warning "Libc++ only supports Clang 21 and later" |
| 38 | # endif | 38 | # endif |
| 39 | # elif defined(_LIBCPP_APPLE_CLANG_VER) | 39 | # elif defined(_LIBCPP_APPLE_CLANG_VER) |
| 40 | # if _LIBCPP_APPLE_CLANG_VER < 1700 | 40 | # if _LIBCPP_APPLE_CLANG_VER < 2100 |
| 41 | # warning "Libc++ only supports AppleClang 26 and later" | 41 | # warning "Libc++ only supports AppleClang 26.4 and later" |
| 42 | # endif | 42 | # endif |
| 43 | # elif defined(_LIBCPP_GCC_VER) | 43 | # elif defined(_LIBCPP_GCC_VER) |
| 44 | # if _LIBCPP_GCC_VER < 1500 | 44 | # if _LIBCPP_GCC_VER < 1500 |
| ... | @@ -46,6 +46,31 @@ | ... | @@ -46,6 +46,31 @@ |
| 46 | # endif | 46 | # endif |
| 47 | # endif | 47 | # endif |
| 48 | 48 | ||
| 49 | # ifndef __has_constexpr_builtin | ||
| 50 | # define __has_constexpr_builtin(x) 0 | ||
| 51 | # endif | ||
| 52 | |||
| 53 | // This checks wheter a Clang module is built | ||
| 54 | # ifndef __building_module | ||
| 55 | # define __building_module(...) 0 | ||
| 56 | # endif | ||
| 57 | |||
| 58 | // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by | ||
| 59 | // the compiler and '1' otherwise. | ||
| 60 | # ifndef __is_identifier | ||
| 61 | # define __is_identifier(__x) 1 | ||
| 62 | # endif | ||
| 63 | |||
| 64 | # define __has_keyword(__x) !(__is_identifier(__x)) | ||
| 65 | |||
| 66 | # ifndef __has_warning | ||
| 67 | # define __has_warning(...) 0 | ||
| 68 | # endif | ||
| 69 | |||
| 70 | # if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L | ||
| 71 | # error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11" | ||
| 72 | # endif | ||
| 73 | |||
| 49 | #endif | 74 | #endif |
| 50 | 75 | ||
| 51 | #endif // _LIBCPP___CONFIGURATION_COMPILER_H | 76 | #endif // _LIBCPP___CONFIGURATION_COMPILER_H |
lib/libcxx/include/__configuration/diagnostic_suppression.h created+44| ... | @@ -0,0 +1,44 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___CONFIGURATION_DIAGNOSTIC_SUPPRESSION_H | ||
| 11 | #define _LIBCPP___CONFIGURATION_DIAGNOSTIC_SUPPRESSION_H | ||
| 12 | |||
| 13 | /* zig patch: instead of including __config_site, zig adds -D flags when compiling */ | ||
| 14 | #include <__configuration/compiler.h> | ||
| 15 | #include <__configuration/utility.h> | ||
| 16 | |||
| 17 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER | ||
| 18 | # pragma GCC system_header | ||
| 19 | #endif | ||
| 20 | |||
| 21 | #ifdef _LIBCPP_COMPILER_CLANG_BASED | ||
| 22 | # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") | ||
| 23 | # define _LIBCPP_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") | ||
| 24 | # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(clang diagnostic ignored str)) | ||
| 25 | # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) | ||
| 26 | #elif defined(_LIBCPP_COMPILER_GCC) | ||
| 27 | # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") | ||
| 28 | # define _LIBCPP_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") | ||
| 29 | # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) | ||
| 30 | # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(GCC diagnostic ignored str)) | ||
| 31 | #else | ||
| 32 | # define _LIBCPP_DIAGNOSTIC_PUSH | ||
| 33 | # define _LIBCPP_DIAGNOSTIC_POP | ||
| 34 | # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) | ||
| 35 | # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) | ||
| 36 | #endif | ||
| 37 | |||
| 38 | // Macros to enter and leave a state where deprecation warnings are suppressed. | ||
| 39 | #define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ | ||
| 40 | _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated") \ | ||
| 41 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") | ||
| 42 | #define _LIBCPP_SUPPRESS_DEPRECATED_POP _LIBCPP_DIAGNOSTIC_POP | ||
| 43 | |||
| 44 | #endif // _LIBCPP___CONFIGURATION_DIAGNOSTIC_SUPPRESSION_H | ||
lib/libcxx/include/__configuration/hardening.h-17| ... | @@ -17,23 +17,6 @@ | ... | @@ -17,23 +17,6 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | // TODO(LLVM 23): Remove this. We're making these an error to catch folks who might not have migrated. | ||
| 21 | // Since hardening went through several changes (many of which impacted user-facing macros), | ||
| 22 | // we're keeping these checks around for a bit longer than usual. Failure to properly configure | ||
| 23 | // hardening results in checks being dropped silently, which is a pretty big deal. | ||
| 24 | #if defined(_LIBCPP_ENABLE_ASSERTIONS) | ||
| 25 | # error "_LIBCPP_ENABLE_ASSERTIONS has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)" | ||
| 26 | #endif | ||
| 27 | #if defined(_LIBCPP_ENABLE_HARDENED_MODE) | ||
| 28 | # error "_LIBCPP_ENABLE_HARDENED_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)" | ||
| 29 | #endif | ||
| 30 | #if defined(_LIBCPP_ENABLE_SAFE_MODE) | ||
| 31 | # error "_LIBCPP_ENABLE_SAFE_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)" | ||
| 32 | #endif | ||
| 33 | #if defined(_LIBCPP_ENABLE_DEBUG_MODE) | ||
| 34 | # error "_LIBCPP_ENABLE_DEBUG_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)" | ||
| 35 | #endif | ||
| 36 | |||
| 37 | // The library provides the macro `_LIBCPP_HARDENING_MODE` which can be set to one of the following values: | 20 | // The library provides the macro `_LIBCPP_HARDENING_MODE` which can be set to one of the following values: |
| 38 | // | 21 | // |
| 39 | // - `_LIBCPP_HARDENING_MODE_NONE`; | 22 | // - `_LIBCPP_HARDENING_MODE_NONE`; |
lib/libcxx/include/__configuration/language.h+42| ... | @@ -50,4 +50,46 @@ | ... | @@ -50,4 +50,46 @@ |
| 50 | # define _LIBCPP_HAS_EXCEPTIONS 0 | 50 | # define _LIBCPP_HAS_EXCEPTIONS 0 |
| 51 | #endif | 51 | #endif |
| 52 | 52 | ||
| 53 | #if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t) | ||
| 54 | # define _LIBCPP_HAS_CHAR8_T 0 | ||
| 55 | #else | ||
| 56 | # define _LIBCPP_HAS_CHAR8_T 1 | ||
| 57 | #endif | ||
| 58 | |||
| 59 | #if _LIBCPP_STD_VER <= 11 | ||
| 60 | # define _LIBCPP_EXPLICIT_SINCE_CXX14 | ||
| 61 | #else | ||
| 62 | # define _LIBCPP_EXPLICIT_SINCE_CXX14 explicit | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #if _LIBCPP_STD_VER >= 14 | ||
| 66 | # define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr | ||
| 67 | #else | ||
| 68 | # define _LIBCPP_CONSTEXPR_SINCE_CXX14 | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #if _LIBCPP_STD_VER >= 17 | ||
| 72 | # define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr | ||
| 73 | #else | ||
| 74 | # define _LIBCPP_CONSTEXPR_SINCE_CXX17 | ||
| 75 | #endif | ||
| 76 | |||
| 77 | #if _LIBCPP_STD_VER >= 20 | ||
| 78 | # define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr | ||
| 79 | #else | ||
| 80 | # define _LIBCPP_CONSTEXPR_SINCE_CXX20 | ||
| 81 | #endif | ||
| 82 | |||
| 83 | #if _LIBCPP_STD_VER >= 23 | ||
| 84 | # define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr | ||
| 85 | #else | ||
| 86 | # define _LIBCPP_CONSTEXPR_SINCE_CXX23 | ||
| 87 | #endif | ||
| 88 | |||
| 89 | #if _LIBCPP_STD_VER >= 26 | ||
| 90 | # define _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr | ||
| 91 | #else | ||
| 92 | # define _LIBCPP_CONSTEXPR_SINCE_CXX26 | ||
| 93 | #endif | ||
| 94 | |||
| 53 | #endif // _LIBCPP___CONFIGURATION_LANGUAGE_H | 95 | #endif // _LIBCPP___CONFIGURATION_LANGUAGE_H |
lib/libcxx/include/__configuration/namespace.h created+99| ... | @@ -0,0 +1,99 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___CONFIGURATION_NAMESPACE_H | ||
| 11 | #define _LIBCPP___CONFIGURATION_NAMESPACE_H | ||
| 12 | |||
| 13 | /* zig patch: instead of including __config_site, zig adds -D flags when compiling */ | ||
| 14 | #include <__configuration/attributes.h> | ||
| 15 | #include <__configuration/diagnostic_suppression.h> | ||
| 16 | #include <__configuration/utility.h> | ||
| 17 | |||
| 18 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER | ||
| 19 | # pragma GCC system_header | ||
| 20 | #endif | ||
| 21 | |||
| 22 | // Clang modules take a significant compile time hit when pushing and popping diagnostics. | ||
| 23 | // Since all the headers are marked as system headers unless _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER is defined, we can | ||
| 24 | // simply disable this pushing and popping when _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER isn't defined. | ||
| 25 | #ifdef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER | ||
| 26 | # define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS \ | ||
| 27 | _LIBCPP_DIAGNOSTIC_PUSH \ | ||
| 28 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++11-extensions") \ | ||
| 29 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \ | ||
| 30 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \ | ||
| 31 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \ | ||
| 32 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++23-extensions") \ | ||
| 33 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \ | ||
| 34 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \ | ||
| 35 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \ | ||
| 36 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++23-extensions") | ||
| 37 | # define _LIBCPP_POP_EXTENSION_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP | ||
| 38 | # define _LIBCPP_PUSH_ABI_PRAGMA_DIAGNOSTICS \ | ||
| 39 | _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpragma-clang-attribute") \ | ||
| 40 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wignored-attributes") | ||
| 41 | # define _LIBCPP_POP_ABI_PRAGMA_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP | ||
| 42 | #else | ||
| 43 | # define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS | ||
| 44 | # define _LIBCPP_POP_EXTENSION_DIAGNOSTICS | ||
| 45 | # define _LIBCPP_PUSH_ABI_PRAGMA_DIAGNOSTICS | ||
| 46 | # define _LIBCPP_POP_ABI_PRAGMA_DIAGNOSTICS | ||
| 47 | #endif | ||
| 48 | |||
| 49 | #define _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS \ | ||
| 50 | _LIBCPP_PUSH_ABI_PRAGMA_DIAGNOSTICS \ | ||
| 51 | _Pragma(_LIBCPP_TOSTRING(clang attribute _LibcxxExplicitABIAnnotations.push( \ | ||
| 52 | __attribute__((__exclude_from_explicit_instantiation__, \ | ||
| 53 | __visibility__("hidden"), \ | ||
| 54 | __abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE)))), \ | ||
| 55 | apply_to = function))) _LIBCPP_POP_ABI_PRAGMA_DIAGNOSTICS | ||
| 56 | |||
| 57 | #define _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS _Pragma("clang attribute _LibcxxExplicitABIAnnotations.pop") | ||
| 58 | |||
| 59 | // clang-format off | ||
| 60 | |||
| 61 | // The unversioned namespace is used when we want to be ABI compatible with other standard libraries in some way. There | ||
| 62 | // are two main categories where that's the case: | ||
| 63 | // - Historically, we have made exception types ABI compatible with libstdc++ to allow throwing them between libstdc++ | ||
| 64 | // and libc++. This is not used anymore for new exception types, since there is no use-case for it anymore. | ||
| 65 | // - Types and functions which are used by the compiler are in the unversioned namespace, since the compiler has to know | ||
| 66 | // their mangling without the appropriate declaration in some cases. | ||
| 67 | // If it's not clear whether using the unversioned namespace is the correct thing to do, it's not. The versioned | ||
| 68 | // namespace (_LIBCPP_BEGIN_NAMESPACE_STD) should almost always be used. | ||
| 69 | # define _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD \ | ||
| 70 | _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS namespace _LIBCPP_NAMESPACE_VISIBILITY std { | ||
| 71 | |||
| 72 | # define _LIBCPP_END_UNVERSIONED_NAMESPACE_STD } _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS _LIBCPP_POP_EXTENSION_DIAGNOSTICS | ||
| 73 | |||
| 74 | # define _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD inline namespace _LIBCPP_ABI_NAMESPACE { | ||
| 75 | # define _LIBCPP_END_NAMESPACE_STD } _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | ||
| 76 | |||
| 77 | // TODO: This should really be in the versioned namespace | ||
| 78 | #define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD namespace experimental { | ||
| 79 | #define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | ||
| 80 | |||
| 81 | #define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 { | ||
| 82 | #define _LIBCPP_END_NAMESPACE_LFTS } _LIBCPP_END_NAMESPACE_EXPERIMENTAL | ||
| 83 | |||
| 84 | #define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 { | ||
| 85 | #define _LIBCPP_END_NAMESPACE_LFTS_V2 } _LIBCPP_END_NAMESPACE_EXPERIMENTAL | ||
| 86 | |||
| 87 | #ifdef _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE | ||
| 88 | # define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD namespace filesystem { | ||
| 89 | # define _LIBCPP_END_NAMESPACE_FILESYSTEM } _LIBCPP_END_NAMESPACE_STD | ||
| 90 | #else | ||
| 91 | # define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD \ | ||
| 92 | inline namespace __fs { namespace filesystem { | ||
| 93 | |||
| 94 | # define _LIBCPP_END_NAMESPACE_FILESYSTEM }} _LIBCPP_END_NAMESPACE_STD | ||
| 95 | #endif | ||
| 96 | |||
| 97 | // clang-format on | ||
| 98 | |||
| 99 | #endif // _LIBCPP___CONFIGURATION_NAMESPACE_H | ||
lib/libcxx/include/__configuration/platform.h+4| ... | @@ -30,6 +30,10 @@ | ... | @@ -30,6 +30,10 @@ |
| 30 | // ... add new file formats here ... | 30 | // ... add new file formats here ... |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | #if defined(__MVS__) | ||
| 34 | # include <features.h> // for __NATIVE_ASCII_F | ||
| 35 | #endif | ||
| 36 | |||
| 33 | // Need to detect which libc we're using if we're on Linux. | 37 | // Need to detect which libc we're using if we're on Linux. |
| 34 | #if (defined(__linux__) || defined(__AMDGPU__) || defined(__NVPTX__)) && __has_include(<features.h>) | 38 | #if (defined(__linux__) || defined(__AMDGPU__) || defined(__NVPTX__)) && __has_include(<features.h>) |
| 35 | # include <features.h> | 39 | # include <features.h> |
lib/libcxx/include/__configuration/pstl.h created+66| ... | @@ -0,0 +1,66 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___CONFIGURATION_PSTL_H | ||
| 11 | #define _LIBCPP___CONFIGURATION_PSTL_H | ||
| 12 | |||
| 13 | /* zig patch: instead of including __config_site, zig adds -D flags when compiling */ | ||
| 14 | |||
| 15 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER | ||
| 16 | # pragma GCC system_header | ||
| 17 | #endif | ||
| 18 | |||
| 19 | #define _PSTL_PRAGMA(x) _Pragma(#x) | ||
| 20 | |||
| 21 | // Enable SIMD for compilers that support OpenMP 4.0 | ||
| 22 | #if (defined(_OPENMP) && _OPENMP >= 201307) | ||
| 23 | |||
| 24 | # define _PSTL_UDR_PRESENT | ||
| 25 | # define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd) | ||
| 26 | # define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd) | ||
| 27 | # define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM)) | ||
| 28 | # define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM)) | ||
| 29 | # define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM)) | ||
| 30 | # define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM)) | ||
| 31 | |||
| 32 | // Declaration of reduction functor, where | ||
| 33 | // NAME - the name of the functor | ||
| 34 | // OP - type of the callable object with the reduction operation | ||
| 35 | // omp_in - refers to the local partial result | ||
| 36 | // omp_out - refers to the final value of the combiner operator | ||
| 37 | // omp_priv - refers to the private copy of the initial value | ||
| 38 | // omp_orig - refers to the original variable to be reduced | ||
| 39 | # define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \ | ||
| 40 | _PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig)) | ||
| 41 | |||
| 42 | #elif defined(_LIBCPP_COMPILER_CLANG_BASED) | ||
| 43 | |||
| 44 | # define _PSTL_PRAGMA_SIMD _Pragma("clang loop vectorize(enable) interleave(enable)") | ||
| 45 | # define _PSTL_PRAGMA_DECLARE_SIMD | ||
| 46 | # define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _Pragma("clang loop vectorize(enable) interleave(enable)") | ||
| 47 | # define _PSTL_PRAGMA_SIMD_SCAN(PRM) _Pragma("clang loop vectorize(enable) interleave(enable)") | ||
| 48 | # define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) | ||
| 49 | # define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) | ||
| 50 | # define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) | ||
| 51 | |||
| 52 | #else // (defined(_OPENMP) && _OPENMP >= 201307) | ||
| 53 | |||
| 54 | # define _PSTL_PRAGMA_SIMD | ||
| 55 | # define _PSTL_PRAGMA_DECLARE_SIMD | ||
| 56 | # define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) | ||
| 57 | # define _PSTL_PRAGMA_SIMD_SCAN(PRM) | ||
| 58 | # define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) | ||
| 59 | # define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) | ||
| 60 | # define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) | ||
| 61 | |||
| 62 | #endif // (defined(_OPENMP) && _OPENMP >= 201307) | ||
| 63 | |||
| 64 | #define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED | ||
| 65 | |||
| 66 | #endif // _LIBCPP___CONFIGURATION_PSTL_H | ||
lib/libcxx/include/__configuration/utility.h created+26| ... | @@ -0,0 +1,26 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___CONFIGURATION_UTILITY_H | ||
| 11 | #define _LIBCPP___CONFIGURATION_UTILITY_H | ||
| 12 | |||
| 13 | /* zig patch: instead of including __config_site, zig adds -D flags when compiling */ | ||
| 14 | |||
| 15 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER | ||
| 16 | # pragma GCC system_header | ||
| 17 | #endif | ||
| 18 | |||
| 19 | #define _LIBCPP_TOSTRING2(x) #x | ||
| 20 | #define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) | ||
| 21 | |||
| 22 | #define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y | ||
| 23 | #define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) | ||
| 24 | #define _LIBCPP_CONCAT3(X, Y, Z) _LIBCPP_CONCAT(X, _LIBCPP_CONCAT(Y, Z)) | ||
| 25 | |||
| 26 | #endif // _LIBCPP___CONFIGURATION_UTILITY_H | ||
lib/libcxx/include/__cstddef/byte.h+6-6| ... | @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD | ... | @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD |
| 23 | 23 | ||
| 24 | enum class byte : unsigned char {}; | 24 | enum class byte : unsigned char {}; |
| 25 | 25 | ||
| 26 | _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator|(byte __lhs, byte __rhs) noexcept { | 26 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator|(byte __lhs, byte __rhs) noexcept { |
| 27 | return static_cast<byte>( | 27 | return static_cast<byte>( |
| 28 | static_cast<unsigned char>(static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs))); | 28 | static_cast<unsigned char>(static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs))); |
| 29 | } | 29 | } |
| ... | @@ -32,7 +32,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator|=(byte& __lhs, byte __rhs) | ... | @@ -32,7 +32,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator|=(byte& __lhs, byte __rhs) |
| 32 | return __lhs = __lhs | __rhs; | 32 | return __lhs = __lhs | __rhs; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator&(byte __lhs, byte __rhs) noexcept { | 35 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator&(byte __lhs, byte __rhs) noexcept { |
| 36 | return static_cast<byte>( | 36 | return static_cast<byte>( |
| 37 | static_cast<unsigned char>(static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs))); | 37 | static_cast<unsigned char>(static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs))); |
| 38 | } | 38 | } |
| ... | @@ -41,7 +41,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator&=(byte& __lhs, byte __rhs) | ... | @@ -41,7 +41,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator&=(byte& __lhs, byte __rhs) |
| 41 | return __lhs = __lhs & __rhs; | 41 | return __lhs = __lhs & __rhs; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator^(byte __lhs, byte __rhs) noexcept { | 44 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator^(byte __lhs, byte __rhs) noexcept { |
| 45 | return static_cast<byte>( | 45 | return static_cast<byte>( |
| 46 | static_cast<unsigned char>(static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs))); | 46 | static_cast<unsigned char>(static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs))); |
| 47 | } | 47 | } |
| ... | @@ -50,7 +50,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator^=(byte& __lhs, byte __rhs) | ... | @@ -50,7 +50,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator^=(byte& __lhs, byte __rhs) |
| 50 | return __lhs = __lhs ^ __rhs; | 50 | return __lhs = __lhs ^ __rhs; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator~(byte __b) noexcept { | 53 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator~(byte __b) noexcept { |
| 54 | return static_cast<byte>(static_cast<unsigned char>(~static_cast<unsigned int>(__b))); | 54 | return static_cast<byte>(static_cast<unsigned char>(~static_cast<unsigned int>(__b))); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| ... | @@ -60,7 +60,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr byte& operator<<=(byte& __lhs, _Integer __shift) | ... | @@ -60,7 +60,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr byte& operator<<=(byte& __lhs, _Integer __shift) |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> | 62 | template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> |
| 63 | _LIBCPP_HIDE_FROM_ABI constexpr byte operator<<(byte __lhs, _Integer __shift) noexcept { | 63 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr byte operator<<(byte __lhs, _Integer __shift) noexcept { |
| 64 | return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) << __shift)); | 64 | return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) << __shift)); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| ... | @@ -70,7 +70,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr byte& operator>>=(byte& __lhs, _Integer __shift) | ... | @@ -70,7 +70,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr byte& operator>>=(byte& __lhs, _Integer __shift) |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> | 72 | template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> |
| 73 | _LIBCPP_HIDE_FROM_ABI constexpr byte operator>>(byte __lhs, _Integer __shift) noexcept { | 73 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr byte operator>>(byte __lhs, _Integer __shift) noexcept { |
| 74 | return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) >> __shift)); | 74 | return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) >> __shift)); |
| 75 | } | 75 | } |
| 76 | 76 |
lib/libcxx/include/__cstddef/max_align_t.h+4-2| ... | @@ -16,12 +16,14 @@ | ... | @@ -16,12 +16,14 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | #if !defined(_LIBCPP_CXX03_LANG) | ||
| 20 | |||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 22 | ||
| 21 | #if !defined(_LIBCPP_CXX03_LANG) | ||
| 22 | using ::max_align_t _LIBCPP_USING_IF_EXISTS; | 23 | using ::max_align_t _LIBCPP_USING_IF_EXISTS; |
| 23 | #endif | ||
| 24 | 24 | ||
| 25 | _LIBCPP_END_NAMESPACE_STD | 25 | _LIBCPP_END_NAMESPACE_STD |
| 26 | 26 | ||
| 27 | #endif | ||
| 28 | |||
| 27 | #endif // _LIBCPP___CSTDDEF_MAX_ALIGN_T_H | 29 | #endif // _LIBCPP___CSTDDEF_MAX_ALIGN_T_H |
lib/libcxx/include/__debug_utils/sanitizers.h+30-5| ... | @@ -17,7 +17,32 @@ | ... | @@ -17,7 +17,32 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | #if __has_feature(address_sanitizer) | 20 | // Within libc++, _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS determines whether the containers should |
| 21 | // provide ASAN container overflow checks. That setting attempts to honour ASAN's documented option | ||
| 22 | // __SANITIZER_DISABLE_CONTAINER_OVERFLOW__ which can be defined by users to disable container overflow | ||
| 23 | // checks. | ||
| 24 | // | ||
| 25 | // However, since parts of some containers (e.g. std::string) are compiled separately into the built | ||
| 26 | // library, there are caveats: | ||
| 27 | // - __SANITIZER_DISABLE_CONTAINER_OVERFLOW__ can't always be honoured, i.e. if the built library | ||
| 28 | // was compiled with ASAN container checks, it's impossible to turn them off afterwards. We diagnose | ||
| 29 | // this with an error to avoid the proliferation of invalid configurations that appear to work. | ||
| 30 | // | ||
| 31 | // - The container overflow checks themselves are not always available even when the user is compiling | ||
| 32 | // with -fsanitize=address. If a container is compiled separately like std::string, it can't provide | ||
| 33 | // container checks unless the separately compiled code was built with container checks enabled. These | ||
| 34 | // containers need to also conditionalize whether they provide overflow checks on `_LIBCPP_INSTRUMENTED_WITH_ASAN`. | ||
| 35 | #if __has_feature(address_sanitizer) && !defined(__SANITIZER_DISABLE_CONTAINER_OVERFLOW__) | ||
| 36 | # define _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS 1 | ||
| 37 | #else | ||
| 38 | # define _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS 0 | ||
| 39 | #endif | ||
| 40 | |||
| 41 | #if _LIBCPP_INSTRUMENTED_WITH_ASAN && !_LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS | ||
| 42 | # error "We can't disable ASAN container checks when libc++ has been built with ASAN container checks enabled" | ||
| 43 | #endif | ||
| 44 | |||
| 45 | #if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS | ||
| 21 | 46 | ||
| 22 | extern "C" { | 47 | extern "C" { |
| 23 | _LIBCPP_EXPORTED_FROM_ABI void | 48 | _LIBCPP_EXPORTED_FROM_ABI void |
| ... | @@ -28,12 +53,12 @@ _LIBCPP_EXPORTED_FROM_ABI int | ... | @@ -28,12 +53,12 @@ _LIBCPP_EXPORTED_FROM_ABI int |
| 28 | __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, const void*, const void*); | 53 | __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, const void*, const void*); |
| 29 | } | 54 | } |
| 30 | 55 | ||
| 31 | #endif // __has_feature(address_sanitizer) | 56 | #endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 32 | 57 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | 58 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 34 | 59 | ||
| 35 | // ASan choices | 60 | // ASan choices |
| 36 | #if __has_feature(address_sanitizer) | 61 | #if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 37 | # define _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS 1 | 62 | # define _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS 1 |
| 38 | #endif | 63 | #endif |
| 39 | 64 | ||
| ... | @@ -57,7 +82,7 @@ _LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container( | ... | @@ -57,7 +82,7 @@ _LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container( |
| 57 | const void* __last_old_contained, | 82 | const void* __last_old_contained, |
| 58 | const void* __first_new_contained, | 83 | const void* __first_new_contained, |
| 59 | const void* __last_new_contained) { | 84 | const void* __last_new_contained) { |
| 60 | #if !__has_feature(address_sanitizer) | 85 | #if !_LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 61 | (void)__first_storage; | 86 | (void)__first_storage; |
| 62 | (void)__last_storage; | 87 | (void)__last_storage; |
| 63 | (void)__first_old_contained; | 88 | (void)__first_old_contained; |
| ... | @@ -86,7 +111,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __annotate_contiguous_c | ... | @@ -86,7 +111,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __annotate_contiguous_c |
| 86 | const void* __last_storage, | 111 | const void* __last_storage, |
| 87 | const void* __old_last_contained, | 112 | const void* __old_last_contained, |
| 88 | const void* __new_last_contained) { | 113 | const void* __new_last_contained) { |
| 89 | #if !__has_feature(address_sanitizer) | 114 | #if !_LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 90 | (void)__first_storage; | 115 | (void)__first_storage; |
| 91 | (void)__last_storage; | 116 | (void)__last_storage; |
| 92 | (void)__old_last_contained; | 117 | (void)__old_last_contained; |
lib/libcxx/include/__exception/exception.h+2| ... | @@ -22,6 +22,7 @@ | ... | @@ -22,6 +22,7 @@ |
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD | 24 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD |
| 25 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 25 | 26 | ||
| 26 | #if defined(_LIBCPP_ABI_VCRUNTIME) && (!defined(_HAS_EXCEPTIONS) || _HAS_EXCEPTIONS != 0) | 27 | #if defined(_LIBCPP_ABI_VCRUNTIME) && (!defined(_HAS_EXCEPTIONS) || _HAS_EXCEPTIONS != 0) |
| 27 | // The std::exception class was already included above, but we're explicit about this condition here for clarity. | 28 | // The std::exception class was already included above, but we're explicit about this condition here for clarity. |
| ... | @@ -91,6 +92,7 @@ public: | ... | @@ -91,6 +92,7 @@ public: |
| 91 | }; | 92 | }; |
| 92 | #endif // !_LIBCPP_ABI_VCRUNTIME | 93 | #endif // !_LIBCPP_ABI_VCRUNTIME |
| 93 | 94 | ||
| 95 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 94 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | 96 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD |
| 95 | 97 | ||
| 96 | #endif // _LIBCPP___EXCEPTION_EXCEPTION_H | 98 | #endif // _LIBCPP___EXCEPTION_EXCEPTION_H |
lib/libcxx/include/__exception/exception_ptr.h+15-37| ... | @@ -31,7 +31,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -31,7 +31,7 @@ _LIBCPP_PUSH_MACROS |
| 31 | 31 | ||
| 32 | #ifndef _LIBCPP_ABI_MICROSOFT | 32 | #ifndef _LIBCPP_ABI_MICROSOFT |
| 33 | 33 | ||
| 34 | # if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION | 34 | # if _LIBCPP_HAS_EXCEPTIONS && _LIBCPP_HAS_RTTI && _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION |
| 35 | 35 | ||
| 36 | namespace __cxxabiv1 { | 36 | namespace __cxxabiv1 { |
| 37 | 37 | ||
| ... | @@ -55,13 +55,12 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception* __cxa_init_primary_exception( | ... | @@ -55,13 +55,12 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception* __cxa_init_primary_exception( |
| 55 | 55 | ||
| 56 | } // namespace __cxxabiv1 | 56 | } // namespace __cxxabiv1 |
| 57 | 57 | ||
| 58 | # endif | 58 | # endif // _LIBCPP_HAS_EXCEPTIONS && _LIBCPP_HAS_RTTI && _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION |
| 59 | 59 | ||
| 60 | #endif | 60 | #endif // !defined(_LIBCPP_ABI_MICROSOFT) |
| 61 | 61 | ||
| 62 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD | 62 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD |
| 63 | 63 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | |
| 64 | #ifndef _LIBCPP_ABI_MICROSOFT | ||
| 65 | 64 | ||
| 66 | inline _LIBCPP_HIDE_FROM_ABI void swap(exception_ptr& __x, exception_ptr& __y) _NOEXCEPT; | 65 | inline _LIBCPP_HIDE_FROM_ABI void swap(exception_ptr& __x, exception_ptr& __y) _NOEXCEPT; |
| 67 | 66 | ||
| ... | @@ -73,6 +72,8 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_ptr { | ... | @@ -73,6 +72,8 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_ptr { |
| 73 | template <class _Ep> | 72 | template <class _Ep> |
| 74 | friend _LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_explicit(_Ep&) _NOEXCEPT; | 73 | friend _LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_explicit(_Ep&) _NOEXCEPT; |
| 75 | 74 | ||
| 75 | friend _LIBCPP_EXPORTED_FROM_ABI exception_ptr __copy_exception_ptr(void*, const void*); | ||
| 76 | |||
| 76 | public: | 77 | public: |
| 77 | // exception_ptr is basically a COW string so it is trivially relocatable. | 78 | // exception_ptr is basically a COW string so it is trivially relocatable. |
| 78 | using __trivially_relocatable _LIBCPP_NODEBUG = exception_ptr; | 79 | using __trivially_relocatable _LIBCPP_NODEBUG = exception_ptr; |
| ... | @@ -112,8 +113,10 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(exception_ptr& __x, exception_ptr& __y) _ | ... | @@ -112,8 +113,10 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(exception_ptr& __x, exception_ptr& __y) _ |
| 112 | std::swap(__x.__ptr_, __y.__ptr_); | 113 | std::swap(__x.__ptr_, __y.__ptr_); |
| 113 | } | 114 | } |
| 114 | 115 | ||
| 116 | #ifndef _LIBCPP_ABI_MICROSOFT | ||
| 117 | |||
| 115 | # if _LIBCPP_HAS_EXCEPTIONS | 118 | # if _LIBCPP_HAS_EXCEPTIONS |
| 116 | # if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION | 119 | # if _LIBCPP_HAS_RTTI && _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION |
| 117 | template <class _Ep> | 120 | template <class _Ep> |
| 118 | _LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_explicit(_Ep& __e) _NOEXCEPT { | 121 | _LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_explicit(_Ep& __e) _NOEXCEPT { |
| 119 | using _Ep2 = __decay_t<_Ep>; | 122 | using _Ep2 = __decay_t<_Ep>; |
| ... | @@ -136,7 +139,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_explicit(_Ep& __e) _NOE | ... | @@ -136,7 +139,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_explicit(_Ep& __e) _NOE |
| 136 | return current_exception(); | 139 | return current_exception(); |
| 137 | } | 140 | } |
| 138 | } | 141 | } |
| 139 | # endif | 142 | # endif // _LIBCPP_HAS_RTTI && _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION |
| 140 | 143 | ||
| 141 | template <class _Ep> | 144 | template <class _Ep> |
| 142 | _LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_via_throw(_Ep& __e) _NOEXCEPT { | 145 | _LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_via_throw(_Ep& __e) _NOEXCEPT { |
| ... | @@ -164,7 +167,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { | ... | @@ -164,7 +167,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { |
| 164 | return std::__make_exception_ptr_via_throw(__e); | 167 | return std::__make_exception_ptr_via_throw(__e); |
| 165 | } | 168 | } |
| 166 | 169 | ||
| 167 | # if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && !defined(_LIBCPP_CXX03_LANG) | 170 | # if _LIBCPP_HAS_RTTI && _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && !defined(_LIBCPP_CXX03_LANG) |
| 168 | return std::__make_exception_ptr_explicit(__e); | 171 | return std::__make_exception_ptr_explicit(__e); |
| 169 | # else | 172 | # else |
| 170 | return std::__make_exception_ptr_via_throw(__e); | 173 | return std::__make_exception_ptr_via_throw(__e); |
| ... | @@ -177,36 +180,9 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep) _NOEXCEPT { | ... | @@ -177,36 +180,9 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep) _NOEXCEPT { |
| 177 | } | 180 | } |
| 178 | # endif // _LIBCPP_HAS_EXCEPTIONS | 181 | # endif // _LIBCPP_HAS_EXCEPTIONS |
| 179 | 182 | ||
| 180 | #else // _LIBCPP_ABI_MICROSOFT | 183 | #else // defined(_LIBCPP_ABI_MICROSOFT) |
| 181 | |||
| 182 | class _LIBCPP_EXPORTED_FROM_ABI exception_ptr { | ||
| 183 | _LIBCPP_DIAGNOSTIC_PUSH | ||
| 184 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field") | ||
| 185 | void* __ptr1_; | ||
| 186 | void* __ptr2_; | ||
| 187 | _LIBCPP_DIAGNOSTIC_POP | ||
| 188 | |||
| 189 | public: | ||
| 190 | exception_ptr() _NOEXCEPT; | ||
| 191 | exception_ptr(nullptr_t) _NOEXCEPT; | ||
| 192 | exception_ptr(const exception_ptr& __other) _NOEXCEPT; | ||
| 193 | exception_ptr& operator=(const exception_ptr& __other) _NOEXCEPT; | ||
| 194 | exception_ptr& operator=(nullptr_t) _NOEXCEPT; | ||
| 195 | ~exception_ptr() _NOEXCEPT; | ||
| 196 | explicit operator bool() const _NOEXCEPT; | ||
| 197 | }; | ||
| 198 | |||
| 199 | _LIBCPP_EXPORTED_FROM_ABI bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT; | ||
| 200 | |||
| 201 | inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT { | ||
| 202 | return !(__x == __y); | ||
| 203 | } | ||
| 204 | |||
| 205 | _LIBCPP_EXPORTED_FROM_ABI void swap(exception_ptr&, exception_ptr&) _NOEXCEPT; | ||
| 206 | 184 | ||
| 207 | _LIBCPP_EXPORTED_FROM_ABI exception_ptr __copy_exception_ptr(void* __except, const void* __ptr); | 185 | _LIBCPP_EXPORTED_FROM_ABI exception_ptr __copy_exception_ptr(void* __except, const void* __ptr); |
| 208 | _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT; | ||
| 209 | [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr); | ||
| 210 | 186 | ||
| 211 | // This is a built-in template function which automagically extracts the required | 187 | // This is a built-in template function which automagically extracts the required |
| 212 | // information. | 188 | // information. |
| ... | @@ -218,7 +194,9 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { | ... | @@ -218,7 +194,9 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { |
| 218 | return __copy_exception_ptr(std::addressof(__e), __GetExceptionInfo(__e)); | 194 | return __copy_exception_ptr(std::addressof(__e), __GetExceptionInfo(__e)); |
| 219 | } | 195 | } |
| 220 | 196 | ||
| 221 | #endif // _LIBCPP_ABI_MICROSOFT | 197 | #endif // defined(_LIBCPP_ABI_MICROSOFT) |
| 198 | |||
| 199 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 222 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | 200 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD |
| 223 | 201 | ||
| 224 | _LIBCPP_POP_MACROS | 202 | _LIBCPP_POP_MACROS |
lib/libcxx/include/__exception/nested_exception.h+6-6| ... | @@ -14,7 +14,6 @@ | ... | @@ -14,7 +14,6 @@ |
| 14 | #include <__memory/addressof.h> | 14 | #include <__memory/addressof.h> |
| 15 | #include <__type_traits/decay.h> | 15 | #include <__type_traits/decay.h> |
| 16 | #include <__type_traits/enable_if.h> | 16 | #include <__type_traits/enable_if.h> |
| 17 | #include <__type_traits/integral_constant.h> | ||
| 18 | #include <__type_traits/is_base_of.h> | 17 | #include <__type_traits/is_base_of.h> |
| 19 | #include <__type_traits/is_class.h> | 18 | #include <__type_traits/is_class.h> |
| 20 | #include <__type_traits/is_constructible.h> | 19 | #include <__type_traits/is_constructible.h> |
| ... | @@ -28,6 +27,7 @@ | ... | @@ -28,6 +27,7 @@ |
| 28 | #endif | 27 | #endif |
| 29 | 28 | ||
| 30 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD | 29 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD |
| 30 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 31 | 31 | ||
| 32 | class _LIBCPP_EXPORTED_FROM_ABI nested_exception { | 32 | class _LIBCPP_EXPORTED_FROM_ABI nested_exception { |
| 33 | exception_ptr __ptr_; | 33 | exception_ptr __ptr_; |
| ... | @@ -81,20 +81,20 @@ template <class _Tp> | ... | @@ -81,20 +81,20 @@ template <class _Tp> |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | template <class _From, class _To> | 83 | template <class _From, class _To> |
| 84 | struct __can_dynamic_cast | 84 | inline const bool __can_dynamic_cast_v = |
| 85 | : _BoolConstant< is_polymorphic<_From>::value && | 85 | is_polymorphic<_From>::value && (!is_base_of<_To, _From>::value || is_convertible<const _From*, const _To*>::value); |
| 86 | (!is_base_of<_To, _From>::value || is_convertible<const _From*, const _To*>::value)> {}; | ||
| 87 | 86 | ||
| 88 | template <class _Ep, __enable_if_t< __can_dynamic_cast<_Ep, nested_exception>::value, int> = 0> | 87 | template <class _Ep, __enable_if_t<__can_dynamic_cast_v<_Ep, nested_exception>, int> = 0> |
| 89 | inline _LIBCPP_HIDE_FROM_ABI void rethrow_if_nested(const _Ep& __e) { | 88 | inline _LIBCPP_HIDE_FROM_ABI void rethrow_if_nested(const _Ep& __e) { |
| 90 | const nested_exception* __nep = dynamic_cast<const nested_exception*>(std::addressof(__e)); | 89 | const nested_exception* __nep = dynamic_cast<const nested_exception*>(std::addressof(__e)); |
| 91 | if (__nep) | 90 | if (__nep) |
| 92 | __nep->rethrow_nested(); | 91 | __nep->rethrow_nested(); |
| 93 | } | 92 | } |
| 94 | 93 | ||
| 95 | template <class _Ep, __enable_if_t<!__can_dynamic_cast<_Ep, nested_exception>::value, int> = 0> | 94 | template <class _Ep, __enable_if_t<!__can_dynamic_cast_v<_Ep, nested_exception>, int> = 0> |
| 96 | inline _LIBCPP_HIDE_FROM_ABI void rethrow_if_nested(const _Ep&) {} | 95 | inline _LIBCPP_HIDE_FROM_ABI void rethrow_if_nested(const _Ep&) {} |
| 97 | 96 | ||
| 97 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 98 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | 98 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD |
| 99 | 99 | ||
| 100 | #endif // _LIBCPP___EXCEPTION_NESTED_EXCEPTION_H | 100 | #endif // _LIBCPP___EXCEPTION_NESTED_EXCEPTION_H |
lib/libcxx/include/__exception/operations.h+4| ... | @@ -16,6 +16,8 @@ | ... | @@ -16,6 +16,8 @@ |
| 16 | #endif | 16 | #endif |
| 17 | 17 | ||
| 18 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD | 18 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD |
| 19 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 20 | |||
| 19 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) || \ | 21 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) || \ |
| 20 | defined(_LIBCPP_BUILDING_LIBRARY) | 22 | defined(_LIBCPP_BUILDING_LIBRARY) |
| 21 | using unexpected_handler = void (*)(); | 23 | using unexpected_handler = void (*)(); |
| ... | @@ -37,6 +39,8 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_ptr; | ... | @@ -37,6 +39,8 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_ptr; |
| 37 | 39 | ||
| 38 | [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT; | 40 | [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT; |
| 39 | [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr); | 41 | [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr); |
| 42 | |||
| 43 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 40 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | 44 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD |
| 41 | 45 | ||
| 42 | #endif // _LIBCPP___EXCEPTION_OPERATIONS_H | 46 | #endif // _LIBCPP___EXCEPTION_OPERATIONS_H |
lib/libcxx/include/__exception/terminate.h+4| ... | @@ -16,7 +16,11 @@ | ... | @@ -16,7 +16,11 @@ |
| 16 | #endif | 16 | #endif |
| 17 | 17 | ||
| 18 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD | 18 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD |
| 19 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 20 | |||
| 19 | [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void terminate() _NOEXCEPT; | 21 | [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void terminate() _NOEXCEPT; |
| 22 | |||
| 23 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 20 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | 24 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD |
| 21 | 25 | ||
| 22 | #endif // _LIBCPP___EXCEPTION_TERMINATE_H | 26 | #endif // _LIBCPP___EXCEPTION_TERMINATE_H |
lib/libcxx/include/__expected/bad_expected_access.h+2| ... | @@ -23,6 +23,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -23,6 +23,7 @@ _LIBCPP_PUSH_MACROS |
| 23 | #if _LIBCPP_STD_VER >= 23 | 23 | #if _LIBCPP_STD_VER >= 23 |
| 24 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 26 | 27 | ||
| 27 | template <class _Err> | 28 | template <class _Err> |
| 28 | class bad_expected_access; | 29 | class bad_expected_access; |
| ... | @@ -66,6 +67,7 @@ private: | ... | @@ -66,6 +67,7 @@ private: |
| 66 | _Err __unex_; | 67 | _Err __unex_; |
| 67 | }; | 68 | }; |
| 68 | 69 | ||
| 70 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 69 | _LIBCPP_END_NAMESPACE_STD | 71 | _LIBCPP_END_NAMESPACE_STD |
| 70 | 72 | ||
| 71 | #endif // _LIBCPP_STD_VER >= 23 | 73 | #endif // _LIBCPP_STD_VER >= 23 |
lib/libcxx/include/__expected/expected.h+19-13| ... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
| 10 | #define _LIBCPP___EXPECTED_EXPECTED_H | 10 | #define _LIBCPP___EXPECTED_EXPECTED_H |
| 11 | 11 | ||
| 12 | #include <__assert> | 12 | #include <__assert> |
| 13 | #include <__concepts/same_as.h> | ||
| 13 | #include <__config> | 14 | #include <__config> |
| 14 | #include <__expected/bad_expected_access.h> | 15 | #include <__expected/bad_expected_access.h> |
| 15 | #include <__expected/unexpect.h> | 16 | #include <__expected/unexpect.h> |
| ... | @@ -36,7 +37,6 @@ | ... | @@ -36,7 +37,6 @@ |
| 36 | #include <__type_traits/is_trivially_destructible.h> | 37 | #include <__type_traits/is_trivially_destructible.h> |
| 37 | #include <__type_traits/is_trivially_relocatable.h> | 38 | #include <__type_traits/is_trivially_relocatable.h> |
| 38 | #include <__type_traits/is_void.h> | 39 | #include <__type_traits/is_void.h> |
| 39 | #include <__type_traits/lazy.h> | ||
| 40 | #include <__type_traits/negation.h> | 40 | #include <__type_traits/negation.h> |
| 41 | #include <__type_traits/remove_cv.h> | 41 | #include <__type_traits/remove_cv.h> |
| 42 | #include <__type_traits/remove_cvref.h> | 42 | #include <__type_traits/remove_cvref.h> |
| ... | @@ -446,6 +446,10 @@ private: | ... | @@ -446,6 +446,10 @@ private: |
| 446 | _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__allow_reusing_expected_tail_padding, __repr> __repr_; | 446 | _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__allow_reusing_expected_tail_padding, __repr> __repr_; |
| 447 | }; | 447 | }; |
| 448 | 448 | ||
| 449 | // Helper to handle comparisons that produce a value whose type is not bool, | ||
| 450 | // but allows only implicit (and not explicit) conversions to bool. | ||
| 451 | constexpr bool __into_bool(bool __b) noexcept { return __b; } | ||
| 452 | |||
| 449 | template <class _Tp, class _Err> | 453 | template <class _Tp, class _Err> |
| 450 | class expected : private __expected_base<_Tp, _Err> { | 454 | class expected : private __expected_base<_Tp, _Err> { |
| 451 | static_assert(!is_reference_v<_Tp> && !is_function_v<_Tp> && !is_same_v<remove_cv_t<_Tp>, in_place_t> && | 455 | static_assert(!is_reference_v<_Tp> && !is_function_v<_Tp> && !is_same_v<remove_cv_t<_Tp>, in_place_t> && |
| ... | @@ -684,12 +688,11 @@ public: | ... | @@ -684,12 +688,11 @@ public: |
| 684 | private: | 688 | private: |
| 685 | template <class _OtherErrQual> | 689 | template <class _OtherErrQual> |
| 686 | static constexpr bool __can_assign_from_unexpected = | 690 | static constexpr bool __can_assign_from_unexpected = |
| 687 | _And< is_constructible<_Err, _OtherErrQual>, | 691 | _And<is_constructible<_Err, _OtherErrQual>, |
| 688 | is_assignable<_Err&, _OtherErrQual>, | 692 | is_assignable<_Err&, _OtherErrQual>, |
| 689 | _Lazy<_Or, | 693 | _Or<is_nothrow_constructible<_Err, _OtherErrQual>, |
| 690 | is_nothrow_constructible<_Err, _OtherErrQual>, | 694 | is_nothrow_move_constructible<_Tp>, |
| 691 | is_nothrow_move_constructible<_Tp>, | 695 | is_nothrow_move_constructible<_Err>>>::value; |
| 692 | is_nothrow_move_constructible<_Err>> >::value; | ||
| 693 | 696 | ||
| 694 | public: | 697 | public: |
| 695 | template <class _OtherErr> | 698 | template <class _OtherErr> |
| ... | @@ -1161,15 +1164,18 @@ public: | ... | @@ -1161,15 +1164,18 @@ public: |
| 1161 | } | 1164 | } |
| 1162 | } | 1165 | } |
| 1163 | 1166 | ||
| 1164 | template <class _T2> | 1167 | // The unusual signature avoids constraint recursion via ADL through |
| 1165 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const _T2& __v) | 1168 | // std::expected, see https://llvm.org/PR160431. Note that this only |
| 1169 | // triggers with compilers that implement https://wg21.link/CWG2369. | ||
| 1170 | template <class _T2, same_as<_Tp> _Tp2> | ||
| 1171 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected<_Tp2, _Err>& __x, const _T2& __v) | ||
| 1166 | # if _LIBCPP_STD_VER >= 26 | 1172 | # if _LIBCPP_STD_VER >= 26 |
| 1167 | requires(!__is_std_expected<_T2>::value) && requires { | 1173 | requires(!__is_std_expected<_T2>::value) && requires { |
| 1168 | { *__x == __v } -> __core_convertible_to<bool>; | 1174 | { *__x == __v } -> __core_convertible_to<bool>; |
| 1169 | } | 1175 | } |
| 1170 | # endif | 1176 | # endif |
| 1171 | { | 1177 | { |
| 1172 | return __x.__has_val() && static_cast<bool>(__x.__val() == __v); | 1178 | return __x.__has_val() && std::__into_bool(__x.__val() == __v); |
| 1173 | } | 1179 | } |
| 1174 | 1180 | ||
| 1175 | template <class _E2> | 1181 | template <class _E2> |
| ... | @@ -1180,7 +1186,7 @@ public: | ... | @@ -1180,7 +1186,7 @@ public: |
| 1180 | } | 1186 | } |
| 1181 | # endif | 1187 | # endif |
| 1182 | { | 1188 | { |
| 1183 | return !__x.__has_val() && static_cast<bool>(__x.__unex() == __e.error()); | 1189 | return !__x.__has_val() && std::__into_bool(__x.__unex() == __e.error()); |
| 1184 | } | 1190 | } |
| 1185 | }; | 1191 | }; |
| 1186 | 1192 | ||
| ... | @@ -1882,7 +1888,7 @@ public: | ... | @@ -1882,7 +1888,7 @@ public: |
| 1882 | if (__x.__has_val() != __y.__has_val()) { | 1888 | if (__x.__has_val() != __y.__has_val()) { |
| 1883 | return false; | 1889 | return false; |
| 1884 | } else { | 1890 | } else { |
| 1885 | return __x.__has_val() || static_cast<bool>(__x.__unex() == __y.__unex()); | 1891 | return __x.__has_val() || std::__into_bool(__x.__unex() == __y.__unex()); |
| 1886 | } | 1892 | } |
| 1887 | } | 1893 | } |
| 1888 | 1894 | ||
| ... | @@ -1894,7 +1900,7 @@ public: | ... | @@ -1894,7 +1900,7 @@ public: |
| 1894 | } | 1900 | } |
| 1895 | # endif | 1901 | # endif |
| 1896 | { | 1902 | { |
| 1897 | return !__x.__has_val() && static_cast<bool>(__x.__unex() == __y.error()); | 1903 | return !__x.__has_val() && std::__into_bool(__x.__unex() == __y.error()); |
| 1898 | } | 1904 | } |
| 1899 | }; | 1905 | }; |
| 1900 | 1906 |
lib/libcxx/include/__filesystem/directory_entry.h+2| ... | @@ -39,6 +39,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -39,6 +39,7 @@ _LIBCPP_PUSH_MACROS |
| 39 | #if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM | 39 | #if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM |
| 40 | 40 | ||
| 41 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 41 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 42 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 42 | 43 | ||
| 43 | class directory_entry { | 44 | class directory_entry { |
| 44 | typedef filesystem::path _Path; | 45 | typedef filesystem::path _Path; |
| ... | @@ -465,6 +466,7 @@ private: | ... | @@ -465,6 +466,7 @@ private: |
| 465 | directory_entry __elem_; | 466 | directory_entry __elem_; |
| 466 | }; | 467 | }; |
| 467 | 468 | ||
| 469 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 468 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 470 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
| 469 | 471 | ||
| 470 | #endif // _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM | 472 | #endif // _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM |
lib/libcxx/include/__filesystem/directory_iterator.h+2| ... | @@ -33,6 +33,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -33,6 +33,7 @@ _LIBCPP_PUSH_MACROS |
| 33 | #if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM | 33 | #if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM |
| 34 | 34 | ||
| 35 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 35 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 36 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 36 | 37 | ||
| 37 | class _LIBCPP_HIDDEN __dir_stream; | 38 | class _LIBCPP_HIDDEN __dir_stream; |
| 38 | class directory_iterator { | 39 | class directory_iterator { |
| ... | @@ -129,6 +130,7 @@ operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) noe | ... | @@ -129,6 +130,7 @@ operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) noe |
| 129 | return directory_iterator(); | 130 | return directory_iterator(); |
| 130 | } | 131 | } |
| 131 | 132 | ||
| 133 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 132 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 134 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
| 133 | 135 | ||
| 134 | # if _LIBCPP_STD_VER >= 20 | 136 | # if _LIBCPP_STD_VER >= 20 |
lib/libcxx/include/__filesystem/filesystem_error.h+2| ... | @@ -26,6 +26,7 @@ | ... | @@ -26,6 +26,7 @@ |
| 26 | #if _LIBCPP_STD_VER >= 17 | 26 | #if _LIBCPP_STD_VER >= 17 |
| 27 | 27 | ||
| 28 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 28 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 29 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 29 | 30 | ||
| 30 | class _LIBCPP_EXPORTED_FROM_ABI filesystem_error : public system_error { | 31 | class _LIBCPP_EXPORTED_FROM_ABI filesystem_error : public system_error { |
| 31 | public: | 32 | public: |
| ... | @@ -80,6 +81,7 @@ template <class... _Args> | ... | @@ -80,6 +81,7 @@ template <class... _Args> |
| 80 | } | 81 | } |
| 81 | # endif | 82 | # endif |
| 82 | 83 | ||
| 84 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 83 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 85 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
| 84 | 86 | ||
| 85 | #endif // _LIBCPP_STD_VER >= 17 | 87 | #endif // _LIBCPP_STD_VER >= 17 |
lib/libcxx/include/__filesystem/operations.h+2| ... | @@ -31,6 +31,7 @@ | ... | @@ -31,6 +31,7 @@ |
| 31 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 32 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 33 | 33 | ||
| 34 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 34 | _LIBCPP_EXPORTED_FROM_ABI path __absolute(const path&, error_code* __ec = nullptr); | 35 | _LIBCPP_EXPORTED_FROM_ABI path __absolute(const path&, error_code* __ec = nullptr); |
| 35 | _LIBCPP_EXPORTED_FROM_ABI path __canonical(const path&, error_code* __ec = nullptr); | 36 | _LIBCPP_EXPORTED_FROM_ABI path __canonical(const path&, error_code* __ec = nullptr); |
| 36 | _LIBCPP_EXPORTED_FROM_ABI bool | 37 | _LIBCPP_EXPORTED_FROM_ABI bool |
| ... | @@ -67,6 +68,7 @@ _LIBCPP_EXPORTED_FROM_ABI path __temp_directory_path(error_code* __ec = nullptr) | ... | @@ -67,6 +68,7 @@ _LIBCPP_EXPORTED_FROM_ABI path __temp_directory_path(error_code* __ec = nullptr) |
| 67 | _LIBCPP_EXPORTED_FROM_ABI bool __fs_is_empty(const path& __p, error_code* __ec = nullptr); | 68 | _LIBCPP_EXPORTED_FROM_ABI bool __fs_is_empty(const path& __p, error_code* __ec = nullptr); |
| 68 | _LIBCPP_EXPORTED_FROM_ABI void __permissions(const path&, perms, perm_options, error_code* = nullptr); | 69 | _LIBCPP_EXPORTED_FROM_ABI void __permissions(const path&, perms, perm_options, error_code* = nullptr); |
| 69 | _LIBCPP_EXPORTED_FROM_ABI space_info __space(const path&, error_code* __ec = nullptr); | 70 | _LIBCPP_EXPORTED_FROM_ABI space_info __space(const path&, error_code* __ec = nullptr); |
| 71 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 70 | 72 | ||
| 71 | [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p) { return __absolute(__p); } | 73 | [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p) { return __absolute(__p); } |
| 72 | [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p, error_code& __ec) { | 74 | [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p, error_code& __ec) { |
lib/libcxx/include/__filesystem/path.h+37-52| ... | @@ -23,6 +23,7 @@ | ... | @@ -23,6 +23,7 @@ |
| 23 | #include <__type_traits/is_pointer.h> | 23 | #include <__type_traits/is_pointer.h> |
| 24 | #include <__type_traits/remove_const.h> | 24 | #include <__type_traits/remove_const.h> |
| 25 | #include <__type_traits/remove_pointer.h> | 25 | #include <__type_traits/remove_pointer.h> |
| 26 | #include <__type_traits/void_t.h> | ||
| 26 | #include <__utility/move.h> | 27 | #include <__utility/move.h> |
| 27 | #include <string> | 28 | #include <string> |
| 28 | #include <string_view> | 29 | #include <string_view> |
| ... | @@ -41,6 +42,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -41,6 +42,7 @@ _LIBCPP_PUSH_MACROS |
| 41 | #if _LIBCPP_STD_VER >= 17 | 42 | #if _LIBCPP_STD_VER >= 17 |
| 42 | 43 | ||
| 43 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 44 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 45 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 44 | 46 | ||
| 45 | template <class _Tp> | 47 | template <class _Tp> |
| 46 | struct __can_convert_char { | 48 | struct __can_convert_char { |
| ... | @@ -93,15 +95,12 @@ typedef string __u8_string; | ... | @@ -93,15 +95,12 @@ typedef string __u8_string; |
| 93 | 95 | ||
| 94 | struct _NullSentinel {}; | 96 | struct _NullSentinel {}; |
| 95 | 97 | ||
| 96 | template <class _Tp> | ||
| 97 | using _Void _LIBCPP_NODEBUG = void; | ||
| 98 | |||
| 99 | template <class _Tp, class = void> | 98 | template <class _Tp, class = void> |
| 100 | struct __is_pathable_string : public false_type {}; | 99 | struct __is_pathable_string : public false_type {}; |
| 101 | 100 | ||
| 102 | template <class _ECharT, class _Traits, class _Alloc> | 101 | template <class _ECharT, class _Traits, class _Alloc> |
| 103 | struct __is_pathable_string< basic_string<_ECharT, _Traits, _Alloc>, | 102 | struct __is_pathable_string< basic_string<_ECharT, _Traits, _Alloc>, |
| 104 | _Void<typename __can_convert_char<_ECharT>::__char_type> > | 103 | void_t<typename __can_convert_char<_ECharT>::__char_type> > |
| 105 | : public __can_convert_char<_ECharT> { | 104 | : public __can_convert_char<_ECharT> { |
| 106 | using _Str _LIBCPP_NODEBUG = basic_string<_ECharT, _Traits, _Alloc>; | 105 | using _Str _LIBCPP_NODEBUG = basic_string<_ECharT, _Traits, _Alloc>; |
| 107 | 106 | ||
| ... | @@ -114,7 +113,7 @@ struct __is_pathable_string< basic_string<_ECharT, _Traits, _Alloc>, | ... | @@ -114,7 +113,7 @@ struct __is_pathable_string< basic_string<_ECharT, _Traits, _Alloc>, |
| 114 | 113 | ||
| 115 | template <class _ECharT, class _Traits> | 114 | template <class _ECharT, class _Traits> |
| 116 | struct __is_pathable_string< basic_string_view<_ECharT, _Traits>, | 115 | struct __is_pathable_string< basic_string_view<_ECharT, _Traits>, |
| 117 | _Void<typename __can_convert_char<_ECharT>::__char_type> > | 116 | void_t<typename __can_convert_char<_ECharT>::__char_type> > |
| 118 | : public __can_convert_char<_ECharT> { | 117 | : public __can_convert_char<_ECharT> { |
| 119 | using _Str _LIBCPP_NODEBUG = basic_string_view<_ECharT, _Traits>; | 118 | using _Str _LIBCPP_NODEBUG = basic_string_view<_ECharT, _Traits>; |
| 120 | 119 | ||
| ... | @@ -154,7 +153,7 @@ template <class _Iter> | ... | @@ -154,7 +153,7 @@ template <class _Iter> |
| 154 | struct __is_pathable_iter< | 153 | struct __is_pathable_iter< |
| 155 | _Iter, | 154 | _Iter, |
| 156 | true, | 155 | true, |
| 157 | _Void<typename __can_convert_char< typename iterator_traits<_Iter>::value_type>::__char_type> > | 156 | void_t<typename __can_convert_char< typename iterator_traits<_Iter>::value_type>::__char_type> > |
| 158 | : __can_convert_char<typename iterator_traits<_Iter>::value_type> { | 157 | : __can_convert_char<typename iterator_traits<_Iter>::value_type> { |
| 159 | using _ECharT _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::value_type; | 158 | using _ECharT _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::value_type; |
| 160 | 159 | ||
| ... | @@ -261,15 +260,14 @@ struct _PathCVT { | ... | @@ -261,15 +260,14 @@ struct _PathCVT { |
| 261 | 260 | ||
| 262 | template <> | 261 | template <> |
| 263 | struct _PathCVT<__path_value> { | 262 | struct _PathCVT<__path_value> { |
| 264 | template <class _Iter, __enable_if_t<__has_exactly_input_iterator_category<_Iter>::value, int> = 0> | 263 | template <class _Iter> |
| 265 | _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) { | ||
| 266 | for (; __b != __e; ++__b) | ||
| 267 | __dest.push_back(*__b); | ||
| 268 | } | ||
| 269 | |||
| 270 | template <class _Iter, __enable_if_t<__has_forward_iterator_category<_Iter>::value, int> = 0> | ||
| 271 | _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) { | 264 | _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) { |
| 272 | __dest.append(__b, __e); | 265 | if constexpr (__has_forward_iterator_category<_Iter>::value) { |
| 266 | __dest.append(__b, __e); | ||
| 267 | } else { | ||
| 268 | for (; __b != __e; ++__b) | ||
| 269 | __dest.push_back(*__b); | ||
| 270 | } | ||
| 273 | } | 271 | } |
| 274 | 272 | ||
| 275 | template <class _Iter> | 273 | template <class _Iter> |
| ... | @@ -296,13 +294,7 @@ struct _PathCVT<char> { | ... | @@ -296,13 +294,7 @@ struct _PathCVT<char> { |
| 296 | __char_to_wide(__str, const_cast<__path_value*>(__dest.data()) + __pos, __size); | 294 | __char_to_wide(__str, const_cast<__path_value*>(__dest.data()) + __pos, __size); |
| 297 | } | 295 | } |
| 298 | 296 | ||
| 299 | template <class _Iter, __enable_if_t<__has_exactly_input_iterator_category<_Iter>::value, int> = 0> | 297 | template <class _Iter> |
| 300 | _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) { | ||
| 301 | basic_string<char> __tmp(__b, __e); | ||
| 302 | __append_string(__dest, __tmp); | ||
| 303 | } | ||
| 304 | |||
| 305 | template <class _Iter, __enable_if_t<__has_forward_iterator_category<_Iter>::value, int> = 0> | ||
| 306 | _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) { | 298 | _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) { |
| 307 | basic_string<char> __tmp(__b, __e); | 299 | basic_string<char> __tmp(__b, __e); |
| 308 | __append_string(__dest, __tmp); | 300 | __append_string(__dest, __tmp); |
| ... | @@ -449,7 +441,7 @@ public: | ... | @@ -449,7 +441,7 @@ public: |
| 449 | return *this; | 441 | return *this; |
| 450 | } | 442 | } |
| 451 | 443 | ||
| 452 | _LIBCPP_HIDE_FROM_ABI path& assign(string_type&& __s) noexcept { | 444 | _LIBCPP_HIDE_FROM_ABI path& assign(string_type&& __s) noexcept _LIBCPP_LIFETIMEBOUND { |
| 453 | __pn_ = std::move(__s); | 445 | __pn_ = std::move(__s); |
| 454 | return *this; | 446 | return *this; |
| 455 | } | 447 | } |
| ... | @@ -460,14 +452,14 @@ public: | ... | @@ -460,14 +452,14 @@ public: |
| 460 | } | 452 | } |
| 461 | 453 | ||
| 462 | template <class _Source> | 454 | template <class _Source> |
| 463 | _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> assign(const _Source& __src) { | 455 | _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> assign(const _Source& __src) _LIBCPP_LIFETIMEBOUND { |
| 464 | __pn_.clear(); | 456 | __pn_.clear(); |
| 465 | _SourceCVT<_Source>::__append_source(__pn_, __src); | 457 | _SourceCVT<_Source>::__append_source(__pn_, __src); |
| 466 | return *this; | 458 | return *this; |
| 467 | } | 459 | } |
| 468 | 460 | ||
| 469 | template <class _InputIt> | 461 | template <class _InputIt> |
| 470 | _LIBCPP_HIDE_FROM_ABI path& assign(_InputIt __first, _InputIt __last) { | 462 | _LIBCPP_HIDE_FROM_ABI path& assign(_InputIt __first, _InputIt __last) _LIBCPP_LIFETIMEBOUND { |
| 471 | typedef typename iterator_traits<_InputIt>::value_type _ItVal; | 463 | typedef typename iterator_traits<_InputIt>::value_type _ItVal; |
| 472 | __pn_.clear(); | 464 | __pn_.clear(); |
| 473 | _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); | 465 | _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); |
| ... | @@ -501,12 +493,12 @@ public: | ... | @@ -501,12 +493,12 @@ public: |
| 501 | } | 493 | } |
| 502 | 494 | ||
| 503 | template <class _Source> | 495 | template <class _Source> |
| 504 | _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) { | 496 | _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) _LIBCPP_LIFETIMEBOUND { |
| 505 | return operator/=(path(__src)); | 497 | return operator/=(path(__src)); |
| 506 | } | 498 | } |
| 507 | 499 | ||
| 508 | template <class _InputIt> | 500 | template <class _InputIt> |
| 509 | _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) { | 501 | _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) _LIBCPP_LIFETIMEBOUND { |
| 510 | return operator/=(path(__first, __last)); | 502 | return operator/=(path(__first, __last)); |
| 511 | } | 503 | } |
| 512 | # else | 504 | # else |
| ... | @@ -530,7 +522,7 @@ public: | ... | @@ -530,7 +522,7 @@ public: |
| 530 | } | 522 | } |
| 531 | 523 | ||
| 532 | template <class _Source> | 524 | template <class _Source> |
| 533 | _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) { | 525 | _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) _LIBCPP_LIFETIMEBOUND { |
| 534 | using _Traits = __is_pathable<_Source>; | 526 | using _Traits = __is_pathable<_Source>; |
| 535 | using _CVT = _PathCVT<_SourceChar<_Source> >; | 527 | using _CVT = _PathCVT<_SourceChar<_Source> >; |
| 536 | bool __source_is_absolute = filesystem::__is_separator(_Traits::__first_or_null(__src)); | 528 | bool __source_is_absolute = filesystem::__is_separator(_Traits::__first_or_null(__src)); |
| ... | @@ -543,7 +535,7 @@ public: | ... | @@ -543,7 +535,7 @@ public: |
| 543 | } | 535 | } |
| 544 | 536 | ||
| 545 | template <class _InputIt> | 537 | template <class _InputIt> |
| 546 | _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) { | 538 | _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) _LIBCPP_LIFETIMEBOUND { |
| 547 | typedef typename iterator_traits<_InputIt>::value_type _ItVal; | 539 | typedef typename iterator_traits<_InputIt>::value_type _ItVal; |
| 548 | static_assert(__can_convert_char<_ItVal>::value, "Must convertible"); | 540 | static_assert(__can_convert_char<_ItVal>::value, "Must convertible"); |
| 549 | using _CVT = _PathCVT<_ItVal>; | 541 | using _CVT = _PathCVT<_ItVal>; |
| ... | @@ -594,13 +586,13 @@ public: | ... | @@ -594,13 +586,13 @@ public: |
| 594 | } | 586 | } |
| 595 | 587 | ||
| 596 | template <class _Source> | 588 | template <class _Source> |
| 597 | _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> concat(const _Source& __x) { | 589 | _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> concat(const _Source& __x) _LIBCPP_LIFETIMEBOUND { |
| 598 | _SourceCVT<_Source>::__append_source(__pn_, __x); | 590 | _SourceCVT<_Source>::__append_source(__pn_, __x); |
| 599 | return *this; | 591 | return *this; |
| 600 | } | 592 | } |
| 601 | 593 | ||
| 602 | template <class _InputIt> | 594 | template <class _InputIt> |
| 603 | _LIBCPP_HIDE_FROM_ABI path& concat(_InputIt __first, _InputIt __last) { | 595 | _LIBCPP_HIDE_FROM_ABI path& concat(_InputIt __first, _InputIt __last) _LIBCPP_LIFETIMEBOUND { |
| 604 | typedef typename iterator_traits<_InputIt>::value_type _ItVal; | 596 | typedef typename iterator_traits<_InputIt>::value_type _ItVal; |
| 605 | _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); | 597 | _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); |
| 606 | return *this; | 598 | return *this; |
| ... | @@ -609,26 +601,26 @@ public: | ... | @@ -609,26 +601,26 @@ public: |
| 609 | // modifiers | 601 | // modifiers |
| 610 | _LIBCPP_HIDE_FROM_ABI void clear() noexcept { __pn_.clear(); } | 602 | _LIBCPP_HIDE_FROM_ABI void clear() noexcept { __pn_.clear(); } |
| 611 | 603 | ||
| 612 | _LIBCPP_HIDE_FROM_ABI path& make_preferred() { | 604 | _LIBCPP_HIDE_FROM_ABI path& make_preferred() _LIBCPP_LIFETIMEBOUND { |
| 613 | # if defined(_LIBCPP_WIN32API) | 605 | # if defined(_LIBCPP_WIN32API) |
| 614 | std::replace(__pn_.begin(), __pn_.end(), L'/', L'\\'); | 606 | std::replace(__pn_.begin(), __pn_.end(), L'/', L'\\'); |
| 615 | # endif | 607 | # endif |
| 616 | return *this; | 608 | return *this; |
| 617 | } | 609 | } |
| 618 | 610 | ||
| 619 | _LIBCPP_HIDE_FROM_ABI path& remove_filename() { | 611 | _LIBCPP_HIDE_FROM_ABI path& remove_filename() _LIBCPP_LIFETIMEBOUND { |
| 620 | auto __fname = __filename(); | 612 | auto __fname = __filename(); |
| 621 | if (!__fname.empty()) | 613 | if (!__fname.empty()) |
| 622 | __pn_.erase(__fname.data() - __pn_.data()); | 614 | __pn_.erase(__fname.data() - __pn_.data()); |
| 623 | return *this; | 615 | return *this; |
| 624 | } | 616 | } |
| 625 | 617 | ||
| 626 | _LIBCPP_HIDE_FROM_ABI path& replace_filename(const path& __replacement) { | 618 | _LIBCPP_HIDE_FROM_ABI path& replace_filename(const path& __replacement) _LIBCPP_LIFETIMEBOUND { |
| 627 | remove_filename(); | 619 | remove_filename(); |
| 628 | return (*this /= __replacement); | 620 | return (*this /= __replacement); |
| 629 | } | 621 | } |
| 630 | 622 | ||
| 631 | path& replace_extension(const path& __replacement = path()); | 623 | path& replace_extension(const path& __replacement = path()) _LIBCPP_LIFETIMEBOUND; |
| 632 | 624 | ||
| 633 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const path& __lhs, const path& __rhs) noexcept { | 625 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const path& __lhs, const path& __rhs) noexcept { |
| 634 | return __lhs.__compare(__rhs.__pn_) == 0; | 626 | return __lhs.__compare(__rhs.__pn_) == 0; |
| ... | @@ -667,9 +659,11 @@ public: | ... | @@ -667,9 +659,11 @@ public: |
| 667 | _LIBCPP_HIDE_FROM_ABI void __reserve(size_t __s) { __pn_.reserve(__s); } | 659 | _LIBCPP_HIDE_FROM_ABI void __reserve(size_t __s) { __pn_.reserve(__s); } |
| 668 | 660 | ||
| 669 | // native format observers | 661 | // native format observers |
| 670 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const string_type& native() const noexcept { return __pn_; } | 662 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const string_type& native() const noexcept _LIBCPP_LIFETIMEBOUND { return __pn_; } |
| 671 | 663 | ||
| 672 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const value_type* c_str() const noexcept { return __pn_.c_str(); } | 664 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const value_type* c_str() const noexcept _LIBCPP_LIFETIMEBOUND { |
| 665 | return __pn_.c_str(); | ||
| 666 | } | ||
| 673 | 667 | ||
| 674 | _LIBCPP_HIDE_FROM_ABI operator string_type() const { return __pn_; } | 668 | _LIBCPP_HIDE_FROM_ABI operator string_type() const { return __pn_; } |
| 675 | 669 | ||
| ... | @@ -874,23 +868,13 @@ public: | ... | @@ -874,23 +868,13 @@ public: |
| 874 | [[nodiscard]] iterator end() const; | 868 | [[nodiscard]] iterator end() const; |
| 875 | 869 | ||
| 876 | # if _LIBCPP_HAS_LOCALIZATION | 870 | # if _LIBCPP_HAS_LOCALIZATION |
| 877 | template < | 871 | template <class _CharT, class _Traits> |
| 878 | class _CharT, | ||
| 879 | class _Traits, | ||
| 880 | __enable_if_t<is_same<_CharT, value_type>::value && is_same<_Traits, char_traits<value_type> >::value, int> = 0> | ||
| 881 | _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>& | ||
| 882 | operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { | ||
| 883 | __os << std::__quoted(__p.native()); | ||
| 884 | return __os; | ||
| 885 | } | ||
| 886 | |||
| 887 | template < | ||
| 888 | class _CharT, | ||
| 889 | class _Traits, | ||
| 890 | __enable_if_t<!is_same<_CharT, value_type>::value || !is_same<_Traits, char_traits<value_type> >::value, int> = 0> | ||
| 891 | _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>& | 872 | _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>& |
| 892 | operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { | 873 | operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { |
| 893 | __os << std::__quoted(__p.string<_CharT, _Traits>()); | 874 | if constexpr (is_same<_CharT, value_type>::value && is_same<_Traits, char_traits<value_type> >::value) |
| 875 | __os << std::quoted(__p.native()); | ||
| 876 | else | ||
| 877 | __os << std::quoted(__p.string<_CharT, _Traits>()); | ||
| 894 | return __os; | 878 | return __os; |
| 895 | } | 879 | } |
| 896 | 880 | ||
| ... | @@ -898,7 +882,7 @@ public: | ... | @@ -898,7 +882,7 @@ public: |
| 898 | _LIBCPP_HIDE_FROM_ABI friend basic_istream<_CharT, _Traits>& | 882 | _LIBCPP_HIDE_FROM_ABI friend basic_istream<_CharT, _Traits>& |
| 899 | operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) { | 883 | operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) { |
| 900 | basic_string<_CharT, _Traits> __tmp; | 884 | basic_string<_CharT, _Traits> __tmp; |
| 901 | __is >> std::__quoted(__tmp); | 885 | __is >> std::quoted(__tmp); |
| 902 | __p = __tmp; | 886 | __p = __tmp; |
| 903 | return __is; | 887 | return __is; |
| 904 | } | 888 | } |
| ... | @@ -916,6 +900,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(path& __lhs, path& __rhs) noexcept { __lh | ... | @@ -916,6 +900,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(path& __lhs, path& __rhs) noexcept { __lh |
| 916 | 900 | ||
| 917 | [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI size_t hash_value(const path& __p) noexcept; | 901 | [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI size_t hash_value(const path& __p) noexcept; |
| 918 | 902 | ||
| 903 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 919 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 904 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
| 920 | 905 | ||
| 921 | _LIBCPP_BEGIN_NAMESPACE_STD | 906 | _LIBCPP_BEGIN_NAMESPACE_STD |
lib/libcxx/include/__filesystem/path_iterator.h+2| ... | @@ -22,6 +22,7 @@ | ... | @@ -22,6 +22,7 @@ |
| 22 | #if _LIBCPP_STD_VER >= 17 | 22 | #if _LIBCPP_STD_VER >= 17 |
| 23 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 24 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 25 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 25 | 26 | ||
| 26 | class _LIBCPP_EXPORTED_FROM_ABI path::iterator { | 27 | class _LIBCPP_EXPORTED_FROM_ABI path::iterator { |
| 27 | public: | 28 | public: |
| ... | @@ -103,6 +104,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const path::iterator& __lhs, const | ... | @@ -103,6 +104,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const path::iterator& __lhs, const |
| 103 | return !(__lhs == __rhs); | 104 | return !(__lhs == __rhs); |
| 104 | } | 105 | } |
| 105 | 106 | ||
| 107 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 106 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 108 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
| 107 | 109 | ||
| 108 | #endif // _LIBCPP_STD_VER >= 17 | 110 | #endif // _LIBCPP_STD_VER >= 17 |
lib/libcxx/include/__filesystem/recursive_directory_iterator.h+2| ... | @@ -32,6 +32,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -32,6 +32,7 @@ _LIBCPP_PUSH_MACROS |
| 32 | #if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM | 32 | #if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM |
| 33 | 33 | ||
| 34 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 34 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 35 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 35 | 36 | ||
| 36 | class recursive_directory_iterator { | 37 | class recursive_directory_iterator { |
| 37 | public: | 38 | public: |
| ... | @@ -139,6 +140,7 @@ begin(recursive_directory_iterator __iter) noexcept { | ... | @@ -139,6 +140,7 @@ begin(recursive_directory_iterator __iter) noexcept { |
| 139 | return recursive_directory_iterator(); | 140 | return recursive_directory_iterator(); |
| 140 | } | 141 | } |
| 141 | 142 | ||
| 143 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 142 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 144 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
| 143 | 145 | ||
| 144 | # if _LIBCPP_STD_VER >= 20 | 146 | # if _LIBCPP_STD_VER >= 20 |
lib/libcxx/include/__flat_map/flat_multimap.h-9| ... | @@ -934,15 +934,6 @@ private: | ... | @@ -934,15 +934,6 @@ private: |
| 934 | 934 | ||
| 935 | containers __containers_; | 935 | containers __containers_; |
| 936 | _LIBCPP_NO_UNIQUE_ADDRESS key_compare __compare_; | 936 | _LIBCPP_NO_UNIQUE_ADDRESS key_compare __compare_; |
| 937 | |||
| 938 | struct __key_equiv { | ||
| 939 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __key_equiv(key_compare __c) : __comp_(__c) {} | ||
| 940 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool | ||
| 941 | operator()(const_reference __x, const_reference __y) const { | ||
| 942 | return !__comp_(std::get<0>(__x), std::get<0>(__y)) && !__comp_(std::get<0>(__y), std::get<0>(__x)); | ||
| 943 | } | ||
| 944 | key_compare __comp_; | ||
| 945 | }; | ||
| 946 | }; | 937 | }; |
| 947 | 938 | ||
| 948 | template <class _KeyContainer, class _MappedContainer, class _Compare = less<typename _KeyContainer::value_type>> | 939 | template <class _KeyContainer, class _MappedContainer, class _Compare = less<typename _KeyContainer::value_type>> |
lib/libcxx/include/__flat_set/flat_multiset.h-9| ... | @@ -745,15 +745,6 @@ private: | ... | @@ -745,15 +745,6 @@ private: |
| 745 | 745 | ||
| 746 | _KeyContainer __keys_; | 746 | _KeyContainer __keys_; |
| 747 | _LIBCPP_NO_UNIQUE_ADDRESS key_compare __compare_; | 747 | _LIBCPP_NO_UNIQUE_ADDRESS key_compare __compare_; |
| 748 | |||
| 749 | struct __key_equiv { | ||
| 750 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __key_equiv(key_compare __c) : __comp_(__c) {} | ||
| 751 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool | ||
| 752 | operator()(const_reference __x, const_reference __y) const { | ||
| 753 | return !__comp_(std::get<0>(__x), std::get<0>(__y)) && !__comp_(std::get<0>(__y), std::get<0>(__x)); | ||
| 754 | } | ||
| 755 | key_compare __comp_; | ||
| 756 | }; | ||
| 757 | }; | 748 | }; |
| 758 | 749 | ||
| 759 | template <class _KeyContainer, class _Compare = less<typename _KeyContainer::value_type>> | 750 | template <class _KeyContainer, class _Compare = less<typename _KeyContainer::value_type>> |
lib/libcxx/include/__format/container_adaptor.h+4-4| ... | @@ -24,10 +24,10 @@ | ... | @@ -24,10 +24,10 @@ |
| 24 | #include <__type_traits/is_const.h> | 24 | #include <__type_traits/is_const.h> |
| 25 | #include <__type_traits/maybe_const.h> | 25 | #include <__type_traits/maybe_const.h> |
| 26 | 26 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 28 | |||
| 29 | #if _LIBCPP_STD_VER >= 23 | 27 | #if _LIBCPP_STD_VER >= 23 |
| 30 | 28 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 30 | |||
| 31 | // [container.adaptors.format] only specifies the library should provide the | 31 | // [container.adaptors.format] only specifies the library should provide the |
| 32 | // formatter specializations, not which header should provide them. | 32 | // formatter specializations, not which header should provide them. |
| 33 | // Since <format> includes a lot of headers, add these headers here instead of | 33 | // Since <format> includes a lot of headers, add these headers here instead of |
| ... | @@ -66,8 +66,8 @@ template <class _CharT, class _Tp, formattable<_CharT> _Container> | ... | @@ -66,8 +66,8 @@ template <class _CharT, class _Tp, formattable<_CharT> _Container> |
| 66 | struct formatter<stack<_Tp, _Container>, _CharT> | 66 | struct formatter<stack<_Tp, _Container>, _CharT> |
| 67 | : public __formatter_container_adaptor<stack<_Tp, _Container>, _CharT> {}; | 67 | : public __formatter_container_adaptor<stack<_Tp, _Container>, _CharT> {}; |
| 68 | 68 | ||
| 69 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 70 | |||
| 71 | _LIBCPP_END_NAMESPACE_STD | 69 | _LIBCPP_END_NAMESPACE_STD |
| 72 | 70 | ||
| 71 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 72 | |||
| 73 | #endif // _LIBCPP___FORMAT_CONTAINER_ADAPTOR_H | 73 | #endif // _LIBCPP___FORMAT_CONTAINER_ADAPTOR_H |
lib/libcxx/include/__format/enable_insertable.h+4-4| ... | @@ -16,10 +16,10 @@ | ... | @@ -16,10 +16,10 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | #if _LIBCPP_STD_VER >= 20 | 19 | #if _LIBCPP_STD_VER >= 20 |
| 22 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | namespace __format { | 23 | namespace __format { |
| 24 | 24 | ||
| 25 | /// Opt-in to enable \ref __insertable for a \a _Container. | 25 | /// Opt-in to enable \ref __insertable for a \a _Container. |
| ... | @@ -28,8 +28,8 @@ inline constexpr bool __enable_insertable = false; | ... | @@ -28,8 +28,8 @@ inline constexpr bool __enable_insertable = false; |
| 28 | 28 | ||
| 29 | } // namespace __format | 29 | } // namespace __format |
| 30 | 30 | ||
| 31 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 32 | |||
| 33 | _LIBCPP_END_NAMESPACE_STD | 31 | _LIBCPP_END_NAMESPACE_STD |
| 34 | 32 | ||
| 33 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 34 | |||
| 35 | #endif // _LIBCPP___FORMAT_ENABLE_INSERTABLE_H | 35 | #endif // _LIBCPP___FORMAT_ENABLE_INSERTABLE_H |
lib/libcxx/include/__format/escaped_output_table.h+7-6| ... | @@ -61,19 +61,20 @@ | ... | @@ -61,19 +61,20 @@ |
| 61 | #ifndef _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H | 61 | #ifndef _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H |
| 62 | #define _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H | 62 | #define _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H |
| 63 | 63 | ||
| 64 | #include <__algorithm/ranges_upper_bound.h> | 64 | #include <__algorithm/upper_bound.h> |
| 65 | #include <__config> | 65 | #include <__config> |
| 66 | #include <__cstddef/ptrdiff_t.h> | 66 | #include <__cstddef/ptrdiff_t.h> |
| 67 | #include <__iterator/access.h> | ||
| 67 | #include <cstdint> | 68 | #include <cstdint> |
| 68 | 69 | ||
| 69 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 70 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 70 | # pragma GCC system_header | 71 | # pragma GCC system_header |
| 71 | #endif | 72 | #endif |
| 72 | 73 | ||
| 73 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 74 | |||
| 75 | #if _LIBCPP_STD_VER >= 23 | 74 | #if _LIBCPP_STD_VER >= 23 |
| 76 | 75 | ||
| 76 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 77 | |||
| 77 | namespace __escaped_output_table { | 78 | namespace __escaped_output_table { |
| 78 | // clang-format off | 79 | // clang-format off |
| 79 | 80 | ||
| ... | @@ -868,7 +869,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[735] = { | ... | @@ -868,7 +869,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[735] = { |
| 868 | if (__code_point >= 0x000323b0) | 869 | if (__code_point >= 0x000323b0) |
| 869 | return true; | 870 | return true; |
| 870 | 871 | ||
| 871 | ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 14) | 0x3fffu) - __entries; | 872 | ptrdiff_t __i = std::upper_bound(std::begin(__entries), std::end(__entries), (__code_point << 14) | 0x3fffu) - __entries; |
| 872 | if (__i == 0) | 873 | if (__i == 0) |
| 873 | return false; | 874 | return false; |
| 874 | 875 | ||
| ... | @@ -880,8 +881,8 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[735] = { | ... | @@ -880,8 +881,8 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[735] = { |
| 880 | // clang-format on | 881 | // clang-format on |
| 881 | } // namespace __escaped_output_table | 882 | } // namespace __escaped_output_table |
| 882 | 883 | ||
| 883 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 884 | |||
| 885 | _LIBCPP_END_NAMESPACE_STD | 884 | _LIBCPP_END_NAMESPACE_STD |
| 886 | 885 | ||
| 886 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 887 | |||
| 887 | #endif // _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H | 888 | #endif // _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H |
lib/libcxx/include/__format/fmt_pair_like.h+4-4| ... | @@ -20,10 +20,10 @@ | ... | @@ -20,10 +20,10 @@ |
| 20 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | #if _LIBCPP_STD_VER >= 23 | 23 | #if _LIBCPP_STD_VER >= 23 |
| 26 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 26 | |||
| 27 | // [tuple.like] defines a tuple-like exposition only concept. This concept is not related to that. Therefore it uses a | 27 | // [tuple.like] defines a tuple-like exposition only concept. This concept is not related to that. Therefore it uses a |
| 28 | // different name for the concept. | 28 | // different name for the concept. |
| 29 | // | 29 | // |
| ... | @@ -35,8 +35,8 @@ template <class _Tp> | ... | @@ -35,8 +35,8 @@ template <class _Tp> |
| 35 | concept __fmt_pair_like = | 35 | concept __fmt_pair_like = |
| 36 | __is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2); | 36 | __is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2); |
| 37 | 37 | ||
| 38 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 39 | |||
| 40 | _LIBCPP_END_NAMESPACE_STD | 38 | _LIBCPP_END_NAMESPACE_STD |
| 41 | 39 | ||
| 40 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 41 | |||
| 42 | #endif // _LIBCPP___FORMAT_FMT_PAIR_LIKE_H | 42 | #endif // _LIBCPP___FORMAT_FMT_PAIR_LIKE_H |
lib/libcxx/include/__format/format_context.h+4-7| ... | @@ -40,10 +40,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -40,10 +40,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 40 | 40 | ||
| 41 | #if _LIBCPP_STD_VER >= 20 | 41 | #if _LIBCPP_STD_VER >= 20 |
| 42 | 42 | ||
| 43 | template <class _OutIt, class _CharT> | ||
| 44 | requires output_iterator<_OutIt, const _CharT&> | ||
| 45 | class basic_format_context; | ||
| 46 | |||
| 47 | # if _LIBCPP_HAS_LOCALIZATION | 43 | # if _LIBCPP_HAS_LOCALIZATION |
| 48 | /** | 44 | /** |
| 49 | * Helper to create a basic_format_context. | 45 | * Helper to create a basic_format_context. |
| ... | @@ -71,15 +67,16 @@ using wformat_context = basic_format_context< back_insert_iterator<__format::__o | ... | @@ -71,15 +67,16 @@ using wformat_context = basic_format_context< back_insert_iterator<__format::__o |
| 71 | # endif | 67 | # endif |
| 72 | 68 | ||
| 73 | template <class _OutIt, class _CharT> | 69 | template <class _OutIt, class _CharT> |
| 74 | requires output_iterator<_OutIt, const _CharT&> | 70 | class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wformat_context)) |
| 75 | class _LIBCPP_PREFERRED_NAME(format_context) | 71 | basic_format_context { |
| 76 | _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wformat_context)) basic_format_context { | ||
| 77 | public: | 72 | public: |
| 78 | using iterator = _OutIt; | 73 | using iterator = _OutIt; |
| 79 | using char_type = _CharT; | 74 | using char_type = _CharT; |
| 80 | template <class _Tp> | 75 | template <class _Tp> |
| 81 | using formatter_type = formatter<_Tp, _CharT>; | 76 | using formatter_type = formatter<_Tp, _CharT>; |
| 82 | 77 | ||
| 78 | static_assert(output_iterator<_OutIt, const _CharT&>, "[format.context]/p3 requires OutIt to be an output_iterator"); | ||
| 79 | |||
| 83 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept { | 80 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept { |
| 84 | return __args_.get(__id); | 81 | return __args_.get(__id); |
| 85 | } | 82 | } |
lib/libcxx/include/__format/format_error.h+2| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 22 | 23 | ||
| 23 | #if _LIBCPP_STD_VER >= 20 | 24 | #if _LIBCPP_STD_VER >= 20 |
| 24 | 25 | ||
| ... | @@ -45,6 +46,7 @@ _LIBCPP_DIAGNOSTIC_POP | ... | @@ -45,6 +46,7 @@ _LIBCPP_DIAGNOSTIC_POP |
| 45 | 46 | ||
| 46 | #endif // _LIBCPP_STD_VER >= 20 | 47 | #endif // _LIBCPP_STD_VER >= 20 |
| 47 | 48 | ||
| 49 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 48 | _LIBCPP_END_NAMESPACE_STD | 50 | _LIBCPP_END_NAMESPACE_STD |
| 49 | 51 | ||
| 50 | #endif // _LIBCPP___FORMAT_FORMAT_ERROR_H | 52 | #endif // _LIBCPP___FORMAT_FORMAT_ERROR_H |
lib/libcxx/include/__format/format_functions.h+15-11| ... | @@ -11,7 +11,7 @@ | ... | @@ -11,7 +11,7 @@ |
| 11 | #define _LIBCPP___FORMAT_FORMAT_FUNCTIONS | 11 | #define _LIBCPP___FORMAT_FORMAT_FUNCTIONS |
| 12 | 12 | ||
| 13 | #include <__algorithm/clamp.h> | 13 | #include <__algorithm/clamp.h> |
| 14 | #include <__algorithm/ranges_find_first_of.h> | 14 | #include <__algorithm/find_first_of.h> |
| 15 | #include <__chrono/statically_widen.h> | 15 | #include <__chrono/statically_widen.h> |
| 16 | #include <__concepts/convertible_to.h> | 16 | #include <__concepts/convertible_to.h> |
| 17 | #include <__concepts/same_as.h> | 17 | #include <__concepts/same_as.h> |
| ... | @@ -26,7 +26,7 @@ | ... | @@ -26,7 +26,7 @@ |
| 26 | #include <__format/format_string.h> | 26 | #include <__format/format_string.h> |
| 27 | #include <__format/format_to_n_result.h> | 27 | #include <__format/format_to_n_result.h> |
| 28 | #include <__format/formatter.h> | 28 | #include <__format/formatter.h> |
| 29 | #include <__format/formatter_bool.h> | 29 | #include <__format/formatter_bool_impl.h> |
| 30 | #include <__format/formatter_char.h> | 30 | #include <__format/formatter_char.h> |
| 31 | #include <__format/formatter_floating_point.h> | 31 | #include <__format/formatter_floating_point.h> |
| 32 | #include <__format/formatter_integer.h> | 32 | #include <__format/formatter_integer.h> |
| ... | @@ -342,7 +342,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator __vformat_to(_ParseCtx&& | ... | @@ -342,7 +342,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator __vformat_to(_ParseCtx&& |
| 342 | 342 | ||
| 343 | # if _LIBCPP_STD_VER >= 26 | 343 | # if _LIBCPP_STD_VER >= 26 |
| 344 | template <class _CharT> | 344 | template <class _CharT> |
| 345 | struct __runtime_format_string { | 345 | struct __dynamic_format_string { |
| 346 | private: | 346 | private: |
| 347 | basic_string_view<_CharT> __str_; | 347 | basic_string_view<_CharT> __str_; |
| 348 | 348 | ||
| ... | @@ -350,15 +350,15 @@ private: | ... | @@ -350,15 +350,15 @@ private: |
| 350 | friend struct basic_format_string; | 350 | friend struct basic_format_string; |
| 351 | 351 | ||
| 352 | public: | 352 | public: |
| 353 | _LIBCPP_HIDE_FROM_ABI __runtime_format_string(basic_string_view<_CharT> __s) noexcept : __str_(__s) {} | 353 | _LIBCPP_HIDE_FROM_ABI __dynamic_format_string(basic_string_view<_CharT> __s) noexcept : __str_(__s) {} |
| 354 | 354 | ||
| 355 | __runtime_format_string(const __runtime_format_string&) = delete; | 355 | __dynamic_format_string(const __dynamic_format_string&) = delete; |
| 356 | __runtime_format_string& operator=(const __runtime_format_string&) = delete; | 356 | __dynamic_format_string& operator=(const __dynamic_format_string&) = delete; |
| 357 | }; | 357 | }; |
| 358 | 358 | ||
| 359 | _LIBCPP_HIDE_FROM_ABI inline __runtime_format_string<char> runtime_format(string_view __fmt) noexcept { return __fmt; } | 359 | _LIBCPP_HIDE_FROM_ABI inline __dynamic_format_string<char> dynamic_format(string_view __fmt) noexcept { return __fmt; } |
| 360 | # if _LIBCPP_HAS_WIDE_CHARACTERS | 360 | # if _LIBCPP_HAS_WIDE_CHARACTERS |
| 361 | _LIBCPP_HIDE_FROM_ABI inline __runtime_format_string<wchar_t> runtime_format(wstring_view __fmt) noexcept { | 361 | _LIBCPP_HIDE_FROM_ABI inline __dynamic_format_string<wchar_t> dynamic_format(wstring_view __fmt) noexcept { |
| 362 | return __fmt; | 362 | return __fmt; |
| 363 | } | 363 | } |
| 364 | # endif | 364 | # endif |
| ... | @@ -375,7 +375,7 @@ struct basic_format_string { | ... | @@ -375,7 +375,7 @@ struct basic_format_string { |
| 375 | 375 | ||
| 376 | _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept { return __str_; } | 376 | _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept { return __str_; } |
| 377 | # if _LIBCPP_STD_VER >= 26 | 377 | # if _LIBCPP_STD_VER >= 26 |
| 378 | _LIBCPP_HIDE_FROM_ABI basic_format_string(__runtime_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {} | 378 | _LIBCPP_HIDE_FROM_ABI basic_format_string(__dynamic_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {} |
| 379 | # endif | 379 | # endif |
| 380 | 380 | ||
| 381 | private: | 381 | private: |
| ... | @@ -459,8 +459,12 @@ template <class _CharT> | ... | @@ -459,8 +459,12 @@ template <class _CharT> |
| 459 | basic_string_view<_CharT> __fmt, | 459 | basic_string_view<_CharT> __fmt, |
| 460 | basic_format_args<basic_format_context<back_insert_iterator<__format::__output_buffer<_CharT>>, _CharT>> __args) { | 460 | basic_format_args<basic_format_context<back_insert_iterator<__format::__output_buffer<_CharT>>, _CharT>> __args) { |
| 461 | // Fold strings not containing '{' or '}' to just return the string | 461 | // Fold strings not containing '{' or '}' to just return the string |
| 462 | if (bool __is_identity = [&] [[__gnu__::__pure__]] // Make sure the compiler knows this call can be eliminated | 462 | if (bool __is_identity = |
| 463 | { return std::ranges::find_first_of(__fmt, array{'{', '}'}) == __fmt.end(); }(); | 463 | [&] [[__gnu__::__pure__]] // Make sure the compiler knows this call can be eliminated |
| 464 | { | ||
| 465 | char __vals[] = {'{', '}'}; | ||
| 466 | return std::find_first_of(__fmt.begin(), __fmt.end(), std::begin(__vals), std::end(__vals)) == __fmt.end(); | ||
| 467 | }(); | ||
| 464 | __builtin_constant_p(__is_identity) && __is_identity) | 468 | __builtin_constant_p(__is_identity) && __is_identity) |
| 465 | return basic_string<_CharT>{__fmt}; | 469 | return basic_string<_CharT>{__fmt}; |
| 466 | 470 |
lib/libcxx/include/__format/formatter_bool.h+5-30| ... | @@ -10,19 +10,10 @@ | ... | @@ -10,19 +10,10 @@ |
| 10 | #ifndef _LIBCPP___FORMAT_FORMATTER_BOOL_H | 10 | #ifndef _LIBCPP___FORMAT_FORMATTER_BOOL_H |
| 11 | #define _LIBCPP___FORMAT_FORMATTER_BOOL_H | 11 | #define _LIBCPP___FORMAT_FORMATTER_BOOL_H |
| 12 | 12 | ||
| 13 | #include <__algorithm/copy.h> | ||
| 14 | #include <__assert> | ||
| 15 | #include <__config> | 13 | #include <__config> |
| 16 | #include <__format/concepts.h> | 14 | #include <__format/concepts.h> |
| 17 | #include <__format/format_parse_context.h> | ||
| 18 | #include <__format/formatter.h> | 15 | #include <__format/formatter.h> |
| 19 | #include <__format/formatter_integral.h> | ||
| 20 | #include <__format/parser_std_format_spec.h> | 16 | #include <__format/parser_std_format_spec.h> |
| 21 | #include <__utility/unreachable.h> | ||
| 22 | |||
| 23 | #if _LIBCPP_HAS_LOCALIZATION | ||
| 24 | # include <__locale> | ||
| 25 | #endif | ||
| 26 | 17 | ||
| 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 28 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| ... | @@ -32,9 +23,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -32,9 +23,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 32 | 23 | ||
| 33 | #if _LIBCPP_STD_VER >= 20 | 24 | #if _LIBCPP_STD_VER >= 20 |
| 34 | 25 | ||
| 26 | template <__fmt_char_type _CharT, class _FormatContext> | ||
| 27 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator | ||
| 28 | __formatter_bool_format(bool __value, __format_spec::__parser<_CharT>, _FormatContext&); | ||
| 29 | |||
| 35 | template <__fmt_char_type _CharT> | 30 | template <__fmt_char_type _CharT> |
| 36 | struct formatter<bool, _CharT> { | 31 | struct formatter<bool, _CharT> { |
| 37 | public: | ||
| 38 | template <class _ParseContext> | 32 | template <class _ParseContext> |
| 39 | _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { | 33 | _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { |
| 40 | typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_integral); | 34 | typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_integral); |
| ... | @@ -44,26 +38,7 @@ public: | ... | @@ -44,26 +38,7 @@ public: |
| 44 | 38 | ||
| 45 | template <class _FormatContext> | 39 | template <class _FormatContext> |
| 46 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(bool __value, _FormatContext& __ctx) const { | 40 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(bool __value, _FormatContext& __ctx) const { |
| 47 | switch (__parser_.__type_) { | 41 | return std::__formatter_bool_format(__value, __parser_, __ctx); |
| 48 | case __format_spec::__type::__default: | ||
| 49 | case __format_spec::__type::__string: | ||
| 50 | return __formatter::__format_bool(__value, __ctx, __parser_.__get_parsed_std_specifications(__ctx)); | ||
| 51 | |||
| 52 | case __format_spec::__type::__binary_lower_case: | ||
| 53 | case __format_spec::__type::__binary_upper_case: | ||
| 54 | case __format_spec::__type::__octal: | ||
| 55 | case __format_spec::__type::__decimal: | ||
| 56 | case __format_spec::__type::__hexadecimal_lower_case: | ||
| 57 | case __format_spec::__type::__hexadecimal_upper_case: | ||
| 58 | // Promotes bool to an integral type. This reduces the number of | ||
| 59 | // instantiations of __format_integer reducing code size. | ||
| 60 | return __formatter::__format_integer( | ||
| 61 | static_cast<unsigned>(__value), __ctx, __parser_.__get_parsed_std_specifications(__ctx)); | ||
| 62 | |||
| 63 | default: | ||
| 64 | _LIBCPP_ASSERT_INTERNAL(false, "The parse function should have validated the type"); | ||
| 65 | __libcpp_unreachable(); | ||
| 66 | } | ||
| 67 | } | 42 | } |
| 68 | 43 | ||
| 69 | __format_spec::__parser<_CharT> __parser_; | 44 | __format_spec::__parser<_CharT> __parser_; |
lib/libcxx/include/__format/formatter_bool_impl.h created+60| ... | @@ -0,0 +1,60 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___FORMAT_FORMATTER_BOOL_IMPL_H | ||
| 11 | #define _LIBCPP___FORMAT_FORMATTER_BOOL_IMPL_H | ||
| 12 | |||
| 13 | #include <__assert> | ||
| 14 | #include <__config> | ||
| 15 | #include <__format/concepts.h> | ||
| 16 | #include <__format/formatter_bool.h> | ||
| 17 | #include <__format/formatter_integral.h> | ||
| 18 | #include <__format/parser_std_format_spec.h> | ||
| 19 | #include <__utility/unreachable.h> | ||
| 20 | |||
| 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 22 | # pragma GCC system_header | ||
| 23 | #endif | ||
| 24 | |||
| 25 | #if _LIBCPP_STD_VER >= 20 | ||
| 26 | |||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 28 | |||
| 29 | // This function is separated from formatter<bool> to avoid pulling in a bunch of code from <format> that we aren't | ||
| 30 | // required to provide in other headers where we need formatter<bool> itself to be complete. | ||
| 31 | template <__fmt_char_type _CharT, class _FormatContext> | ||
| 32 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator | ||
| 33 | __formatter_bool_format(bool __value, __format_spec::__parser<_CharT> __parser, _FormatContext& __ctx) { | ||
| 34 | switch (__parser.__type_) { | ||
| 35 | case __format_spec::__type::__default: | ||
| 36 | case __format_spec::__type::__string: | ||
| 37 | return __formatter::__format_bool(__value, __ctx, __parser.__get_parsed_std_specifications(__ctx)); | ||
| 38 | |||
| 39 | case __format_spec::__type::__binary_lower_case: | ||
| 40 | case __format_spec::__type::__binary_upper_case: | ||
| 41 | case __format_spec::__type::__octal: | ||
| 42 | case __format_spec::__type::__decimal: | ||
| 43 | case __format_spec::__type::__hexadecimal_lower_case: | ||
| 44 | case __format_spec::__type::__hexadecimal_upper_case: | ||
| 45 | // Promotes bool to an integral type. This reduces the number of | ||
| 46 | // instantiations of __format_integer reducing code size. | ||
| 47 | return __formatter::__format_integer( | ||
| 48 | static_cast<unsigned>(__value), __ctx, __parser.__get_parsed_std_specifications(__ctx)); | ||
| 49 | |||
| 50 | default: | ||
| 51 | _LIBCPP_ASSERT_INTERNAL(false, "The parse function should have validated the type"); | ||
| 52 | __libcpp_unreachable(); | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | _LIBCPP_END_NAMESPACE_STD | ||
| 57 | |||
| 58 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 59 | |||
| 60 | #endif // _LIBCPP___FORMAT_FORMATTER_BOOL_IMPL_H | ||
lib/libcxx/include/__format/formatter_floating_point.h+4-4| ... | @@ -32,12 +32,12 @@ | ... | @@ -32,12 +32,12 @@ |
| 32 | #include <__format/formatter_output.h> | 32 | #include <__format/formatter_output.h> |
| 33 | #include <__format/parser_std_format_spec.h> | 33 | #include <__format/parser_std_format_spec.h> |
| 34 | #include <__iterator/concepts.h> | 34 | #include <__iterator/concepts.h> |
| 35 | #include <__math/traits.h> | ||
| 35 | #include <__memory/allocator.h> | 36 | #include <__memory/allocator.h> |
| 36 | #include <__system_error/errc.h> | 37 | #include <__system_error/errc.h> |
| 37 | #include <__type_traits/conditional.h> | 38 | #include <__type_traits/conditional.h> |
| 38 | #include <__utility/move.h> | 39 | #include <__utility/move.h> |
| 39 | #include <__utility/unreachable.h> | 40 | #include <__utility/unreachable.h> |
| 40 | #include <cmath> | ||
| 41 | 41 | ||
| 42 | #if _LIBCPP_HAS_LOCALIZATION | 42 | #if _LIBCPP_HAS_LOCALIZATION |
| 43 | # include <__locale> | 43 | # include <__locale> |
| ... | @@ -637,10 +637,10 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros( | ... | @@ -637,10 +637,10 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros( |
| 637 | template <floating_point _Tp, class _CharT, class _FormatContext> | 637 | template <floating_point _Tp, class _CharT, class _FormatContext> |
| 638 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator | 638 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator |
| 639 | __format_floating_point(_Tp __value, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) { | 639 | __format_floating_point(_Tp __value, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) { |
| 640 | bool __negative = std::signbit(__value); | 640 | bool __negative = __math::signbit(__value); |
| 641 | 641 | ||
| 642 | if (!std::isfinite(__value)) [[unlikely]] | 642 | if (!__math::isfinite(__value)) [[unlikely]] |
| 643 | return __formatter::__format_floating_point_non_finite(__ctx.out(), __specs, __negative, std::isnan(__value)); | 643 | return __formatter::__format_floating_point_non_finite(__ctx.out(), __specs, __negative, __math::isnan(__value)); |
| 644 | 644 | ||
| 645 | // Depending on the std-format-spec string the sign and the value | 645 | // Depending on the std-format-spec string the sign and the value |
| 646 | // might not be outputted together: | 646 | // might not be outputted together: |
lib/libcxx/include/__format/formatter_tuple.h+4-4| ... | @@ -31,10 +31,10 @@ | ... | @@ -31,10 +31,10 @@ |
| 31 | # pragma GCC system_header | 31 | # pragma GCC system_header |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 35 | |||
| 36 | #if _LIBCPP_STD_VER >= 23 | 34 | #if _LIBCPP_STD_VER >= 23 |
| 37 | 35 | ||
| 36 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 37 | |||
| 38 | template <__fmt_char_type _CharT, class _Tuple, formattable<_CharT>... _Args> | 38 | template <__fmt_char_type _CharT, class _Tuple, formattable<_CharT>... _Args> |
| 39 | struct __formatter_tuple { | 39 | struct __formatter_tuple { |
| 40 | _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) noexcept { | 40 | _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) noexcept { |
| ... | @@ -141,8 +141,8 @@ struct formatter<pair<_Args...>, _CharT> : public __formatter_tuple<_CharT, pair | ... | @@ -141,8 +141,8 @@ struct formatter<pair<_Args...>, _CharT> : public __formatter_tuple<_CharT, pair |
| 141 | template <__fmt_char_type _CharT, formattable<_CharT>... _Args> | 141 | template <__fmt_char_type _CharT, formattable<_CharT>... _Args> |
| 142 | struct formatter<tuple<_Args...>, _CharT> : public __formatter_tuple<_CharT, tuple<_Args...>, _Args...> {}; | 142 | struct formatter<tuple<_Args...>, _CharT> : public __formatter_tuple<_CharT, tuple<_Args...>, _Args...> {}; |
| 143 | 143 | ||
| 144 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 145 | |||
| 146 | _LIBCPP_END_NAMESPACE_STD | 144 | _LIBCPP_END_NAMESPACE_STD |
| 147 | 145 | ||
| 146 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 147 | |||
| 148 | #endif // _LIBCPP___FORMAT_FORMATTER_TUPLE_H | 148 | #endif // _LIBCPP___FORMAT_FORMATTER_TUPLE_H |
lib/libcxx/include/__format/range_default_formatter.h+5-4| ... | @@ -22,6 +22,7 @@ | ... | @@ -22,6 +22,7 @@ |
| 22 | #include <__format/formatter.h> | 22 | #include <__format/formatter.h> |
| 23 | #include <__format/range_format.h> | 23 | #include <__format/range_format.h> |
| 24 | #include <__format/range_formatter.h> | 24 | #include <__format/range_formatter.h> |
| 25 | #include <__fwd/format.h> | ||
| 25 | #include <__iterator/back_insert_iterator.h> | 26 | #include <__iterator/back_insert_iterator.h> |
| 26 | #include <__ranges/concepts.h> | 27 | #include <__ranges/concepts.h> |
| 27 | #include <__ranges/data.h> | 28 | #include <__ranges/data.h> |
| ... | @@ -32,10 +33,10 @@ | ... | @@ -32,10 +33,10 @@ |
| 32 | #include <__utility/pair.h> | 33 | #include <__utility/pair.h> |
| 33 | #include <string_view> | 34 | #include <string_view> |
| 34 | 35 | ||
| 35 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 36 | |||
| 37 | #if _LIBCPP_STD_VER >= 23 | 36 | #if _LIBCPP_STD_VER >= 23 |
| 38 | 37 | ||
| 38 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 39 | |||
| 39 | template <class _Rp, class _CharT> | 40 | template <class _Rp, class _CharT> |
| 40 | concept __const_formattable_range = | 41 | concept __const_formattable_range = |
| 41 | ranges::input_range<const _Rp> && formattable<ranges::range_reference_t<const _Rp>, _CharT>; | 42 | ranges::input_range<const _Rp> && formattable<ranges::range_reference_t<const _Rp>, _CharT>; |
| ... | @@ -168,8 +169,8 @@ template <ranges::input_range _Rp, class _CharT> | ... | @@ -168,8 +169,8 @@ template <ranges::input_range _Rp, class _CharT> |
| 168 | requires(format_kind<_Rp> != range_format::disabled && formattable<ranges::range_reference_t<_Rp>, _CharT>) | 169 | requires(format_kind<_Rp> != range_format::disabled && formattable<ranges::range_reference_t<_Rp>, _CharT>) |
| 169 | struct formatter<_Rp, _CharT> : __range_default_formatter<format_kind<_Rp>, _Rp, _CharT> {}; | 170 | struct formatter<_Rp, _CharT> : __range_default_formatter<format_kind<_Rp>, _Rp, _CharT> {}; |
| 170 | 171 | ||
| 171 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 172 | |||
| 173 | _LIBCPP_END_NAMESPACE_STD | 172 | _LIBCPP_END_NAMESPACE_STD |
| 174 | 173 | ||
| 174 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 175 | |||
| 175 | #endif // _LIBCPP___FORMAT_RANGE_DEFAULT_FORMATTER_H | 176 | #endif // _LIBCPP___FORMAT_RANGE_DEFAULT_FORMATTER_H |
lib/libcxx/include/__format/range_format.h+4-18| ... | @@ -17,27 +17,13 @@ | ... | @@ -17,27 +17,13 @@ |
| 17 | #include <__concepts/same_as.h> | 17 | #include <__concepts/same_as.h> |
| 18 | #include <__config> | 18 | #include <__config> |
| 19 | #include <__format/fmt_pair_like.h> | 19 | #include <__format/fmt_pair_like.h> |
| 20 | #include <__fwd/format.h> | ||
| 20 | #include <__ranges/concepts.h> | 21 | #include <__ranges/concepts.h> |
| 21 | #include <__type_traits/remove_cvref.h> | 22 | #include <__type_traits/remove_cvref.h> |
| 22 | 23 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | #if _LIBCPP_STD_VER >= 23 | 24 | #if _LIBCPP_STD_VER >= 23 |
| 26 | 25 | ||
| 27 | _LIBCPP_DIAGNOSTIC_PUSH | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wshadow") | ||
| 29 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wshadow") | ||
| 30 | // This shadows map, set, and string. | ||
| 31 | enum class range_format { disabled, map, set, sequence, string, debug_string }; | ||
| 32 | _LIBCPP_DIAGNOSTIC_POP | ||
| 33 | |||
| 34 | template <class _Rp> | ||
| 35 | constexpr range_format format_kind = [] { | ||
| 36 | // [format.range.fmtkind]/1 | ||
| 37 | // A program that instantiates the primary template of format_kind is ill-formed. | ||
| 38 | static_assert(sizeof(_Rp) != sizeof(_Rp), "create a template specialization of format_kind for your type"); | ||
| 39 | return range_format::disabled; | ||
| 40 | }(); | ||
| 41 | 27 | ||
| 42 | template <ranges::input_range _Rp> | 28 | template <ranges::input_range _Rp> |
| 43 | requires same_as<_Rp, remove_cvref_t<_Rp>> | 29 | requires same_as<_Rp, remove_cvref_t<_Rp>> |
| ... | @@ -64,8 +50,8 @@ inline constexpr range_format format_kind<_Rp> = [] { | ... | @@ -64,8 +50,8 @@ inline constexpr range_format format_kind<_Rp> = [] { |
| 64 | return range_format::sequence; | 50 | return range_format::sequence; |
| 65 | }(); | 51 | }(); |
| 66 | 52 | ||
| 67 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 68 | |||
| 69 | _LIBCPP_END_NAMESPACE_STD | 53 | _LIBCPP_END_NAMESPACE_STD |
| 70 | 54 | ||
| 55 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 56 | |||
| 71 | #endif | 57 | #endif |
lib/libcxx/include/__format/range_formatter.h+6-4| ... | @@ -34,10 +34,10 @@ | ... | @@ -34,10 +34,10 @@ |
| 34 | #include <__type_traits/remove_cvref.h> | 34 | #include <__type_traits/remove_cvref.h> |
| 35 | #include <string_view> | 35 | #include <string_view> |
| 36 | 36 | ||
| 37 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 38 | |||
| 39 | #if _LIBCPP_STD_VER >= 23 | 37 | #if _LIBCPP_STD_VER >= 23 |
| 40 | 38 | ||
| 39 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 40 | |||
| 41 | template <class _Tp, class _CharT = char> | 41 | template <class _Tp, class _CharT = char> |
| 42 | requires same_as<remove_cvref_t<_Tp>, _Tp> && formattable<_Tp, _CharT> | 42 | requires same_as<remove_cvref_t<_Tp>, _Tp> && formattable<_Tp, _CharT> |
| 43 | struct range_formatter { | 43 | struct range_formatter { |
| ... | @@ -215,6 +215,8 @@ private: | ... | @@ -215,6 +215,8 @@ private: |
| 215 | switch (*__begin) { | 215 | switch (*__begin) { |
| 216 | case _CharT('m'): | 216 | case _CharT('m'): |
| 217 | if constexpr (__fmt_pair_like<_Tp>) { | 217 | if constexpr (__fmt_pair_like<_Tp>) { |
| 218 | __underlying_.set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ": ")); | ||
| 219 | __underlying_.set_brackets({}, {}); | ||
| 218 | set_brackets(_LIBCPP_STATICALLY_WIDEN(_CharT, "{"), _LIBCPP_STATICALLY_WIDEN(_CharT, "}")); | 220 | set_brackets(_LIBCPP_STATICALLY_WIDEN(_CharT, "{"), _LIBCPP_STATICALLY_WIDEN(_CharT, "}")); |
| 219 | set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ", ")); | 221 | set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ", ")); |
| 220 | ++__begin; | 222 | ++__begin; |
| ... | @@ -258,8 +260,8 @@ private: | ... | @@ -258,8 +260,8 @@ private: |
| 258 | basic_string_view<_CharT> __closing_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "]"); | 260 | basic_string_view<_CharT> __closing_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "]"); |
| 259 | }; | 261 | }; |
| 260 | 262 | ||
| 261 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 262 | |||
| 263 | _LIBCPP_END_NAMESPACE_STD | 263 | _LIBCPP_END_NAMESPACE_STD |
| 264 | 264 | ||
| 265 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 266 | |||
| 265 | #endif // _LIBCPP___FORMAT_RANGE_FORMATTER_H | 267 | #endif // _LIBCPP___FORMAT_RANGE_FORMATTER_H |
lib/libcxx/include/__format/unicode.h+1-1| ... | @@ -101,7 +101,7 @@ inline constexpr __consume_result __consume_result_error{__replacement_character | ... | @@ -101,7 +101,7 @@ inline constexpr __consume_result __consume_result_error{__replacement_character |
| 101 | return __unicode::__is_code_point(__value) && !__unicode::__is_surrogate(__value); | 101 | return __unicode::__is_code_point(__value) && !__unicode::__is_surrogate(__value); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | template <contiguous_iterator _Iterator> | 104 | template <class _Iterator> |
| 105 | requires same_as<iter_value_t<_Iterator>, char> | 105 | requires same_as<iter_value_t<_Iterator>, char> |
| 106 | _LIBCPP_HIDE_FROM_ABI constexpr bool __is_continuation(_Iterator __char, int __count) { | 106 | _LIBCPP_HIDE_FROM_ABI constexpr bool __is_continuation(_Iterator __char, int __count) { |
| 107 | do { | 107 | do { |
lib/libcxx/include/__functional/binary_negate.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) | 20 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _Predicate> | 24 | template <class _Predicate> |
| 25 | class _LIBCPP_DEPRECATED_IN_CXX17 binary_negate | 25 | class _LIBCPP_DEPRECATED_IN_CXX17 binary_negate |
| 26 | : public __binary_function<typename _Predicate::first_argument_type, | 26 | : public __binary_function<typename _Predicate::first_argument_type, |
| ... | @@ -44,8 +44,8 @@ not2(const _Predicate& __pred) { | ... | @@ -44,8 +44,8 @@ not2(const _Predicate& __pred) { |
| 44 | return binary_negate<_Predicate>(__pred); | 44 | return binary_negate<_Predicate>(__pred); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) | ||
| 48 | |||
| 49 | _LIBCPP_END_NAMESPACE_STD | 47 | _LIBCPP_END_NAMESPACE_STD |
| 50 | 48 | ||
| 49 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) | ||
| 50 | |||
| 51 | #endif // _LIBCPP___FUNCTIONAL_BINARY_NEGATE_H | 51 | #endif // _LIBCPP___FUNCTIONAL_BINARY_NEGATE_H |
lib/libcxx/include/__functional/bind_front.h+49| ... | @@ -17,6 +17,8 @@ | ... | @@ -17,6 +17,8 @@ |
| 17 | #include <__type_traits/decay.h> | 17 | #include <__type_traits/decay.h> |
| 18 | #include <__type_traits/enable_if.h> | 18 | #include <__type_traits/enable_if.h> |
| 19 | #include <__type_traits/is_constructible.h> | 19 | #include <__type_traits/is_constructible.h> |
| 20 | #include <__type_traits/is_member_pointer.h> | ||
| 21 | #include <__type_traits/is_pointer.h> | ||
| 20 | #include <__utility/forward.h> | 22 | #include <__utility/forward.h> |
| 21 | 23 | ||
| 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 24 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | @@ -49,6 +51,53 @@ template <class _Fn, class... _Args> | ... | @@ -49,6 +51,53 @@ template <class _Fn, class... _Args> |
| 49 | 51 | ||
| 50 | #endif // _LIBCPP_STD_VER >= 20 | 52 | #endif // _LIBCPP_STD_VER >= 20 |
| 51 | 53 | ||
| 54 | #if _LIBCPP_STD_VER >= 26 | ||
| 55 | |||
| 56 | template <auto _Fn, class _Indices, class... _BoundArgs> | ||
| 57 | struct __nttp_bind_front_t; | ||
| 58 | |||
| 59 | template <auto _Fn, size_t... _Indices, class... _BoundArgs> | ||
| 60 | struct __nttp_bind_front_t<_Fn, index_sequence<_Indices...>, _BoundArgs...> { | ||
| 61 | tuple<_BoundArgs...> __bound_args_; | ||
| 62 | |||
| 63 | template <class _Self, class... _Args> | ||
| 64 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(this _Self&& __self, _Args&&... __args) noexcept(noexcept(std::invoke( | ||
| 65 | _Fn, std::get<_Indices>(std::forward<_Self>(__self).__bound_args_)..., std::forward<_Args>(__args)...))) | ||
| 66 | -> decltype(std::invoke( | ||
| 67 | _Fn, std::get<_Indices>(std::forward<_Self>(__self).__bound_args_)..., std::forward<_Args>(__args)...)) { | ||
| 68 | return std::invoke( | ||
| 69 | _Fn, std::get<_Indices>(std::forward<_Self>(__self).__bound_args_)..., std::forward<_Args>(__args)...); | ||
| 70 | } | ||
| 71 | }; | ||
| 72 | |||
| 73 | template <auto _Fn> | ||
| 74 | struct __nttp_bind_without_bound_args_t { | ||
| 75 | template <class... _Args> | ||
| 76 | _LIBCPP_HIDE_FROM_ABI static constexpr auto | ||
| 77 | operator()(_Args&&... __args) noexcept(noexcept(std::invoke(_Fn, std::forward<_Args>(__args)...))) | ||
| 78 | -> decltype(std::invoke(_Fn, std::forward<_Args>(__args)...)) { | ||
| 79 | return std::invoke(_Fn, std::forward<_Args>(__args)...); | ||
| 80 | } | ||
| 81 | }; | ||
| 82 | |||
| 83 | template <auto _Fn, class... _Args> | ||
| 84 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto bind_front(_Args&&... __args) { | ||
| 85 | static_assert((is_constructible_v<decay_t<_Args>, _Args> && ...), | ||
| 86 | "bind_front requires all decay_t<Args> to be constructible from respective Args"); | ||
| 87 | static_assert((is_move_constructible_v<decay_t<_Args>> && ...), | ||
| 88 | "bind_front requires all decay_t<Args> to be move constructible"); | ||
| 89 | if constexpr (using _Ty = decltype(_Fn); is_pointer_v<_Ty> || is_member_pointer_v<_Ty>) | ||
| 90 | static_assert(_Fn != nullptr, "bind_front: f cannot be equal to nullptr"); | ||
| 91 | |||
| 92 | if constexpr (sizeof...(_Args) == 0) | ||
| 93 | return __nttp_bind_without_bound_args_t<_Fn>{}; | ||
| 94 | else | ||
| 95 | return __nttp_bind_front_t<_Fn, index_sequence_for<_Args...>, decay_t<_Args>...>{ | ||
| 96 | .__bound_args_{std::forward<_Args>(__args)...}}; | ||
| 97 | } | ||
| 98 | |||
| 99 | #endif // _LIBCPP_STD_VER >= 26 | ||
| 100 | |||
| 52 | _LIBCPP_END_NAMESPACE_STD | 101 | _LIBCPP_END_NAMESPACE_STD |
| 53 | 102 | ||
| 54 | #endif // _LIBCPP___FUNCTIONAL_BIND_FRONT_H | 103 | #endif // _LIBCPP___FUNCTIONAL_BIND_FRONT_H |
lib/libcxx/include/__functional/binder1st.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | 20 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _Operation> | 24 | template <class _Operation> |
| 25 | class _LIBCPP_DEPRECATED_IN_CXX11 binder1st | 25 | class _LIBCPP_DEPRECATED_IN_CXX11 binder1st |
| 26 | : public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type> { | 26 | : public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type> { |
| ... | @@ -47,8 +47,8 @@ bind1st(const _Operation& __op, const _Tp& __x) { | ... | @@ -47,8 +47,8 @@ bind1st(const _Operation& __op, const _Tp& __x) { |
| 47 | return binder1st<_Operation>(__op, __x); | 47 | return binder1st<_Operation>(__op, __x); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | ||
| 51 | |||
| 52 | _LIBCPP_END_NAMESPACE_STD | 50 | _LIBCPP_END_NAMESPACE_STD |
| 53 | 51 | ||
| 52 | #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | ||
| 53 | |||
| 54 | #endif // _LIBCPP___FUNCTIONAL_BINDER1ST_H | 54 | #endif // _LIBCPP___FUNCTIONAL_BINDER1ST_H |
lib/libcxx/include/__functional/binder2nd.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | 20 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _Operation> | 24 | template <class _Operation> |
| 25 | class _LIBCPP_DEPRECATED_IN_CXX11 binder2nd | 25 | class _LIBCPP_DEPRECATED_IN_CXX11 binder2nd |
| 26 | : public __unary_function<typename _Operation::first_argument_type, typename _Operation::result_type> { | 26 | : public __unary_function<typename _Operation::first_argument_type, typename _Operation::result_type> { |
| ... | @@ -47,8 +47,8 @@ bind2nd(const _Operation& __op, const _Tp& __x) { | ... | @@ -47,8 +47,8 @@ bind2nd(const _Operation& __op, const _Tp& __x) { |
| 47 | return binder2nd<_Operation>(__op, __x); | 47 | return binder2nd<_Operation>(__op, __x); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | ||
| 51 | |||
| 52 | _LIBCPP_END_NAMESPACE_STD | 50 | _LIBCPP_END_NAMESPACE_STD |
| 53 | 51 | ||
| 52 | #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | ||
| 53 | |||
| 54 | #endif // _LIBCPP___FUNCTIONAL_BINDER2ND_H | 54 | #endif // _LIBCPP___FUNCTIONAL_BINDER2ND_H |
lib/libcxx/include/__functional/compose.h+4-4| ... | @@ -20,10 +20,10 @@ | ... | @@ -20,10 +20,10 @@ |
| 20 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | #if _LIBCPP_STD_VER >= 20 | 23 | #if _LIBCPP_STD_VER >= 20 |
| 26 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 26 | |||
| 27 | struct __compose_op { | 27 | struct __compose_op { |
| 28 | template <class _Fn1, class _Fn2, class... _Args> | 28 | template <class _Fn1, class _Fn2, class... _Args> |
| 29 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn1&& __f1, _Fn2&& __f2, _Args&&... __args) const noexcept(noexcept( | 29 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn1&& __f1, _Fn2&& __f2, _Args&&... __args) const noexcept(noexcept( |
| ... | @@ -46,8 +46,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __compose(_Fn1&& __f1, _Fn2&& __f2) noexcep | ... | @@ -46,8 +46,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __compose(_Fn1&& __f1, _Fn2&& __f2) noexcep |
| 46 | return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2)); | 46 | return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2)); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 50 | |||
| 51 | _LIBCPP_END_NAMESPACE_STD | 49 | _LIBCPP_END_NAMESPACE_STD |
| 52 | 50 | ||
| 51 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 52 | |||
| 53 | #endif // _LIBCPP___FUNCTIONAL_COMPOSE_H | 53 | #endif // _LIBCPP___FUNCTIONAL_COMPOSE_H |
lib/libcxx/include/__functional/function.h+12-3| ... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
| 17 | #include <__functional/binary_function.h> | 17 | #include <__functional/binary_function.h> |
| 18 | #include <__functional/unary_function.h> | 18 | #include <__functional/unary_function.h> |
| 19 | #include <__memory/addressof.h> | 19 | #include <__memory/addressof.h> |
| 20 | #include <__new/placement_new_delete.h> | ||
| 20 | #include <__type_traits/aligned_storage.h> | 21 | #include <__type_traits/aligned_storage.h> |
| 21 | #include <__type_traits/decay.h> | 22 | #include <__type_traits/decay.h> |
| 22 | #include <__type_traits/invoke.h> | 23 | #include <__type_traits/invoke.h> |
| ... | @@ -44,6 +45,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -44,6 +45,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 44 | // bad_function_call | 45 | // bad_function_call |
| 45 | 46 | ||
| 46 | _LIBCPP_DIAGNOSTIC_PUSH | 47 | _LIBCPP_DIAGNOSTIC_PUSH |
| 48 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 47 | # if !_LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_KEY_FUNCTION | 49 | # if !_LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_KEY_FUNCTION |
| 48 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables") | 50 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables") |
| 49 | # endif | 51 | # endif |
| ... | @@ -65,6 +67,7 @@ public: | ... | @@ -65,6 +67,7 @@ public: |
| 65 | const char* what() const _NOEXCEPT override; | 67 | const char* what() const _NOEXCEPT override; |
| 66 | # endif | 68 | # endif |
| 67 | }; | 69 | }; |
| 70 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 68 | _LIBCPP_DIAGNOSTIC_POP | 71 | _LIBCPP_DIAGNOSTIC_POP |
| 69 | 72 | ||
| 70 | [[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() { | 73 | [[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() { |
| ... | @@ -128,6 +131,7 @@ namespace __function { | ... | @@ -128,6 +131,7 @@ namespace __function { |
| 128 | template <class _Fp> | 131 | template <class _Fp> |
| 129 | class __base; | 132 | class __base; |
| 130 | 133 | ||
| 134 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 131 | template <class _Rp, class... _ArgTypes> | 135 | template <class _Rp, class... _ArgTypes> |
| 132 | class __base<_Rp(_ArgTypes...)> { | 136 | class __base<_Rp(_ArgTypes...)> { |
| 133 | public: | 137 | public: |
| ... | @@ -146,6 +150,7 @@ public: | ... | @@ -146,6 +150,7 @@ public: |
| 146 | virtual const std::type_info& target_type() const _NOEXCEPT = 0; | 150 | virtual const std::type_info& target_type() const _NOEXCEPT = 0; |
| 147 | # endif // _LIBCPP_HAS_RTTI | 151 | # endif // _LIBCPP_HAS_RTTI |
| 148 | }; | 152 | }; |
| 153 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 149 | 154 | ||
| 150 | // __func implements __base for a given functor type. | 155 | // __func implements __base for a given functor type. |
| 151 | 156 | ||
| ... | @@ -527,9 +532,13 @@ public: | ... | @@ -527,9 +532,13 @@ public: |
| 527 | 532 | ||
| 528 | # if _LIBCPP_HAS_BLOCKS_RUNTIME | 533 | # if _LIBCPP_HAS_BLOCKS_RUNTIME |
| 529 | 534 | ||
| 535 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 536 | |||
| 530 | extern "C" void* _Block_copy(const void*); | 537 | extern "C" void* _Block_copy(const void*); |
| 531 | extern "C" void _Block_release(const void*); | 538 | extern "C" void _Block_release(const void*); |
| 532 | 539 | ||
| 540 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 541 | |||
| 533 | template <class _Rp1, class... _ArgTypes1, class _Rp, class... _ArgTypes> | 542 | template <class _Rp1, class... _ArgTypes1, class _Rp, class... _ArgTypes> |
| 534 | class __func<_Rp1 (^)(_ArgTypes1...), _Rp(_ArgTypes...)> : public __base<_Rp(_ArgTypes...)> { | 543 | class __func<_Rp1 (^)(_ArgTypes1...), _Rp(_ArgTypes...)> : public __base<_Rp(_ArgTypes...)> { |
| 535 | typedef _Rp1 (^__block_type)(_ArgTypes1...); | 544 | typedef _Rp1 (^__block_type)(_ArgTypes1...); |
| ... | @@ -540,7 +549,7 @@ public: | ... | @@ -540,7 +549,7 @@ public: |
| 540 | # if __has_feature(objc_arc) | 549 | # if __has_feature(objc_arc) |
| 541 | : __f_(__f) | 550 | : __f_(__f) |
| 542 | # else | 551 | # else |
| 543 | : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr)) | 552 | : __f_(reinterpret_cast<__block_type>(__f ? __function::_Block_copy(__f) : nullptr)) |
| 544 | # endif | 553 | # endif |
| 545 | { | 554 | { |
| 546 | } | 555 | } |
| ... | @@ -563,7 +572,7 @@ public: | ... | @@ -563,7 +572,7 @@ public: |
| 563 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT { | 572 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT { |
| 564 | # if !__has_feature(objc_arc) | 573 | # if !__has_feature(objc_arc) |
| 565 | if (__f_) | 574 | if (__f_) |
| 566 | _Block_release(__f_); | 575 | __function::_Block_release(__f_); |
| 567 | # endif | 576 | # endif |
| 568 | __f_ = 0; | 577 | __f_ = 0; |
| 569 | } | 578 | } |
| ... | @@ -684,7 +693,7 @@ public: | ... | @@ -684,7 +693,7 @@ public: |
| 684 | template <class _Rp, class... _Ap> | 693 | template <class _Rp, class... _Ap> |
| 685 | function(_Rp (*)(_Ap...)) -> function<_Rp(_Ap...)>; | 694 | function(_Rp (*)(_Ap...)) -> function<_Rp(_Ap...)>; |
| 686 | 695 | ||
| 687 | template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type> | 696 | template <class _Fp, class _Stripped = __strip_signature_t<decltype(&_Fp::operator())>> |
| 688 | function(_Fp) -> function<_Stripped>; | 697 | function(_Fp) -> function<_Stripped>; |
| 689 | # endif // _LIBCPP_STD_VER >= 17 | 698 | # endif // _LIBCPP_STD_VER >= 17 |
| 690 | 699 |
lib/libcxx/include/__functional/hash.h+16-12| ... | @@ -23,7 +23,6 @@ | ... | @@ -23,7 +23,6 @@ |
| 23 | #include <__type_traits/is_integral.h> | 23 | #include <__type_traits/is_integral.h> |
| 24 | #include <__type_traits/is_unqualified.h> | 24 | #include <__type_traits/is_unqualified.h> |
| 25 | #include <__type_traits/underlying_type.h> | 25 | #include <__type_traits/underlying_type.h> |
| 26 | #include <__utility/pair.h> | ||
| 27 | #include <__utility/swap.h> | 26 | #include <__utility/swap.h> |
| 28 | #include <cstdint> | 27 | #include <cstdint> |
| 29 | #include <cstring> | 28 | #include <cstring> |
| ... | @@ -41,6 +40,11 @@ inline _LIBCPP_HIDE_FROM_ABI _Size __loadword(const void* __p) { | ... | @@ -41,6 +40,11 @@ inline _LIBCPP_HIDE_FROM_ABI _Size __loadword(const void* __p) { |
| 41 | return __r; | 40 | return __r; |
| 42 | } | 41 | } |
| 43 | 42 | ||
| 43 | struct _PairT { | ||
| 44 | size_t first; | ||
| 45 | size_t second; | ||
| 46 | }; | ||
| 47 | |||
| 44 | // We use murmur2 when size_t is 32 bits, and cityhash64 when size_t | 48 | // We use murmur2 when size_t is 32 bits, and cityhash64 when size_t |
| 45 | // is 64 bits. This is because cityhash64 uses 64bit x 64bit | 49 | // is 64 bits. This is because cityhash64 uses 64bit x 64bit |
| 46 | // multiplication, which can be very slow on 32-bit systems. | 50 | // multiplication, which can be very slow on 32-bit systems. |
| ... | @@ -104,9 +108,9 @@ struct __murmur2_or_cityhash<_Size, 64> { | ... | @@ -104,9 +108,9 @@ struct __murmur2_or_cityhash<_Size, 64> { |
| 104 | _Size __y = std::__loadword<_Size>(__s + __len - 16) + std::__loadword<_Size>(__s + __len - 56); | 108 | _Size __y = std::__loadword<_Size>(__s + __len - 16) + std::__loadword<_Size>(__s + __len - 56); |
| 105 | _Size __z = | 109 | _Size __z = |
| 106 | __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, std::__loadword<_Size>(__s + __len - 24)); | 110 | __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, std::__loadword<_Size>(__s + __len - 24)); |
| 107 | pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z); | 111 | _PairT __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z); |
| 108 | pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x); | 112 | _PairT __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x); |
| 109 | __x = __x * __k1 + std::__loadword<_Size>(__s); | 113 | __x = __x * __k1 + std::__loadword<_Size>(__s); |
| 110 | 114 | ||
| 111 | // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks. | 115 | // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks. |
| 112 | __len = (__len - 1) & ~static_cast<_Size>(63); | 116 | __len = (__len - 1) & ~static_cast<_Size>(63); |
| ... | @@ -192,7 +196,7 @@ private: | ... | @@ -192,7 +196,7 @@ private: |
| 192 | 196 | ||
| 193 | // Return a 16-byte hash for 48 bytes. Quick and dirty. | 197 | // Return a 16-byte hash for 48 bytes. Quick and dirty. |
| 194 | // Callers do best to use "random-looking" values for a and b. | 198 | // Callers do best to use "random-looking" values for a and b. |
| 195 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size> | 199 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _PairT |
| 196 | __weak_hash_len_32_with_seeds(_Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) { | 200 | __weak_hash_len_32_with_seeds(_Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) { |
| 197 | __a += __w; | 201 | __a += __w; |
| 198 | __b = __rotate(__b + __a + __z, 21); | 202 | __b = __rotate(__b + __a + __z, 21); |
| ... | @@ -200,11 +204,14 @@ private: | ... | @@ -200,11 +204,14 @@ private: |
| 200 | __a += __x; | 204 | __a += __x; |
| 201 | __a += __y; | 205 | __a += __y; |
| 202 | __b += __rotate(__a, 44); | 206 | __b += __rotate(__a, 44); |
| 203 | return pair<_Size, _Size>(__a + __z, __b + __c); | 207 | _PairT __ret; |
| 208 | __ret.first = __a + __z; | ||
| 209 | __ret.second = __b + __c; | ||
| 210 | return __ret; | ||
| 204 | } | 211 | } |
| 205 | 212 | ||
| 206 | // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. | 213 | // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. |
| 207 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size> | 214 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _PairT |
| 208 | __weak_hash_len_32_with_seeds(const char* __s, _Size __a, _Size __b) { | 215 | __weak_hash_len_32_with_seeds(const char* __s, _Size __a, _Size __b) { |
| 209 | return __weak_hash_len_32_with_seeds( | 216 | return __weak_hash_len_32_with_seeds( |
| 210 | std::__loadword<_Size>(__s), | 217 | std::__loadword<_Size>(__s), |
| ... | @@ -242,7 +249,9 @@ private: | ... | @@ -242,7 +249,9 @@ private: |
| 242 | }; | 249 | }; |
| 243 | 250 | ||
| 244 | #if _LIBCPP_AVAILABILITY_HAS_HASH_MEMORY | 251 | #if _LIBCPP_AVAILABILITY_HAS_HASH_MEMORY |
| 252 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 245 | [[__gnu__::__pure__]] _LIBCPP_EXPORTED_FROM_ABI size_t __hash_memory(_LIBCPP_NOESCAPE const void*, size_t) _NOEXCEPT; | 253 | [[__gnu__::__pure__]] _LIBCPP_EXPORTED_FROM_ABI size_t __hash_memory(_LIBCPP_NOESCAPE const void*, size_t) _NOEXCEPT; |
| 254 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 246 | #else | 255 | #else |
| 247 | _LIBCPP_HIDE_FROM_ABI inline size_t __hash_memory(const void* __ptr, size_t __size) _NOEXCEPT { | 256 | _LIBCPP_HIDE_FROM_ABI inline size_t __hash_memory(const void* __ptr, size_t __size) _NOEXCEPT { |
| 248 | return __murmur2_or_cityhash<size_t>()(__ptr, __size); | 257 | return __murmur2_or_cityhash<size_t>()(__ptr, __size); |
| ... | @@ -325,11 +334,6 @@ struct __scalar_hash<_Tp, 4> : public __unary_function<_Tp, size_t> { | ... | @@ -325,11 +334,6 @@ struct __scalar_hash<_Tp, 4> : public __unary_function<_Tp, size_t> { |
| 325 | } | 334 | } |
| 326 | }; | 335 | }; |
| 327 | 336 | ||
| 328 | struct _PairT { | ||
| 329 | size_t first; | ||
| 330 | size_t second; | ||
| 331 | }; | ||
| 332 | |||
| 333 | _LIBCPP_HIDE_FROM_ABI inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT { | 337 | _LIBCPP_HIDE_FROM_ABI inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT { |
| 334 | typedef __scalar_hash<_PairT> _HashT; | 338 | typedef __scalar_hash<_PairT> _HashT; |
| 335 | const _PairT __p = {__lhs, __rhs}; | 339 | const _PairT __p = {__lhs, __rhs}; |
lib/libcxx/include/__functional/invoke.h+6-6| ... | @@ -19,19 +19,17 @@ | ... | @@ -19,19 +19,17 @@ |
| 19 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 17 | 22 | #if _LIBCPP_STD_VER >= 17 |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | template <class _Fn, class... _Args> | 26 | template <class _Fn, class... _Args> |
| 27 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 invoke_result_t<_Fn, _Args...> | 27 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 invoke_result_t<_Fn, _Args...> |
| 28 | invoke(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_v<_Fn, _Args...>) { | 28 | invoke(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_v<_Fn, _Args...>) { |
| 29 | return std::__invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...); | 29 | return std::__invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | #endif // _LIBCPP_STD_VER >= 17 | 32 | # if _LIBCPP_STD_VER >= 23 |
| 33 | |||
| 34 | #if _LIBCPP_STD_VER >= 23 | ||
| 35 | template <class _Result, class _Fn, class... _Args> | 33 | template <class _Result, class _Fn, class... _Args> |
| 36 | requires is_invocable_r_v<_Result, _Fn, _Args...> | 34 | requires is_invocable_r_v<_Result, _Fn, _Args...> |
| 37 | _LIBCPP_HIDE_FROM_ABI constexpr _Result | 35 | _LIBCPP_HIDE_FROM_ABI constexpr _Result |
| ... | @@ -48,8 +46,10 @@ invoke_r(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_r_v<_Result | ... | @@ -48,8 +46,10 @@ invoke_r(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_r_v<_Result |
| 48 | return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...); | 46 | return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...); |
| 49 | } | 47 | } |
| 50 | } | 48 | } |
| 51 | #endif | 49 | # endif |
| 52 | 50 | ||
| 53 | _LIBCPP_END_NAMESPACE_STD | 51 | _LIBCPP_END_NAMESPACE_STD |
| 54 | 52 | ||
| 53 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 54 | |||
| 55 | #endif // _LIBCPP___FUNCTIONAL_INVOKE_H | 55 | #endif // _LIBCPP___FUNCTIONAL_INVOKE_H |
lib/libcxx/include/__functional/is_transparent.h+3-3| ... | @@ -21,11 +21,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -21,11 +21,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | ||
| 22 | #if _LIBCPP_STD_VER >= 14 | 22 | #if _LIBCPP_STD_VER >= 14 |
| 23 | 23 | ||
| 24 | template <class _Tp, class _Key = void, class = void> | 24 | template <class _Comparator, class = void> |
| 25 | inline const bool __is_transparent_v = false; | 25 | inline const bool __is_transparent_v = false; |
| 26 | 26 | ||
| 27 | template <class _Tp, class _Key> | 27 | template <class _Comparator> |
| 28 | inline const bool __is_transparent_v<_Tp, _Key, __void_t<typename _Tp::is_transparent> > = true; | 28 | inline const bool __is_transparent_v<_Comparator, __void_t<typename _Comparator::is_transparent> > = true; |
| 29 | 29 | ||
| 30 | #endif | 30 | #endif |
| 31 | 31 |
lib/libcxx/include/__functional/mem_fun_ref.h+4-4| ... | @@ -18,10 +18,10 @@ | ... | @@ -18,10 +18,10 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | 21 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | template <class _Sp, class _Tp> | 25 | template <class _Sp, class _Tp> |
| 26 | class _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t : public __unary_function<_Tp*, _Sp> { | 26 | class _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t : public __unary_function<_Tp*, _Sp> { |
| 27 | _Sp (_Tp::*__p_)(); | 27 | _Sp (_Tp::*__p_)(); |
| ... | @@ -138,8 +138,8 @@ mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const) { | ... | @@ -138,8 +138,8 @@ mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const) { |
| 138 | return const_mem_fun1_ref_t<_Sp, _Tp, _Ap>(__f); | 138 | return const_mem_fun1_ref_t<_Sp, _Tp, _Ap>(__f); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | ||
| 142 | |||
| 143 | _LIBCPP_END_NAMESPACE_STD | 141 | _LIBCPP_END_NAMESPACE_STD |
| 144 | 142 | ||
| 143 | #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | ||
| 144 | |||
| 145 | #endif // _LIBCPP___FUNCTIONAL_MEM_FUN_REF_H | 145 | #endif // _LIBCPP___FUNCTIONAL_MEM_FUN_REF_H |
lib/libcxx/include/__functional/operations.h+4-4| ... | @@ -379,8 +379,8 @@ struct less<void> { | ... | @@ -379,8 +379,8 @@ struct less<void> { |
| 379 | typedef void is_transparent; | 379 | typedef void is_transparent; |
| 380 | }; | 380 | }; |
| 381 | 381 | ||
| 382 | template <class _Tp> | 382 | template <class _ArgumentType> |
| 383 | struct __make_transparent<_Tp, less<_Tp> > { | 383 | struct __make_transparent<_ArgumentType, less<_ArgumentType> > { |
| 384 | using type _LIBCPP_NODEBUG = less<>; | 384 | using type _LIBCPP_NODEBUG = less<>; |
| 385 | }; | 385 | }; |
| 386 | 386 | ||
| ... | @@ -477,8 +477,8 @@ struct greater<void> { | ... | @@ -477,8 +477,8 @@ struct greater<void> { |
| 477 | template <class _Tp, class _Up> | 477 | template <class _Tp, class _Up> |
| 478 | inline const bool __desugars_to_v<__greater_tag, greater<>, _Tp, _Up> = true; | 478 | inline const bool __desugars_to_v<__greater_tag, greater<>, _Tp, _Up> = true; |
| 479 | 479 | ||
| 480 | template <class _Tp> | 480 | template <class _ArgumentType> |
| 481 | struct __make_transparent<_Tp, greater<_Tp>> { | 481 | struct __make_transparent<_ArgumentType, greater<_ArgumentType>> { |
| 482 | using type _LIBCPP_NODEBUG = greater<>; | 482 | using type _LIBCPP_NODEBUG = greater<>; |
| 483 | }; | 483 | }; |
| 484 | 484 |
lib/libcxx/include/__functional/perfect_forward.h+4-4| ... | @@ -28,10 +28,10 @@ | ... | @@ -28,10 +28,10 @@ |
| 28 | _LIBCPP_PUSH_MACROS | 28 | _LIBCPP_PUSH_MACROS |
| 29 | #include <__undef_macros> | 29 | #include <__undef_macros> |
| 30 | 30 | ||
| 31 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 32 | |||
| 33 | #if _LIBCPP_STD_VER >= 17 | 31 | #if _LIBCPP_STD_VER >= 17 |
| 34 | 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 34 | |||
| 35 | template <class _Op, class _Indices, class... _BoundArgs> | 35 | template <class _Op, class _Indices, class... _BoundArgs> |
| 36 | struct __perfect_forward_impl; | 36 | struct __perfect_forward_impl; |
| 37 | 37 | ||
| ... | @@ -96,10 +96,10 @@ public: | ... | @@ -96,10 +96,10 @@ public: |
| 96 | template <class _Op, class... _Args> | 96 | template <class _Op, class... _Args> |
| 97 | using __perfect_forward _LIBCPP_NODEBUG = __perfect_forward_impl<_Op, index_sequence_for<_Args...>, _Args...>; | 97 | using __perfect_forward _LIBCPP_NODEBUG = __perfect_forward_impl<_Op, index_sequence_for<_Args...>, _Args...>; |
| 98 | 98 | ||
| 99 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 100 | |||
| 101 | _LIBCPP_END_NAMESPACE_STD | 99 | _LIBCPP_END_NAMESPACE_STD |
| 102 | 100 | ||
| 101 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 102 | |||
| 103 | _LIBCPP_POP_MACROS | 103 | _LIBCPP_POP_MACROS |
| 104 | 104 | ||
| 105 | #endif // _LIBCPP___FUNCTIONAL_PERFECT_FORWARD_H | 105 | #endif // _LIBCPP___FUNCTIONAL_PERFECT_FORWARD_H |
lib/libcxx/include/__functional/pointer_to_binary_function.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | 20 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _Arg1, class _Arg2, class _Result> | 24 | template <class _Arg1, class _Arg2, class _Result> |
| 25 | class _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function : public __binary_function<_Arg1, _Arg2, _Result> { | 25 | class _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function : public __binary_function<_Arg1, _Arg2, _Result> { |
| 26 | _Result (*__f_)(_Arg1, _Arg2); | 26 | _Result (*__f_)(_Arg1, _Arg2); |
| ... | @@ -36,8 +36,8 @@ ptr_fun(_Result (*__f)(_Arg1, _Arg2)) { | ... | @@ -36,8 +36,8 @@ ptr_fun(_Result (*__f)(_Arg1, _Arg2)) { |
| 36 | return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__f); | 36 | return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__f); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | #endif | ||
| 40 | |||
| 41 | _LIBCPP_END_NAMESPACE_STD | 39 | _LIBCPP_END_NAMESPACE_STD |
| 42 | 40 | ||
| 41 | #endif | ||
| 42 | |||
| 43 | #endif // _LIBCPP___FUNCTIONAL_POINTER_TO_BINARY_FUNCTION_H | 43 | #endif // _LIBCPP___FUNCTIONAL_POINTER_TO_BINARY_FUNCTION_H |
lib/libcxx/include/__functional/pointer_to_unary_function.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | 20 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _Arg, class _Result> | 24 | template <class _Arg, class _Result> |
| 25 | class _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function : public __unary_function<_Arg, _Result> { | 25 | class _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function : public __unary_function<_Arg, _Result> { |
| 26 | _Result (*__f_)(_Arg); | 26 | _Result (*__f_)(_Arg); |
| ... | @@ -36,8 +36,8 @@ ptr_fun(_Result (*__f)(_Arg)) { | ... | @@ -36,8 +36,8 @@ ptr_fun(_Result (*__f)(_Arg)) { |
| 36 | return pointer_to_unary_function<_Arg, _Result>(__f); | 36 | return pointer_to_unary_function<_Arg, _Result>(__f); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | ||
| 40 | |||
| 41 | _LIBCPP_END_NAMESPACE_STD | 39 | _LIBCPP_END_NAMESPACE_STD |
| 42 | 40 | ||
| 41 | #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) | ||
| 42 | |||
| 43 | #endif // _LIBCPP___FUNCTIONAL_POINTER_TO_UNARY_FUNCTION_H | 43 | #endif // _LIBCPP___FUNCTIONAL_POINTER_TO_UNARY_FUNCTION_H |
lib/libcxx/include/__functional/ranges_operations.h+4-4| ... | @@ -21,10 +21,10 @@ | ... | @@ -21,10 +21,10 @@ |
| 21 | # pragma GCC system_header | 21 | # pragma GCC system_header |
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | #if _LIBCPP_STD_VER >= 20 | 24 | #if _LIBCPP_STD_VER >= 20 |
| 27 | 25 | ||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 27 | |||
| 28 | namespace ranges { | 28 | namespace ranges { |
| 29 | 29 | ||
| 30 | struct equal_to { | 30 | struct equal_to { |
| ... | @@ -115,8 +115,8 @@ inline const bool __is_generic_transparent_comparator_v<ranges::less> = true; | ... | @@ -115,8 +115,8 @@ inline const bool __is_generic_transparent_comparator_v<ranges::less> = true; |
| 115 | template <> | 115 | template <> |
| 116 | inline const bool __is_generic_transparent_comparator_v<ranges::greater> = true; | 116 | inline const bool __is_generic_transparent_comparator_v<ranges::greater> = true; |
| 117 | 117 | ||
| 118 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 119 | |||
| 120 | _LIBCPP_END_NAMESPACE_STD | 118 | _LIBCPP_END_NAMESPACE_STD |
| 121 | 119 | ||
| 120 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 121 | |||
| 122 | #endif // _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H | 122 | #endif // _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H |
lib/libcxx/include/__functional/unary_negate.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) | 20 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _Predicate> | 24 | template <class _Predicate> |
| 25 | class _LIBCPP_DEPRECATED_IN_CXX17 unary_negate : public __unary_function<typename _Predicate::argument_type, bool> { | 25 | class _LIBCPP_DEPRECATED_IN_CXX17 unary_negate : public __unary_function<typename _Predicate::argument_type, bool> { |
| 26 | _Predicate __pred_; | 26 | _Predicate __pred_; |
| ... | @@ -40,8 +40,8 @@ not1(const _Predicate& __pred) { | ... | @@ -40,8 +40,8 @@ not1(const _Predicate& __pred) { |
| 40 | return unary_negate<_Predicate>(__pred); | 40 | return unary_negate<_Predicate>(__pred); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) | ||
| 44 | |||
| 45 | _LIBCPP_END_NAMESPACE_STD | 43 | _LIBCPP_END_NAMESPACE_STD |
| 46 | 44 | ||
| 45 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) | ||
| 46 | |||
| 47 | #endif // _LIBCPP___FUNCTIONAL_UNARY_NEGATE_H | 47 | #endif // _LIBCPP___FUNCTIONAL_UNARY_NEGATE_H |
lib/libcxx/include/__fwd/format.h+22-5| ... | @@ -11,28 +11,45 @@ | ... | @@ -11,28 +11,45 @@ |
| 11 | #define _LIBCPP___FWD_FORMAT_H | 11 | #define _LIBCPP___FWD_FORMAT_H |
| 12 | 12 | ||
| 13 | #include <__config> | 13 | #include <__config> |
| 14 | #include <__iterator/concepts.h> | ||
| 15 | 14 | ||
| 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 18 | #endif | 17 | #endif |
| 19 | 18 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 19 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 24 | template <class _Context> | 23 | template <class _Context> |
| 25 | class basic_format_arg; | 24 | class basic_format_arg; |
| 26 | 25 | ||
| 27 | template <class _OutIt, class _CharT> | 26 | template <class _OutIt, class _CharT> |
| 28 | requires output_iterator<_OutIt, const _CharT&> | ||
| 29 | class basic_format_context; | 27 | class basic_format_context; |
| 30 | 28 | ||
| 31 | template <class _Tp, class _CharT = char> | 29 | template <class _Tp, class _CharT = char> |
| 32 | struct formatter; | 30 | struct formatter; |
| 33 | 31 | ||
| 34 | #endif // _LIBCPP_STD_VER >= 20 | 32 | # if _LIBCPP_STD_VER >= 23 |
| 33 | |||
| 34 | _LIBCPP_DIAGNOSTIC_PUSH | ||
| 35 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wshadow") | ||
| 36 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wshadow") | ||
| 37 | // This shadows map, set, and string. | ||
| 38 | enum class range_format { disabled, map, set, sequence, string, debug_string }; | ||
| 39 | _LIBCPP_DIAGNOSTIC_POP | ||
| 40 | |||
| 41 | template <class _Rp> | ||
| 42 | constexpr range_format format_kind = [] { | ||
| 43 | // [format.range.fmtkind]/1 | ||
| 44 | // A program that instantiates the primary template of format_kind is ill-formed. | ||
| 45 | static_assert(sizeof(_Rp) != sizeof(_Rp), "create a template specialization of format_kind for your type"); | ||
| 46 | return range_format::disabled; | ||
| 47 | }(); | ||
| 48 | |||
| 49 | # endif // _LIBCPP_STD_VER >= 23 | ||
| 35 | 50 | ||
| 36 | _LIBCPP_END_NAMESPACE_STD | 51 | _LIBCPP_END_NAMESPACE_STD |
| 37 | 52 | ||
| 53 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 54 | |||
| 38 | #endif // _LIBCPP___FWD_FORMAT_H | 55 | #endif // _LIBCPP___FWD_FORMAT_H |
lib/libcxx/include/__fwd/map.h deleted-31| ... | @@ -1,31 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___FWD_MAP_H | ||
| 10 | #define _LIBCPP___FWD_MAP_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__fwd/functional.h> | ||
| 14 | #include <__fwd/memory.h> | ||
| 15 | #include <__fwd/pair.h> | ||
| 16 | |||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 18 | # pragma GCC system_header | ||
| 19 | #endif | ||
| 20 | |||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > > | ||
| 24 | class map; | ||
| 25 | |||
| 26 | template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > > | ||
| 27 | class multimap; | ||
| 28 | |||
| 29 | _LIBCPP_END_NAMESPACE_STD | ||
| 30 | |||
| 31 | #endif // _LIBCPP___FWD_MAP_H | ||
lib/libcxx/include/__fwd/set.h deleted-30| ... | @@ -1,30 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___FWD_SET_H | ||
| 10 | #define _LIBCPP___FWD_SET_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__fwd/functional.h> | ||
| 14 | #include <__fwd/memory.h> | ||
| 15 | |||
| 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 17 | # pragma GCC system_header | ||
| 18 | #endif | ||
| 19 | |||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> > | ||
| 23 | class set; | ||
| 24 | |||
| 25 | template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> > | ||
| 26 | class multiset; | ||
| 27 | |||
| 28 | _LIBCPP_END_NAMESPACE_STD | ||
| 29 | |||
| 30 | #endif // _LIBCPP___FWD_SET_H | ||
lib/libcxx/include/__fwd/span.h+4-4| ... | @@ -21,18 +21,18 @@ | ... | @@ -21,18 +21,18 @@ |
| 21 | _LIBCPP_PUSH_MACROS | 21 | _LIBCPP_PUSH_MACROS |
| 22 | #include <__undef_macros> | 22 | #include <__undef_macros> |
| 23 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | #if _LIBCPP_STD_VER >= 20 | 24 | #if _LIBCPP_STD_VER >= 20 |
| 27 | 25 | ||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 27 | |||
| 28 | inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max(); | 28 | inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max(); |
| 29 | template <typename _Tp, size_t _Extent = dynamic_extent> | 29 | template <typename _Tp, size_t _Extent = dynamic_extent> |
| 30 | class span; | 30 | class span; |
| 31 | 31 | ||
| 32 | #endif | ||
| 33 | |||
| 34 | _LIBCPP_END_NAMESPACE_STD | 32 | _LIBCPP_END_NAMESPACE_STD |
| 35 | 33 | ||
| 34 | #endif | ||
| 35 | |||
| 36 | _LIBCPP_POP_MACROS | 36 | _LIBCPP_POP_MACROS |
| 37 | 37 | ||
| 38 | #endif // _LIBCPP___FWD_SPAN_H | 38 | #endif // _LIBCPP___FWD_SPAN_H |
lib/libcxx/include/__fwd/variant.h+4-4| ... | @@ -16,10 +16,10 @@ | ... | @@ -16,10 +16,10 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | #if _LIBCPP_STD_VER >= 17 | 19 | #if _LIBCPP_STD_VER >= 17 |
| 22 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | template <class... _Types> | 23 | template <class... _Types> |
| 24 | class variant; | 24 | class variant; |
| 25 | 25 | ||
| ... | @@ -61,8 +61,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& get(const variant<_Types...>&); | ... | @@ -61,8 +61,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& get(const variant<_Types...>&); |
| 61 | template <class _Tp, class... _Types> | 61 | template <class _Tp, class... _Types> |
| 62 | _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& get(const variant<_Types...>&&); | 62 | _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& get(const variant<_Types...>&&); |
| 63 | 63 | ||
| 64 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 65 | |||
| 66 | _LIBCPP_END_NAMESPACE_STD | 64 | _LIBCPP_END_NAMESPACE_STD |
| 67 | 65 | ||
| 66 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 67 | |||
| 68 | #endif // _LIBCPP___FWD_VARIANT_H | 68 | #endif // _LIBCPP___FWD_VARIANT_H |
lib/libcxx/include/__hash_table+17-3| ... | @@ -41,6 +41,8 @@ | ... | @@ -41,6 +41,8 @@ |
| 41 | #include <__type_traits/is_swappable.h> | 41 | #include <__type_traits/is_swappable.h> |
| 42 | #include <__type_traits/remove_const.h> | 42 | #include <__type_traits/remove_const.h> |
| 43 | #include <__type_traits/remove_cvref.h> | 43 | #include <__type_traits/remove_cvref.h> |
| 44 | #include <__utility/exception_guard.h> | ||
| 45 | #include <__utility/exchange.h> | ||
| 44 | #include <__utility/forward.h> | 46 | #include <__utility/forward.h> |
| 45 | #include <__utility/move.h> | 47 | #include <__utility/move.h> |
| 46 | #include <__utility/pair.h> | 48 | #include <__utility/pair.h> |
| ... | @@ -73,7 +75,9 @@ struct __is_hash_value_type : false_type {}; | ... | @@ -73,7 +75,9 @@ struct __is_hash_value_type : false_type {}; |
| 73 | template <class _One> | 75 | template <class _One> |
| 74 | struct __is_hash_value_type<_One> : __is_hash_value_type_imp<__remove_cvref_t<_One> > {}; | 76 | struct __is_hash_value_type<_One> : __is_hash_value_type_imp<__remove_cvref_t<_One> > {}; |
| 75 | 77 | ||
| 78 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 76 | _LIBCPP_EXPORTED_FROM_ABI size_t __next_prime(size_t __n); | 79 | _LIBCPP_EXPORTED_FROM_ABI size_t __next_prime(size_t __n); |
| 80 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 77 | 81 | ||
| 78 | template <class _NodePtr> | 82 | template <class _NodePtr> |
| 79 | struct __hash_node_base { | 83 | struct __hash_node_base { |
| ... | @@ -524,9 +528,7 @@ public: | ... | @@ -524,9 +528,7 @@ public: |
| 524 | 528 | ||
| 525 | _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator(__bucket_list_deallocator&& __x) | 529 | _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator(__bucket_list_deallocator&& __x) |
| 526 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) | 530 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) |
| 527 | : __size_(std::move(__x.__size_)), __alloc_(std::move(__x.__alloc_)) { | 531 | : __size_(std::__exchange(__x.__size_, 0)), __alloc_(std::move(__x.__alloc_)) {} |
| 528 | __x.size() = 0; | ||
| 529 | } | ||
| 530 | 532 | ||
| 531 | _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __size_; } | 533 | _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __size_; } |
| 532 | _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; } | 534 | _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; } |
| ... | @@ -696,6 +698,17 @@ private: | ... | @@ -696,6 +698,17 @@ private: |
| 696 | 698 | ||
| 697 | _LIBCPP_HIDE_FROM_ABI void __copy_construct(__next_pointer __other_iter) { | 699 | _LIBCPP_HIDE_FROM_ABI void __copy_construct(__next_pointer __other_iter) { |
| 698 | __next_pointer __own_iter = __first_node_.__ptr(); | 700 | __next_pointer __own_iter = __first_node_.__ptr(); |
| 701 | // If copying a node throws, the nodes that have already been constructed and linked into the | ||
| 702 | // list have to be deallocated. When this is called from the copy constructor the enclosing | ||
| 703 | // __hash_table is not fully constructed yet, so its destructor would not run to release them. | ||
| 704 | // This is also reached from operator= when assigning into an empty table; there the table | ||
| 705 | // stays alive, so we must leave it in a valid empty state: besides releasing the nodes we | ||
| 706 | // clear the bucket pointers, which were made to point into the now-deallocated node list. | ||
| 707 | auto __guard = std::__make_exception_guard([&] { | ||
| 708 | __deallocate_node_list(__first_node_.__next_); | ||
| 709 | __first_node_.__next_ = nullptr; | ||
| 710 | std::fill_n(__bucket_list_.get(), bucket_count(), nullptr); | ||
| 711 | }); | ||
| 699 | { | 712 | { |
| 700 | __node_holder __new_node = __construct_node_hash(__other_iter->__hash(), __other_iter->__upcast()->__get_value()); | 713 | __node_holder __new_node = __construct_node_hash(__other_iter->__hash(), __other_iter->__upcast()->__get_value()); |
| 701 | __own_iter->__next_ = static_cast<__next_pointer>(__new_node.release()); | 714 | __own_iter->__next_ = static_cast<__next_pointer>(__new_node.release()); |
| ... | @@ -706,6 +719,7 @@ private: | ... | @@ -706,6 +719,7 @@ private: |
| 706 | __other_iter = __other_iter->__next_; | 719 | __other_iter = __other_iter->__next_; |
| 707 | __own_iter = __own_iter->__next_; | 720 | __own_iter = __own_iter->__next_; |
| 708 | __copy_construct(__other_iter, __own_iter, __current_chash); | 721 | __copy_construct(__other_iter, __own_iter, __current_chash); |
| 722 | __guard.__complete(); | ||
| 709 | } | 723 | } |
| 710 | 724 | ||
| 711 | public: | 725 | public: |
lib/libcxx/include/__iterator/access.h+15-13| ... | @@ -20,47 +20,49 @@ | ... | @@ -20,47 +20,49 @@ |
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | ||
| 22 | template <class _Tp, size_t _Np> | 22 | template <class _Tp, size_t _Np> |
| 23 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* begin(_Tp (&__array)[_Np]) _NOEXCEPT { | 23 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* begin(_Tp (&__array)[_Np]) _NOEXCEPT { |
| 24 | return __array; | 24 | return __array; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | template <class _Tp, size_t _Np> | 27 | template <class _Tp, size_t _Np> |
| 28 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* end(_Tp (&__array)[_Np]) _NOEXCEPT { | 28 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* end(_Tp (&__array)[_Np]) _NOEXCEPT { |
| 29 | return __array + _Np; | 29 | return __array + _Np; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | #if !defined(_LIBCPP_CXX03_LANG) | 32 | #if !defined(_LIBCPP_CXX03_LANG) |
| 33 | 33 | ||
| 34 | template <class _Cp> | 34 | template <class _Cp> |
| 35 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(_Cp& __c) -> decltype(__c.begin()) { | 35 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(_Cp& __c) -> decltype(__c.begin()) { |
| 36 | return __c.begin(); | 36 | return __c.begin(); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | template <class _Cp> | 39 | template <class _Cp> |
| 40 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(const _Cp& __c) -> decltype(__c.begin()) { | 40 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(const _Cp& __c) |
| 41 | -> decltype(__c.begin()) { | ||
| 41 | return __c.begin(); | 42 | return __c.begin(); |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 44 | template <class _Cp> | 45 | template <class _Cp> |
| 45 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(_Cp& __c) -> decltype(__c.end()) { | 46 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(_Cp& __c) -> decltype(__c.end()) { |
| 46 | return __c.end(); | 47 | return __c.end(); |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | template <class _Cp> | 50 | template <class _Cp> |
| 50 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(const _Cp& __c) -> decltype(__c.end()) { | 51 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(const _Cp& __c) -> decltype(__c.end()) { |
| 51 | return __c.end(); | 52 | return __c.end(); |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | # if _LIBCPP_STD_VER >= 14 | 55 | # if _LIBCPP_STD_VER >= 14 |
| 55 | 56 | ||
| 56 | template <class _Cp> | 57 | template <class _Cp> |
| 57 | _LIBCPP_HIDE_FROM_ABI constexpr auto | 58 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr auto cbegin(const _Cp& __c) noexcept(noexcept(std::begin(__c))) |
| 58 | cbegin(const _Cp& __c) noexcept(noexcept(std::begin(__c))) -> decltype(std::begin(__c)) { | 59 | -> decltype(std::begin(__c)) { |
| 59 | return std::begin(__c); | 60 | return std::begin(__c); |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | template <class _Cp> | 63 | template <class _Cp> |
| 63 | _LIBCPP_HIDE_FROM_ABI constexpr auto cend(const _Cp& __c) noexcept(noexcept(std::end(__c))) -> decltype(std::end(__c)) { | 64 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr auto cend(const _Cp& __c) noexcept(noexcept(std::end(__c))) |
| 65 | -> decltype(std::end(__c)) { | ||
| 64 | return std::end(__c); | 66 | return std::end(__c); |
| 65 | } | 67 | } |
| 66 | 68 | ||
| ... | @@ -69,22 +71,22 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto cend(const _Cp& __c) noexcept(noexcept(std: | ... | @@ -69,22 +71,22 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto cend(const _Cp& __c) noexcept(noexcept(std: |
| 69 | #else // defined(_LIBCPP_CXX03_LANG) | 71 | #else // defined(_LIBCPP_CXX03_LANG) |
| 70 | 72 | ||
| 71 | template <class _Cp> | 73 | template <class _Cp> |
| 72 | _LIBCPP_HIDE_FROM_ABI typename _Cp::iterator begin(_Cp& __c) { | 74 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI typename _Cp::iterator begin(_Cp& __c) { |
| 73 | return __c.begin(); | 75 | return __c.begin(); |
| 74 | } | 76 | } |
| 75 | 77 | ||
| 76 | template <class _Cp> | 78 | template <class _Cp> |
| 77 | _LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator begin(const _Cp& __c) { | 79 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator begin(const _Cp& __c) { |
| 78 | return __c.begin(); | 80 | return __c.begin(); |
| 79 | } | 81 | } |
| 80 | 82 | ||
| 81 | template <class _Cp> | 83 | template <class _Cp> |
| 82 | _LIBCPP_HIDE_FROM_ABI typename _Cp::iterator end(_Cp& __c) { | 84 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI typename _Cp::iterator end(_Cp& __c) { |
| 83 | return __c.end(); | 85 | return __c.end(); |
| 84 | } | 86 | } |
| 85 | 87 | ||
| 86 | template <class _Cp> | 88 | template <class _Cp> |
| 87 | _LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator end(const _Cp& __c) { | 89 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator end(const _Cp& __c) { |
| 88 | return __c.end(); | 90 | return __c.end(); |
| 89 | } | 91 | } |
| 90 | 92 |
lib/libcxx/include/__iterator/back_insert_iterator.h+3-1| ... | @@ -58,7 +58,9 @@ public: | ... | @@ -58,7 +58,9 @@ public: |
| 58 | return *this; | 58 | return *this; |
| 59 | } | 59 | } |
| 60 | #endif // _LIBCPP_CXX03_LANG | 60 | #endif // _LIBCPP_CXX03_LANG |
| 61 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator*() { return *this; } | 61 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator*() { |
| 62 | return *this; | ||
| 63 | } | ||
| 62 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator++() { return *this; } | 64 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator++() { return *this; } |
| 63 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator operator++(int) { return *this; } | 65 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator operator++(int) { return *this; } |
| 64 | 66 |
lib/libcxx/include/__iterator/bounded_iter.h+7-9| ... | @@ -53,9 +53,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -53,9 +53,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 53 | // optimizations deleting non-redundant bounds checks. | 53 | // optimizations deleting non-redundant bounds checks. |
| 54 | template <class _Iterator> | 54 | template <class _Iterator> |
| 55 | struct __bounded_iter { | 55 | struct __bounded_iter { |
| 56 | static_assert(__libcpp_is_contiguous_iterator<_Iterator>::value, | ||
| 57 | "Only contiguous iterators can be adapted by __bounded_iter."); | ||
| 58 | |||
| 59 | using value_type = typename iterator_traits<_Iterator>::value_type; | 56 | using value_type = typename iterator_traits<_Iterator>::value_type; |
| 60 | using difference_type = typename iterator_traits<_Iterator>::difference_type; | 57 | using difference_type = typename iterator_traits<_Iterator>::difference_type; |
| 61 | using pointer = typename iterator_traits<_Iterator>::pointer; | 58 | using pointer = typename iterator_traits<_Iterator>::pointer; |
| ... | @@ -117,7 +114,7 @@ public: | ... | @@ -117,7 +114,7 @@ public: |
| 117 | // that the iterator is always within `[begin, end]`, we only need to check it's not pointing to | 114 | // that the iterator is always within `[begin, end]`, we only need to check it's not pointing to |
| 118 | // `end`. This is easier for the optimizer because it aligns with the `iter != container.end()` | 115 | // `end`. This is easier for the optimizer because it aligns with the `iter != container.end()` |
| 119 | // checks that typical callers already use (see https://llvm.org/PR78829). | 116 | // checks that typical callers already use (see https://llvm.org/PR78829). |
| 120 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { | 117 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { |
| 121 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | 118 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( |
| 122 | __current_ != __end_, "__bounded_iter::operator*: Attempt to dereference an iterator at the end"); | 119 | __current_ != __end_, "__bounded_iter::operator*: Attempt to dereference an iterator at the end"); |
| 123 | return *__current_; | 120 | return *__current_; |
| ... | @@ -129,7 +126,8 @@ public: | ... | @@ -129,7 +126,8 @@ public: |
| 129 | return std::__to_address(__current_); | 126 | return std::__to_address(__current_); |
| 130 | } | 127 | } |
| 131 | 128 | ||
| 132 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT { | 129 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference |
| 130 | operator[](difference_type __n) const _NOEXCEPT { | ||
| 133 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | 131 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( |
| 134 | __n >= __begin_ - __current_, "__bounded_iter::operator[]: Attempt to index an iterator past the start"); | 132 | __n >= __begin_ - __current_, "__bounded_iter::operator[]: Attempt to index an iterator past the start"); |
| 135 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | 133 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( |
| ... | @@ -172,13 +170,13 @@ public: | ... | @@ -172,13 +170,13 @@ public: |
| 172 | __current_ += __n; | 170 | __current_ += __n; |
| 173 | return *this; | 171 | return *this; |
| 174 | } | 172 | } |
| 175 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter | 173 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter |
| 176 | operator+(__bounded_iter const& __self, difference_type __n) _NOEXCEPT { | 174 | operator+(__bounded_iter const& __self, difference_type __n) _NOEXCEPT { |
| 177 | __bounded_iter __tmp(__self); | 175 | __bounded_iter __tmp(__self); |
| 178 | __tmp += __n; | 176 | __tmp += __n; |
| 179 | return __tmp; | 177 | return __tmp; |
| 180 | } | 178 | } |
| 181 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter | 179 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter |
| 182 | operator+(difference_type __n, __bounded_iter const& __self) _NOEXCEPT { | 180 | operator+(difference_type __n, __bounded_iter const& __self) _NOEXCEPT { |
| 183 | __bounded_iter __tmp(__self); | 181 | __bounded_iter __tmp(__self); |
| 184 | __tmp += __n; | 182 | __tmp += __n; |
| ... | @@ -193,13 +191,13 @@ public: | ... | @@ -193,13 +191,13 @@ public: |
| 193 | __current_ -= __n; | 191 | __current_ -= __n; |
| 194 | return *this; | 192 | return *this; |
| 195 | } | 193 | } |
| 196 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter | 194 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter |
| 197 | operator-(__bounded_iter const& __self, difference_type __n) _NOEXCEPT { | 195 | operator-(__bounded_iter const& __self, difference_type __n) _NOEXCEPT { |
| 198 | __bounded_iter __tmp(__self); | 196 | __bounded_iter __tmp(__self); |
| 199 | __tmp -= __n; | 197 | __tmp -= __n; |
| 200 | return __tmp; | 198 | return __tmp; |
| 201 | } | 199 | } |
| 202 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend difference_type | 200 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend difference_type |
| 203 | operator-(__bounded_iter const& __x, __bounded_iter const& __y) _NOEXCEPT { | 201 | operator-(__bounded_iter const& __x, __bounded_iter const& __y) _NOEXCEPT { |
| 204 | return __x.__current_ - __y.__current_; | 202 | return __x.__current_ - __y.__current_; |
| 205 | } | 203 | } |
lib/libcxx/include/__iterator/capacity_aware_iterator.h created+186| ... | @@ -0,0 +1,186 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___CAPACITY_AWARE_ITERATOR_H | ||
| 11 | #define _LIBCPP___CAPACITY_AWARE_ITERATOR_H | ||
| 12 | |||
| 13 | #include <__assert> | ||
| 14 | #include <__compare/ordering.h> | ||
| 15 | #include <__compare/three_way_comparable.h> | ||
| 16 | #include <__config> | ||
| 17 | #include <__cstddef/size_t.h> | ||
| 18 | #include <__iterator/concepts.h> | ||
| 19 | #include <__iterator/incrementable_traits.h> | ||
| 20 | #include <__iterator/iterator_traits.h> | ||
| 21 | #include <__memory/pointer_traits.h> | ||
| 22 | #include <__type_traits/is_constructible.h> | ||
| 23 | #include <__type_traits/is_convertible.h> | ||
| 24 | #include <__utility/move.h> | ||
| 25 | |||
| 26 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 27 | # pragma GCC system_header | ||
| 28 | #endif | ||
| 29 | |||
| 30 | _LIBCPP_PUSH_MACROS | ||
| 31 | #include <__undef_macros> | ||
| 32 | |||
| 33 | #if _LIBCPP_STD_VER >= 26 | ||
| 34 | |||
| 35 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 36 | |||
| 37 | // __capacity_aware_iterator is an iterator that wraps a contiguous iterator and encodes the maximum number of | ||
| 38 | // elements that can appear in a range of such iterators. That maximum number of elements must be known at compile-time. | ||
| 39 | // As of writing, the only standard library containers which fulfill these requirements are inplace_vector and optional. | ||
| 40 | // | ||
| 41 | // It also embeds a tag type to prevent mixing iterators from e.g. different containers. This also allows for some | ||
| 42 | // algorithms to detect this iterator and perform optimizations based on the added semantic information. | ||
| 43 | |||
| 44 | template <class _Iter, class _Tag, size_t _RangeMaxElements> | ||
| 45 | class __capacity_aware_iterator { | ||
| 46 | private: | ||
| 47 | _Iter __iter_; | ||
| 48 | |||
| 49 | template <class, class, size_t> | ||
| 50 | friend class __capacity_aware_iterator; | ||
| 51 | |||
| 52 | public: | ||
| 53 | static_assert(contiguous_iterator<_Iter>, "__capacity_aware_iterator can only be used with contiguous iterators"); | ||
| 54 | |||
| 55 | using iterator_category = iterator_traits<_Iter>::iterator_category; | ||
| 56 | using iterator_concept = contiguous_iterator_tag; | ||
| 57 | using difference_type = iter_difference_t<_Iter>; | ||
| 58 | using pointer = iterator_traits<_Iter>::pointer; | ||
| 59 | using reference = iter_reference_t<_Iter>; | ||
| 60 | using value_type = iter_value_t<_Iter>; | ||
| 61 | |||
| 62 | _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator() | ||
| 63 | requires is_default_constructible_v<_Iter> | ||
| 64 | = default; | ||
| 65 | |||
| 66 | template <typename _Iter2> | ||
| 67 | requires is_convertible_v<_Iter2, _Iter> | ||
| 68 | _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator( | ||
| 69 | const __capacity_aware_iterator<_Iter2, _Tag, _RangeMaxElements>& __y) noexcept | ||
| 70 | : __iter_(__y.__iter_) {} | ||
| 71 | |||
| 72 | template <class _It, class _Tag2, size_t _RangeMaxElems2> | ||
| 73 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto __make_capacity_aware_iterator(_It __iter) noexcept; | ||
| 74 | |||
| 75 | private: | ||
| 76 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __capacity_aware_iterator(_Iter __iter) : __iter_(std::move(__iter)) {} | ||
| 77 | |||
| 78 | public: | ||
| 79 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const noexcept { return *__iter_; } | ||
| 80 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator->() const noexcept { return std::__to_address(__iter_); } | ||
| 81 | |||
| 82 | _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator& operator++() noexcept { | ||
| 83 | ++__iter_; | ||
| 84 | return *this; | ||
| 85 | } | ||
| 86 | |||
| 87 | _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator operator++(int) noexcept { | ||
| 88 | __capacity_aware_iterator __tmp(*this); | ||
| 89 | ++*this; | ||
| 90 | return __tmp; | ||
| 91 | } | ||
| 92 | |||
| 93 | _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator& operator--() noexcept { | ||
| 94 | --__iter_; | ||
| 95 | return *this; | ||
| 96 | } | ||
| 97 | |||
| 98 | _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator operator--(int) noexcept { | ||
| 99 | __capacity_aware_iterator __tmp(*this); | ||
| 100 | --*this; | ||
| 101 | return __tmp; | ||
| 102 | } | ||
| 103 | |||
| 104 | _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator& operator+=(difference_type __n) noexcept { | ||
| 105 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 106 | static_cast<size_t>(__n >= 0 ? __n : -__n) <= _RangeMaxElements, | ||
| 107 | "__capacity_aware_iterator::operator+=: Attempting to move iterator past its container's possible range"); | ||
| 108 | |||
| 109 | __iter_ += __n; | ||
| 110 | return *this; | ||
| 111 | } | ||
| 112 | |||
| 113 | _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator& operator-=(difference_type __n) noexcept { | ||
| 114 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 115 | static_cast<size_t>(__n >= 0 ? __n : -__n) <= _RangeMaxElements, | ||
| 116 | "__capacity_aware_iterator::operator-=: Attempting to move iterator past its container's possible range"); | ||
| 117 | |||
| 118 | __iter_ -= __n; | ||
| 119 | return *this; | ||
| 120 | } | ||
| 121 | |||
| 122 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const noexcept { | ||
| 123 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 124 | static_cast<size_t>(__n >= 0 ? __n : -__n) < _RangeMaxElements, | ||
| 125 | "__capacity_aware_iterator::operator[]: Attempting to index iterator past its container's possible range"); | ||
| 126 | return *(*this + __n); | ||
| 127 | } | ||
| 128 | |||
| 129 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | ||
| 130 | operator==(const __capacity_aware_iterator& __x, const __capacity_aware_iterator& __y) noexcept { | ||
| 131 | return __x.__iter_ == __y.__iter_; | ||
| 132 | } | ||
| 133 | |||
| 134 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto | ||
| 135 | operator<=>(const __capacity_aware_iterator& __x, const __capacity_aware_iterator& __y) noexcept { | ||
| 136 | if constexpr (three_way_comparable_with<_Iter, _Iter, strong_ordering>) { | ||
| 137 | return __x.__iter_ <=> __y.__iter_; | ||
| 138 | } else { | ||
| 139 | if (__x.__iter_ < __y.__iter_) { | ||
| 140 | return strong_ordering::less; | ||
| 141 | } else if (__x.__iter_ == __y.__iter_) { | ||
| 142 | return strong_ordering::equal; | ||
| 143 | } | ||
| 144 | return strong_ordering::greater; | ||
| 145 | } | ||
| 146 | } | ||
| 147 | |||
| 148 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __capacity_aware_iterator | ||
| 149 | operator+(const __capacity_aware_iterator& __i, difference_type __n) noexcept { | ||
| 150 | auto __tmp = __i; | ||
| 151 | __tmp += __n; | ||
| 152 | return __tmp; | ||
| 153 | } | ||
| 154 | |||
| 155 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __capacity_aware_iterator | ||
| 156 | operator+(difference_type __n, const __capacity_aware_iterator& __i) noexcept { | ||
| 157 | auto __tmp = __i; | ||
| 158 | __tmp += __n; | ||
| 159 | return __tmp; | ||
| 160 | } | ||
| 161 | |||
| 162 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __capacity_aware_iterator | ||
| 163 | operator-(const __capacity_aware_iterator& __i, difference_type __n) noexcept { | ||
| 164 | auto __tmp = __i; | ||
| 165 | __tmp -= __n; | ||
| 166 | return __tmp; | ||
| 167 | } | ||
| 168 | |||
| 169 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type | ||
| 170 | operator-(const __capacity_aware_iterator& __x, const __capacity_aware_iterator& __y) noexcept { | ||
| 171 | return difference_type(__x.__iter_ - __y.__iter_); | ||
| 172 | } | ||
| 173 | }; | ||
| 174 | |||
| 175 | template <class _It, class _Tag2, size_t _RangeMaxElems2> | ||
| 176 | _LIBCPP_HIDE_FROM_ABI constexpr auto __make_capacity_aware_iterator(_It __iter) noexcept { | ||
| 177 | return __capacity_aware_iterator<_It, _Tag2, _RangeMaxElems2>(__iter); | ||
| 178 | } | ||
| 179 | |||
| 180 | _LIBCPP_END_NAMESPACE_STD | ||
| 181 | |||
| 182 | #endif // _LIBCPP_STD_VER >= 26 | ||
| 183 | |||
| 184 | _LIBCPP_POP_MACROS | ||
| 185 | |||
| 186 | #endif // _LIBCPP___CAPACITY_AWARE_ITERATOR_H | ||
lib/libcxx/include/__iterator/common_iterator.h+3-3| ... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
| 17 | #include <__concepts/copyable.h> | 17 | #include <__concepts/copyable.h> |
| 18 | #include <__concepts/derived_from.h> | 18 | #include <__concepts/derived_from.h> |
| 19 | #include <__concepts/equality_comparable.h> | 19 | #include <__concepts/equality_comparable.h> |
| 20 | #include <__concepts/referenceable.h> | ||
| 20 | #include <__concepts/same_as.h> | 21 | #include <__concepts/same_as.h> |
| 21 | #include <__config> | 22 | #include <__config> |
| 22 | #include <__iterator/concepts.h> | 23 | #include <__iterator/concepts.h> |
| ... | @@ -28,7 +29,6 @@ | ... | @@ -28,7 +29,6 @@ |
| 28 | #include <__memory/addressof.h> | 29 | #include <__memory/addressof.h> |
| 29 | #include <__type_traits/conditional.h> | 30 | #include <__type_traits/conditional.h> |
| 30 | #include <__type_traits/is_pointer.h> | 31 | #include <__type_traits/is_pointer.h> |
| 31 | #include <__type_traits/is_referenceable.h> | ||
| 32 | #include <__utility/declval.h> | 32 | #include <__utility/declval.h> |
| 33 | #include <variant> | 33 | #include <variant> |
| 34 | 34 | ||
| ... | @@ -111,7 +111,7 @@ public: | ... | @@ -111,7 +111,7 @@ public: |
| 111 | return *this; | 111 | return *this; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() { | 114 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() { |
| 115 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | 115 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( |
| 116 | std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); | 116 | std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); |
| 117 | return *std::__unchecked_get<_Iter>(__hold_); | 117 | return *std::__unchecked_get<_Iter>(__hold_); |
| ... | @@ -237,7 +237,7 @@ public: | ... | @@ -237,7 +237,7 @@ public: |
| 237 | return std::__unchecked_get<_Sent>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_); | 237 | return std::__unchecked_get<_Sent>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) | 240 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) |
| 241 | iter_move(const common_iterator& __i) noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>()))) | 241 | iter_move(const common_iterator& __i) noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>()))) |
| 242 | requires input_iterator<_Iter> | 242 | requires input_iterator<_Iter> |
| 243 | { | 243 | { |
lib/libcxx/include/__iterator/concepts.h+8-9| ... | @@ -20,6 +20,8 @@ | ... | @@ -20,6 +20,8 @@ |
| 20 | #include <__concepts/invocable.h> | 20 | #include <__concepts/invocable.h> |
| 21 | #include <__concepts/movable.h> | 21 | #include <__concepts/movable.h> |
| 22 | #include <__concepts/predicate.h> | 22 | #include <__concepts/predicate.h> |
| 23 | #include <__concepts/primary_template.h> | ||
| 24 | #include <__concepts/referenceable.h> | ||
| 23 | #include <__concepts/regular.h> | 25 | #include <__concepts/regular.h> |
| 24 | #include <__concepts/relation.h> | 26 | #include <__concepts/relation.h> |
| 25 | #include <__concepts/same_as.h> | 27 | #include <__concepts/same_as.h> |
| ... | @@ -38,10 +40,7 @@ | ... | @@ -38,10 +40,7 @@ |
| 38 | #include <__type_traits/integral_constant.h> | 40 | #include <__type_traits/integral_constant.h> |
| 39 | #include <__type_traits/invoke.h> | 41 | #include <__type_traits/invoke.h> |
| 40 | #include <__type_traits/is_pointer.h> | 42 | #include <__type_traits/is_pointer.h> |
| 41 | #include <__type_traits/is_primary_template.h> | ||
| 42 | #include <__type_traits/is_reference.h> | 43 | #include <__type_traits/is_reference.h> |
| 43 | #include <__type_traits/is_referenceable.h> | ||
| 44 | #include <__type_traits/is_valid_expansion.h> | ||
| 45 | #include <__type_traits/remove_cv.h> | 44 | #include <__type_traits/remove_cv.h> |
| 46 | #include <__type_traits/remove_cvref.h> | 45 | #include <__type_traits/remove_cvref.h> |
| 47 | #include <__utility/forward.h> | 46 | #include <__utility/forward.h> |
| ... | @@ -80,7 +79,7 @@ template <class _Tp> | ... | @@ -80,7 +79,7 @@ template <class _Tp> |
| 80 | concept __specialization_of_projected = requires { | 79 | concept __specialization_of_projected = requires { |
| 81 | typename __projected_iterator_t<_Tp>; | 80 | typename __projected_iterator_t<_Tp>; |
| 82 | typename __projected_projection_t<_Tp>; | 81 | typename __projected_projection_t<_Tp>; |
| 83 | } && __is_primary_template<_Tp>::value; | 82 | } && __primary_template<_Tp>; |
| 84 | 83 | ||
| 85 | template <class _Tp> | 84 | template <class _Tp> |
| 86 | struct __indirect_value_t_impl { | 85 | struct __indirect_value_t_impl { |
| ... | @@ -153,8 +152,7 @@ concept sized_sentinel_for = | ... | @@ -153,8 +152,7 @@ concept sized_sentinel_for = |
| 153 | 152 | ||
| 154 | template <class _Iter> | 153 | template <class _Iter> |
| 155 | struct __iter_traits_cache { | 154 | struct __iter_traits_cache { |
| 156 | using type _LIBCPP_NODEBUG = | 155 | using type _LIBCPP_NODEBUG = _If<__primary_template<iterator_traits<_Iter> >, _Iter, iterator_traits<_Iter> >; |
| 157 | _If<__is_primary_template<iterator_traits<_Iter> >::value, _Iter, iterator_traits<_Iter> >; | ||
| 158 | }; | 156 | }; |
| 159 | template <class _Iter> | 157 | template <class _Iter> |
| 160 | using _ITER_TRAITS _LIBCPP_NODEBUG = typename __iter_traits_cache<_Iter>::type; | 158 | using _ITER_TRAITS _LIBCPP_NODEBUG = typename __iter_traits_cache<_Iter>::type; |
| ... | @@ -169,12 +167,13 @@ struct __iter_concept_category_test { | ... | @@ -169,12 +167,13 @@ struct __iter_concept_category_test { |
| 169 | }; | 167 | }; |
| 170 | struct __iter_concept_random_fallback { | 168 | struct __iter_concept_random_fallback { |
| 171 | template <class _Iter> | 169 | template <class _Iter> |
| 172 | using _Apply _LIBCPP_NODEBUG = | 170 | using _Apply _LIBCPP_NODEBUG = __enable_if_t<__primary_template<iterator_traits<_Iter> >, random_access_iterator_tag>; |
| 173 | __enable_if_t<__is_primary_template<iterator_traits<_Iter> >::value, random_access_iterator_tag>; | ||
| 174 | }; | 171 | }; |
| 175 | 172 | ||
| 176 | template <class _Iter, class _Tester> | 173 | template <class _Iter, class _Tester> |
| 177 | struct __test_iter_concept : _IsValidExpansion<_Tester::template _Apply, _Iter>, _Tester {}; | 174 | struct __test_iter_concept : bool_constant < requires { |
| 175 | typename _Tester::template _Apply<_Iter>; | ||
| 176 | } >, _Tester{}; | ||
| 178 | 177 | ||
| 179 | template <class _Iter> | 178 | template <class _Iter> |
| 180 | struct __iter_concept_cache { | 179 | struct __iter_concept_cache { |
lib/libcxx/include/__iterator/counted_iterator.h+13-13| ... | @@ -98,18 +98,18 @@ public: | ... | @@ -98,18 +98,18 @@ public: |
| 98 | return *this; | 98 | return *this; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; } | 101 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; } |
| 102 | 102 | ||
| 103 | _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); } | 103 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); } |
| 104 | 104 | ||
| 105 | _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> count() const noexcept { return __count_; } | 105 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> count() const noexcept { return __count_; } |
| 106 | 106 | ||
| 107 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() { | 107 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() { |
| 108 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end."); | 108 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end."); |
| 109 | return *__current_; | 109 | return *__current_; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const | 112 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const |
| 113 | requires __dereferenceable<const _Iter> | 113 | requires __dereferenceable<const _Iter> |
| 114 | { | 114 | { |
| 115 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end."); | 115 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end."); |
| ... | @@ -169,13 +169,13 @@ public: | ... | @@ -169,13 +169,13 @@ public: |
| 169 | return __tmp; | 169 | return __tmp; |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator+(iter_difference_t<_Iter> __n) const | 172 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator+(iter_difference_t<_Iter> __n) const |
| 173 | requires random_access_iterator<_Iter> | 173 | requires random_access_iterator<_Iter> |
| 174 | { | 174 | { |
| 175 | return counted_iterator(__current_ + __n, __count_ - __n); | 175 | return counted_iterator(__current_ + __n, __count_ - __n); |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | _LIBCPP_HIDE_FROM_ABI friend constexpr counted_iterator | 178 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr counted_iterator |
| 179 | operator+(iter_difference_t<_Iter> __n, const counted_iterator& __x) | 179 | operator+(iter_difference_t<_Iter> __n, const counted_iterator& __x) |
| 180 | requires random_access_iterator<_Iter> | 180 | requires random_access_iterator<_Iter> |
| 181 | { | 181 | { |
| ... | @@ -191,24 +191,24 @@ public: | ... | @@ -191,24 +191,24 @@ public: |
| 191 | return *this; | 191 | return *this; |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator-(iter_difference_t<_Iter> __n) const | 194 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator-(iter_difference_t<_Iter> __n) const |
| 195 | requires random_access_iterator<_Iter> | 195 | requires random_access_iterator<_Iter> |
| 196 | { | 196 | { |
| 197 | return counted_iterator(__current_ - __n, __count_ + __n); | 197 | return counted_iterator(__current_ - __n, __count_ + __n); |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | template <common_with<_Iter> _I2> | 200 | template <common_with<_Iter> _I2> |
| 201 | _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2> | 201 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2> |
| 202 | operator-(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) { | 202 | operator-(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) { |
| 203 | return __rhs.__count_ - __lhs.__count_; | 203 | return __rhs.__count_ - __lhs.__count_; |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter> | 206 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter> |
| 207 | operator-(const counted_iterator& __lhs, default_sentinel_t) { | 207 | operator-(const counted_iterator& __lhs, default_sentinel_t) { |
| 208 | return -__lhs.__count_; | 208 | return -__lhs.__count_; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter> | 211 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter> |
| 212 | operator-(default_sentinel_t, const counted_iterator& __rhs) { | 212 | operator-(default_sentinel_t, const counted_iterator& __rhs) { |
| 213 | return __rhs.__count_; | 213 | return __rhs.__count_; |
| 214 | } | 214 | } |
| ... | @@ -226,7 +226,7 @@ public: | ... | @@ -226,7 +226,7 @@ public: |
| 226 | return *this; | 226 | return *this; |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](iter_difference_t<_Iter> __n) const | 229 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](iter_difference_t<_Iter> __n) const |
| 230 | requires random_access_iterator<_Iter> | 230 | requires random_access_iterator<_Iter> |
| 231 | { | 231 | { |
| 232 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < __count_, "Subscript argument must be less than size."); | 232 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < __count_, "Subscript argument must be less than size."); |
| ... | @@ -249,7 +249,7 @@ public: | ... | @@ -249,7 +249,7 @@ public: |
| 249 | return __rhs.__count_ <=> __lhs.__count_; | 249 | return __rhs.__count_ <=> __lhs.__count_; |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) | 252 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) |
| 253 | iter_move(const counted_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_))) | 253 | iter_move(const counted_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_))) |
| 254 | requires input_iterator<_Iter> | 254 | requires input_iterator<_Iter> |
| 255 | { | 255 | { |
lib/libcxx/include/__iterator/data.h+10-8| ... | @@ -17,32 +17,34 @@ | ... | @@ -17,32 +17,34 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 17 | 20 | #if _LIBCPP_STD_VER >= 17 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _Cont> | 24 | template <class _Cont> |
| 25 | constexpr _LIBCPP_HIDE_FROM_ABI auto data(_Cont& __c) noexcept(noexcept(__c.data())) -> decltype(__c.data()) { | 25 | [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI auto data(_Cont& __c) noexcept(noexcept(__c.data())) |
| 26 | -> decltype(__c.data()) { | ||
| 26 | return __c.data(); | 27 | return __c.data(); |
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | template <class _Cont> | 30 | template <class _Cont> |
| 30 | constexpr _LIBCPP_HIDE_FROM_ABI auto data(const _Cont& __c) noexcept(noexcept(__c.data())) -> decltype(__c.data()) { | 31 | [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI auto data(const _Cont& __c) noexcept(noexcept(__c.data())) |
| 32 | -> decltype(__c.data()) { | ||
| 31 | return __c.data(); | 33 | return __c.data(); |
| 32 | } | 34 | } |
| 33 | 35 | ||
| 34 | template <class _Tp, size_t _Sz> | 36 | template <class _Tp, size_t _Sz> |
| 35 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { | 37 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { |
| 36 | return __array; | 38 | return __array; |
| 37 | } | 39 | } |
| 38 | 40 | ||
| 39 | template <class _Ep> | 41 | template <class _Ep> |
| 40 | _LIBCPP_HIDE_FROM_ABI constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { | 42 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { |
| 41 | return __il.begin(); | 43 | return __il.begin(); |
| 42 | } | 44 | } |
| 43 | 45 | ||
| 44 | #endif | ||
| 45 | |||
| 46 | _LIBCPP_END_NAMESPACE_STD | 46 | _LIBCPP_END_NAMESPACE_STD |
| 47 | 47 | ||
| 48 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 49 | |||
| 48 | #endif // _LIBCPP___ITERATOR_DATA_H | 50 | #endif // _LIBCPP___ITERATOR_DATA_H |
lib/libcxx/include/__iterator/default_sentinel.h+4-4| ... | @@ -16,15 +16,15 @@ | ... | @@ -16,15 +16,15 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | #if _LIBCPP_STD_VER >= 20 | 19 | #if _LIBCPP_STD_VER >= 20 |
| 22 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | struct default_sentinel_t {}; | 23 | struct default_sentinel_t {}; |
| 24 | inline constexpr default_sentinel_t default_sentinel{}; | 24 | inline constexpr default_sentinel_t default_sentinel{}; |
| 25 | 25 | ||
| 26 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 27 | |||
| 28 | _LIBCPP_END_NAMESPACE_STD | 26 | _LIBCPP_END_NAMESPACE_STD |
| 29 | 27 | ||
| 28 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 29 | |||
| 30 | #endif // _LIBCPP___ITERATOR_DEFAULT_SENTINEL_H | 30 | #endif // _LIBCPP___ITERATOR_DEFAULT_SENTINEL_H |
lib/libcxx/include/__iterator/distance.h+5-4| ... | @@ -67,7 +67,8 @@ __distance(_InputIter __first, _Sent __last) { | ... | @@ -67,7 +67,8 @@ __distance(_InputIter __first, _Sent __last) { |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | template <class _InputIter> | 69 | template <class _InputIter> |
| 70 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 typename iterator_traits<_InputIter>::difference_type | 70 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 |
| 71 | typename iterator_traits<_InputIter>::difference_type | ||
| 71 | distance(_InputIter __first, _InputIter __last) { | 72 | distance(_InputIter __first, _InputIter __last) { |
| 72 | return std::__distance(__first, __last); | 73 | return std::__distance(__first, __last); |
| 73 | } | 74 | } |
| ... | @@ -80,12 +81,12 @@ namespace ranges { | ... | @@ -80,12 +81,12 @@ namespace ranges { |
| 80 | struct __distance { | 81 | struct __distance { |
| 81 | template <class _Ip, sentinel_for<_Ip> _Sp> | 82 | template <class _Ip, sentinel_for<_Ip> _Sp> |
| 82 | requires(!sized_sentinel_for<_Sp, _Ip>) | 83 | requires(!sized_sentinel_for<_Sp, _Ip>) |
| 83 | _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip __first, _Sp __last) const { | 84 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip __first, _Sp __last) const { |
| 84 | return std::__distance(std::move(__first), std::move(__last)); | 85 | return std::__distance(std::move(__first), std::move(__last)); |
| 85 | } | 86 | } |
| 86 | 87 | ||
| 87 | template <class _Ip, sized_sentinel_for<decay_t<_Ip>> _Sp> | 88 | template <class _Ip, sized_sentinel_for<decay_t<_Ip>> _Sp> |
| 88 | _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const { | 89 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const { |
| 89 | if constexpr (sized_sentinel_for<_Sp, __remove_cvref_t<_Ip>>) { | 90 | if constexpr (sized_sentinel_for<_Sp, __remove_cvref_t<_Ip>>) { |
| 90 | return __last - __first; | 91 | return __last - __first; |
| 91 | } else { | 92 | } else { |
| ... | @@ -94,7 +95,7 @@ struct __distance { | ... | @@ -94,7 +95,7 @@ struct __distance { |
| 94 | } | 95 | } |
| 95 | 96 | ||
| 96 | template <range _Rp> | 97 | template <range _Rp> |
| 97 | _LIBCPP_HIDE_FROM_ABI constexpr range_difference_t<_Rp> operator()(_Rp&& __r) const { | 98 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr range_difference_t<_Rp> operator()(_Rp&& __r) const { |
| 98 | if constexpr (sized_range<_Rp>) { | 99 | if constexpr (sized_range<_Rp>) { |
| 99 | return static_cast<range_difference_t<_Rp>>(ranges::size(__r)); | 100 | return static_cast<range_difference_t<_Rp>>(ranges::size(__r)); |
| 100 | } else { | 101 | } else { |
lib/libcxx/include/__iterator/empty.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 17 | 20 | #if _LIBCPP_STD_VER >= 17 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _Cont> | 24 | template <class _Cont> |
| 25 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto | 25 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto |
| 26 | empty(const _Cont& __c) noexcept(noexcept(__c.empty())) -> decltype(__c.empty()) { | 26 | empty(const _Cont& __c) noexcept(noexcept(__c.empty())) -> decltype(__c.empty()) { |
| ... | @@ -37,8 +37,8 @@ template <class _Ep> | ... | @@ -37,8 +37,8 @@ template <class _Ep> |
| 37 | return __il.size() == 0; | 37 | return __il.size() == 0; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 41 | |||
| 42 | _LIBCPP_END_NAMESPACE_STD | 40 | _LIBCPP_END_NAMESPACE_STD |
| 43 | 41 | ||
| 42 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 43 | |||
| 44 | #endif // _LIBCPP___ITERATOR_EMPTY_H | 44 | #endif // _LIBCPP___ITERATOR_EMPTY_H |
lib/libcxx/include/__iterator/erase_if_container.h+2-1| ... | @@ -22,7 +22,8 @@ _LIBCPP_PUSH_MACROS | ... | @@ -22,7 +22,8 @@ _LIBCPP_PUSH_MACROS |
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | ||
| 24 | template <class _Container, class _Predicate> | 24 | template <class _Container, class _Predicate> |
| 25 | _LIBCPP_HIDE_FROM_ABI typename _Container::size_type __libcpp_erase_if_container(_Container& __c, _Predicate& __pred) { | 25 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _Container::size_type |
| 26 | __libcpp_erase_if_container(_Container& __c, _Predicate& __pred) { | ||
| 26 | typename _Container::size_type __old_size = __c.size(); | 27 | typename _Container::size_type __old_size = __c.size(); |
| 27 | 28 | ||
| 28 | const typename _Container::iterator __last = __c.end(); | 29 | const typename _Container::iterator __last = __c.end(); |
lib/libcxx/include/__iterator/front_insert_iterator.h+4-2| ... | @@ -58,14 +58,16 @@ public: | ... | @@ -58,14 +58,16 @@ public: |
| 58 | return *this; | 58 | return *this; |
| 59 | } | 59 | } |
| 60 | #endif // _LIBCPP_CXX03_LANG | 60 | #endif // _LIBCPP_CXX03_LANG |
| 61 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator*() { return *this; } | 61 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator*() { |
| 62 | return *this; | ||
| 63 | } | ||
| 62 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator++() { return *this; } | 64 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator++() { return *this; } |
| 63 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator operator++(int) { return *this; } | 65 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator operator++(int) { return *this; } |
| 64 | }; | 66 | }; |
| 65 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(front_insert_iterator); | 67 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(front_insert_iterator); |
| 66 | 68 | ||
| 67 | template <class _Container> | 69 | template <class _Container> |
| 68 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator<_Container> | 70 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator<_Container> |
| 69 | front_inserter(_Container& __x) { | 71 | front_inserter(_Container& __x) { |
| 70 | return front_insert_iterator<_Container>(__x); | 72 | return front_insert_iterator<_Container>(__x); |
| 71 | } | 73 | } |
lib/libcxx/include/__iterator/incrementable_traits.h+6-6| ... | @@ -11,11 +11,11 @@ | ... | @@ -11,11 +11,11 @@ |
| 11 | #define _LIBCPP___ITERATOR_INCREMENTABLE_TRAITS_H | 11 | #define _LIBCPP___ITERATOR_INCREMENTABLE_TRAITS_H |
| 12 | 12 | ||
| 13 | #include <__concepts/arithmetic.h> | 13 | #include <__concepts/arithmetic.h> |
| 14 | #include <__concepts/primary_template.h> | ||
| 14 | #include <__config> | 15 | #include <__config> |
| 15 | #include <__cstddef/ptrdiff_t.h> | 16 | #include <__cstddef/ptrdiff_t.h> |
| 16 | #include <__type_traits/conditional.h> | 17 | #include <__type_traits/conditional.h> |
| 17 | #include <__type_traits/is_object.h> | 18 | #include <__type_traits/is_object.h> |
| 18 | #include <__type_traits/is_primary_template.h> | ||
| 19 | #include <__type_traits/make_signed.h> | 19 | #include <__type_traits/make_signed.h> |
| 20 | #include <__type_traits/remove_cvref.h> | 20 | #include <__type_traits/remove_cvref.h> |
| 21 | #include <__utility/declval.h> | 21 | #include <__utility/declval.h> |
| ... | @@ -24,10 +24,10 @@ | ... | @@ -24,10 +24,10 @@ |
| 24 | # pragma GCC system_header | 24 | # pragma GCC system_header |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 28 | |||
| 29 | #if _LIBCPP_STD_VER >= 20 | 27 | #if _LIBCPP_STD_VER >= 20 |
| 30 | 28 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 30 | |||
| 31 | // [incrementable.traits] | 31 | // [incrementable.traits] |
| 32 | template <class> | 32 | template <class> |
| 33 | struct incrementable_traits {}; | 33 | struct incrementable_traits {}; |
| ... | @@ -68,12 +68,12 @@ struct iterator_traits; | ... | @@ -68,12 +68,12 @@ struct iterator_traits; |
| 68 | // generated from the primary template, and `iterator_traits<RI>::difference_type` otherwise. | 68 | // generated from the primary template, and `iterator_traits<RI>::difference_type` otherwise. |
| 69 | template <class _Ip> | 69 | template <class _Ip> |
| 70 | using iter_difference_t = | 70 | using iter_difference_t = |
| 71 | typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value, | 71 | typename conditional_t<__primary_template<iterator_traits<remove_cvref_t<_Ip> > >, |
| 72 | incrementable_traits<remove_cvref_t<_Ip> >, | 72 | incrementable_traits<remove_cvref_t<_Ip> >, |
| 73 | iterator_traits<remove_cvref_t<_Ip> > >::difference_type; | 73 | iterator_traits<remove_cvref_t<_Ip> > >::difference_type; |
| 74 | 74 | ||
| 75 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 76 | |||
| 77 | _LIBCPP_END_NAMESPACE_STD | 75 | _LIBCPP_END_NAMESPACE_STD |
| 78 | 76 | ||
| 77 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 78 | |||
| 79 | #endif // _LIBCPP___ITERATOR_INCREMENTABLE_TRAITS_H | 79 | #endif // _LIBCPP___ITERATOR_INCREMENTABLE_TRAITS_H |
lib/libcxx/include/__iterator/insert_iterator.h+2-2| ... | @@ -71,13 +71,13 @@ public: | ... | @@ -71,13 +71,13 @@ public: |
| 71 | return *this; | 71 | return *this; |
| 72 | } | 72 | } |
| 73 | #endif // _LIBCPP_CXX03_LANG | 73 | #endif // _LIBCPP_CXX03_LANG |
| 74 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator*() { return *this; } | 74 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator*() { return *this; } |
| 75 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++() { return *this; } | 75 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++() { return *this; } |
| 76 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++(int) { return *this; } | 76 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++(int) { return *this; } |
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | template <class _Container> | 79 | template <class _Container> |
| 80 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator<_Container> | 80 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator<_Container> |
| 81 | inserter(_Container& __x, __insert_iterator_iter_t<_Container> __i) { | 81 | inserter(_Container& __x, __insert_iterator_iter_t<_Container> __i) { |
| 82 | return insert_iterator<_Container>(__x, __i); | 82 | return insert_iterator<_Container>(__x, __i); |
| 83 | } | 83 | } |
lib/libcxx/include/__iterator/istream_iterator.h+1-1| ... | @@ -60,7 +60,7 @@ public: | ... | @@ -60,7 +60,7 @@ public: |
| 60 | // LWG3600 Changed the wording of the copy constructor. In libc++ this constructor | 60 | // LWG3600 Changed the wording of the copy constructor. In libc++ this constructor |
| 61 | // can still be trivial after this change. | 61 | // can still be trivial after this change. |
| 62 | 62 | ||
| 63 | _LIBCPP_HIDE_FROM_ABI const _Tp& operator*() const { return __value_; } | 63 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Tp& operator*() const { return __value_; } |
| 64 | _LIBCPP_HIDE_FROM_ABI const _Tp* operator->() const { return std::addressof((operator*())); } | 64 | _LIBCPP_HIDE_FROM_ABI const _Tp* operator->() const { return std::addressof((operator*())); } |
| 65 | _LIBCPP_HIDE_FROM_ABI istream_iterator& operator++() { | 65 | _LIBCPP_HIDE_FROM_ABI istream_iterator& operator++() { |
| 66 | if (!(*__in_stream_ >> __value_)) | 66 | if (!(*__in_stream_ >> __value_)) |
lib/libcxx/include/__iterator/istreambuf_iterator.h+4-2| ... | @@ -73,14 +73,16 @@ public: | ... | @@ -73,14 +73,16 @@ public: |
| 73 | _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(streambuf_type* __s) _NOEXCEPT : __sbuf_(__s) {} | 73 | _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(streambuf_type* __s) _NOEXCEPT : __sbuf_(__s) {} |
| 74 | _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(const __proxy& __p) _NOEXCEPT : __sbuf_(__p.__sbuf_) {} | 74 | _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(const __proxy& __p) _NOEXCEPT : __sbuf_(__p.__sbuf_) {} |
| 75 | 75 | ||
| 76 | _LIBCPP_HIDE_FROM_ABI char_type operator*() const { return static_cast<char_type>(__sbuf_->sgetc()); } | 76 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type operator*() const { |
| 77 | return static_cast<char_type>(__sbuf_->sgetc()); | ||
| 78 | } | ||
| 77 | _LIBCPP_HIDE_FROM_ABI istreambuf_iterator& operator++() { | 79 | _LIBCPP_HIDE_FROM_ABI istreambuf_iterator& operator++() { |
| 78 | __sbuf_->sbumpc(); | 80 | __sbuf_->sbumpc(); |
| 79 | return *this; | 81 | return *this; |
| 80 | } | 82 | } |
| 81 | _LIBCPP_HIDE_FROM_ABI __proxy operator++(int) { return __proxy(__sbuf_->sbumpc(), __sbuf_); } | 83 | _LIBCPP_HIDE_FROM_ABI __proxy operator++(int) { return __proxy(__sbuf_->sbumpc(), __sbuf_); } |
| 82 | 84 | ||
| 83 | _LIBCPP_HIDE_FROM_ABI bool equal(const istreambuf_iterator& __b) const { | 85 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool equal(const istreambuf_iterator& __b) const { |
| 84 | return __test_for_eof() == __b.__test_for_eof(); | 86 | return __test_for_eof() == __b.__test_for_eof(); |
| 85 | } | 87 | } |
| 86 | 88 |
lib/libcxx/include/__iterator/iter_move.h+5-5| ... | @@ -11,10 +11,10 @@ | ... | @@ -11,10 +11,10 @@ |
| 11 | #define _LIBCPP___ITERATOR_ITER_MOVE_H | 11 | #define _LIBCPP___ITERATOR_ITER_MOVE_H |
| 12 | 12 | ||
| 13 | #include <__concepts/class_or_enum.h> | 13 | #include <__concepts/class_or_enum.h> |
| 14 | #include <__concepts/referenceable.h> | ||
| 14 | #include <__config> | 15 | #include <__config> |
| 15 | #include <__iterator/iterator_traits.h> | 16 | #include <__iterator/iterator_traits.h> |
| 16 | #include <__type_traits/is_reference.h> | 17 | #include <__type_traits/is_reference.h> |
| 17 | #include <__type_traits/is_referenceable.h> | ||
| 18 | #include <__type_traits/remove_cvref.h> | 18 | #include <__type_traits/remove_cvref.h> |
| 19 | #include <__utility/declval.h> | 19 | #include <__utility/declval.h> |
| 20 | #include <__utility/forward.h> | 20 | #include <__utility/forward.h> |
| ... | @@ -27,10 +27,10 @@ | ... | @@ -27,10 +27,10 @@ |
| 27 | _LIBCPP_PUSH_MACROS | 27 | _LIBCPP_PUSH_MACROS |
| 28 | #include <__undef_macros> | 28 | #include <__undef_macros> |
| 29 | 29 | ||
| 30 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 31 | |||
| 32 | #if _LIBCPP_STD_VER >= 20 | 30 | #if _LIBCPP_STD_VER >= 20 |
| 33 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | |||
| 34 | // [iterator.cust.move] | 34 | // [iterator.cust.move] |
| 35 | 35 | ||
| 36 | namespace ranges { | 36 | namespace ranges { |
| ... | @@ -95,10 +95,10 @@ template <__dereferenceable _Tp> | ... | @@ -95,10 +95,10 @@ template <__dereferenceable _Tp> |
| 95 | } | 95 | } |
| 96 | using iter_rvalue_reference_t = decltype(ranges::iter_move(std::declval<_Tp&>())); | 96 | using iter_rvalue_reference_t = decltype(ranges::iter_move(std::declval<_Tp&>())); |
| 97 | 97 | ||
| 98 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 99 | |||
| 100 | _LIBCPP_END_NAMESPACE_STD | 98 | _LIBCPP_END_NAMESPACE_STD |
| 101 | 99 | ||
| 100 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 101 | |||
| 102 | _LIBCPP_POP_MACROS | 102 | _LIBCPP_POP_MACROS |
| 103 | 103 | ||
| 104 | #endif // _LIBCPP___ITERATOR_ITER_MOVE_H | 104 | #endif // _LIBCPP___ITERATOR_ITER_MOVE_H |
lib/libcxx/include/__iterator/iter_swap.h+4-4| ... | @@ -29,10 +29,10 @@ | ... | @@ -29,10 +29,10 @@ |
| 29 | _LIBCPP_PUSH_MACROS | 29 | _LIBCPP_PUSH_MACROS |
| 30 | #include <__undef_macros> | 30 | #include <__undef_macros> |
| 31 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | |||
| 34 | #if _LIBCPP_STD_VER >= 20 | 32 | #if _LIBCPP_STD_VER >= 20 |
| 35 | 33 | ||
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 35 | |||
| 36 | // [iter.cust.swap] | 36 | // [iter.cust.swap] |
| 37 | 37 | ||
| 38 | namespace ranges { | 38 | namespace ranges { |
| ... | @@ -99,10 +99,10 @@ concept indirectly_swappable = | ... | @@ -99,10 +99,10 @@ concept indirectly_swappable = |
| 99 | ranges::iter_swap(__i2, __i1); | 99 | ranges::iter_swap(__i2, __i1); |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 103 | |||
| 104 | _LIBCPP_END_NAMESPACE_STD | 102 | _LIBCPP_END_NAMESPACE_STD |
| 105 | 103 | ||
| 104 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 105 | |||
| 106 | _LIBCPP_POP_MACROS | 106 | _LIBCPP_POP_MACROS |
| 107 | 107 | ||
| 108 | #endif // _LIBCPP___ITERATOR_ITER_SWAP_H | 108 | #endif // _LIBCPP___ITERATOR_ITER_SWAP_H |
lib/libcxx/include/__iterator/iterator_traits.h+3-3| ... | @@ -15,6 +15,8 @@ | ... | @@ -15,6 +15,8 @@ |
| 15 | #include <__concepts/convertible_to.h> | 15 | #include <__concepts/convertible_to.h> |
| 16 | #include <__concepts/copyable.h> | 16 | #include <__concepts/copyable.h> |
| 17 | #include <__concepts/equality_comparable.h> | 17 | #include <__concepts/equality_comparable.h> |
| 18 | #include <__concepts/primary_template.h> | ||
| 19 | #include <__concepts/referenceable.h> | ||
| 18 | #include <__concepts/same_as.h> | 20 | #include <__concepts/same_as.h> |
| 19 | #include <__concepts/totally_ordered.h> | 21 | #include <__concepts/totally_ordered.h> |
| 20 | #include <__config> | 22 | #include <__config> |
| ... | @@ -30,9 +32,7 @@ | ... | @@ -30,9 +32,7 @@ |
| 30 | #include <__type_traits/integral_constant.h> | 32 | #include <__type_traits/integral_constant.h> |
| 31 | #include <__type_traits/is_convertible.h> | 33 | #include <__type_traits/is_convertible.h> |
| 32 | #include <__type_traits/is_object.h> | 34 | #include <__type_traits/is_object.h> |
| 33 | #include <__type_traits/is_primary_template.h> | ||
| 34 | #include <__type_traits/is_reference.h> | 35 | #include <__type_traits/is_reference.h> |
| 35 | #include <__type_traits/is_referenceable.h> | ||
| 36 | #include <__type_traits/nat.h> | 36 | #include <__type_traits/nat.h> |
| 37 | #include <__type_traits/remove_const.h> | 37 | #include <__type_traits/remove_const.h> |
| 38 | #include <__type_traits/remove_cv.h> | 38 | #include <__type_traits/remove_cv.h> |
| ... | @@ -468,7 +468,7 @@ using __iterator_reference _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::re | ... | @@ -468,7 +468,7 @@ using __iterator_reference _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::re |
| 468 | // This has to be in this file and not readable_traits.h to break the include cycle between the two. | 468 | // This has to be in this file and not readable_traits.h to break the include cycle between the two. |
| 469 | template <class _Ip> | 469 | template <class _Ip> |
| 470 | using iter_value_t = | 470 | using iter_value_t = |
| 471 | typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value, | 471 | typename conditional_t<__primary_template<iterator_traits<remove_cvref_t<_Ip> > >, |
| 472 | indirectly_readable_traits<remove_cvref_t<_Ip> >, | 472 | indirectly_readable_traits<remove_cvref_t<_Ip> >, |
| 473 | iterator_traits<remove_cvref_t<_Ip> > >::value_type; | 473 | iterator_traits<remove_cvref_t<_Ip> > >::value_type; |
| 474 | 474 |
lib/libcxx/include/__iterator/move_iterator.h+25-20| ... | @@ -13,6 +13,7 @@ | ... | @@ -13,6 +13,7 @@ |
| 13 | #include <__compare/compare_three_way_result.h> | 13 | #include <__compare/compare_three_way_result.h> |
| 14 | #include <__compare/three_way_comparable.h> | 14 | #include <__compare/three_way_comparable.h> |
| 15 | #include <__concepts/assignable.h> | 15 | #include <__concepts/assignable.h> |
| 16 | #include <__concepts/constructible.h> | ||
| 16 | #include <__concepts/convertible_to.h> | 17 | #include <__concepts/convertible_to.h> |
| 17 | #include <__concepts/derived_from.h> | 18 | #include <__concepts/derived_from.h> |
| 18 | #include <__concepts/same_as.h> | 19 | #include <__concepts/same_as.h> |
| ... | @@ -27,7 +28,6 @@ | ... | @@ -27,7 +28,6 @@ |
| 27 | #include <__type_traits/conditional.h> | 28 | #include <__type_traits/conditional.h> |
| 28 | #include <__type_traits/enable_if.h> | 29 | #include <__type_traits/enable_if.h> |
| 29 | #include <__type_traits/is_assignable.h> | 30 | #include <__type_traits/is_assignable.h> |
| 30 | #include <__type_traits/is_constructible.h> | ||
| 31 | #include <__type_traits/is_convertible.h> | 31 | #include <__type_traits/is_convertible.h> |
| 32 | #include <__type_traits/is_reference.h> | 32 | #include <__type_traits/is_reference.h> |
| 33 | #include <__type_traits/is_same.h> | 33 | #include <__type_traits/is_same.h> |
| ... | @@ -122,7 +122,7 @@ public: | ... | @@ -122,7 +122,7 @@ public: |
| 122 | 122 | ||
| 123 | #if _LIBCPP_STD_VER >= 20 | 123 | #if _LIBCPP_STD_VER >= 20 |
| 124 | _LIBCPP_HIDE_FROM_ABI constexpr move_iterator() | 124 | _LIBCPP_HIDE_FROM_ABI constexpr move_iterator() |
| 125 | requires is_constructible_v<_Iter> | 125 | requires default_initializable<_Iter> |
| 126 | : __current_() {} | 126 | : __current_() {} |
| 127 | 127 | ||
| 128 | template <class _Up> | 128 | template <class _Up> |
| ... | @@ -136,11 +136,11 @@ public: | ... | @@ -136,11 +136,11 @@ public: |
| 136 | return *this; | 136 | return *this; |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; } | 139 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; } |
| 140 | _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); } | 140 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); } |
| 141 | 141 | ||
| 142 | _LIBCPP_HIDE_FROM_ABI constexpr reference operator*() const { return ranges::iter_move(__current_); } | 142 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator*() const { return ranges::iter_move(__current_); } |
| 143 | _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](difference_type __n) const { | 143 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](difference_type __n) const { |
| 144 | return ranges::iter_move(__current_ + __n); | 144 | return ranges::iter_move(__current_ + __n); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| ... | @@ -169,12 +169,13 @@ public: | ... | @@ -169,12 +169,13 @@ public: |
| 169 | return *this; | 169 | return *this; |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return __current_; } | 172 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return __current_; } |
| 173 | 173 | ||
| 174 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const { | 174 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const { |
| 175 | return static_cast<reference>(*__current_); | 175 | return static_cast<reference>(*__current_); |
| 176 | } | 176 | } |
| 177 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](difference_type __n) const { | 177 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference |
| 178 | operator[](difference_type __n) const { | ||
| 178 | return static_cast<reference>(__current_[__n]); | 179 | return static_cast<reference>(__current_[__n]); |
| 179 | } | 180 | } |
| 180 | 181 | ||
| ... | @@ -194,14 +195,16 @@ public: | ... | @@ -194,14 +195,16 @@ public: |
| 194 | --__current_; | 195 | --__current_; |
| 195 | return __tmp; | 196 | return __tmp; |
| 196 | } | 197 | } |
| 197 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator+(difference_type __n) const { | 198 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator |
| 199 | operator+(difference_type __n) const { | ||
| 198 | return move_iterator(__current_ + __n); | 200 | return move_iterator(__current_ + __n); |
| 199 | } | 201 | } |
| 200 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator+=(difference_type __n) { | 202 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator+=(difference_type __n) { |
| 201 | __current_ += __n; | 203 | __current_ += __n; |
| 202 | return *this; | 204 | return *this; |
| 203 | } | 205 | } |
| 204 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator-(difference_type __n) const { | 206 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator |
| 207 | operator-(difference_type __n) const { | ||
| 205 | return move_iterator(__current_ - __n); | 208 | return move_iterator(__current_ - __n); |
| 206 | } | 209 | } |
| 207 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator-=(difference_type __n) { | 210 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator-=(difference_type __n) { |
| ... | @@ -218,18 +221,18 @@ public: | ... | @@ -218,18 +221,18 @@ public: |
| 218 | } | 221 | } |
| 219 | 222 | ||
| 220 | template <sized_sentinel_for<_Iter> _Sent> | 223 | template <sized_sentinel_for<_Iter> _Sent> |
| 221 | friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> | 224 | [[nodiscard]] friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> |
| 222 | operator-(const move_sentinel<_Sent>& __x, const move_iterator& __y) { | 225 | operator-(const move_sentinel<_Sent>& __x, const move_iterator& __y) { |
| 223 | return __x.base() - __y.base(); | 226 | return __x.base() - __y.base(); |
| 224 | } | 227 | } |
| 225 | 228 | ||
| 226 | template <sized_sentinel_for<_Iter> _Sent> | 229 | template <sized_sentinel_for<_Iter> _Sent> |
| 227 | friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> | 230 | [[nodiscard]] friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> |
| 228 | operator-(const move_iterator& __x, const move_sentinel<_Sent>& __y) { | 231 | operator-(const move_iterator& __x, const move_sentinel<_Sent>& __y) { |
| 229 | return __x.base() - __y.base(); | 232 | return __x.base() - __y.base(); |
| 230 | } | 233 | } |
| 231 | 234 | ||
| 232 | friend _LIBCPP_HIDE_FROM_ABI constexpr iter_rvalue_reference_t<_Iter> | 235 | [[nodiscard]] friend _LIBCPP_HIDE_FROM_ABI constexpr iter_rvalue_reference_t<_Iter> |
| 233 | iter_move(const move_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_))) { | 236 | iter_move(const move_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_))) { |
| 234 | return ranges::iter_move(__i.__current_); | 237 | return ranges::iter_move(__i.__current_); |
| 235 | } | 238 | } |
| ... | @@ -299,13 +302,14 @@ operator<=>(const move_iterator<_Iter1>& __x, | ... | @@ -299,13 +302,14 @@ operator<=>(const move_iterator<_Iter1>& __x, |
| 299 | 302 | ||
| 300 | #ifndef _LIBCPP_CXX03_LANG | 303 | #ifndef _LIBCPP_CXX03_LANG |
| 301 | template <class _Iter1, class _Iter2> | 304 | template <class _Iter1, class _Iter2> |
| 302 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto | 305 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI |
| 303 | operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) -> decltype(__x.base() - __y.base()) { | 306 | _LIBCPP_CONSTEXPR_SINCE_CXX17 auto operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) |
| 307 | -> decltype(__x.base() - __y.base()) { | ||
| 304 | return __x.base() - __y.base(); | 308 | return __x.base() - __y.base(); |
| 305 | } | 309 | } |
| 306 | #else | 310 | #else |
| 307 | template <class _Iter1, class _Iter2> | 311 | template <class _Iter1, class _Iter2> |
| 308 | inline _LIBCPP_HIDE_FROM_ABI typename move_iterator<_Iter1>::difference_type | 312 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename move_iterator<_Iter1>::difference_type |
| 309 | operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { | 313 | operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { |
| 310 | return __x.base() - __y.base(); | 314 | return __x.base() - __y.base(); |
| 311 | } | 315 | } |
| ... | @@ -313,7 +317,7 @@ operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { | ... | @@ -313,7 +317,7 @@ operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { |
| 313 | 317 | ||
| 314 | #if _LIBCPP_STD_VER >= 20 | 318 | #if _LIBCPP_STD_VER >= 20 |
| 315 | template <class _Iter> | 319 | template <class _Iter> |
| 316 | inline _LIBCPP_HIDE_FROM_ABI constexpr move_iterator<_Iter> | 320 | [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr move_iterator<_Iter> |
| 317 | operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x) | 321 | operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x) |
| 318 | requires requires { | 322 | requires requires { |
| 319 | { __x.base() + __n } -> same_as<_Iter>; | 323 | { __x.base() + __n } -> same_as<_Iter>; |
| ... | @@ -323,7 +327,7 @@ operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x) | ... | @@ -323,7 +327,7 @@ operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x) |
| 323 | } | 327 | } |
| 324 | #else | 328 | #else |
| 325 | template <class _Iter> | 329 | template <class _Iter> |
| 326 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter> | 330 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter> |
| 327 | operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) { | 331 | operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) { |
| 328 | return move_iterator<_Iter>(__x.base() + __n); | 332 | return move_iterator<_Iter>(__x.base() + __n); |
| 329 | } | 333 | } |
| ... | @@ -336,7 +340,8 @@ inline constexpr bool disable_sized_sentinel_for<move_iterator<_Iter1>, move_ite | ... | @@ -336,7 +340,8 @@ inline constexpr bool disable_sized_sentinel_for<move_iterator<_Iter1>, move_ite |
| 336 | #endif // _LIBCPP_STD_VER >= 20 | 340 | #endif // _LIBCPP_STD_VER >= 20 |
| 337 | 341 | ||
| 338 | template <class _Iter> | 342 | template <class _Iter> |
| 339 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter> make_move_iterator(_Iter __i) { | 343 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI |
| 344 | _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter> make_move_iterator(_Iter __i) { | ||
| 340 | return move_iterator<_Iter>(std::move(__i)); | 345 | return move_iterator<_Iter>(std::move(__i)); |
| 341 | } | 346 | } |
| 342 | 347 |
lib/libcxx/include/__iterator/move_sentinel.h+5-5| ... | @@ -22,10 +22,10 @@ | ... | @@ -22,10 +22,10 @@ |
| 22 | _LIBCPP_PUSH_MACROS | 22 | _LIBCPP_PUSH_MACROS |
| 23 | #include <__undef_macros> | 23 | #include <__undef_macros> |
| 24 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 26 | |||
| 27 | #if _LIBCPP_STD_VER >= 20 | 25 | #if _LIBCPP_STD_VER >= 20 |
| 28 | 26 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 28 | |||
| 29 | template <semiregular _Sent> | 29 | template <semiregular _Sent> |
| 30 | class move_sentinel { | 30 | class move_sentinel { |
| 31 | public: | 31 | public: |
| ... | @@ -44,7 +44,7 @@ public: | ... | @@ -44,7 +44,7 @@ public: |
| 44 | return *this; | 44 | return *this; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | _LIBCPP_HIDE_FROM_ABI constexpr _Sent base() const { return __last_; } | 47 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Sent base() const { return __last_; } |
| 48 | 48 | ||
| 49 | private: | 49 | private: |
| 50 | _Sent __last_ = _Sent(); | 50 | _Sent __last_ = _Sent(); |
| ... | @@ -52,10 +52,10 @@ private: | ... | @@ -52,10 +52,10 @@ private: |
| 52 | 52 | ||
| 53 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_sentinel); | 53 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_sentinel); |
| 54 | 54 | ||
| 55 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 56 | |||
| 57 | _LIBCPP_END_NAMESPACE_STD | 55 | _LIBCPP_END_NAMESPACE_STD |
| 58 | 56 | ||
| 57 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 58 | |||
| 59 | _LIBCPP_POP_MACROS | 59 | _LIBCPP_POP_MACROS |
| 60 | 60 | ||
| 61 | #endif // _LIBCPP___ITERATOR_MOVE_SENTINEL_H | 61 | #endif // _LIBCPP___ITERATOR_MOVE_SENTINEL_H |
lib/libcxx/include/__iterator/ostream_iterator.h+1-1| ... | @@ -59,7 +59,7 @@ public: | ... | @@ -59,7 +59,7 @@ public: |
| 59 | return *this; | 59 | return *this; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator*() { return *this; } | 62 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator*() { return *this; } |
| 63 | _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++() { return *this; } | 63 | _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++() { return *this; } |
| 64 | _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++(int) { return *this; } | 64 | _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++(int) { return *this; } |
| 65 | }; | 65 | }; |
lib/libcxx/include/__iterator/ostreambuf_iterator.h+25-2| ... | @@ -10,6 +10,8 @@ | ... | @@ -10,6 +10,8 @@ |
| 10 | #ifndef _LIBCPP___ITERATOR_OSTREAMBUF_ITERATOR_H | 10 | #ifndef _LIBCPP___ITERATOR_OSTREAMBUF_ITERATOR_H |
| 11 | #define _LIBCPP___ITERATOR_OSTREAMBUF_ITERATOR_H | 11 | #define _LIBCPP___ITERATOR_OSTREAMBUF_ITERATOR_H |
| 12 | 12 | ||
| 13 | #include <__algorithm/in_out_result.h> | ||
| 14 | #include <__algorithm/specialized_algorithms.h> | ||
| 13 | #include <__config> | 15 | #include <__config> |
| 14 | #include <__cstddef/ptrdiff_t.h> | 16 | #include <__cstddef/ptrdiff_t.h> |
| 15 | #include <__fwd/ios.h> | 17 | #include <__fwd/ios.h> |
| ... | @@ -17,6 +19,7 @@ | ... | @@ -17,6 +19,7 @@ |
| 17 | #include <__fwd/streambuf.h> | 19 | #include <__fwd/streambuf.h> |
| 18 | #include <__iterator/iterator.h> | 20 | #include <__iterator/iterator.h> |
| 19 | #include <__iterator/iterator_traits.h> | 21 | #include <__iterator/iterator_traits.h> |
| 22 | #include <__type_traits/is_same.h> | ||
| 20 | #include <iosfwd> // for forward declaration of ostreambuf_iterator | 23 | #include <iosfwd> // for forward declaration of ostreambuf_iterator |
| 21 | 24 | ||
| 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 25 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | @@ -54,16 +57,36 @@ public: | ... | @@ -54,16 +57,36 @@ public: |
| 54 | __sbuf_ = nullptr; | 57 | __sbuf_ = nullptr; |
| 55 | return *this; | 58 | return *this; |
| 56 | } | 59 | } |
| 57 | _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator*() { return *this; } | 60 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator*() { return *this; } |
| 58 | _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++() { return *this; } | 61 | _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++() { return *this; } |
| 59 | _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++(int) { return *this; } | 62 | _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++(int) { return *this; } |
| 60 | _LIBCPP_HIDE_FROM_ABI bool failed() const _NOEXCEPT { return __sbuf_ == nullptr; } | 63 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool failed() const _NOEXCEPT { return __sbuf_ == nullptr; } |
| 61 | 64 | ||
| 62 | #if _LIBCPP_HAS_LOCALIZATION | 65 | #if _LIBCPP_HAS_LOCALIZATION |
| 63 | template <class _Ch, class _Tr> | 66 | template <class _Ch, class _Tr> |
| 64 | friend _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_Ch, _Tr> __pad_and_output( | 67 | friend _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_Ch, _Tr> __pad_and_output( |
| 65 | ostreambuf_iterator<_Ch, _Tr> __s, const _Ch* __ob, const _Ch* __op, const _Ch* __oe, ios_base& __iob, _Ch __fl); | 68 | ostreambuf_iterator<_Ch, _Tr> __s, const _Ch* __ob, const _Ch* __op, const _Ch* __oe, ios_base& __iob, _Ch __fl); |
| 66 | #endif // _LIBCPP_HAS_LOCALIZATION | 69 | #endif // _LIBCPP_HAS_LOCALIZATION |
| 70 | |||
| 71 | template <class, class...> | ||
| 72 | friend struct __specialized_algorithm; | ||
| 73 | }; | ||
| 74 | |||
| 75 | template <class _InCharT, class _CharT, class _Traits> | ||
| 76 | struct __specialized_algorithm<_Algorithm::__copy, | ||
| 77 | __iterator_pair<_InCharT*, _InCharT*>, | ||
| 78 | __single_iterator<ostreambuf_iterator<_CharT, _Traits> > > { | ||
| 79 | static const bool __has_algorithm = is_same<const _CharT, const _InCharT>::value; | ||
| 80 | |||
| 81 | _LIBCPP_HIDE_FROM_ABI static __in_out_result<_InCharT*, ostreambuf_iterator<_CharT, _Traits> > | ||
| 82 | operator()(_InCharT* __first, _InCharT* __last, ostreambuf_iterator<_CharT, _Traits> __result) { | ||
| 83 | auto __size = __last - __first; | ||
| 84 | if (__result.__sbuf_ && __size > 0) { | ||
| 85 | if (__result.__sbuf_->sputn(__first, __last - __first) != __size) | ||
| 86 | __result.__sbuf_ = nullptr; | ||
| 87 | } | ||
| 88 | return {__last, __result}; | ||
| 89 | } | ||
| 67 | }; | 90 | }; |
| 68 | 91 | ||
| 69 | _LIBCPP_END_NAMESPACE_STD | 92 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__iterator/ranges_iterator_traits.h+4-4| ... | @@ -19,10 +19,10 @@ | ... | @@ -19,10 +19,10 @@ |
| 19 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 23 | 22 | #if _LIBCPP_STD_VER >= 23 |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | template <ranges::input_range _Range> | 26 | template <ranges::input_range _Range> |
| 27 | using __range_key_type _LIBCPP_NODEBUG = __remove_const_t<typename ranges::range_value_t<_Range>::first_type>; | 27 | using __range_key_type _LIBCPP_NODEBUG = __remove_const_t<typename ranges::range_value_t<_Range>::first_type>; |
| 28 | 28 | ||
| ... | @@ -33,8 +33,8 @@ template <ranges::input_range _Range> | ... | @@ -33,8 +33,8 @@ template <ranges::input_range _Range> |
| 33 | using __range_to_alloc_type _LIBCPP_NODEBUG = | 33 | using __range_to_alloc_type _LIBCPP_NODEBUG = |
| 34 | pair<const typename ranges::range_value_t<_Range>::first_type, typename ranges::range_value_t<_Range>::second_type>; | 34 | pair<const typename ranges::range_value_t<_Range>::first_type, typename ranges::range_value_t<_Range>::second_type>; |
| 35 | 35 | ||
| 36 | #endif | ||
| 37 | |||
| 38 | _LIBCPP_END_NAMESPACE_STD | 36 | _LIBCPP_END_NAMESPACE_STD |
| 39 | 37 | ||
| 38 | #endif | ||
| 39 | |||
| 40 | #endif // _LIBCPP___ITERATOR_RANGES_ITERATOR_TRAITS_H | 40 | #endif // _LIBCPP___ITERATOR_RANGES_ITERATOR_TRAITS_H |
lib/libcxx/include/__iterator/readable_traits.h+5-5| ... | @@ -10,12 +10,12 @@ | ... | @@ -10,12 +10,12 @@ |
| 10 | #ifndef _LIBCPP___ITERATOR_READABLE_TRAITS_H | 10 | #ifndef _LIBCPP___ITERATOR_READABLE_TRAITS_H |
| 11 | #define _LIBCPP___ITERATOR_READABLE_TRAITS_H | 11 | #define _LIBCPP___ITERATOR_READABLE_TRAITS_H |
| 12 | 12 | ||
| 13 | #include <__concepts/primary_template.h> | ||
| 13 | #include <__concepts/same_as.h> | 14 | #include <__concepts/same_as.h> |
| 14 | #include <__config> | 15 | #include <__config> |
| 15 | #include <__type_traits/conditional.h> | 16 | #include <__type_traits/conditional.h> |
| 16 | #include <__type_traits/is_array.h> | 17 | #include <__type_traits/is_array.h> |
| 17 | #include <__type_traits/is_object.h> | 18 | #include <__type_traits/is_object.h> |
| 18 | #include <__type_traits/is_primary_template.h> | ||
| 19 | #include <__type_traits/remove_cv.h> | 19 | #include <__type_traits/remove_cv.h> |
| 20 | #include <__type_traits/remove_cvref.h> | 20 | #include <__type_traits/remove_cvref.h> |
| 21 | #include <__type_traits/remove_extent.h> | 21 | #include <__type_traits/remove_extent.h> |
| ... | @@ -24,10 +24,10 @@ | ... | @@ -24,10 +24,10 @@ |
| 24 | # pragma GCC system_header | 24 | # pragma GCC system_header |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 28 | |||
| 29 | #if _LIBCPP_STD_VER >= 20 | 27 | #if _LIBCPP_STD_VER >= 20 |
| 30 | 28 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 30 | |||
| 31 | // [readable.traits] | 31 | // [readable.traits] |
| 32 | template <class> | 32 | template <class> |
| 33 | struct __cond_value_type {}; | 33 | struct __cond_value_type {}; |
| ... | @@ -74,8 +74,8 @@ template <__has_member_value_type _Tp> | ... | @@ -74,8 +74,8 @@ template <__has_member_value_type _Tp> |
| 74 | same_as<remove_cv_t<typename _Tp::element_type>, remove_cv_t<typename _Tp::value_type>> | 74 | same_as<remove_cv_t<typename _Tp::element_type>, remove_cv_t<typename _Tp::value_type>> |
| 75 | struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {}; | 75 | struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {}; |
| 76 | 76 | ||
| 77 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 78 | |||
| 79 | _LIBCPP_END_NAMESPACE_STD | 77 | _LIBCPP_END_NAMESPACE_STD |
| 80 | 78 | ||
| 79 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 80 | |||
| 81 | #endif // _LIBCPP___ITERATOR_READABLE_TRAITS_H | 81 | #endif // _LIBCPP___ITERATOR_READABLE_TRAITS_H |
lib/libcxx/include/__iterator/reverse_access.h+21-14| ... | @@ -18,62 +18,69 @@ | ... | @@ -18,62 +18,69 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 14 | 21 | #if _LIBCPP_STD_VER >= 14 |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | template <class _Tp, size_t _Np> | 25 | template <class _Tp, size_t _Np> |
| 26 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) { | 26 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI |
| 27 | _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) { | ||
| 27 | return reverse_iterator<_Tp*>(__array + _Np); | 28 | return reverse_iterator<_Tp*>(__array + _Np); |
| 28 | } | 29 | } |
| 29 | 30 | ||
| 30 | template <class _Tp, size_t _Np> | 31 | template <class _Tp, size_t _Np> |
| 31 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) { | 32 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) { |
| 32 | return reverse_iterator<_Tp*>(__array); | 33 | return reverse_iterator<_Tp*>(__array); |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | template <class _Ep> | 36 | template <class _Ep> |
| 36 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il) { | 37 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> |
| 38 | rbegin(initializer_list<_Ep> __il) { | ||
| 37 | return reverse_iterator<const _Ep*>(__il.end()); | 39 | return reverse_iterator<const _Ep*>(__il.end()); |
| 38 | } | 40 | } |
| 39 | 41 | ||
| 40 | template <class _Ep> | 42 | template <class _Ep> |
| 41 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il) { | 43 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> |
| 44 | rend(initializer_list<_Ep> __il) { | ||
| 42 | return reverse_iterator<const _Ep*>(__il.begin()); | 45 | return reverse_iterator<const _Ep*>(__il.begin()); |
| 43 | } | 46 | } |
| 44 | 47 | ||
| 45 | template <class _Cp> | 48 | template <class _Cp> |
| 46 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) { | 49 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) { |
| 47 | return __c.rbegin(); | 50 | return __c.rbegin(); |
| 48 | } | 51 | } |
| 49 | 52 | ||
| 50 | template <class _Cp> | 53 | template <class _Cp> |
| 51 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(const _Cp& __c) -> decltype(__c.rbegin()) { | 54 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(const _Cp& __c) |
| 55 | -> decltype(__c.rbegin()) { | ||
| 52 | return __c.rbegin(); | 56 | return __c.rbegin(); |
| 53 | } | 57 | } |
| 54 | 58 | ||
| 55 | template <class _Cp> | 59 | template <class _Cp> |
| 56 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(_Cp& __c) -> decltype(__c.rend()) { | 60 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(_Cp& __c) -> decltype(__c.rend()) { |
| 57 | return __c.rend(); | 61 | return __c.rend(); |
| 58 | } | 62 | } |
| 59 | 63 | ||
| 60 | template <class _Cp> | 64 | template <class _Cp> |
| 61 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(const _Cp& __c) -> decltype(__c.rend()) { | 65 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(const _Cp& __c) |
| 66 | -> decltype(__c.rend()) { | ||
| 62 | return __c.rend(); | 67 | return __c.rend(); |
| 63 | } | 68 | } |
| 64 | 69 | ||
| 65 | template <class _Cp> | 70 | template <class _Cp> |
| 66 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crbegin(const _Cp& __c) -> decltype(std::rbegin(__c)) { | 71 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crbegin(const _Cp& __c) |
| 72 | -> decltype(std::rbegin(__c)) { | ||
| 67 | return std::rbegin(__c); | 73 | return std::rbegin(__c); |
| 68 | } | 74 | } |
| 69 | 75 | ||
| 70 | template <class _Cp> | 76 | template <class _Cp> |
| 71 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crend(const _Cp& __c) -> decltype(std::rend(__c)) { | 77 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crend(const _Cp& __c) |
| 78 | -> decltype(std::rend(__c)) { | ||
| 72 | return std::rend(__c); | 79 | return std::rend(__c); |
| 73 | } | 80 | } |
| 74 | 81 | ||
| 75 | #endif // _LIBCPP_STD_VER >= 14 | ||
| 76 | |||
| 77 | _LIBCPP_END_NAMESPACE_STD | 82 | _LIBCPP_END_NAMESPACE_STD |
| 78 | 83 | ||
| 84 | #endif // _LIBCPP_STD_VER >= 14 | ||
| 85 | |||
| 79 | #endif // _LIBCPP___ITERATOR_REVERSE_ACCESS_H | 86 | #endif // _LIBCPP___ITERATOR_REVERSE_ACCESS_H |
lib/libcxx/include/__iterator/reverse_iterator.h+16-30| ... | @@ -15,21 +15,13 @@ | ... | @@ -15,21 +15,13 @@ |
| 15 | #include <__compare/three_way_comparable.h> | 15 | #include <__compare/three_way_comparable.h> |
| 16 | #include <__concepts/convertible_to.h> | 16 | #include <__concepts/convertible_to.h> |
| 17 | #include <__config> | 17 | #include <__config> |
| 18 | #include <__iterator/advance.h> | ||
| 19 | #include <__iterator/concepts.h> | 18 | #include <__iterator/concepts.h> |
| 20 | #include <__iterator/incrementable_traits.h> | 19 | #include <__iterator/incrementable_traits.h> |
| 21 | #include <__iterator/iter_move.h> | 20 | #include <__iterator/iter_move.h> |
| 22 | #include <__iterator/iter_swap.h> | 21 | #include <__iterator/iter_swap.h> |
| 23 | #include <__iterator/iterator.h> | 22 | #include <__iterator/iterator.h> |
| 24 | #include <__iterator/iterator_traits.h> | 23 | #include <__iterator/iterator_traits.h> |
| 25 | #include <__iterator/next.h> | ||
| 26 | #include <__iterator/prev.h> | ||
| 27 | #include <__iterator/readable_traits.h> | ||
| 28 | #include <__iterator/segmented_iterator.h> | ||
| 29 | #include <__memory/addressof.h> | 24 | #include <__memory/addressof.h> |
| 30 | #include <__ranges/access.h> | ||
| 31 | #include <__ranges/concepts.h> | ||
| 32 | #include <__ranges/subrange.h> | ||
| 33 | #include <__type_traits/conditional.h> | 25 | #include <__type_traits/conditional.h> |
| 34 | #include <__type_traits/enable_if.h> | 26 | #include <__type_traits/enable_if.h> |
| 35 | #include <__type_traits/is_assignable.h> | 27 | #include <__type_traits/is_assignable.h> |
| ... | @@ -38,7 +30,6 @@ | ... | @@ -38,7 +30,6 @@ |
| 38 | #include <__type_traits/is_pointer.h> | 30 | #include <__type_traits/is_pointer.h> |
| 39 | #include <__type_traits/is_same.h> | 31 | #include <__type_traits/is_same.h> |
| 40 | #include <__utility/declval.h> | 32 | #include <__utility/declval.h> |
| 41 | #include <__utility/move.h> | ||
| 42 | 33 | ||
| 43 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 34 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 44 | # pragma GCC system_header | 35 | # pragma GCC system_header |
| ... | @@ -121,8 +112,8 @@ public: | ... | @@ -121,8 +112,8 @@ public: |
| 121 | return *this; | 112 | return *this; |
| 122 | } | 113 | } |
| 123 | #endif | 114 | #endif |
| 124 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return current; } | 115 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return current; } |
| 125 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const { | 116 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const { |
| 126 | _Iter __tmp = current; | 117 | _Iter __tmp = current; |
| 127 | return *--__tmp; | 118 | return *--__tmp; |
| 128 | } | 119 | } |
| ... | @@ -161,25 +152,29 @@ public: | ... | @@ -161,25 +152,29 @@ public: |
| 161 | ++current; | 152 | ++current; |
| 162 | return __tmp; | 153 | return __tmp; |
| 163 | } | 154 | } |
| 164 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator+(difference_type __n) const { | 155 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator |
| 156 | operator+(difference_type __n) const { | ||
| 165 | return reverse_iterator(current - __n); | 157 | return reverse_iterator(current - __n); |
| 166 | } | 158 | } |
| 167 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator+=(difference_type __n) { | 159 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator+=(difference_type __n) { |
| 168 | current -= __n; | 160 | current -= __n; |
| 169 | return *this; | 161 | return *this; |
| 170 | } | 162 | } |
| 171 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator-(difference_type __n) const { | 163 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator |
| 164 | operator-(difference_type __n) const { | ||
| 172 | return reverse_iterator(current + __n); | 165 | return reverse_iterator(current + __n); |
| 173 | } | 166 | } |
| 174 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator-=(difference_type __n) { | 167 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator-=(difference_type __n) { |
| 175 | current += __n; | 168 | current += __n; |
| 176 | return *this; | 169 | return *this; |
| 177 | } | 170 | } |
| 178 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](difference_type __n) const { | 171 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference |
| 172 | operator[](difference_type __n) const { | ||
| 179 | return *(*this + __n); | 173 | return *(*this + __n); |
| 180 | } | 174 | } |
| 181 | 175 | ||
| 182 | #if _LIBCPP_STD_VER >= 20 | 176 | #if _LIBCPP_STD_VER >= 20 |
| 177 | [[nodiscard]] | ||
| 183 | _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i) noexcept( | 178 | _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i) noexcept( |
| 184 | is_nothrow_copy_constructible_v<_Iter> && noexcept(ranges::iter_move(--std::declval<_Iter&>()))) { | 179 | is_nothrow_copy_constructible_v<_Iter> && noexcept(ranges::iter_move(--std::declval<_Iter&>()))) { |
| 185 | auto __tmp = __i.base(); | 180 | auto __tmp = __i.base(); |
| ... | @@ -280,21 +275,21 @@ operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& | ... | @@ -280,21 +275,21 @@ operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& |
| 280 | 275 | ||
| 281 | #ifndef _LIBCPP_CXX03_LANG | 276 | #ifndef _LIBCPP_CXX03_LANG |
| 282 | template <class _Iter1, class _Iter2> | 277 | template <class _Iter1, class _Iter2> |
| 283 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto | 278 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI |
| 284 | operator-(const reverse_iterator<_Iter1>& __x, | 279 | _LIBCPP_CONSTEXPR_SINCE_CXX17 auto operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) |
| 285 | const reverse_iterator<_Iter2>& __y) -> decltype(__y.base() - __x.base()) { | 280 | -> decltype(__y.base() - __x.base()) { |
| 286 | return __y.base() - __x.base(); | 281 | return __y.base() - __x.base(); |
| 287 | } | 282 | } |
| 288 | #else | 283 | #else |
| 289 | template <class _Iter1, class _Iter2> | 284 | template <class _Iter1, class _Iter2> |
| 290 | inline _LIBCPP_HIDE_FROM_ABI typename reverse_iterator<_Iter1>::difference_type | 285 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename reverse_iterator<_Iter1>::difference_type |
| 291 | operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { | 286 | operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { |
| 292 | return __y.base() - __x.base(); | 287 | return __y.base() - __x.base(); |
| 293 | } | 288 | } |
| 294 | #endif | 289 | #endif |
| 295 | 290 | ||
| 296 | template <class _Iter> | 291 | template <class _Iter> |
| 297 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter> | 292 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter> |
| 298 | operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x) { | 293 | operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x) { |
| 299 | return reverse_iterator<_Iter>(__x.base() - __n); | 294 | return reverse_iterator<_Iter>(__x.base() - __n); |
| 300 | } | 295 | } |
| ... | @@ -307,21 +302,12 @@ inline constexpr bool disable_sized_sentinel_for<reverse_iterator<_Iter1>, rever | ... | @@ -307,21 +302,12 @@ inline constexpr bool disable_sized_sentinel_for<reverse_iterator<_Iter1>, rever |
| 307 | 302 | ||
| 308 | #if _LIBCPP_STD_VER >= 14 | 303 | #if _LIBCPP_STD_VER >= 14 |
| 309 | template <class _Iter> | 304 | template <class _Iter> |
| 310 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) { | 305 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI |
| 306 | _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) { | ||
| 311 | return reverse_iterator<_Iter>(__i); | 307 | return reverse_iterator<_Iter>(__i); |
| 312 | } | 308 | } |
| 313 | #endif | 309 | #endif |
| 314 | 310 | ||
| 315 | #if _LIBCPP_STD_VER >= 20 | ||
| 316 | template <ranges::bidirectional_range _Range> | ||
| 317 | _LIBCPP_HIDE_FROM_ABI constexpr ranges::subrange<reverse_iterator<ranges::iterator_t<_Range>>, | ||
| 318 | reverse_iterator<ranges::iterator_t<_Range>>> | ||
| 319 | __reverse_range(_Range&& __range) { | ||
| 320 | auto __first = ranges::begin(__range); | ||
| 321 | return {std::make_reverse_iterator(ranges::next(__first, ranges::end(__range))), std::make_reverse_iterator(__first)}; | ||
| 322 | } | ||
| 323 | #endif | ||
| 324 | |||
| 325 | template <class _Iter, bool __b> | 311 | template <class _Iter, bool __b> |
| 326 | struct __unwrap_iter_impl<reverse_iterator<reverse_iterator<_Iter> >, __b> { | 312 | struct __unwrap_iter_impl<reverse_iterator<reverse_iterator<_Iter> >, __b> { |
| 327 | using _UnwrappedIter _LIBCPP_NODEBUG = decltype(__unwrap_iter_impl<_Iter>::__unwrap(std::declval<_Iter>())); | 313 | using _UnwrappedIter _LIBCPP_NODEBUG = decltype(__unwrap_iter_impl<_Iter>::__unwrap(std::declval<_Iter>())); |
lib/libcxx/include/__iterator/segmented_iterator.h-2| ... | @@ -42,8 +42,6 @@ | ... | @@ -42,8 +42,6 @@ |
| 42 | 42 | ||
| 43 | #include <__config> | 43 | #include <__config> |
| 44 | #include <__cstddef/size_t.h> | 44 | #include <__cstddef/size_t.h> |
| 45 | #include <__iterator/iterator_traits.h> | ||
| 46 | #include <__type_traits/integral_constant.h> | ||
| 47 | 45 | ||
| 48 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 46 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 49 | # pragma GCC system_header | 47 | # pragma GCC system_header |
lib/libcxx/include/__iterator/size.h+10-9| ... | @@ -20,25 +20,26 @@ | ... | @@ -20,25 +20,26 @@ |
| 20 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | #if _LIBCPP_STD_VER >= 17 | 23 | #if _LIBCPP_STD_VER >= 17 |
| 26 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 26 | |||
| 27 | template <class _Cont> | 27 | template <class _Cont> |
| 28 | [[nodiscard]] | ||
| 28 | _LIBCPP_HIDE_FROM_ABI constexpr auto size(const _Cont& __c) noexcept(noexcept(__c.size())) -> decltype(__c.size()) { | 29 | _LIBCPP_HIDE_FROM_ABI constexpr auto size(const _Cont& __c) noexcept(noexcept(__c.size())) -> decltype(__c.size()) { |
| 29 | return __c.size(); | 30 | return __c.size(); |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | template <class _Tp, size_t _Sz> | 33 | template <class _Tp, size_t _Sz> |
| 33 | _LIBCPP_HIDE_FROM_ABI constexpr size_t size(const _Tp (&)[_Sz]) noexcept { | 34 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t size(const _Tp (&)[_Sz]) noexcept { |
| 34 | return _Sz; | 35 | return _Sz; |
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | # if _LIBCPP_STD_VER >= 20 | 38 | # if _LIBCPP_STD_VER >= 20 |
| 38 | template <class _Cont> | 39 | template <class _Cont> |
| 39 | _LIBCPP_HIDE_FROM_ABI constexpr auto | 40 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto ssize(const _Cont& __c) noexcept( |
| 40 | ssize(const _Cont& __c) noexcept(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>( | 41 | noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size()))) |
| 41 | __c.size()))) -> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>> { | 42 | -> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>> { |
| 42 | return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size()); | 43 | return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size()); |
| 43 | } | 44 | } |
| 44 | 45 | ||
| ... | @@ -47,14 +48,14 @@ ssize(const _Cont& __c) noexcept(noexcept(static_cast<common_type_t<ptrdiff_t, m | ... | @@ -47,14 +48,14 @@ ssize(const _Cont& __c) noexcept(noexcept(static_cast<common_type_t<ptrdiff_t, m |
| 47 | _LIBCPP_DIAGNOSTIC_PUSH | 48 | _LIBCPP_DIAGNOSTIC_PUSH |
| 48 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wsign-conversion") | 49 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wsign-conversion") |
| 49 | template <class _Tp, ptrdiff_t _Sz> | 50 | template <class _Tp, ptrdiff_t _Sz> |
| 50 | _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept { | 51 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept { |
| 51 | return _Sz; | 52 | return _Sz; |
| 52 | } | 53 | } |
| 53 | _LIBCPP_DIAGNOSTIC_POP | 54 | _LIBCPP_DIAGNOSTIC_POP |
| 54 | # endif | 55 | # endif |
| 55 | 56 | ||
| 56 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 57 | |||
| 58 | _LIBCPP_END_NAMESPACE_STD | 57 | _LIBCPP_END_NAMESPACE_STD |
| 59 | 58 | ||
| 59 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 60 | |||
| 60 | #endif // _LIBCPP___ITERATOR_SIZE_H | 61 | #endif // _LIBCPP___ITERATOR_SIZE_H |
lib/libcxx/include/__iterator/static_bounded_iter.h+7-6| ... | @@ -128,7 +128,7 @@ private: | ... | @@ -128,7 +128,7 @@ private: |
| 128 | 128 | ||
| 129 | public: | 129 | public: |
| 130 | // Dereference and indexing operations. | 130 | // Dereference and indexing operations. |
| 131 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { | 131 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { |
| 132 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | 132 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( |
| 133 | __current() != __end(), "__static_bounded_iter::operator*: Attempt to dereference an iterator at the end"); | 133 | __current() != __end(), "__static_bounded_iter::operator*: Attempt to dereference an iterator at the end"); |
| 134 | return *__current(); | 134 | return *__current(); |
| ... | @@ -140,7 +140,8 @@ public: | ... | @@ -140,7 +140,8 @@ public: |
| 140 | return std::__to_address(__current()); | 140 | return std::__to_address(__current()); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT { | 143 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference |
| 144 | operator[](difference_type __n) const _NOEXCEPT { | ||
| 144 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | 145 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( |
| 145 | __n >= __begin() - __current(), | 146 | __n >= __begin() - __current(), |
| 146 | "__static_bounded_iter::operator[]: Attempt to index an iterator past the start"); | 147 | "__static_bounded_iter::operator[]: Attempt to index an iterator past the start"); |
| ... | @@ -186,13 +187,13 @@ public: | ... | @@ -186,13 +187,13 @@ public: |
| 186 | __current() += __n; | 187 | __current() += __n; |
| 187 | return *this; | 188 | return *this; |
| 188 | } | 189 | } |
| 189 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter | 190 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter |
| 190 | operator+(__static_bounded_iter const& __self, difference_type __n) _NOEXCEPT { | 191 | operator+(__static_bounded_iter const& __self, difference_type __n) _NOEXCEPT { |
| 191 | __static_bounded_iter __tmp(__self); | 192 | __static_bounded_iter __tmp(__self); |
| 192 | __tmp += __n; | 193 | __tmp += __n; |
| 193 | return __tmp; | 194 | return __tmp; |
| 194 | } | 195 | } |
| 195 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter | 196 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter |
| 196 | operator+(difference_type __n, __static_bounded_iter const& __self) _NOEXCEPT { | 197 | operator+(difference_type __n, __static_bounded_iter const& __self) _NOEXCEPT { |
| 197 | __static_bounded_iter __tmp(__self); | 198 | __static_bounded_iter __tmp(__self); |
| 198 | __tmp += __n; | 199 | __tmp += __n; |
| ... | @@ -208,13 +209,13 @@ public: | ... | @@ -208,13 +209,13 @@ public: |
| 208 | __current() -= __n; | 209 | __current() -= __n; |
| 209 | return *this; | 210 | return *this; |
| 210 | } | 211 | } |
| 211 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter | 212 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter |
| 212 | operator-(__static_bounded_iter const& __self, difference_type __n) _NOEXCEPT { | 213 | operator-(__static_bounded_iter const& __self, difference_type __n) _NOEXCEPT { |
| 213 | __static_bounded_iter __tmp(__self); | 214 | __static_bounded_iter __tmp(__self); |
| 214 | __tmp -= __n; | 215 | __tmp -= __n; |
| 215 | return __tmp; | 216 | return __tmp; |
| 216 | } | 217 | } |
| 217 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend difference_type | 218 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend difference_type |
| 218 | operator-(__static_bounded_iter const& __x, __static_bounded_iter const& __y) _NOEXCEPT { | 219 | operator-(__static_bounded_iter const& __x, __static_bounded_iter const& __y) _NOEXCEPT { |
| 219 | return __x.__current() - __y.__current(); | 220 | return __x.__current() - __y.__current(); |
| 220 | } | 221 | } |
lib/libcxx/include/__iterator/wrap_iter.h+116-127| ... | @@ -15,7 +15,6 @@ | ... | @@ -15,7 +15,6 @@ |
| 15 | #include <__config> | 15 | #include <__config> |
| 16 | #include <__cstddef/size_t.h> | 16 | #include <__cstddef/size_t.h> |
| 17 | #include <__iterator/iterator_traits.h> | 17 | #include <__iterator/iterator_traits.h> |
| 18 | #include <__memory/addressof.h> | ||
| 19 | #include <__memory/pointer_traits.h> | 18 | #include <__memory/pointer_traits.h> |
| 20 | #include <__type_traits/conjunction.h> | 19 | #include <__type_traits/conjunction.h> |
| 21 | #include <__type_traits/disjunction.h> | 20 | #include <__type_traits/disjunction.h> |
| ... | @@ -34,18 +33,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -34,18 +33,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 34 | template <class _Iter> | 33 | template <class _Iter> |
| 35 | class __wrap_iter { | 34 | class __wrap_iter { |
| 36 | public: | 35 | public: |
| 37 | typedef _Iter iterator_type; | 36 | typedef typename iterator_traits<_Iter>::value_type value_type; |
| 38 | typedef typename iterator_traits<iterator_type>::value_type value_type; | 37 | typedef typename iterator_traits<_Iter>::difference_type difference_type; |
| 39 | typedef typename iterator_traits<iterator_type>::difference_type difference_type; | 38 | typedef typename iterator_traits<_Iter>::pointer pointer; |
| 40 | typedef typename iterator_traits<iterator_type>::pointer pointer; | 39 | typedef typename iterator_traits<_Iter>::reference reference; |
| 41 | typedef typename iterator_traits<iterator_type>::reference reference; | 40 | typedef typename iterator_traits<_Iter>::iterator_category iterator_category; |
| 42 | typedef typename iterator_traits<iterator_type>::iterator_category iterator_category; | ||
| 43 | #if _LIBCPP_STD_VER >= 20 | 41 | #if _LIBCPP_STD_VER >= 20 |
| 44 | typedef contiguous_iterator_tag iterator_concept; | 42 | typedef contiguous_iterator_tag iterator_concept; |
| 45 | #endif | 43 | #endif |
| 46 | 44 | ||
| 47 | private: | 45 | private: |
| 48 | iterator_type __i_; | 46 | _Iter __i_; |
| 49 | 47 | ||
| 50 | public: | 48 | public: |
| 51 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter() _NOEXCEPT : __i_() {} | 49 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter() _NOEXCEPT : __i_() {} |
| ... | @@ -57,7 +55,9 @@ public: | ... | @@ -57,7 +55,9 @@ public: |
| 57 | int> = 0> | 55 | int> = 0> |
| 58 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter(const __wrap_iter<_OtherIter>& __u) _NOEXCEPT | 56 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter(const __wrap_iter<_OtherIter>& __u) _NOEXCEPT |
| 59 | : __i_(__u.__i_) {} | 57 | : __i_(__u.__i_) {} |
| 60 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { return *__i_; } | 58 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { |
| 59 | return *__i_; | ||
| 60 | } | ||
| 61 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pointer operator->() const _NOEXCEPT { | 61 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pointer operator->() const _NOEXCEPT { |
| 62 | return std::__to_address(__i_); | 62 | return std::__to_address(__i_); |
| 63 | } | 63 | } |
| ... | @@ -80,7 +80,8 @@ public: | ... | @@ -80,7 +80,8 @@ public: |
| 80 | --(*this); | 80 | --(*this); |
| 81 | return __tmp; | 81 | return __tmp; |
| 82 | } | 82 | } |
| 83 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator+(difference_type __n) const _NOEXCEPT { | 83 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter |
| 84 | operator+(difference_type __n) const _NOEXCEPT { | ||
| 84 | __wrap_iter __w(*this); | 85 | __wrap_iter __w(*this); |
| 85 | __w += __n; | 86 | __w += __n; |
| 86 | return __w; | 87 | return __w; |
| ... | @@ -89,21 +90,21 @@ public: | ... | @@ -89,21 +90,21 @@ public: |
| 89 | __i_ += __n; | 90 | __i_ += __n; |
| 90 | return *this; | 91 | return *this; |
| 91 | } | 92 | } |
| 92 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator-(difference_type __n) const _NOEXCEPT { | 93 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter |
| 94 | operator-(difference_type __n) const _NOEXCEPT { | ||
| 93 | return *this + (-__n); | 95 | return *this + (-__n); |
| 94 | } | 96 | } |
| 95 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator-=(difference_type __n) _NOEXCEPT { | 97 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator-=(difference_type __n) _NOEXCEPT { |
| 96 | *this += -__n; | 98 | *this += -__n; |
| 97 | return *this; | 99 | return *this; |
| 98 | } | 100 | } |
| 99 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT { | 101 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference |
| 102 | operator[](difference_type __n) const _NOEXCEPT { | ||
| 100 | return __i_[__n]; | 103 | return __i_[__n]; |
| 101 | } | 104 | } |
| 102 | 105 | ||
| 103 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 iterator_type base() const _NOEXCEPT { return __i_; } | ||
| 104 | |||
| 105 | private: | 106 | private: |
| 106 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i_(__x) {} | 107 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __wrap_iter(_Iter __x) _NOEXCEPT : __i_(__x) {} |
| 107 | 108 | ||
| 108 | template <class _Up> | 109 | template <class _Up> |
| 109 | friend class __wrap_iter; | 110 | friend class __wrap_iter; |
| ... | @@ -117,137 +118,125 @@ private: | ... | @@ -117,137 +118,125 @@ private: |
| 117 | friend class span; | 118 | friend class span; |
| 118 | template <class _Tp, size_t _Size> | 119 | template <class _Tp, size_t _Size> |
| 119 | friend struct array; | 120 | friend struct array; |
| 120 | template <class _Tp, class> | ||
| 121 | friend struct __optional_iterator; | ||
| 122 | }; | ||
| 123 | |||
| 124 | template <class _Iter1> | ||
| 125 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | ||
| 126 | operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { | ||
| 127 | return __x.base() == __y.base(); | ||
| 128 | } | ||
| 129 | |||
| 130 | template <class _Iter1, class _Iter2> | ||
| 131 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | ||
| 132 | operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { | ||
| 133 | return __x.base() == __y.base(); | ||
| 134 | } | ||
| 135 | |||
| 136 | template <class _Iter1> | ||
| 137 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool | ||
| 138 | operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { | ||
| 139 | return __x.base() < __y.base(); | ||
| 140 | } | ||
| 141 | |||
| 142 | template <class _Iter1, class _Iter2> | ||
| 143 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool | ||
| 144 | operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { | ||
| 145 | return __x.base() < __y.base(); | ||
| 146 | } | ||
| 147 | 121 | ||
| 148 | #if _LIBCPP_STD_VER <= 17 | 122 | #if _LIBCPP_STD_VER <= 17 |
| 149 | template <class _Iter1> | 123 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool |
| 150 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | 124 | operator==(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT { |
| 151 | operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { | 125 | return __x.__i_ == __y.__i_; |
| 152 | return !(__x == __y); | 126 | } |
| 153 | } | 127 | |
| 154 | 128 | template <class _Iter2> | |
| 155 | template <class _Iter1, class _Iter2> | 129 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool |
| 156 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | 130 | operator==(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { |
| 157 | operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { | 131 | return __x.__i_ == __y.__i_; |
| 158 | return !(__x == __y); | 132 | } |
| 159 | } | 133 | |
| 160 | template <class _Iter1> | 134 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool |
| 161 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | 135 | operator<(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT { |
| 162 | operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { | 136 | return __x.__i_ < __y.__i_; |
| 163 | return __y < __x; | 137 | } |
| 164 | } | 138 | |
| 165 | 139 | template <class _Iter2> | |
| 166 | template <class _Iter1, class _Iter2> | 140 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool |
| 167 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | 141 | operator<(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { |
| 168 | operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { | 142 | return __x.__i_ < __y.__i_; |
| 169 | return __y < __x; | 143 | } |
| 170 | } | 144 | |
| 171 | 145 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool | |
| 172 | template <class _Iter1> | 146 | operator!=(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT { |
| 173 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | 147 | return !(__x == __y); |
| 174 | operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { | 148 | } |
| 175 | return !(__x < __y); | 149 | |
| 176 | } | 150 | template <class _Iter2> |
| 177 | 151 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool | |
| 178 | template <class _Iter1, class _Iter2> | 152 | operator!=(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { |
| 179 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | 153 | return !(__x == __y); |
| 180 | operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { | 154 | } |
| 181 | return !(__x < __y); | 155 | |
| 182 | } | 156 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool |
| 183 | 157 | operator>(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT { | |
| 184 | template <class _Iter1> | 158 | return __y < __x; |
| 185 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | 159 | } |
| 186 | operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { | 160 | |
| 187 | return !(__y < __x); | 161 | template <class _Iter2> |
| 188 | } | 162 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool |
| 189 | 163 | operator>(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { | |
| 190 | template <class _Iter1, class _Iter2> | 164 | return __y < __x; |
| 191 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool | 165 | } |
| 192 | operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { | 166 | |
| 193 | return !(__y < __x); | 167 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool |
| 194 | } | 168 | operator>=(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT { |
| 169 | return !(__x < __y); | ||
| 170 | } | ||
| 171 | |||
| 172 | template <class _Iter2> | ||
| 173 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool | ||
| 174 | operator>=(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { | ||
| 175 | return !(__x < __y); | ||
| 176 | } | ||
| 177 | |||
| 178 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool | ||
| 179 | operator<=(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT { | ||
| 180 | return !(__y < __x); | ||
| 181 | } | ||
| 182 | |||
| 183 | template <class _Iter2> | ||
| 184 | _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool | ||
| 185 | operator<=(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { | ||
| 186 | return !(__y < __x); | ||
| 187 | } | ||
| 195 | 188 | ||
| 196 | #else | 189 | #else |
| 197 | template <class _Iter1, class _Iter2> | 190 | _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __wrap_iter&, const __wrap_iter&) = default; |
| 198 | _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering | 191 | |
| 199 | operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept { | 192 | template <class _Iter2> |
| 200 | if constexpr (three_way_comparable_with<_Iter1, _Iter2, strong_ordering>) { | 193 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool |
| 201 | return __x.base() <=> __y.base(); | 194 | operator==(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) noexcept { |
| 202 | } else { | 195 | return __x.__i_ == __y.__i_; |
| 203 | if (__x.base() < __y.base()) | 196 | } |
| 204 | return strong_ordering::less; | ||
| 205 | 197 | ||
| 206 | if (__x.base() == __y.base()) | 198 | template <class _Iter2> |
| 207 | return strong_ordering::equal; | 199 | _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering |
| 200 | operator<=>(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) noexcept { | ||
| 201 | if constexpr (three_way_comparable_with<_Iter, _Iter2, strong_ordering>) { | ||
| 202 | return __x.__i_ <=> __y.__i_; | ||
| 203 | } else { | ||
| 204 | if (__x.__i_ < __y.__i_) | ||
| 205 | return strong_ordering::less; | ||
| 208 | 206 | ||
| 209 | return strong_ordering::greater; | 207 | if (__x.__i_ == __y.__i_) |
| 208 | return strong_ordering::equal; | ||
| 209 | |||
| 210 | return strong_ordering::greater; | ||
| 211 | } | ||
| 210 | } | 212 | } |
| 211 | } | ||
| 212 | #endif // _LIBCPP_STD_VER >= 20 | 213 | #endif // _LIBCPP_STD_VER >= 20 |
| 213 | 214 | ||
| 214 | template <class _Iter1, class _Iter2> | ||
| 215 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | ||
| 216 | #ifndef _LIBCPP_CXX03_LANG | 215 | #ifndef _LIBCPP_CXX03_LANG |
| 217 | auto | 216 | template <class _Iter2> |
| 218 | operator-(const __wrap_iter<_Iter1>& __x, | 217 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 auto |
| 219 | const __wrap_iter<_Iter2>& __y) _NOEXCEPT->decltype(__x.base() - __y.base()) | 218 | operator-(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT->decltype(__x.__i_ - __y.__i_) |
| 220 | #else | 219 | #else |
| 221 | typename __wrap_iter<_Iter1>::difference_type | 220 | template <class _Iter2> |
| 222 | operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | 221 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 |
| 222 | typename __wrap_iter::difference_type operator-(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | ||
| 223 | #endif // C++03 | 223 | #endif // C++03 |
| 224 | { | 224 | { |
| 225 | return __x.base() - __y.base(); | 225 | return __x.__i_ - __y.__i_; |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | template <class _Iter1> | 228 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter |
| 229 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter<_Iter1> | 229 | operator+(typename __wrap_iter::difference_type __n, __wrap_iter __x) _NOEXCEPT { |
| 230 | operator+(typename __wrap_iter<_Iter1>::difference_type __n, __wrap_iter<_Iter1> __x) _NOEXCEPT { | 230 | __x += __n; |
| 231 | __x += __n; | 231 | return __x; |
| 232 | return __x; | 232 | } |
| 233 | } | 233 | }; |
| 234 | 234 | ||
| 235 | #if _LIBCPP_STD_VER <= 17 | 235 | #if _LIBCPP_STD_VER <= 17 |
| 236 | template <class _It> | 236 | template <class _It> |
| 237 | struct __libcpp_is_contiguous_iterator<__wrap_iter<_It> > : true_type {}; | 237 | struct __libcpp_is_contiguous_iterator<__wrap_iter<_It> > : true_type {}; |
| 238 | #endif | 238 | #endif |
| 239 | 239 | ||
| 240 | template <class _It> | ||
| 241 | struct pointer_traits<__wrap_iter<_It> > { | ||
| 242 | typedef __wrap_iter<_It> pointer; | ||
| 243 | typedef typename pointer_traits<_It>::element_type element_type; | ||
| 244 | typedef typename pointer_traits<_It>::difference_type difference_type; | ||
| 245 | |||
| 246 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static element_type* to_address(pointer __w) _NOEXCEPT { | ||
| 247 | return std::__to_address(__w.base()); | ||
| 248 | } | ||
| 249 | }; | ||
| 250 | |||
| 251 | _LIBCPP_END_NAMESPACE_STD | 240 | _LIBCPP_END_NAMESPACE_STD |
| 252 | 241 | ||
| 253 | #endif // _LIBCPP___ITERATOR_WRAP_ITER_H | 242 | #endif // _LIBCPP___ITERATOR_WRAP_ITER_H |
lib/libcxx/include/__locale+104-72| ... | @@ -11,6 +11,7 @@ | ... | @@ -11,6 +11,7 @@ |
| 11 | #define _LIBCPP___LOCALE | 11 | #define _LIBCPP___LOCALE |
| 12 | 12 | ||
| 13 | #include <__config> | 13 | #include <__config> |
| 14 | #include <__configuration/availability.h> | ||
| 14 | 15 | ||
| 15 | #if _LIBCPP_HAS_LOCALIZATION | 16 | #if _LIBCPP_HAS_LOCALIZATION |
| 16 | 17 | ||
| ... | @@ -26,6 +27,7 @@ | ... | @@ -26,6 +27,7 @@ |
| 26 | # include <cstdint> | 27 | # include <cstdint> |
| 27 | # include <cstdlib> | 28 | # include <cstdlib> |
| 28 | # include <string> | 29 | # include <string> |
| 30 | # include <text_encoding> | ||
| 29 | 31 | ||
| 30 | // Some platforms require more includes than others. Keep the includes on all plaforms for now. | 32 | // Some platforms require more includes than others. Keep the includes on all plaforms for now. |
| 31 | # include <cstddef> | 33 | # include <cstddef> |
| ... | @@ -42,6 +44,7 @@ | ... | @@ -42,6 +44,7 @@ |
| 42 | # endif | 44 | # endif |
| 43 | 45 | ||
| 44 | _LIBCPP_BEGIN_NAMESPACE_STD | 46 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 47 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 45 | 48 | ||
| 46 | class _LIBCPP_EXPORTED_FROM_ABI locale; | 49 | class _LIBCPP_EXPORTED_FROM_ABI locale; |
| 47 | 50 | ||
| ... | @@ -88,7 +91,7 @@ public: | ... | @@ -88,7 +91,7 @@ public: |
| 88 | const locale& operator=(const locale&) _NOEXCEPT; | 91 | const locale& operator=(const locale&) _NOEXCEPT; |
| 89 | 92 | ||
| 90 | template <class _Facet> | 93 | template <class _Facet> |
| 91 | _LIBCPP_HIDE_FROM_ABI locale combine(const locale& __other) const { | 94 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI locale combine(const locale& __other) const { |
| 92 | if (!std::has_facet<_Facet>(__other)) | 95 | if (!std::has_facet<_Facet>(__other)) |
| 93 | __throw_runtime_error("locale::combine: locale missing facet"); | 96 | __throw_runtime_error("locale::combine: locale missing facet"); |
| 94 | 97 | ||
| ... | @@ -96,21 +99,29 @@ public: | ... | @@ -96,21 +99,29 @@ public: |
| 96 | } | 99 | } |
| 97 | 100 | ||
| 98 | // locale operations: | 101 | // locale operations: |
| 99 | string name() const; | 102 | [[__nodiscard__]] string name() const; |
| 100 | bool operator==(const locale&) const; | 103 | bool operator==(const locale&) const; |
| 101 | # if _LIBCPP_STD_VER <= 17 | 104 | # if _LIBCPP_STD_VER <= 17 |
| 102 | _LIBCPP_HIDE_FROM_ABI bool operator!=(const locale& __y) const { return !(*this == __y); } | 105 | _LIBCPP_HIDE_FROM_ABI bool operator!=(const locale& __y) const { return !(*this == __y); } |
| 103 | # endif | 106 | # endif |
| 104 | template <class _CharT, class _Traits, class _Allocator> | 107 | template <class _CharT, class _Traits, class _Allocator> |
| 108 | [[__nodiscard__]] | ||
| 105 | _LIBCPP_HIDE_FROM_ABI bool operator()(const basic_string<_CharT, _Traits, _Allocator>& __x, | 109 | _LIBCPP_HIDE_FROM_ABI bool operator()(const basic_string<_CharT, _Traits, _Allocator>& __x, |
| 106 | const basic_string<_CharT, _Traits, _Allocator>& __y) const { | 110 | const basic_string<_CharT, _Traits, _Allocator>& __y) const { |
| 107 | return std::use_facet<std::collate<_CharT> >(*this).compare( | 111 | return std::use_facet<std::collate<_CharT> >(*this).compare( |
| 108 | __x.data(), __x.data() + __x.size(), __y.data(), __y.data() + __y.size()) < 0; | 112 | __x.data(), __x.data() + __x.size(), __y.data(), __y.data() + __y.size()) < 0; |
| 109 | } | 113 | } |
| 114 | # if _LIBCPP_STD_VER >= 26 | ||
| 115 | [[nodiscard]] _LIBCPP_AVAILABILITY_TEXT_ENCODING_ENVIRONMENT | ||
| 116 | _LIBCPP_HIDE_FROM_ABI std::text_encoding encoding() const { | ||
| 117 | std::string __name = name(); | ||
| 118 | return std::__get_locale_encoding(__name.c_str()); | ||
| 119 | } | ||
| 120 | # endif | ||
| 110 | 121 | ||
| 111 | // global locale objects: | 122 | // global locale objects: |
| 112 | static locale global(const locale&); | 123 | static locale global(const locale&); |
| 113 | static const locale& classic(); | 124 | [[__nodiscard__]] static const locale& classic(); |
| 114 | 125 | ||
| 115 | private: | 126 | private: |
| 116 | class __imp; | 127 | class __imp; |
| ... | @@ -118,6 +129,9 @@ private: | ... | @@ -118,6 +129,9 @@ private: |
| 118 | 129 | ||
| 119 | template <class> | 130 | template <class> |
| 120 | friend struct __no_destroy; | 131 | friend struct __no_destroy; |
| 132 | |||
| 133 | friend ios_base; | ||
| 134 | |||
| 121 | _LIBCPP_HIDE_FROM_ABI explicit locale(__private_constructor_tag, __imp* __loc) : __locale_(__loc) {} | 135 | _LIBCPP_HIDE_FROM_ABI explicit locale(__private_constructor_tag, __imp* __loc) : __locale_(__loc) {} |
| 122 | 136 | ||
| 123 | void __install_ctor(const locale&, facet*, long); | 137 | void __install_ctor(const locale&, facet*, long); |
| ... | @@ -168,12 +182,12 @@ inline _LIBCPP_HIDE_FROM_ABI locale::locale(const locale& __other, _Facet* __f) | ... | @@ -168,12 +182,12 @@ inline _LIBCPP_HIDE_FROM_ABI locale::locale(const locale& __other, _Facet* __f) |
| 168 | } | 182 | } |
| 169 | 183 | ||
| 170 | template <class _Facet> | 184 | template <class _Facet> |
| 171 | inline _LIBCPP_HIDE_FROM_ABI bool has_facet(const locale& __l) _NOEXCEPT { | 185 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool has_facet(const locale& __l) _NOEXCEPT { |
| 172 | return __l.has_facet(_Facet::id); | 186 | return __l.has_facet(_Facet::id); |
| 173 | } | 187 | } |
| 174 | 188 | ||
| 175 | template <class _Facet> | 189 | template <class _Facet> |
| 176 | inline _LIBCPP_HIDE_FROM_ABI const _Facet& use_facet(const locale& __l) { | 190 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI const _Facet& use_facet(const locale& __l) { |
| 177 | return static_cast<const _Facet&>(*__l.use_facet(_Facet::id)); | 191 | return static_cast<const _Facet&>(*__l.use_facet(_Facet::id)); |
| 178 | } | 192 | } |
| 179 | 193 | ||
| ... | @@ -187,19 +201,21 @@ public: | ... | @@ -187,19 +201,21 @@ public: |
| 187 | 201 | ||
| 188 | _LIBCPP_HIDE_FROM_ABI explicit collate(size_t __refs = 0) : locale::facet(__refs) {} | 202 | _LIBCPP_HIDE_FROM_ABI explicit collate(size_t __refs = 0) : locale::facet(__refs) {} |
| 189 | 203 | ||
| 190 | _LIBCPP_HIDE_FROM_ABI int | 204 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int |
| 191 | compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const { | 205 | compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const { |
| 192 | return do_compare(__lo1, __hi1, __lo2, __hi2); | 206 | return do_compare(__lo1, __hi1, __lo2, __hi2); |
| 193 | } | 207 | } |
| 194 | 208 | ||
| 195 | // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work | 209 | // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work |
| 196 | // around a dllimport bug that expects an external instantiation. | 210 | // around a dllimport bug that expects an external instantiation. |
| 197 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE string_type | 211 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE string_type |
| 198 | transform(const char_type* __lo, const char_type* __hi) const { | 212 | transform(const char_type* __lo, const char_type* __hi) const { |
| 199 | return do_transform(__lo, __hi); | 213 | return do_transform(__lo, __hi); |
| 200 | } | 214 | } |
| 201 | 215 | ||
| 202 | _LIBCPP_HIDE_FROM_ABI long hash(const char_type* __lo, const char_type* __hi) const { return do_hash(__lo, __hi); } | 216 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI long hash(const char_type* __lo, const char_type* __hi) const { |
| 217 | return do_hash(__lo, __hi); | ||
| 218 | } | ||
| 203 | 219 | ||
| 204 | static locale::id id; | 220 | static locale::id id; |
| 205 | 221 | ||
| ... | @@ -318,6 +334,8 @@ public: | ... | @@ -318,6 +334,8 @@ public: |
| 318 | # endif // defined(__BIONIC__) | 334 | # endif // defined(__BIONIC__) |
| 319 | # elif defined(__GLIBC__) | 335 | # elif defined(__GLIBC__) |
| 320 | typedef unsigned short mask; | 336 | typedef unsigned short mask; |
| 337 | _LIBCPP_DIAGNOSTIC_PUSH | ||
| 338 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmodules-ambiguous-internal-linkage") | ||
| 321 | static const mask space = _ISspace; | 339 | static const mask space = _ISspace; |
| 322 | static const mask print = _ISprint; | 340 | static const mask print = _ISprint; |
| 323 | static const mask cntrl = _IScntrl; | 341 | static const mask cntrl = _IScntrl; |
| ... | @@ -328,6 +346,7 @@ public: | ... | @@ -328,6 +346,7 @@ public: |
| 328 | static const mask punct = _ISpunct; | 346 | static const mask punct = _ISpunct; |
| 329 | static const mask xdigit = _ISxdigit; | 347 | static const mask xdigit = _ISxdigit; |
| 330 | static const mask blank = _ISblank; | 348 | static const mask blank = _ISblank; |
| 349 | _LIBCPP_DIAGNOSTIC_POP | ||
| 331 | # if defined(__mips__) || (BYTE_ORDER == BIG_ENDIAN) | 350 | # if defined(__mips__) || (BYTE_ORDER == BIG_ENDIAN) |
| 332 | static const mask __regex_word = static_cast<mask>(_ISbit(15)); | 351 | static const mask __regex_word = static_cast<mask>(_ISbit(15)); |
| 333 | # else | 352 | # else |
| ... | @@ -459,39 +478,43 @@ public: | ... | @@ -459,39 +478,43 @@ public: |
| 459 | 478 | ||
| 460 | _LIBCPP_HIDE_FROM_ABI explicit ctype(size_t __refs = 0) : locale::facet(__refs) {} | 479 | _LIBCPP_HIDE_FROM_ABI explicit ctype(size_t __refs = 0) : locale::facet(__refs) {} |
| 461 | 480 | ||
| 462 | _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const { return do_is(__m, __c); } | 481 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const { return do_is(__m, __c); } |
| 463 | 482 | ||
| 464 | _LIBCPP_HIDE_FROM_ABI const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const { | 483 | _LIBCPP_HIDE_FROM_ABI const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const { |
| 465 | return do_is(__low, __high, __vec); | 484 | return do_is(__low, __high, __vec); |
| 466 | } | 485 | } |
| 467 | 486 | ||
| 468 | _LIBCPP_HIDE_FROM_ABI const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const { | 487 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const char_type* |
| 488 | scan_is(mask __m, const char_type* __low, const char_type* __high) const { | ||
| 469 | return do_scan_is(__m, __low, __high); | 489 | return do_scan_is(__m, __low, __high); |
| 470 | } | 490 | } |
| 471 | 491 | ||
| 472 | _LIBCPP_HIDE_FROM_ABI const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const { | 492 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const char_type* |
| 493 | scan_not(mask __m, const char_type* __low, const char_type* __high) const { | ||
| 473 | return do_scan_not(__m, __low, __high); | 494 | return do_scan_not(__m, __low, __high); |
| 474 | } | 495 | } |
| 475 | 496 | ||
| 476 | _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); } | 497 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); } |
| 477 | 498 | ||
| 478 | _LIBCPP_HIDE_FROM_ABI const char_type* toupper(char_type* __low, const char_type* __high) const { | 499 | _LIBCPP_HIDE_FROM_ABI const char_type* toupper(char_type* __low, const char_type* __high) const { |
| 479 | return do_toupper(__low, __high); | 500 | return do_toupper(__low, __high); |
| 480 | } | 501 | } |
| 481 | 502 | ||
| 482 | _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); } | 503 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); } |
| 483 | 504 | ||
| 484 | _LIBCPP_HIDE_FROM_ABI const char_type* tolower(char_type* __low, const char_type* __high) const { | 505 | _LIBCPP_HIDE_FROM_ABI const char_type* tolower(char_type* __low, const char_type* __high) const { |
| 485 | return do_tolower(__low, __high); | 506 | return do_tolower(__low, __high); |
| 486 | } | 507 | } |
| 487 | 508 | ||
| 488 | _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); } | 509 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); } |
| 489 | 510 | ||
| 490 | _LIBCPP_HIDE_FROM_ABI const char* widen(const char* __low, const char* __high, char_type* __to) const { | 511 | _LIBCPP_HIDE_FROM_ABI const char* widen(const char* __low, const char* __high, char_type* __to) const { |
| 491 | return do_widen(__low, __high, __to); | 512 | return do_widen(__low, __high, __to); |
| 492 | } | 513 | } |
| 493 | 514 | ||
| 494 | _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const { return do_narrow(__c, __dfault); } | 515 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const { |
| 516 | return do_narrow(__c, __dfault); | ||
| 517 | } | ||
| 495 | 518 | ||
| 496 | _LIBCPP_HIDE_FROM_ABI const char_type* | 519 | _LIBCPP_HIDE_FROM_ABI const char_type* |
| 497 | narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const { | 520 | narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const { |
| ... | @@ -530,7 +553,7 @@ public: | ... | @@ -530,7 +553,7 @@ public: |
| 530 | 553 | ||
| 531 | explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0); | 554 | explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0); |
| 532 | 555 | ||
| 533 | _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const { | 556 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const { |
| 534 | return std::__libcpp_isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) != 0 : false; | 557 | return std::__libcpp_isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) != 0 : false; |
| 535 | } | 558 | } |
| 536 | 559 | ||
| ... | @@ -540,39 +563,43 @@ public: | ... | @@ -540,39 +563,43 @@ public: |
| 540 | return __low; | 563 | return __low; |
| 541 | } | 564 | } |
| 542 | 565 | ||
| 543 | _LIBCPP_HIDE_FROM_ABI const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const { | 566 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const char_type* |
| 567 | scan_is(mask __m, const char_type* __low, const char_type* __high) const { | ||
| 544 | for (; __low != __high; ++__low) | 568 | for (; __low != __high; ++__low) |
| 545 | if (std::__libcpp_isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)) | 569 | if (std::__libcpp_isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)) |
| 546 | break; | 570 | break; |
| 547 | return __low; | 571 | return __low; |
| 548 | } | 572 | } |
| 549 | 573 | ||
| 550 | _LIBCPP_HIDE_FROM_ABI const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const { | 574 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const char_type* |
| 575 | scan_not(mask __m, const char_type* __low, const char_type* __high) const { | ||
| 551 | for (; __low != __high; ++__low) | 576 | for (; __low != __high; ++__low) |
| 552 | if (!std::__libcpp_isascii(*__low) || !(__tab_[static_cast<int>(*__low)] & __m)) | 577 | if (!std::__libcpp_isascii(*__low) || !(__tab_[static_cast<int>(*__low)] & __m)) |
| 553 | break; | 578 | break; |
| 554 | return __low; | 579 | return __low; |
| 555 | } | 580 | } |
| 556 | 581 | ||
| 557 | _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); } | 582 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); } |
| 558 | 583 | ||
| 559 | _LIBCPP_HIDE_FROM_ABI const char_type* toupper(char_type* __low, const char_type* __high) const { | 584 | _LIBCPP_HIDE_FROM_ABI const char_type* toupper(char_type* __low, const char_type* __high) const { |
| 560 | return do_toupper(__low, __high); | 585 | return do_toupper(__low, __high); |
| 561 | } | 586 | } |
| 562 | 587 | ||
| 563 | _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); } | 588 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); } |
| 564 | 589 | ||
| 565 | _LIBCPP_HIDE_FROM_ABI const char_type* tolower(char_type* __low, const char_type* __high) const { | 590 | _LIBCPP_HIDE_FROM_ABI const char_type* tolower(char_type* __low, const char_type* __high) const { |
| 566 | return do_tolower(__low, __high); | 591 | return do_tolower(__low, __high); |
| 567 | } | 592 | } |
| 568 | 593 | ||
| 569 | _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); } | 594 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); } |
| 570 | 595 | ||
| 571 | _LIBCPP_HIDE_FROM_ABI const char* widen(const char* __low, const char* __high, char_type* __to) const { | 596 | _LIBCPP_HIDE_FROM_ABI const char* widen(const char* __low, const char* __high, char_type* __to) const { |
| 572 | return do_widen(__low, __high, __to); | 597 | return do_widen(__low, __high, __to); |
| 573 | } | 598 | } |
| 574 | 599 | ||
| 575 | _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const { return do_narrow(__c, __dfault); } | 600 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const { |
| 601 | return do_narrow(__c, __dfault); | ||
| 602 | } | ||
| 576 | 603 | ||
| 577 | _LIBCPP_HIDE_FROM_ABI const char* | 604 | _LIBCPP_HIDE_FROM_ABI const char* |
| 578 | narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const { | 605 | narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const { |
| ... | @@ -586,8 +613,8 @@ public: | ... | @@ -586,8 +613,8 @@ public: |
| 586 | # else | 613 | # else |
| 587 | static const size_t table_size = 256; | 614 | static const size_t table_size = 256; |
| 588 | # endif | 615 | # endif |
| 589 | _LIBCPP_HIDE_FROM_ABI const mask* table() const _NOEXCEPT { return __tab_; } | 616 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const mask* table() const _NOEXCEPT { return __tab_; } |
| 590 | static const mask* classic_table() _NOEXCEPT; | 617 | [[__nodiscard__]] static const mask* classic_table() _NOEXCEPT; |
| 591 | 618 | ||
| 592 | protected: | 619 | protected: |
| 593 | ~ctype() override; | 620 | ~ctype() override; |
| ... | @@ -650,72 +677,72 @@ protected: | ... | @@ -650,72 +677,72 @@ protected: |
| 650 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 677 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 651 | 678 | ||
| 652 | template <class _CharT> | 679 | template <class _CharT> |
| 653 | inline _LIBCPP_HIDE_FROM_ABI bool isspace(_CharT __c, const locale& __loc) { | 680 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isspace(_CharT __c, const locale& __loc) { |
| 654 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); | 681 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); |
| 655 | } | 682 | } |
| 656 | 683 | ||
| 657 | template <class _CharT> | 684 | template <class _CharT> |
| 658 | inline _LIBCPP_HIDE_FROM_ABI bool isprint(_CharT __c, const locale& __loc) { | 685 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isprint(_CharT __c, const locale& __loc) { |
| 659 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); | 686 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); |
| 660 | } | 687 | } |
| 661 | 688 | ||
| 662 | template <class _CharT> | 689 | template <class _CharT> |
| 663 | inline _LIBCPP_HIDE_FROM_ABI bool iscntrl(_CharT __c, const locale& __loc) { | 690 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool iscntrl(_CharT __c, const locale& __loc) { |
| 664 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); | 691 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); |
| 665 | } | 692 | } |
| 666 | 693 | ||
| 667 | template <class _CharT> | 694 | template <class _CharT> |
| 668 | inline _LIBCPP_HIDE_FROM_ABI bool isupper(_CharT __c, const locale& __loc) { | 695 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isupper(_CharT __c, const locale& __loc) { |
| 669 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); | 696 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); |
| 670 | } | 697 | } |
| 671 | 698 | ||
| 672 | template <class _CharT> | 699 | template <class _CharT> |
| 673 | inline _LIBCPP_HIDE_FROM_ABI bool islower(_CharT __c, const locale& __loc) { | 700 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool islower(_CharT __c, const locale& __loc) { |
| 674 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); | 701 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); |
| 675 | } | 702 | } |
| 676 | 703 | ||
| 677 | template <class _CharT> | 704 | template <class _CharT> |
| 678 | inline _LIBCPP_HIDE_FROM_ABI bool isalpha(_CharT __c, const locale& __loc) { | 705 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isalpha(_CharT __c, const locale& __loc) { |
| 679 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); | 706 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); |
| 680 | } | 707 | } |
| 681 | 708 | ||
| 682 | template <class _CharT> | 709 | template <class _CharT> |
| 683 | inline _LIBCPP_HIDE_FROM_ABI bool isdigit(_CharT __c, const locale& __loc) { | 710 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isdigit(_CharT __c, const locale& __loc) { |
| 684 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); | 711 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); |
| 685 | } | 712 | } |
| 686 | 713 | ||
| 687 | template <class _CharT> | 714 | template <class _CharT> |
| 688 | inline _LIBCPP_HIDE_FROM_ABI bool ispunct(_CharT __c, const locale& __loc) { | 715 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool ispunct(_CharT __c, const locale& __loc) { |
| 689 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); | 716 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); |
| 690 | } | 717 | } |
| 691 | 718 | ||
| 692 | template <class _CharT> | 719 | template <class _CharT> |
| 693 | inline _LIBCPP_HIDE_FROM_ABI bool isxdigit(_CharT __c, const locale& __loc) { | 720 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isxdigit(_CharT __c, const locale& __loc) { |
| 694 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); | 721 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); |
| 695 | } | 722 | } |
| 696 | 723 | ||
| 697 | template <class _CharT> | 724 | template <class _CharT> |
| 698 | inline _LIBCPP_HIDE_FROM_ABI bool isalnum(_CharT __c, const locale& __loc) { | 725 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isalnum(_CharT __c, const locale& __loc) { |
| 699 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); | 726 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); |
| 700 | } | 727 | } |
| 701 | 728 | ||
| 702 | template <class _CharT> | 729 | template <class _CharT> |
| 703 | inline _LIBCPP_HIDE_FROM_ABI bool isgraph(_CharT __c, const locale& __loc) { | 730 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isgraph(_CharT __c, const locale& __loc) { |
| 704 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); | 731 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); |
| 705 | } | 732 | } |
| 706 | 733 | ||
| 707 | template <class _CharT> | 734 | template <class _CharT> |
| 708 | _LIBCPP_HIDE_FROM_ABI bool isblank(_CharT __c, const locale& __loc) { | 735 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool isblank(_CharT __c, const locale& __loc) { |
| 709 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::blank, __c); | 736 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::blank, __c); |
| 710 | } | 737 | } |
| 711 | 738 | ||
| 712 | template <class _CharT> | 739 | template <class _CharT> |
| 713 | inline _LIBCPP_HIDE_FROM_ABI _CharT toupper(_CharT __c, const locale& __loc) { | 740 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _CharT toupper(_CharT __c, const locale& __loc) { |
| 714 | return std::use_facet<ctype<_CharT> >(__loc).toupper(__c); | 741 | return std::use_facet<ctype<_CharT> >(__loc).toupper(__c); |
| 715 | } | 742 | } |
| 716 | 743 | ||
| 717 | template <class _CharT> | 744 | template <class _CharT> |
| 718 | inline _LIBCPP_HIDE_FROM_ABI _CharT tolower(_CharT __c, const locale& __loc) { | 745 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _CharT tolower(_CharT __c, const locale& __loc) { |
| 719 | return std::use_facet<ctype<_CharT> >(__loc).tolower(__c); | 746 | return std::use_facet<ctype<_CharT> >(__loc).tolower(__c); |
| 720 | } | 747 | } |
| 721 | 748 | ||
| ... | @@ -770,16 +797,16 @@ public: | ... | @@ -770,16 +797,16 @@ public: |
| 770 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); | 797 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); |
| 771 | } | 798 | } |
| 772 | 799 | ||
| 773 | _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } | 800 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } |
| 774 | 801 | ||
| 775 | _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } | 802 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } |
| 776 | 803 | ||
| 777 | _LIBCPP_HIDE_FROM_ABI int | 804 | _LIBCPP_HIDE_FROM_ABI int |
| 778 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { | 805 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { |
| 779 | return do_length(__st, __frm, __end, __mx); | 806 | return do_length(__st, __frm, __end, __mx); |
| 780 | } | 807 | } |
| 781 | 808 | ||
| 782 | _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } | 809 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } |
| 783 | 810 | ||
| 784 | static locale::id id; | 811 | static locale::id id; |
| 785 | 812 | ||
| ... | @@ -852,16 +879,16 @@ public: | ... | @@ -852,16 +879,16 @@ public: |
| 852 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); | 879 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); |
| 853 | } | 880 | } |
| 854 | 881 | ||
| 855 | _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } | 882 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } |
| 856 | 883 | ||
| 857 | _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } | 884 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } |
| 858 | 885 | ||
| 859 | _LIBCPP_HIDE_FROM_ABI int | 886 | _LIBCPP_HIDE_FROM_ABI int |
| 860 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { | 887 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { |
| 861 | return do_length(__st, __frm, __end, __mx); | 888 | return do_length(__st, __frm, __end, __mx); |
| 862 | } | 889 | } |
| 863 | 890 | ||
| 864 | _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } | 891 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } |
| 865 | 892 | ||
| 866 | static locale::id id; | 893 | static locale::id id; |
| 867 | 894 | ||
| ... | @@ -933,16 +960,16 @@ public: | ... | @@ -933,16 +960,16 @@ public: |
| 933 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); | 960 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); |
| 934 | } | 961 | } |
| 935 | 962 | ||
| 936 | _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } | 963 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } |
| 937 | 964 | ||
| 938 | _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } | 965 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } |
| 939 | 966 | ||
| 940 | _LIBCPP_HIDE_FROM_ABI int | 967 | _LIBCPP_HIDE_FROM_ABI int |
| 941 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { | 968 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { |
| 942 | return do_length(__st, __frm, __end, __mx); | 969 | return do_length(__st, __frm, __end, __mx); |
| 943 | } | 970 | } |
| 944 | 971 | ||
| 945 | _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } | 972 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } |
| 946 | 973 | ||
| 947 | static locale::id id; | 974 | static locale::id id; |
| 948 | 975 | ||
| ... | @@ -976,10 +1003,11 @@ protected: | ... | @@ -976,10 +1003,11 @@ protected: |
| 976 | 1003 | ||
| 977 | # if _LIBCPP_HAS_CHAR8_T | 1004 | # if _LIBCPP_HAS_CHAR8_T |
| 978 | 1005 | ||
| 979 | // template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20 | 1006 | // template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20, deprecated in C++20 |
| 980 | 1007 | ||
| 981 | template <> | 1008 | template <> |
| 982 | class _LIBCPP_EXPORTED_FROM_ABI codecvt<char16_t, char8_t, mbstate_t> : public locale::facet, public codecvt_base { | 1009 | class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXPORTED_FROM_ABI codecvt<char16_t, char8_t, mbstate_t> |
| 1010 | : public locale::facet, public codecvt_base { | ||
| 983 | public: | 1011 | public: |
| 984 | typedef char16_t intern_type; | 1012 | typedef char16_t intern_type; |
| 985 | typedef char8_t extern_type; | 1013 | typedef char8_t extern_type; |
| ... | @@ -1014,16 +1042,16 @@ public: | ... | @@ -1014,16 +1042,16 @@ public: |
| 1014 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); | 1042 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); |
| 1015 | } | 1043 | } |
| 1016 | 1044 | ||
| 1017 | _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } | 1045 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } |
| 1018 | 1046 | ||
| 1019 | _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } | 1047 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } |
| 1020 | 1048 | ||
| 1021 | _LIBCPP_HIDE_FROM_ABI int | 1049 | _LIBCPP_HIDE_FROM_ABI int |
| 1022 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { | 1050 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { |
| 1023 | return do_length(__st, __frm, __end, __mx); | 1051 | return do_length(__st, __frm, __end, __mx); |
| 1024 | } | 1052 | } |
| 1025 | 1053 | ||
| 1026 | _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } | 1054 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } |
| 1027 | 1055 | ||
| 1028 | static locale::id id; | 1056 | static locale::id id; |
| 1029 | 1057 | ||
| ... | @@ -1096,16 +1124,16 @@ public: | ... | @@ -1096,16 +1124,16 @@ public: |
| 1096 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); | 1124 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); |
| 1097 | } | 1125 | } |
| 1098 | 1126 | ||
| 1099 | _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } | 1127 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } |
| 1100 | 1128 | ||
| 1101 | _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } | 1129 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } |
| 1102 | 1130 | ||
| 1103 | _LIBCPP_HIDE_FROM_ABI int | 1131 | _LIBCPP_HIDE_FROM_ABI int |
| 1104 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { | 1132 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { |
| 1105 | return do_length(__st, __frm, __end, __mx); | 1133 | return do_length(__st, __frm, __end, __mx); |
| 1106 | } | 1134 | } |
| 1107 | 1135 | ||
| 1108 | _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } | 1136 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } |
| 1109 | 1137 | ||
| 1110 | static locale::id id; | 1138 | static locale::id id; |
| 1111 | 1139 | ||
| ... | @@ -1139,10 +1167,11 @@ protected: | ... | @@ -1139,10 +1167,11 @@ protected: |
| 1139 | 1167 | ||
| 1140 | # if _LIBCPP_HAS_CHAR8_T | 1168 | # if _LIBCPP_HAS_CHAR8_T |
| 1141 | 1169 | ||
| 1142 | // template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20 | 1170 | // template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20, deprecated in C++20 |
| 1143 | 1171 | ||
| 1144 | template <> | 1172 | template <> |
| 1145 | class _LIBCPP_EXPORTED_FROM_ABI codecvt<char32_t, char8_t, mbstate_t> : public locale::facet, public codecvt_base { | 1173 | class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXPORTED_FROM_ABI codecvt<char32_t, char8_t, mbstate_t> |
| 1174 | : public locale::facet, public codecvt_base { | ||
| 1146 | public: | 1175 | public: |
| 1147 | typedef char32_t intern_type; | 1176 | typedef char32_t intern_type; |
| 1148 | typedef char8_t extern_type; | 1177 | typedef char8_t extern_type; |
| ... | @@ -1177,16 +1206,16 @@ public: | ... | @@ -1177,16 +1206,16 @@ public: |
| 1177 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); | 1206 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); |
| 1178 | } | 1207 | } |
| 1179 | 1208 | ||
| 1180 | _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } | 1209 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); } |
| 1181 | 1210 | ||
| 1182 | _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } | 1211 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); } |
| 1183 | 1212 | ||
| 1184 | _LIBCPP_HIDE_FROM_ABI int | 1213 | _LIBCPP_HIDE_FROM_ABI int |
| 1185 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { | 1214 | length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { |
| 1186 | return do_length(__st, __frm, __end, __mx); | 1215 | return do_length(__st, __frm, __end, __mx); |
| 1187 | } | 1216 | } |
| 1188 | 1217 | ||
| 1189 | _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } | 1218 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); } |
| 1190 | 1219 | ||
| 1191 | static locale::id id; | 1220 | static locale::id id; |
| 1192 | 1221 | ||
| ... | @@ -1248,8 +1277,10 @@ _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>; // d | ... | @@ -1248,8 +1277,10 @@ _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>; // d |
| 1248 | extern template class _LIBCPP_DEPRECATED_IN_CXX20 | 1277 | extern template class _LIBCPP_DEPRECATED_IN_CXX20 |
| 1249 | _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>; // deprecated in C++20 | 1278 | _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>; // deprecated in C++20 |
| 1250 | # if _LIBCPP_HAS_CHAR8_T | 1279 | # if _LIBCPP_HAS_CHAR8_T |
| 1251 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>; // C++20 | 1280 | extern template class _LIBCPP_DEPRECATED_IN_CXX20 |
| 1252 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>; // C++20 | 1281 | _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>; // C++20, deprecated in C++20 |
| 1282 | extern template class _LIBCPP_DEPRECATED_IN_CXX20 | ||
| 1283 | _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>; // C++20, deprecated in C++20 | ||
| 1253 | # endif | 1284 | # endif |
| 1254 | 1285 | ||
| 1255 | template <size_t _Np> | 1286 | template <size_t _Np> |
| ... | @@ -1409,11 +1440,11 @@ public: | ... | @@ -1409,11 +1440,11 @@ public: |
| 1409 | 1440 | ||
| 1410 | explicit numpunct(size_t __refs = 0); | 1441 | explicit numpunct(size_t __refs = 0); |
| 1411 | 1442 | ||
| 1412 | _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); } | 1443 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); } |
| 1413 | _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); } | 1444 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); } |
| 1414 | _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); } | 1445 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); } |
| 1415 | _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); } | 1446 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); } |
| 1416 | _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); } | 1447 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); } |
| 1417 | 1448 | ||
| 1418 | static locale::id id; | 1449 | static locale::id id; |
| 1419 | 1450 | ||
| ... | @@ -1439,11 +1470,11 @@ public: | ... | @@ -1439,11 +1470,11 @@ public: |
| 1439 | 1470 | ||
| 1440 | explicit numpunct(size_t __refs = 0); | 1471 | explicit numpunct(size_t __refs = 0); |
| 1441 | 1472 | ||
| 1442 | _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); } | 1473 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); } |
| 1443 | _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); } | 1474 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); } |
| 1444 | _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); } | 1475 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); } |
| 1445 | _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); } | 1476 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); } |
| 1446 | _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); } | 1477 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); } |
| 1447 | 1478 | ||
| 1448 | static locale::id id; | 1479 | static locale::id id; |
| 1449 | 1480 | ||
| ... | @@ -1494,6 +1525,7 @@ protected: | ... | @@ -1494,6 +1525,7 @@ protected: |
| 1494 | }; | 1525 | }; |
| 1495 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 1526 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 1496 | 1527 | ||
| 1528 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 1497 | _LIBCPP_END_NAMESPACE_STD | 1529 | _LIBCPP_END_NAMESPACE_STD |
| 1498 | 1530 | ||
| 1499 | #endif // _LIBCPP_HAS_LOCALIZATION | 1531 | #endif // _LIBCPP_HAS_LOCALIZATION |
lib/libcxx/include/__locale_dir/check_grouping.h+2| ... | @@ -20,10 +20,12 @@ | ... | @@ -20,10 +20,12 @@ |
| 20 | # endif | 20 | # endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 23 | 24 | ||
| 24 | _LIBCPP_EXPORTED_FROM_ABI void | 25 | _LIBCPP_EXPORTED_FROM_ABI void |
| 25 | __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, ios_base::iostate& __err); | 26 | __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, ios_base::iostate& __err); |
| 26 | 27 | ||
| 28 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 27 | _LIBCPP_END_NAMESPACE_STD | 29 | _LIBCPP_END_NAMESPACE_STD |
| 28 | 30 | ||
| 29 | #endif // _LIBCPP_HAS_LOCALIZATION | 31 | #endif // _LIBCPP_HAS_LOCALIZATION |
lib/libcxx/include/__locale_dir/get_c_locale.h+2| ... | @@ -29,7 +29,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -29,7 +29,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | # else | 29 | # else |
| 30 | # define _LIBCPP_GET_C_LOCALE __cloc() | 30 | # define _LIBCPP_GET_C_LOCALE __cloc() |
| 31 | // Get the C locale object | 31 | // Get the C locale object |
| 32 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 32 | _LIBCPP_EXPORTED_FROM_ABI __locale::__locale_t __cloc(); | 33 | _LIBCPP_EXPORTED_FROM_ABI __locale::__locale_t __cloc(); |
| 34 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 33 | # define __cloc_defined | 35 | # define __cloc_defined |
| 34 | # endif | 36 | # endif |
| 35 | 37 |
lib/libcxx/include/__locale_dir/locale_base_api.h+16-8| ... | @@ -102,6 +102,8 @@ | ... | @@ -102,6 +102,8 @@ |
| 102 | // | 102 | // |
| 103 | // int __snprintf(char*, size_t, __locale_t, const char*, ...); // required by the headers | 103 | // int __snprintf(char*, size_t, __locale_t, const char*, ...); // required by the headers |
| 104 | // int __asprintf(char**, __locale_t, const char*, ...); // required by the headers | 104 | // int __asprintf(char**, __locale_t, const char*, ...); // required by the headers |
| 105 | // | ||
| 106 | // const char* __get_locale_encoding(__locale_t); | ||
| 105 | // } | 107 | // } |
| 106 | 108 | ||
| 107 | #if _LIBCPP_HAS_LOCALIZATION | 109 | #if _LIBCPP_HAS_LOCALIZATION |
| ... | @@ -112,10 +114,14 @@ | ... | @@ -112,10 +114,14 @@ |
| 112 | # include <__locale_dir/support/freebsd.h> | 114 | # include <__locale_dir/support/freebsd.h> |
| 113 | # elif defined(__NetBSD__) | 115 | # elif defined(__NetBSD__) |
| 114 | # include <__locale_dir/support/netbsd.h> | 116 | # include <__locale_dir/support/netbsd.h> |
| 117 | # elif defined(__OpenBSD__) | ||
| 118 | # include <__locale_dir/support/openbsd.h> | ||
| 115 | # elif defined(_LIBCPP_MSVCRT_LIKE) | 119 | # elif defined(_LIBCPP_MSVCRT_LIKE) |
| 116 | # include <__locale_dir/support/windows.h> | 120 | # include <__locale_dir/support/windows.h> |
| 117 | # elif defined(__Fuchsia__) | 121 | # elif defined(__Fuchsia__) |
| 118 | # include <__locale_dir/support/fuchsia.h> | 122 | # include <__locale_dir/support/fuchsia.h> |
| 123 | # elif _LIBCPP_LIBC_LLVM_LIBC | ||
| 124 | # include <__locale_dir/support/llvm_libc.h> | ||
| 119 | # elif defined(__linux__) | 125 | # elif defined(__linux__) |
| 120 | # include <__locale_dir/support/linux.h> | 126 | # include <__locale_dir/support/linux.h> |
| 121 | # elif _LIBCPP_LIBC_NEWLIB | 127 | # elif _LIBCPP_LIBC_NEWLIB |
| ... | @@ -128,17 +134,14 @@ | ... | @@ -128,17 +134,14 @@ |
| 128 | // (by providing global non-reserved names) and the new API. As we move individual platforms | 134 | // (by providing global non-reserved names) and the new API. As we move individual platforms |
| 129 | // towards the new way of defining the locale base API, this should disappear since each platform | 135 | // towards the new way of defining the locale base API, this should disappear since each platform |
| 130 | // will define those directly. | 136 | // will define those directly. |
| 131 | # if defined(__MVS__) | 137 | # include <__locale_dir/locale_base_api/ibm.h> |
| 132 | # include <__locale_dir/locale_base_api/ibm.h> | ||
| 133 | # elif defined(__OpenBSD__) | ||
| 134 | # include <__locale_dir/locale_base_api/openbsd.h> | ||
| 135 | # endif | ||
| 136 | 138 | ||
| 137 | # include <__locale_dir/locale_base_api/bsd_locale_fallbacks.h> | 139 | # include <__locale_dir/locale_base_api/bsd_locale_fallbacks.h> |
| 138 | 140 | ||
| 139 | # include <__cstddef/size_t.h> | 141 | # include <__cstddef/size_t.h> |
| 140 | # include <__utility/forward.h> | 142 | # include <__utility/forward.h> |
| 141 | # include <ctype.h> | 143 | # include <ctype.h> |
| 144 | # include <langinfo.h> | ||
| 142 | # include <string.h> | 145 | # include <string.h> |
| 143 | # include <time.h> | 146 | # include <time.h> |
| 144 | # if _LIBCPP_HAS_WIDE_CHARACTERS | 147 | # if _LIBCPP_HAS_WIDE_CHARACTERS |
| ... | @@ -228,8 +231,8 @@ inline _LIBCPP_HIDE_FROM_ABI wint_t __towupper(wint_t __ch, __locale_t __loc) { | ... | @@ -228,8 +231,8 @@ inline _LIBCPP_HIDE_FROM_ABI wint_t __towupper(wint_t __ch, __locale_t __loc) { |
| 228 | inline _LIBCPP_HIDE_FROM_ABI wint_t __towlower(wint_t __ch, __locale_t __loc) { return towlower_l(__ch, __loc); } | 231 | inline _LIBCPP_HIDE_FROM_ABI wint_t __towlower(wint_t __ch, __locale_t __loc) { return towlower_l(__ch, __loc); } |
| 229 | # endif | 232 | # endif |
| 230 | 233 | ||
| 231 | inline _LIBCPP_HIDE_FROM_ABI size_t | 234 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t |
| 232 | __strftime(char* __s, size_t __max, const char* __format, const tm* __tm, __locale_t __loc) { | 235 | __strftime(char* __s, size_t __max, const char* __format, const tm* __tm, __locale_t __loc) { |
| 233 | return strftime_l(__s, __max, __format, __tm, __loc); | 236 | return strftime_l(__s, __max, __format, __tm, __loc); |
| 234 | } | 237 | } |
| 235 | 238 | ||
| ... | @@ -268,7 +271,12 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, | ... | @@ -268,7 +271,12 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, |
| 268 | return __libcpp_mbsrtowcs_l(__dest, __src, __len, __ps, __loc); | 271 | return __libcpp_mbsrtowcs_l(__dest, __src, __len, __ps, __loc); |
| 269 | } | 272 | } |
| 270 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 273 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 271 | # endif // _LIBCPP_BUILDING_LIBRARY | 274 | |
| 275 | inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) { | ||
| 276 | return ::nl_langinfo_l(CODESET, __loc); | ||
| 277 | } | ||
| 278 | |||
| 279 | # endif // _LIBCPP_BUILDING_LIBRARY | ||
| 272 | 280 | ||
| 273 | _LIBCPP_DIAGNOSTIC_PUSH | 281 | _LIBCPP_DIAGNOSTIC_PUSH |
| 274 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat") | 282 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat") |
lib/libcxx/include/__locale_dir/locale_base_api/android.h deleted-45| ... | @@ -1,45 +0,0 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===-----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_ANDROID_H | ||
| 11 | #define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_ANDROID_H | ||
| 12 | |||
| 13 | #include <stdlib.h> | ||
| 14 | |||
| 15 | // FIXME: Is this actually required? | ||
| 16 | extern "C" { | ||
| 17 | #include <xlocale.h> | ||
| 18 | } | ||
| 19 | |||
| 20 | #include <android/api-level.h> | ||
| 21 | |||
| 22 | // If we do not have this header, we are in a platform build rather than an NDK | ||
| 23 | // build, which will always be at least as new as the ToT NDK, in which case we | ||
| 24 | // don't need any of the inlines below since libc provides them. | ||
| 25 | #if __has_include(<android/ndk-version.h>) | ||
| 26 | # include <android/ndk-version.h> | ||
| 27 | // In NDK versions later than 16, locale-aware functions are provided by | ||
| 28 | // legacy_stdlib_inlines.h | ||
| 29 | # if __NDK_MAJOR__ <= 16 | ||
| 30 | # if __ANDROID_API__ < 26 | ||
| 31 | |||
| 32 | inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t) { | ||
| 33 | return ::strtof(__nptr, __endptr); | ||
| 34 | } | ||
| 35 | |||
| 36 | inline _LIBCPP_HIDE_FROM_ABI double strtod_l(const char* __nptr, char** __endptr, locale_t) { | ||
| 37 | return ::strtod(__nptr, __endptr); | ||
| 38 | } | ||
| 39 | |||
| 40 | # endif // __ANDROID_API__ < 26 | ||
| 41 | |||
| 42 | # endif // __NDK_MAJOR__ <= 16 | ||
| 43 | #endif // __has_include(<android/ndk-version.h>) | ||
| 44 | |||
| 45 | #endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_ANDROID_H | ||
lib/libcxx/include/__locale_dir/locale_base_api/ibm.h created+97| ... | @@ -0,0 +1,97 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===-----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_IBM_H | ||
| 11 | #define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_IBM_H | ||
| 12 | |||
| 13 | #if defined(__MVS__) | ||
| 14 | # include <__support/ibm/locale_mgmt_zos.h> | ||
| 15 | #endif // defined(__MVS__) | ||
| 16 | |||
| 17 | #include <locale.h> | ||
| 18 | #include <stdarg.h> | ||
| 19 | #include <stdio.h> | ||
| 20 | |||
| 21 | #include "cstdlib" | ||
| 22 | |||
| 23 | #if defined(__MVS__) | ||
| 24 | # include <wctype.h> | ||
| 25 | // POSIX routines | ||
| 26 | # include <__support/xlocale/__posix_l_fallback.h> | ||
| 27 | #endif // defined(__MVS__) | ||
| 28 | |||
| 29 | namespace { | ||
| 30 | |||
| 31 | struct __setAndRestore { | ||
| 32 | explicit __setAndRestore(locale_t locale) { | ||
| 33 | if (locale == (locale_t)0) { | ||
| 34 | __cloc = newlocale(LC_ALL_MASK, "C", /* base */ (locale_t)0); | ||
| 35 | __stored = uselocale(__cloc); | ||
| 36 | } else { | ||
| 37 | __stored = uselocale(locale); | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | ~__setAndRestore() { | ||
| 42 | uselocale(__stored); | ||
| 43 | if (__cloc) | ||
| 44 | freelocale(__cloc); | ||
| 45 | } | ||
| 46 | |||
| 47 | private: | ||
| 48 | locale_t __stored = (locale_t)0; | ||
| 49 | locale_t __cloc = (locale_t)0; | ||
| 50 | }; | ||
| 51 | |||
| 52 | } // namespace | ||
| 53 | |||
| 54 | // The following are not POSIX routines. These are quick-and-dirty hacks | ||
| 55 | // to make things pretend to work | ||
| 56 | inline _LIBCPP_HIDE_FROM_ABI double strtod_l(const char* __nptr, char** __endptr, locale_t locale) { | ||
| 57 | __setAndRestore __newloc(locale); | ||
| 58 | return ::strtod(__nptr, __endptr); | ||
| 59 | } | ||
| 60 | |||
| 61 | inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t locale) { | ||
| 62 | __setAndRestore __newloc(locale); | ||
| 63 | return ::strtof(__nptr, __endptr); | ||
| 64 | } | ||
| 65 | |||
| 66 | inline _LIBCPP_HIDE_FROM_ABI long double strtold_l(const char* __nptr, char** __endptr, locale_t locale) { | ||
| 67 | __setAndRestore __newloc(locale); | ||
| 68 | return ::strtold(__nptr, __endptr); | ||
| 69 | } | ||
| 70 | |||
| 71 | inline _LIBCPP_HIDE_FROM_ABI | ||
| 72 | _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 2, 0) int vasprintf(char** strp, const char* fmt, va_list ap) { | ||
| 73 | const size_t buff_size = 256; | ||
| 74 | if ((*strp = (char*)malloc(buff_size)) == nullptr) { | ||
| 75 | return -1; | ||
| 76 | } | ||
| 77 | |||
| 78 | va_list ap_copy; | ||
| 79 | // va_copy may not be provided by the C library in C++03 mode. | ||
| 80 | #if defined(_LIBCPP_CXX03_LANG) && __has_builtin(__builtin_va_copy) | ||
| 81 | __builtin_va_copy(ap_copy, ap); | ||
| 82 | #else | ||
| 83 | va_copy(ap_copy, ap); | ||
| 84 | #endif | ||
| 85 | int str_size = vsnprintf(*strp, buff_size, fmt, ap_copy); | ||
| 86 | va_end(ap_copy); | ||
| 87 | |||
| 88 | if ((size_t)str_size >= buff_size) { | ||
| 89 | if ((*strp = (char*)realloc(*strp, str_size + 1)) == nullptr) { | ||
| 90 | return -1; | ||
| 91 | } | ||
| 92 | str_size = vsnprintf(*strp, str_size + 1, fmt, ap); | ||
| 93 | } | ||
| 94 | return str_size; | ||
| 95 | } | ||
| 96 | |||
| 97 | #endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_IBM_H | ||
lib/libcxx/include/__locale_dir/locale_base_api/musl.h deleted-31| ... | @@ -1,31 +0,0 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===-----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | // This adds support for the extended locale functions that are currently | ||
| 10 | // missing from the Musl C library. | ||
| 11 | // | ||
| 12 | // This only works when the specified locale is "C" or "POSIX", but that's | ||
| 13 | // about as good as we can do without implementing full xlocale support | ||
| 14 | // in Musl. | ||
| 15 | //===----------------------------------------------------------------------===// | ||
| 16 | |||
| 17 | #ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_MUSL_H | ||
| 18 | #define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_MUSL_H | ||
| 19 | |||
| 20 | #include <cstdlib> | ||
| 21 | #include <cwchar> | ||
| 22 | |||
| 23 | inline _LIBCPP_HIDE_FROM_ABI long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) { | ||
| 24 | return ::strtoll(__nptr, __endptr, __base); | ||
| 25 | } | ||
| 26 | |||
| 27 | inline _LIBCPP_HIDE_FROM_ABI unsigned long long strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) { | ||
| 28 | return ::strtoull(__nptr, __endptr, __base); | ||
| 29 | } | ||
| 30 | |||
| 31 | #endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_MUSL_H | ||
lib/libcxx/include/__locale_dir/locale_base_api/openbsd.h deleted-19| ... | @@ -1,19 +0,0 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===-----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H | ||
| 11 | #define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H | ||
| 12 | |||
| 13 | #include <__support/xlocale/__strtonum_fallback.h> | ||
| 14 | #include <clocale> | ||
| 15 | #include <cstdlib> | ||
| 16 | #include <ctype.h> | ||
| 17 | #include <cwctype> | ||
| 18 | |||
| 19 | #endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H | ||
lib/libcxx/include/__locale_dir/messages.h+5-2| ... | @@ -33,6 +33,7 @@ | ... | @@ -33,6 +33,7 @@ |
| 33 | # endif | 33 | # endif |
| 34 | 34 | ||
| 35 | _LIBCPP_BEGIN_NAMESPACE_STD | 35 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 36 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 36 | 37 | ||
| 37 | class _LIBCPP_EXPORTED_FROM_ABI messages_base { | 38 | class _LIBCPP_EXPORTED_FROM_ABI messages_base { |
| 38 | public: | 39 | public: |
| ... | @@ -49,11 +50,12 @@ public: | ... | @@ -49,11 +50,12 @@ public: |
| 49 | 50 | ||
| 50 | _LIBCPP_HIDE_FROM_ABI explicit messages(size_t __refs = 0) : locale::facet(__refs) {} | 51 | _LIBCPP_HIDE_FROM_ABI explicit messages(size_t __refs = 0) : locale::facet(__refs) {} |
| 51 | 52 | ||
| 52 | _LIBCPP_HIDE_FROM_ABI catalog open(const basic_string<char>& __nm, const locale& __loc) const { | 53 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI catalog open(const basic_string<char>& __nm, const locale& __loc) const { |
| 53 | return do_open(__nm, __loc); | 54 | return do_open(__nm, __loc); |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | _LIBCPP_HIDE_FROM_ABI string_type get(catalog __c, int __set, int __msgid, const string_type& __dflt) const { | 57 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type |
| 58 | get(catalog __c, int __set, int __msgid, const string_type& __dflt) const { | ||
| 57 | return do_get(__c, __set, __msgid, __dflt); | 59 | return do_get(__c, __set, __msgid, __dflt); |
| 58 | } | 60 | } |
| 59 | 61 | ||
| ... | @@ -136,6 +138,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>; | ... | @@ -136,6 +138,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>; |
| 136 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>; | 138 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>; |
| 137 | # endif | 139 | # endif |
| 138 | 140 | ||
| 141 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 139 | _LIBCPP_END_NAMESPACE_STD | 142 | _LIBCPP_END_NAMESPACE_STD |
| 140 | 143 | ||
| 141 | #endif // _LIBCPP_HAS_LOCALIZATION | 144 | #endif // _LIBCPP_HAS_LOCALIZATION |
lib/libcxx/include/__locale_dir/money.h+11-9| ... | @@ -32,6 +32,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -32,6 +32,7 @@ _LIBCPP_PUSH_MACROS |
| 32 | # include <__undef_macros> | 32 | # include <__undef_macros> |
| 33 | 33 | ||
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | 34 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 35 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 35 | 36 | ||
| 36 | // money_base | 37 | // money_base |
| 37 | 38 | ||
| ... | @@ -55,15 +56,15 @@ public: | ... | @@ -55,15 +56,15 @@ public: |
| 55 | 56 | ||
| 56 | _LIBCPP_HIDE_FROM_ABI explicit moneypunct(size_t __refs = 0) : locale::facet(__refs) {} | 57 | _LIBCPP_HIDE_FROM_ABI explicit moneypunct(size_t __refs = 0) : locale::facet(__refs) {} |
| 57 | 58 | ||
| 58 | _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); } | 59 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); } |
| 59 | _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); } | 60 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); } |
| 60 | _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); } | 61 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); } |
| 61 | _LIBCPP_HIDE_FROM_ABI string_type curr_symbol() const { return do_curr_symbol(); } | 62 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type curr_symbol() const { return do_curr_symbol(); } |
| 62 | _LIBCPP_HIDE_FROM_ABI string_type positive_sign() const { return do_positive_sign(); } | 63 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type positive_sign() const { return do_positive_sign(); } |
| 63 | _LIBCPP_HIDE_FROM_ABI string_type negative_sign() const { return do_negative_sign(); } | 64 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type negative_sign() const { return do_negative_sign(); } |
| 64 | _LIBCPP_HIDE_FROM_ABI int frac_digits() const { return do_frac_digits(); } | 65 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int frac_digits() const { return do_frac_digits(); } |
| 65 | _LIBCPP_HIDE_FROM_ABI pattern pos_format() const { return do_pos_format(); } | 66 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pattern pos_format() const { return do_pos_format(); } |
| 66 | _LIBCPP_HIDE_FROM_ABI pattern neg_format() const { return do_neg_format(); } | 67 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pattern neg_format() const { return do_neg_format(); } |
| 67 | 68 | ||
| 68 | static locale::id id; | 69 | static locale::id id; |
| 69 | static const bool intl = _International; | 70 | static const bool intl = _International; |
| ... | @@ -864,6 +865,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>; | ... | @@ -864,6 +865,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>; |
| 864 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>; | 865 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>; |
| 865 | # endif | 866 | # endif |
| 866 | 867 | ||
| 868 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 867 | _LIBCPP_END_NAMESPACE_STD | 869 | _LIBCPP_END_NAMESPACE_STD |
| 868 | 870 | ||
| 869 | _LIBCPP_POP_MACROS | 871 | _LIBCPP_POP_MACROS |
lib/libcxx/include/__locale_dir/num.h+3-2| ... | @@ -42,6 +42,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -42,6 +42,7 @@ _LIBCPP_PUSH_MACROS |
| 42 | # include <__undef_macros> | 42 | # include <__undef_macros> |
| 43 | 43 | ||
| 44 | _LIBCPP_BEGIN_NAMESPACE_STD | 44 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 45 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 45 | 46 | ||
| 46 | struct _LIBCPP_EXPORTED_FROM_ABI __num_get_base { | 47 | struct _LIBCPP_EXPORTED_FROM_ABI __num_get_base { |
| 47 | static const int __num_get_buf_sz = 40; | 48 | static const int __num_get_buf_sz = 40; |
| ... | @@ -95,9 +96,8 @@ struct __num_get : protected __num_get_base { | ... | @@ -95,9 +96,8 @@ struct __num_get : protected __num_get_base { |
| 95 | _LIBCPP_DIAGNOSTIC_PUSH | 96 | _LIBCPP_DIAGNOSTIC_PUSH |
| 96 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpsabi") | 97 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpsabi") |
| 97 | using __vec = __simd_vector<char, 32>; | 98 | using __vec = __simd_vector<char, 32>; |
| 98 | __vec __chars = std::__broadcast<__vec>(__val); | ||
| 99 | __vec __cmp = std::__partial_load<__vec, __int_chr_cnt>(__atoms); | 99 | __vec __cmp = std::__partial_load<__vec, __int_chr_cnt>(__atoms); |
| 100 | auto __res = __chars == __cmp; | 100 | auto __res = __vec(__val) == __cmp; |
| 101 | if (std::__none_of(__res)) | 101 | if (std::__none_of(__res)) |
| 102 | return __int_chr_cnt; | 102 | return __int_chr_cnt; |
| 103 | return std::min(__int_chr_cnt, std::__find_first_set(__res)); | 103 | return std::min(__int_chr_cnt, std::__find_first_set(__res)); |
| ... | @@ -1008,6 +1008,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>; | ... | @@ -1008,6 +1008,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>; |
| 1008 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>; | 1008 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>; |
| 1009 | # endif | 1009 | # endif |
| 1010 | 1010 | ||
| 1011 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 1011 | _LIBCPP_END_NAMESPACE_STD | 1012 | _LIBCPP_END_NAMESPACE_STD |
| 1012 | 1013 | ||
| 1013 | _LIBCPP_POP_MACROS | 1014 | _LIBCPP_POP_MACROS |
lib/libcxx/include/__locale_dir/pad_and_output.h+2-14| ... | @@ -55,13 +55,7 @@ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_CharT, _Traits> __pad_and_output( | ... | @@ -55,13 +55,7 @@ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_CharT, _Traits> __pad_and_output( |
| 55 | __ns -= __sz; | 55 | __ns -= __sz; |
| 56 | else | 56 | else |
| 57 | __ns = 0; | 57 | __ns = 0; |
| 58 | streamsize __np = __op - __ob; | 58 | __s = std::copy(__ob, __op, __s); |
| 59 | if (__np > 0) { | ||
| 60 | if (__s.__sbuf_->sputn(__ob, __np) != __np) { | ||
| 61 | __s.__sbuf_ = nullptr; | ||
| 62 | return __s; | ||
| 63 | } | ||
| 64 | } | ||
| 65 | if (__ns > 0) { | 59 | if (__ns > 0) { |
| 66 | basic_string<_CharT, _Traits> __sp(__ns, __fl); | 60 | basic_string<_CharT, _Traits> __sp(__ns, __fl); |
| 67 | if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns) { | 61 | if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns) { |
| ... | @@ -69,13 +63,7 @@ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_CharT, _Traits> __pad_and_output( | ... | @@ -69,13 +63,7 @@ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_CharT, _Traits> __pad_and_output( |
| 69 | return __s; | 63 | return __s; |
| 70 | } | 64 | } |
| 71 | } | 65 | } |
| 72 | __np = __oe - __op; | 66 | __s = std::copy(__op, __oe, __s); |
| 73 | if (__np > 0) { | ||
| 74 | if (__s.__sbuf_->sputn(__op, __np) != __np) { | ||
| 75 | __s.__sbuf_ = nullptr; | ||
| 76 | return __s; | ||
| 77 | } | ||
| 78 | } | ||
| 79 | __iob.width(0); | 67 | __iob.width(0); |
| 80 | return __s; | 68 | return __s; |
| 81 | } | 69 | } |
lib/libcxx/include/__locale_dir/support/bsd_like.h+8-3| ... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
| 15 | #include <__utility/forward.h> | 15 | #include <__utility/forward.h> |
| 16 | #include <clocale> // std::lconv | 16 | #include <clocale> // std::lconv |
| 17 | #include <ctype.h> | 17 | #include <ctype.h> |
| 18 | #include <langinfo.h> | ||
| 18 | #include <stdio.h> | 19 | #include <stdio.h> |
| 19 | #include <stdlib.h> | 20 | #include <stdlib.h> |
| 20 | #include <string.h> | 21 | #include <string.h> |
| ... | @@ -133,8 +134,8 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __ | ... | @@ -133,8 +134,8 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __ |
| 133 | } | 134 | } |
| 134 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 135 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 135 | 136 | ||
| 136 | inline _LIBCPP_HIDE_FROM_ABI size_t | 137 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t |
| 137 | __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) { | 138 | __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) { |
| 138 | return ::strftime_l(__s, __max, __format, __tm, __loc); | 139 | return ::strftime_l(__s, __max, __format, __tm, __loc); |
| 139 | } | 140 | } |
| 140 | 141 | ||
| ... | @@ -180,7 +181,11 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, | ... | @@ -180,7 +181,11 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, |
| 180 | return ::mbsrtowcs_l(__dest, __src, __len, __ps, __loc); | 181 | return ::mbsrtowcs_l(__dest, __src, __len, __ps, __loc); |
| 181 | } | 182 | } |
| 182 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 183 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 183 | #endif // _LIBCPP_BUILDING_LIBRARY | 184 | |
| 185 | inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) { | ||
| 186 | return ::nl_langinfo_l(CODESET, __loc); | ||
| 187 | } | ||
| 188 | #endif // _LIBCPP_BUILDING_LIBRARY | ||
| 184 | 189 | ||
| 185 | _LIBCPP_DIAGNOSTIC_PUSH | 190 | _LIBCPP_DIAGNOSTIC_PUSH |
| 186 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat") | 191 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat") |
lib/libcxx/include/__locale_dir/support/fuchsia.h+5| ... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
| 15 | #include <cstdio> | 15 | #include <cstdio> |
| 16 | #include <cstdlib> | 16 | #include <cstdlib> |
| 17 | #include <cwchar> | 17 | #include <cwchar> |
| 18 | #include <langinfo.h> | ||
| 18 | 19 | ||
| 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | # pragma GCC system_header | 21 | # pragma GCC system_header |
| ... | @@ -69,6 +70,10 @@ inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) { | ... | @@ -69,6 +70,10 @@ inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) { |
| 69 | return std::localeconv(); | 70 | return std::localeconv(); |
| 70 | } | 71 | } |
| 71 | 72 | ||
| 73 | inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) { | ||
| 74 | return ::nl_langinfo_l(CODESET, __loc); | ||
| 75 | } | ||
| 76 | |||
| 72 | // | 77 | // |
| 73 | // Other functions | 78 | // Other functions |
| 74 | // | 79 | // |
lib/libcxx/include/__locale_dir/support/linux.h+12-3| ... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
| 17 | #include <cstdio> | 17 | #include <cstdio> |
| 18 | #include <cstdlib> | 18 | #include <cstdlib> |
| 19 | #include <ctype.h> | 19 | #include <ctype.h> |
| 20 | #include <langinfo.h> | ||
| 20 | #include <stdarg.h> | 21 | #include <stdarg.h> |
| 21 | #include <string.h> | 22 | #include <string.h> |
| 22 | #include <time.h> | 23 | #include <time.h> |
| ... | @@ -148,8 +149,8 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __ | ... | @@ -148,8 +149,8 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __ |
| 148 | } | 149 | } |
| 149 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 150 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 150 | 151 | ||
| 151 | inline _LIBCPP_HIDE_FROM_ABI size_t | 152 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t |
| 152 | __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) { | 153 | __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) { |
| 153 | return strftime_l(__s, __max, __format, __tm, __loc); | 154 | return strftime_l(__s, __max, __format, __tm, __loc); |
| 154 | } | 155 | } |
| 155 | 156 | ||
| ... | @@ -211,7 +212,15 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, | ... | @@ -211,7 +212,15 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, |
| 211 | return std::mbsrtowcs(__dest, __src, __len, __ps); | 212 | return std::mbsrtowcs(__dest, __src, __len, __ps); |
| 212 | } | 213 | } |
| 213 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 214 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 214 | #endif // _LIBCPP_BUILDING_LIBRARY | 215 | |
| 216 | inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding([[maybe_unused]] __locale_t __loc) { | ||
| 217 | # if defined(__ANDROID__) | ||
| 218 | return "UTF-8"; | ||
| 219 | # else | ||
| 220 | return ::nl_langinfo_l(CODESET, __loc); | ||
| 221 | # endif | ||
| 222 | } | ||
| 223 | #endif // _LIBCPP_BUILDING_LIBRARY | ||
| 215 | 224 | ||
| 216 | #ifndef _LIBCPP_COMPILER_GCC // GCC complains that this can't be always_inline due to C-style varargs | 225 | #ifndef _LIBCPP_COMPILER_GCC // GCC complains that this can't be always_inline due to C-style varargs |
| 217 | _LIBCPP_HIDE_FROM_ABI | 226 | _LIBCPP_HIDE_FROM_ABI |
lib/libcxx/include/__locale_dir/support/newlib.h+7-2| ... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
| 16 | #include <cstdio> | 16 | #include <cstdio> |
| 17 | #include <cstdlib> | 17 | #include <cstdlib> |
| 18 | #include <ctype.h> | 18 | #include <ctype.h> |
| 19 | #include <langinfo.h> | ||
| 19 | #include <stdarg.h> | 20 | #include <stdarg.h> |
| 20 | #include <string.h> | 21 | #include <string.h> |
| 21 | #include <time.h> | 22 | #include <time.h> |
| ... | @@ -76,6 +77,10 @@ inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) { | ... | @@ -76,6 +77,10 @@ inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) { |
| 76 | __locale_guard __current(__loc); | 77 | __locale_guard __current(__loc); |
| 77 | return std::localeconv(); | 78 | return std::localeconv(); |
| 78 | } | 79 | } |
| 80 | |||
| 81 | inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) { | ||
| 82 | return ::nl_langinfo_l(CODESET, __loc); | ||
| 83 | } | ||
| 79 | #endif // _LIBCPP_BUILDING_LIBRARY | 84 | #endif // _LIBCPP_BUILDING_LIBRARY |
| 80 | 85 | ||
| 81 | // | 86 | // |
| ... | @@ -147,8 +152,8 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __ | ... | @@ -147,8 +152,8 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __ |
| 147 | } | 152 | } |
| 148 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 153 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 149 | 154 | ||
| 150 | inline _LIBCPP_HIDE_FROM_ABI | 155 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t |
| 151 | size_t __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) { | 156 | __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) { |
| 152 | return strftime_l(__s, __max, __format, __tm, __loc); | 157 | return strftime_l(__s, __max, __format, __tm, __loc); |
| 153 | } | 158 | } |
| 154 | 159 |
lib/libcxx/include/__locale_dir/support/no_locale/characters.h+6-4| ... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
| 16 | #include <cstring> | 16 | #include <cstring> |
| 17 | #include <ctime> | 17 | #include <ctime> |
| 18 | #if _LIBCPP_HAS_WIDE_CHARACTERS | 18 | #if _LIBCPP_HAS_WIDE_CHARACTERS |
| 19 | # include <cwchar> | ||
| 19 | # include <cwctype> | 20 | # include <cwctype> |
| 20 | #endif | 21 | #endif |
| 21 | 22 | ||
| ... | @@ -23,13 +24,14 @@ | ... | @@ -23,13 +24,14 @@ |
| 23 | # pragma GCC system_header | 24 | # pragma GCC system_header |
| 24 | #endif | 25 | #endif |
| 25 | 26 | ||
| 27 | #if defined(_LIBCPP_BUILDING_LIBRARY) | ||
| 28 | |||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | namespace __locale { | 30 | namespace __locale { |
| 28 | 31 | ||
| 29 | // | 32 | // |
| 30 | // Character manipulation functions | 33 | // Character manipulation functions |
| 31 | // | 34 | // |
| 32 | #if defined(_LIBCPP_BUILDING_LIBRARY) | ||
| 33 | inline _LIBCPP_HIDE_FROM_ABI int __toupper(int __c, __locale_t) { return std::toupper(__c); } | 35 | inline _LIBCPP_HIDE_FROM_ABI int __toupper(int __c, __locale_t) { return std::toupper(__c); } |
| 34 | 36 | ||
| 35 | inline _LIBCPP_HIDE_FROM_ABI int __tolower(int __c, __locale_t) { return std::tolower(__c); } | 37 | inline _LIBCPP_HIDE_FROM_ABI int __tolower(int __c, __locale_t) { return std::tolower(__c); } |
| ... | @@ -80,13 +82,13 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __ | ... | @@ -80,13 +82,13 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __ |
| 80 | } | 82 | } |
| 81 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 83 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 82 | 84 | ||
| 83 | inline _LIBCPP_HIDE_FROM_ABI size_t | 85 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t |
| 84 | __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t) { | 86 | __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t) { |
| 85 | return std::strftime(__s, __max, __format, __tm); | 87 | return std::strftime(__s, __max, __format, __tm); |
| 86 | } | 88 | } |
| 87 | #endif // _LIBCPP_BUILDING_LIBRARY | ||
| 88 | 89 | ||
| 89 | } // namespace __locale | 90 | } // namespace __locale |
| 90 | _LIBCPP_END_NAMESPACE_STD | 91 | _LIBCPP_END_NAMESPACE_STD |
| 91 | 92 | ||
| 93 | #endif // _LIBCPP_BUILDING_LIBRARY | ||
| 92 | #endif // _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_CHARACTERS_H | 94 | #endif // _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_CHARACTERS_H |
lib/libcxx/include/__locale_dir/support/no_locale/conversions.h created+73| ... | @@ -0,0 +1,73 @@ | ||
| 1 | //===-----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_CONVERSIONS_H | ||
| 10 | #define _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_CONVERSIONS_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__cstddef/size_t.h> | ||
| 14 | #include <__std_mbstate_t.h> | ||
| 15 | #include <cstdlib> | ||
| 16 | #if _LIBCPP_HAS_WIDE_CHARACTERS | ||
| 17 | # include <cwchar> | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 21 | # pragma GCC system_header | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(_LIBCPP_BUILDING_LIBRARY) | ||
| 25 | |||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 27 | namespace __locale { | ||
| 28 | |||
| 29 | inline _LIBCPP_HIDE_FROM_ABI decltype(MB_CUR_MAX) __mb_len_max(__locale_t) { return MB_CUR_MAX; } | ||
| 30 | |||
| 31 | # if _LIBCPP_HAS_WIDE_CHARACTERS | ||
| 32 | inline _LIBCPP_HIDE_FROM_ABI wint_t __btowc(int __c, __locale_t) { return std::btowc(__c); } | ||
| 33 | |||
| 34 | inline _LIBCPP_HIDE_FROM_ABI int __wctob(wint_t __c, __locale_t) { return std::wctob(__c); } | ||
| 35 | |||
| 36 | inline _LIBCPP_HIDE_FROM_ABI size_t | ||
| 37 | __wcsnrtombs(char* __dest, const wchar_t** __src, size_t __nwc, size_t __len, mbstate_t* __ps, __locale_t) { | ||
| 38 | return ::wcsnrtombs(__dest, __src, __nwc, __len, __ps); // Non-standard | ||
| 39 | } | ||
| 40 | |||
| 41 | inline _LIBCPP_HIDE_FROM_ABI size_t __wcrtomb(char* __s, wchar_t __wc, mbstate_t* __ps, __locale_t) { | ||
| 42 | return std::wcrtomb(__s, __wc, __ps); | ||
| 43 | } | ||
| 44 | |||
| 45 | inline _LIBCPP_HIDE_FROM_ABI size_t | ||
| 46 | __mbsnrtowcs(wchar_t* __dest, const char** __src, size_t __nms, size_t __len, mbstate_t* __ps, __locale_t) { | ||
| 47 | return ::mbsnrtowcs(__dest, __src, __nms, __len, __ps); // Non-standard | ||
| 48 | } | ||
| 49 | |||
| 50 | inline _LIBCPP_HIDE_FROM_ABI size_t | ||
| 51 | __mbrtowc(wchar_t* __pwc, const char* __s, size_t __n, mbstate_t* __ps, __locale_t) { | ||
| 52 | return std::mbrtowc(__pwc, __s, __n, __ps); | ||
| 53 | } | ||
| 54 | |||
| 55 | inline _LIBCPP_HIDE_FROM_ABI int __mbtowc(wchar_t* __pwc, const char* __pmb, size_t __max, __locale_t) { | ||
| 56 | return std::mbtowc(__pwc, __pmb, __max); | ||
| 57 | } | ||
| 58 | |||
| 59 | inline _LIBCPP_HIDE_FROM_ABI size_t __mbrlen(const char* __s, size_t __n, mbstate_t* __ps, __locale_t) { | ||
| 60 | return std::mbrlen(__s, __n, __ps); | ||
| 61 | } | ||
| 62 | |||
| 63 | inline _LIBCPP_HIDE_FROM_ABI size_t | ||
| 64 | __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, __locale_t) { | ||
| 65 | return std::mbsrtowcs(__dest, __src, __len, __ps); | ||
| 66 | } | ||
| 67 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | ||
| 68 | |||
| 69 | } // namespace __locale | ||
| 70 | _LIBCPP_END_NAMESPACE_STD | ||
| 71 | |||
| 72 | #endif // _LIBCPP_BUILDING_LIBRARY | ||
| 73 | #endif // _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_CONVERSIONS_H | ||
lib/libcxx/include/__locale_dir/support/no_locale/formatting.h created+50| ... | @@ -0,0 +1,50 @@ | ||
| 1 | //===-----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_FORMATTING_H | ||
| 10 | #define _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_FORMATTING_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__utility/forward.h> | ||
| 14 | #include <cstdio> | ||
| 15 | |||
| 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 17 | # pragma GCC system_header | ||
| 18 | #endif | ||
| 19 | |||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | namespace __locale { | ||
| 22 | |||
| 23 | _LIBCPP_DIAGNOSTIC_PUSH | ||
| 24 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat") | ||
| 25 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") // GCC doesn't support [[gnu::format]] on variadic templates | ||
| 26 | #ifdef _LIBCPP_COMPILER_CLANG_BASED | ||
| 27 | # define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) _LIBCPP_ATTRIBUTE_FORMAT(__VA_ARGS__) | ||
| 28 | #else | ||
| 29 | # define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) /* nothing */ | ||
| 30 | #endif | ||
| 31 | |||
| 32 | template <class... _Args> | ||
| 33 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 4, 5) int __snprintf( | ||
| 34 | char* __s, size_t __n, __locale_t, const char* __format, _Args&&... __args) { | ||
| 35 | return std::snprintf(__s, __n, __format, std::forward<_Args>(__args)...); | ||
| 36 | } | ||
| 37 | |||
| 38 | template <class... _Args> | ||
| 39 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __asprintf( | ||
| 40 | char** __s, __locale_t, const char* __format, _Args&&... __args) { | ||
| 41 | return ::asprintf(__s, __format, std::forward<_Args>(__args)...); // non-standard | ||
| 42 | } | ||
| 43 | |||
| 44 | _LIBCPP_DIAGNOSTIC_POP | ||
| 45 | #undef _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT | ||
| 46 | |||
| 47 | } // namespace __locale | ||
| 48 | _LIBCPP_END_NAMESPACE_STD | ||
| 49 | |||
| 50 | #endif // _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_FORMATTING_H | ||
lib/libcxx/include/__locale_dir/support/openbsd.h created+229| ... | @@ -0,0 +1,229 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===-----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H | ||
| 11 | #define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H | ||
| 12 | |||
| 13 | #include <__config> | ||
| 14 | #include <__cstddef/size_t.h> | ||
| 15 | #include <__std_mbstate_t.h> | ||
| 16 | #include <__utility/forward.h> | ||
| 17 | #include <clocale> // std::lconv | ||
| 18 | #include <ctype.h> | ||
| 19 | #include <stdio.h> | ||
| 20 | #include <stdlib.h> | ||
| 21 | #include <string.h> | ||
| 22 | #include <time.h> | ||
| 23 | #if _LIBCPP_HAS_WIDE_CHARACTERS | ||
| 24 | # include <wchar.h> | ||
| 25 | # include <wctype.h> | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 29 | # pragma GCC system_header | ||
| 30 | #endif | ||
| 31 | |||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | namespace __locale { | ||
| 34 | |||
| 35 | struct __locale_guard { | ||
| 36 | __locale_guard(locale_t& __loc) : __old_loc_(::uselocale(__loc)) {} | ||
| 37 | |||
| 38 | ~__locale_guard() { | ||
| 39 | if (__old_loc_) | ||
| 40 | ::uselocale(__old_loc_); | ||
| 41 | } | ||
| 42 | |||
| 43 | locale_t __old_loc_; | ||
| 44 | |||
| 45 | __locale_guard(__locale_guard const&) = delete; | ||
| 46 | __locale_guard& operator=(__locale_guard const&) = delete; | ||
| 47 | }; | ||
| 48 | |||
| 49 | // | ||
| 50 | // Locale management | ||
| 51 | // | ||
| 52 | #define _LIBCPP_COLLATE_MASK LC_COLLATE_MASK | ||
| 53 | #define _LIBCPP_CTYPE_MASK LC_CTYPE_MASK | ||
| 54 | #define _LIBCPP_MONETARY_MASK LC_MONETARY_MASK | ||
| 55 | #define _LIBCPP_NUMERIC_MASK LC_NUMERIC_MASK | ||
| 56 | #define _LIBCPP_TIME_MASK LC_TIME_MASK | ||
| 57 | #define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK | ||
| 58 | #define _LIBCPP_ALL_MASK LC_ALL_MASK | ||
| 59 | #define _LIBCPP_LC_ALL LC_ALL | ||
| 60 | |||
| 61 | using __locale_t _LIBCPP_NODEBUG = ::locale_t; | ||
| 62 | #if defined(_LIBCPP_BUILDING_LIBRARY) | ||
| 63 | using __lconv_t _LIBCPP_NODEBUG = std::lconv; | ||
| 64 | |||
| 65 | inline __locale_t __newlocale(int __category_mask, const char* __locale, __locale_t __base) { | ||
| 66 | return ::newlocale(__category_mask, __locale, __base); | ||
| 67 | } | ||
| 68 | |||
| 69 | inline void __freelocale(__locale_t __loc) { ::freelocale(__loc); } | ||
| 70 | |||
| 71 | inline char* __setlocale(int __category, char const* __locale) { return ::setlocale(__category, __locale); } | ||
| 72 | |||
| 73 | inline __lconv_t* __localeconv(__locale_t& __loc) { | ||
| 74 | __locale_guard __current(__loc); | ||
| 75 | return ::localeconv(); | ||
| 76 | } | ||
| 77 | #endif // _LIBCPP_BUILDING_LIBRARY | ||
| 78 | |||
| 79 | // | ||
| 80 | // Strtonum functions | ||
| 81 | // | ||
| 82 | inline float __strtof(const char* __nptr, char** __endptr, __locale_t) { return ::strtof(__nptr, __endptr); } | ||
| 83 | |||
| 84 | inline double __strtod(const char* __nptr, char** __endptr, __locale_t) { return ::strtod(__nptr, __endptr); } | ||
| 85 | |||
| 86 | inline long double __strtold(const char* __nptr, char** __endptr, __locale_t) { return ::strtold(__nptr, __endptr); } | ||
| 87 | |||
| 88 | // | ||
| 89 | // Character manipulation functions | ||
| 90 | // | ||
| 91 | #if defined(_LIBCPP_BUILDING_LIBRARY) | ||
| 92 | inline int __toupper(int __c, __locale_t __loc) { return ::toupper_l(__c, __loc); } | ||
| 93 | |||
| 94 | inline int __tolower(int __c, __locale_t __loc) { return ::tolower_l(__c, __loc); } | ||
| 95 | |||
| 96 | inline int __strcoll(const char* __s1, const char* __s2, __locale_t __loc) { return ::strcoll_l(__s1, __s2, __loc); } | ||
| 97 | |||
| 98 | inline size_t __strxfrm(char* __dest, const char* __src, size_t __n, __locale_t __loc) { | ||
| 99 | return ::strxfrm_l(__dest, __src, __n, __loc); | ||
| 100 | } | ||
| 101 | |||
| 102 | # if _LIBCPP_HAS_WIDE_CHARACTERS | ||
| 103 | inline int __iswctype(wint_t __c, wctype_t __type, __locale_t __loc) { return ::iswctype_l(__c, __type, __loc); } | ||
| 104 | |||
| 105 | inline int __iswspace(wint_t __c, __locale_t __loc) { return ::iswspace_l(__c, __loc); } | ||
| 106 | |||
| 107 | inline int __iswprint(wint_t __c, __locale_t __loc) { return ::iswprint_l(__c, __loc); } | ||
| 108 | |||
| 109 | inline int __iswcntrl(wint_t __c, __locale_t __loc) { return ::iswcntrl_l(__c, __loc); } | ||
| 110 | |||
| 111 | inline int __iswupper(wint_t __c, __locale_t __loc) { return ::iswupper_l(__c, __loc); } | ||
| 112 | |||
| 113 | inline int __iswlower(wint_t __c, __locale_t __loc) { return ::iswlower_l(__c, __loc); } | ||
| 114 | |||
| 115 | inline int __iswalpha(wint_t __c, __locale_t __loc) { return ::iswalpha_l(__c, __loc); } | ||
| 116 | |||
| 117 | inline int __iswblank(wint_t __c, __locale_t __loc) { return ::iswblank_l(__c, __loc); } | ||
| 118 | |||
| 119 | inline int __iswdigit(wint_t __c, __locale_t __loc) { return ::iswdigit_l(__c, __loc); } | ||
| 120 | |||
| 121 | inline int __iswpunct(wint_t __c, __locale_t __loc) { return ::iswpunct_l(__c, __loc); } | ||
| 122 | |||
| 123 | inline int __iswxdigit(wint_t __c, __locale_t __loc) { return ::iswxdigit_l(__c, __loc); } | ||
| 124 | |||
| 125 | inline wint_t __towupper(wint_t __c, __locale_t __loc) { return ::towupper_l(__c, __loc); } | ||
| 126 | |||
| 127 | inline wint_t __towlower(wint_t __c, __locale_t __loc) { return ::towlower_l(__c, __loc); } | ||
| 128 | |||
| 129 | inline int __wcscoll(const wchar_t* __ws1, const wchar_t* __ws2, __locale_t __loc) { | ||
| 130 | return ::wcscoll_l(__ws1, __ws2, __loc); | ||
| 131 | } | ||
| 132 | |||
| 133 | inline size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __src, size_t __n, __locale_t __loc) { | ||
| 134 | return ::wcsxfrm_l(__dest, __src, __n, __loc); | ||
| 135 | } | ||
| 136 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | ||
| 137 | |||
| 138 | inline _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t | ||
| 139 | __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) { | ||
| 140 | return ::strftime_l(__s, __max, __format, __tm, __loc); | ||
| 141 | } | ||
| 142 | |||
| 143 | // | ||
| 144 | // Other functions | ||
| 145 | // | ||
| 146 | inline decltype(MB_CUR_MAX) __mb_len_max(__locale_t __loc) { | ||
| 147 | __locale_guard __current(__loc); | ||
| 148 | return MB_CUR_MAX; | ||
| 149 | } | ||
| 150 | |||
| 151 | # if _LIBCPP_HAS_WIDE_CHARACTERS | ||
| 152 | inline wint_t __btowc(int __c, __locale_t __loc) { | ||
| 153 | __locale_guard __current(__loc); | ||
| 154 | return btowc(__c); | ||
| 155 | } | ||
| 156 | |||
| 157 | inline int __wctob(wint_t __c, __locale_t __loc) { | ||
| 158 | __locale_guard __current(__loc); | ||
| 159 | return wctob(__c); | ||
| 160 | } | ||
| 161 | |||
| 162 | inline size_t | ||
| 163 | __wcsnrtombs(char* __dest, const wchar_t** __src, size_t __nwc, size_t __len, mbstate_t* __ps, __locale_t __loc) { | ||
| 164 | __locale_guard __current(__loc); | ||
| 165 | return wcsnrtombs(__dest, __src, __nwc, __len, __ps); // wcsnrtombs is a POSIX extension | ||
| 166 | } | ||
| 167 | |||
| 168 | inline size_t __wcrtomb(char* __s, wchar_t __wc, mbstate_t* __ps, __locale_t __loc) { | ||
| 169 | __locale_guard __current(__loc); | ||
| 170 | return wcrtomb(__s, __wc, __ps); | ||
| 171 | } | ||
| 172 | |||
| 173 | inline size_t | ||
| 174 | __mbsnrtowcs(wchar_t* __dest, const char** __src, size_t __nms, size_t __len, mbstate_t* __ps, __locale_t __loc) { | ||
| 175 | __locale_guard __current(__loc); | ||
| 176 | return mbsnrtowcs(__dest, __src, __nms, __len, __ps); // mbsnrtowcs is a POSIX extension | ||
| 177 | } | ||
| 178 | |||
| 179 | inline size_t __mbrtowc(wchar_t* __pwc, const char* __s, size_t __n, mbstate_t* __ps, __locale_t __loc) { | ||
| 180 | __locale_guard __current(__loc); | ||
| 181 | return mbrtowc(__pwc, __s, __n, __ps); | ||
| 182 | } | ||
| 183 | |||
| 184 | inline int __mbtowc(wchar_t* __pwc, const char* __pmb, size_t __max, __locale_t __loc) { | ||
| 185 | __locale_guard __current(__loc); | ||
| 186 | return mbtowc(__pwc, __pmb, __max); | ||
| 187 | } | ||
| 188 | |||
| 189 | inline size_t __mbrlen(const char* __s, size_t __n, mbstate_t* __ps, __locale_t __loc) { | ||
| 190 | __locale_guard __current(__loc); | ||
| 191 | return mbrlen(__s, __n, __ps); | ||
| 192 | } | ||
| 193 | |||
| 194 | inline size_t __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, __locale_t __loc) { | ||
| 195 | __locale_guard __current(__loc); | ||
| 196 | return mbsrtowcs(__dest, __src, __len, __ps); | ||
| 197 | } | ||
| 198 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | ||
| 199 | #endif // _LIBCPP_BUILDING_LIBRARY | ||
| 200 | |||
| 201 | _LIBCPP_DIAGNOSTIC_PUSH | ||
| 202 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat") | ||
| 203 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") // GCC doesn't support [[gnu::format]] on variadic templates | ||
| 204 | #ifdef _LIBCPP_COMPILER_CLANG_BASED | ||
| 205 | # define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) _LIBCPP_ATTRIBUTE_FORMAT(__VA_ARGS__) | ||
| 206 | #else | ||
| 207 | # define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) /* nothing */ | ||
| 208 | #endif | ||
| 209 | |||
| 210 | template <class... _Args> | ||
| 211 | _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 4, 5) | ||
| 212 | int __snprintf(char* __s, size_t __n, __locale_t __loc, const char* __format, _Args&&... __args) { | ||
| 213 | __locale_guard __current(__loc); | ||
| 214 | return ::snprintf(__s, __n, __format, std::forward<_Args>(__args)...); | ||
| 215 | } | ||
| 216 | |||
| 217 | template <class... _Args> | ||
| 218 | _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 3, 4) | ||
| 219 | int __asprintf(char** __s, __locale_t __loc, const char* __format, _Args&&... __args) { | ||
| 220 | __locale_guard __current(__loc); | ||
| 221 | return ::asprintf(__s, __format, std::forward<_Args>(__args)...); // non-standard | ||
| 222 | } | ||
| 223 | _LIBCPP_DIAGNOSTIC_POP | ||
| 224 | #undef _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT | ||
| 225 | |||
| 226 | } // namespace __locale | ||
| 227 | _LIBCPP_END_NAMESPACE_STD | ||
| 228 | |||
| 229 | #endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H | ||
lib/libcxx/include/__locale_dir/support/windows.h+7-3| ... | @@ -27,6 +27,7 @@ | ... | @@ -27,6 +27,7 @@ |
| 27 | #endif | 27 | #endif |
| 28 | 28 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 30 | namespace __locale { | 31 | namespace __locale { |
| 31 | 32 | ||
| 32 | using __lconv_t _LIBCPP_NODEBUG = std::lconv; | 33 | using __lconv_t _LIBCPP_NODEBUG = std::lconv; |
| ... | @@ -163,6 +164,7 @@ inline _LIBCPP_HIDE_FROM_ABI char* __setlocale(int __category, const char* __loc | ... | @@ -163,6 +164,7 @@ inline _LIBCPP_HIDE_FROM_ABI char* __setlocale(int __category, const char* __loc |
| 163 | return __new_locale; | 164 | return __new_locale; |
| 164 | } | 165 | } |
| 165 | _LIBCPP_EXPORTED_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc); | 166 | _LIBCPP_EXPORTED_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc); |
| 167 | _LIBCPP_EXPORTED_FROM_ABI const char* __get_locale_encoding(__locale_t __loc); | ||
| 166 | #endif // _LIBCPP_BUILDING_LIBRARY | 168 | #endif // _LIBCPP_BUILDING_LIBRARY |
| 167 | 169 | ||
| 168 | // | 170 | // |
| ... | @@ -230,10 +232,11 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __ | ... | @@ -230,10 +232,11 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __ |
| 230 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 232 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 231 | 233 | ||
| 232 | # if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800 | 234 | # if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800 |
| 233 | _LIBCPP_EXPORTED_FROM_ABI size_t __strftime(char*, size_t, const char*, const struct tm*, __locale_t); | 235 | _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t |
| 236 | __strftime(char*, size_t, const char*, const struct tm*, __locale_t); | ||
| 234 | # else | 237 | # else |
| 235 | inline _LIBCPP_HIDE_FROM_ABI size_t | 238 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t |
| 236 | __strftime(char* __ret, size_t __n, const char* __format, const struct tm* __tm, __locale_t __loc) { | 239 | __strftime(char* __ret, size_t __n, const char* __format, const struct tm* __tm, __locale_t __loc) { |
| 237 | return ::_strftime_l(__ret, __n, __format, __tm, __loc); | 240 | return ::_strftime_l(__ret, __n, __format, __tm, __loc); |
| 238 | } | 241 | } |
| 239 | # endif | 242 | # endif |
| ... | @@ -303,6 +306,7 @@ struct __locale_guard { | ... | @@ -303,6 +306,7 @@ struct __locale_guard { |
| 303 | #endif // _LIBCPP_BUILDING_LIBRARY | 306 | #endif // _LIBCPP_BUILDING_LIBRARY |
| 304 | 307 | ||
| 305 | } // namespace __locale | 308 | } // namespace __locale |
| 309 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 306 | _LIBCPP_END_NAMESPACE_STD | 310 | _LIBCPP_END_NAMESPACE_STD |
| 307 | 311 | ||
| 308 | #endif // _LIBCPP___LOCALE_DIR_SUPPORT_WINDOWS_H | 312 | #endif // _LIBCPP___LOCALE_DIR_SUPPORT_WINDOWS_H |
lib/libcxx/include/__locale_dir/time.h+2| ... | @@ -22,6 +22,7 @@ | ... | @@ -22,6 +22,7 @@ |
| 22 | # endif | 22 | # endif |
| 23 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | 24 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 25 | 26 | ||
| 26 | template <class _CharT, class _InputIterator> | 27 | template <class _CharT, class _InputIterator> |
| 27 | _LIBCPP_HIDE_FROM_ABI int __get_up_to_n_digits( | 28 | _LIBCPP_HIDE_FROM_ABI int __get_up_to_n_digits( |
| ... | @@ -755,6 +756,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>; | ... | @@ -755,6 +756,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>; |
| 755 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>; | 756 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>; |
| 756 | # endif | 757 | # endif |
| 757 | 758 | ||
| 759 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 758 | _LIBCPP_END_NAMESPACE_STD | 760 | _LIBCPP_END_NAMESPACE_STD |
| 759 | 761 | ||
| 760 | #endif // _LIBCPP_HAS_LOCALIZATION | 762 | #endif // _LIBCPP_HAS_LOCALIZATION |
lib/libcxx/include/__locale_dir/wbuffer_convert.h+4-2| ... | @@ -27,6 +27,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -27,6 +27,7 @@ _LIBCPP_PUSH_MACROS |
| 27 | # include <__undef_macros> | 27 | # include <__undef_macros> |
| 28 | 28 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 30 | 31 | ||
| 31 | template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> > | 32 | template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> > |
| 32 | class _LIBCPP_DEPRECATED_IN_CXX17 wbuffer_convert : public basic_streambuf<_Elem, _Tr> { | 33 | class _LIBCPP_DEPRECATED_IN_CXX17 wbuffer_convert : public basic_streambuf<_Elem, _Tr> { |
| ... | @@ -67,7 +68,7 @@ public: | ... | @@ -67,7 +68,7 @@ public: |
| 67 | 68 | ||
| 68 | _LIBCPP_HIDE_FROM_ABI ~wbuffer_convert(); | 69 | _LIBCPP_HIDE_FROM_ABI ~wbuffer_convert(); |
| 69 | 70 | ||
| 70 | _LIBCPP_HIDE_FROM_ABI streambuf* rdbuf() const { return __bufptr_; } | 71 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI streambuf* rdbuf() const { return __bufptr_; } |
| 71 | _LIBCPP_HIDE_FROM_ABI streambuf* rdbuf(streambuf* __bytebuf) { | 72 | _LIBCPP_HIDE_FROM_ABI streambuf* rdbuf(streambuf* __bytebuf) { |
| 72 | streambuf* __r = __bufptr_; | 73 | streambuf* __r = __bufptr_; |
| 73 | __bufptr_ = __bytebuf; | 74 | __bufptr_ = __bytebuf; |
| ... | @@ -77,7 +78,7 @@ public: | ... | @@ -77,7 +78,7 @@ public: |
| 77 | wbuffer_convert(const wbuffer_convert&) = delete; | 78 | wbuffer_convert(const wbuffer_convert&) = delete; |
| 78 | wbuffer_convert& operator=(const wbuffer_convert&) = delete; | 79 | wbuffer_convert& operator=(const wbuffer_convert&) = delete; |
| 79 | 80 | ||
| 80 | _LIBCPP_HIDE_FROM_ABI state_type state() const { return __st_; } | 81 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI state_type state() const { return __st_; } |
| 81 | 82 | ||
| 82 | protected: | 83 | protected: |
| 83 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type underflow(); | 84 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type underflow(); |
| ... | @@ -419,6 +420,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>* wbuffer_convert<_Codecvt, _Elem, _Tr>::__ | ... | @@ -419,6 +420,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>* wbuffer_convert<_Codecvt, _Elem, _Tr>::__ |
| 419 | 420 | ||
| 420 | _LIBCPP_SUPPRESS_DEPRECATED_POP | 421 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 421 | 422 | ||
| 423 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 422 | _LIBCPP_END_NAMESPACE_STD | 424 | _LIBCPP_END_NAMESPACE_STD |
| 423 | 425 | ||
| 424 | _LIBCPP_POP_MACROS | 426 | _LIBCPP_POP_MACROS |
lib/libcxx/include/__locale_dir/wstring_convert.h+14-10| ... | @@ -64,28 +64,30 @@ public: | ... | @@ -64,28 +64,30 @@ public: |
| 64 | wstring_convert(const wstring_convert& __wc) = delete; | 64 | wstring_convert(const wstring_convert& __wc) = delete; |
| 65 | wstring_convert& operator=(const wstring_convert& __wc) = delete; | 65 | wstring_convert& operator=(const wstring_convert& __wc) = delete; |
| 66 | 66 | ||
| 67 | _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(char __byte) { return from_bytes(&__byte, &__byte + 1); } | 67 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(char __byte) { |
| 68 | _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __ptr) { | 68 | return from_bytes(&__byte, &__byte + 1); |
| 69 | } | ||
| 70 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __ptr) { | ||
| 69 | return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr)); | 71 | return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr)); |
| 70 | } | 72 | } |
| 71 | _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const byte_string& __str) { | 73 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const byte_string& __str) { |
| 72 | return from_bytes(__str.data(), __str.data() + __str.size()); | 74 | return from_bytes(__str.data(), __str.data() + __str.size()); |
| 73 | } | 75 | } |
| 74 | _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __first, const char* __last); | 76 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __first, const char* __last); |
| 75 | 77 | ||
| 76 | _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(_Elem __wchar) { | 78 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(_Elem __wchar) { |
| 77 | return to_bytes(std::addressof(__wchar), std::addressof(__wchar) + 1); | 79 | return to_bytes(std::addressof(__wchar), std::addressof(__wchar) + 1); |
| 78 | } | 80 | } |
| 79 | _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __wptr) { | 81 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __wptr) { |
| 80 | return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr)); | 82 | return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr)); |
| 81 | } | 83 | } |
| 82 | _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const wide_string& __wstr) { | 84 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const wide_string& __wstr) { |
| 83 | return to_bytes(__wstr.data(), __wstr.data() + __wstr.size()); | 85 | return to_bytes(__wstr.data(), __wstr.data() + __wstr.size()); |
| 84 | } | 86 | } |
| 85 | _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __first, const _Elem* __last); | 87 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __first, const _Elem* __last); |
| 86 | 88 | ||
| 87 | _LIBCPP_HIDE_FROM_ABI size_t converted() const _NOEXCEPT { return __cvtcount_; } | 89 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t converted() const _NOEXCEPT { return __cvtcount_; } |
| 88 | _LIBCPP_HIDE_FROM_ABI state_type state() const { return __cvtstate_; } | 90 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI state_type state() const { return __cvtstate_; } |
| 89 | }; | 91 | }; |
| 90 | 92 | ||
| 91 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | 93 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| ... | @@ -174,9 +176,11 @@ wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::from_bytes(const char* | ... | @@ -174,9 +176,11 @@ wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::from_bytes(const char* |
| 174 | return __wide_err_string_; | 176 | return __wide_err_string_; |
| 175 | } | 177 | } |
| 176 | 178 | ||
| 179 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | ||
| 177 | template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc> | 180 | template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc> |
| 178 | typename wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::byte_string | 181 | typename wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::byte_string |
| 179 | wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::to_bytes(const _Elem* __frm, const _Elem* __frm_end) { | 182 | wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::to_bytes(const _Elem* __frm, const _Elem* __frm_end) { |
| 183 | _LIBCPP_SUPPRESS_DEPRECATED_POP | ||
| 180 | __cvtcount_ = 0; | 184 | __cvtcount_ = 0; |
| 181 | if (__cvtptr_ != nullptr) { | 185 | if (__cvtptr_ != nullptr) { |
| 182 | byte_string __bs(2 * (__frm_end - __frm), char()); | 186 | byte_string __bs(2 * (__frm_end - __frm), char()); |
lib/libcxx/include/__log_hardening_failure+2| ... | @@ -24,7 +24,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -24,7 +24,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | ||
| 25 | // This function should never be called directly from the code -- it should only be called through the | 25 | // This function should never be called directly from the code -- it should only be called through the |
| 26 | // `_LIBCPP_LOG_HARDENING_FAILURE` macro. | 26 | // `_LIBCPP_LOG_HARDENING_FAILURE` macro. |
| 27 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 27 | [[__gnu__::__cold__]] _LIBCPP_EXPORTED_FROM_ABI void __log_hardening_failure(const char* __message) noexcept; | 28 | [[__gnu__::__cold__]] _LIBCPP_EXPORTED_FROM_ABI void __log_hardening_failure(const char* __message) noexcept; |
| 29 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 28 | 30 | ||
| 29 | // _LIBCPP_LOG_HARDENING_FAILURE(message) | 31 | // _LIBCPP_LOG_HARDENING_FAILURE(message) |
| 30 | // | 32 | // |
lib/libcxx/include/__math/abs.h+13| ... | @@ -63,6 +63,19 @@ template <class = int> | ... | @@ -63,6 +63,19 @@ template <class = int> |
| 63 | return __builtin_llabs(__x); | 63 | return __builtin_llabs(__x); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | #if _LIBCPP_HAS_INT128 | ||
| 67 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI inline __int128_t abs(__int128_t __x) _NOEXCEPT { return __x < 0 ? -__x : __x; } | ||
| 68 | #endif | ||
| 69 | |||
| 70 | #if defined(__BITINT_MAXWIDTH__) | ||
| 71 | // _BitInt does not integer-promote, so without a same-type overload a narrow | ||
| 72 | // signed _BitInt would be an ambiguous call against abs(int/long/long long). | ||
| 73 | template <int _Np> | ||
| 74 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _BitInt(_Np) abs(_BitInt(_Np) __x) _NOEXCEPT { | ||
| 75 | return __x < 0 ? -__x : __x; | ||
| 76 | } | ||
| 77 | #endif | ||
| 78 | |||
| 66 | } // namespace __math | 79 | } // namespace __math |
| 67 | 80 | ||
| 68 | _LIBCPP_END_NAMESPACE_STD | 81 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__math/gamma.h+28| ... | @@ -55,6 +55,34 @@ inline _LIBCPP_HIDE_FROM_ABI double tgamma(_A1 __x) _NOEXCEPT { | ... | @@ -55,6 +55,34 @@ inline _LIBCPP_HIDE_FROM_ABI double tgamma(_A1 __x) _NOEXCEPT { |
| 55 | return __builtin_tgamma((double)__x); | 55 | return __builtin_tgamma((double)__x); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | // __lgamma_r | ||
| 59 | // | ||
| 60 | // POSIX systems provide a function named lgamma_r which is a reentrant version of lgamma. Use that | ||
| 61 | // whenever possible. However, we avoid re-declaring the actual function since different platforms | ||
| 62 | // declare it differently in the first place: instead use `asm` to get the compiler to call the right | ||
| 63 | // function. | ||
| 64 | |||
| 65 | #if defined(_LIBCPP_MSVCRT_LIKE) // reentrant version is not available on Windows | ||
| 66 | |||
| 67 | inline _LIBCPP_HIDE_FROM_ABI double __lgamma_r(double __d) _NOEXCEPT { return __builtin_lgamma(__d); } | ||
| 68 | |||
| 69 | #else | ||
| 70 | |||
| 71 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 72 | # if defined(_LIBCPP_OBJECT_FORMAT_MACHO) | ||
| 73 | double __lgamma_r_shim(double, int*) _NOEXCEPT __asm__("_lgamma_r"); | ||
| 74 | # else | ||
| 75 | double __lgamma_r_shim(double, int*) _NOEXCEPT __asm__("lgamma_r"); | ||
| 76 | # endif | ||
| 77 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 78 | |||
| 79 | inline _LIBCPP_HIDE_FROM_ABI double __lgamma_r(double __d) _NOEXCEPT { | ||
| 80 | int __sign; | ||
| 81 | return __math::__lgamma_r_shim(__d, &__sign); | ||
| 82 | } | ||
| 83 | |||
| 84 | #endif | ||
| 85 | |||
| 58 | } // namespace __math | 86 | } // namespace __math |
| 59 | 87 | ||
| 60 | _LIBCPP_END_NAMESPACE_STD | 88 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__math/special_functions.h+5-5| ... | @@ -21,10 +21,10 @@ | ... | @@ -21,10 +21,10 @@ |
| 21 | # pragma GCC system_header | 21 | # pragma GCC system_header |
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | #if _LIBCPP_STD_VER >= 17 | 24 | #if _LIBCPP_STD_VER >= 17 |
| 27 | 25 | ||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 27 | |||
| 28 | template <class _Real> | 28 | template <class _Real> |
| 29 | _LIBCPP_HIDE_FROM_ABI _Real __hermite(unsigned __n, _Real __x) { | 29 | _LIBCPP_HIDE_FROM_ABI _Real __hermite(unsigned __n, _Real __x) { |
| 30 | // The Hermite polynomial H_n(x). | 30 | // The Hermite polynomial H_n(x). |
| ... | @@ -49,7 +49,7 @@ _LIBCPP_HIDE_FROM_ABI _Real __hermite(unsigned __n, _Real __x) { | ... | @@ -49,7 +49,7 @@ _LIBCPP_HIDE_FROM_ABI _Real __hermite(unsigned __n, _Real __x) { |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | if (!__math::isfinite(__H_n)) { | 51 | if (!__math::isfinite(__H_n)) { |
| 52 | // Overflow occured. Two possible cases: | 52 | // Overflow occurred. Two possible cases: |
| 53 | // n is odd: return infinity of the same sign as x. | 53 | // n is odd: return infinity of the same sign as x. |
| 54 | // n is even: return +Inf | 54 | // n is even: return +Inf |
| 55 | _Real __inf = std::numeric_limits<_Real>::infinity(); | 55 | _Real __inf = std::numeric_limits<_Real>::infinity(); |
| ... | @@ -77,8 +77,8 @@ _LIBCPP_HIDE_FROM_ABI double hermite(unsigned __n, _Integer __x) { | ... | @@ -77,8 +77,8 @@ _LIBCPP_HIDE_FROM_ABI double hermite(unsigned __n, _Integer __x) { |
| 77 | return std::hermite(__n, static_cast<double>(__x)); | 77 | return std::hermite(__n, static_cast<double>(__x)); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 81 | |||
| 82 | _LIBCPP_END_NAMESPACE_STD | 80 | _LIBCPP_END_NAMESPACE_STD |
| 83 | 81 | ||
| 82 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 83 | |||
| 84 | #endif // _LIBCPP___MATH_SPECIAL_FUNCTIONS_H | 84 | #endif // _LIBCPP___MATH_SPECIAL_FUNCTIONS_H |
lib/libcxx/include/__mbstate_t.h+4| ... | @@ -39,10 +39,14 @@ | ... | @@ -39,10 +39,14 @@ |
| 39 | # define __NEED_mbstate_t | 39 | # define __NEED_mbstate_t |
| 40 | # include <bits/alltypes.h> | 40 | # include <bits/alltypes.h> |
| 41 | # undef __NEED_mbstate_t | 41 | # undef __NEED_mbstate_t |
| 42 | #elif _LIBCPP_LIBC_LLVM_LIBC | ||
| 43 | # include <llvm-libc-types/mbstate_t.h> | ||
| 42 | #elif __has_include(<bits/types/mbstate_t.h>) | 44 | #elif __has_include(<bits/types/mbstate_t.h>) |
| 43 | # include <bits/types/mbstate_t.h> // works on most Unixes | 45 | # include <bits/types/mbstate_t.h> // works on most Unixes |
| 44 | #elif __has_include(<sys/_types/_mbstate_t.h>) | 46 | #elif __has_include(<sys/_types/_mbstate_t.h>) |
| 45 | # include <sys/_types/_mbstate_t.h> // works on Darwin | 47 | # include <sys/_types/_mbstate_t.h> // works on Darwin |
| 48 | #elif __has_include(<bits/mbstate_t.h>) | ||
| 49 | # include <bits/mbstate_t.h> // works for Android | ||
| 46 | #elif __has_include_next(<wchar.h>) | 50 | #elif __has_include_next(<wchar.h>) |
| 47 | # include_next <wchar.h> // use the C standard provider of mbstate_t if present | 51 | # include_next <wchar.h> // use the C standard provider of mbstate_t if present |
| 48 | #elif __has_include_next(<uchar.h>) | 52 | #elif __has_include_next(<uchar.h>) |
lib/libcxx/include/__mdspan/aligned_accessor.h+4-4| ... | @@ -33,10 +33,10 @@ | ... | @@ -33,10 +33,10 @@ |
| 33 | _LIBCPP_PUSH_MACROS | 33 | _LIBCPP_PUSH_MACROS |
| 34 | #include <__undef_macros> | 34 | #include <__undef_macros> |
| 35 | 35 | ||
| 36 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 37 | |||
| 38 | #if _LIBCPP_STD_VER >= 26 | 36 | #if _LIBCPP_STD_VER >= 26 |
| 39 | 37 | ||
| 38 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 39 | |||
| 40 | template <class _ElementType, size_t _ByteAlignment> | 40 | template <class _ElementType, size_t _ByteAlignment> |
| 41 | struct aligned_accessor { | 41 | struct aligned_accessor { |
| 42 | static_assert(_ByteAlignment != 0 && (_ByteAlignment & (_ByteAlignment - 1)) == 0, | 42 | static_assert(_ByteAlignment != 0 && (_ByteAlignment & (_ByteAlignment - 1)) == 0, |
| ... | @@ -78,10 +78,10 @@ struct aligned_accessor { | ... | @@ -78,10 +78,10 @@ struct aligned_accessor { |
| 78 | } | 78 | } |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | #endif // _LIBCPP_STD_VER >= 26 | ||
| 82 | |||
| 83 | _LIBCPP_END_NAMESPACE_STD | 81 | _LIBCPP_END_NAMESPACE_STD |
| 84 | 82 | ||
| 83 | #endif // _LIBCPP_STD_VER >= 26 | ||
| 84 | |||
| 85 | _LIBCPP_POP_MACROS | 85 | _LIBCPP_POP_MACROS |
| 86 | 86 | ||
| 87 | #endif // _LIBCPP___MDSPAN_ALIGNED_ACCESSOR_H | 87 | #endif // _LIBCPP___MDSPAN_ALIGNED_ACCESSOR_H |
lib/libcxx/include/__mdspan/extents.h+76-81| ... | @@ -21,12 +21,16 @@ | ... | @@ -21,12 +21,16 @@ |
| 21 | #include <__config> | 21 | #include <__config> |
| 22 | 22 | ||
| 23 | #include <__concepts/arithmetic.h> | 23 | #include <__concepts/arithmetic.h> |
| 24 | #include <__concepts/same_as.h> | ||
| 24 | #include <__type_traits/common_type.h> | 25 | #include <__type_traits/common_type.h> |
| 25 | #include <__type_traits/integer_traits.h> | 26 | #include <__type_traits/integer_traits.h> |
| 26 | #include <__type_traits/is_convertible.h> | 27 | #include <__type_traits/is_convertible.h> |
| 27 | #include <__type_traits/is_nothrow_constructible.h> | 28 | #include <__type_traits/is_nothrow_constructible.h> |
| 28 | #include <__type_traits/is_signed.h> | 29 | #include <__type_traits/is_signed.h> |
| 29 | #include <__type_traits/make_unsigned.h> | 30 | #include <__type_traits/make_unsigned.h> |
| 31 | #include <__type_traits/remove_cvref.h> | ||
| 32 | #include <__utility/as_const.h> | ||
| 33 | #include <__utility/forward.h> | ||
| 30 | #include <__utility/integer_sequence.h> | 34 | #include <__utility/integer_sequence.h> |
| 31 | #include <__utility/unreachable.h> | 35 | #include <__utility/unreachable.h> |
| 32 | #include <array> | 36 | #include <array> |
| ... | @@ -46,25 +50,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -46,25 +50,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 46 | #if _LIBCPP_STD_VER >= 23 | 50 | #if _LIBCPP_STD_VER >= 23 |
| 47 | 51 | ||
| 48 | namespace __mdspan_detail { | 52 | namespace __mdspan_detail { |
| 49 | |||
| 50 | // ------------------------------------------------------------------ | ||
| 51 | // ------------ __static_array -------------------------------------- | ||
| 52 | // ------------------------------------------------------------------ | ||
| 53 | // array like class which provides an array of static values with get | ||
| 54 | template <class _Tp, _Tp... _Values> | ||
| 55 | struct __static_array { | ||
| 56 | static constexpr array<_Tp, sizeof...(_Values)> __array = {_Values...}; | ||
| 57 | |||
| 58 | public: | ||
| 59 | _LIBCPP_HIDE_FROM_ABI static constexpr size_t __size() { return sizeof...(_Values); } | ||
| 60 | _LIBCPP_HIDE_FROM_ABI static constexpr _Tp __get(size_t __index) noexcept { return __array[__index]; } | ||
| 61 | |||
| 62 | template <size_t _Index> | ||
| 63 | _LIBCPP_HIDE_FROM_ABI static constexpr _Tp __get() { | ||
| 64 | return __get(_Index); | ||
| 65 | } | ||
| 66 | }; | ||
| 67 | |||
| 68 | // ------------------------------------------------------------------ | 53 | // ------------------------------------------------------------------ |
| 69 | // ------------ __possibly_empty_array ----------------------------- | 54 | // ------------ __possibly_empty_array ----------------------------- |
| 70 | // ------------------------------------------------------------------ | 55 | // ------------------------------------------------------------------ |
| ... | @@ -117,35 +102,28 @@ struct __static_partial_sums { | ... | @@ -117,35 +102,28 @@ struct __static_partial_sums { |
| 117 | // array like class which has a mix of static and runtime values but | 102 | // array like class which has a mix of static and runtime values but |
| 118 | // only stores the runtime values. | 103 | // only stores the runtime values. |
| 119 | // The type of the static and the runtime values can be different. | 104 | // The type of the static and the runtime values can be different. |
| 120 | // The position of a dynamic value is indicated through a tag value. | 105 | // The position of a dynamic value is indicated by dynamic_extent. |
| 121 | template <class _TDynamic, class _TStatic, _TStatic _DynTag, _TStatic... _Values> | 106 | template <class _TDynamic, class _TStatic, _TStatic... _Values> |
| 122 | struct __maybe_static_array { | 107 | struct __maybe_static_array { |
| 123 | static_assert(is_convertible<_TStatic, _TDynamic>::value, | 108 | static_assert(is_convertible_v<_TStatic, _TDynamic>, |
| 124 | "__maybe_static_array: _TStatic must be convertible to _TDynamic"); | 109 | "__maybe_static_array: _TStatic must be convertible to _TDynamic"); |
| 125 | static_assert(is_convertible<_TDynamic, _TStatic>::value, | 110 | static_assert(is_convertible_v<_TDynamic, _TStatic>, |
| 126 | "__maybe_static_array: _TDynamic must be convertible to _TStatic"); | 111 | "__maybe_static_array: _TDynamic must be convertible to _TStatic"); |
| 127 | 112 | ||
| 128 | private: | 113 | private: |
| 129 | // Static values member | 114 | // Static values member |
| 130 | static constexpr size_t __size_ = sizeof...(_Values); | 115 | static constexpr size_t __size_ = sizeof...(_Values); |
| 131 | static constexpr size_t __size_dynamic_ = ((_Values == _DynTag) + ... + 0); | 116 | static constexpr size_t __size_dynamic_ = ((_Values == dynamic_extent) + ... + 0); |
| 132 | using _StaticValues _LIBCPP_NODEBUG = __static_array<_TStatic, _Values...>; | ||
| 133 | using _DynamicValues _LIBCPP_NODEBUG = __possibly_empty_array<_TDynamic, __size_dynamic_>; | 117 | using _DynamicValues _LIBCPP_NODEBUG = __possibly_empty_array<_TDynamic, __size_dynamic_>; |
| 134 | 118 | ||
| 135 | // Dynamic values member | 119 | static constexpr array<_TStatic, sizeof...(_Values)> __static_values_ = {_Values...}; |
| 136 | _LIBCPP_NO_UNIQUE_ADDRESS _DynamicValues __dyn_vals_; | 120 | _LIBCPP_NO_UNIQUE_ADDRESS _DynamicValues __dyn_vals_; |
| 137 | 121 | ||
| 138 | // static mapping of indices to the position in the dynamic values array | 122 | // static mapping of indices to the position in the dynamic values array |
| 139 | using _DynamicIdxMap _LIBCPP_NODEBUG = __static_partial_sums<static_cast<size_t>(_Values == _DynTag)...>; | 123 | using _DynamicIdxMap _LIBCPP_NODEBUG = __static_partial_sums<static_cast<size_t>(_Values == dynamic_extent)...>; |
| 140 | |||
| 141 | template <size_t... _Indices> | ||
| 142 | _LIBCPP_HIDE_FROM_ABI static constexpr _DynamicValues __zeros(index_sequence<_Indices...>) noexcept { | ||
| 143 | return _DynamicValues{((void)_Indices, 0)...}; | ||
| 144 | } | ||
| 145 | 124 | ||
| 146 | public: | 125 | public: |
| 147 | _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array() noexcept | 126 | _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array() noexcept : __dyn_vals_{} {} |
| 148 | : __dyn_vals_{__zeros(make_index_sequence<__size_dynamic_>())} {} | ||
| 149 | 127 | ||
| 150 | // constructors from dynamic values only -- this covers the case for rank() == 0 | 128 | // constructors from dynamic values only -- this covers the case for rank() == 0 |
| 151 | template <class... _DynVals> | 129 | template <class... _DynVals> |
| ... | @@ -169,8 +147,8 @@ public: | ... | @@ -169,8 +147,8 @@ public: |
| 169 | static_assert(sizeof...(_DynVals) == __size_, "Invalid number of values."); | 147 | static_assert(sizeof...(_DynVals) == __size_, "Invalid number of values."); |
| 170 | _TDynamic __values[__size_] = {static_cast<_TDynamic>(__vals)...}; | 148 | _TDynamic __values[__size_] = {static_cast<_TDynamic>(__vals)...}; |
| 171 | for (size_t __i = 0; __i < __size_; __i++) { | 149 | for (size_t __i = 0; __i < __size_; __i++) { |
| 172 | _TStatic __static_val = _StaticValues::__get(__i); | 150 | _TStatic __static_val = __static_values_[__i]; |
| 173 | if (__static_val == _DynTag) { | 151 | if (__static_val == dynamic_extent) { |
| 174 | __dyn_vals_[_DynamicIdxMap::__get(__i)] = __values[__i]; | 152 | __dyn_vals_[_DynamicIdxMap::__get(__i)] = __values[__i]; |
| 175 | } else | 153 | } else |
| 176 | // Not catching this could lead to out of bounds errors later | 154 | // Not catching this could lead to out of bounds errors later |
| ... | @@ -188,8 +166,8 @@ public: | ... | @@ -188,8 +166,8 @@ public: |
| 188 | _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array(const span<_Tp, _Size>& __vals) { | 166 | _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array(const span<_Tp, _Size>& __vals) { |
| 189 | static_assert(_Size == __size_ || __size_ == dynamic_extent); | 167 | static_assert(_Size == __size_ || __size_ == dynamic_extent); |
| 190 | for (size_t __i = 0; __i < __size_; __i++) { | 168 | for (size_t __i = 0; __i < __size_; __i++) { |
| 191 | _TStatic __static_val = _StaticValues::__get(__i); | 169 | _TStatic __static_val = __static_values_[__i]; |
| 192 | if (__static_val == _DynTag) { | 170 | if (__static_val == dynamic_extent) { |
| 193 | __dyn_vals_[_DynamicIdxMap::__get(__i)] = static_cast<_TDynamic>(__vals[__i]); | 171 | __dyn_vals_[_DynamicIdxMap::__get(__i)] = static_cast<_TDynamic>(__vals[__i]); |
| 194 | } else | 172 | } else |
| 195 | // Not catching this could lead to out of bounds errors later | 173 | // Not catching this could lead to out of bounds errors later |
| ... | @@ -205,13 +183,15 @@ public: | ... | @@ -205,13 +183,15 @@ public: |
| 205 | // access functions | 183 | // access functions |
| 206 | _LIBCPP_HIDE_FROM_ABI static constexpr _TStatic __static_value(size_t __i) noexcept { | 184 | _LIBCPP_HIDE_FROM_ABI static constexpr _TStatic __static_value(size_t __i) noexcept { |
| 207 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank"); | 185 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank"); |
| 208 | return _StaticValues::__get(__i); | 186 | return __static_values_[__i]; |
| 209 | } | 187 | } |
| 210 | 188 | ||
| 211 | _LIBCPP_HIDE_FROM_ABI constexpr _TDynamic __value(size_t __i) const { | 189 | _LIBCPP_HIDE_FROM_ABI constexpr _TDynamic __value(size_t __i) const { |
| 212 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank"); | 190 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank"); |
| 213 | _TStatic __static_val = _StaticValues::__get(__i); | 191 | _TStatic __static_val = __static_values_[__i]; |
| 214 | return __static_val == _DynTag ? __dyn_vals_[_DynamicIdxMap::__get(__i)] : static_cast<_TDynamic>(__static_val); | 192 | return __static_val == dynamic_extent |
| 193 | ? __dyn_vals_[_DynamicIdxMap::__get(__i)] | ||
| 194 | : static_cast<_TDynamic>(__static_val); | ||
| 215 | } | 195 | } |
| 216 | _LIBCPP_HIDE_FROM_ABI constexpr _TDynamic operator[](size_t __i) const { | 196 | _LIBCPP_HIDE_FROM_ABI constexpr _TDynamic operator[](size_t __i) const { |
| 217 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank"); | 197 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank"); |
| ... | @@ -252,19 +232,6 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __is_representable_as(_From __value) { | ... | @@ -252,19 +232,6 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __is_representable_as(_From __value) { |
| 252 | return true; | 232 | return true; |
| 253 | } | 233 | } |
| 254 | 234 | ||
| 255 | template <integral _To, class... _From> | ||
| 256 | _LIBCPP_HIDE_FROM_ABI constexpr bool __are_representable_as(_From... __values) { | ||
| 257 | return (__mdspan_detail::__is_representable_as<_To>(__values) && ... && true); | ||
| 258 | } | ||
| 259 | |||
| 260 | template <integral _To, class _From, size_t _Size> | ||
| 261 | _LIBCPP_HIDE_FROM_ABI constexpr bool __are_representable_as(span<_From, _Size> __values) { | ||
| 262 | for (size_t __i = 0; __i < _Size; __i++) | ||
| 263 | if (!__mdspan_detail::__is_representable_as<_To>(__values[__i])) | ||
| 264 | return false; | ||
| 265 | return true; | ||
| 266 | } | ||
| 267 | |||
| 268 | } // namespace __mdspan_detail | 235 | } // namespace __mdspan_detail |
| 269 | 236 | ||
| 270 | // ------------------------------------------------------------------ | 237 | // ------------------------------------------------------------------ |
| ... | @@ -293,10 +260,45 @@ private: | ... | @@ -293,10 +260,45 @@ private: |
| 293 | static constexpr rank_type __rank_dynamic_ = ((_Extents == dynamic_extent) + ... + 0); | 260 | static constexpr rank_type __rank_dynamic_ = ((_Extents == dynamic_extent) + ... + 0); |
| 294 | 261 | ||
| 295 | // internal storage type using __maybe_static_array | 262 | // internal storage type using __maybe_static_array |
| 296 | using _Values _LIBCPP_NODEBUG = | 263 | using _Values _LIBCPP_NODEBUG = __mdspan_detail::__maybe_static_array<_IndexType, size_t, _Extents...>; |
| 297 | __mdspan_detail::__maybe_static_array<_IndexType, size_t, dynamic_extent, _Extents...>; | ||
| 298 | [[no_unique_address]] _Values __vals_; | 264 | [[no_unique_address]] _Values __vals_; |
| 299 | 265 | ||
| 266 | template <class _OtherIndexType> | ||
| 267 | _LIBCPP_HIDE_FROM_ABI static constexpr index_type __checked_index_cast(_OtherIndexType&& __value) noexcept { | ||
| 268 | using _OtherType = remove_cvref_t<_OtherIndexType>; | ||
| 269 | if constexpr (integral<_OtherType> && !same_as<_OtherType, bool>) { | ||
| 270 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 271 | __mdspan_detail::__is_representable_as<index_type>(__value), | ||
| 272 | "extents ctor: arguments must be representable as index_type and nonnegative"); | ||
| 273 | return static_cast<index_type>(__value); | ||
| 274 | } else { | ||
| 275 | auto __converted_val = static_cast<index_type>(std::forward<_OtherIndexType>(__value)); | ||
| 276 | if constexpr (is_signed_v<index_type>) { | ||
| 277 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 278 | __converted_val >= 0, "extents ctor: arguments must be representable as index_type and nonnegative"); | ||
| 279 | } | ||
| 280 | return __converted_val; | ||
| 281 | } | ||
| 282 | } | ||
| 283 | |||
| 284 | template <class... _OtherIndexTypes> | ||
| 285 | _LIBCPP_HIDE_FROM_ABI static constexpr _Values | ||
| 286 | __representability_checked_cast(_OtherIndexTypes&&... __values) noexcept { | ||
| 287 | return _Values{__checked_index_cast(std::forward<_OtherIndexTypes>(__values))...}; | ||
| 288 | } | ||
| 289 | |||
| 290 | template <class _OtherIndexType, size_t _Size, size_t... _Idxs> | ||
| 291 | _LIBCPP_HIDE_FROM_ABI static constexpr _Values | ||
| 292 | __representability_checked_cast(const array<_OtherIndexType, _Size>& __exts, index_sequence<_Idxs...>) noexcept { | ||
| 293 | return __representability_checked_cast(__exts[_Idxs]...); | ||
| 294 | } | ||
| 295 | |||
| 296 | template <class _OtherIndexType, size_t _Size, size_t... _Idxs> | ||
| 297 | _LIBCPP_HIDE_FROM_ABI static constexpr _Values | ||
| 298 | __representability_checked_cast(const span<_OtherIndexType, _Size>& __exts, index_sequence<_Idxs...>) noexcept { | ||
| 299 | return __representability_checked_cast(std::as_const(__exts[_Idxs])...); | ||
| 300 | } | ||
| 301 | |||
| 300 | public: | 302 | public: |
| 301 | // [mdspan.extents.obs], observers of multidimensional index space | 303 | // [mdspan.extents.obs], observers of multidimensional index space |
| 302 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return __rank_; } | 304 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return __rank_; } |
| ... | @@ -319,12 +321,9 @@ public: | ... | @@ -319,12 +321,9 @@ public: |
| 319 | (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) && | 321 | (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) && |
| 320 | (sizeof...(_OtherIndexTypes) == __rank_ || sizeof...(_OtherIndexTypes) == __rank_dynamic_)) | 322 | (sizeof...(_OtherIndexTypes) == __rank_ || sizeof...(_OtherIndexTypes) == __rank_dynamic_)) |
| 321 | _LIBCPP_HIDE_FROM_ABI constexpr explicit extents(_OtherIndexTypes... __dynvals) noexcept | 323 | _LIBCPP_HIDE_FROM_ABI constexpr explicit extents(_OtherIndexTypes... __dynvals) noexcept |
| 322 | : __vals_(static_cast<index_type>(__dynvals)...) { | 324 | // Not catching this could lead to out of bounds errors later |
| 323 | // Not catching this could lead to out of bounds errors later | 325 | // e.g. mdspan m(ptr, dextents<char, 1>(200u)); leads to an extent of -56 on m |
| 324 | // e.g. mdspan m(ptr, dextents<char, 1>(200u)); leads to an extent of -56 on m | 326 | : __vals_(__representability_checked_cast(std::move(__dynvals)...)) {} |
| 325 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as<index_type>(__dynvals...), | ||
| 326 | "extents ctor: arguments must be representable as index_type and nonnegative"); | ||
| 327 | } | ||
| 328 | 327 | ||
| 329 | template <class _OtherIndexType, size_t _Size> | 328 | template <class _OtherIndexType, size_t _Size> |
| 330 | requires(is_convertible_v<const _OtherIndexType&, index_type> && | 329 | requires(is_convertible_v<const _OtherIndexType&, index_type> && |
| ... | @@ -332,12 +331,9 @@ public: | ... | @@ -332,12 +331,9 @@ public: |
| 332 | (_Size == __rank_ || _Size == __rank_dynamic_)) | 331 | (_Size == __rank_ || _Size == __rank_dynamic_)) |
| 333 | explicit(_Size != __rank_dynamic_) | 332 | explicit(_Size != __rank_dynamic_) |
| 334 | _LIBCPP_HIDE_FROM_ABI constexpr extents(const array<_OtherIndexType, _Size>& __exts) noexcept | 333 | _LIBCPP_HIDE_FROM_ABI constexpr extents(const array<_OtherIndexType, _Size>& __exts) noexcept |
| 335 | : __vals_(span(__exts)) { | 334 | // Not catching this could lead to out of bounds errors later |
| 336 | // Not catching this could lead to out of bounds errors later | 335 | // e.g. mdspan m(ptr, dextents<char, 1>(200u)); leads to an extent of -56 on m |
| 337 | // e.g. mdspan m(ptr, dextents<char, 1>(array<unsigned,1>(200))); leads to an extent of -56 on m | 336 | : __vals_(__representability_checked_cast(__exts, make_index_sequence<_Size>())) {} |
| 338 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as<index_type>(span(__exts)), | ||
| 339 | "extents ctor: arguments must be representable as index_type and nonnegative"); | ||
| 340 | } | ||
| 341 | 337 | ||
| 342 | template <class _OtherIndexType, size_t _Size> | 338 | template <class _OtherIndexType, size_t _Size> |
| 343 | requires(is_convertible_v<const _OtherIndexType&, index_type> && | 339 | requires(is_convertible_v<const _OtherIndexType&, index_type> && |
| ... | @@ -345,13 +341,9 @@ public: | ... | @@ -345,13 +341,9 @@ public: |
| 345 | (_Size == __rank_ || _Size == __rank_dynamic_)) | 341 | (_Size == __rank_ || _Size == __rank_dynamic_)) |
| 346 | explicit(_Size != __rank_dynamic_) | 342 | explicit(_Size != __rank_dynamic_) |
| 347 | _LIBCPP_HIDE_FROM_ABI constexpr extents(const span<_OtherIndexType, _Size>& __exts) noexcept | 343 | _LIBCPP_HIDE_FROM_ABI constexpr extents(const span<_OtherIndexType, _Size>& __exts) noexcept |
| 348 | : __vals_(__exts) { | 344 | // Not catching this could lead to out of bounds errors later |
| 349 | // Not catching this could lead to out of bounds errors later | 345 | // e.g. mdspan m(ptr, dextents<char, 1>(200u)); leads to an extent of -56 on m |
| 350 | // e.g. array a{200u}; mdspan<int, dextents<char,1>> m(ptr, extents(span<unsigned,1>(a))); leads to an extent of -56 | 346 | : __vals_(__representability_checked_cast(__exts, make_index_sequence<_Size>())) {} |
| 351 | // on m | ||
| 352 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as<index_type>(__exts), | ||
| 353 | "extents ctor: arguments must be representable as index_type and nonnegative"); | ||
| 354 | } | ||
| 355 | 347 | ||
| 356 | private: | 348 | private: |
| 357 | // Function to construct extents storage from other extents. | 349 | // Function to construct extents storage from other extents. |
| ... | @@ -433,6 +425,15 @@ public: | ... | @@ -433,6 +425,15 @@ public: |
| 433 | } | 425 | } |
| 434 | return true; | 426 | return true; |
| 435 | } | 427 | } |
| 428 | |||
| 429 | template <class _OtherIndexType> | ||
| 430 | _LIBCPP_HIDE_FROM_ABI static constexpr auto __index_cast(_OtherIndexType&& __i) noexcept { | ||
| 431 | using _OtherIndex = remove_cvref_t<_OtherIndexType>; | ||
| 432 | if constexpr (integral<_OtherIndex> && !same_as<_OtherIndex, bool>) | ||
| 433 | return __i; | ||
| 434 | else | ||
| 435 | return static_cast<index_type>(std::forward<_OtherIndexType>(__i)); | ||
| 436 | } | ||
| 436 | }; | 437 | }; |
| 437 | 438 | ||
| 438 | // Recursive helper classes to implement dextents alias for extents | 439 | // Recursive helper classes to implement dextents alias for extents |
| ... | @@ -465,15 +466,9 @@ using dims = dextents<_IndexType, _Rank>; | ... | @@ -465,15 +466,9 @@ using dims = dextents<_IndexType, _Rank>; |
| 465 | # endif | 466 | # endif |
| 466 | 467 | ||
| 467 | // Deduction guide for extents | 468 | // Deduction guide for extents |
| 468 | # if _LIBCPP_STD_VER >= 26 | ||
| 469 | template <class... _IndexTypes> | 469 | template <class... _IndexTypes> |
| 470 | requires(is_convertible_v<_IndexTypes, size_t> && ...) | 470 | requires(is_convertible_v<_IndexTypes, size_t> && ...) |
| 471 | explicit extents(_IndexTypes...) -> extents<size_t, __maybe_static_ext<_IndexTypes>...>; | 471 | explicit extents(_IndexTypes...) -> extents<size_t, __maybe_static_ext<_IndexTypes>...>; |
| 472 | # else | ||
| 473 | template <class... _IndexTypes> | ||
| 474 | requires(is_convertible_v<_IndexTypes, size_t> && ...) | ||
| 475 | explicit extents(_IndexTypes...) -> extents<size_t, size_t(((void)sizeof(_IndexTypes), dynamic_extent))...>; | ||
| 476 | # endif | ||
| 477 | 472 | ||
| 478 | namespace __mdspan_detail { | 473 | namespace __mdspan_detail { |
| 479 | 474 |
lib/libcxx/include/__mdspan/layout_left.h+3-3| ... | @@ -47,9 +47,9 @@ public: | ... | @@ -47,9 +47,9 @@ public: |
| 47 | "layout_left::mapping template argument must be a specialization of extents."); | 47 | "layout_left::mapping template argument must be a specialization of extents."); |
| 48 | 48 | ||
| 49 | using extents_type = _Extents; | 49 | using extents_type = _Extents; |
| 50 | using index_type = typename extents_type::index_type; | 50 | using index_type = extents_type::index_type; |
| 51 | using size_type = typename extents_type::size_type; | 51 | using size_type = extents_type::size_type; |
| 52 | using rank_type = typename extents_type::rank_type; | 52 | using rank_type = extents_type::rank_type; |
| 53 | using layout_type = layout_left; | 53 | using layout_type = layout_left; |
| 54 | 54 | ||
| 55 | private: | 55 | private: |
lib/libcxx/include/__mdspan/layout_right.h+3-3| ... | @@ -47,9 +47,9 @@ public: | ... | @@ -47,9 +47,9 @@ public: |
| 47 | "layout_right::mapping template argument must be a specialization of extents."); | 47 | "layout_right::mapping template argument must be a specialization of extents."); |
| 48 | 48 | ||
| 49 | using extents_type = _Extents; | 49 | using extents_type = _Extents; |
| 50 | using index_type = typename extents_type::index_type; | 50 | using index_type = extents_type::index_type; |
| 51 | using size_type = typename extents_type::size_type; | 51 | using size_type = extents_type::size_type; |
| 52 | using rank_type = typename extents_type::rank_type; | 52 | using rank_type = extents_type::rank_type; |
| 53 | using layout_type = layout_right; | 53 | using layout_type = layout_right; |
| 54 | 54 | ||
| 55 | private: | 55 | private: |
lib/libcxx/include/__mdspan/layout_stride.h+18-30| ... | @@ -72,9 +72,9 @@ public: | ... | @@ -72,9 +72,9 @@ public: |
| 72 | "layout_stride::mapping template argument must be a specialization of extents."); | 72 | "layout_stride::mapping template argument must be a specialization of extents."); |
| 73 | 73 | ||
| 74 | using extents_type = _Extents; | 74 | using extents_type = _Extents; |
| 75 | using index_type = typename extents_type::index_type; | 75 | using index_type = extents_type::index_type; |
| 76 | using size_type = typename extents_type::size_type; | 76 | using size_type = extents_type::size_type; |
| 77 | using rank_type = typename extents_type::rank_type; | 77 | using rank_type = extents_type::rank_type; |
| 78 | using layout_type = layout_stride; | 78 | using layout_type = layout_stride; |
| 79 | 79 | ||
| 80 | private: | 80 | private: |
| ... | @@ -296,38 +296,26 @@ public: | ... | @@ -296,38 +296,26 @@ public: |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_unique() noexcept { return true; } | 298 | _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_unique() noexcept { return true; } |
| 299 | _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_exhaustive() noexcept { return false; } | 299 | _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_exhaustive() noexcept { |
| 300 | if constexpr (__rank_ == 0) | ||
| 301 | return true; | ||
| 302 | for (size_t __r = 0; __r < __rank_; ++__r) | ||
| 303 | if (extents_type::static_extent(__r) == 0) | ||
| 304 | return true; | ||
| 305 | return false; | ||
| 306 | } | ||
| 300 | _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_strided() noexcept { return true; } | 307 | _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_strided() noexcept { return true; } |
| 301 | 308 | ||
| 302 | _LIBCPP_HIDE_FROM_ABI static constexpr bool is_unique() noexcept { return true; } | 309 | _LIBCPP_HIDE_FROM_ABI static constexpr bool is_unique() noexcept { return true; } |
| 303 | // The answer of this function is fairly complex in the case where one or more | ||
| 304 | // extents are zero. | ||
| 305 | // Technically it is meaningless to query is_exhaustive() in that case, but unfortunately | ||
| 306 | // the way the standard defines this function, we can't give a simple true or false then. | ||
| 307 | _LIBCPP_HIDE_FROM_ABI constexpr bool is_exhaustive() const noexcept { | 310 | _LIBCPP_HIDE_FROM_ABI constexpr bool is_exhaustive() const noexcept { |
| 308 | if constexpr (__rank_ == 0) | 311 | if constexpr (is_always_exhaustive()) |
| 309 | return true; | 312 | return true; |
| 310 | else { | 313 | index_type __span_size = required_span_size(); |
| 311 | index_type __span_size = required_span_size(); | 314 | if (__span_size == static_cast<index_type>(0)) |
| 312 | if (__span_size == static_cast<index_type>(0)) { | 315 | return true; |
| 313 | if constexpr (__rank_ == 1) | 316 | return __span_size == [&]<size_t... _Pos>(index_sequence<_Pos...>) { |
| 314 | return __strides_[0] == 1; | 317 | return (__extents_.extent(_Pos) * ... * static_cast<index_type>(1)); |
| 315 | else { | 318 | }(make_index_sequence<__rank_>()); |
| 316 | rank_type __r_largest = 0; | ||
| 317 | for (rank_type __r = 1; __r < __rank_; __r++) | ||
| 318 | if (__strides_[__r] > __strides_[__r_largest]) | ||
| 319 | __r_largest = __r; | ||
| 320 | for (rank_type __r = 0; __r < __rank_; __r++) | ||
| 321 | if (__extents_.extent(__r) == 0 && __r != __r_largest) | ||
| 322 | return false; | ||
| 323 | return true; | ||
| 324 | } | ||
| 325 | } else { | ||
| 326 | return required_span_size() == [&]<size_t... _Pos>(index_sequence<_Pos...>) { | ||
| 327 | return (__extents_.extent(_Pos) * ... * static_cast<index_type>(1)); | ||
| 328 | }(make_index_sequence<__rank_>()); | ||
| 329 | } | ||
| 330 | } | ||
| 331 | } | 319 | } |
| 332 | _LIBCPP_HIDE_FROM_ABI static constexpr bool is_strided() noexcept { return true; } | 320 | _LIBCPP_HIDE_FROM_ABI static constexpr bool is_strided() noexcept { return true; } |
| 333 | 321 |
lib/libcxx/include/__mdspan/mdspan.h+55-21| ... | @@ -30,6 +30,7 @@ | ... | @@ -30,6 +30,7 @@ |
| 30 | #include <__type_traits/is_constructible.h> | 30 | #include <__type_traits/is_constructible.h> |
| 31 | #include <__type_traits/is_convertible.h> | 31 | #include <__type_traits/is_convertible.h> |
| 32 | #include <__type_traits/is_nothrow_constructible.h> | 32 | #include <__type_traits/is_nothrow_constructible.h> |
| 33 | #include <__type_traits/is_object.h> | ||
| 33 | #include <__type_traits/is_pointer.h> | 34 | #include <__type_traits/is_pointer.h> |
| 34 | #include <__type_traits/is_same.h> | 35 | #include <__type_traits/is_same.h> |
| 35 | #include <__type_traits/rank.h> | 36 | #include <__type_traits/rank.h> |
| ... | @@ -37,9 +38,11 @@ | ... | @@ -37,9 +38,11 @@ |
| 37 | #include <__type_traits/remove_cv.h> | 38 | #include <__type_traits/remove_cv.h> |
| 38 | #include <__type_traits/remove_pointer.h> | 39 | #include <__type_traits/remove_pointer.h> |
| 39 | #include <__type_traits/remove_reference.h> | 40 | #include <__type_traits/remove_reference.h> |
| 41 | #include <__utility/as_const.h> | ||
| 40 | #include <__utility/integer_sequence.h> | 42 | #include <__utility/integer_sequence.h> |
| 41 | #include <array> | 43 | #include <array> |
| 42 | #include <span> | 44 | #include <span> |
| 45 | #include <stdexcept> | ||
| 43 | 46 | ||
| 44 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 47 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 45 | # pragma GCC system_header | 48 | # pragma GCC system_header |
| ... | @@ -66,6 +69,9 @@ class mdspan { | ... | @@ -66,6 +69,9 @@ class mdspan { |
| 66 | private: | 69 | private: |
| 67 | static_assert(__mdspan_detail::__is_extents_v<_Extents>, | 70 | static_assert(__mdspan_detail::__is_extents_v<_Extents>, |
| 68 | "mdspan: Extents template parameter must be a specialization of extents."); | 71 | "mdspan: Extents template parameter must be a specialization of extents."); |
| 72 | static_assert( | ||
| 73 | is_object_v<_ElementType> && requires { sizeof(_ElementType); }, | ||
| 74 | "mdspan: ElementType template parameter must be a complete object type"); | ||
| 69 | static_assert(!is_array_v<_ElementType>, "mdspan: ElementType template parameter may not be an array type"); | 75 | static_assert(!is_array_v<_ElementType>, "mdspan: ElementType template parameter may not be an array type"); |
| 70 | static_assert(!is_abstract_v<_ElementType>, "mdspan: ElementType template parameter may not be an abstract class"); | 76 | static_assert(!is_abstract_v<_ElementType>, "mdspan: ElementType template parameter may not be an abstract class"); |
| 71 | static_assert(is_same_v<_ElementType, typename _AccessorPolicy::element_type>, | 77 | static_assert(is_same_v<_ElementType, typename _AccessorPolicy::element_type>, |
| ... | @@ -78,14 +84,14 @@ public: | ... | @@ -78,14 +84,14 @@ public: |
| 78 | using extents_type = _Extents; | 84 | using extents_type = _Extents; |
| 79 | using layout_type = _LayoutPolicy; | 85 | using layout_type = _LayoutPolicy; |
| 80 | using accessor_type = _AccessorPolicy; | 86 | using accessor_type = _AccessorPolicy; |
| 81 | using mapping_type = typename layout_type::template mapping<extents_type>; | 87 | using mapping_type = layout_type::template mapping<extents_type>; |
| 82 | using element_type = _ElementType; | 88 | using element_type = _ElementType; |
| 83 | using value_type = remove_cv_t<element_type>; | 89 | using value_type = remove_cv_t<element_type>; |
| 84 | using index_type = typename extents_type::index_type; | 90 | using index_type = extents_type::index_type; |
| 85 | using size_type = typename extents_type::size_type; | 91 | using size_type = extents_type::size_type; |
| 86 | using rank_type = typename extents_type::rank_type; | 92 | using rank_type = extents_type::rank_type; |
| 87 | using data_handle_type = typename accessor_type::data_handle_type; | 93 | using data_handle_type = accessor_type::data_handle_type; |
| 88 | using reference = typename accessor_type::reference; | 94 | using reference = accessor_type::reference; |
| 89 | 95 | ||
| 90 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return extents_type::rank(); } | 96 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return extents_type::rank(); } |
| 91 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank_dynamic() noexcept { | 97 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank_dynamic() noexcept { |
| ... | @@ -187,11 +193,11 @@ public: | ... | @@ -187,11 +193,11 @@ public: |
| 187 | (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) && | 193 | (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) && |
| 188 | (sizeof...(_OtherIndexTypes) == rank())) | 194 | (sizeof...(_OtherIndexTypes) == rank())) |
| 189 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](_OtherIndexTypes... __indices) const { | 195 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](_OtherIndexTypes... __indices) const { |
| 190 | // Note the standard layouts would also check this, but user provided ones may not, so we | 196 | return [&]<class... _IndexTypes>(_IndexTypes... __idxs) -> reference { |
| 191 | // check the precondition here | 197 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__is_multidimensional_index_in(extents(), __idxs...), |
| 192 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__is_multidimensional_index_in(extents(), __indices...), | 198 | "mdspan: operator[] out of bounds access"); |
| 193 | "mdspan: operator[] out of bounds access"); | 199 | return __acc_.access(__ptr_, __map_(static_cast<index_type>(std::move(__idxs))...)); |
| 194 | return __acc_.access(__ptr_, __map_(static_cast<index_type>(std::move(__indices))...)); | 200 | }(extents_type::__index_cast(std::move(__indices))...); |
| 195 | } | 201 | } |
| 196 | 202 | ||
| 197 | template <class _OtherIndexType> | 203 | template <class _OtherIndexType> |
| ... | @@ -200,7 +206,7 @@ public: | ... | @@ -200,7 +206,7 @@ public: |
| 200 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference | 206 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference |
| 201 | operator[](const array< _OtherIndexType, rank()>& __indices) const { | 207 | operator[](const array< _OtherIndexType, rank()>& __indices) const { |
| 202 | return __acc_.access(__ptr_, [&]<size_t... _Idxs>(index_sequence<_Idxs...>) { | 208 | return __acc_.access(__ptr_, [&]<size_t... _Idxs>(index_sequence<_Idxs...>) { |
| 203 | return __map_(__indices[_Idxs]...); | 209 | return __map_(extents_type::__index_cast(__indices[_Idxs])...); |
| 204 | }(make_index_sequence<rank()>())); | 210 | }(make_index_sequence<rank()>())); |
| 205 | } | 211 | } |
| 206 | 212 | ||
| ... | @@ -209,10 +215,41 @@ public: | ... | @@ -209,10 +215,41 @@ public: |
| 209 | is_nothrow_constructible_v<index_type, const _OtherIndexType&>) | 215 | is_nothrow_constructible_v<index_type, const _OtherIndexType&>) |
| 210 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](span<_OtherIndexType, rank()> __indices) const { | 216 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](span<_OtherIndexType, rank()> __indices) const { |
| 211 | return __acc_.access(__ptr_, [&]<size_t... _Idxs>(index_sequence<_Idxs...>) { | 217 | return __acc_.access(__ptr_, [&]<size_t... _Idxs>(index_sequence<_Idxs...>) { |
| 212 | return __map_(__indices[_Idxs]...); | 218 | return __map_(extents_type::__index_cast(__indices[_Idxs])...); |
| 213 | }(make_index_sequence<rank()>())); | 219 | }(make_index_sequence<rank()>())); |
| 214 | } | 220 | } |
| 215 | 221 | ||
| 222 | # if _LIBCPP_STD_VER >= 26 | ||
| 223 | template <class... _OtherIndexTypes> | ||
| 224 | requires((is_convertible_v<_OtherIndexTypes, index_type> && ...) && | ||
| 225 | (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) && | ||
| 226 | (sizeof...(_OtherIndexTypes) == rank())) | ||
| 227 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference at(_OtherIndexTypes... __indices) const { | ||
| 228 | if (!__mdspan_detail::__is_multidimensional_index_in(__map_.extents(), __indices...)) { | ||
| 229 | __throw_out_of_range(); | ||
| 230 | } | ||
| 231 | return (*this)[extents_type::__index_cast(std::move(__indices))...]; | ||
| 232 | } | ||
| 233 | |||
| 234 | template <class _OtherIndexType> | ||
| 235 | requires(is_convertible_v<const _OtherIndexType&, index_type> && | ||
| 236 | is_nothrow_constructible_v<index_type, const _OtherIndexType&>) | ||
| 237 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference at(const array<_OtherIndexType, rank()>& __indices) const { | ||
| 238 | return [&]<size_t... _Idxs>(index_sequence<_Idxs...>) -> reference { | ||
| 239 | return at(extents_type::__index_cast(__indices[_Idxs])...); | ||
| 240 | }(make_index_sequence<rank()>()); | ||
| 241 | } | ||
| 242 | |||
| 243 | template <class _OtherIndexType> | ||
| 244 | requires(is_convertible_v<const _OtherIndexType&, index_type> && | ||
| 245 | is_nothrow_constructible_v<index_type, const _OtherIndexType&>) | ||
| 246 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference at(span<_OtherIndexType, rank()> __indices) const { | ||
| 247 | return [&]<size_t... _Idxs>(index_sequence<_Idxs...>) -> reference { | ||
| 248 | return at(extents_type::__index_cast(std::as_const(__indices[_Idxs]))...); | ||
| 249 | }(make_index_sequence<rank()>()); | ||
| 250 | } | ||
| 251 | # endif | ||
| 252 | |||
| 216 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { | 253 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { |
| 217 | // Could leave this as only checked in debug mode: semantically size() is never | 254 | // Could leave this as only checked in debug mode: semantically size() is never |
| 218 | // guaranteed to be related to any accessible range | 255 | // guaranteed to be related to any accessible range |
| ... | @@ -269,19 +306,16 @@ private: | ... | @@ -269,19 +306,16 @@ private: |
| 269 | 306 | ||
| 270 | template <class, class, class, class> | 307 | template <class, class, class, class> |
| 271 | friend class mdspan; | 308 | friend class mdspan; |
| 272 | }; | ||
| 273 | 309 | ||
| 274 | # if _LIBCPP_STD_VER >= 26 | 310 | # if _LIBCPP_STD_VER >= 26 |
| 311 | _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("mdspan"); } | ||
| 312 | # endif | ||
| 313 | }; | ||
| 314 | |||
| 275 | template <class _ElementType, class... _OtherIndexTypes> | 315 | template <class _ElementType, class... _OtherIndexTypes> |
| 276 | requires((is_convertible_v<_OtherIndexTypes, size_t> && ...) && (sizeof...(_OtherIndexTypes) > 0)) | 316 | requires((is_convertible_v<_OtherIndexTypes, size_t> && ...) && (sizeof...(_OtherIndexTypes) > 0)) |
| 277 | explicit mdspan(_ElementType*, _OtherIndexTypes...) | 317 | explicit mdspan(_ElementType*, _OtherIndexTypes...) |
| 278 | -> mdspan<_ElementType, extents<size_t, __maybe_static_ext<_OtherIndexTypes>...>>; | 318 | -> mdspan<_ElementType, extents<size_t, __maybe_static_ext<_OtherIndexTypes>...>>; |
| 279 | # else | ||
| 280 | template <class _ElementType, class... _OtherIndexTypes> | ||
| 281 | requires((is_convertible_v<_OtherIndexTypes, size_t> && ...) && (sizeof...(_OtherIndexTypes) > 0)) | ||
| 282 | explicit mdspan(_ElementType*, _OtherIndexTypes...) | ||
| 283 | -> mdspan<_ElementType, dextents<size_t, sizeof...(_OtherIndexTypes)>>; | ||
| 284 | # endif | ||
| 285 | 319 | ||
| 286 | template <class _Pointer> | 320 | template <class _Pointer> |
| 287 | requires(is_pointer_v<remove_reference_t<_Pointer>>) | 321 | requires(is_pointer_v<remove_reference_t<_Pointer>>) |
| ... | @@ -309,7 +343,7 @@ mdspan(_ElementType*, const _MappingType&) | ... | @@ -309,7 +343,7 @@ mdspan(_ElementType*, const _MappingType&) |
| 309 | -> mdspan<_ElementType, typename _MappingType::extents_type, typename _MappingType::layout_type>; | 343 | -> mdspan<_ElementType, typename _MappingType::extents_type, typename _MappingType::layout_type>; |
| 310 | 344 | ||
| 311 | template <class _MappingType, class _AccessorType> | 345 | template <class _MappingType, class _AccessorType> |
| 312 | mdspan(const typename _AccessorType::data_handle_type, const _MappingType&, const _AccessorType&) | 346 | mdspan(typename _AccessorType::data_handle_type, const _MappingType&, const _AccessorType&) |
| 313 | -> mdspan<typename _AccessorType::element_type, | 347 | -> mdspan<typename _AccessorType::element_type, |
| 314 | typename _MappingType::extents_type, | 348 | typename _MappingType::extents_type, |
| 315 | typename _MappingType::layout_type, | 349 | typename _MappingType::layout_type, |
lib/libcxx/include/__memory/aligned_alloc.h deleted-63| ... | @@ -1,63 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___MEMORY_ALIGNED_ALLOC_H | ||
| 10 | #define _LIBCPP___MEMORY_ALIGNED_ALLOC_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <cstdlib> | ||
| 14 | |||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 16 | # pragma GCC system_header | ||
| 17 | #endif | ||
| 18 | |||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | #if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION | ||
| 22 | |||
| 23 | // Low-level helpers to call the aligned allocation and deallocation functions | ||
| 24 | // on the target platform. This is used to implement libc++'s own memory | ||
| 25 | // allocation routines -- if you need to allocate memory inside the library, | ||
| 26 | // chances are that you want to use `__libcpp_allocate` instead. | ||
| 27 | // | ||
| 28 | // Returns the allocated memory, or `nullptr` on failure. | ||
| 29 | inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) { | ||
| 30 | # if defined(_LIBCPP_MSVCRT_LIKE) | ||
| 31 | return ::_aligned_malloc(__size, __alignment); | ||
| 32 | # elif _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_C11_ALIGNED_ALLOC | ||
| 33 | // aligned_alloc() requires that __size is a multiple of __alignment, | ||
| 34 | // but for C++ [new.delete.general], only states "if the value of an | ||
| 35 | // alignment argument passed to any of these functions is not a valid | ||
| 36 | // alignment value, the behavior is undefined". | ||
| 37 | // To handle calls such as ::operator new(1, std::align_val_t(128)), we | ||
| 38 | // round __size up to the next multiple of __alignment. | ||
| 39 | size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1); | ||
| 40 | // Rounding up could have wrapped around to zero, so we have to add another | ||
| 41 | // max() ternary to the actual call site to avoid succeeded in that case. | ||
| 42 | return ::aligned_alloc(__alignment, __size > __rounded_size ? __size : __rounded_size); | ||
| 43 | # else | ||
| 44 | void* __result = nullptr; | ||
| 45 | (void)::posix_memalign(&__result, __alignment, __size); | ||
| 46 | // If posix_memalign fails, __result is unmodified so we still return `nullptr`. | ||
| 47 | return __result; | ||
| 48 | # endif | ||
| 49 | } | ||
| 50 | |||
| 51 | inline _LIBCPP_HIDE_FROM_ABI void __libcpp_aligned_free(void* __ptr) { | ||
| 52 | # if defined(_LIBCPP_MSVCRT_LIKE) | ||
| 53 | ::_aligned_free(__ptr); | ||
| 54 | # else | ||
| 55 | ::free(__ptr); | ||
| 56 | # endif | ||
| 57 | } | ||
| 58 | |||
| 59 | #endif // _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION | ||
| 60 | |||
| 61 | _LIBCPP_END_NAMESPACE_STD | ||
| 62 | |||
| 63 | #endif // _LIBCPP___MEMORY_ALIGNED_ALLOC_H | ||
lib/libcxx/include/__memory/allocator_traits.h+61-1| ... | @@ -11,6 +11,7 @@ | ... | @@ -11,6 +11,7 @@ |
| 11 | #define _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H | 11 | #define _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H |
| 12 | 12 | ||
| 13 | #include <__config> | 13 | #include <__config> |
| 14 | #include <__cstddef/ptrdiff_t.h> | ||
| 14 | #include <__cstddef/size_t.h> | 15 | #include <__cstddef/size_t.h> |
| 15 | #include <__fwd/memory.h> | 16 | #include <__fwd/memory.h> |
| 16 | #include <__memory/construct_at.h> | 17 | #include <__memory/construct_at.h> |
| ... | @@ -223,8 +224,13 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(allocation_result); | ... | @@ -223,8 +224,13 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(allocation_result); |
| 223 | 224 | ||
| 224 | #endif // _LIBCPP_STD_VER | 225 | #endif // _LIBCPP_STD_VER |
| 225 | 226 | ||
| 227 | template <class> | ||
| 228 | struct allocator_traits; | ||
| 229 | |||
| 230 | // We have a base class that can be specialized for different allocators, since the metaprogramming to get the aliases | ||
| 231 | // is quite expensive and the definition of these aliases is usually quite trivial in the end. | ||
| 226 | template <class _Alloc> | 232 | template <class _Alloc> |
| 227 | struct allocator_traits { | 233 | struct __allocator_traits_base { |
| 228 | using allocator_type = _Alloc; | 234 | using allocator_type = _Alloc; |
| 229 | using value_type = typename allocator_type::value_type; | 235 | using value_type = typename allocator_type::value_type; |
| 230 | using pointer = __pointer<value_type, allocator_type>; | 236 | using pointer = __pointer<value_type, allocator_type>; |
| ... | @@ -253,6 +259,60 @@ struct allocator_traits { | ... | @@ -253,6 +259,60 @@ struct allocator_traits { |
| 253 | using other = allocator_traits<typename rebind_alloc<_Tp>::other>; | 259 | using other = allocator_traits<typename rebind_alloc<_Tp>::other>; |
| 254 | }; | 260 | }; |
| 255 | #endif // _LIBCPP_CXX03_LANG | 261 | #endif // _LIBCPP_CXX03_LANG |
| 262 | }; | ||
| 263 | |||
| 264 | template <class _Tp> | ||
| 265 | struct __allocator_traits_base<allocator<_Tp> > { | ||
| 266 | using allocator_type = allocator<_Tp>; | ||
| 267 | using value_type = _Tp; | ||
| 268 | using pointer = _Tp*; | ||
| 269 | using const_pointer = const _Tp*; | ||
| 270 | using void_pointer = void*; | ||
| 271 | using const_void_pointer = const void*; | ||
| 272 | using difference_type = ptrdiff_t; | ||
| 273 | using size_type = size_t; | ||
| 274 | using propagate_on_container_copy_assignment = false_type; | ||
| 275 | using propagate_on_container_move_assignment = true_type; | ||
| 276 | using propagate_on_container_swap = false_type; | ||
| 277 | using is_always_equal = true_type; | ||
| 278 | |||
| 279 | #ifndef _LIBCPP_CXX03_LANG | ||
| 280 | template <class _Up> | ||
| 281 | using rebind_alloc = allocator<_Up>; | ||
| 282 | template <class _Up> | ||
| 283 | using rebind_traits = allocator_traits<allocator<_Up> >; | ||
| 284 | #else | ||
| 285 | template <class _Up> | ||
| 286 | struct rebind_alloc { | ||
| 287 | using other = allocator<_Up>; | ||
| 288 | }; | ||
| 289 | template <class _Up> | ||
| 290 | struct rebind_traits { | ||
| 291 | using other = allocator_traits<allocator<_Up> >; | ||
| 292 | }; | ||
| 293 | #endif | ||
| 294 | }; | ||
| 295 | |||
| 296 | template <class _Alloc> | ||
| 297 | struct allocator_traits : __allocator_traits_base<_Alloc> { | ||
| 298 | using __base _LIBCPP_NODEBUG = __allocator_traits_base<_Alloc>; | ||
| 299 | |||
| 300 | using allocator_type = typename __base::allocator_type; | ||
| 301 | using value_type = typename __base::value_type; | ||
| 302 | using pointer = typename __base::pointer; | ||
| 303 | using const_pointer = typename __base::const_pointer; | ||
| 304 | using void_pointer = typename __base::void_pointer; | ||
| 305 | using const_void_pointer = typename __base::const_void_pointer; | ||
| 306 | using difference_type = typename __base::difference_type; | ||
| 307 | using size_type = typename __base::size_type; | ||
| 308 | using propagate_on_container_copy_assignment = typename __base::propagate_on_container_copy_assignment; | ||
| 309 | using propagate_on_container_move_assignment = typename __base::propagate_on_container_move_assignment; | ||
| 310 | using is_always_equal = typename __base::is_always_equal; | ||
| 311 | |||
| 312 | template <class _Tp> | ||
| 313 | using rebind_alloc = typename __base::template rebind_alloc<_Tp>; | ||
| 314 | template <class _Tp> | ||
| 315 | using rebind_traits = typename __base::template rebind_traits<_Tp>; | ||
| 256 | 316 | ||
| 257 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer | 317 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer |
| 258 | allocate(allocator_type& __a, size_type __n) { | 318 | allocate(allocator_type& __a, size_type __n) { |
lib/libcxx/include/__memory/compressed_pair.h+4-29| ... | @@ -20,8 +20,6 @@ | ... | @@ -20,8 +20,6 @@ |
| 20 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | // ================================================================================================================== // | 23 | // ================================================================================================================== // |
| 26 | // The utilites here are for staying ABI compatible with the legacy `__compressed_pair`. They should not be used // | 24 | // The utilites here are for staying ABI compatible with the legacy `__compressed_pair`. They should not be used // |
| 27 | // for new data structures. Use `_LIBCPP_NO_UNIQUE_ADDRESS` for new data structures instead (but make sure you // | 25 | // for new data structures. Use `_LIBCPP_NO_UNIQUE_ADDRESS` for new data structures instead (but make sure you // |
| ... | @@ -59,6 +57,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -59,6 +57,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 59 | 57 | ||
| 60 | #ifndef _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING | 58 | #ifndef _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING |
| 61 | 59 | ||
| 60 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 61 | |||
| 62 | template <class _Tp> | 62 | template <class _Tp> |
| 63 | inline const size_t __compressed_pair_alignment = _LIBCPP_ALIGNOF(_Tp); | 63 | inline const size_t __compressed_pair_alignment = _LIBCPP_ALIGNOF(_Tp); |
| 64 | 64 | ||
| ... | @@ -94,16 +94,6 @@ class __compressed_pair_padding<_ToPad, true> {}; | ... | @@ -94,16 +94,6 @@ class __compressed_pair_padding<_ToPad, true> {}; |
| 94 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _); \ | 94 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _); \ |
| 95 | _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \ | 95 | _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \ |
| 96 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _) | 96 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _) |
| 97 | |||
| 98 | # define _LIBCPP_COMPRESSED_TRIPLE(T1, Initializer1, T2, Initializer2, T3, Initializer3) \ | ||
| 99 | _LIBCPP_NO_UNIQUE_ADDRESS \ | ||
| 100 | __attribute__((__aligned__(::std::__compressed_pair_alignment<T2>), \ | ||
| 101 | __aligned__(::std::__compressed_pair_alignment<T3>))) T1 Initializer1; \ | ||
| 102 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _); \ | ||
| 103 | _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \ | ||
| 104 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _); \ | ||
| 105 | _LIBCPP_NO_UNIQUE_ADDRESS T3 Initializer3; \ | ||
| 106 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T3> _LIBCPP_CONCAT3(__padding3_, __LINE__, _) | ||
| 107 | # else | 97 | # else |
| 108 | # define _LIBCPP_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \ | 98 | # define _LIBCPP_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \ |
| 109 | struct { \ | 99 | struct { \ |
| ... | @@ -112,31 +102,16 @@ class __compressed_pair_padding<_ToPad, true> {}; | ... | @@ -112,31 +102,16 @@ class __compressed_pair_padding<_ToPad, true> {}; |
| 112 | _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \ | 102 | _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \ |
| 113 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _); \ | 103 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _); \ |
| 114 | } | 104 | } |
| 115 | |||
| 116 | # define _LIBCPP_COMPRESSED_TRIPLE(T1, Initializer1, T2, Initializer2, T3, Initializer3) \ | ||
| 117 | struct { \ | ||
| 118 | _LIBCPP_NO_UNIQUE_ADDRESS T1 Initializer1; \ | ||
| 119 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _); \ | ||
| 120 | _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \ | ||
| 121 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _); \ | ||
| 122 | _LIBCPP_NO_UNIQUE_ADDRESS T3 Initializer3; \ | ||
| 123 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T3> _LIBCPP_CONCAT3(__padding3_, __LINE__, _); \ | ||
| 124 | } | ||
| 125 | # endif | 105 | # endif |
| 126 | 106 | ||
| 107 | _LIBCPP_END_NAMESPACE_STD | ||
| 108 | |||
| 127 | #else | 109 | #else |
| 128 | # define _LIBCPP_COMPRESSED_ELEMENT(T1, Initializer1) _LIBCPP_NO_UNIQUE_ADDRESS T1 Initializer1 | 110 | # define _LIBCPP_COMPRESSED_ELEMENT(T1, Initializer1) _LIBCPP_NO_UNIQUE_ADDRESS T1 Initializer1 |
| 129 | 111 | ||
| 130 | # define _LIBCPP_COMPRESSED_PAIR(T1, Name1, T2, Name2) \ | 112 | # define _LIBCPP_COMPRESSED_PAIR(T1, Name1, T2, Name2) \ |
| 131 | _LIBCPP_NO_UNIQUE_ADDRESS T1 Name1; \ | 113 | _LIBCPP_NO_UNIQUE_ADDRESS T1 Name1; \ |
| 132 | _LIBCPP_NO_UNIQUE_ADDRESS T2 Name2 | 114 | _LIBCPP_NO_UNIQUE_ADDRESS T2 Name2 |
| 133 | |||
| 134 | # define _LIBCPP_COMPRESSED_TRIPLE(T1, Name1, T2, Name2, T3, Name3) \ | ||
| 135 | _LIBCPP_NO_UNIQUE_ADDRESS T1 Name1; \ | ||
| 136 | _LIBCPP_NO_UNIQUE_ADDRESS T2 Name2; \ | ||
| 137 | _LIBCPP_NO_UNIQUE_ADDRESS T3 Name3 | ||
| 138 | #endif // _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING | 115 | #endif // _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING |
| 139 | 116 | ||
| 140 | _LIBCPP_END_NAMESPACE_STD | ||
| 141 | |||
| 142 | #endif // _LIBCPP___MEMORY_COMPRESSED_PAIR_H | 117 | #endif // _LIBCPP___MEMORY_COMPRESSED_PAIR_H |
lib/libcxx/include/__memory/inout_ptr.h+5-6| ... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
| 11 | #define _LIBCPP___INOUT_PTR_H | 11 | #define _LIBCPP___INOUT_PTR_H |
| 12 | 12 | ||
| 13 | #include <__config> | 13 | #include <__config> |
| 14 | #include <__fwd/memory.h> | ||
| 14 | #include <__memory/addressof.h> | 15 | #include <__memory/addressof.h> |
| 15 | #include <__memory/pointer_traits.h> | 16 | #include <__memory/pointer_traits.h> |
| 16 | #include <__memory/shared_ptr.h> | ||
| 17 | #include <__memory/unique_ptr.h> | ||
| 18 | #include <__type_traits/is_pointer.h> | 17 | #include <__type_traits/is_pointer.h> |
| 19 | #include <__type_traits/is_same.h> | 18 | #include <__type_traits/is_same.h> |
| 20 | #include <__type_traits/is_specialization.h> | 19 | #include <__type_traits/is_specialization.h> |
| ... | @@ -30,10 +29,10 @@ | ... | @@ -30,10 +29,10 @@ |
| 30 | _LIBCPP_PUSH_MACROS | 29 | _LIBCPP_PUSH_MACROS |
| 31 | #include <__undef_macros> | 30 | #include <__undef_macros> |
| 32 | 31 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 34 | |||
| 35 | #if _LIBCPP_STD_VER >= 23 | 32 | #if _LIBCPP_STD_VER >= 23 |
| 36 | 33 | ||
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 35 | |||
| 37 | template <class _Smart, class _Pointer, class... _Args> | 36 | template <class _Smart, class _Pointer, class... _Args> |
| 38 | class inout_ptr_t { | 37 | class inout_ptr_t { |
| 39 | static_assert(!__is_specialization_v<_Smart, shared_ptr>, "std::shared_ptr<> is not supported with std::inout_ptr."); | 38 | static_assert(!__is_specialization_v<_Smart, shared_ptr>, "std::shared_ptr<> is not supported with std::inout_ptr."); |
| ... | @@ -101,10 +100,10 @@ template <class _Pointer = void, class _Smart, class... _Args> | ... | @@ -101,10 +100,10 @@ template <class _Pointer = void, class _Smart, class... _Args> |
| 101 | return std::inout_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...); | 100 | return std::inout_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...); |
| 102 | } | 101 | } |
| 103 | 102 | ||
| 104 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 105 | |||
| 106 | _LIBCPP_END_NAMESPACE_STD | 103 | _LIBCPP_END_NAMESPACE_STD |
| 107 | 104 | ||
| 105 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 106 | |||
| 108 | _LIBCPP_POP_MACROS | 107 | _LIBCPP_POP_MACROS |
| 109 | 108 | ||
| 110 | #endif // _LIBCPP___INOUT_PTR_H | 109 | #endif // _LIBCPP___INOUT_PTR_H |
lib/libcxx/include/__memory/is_sufficiently_aligned.h+6-1| ... | @@ -20,11 +20,16 @@ | ... | @@ -20,11 +20,16 @@ |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | ||
| 23 | template <size_t _Alignment, class _Tp> | ||
| 24 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool __is_sufficiently_aligned(_Tp* __ptr) { | ||
| 25 | return reinterpret_cast<uintptr_t>(__ptr) % _Alignment == 0; | ||
| 26 | } | ||
| 27 | |||
| 23 | #if _LIBCPP_STD_VER >= 26 | 28 | #if _LIBCPP_STD_VER >= 26 |
| 24 | 29 | ||
| 25 | template <size_t _Alignment, class _Tp> | 30 | template <size_t _Alignment, class _Tp> |
| 26 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_sufficiently_aligned(_Tp* __ptr) { | 31 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_sufficiently_aligned(_Tp* __ptr) { |
| 27 | return reinterpret_cast<uintptr_t>(__ptr) % _Alignment == 0; | 32 | return std::__is_sufficiently_aligned<_Alignment>(__ptr); |
| 28 | } | 33 | } |
| 29 | 34 | ||
| 30 | #endif // _LIBCPP_STD_VER >= 26 | 35 | #endif // _LIBCPP_STD_VER >= 26 |
lib/libcxx/include/__memory/out_ptr.h+5-6| ... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
| 11 | #define _LIBCPP___OUT_PTR_H | 11 | #define _LIBCPP___OUT_PTR_H |
| 12 | 12 | ||
| 13 | #include <__config> | 13 | #include <__config> |
| 14 | #include <__fwd/memory.h> | ||
| 14 | #include <__memory/addressof.h> | 15 | #include <__memory/addressof.h> |
| 15 | #include <__memory/pointer_traits.h> | 16 | #include <__memory/pointer_traits.h> |
| 16 | #include <__memory/shared_ptr.h> | ||
| 17 | #include <__memory/unique_ptr.h> | ||
| 18 | #include <__type_traits/is_pointer.h> | 17 | #include <__type_traits/is_pointer.h> |
| 19 | #include <__type_traits/is_specialization.h> | 18 | #include <__type_traits/is_specialization.h> |
| 20 | #include <__type_traits/is_void.h> | 19 | #include <__type_traits/is_void.h> |
| ... | @@ -29,10 +28,10 @@ | ... | @@ -29,10 +28,10 @@ |
| 29 | _LIBCPP_PUSH_MACROS | 28 | _LIBCPP_PUSH_MACROS |
| 30 | #include <__undef_macros> | 29 | #include <__undef_macros> |
| 31 | 30 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | |||
| 34 | #if _LIBCPP_STD_VER >= 23 | 31 | #if _LIBCPP_STD_VER >= 23 |
| 35 | 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 34 | |||
| 36 | template <class _Smart, class _Pointer, class... _Args> | 35 | template <class _Smart, class _Pointer, class... _Args> |
| 37 | class out_ptr_t { | 36 | class out_ptr_t { |
| 38 | static_assert(!__is_specialization_v<_Smart, shared_ptr> || sizeof...(_Args) > 0, | 37 | static_assert(!__is_specialization_v<_Smart, shared_ptr> || sizeof...(_Args) > 0, |
| ... | @@ -93,10 +92,10 @@ template <class _Pointer = void, class _Smart, class... _Args> | ... | @@ -93,10 +92,10 @@ template <class _Pointer = void, class _Smart, class... _Args> |
| 93 | return std::out_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...); | 92 | return std::out_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...); |
| 94 | } | 93 | } |
| 95 | 94 | ||
| 96 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 97 | |||
| 98 | _LIBCPP_END_NAMESPACE_STD | 95 | _LIBCPP_END_NAMESPACE_STD |
| 99 | 96 | ||
| 97 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 98 | |||
| 100 | _LIBCPP_POP_MACROS | 99 | _LIBCPP_POP_MACROS |
| 101 | 100 | ||
| 102 | #endif // _LIBCPP___OUT_PTR_H | 101 | #endif // _LIBCPP___OUT_PTR_H |
lib/libcxx/include/__memory/pointer_traits.h+20-35| ... | @@ -14,12 +14,10 @@ | ... | @@ -14,12 +14,10 @@ |
| 14 | #include <__cstddef/ptrdiff_t.h> | 14 | #include <__cstddef/ptrdiff_t.h> |
| 15 | #include <__memory/addressof.h> | 15 | #include <__memory/addressof.h> |
| 16 | #include <__type_traits/conditional.h> | 16 | #include <__type_traits/conditional.h> |
| 17 | #include <__type_traits/conjunction.h> | ||
| 18 | #include <__type_traits/decay.h> | 17 | #include <__type_traits/decay.h> |
| 19 | #include <__type_traits/detected_or.h> | 18 | #include <__type_traits/detected_or.h> |
| 20 | #include <__type_traits/enable_if.h> | 19 | #include <__type_traits/enable_if.h> |
| 21 | #include <__type_traits/integral_constant.h> | 20 | #include <__type_traits/integral_constant.h> |
| 22 | #include <__type_traits/is_class.h> | ||
| 23 | #include <__type_traits/is_function.h> | 21 | #include <__type_traits/is_function.h> |
| 24 | #include <__type_traits/is_void.h> | 22 | #include <__type_traits/is_void.h> |
| 25 | #include <__type_traits/nat.h> | 23 | #include <__type_traits/nat.h> |
| ... | @@ -139,9 +137,6 @@ using __rebind_pointer_t _LIBCPP_NODEBUG = typename pointer_traits<_From>::templ | ... | @@ -139,9 +137,6 @@ using __rebind_pointer_t _LIBCPP_NODEBUG = typename pointer_traits<_From>::templ |
| 139 | 137 | ||
| 140 | // to_address | 138 | // to_address |
| 141 | 139 | ||
| 142 | template <class _Pointer, class = void> | ||
| 143 | struct __to_address_helper; | ||
| 144 | |||
| 145 | template <class _Tp> | 140 | template <class _Tp> |
| 146 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __to_address(_Tp* __p) _NOEXCEPT { | 141 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __to_address(_Tp* __p) _NOEXCEPT { |
| 147 | static_assert(!is_function<_Tp>::value, "_Tp is a function type"); | 142 | static_assert(!is_function<_Tp>::value, "_Tp is a function type"); |
| ... | @@ -149,48 +144,38 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __to_address(_Tp* __p) _NOEXCEPT { | ... | @@ -149,48 +144,38 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __to_address(_Tp* __p) _NOEXCEPT { |
| 149 | } | 144 | } |
| 150 | 145 | ||
| 151 | template <class _Pointer, class = void> | 146 | template <class _Pointer, class = void> |
| 152 | struct _HasToAddress : false_type {}; | 147 | inline const bool __has_to_address_v = false; |
| 153 | 148 | ||
| 154 | template <class _Pointer> | 149 | template <class _Pointer> |
| 155 | struct _HasToAddress<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>())) > | 150 | inline const bool |
| 156 | : true_type {}; | 151 | __has_to_address_v<_Pointer, |
| 152 | decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> = true; | ||
| 157 | 153 | ||
| 158 | template <class _Pointer, class = void> | 154 | template <class _Pointer, class = void> |
| 159 | struct _HasArrow : false_type {}; | 155 | inline const bool __has_arrow_v = false; |
| 160 | |||
| 161 | template <class _Pointer> | ||
| 162 | struct _HasArrow<_Pointer, decltype((void)std::declval<const _Pointer&>().operator->()) > : true_type {}; | ||
| 163 | 156 | ||
| 164 | template <class _Pointer> | 157 | template <class _Pointer> |
| 165 | struct _IsFancyPointer { | 158 | inline const bool __has_arrow_v<_Pointer, decltype((void)std::declval<const _Pointer&>().operator->()) > = true; |
| 166 | static const bool value = _HasArrow<_Pointer>::value || _HasToAddress<_Pointer>::value; | ||
| 167 | }; | ||
| 168 | 159 | ||
| 169 | // enable_if is needed here to avoid instantiating checks for fancy pointers on raw pointers | 160 | template <class _Pointer, __enable_if_t<__has_to_address_v<_Pointer>, int> = 0> |
| 170 | template <class _Pointer, __enable_if_t< _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value, int> = 0> | 161 | _LIBCPP_CONSTEXPR __decay_t<decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> |
| 171 | _LIBCPP_HIDE_FROM_ABI | ||
| 172 | _LIBCPP_CONSTEXPR __decay_t<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))> | ||
| 173 | __to_address(const _Pointer& __p) _NOEXCEPT { | 162 | __to_address(const _Pointer& __p) _NOEXCEPT { |
| 174 | return __to_address_helper<_Pointer>::__call(__p); | 163 | return pointer_traits<_Pointer>::to_address(__p); |
| 175 | } | 164 | } |
| 176 | 165 | ||
| 177 | template <class _Pointer, class> | 166 | template <class _Pointer> |
| 178 | struct __to_address_helper { | 167 | struct __to_address_arrow_result; |
| 179 | _LIBCPP_HIDE_FROM_ABI | ||
| 180 | _LIBCPP_CONSTEXPR static decltype(std::__to_address(std::declval<const _Pointer&>().operator->())) | ||
| 181 | __call(const _Pointer& __p) _NOEXCEPT { | ||
| 182 | return std::__to_address(__p.operator->()); | ||
| 183 | } | ||
| 184 | }; | ||
| 185 | 168 | ||
| 169 | template <class _Pointer, __enable_if_t<!__has_to_address_v<_Pointer> && __has_arrow_v<_Pointer>, int> = 0> | ||
| 170 | _LIBCPP_CONSTEXPR typename __to_address_arrow_result<_Pointer>::type __to_address(const _Pointer& __p) _NOEXCEPT { | ||
| 171 | return std::__to_address(__p.operator->()); | ||
| 172 | } | ||
| 173 | |||
| 174 | // The return type needs to see all `__to_address` overloads, so this is delayed until after all the overloads have been | ||
| 175 | // defined. This could also be moved to a trailing return type, but that's not available in C++03. | ||
| 186 | template <class _Pointer> | 176 | template <class _Pointer> |
| 187 | struct __to_address_helper<_Pointer, | 177 | struct __to_address_arrow_result { |
| 188 | decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> { | 178 | using type _LIBCPP_NODEBUG = __decay_t<decltype(std::__to_address(std::declval<const _Pointer&>().operator->()))>; |
| 189 | _LIBCPP_HIDE_FROM_ABI | ||
| 190 | _LIBCPP_CONSTEXPR static decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>())) | ||
| 191 | __call(const _Pointer& __p) _NOEXCEPT { | ||
| 192 | return pointer_traits<_Pointer>::to_address(__p); | ||
| 193 | } | ||
| 194 | }; | 179 | }; |
| 195 | 180 | ||
| 196 | #if _LIBCPP_STD_VER >= 20 | 181 | #if _LIBCPP_STD_VER >= 20 |
lib/libcxx/include/__memory/ranges_uninitialized_algorithms.h+29-26| ... | @@ -44,14 +44,16 @@ namespace ranges { | ... | @@ -44,14 +44,16 @@ namespace ranges { |
| 44 | struct __uninitialized_default_construct { | 44 | struct __uninitialized_default_construct { |
| 45 | template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel> | 45 | template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel> |
| 46 | requires default_initializable<iter_value_t<_ForwardIterator>> | 46 | requires default_initializable<iter_value_t<_ForwardIterator>> |
| 47 | _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const { | 47 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 48 | operator()(_ForwardIterator __first, _Sentinel __last) const { | ||
| 48 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; | 49 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; |
| 49 | return std::__uninitialized_default_construct<_ValueType>(std::move(__first), std::move(__last)); | 50 | return std::__uninitialized_default_construct<_ValueType>(std::move(__first), std::move(__last)); |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | template <__nothrow_forward_range _ForwardRange> | 53 | template <__nothrow_forward_range _ForwardRange> |
| 53 | requires default_initializable<range_value_t<_ForwardRange>> | 54 | requires default_initializable<range_value_t<_ForwardRange>> |
| 54 | _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_ForwardRange> operator()(_ForwardRange&& __range) const { | 55 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 borrowed_iterator_t<_ForwardRange> |
| 56 | operator()(_ForwardRange&& __range) const { | ||
| 55 | return (*this)(ranges::begin(__range), ranges::end(__range)); | 57 | return (*this)(ranges::begin(__range), ranges::end(__range)); |
| 56 | } | 58 | } |
| 57 | }; | 59 | }; |
| ... | @@ -65,7 +67,7 @@ inline constexpr auto uninitialized_default_construct = __uninitialized_default_ | ... | @@ -65,7 +67,7 @@ inline constexpr auto uninitialized_default_construct = __uninitialized_default_ |
| 65 | struct __uninitialized_default_construct_n { | 67 | struct __uninitialized_default_construct_n { |
| 66 | template <__nothrow_forward_iterator _ForwardIterator> | 68 | template <__nothrow_forward_iterator _ForwardIterator> |
| 67 | requires default_initializable<iter_value_t<_ForwardIterator>> | 69 | requires default_initializable<iter_value_t<_ForwardIterator>> |
| 68 | _LIBCPP_HIDE_FROM_ABI _ForwardIterator | 70 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 69 | operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const { | 71 | operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const { |
| 70 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; | 72 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; |
| 71 | return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n); | 73 | return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n); |
| ... | @@ -81,14 +83,16 @@ inline constexpr auto uninitialized_default_construct_n = __uninitialized_defaul | ... | @@ -81,14 +83,16 @@ inline constexpr auto uninitialized_default_construct_n = __uninitialized_defaul |
| 81 | struct __uninitialized_value_construct { | 83 | struct __uninitialized_value_construct { |
| 82 | template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel> | 84 | template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel> |
| 83 | requires default_initializable<iter_value_t<_ForwardIterator>> | 85 | requires default_initializable<iter_value_t<_ForwardIterator>> |
| 84 | _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const { | 86 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 87 | operator()(_ForwardIterator __first, _Sentinel __last) const { | ||
| 85 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; | 88 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; |
| 86 | return std::__uninitialized_value_construct<_ValueType>(std::move(__first), std::move(__last)); | 89 | return std::__uninitialized_value_construct<_ValueType>(std::move(__first), std::move(__last)); |
| 87 | } | 90 | } |
| 88 | 91 | ||
| 89 | template <__nothrow_forward_range _ForwardRange> | 92 | template <__nothrow_forward_range _ForwardRange> |
| 90 | requires default_initializable<range_value_t<_ForwardRange>> | 93 | requires default_initializable<range_value_t<_ForwardRange>> |
| 91 | _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_ForwardRange> operator()(_ForwardRange&& __range) const { | 94 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 borrowed_iterator_t<_ForwardRange> |
| 95 | operator()(_ForwardRange&& __range) const { | ||
| 92 | return (*this)(ranges::begin(__range), ranges::end(__range)); | 96 | return (*this)(ranges::begin(__range), ranges::end(__range)); |
| 93 | } | 97 | } |
| 94 | }; | 98 | }; |
| ... | @@ -102,7 +106,7 @@ inline constexpr auto uninitialized_value_construct = __uninitialized_value_cons | ... | @@ -102,7 +106,7 @@ inline constexpr auto uninitialized_value_construct = __uninitialized_value_cons |
| 102 | struct __uninitialized_value_construct_n { | 106 | struct __uninitialized_value_construct_n { |
| 103 | template <__nothrow_forward_iterator _ForwardIterator> | 107 | template <__nothrow_forward_iterator _ForwardIterator> |
| 104 | requires default_initializable<iter_value_t<_ForwardIterator>> | 108 | requires default_initializable<iter_value_t<_ForwardIterator>> |
| 105 | _LIBCPP_HIDE_FROM_ABI _ForwardIterator | 109 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 106 | operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const { | 110 | operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const { |
| 107 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; | 111 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; |
| 108 | return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n); | 112 | return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n); |
| ... | @@ -118,14 +122,16 @@ inline constexpr auto uninitialized_value_construct_n = __uninitialized_value_co | ... | @@ -118,14 +122,16 @@ inline constexpr auto uninitialized_value_construct_n = __uninitialized_value_co |
| 118 | struct __uninitialized_fill { | 122 | struct __uninitialized_fill { |
| 119 | template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel, class _Tp> | 123 | template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel, class _Tp> |
| 120 | requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&> | 124 | requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&> |
| 121 | _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) const { | 125 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 126 | operator()(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) const { | ||
| 122 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; | 127 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; |
| 123 | return std::__uninitialized_fill<_ValueType>(std::move(__first), std::move(__last), __x); | 128 | return std::__uninitialized_fill<_ValueType>(std::move(__first), std::move(__last), __x); |
| 124 | } | 129 | } |
| 125 | 130 | ||
| 126 | template <__nothrow_forward_range _ForwardRange, class _Tp> | 131 | template <__nothrow_forward_range _ForwardRange, class _Tp> |
| 127 | requires constructible_from<range_value_t<_ForwardRange>, const _Tp&> | 132 | requires constructible_from<range_value_t<_ForwardRange>, const _Tp&> |
| 128 | _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_ForwardRange> operator()(_ForwardRange&& __range, const _Tp& __x) const { | 133 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 borrowed_iterator_t<_ForwardRange> |
| 134 | operator()(_ForwardRange&& __range, const _Tp& __x) const { | ||
| 129 | return (*this)(ranges::begin(__range), ranges::end(__range), __x); | 135 | return (*this)(ranges::begin(__range), ranges::end(__range), __x); |
| 130 | } | 136 | } |
| 131 | }; | 137 | }; |
| ... | @@ -139,7 +145,7 @@ inline constexpr auto uninitialized_fill = __uninitialized_fill{}; | ... | @@ -139,7 +145,7 @@ inline constexpr auto uninitialized_fill = __uninitialized_fill{}; |
| 139 | struct __uninitialized_fill_n { | 145 | struct __uninitialized_fill_n { |
| 140 | template <__nothrow_forward_iterator _ForwardIterator, class _Tp> | 146 | template <__nothrow_forward_iterator _ForwardIterator, class _Tp> |
| 141 | requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&> | 147 | requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&> |
| 142 | _LIBCPP_HIDE_FROM_ABI _ForwardIterator | 148 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 143 | operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n, const _Tp& __x) const { | 149 | operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n, const _Tp& __x) const { |
| 144 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; | 150 | using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; |
| 145 | return std::__uninitialized_fill_n<_ValueType>(std::move(__first), __n, __x); | 151 | return std::__uninitialized_fill_n<_ValueType>(std::move(__first), __n, __x); |
| ... | @@ -161,20 +167,20 @@ struct __uninitialized_copy { | ... | @@ -161,20 +167,20 @@ struct __uninitialized_copy { |
| 161 | __nothrow_forward_iterator _OutputIterator, | 167 | __nothrow_forward_iterator _OutputIterator, |
| 162 | __nothrow_sentinel_for<_OutputIterator> _Sentinel2> | 168 | __nothrow_sentinel_for<_OutputIterator> _Sentinel2> |
| 163 | requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>> | 169 | requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>> |
| 164 | _LIBCPP_HIDE_FROM_ABI uninitialized_copy_result<_InputIterator, _OutputIterator> | 170 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 uninitialized_copy_result<_InputIterator, _OutputIterator> |
| 165 | operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const { | 171 | operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const { |
| 166 | using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; | 172 | using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; |
| 167 | 173 | ||
| 168 | auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; | 174 | auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; |
| 169 | auto __result = std::__uninitialized_copy<_ValueType>( | 175 | return std::__uninitialized_copy<_ValueType>( |
| 170 | std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_copying); | 176 | std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_copying); |
| 171 | return {std::move(__result.first), std::move(__result.second)}; | ||
| 172 | } | 177 | } |
| 173 | 178 | ||
| 174 | template <input_range _InputRange, __nothrow_forward_range _OutputRange> | 179 | template <input_range _InputRange, __nothrow_forward_range _OutputRange> |
| 175 | requires constructible_from<range_value_t<_OutputRange>, range_reference_t<_InputRange>> | 180 | requires constructible_from<range_value_t<_OutputRange>, range_reference_t<_InputRange>> |
| 176 | _LIBCPP_HIDE_FROM_ABI uninitialized_copy_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>> | 181 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 177 | operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const { | 182 | uninitialized_copy_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>> |
| 183 | operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const { | ||
| 178 | return (*this)( | 184 | return (*this)( |
| 179 | ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range)); | 185 | ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range)); |
| 180 | } | 186 | } |
| ... | @@ -194,16 +200,14 @@ struct __uninitialized_copy_n { | ... | @@ -194,16 +200,14 @@ struct __uninitialized_copy_n { |
| 194 | __nothrow_forward_iterator _OutputIterator, | 200 | __nothrow_forward_iterator _OutputIterator, |
| 195 | __nothrow_sentinel_for<_OutputIterator> _Sentinel> | 201 | __nothrow_sentinel_for<_OutputIterator> _Sentinel> |
| 196 | requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>> | 202 | requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>> |
| 197 | _LIBCPP_HIDE_FROM_ABI uninitialized_copy_n_result<_InputIterator, _OutputIterator> | 203 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 uninitialized_copy_n_result<_InputIterator, _OutputIterator> |
| 198 | operator()(_InputIterator __ifirst, | 204 | operator()(_InputIterator __ifirst, |
| 199 | iter_difference_t<_InputIterator> __n, | 205 | iter_difference_t<_InputIterator> __n, |
| 200 | _OutputIterator __ofirst, | 206 | _OutputIterator __ofirst, |
| 201 | _Sentinel __olast) const { | 207 | _Sentinel __olast) const { |
| 202 | using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; | 208 | using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; |
| 203 | auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; | 209 | auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; |
| 204 | auto __result = | 210 | return std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __stop_copying); |
| 205 | std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __stop_copying); | ||
| 206 | return {std::move(__result.first), std::move(__result.second)}; | ||
| 207 | } | 211 | } |
| 208 | }; | 212 | }; |
| 209 | 213 | ||
| ... | @@ -222,20 +226,20 @@ struct __uninitialized_move { | ... | @@ -222,20 +226,20 @@ struct __uninitialized_move { |
| 222 | __nothrow_forward_iterator _OutputIterator, | 226 | __nothrow_forward_iterator _OutputIterator, |
| 223 | __nothrow_sentinel_for<_OutputIterator> _Sentinel2> | 227 | __nothrow_sentinel_for<_OutputIterator> _Sentinel2> |
| 224 | requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>> | 228 | requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>> |
| 225 | _LIBCPP_HIDE_FROM_ABI uninitialized_move_result<_InputIterator, _OutputIterator> | 229 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 uninitialized_move_result<_InputIterator, _OutputIterator> |
| 226 | operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const { | 230 | operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const { |
| 227 | using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; | 231 | using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; |
| 228 | auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); }; | 232 | auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); }; |
| 229 | auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; | 233 | auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; |
| 230 | auto __result = std::__uninitialized_move<_ValueType>( | 234 | return std::__uninitialized_move<_ValueType>( |
| 231 | std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_moving, __iter_move); | 235 | std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_moving, __iter_move); |
| 232 | return {std::move(__result.first), std::move(__result.second)}; | ||
| 233 | } | 236 | } |
| 234 | 237 | ||
| 235 | template <input_range _InputRange, __nothrow_forward_range _OutputRange> | 238 | template <input_range _InputRange, __nothrow_forward_range _OutputRange> |
| 236 | requires constructible_from<range_value_t<_OutputRange>, range_rvalue_reference_t<_InputRange>> | 239 | requires constructible_from<range_value_t<_OutputRange>, range_rvalue_reference_t<_InputRange>> |
| 237 | _LIBCPP_HIDE_FROM_ABI uninitialized_move_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>> | 240 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 238 | operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const { | 241 | uninitialized_move_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>> |
| 242 | operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const { | ||
| 239 | return (*this)( | 243 | return (*this)( |
| 240 | ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range)); | 244 | ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range)); |
| 241 | } | 245 | } |
| ... | @@ -255,7 +259,7 @@ struct __uninitialized_move_n { | ... | @@ -255,7 +259,7 @@ struct __uninitialized_move_n { |
| 255 | __nothrow_forward_iterator _OutputIterator, | 259 | __nothrow_forward_iterator _OutputIterator, |
| 256 | __nothrow_sentinel_for<_OutputIterator> _Sentinel> | 260 | __nothrow_sentinel_for<_OutputIterator> _Sentinel> |
| 257 | requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>> | 261 | requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>> |
| 258 | _LIBCPP_HIDE_FROM_ABI uninitialized_move_n_result<_InputIterator, _OutputIterator> | 262 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 uninitialized_move_n_result<_InputIterator, _OutputIterator> |
| 259 | operator()(_InputIterator __ifirst, | 263 | operator()(_InputIterator __ifirst, |
| 260 | iter_difference_t<_InputIterator> __n, | 264 | iter_difference_t<_InputIterator> __n, |
| 261 | _OutputIterator __ofirst, | 265 | _OutputIterator __ofirst, |
| ... | @@ -263,9 +267,8 @@ struct __uninitialized_move_n { | ... | @@ -263,9 +267,8 @@ struct __uninitialized_move_n { |
| 263 | using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; | 267 | using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; |
| 264 | auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); }; | 268 | auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); }; |
| 265 | auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; | 269 | auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; |
| 266 | auto __result = std::__uninitialized_move_n<_ValueType>( | 270 | return std::__uninitialized_move_n<_ValueType>( |
| 267 | std::move(__ifirst), __n, std::move(__ofirst), __stop_moving, __iter_move); | 271 | std::move(__ifirst), __n, std::move(__ofirst), __stop_moving, __iter_move); |
| 268 | return {std::move(__result.first), std::move(__result.second)}; | ||
| 269 | } | 272 | } |
| 270 | }; | 273 | }; |
| 271 | 274 |
lib/libcxx/include/__memory/raw_storage_iterator.h+4-4| ... | @@ -21,13 +21,13 @@ | ... | @@ -21,13 +21,13 @@ |
| 21 | # pragma GCC system_header | 21 | # pragma GCC system_header |
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR) | ||
| 25 | |||
| 24 | _LIBCPP_PUSH_MACROS | 26 | _LIBCPP_PUSH_MACROS |
| 25 | #include <__undef_macros> | 27 | #include <__undef_macros> |
| 26 | 28 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 30 | ||
| 29 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR) | ||
| 30 | |||
| 31 | template <class _OutputIterator, class _Tp> | 31 | template <class _OutputIterator, class _Tp> |
| 32 | class _LIBCPP_DEPRECATED_IN_CXX17 raw_storage_iterator | 32 | class _LIBCPP_DEPRECATED_IN_CXX17 raw_storage_iterator |
| 33 | : public __iterator_base<raw_storage_iterator<_OutputIterator, _Tp>, output_iterator_tag, void, void, void, void> { | 33 | : public __iterator_base<raw_storage_iterator<_OutputIterator, _Tp>, output_iterator_tag, void, void, void, void> { |
| ... | @@ -71,10 +71,10 @@ public: | ... | @@ -71,10 +71,10 @@ public: |
| 71 | # endif | 71 | # endif |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR) | ||
| 75 | |||
| 76 | _LIBCPP_END_NAMESPACE_STD | 74 | _LIBCPP_END_NAMESPACE_STD |
| 77 | 75 | ||
| 78 | _LIBCPP_POP_MACROS | 76 | _LIBCPP_POP_MACROS |
| 79 | 77 | ||
| 78 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR) | ||
| 79 | |||
| 80 | #endif // _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H | 80 | #endif // _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H |
lib/libcxx/include/__memory/shared_count.h+2| ... | @@ -18,6 +18,7 @@ | ... | @@ -18,6 +18,7 @@ |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 21 | 22 | ||
| 22 | // NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively) | 23 | // NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively) |
| 23 | // should be sufficient for thread safety. | 24 | // should be sufficient for thread safety. |
| ... | @@ -111,6 +112,7 @@ private: | ... | @@ -111,6 +112,7 @@ private: |
| 111 | virtual void __on_zero_shared_weak() _NOEXCEPT = 0; | 112 | virtual void __on_zero_shared_weak() _NOEXCEPT = 0; |
| 112 | }; | 113 | }; |
| 113 | 114 | ||
| 115 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 114 | _LIBCPP_END_NAMESPACE_STD | 116 | _LIBCPP_END_NAMESPACE_STD |
| 115 | 117 | ||
| 116 | #endif // _LIBCPP___MEMORY_SHARED_COUNT_H | 118 | #endif // _LIBCPP___MEMORY_SHARED_COUNT_H |
lib/libcxx/include/__memory/shared_ptr.h+209-277| ... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
| 10 | #ifndef _LIBCPP___MEMORY_SHARED_PTR_H | 10 | #ifndef _LIBCPP___MEMORY_SHARED_PTR_H |
| 11 | #define _LIBCPP___MEMORY_SHARED_PTR_H | 11 | #define _LIBCPP___MEMORY_SHARED_PTR_H |
| 12 | 12 | ||
| 13 | #include <__atomic/memory_order.h> | ||
| 13 | #include <__compare/compare_three_way.h> | 14 | #include <__compare/compare_three_way.h> |
| 14 | #include <__compare/ordering.h> | 15 | #include <__compare/ordering.h> |
| 15 | #include <__config> | 16 | #include <__config> |
| ... | @@ -27,19 +28,17 @@ | ... | @@ -27,19 +28,17 @@ |
| 27 | #include <__memory/allocator_destructor.h> | 28 | #include <__memory/allocator_destructor.h> |
| 28 | #include <__memory/allocator_traits.h> | 29 | #include <__memory/allocator_traits.h> |
| 29 | #include <__memory/auto_ptr.h> | 30 | #include <__memory/auto_ptr.h> |
| 30 | #include <__memory/compressed_pair.h> | ||
| 31 | #include <__memory/construct_at.h> | 31 | #include <__memory/construct_at.h> |
| 32 | #include <__memory/destroy.h> | 32 | #include <__memory/destroy.h> |
| 33 | #include <__memory/pointer_traits.h> | 33 | #include <__memory/pointer_traits.h> |
| 34 | #include <__memory/shared_count.h> | 34 | #include <__memory/shared_count.h> |
| 35 | #include <__memory/uninitialized_algorithms.h> | 35 | #include <__memory/uninitialized_algorithms.h> |
| 36 | #include <__memory/uninitialized_multidimensional_algorithms.h> | ||
| 36 | #include <__memory/unique_ptr.h> | 37 | #include <__memory/unique_ptr.h> |
| 37 | #include <__type_traits/add_reference.h> | 38 | #include <__type_traits/add_reference.h> |
| 38 | #include <__type_traits/conditional.h> | 39 | #include <__type_traits/conditional.h> |
| 39 | #include <__type_traits/conjunction.h> | 40 | #include <__type_traits/conjunction.h> |
| 40 | #include <__type_traits/disjunction.h> | ||
| 41 | #include <__type_traits/enable_if.h> | 41 | #include <__type_traits/enable_if.h> |
| 42 | #include <__type_traits/integral_constant.h> | ||
| 43 | #include <__type_traits/is_array.h> | 42 | #include <__type_traits/is_array.h> |
| 44 | #include <__type_traits/is_constructible.h> | 43 | #include <__type_traits/is_constructible.h> |
| 45 | #include <__type_traits/is_convertible.h> | 44 | #include <__type_traits/is_convertible.h> |
| ... | @@ -47,10 +46,11 @@ | ... | @@ -47,10 +46,11 @@ |
| 47 | #include <__type_traits/is_reference.h> | 46 | #include <__type_traits/is_reference.h> |
| 48 | #include <__type_traits/is_same.h> | 47 | #include <__type_traits/is_same.h> |
| 49 | #include <__type_traits/nat.h> | 48 | #include <__type_traits/nat.h> |
| 50 | #include <__type_traits/negation.h> | ||
| 51 | #include <__type_traits/remove_cv.h> | 49 | #include <__type_traits/remove_cv.h> |
| 52 | #include <__type_traits/remove_extent.h> | 50 | #include <__type_traits/remove_extent.h> |
| 51 | #include <__type_traits/remove_pointer.h> | ||
| 53 | #include <__type_traits/remove_reference.h> | 52 | #include <__type_traits/remove_reference.h> |
| 53 | #include <__type_traits/void_t.h> | ||
| 54 | #include <__utility/declval.h> | 54 | #include <__utility/declval.h> |
| 55 | #include <__utility/exception_guard.h> | 55 | #include <__utility/exception_guard.h> |
| 56 | #include <__utility/forward.h> | 56 | #include <__utility/forward.h> |
| ... | @@ -58,9 +58,6 @@ | ... | @@ -58,9 +58,6 @@ |
| 58 | #include <__utility/swap.h> | 58 | #include <__utility/swap.h> |
| 59 | #include <__verbose_abort> | 59 | #include <__verbose_abort> |
| 60 | #include <typeinfo> | 60 | #include <typeinfo> |
| 61 | #if _LIBCPP_HAS_ATOMIC_HEADER | ||
| 62 | # include <__atomic/memory_order.h> | ||
| 63 | #endif | ||
| 64 | 61 | ||
| 65 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 62 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 66 | # pragma GCC system_header | 63 | # pragma GCC system_header |
| ... | @@ -70,6 +67,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -70,6 +67,7 @@ _LIBCPP_PUSH_MACROS |
| 70 | #include <__undef_macros> | 67 | #include <__undef_macros> |
| 71 | 68 | ||
| 72 | _LIBCPP_BEGIN_NAMESPACE_STD | 69 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 70 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 73 | 71 | ||
| 74 | class _LIBCPP_EXPORTED_FROM_ABI bad_weak_ptr : public std::exception { | 72 | class _LIBCPP_EXPORTED_FROM_ABI bad_weak_ptr : public std::exception { |
| 75 | public: | 73 | public: |
| ... | @@ -92,47 +90,36 @@ template <class _Tp> | ... | @@ -92,47 +90,36 @@ template <class _Tp> |
| 92 | class weak_ptr; | 90 | class weak_ptr; |
| 93 | 91 | ||
| 94 | template <class _Tp, class _Dp, class _Alloc> | 92 | template <class _Tp, class _Dp, class _Alloc> |
| 95 | class __shared_ptr_pointer : public __shared_weak_count { | 93 | class _LIBCPP_HIDE_STRUCT_FROM_ABI __shared_ptr_pointer final : public __shared_weak_count { |
| 96 | _LIBCPP_COMPRESSED_TRIPLE(_Tp, __ptr_, _Dp, __deleter_, _Alloc, __alloc_); | 94 | _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_; |
| 95 | _LIBCPP_NO_UNIQUE_ADDRESS _Dp __deleter_; | ||
| 96 | _LIBCPP_NO_UNIQUE_ADDRESS _Tp __ptr_; | ||
| 97 | 97 | ||
| 98 | public: | 98 | public: |
| 99 | _LIBCPP_HIDE_FROM_ABI __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a) | 99 | _LIBCPP_HIDE_FROM_ABI __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a) |
| 100 | : __ptr_(__p), __deleter_(std::move(__d)), __alloc_(std::move(__a)) {} | 100 | : __alloc_(std::move(__a)), __deleter_(std::move(__d)), __ptr_(__p) {} |
| 101 | 101 | ||
| 102 | #if _LIBCPP_HAS_RTTI | 102 | #if _LIBCPP_HAS_RTTI |
| 103 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL const void* __get_deleter(const type_info&) const _NOEXCEPT override; | 103 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL const void* __get_deleter(const type_info& __t) const _NOEXCEPT override { |
| 104 | return __t == typeid(_Dp) ? std::addressof(__deleter_) : nullptr; | ||
| 105 | } | ||
| 104 | #endif | 106 | #endif |
| 105 | 107 | ||
| 106 | private: | 108 | private: |
| 107 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override; | 109 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override { |
| 108 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override; | 110 | __deleter_(__ptr_); |
| 109 | }; | 111 | __ptr_.~_Tp(); |
| 110 | 112 | __deleter_.~_Dp(); | |
| 111 | #if _LIBCPP_HAS_RTTI | 113 | } |
| 112 | |||
| 113 | template <class _Tp, class _Dp, class _Alloc> | ||
| 114 | const void* __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT { | ||
| 115 | return __t == typeid(_Dp) ? std::addressof(__deleter_) : nullptr; | ||
| 116 | } | ||
| 117 | |||
| 118 | #endif // _LIBCPP_HAS_RTTI | ||
| 119 | 114 | ||
| 120 | template <class _Tp, class _Dp, class _Alloc> | 115 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override { |
| 121 | void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared() _NOEXCEPT { | 116 | using __alloc_t = __allocator_traits_rebind_t<_Alloc, __shared_ptr_pointer>; |
| 122 | __deleter_(__ptr_); | ||
| 123 | __deleter_.~_Dp(); | ||
| 124 | } | ||
| 125 | 117 | ||
| 126 | template <class _Tp, class _Dp, class _Alloc> | 118 | __alloc_t __a(__alloc_); |
| 127 | void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT { | 119 | __alloc_.~_Alloc(); |
| 128 | typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al; | 120 | __a.deallocate(pointer_traits<typename allocator_traits<__alloc_t>::pointer>::pointer_to(*this), 1); |
| 129 | typedef allocator_traits<_Al> _ATraits; | 121 | } |
| 130 | typedef pointer_traits<typename _ATraits::pointer> _PTraits; | 122 | }; |
| 131 | |||
| 132 | _Al __a(__alloc_); | ||
| 133 | __alloc_.~_Alloc(); | ||
| 134 | __a.deallocate(_PTraits::pointer_to(*this), 1); | ||
| 135 | } | ||
| 136 | 123 | ||
| 137 | // This tag is used to instantiate an allocator type. The various shared_ptr control blocks | 124 | // This tag is used to instantiate an allocator type. The various shared_ptr control blocks |
| 138 | // detect that the allocator has been instantiated for this type and perform alternative | 125 | // detect that the allocator has been instantiated for this type and perform alternative |
| ... | @@ -140,79 +127,54 @@ void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT { | ... | @@ -140,79 +127,54 @@ void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT { |
| 140 | struct __for_overwrite_tag {}; | 127 | struct __for_overwrite_tag {}; |
| 141 | 128 | ||
| 142 | template <class _Tp, class _Alloc> | 129 | template <class _Tp, class _Alloc> |
| 143 | struct __shared_ptr_emplace : __shared_weak_count { | 130 | struct _LIBCPP_HIDE_STRUCT_FROM_ABI __shared_ptr_emplace : __shared_weak_count { |
| 144 | using __value_type _LIBCPP_NODEBUG = __remove_cv_t<_Tp>; | 131 | using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<_Alloc>; |
| 132 | using __value_type _LIBCPP_NODEBUG = __remove_cv_t<_Tp>; | ||
| 145 | 133 | ||
| 146 | template <class... _Args, | 134 | template <class... _Args> |
| 147 | class _Allocator = _Alloc, | 135 | _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&&... __args) : __alloc_(std::move(__a)) { |
| 148 | __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0> | 136 | allocator_traits<_Alloc>::construct(__alloc_, __get_elem(), std::forward<_Args>(__args)...); |
| 149 | _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&&...) : __storage_(std::move(__a)) { | ||
| 150 | static_assert( | ||
| 151 | sizeof...(_Args) == 0, "No argument should be provided to the control block when using _for_overwrite"); | ||
| 152 | ::new (static_cast<void*>(__get_elem())) __value_type; | ||
| 153 | } | 137 | } |
| 154 | 138 | ||
| 155 | template <class... _Args, | 139 | _LIBCPP_HIDE_FROM_ABI __value_type* __get_elem() _NOEXCEPT { return reinterpret_cast<__value_type*>(__buffer_); } |
| 156 | class _Allocator = _Alloc, | ||
| 157 | __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0> | ||
| 158 | _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&&... __args) : __storage_(std::move(__a)) { | ||
| 159 | using _TpAlloc = typename __allocator_traits_rebind<_Alloc, __value_type>::type; | ||
| 160 | _TpAlloc __tmp(*__get_alloc()); | ||
| 161 | allocator_traits<_TpAlloc>::construct(__tmp, __get_elem(), std::forward<_Args>(__args)...); | ||
| 162 | } | ||
| 163 | |||
| 164 | _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT { return __storage_.__get_alloc(); } | ||
| 165 | |||
| 166 | _LIBCPP_HIDE_FROM_ABI __value_type* __get_elem() _NOEXCEPT { return __storage_.__get_elem(); } | ||
| 167 | 140 | ||
| 168 | private: | 141 | private: |
| 169 | template <class _Allocator = _Alloc, | 142 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override { |
| 170 | __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0> | 143 | allocator_traits<_Alloc>::destroy(__alloc_, __get_elem()); |
| 171 | _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT { | ||
| 172 | __get_elem()->~__value_type(); | ||
| 173 | } | ||
| 174 | |||
| 175 | template <class _Allocator = _Alloc, | ||
| 176 | __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0> | ||
| 177 | _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT { | ||
| 178 | using _TpAlloc = typename __allocator_traits_rebind<_Allocator, __remove_cv_t<_Tp> >::type; | ||
| 179 | _TpAlloc __tmp(*__get_alloc()); | ||
| 180 | allocator_traits<_TpAlloc>::destroy(__tmp, __get_elem()); | ||
| 181 | } | 144 | } |
| 182 | 145 | ||
| 183 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override { __on_zero_shared_impl(); } | ||
| 184 | |||
| 185 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override { | 146 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override { |
| 186 | using _ControlBlockAlloc = typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type; | 147 | using __alloc_t = __allocator_traits_rebind_t<_Alloc, __shared_ptr_emplace>; |
| 187 | using _ControlBlockPointer = typename allocator_traits<_ControlBlockAlloc>::pointer; | 148 | __alloc_t __tmp(__alloc_); |
| 188 | _ControlBlockAlloc __tmp(*__get_alloc()); | 149 | __alloc_.~_Alloc(); |
| 189 | __storage_.~_Storage(); | 150 | allocator_traits<__alloc_t>::deallocate( |
| 190 | allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, pointer_traits<_ControlBlockPointer>::pointer_to(*this), 1); | 151 | __tmp, pointer_traits<typename allocator_traits<__alloc_t>::pointer>::pointer_to(*this), 1); |
| 191 | } | 152 | } |
| 192 | 153 | ||
| 193 | // TODO: It should be possible to refactor this to remove `_Storage` entirely. | 154 | _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_; |
| 194 | // This class implements the control block for non-array shared pointers created | 155 | _ALIGNAS_TYPE(__value_type) char __buffer_[sizeof(__value_type)]; |
| 195 | // through `std::allocate_shared` and `std::make_shared`. | 156 | }; |
| 196 | struct _Storage { | ||
| 197 | struct _Data { | ||
| 198 | _LIBCPP_COMPRESSED_PAIR(_Alloc, __alloc_, __value_type, __elem_); | ||
| 199 | }; | ||
| 200 | 157 | ||
| 201 | _ALIGNAS_TYPE(_Data) char __buffer_[sizeof(_Data)]; | 158 | template <class _Tp, class _Alloc> |
| 159 | struct _LIBCPP_HIDE_STRUCT_FROM_ABI __shared_ptr_emplace_for_overwrite : __shared_weak_count { | ||
| 160 | using __value_type _LIBCPP_NODEBUG = __remove_cv_t<_Tp>; | ||
| 202 | 161 | ||
| 203 | _LIBCPP_HIDE_FROM_ABI explicit _Storage(_Alloc&& __a) { ::new ((void*)__get_alloc()) _Alloc(std::move(__a)); } | 162 | _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace_for_overwrite(_Alloc __a) : __alloc_(std::move(__a)) {} |
| 204 | _LIBCPP_HIDE_FROM_ABI ~_Storage() { __get_alloc()->~_Alloc(); } | ||
| 205 | 163 | ||
| 206 | _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT { | 164 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override { __value_.~__value_type(); } |
| 207 | return std::addressof(reinterpret_cast<_Data*>(__buffer_)->__alloc_); | 165 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override { |
| 208 | } | 166 | using __alloc_t = __allocator_traits_rebind_t<_Alloc, __shared_ptr_emplace_for_overwrite>; |
| 167 | using __alloc_traits = allocator_traits<__alloc_t>; | ||
| 168 | __alloc_t __tmp(__alloc_); | ||
| 169 | __alloc_.~_Alloc(); | ||
| 170 | __alloc_traits::deallocate(__tmp, pointer_traits<typename __alloc_traits::pointer>::pointer_to(*this), 1); | ||
| 171 | } | ||
| 209 | 172 | ||
| 210 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI __value_type* __get_elem() _NOEXCEPT { | 173 | _LIBCPP_HIDE_FROM_ABI __value_type* __get_elem() _NOEXCEPT { return std::addressof(__value_); } |
| 211 | return std::addressof(reinterpret_cast<_Data*>(__buffer_)->__elem_); | ||
| 212 | } | ||
| 213 | }; | ||
| 214 | 174 | ||
| 215 | _Storage __storage_; | 175 | private: |
| 176 | _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_; | ||
| 177 | _LIBCPP_NO_UNIQUE_ADDRESS __value_type __value_; | ||
| 216 | }; | 178 | }; |
| 217 | 179 | ||
| 218 | struct __shared_ptr_dummy_rebind_allocator_type; | 180 | struct __shared_ptr_dummy_rebind_allocator_type; |
| ... | @@ -233,16 +195,16 @@ class enable_shared_from_this; | ... | @@ -233,16 +195,16 @@ class enable_shared_from_this; |
| 233 | // when either Y* is convertible to T* or Y is U[N] and T is cv U[]. | 195 | // when either Y* is convertible to T* or Y is U[N] and T is cv U[]. |
| 234 | #if _LIBCPP_STD_VER >= 17 | 196 | #if _LIBCPP_STD_VER >= 17 |
| 235 | template <class _Yp, class _Tp> | 197 | template <class _Yp, class _Tp> |
| 236 | struct __bounded_convertible_to_unbounded : false_type {}; | 198 | inline const bool __bounded_convertible_to_unbounded_v = false; |
| 237 | 199 | ||
| 238 | template <class _Up, std::size_t _Np, class _Tp> | 200 | template <class _Up, std::size_t _Np, class _Tp> |
| 239 | struct __bounded_convertible_to_unbounded<_Up[_Np], _Tp> : is_same<__remove_cv_t<_Tp>, _Up[]> {}; | 201 | inline const bool __bounded_convertible_to_unbounded_v<_Up[_Np], _Tp> = is_same_v<remove_cv_t<_Tp>, _Up[]>; |
| 240 | 202 | ||
| 241 | template <class _Yp, class _Tp> | 203 | template <class _Yp, class _Tp> |
| 242 | struct __compatible_with : _Or< is_convertible<_Yp*, _Tp*>, __bounded_convertible_to_unbounded<_Yp, _Tp> > {}; | 204 | inline const bool __compatible_with_v = is_convertible_v<_Yp*, _Tp*> || __bounded_convertible_to_unbounded_v<_Yp, _Tp>; |
| 243 | #else | 205 | #else |
| 244 | template <class _Yp, class _Tp> | 206 | template <class _Yp, class _Tp> |
| 245 | struct __compatible_with : is_convertible<_Yp*, _Tp*> {}; | 207 | inline const bool __compatible_with_v = is_convertible<_Yp*, _Tp*>::value; |
| 246 | #endif // _LIBCPP_STD_VER >= 17 | 208 | #endif // _LIBCPP_STD_VER >= 17 |
| 247 | 209 | ||
| 248 | // Constructors that take raw pointers have a different set of "compatible" constraints | 210 | // Constructors that take raw pointers have a different set of "compatible" constraints |
| ... | @@ -252,49 +214,46 @@ struct __compatible_with : is_convertible<_Yp*, _Tp*> {}; | ... | @@ -252,49 +214,46 @@ struct __compatible_with : is_convertible<_Yp*, _Tp*> {}; |
| 252 | // - If T is not an array type, then Y* is convertible to T*. | 214 | // - If T is not an array type, then Y* is convertible to T*. |
| 253 | #if _LIBCPP_STD_VER >= 17 | 215 | #if _LIBCPP_STD_VER >= 17 |
| 254 | template <class _Yp, class _Tp, class = void> | 216 | template <class _Yp, class _Tp, class = void> |
| 255 | struct __raw_pointer_compatible_with : _And< _Not<is_array<_Tp>>, is_convertible<_Yp*, _Tp*> > {}; | 217 | inline const bool __raw_pointer_compatible_with_v = !is_array_v<_Tp> && is_convertible_v<_Yp*, _Tp*>; |
| 256 | 218 | ||
| 257 | template <class _Yp, class _Up, std::size_t _Np> | 219 | template <class _Yp, class _Up, std::size_t _Np> |
| 258 | struct __raw_pointer_compatible_with<_Yp, _Up[_Np], __enable_if_t< is_convertible<_Yp (*)[_Np], _Up (*)[_Np]>::value> > | 220 | inline const bool |
| 259 | : true_type {}; | 221 | __raw_pointer_compatible_with_v<_Yp, _Up[_Np], enable_if_t<is_convertible_v<_Yp (*)[_Np], _Up (*)[_Np]>>> = true; |
| 260 | 222 | ||
| 261 | template <class _Yp, class _Up> | 223 | template <class _Yp, class _Up> |
| 262 | struct __raw_pointer_compatible_with<_Yp, _Up[], __enable_if_t< is_convertible<_Yp (*)[], _Up (*)[]>::value> > | 224 | inline const bool __raw_pointer_compatible_with_v<_Yp, _Up[], enable_if_t<is_convertible_v<_Yp (*)[], _Up (*)[]>>> = |
| 263 | : true_type {}; | 225 | true; |
| 264 | 226 | ||
| 265 | #else | 227 | #else |
| 266 | template <class _Yp, class _Tp> | 228 | template <class _Yp, class _Tp> |
| 267 | struct __raw_pointer_compatible_with : is_convertible<_Yp*, _Tp*> {}; | 229 | inline const bool __raw_pointer_compatible_with_v = is_convertible<_Yp*, _Tp*>::value; |
| 268 | #endif // _LIBCPP_STD_VER >= 17 | 230 | #endif // _LIBCPP_STD_VER >= 17 |
| 269 | 231 | ||
| 270 | template <class _Ptr, class = void> | 232 | template <class _Ptr, class = void> |
| 271 | struct __is_deletable : false_type {}; | 233 | inline const bool __is_deletable_v = false; |
| 272 | template <class _Ptr> | 234 | template <class _Ptr> |
| 273 | struct __is_deletable<_Ptr, decltype(delete std::declval<_Ptr>())> : true_type {}; | 235 | inline const bool __is_deletable_v<_Ptr, decltype(delete std::declval<_Ptr>())> = true; |
| 274 | 236 | ||
| 275 | template <class _Ptr, class = void> | 237 | template <class _Ptr, class = void> |
| 276 | struct __is_array_deletable : false_type {}; | 238 | inline const bool __is_array_deletable_v = false; |
| 277 | template <class _Ptr> | 239 | template <class _Ptr> |
| 278 | struct __is_array_deletable<_Ptr, decltype(delete[] std::declval<_Ptr>())> : true_type {}; | 240 | inline const bool __is_array_deletable_v<_Ptr, decltype(delete[] std::declval<_Ptr>())> = true; |
| 279 | |||
| 280 | template <class _Dp, class _Pt, class = decltype(std::declval<_Dp>()(std::declval<_Pt>()))> | ||
| 281 | true_type __well_formed_deleter_test(int); | ||
| 282 | 241 | ||
| 283 | template <class, class> | 242 | template <class _Dp, class _Pt, class = void> |
| 284 | false_type __well_formed_deleter_test(...); | 243 | inline const bool __well_formed_deleter_v = false; |
| 285 | 244 | ||
| 286 | template <class _Dp, class _Pt> | 245 | template <class _Dp, class _Pt> |
| 287 | struct __well_formed_deleter : decltype(std::__well_formed_deleter_test<_Dp, _Pt>(0)) {}; | 246 | inline const bool __well_formed_deleter_v<_Dp, _Pt, __void_t<decltype(std::declval<_Dp>()(std::declval<_Pt>()))> > = |
| 247 | true; | ||
| 288 | 248 | ||
| 289 | template <class _Dp, class _Yp, class _Tp> | 249 | template <class _Dp, class _Yp, class _Tp> |
| 290 | struct __shared_ptr_deleter_ctor_reqs { | 250 | inline const bool __shared_ptr_deleter_ctor_reqs_v = |
| 291 | static const bool value = __raw_pointer_compatible_with<_Yp, _Tp>::value && is_move_constructible<_Dp>::value && | 251 | __raw_pointer_compatible_with_v<_Yp, _Tp> && is_move_constructible<_Dp>::value && |
| 292 | __well_formed_deleter<_Dp, _Yp*>::value; | 252 | __well_formed_deleter_v<_Dp, _Yp*>; |
| 293 | }; | ||
| 294 | 253 | ||
| 295 | template <class _Dp> | 254 | template <class _Dp> |
| 296 | using __shared_ptr_nullptr_deleter_ctor_reqs _LIBCPP_NODEBUG = | 255 | inline const bool __shared_ptr_nullptr_deleter_ctor_reqs_v = |
| 297 | _And<is_move_constructible<_Dp>, __well_formed_deleter<_Dp, nullptr_t> >; | 256 | is_move_constructible<_Dp>::value && __well_formed_deleter_v<_Dp, nullptr_t>; |
| 298 | 257 | ||
| 299 | #if defined(_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI) | 258 | #if defined(_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI) |
| 300 | # define _LIBCPP_SHARED_PTR_TRIVIAL_ABI __attribute__((__trivial_abi__)) | 259 | # define _LIBCPP_SHARED_PTR_TRIVIAL_ABI __attribute__((__trivial_abi__)) |
| ... | @@ -328,16 +287,15 @@ public: | ... | @@ -328,16 +287,15 @@ public: |
| 328 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {} | 287 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {} |
| 329 | 288 | ||
| 330 | template <class _Yp, | 289 | template <class _Yp, |
| 331 | __enable_if_t< _And< __raw_pointer_compatible_with<_Yp, _Tp> | 290 | __enable_if_t<__raw_pointer_compatible_with_v<_Yp, _Tp> |
| 332 | // In C++03 we get errors when trying to do SFINAE with the | 291 | // In C++03 we get errors when trying to do SFINAE with the |
| 333 | // delete operator, so we always pretend that it's deletable. | 292 | // delete operator, so we always pretend that it's deletable. |
| 334 | // The same happens on GCC. | 293 | // The same happens on GCC. |
| 335 | #if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_COMPILER_GCC) | 294 | #if !defined(_LIBCPP_CXX03_LANG) |
| 336 | , | 295 | && (is_array<_Tp>::value ? __is_array_deletable_v<_Yp*> : __is_deletable_v<_Yp*>) |
| 337 | _If<is_array<_Tp>::value, __is_array_deletable<_Yp*>, __is_deletable<_Yp*> > | ||
| 338 | #endif | 296 | #endif |
| 339 | >::value, | 297 | , |
| 340 | int> = 0> | 298 | int> = 0> |
| 341 | _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(_Yp* __p) : __ptr_(__p) { | 299 | _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(_Yp* __p) : __ptr_(__p) { |
| 342 | unique_ptr<_Yp> __hold(__p); | 300 | unique_ptr<_Yp> __hold(__p); |
| 343 | typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; | 301 | typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; |
| ... | @@ -347,7 +305,7 @@ public: | ... | @@ -347,7 +305,7 @@ public: |
| 347 | __enable_weak_this(__p, __p); | 305 | __enable_weak_this(__p, __p); |
| 348 | } | 306 | } |
| 349 | 307 | ||
| 350 | template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0> | 308 | template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs_v<_Dp, _Yp, _Tp>, int> = 0> |
| 351 | _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d) : __ptr_(__p) { | 309 | _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d) : __ptr_(__p) { |
| 352 | auto __guard = std::__make_exception_guard([&] { __d(__p); }); | 310 | auto __guard = std::__make_exception_guard([&] { __d(__p); }); |
| 353 | typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; | 311 | typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; |
| ... | @@ -361,10 +319,7 @@ public: | ... | @@ -361,10 +319,7 @@ public: |
| 361 | __guard.__complete(); | 319 | __guard.__complete(); |
| 362 | } | 320 | } |
| 363 | 321 | ||
| 364 | template <class _Yp, | 322 | template <class _Yp, class _Dp, class _Alloc, __enable_if_t<__shared_ptr_deleter_ctor_reqs_v<_Dp, _Yp, _Tp>, int> = 0> |
| 365 | class _Dp, | ||
| 366 | class _Alloc, | ||
| 367 | __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0> | ||
| 368 | _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d, _Alloc __a) : __ptr_(__p) { | 323 | _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d, _Alloc __a) : __ptr_(__p) { |
| 369 | auto __guard = std::__make_exception_guard([&] { __d(__p); }); | 324 | auto __guard = std::__make_exception_guard([&] { __d(__p); }); |
| 370 | typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk; | 325 | typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk; |
| ... | @@ -387,7 +342,7 @@ public: | ... | @@ -387,7 +342,7 @@ public: |
| 387 | _LIBCPP_HIDE_FROM_ABI shared_ptr( | 342 | _LIBCPP_HIDE_FROM_ABI shared_ptr( |
| 388 | nullptr_t __p, | 343 | nullptr_t __p, |
| 389 | _Dp __d, | 344 | _Dp __d, |
| 390 | __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag()) | 345 | __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs_v<_Dp>, __nullptr_sfinae_tag> = __nullptr_sfinae_tag()) |
| 391 | : __ptr_(nullptr) { | 346 | : __ptr_(nullptr) { |
| 392 | auto __guard = std::__make_exception_guard([&] { __d(__p); }); | 347 | auto __guard = std::__make_exception_guard([&] { __d(__p); }); |
| 393 | typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT; | 348 | typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT; |
| ... | @@ -405,7 +360,7 @@ public: | ... | @@ -405,7 +360,7 @@ public: |
| 405 | nullptr_t __p, | 360 | nullptr_t __p, |
| 406 | _Dp __d, | 361 | _Dp __d, |
| 407 | _Alloc __a, | 362 | _Alloc __a, |
| 408 | __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag()) | 363 | __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs_v<_Dp>, __nullptr_sfinae_tag> = __nullptr_sfinae_tag()) |
| 409 | : __ptr_(nullptr) { | 364 | : __ptr_(nullptr) { |
| 410 | auto __guard = std::__make_exception_guard([&] { __d(__p); }); | 365 | auto __guard = std::__make_exception_guard([&] { __d(__p); }); |
| 411 | typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk; | 366 | typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk; |
| ... | @@ -447,7 +402,7 @@ public: | ... | @@ -447,7 +402,7 @@ public: |
| 447 | __cntrl_->__add_shared(); | 402 | __cntrl_->__add_shared(); |
| 448 | } | 403 | } |
| 449 | 404 | ||
| 450 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> | 405 | template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0> |
| 451 | _LIBCPP_HIDE_FROM_ABI shared_ptr(const shared_ptr<_Yp>& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { | 406 | _LIBCPP_HIDE_FROM_ABI shared_ptr(const shared_ptr<_Yp>& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { |
| 452 | if (__cntrl_) | 407 | if (__cntrl_) |
| 453 | __cntrl_->__add_shared(); | 408 | __cntrl_->__add_shared(); |
| ... | @@ -458,13 +413,13 @@ public: | ... | @@ -458,13 +413,13 @@ public: |
| 458 | __r.__cntrl_ = nullptr; | 413 | __r.__cntrl_ = nullptr; |
| 459 | } | 414 | } |
| 460 | 415 | ||
| 461 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> | 416 | template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0> |
| 462 | _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { | 417 | _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { |
| 463 | __r.__ptr_ = nullptr; | 418 | __r.__ptr_ = nullptr; |
| 464 | __r.__cntrl_ = nullptr; | 419 | __r.__cntrl_ = nullptr; |
| 465 | } | 420 | } |
| 466 | 421 | ||
| 467 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> | 422 | template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0> |
| 468 | _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(const weak_ptr<_Yp>& __r) | 423 | _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(const weak_ptr<_Yp>& __r) |
| 469 | : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_) { | 424 | : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_) { |
| 470 | if (__cntrl_ == nullptr) | 425 | if (__cntrl_ == nullptr) |
| ... | @@ -483,7 +438,7 @@ public: | ... | @@ -483,7 +438,7 @@ public: |
| 483 | 438 | ||
| 484 | template <class _Yp, | 439 | template <class _Yp, |
| 485 | class _Dp, | 440 | class _Dp, |
| 486 | __enable_if_t<__compatible_with<_Yp, _Tp>::value && | 441 | __enable_if_t<__compatible_with_v<_Yp, _Tp> && |
| 487 | is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, | 442 | is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, |
| 488 | int> = 0> | 443 | int> = 0> |
| 489 | _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) { | 444 | _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) { |
| ... | @@ -506,7 +461,7 @@ public: | ... | @@ -506,7 +461,7 @@ public: |
| 506 | return *this; | 461 | return *this; |
| 507 | } | 462 | } |
| 508 | 463 | ||
| 509 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> | 464 | template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0> |
| 510 | _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT { | 465 | _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT { |
| 511 | shared_ptr(__r).swap(*this); | 466 | shared_ptr(__r).swap(*this); |
| 512 | return *this; | 467 | return *this; |
| ... | @@ -517,7 +472,7 @@ public: | ... | @@ -517,7 +472,7 @@ public: |
| 517 | return *this; | 472 | return *this; |
| 518 | } | 473 | } |
| 519 | 474 | ||
| 520 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> | 475 | template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0> |
| 521 | _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(shared_ptr<_Yp>&& __r) { | 476 | _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(shared_ptr<_Yp>&& __r) { |
| 522 | shared_ptr(std::move(__r)).swap(*this); | 477 | shared_ptr(std::move(__r)).swap(*this); |
| 523 | return *this; | 478 | return *this; |
| ... | @@ -535,8 +490,8 @@ public: | ... | @@ -535,8 +490,8 @@ public: |
| 535 | 490 | ||
| 536 | template <class _Yp, | 491 | template <class _Yp, |
| 537 | class _Dp, | 492 | class _Dp, |
| 538 | __enable_if_t<_And< __compatible_with<_Yp, _Tp>, | 493 | __enable_if_t<__compatible_with_v<_Yp, _Tp> && |
| 539 | is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*> >::value, | 494 | is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, |
| 540 | int> = 0> | 495 | int> = 0> |
| 541 | _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(unique_ptr<_Yp, _Dp>&& __r) { | 496 | _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(unique_ptr<_Yp, _Dp>&& __r) { |
| 542 | shared_ptr(std::move(__r)).swap(*this); | 497 | shared_ptr(std::move(__r)).swap(*this); |
| ... | @@ -550,20 +505,17 @@ public: | ... | @@ -550,20 +505,17 @@ public: |
| 550 | 505 | ||
| 551 | _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT { shared_ptr().swap(*this); } | 506 | _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT { shared_ptr().swap(*this); } |
| 552 | 507 | ||
| 553 | template <class _Yp, __enable_if_t<__raw_pointer_compatible_with<_Yp, _Tp>::value, int> = 0> | 508 | template <class _Yp, __enable_if_t<__raw_pointer_compatible_with_v<_Yp, _Tp>, int> = 0> |
| 554 | _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p) { | 509 | _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p) { |
| 555 | shared_ptr(__p).swap(*this); | 510 | shared_ptr(__p).swap(*this); |
| 556 | } | 511 | } |
| 557 | 512 | ||
| 558 | template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0> | 513 | template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs_v<_Dp, _Yp, _Tp>, int> = 0> |
| 559 | _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d) { | 514 | _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d) { |
| 560 | shared_ptr(__p, __d).swap(*this); | 515 | shared_ptr(__p, __d).swap(*this); |
| 561 | } | 516 | } |
| 562 | 517 | ||
| 563 | template <class _Yp, | 518 | template <class _Yp, class _Dp, class _Alloc, __enable_if_t<__shared_ptr_deleter_ctor_reqs_v<_Dp, _Yp, _Tp>, int> = 0> |
| 564 | class _Dp, | ||
| 565 | class _Alloc, | ||
| 566 | __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0> | ||
| 567 | _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d, _Alloc __a) { | 519 | _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d, _Alloc __a) { |
| 568 | shared_ptr(__p, __d, __a).swap(*this); | 520 | shared_ptr(__p, __d, __a).swap(*this); |
| 569 | } | 521 | } |
| ... | @@ -647,7 +599,26 @@ private: | ... | @@ -647,7 +599,26 @@ private: |
| 647 | } | 599 | } |
| 648 | } | 600 | } |
| 649 | 601 | ||
| 650 | _LIBCPP_HIDE_FROM_ABI void __enable_weak_this(...) _NOEXCEPT {} | 602 | template <class _Vp> |
| 603 | static __type_identity<_Vp> __get_shared_from_this_impl(const enable_shared_from_this<_Vp>*); | ||
| 604 | |||
| 605 | template <class _Vp, class = void> | ||
| 606 | struct __get_shared_from_this { | ||
| 607 | using type _LIBCPP_NODEBUG = __nat; | ||
| 608 | }; | ||
| 609 | |||
| 610 | template <class _Vp> | ||
| 611 | struct __get_shared_from_this<_Vp, __void_t<decltype(__get_shared_from_this_impl(static_cast<_Vp*>(nullptr)))> > { | ||
| 612 | using type _LIBCPP_NODEBUG = const enable_shared_from_this<typename decltype(__get_shared_from_this_impl( | ||
| 613 | static_cast<_Vp*>(nullptr)))::type>*; | ||
| 614 | }; | ||
| 615 | |||
| 616 | template < | ||
| 617 | class _Yp, | ||
| 618 | class _OrigPtr, | ||
| 619 | __enable_if_t<!is_convertible<_OrigPtr, typename __get_shared_from_this<__remove_pointer_t<_Yp> >::type>::value, | ||
| 620 | int> = 0> | ||
| 621 | _LIBCPP_HIDE_FROM_ABI void __enable_weak_this(_Yp, _OrigPtr) {} | ||
| 651 | 622 | ||
| 652 | template <class, class _Yp> | 623 | template <class, class _Yp> |
| 653 | struct __shared_ptr_default_delete : default_delete<_Yp> {}; | 624 | struct __shared_ptr_default_delete : default_delete<_Yp> {}; |
| ... | @@ -674,15 +645,22 @@ shared_ptr(unique_ptr<_Tp, _Dp>) -> shared_ptr<_Tp>; | ... | @@ -674,15 +645,22 @@ shared_ptr(unique_ptr<_Tp, _Dp>) -> shared_ptr<_Tp>; |
| 674 | // | 645 | // |
| 675 | // std::allocate_shared and std::make_shared | 646 | // std::allocate_shared and std::make_shared |
| 676 | // | 647 | // |
| 677 | template <class _Tp, class _Alloc, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0> | 648 | |
| 678 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&... __args) { | 649 | template <class _ControlBlock, class _Tp, class _Alloc, class... _Args> |
| 679 | using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>; | 650 | _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> __allocate_shared_impl(const _Alloc& __alloc, _Args&&... __args) { |
| 680 | using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type; | 651 | using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type; |
| 681 | __allocation_guard<_ControlBlockAllocator> __guard(__a, 1); | 652 | __allocation_guard<_ControlBlockAllocator> __guard(__alloc, 1); |
| 682 | ::new ((void*)std::addressof(*__guard.__get())) _ControlBlock(__a, std::forward<_Args>(__args)...); | 653 | ::new ((void*)std::addressof(*__guard.__get())) _ControlBlock(__alloc, std::forward<_Args>(__args)...); |
| 683 | auto __control_block = __guard.__release_ptr(); | 654 | auto __control_block = __guard.__release_ptr(); |
| 684 | return shared_ptr<_Tp>::__create_with_control_block( | 655 | return shared_ptr<_Tp>::__create_with_control_block( |
| 685 | (*__control_block).__get_elem(), std::addressof(*__control_block)); | 656 | __control_block->__get_elem(), std::__to_address(__control_block)); |
| 657 | } | ||
| 658 | |||
| 659 | template <class _Tp, class _Alloc, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0> | ||
| 660 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&... __args) { | ||
| 661 | using _CanonicalAlloc = __allocator_traits_rebind_t<_Alloc, __remove_cv_t<_Tp> >; | ||
| 662 | using _ControlBlock = __shared_ptr_emplace<_Tp, _CanonicalAlloc>; | ||
| 663 | return std::__allocate_shared_impl<_ControlBlock, _Tp>(_CanonicalAlloc(__a), std::forward<_Args>(__args)...); | ||
| 686 | } | 664 | } |
| 687 | 665 | ||
| 688 | template <class _Tp, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0> | 666 | template <class _Tp, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0> |
| ... | @@ -694,9 +672,9 @@ template <class _Tp, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = | ... | @@ -694,9 +672,9 @@ template <class _Tp, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = |
| 694 | 672 | ||
| 695 | template <class _Tp, class _Alloc, __enable_if_t<!is_array<_Tp>::value, int> = 0> | 673 | template <class _Tp, class _Alloc, __enable_if_t<!is_array<_Tp>::value, int> = 0> |
| 696 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) { | 674 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) { |
| 697 | using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>; | 675 | using _CanonicalAlloc = __allocator_traits_rebind_t<_Alloc, remove_cv_t<_Tp>>; |
| 698 | _ForOverwriteAllocator __alloc(__a); | 676 | using _ControlBlock = __shared_ptr_emplace_for_overwrite<_Tp, _CanonicalAlloc>; |
| 699 | return std::allocate_shared<_Tp>(__alloc); | 677 | return std::__allocate_shared_impl<_ControlBlock, _Tp>(_CanonicalAlloc(__a)); |
| 700 | } | 678 | } |
| 701 | 679 | ||
| 702 | template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0> | 680 | template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0> |
| ... | @@ -752,7 +730,7 @@ struct __unbounded_array_control_block<_Tp[], _Alloc> : __shared_weak_count { | ... | @@ -752,7 +730,7 @@ struct __unbounded_array_control_block<_Tp[], _Alloc> : __shared_weak_count { |
| 752 | // [1]: https://en.wikipedia.org/wiki/Data_structure_alignment#Computing_padding | 730 | // [1]: https://en.wikipedia.org/wiki/Data_structure_alignment#Computing_padding |
| 753 | size_t __bytes = __elements == 0 ? sizeof(__unbounded_array_control_block) | 731 | size_t __bytes = __elements == 0 ? sizeof(__unbounded_array_control_block) |
| 754 | : (__elements - 1) * sizeof(_Tp) + sizeof(__unbounded_array_control_block); | 732 | : (__elements - 1) * sizeof(_Tp) + sizeof(__unbounded_array_control_block); |
| 755 | constexpr size_t __align = alignof(_Tp); | 733 | constexpr size_t __align = alignof(__unbounded_array_control_block); |
| 756 | return (__bytes + __align - 1) & ~(__align - 1); | 734 | return (__bytes + __align - 1) & ~(__align - 1); |
| 757 | } | 735 | } |
| 758 | 736 | ||
| ... | @@ -1171,44 +1149,93 @@ private: | ... | @@ -1171,44 +1149,93 @@ private: |
| 1171 | __shared_weak_count* __cntrl_; | 1149 | __shared_weak_count* __cntrl_; |
| 1172 | 1150 | ||
| 1173 | public: | 1151 | public: |
| 1174 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT; | 1152 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {} |
| 1153 | |||
| 1154 | template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0> | ||
| 1155 | _LIBCPP_HIDE_FROM_ABI weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { | ||
| 1156 | if (__cntrl_) | ||
| 1157 | __cntrl_->__add_weak(); | ||
| 1158 | } | ||
| 1159 | |||
| 1160 | _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { | ||
| 1161 | if (__cntrl_) | ||
| 1162 | __cntrl_->__add_weak(); | ||
| 1163 | } | ||
| 1164 | |||
| 1165 | template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0> | ||
| 1166 | _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) { | ||
| 1167 | shared_ptr<_Yp> __s = __r.lock(); | ||
| 1168 | *this = weak_ptr<_Tp>(__s); | ||
| 1169 | } | ||
| 1175 | 1170 | ||
| 1176 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> | 1171 | _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { |
| 1177 | _LIBCPP_HIDE_FROM_ABI weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT; | 1172 | __r.__ptr_ = nullptr; |
| 1173 | __r.__cntrl_ = nullptr; | ||
| 1174 | } | ||
| 1178 | 1175 | ||
| 1179 | _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr const& __r) _NOEXCEPT; | 1176 | template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0> |
| 1177 | _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) { | ||
| 1178 | shared_ptr<_Yp> __s = __r.lock(); | ||
| 1179 | *this = weak_ptr<_Tp>(__s); | ||
| 1180 | __r.reset(); | ||
| 1181 | } | ||
| 1180 | 1182 | ||
| 1181 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> | 1183 | _LIBCPP_HIDE_FROM_ABI ~weak_ptr() { |
| 1182 | _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT; | 1184 | if (__cntrl_) |
| 1185 | __cntrl_->__release_weak(); | ||
| 1186 | } | ||
| 1183 | 1187 | ||
| 1184 | _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr&& __r) _NOEXCEPT; | 1188 | _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT { |
| 1189 | weak_ptr(__r).swap(*this); | ||
| 1190 | return *this; | ||
| 1191 | } | ||
| 1185 | 1192 | ||
| 1186 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> | 1193 | template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0> |
| 1187 | _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT; | 1194 | _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT { |
| 1195 | weak_ptr(__r).swap(*this); | ||
| 1196 | return *this; | ||
| 1197 | } | ||
| 1188 | 1198 | ||
| 1189 | _LIBCPP_HIDE_FROM_ABI ~weak_ptr(); | 1199 | _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT { |
| 1200 | weak_ptr(std::move(__r)).swap(*this); | ||
| 1201 | return *this; | ||
| 1202 | } | ||
| 1190 | 1203 | ||
| 1191 | _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT; | 1204 | template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0> |
| 1192 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> | 1205 | _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT { |
| 1193 | _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT; | 1206 | weak_ptr(std::move(__r)).swap(*this); |
| 1207 | return *this; | ||
| 1208 | } | ||
| 1194 | 1209 | ||
| 1195 | _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT; | 1210 | template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0> |
| 1196 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> | 1211 | _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT { |
| 1197 | _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT; | 1212 | weak_ptr(__r).swap(*this); |
| 1213 | return *this; | ||
| 1214 | } | ||
| 1198 | 1215 | ||
| 1199 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> | 1216 | _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr& __r) _NOEXCEPT { |
| 1200 | _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT; | 1217 | std::swap(__ptr_, __r.__ptr_); |
| 1218 | std::swap(__cntrl_, __r.__cntrl_); | ||
| 1219 | } | ||
| 1201 | 1220 | ||
| 1202 | _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr& __r) _NOEXCEPT; | 1221 | _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT { weak_ptr().swap(*this); } |
| 1203 | _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT; | ||
| 1204 | 1222 | ||
| 1205 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { | 1223 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { |
| 1206 | return __cntrl_ ? __cntrl_->use_count() : 0; | 1224 | return __cntrl_ ? __cntrl_->use_count() : 0; |
| 1207 | } | 1225 | } |
| 1226 | |||
| 1208 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool expired() const _NOEXCEPT { | 1227 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool expired() const _NOEXCEPT { |
| 1209 | return __cntrl_ == nullptr || __cntrl_->use_count() == 0; | 1228 | return __cntrl_ == nullptr || __cntrl_->use_count() == 0; |
| 1210 | } | 1229 | } |
| 1211 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> lock() const _NOEXCEPT; | 1230 | |
| 1231 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> lock() const _NOEXCEPT { | ||
| 1232 | shared_ptr<_Tp> __r; | ||
| 1233 | __r.__cntrl_ = __cntrl_ ? __cntrl_->lock() : __cntrl_; | ||
| 1234 | if (__r.__cntrl_) | ||
| 1235 | __r.__ptr_ = __ptr_; | ||
| 1236 | return __r; | ||
| 1237 | } | ||
| 1238 | |||
| 1212 | template <class _Up> | 1239 | template <class _Up> |
| 1213 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT { | 1240 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT { |
| 1214 | return __cntrl_ < __r.__cntrl_; | 1241 | return __cntrl_ < __r.__cntrl_; |
| ... | @@ -1229,107 +1256,11 @@ template <class _Tp> | ... | @@ -1229,107 +1256,11 @@ template <class _Tp> |
| 1229 | weak_ptr(shared_ptr<_Tp>) -> weak_ptr<_Tp>; | 1256 | weak_ptr(shared_ptr<_Tp>) -> weak_ptr<_Tp>; |
| 1230 | #endif | 1257 | #endif |
| 1231 | 1258 | ||
| 1232 | template <class _Tp> | ||
| 1233 | inline _LIBCPP_CONSTEXPR weak_ptr<_Tp>::weak_ptr() _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {} | ||
| 1234 | |||
| 1235 | template <class _Tp> | ||
| 1236 | inline weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { | ||
| 1237 | if (__cntrl_) | ||
| 1238 | __cntrl_->__add_weak(); | ||
| 1239 | } | ||
| 1240 | |||
| 1241 | template <class _Tp> | ||
| 1242 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > | ||
| 1243 | inline weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { | ||
| 1244 | if (__cntrl_) | ||
| 1245 | __cntrl_->__add_weak(); | ||
| 1246 | } | ||
| 1247 | |||
| 1248 | template <class _Tp> | ||
| 1249 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > | ||
| 1250 | inline weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) { | ||
| 1251 | shared_ptr<_Yp> __s = __r.lock(); | ||
| 1252 | *this = weak_ptr<_Tp>(__s); | ||
| 1253 | } | ||
| 1254 | |||
| 1255 | template <class _Tp> | ||
| 1256 | inline weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { | ||
| 1257 | __r.__ptr_ = nullptr; | ||
| 1258 | __r.__cntrl_ = nullptr; | ||
| 1259 | } | ||
| 1260 | |||
| 1261 | template <class _Tp> | ||
| 1262 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > | ||
| 1263 | inline weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) { | ||
| 1264 | shared_ptr<_Yp> __s = __r.lock(); | ||
| 1265 | *this = weak_ptr<_Tp>(__s); | ||
| 1266 | __r.reset(); | ||
| 1267 | } | ||
| 1268 | |||
| 1269 | template <class _Tp> | ||
| 1270 | weak_ptr<_Tp>::~weak_ptr() { | ||
| 1271 | if (__cntrl_) | ||
| 1272 | __cntrl_->__release_weak(); | ||
| 1273 | } | ||
| 1274 | |||
| 1275 | template <class _Tp> | ||
| 1276 | inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT { | ||
| 1277 | weak_ptr(__r).swap(*this); | ||
| 1278 | return *this; | ||
| 1279 | } | ||
| 1280 | |||
| 1281 | template <class _Tp> | ||
| 1282 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > | ||
| 1283 | inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT { | ||
| 1284 | weak_ptr(__r).swap(*this); | ||
| 1285 | return *this; | ||
| 1286 | } | ||
| 1287 | |||
| 1288 | template <class _Tp> | ||
| 1289 | inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT { | ||
| 1290 | weak_ptr(std::move(__r)).swap(*this); | ||
| 1291 | return *this; | ||
| 1292 | } | ||
| 1293 | |||
| 1294 | template <class _Tp> | ||
| 1295 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > | ||
| 1296 | inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT { | ||
| 1297 | weak_ptr(std::move(__r)).swap(*this); | ||
| 1298 | return *this; | ||
| 1299 | } | ||
| 1300 | |||
| 1301 | template <class _Tp> | ||
| 1302 | template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > | ||
| 1303 | inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT { | ||
| 1304 | weak_ptr(__r).swap(*this); | ||
| 1305 | return *this; | ||
| 1306 | } | ||
| 1307 | |||
| 1308 | template <class _Tp> | ||
| 1309 | inline void weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT { | ||
| 1310 | std::swap(__ptr_, __r.__ptr_); | ||
| 1311 | std::swap(__cntrl_, __r.__cntrl_); | ||
| 1312 | } | ||
| 1313 | |||
| 1314 | template <class _Tp> | 1259 | template <class _Tp> |
| 1315 | inline _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT { | 1260 | inline _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT { |
| 1316 | __x.swap(__y); | 1261 | __x.swap(__y); |
| 1317 | } | 1262 | } |
| 1318 | 1263 | ||
| 1319 | template <class _Tp> | ||
| 1320 | inline void weak_ptr<_Tp>::reset() _NOEXCEPT { | ||
| 1321 | weak_ptr().swap(*this); | ||
| 1322 | } | ||
| 1323 | |||
| 1324 | template <class _Tp> | ||
| 1325 | shared_ptr<_Tp> weak_ptr<_Tp>::lock() const _NOEXCEPT { | ||
| 1326 | shared_ptr<_Tp> __r; | ||
| 1327 | __r.__cntrl_ = __cntrl_ ? __cntrl_->lock() : __cntrl_; | ||
| 1328 | if (__r.__cntrl_) | ||
| 1329 | __r.__ptr_ = __ptr_; | ||
| 1330 | return __r; | ||
| 1331 | } | ||
| 1332 | |||
| 1333 | #if _LIBCPP_STD_VER >= 17 | 1264 | #if _LIBCPP_STD_VER >= 17 |
| 1334 | template <class _Tp = void> | 1265 | template <class _Tp = void> |
| 1335 | struct owner_less; | 1266 | struct owner_less; |
| ... | @@ -1536,6 +1467,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit( | ... | @@ -1536,6 +1467,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit( |
| 1536 | 1467 | ||
| 1537 | #endif // _LIBCPP_HAS_THREADS | 1468 | #endif // _LIBCPP_HAS_THREADS |
| 1538 | 1469 | ||
| 1470 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 1539 | _LIBCPP_END_NAMESPACE_STD | 1471 | _LIBCPP_END_NAMESPACE_STD |
| 1540 | 1472 | ||
| 1541 | _LIBCPP_POP_MACROS | 1473 | _LIBCPP_POP_MACROS |
lib/libcxx/include/__memory/temporary_buffer.h+3| ... | @@ -26,6 +26,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -26,6 +26,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | template <class _Tp> | 26 | template <class _Tp> |
| 27 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17 pair<_Tp*, ptrdiff_t> | 27 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17 pair<_Tp*, ptrdiff_t> |
| 28 | get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT { | 28 | get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT { |
| 29 | if (__n <= 0) | ||
| 30 | return pair<_Tp*, ptrdiff_t>(); | ||
| 31 | |||
| 29 | __unique_temporary_buffer<_Tp> __unique_buf = std::__allocate_unique_temporary_buffer<_Tp>(__n); | 32 | __unique_temporary_buffer<_Tp> __unique_buf = std::__allocate_unique_temporary_buffer<_Tp>(__n); |
| 30 | pair<_Tp*, ptrdiff_t> __result(__unique_buf.get(), __unique_buf.get_deleter().__count_); | 33 | pair<_Tp*, ptrdiff_t> __result(__unique_buf.get(), __unique_buf.get_deleter().__count_); |
| 31 | __unique_buf.release(); | 34 | __unique_buf.release(); |
lib/libcxx/include/__memory/uninitialized_algorithms.h+53-192| ... | @@ -11,11 +11,10 @@ | ... | @@ -11,11 +11,10 @@ |
| 11 | #define _LIBCPP___MEMORY_UNINITIALIZED_ALGORITHMS_H | 11 | #define _LIBCPP___MEMORY_UNINITIALIZED_ALGORITHMS_H |
| 12 | 12 | ||
| 13 | #include <__algorithm/copy.h> | 13 | #include <__algorithm/copy.h> |
| 14 | #include <__algorithm/move.h> | 14 | #include <__algorithm/in_out_result.h> |
| 15 | #include <__algorithm/unwrap_iter.h> | 15 | #include <__algorithm/unwrap_iter.h> |
| 16 | #include <__algorithm/unwrap_range.h> | 16 | #include <__algorithm/unwrap_range.h> |
| 17 | #include <__config> | 17 | #include <__config> |
| 18 | #include <__cstddef/size_t.h> | ||
| 19 | #include <__fwd/memory.h> | 18 | #include <__fwd/memory.h> |
| 20 | #include <__iterator/iterator_traits.h> | 19 | #include <__iterator/iterator_traits.h> |
| 21 | #include <__iterator/reverse_iterator.h> | 20 | #include <__iterator/reverse_iterator.h> |
| ... | @@ -25,15 +24,13 @@ | ... | @@ -25,15 +24,13 @@ |
| 25 | #include <__memory/destroy.h> | 24 | #include <__memory/destroy.h> |
| 26 | #include <__memory/pointer_traits.h> | 25 | #include <__memory/pointer_traits.h> |
| 27 | #include <__type_traits/enable_if.h> | 26 | #include <__type_traits/enable_if.h> |
| 28 | #include <__type_traits/extent.h> | ||
| 29 | #include <__type_traits/is_array.h> | ||
| 30 | #include <__type_traits/is_constant_evaluated.h> | 27 | #include <__type_traits/is_constant_evaluated.h> |
| 28 | #include <__type_traits/is_reference.h> | ||
| 31 | #include <__type_traits/is_same.h> | 29 | #include <__type_traits/is_same.h> |
| 32 | #include <__type_traits/is_trivially_assignable.h> | 30 | #include <__type_traits/is_trivially_assignable.h> |
| 33 | #include <__type_traits/is_trivially_constructible.h> | 31 | #include <__type_traits/is_trivially_constructible.h> |
| 34 | #include <__type_traits/is_trivially_relocatable.h> | 32 | #include <__type_traits/is_trivially_relocatable.h> |
| 35 | #include <__type_traits/remove_const.h> | 33 | #include <__type_traits/remove_const.h> |
| 36 | #include <__type_traits/remove_extent.h> | ||
| 37 | #include <__utility/exception_guard.h> | 34 | #include <__utility/exception_guard.h> |
| 38 | #include <__utility/move.h> | 35 | #include <__utility/move.h> |
| 39 | #include <__utility/pair.h> | 36 | #include <__utility/pair.h> |
| ... | @@ -57,7 +54,8 @@ struct __always_false { | ... | @@ -57,7 +54,8 @@ struct __always_false { |
| 57 | // uninitialized_copy | 54 | // uninitialized_copy |
| 58 | 55 | ||
| 59 | template <class _ValueType, class _InputIterator, class _Sentinel1, class _ForwardIterator, class _EndPredicate> | 56 | template <class _ValueType, class _InputIterator, class _Sentinel1, class _ForwardIterator, class _EndPredicate> |
| 60 | inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_copy( | 57 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __in_out_result<_InputIterator, _ForwardIterator> |
| 58 | __uninitialized_copy( | ||
| 61 | _InputIterator __ifirst, _Sentinel1 __ilast, _ForwardIterator __ofirst, _EndPredicate __stop_copying) { | 59 | _InputIterator __ifirst, _Sentinel1 __ilast, _ForwardIterator __ofirst, _EndPredicate __stop_copying) { |
| 62 | _ForwardIterator __idx = __ofirst; | 60 | _ForwardIterator __idx = __ofirst; |
| 63 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); }); | 61 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); }); |
| ... | @@ -65,22 +63,22 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali | ... | @@ -65,22 +63,22 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali |
| 65 | ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst); | 63 | ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst); |
| 66 | __guard.__complete(); | 64 | __guard.__complete(); |
| 67 | 65 | ||
| 68 | return pair<_InputIterator, _ForwardIterator>(std::move(__ifirst), std::move(__idx)); | 66 | return {std::move(__ifirst), std::move(__idx)}; |
| 69 | } | 67 | } |
| 70 | 68 | ||
| 71 | template <class _InputIterator, class _ForwardIterator> | 69 | template <class _InputIterator, class _ForwardIterator> |
| 72 | _LIBCPP_HIDE_FROM_ABI _ForwardIterator | 70 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 73 | uninitialized_copy(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) { | 71 | uninitialized_copy(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) { |
| 74 | typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; | 72 | typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; |
| 75 | auto __result = std::__uninitialized_copy<_ValueType>( | 73 | auto __result = std::__uninitialized_copy<_ValueType>( |
| 76 | std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __always_false()); | 74 | std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __always_false()); |
| 77 | return std::move(__result.second); | 75 | return std::move(__result.__out_); |
| 78 | } | 76 | } |
| 79 | 77 | ||
| 80 | // uninitialized_copy_n | 78 | // uninitialized_copy_n |
| 81 | 79 | ||
| 82 | template <class _ValueType, class _InputIterator, class _Size, class _ForwardIterator, class _EndPredicate> | 80 | template <class _ValueType, class _InputIterator, class _Size, class _ForwardIterator, class _EndPredicate> |
| 83 | inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> | 81 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __in_out_result<_InputIterator, _ForwardIterator> |
| 84 | __uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_copying) { | 82 | __uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_copying) { |
| 85 | _ForwardIterator __idx = __ofirst; | 83 | _ForwardIterator __idx = __ofirst; |
| 86 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); }); | 84 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); }); |
| ... | @@ -88,22 +86,22 @@ __uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __of | ... | @@ -88,22 +86,22 @@ __uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __of |
| 88 | ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst); | 86 | ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst); |
| 89 | __guard.__complete(); | 87 | __guard.__complete(); |
| 90 | 88 | ||
| 91 | return pair<_InputIterator, _ForwardIterator>(std::move(__ifirst), std::move(__idx)); | 89 | return {std::move(__ifirst), std::move(__idx)}; |
| 92 | } | 90 | } |
| 93 | 91 | ||
| 94 | template <class _InputIterator, class _Size, class _ForwardIterator> | 92 | template <class _InputIterator, class _Size, class _ForwardIterator> |
| 95 | inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator | 93 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 96 | uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst) { | 94 | uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst) { |
| 97 | typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; | 95 | typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; |
| 98 | auto __result = | 96 | auto __result = |
| 99 | std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __always_false()); | 97 | std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __always_false()); |
| 100 | return std::move(__result.second); | 98 | return std::move(__result.__out_); |
| 101 | } | 99 | } |
| 102 | 100 | ||
| 103 | // uninitialized_fill | 101 | // uninitialized_fill |
| 104 | 102 | ||
| 105 | template <class _ValueType, class _ForwardIterator, class _Sentinel, class _Tp> | 103 | template <class _ValueType, class _ForwardIterator, class _Sentinel, class _Tp> |
| 106 | inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator | 104 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 107 | __uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) { | 105 | __uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) { |
| 108 | _ForwardIterator __idx = __first; | 106 | _ForwardIterator __idx = __first; |
| 109 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); | 107 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); |
| ... | @@ -115,7 +113,7 @@ __uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) | ... | @@ -115,7 +113,7 @@ __uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) |
| 115 | } | 113 | } |
| 116 | 114 | ||
| 117 | template <class _ForwardIterator, class _Tp> | 115 | template <class _ForwardIterator, class _Tp> |
| 118 | inline _LIBCPP_HIDE_FROM_ABI void | 116 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 119 | uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x) { | 117 | uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x) { |
| 120 | typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; | 118 | typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; |
| 121 | (void)std::__uninitialized_fill<_ValueType>(__first, __last, __x); | 119 | (void)std::__uninitialized_fill<_ValueType>(__first, __last, __x); |
| ... | @@ -124,7 +122,7 @@ uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& | ... | @@ -124,7 +122,7 @@ uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& |
| 124 | // uninitialized_fill_n | 122 | // uninitialized_fill_n |
| 125 | 123 | ||
| 126 | template <class _ValueType, class _ForwardIterator, class _Size, class _Tp> | 124 | template <class _ValueType, class _ForwardIterator, class _Size, class _Tp> |
| 127 | inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator | 125 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 128 | __uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { | 126 | __uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { |
| 129 | _ForwardIterator __idx = __first; | 127 | _ForwardIterator __idx = __first; |
| 130 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); | 128 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); |
| ... | @@ -136,7 +134,7 @@ __uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { | ... | @@ -136,7 +134,7 @@ __uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { |
| 136 | } | 134 | } |
| 137 | 135 | ||
| 138 | template <class _ForwardIterator, class _Size, class _Tp> | 136 | template <class _ForwardIterator, class _Size, class _Tp> |
| 139 | inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator | 137 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 140 | uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { | 138 | uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { |
| 141 | typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; | 139 | typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; |
| 142 | return std::__uninitialized_fill_n<_ValueType>(__first, __n, __x); | 140 | return std::__uninitialized_fill_n<_ValueType>(__first, __n, __x); |
| ... | @@ -144,10 +142,18 @@ uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { | ... | @@ -144,10 +142,18 @@ uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { |
| 144 | 142 | ||
| 145 | #if _LIBCPP_STD_VER >= 17 | 143 | #if _LIBCPP_STD_VER >= 17 |
| 146 | 144 | ||
| 145 | template <class _Iter> | ||
| 146 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) __deref_move(_Iter& __it) { | ||
| 147 | if constexpr (is_lvalue_reference_v<decltype(*__it)>) | ||
| 148 | return std::move(*__it); | ||
| 149 | else | ||
| 150 | return *__it; | ||
| 151 | } | ||
| 152 | |||
| 147 | // uninitialized_default_construct | 153 | // uninitialized_default_construct |
| 148 | 154 | ||
| 149 | template <class _ValueType, class _ForwardIterator, class _Sentinel> | 155 | template <class _ValueType, class _ForwardIterator, class _Sentinel> |
| 150 | inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator | 156 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 151 | __uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) { | 157 | __uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) { |
| 152 | auto __idx = __first; | 158 | auto __idx = __first; |
| 153 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); | 159 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); |
| ... | @@ -159,7 +165,8 @@ __uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) { | ... | @@ -159,7 +165,8 @@ __uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) { |
| 159 | } | 165 | } |
| 160 | 166 | ||
| 161 | template <class _ForwardIterator> | 167 | template <class _ForwardIterator> |
| 162 | inline _LIBCPP_HIDE_FROM_ABI void uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last) { | 168 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 169 | uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last) { | ||
| 163 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; | 170 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; |
| 164 | (void)std::__uninitialized_default_construct<_ValueType>(std::move(__first), std::move(__last)); | 171 | (void)std::__uninitialized_default_construct<_ValueType>(std::move(__first), std::move(__last)); |
| 165 | } | 172 | } |
| ... | @@ -167,7 +174,8 @@ inline _LIBCPP_HIDE_FROM_ABI void uninitialized_default_construct(_ForwardIterat | ... | @@ -167,7 +174,8 @@ inline _LIBCPP_HIDE_FROM_ABI void uninitialized_default_construct(_ForwardIterat |
| 167 | // uninitialized_default_construct_n | 174 | // uninitialized_default_construct_n |
| 168 | 175 | ||
| 169 | template <class _ValueType, class _ForwardIterator, class _Size> | 176 | template <class _ValueType, class _ForwardIterator, class _Size> |
| 170 | inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) { | 177 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 178 | __uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) { | ||
| 171 | auto __idx = __first; | 179 | auto __idx = __first; |
| 172 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); | 180 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); |
| 173 | for (; __n > 0; ++__idx, (void)--__n) | 181 | for (; __n > 0; ++__idx, (void)--__n) |
| ... | @@ -178,7 +186,8 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct_ | ... | @@ -178,7 +186,8 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct_ |
| 178 | } | 186 | } |
| 179 | 187 | ||
| 180 | template <class _ForwardIterator, class _Size> | 188 | template <class _ForwardIterator, class _Size> |
| 181 | inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) { | 189 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 190 | uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) { | ||
| 182 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; | 191 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; |
| 183 | return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n); | 192 | return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n); |
| 184 | } | 193 | } |
| ... | @@ -186,7 +195,7 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_default_construct_n( | ... | @@ -186,7 +195,7 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_default_construct_n( |
| 186 | // uninitialized_value_construct | 195 | // uninitialized_value_construct |
| 187 | 196 | ||
| 188 | template <class _ValueType, class _ForwardIterator, class _Sentinel> | 197 | template <class _ValueType, class _ForwardIterator, class _Sentinel> |
| 189 | inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator | 198 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 190 | __uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) { | 199 | __uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) { |
| 191 | auto __idx = __first; | 200 | auto __idx = __first; |
| 192 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); | 201 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); |
| ... | @@ -198,7 +207,8 @@ __uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) { | ... | @@ -198,7 +207,8 @@ __uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) { |
| 198 | } | 207 | } |
| 199 | 208 | ||
| 200 | template <class _ForwardIterator> | 209 | template <class _ForwardIterator> |
| 201 | inline _LIBCPP_HIDE_FROM_ABI void uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last) { | 210 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 211 | uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last) { | ||
| 202 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; | 212 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; |
| 203 | (void)std::__uninitialized_value_construct<_ValueType>(std::move(__first), std::move(__last)); | 213 | (void)std::__uninitialized_value_construct<_ValueType>(std::move(__first), std::move(__last)); |
| 204 | } | 214 | } |
| ... | @@ -206,7 +216,8 @@ inline _LIBCPP_HIDE_FROM_ABI void uninitialized_value_construct(_ForwardIterator | ... | @@ -206,7 +216,8 @@ inline _LIBCPP_HIDE_FROM_ABI void uninitialized_value_construct(_ForwardIterator |
| 206 | // uninitialized_value_construct_n | 216 | // uninitialized_value_construct_n |
| 207 | 217 | ||
| 208 | template <class _ValueType, class _ForwardIterator, class _Size> | 218 | template <class _ValueType, class _ForwardIterator, class _Size> |
| 209 | inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) { | 219 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 220 | __uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) { | ||
| 210 | auto __idx = __first; | 221 | auto __idx = __first; |
| 211 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); | 222 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); }); |
| 212 | for (; __n > 0; ++__idx, (void)--__n) | 223 | for (; __n > 0; ++__idx, (void)--__n) |
| ... | @@ -217,7 +228,8 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct_n( | ... | @@ -217,7 +228,8 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct_n( |
| 217 | } | 228 | } |
| 218 | 229 | ||
| 219 | template <class _ForwardIterator, class _Size> | 230 | template <class _ForwardIterator, class _Size> |
| 220 | inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) { | 231 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 232 | uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) { | ||
| 221 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; | 233 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; |
| 222 | return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n); | 234 | return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n); |
| 223 | } | 235 | } |
| ... | @@ -230,12 +242,12 @@ template <class _ValueType, | ... | @@ -230,12 +242,12 @@ template <class _ValueType, |
| 230 | class _ForwardIterator, | 242 | class _ForwardIterator, |
| 231 | class _EndPredicate, | 243 | class _EndPredicate, |
| 232 | class _IterMove> | 244 | class _IterMove> |
| 233 | inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_move( | 245 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __in_out_result<_InputIterator, _ForwardIterator> |
| 234 | _InputIterator __ifirst, | 246 | __uninitialized_move(_InputIterator __ifirst, |
| 235 | _Sentinel1 __ilast, | 247 | _Sentinel1 __ilast, |
| 236 | _ForwardIterator __ofirst, | 248 | _ForwardIterator __ofirst, |
| 237 | _EndPredicate __stop_moving, | 249 | _EndPredicate __stop_moving, |
| 238 | _IterMove __iter_move) { | 250 | _IterMove __iter_move) { |
| 239 | auto __idx = __ofirst; | 251 | auto __idx = __ofirst; |
| 240 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); }); | 252 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); }); |
| 241 | for (; __ifirst != __ilast && !__stop_moving(__idx); ++__idx, (void)++__ifirst) { | 253 | for (; __ifirst != __ilast && !__stop_moving(__idx); ++__idx, (void)++__ifirst) { |
| ... | @@ -247,14 +259,14 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali | ... | @@ -247,14 +259,14 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali |
| 247 | } | 259 | } |
| 248 | 260 | ||
| 249 | template <class _InputIterator, class _ForwardIterator> | 261 | template <class _InputIterator, class _ForwardIterator> |
| 250 | inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator | 262 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator |
| 251 | uninitialized_move(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) { | 263 | uninitialized_move(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) { |
| 252 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; | 264 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; |
| 253 | auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::move(*__iter); }; | 265 | auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::__deref_move(__iter); }; |
| 254 | 266 | ||
| 255 | auto __result = std::__uninitialized_move<_ValueType>( | 267 | auto __result = std::__uninitialized_move<_ValueType>( |
| 256 | std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __always_false(), __iter_move); | 268 | std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __always_false(), __iter_move); |
| 257 | return std::move(__result.second); | 269 | return std::move(__result.__out_); |
| 258 | } | 270 | } |
| 259 | 271 | ||
| 260 | // uninitialized_move_n | 272 | // uninitialized_move_n |
| ... | @@ -265,7 +277,8 @@ template <class _ValueType, | ... | @@ -265,7 +277,8 @@ template <class _ValueType, |
| 265 | class _ForwardIterator, | 277 | class _ForwardIterator, |
| 266 | class _EndPredicate, | 278 | class _EndPredicate, |
| 267 | class _IterMove> | 279 | class _IterMove> |
| 268 | inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_move_n( | 280 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __in_out_result<_InputIterator, _ForwardIterator> |
| 281 | __uninitialized_move_n( | ||
| 269 | _InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_moving, _IterMove __iter_move) { | 282 | _InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_moving, _IterMove __iter_move) { |
| 270 | auto __idx = __ofirst; | 283 | auto __idx = __ofirst; |
| 271 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); }); | 284 | auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); }); |
| ... | @@ -277,166 +290,14 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali | ... | @@ -277,166 +290,14 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali |
| 277 | } | 290 | } |
| 278 | 291 | ||
| 279 | template <class _InputIterator, class _Size, class _ForwardIterator> | 292 | template <class _InputIterator, class _Size, class _ForwardIterator> |
| 280 | inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> | 293 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<_InputIterator, _ForwardIterator> |
| 281 | uninitialized_move_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst) { | 294 | uninitialized_move_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst) { |
| 282 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; | 295 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; |
| 283 | auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::move(*__iter); }; | 296 | auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::__deref_move(__iter); }; |
| 284 | 297 | ||
| 285 | return std::__uninitialized_move_n<_ValueType>( | 298 | auto __result = std::__uninitialized_move_n<_ValueType>( |
| 286 | std::move(__ifirst), __n, std::move(__ofirst), __always_false(), __iter_move); | 299 | std::move(__ifirst), __n, std::move(__ofirst), __always_false(), __iter_move); |
| 287 | } | 300 | return {std::move(__result.__in_), std::move(__result.__out_)}; |
| 288 | |||
| 289 | // TODO: Rewrite this to iterate left to right and use reverse_iterators when calling | ||
| 290 | // Destroys every element in the range [first, last) FROM RIGHT TO LEFT using allocator | ||
| 291 | // destruction. If elements are themselves C-style arrays, they are recursively destroyed | ||
| 292 | // in the same manner. | ||
| 293 | // | ||
| 294 | // This function assumes that destructors do not throw, and that the allocator is bound to | ||
| 295 | // the correct type. | ||
| 296 | template <class _Alloc, | ||
| 297 | class _BidirIter, | ||
| 298 | __enable_if_t<__has_bidirectional_iterator_category<_BidirIter>::value, int> = 0> | ||
| 299 | _LIBCPP_HIDE_FROM_ABI constexpr void | ||
| 300 | __allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter __first, _BidirIter __last) noexcept { | ||
| 301 | using _ValueType = typename iterator_traits<_BidirIter>::value_type; | ||
| 302 | static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _ValueType>, | ||
| 303 | "The allocator should already be rebound to the correct type"); | ||
| 304 | |||
| 305 | if (__first == __last) | ||
| 306 | return; | ||
| 307 | |||
| 308 | if constexpr (is_array_v<_ValueType>) { | ||
| 309 | static_assert(!__is_unbounded_array_v<_ValueType>, | ||
| 310 | "arrays of unbounded arrays don't exist, but if they did we would mess up here"); | ||
| 311 | |||
| 312 | using _Element = remove_extent_t<_ValueType>; | ||
| 313 | __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc); | ||
| 314 | do { | ||
| 315 | --__last; | ||
| 316 | decltype(auto) __array = *__last; | ||
| 317 | std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + extent_v<_ValueType>); | ||
| 318 | } while (__last != __first); | ||
| 319 | } else { | ||
| 320 | do { | ||
| 321 | --__last; | ||
| 322 | allocator_traits<_Alloc>::destroy(__alloc, std::addressof(*__last)); | ||
| 323 | } while (__last != __first); | ||
| 324 | } | ||
| 325 | } | ||
| 326 | |||
| 327 | // Constructs the object at the given location using the allocator's construct method. | ||
| 328 | // | ||
| 329 | // If the object being constructed is an array, each element of the array is allocator-constructed, | ||
| 330 | // recursively. If an exception is thrown during the construction of an array, the initialized | ||
| 331 | // elements are destroyed in reverse order of initialization using allocator destruction. | ||
| 332 | // | ||
| 333 | // This function assumes that the allocator is bound to the correct type. | ||
| 334 | template <class _Alloc, class _Tp> | ||
| 335 | _LIBCPP_HIDE_FROM_ABI constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc) { | ||
| 336 | static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>, | ||
| 337 | "The allocator should already be rebound to the correct type"); | ||
| 338 | |||
| 339 | if constexpr (is_array_v<_Tp>) { | ||
| 340 | using _Element = remove_extent_t<_Tp>; | ||
| 341 | __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc); | ||
| 342 | size_t __i = 0; | ||
| 343 | _Tp& __array = *__loc; | ||
| 344 | |||
| 345 | // If an exception is thrown, destroy what we have constructed so far in reverse order. | ||
| 346 | auto __guard = std::__make_exception_guard([&]() { | ||
| 347 | std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i); | ||
| 348 | }); | ||
| 349 | |||
| 350 | for (; __i != extent_v<_Tp>; ++__i) { | ||
| 351 | std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i])); | ||
| 352 | } | ||
| 353 | __guard.__complete(); | ||
| 354 | } else { | ||
| 355 | allocator_traits<_Alloc>::construct(__alloc, __loc); | ||
| 356 | } | ||
| 357 | } | ||
| 358 | |||
| 359 | // Constructs the object at the given location using the allocator's construct method, passing along | ||
| 360 | // the provided argument. | ||
| 361 | // | ||
| 362 | // If the object being constructed is an array, the argument is also assumed to be an array. Each | ||
| 363 | // each element of the array being constructed is allocator-constructed from the corresponding | ||
| 364 | // element of the argument array. If an exception is thrown during the construction of an array, | ||
| 365 | // the initialized elements are destroyed in reverse order of initialization using allocator | ||
| 366 | // destruction. | ||
| 367 | // | ||
| 368 | // This function assumes that the allocator is bound to the correct type. | ||
| 369 | template <class _Alloc, class _Tp, class _Arg> | ||
| 370 | _LIBCPP_HIDE_FROM_ABI constexpr void | ||
| 371 | __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc, _Arg const& __arg) { | ||
| 372 | static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>, | ||
| 373 | "The allocator should already be rebound to the correct type"); | ||
| 374 | |||
| 375 | if constexpr (is_array_v<_Tp>) { | ||
| 376 | static_assert(is_array_v<_Arg>, | ||
| 377 | "Provided non-array initialization argument to __allocator_construct_at_multidimensional when " | ||
| 378 | "trying to construct an array."); | ||
| 379 | |||
| 380 | using _Element = remove_extent_t<_Tp>; | ||
| 381 | __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc); | ||
| 382 | size_t __i = 0; | ||
| 383 | _Tp& __array = *__loc; | ||
| 384 | |||
| 385 | // If an exception is thrown, destroy what we have constructed so far in reverse order. | ||
| 386 | auto __guard = std::__make_exception_guard([&]() { | ||
| 387 | std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i); | ||
| 388 | }); | ||
| 389 | for (; __i != extent_v<_Tp>; ++__i) { | ||
| 390 | std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]), __arg[__i]); | ||
| 391 | } | ||
| 392 | __guard.__complete(); | ||
| 393 | } else { | ||
| 394 | allocator_traits<_Alloc>::construct(__alloc, __loc, __arg); | ||
| 395 | } | ||
| 396 | } | ||
| 397 | |||
| 398 | // Given a range starting at it and containing n elements, initializes each element in the | ||
| 399 | // range from left to right using the construct method of the allocator (rebound to the | ||
| 400 | // correct type). | ||
| 401 | // | ||
| 402 | // If an exception is thrown, the initialized elements are destroyed in reverse order of | ||
| 403 | // initialization using allocator_traits destruction. If the elements in the range are C-style | ||
| 404 | // arrays, they are initialized element-wise using allocator construction, and recursively so. | ||
| 405 | template <class _Alloc, | ||
| 406 | class _BidirIter, | ||
| 407 | class _Tp, | ||
| 408 | class _Size = typename iterator_traits<_BidirIter>::difference_type> | ||
| 409 | _LIBCPP_HIDE_FROM_ABI constexpr void | ||
| 410 | __uninitialized_allocator_fill_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n, _Tp const& __value) { | ||
| 411 | using _ValueType = typename iterator_traits<_BidirIter>::value_type; | ||
| 412 | __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc); | ||
| 413 | _BidirIter __begin = __it; | ||
| 414 | |||
| 415 | // If an exception is thrown, destroy what we have constructed so far in reverse order. | ||
| 416 | auto __guard = | ||
| 417 | std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); | ||
| 418 | for (; __n != 0; --__n, ++__it) { | ||
| 419 | std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it), __value); | ||
| 420 | } | ||
| 421 | __guard.__complete(); | ||
| 422 | } | ||
| 423 | |||
| 424 | // Same as __uninitialized_allocator_fill_n_multidimensional, but doesn't pass any initialization argument | ||
| 425 | // to the allocator's construct method, which results in value initialization. | ||
| 426 | template <class _Alloc, class _BidirIter, class _Size = typename iterator_traits<_BidirIter>::difference_type> | ||
| 427 | _LIBCPP_HIDE_FROM_ABI constexpr void | ||
| 428 | __uninitialized_allocator_value_construct_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n) { | ||
| 429 | using _ValueType = typename iterator_traits<_BidirIter>::value_type; | ||
| 430 | __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc); | ||
| 431 | _BidirIter __begin = __it; | ||
| 432 | |||
| 433 | // If an exception is thrown, destroy what we have constructed so far in reverse order. | ||
| 434 | auto __guard = | ||
| 435 | std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); | ||
| 436 | for (; __n != 0; --__n, ++__it) { | ||
| 437 | std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it)); | ||
| 438 | } | ||
| 439 | __guard.__complete(); | ||
| 440 | } | 301 | } |
| 441 | 302 | ||
| 442 | #endif // _LIBCPP_STD_VER >= 17 | 303 | #endif // _LIBCPP_STD_VER >= 17 |
| ... | @@ -486,7 +347,7 @@ inline const bool __allocator_has_trivial_copy_construct_v<allocator<_Type>, _Ty | ... | @@ -486,7 +347,7 @@ inline const bool __allocator_has_trivial_copy_construct_v<allocator<_Type>, _Ty |
| 486 | template <class _Alloc, | 347 | template <class _Alloc, |
| 487 | class _In, | 348 | class _In, |
| 488 | class _Out, | 349 | class _Out, |
| 489 | __enable_if_t<is_trivially_copy_constructible<_In>::value && is_trivially_copy_assignable<_In>::value && | 350 | __enable_if_t<is_trivially_copy_constructible<_In>::value && is_trivially_assignable<_Out&, _In&>::value && |
| 490 | is_same<__remove_const_t<_In>, __remove_const_t<_Out> >::value && | 351 | is_same<__remove_const_t<_In>, __remove_const_t<_Out> >::value && |
| 491 | __allocator_has_trivial_copy_construct_v<_Alloc, _In>, | 352 | __allocator_has_trivial_copy_construct_v<_Alloc, _In>, |
| 492 | int> = 0> | 353 | int> = 0> |
lib/libcxx/include/__memory/uninitialized_multidimensional_algorithms.h created+194| ... | @@ -0,0 +1,194 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___MEMORY_UNINITIALIZED_MULTIDIMENSIONAL_ALGORITHMS_H | ||
| 10 | #define _LIBCPP___MEMORY_UNINITIALIZED_MULTIDIMENSIONAL_ALGORITHMS_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__cstddef/size_t.h> | ||
| 14 | #include <__iterator/iterator_traits.h> | ||
| 15 | #include <__memory/addressof.h> | ||
| 16 | #include <__memory/allocator_traits.h> | ||
| 17 | #include <__type_traits/enable_if.h> | ||
| 18 | #include <__type_traits/extent.h> | ||
| 19 | #include <__type_traits/is_array.h> | ||
| 20 | #include <__type_traits/is_same.h> | ||
| 21 | #include <__type_traits/remove_extent.h> | ||
| 22 | #include <__utility/exception_guard.h> | ||
| 23 | |||
| 24 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 25 | # pragma GCC system_header | ||
| 26 | #endif | ||
| 27 | |||
| 28 | _LIBCPP_PUSH_MACROS | ||
| 29 | #include <__undef_macros> | ||
| 30 | |||
| 31 | #if _LIBCPP_STD_VER >= 17 | ||
| 32 | |||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 34 | |||
| 35 | // TODO: Rewrite this to iterate left to right and use reverse_iterators when calling | ||
| 36 | // Destroys every element in the range [first, last) FROM RIGHT TO LEFT using allocator | ||
| 37 | // destruction. If elements are themselves C-style arrays, they are recursively destroyed | ||
| 38 | // in the same manner. | ||
| 39 | // | ||
| 40 | // This function assumes that destructors do not throw, and that the allocator is bound to | ||
| 41 | // the correct type. | ||
| 42 | template <class _Alloc, | ||
| 43 | class _BidirIter, | ||
| 44 | __enable_if_t<__has_bidirectional_iterator_category<_BidirIter>::value, int> = 0> | ||
| 45 | _LIBCPP_HIDE_FROM_ABI constexpr void | ||
| 46 | __allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter __first, _BidirIter __last) noexcept { | ||
| 47 | using _ValueType = typename iterator_traits<_BidirIter>::value_type; | ||
| 48 | static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _ValueType>, | ||
| 49 | "The allocator should already be rebound to the correct type"); | ||
| 50 | |||
| 51 | if (__first == __last) | ||
| 52 | return; | ||
| 53 | |||
| 54 | if constexpr (is_array_v<_ValueType>) { | ||
| 55 | static_assert(!__is_unbounded_array_v<_ValueType>, | ||
| 56 | "arrays of unbounded arrays don't exist, but if they did we would mess up here"); | ||
| 57 | |||
| 58 | using _Element = remove_extent_t<_ValueType>; | ||
| 59 | __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc); | ||
| 60 | do { | ||
| 61 | --__last; | ||
| 62 | decltype(auto) __array = *__last; | ||
| 63 | std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + extent_v<_ValueType>); | ||
| 64 | } while (__last != __first); | ||
| 65 | } else { | ||
| 66 | do { | ||
| 67 | --__last; | ||
| 68 | allocator_traits<_Alloc>::destroy(__alloc, std::addressof(*__last)); | ||
| 69 | } while (__last != __first); | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | // Constructs the object at the given location using the allocator's construct method. | ||
| 74 | // | ||
| 75 | // If the object being constructed is an array, each element of the array is allocator-constructed, | ||
| 76 | // recursively. If an exception is thrown during the construction of an array, the initialized | ||
| 77 | // elements are destroyed in reverse order of initialization using allocator destruction. | ||
| 78 | // | ||
| 79 | // This function assumes that the allocator is bound to the correct type. | ||
| 80 | template <class _Alloc, class _Tp> | ||
| 81 | _LIBCPP_HIDE_FROM_ABI constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc) { | ||
| 82 | static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>, | ||
| 83 | "The allocator should already be rebound to the correct type"); | ||
| 84 | |||
| 85 | if constexpr (is_array_v<_Tp>) { | ||
| 86 | using _Element = remove_extent_t<_Tp>; | ||
| 87 | __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc); | ||
| 88 | size_t __i = 0; | ||
| 89 | _Tp& __array = *__loc; | ||
| 90 | |||
| 91 | // If an exception is thrown, destroy what we have constructed so far in reverse order. | ||
| 92 | auto __guard = std::__make_exception_guard([&]() { | ||
| 93 | std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i); | ||
| 94 | }); | ||
| 95 | |||
| 96 | for (; __i != extent_v<_Tp>; ++__i) { | ||
| 97 | std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i])); | ||
| 98 | } | ||
| 99 | __guard.__complete(); | ||
| 100 | } else { | ||
| 101 | allocator_traits<_Alloc>::construct(__alloc, __loc); | ||
| 102 | } | ||
| 103 | } | ||
| 104 | |||
| 105 | // Constructs the object at the given location using the allocator's construct method, passing along | ||
| 106 | // the provided argument. | ||
| 107 | // | ||
| 108 | // If the object being constructed is an array, the argument is also assumed to be an array. Each | ||
| 109 | // each element of the array being constructed is allocator-constructed from the corresponding | ||
| 110 | // element of the argument array. If an exception is thrown during the construction of an array, | ||
| 111 | // the initialized elements are destroyed in reverse order of initialization using allocator | ||
| 112 | // destruction. | ||
| 113 | // | ||
| 114 | // This function assumes that the allocator is bound to the correct type. | ||
| 115 | template <class _Alloc, class _Tp, class _Arg> | ||
| 116 | _LIBCPP_HIDE_FROM_ABI constexpr void | ||
| 117 | __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc, _Arg const& __arg) { | ||
| 118 | static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>, | ||
| 119 | "The allocator should already be rebound to the correct type"); | ||
| 120 | |||
| 121 | if constexpr (is_array_v<_Tp>) { | ||
| 122 | static_assert(is_array_v<_Arg>, | ||
| 123 | "Provided non-array initialization argument to __allocator_construct_at_multidimensional when " | ||
| 124 | "trying to construct an array."); | ||
| 125 | |||
| 126 | using _Element = remove_extent_t<_Tp>; | ||
| 127 | __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc); | ||
| 128 | size_t __i = 0; | ||
| 129 | _Tp& __array = *__loc; | ||
| 130 | |||
| 131 | // If an exception is thrown, destroy what we have constructed so far in reverse order. | ||
| 132 | auto __guard = std::__make_exception_guard([&]() { | ||
| 133 | std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i); | ||
| 134 | }); | ||
| 135 | for (; __i != extent_v<_Tp>; ++__i) { | ||
| 136 | std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]), __arg[__i]); | ||
| 137 | } | ||
| 138 | __guard.__complete(); | ||
| 139 | } else { | ||
| 140 | allocator_traits<_Alloc>::construct(__alloc, __loc, __arg); | ||
| 141 | } | ||
| 142 | } | ||
| 143 | |||
| 144 | // Given a range starting at it and containing n elements, initializes each element in the | ||
| 145 | // range from left to right using the construct method of the allocator (rebound to the | ||
| 146 | // correct type). | ||
| 147 | // | ||
| 148 | // If an exception is thrown, the initialized elements are destroyed in reverse order of | ||
| 149 | // initialization using allocator_traits destruction. If the elements in the range are C-style | ||
| 150 | // arrays, they are initialized element-wise using allocator construction, and recursively so. | ||
| 151 | template <class _Alloc, | ||
| 152 | class _BidirIter, | ||
| 153 | class _Tp, | ||
| 154 | class _Size = typename iterator_traits<_BidirIter>::difference_type> | ||
| 155 | _LIBCPP_HIDE_FROM_ABI constexpr void | ||
| 156 | __uninitialized_allocator_fill_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n, _Tp const& __value) { | ||
| 157 | using _ValueType = typename iterator_traits<_BidirIter>::value_type; | ||
| 158 | __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc); | ||
| 159 | _BidirIter __begin = __it; | ||
| 160 | |||
| 161 | // If an exception is thrown, destroy what we have constructed so far in reverse order. | ||
| 162 | auto __guard = | ||
| 163 | std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); | ||
| 164 | for (; __n != 0; --__n, ++__it) { | ||
| 165 | std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it), __value); | ||
| 166 | } | ||
| 167 | __guard.__complete(); | ||
| 168 | } | ||
| 169 | |||
| 170 | // Same as __uninitialized_allocator_fill_n_multidimensional, but doesn't pass any initialization argument | ||
| 171 | // to the allocator's construct method, which results in value initialization. | ||
| 172 | template <class _Alloc, class _BidirIter, class _Size = typename iterator_traits<_BidirIter>::difference_type> | ||
| 173 | _LIBCPP_HIDE_FROM_ABI constexpr void | ||
| 174 | __uninitialized_allocator_value_construct_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n) { | ||
| 175 | using _ValueType = typename iterator_traits<_BidirIter>::value_type; | ||
| 176 | __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc); | ||
| 177 | _BidirIter __begin = __it; | ||
| 178 | |||
| 179 | // If an exception is thrown, destroy what we have constructed so far in reverse order. | ||
| 180 | auto __guard = | ||
| 181 | std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); | ||
| 182 | for (; __n != 0; --__n, ++__it) { | ||
| 183 | std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it)); | ||
| 184 | } | ||
| 185 | __guard.__complete(); | ||
| 186 | } | ||
| 187 | |||
| 188 | _LIBCPP_END_NAMESPACE_STD | ||
| 189 | |||
| 190 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 191 | |||
| 192 | _LIBCPP_POP_MACROS | ||
| 193 | |||
| 194 | #endif // _LIBCPP___MEMORY_UNINITIALIZED_MULTIDIMENSIONAL_ALGORITHMS_H | ||
lib/libcxx/include/__memory/unique_ptr.h+62-110| ... | @@ -27,7 +27,6 @@ | ... | @@ -27,7 +27,6 @@ |
| 27 | #include <__type_traits/add_reference.h> | 27 | #include <__type_traits/add_reference.h> |
| 28 | #include <__type_traits/common_type.h> | 28 | #include <__type_traits/common_type.h> |
| 29 | #include <__type_traits/conditional.h> | 29 | #include <__type_traits/conditional.h> |
| 30 | #include <__type_traits/dependent_type.h> | ||
| 31 | #include <__type_traits/enable_if.h> | 30 | #include <__type_traits/enable_if.h> |
| 32 | #include <__type_traits/integral_constant.h> | 31 | #include <__type_traits/integral_constant.h> |
| 33 | #include <__type_traits/is_array.h> | 32 | #include <__type_traits/is_array.h> |
| ... | @@ -43,7 +42,8 @@ | ... | @@ -43,7 +42,8 @@ |
| 43 | #include <__type_traits/is_trivially_relocatable.h> | 42 | #include <__type_traits/is_trivially_relocatable.h> |
| 44 | #include <__type_traits/is_void.h> | 43 | #include <__type_traits/is_void.h> |
| 45 | #include <__type_traits/remove_extent.h> | 44 | #include <__type_traits/remove_extent.h> |
| 46 | #include <__type_traits/type_identity.h> | 45 | #include <__type_traits/remove_reference.h> |
| 46 | #include <__type_traits/void_t.h> | ||
| 47 | #include <__utility/declval.h> | 47 | #include <__utility/declval.h> |
| 48 | #include <__utility/forward.h> | 48 | #include <__utility/forward.h> |
| 49 | #include <__utility/move.h> | 49 | #include <__utility/move.h> |
| ... | @@ -95,27 +95,17 @@ inline const bool __is_default_deleter_v = false; | ... | @@ -95,27 +95,17 @@ inline const bool __is_default_deleter_v = false; |
| 95 | template <class _Tp> | 95 | template <class _Tp> |
| 96 | inline const bool __is_default_deleter_v<default_delete<_Tp> > = true; | 96 | inline const bool __is_default_deleter_v<default_delete<_Tp> > = true; |
| 97 | 97 | ||
| 98 | template <class _Deleter> | 98 | template <class, class = void> |
| 99 | struct __unique_ptr_deleter_sfinae { | 99 | inline const bool __can_dereference = false; |
| 100 | static_assert(!is_reference<_Deleter>::value, "incorrect specialization"); | ||
| 101 | typedef const _Deleter& __lval_ref_type; | ||
| 102 | typedef _Deleter&& __good_rval_ref_type; | ||
| 103 | typedef true_type __enable_rval_overload; | ||
| 104 | }; | ||
| 105 | 100 | ||
| 106 | template <class _Deleter> | 101 | template <class _Tp> |
| 107 | struct __unique_ptr_deleter_sfinae<_Deleter const&> { | 102 | inline const bool __can_dereference<_Tp, decltype((void)*std::declval<_Tp>())> = true; |
| 108 | typedef const _Deleter& __lval_ref_type; | ||
| 109 | typedef const _Deleter&& __bad_rval_ref_type; | ||
| 110 | typedef false_type __enable_rval_overload; | ||
| 111 | }; | ||
| 112 | 103 | ||
| 113 | template <class _Deleter> | 104 | template <class _Tp, class = void> |
| 114 | struct __unique_ptr_deleter_sfinae<_Deleter&> { | 105 | inline const bool __can_add_pointer = false; |
| 115 | typedef _Deleter& __lval_ref_type; | 106 | |
| 116 | typedef _Deleter&& __bad_rval_ref_type; | 107 | template <class _Tp> |
| 117 | typedef false_type __enable_rval_overload; | 108 | inline const bool __can_add_pointer<_Tp, __void_t<_Tp*> > = true; |
| 118 | }; | ||
| 119 | 109 | ||
| 120 | #if defined(_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI) | 110 | #if defined(_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI) |
| 121 | # define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI __attribute__((__trivial_abi__)) | 111 | # define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI __attribute__((__trivial_abi__)) |
| ... | @@ -125,13 +115,14 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> { | ... | @@ -125,13 +115,14 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> { |
| 125 | 115 | ||
| 126 | template <class _Tp, class _Dp = default_delete<_Tp> > | 116 | template <class _Tp, class _Dp = default_delete<_Tp> > |
| 127 | class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI unique_ptr { | 117 | class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI unique_ptr { |
| 118 | static_assert(__can_add_pointer<_Tp>, "unique_ptr<T, D> requires T* to be a valid type"); | ||
| 119 | static_assert(!is_rvalue_reference<_Dp>::value, "the specified deleter type cannot be an rvalue reference"); | ||
| 120 | |||
| 128 | public: | 121 | public: |
| 129 | typedef _Tp element_type; | 122 | typedef _Tp element_type; |
| 130 | typedef _Dp deleter_type; | 123 | typedef _Dp deleter_type; |
| 131 | using pointer _LIBCPP_NODEBUG = __pointer<_Tp, deleter_type>; | 124 | using pointer _LIBCPP_NODEBUG = __pointer<_Tp, deleter_type>; |
| 132 | 125 | ||
| 133 | static_assert(!is_rvalue_reference<deleter_type>::value, "the specified deleter type cannot be an rvalue reference"); | ||
| 134 | |||
| 135 | // A unique_ptr contains the following members which may be trivially relocatable: | 126 | // A unique_ptr contains the following members which may be trivially relocatable: |
| 136 | // - pointer : this may be trivially relocatable, so it's checked | 127 | // - pointer : this may be trivially relocatable, so it's checked |
| 137 | // - deleter_type: this may be trivially relocatable, so it's checked | 128 | // - deleter_type: this may be trivially relocatable, so it's checked |
| ... | @@ -146,24 +137,6 @@ public: | ... | @@ -146,24 +137,6 @@ public: |
| 146 | private: | 137 | private: |
| 147 | _LIBCPP_COMPRESSED_PAIR(pointer, __ptr_, deleter_type, __deleter_); | 138 | _LIBCPP_COMPRESSED_PAIR(pointer, __ptr_, deleter_type, __deleter_); |
| 148 | 139 | ||
| 149 | using _DeleterSFINAE _LIBCPP_NODEBUG = __unique_ptr_deleter_sfinae<_Dp>; | ||
| 150 | |||
| 151 | template <bool _Dummy> | ||
| 152 | using _LValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type; | ||
| 153 | |||
| 154 | template <bool _Dummy> | ||
| 155 | using _GoodRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type; | ||
| 156 | |||
| 157 | template <bool _Dummy> | ||
| 158 | using _BadRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; | ||
| 159 | |||
| 160 | template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type> | ||
| 161 | using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG = | ||
| 162 | __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>; | ||
| 163 | |||
| 164 | template <class _ArgType> | ||
| 165 | using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = __enable_if_t<is_constructible<deleter_type, _ArgType>::value>; | ||
| 166 | |||
| 167 | template <class _UPtr, class _Up> | 140 | template <class _UPtr, class _Up> |
| 168 | using _EnableIfMoveConvertible _LIBCPP_NODEBUG = | 141 | using _EnableIfMoveConvertible _LIBCPP_NODEBUG = |
| 169 | __enable_if_t< is_convertible<typename _UPtr::pointer, pointer>::value && !is_array<_Up>::value >; | 142 | __enable_if_t< is_convertible<typename _UPtr::pointer, pointer>::value && !is_array<_Up>::value >; |
| ... | @@ -177,31 +150,33 @@ private: | ... | @@ -177,31 +150,33 @@ private: |
| 177 | using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value >; | 150 | using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value >; |
| 178 | 151 | ||
| 179 | public: | 152 | public: |
| 180 | template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > | 153 | template <class _Deleter = deleter_type, |
| 154 | __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0> | ||
| 181 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(), __deleter_() {} | 155 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(), __deleter_() {} |
| 182 | 156 | ||
| 183 | template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > | 157 | template <class _Deleter = deleter_type, |
| 158 | __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0> | ||
| 184 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(), __deleter_() {} | 159 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(), __deleter_() {} |
| 185 | 160 | ||
| 186 | template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > | 161 | template <class _Deleter = deleter_type, |
| 162 | __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0> | ||
| 187 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT | 163 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT |
| 188 | : __ptr_(__p), | 164 | : __ptr_(__p), |
| 189 | __deleter_() {} | 165 | __deleter_() {} |
| 190 | 166 | ||
| 191 | template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > | 167 | template <class _Deleter = deleter_type, __enable_if_t<is_copy_constructible<_Deleter>::value, int> = 0> |
| 192 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT | 168 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, const deleter_type& __d) _NOEXCEPT |
| 193 | : __ptr_(__p), | 169 | : __ptr_(__p), |
| 194 | __deleter_(__d) {} | 170 | __deleter_(__d) {} |
| 195 | 171 | ||
| 196 | template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > | 172 | template <class _Deleter = deleter_type, |
| 197 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT | 173 | __enable_if_t<!is_reference<_Deleter>::value && is_move_constructible<_Deleter>::value, int> = 0> |
| 174 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, deleter_type&& __d) _NOEXCEPT | ||
| 198 | : __ptr_(__p), | 175 | : __ptr_(__p), |
| 199 | __deleter_(std::move(__d)) { | 176 | __deleter_(std::move(__d)) {} |
| 200 | static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); | ||
| 201 | } | ||
| 202 | 177 | ||
| 203 | template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > > | 178 | template <class _Deleter = deleter_type, __enable_if_t<is_reference<_Deleter>::value, int> = 0> |
| 204 | _LIBCPP_HIDE_FROM_ABI unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete; | 179 | _LIBCPP_HIDE_FROM_ABI unique_ptr(pointer, __libcpp_remove_reference_t<deleter_type>&&) = delete; |
| 205 | 180 | ||
| 206 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT | 181 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT |
| 207 | : __ptr_(__u.release()), | 182 | : __ptr_(__u.release()), |
| ... | @@ -222,7 +197,7 @@ public: | ... | @@ -222,7 +197,7 @@ public: |
| 222 | #endif | 197 | #endif |
| 223 | 198 | ||
| 224 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { | 199 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { |
| 225 | reset(__u.release()); | 200 | reset(__u.release()); // NOLINT(misc-uniqueptr-reset-release) |
| 226 | __deleter_ = std::forward<deleter_type>(__u.get_deleter()); | 201 | __deleter_ = std::forward<deleter_type>(__u.get_deleter()); |
| 227 | return *this; | 202 | return *this; |
| 228 | } | 203 | } |
| ... | @@ -258,6 +233,7 @@ public: | ... | @@ -258,6 +233,7 @@ public: |
| 258 | return *this; | 233 | return *this; |
| 259 | } | 234 | } |
| 260 | 235 | ||
| 236 | template <class _Ptr = pointer, __enable_if_t<__can_dereference<_Ptr>, int> = 0> | ||
| 261 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const | 237 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const |
| 262 | _NOEXCEPT_(_NOEXCEPT_(*std::declval<pointer>())) { | 238 | _NOEXCEPT_(_NOEXCEPT_(*std::declval<pointer>())) { |
| 263 | return *__ptr_; | 239 | return *__ptr_; |
| ... | @@ -434,27 +410,6 @@ private: | ... | @@ -434,27 +410,6 @@ private: |
| 434 | (is_same<pointer, element_type*>::value && | 410 | (is_same<pointer, element_type*>::value && |
| 435 | is_convertible<_FromElem (*)[], element_type (*)[]>::value) > {}; | 411 | is_convertible<_FromElem (*)[], element_type (*)[]>::value) > {}; |
| 436 | 412 | ||
| 437 | typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE; | ||
| 438 | |||
| 439 | template <bool _Dummy> | ||
| 440 | using _LValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type; | ||
| 441 | |||
| 442 | template <bool _Dummy> | ||
| 443 | using _GoodRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type; | ||
| 444 | |||
| 445 | template <bool _Dummy> | ||
| 446 | using _BadRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; | ||
| 447 | |||
| 448 | template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type> | ||
| 449 | using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG = | ||
| 450 | __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>; | ||
| 451 | |||
| 452 | template <class _ArgType> | ||
| 453 | using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = __enable_if_t<is_constructible<deleter_type, _ArgType>::value>; | ||
| 454 | |||
| 455 | template <class _Pp> | ||
| 456 | using _EnableIfPointerConvertible _LIBCPP_NODEBUG = __enable_if_t< _CheckArrayPointerConversion<_Pp>::value >; | ||
| 457 | |||
| 458 | template <class _UPtr, class _Up, class _ElemT = typename _UPtr::element_type> | 413 | template <class _UPtr, class _Up, class _ElemT = typename _UPtr::element_type> |
| 459 | using _EnableIfMoveConvertible _LIBCPP_NODEBUG = | 414 | using _EnableIfMoveConvertible _LIBCPP_NODEBUG = |
| 460 | __enable_if_t< is_array<_Up>::value && is_same<pointer, element_type*>::value && | 415 | __enable_if_t< is_array<_Up>::value && is_same<pointer, element_type*>::value && |
| ... | @@ -470,17 +425,19 @@ private: | ... | @@ -470,17 +425,19 @@ private: |
| 470 | using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value >; | 425 | using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value >; |
| 471 | 426 | ||
| 472 | public: | 427 | public: |
| 473 | template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > | 428 | template <class _Deleter = deleter_type, |
| 429 | __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0> | ||
| 474 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(), __deleter_() {} | 430 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(), __deleter_() {} |
| 475 | 431 | ||
| 476 | template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > | 432 | template <class _Deleter = deleter_type, |
| 433 | __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0> | ||
| 477 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(), __deleter_() {} | 434 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(), __deleter_() {} |
| 478 | 435 | ||
| 479 | template <class _Pp, | 436 | template <class _Ptr, |
| 480 | bool _Dummy = true, | 437 | class _Deleter = deleter_type, |
| 481 | class = _EnableIfDeleterDefaultConstructible<_Dummy>, | 438 | __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0, |
| 482 | class = _EnableIfPointerConvertible<_Pp> > | 439 | __enable_if_t<_CheckArrayPointerConversion<_Ptr>::value, int> = 0> |
| 483 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(_Pp __ptr) _NOEXCEPT | 440 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(_Ptr __ptr) _NOEXCEPT |
| 484 | : __ptr_(__ptr), | 441 | : __ptr_(__ptr), |
| 485 | __deleter_() {} | 442 | __deleter_() {} |
| 486 | 443 | ||
| ... | @@ -490,43 +447,38 @@ public: | ... | @@ -490,43 +447,38 @@ public: |
| 490 | : __ptr_(__ptr), | 447 | : __ptr_(__ptr), |
| 491 | __checker_(__size) {} | 448 | __checker_(__size) {} |
| 492 | 449 | ||
| 493 | template <class _Pp, | 450 | template <class _Ptr, |
| 494 | bool _Dummy = true, | 451 | class _Deleter = deleter_type, |
| 495 | class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >, | 452 | __enable_if_t<is_copy_constructible<_Deleter>::value, int> = 0, |
| 496 | class = _EnableIfPointerConvertible<_Pp> > | 453 | __enable_if_t<_CheckArrayPointerConversion<_Ptr>::value, int> = 0> |
| 497 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __ptr, _LValRefType<_Dummy> __deleter) _NOEXCEPT | 454 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Ptr __ptr, const deleter_type& __deleter) _NOEXCEPT |
| 498 | : __ptr_(__ptr), | 455 | : __ptr_(__ptr), |
| 499 | __deleter_(__deleter) {} | 456 | __deleter_(__deleter) {} |
| 500 | 457 | ||
| 501 | template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > | 458 | template <class _Deleter = deleter_type, __enable_if_t<is_copy_constructible<_Deleter>::value, int> = 0> |
| 502 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _LValRefType<_Dummy> __deleter) _NOEXCEPT | 459 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, const deleter_type& __deleter) _NOEXCEPT |
| 503 | : __ptr_(nullptr), | 460 | : __ptr_(nullptr), |
| 504 | __deleter_(__deleter) {} | 461 | __deleter_(__deleter) {} |
| 505 | 462 | ||
| 506 | template <class _Pp, | 463 | template <class _Ptr, |
| 507 | bool _Dummy = true, | 464 | class _Deleter = deleter_type, |
| 508 | class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> >, | 465 | __enable_if_t<!is_reference<_Deleter>::value && is_move_constructible<_Deleter>::value, int> = 0, |
| 509 | class = _EnableIfPointerConvertible<_Pp> > | 466 | __enable_if_t<_CheckArrayPointerConversion<_Ptr>::value, int> = 0> |
| 510 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | 467 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Ptr __ptr, deleter_type&& __deleter) _NOEXCEPT |
| 511 | unique_ptr(_Pp __ptr, _GoodRValRefType<_Dummy> __deleter) _NOEXCEPT | ||
| 512 | : __ptr_(__ptr), | 468 | : __ptr_(__ptr), |
| 513 | __deleter_(std::move(__deleter)) { | 469 | __deleter_(std::move(__deleter)) {} |
| 514 | static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); | ||
| 515 | } | ||
| 516 | 470 | ||
| 517 | template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > | 471 | template <class _Deleter = deleter_type, |
| 518 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | 472 | __enable_if_t<!is_reference<_Deleter>::value && is_move_constructible<_Deleter>::value, int> = 0> |
| 519 | unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __deleter) _NOEXCEPT | 473 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, deleter_type&& __deleter) _NOEXCEPT |
| 520 | : __ptr_(nullptr), | 474 | : __ptr_(nullptr), |
| 521 | __deleter_(std::move(__deleter)) { | 475 | __deleter_(std::move(__deleter)) {} |
| 522 | static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); | ||
| 523 | } | ||
| 524 | 476 | ||
| 525 | template <class _Pp, | 477 | template <class _Ptr, |
| 526 | bool _Dummy = true, | 478 | class _Deleter = deleter_type, |
| 527 | class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >, | 479 | __enable_if_t<is_reference<_Deleter>::value, int> = 0, |
| 528 | class = _EnableIfPointerConvertible<_Pp> > | 480 | __enable_if_t<_CheckArrayPointerConversion<_Ptr>::value, int> = 0> |
| 529 | _LIBCPP_HIDE_FROM_ABI unique_ptr(_Pp __ptr, _BadRValRefType<_Dummy> __deleter) = delete; | 481 | _LIBCPP_HIDE_FROM_ABI unique_ptr(_Ptr, __libcpp_remove_reference_t<deleter_type>&&) = delete; |
| 530 | 482 | ||
| 531 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT | 483 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT |
| 532 | : __ptr_(__u.release()), | 484 | : __ptr_(__u.release()), |
| ... | @@ -534,7 +486,7 @@ public: | ... | @@ -534,7 +486,7 @@ public: |
| 534 | __checker_(std::move(__u.__checker_)) {} | 486 | __checker_(std::move(__u.__checker_)) {} |
| 535 | 487 | ||
| 536 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { | 488 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { |
| 537 | reset(__u.release()); | 489 | reset(__u.release()); // NOLINT(misc-uniqueptr-reset-release) |
| 538 | __deleter_ = std::forward<deleter_type>(__u.get_deleter()); | 490 | __deleter_ = std::forward<deleter_type>(__u.get_deleter()); |
| 539 | __checker_ = std::move(__u.__checker_); | 491 | __checker_ = std::move(__u.__checker_); |
| 540 | return *this; | 492 | return *this; |
lib/libcxx/include/__memory/uses_allocator_construction.h+6-6| ... | @@ -27,10 +27,10 @@ | ... | @@ -27,10 +27,10 @@ |
| 27 | _LIBCPP_PUSH_MACROS | 27 | _LIBCPP_PUSH_MACROS |
| 28 | #include <__undef_macros> | 28 | #include <__undef_macros> |
| 29 | 29 | ||
| 30 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 31 | |||
| 32 | #if _LIBCPP_STD_VER >= 17 | 30 | #if _LIBCPP_STD_VER >= 17 |
| 33 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | |||
| 34 | template <class _Tp> | 34 | template <class _Tp> |
| 35 | inline constexpr bool __is_cv_std_pair = __is_pair_v<remove_cv_t<_Tp>>; | 35 | inline constexpr bool __is_cv_std_pair = __is_pair_v<remove_cv_t<_Tp>>; |
| 36 | 36 | ||
| ... | @@ -202,9 +202,7 @@ __uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _ | ... | @@ -202,9 +202,7 @@ __uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _ |
| 202 | __uses_allocator_construction_args<_Type>::__apply(__alloc, std::forward<_Args>(__args)...)); | 202 | __uses_allocator_construction_args<_Type>::__apply(__alloc, std::forward<_Args>(__args)...)); |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | #endif // _LIBCPP_STD_VER >= 17 | 205 | # if _LIBCPP_STD_VER >= 20 |
| 206 | |||
| 207 | #if _LIBCPP_STD_VER >= 20 | ||
| 208 | 206 | ||
| 209 | template <class _Type, class _Alloc, class... _Args> | 207 | template <class _Type, class _Alloc, class... _Args> |
| 210 | _LIBCPP_HIDE_FROM_ABI constexpr auto uses_allocator_construction_args(const _Alloc& __alloc, _Args&&... __args) noexcept | 208 | _LIBCPP_HIDE_FROM_ABI constexpr auto uses_allocator_construction_args(const _Alloc& __alloc, _Args&&... __args) noexcept |
| ... | @@ -225,10 +223,12 @@ uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _Ar | ... | @@ -225,10 +223,12 @@ uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _Ar |
| 225 | return /*--*/ std::__uninitialized_construct_using_allocator(__ptr, __alloc, std::forward<_Args>(__args)...); | 223 | return /*--*/ std::__uninitialized_construct_using_allocator(__ptr, __alloc, std::forward<_Args>(__args)...); |
| 226 | } | 224 | } |
| 227 | 225 | ||
| 228 | #endif // _LIBCPP_STD_VER >= 20 | 226 | # endif // _LIBCPP_STD_VER >= 20 |
| 229 | 227 | ||
| 230 | _LIBCPP_END_NAMESPACE_STD | 228 | _LIBCPP_END_NAMESPACE_STD |
| 231 | 229 | ||
| 230 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 231 | |||
| 232 | _LIBCPP_POP_MACROS | 232 | _LIBCPP_POP_MACROS |
| 233 | 233 | ||
| 234 | #endif // _LIBCPP___MEMORY_USES_ALLOCATOR_CONSTRUCTION_H | 234 | #endif // _LIBCPP___MEMORY_USES_ALLOCATOR_CONSTRUCTION_H |
lib/libcxx/include/__memory/valid_range.h created+74| ... | @@ -0,0 +1,74 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___MEMORY_VALID_RANGE_H | ||
| 10 | #define _LIBCPP___MEMORY_VALID_RANGE_H | ||
| 11 | |||
| 12 | #include <__algorithm/comp.h> | ||
| 13 | #include <__assert> | ||
| 14 | #include <__config> | ||
| 15 | #include <__iterator/iterator_traits.h> | ||
| 16 | #include <__memory/assume_aligned.h> | ||
| 17 | #include <__memory/pointer_traits.h> | ||
| 18 | #include <__type_traits/is_constant_evaluated.h> | ||
| 19 | #include <__type_traits/is_same.h> | ||
| 20 | #include <__type_traits/remove_cvref.h> | ||
| 21 | |||
| 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 23 | # pragma GCC system_header | ||
| 24 | #endif | ||
| 25 | |||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 27 | |||
| 28 | // A valid range as defined by the C++ Standard has the following constraints: | ||
| 29 | // - [__first, __last) is dereferenceable | ||
| 30 | // - __last is reachable from __first | ||
| 31 | // - if __first and __last are contiguous iterators, the pointers they "decay to" are correctly aligned according to the | ||
| 32 | // language rules for pointers | ||
| 33 | |||
| 34 | // This function attempts to detect invalid ranges as defined above. Specifically, it checks bullet (2). This also means | ||
| 35 | // that it doesn't return whether a range is actually valid, but only whether a range is definitely not valid. | ||
| 36 | // The checks may be extended in the future. | ||
| 37 | template <class _Tp> | ||
| 38 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool | ||
| 39 | __is_valid_range(const _Tp* __first, const _Tp* __last) { | ||
| 40 | if (__libcpp_is_constant_evaluated()) { | ||
| 41 | // If this is not a constant during constant evaluation, that is because __first and __last are not | ||
| 42 | // part of the same allocation. If they are part of the same allocation, we must still make sure they | ||
| 43 | // are ordered properly. | ||
| 44 | return __builtin_constant_p(__first <= __last) && __first <= __last; | ||
| 45 | } | ||
| 46 | |||
| 47 | return !__less<>()(__last, __first); | ||
| 48 | } | ||
| 49 | |||
| 50 | // This function allows the compiler to assume that [__first, __last) is a valid range as defined above. | ||
| 51 | // | ||
| 52 | // In practice, we only add explicit assumptions for bullets (1) and (3). These assumptions allow (currently only | ||
| 53 | // clang-based compilers) to auto-vectorize algorithms that contain early returns. | ||
| 54 | template <class _Iter, class _Sent> | ||
| 55 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void | ||
| 56 | __assume_valid_range([[__maybe_unused__]] _Iter&& __first, [[__maybe_unused__]] _Sent&& __last) { | ||
| 57 | #if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2300 && !defined(_LIBCPP_CXX03_LANG) | ||
| 58 | if constexpr (__libcpp_is_contiguous_iterator<__remove_cvref_t<_Iter>>::value && | ||
| 59 | is_same<__remove_cvref_t<_Iter>, __remove_cvref_t<_Sent>>::value) { | ||
| 60 | _LIBCPP_ASSERT_INTERNAL(std::__is_valid_range(std::__to_address(__first), std::__to_address(__last)), | ||
| 61 | "Valid range assumption does not hold"); | ||
| 62 | if (!__libcpp_is_constant_evaluated()) { | ||
| 63 | using __value_type = typename iterator_traits<__remove_cvref_t<_Iter>>::value_type; | ||
| 64 | __builtin_assume_dereferenceable(std::__to_address(__first), (__last - __first) * sizeof(__value_type)); | ||
| 65 | (void)std::__assume_aligned<_LIBCPP_ALIGNOF(__value_type)>(std::__to_address(__first)); | ||
| 66 | (void)std::__assume_aligned<_LIBCPP_ALIGNOF(__value_type)>(std::__to_address(__last)); | ||
| 67 | } | ||
| 68 | } | ||
| 69 | #endif | ||
| 70 | } | ||
| 71 | |||
| 72 | _LIBCPP_END_NAMESPACE_STD | ||
| 73 | |||
| 74 | #endif // _LIBCPP___MEMORY_VALID_RANGE_H | ||
lib/libcxx/include/__memory_resource/memory_resource.h+2| ... | @@ -21,6 +21,7 @@ | ... | @@ -21,6 +21,7 @@ |
| 21 | #if _LIBCPP_STD_VER >= 17 | 21 | #if _LIBCPP_STD_VER >= 17 |
| 22 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 24 | 25 | ||
| 25 | namespace pmr { | 26 | namespace pmr { |
| 26 | 27 | ||
| ... | @@ -84,6 +85,7 @@ null_memory_resource() noexcept; | ... | @@ -84,6 +85,7 @@ null_memory_resource() noexcept; |
| 84 | 85 | ||
| 85 | } // namespace pmr | 86 | } // namespace pmr |
| 86 | 87 | ||
| 88 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 87 | _LIBCPP_END_NAMESPACE_STD | 89 | _LIBCPP_END_NAMESPACE_STD |
| 88 | 90 | ||
| 89 | #endif // _LIBCPP_STD_VER >= 17 | 91 | #endif // _LIBCPP_STD_VER >= 17 |
lib/libcxx/include/__memory_resource/monotonic_buffer_resource.h+2| ... | @@ -21,6 +21,7 @@ | ... | @@ -21,6 +21,7 @@ |
| 21 | #if _LIBCPP_STD_VER >= 17 | 21 | #if _LIBCPP_STD_VER >= 17 |
| 22 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 24 | 25 | ||
| 25 | namespace pmr { | 26 | namespace pmr { |
| 26 | 27 | ||
| ... | @@ -112,6 +113,7 @@ private: | ... | @@ -112,6 +113,7 @@ private: |
| 112 | 113 | ||
| 113 | } // namespace pmr | 114 | } // namespace pmr |
| 114 | 115 | ||
| 116 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 115 | _LIBCPP_END_NAMESPACE_STD | 117 | _LIBCPP_END_NAMESPACE_STD |
| 116 | 118 | ||
| 117 | #endif // _LIBCPP_STD_VER >= 17 | 119 | #endif // _LIBCPP_STD_VER >= 17 |
lib/libcxx/include/__memory_resource/synchronized_pool_resource.h+2| ... | @@ -24,6 +24,7 @@ | ... | @@ -24,6 +24,7 @@ |
| 24 | #if _LIBCPP_STD_VER >= 17 | 24 | #if _LIBCPP_STD_VER >= 17 |
| 25 | 25 | ||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 27 | 28 | ||
| 28 | namespace pmr { | 29 | namespace pmr { |
| 29 | 30 | ||
| ... | @@ -88,6 +89,7 @@ private: | ... | @@ -88,6 +89,7 @@ private: |
| 88 | 89 | ||
| 89 | } // namespace pmr | 90 | } // namespace pmr |
| 90 | 91 | ||
| 92 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 91 | _LIBCPP_END_NAMESPACE_STD | 93 | _LIBCPP_END_NAMESPACE_STD |
| 92 | 94 | ||
| 93 | #endif // _LIBCPP_STD_VER >= 17 | 95 | #endif // _LIBCPP_STD_VER >= 17 |
lib/libcxx/include/__memory_resource/unsynchronized_pool_resource.h+2| ... | @@ -22,6 +22,7 @@ | ... | @@ -22,6 +22,7 @@ |
| 22 | #if _LIBCPP_STD_VER >= 17 | 22 | #if _LIBCPP_STD_VER >= 17 |
| 23 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | 24 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 25 | 26 | ||
| 26 | namespace pmr { | 27 | namespace pmr { |
| 27 | 28 | ||
| ... | @@ -99,6 +100,7 @@ private: | ... | @@ -99,6 +100,7 @@ private: |
| 99 | 100 | ||
| 100 | } // namespace pmr | 101 | } // namespace pmr |
| 101 | 102 | ||
| 103 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 102 | _LIBCPP_END_NAMESPACE_STD | 104 | _LIBCPP_END_NAMESPACE_STD |
| 103 | 105 | ||
| 104 | #endif // _LIBCPP_STD_VER >= 17 | 106 | #endif // _LIBCPP_STD_VER >= 17 |
lib/libcxx/include/__mutex/lock_guard.h+1-1| ... | @@ -34,7 +34,7 @@ public: | ... | @@ -34,7 +34,7 @@ public: |
| 34 | 34 | ||
| 35 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_REQUIRES_CAPABILITY(__m) | 35 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_REQUIRES_CAPABILITY(__m) |
| 36 | : __m_(__m) {} | 36 | : __m_(__m) {} |
| 37 | _LIBCPP_RELEASE_CAPABILITY _LIBCPP_HIDE_FROM_ABI ~lock_guard() { __m_.unlock(); } | 37 | _LIBCPP_RELEASE_CAPABILITY() _LIBCPP_HIDE_FROM_ABI ~lock_guard() { __m_.unlock(); } |
| 38 | 38 | ||
| 39 | lock_guard(lock_guard const&) = delete; | 39 | lock_guard(lock_guard const&) = delete; |
| 40 | lock_guard& operator=(lock_guard const&) = delete; | 40 | lock_guard& operator=(lock_guard const&) = delete; |
lib/libcxx/include/__mutex/mutex.h+3-1| ... | @@ -20,6 +20,7 @@ | ... | @@ -20,6 +20,7 @@ |
| 20 | #if _LIBCPP_HAS_THREADS | 20 | #if _LIBCPP_HAS_THREADS |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 23 | 24 | ||
| 24 | class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_CAPABILITY("mutex") mutex { | 25 | class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_CAPABILITY("mutex") mutex { |
| 25 | __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER; | 26 | __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER; |
| ... | @@ -38,7 +39,7 @@ public: | ... | @@ -38,7 +39,7 @@ public: |
| 38 | 39 | ||
| 39 | _LIBCPP_ACQUIRE_CAPABILITY() void lock(); | 40 | _LIBCPP_ACQUIRE_CAPABILITY() void lock(); |
| 40 | [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) bool try_lock() _NOEXCEPT; | 41 | [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) bool try_lock() _NOEXCEPT; |
| 41 | _LIBCPP_RELEASE_CAPABILITY void unlock() _NOEXCEPT; | 42 | _LIBCPP_RELEASE_CAPABILITY() void unlock() _NOEXCEPT; |
| 42 | 43 | ||
| 43 | typedef __libcpp_mutex_t* native_handle_type; | 44 | typedef __libcpp_mutex_t* native_handle_type; |
| 44 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__m_; } | 45 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__m_; } |
| ... | @@ -46,6 +47,7 @@ public: | ... | @@ -46,6 +47,7 @@ public: |
| 46 | 47 | ||
| 47 | static_assert(is_nothrow_default_constructible<mutex>::value, "the default constructor for std::mutex must be nothrow"); | 48 | static_assert(is_nothrow_default_constructible<mutex>::value, "the default constructor for std::mutex must be nothrow"); |
| 48 | 49 | ||
| 50 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 49 | _LIBCPP_END_NAMESPACE_STD | 51 | _LIBCPP_END_NAMESPACE_STD |
| 50 | 52 | ||
| 51 | #endif // _LIBCPP_HAS_THREADS | 53 | #endif // _LIBCPP_HAS_THREADS |
lib/libcxx/include/__mutex/once_flag.h+2| ... | @@ -113,7 +113,9 @@ void _LIBCPP_HIDE_FROM_ABI __call_once_proxy(void* __vp) { | ... | @@ -113,7 +113,9 @@ void _LIBCPP_HIDE_FROM_ABI __call_once_proxy(void* __vp) { |
| 113 | (*__p)(); | 113 | (*__p)(); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 116 | _LIBCPP_EXPORTED_FROM_ABI void __call_once(volatile once_flag::_State_type&, void*, void (*)(void*)); | 117 | _LIBCPP_EXPORTED_FROM_ABI void __call_once(volatile once_flag::_State_type&, void*, void (*)(void*)); |
| 118 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 117 | 119 | ||
| 118 | template <class _ValueType> | 120 | template <class _ValueType> |
| 119 | inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_acquire_load(_ValueType const* __value) { | 121 | inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_acquire_load(_ValueType const* __value) { |
lib/libcxx/include/__mutex/unique_lock.h+5-5| ... | @@ -84,13 +84,13 @@ public: | ... | @@ -84,13 +84,13 @@ public: |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI void lock(); | 86 | _LIBCPP_HIDE_FROM_ABI void lock(); |
| 87 | _LIBCPP_HIDE_FROM_ABI bool try_lock(); | 87 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock(); |
| 88 | 88 | ||
| 89 | template <class _Rep, class _Period> | 89 | template <class _Rep, class _Period> |
| 90 | _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d); | 90 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d); |
| 91 | 91 | ||
| 92 | template <class _Clock, class _Duration> | 92 | template <class _Clock, class _Duration> |
| 93 | _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); | 93 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); |
| 94 | 94 | ||
| 95 | _LIBCPP_HIDE_FROM_ABI void unlock(); | 95 | _LIBCPP_HIDE_FROM_ABI void unlock(); |
| 96 | 96 | ||
| ... | @@ -106,9 +106,9 @@ public: | ... | @@ -106,9 +106,9 @@ public: |
| 106 | return __m; | 106 | return __m; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | _LIBCPP_HIDE_FROM_ABI bool owns_lock() const _NOEXCEPT { return __owns_; } | 109 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool owns_lock() const _NOEXCEPT { return __owns_; } |
| 110 | _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __owns_; } | 110 | _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __owns_; } |
| 111 | _LIBCPP_HIDE_FROM_ABI mutex_type* mutex() const _NOEXCEPT { return __m_; } | 111 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mutex_type* mutex() const _NOEXCEPT { return __m_; } |
| 112 | }; | 112 | }; |
| 113 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(unique_lock); | 113 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(unique_lock); |
| 114 | 114 |
lib/libcxx/include/__new/exceptions.h+3| ... | @@ -24,6 +24,8 @@ | ... | @@ -24,6 +24,8 @@ |
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD | 26 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD |
| 27 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 28 | |||
| 27 | #if !defined(_LIBCPP_ABI_VCRUNTIME) | 29 | #if !defined(_LIBCPP_ABI_VCRUNTIME) |
| 28 | 30 | ||
| 29 | class _LIBCPP_EXPORTED_FROM_ABI bad_alloc : public exception { | 31 | class _LIBCPP_EXPORTED_FROM_ABI bad_alloc : public exception { |
| ... | @@ -74,6 +76,7 @@ public: | ... | @@ -74,6 +76,7 @@ public: |
| 74 | _LIBCPP_VERBOSE_ABORT("bad_array_new_length was thrown in -fno-exceptions mode"); | 76 | _LIBCPP_VERBOSE_ABORT("bad_array_new_length was thrown in -fno-exceptions mode"); |
| 75 | #endif | 77 | #endif |
| 76 | } | 78 | } |
| 79 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 77 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | 80 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD |
| 78 | 81 | ||
| 79 | #endif // _LIBCPP___NEW_EXCEPTIONS_H | 82 | #endif // _LIBCPP___NEW_EXCEPTIONS_H |
lib/libcxx/include/__new/new_handler.h+4| ... | @@ -19,9 +19,13 @@ | ... | @@ -19,9 +19,13 @@ |
| 19 | # include <new.h> | 19 | # include <new.h> |
| 20 | #else | 20 | #else |
| 21 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD |
| 22 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 23 | |||
| 22 | typedef void (*new_handler)(); | 24 | typedef void (*new_handler)(); |
| 23 | _LIBCPP_EXPORTED_FROM_ABI new_handler set_new_handler(new_handler) _NOEXCEPT; | 25 | _LIBCPP_EXPORTED_FROM_ABI new_handler set_new_handler(new_handler) _NOEXCEPT; |
| 24 | _LIBCPP_EXPORTED_FROM_ABI new_handler get_new_handler() _NOEXCEPT; | 26 | _LIBCPP_EXPORTED_FROM_ABI new_handler get_new_handler() _NOEXCEPT; |
| 27 | |||
| 28 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 25 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | 29 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD |
| 26 | #endif // _LIBCPP_ABI_VCRUNTIME | 30 | #endif // _LIBCPP_ABI_VCRUNTIME |
| 27 | 31 |
lib/libcxx/include/__new/placement_new_delete.h+2-2| ... | @@ -27,8 +27,8 @@ operator new(std::size_t, void* __p) _NOEXCEPT { | ... | @@ -27,8 +27,8 @@ operator new(std::size_t, void* __p) _NOEXCEPT { |
| 27 | operator new[](std::size_t, void* __p) _NOEXCEPT { | 27 | operator new[](std::size_t, void* __p) _NOEXCEPT { |
| 28 | return __p; | 28 | return __p; |
| 29 | } | 29 | } |
| 30 | inline _LIBCPP_HIDE_FROM_ABI void operator delete(void*, void*) _NOEXCEPT {} | 30 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator delete(void*, void*) _NOEXCEPT {} |
| 31 | inline _LIBCPP_HIDE_FROM_ABI void operator delete[](void*, void*) _NOEXCEPT {} | 31 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator delete[](void*, void*) _NOEXCEPT {} |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
| 34 | #endif // _LIBCPP___NEW_PLACEMENT_NEW_DELETE_H | 34 | #endif // _LIBCPP___NEW_PLACEMENT_NEW_DELETE_H |
lib/libcxx/include/__node_handle+37-36| ... | @@ -31,29 +31,29 @@ private: | ... | @@ -31,29 +31,29 @@ private: |
| 31 | public: | 31 | public: |
| 32 | // [container.node.cons], constructors, copy, and assignment | 32 | // [container.node.cons], constructors, copy, and assignment |
| 33 | constexpr node-handle() noexcept : ptr_(), alloc_() {} | 33 | constexpr node-handle() noexcept : ptr_(), alloc_() {} |
| 34 | node-handle(node-handle&&) noexcept; | 34 | constexpr node-handle(node-handle&&) noexcept; // constexpr since C++26 |
| 35 | node-handle& operator=(node-handle&&); | 35 | constexpr node-handle& operator=(node-handle&&); // constexpr since C++26 |
| 36 | 36 | ||
| 37 | // [container.node.dtor], destructor | 37 | // [container.node.dtor], destructor |
| 38 | ~node-handle(); | 38 | constexpr ~node-handle(); // constexpr since C++26 |
| 39 | 39 | ||
| 40 | // [container.node.observers], observers | 40 | // [container.node.observers], observers |
| 41 | value_type& value() const; // not present for map containers | 41 | value_type& value() const; // not present for map containers |
| 42 | key_type& key() const; // not present for set containers | 42 | key_type& key() const; // not present for set containers |
| 43 | mapped_type& mapped() const; // not present for set containers | 43 | constexpr mapped_type& mapped() const; // not present for set containers, constexpr since C++26 |
| 44 | 44 | ||
| 45 | allocator_type get_allocator() const; | 45 | constexpr allocator_type get_allocator() const; // constexpr since C++26 |
| 46 | explicit operator bool() const noexcept; | 46 | constexpr explicit operator bool() const noexcept; // constexpr since C++26 |
| 47 | [[nodiscard]] bool empty() const noexcept; // nodiscard since C++20 | 47 | [[nodiscard]] constexpr bool empty() const noexcept; // nodiscard since C++20, constexpr since C++26 |
| 48 | 48 | ||
| 49 | // [container.node.modifiers], modifiers | 49 | // [container.node.modifiers], modifiers |
| 50 | void swap(node-handle&) | 50 | constexpr void swap(node-handle&) |
| 51 | noexcept(ator_traits::propagate_on_container_swap::value || | 51 | noexcept(ator_traits::propagate_on_container_swap::value || |
| 52 | ator_traits::is_always_equal::value); | 52 | ator_traits::is_always_equal::value); // constexpr since C++26 |
| 53 | 53 | ||
| 54 | friend void swap(node-handle& x, node-handle& y) noexcept(noexcept(x.swap(y))) { | 54 | constexpr friend void swap(node-handle& x, node-handle& y) noexcept(noexcept(x.swap(y))) { |
| 55 | x.swap(y); | 55 | x.swap(y); |
| 56 | } | 56 | } // constexpr since C++26 |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | */ | 59 | */ |
| ... | @@ -63,6 +63,7 @@ public: | ... | @@ -63,6 +63,7 @@ public: |
| 63 | #include <__memory/allocator_traits.h> | 63 | #include <__memory/allocator_traits.h> |
| 64 | #include <__memory/pointer_traits.h> | 64 | #include <__memory/pointer_traits.h> |
| 65 | #include <__type_traits/is_specialization.h> | 65 | #include <__type_traits/is_specialization.h> |
| 66 | #include <__utility/exchange.h> | ||
| 66 | #include <optional> | 67 | #include <optional> |
| 67 | 68 | ||
| 68 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 69 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | @@ -72,10 +73,10 @@ public: | ... | @@ -72,10 +73,10 @@ public: |
| 72 | _LIBCPP_PUSH_MACROS | 73 | _LIBCPP_PUSH_MACROS |
| 73 | #include <__undef_macros> | 74 | #include <__undef_macros> |
| 74 | 75 | ||
| 75 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 76 | |||
| 77 | #if _LIBCPP_STD_VER >= 17 | 76 | #if _LIBCPP_STD_VER >= 17 |
| 78 | 77 | ||
| 78 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 79 | |||
| 79 | // Specialized in __tree & __hash_table for their _NodeType. | 80 | // Specialized in __tree & __hash_table for their _NodeType. |
| 80 | template <class _NodeType, class _Alloc> | 81 | template <class _NodeType, class _Alloc> |
| 81 | struct __generic_container_node_destructor; | 82 | struct __generic_container_node_destructor; |
| ... | @@ -99,12 +100,12 @@ private: | ... | @@ -99,12 +100,12 @@ private: |
| 99 | __node_pointer_type __ptr_ = nullptr; | 100 | __node_pointer_type __ptr_ = nullptr; |
| 100 | optional<allocator_type> __alloc_; | 101 | optional<allocator_type> __alloc_; |
| 101 | 102 | ||
| 102 | _LIBCPP_HIDE_FROM_ABI void __release_ptr() { | 103 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __release_ptr() { |
| 103 | __ptr_ = nullptr; | 104 | __ptr_ = nullptr; |
| 104 | __alloc_ = std::nullopt; | 105 | __alloc_ = std::nullopt; |
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | _LIBCPP_HIDE_FROM_ABI void __destroy_node_pointer() { | 108 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __destroy_node_pointer() { |
| 108 | if (__ptr_ != nullptr) { | 109 | if (__ptr_ != nullptr) { |
| 109 | typedef typename __allocator_traits_rebind< allocator_type, _NodeType>::type __node_alloc_type; | 110 | typedef typename __allocator_traits_rebind< allocator_type, _NodeType>::type __node_alloc_type; |
| 110 | __node_alloc_type __alloc(*__alloc_); | 111 | __node_alloc_type __alloc(*__alloc_); |
| ... | @@ -113,19 +114,17 @@ private: | ... | @@ -113,19 +114,17 @@ private: |
| 113 | } | 114 | } |
| 114 | } | 115 | } |
| 115 | 116 | ||
| 116 | _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__node_pointer_type __ptr, allocator_type const& __alloc) | 117 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 118 | __basic_node_handle(__node_pointer_type __ptr, allocator_type const& __alloc) | ||
| 117 | : __ptr_(__ptr), __alloc_(__alloc) {} | 119 | : __ptr_(__ptr), __alloc_(__alloc) {} |
| 118 | 120 | ||
| 119 | public: | 121 | public: |
| 120 | _LIBCPP_HIDE_FROM_ABI __basic_node_handle() = default; | 122 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle() = default; |
| 121 | 123 | ||
| 122 | _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__basic_node_handle&& __other) noexcept | 124 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle(__basic_node_handle&& __other) noexcept |
| 123 | : __ptr_(__other.__ptr_), __alloc_(std::move(__other.__alloc_)) { | 125 | : __ptr_(std::exchange(__other.__ptr_, nullptr)), __alloc_(std::exchange(__other.__alloc_, std::nullopt)) {} |
| 124 | __other.__ptr_ = nullptr; | ||
| 125 | __other.__alloc_ = std::nullopt; | ||
| 126 | } | ||
| 127 | 126 | ||
| 128 | _LIBCPP_HIDE_FROM_ABI __basic_node_handle& operator=(__basic_node_handle&& __other) { | 127 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle& operator=(__basic_node_handle&& __other) { |
| 129 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 128 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 130 | __alloc_ == std::nullopt || __alloc_traits::propagate_on_container_move_assignment::value || | 129 | __alloc_ == std::nullopt || __alloc_traits::propagate_on_container_move_assignment::value || |
| 131 | __alloc_ == __other.__alloc_, | 130 | __alloc_ == __other.__alloc_, |
| ... | @@ -133,24 +132,23 @@ public: | ... | @@ -133,24 +132,23 @@ public: |
| 133 | "node_type::operator=(node_type&&)"); | 132 | "node_type::operator=(node_type&&)"); |
| 134 | 133 | ||
| 135 | __destroy_node_pointer(); | 134 | __destroy_node_pointer(); |
| 136 | __ptr_ = __other.__ptr_; | 135 | __ptr_ = std::exchange(__other.__ptr_, nullptr); |
| 137 | 136 | ||
| 138 | if (__alloc_traits::propagate_on_container_move_assignment::value || __alloc_ == std::nullopt) | 137 | if (__alloc_traits::propagate_on_container_move_assignment::value || __alloc_ == std::nullopt) |
| 139 | __alloc_ = std::move(__other.__alloc_); | 138 | __alloc_ = std::move(__other.__alloc_); |
| 140 | 139 | ||
| 141 | __other.__ptr_ = nullptr; | ||
| 142 | __other.__alloc_ = std::nullopt; | 140 | __other.__alloc_ = std::nullopt; |
| 143 | 141 | ||
| 144 | return *this; | 142 | return *this; |
| 145 | } | 143 | } |
| 146 | 144 | ||
| 147 | _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return *__alloc_; } | 145 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const { return *__alloc_; } |
| 148 | 146 | ||
| 149 | _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ptr_ != nullptr; } | 147 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit operator bool() const { return __ptr_ != nullptr; } |
| 150 | 148 | ||
| 151 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return __ptr_ == nullptr; } | 149 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const { return __ptr_ == nullptr; } |
| 152 | 150 | ||
| 153 | _LIBCPP_HIDE_FROM_ABI void swap(__basic_node_handle& __other) noexcept( | 151 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(__basic_node_handle& __other) noexcept( |
| 154 | __alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value) { | 152 | __alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value) { |
| 155 | using std::swap; | 153 | using std::swap; |
| 156 | swap(__ptr_, __other.__ptr_); | 154 | swap(__ptr_, __other.__ptr_); |
| ... | @@ -159,19 +157,21 @@ public: | ... | @@ -159,19 +157,21 @@ public: |
| 159 | swap(__alloc_, __other.__alloc_); | 157 | swap(__alloc_, __other.__alloc_); |
| 160 | } | 158 | } |
| 161 | 159 | ||
| 162 | _LIBCPP_HIDE_FROM_ABI friend void | 160 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 friend void |
| 163 | swap(__basic_node_handle& __a, __basic_node_handle& __b) noexcept(noexcept(__a.swap(__b))) { | 161 | swap(__basic_node_handle& __a, __basic_node_handle& __b) noexcept(noexcept(__a.swap(__b))) { |
| 164 | __a.swap(__b); | 162 | __a.swap(__b); |
| 165 | } | 163 | } |
| 166 | 164 | ||
| 167 | _LIBCPP_HIDE_FROM_ABI ~__basic_node_handle() { __destroy_node_pointer(); } | 165 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__basic_node_handle() { __destroy_node_pointer(); } |
| 168 | }; | 166 | }; |
| 169 | 167 | ||
| 170 | template <class _NodeType, class _Derived> | 168 | template <class _NodeType, class _Derived> |
| 171 | struct __set_node_handle_specifics { | 169 | struct __set_node_handle_specifics { |
| 172 | typedef typename _NodeType::__node_value_type value_type; | 170 | typedef typename _NodeType::__node_value_type value_type; |
| 173 | 171 | ||
| 174 | _LIBCPP_HIDE_FROM_ABI value_type& value() const { return static_cast<_Derived const*>(this)->__ptr_->__get_value(); } | 172 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_type& value() const { |
| 173 | return static_cast<_Derived const*>(this)->__ptr_->__get_value(); | ||
| 174 | } | ||
| 175 | }; | 175 | }; |
| 176 | 176 | ||
| 177 | template <class _NodeType, class _Derived> | 177 | template <class _NodeType, class _Derived> |
| ... | @@ -179,6 +179,7 @@ struct __map_node_handle_specifics { | ... | @@ -179,6 +179,7 @@ struct __map_node_handle_specifics { |
| 179 | using key_type = __remove_const_t<typename _NodeType::__node_value_type::first_type>; | 179 | using key_type = __remove_const_t<typename _NodeType::__node_value_type::first_type>; |
| 180 | using mapped_type = typename _NodeType::__node_value_type::second_type; | 180 | using mapped_type = typename _NodeType::__node_value_type::second_type; |
| 181 | 181 | ||
| 182 | // This method is not constexpr as per the standard. | ||
| 182 | _LIBCPP_HIDE_FROM_ABI key_type& key() const { | 183 | _LIBCPP_HIDE_FROM_ABI key_type& key() const { |
| 183 | return const_cast<key_type&>(static_cast<_Derived const*>(this)->__ptr_->__get_value().first); | 184 | return const_cast<key_type&>(static_cast<_Derived const*>(this)->__ptr_->__get_value().first); |
| 184 | } | 185 | } |
| ... | @@ -201,10 +202,10 @@ struct __insert_return_type { | ... | @@ -201,10 +202,10 @@ struct __insert_return_type { |
| 201 | _NodeType node; | 202 | _NodeType node; |
| 202 | }; | 203 | }; |
| 203 | 204 | ||
| 204 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 205 | |||
| 206 | _LIBCPP_END_NAMESPACE_STD | 205 | _LIBCPP_END_NAMESPACE_STD |
| 207 | 206 | ||
| 207 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 208 | |||
| 208 | _LIBCPP_POP_MACROS | 209 | _LIBCPP_POP_MACROS |
| 209 | 210 | ||
| 210 | #endif // _LIBCPP___NODE_HANDLE | 211 | #endif // _LIBCPP___NODE_HANDLE |
lib/libcxx/include/__numeric/accumulate.h+2-2| ... | @@ -23,7 +23,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -23,7 +23,7 @@ _LIBCPP_PUSH_MACROS |
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | ||
| 25 | template <class _InputIterator, class _Tp> | 25 | template <class _InputIterator, class _Tp> |
| 26 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp | 26 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp |
| 27 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) { | 27 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) { |
| 28 | for (; __first != __last; ++__first) | 28 | for (; __first != __last; ++__first) |
| 29 | #if _LIBCPP_STD_VER >= 20 | 29 | #if _LIBCPP_STD_VER >= 20 |
| ... | @@ -35,7 +35,7 @@ accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) { | ... | @@ -35,7 +35,7 @@ accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) { |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | template <class _InputIterator, class _Tp, class _BinaryOperation> | 37 | template <class _InputIterator, class _Tp, class _BinaryOperation> |
| 38 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp | 38 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp |
| 39 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) { | 39 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) { |
| 40 | for (; __first != __last; ++__first) | 40 | for (; __first != __last; ++__first) |
| 41 | #if _LIBCPP_STD_VER >= 20 | 41 | #if _LIBCPP_STD_VER >= 20 |
lib/libcxx/include/__numeric/gcd_lcm.h+2-2| ... | @@ -47,7 +47,7 @@ constexpr _LIBCPP_HIDE_FROM_ABI _Result __abs_in_type(_Source __t) noexcept { | ... | @@ -47,7 +47,7 @@ constexpr _LIBCPP_HIDE_FROM_ABI _Result __abs_in_type(_Source __t) noexcept { |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | template <class _Tp, class _Up> | 49 | template <class _Tp, class _Up> |
| 50 | constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) { | 50 | [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) { |
| 51 | static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to gcd must be integer types"); | 51 | static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to gcd must be integer types"); |
| 52 | static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to gcd cannot be bool"); | 52 | static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to gcd cannot be bool"); |
| 53 | static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to gcd cannot be bool"); | 53 | static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to gcd cannot be bool"); |
| ... | @@ -95,7 +95,7 @@ constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) { | ... | @@ -95,7 +95,7 @@ constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) { |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | template <class _Tp, class _Up> | 97 | template <class _Tp, class _Up> |
| 98 | constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up __n) { | 98 | [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up __n) { |
| 99 | static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to lcm must be integer types"); | 99 | static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to lcm must be integer types"); |
| 100 | static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to lcm cannot be bool"); | 100 | static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to lcm cannot be bool"); |
| 101 | static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to lcm cannot be bool"); | 101 | static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to lcm cannot be bool"); |
lib/libcxx/include/__numeric/inner_product.h+2-2| ... | @@ -23,7 +23,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -23,7 +23,7 @@ _LIBCPP_PUSH_MACROS |
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | ||
| 25 | template <class _InputIterator1, class _InputIterator2, class _Tp> | 25 | template <class _InputIterator1, class _InputIterator2, class _Tp> |
| 26 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp | 26 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp |
| 27 | inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { | 27 | inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { |
| 28 | for (; __first1 != __last1; ++__first1, (void)++__first2) | 28 | for (; __first1 != __last1; ++__first1, (void)++__first2) |
| 29 | #if _LIBCPP_STD_VER >= 20 | 29 | #if _LIBCPP_STD_VER >= 20 |
| ... | @@ -35,7 +35,7 @@ inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 | ... | @@ -35,7 +35,7 @@ inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2> | 37 | template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2> |
| 38 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp inner_product( | 38 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp inner_product( |
| 39 | _InputIterator1 __first1, | 39 | _InputIterator1 __first1, |
| 40 | _InputIterator1 __last1, | 40 | _InputIterator1 __last1, |
| 41 | _InputIterator2 __first2, | 41 | _InputIterator2 __first2, |
lib/libcxx/include/__numeric/pstl.h+6-6| ... | @@ -41,7 +41,7 @@ template <class _ExecutionPolicy, | ... | @@ -41,7 +41,7 @@ template <class _ExecutionPolicy, |
| 41 | class _BinaryOperation, | 41 | class _BinaryOperation, |
| 42 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, | 42 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, |
| 43 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> | 43 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> |
| 44 | _LIBCPP_HIDE_FROM_ABI _Tp reduce( | 44 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Tp reduce( |
| 45 | _ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init, _BinaryOperation __op) { | 45 | _ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init, _BinaryOperation __op) { |
| 46 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators"); | 46 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators"); |
| 47 | using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>; | 47 | using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>; |
| ... | @@ -58,7 +58,7 @@ template <class _ExecutionPolicy, | ... | @@ -58,7 +58,7 @@ template <class _ExecutionPolicy, |
| 58 | class _Tp, | 58 | class _Tp, |
| 59 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, | 59 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, |
| 60 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> | 60 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> |
| 61 | _LIBCPP_HIDE_FROM_ABI _Tp | 61 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Tp |
| 62 | reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init) { | 62 | reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init) { |
| 63 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators"); | 63 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators"); |
| 64 | using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>; | 64 | using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>; |
| ... | @@ -70,7 +70,7 @@ template <class _ExecutionPolicy, | ... | @@ -70,7 +70,7 @@ template <class _ExecutionPolicy, |
| 70 | class _ForwardIterator, | 70 | class _ForwardIterator, |
| 71 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, | 71 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, |
| 72 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> | 72 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> |
| 73 | _LIBCPP_HIDE_FROM_ABI __iterator_value_type<_ForwardIterator> | 73 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __iterator_value_type<_ForwardIterator> |
| 74 | reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last) { | 74 | reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last) { |
| 75 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators"); | 75 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators"); |
| 76 | using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>; | 76 | using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>; |
| ... | @@ -90,7 +90,7 @@ template <class _ExecutionPolicy, | ... | @@ -90,7 +90,7 @@ template <class _ExecutionPolicy, |
| 90 | class _BinaryOperation2, | 90 | class _BinaryOperation2, |
| 91 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, | 91 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, |
| 92 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> | 92 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> |
| 93 | _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce( | 93 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce( |
| 94 | _ExecutionPolicy&& __policy, | 94 | _ExecutionPolicy&& __policy, |
| 95 | _ForwardIterator1 __first1, | 95 | _ForwardIterator1 __first1, |
| 96 | _ForwardIterator1 __last1, | 96 | _ForwardIterator1 __last1, |
| ... | @@ -120,7 +120,7 @@ template <class _ExecutionPolicy, | ... | @@ -120,7 +120,7 @@ template <class _ExecutionPolicy, |
| 120 | class _Tp, | 120 | class _Tp, |
| 121 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, | 121 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, |
| 122 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> | 122 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> |
| 123 | _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce( | 123 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce( |
| 124 | _ExecutionPolicy&& __policy, | 124 | _ExecutionPolicy&& __policy, |
| 125 | _ForwardIterator1 __first1, | 125 | _ForwardIterator1 __first1, |
| 126 | _ForwardIterator1 __last1, | 126 | _ForwardIterator1 __last1, |
| ... | @@ -147,7 +147,7 @@ template <class _ExecutionPolicy, | ... | @@ -147,7 +147,7 @@ template <class _ExecutionPolicy, |
| 147 | class _UnaryOperation, | 147 | class _UnaryOperation, |
| 148 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, | 148 | class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, |
| 149 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> | 149 | enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> |
| 150 | _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce( | 150 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce( |
| 151 | _ExecutionPolicy&& __policy, | 151 | _ExecutionPolicy&& __policy, |
| 152 | _ForwardIterator __first, | 152 | _ForwardIterator __first, |
| 153 | _ForwardIterator __last, | 153 | _ForwardIterator __last, |
lib/libcxx/include/__numeric/ranges_iota.h+4-3| ... | @@ -26,9 +26,10 @@ | ... | @@ -26,9 +26,10 @@ |
| 26 | _LIBCPP_PUSH_MACROS | 26 | _LIBCPP_PUSH_MACROS |
| 27 | #include <__undef_macros> | 27 | #include <__undef_macros> |
| 28 | 28 | ||
| 29 | #if _LIBCPP_STD_VER >= 23 | ||
| 30 | |||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | 31 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 32 | ||
| 31 | #if _LIBCPP_STD_VER >= 23 | ||
| 32 | namespace ranges { | 33 | namespace ranges { |
| 33 | template <typename _Out, typename _Tp> | 34 | template <typename _Out, typename _Tp> |
| 34 | using iota_result = ranges::out_value_result<_Out, _Tp>; | 35 | using iota_result = ranges::out_value_result<_Out, _Tp>; |
| ... | @@ -56,10 +57,10 @@ public: | ... | @@ -56,10 +57,10 @@ public: |
| 56 | inline constexpr auto iota = __iota_fn{}; | 57 | inline constexpr auto iota = __iota_fn{}; |
| 57 | } // namespace ranges | 58 | } // namespace ranges |
| 58 | 59 | ||
| 59 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 60 | |||
| 61 | _LIBCPP_END_NAMESPACE_STD | 60 | _LIBCPP_END_NAMESPACE_STD |
| 62 | 61 | ||
| 62 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 63 | |||
| 63 | _LIBCPP_POP_MACROS | 64 | _LIBCPP_POP_MACROS |
| 64 | 65 | ||
| 65 | #endif // _LIBCPP___NUMERIC_RANGES_IOTA_H | 66 | #endif // _LIBCPP___NUMERIC_RANGES_IOTA_H |
lib/libcxx/include/__numeric/reduce.h+8-6| ... | @@ -22,32 +22,34 @@ | ... | @@ -22,32 +22,34 @@ |
| 22 | _LIBCPP_PUSH_MACROS | 22 | _LIBCPP_PUSH_MACROS |
| 23 | #include <__undef_macros> | 23 | #include <__undef_macros> |
| 24 | 24 | ||
| 25 | #if _LIBCPP_STD_VER >= 17 | ||
| 26 | |||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 28 | ||
| 27 | #if _LIBCPP_STD_VER >= 17 | ||
| 28 | template <class _InputIterator, class _Tp, class _BinaryOp> | 29 | template <class _InputIterator, class _Tp, class _BinaryOp> |
| 29 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp | 30 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI |
| 30 | reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) { | 31 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) { |
| 31 | for (; __first != __last; ++__first) | 32 | for (; __first != __last; ++__first) |
| 32 | __init = __b(std::move(__init), *__first); | 33 | __init = __b(std::move(__init), *__first); |
| 33 | return __init; | 34 | return __init; |
| 34 | } | 35 | } |
| 35 | 36 | ||
| 36 | template <class _InputIterator, class _Tp> | 37 | template <class _InputIterator, class _Tp> |
| 37 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp | 38 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp |
| 38 | reduce(_InputIterator __first, _InputIterator __last, _Tp __init) { | 39 | reduce(_InputIterator __first, _InputIterator __last, _Tp __init) { |
| 39 | return std::reduce(__first, __last, __init, std::plus<>()); | 40 | return std::reduce(__first, __last, __init, std::plus<>()); |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | template <class _InputIterator> | 43 | template <class _InputIterator> |
| 43 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename iterator_traits<_InputIterator>::value_type | 44 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename iterator_traits<_InputIterator>::value_type |
| 44 | reduce(_InputIterator __first, _InputIterator __last) { | 45 | reduce(_InputIterator __first, _InputIterator __last) { |
| 45 | return std::reduce(__first, __last, typename iterator_traits<_InputIterator>::value_type{}); | 46 | return std::reduce(__first, __last, typename iterator_traits<_InputIterator>::value_type{}); |
| 46 | } | 47 | } |
| 47 | #endif | ||
| 48 | 48 | ||
| 49 | _LIBCPP_END_NAMESPACE_STD | 49 | _LIBCPP_END_NAMESPACE_STD |
| 50 | 50 | ||
| 51 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 52 | |||
| 51 | _LIBCPP_POP_MACROS | 53 | _LIBCPP_POP_MACROS |
| 52 | 54 | ||
| 53 | #endif // _LIBCPP___NUMERIC_REDUCE_H | 55 | #endif // _LIBCPP___NUMERIC_REDUCE_H |
lib/libcxx/include/__numeric/saturation_arithmetic.h+15-15| ... | @@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | #if _LIBCPP_STD_VER >= 20 | 29 | #if _LIBCPP_STD_VER >= 20 |
| 30 | 30 | ||
| 31 | template <__signed_or_unsigned_integer _Tp> | 31 | template <__signed_or_unsigned_integer _Tp> |
| 32 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __add_sat(_Tp __x, _Tp __y) noexcept { | 32 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_add(_Tp __x, _Tp __y) noexcept { |
| 33 | # if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2101 | 33 | # if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2101 |
| 34 | return __builtin_elementwise_add_sat(__x, __y); | 34 | return __builtin_elementwise_add_sat(__x, __y); |
| 35 | # else | 35 | # else |
| ... | @@ -51,7 +51,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __add_sat(_Tp __x, _Tp __y) noexcept { | ... | @@ -51,7 +51,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __add_sat(_Tp __x, _Tp __y) noexcept { |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | template <__signed_or_unsigned_integer _Tp> | 53 | template <__signed_or_unsigned_integer _Tp> |
| 54 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __sub_sat(_Tp __x, _Tp __y) noexcept { | 54 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_sub(_Tp __x, _Tp __y) noexcept { |
| 55 | # if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2101 | 55 | # if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2101 |
| 56 | return __builtin_elementwise_sub_sat(__x, __y); | 56 | return __builtin_elementwise_sub_sat(__x, __y); |
| 57 | # else | 57 | # else |
| ... | @@ -74,7 +74,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __sub_sat(_Tp __x, _Tp __y) noexcept { | ... | @@ -74,7 +74,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __sub_sat(_Tp __x, _Tp __y) noexcept { |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | template <__signed_or_unsigned_integer _Tp> | 76 | template <__signed_or_unsigned_integer _Tp> |
| 77 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __mul_sat(_Tp __x, _Tp __y) noexcept { | 77 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_mul(_Tp __x, _Tp __y) noexcept { |
| 78 | if (_Tp __mul; !__builtin_mul_overflow(__x, __y, std::addressof(__mul))) | 78 | if (_Tp __mul; !__builtin_mul_overflow(__x, __y, std::addressof(__mul))) |
| 79 | return __mul; | 79 | return __mul; |
| 80 | // Handle overflow | 80 | // Handle overflow |
| ... | @@ -90,7 +90,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __mul_sat(_Tp __x, _Tp __y) noexcept { | ... | @@ -90,7 +90,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __mul_sat(_Tp __x, _Tp __y) noexcept { |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | template <__signed_or_unsigned_integer _Tp> | 92 | template <__signed_or_unsigned_integer _Tp> |
| 93 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __div_sat(_Tp __x, _Tp __y) noexcept { | 93 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_div(_Tp __x, _Tp __y) noexcept { |
| 94 | _LIBCPP_ASSERT_UNCATEGORIZED(__y != 0, "Division by 0 is undefined"); | 94 | _LIBCPP_ASSERT_UNCATEGORIZED(__y != 0, "Division by 0 is undefined"); |
| 95 | if constexpr (__unsigned_integer<_Tp>) { | 95 | if constexpr (__unsigned_integer<_Tp>) { |
| 96 | return __x / __y; | 96 | return __x / __y; |
| ... | @@ -103,7 +103,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __div_sat(_Tp __x, _Tp __y) noexcept { | ... | @@ -103,7 +103,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __div_sat(_Tp __x, _Tp __y) noexcept { |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | template <__signed_or_unsigned_integer _Rp, __signed_or_unsigned_integer _Tp> | 105 | template <__signed_or_unsigned_integer _Rp, __signed_or_unsigned_integer _Tp> |
| 106 | _LIBCPP_HIDE_FROM_ABI constexpr _Rp __saturate_cast(_Tp __x) noexcept { | 106 | _LIBCPP_HIDE_FROM_ABI constexpr _Rp __saturating_cast(_Tp __x) noexcept { |
| 107 | // Saturation is impossible edge case when ((min _Rp) < (min _Tp) && (max _Rp) > (max _Tp)) and it is expected to be | 107 | // Saturation is impossible edge case when ((min _Rp) < (min _Tp) && (max _Rp) > (max _Tp)) and it is expected to be |
| 108 | // optimized out by the compiler. | 108 | // optimized out by the compiler. |
| 109 | 109 | ||
| ... | @@ -121,28 +121,28 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Rp __saturate_cast(_Tp __x) noexcept { | ... | @@ -121,28 +121,28 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Rp __saturate_cast(_Tp __x) noexcept { |
| 121 | #if _LIBCPP_STD_VER >= 26 | 121 | #if _LIBCPP_STD_VER >= 26 |
| 122 | 122 | ||
| 123 | template <__signed_or_unsigned_integer _Tp> | 123 | template <__signed_or_unsigned_integer _Tp> |
| 124 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp add_sat(_Tp __x, _Tp __y) noexcept { | 124 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_add(_Tp __x, _Tp __y) noexcept { |
| 125 | return std::__add_sat(__x, __y); | 125 | return std::__saturating_add(__x, __y); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | template <__signed_or_unsigned_integer _Tp> | 128 | template <__signed_or_unsigned_integer _Tp> |
| 129 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp sub_sat(_Tp __x, _Tp __y) noexcept { | 129 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_sub(_Tp __x, _Tp __y) noexcept { |
| 130 | return std::__sub_sat(__x, __y); | 130 | return std::__saturating_sub(__x, __y); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | template <__signed_or_unsigned_integer _Tp> | 133 | template <__signed_or_unsigned_integer _Tp> |
| 134 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp mul_sat(_Tp __x, _Tp __y) noexcept { | 134 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_mul(_Tp __x, _Tp __y) noexcept { |
| 135 | return std::__mul_sat(__x, __y); | 135 | return std::__saturating_mul(__x, __y); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | template <__signed_or_unsigned_integer _Tp> | 138 | template <__signed_or_unsigned_integer _Tp> |
| 139 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp div_sat(_Tp __x, _Tp __y) noexcept { | 139 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_div(_Tp __x, _Tp __y) noexcept { |
| 140 | return std::__div_sat(__x, __y); | 140 | return std::__saturating_div(__x, __y); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | template <__signed_or_unsigned_integer _Rp, __signed_or_unsigned_integer _Tp> | 143 | template <__signed_or_unsigned_integer _Rp, __signed_or_unsigned_integer _Tp> |
| 144 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Rp saturate_cast(_Tp __x) noexcept { | 144 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Rp saturating_cast(_Tp __x) noexcept { |
| 145 | return std::__saturate_cast<_Rp>(__x); | 145 | return std::__saturating_cast<_Rp>(__x); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | #endif // _LIBCPP_STD_VER >= 26 | 148 | #endif // _LIBCPP_STD_VER >= 26 |
lib/libcxx/include/__numeric/transform_reduce.h+8-6| ... | @@ -21,19 +21,20 @@ | ... | @@ -21,19 +21,20 @@ |
| 21 | _LIBCPP_PUSH_MACROS | 21 | _LIBCPP_PUSH_MACROS |
| 22 | #include <__undef_macros> | 22 | #include <__undef_macros> |
| 23 | 23 | ||
| 24 | #if _LIBCPP_STD_VER >= 17 | ||
| 25 | |||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | 27 | ||
| 26 | #if _LIBCPP_STD_VER >= 17 | ||
| 27 | template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp> | 28 | template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp> |
| 28 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp | 29 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 |
| 29 | transform_reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b, _UnaryOp __u) { | 30 | _Tp transform_reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b, _UnaryOp __u) { |
| 30 | for (; __first != __last; ++__first) | 31 | for (; __first != __last; ++__first) |
| 31 | __init = __b(std::move(__init), __u(*__first)); | 32 | __init = __b(std::move(__init), __u(*__first)); |
| 32 | return __init; | 33 | return __init; |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOp1, class _BinaryOp2> | 36 | template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOp1, class _BinaryOp2> |
| 36 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce( | 37 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce( |
| 37 | _InputIterator1 __first1, | 38 | _InputIterator1 __first1, |
| 38 | _InputIterator1 __last1, | 39 | _InputIterator1 __last1, |
| 39 | _InputIterator2 __first2, | 40 | _InputIterator2 __first2, |
| ... | @@ -46,14 +47,15 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce( | ... | @@ -46,14 +47,15 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce( |
| 46 | } | 47 | } |
| 47 | 48 | ||
| 48 | template <class _InputIterator1, class _InputIterator2, class _Tp> | 49 | template <class _InputIterator1, class _InputIterator2, class _Tp> |
| 49 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp | 50 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp |
| 50 | transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { | 51 | transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { |
| 51 | return std::transform_reduce(__first1, __last1, __first2, std::move(__init), std::plus<>(), std::multiplies<>()); | 52 | return std::transform_reduce(__first1, __last1, __first2, std::move(__init), std::plus<>(), std::multiplies<>()); |
| 52 | } | 53 | } |
| 53 | #endif | ||
| 54 | 54 | ||
| 55 | _LIBCPP_END_NAMESPACE_STD | 55 | _LIBCPP_END_NAMESPACE_STD |
| 56 | 56 | ||
| 57 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 58 | |||
| 57 | _LIBCPP_POP_MACROS | 59 | _LIBCPP_POP_MACROS |
| 58 | 60 | ||
| 59 | #endif // _LIBCPP___NUMERIC_TRANSFORM_REDUCE_H | 61 | #endif // _LIBCPP___NUMERIC_TRANSFORM_REDUCE_H |
lib/libcxx/include/__ostream/basic_ostream.h+2| ... | @@ -41,6 +41,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -41,6 +41,7 @@ _LIBCPP_PUSH_MACROS |
| 41 | # include <__undef_macros> | 41 | # include <__undef_macros> |
| 42 | 42 | ||
| 43 | _LIBCPP_BEGIN_NAMESPACE_STD | 43 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 44 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 44 | 45 | ||
| 45 | template <class _CharT, class _Traits> | 46 | template <class _CharT, class _Traits> |
| 46 | class basic_ostream : virtual public basic_ios<_CharT, _Traits> { | 47 | class basic_ostream : virtual public basic_ios<_CharT, _Traits> { |
| ... | @@ -672,6 +673,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>; | ... | @@ -672,6 +673,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>; |
| 672 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>; | 673 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>; |
| 673 | # endif | 674 | # endif |
| 674 | 675 | ||
| 676 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 675 | _LIBCPP_END_NAMESPACE_STD | 677 | _LIBCPP_END_NAMESPACE_STD |
| 676 | 678 | ||
| 677 | _LIBCPP_POP_MACROS | 679 | _LIBCPP_POP_MACROS |
lib/libcxx/include/__ostream/print.h+8-9| ... | @@ -82,12 +82,14 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(ostream& __os, string_view _ | ... | @@ -82,12 +82,14 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(ostream& __os, string_view _ |
| 82 | // native Unicode API; | 82 | // native Unicode API; |
| 83 | // Whether the returned FILE* is "a terminal capable of displaying Unicode" | 83 | // Whether the returned FILE* is "a terminal capable of displaying Unicode" |
| 84 | // is determined in the same way as the print(FILE*, ...) overloads. | 84 | // is determined in the same way as the print(FILE*, ...) overloads. |
| 85 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 85 | _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os); | 86 | _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os); |
| 87 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 86 | 88 | ||
| 87 | # if _LIBCPP_HAS_UNICODE | 89 | # if _LIBCPP_HAS_UNICODE |
| 88 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | 90 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). |
| 89 | _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) { | 91 | _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) { |
| 90 | # if _LIBCPP_AVAILABILITY_HAS_PRINT == 0 | 92 | # ifndef _LIBCPP_WIN32API |
| 91 | return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl); | 93 | return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl); |
| 92 | # else | 94 | # else |
| 93 | FILE* __file = std::__get_ostream_file(__os); | 95 | FILE* __file = std::__get_ostream_file(__os); |
| ... | @@ -110,13 +112,10 @@ _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, fo | ... | @@ -110,13 +112,10 @@ _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, fo |
| 110 | # endif // _LIBCPP_HAS_EXCEPTIONS | 112 | # endif // _LIBCPP_HAS_EXCEPTIONS |
| 111 | ostream::sentry __s(__os); | 113 | ostream::sentry __s(__os); |
| 112 | if (__s) { | 114 | if (__s) { |
| 113 | # ifndef _LIBCPP_WIN32API | 115 | auto __result = std::vformat(__fmt, __args); |
| 114 | __print::__vprint_unicode_posix(__file, __fmt, __args, __write_nl, true); | 116 | if (__write_nl) |
| 115 | # elif _LIBCPP_HAS_WIDE_CHARACTERS | 117 | __result.push_back('\n'); |
| 116 | __print::__vprint_unicode_windows(__file, __fmt, __args, __write_nl, true); | 118 | __print::__output_unicode_windows(__file, __result); |
| 117 | # else | ||
| 118 | # error "Windows builds with wchar_t disabled are not supported." | ||
| 119 | # endif | ||
| 120 | } | 119 | } |
| 121 | 120 | ||
| 122 | # if _LIBCPP_HAS_EXCEPTIONS | 121 | # if _LIBCPP_HAS_EXCEPTIONS |
| ... | @@ -124,7 +123,7 @@ _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, fo | ... | @@ -124,7 +123,7 @@ _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, fo |
| 124 | __os.__set_badbit_and_consider_rethrow(); | 123 | __os.__set_badbit_and_consider_rethrow(); |
| 125 | } | 124 | } |
| 126 | # endif // _LIBCPP_HAS_EXCEPTIONS | 125 | # endif // _LIBCPP_HAS_EXCEPTIONS |
| 127 | # endif // _LIBCPP_AVAILABILITY_HAS_PRINT | 126 | # endif // _LIBCPP_WIN32API |
| 128 | } | 127 | } |
| 129 | 128 | ||
| 130 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | 129 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). |
lib/libcxx/include/__pstl/backend_fwd.h+20| ... | @@ -109,6 +109,13 @@ struct __is_partitioned; | ... | @@ -109,6 +109,13 @@ struct __is_partitioned; |
| 109 | // optional<bool> | 109 | // optional<bool> |
| 110 | // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept; | 110 | // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept; |
| 111 | 111 | ||
| 112 | template <class _Backend, class _ExecutionPolicy> | ||
| 113 | struct __find_first_of; | ||
| 114 | // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate> | ||
| 115 | // optional<_ForwardIterator1> | ||
| 116 | // operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, | ||
| 117 | // _ForwardIterator2 __first2, _ForwardIterator2 __last2, _Predicate __pred) const noexcept; | ||
| 118 | |||
| 112 | template <class _Backend, class _ExecutionPolicy> | 119 | template <class _Backend, class _ExecutionPolicy> |
| 113 | struct __for_each; | 120 | struct __for_each; |
| 114 | // template <class _Policy, class _ForwardIterator, class _Function> | 121 | // template <class _Policy, class _ForwardIterator, class _Function> |
| ... | @@ -159,6 +166,13 @@ struct __generate_n; | ... | @@ -159,6 +166,13 @@ struct __generate_n; |
| 159 | // optional<__empty> | 166 | // optional<__empty> |
| 160 | // operator()(_Policy&&, _ForwardIterator __first, _Size __n, _Generator __gen) const noexcept; | 167 | // operator()(_Policy&&, _ForwardIterator __first, _Size __n, _Generator __gen) const noexcept; |
| 161 | 168 | ||
| 169 | template <class _Backend, class _ExecutionPolicy> | ||
| 170 | struct __reverse_copy; | ||
| 171 | // template <class _Policy, class _BidirectionalIterator, class _ForwardIterator> | ||
| 172 | // optional<_ForwardIterator> | ||
| 173 | // operator()(_Policy&&, _BidirectionalIterator __first, _BidirectionalIterator __last, | ||
| 174 | // _ForwardIterator __result) const noexcept; | ||
| 175 | |||
| 162 | template <class _Backend, class _ExecutionPolicy> | 176 | template <class _Backend, class _ExecutionPolicy> |
| 163 | struct __merge; | 177 | struct __merge; |
| 164 | // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardOutIterator, class _Comp> | 178 | // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardOutIterator, class _Comp> |
| ... | @@ -297,6 +311,12 @@ struct __reduce; | ... | @@ -297,6 +311,12 @@ struct __reduce; |
| 297 | // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, | 311 | // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, |
| 298 | // _Tp __init, _BinaryOperation __op) const noexcept; | 312 | // _Tp __init, _BinaryOperation __op) const noexcept; |
| 299 | 313 | ||
| 314 | template <class _Backend, class _ExecutionPolicy> | ||
| 315 | struct __is_sorted; | ||
| 316 | // template <class _Policy, class _ForwardIterator, class _Comp> | ||
| 317 | // optional<bool> | ||
| 318 | // operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Comp&& __comp) const noexcept; | ||
| 319 | |||
| 300 | } // namespace __pstl | 320 | } // namespace __pstl |
| 301 | _LIBCPP_END_NAMESPACE_STD | 321 | _LIBCPP_END_NAMESPACE_STD |
| 302 | 322 |
lib/libcxx/include/__pstl/backends/default.h+78| ... | @@ -12,15 +12,21 @@ | ... | @@ -12,15 +12,21 @@ |
| 12 | #include <__algorithm/copy_n.h> | 12 | #include <__algorithm/copy_n.h> |
| 13 | #include <__algorithm/equal.h> | 13 | #include <__algorithm/equal.h> |
| 14 | #include <__algorithm/fill_n.h> | 14 | #include <__algorithm/fill_n.h> |
| 15 | #include <__algorithm/find.h> | ||
| 16 | #include <__algorithm/find_if.h> | ||
| 15 | #include <__algorithm/for_each_n.h> | 17 | #include <__algorithm/for_each_n.h> |
| 18 | #include <__algorithm/is_sorted.h> | ||
| 16 | #include <__config> | 19 | #include <__config> |
| 17 | #include <__functional/identity.h> | 20 | #include <__functional/identity.h> |
| 18 | #include <__functional/not_fn.h> | 21 | #include <__functional/not_fn.h> |
| 19 | #include <__functional/operations.h> | 22 | #include <__functional/operations.h> |
| 20 | #include <__iterator/concepts.h> | 23 | #include <__iterator/concepts.h> |
| 21 | #include <__iterator/iterator_traits.h> | 24 | #include <__iterator/iterator_traits.h> |
| 25 | #include <__iterator/next.h> | ||
| 26 | #include <__iterator/reverse_iterator.h> | ||
| 22 | #include <__pstl/backend_fwd.h> | 27 | #include <__pstl/backend_fwd.h> |
| 23 | #include <__pstl/dispatch.h> | 28 | #include <__pstl/dispatch.h> |
| 29 | #include <__type_traits/desugars_to.h> | ||
| 24 | #include <__utility/empty.h> | 30 | #include <__utility/empty.h> |
| 25 | #include <__utility/forward.h> | 31 | #include <__utility/forward.h> |
| 26 | #include <__utility/move.h> | 32 | #include <__utility/move.h> |
| ... | @@ -55,6 +61,7 @@ namespace __pstl { | ... | @@ -55,6 +61,7 @@ namespace __pstl { |
| 55 | // - all_of | 61 | // - all_of |
| 56 | // - none_of | 62 | // - none_of |
| 57 | // - is_partitioned | 63 | // - is_partitioned |
| 64 | // - find_first_of | ||
| 58 | // | 65 | // |
| 59 | // for_each family | 66 | // for_each family |
| 60 | // --------------- | 67 | // --------------- |
| ... | @@ -80,6 +87,7 @@ namespace __pstl { | ... | @@ -80,6 +87,7 @@ namespace __pstl { |
| 80 | // - count | 87 | // - count |
| 81 | // - equal(3 legs) | 88 | // - equal(3 legs) |
| 82 | // - equal | 89 | // - equal |
| 90 | // - is_sorted | ||
| 83 | // - reduce | 91 | // - reduce |
| 84 | // | 92 | // |
| 85 | // transform and transform_binary family | 93 | // transform and transform_binary family |
| ... | @@ -89,6 +97,7 @@ namespace __pstl { | ... | @@ -89,6 +97,7 @@ namespace __pstl { |
| 89 | // - move | 97 | // - move |
| 90 | // - copy | 98 | // - copy |
| 91 | // - copy_n | 99 | // - copy_n |
| 100 | // - reverse_copy | ||
| 92 | // - rotate_copy | 101 | // - rotate_copy |
| 93 | // | 102 | // |
| 94 | 103 | ||
| ... | @@ -178,6 +187,30 @@ struct __is_partitioned<__default_backend_tag, _ExecutionPolicy> { | ... | @@ -178,6 +187,30 @@ struct __is_partitioned<__default_backend_tag, _ExecutionPolicy> { |
| 178 | } | 187 | } |
| 179 | }; | 188 | }; |
| 180 | 189 | ||
| 190 | template <class _ExecutionPolicy> | ||
| 191 | struct __find_first_of<__default_backend_tag, _ExecutionPolicy> { | ||
| 192 | template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate> | ||
| 193 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator1> | ||
| 194 | operator()(_Policy&& __policy, | ||
| 195 | _ForwardIterator1 __first1, | ||
| 196 | _ForwardIterator1 __last1, | ||
| 197 | _ForwardIterator2 __first2, | ||
| 198 | _ForwardIterator2 __last2, | ||
| 199 | _Predicate&& __pred) const noexcept { | ||
| 200 | using _FindIf = __dispatch<__find_if, __current_configuration, _ExecutionPolicy>; | ||
| 201 | using _Ref1 = __iterator_reference<_ForwardIterator1>; | ||
| 202 | using _Ref2 = __iterator_reference<_ForwardIterator2>; | ||
| 203 | return _FindIf()(__policy, std::move(__first1), std::move(__last1), [&](_Ref1 __element) { | ||
| 204 | if constexpr (__desugars_to_v<__equal_tag, _Predicate, _Ref1, _Ref2>) { | ||
| 205 | // bypass an equality predicate and call directly to std::find() to allow more vectorization | ||
| 206 | return std::find(__first2, __last2, __element) != __last2; | ||
| 207 | } else { | ||
| 208 | return std::find_if(__first2, __last2, [&](_Ref2 __value) { return __pred(__element, __value); }) != __last2; | ||
| 209 | } | ||
| 210 | }); | ||
| 211 | } | ||
| 212 | }; | ||
| 213 | |||
| 181 | ////////////////////////////////////////////////////////////// | 214 | ////////////////////////////////////////////////////////////// |
| 182 | // for_each family | 215 | // for_each family |
| 183 | ////////////////////////////////////////////////////////////// | 216 | ////////////////////////////////////////////////////////////// |
| ... | @@ -388,6 +421,35 @@ struct __reduce<__default_backend_tag, _ExecutionPolicy> { | ... | @@ -388,6 +421,35 @@ struct __reduce<__default_backend_tag, _ExecutionPolicy> { |
| 388 | } | 421 | } |
| 389 | }; | 422 | }; |
| 390 | 423 | ||
| 424 | template <class _ExecutionPolicy> | ||
| 425 | struct __is_sorted<__default_backend_tag, _ExecutionPolicy> { | ||
| 426 | template <class _Policy, class _ForwardIterator, class _Comp> | ||
| 427 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool> | ||
| 428 | operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Comp&& __comp) const noexcept { | ||
| 429 | if constexpr (__has_bidirectional_iterator_category<_ForwardIterator>::value) { | ||
| 430 | if (__first == __last) | ||
| 431 | return true; // Empty, sorted by definition | ||
| 432 | _ForwardIterator __first2 = std::next(__first); | ||
| 433 | if (__first2 == __last) | ||
| 434 | return true; // Only one element, sorted by definition | ||
| 435 | --__last; // Make two iterator ranges: [__first, __first + n - 1) and [__first + 1, __first + n) | ||
| 436 | using _TransformReduce = __dispatch<__transform_reduce_binary, __current_configuration, _ExecutionPolicy>; | ||
| 437 | using _Ref = __iterator_reference<_ForwardIterator>; | ||
| 438 | return _TransformReduce()( | ||
| 439 | __policy, | ||
| 440 | std::move(__first), | ||
| 441 | std::move(__last), | ||
| 442 | std::move(__first2), | ||
| 443 | true, | ||
| 444 | std::logical_and{}, | ||
| 445 | [&](_Ref __left, _Ref __right) -> bool { return !__comp(__right, __left); }); | ||
| 446 | } else { | ||
| 447 | // Currently anything outside bidirectional iterators has to be processed serially | ||
| 448 | return std::is_sorted(std::move(__first), std::move(__last), std::forward<_Comp>(__comp)); | ||
| 449 | } | ||
| 450 | } | ||
| 451 | }; | ||
| 452 | |||
| 391 | ////////////////////////////////////////////////////////////// | 453 | ////////////////////////////////////////////////////////////// |
| 392 | // transform family | 454 | // transform family |
| 393 | ////////////////////////////////////////////////////////////// | 455 | ////////////////////////////////////////////////////////////// |
| ... | @@ -497,6 +559,22 @@ struct __rotate_copy<__default_backend_tag, _ExecutionPolicy> { | ... | @@ -497,6 +559,22 @@ struct __rotate_copy<__default_backend_tag, _ExecutionPolicy> { |
| 497 | } | 559 | } |
| 498 | }; | 560 | }; |
| 499 | 561 | ||
| 562 | template <class _ExecutionPolicy> | ||
| 563 | struct __reverse_copy<__default_backend_tag, _ExecutionPolicy> { | ||
| 564 | template <class _Policy, class _BidirectionalIterator, class _ForwardIterator> | ||
| 565 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator> | ||
| 566 | operator()(_Policy&& __policy, | ||
| 567 | _BidirectionalIterator __first, | ||
| 568 | _BidirectionalIterator __last, | ||
| 569 | _ForwardIterator __result) const noexcept { | ||
| 570 | using _Copy = __dispatch<__copy, __current_configuration, _ExecutionPolicy>; | ||
| 571 | return _Copy()(__policy, | ||
| 572 | std::reverse_iterator<_BidirectionalIterator>(std::move(__last)), | ||
| 573 | std::reverse_iterator<_BidirectionalIterator>(std::move(__first)), | ||
| 574 | std::move(__result)); | ||
| 575 | } | ||
| 576 | }; | ||
| 577 | |||
| 500 | } // namespace __pstl | 578 | } // namespace __pstl |
| 501 | _LIBCPP_END_NAMESPACE_STD | 579 | _LIBCPP_END_NAMESPACE_STD |
| 502 | 580 |
lib/libcxx/include/__pstl/backends/libdispatch.h+2| ... | @@ -48,6 +48,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -48,6 +48,7 @@ _LIBCPP_PUSH_MACROS |
| 48 | #if _LIBCPP_STD_VER >= 17 | 48 | #if _LIBCPP_STD_VER >= 17 |
| 49 | 49 | ||
| 50 | _LIBCPP_BEGIN_NAMESPACE_STD | 50 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 51 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 51 | namespace __pstl { | 52 | namespace __pstl { |
| 52 | 53 | ||
| 53 | namespace __libdispatch { | 54 | namespace __libdispatch { |
| ... | @@ -393,6 +394,7 @@ struct __fill<__libdispatch_backend_tag, _ExecutionPolicy> | ... | @@ -393,6 +394,7 @@ struct __fill<__libdispatch_backend_tag, _ExecutionPolicy> |
| 393 | : __cpu_parallel_fill<__libdispatch_backend_tag, _ExecutionPolicy> {}; | 394 | : __cpu_parallel_fill<__libdispatch_backend_tag, _ExecutionPolicy> {}; |
| 394 | 395 | ||
| 395 | } // namespace __pstl | 396 | } // namespace __pstl |
| 397 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 396 | _LIBCPP_END_NAMESPACE_STD | 398 | _LIBCPP_END_NAMESPACE_STD |
| 397 | 399 | ||
| 398 | #endif // _LIBCPP_STD_VER >= 17 | 400 | #endif // _LIBCPP_STD_VER >= 17 |
lib/libcxx/include/__random/bernoulli_distribution.h+7-7| ... | @@ -36,7 +36,7 @@ public: | ... | @@ -36,7 +36,7 @@ public: |
| 36 | 36 | ||
| 37 | _LIBCPP_HIDE_FROM_ABI explicit param_type(double __p = 0.5) : __p_(__p) {} | 37 | _LIBCPP_HIDE_FROM_ABI explicit param_type(double __p = 0.5) : __p_(__p) {} |
| 38 | 38 | ||
| 39 | _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; } | 39 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; } |
| 40 | 40 | ||
| 41 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 41 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 42 | return __x.__p_ == __y.__p_; | 42 | return __x.__p_ == __y.__p_; |
| ... | @@ -60,20 +60,20 @@ public: | ... | @@ -60,20 +60,20 @@ public: |
| 60 | 60 | ||
| 61 | // generating functions | 61 | // generating functions |
| 62 | template <class _URNG> | 62 | template <class _URNG> |
| 63 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 63 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 64 | return (*this)(__g, __p_); | 64 | return (*this)(__g, __p_); |
| 65 | } | 65 | } |
| 66 | template <class _URNG> | 66 | template <class _URNG> |
| 67 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 67 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 68 | 68 | ||
| 69 | // property functions | 69 | // property functions |
| 70 | _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); } | 70 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); } |
| 71 | 71 | ||
| 72 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 72 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 73 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 73 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 74 | 74 | ||
| 75 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return false; } | 75 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return false; } |
| 76 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return true; } | 76 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return true; } |
| 77 | 77 | ||
| 78 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const bernoulli_distribution& __x, const bernoulli_distribution& __y) { | 78 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const bernoulli_distribution& __x, const bernoulli_distribution& __y) { |
| 79 | return __x.__p_ == __y.__p_; | 79 | return __x.__p_ == __y.__p_; |
lib/libcxx/include/__random/binomial_distribution.h+13-32| ... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
| 10 | #define _LIBCPP___RANDOM_BINOMIAL_DISTRIBUTION_H | 10 | #define _LIBCPP___RANDOM_BINOMIAL_DISTRIBUTION_H |
| 11 | 11 | ||
| 12 | #include <__config> | 12 | #include <__config> |
| 13 | #include <__math/gamma.h> | ||
| 13 | #include <__random/is_valid.h> | 14 | #include <__random/is_valid.h> |
| 14 | #include <__random/uniform_real_distribution.h> | 15 | #include <__random/uniform_real_distribution.h> |
| 15 | #include <cmath> | 16 | #include <cmath> |
| ... | @@ -44,8 +45,8 @@ public: | ... | @@ -44,8 +45,8 @@ public: |
| 44 | 45 | ||
| 45 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __t = 1, double __p = 0.5); | 46 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __t = 1, double __p = 0.5); |
| 46 | 47 | ||
| 47 | _LIBCPP_HIDE_FROM_ABI result_type t() const { return __t_; } | 48 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type t() const { return __t_; } |
| 48 | _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; } | 49 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; } |
| 49 | 50 | ||
| 50 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 51 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 51 | return __x.__t_ == __y.__t_ && __x.__p_ == __y.__p_; | 52 | return __x.__t_ == __y.__t_ && __x.__p_ == __y.__p_; |
| ... | @@ -73,21 +74,21 @@ public: | ... | @@ -73,21 +74,21 @@ public: |
| 73 | 74 | ||
| 74 | // generating functions | 75 | // generating functions |
| 75 | template <class _URNG> | 76 | template <class _URNG> |
| 76 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 77 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 77 | return (*this)(__g, __p_); | 78 | return (*this)(__g, __p_); |
| 78 | } | 79 | } |
| 79 | template <class _URNG> | 80 | template <class _URNG> |
| 80 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 81 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 81 | 82 | ||
| 82 | // property functions | 83 | // property functions |
| 83 | _LIBCPP_HIDE_FROM_ABI result_type t() const { return __p_.t(); } | 84 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type t() const { return __p_.t(); } |
| 84 | _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); } | 85 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); } |
| 85 | 86 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 87 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 87 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 88 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 88 | 89 | ||
| 89 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } | 90 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } |
| 90 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return t(); } | 91 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return t(); } |
| 91 | 92 | ||
| 92 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const binomial_distribution& __x, const binomial_distribution& __y) { | 93 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const binomial_distribution& __x, const binomial_distribution& __y) { |
| 93 | return __x.__p_ == __y.__p_; | 94 | return __x.__p_ == __y.__p_; |
| ... | @@ -97,33 +98,13 @@ public: | ... | @@ -97,33 +98,13 @@ public: |
| 97 | } | 98 | } |
| 98 | }; | 99 | }; |
| 99 | 100 | ||
| 100 | // Some libc declares the math functions to be `noexcept`. | ||
| 101 | #if _LIBCPP_GLIBC_PREREQ(2, 8) || defined(__LLVM_LIBC__) | ||
| 102 | # define _LIBCPP_LGAMMA_R_NOEXCEPT _NOEXCEPT | ||
| 103 | #else | ||
| 104 | # define _LIBCPP_LGAMMA_R_NOEXCEPT | ||
| 105 | #endif | ||
| 106 | |||
| 107 | #if !defined(_LIBCPP_MSVCRT_LIKE) | ||
| 108 | extern "C" double lgamma_r(double, int*) _LIBCPP_LGAMMA_R_NOEXCEPT; | ||
| 109 | #endif | ||
| 110 | |||
| 111 | inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) { | ||
| 112 | #if defined(_LIBCPP_MSVCRT_LIKE) | ||
| 113 | return lgamma(__d); | ||
| 114 | #else | ||
| 115 | int __sign; | ||
| 116 | return lgamma_r(__d, &__sign); | ||
| 117 | #endif | ||
| 118 | } | ||
| 119 | |||
| 120 | template <class _IntType> | 101 | template <class _IntType> |
| 121 | binomial_distribution<_IntType>::param_type::param_type(result_type __t, double __p) : __t_(__t), __p_(__p) { | 102 | binomial_distribution<_IntType>::param_type::param_type(result_type __t, double __p) : __t_(__t), __p_(__p) { |
| 122 | if (0 < __p_ && __p_ < 1) { | 103 | if (0 < __p_ && __p_ < 1) { |
| 123 | __r0_ = static_cast<result_type>((__t_ + 1) * __p_); | 104 | __r0_ = static_cast<result_type>((__t_ + 1) * __p_); |
| 124 | __pr_ = std::exp( | 105 | __pr_ = |
| 125 | std::__libcpp_lgamma(__t_ + 1.) - std::__libcpp_lgamma(__r0_ + 1.) - std::__libcpp_lgamma(__t_ - __r0_ + 1.) + | 106 | std::exp(__math::__lgamma_r(__t_ + 1.) - __math::__lgamma_r(__r0_ + 1.) - |
| 126 | __r0_ * std::log(__p_) + (__t_ - __r0_) * std::log(1 - __p_)); | 107 | __math::__lgamma_r(__t_ - __r0_ + 1.) + __r0_ * std::log(__p_) + (__t_ - __r0_) * std::log(1 - __p_)); |
| 127 | __odds_ratio_ = __p_ / (1 - __p_); | 108 | __odds_ratio_ = __p_ / (1 - __p_); |
| 128 | } | 109 | } |
| 129 | } | 110 | } |
lib/libcxx/include/__random/cauchy_distribution.h+9-9| ... | @@ -43,8 +43,8 @@ public: | ... | @@ -43,8 +43,8 @@ public: |
| 43 | 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} | 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} |
| 45 | 45 | ||
| 46 | _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; } | 46 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; } |
| 47 | _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; } | 47 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; } |
| 48 | 48 | ||
| 49 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 49 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 50 | return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_; | 50 | return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_; |
| ... | @@ -70,21 +70,21 @@ public: | ... | @@ -70,21 +70,21 @@ public: |
| 70 | 70 | ||
| 71 | // generating functions | 71 | // generating functions |
| 72 | template <class _URNG> | 72 | template <class _URNG> |
| 73 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 73 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 74 | return (*this)(__g, __p_); | 74 | return (*this)(__g, __p_); |
| 75 | } | 75 | } |
| 76 | template <class _URNG> | 76 | template <class _URNG> |
| 77 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 77 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 78 | 78 | ||
| 79 | // property functions | 79 | // property functions |
| 80 | _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); } | 80 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); } |
| 81 | _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); } | 81 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); } |
| 82 | 82 | ||
| 83 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 83 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 84 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 84 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 85 | 85 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); } | 86 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); } |
| 87 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } | 87 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } |
| 88 | 88 | ||
| 89 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const cauchy_distribution& __x, const cauchy_distribution& __y) { | 89 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const cauchy_distribution& __x, const cauchy_distribution& __y) { |
| 90 | return __x.__p_ == __y.__p_; | 90 | return __x.__p_ == __y.__p_; |
lib/libcxx/include/__random/chi_squared_distribution.h+7-7| ... | @@ -41,7 +41,7 @@ public: | ... | @@ -41,7 +41,7 @@ public: |
| 41 | 41 | ||
| 42 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __n = 1) : __n_(__n) {} | 42 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __n = 1) : __n_(__n) {} |
| 43 | 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; } | 44 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; } |
| 45 | 45 | ||
| 46 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 46 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 47 | return __x.__n_ == __y.__n_; | 47 | return __x.__n_ == __y.__n_; |
| ... | @@ -65,22 +65,22 @@ public: | ... | @@ -65,22 +65,22 @@ public: |
| 65 | 65 | ||
| 66 | // generating functions | 66 | // generating functions |
| 67 | template <class _URNG> | 67 | template <class _URNG> |
| 68 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 68 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 69 | return (*this)(__g, __p_); | 69 | return (*this)(__g, __p_); |
| 70 | } | 70 | } |
| 71 | template <class _URNG> | 71 | template <class _URNG> |
| 72 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) { | 72 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) { |
| 73 | return gamma_distribution<result_type>(__p.n() / 2, 2)(__g); | 73 | return gamma_distribution<result_type>(__p.n() / 2, 2)(__g); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | // property functions | 76 | // property functions |
| 77 | _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); } | 77 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); } |
| 78 | 78 | ||
| 79 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 79 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 80 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 80 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 81 | 81 | ||
| 82 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } | 82 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } |
| 83 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } | 83 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } |
| 84 | 84 | ||
| 85 | friend _LIBCPP_HIDE_FROM_ABI bool | 85 | friend _LIBCPP_HIDE_FROM_ABI bool |
| 86 | operator==(const chi_squared_distribution& __x, const chi_squared_distribution& __y) { | 86 | operator==(const chi_squared_distribution& __x, const chi_squared_distribution& __y) { |
lib/libcxx/include/__random/discard_block_engine.h+9-10| ... | @@ -54,8 +54,8 @@ public: | ... | @@ -54,8 +54,8 @@ public: |
| 54 | static constexpr result_type _Max = _Engine::max(); | 54 | static constexpr result_type _Max = _Engine::max(); |
| 55 | #endif | 55 | #endif |
| 56 | 56 | ||
| 57 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Engine::min(); } | 57 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Engine::min(); } |
| 58 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Engine::max(); } | 58 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Engine::max(); } |
| 59 | 59 | ||
| 60 | // constructors and seeding functions | 60 | // constructors and seeding functions |
| 61 | _LIBCPP_HIDE_FROM_ABI discard_block_engine() : __n_(0) {} | 61 | _LIBCPP_HIDE_FROM_ABI discard_block_engine() : __n_(0) {} |
| ... | @@ -64,10 +64,9 @@ public: | ... | @@ -64,10 +64,9 @@ public: |
| 64 | _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(_Engine&& __e) : __e_(std::move(__e)), __n_(0) {} | 64 | _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(_Engine&& __e) : __e_(std::move(__e)), __n_(0) {} |
| 65 | #endif // _LIBCPP_CXX03_LANG | 65 | #endif // _LIBCPP_CXX03_LANG |
| 66 | _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {} | 66 | _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {} |
| 67 | template < | 67 | template <class _Sseq, |
| 68 | class _Sseq, | 68 | __enable_if_t<__is_seed_sequence_v<_Sseq, discard_block_engine> && !is_convertible<_Sseq, _Engine>::value, |
| 69 | __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value && !is_convertible<_Sseq, _Engine>::value, | 69 | int> = 0> |
| 70 | int> = 0> | ||
| 71 | _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(_Sseq& __q) : __e_(__q), __n_(0) {} | 70 | _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(_Sseq& __q) : __e_(__q), __n_(0) {} |
| 72 | _LIBCPP_HIDE_FROM_ABI void seed() { | 71 | _LIBCPP_HIDE_FROM_ABI void seed() { |
| 73 | __e_.seed(); | 72 | __e_.seed(); |
| ... | @@ -77,21 +76,21 @@ public: | ... | @@ -77,21 +76,21 @@ public: |
| 77 | __e_.seed(__sd); | 76 | __e_.seed(__sd); |
| 78 | __n_ = 0; | 77 | __n_ = 0; |
| 79 | } | 78 | } |
| 80 | template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value, int> = 0> | 79 | template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, discard_block_engine>, int> = 0> |
| 81 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { | 80 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { |
| 82 | __e_.seed(__q); | 81 | __e_.seed(__q); |
| 83 | __n_ = 0; | 82 | __n_ = 0; |
| 84 | } | 83 | } |
| 85 | 84 | ||
| 86 | // generating functions | 85 | // generating functions |
| 87 | _LIBCPP_HIDE_FROM_ABI result_type operator()(); | 86 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(); |
| 88 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { | 87 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { |
| 89 | for (; __z; --__z) | 88 | for (; __z; --__z) |
| 90 | operator()(); | 89 | (void)operator()(); |
| 91 | } | 90 | } |
| 92 | 91 | ||
| 93 | // property functions | 92 | // property functions |
| 94 | _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; } | 93 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; } |
| 95 | 94 | ||
| 96 | template <class _Eng, size_t _Pp, size_t _Rp> | 95 | template <class _Eng, size_t _Pp, size_t _Rp> |
| 97 | friend bool | 96 | friend bool |
lib/libcxx/include/__random/discrete_distribution.h+7-7| ... | @@ -52,7 +52,7 @@ public: | ... | @@ -52,7 +52,7 @@ public: |
| 52 | template <class _UnaryOperation> | 52 | template <class _UnaryOperation> |
| 53 | _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw); | 53 | _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw); |
| 54 | 54 | ||
| 55 | _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const; | 55 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const; |
| 56 | 56 | ||
| 57 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 57 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 58 | return __x.__p_ == __y.__p_; | 58 | return __x.__p_ == __y.__p_; |
| ... | @@ -92,20 +92,20 @@ public: | ... | @@ -92,20 +92,20 @@ public: |
| 92 | 92 | ||
| 93 | // generating functions | 93 | // generating functions |
| 94 | template <class _URNG> | 94 | template <class _URNG> |
| 95 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 95 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 96 | return (*this)(__g, __p_); | 96 | return (*this)(__g, __p_); |
| 97 | } | 97 | } |
| 98 | template <class _URNG> | 98 | template <class _URNG> |
| 99 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 99 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 100 | 100 | ||
| 101 | // property functions | 101 | // property functions |
| 102 | _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const { return __p_.probabilities(); } | 102 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const { return __p_.probabilities(); } |
| 103 | 103 | ||
| 104 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 104 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 105 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 105 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 106 | 106 | ||
| 107 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } | 107 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } |
| 108 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__p_.size(); } | 108 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__p_.size(); } |
| 109 | 109 | ||
| 110 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const discrete_distribution& __x, const discrete_distribution& __y) { | 110 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const discrete_distribution& __x, const discrete_distribution& __y) { |
| 111 | return __x.__p_ == __y.__p_; | 111 | return __x.__p_ == __y.__p_; |
lib/libcxx/include/__random/exponential_distribution.h+7-7| ... | @@ -43,7 +43,7 @@ public: | ... | @@ -43,7 +43,7 @@ public: |
| 43 | 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __lambda = 1) : __lambda_(__lambda) {} | 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __lambda = 1) : __lambda_(__lambda) {} |
| 45 | 45 | ||
| 46 | _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __lambda_; } | 46 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __lambda_; } |
| 47 | 47 | ||
| 48 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 48 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 49 | return __x.__lambda_ == __y.__lambda_; | 49 | return __x.__lambda_ == __y.__lambda_; |
| ... | @@ -67,20 +67,20 @@ public: | ... | @@ -67,20 +67,20 @@ public: |
| 67 | 67 | ||
| 68 | // generating functions | 68 | // generating functions |
| 69 | template <class _URNG> | 69 | template <class _URNG> |
| 70 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 70 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 71 | return (*this)(__g, __p_); | 71 | return (*this)(__g, __p_); |
| 72 | } | 72 | } |
| 73 | template <class _URNG> | 73 | template <class _URNG> |
| 74 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 74 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 75 | 75 | ||
| 76 | // property functions | 76 | // property functions |
| 77 | _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __p_.lambda(); } | 77 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __p_.lambda(); } |
| 78 | 78 | ||
| 79 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 79 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 80 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 80 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 81 | 81 | ||
| 82 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } | 82 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } |
| 83 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } | 83 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } |
| 84 | 84 | ||
| 85 | friend _LIBCPP_HIDE_FROM_ABI bool | 85 | friend _LIBCPP_HIDE_FROM_ABI bool |
| 86 | operator==(const exponential_distribution& __x, const exponential_distribution& __y) { | 86 | operator==(const exponential_distribution& __x, const exponential_distribution& __y) { |
lib/libcxx/include/__random/extreme_value_distribution.h+9-9| ... | @@ -43,8 +43,8 @@ public: | ... | @@ -43,8 +43,8 @@ public: |
| 43 | 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} | 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} |
| 45 | 45 | ||
| 46 | _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; } | 46 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; } |
| 47 | _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; } | 47 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; } |
| 48 | 48 | ||
| 49 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 49 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 50 | return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_; | 50 | return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_; |
| ... | @@ -70,21 +70,21 @@ public: | ... | @@ -70,21 +70,21 @@ public: |
| 70 | 70 | ||
| 71 | // generating functions | 71 | // generating functions |
| 72 | template <class _URNG> | 72 | template <class _URNG> |
| 73 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 73 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 74 | return (*this)(__g, __p_); | 74 | return (*this)(__g, __p_); |
| 75 | } | 75 | } |
| 76 | template <class _URNG> | 76 | template <class _URNG> |
| 77 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 77 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 78 | 78 | ||
| 79 | // property functions | 79 | // property functions |
| 80 | _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); } | 80 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); } |
| 81 | _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); } | 81 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); } |
| 82 | 82 | ||
| 83 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 83 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 84 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 84 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 85 | 85 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); } | 86 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); } |
| 87 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } | 87 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } |
| 88 | 88 | ||
| 89 | friend _LIBCPP_HIDE_FROM_ABI bool | 89 | friend _LIBCPP_HIDE_FROM_ABI bool |
| 90 | operator==(const extreme_value_distribution& __x, const extreme_value_distribution& __y) { | 90 | operator==(const extreme_value_distribution& __x, const extreme_value_distribution& __y) { |
lib/libcxx/include/__random/fisher_f_distribution.h+9-9| ... | @@ -42,8 +42,8 @@ public: | ... | @@ -42,8 +42,8 @@ public: |
| 42 | 42 | ||
| 43 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __m = 1, result_type __n = 1) : __m_(__m), __n_(__n) {} | 43 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __m = 1, result_type __n = 1) : __m_(__m), __n_(__n) {} |
| 44 | 44 | ||
| 45 | _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; } | 45 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; } |
| 46 | _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; } | 46 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; } |
| 47 | 47 | ||
| 48 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 48 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 49 | return __x.__m_ == __y.__m_ && __x.__n_ == __y.__n_; | 49 | return __x.__m_ == __y.__m_ && __x.__n_ == __y.__n_; |
| ... | @@ -69,21 +69,21 @@ public: | ... | @@ -69,21 +69,21 @@ public: |
| 69 | 69 | ||
| 70 | // generating functions | 70 | // generating functions |
| 71 | template <class _URNG> | 71 | template <class _URNG> |
| 72 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 72 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 73 | return (*this)(__g, __p_); | 73 | return (*this)(__g, __p_); |
| 74 | } | 74 | } |
| 75 | template <class _URNG> | 75 | template <class _URNG> |
| 76 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 76 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 77 | 77 | ||
| 78 | // property functions | 78 | // property functions |
| 79 | _LIBCPP_HIDE_FROM_ABI result_type m() const { return __p_.m(); } | 79 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type m() const { return __p_.m(); } |
| 80 | _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); } | 80 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); } |
| 81 | 81 | ||
| 82 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 82 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 83 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 83 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 84 | 84 | ||
| 85 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } | 85 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } |
| 86 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } | 86 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } |
| 87 | 87 | ||
| 88 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const fisher_f_distribution& __x, const fisher_f_distribution& __y) { | 88 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const fisher_f_distribution& __x, const fisher_f_distribution& __y) { |
| 89 | return __x.__p_ == __y.__p_; | 89 | return __x.__p_ == __y.__p_; |
lib/libcxx/include/__random/gamma_distribution.h+9-9| ... | @@ -45,8 +45,8 @@ public: | ... | @@ -45,8 +45,8 @@ public: |
| 45 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __alpha = 1, result_type __beta = 1) | 45 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __alpha = 1, result_type __beta = 1) |
| 46 | : __alpha_(__alpha), __beta_(__beta) {} | 46 | : __alpha_(__alpha), __beta_(__beta) {} |
| 47 | 47 | ||
| 48 | _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __alpha_; } | 48 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __alpha_; } |
| 49 | _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __beta_; } | 49 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __beta_; } |
| 50 | 50 | ||
| 51 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 51 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 52 | return __x.__alpha_ == __y.__alpha_ && __x.__beta_ == __y.__beta_; | 52 | return __x.__alpha_ == __y.__alpha_ && __x.__beta_ == __y.__beta_; |
| ... | @@ -72,21 +72,21 @@ public: | ... | @@ -72,21 +72,21 @@ public: |
| 72 | 72 | ||
| 73 | // generating functions | 73 | // generating functions |
| 74 | template <class _URNG> | 74 | template <class _URNG> |
| 75 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 75 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 76 | return (*this)(__g, __p_); | 76 | return (*this)(__g, __p_); |
| 77 | } | 77 | } |
| 78 | template <class _URNG> | 78 | template <class _URNG> |
| 79 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 79 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 80 | 80 | ||
| 81 | // property functions | 81 | // property functions |
| 82 | _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __p_.alpha(); } | 82 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __p_.alpha(); } |
| 83 | _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __p_.beta(); } | 83 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __p_.beta(); } |
| 84 | 84 | ||
| 85 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 85 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 86 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 86 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 87 | 87 | ||
| 88 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } | 88 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } |
| 89 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } | 89 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } |
| 90 | 90 | ||
| 91 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const gamma_distribution& __x, const gamma_distribution& __y) { | 91 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const gamma_distribution& __x, const gamma_distribution& __y) { |
| 92 | return __x.__p_ == __y.__p_; | 92 | return __x.__p_ == __y.__p_; |
lib/libcxx/include/__random/generate_canonical.h+1-1| ... | @@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | // generate_canonical | 27 | // generate_canonical |
| 28 | 28 | ||
| 29 | template <class _RealType, size_t __bits, class _URNG> | 29 | template <class _RealType, size_t __bits, class _URNG> |
| 30 | _LIBCPP_HIDE_FROM_ABI _RealType generate_canonical(_URNG& __g) { | 30 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _RealType generate_canonical(_URNG& __g) { |
| 31 | const size_t __dt = numeric_limits<_RealType>::digits; | 31 | const size_t __dt = numeric_limits<_RealType>::digits; |
| 32 | const size_t __b = __dt < __bits ? __dt : __bits; | 32 | const size_t __b = __dt < __bits ? __dt : __bits; |
| 33 | #ifdef _LIBCPP_CXX03_LANG | 33 | #ifdef _LIBCPP_CXX03_LANG |
lib/libcxx/include/__random/geometric_distribution.h+7-7| ... | @@ -40,7 +40,7 @@ public: | ... | @@ -40,7 +40,7 @@ public: |
| 40 | 40 | ||
| 41 | _LIBCPP_HIDE_FROM_ABI explicit param_type(double __p = 0.5) : __p_(__p) {} | 41 | _LIBCPP_HIDE_FROM_ABI explicit param_type(double __p = 0.5) : __p_(__p) {} |
| 42 | 42 | ||
| 43 | _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; } | 43 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; } |
| 44 | 44 | ||
| 45 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 45 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 46 | return __x.__p_ == __y.__p_; | 46 | return __x.__p_ == __y.__p_; |
| ... | @@ -64,22 +64,22 @@ public: | ... | @@ -64,22 +64,22 @@ public: |
| 64 | 64 | ||
| 65 | // generating functions | 65 | // generating functions |
| 66 | template <class _URNG> | 66 | template <class _URNG> |
| 67 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 67 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 68 | return (*this)(__g, __p_); | 68 | return (*this)(__g, __p_); |
| 69 | } | 69 | } |
| 70 | template <class _URNG> | 70 | template <class _URNG> |
| 71 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) { | 71 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) { |
| 72 | return negative_binomial_distribution<result_type>(1, __p.p())(__g); | 72 | return negative_binomial_distribution<result_type>(1, __p.p())(__g); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | // property functions | 75 | // property functions |
| 76 | _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); } | 76 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); } |
| 77 | 77 | ||
| 78 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 78 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 79 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 79 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 80 | 80 | ||
| 81 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } | 81 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } |
| 82 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); } | 82 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); } |
| 83 | 83 | ||
| 84 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const geometric_distribution& __x, const geometric_distribution& __y) { | 84 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const geometric_distribution& __x, const geometric_distribution& __y) { |
| 85 | return __x.__p_ == __y.__p_; | 85 | return __x.__p_ == __y.__p_; |
lib/libcxx/include/__random/independent_bits_engine.h+29-35| ... | @@ -82,8 +82,8 @@ public: | ... | @@ -82,8 +82,8 @@ public: |
| 82 | static_assert(_Min < _Max, "independent_bits_engine invalid parameters"); | 82 | static_assert(_Min < _Max, "independent_bits_engine invalid parameters"); |
| 83 | 83 | ||
| 84 | // engine characteristics | 84 | // engine characteristics |
| 85 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } | 85 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } |
| 86 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } | 86 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } |
| 87 | 87 | ||
| 88 | // constructors and seeding functions | 88 | // constructors and seeding functions |
| 89 | _LIBCPP_HIDE_FROM_ABI independent_bits_engine() {} | 89 | _LIBCPP_HIDE_FROM_ABI independent_bits_engine() {} |
| ... | @@ -94,25 +94,47 @@ public: | ... | @@ -94,25 +94,47 @@ public: |
| 94 | _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(result_type __sd) : __e_(__sd) {} | 94 | _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(result_type __sd) : __e_(__sd) {} |
| 95 | template < | 95 | template < |
| 96 | class _Sseq, | 96 | class _Sseq, |
| 97 | __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value && !is_convertible<_Sseq, _Engine>::value, | 97 | __enable_if_t<__is_seed_sequence_v<_Sseq, independent_bits_engine> && !is_convertible<_Sseq, _Engine>::value, |
| 98 | int> = 0> | 98 | int> = 0> |
| 99 | _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(_Sseq& __q) : __e_(__q) {} | 99 | _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(_Sseq& __q) : __e_(__q) {} |
| 100 | _LIBCPP_HIDE_FROM_ABI void seed() { __e_.seed(); } | 100 | _LIBCPP_HIDE_FROM_ABI void seed() { __e_.seed(); } |
| 101 | _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd) { __e_.seed(__sd); } | 101 | _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd) { __e_.seed(__sd); } |
| 102 | template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value, int> = 0> | 102 | template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, independent_bits_engine>, int> = 0> |
| 103 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { | 103 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { |
| 104 | __e_.seed(__q); | 104 | __e_.seed(__q); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | // generating functions | 107 | // generating functions |
| 108 | _LIBCPP_HIDE_FROM_ABI result_type operator()() { return __eval(integral_constant<bool, _Rp != 0>()); } | 108 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()() { |
| 109 | if _LIBCPP_CONSTEXPR (_Rp != 0) { | ||
| 110 | result_type __sp = 0; | ||
| 111 | for (size_t __k = 0; __k < __n0; ++__k) { | ||
| 112 | _Engine_result_type __u; | ||
| 113 | do { | ||
| 114 | __u = __e_() - _Engine::min(); | ||
| 115 | } while (__u >= __y0); | ||
| 116 | __sp = static_cast<result_type>(__lshift<__w0>(__sp) + (__u & __mask0)); | ||
| 117 | } | ||
| 118 | for (size_t __k = __n0; __k < __n; ++__k) { | ||
| 119 | _Engine_result_type __u; | ||
| 120 | do { | ||
| 121 | __u = __e_() - _Engine::min(); | ||
| 122 | } while (__u >= __y1); | ||
| 123 | __sp = static_cast<result_type>(__lshift<__w0 + 1>(__sp) + (__u & __mask1)); | ||
| 124 | } | ||
| 125 | return __sp; | ||
| 126 | } else { | ||
| 127 | return static_cast<result_type>(__e_() & __mask0); | ||
| 128 | } | ||
| 129 | } | ||
| 130 | |||
| 109 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { | 131 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { |
| 110 | for (; __z; --__z) | 132 | for (; __z; --__z) |
| 111 | operator()(); | 133 | (void)operator()(); |
| 112 | } | 134 | } |
| 113 | 135 | ||
| 114 | // property functions | 136 | // property functions |
| 115 | _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; } | 137 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; } |
| 116 | 138 | ||
| 117 | template <class _Eng, size_t _Wp, class _UInt> | 139 | template <class _Eng, size_t _Wp, class _UInt> |
| 118 | friend bool operator==(const independent_bits_engine<_Eng, _Wp, _UInt>& __x, | 140 | friend bool operator==(const independent_bits_engine<_Eng, _Wp, _UInt>& __x, |
| ... | @@ -131,9 +153,6 @@ public: | ... | @@ -131,9 +153,6 @@ public: |
| 131 | operator>>(basic_istream<_CharT, _Traits>& __is, independent_bits_engine<_Eng, _Wp, _UInt>& __x); | 153 | operator>>(basic_istream<_CharT, _Traits>& __is, independent_bits_engine<_Eng, _Wp, _UInt>& __x); |
| 132 | 154 | ||
| 133 | private: | 155 | private: |
| 134 | _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type); | ||
| 135 | _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type); | ||
| 136 | |||
| 137 | template <size_t __count, | 156 | template <size_t __count, |
| 138 | __enable_if_t<__count< _Dt, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) { | 157 | __enable_if_t<__count< _Dt, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) { |
| 139 | return __x << __count; | 158 | return __x << __count; |
| ... | @@ -145,31 +164,6 @@ private: | ... | @@ -145,31 +164,6 @@ private: |
| 145 | } | 164 | } |
| 146 | }; | 165 | }; |
| 147 | 166 | ||
| 148 | template <class _Engine, size_t __w, class _UIntType> | ||
| 149 | inline _UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type) { | ||
| 150 | return static_cast<result_type>(__e_() & __mask0); | ||
| 151 | } | ||
| 152 | |||
| 153 | template <class _Engine, size_t __w, class _UIntType> | ||
| 154 | _UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) { | ||
| 155 | result_type __sp = 0; | ||
| 156 | for (size_t __k = 0; __k < __n0; ++__k) { | ||
| 157 | _Engine_result_type __u; | ||
| 158 | do { | ||
| 159 | __u = __e_() - _Engine::min(); | ||
| 160 | } while (__u >= __y0); | ||
| 161 | __sp = static_cast<result_type>(__lshift<__w0>(__sp) + (__u & __mask0)); | ||
| 162 | } | ||
| 163 | for (size_t __k = __n0; __k < __n; ++__k) { | ||
| 164 | _Engine_result_type __u; | ||
| 165 | do { | ||
| 166 | __u = __e_() - _Engine::min(); | ||
| 167 | } while (__u >= __y1); | ||
| 168 | __sp = static_cast<result_type>(__lshift<__w0 + 1>(__sp) + (__u & __mask1)); | ||
| 169 | } | ||
| 170 | return __sp; | ||
| 171 | } | ||
| 172 | |||
| 173 | template <class _Eng, size_t _Wp, class _UInt> | 167 | template <class _Eng, size_t _Wp, class _UInt> |
| 174 | inline _LIBCPP_HIDE_FROM_ABI bool | 168 | inline _LIBCPP_HIDE_FROM_ABI bool |
| 175 | operator==(const independent_bits_engine<_Eng, _Wp, _UInt>& __x, const independent_bits_engine<_Eng, _Wp, _UInt>& __y) { | 169 | operator==(const independent_bits_engine<_Eng, _Wp, _UInt>& __x, const independent_bits_engine<_Eng, _Wp, _UInt>& __y) { |
lib/libcxx/include/__random/is_seed_sequence.h+2-4| ... | @@ -21,10 +21,8 @@ | ... | @@ -21,10 +21,8 @@ |
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | ||
| 23 | template <class _Sseq, class _Engine> | 23 | template <class _Sseq, class _Engine> |
| 24 | struct __is_seed_sequence { | 24 | inline const bool __is_seed_sequence_v = |
| 25 | static _LIBCPP_CONSTEXPR const bool value = | 25 | !is_convertible<_Sseq, typename _Engine::result_type>::value && !is_same<__remove_cv_t<_Sseq>, _Engine>::value; |
| 26 | !is_convertible<_Sseq, typename _Engine::result_type>::value && !is_same<__remove_cv_t<_Sseq>, _Engine>::value; | ||
| 27 | }; | ||
| 28 | 26 | ||
| 29 | _LIBCPP_END_NAMESPACE_STD | 27 | _LIBCPP_END_NAMESPACE_STD |
| 30 | 28 |
lib/libcxx/include/__random/linear_congruential_engine.h+26-41| ... | @@ -254,8 +254,8 @@ public: | ... | @@ -254,8 +254,8 @@ public: |
| 254 | static inline _LIBCPP_CONSTEXPR const result_type multiplier = __a; | 254 | static inline _LIBCPP_CONSTEXPR const result_type multiplier = __a; |
| 255 | static inline _LIBCPP_CONSTEXPR const result_type increment = __c; | 255 | static inline _LIBCPP_CONSTEXPR const result_type increment = __c; |
| 256 | static inline _LIBCPP_CONSTEXPR const result_type modulus = __m; | 256 | static inline _LIBCPP_CONSTEXPR const result_type modulus = __m; |
| 257 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } | 257 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } |
| 258 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } | 258 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } |
| 259 | static inline _LIBCPP_CONSTEXPR const result_type default_seed = 1u; | 259 | static inline _LIBCPP_CONSTEXPR const result_type default_seed = 1u; |
| 260 | 260 | ||
| 261 | // constructors and seeding functions | 261 | // constructors and seeding functions |
| ... | @@ -265,28 +265,43 @@ public: | ... | @@ -265,28 +265,43 @@ public: |
| 265 | #else | 265 | #else |
| 266 | _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(result_type __s = default_seed) { seed(__s); } | 266 | _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(result_type __s = default_seed) { seed(__s); } |
| 267 | #endif | 267 | #endif |
| 268 | template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0> | 268 | template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, linear_congruential_engine>, int> = 0> |
| 269 | _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(_Sseq& __q) { | 269 | _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(_Sseq& __q) { |
| 270 | seed(__q); | 270 | seed(__q); |
| 271 | } | 271 | } |
| 272 | |||
| 272 | _LIBCPP_HIDE_FROM_ABI void seed(result_type __s = default_seed) { | 273 | _LIBCPP_HIDE_FROM_ABI void seed(result_type __s = default_seed) { |
| 273 | seed(integral_constant<bool, __m == 0>(), integral_constant<bool, __c == 0>(), __s); | 274 | if _LIBCPP_CONSTEXPR (__m == 0) { |
| 275 | if _LIBCPP_CONSTEXPR (__c == 0) | ||
| 276 | __x_ = __s == 0 ? 1 : __s; | ||
| 277 | else | ||
| 278 | __x_ = __s; | ||
| 279 | } else { | ||
| 280 | if _LIBCPP_CONSTEXPR (__c == 0) | ||
| 281 | __x_ = __s % __m == 0 ? 1 : __s % __m; | ||
| 282 | else | ||
| 283 | __x_ = __s % __m; | ||
| 284 | } | ||
| 274 | } | 285 | } |
| 275 | template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0> | 286 | |
| 287 | template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, linear_congruential_engine>, int> = 0> | ||
| 276 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { | 288 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { |
| 277 | __seed( | 289 | const _LIBCPP_CONSTEXPR unsigned __k = |
| 278 | __q, | 290 | 1 + (__m == 0 ? (sizeof(result_type) * __CHAR_BIT__ - 1) / 32 : (__m > 0x100000000ull)); |
| 279 | integral_constant<unsigned, | 291 | static_assert(__k <= 2); |
| 280 | 1 + (__m == 0 ? (sizeof(result_type) * __CHAR_BIT__ - 1) / 32 : (__m > 0x100000000ull))>()); | 292 | uint32_t __ar[__k + 3]; |
| 293 | __q.generate(__ar, __ar + __k + 3); | ||
| 294 | result_type __s = static_cast<result_type>((__ar[3] + (__k == 1 ? 0 : (uint64_t)__ar[4] << 32)) % __m); | ||
| 295 | __x_ = __c == 0 && __s == 0 ? result_type(1) : __s; | ||
| 281 | } | 296 | } |
| 282 | 297 | ||
| 283 | // generating functions | 298 | // generating functions |
| 284 | _LIBCPP_HIDE_FROM_ABI result_type operator()() { | 299 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()() { |
| 285 | return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, _Mp>::next(__x_)); | 300 | return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, _Mp>::next(__x_)); |
| 286 | } | 301 | } |
| 287 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { | 302 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { |
| 288 | for (; __z; --__z) | 303 | for (; __z; --__z) |
| 289 | operator()(); | 304 | (void)operator()(); |
| 290 | } | 305 | } |
| 291 | 306 | ||
| 292 | friend _LIBCPP_HIDE_FROM_ABI bool | 307 | friend _LIBCPP_HIDE_FROM_ABI bool |
| ... | @@ -299,16 +314,6 @@ public: | ... | @@ -299,16 +314,6 @@ public: |
| 299 | } | 314 | } |
| 300 | 315 | ||
| 301 | private: | 316 | private: |
| 302 | _LIBCPP_HIDE_FROM_ABI void seed(true_type, true_type, result_type __s) { __x_ = __s == 0 ? 1 : __s; } | ||
| 303 | _LIBCPP_HIDE_FROM_ABI void seed(true_type, false_type, result_type __s) { __x_ = __s; } | ||
| 304 | _LIBCPP_HIDE_FROM_ABI void seed(false_type, true_type, result_type __s) { __x_ = __s % __m == 0 ? 1 : __s % __m; } | ||
| 305 | _LIBCPP_HIDE_FROM_ABI void seed(false_type, false_type, result_type __s) { __x_ = __s % __m; } | ||
| 306 | |||
| 307 | template <class _Sseq> | ||
| 308 | _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>); | ||
| 309 | template <class _Sseq> | ||
| 310 | _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>); | ||
| 311 | |||
| 312 | template <class _CharT, class _Traits, class _Up, _Up _Ap, _Up _Cp, _Up _Np> | 317 | template <class _CharT, class _Traits, class _Up, _Up _Ap, _Up _Cp, _Up _Np> |
| 313 | friend basic_ostream<_CharT, _Traits>& | 318 | friend basic_ostream<_CharT, _Traits>& |
| 314 | operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&); | 319 | operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&); |
| ... | @@ -318,26 +323,6 @@ private: | ... | @@ -318,26 +323,6 @@ private: |
| 318 | operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x); | 323 | operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x); |
| 319 | }; | 324 | }; |
| 320 | 325 | ||
| 321 | template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> | ||
| 322 | template <class _Sseq> | ||
| 323 | void linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q, integral_constant<unsigned, 1>) { | ||
| 324 | const unsigned __k = 1; | ||
| 325 | uint32_t __ar[__k + 3]; | ||
| 326 | __q.generate(__ar, __ar + __k + 3); | ||
| 327 | result_type __s = static_cast<result_type>(__ar[3] % __m); | ||
| 328 | __x_ = __c == 0 && __s == 0 ? result_type(1) : __s; | ||
| 329 | } | ||
| 330 | |||
| 331 | template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> | ||
| 332 | template <class _Sseq> | ||
| 333 | void linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q, integral_constant<unsigned, 2>) { | ||
| 334 | const unsigned __k = 2; | ||
| 335 | uint32_t __ar[__k + 3]; | ||
| 336 | __q.generate(__ar, __ar + __k + 3); | ||
| 337 | result_type __s = static_cast<result_type>((__ar[3] + ((uint64_t)__ar[4] << 32)) % __m); | ||
| 338 | __x_ = __c == 0 && __s == 0 ? result_type(1) : __s; | ||
| 339 | } | ||
| 340 | |||
| 341 | template <class _CharT, class _Traits, class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> | 326 | template <class _CharT, class _Traits, class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> |
| 342 | inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | 327 | inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& |
| 343 | operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_UIntType, __a, __c, __m>& __x) { | 328 | operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_UIntType, __a, __c, __m>& __x) { |
lib/libcxx/include/__random/lognormal_distribution.h+9-9| ... | @@ -43,8 +43,8 @@ public: | ... | @@ -43,8 +43,8 @@ public: |
| 43 | 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __m = 0, result_type __s = 1) : __m_(__m), __s_(__s) {} | 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __m = 0, result_type __s = 1) : __m_(__m), __s_(__s) {} |
| 45 | 45 | ||
| 46 | _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; } | 46 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; } |
| 47 | _LIBCPP_HIDE_FROM_ABI result_type s() const { return __s_; } | 47 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type s() const { return __s_; } |
| 48 | 48 | ||
| 49 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 49 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 50 | return __x.__m_ == __y.__m_ && __x.__s_ == __y.__s_; | 50 | return __x.__m_ == __y.__m_ && __x.__s_ == __y.__s_; |
| ... | @@ -68,28 +68,28 @@ public: | ... | @@ -68,28 +68,28 @@ public: |
| 68 | 68 | ||
| 69 | // generating functions | 69 | // generating functions |
| 70 | template <class _URNG> | 70 | template <class _URNG> |
| 71 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 71 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 72 | return std::exp(__nd_(__g)); | 72 | return std::exp(__nd_(__g)); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | template <class _URNG> | 75 | template <class _URNG> |
| 76 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) { | 76 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) { |
| 77 | typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s()); | 77 | typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s()); |
| 78 | return std::exp(__nd_(__g, __pn)); | 78 | return std::exp(__nd_(__g, __pn)); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | // property functions | 81 | // property functions |
| 82 | _LIBCPP_HIDE_FROM_ABI result_type m() const { return __nd_.mean(); } | 82 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type m() const { return __nd_.mean(); } |
| 83 | _LIBCPP_HIDE_FROM_ABI result_type s() const { return __nd_.stddev(); } | 83 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type s() const { return __nd_.stddev(); } |
| 84 | 84 | ||
| 85 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return param_type(__nd_.mean(), __nd_.stddev()); } | 85 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return param_type(__nd_.mean(), __nd_.stddev()); } |
| 86 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { | 86 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { |
| 87 | typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s()); | 87 | typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s()); |
| 88 | __nd_.param(__pn); | 88 | __nd_.param(__pn); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } | 91 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } |
| 92 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } | 92 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } |
| 93 | 93 | ||
| 94 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const lognormal_distribution& __x, const lognormal_distribution& __y) { | 94 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const lognormal_distribution& __x, const lognormal_distribution& __y) { |
| 95 | return __x.__nd_ == __y.__nd_; | 95 | return __x.__nd_ == __y.__nd_; |
lib/libcxx/include/__random/mersenne_twister_engine.h+73-62| ... | @@ -161,8 +161,8 @@ public: | ... | @@ -161,8 +161,8 @@ public: |
| 161 | static inline _LIBCPP_CONSTEXPR const result_type tempering_c = __c; | 161 | static inline _LIBCPP_CONSTEXPR const result_type tempering_c = __c; |
| 162 | static inline _LIBCPP_CONSTEXPR const size_t tempering_l = __l; | 162 | static inline _LIBCPP_CONSTEXPR const size_t tempering_l = __l; |
| 163 | static inline _LIBCPP_CONSTEXPR const result_type initialization_multiplier = __f; | 163 | static inline _LIBCPP_CONSTEXPR const result_type initialization_multiplier = __f; |
| 164 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } | 164 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } |
| 165 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } | 165 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } |
| 166 | static inline _LIBCPP_CONSTEXPR const result_type default_seed = 5489u; | 166 | static inline _LIBCPP_CONSTEXPR const result_type default_seed = 5489u; |
| 167 | 167 | ||
| 168 | // constructors and seeding functions | 168 | // constructors and seeding functions |
| ... | @@ -172,7 +172,7 @@ public: | ... | @@ -172,7 +172,7 @@ public: |
| 172 | #else | 172 | #else |
| 173 | _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(result_type __sd = default_seed) { seed(__sd); } | 173 | _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(result_type __sd = default_seed) { seed(__sd); } |
| 174 | #endif | 174 | #endif |
| 175 | template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0> | 175 | template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, mersenne_twister_engine>, int> = 0> |
| 176 | _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(_Sseq& __q) { | 176 | _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(_Sseq& __q) { |
| 177 | seed(__q); | 177 | seed(__q); |
| 178 | } | 178 | } |
| ... | @@ -181,21 +181,68 @@ public: | ... | @@ -181,21 +181,68 @@ public: |
| 181 | for (size_t __i = 1; __i < __n; ++__i) | 181 | for (size_t __i = 1; __i < __n; ++__i) |
| 182 | __x_[__i] = (__f * (__x_[__i - 1] ^ __rshift<__w - 2>(__x_[__i - 1])) + __i) & _Max; | 182 | __x_[__i] = (__f * (__x_[__i - 1] ^ __rshift<__w - 2>(__x_[__i - 1])) + __i) & _Max; |
| 183 | __i_ = 0; | 183 | __i_ = 0; |
| 184 | #ifdef _LIBCPP_ABI_VECTORIZED_MERSENNE_TWISTER_ENGINE | ||
| 185 | __update_all_states(); | ||
| 186 | #endif | ||
| 184 | } | 187 | } |
| 185 | template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0> | 188 | template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, mersenne_twister_engine>, int> = 0> |
| 186 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { | 189 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { |
| 187 | __seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>()); | 190 | const unsigned __k = 1 + (__w - 1) / 32; |
| 191 | static_assert(__k <= 2); | ||
| 192 | uint32_t __ar[__n * __k]; | ||
| 193 | __q.generate(__ar, __ar + __n * __k); | ||
| 194 | for (size_t __i = 0; __i < __n; ++__i) { | ||
| 195 | if _LIBCPP_CONSTEXPR (__k == 1) { | ||
| 196 | __x_[__i] = static_cast<result_type>(__ar[__i] & _Max); | ||
| 197 | } else { | ||
| 198 | __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max); | ||
| 199 | } | ||
| 200 | } | ||
| 201 | const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1); | ||
| 202 | __i_ = 0; | ||
| 203 | if ((__x_[0] & ~__mask) == 0) { | ||
| 204 | for (size_t __i = 1; __i < __n; ++__i) | ||
| 205 | if (__x_[__i] != 0) | ||
| 206 | return; | ||
| 207 | __x_[0] = result_type(1) << (__w - 1); | ||
| 208 | } | ||
| 209 | #ifdef _LIBCPP_ABI_VECTORIZED_MERSENNE_TWISTER_ENGINE | ||
| 210 | __update_all_states(); | ||
| 211 | #endif | ||
| 188 | } | 212 | } |
| 189 | 213 | ||
| 190 | // generating functions | 214 | void __update_state(size_t __i, size_t __k) { |
| 191 | _LIBCPP_HIDE_FROM_ABI result_type operator()() { | 215 | const size_t __j = (__i + 1) % __n; |
| 192 | const size_t __j = (__i_ + 1) % __n; | ||
| 193 | const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1); | 216 | const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1); |
| 194 | const result_type __yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask); | 217 | const result_type __yp = (__x_[__i] & ~__mask) | (__x_[__j] & __mask); |
| 195 | const size_t __k = (__i_ + __m) % __n; | 218 | __x_[__i] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1)); |
| 196 | __x_[__i_] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1)); | 219 | } |
| 197 | result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d); | 220 | |
| 198 | __i_ = __j; | 221 | void __update_state(size_t __i) { __update_state(__i, (__i + __m) % __n); } |
| 222 | |||
| 223 | void __update_all_states() { | ||
| 224 | size_t __i = 0; | ||
| 225 | // This is split into two loops to help the compiler vectorize the code | ||
| 226 | for (; __i != (__n - __m); ++__i) | ||
| 227 | __update_state(__i); | ||
| 228 | for (size_t __j = 0; __i != __n; ++__i, ++__j) | ||
| 229 | __update_state(__i, __j); | ||
| 230 | } | ||
| 231 | |||
| 232 | // generating functions | ||
| 233 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()() { | ||
| 234 | #ifdef _LIBCPP_ABI_VECTORIZED_MERSENNE_TWISTER_ENGINE | ||
| 235 | result_type __val = __x_[__i_]; | ||
| 236 | if (++__i_ == __n) [[__unlikely__]] { | ||
| 237 | __update_all_states(); | ||
| 238 | __i_ = 0; | ||
| 239 | } | ||
| 240 | #else | ||
| 241 | __update_state(__i_); | ||
| 242 | result_type __val = __x_[__i_]; | ||
| 243 | __i_ = (__i_ + 1) % __n; | ||
| 244 | #endif | ||
| 245 | result_type __z = __val ^ (__rshift<__u>(__val) & __d); | ||
| 199 | __z ^= __lshift<__s>(__z) & __b; | 246 | __z ^= __lshift<__s>(__z) & __b; |
| 200 | __z ^= __lshift<__t>(__z) & __c; | 247 | __z ^= __lshift<__t>(__z) & __c; |
| 201 | return __z ^ __rshift<__l>(__z); | 248 | return __z ^ __rshift<__l>(__z); |
| ... | @@ -203,7 +250,7 @@ public: | ... | @@ -203,7 +250,7 @@ public: |
| 203 | 250 | ||
| 204 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { | 251 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { |
| 205 | for (; __z; --__z) | 252 | for (; __z; --__z) |
| 206 | operator()(); | 253 | (void)operator()(); |
| 207 | } | 254 | } |
| 208 | 255 | ||
| 209 | template <class _UInt, | 256 | template <class _UInt, |
| ... | @@ -265,59 +312,23 @@ public: | ... | @@ -265,59 +312,23 @@ public: |
| 265 | mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); | 312 | mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); |
| 266 | 313 | ||
| 267 | private: | 314 | private: |
| 268 | template <class _Sseq> | 315 | template <size_t __count> |
| 269 | _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>) { | 316 | _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) { |
| 270 | const unsigned __k = 1; | 317 | if _LIBCPP_CONSTEXPR (__count < __w) { |
| 271 | uint32_t __ar[__n * __k]; | 318 | return (__x << __count) & _Max; |
| 272 | __q.generate(__ar, __ar + __n * __k); | 319 | } else { |
| 273 | for (size_t __i = 0; __i < __n; ++__i) | 320 | return result_type(0); |
| 274 | __x_[__i] = static_cast<result_type>(__ar[__i] & _Max); | ||
| 275 | const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1); | ||
| 276 | __i_ = 0; | ||
| 277 | if ((__x_[0] & ~__mask) == 0) { | ||
| 278 | for (size_t __i = 1; __i < __n; ++__i) | ||
| 279 | if (__x_[__i] != 0) | ||
| 280 | return; | ||
| 281 | __x_[0] = result_type(1) << (__w - 1); | ||
| 282 | } | 321 | } |
| 283 | } | 322 | } |
| 284 | 323 | ||
| 285 | template <class _Sseq> | 324 | template <size_t __count> |
| 286 | _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>) { | 325 | _LIBCPP_HIDE_FROM_ABI static result_type __rshift(result_type __x) { |
| 287 | const unsigned __k = 2; | 326 | if _LIBCPP_CONSTEXPR (__count < _Dt) { |
| 288 | uint32_t __ar[__n * __k]; | 327 | return __x >> __count; |
| 289 | __q.generate(__ar, __ar + __n * __k); | 328 | } else { |
| 290 | for (size_t __i = 0; __i < __n; ++__i) | 329 | return result_type(0); |
| 291 | __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max); | ||
| 292 | const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1); | ||
| 293 | __i_ = 0; | ||
| 294 | if ((__x_[0] & ~__mask) == 0) { | ||
| 295 | for (size_t __i = 1; __i < __n; ++__i) | ||
| 296 | if (__x_[__i] != 0) | ||
| 297 | return; | ||
| 298 | __x_[0] = result_type(1) << (__w - 1); | ||
| 299 | } | 330 | } |
| 300 | } | 331 | } |
| 301 | |||
| 302 | template <size_t __count, | ||
| 303 | __enable_if_t<__count< __w, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) { | ||
| 304 | return (__x << __count) & _Max; | ||
| 305 | } | ||
| 306 | |||
| 307 | template <size_t __count, __enable_if_t<(__count >= __w), int> = 0> | ||
| 308 | _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type) { | ||
| 309 | return result_type(0); | ||
| 310 | } | ||
| 311 | |||
| 312 | template <size_t __count, | ||
| 313 | __enable_if_t<__count< _Dt, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __rshift(result_type __x) { | ||
| 314 | return __x >> __count; | ||
| 315 | } | ||
| 316 | |||
| 317 | template <size_t __count, __enable_if_t<(__count >= _Dt), int> = 0> | ||
| 318 | _LIBCPP_HIDE_FROM_ABI static result_type __rshift(result_type) { | ||
| 319 | return result_type(0); | ||
| 320 | } | ||
| 321 | }; | 332 | }; |
| 322 | 333 | ||
| 323 | template <class _UInt, | 334 | template <class _UInt, |
lib/libcxx/include/__random/negative_binomial_distribution.h+9-9| ... | @@ -44,8 +44,8 @@ public: | ... | @@ -44,8 +44,8 @@ public: |
| 44 | 44 | ||
| 45 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __k = 1, double __p = 0.5) : __k_(__k), __p_(__p) {} | 45 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __k = 1, double __p = 0.5) : __k_(__k), __p_(__p) {} |
| 46 | 46 | ||
| 47 | _LIBCPP_HIDE_FROM_ABI result_type k() const { return __k_; } | 47 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type k() const { return __k_; } |
| 48 | _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; } | 48 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; } |
| 49 | 49 | ||
| 50 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 50 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 51 | return __x.__k_ == __y.__k_ && __x.__p_ == __y.__p_; | 51 | return __x.__k_ == __y.__k_ && __x.__p_ == __y.__p_; |
| ... | @@ -70,21 +70,21 @@ public: | ... | @@ -70,21 +70,21 @@ public: |
| 70 | 70 | ||
| 71 | // generating functions | 71 | // generating functions |
| 72 | template <class _URNG> | 72 | template <class _URNG> |
| 73 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 73 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 74 | return (*this)(__g, __p_); | 74 | return (*this)(__g, __p_); |
| 75 | } | 75 | } |
| 76 | template <class _URNG> | 76 | template <class _URNG> |
| 77 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 77 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 78 | 78 | ||
| 79 | // property functions | 79 | // property functions |
| 80 | _LIBCPP_HIDE_FROM_ABI result_type k() const { return __p_.k(); } | 80 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type k() const { return __p_.k(); } |
| 81 | _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); } | 81 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); } |
| 82 | 82 | ||
| 83 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 83 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 84 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 84 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 85 | 85 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } | 86 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } |
| 87 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); } | 87 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); } |
| 88 | 88 | ||
| 89 | friend _LIBCPP_HIDE_FROM_ABI bool | 89 | friend _LIBCPP_HIDE_FROM_ABI bool |
| 90 | operator==(const negative_binomial_distribution& __x, const negative_binomial_distribution& __y) { | 90 | operator==(const negative_binomial_distribution& __x, const negative_binomial_distribution& __y) { |
lib/libcxx/include/__random/normal_distribution.h+9-9| ... | @@ -44,8 +44,8 @@ public: | ... | @@ -44,8 +44,8 @@ public: |
| 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __mean = 0, result_type __stddev = 1) | 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __mean = 0, result_type __stddev = 1) |
| 45 | : __mean_(__mean), __stddev_(__stddev) {} | 45 | : __mean_(__mean), __stddev_(__stddev) {} |
| 46 | 46 | ||
| 47 | _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __mean_; } | 47 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __mean_; } |
| 48 | _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __stddev_; } | 48 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __stddev_; } |
| 49 | 49 | ||
| 50 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 50 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 51 | return __x.__mean_ == __y.__mean_ && __x.__stddev_ == __y.__stddev_; | 51 | return __x.__mean_ == __y.__mean_ && __x.__stddev_ == __y.__stddev_; |
| ... | @@ -73,21 +73,21 @@ public: | ... | @@ -73,21 +73,21 @@ public: |
| 73 | 73 | ||
| 74 | // generating functions | 74 | // generating functions |
| 75 | template <class _URNG> | 75 | template <class _URNG> |
| 76 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 76 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 77 | return (*this)(__g, __p_); | 77 | return (*this)(__g, __p_); |
| 78 | } | 78 | } |
| 79 | template <class _URNG> | 79 | template <class _URNG> |
| 80 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 80 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 81 | 81 | ||
| 82 | // property functions | 82 | // property functions |
| 83 | _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __p_.mean(); } | 83 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __p_.mean(); } |
| 84 | _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __p_.stddev(); } | 84 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __p_.stddev(); } |
| 85 | 85 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 86 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 87 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 87 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 88 | 88 | ||
| 89 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); } | 89 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); } |
| 90 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } | 90 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } |
| 91 | 91 | ||
| 92 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const normal_distribution& __x, const normal_distribution& __y) { | 92 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const normal_distribution& __x, const normal_distribution& __y) { |
| 93 | return __x.__p_ == __y.__p_ && __x.__v_hot_ == __y.__v_hot_ && (!__x.__v_hot_ || __x.__v_ == __y.__v_); | 93 | return __x.__p_ == __y.__p_ && __x.__v_hot_ == __y.__v_hot_ && (!__x.__v_hot_ || __x.__v_ == __y.__v_); |
lib/libcxx/include/__random/piecewise_constant_distribution.h+9-9| ... | @@ -59,8 +59,8 @@ public: | ... | @@ -59,8 +59,8 @@ public: |
| 59 | _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default; | 59 | _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default; |
| 60 | _LIBCPP_HIDE_FROM_ABI param_type& operator=(const param_type& __rhs); | 60 | _LIBCPP_HIDE_FROM_ABI param_type& operator=(const param_type& __rhs); |
| 61 | 61 | ||
| 62 | _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; } | 62 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; } |
| 63 | _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; } | 63 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; } |
| 64 | 64 | ||
| 65 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 65 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 66 | return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_; | 66 | return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_; |
| ... | @@ -109,21 +109,21 @@ public: | ... | @@ -109,21 +109,21 @@ public: |
| 109 | 109 | ||
| 110 | // generating functions | 110 | // generating functions |
| 111 | template <class _URNG> | 111 | template <class _URNG> |
| 112 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 112 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 113 | return (*this)(__g, __p_); | 113 | return (*this)(__g, __p_); |
| 114 | } | 114 | } |
| 115 | template <class _URNG> | 115 | template <class _URNG> |
| 116 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 116 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 117 | 117 | ||
| 118 | // property functions | 118 | // property functions |
| 119 | _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); } | 119 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); } |
| 120 | _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); } | 120 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); } |
| 121 | 121 | ||
| 122 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 122 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 123 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 123 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 124 | 124 | ||
| 125 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); } | 125 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); } |
| 126 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); } | 126 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); } |
| 127 | 127 | ||
| 128 | friend _LIBCPP_HIDE_FROM_ABI bool | 128 | friend _LIBCPP_HIDE_FROM_ABI bool |
| 129 | operator==(const piecewise_constant_distribution& __x, const piecewise_constant_distribution& __y) { | 129 | operator==(const piecewise_constant_distribution& __x, const piecewise_constant_distribution& __y) { |
lib/libcxx/include/__random/piecewise_linear_distribution.h+9-9| ... | @@ -60,8 +60,8 @@ public: | ... | @@ -60,8 +60,8 @@ public: |
| 60 | _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default; | 60 | _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default; |
| 61 | _LIBCPP_HIDE_FROM_ABI param_type& operator=(const param_type& __rhs); | 61 | _LIBCPP_HIDE_FROM_ABI param_type& operator=(const param_type& __rhs); |
| 62 | 62 | ||
| 63 | _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; } | 63 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; } |
| 64 | _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; } | 64 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; } |
| 65 | 65 | ||
| 66 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 66 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 67 | return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_; | 67 | return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_; |
| ... | @@ -110,21 +110,21 @@ public: | ... | @@ -110,21 +110,21 @@ public: |
| 110 | 110 | ||
| 111 | // generating functions | 111 | // generating functions |
| 112 | template <class _URNG> | 112 | template <class _URNG> |
| 113 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 113 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 114 | return (*this)(__g, __p_); | 114 | return (*this)(__g, __p_); |
| 115 | } | 115 | } |
| 116 | template <class _URNG> | 116 | template <class _URNG> |
| 117 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 117 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 118 | 118 | ||
| 119 | // property functions | 119 | // property functions |
| 120 | _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); } | 120 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); } |
| 121 | _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); } | 121 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); } |
| 122 | 122 | ||
| 123 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 123 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 124 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 124 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 125 | 125 | ||
| 126 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); } | 126 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); } |
| 127 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); } | 127 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); } |
| 128 | 128 | ||
| 129 | friend _LIBCPP_HIDE_FROM_ABI bool | 129 | friend _LIBCPP_HIDE_FROM_ABI bool |
| 130 | operator==(const piecewise_linear_distribution& __x, const piecewise_linear_distribution& __y) { | 130 | operator==(const piecewise_linear_distribution& __x, const piecewise_linear_distribution& __y) { |
lib/libcxx/include/__random/poisson_distribution.h+7-7| ... | @@ -53,7 +53,7 @@ public: | ... | @@ -53,7 +53,7 @@ public: |
| 53 | 53 | ||
| 54 | _LIBCPP_HIDE_FROM_ABI explicit param_type(double __mean = 1.0); | 54 | _LIBCPP_HIDE_FROM_ABI explicit param_type(double __mean = 1.0); |
| 55 | 55 | ||
| 56 | _LIBCPP_HIDE_FROM_ABI double mean() const { return __mean_; } | 56 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double mean() const { return __mean_; } |
| 57 | 57 | ||
| 58 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 58 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 59 | return __x.__mean_ == __y.__mean_; | 59 | return __x.__mean_ == __y.__mean_; |
| ... | @@ -79,20 +79,20 @@ public: | ... | @@ -79,20 +79,20 @@ public: |
| 79 | 79 | ||
| 80 | // generating functions | 80 | // generating functions |
| 81 | template <class _URNG> | 81 | template <class _URNG> |
| 82 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 82 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 83 | return (*this)(__g, __p_); | 83 | return (*this)(__g, __p_); |
| 84 | } | 84 | } |
| 85 | template <class _URNG> | 85 | template <class _URNG> |
| 86 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 86 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 87 | 87 | ||
| 88 | // property functions | 88 | // property functions |
| 89 | _LIBCPP_HIDE_FROM_ABI double mean() const { return __p_.mean(); } | 89 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double mean() const { return __p_.mean(); } |
| 90 | 90 | ||
| 91 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 91 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 92 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 92 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 93 | 93 | ||
| 94 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } | 94 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } |
| 95 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); } | 95 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); } |
| 96 | 96 | ||
| 97 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const poisson_distribution& __x, const poisson_distribution& __y) { | 97 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const poisson_distribution& __x, const poisson_distribution& __y) { |
| 98 | return __x.__p_ == __y.__p_; | 98 | return __x.__p_ == __y.__p_; |
lib/libcxx/include/__random/random_device.h+11-13| ... | @@ -19,27 +19,24 @@ | ... | @@ -19,27 +19,24 @@ |
| 19 | _LIBCPP_PUSH_MACROS | 19 | _LIBCPP_PUSH_MACROS |
| 20 | #include <__undef_macros> | 20 | #include <__undef_macros> |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_HAS_RANDOM_DEVICE | 22 | #if _LIBCPP_HAS_RANDOM_DEVICE |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 26 | |||
| 26 | class _LIBCPP_EXPORTED_FROM_ABI random_device { | 27 | class _LIBCPP_EXPORTED_FROM_ABI random_device { |
| 27 | # ifdef _LIBCPP_USING_DEV_RANDOM | 28 | # ifdef _LIBCPP_USING_DEV_RANDOM |
| 28 | int __f_; | 29 | int __f_; |
| 29 | # elif !defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT) | 30 | # elif !defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT) |
| 30 | _LIBCPP_DIAGNOSTIC_PUSH | ||
| 31 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field") | ||
| 32 | |||
| 33 | // Apple platforms used to use the `_LIBCPP_USING_DEV_RANDOM` code path, and now | 31 | // Apple platforms used to use the `_LIBCPP_USING_DEV_RANDOM` code path, and now |
| 34 | // use `arc4random()` as of this comment. In order to avoid breaking the ABI, we | 32 | // use `arc4random()` as of this comment. In order to avoid breaking the ABI, we |
| 35 | // retain the same layout as before. | 33 | // retain the same layout as before. |
| 36 | # if defined(__APPLE__) | 34 | # if defined(__APPLE__) |
| 37 | int __padding_; // padding to fake the `__f_` field above | 35 | [[__maybe_unused__]] int __padding_; // padding to fake the `__f_` field above |
| 38 | # endif | 36 | # endif |
| 39 | 37 | ||
| 40 | // ... vendors can add workarounds here if they switch to a different representation ... | 38 | // ... vendors can add workarounds here if they switch to a different representation ... |
| 41 | 39 | ||
| 42 | _LIBCPP_DIAGNOSTIC_POP | ||
| 43 | # endif | 40 | # endif |
| 44 | 41 | ||
| 45 | public: | 42 | public: |
| ... | @@ -50,8 +47,8 @@ public: | ... | @@ -50,8 +47,8 @@ public: |
| 50 | static _LIBCPP_CONSTEXPR const result_type _Min = 0; | 47 | static _LIBCPP_CONSTEXPR const result_type _Min = 0; |
| 51 | static _LIBCPP_CONSTEXPR const result_type _Max = 0xFFFFFFFFu; | 48 | static _LIBCPP_CONSTEXPR const result_type _Max = 0xFFFFFFFFu; |
| 52 | 49 | ||
| 53 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } | 50 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } |
| 54 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } | 51 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } |
| 55 | 52 | ||
| 56 | // constructors | 53 | // constructors |
| 57 | # ifndef _LIBCPP_CXX03_LANG | 54 | # ifndef _LIBCPP_CXX03_LANG |
| ... | @@ -63,19 +60,20 @@ public: | ... | @@ -63,19 +60,20 @@ public: |
| 63 | ~random_device(); | 60 | ~random_device(); |
| 64 | 61 | ||
| 65 | // generating functions | 62 | // generating functions |
| 66 | result_type operator()(); | 63 | [[__nodiscard__]] result_type operator()(); |
| 67 | 64 | ||
| 68 | // property functions | 65 | // property functions |
| 69 | double entropy() const _NOEXCEPT; | 66 | [[__nodiscard__]] double entropy() const _NOEXCEPT; |
| 70 | 67 | ||
| 71 | random_device(const random_device&) = delete; | 68 | random_device(const random_device&) = delete; |
| 72 | void operator=(const random_device&) = delete; | 69 | void operator=(const random_device&) = delete; |
| 73 | }; | 70 | }; |
| 74 | 71 | ||
| 75 | #endif // _LIBCPP_HAS_RANDOM_DEVICE | 72 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS |
| 76 | |||
| 77 | _LIBCPP_END_NAMESPACE_STD | 73 | _LIBCPP_END_NAMESPACE_STD |
| 78 | 74 | ||
| 75 | #endif // _LIBCPP_HAS_RANDOM_DEVICE | ||
| 76 | |||
| 79 | _LIBCPP_POP_MACROS | 77 | _LIBCPP_POP_MACROS |
| 80 | 78 | ||
| 81 | #endif // _LIBCPP___RANDOM_RANDOM_DEVICE_H | 79 | #endif // _LIBCPP___RANDOM_RANDOM_DEVICE_H |
lib/libcxx/include/__random/seed_seq.h+2-2| ... | @@ -56,7 +56,7 @@ public: | ... | @@ -56,7 +56,7 @@ public: |
| 56 | _LIBCPP_HIDE_FROM_ABI void generate(_RandomAccessIterator __first, _RandomAccessIterator __last); | 56 | _LIBCPP_HIDE_FROM_ABI void generate(_RandomAccessIterator __first, _RandomAccessIterator __last); |
| 57 | 57 | ||
| 58 | // property functions | 58 | // property functions |
| 59 | _LIBCPP_HIDE_FROM_ABI size_t size() const _NOEXCEPT { return __v_.size(); } | 59 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t size() const _NOEXCEPT { return __v_.size(); } |
| 60 | template <class _OutputIterator> | 60 | template <class _OutputIterator> |
| 61 | _LIBCPP_HIDE_FROM_ABI void param(_OutputIterator __dest) const { | 61 | _LIBCPP_HIDE_FROM_ABI void param(_OutputIterator __dest) const { |
| 62 | std::copy(__v_.begin(), __v_.end(), __dest); | 62 | std::copy(__v_.begin(), __v_.end(), __dest); |
| ... | @@ -65,7 +65,7 @@ public: | ... | @@ -65,7 +65,7 @@ public: |
| 65 | seed_seq(const seed_seq&) = delete; | 65 | seed_seq(const seed_seq&) = delete; |
| 66 | void operator=(const seed_seq&) = delete; | 66 | void operator=(const seed_seq&) = delete; |
| 67 | 67 | ||
| 68 | _LIBCPP_HIDE_FROM_ABI static result_type _Tp(result_type __x) { return __x ^ (__x >> 27); } | 68 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static result_type _Tp(result_type __x) { return __x ^ (__x >> 27); } |
| 69 | 69 | ||
| 70 | private: | 70 | private: |
| 71 | template <class _InputIterator> | 71 | template <class _InputIterator> |
lib/libcxx/include/__random/shuffle_order_engine.h+23-33| ... | @@ -76,8 +76,8 @@ public: | ... | @@ -76,8 +76,8 @@ public: |
| 76 | static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max(); | 76 | static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max(); |
| 77 | #endif | 77 | #endif |
| 78 | static_assert(_Min < _Max, "shuffle_order_engine invalid parameters"); | 78 | static_assert(_Min < _Max, "shuffle_order_engine invalid parameters"); |
| 79 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } | 79 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } |
| 80 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } | 80 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } |
| 81 | 81 | ||
| 82 | static _LIBCPP_CONSTEXPR const unsigned long long _Rp = _Max - _Min + 1ull; | 82 | static _LIBCPP_CONSTEXPR const unsigned long long _Rp = _Max - _Min + 1ull; |
| 83 | 83 | ||
| ... | @@ -88,10 +88,9 @@ public: | ... | @@ -88,10 +88,9 @@ public: |
| 88 | _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(_Engine&& __e) : __e_(std::move(__e)) { __init(); } | 88 | _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(_Engine&& __e) : __e_(std::move(__e)) { __init(); } |
| 89 | #endif // _LIBCPP_CXX03_LANG | 89 | #endif // _LIBCPP_CXX03_LANG |
| 90 | _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(result_type __sd) : __e_(__sd) { __init(); } | 90 | _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(result_type __sd) : __e_(__sd) { __init(); } |
| 91 | template < | 91 | template <class _Sseq, |
| 92 | class _Sseq, | 92 | __enable_if_t<__is_seed_sequence_v<_Sseq, shuffle_order_engine> && !is_convertible<_Sseq, _Engine>::value, |
| 93 | __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value && !is_convertible<_Sseq, _Engine>::value, | 93 | int> = 0> |
| 94 | int> = 0> | ||
| 95 | _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(_Sseq& __q) : __e_(__q) { | 94 | _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(_Sseq& __q) : __e_(__q) { |
| 96 | __init(); | 95 | __init(); |
| 97 | } | 96 | } |
| ... | @@ -103,21 +102,35 @@ public: | ... | @@ -103,21 +102,35 @@ public: |
| 103 | __e_.seed(__sd); | 102 | __e_.seed(__sd); |
| 104 | __init(); | 103 | __init(); |
| 105 | } | 104 | } |
| 106 | template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value, int> = 0> | 105 | template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, shuffle_order_engine>, int> = 0> |
| 107 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { | 106 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { |
| 108 | __e_.seed(__q); | 107 | __e_.seed(__q); |
| 109 | __init(); | 108 | __init(); |
| 110 | } | 109 | } |
| 111 | 110 | ||
| 112 | // generating functions | 111 | // generating functions |
| 113 | _LIBCPP_HIDE_FROM_ABI result_type operator()() { return __eval(integral_constant<bool, _Rp != 0>()); } | 112 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()() { |
| 113 | if _LIBCPP_CONSTEXPR (_Rp != 0 || !(__k & 1)) { | ||
| 114 | using _Ratio = __uratio<__k, _Rp != 0 ? _Rp : 0x8000000000000000ull>; | ||
| 115 | if _LIBCPP_CONSTEXPR (_Ratio::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)) { | ||
| 116 | return __evalf<_Ratio::num, _Ratio::den>(); | ||
| 117 | } else { | ||
| 118 | const size_t __j = static_cast<size_t>(_Ratio::num * (__y_ - _Min) / _Ratio::den); | ||
| 119 | __y_ = __v_[__j]; | ||
| 120 | __v_[__j] = __e_(); | ||
| 121 | return __y_; | ||
| 122 | } | ||
| 123 | } else | ||
| 124 | return __evalf<__k, 0>(); | ||
| 125 | } | ||
| 126 | |||
| 114 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { | 127 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { |
| 115 | for (; __z; --__z) | 128 | for (; __z; --__z) |
| 116 | operator()(); | 129 | (void)operator()(); |
| 117 | } | 130 | } |
| 118 | 131 | ||
| 119 | // property functions | 132 | // property functions |
| 120 | _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; } | 133 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; } |
| 121 | 134 | ||
| 122 | private: | 135 | private: |
| 123 | template <class _Eng, size_t _Kp> | 136 | template <class _Eng, size_t _Kp> |
| ... | @@ -140,29 +153,6 @@ private: | ... | @@ -140,29 +153,6 @@ private: |
| 140 | __y_ = __e_(); | 153 | __y_ = __e_(); |
| 141 | } | 154 | } |
| 142 | 155 | ||
| 143 | _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type) { return __eval2(integral_constant<bool, __k & 1>()); } | ||
| 144 | _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type) { return __eval(__uratio<__k, _Rp>()); } | ||
| 145 | |||
| 146 | _LIBCPP_HIDE_FROM_ABI result_type __eval2(false_type) { return __eval(__uratio<__k / 2, 0x8000000000000000ull>()); } | ||
| 147 | _LIBCPP_HIDE_FROM_ABI result_type __eval2(true_type) { return __evalf<__k, 0>(); } | ||
| 148 | |||
| 149 | template <uint64_t _Np, | ||
| 150 | uint64_t _Dp, | ||
| 151 | __enable_if_t<(__uratio<_Np, _Dp>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)), int> = 0> | ||
| 152 | _LIBCPP_HIDE_FROM_ABI result_type __eval(__uratio<_Np, _Dp>) { | ||
| 153 | return __evalf<__uratio<_Np, _Dp>::num, __uratio<_Np, _Dp>::den>(); | ||
| 154 | } | ||
| 155 | |||
| 156 | template <uint64_t _Np, | ||
| 157 | uint64_t _Dp, | ||
| 158 | __enable_if_t<__uratio<_Np, _Dp>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min), int> = 0> | ||
| 159 | _LIBCPP_HIDE_FROM_ABI result_type __eval(__uratio<_Np, _Dp>) { | ||
| 160 | const size_t __j = static_cast<size_t>(__uratio<_Np, _Dp>::num * (__y_ - _Min) / __uratio<_Np, _Dp>::den); | ||
| 161 | __y_ = __v_[__j]; | ||
| 162 | __v_[__j] = __e_(); | ||
| 163 | return __y_; | ||
| 164 | } | ||
| 165 | |||
| 166 | template <uint64_t __n, uint64_t __d> | 156 | template <uint64_t __n, uint64_t __d> |
| 167 | _LIBCPP_HIDE_FROM_ABI result_type __evalf() { | 157 | _LIBCPP_HIDE_FROM_ABI result_type __evalf() { |
| 168 | const double __fp = __d == 0 ? __n / (2. * 0x8000000000000000ull) : __n / (double)__d; | 158 | const double __fp = __d == 0 ? __n / (2. * 0x8000000000000000ull) : __n / (double)__d; |
lib/libcxx/include/__random/student_t_distribution.h+7-7| ... | @@ -43,7 +43,7 @@ public: | ... | @@ -43,7 +43,7 @@ public: |
| 43 | 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __n = 1) : __n_(__n) {} | 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __n = 1) : __n_(__n) {} |
| 45 | 45 | ||
| 46 | _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; } | 46 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; } |
| 47 | 47 | ||
| 48 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 48 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 49 | return __x.__n_ == __y.__n_; | 49 | return __x.__n_ == __y.__n_; |
| ... | @@ -68,20 +68,20 @@ public: | ... | @@ -68,20 +68,20 @@ public: |
| 68 | 68 | ||
| 69 | // generating functions | 69 | // generating functions |
| 70 | template <class _URNG> | 70 | template <class _URNG> |
| 71 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 71 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 72 | return (*this)(__g, __p_); | 72 | return (*this)(__g, __p_); |
| 73 | } | 73 | } |
| 74 | template <class _URNG> | 74 | template <class _URNG> |
| 75 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 75 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 76 | 76 | ||
| 77 | // property functions | 77 | // property functions |
| 78 | _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); } | 78 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); } |
| 79 | 79 | ||
| 80 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 80 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 81 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 81 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 82 | 82 | ||
| 83 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); } | 83 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); } |
| 84 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } | 84 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } |
| 85 | 85 | ||
| 86 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const student_t_distribution& __x, const student_t_distribution& __y) { | 86 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const student_t_distribution& __x, const student_t_distribution& __y) { |
| 87 | return __x.__p_ == __y.__p_; | 87 | return __x.__p_ == __y.__p_; |
lib/libcxx/include/__random/subtract_with_carry_engine.h+31-60| ... | @@ -75,8 +75,8 @@ public: | ... | @@ -75,8 +75,8 @@ public: |
| 75 | static inline _LIBCPP_CONSTEXPR const size_t word_size = __w; | 75 | static inline _LIBCPP_CONSTEXPR const size_t word_size = __w; |
| 76 | static inline _LIBCPP_CONSTEXPR const size_t short_lag = __s; | 76 | static inline _LIBCPP_CONSTEXPR const size_t short_lag = __s; |
| 77 | static inline _LIBCPP_CONSTEXPR const size_t long_lag = __r; | 77 | static inline _LIBCPP_CONSTEXPR const size_t long_lag = __r; |
| 78 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } | 78 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } |
| 79 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } | 79 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } |
| 80 | static inline _LIBCPP_CONSTEXPR const result_type default_seed = 19780503u; | 80 | static inline _LIBCPP_CONSTEXPR const result_type default_seed = 19780503u; |
| 81 | 81 | ||
| 82 | // constructors and seeding functions | 82 | // constructors and seeding functions |
| ... | @@ -86,23 +86,46 @@ public: | ... | @@ -86,23 +86,46 @@ public: |
| 86 | #else | 86 | #else |
| 87 | _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(result_type __sd = default_seed) { seed(__sd); } | 87 | _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(result_type __sd = default_seed) { seed(__sd); } |
| 88 | #endif | 88 | #endif |
| 89 | template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0> | 89 | template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, subtract_with_carry_engine>, int> = 0> |
| 90 | _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(_Sseq& __q) { | 90 | _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(_Sseq& __q) { |
| 91 | seed(__q); | 91 | seed(__q); |
| 92 | } | 92 | } |
| 93 | |||
| 93 | _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd = default_seed) { | 94 | _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd = default_seed) { |
| 94 | seed(__sd, integral_constant<unsigned, 1 + (__w - 1) / 32>()); | 95 | linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd); |
| 96 | for (size_t __i = 0; __i < __r; ++__i) { | ||
| 97 | if _LIBCPP_CONSTEXPR ((1 + (__w - 1) / 32) == 1) { | ||
| 98 | __x_[__i] = static_cast<result_type>(__e() & _Max); | ||
| 99 | } else { | ||
| 100 | result_type __e0 = __e(); | ||
| 101 | __x_[__i] = static_cast<result_type>((__e0 + ((uint64_t)__e() << 32)) & _Max); | ||
| 102 | } | ||
| 103 | } | ||
| 104 | __c_ = __x_[__r - 1] == 0; | ||
| 105 | __i_ = 0; | ||
| 95 | } | 106 | } |
| 96 | template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0> | 107 | |
| 108 | template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, subtract_with_carry_engine>, int> = 0> | ||
| 97 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { | 109 | _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) { |
| 98 | __seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>()); | 110 | const unsigned __k = 1 + (__w - 1) / 32; |
| 111 | static_assert(__k <= 2); | ||
| 112 | uint32_t __ar[__r * __k]; | ||
| 113 | __q.generate(__ar, __ar + __r * __k); | ||
| 114 | for (size_t __i = 0; __i < __r; ++__i) { | ||
| 115 | if _LIBCPP_CONSTEXPR (__k == 1) | ||
| 116 | __x_[__i] = static_cast<result_type>(__ar[__i] & _Max); | ||
| 117 | else | ||
| 118 | __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max); | ||
| 119 | } | ||
| 120 | __c_ = __x_[__r - 1] == 0; | ||
| 121 | __i_ = 0; | ||
| 99 | } | 122 | } |
| 100 | 123 | ||
| 101 | // generating functions | 124 | // generating functions |
| 102 | _LIBCPP_HIDE_FROM_ABI result_type operator()(); | 125 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(); |
| 103 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { | 126 | _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) { |
| 104 | for (; __z; --__z) | 127 | for (; __z; --__z) |
| 105 | operator()(); | 128 | (void)operator()(); |
| 106 | } | 129 | } |
| 107 | 130 | ||
| 108 | template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> | 131 | template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> |
| ... | @@ -120,60 +143,8 @@ public: | ... | @@ -120,60 +143,8 @@ public: |
| 120 | template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> | 143 | template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> |
| 121 | friend basic_istream<_CharT, _Traits>& | 144 | friend basic_istream<_CharT, _Traits>& |
| 122 | operator>>(basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); | 145 | operator>>(basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); |
| 123 | |||
| 124 | private: | ||
| 125 | _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 1>); | ||
| 126 | _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 2>); | ||
| 127 | template <class _Sseq> | ||
| 128 | _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>); | ||
| 129 | template <class _Sseq> | ||
| 130 | _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>); | ||
| 131 | }; | 146 | }; |
| 132 | 147 | ||
| 133 | template <class _UIntType, size_t __w, size_t __s, size_t __r> | ||
| 134 | void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, integral_constant<unsigned, 1>) { | ||
| 135 | linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd); | ||
| 136 | for (size_t __i = 0; __i < __r; ++__i) | ||
| 137 | __x_[__i] = static_cast<result_type>(__e() & _Max); | ||
| 138 | __c_ = __x_[__r - 1] == 0; | ||
| 139 | __i_ = 0; | ||
| 140 | } | ||
| 141 | |||
| 142 | template <class _UIntType, size_t __w, size_t __s, size_t __r> | ||
| 143 | void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, integral_constant<unsigned, 2>) { | ||
| 144 | linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd); | ||
| 145 | for (size_t __i = 0; __i < __r; ++__i) { | ||
| 146 | result_type __e0 = __e(); | ||
| 147 | __x_[__i] = static_cast<result_type>((__e0 + ((uint64_t)__e() << 32)) & _Max); | ||
| 148 | } | ||
| 149 | __c_ = __x_[__r - 1] == 0; | ||
| 150 | __i_ = 0; | ||
| 151 | } | ||
| 152 | |||
| 153 | template <class _UIntType, size_t __w, size_t __s, size_t __r> | ||
| 154 | template <class _Sseq> | ||
| 155 | void subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q, integral_constant<unsigned, 1>) { | ||
| 156 | const unsigned __k = 1; | ||
| 157 | uint32_t __ar[__r * __k]; | ||
| 158 | __q.generate(__ar, __ar + __r * __k); | ||
| 159 | for (size_t __i = 0; __i < __r; ++__i) | ||
| 160 | __x_[__i] = static_cast<result_type>(__ar[__i] & _Max); | ||
| 161 | __c_ = __x_[__r - 1] == 0; | ||
| 162 | __i_ = 0; | ||
| 163 | } | ||
| 164 | |||
| 165 | template <class _UIntType, size_t __w, size_t __s, size_t __r> | ||
| 166 | template <class _Sseq> | ||
| 167 | void subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q, integral_constant<unsigned, 2>) { | ||
| 168 | const unsigned __k = 2; | ||
| 169 | uint32_t __ar[__r * __k]; | ||
| 170 | __q.generate(__ar, __ar + __r * __k); | ||
| 171 | for (size_t __i = 0; __i < __r; ++__i) | ||
| 172 | __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max); | ||
| 173 | __c_ = __x_[__r - 1] == 0; | ||
| 174 | __i_ = 0; | ||
| 175 | } | ||
| 176 | |||
| 177 | template <class _UIntType, size_t __w, size_t __s, size_t __r> | 148 | template <class _UIntType, size_t __w, size_t __s, size_t __r> |
| 178 | _UIntType subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()() { | 149 | _UIntType subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()() { |
| 179 | const result_type& __xs = __x_[(__i_ + (__r - __s)) % __r]; | 150 | const result_type& __xs = __x_[(__i_ + (__r - __s)) % __r]; |
lib/libcxx/include/__random/uniform_int_distribution.h+9-9| ... | @@ -151,8 +151,8 @@ public: | ... | @@ -151,8 +151,8 @@ public: |
| 151 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = numeric_limits<result_type>::max()) | 151 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = numeric_limits<result_type>::max()) |
| 152 | : __a_(__a), __b_(__b) {} | 152 | : __a_(__a), __b_(__b) {} |
| 153 | 153 | ||
| 154 | _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; } | 154 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; } |
| 155 | _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; } | 155 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; } |
| 156 | 156 | ||
| 157 | _LIBCPP_HIDE_FROM_ABI friend bool operator==(const param_type& __x, const param_type& __y) { | 157 | _LIBCPP_HIDE_FROM_ABI friend bool operator==(const param_type& __x, const param_type& __y) { |
| 158 | return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_; | 158 | return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_; |
| ... | @@ -179,21 +179,21 @@ public: | ... | @@ -179,21 +179,21 @@ public: |
| 179 | 179 | ||
| 180 | // generating functions | 180 | // generating functions |
| 181 | template <class _URNG> | 181 | template <class _URNG> |
| 182 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 182 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 183 | return (*this)(__g, __p_); | 183 | return (*this)(__g, __p_); |
| 184 | } | 184 | } |
| 185 | template <class _URNG> | 185 | template <class _URNG> |
| 186 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 186 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 187 | 187 | ||
| 188 | // property functions | 188 | // property functions |
| 189 | _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); } | 189 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); } |
| 190 | _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); } | 190 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); } |
| 191 | 191 | ||
| 192 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 192 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 193 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 193 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 194 | 194 | ||
| 195 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); } | 195 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); } |
| 196 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); } | 196 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); } |
| 197 | 197 | ||
| 198 | _LIBCPP_HIDE_FROM_ABI friend bool | 198 | _LIBCPP_HIDE_FROM_ABI friend bool |
| 199 | operator==(const uniform_int_distribution& __x, const uniform_int_distribution& __y) { | 199 | operator==(const uniform_int_distribution& __x, const uniform_int_distribution& __y) { |
lib/libcxx/include/__random/uniform_random_bit_generator.h+4-4| ... | @@ -23,10 +23,10 @@ | ... | @@ -23,10 +23,10 @@ |
| 23 | _LIBCPP_PUSH_MACROS | 23 | _LIBCPP_PUSH_MACROS |
| 24 | #include <__undef_macros> | 24 | #include <__undef_macros> |
| 25 | 25 | ||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 27 | |||
| 28 | #if _LIBCPP_STD_VER >= 20 | 26 | #if _LIBCPP_STD_VER >= 20 |
| 29 | 27 | ||
| 28 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 29 | |||
| 30 | // [rand.req.urng] | 30 | // [rand.req.urng] |
| 31 | template <class _Gen> | 31 | template <class _Gen> |
| 32 | concept uniform_random_bit_generator = invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>> && requires { | 32 | concept uniform_random_bit_generator = invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>> && requires { |
| ... | @@ -35,10 +35,10 @@ concept uniform_random_bit_generator = invocable<_Gen&> && unsigned_integral<inv | ... | @@ -35,10 +35,10 @@ concept uniform_random_bit_generator = invocable<_Gen&> && unsigned_integral<inv |
| 35 | requires bool_constant<(_Gen::min() < _Gen::max())>::value; | 35 | requires bool_constant<(_Gen::min() < _Gen::max())>::value; |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 39 | |||
| 40 | _LIBCPP_END_NAMESPACE_STD | 38 | _LIBCPP_END_NAMESPACE_STD |
| 41 | 39 | ||
| 40 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 41 | |||
| 42 | _LIBCPP_POP_MACROS | 42 | _LIBCPP_POP_MACROS |
| 43 | 43 | ||
| 44 | #endif // _LIBCPP___RANDOM_UNIFORM_RANDOM_BIT_GENERATOR_H | 44 | #endif // _LIBCPP___RANDOM_UNIFORM_RANDOM_BIT_GENERATOR_H |
lib/libcxx/include/__random/uniform_real_distribution.h+9-9| ... | @@ -42,8 +42,8 @@ public: | ... | @@ -42,8 +42,8 @@ public: |
| 42 | 42 | ||
| 43 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} | 43 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} |
| 44 | 44 | ||
| 45 | _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; } | 45 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; } |
| 46 | _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; } | 46 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; } |
| 47 | 47 | ||
| 48 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 48 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 49 | return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_; | 49 | return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_; |
| ... | @@ -69,21 +69,21 @@ public: | ... | @@ -69,21 +69,21 @@ public: |
| 69 | 69 | ||
| 70 | // generating functions | 70 | // generating functions |
| 71 | template <class _URNG> | 71 | template <class _URNG> |
| 72 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 72 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 73 | return (*this)(__g, __p_); | 73 | return (*this)(__g, __p_); |
| 74 | } | 74 | } |
| 75 | template <class _URNG> | 75 | template <class _URNG> |
| 76 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); | 76 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p); |
| 77 | 77 | ||
| 78 | // property functions | 78 | // property functions |
| 79 | _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); } | 79 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); } |
| 80 | _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); } | 80 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); } |
| 81 | 81 | ||
| 82 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 82 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 83 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 83 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 84 | 84 | ||
| 85 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); } | 85 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); } |
| 86 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); } | 86 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); } |
| 87 | 87 | ||
| 88 | friend _LIBCPP_HIDE_FROM_ABI bool | 88 | friend _LIBCPP_HIDE_FROM_ABI bool |
| 89 | operator==(const uniform_real_distribution& __x, const uniform_real_distribution& __y) { | 89 | operator==(const uniform_real_distribution& __x, const uniform_real_distribution& __y) { |
lib/libcxx/include/__random/weibull_distribution.h+9-9| ... | @@ -43,8 +43,8 @@ public: | ... | @@ -43,8 +43,8 @@ public: |
| 43 | 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 1, result_type __b = 1) : __a_(__a), __b_(__b) {} | 44 | _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 1, result_type __b = 1) : __a_(__a), __b_(__b) {} |
| 45 | 45 | ||
| 46 | _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; } | 46 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; } |
| 47 | _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; } | 47 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; } |
| 48 | 48 | ||
| 49 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { | 49 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) { |
| 50 | return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_; | 50 | return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_; |
| ... | @@ -70,23 +70,23 @@ public: | ... | @@ -70,23 +70,23 @@ public: |
| 70 | 70 | ||
| 71 | // generating functions | 71 | // generating functions |
| 72 | template <class _URNG> | 72 | template <class _URNG> |
| 73 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { | 73 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) { |
| 74 | return (*this)(__g, __p_); | 74 | return (*this)(__g, __p_); |
| 75 | } | 75 | } |
| 76 | template <class _URNG> | 76 | template <class _URNG> |
| 77 | _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) { | 77 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) { |
| 78 | return __p.b() * std::pow(exponential_distribution<result_type>()(__g), 1 / __p.a()); | 78 | return __p.b() * std::pow(exponential_distribution<result_type>()(__g), 1 / __p.a()); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | // property functions | 81 | // property functions |
| 82 | _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); } | 82 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); } |
| 83 | _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); } | 83 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); } |
| 84 | 84 | ||
| 85 | _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } | 85 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; } |
| 86 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } | 86 | _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; } |
| 87 | 87 | ||
| 88 | _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } | 88 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; } |
| 89 | _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } | 89 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); } |
| 90 | 90 | ||
| 91 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const weibull_distribution& __x, const weibull_distribution& __y) { | 91 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const weibull_distribution& __x, const weibull_distribution& __y) { |
| 92 | return __x.__p_ == __y.__p_; | 92 | return __x.__p_ == __y.__p_; |
lib/libcxx/include/__ranges/access.h+4-4| ... | @@ -27,10 +27,10 @@ | ... | @@ -27,10 +27,10 @@ |
| 27 | # pragma GCC system_header | 27 | # pragma GCC system_header |
| 28 | #endif | 28 | #endif |
| 29 | 29 | ||
| 30 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 31 | |||
| 32 | #if _LIBCPP_STD_VER >= 20 | 30 | #if _LIBCPP_STD_VER >= 20 |
| 33 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | |||
| 34 | namespace ranges { | 34 | namespace ranges { |
| 35 | template <class _Tp> | 35 | template <class _Tp> |
| 36 | concept __can_borrow = is_lvalue_reference_v<_Tp> || enable_borrowed_range<remove_cvref_t<_Tp>>; | 36 | concept __can_borrow = is_lvalue_reference_v<_Tp> || enable_borrowed_range<remove_cvref_t<_Tp>>; |
| ... | @@ -203,8 +203,8 @@ inline constexpr auto cend = __cend::__fn{}; | ... | @@ -203,8 +203,8 @@ inline constexpr auto cend = __cend::__fn{}; |
| 203 | } // namespace __cpo | 203 | } // namespace __cpo |
| 204 | } // namespace ranges | 204 | } // namespace ranges |
| 205 | 205 | ||
| 206 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 207 | |||
| 208 | _LIBCPP_END_NAMESPACE_STD | 206 | _LIBCPP_END_NAMESPACE_STD |
| 209 | 207 | ||
| 208 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 209 | |||
| 210 | #endif // _LIBCPP___RANGES_ACCESS_H | 210 | #endif // _LIBCPP___RANGES_ACCESS_H |
lib/libcxx/include/__ranges/adjacent_transform_view.h+20-19| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | #include <__concepts/derived_from.h> | 19 | #include <__concepts/derived_from.h> |
| 20 | #include <__concepts/equality_comparable.h> | 20 | #include <__concepts/equality_comparable.h> |
| 21 | #include <__concepts/invocable.h> | 21 | #include <__concepts/invocable.h> |
| 22 | #include <__concepts/referenceable.h> | ||
| 22 | #include <__cstddef/size_t.h> | 23 | #include <__cstddef/size_t.h> |
| 23 | #include <__functional/bind_back.h> | 24 | #include <__functional/bind_back.h> |
| 24 | #include <__functional/invoke.h> | 25 | #include <__functional/invoke.h> |
| ... | @@ -45,7 +46,6 @@ | ... | @@ -45,7 +46,6 @@ |
| 45 | #include <__type_traits/decay.h> | 46 | #include <__type_traits/decay.h> |
| 46 | #include <__type_traits/is_nothrow_constructible.h> | 47 | #include <__type_traits/is_nothrow_constructible.h> |
| 47 | #include <__type_traits/is_object.h> | 48 | #include <__type_traits/is_object.h> |
| 48 | #include <__type_traits/is_referenceable.h> | ||
| 49 | #include <__type_traits/make_unsigned.h> | 49 | #include <__type_traits/make_unsigned.h> |
| 50 | #include <__type_traits/maybe_const.h> | 50 | #include <__type_traits/maybe_const.h> |
| 51 | #include <__utility/declval.h> | 51 | #include <__utility/declval.h> |
| ... | @@ -105,22 +105,22 @@ public: | ... | @@ -105,22 +105,22 @@ public: |
| 105 | _LIBCPP_HIDE_FROM_ABI constexpr explicit adjacent_transform_view(_View __base, _Fn __fun) | 105 | _LIBCPP_HIDE_FROM_ABI constexpr explicit adjacent_transform_view(_View __base, _Fn __fun) |
| 106 | : __inner_(std::move(__base)), __fun_(std::in_place, std::move(__fun)) {} | 106 | : __inner_(std::move(__base)), __fun_(std::in_place, std::move(__fun)) {} |
| 107 | 107 | ||
| 108 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | 108 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& |
| 109 | requires copy_constructible<_View> | 109 | requires copy_constructible<_View> |
| 110 | { | 110 | { |
| 111 | return __inner_.base(); | 111 | return __inner_.base(); |
| 112 | } | 112 | } |
| 113 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__inner_).base(); } | 113 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__inner_).base(); } |
| 114 | 114 | ||
| 115 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { return __iterator<false>(*this, __inner_.begin()); } | 115 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { return __iterator<false>(*this, __inner_.begin()); } |
| 116 | 116 | ||
| 117 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | 117 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const |
| 118 | requires range<const _InnerView> && regular_invocable<__apply_n<const _Fn&, _Np>, range_reference_t<const _View>> | 118 | requires range<const _InnerView> && regular_invocable<__apply_n<const _Fn&, _Np>, range_reference_t<const _View>> |
| 119 | { | 119 | { |
| 120 | return __iterator<true>(*this, __inner_.begin()); | 120 | return __iterator<true>(*this, __inner_.begin()); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() { | 123 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() { |
| 124 | if constexpr (common_range<_InnerView>) { | 124 | if constexpr (common_range<_InnerView>) { |
| 125 | return __iterator<false>(*this, __inner_.end()); | 125 | return __iterator<false>(*this, __inner_.end()); |
| 126 | } else { | 126 | } else { |
| ... | @@ -128,7 +128,7 @@ public: | ... | @@ -128,7 +128,7 @@ public: |
| 128 | } | 128 | } |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | 131 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const |
| 132 | requires range<const _InnerView> && regular_invocable<__apply_n<const _Fn&, _Np>, range_reference_t<const _View>> | 132 | requires range<const _InnerView> && regular_invocable<__apply_n<const _Fn&, _Np>, range_reference_t<const _View>> |
| 133 | { | 133 | { |
| 134 | if constexpr (common_range<const _InnerView>) { | 134 | if constexpr (common_range<const _InnerView>) { |
| ... | @@ -138,13 +138,13 @@ public: | ... | @@ -138,13 +138,13 @@ public: |
| 138 | } | 138 | } |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() | 141 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() |
| 142 | requires sized_range<_InnerView> | 142 | requires sized_range<_InnerView> |
| 143 | { | 143 | { |
| 144 | return __inner_.size(); | 144 | return __inner_.size(); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | 147 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const |
| 148 | requires sized_range<const _InnerView> | 148 | requires sized_range<const _InnerView> |
| 149 | { | 149 | { |
| 150 | return __inner_.size(); | 150 | return __inner_.size(); |
| ... | @@ -202,7 +202,7 @@ public: | ... | @@ -202,7 +202,7 @@ public: |
| 202 | requires _Const && convertible_to<__inner_iterator<false>, __inner_iterator<true>> | 202 | requires _Const && convertible_to<__inner_iterator<false>, __inner_iterator<true>> |
| 203 | : __parent_(__i.__parent_), __inner_(std::move(__i.__inner_)) {} | 203 | : __parent_(__i.__parent_), __inner_(std::move(__i.__inner_)) {} |
| 204 | 204 | ||
| 205 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const | 205 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const |
| 206 | noexcept(__noexcept_dereference(make_index_sequence<_Np>{})) { | 206 | noexcept(__noexcept_dereference(make_index_sequence<_Np>{})) { |
| 207 | return std::apply( | 207 | return std::apply( |
| 208 | [&](const auto&... __iters) -> decltype(auto) { return std::invoke(*__parent_->__fun_, *__iters...); }, | 208 | [&](const auto&... __iters) -> decltype(auto) { return std::invoke(*__parent_->__fun_, *__iters...); }, |
| ... | @@ -249,7 +249,7 @@ public: | ... | @@ -249,7 +249,7 @@ public: |
| 249 | return *this; | 249 | return *this; |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const | 252 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const |
| 253 | requires random_access_range<_Base> | 253 | requires random_access_range<_Base> |
| 254 | { | 254 | { |
| 255 | return std::apply( | 255 | return std::apply( |
| ... | @@ -291,25 +291,26 @@ public: | ... | @@ -291,25 +291,26 @@ public: |
| 291 | return __x.__inner_ <=> __y.__inner_; | 291 | return __x.__inner_ <=> __y.__inner_; |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n) | 294 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n) |
| 295 | requires random_access_range<_Base> | 295 | requires random_access_range<_Base> |
| 296 | { | 296 | { |
| 297 | return __iterator(*__i.__parent_, __i.__inner_ + __n); | 297 | return __iterator(*__i.__parent_, __i.__inner_ + __n); |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i) | 300 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i) |
| 301 | requires random_access_range<_Base> | 301 | requires random_access_range<_Base> |
| 302 | { | 302 | { |
| 303 | return __iterator(*__i.__parent_, __i.__inner_ + __n); | 303 | return __iterator(*__i.__parent_, __i.__inner_ + __n); |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n) | 306 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n) |
| 307 | requires random_access_range<_Base> | 307 | requires random_access_range<_Base> |
| 308 | { | 308 | { |
| 309 | return __iterator(*__i.__parent_, __i.__inner_ - __n); | 309 | return __iterator(*__i.__parent_, __i.__inner_ - __n); |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) | 312 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type |
| 313 | operator-(const __iterator& __x, const __iterator& __y) | ||
| 313 | requires sized_sentinel_for<__inner_iterator<_Const>, __inner_iterator<_Const>> | 314 | requires sized_sentinel_for<__inner_iterator<_Const>, __inner_iterator<_Const>> |
| 314 | { | 315 | { |
| 315 | return __x.__inner_ - __y.__inner_; | 316 | return __x.__inner_ - __y.__inner_; |
| ... | @@ -344,14 +345,14 @@ public: | ... | @@ -344,14 +345,14 @@ public: |
| 344 | 345 | ||
| 345 | template <bool _OtherConst> | 346 | template <bool _OtherConst> |
| 346 | requires sized_sentinel_for<__inner_sentinel<_Const>, __inner_iterator<_OtherConst>> | 347 | requires sized_sentinel_for<__inner_sentinel<_Const>, __inner_iterator<_OtherConst>> |
| 347 | _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>> | 348 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>> |
| 348 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | 349 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { |
| 349 | return __x.__inner_ - __y.__inner_; | 350 | return __x.__inner_ - __y.__inner_; |
| 350 | } | 351 | } |
| 351 | 352 | ||
| 352 | template <bool _OtherConst> | 353 | template <bool _OtherConst> |
| 353 | requires sized_sentinel_for<__inner_sentinel<_Const>, __inner_iterator<_OtherConst>> | 354 | requires sized_sentinel_for<__inner_sentinel<_Const>, __inner_iterator<_OtherConst>> |
| 354 | _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>> | 355 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>> |
| 355 | operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { | 356 | operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { |
| 356 | return __x.__inner_ - __y.__inner_; | 357 | return __x.__inner_ - __y.__inner_; |
| 357 | } | 358 | } |
| ... | @@ -364,14 +365,14 @@ template <size_t _Np> | ... | @@ -364,14 +365,14 @@ template <size_t _Np> |
| 364 | struct __fn : __range_adaptor_closure<__fn<_Np>> { | 365 | struct __fn : __range_adaptor_closure<__fn<_Np>> { |
| 365 | template <class _Range, class _Fn> | 366 | template <class _Range, class _Fn> |
| 366 | requires(_Np == 0 && forward_range<_Range &&>) | 367 | requires(_Np == 0 && forward_range<_Range &&>) |
| 367 | _LIBCPP_HIDE_FROM_ABI static constexpr auto | 368 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto |
| 368 | operator()(_Range&&, _Fn&& __fn) noexcept(noexcept(views::zip_transform(std::forward<_Fn>(__fn)))) | 369 | operator()(_Range&&, _Fn&& __fn) noexcept(noexcept(views::zip_transform(std::forward<_Fn>(__fn)))) |
| 369 | -> decltype(views::zip_transform(std::forward<_Fn>(__fn))) { | 370 | -> decltype(views::zip_transform(std::forward<_Fn>(__fn))) { |
| 370 | return views::zip_transform(std::forward<_Fn>(__fn)); | 371 | return views::zip_transform(std::forward<_Fn>(__fn)); |
| 371 | } | 372 | } |
| 372 | 373 | ||
| 373 | template <class _Range, class _Fn> | 374 | template <class _Range, class _Fn> |
| 374 | _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Fn&& __fn) noexcept( | 375 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Fn&& __fn) noexcept( |
| 375 | noexcept(adjacent_transform_view<views::all_t<_Range&&>, decay_t<_Fn>, _Np>( | 376 | noexcept(adjacent_transform_view<views::all_t<_Range&&>, decay_t<_Fn>, _Np>( |
| 376 | std::forward<_Range>(__range), std::forward<_Fn>(__fn)))) | 377 | std::forward<_Range>(__range), std::forward<_Fn>(__fn)))) |
| 377 | -> decltype(adjacent_transform_view<views::all_t<_Range&&>, decay_t<_Fn>, _Np>( | 378 | -> decltype(adjacent_transform_view<views::all_t<_Range&&>, decay_t<_Fn>, _Np>( |
lib/libcxx/include/__ranges/adjacent_view.h+19-18| ... | @@ -81,26 +81,26 @@ public: | ... | @@ -81,26 +81,26 @@ public: |
| 81 | 81 | ||
| 82 | _LIBCPP_HIDE_FROM_ABI constexpr explicit adjacent_view(_View __base) : __base_(std::move(__base)) {} | 82 | _LIBCPP_HIDE_FROM_ABI constexpr explicit adjacent_view(_View __base) : __base_(std::move(__base)) {} |
| 83 | 83 | ||
| 84 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | 84 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& |
| 85 | requires copy_constructible<_View> | 85 | requires copy_constructible<_View> |
| 86 | { | 86 | { |
| 87 | return __base_; | 87 | return __base_; |
| 88 | } | 88 | } |
| 89 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | ||
| 90 | 89 | ||
| 91 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() | 90 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } |
| 91 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() | ||
| 92 | requires(!__simple_view<_View>) | 92 | requires(!__simple_view<_View>) |
| 93 | { | 93 | { |
| 94 | return __iterator<false>(ranges::begin(__base_), ranges::end(__base_)); | 94 | return __iterator<false>(ranges::begin(__base_), ranges::end(__base_)); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | 97 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const |
| 98 | requires range<const _View> // LWG4482 This is under-constrained. | 98 | requires range<const _View> // LWG4482 This is under-constrained. |
| 99 | { | 99 | { |
| 100 | return __iterator<true>(ranges::begin(__base_), ranges::end(__base_)); | 100 | return __iterator<true>(ranges::begin(__base_), ranges::end(__base_)); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() | 103 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() |
| 104 | requires(!__simple_view<_View>) | 104 | requires(!__simple_view<_View>) |
| 105 | { | 105 | { |
| 106 | if constexpr (common_range<_View>) { | 106 | if constexpr (common_range<_View>) { |
| ... | @@ -110,7 +110,7 @@ public: | ... | @@ -110,7 +110,7 @@ public: |
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | 113 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const |
| 114 | requires range<const _View> // LWG4482 This is under-constrained. | 114 | requires range<const _View> // LWG4482 This is under-constrained. |
| 115 | { | 115 | { |
| 116 | if constexpr (common_range<const _View>) { | 116 | if constexpr (common_range<const _View>) { |
| ... | @@ -120,7 +120,7 @@ public: | ... | @@ -120,7 +120,7 @@ public: |
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() | 123 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() |
| 124 | requires sized_range<_View> | 124 | requires sized_range<_View> |
| 125 | { | 125 | { |
| 126 | using _ST = decltype(ranges::size(__base_)); | 126 | using _ST = decltype(ranges::size(__base_)); |
| ... | @@ -130,7 +130,7 @@ public: | ... | @@ -130,7 +130,7 @@ public: |
| 130 | return static_cast<_ST>(__sz); | 130 | return static_cast<_ST>(__sz); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | 133 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const |
| 134 | requires sized_range<const _View> | 134 | requires sized_range<const _View> |
| 135 | { | 135 | { |
| 136 | using _ST = decltype(ranges::size(__base_)); | 136 | using _ST = decltype(ranges::size(__base_)); |
| ... | @@ -205,7 +205,7 @@ public: | ... | @@ -205,7 +205,7 @@ public: |
| 205 | requires _Const && convertible_to<iterator_t<_View>, iterator_t<const _View>> | 205 | requires _Const && convertible_to<iterator_t<_View>, iterator_t<const _View>> |
| 206 | : __iterator(std::move(__i), make_index_sequence<_Np>{}) {} | 206 | : __iterator(std::move(__i), make_index_sequence<_Np>{}) {} |
| 207 | 207 | ||
| 208 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const { | 208 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const { |
| 209 | return std::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_); | 209 | return std::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| ... | @@ -257,7 +257,7 @@ public: | ... | @@ -257,7 +257,7 @@ public: |
| 257 | return *this; | 257 | return *this; |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const | 260 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const |
| 261 | requires random_access_range<_Base> | 261 | requires random_access_range<_Base> |
| 262 | { | 262 | { |
| 263 | return std::__tuple_transform([&](auto& __i) -> decltype(auto) { return __i[__n]; }, __current_); | 263 | return std::__tuple_transform([&](auto& __i) -> decltype(auto) { return __i[__n]; }, __current_); |
| ... | @@ -297,7 +297,7 @@ public: | ... | @@ -297,7 +297,7 @@ public: |
| 297 | return __x.__current_.back() <=> __y.__current_.back(); | 297 | return __x.__current_.back() <=> __y.__current_.back(); |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n) | 300 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n) |
| 301 | requires random_access_range<_Base> | 301 | requires random_access_range<_Base> |
| 302 | { | 302 | { |
| 303 | auto __r = __i; | 303 | auto __r = __i; |
| ... | @@ -305,13 +305,13 @@ public: | ... | @@ -305,13 +305,13 @@ public: |
| 305 | return __r; | 305 | return __r; |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i) | 308 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i) |
| 309 | requires random_access_range<_Base> | 309 | requires random_access_range<_Base> |
| 310 | { | 310 | { |
| 311 | return __i + __n; | 311 | return __i + __n; |
| 312 | } | 312 | } |
| 313 | 313 | ||
| 314 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n) | 314 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n) |
| 315 | requires random_access_range<_Base> | 315 | requires random_access_range<_Base> |
| 316 | { | 316 | { |
| 317 | auto __r = __i; | 317 | auto __r = __i; |
| ... | @@ -319,7 +319,8 @@ public: | ... | @@ -319,7 +319,8 @@ public: |
| 319 | return __r; | 319 | return __r; |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) | 322 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type |
| 323 | operator-(const __iterator& __x, const __iterator& __y) | ||
| 323 | requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> | 324 | requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> |
| 324 | { | 325 | { |
| 325 | return __x.__current_.back() - __y.__current_.back(); | 326 | return __x.__current_.back() - __y.__current_.back(); |
| ... | @@ -366,14 +367,14 @@ public: | ... | @@ -366,14 +367,14 @@ public: |
| 366 | 367 | ||
| 367 | template <bool _OtherConst> | 368 | template <bool _OtherConst> |
| 368 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | 369 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| 369 | _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> | 370 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> |
| 370 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | 371 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { |
| 371 | return __x.__current_.back() - __y.__end_; | 372 | return __x.__current_.back() - __y.__end_; |
| 372 | } | 373 | } |
| 373 | 374 | ||
| 374 | template <bool _OtherConst> | 375 | template <bool _OtherConst> |
| 375 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | 376 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| 376 | _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> | 377 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> |
| 377 | operator-(const __sentinel& __y, const __iterator<_OtherConst>& __x) { | 378 | operator-(const __sentinel& __y, const __iterator<_OtherConst>& __x) { |
| 378 | return __y.__end_ - __x.__current_.back(); | 379 | return __y.__end_ - __x.__current_.back(); |
| 379 | } | 380 | } |
| ... | @@ -389,12 +390,12 @@ template <size_t _Np> | ... | @@ -389,12 +390,12 @@ template <size_t _Np> |
| 389 | struct __fn : __range_adaptor_closure<__fn<_Np>> { | 390 | struct __fn : __range_adaptor_closure<__fn<_Np>> { |
| 390 | template <class _Range> | 391 | template <class _Range> |
| 391 | requires(_Np == 0 && forward_range<_Range &&>) | 392 | requires(_Np == 0 && forward_range<_Range &&>) |
| 392 | _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&&) noexcept { | 393 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&&) noexcept { |
| 393 | return empty_view<tuple<>>{}; | 394 | return empty_view<tuple<>>{}; |
| 394 | } | 395 | } |
| 395 | 396 | ||
| 396 | template <class _Ranges> | 397 | template <class _Ranges> |
| 397 | _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ranges&& __range) noexcept( | 398 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ranges&& __range) noexcept( |
| 398 | noexcept(adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range)))) | 399 | noexcept(adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range)))) |
| 399 | -> decltype(adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range))) { | 400 | -> decltype(adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range))) { |
| 400 | return adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range)); | 401 | return adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range)); |
lib/libcxx/include/__ranges/all.h+4-4| ... | @@ -29,10 +29,10 @@ | ... | @@ -29,10 +29,10 @@ |
| 29 | # pragma GCC system_header | 29 | # pragma GCC system_header |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | |||
| 34 | #if _LIBCPP_STD_VER >= 20 | 32 | #if _LIBCPP_STD_VER >= 20 |
| 35 | 33 | ||
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 35 | |||
| 36 | namespace ranges::views { | 36 | namespace ranges::views { |
| 37 | 37 | ||
| 38 | namespace __all { | 38 | namespace __all { |
| ... | @@ -71,8 +71,8 @@ using all_t = decltype(views::all(std::declval<_Range>())); | ... | @@ -71,8 +71,8 @@ using all_t = decltype(views::all(std::declval<_Range>())); |
| 71 | 71 | ||
| 72 | } // namespace ranges::views | 72 | } // namespace ranges::views |
| 73 | 73 | ||
| 74 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 75 | |||
| 76 | _LIBCPP_END_NAMESPACE_STD | 74 | _LIBCPP_END_NAMESPACE_STD |
| 77 | 75 | ||
| 76 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 77 | |||
| 78 | #endif // _LIBCPP___RANGES_ALL_H | 78 | #endif // _LIBCPP___RANGES_ALL_H |
lib/libcxx/include/__ranges/chunk_by_view.h+1-1| ... | @@ -54,7 +54,7 @@ namespace ranges { | ... | @@ -54,7 +54,7 @@ namespace ranges { |
| 54 | 54 | ||
| 55 | template <forward_range _View, indirect_binary_predicate<iterator_t<_View>, iterator_t<_View>> _Pred> | 55 | template <forward_range _View, indirect_binary_predicate<iterator_t<_View>, iterator_t<_View>> _Pred> |
| 56 | requires view<_View> && is_object_v<_Pred> | 56 | requires view<_View> && is_object_v<_Pred> |
| 57 | class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS chunk_by_view : public view_interface<chunk_by_view<_View, _Pred>> { | 57 | class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG chunk_by_view : public view_interface<chunk_by_view<_View, _Pred>> { |
| 58 | _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); | 58 | _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); |
| 59 | _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_; | 59 | _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_; |
| 60 | 60 |
lib/libcxx/include/__ranges/concat_view.h created+651| ... | @@ -0,0 +1,651 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___RANGES_CONCAT_VIEW_H | ||
| 11 | #define _LIBCPP___RANGES_CONCAT_VIEW_H | ||
| 12 | |||
| 13 | #include <__assert> | ||
| 14 | #include <__concepts/common_reference_with.h> | ||
| 15 | #include <__concepts/constructible.h> | ||
| 16 | #include <__concepts/convertible_to.h> | ||
| 17 | #include <__concepts/copyable.h> | ||
| 18 | #include <__concepts/derived_from.h> | ||
| 19 | #include <__concepts/equality_comparable.h> | ||
| 20 | #include <__concepts/swappable.h> | ||
| 21 | #include <__config> | ||
| 22 | #include <__iterator/concepts.h> | ||
| 23 | #include <__iterator/default_sentinel.h> | ||
| 24 | #include <__iterator/distance.h> | ||
| 25 | #include <__iterator/incrementable_traits.h> | ||
| 26 | #include <__iterator/iter_move.h> | ||
| 27 | #include <__iterator/iter_swap.h> | ||
| 28 | #include <__iterator/iterator_traits.h> | ||
| 29 | #include <__iterator/next.h> | ||
| 30 | #include <__ranges/access.h> | ||
| 31 | #include <__ranges/all.h> | ||
| 32 | #include <__ranges/concepts.h> | ||
| 33 | #include <__ranges/movable_box.h> | ||
| 34 | #include <__ranges/range_adaptor.h> | ||
| 35 | #include <__ranges/size.h> | ||
| 36 | #include <__ranges/view_interface.h> | ||
| 37 | #include <__tuple/tuple_transform.h> | ||
| 38 | #include <__type_traits/conditional.h> | ||
| 39 | #include <__type_traits/decay.h> | ||
| 40 | #include <__type_traits/is_nothrow_constructible.h> | ||
| 41 | #include <__type_traits/make_unsigned.h> | ||
| 42 | #include <__type_traits/maybe_const.h> | ||
| 43 | #include <__utility/forward.h> | ||
| 44 | #include <__utility/in_place.h> | ||
| 45 | #include <__utility/move.h> | ||
| 46 | #include <tuple> | ||
| 47 | #include <variant> | ||
| 48 | |||
| 49 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 50 | # pragma GCC system_header | ||
| 51 | #endif | ||
| 52 | |||
| 53 | _LIBCPP_PUSH_MACROS | ||
| 54 | #include <__undef_macros> | ||
| 55 | |||
| 56 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 57 | |||
| 58 | #if _LIBCPP_STD_VER >= 26 | ||
| 59 | |||
| 60 | namespace ranges { | ||
| 61 | |||
| 62 | # ifdef __cpp_pack_indexing | ||
| 63 | template <class... _Tp> | ||
| 64 | using __extract_last _LIBCPP_NODEBUG = _Tp...[sizeof...(_Tp) - 1]; | ||
| 65 | # else | ||
| 66 | template <class _Tp, class... _Tail> | ||
| 67 | struct __extract_last_impl : __extract_last_impl<_Tail...> {}; | ||
| 68 | template <class _Tp> | ||
| 69 | struct __extract_last_impl<_Tp> { | ||
| 70 | using type _LIBCPP_NODEBUG = _Tp; | ||
| 71 | }; | ||
| 72 | |||
| 73 | template <class... _Tp> | ||
| 74 | using __extract_last _LIBCPP_NODEBUG = __extract_last_impl<_Tp...>::type; | ||
| 75 | # endif | ||
| 76 | |||
| 77 | template <bool _Const, class... _Tp> | ||
| 78 | struct __all_but_first_model_sized_range; | ||
| 79 | |||
| 80 | template <bool _Const, class _Head, class... _Tail> | ||
| 81 | struct __all_but_first_model_sized_range<_Const, _Head, _Tail...> { | ||
| 82 | static constexpr bool value = (sized_range<__maybe_const<_Const, _Tail>> && ...); | ||
| 83 | }; | ||
| 84 | |||
| 85 | template <bool _Const, class... _Views> | ||
| 86 | concept __all_random_access = (random_access_range<__maybe_const<_Const, _Views>> && ...); | ||
| 87 | |||
| 88 | template <bool _Const, class... _Views> | ||
| 89 | concept __all_bidirectional = (bidirectional_range<__maybe_const<_Const, _Views>> && ...); | ||
| 90 | |||
| 91 | template <bool _Const, class... _Views> | ||
| 92 | concept __all_forward = (forward_range<__maybe_const<_Const, _Views>> && ...); | ||
| 93 | |||
| 94 | template <bool _Const, class _First, class... _Tail> | ||
| 95 | struct __all_common_ignore_last { | ||
| 96 | static constexpr bool value = | ||
| 97 | common_range<__maybe_const<_Const, _First>> && __all_common_ignore_last<_Const, _Tail...>::value; | ||
| 98 | }; | ||
| 99 | |||
| 100 | template <bool _Const, class _Tail> | ||
| 101 | struct __all_common_ignore_last<_Const, _Tail> { | ||
| 102 | static constexpr bool value = true; | ||
| 103 | }; | ||
| 104 | |||
| 105 | template <bool _Const, class... _Rs> | ||
| 106 | concept __concat_is_random_access = | ||
| 107 | (__all_random_access<_Const, _Rs...>) && (__all_common_ignore_last<_Const, _Rs...>::value); | ||
| 108 | |||
| 109 | template <bool _Const, class... _Rs> | ||
| 110 | concept __concat_is_bidirectional = | ||
| 111 | (__all_bidirectional<_Const, _Rs...>) && (__all_common_ignore_last<_Const, _Rs...>::value); | ||
| 112 | |||
| 113 | template <input_range... _Views> | ||
| 114 | requires((view<_Views> && ...) && (sizeof...(_Views) > 0) && __concatable<_Views...>) | ||
| 115 | class concat_view : public view_interface<concat_view<_Views...>> { | ||
| 116 | tuple<_Views...> __views_; | ||
| 117 | |||
| 118 | template <bool _Const> | ||
| 119 | class __iterator; | ||
| 120 | |||
| 121 | public: | ||
| 122 | _LIBCPP_HIDE_FROM_ABI constexpr concat_view() = default; | ||
| 123 | |||
| 124 | _LIBCPP_HIDE_FROM_ABI constexpr explicit concat_view(_Views... __views) : __views_(std::move(__views)...) {} | ||
| 125 | |||
| 126 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> begin() | ||
| 127 | requires(!(__simple_view<_Views> && ...)) | ||
| 128 | { | ||
| 129 | __iterator<false> __it(this, in_place_index<0>, ranges::begin(std::get<0>(__views_))); | ||
| 130 | __it.template __satisfy<0>(); | ||
| 131 | return __it; | ||
| 132 | } | ||
| 133 | |||
| 134 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> begin() const | ||
| 135 | requires((range<const _Views> && ...) && __concatable<const _Views...>) | ||
| 136 | { | ||
| 137 | __iterator<true> __it(this, in_place_index<0>, ranges::begin(std::get<0>(__views_))); | ||
| 138 | __it.template __satisfy<0>(); | ||
| 139 | return __it; | ||
| 140 | } | ||
| 141 | |||
| 142 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() | ||
| 143 | requires(!(__simple_view<_Views> && ...)) | ||
| 144 | { | ||
| 145 | if constexpr (__all_forward<false, _Views...> && common_range<__maybe_const<false, __extract_last<_Views...>>>) { | ||
| 146 | constexpr auto __n = sizeof...(_Views); | ||
| 147 | return __iterator<false>(this, in_place_index<__n - 1>, ranges::end(std::get<__n - 1>(__views_))); | ||
| 148 | } else { | ||
| 149 | return default_sentinel; | ||
| 150 | } | ||
| 151 | } | ||
| 152 | |||
| 153 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | ||
| 154 | requires((range<const _Views> && ...) && __concatable<const _Views...>) | ||
| 155 | { | ||
| 156 | if constexpr (__all_forward<true, _Views...> && common_range<__maybe_const<true, __extract_last<_Views...>>>) { | ||
| 157 | constexpr auto __n = sizeof...(_Views); | ||
| 158 | return __iterator<true>(this, in_place_index<__n - 1>, ranges::end(std::get<__n - 1>(__views_))); | ||
| 159 | } else { | ||
| 160 | return default_sentinel; | ||
| 161 | } | ||
| 162 | } | ||
| 163 | |||
| 164 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() | ||
| 165 | requires(sized_range<_Views> && ...) | ||
| 166 | { | ||
| 167 | return std::apply( | ||
| 168 | [](auto... __sizes) { return (make_unsigned_t<common_type_t<decltype(__sizes)...>>(__sizes) + ...); }, | ||
| 169 | std::__tuple_transform(ranges::size, __views_)); | ||
| 170 | } | ||
| 171 | |||
| 172 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | ||
| 173 | requires(sized_range<const _Views> && ...) | ||
| 174 | { | ||
| 175 | return std::apply( | ||
| 176 | [](auto... __sizes) { return (make_unsigned_t<common_type_t<decltype(__sizes)...>>(__sizes) + ...); }, | ||
| 177 | std::__tuple_transform(ranges::size, __views_)); | ||
| 178 | } | ||
| 179 | }; | ||
| 180 | |||
| 181 | template <class... _Views> | ||
| 182 | concat_view(_Views&&...) -> concat_view<views::all_t<_Views>...>; | ||
| 183 | |||
| 184 | template <bool _Const, typename... _Views> | ||
| 185 | struct __concat_view_iterator_category {}; | ||
| 186 | |||
| 187 | template <bool _Const, typename... _Views> | ||
| 188 | requires __all_forward<_Const, _Views...> | ||
| 189 | struct __concat_view_iterator_category<_Const, _Views...> { | ||
| 190 | private: | ||
| 191 | constexpr static bool __derive_pack_random_iterator = | ||
| 192 | (derived_from<typename iterator_traits<iterator_t<__maybe_const<_Const, _Views>>>::iterator_category, | ||
| 193 | random_access_iterator_tag> && | ||
| 194 | ...); | ||
| 195 | constexpr static bool __derive_pack_bidirectional_iterator = | ||
| 196 | (derived_from<typename iterator_traits<iterator_t<__maybe_const<_Const, _Views>>>::iterator_category, | ||
| 197 | bidirectional_iterator_tag> && | ||
| 198 | ...); | ||
| 199 | constexpr static bool __derive_pack_forward_iterator = | ||
| 200 | (derived_from<typename iterator_traits< iterator_t<__maybe_const<_Const, _Views>>>::iterator_category, | ||
| 201 | forward_iterator_tag> && | ||
| 202 | ...); | ||
| 203 | |||
| 204 | public: | ||
| 205 | using iterator_category = | ||
| 206 | _If<!is_reference_v<__concat_reference_t<__maybe_const<_Const, _Views>...>>, | ||
| 207 | input_iterator_tag, | ||
| 208 | _If<__derive_pack_random_iterator, | ||
| 209 | random_access_iterator_tag, | ||
| 210 | _If<__derive_pack_bidirectional_iterator, | ||
| 211 | bidirectional_iterator_tag, | ||
| 212 | _If<__derive_pack_forward_iterator, forward_iterator_tag, input_iterator_tag > > > >; | ||
| 213 | }; | ||
| 214 | |||
| 215 | template <input_range... _Views> | ||
| 216 | requires((view<_Views> && ...) && (sizeof...(_Views) > 0) && __concatable<_Views...>) | ||
| 217 | template <bool _Const> | ||
| 218 | class concat_view<_Views...>::__iterator : public __concat_view_iterator_category<_Const, _Views...> { | ||
| 219 | public: | ||
| 220 | using iterator_concept = | ||
| 221 | _If<__concat_is_random_access<_Const, _Views...>, | ||
| 222 | random_access_iterator_tag, | ||
| 223 | _If<__concat_is_bidirectional<_Const, _Views...>, | ||
| 224 | bidirectional_iterator_tag, | ||
| 225 | _If< __all_forward<_Const, _Views...>, forward_iterator_tag, input_iterator_tag > > >; | ||
| 226 | using value_type = __concat_value_t<__maybe_const<_Const, _Views>...>; | ||
| 227 | using difference_type = common_type_t<range_difference_t<__maybe_const<_Const, _Views>>...>; | ||
| 228 | |||
| 229 | private: | ||
| 230 | using __base_iter _LIBCPP_NODEBUG = variant<iterator_t<__maybe_const<_Const, _Views>>...>; | ||
| 231 | __base_iter __it_; | ||
| 232 | __maybe_const<_Const, concat_view>* __parent_ = nullptr; | ||
| 233 | |||
| 234 | template <size_t _Idx> | ||
| 235 | _LIBCPP_HIDE_FROM_ABI constexpr void __satisfy() { | ||
| 236 | if constexpr (_Idx < (sizeof...(_Views) - 1)) { | ||
| 237 | if (std::get<_Idx>(__it_) == ranges::end(std::get<_Idx>(__parent_->__views_))) { | ||
| 238 | __it_.template emplace<_Idx + 1>(ranges::begin(std::get<_Idx + 1>(__parent_->__views_))); | ||
| 239 | __satisfy<_Idx + 1>(); | ||
| 240 | } | ||
| 241 | } | ||
| 242 | } | ||
| 243 | |||
| 244 | template <size_t _Idx> | ||
| 245 | _LIBCPP_HIDE_FROM_ABI constexpr void __prev() { | ||
| 246 | if constexpr (_Idx == 0) { | ||
| 247 | --std::get<0>(__it_); | ||
| 248 | } else { | ||
| 249 | if (std::get<_Idx>(__it_) == ranges::begin(std::get<_Idx>(__parent_->__views_))) { | ||
| 250 | __it_.template emplace<_Idx - 1>(ranges::end(std::get<_Idx - 1>(__parent_->__views_))); | ||
| 251 | __prev<_Idx - 1>(); | ||
| 252 | } else { | ||
| 253 | --std::get<_Idx>(__it_); | ||
| 254 | } | ||
| 255 | } | ||
| 256 | } | ||
| 257 | |||
| 258 | template <size_t _Idx> | ||
| 259 | _LIBCPP_HIDE_FROM_ABI constexpr void __advance_fwd(difference_type __offset, difference_type __steps) { | ||
| 260 | using __underlying_diff_type = iter_difference_t<variant_alternative_t<_Idx, __base_iter>>; | ||
| 261 | if constexpr (_Idx == sizeof...(_Views) - 1) { | ||
| 262 | std::get<_Idx>(__it_) += static_cast<__underlying_diff_type>(__steps); | ||
| 263 | } else { | ||
| 264 | auto __n_size = ranges::distance(std::get<_Idx>(__parent_->__views_)); | ||
| 265 | if (__offset + __steps < __n_size) { | ||
| 266 | std::get<_Idx>(__it_) += static_cast<__underlying_diff_type>(__steps); | ||
| 267 | } else { | ||
| 268 | __it_.template emplace<_Idx + 1>(ranges::begin(std::get<_Idx + 1>(__parent_->__views_))); | ||
| 269 | __advance_fwd<_Idx + 1>(0, __offset + __steps - __n_size); | ||
| 270 | } | ||
| 271 | } | ||
| 272 | } | ||
| 273 | |||
| 274 | template <size_t _Idx> | ||
| 275 | _LIBCPP_HIDE_FROM_ABI constexpr void __advance_bwd(difference_type __offset, difference_type __steps) { | ||
| 276 | using __underlying_diff_type = iter_difference_t<variant_alternative_t<_Idx, __base_iter>>; | ||
| 277 | if constexpr (_Idx == 0) { | ||
| 278 | std::get<_Idx>(__it_) -= static_cast<__underlying_diff_type>(__steps); | ||
| 279 | } else { | ||
| 280 | if (__offset >= __steps) { | ||
| 281 | std::get<_Idx>(__it_) -= static_cast<__underlying_diff_type>(__steps); | ||
| 282 | } else { | ||
| 283 | auto __prev_size = ranges::distance(std::get<_Idx - 1>(__parent_->__views_)); | ||
| 284 | __it_.template emplace<_Idx - 1>(ranges::end(std::get<_Idx - 1>(__parent_->__views_))); | ||
| 285 | __advance_bwd<_Idx - 1>(__prev_size, __steps - __offset); | ||
| 286 | } | ||
| 287 | } | ||
| 288 | } | ||
| 289 | |||
| 290 | template <typename _Func> | ||
| 291 | _LIBCPP_HIDE_FROM_ABI constexpr auto __invoke_at_index(_Func&& __func) const { | ||
| 292 | // TODO(GCC 16): Just capture `this` when GCC PR113563 and PR121008 are fixed. | ||
| 293 | return [&__func, &__view_iter = *this]<std::size_t _Is>(this auto&& __self) { | ||
| 294 | if (_Is == __view_iter.__it_.index()) { | ||
| 295 | return __func.template operator()<_Is>(); | ||
| 296 | } | ||
| 297 | if constexpr (_Is + 1 < sizeof...(_Views)) { | ||
| 298 | return __self.template operator()<_Is + 1>(); | ||
| 299 | } | ||
| 300 | __builtin_unreachable(); | ||
| 301 | }.template operator()<0>(); | ||
| 302 | } | ||
| 303 | |||
| 304 | template <size_t... _Is, typename _Func> | ||
| 305 | _LIBCPP_HIDE_FROM_ABI constexpr void __apply_at_index(size_t __index, _Func&& __func, index_sequence<_Is...>) const { | ||
| 306 | ((__index == _Is ? (static_cast<void>(__func(integral_constant<size_t, _Is>{})), 0) : 0), ...); | ||
| 307 | } | ||
| 308 | |||
| 309 | template <size_t _Idx, typename _Func> | ||
| 310 | _LIBCPP_HIDE_FROM_ABI constexpr void __apply_at_index(size_t __index, _Func&& __func) const { | ||
| 311 | __apply_at_index(__index, std::forward<_Func>(__func), make_index_sequence<_Idx>{}); | ||
| 312 | } | ||
| 313 | |||
| 314 | template <class... _Args> | ||
| 315 | _LIBCPP_HIDE_FROM_ABI explicit constexpr __iterator(__maybe_const<_Const, concat_view>* __parent, _Args&&... __args) | ||
| 316 | requires constructible_from<__base_iter, _Args&&...> | ||
| 317 | : __it_(std::forward<_Args>(__args)...), __parent_(__parent) {} | ||
| 318 | |||
| 319 | friend class concat_view; | ||
| 320 | friend class __iterator<!_Const>; | ||
| 321 | |||
| 322 | public: | ||
| 323 | _LIBCPP_HIDE_FROM_ABI __iterator() = default; | ||
| 324 | |||
| 325 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i) | ||
| 326 | requires _Const && (convertible_to<iterator_t<_Views>, iterator_t<const _Views>> && ...) | ||
| 327 | : __it_([&__src = __i.__it_]<size_t... _Indices>(size_t __idx, index_sequence<_Indices...>) -> __base_iter { | ||
| 328 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 329 | !__src.valueless_by_exception(), "Trying to convert from a valueless iterator of concat_view."); | ||
| 330 | using __src_lref = decltype((__src)); | ||
| 331 | using __construction_fptr = __base_iter (*)(__src_lref); | ||
| 332 | static constexpr __construction_fptr __vtable[]{[](__src_lref __src_var) -> __base_iter { | ||
| 333 | return __base_iter(in_place_index<_Indices>, std::__unchecked_get<_Indices>(std::move(__src_var))); | ||
| 334 | }...}; | ||
| 335 | return __vtable[__idx](__src); | ||
| 336 | }(__i.__it_.index(), make_index_sequence<variant_size_v<__base_iter>>{})), | ||
| 337 | __parent_(__i.__parent_) {} | ||
| 338 | |||
| 339 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { | ||
| 340 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 341 | !__it_.valueless_by_exception(), "Trying to dereference a valueless iterator of concat_view."); | ||
| 342 | return __variant_detail::__visitation::__variant::__visit_value( | ||
| 343 | [](auto&& __it) -> __concat_reference_t<__maybe_const<_Const, _Views>...> { return *__it; }, __it_); | ||
| 344 | } | ||
| 345 | |||
| 346 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { | ||
| 347 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 348 | !__it_.valueless_by_exception(), "Trying to increment a valueless iterator of concat_view."); | ||
| 349 | size_t __active_index = __it_.index(); | ||
| 350 | __apply_at_index<variant_size_v<decltype(__it_)>>(__active_index, [&](auto __index_constant) { | ||
| 351 | constexpr size_t __i = __index_constant.value; | ||
| 352 | ++std::__unchecked_get<__i>(__it_); | ||
| 353 | __satisfy<__i>(); | ||
| 354 | }); | ||
| 355 | return *this; | ||
| 356 | } | ||
| 357 | |||
| 358 | _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; } | ||
| 359 | |||
| 360 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) | ||
| 361 | requires(__all_forward<_Const, _Views...>) | ||
| 362 | { | ||
| 363 | auto __tmp = *this; | ||
| 364 | ++*this; | ||
| 365 | return __tmp; | ||
| 366 | } | ||
| 367 | |||
| 368 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() | ||
| 369 | requires __concat_is_bidirectional<_Const, _Views...> | ||
| 370 | { | ||
| 371 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 372 | !__it_.valueless_by_exception(), "Trying to decrement a valueless iterator of concat_view."); | ||
| 373 | size_t __active_index = __it_.index(); | ||
| 374 | __apply_at_index<variant_size_v<decltype(__it_)>>(__active_index, [&](auto __index_constant) { | ||
| 375 | constexpr size_t __i = __index_constant.value; | ||
| 376 | __prev<__i>(); | ||
| 377 | }); | ||
| 378 | return *this; | ||
| 379 | } | ||
| 380 | |||
| 381 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) | ||
| 382 | requires __concat_is_bidirectional<_Const, _Views...> | ||
| 383 | { | ||
| 384 | auto __tmp = *this; | ||
| 385 | --*this; | ||
| 386 | return __tmp; | ||
| 387 | } | ||
| 388 | |||
| 389 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) | ||
| 390 | requires(equality_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...) | ||
| 391 | { | ||
| 392 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(), | ||
| 393 | "Trying to compare a valueless iterator of concat_view."); | ||
| 394 | return __x.__it_ == __y.__it_; | ||
| 395 | } | ||
| 396 | |||
| 397 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const | ||
| 398 | requires __concat_is_random_access<_Const, _Views...> | ||
| 399 | { | ||
| 400 | return *((*this) + __n); | ||
| 401 | } | ||
| 402 | |||
| 403 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __it, difference_type __n) | ||
| 404 | requires __concat_is_random_access<_Const, _Views...> | ||
| 405 | { | ||
| 406 | auto __temp = __it; | ||
| 407 | __temp += __n; | ||
| 408 | return __temp; | ||
| 409 | } | ||
| 410 | |||
| 411 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __it) | ||
| 412 | requires __concat_is_random_access<_Const, _Views...> | ||
| 413 | { | ||
| 414 | return __it + __n; | ||
| 415 | } | ||
| 416 | |||
| 417 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) | ||
| 418 | requires __concat_is_random_access<_Const, _Views...> | ||
| 419 | { | ||
| 420 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 421 | !__it_.valueless_by_exception(), "Trying to increment a valueless iterator of concat_view."); | ||
| 422 | size_t __active_index = __it_.index(); | ||
| 423 | if (__n > 0) { | ||
| 424 | __apply_at_index<tuple_size_v<decltype(__parent_->__views_)>>(__active_index, [&](auto __index_constant) { | ||
| 425 | constexpr size_t __i = __index_constant.value; | ||
| 426 | auto& __active_view = std::get<__i>(__parent_->__views_); | ||
| 427 | difference_type __idx = std::get<__i>(__it_) - ranges::begin(__active_view); | ||
| 428 | __advance_fwd<__i>(__idx, __n); | ||
| 429 | }); | ||
| 430 | |||
| 431 | } | ||
| 432 | |||
| 433 | else if (__n < 0) { | ||
| 434 | __apply_at_index<tuple_size_v<decltype(__parent_->__views_)>>(__active_index, [&](auto __index_constant) { | ||
| 435 | constexpr size_t __i = __index_constant.value; | ||
| 436 | auto& __active_view = std::get<__i>(__parent_->__views_); | ||
| 437 | difference_type __idx = std::get<__i>(__it_) - ranges::begin(__active_view); | ||
| 438 | __advance_bwd<__i>(__idx, -__n); | ||
| 439 | }); | ||
| 440 | } | ||
| 441 | |||
| 442 | return *this; | ||
| 443 | } | ||
| 444 | |||
| 445 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) | ||
| 446 | requires __concat_is_random_access<_Const, _Views...> | ||
| 447 | { | ||
| 448 | *this += -__n; | ||
| 449 | return *this; | ||
| 450 | } | ||
| 451 | |||
| 452 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __it, default_sentinel_t) { | ||
| 453 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 454 | !__it.__it_.valueless_by_exception(), | ||
| 455 | "Trying to compare a valueless iterator of concat_view with the default sentinel."); | ||
| 456 | constexpr auto __last_idx = sizeof...(_Views) - 1; | ||
| 457 | return __it.__it_.index() == __last_idx && | ||
| 458 | std::__unchecked_get<__last_idx>(__it.__it_) == ranges::end(std::get<__last_idx>(__it.__parent_->__views_)); | ||
| 459 | } | ||
| 460 | |||
| 461 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) | ||
| 462 | requires(__all_random_access<_Const, _Views> && ...) | ||
| 463 | { | ||
| 464 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(), | ||
| 465 | "Trying to compare a valueless iterator of concat_view."); | ||
| 466 | return __x.__it_ < __y.__it_; | ||
| 467 | } | ||
| 468 | |||
| 469 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) | ||
| 470 | requires(__all_random_access<_Const, _Views> && ...) | ||
| 471 | { | ||
| 472 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(), | ||
| 473 | "Trying to compare a valueless iterator of concat_view."); | ||
| 474 | return __x.__it_ > __y.__it_; | ||
| 475 | } | ||
| 476 | |||
| 477 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) | ||
| 478 | requires(__all_random_access<_Const, _Views> && ...) | ||
| 479 | { | ||
| 480 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(), | ||
| 481 | "Trying to compare a valueless iterator of concat_view."); | ||
| 482 | return __x.__it_ <= __y.__it_; | ||
| 483 | } | ||
| 484 | |||
| 485 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) | ||
| 486 | requires(__all_random_access<_Const, _Views> && ...) | ||
| 487 | { | ||
| 488 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(), | ||
| 489 | "Trying to compare a valueless iterator of concat_view."); | ||
| 490 | return __x.__it_ >= __y.__it_; | ||
| 491 | } | ||
| 492 | |||
| 493 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) | ||
| 494 | requires((__all_random_access<_Const, _Views> && ...) && | ||
| 495 | (three_way_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...)) | ||
| 496 | { | ||
| 497 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(), | ||
| 498 | "Trying to compare a valueless iterator of concat_view."); | ||
| 499 | return __x.__it_ <=> __y.__it_; | ||
| 500 | } | ||
| 501 | |||
| 502 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) iter_move(const __iterator& __it) noexcept( | ||
| 503 | |||
| 504 | ((is_nothrow_invocable_v< decltype(ranges::iter_move), const iterator_t<__maybe_const<_Const, _Views>>& > && | ||
| 505 | is_nothrow_convertible_v< range_rvalue_reference_t<__maybe_const<_Const, _Views>>, | ||
| 506 | __concat_rvalue_reference_t<__maybe_const<_Const, _Views>...> >) && | ||
| 507 | ...)) | ||
| 508 | |||
| 509 | { | ||
| 510 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 511 | !__it.__it_.valueless_by_exception(), "Trying to apply iter_move to a valueless iterator of concat_view."); | ||
| 512 | return __variant_detail::__visitation::__variant::__visit_value( | ||
| 513 | [](const auto& __i) -> __concat_rvalue_reference_t<__maybe_const<_Const, _Views>...> { | ||
| 514 | return ranges::iter_move(__i); | ||
| 515 | }, | ||
| 516 | __it.__it_); | ||
| 517 | } | ||
| 518 | |||
| 519 | _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const __iterator& __x, const __iterator& __y) | ||
| 520 | |||
| 521 | noexcept((noexcept(ranges::swap(*__x, *__y))) && | ||
| 522 | (noexcept(ranges::iter_swap(std::declval<const iterator_t<__maybe_const<_Const, _Views>>>(), | ||
| 523 | std::declval<const iterator_t<__maybe_const<_Const, _Views>>>())) && | ||
| 524 | ...)) | ||
| 525 | |||
| 526 | requires swappable_with<iter_reference_t<__iterator>, iter_reference_t<__iterator>> && | ||
| 527 | (... && indirectly_swappable<iterator_t<__maybe_const<_Const, _Views>>>) | ||
| 528 | { | ||
| 529 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 530 | !__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(), | ||
| 531 | "Trying to swap iterators of concat_view where at least one iterator is valueless."); | ||
| 532 | __variant_detail::__visitation::__variant::__visit_value( | ||
| 533 | [&](const auto& __it1, const auto& __it2) { | ||
| 534 | if constexpr (is_same_v<decltype(__it1), decltype(__it2)>) { | ||
| 535 | ranges::iter_swap(__it1, __it2); | ||
| 536 | } else { | ||
| 537 | ranges::swap(*__x, *__y); | ||
| 538 | } | ||
| 539 | }, | ||
| 540 | __x.__it_, | ||
| 541 | __y.__it_); | ||
| 542 | } | ||
| 543 | |||
| 544 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type | ||
| 545 | operator-(const __iterator& __x, const __iterator& __y) | ||
| 546 | requires __concat_is_random_access<_Const, _Views...> | ||
| 547 | { | ||
| 548 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 549 | !__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(), | ||
| 550 | "Trying to subtract two iterators of concat_view where at least one iterator is valueless."); | ||
| 551 | return __x.__invoke_at_index([&]<std::size_t __index_x>() -> difference_type { | ||
| 552 | return __y.__invoke_at_index([&]<std::size_t __index_y>() -> difference_type { | ||
| 553 | if constexpr (__index_x > __index_y) { | ||
| 554 | auto __dx = ranges::distance( | ||
| 555 | ranges::begin(std::get<__index_x>(__x.__parent_->__views_)), std::get<__index_x>(__x.__it_)); | ||
| 556 | auto __dy = ranges::distance( | ||
| 557 | std::get<__index_y>(__y.__it_), ranges::end(std::get<__index_y>(__y.__parent_->__views_))); | ||
| 558 | difference_type __s = [&]<std::size_t __start, std::size_t __end>(this auto&& __self) -> difference_type { | ||
| 559 | if constexpr (__start < __end) { | ||
| 560 | return ranges::size(std::get<__start>(__x.__parent_->__views_)) + | ||
| 561 | __self.template operator()<__start + 1, __end>(); | ||
| 562 | } | ||
| 563 | return 0; | ||
| 564 | }.template operator()<__index_y + 1, __index_x>(); | ||
| 565 | return __dy + __s + __dx; | ||
| 566 | } else if constexpr (__index_x < __index_y) { | ||
| 567 | return -(__y - __x); | ||
| 568 | } else { | ||
| 569 | return std::get<__index_x>(__x.__it_) - std::get<__index_y>(__y.__it_); | ||
| 570 | } | ||
| 571 | }); | ||
| 572 | }); | ||
| 573 | } | ||
| 574 | |||
| 575 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __it, difference_type __n) | ||
| 576 | requires __concat_is_random_access<_Const, _Views...> | ||
| 577 | { | ||
| 578 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 579 | !__it.__it_.valueless_by_exception(), "Trying to subtract a valuess iterators of concat_view."); | ||
| 580 | auto __temp = __it; | ||
| 581 | __temp -= __n; | ||
| 582 | return __temp; | ||
| 583 | } | ||
| 584 | |||
| 585 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type | ||
| 586 | operator-(const __iterator& __x, default_sentinel_t) | ||
| 587 | requires(sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_Const, _Views>>> && | ||
| 588 | ...) && | ||
| 589 | (__all_but_first_model_sized_range<_Const, _Views...>::value) | ||
| 590 | { | ||
| 591 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | ||
| 592 | !__x.__it_.valueless_by_exception(), | ||
| 593 | "Trying to subtract a valuess iterators of concat_view from the default sentinel."); | ||
| 594 | return __x.__invoke_at_index([&]<std::size_t __index_x>() -> difference_type { | ||
| 595 | auto __dx = | ||
| 596 | ranges::distance(std::get<__index_x>(__x.__it_), ranges::end(std::get<__index_x>(__x.__parent_->__views_))); | ||
| 597 | difference_type __s = [&]<std::size_t __start, std::size_t __end>(this auto&& __self) -> difference_type { | ||
| 598 | if constexpr (__start < __end) { | ||
| 599 | return ranges::size(std::get<__start>(__x.__parent_->__views_)) + | ||
| 600 | __self.template operator()<__start + 1, __end>(); | ||
| 601 | } | ||
| 602 | return 0; | ||
| 603 | }.template operator()<__index_x + 1, sizeof...(_Views)>(); | ||
| 604 | return -(__dx + __s); | ||
| 605 | }); | ||
| 606 | } | ||
| 607 | |||
| 608 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type | ||
| 609 | operator-(default_sentinel_t, const __iterator& __x) | ||
| 610 | requires(sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_Const, _Views>>> && | ||
| 611 | ...) && | ||
| 612 | (__all_but_first_model_sized_range<_Const, _Views...>::value) | ||
| 613 | { | ||
| 614 | return -(__x - default_sentinel); | ||
| 615 | } | ||
| 616 | }; | ||
| 617 | |||
| 618 | namespace views { | ||
| 619 | namespace __concat { | ||
| 620 | struct __fn { | ||
| 621 | template <input_range _Range> | ||
| 622 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto | ||
| 623 | operator()(_Range&& __range) noexcept(noexcept(views::all((std::forward<_Range>(__range))))) | ||
| 624 | -> decltype(views::all((std::forward<_Range>(__range)))) { | ||
| 625 | return views::all(std::forward<_Range>(__range)); | ||
| 626 | } | ||
| 627 | |||
| 628 | template <class _FirstRange, class... _TailRanges> | ||
| 629 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto | ||
| 630 | operator()(_FirstRange&& __first, _TailRanges&&... __tail) noexcept( | ||
| 631 | noexcept(concat_view(std::forward<_FirstRange>(__first), std::forward<_TailRanges>(__tail)...))) | ||
| 632 | -> decltype(concat_view(std::forward<_FirstRange>(__first), std::forward<_TailRanges>(__tail)...)) { | ||
| 633 | return concat_view(std::forward<_FirstRange>(__first), std::forward<_TailRanges>(__tail)...); | ||
| 634 | } | ||
| 635 | }; | ||
| 636 | } // namespace __concat | ||
| 637 | |||
| 638 | inline namespace __cpo { | ||
| 639 | inline constexpr auto concat = __concat::__fn{}; | ||
| 640 | } // namespace __cpo | ||
| 641 | } // namespace views | ||
| 642 | |||
| 643 | } // namespace ranges | ||
| 644 | |||
| 645 | #endif // _LIBCPP_STD_VER >= 26 | ||
| 646 | |||
| 647 | _LIBCPP_END_NAMESPACE_STD | ||
| 648 | |||
| 649 | _LIBCPP_POP_MACROS | ||
| 650 | |||
| 651 | #endif // _LIBCPP___RANGES_CONCAT_VIEW_H | ||
lib/libcxx/include/__ranges/concepts.h+4-4| ... | @@ -39,10 +39,10 @@ | ... | @@ -39,10 +39,10 @@ |
| 39 | # pragma GCC system_header | 39 | # pragma GCC system_header |
| 40 | #endif | 40 | #endif |
| 41 | 41 | ||
| 42 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 43 | |||
| 44 | #if _LIBCPP_STD_VER >= 20 | 42 | #if _LIBCPP_STD_VER >= 20 |
| 45 | 43 | ||
| 44 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 45 | |||
| 46 | namespace ranges { | 46 | namespace ranges { |
| 47 | 47 | ||
| 48 | // [range.range] | 48 | // [range.range] |
| ... | @@ -175,8 +175,8 @@ concept __concatable = requires { | ... | @@ -175,8 +175,8 @@ concept __concatable = requires { |
| 175 | 175 | ||
| 176 | } // namespace ranges | 176 | } // namespace ranges |
| 177 | 177 | ||
| 178 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 179 | |||
| 180 | _LIBCPP_END_NAMESPACE_STD | 178 | _LIBCPP_END_NAMESPACE_STD |
| 181 | 179 | ||
| 180 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 181 | |||
| 182 | #endif // _LIBCPP___RANGES_CONCEPTS_H | 182 | #endif // _LIBCPP___RANGES_CONCEPTS_H |
lib/libcxx/include/__ranges/container_compatible_range.h+4-4| ... | @@ -18,16 +18,16 @@ | ... | @@ -18,16 +18,16 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 23 | 21 | #if _LIBCPP_STD_VER >= 23 |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | template <class _Range, class _Tp> | 25 | template <class _Range, class _Tp> |
| 26 | concept _ContainerCompatibleRange = | 26 | concept _ContainerCompatibleRange = |
| 27 | ranges::input_range<_Range> && convertible_to<ranges::range_reference_t<_Range>, _Tp>; | 27 | ranges::input_range<_Range> && convertible_to<ranges::range_reference_t<_Range>, _Tp>; |
| 28 | 28 | ||
| 29 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 30 | |||
| 31 | _LIBCPP_END_NAMESPACE_STD | 29 | _LIBCPP_END_NAMESPACE_STD |
| 32 | 30 | ||
| 31 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 32 | |||
| 33 | #endif // _LIBCPP___RANGES_CONTAINER_COMPATIBLE_RANGE_H | 33 | #endif // _LIBCPP___RANGES_CONTAINER_COMPATIBLE_RANGE_H |
lib/libcxx/include/__ranges/dangling.h+4-4| ... | @@ -19,10 +19,10 @@ | ... | @@ -19,10 +19,10 @@ |
| 19 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 20 | 22 | #if _LIBCPP_STD_VER >= 20 |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | namespace ranges { | 26 | namespace ranges { |
| 27 | struct dangling { | 27 | struct dangling { |
| 28 | dangling() = default; | 28 | dangling() = default; |
| ... | @@ -35,8 +35,8 @@ using borrowed_iterator_t = _If<borrowed_range<_Rp>, iterator_t<_Rp>, dangling>; | ... | @@ -35,8 +35,8 @@ using borrowed_iterator_t = _If<borrowed_range<_Rp>, iterator_t<_Rp>, dangling>; |
| 35 | // borrowed_subrange_t defined in <__ranges/subrange.h> | 35 | // borrowed_subrange_t defined in <__ranges/subrange.h> |
| 36 | } // namespace ranges | 36 | } // namespace ranges |
| 37 | 37 | ||
| 38 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 39 | |||
| 40 | _LIBCPP_END_NAMESPACE_STD | 38 | _LIBCPP_END_NAMESPACE_STD |
| 41 | 39 | ||
| 40 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 41 | |||
| 42 | #endif // _LIBCPP___RANGES_DANGLING_H | 42 | #endif // _LIBCPP___RANGES_DANGLING_H |
lib/libcxx/include/__ranges/data.h+6-6| ... | @@ -28,10 +28,10 @@ | ... | @@ -28,10 +28,10 @@ |
| 28 | # pragma GCC system_header | 28 | # pragma GCC system_header |
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
| 31 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 32 | |||
| 33 | #if _LIBCPP_STD_VER >= 20 | 31 | #if _LIBCPP_STD_VER >= 20 |
| 34 | 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 34 | |||
| 35 | // [range.prim.data] | 35 | // [range.prim.data] |
| 36 | 36 | ||
| 37 | namespace ranges { | 37 | namespace ranges { |
| ... | @@ -51,12 +51,12 @@ concept __ranges_begin_invocable = !__member_data<_Tp> && __can_borrow<_Tp> && r | ... | @@ -51,12 +51,12 @@ concept __ranges_begin_invocable = !__member_data<_Tp> && __can_borrow<_Tp> && r |
| 51 | 51 | ||
| 52 | struct __fn { | 52 | struct __fn { |
| 53 | template <__member_data _Tp> | 53 | template <__member_data _Tp> |
| 54 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) { | 54 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) { |
| 55 | return __t.data(); | 55 | return __t.data(); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | template <__ranges_begin_invocable _Tp> | 58 | template <__ranges_begin_invocable _Tp> |
| 59 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const | 59 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const |
| 60 | noexcept(noexcept(std::to_address(ranges::begin(__t)))) { | 60 | noexcept(noexcept(std::to_address(ranges::begin(__t)))) { |
| 61 | return std::to_address(ranges::begin(__t)); | 61 | return std::to_address(ranges::begin(__t)); |
| 62 | } | 62 | } |
| ... | @@ -95,8 +95,8 @@ inline constexpr auto cdata = __cdata::__fn{}; | ... | @@ -95,8 +95,8 @@ inline constexpr auto cdata = __cdata::__fn{}; |
| 95 | } // namespace __cpo | 95 | } // namespace __cpo |
| 96 | } // namespace ranges | 96 | } // namespace ranges |
| 97 | 97 | ||
| 98 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 99 | |||
| 100 | _LIBCPP_END_NAMESPACE_STD | 98 | _LIBCPP_END_NAMESPACE_STD |
| 101 | 99 | ||
| 100 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 101 | |||
| 102 | #endif // _LIBCPP___RANGES_DATA_H | 102 | #endif // _LIBCPP___RANGES_DATA_H |
lib/libcxx/include/__ranges/drop_view.h+1-2| ... | @@ -74,8 +74,7 @@ public: | ... | @@ -74,8 +74,7 @@ public: |
| 74 | requires default_initializable<_View> | 74 | requires default_initializable<_View> |
| 75 | = default; | 75 | = default; |
| 76 | 76 | ||
| 77 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 | 77 | _LIBCPP_HIDE_FROM_ABI constexpr explicit drop_view(_View __base, range_difference_t<_View> __count) |
| 78 | drop_view(_View __base, range_difference_t<_View> __count) | ||
| 79 | : __count_(__count), __base_(std::move(__base)) { | 78 | : __count_(__count), __base_(std::move(__base)) { |
| 80 | _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero."); | 79 | _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero."); |
| 81 | } | 80 | } |
lib/libcxx/include/__ranges/drop_while_view.h+2-2| ... | @@ -48,13 +48,13 @@ namespace ranges { | ... | @@ -48,13 +48,13 @@ namespace ranges { |
| 48 | 48 | ||
| 49 | template <view _View, class _Pred> | 49 | template <view _View, class _Pred> |
| 50 | requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>> | 50 | requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>> |
| 51 | class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS drop_while_view : public view_interface<drop_while_view<_View, _Pred>> { | 51 | class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG drop_while_view : public view_interface<drop_while_view<_View, _Pred>> { |
| 52 | public: | 52 | public: |
| 53 | _LIBCPP_HIDE_FROM_ABI drop_while_view() | 53 | _LIBCPP_HIDE_FROM_ABI drop_while_view() |
| 54 | requires default_initializable<_View> && default_initializable<_Pred> | 54 | requires default_initializable<_View> && default_initializable<_Pred> |
| 55 | = default; | 55 | = default; |
| 56 | 56 | ||
| 57 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_while_view(_View __base, _Pred __pred) | 57 | _LIBCPP_HIDE_FROM_ABI constexpr explicit drop_while_view(_View __base, _Pred __pred) |
| 58 | : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {} | 58 | : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {} |
| 59 | 59 | ||
| 60 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | 60 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& |
lib/libcxx/include/__ranges/elements_of.h+4-4| ... | @@ -23,10 +23,10 @@ | ... | @@ -23,10 +23,10 @@ |
| 23 | _LIBCPP_PUSH_MACROS | 23 | _LIBCPP_PUSH_MACROS |
| 24 | #include <__undef_macros> | 24 | #include <__undef_macros> |
| 25 | 25 | ||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 27 | |||
| 28 | #if _LIBCPP_STD_VER >= 23 | 26 | #if _LIBCPP_STD_VER >= 23 |
| 29 | 27 | ||
| 28 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 29 | |||
| 30 | namespace ranges { | 30 | namespace ranges { |
| 31 | 31 | ||
| 32 | template <range _Range, class _Allocator = allocator<byte>> | 32 | template <range _Range, class _Allocator = allocator<byte>> |
| ... | @@ -40,10 +40,10 @@ elements_of(_Range&&, _Allocator = _Allocator()) -> elements_of<_Range&&, _Alloc | ... | @@ -40,10 +40,10 @@ elements_of(_Range&&, _Allocator = _Allocator()) -> elements_of<_Range&&, _Alloc |
| 40 | 40 | ||
| 41 | } // namespace ranges | 41 | } // namespace ranges |
| 42 | 42 | ||
| 43 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 44 | |||
| 45 | _LIBCPP_END_NAMESPACE_STD | 43 | _LIBCPP_END_NAMESPACE_STD |
| 46 | 44 | ||
| 45 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 46 | |||
| 47 | _LIBCPP_POP_MACROS | 47 | _LIBCPP_POP_MACROS |
| 48 | 48 | ||
| 49 | #endif // _LIBCPP___RANGES_ELEMENTS_OF_H | 49 | #endif // _LIBCPP___RANGES_ELEMENTS_OF_H |
lib/libcxx/include/__ranges/elements_view.h+21-20| ... | @@ -77,57 +77,57 @@ public: | ... | @@ -77,57 +77,57 @@ public: |
| 77 | 77 | ||
| 78 | _LIBCPP_HIDE_FROM_ABI constexpr explicit elements_view(_View __base) : __base_(std::move(__base)) {} | 78 | _LIBCPP_HIDE_FROM_ABI constexpr explicit elements_view(_View __base) : __base_(std::move(__base)) {} |
| 79 | 79 | ||
| 80 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | 80 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& |
| 81 | requires copy_constructible<_View> | 81 | requires copy_constructible<_View> |
| 82 | { | 82 | { |
| 83 | return __base_; | 83 | return __base_; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | 86 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } |
| 87 | 87 | ||
| 88 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() | 88 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() |
| 89 | requires(!__simple_view<_View>) | 89 | requires(!__simple_view<_View>) |
| 90 | { | 90 | { |
| 91 | return __iterator</*_Const=*/false>(ranges::begin(__base_)); | 91 | return __iterator</*_Const=*/false>(ranges::begin(__base_)); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | 94 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const |
| 95 | requires range<const _View> | 95 | requires range<const _View> |
| 96 | { | 96 | { |
| 97 | return __iterator</*_Const=*/true>(ranges::begin(__base_)); | 97 | return __iterator</*_Const=*/true>(ranges::begin(__base_)); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() | 100 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() |
| 101 | requires(!__simple_view<_View> && !common_range<_View>) | 101 | requires(!__simple_view<_View> && !common_range<_View>) |
| 102 | { | 102 | { |
| 103 | return __sentinel</*_Const=*/false>{ranges::end(__base_)}; | 103 | return __sentinel</*_Const=*/false>{ranges::end(__base_)}; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() | 106 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() |
| 107 | requires(!__simple_view<_View> && common_range<_View>) | 107 | requires(!__simple_view<_View> && common_range<_View>) |
| 108 | { | 108 | { |
| 109 | return __iterator</*_Const=*/false>{ranges::end(__base_)}; | 109 | return __iterator</*_Const=*/false>{ranges::end(__base_)}; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | 112 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const |
| 113 | requires range<const _View> | 113 | requires range<const _View> |
| 114 | { | 114 | { |
| 115 | return __sentinel</*_Const=*/true>{ranges::end(__base_)}; | 115 | return __sentinel</*_Const=*/true>{ranges::end(__base_)}; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | 118 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const |
| 119 | requires common_range<const _View> | 119 | requires common_range<const _View> |
| 120 | { | 120 | { |
| 121 | return __iterator</*_Const=*/true>{ranges::end(__base_)}; | 121 | return __iterator</*_Const=*/true>{ranges::end(__base_)}; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() | 124 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() |
| 125 | requires sized_range<_View> | 125 | requires sized_range<_View> |
| 126 | { | 126 | { |
| 127 | return ranges::size(__base_); | 127 | return ranges::size(__base_); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | 130 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const |
| 131 | requires sized_range<const _View> | 131 | requires sized_range<const _View> |
| 132 | { | 132 | { |
| 133 | return ranges::size(__base_); | 133 | return ranges::size(__base_); |
| ... | @@ -211,11 +211,11 @@ public: | ... | @@ -211,11 +211,11 @@ public: |
| 211 | requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> | 211 | requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> |
| 212 | : __current_(std::move(__i.__current_)) {} | 212 | : __current_(std::move(__i.__current_)) {} |
| 213 | 213 | ||
| 214 | _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; } | 214 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; } |
| 215 | 215 | ||
| 216 | _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); } | 216 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); } |
| 217 | 217 | ||
| 218 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return __get_element(__current_); } | 218 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return __get_element(__current_); } |
| 219 | 219 | ||
| 220 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { | 220 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { |
| 221 | ++__current_; | 221 | ++__current_; |
| ... | @@ -261,7 +261,7 @@ public: | ... | @@ -261,7 +261,7 @@ public: |
| 261 | return *this; | 261 | return *this; |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const | 264 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const |
| 265 | requires random_access_range<_Base> | 265 | requires random_access_range<_Base> |
| 266 | { | 266 | { |
| 267 | return __get_element(__current_ + __n); | 267 | return __get_element(__current_ + __n); |
| ... | @@ -303,25 +303,26 @@ public: | ... | @@ -303,25 +303,26 @@ public: |
| 303 | return __x.__current_ <=> __y.__current_; | 303 | return __x.__current_ <=> __y.__current_; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __x, difference_type __y) | 306 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __x, difference_type __y) |
| 307 | requires random_access_range<_Base> | 307 | requires random_access_range<_Base> |
| 308 | { | 308 | { |
| 309 | return __iterator{__x} += __y; | 309 | return __iterator{__x} += __y; |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __x, const __iterator& __y) | 312 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __x, const __iterator& __y) |
| 313 | requires random_access_range<_Base> | 313 | requires random_access_range<_Base> |
| 314 | { | 314 | { |
| 315 | return __y + __x; | 315 | return __y + __x; |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __x, difference_type __y) | 318 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __x, difference_type __y) |
| 319 | requires random_access_range<_Base> | 319 | requires random_access_range<_Base> |
| 320 | { | 320 | { |
| 321 | return __iterator{__x} -= __y; | 321 | return __iterator{__x} -= __y; |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) | 324 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type |
| 325 | operator-(const __iterator& __x, const __iterator& __y) | ||
| 325 | requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> | 326 | requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> |
| 326 | { | 327 | { |
| 327 | return __x.__current_ - __y.__current_; | 328 | return __x.__current_ - __y.__current_; |
| ... | @@ -365,14 +366,14 @@ public: | ... | @@ -365,14 +366,14 @@ public: |
| 365 | 366 | ||
| 366 | template <bool _OtherConst> | 367 | template <bool _OtherConst> |
| 367 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | 368 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| 368 | _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> | 369 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> |
| 369 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | 370 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { |
| 370 | return __get_current(__x) - __y.__end_; | 371 | return __get_current(__x) - __y.__end_; |
| 371 | } | 372 | } |
| 372 | 373 | ||
| 373 | template <bool _OtherConst> | 374 | template <bool _OtherConst> |
| 374 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | 375 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| 375 | _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> | 376 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> |
| 376 | operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { | 377 | operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { |
| 377 | return __x.__end_ - __get_current(__y); | 378 | return __x.__end_ - __get_current(__y); |
| 378 | } | 379 | } |
lib/libcxx/include/__ranges/empty.h+4-4| ... | @@ -20,10 +20,10 @@ | ... | @@ -20,10 +20,10 @@ |
| 20 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | #if _LIBCPP_STD_VER >= 20 | 23 | #if _LIBCPP_STD_VER >= 20 |
| 26 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 26 | |||
| 27 | // [range.prim.empty] | 27 | // [range.prim.empty] |
| 28 | 28 | ||
| 29 | namespace ranges { | 29 | namespace ranges { |
| ... | @@ -64,8 +64,8 @@ inline constexpr auto empty = __empty::__fn{}; | ... | @@ -64,8 +64,8 @@ inline constexpr auto empty = __empty::__fn{}; |
| 64 | } // namespace __cpo | 64 | } // namespace __cpo |
| 65 | } // namespace ranges | 65 | } // namespace ranges |
| 66 | 66 | ||
| 67 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 68 | |||
| 69 | _LIBCPP_END_NAMESPACE_STD | 67 | _LIBCPP_END_NAMESPACE_STD |
| 70 | 68 | ||
| 69 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 70 | |||
| 71 | #endif // _LIBCPP___RANGES_EMPTY_H | 71 | #endif // _LIBCPP___RANGES_EMPTY_H |
lib/libcxx/include/__ranges/enable_borrowed_range.h+4-4| ... | @@ -20,10 +20,10 @@ | ... | @@ -20,10 +20,10 @@ |
| 20 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | #if _LIBCPP_STD_VER >= 20 | 23 | #if _LIBCPP_STD_VER >= 20 |
| 26 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 26 | |||
| 27 | namespace ranges { | 27 | namespace ranges { |
| 28 | 28 | ||
| 29 | // [range.range], ranges | 29 | // [range.range], ranges |
| ... | @@ -33,8 +33,8 @@ inline constexpr bool enable_borrowed_range = false; | ... | @@ -33,8 +33,8 @@ inline constexpr bool enable_borrowed_range = false; |
| 33 | 33 | ||
| 34 | } // namespace ranges | 34 | } // namespace ranges |
| 35 | 35 | ||
| 36 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 37 | |||
| 38 | _LIBCPP_END_NAMESPACE_STD | 36 | _LIBCPP_END_NAMESPACE_STD |
| 39 | 37 | ||
| 38 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 39 | |||
| 40 | #endif // _LIBCPP___RANGES_ENABLE_BORROWED_RANGE_H | 40 | #endif // _LIBCPP___RANGES_ENABLE_BORROWED_RANGE_H |
lib/libcxx/include/__ranges/enable_view.h+4-4| ... | @@ -20,10 +20,10 @@ | ... | @@ -20,10 +20,10 @@ |
| 20 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | #if _LIBCPP_STD_VER >= 20 | 23 | #if _LIBCPP_STD_VER >= 20 |
| 26 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 26 | |||
| 27 | namespace ranges { | 27 | namespace ranges { |
| 28 | 28 | ||
| 29 | struct view_base {}; | 29 | struct view_base {}; |
| ... | @@ -43,8 +43,8 @@ inline constexpr bool enable_view = derived_from<_Tp, view_base> || requires { | ... | @@ -43,8 +43,8 @@ inline constexpr bool enable_view = derived_from<_Tp, view_base> || requires { |
| 43 | 43 | ||
| 44 | } // namespace ranges | 44 | } // namespace ranges |
| 45 | 45 | ||
| 46 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 47 | |||
| 48 | _LIBCPP_END_NAMESPACE_STD | 46 | _LIBCPP_END_NAMESPACE_STD |
| 49 | 47 | ||
| 48 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 49 | |||
| 50 | #endif // _LIBCPP___RANGES_ENABLE_VIEW_H | 50 | #endif // _LIBCPP___RANGES_ENABLE_VIEW_H |
lib/libcxx/include/__ranges/enumerate_view.h created+350| ... | @@ -0,0 +1,350 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___RANGES_ENUMERATE_VIEW_H | ||
| 11 | #define _LIBCPP___RANGES_ENUMERATE_VIEW_H | ||
| 12 | |||
| 13 | #include <__concepts/constructible.h> | ||
| 14 | #include <__concepts/convertible_to.h> | ||
| 15 | #include <__config> | ||
| 16 | #include <__iterator/concepts.h> | ||
| 17 | #include <__iterator/distance.h> | ||
| 18 | #include <__iterator/iter_move.h> | ||
| 19 | #include <__iterator/iterator_traits.h> | ||
| 20 | #include <__ranges/access.h> | ||
| 21 | #include <__ranges/all.h> | ||
| 22 | #include <__ranges/concepts.h> | ||
| 23 | #include <__ranges/enable_borrowed_range.h> | ||
| 24 | #include <__ranges/range_adaptor.h> | ||
| 25 | #include <__ranges/size.h> | ||
| 26 | #include <__ranges/view_interface.h> | ||
| 27 | #include <__type_traits/maybe_const.h> | ||
| 28 | #include <__utility/forward.h> | ||
| 29 | #include <__utility/move.h> | ||
| 30 | #include <tuple> | ||
| 31 | |||
| 32 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 33 | # pragma GCC system_header | ||
| 34 | #endif | ||
| 35 | |||
| 36 | _LIBCPP_PUSH_MACROS | ||
| 37 | #include <__undef_macros> | ||
| 38 | |||
| 39 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 40 | |||
| 41 | #if _LIBCPP_STD_VER >= 23 | ||
| 42 | |||
| 43 | namespace ranges { | ||
| 44 | |||
| 45 | // [concept.object] | ||
| 46 | |||
| 47 | template <class _Rp> | ||
| 48 | concept __range_with_movable_references = | ||
| 49 | input_range<_Rp> && std::move_constructible<range_reference_t<_Rp>> && | ||
| 50 | std::move_constructible<range_rvalue_reference_t<_Rp>>; | ||
| 51 | |||
| 52 | // [range.enumerate.view] | ||
| 53 | |||
| 54 | template <view _View> | ||
| 55 | requires __range_with_movable_references<_View> | ||
| 56 | class enumerate_view : public view_interface<enumerate_view<_View>> { | ||
| 57 | _View __base_ = _View(); | ||
| 58 | |||
| 59 | // [range.enumerate.iterator] | ||
| 60 | template <bool _Const> | ||
| 61 | class __iterator; | ||
| 62 | |||
| 63 | // [range.enumerate.sentinel] | ||
| 64 | template <bool _Const> | ||
| 65 | class __sentinel; | ||
| 66 | |||
| 67 | public: | ||
| 68 | _LIBCPP_HIDE_FROM_ABI constexpr enumerate_view() | ||
| 69 | requires default_initializable<_View> | ||
| 70 | = default; | ||
| 71 | _LIBCPP_HIDE_FROM_ABI constexpr explicit enumerate_view(_View __base) : __base_(std::move(__base)) {} | ||
| 72 | |||
| 73 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() | ||
| 74 | requires(!__simple_view<_View>) | ||
| 75 | { | ||
| 76 | return __iterator<false>(ranges::begin(__base_), 0); | ||
| 77 | } | ||
| 78 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | ||
| 79 | requires __range_with_movable_references<const _View> | ||
| 80 | { | ||
| 81 | return __iterator<true>(ranges::begin(__base_), 0); | ||
| 82 | } | ||
| 83 | |||
| 84 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() | ||
| 85 | requires(!__simple_view<_View>) | ||
| 86 | { | ||
| 87 | if constexpr (forward_range<_View> && common_range<_View> && sized_range<_View>) | ||
| 88 | return __iterator<false>(ranges::end(__base_), ranges::distance(__base_)); | ||
| 89 | else | ||
| 90 | return __sentinel<false>(ranges::end(__base_)); | ||
| 91 | } | ||
| 92 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | ||
| 93 | requires __range_with_movable_references<const _View> | ||
| 94 | { | ||
| 95 | if constexpr (forward_range<_View> && common_range<const _View> && sized_range<const _View>) | ||
| 96 | return __iterator<true>(ranges::end(__base_), ranges::distance(__base_)); | ||
| 97 | else | ||
| 98 | return __sentinel<true>(ranges::end(__base_)); | ||
| 99 | } | ||
| 100 | |||
| 101 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() | ||
| 102 | requires sized_range<_View> | ||
| 103 | { | ||
| 104 | return ranges::size(__base_); | ||
| 105 | } | ||
| 106 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | ||
| 107 | requires sized_range<const _View> | ||
| 108 | { | ||
| 109 | return ranges::size(__base_); | ||
| 110 | } | ||
| 111 | |||
| 112 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | ||
| 113 | requires copy_constructible<_View> | ||
| 114 | { | ||
| 115 | return __base_; | ||
| 116 | } | ||
| 117 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | ||
| 118 | }; | ||
| 119 | |||
| 120 | template <class _Range> | ||
| 121 | enumerate_view(_Range&&) -> enumerate_view<views::all_t<_Range>>; | ||
| 122 | |||
| 123 | // [range.enumerate.iterator] | ||
| 124 | |||
| 125 | template <view _View> | ||
| 126 | requires __range_with_movable_references<_View> | ||
| 127 | template <bool _Const> | ||
| 128 | class enumerate_view<_View>::__iterator { | ||
| 129 | using _Base _LIBCPP_NODEBUG = __maybe_const<_Const, _View>; | ||
| 130 | |||
| 131 | static consteval auto __get_iterator_concept() { | ||
| 132 | if constexpr (random_access_range<_Base>) { | ||
| 133 | return random_access_iterator_tag{}; | ||
| 134 | } else if constexpr (bidirectional_range<_Base>) { | ||
| 135 | return bidirectional_iterator_tag{}; | ||
| 136 | } else if constexpr (forward_range<_Base>) { | ||
| 137 | return forward_iterator_tag{}; | ||
| 138 | } else { | ||
| 139 | return input_iterator_tag{}; | ||
| 140 | } | ||
| 141 | } | ||
| 142 | |||
| 143 | friend class enumerate_view<_View>; | ||
| 144 | |||
| 145 | public: | ||
| 146 | using iterator_category = input_iterator_tag; | ||
| 147 | using iterator_concept = decltype(__get_iterator_concept()); | ||
| 148 | using difference_type = range_difference_t<_Base>; | ||
| 149 | using value_type = tuple<difference_type, range_value_t<_Base>>; | ||
| 150 | |||
| 151 | private: | ||
| 152 | using __reference_type _LIBCPP_NODEBUG = tuple<difference_type, range_reference_t<_Base>>; | ||
| 153 | |||
| 154 | iterator_t<_Base> __current_ = iterator_t<_Base>(); | ||
| 155 | difference_type __pos_ = 0; | ||
| 156 | |||
| 157 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(iterator_t<_Base> __current, difference_type __pos) | ||
| 158 | : __current_(std::move(__current)), __pos_(__pos) {} | ||
| 159 | |||
| 160 | public: | ||
| 161 | _LIBCPP_HIDE_FROM_ABI __iterator() | ||
| 162 | requires default_initializable<iterator_t<_Base>> | ||
| 163 | = default; | ||
| 164 | |||
| 165 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i) | ||
| 166 | requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> | ||
| 167 | : __current_(std::move(__i.__current_)), __pos_(__i.__pos_) {} | ||
| 168 | |||
| 169 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; } | ||
| 170 | |||
| 171 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); } | ||
| 172 | |||
| 173 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr difference_type index() const noexcept { return __pos_; } | ||
| 174 | |||
| 175 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const { return __reference_type(__pos_, *__current_); } | ||
| 176 | |||
| 177 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { | ||
| 178 | ++__current_; | ||
| 179 | ++__pos_; | ||
| 180 | return *this; | ||
| 181 | } | ||
| 182 | |||
| 183 | _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { return ++*this; } | ||
| 184 | |||
| 185 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) | ||
| 186 | requires forward_range<_Base> | ||
| 187 | { | ||
| 188 | auto __temp = *this; | ||
| 189 | ++*this; | ||
| 190 | return __temp; | ||
| 191 | } | ||
| 192 | |||
| 193 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() | ||
| 194 | requires bidirectional_range<_Base> | ||
| 195 | { | ||
| 196 | --__current_; | ||
| 197 | --__pos_; | ||
| 198 | return *this; | ||
| 199 | } | ||
| 200 | |||
| 201 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) | ||
| 202 | requires bidirectional_range<_Base> | ||
| 203 | { | ||
| 204 | auto __temp = *this; | ||
| 205 | --*this; | ||
| 206 | return *__temp; | ||
| 207 | } | ||
| 208 | |||
| 209 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) | ||
| 210 | requires random_access_range<_Base> | ||
| 211 | { | ||
| 212 | __current_ += __n; | ||
| 213 | __pos_ += __n; | ||
| 214 | return *this; | ||
| 215 | } | ||
| 216 | |||
| 217 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) | ||
| 218 | requires random_access_range<_Base> | ||
| 219 | { | ||
| 220 | __current_ -= __n; | ||
| 221 | __pos_ -= __n; | ||
| 222 | return *this; | ||
| 223 | } | ||
| 224 | |||
| 225 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const | ||
| 226 | requires random_access_range<_Base> | ||
| 227 | { | ||
| 228 | return __reference_type(__pos_ + __n, __current_[__n]); | ||
| 229 | } | ||
| 230 | |||
| 231 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) noexcept { | ||
| 232 | return __x.__pos_ == __y.__pos_; | ||
| 233 | } | ||
| 234 | |||
| 235 | _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering | ||
| 236 | operator<=>(const __iterator& __x, const __iterator& __y) noexcept { | ||
| 237 | return __x.__pos_ <=> __y.__pos_; | ||
| 238 | } | ||
| 239 | |||
| 240 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n) | ||
| 241 | requires random_access_range<_Base> | ||
| 242 | { | ||
| 243 | auto __temp = __i; | ||
| 244 | __temp += __n; | ||
| 245 | return __temp; | ||
| 246 | } | ||
| 247 | |||
| 248 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i) | ||
| 249 | requires random_access_range<_Base> | ||
| 250 | { | ||
| 251 | return __i + __n; | ||
| 252 | } | ||
| 253 | |||
| 254 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n) | ||
| 255 | requires random_access_range<_Base> | ||
| 256 | { | ||
| 257 | auto __temp = __i; | ||
| 258 | __temp -= __n; | ||
| 259 | return __temp; | ||
| 260 | } | ||
| 261 | |||
| 262 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type | ||
| 263 | operator-(const __iterator& __x, const __iterator& __y) noexcept { | ||
| 264 | return __x.__pos_ - __y.__pos_; | ||
| 265 | } | ||
| 266 | |||
| 267 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto iter_move(const __iterator& __i) noexcept( | ||
| 268 | noexcept(ranges::iter_move(__i.__current_)) && is_nothrow_move_constructible_v<range_rvalue_reference_t<_Base>>) { | ||
| 269 | return tuple<difference_type, range_rvalue_reference_t<_Base>>(__i.__pos_, ranges::iter_move(__i.__current_)); | ||
| 270 | } | ||
| 271 | }; | ||
| 272 | |||
| 273 | // [range.enumerate.sentinel] | ||
| 274 | |||
| 275 | template <view _View> | ||
| 276 | requires __range_with_movable_references<_View> | ||
| 277 | template <bool _Const> | ||
| 278 | class enumerate_view<_View>::__sentinel { | ||
| 279 | using _Base _LIBCPP_NODEBUG = __maybe_const<_Const, _View>; | ||
| 280 | |||
| 281 | sentinel_t<_Base> __end_ = sentinel_t<_Base>(); | ||
| 282 | |||
| 283 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {} | ||
| 284 | |||
| 285 | friend class enumerate_view<_View>; | ||
| 286 | |||
| 287 | public: | ||
| 288 | _LIBCPP_HIDE_FROM_ABI __sentinel() = default; | ||
| 289 | |||
| 290 | _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __other) | ||
| 291 | requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> | ||
| 292 | : __end_(std::move(__other.__end_)) {} | ||
| 293 | |||
| 294 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } | ||
| 295 | |||
| 296 | template <bool _OtherConst> | ||
| 297 | requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | ||
| 298 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | ||
| 299 | return __x.__current_ == __y.__end_; | ||
| 300 | } | ||
| 301 | |||
| 302 | template <bool _OtherConst> | ||
| 303 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | ||
| 304 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> | ||
| 305 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | ||
| 306 | return __x.__current_ - __y.__end_; | ||
| 307 | } | ||
| 308 | |||
| 309 | template <bool _OtherConst> | ||
| 310 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | ||
| 311 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> | ||
| 312 | operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { | ||
| 313 | return __x.__end_ - __y.__current_; | ||
| 314 | } | ||
| 315 | }; | ||
| 316 | |||
| 317 | template <class _View> | ||
| 318 | constexpr bool enable_borrowed_range<enumerate_view<_View>> = enable_borrowed_range<_View>; | ||
| 319 | |||
| 320 | namespace views { | ||
| 321 | namespace __enumerate { | ||
| 322 | |||
| 323 | // [range.enumerate.overview] | ||
| 324 | |||
| 325 | struct __fn : __range_adaptor_closure<__fn> { | ||
| 326 | template <class _Range> | ||
| 327 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto | ||
| 328 | operator()(_Range&& __range) noexcept(noexcept(enumerate_view<views::all_t<_Range>>(std::forward<_Range>(__range)))) | ||
| 329 | -> decltype(/*--------------------------*/ enumerate_view<views::all_t<_Range>>(std::forward<_Range>(__range))) { | ||
| 330 | return /*---------------------------------*/ enumerate_view<views::all_t<_Range>>(std::forward<_Range>(__range)); | ||
| 331 | } | ||
| 332 | }; | ||
| 333 | |||
| 334 | } // namespace __enumerate | ||
| 335 | |||
| 336 | inline namespace __cpo { | ||
| 337 | |||
| 338 | inline constexpr auto enumerate = __enumerate::__fn{}; | ||
| 339 | |||
| 340 | } // namespace __cpo | ||
| 341 | } // namespace views | ||
| 342 | } // namespace ranges | ||
| 343 | |||
| 344 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 345 | |||
| 346 | _LIBCPP_END_NAMESPACE_STD | ||
| 347 | |||
| 348 | _LIBCPP_POP_MACROS | ||
| 349 | |||
| 350 | #endif // _LIBCPP___RANGES_ENUMERATE_VIEW_H | ||
lib/libcxx/include/__ranges/filter_view.h+2-2| ... | @@ -54,7 +54,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -54,7 +54,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 54 | namespace ranges { | 54 | namespace ranges { |
| 55 | template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> | 55 | template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> |
| 56 | requires view<_View> && is_object_v<_Pred> | 56 | requires view<_View> && is_object_v<_Pred> |
| 57 | class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS filter_view : public view_interface<filter_view<_View, _Pred>> { | 57 | class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG filter_view : public view_interface<filter_view<_View, _Pred>> { |
| 58 | _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); | 58 | _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); |
| 59 | _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_; | 59 | _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_; |
| 60 | 60 | ||
| ... | @@ -72,7 +72,7 @@ public: | ... | @@ -72,7 +72,7 @@ public: |
| 72 | requires default_initializable<_View> && default_initializable<_Pred> | 72 | requires default_initializable<_View> && default_initializable<_Pred> |
| 73 | = default; | 73 | = default; |
| 74 | 74 | ||
| 75 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 filter_view(_View __base, _Pred __pred) | 75 | _LIBCPP_HIDE_FROM_ABI constexpr explicit filter_view(_View __base, _Pred __pred) |
| 76 | : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {} | 76 | : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {} |
| 77 | 77 | ||
| 78 | template <class _Vp = _View> | 78 | template <class _Vp = _View> |
lib/libcxx/include/__ranges/from_range.h+4-4| ... | @@ -16,18 +16,18 @@ | ... | @@ -16,18 +16,18 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | #if _LIBCPP_STD_VER >= 23 | 19 | #if _LIBCPP_STD_VER >= 23 |
| 22 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | struct from_range_t { | 23 | struct from_range_t { |
| 24 | explicit from_range_t() = default; | 24 | explicit from_range_t() = default; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | inline constexpr from_range_t from_range{}; | 27 | inline constexpr from_range_t from_range{}; |
| 28 | 28 | ||
| 29 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 30 | |||
| 31 | _LIBCPP_END_NAMESPACE_STD | 29 | _LIBCPP_END_NAMESPACE_STD |
| 32 | 30 | ||
| 31 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 32 | |||
| 33 | #endif // _LIBCPP___RANGES_FROM_RANGE_H | 33 | #endif // _LIBCPP___RANGES_FROM_RANGE_H |
lib/libcxx/include/__ranges/iota_view.h+6-6| ... | @@ -316,8 +316,8 @@ public: | ... | @@ -316,8 +316,8 @@ public: |
| 316 | 316 | ||
| 317 | _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) {} | 317 | _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) {} |
| 318 | 318 | ||
| 319 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 | 319 | _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(type_identity_t<_Start> __value, |
| 320 | iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel) | 320 | type_identity_t<_BoundSentinel> __bound_sentinel) |
| 321 | : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) { | 321 | : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) { |
| 322 | // Validate the precondition if possible. | 322 | // Validate the precondition if possible. |
| 323 | if constexpr (totally_ordered_with<_Start, _BoundSentinel>) { | 323 | if constexpr (totally_ordered_with<_Start, _BoundSentinel>) { |
| ... | @@ -326,15 +326,15 @@ public: | ... | @@ -326,15 +326,15 @@ public: |
| 326 | } | 326 | } |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __iterator __last) | 329 | _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(__iterator __first, __iterator __last) |
| 330 | requires same_as<_Start, _BoundSentinel> | 330 | requires same_as<_Start, _BoundSentinel> |
| 331 | : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {} | 331 | : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {} |
| 332 | 332 | ||
| 333 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, _BoundSentinel __last) | 333 | _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(__iterator __first, _BoundSentinel __last) |
| 334 | requires same_as<_BoundSentinel, unreachable_sentinel_t> | 334 | requires same_as<_BoundSentinel, unreachable_sentinel_t> |
| 335 | : iota_view(std::move(__first.__value_), std::move(__last)) {} | 335 | : iota_view(std::move(__first.__value_), std::move(__last)) {} |
| 336 | 336 | ||
| 337 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last) | 337 | _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(__iterator __first, __sentinel __last) |
| 338 | requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>) | 338 | requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>) |
| 339 | : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {} | 339 | : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {} |
| 340 | 340 | ||
| ... | @@ -357,7 +357,7 @@ public: | ... | @@ -357,7 +357,7 @@ public: |
| 357 | 357 | ||
| 358 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | 358 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const |
| 359 | requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) || | 359 | requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) || |
| 360 | (integral<_Start> && integral<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start> | 360 | (__integer_like<_Start> && __integer_like<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start> |
| 361 | { | 361 | { |
| 362 | if constexpr (__integer_like<_Start> && __integer_like<_BoundSentinel>) { | 362 | if constexpr (__integer_like<_Start> && __integer_like<_BoundSentinel>) { |
| 363 | return (__value_ < 0) | 363 | return (__value_ < 0) |
lib/libcxx/include/__ranges/istream_view.h+4-4| ... | @@ -46,12 +46,12 @@ public: | ... | @@ -46,12 +46,12 @@ public: |
| 46 | _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_istream_view(basic_istream<_CharT, _Traits>& __stream) | 46 | _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_istream_view(basic_istream<_CharT, _Traits>& __stream) |
| 47 | : __stream_(std::addressof(__stream)) {} | 47 | : __stream_(std::addressof(__stream)) {} |
| 48 | 48 | ||
| 49 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { | 49 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { |
| 50 | *__stream_ >> __value_; | 50 | *__stream_ >> __value_; |
| 51 | return __iterator{*this}; | 51 | return __iterator{*this}; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; } | 54 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; } |
| 55 | 55 | ||
| 56 | private: | 56 | private: |
| 57 | basic_istream<_CharT, _Traits>* __stream_; | 57 | basic_istream<_CharT, _Traits>* __stream_; |
| ... | @@ -82,7 +82,7 @@ public: | ... | @@ -82,7 +82,7 @@ public: |
| 82 | 82 | ||
| 83 | _LIBCPP_HIDE_FROM_ABI void operator++(int) { ++*this; } | 83 | _LIBCPP_HIDE_FROM_ABI void operator++(int) { ++*this; } |
| 84 | 84 | ||
| 85 | _LIBCPP_HIDE_FROM_ABI _Val& operator*() const { return __parent_->__value_; } | 85 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Val& operator*() const { return __parent_->__value_; } |
| 86 | 86 | ||
| 87 | _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __iterator& __x, default_sentinel_t) { | 87 | _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __iterator& __x, default_sentinel_t) { |
| 88 | return !*__x.__get_parent_stream(); | 88 | return !*__x.__get_parent_stream(); |
| ... | @@ -113,7 +113,7 @@ struct __fn { | ... | @@ -113,7 +113,7 @@ struct __fn { |
| 113 | template <class _Up, class _UnCVRef = remove_cvref_t<_Up>> | 113 | template <class _Up, class _UnCVRef = remove_cvref_t<_Up>> |
| 114 | requires derived_from<_UnCVRef, basic_istream<typename _UnCVRef::char_type, | 114 | requires derived_from<_UnCVRef, basic_istream<typename _UnCVRef::char_type, |
| 115 | typename _UnCVRef::traits_type>> | 115 | typename _UnCVRef::traits_type>> |
| 116 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Up&& __u) const | 116 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Up&& __u) const |
| 117 | noexcept(noexcept(basic_istream_view<_Tp, typename _UnCVRef::char_type, | 117 | noexcept(noexcept(basic_istream_view<_Tp, typename _UnCVRef::char_type, |
| 118 | typename _UnCVRef::traits_type>(std::forward<_Up>(__u)))) | 118 | typename _UnCVRef::traits_type>(std::forward<_Up>(__u)))) |
| 119 | -> decltype( basic_istream_view<_Tp, typename _UnCVRef::char_type, | 119 | -> decltype( basic_istream_view<_Tp, typename _UnCVRef::char_type, |
lib/libcxx/include/__ranges/join_view.h+8-8| ... | @@ -100,15 +100,15 @@ public: | ... | @@ -100,15 +100,15 @@ public: |
| 100 | 100 | ||
| 101 | _LIBCPP_HIDE_FROM_ABI constexpr explicit join_view(_View __base) : __base_(std::move(__base)) {} | 101 | _LIBCPP_HIDE_FROM_ABI constexpr explicit join_view(_View __base) : __base_(std::move(__base)) {} |
| 102 | 102 | ||
| 103 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | 103 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& |
| 104 | requires copy_constructible<_View> | 104 | requires copy_constructible<_View> |
| 105 | { | 105 | { |
| 106 | return __base_; | 106 | return __base_; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | 109 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } |
| 110 | 110 | ||
| 111 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { | 111 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { |
| 112 | if constexpr (forward_range<_View>) { | 112 | if constexpr (forward_range<_View>) { |
| 113 | constexpr bool __use_const = __simple_view<_View> && is_reference_v<range_reference_t<_View>>; | 113 | constexpr bool __use_const = __simple_view<_View> && is_reference_v<range_reference_t<_View>>; |
| 114 | return __iterator<__use_const>{*this, ranges::begin(__base_)}; | 114 | return __iterator<__use_const>{*this, ranges::begin(__base_)}; |
| ... | @@ -119,14 +119,14 @@ public: | ... | @@ -119,14 +119,14 @@ public: |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | template <class _V2 = _View> | 121 | template <class _V2 = _View> |
| 122 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | 122 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const |
| 123 | requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> && | 123 | requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> && |
| 124 | input_range<range_reference_t<const _V2>> | 124 | input_range<range_reference_t<const _V2>> |
| 125 | { | 125 | { |
| 126 | return __iterator<true>{*this, ranges::begin(__base_)}; | 126 | return __iterator<true>{*this, ranges::begin(__base_)}; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() { | 129 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() { |
| 130 | if constexpr (forward_range<_View> && is_reference_v<_InnerRange> && forward_range<_InnerRange> && | 130 | if constexpr (forward_range<_View> && is_reference_v<_InnerRange> && forward_range<_InnerRange> && |
| 131 | common_range<_View> && common_range<_InnerRange>) | 131 | common_range<_View> && common_range<_InnerRange>) |
| 132 | return __iterator<__simple_view<_View>>{*this, ranges::end(__base_)}; | 132 | return __iterator<__simple_view<_View>>{*this, ranges::end(__base_)}; |
| ... | @@ -135,7 +135,7 @@ public: | ... | @@ -135,7 +135,7 @@ public: |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | template <class _V2 = _View> | 137 | template <class _V2 = _View> |
| 138 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | 138 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const |
| 139 | requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> && | 139 | requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> && |
| 140 | input_range<range_reference_t<const _V2>> | 140 | input_range<range_reference_t<const _V2>> |
| 141 | { | 141 | { |
| ... | @@ -276,7 +276,7 @@ public: | ... | @@ -276,7 +276,7 @@ public: |
| 276 | requires _Const && convertible_to<iterator_t<_View>, _Outer> && convertible_to<iterator_t<_InnerRange>, _Inner> | 276 | requires _Const && convertible_to<iterator_t<_View>, _Outer> && convertible_to<iterator_t<_InnerRange>, _Inner> |
| 277 | : __outer_(std::move(__i.__outer_)), __inner_(std::move(__i.__inner_)), __parent_(__i.__parent_) {} | 277 | : __outer_(std::move(__i.__outer_)), __inner_(std::move(__i.__inner_)), __parent_(__i.__parent_) {} |
| 278 | 278 | ||
| 279 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return **__inner_; } | 279 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return **__inner_; } |
| 280 | 280 | ||
| 281 | _LIBCPP_HIDE_FROM_ABI constexpr _Inner operator->() const | 281 | _LIBCPP_HIDE_FROM_ABI constexpr _Inner operator->() const |
| 282 | requires __has_arrow<_Inner> && copyable<_Inner> | 282 | requires __has_arrow<_Inner> && copyable<_Inner> |
| ... | @@ -339,7 +339,7 @@ public: | ... | @@ -339,7 +339,7 @@ public: |
| 339 | return __x.__outer_ == __y.__outer_ && __x.__inner_ == __y.__inner_; | 339 | return __x.__outer_ == __y.__outer_ && __x.__inner_ == __y.__inner_; |
| 340 | } | 340 | } |
| 341 | 341 | ||
| 342 | _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) | 342 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) |
| 343 | iter_move(const __iterator& __i) noexcept(noexcept(ranges::iter_move(*__i.__inner_))) { | 343 | iter_move(const __iterator& __i) noexcept(noexcept(ranges::iter_move(*__i.__inner_))) { |
| 344 | return ranges::iter_move(*__i.__inner_); | 344 | return ranges::iter_move(*__i.__inner_); |
| 345 | } | 345 | } |
lib/libcxx/include/__ranges/join_with_view.h+2-3| ... | @@ -372,7 +372,7 @@ public: | ... | @@ -372,7 +372,7 @@ public: |
| 372 | return __tmp; | 372 | return __tmp; |
| 373 | } | 373 | } |
| 374 | 374 | ||
| 375 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) | 375 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) |
| 376 | requires __ref_is_glvalue && forward_range<_Base> && equality_comparable<_InnerIter> | 376 | requires __ref_is_glvalue && forward_range<_Base> && equality_comparable<_InnerIter> |
| 377 | { | 377 | { |
| 378 | return __x.__outer_it_ == __y.__outer_it_ && __x.__inner_it_ == __y.__inner_it_; | 378 | return __x.__outer_it_ == __y.__outer_it_ && __x.__inner_it_ == __y.__inner_it_; |
| ... | @@ -420,8 +420,7 @@ public: | ... | @@ -420,8 +420,7 @@ public: |
| 420 | 420 | ||
| 421 | template <bool _OtherConst> | 421 | template <bool _OtherConst> |
| 422 | requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | 422 | requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| 423 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr bool | 423 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { |
| 424 | operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | ||
| 425 | return __get_outer_of(__x) == __y.__end_; | 424 | return __get_outer_of(__x) == __y.__end_; |
| 426 | } | 425 | } |
| 427 | }; | 426 | }; |
lib/libcxx/include/__ranges/lazy_split_view.h+19-15| ... | @@ -86,23 +86,23 @@ public: | ... | @@ -86,23 +86,23 @@ public: |
| 86 | requires default_initializable<_View> && default_initializable<_Pattern> | 86 | requires default_initializable<_View> && default_initializable<_Pattern> |
| 87 | = default; | 87 | = default; |
| 88 | 88 | ||
| 89 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_View __base, _Pattern __pattern) | 89 | _LIBCPP_HIDE_FROM_ABI constexpr explicit lazy_split_view(_View __base, _Pattern __pattern) |
| 90 | : __base_(std::move(__base)), __pattern_(std::move(__pattern)) {} | 90 | : __base_(std::move(__base)), __pattern_(std::move(__pattern)) {} |
| 91 | 91 | ||
| 92 | template <input_range _Range> | 92 | template <input_range _Range> |
| 93 | requires constructible_from<_View, views::all_t<_Range>> && | 93 | requires constructible_from<_View, views::all_t<_Range>> && |
| 94 | constructible_from<_Pattern, single_view<range_value_t<_Range>>> | 94 | constructible_from<_Pattern, single_view<range_value_t<_Range>>> |
| 95 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_Range&& __r, range_value_t<_Range> __e) | 95 | _LIBCPP_HIDE_FROM_ABI constexpr explicit lazy_split_view(_Range&& __r, range_value_t<_Range> __e) |
| 96 | : __base_(views::all(std::forward<_Range>(__r))), __pattern_(views::single(std::move(__e))) {} | 96 | : __base_(views::all(std::forward<_Range>(__r))), __pattern_(views::single(std::move(__e))) {} |
| 97 | 97 | ||
| 98 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | 98 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& |
| 99 | requires copy_constructible<_View> | 99 | requires copy_constructible<_View> |
| 100 | { | 100 | { |
| 101 | return __base_; | 101 | return __base_; |
| 102 | } | 102 | } |
| 103 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | 103 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } |
| 104 | 104 | ||
| 105 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { | 105 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { |
| 106 | if constexpr (forward_range<_View>) { | 106 | if constexpr (forward_range<_View>) { |
| 107 | return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::begin(__base_)}; | 107 | return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::begin(__base_)}; |
| 108 | } else { | 108 | } else { |
| ... | @@ -111,19 +111,19 @@ public: | ... | @@ -111,19 +111,19 @@ public: |
| 111 | } | 111 | } |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | 114 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const |
| 115 | requires forward_range<_View> && forward_range<const _View> | 115 | requires forward_range<_View> && forward_range<const _View> |
| 116 | { | 116 | { |
| 117 | return __outer_iterator<true>{*this, ranges::begin(__base_)}; | 117 | return __outer_iterator<true>{*this, ranges::begin(__base_)}; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() | 120 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() |
| 121 | requires forward_range<_View> && common_range<_View> | 121 | requires forward_range<_View> && common_range<_View> |
| 122 | { | 122 | { |
| 123 | return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::end(__base_)}; | 123 | return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::end(__base_)}; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const { | 126 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const { |
| 127 | if constexpr (forward_range<_View> && forward_range<const _View> && common_range<const _View>) { | 127 | if constexpr (forward_range<_View> && forward_range<const _View> && common_range<const _View>) { |
| 128 | return __outer_iterator<true>{*this, ranges::end(__base_)}; | 128 | return __outer_iterator<true>{*this, ranges::end(__base_)}; |
| 129 | } else { | 129 | } else { |
| ... | @@ -188,8 +188,10 @@ private: | ... | @@ -188,8 +188,10 @@ private: |
| 188 | _LIBCPP_HIDE_FROM_ABI value_type() = default; | 188 | _LIBCPP_HIDE_FROM_ABI value_type() = default; |
| 189 | _LIBCPP_HIDE_FROM_ABI constexpr explicit value_type(__outer_iterator __i) : __i_(std::move(__i)) {} | 189 | _LIBCPP_HIDE_FROM_ABI constexpr explicit value_type(__outer_iterator __i) : __i_(std::move(__i)) {} |
| 190 | 190 | ||
| 191 | _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator<_Const> begin() const { return __inner_iterator<_Const>{__i_}; } | 191 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator<_Const> begin() const { |
| 192 | _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; } | 192 | return __inner_iterator<_Const>{__i_}; |
| 193 | } | ||
| 194 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; } | ||
| 193 | }; | 195 | }; |
| 194 | 196 | ||
| 195 | _LIBCPP_HIDE_FROM_ABI __outer_iterator() = default; | 197 | _LIBCPP_HIDE_FROM_ABI __outer_iterator() = default; |
| ... | @@ -206,7 +208,7 @@ private: | ... | @@ -206,7 +208,7 @@ private: |
| 206 | requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> | 208 | requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> |
| 207 | : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {} | 209 | : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {} |
| 208 | 210 | ||
| 209 | _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return value_type{*this}; } | 211 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return value_type{*this}; } |
| 210 | 212 | ||
| 211 | _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator& operator++() { | 213 | _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator& operator++() { |
| 212 | const auto __end = ranges::end(__parent_->__base_); | 214 | const auto __end = ranges::end(__parent_->__base_); |
| ... | @@ -342,14 +344,16 @@ private: | ... | @@ -342,14 +344,16 @@ private: |
| 342 | 344 | ||
| 343 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __inner_iterator(__outer_iterator<_Const> __i) : __i_(std::move(__i)) {} | 345 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __inner_iterator(__outer_iterator<_Const> __i) : __i_(std::move(__i)) {} |
| 344 | 346 | ||
| 345 | _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __i_.__current(); } | 347 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { |
| 346 | _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && | 348 | return __i_.__current(); |
| 349 | } | ||
| 350 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && | ||
| 347 | requires forward_range<_View> | 351 | requires forward_range<_View> |
| 348 | { | 352 | { |
| 349 | return std::move(__i_.__current()); | 353 | return std::move(__i_.__current()); |
| 350 | } | 354 | } |
| 351 | 355 | ||
| 352 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return *__i_.__current(); } | 356 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return *__i_.__current(); } |
| 353 | 357 | ||
| 354 | _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator& operator++() { | 358 | _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator& operator++() { |
| 355 | __incremented_ = true; | 359 | __incremented_ = true; |
| ... | @@ -385,7 +389,7 @@ private: | ... | @@ -385,7 +389,7 @@ private: |
| 385 | return __x.__is_done(); | 389 | return __x.__is_done(); |
| 386 | } | 390 | } |
| 387 | 391 | ||
| 388 | _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) | 392 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) |
| 389 | iter_move(const __inner_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__outer_current()))) { | 393 | iter_move(const __inner_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__outer_current()))) { |
| 390 | return ranges::iter_move(__i.__outer_current()); | 394 | return ranges::iter_move(__i.__outer_current()); |
| 391 | } | 395 | } |
lib/libcxx/include/__ranges/owning_view.h+4-4| ... | @@ -30,10 +30,10 @@ | ... | @@ -30,10 +30,10 @@ |
| 30 | _LIBCPP_PUSH_MACROS | 30 | _LIBCPP_PUSH_MACROS |
| 31 | #include <__undef_macros> | 31 | #include <__undef_macros> |
| 32 | 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 34 | |||
| 35 | #if _LIBCPP_STD_VER >= 20 | 33 | #if _LIBCPP_STD_VER >= 20 |
| 36 | 34 | ||
| 35 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 36 | |||
| 37 | namespace ranges { | 37 | namespace ranges { |
| 38 | template <range _Rp> | 38 | template <range _Rp> |
| 39 | requires movable<_Rp> && (!__is_std_initializer_list<remove_cvref_t<_Rp>>) | 39 | requires movable<_Rp> && (!__is_std_initializer_list<remove_cvref_t<_Rp>>) |
| ... | @@ -107,10 +107,10 @@ inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_ | ... | @@ -107,10 +107,10 @@ inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_ |
| 107 | 107 | ||
| 108 | } // namespace ranges | 108 | } // namespace ranges |
| 109 | 109 | ||
| 110 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 111 | |||
| 112 | _LIBCPP_END_NAMESPACE_STD | 110 | _LIBCPP_END_NAMESPACE_STD |
| 113 | 111 | ||
| 112 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 113 | |||
| 114 | _LIBCPP_POP_MACROS | 114 | _LIBCPP_POP_MACROS |
| 115 | 115 | ||
| 116 | #endif // _LIBCPP___RANGES_OWNING_VIEW_H | 116 | #endif // _LIBCPP___RANGES_OWNING_VIEW_H |
lib/libcxx/include/__ranges/range_adaptor.h+4-4| ... | @@ -34,10 +34,10 @@ | ... | @@ -34,10 +34,10 @@ |
| 34 | _LIBCPP_PUSH_MACROS | 34 | _LIBCPP_PUSH_MACROS |
| 35 | #include <__undef_macros> | 35 | #include <__undef_macros> |
| 36 | 36 | ||
| 37 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 38 | |||
| 39 | #if _LIBCPP_STD_VER >= 20 | 37 | #if _LIBCPP_STD_VER >= 20 |
| 40 | 38 | ||
| 39 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 40 | |||
| 41 | namespace ranges { | 41 | namespace ranges { |
| 42 | 42 | ||
| 43 | // CRTP base that one can derive from in order to be considered a range adaptor closure | 43 | // CRTP base that one can derive from in order to be considered a range adaptor closure |
| ... | @@ -90,10 +90,10 @@ class _LIBCPP_NO_SPECIALIZATIONS range_adaptor_closure : public __range_adaptor_ | ... | @@ -90,10 +90,10 @@ class _LIBCPP_NO_SPECIALIZATIONS range_adaptor_closure : public __range_adaptor_ |
| 90 | 90 | ||
| 91 | } // namespace ranges | 91 | } // namespace ranges |
| 92 | 92 | ||
| 93 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 94 | |||
| 95 | _LIBCPP_END_NAMESPACE_STD | 93 | _LIBCPP_END_NAMESPACE_STD |
| 96 | 94 | ||
| 95 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 96 | |||
| 97 | _LIBCPP_POP_MACROS | 97 | _LIBCPP_POP_MACROS |
| 98 | 98 | ||
| 99 | #endif // _LIBCPP___RANGES_RANGE_ADAPTOR_H | 99 | #endif // _LIBCPP___RANGES_RANGE_ADAPTOR_H |
lib/libcxx/include/__ranges/ref_view.h+4-4| ... | @@ -32,10 +32,10 @@ | ... | @@ -32,10 +32,10 @@ |
| 32 | # pragma GCC system_header | 32 | # pragma GCC system_header |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 36 | |||
| 37 | #if _LIBCPP_STD_VER >= 20 | 35 | #if _LIBCPP_STD_VER >= 20 |
| 38 | 36 | ||
| 37 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 38 | |||
| 39 | namespace ranges { | 39 | namespace ranges { |
| 40 | template <range _Range> | 40 | template <range _Range> |
| 41 | requires is_object_v<_Range> | 41 | requires is_object_v<_Range> |
| ... | @@ -82,8 +82,8 @@ template <class _Tp> | ... | @@ -82,8 +82,8 @@ template <class _Tp> |
| 82 | inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true; | 82 | inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true; |
| 83 | } // namespace ranges | 83 | } // namespace ranges |
| 84 | 84 | ||
| 85 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 86 | |||
| 87 | _LIBCPP_END_NAMESPACE_STD | 85 | _LIBCPP_END_NAMESPACE_STD |
| 88 | 86 | ||
| 87 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 88 | |||
| 89 | #endif // _LIBCPP___RANGES_REF_VIEW_H | 89 | #endif // _LIBCPP___RANGES_REF_VIEW_H |
lib/libcxx/include/__ranges/repeat_view.h+5-5| ... | @@ -40,10 +40,10 @@ | ... | @@ -40,10 +40,10 @@ |
| 40 | _LIBCPP_PUSH_MACROS | 40 | _LIBCPP_PUSH_MACROS |
| 41 | #include <__undef_macros> | 41 | #include <__undef_macros> |
| 42 | 42 | ||
| 43 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 44 | |||
| 45 | #if _LIBCPP_STD_VER >= 23 | 43 | #if _LIBCPP_STD_VER >= 23 |
| 46 | 44 | ||
| 45 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 46 | |||
| 47 | namespace ranges { | 47 | namespace ranges { |
| 48 | 48 | ||
| 49 | template <class _Tp> | 49 | template <class _Tp> |
| ... | @@ -74,7 +74,7 @@ struct __fn; | ... | @@ -74,7 +74,7 @@ struct __fn; |
| 74 | template <move_constructible _Tp, semiregular _Bound = unreachable_sentinel_t> | 74 | template <move_constructible _Tp, semiregular _Bound = unreachable_sentinel_t> |
| 75 | requires(is_object_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>> && | 75 | requires(is_object_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>> && |
| 76 | (__integer_like_with_usable_difference_type<_Bound> || same_as<_Bound, unreachable_sentinel_t>)) | 76 | (__integer_like_with_usable_difference_type<_Bound> || same_as<_Bound, unreachable_sentinel_t>)) |
| 77 | class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS repeat_view : public view_interface<repeat_view<_Tp, _Bound>> { | 77 | class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG repeat_view : public view_interface<repeat_view<_Tp, _Bound>> { |
| 78 | friend struct views::__take::__fn; | 78 | friend struct views::__take::__fn; |
| 79 | friend struct views::__drop::__fn; | 79 | friend struct views::__drop::__fn; |
| 80 | class __iterator; | 80 | class __iterator; |
| ... | @@ -265,10 +265,10 @@ inline constexpr bool __is_repeat_specialization<repeat_view<_Tp, _Bound>> = tru | ... | @@ -265,10 +265,10 @@ inline constexpr bool __is_repeat_specialization<repeat_view<_Tp, _Bound>> = tru |
| 265 | 265 | ||
| 266 | } // namespace ranges | 266 | } // namespace ranges |
| 267 | 267 | ||
| 268 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 269 | |||
| 270 | _LIBCPP_END_NAMESPACE_STD | 268 | _LIBCPP_END_NAMESPACE_STD |
| 271 | 269 | ||
| 270 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 271 | |||
| 272 | _LIBCPP_POP_MACROS | 272 | _LIBCPP_POP_MACROS |
| 273 | 273 | ||
| 274 | #endif // _LIBCPP___RANGES_REPEAT_VIEW_H | 274 | #endif // _LIBCPP___RANGES_REPEAT_VIEW_H |
lib/libcxx/include/__ranges/reverse_view.h+8-8| ... | @@ -59,13 +59,13 @@ public: | ... | @@ -59,13 +59,13 @@ public: |
| 59 | 59 | ||
| 60 | _LIBCPP_HIDE_FROM_ABI constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {} | 60 | _LIBCPP_HIDE_FROM_ABI constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {} |
| 61 | 61 | ||
| 62 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | 62 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& |
| 63 | requires copy_constructible<_View> | 63 | requires copy_constructible<_View> |
| 64 | { | 64 | { |
| 65 | return __base_; | 65 | return __base_; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | 68 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } |
| 69 | 69 | ||
| 70 | _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin() { | 70 | _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin() { |
| 71 | if constexpr (_UseCache) | 71 | if constexpr (_UseCache) |
| ... | @@ -78,35 +78,35 @@ public: | ... | @@ -78,35 +78,35 @@ public: |
| 78 | return __tmp; | 78 | return __tmp; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin() | 81 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin() |
| 82 | requires common_range<_View> | 82 | requires common_range<_View> |
| 83 | { | 83 | { |
| 84 | return std::make_reverse_iterator(ranges::end(__base_)); | 84 | return std::make_reverse_iterator(ranges::end(__base_)); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | 87 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const |
| 88 | requires common_range<const _View> | 88 | requires common_range<const _View> |
| 89 | { | 89 | { |
| 90 | return std::make_reverse_iterator(ranges::end(__base_)); | 90 | return std::make_reverse_iterator(ranges::end(__base_)); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> end() { | 93 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> end() { |
| 94 | return std::make_reverse_iterator(ranges::begin(__base_)); | 94 | return std::make_reverse_iterator(ranges::begin(__base_)); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | 97 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const |
| 98 | requires common_range<const _View> | 98 | requires common_range<const _View> |
| 99 | { | 99 | { |
| 100 | return std::make_reverse_iterator(ranges::begin(__base_)); | 100 | return std::make_reverse_iterator(ranges::begin(__base_)); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() | 103 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() |
| 104 | requires sized_range<_View> | 104 | requires sized_range<_View> |
| 105 | { | 105 | { |
| 106 | return ranges::size(__base_); | 106 | return ranges::size(__base_); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | 109 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const |
| 110 | requires sized_range<const _View> | 110 | requires sized_range<const _View> |
| 111 | { | 111 | { |
| 112 | return ranges::size(__base_); | 112 | return ranges::size(__base_); |
lib/libcxx/include/__ranges/single_view.h+1-1| ... | @@ -41,7 +41,7 @@ template <move_constructible _Tp> | ... | @@ -41,7 +41,7 @@ template <move_constructible _Tp> |
| 41 | template <copy_constructible _Tp> | 41 | template <copy_constructible _Tp> |
| 42 | # endif | 42 | # endif |
| 43 | requires is_object_v<_Tp> | 43 | requires is_object_v<_Tp> |
| 44 | class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS single_view : public view_interface<single_view<_Tp>> { | 44 | class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG single_view : public view_interface<single_view<_Tp>> { |
| 45 | _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Tp> __value_; | 45 | _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Tp> __value_; |
| 46 | 46 | ||
| 47 | public: | 47 | public: |
lib/libcxx/include/__ranges/size.h+4-4| ... | @@ -29,10 +29,10 @@ | ... | @@ -29,10 +29,10 @@ |
| 29 | # pragma GCC system_header | 29 | # pragma GCC system_header |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | |||
| 34 | #if _LIBCPP_STD_VER >= 20 | 32 | #if _LIBCPP_STD_VER >= 20 |
| 35 | 33 | ||
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 35 | |||
| 36 | namespace ranges { | 36 | namespace ranges { |
| 37 | template <class> | 37 | template <class> |
| 38 | inline constexpr bool disable_sized_range = false; | 38 | inline constexpr bool disable_sized_range = false; |
| ... | @@ -131,8 +131,8 @@ inline constexpr auto ssize = __ssize::__fn{}; | ... | @@ -131,8 +131,8 @@ inline constexpr auto ssize = __ssize::__fn{}; |
| 131 | } // namespace __cpo | 131 | } // namespace __cpo |
| 132 | } // namespace ranges | 132 | } // namespace ranges |
| 133 | 133 | ||
| 134 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 135 | |||
| 136 | _LIBCPP_END_NAMESPACE_STD | 134 | _LIBCPP_END_NAMESPACE_STD |
| 137 | 135 | ||
| 136 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 137 | |||
| 138 | #endif // _LIBCPP___RANGES_SIZE_H | 138 | #endif // _LIBCPP___RANGES_SIZE_H |
lib/libcxx/include/__ranges/split_view.h+8-9| ... | @@ -78,32 +78,31 @@ public: | ... | @@ -78,32 +78,31 @@ public: |
| 78 | requires default_initializable<_View> && default_initializable<_Pattern> | 78 | requires default_initializable<_View> && default_initializable<_Pattern> |
| 79 | = default; | 79 | = default; |
| 80 | 80 | ||
| 81 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 split_view(_View __base, _Pattern __pattern) | 81 | _LIBCPP_HIDE_FROM_ABI constexpr explicit split_view(_View __base, _Pattern __pattern) |
| 82 | : __base_(std::move(__base)), __pattern_(std::move((__pattern))) {} | 82 | : __base_(std::move(__base)), __pattern_(std::move((__pattern))) {} |
| 83 | 83 | ||
| 84 | template <forward_range _Range> | 84 | template <forward_range _Range> |
| 85 | requires constructible_from<_View, views::all_t<_Range>> && | 85 | requires constructible_from<_View, views::all_t<_Range>> && |
| 86 | constructible_from<_Pattern, single_view<range_value_t<_Range>>> | 86 | constructible_from<_Pattern, single_view<range_value_t<_Range>>> |
| 87 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 | 87 | _LIBCPP_HIDE_FROM_ABI constexpr explicit split_view(_Range&& __range, range_value_t<_Range> __elem) |
| 88 | split_view(_Range&& __range, range_value_t<_Range> __elem) | ||
| 89 | : __base_(views::all(std::forward<_Range>(__range))), __pattern_(views::single(std::move(__elem))) {} | 88 | : __base_(views::all(std::forward<_Range>(__range))), __pattern_(views::single(std::move(__elem))) {} |
| 90 | 89 | ||
| 91 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | 90 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& |
| 92 | requires copy_constructible<_View> | 91 | requires copy_constructible<_View> |
| 93 | { | 92 | { |
| 94 | return __base_; | 93 | return __base_; |
| 95 | } | 94 | } |
| 96 | 95 | ||
| 97 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | 96 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } |
| 98 | 97 | ||
| 99 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() { | 98 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() { |
| 100 | if (!__cached_begin_.__has_value()) { | 99 | if (!__cached_begin_.__has_value()) { |
| 101 | __cached_begin_.__emplace(__find_next(ranges::begin(__base_))); | 100 | __cached_begin_.__emplace(__find_next(ranges::begin(__base_))); |
| 102 | } | 101 | } |
| 103 | return {*this, ranges::begin(__base_), *__cached_begin_}; | 102 | return {*this, ranges::begin(__base_), *__cached_begin_}; |
| 104 | } | 103 | } |
| 105 | 104 | ||
| 106 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() { | 105 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() { |
| 107 | if constexpr (common_range<_View>) { | 106 | if constexpr (common_range<_View>) { |
| 108 | return __iterator{*this, ranges::end(__base_), {}}; | 107 | return __iterator{*this, ranges::end(__base_), {}}; |
| 109 | } else { | 108 | } else { |
| ... | @@ -142,9 +141,9 @@ public: | ... | @@ -142,9 +141,9 @@ public: |
| 142 | split_view<_View, _Pattern>& __parent, iterator_t<_View> __current, subrange<iterator_t<_View>> __next) | 141 | split_view<_View, _Pattern>& __parent, iterator_t<_View> __current, subrange<iterator_t<_View>> __next) |
| 143 | : __parent_(std::addressof(__parent)), __cur_(std::move(__current)), __next_(std::move(__next)) {} | 142 | : __parent_(std::addressof(__parent)), __cur_(std::move(__current)), __next_(std::move(__next)) {} |
| 144 | 143 | ||
| 145 | _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() const { return __cur_; } | 144 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() const { return __cur_; } |
| 146 | 145 | ||
| 147 | _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return {__cur_, __next_.begin()}; } | 146 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return {__cur_, __next_.begin()}; } |
| 148 | 147 | ||
| 149 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { | 148 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { |
| 150 | __cur_ = __next_.begin(); | 149 | __cur_ = __next_.begin(); |
lib/libcxx/include/__ranges/stride_view.h created+410| ... | @@ -0,0 +1,410 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___RANGES_STRIDE_VIEW_H | ||
| 11 | #define _LIBCPP___RANGES_STRIDE_VIEW_H | ||
| 12 | |||
| 13 | #include <__assert> | ||
| 14 | #include <__compare/three_way_comparable.h> | ||
| 15 | #include <__concepts/constructible.h> | ||
| 16 | #include <__concepts/convertible_to.h> | ||
| 17 | #include <__concepts/derived_from.h> | ||
| 18 | #include <__concepts/equality_comparable.h> | ||
| 19 | #include <__config> | ||
| 20 | #include <__functional/bind_back.h> | ||
| 21 | #include <__iterator/advance.h> | ||
| 22 | #include <__iterator/concepts.h> | ||
| 23 | #include <__iterator/default_sentinel.h> | ||
| 24 | #include <__iterator/distance.h> | ||
| 25 | #include <__iterator/iter_move.h> | ||
| 26 | #include <__iterator/iter_swap.h> | ||
| 27 | #include <__iterator/iterator_traits.h> | ||
| 28 | #include <__ranges/access.h> | ||
| 29 | #include <__ranges/all.h> | ||
| 30 | #include <__ranges/concepts.h> | ||
| 31 | #include <__ranges/enable_borrowed_range.h> | ||
| 32 | #include <__ranges/range_adaptor.h> | ||
| 33 | #include <__ranges/view_interface.h> | ||
| 34 | #include <__type_traits/make_unsigned.h> | ||
| 35 | |||
| 36 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 37 | # pragma GCC system_header | ||
| 38 | #endif | ||
| 39 | |||
| 40 | _LIBCPP_PUSH_MACROS | ||
| 41 | #include <__undef_macros> | ||
| 42 | |||
| 43 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 44 | |||
| 45 | #if _LIBCPP_STD_VER >= 23 | ||
| 46 | |||
| 47 | namespace ranges { | ||
| 48 | |||
| 49 | template <class _Value> | ||
| 50 | _LIBCPP_HIDE_FROM_ABI constexpr _Value __div_ceil(_Value __left, _Value __right) { | ||
| 51 | _Value __r = __left / __right; | ||
| 52 | if (__left % __right) { | ||
| 53 | ++__r; | ||
| 54 | } | ||
| 55 | return __r; | ||
| 56 | } | ||
| 57 | |||
| 58 | template <input_range _View> | ||
| 59 | requires view<_View> | ||
| 60 | class stride_view : public view_interface<stride_view<_View>> { | ||
| 61 | _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); | ||
| 62 | range_difference_t<_View> __stride_ = 0; | ||
| 63 | |||
| 64 | template <bool _Const> | ||
| 65 | class __iterator; | ||
| 66 | |||
| 67 | public: | ||
| 68 | _LIBCPP_HIDE_FROM_ABI constexpr explicit stride_view(_View __base, range_difference_t<_View> __stride) | ||
| 69 | : __base_(std::move(__base)), __stride_(__stride) { | ||
| 70 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__stride > 0, "The value of stride must be greater than 0"); | ||
| 71 | } | ||
| 72 | |||
| 73 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | ||
| 74 | requires copy_constructible<_View> | ||
| 75 | { | ||
| 76 | return __base_; | ||
| 77 | } | ||
| 78 | |||
| 79 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | ||
| 80 | |||
| 81 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr range_difference_t<_View> stride() const noexcept { return __stride_; } | ||
| 82 | |||
| 83 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() | ||
| 84 | requires(!__simple_view<_View>) | ||
| 85 | { | ||
| 86 | return __iterator</*_Const=*/false>(this, ranges::begin(__base_), 0); | ||
| 87 | } | ||
| 88 | |||
| 89 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | ||
| 90 | requires range<const _View> | ||
| 91 | { | ||
| 92 | return __iterator</*_Const=*/true>(this, ranges::begin(__base_), 0); | ||
| 93 | } | ||
| 94 | |||
| 95 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() | ||
| 96 | requires(!__simple_view<_View>) | ||
| 97 | { | ||
| 98 | if constexpr (common_range<_View> && sized_range<_View> && forward_range<_View>) { | ||
| 99 | auto __missing = (__stride_ - ranges::distance(__base_) % __stride_) % __stride_; | ||
| 100 | return __iterator</*_Const=*/false>(this, ranges::end(__base_), __missing); | ||
| 101 | } else if constexpr (common_range<_View> && !bidirectional_range<_View>) { | ||
| 102 | return __iterator</*_Const=*/false>(this, ranges::end(__base_), 0); | ||
| 103 | } else { | ||
| 104 | return default_sentinel; | ||
| 105 | } | ||
| 106 | } | ||
| 107 | |||
| 108 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | ||
| 109 | requires(range<const _View>) | ||
| 110 | { | ||
| 111 | if constexpr (common_range<const _View> && sized_range<const _View> && forward_range<const _View>) { | ||
| 112 | auto __missing = (__stride_ - ranges::distance(__base_) % __stride_) % __stride_; | ||
| 113 | return __iterator</*_Const=*/true>(this, ranges::end(__base_), __missing); | ||
| 114 | } else if constexpr (common_range<const _View> && !bidirectional_range<const _View>) { | ||
| 115 | return __iterator</*_Const=*/true>(this, ranges::end(__base_), 0); | ||
| 116 | } else { | ||
| 117 | return default_sentinel; | ||
| 118 | } | ||
| 119 | } | ||
| 120 | |||
| 121 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() | ||
| 122 | requires sized_range<_View> | ||
| 123 | { | ||
| 124 | return std::__to_unsigned_like(ranges::__div_ceil(ranges::distance(__base_), __stride_)); | ||
| 125 | } | ||
| 126 | |||
| 127 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | ||
| 128 | requires sized_range<const _View> | ||
| 129 | { | ||
| 130 | return std::__to_unsigned_like(ranges::__div_ceil(ranges::distance(__base_), __stride_)); | ||
| 131 | } | ||
| 132 | }; // class stride_view | ||
| 133 | |||
| 134 | template <class _Range> | ||
| 135 | stride_view(_Range&&, range_difference_t<_Range>) -> stride_view<views::all_t<_Range>>; | ||
| 136 | |||
| 137 | template <class _View> | ||
| 138 | struct __stride_iterator_category {}; | ||
| 139 | |||
| 140 | template <forward_range _View> | ||
| 141 | struct __stride_iterator_category<_View> { | ||
| 142 | using _Cat _LIBCPP_NODEBUG = typename iterator_traits<iterator_t<_View>>::iterator_category; | ||
| 143 | using iterator_category = | ||
| 144 | _If<derived_from<_Cat, random_access_iterator_tag>, | ||
| 145 | /* then */ random_access_iterator_tag, | ||
| 146 | /* else */ _Cat >; | ||
| 147 | }; | ||
| 148 | |||
| 149 | template <input_range _View> | ||
| 150 | requires view<_View> | ||
| 151 | template <bool _Const> | ||
| 152 | class stride_view<_View>::__iterator : public __stride_iterator_category<__maybe_const<_Const, _View>> { | ||
| 153 | using _Parent _LIBCPP_NODEBUG = __maybe_const<_Const, stride_view<_View>>; | ||
| 154 | using _Base _LIBCPP_NODEBUG = __maybe_const<_Const, _View>; | ||
| 155 | |||
| 156 | _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_Base> __current_ = iterator_t<_Base>(); | ||
| 157 | _LIBCPP_NO_UNIQUE_ADDRESS ranges::sentinel_t<_Base> __end_ = ranges::sentinel_t<_Base>(); | ||
| 158 | range_difference_t<_Base> __stride_ = 0; | ||
| 159 | range_difference_t<_Base> __missing_ = 0; | ||
| 160 | |||
| 161 | friend stride_view; | ||
| 162 | |||
| 163 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator( | ||
| 164 | _Parent* __parent, ranges::iterator_t<_Base> __current, range_difference_t<_Base> __missing) | ||
| 165 | : __current_(std::move(__current)), | ||
| 166 | __end_(ranges::end(__parent->__base_)), | ||
| 167 | __stride_(__parent->__stride_), | ||
| 168 | __missing_(__missing) {} | ||
| 169 | |||
| 170 | static consteval auto __get_stride_view_iterator_concept() { | ||
| 171 | if constexpr (random_access_range<_Base>) { | ||
| 172 | return random_access_iterator_tag{}; | ||
| 173 | } else if constexpr (bidirectional_range<_Base>) { | ||
| 174 | return bidirectional_iterator_tag{}; | ||
| 175 | } else if constexpr (forward_range<_Base>) { | ||
| 176 | return forward_iterator_tag{}; | ||
| 177 | } else { | ||
| 178 | return input_iterator_tag{}; | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 182 | public: | ||
| 183 | using difference_type = range_difference_t<_Base>; | ||
| 184 | using value_type = range_value_t<_Base>; | ||
| 185 | using iterator_concept = decltype(__get_stride_view_iterator_concept()); | ||
| 186 | // using iterator_category = inherited; | ||
| 187 | |||
| 188 | _LIBCPP_HIDE_FROM_ABI __iterator() | ||
| 189 | requires default_initializable<iterator_t<_Base>> | ||
| 190 | = default; | ||
| 191 | |||
| 192 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i) | ||
| 193 | requires _Const && convertible_to<ranges::iterator_t<_View>, iterator_t<_Base>> && | ||
| 194 | convertible_to<sentinel_t<_View>, sentinel_t<_Base>> | ||
| 195 | : __current_(std::move(__i.__current_)), | ||
| 196 | __end_(std::move(__i.__end_)), | ||
| 197 | __stride_(__i.__stride_), | ||
| 198 | __missing_(__i.__missing_) {} | ||
| 199 | |||
| 200 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> const& base() const& noexcept { return __current_; } | ||
| 201 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); } | ||
| 202 | |||
| 203 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { | ||
| 204 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__current_ != __end_, "Cannot dereference an iterator at the end."); | ||
| 205 | return *__current_; | ||
| 206 | } | ||
| 207 | |||
| 208 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { | ||
| 209 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__current_ != __end_, "Cannot increment an iterator already at the end."); | ||
| 210 | __missing_ = ranges::advance(__current_, __stride_, __end_); | ||
| 211 | return *this; | ||
| 212 | } | ||
| 213 | |||
| 214 | _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { | ||
| 215 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__current_ != __end_, "Cannot increment an iterator already at the end."); | ||
| 216 | ++*this; | ||
| 217 | } | ||
| 218 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) | ||
| 219 | requires forward_range<_Base> | ||
| 220 | { | ||
| 221 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__current_ != __end_, "Cannot increment an iterator already at the end."); | ||
| 222 | auto __tmp = *this; | ||
| 223 | ++*this; | ||
| 224 | return __tmp; | ||
| 225 | } | ||
| 226 | |||
| 227 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() | ||
| 228 | requires bidirectional_range<_Base> | ||
| 229 | { | ||
| 230 | ranges::advance(__current_, __missing_ - __stride_); | ||
| 231 | __missing_ = 0; | ||
| 232 | return *this; | ||
| 233 | } | ||
| 234 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) | ||
| 235 | requires bidirectional_range<_Base> | ||
| 236 | { | ||
| 237 | auto __tmp = *this; | ||
| 238 | --*this; | ||
| 239 | return __tmp; | ||
| 240 | } | ||
| 241 | |||
| 242 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) | ||
| 243 | requires random_access_range<_Base> | ||
| 244 | { | ||
| 245 | if (__n > 0) { | ||
| 246 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(ranges::distance(__current_, __end_) > __stride_ * (__n - 1), | ||
| 247 | "Advancing the iterator beyond the end is not allowed."); | ||
| 248 | ranges::advance(__current_, __stride_ * (__n - 1)); | ||
| 249 | __missing_ = ranges::advance(__current_, __stride_, __end_); | ||
| 250 | |||
| 251 | } else if (__n < 0) { | ||
| 252 | ranges::advance(__current_, __stride_ * __n + __missing_); | ||
| 253 | __missing_ = 0; | ||
| 254 | } | ||
| 255 | return *this; | ||
| 256 | } | ||
| 257 | |||
| 258 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) | ||
| 259 | requires random_access_range<_Base> | ||
| 260 | { | ||
| 261 | return *this += -__n; | ||
| 262 | } | ||
| 263 | |||
| 264 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const | ||
| 265 | requires random_access_range<_Base> | ||
| 266 | { | ||
| 267 | return *(*this + __n); | ||
| 268 | } | ||
| 269 | |||
| 270 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, default_sentinel_t) { | ||
| 271 | return __x.__current_ == __x.__end_; | ||
| 272 | } | ||
| 273 | |||
| 274 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, __iterator const& __y) | ||
| 275 | requires equality_comparable<iterator_t<_Base>> | ||
| 276 | { | ||
| 277 | return __x.__current_ == __y.__current_; | ||
| 278 | } | ||
| 279 | |||
| 280 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(__iterator const& __x, __iterator const& __y) | ||
| 281 | requires random_access_range<_Base> | ||
| 282 | { | ||
| 283 | return __x.__current_ < __y.__current_; | ||
| 284 | } | ||
| 285 | |||
| 286 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(__iterator const& __x, __iterator const& __y) | ||
| 287 | requires random_access_range<_Base> | ||
| 288 | { | ||
| 289 | return __y < __x; | ||
| 290 | } | ||
| 291 | |||
| 292 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(__iterator const& __x, __iterator const& __y) | ||
| 293 | requires random_access_range<_Base> | ||
| 294 | { | ||
| 295 | return !(__y < __x); | ||
| 296 | } | ||
| 297 | |||
| 298 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(__iterator const& __x, __iterator const& __y) | ||
| 299 | requires random_access_range<_Base> | ||
| 300 | { | ||
| 301 | return !(__x < __y); | ||
| 302 | } | ||
| 303 | |||
| 304 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(__iterator const& __x, __iterator const& __y) | ||
| 305 | requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>> | ||
| 306 | { | ||
| 307 | return __x.__current_ <=> __y.__current_; | ||
| 308 | } | ||
| 309 | |||
| 310 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator const& __i, difference_type __s) | ||
| 311 | requires random_access_range<_Base> | ||
| 312 | { | ||
| 313 | auto __r = __i; | ||
| 314 | __r += __s; | ||
| 315 | return __r; | ||
| 316 | } | ||
| 317 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __s, __iterator const& __i) | ||
| 318 | requires random_access_range<_Base> | ||
| 319 | { | ||
| 320 | auto __r = __i; | ||
| 321 | __r += __s; | ||
| 322 | return __r; | ||
| 323 | } | ||
| 324 | |||
| 325 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator const& __i, difference_type __s) | ||
| 326 | requires random_access_range<_Base> | ||
| 327 | { | ||
| 328 | auto __r = __i; | ||
| 329 | __r -= __s; | ||
| 330 | return __r; | ||
| 331 | } | ||
| 332 | |||
| 333 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type | ||
| 334 | operator-(__iterator const& __x, __iterator const& __y) | ||
| 335 | requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> | ||
| 336 | { | ||
| 337 | if constexpr (forward_range<_Base>) { | ||
| 338 | auto __n = __x.__current_ - __y.__current_; | ||
| 339 | return (__n + __x.__missing_ - __y.__missing_) / __x.__stride_; | ||
| 340 | } | ||
| 341 | auto __n = __x.__current_ - __y.__current_; | ||
| 342 | if (__n < 0) { | ||
| 343 | return -ranges::__div_ceil(-__n, __x.__stride_); | ||
| 344 | } | ||
| 345 | return ranges::__div_ceil(__n, __x.__stride_); | ||
| 346 | } | ||
| 347 | |||
| 348 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type | ||
| 349 | operator-(default_sentinel_t, __iterator const& __x) | ||
| 350 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base>> | ||
| 351 | { | ||
| 352 | return ranges::__div_ceil(__x.__end_ - __x.__current_, __x.__stride_); | ||
| 353 | } | ||
| 354 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type | ||
| 355 | operator-(__iterator const& __x, default_sentinel_t __y) | ||
| 356 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base>> | ||
| 357 | { | ||
| 358 | return -(__y - __x); | ||
| 359 | } | ||
| 360 | |||
| 361 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_rvalue_reference_t<_Base> | ||
| 362 | iter_move(__iterator const& __it) noexcept(noexcept(ranges::iter_move(__it.__current_))) { | ||
| 363 | return ranges::iter_move(__it.__current_); | ||
| 364 | } | ||
| 365 | |||
| 366 | _LIBCPP_HIDE_FROM_ABI friend constexpr void | ||
| 367 | iter_swap(__iterator const& __x, | ||
| 368 | __iterator const& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) | ||
| 369 | requires indirectly_swappable<iterator_t<_Base>> | ||
| 370 | { | ||
| 371 | return ranges::iter_swap(__x.__current_, __y.__current_); | ||
| 372 | } | ||
| 373 | }; // class stride_view::__iterator | ||
| 374 | |||
| 375 | template <class _Tp> | ||
| 376 | inline constexpr bool enable_borrowed_range<stride_view<_Tp>> = enable_borrowed_range<_Tp>; | ||
| 377 | |||
| 378 | namespace views { | ||
| 379 | namespace __stride_view { | ||
| 380 | struct __fn { | ||
| 381 | // clang-format off | ||
| 382 | template <viewable_range _Range> | ||
| 383 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI | ||
| 384 | constexpr auto operator()(_Range&& __range, range_difference_t<_Range> __n) const | ||
| 385 | noexcept(noexcept(stride_view{std::forward<_Range>(__range), __n})) | ||
| 386 | -> decltype( stride_view{std::forward<_Range>(__range), __n}) | ||
| 387 | { return stride_view(std::forward<_Range>(__range), __n); } | ||
| 388 | // clang-format on | ||
| 389 | |||
| 390 | template <class _Np> | ||
| 391 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const { | ||
| 392 | return __pipeable(std::__bind_back(*this, std::forward<_Np>(__n))); | ||
| 393 | } | ||
| 394 | }; | ||
| 395 | } // namespace __stride_view | ||
| 396 | |||
| 397 | inline namespace __cpo { | ||
| 398 | inline constexpr auto stride = __stride_view::__fn{}; | ||
| 399 | } // namespace __cpo | ||
| 400 | } // namespace views | ||
| 401 | |||
| 402 | } // namespace ranges | ||
| 403 | |||
| 404 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 405 | |||
| 406 | _LIBCPP_END_NAMESPACE_STD | ||
| 407 | |||
| 408 | _LIBCPP_POP_MACROS | ||
| 409 | |||
| 410 | #endif // _LIBCPP___RANGES_STRIDE_VIEW_H | ||
lib/libcxx/include/__ranges/subrange.h+15-14| ... | @@ -49,10 +49,10 @@ | ... | @@ -49,10 +49,10 @@ |
| 49 | _LIBCPP_PUSH_MACROS | 49 | _LIBCPP_PUSH_MACROS |
| 50 | #include <__undef_macros> | 50 | #include <__undef_macros> |
| 51 | 51 | ||
| 52 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 53 | |||
| 54 | #if _LIBCPP_STD_VER >= 20 | 52 | #if _LIBCPP_STD_VER >= 20 |
| 55 | 53 | ||
| 54 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 55 | |||
| 56 | namespace ranges { | 56 | namespace ranges { |
| 57 | template <class _From, class _To> | 57 | template <class _From, class _To> |
| 58 | concept __uses_nonqualification_pointer_conversion = | 58 | concept __uses_nonqualification_pointer_conversion = |
| ... | @@ -131,7 +131,7 @@ public: | ... | @@ -131,7 +131,7 @@ public: |
| 131 | return _Pair(__begin_, __end_); | 131 | return _Pair(__begin_, __end_); |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() const | 134 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() const |
| 135 | requires copyable<_Iter> | 135 | requires copyable<_Iter> |
| 136 | { | 136 | { |
| 137 | return __begin_; | 137 | return __begin_; |
| ... | @@ -143,11 +143,11 @@ public: | ... | @@ -143,11 +143,11 @@ public: |
| 143 | return std::move(__begin_); | 143 | return std::move(__begin_); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | _LIBCPP_HIDE_FROM_ABI constexpr _Sent end() const { return __end_; } | 146 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Sent end() const { return __end_; } |
| 147 | 147 | ||
| 148 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __begin_ == __end_; } | 148 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __begin_ == __end_; } |
| 149 | 149 | ||
| 150 | _LIBCPP_HIDE_FROM_ABI constexpr make_unsigned_t<iter_difference_t<_Iter>> size() const | 150 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr make_unsigned_t<iter_difference_t<_Iter>> size() const |
| 151 | requires(_Kind == subrange_kind::sized) | 151 | requires(_Kind == subrange_kind::sized) |
| 152 | { | 152 | { |
| 153 | if constexpr (_StoreSize) | 153 | if constexpr (_StoreSize) |
| ... | @@ -201,11 +201,12 @@ template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent> | ... | @@ -201,11 +201,12 @@ template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent> |
| 201 | subrange(_Iter, _Sent, make_unsigned_t<iter_difference_t<_Iter>>) -> subrange<_Iter, _Sent, subrange_kind::sized>; | 201 | subrange(_Iter, _Sent, make_unsigned_t<iter_difference_t<_Iter>>) -> subrange<_Iter, _Sent, subrange_kind::sized>; |
| 202 | 202 | ||
| 203 | template <borrowed_range _Range> | 203 | template <borrowed_range _Range> |
| 204 | subrange(_Range&&) -> subrange<iterator_t<_Range>, | 204 | subrange(_Range&&) |
| 205 | sentinel_t<_Range>, | 205 | -> subrange<iterator_t<_Range>, |
| 206 | (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>) | 206 | sentinel_t<_Range>, |
| 207 | ? subrange_kind::sized | 207 | (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>) |
| 208 | : subrange_kind::unsized>; | 208 | ? subrange_kind::sized |
| 209 | : subrange_kind::unsized>; | ||
| 209 | 210 | ||
| 210 | template <borrowed_range _Range> | 211 | template <borrowed_range _Range> |
| 211 | subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>) | 212 | subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>) |
| ... | @@ -213,7 +214,7 @@ subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>) | ... | @@ -213,7 +214,7 @@ subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>) |
| 213 | 214 | ||
| 214 | template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> | 215 | template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> |
| 215 | requires((_Index == 0 && copyable<_Iter>) || _Index == 1) | 216 | requires((_Index == 0 && copyable<_Iter>) || _Index == 1) |
| 216 | _LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) { | 217 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) { |
| 217 | if constexpr (_Index == 0) | 218 | if constexpr (_Index == 0) |
| 218 | return __subrange.begin(); | 219 | return __subrange.begin(); |
| 219 | else | 220 | else |
| ... | @@ -222,7 +223,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __ | ... | @@ -222,7 +223,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __ |
| 222 | 223 | ||
| 223 | template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> | 224 | template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> |
| 224 | requires(_Index < 2) | 225 | requires(_Index < 2) |
| 225 | _LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) { | 226 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) { |
| 226 | if constexpr (_Index == 0) | 227 | if constexpr (_Index == 0) |
| 227 | return __subrange.begin(); | 228 | return __subrange.begin(); |
| 228 | else | 229 | else |
| ... | @@ -265,10 +266,10 @@ struct tuple_element<1, const ranges::subrange<_Ip, _Sp, _Kp>> { | ... | @@ -265,10 +266,10 @@ struct tuple_element<1, const ranges::subrange<_Ip, _Sp, _Kp>> { |
| 265 | using type _LIBCPP_NODEBUG = _Sp; | 266 | using type _LIBCPP_NODEBUG = _Sp; |
| 266 | }; | 267 | }; |
| 267 | 268 | ||
| 268 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 269 | |||
| 270 | _LIBCPP_END_NAMESPACE_STD | 269 | _LIBCPP_END_NAMESPACE_STD |
| 271 | 270 | ||
| 271 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 272 | |||
| 272 | _LIBCPP_POP_MACROS | 273 | _LIBCPP_POP_MACROS |
| 273 | 274 | ||
| 274 | #endif // _LIBCPP___RANGES_SUBRANGE_H | 275 | #endif // _LIBCPP___RANGES_SUBRANGE_H |
lib/libcxx/include/__ranges/take_view.h+1-2| ... | @@ -69,8 +69,7 @@ public: | ... | @@ -69,8 +69,7 @@ public: |
| 69 | requires default_initializable<_View> | 69 | requires default_initializable<_View> |
| 70 | = default; | 70 | = default; |
| 71 | 71 | ||
| 72 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 | 72 | _LIBCPP_HIDE_FROM_ABI constexpr explicit take_view(_View __base, range_difference_t<_View> __count) |
| 73 | take_view(_View __base, range_difference_t<_View> __count) | ||
| 74 | : __base_(std::move(__base)), __count_(__count) { | 73 | : __base_(std::move(__base)), __count_(__count) { |
| 75 | _LIBCPP_ASSERT_UNCATEGORIZED(__count >= 0, "count has to be greater than or equal to zero"); | 74 | _LIBCPP_ASSERT_UNCATEGORIZED(__count >= 0, "count has to be greater than or equal to zero"); |
| 76 | } | 75 | } |
lib/libcxx/include/__ranges/take_while_view.h+10-10| ... | @@ -46,7 +46,7 @@ namespace ranges { | ... | @@ -46,7 +46,7 @@ namespace ranges { |
| 46 | 46 | ||
| 47 | template <view _View, class _Pred> | 47 | template <view _View, class _Pred> |
| 48 | requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>> | 48 | requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>> |
| 49 | class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS take_while_view : public view_interface<take_while_view<_View, _Pred>> { | 49 | class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG take_while_view : public view_interface<take_while_view<_View, _Pred>> { |
| 50 | template <bool> | 50 | template <bool> |
| 51 | class __sentinel; | 51 | class __sentinel; |
| 52 | 52 | ||
| ... | @@ -58,38 +58,38 @@ public: | ... | @@ -58,38 +58,38 @@ public: |
| 58 | requires default_initializable<_View> && default_initializable<_Pred> | 58 | requires default_initializable<_View> && default_initializable<_Pred> |
| 59 | = default; | 59 | = default; |
| 60 | 60 | ||
| 61 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_while_view(_View __base, _Pred __pred) | 61 | _LIBCPP_HIDE_FROM_ABI constexpr explicit take_while_view(_View __base, _Pred __pred) |
| 62 | : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {} | 62 | : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {} |
| 63 | 63 | ||
| 64 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | 64 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& |
| 65 | requires copy_constructible<_View> | 65 | requires copy_constructible<_View> |
| 66 | { | 66 | { |
| 67 | return __base_; | 67 | return __base_; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | 70 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } |
| 71 | 71 | ||
| 72 | _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; } | 72 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; } |
| 73 | 73 | ||
| 74 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() | 74 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() |
| 75 | requires(!__simple_view<_View>) | 75 | requires(!__simple_view<_View>) |
| 76 | { | 76 | { |
| 77 | return ranges::begin(__base_); | 77 | return ranges::begin(__base_); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | 80 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const |
| 81 | requires range<const _View> && indirect_unary_predicate<const _Pred, iterator_t<const _View>> | 81 | requires range<const _View> && indirect_unary_predicate<const _Pred, iterator_t<const _View>> |
| 82 | { | 82 | { |
| 83 | return ranges::begin(__base_); | 83 | return ranges::begin(__base_); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() | 86 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() |
| 87 | requires(!__simple_view<_View>) | 87 | requires(!__simple_view<_View>) |
| 88 | { | 88 | { |
| 89 | return __sentinel</*_Const=*/false>(ranges::end(__base_), std::addressof(*__pred_)); | 89 | return __sentinel</*_Const=*/false>(ranges::end(__base_), std::addressof(*__pred_)); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | 92 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const |
| 93 | requires range<const _View> && indirect_unary_predicate<const _Pred, iterator_t<const _View>> | 93 | requires range<const _View> && indirect_unary_predicate<const _Pred, iterator_t<const _View>> |
| 94 | { | 94 | { |
| 95 | return __sentinel</*_Const=*/true>(ranges::end(__base_), std::addressof(*__pred_)); | 95 | return __sentinel</*_Const=*/true>(ranges::end(__base_), std::addressof(*__pred_)); |
| ... | @@ -120,7 +120,7 @@ public: | ... | @@ -120,7 +120,7 @@ public: |
| 120 | requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> | 120 | requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> |
| 121 | : __end_(std::move(__s.__end_)), __pred_(__s.__pred_) {} | 121 | : __end_(std::move(__s.__end_)), __pred_(__s.__pred_) {} |
| 122 | 122 | ||
| 123 | _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } | 123 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } |
| 124 | 124 | ||
| 125 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const iterator_t<_Base>& __x, const __sentinel& __y) { | 125 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const iterator_t<_Base>& __x, const __sentinel& __y) { |
| 126 | return __x == __y.__end_ || !std::invoke(*__y.__pred_, *__x); | 126 | return __x == __y.__end_ || !std::invoke(*__y.__pred_, *__x); |
lib/libcxx/include/__ranges/transform_view.h+35-24| ... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
| 16 | #include <__concepts/derived_from.h> | 16 | #include <__concepts/derived_from.h> |
| 17 | #include <__concepts/equality_comparable.h> | 17 | #include <__concepts/equality_comparable.h> |
| 18 | #include <__concepts/invocable.h> | 18 | #include <__concepts/invocable.h> |
| 19 | #include <__concepts/referenceable.h> | ||
| 19 | #include <__config> | 20 | #include <__config> |
| 20 | #include <__functional/bind_back.h> | 21 | #include <__functional/bind_back.h> |
| 21 | #include <__functional/invoke.h> | 22 | #include <__functional/invoke.h> |
| ... | @@ -37,7 +38,6 @@ | ... | @@ -37,7 +38,6 @@ |
| 37 | #include <__type_traits/is_nothrow_constructible.h> | 38 | #include <__type_traits/is_nothrow_constructible.h> |
| 38 | #include <__type_traits/is_object.h> | 39 | #include <__type_traits/is_object.h> |
| 39 | #include <__type_traits/is_reference.h> | 40 | #include <__type_traits/is_reference.h> |
| 40 | #include <__type_traits/is_referenceable.h> | ||
| 41 | #include <__type_traits/maybe_const.h> | 41 | #include <__type_traits/maybe_const.h> |
| 42 | #include <__type_traits/remove_cvref.h> | 42 | #include <__type_traits/remove_cvref.h> |
| 43 | #include <__utility/forward.h> | 43 | #include <__utility/forward.h> |
| ... | @@ -71,7 +71,7 @@ template <input_range _View, move_constructible _Fn> | ... | @@ -71,7 +71,7 @@ template <input_range _View, move_constructible _Fn> |
| 71 | template <input_range _View, copy_constructible _Fn> | 71 | template <input_range _View, copy_constructible _Fn> |
| 72 | # endif | 72 | # endif |
| 73 | requires __transform_view_constraints<_View, _Fn> | 73 | requires __transform_view_constraints<_View, _Fn> |
| 74 | class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS transform_view : public view_interface<transform_view<_View, _Fn>> { | 74 | class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG transform_view : public view_interface<transform_view<_View, _Fn>> { |
| 75 | template <bool> | 75 | template <bool> |
| 76 | class __iterator; | 76 | class __iterator; |
| 77 | template <bool> | 77 | template <bool> |
| ... | @@ -85,46 +85,56 @@ public: | ... | @@ -85,46 +85,56 @@ public: |
| 85 | requires default_initializable<_View> && default_initializable<_Fn> | 85 | requires default_initializable<_View> && default_initializable<_Fn> |
| 86 | = default; | 86 | = default; |
| 87 | 87 | ||
| 88 | _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 transform_view(_View __base, _Fn __func) | 88 | _LIBCPP_HIDE_FROM_ABI constexpr explicit transform_view(_View __base, _Fn __func) |
| 89 | : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {} | 89 | : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {} |
| 90 | 90 | ||
| 91 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | 91 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& |
| 92 | requires copy_constructible<_View> | 92 | requires copy_constructible<_View> |
| 93 | { | 93 | { |
| 94 | return __base_; | 94 | return __base_; |
| 95 | } | 95 | } |
| 96 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | ||
| 97 | 96 | ||
| 98 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> begin() { return __iterator<false>{*this, ranges::begin(__base_)}; } | 97 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } |
| 99 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> begin() const | 98 | |
| 99 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> begin() { | ||
| 100 | return __iterator<false>{*this, ranges::begin(__base_)}; | ||
| 101 | } | ||
| 102 | |||
| 103 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> begin() const | ||
| 100 | requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View> | 104 | requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View> |
| 101 | { | 105 | { |
| 102 | return __iterator<true>(*this, ranges::begin(__base_)); | 106 | return __iterator<true>(*this, ranges::begin(__base_)); |
| 103 | } | 107 | } |
| 104 | 108 | ||
| 105 | _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<false> end() { return __sentinel<false>(ranges::end(__base_)); } | 109 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<false> end() { |
| 106 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> end() | 110 | return __sentinel<false>(ranges::end(__base_)); |
| 111 | } | ||
| 112 | |||
| 113 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> end() | ||
| 107 | requires common_range<_View> | 114 | requires common_range<_View> |
| 108 | { | 115 | { |
| 109 | return __iterator<false>(*this, ranges::end(__base_)); | 116 | return __iterator<false>(*this, ranges::end(__base_)); |
| 110 | } | 117 | } |
| 111 | _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<true> end() const | 118 | |
| 119 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<true> end() const | ||
| 112 | requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View> | 120 | requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View> |
| 113 | { | 121 | { |
| 114 | return __sentinel<true>(ranges::end(__base_)); | 122 | return __sentinel<true>(ranges::end(__base_)); |
| 115 | } | 123 | } |
| 116 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> end() const | 124 | |
| 125 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> end() const | ||
| 117 | requires common_range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View> | 126 | requires common_range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View> |
| 118 | { | 127 | { |
| 119 | return __iterator<true>(*this, ranges::end(__base_)); | 128 | return __iterator<true>(*this, ranges::end(__base_)); |
| 120 | } | 129 | } |
| 121 | 130 | ||
| 122 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() | 131 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() |
| 123 | requires sized_range<_View> | 132 | requires sized_range<_View> |
| 124 | { | 133 | { |
| 125 | return ranges::size(__base_); | 134 | return ranges::size(__base_); |
| 126 | } | 135 | } |
| 127 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | 136 | |
| 137 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | ||
| 128 | requires sized_range<const _View> | 138 | requires sized_range<const _View> |
| 129 | { | 139 | { |
| 130 | return ranges::size(__base_); | 140 | return ranges::size(__base_); |
| ... | @@ -209,11 +219,11 @@ public: | ... | @@ -209,11 +219,11 @@ public: |
| 209 | requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> | 219 | requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> |
| 210 | : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {} | 220 | : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {} |
| 211 | 221 | ||
| 212 | _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; } | 222 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; } |
| 213 | 223 | ||
| 214 | _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); } | 224 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); } |
| 215 | 225 | ||
| 216 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const | 226 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const |
| 217 | noexcept(noexcept(std::invoke(*__parent_->__func_, *__current_))) { | 227 | noexcept(noexcept(std::invoke(*__parent_->__func_, *__current_))) { |
| 218 | return std::invoke(*__parent_->__func_, *__current_); | 228 | return std::invoke(*__parent_->__func_, *__current_); |
| 219 | } | 229 | } |
| ... | @@ -262,7 +272,7 @@ public: | ... | @@ -262,7 +272,7 @@ public: |
| 262 | return *this; | 272 | return *this; |
| 263 | } | 273 | } |
| 264 | 274 | ||
| 265 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const | 275 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const |
| 266 | noexcept(noexcept(std::invoke(*__parent_->__func_, __current_[__n]))) | 276 | noexcept(noexcept(std::invoke(*__parent_->__func_, __current_[__n]))) |
| 267 | requires random_access_range<_Base> | 277 | requires random_access_range<_Base> |
| 268 | { | 278 | { |
| ... | @@ -305,25 +315,26 @@ public: | ... | @@ -305,25 +315,26 @@ public: |
| 305 | return __x.__current_ <=> __y.__current_; | 315 | return __x.__current_ <=> __y.__current_; |
| 306 | } | 316 | } |
| 307 | 317 | ||
| 308 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n) | 318 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n) |
| 309 | requires random_access_range<_Base> | 319 | requires random_access_range<_Base> |
| 310 | { | 320 | { |
| 311 | return __iterator{*__i.__parent_, __i.__current_ + __n}; | 321 | return __iterator{*__i.__parent_, __i.__current_ + __n}; |
| 312 | } | 322 | } |
| 313 | 323 | ||
| 314 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i) | 324 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i) |
| 315 | requires random_access_range<_Base> | 325 | requires random_access_range<_Base> |
| 316 | { | 326 | { |
| 317 | return __iterator{*__i.__parent_, __i.__current_ + __n}; | 327 | return __iterator{*__i.__parent_, __i.__current_ + __n}; |
| 318 | } | 328 | } |
| 319 | 329 | ||
| 320 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n) | 330 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n) |
| 321 | requires random_access_range<_Base> | 331 | requires random_access_range<_Base> |
| 322 | { | 332 | { |
| 323 | return __iterator{*__i.__parent_, __i.__current_ - __n}; | 333 | return __iterator{*__i.__parent_, __i.__current_ - __n}; |
| 324 | } | 334 | } |
| 325 | 335 | ||
| 326 | _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) | 336 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type |
| 337 | operator-(const __iterator& __x, const __iterator& __y) | ||
| 327 | requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> | 338 | requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> |
| 328 | { | 339 | { |
| 329 | return __x.__current_ - __y.__current_; | 340 | return __x.__current_ - __y.__current_; |
| ... | @@ -361,7 +372,7 @@ public: | ... | @@ -361,7 +372,7 @@ public: |
| 361 | requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> | 372 | requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> |
| 362 | : __end_(std::move(__i.__end_)) {} | 373 | : __end_(std::move(__i.__end_)) {} |
| 363 | 374 | ||
| 364 | _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } | 375 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } |
| 365 | 376 | ||
| 366 | template <bool _OtherConst> | 377 | template <bool _OtherConst> |
| 367 | requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | 378 | requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| ... | @@ -371,14 +382,14 @@ public: | ... | @@ -371,14 +382,14 @@ public: |
| 371 | 382 | ||
| 372 | template <bool _OtherConst> | 383 | template <bool _OtherConst> |
| 373 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | 384 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| 374 | _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> | 385 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> |
| 375 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | 386 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { |
| 376 | return __x.__current_ - __y.__end_; | 387 | return __x.__current_ - __y.__end_; |
| 377 | } | 388 | } |
| 378 | 389 | ||
| 379 | template <bool _OtherConst> | 390 | template <bool _OtherConst> |
| 380 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | 391 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| 381 | _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> | 392 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> |
| 382 | operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { | 393 | operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { |
| 383 | return __x.__end_ - __y.__current_; | 394 | return __x.__end_ - __y.__current_; |
| 384 | } | 395 | } |
lib/libcxx/include/__ranges/view_interface.h+4-4| ... | @@ -30,10 +30,10 @@ | ... | @@ -30,10 +30,10 @@ |
| 30 | # pragma GCC system_header | 30 | # pragma GCC system_header |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 34 | |||
| 35 | #if _LIBCPP_STD_VER >= 20 | 33 | #if _LIBCPP_STD_VER >= 20 |
| 36 | 34 | ||
| 35 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 36 | |||
| 37 | namespace ranges { | 37 | namespace ranges { |
| 38 | 38 | ||
| 39 | template <class _Derived> | 39 | template <class _Derived> |
| ... | @@ -163,8 +163,8 @@ public: | ... | @@ -163,8 +163,8 @@ public: |
| 163 | 163 | ||
| 164 | } // namespace ranges | 164 | } // namespace ranges |
| 165 | 165 | ||
| 166 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 167 | |||
| 168 | _LIBCPP_END_NAMESPACE_STD | 166 | _LIBCPP_END_NAMESPACE_STD |
| 169 | 167 | ||
| 168 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 169 | |||
| 170 | #endif // _LIBCPP___RANGES_VIEW_INTERFACE_H | 170 | #endif // _LIBCPP___RANGES_VIEW_INTERFACE_H |
lib/libcxx/include/__ranges/views.h+2-1| ... | @@ -22,7 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -22,7 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | ||
| 23 | namespace ranges { | 23 | namespace ranges { |
| 24 | 24 | ||
| 25 | namespace views {} | 25 | namespace views { // NOLINT(libcpp-avoid-empty-namespaces) // This is needed to declare the alias below. |
| 26 | } // namespace views | ||
| 26 | 27 | ||
| 27 | } // namespace ranges | 28 | } // namespace ranges |
| 28 | 29 |
lib/libcxx/include/__ranges/zip_transform_view.h+18-17| ... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
| 17 | #include <__concepts/derived_from.h> | 17 | #include <__concepts/derived_from.h> |
| 18 | #include <__concepts/equality_comparable.h> | 18 | #include <__concepts/equality_comparable.h> |
| 19 | #include <__concepts/invocable.h> | 19 | #include <__concepts/invocable.h> |
| 20 | #include <__concepts/referenceable.h> | ||
| 20 | #include <__functional/invoke.h> | 21 | #include <__functional/invoke.h> |
| 21 | #include <__iterator/concepts.h> | 22 | #include <__iterator/concepts.h> |
| 22 | #include <__iterator/incrementable_traits.h> | 23 | #include <__iterator/incrementable_traits.h> |
| ... | @@ -33,7 +34,6 @@ | ... | @@ -33,7 +34,6 @@ |
| 33 | #include <__type_traits/invoke.h> | 34 | #include <__type_traits/invoke.h> |
| 34 | #include <__type_traits/is_object.h> | 35 | #include <__type_traits/is_object.h> |
| 35 | #include <__type_traits/is_reference.h> | 36 | #include <__type_traits/is_reference.h> |
| 36 | #include <__type_traits/is_referenceable.h> | ||
| 37 | #include <__type_traits/maybe_const.h> | 37 | #include <__type_traits/maybe_const.h> |
| 38 | #include <__type_traits/remove_cvref.h> | 38 | #include <__type_traits/remove_cvref.h> |
| 39 | #include <__utility/forward.h> | 39 | #include <__utility/forward.h> |
| ... | @@ -79,15 +79,15 @@ public: | ... | @@ -79,15 +79,15 @@ public: |
| 79 | _LIBCPP_HIDE_FROM_ABI constexpr explicit zip_transform_view(_Fn __fun, _Views... __views) | 79 | _LIBCPP_HIDE_FROM_ABI constexpr explicit zip_transform_view(_Fn __fun, _Views... __views) |
| 80 | : __zip_(std::move(__views)...), __fun_(in_place, std::move(__fun)) {} | 80 | : __zip_(std::move(__views)...), __fun_(in_place, std::move(__fun)) {} |
| 81 | 81 | ||
| 82 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { return __iterator<false>(*this, __zip_.begin()); } | 82 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { return __iterator<false>(*this, __zip_.begin()); } |
| 83 | 83 | ||
| 84 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | 84 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const |
| 85 | requires range<const _InnerView> && regular_invocable<const _Fn&, range_reference_t<const _Views>...> | 85 | requires range<const _InnerView> && regular_invocable<const _Fn&, range_reference_t<const _Views>...> |
| 86 | { | 86 | { |
| 87 | return __iterator<true>(*this, __zip_.begin()); | 87 | return __iterator<true>(*this, __zip_.begin()); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() { | 90 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() { |
| 91 | if constexpr (common_range<_InnerView>) { | 91 | if constexpr (common_range<_InnerView>) { |
| 92 | return __iterator<false>(*this, __zip_.end()); | 92 | return __iterator<false>(*this, __zip_.end()); |
| 93 | } else { | 93 | } else { |
| ... | @@ -95,7 +95,7 @@ public: | ... | @@ -95,7 +95,7 @@ public: |
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | 98 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const |
| 99 | requires range<const _InnerView> && regular_invocable<const _Fn&, range_reference_t<const _Views>...> | 99 | requires range<const _InnerView> && regular_invocable<const _Fn&, range_reference_t<const _Views>...> |
| 100 | { | 100 | { |
| 101 | if constexpr (common_range<const _InnerView>) { | 101 | if constexpr (common_range<const _InnerView>) { |
| ... | @@ -105,13 +105,13 @@ public: | ... | @@ -105,13 +105,13 @@ public: |
| 105 | } | 105 | } |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() | 108 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() |
| 109 | requires sized_range<_InnerView> | 109 | requires sized_range<_InnerView> |
| 110 | { | 110 | { |
| 111 | return __zip_.size(); | 111 | return __zip_.size(); |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | 114 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const |
| 115 | requires sized_range<const _InnerView> | 115 | requires sized_range<const _InnerView> |
| 116 | { | 116 | { |
| 117 | return __zip_.size(); | 117 | return __zip_.size(); |
| ... | @@ -184,7 +184,7 @@ public: | ... | @@ -184,7 +184,7 @@ public: |
| 184 | requires _Const && convertible_to<__ziperator<false>, __ziperator<_Const>> | 184 | requires _Const && convertible_to<__ziperator<false>, __ziperator<_Const>> |
| 185 | : __parent_(__i.__parent_), __inner_(std::move(__i.__inner_)) {} | 185 | : __parent_(__i.__parent_), __inner_(std::move(__i.__inner_)) {} |
| 186 | 186 | ||
| 187 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const | 187 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const |
| 188 | noexcept(noexcept(std::apply(__get_deref_and_invoke(), __zip_view_iterator_access::__get_underlying(__inner_)))) { | 188 | noexcept(noexcept(std::apply(__get_deref_and_invoke(), __zip_view_iterator_access::__get_underlying(__inner_)))) { |
| 189 | return std::apply(__get_deref_and_invoke(), __zip_view_iterator_access::__get_underlying(__inner_)); | 189 | return std::apply(__get_deref_and_invoke(), __zip_view_iterator_access::__get_underlying(__inner_)); |
| 190 | } | 190 | } |
| ... | @@ -233,7 +233,7 @@ public: | ... | @@ -233,7 +233,7 @@ public: |
| 233 | return *this; | 233 | return *this; |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const | 236 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const |
| 237 | requires random_access_range<_Base> | 237 | requires random_access_range<_Base> |
| 238 | { | 238 | { |
| 239 | return std::apply( | 239 | return std::apply( |
| ... | @@ -255,25 +255,26 @@ public: | ... | @@ -255,25 +255,26 @@ public: |
| 255 | return __x.__inner_ <=> __y.__inner_; | 255 | return __x.__inner_ <=> __y.__inner_; |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n) | 258 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n) |
| 259 | requires random_access_range<_Base> | 259 | requires random_access_range<_Base> |
| 260 | { | 260 | { |
| 261 | return __iterator(*__i.__parent_, __i.__inner_ + __n); | 261 | return __iterator(*__i.__parent_, __i.__inner_ + __n); |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i) | 264 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i) |
| 265 | requires random_access_range<_Base> | 265 | requires random_access_range<_Base> |
| 266 | { | 266 | { |
| 267 | return __iterator(*__i.__parent_, __i.__inner_ + __n); | 267 | return __iterator(*__i.__parent_, __i.__inner_ + __n); |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n) | 270 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n) |
| 271 | requires random_access_range<_Base> | 271 | requires random_access_range<_Base> |
| 272 | { | 272 | { |
| 273 | return __iterator(*__i.__parent_, __i.__inner_ - __n); | 273 | return __iterator(*__i.__parent_, __i.__inner_ - __n); |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) | 276 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type |
| 277 | operator-(const __iterator& __x, const __iterator& __y) | ||
| 277 | requires sized_sentinel_for<__ziperator<_Const>, __ziperator<_Const>> | 278 | requires sized_sentinel_for<__ziperator<_Const>, __ziperator<_Const>> |
| 278 | { | 279 | { |
| 279 | return __x.__inner_ - __y.__inner_; | 280 | return __x.__inner_ - __y.__inner_; |
| ... | @@ -307,14 +308,14 @@ public: | ... | @@ -307,14 +308,14 @@ public: |
| 307 | 308 | ||
| 308 | template <bool _OtherConst> | 309 | template <bool _OtherConst> |
| 309 | requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>> | 310 | requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>> |
| 310 | _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>> | 311 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>> |
| 311 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | 312 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { |
| 312 | return __x.__inner_ - __y.__inner_; | 313 | return __x.__inner_ - __y.__inner_; |
| 313 | } | 314 | } |
| 314 | 315 | ||
| 315 | template <bool _OtherConst> | 316 | template <bool _OtherConst> |
| 316 | requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>> | 317 | requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>> |
| 317 | _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>> | 318 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>> |
| 318 | operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { | 319 | operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { |
| 319 | return __x.__inner_ - __y.__inner_; | 320 | return __x.__inner_ - __y.__inner_; |
| 320 | } | 321 | } |
| ... | @@ -327,14 +328,14 @@ struct __fn { | ... | @@ -327,14 +328,14 @@ struct __fn { |
| 327 | template <class _Fn> | 328 | template <class _Fn> |
| 328 | requires(move_constructible<decay_t<_Fn>> && regular_invocable<decay_t<_Fn>&> && | 329 | requires(move_constructible<decay_t<_Fn>> && regular_invocable<decay_t<_Fn>&> && |
| 329 | is_object_v<invoke_result_t<decay_t<_Fn>&>>) | 330 | is_object_v<invoke_result_t<decay_t<_Fn>&>>) |
| 330 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&&) const | 331 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&&) const |
| 331 | noexcept(noexcept(auto(views::empty<decay_t<invoke_result_t<decay_t<_Fn>&>>>))) { | 332 | noexcept(noexcept(auto(views::empty<decay_t<invoke_result_t<decay_t<_Fn>&>>>))) { |
| 332 | return views::empty<decay_t<invoke_result_t<decay_t<_Fn>&>>>; | 333 | return views::empty<decay_t<invoke_result_t<decay_t<_Fn>&>>>; |
| 333 | } | 334 | } |
| 334 | 335 | ||
| 335 | template <class _Fn, class... _Ranges> | 336 | template <class _Fn, class... _Ranges> |
| 336 | requires(sizeof...(_Ranges) > 0) | 337 | requires(sizeof...(_Ranges) > 0) |
| 337 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __fun, _Ranges&&... __rs) const | 338 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __fun, _Ranges&&... __rs) const |
| 338 | noexcept(noexcept(zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...))) | 339 | noexcept(noexcept(zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...))) |
| 339 | -> decltype(zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...)) { | 340 | -> decltype(zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...)) { |
| 340 | return zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...); | 341 | return zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...); |
lib/libcxx/include/__ranges/zip_view.h+18-15| ... | @@ -134,19 +134,19 @@ public: | ... | @@ -134,19 +134,19 @@ public: |
| 134 | 134 | ||
| 135 | _LIBCPP_HIDE_FROM_ABI constexpr explicit zip_view(_Views... __views) : __views_(std::move(__views)...) {} | 135 | _LIBCPP_HIDE_FROM_ABI constexpr explicit zip_view(_Views... __views) : __views_(std::move(__views)...) {} |
| 136 | 136 | ||
| 137 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() | 137 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() |
| 138 | requires(!(__simple_view<_Views> && ...)) | 138 | requires(!(__simple_view<_Views> && ...)) |
| 139 | { | 139 | { |
| 140 | return __iterator<false>(std::__tuple_transform(ranges::begin, __views_)); | 140 | return __iterator<false>(std::__tuple_transform(ranges::begin, __views_)); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | 143 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const |
| 144 | requires(range<const _Views> && ...) | 144 | requires(range<const _Views> && ...) |
| 145 | { | 145 | { |
| 146 | return __iterator<true>(std::__tuple_transform(ranges::begin, __views_)); | 146 | return __iterator<true>(std::__tuple_transform(ranges::begin, __views_)); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() | 149 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() |
| 150 | requires(!(__simple_view<_Views> && ...)) | 150 | requires(!(__simple_view<_Views> && ...)) |
| 151 | { | 151 | { |
| 152 | if constexpr (!__zip_is_common<_Views...>) { | 152 | if constexpr (!__zip_is_common<_Views...>) { |
| ... | @@ -158,7 +158,7 @@ public: | ... | @@ -158,7 +158,7 @@ public: |
| 158 | } | 158 | } |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | 161 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const |
| 162 | requires(range<const _Views> && ...) | 162 | requires(range<const _Views> && ...) |
| 163 | { | 163 | { |
| 164 | if constexpr (!__zip_is_common<const _Views...>) { | 164 | if constexpr (!__zip_is_common<const _Views...>) { |
| ... | @@ -170,7 +170,7 @@ public: | ... | @@ -170,7 +170,7 @@ public: |
| 170 | } | 170 | } |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() | 173 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() |
| 174 | requires(sized_range<_Views> && ...) | 174 | requires(sized_range<_Views> && ...) |
| 175 | { | 175 | { |
| 176 | return std::apply( | 176 | return std::apply( |
| ... | @@ -181,7 +181,7 @@ public: | ... | @@ -181,7 +181,7 @@ public: |
| 181 | std::__tuple_transform(ranges::size, __views_)); | 181 | std::__tuple_transform(ranges::size, __views_)); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | 184 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const |
| 185 | requires(sized_range<const _Views> && ...) | 185 | requires(sized_range<const _Views> && ...) |
| 186 | { | 186 | { |
| 187 | return std::apply( | 187 | return std::apply( |
| ... | @@ -267,7 +267,7 @@ public: | ... | @@ -267,7 +267,7 @@ public: |
| 267 | requires _Const && (convertible_to<iterator_t<_Views>, iterator_t<__maybe_const<_Const, _Views>>> && ...) | 267 | requires _Const && (convertible_to<iterator_t<_Views>, iterator_t<__maybe_const<_Const, _Views>>> && ...) |
| 268 | : __current_(std::move(__i.__current_)) {} | 268 | : __current_(std::move(__i.__current_)) {} |
| 269 | 269 | ||
| 270 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const { | 270 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const { |
| 271 | return std::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_); | 271 | return std::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_); |
| 272 | } | 272 | } |
| 273 | 273 | ||
| ... | @@ -315,7 +315,7 @@ public: | ... | @@ -315,7 +315,7 @@ public: |
| 315 | return *this; | 315 | return *this; |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const | 318 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const |
| 319 | requires __zip_all_random_access<_Const, _Views...> | 319 | requires __zip_all_random_access<_Const, _Views...> |
| 320 | { | 320 | { |
| 321 | return std::__tuple_transform( | 321 | return std::__tuple_transform( |
| ... | @@ -338,7 +338,7 @@ public: | ... | @@ -338,7 +338,7 @@ public: |
| 338 | return __x.__current_ <=> __y.__current_; | 338 | return __x.__current_ <=> __y.__current_; |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n) | 341 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n) |
| 342 | requires __zip_all_random_access<_Const, _Views...> | 342 | requires __zip_all_random_access<_Const, _Views...> |
| 343 | { | 343 | { |
| 344 | auto __r = __i; | 344 | auto __r = __i; |
| ... | @@ -346,13 +346,13 @@ public: | ... | @@ -346,13 +346,13 @@ public: |
| 346 | return __r; | 346 | return __r; |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i) | 349 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i) |
| 350 | requires __zip_all_random_access<_Const, _Views...> | 350 | requires __zip_all_random_access<_Const, _Views...> |
| 351 | { | 351 | { |
| 352 | return __i + __n; | 352 | return __i + __n; |
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n) | 355 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n) |
| 356 | requires __zip_all_random_access<_Const, _Views...> | 356 | requires __zip_all_random_access<_Const, _Views...> |
| 357 | { | 357 | { |
| 358 | auto __r = __i; | 358 | auto __r = __i; |
| ... | @@ -360,7 +360,8 @@ public: | ... | @@ -360,7 +360,8 @@ public: |
| 360 | return __r; | 360 | return __r; |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) | 363 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type |
| 364 | operator-(const __iterator& __x, const __iterator& __y) | ||
| 364 | requires(sized_sentinel_for<iterator_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_Const, _Views>>> && | 365 | requires(sized_sentinel_for<iterator_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_Const, _Views>>> && |
| 365 | ...) | 366 | ...) |
| 366 | { | 367 | { |
| ... | @@ -374,7 +375,7 @@ public: | ... | @@ -374,7 +375,7 @@ public: |
| 374 | __diffs); | 375 | __diffs); |
| 375 | } | 376 | } |
| 376 | 377 | ||
| 377 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto iter_move(const __iterator& __i) noexcept( | 378 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto iter_move(const __iterator& __i) noexcept( |
| 378 | (noexcept(ranges::iter_move(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) && ...) && | 379 | (noexcept(ranges::iter_move(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) && ...) && |
| 379 | (is_nothrow_move_constructible_v<range_rvalue_reference_t<__maybe_const<_Const, _Views>>> && ...)) { | 380 | (is_nothrow_move_constructible_v<range_rvalue_reference_t<__maybe_const<_Const, _Views>>> && ...)) { |
| 380 | return std::__tuple_transform(ranges::iter_move, __i.__current_); | 381 | return std::__tuple_transform(ranges::iter_move, __i.__current_); |
| ... | @@ -426,6 +427,7 @@ public: | ... | @@ -426,6 +427,7 @@ public: |
| 426 | requires( | 427 | requires( |
| 427 | sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_OtherConst, _Views>>> && | 428 | sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_OtherConst, _Views>>> && |
| 428 | ...) | 429 | ...) |
| 430 | [[nodiscard]] | ||
| 429 | _LIBCPP_HIDE_FROM_ABI friend constexpr common_type_t<range_difference_t<__maybe_const<_OtherConst, _Views>>...> | 431 | _LIBCPP_HIDE_FROM_ABI friend constexpr common_type_t<range_difference_t<__maybe_const<_OtherConst, _Views>>...> |
| 430 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | 432 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { |
| 431 | const auto __diffs = ranges::__tuple_zip_transform(minus<>(), __iter_current(__x), __y.__end_); | 433 | const auto __diffs = ranges::__tuple_zip_transform(minus<>(), __iter_current(__x), __y.__end_); |
| ... | @@ -443,6 +445,7 @@ public: | ... | @@ -443,6 +445,7 @@ public: |
| 443 | requires( | 445 | requires( |
| 444 | sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_OtherConst, _Views>>> && | 446 | sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_OtherConst, _Views>>> && |
| 445 | ...) | 447 | ...) |
| 448 | [[nodiscard]] | ||
| 446 | _LIBCPP_HIDE_FROM_ABI friend constexpr common_type_t<range_difference_t<__maybe_const<_OtherConst, _Views>>...> | 449 | _LIBCPP_HIDE_FROM_ABI friend constexpr common_type_t<range_difference_t<__maybe_const<_OtherConst, _Views>>...> |
| 447 | operator-(const __sentinel& __y, const __iterator<_OtherConst>& __x) { | 450 | operator-(const __sentinel& __y, const __iterator<_OtherConst>& __x) { |
| 448 | return -(__x - __y); | 451 | return -(__x - __y); |
| ... | @@ -456,10 +459,10 @@ namespace views { | ... | @@ -456,10 +459,10 @@ namespace views { |
| 456 | namespace __zip { | 459 | namespace __zip { |
| 457 | 460 | ||
| 458 | struct __fn { | 461 | struct __fn { |
| 459 | _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()() noexcept { return empty_view<tuple<>>{}; } | 462 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()() noexcept { return empty_view<tuple<>>{}; } |
| 460 | 463 | ||
| 461 | template <class... _Ranges> | 464 | template <class... _Ranges> |
| 462 | _LIBCPP_HIDE_FROM_ABI static constexpr auto | 465 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto |
| 463 | operator()(_Ranges&&... __rs) noexcept(noexcept(zip_view<all_t<_Ranges&&>...>(std::forward<_Ranges>(__rs)...))) | 466 | operator()(_Ranges&&... __rs) noexcept(noexcept(zip_view<all_t<_Ranges&&>...>(std::forward<_Ranges>(__rs)...))) |
| 464 | -> decltype(zip_view<all_t<_Ranges&&>...>(std::forward<_Ranges>(__rs)...)) { | 467 | -> decltype(zip_view<all_t<_Ranges&&>...>(std::forward<_Ranges>(__rs)...)) { |
| 465 | return zip_view<all_t<_Ranges>...>(std::forward<_Ranges>(__rs)...); | 468 | return zip_view<all_t<_Ranges>...>(std::forward<_Ranges>(__rs)...); |
lib/libcxx/include/__split_buffer+131-16| ... | @@ -25,6 +25,7 @@ | ... | @@ -25,6 +25,7 @@ |
| 25 | #include <__memory/compressed_pair.h> | 25 | #include <__memory/compressed_pair.h> |
| 26 | #include <__memory/pointer_traits.h> | 26 | #include <__memory/pointer_traits.h> |
| 27 | #include <__memory/swap_allocator.h> | 27 | #include <__memory/swap_allocator.h> |
| 28 | #include <__memory/uninitialized_algorithms.h> | ||
| 28 | #include <__type_traits/conditional.h> | 29 | #include <__type_traits/conditional.h> |
| 29 | #include <__type_traits/enable_if.h> | 30 | #include <__type_traits/enable_if.h> |
| 30 | #include <__type_traits/integral_constant.h> | 31 | #include <__type_traits/integral_constant.h> |
| ... | @@ -156,10 +157,8 @@ public: | ... | @@ -156,10 +157,8 @@ public: |
| 156 | 157 | ||
| 157 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT { return *(__end_ - 1); } | 158 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT { return *(__end_ - 1); } |
| 158 | 159 | ||
| 159 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_without_allocator( | 160 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void |
| 160 | __split_buffer_pointer_layout<__split_buffer<value_type, allocator_type, __split_buffer_pointer_layout>, | 161 | __swap_without_allocator(__split_buffer_pointer_layout& __other) _NOEXCEPT { |
| 161 | value_type, | ||
| 162 | allocator_type>& __other) _NOEXCEPT { | ||
| 163 | std::swap(__front_cap_, __other.__front_cap_); | 162 | std::swap(__front_cap_, __other.__front_cap_); |
| 164 | std::swap(__begin_, __other.__begin_); | 163 | std::swap(__begin_, __other.__begin_); |
| 165 | std::swap(__back_cap_, __other.__back_cap_); | 164 | std::swap(__back_cap_, __other.__back_cap_); |
| ... | @@ -190,6 +189,65 @@ public: | ... | @@ -190,6 +189,65 @@ public: |
| 190 | __back_cap_ = __other.__back_cap_; | 189 | __back_cap_ = __other.__back_cap_; |
| 191 | } | 190 | } |
| 192 | 191 | ||
| 192 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | ||
| 193 | __swap_layouts(pointer& __begin, pointer& __end, pointer& __back_capacity) { | ||
| 194 | using std::swap; | ||
| 195 | swap(__begin_, __begin); | ||
| 196 | swap(__end_, __end); | ||
| 197 | swap(__back_cap_, __back_capacity); | ||
| 198 | } | ||
| 199 | |||
| 200 | /// Relocates the objects in the range `[__first, __last)` to the front of the buffer, then swaps | ||
| 201 | /// `__first`, `__last`, and `__capacity` with `__begin_`, `__end_`, and `__back_cap_`, | ||
| 202 | /// respectively. | ||
| 203 | /// | ||
| 204 | /// Precondition: `__front_spare() == __last - __first`. | ||
| 205 | /// Exceptions: This function has a strong exception guarantee. | ||
| 206 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | ||
| 207 | __relocate(pointer& __first, pointer& __last, pointer& __capacity) { | ||
| 208 | auto __size = __last - __first; | ||
| 209 | auto __new_begin = __begin_ - __size; | ||
| 210 | std::__uninitialized_allocator_relocate( | ||
| 211 | __alloc_, std::__to_address(__first), std::__to_address(__last), std::__to_address(__new_begin)); | ||
| 212 | __begin_ = __new_begin; | ||
| 213 | __last = __first; | ||
| 214 | |||
| 215 | __swap_layouts(__first, __last, __capacity); | ||
| 216 | __front_cap_ = __begin_; | ||
| 217 | } | ||
| 218 | |||
| 219 | /// Relocates the objects in the range `[__first, __pivot)` to the front of the buffer, the | ||
| 220 | /// objects in `[__pivot, __last)` into the back of the buffer, then swaps `__first`, `__last`, | ||
| 221 | /// and `__capacity` with `__begin_`, `__end_`, and `__back_cap_`, respectively. | ||
| 222 | /// | ||
| 223 | /// Preconditions: | ||
| 224 | /// * `__front_spare() == __pivot - __first` | ||
| 225 | /// * `__back_spare() == __last - __pivot` | ||
| 226 | /// Exceptions: This function has a strong exception guarantee if `__first == __pivot` or | ||
| 227 | /// `__last == __pivot`. | ||
| 228 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer | ||
| 229 | __relocate_with_pivot(pointer __pivot, pointer& __first, pointer& __last, pointer& __capacity) { | ||
| 230 | pointer __result = __begin_; | ||
| 231 | |||
| 232 | // Relocate [__p, __last) first to avoid having a hole in [__first, __last) | ||
| 233 | // in case something in [__first, __p) throws. | ||
| 234 | std::__uninitialized_allocator_relocate( | ||
| 235 | __alloc_, std::__to_address(__pivot), std::__to_address(__last), std::__to_address(__end_)); | ||
| 236 | auto __relocated_so_far = __last - __pivot; | ||
| 237 | __end_ += __relocated_so_far; | ||
| 238 | __last = __pivot; // The objects in [__p, __last) have been destroyed by relocating them. | ||
| 239 | |||
| 240 | auto __new_begin = __begin_ - (__pivot - __first); | ||
| 241 | std::__uninitialized_allocator_relocate( | ||
| 242 | __alloc_, std::__to_address(__first), std::__to_address(__pivot), std::__to_address(__new_begin)); | ||
| 243 | __begin_ = __new_begin; | ||
| 244 | |||
| 245 | __last = __first; // All the objects have been destroyed by relocating them. | ||
| 246 | __swap_layouts(__first, __last, __capacity); | ||
| 247 | __front_cap_ = __begin_; | ||
| 248 | return __result; | ||
| 249 | } | ||
| 250 | |||
| 193 | private: | 251 | private: |
| 194 | pointer __front_cap_ = nullptr; | 252 | pointer __front_cap_ = nullptr; |
| 195 | pointer __begin_ = nullptr; | 253 | pointer __begin_ = nullptr; |
| ... | @@ -263,25 +321,19 @@ public: | ... | @@ -263,25 +321,19 @@ public: |
| 263 | 321 | ||
| 264 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | 322 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void |
| 265 | __set_valid_range(pointer __new_begin, pointer __new_end) _NOEXCEPT { | 323 | __set_valid_range(pointer __new_begin, pointer __new_end) _NOEXCEPT { |
| 266 | // Size-based __split_buffers track their size directly: we need to explicitly update the size | ||
| 267 | // when the front is adjusted. | ||
| 268 | __size_ -= __new_begin - __begin_; | ||
| 269 | __begin_ = __new_begin; | 324 | __begin_ = __new_begin; |
| 270 | __set_sentinel(__new_end); | 325 | __set_sentinel(__new_end); |
| 271 | } | 326 | } |
| 272 | 327 | ||
| 273 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | 328 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void |
| 274 | __set_valid_range(pointer __new_begin, size_type __new_size) _NOEXCEPT { | 329 | __set_valid_range(pointer __new_begin, size_type __new_size) _NOEXCEPT { |
| 275 | // Size-based __split_buffers track their size directly: we need to explicitly update the size | ||
| 276 | // when the front is adjusted. | ||
| 277 | __size_ -= __new_begin - __begin_; | ||
| 278 | __begin_ = __new_begin; | 330 | __begin_ = __new_begin; |
| 279 | __set_sentinel(__new_size); | 331 | __set_sentinel(__new_size); |
| 280 | } | 332 | } |
| 281 | 333 | ||
| 282 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_sentinel(pointer __new_end) _NOEXCEPT { | 334 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_sentinel(pointer __new_end) _NOEXCEPT { |
| 283 | _LIBCPP_ASSERT_INTERNAL(__front_cap_ <= __new_end, "__new_end cannot precede __front_cap_"); | 335 | _LIBCPP_ASSERT_INTERNAL(__front_cap_ <= __new_end, "__new_end cannot precede __front_cap_"); |
| 284 | __size_ += __new_end - end(); | 336 | __size_ = __new_end - __begin_; |
| 285 | } | 337 | } |
| 286 | 338 | ||
| 287 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_sentinel(size_type __new_size) _NOEXCEPT { | 339 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_sentinel(size_type __new_size) _NOEXCEPT { |
| ... | @@ -312,10 +364,8 @@ public: | ... | @@ -312,10 +364,8 @@ public: |
| 312 | return __begin_[__size_ - 1]; | 364 | return __begin_[__size_ - 1]; |
| 313 | } | 365 | } |
| 314 | 366 | ||
| 315 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_without_allocator( | 367 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void |
| 316 | __split_buffer_pointer_layout<__split_buffer<value_type, allocator_type, __split_buffer_pointer_layout>, | 368 | __swap_without_allocator(__split_buffer_size_layout& __other) _NOEXCEPT { |
| 317 | value_type, | ||
| 318 | allocator_type>& __other) _NOEXCEPT { | ||
| 319 | std::swap(__front_cap_, __other.__front_cap_); | 369 | std::swap(__front_cap_, __other.__front_cap_); |
| 320 | std::swap(__begin_, __other.__begin_); | 370 | std::swap(__begin_, __other.__begin_); |
| 321 | std::swap(__cap_, __other.__cap_); | 371 | std::swap(__cap_, __other.__cap_); |
| ... | @@ -346,6 +396,68 @@ public: | ... | @@ -346,6 +396,68 @@ public: |
| 346 | __size_ = __other.__size_; | 396 | __size_ = __other.__size_; |
| 347 | } | 397 | } |
| 348 | 398 | ||
| 399 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | ||
| 400 | __swap_layouts(pointer& __begin, size_type& __size, size_type& __capacity) { | ||
| 401 | using std::swap; | ||
| 402 | swap(__begin_, __begin); | ||
| 403 | swap(__size_, __size); | ||
| 404 | swap(__cap_, __capacity); | ||
| 405 | } | ||
| 406 | |||
| 407 | /// Relocates the objects in the range `[__first, __first + __n)` to the front of the buffer, then | ||
| 408 | /// swaps `__first`, `__n`, and `__capacity` with `__begin_`, `__size_`, and `__capacity_`, | ||
| 409 | /// respectively. | ||
| 410 | /// | ||
| 411 | /// Precondition: `__front_spare() == __n`. | ||
| 412 | /// Exceptions: This function has a strong exception guarantee. | ||
| 413 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | ||
| 414 | __relocate(pointer& __first, size_type& __n, size_type& __capacity) { | ||
| 415 | auto __new_begin = __begin_ - __n; | ||
| 416 | auto __last = __first + __n; | ||
| 417 | std::__uninitialized_allocator_relocate( | ||
| 418 | __alloc_, std::__to_address(__first), std::__to_address(__last), std::__to_address(__new_begin)); | ||
| 419 | __set_valid_range(__new_begin, end()); | ||
| 420 | __n = 0; | ||
| 421 | |||
| 422 | __swap_layouts(__first, __n, __capacity); | ||
| 423 | __front_cap_ = __begin_; | ||
| 424 | } | ||
| 425 | |||
| 426 | /// Relocates the objects in the range `[__first, __pivot)` to the front of the buffer, the | ||
| 427 | /// objects in `[__pivot, __first + __n)` to the back of the buffer, then swaps `__first`, `__n`, | ||
| 428 | /// and `__capacity` with `__begin_`, `__size_`, and `__capacity_`, respectively. | ||
| 429 | /// | ||
| 430 | /// Preconditions: | ||
| 431 | /// * `__front_spare() == __pivot - __first` | ||
| 432 | /// * `__back_spare() == __last - __pivot` | ||
| 433 | /// Exceptions: This function has a strong exception guarantee if `__first == __pivot` or | ||
| 434 | /// `__first + __n == __pivot`. | ||
| 435 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer | ||
| 436 | __relocate_with_pivot(pointer __pivot, pointer& __first, size_type& __n, size_type& __capacity) { | ||
| 437 | pointer __result = __begin_; | ||
| 438 | pointer __last = __first + __n; | ||
| 439 | |||
| 440 | // We relocate elements in reverse order to ensure that a throwing relocation operation leaves the | ||
| 441 | // buffer in a valid state. | ||
| 442 | std::__uninitialized_allocator_relocate( | ||
| 443 | __alloc_, std::__to_address(__pivot), std::__to_address(__last), std::__to_address(end())); | ||
| 444 | |||
| 445 | auto const __relocated_so_far = __last - __pivot; | ||
| 446 | __size_ += __relocated_so_far; | ||
| 447 | __n -= __relocated_so_far; // The objects in [__pivot, __last) have been destroyed by relocating them. | ||
| 448 | |||
| 449 | auto __new_begin = __begin_ - __n; | ||
| 450 | std::__uninitialized_allocator_relocate( | ||
| 451 | __alloc_, std::__to_address(__first), std::__to_address(__pivot), std::__to_address(__new_begin)); | ||
| 452 | __begin_ = __new_begin; | ||
| 453 | __size_ += __n; | ||
| 454 | __n = 0; // All the objects have been destroyed by relocating them. | ||
| 455 | |||
| 456 | __swap_layouts(__first, __n, __capacity); | ||
| 457 | __front_cap_ = __begin_; | ||
| 458 | return __result; | ||
| 459 | } | ||
| 460 | |||
| 349 | private: | 461 | private: |
| 350 | pointer __front_cap_ = nullptr; | 462 | pointer __front_cap_ = nullptr; |
| 351 | pointer __begin_ = nullptr; | 463 | pointer __begin_ = nullptr; |
| ... | @@ -452,11 +564,14 @@ public: | ... | @@ -452,11 +564,14 @@ public: |
| 452 | using __base_type::__get_allocator; | 564 | using __base_type::__get_allocator; |
| 453 | using __base_type::__raw_capacity; | 565 | using __base_type::__raw_capacity; |
| 454 | using __base_type::__raw_sentinel; | 566 | using __base_type::__raw_sentinel; |
| 567 | using __base_type::__relocate; | ||
| 568 | using __base_type::__relocate_with_pivot; | ||
| 455 | using __base_type::__reset; | 569 | using __base_type::__reset; |
| 456 | using __base_type::__set_capacity; | 570 | using __base_type::__set_capacity; |
| 457 | using __base_type::__set_data; | 571 | using __base_type::__set_data; |
| 458 | using __base_type::__set_sentinel; | 572 | using __base_type::__set_sentinel; |
| 459 | using __base_type::__set_valid_range; | 573 | using __base_type::__set_valid_range; |
| 574 | using __base_type::__swap_layouts; | ||
| 460 | 575 | ||
| 461 | using typename __base_type::__alloc_traits; | 576 | using typename __base_type::__alloc_traits; |
| 462 | using typename __base_type::allocator_type; | 577 | using typename __base_type::allocator_type; |
| ... | @@ -585,7 +700,7 @@ public: | ... | @@ -585,7 +700,7 @@ public: |
| 585 | 700 | ||
| 586 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | 701 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void |
| 587 | __swap_without_allocator(__split_buffer<value_type, allocator_type, _Layout>& __other) _NOEXCEPT { | 702 | __swap_without_allocator(__split_buffer<value_type, allocator_type, _Layout>& __other) _NOEXCEPT { |
| 588 | __base_type::__swap_without_allocator(__other); | 703 | __base_type::__swap_without_allocator(static_cast<__base_type&>(__other)); |
| 589 | } | 704 | } |
| 590 | 705 | ||
| 591 | private: | 706 | private: |
lib/libcxx/include/__stop_token/atomic_unique_lock.h+8-7| ... | @@ -10,25 +10,26 @@ | ... | @@ -10,25 +10,26 @@ |
| 10 | #ifndef _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H | 10 | #ifndef _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H |
| 11 | #define _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H | 11 | #define _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H |
| 12 | 12 | ||
| 13 | #include <__bit/popcount.h> | 13 | #include <__atomic/atomic.h> |
| 14 | #include <__atomic/memory_order.h> | ||
| 15 | #include <__bit/has_single_bit.h> | ||
| 14 | #include <__config> | 16 | #include <__config> |
| 15 | #include <atomic> | ||
| 16 | 17 | ||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 19 | #endif | 20 | #endif |
| 20 | 21 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 20 | 22 | #if _LIBCPP_STD_VER >= 20 |
| 24 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 25 | // This class implements an RAII unique_lock without a mutex. | 26 | // This class implements an RAII unique_lock without a mutex. |
| 26 | // It uses std::atomic<State>, | 27 | // It uses std::atomic<State>, |
| 27 | // where State contains a lock bit and might contain other data, | 28 | // where State contains a lock bit and might contain other data, |
| 28 | // and LockedBit is the value of State when the lock bit is set, e.g 1 << 2 | 29 | // and LockedBit is the value of State when the lock bit is set, e.g 1 << 2 |
| 29 | template <class _State, _State _LockedBit> | 30 | template <class _State, _State _LockedBit> |
| 30 | class __atomic_unique_lock { | 31 | class __atomic_unique_lock { |
| 31 | static_assert(std::__popcount(static_cast<unsigned long long>(_LockedBit)) == 1, | 32 | static_assert(std::has_single_bit(static_cast<unsigned long long>(_LockedBit)), |
| 32 | "LockedBit must be an integer where only one bit is set"); | 33 | "LockedBit must be an integer where only one bit is set"); |
| 33 | 34 | ||
| 34 | std::atomic<_State>& __state_; | 35 | std::atomic<_State>& __state_; |
| ... | @@ -133,8 +134,8 @@ private: | ... | @@ -133,8 +134,8 @@ private: |
| 133 | _LIBCPP_HIDE_FROM_ABI static constexpr auto __set_locked_bit = [](_State __state) { return __state | _LockedBit; }; | 134 | _LIBCPP_HIDE_FROM_ABI static constexpr auto __set_locked_bit = [](_State __state) { return __state | _LockedBit; }; |
| 134 | }; | 135 | }; |
| 135 | 136 | ||
| 136 | #endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | ||
| 137 | |||
| 138 | _LIBCPP_END_NAMESPACE_STD | 137 | _LIBCPP_END_NAMESPACE_STD |
| 139 | 138 | ||
| 139 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 140 | |||
| 140 | #endif // _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H | 141 | #endif // _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H |
lib/libcxx/include/__stop_token/intrusive_list_view.h+4-4| ... | @@ -17,10 +17,10 @@ | ... | @@ -17,10 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 23 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <class _Derived> | 24 | template <class _Derived> |
| 25 | struct __intrusive_node_base { | 25 | struct __intrusive_node_base { |
| 26 | _Derived* __next_ = nullptr; | 26 | _Derived* __next_ = nullptr; |
| ... | @@ -78,8 +78,8 @@ private: | ... | @@ -78,8 +78,8 @@ private: |
| 78 | _Node* __head_ = nullptr; | 78 | _Node* __head_ = nullptr; |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 82 | |||
| 83 | _LIBCPP_END_NAMESPACE_STD | 81 | _LIBCPP_END_NAMESPACE_STD |
| 84 | 82 | ||
| 83 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 84 | |||
| 85 | #endif // _LIBCPP___STOP_TOKEN_INTRUSIVE_LIST_VIEW_H | 85 | #endif // _LIBCPP___STOP_TOKEN_INTRUSIVE_LIST_VIEW_H |
lib/libcxx/include/__stop_token/intrusive_shared_ptr.h+4-5| ... | @@ -10,7 +10,6 @@ | ... | @@ -10,7 +10,6 @@ |
| 10 | #ifndef _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H | 10 | #ifndef _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H |
| 11 | #define _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H | 11 | #define _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H |
| 12 | 12 | ||
| 13 | #include <__atomic/atomic.h> | ||
| 14 | #include <__atomic/memory_order.h> | 13 | #include <__atomic/memory_order.h> |
| 15 | #include <__config> | 14 | #include <__config> |
| 16 | #include <__cstddef/nullptr_t.h> | 15 | #include <__cstddef/nullptr_t.h> |
| ... | @@ -26,10 +25,10 @@ | ... | @@ -26,10 +25,10 @@ |
| 26 | _LIBCPP_PUSH_MACROS | 25 | _LIBCPP_PUSH_MACROS |
| 27 | #include <__undef_macros> | 26 | #include <__undef_macros> |
| 28 | 27 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 30 | |||
| 31 | #if _LIBCPP_STD_VER >= 20 | 28 | #if _LIBCPP_STD_VER >= 20 |
| 32 | 29 | ||
| 30 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 31 | |||
| 33 | // For intrusive_shared_ptr to work with a type T, specialize __intrusive_shared_ptr_traits<T> and implement | 32 | // For intrusive_shared_ptr to work with a type T, specialize __intrusive_shared_ptr_traits<T> and implement |
| 34 | // the following function: | 33 | // the following function: |
| 35 | // | 34 | // |
| ... | @@ -126,10 +125,10 @@ private: | ... | @@ -126,10 +125,10 @@ private: |
| 126 | } | 125 | } |
| 127 | }; | 126 | }; |
| 128 | 127 | ||
| 129 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 130 | |||
| 131 | _LIBCPP_END_NAMESPACE_STD | 128 | _LIBCPP_END_NAMESPACE_STD |
| 132 | 129 | ||
| 130 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 131 | |||
| 133 | _LIBCPP_POP_MACROS | 132 | _LIBCPP_POP_MACROS |
| 134 | 133 | ||
| 135 | #endif // _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H | 134 | #endif // _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H |
lib/libcxx/include/__stop_token/stop_callback.h+4-4| ... | @@ -29,10 +29,10 @@ | ... | @@ -29,10 +29,10 @@ |
| 29 | _LIBCPP_PUSH_MACROS | 29 | _LIBCPP_PUSH_MACROS |
| 30 | #include <__undef_macros> | 30 | #include <__undef_macros> |
| 31 | 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 33 | |||
| 34 | #if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | 32 | #if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS |
| 35 | 33 | ||
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 35 | |||
| 36 | template <class _Callback> | 36 | template <class _Callback> |
| 37 | class stop_callback : private __stop_callback_base { | 37 | class stop_callback : private __stop_callback_base { |
| 38 | static_assert(invocable<_Callback>, | 38 | static_assert(invocable<_Callback>, |
| ... | @@ -93,10 +93,10 @@ private: | ... | @@ -93,10 +93,10 @@ private: |
| 93 | template <class _Callback> | 93 | template <class _Callback> |
| 94 | stop_callback(stop_token, _Callback) -> stop_callback<_Callback>; | 94 | stop_callback(stop_token, _Callback) -> stop_callback<_Callback>; |
| 95 | 95 | ||
| 96 | #endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | ||
| 97 | |||
| 98 | _LIBCPP_END_NAMESPACE_STD | 96 | _LIBCPP_END_NAMESPACE_STD |
| 99 | 97 | ||
| 98 | #endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | ||
| 99 | |||
| 100 | _LIBCPP_POP_MACROS | 100 | _LIBCPP_POP_MACROS |
| 101 | 101 | ||
| 102 | #endif // _LIBCPP___STOP_TOKEN_STOP_CALLBACK_H | 102 | #endif // _LIBCPP___STOP_TOKEN_STOP_CALLBACK_H |
lib/libcxx/include/__stop_token/stop_state.h+6-5| ... | @@ -11,21 +11,22 @@ | ... | @@ -11,21 +11,22 @@ |
| 11 | #define _LIBCPP___STOP_TOKEN_STOP_STATE_H | 11 | #define _LIBCPP___STOP_TOKEN_STOP_STATE_H |
| 12 | 12 | ||
| 13 | #include <__assert> | 13 | #include <__assert> |
| 14 | #include <__atomic/atomic.h> | ||
| 15 | #include <__atomic/memory_order.h> | ||
| 14 | #include <__config> | 16 | #include <__config> |
| 15 | #include <__stop_token/atomic_unique_lock.h> | 17 | #include <__stop_token/atomic_unique_lock.h> |
| 16 | #include <__stop_token/intrusive_list_view.h> | 18 | #include <__stop_token/intrusive_list_view.h> |
| 17 | #include <__thread/id.h> | 19 | #include <__thread/id.h> |
| 18 | #include <atomic> | ||
| 19 | #include <cstdint> | 20 | #include <cstdint> |
| 20 | 21 | ||
| 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 22 | # pragma GCC system_header | 23 | # pragma GCC system_header |
| 23 | #endif | 24 | #endif |
| 24 | 25 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 26 | |||
| 27 | #if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | 26 | #if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS |
| 28 | 27 | ||
| 28 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 29 | |||
| 29 | struct __stop_callback_base : __intrusive_node_base<__stop_callback_base> { | 30 | struct __stop_callback_base : __intrusive_node_base<__stop_callback_base> { |
| 30 | using __callback_fn_t _LIBCPP_NODEBUG = void(__stop_callback_base*) noexcept; | 31 | using __callback_fn_t _LIBCPP_NODEBUG = void(__stop_callback_base*) noexcept; |
| 31 | _LIBCPP_HIDE_FROM_ABI explicit __stop_callback_base(__callback_fn_t* __callback_fn) : __callback_fn_(__callback_fn) {} | 32 | _LIBCPP_HIDE_FROM_ABI explicit __stop_callback_base(__callback_fn_t* __callback_fn) : __callback_fn_(__callback_fn) {} |
| ... | @@ -229,8 +230,8 @@ struct __intrusive_shared_ptr_traits<__stop_state> { | ... | @@ -229,8 +230,8 @@ struct __intrusive_shared_ptr_traits<__stop_state> { |
| 229 | } | 230 | } |
| 230 | }; | 231 | }; |
| 231 | 232 | ||
| 232 | #endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | ||
| 233 | |||
| 234 | _LIBCPP_END_NAMESPACE_STD | 233 | _LIBCPP_END_NAMESPACE_STD |
| 235 | 234 | ||
| 235 | #endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | ||
| 236 | |||
| 236 | #endif // _LIBCPP___STOP_TOKEN_STOP_STATE_H | 237 | #endif // _LIBCPP___STOP_TOKEN_STOP_STATE_H |
lib/libcxx/include/__stop_token/stop_token.h+4-4| ... | @@ -18,10 +18,10 @@ | ... | @@ -18,10 +18,10 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | 21 | #if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | class stop_token { | 25 | class stop_token { |
| 26 | public: | 26 | public: |
| 27 | _LIBCPP_HIDE_FROM_ABI stop_token() noexcept = default; | 27 | _LIBCPP_HIDE_FROM_ABI stop_token() noexcept = default; |
| ... | @@ -56,8 +56,8 @@ private: | ... | @@ -56,8 +56,8 @@ private: |
| 56 | _LIBCPP_HIDE_FROM_ABI explicit stop_token(const __intrusive_shared_ptr<__stop_state>& __state) : __state_(__state) {} | 56 | _LIBCPP_HIDE_FROM_ABI explicit stop_token(const __intrusive_shared_ptr<__stop_state>& __state) : __state_(__state) {} |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | #endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | ||
| 60 | |||
| 61 | _LIBCPP_END_NAMESPACE_STD | 59 | _LIBCPP_END_NAMESPACE_STD |
| 62 | 60 | ||
| 61 | #endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS | ||
| 62 | |||
| 63 | #endif // _LIBCPP___STOP_TOKEN_STOP_TOKEN_H | 63 | #endif // _LIBCPP___STOP_TOKEN_STOP_TOKEN_H |
lib/libcxx/include/__support/xlocale/__nop_locale_mgmt.h deleted-33| ... | @@ -1,33 +0,0 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===-----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP___SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H | ||
| 11 | #define _LIBCPP___SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H | ||
| 12 | |||
| 13 | #include <__config> | ||
| 14 | |||
| 15 | // Patch over lack of extended locale support | ||
| 16 | typedef void* locale_t; | ||
| 17 | |||
| 18 | inline _LIBCPP_HIDE_FROM_ABI locale_t duplocale(locale_t) { return nullptr; } | ||
| 19 | |||
| 20 | inline _LIBCPP_HIDE_FROM_ABI void freelocale(locale_t) {} | ||
| 21 | |||
| 22 | inline _LIBCPP_HIDE_FROM_ABI locale_t newlocale(int, const char*, locale_t) { return nullptr; } | ||
| 23 | |||
| 24 | #define LC_COLLATE_MASK (1 << LC_COLLATE) | ||
| 25 | #define LC_CTYPE_MASK (1 << LC_CTYPE) | ||
| 26 | #define LC_MESSAGES_MASK (1 << LC_MESSAGES) | ||
| 27 | #define LC_MONETARY_MASK (1 << LC_MONETARY) | ||
| 28 | #define LC_NUMERIC_MASK (1 << LC_NUMERIC) | ||
| 29 | #define LC_TIME_MASK (1 << LC_TIME) | ||
| 30 | #define LC_ALL_MASK \ | ||
| 31 | (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK | LC_MESSAGES_MASK) | ||
| 32 | |||
| 33 | #endif // _LIBCPP___SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H | ||
lib/libcxx/include/__support/xlocale/__strtonum_fallback.h deleted-37| ... | @@ -1,37 +0,0 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===-----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | // These are reimplementations of some extended locale functions ( *_l ) that | ||
| 10 | // aren't part of POSIX. They are widely available though (GLIBC, BSD, maybe | ||
| 11 | // others). The unifying aspect in this case is that all of these functions | ||
| 12 | // convert strings to some numeric type. | ||
| 13 | //===----------------------------------------------------------------------===// | ||
| 14 | |||
| 15 | #ifndef _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H | ||
| 16 | #define _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H | ||
| 17 | |||
| 18 | #include <__config> | ||
| 19 | #include <stdlib.h> | ||
| 20 | |||
| 21 | #if _LIBCPP_HAS_WIDE_CHARACTERS | ||
| 22 | # include <wchar.h> | ||
| 23 | #endif | ||
| 24 | |||
| 25 | inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t) { | ||
| 26 | return ::strtof(__nptr, __endptr); | ||
| 27 | } | ||
| 28 | |||
| 29 | inline _LIBCPP_HIDE_FROM_ABI double strtod_l(const char* __nptr, char** __endptr, locale_t) { | ||
| 30 | return ::strtod(__nptr, __endptr); | ||
| 31 | } | ||
| 32 | |||
| 33 | inline _LIBCPP_HIDE_FROM_ABI long double strtold_l(const char* __nptr, char** __endptr, locale_t) { | ||
| 34 | return ::strtold(__nptr, __endptr); | ||
| 35 | } | ||
| 36 | |||
| 37 | #endif // _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H | ||
lib/libcxx/include/__system_error/error_category.h+2| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 22 | 23 | ||
| 23 | class error_condition; | 24 | class error_condition; |
| 24 | class _LIBCPP_EXPORTED_FROM_ABI error_code; | 25 | class _LIBCPP_EXPORTED_FROM_ABI error_code; |
| ... | @@ -70,6 +71,7 @@ public: | ... | @@ -70,6 +71,7 @@ public: |
| 70 | [[__gnu__::__const__]] [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& generic_category() _NOEXCEPT; | 71 | [[__gnu__::__const__]] [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& generic_category() _NOEXCEPT; |
| 71 | [[__gnu__::__const__]] [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& system_category() _NOEXCEPT; | 72 | [[__gnu__::__const__]] [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& system_category() _NOEXCEPT; |
| 72 | 73 | ||
| 74 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 73 | _LIBCPP_END_NAMESPACE_STD | 75 | _LIBCPP_END_NAMESPACE_STD |
| 74 | 76 | ||
| 75 | #endif // _LIBCPP___SYSTEM_ERROR_ERROR_CATEGORY_H | 77 | #endif // _LIBCPP___SYSTEM_ERROR_ERROR_CATEGORY_H |
lib/libcxx/include/__system_error/error_code.h+2| ... | @@ -24,6 +24,7 @@ | ... | @@ -24,6 +24,7 @@ |
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 27 | 28 | ||
| 28 | template <class _Tp> | 29 | template <class _Tp> |
| 29 | struct is_error_code_enum : public false_type {}; | 30 | struct is_error_code_enum : public false_type {}; |
| ... | @@ -137,6 +138,7 @@ struct hash<error_code> : public __unary_function<error_code, size_t> { | ... | @@ -137,6 +138,7 @@ struct hash<error_code> : public __unary_function<error_code, size_t> { |
| 137 | } | 138 | } |
| 138 | }; | 139 | }; |
| 139 | 140 | ||
| 141 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 140 | _LIBCPP_END_NAMESPACE_STD | 142 | _LIBCPP_END_NAMESPACE_STD |
| 141 | 143 | ||
| 142 | #endif // _LIBCPP___SYSTEM_ERROR_ERROR_CODE_H | 144 | #endif // _LIBCPP___SYSTEM_ERROR_ERROR_CODE_H |
lib/libcxx/include/__system_error/error_condition.h+2| ... | @@ -23,6 +23,7 @@ | ... | @@ -23,6 +23,7 @@ |
| 23 | #endif | 23 | #endif |
| 24 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 26 | 27 | ||
| 27 | template <class _Tp> | 28 | template <class _Tp> |
| 28 | struct is_error_condition_enum : public false_type {}; | 29 | struct is_error_condition_enum : public false_type {}; |
| ... | @@ -124,6 +125,7 @@ struct hash<error_condition> : public __unary_function<error_condition, size_t> | ... | @@ -124,6 +125,7 @@ struct hash<error_condition> : public __unary_function<error_condition, size_t> |
| 124 | } | 125 | } |
| 125 | }; | 126 | }; |
| 126 | 127 | ||
| 128 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 127 | _LIBCPP_END_NAMESPACE_STD | 129 | _LIBCPP_END_NAMESPACE_STD |
| 128 | 130 | ||
| 129 | #endif // _LIBCPP___SYSTEM_ERROR_ERROR_CONDITION_H | 131 | #endif // _LIBCPP___SYSTEM_ERROR_ERROR_CONDITION_H |
lib/libcxx/include/__system_error/system_error.h+2| ... | @@ -22,6 +22,7 @@ | ... | @@ -22,6 +22,7 @@ |
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | 24 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 25 | 26 | ||
| 26 | class _LIBCPP_EXPORTED_FROM_ABI system_error : public runtime_error { | 27 | class _LIBCPP_EXPORTED_FROM_ABI system_error : public runtime_error { |
| 27 | error_code __ec_; | 28 | error_code __ec_; |
| ... | @@ -52,6 +53,7 @@ public: | ... | @@ -52,6 +53,7 @@ public: |
| 52 | #endif | 53 | #endif |
| 53 | } | 54 | } |
| 54 | 55 | ||
| 56 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 55 | _LIBCPP_END_NAMESPACE_STD | 57 | _LIBCPP_END_NAMESPACE_STD |
| 56 | 58 | ||
| 57 | #endif // _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H | 59 | #endif // _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H |
lib/libcxx/include/__system_error/throw_system_error.h+2| ... | @@ -17,9 +17,11 @@ | ... | @@ -17,9 +17,11 @@ |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 20 | 21 | ||
| 21 | [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg); | 22 | [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg); |
| 22 | 23 | ||
| 24 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 23 | _LIBCPP_END_NAMESPACE_STD | 25 | _LIBCPP_END_NAMESPACE_STD |
| 24 | 26 | ||
| 25 | #endif // _LIBCPP___SYSTEM_ERROR_THROW_SYSTEM_ERROR_H | 27 | #endif // _LIBCPP___SYSTEM_ERROR_THROW_SYSTEM_ERROR_H |
lib/libcxx/include/__thread/formatter.h+1-8| ... | @@ -51,20 +51,13 @@ public: | ... | @@ -51,20 +51,13 @@ public: |
| 51 | // On Linux systems pthread_t is an unsigned long long. | 51 | // On Linux systems pthread_t is an unsigned long long. |
| 52 | // On Apple systems pthread_t is a pointer type. | 52 | // On Apple systems pthread_t is a pointer type. |
| 53 | // | 53 | // |
| 54 | // Note the output should match what the stream operator does. Since | 54 | // Note the output should match what the stream operator does. |
| 55 | // the ostream operator has been shipped years before this formatter | ||
| 56 | // was added to the Standard, this formatter does what the stream | ||
| 57 | // operator does. This may require platform specific changes. | ||
| 58 | 55 | ||
| 59 | using _Tp = decltype(__get_underlying_id(__id)); | 56 | using _Tp = decltype(__get_underlying_id(__id)); |
| 60 | using _Cp = conditional_t<integral<_Tp>, _Tp, conditional_t<is_pointer_v<_Tp>, uintptr_t, void>>; | 57 | using _Cp = conditional_t<integral<_Tp>, _Tp, conditional_t<is_pointer_v<_Tp>, uintptr_t, void>>; |
| 61 | static_assert(!is_same_v<_Cp, void>, "unsupported thread::id type, please file a bug report"); | 58 | static_assert(!is_same_v<_Cp, void>, "unsupported thread::id type, please file a bug report"); |
| 62 | 59 | ||
| 63 | __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx); | 60 | __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx); |
| 64 | if constexpr (is_pointer_v<_Tp>) { | ||
| 65 | __specs.__std_.__alternate_form_ = true; | ||
| 66 | __specs.__std_.__type_ = __format_spec::__type::__hexadecimal_lower_case; | ||
| 67 | } | ||
| 68 | return __formatter::__format_integer(reinterpret_cast<_Cp>(__get_underlying_id(__id)), __ctx, __specs); | 61 | return __formatter::__format_integer(reinterpret_cast<_Cp>(__get_underlying_id(__id)), __ctx, __specs); |
| 69 | } | 62 | } |
| 70 | 63 |
lib/libcxx/include/__thread/id.h+4-3| ... | @@ -20,9 +20,10 @@ | ... | @@ -20,9 +20,10 @@ |
| 20 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | #if _LIBCPP_HAS_THREADS | ||
| 24 | |||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 26 | ||
| 25 | #if _LIBCPP_HAS_THREADS | ||
| 26 | class __thread_id; | 27 | class __thread_id; |
| 27 | 28 | ||
| 28 | namespace this_thread { | 29 | namespace this_thread { |
| ... | @@ -114,8 +115,8 @@ inline _LIBCPP_HIDE_FROM_ABI __thread_id get_id() _NOEXCEPT { return __libcpp_th | ... | @@ -114,8 +115,8 @@ inline _LIBCPP_HIDE_FROM_ABI __thread_id get_id() _NOEXCEPT { return __libcpp_th |
| 114 | 115 | ||
| 115 | } // namespace this_thread | 116 | } // namespace this_thread |
| 116 | 117 | ||
| 117 | #endif // _LIBCPP_HAS_THREADS | ||
| 118 | |||
| 119 | _LIBCPP_END_NAMESPACE_STD | 118 | _LIBCPP_END_NAMESPACE_STD |
| 120 | 119 | ||
| 120 | #endif // _LIBCPP_HAS_THREADS | ||
| 121 | |||
| 121 | #endif // _LIBCPP___THREAD_ID_H | 122 | #endif // _LIBCPP___THREAD_ID_H |
lib/libcxx/include/__thread/support/pthread.h+16-3| ... | @@ -144,7 +144,9 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_execute_once(__libcpp_exec_once_flag* | ... | @@ -144,7 +144,9 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_execute_once(__libcpp_exec_once_flag* |
| 144 | // | 144 | // |
| 145 | // Thread id | 145 | // Thread id |
| 146 | // | 146 | // |
| 147 | #if defined(__MVS__) | 147 | #if _LIBCPP_LIBC_LLVM_LIBC |
| 148 | typedef pthread_id_np_t __libcpp_thread_id; | ||
| 149 | #elif defined(__MVS__) | ||
| 148 | typedef unsigned long long __libcpp_thread_id; | 150 | typedef unsigned long long __libcpp_thread_id; |
| 149 | #else | 151 | #else |
| 150 | typedef pthread_t __libcpp_thread_id; | 152 | typedef pthread_t __libcpp_thread_id; |
| ... | @@ -163,11 +165,18 @@ inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_id_less(__libcpp_thread_id __t | ... | @@ -163,11 +165,18 @@ inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_id_less(__libcpp_thread_id __t |
| 163 | // | 165 | // |
| 164 | // Thread | 166 | // Thread |
| 165 | // | 167 | // |
| 166 | #define _LIBCPP_NULL_THREAD ((__libcpp_thread_t())) | 168 | #if defined(PTHREAD_NULL) |
| 169 | # define _LIBCPP_NULL_THREAD PTHREAD_NULL | ||
| 170 | #else | ||
| 171 | # define _LIBCPP_NULL_THREAD ((__libcpp_thread_t())) | ||
| 172 | #endif | ||
| 167 | typedef pthread_t __libcpp_thread_t; | 173 | typedef pthread_t __libcpp_thread_t; |
| 168 | 174 | ||
| 169 | inline _LIBCPP_HIDE_FROM_ABI __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) { | 175 | inline _LIBCPP_HIDE_FROM_ABI __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) { |
| 170 | #if defined(__MVS__) | 176 | #if _LIBCPP_LIBC_LLVM_LIBC |
| 177 | __libcpp_thread_id __id; | ||
| 178 | return pthread_getunique_np(__t, &__id) ? 0 : __id; | ||
| 179 | #elif defined(__MVS__) | ||
| 171 | return __t->__; | 180 | return __t->__; |
| 172 | #else | 181 | #else |
| 173 | return *__t; | 182 | return *__t; |
| ... | @@ -183,8 +192,12 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_create(__libcpp_thread_t* __t, | ... | @@ -183,8 +192,12 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_create(__libcpp_thread_t* __t, |
| 183 | } | 192 | } |
| 184 | 193 | ||
| 185 | inline _LIBCPP_HIDE_FROM_ABI __libcpp_thread_id __libcpp_thread_get_current_id() { | 194 | inline _LIBCPP_HIDE_FROM_ABI __libcpp_thread_id __libcpp_thread_get_current_id() { |
| 195 | #if _LIBCPP_LIBC_LLVM_LIBC | ||
| 196 | return pthread_getthreadid_np(); | ||
| 197 | #else | ||
| 186 | const __libcpp_thread_t __current_thread = pthread_self(); | 198 | const __libcpp_thread_t __current_thread = pthread_self(); |
| 187 | return __libcpp_thread_get_id(&__current_thread); | 199 | return __libcpp_thread_get_id(&__current_thread); |
| 200 | #endif | ||
| 188 | } | 201 | } |
| 189 | 202 | ||
| 190 | inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_join(__libcpp_thread_t* __t) { return pthread_join(*__t, nullptr); } | 203 | inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_join(__libcpp_thread_t* __t) { return pthread_join(*__t, nullptr); } |
lib/libcxx/include/__thread/support/windows.h+2| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 22 | 23 | ||
| 23 | using __libcpp_timespec_t = ::timespec; | 24 | using __libcpp_timespec_t = ::timespec; |
| 24 | 25 | ||
| ... | @@ -126,6 +127,7 @@ _LIBCPP_EXPORTED_FROM_ABI void* __libcpp_tls_get(__libcpp_tls_key __key); | ... | @@ -126,6 +127,7 @@ _LIBCPP_EXPORTED_FROM_ABI void* __libcpp_tls_get(__libcpp_tls_key __key); |
| 126 | 127 | ||
| 127 | _LIBCPP_EXPORTED_FROM_ABI int __libcpp_tls_set(__libcpp_tls_key __key, void* __p); | 128 | _LIBCPP_EXPORTED_FROM_ABI int __libcpp_tls_set(__libcpp_tls_key __key, void* __p); |
| 128 | 129 | ||
| 130 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 129 | _LIBCPP_END_NAMESPACE_STD | 131 | _LIBCPP_END_NAMESPACE_STD |
| 130 | 132 | ||
| 131 | #endif // _LIBCPP___THREAD_SUPPORT_WINDOWS_H | 133 | #endif // _LIBCPP___THREAD_SUPPORT_WINDOWS_H |
lib/libcxx/include/__thread/this_thread.h+2| ... | @@ -32,7 +32,9 @@ namespace this_thread { | ... | @@ -32,7 +32,9 @@ namespace this_thread { |
| 32 | 32 | ||
| 33 | #if _LIBCPP_HAS_THREADS | 33 | #if _LIBCPP_HAS_THREADS |
| 34 | 34 | ||
| 35 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 35 | _LIBCPP_EXPORTED_FROM_ABI void sleep_for(const chrono::nanoseconds& __ns); | 36 | _LIBCPP_EXPORTED_FROM_ABI void sleep_for(const chrono::nanoseconds& __ns); |
| 37 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 36 | 38 | ||
| 37 | template <class _Rep, class _Period> | 39 | template <class _Rep, class _Period> |
| 38 | _LIBCPP_HIDE_FROM_ABI void sleep_for(const chrono::duration<_Rep, _Period>& __d) { | 40 | _LIBCPP_HIDE_FROM_ABI void sleep_for(const chrono::duration<_Rep, _Period>& __d) { |
lib/libcxx/include/__thread/thread.h+23-14| ... | @@ -11,12 +11,13 @@ | ... | @@ -11,12 +11,13 @@ |
| 11 | #define _LIBCPP___THREAD_THREAD_H | 11 | #define _LIBCPP___THREAD_THREAD_H |
| 12 | 12 | ||
| 13 | #include <__assert> | 13 | #include <__assert> |
| 14 | #include <__charconv/to_chars_integral.h> | ||
| 14 | #include <__condition_variable/condition_variable.h> | 15 | #include <__condition_variable/condition_variable.h> |
| 15 | #include <__config> | 16 | #include <__config> |
| 16 | #include <__exception/terminate.h> | 17 | #include <__exception/terminate.h> |
| 17 | #include <__functional/hash.h> | 18 | #include <__functional/hash.h> |
| 18 | #include <__functional/unary_function.h> | 19 | #include <__functional/unary_function.h> |
| 19 | #include <__locale> | 20 | #include <__fwd/ostream.h> |
| 20 | #include <__memory/addressof.h> | 21 | #include <__memory/addressof.h> |
| 21 | #include <__memory/unique_ptr.h> | 22 | #include <__memory/unique_ptr.h> |
| 22 | #include <__mutex/mutex.h> | 23 | #include <__mutex/mutex.h> |
| ... | @@ -27,15 +28,16 @@ | ... | @@ -27,15 +28,16 @@ |
| 27 | #include <__type_traits/enable_if.h> | 28 | #include <__type_traits/enable_if.h> |
| 28 | #include <__type_traits/invoke.h> | 29 | #include <__type_traits/invoke.h> |
| 29 | #include <__type_traits/is_constructible.h> | 30 | #include <__type_traits/is_constructible.h> |
| 31 | #include <__type_traits/is_integral.h> | ||
| 32 | #include <__type_traits/is_pointer.h> | ||
| 30 | #include <__type_traits/is_same.h> | 33 | #include <__type_traits/is_same.h> |
| 31 | #include <__type_traits/remove_cvref.h> | 34 | #include <__type_traits/remove_cvref.h> |
| 35 | #include <__utility/exchange.h> | ||
| 32 | #include <__utility/forward.h> | 36 | #include <__utility/forward.h> |
| 37 | #include <cstdint> | ||
| 38 | #include <limits> | ||
| 33 | #include <tuple> | 39 | #include <tuple> |
| 34 | 40 | ||
| 35 | #if _LIBCPP_HAS_LOCALIZATION | ||
| 36 | # include <sstream> | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 41 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 40 | # pragma GCC system_header | 42 | # pragma GCC system_header |
| 41 | #endif | 43 | #endif |
| ... | @@ -44,6 +46,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -44,6 +46,7 @@ _LIBCPP_PUSH_MACROS |
| 44 | #include <__undef_macros> | 46 | #include <__undef_macros> |
| 45 | 47 | ||
| 46 | _LIBCPP_BEGIN_NAMESPACE_STD | 48 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 49 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 47 | 50 | ||
| 48 | #if _LIBCPP_HAS_THREADS | 51 | #if _LIBCPP_HAS_THREADS |
| 49 | 52 | ||
| ... | @@ -144,13 +147,19 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) { | ... | @@ -144,13 +147,19 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) { |
| 144 | // | 147 | // |
| 145 | // Since various flags in the output stream can affect how the | 148 | // Since various flags in the output stream can affect how the |
| 146 | // thread id is represented (e.g. numpunct or showbase), we | 149 | // thread id is represented (e.g. numpunct or showbase), we |
| 147 | // use a temporary stream instead and just output the thread | 150 | // use `to_chars` directly and output the id as a string. |
| 148 | // id representation as a string. | 151 | |
| 152 | static_assert(is_pointer<__libcpp_thread_id>::value || is_integral<__libcpp_thread_id>::value); | ||
| 153 | |||
| 154 | using __int_type = __conditional_t<is_pointer<__libcpp_thread_id>::value, uintptr_t, __libcpp_thread_id>; | ||
| 149 | 155 | ||
| 150 | basic_ostringstream<_CharT, _Traits> __sstr; | 156 | static const size_t __buffer_size = numeric_limits<__int_type>::digits10 + 2; |
| 151 | __sstr.imbue(locale::classic()); | 157 | char __buffer[__buffer_size]; |
| 152 | __sstr << __id.__id_; | 158 | auto __ret = |
| 153 | return __os << __sstr.str(); | 159 | std::__to_chars_integral(__buffer, __buffer + __buffer_size - 1, reinterpret_cast<__int_type>(__id.__id_), 10); |
| 160 | _LIBCPP_ASSERT_INTERNAL(__ret.__ec == std::errc(), "to_chars failed!"); | ||
| 161 | *__ret.__ptr = '\0'; | ||
| 162 | return __os << __buffer; | ||
| 154 | } | 163 | } |
| 155 | # endif // _LIBCPP_HAS_LOCALIZATION | 164 | # endif // _LIBCPP_HAS_LOCALIZATION |
| 156 | 165 | ||
| ... | @@ -236,13 +245,12 @@ public: | ... | @@ -236,13 +245,12 @@ public: |
| 236 | # endif | 245 | # endif |
| 237 | ~thread(); | 246 | ~thread(); |
| 238 | 247 | ||
| 239 | _LIBCPP_HIDE_FROM_ABI thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) { __t.__t_ = _LIBCPP_NULL_THREAD; } | 248 | _LIBCPP_HIDE_FROM_ABI thread(thread&& __t) _NOEXCEPT : __t_(std::__exchange(__t.__t_, __libcpp_thread_t())) {} |
| 240 | 249 | ||
| 241 | _LIBCPP_HIDE_FROM_ABI thread& operator=(thread&& __t) _NOEXCEPT { | 250 | _LIBCPP_HIDE_FROM_ABI thread& operator=(thread&& __t) _NOEXCEPT { |
| 242 | if (!__libcpp_thread_isnull(&__t_)) | 251 | if (!__libcpp_thread_isnull(&__t_)) |
| 243 | terminate(); | 252 | terminate(); |
| 244 | __t_ = __t.__t_; | 253 | __t_ = std::__exchange(__t.__t_, __libcpp_thread_t()); |
| 245 | __t.__t_ = _LIBCPP_NULL_THREAD; | ||
| 246 | return *this; | 254 | return *this; |
| 247 | } | 255 | } |
| 248 | 256 | ||
| ... | @@ -261,6 +269,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(thread& __x, thread& __y) _NOEXCEPT { __x | ... | @@ -261,6 +269,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(thread& __x, thread& __y) _NOEXCEPT { __x |
| 261 | 269 | ||
| 262 | #endif // _LIBCPP_HAS_THREADS | 270 | #endif // _LIBCPP_HAS_THREADS |
| 263 | 271 | ||
| 272 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 264 | _LIBCPP_END_NAMESPACE_STD | 273 | _LIBCPP_END_NAMESPACE_STD |
| 265 | 274 | ||
| 266 | _LIBCPP_POP_MACROS | 275 | _LIBCPP_POP_MACROS |
lib/libcxx/include/__tree+469-358| ... | @@ -113,7 +113,7 @@ __root, have a non-null __parent_ field. | ... | @@ -113,7 +113,7 @@ __root, have a non-null __parent_ field. |
| 113 | // Returns: true if __x is a left child of its parent, else false | 113 | // Returns: true if __x is a left child of its parent, else false |
| 114 | // Precondition: __x != nullptr. | 114 | // Precondition: __x != nullptr. |
| 115 | template <class _NodePtr> | 115 | template <class _NodePtr> |
| 116 | inline _LIBCPP_HIDE_FROM_ABI bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT { | 116 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT { |
| 117 | return __x == __x->__parent_->__left_; | 117 | return __x == __x->__parent_->__left_; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| ... | @@ -121,7 +121,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT { | ... | @@ -121,7 +121,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT { |
| 121 | // __x is a proper subtree, returns the black height (null counts as 1). If | 121 | // __x is a proper subtree, returns the black height (null counts as 1). If |
| 122 | // __x is an improper subtree, returns 0. | 122 | // __x is an improper subtree, returns 0. |
| 123 | template <class _NodePtr> | 123 | template <class _NodePtr> |
| 124 | unsigned __tree_sub_invariant(_NodePtr __x) { | 124 | _LIBCPP_CONSTEXPR_SINCE_CXX26 unsigned __tree_sub_invariant(_NodePtr __x) { |
| 125 | if (__x == nullptr) | 125 | if (__x == nullptr) |
| 126 | return 1; | 126 | return 1; |
| 127 | // parent consistency checked by caller | 127 | // parent consistency checked by caller |
| ... | @@ -153,7 +153,7 @@ unsigned __tree_sub_invariant(_NodePtr __x) { | ... | @@ -153,7 +153,7 @@ unsigned __tree_sub_invariant(_NodePtr __x) { |
| 153 | // __root == nullptr is a proper tree. Returns true if __root is a proper | 153 | // __root == nullptr is a proper tree. Returns true if __root is a proper |
| 154 | // red black tree, else returns false. | 154 | // red black tree, else returns false. |
| 155 | template <class _NodePtr> | 155 | template <class _NodePtr> |
| 156 | _LIBCPP_HIDE_FROM_ABI bool __tree_invariant(_NodePtr __root) { | 156 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __tree_invariant(_NodePtr __root) { |
| 157 | if (__root == nullptr) | 157 | if (__root == nullptr) |
| 158 | return true; | 158 | return true; |
| 159 | // check __x->__parent_ consistency | 159 | // check __x->__parent_ consistency |
| ... | @@ -170,7 +170,7 @@ _LIBCPP_HIDE_FROM_ABI bool __tree_invariant(_NodePtr __root) { | ... | @@ -170,7 +170,7 @@ _LIBCPP_HIDE_FROM_ABI bool __tree_invariant(_NodePtr __root) { |
| 170 | 170 | ||
| 171 | // Returns: pointer to the left-most node under __x. | 171 | // Returns: pointer to the left-most node under __x. |
| 172 | template <class _NodePtr> | 172 | template <class _NodePtr> |
| 173 | inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT { | 173 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT { |
| 174 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null"); | 174 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null"); |
| 175 | while (__x->__left_ != nullptr) | 175 | while (__x->__left_ != nullptr) |
| 176 | __x = __x->__left_; | 176 | __x = __x->__left_; |
| ... | @@ -179,7 +179,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT { | ... | @@ -179,7 +179,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT { |
| 179 | 179 | ||
| 180 | // Returns: pointer to the right-most node under __x. | 180 | // Returns: pointer to the right-most node under __x. |
| 181 | template <class _NodePtr> | 181 | template <class _NodePtr> |
| 182 | inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT { | 182 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT { |
| 183 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null"); | 183 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null"); |
| 184 | while (__x->__right_ != nullptr) | 184 | while (__x->__right_ != nullptr) |
| 185 | __x = __x->__right_; | 185 | __x = __x->__right_; |
| ... | @@ -188,7 +188,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT { | ... | @@ -188,7 +188,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT { |
| 188 | 188 | ||
| 189 | // Returns: pointer to the next in-order node after __x. | 189 | // Returns: pointer to the next in-order node after __x. |
| 190 | template <class _NodePtr> | 190 | template <class _NodePtr> |
| 191 | _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT { | 191 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT { |
| 192 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); | 192 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); |
| 193 | if (__x->__right_ != nullptr) | 193 | if (__x->__right_ != nullptr) |
| 194 | return std::__tree_min(__x->__right_); | 194 | return std::__tree_min(__x->__right_); |
| ... | @@ -203,23 +203,23 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT { | ... | @@ -203,23 +203,23 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT { |
| 203 | // to the actual root of the tree through a __left_ pointer. Incrementing the end() pointer is UB, so we can assume that | 203 | // to the actual root of the tree through a __left_ pointer. Incrementing the end() pointer is UB, so we can assume that |
| 204 | // never happens. | 204 | // never happens. |
| 205 | template <class _EndNodePtr, class _NodePtr> | 205 | template <class _EndNodePtr, class _NodePtr> |
| 206 | inline _LIBCPP_HIDE_FROM_ABI _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEPT { | 206 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEPT { |
| 207 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); | 207 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); |
| 208 | if (__x->__right_ != nullptr) | 208 | if (__x->__right_ != nullptr) |
| 209 | return static_cast<_EndNodePtr>(std::__tree_min(__x->__right_)); | 209 | return std::__static_fancy_pointer_cast<_EndNodePtr>(std::__tree_min(__x->__right_)); |
| 210 | while (!std::__tree_is_left_child(__x)) | 210 | while (!std::__tree_is_left_child(__x)) |
| 211 | __x = __x->__parent_unsafe(); | 211 | __x = __x->__parent_unsafe(); |
| 212 | return static_cast<_EndNodePtr>(__x->__parent_); | 212 | return std::__static_fancy_pointer_cast<_EndNodePtr>(__x->__parent_); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | // Returns: pointer to the previous in-order node before __x. | 215 | // Returns: pointer to the previous in-order node before __x. |
| 216 | // Note: __x may be the end node. | 216 | // Note: __x may be the end node. |
| 217 | template <class _NodePtr, class _EndNodePtr> | 217 | template <class _NodePtr, class _EndNodePtr> |
| 218 | inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT { | 218 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT { |
| 219 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); | 219 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); |
| 220 | if (__x->__left_ != nullptr) | 220 | if (__x->__left_ != nullptr) |
| 221 | return std::__tree_max(__x->__left_); | 221 | return std::__tree_max(__x->__left_); |
| 222 | _NodePtr __xx = static_cast<_NodePtr>(__x); | 222 | _NodePtr __xx = std::__static_fancy_pointer_cast<_NodePtr>(__x); |
| 223 | while (std::__tree_is_left_child(__xx)) | 223 | while (std::__tree_is_left_child(__xx)) |
| 224 | __xx = __xx->__parent_unsafe(); | 224 | __xx = __xx->__parent_unsafe(); |
| 225 | return __xx->__parent_unsafe(); | 225 | return __xx->__parent_unsafe(); |
| ... | @@ -227,7 +227,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEP | ... | @@ -227,7 +227,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEP |
| 227 | 227 | ||
| 228 | // Returns: pointer to a node which has no children | 228 | // Returns: pointer to a node which has no children |
| 229 | template <class _NodePtr> | 229 | template <class _NodePtr> |
| 230 | _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT { | 230 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT { |
| 231 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); | 231 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); |
| 232 | while (true) { | 232 | while (true) { |
| 233 | if (__x->__left_ != nullptr) { | 233 | if (__x->__left_ != nullptr) { |
| ... | @@ -246,7 +246,7 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT { | ... | @@ -246,7 +246,7 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT { |
| 246 | // Effects: Makes __x->__right_ the subtree root with __x as its left child | 246 | // Effects: Makes __x->__right_ the subtree root with __x as its left child |
| 247 | // while preserving in-order order. | 247 | // while preserving in-order order. |
| 248 | template <class _NodePtr> | 248 | template <class _NodePtr> |
| 249 | _LIBCPP_HIDE_FROM_ABI void __tree_left_rotate(_NodePtr __x) _NOEXCEPT { | 249 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree_left_rotate(_NodePtr __x) _NOEXCEPT { |
| 250 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); | 250 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); |
| 251 | _LIBCPP_ASSERT_INTERNAL(__x->__right_ != nullptr, "node should have a right child"); | 251 | _LIBCPP_ASSERT_INTERNAL(__x->__right_ != nullptr, "node should have a right child"); |
| 252 | _NodePtr __y = __x->__right_; | 252 | _NodePtr __y = __x->__right_; |
| ... | @@ -265,7 +265,7 @@ _LIBCPP_HIDE_FROM_ABI void __tree_left_rotate(_NodePtr __x) _NOEXCEPT { | ... | @@ -265,7 +265,7 @@ _LIBCPP_HIDE_FROM_ABI void __tree_left_rotate(_NodePtr __x) _NOEXCEPT { |
| 265 | // Effects: Makes __x->__left_ the subtree root with __x as its right child | 265 | // Effects: Makes __x->__left_ the subtree root with __x as its right child |
| 266 | // while preserving in-order order. | 266 | // while preserving in-order order. |
| 267 | template <class _NodePtr> | 267 | template <class _NodePtr> |
| 268 | _LIBCPP_HIDE_FROM_ABI void __tree_right_rotate(_NodePtr __x) _NOEXCEPT { | 268 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree_right_rotate(_NodePtr __x) _NOEXCEPT { |
| 269 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); | 269 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null"); |
| 270 | _LIBCPP_ASSERT_INTERNAL(__x->__left_ != nullptr, "node should have a left child"); | 270 | _LIBCPP_ASSERT_INTERNAL(__x->__left_ != nullptr, "node should have a left child"); |
| 271 | _NodePtr __y = __x->__left_; | 271 | _NodePtr __y = __x->__left_; |
| ... | @@ -289,7 +289,8 @@ _LIBCPP_HIDE_FROM_ABI void __tree_right_rotate(_NodePtr __x) _NOEXCEPT { | ... | @@ -289,7 +289,8 @@ _LIBCPP_HIDE_FROM_ABI void __tree_right_rotate(_NodePtr __x) _NOEXCEPT { |
| 289 | // Postcondition: __tree_invariant(end_node->__left_) == true. end_node->__left_ | 289 | // Postcondition: __tree_invariant(end_node->__left_) == true. end_node->__left_ |
| 290 | // may be different than the value passed in as __root. | 290 | // may be different than the value passed in as __root. |
| 291 | template <class _NodePtr> | 291 | template <class _NodePtr> |
| 292 | _LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT { | 292 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 293 | __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT { | ||
| 293 | _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root of the tree shouldn't be null"); | 294 | _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root of the tree shouldn't be null"); |
| 294 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Can't attach null node to a leaf"); | 295 | _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Can't attach null node to a leaf"); |
| 295 | __x->__is_black_ = __x == __root; | 296 | __x->__is_black_ = __x == __root; |
| ... | @@ -345,7 +346,7 @@ _LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr | ... | @@ -345,7 +346,7 @@ _LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr |
| 345 | // nor any of its children refer to __z. end_node->__left_ | 346 | // nor any of its children refer to __z. end_node->__left_ |
| 346 | // may be different than the value passed in as __root. | 347 | // may be different than the value passed in as __root. |
| 347 | template <class _NodePtr> | 348 | template <class _NodePtr> |
| 348 | _LIBCPP_HIDE_FROM_ABI void __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT { | 349 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT { |
| 349 | _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root node should not be null"); | 350 | _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root node should not be null"); |
| 350 | _LIBCPP_ASSERT_INTERNAL(__z != nullptr, "The node to remove should not be null"); | 351 | _LIBCPP_ASSERT_INTERNAL(__z != nullptr, "The node to remove should not be null"); |
| 351 | _LIBCPP_ASSERT_INTERNAL(std::__tree_invariant(__root), "The tree invariants should hold"); | 352 | _LIBCPP_ASSERT_INTERNAL(std::__tree_invariant(__root), "The tree invariants should hold"); |
| ... | @@ -560,7 +561,7 @@ public: | ... | @@ -560,7 +561,7 @@ public: |
| 560 | using pointer = _Pointer; | 561 | using pointer = _Pointer; |
| 561 | pointer __left_; | 562 | pointer __left_; |
| 562 | 563 | ||
| 563 | _LIBCPP_HIDE_FROM_ABI __tree_end_node() _NOEXCEPT : __left_() {} | 564 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_end_node() _NOEXCEPT : __left_() {} |
| 564 | }; | 565 | }; |
| 565 | 566 | ||
| 566 | template <class _VoidPtr> | 567 | template <class _VoidPtr> |
| ... | @@ -573,9 +574,13 @@ public: | ... | @@ -573,9 +574,13 @@ public: |
| 573 | __end_node_pointer __parent_; | 574 | __end_node_pointer __parent_; |
| 574 | bool __is_black_; | 575 | bool __is_black_; |
| 575 | 576 | ||
| 576 | _LIBCPP_HIDE_FROM_ABI pointer __parent_unsafe() const { return static_cast<pointer>(__parent_); } | 577 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer __parent_unsafe() const { |
| 578 | return std::__static_fancy_pointer_cast<pointer>(__parent_); | ||
| 579 | } | ||
| 577 | 580 | ||
| 578 | _LIBCPP_HIDE_FROM_ABI void __set_parent(pointer __p) { __parent_ = static_cast<__end_node_pointer>(__p); } | 581 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __set_parent(pointer __p) { |
| 582 | __parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__p); | ||
| 583 | } | ||
| 579 | 584 | ||
| 580 | _LIBCPP_HIDE_FROM_ABI __tree_node_base() = default; | 585 | _LIBCPP_HIDE_FROM_ABI __tree_node_base() = default; |
| 581 | __tree_node_base(__tree_node_base const&) = delete; | 586 | __tree_node_base(__tree_node_base const&) = delete; |
| ... | @@ -598,7 +603,7 @@ private: | ... | @@ -598,7 +603,7 @@ private: |
| 598 | }; | 603 | }; |
| 599 | 604 | ||
| 600 | public: | 605 | public: |
| 601 | _LIBCPP_HIDE_FROM_ABI __node_value_type& __get_value() { return __value_; } | 606 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_value_type& __get_value() { return __value_; } |
| 602 | #else | 607 | #else |
| 603 | 608 | ||
| 604 | private: | 609 | private: |
| ... | @@ -609,9 +614,10 @@ public: | ... | @@ -609,9 +614,10 @@ public: |
| 609 | #endif | 614 | #endif |
| 610 | 615 | ||
| 611 | template <class _Alloc, class... _Args> | 616 | template <class _Alloc, class... _Args> |
| 612 | _LIBCPP_HIDE_FROM_ABI explicit __tree_node(_Alloc& __na, _Args&&... __args) { | 617 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_node(_Alloc& __na, _Args&&... __args) { |
| 613 | allocator_traits<_Alloc>::construct(__na, std::addressof(__get_value()), std::forward<_Args>(__args)...); | 618 | allocator_traits<_Alloc>::construct(__na, std::addressof(__get_value()), std::forward<_Args>(__args)...); |
| 614 | } | 619 | } |
| 620 | |||
| 615 | ~__tree_node() = delete; | 621 | ~__tree_node() = delete; |
| 616 | __tree_node(__tree_node const&) = delete; | 622 | __tree_node(__tree_node const&) = delete; |
| 617 | __tree_node& operator=(__tree_node const&) = delete; | 623 | __tree_node& operator=(__tree_node const&) = delete; |
| ... | @@ -631,14 +637,15 @@ private: | ... | @@ -631,14 +637,15 @@ private: |
| 631 | public: | 637 | public: |
| 632 | bool __value_constructed; | 638 | bool __value_constructed; |
| 633 | 639 | ||
| 634 | _LIBCPP_HIDE_FROM_ABI __tree_node_destructor(const __tree_node_destructor&) = default; | 640 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node_destructor(const __tree_node_destructor&) = default; |
| 635 | __tree_node_destructor& operator=(const __tree_node_destructor&) = delete; | 641 | __tree_node_destructor& operator=(const __tree_node_destructor&) = delete; |
| 636 | 642 | ||
| 637 | _LIBCPP_HIDE_FROM_ABI explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT | 643 | _LIBCPP_HIDE_FROM_ABI |
| 644 | _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT | ||
| 638 | : __na_(__na), | 645 | : __na_(__na), |
| 639 | __value_constructed(__val) {} | 646 | __value_constructed(__val) {} |
| 640 | 647 | ||
| 641 | _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT { | 648 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator()(pointer __p) _NOEXCEPT { |
| 642 | if (__value_constructed) | 649 | if (__value_constructed) |
| 643 | __alloc_traits::destroy(__na_, std::addressof(__p->__get_value())); | 650 | __alloc_traits::destroy(__na_, std::addressof(__p->__get_value())); |
| 644 | if (__p) | 651 | if (__p) |
| ... | @@ -663,7 +670,8 @@ template <class _Reference, class _Break, class _NodePtr, class _Func, class _Pr | ... | @@ -663,7 +670,8 @@ template <class _Reference, class _Break, class _NodePtr, class _Func, class _Pr |
| 663 | #ifndef _LIBCPP_COMPILER_GCC // This function is recursive, so GCC complains about always_inline. | 670 | #ifndef _LIBCPP_COMPILER_GCC // This function is recursive, so GCC complains about always_inline. |
| 664 | _LIBCPP_HIDE_FROM_ABI | 671 | _LIBCPP_HIDE_FROM_ABI |
| 665 | #endif | 672 | #endif |
| 666 | bool __tree_iterate_from_root(_Break __break, _NodePtr __root, _Func& __func, _Proj& __proj) { | 673 | _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 674 | __tree_iterate_from_root(_Break __break, _NodePtr __root, _Func& __func, _Proj& __proj) { | ||
| 667 | if (__root->__left_) { | 675 | if (__root->__left_) { |
| 668 | if (std::__tree_iterate_from_root<_Reference>(__break, static_cast<_NodePtr>(__root->__left_), __func, __proj)) | 676 | if (std::__tree_iterate_from_root<_Reference>(__break, static_cast<_NodePtr>(__root->__left_), __func, __proj)) |
| 669 | return true; | 677 | return true; |
| ... | @@ -678,7 +686,7 @@ bool __tree_iterate_from_root(_Break __break, _NodePtr __root, _Func& __func, _P | ... | @@ -678,7 +686,7 @@ bool __tree_iterate_from_root(_Break __break, _NodePtr __root, _Func& __func, _P |
| 678 | 686 | ||
| 679 | // Do an in-order traversal of the tree from __first to __last. | 687 | // Do an in-order traversal of the tree from __first to __last. |
| 680 | template <class _NodeIter, class _Func, class _Proj> | 688 | template <class _NodeIter, class _Func, class _Proj> |
| 681 | _LIBCPP_HIDE_FROM_ABI void | 689 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 682 | __tree_iterate_subrange(_NodeIter __first_it, _NodeIter __last_it, _Func& __func, _Proj& __proj) { | 690 | __tree_iterate_subrange(_NodeIter __first_it, _NodeIter __last_it, _Func& __func, _Proj& __proj) { |
| 683 | using _NodePtr = typename _NodeIter::__node_pointer; | 691 | using _NodePtr = typename _NodeIter::__node_pointer; |
| 684 | using _Reference = typename _NodeIter::reference; | 692 | using _Reference = typename _NodeIter::reference; |
| ... | @@ -722,51 +730,57 @@ public: | ... | @@ -722,51 +730,57 @@ public: |
| 722 | using reference = value_type&; | 730 | using reference = value_type&; |
| 723 | using pointer = __rebind_pointer_t<_NodePtr, value_type>; | 731 | using pointer = __rebind_pointer_t<_NodePtr, value_type>; |
| 724 | 732 | ||
| 725 | _LIBCPP_HIDE_FROM_ABI __tree_iterator() _NOEXCEPT : __ptr_(nullptr) {} | 733 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator() _NOEXCEPT : __ptr_(nullptr) {} |
| 726 | 734 | ||
| 727 | _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__get_value(); } | 735 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return __get_np()->__get_value(); } |
| 728 | _LIBCPP_HIDE_FROM_ABI pointer operator->() const { | 736 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const { |
| 729 | return pointer_traits<pointer>::pointer_to(__get_np()->__get_value()); | 737 | return pointer_traits<pointer>::pointer_to(__get_np()->__get_value()); |
| 730 | } | 738 | } |
| 731 | 739 | ||
| 732 | _LIBCPP_HIDE_FROM_ABI __tree_iterator& operator++() { | 740 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator& operator++() { |
| 733 | __ptr_ = std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)); | 741 | __ptr_ = std::__tree_next_iter<__end_node_pointer>(std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr_)); |
| 734 | return *this; | 742 | return *this; |
| 735 | } | 743 | } |
| 736 | _LIBCPP_HIDE_FROM_ABI __tree_iterator operator++(int) { | 744 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator operator++(int) { |
| 737 | __tree_iterator __t(*this); | 745 | __tree_iterator __t(*this); |
| 738 | ++(*this); | 746 | ++(*this); |
| 739 | return __t; | 747 | return __t; |
| 740 | } | 748 | } |
| 741 | 749 | ||
| 742 | _LIBCPP_HIDE_FROM_ABI __tree_iterator& operator--() { | 750 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator& operator--() { |
| 743 | __ptr_ = static_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_)); | 751 | __ptr_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_)); |
| 744 | return *this; | 752 | return *this; |
| 745 | } | 753 | } |
| 746 | _LIBCPP_HIDE_FROM_ABI __tree_iterator operator--(int) { | 754 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator operator--(int) { |
| 747 | __tree_iterator __t(*this); | 755 | __tree_iterator __t(*this); |
| 748 | --(*this); | 756 | --(*this); |
| 749 | return __t; | 757 | return __t; |
| 750 | } | 758 | } |
| 751 | 759 | ||
| 752 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __tree_iterator& __x, const __tree_iterator& __y) { | 760 | friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 761 | operator==(const __tree_iterator& __x, const __tree_iterator& __y) { | ||
| 753 | return __x.__ptr_ == __y.__ptr_; | 762 | return __x.__ptr_ == __y.__ptr_; |
| 754 | } | 763 | } |
| 755 | friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y) { | 764 | friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 765 | operator!=(const __tree_iterator& __x, const __tree_iterator& __y) { | ||
| 756 | return !(__x == __y); | 766 | return !(__x == __y); |
| 757 | } | 767 | } |
| 758 | 768 | ||
| 759 | private: | 769 | private: |
| 760 | _LIBCPP_HIDE_FROM_ABI explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} | 770 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_iterator(__node_pointer __p) _NOEXCEPT |
| 761 | _LIBCPP_HIDE_FROM_ABI explicit __tree_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {} | 771 | : __ptr_(std::__static_fancy_pointer_cast<__end_node_pointer>(__p)) {} |
| 762 | _LIBCPP_HIDE_FROM_ABI __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); } | 772 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_iterator(__end_node_pointer __p) _NOEXCEPT |
| 773 | : __ptr_(__p) {} | ||
| 774 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __get_np() const { | ||
| 775 | return std::__static_fancy_pointer_cast<__node_pointer>(__ptr_); | ||
| 776 | } | ||
| 763 | template <class, class, class> | 777 | template <class, class, class> |
| 764 | friend class __tree; | 778 | friend class __tree; |
| 765 | template <class, class, class> | 779 | template <class, class, class> |
| 766 | friend class __tree_const_iterator; | 780 | friend class __tree_const_iterator; |
| 767 | 781 | ||
| 768 | template <class _NodeIter, class _Func, class _Proj> | 782 | template <class _NodeIter, class _Func, class _Proj> |
| 769 | friend void __tree_iterate_subrange(_NodeIter, _NodeIter, _Func&, _Proj&); | 783 | _LIBCPP_CONSTEXPR_SINCE_CXX26 friend void __tree_iterate_subrange(_NodeIter, _NodeIter, _Func&, _Proj&); |
| 770 | }; | 784 | }; |
| 771 | 785 | ||
| 772 | #ifndef _LIBCPP_CXX03_LANG | 786 | #ifndef _LIBCPP_CXX03_LANG |
| ... | @@ -780,7 +794,8 @@ struct __specialized_algorithm< | ... | @@ -780,7 +794,8 @@ struct __specialized_algorithm< |
| 780 | using __iterator _LIBCPP_NODEBUG = __tree_iterator<_Tp, _NodePtr, _DiffType>; | 794 | using __iterator _LIBCPP_NODEBUG = __tree_iterator<_Tp, _NodePtr, _DiffType>; |
| 781 | 795 | ||
| 782 | template <class _Func, class _Proj> | 796 | template <class _Func, class _Proj> |
| 783 | _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Func& __func, _Proj& __proj) { | 797 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void |
| 798 | operator()(__iterator __first, __iterator __last, _Func& __func, _Proj& __proj) { | ||
| 784 | std::__tree_iterate_subrange(__first, __last, __func, __proj); | 799 | std::__tree_iterate_subrange(__first, __last, __func, __proj); |
| 785 | } | 800 | } |
| 786 | }; | 801 | }; |
| ... | @@ -804,54 +819,61 @@ public: | ... | @@ -804,54 +819,61 @@ public: |
| 804 | using pointer = __rebind_pointer_t<_NodePtr, const value_type>; | 819 | using pointer = __rebind_pointer_t<_NodePtr, const value_type>; |
| 805 | using __non_const_iterator _LIBCPP_NODEBUG = __tree_iterator<_Tp, __node_pointer, difference_type>; | 820 | using __non_const_iterator _LIBCPP_NODEBUG = __tree_iterator<_Tp, __node_pointer, difference_type>; |
| 806 | 821 | ||
| 807 | _LIBCPP_HIDE_FROM_ABI __tree_const_iterator() _NOEXCEPT : __ptr_(nullptr) {} | 822 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator() _NOEXCEPT : __ptr_(nullptr) {} |
| 808 | 823 | ||
| 809 | _LIBCPP_HIDE_FROM_ABI __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT : __ptr_(__p.__ptr_) {} | 824 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT |
| 825 | : __ptr_(__p.__ptr_) {} | ||
| 810 | 826 | ||
| 811 | _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__get_value(); } | 827 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return __get_np()->__get_value(); } |
| 812 | _LIBCPP_HIDE_FROM_ABI pointer operator->() const { | 828 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const { |
| 813 | return pointer_traits<pointer>::pointer_to(__get_np()->__get_value()); | 829 | return pointer_traits<pointer>::pointer_to(__get_np()->__get_value()); |
| 814 | } | 830 | } |
| 815 | 831 | ||
| 816 | _LIBCPP_HIDE_FROM_ABI __tree_const_iterator& operator++() { | 832 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator& operator++() { |
| 817 | __ptr_ = std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)); | 833 | __ptr_ = std::__tree_next_iter<__end_node_pointer>(std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr_)); |
| 818 | return *this; | 834 | return *this; |
| 819 | } | 835 | } |
| 820 | 836 | ||
| 821 | _LIBCPP_HIDE_FROM_ABI __tree_const_iterator operator++(int) { | 837 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator operator++(int) { |
| 822 | __tree_const_iterator __t(*this); | 838 | __tree_const_iterator __t(*this); |
| 823 | ++(*this); | 839 | ++(*this); |
| 824 | return __t; | 840 | return __t; |
| 825 | } | 841 | } |
| 826 | 842 | ||
| 827 | _LIBCPP_HIDE_FROM_ABI __tree_const_iterator& operator--() { | 843 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator& operator--() { |
| 828 | __ptr_ = static_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_)); | 844 | __ptr_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_)); |
| 829 | return *this; | 845 | return *this; |
| 830 | } | 846 | } |
| 831 | 847 | ||
| 832 | _LIBCPP_HIDE_FROM_ABI __tree_const_iterator operator--(int) { | 848 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator operator--(int) { |
| 833 | __tree_const_iterator __t(*this); | 849 | __tree_const_iterator __t(*this); |
| 834 | --(*this); | 850 | --(*this); |
| 835 | return __t; | 851 | return __t; |
| 836 | } | 852 | } |
| 837 | 853 | ||
| 838 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y) { | 854 | friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 855 | operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y) { | ||
| 839 | return __x.__ptr_ == __y.__ptr_; | 856 | return __x.__ptr_ == __y.__ptr_; |
| 840 | } | 857 | } |
| 841 | friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y) { | 858 | friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 859 | operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y) { | ||
| 842 | return !(__x == __y); | 860 | return !(__x == __y); |
| 843 | } | 861 | } |
| 844 | 862 | ||
| 845 | private: | 863 | private: |
| 846 | _LIBCPP_HIDE_FROM_ABI explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} | 864 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT |
| 847 | _LIBCPP_HIDE_FROM_ABI explicit __tree_const_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {} | 865 | : __ptr_(std::__static_fancy_pointer_cast<__end_node_pointer>(__p)) {} |
| 848 | _LIBCPP_HIDE_FROM_ABI __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); } | 866 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_const_iterator(__end_node_pointer __p) _NOEXCEPT |
| 867 | : __ptr_(std::__static_fancy_pointer_cast<__end_node_pointer>(__p)) {} | ||
| 868 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __get_np() const { | ||
| 869 | return std::__static_fancy_pointer_cast<__node_pointer>(__ptr_); | ||
| 870 | } | ||
| 849 | 871 | ||
| 850 | template <class, class, class> | 872 | template <class, class, class> |
| 851 | friend class __tree; | 873 | friend class __tree; |
| 852 | 874 | ||
| 853 | template <class _NodeIter, class _Func, class _Proj> | 875 | template <class _NodeIter, class _Func, class _Proj> |
| 854 | friend void __tree_iterate_subrange(_NodeIter, _NodeIter, _Func&, _Proj&); | 876 | _LIBCPP_CONSTEXPR_SINCE_CXX26 friend void __tree_iterate_subrange(_NodeIter, _NodeIter, _Func&, _Proj&); |
| 855 | }; | 877 | }; |
| 856 | 878 | ||
| 857 | #ifndef _LIBCPP_CXX03_LANG | 879 | #ifndef _LIBCPP_CXX03_LANG |
| ... | @@ -865,7 +887,8 @@ struct __specialized_algorithm< | ... | @@ -865,7 +887,8 @@ struct __specialized_algorithm< |
| 865 | using __iterator _LIBCPP_NODEBUG = __tree_const_iterator<_Tp, _NodePtr, _DiffType>; | 887 | using __iterator _LIBCPP_NODEBUG = __tree_const_iterator<_Tp, _NodePtr, _DiffType>; |
| 866 | 888 | ||
| 867 | template <class _Func, class _Proj> | 889 | template <class _Func, class _Proj> |
| 868 | _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Func& __func, _Proj& __proj) { | 890 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void |
| 891 | operator()(__iterator __first, __iterator __last, _Func& __func, _Proj& __proj) { | ||
| 869 | std::__tree_iterate_subrange(__first, __last, __func, __proj); | 892 | std::__tree_iterate_subrange(__first, __last, __func, __proj); |
| 870 | } | 893 | } |
| 871 | }; | 894 | }; |
| ... | @@ -927,98 +950,114 @@ private: | ... | @@ -927,98 +950,114 @@ private: |
| 927 | _LIBCPP_COMPRESSED_PAIR(size_type, __size_, value_compare, __value_comp_); | 950 | _LIBCPP_COMPRESSED_PAIR(size_type, __size_, value_compare, __value_comp_); |
| 928 | 951 | ||
| 929 | public: | 952 | public: |
| 930 | _LIBCPP_HIDE_FROM_ABI __end_node_pointer __end_node() _NOEXCEPT { | 953 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __end_node_pointer __end_node() _NOEXCEPT { |
| 931 | return pointer_traits<__end_node_pointer>::pointer_to(__end_node_); | 954 | return pointer_traits<__end_node_pointer>::pointer_to(__end_node_); |
| 932 | } | 955 | } |
| 933 | _LIBCPP_HIDE_FROM_ABI __end_node_pointer __end_node() const _NOEXCEPT { | 956 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __end_node_pointer __end_node() const _NOEXCEPT { |
| 934 | return pointer_traits<__end_node_pointer>::pointer_to(const_cast<__end_node_t&>(__end_node_)); | 957 | return pointer_traits<__end_node_pointer>::pointer_to(const_cast<__end_node_t&>(__end_node_)); |
| 935 | } | 958 | } |
| 936 | _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __node_alloc_; } | 959 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_allocator& __node_alloc() _NOEXCEPT { |
| 960 | return __node_alloc_; | ||
| 961 | } | ||
| 937 | 962 | ||
| 938 | private: | 963 | private: |
| 939 | _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __node_alloc_; } | 964 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const __node_allocator& __node_alloc() const _NOEXCEPT { |
| 965 | return __node_alloc_; | ||
| 966 | } | ||
| 940 | 967 | ||
| 941 | public: | 968 | public: |
| 942 | _LIBCPP_HIDE_FROM_ABI allocator_type __alloc() const _NOEXCEPT { return allocator_type(__node_alloc()); } | 969 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type __alloc() const _NOEXCEPT { |
| 970 | return allocator_type(__node_alloc()); | ||
| 971 | } | ||
| 943 | 972 | ||
| 944 | _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; } | 973 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT { return __size_; } |
| 945 | _LIBCPP_HIDE_FROM_ABI value_compare& value_comp() _NOEXCEPT { return __value_comp_; } | 974 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare& value_comp() _NOEXCEPT { return __value_comp_; } |
| 946 | _LIBCPP_HIDE_FROM_ABI const value_compare& value_comp() const _NOEXCEPT { return __value_comp_; } | 975 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const value_compare& value_comp() const _NOEXCEPT { |
| 976 | return __value_comp_; | ||
| 977 | } | ||
| 947 | 978 | ||
| 948 | public: | 979 | public: |
| 949 | _LIBCPP_HIDE_FROM_ABI __node_pointer __root() const _NOEXCEPT { | 980 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __root() const _NOEXCEPT { |
| 950 | return static_cast<__node_pointer>(__end_node()->__left_); | 981 | return std::__static_fancy_pointer_cast<__node_pointer>(__end_node()->__left_); |
| 951 | } | 982 | } |
| 952 | 983 | ||
| 953 | _LIBCPP_HIDE_FROM_ABI __node_base_pointer* __root_ptr() const _NOEXCEPT { | 984 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer* __root_ptr() const _NOEXCEPT { |
| 954 | return std::addressof(__end_node()->__left_); | 985 | return std::addressof(__end_node()->__left_); |
| 955 | } | 986 | } |
| 956 | 987 | ||
| 957 | using iterator = __tree_iterator<_Tp, __node_pointer, difference_type>; | 988 | using iterator = __tree_iterator<_Tp, __node_pointer, difference_type>; |
| 958 | using const_iterator = __tree_const_iterator<_Tp, __node_pointer, difference_type>; | 989 | using const_iterator = __tree_const_iterator<_Tp, __node_pointer, difference_type>; |
| 959 | 990 | ||
| 960 | _LIBCPP_HIDE_FROM_ABI explicit __tree(const value_compare& __comp) _NOEXCEPT_( | 991 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree(const value_compare& __comp) _NOEXCEPT_( |
| 961 | is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value) | 992 | is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value) |
| 962 | : __size_(0), __value_comp_(__comp) { | 993 | : __size_(0), __value_comp_(__comp) { |
| 963 | __begin_node_ = __end_node(); | 994 | __begin_node_ = __end_node(); |
| 964 | } | 995 | } |
| 965 | 996 | ||
| 966 | _LIBCPP_HIDE_FROM_ABI explicit __tree(const allocator_type& __a) | 997 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree(const allocator_type& __a) |
| 967 | : __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0) { | 998 | : __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0) { |
| 968 | __begin_node_ = __end_node(); | 999 | __begin_node_ = __end_node(); |
| 969 | } | 1000 | } |
| 970 | 1001 | ||
| 971 | _LIBCPP_HIDE_FROM_ABI __tree(const value_compare& __comp, const allocator_type& __a) | 1002 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(const value_compare& __comp, const allocator_type& __a) |
| 972 | : __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0), __value_comp_(__comp) { | 1003 | : __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0), __value_comp_(__comp) { |
| 973 | __begin_node_ = __end_node(); | 1004 | __begin_node_ = __end_node(); |
| 974 | } | 1005 | } |
| 975 | 1006 | ||
| 976 | _LIBCPP_HIDE_FROM_ABI __tree(const __tree& __t); | 1007 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(const __tree& __t); |
| 977 | 1008 | ||
| 978 | _LIBCPP_HIDE_FROM_ABI __tree(const __tree& __other, const allocator_type& __alloc) | 1009 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(const __tree& __other, const allocator_type& __alloc) |
| 979 | : __begin_node_(__end_node()), __node_alloc_(__alloc), __size_(0), __value_comp_(__other.value_comp()) { | 1010 | : __begin_node_(__end_node()), __node_alloc_(__alloc), __size_(0), __value_comp_(__other.value_comp()) { |
| 980 | if (__other.size() == 0) | 1011 | if (__other.size() == 0) |
| 981 | return; | 1012 | return; |
| 982 | 1013 | ||
| 983 | *__root_ptr() = static_cast<__node_base_pointer>(__copy_construct_tree(__other.__root())); | 1014 | *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_construct_tree(__other.__root())); |
| 984 | __root()->__parent_ = __end_node(); | 1015 | __root()->__parent_ = __end_node(); |
| 985 | __begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)); | 1016 | __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)); |
| 986 | __size_ = __other.size(); | 1017 | __size_ = __other.size(); |
| 987 | } | 1018 | } |
| 988 | 1019 | ||
| 989 | _LIBCPP_HIDE_FROM_ABI __tree& operator=(const __tree& __t); | 1020 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree& operator=(const __tree& __t); |
| 990 | template <class _ForwardIterator> | 1021 | template <class _ForwardIterator> |
| 991 | _LIBCPP_HIDE_FROM_ABI void __assign_unique(_ForwardIterator __first, _ForwardIterator __last); | 1022 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 992 | _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t) _NOEXCEPT_( | 1023 | __assign_unique(_ForwardIterator __first, _ForwardIterator __last); |
| 1024 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(__tree&& __t) _NOEXCEPT_( | ||
| 993 | is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value); | 1025 | is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value); |
| 994 | _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t, const allocator_type& __a); | 1026 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(__tree&& __t, const allocator_type& __a); |
| 995 | 1027 | ||
| 996 | _LIBCPP_HIDE_FROM_ABI __tree& operator=(__tree&& __t) | 1028 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree& operator=(__tree&& __t) |
| 997 | _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value && | 1029 | _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value && |
| 998 | ((__node_traits::propagate_on_container_move_assignment::value && | 1030 | ((__node_traits::propagate_on_container_move_assignment::value && |
| 999 | is_nothrow_move_assignable<__node_allocator>::value) || | 1031 | is_nothrow_move_assignable<__node_allocator>::value) || |
| 1000 | allocator_traits<__node_allocator>::is_always_equal::value)) { | 1032 | allocator_traits<__node_allocator>::is_always_equal::value)) { |
| 1001 | __move_assign(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>()); | 1033 | __move_assign(__t, |
| 1034 | integral_constant<bool, | ||
| 1035 | __node_traits::propagate_on_container_move_assignment::value || | ||
| 1036 | __node_traits::is_always_equal::value>()); | ||
| 1002 | return *this; | 1037 | return *this; |
| 1003 | } | 1038 | } |
| 1004 | 1039 | ||
| 1005 | _LIBCPP_HIDE_FROM_ABI ~__tree() { | 1040 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__tree() { |
| 1006 | static_assert(is_copy_constructible<value_compare>::value, "Comparator must be copy-constructible."); | 1041 | static_assert(is_copy_constructible<value_compare>::value, "Comparator must be copy-constructible."); |
| 1007 | destroy(__root()); | 1042 | destroy(__root()); |
| 1008 | } | 1043 | } |
| 1009 | 1044 | ||
| 1010 | _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return iterator(__begin_node_); } | 1045 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT { return iterator(__begin_node_); } |
| 1011 | _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return const_iterator(__begin_node_); } | 1046 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT { |
| 1012 | _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return iterator(__end_node()); } | 1047 | return const_iterator(__begin_node_); |
| 1013 | _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return const_iterator(__end_node()); } | 1048 | } |
| 1049 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT { return iterator(__end_node()); } | ||
| 1050 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT { | ||
| 1051 | return const_iterator(__end_node()); | ||
| 1052 | } | ||
| 1014 | 1053 | ||
| 1015 | _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { | 1054 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT { |
| 1016 | return std::min<size_type>(__node_traits::max_size(__node_alloc()), numeric_limits<difference_type >::max()); | 1055 | return std::min<size_type>(__node_traits::max_size(__node_alloc()), numeric_limits<difference_type >::max()); |
| 1017 | } | 1056 | } |
| 1018 | 1057 | ||
| 1019 | _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT; | 1058 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT; |
| 1020 | 1059 | ||
| 1021 | _LIBCPP_HIDE_FROM_ABI void swap(__tree& __t) | 1060 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(__tree& __t) |
| 1022 | #if _LIBCPP_STD_VER <= 11 | 1061 | #if _LIBCPP_STD_VER <= 11 |
| 1023 | _NOEXCEPT_(__is_nothrow_swappable_v<value_compare> && | 1062 | _NOEXCEPT_(__is_nothrow_swappable_v<value_compare> && |
| 1024 | (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)); | 1063 | (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)); |
| ... | @@ -1027,21 +1066,22 @@ public: | ... | @@ -1027,21 +1066,22 @@ public: |
| 1027 | #endif | 1066 | #endif |
| 1028 | 1067 | ||
| 1029 | template <class... _Args> | 1068 | template <class... _Args> |
| 1030 | _LIBCPP_HIDE_FROM_ABI iterator __emplace_multi(_Args&&... __args); | 1069 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __emplace_multi(_Args&&... __args); |
| 1031 | 1070 | ||
| 1032 | template <class... _Args> | 1071 | template <class... _Args> |
| 1033 | _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args); | 1072 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator |
| 1073 | __emplace_hint_multi(const_iterator __p, _Args&&... __args); | ||
| 1034 | 1074 | ||
| 1035 | template <class... _Args> | 1075 | template <class... _Args> |
| 1036 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Args&&... __args) { | 1076 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> __emplace_unique(_Args&&... __args) { |
| 1037 | return std::__try_key_extraction<key_type>( | 1077 | return std::__try_key_extraction<key_type>( |
| 1038 | [this](const key_type& __key, _Args&&... __args2) { | 1078 | [this](const key_type& __key, _Args&&... __args2) { |
| 1039 | auto [__parent, __child] = __find_equal(__key); | 1079 | auto [__parent, __child] = __find_equal(__key); |
| 1040 | __node_pointer __r = static_cast<__node_pointer>(__child); | 1080 | __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child); |
| 1041 | bool __inserted = false; | 1081 | bool __inserted = false; |
| 1042 | if (__child == nullptr) { | 1082 | if (__child == nullptr) { |
| 1043 | __node_holder __h = __construct_node(std::forward<_Args>(__args2)...); | 1083 | __node_holder __h = __construct_node(std::forward<_Args>(__args2)...); |
| 1044 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); | 1084 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get())); |
| 1045 | __r = __h.release(); | 1085 | __r = __h.release(); |
| 1046 | __inserted = true; | 1086 | __inserted = true; |
| 1047 | } | 1087 | } |
| ... | @@ -1050,10 +1090,10 @@ public: | ... | @@ -1050,10 +1090,10 @@ public: |
| 1050 | [this](_Args&&... __args2) { | 1090 | [this](_Args&&... __args2) { |
| 1051 | __node_holder __h = __construct_node(std::forward<_Args>(__args2)...); | 1091 | __node_holder __h = __construct_node(std::forward<_Args>(__args2)...); |
| 1052 | auto [__parent, __child] = __find_equal(__h->__get_value()); | 1092 | auto [__parent, __child] = __find_equal(__h->__get_value()); |
| 1053 | __node_pointer __r = static_cast<__node_pointer>(__child); | 1093 | __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child); |
| 1054 | bool __inserted = false; | 1094 | bool __inserted = false; |
| 1055 | if (__child == nullptr) { | 1095 | if (__child == nullptr) { |
| 1056 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); | 1096 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get())); |
| 1057 | __r = __h.release(); | 1097 | __r = __h.release(); |
| 1058 | __inserted = true; | 1098 | __inserted = true; |
| 1059 | } | 1099 | } |
| ... | @@ -1063,16 +1103,17 @@ public: | ... | @@ -1063,16 +1103,17 @@ public: |
| 1063 | } | 1103 | } |
| 1064 | 1104 | ||
| 1065 | template <class... _Args> | 1105 | template <class... _Args> |
| 1066 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_hint_unique(const_iterator __p, _Args&&... __args) { | 1106 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> |
| 1107 | __emplace_hint_unique(const_iterator __p, _Args&&... __args) { | ||
| 1067 | return std::__try_key_extraction<key_type>( | 1108 | return std::__try_key_extraction<key_type>( |
| 1068 | [this, __p](const key_type& __key, _Args&&... __args2) { | 1109 | [this, __p](const key_type& __key, _Args&&... __args2) { |
| 1069 | __node_base_pointer __dummy; | 1110 | __node_base_pointer __dummy; |
| 1070 | auto [__parent, __child] = __find_equal(__p, __dummy, __key); | 1111 | auto [__parent, __child] = __find_equal(__p, __dummy, __key); |
| 1071 | __node_pointer __r = static_cast<__node_pointer>(__child); | 1112 | __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child); |
| 1072 | bool __inserted = false; | 1113 | bool __inserted = false; |
| 1073 | if (__child == nullptr) { | 1114 | if (__child == nullptr) { |
| 1074 | __node_holder __h = __construct_node(std::forward<_Args>(__args2)...); | 1115 | __node_holder __h = __construct_node(std::forward<_Args>(__args2)...); |
| 1075 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); | 1116 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get())); |
| 1076 | __r = __h.release(); | 1117 | __r = __h.release(); |
| 1077 | __inserted = true; | 1118 | __inserted = true; |
| 1078 | } | 1119 | } |
| ... | @@ -1082,9 +1123,9 @@ public: | ... | @@ -1082,9 +1123,9 @@ public: |
| 1082 | __node_holder __h = __construct_node(std::forward<_Args>(__args2)...); | 1123 | __node_holder __h = __construct_node(std::forward<_Args>(__args2)...); |
| 1083 | __node_base_pointer __dummy; | 1124 | __node_base_pointer __dummy; |
| 1084 | auto [__parent, __child] = __find_equal(__p, __dummy, __h->__get_value()); | 1125 | auto [__parent, __child] = __find_equal(__p, __dummy, __h->__get_value()); |
| 1085 | __node_pointer __r = static_cast<__node_pointer>(__child); | 1126 | __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child); |
| 1086 | if (__child == nullptr) { | 1127 | if (__child == nullptr) { |
| 1087 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); | 1128 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get())); |
| 1088 | __r = __h.release(); | 1129 | __r = __h.release(); |
| 1089 | } | 1130 | } |
| 1090 | return pair<iterator, bool>(iterator(__r), __child == nullptr); | 1131 | return pair<iterator, bool>(iterator(__r), __child == nullptr); |
| ... | @@ -1093,46 +1134,50 @@ public: | ... | @@ -1093,46 +1134,50 @@ public: |
| 1093 | } | 1134 | } |
| 1094 | 1135 | ||
| 1095 | template <class _InIter, class _Sent> | 1136 | template <class _InIter, class _Sent> |
| 1096 | _LIBCPP_HIDE_FROM_ABI void __insert_range_multi(_InIter __first, _Sent __last) { | 1137 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_range_multi(_InIter __first, _Sent __last) { |
| 1097 | if (__first == __last) | 1138 | if (__first == __last) |
| 1098 | return; | 1139 | return; |
| 1099 | 1140 | ||
| 1100 | if (__root() == nullptr) { // Make sure we always have a root node | 1141 | if (__root() == nullptr) { // Make sure we always have a root node |
| 1101 | __insert_node_at( | 1142 | __insert_node_at(__end_node(), |
| 1102 | __end_node(), __end_node()->__left_, static_cast<__node_base_pointer>(__construct_node(*__first).release())); | 1143 | __end_node()->__left_, |
| 1144 | std::__static_fancy_pointer_cast<__node_base_pointer>(__construct_node(*__first).release())); | ||
| 1103 | ++__first; | 1145 | ++__first; |
| 1104 | } | 1146 | } |
| 1105 | 1147 | ||
| 1106 | auto __max_node = static_cast<__node_pointer>(std::__tree_max(static_cast<__node_base_pointer>(__root()))); | 1148 | auto __max_node = std::__static_fancy_pointer_cast<__node_pointer>( |
| 1149 | std::__tree_max(std::__static_fancy_pointer_cast<__node_base_pointer>(__root()))); | ||
| 1107 | 1150 | ||
| 1108 | for (; __first != __last; ++__first) { | 1151 | for (; __first != __last; ++__first) { |
| 1109 | __node_holder __nd = __construct_node(*__first); | 1152 | __node_holder __nd = __construct_node(*__first); |
| 1110 | // Always check the max node first. This optimizes for sorted ranges inserted at the end. | 1153 | // Always check the max node first. This optimizes for sorted ranges inserted at the end. |
| 1111 | if (!value_comp()(__nd->__get_value(), __max_node->__get_value())) { // __node >= __max_val | 1154 | if (!value_comp()(__nd->__get_value(), __max_node->__get_value())) { // __node >= __max_val |
| 1112 | __insert_node_at(static_cast<__end_node_pointer>(__max_node), | 1155 | __insert_node_at(std::__static_fancy_pointer_cast<__end_node_pointer>(__max_node), |
| 1113 | __max_node->__right_, | 1156 | __max_node->__right_, |
| 1114 | static_cast<__node_base_pointer>(__nd.get())); | 1157 | std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.get())); |
| 1115 | __max_node = __nd.release(); | 1158 | __max_node = __nd.release(); |
| 1116 | } else { | 1159 | } else { |
| 1117 | __end_node_pointer __parent; | 1160 | __end_node_pointer __parent; |
| 1118 | __node_base_pointer& __child = __find_leaf_high(__parent, __nd->__get_value()); | 1161 | __node_base_pointer& __child = __find_leaf_high(__parent, __nd->__get_value()); |
| 1119 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release())); | 1162 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.release())); |
| 1120 | } | 1163 | } |
| 1121 | } | 1164 | } |
| 1122 | } | 1165 | } |
| 1123 | 1166 | ||
| 1124 | template <class _InIter, class _Sent> | 1167 | template <class _InIter, class _Sent> |
| 1125 | _LIBCPP_HIDE_FROM_ABI void __insert_range_unique(_InIter __first, _Sent __last) { | 1168 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_range_unique(_InIter __first, _Sent __last) { |
| 1126 | if (__first == __last) | 1169 | if (__first == __last) |
| 1127 | return; | 1170 | return; |
| 1128 | 1171 | ||
| 1129 | if (__root() == nullptr) { | 1172 | if (__root() == nullptr) { |
| 1130 | __insert_node_at( | 1173 | __insert_node_at(__end_node(), |
| 1131 | __end_node(), __end_node()->__left_, static_cast<__node_base_pointer>(__construct_node(*__first).release())); | 1174 | __end_node()->__left_, |
| 1175 | std::__static_fancy_pointer_cast<__node_base_pointer>(__construct_node(*__first).release())); | ||
| 1132 | ++__first; | 1176 | ++__first; |
| 1133 | } | 1177 | } |
| 1134 | 1178 | ||
| 1135 | auto __max_node = static_cast<__node_pointer>(std::__tree_max(static_cast<__node_base_pointer>(__root()))); | 1179 | auto __max_node = std::__static_fancy_pointer_cast<__node_pointer>( |
| 1180 | std::__tree_max(std::__static_fancy_pointer_cast<__node_base_pointer>(__root()))); | ||
| 1136 | 1181 | ||
| 1137 | using __reference = decltype(*__first); | 1182 | using __reference = decltype(*__first); |
| 1138 | 1183 | ||
| ... | @@ -1141,29 +1186,31 @@ public: | ... | @@ -1141,29 +1186,31 @@ public: |
| 1141 | [this, &__max_node](const key_type& __key, __reference&& __val) { | 1186 | [this, &__max_node](const key_type& __key, __reference&& __val) { |
| 1142 | if (value_comp()(__max_node->__get_value(), __key)) { // __key > __max_node | 1187 | if (value_comp()(__max_node->__get_value(), __key)) { // __key > __max_node |
| 1143 | __node_holder __nd = __construct_node(std::forward<__reference>(__val)); | 1188 | __node_holder __nd = __construct_node(std::forward<__reference>(__val)); |
| 1144 | __insert_node_at(static_cast<__end_node_pointer>(__max_node), | 1189 | __insert_node_at(std::__static_fancy_pointer_cast<__end_node_pointer>(__max_node), |
| 1145 | __max_node->__right_, | 1190 | __max_node->__right_, |
| 1146 | static_cast<__node_base_pointer>(__nd.get())); | 1191 | std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.get())); |
| 1147 | __max_node = __nd.release(); | 1192 | __max_node = __nd.release(); |
| 1148 | } else { | 1193 | } else { |
| 1149 | auto [__parent, __child] = __find_equal(__key); | 1194 | auto [__parent, __child] = __find_equal(__key); |
| 1150 | if (__child == nullptr) { | 1195 | if (__child == nullptr) { |
| 1151 | __node_holder __nd = __construct_node(std::forward<__reference>(__val)); | 1196 | __node_holder __nd = __construct_node(std::forward<__reference>(__val)); |
| 1152 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release())); | 1197 | __insert_node_at( |
| 1198 | __parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.release())); | ||
| 1153 | } | 1199 | } |
| 1154 | } | 1200 | } |
| 1155 | }, | 1201 | }, |
| 1156 | [this, &__max_node](__reference&& __val) { | 1202 | [this, &__max_node](__reference&& __val) { |
| 1157 | __node_holder __nd = __construct_node(std::forward<__reference>(__val)); | 1203 | __node_holder __nd = __construct_node(std::forward<__reference>(__val)); |
| 1158 | if (value_comp()(__max_node->__get_value(), __nd->__get_value())) { // __node > __max_node | 1204 | if (value_comp()(__max_node->__get_value(), __nd->__get_value())) { // __node > __max_node |
| 1159 | __insert_node_at(static_cast<__end_node_pointer>(__max_node), | 1205 | __insert_node_at(std::__static_fancy_pointer_cast<__end_node_pointer>(__max_node), |
| 1160 | __max_node->__right_, | 1206 | __max_node->__right_, |
| 1161 | static_cast<__node_base_pointer>(__nd.get())); | 1207 | std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.get())); |
| 1162 | __max_node = __nd.release(); | 1208 | __max_node = __nd.release(); |
| 1163 | } else { | 1209 | } else { |
| 1164 | auto [__parent, __child] = __find_equal(__nd->__get_value()); | 1210 | auto [__parent, __child] = __find_equal(__nd->__get_value()); |
| 1165 | if (__child == nullptr) { | 1211 | if (__child == nullptr) { |
| 1166 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release())); | 1212 | __insert_node_at( |
| 1213 | __parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.release())); | ||
| 1167 | } | 1214 | } |
| 1168 | } | 1215 | } |
| 1169 | }, | 1216 | }, |
| ... | @@ -1171,62 +1218,67 @@ public: | ... | @@ -1171,62 +1218,67 @@ public: |
| 1171 | } | 1218 | } |
| 1172 | } | 1219 | } |
| 1173 | 1220 | ||
| 1174 | _LIBCPP_HIDE_FROM_ABI iterator __remove_node_pointer(__node_pointer) _NOEXCEPT; | 1221 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __remove_node_pointer(__node_pointer) _NOEXCEPT; |
| 1175 | 1222 | ||
| 1176 | #if _LIBCPP_STD_VER >= 17 | 1223 | #if _LIBCPP_STD_VER >= 17 |
| 1177 | template <class _NodeHandle, class _InsertReturnType> | 1224 | template <class _NodeHandle, class _InsertReturnType> |
| 1178 | _LIBCPP_HIDE_FROM_ABI _InsertReturnType __node_handle_insert_unique(_NodeHandle&&); | 1225 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _InsertReturnType __node_handle_insert_unique(_NodeHandle&&); |
| 1179 | template <class _NodeHandle> | 1226 | template <class _NodeHandle> |
| 1180 | _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_unique(const_iterator, _NodeHandle&&); | 1227 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator |
| 1228 | __node_handle_insert_unique(const_iterator, _NodeHandle&&); | ||
| 1181 | template <class _Comp2> | 1229 | template <class _Comp2> |
| 1182 | _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source); | 1230 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1231 | __node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source); | ||
| 1183 | 1232 | ||
| 1184 | template <class _NodeHandle> | 1233 | template <class _NodeHandle> |
| 1185 | _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(_NodeHandle&&); | 1234 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __node_handle_insert_multi(_NodeHandle&&); |
| 1186 | template <class _NodeHandle> | 1235 | template <class _NodeHandle> |
| 1187 | _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(const_iterator, _NodeHandle&&); | 1236 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator |
| 1237 | __node_handle_insert_multi(const_iterator, _NodeHandle&&); | ||
| 1188 | template <class _Comp2> | 1238 | template <class _Comp2> |
| 1189 | _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source); | 1239 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1240 | __node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source); | ||
| 1190 | 1241 | ||
| 1191 | template <class _NodeHandle> | 1242 | template <class _NodeHandle> |
| 1192 | _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(key_type const&); | 1243 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle __node_handle_extract(key_type const&); |
| 1193 | template <class _NodeHandle> | 1244 | template <class _NodeHandle> |
| 1194 | _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(const_iterator); | 1245 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle __node_handle_extract(const_iterator); |
| 1195 | #endif | 1246 | #endif |
| 1196 | 1247 | ||
| 1197 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p); | 1248 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p); |
| 1198 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l); | 1249 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l); |
| 1199 | template <class _Key> | 1250 | template <class _Key> |
| 1200 | _LIBCPP_HIDE_FROM_ABI size_type __erase_unique(const _Key& __k); | 1251 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __erase_unique(const _Key& __k); |
| 1201 | template <class _Key> | 1252 | template <class _Key> |
| 1202 | _LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k); | 1253 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __erase_multi(const _Key& __k); |
| 1203 | 1254 | ||
| 1204 | _LIBCPP_HIDE_FROM_ABI void | 1255 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1205 | __insert_node_at(__end_node_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT; | 1256 | __insert_node_at(__end_node_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT; |
| 1206 | 1257 | ||
| 1207 | template <class _Key> | 1258 | template <class _Key> |
| 1208 | _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __key) { | 1259 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _Key& __key) { |
| 1209 | auto [__, __match] = __find_equal(__key); | 1260 | auto [__dummy, __match] = __find_equal(__key); |
| 1210 | if (__match == nullptr) | 1261 | if (__match == nullptr) |
| 1211 | return end(); | 1262 | return end(); |
| 1212 | return iterator(static_cast<__node_pointer>(__match)); | 1263 | return iterator(std::__static_fancy_pointer_cast<__node_pointer>(__match)); |
| 1213 | } | 1264 | } |
| 1214 | 1265 | ||
| 1215 | template <class _Key> | 1266 | template <class _Key> |
| 1216 | _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __key) const { | 1267 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _Key& __key) const { |
| 1217 | auto [__, __match] = __find_equal(__key); | 1268 | auto [__dummy, __match] = __find_equal(__key); |
| 1218 | if (__match == nullptr) | 1269 | if (__match == nullptr) |
| 1219 | return end(); | 1270 | return end(); |
| 1220 | return const_iterator(static_cast<__node_pointer>(__match)); | 1271 | return const_iterator(std::__static_fancy_pointer_cast<__node_pointer>(__match)); |
| 1221 | } | 1272 | } |
| 1222 | 1273 | ||
| 1223 | template <class _Key> | 1274 | template <class _Key> |
| 1224 | _LIBCPP_HIDE_FROM_ABI size_type __count_unique(const _Key& __k) const; | 1275 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __count_unique(const _Key& __k) const; |
| 1225 | template <class _Key> | 1276 | template <class _Key> |
| 1226 | _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const; | 1277 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __count_multi(const _Key& __k) const; |
| 1227 | 1278 | ||
| 1228 | template <bool _LowerBound, class _Key> | 1279 | template <bool _LowerBound, class _Key> |
| 1229 | _LIBCPP_HIDE_FROM_ABI __end_node_pointer __lower_upper_bound_unique_impl(const _Key& __v) const { | 1280 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __end_node_pointer |
| 1281 | __lower_upper_bound_unique_impl(const _Key& __v) const { | ||
| 1230 | auto __rt = __root(); | 1282 | auto __rt = __root(); |
| 1231 | auto __result = __end_node(); | 1283 | auto __result = __end_node(); |
| 1232 | auto __comp = __lazy_synth_three_way_comparator<_Compare, _Key, value_type>(value_comp()); | 1284 | auto __comp = __lazy_synth_three_way_comparator<_Compare, _Key, value_type>(value_comp()); |
| ... | @@ -1234,14 +1286,15 @@ public: | ... | @@ -1234,14 +1286,15 @@ public: |
| 1234 | auto __comp_res = __comp(__v, __rt->__get_value()); | 1286 | auto __comp_res = __comp(__v, __rt->__get_value()); |
| 1235 | 1287 | ||
| 1236 | if (__comp_res.__less()) { | 1288 | if (__comp_res.__less()) { |
| 1237 | __result = static_cast<__end_node_pointer>(__rt); | 1289 | __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt); |
| 1238 | __rt = static_cast<__node_pointer>(__rt->__left_); | 1290 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_); |
| 1239 | } else if (__comp_res.__greater()) { | 1291 | } else if (__comp_res.__greater()) { |
| 1240 | __rt = static_cast<__node_pointer>(__rt->__right_); | 1292 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_); |
| 1241 | } else if _LIBCPP_CONSTEXPR (_LowerBound) { | 1293 | } else if _LIBCPP_CONSTEXPR (_LowerBound) { |
| 1242 | return static_cast<__end_node_pointer>(__rt); | 1294 | return std::__static_fancy_pointer_cast<__end_node_pointer>(__rt); |
| 1243 | } else { | 1295 | } else { |
| 1244 | return __rt->__right_ ? static_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) : __result; | 1296 | return __rt->__right_ ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) |
| 1297 | : __result; | ||
| 1245 | } | 1298 | } |
| 1246 | } | 1299 | } |
| 1247 | return __result; | 1300 | return __result; |
| ... | @@ -1282,7 +1335,7 @@ public: | ... | @@ -1282,7 +1335,7 @@ public: |
| 1282 | #endif // _LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND | 1335 | #endif // _LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND |
| 1283 | 1336 | ||
| 1284 | template <class _Key> | 1337 | template <class _Key> |
| 1285 | _LIBCPP_HIDE_FROM_ABI iterator __lower_bound_unique(const _Key& __v) { | 1338 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __lower_bound_unique(const _Key& __v) { |
| 1286 | #if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND) | 1339 | #if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND) |
| 1287 | return iterator(__lower_bound_unique_compat_impl(__v)); | 1340 | return iterator(__lower_bound_unique_compat_impl(__v)); |
| 1288 | #else | 1341 | #else |
| ... | @@ -1291,7 +1344,7 @@ public: | ... | @@ -1291,7 +1344,7 @@ public: |
| 1291 | } | 1344 | } |
| 1292 | 1345 | ||
| 1293 | template <class _Key> | 1346 | template <class _Key> |
| 1294 | _LIBCPP_HIDE_FROM_ABI const_iterator __lower_bound_unique(const _Key& __v) const { | 1347 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __lower_bound_unique(const _Key& __v) const { |
| 1295 | #if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND) | 1348 | #if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND) |
| 1296 | return const_iterator(__lower_bound_unique_compat_impl(__v)); | 1349 | return const_iterator(__lower_bound_unique_compat_impl(__v)); |
| 1297 | #else | 1350 | #else |
| ... | @@ -1300,7 +1353,7 @@ public: | ... | @@ -1300,7 +1353,7 @@ public: |
| 1300 | } | 1353 | } |
| 1301 | 1354 | ||
| 1302 | template <class _Key> | 1355 | template <class _Key> |
| 1303 | _LIBCPP_HIDE_FROM_ABI iterator __upper_bound_unique(const _Key& __v) { | 1356 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __upper_bound_unique(const _Key& __v) { |
| 1304 | #if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND) | 1357 | #if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND) |
| 1305 | return iterator(__upper_bound_unique_compat_impl(__v)); | 1358 | return iterator(__upper_bound_unique_compat_impl(__v)); |
| 1306 | #else | 1359 | #else |
| ... | @@ -1309,7 +1362,7 @@ public: | ... | @@ -1309,7 +1362,7 @@ public: |
| 1309 | } | 1362 | } |
| 1310 | 1363 | ||
| 1311 | template <class _Key> | 1364 | template <class _Key> |
| 1312 | _LIBCPP_HIDE_FROM_ABI const_iterator __upper_bound_unique(const _Key& __v) const { | 1365 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __upper_bound_unique(const _Key& __v) const { |
| 1313 | #if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND) | 1366 | #if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND) |
| 1314 | return iterator(__upper_bound_unique_compat_impl(__v)); | 1367 | return iterator(__upper_bound_unique_compat_impl(__v)); |
| 1315 | #else | 1368 | #else |
| ... | @@ -1319,117 +1372,138 @@ public: | ... | @@ -1319,117 +1372,138 @@ public: |
| 1319 | 1372 | ||
| 1320 | private: | 1373 | private: |
| 1321 | template <class _Key> | 1374 | template <class _Key> |
| 1322 | _LIBCPP_HIDE_FROM_ABI iterator | 1375 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator |
| 1323 | __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result); | 1376 | __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result); |
| 1324 | 1377 | ||
| 1325 | template <class _Key> | 1378 | template <class _Key> |
| 1326 | _LIBCPP_HIDE_FROM_ABI const_iterator | 1379 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 1327 | __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const; | 1380 | __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const; |
| 1328 | 1381 | ||
| 1329 | public: | 1382 | public: |
| 1330 | template <class _Key> | 1383 | template <class _Key> |
| 1331 | _LIBCPP_HIDE_FROM_ABI iterator __lower_bound_multi(const _Key& __v) { | 1384 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __lower_bound_multi(const _Key& __v) { |
| 1332 | return __lower_bound_multi(__v, __root(), __end_node()); | 1385 | return __lower_bound_multi(__v, __root(), __end_node()); |
| 1333 | } | 1386 | } |
| 1334 | template <class _Key> | 1387 | template <class _Key> |
| 1335 | _LIBCPP_HIDE_FROM_ABI const_iterator __lower_bound_multi(const _Key& __v) const { | 1388 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __lower_bound_multi(const _Key& __v) const { |
| 1336 | return __lower_bound_multi(__v, __root(), __end_node()); | 1389 | return __lower_bound_multi(__v, __root(), __end_node()); |
| 1337 | } | 1390 | } |
| 1338 | 1391 | ||
| 1339 | template <class _Key> | 1392 | template <class _Key> |
| 1340 | _LIBCPP_HIDE_FROM_ABI iterator __upper_bound_multi(const _Key& __v) { | 1393 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __upper_bound_multi(const _Key& __v) { |
| 1341 | return __upper_bound_multi(__v, __root(), __end_node()); | 1394 | return __upper_bound_multi(__v, __root(), __end_node()); |
| 1342 | } | 1395 | } |
| 1343 | 1396 | ||
| 1344 | template <class _Key> | 1397 | template <class _Key> |
| 1345 | _LIBCPP_HIDE_FROM_ABI const_iterator __upper_bound_multi(const _Key& __v) const { | 1398 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __upper_bound_multi(const _Key& __v) const { |
| 1346 | return __upper_bound_multi(__v, __root(), __end_node()); | 1399 | return __upper_bound_multi(__v, __root(), __end_node()); |
| 1347 | } | 1400 | } |
| 1348 | 1401 | ||
| 1349 | private: | 1402 | private: |
| 1350 | template <class _Key> | 1403 | template <class _Key> |
| 1351 | _LIBCPP_HIDE_FROM_ABI iterator | 1404 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator |
| 1352 | __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result); | 1405 | __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result); |
| 1353 | 1406 | ||
| 1354 | template <class _Key> | 1407 | template <class _Key> |
| 1355 | _LIBCPP_HIDE_FROM_ABI const_iterator | 1408 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 1356 | __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const; | 1409 | __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const; |
| 1357 | 1410 | ||
| 1358 | public: | 1411 | public: |
| 1359 | template <class _Key> | 1412 | template <class _Key> |
| 1360 | _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_unique(const _Key& __k); | 1413 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> __equal_range_unique(const _Key& __k); |
| 1361 | template <class _Key> | 1414 | template <class _Key> |
| 1362 | _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_unique(const _Key& __k) const; | 1415 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator> |
| 1416 | __equal_range_unique(const _Key& __k) const; | ||
| 1363 | 1417 | ||
| 1364 | template <class _Key> | 1418 | template <class _Key> |
| 1365 | _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_multi(const _Key& __k); | 1419 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> __equal_range_multi(const _Key& __k); |
| 1366 | template <class _Key> | 1420 | template <class _Key> |
| 1367 | _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_multi(const _Key& __k) const; | 1421 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator> |
| 1422 | __equal_range_multi(const _Key& __k) const; | ||
| 1368 | 1423 | ||
| 1369 | using _Dp _LIBCPP_NODEBUG = __tree_node_destructor<__node_allocator>; | 1424 | using _Dp _LIBCPP_NODEBUG = __tree_node_destructor<__node_allocator>; |
| 1370 | using __node_holder _LIBCPP_NODEBUG = unique_ptr<__node, _Dp>; | 1425 | using __node_holder _LIBCPP_NODEBUG = unique_ptr<__node, _Dp>; |
| 1371 | 1426 | ||
| 1372 | _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT; | 1427 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_holder remove(const_iterator __p) _NOEXCEPT; |
| 1373 | 1428 | ||
| 1374 | // FIXME: Make this function const qualified. Unfortunately doing so | 1429 | // FIXME: Make this function const qualified. Unfortunately doing so |
| 1375 | // breaks existing code which uses non-const callable comparators. | 1430 | // breaks existing code which uses non-const callable comparators. |
| 1376 | template <class _Key> | 1431 | template <class _Key> |
| 1377 | _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&> __find_equal(const _Key& __v); | 1432 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<__end_node_pointer, __node_base_pointer&> |
| 1433 | __find_equal(const _Key& __v); | ||
| 1378 | 1434 | ||
| 1379 | template <class _Key> | 1435 | template <class _Key> |
| 1380 | _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&> __find_equal(const _Key& __v) const { | 1436 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<__end_node_pointer, __node_base_pointer&> |
| 1437 | __find_equal(const _Key& __v) const { | ||
| 1381 | return const_cast<__tree*>(this)->__find_equal(__v); | 1438 | return const_cast<__tree*>(this)->__find_equal(__v); |
| 1382 | } | 1439 | } |
| 1383 | 1440 | ||
| 1384 | template <class _Key> | 1441 | template <class _Key> |
| 1385 | _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&> | 1442 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<__end_node_pointer, __node_base_pointer&> |
| 1386 | __find_equal(const_iterator __hint, __node_base_pointer& __dummy, const _Key& __v); | 1443 | __find_equal(const_iterator __hint, __node_base_pointer& __dummy, const _Key& __v); |
| 1387 | 1444 | ||
| 1388 | _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree& __t) { | 1445 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __copy_assign_alloc(const __tree& __t) { |
| 1389 | __copy_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>()); | 1446 | __copy_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>()); |
| 1390 | } | 1447 | } |
| 1391 | 1448 | ||
| 1392 | _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree& __t, true_type) { | 1449 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __copy_assign_alloc(const __tree& __t, true_type) { |
| 1393 | if (__node_alloc() != __t.__node_alloc()) | 1450 | if (__node_alloc() != __t.__node_alloc()) |
| 1394 | clear(); | 1451 | clear(); |
| 1395 | __node_alloc() = __t.__node_alloc(); | 1452 | __node_alloc() = __t.__node_alloc(); |
| 1396 | } | 1453 | } |
| 1397 | _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree&, false_type) {} | 1454 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __copy_assign_alloc(const __tree&, false_type) {} |
| 1398 | 1455 | ||
| 1399 | private: | 1456 | private: |
| 1400 | _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_low(__end_node_pointer& __parent, const value_type& __v); | 1457 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer& |
| 1458 | __find_leaf_low(__end_node_pointer& __parent, const value_type& __v); | ||
| 1401 | 1459 | ||
| 1402 | _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_high(__end_node_pointer& __parent, const value_type& __v); | 1460 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer& |
| 1461 | __find_leaf_high(__end_node_pointer& __parent, const value_type& __v); | ||
| 1403 | 1462 | ||
| 1404 | _LIBCPP_HIDE_FROM_ABI __node_base_pointer& | 1463 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer& |
| 1405 | __find_leaf(const_iterator __hint, __end_node_pointer& __parent, const value_type& __v); | 1464 | __find_leaf(const_iterator __hint, __end_node_pointer& __parent, const value_type& __v); |
| 1406 | 1465 | ||
| 1407 | template <class... _Args> | 1466 | template <class... _Args> |
| 1408 | _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&&... __args); | 1467 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_holder __construct_node(_Args&&... __args); |
| 1409 | 1468 | ||
| 1410 | // TODO: Make this _LIBCPP_HIDE_FROM_ABI | 1469 | // TODO: Make this _LIBCPP_HIDE_FROM_ABI |
| 1411 | _LIBCPP_HIDDEN void destroy(__node_pointer __nd) _NOEXCEPT { (__tree_deleter(__node_alloc_))(__nd); } | 1470 | _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX26 void destroy(__node_pointer __nd) _NOEXCEPT { |
| 1471 | (__tree_deleter(__node_alloc_))(__nd); | ||
| 1472 | } | ||
| 1412 | 1473 | ||
| 1413 | _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, false_type); | 1474 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign(__tree& __t, false_type); |
| 1414 | _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, true_type) _NOEXCEPT_( | 1475 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign(__tree& __t, true_type) _NOEXCEPT_( |
| 1415 | is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value); | 1476 | is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value); |
| 1416 | 1477 | ||
| 1417 | _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree& __t) | 1478 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc(__tree& __t) |
| 1418 | _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value || | 1479 | _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value || |
| 1419 | is_nothrow_move_assignable<__node_allocator>::value) { | 1480 | is_nothrow_move_assignable<__node_allocator>::value) { |
| 1420 | __move_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>()); | 1481 | __move_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>()); |
| 1421 | } | 1482 | } |
| 1422 | 1483 | ||
| 1423 | _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree& __t, true_type) | 1484 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc(__tree& __t, true_type) |
| 1424 | _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) { | 1485 | _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) { |
| 1425 | __node_alloc() = std::move(__t.__node_alloc()); | 1486 | __node_alloc() = std::move(__t.__node_alloc()); |
| 1426 | } | 1487 | } |
| 1427 | _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {} | 1488 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {} |
| 1428 | 1489 | ||
| 1429 | template <class _From, class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0> | 1490 | template <class _From, class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0> |
| 1430 | _LIBCPP_HIDE_FROM_ABI static void __assign_value(__get_node_value_type_t<value_type>& __lhs, _From&& __rhs) { | 1491 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void |
| 1492 | __assign_value(__get_node_value_type_t<value_type>& __lhs, _From&& __rhs) { | ||
| 1431 | using __key_type = __remove_const_t<typename value_type::first_type>; | 1493 | using __key_type = __remove_const_t<typename value_type::first_type>; |
| 1432 | 1494 | ||
| 1495 | #if _LIBCPP_STD_VER >= 26 | ||
| 1496 | if constexpr (std::is_copy_constructible_v<decltype(__rhs.first)>) { | ||
| 1497 | // We need to replace the `const key_type` subobject by reconstruction during constant evaluation to avoid | ||
| 1498 | // undefined behavior. Currently, there is no constexpr-friend way to replacing a move-only key subobject. | ||
| 1499 | if consteval { | ||
| 1500 | std::destroy_at(std::addressof(__lhs)); | ||
| 1501 | std::construct_at(std::addressof(__lhs), __rhs.first, std::forward<_From>(__rhs).second); | ||
| 1502 | return; | ||
| 1503 | } | ||
| 1504 | } | ||
| 1505 | #endif | ||
| 1506 | |||
| 1433 | // This is technically UB, since the object was constructed as `const`. | 1507 | // This is technically UB, since the object was constructed as `const`. |
| 1434 | // Clang doesn't optimize on this currently though. | 1508 | // Clang doesn't optimize on this currently though. |
| 1435 | const_cast<__key_type&>(__lhs.first) = const_cast<__copy_cvref_t<_From, __key_type>&&>(__rhs.first); | 1509 | const_cast<__key_type&>(__lhs.first) = const_cast<__copy_cvref_t<_From, __key_type>&&>(__rhs.first); |
| ... | @@ -1437,7 +1511,7 @@ private: | ... | @@ -1437,7 +1511,7 @@ private: |
| 1437 | } | 1511 | } |
| 1438 | 1512 | ||
| 1439 | template <class _To, class _From, class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0> | 1513 | template <class _To, class _From, class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0> |
| 1440 | _LIBCPP_HIDE_FROM_ABI static void __assign_value(_To& __lhs, _From&& __rhs) { | 1514 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void __assign_value(_To& __lhs, _From&& __rhs) { |
| 1441 | __lhs = std::forward<_From>(__rhs); | 1515 | __lhs = std::forward<_From>(__rhs); |
| 1442 | } | 1516 | } |
| 1443 | 1517 | ||
| ... | @@ -1447,24 +1521,23 @@ private: | ... | @@ -1447,24 +1521,23 @@ private: |
| 1447 | public: | 1521 | public: |
| 1448 | using pointer = __node_pointer; | 1522 | using pointer = __node_pointer; |
| 1449 | 1523 | ||
| 1450 | _LIBCPP_HIDE_FROM_ABI __tree_deleter(__node_allocator& __alloc) : __alloc_(__alloc) {} | 1524 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_deleter(__node_allocator& __alloc) : __alloc_(__alloc) {} |
| 1451 | 1525 | ||
| 1452 | #ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function | 1526 | #ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function |
| 1453 | _LIBCPP_HIDE_FROM_ABI | 1527 | _LIBCPP_HIDE_FROM_ABI |
| 1454 | #endif | 1528 | #endif |
| 1455 | void | 1529 | _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator()(__node_pointer __ptr) { |
| 1456 | operator()(__node_pointer __ptr) { | ||
| 1457 | if (!__ptr) | 1530 | if (!__ptr) |
| 1458 | return; | 1531 | return; |
| 1459 | 1532 | ||
| 1460 | (*this)(static_cast<__node_pointer>(__ptr->__left_)); | 1533 | (*this)(std::__static_fancy_pointer_cast<__node_pointer>(__ptr->__left_)); |
| 1461 | 1534 | ||
| 1462 | auto __right = __ptr->__right_; | 1535 | auto __right = __ptr->__right_; |
| 1463 | 1536 | ||
| 1464 | __node_traits::destroy(__alloc_, std::addressof(__ptr->__get_value())); | 1537 | __node_traits::destroy(__alloc_, std::addressof(__ptr->__get_value())); |
| 1465 | __node_traits::deallocate(__alloc_, __ptr, 1); | 1538 | __node_traits::deallocate(__alloc_, __ptr, 1); |
| 1466 | 1539 | ||
| 1467 | (*this)(static_cast<__node_pointer>(__right)); | 1540 | (*this)(std::__static_fancy_pointer_cast<__node_pointer>(__right)); |
| 1468 | } | 1541 | } |
| 1469 | }; | 1542 | }; |
| 1470 | 1543 | ||
| ... | @@ -1476,41 +1549,54 @@ private: | ... | @@ -1476,41 +1549,54 @@ private: |
| 1476 | #ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function | 1549 | #ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function |
| 1477 | _LIBCPP_HIDE_FROM_ABI | 1550 | _LIBCPP_HIDE_FROM_ABI |
| 1478 | #endif | 1551 | #endif |
| 1479 | __node_pointer __construct_from_tree(__node_pointer __src, _NodeConstructor __construct) { | 1552 | _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer |
| 1553 | __construct_from_tree(__node_pointer __src, _NodeConstructor __construct) { | ||
| 1480 | if (!__src) | 1554 | if (!__src) |
| 1481 | return nullptr; | 1555 | return nullptr; |
| 1482 | 1556 | ||
| 1483 | __node_holder __new_node = __construct(__src->__get_value()); | 1557 | __node_holder __new_node = __construct(__src->__get_value()); |
| 1484 | 1558 | ||
| 1485 | unique_ptr<__node, __tree_deleter> __left( | 1559 | unique_ptr<__node, __tree_deleter> __left( |
| 1486 | __construct_from_tree(static_cast<__node_pointer>(__src->__left_), __construct), __node_alloc_); | 1560 | __construct_from_tree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_), __construct), |
| 1487 | __node_pointer __right = __construct_from_tree(static_cast<__node_pointer>(__src->__right_), __construct); | 1561 | __node_alloc_); |
| 1562 | __node_pointer __right = | ||
| 1563 | __construct_from_tree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_), __construct); | ||
| 1488 | 1564 | ||
| 1489 | __node_pointer __new_node_ptr = __new_node.release(); | 1565 | __node_pointer __new_node_ptr = __new_node.release(); |
| 1490 | 1566 | ||
| 1491 | __new_node_ptr->__is_black_ = __src->__is_black_; | 1567 | __new_node_ptr->__is_black_ = __src->__is_black_; |
| 1492 | __new_node_ptr->__left_ = static_cast<__node_base_pointer>(__left.release()); | 1568 | __new_node_ptr->__left_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__left.release()); |
| 1493 | __new_node_ptr->__right_ = static_cast<__node_base_pointer>(__right); | 1569 | __new_node_ptr->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__right); |
| 1494 | if (__new_node_ptr->__left_) | 1570 | if (__new_node_ptr->__left_) |
| 1495 | __new_node_ptr->__left_->__parent_ = static_cast<__end_node_pointer>(__new_node_ptr); | 1571 | __new_node_ptr->__left_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__new_node_ptr); |
| 1496 | if (__new_node_ptr->__right_) | 1572 | if (__new_node_ptr->__right_) |
| 1497 | __new_node_ptr->__right_->__parent_ = static_cast<__end_node_pointer>(__new_node_ptr); | 1573 | __new_node_ptr->__right_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__new_node_ptr); |
| 1498 | return __new_node_ptr; | 1574 | return __new_node_ptr; |
| 1499 | } | 1575 | } |
| 1500 | 1576 | ||
| 1501 | _LIBCPP_HIDE_FROM_ABI __node_pointer __copy_construct_tree(__node_pointer __src) { | 1577 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __copy_construct_tree(__node_pointer __src) { |
| 1502 | return __construct_from_tree(__src, [this](const value_type& __val) { return __construct_node(__val); }); | 1578 | return __construct_from_tree(__src, [this](const value_type& __val) { return __construct_node(__val); }); |
| 1503 | } | 1579 | } |
| 1504 | 1580 | ||
| 1505 | template <class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0> | 1581 | template <class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0> |
| 1506 | _LIBCPP_HIDE_FROM_ABI __node_pointer __move_construct_tree(__node_pointer __src) { | 1582 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __move_construct_tree(__node_pointer __src) { |
| 1507 | return __construct_from_tree(__src, [this](value_type& __val) { | 1583 | return __construct_from_tree(__src, [this](value_type& __val) { |
| 1584 | |||
| 1585 | #if _LIBCPP_STD_VER >= 26 | ||
| 1586 | // We need to replace the `const key_type` subobject by reconstruction during constant evaluation to avoid | ||
| 1587 | // undefined behavior. Currently, there is no constexpr-friend way to replacing a move-only key subobject. | ||
| 1588 | if constexpr (std::is_copy_constructible_v<decltype(__val.first)>) { | ||
| 1589 | if consteval { | ||
| 1590 | return __construct_node(__val.first, std::move(__val.second)); | ||
| 1591 | } | ||
| 1592 | } | ||
| 1593 | #endif | ||
| 1508 | return __construct_node(const_cast<key_type&&>(__val.first), std::move(__val.second)); | 1594 | return __construct_node(const_cast<key_type&&>(__val.first), std::move(__val.second)); |
| 1509 | }); | 1595 | }); |
| 1510 | } | 1596 | } |
| 1511 | 1597 | ||
| 1512 | template <class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0> | 1598 | template <class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0> |
| 1513 | _LIBCPP_HIDE_FROM_ABI __node_pointer __move_construct_tree(__node_pointer __src) { | 1599 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __move_construct_tree(__node_pointer __src) { |
| 1514 | return __construct_from_tree(__src, [this](value_type& __val) { return __construct_node(std::move(__val)); }); | 1600 | return __construct_from_tree(__src, [this](value_type& __val) { return __construct_node(std::move(__val)); }); |
| 1515 | } | 1601 | } |
| 1516 | 1602 | ||
| ... | @@ -1521,7 +1607,7 @@ private: | ... | @@ -1521,7 +1607,7 @@ private: |
| 1521 | #ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function | 1607 | #ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function |
| 1522 | _LIBCPP_HIDE_FROM_ABI | 1608 | _LIBCPP_HIDE_FROM_ABI |
| 1523 | #endif | 1609 | #endif |
| 1524 | __node_pointer __assign_from_tree( | 1610 | _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __assign_from_tree( |
| 1525 | __node_pointer __dest, __node_pointer __src, _Assignment __assign, _ConstructionAlg __construct_subtree) { | 1611 | __node_pointer __dest, __node_pointer __src, _Assignment __assign, _ConstructionAlg __construct_subtree) { |
| 1526 | if (!__src) { | 1612 | if (!__src) { |
| 1527 | destroy(__dest); | 1613 | destroy(__dest); |
| ... | @@ -1533,36 +1619,37 @@ private: | ... | @@ -1533,36 +1619,37 @@ private: |
| 1533 | 1619 | ||
| 1534 | // If we already have a left node in the destination tree, reuse it and copy-assign recursively | 1620 | // If we already have a left node in the destination tree, reuse it and copy-assign recursively |
| 1535 | if (__dest->__left_) { | 1621 | if (__dest->__left_) { |
| 1536 | __dest->__left_ = static_cast<__node_base_pointer>(__assign_from_tree( | 1622 | __dest->__left_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__assign_from_tree( |
| 1537 | static_cast<__node_pointer>(__dest->__left_), | 1623 | std::__static_fancy_pointer_cast<__node_pointer>(__dest->__left_), |
| 1538 | static_cast<__node_pointer>(__src->__left_), | 1624 | std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_), |
| 1539 | __assign, | 1625 | __assign, |
| 1540 | __construct_subtree)); | 1626 | __construct_subtree)); |
| 1541 | 1627 | ||
| 1542 | // Otherwise, we must create new nodes; copy-construct from here on | 1628 | // Otherwise, we must create new nodes; copy-construct from here on |
| 1543 | } else if (__src->__left_) { | 1629 | } else if (__src->__left_) { |
| 1544 | auto __new_left = __construct_subtree(static_cast<__node_pointer>(__src->__left_)); | 1630 | auto __new_left = __construct_subtree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_)); |
| 1545 | __dest->__left_ = static_cast<__node_base_pointer>(__new_left); | 1631 | __dest->__left_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__new_left); |
| 1546 | __new_left->__parent_ = static_cast<__end_node_pointer>(__dest); | 1632 | __new_left->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__dest); |
| 1547 | } | 1633 | } |
| 1548 | 1634 | ||
| 1549 | // Identical to the left case above, just for the right nodes | 1635 | // Identical to the left case above, just for the right nodes |
| 1550 | if (__dest->__right_) { | 1636 | if (__dest->__right_) { |
| 1551 | __dest->__right_ = static_cast<__node_base_pointer>(__assign_from_tree( | 1637 | __dest->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__assign_from_tree( |
| 1552 | static_cast<__node_pointer>(__dest->__right_), | 1638 | std::__static_fancy_pointer_cast<__node_pointer>(__dest->__right_), |
| 1553 | static_cast<__node_pointer>(__src->__right_), | 1639 | std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_), |
| 1554 | __assign, | 1640 | __assign, |
| 1555 | __construct_subtree)); | 1641 | __construct_subtree)); |
| 1556 | } else if (__src->__right_) { | 1642 | } else if (__src->__right_) { |
| 1557 | auto __new_right = __construct_subtree(static_cast<__node_pointer>(__src->__right_)); | 1643 | auto __new_right = __construct_subtree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_)); |
| 1558 | __dest->__right_ = static_cast<__node_base_pointer>(__new_right); | 1644 | __dest->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__new_right); |
| 1559 | __new_right->__parent_ = static_cast<__end_node_pointer>(__dest); | 1645 | __new_right->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__dest); |
| 1560 | } | 1646 | } |
| 1561 | 1647 | ||
| 1562 | return __dest; | 1648 | return __dest; |
| 1563 | } | 1649 | } |
| 1564 | 1650 | ||
| 1565 | _LIBCPP_HIDE_FROM_ABI __node_pointer __copy_assign_tree(__node_pointer __dest, __node_pointer __src) { | 1651 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer |
| 1652 | __copy_assign_tree(__node_pointer __dest, __node_pointer __src) { | ||
| 1566 | return __assign_from_tree( | 1653 | return __assign_from_tree( |
| 1567 | __dest, | 1654 | __dest, |
| 1568 | __src, | 1655 | __src, |
| ... | @@ -1570,7 +1657,8 @@ private: | ... | @@ -1570,7 +1657,8 @@ private: |
| 1570 | [this](__node_pointer __nd) { return __copy_construct_tree(__nd); }); | 1657 | [this](__node_pointer __nd) { return __copy_construct_tree(__nd); }); |
| 1571 | } | 1658 | } |
| 1572 | 1659 | ||
| 1573 | _LIBCPP_HIDE_FROM_ABI __node_pointer __move_assign_tree(__node_pointer __dest, __node_pointer __src) { | 1660 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer |
| 1661 | __move_assign_tree(__node_pointer __dest, __node_pointer __src) { | ||
| 1574 | return __assign_from_tree( | 1662 | return __assign_from_tree( |
| 1575 | __dest, | 1663 | __dest, |
| 1576 | __src, | 1664 | __src, |
| ... | @@ -1589,7 +1677,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<__tree<_Tp | ... | @@ -1589,7 +1677,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<__tree<_Tp |
| 1589 | using __node_pointer _LIBCPP_NODEBUG = typename __tree<_Tp, _Compare, _Allocator>::__node_pointer; | 1677 | using __node_pointer _LIBCPP_NODEBUG = typename __tree<_Tp, _Compare, _Allocator>::__node_pointer; |
| 1590 | 1678 | ||
| 1591 | template <class _Tree, class _Func, class _Proj> | 1679 | template <class _Tree, class _Func, class _Proj> |
| 1592 | _LIBCPP_HIDE_FROM_ABI static auto operator()(_Tree&& __range, _Func __func, _Proj __proj) { | 1680 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto |
| 1681 | operator()(_Tree&& __range, _Func __func, _Proj __proj) { | ||
| 1593 | if (__range.size() != 0) | 1682 | if (__range.size() != 0) |
| 1594 | std::__tree_iterate_from_root<__copy_cvref_t<_Tree, typename __remove_cvref_t<_Tree>::value_type>>( | 1683 | std::__tree_iterate_from_root<__copy_cvref_t<_Tree, typename __remove_cvref_t<_Tree>::value_type>>( |
| 1595 | [](__node_pointer) { return false; }, __range.__root(), __func, __proj); | 1684 | [](__node_pointer) { return false; }, __range.__root(), __func, __proj); |
| ... | @@ -1599,7 +1688,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<__tree<_Tp | ... | @@ -1599,7 +1688,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<__tree<_Tp |
| 1599 | #endif | 1688 | #endif |
| 1600 | 1689 | ||
| 1601 | template <class _Tp, class _Compare, class _Allocator> | 1690 | template <class _Tp, class _Compare, class _Allocator> |
| 1602 | __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) { | 1691 | _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>& |
| 1692 | __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) { | ||
| 1603 | if (this == std::addressof(__t)) | 1693 | if (this == std::addressof(__t)) |
| 1604 | return *this; | 1694 | return *this; |
| 1605 | 1695 | ||
| ... | @@ -1607,21 +1697,22 @@ __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=( | ... | @@ -1607,21 +1697,22 @@ __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=( |
| 1607 | __copy_assign_alloc(__t); | 1697 | __copy_assign_alloc(__t); |
| 1608 | 1698 | ||
| 1609 | if (__size_ != 0) { | 1699 | if (__size_ != 0) { |
| 1610 | *__root_ptr() = static_cast<__node_base_pointer>(__copy_assign_tree(__root(), __t.__root())); | 1700 | *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_assign_tree(__root(), __t.__root())); |
| 1611 | } else { | 1701 | } else { |
| 1612 | *__root_ptr() = static_cast<__node_base_pointer>(__copy_construct_tree(__t.__root())); | 1702 | *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_construct_tree(__t.__root())); |
| 1613 | if (__root()) | 1703 | if (__root()) |
| 1614 | __root()->__parent_ = __end_node(); | 1704 | __root()->__parent_ = __end_node(); |
| 1615 | } | 1705 | } |
| 1616 | __begin_node_ = | 1706 | __begin_node_ = __end_node()->__left_ |
| 1617 | __end_node()->__left_ ? static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)) : __end_node(); | 1707 | ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)) |
| 1708 | : __end_node(); | ||
| 1618 | __size_ = __t.size(); | 1709 | __size_ = __t.size(); |
| 1619 | 1710 | ||
| 1620 | return *this; | 1711 | return *this; |
| 1621 | } | 1712 | } |
| 1622 | 1713 | ||
| 1623 | template <class _Tp, class _Compare, class _Allocator> | 1714 | template <class _Tp, class _Compare, class _Allocator> |
| 1624 | __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) | 1715 | _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) |
| 1625 | : __begin_node_(__end_node()), | 1716 | : __begin_node_(__end_node()), |
| 1626 | __node_alloc_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())), | 1717 | __node_alloc_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())), |
| 1627 | __size_(0), | 1718 | __size_(0), |
| ... | @@ -1629,14 +1720,14 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) | ... | @@ -1629,14 +1720,14 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) |
| 1629 | if (__t.size() == 0) | 1720 | if (__t.size() == 0) |
| 1630 | return; | 1721 | return; |
| 1631 | 1722 | ||
| 1632 | *__root_ptr() = static_cast<__node_base_pointer>(__copy_construct_tree(__t.__root())); | 1723 | *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_construct_tree(__t.__root())); |
| 1633 | __root()->__parent_ = __end_node(); | 1724 | __root()->__parent_ = __end_node(); |
| 1634 | __begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)); | 1725 | __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)); |
| 1635 | __size_ = __t.size(); | 1726 | __size_ = __t.size(); |
| 1636 | } | 1727 | } |
| 1637 | 1728 | ||
| 1638 | template <class _Tp, class _Compare, class _Allocator> | 1729 | template <class _Tp, class _Compare, class _Allocator> |
| 1639 | __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_( | 1730 | _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_( |
| 1640 | is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value) | 1731 | is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value) |
| 1641 | : __begin_node_(std::move(__t.__begin_node_)), | 1732 | : __begin_node_(std::move(__t.__begin_node_)), |
| 1642 | __end_node_(std::move(__t.__end_node_)), | 1733 | __end_node_(std::move(__t.__end_node_)), |
| ... | @@ -1646,7 +1737,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_( | ... | @@ -1646,7 +1737,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_( |
| 1646 | if (__size_ == 0) | 1737 | if (__size_ == 0) |
| 1647 | __begin_node_ = __end_node(); | 1738 | __begin_node_ = __end_node(); |
| 1648 | else { | 1739 | else { |
| 1649 | __end_node()->__left_->__parent_ = static_cast<__end_node_pointer>(__end_node()); | 1740 | __end_node()->__left_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__end_node()); |
| 1650 | __t.__begin_node_ = __t.__end_node(); | 1741 | __t.__begin_node_ = __t.__end_node(); |
| 1651 | __t.__end_node()->__left_ = nullptr; | 1742 | __t.__end_node()->__left_ = nullptr; |
| 1652 | __t.__size_ = 0; | 1743 | __t.__size_ = 0; |
| ... | @@ -1654,7 +1745,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_( | ... | @@ -1654,7 +1745,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_( |
| 1654 | } | 1745 | } |
| 1655 | 1746 | ||
| 1656 | template <class _Tp, class _Compare, class _Allocator> | 1747 | template <class _Tp, class _Compare, class _Allocator> |
| 1657 | __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a) | 1748 | _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a) |
| 1658 | : __begin_node_(__end_node()), | 1749 | : __begin_node_(__end_node()), |
| 1659 | __node_alloc_(__node_allocator(__a)), | 1750 | __node_alloc_(__node_allocator(__a)), |
| 1660 | __size_(0), | 1751 | __size_(0), |
| ... | @@ -1664,24 +1755,24 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __ | ... | @@ -1664,24 +1755,24 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __ |
| 1664 | if (__a == __t.__alloc()) { | 1755 | if (__a == __t.__alloc()) { |
| 1665 | __begin_node_ = __t.__begin_node_; | 1756 | __begin_node_ = __t.__begin_node_; |
| 1666 | __end_node()->__left_ = __t.__end_node()->__left_; | 1757 | __end_node()->__left_ = __t.__end_node()->__left_; |
| 1667 | __end_node()->__left_->__parent_ = static_cast<__end_node_pointer>(__end_node()); | 1758 | __end_node()->__left_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__end_node()); |
| 1668 | __size_ = __t.__size_; | 1759 | __size_ = __t.__size_; |
| 1669 | __t.__begin_node_ = __t.__end_node(); | 1760 | __t.__begin_node_ = __t.__end_node(); |
| 1670 | __t.__end_node()->__left_ = nullptr; | 1761 | __t.__end_node()->__left_ = nullptr; |
| 1671 | __t.__size_ = 0; | 1762 | __t.__size_ = 0; |
| 1672 | } else { | 1763 | } else { |
| 1673 | *__root_ptr() = static_cast<__node_base_pointer>(__move_construct_tree(__t.__root())); | 1764 | *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__move_construct_tree(__t.__root())); |
| 1674 | __root()->__parent_ = __end_node(); | 1765 | __root()->__parent_ = __end_node(); |
| 1675 | __begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)); | 1766 | __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)); |
| 1676 | __size_ = __t.size(); | 1767 | __size_ = __t.size(); |
| 1677 | __t.clear(); // Ensure that __t is in a valid state after moving out the keys | 1768 | __t.clear(); // Ensure that __t is in a valid state after moving out the keys |
| 1678 | } | 1769 | } |
| 1679 | } | 1770 | } |
| 1680 | 1771 | ||
| 1681 | template <class _Tp, class _Compare, class _Allocator> | 1772 | template <class _Tp, class _Compare, class _Allocator> |
| 1682 | void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type) | 1773 | _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type) |
| 1683 | _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value) { | 1774 | _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value) { |
| 1684 | destroy(static_cast<__node_pointer>(__end_node()->__left_)); | 1775 | destroy(std::__static_fancy_pointer_cast<__node_pointer>(__end_node()->__left_)); |
| 1685 | __begin_node_ = __t.__begin_node_; | 1776 | __begin_node_ = __t.__begin_node_; |
| 1686 | __end_node_ = __t.__end_node_; | 1777 | __end_node_ = __t.__end_node_; |
| 1687 | __move_assign_alloc(__t); | 1778 | __move_assign_alloc(__t); |
| ... | @@ -1690,7 +1781,7 @@ void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type) | ... | @@ -1690,7 +1781,7 @@ void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type) |
| 1690 | if (__size_ == 0) | 1781 | if (__size_ == 0) |
| 1691 | __begin_node_ = __end_node(); | 1782 | __begin_node_ = __end_node(); |
| 1692 | else { | 1783 | else { |
| 1693 | __end_node()->__left_->__parent_ = static_cast<__end_node_pointer>(__end_node()); | 1784 | __end_node()->__left_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__end_node()); |
| 1694 | __t.__begin_node_ = __t.__end_node(); | 1785 | __t.__begin_node_ = __t.__end_node(); |
| 1695 | __t.__end_node()->__left_ = nullptr; | 1786 | __t.__end_node()->__left_ = nullptr; |
| 1696 | __t.__size_ = 0; | 1787 | __t.__size_ = 0; |
| ... | @@ -1698,27 +1789,28 @@ void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type) | ... | @@ -1698,27 +1789,28 @@ void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type) |
| 1698 | } | 1789 | } |
| 1699 | 1790 | ||
| 1700 | template <class _Tp, class _Compare, class _Allocator> | 1791 | template <class _Tp, class _Compare, class _Allocator> |
| 1701 | void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) { | 1792 | _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) { |
| 1702 | if (__node_alloc() == __t.__node_alloc()) { | 1793 | if (__node_alloc() == __t.__node_alloc()) { |
| 1703 | __move_assign(__t, true_type()); | 1794 | __move_assign(__t, true_type()); |
| 1704 | } else { | 1795 | } else { |
| 1705 | value_comp() = std::move(__t.value_comp()); | 1796 | value_comp() = std::move(__t.value_comp()); |
| 1706 | if (__size_ != 0) { | 1797 | if (__size_ != 0) { |
| 1707 | *__root_ptr() = static_cast<__node_base_pointer>(__move_assign_tree(__root(), __t.__root())); | 1798 | *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__move_assign_tree(__root(), __t.__root())); |
| 1708 | } else { | 1799 | } else { |
| 1709 | *__root_ptr() = static_cast<__node_base_pointer>(__move_construct_tree(__t.__root())); | 1800 | *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__move_construct_tree(__t.__root())); |
| 1710 | if (__root()) | 1801 | if (__root()) |
| 1711 | __root()->__parent_ = __end_node(); | 1802 | __root()->__parent_ = __end_node(); |
| 1712 | } | 1803 | } |
| 1713 | __begin_node_ = | 1804 | __begin_node_ = __end_node()->__left_ |
| 1714 | __end_node()->__left_ ? static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)) : __end_node(); | 1805 | ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)) |
| 1806 | : __end_node(); | ||
| 1715 | __size_ = __t.size(); | 1807 | __size_ = __t.size(); |
| 1716 | __t.clear(); // Ensure that __t is in a valid state after moving out the keys | 1808 | __t.clear(); // Ensure that __t is in a valid state after moving out the keys |
| 1717 | } | 1809 | } |
| 1718 | } | 1810 | } |
| 1719 | 1811 | ||
| 1720 | template <class _Tp, class _Compare, class _Allocator> | 1812 | template <class _Tp, class _Compare, class _Allocator> |
| 1721 | void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) | 1813 | _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) |
| 1722 | #if _LIBCPP_STD_VER <= 11 | 1814 | #if _LIBCPP_STD_VER <= 11 |
| 1723 | _NOEXCEPT_(__is_nothrow_swappable_v<value_compare> && | 1815 | _NOEXCEPT_(__is_nothrow_swappable_v<value_compare> && |
| 1724 | (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)) | 1816 | (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)) |
| ... | @@ -1743,7 +1835,7 @@ void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) | ... | @@ -1743,7 +1835,7 @@ void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) |
| 1743 | } | 1835 | } |
| 1744 | 1836 | ||
| 1745 | template <class _Tp, class _Compare, class _Allocator> | 1837 | template <class _Tp, class _Compare, class _Allocator> |
| 1746 | void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT { | 1838 | _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT { |
| 1747 | destroy(__root()); | 1839 | destroy(__root()); |
| 1748 | __size_ = 0; | 1840 | __size_ = 0; |
| 1749 | __begin_node_ = __end_node(); | 1841 | __begin_node_ = __end_node(); |
| ... | @@ -1754,23 +1846,23 @@ void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT { | ... | @@ -1754,23 +1846,23 @@ void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT { |
| 1754 | // Set __parent to parent of null leaf | 1846 | // Set __parent to parent of null leaf |
| 1755 | // Return reference to null leaf | 1847 | // Return reference to null leaf |
| 1756 | template <class _Tp, class _Compare, class _Allocator> | 1848 | template <class _Tp, class _Compare, class _Allocator> |
| 1757 | typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& | 1849 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& |
| 1758 | __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__end_node_pointer& __parent, const value_type& __v) { | 1850 | __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__end_node_pointer& __parent, const value_type& __v) { |
| 1759 | __node_pointer __nd = __root(); | 1851 | __node_pointer __nd = __root(); |
| 1760 | if (__nd != nullptr) { | 1852 | if (__nd != nullptr) { |
| 1761 | while (true) { | 1853 | while (true) { |
| 1762 | if (value_comp()(__nd->__get_value(), __v)) { | 1854 | if (value_comp()(__nd->__get_value(), __v)) { |
| 1763 | if (__nd->__right_ != nullptr) | 1855 | if (__nd->__right_ != nullptr) |
| 1764 | __nd = static_cast<__node_pointer>(__nd->__right_); | 1856 | __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__right_); |
| 1765 | else { | 1857 | else { |
| 1766 | __parent = static_cast<__end_node_pointer>(__nd); | 1858 | __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd); |
| 1767 | return __nd->__right_; | 1859 | return __nd->__right_; |
| 1768 | } | 1860 | } |
| 1769 | } else { | 1861 | } else { |
| 1770 | if (__nd->__left_ != nullptr) | 1862 | if (__nd->__left_ != nullptr) |
| 1771 | __nd = static_cast<__node_pointer>(__nd->__left_); | 1863 | __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__left_); |
| 1772 | else { | 1864 | else { |
| 1773 | __parent = static_cast<__end_node_pointer>(__nd); | 1865 | __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd); |
| 1774 | return __parent->__left_; | 1866 | return __parent->__left_; |
| 1775 | } | 1867 | } |
| 1776 | } | 1868 | } |
| ... | @@ -1784,23 +1876,23 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__end_node_pointer& __parent, | ... | @@ -1784,23 +1876,23 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__end_node_pointer& __parent, |
| 1784 | // Set __parent to parent of null leaf | 1876 | // Set __parent to parent of null leaf |
| 1785 | // Return reference to null leaf | 1877 | // Return reference to null leaf |
| 1786 | template <class _Tp, class _Compare, class _Allocator> | 1878 | template <class _Tp, class _Compare, class _Allocator> |
| 1787 | typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& | 1879 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& |
| 1788 | __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent, const value_type& __v) { | 1880 | __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent, const value_type& __v) { |
| 1789 | __node_pointer __nd = __root(); | 1881 | __node_pointer __nd = __root(); |
| 1790 | if (__nd != nullptr) { | 1882 | if (__nd != nullptr) { |
| 1791 | while (true) { | 1883 | while (true) { |
| 1792 | if (value_comp()(__v, __nd->__get_value())) { | 1884 | if (value_comp()(__v, __nd->__get_value())) { |
| 1793 | if (__nd->__left_ != nullptr) | 1885 | if (__nd->__left_ != nullptr) |
| 1794 | __nd = static_cast<__node_pointer>(__nd->__left_); | 1886 | __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__left_); |
| 1795 | else { | 1887 | else { |
| 1796 | __parent = static_cast<__end_node_pointer>(__nd); | 1888 | __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd); |
| 1797 | return __parent->__left_; | 1889 | return __parent->__left_; |
| 1798 | } | 1890 | } |
| 1799 | } else { | 1891 | } else { |
| 1800 | if (__nd->__right_ != nullptr) | 1892 | if (__nd->__right_ != nullptr) |
| 1801 | __nd = static_cast<__node_pointer>(__nd->__right_); | 1893 | __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__right_); |
| 1802 | else { | 1894 | else { |
| 1803 | __parent = static_cast<__end_node_pointer>(__nd); | 1895 | __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd); |
| 1804 | return __nd->__right_; | 1896 | return __nd->__right_; |
| 1805 | } | 1897 | } |
| 1806 | } | 1898 | } |
| ... | @@ -1817,7 +1909,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent | ... | @@ -1817,7 +1909,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent |
| 1817 | // Set __parent to parent of null leaf | 1909 | // Set __parent to parent of null leaf |
| 1818 | // Return reference to null leaf | 1910 | // Return reference to null leaf |
| 1819 | template <class _Tp, class _Compare, class _Allocator> | 1911 | template <class _Tp, class _Compare, class _Allocator> |
| 1820 | typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Compare, _Allocator>::__find_leaf( | 1912 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& |
| 1913 | __tree<_Tp, _Compare, _Allocator>::__find_leaf( | ||
| 1821 | const_iterator __hint, __end_node_pointer& __parent, const value_type& __v) { | 1914 | const_iterator __hint, __end_node_pointer& __parent, const value_type& __v) { |
| 1822 | if (__hint == end() || !value_comp()(*__hint, __v)) // check before | 1915 | if (__hint == end() || !value_comp()(*__hint, __v)) // check before |
| 1823 | { | 1916 | { |
| ... | @@ -1826,11 +1919,11 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Co | ... | @@ -1826,11 +1919,11 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Co |
| 1826 | if (__prior == begin() || !value_comp()(__v, *--__prior)) { | 1919 | if (__prior == begin() || !value_comp()(__v, *--__prior)) { |
| 1827 | // *prev(__hint) <= __v <= *__hint | 1920 | // *prev(__hint) <= __v <= *__hint |
| 1828 | if (__hint.__ptr_->__left_ == nullptr) { | 1921 | if (__hint.__ptr_->__left_ == nullptr) { |
| 1829 | __parent = static_cast<__end_node_pointer>(__hint.__ptr_); | 1922 | __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__hint.__ptr_); |
| 1830 | return __parent->__left_; | 1923 | return __parent->__left_; |
| 1831 | } else { | 1924 | } else { |
| 1832 | __parent = static_cast<__end_node_pointer>(__prior.__ptr_); | 1925 | __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__prior.__ptr_); |
| 1833 | return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_; | 1926 | return std::__static_fancy_pointer_cast<__node_base_pointer>(__prior.__ptr_)->__right_; |
| 1834 | } | 1927 | } |
| 1835 | } | 1928 | } |
| 1836 | // __v < *prev(__hint) | 1929 | // __v < *prev(__hint) |
| ... | @@ -1845,8 +1938,9 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Co | ... | @@ -1845,8 +1938,9 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Co |
| 1845 | // If __v doesn't exist, return the parent of the null leaf and a reference to the pointer to the null leaf. | 1938 | // If __v doesn't exist, return the parent of the null leaf and a reference to the pointer to the null leaf. |
| 1846 | template <class _Tp, class _Compare, class _Allocator> | 1939 | template <class _Tp, class _Compare, class _Allocator> |
| 1847 | template <class _Key> | 1940 | template <class _Key> |
| 1848 | _LIBCPP_HIDE_FROM_ABI pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer, | 1941 | _LIBCPP_HIDE_FROM_ABI |
| 1849 | typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&> | 1942 | _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer, |
| 1943 | typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&> | ||
| 1850 | __tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) { | 1944 | __tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) { |
| 1851 | using _Pair = pair<__end_node_pointer, __node_base_pointer&>; | 1945 | using _Pair = pair<__end_node_pointer, __node_base_pointer&>; |
| 1852 | 1946 | ||
| ... | @@ -1858,27 +1952,27 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) { | ... | @@ -1858,27 +1952,27 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) { |
| 1858 | } | 1952 | } |
| 1859 | 1953 | ||
| 1860 | __node_base_pointer* __node_ptr = __root_ptr(); | 1954 | __node_base_pointer* __node_ptr = __root_ptr(); |
| 1861 | auto&& __transparent = std::__as_transparent<_Key>(value_comp()); | 1955 | auto&& __transparent = std::__as_transparent<key_type>(value_comp()); |
| 1862 | auto __comp = | 1956 | auto __comp = |
| 1863 | __lazy_synth_three_way_comparator<__make_transparent_t<_Key, _Compare>, _Key, value_type>(__transparent); | 1957 | __lazy_synth_three_way_comparator<__make_transparent_t<key_type, _Compare>, _Key, value_type>(__transparent); |
| 1864 | 1958 | ||
| 1865 | while (true) { | 1959 | while (true) { |
| 1866 | auto __comp_res = __comp(__v, __nd->__get_value()); | 1960 | auto __comp_res = __comp(__v, __nd->__get_value()); |
| 1867 | 1961 | ||
| 1868 | if (__comp_res.__less()) { | 1962 | if (__comp_res.__less()) { |
| 1869 | if (__nd->__left_ == nullptr) | 1963 | if (__nd->__left_ == nullptr) |
| 1870 | return _Pair(static_cast<__end_node_pointer>(__nd), __nd->__left_); | 1964 | return _Pair(std::__static_fancy_pointer_cast<__end_node_pointer>(__nd), __nd->__left_); |
| 1871 | 1965 | ||
| 1872 | __node_ptr = std::addressof(__nd->__left_); | 1966 | __node_ptr = std::addressof(__nd->__left_); |
| 1873 | __nd = static_cast<__node_pointer>(__nd->__left_); | 1967 | __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__left_); |
| 1874 | } else if (__comp_res.__greater()) { | 1968 | } else if (__comp_res.__greater()) { |
| 1875 | if (__nd->__right_ == nullptr) | 1969 | if (__nd->__right_ == nullptr) |
| 1876 | return _Pair(static_cast<__end_node_pointer>(__nd), __nd->__right_); | 1970 | return _Pair(std::__static_fancy_pointer_cast<__end_node_pointer>(__nd), __nd->__right_); |
| 1877 | 1971 | ||
| 1878 | __node_ptr = std::addressof(__nd->__right_); | 1972 | __node_ptr = std::addressof(__nd->__right_); |
| 1879 | __nd = static_cast<__node_pointer>(__nd->__right_); | 1973 | __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__right_); |
| 1880 | } else { | 1974 | } else { |
| 1881 | return _Pair(static_cast<__end_node_pointer>(__nd), *__node_ptr); | 1975 | return _Pair(std::__static_fancy_pointer_cast<__end_node_pointer>(__nd), *__node_ptr); |
| 1882 | } | 1976 | } |
| 1883 | } | 1977 | } |
| 1884 | } | 1978 | } |
| ... | @@ -1891,8 +1985,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) { | ... | @@ -1891,8 +1985,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) { |
| 1891 | // If __v doesn't exist, return the parent of the null leaf and a reference to the pointer to the null leaf. | 1985 | // If __v doesn't exist, return the parent of the null leaf and a reference to the pointer to the null leaf. |
| 1892 | template <class _Tp, class _Compare, class _Allocator> | 1986 | template <class _Tp, class _Compare, class _Allocator> |
| 1893 | template <class _Key> | 1987 | template <class _Key> |
| 1894 | _LIBCPP_HIDE_FROM_ABI pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer, | 1988 | _LIBCPP_HIDE_FROM_ABI |
| 1895 | typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&> | 1989 | _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer, |
| 1990 | typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&> | ||
| 1896 | __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_base_pointer& __dummy, const _Key& __v) { | 1991 | __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_base_pointer& __dummy, const _Key& __v) { |
| 1897 | using _Pair = pair<__end_node_pointer, __node_base_pointer&>; | 1992 | using _Pair = pair<__end_node_pointer, __node_base_pointer&>; |
| 1898 | 1993 | ||
| ... | @@ -1903,7 +1998,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_ba | ... | @@ -1903,7 +1998,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_ba |
| 1903 | // *prev(__hint) < __v < *__hint | 1998 | // *prev(__hint) < __v < *__hint |
| 1904 | if (__hint.__ptr_->__left_ == nullptr) | 1999 | if (__hint.__ptr_->__left_ == nullptr) |
| 1905 | return _Pair(__hint.__ptr_, __hint.__ptr_->__left_); | 2000 | return _Pair(__hint.__ptr_, __hint.__ptr_->__left_); |
| 1906 | return _Pair(__prior.__ptr_, static_cast<__node_pointer>(__prior.__ptr_)->__right_); | 2001 | return _Pair(__prior.__ptr_, std::__static_fancy_pointer_cast<__node_pointer>(__prior.__ptr_)->__right_); |
| 1907 | } | 2002 | } |
| 1908 | // __v <= *prev(__hint) | 2003 | // __v <= *prev(__hint) |
| 1909 | return __find_equal(__v); | 2004 | return __find_equal(__v); |
| ... | @@ -1915,7 +2010,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_ba | ... | @@ -1915,7 +2010,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_ba |
| 1915 | if (__next == end() || value_comp()(__v, *__next)) { | 2010 | if (__next == end() || value_comp()(__v, *__next)) { |
| 1916 | // *__hint < __v < *std::next(__hint) | 2011 | // *__hint < __v < *std::next(__hint) |
| 1917 | if (__hint.__get_np()->__right_ == nullptr) | 2012 | if (__hint.__get_np()->__right_ == nullptr) |
| 1918 | return _Pair(__hint.__ptr_, static_cast<__node_pointer>(__hint.__ptr_)->__right_); | 2013 | return _Pair(__hint.__ptr_, std::__static_fancy_pointer_cast<__node_pointer>(__hint.__ptr_)->__right_); |
| 1919 | return _Pair(__next.__ptr_, __next.__ptr_->__left_); | 2014 | return _Pair(__next.__ptr_, __next.__ptr_->__left_); |
| 1920 | } | 2015 | } |
| 1921 | // *next(__hint) <= __v | 2016 | // *next(__hint) <= __v |
| ... | @@ -1923,12 +2018,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_ba | ... | @@ -1923,12 +2018,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_ba |
| 1923 | } | 2018 | } |
| 1924 | 2019 | ||
| 1925 | // else __v == *__hint | 2020 | // else __v == *__hint |
| 1926 | __dummy = static_cast<__node_base_pointer>(__hint.__ptr_); | 2021 | __dummy = std::__static_fancy_pointer_cast<__node_base_pointer>(__hint.__ptr_); |
| 1927 | return _Pair(__hint.__ptr_, __dummy); | 2022 | return _Pair(__hint.__ptr_, __dummy); |
| 1928 | } | 2023 | } |
| 1929 | 2024 | ||
| 1930 | template <class _Tp, class _Compare, class _Allocator> | 2025 | template <class _Tp, class _Compare, class _Allocator> |
| 1931 | void __tree<_Tp, _Compare, _Allocator>::__insert_node_at( | 2026 | _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::__insert_node_at( |
| 1932 | __end_node_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT { | 2027 | __end_node_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT { |
| 1933 | __new_node->__left_ = nullptr; | 2028 | __new_node->__left_ = nullptr; |
| 1934 | __new_node->__right_ = nullptr; | 2029 | __new_node->__right_ = nullptr; |
| ... | @@ -1936,14 +2031,14 @@ void __tree<_Tp, _Compare, _Allocator>::__insert_node_at( | ... | @@ -1936,14 +2031,14 @@ void __tree<_Tp, _Compare, _Allocator>::__insert_node_at( |
| 1936 | // __new_node->__is_black_ is initialized in __tree_balance_after_insert | 2031 | // __new_node->__is_black_ is initialized in __tree_balance_after_insert |
| 1937 | __child = __new_node; | 2032 | __child = __new_node; |
| 1938 | if (__begin_node_->__left_ != nullptr) | 2033 | if (__begin_node_->__left_ != nullptr) |
| 1939 | __begin_node_ = static_cast<__end_node_pointer>(__begin_node_->__left_); | 2034 | __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__begin_node_->__left_); |
| 1940 | std::__tree_balance_after_insert(__end_node()->__left_, __child); | 2035 | std::__tree_balance_after_insert(__end_node()->__left_, __child); |
| 1941 | ++__size_; | 2036 | ++__size_; |
| 1942 | } | 2037 | } |
| 1943 | 2038 | ||
| 1944 | template <class _Tp, class _Compare, class _Allocator> | 2039 | template <class _Tp, class _Compare, class _Allocator> |
| 1945 | template <class... _Args> | 2040 | template <class... _Args> |
| 1946 | typename __tree<_Tp, _Compare, _Allocator>::__node_holder | 2041 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_holder |
| 1947 | __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) { | 2042 | __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) { |
| 1948 | __node_allocator& __na = __node_alloc(); | 2043 | __node_allocator& __na = __node_alloc(); |
| 1949 | __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | 2044 | __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); |
| ... | @@ -1954,42 +2049,42 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) { | ... | @@ -1954,42 +2049,42 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) { |
| 1954 | 2049 | ||
| 1955 | template <class _Tp, class _Compare, class _Allocator> | 2050 | template <class _Tp, class _Compare, class _Allocator> |
| 1956 | template <class... _Args> | 2051 | template <class... _Args> |
| 1957 | typename __tree<_Tp, _Compare, _Allocator>::iterator | 2052 | typename __tree<_Tp, _Compare, _Allocator>::iterator _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1958 | __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) { | 2053 | __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) { |
| 1959 | __node_holder __h = __construct_node(std::forward<_Args>(__args)...); | 2054 | __node_holder __h = __construct_node(std::forward<_Args>(__args)...); |
| 1960 | __end_node_pointer __parent; | 2055 | __end_node_pointer __parent; |
| 1961 | __node_base_pointer& __child = __find_leaf_high(__parent, __h->__get_value()); | 2056 | __node_base_pointer& __child = __find_leaf_high(__parent, __h->__get_value()); |
| 1962 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); | 2057 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get())); |
| 1963 | return iterator(static_cast<__node_pointer>(__h.release())); | 2058 | return iterator(std::__static_fancy_pointer_cast<__node_pointer>(__h.release())); |
| 1964 | } | 2059 | } |
| 1965 | 2060 | ||
| 1966 | template <class _Tp, class _Compare, class _Allocator> | 2061 | template <class _Tp, class _Compare, class _Allocator> |
| 1967 | template <class... _Args> | 2062 | template <class... _Args> |
| 1968 | typename __tree<_Tp, _Compare, _Allocator>::iterator | 2063 | typename __tree<_Tp, _Compare, _Allocator>::iterator _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1969 | __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, _Args&&... __args) { | 2064 | __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, _Args&&... __args) { |
| 1970 | __node_holder __h = __construct_node(std::forward<_Args>(__args)...); | 2065 | __node_holder __h = __construct_node(std::forward<_Args>(__args)...); |
| 1971 | __end_node_pointer __parent; | 2066 | __end_node_pointer __parent; |
| 1972 | __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__get_value()); | 2067 | __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__get_value()); |
| 1973 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); | 2068 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get())); |
| 1974 | return iterator(static_cast<__node_pointer>(__h.release())); | 2069 | return iterator(std::__static_fancy_pointer_cast<__node_pointer>(__h.release())); |
| 1975 | } | 2070 | } |
| 1976 | 2071 | ||
| 1977 | template <class _Tp, class _Compare, class _Allocator> | 2072 | template <class _Tp, class _Compare, class _Allocator> |
| 1978 | typename __tree<_Tp, _Compare, _Allocator>::iterator | 2073 | typename __tree<_Tp, _Compare, _Allocator>::iterator _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1979 | __tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) _NOEXCEPT { | 2074 | __tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) _NOEXCEPT { |
| 1980 | iterator __r(__ptr); | 2075 | iterator __r(__ptr); |
| 1981 | ++__r; | 2076 | ++__r; |
| 1982 | if (__begin_node_ == __ptr) | 2077 | if (__begin_node_ == __ptr) |
| 1983 | __begin_node_ = __r.__ptr_; | 2078 | __begin_node_ = __r.__ptr_; |
| 1984 | --__size_; | 2079 | --__size_; |
| 1985 | std::__tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__ptr)); | 2080 | std::__tree_remove(__end_node()->__left_, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr)); |
| 1986 | return __r; | 2081 | return __r; |
| 1987 | } | 2082 | } |
| 1988 | 2083 | ||
| 1989 | #if _LIBCPP_STD_VER >= 17 | 2084 | #if _LIBCPP_STD_VER >= 17 |
| 1990 | template <class _Tp, class _Compare, class _Allocator> | 2085 | template <class _Tp, class _Compare, class _Allocator> |
| 1991 | template <class _NodeHandle, class _InsertReturnType> | 2086 | template <class _NodeHandle, class _InsertReturnType> |
| 1992 | _LIBCPP_HIDE_FROM_ABI _InsertReturnType | 2087 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _InsertReturnType |
| 1993 | __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(_NodeHandle&& __nh) { | 2088 | __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(_NodeHandle&& __nh) { |
| 1994 | if (__nh.empty()) | 2089 | if (__nh.empty()) |
| 1995 | return _InsertReturnType{end(), false, _NodeHandle()}; | 2090 | return _InsertReturnType{end(), false, _NodeHandle()}; |
| ... | @@ -1997,16 +2092,17 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(_NodeHandle&& __n | ... | @@ -1997,16 +2092,17 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(_NodeHandle&& __n |
| 1997 | __node_pointer __ptr = __nh.__ptr_; | 2092 | __node_pointer __ptr = __nh.__ptr_; |
| 1998 | auto [__parent, __child] = __find_equal(__ptr->__get_value()); | 2093 | auto [__parent, __child] = __find_equal(__ptr->__get_value()); |
| 1999 | if (__child != nullptr) | 2094 | if (__child != nullptr) |
| 2000 | return _InsertReturnType{iterator(static_cast<__node_pointer>(__child)), false, std::move(__nh)}; | 2095 | return _InsertReturnType{ |
| 2096 | iterator(std::__static_fancy_pointer_cast<__node_pointer>(__child)), false, std::move(__nh)}; | ||
| 2001 | 2097 | ||
| 2002 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr)); | 2098 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr)); |
| 2003 | __nh.__release_ptr(); | 2099 | __nh.__release_ptr(); |
| 2004 | return _InsertReturnType{iterator(__ptr), true, _NodeHandle()}; | 2100 | return _InsertReturnType{iterator(__ptr), true, _NodeHandle()}; |
| 2005 | } | 2101 | } |
| 2006 | 2102 | ||
| 2007 | template <class _Tp, class _Compare, class _Allocator> | 2103 | template <class _Tp, class _Compare, class _Allocator> |
| 2008 | template <class _NodeHandle> | 2104 | template <class _NodeHandle> |
| 2009 | _LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator | 2105 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator |
| 2010 | __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __hint, _NodeHandle&& __nh) { | 2106 | __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __hint, _NodeHandle&& __nh) { |
| 2011 | if (__nh.empty()) | 2107 | if (__nh.empty()) |
| 2012 | return end(); | 2108 | return end(); |
| ... | @@ -2014,9 +2110,9 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __ | ... | @@ -2014,9 +2110,9 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __ |
| 2014 | __node_pointer __ptr = __nh.__ptr_; | 2110 | __node_pointer __ptr = __nh.__ptr_; |
| 2015 | __node_base_pointer __dummy; | 2111 | __node_base_pointer __dummy; |
| 2016 | auto [__parent, __child] = __find_equal(__hint, __dummy, __ptr->__get_value()); | 2112 | auto [__parent, __child] = __find_equal(__hint, __dummy, __ptr->__get_value()); |
| 2017 | __node_pointer __r = static_cast<__node_pointer>(__child); | 2113 | __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child); |
| 2018 | if (__child == nullptr) { | 2114 | if (__child == nullptr) { |
| 2019 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr)); | 2115 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr)); |
| 2020 | __r = __ptr; | 2116 | __r = __ptr; |
| 2021 | __nh.__release_ptr(); | 2117 | __nh.__release_ptr(); |
| 2022 | } | 2118 | } |
| ... | @@ -2025,7 +2121,8 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __ | ... | @@ -2025,7 +2121,8 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __ |
| 2025 | 2121 | ||
| 2026 | template <class _Tp, class _Compare, class _Allocator> | 2122 | template <class _Tp, class _Compare, class _Allocator> |
| 2027 | template <class _NodeHandle> | 2123 | template <class _NodeHandle> |
| 2028 | _LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key) { | 2124 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle |
| 2125 | __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key) { | ||
| 2029 | iterator __it = __lower_bound_multi(__key); | 2126 | iterator __it = __lower_bound_multi(__key); |
| 2030 | if (__it == end() || __value_comp_(__key, *__it)) | 2127 | if (__it == end() || __value_comp_(__key, *__it)) |
| 2031 | return _NodeHandle(); | 2128 | return _NodeHandle(); |
| ... | @@ -2034,7 +2131,8 @@ _LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_hand | ... | @@ -2034,7 +2131,8 @@ _LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_hand |
| 2034 | 2131 | ||
| 2035 | template <class _Tp, class _Compare, class _Allocator> | 2132 | template <class _Tp, class _Compare, class _Allocator> |
| 2036 | template <class _NodeHandle> | 2133 | template <class _NodeHandle> |
| 2037 | _LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p) { | 2134 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle |
| 2135 | __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p) { | ||
| 2038 | __node_pointer __np = __p.__get_np(); | 2136 | __node_pointer __np = __p.__get_np(); |
| 2039 | __remove_node_pointer(__np); | 2137 | __remove_node_pointer(__np); |
| 2040 | return _NodeHandle(__np, __alloc()); | 2138 | return _NodeHandle(__np, __alloc()); |
| ... | @@ -2042,7 +2140,7 @@ _LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_hand | ... | @@ -2042,7 +2140,7 @@ _LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_hand |
| 2042 | 2140 | ||
| 2043 | template <class _Tp, class _Compare, class _Allocator> | 2141 | template <class _Tp, class _Compare, class _Allocator> |
| 2044 | template <class _Comp2> | 2142 | template <class _Comp2> |
| 2045 | _LIBCPP_HIDE_FROM_ABI void | 2143 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 2046 | __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source) { | 2144 | __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source) { |
| 2047 | for (iterator __i = __source.begin(); __i != __source.end();) { | 2145 | for (iterator __i = __source.begin(); __i != __source.end();) { |
| 2048 | __node_pointer __src_ptr = __i.__get_np(); | 2146 | __node_pointer __src_ptr = __i.__get_np(); |
| ... | @@ -2051,27 +2149,27 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(__tree<_Tp, _Comp2 | ... | @@ -2051,27 +2149,27 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(__tree<_Tp, _Comp2 |
| 2051 | if (__child != nullptr) | 2149 | if (__child != nullptr) |
| 2052 | continue; | 2150 | continue; |
| 2053 | __source.__remove_node_pointer(__src_ptr); | 2151 | __source.__remove_node_pointer(__src_ptr); |
| 2054 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__src_ptr)); | 2152 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__src_ptr)); |
| 2055 | } | 2153 | } |
| 2056 | } | 2154 | } |
| 2057 | 2155 | ||
| 2058 | template <class _Tp, class _Compare, class _Allocator> | 2156 | template <class _Tp, class _Compare, class _Allocator> |
| 2059 | template <class _NodeHandle> | 2157 | template <class _NodeHandle> |
| 2060 | _LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator | 2158 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator |
| 2061 | __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh) { | 2159 | __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh) { |
| 2062 | if (__nh.empty()) | 2160 | if (__nh.empty()) |
| 2063 | return end(); | 2161 | return end(); |
| 2064 | __node_pointer __ptr = __nh.__ptr_; | 2162 | __node_pointer __ptr = __nh.__ptr_; |
| 2065 | __end_node_pointer __parent; | 2163 | __end_node_pointer __parent; |
| 2066 | __node_base_pointer& __child = __find_leaf_high(__parent, __ptr->__get_value()); | 2164 | __node_base_pointer& __child = __find_leaf_high(__parent, __ptr->__get_value()); |
| 2067 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr)); | 2165 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr)); |
| 2068 | __nh.__release_ptr(); | 2166 | __nh.__release_ptr(); |
| 2069 | return iterator(__ptr); | 2167 | return iterator(__ptr); |
| 2070 | } | 2168 | } |
| 2071 | 2169 | ||
| 2072 | template <class _Tp, class _Compare, class _Allocator> | 2170 | template <class _Tp, class _Compare, class _Allocator> |
| 2073 | template <class _NodeHandle> | 2171 | template <class _NodeHandle> |
| 2074 | _LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator | 2172 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator |
| 2075 | __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh) { | 2173 | __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh) { |
| 2076 | if (__nh.empty()) | 2174 | if (__nh.empty()) |
| 2077 | return end(); | 2175 | return end(); |
| ... | @@ -2079,14 +2177,14 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __h | ... | @@ -2079,14 +2177,14 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __h |
| 2079 | __node_pointer __ptr = __nh.__ptr_; | 2177 | __node_pointer __ptr = __nh.__ptr_; |
| 2080 | __end_node_pointer __parent; | 2178 | __end_node_pointer __parent; |
| 2081 | __node_base_pointer& __child = __find_leaf(__hint, __parent, __ptr->__get_value()); | 2179 | __node_base_pointer& __child = __find_leaf(__hint, __parent, __ptr->__get_value()); |
| 2082 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr)); | 2180 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr)); |
| 2083 | __nh.__release_ptr(); | 2181 | __nh.__release_ptr(); |
| 2084 | return iterator(__ptr); | 2182 | return iterator(__ptr); |
| 2085 | } | 2183 | } |
| 2086 | 2184 | ||
| 2087 | template <class _Tp, class _Compare, class _Allocator> | 2185 | template <class _Tp, class _Compare, class _Allocator> |
| 2088 | template <class _Comp2> | 2186 | template <class _Comp2> |
| 2089 | _LIBCPP_HIDE_FROM_ABI void | 2187 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 2090 | __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source) { | 2188 | __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source) { |
| 2091 | for (iterator __i = __source.begin(); __i != __source.end();) { | 2189 | for (iterator __i = __source.begin(); __i != __source.end();) { |
| 2092 | __node_pointer __src_ptr = __i.__get_np(); | 2190 | __node_pointer __src_ptr = __i.__get_np(); |
| ... | @@ -2094,14 +2192,14 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(__tree<_Tp, _Comp2, | ... | @@ -2094,14 +2192,14 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(__tree<_Tp, _Comp2, |
| 2094 | __node_base_pointer& __child = __find_leaf_high(__parent, __src_ptr->__get_value()); | 2192 | __node_base_pointer& __child = __find_leaf_high(__parent, __src_ptr->__get_value()); |
| 2095 | ++__i; | 2193 | ++__i; |
| 2096 | __source.__remove_node_pointer(__src_ptr); | 2194 | __source.__remove_node_pointer(__src_ptr); |
| 2097 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__src_ptr)); | 2195 | __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__src_ptr)); |
| 2098 | } | 2196 | } |
| 2099 | } | 2197 | } |
| 2100 | |||
| 2101 | #endif // _LIBCPP_STD_VER >= 17 | 2198 | #endif // _LIBCPP_STD_VER >= 17 |
| 2102 | 2199 | ||
| 2103 | template <class _Tp, class _Compare, class _Allocator> | 2200 | template <class _Tp, class _Compare, class _Allocator> |
| 2104 | typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) { | 2201 | _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 2202 | typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) { | ||
| 2105 | __node_pointer __np = __p.__get_np(); | 2203 | __node_pointer __np = __p.__get_np(); |
| 2106 | iterator __r = __remove_node_pointer(__np); | 2204 | iterator __r = __remove_node_pointer(__np); |
| 2107 | __node_allocator& __na = __node_alloc(); | 2205 | __node_allocator& __na = __node_alloc(); |
| ... | @@ -2111,7 +2209,7 @@ typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allo | ... | @@ -2111,7 +2209,7 @@ typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allo |
| 2111 | } | 2209 | } |
| 2112 | 2210 | ||
| 2113 | template <class _Tp, class _Compare, class _Allocator> | 2211 | template <class _Tp, class _Compare, class _Allocator> |
| 2114 | typename __tree<_Tp, _Compare, _Allocator>::iterator | 2212 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator |
| 2115 | __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l) { | 2213 | __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l) { |
| 2116 | while (__f != __l) | 2214 | while (__f != __l) |
| 2117 | __f = erase(__f); | 2215 | __f = erase(__f); |
| ... | @@ -2120,7 +2218,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l) | ... | @@ -2120,7 +2218,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l) |
| 2120 | 2218 | ||
| 2121 | template <class _Tp, class _Compare, class _Allocator> | 2219 | template <class _Tp, class _Compare, class _Allocator> |
| 2122 | template <class _Key> | 2220 | template <class _Key> |
| 2123 | typename __tree<_Tp, _Compare, _Allocator>::size_type | 2221 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type |
| 2124 | __tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) { | 2222 | __tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) { |
| 2125 | iterator __i = find(__k); | 2223 | iterator __i = find(__k); |
| 2126 | if (__i == end()) | 2224 | if (__i == end()) |
| ... | @@ -2131,7 +2229,7 @@ __tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) { | ... | @@ -2131,7 +2229,7 @@ __tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) { |
| 2131 | 2229 | ||
| 2132 | template <class _Tp, class _Compare, class _Allocator> | 2230 | template <class _Tp, class _Compare, class _Allocator> |
| 2133 | template <class _Key> | 2231 | template <class _Key> |
| 2134 | typename __tree<_Tp, _Compare, _Allocator>::size_type | 2232 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type |
| 2135 | __tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) { | 2233 | __tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) { |
| 2136 | pair<iterator, iterator> __p = __equal_range_multi(__k); | 2234 | pair<iterator, iterator> __p = __equal_range_multi(__k); |
| 2137 | size_type __r = 0; | 2235 | size_type __r = 0; |
| ... | @@ -2142,16 +2240,16 @@ __tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) { | ... | @@ -2142,16 +2240,16 @@ __tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) { |
| 2142 | 2240 | ||
| 2143 | template <class _Tp, class _Compare, class _Allocator> | 2241 | template <class _Tp, class _Compare, class _Allocator> |
| 2144 | template <class _Key> | 2242 | template <class _Key> |
| 2145 | typename __tree<_Tp, _Compare, _Allocator>::size_type | 2243 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type |
| 2146 | __tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const { | 2244 | __tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const { |
| 2147 | __node_pointer __rt = __root(); | 2245 | __node_pointer __rt = __root(); |
| 2148 | auto __comp = __lazy_synth_three_way_comparator<value_compare, _Key, value_type>(value_comp()); | 2246 | auto __comp = __lazy_synth_three_way_comparator<value_compare, _Key, value_type>(value_comp()); |
| 2149 | while (__rt != nullptr) { | 2247 | while (__rt != nullptr) { |
| 2150 | auto __comp_res = __comp(__k, __rt->__get_value()); | 2248 | auto __comp_res = __comp(__k, __rt->__get_value()); |
| 2151 | if (__comp_res.__less()) { | 2249 | if (__comp_res.__less()) { |
| 2152 | __rt = static_cast<__node_pointer>(__rt->__left_); | 2250 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_); |
| 2153 | } else if (__comp_res.__greater()) | 2251 | } else if (__comp_res.__greater()) |
| 2154 | __rt = static_cast<__node_pointer>(__rt->__right_); | 2252 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_); |
| 2155 | else | 2253 | else |
| 2156 | return 1; | 2254 | return 1; |
| 2157 | } | 2255 | } |
| ... | @@ -2160,7 +2258,7 @@ __tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const { | ... | @@ -2160,7 +2258,7 @@ __tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const { |
| 2160 | 2258 | ||
| 2161 | template <class _Tp, class _Compare, class _Allocator> | 2259 | template <class _Tp, class _Compare, class _Allocator> |
| 2162 | template <class _Key> | 2260 | template <class _Key> |
| 2163 | typename __tree<_Tp, _Compare, _Allocator>::size_type | 2261 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type |
| 2164 | __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const { | 2262 | __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const { |
| 2165 | __end_node_pointer __result = __end_node(); | 2263 | __end_node_pointer __result = __end_node(); |
| 2166 | __node_pointer __rt = __root(); | 2264 | __node_pointer __rt = __root(); |
| ... | @@ -2168,78 +2266,85 @@ __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const { | ... | @@ -2168,78 +2266,85 @@ __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const { |
| 2168 | while (__rt != nullptr) { | 2266 | while (__rt != nullptr) { |
| 2169 | auto __comp_res = __comp(__k, __rt->__get_value()); | 2267 | auto __comp_res = __comp(__k, __rt->__get_value()); |
| 2170 | if (__comp_res.__less()) { | 2268 | if (__comp_res.__less()) { |
| 2171 | __result = static_cast<__end_node_pointer>(__rt); | 2269 | __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt); |
| 2172 | __rt = static_cast<__node_pointer>(__rt->__left_); | 2270 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_); |
| 2173 | } else if (__comp_res.__greater()) | 2271 | } else if (__comp_res.__greater()) |
| 2174 | __rt = static_cast<__node_pointer>(__rt->__right_); | 2272 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_); |
| 2175 | else | 2273 | else |
| 2176 | return std::distance( | 2274 | return std::distance( |
| 2177 | __lower_bound_multi(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)), | 2275 | __lower_bound_multi(__k, |
| 2178 | __upper_bound_multi(__k, static_cast<__node_pointer>(__rt->__right_), __result)); | 2276 | std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_), |
| 2277 | std::__static_fancy_pointer_cast<__end_node_pointer>(__rt)), | ||
| 2278 | __upper_bound_multi(__k, std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_), __result)); | ||
| 2179 | } | 2279 | } |
| 2180 | return 0; | 2280 | return 0; |
| 2181 | } | 2281 | } |
| 2182 | 2282 | ||
| 2183 | template <class _Tp, class _Compare, class _Allocator> | 2283 | template <class _Tp, class _Compare, class _Allocator> |
| 2184 | template <class _Key> | 2284 | template <class _Key> |
| 2185 | typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound_multi( | 2285 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator |
| 2286 | __tree<_Tp, _Compare, _Allocator>::__lower_bound_multi( | ||
| 2186 | const _Key& __v, __node_pointer __root, __end_node_pointer __result) { | 2287 | const _Key& __v, __node_pointer __root, __end_node_pointer __result) { |
| 2187 | while (__root != nullptr) { | 2288 | while (__root != nullptr) { |
| 2188 | if (!value_comp()(__root->__get_value(), __v)) { | 2289 | if (!value_comp()(__root->__get_value(), __v)) { |
| 2189 | __result = static_cast<__end_node_pointer>(__root); | 2290 | __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root); |
| 2190 | __root = static_cast<__node_pointer>(__root->__left_); | 2291 | __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_); |
| 2191 | } else | 2292 | } else |
| 2192 | __root = static_cast<__node_pointer>(__root->__right_); | 2293 | __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_); |
| 2193 | } | 2294 | } |
| 2194 | return iterator(__result); | 2295 | return iterator(__result); |
| 2195 | } | 2296 | } |
| 2196 | 2297 | ||
| 2197 | template <class _Tp, class _Compare, class _Allocator> | 2298 | template <class _Tp, class _Compare, class _Allocator> |
| 2198 | template <class _Key> | 2299 | template <class _Key> |
| 2199 | typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound_multi( | 2300 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::const_iterator |
| 2301 | __tree<_Tp, _Compare, _Allocator>::__lower_bound_multi( | ||
| 2200 | const _Key& __v, __node_pointer __root, __end_node_pointer __result) const { | 2302 | const _Key& __v, __node_pointer __root, __end_node_pointer __result) const { |
| 2201 | while (__root != nullptr) { | 2303 | while (__root != nullptr) { |
| 2202 | if (!value_comp()(__root->__get_value(), __v)) { | 2304 | if (!value_comp()(__root->__get_value(), __v)) { |
| 2203 | __result = static_cast<__end_node_pointer>(__root); | 2305 | __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root); |
| 2204 | __root = static_cast<__node_pointer>(__root->__left_); | 2306 | __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_); |
| 2205 | } else | 2307 | } else |
| 2206 | __root = static_cast<__node_pointer>(__root->__right_); | 2308 | __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_); |
| 2207 | } | 2309 | } |
| 2208 | return const_iterator(__result); | 2310 | return const_iterator(__result); |
| 2209 | } | 2311 | } |
| 2210 | 2312 | ||
| 2211 | template <class _Tp, class _Compare, class _Allocator> | 2313 | template <class _Tp, class _Compare, class _Allocator> |
| 2212 | template <class _Key> | 2314 | template <class _Key> |
| 2213 | typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound_multi( | 2315 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator |
| 2316 | __tree<_Tp, _Compare, _Allocator>::__upper_bound_multi( | ||
| 2214 | const _Key& __v, __node_pointer __root, __end_node_pointer __result) { | 2317 | const _Key& __v, __node_pointer __root, __end_node_pointer __result) { |
| 2215 | while (__root != nullptr) { | 2318 | while (__root != nullptr) { |
| 2216 | if (value_comp()(__v, __root->__get_value())) { | 2319 | if (value_comp()(__v, __root->__get_value())) { |
| 2217 | __result = static_cast<__end_node_pointer>(__root); | 2320 | __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root); |
| 2218 | __root = static_cast<__node_pointer>(__root->__left_); | 2321 | __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_); |
| 2219 | } else | 2322 | } else |
| 2220 | __root = static_cast<__node_pointer>(__root->__right_); | 2323 | __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_); |
| 2221 | } | 2324 | } |
| 2222 | return iterator(__result); | 2325 | return iterator(__result); |
| 2223 | } | 2326 | } |
| 2224 | 2327 | ||
| 2225 | template <class _Tp, class _Compare, class _Allocator> | 2328 | template <class _Tp, class _Compare, class _Allocator> |
| 2226 | template <class _Key> | 2329 | template <class _Key> |
| 2227 | typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound_multi( | 2330 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::const_iterator |
| 2331 | __tree<_Tp, _Compare, _Allocator>::__upper_bound_multi( | ||
| 2228 | const _Key& __v, __node_pointer __root, __end_node_pointer __result) const { | 2332 | const _Key& __v, __node_pointer __root, __end_node_pointer __result) const { |
| 2229 | while (__root != nullptr) { | 2333 | while (__root != nullptr) { |
| 2230 | if (value_comp()(__v, __root->__get_value())) { | 2334 | if (value_comp()(__v, __root->__get_value())) { |
| 2231 | __result = static_cast<__end_node_pointer>(__root); | 2335 | __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root); |
| 2232 | __root = static_cast<__node_pointer>(__root->__left_); | 2336 | __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_); |
| 2233 | } else | 2337 | } else |
| 2234 | __root = static_cast<__node_pointer>(__root->__right_); | 2338 | __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_); |
| 2235 | } | 2339 | } |
| 2236 | return const_iterator(__result); | 2340 | return const_iterator(__result); |
| 2237 | } | 2341 | } |
| 2238 | 2342 | ||
| 2239 | template <class _Tp, class _Compare, class _Allocator> | 2343 | template <class _Tp, class _Compare, class _Allocator> |
| 2240 | template <class _Key> | 2344 | template <class _Key> |
| 2241 | pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator> | 2345 | _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 2242 | __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) { | 2346 | pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator> |
| 2347 | __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) { | ||
| 2243 | using _Pp = pair<iterator, iterator>; | 2348 | using _Pp = pair<iterator, iterator>; |
| 2244 | __end_node_pointer __result = __end_node(); | 2349 | __end_node_pointer __result = __end_node(); |
| 2245 | __node_pointer __rt = __root(); | 2350 | __node_pointer __rt = __root(); |
| ... | @@ -2247,22 +2352,23 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) { | ... | @@ -2247,22 +2352,23 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) { |
| 2247 | while (__rt != nullptr) { | 2352 | while (__rt != nullptr) { |
| 2248 | auto __comp_res = __comp(__k, __rt->__get_value()); | 2353 | auto __comp_res = __comp(__k, __rt->__get_value()); |
| 2249 | if (__comp_res.__less()) { | 2354 | if (__comp_res.__less()) { |
| 2250 | __result = static_cast<__end_node_pointer>(__rt); | 2355 | __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt); |
| 2251 | __rt = static_cast<__node_pointer>(__rt->__left_); | 2356 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_); |
| 2252 | } else if (__comp_res.__greater()) | 2357 | } else if (__comp_res.__greater()) |
| 2253 | __rt = static_cast<__node_pointer>(__rt->__right_); | 2358 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_); |
| 2254 | else | 2359 | else |
| 2255 | return _Pp(iterator(__rt), | 2360 | return _Pp(iterator(__rt), |
| 2256 | iterator(__rt->__right_ != nullptr ? static_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) | 2361 | iterator(__rt->__right_ != nullptr |
| 2257 | : __result)); | 2362 | ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) |
| 2363 | : __result)); | ||
| 2258 | } | 2364 | } |
| 2259 | return _Pp(iterator(__result), iterator(__result)); | 2365 | return _Pp(iterator(__result), iterator(__result)); |
| 2260 | } | 2366 | } |
| 2261 | 2367 | ||
| 2262 | template <class _Tp, class _Compare, class _Allocator> | 2368 | template <class _Tp, class _Compare, class _Allocator> |
| 2263 | template <class _Key> | 2369 | template <class _Key> |
| 2264 | pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator, | 2370 | _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator, |
| 2265 | typename __tree<_Tp, _Compare, _Allocator>::const_iterator> | 2371 | typename __tree<_Tp, _Compare, _Allocator>::const_iterator> |
| 2266 | __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const { | 2372 | __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const { |
| 2267 | using _Pp = pair<const_iterator, const_iterator>; | 2373 | using _Pp = pair<const_iterator, const_iterator>; |
| 2268 | __end_node_pointer __result = __end_node(); | 2374 | __end_node_pointer __result = __end_node(); |
| ... | @@ -2271,23 +2377,25 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const { | ... | @@ -2271,23 +2377,25 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const { |
| 2271 | while (__rt != nullptr) { | 2377 | while (__rt != nullptr) { |
| 2272 | auto __comp_res = __comp(__k, __rt->__get_value()); | 2378 | auto __comp_res = __comp(__k, __rt->__get_value()); |
| 2273 | if (__comp_res.__less()) { | 2379 | if (__comp_res.__less()) { |
| 2274 | __result = static_cast<__end_node_pointer>(__rt); | 2380 | __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt); |
| 2275 | __rt = static_cast<__node_pointer>(__rt->__left_); | 2381 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_); |
| 2276 | } else if (__comp_res.__greater()) | 2382 | } else if (__comp_res.__greater()) |
| 2277 | __rt = static_cast<__node_pointer>(__rt->__right_); | 2383 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_); |
| 2278 | else | 2384 | else |
| 2279 | return _Pp( | 2385 | return _Pp( |
| 2280 | const_iterator(__rt), | 2386 | const_iterator(__rt), |
| 2281 | const_iterator( | 2387 | const_iterator(__rt->__right_ != nullptr |
| 2282 | __rt->__right_ != nullptr ? static_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) : __result)); | 2388 | ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) |
| 2389 | : __result)); | ||
| 2283 | } | 2390 | } |
| 2284 | return _Pp(const_iterator(__result), const_iterator(__result)); | 2391 | return _Pp(const_iterator(__result), const_iterator(__result)); |
| 2285 | } | 2392 | } |
| 2286 | 2393 | ||
| 2287 | template <class _Tp, class _Compare, class _Allocator> | 2394 | template <class _Tp, class _Compare, class _Allocator> |
| 2288 | template <class _Key> | 2395 | template <class _Key> |
| 2289 | pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator> | 2396 | _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 2290 | __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) { | 2397 | pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator> |
| 2398 | __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) { | ||
| 2291 | using _Pp = pair<iterator, iterator>; | 2399 | using _Pp = pair<iterator, iterator>; |
| 2292 | __end_node_pointer __result = __end_node(); | 2400 | __end_node_pointer __result = __end_node(); |
| 2293 | __node_pointer __rt = __root(); | 2401 | __node_pointer __rt = __root(); |
| ... | @@ -2295,22 +2403,23 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) { | ... | @@ -2295,22 +2403,23 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) { |
| 2295 | while (__rt != nullptr) { | 2403 | while (__rt != nullptr) { |
| 2296 | auto __comp_res = __comp(__k, __rt->__get_value()); | 2404 | auto __comp_res = __comp(__k, __rt->__get_value()); |
| 2297 | if (__comp_res.__less()) { | 2405 | if (__comp_res.__less()) { |
| 2298 | __result = static_cast<__end_node_pointer>(__rt); | 2406 | __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt); |
| 2299 | __rt = static_cast<__node_pointer>(__rt->__left_); | 2407 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_); |
| 2300 | } else if (__comp_res.__greater()) | 2408 | } else if (__comp_res.__greater()) |
| 2301 | __rt = static_cast<__node_pointer>(__rt->__right_); | 2409 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_); |
| 2302 | else | 2410 | else |
| 2303 | return _Pp( | 2411 | return _Pp(__lower_bound_multi(__k, |
| 2304 | __lower_bound_multi(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)), | 2412 | std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_), |
| 2305 | __upper_bound_multi(__k, static_cast<__node_pointer>(__rt->__right_), __result)); | 2413 | std::__static_fancy_pointer_cast<__end_node_pointer>(__rt)), |
| 2414 | __upper_bound_multi(__k, std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_), __result)); | ||
| 2306 | } | 2415 | } |
| 2307 | return _Pp(iterator(__result), iterator(__result)); | 2416 | return _Pp(iterator(__result), iterator(__result)); |
| 2308 | } | 2417 | } |
| 2309 | 2418 | ||
| 2310 | template <class _Tp, class _Compare, class _Allocator> | 2419 | template <class _Tp, class _Compare, class _Allocator> |
| 2311 | template <class _Key> | 2420 | template <class _Key> |
| 2312 | pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator, | 2421 | _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator, |
| 2313 | typename __tree<_Tp, _Compare, _Allocator>::const_iterator> | 2422 | typename __tree<_Tp, _Compare, _Allocator>::const_iterator> |
| 2314 | __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const { | 2423 | __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const { |
| 2315 | using _Pp = pair<const_iterator, const_iterator>; | 2424 | using _Pp = pair<const_iterator, const_iterator>; |
| 2316 | __end_node_pointer __result = __end_node(); | 2425 | __end_node_pointer __result = __end_node(); |
| ... | @@ -2319,35 +2428,37 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const { | ... | @@ -2319,35 +2428,37 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const { |
| 2319 | while (__rt != nullptr) { | 2428 | while (__rt != nullptr) { |
| 2320 | auto __comp_res = __comp(__k, __rt->__get_value()); | 2429 | auto __comp_res = __comp(__k, __rt->__get_value()); |
| 2321 | if (__comp_res.__less()) { | 2430 | if (__comp_res.__less()) { |
| 2322 | __result = static_cast<__end_node_pointer>(__rt); | 2431 | __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt); |
| 2323 | __rt = static_cast<__node_pointer>(__rt->__left_); | 2432 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_); |
| 2324 | } else if (__comp_res.__greater()) | 2433 | } else if (__comp_res.__greater()) |
| 2325 | __rt = static_cast<__node_pointer>(__rt->__right_); | 2434 | __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_); |
| 2326 | else | 2435 | else |
| 2327 | return _Pp( | 2436 | return _Pp(__lower_bound_multi(__k, |
| 2328 | __lower_bound_multi(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)), | 2437 | std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_), |
| 2329 | __upper_bound_multi(__k, static_cast<__node_pointer>(__rt->__right_), __result)); | 2438 | std::__static_fancy_pointer_cast<__end_node_pointer>(__rt)), |
| 2439 | __upper_bound_multi(__k, std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_), __result)); | ||
| 2330 | } | 2440 | } |
| 2331 | return _Pp(const_iterator(__result), const_iterator(__result)); | 2441 | return _Pp(const_iterator(__result), const_iterator(__result)); |
| 2332 | } | 2442 | } |
| 2333 | 2443 | ||
| 2334 | template <class _Tp, class _Compare, class _Allocator> | 2444 | template <class _Tp, class _Compare, class _Allocator> |
| 2335 | typename __tree<_Tp, _Compare, _Allocator>::__node_holder | 2445 | _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_holder |
| 2336 | __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT { | 2446 | __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT { |
| 2337 | __node_pointer __np = __p.__get_np(); | 2447 | __node_pointer __np = __p.__get_np(); |
| 2338 | if (__begin_node_ == __p.__ptr_) { | 2448 | if (__begin_node_ == __p.__ptr_) { |
| 2339 | if (__np->__right_ != nullptr) | 2449 | if (__np->__right_ != nullptr) |
| 2340 | __begin_node_ = static_cast<__end_node_pointer>(__np->__right_); | 2450 | __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__np->__right_); |
| 2341 | else | 2451 | else |
| 2342 | __begin_node_ = static_cast<__end_node_pointer>(__np->__parent_); | 2452 | __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__np->__parent_); |
| 2343 | } | 2453 | } |
| 2344 | --__size_; | 2454 | --__size_; |
| 2345 | std::__tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__np)); | 2455 | std::__tree_remove(__end_node()->__left_, std::__static_fancy_pointer_cast<__node_base_pointer>(__np)); |
| 2346 | return __node_holder(__np, _Dp(__node_alloc(), true)); | 2456 | return __node_holder(__np, _Dp(__node_alloc(), true)); |
| 2347 | } | 2457 | } |
| 2348 | 2458 | ||
| 2349 | template <class _Tp, class _Compare, class _Allocator> | 2459 | template <class _Tp, class _Compare, class _Allocator> |
| 2350 | inline _LIBCPP_HIDE_FROM_ABI void swap(__tree<_Tp, _Compare, _Allocator>& __x, __tree<_Tp, _Compare, _Allocator>& __y) | 2460 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 2461 | swap(__tree<_Tp, _Compare, _Allocator>& __x, __tree<_Tp, _Compare, _Allocator>& __y) | ||
| 2351 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { | 2462 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { |
| 2352 | __x.swap(__y); | 2463 | __x.swap(__y); |
| 2353 | } | 2464 | } |
lib/libcxx/include/__tuple/make_tuple_types.h deleted-80| ... | @@ -1,80 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TUPLE_MAKE_TUPLE_TYPES_H | ||
| 10 | #define _LIBCPP___TUPLE_MAKE_TUPLE_TYPES_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__cstddef/size_t.h> | ||
| 14 | #include <__fwd/array.h> | ||
| 15 | #include <__fwd/tuple.h> | ||
| 16 | #include <__tuple/tuple_element.h> | ||
| 17 | #include <__tuple/tuple_indices.h> | ||
| 18 | #include <__tuple/tuple_size.h> | ||
| 19 | #include <__tuple/tuple_types.h> | ||
| 20 | #include <__type_traits/copy_cvref.h> | ||
| 21 | #include <__type_traits/remove_cvref.h> | ||
| 22 | #include <__type_traits/remove_reference.h> | ||
| 23 | |||
| 24 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 25 | # pragma GCC system_header | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #ifndef _LIBCPP_CXX03_LANG | ||
| 29 | |||
| 30 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 31 | |||
| 32 | // __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a | ||
| 33 | // __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep). | ||
| 34 | // _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a | ||
| 35 | // lvalue_reference type, then __tuple_types<_Types&...> is the result. | ||
| 36 | |||
| 37 | template <class _TupleTypes, class _TupleIndices> | ||
| 38 | struct __make_tuple_types_flat; | ||
| 39 | |||
| 40 | template <template <class...> class _Tuple, class... _Types, size_t... _Idx> | ||
| 41 | struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> { | ||
| 42 | // Specialization for pair, tuple, and __tuple_types | ||
| 43 | template <class _Tp> | ||
| 44 | using __apply_quals _LIBCPP_NODEBUG = __tuple_types<__copy_cvref_t<_Tp, __type_pack_element<_Idx, _Types...>>...>; | ||
| 45 | }; | ||
| 46 | |||
| 47 | template <class _Vt, size_t _Np, size_t... _Idx> | ||
| 48 | struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> { | ||
| 49 | template <size_t> | ||
| 50 | using __value_type _LIBCPP_NODEBUG = _Vt; | ||
| 51 | template <class _Tp> | ||
| 52 | using __apply_quals _LIBCPP_NODEBUG = __tuple_types<__copy_cvref_t<_Tp, __value_type<_Idx>>...>; | ||
| 53 | }; | ||
| 54 | |||
| 55 | template <class _Tp, | ||
| 56 | size_t _Ep = tuple_size<__libcpp_remove_reference_t<_Tp> >::value, | ||
| 57 | size_t _Sp = 0, | ||
| 58 | bool _SameSize = (_Ep == tuple_size<__libcpp_remove_reference_t<_Tp> >::value)> | ||
| 59 | struct __make_tuple_types { | ||
| 60 | static_assert(_Sp <= _Ep, "__make_tuple_types input error"); | ||
| 61 | using _RawTp _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>; | ||
| 62 | using _Maker _LIBCPP_NODEBUG = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>; | ||
| 63 | using type _LIBCPP_NODEBUG = typename _Maker::template __apply_quals<_Tp>; | ||
| 64 | }; | ||
| 65 | |||
| 66 | template <class... _Types, size_t _Ep> | ||
| 67 | struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> { | ||
| 68 | using type _LIBCPP_NODEBUG = __tuple_types<_Types...>; | ||
| 69 | }; | ||
| 70 | |||
| 71 | template <class... _Types, size_t _Ep> | ||
| 72 | struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> { | ||
| 73 | using type _LIBCPP_NODEBUG = __tuple_types<_Types...>; | ||
| 74 | }; | ||
| 75 | |||
| 76 | _LIBCPP_END_NAMESPACE_STD | ||
| 77 | |||
| 78 | #endif // _LIBCPP_CXX03_LANG | ||
| 79 | |||
| 80 | #endif // _LIBCPP___TUPLE_MAKE_TUPLE_TYPES_H | ||
lib/libcxx/include/__tuple/sfinae_helpers.h+6-5| ... | @@ -15,10 +15,10 @@ | ... | @@ -15,10 +15,10 @@ |
| 15 | # pragma GCC system_header | 15 | # pragma GCC system_header |
| 16 | #endif | 16 | #endif |
| 17 | 17 | ||
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 19 | |||
| 20 | #ifndef _LIBCPP_CXX03_LANG | 18 | #ifndef _LIBCPP_CXX03_LANG |
| 21 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | struct __check_tuple_constructor_fail { | 22 | struct __check_tuple_constructor_fail { |
| 23 | static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() { return false; } | 23 | static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() { return false; } |
| 24 | static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() { return false; } | 24 | static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() { return false; } |
| ... | @@ -35,9 +35,8 @@ struct __check_tuple_constructor_fail { | ... | @@ -35,9 +35,8 @@ struct __check_tuple_constructor_fail { |
| 35 | return false; | 35 | return false; |
| 36 | } | 36 | } |
| 37 | }; | 37 | }; |
| 38 | #endif // !defined(_LIBCPP_CXX03_LANG) | ||
| 39 | 38 | ||
| 40 | #if _LIBCPP_STD_VER >= 17 | 39 | # if _LIBCPP_STD_VER >= 17 |
| 41 | 40 | ||
| 42 | template <bool _CanCopy, bool _CanMove> | 41 | template <bool _CanCopy, bool _CanMove> |
| 43 | struct __sfinae_ctor_base {}; | 42 | struct __sfinae_ctor_base {}; |
| ... | @@ -92,8 +91,10 @@ struct __sfinae_assign_base<false, true> { | ... | @@ -92,8 +91,10 @@ struct __sfinae_assign_base<false, true> { |
| 92 | __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete; | 91 | __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete; |
| 93 | __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default; | 92 | __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default; |
| 94 | }; | 93 | }; |
| 95 | #endif // _LIBCPP_STD_VER >= 17 | 94 | # endif // _LIBCPP_STD_VER >= 17 |
| 96 | 95 | ||
| 97 | _LIBCPP_END_NAMESPACE_STD | 96 | _LIBCPP_END_NAMESPACE_STD |
| 98 | 97 | ||
| 98 | #endif // !defined(_LIBCPP_CXX03_LANG) | ||
| 99 | |||
| 99 | #endif // _LIBCPP___TUPLE_SFINAE_HELPERS_H | 100 | #endif // _LIBCPP___TUPLE_SFINAE_HELPERS_H |
lib/libcxx/include/__tuple/tuple_indices.h deleted-37| ... | @@ -1,37 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TUPLE_MAKE_TUPLE_INDICES_H | ||
| 10 | #define _LIBCPP___TUPLE_MAKE_TUPLE_INDICES_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__cstddef/size_t.h> | ||
| 14 | #include <__utility/integer_sequence.h> | ||
| 15 | |||
| 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 17 | # pragma GCC system_header | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #ifndef _LIBCPP_CXX03_LANG | ||
| 21 | |||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | template <size_t...> | ||
| 25 | struct __tuple_indices {}; | ||
| 26 | |||
| 27 | template <size_t _Ep, size_t _Sp = 0> | ||
| 28 | struct __make_tuple_indices { | ||
| 29 | static_assert(_Sp <= _Ep, "__make_tuple_indices input error"); | ||
| 30 | typedef __make_indices_imp<_Ep, _Sp> type; | ||
| 31 | }; | ||
| 32 | |||
| 33 | _LIBCPP_END_NAMESPACE_STD | ||
| 34 | |||
| 35 | #endif // _LIBCPP_CXX03_LANG | ||
| 36 | |||
| 37 | #endif // _LIBCPP___TUPLE_MAKE_TUPLE_INDICES_H | ||
lib/libcxx/include/__tuple/tuple_like.h+4-4| ... | @@ -19,10 +19,10 @@ | ... | @@ -19,10 +19,10 @@ |
| 19 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 20 | 22 | #if _LIBCPP_STD_VER >= 20 |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | template <class _Tp> | 26 | template <class _Tp> |
| 27 | inline constexpr bool __is_ranges_subrange_v = false; | 27 | inline constexpr bool __is_ranges_subrange_v = false; |
| 28 | 28 | ||
| ... | @@ -35,8 +35,8 @@ concept __tuple_like = __tuple_like_no_subrange<_Tp> || __is_ranges_subrange_v<r | ... | @@ -35,8 +35,8 @@ concept __tuple_like = __tuple_like_no_subrange<_Tp> || __is_ranges_subrange_v<r |
| 35 | // As of writing this comment every use of `pair-like` in the standard excludes `ranges::subrange`, so | 35 | // As of writing this comment every use of `pair-like` in the standard excludes `ranges::subrange`, so |
| 36 | // you most likely want to use `__pair_like_no_subrange` if you're looking for `pair-like`. | 36 | // you most likely want to use `__pair_like_no_subrange` if you're looking for `pair-like`. |
| 37 | 37 | ||
| 38 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 39 | |||
| 40 | _LIBCPP_END_NAMESPACE_STD | 38 | _LIBCPP_END_NAMESPACE_STD |
| 41 | 39 | ||
| 40 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 41 | |||
| 42 | #endif // _LIBCPP___TUPLE_TUPLE_LIKE_H | 42 | #endif // _LIBCPP___TUPLE_TUPLE_LIKE_H |
lib/libcxx/include/__tuple/tuple_like_ext.h deleted-52| ... | @@ -1,52 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TUPLE_TUPLE_LIKE_EXT_H | ||
| 10 | #define _LIBCPP___TUPLE_TUPLE_LIKE_EXT_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__cstddef/size_t.h> | ||
| 14 | #include <__fwd/array.h> | ||
| 15 | #include <__fwd/pair.h> | ||
| 16 | #include <__fwd/tuple.h> | ||
| 17 | #include <__tuple/tuple_types.h> | ||
| 18 | #include <__type_traits/integral_constant.h> | ||
| 19 | |||
| 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 21 | # pragma GCC system_header | ||
| 22 | #endif | ||
| 23 | |||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | template <class _Tp> | ||
| 27 | struct __tuple_like_ext : false_type {}; | ||
| 28 | |||
| 29 | template <class _Tp> | ||
| 30 | struct __tuple_like_ext<const _Tp> : public __tuple_like_ext<_Tp> {}; | ||
| 31 | template <class _Tp> | ||
| 32 | struct __tuple_like_ext<volatile _Tp> : public __tuple_like_ext<_Tp> {}; | ||
| 33 | template <class _Tp> | ||
| 34 | struct __tuple_like_ext<const volatile _Tp> : public __tuple_like_ext<_Tp> {}; | ||
| 35 | |||
| 36 | #ifndef _LIBCPP_CXX03_LANG | ||
| 37 | template <class... _Tp> | ||
| 38 | struct __tuple_like_ext<tuple<_Tp...> > : true_type {}; | ||
| 39 | #endif | ||
| 40 | |||
| 41 | template <class _T1, class _T2> | ||
| 42 | struct __tuple_like_ext<pair<_T1, _T2> > : true_type {}; | ||
| 43 | |||
| 44 | template <class _Tp, size_t _Size> | ||
| 45 | struct __tuple_like_ext<array<_Tp, _Size> > : true_type {}; | ||
| 46 | |||
| 47 | template <class... _Tp> | ||
| 48 | struct __tuple_like_ext<__tuple_types<_Tp...> > : true_type {}; | ||
| 49 | |||
| 50 | _LIBCPP_END_NAMESPACE_STD | ||
| 51 | |||
| 52 | #endif // _LIBCPP___TUPLE_TUPLE_LIKE_EXT_H | ||
lib/libcxx/include/__tuple/tuple_like_no_subrange.h+4-4| ... | @@ -22,10 +22,10 @@ | ... | @@ -22,10 +22,10 @@ |
| 22 | # pragma GCC system_header | 22 | # pragma GCC system_header |
| 23 | #endif | 23 | #endif |
| 24 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 26 | |||
| 27 | #if _LIBCPP_STD_VER >= 20 | 25 | #if _LIBCPP_STD_VER >= 20 |
| 28 | 26 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 28 | |||
| 29 | template <class _Tp> | 29 | template <class _Tp> |
| 30 | inline constexpr bool __tuple_like_no_subrange_impl = false; | 30 | inline constexpr bool __tuple_like_no_subrange_impl = false; |
| 31 | 31 | ||
| ... | @@ -54,8 +54,8 @@ concept __tuple_like_no_subrange = __tuple_like_no_subrange_impl<remove_cvref_t< | ... | @@ -54,8 +54,8 @@ concept __tuple_like_no_subrange = __tuple_like_no_subrange_impl<remove_cvref_t< |
| 54 | template <class _Tp> | 54 | template <class _Tp> |
| 55 | concept __pair_like_no_subrange = __tuple_like_no_subrange<_Tp> && tuple_size<remove_cvref_t<_Tp>>::value == 2; | 55 | concept __pair_like_no_subrange = __tuple_like_no_subrange<_Tp> && tuple_size<remove_cvref_t<_Tp>>::value == 2; |
| 56 | 56 | ||
| 57 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 58 | |||
| 59 | _LIBCPP_END_NAMESPACE_STD | 57 | _LIBCPP_END_NAMESPACE_STD |
| 60 | 58 | ||
| 59 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 60 | |||
| 61 | #endif // _LIBCPP___TUPLE_TUPLE_LIKE_NO_SUBRANGE_H | 61 | #endif // _LIBCPP___TUPLE_TUPLE_LIKE_NO_SUBRANGE_H |
lib/libcxx/include/__tuple/tuple_types.h deleted-25| ... | @@ -1,25 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TUPLE_TUPLE_TYPES_H | ||
| 10 | #define _LIBCPP___TUPLE_TUPLE_TYPES_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | |||
| 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 15 | # pragma GCC system_header | ||
| 16 | #endif | ||
| 17 | |||
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 19 | |||
| 20 | template <class... _Tp> | ||
| 21 | struct __tuple_types {}; | ||
| 22 | |||
| 23 | _LIBCPP_END_NAMESPACE_STD | ||
| 24 | |||
| 25 | #endif // _LIBCPP___TUPLE_TUPLE_TYPES_H | ||
lib/libcxx/include/__type_traits/add_pointer.h+3-28| ... | @@ -10,9 +10,6 @@ | ... | @@ -10,9 +10,6 @@ |
| 10 | #define _LIBCPP___TYPE_TRAITS_ADD_POINTER_H | 10 | #define _LIBCPP___TYPE_TRAITS_ADD_POINTER_H |
| 11 | 11 | ||
| 12 | #include <__config> | 12 | #include <__config> |
| 13 | #include <__type_traits/is_referenceable.h> | ||
| 14 | #include <__type_traits/is_void.h> | ||
| 15 | #include <__type_traits/remove_reference.h> | ||
| 16 | 13 | ||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | # pragma GCC system_header | 15 | # pragma GCC system_header |
| ... | @@ -20,40 +17,18 @@ | ... | @@ -20,40 +17,18 @@ |
| 20 | 17 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 19 | ||
| 23 | #if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) | ||
| 24 | |||
| 25 | template <class _Tp> | 20 | template <class _Tp> |
| 26 | struct _LIBCPP_NO_SPECIALIZATIONS add_pointer { | 21 | struct _LIBCPP_NO_SPECIALIZATIONS add_pointer { |
| 27 | using type _LIBCPP_NODEBUG = __add_pointer(_Tp); | 22 | using type _LIBCPP_NODEBUG = __add_pointer(_Tp); |
| 28 | }; | 23 | }; |
| 29 | 24 | ||
| 30 | # ifdef _LIBCPP_COMPILER_GCC | 25 | #ifdef _LIBCPP_COMPILER_GCC |
| 31 | template <class _Tp> | 26 | template <class _Tp> |
| 32 | using __add_pointer_t _LIBCPP_NODEBUG = typename add_pointer<_Tp>::type; | 27 | using __add_pointer_t _LIBCPP_NODEBUG = typename add_pointer<_Tp>::type; |
| 33 | # else | ||
| 34 | template <class _Tp> | ||
| 35 | using __add_pointer_t _LIBCPP_NODEBUG = __add_pointer(_Tp); | ||
| 36 | # endif | ||
| 37 | |||
| 38 | #else | 28 | #else |
| 39 | template <class _Tp, bool = __is_referenceable_v<_Tp> || is_void<_Tp>::value> | ||
| 40 | struct __add_pointer_impl { | ||
| 41 | using type _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tp>*; | ||
| 42 | }; | ||
| 43 | template <class _Tp> | ||
| 44 | struct __add_pointer_impl<_Tp, false> { | ||
| 45 | using type _LIBCPP_NODEBUG = _Tp; | ||
| 46 | }; | ||
| 47 | |||
| 48 | template <class _Tp> | 29 | template <class _Tp> |
| 49 | using __add_pointer_t = typename __add_pointer_impl<_Tp>::type; | 30 | using __add_pointer_t _LIBCPP_NODEBUG = __add_pointer(_Tp); |
| 50 | 31 | #endif | |
| 51 | template <class _Tp> | ||
| 52 | struct _LIBCPP_NO_SPECIALIZATIONS add_pointer { | ||
| 53 | using type _LIBCPP_NODEBUG = __add_pointer_t<_Tp>; | ||
| 54 | }; | ||
| 55 | |||
| 56 | #endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) | ||
| 57 | 32 | ||
| 58 | #if _LIBCPP_STD_VER >= 14 | 33 | #if _LIBCPP_STD_VER >= 14 |
| 59 | template <class _Tp> | 34 | template <class _Tp> |
lib/libcxx/include/__type_traits/aligned_union.h+10-13| ... | @@ -19,25 +19,22 @@ | ... | @@ -19,25 +19,22 @@ |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | ||
| 22 | template <size_t _I0, size_t... _In> | 22 | template <class _Arg0, class... _Args> |
| 23 | struct __static_max; | 23 | union __union { |
| 24 | 24 | _ALIGNAS(_LIBCPP_PREFERRED_ALIGNOF(_Arg0)) _Arg0 __arg; | |
| 25 | template <size_t _I0> | 25 | __union<_Args...> __u; |
| 26 | struct __static_max<_I0> { | ||
| 27 | static const size_t value = _I0; | ||
| 28 | }; | 26 | }; |
| 29 | 27 | ||
| 30 | template <size_t _I0, size_t _I1, size_t... _In> | 28 | template <class _Arg> |
| 31 | struct __static_max<_I0, _I1, _In...> { | 29 | union __union<_Arg> { |
| 32 | static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : __static_max<_I1, _In...>::value; | 30 | _ALIGNAS(_LIBCPP_PREFERRED_ALIGNOF(_Arg)) _Arg __arg; |
| 33 | }; | 31 | }; |
| 34 | 32 | ||
| 35 | template <size_t _Len, class _Type0, class... _Types> | 33 | template <size_t _Len, class _Type0, class... _Types> |
| 36 | struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_NO_SPECIALIZATIONS aligned_union { | 34 | struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_NO_SPECIALIZATIONS aligned_union { |
| 37 | static const size_t alignment_value = | 35 | using _Union _LIBCPP_NODEBUG = __union<char[_Len], _Type0, _Types...>; |
| 38 | __static_max<_LIBCPP_PREFERRED_ALIGNOF(_Type0), _LIBCPP_PREFERRED_ALIGNOF(_Types)...>::value; | 36 | static const size_t alignment_value = _LIBCPP_ALIGNOF(_Union); |
| 39 | static const size_t __len = __static_max<_Len, sizeof(_Type0), sizeof(_Types)...>::value; | 37 | using type _LIBCPP_NODEBUG = typename aligned_storage<sizeof(_Union), alignment_value>::type; |
| 40 | typedef typename aligned_storage<__len, alignment_value>::type type; | ||
| 41 | }; | 38 | }; |
| 42 | 39 | ||
| 43 | #if _LIBCPP_STD_VER >= 14 | 40 | #if _LIBCPP_STD_VER >= 14 |
lib/libcxx/include/__type_traits/can_extract_key.h deleted-53| ... | @@ -1,53 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TYPE_TRAITS_CAN_EXTRACT_KEY_H | ||
| 10 | #define _LIBCPP___TYPE_TRAITS_CAN_EXTRACT_KEY_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__fwd/pair.h> | ||
| 14 | #include <__type_traits/conditional.h> | ||
| 15 | #include <__type_traits/integral_constant.h> | ||
| 16 | #include <__type_traits/is_same.h> | ||
| 17 | #include <__type_traits/remove_const.h> | ||
| 18 | #include <__type_traits/remove_const_ref.h> | ||
| 19 | |||
| 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 21 | # pragma GCC system_header | ||
| 22 | #endif | ||
| 23 | |||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | // These traits are used in __tree and __hash_table | ||
| 27 | struct __extract_key_fail_tag {}; | ||
| 28 | struct __extract_key_self_tag {}; | ||
| 29 | struct __extract_key_first_tag {}; | ||
| 30 | |||
| 31 | template <class _ValTy, class _Key, class _RawValTy = __remove_const_ref_t<_ValTy> > | ||
| 32 | struct __can_extract_key | ||
| 33 | : __conditional_t<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag, __extract_key_fail_tag> {}; | ||
| 34 | |||
| 35 | template <class _Pair, class _Key, class _First, class _Second> | ||
| 36 | struct __can_extract_key<_Pair, _Key, pair<_First, _Second> > | ||
| 37 | : __conditional_t<_IsSame<__remove_const_t<_First>, _Key>::value, __extract_key_first_tag, __extract_key_fail_tag> { | ||
| 38 | }; | ||
| 39 | |||
| 40 | // __can_extract_map_key uses true_type/false_type instead of the tags. | ||
| 41 | // It returns true if _Key != _ContainerValueTy (the container is a map not a set) | ||
| 42 | // and _ValTy == _Key. | ||
| 43 | template <class _ValTy, class _Key, class _ContainerValueTy, class _RawValTy = __remove_const_ref_t<_ValTy> > | ||
| 44 | struct __can_extract_map_key : integral_constant<bool, _IsSame<_RawValTy, _Key>::value> {}; | ||
| 45 | |||
| 46 | // This specialization returns __extract_key_fail_tag for non-map containers | ||
| 47 | // because _Key == _ContainerValueTy | ||
| 48 | template <class _ValTy, class _Key, class _RawValTy> | ||
| 49 | struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> : false_type {}; | ||
| 50 | |||
| 51 | _LIBCPP_END_NAMESPACE_STD | ||
| 52 | |||
| 53 | #endif // _LIBCPP___TYPE_TRAITS_CAN_EXTRACT_KEY_H | ||
lib/libcxx/include/__type_traits/common_reference.h+5-3| ... | @@ -24,10 +24,12 @@ | ... | @@ -24,10 +24,12 @@ |
| 24 | # pragma GCC system_header | 24 | # pragma GCC system_header |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | #if _LIBCPP_STD_VER >= 20 | ||
| 28 | |||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 30 | ||
| 29 | // common_reference | 31 | // common_reference |
| 30 | #if _LIBCPP_STD_VER >= 20 | 32 | |
| 31 | // Let COND_RES(X, Y) be: | 33 | // Let COND_RES(X, Y) be: |
| 32 | template <class _Xp, class _Yp> | 34 | template <class _Xp, class _Yp> |
| 33 | using __cond_res _LIBCPP_NODEBUG = decltype(false ? std::declval<_Xp (&)()>()() : std::declval<_Yp (&)()>()()); | 35 | using __cond_res _LIBCPP_NODEBUG = decltype(false ? std::declval<_Xp (&)()>()() : std::declval<_Yp (&)()>()()); |
| ... | @@ -195,8 +197,8 @@ _LIBCPP_DIAGNOSTIC_POP | ... | @@ -195,8 +197,8 @@ _LIBCPP_DIAGNOSTIC_POP |
| 195 | template <class...> | 197 | template <class...> |
| 196 | struct _LIBCPP_NO_SPECIALIZATIONS common_reference {}; | 198 | struct _LIBCPP_NO_SPECIALIZATIONS common_reference {}; |
| 197 | 199 | ||
| 198 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 199 | |||
| 200 | _LIBCPP_END_NAMESPACE_STD | 200 | _LIBCPP_END_NAMESPACE_STD |
| 201 | 201 | ||
| 202 | #endif // _LIBCPP_STD_VER >= 20 | ||
| 203 | |||
| 202 | #endif // _LIBCPP___TYPE_TRAITS_COMMON_REFERENCE_H | 204 | #endif // _LIBCPP___TYPE_TRAITS_COMMON_REFERENCE_H |
lib/libcxx/include/__type_traits/conditional.h+2-12| ... | @@ -35,20 +35,10 @@ struct _IfImpl<false> { | ... | @@ -35,20 +35,10 @@ struct _IfImpl<false> { |
| 35 | template <bool _Cond, class _IfRes, class _ElseRes> | 35 | template <bool _Cond, class _IfRes, class _ElseRes> |
| 36 | using _If _LIBCPP_NODEBUG = typename _IfImpl<_Cond>::template _Select<_IfRes, _ElseRes>; | 36 | using _If _LIBCPP_NODEBUG = typename _IfImpl<_Cond>::template _Select<_IfRes, _ElseRes>; |
| 37 | 37 | ||
| 38 | template <bool _Bp, class _If, class _Then> | 38 | template <bool _Bp, class _IfRes, class _ElseRes> |
| 39 | struct _LIBCPP_NO_SPECIALIZATIONS conditional { | 39 | struct _LIBCPP_NO_SPECIALIZATIONS conditional { |
| 40 | using type _LIBCPP_NODEBUG = _If; | 40 | using type _LIBCPP_NODEBUG = _If<_Bp, _IfRes, _ElseRes>; |
| 41 | }; | ||
| 42 | |||
| 43 | _LIBCPP_DIAGNOSTIC_PUSH | ||
| 44 | #if __has_warning("-Winvalid-specialization") | ||
| 45 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") | ||
| 46 | #endif | ||
| 47 | template <class _If, class _Then> | ||
| 48 | struct conditional<false, _If, _Then> { | ||
| 49 | using type _LIBCPP_NODEBUG = _Then; | ||
| 50 | }; | 41 | }; |
| 51 | _LIBCPP_DIAGNOSTIC_POP | ||
| 52 | 42 | ||
| 53 | #if _LIBCPP_STD_VER >= 14 | 43 | #if _LIBCPP_STD_VER >= 14 |
| 54 | template <bool _Bp, class _IfRes, class _ElseRes> | 44 | template <bool _Bp, class _IfRes, class _ElseRes> |
lib/libcxx/include/__type_traits/conjunction.h+1-1| ... | @@ -34,7 +34,7 @@ false_type __and_helper(...); | ... | @@ -34,7 +34,7 @@ false_type __and_helper(...); |
| 34 | // | 34 | // |
| 35 | // However, `_And<_Pred...>` itself will evaluate its result immediately (without having to | 35 | // However, `_And<_Pred...>` itself will evaluate its result immediately (without having to |
| 36 | // be instantiated) since it is an alias, unlike `conjunction<_Pred...>`, which is a struct. | 36 | // be instantiated) since it is an alias, unlike `conjunction<_Pred...>`, which is a struct. |
| 37 | // If you want to defer the evaluation of `_And<_Pred...>` itself, use `_Lazy<_And, _Pred...>`. | 37 | // If you want to defer the evaluation, use `conjunction{,_v}<_Pred...>`. |
| 38 | template <class... _Pred> | 38 | template <class... _Pred> |
| 39 | using _And _LIBCPP_NODEBUG = decltype(std::__and_helper<_Pred...>(0)); | 39 | using _And _LIBCPP_NODEBUG = decltype(std::__and_helper<_Pred...>(0)); |
| 40 | 40 |
lib/libcxx/include/__type_traits/dependent_type.h deleted-25| ... | @@ -1,25 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TYPE_TRAITS_DEPENDENT_TYPE_H | ||
| 10 | #define _LIBCPP___TYPE_TRAITS_DEPENDENT_TYPE_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | |||
| 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 15 | # pragma GCC system_header | ||
| 16 | #endif | ||
| 17 | |||
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 19 | |||
| 20 | template <class _Tp, bool> | ||
| 21 | struct __dependent_type : public _Tp {}; | ||
| 22 | |||
| 23 | _LIBCPP_END_NAMESPACE_STD | ||
| 24 | |||
| 25 | #endif // _LIBCPP___TYPE_TRAITS_DEPENDENT_TYPE_H | ||
lib/libcxx/include/__type_traits/disjunction.h+1-2| ... | @@ -38,8 +38,7 @@ struct _OrImpl<false> { | ... | @@ -38,8 +38,7 @@ struct _OrImpl<false> { |
| 38 | // | 38 | // |
| 39 | // However, `_Or<_Pred...>` itself will evaluate its result immediately (without having to | 39 | // However, `_Or<_Pred...>` itself will evaluate its result immediately (without having to |
| 40 | // be instantiated) since it is an alias, unlike `disjunction<_Pred...>`, which is a struct. | 40 | // be instantiated) since it is an alias, unlike `disjunction<_Pred...>`, which is a struct. |
| 41 | // If you want to defer the evaluation of `_Or<_Pred...>` itself, use `_Lazy<_Or, _Pred...>` | 41 | // If you want to defer the evaluation , use `disjunction{,_v}<_Pred...>`. |
| 42 | // or `disjunction<_Pred...>` directly. | ||
| 43 | template <class... _Args> | 42 | template <class... _Args> |
| 44 | using _Or _LIBCPP_NODEBUG = typename _OrImpl<sizeof...(_Args) != 0>::template _Result<false_type, _Args...>; | 43 | using _Or _LIBCPP_NODEBUG = typename _OrImpl<sizeof...(_Args) != 0>::template _Result<false_type, _Args...>; |
| 45 | 44 |
lib/libcxx/include/__type_traits/has_unique_object_representation.h+4-4| ... | @@ -16,10 +16,10 @@ | ... | @@ -16,10 +16,10 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | #if _LIBCPP_STD_VER >= 17 | 19 | #if _LIBCPP_STD_VER >= 17 |
| 22 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | template <class _Tp> | 23 | template <class _Tp> |
| 24 | struct _LIBCPP_NO_SPECIALIZATIONS has_unique_object_representations | 24 | struct _LIBCPP_NO_SPECIALIZATIONS has_unique_object_representations |
| 25 | : integral_constant<bool, __has_unique_object_representations(_Tp)> {}; | 25 | : integral_constant<bool, __has_unique_object_representations(_Tp)> {}; |
| ... | @@ -28,8 +28,8 @@ template <class _Tp> | ... | @@ -28,8 +28,8 @@ template <class _Tp> |
| 28 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool has_unique_object_representations_v = | 28 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool has_unique_object_representations_v = |
| 29 | __has_unique_object_representations(_Tp); | 29 | __has_unique_object_representations(_Tp); |
| 30 | 30 | ||
| 31 | #endif | ||
| 32 | |||
| 33 | _LIBCPP_END_NAMESPACE_STD | 31 | _LIBCPP_END_NAMESPACE_STD |
| 34 | 32 | ||
| 33 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 34 | |||
| 35 | #endif // _LIBCPP___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H | 35 | #endif // _LIBCPP___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H |
lib/libcxx/include/__type_traits/integer_traits.h+26-29| ... | @@ -10,6 +10,11 @@ | ... | @@ -10,6 +10,11 @@ |
| 10 | #define _LIBCPP___TYPE_TRAITS_INTEGER_TRAITS_H | 10 | #define _LIBCPP___TYPE_TRAITS_INTEGER_TRAITS_H |
| 11 | 11 | ||
| 12 | #include <__config> | 12 | #include <__config> |
| 13 | #include <__type_traits/is_integral.h> | ||
| 14 | #include <__type_traits/is_same.h> | ||
| 15 | #include <__type_traits/is_signed.h> | ||
| 16 | #include <__type_traits/is_unqualified.h> | ||
| 17 | #include <__type_traits/is_unsigned.h> | ||
| 13 | 18 | ||
| 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 15 | # pragma GCC system_header | 20 | # pragma GCC system_header |
| ... | @@ -17,43 +22,35 @@ | ... | @@ -17,43 +22,35 @@ |
| 17 | 22 | ||
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 24 | ||
| 20 | // This trait is to determine whether a type is a /signed integer type/ | 25 | // /signed integer type/ and /unsigned integer type/ per [basic.fundamental] |
| 21 | // See [basic.fundamental]/p1 | 26 | // /p1-2: specific unqualified types plus extended integer types. bool and |
| 27 | // character types are integral but excluded. cv-qualified versions are | ||
| 28 | // distinct types ([basic.type.qualifier]) and so excluded. | ||
| 29 | |||
| 22 | template <class _Tp> | 30 | template <class _Tp> |
| 23 | inline const bool __is_signed_integer_v = false; | 31 | inline const bool __is_character_v = false; |
| 24 | template <> | ||
| 25 | inline const bool __is_signed_integer_v<signed char> = true; | ||
| 26 | template <> | 32 | template <> |
| 27 | inline const bool __is_signed_integer_v<signed short> = true; | 33 | inline const bool __is_character_v<char> = true; |
| 28 | template <> | 34 | template <> |
| 29 | inline const bool __is_signed_integer_v<signed int> = true; | 35 | inline const bool __is_character_v<wchar_t> = true; |
| 36 | #if _LIBCPP_HAS_CHAR8_T | ||
| 30 | template <> | 37 | template <> |
| 31 | inline const bool __is_signed_integer_v<signed long> = true; | 38 | inline const bool __is_character_v<char8_t> = true; |
| 39 | #endif | ||
| 32 | template <> | 40 | template <> |
| 33 | inline const bool __is_signed_integer_v<signed long long> = true; | 41 | inline const bool __is_character_v<char16_t> = true; |
| 34 | #if _LIBCPP_HAS_INT128 | ||
| 35 | template <> | 42 | template <> |
| 36 | inline const bool __is_signed_integer_v<__int128_t> = true; | 43 | inline const bool __is_character_v<char32_t> = true; |
| 37 | #endif | ||
| 38 | 44 | ||
| 39 | // This trait is to determine whether a type is an /unsigned integer type/ | ||
| 40 | // See [basic.fundamental]/p2 | ||
| 41 | template <class _Tp> | 45 | template <class _Tp> |
| 42 | inline const bool __is_unsigned_integer_v = false; | 46 | inline const bool __is_signed_integer_v = |
| 43 | template <> | 47 | is_integral<_Tp>::value && is_signed<_Tp>::value && !__is_character_v<_Tp> && !is_same<_Tp, bool>::value && |
| 44 | inline const bool __is_unsigned_integer_v<unsigned char> = true; | 48 | __is_unqualified_v<_Tp>; |
| 45 | template <> | 49 | |
| 46 | inline const bool __is_unsigned_integer_v<unsigned short> = true; | 50 | template <class _Tp> |
| 47 | template <> | 51 | inline const bool __is_unsigned_integer_v = |
| 48 | inline const bool __is_unsigned_integer_v<unsigned int> = true; | 52 | is_integral<_Tp>::value && is_unsigned<_Tp>::value && !__is_character_v<_Tp> && !is_same<_Tp, bool>::value && |
| 49 | template <> | 53 | __is_unqualified_v<_Tp>; |
| 50 | inline const bool __is_unsigned_integer_v<unsigned long> = true; | ||
| 51 | template <> | ||
| 52 | inline const bool __is_unsigned_integer_v<unsigned long long> = true; | ||
| 53 | #if _LIBCPP_HAS_INT128 | ||
| 54 | template <> | ||
| 55 | inline const bool __is_unsigned_integer_v<__uint128_t> = true; | ||
| 56 | #endif | ||
| 57 | 54 | ||
| 58 | #if _LIBCPP_STD_VER >= 20 | 55 | #if _LIBCPP_STD_VER >= 20 |
| 59 | template <class _Tp> | 56 | template <class _Tp> |
lib/libcxx/include/__type_traits/integral_constant.h+1-1| ... | @@ -24,7 +24,7 @@ struct _LIBCPP_NO_SPECIALIZATIONS integral_constant { | ... | @@ -24,7 +24,7 @@ struct _LIBCPP_NO_SPECIALIZATIONS integral_constant { |
| 24 | typedef integral_constant type; | 24 | typedef integral_constant type; |
| 25 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT { return value; } | 25 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT { return value; } |
| 26 | #if _LIBCPP_STD_VER >= 14 | 26 | #if _LIBCPP_STD_VER >= 14 |
| 27 | _LIBCPP_HIDE_FROM_ABI constexpr value_type operator()() const _NOEXCEPT { return value; } | 27 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr value_type operator()() const _NOEXCEPT { return value; } |
| 28 | #endif | 28 | #endif |
| 29 | }; | 29 | }; |
| 30 | 30 |
lib/libcxx/include/__type_traits/is_bounded_array.h deleted-36| ... | @@ -1,36 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_H | ||
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__type_traits/integral_constant.h> | ||
| 14 | |||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 16 | # pragma GCC system_header | ||
| 17 | #endif | ||
| 18 | |||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | template <class _Tp> | ||
| 22 | inline const bool __is_bounded_array_v = __is_bounded_array(_Tp); | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 20 | ||
| 25 | |||
| 26 | template <class _Tp> | ||
| 27 | struct _LIBCPP_NO_SPECIALIZATIONS is_bounded_array : bool_constant<__is_bounded_array(_Tp)> {}; | ||
| 28 | |||
| 29 | template <class _Tp> | ||
| 30 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_bounded_array_v = __is_bounded_array(_Tp); | ||
| 31 | |||
| 32 | #endif | ||
| 33 | |||
| 34 | _LIBCPP_END_NAMESPACE_STD | ||
| 35 | |||
| 36 | #endif // _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_H | ||
lib/libcxx/include/__type_traits/is_constant_evaluated.h+1-1| ... | @@ -18,7 +18,7 @@ | ... | @@ -18,7 +18,7 @@ |
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | ||
| 20 | #if _LIBCPP_STD_VER >= 20 | 20 | #if _LIBCPP_STD_VER >= 20 |
| 21 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_constant_evaluated() noexcept { | 21 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_constant_evaluated() noexcept { |
| 22 | return __builtin_is_constant_evaluated(); | 22 | return __builtin_is_constant_evaluated(); |
| 23 | } | 23 | } |
| 24 | #endif | 24 | #endif |
lib/libcxx/include/__type_traits/is_implicit_lifetime.h+4-2| ... | @@ -16,9 +16,10 @@ | ... | @@ -16,9 +16,10 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | #if _LIBCPP_STD_VER >= 23 | ||
| 20 | |||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 22 | ||
| 21 | #if _LIBCPP_STD_VER >= 23 | ||
| 22 | # if __has_builtin(__builtin_is_implicit_lifetime) | 23 | # if __has_builtin(__builtin_is_implicit_lifetime) |
| 23 | 24 | ||
| 24 | template <class _Tp> | 25 | template <class _Tp> |
| ... | @@ -28,8 +29,9 @@ template <class _Tp> | ... | @@ -28,8 +29,9 @@ template <class _Tp> |
| 28 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_implicit_lifetime_v = __builtin_is_implicit_lifetime(_Tp); | 29 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_implicit_lifetime_v = __builtin_is_implicit_lifetime(_Tp); |
| 29 | 30 | ||
| 30 | # endif | 31 | # endif |
| 31 | #endif | ||
| 32 | 32 | ||
| 33 | _LIBCPP_END_NAMESPACE_STD | 33 | _LIBCPP_END_NAMESPACE_STD |
| 34 | 34 | ||
| 35 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 36 | |||
| 35 | #endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICIT_LIFETIME_H | 37 | #endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICIT_LIFETIME_H |
lib/libcxx/include/__type_traits/is_implicitly_default_constructible.h+4-2| ... | @@ -17,9 +17,10 @@ | ... | @@ -17,9 +17,10 @@ |
| 17 | # pragma GCC system_header | 17 | # pragma GCC system_header |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | #ifndef _LIBCPP_CXX03_LANG | ||
| 21 | |||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 23 | ||
| 22 | #ifndef _LIBCPP_CXX03_LANG | ||
| 23 | // First of all, we can't implement this check in C++03 mode because the {} | 24 | // First of all, we can't implement this check in C++03 mode because the {} |
| 24 | // default initialization syntax isn't valid. | 25 | // default initialization syntax isn't valid. |
| 25 | // Second, we implement the trait in a funny manner with two defaulted template | 26 | // Second, we implement the trait in a funny manner with two defaulted template |
| ... | @@ -39,8 +40,9 @@ template <class _Tp> | ... | @@ -39,8 +40,9 @@ template <class _Tp> |
| 39 | struct __is_implicitly_default_constructible<_Tp, | 40 | struct __is_implicitly_default_constructible<_Tp, |
| 40 | decltype(std::__test_implicit_default_constructible<_Tp const&>({})), | 41 | decltype(std::__test_implicit_default_constructible<_Tp const&>({})), |
| 41 | false_type> : false_type {}; | 42 | false_type> : false_type {}; |
| 42 | #endif // !C++03 | ||
| 43 | 43 | ||
| 44 | _LIBCPP_END_NAMESPACE_STD | 44 | _LIBCPP_END_NAMESPACE_STD |
| 45 | 45 | ||
| 46 | #endif // _LIBCPP_CXX03_LANG | ||
| 47 | |||
| 46 | #endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H | 48 | #endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H |
lib/libcxx/include/__type_traits/is_literal_type.h+4-2| ... | @@ -16,9 +16,10 @@ | ... | @@ -16,9 +16,10 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | ||
| 20 | |||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 22 | ||
| 21 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | ||
| 22 | template <class _Tp> | 23 | template <class _Tp> |
| 23 | struct _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS is_literal_type | 24 | struct _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS is_literal_type |
| 24 | : integral_constant<bool, __is_literal_type(_Tp)> {}; | 25 | : integral_constant<bool, __is_literal_type(_Tp)> {}; |
| ... | @@ -27,8 +28,9 @@ struct _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS is_literal_type | ... | @@ -27,8 +28,9 @@ struct _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS is_literal_type |
| 27 | template <class _Tp> | 28 | template <class _Tp> |
| 28 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_literal_type_v = __is_literal_type(_Tp); | 29 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_literal_type_v = __is_literal_type(_Tp); |
| 29 | # endif // _LIBCPP_STD_VER >= 17 | 30 | # endif // _LIBCPP_STD_VER >= 17 |
| 30 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | ||
| 31 | 31 | ||
| 32 | _LIBCPP_END_NAMESPACE_STD | 32 | _LIBCPP_END_NAMESPACE_STD |
| 33 | 33 | ||
| 34 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | ||
| 35 | |||
| 34 | #endif // _LIBCPP___TYPE_TRAITS_IS_LITERAL_TYPE | 36 | #endif // _LIBCPP___TYPE_TRAITS_IS_LITERAL_TYPE |
lib/libcxx/include/__type_traits/is_primary_template.h deleted-32| ... | @@ -1,32 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H | ||
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__type_traits/enable_if.h> | ||
| 14 | #include <__type_traits/is_same.h> | ||
| 15 | #include <__type_traits/is_valid_expansion.h> | ||
| 16 | |||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 18 | # pragma GCC system_header | ||
| 19 | #endif | ||
| 20 | |||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | template <class _Tp> | ||
| 24 | using __test_for_primary_template _LIBCPP_NODEBUG = | ||
| 25 | __enable_if_t<_IsSame<_Tp, typename _Tp::__primary_template>::value>; | ||
| 26 | |||
| 27 | template <class _Tp> | ||
| 28 | using __is_primary_template _LIBCPP_NODEBUG = _IsValidExpansion<__test_for_primary_template, _Tp>; | ||
| 29 | |||
| 30 | _LIBCPP_END_NAMESPACE_STD | ||
| 31 | |||
| 32 | #endif // _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H | ||
lib/libcxx/include/__type_traits/is_referenceable.h deleted-34| ... | @@ -1,34 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H | ||
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__type_traits/void_t.h> | ||
| 14 | |||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 16 | # pragma GCC system_header | ||
| 17 | #endif | ||
| 18 | |||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | template <class _Tp, class = void> | ||
| 22 | inline const bool __is_referenceable_v = false; | ||
| 23 | |||
| 24 | template <class _Tp> | ||
| 25 | inline const bool __is_referenceable_v<_Tp, __void_t<_Tp&> > = true; | ||
| 26 | |||
| 27 | #if _LIBCPP_STD_VER >= 20 | ||
| 28 | template <class _Tp> | ||
| 29 | concept __referenceable = __is_referenceable_v<_Tp>; | ||
| 30 | #endif | ||
| 31 | |||
| 32 | _LIBCPP_END_NAMESPACE_STD | ||
| 33 | |||
| 34 | #endif // _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H | ||
lib/libcxx/include/__type_traits/is_replaceable.h deleted-61| ... | @@ -1,61 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TYPE_TRAITS_IS_REPLACEABLE_H | ||
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_REPLACEABLE_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__type_traits/enable_if.h> | ||
| 14 | #include <__type_traits/integral_constant.h> | ||
| 15 | #include <__type_traits/is_same.h> | ||
| 16 | #include <__type_traits/is_trivially_copyable.h> | ||
| 17 | |||
| 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 19 | # pragma GCC system_header | ||
| 20 | #endif | ||
| 21 | |||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | // A type is replaceable if, with `x` and `y` being different objects, `x = std::move(y)` is equivalent to: | ||
| 25 | // | ||
| 26 | // std::destroy_at(&x) | ||
| 27 | // std::construct_at(&x, std::move(y)) | ||
| 28 | // | ||
| 29 | // This allows turning a move-assignment into a sequence of destroy + move-construct, which | ||
| 30 | // is often more efficient. This is especially relevant when the move-construct is in fact | ||
| 31 | // part of a trivial relocation from somewhere else, in which case there is a huge win. | ||
| 32 | // | ||
| 33 | // Note that this requires language support in order to be really effective, but we | ||
| 34 | // currently emulate the base template with something very conservative. | ||
| 35 | template <class _Tp, class = void> | ||
| 36 | struct __is_replaceable : is_trivially_copyable<_Tp> {}; | ||
| 37 | |||
| 38 | template <class _Tp> | ||
| 39 | struct __is_replaceable<_Tp, __enable_if_t<is_same<_Tp, typename _Tp::__replaceable>::value> > : true_type {}; | ||
| 40 | |||
| 41 | template <class _Tp> | ||
| 42 | inline const bool __is_replaceable_v = __is_replaceable<_Tp>::value; | ||
| 43 | |||
| 44 | // Determines whether an allocator member of a container is replaceable. | ||
| 45 | // | ||
| 46 | // First, we require the allocator type to be considered replaceable. If not, then something fishy might be | ||
| 47 | // happening. Assuming the allocator type is replaceable, we conclude replaceability of the allocator as a | ||
| 48 | // member of the container if the allocator always compares equal (in which case propagation doesn't matter), | ||
| 49 | // or if the allocator always propagates on assignment, which is required in order for move construction and | ||
| 50 | // assignment to be equivalent. | ||
| 51 | template <class _AllocatorTraits> | ||
| 52 | struct __container_allocator_is_replaceable | ||
| 53 | : integral_constant<bool, | ||
| 54 | __is_replaceable_v<typename _AllocatorTraits::allocator_type> && | ||
| 55 | (_AllocatorTraits::is_always_equal::value || | ||
| 56 | (_AllocatorTraits::propagate_on_container_move_assignment::value && | ||
| 57 | _AllocatorTraits::propagate_on_container_copy_assignment::value))> {}; | ||
| 58 | |||
| 59 | _LIBCPP_END_NAMESPACE_STD | ||
| 60 | |||
| 61 | #endif // _LIBCPP___TYPE_TRAITS_IS_REPLACEABLE_H | ||
lib/libcxx/include/__type_traits/is_trivially_relocatable.h+4| ... | @@ -34,10 +34,14 @@ template <class _Tp, class = void> | ... | @@ -34,10 +34,14 @@ template <class _Tp, class = void> |
| 34 | struct __libcpp_is_trivially_relocatable : is_trivially_copyable<_Tp> {}; | 34 | struct __libcpp_is_trivially_relocatable : is_trivially_copyable<_Tp> {}; |
| 35 | #endif | 35 | #endif |
| 36 | 36 | ||
| 37 | // __trivially_relocatable on libc++'s builtin types does not currently return the right answer with PFP | ||
| 38 | // in tagged mode, in which the address of the pointer is used as part of the pointer encoding. | ||
| 39 | #if !defined(__POINTER_FIELD_PROTECTION_TAGGED__) | ||
| 37 | template <class _Tp> | 40 | template <class _Tp> |
| 38 | struct __libcpp_is_trivially_relocatable<_Tp, | 41 | struct __libcpp_is_trivially_relocatable<_Tp, |
| 39 | __enable_if_t<is_same<_Tp, typename _Tp::__trivially_relocatable>::value> > | 42 | __enable_if_t<is_same<_Tp, typename _Tp::__trivially_relocatable>::value> > |
| 40 | : true_type {}; | 43 | : true_type {}; |
| 44 | #endif | ||
| 41 | 45 | ||
| 42 | _LIBCPP_END_NAMESPACE_STD | 46 | _LIBCPP_END_NAMESPACE_STD |
| 43 | 47 |
lib/libcxx/include/__type_traits/is_unbounded_array.h deleted-38| ... | @@ -1,38 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TYPE_TRAITS_IS_UNBOUNDED_ARRAY_H | ||
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_UNBOUNDED_ARRAY_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__type_traits/integral_constant.h> | ||
| 14 | |||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 16 | # pragma GCC system_header | ||
| 17 | #endif | ||
| 18 | |||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | template <class> | ||
| 22 | inline const bool __is_unbounded_array_v = false; | ||
| 23 | template <class _Tp> | ||
| 24 | inline const bool __is_unbounded_array_v<_Tp[]> = true; | ||
| 25 | |||
| 26 | #if _LIBCPP_STD_VER >= 20 | ||
| 27 | |||
| 28 | template <class _Tp> | ||
| 29 | struct _LIBCPP_NO_SPECIALIZATIONS is_unbounded_array : bool_constant<__is_unbounded_array_v<_Tp>> {}; | ||
| 30 | |||
| 31 | template <class _Tp> | ||
| 32 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_unbounded_array_v = __is_unbounded_array_v<_Tp>; | ||
| 33 | |||
| 34 | #endif | ||
| 35 | |||
| 36 | _LIBCPP_END_NAMESPACE_STD | ||
| 37 | |||
| 38 | #endif // _LIBCPP___TYPE_TRAITS_IS_UNBOUNDED_ARRAY_H | ||
lib/libcxx/include/__type_traits/is_valid_expansion.h deleted-31| ... | @@ -1,31 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TYPE_TRAITS_IS_VALID_EXPANSION_H | ||
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_VALID_EXPANSION_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__type_traits/integral_constant.h> | ||
| 14 | |||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 16 | # pragma GCC system_header | ||
| 17 | #endif | ||
| 18 | |||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | template <template <class...> class _Templ, class... _Args, class = _Templ<_Args...> > | ||
| 22 | true_type __sfinae_test_impl(int); | ||
| 23 | template <template <class...> class, class...> | ||
| 24 | false_type __sfinae_test_impl(...); | ||
| 25 | |||
| 26 | template <template <class...> class _Templ, class... _Args> | ||
| 27 | using _IsValidExpansion _LIBCPP_NODEBUG = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0)); | ||
| 28 | |||
| 29 | _LIBCPP_END_NAMESPACE_STD | ||
| 30 | |||
| 31 | #endif // _LIBCPP___TYPE_TRAITS_IS_VALID_EXPANSION_H | ||
lib/libcxx/include/__type_traits/is_within_lifetime.h+1-1| ... | @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | ||
| 20 | #if _LIBCPP_STD_VER >= 26 && __has_builtin(__builtin_is_within_lifetime) | 20 | #if _LIBCPP_STD_VER >= 26 && __has_builtin(__builtin_is_within_lifetime) |
| 21 | template <class _Tp> | 21 | template <class _Tp> |
| 22 | _LIBCPP_HIDE_FROM_ABI consteval bool is_within_lifetime(const _Tp* __p) noexcept { | 22 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI consteval bool is_within_lifetime(const _Tp* __p) noexcept { |
| 23 | return __builtin_is_within_lifetime(__p); | 23 | return __builtin_is_within_lifetime(__p); |
| 24 | } | 24 | } |
| 25 | #endif | 25 | #endif |
lib/libcxx/include/__type_traits/lazy.h deleted-25| ... | @@ -1,25 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___TYPE_TRAITS_LAZY_H | ||
| 10 | #define _LIBCPP___TYPE_TRAITS_LAZY_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | |||
| 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 15 | # pragma GCC system_header | ||
| 16 | #endif | ||
| 17 | |||
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 19 | |||
| 20 | template <template <class...> class _Func, class... _Args> | ||
| 21 | struct _Lazy : _Func<_Args...> {}; | ||
| 22 | |||
| 23 | _LIBCPP_END_NAMESPACE_STD | ||
| 24 | |||
| 25 | #endif // _LIBCPP___TYPE_TRAITS_LAZY_H | ||
lib/libcxx/include/__type_traits/make_transparent.h+13-11| ... | @@ -22,29 +22,31 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -22,29 +22,31 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | ||
| 23 | // __make_transparent tries to create a transparent comparator from its non-transparent counterpart, e.g. obtain | 23 | // __make_transparent tries to create a transparent comparator from its non-transparent counterpart, e.g. obtain |
| 24 | // `less<>` from `less<T>`. This is useful in cases where conversions can be avoided (e.g. a string literal to a | 24 | // `less<>` from `less<T>`. This is useful in cases where conversions can be avoided (e.g. a string literal to a |
| 25 | // std::string). | 25 | // std::string). This depends on the argument type provided to the comparator, because a comparator might be |
| 26 | // transparent for some argument types but not for others. | ||
| 26 | 27 | ||
| 27 | template <class _Tp, class _Comparator> | 28 | template <class _ArgumentType, class _Comparator> |
| 28 | struct __make_transparent { | 29 | struct __make_transparent { |
| 29 | using type _LIBCPP_NODEBUG = _Comparator; | 30 | using type _LIBCPP_NODEBUG = _Comparator; |
| 30 | }; | 31 | }; |
| 31 | 32 | ||
| 32 | template <class _Tp, class _Comparator> | 33 | template <class _ArgumentType, class _Comparator> |
| 33 | using __make_transparent_t _LIBCPP_NODEBUG = typename __make_transparent<_Tp, _Comparator>::type; | 34 | using __make_transparent_t _LIBCPP_NODEBUG = typename __make_transparent<_ArgumentType, _Comparator>::type; |
| 34 | 35 | ||
| 35 | template <class _Tp, | 36 | template <class _ArgumentType, |
| 36 | class _Comparator, | 37 | class _Comparator, |
| 37 | __enable_if_t<is_same<_Comparator, __make_transparent_t<_Tp, _Comparator> >::value, int> = 0> | 38 | __enable_if_t<is_same<_Comparator, __make_transparent_t<_ArgumentType, _Comparator> >::value, int> = 0> |
| 38 | _LIBCPP_HIDE_FROM_ABI _Comparator& __as_transparent(_Comparator& __comp) { | 39 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Comparator& __as_transparent(_Comparator& __comp) { |
| 39 | return __comp; | 40 | return __comp; |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | template <class _Tp, | 43 | template <class _ArgumentType, |
| 43 | class _Comparator, | 44 | class _Comparator, |
| 44 | __enable_if_t<!is_same<_Comparator, __make_transparent_t<_Tp, _Comparator> >::value, int> = 0> | 45 | __enable_if_t<!is_same<_Comparator, __make_transparent_t<_ArgumentType, _Comparator> >::value, int> = 0> |
| 45 | _LIBCPP_HIDE_FROM_ABI __make_transparent_t<_Tp, _Comparator> __as_transparent(_Comparator&) { | 46 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __make_transparent_t<_ArgumentType, _Comparator> |
| 47 | __as_transparent(_Comparator&) { | ||
| 46 | static_assert(is_empty<_Comparator>::value); | 48 | static_assert(is_empty<_Comparator>::value); |
| 47 | return __make_transparent_t<_Tp, _Comparator>(); | 49 | return __make_transparent_t<_ArgumentType, _Comparator>(); |
| 48 | } | 50 | } |
| 49 | 51 | ||
| 50 | _LIBCPP_END_NAMESPACE_STD | 52 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/rank.h+1-21| ... | @@ -19,32 +19,12 @@ | ... | @@ -19,32 +19,12 @@ |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | ||
| 22 | #if __has_builtin(__array_rank) && !defined(_LIBCPP_COMPILER_CLANG_BASED) || \ | ||
| 23 | (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2001) | ||
| 24 | |||
| 25 | template <class _Tp> | 22 | template <class _Tp> |
| 26 | struct _LIBCPP_NO_SPECIALIZATIONS rank : integral_constant<size_t, __array_rank(_Tp)> {}; | 23 | struct _LIBCPP_NO_SPECIALIZATIONS rank : integral_constant<size_t, __array_rank(_Tp)> {}; |
| 27 | 24 | ||
| 28 | #else | ||
| 29 | |||
| 30 | template <class _Tp> | ||
| 31 | struct _LIBCPP_NO_SPECIALIZATIONS rank : public integral_constant<size_t, 0> {}; | ||
| 32 | |||
| 33 | _LIBCPP_DIAGNOSTIC_PUSH | ||
| 34 | # if __has_warning("-Winvalid-specialization") | ||
| 35 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") | ||
| 36 | # endif | ||
| 37 | template <class _Tp> | ||
| 38 | struct rank<_Tp[]> : public integral_constant<size_t, rank<_Tp>::value + 1> {}; | ||
| 39 | template <class _Tp, size_t _Np> | ||
| 40 | struct rank<_Tp[_Np]> : public integral_constant<size_t, rank<_Tp>::value + 1> {}; | ||
| 41 | _LIBCPP_DIAGNOSTIC_POP | ||
| 42 | |||
| 43 | #endif // __has_builtin(__array_rank) | ||
| 44 | |||
| 45 | #if _LIBCPP_STD_VER >= 17 | 25 | #if _LIBCPP_STD_VER >= 17 |
| 46 | template <class _Tp> | 26 | template <class _Tp> |
| 47 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr size_t rank_v = rank<_Tp>::value; | 27 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr size_t rank_v = __array_rank(_Tp); |
| 48 | #endif | 28 | #endif |
| 49 | 29 | ||
| 50 | _LIBCPP_END_NAMESPACE_STD | 30 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/reference_converts_from_temporary.h+4-4| ... | @@ -16,10 +16,10 @@ | ... | @@ -16,10 +16,10 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | #if _LIBCPP_STD_VER >= 23 | 19 | #if _LIBCPP_STD_VER >= 23 |
| 22 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | template <class _Tp, class _Up> | 23 | template <class _Tp, class _Up> |
| 24 | struct _LIBCPP_NO_SPECIALIZATIONS reference_converts_from_temporary | 24 | struct _LIBCPP_NO_SPECIALIZATIONS reference_converts_from_temporary |
| 25 | : public bool_constant<__reference_converts_from_temporary(_Tp, _Up)> {}; | 25 | : public bool_constant<__reference_converts_from_temporary(_Tp, _Up)> {}; |
| ... | @@ -28,8 +28,8 @@ template <class _Tp, class _Up> | ... | @@ -28,8 +28,8 @@ template <class _Tp, class _Up> |
| 28 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool reference_converts_from_temporary_v = | 28 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool reference_converts_from_temporary_v = |
| 29 | __reference_converts_from_temporary(_Tp, _Up); | 29 | __reference_converts_from_temporary(_Tp, _Up); |
| 30 | 30 | ||
| 31 | #endif | ||
| 32 | |||
| 33 | _LIBCPP_END_NAMESPACE_STD | 31 | _LIBCPP_END_NAMESPACE_STD |
| 34 | 32 | ||
| 33 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 34 | |||
| 35 | #endif // _LIBCPP___TYPE_TRAITS_REFERENCE_CONVERTS_FROM_TEMPORARY_H | 35 | #endif // _LIBCPP___TYPE_TRAITS_REFERENCE_CONVERTS_FROM_TEMPORARY_H |
lib/libcxx/include/__type_traits/remove_pointer.h+3-16| ... | @@ -17,31 +17,18 @@ | ... | @@ -17,31 +17,18 @@ |
| 17 | 17 | ||
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | ||
| 20 | #if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer) | ||
| 21 | template <class _Tp> | 20 | template <class _Tp> |
| 22 | struct _LIBCPP_NO_SPECIALIZATIONS remove_pointer { | 21 | struct _LIBCPP_NO_SPECIALIZATIONS remove_pointer { |
| 23 | using type _LIBCPP_NODEBUG = __remove_pointer(_Tp); | 22 | using type _LIBCPP_NODEBUG = __remove_pointer(_Tp); |
| 24 | }; | 23 | }; |
| 25 | 24 | ||
| 26 | # ifdef _LIBCPP_COMPILER_GCC | 25 | #ifdef _LIBCPP_COMPILER_GCC |
| 27 | template <class _Tp> | 26 | template <class _Tp> |
| 28 | using __remove_pointer_t _LIBCPP_NODEBUG = typename remove_pointer<_Tp>::type; | 27 | using __remove_pointer_t _LIBCPP_NODEBUG = typename remove_pointer<_Tp>::type; |
| 29 | # else | ||
| 30 | template <class _Tp> | ||
| 31 | using __remove_pointer_t _LIBCPP_NODEBUG = __remove_pointer(_Tp); | ||
| 32 | # endif | ||
| 33 | #else | 28 | #else |
| 34 | // clang-format off | ||
| 35 | template <class _Tp> struct remove_pointer {using type _LIBCPP_NODEBUG = _Tp;}; | ||
| 36 | template <class _Tp> struct remove_pointer<_Tp*> {using type _LIBCPP_NODEBUG = _Tp;}; | ||
| 37 | template <class _Tp> struct remove_pointer<_Tp* const> {using type _LIBCPP_NODEBUG = _Tp;}; | ||
| 38 | template <class _Tp> struct remove_pointer<_Tp* volatile> {using type _LIBCPP_NODEBUG = _Tp;}; | ||
| 39 | template <class _Tp> struct remove_pointer<_Tp* const volatile> {using type _LIBCPP_NODEBUG = _Tp;}; | ||
| 40 | // clang-format on | ||
| 41 | |||
| 42 | template <class _Tp> | 29 | template <class _Tp> |
| 43 | using __remove_pointer_t = typename remove_pointer<_Tp>::type; | 30 | using __remove_pointer_t _LIBCPP_NODEBUG = __remove_pointer(_Tp); |
| 44 | #endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer) | 31 | #endif |
| 45 | 32 | ||
| 46 | #if _LIBCPP_STD_VER >= 14 | 33 | #if _LIBCPP_STD_VER >= 14 |
| 47 | template <class _Tp> | 34 | template <class _Tp> |
lib/libcxx/include/__type_traits/result_of.h+6-4| ... | @@ -16,18 +16,19 @@ | ... | @@ -16,18 +16,19 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | ||
| 20 | |||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 22 | ||
| 21 | // result_of | 23 | // result_of |
| 22 | 24 | ||
| 23 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | ||
| 24 | template <class _Callable> | 25 | template <class _Callable> |
| 25 | struct _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS result_of; | 26 | struct _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS result_of; |
| 26 | 27 | ||
| 27 | _LIBCPP_DIAGNOSTIC_PUSH | 28 | _LIBCPP_DIAGNOSTIC_PUSH |
| 28 | #if __has_warning("-Winvalid-specialization") | 29 | # if __has_warning("-Winvalid-specialization") |
| 29 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") | 30 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") |
| 30 | #endif | 31 | # endif |
| 31 | template <class _Fp, class... _Args> | 32 | template <class _Fp, class... _Args> |
| 32 | struct result_of<_Fp(_Args...)> : __invoke_result<_Fp, _Args...> {}; | 33 | struct result_of<_Fp(_Args...)> : __invoke_result<_Fp, _Args...> {}; |
| 33 | _LIBCPP_DIAGNOSTIC_POP | 34 | _LIBCPP_DIAGNOSTIC_POP |
| ... | @@ -36,8 +37,9 @@ _LIBCPP_DIAGNOSTIC_POP | ... | @@ -36,8 +37,9 @@ _LIBCPP_DIAGNOSTIC_POP |
| 36 | template <class _Tp> | 37 | template <class _Tp> |
| 37 | using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type; | 38 | using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type; |
| 38 | # endif // _LIBCPP_STD_VER >= 14 | 39 | # endif // _LIBCPP_STD_VER >= 14 |
| 39 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | ||
| 40 | 40 | ||
| 41 | _LIBCPP_END_NAMESPACE_STD | 41 | _LIBCPP_END_NAMESPACE_STD |
| 42 | 42 | ||
| 43 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | ||
| 44 | |||
| 43 | #endif // _LIBCPP___TYPE_TRAITS_RESULT_OF_H | 45 | #endif // _LIBCPP___TYPE_TRAITS_RESULT_OF_H |
lib/libcxx/include/__type_traits/strip_signature.h+3| ... | @@ -74,6 +74,9 @@ template<class _Rp, class _Gp, class ..._Ap> | ... | @@ -74,6 +74,9 @@ template<class _Rp, class _Gp, class ..._Ap> |
| 74 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile & noexcept> { using type _LIBCPP_NODEBUG = _Rp(_Ap...); }; | 74 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile & noexcept> { using type _LIBCPP_NODEBUG = _Rp(_Ap...); }; |
| 75 | // clang-format on | 75 | // clang-format on |
| 76 | 76 | ||
| 77 | template <class _Fp> | ||
| 78 | using __strip_signature_t _LIBCPP_NODEBUG = typename __strip_signature<_Fp>::type; | ||
| 79 | |||
| 77 | _LIBCPP_END_NAMESPACE_STD | 80 | _LIBCPP_END_NAMESPACE_STD |
| 78 | 81 | ||
| 79 | #endif // _LIBCPP_STD_VER >= 17 | 82 | #endif // _LIBCPP_STD_VER >= 17 |
lib/libcxx/include/__utility/as_const.h+4-2| ... | @@ -15,9 +15,10 @@ | ... | @@ -15,9 +15,10 @@ |
| 15 | # pragma GCC system_header | 15 | # pragma GCC system_header |
| 16 | #endif | 16 | #endif |
| 17 | 17 | ||
| 18 | #if _LIBCPP_STD_VER >= 17 | ||
| 19 | |||
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 21 | ||
| 20 | #if _LIBCPP_STD_VER >= 17 | ||
| 21 | template <class _Tp> | 22 | template <class _Tp> |
| 22 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& as_const(_Tp& __t) noexcept { | 23 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& as_const(_Tp& __t) noexcept { |
| 23 | return __t; | 24 | return __t; |
| ... | @@ -25,8 +26,9 @@ template <class _Tp> | ... | @@ -25,8 +26,9 @@ template <class _Tp> |
| 25 | 26 | ||
| 26 | template <class _Tp> | 27 | template <class _Tp> |
| 27 | void as_const(const _Tp&&) = delete; | 28 | void as_const(const _Tp&&) = delete; |
| 28 | #endif | ||
| 29 | 29 | ||
| 30 | _LIBCPP_END_NAMESPACE_STD | 30 | _LIBCPP_END_NAMESPACE_STD |
| 31 | 31 | ||
| 32 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 33 | |||
| 32 | #endif // _LIBCPP___UTILITY_AS_CONST_H | 34 | #endif // _LIBCPP___UTILITY_AS_CONST_H |
lib/libcxx/include/__utility/constant_wrapper.h created+326| ... | @@ -0,0 +1,326 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___UTILITY_CONSTANT_WRAPPER_H | ||
| 10 | #define _LIBCPP___UTILITY_CONSTANT_WRAPPER_H | ||
| 11 | |||
| 12 | #include <__config> | ||
| 13 | #include <__cstddef/size_t.h> | ||
| 14 | #include <__functional/invoke.h> | ||
| 15 | #include <__type_traits/invoke.h> | ||
| 16 | #include <__type_traits/is_constructible.h> | ||
| 17 | #include <__type_traits/is_same.h> | ||
| 18 | #include <__type_traits/remove_cvref.h> | ||
| 19 | #include <__utility/declval.h> | ||
| 20 | #include <__utility/forward.h> | ||
| 21 | #include <__utility/integer_sequence.h> | ||
| 22 | |||
| 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 24 | # pragma GCC system_header | ||
| 25 | #endif | ||
| 26 | |||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 28 | |||
| 29 | #if _LIBCPP_STD_VER >= 26 | ||
| 30 | |||
| 31 | template <auto _Xp, class = remove_cvref_t<decltype(_Xp)>> | ||
| 32 | struct constant_wrapper; | ||
| 33 | |||
| 34 | template <class _Tp> | ||
| 35 | concept __constexpr_param = requires { typename constant_wrapper<_Tp::value>; }; | ||
| 36 | |||
| 37 | template <auto _Xp> | ||
| 38 | constexpr auto cw = constant_wrapper<_Xp>{}; | ||
| 39 | |||
| 40 | struct __cw_operators { | ||
| 41 | // unary operators | ||
| 42 | template <__constexpr_param _Tp> | ||
| 43 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator+(_Tp) noexcept -> constant_wrapper<(+_Tp::value)> { | ||
| 44 | return {}; | ||
| 45 | } | ||
| 46 | template <__constexpr_param _Tp> | ||
| 47 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator-(_Tp) noexcept -> constant_wrapper<(-_Tp::value)> { | ||
| 48 | return {}; | ||
| 49 | } | ||
| 50 | template <__constexpr_param _Tp> | ||
| 51 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator~(_Tp) noexcept -> constant_wrapper<(~_Tp::value)> { | ||
| 52 | return {}; | ||
| 53 | } | ||
| 54 | template <__constexpr_param _Tp> | ||
| 55 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator!(_Tp) noexcept -> constant_wrapper<(!_Tp::value)> { | ||
| 56 | return {}; | ||
| 57 | } | ||
| 58 | template <__constexpr_param _Tp> | ||
| 59 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator&(_Tp) noexcept -> constant_wrapper<(&_Tp::value)> { | ||
| 60 | return {}; | ||
| 61 | } | ||
| 62 | template <__constexpr_param _Tp> | ||
| 63 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator*(_Tp) noexcept -> constant_wrapper<(*_Tp::value)> { | ||
| 64 | return {}; | ||
| 65 | } | ||
| 66 | |||
| 67 | // binary operators | ||
| 68 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 69 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator+(_Lp, _Rp) noexcept | ||
| 70 | -> constant_wrapper<(_Lp::value + _Rp::value)> { | ||
| 71 | return {}; | ||
| 72 | } | ||
| 73 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 74 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator-(_Lp, _Rp) noexcept | ||
| 75 | -> constant_wrapper<(_Lp::value - _Rp::value)> { | ||
| 76 | return {}; | ||
| 77 | } | ||
| 78 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 79 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator*(_Lp, _Rp) noexcept | ||
| 80 | -> constant_wrapper<(_Lp::value * _Rp::value)> { | ||
| 81 | return {}; | ||
| 82 | } | ||
| 83 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 84 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator/(_Lp, _Rp) noexcept | ||
| 85 | -> constant_wrapper<(_Lp::value / _Rp::value)> { | ||
| 86 | return {}; | ||
| 87 | } | ||
| 88 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 89 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator%(_Lp, _Rp) noexcept | ||
| 90 | -> constant_wrapper<(_Lp::value % _Rp::value)> { | ||
| 91 | return {}; | ||
| 92 | } | ||
| 93 | |||
| 94 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 95 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<<(_Lp, _Rp) noexcept | ||
| 96 | -> constant_wrapper<(_Lp::value << _Rp::value)> { | ||
| 97 | return {}; | ||
| 98 | } | ||
| 99 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 100 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator>>(_Lp, _Rp) noexcept | ||
| 101 | -> constant_wrapper<(_Lp::value >> _Rp::value)> { | ||
| 102 | return {}; | ||
| 103 | } | ||
| 104 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 105 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator&(_Lp, _Rp) noexcept | ||
| 106 | -> constant_wrapper<(_Lp::value & _Rp::value)> { | ||
| 107 | return {}; | ||
| 108 | } | ||
| 109 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 110 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator|(_Lp, _Rp) noexcept | ||
| 111 | -> constant_wrapper<(_Lp::value | _Rp::value)> { | ||
| 112 | return {}; | ||
| 113 | } | ||
| 114 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 115 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator^(_Lp, _Rp) noexcept | ||
| 116 | -> constant_wrapper<(_Lp::value ^ _Rp::value)> { | ||
| 117 | return {}; | ||
| 118 | } | ||
| 119 | |||
| 120 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 121 | requires(!is_constructible_v<bool, decltype(_Lp::value)> || !is_constructible_v<bool, decltype(_Rp::value)>) | ||
| 122 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator&&(_Lp, _Rp) noexcept | ||
| 123 | -> constant_wrapper<(_Lp::value && _Rp::value)> { | ||
| 124 | return {}; | ||
| 125 | } | ||
| 126 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 127 | requires(!is_constructible_v<bool, decltype(_Lp::value)> || !is_constructible_v<bool, decltype(_Rp::value)>) | ||
| 128 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator||(_Lp, _Rp) noexcept | ||
| 129 | -> constant_wrapper<(_Lp::value || _Rp::value)> { | ||
| 130 | return {}; | ||
| 131 | } | ||
| 132 | |||
| 133 | // comparisons | ||
| 134 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 135 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(_Lp, _Rp) noexcept | ||
| 136 | -> constant_wrapper<(_Lp::value <=> _Rp::value)> { | ||
| 137 | return {}; | ||
| 138 | } | ||
| 139 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 140 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<(_Lp, _Rp) noexcept | ||
| 141 | -> constant_wrapper<(_Lp::value < _Rp::value)> { | ||
| 142 | return {}; | ||
| 143 | } | ||
| 144 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 145 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=(_Lp, _Rp) noexcept | ||
| 146 | -> constant_wrapper<(_Lp::value <= _Rp::value)> { | ||
| 147 | return {}; | ||
| 148 | } | ||
| 149 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 150 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator==(_Lp, _Rp) noexcept | ||
| 151 | -> constant_wrapper<(_Lp::value == _Rp::value)> { | ||
| 152 | return {}; | ||
| 153 | } | ||
| 154 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 155 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator!=(_Lp, _Rp) noexcept | ||
| 156 | -> constant_wrapper<(_Lp::value != _Rp::value)> { | ||
| 157 | return {}; | ||
| 158 | } | ||
| 159 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 160 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator>(_Lp, _Rp) noexcept | ||
| 161 | -> constant_wrapper<(_Lp::value > _Rp::value)> { | ||
| 162 | return {}; | ||
| 163 | } | ||
| 164 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 165 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator>=(_Lp, _Rp) noexcept | ||
| 166 | -> constant_wrapper<(_Lp::value >= _Rp::value)> { | ||
| 167 | return {}; | ||
| 168 | } | ||
| 169 | |||
| 170 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 171 | friend auto operator,(_Lp, _Rp) = delete; | ||
| 172 | |||
| 173 | template <__constexpr_param _Lp, __constexpr_param _Rp> | ||
| 174 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator->*(_Lp, _Rp) noexcept | ||
| 175 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 176 | -> constant_wrapper<auto(_Lp::value->*_Rp::value)> { | ||
| 177 | return {}; | ||
| 178 | } | ||
| 179 | |||
| 180 | // pseudo-mutators | ||
| 181 | template <__constexpr_param _Tp> | ||
| 182 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator++(this _Tp) noexcept -> constant_wrapper<(++_Tp::value)> { | ||
| 183 | return {}; | ||
| 184 | } | ||
| 185 | template <__constexpr_param _Tp> | ||
| 186 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator++(this _Tp, int) noexcept | ||
| 187 | -> constant_wrapper<(_Tp::value++)> { | ||
| 188 | return {}; | ||
| 189 | } | ||
| 190 | template <__constexpr_param _Tp> | ||
| 191 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator--(this _Tp) noexcept -> constant_wrapper<(--_Tp::value)> { | ||
| 192 | return {}; | ||
| 193 | } | ||
| 194 | template <__constexpr_param _Tp> | ||
| 195 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator--(this _Tp, int) noexcept | ||
| 196 | -> constant_wrapper<(_Tp::value--)> { | ||
| 197 | return {}; | ||
| 198 | } | ||
| 199 | |||
| 200 | template <__constexpr_param _Tp, __constexpr_param _Rp> | ||
| 201 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator+=(this _Tp, _Rp) noexcept | ||
| 202 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 203 | -> constant_wrapper<auto(_Tp::value += _Rp::value)> { | ||
| 204 | return {}; | ||
| 205 | } | ||
| 206 | template <__constexpr_param _Tp, __constexpr_param _Rp> | ||
| 207 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator-=(this _Tp, _Rp) noexcept | ||
| 208 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 209 | -> constant_wrapper<auto(_Tp::value -= _Rp::value)> { | ||
| 210 | return {}; | ||
| 211 | } | ||
| 212 | template <__constexpr_param _Tp, __constexpr_param _Rp> | ||
| 213 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator*=(this _Tp, _Rp) noexcept | ||
| 214 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 215 | -> constant_wrapper<auto(_Tp::value *= _Rp::value)> { | ||
| 216 | return {}; | ||
| 217 | } | ||
| 218 | template <__constexpr_param _Tp, __constexpr_param _Rp> | ||
| 219 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator/=(this _Tp, _Rp) noexcept | ||
| 220 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 221 | -> constant_wrapper<auto(_Tp::value /= _Rp::value)> { | ||
| 222 | return {}; | ||
| 223 | } | ||
| 224 | template <__constexpr_param _Tp, __constexpr_param _Rp> | ||
| 225 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator%=(this _Tp, _Rp) noexcept | ||
| 226 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 227 | -> constant_wrapper<auto(_Tp::value %= _Rp::value)> { | ||
| 228 | return {}; | ||
| 229 | } | ||
| 230 | template <__constexpr_param _Tp, __constexpr_param _Rp> | ||
| 231 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator&=(this _Tp, _Rp) noexcept | ||
| 232 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 233 | -> constant_wrapper<auto(_Tp::value &= _Rp::value)> { | ||
| 234 | return {}; | ||
| 235 | } | ||
| 236 | template <__constexpr_param _Tp, __constexpr_param _Rp> | ||
| 237 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator|=(this _Tp, _Rp) noexcept | ||
| 238 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 239 | -> constant_wrapper<auto(_Tp::value |= _Rp::value)> { | ||
| 240 | return {}; | ||
| 241 | } | ||
| 242 | template <__constexpr_param _Tp, __constexpr_param _Rp> | ||
| 243 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator^=(this _Tp, _Rp) noexcept | ||
| 244 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 245 | -> constant_wrapper<auto(_Tp::value ^= _Rp::value)> { | ||
| 246 | return {}; | ||
| 247 | } | ||
| 248 | template <__constexpr_param _Tp, __constexpr_param _Rp> | ||
| 249 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator<<=(this _Tp, _Rp) noexcept | ||
| 250 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 251 | -> constant_wrapper<auto(_Tp::value <<= _Rp::value)> { | ||
| 252 | return {}; | ||
| 253 | } | ||
| 254 | template <__constexpr_param _Tp, __constexpr_param _Rp> | ||
| 255 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator>>=(this _Tp, _Rp) noexcept | ||
| 256 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 257 | -> constant_wrapper<auto(_Tp::value >>= _Rp::value)> { | ||
| 258 | return {}; | ||
| 259 | } | ||
| 260 | }; | ||
| 261 | |||
| 262 | template <const auto& _Callable, class... _Args> | ||
| 263 | concept __constexpr_callable = (__constexpr_param<remove_cvref_t<_Args>> && ...) && requires { | ||
| 264 | typename constant_wrapper<std::invoke(_Callable, remove_cvref_t<_Args>::value...)>; | ||
| 265 | }; | ||
| 266 | |||
| 267 | template <const auto& _Obj, class... _Args> | ||
| 268 | concept __constexpr_indexable = (__constexpr_param<remove_cvref_t<_Args>> && ...) && requires { | ||
| 269 | typename constant_wrapper<auto(_Obj[remove_cvref_t<_Args>::value...])>; | ||
| 270 | }; | ||
| 271 | |||
| 272 | template <auto _Xp, class _Tp> | ||
| 273 | struct constant_wrapper : __cw_operators { | ||
| 274 | static constexpr decltype((_Xp)) value = (_Xp); | ||
| 275 | |||
| 276 | using type = constant_wrapper; | ||
| 277 | using value_type = decltype(_Xp); | ||
| 278 | |||
| 279 | static_assert(is_same_v<_Tp, value_type>, | ||
| 280 | "the second template parameter of std::constant_wrapper must be its value_type"); | ||
| 281 | |||
| 282 | template <__constexpr_param _Rp> | ||
| 283 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator=(_Rp) const noexcept | ||
| 284 | // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed. | ||
| 285 | -> constant_wrapper<auto(value = _Rp::value)> { | ||
| 286 | return {}; | ||
| 287 | } | ||
| 288 | |||
| 289 | _LIBCPP_HIDE_FROM_ABI constexpr operator decltype(value)() const noexcept { return value; } | ||
| 290 | |||
| 291 | template <class... _Args> | ||
| 292 | requires __constexpr_callable<value, _Args...> | ||
| 293 | [[nodiscard]] | ||
| 294 | _LIBCPP_HIDE_FROM_ABI static constexpr constant_wrapper<std::invoke(value, remove_cvref_t<_Args>::value...)> | ||
| 295 | operator()(_Args&&...) noexcept { | ||
| 296 | return {}; | ||
| 297 | } | ||
| 298 | |||
| 299 | template <class... _Args> | ||
| 300 | requires(!__constexpr_callable<value, _Args...> && is_invocable_v<const value_type&, _Args && ...>) | ||
| 301 | _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) | ||
| 302 | operator()(_Args&&... __args) noexcept(noexcept(std::invoke(value, std::forward<_Args>(__args)...))) { | ||
| 303 | return std::invoke(value, std::forward<_Args>(__args)...); | ||
| 304 | } | ||
| 305 | |||
| 306 | template <class... _Args> | ||
| 307 | requires __constexpr_indexable<value, _Args...> | ||
| 308 | [[nodiscard]] | ||
| 309 | _LIBCPP_HIDE_FROM_ABI static constexpr constant_wrapper<auto(value[remove_cvref_t<_Args>::value...])> | ||
| 310 | operator[](_Args&&...) noexcept { | ||
| 311 | return {}; | ||
| 312 | } | ||
| 313 | |||
| 314 | template <class... _Args> | ||
| 315 | requires(!__constexpr_indexable<value, _Args...> && requires { value[std::declval<_Args>()...]; }) | ||
| 316 | _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) | ||
| 317 | operator[](_Args&&... __args) noexcept(noexcept(value[std::forward<_Args>(__args)...])) { | ||
| 318 | return value[std::forward<_Args>(__args)...]; | ||
| 319 | } | ||
| 320 | }; | ||
| 321 | |||
| 322 | #endif // _LIBCPP_STD_VER >= 26 | ||
| 323 | |||
| 324 | _LIBCPP_END_NAMESPACE_STD | ||
| 325 | |||
| 326 | #endif // _LIBCPP___UTILITY_CONSTANT_WRAPPER_H | ||
lib/libcxx/include/__utility/default_three_way_comparator.h+2-2| ... | @@ -31,7 +31,7 @@ template <class _LHS, class _RHS> | ... | @@ -31,7 +31,7 @@ template <class _LHS, class _RHS> |
| 31 | struct __default_three_way_comparator<_LHS, | 31 | struct __default_three_way_comparator<_LHS, |
| 32 | _RHS, | 32 | _RHS, |
| 33 | __enable_if_t<is_arithmetic<_LHS>::value && is_arithmetic<_RHS>::value> > { | 33 | __enable_if_t<is_arithmetic<_LHS>::value && is_arithmetic<_RHS>::value> > { |
| 34 | _LIBCPP_HIDE_FROM_ABI static int operator()(_LHS __lhs, _RHS __rhs) { | 34 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static int operator()(_LHS __lhs, _RHS __rhs) { |
| 35 | if (__lhs < __rhs) | 35 | if (__lhs < __rhs) |
| 36 | return -1; | 36 | return -1; |
| 37 | if (__lhs > __rhs) | 37 | if (__lhs > __rhs) |
| ... | @@ -47,7 +47,7 @@ struct __default_three_way_comparator< | ... | @@ -47,7 +47,7 @@ struct __default_three_way_comparator< |
| 47 | _RHS, | 47 | _RHS, |
| 48 | __enable_if_t<!(is_arithmetic<_LHS>::value && is_arithmetic<_RHS>::value) && | 48 | __enable_if_t<!(is_arithmetic<_LHS>::value && is_arithmetic<_RHS>::value) && |
| 49 | __builtin_lt_synthesizes_from_spaceship(const _LHS&, const _RHS&)>> { | 49 | __builtin_lt_synthesizes_from_spaceship(const _LHS&, const _RHS&)>> { |
| 50 | _LIBCPP_HIDE_FROM_ABI static int operator()(const _LHS& __lhs, const _RHS& __rhs) { | 50 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static int operator()(const _LHS& __lhs, const _RHS& __rhs) { |
| 51 | auto __res = __lhs <=> __rhs; | 51 | auto __res = __lhs <=> __rhs; |
| 52 | if (__res < 0) | 52 | if (__res < 0) |
| 53 | return -1; | 53 | return -1; |
lib/libcxx/include/__utility/exchange.h+14-3| ... | @@ -10,6 +10,9 @@ | ... | @@ -10,6 +10,9 @@ |
| 10 | #define _LIBCPP___UTILITY_EXCHANGE_H | 10 | #define _LIBCPP___UTILITY_EXCHANGE_H |
| 11 | 11 | ||
| 12 | #include <__config> | 12 | #include <__config> |
| 13 | #include <__type_traits/enable_if.h> | ||
| 14 | #include <__type_traits/is_assignable.h> | ||
| 15 | #include <__type_traits/is_constructible.h> | ||
| 13 | #include <__type_traits/is_nothrow_assignable.h> | 16 | #include <__type_traits/is_nothrow_assignable.h> |
| 14 | #include <__type_traits/is_nothrow_constructible.h> | 17 | #include <__type_traits/is_nothrow_constructible.h> |
| 15 | #include <__utility/forward.h> | 18 | #include <__utility/forward.h> |
| ... | @@ -24,14 +27,22 @@ _LIBCPP_PUSH_MACROS | ... | @@ -24,14 +27,22 @@ _LIBCPP_PUSH_MACROS |
| 24 | 27 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 29 | ||
| 27 | #if _LIBCPP_STD_VER >= 14 | ||
| 28 | template <class _T1, class _T2 = _T1> | 30 | template <class _T1, class _T2 = _T1> |
| 29 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _T1 exchange(_T1& __obj, _T2&& __new_value) noexcept( | 31 | [[__nodiscard__]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1 |
| 30 | is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) { | 32 | __exchange(_T1& __obj, _T2&& __new_value) |
| 33 | _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value&& is_nothrow_assignable<_T1&, _T2>::value) { | ||
| 31 | _T1 __old_value = std::move(__obj); | 34 | _T1 __old_value = std::move(__obj); |
| 32 | __obj = std::forward<_T2>(__new_value); | 35 | __obj = std::forward<_T2>(__new_value); |
| 33 | return __old_value; | 36 | return __old_value; |
| 34 | } | 37 | } |
| 38 | |||
| 39 | #if _LIBCPP_STD_VER >= 14 | ||
| 40 | template <class _T1, class _T2 = _T1> | ||
| 41 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI | ||
| 42 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _T1 exchange(_T1& __obj, _T2&& __new_value) noexcept( | ||
| 43 | is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) { | ||
| 44 | return std::__exchange(__obj, std::forward<_T2>(__new_value)); | ||
| 45 | } | ||
| 35 | #endif // _LIBCPP_STD_VER >= 14 | 46 | #endif // _LIBCPP_STD_VER >= 14 |
| 36 | 47 | ||
| 37 | _LIBCPP_END_NAMESPACE_STD | 48 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__utility/forward_like.h+4-4| ... | @@ -21,10 +21,10 @@ | ... | @@ -21,10 +21,10 @@ |
| 21 | # pragma GCC system_header | 21 | # pragma GCC system_header |
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | #if _LIBCPP_STD_VER >= 23 | 24 | #if _LIBCPP_STD_VER >= 23 |
| 27 | 25 | ||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 27 | |||
| 28 | template <class _Ap, class _Bp> | 28 | template <class _Ap, class _Bp> |
| 29 | using _CopyConst _LIBCPP_NODEBUG = _If<is_const_v<_Ap>, const _Bp, _Bp>; | 29 | using _CopyConst _LIBCPP_NODEBUG = _If<is_const_v<_Ap>, const _Bp, _Bp>; |
| 30 | 30 | ||
| ... | @@ -56,8 +56,8 @@ __forward_as(_LIBCPP_LIFETIMEBOUND _Up&& __val) noexcept { | ... | @@ -56,8 +56,8 @@ __forward_as(_LIBCPP_LIFETIMEBOUND _Up&& __val) noexcept { |
| 56 | return static_cast<_ForwardLike<_Tp, _As>>(__val); | 56 | return static_cast<_ForwardLike<_Tp, _As>>(__val); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 60 | |||
| 61 | _LIBCPP_END_NAMESPACE_STD | 59 | _LIBCPP_END_NAMESPACE_STD |
| 62 | 60 | ||
| 61 | #endif // _LIBCPP_STD_VER >= 23 | ||
| 62 | |||
| 63 | #endif // _LIBCPP___UTILITY_FORWARD_LIKE_H | 63 | #endif // _LIBCPP___UTILITY_FORWARD_LIKE_H |
lib/libcxx/include/__utility/in_place.h+4-4| ... | @@ -18,10 +18,10 @@ | ... | @@ -18,10 +18,10 @@ |
| 18 | # pragma GCC system_header | 18 | # pragma GCC system_header |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 22 | |||
| 23 | #if _LIBCPP_STD_VER >= 17 | 21 | #if _LIBCPP_STD_VER >= 17 |
| 24 | 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 24 | |||
| 25 | struct in_place_t { | 25 | struct in_place_t { |
| 26 | explicit in_place_t() = default; | 26 | explicit in_place_t() = default; |
| 27 | }; | 27 | }; |
| ... | @@ -57,8 +57,8 @@ struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {}; | ... | @@ -57,8 +57,8 @@ struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {}; |
| 57 | template <class _Tp> | 57 | template <class _Tp> |
| 58 | using __is_inplace_index _LIBCPP_NODEBUG = __is_inplace_index_imp<__remove_cvref_t<_Tp>>; | 58 | using __is_inplace_index _LIBCPP_NODEBUG = __is_inplace_index_imp<__remove_cvref_t<_Tp>>; |
| 59 | 59 | ||
| 60 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 61 | |||
| 62 | _LIBCPP_END_NAMESPACE_STD | 60 | _LIBCPP_END_NAMESPACE_STD |
| 63 | 61 | ||
| 62 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 63 | |||
| 64 | #endif // _LIBCPP___UTILITY_IN_PLACE_H | 64 | #endif // _LIBCPP___UTILITY_IN_PLACE_H |
lib/libcxx/include/__utility/is_pointer_in_range.h+6-6| ... | @@ -12,12 +12,12 @@ | ... | @@ -12,12 +12,12 @@ |
| 12 | #include <__algorithm/comp.h> | 12 | #include <__algorithm/comp.h> |
| 13 | #include <__assert> | 13 | #include <__assert> |
| 14 | #include <__config> | 14 | #include <__config> |
| 15 | #include <__memory/valid_range.h> | ||
| 15 | #include <__type_traits/enable_if.h> | 16 | #include <__type_traits/enable_if.h> |
| 16 | #include <__type_traits/integral_constant.h> | 17 | #include <__type_traits/integral_constant.h> |
| 17 | #include <__type_traits/is_constant_evaluated.h> | 18 | #include <__type_traits/is_constant_evaluated.h> |
| 18 | #include <__type_traits/void_t.h> | 19 | #include <__type_traits/void_t.h> |
| 19 | #include <__utility/declval.h> | 20 | #include <__utility/declval.h> |
| 20 | #include <__utility/is_valid_range.h> | ||
| 21 | 21 | ||
| 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | # pragma GCC system_header | 23 | # pragma GCC system_header |
| ... | @@ -26,13 +26,13 @@ | ... | @@ -26,13 +26,13 @@ |
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 27 | ||
| 28 | template <class _Tp, class _Up, class = void> | 28 | template <class _Tp, class _Up, class = void> |
| 29 | struct __is_less_than_comparable : false_type {}; | 29 | inline const bool __is_less_than_comparable_v = false; |
| 30 | 30 | ||
| 31 | template <class _Tp, class _Up> | 31 | template <class _Tp, class _Up> |
| 32 | struct __is_less_than_comparable<_Tp, _Up, __void_t<decltype(std::declval<_Tp>() < std::declval<_Up>())> > : true_type { | 32 | inline const bool |
| 33 | }; | 33 | __is_less_than_comparable_v<_Tp, _Up, __void_t<decltype(std::declval<_Tp>() < std::declval<_Up>())> > = true; |
| 34 | 34 | ||
| 35 | template <class _Tp, class _Up, __enable_if_t<__is_less_than_comparable<const _Tp*, const _Up*>::value, int> = 0> | 35 | template <class _Tp, class _Up, __enable_if_t<__is_less_than_comparable_v<const _Tp*, const _Up*>, int> = 0> |
| 36 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool | 36 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool |
| 37 | __is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) { | 37 | __is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) { |
| 38 | _LIBCPP_ASSERT_VALID_INPUT_RANGE(std::__is_valid_range(__begin, __end), "[__begin, __end) is not a valid range"); | 38 | _LIBCPP_ASSERT_VALID_INPUT_RANGE(std::__is_valid_range(__begin, __end), "[__begin, __end) is not a valid range"); |
| ... | @@ -47,7 +47,7 @@ __is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) { | ... | @@ -47,7 +47,7 @@ __is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) { |
| 47 | return !__less<>()(__ptr, __begin) && __less<>()(__ptr, __end); | 47 | return !__less<>()(__ptr, __begin) && __less<>()(__ptr, __end); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | template <class _Tp, class _Up, __enable_if_t<!__is_less_than_comparable<const _Tp*, const _Up*>::value, int> = 0> | 50 | template <class _Tp, class _Up, __enable_if_t<!__is_less_than_comparable_v<const _Tp*, const _Up*>, int> = 0> |
| 51 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool | 51 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool |
| 52 | __is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) { | 52 | __is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) { |
| 53 | if (__libcpp_is_constant_evaluated()) | 53 | if (__libcpp_is_constant_evaluated()) |
lib/libcxx/include/__utility/is_valid_range.h deleted-37| ... | @@ -1,37 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___UTILITY_IS_VALID_RANGE_H | ||
| 10 | #define _LIBCPP___UTILITY_IS_VALID_RANGE_H | ||
| 11 | |||
| 12 | #include <__algorithm/comp.h> | ||
| 13 | #include <__config> | ||
| 14 | #include <__type_traits/is_constant_evaluated.h> | ||
| 15 | |||
| 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 17 | # pragma GCC system_header | ||
| 18 | #endif | ||
| 19 | |||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 21 | |||
| 22 | template <class _Tp> | ||
| 23 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool | ||
| 24 | __is_valid_range(const _Tp* __first, const _Tp* __last) { | ||
| 25 | if (__libcpp_is_constant_evaluated()) { | ||
| 26 | // If this is not a constant during constant evaluation, that is because __first and __last are not | ||
| 27 | // part of the same allocation. If they are part of the same allocation, we must still make sure they | ||
| 28 | // are ordered properly. | ||
| 29 | return __builtin_constant_p(__first <= __last) && __first <= __last; | ||
| 30 | } | ||
| 31 | |||
| 32 | return !__less<>()(__last, __first); | ||
| 33 | } | ||
| 34 | |||
| 35 | _LIBCPP_END_NAMESPACE_STD | ||
| 36 | |||
| 37 | #endif // _LIBCPP___UTILITY_IS_VALID_RANGE_H | ||
lib/libcxx/include/__utility/lazy_synth_three_way_comparator.h+18-15| ... | @@ -35,20 +35,20 @@ struct __lazy_compare_result { | ... | @@ -35,20 +35,20 @@ struct __lazy_compare_result { |
| 35 | const _LHS& __lhs_; | 35 | const _LHS& __lhs_; |
| 36 | const _RHS& __rhs_; | 36 | const _RHS& __rhs_; |
| 37 | 37 | ||
| 38 | _LIBCPP_HIDE_FROM_ABI | 38 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_compare_result( |
| 39 | __lazy_compare_result(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp, | 39 | _LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp, |
| 40 | _LIBCPP_CTOR_LIFETIMEBOUND const _LHS& __lhs, | 40 | _LIBCPP_CTOR_LIFETIMEBOUND const _LHS& __lhs, |
| 41 | _LIBCPP_CTOR_LIFETIMEBOUND const _RHS& __rhs) | 41 | _LIBCPP_CTOR_LIFETIMEBOUND const _RHS& __rhs) |
| 42 | : __comp_(__comp), __lhs_(__lhs), __rhs_(__rhs) {} | 42 | : __comp_(__comp), __lhs_(__lhs), __rhs_(__rhs) {} |
| 43 | 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI bool __less() const { | 44 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __less() const { |
| 45 | bool __result = __comp_(__lhs_, __rhs_); | 45 | bool __result = __comp_(__lhs_, __rhs_); |
| 46 | _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(__result ? !static_cast<bool>(__comp_(__rhs_, __lhs_)) : true, | 46 | _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(__result ? !static_cast<bool>(__comp_(__rhs_, __lhs_)) : true, |
| 47 | "Comparator does not induce a strict weak ordering"); | 47 | "Comparator does not induce a strict weak ordering"); |
| 48 | return __result; | 48 | return __result; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | _LIBCPP_HIDE_FROM_ABI bool __greater() const { | 51 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __greater() const { |
| 52 | bool __result = __comp_(__rhs_, __lhs_); | 52 | bool __result = __comp_(__rhs_, __lhs_); |
| 53 | _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(__result ? !static_cast<bool>(__comp_(__lhs_, __rhs_)) : true, | 53 | _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(__result ? !static_cast<bool>(__comp_(__lhs_, __rhs_)) : true, |
| 54 | "Comparator does not induce a strict weak ordering"); | 54 | "Comparator does not induce a strict weak ordering"); |
| ... | @@ -63,10 +63,11 @@ template <class _Comparator, class _LHS, class _RHS, class = void> | ... | @@ -63,10 +63,11 @@ template <class _Comparator, class _LHS, class _RHS, class = void> |
| 63 | struct __lazy_synth_three_way_comparator { | 63 | struct __lazy_synth_three_way_comparator { |
| 64 | const _Comparator& __comp_; | 64 | const _Comparator& __comp_; |
| 65 | 65 | ||
| 66 | _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp) | 66 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 67 | __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp) | ||
| 67 | : __comp_(__comp) {} | 68 | : __comp_(__comp) {} |
| 68 | 69 | ||
| 69 | _LIBCPP_HIDE_FROM_ABI __lazy_compare_result<_Comparator, _LHS, _RHS> | 70 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_compare_result<_Comparator, _LHS, _RHS> |
| 70 | operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) const { | 71 | operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) const { |
| 71 | return __lazy_compare_result<_Comparator, _LHS, _RHS>(__comp_, __lhs, __rhs); | 72 | return __lazy_compare_result<_Comparator, _LHS, _RHS>(__comp_, __lhs, __rhs); |
| 72 | } | 73 | } |
| ... | @@ -75,10 +76,10 @@ struct __lazy_synth_three_way_comparator { | ... | @@ -75,10 +76,10 @@ struct __lazy_synth_three_way_comparator { |
| 75 | struct __eager_compare_result { | 76 | struct __eager_compare_result { |
| 76 | int __res_; | 77 | int __res_; |
| 77 | 78 | ||
| 78 | _LIBCPP_HIDE_FROM_ABI explicit __eager_compare_result(int __res) : __res_(__res) {} | 79 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __eager_compare_result(int __res) : __res_(__res) {} |
| 79 | 80 | ||
| 80 | _LIBCPP_HIDE_FROM_ABI bool __less() const { return __res_ < 0; } | 81 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __less() const { return __res_ < 0; } |
| 81 | _LIBCPP_HIDE_FROM_ABI bool __greater() const { return __res_ > 0; } | 82 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __greater() const { return __res_ > 0; } |
| 82 | }; | 83 | }; |
| 83 | 84 | ||
| 84 | template <class _Comparator, class _LHS, class _RHS> | 85 | template <class _Comparator, class _LHS, class _RHS> |
| ... | @@ -89,10 +90,11 @@ struct __lazy_synth_three_way_comparator<_Comparator, | ... | @@ -89,10 +90,11 @@ struct __lazy_synth_three_way_comparator<_Comparator, |
| 89 | __has_default_three_way_comparator<_LHS, _RHS> >::value> > { | 90 | __has_default_three_way_comparator<_LHS, _RHS> >::value> > { |
| 90 | // This lifetimebound annotation is technically incorrect, but other specializations actually capture the lifetime of | 91 | // This lifetimebound annotation is technically incorrect, but other specializations actually capture the lifetime of |
| 91 | // the comparator. | 92 | // the comparator. |
| 92 | _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {} | 93 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 94 | __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {} | ||
| 93 | 95 | ||
| 94 | // Same comment as above. | 96 | // Same comment as above. |
| 95 | _LIBCPP_HIDE_FROM_ABI static __eager_compare_result | 97 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static __eager_compare_result |
| 96 | operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) { | 98 | operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) { |
| 97 | return __eager_compare_result(__default_three_way_comparator<_LHS, _RHS>()(__lhs, __rhs)); | 99 | return __eager_compare_result(__default_three_way_comparator<_LHS, _RHS>()(__lhs, __rhs)); |
| 98 | } | 100 | } |
| ... | @@ -106,10 +108,11 @@ struct __lazy_synth_three_way_comparator<_Comparator, | ... | @@ -106,10 +108,11 @@ struct __lazy_synth_three_way_comparator<_Comparator, |
| 106 | __has_default_three_way_comparator<_LHS, _RHS> >::value> > { | 108 | __has_default_three_way_comparator<_LHS, _RHS> >::value> > { |
| 107 | // This lifetimebound annotation is technically incorrect, but other specializations actually capture the lifetime of | 109 | // This lifetimebound annotation is technically incorrect, but other specializations actually capture the lifetime of |
| 108 | // the comparator. | 110 | // the comparator. |
| 109 | _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {} | 111 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 112 | __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {} | ||
| 110 | 113 | ||
| 111 | // Same comment as above. | 114 | // Same comment as above. |
| 112 | _LIBCPP_HIDE_FROM_ABI static __eager_compare_result | 115 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static __eager_compare_result |
| 113 | operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) { | 116 | operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) { |
| 114 | return __eager_compare_result(-__default_three_way_comparator<_LHS, _RHS>()(__lhs, __rhs)); | 117 | return __eager_compare_result(-__default_three_way_comparator<_LHS, _RHS>()(__lhs, __rhs)); |
| 115 | } | 118 | } |
lib/libcxx/include/__utility/pair.h+77-97| ... | @@ -55,22 +55,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -55,22 +55,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 55 | template <class _T1, class _T2> | 55 | template <class _T1, class _T2> |
| 56 | struct __check_pair_construction { | 56 | struct __check_pair_construction { |
| 57 | template <int&...> | 57 | template <int&...> |
| 58 | static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() { | 58 | static constexpr bool __enable_implicit_default() { |
| 59 | return __is_implicitly_default_constructible<_T1>::value && __is_implicitly_default_constructible<_T2>::value; | 59 | return __is_implicitly_default_constructible<_T1>::value && __is_implicitly_default_constructible<_T2>::value; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | template <int&...> | 62 | template <int&...> |
| 63 | static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_default() { | 63 | static constexpr bool __enable_default() { |
| 64 | return is_default_constructible<_T1>::value && is_default_constructible<_T2>::value; | 64 | return is_default_constructible<_T1>::value && is_default_constructible<_T2>::value; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | template <class _U1, class _U2> | 67 | template <class _U1, class _U2> |
| 68 | static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_pair_constructible() { | 68 | static constexpr bool __is_pair_constructible() { |
| 69 | return is_constructible<_T1, _U1>::value && is_constructible<_T2, _U2>::value; | 69 | return is_constructible<_T1, _U1>::value && is_constructible<_T2, _U2>::value; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | template <class _U1, class _U2> | 72 | template <class _U1, class _U2> |
| 73 | static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_implicit() { | 73 | static constexpr bool __is_implicit() { |
| 74 | return is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value; | 74 | return is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value; |
| 75 | } | 75 | } |
| 76 | }; | 76 | }; |
| ... | @@ -79,9 +79,8 @@ struct __check_pair_construction { | ... | @@ -79,9 +79,8 @@ struct __check_pair_construction { |
| 79 | 79 | ||
| 80 | template <class, class> | 80 | template <class, class> |
| 81 | struct __non_trivially_copyable_base { | 81 | struct __non_trivially_copyable_base { |
| 82 | _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __non_trivially_copyable_base() _NOEXCEPT {} | 82 | _LIBCPP_CONSTEXPR __non_trivially_copyable_base() _NOEXCEPT {} |
| 83 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI | 83 | _LIBCPP_CONSTEXPR_SINCE_CXX14 __non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {} |
| 84 | __non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {} | ||
| 85 | }; | 84 | }; |
| 86 | 85 | ||
| 87 | template <class _T1, class _T2> | 86 | template <class _T1, class _T2> |
| ... | @@ -101,18 +100,18 @@ struct pair | ... | @@ -101,18 +100,18 @@ struct pair |
| 101 | pair, | 100 | pair, |
| 102 | void>; | 101 | void>; |
| 103 | 102 | ||
| 104 | _LIBCPP_HIDE_FROM_ABI pair(pair const&) = default; | 103 | pair(pair const&) = default; |
| 105 | _LIBCPP_HIDE_FROM_ABI pair(pair&&) = default; | 104 | pair(pair&&) = default; |
| 106 | 105 | ||
| 107 | #ifdef _LIBCPP_CXX03_LANG | 106 | #ifdef _LIBCPP_CXX03_LANG |
| 108 | _LIBCPP_HIDE_FROM_ABI pair() : first(), second() {} | 107 | pair() : first(), second() {} |
| 109 | 108 | ||
| 110 | _LIBCPP_HIDE_FROM_ABI pair(_T1 const& __t1, _T2 const& __t2) : first(__t1), second(__t2) {} | 109 | pair(_T1 const& __t1, _T2 const& __t2) : first(__t1), second(__t2) {} |
| 111 | 110 | ||
| 112 | template <class _U1, class _U2> | 111 | template <class _U1, class _U2> |
| 113 | _LIBCPP_HIDE_FROM_ABI pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} | 112 | pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} |
| 114 | 113 | ||
| 115 | _LIBCPP_HIDE_FROM_ABI pair& operator=(pair const& __p) { | 114 | pair& operator=(pair const& __p) { |
| 116 | first = __p.first; | 115 | first = __p.first; |
| 117 | second = __p.second; | 116 | second = __p.second; |
| 118 | return *this; | 117 | return *this; |
| ... | @@ -126,7 +125,7 @@ struct pair | ... | @@ -126,7 +125,7 @@ struct pair |
| 126 | class _U2, | 125 | class _U2, |
| 127 | __enable_if_t<is_assignable<first_type&, _U1 const&>::value && is_assignable<second_type&, _U2 const&>::value, | 126 | __enable_if_t<is_assignable<first_type&, _U1 const&>::value && is_assignable<second_type&, _U2 const&>::value, |
| 128 | int> = 0> | 127 | int> = 0> |
| 129 | _LIBCPP_HIDE_FROM_ABI pair& operator=(pair<_U1, _U2> const& __p) { | 128 | pair& operator=(pair<_U1, _U2> const& __p) { |
| 130 | first = __p.first; | 129 | first = __p.first; |
| 131 | second = __p.second; | 130 | second = __p.second; |
| 132 | return *this; | 131 | return *this; |
| ... | @@ -134,13 +133,12 @@ struct pair | ... | @@ -134,13 +133,12 @@ struct pair |
| 134 | #else | 133 | #else |
| 135 | template <class _CheckArgsDep = __check_pair_construction<_T1, _T2>, | 134 | template <class _CheckArgsDep = __check_pair_construction<_T1, _T2>, |
| 136 | __enable_if_t<_CheckArgsDep::__enable_default(), int> = 0> | 135 | __enable_if_t<_CheckArgsDep::__enable_default(), int> = 0> |
| 137 | explicit(!_CheckArgsDep::__enable_implicit_default()) _LIBCPP_HIDE_FROM_ABI constexpr pair() noexcept( | 136 | explicit(!_CheckArgsDep::__enable_implicit_default()) constexpr pair() noexcept( |
| 138 | is_nothrow_default_constructible<first_type>::value && is_nothrow_default_constructible<second_type>::value) | 137 | is_nothrow_default_constructible<first_type>::value && is_nothrow_default_constructible<second_type>::value) |
| 139 | : first(), second() {} | 138 | : first(), second() {} |
| 140 | 139 | ||
| 141 | template <class _CheckArgsDep = __check_pair_construction<_T1, _T2>, | 140 | template <class _CheckArgsDep = __check_pair_construction<_T1, _T2>, |
| 142 | __enable_if_t<_CheckArgsDep::template __is_pair_constructible<_T1 const&, _T2 const&>(), int> = 0> | 141 | __enable_if_t<_CheckArgsDep::template __is_pair_constructible<_T1 const&, _T2 const&>(), int> = 0> |
| 143 | _LIBCPP_HIDE_FROM_ABI | ||
| 144 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_CheckArgsDep::template __is_implicit<_T1 const&, _T2 const&>()) | 142 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_CheckArgsDep::template __is_implicit<_T1 const&, _T2 const&>()) |
| 145 | pair(_T1 const& __t1, _T2 const& __t2) noexcept(is_nothrow_copy_constructible<first_type>::value && | 143 | pair(_T1 const& __t1, _T2 const& __t2) noexcept(is_nothrow_copy_constructible<first_type>::value && |
| 146 | is_nothrow_copy_constructible<second_type>::value) | 144 | is_nothrow_copy_constructible<second_type>::value) |
| ... | @@ -155,7 +153,6 @@ struct pair | ... | @@ -155,7 +153,6 @@ struct pair |
| 155 | class _U2, | 153 | class _U2, |
| 156 | # endif | 154 | # endif |
| 157 | __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1, _U2>(), int> = 0 > | 155 | __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1, _U2>(), int> = 0 > |
| 158 | _LIBCPP_HIDE_FROM_ABI | ||
| 159 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<_U1, _U2>()) | 156 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<_U1, _U2>()) |
| 160 | pair(_U1&& __u1, _U2&& __u2) noexcept(is_nothrow_constructible<first_type, _U1>::value && | 157 | pair(_U1&& __u1, _U2&& __u2) noexcept(is_nothrow_constructible<first_type, _U1>::value && |
| 161 | is_nothrow_constructible<second_type, _U2>::value) | 158 | is_nothrow_constructible<second_type, _U2>::value) |
| ... | @@ -166,7 +163,7 @@ struct pair | ... | @@ -166,7 +163,7 @@ struct pair |
| 166 | template <class _U1, | 163 | template <class _U1, |
| 167 | class _U2, | 164 | class _U2, |
| 168 | __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1&, _U2&>(), int> = 0> | 165 | __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1&, _U2&>(), int> = 0> |
| 169 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<_U1&, _U2&>()) | 166 | constexpr explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<_U1&, _U2&>()) |
| 170 | pair(pair<_U1, _U2>& __p) noexcept((is_nothrow_constructible<first_type, _U1&>::value && | 167 | pair(pair<_U1, _U2>& __p) noexcept((is_nothrow_constructible<first_type, _U1&>::value && |
| 171 | is_nothrow_constructible<second_type, _U2&>::value)) | 168 | is_nothrow_constructible<second_type, _U2&>::value)) |
| 172 | : first(__p.first), second(__p.second) {} | 169 | : first(__p.first), second(__p.second) {} |
| ... | @@ -177,7 +174,7 @@ struct pair | ... | @@ -177,7 +174,7 @@ struct pair |
| 177 | class _U2, | 174 | class _U2, |
| 178 | __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1 const&, _U2 const&>(), | 175 | __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1 const&, _U2 const&>(), |
| 179 | int> = 0> | 176 | int> = 0> |
| 180 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit( | 177 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit( |
| 181 | !__check_pair_construction<_T1, _T2>::template __is_implicit<_U1 const&, _U2 const&>()) | 178 | !__check_pair_construction<_T1, _T2>::template __is_implicit<_U1 const&, _U2 const&>()) |
| 182 | pair(pair<_U1, _U2> const& __p) noexcept(is_nothrow_constructible<first_type, _U1 const&>::value && | 179 | pair(pair<_U1, _U2> const& __p) noexcept(is_nothrow_constructible<first_type, _U1 const&>::value && |
| 183 | is_nothrow_constructible<second_type, _U2 const&>::value) | 180 | is_nothrow_constructible<second_type, _U2 const&>::value) |
| ... | @@ -186,7 +183,6 @@ struct pair | ... | @@ -186,7 +183,6 @@ struct pair |
| 186 | template <class _U1, | 183 | template <class _U1, |
| 187 | class _U2, | 184 | class _U2, |
| 188 | __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1, _U2>(), int> = 0> | 185 | __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1, _U2>(), int> = 0> |
| 189 | _LIBCPP_HIDE_FROM_ABI | ||
| 190 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<_U1, _U2>()) | 186 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<_U1, _U2>()) |
| 191 | pair(pair<_U1, _U2>&& __p) noexcept(is_nothrow_constructible<first_type, _U1&&>::value && | 187 | pair(pair<_U1, _U2>&& __p) noexcept(is_nothrow_constructible<first_type, _U1&&>::value && |
| 192 | is_nothrow_constructible<second_type, _U2&&>::value) | 188 | is_nothrow_constructible<second_type, _U2&&>::value) |
| ... | @@ -198,8 +194,7 @@ struct pair | ... | @@ -198,8 +194,7 @@ struct pair |
| 198 | class _U2, | 194 | class _U2, |
| 199 | __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<const _U1&&, const _U2&&>(), | 195 | __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<const _U1&&, const _U2&&>(), |
| 200 | int> = 0> | 196 | int> = 0> |
| 201 | _LIBCPP_HIDE_FROM_ABI constexpr explicit( | 197 | constexpr explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<const _U1&&, const _U2&&>()) |
| 202 | !__check_pair_construction<_T1, _T2>::template __is_implicit<const _U1&&, const _U2&&>()) | ||
| 203 | pair(const pair<_U1, _U2>&& __p) noexcept(is_nothrow_constructible<first_type, const _U1&&>::value && | 198 | pair(const pair<_U1, _U2>&& __p) noexcept(is_nothrow_constructible<first_type, const _U1&&>::value && |
| 204 | is_nothrow_constructible<second_type, const _U2&&>::value) | 199 | is_nothrow_constructible<second_type, const _U2&&>::value) |
| 205 | : first(std::move(__p.first)), second(std::move(__p.second)) {} | 200 | : first(std::move(__p.first)), second(std::move(__p.second)) {} |
| ... | @@ -209,19 +204,19 @@ struct pair | ... | @@ -209,19 +204,19 @@ struct pair |
| 209 | template <__pair_like_no_subrange _PairLike> | 204 | template <__pair_like_no_subrange _PairLike> |
| 210 | requires(is_constructible_v<first_type, decltype(std::get<0>(std::declval<_PairLike &&>()))> && | 205 | requires(is_constructible_v<first_type, decltype(std::get<0>(std::declval<_PairLike &&>()))> && |
| 211 | is_constructible_v<second_type, decltype(std::get<1>(std::declval<_PairLike &&>()))>) | 206 | is_constructible_v<second_type, decltype(std::get<1>(std::declval<_PairLike &&>()))>) |
| 212 | _LIBCPP_HIDE_FROM_ABI constexpr explicit( | 207 | constexpr explicit(!is_convertible_v<decltype(std::get<0>(std::declval<_PairLike&&>())), first_type> || |
| 213 | !is_convertible_v<decltype(std::get<0>(std::declval<_PairLike&&>())), first_type> || | 208 | !is_convertible_v<decltype(std::get<1>(std::declval<_PairLike&&>())), second_type>) |
| 214 | !is_convertible_v<decltype(std::get<1>(std::declval<_PairLike&&>())), second_type>) pair(_PairLike&& __p) | 209 | pair(_PairLike&& __p) |
| 215 | : first(std::get<0>(std::forward<_PairLike>(__p))), second(std::get<1>(std::forward<_PairLike>(__p))) {} | 210 | : first(std::get<0>(std::forward<_PairLike>(__p))), second(std::get<1>(std::forward<_PairLike>(__p))) {} |
| 216 | # endif | 211 | # endif |
| 217 | 212 | ||
| 218 | template <class... _Args1, class... _Args2> | 213 | template <class... _Args1, class... _Args2> |
| 219 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | 214 | _LIBCPP_CONSTEXPR_SINCE_CXX20 |
| 220 | pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) noexcept( | 215 | pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) noexcept( |
| 221 | is_nothrow_constructible<first_type, _Args1...>::value && is_nothrow_constructible<second_type, _Args2...>::value) | 216 | is_nothrow_constructible<first_type, _Args1...>::value && is_nothrow_constructible<second_type, _Args2...>::value) |
| 222 | : pair(__pc, __first_args, __second_args, __index_sequence_for<_Args1...>(), __index_sequence_for<_Args2...>()) {} | 217 | : pair(__pc, __first_args, __second_args, __index_sequence_for<_Args1...>(), __index_sequence_for<_Args2...>()) {} |
| 223 | 218 | ||
| 224 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& | 219 | _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& |
| 225 | operator=(__conditional_t<is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value, | 220 | operator=(__conditional_t<is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value, |
| 226 | pair, | 221 | pair, |
| 227 | __nat> const& __p) noexcept(is_nothrow_copy_assignable<first_type>::value && | 222 | __nat> const& __p) noexcept(is_nothrow_copy_assignable<first_type>::value && |
| ... | @@ -231,7 +226,7 @@ struct pair | ... | @@ -231,7 +226,7 @@ struct pair |
| 231 | return *this; | 226 | return *this; |
| 232 | } | 227 | } |
| 233 | 228 | ||
| 234 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=( | 229 | _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=( |
| 235 | __conditional_t<is_move_assignable<first_type>::value && is_move_assignable<second_type>::value, pair, __nat>&& | 230 | __conditional_t<is_move_assignable<first_type>::value && is_move_assignable<second_type>::value, pair, __nat>&& |
| 236 | __p) noexcept(is_nothrow_move_assignable<first_type>::value && | 231 | __p) noexcept(is_nothrow_move_assignable<first_type>::value && |
| 237 | is_nothrow_move_assignable<second_type>::value) { | 232 | is_nothrow_move_assignable<second_type>::value) { |
| ... | @@ -245,7 +240,7 @@ struct pair | ... | @@ -245,7 +240,7 @@ struct pair |
| 245 | class _U2, | 240 | class _U2, |
| 246 | __enable_if_t<is_assignable<first_type&, _U1 const&>::value && is_assignable<second_type&, _U2 const&>::value, | 241 | __enable_if_t<is_assignable<first_type&, _U1 const&>::value && is_assignable<second_type&, _U2 const&>::value, |
| 247 | int> = 0> | 242 | int> = 0> |
| 248 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2> const& __p) { | 243 | _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2> const& __p) { |
| 249 | first = __p.first; | 244 | first = __p.first; |
| 250 | second = __p.second; | 245 | second = __p.second; |
| 251 | return *this; | 246 | return *this; |
| ... | @@ -254,7 +249,7 @@ struct pair | ... | @@ -254,7 +249,7 @@ struct pair |
| 254 | template <class _U1, | 249 | template <class _U1, |
| 255 | class _U2, | 250 | class _U2, |
| 256 | __enable_if_t<is_assignable<first_type&, _U1>::value && is_assignable<second_type&, _U2>::value, int> = 0> | 251 | __enable_if_t<is_assignable<first_type&, _U1>::value && is_assignable<second_type&, _U2>::value, int> = 0> |
| 257 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2>&& __p) { | 252 | _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2>&& __p) { |
| 258 | first = std::forward<_U1>(__p.first); | 253 | first = std::forward<_U1>(__p.first); |
| 259 | second = std::forward<_U2>(__p.second); | 254 | second = std::forward<_U2>(__p.second); |
| 260 | return *this; | 255 | return *this; |
| ... | @@ -262,7 +257,7 @@ struct pair | ... | @@ -262,7 +257,7 @@ struct pair |
| 262 | 257 | ||
| 263 | # if _LIBCPP_STD_VER >= 23 | 258 | # if _LIBCPP_STD_VER >= 23 |
| 264 | template <class = void> | 259 | template <class = void> |
| 265 | _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair const& __p) const | 260 | constexpr const pair& operator=(pair const& __p) const |
| 266 | noexcept(is_nothrow_copy_assignable_v<const first_type> && is_nothrow_copy_assignable_v<const second_type>) | 261 | noexcept(is_nothrow_copy_assignable_v<const first_type> && is_nothrow_copy_assignable_v<const second_type>) |
| 267 | requires(is_copy_assignable_v<const first_type> && is_copy_assignable_v<const second_type>) | 262 | requires(is_copy_assignable_v<const first_type> && is_copy_assignable_v<const second_type>) |
| 268 | { | 263 | { |
| ... | @@ -272,7 +267,7 @@ struct pair | ... | @@ -272,7 +267,7 @@ struct pair |
| 272 | } | 267 | } |
| 273 | 268 | ||
| 274 | template <class = void> | 269 | template <class = void> |
| 275 | _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair&& __p) const | 270 | constexpr const pair& operator=(pair&& __p) const |
| 276 | noexcept(is_nothrow_assignable_v<const first_type&, first_type> && | 271 | noexcept(is_nothrow_assignable_v<const first_type&, first_type> && |
| 277 | is_nothrow_assignable_v<const second_type&, second_type>) | 272 | is_nothrow_assignable_v<const second_type&, second_type>) |
| 278 | requires(is_assignable_v<const first_type&, first_type> && is_assignable_v<const second_type&, second_type>) | 273 | requires(is_assignable_v<const first_type&, first_type> && is_assignable_v<const second_type&, second_type>) |
| ... | @@ -283,7 +278,7 @@ struct pair | ... | @@ -283,7 +278,7 @@ struct pair |
| 283 | } | 278 | } |
| 284 | 279 | ||
| 285 | template <class _U1, class _U2> | 280 | template <class _U1, class _U2> |
| 286 | _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(const pair<_U1, _U2>& __p) const | 281 | constexpr const pair& operator=(const pair<_U1, _U2>& __p) const |
| 287 | requires(is_assignable_v<const first_type&, const _U1&> && is_assignable_v<const second_type&, const _U2&>) | 282 | requires(is_assignable_v<const first_type&, const _U1&> && is_assignable_v<const second_type&, const _U2&>) |
| 288 | { | 283 | { |
| 289 | first = __p.first; | 284 | first = __p.first; |
| ... | @@ -292,7 +287,7 @@ struct pair | ... | @@ -292,7 +287,7 @@ struct pair |
| 292 | } | 287 | } |
| 293 | 288 | ||
| 294 | template <class _U1, class _U2> | 289 | template <class _U1, class _U2> |
| 295 | _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair<_U1, _U2>&& __p) const | 290 | constexpr const pair& operator=(pair<_U1, _U2>&& __p) const |
| 296 | requires(is_assignable_v<const first_type&, _U1> && is_assignable_v<const second_type&, _U2>) | 291 | requires(is_assignable_v<const first_type&, _U1> && is_assignable_v<const second_type&, _U2>) |
| 297 | { | 292 | { |
| 298 | first = std::forward<_U1>(__p.first); | 293 | first = std::forward<_U1>(__p.first); |
| ... | @@ -304,7 +299,7 @@ struct pair | ... | @@ -304,7 +299,7 @@ struct pair |
| 304 | requires(__different_from<_PairLike, pair> && | 299 | requires(__different_from<_PairLike, pair> && |
| 305 | is_assignable_v<first_type&, decltype(std::get<0>(std::declval<_PairLike>()))> && | 300 | is_assignable_v<first_type&, decltype(std::get<0>(std::declval<_PairLike>()))> && |
| 306 | is_assignable_v<second_type&, decltype(std::get<1>(std::declval<_PairLike>()))>) | 301 | is_assignable_v<second_type&, decltype(std::get<1>(std::declval<_PairLike>()))>) |
| 307 | _LIBCPP_HIDE_FROM_ABI constexpr pair& operator=(_PairLike&& __p) { | 302 | constexpr pair& operator=(_PairLike&& __p) { |
| 308 | first = std::get<0>(std::forward<_PairLike>(__p)); | 303 | first = std::get<0>(std::forward<_PairLike>(__p)); |
| 309 | second = std::get<1>(std::forward<_PairLike>(__p)); | 304 | second = std::get<1>(std::forward<_PairLike>(__p)); |
| 310 | return *this; | 305 | return *this; |
| ... | @@ -314,7 +309,7 @@ struct pair | ... | @@ -314,7 +309,7 @@ struct pair |
| 314 | requires(__different_from<_PairLike, pair> && | 309 | requires(__different_from<_PairLike, pair> && |
| 315 | is_assignable_v<first_type const&, decltype(std::get<0>(std::declval<_PairLike>()))> && | 310 | is_assignable_v<first_type const&, decltype(std::get<0>(std::declval<_PairLike>()))> && |
| 316 | is_assignable_v<second_type const&, decltype(std::get<1>(std::declval<_PairLike>()))>) | 311 | is_assignable_v<second_type const&, decltype(std::get<1>(std::declval<_PairLike>()))>) |
| 317 | _LIBCPP_HIDE_FROM_ABI constexpr pair const& operator=(_PairLike&& __p) const { | 312 | constexpr pair const& operator=(_PairLike&& __p) const { |
| 318 | first = std::get<0>(std::forward<_PairLike>(__p)); | 313 | first = std::get<0>(std::forward<_PairLike>(__p)); |
| 319 | second = std::get<1>(std::forward<_PairLike>(__p)); | 314 | second = std::get<1>(std::forward<_PairLike>(__p)); |
| 320 | return *this; | 315 | return *this; |
| ... | @@ -328,34 +323,33 @@ struct pair | ... | @@ -328,34 +323,33 @@ struct pair |
| 328 | template <class _U1, | 323 | template <class _U1, |
| 329 | class _U2, | 324 | class _U2, |
| 330 | __enable_if_t<is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value, int> = 0> | 325 | __enable_if_t<is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value, int> = 0> |
| 331 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2> const& __p) | 326 | _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2> const& __p) : first(std::get<0>(__p)), second(std::get<1>(__p)) {} |
| 332 | : first(std::get<0>(__p)), second(std::get<1>(__p)) {} | ||
| 333 | 327 | ||
| 334 | template < class _U1, | 328 | template < class _U1, |
| 335 | class _U2, | 329 | class _U2, |
| 336 | __enable_if_t<is_constructible<_T1, _U1 const&>::value && is_constructible<_T2, _U2 const&>::value && | 330 | __enable_if_t<is_constructible<_T1, _U1 const&>::value && is_constructible<_T2, _U2 const&>::value && |
| 337 | !(is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value), | 331 | !(is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value), |
| 338 | int> = 0> | 332 | int> = 0> |
| 339 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2> const& __p) | 333 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2> const& __p) |
| 340 | : first(std::get<0>(__p)), second(std::get<1>(__p)) {} | 334 | : first(std::get<0>(__p)), second(std::get<1>(__p)) {} |
| 341 | 335 | ||
| 342 | template <class _U1, | 336 | template <class _U1, |
| 343 | class _U2, | 337 | class _U2, |
| 344 | __enable_if_t<is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value, int> = 0> | 338 | __enable_if_t<is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value, int> = 0> |
| 345 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2>&& __p) | 339 | _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2>&& __p) |
| 346 | : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {} | 340 | : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {} |
| 347 | 341 | ||
| 348 | template <class _U1, | 342 | template <class _U1, |
| 349 | class _U2, | 343 | class _U2, |
| 350 | __enable_if_t<is_constructible<_T1, _U1>::value && is_constructible<_T2, _U2>::value && | 344 | __enable_if_t<is_constructible<_T1, _U1>::value && is_constructible<_T2, _U2>::value && |
| 351 | !(is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value) > = 0> | 345 | !(is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value) > = 0> |
| 352 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2>&& __p) | 346 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2>&& __p) |
| 353 | : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {} | 347 | : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {} |
| 354 | 348 | ||
| 355 | template <class _U1, | 349 | template <class _U1, |
| 356 | class _U2, | 350 | class _U2, |
| 357 | __enable_if_t<is_assignable<_T1&, _U1 const&>::value && is_assignable<_T2&, _U2 const&>::value, int> = 0> | 351 | __enable_if_t<is_assignable<_T1&, _U1 const&>::value && is_assignable<_T2&, _U2 const&>::value, int> = 0> |
| 358 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2> const& __p) { | 352 | _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2> const& __p) { |
| 359 | first = std::get<0>(__p); | 353 | first = std::get<0>(__p); |
| 360 | second = std::get<1>(__p); | 354 | second = std::get<1>(__p); |
| 361 | return *this; | 355 | return *this; |
| ... | @@ -364,7 +358,7 @@ struct pair | ... | @@ -364,7 +358,7 @@ struct pair |
| 364 | template <class _U1, | 358 | template <class _U1, |
| 365 | class _U2, | 359 | class _U2, |
| 366 | __enable_if_t<is_assignable<_T1&, _U1&&>::value && is_assignable<_T2&, _U2&&>::value, int> = 0> | 360 | __enable_if_t<is_assignable<_T1&, _U1&&>::value && is_assignable<_T2&, _U2&&>::value, int> = 0> |
| 367 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2>&& __p) { | 361 | _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2>&& __p) { |
| 368 | first = std::get<0>(std::move(__p)); | 362 | first = std::get<0>(std::move(__p)); |
| 369 | second = std::get<1>(std::move(__p)); | 363 | second = std::get<1>(std::move(__p)); |
| 370 | return *this; | 364 | return *this; |
| ... | @@ -373,36 +367,34 @@ struct pair | ... | @@ -373,36 +367,34 @@ struct pair |
| 373 | // from std::array | 367 | // from std::array |
| 374 | template <class _Up, | 368 | template <class _Up, |
| 375 | __enable_if_t<is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value, int> = 0> | 369 | __enable_if_t<is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value, int> = 0> |
| 376 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2> const& __p) : first(__p[0]), second(__p[1]) {} | 370 | _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2> const& __p) : first(__p[0]), second(__p[1]) {} |
| 377 | 371 | ||
| 378 | template <class _Up, | 372 | template <class _Up, |
| 379 | __enable_if_t<is_constructible<_T1, _Up const&>::value && is_constructible<_T2, _Up const&>::value && | 373 | __enable_if_t<is_constructible<_T1, _Up const&>::value && is_constructible<_T2, _Up const&>::value && |
| 380 | !(is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value), | 374 | !(is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value), |
| 381 | int> = 0> | 375 | int> = 0> |
| 382 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2> const& __p) | 376 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2> const& __p) : first(__p[0]), second(__p[1]) {} |
| 383 | : first(__p[0]), second(__p[1]) {} | ||
| 384 | 377 | ||
| 385 | template <class _Up, __enable_if_t< is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value, int> = 0> | 378 | template <class _Up, __enable_if_t< is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value, int> = 0> |
| 386 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2>&& __p) | 379 | _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2>&& __p) : first(std::move(__p)[0]), second(std::move(__p)[1]) {} |
| 387 | : first(std::move(__p)[0]), second(std::move(__p)[1]) {} | ||
| 388 | 380 | ||
| 389 | template <class _Up, | 381 | template <class _Up, |
| 390 | __enable_if_t<is_constructible<_T1, _Up>::value && is_constructible<_T2, _Up>::value && | 382 | __enable_if_t<is_constructible<_T1, _Up>::value && is_constructible<_T2, _Up>::value && |
| 391 | !(is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value), | 383 | !(is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value), |
| 392 | int> = 0> | 384 | int> = 0> |
| 393 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2>&& __p) | 385 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2>&& __p) |
| 394 | : first(std::move(__p)[0]), second(std::move(__p)[1]) {} | 386 | : first(std::move(__p)[0]), second(std::move(__p)[1]) {} |
| 395 | 387 | ||
| 396 | template <class _Up, | 388 | template <class _Up, |
| 397 | __enable_if_t<is_assignable<_T1&, _Up const&>::value && is_assignable<_T2&, _Up const&>::value, int> = 0> | 389 | __enable_if_t<is_assignable<_T1&, _Up const&>::value && is_assignable<_T2&, _Up const&>::value, int> = 0> |
| 398 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2> const& __p) { | 390 | _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2> const& __p) { |
| 399 | first = std::get<0>(__p); | 391 | first = std::get<0>(__p); |
| 400 | second = std::get<1>(__p); | 392 | second = std::get<1>(__p); |
| 401 | return *this; | 393 | return *this; |
| 402 | } | 394 | } |
| 403 | 395 | ||
| 404 | template <class _Up, __enable_if_t<is_assignable<_T1&, _Up>::value && is_assignable<_T2&, _Up>::value, int> = 0> | 396 | template <class _Up, __enable_if_t<is_assignable<_T1&, _Up>::value && is_assignable<_T2&, _Up>::value, int> = 0> |
| 405 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2>&& __p) { | 397 | _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2>&& __p) { |
| 406 | first = std::get<0>(std::move(__p)); | 398 | first = std::get<0>(std::move(__p)); |
| 407 | second = std::get<1>(std::move(__p)); | 399 | second = std::get<1>(std::move(__p)); |
| 408 | return *this; | 400 | return *this; |
| ... | @@ -410,7 +402,7 @@ struct pair | ... | @@ -410,7 +402,7 @@ struct pair |
| 410 | # endif // _LIBCPP_STD_VER < 23 | 402 | # endif // _LIBCPP_STD_VER < 23 |
| 411 | #endif // _LIBCPP_CXX03_LANG | 403 | #endif // _LIBCPP_CXX03_LANG |
| 412 | 404 | ||
| 413 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair& __p) | 405 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair& __p) |
| 414 | _NOEXCEPT_(__is_nothrow_swappable_v<first_type>&& __is_nothrow_swappable_v<second_type>) { | 406 | _NOEXCEPT_(__is_nothrow_swappable_v<first_type>&& __is_nothrow_swappable_v<second_type>) { |
| 415 | using std::swap; | 407 | using std::swap; |
| 416 | swap(first, __p.first); | 408 | swap(first, __p.first); |
| ... | @@ -418,7 +410,7 @@ struct pair | ... | @@ -418,7 +410,7 @@ struct pair |
| 418 | } | 410 | } |
| 419 | 411 | ||
| 420 | #if _LIBCPP_STD_VER >= 23 | 412 | #if _LIBCPP_STD_VER >= 23 |
| 421 | _LIBCPP_HIDE_FROM_ABI constexpr void swap(const pair& __p) const | 413 | constexpr void swap(const pair& __p) const |
| 422 | noexcept(__is_nothrow_swappable_v<const first_type> && __is_nothrow_swappable_v<const second_type>) { | 414 | noexcept(__is_nothrow_swappable_v<const first_type> && __is_nothrow_swappable_v<const second_type>) { |
| 423 | using std::swap; | 415 | using std::swap; |
| 424 | swap(first, __p.first); | 416 | swap(first, __p.first); |
| ... | @@ -429,7 +421,7 @@ struct pair | ... | @@ -429,7 +421,7 @@ struct pair |
| 429 | private: | 421 | private: |
| 430 | #ifndef _LIBCPP_CXX03_LANG | 422 | #ifndef _LIBCPP_CXX03_LANG |
| 431 | template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2> | 423 | template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2> |
| 432 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | 424 | _LIBCPP_CONSTEXPR_SINCE_CXX20 |
| 433 | pair(piecewise_construct_t, | 425 | pair(piecewise_construct_t, |
| 434 | tuple<_Args1...>& __first_args, | 426 | tuple<_Args1...>& __first_args, |
| 435 | tuple<_Args2...>& __second_args, | 427 | tuple<_Args2...>& __second_args, |
| ... | @@ -448,8 +440,7 @@ pair(_T1, _T2) -> pair<_T1, _T2>; | ... | @@ -448,8 +440,7 @@ pair(_T1, _T2) -> pair<_T1, _T2>; |
| 448 | // [pairs.spec], specialized algorithms | 440 | // [pairs.spec], specialized algorithms |
| 449 | 441 | ||
| 450 | template <class _T1, class _T2, class _U1, class _U2> | 442 | template <class _T1, class _T2, class _U1, class _U2> |
| 451 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool | 443 | inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) |
| 452 | operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) | ||
| 453 | #if _LIBCPP_STD_VER >= 26 | 444 | #if _LIBCPP_STD_VER >= 26 |
| 454 | requires requires { | 445 | requires requires { |
| 455 | { __x.first == __y.first } -> __boolean_testable; | 446 | { __x.first == __y.first } -> __boolean_testable; |
| ... | @@ -463,8 +454,7 @@ operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) | ... | @@ -463,8 +454,7 @@ operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) |
| 463 | #if _LIBCPP_STD_VER >= 20 | 454 | #if _LIBCPP_STD_VER >= 20 |
| 464 | 455 | ||
| 465 | template <class _T1, class _T2, class _U1, class _U2> | 456 | template <class _T1, class _T2, class _U1, class _U2> |
| 466 | _LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t< __synth_three_way_result<_T1, _U1>, | 457 | constexpr common_comparison_category_t< __synth_three_way_result<_T1, _U1>, __synth_three_way_result<_T2, _U2> > |
| 467 | __synth_three_way_result<_T2, _U2> > | ||
| 468 | operator<=>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { | 458 | operator<=>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { |
| 469 | if (auto __c = std::__synth_three_way(__x.first, __y.first); __c != 0) { | 459 | if (auto __c = std::__synth_three_way(__x.first, __y.first); __c != 0) { |
| 470 | return __c; | 460 | return __c; |
| ... | @@ -475,32 +465,27 @@ operator<=>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { | ... | @@ -475,32 +465,27 @@ operator<=>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { |
| 475 | #else // _LIBCPP_STD_VER >= 20 | 465 | #else // _LIBCPP_STD_VER >= 20 |
| 476 | 466 | ||
| 477 | template <class _T1, class _T2, class _U1, class _U2> | 467 | template <class _T1, class _T2, class _U1, class _U2> |
| 478 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool | 468 | inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator!=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { |
| 479 | operator!=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { | ||
| 480 | return !(__x == __y); | 469 | return !(__x == __y); |
| 481 | } | 470 | } |
| 482 | 471 | ||
| 483 | template <class _T1, class _T2, class _U1, class _U2> | 472 | template <class _T1, class _T2, class _U1, class _U2> |
| 484 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool | 473 | inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator<(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { |
| 485 | operator<(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { | ||
| 486 | return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second); | 474 | return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second); |
| 487 | } | 475 | } |
| 488 | 476 | ||
| 489 | template <class _T1, class _T2, class _U1, class _U2> | 477 | template <class _T1, class _T2, class _U1, class _U2> |
| 490 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool | 478 | inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { |
| 491 | operator>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { | ||
| 492 | return __y < __x; | 479 | return __y < __x; |
| 493 | } | 480 | } |
| 494 | 481 | ||
| 495 | template <class _T1, class _T2, class _U1, class _U2> | 482 | template <class _T1, class _T2, class _U1, class _U2> |
| 496 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool | 483 | inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator>=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { |
| 497 | operator>=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { | ||
| 498 | return !(__x < __y); | 484 | return !(__x < __y); |
| 499 | } | 485 | } |
| 500 | 486 | ||
| 501 | template <class _T1, class _T2, class _U1, class _U2> | 487 | template <class _T1, class _T2, class _U1, class _U2> |
| 502 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool | 488 | inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator<=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { |
| 503 | operator<=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) { | ||
| 504 | return !(__y < __x); | 489 | return !(__y < __x); |
| 505 | } | 490 | } |
| 506 | 491 | ||
| ... | @@ -524,7 +509,7 @@ struct common_type<pair<_T1, _T2>, pair<_U1, _U2>> { | ... | @@ -524,7 +509,7 @@ struct common_type<pair<_T1, _T2>, pair<_U1, _U2>> { |
| 524 | #endif // _LIBCPP_STD_VER >= 23 | 509 | #endif // _LIBCPP_STD_VER >= 23 |
| 525 | 510 | ||
| 526 | template <class _T1, class _T2, __enable_if_t<__is_swappable_v<_T1> && __is_swappable_v<_T2>, int> = 0> | 511 | template <class _T1, class _T2, __enable_if_t<__is_swappable_v<_T1> && __is_swappable_v<_T2>, int> = 0> |
| 527 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | 512 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) |
| 528 | _NOEXCEPT_(__is_nothrow_swappable_v<_T1>&& __is_nothrow_swappable_v<_T2>) { | 513 | _NOEXCEPT_(__is_nothrow_swappable_v<_T1>&& __is_nothrow_swappable_v<_T2>) { |
| 529 | __x.swap(__y); | 514 | __x.swap(__y); |
| 530 | } | 515 | } |
| ... | @@ -532,15 +517,14 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair<_T1, _ | ... | @@ -532,15 +517,14 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair<_T1, _ |
| 532 | #if _LIBCPP_STD_VER >= 23 | 517 | #if _LIBCPP_STD_VER >= 23 |
| 533 | template <class _T1, class _T2> | 518 | template <class _T1, class _T2> |
| 534 | requires(__is_swappable_v<const _T1> && __is_swappable_v<const _T2>) | 519 | requires(__is_swappable_v<const _T1> && __is_swappable_v<const _T2>) |
| 535 | _LIBCPP_HIDE_FROM_ABI constexpr void | 520 | constexpr void swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) noexcept(noexcept(__x.swap(__y))) { |
| 536 | swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) noexcept(noexcept(__x.swap(__y))) { | ||
| 537 | __x.swap(__y); | 521 | __x.swap(__y); |
| 538 | } | 522 | } |
| 539 | #endif | 523 | #endif |
| 540 | 524 | ||
| 541 | template <class _T1, class _T2> | 525 | template <class _T1, class _T2> |
| 542 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | 526 | [[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<__unwrap_ref_decay_t<_T1>, __unwrap_ref_decay_t<_T2> > |
| 543 | pair<__unwrap_ref_decay_t<_T1>, __unwrap_ref_decay_t<_T2> > make_pair(_T1&& __t1, _T2&& __t2) { | 527 | make_pair(_T1&& __t1, _T2&& __t2) { |
| 544 | return pair<__unwrap_ref_decay_t<_T1>, __unwrap_ref_decay_t<_T2> >(std::forward<_T1>(__t1), std::forward<_T2>(__t2)); | 528 | return pair<__unwrap_ref_decay_t<_T1>, __unwrap_ref_decay_t<_T2> >(std::forward<_T1>(__t1), std::forward<_T2>(__t2)); |
| 545 | } | 529 | } |
| 546 | 530 | ||
| ... | @@ -568,22 +552,22 @@ struct __get_pair; | ... | @@ -568,22 +552,22 @@ struct __get_pair; |
| 568 | template <> | 552 | template <> |
| 569 | struct __get_pair<0> { | 553 | struct __get_pair<0> { |
| 570 | template <class _T1, class _T2> | 554 | template <class _T1, class _T2> |
| 571 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT { | 555 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT { |
| 572 | return __p.first; | 556 | return __p.first; |
| 573 | } | 557 | } |
| 574 | 558 | ||
| 575 | template <class _T1, class _T2> | 559 | template <class _T1, class _T2> |
| 576 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1& get(const pair<_T1, _T2>& __p) _NOEXCEPT { | 560 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1& get(const pair<_T1, _T2>& __p) _NOEXCEPT { |
| 577 | return __p.first; | 561 | return __p.first; |
| 578 | } | 562 | } |
| 579 | 563 | ||
| 580 | template <class _T1, class _T2> | 564 | template <class _T1, class _T2> |
| 581 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT { | 565 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT { |
| 582 | return std::forward<_T1>(__p.first); | 566 | return std::forward<_T1>(__p.first); |
| 583 | } | 567 | } |
| 584 | 568 | ||
| 585 | template <class _T1, class _T2> | 569 | template <class _T1, class _T2> |
| 586 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT { | 570 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT { |
| 587 | return std::forward<const _T1>(__p.first); | 571 | return std::forward<const _T1>(__p.first); |
| 588 | } | 572 | } |
| 589 | }; | 573 | }; |
| ... | @@ -591,92 +575,88 @@ struct __get_pair<0> { | ... | @@ -591,92 +575,88 @@ struct __get_pair<0> { |
| 591 | template <> | 575 | template <> |
| 592 | struct __get_pair<1> { | 576 | struct __get_pair<1> { |
| 593 | template <class _T1, class _T2> | 577 | template <class _T1, class _T2> |
| 594 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT { | 578 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT { |
| 595 | return __p.second; | 579 | return __p.second; |
| 596 | } | 580 | } |
| 597 | 581 | ||
| 598 | template <class _T1, class _T2> | 582 | template <class _T1, class _T2> |
| 599 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2& get(const pair<_T1, _T2>& __p) _NOEXCEPT { | 583 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2& get(const pair<_T1, _T2>& __p) _NOEXCEPT { |
| 600 | return __p.second; | 584 | return __p.second; |
| 601 | } | 585 | } |
| 602 | 586 | ||
| 603 | template <class _T1, class _T2> | 587 | template <class _T1, class _T2> |
| 604 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT { | 588 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT { |
| 605 | return std::forward<_T2>(__p.second); | 589 | return std::forward<_T2>(__p.second); |
| 606 | } | 590 | } |
| 607 | 591 | ||
| 608 | template <class _T1, class _T2> | 592 | template <class _T1, class _T2> |
| 609 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT { | 593 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT { |
| 610 | return std::forward<const _T2>(__p.second); | 594 | return std::forward<const _T2>(__p.second); |
| 611 | } | 595 | } |
| 612 | }; | 596 | }; |
| 613 | 597 | ||
| 614 | template <size_t _Ip, class _T1, class _T2> | 598 | template <size_t _Ip, class _T1, class _T2> |
| 615 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | 599 | [[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type& |
| 616 | typename tuple_element<_Ip, pair<_T1, _T2> >::type& | ||
| 617 | get(pair<_T1, _T2>& __p) _NOEXCEPT { | 600 | get(pair<_T1, _T2>& __p) _NOEXCEPT { |
| 618 | return __get_pair<_Ip>::get(__p); | 601 | return __get_pair<_Ip>::get(__p); |
| 619 | } | 602 | } |
| 620 | 603 | ||
| 621 | template <size_t _Ip, class _T1, class _T2> | 604 | template <size_t _Ip, class _T1, class _T2> |
| 622 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI | 605 | [[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& |
| 623 | _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& | ||
| 624 | get(const pair<_T1, _T2>& __p) _NOEXCEPT { | 606 | get(const pair<_T1, _T2>& __p) _NOEXCEPT { |
| 625 | return __get_pair<_Ip>::get(__p); | 607 | return __get_pair<_Ip>::get(__p); |
| 626 | } | 608 | } |
| 627 | 609 | ||
| 628 | template <size_t _Ip, class _T1, class _T2> | 610 | template <size_t _Ip, class _T1, class _T2> |
| 629 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | 611 | [[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& |
| 630 | typename tuple_element<_Ip, pair<_T1, _T2> >::type&& | ||
| 631 | get(pair<_T1, _T2>&& __p) _NOEXCEPT { | 612 | get(pair<_T1, _T2>&& __p) _NOEXCEPT { |
| 632 | return __get_pair<_Ip>::get(std::move(__p)); | 613 | return __get_pair<_Ip>::get(std::move(__p)); |
| 633 | } | 614 | } |
| 634 | 615 | ||
| 635 | template <size_t _Ip, class _T1, class _T2> | 616 | template <size_t _Ip, class _T1, class _T2> |
| 636 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI | 617 | [[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& |
| 637 | _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& | ||
| 638 | get(const pair<_T1, _T2>&& __p) _NOEXCEPT { | 618 | get(const pair<_T1, _T2>&& __p) _NOEXCEPT { |
| 639 | return __get_pair<_Ip>::get(std::move(__p)); | 619 | return __get_pair<_Ip>::get(std::move(__p)); |
| 640 | } | 620 | } |
| 641 | 621 | ||
| 642 | #if _LIBCPP_STD_VER >= 14 | 622 | #if _LIBCPP_STD_VER >= 14 |
| 643 | template <class _T1, class _T2> | 623 | template <class _T1, class _T2> |
| 644 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT { | 624 | [[__nodiscard__]] inline constexpr _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT { |
| 645 | return __p.first; | 625 | return __p.first; |
| 646 | } | 626 | } |
| 647 | 627 | ||
| 648 | template <class _T1, class _T2> | 628 | template <class _T1, class _T2> |
| 649 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT { | 629 | [[__nodiscard__]] inline constexpr _T1 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT { |
| 650 | return __p.first; | 630 | return __p.first; |
| 651 | } | 631 | } |
| 652 | 632 | ||
| 653 | template <class _T1, class _T2> | 633 | template <class _T1, class _T2> |
| 654 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT { | 634 | [[__nodiscard__]] inline constexpr _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT { |
| 655 | return std::forward<_T1&&>(__p.first); | 635 | return std::forward<_T1&&>(__p.first); |
| 656 | } | 636 | } |
| 657 | 637 | ||
| 658 | template <class _T1, class _T2> | 638 | template <class _T1, class _T2> |
| 659 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT { | 639 | [[__nodiscard__]] inline constexpr _T1 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT { |
| 660 | return std::forward<_T1 const&&>(__p.first); | 640 | return std::forward<_T1 const&&>(__p.first); |
| 661 | } | 641 | } |
| 662 | 642 | ||
| 663 | template <class _T2, class _T1> | 643 | template <class _T2, class _T1> |
| 664 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT { | 644 | [[__nodiscard__]] inline constexpr _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT { |
| 665 | return __p.second; | 645 | return __p.second; |
| 666 | } | 646 | } |
| 667 | 647 | ||
| 668 | template <class _T2, class _T1> | 648 | template <class _T2, class _T1> |
| 669 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT { | 649 | [[__nodiscard__]] inline constexpr _T2 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT { |
| 670 | return __p.second; | 650 | return __p.second; |
| 671 | } | 651 | } |
| 672 | 652 | ||
| 673 | template <class _T2, class _T1> | 653 | template <class _T2, class _T1> |
| 674 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT { | 654 | [[__nodiscard__]] inline constexpr _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT { |
| 675 | return std::forward<_T2&&>(__p.second); | 655 | return std::forward<_T2&&>(__p.second); |
| 676 | } | 656 | } |
| 677 | 657 | ||
| 678 | template <class _T2, class _T1> | 658 | template <class _T2, class _T1> |
| 679 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT { | 659 | [[__nodiscard__]] inline constexpr _T2 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT { |
| 680 | return std::forward<_T2 const&&>(__p.second); | 660 | return std::forward<_T2 const&&>(__p.second); |
| 681 | } | 661 | } |
| 682 | 662 |
lib/libcxx/include/__utility/try_key_extraction.h+6-6| ... | @@ -28,7 +28,7 @@ | ... | @@ -28,7 +28,7 @@ |
| 28 | _LIBCPP_BEGIN_NAMESPACE_STD | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | ||
| 30 | template <class _KeyT, class _Ret, class _WithKey, class _WithoutKey, class... _Args> | 30 | template <class _KeyT, class _Ret, class _WithKey, class _WithoutKey, class... _Args> |
| 31 | _LIBCPP_HIDE_FROM_ABI _Ret | 31 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Ret |
| 32 | __try_key_extraction_impl(__priority_tag<0>, _WithKey, _WithoutKey __without_key, _Args&&... __args) { | 32 | __try_key_extraction_impl(__priority_tag<0>, _WithKey, _WithoutKey __without_key, _Args&&... __args) { |
| 33 | return __without_key(std::forward<_Args>(__args)...); | 33 | return __without_key(std::forward<_Args>(__args)...); |
| 34 | } | 34 | } |
| ... | @@ -39,7 +39,7 @@ template <class _KeyT, | ... | @@ -39,7 +39,7 @@ template <class _KeyT, |
| 39 | class _WithoutKey, | 39 | class _WithoutKey, |
| 40 | class _Arg, | 40 | class _Arg, |
| 41 | __enable_if_t<is_same<_KeyT, __remove_const_ref_t<_Arg> >::value, int> = 0> | 41 | __enable_if_t<is_same<_KeyT, __remove_const_ref_t<_Arg> >::value, int> = 0> |
| 42 | _LIBCPP_HIDE_FROM_ABI _Ret | 42 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Ret |
| 43 | __try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg&& __arg) { | 43 | __try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg&& __arg) { |
| 44 | return __with_key(__arg, std::forward<_Arg>(__arg)); | 44 | return __with_key(__arg, std::forward<_Arg>(__arg)); |
| 45 | } | 45 | } |
| ... | @@ -52,7 +52,7 @@ template <class _KeyT, | ... | @@ -52,7 +52,7 @@ template <class _KeyT, |
| 52 | __enable_if_t<__is_pair_v<__remove_const_ref_t<_Arg> > && | 52 | __enable_if_t<__is_pair_v<__remove_const_ref_t<_Arg> > && |
| 53 | is_same<__remove_const_t<typename __remove_const_ref_t<_Arg>::first_type>, _KeyT>::value, | 53 | is_same<__remove_const_t<typename __remove_const_ref_t<_Arg>::first_type>, _KeyT>::value, |
| 54 | int> = 0> | 54 | int> = 0> |
| 55 | _LIBCPP_HIDE_FROM_ABI _Ret | 55 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Ret |
| 56 | __try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg&& __arg) { | 56 | __try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg&& __arg) { |
| 57 | return __with_key(__arg.first, std::forward<_Arg>(__arg)); | 57 | return __with_key(__arg.first, std::forward<_Arg>(__arg)); |
| 58 | } | 58 | } |
| ... | @@ -64,7 +64,7 @@ template <class _KeyT, | ... | @@ -64,7 +64,7 @@ template <class _KeyT, |
| 64 | class _Arg1, | 64 | class _Arg1, |
| 65 | class _Arg2, | 65 | class _Arg2, |
| 66 | __enable_if_t<is_same<_KeyT, __remove_const_ref_t<_Arg1> >::value, int> = 0> | 66 | __enable_if_t<is_same<_KeyT, __remove_const_ref_t<_Arg1> >::value, int> = 0> |
| 67 | _LIBCPP_HIDE_FROM_ABI _Ret | 67 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Ret |
| 68 | __try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg1&& __arg1, _Arg2&& __arg2) { | 68 | __try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg1&& __arg1, _Arg2&& __arg2) { |
| 69 | return __with_key(__arg1, std::forward<_Arg1>(__arg1), std::forward<_Arg2>(__arg2)); | 69 | return __with_key(__arg1, std::forward<_Arg1>(__arg1), std::forward<_Arg2>(__arg2)); |
| 70 | } | 70 | } |
| ... | @@ -81,7 +81,7 @@ template <class _KeyT, | ... | @@ -81,7 +81,7 @@ template <class _KeyT, |
| 81 | __is_tuple_v<_Tuple1> && tuple_size<_Tuple1>::value == 1 && | 81 | __is_tuple_v<_Tuple1> && tuple_size<_Tuple1>::value == 1 && |
| 82 | is_same<__remove_const_ref_t<typename tuple_element<0, _Tuple1>::type>, _KeyT>::value, | 82 | is_same<__remove_const_ref_t<typename tuple_element<0, _Tuple1>::type>, _KeyT>::value, |
| 83 | int> = 0> | 83 | int> = 0> |
| 84 | _LIBCPP_HIDE_FROM_ABI _Ret __try_key_extraction_impl( | 84 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Ret __try_key_extraction_impl( |
| 85 | __priority_tag<1>, | 85 | __priority_tag<1>, |
| 86 | _WithKey __with_key, | 86 | _WithKey __with_key, |
| 87 | _WithoutKey, | 87 | _WithoutKey, |
| ... | @@ -102,7 +102,7 @@ _LIBCPP_HIDE_FROM_ABI _Ret __try_key_extraction_impl( | ... | @@ -102,7 +102,7 @@ _LIBCPP_HIDE_FROM_ABI _Ret __try_key_extraction_impl( |
| 102 | // | 102 | // |
| 103 | // Both `__with_key` and `__without_key` must take all arguments by reference. | 103 | // Both `__with_key` and `__without_key` must take all arguments by reference. |
| 104 | template <class _KeyT, class _WithKey, class _WithoutKey, class... _Args> | 104 | template <class _KeyT, class _WithKey, class _WithoutKey, class... _Args> |
| 105 | _LIBCPP_HIDE_FROM_ABI decltype(std::declval<_WithoutKey>()(std::declval<_Args>()...)) | 105 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 decltype(std::declval<_WithoutKey>()(std::declval<_Args>()...)) |
| 106 | __try_key_extraction(_WithKey __with_key, _WithoutKey __without_key, _Args&&... __args) { | 106 | __try_key_extraction(_WithKey __with_key, _WithoutKey __without_key, _Args&&... __args) { |
| 107 | using _Ret = decltype(__without_key(std::forward<_Args>(__args)...)); | 107 | using _Ret = decltype(__without_key(std::forward<_Args>(__args)...)); |
| 108 | return std::__try_key_extraction_impl<_KeyT, _Ret>( | 108 | return std::__try_key_extraction_impl<_KeyT, _Ret>( |
lib/libcxx/include/__variant/monostate.h+4-4| ... | @@ -19,10 +19,10 @@ | ... | @@ -19,10 +19,10 @@ |
| 19 | # pragma GCC system_header | 19 | # pragma GCC system_header |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 23 | |||
| 24 | #if _LIBCPP_STD_VER >= 17 | 22 | #if _LIBCPP_STD_VER >= 17 |
| 25 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 25 | |||
| 26 | struct monostate {}; | 26 | struct monostate {}; |
| 27 | 27 | ||
| 28 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(monostate, monostate) noexcept { return true; } | 28 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(monostate, monostate) noexcept { return true; } |
| ... | @@ -59,8 +59,8 @@ struct hash<monostate> { | ... | @@ -59,8 +59,8 @@ struct hash<monostate> { |
| 59 | } | 59 | } |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 63 | |||
| 64 | _LIBCPP_END_NAMESPACE_STD | 62 | _LIBCPP_END_NAMESPACE_STD |
| 65 | 63 | ||
| 64 | #endif // _LIBCPP_STD_VER >= 17 | ||
| 65 | |||
| 66 | #endif // _LIBCPP___VARIANT_MONOSTATE_H | 66 | #endif // _LIBCPP___VARIANT_MONOSTATE_H |
lib/libcxx/include/__vector/layout.h created+479| ... | @@ -0,0 +1,479 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP___VECTOR_LAYOUT_H | ||
| 10 | #define _LIBCPP___VECTOR_LAYOUT_H | ||
| 11 | |||
| 12 | #include <__assert> | ||
| 13 | #include <__config> | ||
| 14 | #include <__debug_utils/sanitizers.h> | ||
| 15 | #include <__memory/allocator_traits.h> | ||
| 16 | #include <__memory/compressed_pair.h> | ||
| 17 | #include <__memory/pointer_traits.h> | ||
| 18 | #include <__memory/swap_allocator.h> | ||
| 19 | #include <__memory/uninitialized_algorithms.h> | ||
| 20 | #include <__split_buffer> | ||
| 21 | #include <__type_traits/is_nothrow_constructible.h> | ||
| 22 | #include <__utility/exchange.h> | ||
| 23 | #include <__utility/move.h> | ||
| 24 | #include <__utility/swap.h> | ||
| 25 | |||
| 26 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 27 | # pragma GCC system_header | ||
| 28 | #endif | ||
| 29 | |||
| 30 | _LIBCPP_PUSH_MACROS | ||
| 31 | #include <__undef_macros> | ||
| 32 | |||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 34 | |||
| 35 | /// Defines `std::vector`'s storage layout and any operations that are affected by a change in the | ||
| 36 | /// layout. | ||
| 37 | /// | ||
| 38 | /// `std::vector` can be represented in a variety of ways. Each representation strongly influences | ||
| 39 | /// the codegen when calling vector operations, which can significantly impact runtime performance | ||
| 40 | /// and memory utilisation. libc++ provides two alternative layouts for `std::vector`, although only | ||
| 41 | /// one can be active for an entire binary: | ||
| 42 | /// | ||
| 43 | /// * pointer-based layout (stable ABI default) | ||
| 44 | /// * size-based layout (unstable ABI alternative) | ||
| 45 | // | ||
| 46 | /// We describe these layouts below. All vector representations have a pointer that points to where | ||
| 47 | /// the memory is allocated (called `__begin_`). | ||
| 48 | /// | ||
| 49 | /// **Pointer-based layout** | ||
| 50 | /// | ||
| 51 | /// The pointer-based layout uses two more pointers in addition to `__begin_`. The second pointer | ||
| 52 | /// (called `__end_`) points past the end of the part of the buffer that holds valid elements. | ||
| 53 | /// Another pointer (called `__capacity_`) points past the end of the allocated buffer. The original | ||
| 54 | /// libc++ `std::vector` implementation only provided the pointer-based layout. libc++ continues to | ||
| 55 | /// use the pointer-based layout, by default, in order to maintain binary compatibility with | ||
| 56 | /// existing software. | ||
| 57 | /// | ||
| 58 | /// The `__end_` pointer has three primary use-cases: | ||
| 59 | /// * to compute the size of the vector; and | ||
| 60 | /// * to construct the past-the-end iterator; and | ||
| 61 | /// * to indicate where the next element should be appended. | ||
| 62 | /// | ||
| 63 | /// The `__capacity_` is used to compute the capacity of the vector, which lets the vector know how | ||
| 64 | /// many elements can be added to the vector before a reallocation is necessary. | ||
| 65 | /// | ||
| 66 | /// __begin_ = 0xE4FD0, __end_ = 0xE4FF0, __capacity_ = 0xE5000 | ||
| 67 | /// 0xE4FD0 0xE4FF0 0xE5000 | ||
| 68 | /// v v v | ||
| 69 | /// +---------------+--------+--------+--------+--------+--------+--------+---------------------+ | ||
| 70 | /// | ????????????? | 3174 | 5656 | 648 | 489 | ------ | ------ | ??????????????????? | | ||
| 71 | /// +---------------+--------+--------+--------+--------+--------+--------+---------------------+ | ||
| 72 | /// ^ ^ ^ | ||
| 73 | /// __begin_ __end_ __capacity_ | ||
| 74 | /// | ||
| 75 | /// Figure 1: A visual representation of a pointer-based `std::vector<short>`. This vector has | ||
| 76 | /// four elements, with the capacity to store six. Boxes with numbers are valid elements within | ||
| 77 | /// the vector, and boxes with `xx` have been allocated, but aren't being used as elements right | ||
| 78 | /// now. | ||
| 79 | /// | ||
| 80 | /// This is the default layout for libc++. | ||
| 81 | /// | ||
| 82 | /// **Size-based layout** | ||
| 83 | /// | ||
| 84 | /// The size-based layout uses integers to track its size and capacity, and computes pointers to | ||
| 85 | /// past-the-end of the valid range and the whole buffer only when it's necessary. Programs using | ||
| 86 | /// the size-based layout have been measured to yield improved compute and memory performance over | ||
| 87 | /// the pointer-based layout. Despite these promising measurements, the size-based layout is opt-in, | ||
| 88 | /// to preserve ABI compatibility with prebuilt binaries. Given the improved performance, we | ||
| 89 | /// recommend preferring the size-based layout in the absence of such ABI constraints. | ||
| 90 | /// | ||
| 91 | /// __begin_ = 0xE4FD0, __size_ = 4, __capacity_ = 6 | ||
| 92 | /// 0xE4FD0 | ||
| 93 | /// v | ||
| 94 | /// +---------------+--------+--------+--------+--------+--------+--------+---------------------+ | ||
| 95 | /// | ????????????? | 3174 | 5656 | 648 | 489 | ------ | ------ | ??????????????????? | | ||
| 96 | /// +---------------+--------+--------+--------+--------+--------+--------+---------------------+ | ||
| 97 | /// ^ | ||
| 98 | /// __begin_ | ||
| 99 | /// | ||
| 100 | /// Figure 2: A visual representation of this a size-based layout. Blank boxes are not a part | ||
| 101 | /// of the vector's allocated buffer. | ||
| 102 | /// | ||
| 103 | /// **Class design** | ||
| 104 | /// | ||
| 105 | /// __vector_layout was designed with the following goals: | ||
| 106 | /// 1. to abstractly represent the buffer's boundaries; and | ||
| 107 | /// 2. to limit the number of `#ifdef` blocks that a reader needs to pass through; and | ||
| 108 | /// 3. given (1) and (2), to have no logically identical components in multiple `#ifdef` clauses. | ||
| 109 | /// | ||
| 110 | /// To facilitate these goals, there is a single `__vector_layout` definition. Users must choose | ||
| 111 | /// their vector's layout when libc++ is being configured, so there is no need to manage multiple | ||
| 112 | /// vector layout types (e.g. `__vector_size_layout`, `__vector_pointer_layout`, etc.). In doing so, | ||
| 113 | /// we reduce a significant portion of duplicate code. | ||
| 114 | template <class _Tp, class _Allocator> | ||
| 115 | class __vector_layout { | ||
| 116 | public: | ||
| 117 | using value_type _LIBCPP_NODEBUG = _Tp; | ||
| 118 | using allocator_type _LIBCPP_NODEBUG = _Allocator; | ||
| 119 | using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<allocator_type>; | ||
| 120 | using size_type _LIBCPP_NODEBUG = typename __alloc_traits::size_type; | ||
| 121 | using pointer _LIBCPP_NODEBUG = typename __alloc_traits::pointer; | ||
| 122 | using const_pointer _LIBCPP_NODEBUG = typename __alloc_traits::const_pointer; | ||
| 123 | #ifdef _LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED | ||
| 124 | using _SplitBuffer _LIBCPP_NODEBUG = __split_buffer<_Tp, _Allocator, __split_buffer_size_layout>; | ||
| 125 | using __bound_type _LIBCPP_NODEBUG = size_type; | ||
| 126 | #else | ||
| 127 | using _SplitBuffer _LIBCPP_NODEBUG = __split_buffer<_Tp, _Allocator, __split_buffer_pointer_layout>; | ||
| 128 | using __bound_type _LIBCPP_NODEBUG = pointer; | ||
| 129 | #endif | ||
| 130 | |||
| 131 | // Cannot be defaulted, since `_LIBCPP_COMPRESSED_PAIR` isn't an aggregate before C++14. | ||
| 132 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __vector_layout() | ||
| 133 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) | ||
| 134 | : __capacity_() {} | ||
| 135 | |||
| 136 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __vector_layout(allocator_type const& __a) | ||
| 137 | _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value) | ||
| 138 | : __capacity_(), __alloc_(__a) {} | ||
| 139 | |||
| 140 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __vector_layout(allocator_type&& __a) | ||
| 141 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) | ||
| 142 | : __capacity_(), __alloc_(std::move(__a)) {} | ||
| 143 | |||
| 144 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __vector_layout(__vector_layout&& __other) | ||
| 145 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); | ||
| 146 | |||
| 147 | /// Returns a reference to the stored allocator. | ||
| 148 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { | ||
| 149 | return __alloc_; | ||
| 150 | } | ||
| 151 | |||
| 152 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type const& | ||
| 153 | __alloc() const _NOEXCEPT { | ||
| 154 | return __alloc_; | ||
| 155 | } | ||
| 156 | |||
| 157 | /// Returns a pointer to the beginning of the buffer. | ||
| 158 | /// | ||
| 159 | /// `__begin_ptr()` is not called `data()` because `vector::data()` returns `T*`, but `__begin_` | ||
| 160 | /// is allowed to be a fancy pointer. | ||
| 161 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __begin_ptr() _NOEXCEPT { | ||
| 162 | return __begin_; | ||
| 163 | } | ||
| 164 | |||
| 165 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer __begin_ptr() const _NOEXCEPT { | ||
| 166 | return __begin_; | ||
| 167 | } | ||
| 168 | |||
| 169 | /// Returns a built-in pointer to the beginning of the buffer. | ||
| 170 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _Tp* __data() _NOEXCEPT { | ||
| 171 | return std::__to_address(__begin_); | ||
| 172 | } | ||
| 173 | |||
| 174 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _Tp const* __data() const _NOEXCEPT { | ||
| 175 | return std::__to_address(__begin_); | ||
| 176 | } | ||
| 177 | |||
| 178 | /// Returns how many elements can be added before a reallocation occurs. | ||
| 179 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type | ||
| 180 | __remaining_capacity() const _NOEXCEPT; | ||
| 181 | |||
| 182 | /// Sets the member pointing to the first element in the vector to `__new_begin`, the member used | ||
| 183 | /// to obtain the vector's bound to the equivalent of `__new_size`, and the member that represents | ||
| 184 | /// the vector's capacity to the equivalent to `__new_capacity`. | ||
| 185 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | ||
| 186 | __set_layout(pointer __new_begin, size_type __new_size, size_type __new_capacity) _NOEXCEPT; | ||
| 187 | |||
| 188 | /// Sets the member used to obtain the vector's bound to the equivalent of `__ptr`. | ||
| 189 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_bound_using_pointer(pointer __ptr) _NOEXCEPT; | ||
| 190 | |||
| 191 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __reset_without_allocator() _NOEXCEPT; | ||
| 192 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap(__vector_layout& __other) _NOEXCEPT; | ||
| 193 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | ||
| 194 | __move_assign_without_allocator(__vector_layout& __other) _NOEXCEPT; | ||
| 195 | |||
| 196 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __relocate(_SplitBuffer& __buffer); | ||
| 197 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer | ||
| 198 | __relocate_with_pivot(_SplitBuffer& __buffer, pointer __pivot); | ||
| 199 | |||
| 200 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __size() const _NOEXCEPT; | ||
| 201 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __capacity() const _NOEXCEPT; | ||
| 202 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __empty() const _NOEXCEPT; | ||
| 203 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __end_ptr() _NOEXCEPT; | ||
| 204 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer __end_ptr() const _NOEXCEPT; | ||
| 205 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __capacity_ptr() _NOEXCEPT; | ||
| 206 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer __capacity_ptr() const _NOEXCEPT; | ||
| 207 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const _NOEXCEPT; | ||
| 208 | |||
| 209 | private: | ||
| 210 | pointer __begin_ = nullptr; | ||
| 211 | |||
| 212 | #ifdef _LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED | ||
| 213 | size_type __size_ = 0; | ||
| 214 | size_type __capacity_ = 0; | ||
| 215 | _LIBCPP_NO_UNIQUE_ADDRESS allocator_type __alloc_; | ||
| 216 | #else | ||
| 217 | pointer __end_ = nullptr; | ||
| 218 | _LIBCPP_COMPRESSED_PAIR(pointer, __capacity_ = nullptr, allocator_type, __alloc_); | ||
| 219 | #endif | ||
| 220 | |||
| 221 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | ||
| 222 | _LIBCPP_HIDE_FROM_ABI void __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const { | ||
| 223 | std::__annotate_contiguous_container<_Allocator>(__data(), __data() + __capacity(), __old_mid, __new_mid); | ||
| 224 | } | ||
| 225 | |||
| 226 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT { | ||
| 227 | __annotate_contiguous_container(__data() + __capacity(), __data() + __current_size); | ||
| 228 | } | ||
| 229 | |||
| 230 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT { | ||
| 231 | __annotate_contiguous_container(__data() + __size(), __data() + __capacity()); | ||
| 232 | } | ||
| 233 | }; | ||
| 234 | |||
| 235 | #ifdef _LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED | ||
| 236 | template <class _Tp, class _Alloc> | ||
| 237 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __vector_layout<_Tp, _Alloc>::__vector_layout(__vector_layout&& __other) | ||
| 238 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) | ||
| 239 | : __begin_(std::__exchange(__other.__begin_, nullptr)), | ||
| 240 | __size_(std::__exchange(__other.__size_, 0)), | ||
| 241 | __capacity_(std::__exchange(__other.__capacity_, 0)), | ||
| 242 | __alloc_(std::move(__other.__alloc_)) {} | ||
| 243 | |||
| 244 | template <class _Tp, class _Alloc> | ||
| 245 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type | ||
| 246 | __vector_layout<_Tp, _Alloc>::__remaining_capacity() const _NOEXCEPT { | ||
| 247 | return __capacity_ - __size_; | ||
| 248 | } | ||
| 249 | |||
| 250 | template <class _Tp, class _Alloc> | ||
| 251 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__set_layout( | ||
| 252 | pointer __new_begin, size_type __new_size, size_type __new_capacity) _NOEXCEPT { | ||
| 253 | __begin_ = __new_begin; | ||
| 254 | __size_ = __new_size; | ||
| 255 | __capacity_ = __new_capacity; | ||
| 256 | } | ||
| 257 | |||
| 258 | template <class _Tp, class _Alloc> | ||
| 259 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__set_bound_using_pointer(pointer __ptr) _NOEXCEPT { | ||
| 260 | __size_ = static_cast<size_type>(__ptr - __begin_); | ||
| 261 | } | ||
| 262 | |||
| 263 | template <class _Tp, class _Alloc> | ||
| 264 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__reset_without_allocator() _NOEXCEPT { | ||
| 265 | __begin_ = nullptr; | ||
| 266 | __size_ = 0; | ||
| 267 | __capacity_ = 0; | ||
| 268 | } | ||
| 269 | |||
| 270 | template <class _Tp, class _Alloc> | ||
| 271 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__swap(__vector_layout& __other) _NOEXCEPT { | ||
| 272 | using std::swap; | ||
| 273 | swap(__begin_, __other.__begin_); | ||
| 274 | swap(__size_, __other.__size_); | ||
| 275 | swap(__capacity_, __other.__capacity_); | ||
| 276 | std::__swap_allocator(__alloc_, __other.__alloc_); | ||
| 277 | } | ||
| 278 | |||
| 279 | template <class _Tp, class _Alloc> | ||
| 280 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | ||
| 281 | __vector_layout<_Tp, _Alloc>::__move_assign_without_allocator(__vector_layout& __other) _NOEXCEPT { | ||
| 282 | __begin_ = __other.__begin_; | ||
| 283 | __size_ = __other.__size_; | ||
| 284 | __capacity_ = __other.__capacity_; | ||
| 285 | |||
| 286 | __other.__reset_without_allocator(); | ||
| 287 | } | ||
| 288 | |||
| 289 | template <class _Tp, class _Alloc> | ||
| 290 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__relocate(_SplitBuffer& __buffer) { | ||
| 291 | __annotate_delete(); | ||
| 292 | __buffer.__relocate(__begin_, __size_, __capacity_); | ||
| 293 | __annotate_new(__size_); | ||
| 294 | } | ||
| 295 | |||
| 296 | template <class _Tp, class _Alloc> | ||
| 297 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer | ||
| 298 | __vector_layout<_Tp, _Alloc>::__relocate_with_pivot(_SplitBuffer& __buffer, pointer __pivot) { | ||
| 299 | __annotate_delete(); | ||
| 300 | auto __result = __buffer.__relocate_with_pivot(__pivot, __begin_, __size_, __capacity_); | ||
| 301 | __annotate_new(__size_); | ||
| 302 | return __result; | ||
| 303 | } | ||
| 304 | |||
| 305 | template <class _Tp, class _Alloc> | ||
| 306 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type | ||
| 307 | __vector_layout<_Tp, _Alloc>::__size() const _NOEXCEPT { | ||
| 308 | return __size_; | ||
| 309 | } | ||
| 310 | |||
| 311 | template <class _Tp, class _Alloc> | ||
| 312 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type | ||
| 313 | __vector_layout<_Tp, _Alloc>::__capacity() const _NOEXCEPT { | ||
| 314 | return __capacity_; | ||
| 315 | } | ||
| 316 | |||
| 317 | template <class _Tp, class _Alloc> | ||
| 318 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __vector_layout<_Tp, _Alloc>::__empty() const _NOEXCEPT { | ||
| 319 | return __size_ == 0; | ||
| 320 | } | ||
| 321 | |||
| 322 | template <class _Tp, class _Alloc> | ||
| 323 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer | ||
| 324 | __vector_layout<_Tp, _Alloc>::__end_ptr() _NOEXCEPT { | ||
| 325 | return __begin_ + __size_; | ||
| 326 | } | ||
| 327 | |||
| 328 | template <class _Tp, class _Alloc> | ||
| 329 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::const_pointer | ||
| 330 | __vector_layout<_Tp, _Alloc>::__end_ptr() const _NOEXCEPT { | ||
| 331 | return __begin_ + __size_; | ||
| 332 | } | ||
| 333 | |||
| 334 | template <class _Tp, class _Alloc> | ||
| 335 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer | ||
| 336 | __vector_layout<_Tp, _Alloc>::__capacity_ptr() _NOEXCEPT { | ||
| 337 | return __begin_ + __capacity_; | ||
| 338 | } | ||
| 339 | |||
| 340 | template <class _Tp, class _Alloc> | ||
| 341 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::const_pointer | ||
| 342 | __vector_layout<_Tp, _Alloc>::__capacity_ptr() const _NOEXCEPT { | ||
| 343 | return __begin_ + __capacity_; | ||
| 344 | } | ||
| 345 | |||
| 346 | template <class _Tp, class _Alloc> | ||
| 347 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __vector_layout<_Tp, _Alloc>::__invariants() const _NOEXCEPT { | ||
| 348 | if (__begin_ == nullptr) | ||
| 349 | return __size_ == 0 && __capacity_ == 0; | ||
| 350 | return __size_ <= __capacity_; | ||
| 351 | } | ||
| 352 | #else // !defined(_LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED) | ||
| 353 | template <class _Tp, class _Alloc> | ||
| 354 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __vector_layout<_Tp, _Alloc>::__vector_layout(__vector_layout&& __other) | ||
| 355 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) | ||
| 356 | : __begin_(std::__exchange(__other.__begin_, nullptr)), | ||
| 357 | __end_(std::__exchange(__other.__end_, nullptr)), | ||
| 358 | __capacity_(std::__exchange(__other.__capacity_, nullptr)), | ||
| 359 | __alloc_(std::move(__other.__alloc_)) {} | ||
| 360 | |||
| 361 | template <class _Tp, class _Alloc> | ||
| 362 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type | ||
| 363 | __vector_layout<_Tp, _Alloc>::__remaining_capacity() const _NOEXCEPT { | ||
| 364 | return __capacity_ - __end_; | ||
| 365 | } | ||
| 366 | |||
| 367 | template <class _Tp, class _Alloc> | ||
| 368 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__set_layout( | ||
| 369 | pointer __new_begin, size_type __new_size, size_type __new_capacity) _NOEXCEPT { | ||
| 370 | __begin_ = __new_begin; | ||
| 371 | __end_ = __new_begin + __new_size; | ||
| 372 | __capacity_ = __new_begin + __new_capacity; | ||
| 373 | } | ||
| 374 | |||
| 375 | template <class _Tp, class _Alloc> | ||
| 376 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__set_bound_using_pointer(pointer __ptr) _NOEXCEPT { | ||
| 377 | __end_ = __ptr; | ||
| 378 | } | ||
| 379 | |||
| 380 | template <class _Tp, class _Alloc> | ||
| 381 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__reset_without_allocator() _NOEXCEPT { | ||
| 382 | __begin_ = nullptr; | ||
| 383 | __end_ = nullptr; | ||
| 384 | __capacity_ = nullptr; | ||
| 385 | } | ||
| 386 | |||
| 387 | template <class _Tp, class _Alloc> | ||
| 388 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__swap(__vector_layout& __other) _NOEXCEPT { | ||
| 389 | using std::swap; | ||
| 390 | swap(__begin_, __other.__begin_); | ||
| 391 | swap(__end_, __other.__end_); | ||
| 392 | swap(__capacity_, __other.__capacity_); | ||
| 393 | std::__swap_allocator(__alloc_, __other.__alloc_); | ||
| 394 | } | ||
| 395 | |||
| 396 | template <class _Tp, class _Alloc> | ||
| 397 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | ||
| 398 | __vector_layout<_Tp, _Alloc>::__move_assign_without_allocator(__vector_layout& __other) _NOEXCEPT { | ||
| 399 | __begin_ = __other.__begin_; | ||
| 400 | __end_ = __other.__end_; | ||
| 401 | __capacity_ = __other.__capacity_; | ||
| 402 | |||
| 403 | __other.__reset_without_allocator(); | ||
| 404 | } | ||
| 405 | |||
| 406 | template <class _Tp, class _Alloc> | ||
| 407 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__relocate(_SplitBuffer& __buffer) { | ||
| 408 | __annotate_delete(); | ||
| 409 | __buffer.__relocate(__begin_, __end_, __capacity_); | ||
| 410 | __annotate_new(__size()); | ||
| 411 | } | ||
| 412 | |||
| 413 | template <class _Tp, class _Alloc> | ||
| 414 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer | ||
| 415 | __vector_layout<_Tp, _Alloc>::__relocate_with_pivot(_SplitBuffer& __buffer, pointer __pivot) { | ||
| 416 | __annotate_delete(); | ||
| 417 | auto __result = __buffer.__relocate_with_pivot(__pivot, __begin_, __end_, __capacity_); | ||
| 418 | __annotate_new(__size()); | ||
| 419 | return __result; | ||
| 420 | } | ||
| 421 | |||
| 422 | template <class _Tp, class _Alloc> | ||
| 423 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type | ||
| 424 | __vector_layout<_Tp, _Alloc>::__size() const _NOEXCEPT { | ||
| 425 | return static_cast<size_type>(__end_ - __begin_); | ||
| 426 | } | ||
| 427 | |||
| 428 | template <class _Tp, class _Alloc> | ||
| 429 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type | ||
| 430 | __vector_layout<_Tp, _Alloc>::__capacity() const _NOEXCEPT { | ||
| 431 | return static_cast<size_type>(__capacity_ - __begin_); | ||
| 432 | } | ||
| 433 | |||
| 434 | template <class _Tp, class _Alloc> | ||
| 435 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __vector_layout<_Tp, _Alloc>::__empty() const _NOEXCEPT { | ||
| 436 | return __begin_ == __end_; | ||
| 437 | } | ||
| 438 | |||
| 439 | template <class _Tp, class _Alloc> | ||
| 440 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer | ||
| 441 | __vector_layout<_Tp, _Alloc>::__end_ptr() _NOEXCEPT { | ||
| 442 | return __end_; | ||
| 443 | } | ||
| 444 | |||
| 445 | template <class _Tp, class _Alloc> | ||
| 446 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::const_pointer | ||
| 447 | __vector_layout<_Tp, _Alloc>::__end_ptr() const _NOEXCEPT { | ||
| 448 | return __end_; | ||
| 449 | } | ||
| 450 | |||
| 451 | template <class _Tp, class _Alloc> | ||
| 452 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer | ||
| 453 | __vector_layout<_Tp, _Alloc>::__capacity_ptr() _NOEXCEPT { | ||
| 454 | return __capacity_; | ||
| 455 | } | ||
| 456 | |||
| 457 | template <class _Tp, class _Alloc> | ||
| 458 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::const_pointer | ||
| 459 | __vector_layout<_Tp, _Alloc>::__capacity_ptr() const _NOEXCEPT { | ||
| 460 | return __capacity_; | ||
| 461 | } | ||
| 462 | |||
| 463 | template <class _Tp, class _Alloc> | ||
| 464 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __vector_layout<_Tp, _Alloc>::__invariants() const _NOEXCEPT { | ||
| 465 | if (__begin_ == nullptr) | ||
| 466 | return __end_ == nullptr && __capacity_ == nullptr; | ||
| 467 | if (__begin_ > __end_) | ||
| 468 | return false; | ||
| 469 | if (__begin_ == __capacity_) | ||
| 470 | return false; | ||
| 471 | return __end_ <= __capacity_; | ||
| 472 | } | ||
| 473 | #endif // _LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED | ||
| 474 | |||
| 475 | _LIBCPP_END_NAMESPACE_STD | ||
| 476 | |||
| 477 | _LIBCPP_POP_MACROS | ||
| 478 | |||
| 479 | #endif // _LIBCPP___VECTOR_LAYOUT_H | ||
lib/libcxx/include/__vector/vector.h+218-301| ... | @@ -56,6 +56,7 @@ | ... | @@ -56,6 +56,7 @@ |
| 56 | #include <__type_traits/is_nothrow_constructible.h> | 56 | #include <__type_traits/is_nothrow_constructible.h> |
| 57 | #include <__type_traits/is_pointer.h> | 57 | #include <__type_traits/is_pointer.h> |
| 58 | #include <__type_traits/is_same.h> | 58 | #include <__type_traits/is_same.h> |
| 59 | #include <__type_traits/is_swappable.h> | ||
| 59 | #include <__type_traits/is_trivially_relocatable.h> | 60 | #include <__type_traits/is_trivially_relocatable.h> |
| 60 | #include <__type_traits/type_identity.h> | 61 | #include <__type_traits/type_identity.h> |
| 61 | #include <__utility/declval.h> | 62 | #include <__utility/declval.h> |
| ... | @@ -72,6 +73,7 @@ | ... | @@ -72,6 +73,7 @@ |
| 72 | // These headers define parts of vectors definition, since they define ADL functions or class specializations. | 73 | // These headers define parts of vectors definition, since they define ADL functions or class specializations. |
| 73 | #include <__vector/comparison.h> | 74 | #include <__vector/comparison.h> |
| 74 | #include <__vector/container_traits.h> | 75 | #include <__vector/container_traits.h> |
| 76 | #include <__vector/layout.h> | ||
| 75 | #include <__vector/swap.h> | 77 | #include <__vector/swap.h> |
| 76 | 78 | ||
| 77 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 79 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | @@ -85,19 +87,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -85,19 +87,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 85 | 87 | ||
| 86 | template <class _Tp, class _Allocator /* = allocator<_Tp> */> | 88 | template <class _Tp, class _Allocator /* = allocator<_Tp> */> |
| 87 | class vector { | 89 | class vector { |
| 88 | template <class _Up, class _Alloc> | 90 | using __base_type _LIBCPP_NODEBUG = __vector_layout<_Tp, _Allocator>; |
| 89 | using __split_buffer _LIBCPP_NODEBUG = std::__split_buffer<_Up, _Alloc, __split_buffer_pointer_layout>; | 91 | using __bound_type _LIBCPP_NODEBUG = typename __base_type::__bound_type; |
| 92 | using _SplitBuffer _LIBCPP_NODEBUG = typename __base_type::_SplitBuffer; | ||
| 90 | 93 | ||
| 91 | public: | 94 | public: |
| 92 | // | 95 | // |
| 93 | // Types | 96 | // Types |
| 94 | // | 97 | // |
| 95 | using __self _LIBCPP_NODEBUG = vector; | ||
| 96 | using value_type = _Tp; | 98 | using value_type = _Tp; |
| 97 | using allocator_type = _Allocator; | 99 | using allocator_type = _Allocator; |
| 98 | using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<allocator_type>; | 100 | using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<_Allocator>; |
| 99 | using reference = value_type&; | 101 | using reference = _Tp&; |
| 100 | using const_reference = const value_type&; | 102 | using const_reference = const _Tp&; |
| 101 | using size_type = typename __alloc_traits::size_type; | 103 | using size_type = typename __alloc_traits::size_type; |
| 102 | using difference_type = typename __alloc_traits::difference_type; | 104 | using difference_type = typename __alloc_traits::difference_type; |
| 103 | using pointer = typename __alloc_traits::pointer; | 105 | using pointer = typename __alloc_traits::pointer; |
| ... | @@ -106,8 +108,8 @@ public: | ... | @@ -106,8 +108,8 @@ public: |
| 106 | // Users might provide custom allocators, and prior to C++20 we have no existing way to detect whether the allocator's | 108 | // Users might provide custom allocators, and prior to C++20 we have no existing way to detect whether the allocator's |
| 107 | // pointer type is contiguous (though it has to be by the Standard). Using the wrapper type ensures the iterator is | 109 | // pointer type is contiguous (though it has to be by the Standard). Using the wrapper type ensures the iterator is |
| 108 | // considered contiguous. | 110 | // considered contiguous. |
| 109 | using iterator = __bounded_iter<__wrap_iter<pointer> >; | 111 | using iterator = __bounded_iter<pointer>; |
| 110 | using const_iterator = __bounded_iter<__wrap_iter<const_pointer> >; | 112 | using const_iterator = __bounded_iter<const_pointer>; |
| 111 | #else | 113 | #else |
| 112 | using iterator = __wrap_iter<pointer>; | 114 | using iterator = __wrap_iter<pointer>; |
| 113 | using const_iterator = __wrap_iter<const_pointer>; | 115 | using const_iterator = __wrap_iter<const_pointer>; |
| ... | @@ -139,7 +141,7 @@ public: | ... | @@ -139,7 +141,7 @@ public: |
| 139 | #else | 141 | #else |
| 140 | noexcept | 142 | noexcept |
| 141 | #endif | 143 | #endif |
| 142 | : __alloc_(__a) { | 144 | : __layout_(__a) { |
| 143 | } | 145 | } |
| 144 | 146 | ||
| 145 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n) { | 147 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n) { |
| ... | @@ -151,9 +153,8 @@ public: | ... | @@ -151,9 +153,8 @@ public: |
| 151 | __guard.__complete(); | 153 | __guard.__complete(); |
| 152 | } | 154 | } |
| 153 | 155 | ||
| 154 | #if _LIBCPP_STD_VER >= 14 | ||
| 155 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a) | 156 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a) |
| 156 | : __alloc_(__a) { | 157 | : __layout_(__a) { |
| 157 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | 158 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); |
| 158 | if (__n > 0) { | 159 | if (__n > 0) { |
| 159 | __vallocate(__n); | 160 | __vallocate(__n); |
| ... | @@ -161,7 +162,6 @@ public: | ... | @@ -161,7 +162,6 @@ public: |
| 161 | } | 162 | } |
| 162 | __guard.__complete(); | 163 | __guard.__complete(); |
| 163 | } | 164 | } |
| 164 | #endif | ||
| 165 | 165 | ||
| 166 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x) { | 166 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x) { |
| 167 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | 167 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); |
| ... | @@ -175,7 +175,7 @@ public: | ... | @@ -175,7 +175,7 @@ public: |
| 175 | template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0> | 175 | template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0> |
| 176 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | 176 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI |
| 177 | vector(size_type __n, const value_type& __x, const allocator_type& __a) | 177 | vector(size_type __n, const value_type& __x, const allocator_type& __a) |
| 178 | : __alloc_(__a) { | 178 | : __layout_(__a) { |
| 179 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | 179 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); |
| 180 | if (__n > 0) { | 180 | if (__n > 0) { |
| 181 | __vallocate(__n); | 181 | __vallocate(__n); |
| ... | @@ -198,7 +198,7 @@ public: | ... | @@ -198,7 +198,7 @@ public: |
| 198 | int> = 0> | 198 | int> = 0> |
| 199 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | 199 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI |
| 200 | vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a) | 200 | vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a) |
| 201 | : __alloc_(__a) { | 201 | : __layout_(__a) { |
| 202 | __init_with_sentinel(__first, __last); | 202 | __init_with_sentinel(__first, __last); |
| 203 | } | 203 | } |
| 204 | 204 | ||
| ... | @@ -219,16 +219,15 @@ public: | ... | @@ -219,16 +219,15 @@ public: |
| 219 | int> = 0> | 219 | int> = 0> |
| 220 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | 220 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI |
| 221 | vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a) | 221 | vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a) |
| 222 | : __alloc_(__a) { | 222 | : __layout_(__a) { |
| 223 | size_type __n = static_cast<size_type>(std::distance(__first, __last)); | 223 | size_type __n = static_cast<size_type>(std::distance(__first, __last)); |
| 224 | __init_with_size(__first, __last, __n); | 224 | __init_with_size(__first, __last, __n); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | #if _LIBCPP_STD_VER >= 23 | 227 | #if _LIBCPP_STD_VER >= 23 |
| 228 | template <_ContainerCompatibleRange<_Tp> _Range> | 228 | template <_ContainerCompatibleRange<_Tp> _Range> |
| 229 | _LIBCPP_HIDE_FROM_ABI constexpr vector( | 229 | _LIBCPP_HIDE_FROM_ABI constexpr vector(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type()) |
| 230 | from_range_t, _Range&& __range, const allocator_type& __alloc = allocator_type()) | 230 | : __layout_(__a) { |
| 231 | : __alloc_(__alloc) { | ||
| 232 | if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) { | 231 | if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) { |
| 233 | auto __n = static_cast<size_type>(ranges::distance(__range)); | 232 | auto __n = static_cast<size_type>(ranges::distance(__range)); |
| 234 | __init_with_size(ranges::begin(__range), ranges::end(__range), __n); | 233 | __init_with_size(ranges::begin(__range), ranges::end(__range), __n); |
| ... | @@ -245,10 +244,10 @@ private: | ... | @@ -245,10 +244,10 @@ private: |
| 245 | _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {} | 244 | _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {} |
| 246 | 245 | ||
| 247 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() { | 246 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() { |
| 248 | if (__vec_.__begin_ != nullptr) { | 247 | if (__vec_.__layout_.__begin_ptr() != nullptr) { |
| 249 | __vec_.clear(); | 248 | __vec_.clear(); |
| 250 | __vec_.__annotate_delete(); | 249 | __vec_.__annotate_delete(); |
| 251 | __alloc_traits::deallocate(__vec_.__alloc_, __vec_.__begin_, __vec_.capacity()); | 250 | __alloc_traits::deallocate(__vec_.__layout_.__alloc(), __vec_.__layout_.__begin_ptr(), __vec_.capacity()); |
| 252 | } | 251 | } |
| 253 | } | 252 | } |
| 254 | 253 | ||
| ... | @@ -256,17 +255,19 @@ private: | ... | @@ -256,17 +255,19 @@ private: |
| 256 | vector& __vec_; | 255 | vector& __vec_; |
| 257 | }; | 256 | }; |
| 258 | 257 | ||
| 258 | using __emplace_back_result_t _LIBCPP_NODEBUG = _If<(_LIBCPP_STD_VER < 17), void, reference>; | ||
| 259 | |||
| 259 | public: | 260 | public: |
| 260 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~vector() { __destroy_vector (*this)(); } | 261 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~vector() { __destroy_vector (*this)(); } |
| 261 | 262 | ||
| 262 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(const vector& __x) | 263 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(const vector& __x) |
| 263 | : __alloc_(__alloc_traits::select_on_container_copy_construction(__x.__alloc_)) { | 264 | : __layout_(__alloc_traits::select_on_container_copy_construction(__x.__layout_.__alloc())) { |
| 264 | __init_with_size(__x.__begin_, __x.__end_, __x.size()); | 265 | __init_with_size(__x.__layout_.__begin_ptr(), __x.__layout_.__end_ptr(), __x.size()); |
| 265 | } | 266 | } |
| 266 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | 267 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI |
| 267 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | 268 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) |
| 268 | : __alloc_(__a) { | 269 | : __layout_(__a) { |
| 269 | __init_with_size(__x.__begin_, __x.__end_, __x.size()); | 270 | __init_with_size(__x.__layout_.__begin_ptr(), __x.__layout_.__end_ptr(), __x.size()); |
| 270 | } | 271 | } |
| 271 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(const vector& __x); | 272 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(const vector& __x); |
| 272 | 273 | ||
| ... | @@ -277,7 +278,7 @@ public: | ... | @@ -277,7 +278,7 @@ public: |
| 277 | 278 | ||
| 278 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | 279 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI |
| 279 | vector(initializer_list<value_type> __il, const allocator_type& __a) | 280 | vector(initializer_list<value_type> __il, const allocator_type& __a) |
| 280 | : __alloc_(__a) { | 281 | : __layout_(__a) { |
| 281 | __init_with_size(__il.begin(), __il.end(), __il.size()); | 282 | __init_with_size(__il.begin(), __il.end(), __il.size()); |
| 282 | } | 283 | } |
| 283 | 284 | ||
| ... | @@ -294,8 +295,8 @@ public: | ... | @@ -294,8 +295,8 @@ public: |
| 294 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); | 295 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); |
| 295 | #endif | 296 | #endif |
| 296 | 297 | ||
| 297 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | 298 | _LIBCPP_CONSTEXPR_SINCE_CXX20 |
| 298 | vector(vector&& __x, const __type_identity_t<allocator_type>& __a); | 299 | _LIBCPP_HIDE_FROM_ABI vector(vector&& __x, const __type_identity_t<allocator_type>& __a); |
| 299 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(vector&& __x) | 300 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(vector&& __x) |
| 300 | _NOEXCEPT_(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value) { | 301 | _NOEXCEPT_(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value) { |
| 301 | __move_assign(__x, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); | 302 | __move_assign(__x, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); |
| ... | @@ -340,23 +341,23 @@ public: | ... | @@ -340,23 +341,23 @@ public: |
| 340 | #endif | 341 | #endif |
| 341 | 342 | ||
| 342 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { | 343 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { |
| 343 | return this->__alloc_; | 344 | return this->__layout_.__alloc(); |
| 344 | } | 345 | } |
| 345 | 346 | ||
| 346 | // | 347 | // |
| 347 | // Iterators | 348 | // Iterators |
| 348 | // | 349 | // |
| 349 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { | 350 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { |
| 350 | return __make_iter(__add_alignment_assumption(this->__begin_)); | 351 | return __make_iter(__add_alignment_assumption(this->__layout_.__begin_ptr())); |
| 351 | } | 352 | } |
| 352 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { | 353 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { |
| 353 | return __make_iter(__add_alignment_assumption(this->__begin_)); | 354 | return __make_iter(__add_alignment_assumption(this->__layout_.__begin_ptr())); |
| 354 | } | 355 | } |
| 355 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { | 356 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { |
| 356 | return __make_iter(__add_alignment_assumption(this->__end_)); | 357 | return __make_iter(__add_alignment_assumption(__layout_.__end_ptr())); |
| 357 | } | 358 | } |
| 358 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { | 359 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { |
| 359 | return __make_iter(__add_alignment_assumption(this->__end_)); | 360 | return __make_iter(__add_alignment_assumption(__layout_.__end_ptr())); |
| 360 | } | 361 | } |
| 361 | 362 | ||
| 362 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { | 363 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { |
| ... | @@ -391,16 +392,17 @@ public: | ... | @@ -391,16 +392,17 @@ public: |
| 391 | // [vector.capacity], capacity | 392 | // [vector.capacity], capacity |
| 392 | // | 393 | // |
| 393 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { | 394 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { |
| 394 | return static_cast<size_type>(this->__end_ - this->__begin_); | 395 | return __layout_.__size(); |
| 395 | } | 396 | } |
| 396 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const _NOEXCEPT { | 397 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const _NOEXCEPT { |
| 397 | return static_cast<size_type>(this->__cap_ - this->__begin_); | 398 | return __layout_.__capacity(); |
| 398 | } | 399 | } |
| 399 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { | 400 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { |
| 400 | return this->__begin_ == this->__end_; | 401 | return __layout_.__empty(); |
| 401 | } | 402 | } |
| 403 | |||
| 402 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { | 404 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { |
| 403 | return std::min<size_type>(__alloc_traits::max_size(this->__alloc_), numeric_limits<difference_type>::max()); | 405 | return std::min<size_type>(__alloc_traits::max_size(__layout_.__alloc()), numeric_limits<difference_type>::max()); |
| 404 | } | 406 | } |
| 405 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n); | 407 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n); |
| 406 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT; | 408 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT; |
| ... | @@ -410,50 +412,50 @@ public: | ... | @@ -410,50 +412,50 @@ public: |
| 410 | // | 412 | // |
| 411 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __n) _NOEXCEPT { | 413 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __n) _NOEXCEPT { |
| 412 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds"); | 414 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds"); |
| 413 | return this->__begin_[__n]; | 415 | return this->__layout_.__begin_ptr()[__n]; |
| 414 | } | 416 | } |
| 415 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference | 417 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference |
| 416 | operator[](size_type __n) const _NOEXCEPT { | 418 | operator[](size_type __n) const _NOEXCEPT { |
| 417 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds"); | 419 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds"); |
| 418 | return this->__begin_[__n]; | 420 | return this->__layout_.__begin_ptr()[__n]; |
| 419 | } | 421 | } |
| 420 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at(size_type __n) { | 422 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at(size_type __n) { |
| 421 | if (__n >= size()) | 423 | if (__n >= size()) |
| 422 | this->__throw_out_of_range(); | 424 | this->__throw_out_of_range(); |
| 423 | return this->__begin_[__n]; | 425 | return this->__layout_.__begin_ptr()[__n]; |
| 424 | } | 426 | } |
| 425 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const { | 427 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const { |
| 426 | if (__n >= size()) | 428 | if (__n >= size()) |
| 427 | this->__throw_out_of_range(); | 429 | this->__throw_out_of_range(); |
| 428 | return this->__begin_[__n]; | 430 | return this->__layout_.__begin_ptr()[__n]; |
| 429 | } | 431 | } |
| 430 | 432 | ||
| 431 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT { | 433 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT { |
| 432 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector"); | 434 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector"); |
| 433 | return *this->__begin_; | 435 | return *this->__layout_.__begin_ptr(); |
| 434 | } | 436 | } |
| 435 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT { | 437 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT { |
| 436 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector"); | 438 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector"); |
| 437 | return *this->__begin_; | 439 | return *this->__layout_.__begin_ptr(); |
| 438 | } | 440 | } |
| 439 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT { | 441 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT { |
| 440 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector"); | 442 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector"); |
| 441 | return *(this->__end_ - 1); | 443 | return end()[-1]; |
| 442 | } | 444 | } |
| 443 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT { | 445 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT { |
| 444 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector"); | 446 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector"); |
| 445 | return *(this->__end_ - 1); | 447 | return end()[-1]; |
| 446 | } | 448 | } |
| 447 | 449 | ||
| 448 | // | 450 | // |
| 449 | // [vector.data], data access | 451 | // [vector.data], data access |
| 450 | // | 452 | // |
| 451 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI value_type* data() _NOEXCEPT { | 453 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI value_type* data() _NOEXCEPT { |
| 452 | return std::__to_address(this->__begin_); | 454 | return __layout_.__data(); |
| 453 | } | 455 | } |
| 454 | 456 | ||
| 455 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const value_type* data() const _NOEXCEPT { | 457 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const value_type* data() const _NOEXCEPT { |
| 456 | return std::__to_address(this->__begin_); | 458 | return __layout_.__data(); |
| 457 | } | 459 | } |
| 458 | 460 | ||
| 459 | // | 461 | // |
| ... | @@ -464,21 +466,15 @@ public: | ... | @@ -464,21 +466,15 @@ public: |
| 464 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x) { emplace_back(std::move(__x)); } | 466 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x) { emplace_back(std::move(__x)); } |
| 465 | 467 | ||
| 466 | template <class... _Args> | 468 | template <class... _Args> |
| 467 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | 469 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __emplace_back_result_t emplace_back(_Args&&... __args); |
| 468 | #if _LIBCPP_STD_VER >= 17 | ||
| 469 | reference | ||
| 470 | emplace_back(_Args&&... __args); | ||
| 471 | #else | ||
| 472 | void | ||
| 473 | emplace_back(_Args&&... __args); | ||
| 474 | #endif | ||
| 475 | 470 | ||
| 476 | template <class... _Args> | 471 | template <class... _Args> |
| 477 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __emplace_back_assume_capacity(_Args&&... __args) { | 472 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __emplace_back_assume_capacity(_Args&&... __args) { |
| 478 | _LIBCPP_ASSERT_INTERNAL( | 473 | _LIBCPP_ASSERT_INTERNAL( |
| 479 | size() < capacity(), "We assume that we have enough space to insert an element at the end of the vector"); | 474 | size() < capacity(), "We assume that we have enough space to insert an element at the end of the vector"); |
| 480 | _ConstructTransaction __tx(*this, 1); | 475 | _ConstructTransaction __tx(*this, 1); |
| 481 | __alloc_traits::construct(this->__alloc_, std::__to_address(__tx.__pos_), std::forward<_Args>(__args)...); | 476 | __alloc_traits::construct( |
| 477 | this->__layout_.__alloc(), std::__to_address(__tx.__pos_), std::forward<_Args>(__args)...); | ||
| 482 | ++__tx.__pos_; | 478 | ++__tx.__pos_; |
| 483 | } | 479 | } |
| 484 | 480 | ||
| ... | @@ -487,15 +483,15 @@ public: | ... | @@ -487,15 +483,15 @@ public: |
| 487 | _LIBCPP_HIDE_FROM_ABI constexpr void append_range(_Range&& __range) { | 483 | _LIBCPP_HIDE_FROM_ABI constexpr void append_range(_Range&& __range) { |
| 488 | if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) { | 484 | if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) { |
| 489 | auto __len = ranges::distance(__range); | 485 | auto __len = ranges::distance(__range); |
| 490 | if (__len <= __cap_ - __end_) { | 486 | if (__len <= static_cast<difference_type>(__layout_.__remaining_capacity())) { |
| 491 | __construct_at_end(ranges::begin(__range), ranges::end(__range), __len); | 487 | __construct_at_end(ranges::begin(__range), ranges::end(__range), __len); |
| 492 | } else { | 488 | } else { |
| 493 | __split_buffer<value_type, allocator_type> __buffer(__recommend(size() + __len), size(), __alloc_); | 489 | _SplitBuffer __buffer(__recommend(size() + __len), size(), __layout_.__alloc()); |
| 494 | __buffer.__construct_at_end_with_size(ranges::begin(__range), __len); | 490 | __buffer.__construct_at_end_with_size(ranges::begin(__range), __len); |
| 495 | __swap_out_circular_buffer(__buffer); | 491 | __layout_.__relocate(__buffer); |
| 496 | } | 492 | } |
| 497 | } else { | 493 | } else { |
| 498 | vector __buffer(__alloc_); | 494 | vector __buffer(__layout_.__alloc()); |
| 499 | for (auto&& __val : __range) | 495 | for (auto&& __val : __range) |
| 500 | __buffer.emplace_back(std::forward<decltype(__val)>(__val)); | 496 | __buffer.emplace_back(std::forward<decltype(__val)>(__val)); |
| 501 | append_range(ranges::as_rvalue_view(__buffer)); | 497 | append_range(ranges::as_rvalue_view(__buffer)); |
| ... | @@ -505,7 +501,7 @@ public: | ... | @@ -505,7 +501,7 @@ public: |
| 505 | 501 | ||
| 506 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_back() { | 502 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_back() { |
| 507 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "vector::pop_back called on an empty vector"); | 503 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "vector::pop_back called on an empty vector"); |
| 508 | this->__destruct_at_end(this->__end_ - 1); | 504 | this->__destruct_at_end(__layout_.__end_ptr() - 1); |
| 509 | } | 505 | } |
| 510 | 506 | ||
| 511 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, const_reference __x); | 507 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, const_reference __x); |
| ... | @@ -550,8 +546,8 @@ public: | ... | @@ -550,8 +546,8 @@ public: |
| 550 | #endif | 546 | #endif |
| 551 | 547 | ||
| 552 | #ifndef _LIBCPP_CXX03_LANG | 548 | #ifndef _LIBCPP_CXX03_LANG |
| 553 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator | 549 | _LIBCPP_CONSTEXPR_SINCE_CXX20 |
| 554 | insert(const_iterator __position, initializer_list<value_type> __il) { | 550 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, initializer_list<value_type> __il) { |
| 555 | return insert(__position, __il.begin(), __il.end()); | 551 | return insert(__position, __il.begin(), __il.end()); |
| 556 | } | 552 | } |
| 557 | #endif | 553 | #endif |
| ... | @@ -561,7 +557,7 @@ public: | ... | @@ -561,7 +557,7 @@ public: |
| 561 | 557 | ||
| 562 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { | 558 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { |
| 563 | size_type __old_size = size(); | 559 | size_type __old_size = size(); |
| 564 | __base_destruct_at_end(this->__begin_); | 560 | __base_destruct_at_end(this->__layout_.__begin_ptr()); |
| 565 | __annotate_shrink(__old_size); | 561 | __annotate_shrink(__old_size); |
| 566 | } | 562 | } |
| 567 | 563 | ||
| ... | @@ -575,27 +571,41 @@ public: | ... | @@ -575,27 +571,41 @@ public: |
| 575 | _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>); | 571 | _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>); |
| 576 | #endif | 572 | #endif |
| 577 | 573 | ||
| 578 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const; | 574 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const _NOEXCEPT { |
| 575 | return __layout_.__invariants(); | ||
| 576 | } | ||
| 579 | 577 | ||
| 580 | private: | 578 | private: |
| 581 | pointer __begin_ = nullptr; | 579 | __base_type __layout_; |
| 582 | pointer __end_ = nullptr; | ||
| 583 | _LIBCPP_COMPRESSED_PAIR(pointer, __cap_ = nullptr, allocator_type, __alloc_); | ||
| 584 | 580 | ||
| 585 | // Allocate space for __n objects | 581 | // Allocate space for __n objects |
| 586 | // throws length_error if __n > max_size() | 582 | // throws length_error if __n > max_size() |
| 587 | // throws (probably bad_alloc) if memory run out | 583 | // throws (probably bad_alloc) if memory run out |
| 588 | // Precondition: __begin_ == __end_ == __cap_ == nullptr | 584 | // Precondition: begin() == nullptr |
| 585 | // Precondition: size() == 0 | ||
| 586 | // Precondition: capacity() == 0 | ||
| 589 | // Precondition: __n > 0 | 587 | // Precondition: __n > 0 |
| 590 | // Postcondition: capacity() >= __n | 588 | // Postcondition: capacity() >= __n |
| 591 | // Postcondition: size() == 0 | 589 | // Postcondition: size() == 0 |
| 592 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) { | 590 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) { |
| 591 | _LIBCPP_ASSERT_INTERNAL( | ||
| 592 | __layout_.__begin_ptr() == nullptr, | ||
| 593 | "vector::__vallocate can only be called on a vector that hasn't allocated memory. This vector either already " | ||
| 594 | "owns a buffer, or a deallocation function didn't reset the layout's begin pointer."); | ||
| 595 | _LIBCPP_ASSERT_INTERNAL( | ||
| 596 | size() == 0, | ||
| 597 | "vector::__vallocate can only be called on a vector that hasn't allocated memory. This vector either already " | ||
| 598 | "owns a buffer, or a deallocation function didn't reset the layout's size."); | ||
| 599 | _LIBCPP_ASSERT_INTERNAL( | ||
| 600 | __layout_.__capacity() == 0, | ||
| 601 | "vector::__vallocate can only be called on a vector that hasn't allocated memory. This vector either already " | ||
| 602 | "owns a buffer, or a deallocation function didn't reset the layout's capacity."); | ||
| 603 | _LIBCPP_ASSERT_INTERNAL(__n > 0, "vector::__vallocate cannot allocate 0 bytes"); | ||
| 604 | |||
| 593 | if (__n > max_size()) | 605 | if (__n > max_size()) |
| 594 | this->__throw_length_error(); | 606 | this->__throw_length_error(); |
| 595 | auto __allocation = std::__allocate_at_least(this->__alloc_, __n); | 607 | auto __allocation = std::__allocate_at_least(this->__layout_.__alloc(), __n); |
| 596 | __begin_ = __allocation.ptr; | 608 | __layout_.__set_layout(__allocation.ptr, 0, __allocation.count); |
| 597 | __end_ = __allocation.ptr; | ||
| 598 | __cap_ = __begin_ + __allocation.count; | ||
| 599 | __annotate_new(0); | 609 | __annotate_new(0); |
| 600 | } | 610 | } |
| 601 | 611 | ||
| ... | @@ -644,7 +654,7 @@ private: | ... | @@ -644,7 +654,7 @@ private: |
| 644 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | 654 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void |
| 645 | __insert_assign_n_unchecked(_Iterator __first, difference_type __n, pointer __position) { | 655 | __insert_assign_n_unchecked(_Iterator __first, difference_type __n, pointer __position) { |
| 646 | for (pointer __end_position = __position + __n; __position != __end_position; ++__position, (void)++__first) { | 656 | for (pointer __end_position = __position + __n; __position != __end_position; ++__position, (void)++__first) { |
| 647 | __temp_value<value_type, _Allocator> __tmp(this->__alloc_, *__first); | 657 | __temp_value<value_type, _Allocator> __tmp(this->__layout_.__alloc(), *__first); |
| 648 | *__position = std::move(__tmp.get()); | 658 | *__position = std::move(__tmp.get()); |
| 649 | } | 659 | } |
| 650 | } | 660 | } |
| ... | @@ -680,10 +690,7 @@ private: | ... | @@ -680,10 +690,7 @@ private: |
| 680 | // current implementation, there is no connection between a bounded iterator and its associated container, so we | 690 | // current implementation, there is no connection between a bounded iterator and its associated container, so we |
| 681 | // don't have a way to update existing valid iterators when the container is resized and thus have to go with | 691 | // don't have a way to update existing valid iterators when the container is resized and thus have to go with |
| 682 | // a laxer approach. | 692 | // a laxer approach. |
| 683 | return std::__make_bounded_iter( | 693 | return std::__make_bounded_iter(__p, __layout_.__begin_ptr(), __layout_.__capacity_ptr()); |
| 684 | std::__wrap_iter<pointer>(__p), | ||
| 685 | std::__wrap_iter<pointer>(this->__begin_), | ||
| 686 | std::__wrap_iter<pointer>(this->__cap_)); | ||
| 687 | #else | 694 | #else |
| 688 | return iterator(__p); | 695 | return iterator(__p); |
| 689 | #endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR | 696 | #endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR |
| ... | @@ -692,19 +699,12 @@ private: | ... | @@ -692,19 +699,12 @@ private: |
| 692 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator __make_iter(const_pointer __p) const _NOEXCEPT { | 699 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator __make_iter(const_pointer __p) const _NOEXCEPT { |
| 693 | #ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR | 700 | #ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR |
| 694 | // Bound the iterator according to the capacity, rather than the size. | 701 | // Bound the iterator according to the capacity, rather than the size. |
| 695 | return std::__make_bounded_iter( | 702 | return std::__make_bounded_iter(__p, __layout_.__begin_ptr(), __layout_.__capacity_ptr()); |
| 696 | std::__wrap_iter<const_pointer>(__p), | ||
| 697 | std::__wrap_iter<const_pointer>(this->__begin_), | ||
| 698 | std::__wrap_iter<const_pointer>(this->__cap_)); | ||
| 699 | #else | 703 | #else |
| 700 | return const_iterator(__p); | 704 | return const_iterator(__p); |
| 701 | #endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR | 705 | #endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR |
| 702 | } | 706 | } |
| 703 | 707 | ||
| 704 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | ||
| 705 | __swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v); | ||
| 706 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer | ||
| 707 | __swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v, pointer __p); | ||
| 708 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | 708 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void |
| 709 | __move_range(pointer __from_s, pointer __from_e, pointer __to); | 709 | __move_range(pointer __from_s, pointer __from_e, pointer __to); |
| 710 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, true_type) | 710 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, true_type) |
| ... | @@ -751,14 +751,14 @@ private: | ... | @@ -751,14 +751,14 @@ private: |
| 751 | 751 | ||
| 752 | struct _ConstructTransaction { | 752 | struct _ConstructTransaction { |
| 753 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(vector& __v, size_type __n) | 753 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(vector& __v, size_type __n) |
| 754 | : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) { | 754 | : __v_(__v), __pos_(__v.__layout_.__end_ptr()), __new_end_(__pos_ + __n) { |
| 755 | __v_.__annotate_increase(__n); | 755 | __v_.__annotate_increase(__n); |
| 756 | } | 756 | } |
| 757 | 757 | ||
| 758 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { | 758 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { |
| 759 | __v_.__end_ = __pos_; | 759 | __v_.__layout_.__set_bound_using_pointer(__pos_); |
| 760 | if (__pos_ != __new_end_) { | 760 | if (__pos_ != __new_end_) { |
| 761 | __v_.__annotate_shrink(__new_end_ - __v_.__begin_); | 761 | __v_.__annotate_shrink(__new_end_ - __v_.__layout_.__begin_ptr()); |
| 762 | } | 762 | } |
| 763 | } | 763 | } |
| 764 | 764 | ||
| ... | @@ -771,10 +771,10 @@ private: | ... | @@ -771,10 +771,10 @@ private: |
| 771 | }; | 771 | }; |
| 772 | 772 | ||
| 773 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __base_destruct_at_end(pointer __new_last) _NOEXCEPT { | 773 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __base_destruct_at_end(pointer __new_last) _NOEXCEPT { |
| 774 | pointer __soon_to_be_end = this->__end_; | 774 | pointer __soon_to_be_end = __layout_.__end_ptr(); |
| 775 | while (__new_last != __soon_to_be_end) | 775 | while (__new_last != __soon_to_be_end) |
| 776 | __alloc_traits::destroy(this->__alloc_, std::__to_address(--__soon_to_be_end)); | 776 | __alloc_traits::destroy(this->__layout_.__alloc(), std::__to_address(--__soon_to_be_end)); |
| 777 | this->__end_ = __new_last; | 777 | __layout_.__set_bound_using_pointer(__new_last); |
| 778 | } | 778 | } |
| 779 | 779 | ||
| 780 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c) { | 780 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c) { |
| ... | @@ -792,56 +792,38 @@ private: | ... | @@ -792,56 +792,38 @@ private: |
| 792 | [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI static void __throw_out_of_range() { std::__throw_out_of_range("vector"); } | 792 | [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI static void __throw_out_of_range() { std::__throw_out_of_range("vector"); } |
| 793 | 793 | ||
| 794 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c, true_type) { | 794 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c, true_type) { |
| 795 | if (this->__alloc_ != __c.__alloc_) { | 795 | if (this->__layout_.__alloc() != __c.__layout_.__alloc()) { |
| 796 | clear(); | 796 | clear(); |
| 797 | __annotate_delete(); | 797 | __annotate_delete(); |
| 798 | __alloc_traits::deallocate(this->__alloc_, this->__begin_, capacity()); | 798 | __alloc_traits::deallocate(this->__layout_.__alloc(), this->__layout_.__begin_ptr(), capacity()); |
| 799 | this->__begin_ = this->__end_ = this->__cap_ = nullptr; | 799 | __layout_.__reset_without_allocator(); |
| 800 | } | 800 | } |
| 801 | this->__alloc_ = __c.__alloc_; | 801 | this->__layout_.__alloc() = __c.__layout_.__alloc(); |
| 802 | } | 802 | } |
| 803 | 803 | ||
| 804 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector&, false_type) {} | 804 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector&, false_type) {} |
| 805 | 805 | ||
| 806 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector& __c, true_type) | 806 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector& __c, true_type) |
| 807 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) { | 807 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) { |
| 808 | this->__alloc_ = std::move(__c.__alloc_); | 808 | this->__layout_.__alloc() = std::move(__c.__layout_.__alloc()); |
| 809 | } | 809 | } |
| 810 | 810 | ||
| 811 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector&, false_type) _NOEXCEPT {} | 811 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector&, false_type) _NOEXCEPT {} |
| 812 | 812 | ||
| 813 | template <class _Ptr = pointer, __enable_if_t<is_pointer<_Ptr>::value, int> = 0> | 813 | template <class _Ptr = pointer, __enable_if_t<is_pointer<_Ptr>::value, int> = 0> |
| 814 | static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI pointer | 814 | static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Ptr |
| 815 | __add_alignment_assumption(_Ptr __p) _NOEXCEPT { | 815 | __add_alignment_assumption(_Ptr __p) _NOEXCEPT { |
| 816 | if (!__libcpp_is_constant_evaluated()) { | 816 | if (!__libcpp_is_constant_evaluated()) { |
| 817 | return static_cast<pointer>(__builtin_assume_aligned(__p, _LIBCPP_ALIGNOF(decltype(*__p)))); | 817 | return static_cast<_Ptr>(__builtin_assume_aligned(__p, _LIBCPP_ALIGNOF(decltype(*__p)))); |
| 818 | } | 818 | } |
| 819 | return __p; | 819 | return __p; |
| 820 | } | 820 | } |
| 821 | 821 | ||
| 822 | template <class _Ptr = pointer, __enable_if_t<!is_pointer<_Ptr>::value, int> = 0> | 822 | template <class _Ptr = pointer, __enable_if_t<!is_pointer<_Ptr>::value, int> = 0> |
| 823 | static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI pointer | 823 | static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Ptr |
| 824 | __add_alignment_assumption(_Ptr __p) _NOEXCEPT { | 824 | __add_alignment_assumption(_Ptr __p) _NOEXCEPT { |
| 825 | return __p; | 825 | return __p; |
| 826 | } | 826 | } |
| 827 | |||
| 828 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_layouts(__split_buffer<_Tp, allocator_type>& __sb) { | ||
| 829 | auto __vector_begin = __begin_; | ||
| 830 | auto __vector_sentinel = __end_; | ||
| 831 | auto __vector_cap = __cap_; | ||
| 832 | |||
| 833 | auto __sb_begin = __sb.begin(); | ||
| 834 | auto __sb_sentinel = __sb.__raw_sentinel(); | ||
| 835 | auto __sb_cap = __sb.__raw_capacity(); | ||
| 836 | |||
| 837 | // TODO: replace with __set_valid_range and __set_capacity when vector supports it. | ||
| 838 | __begin_ = __sb_begin; | ||
| 839 | __end_ = __sb_sentinel; | ||
| 840 | __cap_ = __sb_cap; | ||
| 841 | |||
| 842 | __sb.__set_valid_range(__vector_begin, __vector_sentinel); | ||
| 843 | __sb.__set_capacity(__vector_cap); | ||
| 844 | } | ||
| 845 | }; | 827 | }; |
| 846 | 828 | ||
| 847 | #if _LIBCPP_STD_VER >= 17 | 829 | #if _LIBCPP_STD_VER >= 17 |
| ... | @@ -865,60 +847,13 @@ template <ranges::input_range _Range, | ... | @@ -865,60 +847,13 @@ template <ranges::input_range _Range, |
| 865 | vector(from_range_t, _Range&&, _Alloc = _Alloc()) -> vector<ranges::range_value_t<_Range>, _Alloc>; | 847 | vector(from_range_t, _Range&&, _Alloc = _Alloc()) -> vector<ranges::range_value_t<_Range>, _Alloc>; |
| 866 | #endif | 848 | #endif |
| 867 | 849 | ||
| 868 | // __swap_out_circular_buffer relocates the objects in [__begin_, __end_) into the front of __v and swaps the buffers of | ||
| 869 | // *this and __v. It is assumed that __v provides space for exactly (__end_ - __begin_) objects in the front. This | ||
| 870 | // function has a strong exception guarantee. | ||
| 871 | template <class _Tp, class _Allocator> | ||
| 872 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | ||
| 873 | vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v) { | ||
| 874 | __annotate_delete(); | ||
| 875 | auto __new_begin = __v.begin() - size(); | ||
| 876 | std::__uninitialized_allocator_relocate( | ||
| 877 | this->__alloc_, std::__to_address(__begin_), std::__to_address(__end_), std::__to_address(__new_begin)); | ||
| 878 | __v.__set_valid_range(__new_begin, __v.end()); | ||
| 879 | __end_ = __begin_; // All the objects have been destroyed by relocating them. | ||
| 880 | |||
| 881 | __swap_layouts(__v); | ||
| 882 | __v.__set_data(__v.begin()); | ||
| 883 | __annotate_new(size()); | ||
| 884 | } | ||
| 885 | |||
| 886 | // __swap_out_circular_buffer relocates the objects in [__begin_, __p) into the front of __v, the objects in | ||
| 887 | // [__p, __end_) into the back of __v and swaps the buffers of *this and __v. It is assumed that __v provides space for | ||
| 888 | // exactly (__p - __begin_) objects in the front and space for at least (__end_ - __p) objects in the back. This | ||
| 889 | // function has a strong exception guarantee if __begin_ == __p || __end_ == __p. | ||
| 890 | template <class _Tp, class _Allocator> | ||
| 891 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer | ||
| 892 | vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v, pointer __p) { | ||
| 893 | __annotate_delete(); | ||
| 894 | pointer __ret = __v.begin(); | ||
| 895 | |||
| 896 | // Relocate [__p, __end_) first to avoid having a hole in [__begin_, __end_) | ||
| 897 | // in case something in [__begin_, __p) throws. | ||
| 898 | std::__uninitialized_allocator_relocate( | ||
| 899 | this->__alloc_, std::__to_address(__p), std::__to_address(__end_), std::__to_address(__v.end())); | ||
| 900 | auto __relocated_so_far = __end_ - __p; | ||
| 901 | __v.__set_sentinel(__v.end() + __relocated_so_far); | ||
| 902 | __end_ = __p; // The objects in [__p, __end_) have been destroyed by relocating them. | ||
| 903 | auto __new_begin = __v.begin() - (__p - __begin_); | ||
| 904 | |||
| 905 | std::__uninitialized_allocator_relocate( | ||
| 906 | this->__alloc_, std::__to_address(__begin_), std::__to_address(__p), std::__to_address(__new_begin)); | ||
| 907 | __v.__set_valid_range(__new_begin, __v.end()); | ||
| 908 | __end_ = __begin_; // All the objects have been destroyed by relocating them. | ||
| 909 | __swap_layouts(__v); | ||
| 910 | __v.__set_data(__v.begin()); | ||
| 911 | __annotate_new(size()); | ||
| 912 | return __ret; | ||
| 913 | } | ||
| 914 | |||
| 915 | template <class _Tp, class _Allocator> | 850 | template <class _Tp, class _Allocator> |
| 916 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__vdeallocate() _NOEXCEPT { | 851 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__vdeallocate() _NOEXCEPT { |
| 917 | if (this->__begin_ != nullptr) { | 852 | if (this->__layout_.__begin_ptr() != nullptr) { |
| 918 | clear(); | 853 | clear(); |
| 919 | __annotate_delete(); | 854 | __annotate_delete(); |
| 920 | __alloc_traits::deallocate(this->__alloc_, this->__begin_, capacity()); | 855 | __alloc_traits::deallocate(this->__layout_.__alloc(), this->__layout_.__begin_ptr(), capacity()); |
| 921 | this->__begin_ = this->__end_ = this->__cap_ = nullptr; | 856 | __layout_.__reset_without_allocator(); |
| 922 | } | 857 | } |
| 923 | } | 858 | } |
| 924 | 859 | ||
| ... | @@ -935,7 +870,7 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const { | ... | @@ -935,7 +870,7 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const { |
| 935 | return std::max<size_type>(2 * __cap, __new_size); | 870 | return std::max<size_type>(2 * __cap, __new_size); |
| 936 | } | 871 | } |
| 937 | 872 | ||
| 938 | // Default constructs __n objects starting at __end_ | 873 | // Default constructs __n objects starting at __layout_.__end_ptr() |
| 939 | // throws if construction throws | 874 | // throws if construction throws |
| 940 | // Precondition: __n > 0 | 875 | // Precondition: __n > 0 |
| 941 | // Precondition: size() + __n <= capacity() | 876 | // Precondition: size() + __n <= capacity() |
| ... | @@ -945,11 +880,11 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__construct_at_end(s | ... | @@ -945,11 +880,11 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__construct_at_end(s |
| 945 | _ConstructTransaction __tx(*this, __n); | 880 | _ConstructTransaction __tx(*this, __n); |
| 946 | const_pointer __new_end = __tx.__new_end_; | 881 | const_pointer __new_end = __tx.__new_end_; |
| 947 | for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) { | 882 | for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) { |
| 948 | __alloc_traits::construct(this->__alloc_, std::__to_address(__pos)); | 883 | __alloc_traits::construct(this->__layout_.__alloc(), std::__to_address(__pos)); |
| 949 | } | 884 | } |
| 950 | } | 885 | } |
| 951 | 886 | ||
| 952 | // Copy constructs __n objects starting at __end_ from __x | 887 | // Copy constructs __n objects starting at __layout_.__end_ptr() from __x |
| 953 | // throws if construction throws | 888 | // throws if construction throws |
| 954 | // Precondition: __n > 0 | 889 | // Precondition: __n > 0 |
| 955 | // Precondition: size() + __n <= capacity() | 890 | // Precondition: size() + __n <= capacity() |
| ... | @@ -961,7 +896,7 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) | ... | @@ -961,7 +896,7 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) |
| 961 | _ConstructTransaction __tx(*this, __n); | 896 | _ConstructTransaction __tx(*this, __n); |
| 962 | const_pointer __new_end = __tx.__new_end_; | 897 | const_pointer __new_end = __tx.__new_end_; |
| 963 | for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) { | 898 | for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) { |
| 964 | __alloc_traits::construct(this->__alloc_, std::__to_address(__pos), __x); | 899 | __alloc_traits::construct(this->__layout_.__alloc(), std::__to_address(__pos), __x); |
| 965 | } | 900 | } |
| 966 | } | 901 | } |
| 967 | 902 | ||
| ... | @@ -970,7 +905,8 @@ template <class _InputIterator, class _Sentinel> | ... | @@ -970,7 +905,8 @@ template <class _InputIterator, class _Sentinel> |
| 970 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | 905 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void |
| 971 | vector<_Tp, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n) { | 906 | vector<_Tp, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n) { |
| 972 | _ConstructTransaction __tx(*this, __n); | 907 | _ConstructTransaction __tx(*this, __n); |
| 973 | __tx.__pos_ = std::__uninitialized_allocator_copy(this->__alloc_, std::move(__first), std::move(__last), __tx.__pos_); | 908 | __tx.__pos_ = std::__uninitialized_allocator_copy( |
| 909 | this->__layout_.__alloc(), std::move(__first), std::move(__last), __tx.__pos_); | ||
| 974 | } | 910 | } |
| 975 | 911 | ||
| 976 | template <class _Tp, class _Allocator> | 912 | template <class _Tp, class _Allocator> |
| ... | @@ -980,22 +916,15 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocato | ... | @@ -980,22 +916,15 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocato |
| 980 | #else | 916 | #else |
| 981 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) | 917 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) |
| 982 | #endif | 918 | #endif |
| 983 | : __alloc_(std::move(__x.__alloc_)) { | 919 | : __layout_(std::move(__x.__layout_)) { |
| 984 | this->__begin_ = __x.__begin_; | ||
| 985 | this->__end_ = __x.__end_; | ||
| 986 | this->__cap_ = __x.__cap_; | ||
| 987 | __x.__begin_ = __x.__end_ = __x.__cap_ = nullptr; | ||
| 988 | } | 920 | } |
| 989 | 921 | ||
| 990 | template <class _Tp, class _Allocator> | 922 | template <class _Tp, class _Allocator> |
| 991 | _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI | 923 | _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI |
| 992 | vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_type>& __a) | 924 | vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_type>& __a) |
| 993 | : __alloc_(__a) { | 925 | : __layout_(__a) { |
| 994 | if (__a == __x.__alloc_) { | 926 | if (__a == __x.__layout_.__alloc()) { |
| 995 | this->__begin_ = __x.__begin_; | 927 | __layout_.__move_assign_without_allocator(__x.__layout_); |
| 996 | this->__end_ = __x.__end_; | ||
| 997 | this->__cap_ = __x.__cap_; | ||
| 998 | __x.__begin_ = __x.__end_ = __x.__cap_ = nullptr; | ||
| 999 | } else { | 928 | } else { |
| 1000 | typedef move_iterator<iterator> _Ip; | 929 | typedef move_iterator<iterator> _Ip; |
| 1001 | __init_with_size(_Ip(__x.begin()), _Ip(__x.end()), __x.size()); | 930 | __init_with_size(_Ip(__x.begin()), _Ip(__x.end()), __x.size()); |
| ... | @@ -1005,7 +934,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_ | ... | @@ -1005,7 +934,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_ |
| 1005 | template <class _Tp, class _Allocator> | 934 | template <class _Tp, class _Allocator> |
| 1006 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type) | 935 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type) |
| 1007 | _NOEXCEPT_(__alloc_traits::is_always_equal::value) { | 936 | _NOEXCEPT_(__alloc_traits::is_always_equal::value) { |
| 1008 | if (this->__alloc_ != __c.__alloc_) { | 937 | if (this->__layout_.__alloc() != __c.__layout_.__alloc()) { |
| 1009 | typedef move_iterator<iterator> _Ip; | 938 | typedef move_iterator<iterator> _Ip; |
| 1010 | assign(_Ip(__c.begin()), _Ip(__c.end())); | 939 | assign(_Ip(__c.begin()), _Ip(__c.end())); |
| 1011 | } else | 940 | } else |
| ... | @@ -1017,10 +946,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__move_assign(vector | ... | @@ -1017,10 +946,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__move_assign(vector |
| 1017 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) { | 946 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) { |
| 1018 | __vdeallocate(); | 947 | __vdeallocate(); |
| 1019 | __move_assign_alloc(__c); // this can throw | 948 | __move_assign_alloc(__c); // this can throw |
| 1020 | this->__begin_ = __c.__begin_; | 949 | __layout_.__move_assign_without_allocator(__c.__layout_); |
| 1021 | this->__end_ = __c.__end_; | ||
| 1022 | this->__cap_ = __c.__cap_; | ||
| 1023 | __c.__begin_ = __c.__end_ = __c.__cap_ = nullptr; | ||
| 1024 | } | 950 | } |
| 1025 | 951 | ||
| 1026 | template <class _Tp, class _Allocator> | 952 | template <class _Tp, class _Allocator> |
| ... | @@ -1028,7 +954,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocato | ... | @@ -1028,7 +954,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocato |
| 1028 | vector<_Tp, _Allocator>::operator=(const vector& __x) { | 954 | vector<_Tp, _Allocator>::operator=(const vector& __x) { |
| 1029 | if (this != std::addressof(__x)) { | 955 | if (this != std::addressof(__x)) { |
| 1030 | __copy_assign_alloc(__x); | 956 | __copy_assign_alloc(__x); |
| 1031 | assign(__x.__begin_, __x.__end_); | 957 | assign(__x.__layout_.__begin_ptr(), __x.__layout_.__end_ptr()); |
| 1032 | } | 958 | } |
| 1033 | return *this; | 959 | return *this; |
| 1034 | } | 960 | } |
| ... | @@ -1037,10 +963,11 @@ template <class _Tp, class _Allocator> | ... | @@ -1037,10 +963,11 @@ template <class _Tp, class _Allocator> |
| 1037 | template <class _Iterator, class _Sentinel> | 963 | template <class _Iterator, class _Sentinel> |
| 1038 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | 964 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void |
| 1039 | vector<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) { | 965 | vector<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) { |
| 1040 | pointer __cur = __begin_; | 966 | pointer __cur = __layout_.__begin_ptr(); |
| 1041 | for (; __first != __last && __cur != __end_; ++__first, (void)++__cur) | 967 | pointer __end = __layout_.__end_ptr(); |
| 968 | for (; __first != __last && __cur != __end; ++__first, (void)++__cur) | ||
| 1042 | *__cur = *__first; | 969 | *__cur = *__first; |
| 1043 | if (__cur != __end_) { | 970 | if (__cur != __end) { |
| 1044 | __destruct_at_end(__cur); | 971 | __destruct_at_end(__cur); |
| 1045 | } else { | 972 | } else { |
| 1046 | for (; __first != __last; ++__first) | 973 | for (; __first != __last; ++__first) |
| ... | @@ -1054,11 +981,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | ... | @@ -1054,11 +981,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void |
| 1054 | vector<_Tp, _Allocator>::__assign_with_size(_Iterator __first, _Sentinel __last, difference_type __n) { | 981 | vector<_Tp, _Allocator>::__assign_with_size(_Iterator __first, _Sentinel __last, difference_type __n) { |
| 1055 | size_type __new_size = static_cast<size_type>(__n); | 982 | size_type __new_size = static_cast<size_type>(__n); |
| 1056 | if (__new_size <= capacity()) { | 983 | if (__new_size <= capacity()) { |
| 1057 | if (__new_size > size()) { | 984 | auto const __size = size(); |
| 1058 | auto __mid = std::__copy_n<_AlgPolicy>(std::move(__first), size(), this->__begin_).first; | 985 | if (__new_size > __size) { |
| 1059 | __construct_at_end(std::move(__mid), std::move(__last), __new_size - size()); | 986 | auto __mid = std::__copy_n<_AlgPolicy>(std::move(__first), __size, this->__layout_.__begin_ptr()).__in_; |
| 987 | __construct_at_end(std::move(__mid), std::move(__last), __new_size - __size); | ||
| 1060 | } else { | 988 | } else { |
| 1061 | pointer __m = std::__copy(std::move(__first), __last, this->__begin_).second; | 989 | pointer __m = std::__copy(std::move(__first), __last, this->__layout_.__begin_ptr()).__out_; |
| 1062 | this->__destruct_at_end(__m); | 990 | this->__destruct_at_end(__m); |
| 1063 | } | 991 | } |
| 1064 | } else { | 992 | } else { |
| ... | @@ -1072,11 +1000,11 @@ template <class _Tp, class _Allocator> | ... | @@ -1072,11 +1000,11 @@ template <class _Tp, class _Allocator> |
| 1072 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) { | 1000 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) { |
| 1073 | if (__n <= capacity()) { | 1001 | if (__n <= capacity()) { |
| 1074 | size_type __s = size(); | 1002 | size_type __s = size(); |
| 1075 | std::fill_n(this->__begin_, std::min(__n, __s), __u); | 1003 | std::fill_n(this->__layout_.__begin_ptr(), std::min(__n, __s), __u); |
| 1076 | if (__n > __s) | 1004 | if (__n > __s) |
| 1077 | __construct_at_end(__n - __s, __u); | 1005 | __construct_at_end(__n - __s, __u); |
| 1078 | else | 1006 | else |
| 1079 | this->__destruct_at_end(this->__begin_ + __n); | 1007 | this->__destruct_at_end(this->__layout_.__begin_ptr() + __n); |
| 1080 | } else { | 1008 | } else { |
| 1081 | __vdeallocate(); | 1009 | __vdeallocate(); |
| 1082 | __vallocate(__recommend(static_cast<size_type>(__n))); | 1010 | __vallocate(__recommend(static_cast<size_type>(__n))); |
| ... | @@ -1089,8 +1017,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::reserve(size_type __ | ... | @@ -1089,8 +1017,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::reserve(size_type __ |
| 1089 | if (__n > capacity()) { | 1017 | if (__n > capacity()) { |
| 1090 | if (__n > max_size()) | 1018 | if (__n > max_size()) |
| 1091 | this->__throw_length_error(); | 1019 | this->__throw_length_error(); |
| 1092 | __split_buffer<value_type, allocator_type> __v(__n, size(), this->__alloc_); | 1020 | _SplitBuffer __v(__n, size(), this->__layout_.__alloc()); |
| 1093 | __swap_out_circular_buffer(__v); | 1021 | __layout_.__relocate(__v); |
| 1094 | } | 1022 | } |
| 1095 | } | 1023 | } |
| 1096 | 1024 | ||
| ... | @@ -1100,12 +1028,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::shrink_to_fit() _NOE | ... | @@ -1100,12 +1028,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::shrink_to_fit() _NOE |
| 1100 | #if _LIBCPP_HAS_EXCEPTIONS | 1028 | #if _LIBCPP_HAS_EXCEPTIONS |
| 1101 | try { | 1029 | try { |
| 1102 | #endif // _LIBCPP_HAS_EXCEPTIONS | 1030 | #endif // _LIBCPP_HAS_EXCEPTIONS |
| 1103 | __split_buffer<value_type, allocator_type> __v(size(), size(), this->__alloc_); | 1031 | _SplitBuffer __v(size(), size(), this->__layout_.__alloc()); |
| 1104 | // The Standard mandates shrink_to_fit() does not increase the capacity. | 1032 | // The Standard mandates shrink_to_fit() does not increase the capacity. |
| 1105 | // With equal capacity keep the existing buffer. This avoids extra work | 1033 | // With equal capacity keep the existing buffer. This avoids extra work |
| 1106 | // due to swapping the elements. | 1034 | // due to swapping the elements. |
| 1107 | if (__v.capacity() < capacity()) | 1035 | if (__v.capacity() < capacity()) |
| 1108 | __swap_out_circular_buffer(__v); | 1036 | __layout_.__relocate(__v); |
| 1109 | #if _LIBCPP_HAS_EXCEPTIONS | 1037 | #if _LIBCPP_HAS_EXCEPTIONS |
| 1110 | } catch (...) { | 1038 | } catch (...) { |
| 1111 | } | 1039 | } |
| ... | @@ -1117,13 +1045,13 @@ template <class _Tp, class _Allocator> | ... | @@ -1117,13 +1045,13 @@ template <class _Tp, class _Allocator> |
| 1117 | template <class... _Args> | 1045 | template <class... _Args> |
| 1118 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer | 1046 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer |
| 1119 | vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) { | 1047 | vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) { |
| 1120 | __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), size(), this->__alloc_); | 1048 | _SplitBuffer __v(__recommend(size() + 1), size(), this->__layout_.__alloc()); |
| 1121 | // __v.emplace_back(std::forward<_Args>(__args)...); | 1049 | // __v.emplace_back(std::forward<_Args>(__args)...); |
| 1122 | pointer __end = __v.end(); | 1050 | pointer __end = __v.end(); |
| 1123 | __alloc_traits::construct(this->__alloc_, std::__to_address(__end), std::forward<_Args>(__args)...); | 1051 | __alloc_traits::construct(this->__layout_.__alloc(), std::__to_address(__end), std::forward<_Args>(__args)...); |
| 1124 | __v.__set_sentinel(++__end); | 1052 | __v.__set_sentinel(++__end); |
| 1125 | __swap_out_circular_buffer(__v); | 1053 | __layout_.__relocate(__v); |
| 1126 | return this->__end_; | 1054 | return __end; |
| 1127 | } | 1055 | } |
| 1128 | 1056 | ||
| 1129 | // This makes the compiler inline `__else()` if `__cond` is known to be false. Currently LLVM doesn't do that without | 1057 | // This makes the compiler inline `__else()` if `__cond` is known to be false. Currently LLVM doesn't do that without |
| ... | @@ -1144,27 +1072,22 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __if_likely_else(bool _ | ... | @@ -1144,27 +1072,22 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __if_likely_else(bool _ |
| 1144 | } | 1072 | } |
| 1145 | } | 1073 | } |
| 1146 | 1074 | ||
| 1147 | template <class _Tp, class _Allocator> | 1075 | template <class _Tp, class _Alloc> |
| 1148 | template <class... _Args> | 1076 | template <class... _Args> |
| 1149 | _LIBCPP_CONSTEXPR_SINCE_CXX20 inline | 1077 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Alloc>::__emplace_back_result_t |
| 1150 | #if _LIBCPP_STD_VER >= 17 | 1078 | vector<_Tp, _Alloc>::emplace_back(_Args&&... __args) { |
| 1151 | typename vector<_Tp, _Allocator>::reference | 1079 | pointer __end = __layout_.__end_ptr(); |
| 1152 | #else | ||
| 1153 | void | ||
| 1154 | #endif | ||
| 1155 | vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) { | ||
| 1156 | pointer __end = this->__end_; | ||
| 1157 | std::__if_likely_else( | 1080 | std::__if_likely_else( |
| 1158 | __end < this->__cap_, | 1081 | size() != capacity(), |
| 1159 | [&] { | 1082 | [&] { |
| 1160 | __emplace_back_assume_capacity(std::forward<_Args>(__args)...); | 1083 | __emplace_back_assume_capacity(std::forward<_Args>(__args)...); |
| 1161 | ++__end; | 1084 | ++__end; |
| 1162 | }, | 1085 | }, |
| 1163 | [&] { __end = __emplace_back_slow_path(std::forward<_Args>(__args)...); }); | 1086 | [&] { __end = __emplace_back_slow_path(std::forward<_Args>(__args)...); }); |
| 1164 | 1087 | ||
| 1165 | this->__end_ = __end; | 1088 | __layout_.__set_bound_using_pointer(__end); |
| 1166 | #if _LIBCPP_STD_VER >= 17 | 1089 | #if _LIBCPP_STD_VER >= 17 |
| 1167 | return *(__end - 1); | 1090 | return back(); |
| 1168 | #endif | 1091 | #endif |
| 1169 | } | 1092 | } |
| 1170 | 1093 | ||
| ... | @@ -1174,8 +1097,8 @@ vector<_Tp, _Allocator>::erase(const_iterator __position) { | ... | @@ -1174,8 +1097,8 @@ vector<_Tp, _Allocator>::erase(const_iterator __position) { |
| 1174 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( | 1097 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( |
| 1175 | __position != end(), "vector::erase(iterator) called with a non-dereferenceable iterator"); | 1098 | __position != end(), "vector::erase(iterator) called with a non-dereferenceable iterator"); |
| 1176 | difference_type __ps = __position - cbegin(); | 1099 | difference_type __ps = __position - cbegin(); |
| 1177 | pointer __p = this->__begin_ + __ps; | 1100 | pointer __p = this->__layout_.__begin_ptr() + __ps; |
| 1178 | this->__destruct_at_end(std::move(__p + 1, this->__end_, __p)); | 1101 | this->__destruct_at_end(std::move(__p + 1, __layout_.__end_ptr(), __p)); |
| 1179 | return __make_iter(__p); | 1102 | return __make_iter(__p); |
| 1180 | } | 1103 | } |
| 1181 | 1104 | ||
| ... | @@ -1183,9 +1106,9 @@ template <class _Tp, class _Allocator> | ... | @@ -1183,9 +1106,9 @@ template <class _Tp, class _Allocator> |
| 1183 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator | 1106 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator |
| 1184 | vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) { | 1107 | vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) { |
| 1185 | _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "vector::erase(first, last) called with invalid range"); | 1108 | _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "vector::erase(first, last) called with invalid range"); |
| 1186 | pointer __p = this->__begin_ + (__first - begin()); | 1109 | pointer __p = this->__layout_.__begin_ptr() + (__first - begin()); |
| 1187 | if (__first != __last) { | 1110 | if (__first != __last) { |
| 1188 | this->__destruct_at_end(std::move(__p + (__last - __first), this->__end_, __p)); | 1111 | this->__destruct_at_end(std::move(__p + (__last - __first), __layout_.__end_ptr(), __p)); |
| 1189 | } | 1112 | } |
| 1190 | return __make_iter(__p); | 1113 | return __make_iter(__p); |
| 1191 | } | 1114 | } |
| ... | @@ -1193,13 +1116,13 @@ vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) { | ... | @@ -1193,13 +1116,13 @@ vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) { |
| 1193 | template <class _Tp, class _Allocator> | 1116 | template <class _Tp, class _Allocator> |
| 1194 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | 1117 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void |
| 1195 | vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to) { | 1118 | vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to) { |
| 1196 | pointer __old_last = this->__end_; | 1119 | pointer __old_last = __layout_.__end_ptr(); |
| 1197 | difference_type __n = __old_last - __to; | 1120 | difference_type __n = __old_last - __to; |
| 1198 | { | 1121 | { |
| 1199 | pointer __i = __from_s + __n; | 1122 | pointer __i = __from_s + __n; |
| 1200 | _ConstructTransaction __tx(*this, __from_e - __i); | 1123 | _ConstructTransaction __tx(*this, __from_e - __i); |
| 1201 | for (pointer __pos = __tx.__pos_; __i < __from_e; ++__i, (void)++__pos, __tx.__pos_ = __pos) { | 1124 | for (pointer __pos = __tx.__pos_; __i < __from_e; ++__i, (void)++__pos, __tx.__pos_ = __pos) { |
| 1202 | __alloc_traits::construct(this->__alloc_, std::__to_address(__pos), std::move(*__i)); | 1125 | __alloc_traits::construct(this->__layout_.__alloc(), std::__to_address(__pos), std::move(*__i)); |
| 1203 | } | 1126 | } |
| 1204 | } | 1127 | } |
| 1205 | std::move_backward(__from_s, __from_s + __n, __old_last); | 1128 | std::move_backward(__from_s, __from_s + __n, __old_last); |
| ... | @@ -1208,21 +1131,22 @@ vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointe | ... | @@ -1208,21 +1131,22 @@ vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointe |
| 1208 | template <class _Tp, class _Allocator> | 1131 | template <class _Tp, class _Allocator> |
| 1209 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator | 1132 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator |
| 1210 | vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) { | 1133 | vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) { |
| 1211 | pointer __p = this->__begin_ + (__position - begin()); | 1134 | pointer __p = this->__layout_.__begin_ptr() + (__position - begin()); |
| 1212 | if (this->__end_ < this->__cap_) { | 1135 | if (size() != capacity()) { |
| 1213 | if (__p == this->__end_) { | 1136 | pointer __end = __layout_.__end_ptr(); |
| 1137 | if (__p == __end) { | ||
| 1214 | __emplace_back_assume_capacity(__x); | 1138 | __emplace_back_assume_capacity(__x); |
| 1215 | } else { | 1139 | } else { |
| 1216 | __move_range(__p, this->__end_, __p + 1); | 1140 | __move_range(__p, __end, __p + 1); |
| 1217 | const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); | 1141 | const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); |
| 1218 | if (std::__is_pointer_in_range(std::__to_address(__p), std::__to_address(__end_), std::addressof(__x))) | 1142 | if (std::__is_pointer_in_range(std::__to_address(__p), std::__to_address(__end), std::addressof(__x))) |
| 1219 | ++__xr; | 1143 | ++__xr; |
| 1220 | *__p = *__xr; | 1144 | *__p = *__xr; |
| 1221 | } | 1145 | } |
| 1222 | } else { | 1146 | } else { |
| 1223 | __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_); | 1147 | _SplitBuffer __v(__recommend(size() + 1), __p - this->__layout_.__begin_ptr(), this->__layout_.__alloc()); |
| 1224 | __v.emplace_back(__x); | 1148 | __v.emplace_back(__x); |
| 1225 | __p = __swap_out_circular_buffer(__v, __p); | 1149 | __p = __layout_.__relocate_with_pivot(__v, __p); |
| 1226 | } | 1150 | } |
| 1227 | return __make_iter(__p); | 1151 | return __make_iter(__p); |
| 1228 | } | 1152 | } |
| ... | @@ -1230,18 +1154,19 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) | ... | @@ -1230,18 +1154,19 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) |
| 1230 | template <class _Tp, class _Allocator> | 1154 | template <class _Tp, class _Allocator> |
| 1231 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator | 1155 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator |
| 1232 | vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) { | 1156 | vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) { |
| 1233 | pointer __p = this->__begin_ + (__position - begin()); | 1157 | pointer __p = this->__layout_.__begin_ptr() + (__position - begin()); |
| 1234 | if (this->__end_ < this->__cap_) { | 1158 | if (size() != capacity()) { |
| 1235 | if (__p == this->__end_) { | 1159 | pointer __end = __layout_.__end_ptr(); |
| 1160 | if (__p == __end) { | ||
| 1236 | __emplace_back_assume_capacity(std::move(__x)); | 1161 | __emplace_back_assume_capacity(std::move(__x)); |
| 1237 | } else { | 1162 | } else { |
| 1238 | __move_range(__p, this->__end_, __p + 1); | 1163 | __move_range(__p, __end, __p + 1); |
| 1239 | *__p = std::move(__x); | 1164 | *__p = std::move(__x); |
| 1240 | } | 1165 | } |
| 1241 | } else { | 1166 | } else { |
| 1242 | __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_); | 1167 | _SplitBuffer __v(__recommend(size() + 1), __p - this->__layout_.__begin_ptr(), this->__layout_.__alloc()); |
| 1243 | __v.emplace_back(std::move(__x)); | 1168 | __v.emplace_back(std::move(__x)); |
| 1244 | __p = __swap_out_circular_buffer(__v, __p); | 1169 | __p = __layout_.__relocate_with_pivot(__v, __p); |
| 1245 | } | 1170 | } |
| 1246 | return __make_iter(__p); | 1171 | return __make_iter(__p); |
| 1247 | } | 1172 | } |
| ... | @@ -1250,19 +1175,20 @@ template <class _Tp, class _Allocator> | ... | @@ -1250,19 +1175,20 @@ template <class _Tp, class _Allocator> |
| 1250 | template <class... _Args> | 1175 | template <class... _Args> |
| 1251 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator | 1176 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator |
| 1252 | vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) { | 1177 | vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) { |
| 1253 | pointer __p = this->__begin_ + (__position - begin()); | 1178 | pointer __p = this->__layout_.__begin_ptr() + (__position - begin()); |
| 1254 | if (this->__end_ < this->__cap_) { | 1179 | if (size() != capacity()) { |
| 1255 | if (__p == this->__end_) { | 1180 | pointer __end = __layout_.__end_ptr(); |
| 1181 | if (__p == __end) { | ||
| 1256 | __emplace_back_assume_capacity(std::forward<_Args>(__args)...); | 1182 | __emplace_back_assume_capacity(std::forward<_Args>(__args)...); |
| 1257 | } else { | 1183 | } else { |
| 1258 | __temp_value<value_type, _Allocator> __tmp(this->__alloc_, std::forward<_Args>(__args)...); | 1184 | __temp_value<value_type, _Allocator> __tmp(this->__layout_.__alloc(), std::forward<_Args>(__args)...); |
| 1259 | __move_range(__p, this->__end_, __p + 1); | 1185 | __move_range(__p, __end, __p + 1); |
| 1260 | *__p = std::move(__tmp.get()); | 1186 | *__p = std::move(__tmp.get()); |
| 1261 | } | 1187 | } |
| 1262 | } else { | 1188 | } else { |
| 1263 | __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_); | 1189 | _SplitBuffer __v(__recommend(size() + 1), __p - this->__layout_.__begin_ptr(), this->__layout_.__alloc()); |
| 1264 | __v.emplace_back(std::forward<_Args>(__args)...); | 1190 | __v.emplace_back(std::forward<_Args>(__args)...); |
| 1265 | __p = __swap_out_circular_buffer(__v, __p); | 1191 | __p = __layout_.__relocate_with_pivot(__v, __p); |
| 1266 | } | 1192 | } |
| 1267 | return __make_iter(__p); | 1193 | return __make_iter(__p); |
| 1268 | } | 1194 | } |
| ... | @@ -1270,27 +1196,28 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) { | ... | @@ -1270,27 +1196,28 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) { |
| 1270 | template <class _Tp, class _Allocator> | 1196 | template <class _Tp, class _Allocator> |
| 1271 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator | 1197 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator |
| 1272 | vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x) { | 1198 | vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x) { |
| 1273 | pointer __p = this->__begin_ + (__position - begin()); | 1199 | pointer __p = this->__layout_.__begin_ptr() + (__position - begin()); |
| 1274 | if (__n > 0) { | 1200 | if (__n > 0) { |
| 1275 | if (__n <= static_cast<size_type>(this->__cap_ - this->__end_)) { | 1201 | if (__n <= __layout_.__remaining_capacity()) { |
| 1276 | size_type __old_n = __n; | 1202 | size_type __old_n = __n; |
| 1277 | pointer __old_last = this->__end_; | 1203 | pointer __end = __layout_.__end_ptr(); |
| 1278 | if (__n > static_cast<size_type>(this->__end_ - __p)) { | 1204 | pointer __old_last = __end; |
| 1279 | size_type __cx = __n - (this->__end_ - __p); | 1205 | if (__n > static_cast<size_type>(__end - __p)) { |
| 1206 | size_type __cx = __n - (__end - __p); | ||
| 1280 | __construct_at_end(__cx, __x); | 1207 | __construct_at_end(__cx, __x); |
| 1281 | __n -= __cx; | 1208 | __n -= __cx; |
| 1282 | } | 1209 | } |
| 1283 | if (__n > 0) { | 1210 | if (__n > 0) { |
| 1284 | __move_range(__p, __old_last, __p + __old_n); | 1211 | __move_range(__p, __old_last, __p + __old_n); |
| 1285 | const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); | 1212 | const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); |
| 1286 | if (std::__is_pointer_in_range(std::__to_address(__p), std::__to_address(__end_), std::addressof(__x))) | 1213 | if (std::__is_pointer_in_range(std::__to_address(__p), std::__to_address(__end), std::addressof(__x))) |
| 1287 | __xr += __old_n; | 1214 | __xr += __old_n; |
| 1288 | std::fill_n(__p, __n, *__xr); | 1215 | std::fill_n(__p, __n, *__xr); |
| 1289 | } | 1216 | } |
| 1290 | } else { | 1217 | } else { |
| 1291 | __split_buffer<value_type, allocator_type> __v(__recommend(size() + __n), __p - this->__begin_, this->__alloc_); | 1218 | _SplitBuffer __v(__recommend(size() + __n), __p - this->__layout_.__begin_ptr(), this->__layout_.__alloc()); |
| 1292 | __v.__construct_at_end(__n, __x); | 1219 | __v.__construct_at_end(__n, __x); |
| 1293 | __p = __swap_out_circular_buffer(__v, __p); | 1220 | __p = __layout_.__relocate_with_pivot(__v, __p); |
| 1294 | } | 1221 | } |
| 1295 | } | 1222 | } |
| 1296 | return __make_iter(__p); | 1223 | return __make_iter(__p); |
| ... | @@ -1301,30 +1228,38 @@ template <class _InputIterator, class _Sentinel> | ... | @@ -1301,30 +1228,38 @@ template <class _InputIterator, class _Sentinel> |
| 1301 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator | 1228 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator |
| 1302 | vector<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last) { | 1229 | vector<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last) { |
| 1303 | difference_type __off = __position - begin(); | 1230 | difference_type __off = __position - begin(); |
| 1304 | pointer __p = this->__begin_ + __off; | 1231 | pointer __p = this->__layout_.__begin_ptr() + __off; |
| 1305 | pointer __old_last = this->__end_; | 1232 | pointer __old_last = __layout_.__end_ptr(); |
| 1306 | for (; this->__end_ != this->__cap_ && __first != __last; ++__first) | 1233 | for (; size() != capacity() && __first != __last; ++__first) |
| 1307 | __emplace_back_assume_capacity(*__first); | 1234 | __emplace_back_assume_capacity(*__first); |
| 1308 | 1235 | ||
| 1309 | if (__first == __last) | 1236 | if (__first == __last) |
| 1310 | (void)std::rotate(__p, __old_last, this->__end_); | 1237 | (void)std::rotate(__p, __old_last, __layout_.__end_ptr()); |
| 1311 | else { | 1238 | else { |
| 1312 | __split_buffer<value_type, allocator_type> __v(__alloc_); | 1239 | _SplitBuffer __v(__layout_.__alloc()); |
| 1313 | auto __guard = std::__make_exception_guard( | 1240 | pointer __end = __layout_.__end_ptr(); |
| 1314 | _AllocatorDestroyRangeReverse<allocator_type, pointer>(__alloc_, __old_last, this->__end_)); | 1241 | auto __guard = std::__make_exception_guard( |
| 1242 | _AllocatorDestroyRangeReverse<allocator_type, pointer>(__layout_.__alloc(), __old_last, __end)); | ||
| 1315 | __v.__construct_at_end_with_sentinel(std::move(__first), std::move(__last)); | 1243 | __v.__construct_at_end_with_sentinel(std::move(__first), std::move(__last)); |
| 1316 | __split_buffer<value_type, allocator_type> __merged( | 1244 | _SplitBuffer __merged( |
| 1317 | __recommend(size() + __v.size()), __off, __alloc_); // has `__off` positions available at the front | 1245 | __recommend(size() + __v.size()), __off, __layout_.__alloc()); // has `__off` positions available at the front |
| 1318 | std::__uninitialized_allocator_relocate( | 1246 | std::__uninitialized_allocator_relocate( |
| 1319 | __alloc_, std::__to_address(__old_last), std::__to_address(this->__end_), std::__to_address(__merged.end())); | 1247 | __layout_.__alloc(), |
| 1320 | __guard.__complete(); // Release the guard once objects in [__old_last_, __end_) have been successfully relocated. | 1248 | std::__to_address(__old_last), |
| 1321 | __merged.__set_sentinel(__merged.end() + (this->__end_ - __old_last)); | 1249 | std::__to_address(__layout_.__end_ptr()), |
| 1322 | this->__end_ = __old_last; | 1250 | std::__to_address(__merged.end())); |
| 1251 | __guard.__complete(); // Release the guard once objects in [__old_last_, __layout_.__end_ptr()) have been | ||
| 1252 | // successfully relocated. | ||
| 1253 | __merged.__set_sentinel(__merged.end() + (__layout_.__end_ptr() - __old_last)); | ||
| 1254 | __layout_.__set_bound_using_pointer(__old_last); | ||
| 1323 | std::__uninitialized_allocator_relocate( | 1255 | std::__uninitialized_allocator_relocate( |
| 1324 | __alloc_, std::__to_address(__v.begin()), std::__to_address(__v.end()), std::__to_address(__merged.end())); | 1256 | __layout_.__alloc(), |
| 1257 | std::__to_address(__v.begin()), | ||
| 1258 | std::__to_address(__v.end()), | ||
| 1259 | std::__to_address(__merged.end())); | ||
| 1325 | __merged.__set_sentinel(__merged.size() + __v.size()); | 1260 | __merged.__set_sentinel(__merged.size() + __v.size()); |
| 1326 | __v.__set_sentinel(__v.begin()); | 1261 | __v.__set_sentinel(__v.begin()); |
| 1327 | __p = __swap_out_circular_buffer(__merged, __p); | 1262 | __p = __layout_.__relocate_with_pivot(__merged, __p); |
| 1328 | } | 1263 | } |
| 1329 | return __make_iter(__p); | 1264 | return __make_iter(__p); |
| 1330 | } | 1265 | } |
| ... | @@ -1334,16 +1269,17 @@ template <class _AlgPolicy, class _Iterator, class _Sentinel> | ... | @@ -1334,16 +1269,17 @@ template <class _AlgPolicy, class _Iterator, class _Sentinel> |
| 1334 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator | 1269 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator |
| 1335 | vector<_Tp, _Allocator>::__insert_with_size( | 1270 | vector<_Tp, _Allocator>::__insert_with_size( |
| 1336 | const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n) { | 1271 | const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n) { |
| 1337 | pointer __p = this->__begin_ + (__position - begin()); | 1272 | pointer __p = this->__layout_.__begin_ptr() + (__position - begin()); |
| 1338 | if (__n > 0) { | 1273 | if (__n > 0) { |
| 1339 | if (__n <= this->__cap_ - this->__end_) { | 1274 | if (__n <= static_cast<difference_type>(__layout_.__remaining_capacity())) { |
| 1340 | pointer __old_last = this->__end_; | 1275 | pointer __end = __layout_.__end_ptr(); |
| 1341 | difference_type __dx = this->__end_ - __p; | 1276 | pointer __old_last = __end; |
| 1277 | difference_type __dx = __end - __p; | ||
| 1342 | if (__n > __dx) { | 1278 | if (__n > __dx) { |
| 1343 | #if _LIBCPP_STD_VER >= 23 | 1279 | #if _LIBCPP_STD_VER >= 23 |
| 1344 | if constexpr (!forward_iterator<_Iterator>) { | 1280 | if constexpr (!forward_iterator<_Iterator>) { |
| 1345 | __construct_at_end(std::move(__first), std::move(__last), __n); | 1281 | __construct_at_end(std::move(__first), std::move(__last), __n); |
| 1346 | std::rotate(__p, __old_last, this->__end_); | 1282 | std::rotate(__p, __old_last, __end); |
| 1347 | } else | 1283 | } else |
| 1348 | #endif | 1284 | #endif |
| 1349 | { | 1285 | { |
| ... | @@ -1359,9 +1295,9 @@ vector<_Tp, _Allocator>::__insert_with_size( | ... | @@ -1359,9 +1295,9 @@ vector<_Tp, _Allocator>::__insert_with_size( |
| 1359 | __insert_assign_n_unchecked<_AlgPolicy>(std::move(__first), __n, __p); | 1295 | __insert_assign_n_unchecked<_AlgPolicy>(std::move(__first), __n, __p); |
| 1360 | } | 1296 | } |
| 1361 | } else { | 1297 | } else { |
| 1362 | __split_buffer<value_type, allocator_type> __v(__recommend(size() + __n), __p - this->__begin_, this->__alloc_); | 1298 | _SplitBuffer __v(__recommend(size() + __n), __p - this->__layout_.__begin_ptr(), this->__layout_.__alloc()); |
| 1363 | __v.__construct_at_end_with_size(std::move(__first), __n); | 1299 | __v.__construct_at_end_with_size(std::move(__first), __n); |
| 1364 | __p = __swap_out_circular_buffer(__v, __p); | 1300 | __p = __layout_.__relocate_with_pivot(__v, __p); |
| 1365 | } | 1301 | } |
| 1366 | } | 1302 | } |
| 1367 | return __make_iter(__p); | 1303 | return __make_iter(__p); |
| ... | @@ -1374,12 +1310,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __n | ... | @@ -1374,12 +1310,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __n |
| 1374 | if (__new_size <= capacity()) { | 1310 | if (__new_size <= capacity()) { |
| 1375 | __construct_at_end(__new_size - __current_size); | 1311 | __construct_at_end(__new_size - __current_size); |
| 1376 | } else { | 1312 | } else { |
| 1377 | __split_buffer<value_type, allocator_type> __v(__recommend(__new_size), __current_size, __alloc_); | 1313 | _SplitBuffer __v(__recommend(__new_size), __current_size, __layout_.__alloc()); |
| 1378 | __v.__construct_at_end(__new_size - __current_size); | 1314 | __v.__construct_at_end(__new_size - __current_size); |
| 1379 | __swap_out_circular_buffer(__v); | 1315 | __layout_.__relocate(__v); |
| 1380 | } | 1316 | } |
| 1381 | } else if (__current_size > __new_size) { | 1317 | } else if (__current_size > __new_size) { |
| 1382 | this->__destruct_at_end(this->__begin_ + __new_size); | 1318 | this->__destruct_at_end(this->__layout_.__begin_ptr() + __new_size); |
| 1383 | } | 1319 | } |
| 1384 | } | 1320 | } |
| 1385 | 1321 | ||
| ... | @@ -1390,12 +1326,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __n | ... | @@ -1390,12 +1326,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __n |
| 1390 | if (__new_size <= capacity()) | 1326 | if (__new_size <= capacity()) |
| 1391 | __construct_at_end(__new_size - __current_size, __x); | 1327 | __construct_at_end(__new_size - __current_size, __x); |
| 1392 | else { | 1328 | else { |
| 1393 | __split_buffer<value_type, allocator_type> __v(__recommend(__new_size), __current_size, __alloc_); | 1329 | _SplitBuffer __v(__recommend(__new_size), __current_size, __layout_.__alloc()); |
| 1394 | __v.__construct_at_end(__new_size - __current_size, __x); | 1330 | __v.__construct_at_end(__new_size - __current_size, __x); |
| 1395 | __swap_out_circular_buffer(__v); | 1331 | __layout_.__relocate(__v); |
| 1396 | } | 1332 | } |
| 1397 | } else if (__current_size > __new_size) { | 1333 | } else if (__current_size > __new_size) { |
| 1398 | this->__destruct_at_end(this->__begin_ + __new_size); | 1334 | this->__destruct_at_end(this->__layout_.__begin_ptr() + __new_size); |
| 1399 | } | 1335 | } |
| 1400 | } | 1336 | } |
| 1401 | 1337 | ||
| ... | @@ -1408,29 +1344,10 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::swap(vector& __x) | ... | @@ -1408,29 +1344,10 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::swap(vector& __x) |
| 1408 | #endif | 1344 | #endif |
| 1409 | { | 1345 | { |
| 1410 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 1346 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1411 | __alloc_traits::propagate_on_container_swap::value || this->__alloc_ == __x.__alloc_, | 1347 | __alloc_traits::propagate_on_container_swap::value || __layout_.__alloc() == __x.__layout_.__alloc(), |
| 1412 | "vector::swap: Either propagate_on_container_swap must be true" | 1348 | "vector::swap: Either propagate_on_container_swap must be true" |
| 1413 | " or the allocators must compare equal"); | 1349 | " or the allocators must compare equal"); |
| 1414 | std::swap(this->__begin_, __x.__begin_); | 1350 | __layout_.__swap(__x.__layout_); |
| 1415 | std::swap(this->__end_, __x.__end_); | ||
| 1416 | std::swap(this->__cap_, __x.__cap_); | ||
| 1417 | std::__swap_allocator(this->__alloc_, __x.__alloc_); | ||
| 1418 | } | ||
| 1419 | |||
| 1420 | template <class _Tp, class _Allocator> | ||
| 1421 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool vector<_Tp, _Allocator>::__invariants() const { | ||
| 1422 | if (this->__begin_ == nullptr) { | ||
| 1423 | if (this->__end_ != nullptr || this->__cap_ != nullptr) | ||
| 1424 | return false; | ||
| 1425 | } else { | ||
| 1426 | if (this->__begin_ > this->__end_) | ||
| 1427 | return false; | ||
| 1428 | if (this->__begin_ == this->__cap_) | ||
| 1429 | return false; | ||
| 1430 | if (this->__end_ > this->__cap_) | ||
| 1431 | return false; | ||
| 1432 | } | ||
| 1433 | return true; | ||
| 1434 | } | 1351 | } |
| 1435 | 1352 | ||
| 1436 | #if _LIBCPP_STD_VER >= 20 | 1353 | #if _LIBCPP_STD_VER >= 20 |
lib/libcxx/include/__vector/vector_bool.h+10-20| ... | @@ -45,6 +45,7 @@ | ... | @@ -45,6 +45,7 @@ |
| 45 | #include <__type_traits/is_nothrow_constructible.h> | 45 | #include <__type_traits/is_nothrow_constructible.h> |
| 46 | #include <__type_traits/type_identity.h> | 46 | #include <__type_traits/type_identity.h> |
| 47 | #include <__utility/exception_guard.h> | 47 | #include <__utility/exception_guard.h> |
| 48 | #include <__utility/exchange.h> | ||
| 48 | #include <__utility/forward.h> | 49 | #include <__utility/forward.h> |
| 49 | #include <__utility/move.h> | 50 | #include <__utility/move.h> |
| 50 | #include <__utility/swap.h> | 51 | #include <__utility/swap.h> |
| ... | @@ -151,9 +152,7 @@ public: | ... | @@ -151,9 +152,7 @@ public: |
| 151 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~vector() { __destroy_vector (*this)(); } | 152 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~vector() { __destroy_vector (*this)(); } |
| 152 | 153 | ||
| 153 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n); | 154 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n); |
| 154 | #if _LIBCPP_STD_VER >= 14 | ||
| 155 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n, const allocator_type& __a); | 155 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n, const allocator_type& __a); |
| 156 | #endif | ||
| 157 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v); | 156 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v); |
| 158 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | 157 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 |
| 159 | vector(size_type __n, const value_type& __v, const allocator_type& __a); | 158 | vector(size_type __n, const value_type& __v, const allocator_type& __a); |
| ... | @@ -604,7 +603,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n) | ... | @@ -604,7 +603,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n) |
| 604 | } | 603 | } |
| 605 | } | 604 | } |
| 606 | 605 | ||
| 607 | #if _LIBCPP_STD_VER >= 14 | ||
| 608 | template <class _Allocator> | 606 | template <class _Allocator> |
| 609 | _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a) | 607 | _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a) |
| 610 | : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) { | 608 | : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) { |
| ... | @@ -614,7 +612,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, co | ... | @@ -614,7 +612,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, co |
| 614 | __size_ = __n; | 612 | __size_ = __n; |
| 615 | } | 613 | } |
| 616 | } | 614 | } |
| 617 | #endif | ||
| 618 | 615 | ||
| 619 | template <class _Allocator> | 616 | template <class _Allocator> |
| 620 | _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const value_type& __x) | 617 | _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const value_type& __x) |
| ... | @@ -740,13 +737,10 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocat | ... | @@ -740,13 +737,10 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocat |
| 740 | #else | 737 | #else |
| 741 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) | 738 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) |
| 742 | #endif | 739 | #endif |
| 743 | : __begin_(__v.__begin_), | 740 | : __begin_(std::__exchange(__v.__begin_, nullptr)), |
| 744 | __size_(__v.__size_), | 741 | __size_(std::__exchange(__v.__size_, 0)), |
| 745 | __cap_(__v.__cap_), | 742 | __cap_(std::__exchange(__v.__cap_, 0)), |
| 746 | __alloc_(std::move(__v.__alloc_)) { | 743 | __alloc_(std::move(__v.__alloc_)) { |
| 747 | __v.__begin_ = nullptr; | ||
| 748 | __v.__size_ = 0; | ||
| 749 | __v.__cap_ = 0; | ||
| 750 | } | 744 | } |
| 751 | 745 | ||
| 752 | template <class _Allocator> | 746 | template <class _Allocator> |
| ... | @@ -754,11 +748,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 | ... | @@ -754,11 +748,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 |
| 754 | vector<bool, _Allocator>::vector(vector&& __v, const __type_identity_t<allocator_type>& __a) | 748 | vector<bool, _Allocator>::vector(vector&& __v, const __type_identity_t<allocator_type>& __a) |
| 755 | : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(__a) { | 749 | : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(__a) { |
| 756 | if (__a == allocator_type(__v.__alloc_)) { | 750 | if (__a == allocator_type(__v.__alloc_)) { |
| 757 | this->__begin_ = __v.__begin_; | 751 | __begin_ = std::__exchange(__v.__begin_, nullptr); |
| 758 | this->__size_ = __v.__size_; | 752 | __size_ = std::__exchange(__v.__size_, 0); |
| 759 | this->__cap_ = __v.__cap_; | 753 | __cap_ = std::__exchange(__v.__cap_, 0); |
| 760 | __v.__begin_ = nullptr; | ||
| 761 | __v.__cap_ = __v.__size_ = 0; | ||
| 762 | } else if (__v.size() > 0) { | 754 | } else if (__v.size() > 0) { |
| 763 | __vallocate(__v.size()); | 755 | __vallocate(__v.size()); |
| 764 | __size_ = __v.__size_; | 756 | __size_ = __v.__size_; |
| ... | @@ -787,11 +779,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::__move_assign(vecto | ... | @@ -787,11 +779,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::__move_assign(vecto |
| 787 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) { | 779 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) { |
| 788 | __vdeallocate(); | 780 | __vdeallocate(); |
| 789 | __move_assign_alloc(__c); | 781 | __move_assign_alloc(__c); |
| 790 | this->__begin_ = __c.__begin_; | 782 | __begin_ = std::__exchange(__c.__begin_, nullptr); |
| 791 | this->__size_ = __c.__size_; | 783 | __size_ = std::__exchange(__c.__size_, 0); |
| 792 | this->__cap_ = __c.__cap_; | 784 | __cap_ = std::__exchange(__c.__cap_, 0); |
| 793 | __c.__begin_ = nullptr; | ||
| 794 | __c.__cap_ = __c.__size_ = 0; | ||
| 795 | } | 785 | } |
| 796 | 786 | ||
| 797 | template <class _Allocator> | 787 | template <class _Allocator> |
lib/libcxx/include/__verbose_abort+2| ... | @@ -20,8 +20,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -20,8 +20,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | ||
| 21 | // This function should never be called directly from the code -- it should only be called through | 21 | // This function should never be called directly from the code -- it should only be called through |
| 22 | // the _LIBCPP_VERBOSE_ABORT macro. | 22 | // the _LIBCPP_VERBOSE_ABORT macro. |
| 23 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 23 | [[__noreturn__]] _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT( | 24 | [[__noreturn__]] _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT( |
| 24 | __printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...) _NOEXCEPT; | 25 | __printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...) _NOEXCEPT; |
| 26 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 25 | 27 | ||
| 26 | // _LIBCPP_VERBOSE_ABORT(format, args...) | 28 | // _LIBCPP_VERBOSE_ABORT(format, args...) |
| 27 | // | 29 | // |
lib/libcxx/include/__verbose_trap+1-12| ... | @@ -16,21 +16,10 @@ | ... | @@ -16,21 +16,10 @@ |
| 16 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 20 | |||
| 21 | #if __has_builtin(__builtin_verbose_trap) | 19 | #if __has_builtin(__builtin_verbose_trap) |
| 22 | // AppleClang shipped a slightly different version of __builtin_verbose_trap from the upstream | 20 | # define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap("libc++", message) |
| 23 | // version before upstream Clang actually got the builtin. | ||
| 24 | // TODO: Remove once AppleClang supports the two-arguments version of the builtin. | ||
| 25 | # if defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1700 | ||
| 26 | # define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap(message) | ||
| 27 | # else | ||
| 28 | # define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap("libc++", message) | ||
| 29 | # endif | ||
| 30 | #else | 21 | #else |
| 31 | # define _LIBCPP_VERBOSE_TRAP(message) ((void)message, __builtin_trap()) | 22 | # define _LIBCPP_VERBOSE_TRAP(message) ((void)message, __builtin_trap()) |
| 32 | #endif | 23 | #endif |
| 33 | 24 | ||
| 34 | _LIBCPP_END_NAMESPACE_STD | ||
| 35 | |||
| 36 | #endif // _LIBCPP___VERBOSE_TRAP | 25 | #endif // _LIBCPP___VERBOSE_TRAP |
lib/libcxx/include/algorithm+57-2| ... | @@ -883,6 +883,13 @@ namespace ranges { | ... | @@ -883,6 +883,13 @@ namespace ranges { |
| 883 | uniform_random_bit_generator<remove_reference_t<Gen>> | 883 | uniform_random_bit_generator<remove_reference_t<Gen>> |
| 884 | O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20 | 884 | O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20 |
| 885 | 885 | ||
| 886 | template<permutable I, sentinel_for<I> S> | ||
| 887 | constexpr subrange<I> ranges::shift_left(I first, S last, iter_difference_t<I> n); // since C++23 | ||
| 888 | |||
| 889 | template<forward_range R> | ||
| 890 | requires permutable<iterator_t<R>> | ||
| 891 | constexpr borrowed_subrange_t<R> ranges::shift_left(R&& r, range_difference_t<R> n) // since C++23 | ||
| 892 | |||
| 886 | template<random_access_iterator I, sentinel_for<I> S, class Gen> | 893 | template<random_access_iterator I, sentinel_for<I> S, class Gen> |
| 887 | requires permutable<I> && | 894 | requires permutable<I> && |
| 888 | uniform_random_bit_generator<remove_reference_t<Gen>> | 895 | uniform_random_bit_generator<remove_reference_t<Gen>> |
| ... | @@ -944,6 +951,33 @@ namespace ranges { | ... | @@ -944,6 +951,33 @@ namespace ranges { |
| 944 | template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F> | 951 | template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F> |
| 945 | constexpr auto fold_left(R&& r, T init, F f); // since C++23 | 952 | constexpr auto fold_left(R&& r, T init, F f); // since C++23 |
| 946 | 953 | ||
| 954 | template<input_iterator I, sentinel_for<I> S, | ||
| 955 | indirectly-binary-left-foldable<iter_value_t<I>, I> F> | ||
| 956 | requires constructible_from<iter_value_t<I>, iter_reference_t<I>> | ||
| 957 | constexpr auto ranges::fold_left_first(I first, S last, F f); // since C++23 | ||
| 958 | |||
| 959 | template<input_range R, indirectly-binary-left-foldable<range_value_t<R>, iterator_t<R>> F> | ||
| 960 | requires constructible_from<range_value_t<R>, range_reference_t<R>> | ||
| 961 | constexpr auto ranges::fold_left_first(R&& r, F f); // since C++23 | ||
| 962 | |||
| 963 | template<bidirectional_iterator I, sentinel_for<I> S, class T = iter_value_t<I>, | ||
| 964 | indirectly-binary-right-foldable<T, I> F> | ||
| 965 | constexpr auto ranges::fold_right(I first, S last, T init, F f); // since C++23 | ||
| 966 | |||
| 967 | template<bidirectional_range R, class T = range_value_t<R>, | ||
| 968 | indirectly-binary-right-foldable<T, iterator_t<R>> F> | ||
| 969 | constexpr auto ranges::fold_right(R&& r, T init, F f); // since C++23 | ||
| 970 | |||
| 971 | template<bidirectional_iterator I, sentinel_for<I> S, | ||
| 972 | indirectly-binary-right-foldable<iter_value_t<I>, I> F> | ||
| 973 | requires constructible_from<iter_value_t<I>, iter_reference_t<I>> | ||
| 974 | constexpr auto ranges::fold_right_last(I first, S last, F f); // since C++23 | ||
| 975 | |||
| 976 | template<bidirectional_range R, | ||
| 977 | indirectly-binary-right-foldable<range_value_t<R>, iterator_t<R>> F> | ||
| 978 | requires constructible_from<range_value_t<R>, range_reference_t<R>> | ||
| 979 | constexpr auto ranges::fold_right_last(R&& r, F f); // since C++23 | ||
| 980 | |||
| 947 | template<class I, class T> | 981 | template<class I, class T> |
| 948 | using fold_left_with_iter_result = in_value_result<I, T>; // since C++23 | 982 | using fold_left_with_iter_result = in_value_result<I, T>; // since C++23 |
| 949 | 983 | ||
| ... | @@ -954,6 +988,18 @@ namespace ranges { | ... | @@ -954,6 +988,18 @@ namespace ranges { |
| 954 | template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F> | 988 | template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F> |
| 955 | constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23 | 989 | constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23 |
| 956 | 990 | ||
| 991 | template<class I, class T> | ||
| 992 | using fold_left_first_with_iter_result = in_value_result<I, T>; // since C++23 | ||
| 993 | |||
| 994 | template<input_iterator I, sentinel_for<I> S, | ||
| 995 | indirectly-binary-left-foldable<iter_value_t<I>, I> F> | ||
| 996 | requires constructible_from<iter_value_t<I>, iter_reference_t<I>> | ||
| 997 | constexpr see below ranges::fold_left_first_with_iter(I first, S last, F f); // since C++23 | ||
| 998 | |||
| 999 | template<input_range R, indirectly-binary-left-foldable<range_value_t<R>, iterator_t<R>> F> | ||
| 1000 | requires constructible_from<range_value_t<R>, range_reference_t<R>> | ||
| 1001 | constexpr see below ranges::fold_left_first_with_iter(R&& r, F f); // since C++23 | ||
| 1002 | |||
| 957 | template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, | 1003 | template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, |
| 958 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> | 1004 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 959 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> | 1005 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| ... | @@ -1489,6 +1535,13 @@ template<class ForwardIterator> | ... | @@ -1489,6 +1535,13 @@ template<class ForwardIterator> |
| 1489 | shift_right(ForwardIterator first, ForwardIterator last, | 1535 | shift_right(ForwardIterator first, ForwardIterator last, |
| 1490 | typename iterator_traits<ForwardIterator>::difference_type n); // C++20 | 1536 | typename iterator_traits<ForwardIterator>::difference_type n); // C++20 |
| 1491 | 1537 | ||
| 1538 | template<permutable I, sentinel_for<I> S> | ||
| 1539 | constexpr subrange<I> ranges::shift_right(I first, S last, iter_difference_t<I> n); // since C++23 | ||
| 1540 | |||
| 1541 | template<forward_range R> | ||
| 1542 | requires permutable<iterator_t<R>> | ||
| 1543 | constexpr borrowed_subrange_t<R> ranges::shift_right(R&& r, range_difference_t<R> n) // since C++23 | ||
| 1544 | |||
| 1492 | template <class InputIterator, class Predicate> | 1545 | template <class InputIterator, class Predicate> |
| 1493 | constexpr bool // constexpr since C++20 | 1546 | constexpr bool // constexpr since C++20 |
| 1494 | is_partitioned(InputIterator first, InputIterator last, Predicate pred); | 1547 | is_partitioned(InputIterator first, InputIterator last, Predicate pred); |
| ... | @@ -2035,6 +2088,8 @@ template <class BidirectionalIterator, class Compare> | ... | @@ -2035,6 +2088,8 @@ template <class BidirectionalIterator, class Compare> |
| 2035 | # include <__algorithm/ranges_ends_with.h> | 2088 | # include <__algorithm/ranges_ends_with.h> |
| 2036 | # include <__algorithm/ranges_find_last.h> | 2089 | # include <__algorithm/ranges_find_last.h> |
| 2037 | # include <__algorithm/ranges_fold.h> | 2090 | # include <__algorithm/ranges_fold.h> |
| 2091 | # include <__algorithm/ranges_shift_left.h> | ||
| 2092 | # include <__algorithm/ranges_shift_right.h> | ||
| 2038 | # include <__algorithm/ranges_starts_with.h> | 2093 | # include <__algorithm/ranges_starts_with.h> |
| 2039 | # endif // _LIBCPP_STD_VER >= 23 | 2094 | # endif // _LIBCPP_STD_VER >= 23 |
| 2040 | 2095 | ||
| ... | @@ -2049,11 +2104,11 @@ template <class BidirectionalIterator, class Compare> | ... | @@ -2049,11 +2104,11 @@ template <class BidirectionalIterator, class Compare> |
| 2049 | # pragma GCC system_header | 2104 | # pragma GCC system_header |
| 2050 | # endif | 2105 | # endif |
| 2051 | 2106 | ||
| 2052 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14 | 2107 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER == 14 |
| 2053 | # include <execution> | 2108 | # include <execution> |
| 2054 | # endif | 2109 | # endif |
| 2055 | 2110 | ||
| 2056 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 2111 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 2057 | # include <atomic> | 2112 | # include <atomic> |
| 2058 | # include <bit> | 2113 | # include <bit> |
| 2059 | # include <concepts> | 2114 | # include <concepts> |
lib/libcxx/include/any+11-9| ... | @@ -120,16 +120,20 @@ _LIBCPP_PUSH_MACROS | ... | @@ -120,16 +120,20 @@ _LIBCPP_PUSH_MACROS |
| 120 | # include <__undef_macros> | 120 | # include <__undef_macros> |
| 121 | 121 | ||
| 122 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD | 122 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD |
| 123 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 124 | |||
| 123 | class _LIBCPP_EXPORTED_FROM_ABI bad_any_cast : public bad_cast { | 125 | class _LIBCPP_EXPORTED_FROM_ABI bad_any_cast : public bad_cast { |
| 124 | public: | 126 | public: |
| 125 | const char* what() const _NOEXCEPT override; | 127 | const char* what() const _NOEXCEPT override; |
| 126 | }; | 128 | }; |
| 127 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | ||
| 128 | 129 | ||
| 129 | _LIBCPP_BEGIN_NAMESPACE_STD | 130 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS |
| 131 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | ||
| 130 | 132 | ||
| 131 | # if _LIBCPP_STD_VER >= 17 | 133 | # if _LIBCPP_STD_VER >= 17 |
| 132 | 134 | ||
| 135 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 136 | |||
| 133 | [[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_any_cast() { | 137 | [[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_any_cast() { |
| 134 | # if _LIBCPP_HAS_EXCEPTIONS | 138 | # if _LIBCPP_HAS_EXCEPTIONS |
| 135 | throw bad_any_cast(); | 139 | throw bad_any_cast(); |
| ... | @@ -522,8 +526,6 @@ template <class _ValueType> | ... | @@ -522,8 +526,6 @@ template <class _ValueType> |
| 522 | 526 | ||
| 523 | template <class _ValueType> | 527 | template <class _ValueType> |
| 524 | [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) noexcept { | 528 | [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) noexcept { |
| 525 | static_assert(!is_void_v<_ValueType>, "_ValueType may not be void."); | ||
| 526 | static_assert(!is_reference_v<_ValueType>, "_ValueType may not be a reference."); | ||
| 527 | return std::any_cast<_ValueType>(const_cast<any*>(__any)); | 529 | return std::any_cast<_ValueType>(const_cast<any*>(__any)); |
| 528 | } | 530 | } |
| 529 | 531 | ||
| ... | @@ -550,17 +552,17 @@ template <class _ValueType> | ... | @@ -550,17 +552,17 @@ template <class _ValueType> |
| 550 | return nullptr; | 552 | return nullptr; |
| 551 | } | 553 | } |
| 552 | 554 | ||
| 553 | # endif // _LIBCPP_STD_VER >= 17 | ||
| 554 | |||
| 555 | _LIBCPP_END_NAMESPACE_STD | 555 | _LIBCPP_END_NAMESPACE_STD |
| 556 | 556 | ||
| 557 | # endif // _LIBCPP_STD_VER >= 17 | ||
| 558 | |||
| 557 | _LIBCPP_POP_MACROS | 559 | _LIBCPP_POP_MACROS |
| 558 | 560 | ||
| 559 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 | 561 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 17 |
| 560 | # include <chrono> | 562 | # include <chrono> |
| 561 | # endif | 563 | # endif |
| 562 | 564 | ||
| 563 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 565 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 564 | # include <atomic> | 566 | # include <atomic> |
| 565 | # include <concepts> | 567 | # include <concepts> |
| 566 | # include <cstdlib> | 568 | # include <cstdlib> |
| ... | @@ -572,7 +574,7 @@ _LIBCPP_POP_MACROS | ... | @@ -572,7 +574,7 @@ _LIBCPP_POP_MACROS |
| 572 | # include <variant> | 574 | # include <variant> |
| 573 | # endif | 575 | # endif |
| 574 | 576 | ||
| 575 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23 | 577 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 576 | # include <cstring> | 578 | # include <cstring> |
| 577 | # include <limits> | 579 | # include <limits> |
| 578 | # endif | 580 | # endif |
lib/libcxx/include/array+1-1| ... | @@ -594,7 +594,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -594,7 +594,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 594 | 594 | ||
| 595 | _LIBCPP_POP_MACROS | 595 | _LIBCPP_POP_MACROS |
| 596 | 596 | ||
| 597 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 597 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 598 | # include <algorithm> | 598 | # include <algorithm> |
| 599 | # include <concepts> | 599 | # include <concepts> |
| 600 | # include <cstdlib> | 600 | # include <cstdlib> |
lib/libcxx/include/atomic+1-5| ... | @@ -626,11 +626,7 @@ template <class T> | ... | @@ -626,11 +626,7 @@ template <class T> |
| 626 | # pragma GCC system_header | 626 | # pragma GCC system_header |
| 627 | # endif | 627 | # endif |
| 628 | 628 | ||
| 629 | # if !_LIBCPP_HAS_ATOMIC_HEADER | 629 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 630 | # error <atomic> is not implemented | ||
| 631 | # endif | ||
| 632 | |||
| 633 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | ||
| 634 | # include <cmath> | 630 | # include <cmath> |
| 635 | # include <compare> | 631 | # include <compare> |
| 636 | # include <cstddef> | 632 | # include <cstddef> |
lib/libcxx/include/barrier+3-1| ... | @@ -95,6 +95,7 @@ using __barrier_phase_t _LIBCPP_NODEBUG = uint8_t; | ... | @@ -95,6 +95,7 @@ using __barrier_phase_t _LIBCPP_NODEBUG = uint8_t; |
| 95 | 95 | ||
| 96 | class __barrier_algorithm_base; | 96 | class __barrier_algorithm_base; |
| 97 | 97 | ||
| 98 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 98 | [[__gnu__::__returns_nonnull__, __gnu__::__malloc__]] | 99 | [[__gnu__::__returns_nonnull__, __gnu__::__malloc__]] |
| 99 | _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* __construct_barrier_algorithm_base(ptrdiff_t& __expected); | 100 | _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* __construct_barrier_algorithm_base(ptrdiff_t& __expected); |
| 100 | 101 | ||
| ... | @@ -104,6 +105,7 @@ __arrive_barrier_algorithm_base([[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barr | ... | @@ -104,6 +105,7 @@ __arrive_barrier_algorithm_base([[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barr |
| 104 | 105 | ||
| 105 | _LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base( | 106 | _LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base( |
| 106 | [[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier) noexcept; | 107 | [[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier) noexcept; |
| 108 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 107 | 109 | ||
| 108 | template <class _CompletionF> | 110 | template <class _CompletionF> |
| 109 | class __barrier_base { | 111 | class __barrier_base { |
| ... | @@ -190,7 +192,7 @@ _LIBCPP_POP_MACROS | ... | @@ -190,7 +192,7 @@ _LIBCPP_POP_MACROS |
| 190 | 192 | ||
| 191 | # endif // _LIBCPP_HAS_THREADS | 193 | # endif // _LIBCPP_HAS_THREADS |
| 192 | 194 | ||
| 193 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 195 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 194 | # include <atomic> | 196 | # include <atomic> |
| 195 | # include <concepts> | 197 | # include <concepts> |
| 196 | # include <iterator> | 198 | # include <iterator> |
lib/libcxx/include/bit+1-1| ... | @@ -90,7 +90,7 @@ namespace std { | ... | @@ -90,7 +90,7 @@ namespace std { |
| 90 | # pragma GCC system_header | 90 | # pragma GCC system_header |
| 91 | # endif | 91 | # endif |
| 92 | 92 | ||
| 93 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 93 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 94 | # include <cstdlib> | 94 | # include <cstdlib> |
| 95 | # include <iosfwd> | 95 | # include <iosfwd> |
| 96 | # include <limits> | 96 | # include <limits> |
lib/libcxx/include/bitset+1-1| ... | @@ -971,7 +971,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -971,7 +971,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 971 | 971 | ||
| 972 | _LIBCPP_POP_MACROS | 972 | _LIBCPP_POP_MACROS |
| 973 | 973 | ||
| 974 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 974 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 975 | # include <concepts> | 975 | # include <concepts> |
| 976 | # include <cstdlib> | 976 | # include <cstdlib> |
| 977 | # include <optional> | 977 | # include <optional> |
lib/libcxx/include/cctype+5-63| ... | @@ -39,13 +39,11 @@ int toupper(int c); | ... | @@ -39,13 +39,11 @@ int toupper(int c); |
| 39 | #else | 39 | #else |
| 40 | # include <__config> | 40 | # include <__config> |
| 41 | 41 | ||
| 42 | # include <ctype.h> | 42 | # if __has_include(<ctype.h>) |
| 43 | 43 | # include <ctype.h> | |
| 44 | # ifndef _LIBCPP_CTYPE_H | 44 | # ifdef _LIBCPP_CTYPE_H |
| 45 | # error <cctype> tried including <ctype.h> but didn't find libc++'s <ctype.h> header. \ | 45 | # error "If libc++ starts defining <ctype.h>, the __has_include check should move to libc++'s <ctype.h>" |
| 46 | This usually means that your header search paths are not configured properly. \ | 46 | # endif |
| 47 | The header search paths should contain the C++ Standard Library headers before \ | ||
| 48 | any C Standard Library. | ||
| 49 | # endif | 47 | # endif |
| 50 | 48 | ||
| 51 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 49 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | @@ -54,62 +52,6 @@ int toupper(int c); | ... | @@ -54,62 +52,6 @@ int toupper(int c); |
| 54 | 52 | ||
| 55 | _LIBCPP_BEGIN_NAMESPACE_STD | 53 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 56 | 54 | ||
| 57 | # ifdef isalnum | ||
| 58 | # undef isalnum | ||
| 59 | # endif | ||
| 60 | |||
| 61 | # ifdef isalpha | ||
| 62 | # undef isalpha | ||
| 63 | # endif | ||
| 64 | |||
| 65 | # ifdef isblank | ||
| 66 | # undef isblank | ||
| 67 | # endif | ||
| 68 | |||
| 69 | # ifdef iscntrl | ||
| 70 | # undef iscntrl | ||
| 71 | # endif | ||
| 72 | |||
| 73 | # ifdef isdigit | ||
| 74 | # undef isdigit | ||
| 75 | # endif | ||
| 76 | |||
| 77 | # ifdef isgraph | ||
| 78 | # undef isgraph | ||
| 79 | # endif | ||
| 80 | |||
| 81 | # ifdef islower | ||
| 82 | # undef islower | ||
| 83 | # endif | ||
| 84 | |||
| 85 | # ifdef isprint | ||
| 86 | # undef isprint | ||
| 87 | # endif | ||
| 88 | |||
| 89 | # ifdef ispunct | ||
| 90 | # undef ispunct | ||
| 91 | # endif | ||
| 92 | |||
| 93 | # ifdef isspace | ||
| 94 | # undef isspace | ||
| 95 | # endif | ||
| 96 | |||
| 97 | # ifdef isupper | ||
| 98 | # undef isupper | ||
| 99 | # endif | ||
| 100 | |||
| 101 | # ifdef isxdigit | ||
| 102 | # undef isxdigit | ||
| 103 | # endif | ||
| 104 | |||
| 105 | # ifdef tolower | ||
| 106 | # undef tolower | ||
| 107 | # endif | ||
| 108 | |||
| 109 | # ifdef toupper | ||
| 110 | # undef toupper | ||
| 111 | # endif | ||
| 112 | |||
| 113 | using ::isalnum _LIBCPP_USING_IF_EXISTS; | 55 | using ::isalnum _LIBCPP_USING_IF_EXISTS; |
| 114 | using ::isalpha _LIBCPP_USING_IF_EXISTS; | 56 | using ::isalpha _LIBCPP_USING_IF_EXISTS; |
| 115 | using ::isblank _LIBCPP_USING_IF_EXISTS; | 57 | using ::isblank _LIBCPP_USING_IF_EXISTS; |
lib/libcxx/include/cfenv+5-8| ... | @@ -57,14 +57,11 @@ int feupdateenv(const fenv_t* envp); | ... | @@ -57,14 +57,11 @@ int feupdateenv(const fenv_t* envp); |
| 57 | #else | 57 | #else |
| 58 | # include <__config> | 58 | # include <__config> |
| 59 | 59 | ||
| 60 | # include <fenv.h> | 60 | # if __has_include(<fenv.h>) |
| 61 | 61 | # include <fenv.h> | |
| 62 | # ifndef _LIBCPP_FENV_H | 62 | # ifdef _LIBCPP_FENV_H |
| 63 | # error <cfenv> tried including <fenv.h> but didn't find libc++'s <fenv.h> header. \ | 63 | # error "If libc++ starts defining <fenv.h>, the __has_include check should move to libc++'s <fenv.h>" |
| 64 | This usually means that your header search paths are not configured properly. \ | 64 | # endif |
| 65 | The header search paths should contain the C++ Standard Library headers before \ | ||
| 66 | any C Standard Library, and you are probably using compiler flags that make that \ | ||
| 67 | not be the case. | ||
| 68 | # endif | 65 | # endif |
| 69 | 66 | ||
| 70 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 67 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
lib/libcxx/include/cfloat+6-8| ... | @@ -74,14 +74,12 @@ Macros: | ... | @@ -74,14 +74,12 @@ Macros: |
| 74 | #else | 74 | #else |
| 75 | # include <__config> | 75 | # include <__config> |
| 76 | 76 | ||
| 77 | # include <float.h> | 77 | // <float.h> is not provided by libc++ |
| 78 | 78 | # if __has_include(<float.h>) | |
| 79 | # ifndef _LIBCPP_FLOAT_H | 79 | # include <float.h> |
| 80 | # error <cfloat> tried including <float.h> but didn't find libc++'s <float.h> header. \ | 80 | # ifdef _LIBCPP_FLOAT_H |
| 81 | This usually means that your header search paths are not configured properly. \ | 81 | # error "If libc++ starts defining <float.h>, the __has_include check should move to libc++'s <float.h>" |
| 82 | The header search paths should contain the C++ Standard Library headers before \ | 82 | # endif |
| 83 | any C Standard Library, and you are probably using compiler flags that make that \ | ||
| 84 | not be the case. | ||
| 85 | # endif | 83 | # endif |
| 86 | 84 | ||
| 87 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 85 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
lib/libcxx/include/charconv+1-5| ... | @@ -100,11 +100,7 @@ namespace std { | ... | @@ -100,11 +100,7 @@ namespace std { |
| 100 | # pragma GCC system_header | 100 | # pragma GCC system_header |
| 101 | # endif | 101 | # endif |
| 102 | 102 | ||
| 103 | _LIBCPP_BEGIN_NAMESPACE_STD | 103 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 104 | |||
| 105 | _LIBCPP_END_NAMESPACE_STD | ||
| 106 | |||
| 107 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | ||
| 108 | # include <cmath> | 104 | # include <cmath> |
| 109 | # include <concepts> | 105 | # include <concepts> |
| 110 | # include <cstddef> | 106 | # include <cstddef> |
lib/libcxx/include/chrono+4-3| ... | @@ -46,6 +46,7 @@ public: | ... | @@ -46,6 +46,7 @@ public: |
| 46 | template <class Rep, class Period = ratio<1>> | 46 | template <class Rep, class Period = ratio<1>> |
| 47 | class duration | 47 | class duration |
| 48 | { | 48 | { |
| 49 | static_assert(__is_unqualified_v<Rep>, "A duration representation cannot be qualified"); | ||
| 49 | static_assert(!__is_duration<Rep>::value, "A duration representation can not be a duration"); | 50 | static_assert(!__is_duration<Rep>::value, "A duration representation can not be a duration"); |
| 50 | static_assert(__is_ratio<Period>::value, "Second template parameter of duration must be a std::ratio"); | 51 | static_assert(__is_ratio<Period>::value, "Second template parameter of duration must be a std::ratio"); |
| 51 | static_assert(Period::num > 0, "duration period must be positive"); | 52 | static_assert(Period::num > 0, "duration period must be positive"); |
| ... | @@ -1148,13 +1149,13 @@ namespace std { | ... | @@ -1148,13 +1149,13 @@ namespace std { |
| 1148 | # pragma GCC system_header | 1149 | # pragma GCC system_header |
| 1149 | # endif | 1150 | # endif |
| 1150 | 1151 | ||
| 1151 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 | 1152 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 17 |
| 1152 | # include <cstdint> | 1153 | # include <cstdint> |
| 1153 | # include <stdexcept> | 1154 | # include <stdexcept> |
| 1154 | # include <string_view> | 1155 | # include <string_view> |
| 1155 | # endif | 1156 | # endif |
| 1156 | 1157 | ||
| 1157 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1158 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1158 | # include <bit> | 1159 | # include <bit> |
| 1159 | # include <concepts> | 1160 | # include <concepts> |
| 1160 | # include <cstring> | 1161 | # include <cstring> |
| ... | @@ -1164,7 +1165,7 @@ namespace std { | ... | @@ -1164,7 +1165,7 @@ namespace std { |
| 1164 | # include <vector> | 1165 | # include <vector> |
| 1165 | # endif | 1166 | # endif |
| 1166 | 1167 | ||
| 1167 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 20 | 1168 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER == 20 |
| 1168 | # include <charconv> | 1169 | # include <charconv> |
| 1169 | # if _LIBCPP_HAS_LOCALIZATION | 1170 | # if _LIBCPP_HAS_LOCALIZATION |
| 1170 | # include <locale> | 1171 | # include <locale> |
lib/libcxx/include/cinttypes+5-8| ... | @@ -244,14 +244,11 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int | ... | @@ -244,14 +244,11 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int |
| 244 | // [cinttypes.syn] | 244 | // [cinttypes.syn] |
| 245 | # include <cstdint> | 245 | # include <cstdint> |
| 246 | 246 | ||
| 247 | # include <inttypes.h> | 247 | # if __has_include(<inttypes.h>) |
| 248 | 248 | # include <inttypes.h> | |
| 249 | # ifndef _LIBCPP_INTTYPES_H | 249 | # ifdef _LIBCPP_INTTYPES_H |
| 250 | # error <cinttypes> tried including <inttypes.h> but didn't find libc++'s <inttypes.h> header. \ | 250 | # error "If libc++ starts defining <inttypes.h>, the __has_include check should move to libc++'s <float.h>" |
| 251 | This usually means that your header search paths are not configured properly. \ | 251 | # endif |
| 252 | The header search paths should contain the C++ Standard Library headers before \ | ||
| 253 | any C Standard Library, and you are probably using compiler flags that make that \ | ||
| 254 | not be the case. | ||
| 255 | # endif | 252 | # endif |
| 256 | 253 | ||
| 257 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 254 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
lib/libcxx/include/cmath+1-1| ... | @@ -612,7 +612,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -612,7 +612,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 612 | 612 | ||
| 613 | _LIBCPP_POP_MACROS | 613 | _LIBCPP_POP_MACROS |
| 614 | 614 | ||
| 615 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 615 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 616 | # include <type_traits> | 616 | # include <type_traits> |
| 617 | # endif | 617 | # endif |
| 618 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 618 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/codecvt+3-1| ... | @@ -71,6 +71,7 @@ class codecvt_utf8_utf16 | ... | @@ -71,6 +71,7 @@ class codecvt_utf8_utf16 |
| 71 | # if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT) | 71 | # if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT) |
| 72 | 72 | ||
| 73 | _LIBCPP_BEGIN_NAMESPACE_STD | 73 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 74 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 74 | 75 | ||
| 75 | enum _LIBCPP_DEPRECATED_IN_CXX17 codecvt_mode { consume_header = 4, generate_header = 2, little_endian = 1 }; | 76 | enum _LIBCPP_DEPRECATED_IN_CXX17 codecvt_mode { consume_header = 4, generate_header = 2, little_endian = 1 }; |
| 76 | 77 | ||
| ... | @@ -579,13 +580,14 @@ public: | ... | @@ -579,13 +580,14 @@ public: |
| 579 | }; | 580 | }; |
| 580 | _LIBCPP_SUPPRESS_DEPRECATED_POP | 581 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 581 | 582 | ||
| 583 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 582 | _LIBCPP_END_NAMESPACE_STD | 584 | _LIBCPP_END_NAMESPACE_STD |
| 583 | 585 | ||
| 584 | # endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT) | 586 | # endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT) |
| 585 | 587 | ||
| 586 | # endif // _LIBCPP_HAS_LOCALIZATION | 588 | # endif // _LIBCPP_HAS_LOCALIZATION |
| 587 | 589 | ||
| 588 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 590 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 589 | # include <atomic> | 591 | # include <atomic> |
| 590 | # include <concepts> | 592 | # include <concepts> |
| 591 | # include <cstddef> | 593 | # include <cstddef> |
lib/libcxx/include/compare+1-1| ... | @@ -167,7 +167,7 @@ namespace std { | ... | @@ -167,7 +167,7 @@ namespace std { |
| 167 | # pragma GCC system_header | 167 | # pragma GCC system_header |
| 168 | # endif | 168 | # endif |
| 169 | 169 | ||
| 170 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 170 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 171 | # include <cmath> | 171 | # include <cmath> |
| 172 | # include <cstddef> | 172 | # include <cstddef> |
| 173 | # include <type_traits> | 173 | # include <type_traits> |
lib/libcxx/include/complex+1-1| ... | @@ -1484,7 +1484,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -1484,7 +1484,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 1484 | 1484 | ||
| 1485 | _LIBCPP_POP_MACROS | 1485 | _LIBCPP_POP_MACROS |
| 1486 | 1486 | ||
| 1487 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1487 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1488 | # include <iosfwd> | 1488 | # include <iosfwd> |
| 1489 | # include <stdexcept> | 1489 | # include <stdexcept> |
| 1490 | # include <type_traits> | 1490 | # include <type_traits> |
lib/libcxx/include/concepts+1-1| ... | @@ -161,7 +161,7 @@ namespace std { | ... | @@ -161,7 +161,7 @@ namespace std { |
| 161 | 161 | ||
| 162 | # include <version> | 162 | # include <version> |
| 163 | 163 | ||
| 164 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 164 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 165 | # include <cstddef> | 165 | # include <cstddef> |
| 166 | # include <type_traits> | 166 | # include <type_traits> |
| 167 | # endif | 167 | # endif |
lib/libcxx/include/condition_variable+6-1| ... | @@ -146,6 +146,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -146,6 +146,7 @@ _LIBCPP_PUSH_MACROS |
| 146 | # if _LIBCPP_HAS_THREADS | 146 | # if _LIBCPP_HAS_THREADS |
| 147 | 147 | ||
| 148 | _LIBCPP_BEGIN_NAMESPACE_STD | 148 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 149 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 149 | 150 | ||
| 150 | template <class _Lock> | 151 | template <class _Lock> |
| 151 | struct __unlock_guard { | 152 | struct __unlock_guard { |
| ... | @@ -342,14 +343,18 @@ bool condition_variable_any::wait_for( | ... | @@ -342,14 +343,18 @@ bool condition_variable_any::wait_for( |
| 342 | 343 | ||
| 343 | _LIBCPP_EXPORTED_FROM_ABI void notify_all_at_thread_exit(condition_variable&, unique_lock<mutex>); | 344 | _LIBCPP_EXPORTED_FROM_ABI void notify_all_at_thread_exit(condition_variable&, unique_lock<mutex>); |
| 344 | 345 | ||
| 346 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 345 | _LIBCPP_END_NAMESPACE_STD | 347 | _LIBCPP_END_NAMESPACE_STD |
| 346 | 348 | ||
| 347 | # endif // _LIBCPP_HAS_THREADS | 349 | # endif // _LIBCPP_HAS_THREADS |
| 348 | 350 | ||
| 349 | _LIBCPP_POP_MACROS | 351 | _LIBCPP_POP_MACROS |
| 350 | 352 | ||
| 351 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 353 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 352 | # include <atomic> | 354 | # include <atomic> |
| 355 | # endif | ||
| 356 | |||
| 357 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 | ||
| 353 | # include <concepts> | 358 | # include <concepts> |
| 354 | # include <cstdint> | 359 | # include <cstdint> |
| 355 | # include <cstdlib> | 360 | # include <cstdlib> |
lib/libcxx/include/coroutine+1-1| ... | @@ -61,7 +61,7 @@ struct suspend_always; | ... | @@ -61,7 +61,7 @@ struct suspend_always; |
| 61 | # pragma GCC system_header | 61 | # pragma GCC system_header |
| 62 | # endif | 62 | # endif |
| 63 | 63 | ||
| 64 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 64 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 65 | # include <cstddef> | 65 | # include <cstddef> |
| 66 | # include <iosfwd> | 66 | # include <iosfwd> |
| 67 | # include <limits> | 67 | # include <limits> |
lib/libcxx/include/ctype.h deleted-65| ... | @@ -1,65 +0,0 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP_CTYPE_H | ||
| 11 | #define _LIBCPP_CTYPE_H | ||
| 12 | |||
| 13 | /* | ||
| 14 | ctype.h synopsis | ||
| 15 | |||
| 16 | int isalnum(int c); | ||
| 17 | int isalpha(int c); | ||
| 18 | int isblank(int c); // C99 | ||
| 19 | int iscntrl(int c); | ||
| 20 | int isdigit(int c); | ||
| 21 | int isgraph(int c); | ||
| 22 | int islower(int c); | ||
| 23 | int isprint(int c); | ||
| 24 | int ispunct(int c); | ||
| 25 | int isspace(int c); | ||
| 26 | int isupper(int c); | ||
| 27 | int isxdigit(int c); | ||
| 28 | int tolower(int c); | ||
| 29 | int toupper(int c); | ||
| 30 | */ | ||
| 31 | |||
| 32 | #if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | ||
| 33 | # include <__cxx03/__config> | ||
| 34 | #else | ||
| 35 | # include <__config> | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 39 | # pragma GCC system_header | ||
| 40 | #endif | ||
| 41 | |||
| 42 | #if __has_include_next(<ctype.h>) | ||
| 43 | # include_next <ctype.h> | ||
| 44 | #endif | ||
| 45 | |||
| 46 | #ifdef __cplusplus | ||
| 47 | |||
| 48 | # undef isalnum | ||
| 49 | # undef isalpha | ||
| 50 | # undef isblank | ||
| 51 | # undef iscntrl | ||
| 52 | # undef isdigit | ||
| 53 | # undef isgraph | ||
| 54 | # undef islower | ||
| 55 | # undef isprint | ||
| 56 | # undef ispunct | ||
| 57 | # undef isspace | ||
| 58 | # undef isupper | ||
| 59 | # undef isxdigit | ||
| 60 | # undef tolower | ||
| 61 | # undef toupper | ||
| 62 | |||
| 63 | #endif | ||
| 64 | |||
| 65 | #endif // _LIBCPP_CTYPE_H | ||
lib/libcxx/include/cuchar+4-4| ... | @@ -56,10 +56,10 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps); | ... | @@ -56,10 +56,10 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps); |
| 56 | # pragma GCC system_header | 56 | # pragma GCC system_header |
| 57 | # endif | 57 | # endif |
| 58 | 58 | ||
| 59 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 60 | |||
| 61 | # if !defined(_LIBCPP_CXX03_LANG) | 59 | # if !defined(_LIBCPP_CXX03_LANG) |
| 62 | 60 | ||
| 61 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 62 | |||
| 63 | using ::mbstate_t _LIBCPP_USING_IF_EXISTS; | 63 | using ::mbstate_t _LIBCPP_USING_IF_EXISTS; |
| 64 | 64 | ||
| 65 | # if _LIBCPP_HAS_C8RTOMB_MBRTOC8 | 65 | # if _LIBCPP_HAS_C8RTOMB_MBRTOC8 |
| ... | @@ -71,10 +71,10 @@ using ::c16rtomb _LIBCPP_USING_IF_EXISTS; | ... | @@ -71,10 +71,10 @@ using ::c16rtomb _LIBCPP_USING_IF_EXISTS; |
| 71 | using ::mbrtoc32 _LIBCPP_USING_IF_EXISTS; | 71 | using ::mbrtoc32 _LIBCPP_USING_IF_EXISTS; |
| 72 | using ::c32rtomb _LIBCPP_USING_IF_EXISTS; | 72 | using ::c32rtomb _LIBCPP_USING_IF_EXISTS; |
| 73 | 73 | ||
| 74 | # endif // _LIBCPP_CXX03_LANG | ||
| 75 | |||
| 76 | _LIBCPP_END_NAMESPACE_STD | 74 | _LIBCPP_END_NAMESPACE_STD |
| 77 | 75 | ||
| 76 | # endif // _LIBCPP_CXX03_LANG | ||
| 77 | |||
| 78 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 78 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 79 | 79 | ||
| 80 | #endif // _LIBCPP_CUCHAR | 80 | #endif // _LIBCPP_CUCHAR |
lib/libcxx/include/cwchar+1-1| ... | @@ -258,7 +258,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __constexpr_wmemchr(_Tp | ... | @@ -258,7 +258,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __constexpr_wmemchr(_Tp |
| 258 | 258 | ||
| 259 | _LIBCPP_END_NAMESPACE_STD | 259 | _LIBCPP_END_NAMESPACE_STD |
| 260 | 260 | ||
| 261 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 261 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 262 | # include <cstddef> | 262 | # include <cstddef> |
| 263 | # endif | 263 | # endif |
| 264 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 264 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/deque+45-31| ... | @@ -40,7 +40,7 @@ public: | ... | @@ -40,7 +40,7 @@ public: |
| 40 | deque() noexcept(is_nothrow_default_constructible<allocator_type>::value); | 40 | deque() noexcept(is_nothrow_default_constructible<allocator_type>::value); |
| 41 | explicit deque(const allocator_type& a); | 41 | explicit deque(const allocator_type& a); |
| 42 | explicit deque(size_type n); | 42 | explicit deque(size_type n); |
| 43 | explicit deque(size_type n, const allocator_type& a); // C++14 | 43 | explicit deque(size_type n, const allocator_type& a); |
| 44 | deque(size_type n, const value_type& v); | 44 | deque(size_type n, const value_type& v); |
| 45 | deque(size_type n, const value_type& v, const allocator_type& a); | 45 | deque(size_type n, const value_type& v, const allocator_type& a); |
| 46 | template <class InputIterator> | 46 | template <class InputIterator> |
| ... | @@ -263,10 +263,17 @@ _LIBCPP_PUSH_MACROS | ... | @@ -263,10 +263,17 @@ _LIBCPP_PUSH_MACROS |
| 263 | 263 | ||
| 264 | _LIBCPP_BEGIN_NAMESPACE_STD | 264 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 265 | 265 | ||
| 266 | # ifndef _LIBCPP_ABI_USE_SMALL_DEQUE_BLOCK_SIZE | ||
| 266 | template <class _ValueType, class _DiffType> | 267 | template <class _ValueType, class _DiffType> |
| 267 | struct __deque_block_size { | 268 | struct __deque_block_size { |
| 268 | static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16; | 269 | static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16; |
| 269 | }; | 270 | }; |
| 271 | # else | ||
| 272 | template <class _ValueType, class _DiffType> | ||
| 273 | struct __deque_block_size { | ||
| 274 | static const _DiffType value = sizeof(_ValueType) < 128 ? 512 / sizeof(_ValueType) : 4; | ||
| 275 | }; | ||
| 276 | # endif | ||
| 270 | 277 | ||
| 271 | template <class _ValueType, | 278 | template <class _ValueType, |
| 272 | class _Pointer, | 279 | class _Pointer, |
| ... | @@ -283,7 +290,18 @@ template <class _ValueType, | ... | @@ -283,7 +290,18 @@ template <class _ValueType, |
| 283 | # endif | 290 | # endif |
| 284 | > | 291 | > |
| 285 | class __deque_iterator { | 292 | class __deque_iterator { |
| 286 | typedef _MapPointer __map_iterator; | 293 | using __map_iterator _LIBCPP_NODEBUG = __rebind_pointer_t<_Pointer, const __rebind_pointer_t<_Pointer, _ValueType> >; |
| 294 | |||
| 295 | // TODO(LLVM 25): Remove this check | ||
| 296 | # ifndef _LIBCPP_ABI_DEQUE_ITERATORS | ||
| 297 | static_assert( | ||
| 298 | sizeof(__map_iterator) == sizeof(_MapPointer) && _LIBCPP_ALIGNOF(__map_iterator) == _LIBCPP_ALIGNOF(_MapPointer), | ||
| 299 | "It looks like you are using fancy pointers such that FancyPtr<const FancyPtr<const value_type>> is not " | ||
| 300 | "layout-compatible with FancyPtr<FancyPtr<value_type>> or FancyPtr<const FancyPtr<value_type>>. " | ||
| 301 | "This means that your ABI is being broken between LLVM 22 and LLVM 23 if deque::iterator or " | ||
| 302 | "deque::const_iterator is used. If you don't care about your ABI being broken, define the " | ||
| 303 | "_LIBCPP_ABI_DEQUE_ITERATORS macro to silence this diagnostic."); | ||
| 304 | # endif | ||
| 287 | 305 | ||
| 288 | public: | 306 | public: |
| 289 | typedef _Pointer pointer; | 307 | typedef _Pointer pointer; |
| ... | @@ -459,7 +477,7 @@ private: | ... | @@ -459,7 +477,7 @@ private: |
| 459 | __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, _DiffType, _BlockSize>; | 477 | __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, _DiffType, _BlockSize>; |
| 460 | 478 | ||
| 461 | public: | 479 | public: |
| 462 | using __segment_iterator _LIBCPP_NODEBUG = _MapPointer; | 480 | using __segment_iterator _LIBCPP_NODEBUG = typename _Iterator::__map_iterator; |
| 463 | using __local_iterator _LIBCPP_NODEBUG = _Pointer; | 481 | using __local_iterator _LIBCPP_NODEBUG = _Pointer; |
| 464 | 482 | ||
| 465 | static _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_Iterator __iter) { return __iter.__m_iter_; } | 483 | static _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_Iterator __iter) { return __iter.__m_iter_; } |
| ... | @@ -626,9 +644,7 @@ public: | ... | @@ -626,9 +644,7 @@ public: |
| 626 | } | 644 | } |
| 627 | 645 | ||
| 628 | explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n); | 646 | explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n); |
| 629 | # if _LIBCPP_STD_VER >= 14 | ||
| 630 | explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const _Allocator& __a); | 647 | explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const _Allocator& __a); |
| 631 | # endif | ||
| 632 | _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v); | 648 | _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v); |
| 633 | 649 | ||
| 634 | template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0> | 650 | template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0> |
| ... | @@ -725,24 +741,24 @@ public: | ... | @@ -725,24 +741,24 @@ public: |
| 725 | // iterators: | 741 | // iterators: |
| 726 | 742 | ||
| 727 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { | 743 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { |
| 728 | __map_pointer __mp = __map_.begin() + __start_ / __block_size; | 744 | auto __mp = __map_.begin() + __start_ / __block_size; |
| 729 | return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); | 745 | return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); |
| 730 | } | 746 | } |
| 731 | 747 | ||
| 732 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { | 748 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { |
| 733 | __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size); | 749 | auto __mp = __map_.begin() + __start_ / __block_size; |
| 734 | return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); | 750 | return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); |
| 735 | } | 751 | } |
| 736 | 752 | ||
| 737 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { | 753 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { |
| 738 | size_type __p = size() + __start_; | 754 | size_type __p = size() + __start_; |
| 739 | __map_pointer __mp = __map_.begin() + __p / __block_size; | 755 | auto __mp = __map_.begin() + __p / __block_size; |
| 740 | return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); | 756 | return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); |
| 741 | } | 757 | } |
| 742 | 758 | ||
| 743 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { | 759 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { |
| 744 | size_type __p = size() + __start_; | 760 | size_type __p = size() + __start_; |
| 745 | __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size); | 761 | auto __mp = __map_.begin() + __p / __block_size; |
| 746 | return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); | 762 | return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); |
| 747 | } | 763 | } |
| 748 | 764 | ||
| ... | @@ -953,7 +969,7 @@ private: | ... | @@ -953,7 +969,7 @@ private: |
| 953 | (void)__end; | 969 | (void)__end; |
| 954 | (void)__annotation_type; | 970 | (void)__annotation_type; |
| 955 | (void)__place; | 971 | (void)__place; |
| 956 | # if __has_feature(address_sanitizer) | 972 | # if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 957 | // __beg - index of the first item to annotate | 973 | // __beg - index of the first item to annotate |
| 958 | // __end - index behind the last item to annotate (so last item + 1) | 974 | // __end - index behind the last item to annotate (so last item + 1) |
| 959 | // __annotation_type - __asan_unposion or __asan_poison | 975 | // __annotation_type - __asan_unposion or __asan_poison |
| ... | @@ -1046,23 +1062,23 @@ private: | ... | @@ -1046,23 +1062,23 @@ private: |
| 1046 | std::__annotate_double_ended_contiguous_container<_Allocator>( | 1062 | std::__annotate_double_ended_contiguous_container<_Allocator>( |
| 1047 | __mem_beg, __mem_end, __old_beg, __old_end, __new_beg, __new_end); | 1063 | __mem_beg, __mem_end, __old_beg, __old_end, __new_beg, __new_end); |
| 1048 | } | 1064 | } |
| 1049 | # endif // __has_feature(address_sanitizer) | 1065 | # endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1050 | } | 1066 | } |
| 1051 | 1067 | ||
| 1052 | _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT { | 1068 | _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT { |
| 1053 | (void)__current_size; | 1069 | (void)__current_size; |
| 1054 | # if __has_feature(address_sanitizer) | 1070 | # if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1055 | if (__current_size == 0) | 1071 | if (__current_size == 0) |
| 1056 | __annotate_from_to(0, __map_.size() * __block_size, __asan_poison, __asan_back_moved); | 1072 | __annotate_from_to(0, __map_.size() * __block_size, __asan_poison, __asan_back_moved); |
| 1057 | else { | 1073 | else { |
| 1058 | __annotate_from_to(0, __start_, __asan_poison, __asan_front_moved); | 1074 | __annotate_from_to(0, __start_, __asan_poison, __asan_front_moved); |
| 1059 | __annotate_from_to(__start_ + __current_size, __map_.size() * __block_size, __asan_poison, __asan_back_moved); | 1075 | __annotate_from_to(__start_ + __current_size, __map_.size() * __block_size, __asan_poison, __asan_back_moved); |
| 1060 | } | 1076 | } |
| 1061 | # endif // __has_feature(address_sanitizer) | 1077 | # endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1062 | } | 1078 | } |
| 1063 | 1079 | ||
| 1064 | _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT { | 1080 | _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT { |
| 1065 | # if __has_feature(address_sanitizer) | 1081 | # if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1066 | if (empty()) { | 1082 | if (empty()) { |
| 1067 | for (size_t __i = 0; __i < __map_.size(); ++__i) { | 1083 | for (size_t __i = 0; __i < __map_.size(); ++__i) { |
| 1068 | __annotate_whole_block(__i, __asan_unposion); | 1084 | __annotate_whole_block(__i, __asan_unposion); |
| ... | @@ -1071,19 +1087,19 @@ private: | ... | @@ -1071,19 +1087,19 @@ private: |
| 1071 | __annotate_from_to(0, __start_, __asan_unposion, __asan_front_moved); | 1087 | __annotate_from_to(0, __start_, __asan_unposion, __asan_front_moved); |
| 1072 | __annotate_from_to(__start_ + size(), __map_.size() * __block_size, __asan_unposion, __asan_back_moved); | 1088 | __annotate_from_to(__start_ + size(), __map_.size() * __block_size, __asan_unposion, __asan_back_moved); |
| 1073 | } | 1089 | } |
| 1074 | # endif // __has_feature(address_sanitizer) | 1090 | # endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1075 | } | 1091 | } |
| 1076 | 1092 | ||
| 1077 | _LIBCPP_HIDE_FROM_ABI void __annotate_increase_front(size_type __n) const _NOEXCEPT { | 1093 | _LIBCPP_HIDE_FROM_ABI void __annotate_increase_front(size_type __n) const _NOEXCEPT { |
| 1078 | (void)__n; | 1094 | (void)__n; |
| 1079 | # if __has_feature(address_sanitizer) | 1095 | # if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1080 | __annotate_from_to(__start_ - __n, __start_, __asan_unposion, __asan_front_moved); | 1096 | __annotate_from_to(__start_ - __n, __start_, __asan_unposion, __asan_front_moved); |
| 1081 | # endif | 1097 | # endif |
| 1082 | } | 1098 | } |
| 1083 | 1099 | ||
| 1084 | _LIBCPP_HIDE_FROM_ABI void __annotate_increase_back(size_type __n) const _NOEXCEPT { | 1100 | _LIBCPP_HIDE_FROM_ABI void __annotate_increase_back(size_type __n) const _NOEXCEPT { |
| 1085 | (void)__n; | 1101 | (void)__n; |
| 1086 | # if __has_feature(address_sanitizer) | 1102 | # if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1087 | __annotate_from_to(__start_ + size(), __start_ + size() + __n, __asan_unposion, __asan_back_moved); | 1103 | __annotate_from_to(__start_ + size(), __start_ + size() + __n, __asan_unposion, __asan_back_moved); |
| 1088 | # endif | 1104 | # endif |
| 1089 | } | 1105 | } |
| ... | @@ -1091,7 +1107,7 @@ private: | ... | @@ -1091,7 +1107,7 @@ private: |
| 1091 | _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_front(size_type __old_size, size_type __old_start) const _NOEXCEPT { | 1107 | _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_front(size_type __old_size, size_type __old_start) const _NOEXCEPT { |
| 1092 | (void)__old_size; | 1108 | (void)__old_size; |
| 1093 | (void)__old_start; | 1109 | (void)__old_start; |
| 1094 | # if __has_feature(address_sanitizer) | 1110 | # if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1095 | __annotate_from_to(__old_start, __old_start + (__old_size - size()), __asan_poison, __asan_front_moved); | 1111 | __annotate_from_to(__old_start, __old_start + (__old_size - size()), __asan_poison, __asan_front_moved); |
| 1096 | # endif | 1112 | # endif |
| 1097 | } | 1113 | } |
| ... | @@ -1099,7 +1115,7 @@ private: | ... | @@ -1099,7 +1115,7 @@ private: |
| 1099 | _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_back(size_type __old_size, size_type __old_start) const _NOEXCEPT { | 1115 | _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_back(size_type __old_size, size_type __old_start) const _NOEXCEPT { |
| 1100 | (void)__old_size; | 1116 | (void)__old_size; |
| 1101 | (void)__old_start; | 1117 | (void)__old_start; |
| 1102 | # if __has_feature(address_sanitizer) | 1118 | # if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1103 | __annotate_from_to(__old_start + size(), __old_start + __old_size, __asan_poison, __asan_back_moved); | 1119 | __annotate_from_to(__old_start + size(), __old_start + __old_size, __asan_poison, __asan_back_moved); |
| 1104 | # endif | 1120 | # endif |
| 1105 | } | 1121 | } |
| ... | @@ -1112,7 +1128,7 @@ private: | ... | @@ -1112,7 +1128,7 @@ private: |
| 1112 | __annotate_whole_block(size_t __block_index, __asan_annotation_type __annotation_type) const _NOEXCEPT { | 1128 | __annotate_whole_block(size_t __block_index, __asan_annotation_type __annotation_type) const _NOEXCEPT { |
| 1113 | (void)__block_index; | 1129 | (void)__block_index; |
| 1114 | (void)__annotation_type; | 1130 | (void)__annotation_type; |
| 1115 | # if __has_feature(address_sanitizer) | 1131 | # if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1116 | __map_const_iterator __block_it = __map_.begin() + __block_index; | 1132 | __map_const_iterator __block_it = __map_.begin() + __block_index; |
| 1117 | const void* __block_start = std::__to_address(*__block_it); | 1133 | const void* __block_start = std::__to_address(*__block_it); |
| 1118 | const void* __block_end = std::__to_address(*__block_it + __block_size); | 1134 | const void* __block_end = std::__to_address(*__block_it + __block_size); |
| ... | @@ -1125,7 +1141,7 @@ private: | ... | @@ -1125,7 +1141,7 @@ private: |
| 1125 | } | 1141 | } |
| 1126 | # endif | 1142 | # endif |
| 1127 | } | 1143 | } |
| 1128 | # if __has_feature(address_sanitizer) | 1144 | # if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1129 | 1145 | ||
| 1130 | public: | 1146 | public: |
| 1131 | _LIBCPP_HIDE_FROM_ABI bool __verify_asan_annotations() const _NOEXCEPT { | 1147 | _LIBCPP_HIDE_FROM_ABI bool __verify_asan_annotations() const _NOEXCEPT { |
| ... | @@ -1187,7 +1203,7 @@ public: | ... | @@ -1187,7 +1203,7 @@ public: |
| 1187 | } | 1203 | } |
| 1188 | 1204 | ||
| 1189 | private: | 1205 | private: |
| 1190 | # endif // __has_feature(address_sanitizer) | 1206 | # endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS |
| 1191 | _LIBCPP_HIDE_FROM_ABI bool __maybe_remove_front_spare(bool __keep_one = true) { | 1207 | _LIBCPP_HIDE_FROM_ABI bool __maybe_remove_front_spare(bool __keep_one = true) { |
| 1192 | if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) { | 1208 | if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) { |
| 1193 | __annotate_whole_block(0, __asan_unposion); | 1209 | __annotate_whole_block(0, __asan_unposion); |
| ... | @@ -1305,7 +1321,6 @@ deque<_Tp, _Allocator>::deque(size_type __n) : __start_(0), __size_(0) { | ... | @@ -1305,7 +1321,6 @@ deque<_Tp, _Allocator>::deque(size_type __n) : __start_(0), __size_(0) { |
| 1305 | __append(__n); | 1321 | __append(__n); |
| 1306 | } | 1322 | } |
| 1307 | 1323 | ||
| 1308 | # if _LIBCPP_STD_VER >= 14 | ||
| 1309 | template <class _Tp, class _Allocator> | 1324 | template <class _Tp, class _Allocator> |
| 1310 | deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a) | 1325 | deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a) |
| 1311 | : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { | 1326 | : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { |
| ... | @@ -1313,7 +1328,6 @@ deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a) | ... | @@ -1313,7 +1328,6 @@ deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a) |
| 1313 | if (__n > 0) | 1328 | if (__n > 0) |
| 1314 | __append(__n); | 1329 | __append(__n); |
| 1315 | } | 1330 | } |
| 1316 | # endif | ||
| 1317 | 1331 | ||
| 1318 | template <class _Tp, class _Allocator> | 1332 | template <class _Tp, class _Allocator> |
| 1319 | deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) : __start_(0), __size_(0) { | 1333 | deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) : __start_(0), __size_(0) { |
| ... | @@ -2220,7 +2234,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __ | ... | @@ -2220,7 +2234,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __ |
| 2220 | __fe = __fb + __bs; | 2234 | __fe = __fb + __bs; |
| 2221 | } | 2235 | } |
| 2222 | if (__fb <= __vt && __vt < __fe) | 2236 | if (__fb <= __vt && __vt < __fe) |
| 2223 | __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_; | 2237 | __vt = (const_iterator(__f.__m_iter_, __vt) -= __f - __r).__ptr_; |
| 2224 | __r = std::move(__fb, __fe, __r); | 2238 | __r = std::move(__fb, __fe, __r); |
| 2225 | __n -= __bs; | 2239 | __n -= __bs; |
| 2226 | __f += __bs; | 2240 | __f += __bs; |
| ... | @@ -2247,7 +2261,7 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it | ... | @@ -2247,7 +2261,7 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it |
| 2247 | __lb = __le - __bs; | 2261 | __lb = __le - __bs; |
| 2248 | } | 2262 | } |
| 2249 | if (__lb <= __vt && __vt < __le) | 2263 | if (__lb <= __vt && __vt < __le) |
| 2250 | __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_; | 2264 | __vt = (const_iterator(__l.__m_iter_, __vt) += __r - __l - 1).__ptr_; |
| 2251 | __r = std::move_backward(__lb, __le, __r); | 2265 | __r = std::move_backward(__lb, __le, __r); |
| 2252 | __n -= __bs; | 2266 | __n -= __bs; |
| 2253 | __l -= __bs - 1; | 2267 | __l -= __bs - 1; |
| ... | @@ -2273,7 +2287,7 @@ void deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator _ | ... | @@ -2273,7 +2287,7 @@ void deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator _ |
| 2273 | __fe = __fb + __bs; | 2287 | __fe = __fb + __bs; |
| 2274 | } | 2288 | } |
| 2275 | if (__fb <= __vt && __vt < __fe) | 2289 | if (__fb <= __vt && __vt < __fe) |
| 2276 | __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_; | 2290 | __vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_; |
| 2277 | for (; __fb != __fe; ++__fb, ++__r, ++__size()) | 2291 | for (; __fb != __fe; ++__fb, ++__r, ++__size()) |
| 2278 | __alloc_traits::construct(__a, std::addressof(*__r), std::move(*__fb)); | 2292 | __alloc_traits::construct(__a, std::addressof(*__r), std::move(*__fb)); |
| 2279 | __n -= __bs; | 2293 | __n -= __bs; |
| ... | @@ -2305,7 +2319,7 @@ void deque<_Tp, _Allocator>::__move_construct_backward_and_check( | ... | @@ -2305,7 +2319,7 @@ void deque<_Tp, _Allocator>::__move_construct_backward_and_check( |
| 2305 | __lb = __le - __bs; | 2319 | __lb = __le - __bs; |
| 2306 | } | 2320 | } |
| 2307 | if (__lb <= __vt && __vt < __le) | 2321 | if (__lb <= __vt && __vt < __le) |
| 2308 | __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_; | 2322 | __vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_; |
| 2309 | while (__le != __lb) { | 2323 | while (__le != __lb) { |
| 2310 | __alloc_traits::construct(__a, std::addressof(*--__r), std::move(*--__le)); | 2324 | __alloc_traits::construct(__a, std::addressof(*--__r), std::move(*--__le)); |
| 2311 | --__start_; | 2325 | --__start_; |
| ... | @@ -2532,7 +2546,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -2532,7 +2546,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 2532 | 2546 | ||
| 2533 | _LIBCPP_POP_MACROS | 2547 | _LIBCPP_POP_MACROS |
| 2534 | 2548 | ||
| 2535 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 2549 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 2536 | # include <algorithm> | 2550 | # include <algorithm> |
| 2537 | # include <atomic> | 2551 | # include <atomic> |
| 2538 | # include <concepts> | 2552 | # include <concepts> |
lib/libcxx/include/exception+2-2| ... | @@ -91,13 +91,13 @@ template <class E> void rethrow_if_nested(const E& e); | ... | @@ -91,13 +91,13 @@ template <class E> void rethrow_if_nested(const E& e); |
| 91 | # pragma GCC system_header | 91 | # pragma GCC system_header |
| 92 | # endif | 92 | # endif |
| 93 | 93 | ||
| 94 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 94 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 95 | # include <cstddef> | 95 | # include <cstddef> |
| 96 | # include <new> | 96 | # include <new> |
| 97 | # include <type_traits> | 97 | # include <type_traits> |
| 98 | # endif | 98 | # endif |
| 99 | 99 | ||
| 100 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23 | 100 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 101 | # include <cstdlib> | 101 | # include <cstdlib> |
| 102 | # endif | 102 | # endif |
| 103 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 103 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/execution+1-1| ... | @@ -155,7 +155,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -155,7 +155,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 155 | 155 | ||
| 156 | # endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 | 156 | # endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 |
| 157 | 157 | ||
| 158 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 158 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 159 | # include <cstddef> | 159 | # include <cstddef> |
| 160 | # endif | 160 | # endif |
| 161 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 161 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/experimental/iterator+2-2| ... | @@ -124,14 +124,14 @@ _LIBCPP_END_NAMESPACE_LFTS | ... | @@ -124,14 +124,14 @@ _LIBCPP_END_NAMESPACE_LFTS |
| 124 | 124 | ||
| 125 | _LIBCPP_POP_MACROS | 125 | _LIBCPP_POP_MACROS |
| 126 | 126 | ||
| 127 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 127 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 128 | # include <cstddef> | 128 | # include <cstddef> |
| 129 | # include <iosfwd> | 129 | # include <iosfwd> |
| 130 | # include <optional> | 130 | # include <optional> |
| 131 | # include <type_traits> | 131 | # include <type_traits> |
| 132 | # endif | 132 | # endif |
| 133 | 133 | ||
| 134 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23 | 134 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 135 | # include <locale> | 135 | # include <locale> |
| 136 | # endif | 136 | # endif |
| 137 | 137 |
lib/libcxx/include/experimental/memory+5-7| ... | @@ -70,10 +70,10 @@ public: | ... | @@ -70,10 +70,10 @@ public: |
| 70 | 70 | ||
| 71 | # ifdef _LIBCPP_ENABLE_EXPERIMENTAL | 71 | # ifdef _LIBCPP_ENABLE_EXPERIMENTAL |
| 72 | 72 | ||
| 73 | _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 | ||
| 74 | |||
| 75 | # if _LIBCPP_STD_VER >= 17 | 73 | # if _LIBCPP_STD_VER >= 17 |
| 76 | 74 | ||
| 75 | _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 | ||
| 76 | |||
| 77 | template <class _Wp> | 77 | template <class _Wp> |
| 78 | class observer_ptr { | 78 | class observer_ptr { |
| 79 | public: | 79 | public: |
| ... | @@ -175,28 +175,26 @@ _LIBCPP_HIDE_FROM_ABI bool operator>=(observer_ptr<_W1> __a, observer_ptr<_W2> _ | ... | @@ -175,28 +175,26 @@ _LIBCPP_HIDE_FROM_ABI bool operator>=(observer_ptr<_W1> __a, observer_ptr<_W2> _ |
| 175 | return !(__a < __b); | 175 | return !(__a < __b); |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | # endif // _LIBCPP_STD_VER >= 17 | ||
| 179 | |||
| 180 | _LIBCPP_END_NAMESPACE_LFTS_V2 | 178 | _LIBCPP_END_NAMESPACE_LFTS_V2 |
| 181 | 179 | ||
| 182 | _LIBCPP_BEGIN_NAMESPACE_STD | 180 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 183 | 181 | ||
| 184 | // hash | 182 | // hash |
| 185 | 183 | ||
| 186 | # if _LIBCPP_STD_VER >= 17 | ||
| 187 | template <class _Tp> | 184 | template <class _Tp> |
| 188 | struct hash<experimental::observer_ptr<_Tp>> { | 185 | struct hash<experimental::observer_ptr<_Tp>> { |
| 189 | _LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::observer_ptr<_Tp>& __ptr) const noexcept { | 186 | _LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::observer_ptr<_Tp>& __ptr) const noexcept { |
| 190 | return hash<_Tp*>()(__ptr.get()); | 187 | return hash<_Tp*>()(__ptr.get()); |
| 191 | } | 188 | } |
| 192 | }; | 189 | }; |
| 193 | # endif // _LIBCPP_STD_VER >= 17 | ||
| 194 | 190 | ||
| 195 | _LIBCPP_END_NAMESPACE_STD | 191 | _LIBCPP_END_NAMESPACE_STD |
| 196 | 192 | ||
| 193 | # endif // _LIBCPP_STD_VER >= 17 | ||
| 194 | |||
| 197 | # endif // _LIBCPP_ENABLE_EXPERIMENTAL | 195 | # endif // _LIBCPP_ENABLE_EXPERIMENTAL |
| 198 | 196 | ||
| 199 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 197 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 200 | # include <cstddef> | 198 | # include <cstddef> |
| 201 | # include <limits> | 199 | # include <limits> |
| 202 | # endif | 200 | # endif |
lib/libcxx/include/experimental/propagate_const+1-1| ... | @@ -488,7 +488,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -488,7 +488,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 488 | 488 | ||
| 489 | _LIBCPP_POP_MACROS | 489 | _LIBCPP_POP_MACROS |
| 490 | 490 | ||
| 491 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 491 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 492 | # include <cstddef> | 492 | # include <cstddef> |
| 493 | # include <type_traits> | 493 | # include <type_traits> |
| 494 | # endif | 494 | # endif |
lib/libcxx/include/experimental/simd+1-1| ... | @@ -88,7 +88,7 @@ inline namespace parallelism_v2 { | ... | @@ -88,7 +88,7 @@ inline namespace parallelism_v2 { |
| 88 | # include <experimental/__simd/traits.h> | 88 | # include <experimental/__simd/traits.h> |
| 89 | # include <experimental/__simd/vec_ext.h> | 89 | # include <experimental/__simd/vec_ext.h> |
| 90 | 90 | ||
| 91 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 91 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 92 | # include <cstddef> | 92 | # include <cstddef> |
| 93 | # endif | 93 | # endif |
| 94 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 94 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/experimental/type_traits+1-1| ... | @@ -151,7 +151,7 @@ constexpr bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Ar | ... | @@ -151,7 +151,7 @@ constexpr bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Ar |
| 151 | 151 | ||
| 152 | _LIBCPP_END_NAMESPACE_LFTS | 152 | _LIBCPP_END_NAMESPACE_LFTS |
| 153 | 153 | ||
| 154 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 154 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 155 | # include <cstddef> | 155 | # include <cstddef> |
| 156 | # endif | 156 | # endif |
| 157 | 157 |
lib/libcxx/include/experimental/utility+1-1| ... | @@ -46,7 +46,7 @@ struct erased_type {}; | ... | @@ -46,7 +46,7 @@ struct erased_type {}; |
| 46 | 46 | ||
| 47 | _LIBCPP_END_NAMESPACE_LFTS | 47 | _LIBCPP_END_NAMESPACE_LFTS |
| 48 | 48 | ||
| 49 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 49 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 50 | # include <cstddef> | 50 | # include <cstddef> |
| 51 | # endif | 51 | # endif |
| 52 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 52 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/ext/hash_map+1-1| ... | @@ -825,7 +825,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multimap<_Key, _Tp, _Has | ... | @@ -825,7 +825,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multimap<_Key, _Tp, _Has |
| 825 | 825 | ||
| 826 | } // namespace __gnu_cxx | 826 | } // namespace __gnu_cxx |
| 827 | 827 | ||
| 828 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 828 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 829 | # include <concepts> | 829 | # include <concepts> |
| 830 | # include <iterator> | 830 | # include <iterator> |
| 831 | # include <type_traits> | 831 | # include <type_traits> |
lib/libcxx/include/ext/hash_set+1-1| ... | @@ -572,7 +572,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multiset<_Value, _Hash, | ... | @@ -572,7 +572,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multiset<_Value, _Hash, |
| 572 | 572 | ||
| 573 | } // namespace __gnu_cxx | 573 | } // namespace __gnu_cxx |
| 574 | 574 | ||
| 575 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 575 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 576 | # include <concepts> | 576 | # include <concepts> |
| 577 | # include <iterator> | 577 | # include <iterator> |
| 578 | # include <type_traits> | 578 | # include <type_traits> |
lib/libcxx/include/fenv.h deleted-118| ... | @@ -1,118 +0,0 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP_FENV_H | ||
| 11 | #define _LIBCPP_FENV_H | ||
| 12 | |||
| 13 | /* | ||
| 14 | fenv.h synopsis | ||
| 15 | |||
| 16 | This entire header is C99 / C++0X | ||
| 17 | |||
| 18 | Macros: | ||
| 19 | |||
| 20 | FE_DIVBYZERO | ||
| 21 | FE_INEXACT | ||
| 22 | FE_INVALID | ||
| 23 | FE_OVERFLOW | ||
| 24 | FE_UNDERFLOW | ||
| 25 | FE_ALL_EXCEPT | ||
| 26 | FE_DOWNWARD | ||
| 27 | FE_TONEAREST | ||
| 28 | FE_TOWARDZERO | ||
| 29 | FE_UPWARD | ||
| 30 | FE_DFL_ENV | ||
| 31 | |||
| 32 | Types: | ||
| 33 | |||
| 34 | fenv_t | ||
| 35 | fexcept_t | ||
| 36 | |||
| 37 | int feclearexcept(int excepts); | ||
| 38 | int fegetexceptflag(fexcept_t* flagp, int excepts); | ||
| 39 | int feraiseexcept(int excepts); | ||
| 40 | int fesetexceptflag(const fexcept_t* flagp, int excepts); | ||
| 41 | int fetestexcept(int excepts); | ||
| 42 | int fegetround(); | ||
| 43 | int fesetround(int round); | ||
| 44 | int fegetenv(fenv_t* envp); | ||
| 45 | int feholdexcept(fenv_t* envp); | ||
| 46 | int fesetenv(const fenv_t* envp); | ||
| 47 | int feupdateenv(const fenv_t* envp); | ||
| 48 | |||
| 49 | |||
| 50 | */ | ||
| 51 | |||
| 52 | #if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | ||
| 53 | # include <__cxx03/__config> | ||
| 54 | #else | ||
| 55 | # include <__config> | ||
| 56 | #endif | ||
| 57 | |||
| 58 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 59 | # pragma GCC system_header | ||
| 60 | #endif | ||
| 61 | |||
| 62 | #if __has_include_next(<fenv.h>) | ||
| 63 | # include_next <fenv.h> | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #ifdef __cplusplus | ||
| 67 | |||
| 68 | extern "C++" { | ||
| 69 | |||
| 70 | # ifdef feclearexcept | ||
| 71 | # undef feclearexcept | ||
| 72 | # endif | ||
| 73 | |||
| 74 | # ifdef fegetexceptflag | ||
| 75 | # undef fegetexceptflag | ||
| 76 | # endif | ||
| 77 | |||
| 78 | # ifdef feraiseexcept | ||
| 79 | # undef feraiseexcept | ||
| 80 | # endif | ||
| 81 | |||
| 82 | # ifdef fesetexceptflag | ||
| 83 | # undef fesetexceptflag | ||
| 84 | # endif | ||
| 85 | |||
| 86 | # ifdef fetestexcept | ||
| 87 | # undef fetestexcept | ||
| 88 | # endif | ||
| 89 | |||
| 90 | # ifdef fegetround | ||
| 91 | # undef fegetround | ||
| 92 | # endif | ||
| 93 | |||
| 94 | # ifdef fesetround | ||
| 95 | # undef fesetround | ||
| 96 | # endif | ||
| 97 | |||
| 98 | # ifdef fegetenv | ||
| 99 | # undef fegetenv | ||
| 100 | # endif | ||
| 101 | |||
| 102 | # ifdef feholdexcept | ||
| 103 | # undef feholdexcept | ||
| 104 | # endif | ||
| 105 | |||
| 106 | # ifdef fesetenv | ||
| 107 | # undef fesetenv | ||
| 108 | # endif | ||
| 109 | |||
| 110 | # ifdef feupdateenv | ||
| 111 | # undef feupdateenv | ||
| 112 | # endif | ||
| 113 | |||
| 114 | } // extern "C++" | ||
| 115 | |||
| 116 | #endif // defined(__cplusplus) | ||
| 117 | |||
| 118 | #endif // _LIBCPP_FENV_H | ||
lib/libcxx/include/filesystem+1-1| ... | @@ -568,7 +568,7 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct | ... | @@ -568,7 +568,7 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct |
| 568 | # pragma GCC system_header | 568 | # pragma GCC system_header |
| 569 | # endif | 569 | # endif |
| 570 | 570 | ||
| 571 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 571 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 572 | # include <concepts> | 572 | # include <concepts> |
| 573 | # include <cstdlib> | 573 | # include <cstdlib> |
| 574 | # include <cstring> | 574 | # include <cstring> |
lib/libcxx/include/float.h deleted-99| ... | @@ -1,99 +0,0 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP_FLOAT_H | ||
| 11 | #define _LIBCPP_FLOAT_H | ||
| 12 | |||
| 13 | /* | ||
| 14 | float.h synopsis | ||
| 15 | |||
| 16 | Macros: | ||
| 17 | |||
| 18 | FLT_ROUNDS | ||
| 19 | FLT_EVAL_METHOD // C99 | ||
| 20 | FLT_RADIX | ||
| 21 | |||
| 22 | FLT_MANT_DIG | ||
| 23 | DBL_MANT_DIG | ||
| 24 | LDBL_MANT_DIG | ||
| 25 | |||
| 26 | FLT_HAS_SUBNORM // C11 | ||
| 27 | DBL_HAS_SUBNORM // C11 | ||
| 28 | LDBL_HAS_SUBNORM // C11 | ||
| 29 | |||
| 30 | DECIMAL_DIG // C99 | ||
| 31 | FLT_DECIMAL_DIG // C11 | ||
| 32 | DBL_DECIMAL_DIG // C11 | ||
| 33 | LDBL_DECIMAL_DIG // C11 | ||
| 34 | |||
| 35 | FLT_DIG | ||
| 36 | DBL_DIG | ||
| 37 | LDBL_DIG | ||
| 38 | |||
| 39 | FLT_MIN_EXP | ||
| 40 | DBL_MIN_EXP | ||
| 41 | LDBL_MIN_EXP | ||
| 42 | |||
| 43 | FLT_MIN_10_EXP | ||
| 44 | DBL_MIN_10_EXP | ||
| 45 | LDBL_MIN_10_EXP | ||
| 46 | |||
| 47 | FLT_MAX_EXP | ||
| 48 | DBL_MAX_EXP | ||
| 49 | LDBL_MAX_EXP | ||
| 50 | |||
| 51 | FLT_MAX_10_EXP | ||
| 52 | DBL_MAX_10_EXP | ||
| 53 | LDBL_MAX_10_EXP | ||
| 54 | |||
| 55 | FLT_MAX | ||
| 56 | DBL_MAX | ||
| 57 | LDBL_MAX | ||
| 58 | |||
| 59 | FLT_EPSILON | ||
| 60 | DBL_EPSILON | ||
| 61 | LDBL_EPSILON | ||
| 62 | |||
| 63 | FLT_MIN | ||
| 64 | DBL_MIN | ||
| 65 | LDBL_MIN | ||
| 66 | |||
| 67 | FLT_TRUE_MIN // C11 | ||
| 68 | DBL_TRUE_MIN // C11 | ||
| 69 | LDBL_TRUE_MIN // C11 | ||
| 70 | |||
| 71 | */ | ||
| 72 | |||
| 73 | #if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | ||
| 74 | # include <__cxx03/__config> | ||
| 75 | #else | ||
| 76 | # include <__config> | ||
| 77 | #endif | ||
| 78 | |||
| 79 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 80 | # pragma GCC system_header | ||
| 81 | #endif | ||
| 82 | |||
| 83 | #if __has_include_next(<float.h>) | ||
| 84 | # include_next <float.h> | ||
| 85 | #endif | ||
| 86 | |||
| 87 | #ifdef __cplusplus | ||
| 88 | |||
| 89 | # ifndef FLT_EVAL_METHOD | ||
| 90 | # define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ | ||
| 91 | # endif | ||
| 92 | |||
| 93 | # ifndef DECIMAL_DIG | ||
| 94 | # define DECIMAL_DIG __DECIMAL_DIG__ | ||
| 95 | # endif | ||
| 96 | |||
| 97 | #endif // __cplusplus | ||
| 98 | |||
| 99 | #endif // _LIBCPP_FLOAT_H | ||
lib/libcxx/include/format+13-10| ... | @@ -31,7 +31,7 @@ namespace std { | ... | @@ -31,7 +31,7 @@ namespace std { |
| 31 | 31 | ||
| 32 | public: | 32 | public: |
| 33 | template<class T> consteval basic_format_string(const T& s); | 33 | template<class T> consteval basic_format_string(const T& s); |
| 34 | basic_format_string(runtime-format-string<charT> s) noexcept : str(s.str) {} // since C++26 | 34 | basic_format_string(dynamic-format-string<charT> s) noexcept : str(s.str) {} // since C++26 |
| 35 | 35 | ||
| 36 | constexpr basic_string_view<charT> get() const noexcept { return str; } | 36 | constexpr basic_string_view<charT> get() const noexcept { return str; } |
| 37 | }; | 37 | }; |
| ... | @@ -42,21 +42,21 @@ namespace std { | ... | @@ -42,21 +42,21 @@ namespace std { |
| 42 | using wformat_string = // since C++23, exposition only before C++23 | 42 | using wformat_string = // since C++23, exposition only before C++23 |
| 43 | basic_format_string<wchar_t, type_identity_t<Args>...>; | 43 | basic_format_string<wchar_t, type_identity_t<Args>...>; |
| 44 | 44 | ||
| 45 | template<class charT> struct runtime-format-string { // since C++26, exposition-only | 45 | template<class charT> struct dynamic-format-string { // since C++26, exposition-only |
| 46 | private: | 46 | private: |
| 47 | basic_string_view<charT> str; // exposition-only | 47 | basic_string_view<charT> str; // exposition-only |
| 48 | 48 | ||
| 49 | public: | 49 | public: |
| 50 | runtime-format-string(basic_string_view<charT> s) noexcept : str(s) {} | 50 | dynamic-format-string(basic_string_view<charT> s) noexcept : str(s) {} |
| 51 | 51 | ||
| 52 | runtime-format-string(const runtime-format-string&) = delete; | 52 | dynamic-format-string(const dynamic-format-string&) = delete; |
| 53 | runtime-format-string& operator=(const runtime-format-string&) = delete; | 53 | dynamic-format-string& operator=(const dynamic-format-string&) = delete; |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | runtime-format-string<char> runtime_format(string_view fmt) noexcept { | 56 | dynamic-format-string<char> dynamic_format(string_view fmt) noexcept { |
| 57 | return fmt; | 57 | return fmt; |
| 58 | } | 58 | } |
| 59 | runtime-format-string<wchar_t> runtime_format(wstring_view fmt) noexcept { | 59 | dynamic-format-string<wchar_t> dynamic_format(wstring_view fmt) noexcept { |
| 60 | return fmt; | 60 | return fmt; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| ... | @@ -213,7 +213,7 @@ namespace std { | ... | @@ -213,7 +213,7 @@ namespace std { |
| 213 | # include <__format/format_string.h> | 213 | # include <__format/format_string.h> |
| 214 | # include <__format/format_to_n_result.h> | 214 | # include <__format/format_to_n_result.h> |
| 215 | # include <__format/formatter.h> | 215 | # include <__format/formatter.h> |
| 216 | # include <__format/formatter_bool.h> | 216 | # include <__format/formatter_bool_impl.h> |
| 217 | # include <__format/formatter_char.h> | 217 | # include <__format/formatter_char.h> |
| 218 | # include <__format/formatter_floating_point.h> | 218 | # include <__format/formatter_floating_point.h> |
| 219 | # include <__format/formatter_integer.h> | 219 | # include <__format/formatter_integer.h> |
| ... | @@ -233,12 +233,15 @@ namespace std { | ... | @@ -233,12 +233,15 @@ namespace std { |
| 233 | # pragma GCC system_header | 233 | # pragma GCC system_header |
| 234 | # endif | 234 | # endif |
| 235 | 235 | ||
| 236 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 236 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 237 | # include <cmath> | ||
| 238 | # endif | ||
| 239 | |||
| 240 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 | ||
| 237 | # include <array> | 241 | # include <array> |
| 238 | # include <cctype> | 242 | # include <cctype> |
| 239 | # include <cerrno> | 243 | # include <cerrno> |
| 240 | # include <clocale> | 244 | # include <clocale> |
| 241 | # include <cmath> | ||
| 242 | # include <cstddef> | 245 | # include <cstddef> |
| 243 | # include <cstdint> | 246 | # include <cstdint> |
| 244 | # include <cstdlib> | 247 | # include <cstdlib> |
lib/libcxx/include/forward_list+4-8| ... | @@ -37,7 +37,7 @@ public: | ... | @@ -37,7 +37,7 @@ public: |
| 37 | noexcept(is_nothrow_default_constructible<allocator_type>::value); | 37 | noexcept(is_nothrow_default_constructible<allocator_type>::value); |
| 38 | explicit forward_list(const allocator_type& a); | 38 | explicit forward_list(const allocator_type& a); |
| 39 | explicit forward_list(size_type n); | 39 | explicit forward_list(size_type n); |
| 40 | explicit forward_list(size_type n, const allocator_type& a); // C++14 | 40 | explicit forward_list(size_type n, const allocator_type& a); |
| 41 | forward_list(size_type n, const value_type& v); | 41 | forward_list(size_type n, const value_type& v); |
| 42 | forward_list(size_type n, const value_type& v, const allocator_type& a); | 42 | forward_list(size_type n, const value_type& v, const allocator_type& a); |
| 43 | template <class InputIterator> | 43 | template <class InputIterator> |
| ... | @@ -234,6 +234,7 @@ template <class T, class Allocator, class Predicate> | ... | @@ -234,6 +234,7 @@ template <class T, class Allocator, class Predicate> |
| 234 | # include <__type_traits/remove_cv.h> | 234 | # include <__type_traits/remove_cv.h> |
| 235 | # include <__type_traits/type_identity.h> | 235 | # include <__type_traits/type_identity.h> |
| 236 | # include <__utility/exception_guard.h> | 236 | # include <__utility/exception_guard.h> |
| 237 | # include <__utility/exchange.h> | ||
| 237 | # include <__utility/forward.h> | 238 | # include <__utility/forward.h> |
| 238 | # include <__utility/move.h> | 239 | # include <__utility/move.h> |
| 239 | # include <__utility/swap.h> | 240 | # include <__utility/swap.h> |
| ... | @@ -663,9 +664,7 @@ public: | ... | @@ -663,9 +664,7 @@ public: |
| 663 | _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) {} // = default; | 664 | _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) {} // = default; |
| 664 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit forward_list(const allocator_type& __a); | 665 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit forward_list(const allocator_type& __a); |
| 665 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n); | 666 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n); |
| 666 | # if _LIBCPP_STD_VER >= 14 | ||
| 667 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n, const allocator_type& __a); | 667 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n, const allocator_type& __a); |
| 668 | # endif | ||
| 669 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v); | 668 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v); |
| 670 | 669 | ||
| 671 | template <__enable_if_t<__is_allocator_v<_Alloc>, int> = 0> | 670 | template <__enable_if_t<__is_allocator_v<_Alloc>, int> = 0> |
| ... | @@ -940,7 +939,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type | ... | @@ -940,7 +939,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type |
| 940 | } | 939 | } |
| 941 | } | 940 | } |
| 942 | 941 | ||
| 943 | # if _LIBCPP_STD_VER >= 14 | ||
| 944 | template <class _Tp, class _Alloc> | 942 | template <class _Tp, class _Alloc> |
| 945 | _LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __base_alloc) | 943 | _LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __base_alloc) |
| 946 | : __base(__base_alloc) { | 944 | : __base(__base_alloc) { |
| ... | @@ -951,7 +949,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type | ... | @@ -951,7 +949,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type |
| 951 | } | 949 | } |
| 952 | } | 950 | } |
| 953 | } | 951 | } |
| 954 | # endif | ||
| 955 | 952 | ||
| 956 | template <class _Tp, class _Alloc> | 953 | template <class _Tp, class _Alloc> |
| 957 | _LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v) { | 954 | _LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v) { |
| ... | @@ -1022,8 +1019,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void forward_list<_Tp, _Alloc>::__move_assign(forw | ... | @@ -1022,8 +1019,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void forward_list<_Tp, _Alloc>::__move_assign(forw |
| 1022 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) { | 1019 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) { |
| 1023 | clear(); | 1020 | clear(); |
| 1024 | __base::__move_assign_alloc(__x); | 1021 | __base::__move_assign_alloc(__x); |
| 1025 | __base::__before_begin()->__next_ = __x.__before_begin()->__next_; | 1022 | __base::__before_begin()->__next_ = std::__exchange(__x.__before_begin()->__next_, nullptr); |
| 1026 | __x.__before_begin()->__next_ = nullptr; | ||
| 1027 | } | 1023 | } |
| 1028 | 1024 | ||
| 1029 | template <class _Tp, class _Alloc> | 1025 | template <class _Tp, class _Alloc> |
| ... | @@ -1603,7 +1599,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -1603,7 +1599,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 1603 | 1599 | ||
| 1604 | _LIBCPP_POP_MACROS | 1600 | _LIBCPP_POP_MACROS |
| 1605 | 1601 | ||
| 1606 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1602 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1607 | # include <algorithm> | 1603 | # include <algorithm> |
| 1608 | # include <atomic> | 1604 | # include <atomic> |
| 1609 | # include <concepts> | 1605 | # include <concepts> |
lib/libcxx/include/fstream+90-31| ... | @@ -220,6 +220,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -220,6 +220,7 @@ _LIBCPP_PUSH_MACROS |
| 220 | # include <__undef_macros> | 220 | # include <__undef_macros> |
| 221 | 221 | ||
| 222 | _LIBCPP_BEGIN_NAMESPACE_STD | 222 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 223 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 223 | 224 | ||
| 224 | # if _LIBCPP_STD_VER >= 23 && defined(_LIBCPP_WIN32API) | 225 | # if _LIBCPP_STD_VER >= 23 && defined(_LIBCPP_WIN32API) |
| 225 | _LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) noexcept; | 226 | _LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) noexcept; |
| ... | @@ -308,6 +309,34 @@ protected: | ... | @@ -308,6 +309,34 @@ protected: |
| 308 | return basic_streambuf<_CharT, _Traits>::xsputn(__str, __len); | 309 | return basic_streambuf<_CharT, _Traits>::xsputn(__str, __len); |
| 309 | } | 310 | } |
| 310 | 311 | ||
| 312 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL streamsize xsgetn(char_type* __str, streamsize __len) override { | ||
| 313 | if (__file_ && __always_noconv_) { | ||
| 314 | char_type __1buf; | ||
| 315 | __read_guard __guard(__1buf, *this); | ||
| 316 | const streamsize __n = std::min(this->egptr() - this->gptr(), __len); | ||
| 317 | if (__n != 0) { | ||
| 318 | traits_type::copy(__str, this->gptr(), __n); | ||
| 319 | this->__gbump_ptrdiff(__n); | ||
| 320 | } | ||
| 321 | const streamsize __remainder = __len - __n; | ||
| 322 | const streamsize __buffer_space = this->egptr() - this->eback(); | ||
| 323 | |||
| 324 | if (__remainder >= __buffer_space) { | ||
| 325 | auto __res = std::fread(__str + __n, sizeof(char_type), __remainder, __file_) + __n; | ||
| 326 | |||
| 327 | // Copy the buffer-sized tail into the buffer so that `unget`ting works correctly | ||
| 328 | auto __buf_size = std::min<size_t>(__res, this->egptr() - this->eback()); | ||
| 329 | traits_type::copy(this->eback(), __str + __res - __buf_size, __buf_size); | ||
| 330 | this->setg(this->eback(), this->eback() + __buf_size, this->eback() + __buf_size); | ||
| 331 | |||
| 332 | return __res; | ||
| 333 | } else if (__remainder > 0) | ||
| 334 | return basic_streambuf<_CharT, _Traits>::xsgetn(__str + __n, __remainder) + __n; | ||
| 335 | return __n; | ||
| 336 | } | ||
| 337 | return basic_streambuf<_CharT, _Traits>::xsgetn(__str, __len); | ||
| 338 | } | ||
| 339 | |||
| 311 | private: | 340 | private: |
| 312 | char* __extbuf_; | 341 | char* __extbuf_; |
| 313 | const char* __extbufnext_; | 342 | const char* __extbufnext_; |
| ... | @@ -364,6 +393,40 @@ private: | ... | @@ -364,6 +393,40 @@ private: |
| 364 | bool __always_noconv_; | 393 | bool __always_noconv_; |
| 365 | 394 | ||
| 366 | bool __read_mode(); | 395 | bool __read_mode(); |
| 396 | |||
| 397 | struct [[__nodiscard__]] __read_guard { | ||
| 398 | basic_filebuf& __self_; | ||
| 399 | size_t __unget_size_; | ||
| 400 | char_type& __1buf_; | ||
| 401 | |||
| 402 | _LIBCPP_HIDE_FROM_ABI __read_guard(char_type& __1buf, basic_filebuf& __self) : __self_(__self), __1buf_(__1buf) { | ||
| 403 | if (__self.__cm_ & ios_base::in) { | ||
| 404 | __unget_size_ = std::min<size_t>((__self.egptr() - __self.eback()) / 2, 4); | ||
| 405 | } else { | ||
| 406 | __self.setp(nullptr, nullptr); | ||
| 407 | if (__self.__always_noconv_) { | ||
| 408 | __self.setg(reinterpret_cast<char_type*>(__self.__extbuf_), | ||
| 409 | reinterpret_cast<char_type*>(__self.__extbuf_) + __self.__ebs_, | ||
| 410 | reinterpret_cast<char_type*>(__self.__extbuf_) + __self.__ebs_); | ||
| 411 | } else { | ||
| 412 | __self.setg(__self.__intbuf_, __self.__intbuf_ + __self.__ibs_, __self.__intbuf_ + __self.__ibs_); | ||
| 413 | } | ||
| 414 | __self.__cm_ = ios_base::in; | ||
| 415 | __unget_size_ = 0; | ||
| 416 | } | ||
| 417 | |||
| 418 | if (__self.gptr() == nullptr) | ||
| 419 | __self.setg(std::addressof(__1buf_), std::addressof(__1buf_) + 1, std::addressof(__1buf_) + 1); | ||
| 420 | } | ||
| 421 | |||
| 422 | _LIBCPP_HIDE_FROM_ABI size_t __unget_size() { return __unget_size_; } | ||
| 423 | |||
| 424 | _LIBCPP_HIDE_FROM_ABI ~__read_guard() { | ||
| 425 | if (__self_.eback() == std::addressof(__1buf_)) | ||
| 426 | __self_.setg(nullptr, nullptr, nullptr); | ||
| 427 | } | ||
| 428 | }; | ||
| 429 | |||
| 367 | void __write_mode(); | 430 | void __write_mode(); |
| 368 | 431 | ||
| 369 | _LIBCPP_HIDE_FROM_ABI static int __fseek(FILE* __file, pos_type __offset, int __whence); | 432 | _LIBCPP_HIDE_FROM_ABI static int __fseek(FILE* __file, pos_type __offset, int __whence); |
| ... | @@ -400,14 +463,12 @@ private: | ... | @@ -400,14 +463,12 @@ private: |
| 400 | // If the file is already open, switch to unbuffered mode. Otherwise, record | 463 | // If the file is already open, switch to unbuffered mode. Otherwise, record |
| 401 | // the request to use unbuffered mode so that we use that mode when we | 464 | // the request to use unbuffered mode so that we use that mode when we |
| 402 | // eventually open the file. | 465 | // eventually open the file. |
| 403 | _LIBCPP_HIDE_FROM_ABI void __request_unbuffered_mode(char_type* __s, streamsize __n) { | 466 | _LIBCPP_HIDE_FROM_ABI void __request_unbuffered_mode() { |
| 404 | if (__cm_ == __no_io_operations && __s == nullptr && __n == 0) { | 467 | if (__file_) { |
| 405 | if (__file_) { | 468 | std::setbuf(__file_, nullptr); |
| 406 | std::setbuf(__file_, nullptr); | 469 | __cm_ = 0; |
| 407 | __cm_ = 0; | 470 | } else { |
| 408 | } else { | 471 | __cm_ = __no_io_operations | __use_unbuffered_io; |
| 409 | __cm_ = __no_io_operations | __use_unbuffered_io; | ||
| 410 | } | ||
| 411 | } | 472 | } |
| 412 | } | 473 | } |
| 413 | 474 | ||
| ... | @@ -601,6 +662,17 @@ inline bool basic_filebuf<_CharT, _Traits>::is_open() const { | ... | @@ -601,6 +662,17 @@ inline bool basic_filebuf<_CharT, _Traits>::is_open() const { |
| 601 | return __file_ != nullptr; | 662 | return __file_ != nullptr; |
| 602 | } | 663 | } |
| 603 | 664 | ||
| 665 | // Configures the fopen close-on-exec mode character, if any. This string will | ||
| 666 | // be appended to any mode string used by fstream for fopen/fdopen. | ||
| 667 | // | ||
| 668 | // Not all platforms support this, but it helps avoid fd-leaks on platforms that | ||
| 669 | // do. | ||
| 670 | # if defined(__BIONIC__) | ||
| 671 | # define _LIBCPP_FOPEN_CLOEXEC_MODE "e" | ||
| 672 | # else | ||
| 673 | # define _LIBCPP_FOPEN_CLOEXEC_MODE | ||
| 674 | # endif | ||
| 675 | |||
| 604 | template <class _CharT, class _Traits> | 676 | template <class _CharT, class _Traits> |
| 605 | const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(ios_base::openmode __mode) _NOEXCEPT { | 677 | const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(ios_base::openmode __mode) _NOEXCEPT { |
| 606 | switch (__mode & ~ios_base::ate) { | 678 | switch (__mode & ~ios_base::ate) { |
| ... | @@ -773,11 +845,11 @@ template <class _CharT, class _Traits> | ... | @@ -773,11 +845,11 @@ template <class _CharT, class _Traits> |
| 773 | typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::underflow() { | 845 | typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::underflow() { |
| 774 | if (__file_ == nullptr) | 846 | if (__file_ == nullptr) |
| 775 | return traits_type::eof(); | 847 | return traits_type::eof(); |
| 776 | bool __initial = __read_mode(); | 848 | |
| 777 | char_type __1buf; | 849 | char_type __1buf; |
| 778 | if (this->gptr() == nullptr) | 850 | __read_guard __guard(__1buf, *this); |
| 779 | this->setg(std::addressof(__1buf), std::addressof(__1buf) + 1, std::addressof(__1buf) + 1); | 851 | |
| 780 | const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4); | 852 | const size_t __unget_sz = __guard.__unget_size(); |
| 781 | int_type __c = traits_type::eof(); | 853 | int_type __c = traits_type::eof(); |
| 782 | if (this->gptr() == this->egptr()) { | 854 | if (this->gptr() == this->egptr()) { |
| 783 | std::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type)); | 855 | std::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type)); |
| ... | @@ -820,8 +892,6 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits> | ... | @@ -820,8 +892,6 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits> |
| 820 | } | 892 | } |
| 821 | } else | 893 | } else |
| 822 | __c = traits_type::to_int_type(*this->gptr()); | 894 | __c = traits_type::to_int_type(*this->gptr()); |
| 823 | if (this->eback() == std::addressof(__1buf)) | ||
| 824 | this->setg(nullptr, nullptr, nullptr); | ||
| 825 | return __c; | 895 | return __c; |
| 826 | } | 896 | } |
| 827 | 897 | ||
| ... | @@ -920,7 +990,9 @@ template <class _CharT, class _Traits> | ... | @@ -920,7 +990,9 @@ template <class _CharT, class _Traits> |
| 920 | basic_streambuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n) { | 990 | basic_streambuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n) { |
| 921 | this->setg(nullptr, nullptr, nullptr); | 991 | this->setg(nullptr, nullptr, nullptr); |
| 922 | this->setp(nullptr, nullptr); | 992 | this->setp(nullptr, nullptr); |
| 923 | __request_unbuffered_mode(__s, __n); | 993 | // Calling setbuf(nullptr, 0) before any i/o operation switches the stream to unbuffered mode |
| 994 | if (__cm_ == __no_io_operations && __s == nullptr && __n == 0) | ||
| 995 | __request_unbuffered_mode(); | ||
| 924 | if (__owns_eb_) | 996 | if (__owns_eb_) |
| 925 | delete[] __extbuf_; | 997 | delete[] __extbuf_; |
| 926 | if (__owns_ib_) | 998 | if (__owns_ib_) |
| ... | @@ -1110,20 +1182,6 @@ void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) { | ... | @@ -1110,20 +1182,6 @@ void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) { |
| 1110 | } | 1182 | } |
| 1111 | } | 1183 | } |
| 1112 | 1184 | ||
| 1113 | template <class _CharT, class _Traits> | ||
| 1114 | bool basic_filebuf<_CharT, _Traits>::__read_mode() { | ||
| 1115 | if (!(__cm_ & ios_base::in)) { | ||
| 1116 | this->setp(nullptr, nullptr); | ||
| 1117 | if (__always_noconv_) | ||
| 1118 | this->setg((char_type*)__extbuf_, (char_type*)__extbuf_ + __ebs_, (char_type*)__extbuf_ + __ebs_); | ||
| 1119 | else | ||
| 1120 | this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_); | ||
| 1121 | __cm_ = ios_base::in; | ||
| 1122 | return true; | ||
| 1123 | } | ||
| 1124 | return false; | ||
| 1125 | } | ||
| 1126 | |||
| 1127 | template <class _CharT, class _Traits> | 1185 | template <class _CharT, class _Traits> |
| 1128 | void basic_filebuf<_CharT, _Traits>::__write_mode() { | 1186 | void basic_filebuf<_CharT, _Traits>::__write_mode() { |
| 1129 | if (!(__cm_ & ios_base::out)) { | 1187 | if (!(__cm_ & ios_base::out)) { |
| ... | @@ -1616,13 +1674,14 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ofstream<char>; | ... | @@ -1616,13 +1674,14 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ofstream<char>; |
| 1616 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>; | 1674 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>; |
| 1617 | # endif | 1675 | # endif |
| 1618 | 1676 | ||
| 1677 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 1619 | _LIBCPP_END_NAMESPACE_STD | 1678 | _LIBCPP_END_NAMESPACE_STD |
| 1620 | 1679 | ||
| 1621 | _LIBCPP_POP_MACROS | 1680 | _LIBCPP_POP_MACROS |
| 1622 | 1681 | ||
| 1623 | # endif // _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION | 1682 | # endif // _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION |
| 1624 | 1683 | ||
| 1625 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1684 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1626 | # include <atomic> | 1685 | # include <atomic> |
| 1627 | # include <concepts> | 1686 | # include <concepts> |
| 1628 | # include <cstdlib> | 1687 | # include <cstdlib> |
| ... | @@ -1634,7 +1693,7 @@ _LIBCPP_POP_MACROS | ... | @@ -1634,7 +1693,7 @@ _LIBCPP_POP_MACROS |
| 1634 | # include <type_traits> | 1693 | # include <type_traits> |
| 1635 | # endif | 1694 | # endif |
| 1636 | 1695 | ||
| 1637 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23 | 1696 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 1638 | # include <filesystem> | 1697 | # include <filesystem> |
| 1639 | # endif | 1698 | # endif |
| 1640 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 1699 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/functional+7-5| ... | @@ -221,6 +221,8 @@ template <auto f> | ... | @@ -221,6 +221,8 @@ template <auto f> |
| 221 | // [func.bind.partial], function templates bind_front and bind_back | 221 | // [func.bind.partial], function templates bind_front and bind_back |
| 222 | template<class F, class... Args> | 222 | template<class F, class... Args> |
| 223 | constexpr unspecified bind_front(F&&, Args&&...); // C++20 | 223 | constexpr unspecified bind_front(F&&, Args&&...); // C++20 |
| 224 | template<auto f, class... Args> | ||
| 225 | constexpr unspecified bind_front(Args&&...); // C++26 | ||
| 224 | template<class F, class... Args> | 226 | template<class F, class... Args> |
| 225 | constexpr unspecified bind_back(F&&, Args&&...); // C++23 | 227 | constexpr unspecified bind_back(F&&, Args&&...); // C++23 |
| 226 | 228 | ||
| ... | @@ -540,7 +542,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited | ... | @@ -540,7 +542,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited |
| 540 | # include <__functional/binder1st.h> | 542 | # include <__functional/binder1st.h> |
| 541 | # include <__functional/binder2nd.h> | 543 | # include <__functional/binder2nd.h> |
| 542 | # include <__functional/hash.h> | 544 | # include <__functional/hash.h> |
| 543 | # include <__functional/mem_fn.h> // TODO: deprecate | 545 | # include <__functional/mem_fn.h> |
| 544 | # include <__functional/mem_fun_ref.h> | 546 | # include <__functional/mem_fun_ref.h> |
| 545 | # include <__functional/operations.h> | 547 | # include <__functional/operations.h> |
| 546 | # include <__functional/pointer_to_binary_function.h> | 548 | # include <__functional/pointer_to_binary_function.h> |
| ... | @@ -575,18 +577,18 @@ POLICY: For non-variadic implementations, the number of arguments is limited | ... | @@ -575,18 +577,18 @@ POLICY: For non-variadic implementations, the number of arguments is limited |
| 575 | # pragma GCC system_header | 577 | # pragma GCC system_header |
| 576 | # endif | 578 | # endif |
| 577 | 579 | ||
| 578 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && defined(_LIBCPP_CXX03_LANG) | 580 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && defined(_LIBCPP_CXX03_LANG) |
| 579 | # include <limits> | 581 | # include <limits> |
| 580 | # include <new> | 582 | # include <new> |
| 581 | # endif | 583 | # endif |
| 582 | 584 | ||
| 583 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14 | 585 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 14 |
| 584 | # include <array> | 586 | # include <array> |
| 585 | # include <initializer_list> | 587 | # include <initializer_list> |
| 586 | # include <unordered_map> | 588 | # include <unordered_map> |
| 587 | # endif | 589 | # endif |
| 588 | 590 | ||
| 589 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 591 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 590 | # include <atomic> | 592 | # include <atomic> |
| 591 | # include <concepts> | 593 | # include <concepts> |
| 592 | # include <cstdlib> | 594 | # include <cstdlib> |
| ... | @@ -601,7 +603,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited | ... | @@ -601,7 +603,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited |
| 601 | # include <vector> | 603 | # include <vector> |
| 602 | # endif | 604 | # endif |
| 603 | 605 | ||
| 604 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 23 | 606 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER == 23 |
| 605 | # include <__vector/vector.h> | 607 | # include <__vector/vector.h> |
| 606 | # endif | 608 | # endif |
| 607 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 609 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/future+23-10| ... | @@ -379,7 +379,6 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; | ... | @@ -379,7 +379,6 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; |
| 379 | # include <__memory/allocator_arg_t.h> | 379 | # include <__memory/allocator_arg_t.h> |
| 380 | # include <__memory/allocator_destructor.h> | 380 | # include <__memory/allocator_destructor.h> |
| 381 | # include <__memory/allocator_traits.h> | 381 | # include <__memory/allocator_traits.h> |
| 382 | # include <__memory/compressed_pair.h> | ||
| 383 | # include <__memory/pointer_traits.h> | 382 | # include <__memory/pointer_traits.h> |
| 384 | # include <__memory/shared_count.h> | 383 | # include <__memory/shared_count.h> |
| 385 | # include <__memory/unique_ptr.h> | 384 | # include <__memory/unique_ptr.h> |
| ... | @@ -420,6 +419,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -420,6 +419,7 @@ _LIBCPP_PUSH_MACROS |
| 420 | # include <__undef_macros> | 419 | # include <__undef_macros> |
| 421 | 420 | ||
| 422 | _LIBCPP_BEGIN_NAMESPACE_STD | 421 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 422 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 423 | 423 | ||
| 424 | // enum class future_errc | 424 | // enum class future_errc |
| 425 | _LIBCPP_DECLARE_STRONG_ENUM(future_errc){ | 425 | _LIBCPP_DECLARE_STRONG_ENUM(future_errc){ |
| ... | @@ -435,7 +435,12 @@ struct is_error_code_enum<future_errc::__lx> : public true_type {}; | ... | @@ -435,7 +435,12 @@ struct is_error_code_enum<future_errc::__lx> : public true_type {}; |
| 435 | # endif | 435 | # endif |
| 436 | 436 | ||
| 437 | // enum class launch | 437 | // enum class launch |
| 438 | _LIBCPP_DECLARE_STRONG_ENUM(launch){async = 1, deferred = 2, any = async | deferred}; | 438 | _LIBCPP_DECLARE_STRONG_ENUM(launch){ |
| 439 | async = 1, | ||
| 440 | deferred = 2, | ||
| 441 | any _LIBCPP_DEPRECATED_("std::launch::any is a deprecated extension. " | ||
| 442 | "Use std::launch::async | std::launch::deferred instead. " | ||
| 443 | "It will be removed in LLVM 25.") = async | deferred}; | ||
| 439 | _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch) | 444 | _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch) |
| 440 | 445 | ||
| 441 | # ifndef _LIBCPP_CXX03_LANG | 446 | # ifndef _LIBCPP_CXX03_LANG |
| ... | @@ -1407,8 +1412,10 @@ template <class _FD, class _Alloc, class _FB> | ... | @@ -1407,8 +1412,10 @@ template <class _FD, class _Alloc, class _FB> |
| 1407 | class __packaged_task_func; | 1412 | class __packaged_task_func; |
| 1408 | 1413 | ||
| 1409 | template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes> | 1414 | template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes> |
| 1410 | class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)> { | 1415 | class _LIBCPP_HIDE_STRUCT_FROM_ABI |
| 1411 | _LIBCPP_COMPRESSED_PAIR(_Fp, __func_, _Alloc, __alloc_); | 1416 | __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)> { |
| 1417 | _LIBCPP_NO_UNIQUE_ADDRESS _Fp __func_; | ||
| 1418 | _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_; | ||
| 1412 | 1419 | ||
| 1413 | public: | 1420 | public: |
| 1414 | _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(const _Fp& __f) : __func_(__f) {} | 1421 | _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(const _Fp& __f) : __func_(__f) {} |
| ... | @@ -1429,8 +1436,8 @@ void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to( | ... | @@ -1429,8 +1436,8 @@ void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to( |
| 1429 | 1436 | ||
| 1430 | template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes> | 1437 | template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes> |
| 1431 | void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() { | 1438 | void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() { |
| 1432 | __func_.~_Fp(); | ||
| 1433 | __alloc_.~_Alloc(); | 1439 | __alloc_.~_Alloc(); |
| 1440 | __func_.~_Fp(); | ||
| 1434 | } | 1441 | } |
| 1435 | 1442 | ||
| 1436 | template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes> | 1443 | template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes> |
| ... | @@ -1439,8 +1446,8 @@ void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() | ... | @@ -1439,8 +1446,8 @@ void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() |
| 1439 | typedef allocator_traits<_Ap> _ATraits; | 1446 | typedef allocator_traits<_Ap> _ATraits; |
| 1440 | typedef pointer_traits<typename _ATraits::pointer> _PTraits; | 1447 | typedef pointer_traits<typename _ATraits::pointer> _PTraits; |
| 1441 | _Ap __a(__alloc_); | 1448 | _Ap __a(__alloc_); |
| 1442 | __func_.~_Fp(); | ||
| 1443 | __alloc_.~_Alloc(); | 1449 | __alloc_.~_Alloc(); |
| 1450 | __func_.~_Fp(); | ||
| 1444 | __a.deallocate(_PTraits::pointer_to(*this), 1); | 1451 | __a.deallocate(_PTraits::pointer_to(*this), 1); |
| 1445 | } | 1452 | } |
| 1446 | 1453 | ||
| ... | @@ -1744,7 +1751,7 @@ public: | ... | @@ -1744,7 +1751,7 @@ public: |
| 1744 | template <class _Rp, class... _Args> | 1751 | template <class _Rp, class... _Args> |
| 1745 | packaged_task(_Rp (*)(_Args...)) -> packaged_task<_Rp(_Args...)>; | 1752 | packaged_task(_Rp (*)(_Args...)) -> packaged_task<_Rp(_Args...)>; |
| 1746 | 1753 | ||
| 1747 | template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type> | 1754 | template <class _Fp, class _Stripped = __strip_signature_t<decltype(&_Fp::operator())>> |
| 1748 | packaged_task(_Fp) -> packaged_task<_Stripped>; | 1755 | packaged_task(_Fp) -> packaged_task<_Stripped>; |
| 1749 | 1756 | ||
| 1750 | # endif | 1757 | # endif |
| ... | @@ -1876,7 +1883,7 @@ async(launch __policy, _Fp&& __f, _Args&&... __args) { | ... | @@ -1876,7 +1883,7 @@ async(launch __policy, _Fp&& __f, _Args&&... __args) { |
| 1876 | template <class _Fp, class... _Args> | 1883 | template <class _Fp, class... _Args> |
| 1877 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI future<__invoke_result_t<__decay_t<_Fp>, __decay_t<_Args>...> > | 1884 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI future<__invoke_result_t<__decay_t<_Fp>, __decay_t<_Args>...> > |
| 1878 | async(_Fp&& __f, _Args&&... __args) { | 1885 | async(_Fp&& __f, _Args&&... __args) { |
| 1879 | return std::async(launch::any, std::forward<_Fp>(__f), std::forward<_Args>(__args)...); | 1886 | return std::async(launch::async | launch::deferred, std::forward<_Fp>(__f), std::forward<_Args>(__args)...); |
| 1880 | } | 1887 | } |
| 1881 | 1888 | ||
| 1882 | # endif // C++03 | 1889 | # endif // C++03 |
| ... | @@ -2052,17 +2059,18 @@ inline shared_future<_Rp&> future<_Rp&>::share() _NOEXCEPT { | ... | @@ -2052,17 +2059,18 @@ inline shared_future<_Rp&> future<_Rp&>::share() _NOEXCEPT { |
| 2052 | 2059 | ||
| 2053 | inline shared_future<void> future<void>::share() _NOEXCEPT { return shared_future<void>(std::move(*this)); } | 2060 | inline shared_future<void> future<void>::share() _NOEXCEPT { return shared_future<void>(std::move(*this)); } |
| 2054 | 2061 | ||
| 2062 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 2055 | _LIBCPP_END_NAMESPACE_STD | 2063 | _LIBCPP_END_NAMESPACE_STD |
| 2056 | 2064 | ||
| 2057 | _LIBCPP_POP_MACROS | 2065 | _LIBCPP_POP_MACROS |
| 2058 | 2066 | ||
| 2059 | # endif // _LIBCPP_HAS_THREADS | 2067 | # endif // _LIBCPP_HAS_THREADS |
| 2060 | 2068 | ||
| 2061 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 | 2069 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 17 |
| 2062 | # include <chrono> | 2070 | # include <chrono> |
| 2063 | # endif | 2071 | # endif |
| 2064 | 2072 | ||
| 2065 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 2073 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 2066 | # include <atomic> | 2074 | # include <atomic> |
| 2067 | # include <cstdlib> | 2075 | # include <cstdlib> |
| 2068 | # include <exception> | 2076 | # include <exception> |
| ... | @@ -2070,6 +2078,11 @@ _LIBCPP_POP_MACROS | ... | @@ -2070,6 +2078,11 @@ _LIBCPP_POP_MACROS |
| 2070 | # include <system_error> | 2078 | # include <system_error> |
| 2071 | # include <thread> | 2079 | # include <thread> |
| 2072 | # endif | 2080 | # endif |
| 2081 | |||
| 2082 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 | ||
| 2083 | # include <sstream> | ||
| 2084 | # endif | ||
| 2085 | |||
| 2073 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 2086 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 2074 | 2087 | ||
| 2075 | #endif // _LIBCPP_FUTURE | 2088 | #endif // _LIBCPP_FUTURE |
lib/libcxx/include/initializer_list+5-5| ... | @@ -53,11 +53,11 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in | ... | @@ -53,11 +53,11 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in |
| 53 | # pragma GCC system_header | 53 | # pragma GCC system_header |
| 54 | # endif | 54 | # endif |
| 55 | 55 | ||
| 56 | # ifndef _LIBCPP_CXX03_LANG | ||
| 57 | |||
| 56 | namespace std // purposefully not versioned | 58 | namespace std // purposefully not versioned |
| 57 | { | 59 | { |
| 58 | 60 | ||
| 59 | # ifndef _LIBCPP_CXX03_LANG | ||
| 60 | |||
| 61 | template <class _Ep> | 61 | template <class _Ep> |
| 62 | class _LIBCPP_NO_SPECIALIZATIONS initializer_list { | 62 | class _LIBCPP_NO_SPECIALIZATIONS initializer_list { |
| 63 | const _Ep* __begin_; | 63 | const _Ep* __begin_; |
| ... | @@ -101,11 +101,11 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end(initia | ... | @@ -101,11 +101,11 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end(initia |
| 101 | return __il.end(); | 101 | return __il.end(); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | # endif // !defined(_LIBCPP_CXX03_LANG) | ||
| 105 | |||
| 106 | } // namespace std | 104 | } // namespace std |
| 107 | 105 | ||
| 108 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 106 | # endif // _LIBCPP_CXX03_LANG |
| 107 | |||
| 108 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 | ||
| 109 | # include <cstddef> | 109 | # include <cstddef> |
| 110 | # endif | 110 | # endif |
| 111 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 111 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/inttypes.h deleted-268| ... | @@ -1,268 +0,0 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP_INTTYPES_H | ||
| 11 | // AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T | ||
| 12 | // is defined until an inclusion of it without _STD_TYPES_T occurs, in which | ||
| 13 | // case the header guard macro is defined. | ||
| 14 | #if !defined(_AIX) || !defined(_STD_TYPES_T) | ||
| 15 | # define _LIBCPP_INTTYPES_H | ||
| 16 | #endif // _STD_TYPES_T | ||
| 17 | |||
| 18 | /* | ||
| 19 | inttypes.h synopsis | ||
| 20 | |||
| 21 | This entire header is C99 / C++0X | ||
| 22 | |||
| 23 | #include <stdint.h> // <cinttypes> includes <cstdint> | ||
| 24 | |||
| 25 | Macros: | ||
| 26 | |||
| 27 | PRId8 | ||
| 28 | PRId16 | ||
| 29 | PRId32 | ||
| 30 | PRId64 | ||
| 31 | |||
| 32 | PRIdLEAST8 | ||
| 33 | PRIdLEAST16 | ||
| 34 | PRIdLEAST32 | ||
| 35 | PRIdLEAST64 | ||
| 36 | |||
| 37 | PRIdFAST8 | ||
| 38 | PRIdFAST16 | ||
| 39 | PRIdFAST32 | ||
| 40 | PRIdFAST64 | ||
| 41 | |||
| 42 | PRIdMAX | ||
| 43 | PRIdPTR | ||
| 44 | |||
| 45 | PRIi8 | ||
| 46 | PRIi16 | ||
| 47 | PRIi32 | ||
| 48 | PRIi64 | ||
| 49 | |||
| 50 | PRIiLEAST8 | ||
| 51 | PRIiLEAST16 | ||
| 52 | PRIiLEAST32 | ||
| 53 | PRIiLEAST64 | ||
| 54 | |||
| 55 | PRIiFAST8 | ||
| 56 | PRIiFAST16 | ||
| 57 | PRIiFAST32 | ||
| 58 | PRIiFAST64 | ||
| 59 | |||
| 60 | PRIiMAX | ||
| 61 | PRIiPTR | ||
| 62 | |||
| 63 | PRIo8 | ||
| 64 | PRIo16 | ||
| 65 | PRIo32 | ||
| 66 | PRIo64 | ||
| 67 | |||
| 68 | PRIoLEAST8 | ||
| 69 | PRIoLEAST16 | ||
| 70 | PRIoLEAST32 | ||
| 71 | PRIoLEAST64 | ||
| 72 | |||
| 73 | PRIoFAST8 | ||
| 74 | PRIoFAST16 | ||
| 75 | PRIoFAST32 | ||
| 76 | PRIoFAST64 | ||
| 77 | |||
| 78 | PRIoMAX | ||
| 79 | PRIoPTR | ||
| 80 | |||
| 81 | PRIu8 | ||
| 82 | PRIu16 | ||
| 83 | PRIu32 | ||
| 84 | PRIu64 | ||
| 85 | |||
| 86 | PRIuLEAST8 | ||
| 87 | PRIuLEAST16 | ||
| 88 | PRIuLEAST32 | ||
| 89 | PRIuLEAST64 | ||
| 90 | |||
| 91 | PRIuFAST8 | ||
| 92 | PRIuFAST16 | ||
| 93 | PRIuFAST32 | ||
| 94 | PRIuFAST64 | ||
| 95 | |||
| 96 | PRIuMAX | ||
| 97 | PRIuPTR | ||
| 98 | |||
| 99 | PRIx8 | ||
| 100 | PRIx16 | ||
| 101 | PRIx32 | ||
| 102 | PRIx64 | ||
| 103 | |||
| 104 | PRIxLEAST8 | ||
| 105 | PRIxLEAST16 | ||
| 106 | PRIxLEAST32 | ||
| 107 | PRIxLEAST64 | ||
| 108 | |||
| 109 | PRIxFAST8 | ||
| 110 | PRIxFAST16 | ||
| 111 | PRIxFAST32 | ||
| 112 | PRIxFAST64 | ||
| 113 | |||
| 114 | PRIxMAX | ||
| 115 | PRIxPTR | ||
| 116 | |||
| 117 | PRIX8 | ||
| 118 | PRIX16 | ||
| 119 | PRIX32 | ||
| 120 | PRIX64 | ||
| 121 | |||
| 122 | PRIXLEAST8 | ||
| 123 | PRIXLEAST16 | ||
| 124 | PRIXLEAST32 | ||
| 125 | PRIXLEAST64 | ||
| 126 | |||
| 127 | PRIXFAST8 | ||
| 128 | PRIXFAST16 | ||
| 129 | PRIXFAST32 | ||
| 130 | PRIXFAST64 | ||
| 131 | |||
| 132 | PRIXMAX | ||
| 133 | PRIXPTR | ||
| 134 | |||
| 135 | SCNd8 | ||
| 136 | SCNd16 | ||
| 137 | SCNd32 | ||
| 138 | SCNd64 | ||
| 139 | |||
| 140 | SCNdLEAST8 | ||
| 141 | SCNdLEAST16 | ||
| 142 | SCNdLEAST32 | ||
| 143 | SCNdLEAST64 | ||
| 144 | |||
| 145 | SCNdFAST8 | ||
| 146 | SCNdFAST16 | ||
| 147 | SCNdFAST32 | ||
| 148 | SCNdFAST64 | ||
| 149 | |||
| 150 | SCNdMAX | ||
| 151 | SCNdPTR | ||
| 152 | |||
| 153 | SCNi8 | ||
| 154 | SCNi16 | ||
| 155 | SCNi32 | ||
| 156 | SCNi64 | ||
| 157 | |||
| 158 | SCNiLEAST8 | ||
| 159 | SCNiLEAST16 | ||
| 160 | SCNiLEAST32 | ||
| 161 | SCNiLEAST64 | ||
| 162 | |||
| 163 | SCNiFAST8 | ||
| 164 | SCNiFAST16 | ||
| 165 | SCNiFAST32 | ||
| 166 | SCNiFAST64 | ||
| 167 | |||
| 168 | SCNiMAX | ||
| 169 | SCNiPTR | ||
| 170 | |||
| 171 | SCNo8 | ||
| 172 | SCNo16 | ||
| 173 | SCNo32 | ||
| 174 | SCNo64 | ||
| 175 | |||
| 176 | SCNoLEAST8 | ||
| 177 | SCNoLEAST16 | ||
| 178 | SCNoLEAST32 | ||
| 179 | SCNoLEAST64 | ||
| 180 | |||
| 181 | SCNoFAST8 | ||
| 182 | SCNoFAST16 | ||
| 183 | SCNoFAST32 | ||
| 184 | SCNoFAST64 | ||
| 185 | |||
| 186 | SCNoMAX | ||
| 187 | SCNoPTR | ||
| 188 | |||
| 189 | SCNu8 | ||
| 190 | SCNu16 | ||
| 191 | SCNu32 | ||
| 192 | SCNu64 | ||
| 193 | |||
| 194 | SCNuLEAST8 | ||
| 195 | SCNuLEAST16 | ||
| 196 | SCNuLEAST32 | ||
| 197 | SCNuLEAST64 | ||
| 198 | |||
| 199 | SCNuFAST8 | ||
| 200 | SCNuFAST16 | ||
| 201 | SCNuFAST32 | ||
| 202 | SCNuFAST64 | ||
| 203 | |||
| 204 | SCNuMAX | ||
| 205 | SCNuPTR | ||
| 206 | |||
| 207 | SCNx8 | ||
| 208 | SCNx16 | ||
| 209 | SCNx32 | ||
| 210 | SCNx64 | ||
| 211 | |||
| 212 | SCNxLEAST8 | ||
| 213 | SCNxLEAST16 | ||
| 214 | SCNxLEAST32 | ||
| 215 | SCNxLEAST64 | ||
| 216 | |||
| 217 | SCNxFAST8 | ||
| 218 | SCNxFAST16 | ||
| 219 | SCNxFAST32 | ||
| 220 | SCNxFAST64 | ||
| 221 | |||
| 222 | SCNxMAX | ||
| 223 | SCNxPTR | ||
| 224 | |||
| 225 | Types: | ||
| 226 | |||
| 227 | imaxdiv_t | ||
| 228 | |||
| 229 | intmax_t imaxabs(intmax_t j); | ||
| 230 | imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom); | ||
| 231 | intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base); | ||
| 232 | uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base); | ||
| 233 | intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); | ||
| 234 | uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); | ||
| 235 | |||
| 236 | */ | ||
| 237 | |||
| 238 | #if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | ||
| 239 | # include <__cxx03/__config> | ||
| 240 | #else | ||
| 241 | # include <__config> | ||
| 242 | #endif | ||
| 243 | |||
| 244 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 245 | # pragma GCC system_header | ||
| 246 | #endif | ||
| 247 | |||
| 248 | /* C99 stdlib (e.g. glibc < 2.18) does not provide format macros needed | ||
| 249 | for C++11 unless __STDC_FORMAT_MACROS is defined | ||
| 250 | */ | ||
| 251 | #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) | ||
| 252 | # define __STDC_FORMAT_MACROS | ||
| 253 | #endif | ||
| 254 | |||
| 255 | #if __has_include_next(<inttypes.h>) | ||
| 256 | # include_next <inttypes.h> | ||
| 257 | #endif | ||
| 258 | |||
| 259 | #ifdef __cplusplus | ||
| 260 | |||
| 261 | # include <stdint.h> | ||
| 262 | |||
| 263 | # undef imaxabs | ||
| 264 | # undef imaxdiv | ||
| 265 | |||
| 266 | #endif // __cplusplus | ||
| 267 | |||
| 268 | #endif // _LIBCPP_INTTYPES_H | ||
lib/libcxx/include/iomanip+4-18| ... | @@ -413,6 +413,8 @@ inline _LIBCPP_HIDE_FROM_ABI __iom_t10<_CharT> put_time(const tm* __tm, const _C | ... | @@ -413,6 +413,8 @@ inline _LIBCPP_HIDE_FROM_ABI __iom_t10<_CharT> put_time(const tm* __tm, const _C |
| 413 | return __iom_t10<_CharT>(__tm, __fmt); | 413 | return __iom_t10<_CharT>(__tm, __fmt); |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | # if _LIBCPP_STD_VER >= 14 | ||
| 417 | |||
| 416 | template <class _CharT, class _Traits> | 418 | template <class _CharT, class _Traits> |
| 417 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& __quoted_output( | 419 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& __quoted_output( |
| 418 | basic_ostream<_CharT, _Traits>& __os, | 420 | basic_ostream<_CharT, _Traits>& __os, |
| ... | @@ -502,22 +504,6 @@ struct _LIBCPP_HIDDEN __quoted_proxy { | ... | @@ -502,22 +504,6 @@ struct _LIBCPP_HIDDEN __quoted_proxy { |
| 502 | } | 504 | } |
| 503 | }; | 505 | }; |
| 504 | 506 | ||
| 505 | template <class _CharT, class _Traits, class _Allocator> | ||
| 506 | _LIBCPP_HIDE_FROM_ABI __quoted_output_proxy<_CharT, _Traits> | ||
| 507 | __quoted(const basic_string<_CharT, _Traits, _Allocator>& __s, | ||
| 508 | _CharT __delim = _CharT('"'), | ||
| 509 | _CharT __escape = _CharT('\\')) { | ||
| 510 | return __quoted_output_proxy<_CharT, _Traits>(__s.data(), __s.data() + __s.size(), __delim, __escape); | ||
| 511 | } | ||
| 512 | |||
| 513 | template <class _CharT, class _Traits, class _Allocator> | ||
| 514 | _LIBCPP_HIDE_FROM_ABI __quoted_proxy<_CharT, _Traits, _Allocator> | ||
| 515 | __quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) { | ||
| 516 | return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape); | ||
| 517 | } | ||
| 518 | |||
| 519 | # if _LIBCPP_STD_VER >= 14 | ||
| 520 | |||
| 521 | template <class _CharT> | 507 | template <class _CharT> |
| 522 | _LIBCPP_HIDE_FROM_ABI auto quoted(const _CharT* __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) { | 508 | _LIBCPP_HIDE_FROM_ABI auto quoted(const _CharT* __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) { |
| 523 | const _CharT* __end = __s; | 509 | const _CharT* __end = __s; |
| ... | @@ -552,7 +538,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -552,7 +538,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 552 | 538 | ||
| 553 | # endif // _LIBCPP_HAS_LOCALIZATION | 539 | # endif // _LIBCPP_HAS_LOCALIZATION |
| 554 | 540 | ||
| 555 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 541 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 556 | # include <array> | 542 | # include <array> |
| 557 | # include <bitset> | 543 | # include <bitset> |
| 558 | # include <deque> | 544 | # include <deque> |
| ... | @@ -567,7 +553,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -567,7 +553,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 567 | # include <vector> | 553 | # include <vector> |
| 568 | # endif | 554 | # endif |
| 569 | 555 | ||
| 570 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23 | 556 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 571 | # include <locale> | 557 | # include <locale> |
| 572 | # endif | 558 | # endif |
| 573 | 559 |
lib/libcxx/include/ios+18-15| ... | @@ -235,10 +235,6 @@ storage-class-specifier const error_category& iostream_category() noexcept; | ... | @@ -235,10 +235,6 @@ storage-class-specifier const error_category& iostream_category() noexcept; |
| 235 | # include <__verbose_abort> | 235 | # include <__verbose_abort> |
| 236 | # include <version> | 236 | # include <version> |
| 237 | 237 | ||
| 238 | # if _LIBCPP_HAS_ATOMIC_HEADER | ||
| 239 | # include <__atomic/atomic.h> // for __xindex_ | ||
| 240 | # endif | ||
| 241 | |||
| 242 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 238 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 243 | # pragma GCC system_header | 239 | # pragma GCC system_header |
| 244 | # endif | 240 | # endif |
| ... | @@ -247,6 +243,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -247,6 +243,7 @@ _LIBCPP_PUSH_MACROS |
| 247 | # include <__undef_macros> | 243 | # include <__undef_macros> |
| 248 | 244 | ||
| 249 | _LIBCPP_BEGIN_NAMESPACE_STD | 245 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 246 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 250 | 247 | ||
| 251 | typedef ptrdiff_t streamsize; | 248 | typedef ptrdiff_t streamsize; |
| 252 | 249 | ||
| ... | @@ -361,7 +358,7 @@ public: | ... | @@ -361,7 +358,7 @@ public: |
| 361 | } | 358 | } |
| 362 | 359 | ||
| 363 | protected: | 360 | protected: |
| 364 | _LIBCPP_HIDE_FROM_ABI ios_base() : __loc_(nullptr) { | 361 | _LIBCPP_HIDE_FROM_ABI ios_base() : __loc_(__private_constructor_tag(), nullptr) { |
| 365 | // Purposefully does no initialization | 362 | // Purposefully does no initialization |
| 366 | // | 363 | // |
| 367 | // Except for the locale, this is a sentinel to avoid destroying | 364 | // Except for the locale, this is a sentinel to avoid destroying |
| ... | @@ -386,25 +383,25 @@ protected: | ... | @@ -386,25 +383,25 @@ protected: |
| 386 | _LIBCPP_HIDE_FROM_ABI void set_rdbuf(void* __sb) { __rdbuf_ = __sb; } | 383 | _LIBCPP_HIDE_FROM_ABI void set_rdbuf(void* __sb) { __rdbuf_ = __sb; } |
| 387 | 384 | ||
| 388 | private: | 385 | private: |
| 389 | // All data members must be scalars | ||
| 390 | fmtflags __fmtflags_; | 386 | fmtflags __fmtflags_; |
| 391 | streamsize __precision_; | 387 | streamsize __precision_; |
| 392 | streamsize __width_; | 388 | streamsize __width_; |
| 393 | iostate __rdstate_; | 389 | iostate __rdstate_; |
| 394 | iostate __exceptions_; | 390 | iostate __exceptions_; |
| 395 | void* __rdbuf_; | 391 | void* __rdbuf_; |
| 396 | void* __loc_; | 392 | # ifndef _LIBCPP_CXX03_LANG |
| 393 | union { | ||
| 394 | locale __loc_; | ||
| 395 | }; | ||
| 396 | # else | ||
| 397 | // We only care about the union above to implement the destructor correctly, which we do in C++26 anyways. No need to | ||
| 398 | // handle C++03 shenanigans. | ||
| 399 | locale __loc_; | ||
| 400 | # endif | ||
| 397 | event_callback* __fn_; | 401 | event_callback* __fn_; |
| 398 | int* __index_; | 402 | int* __index_; |
| 399 | size_t __event_size_; | 403 | size_t __event_size_; |
| 400 | size_t __event_cap_; | 404 | size_t __event_cap_; |
| 401 | // TODO(EricWF): Enable this for both Clang and GCC. Currently it is only | ||
| 402 | // enabled with clang. | ||
| 403 | # if _LIBCPP_HAS_C_ATOMIC_IMP && _LIBCPP_HAS_THREADS | ||
| 404 | static atomic<int> __xindex_; | ||
| 405 | # else | ||
| 406 | static int __xindex_; | ||
| 407 | # endif | ||
| 408 | long* __iarray_; | 405 | long* __iarray_; |
| 409 | size_t __iarray_size_; | 406 | size_t __iarray_size_; |
| 410 | size_t __iarray_cap_; | 407 | size_t __iarray_cap_; |
| ... | @@ -871,13 +868,19 @@ _LIBCPP_HIDE_FROM_ABI inline ios_base& defaultfloat(ios_base& __str) { | ... | @@ -871,13 +868,19 @@ _LIBCPP_HIDE_FROM_ABI inline ios_base& defaultfloat(ios_base& __str) { |
| 871 | return __str; | 868 | return __str; |
| 872 | } | 869 | } |
| 873 | 870 | ||
| 871 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 874 | _LIBCPP_END_NAMESPACE_STD | 872 | _LIBCPP_END_NAMESPACE_STD |
| 875 | 873 | ||
| 876 | _LIBCPP_POP_MACROS | 874 | _LIBCPP_POP_MACROS |
| 877 | 875 | ||
| 878 | # endif // _LIBCPP_HAS_LOCALIZATION | 876 | # endif // _LIBCPP_HAS_LOCALIZATION |
| 879 | 877 | ||
| 880 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 878 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 879 | # include <ctime> | ||
| 880 | # include <ratio> | ||
| 881 | # endif | ||
| 882 | |||
| 883 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 | ||
| 881 | # include <atomic> | 884 | # include <atomic> |
| 882 | # include <concepts> | 885 | # include <concepts> |
| 883 | # include <cstddef> | 886 | # include <cstddef> |
lib/libcxx/include/istream+4-2| ... | @@ -190,6 +190,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -190,6 +190,7 @@ _LIBCPP_PUSH_MACROS |
| 190 | # include <__undef_macros> | 190 | # include <__undef_macros> |
| 191 | 191 | ||
| 192 | _LIBCPP_BEGIN_NAMESPACE_STD | 192 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 193 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 193 | 194 | ||
| 194 | template <class _CharT, class _Traits> | 195 | template <class _CharT, class _Traits> |
| 195 | class basic_istream : virtual public basic_ios<_CharT, _Traits> { | 196 | class basic_istream : virtual public basic_ios<_CharT, _Traits> { |
| ... | @@ -1405,20 +1406,21 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>; | ... | @@ -1405,20 +1406,21 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>; |
| 1405 | # endif | 1406 | # endif |
| 1406 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>; | 1407 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>; |
| 1407 | 1408 | ||
| 1409 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 1408 | _LIBCPP_END_NAMESPACE_STD | 1410 | _LIBCPP_END_NAMESPACE_STD |
| 1409 | 1411 | ||
| 1410 | _LIBCPP_POP_MACROS | 1412 | _LIBCPP_POP_MACROS |
| 1411 | 1413 | ||
| 1412 | # endif // _LIBCPP_HAS_LOCALIZATION | 1414 | # endif // _LIBCPP_HAS_LOCALIZATION |
| 1413 | 1415 | ||
| 1414 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1416 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1415 | # include <concepts> | 1417 | # include <concepts> |
| 1416 | # include <iosfwd> | 1418 | # include <iosfwd> |
| 1417 | # include <ostream> | 1419 | # include <ostream> |
| 1418 | # include <type_traits> | 1420 | # include <type_traits> |
| 1419 | # endif | 1421 | # endif |
| 1420 | 1422 | ||
| 1421 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23 | 1423 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 1422 | # include <locale> | 1424 | # include <locale> |
| 1423 | # endif | 1425 | # endif |
| 1424 | 1426 |
lib/libcxx/include/iterator+2-2| ... | @@ -751,11 +751,11 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept; | ... | @@ -751,11 +751,11 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept; |
| 751 | # pragma GCC system_header | 751 | # pragma GCC system_header |
| 752 | # endif | 752 | # endif |
| 753 | 753 | ||
| 754 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 | 754 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 17 |
| 755 | # include <variant> | 755 | # include <variant> |
| 756 | # endif | 756 | # endif |
| 757 | 757 | ||
| 758 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 758 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 759 | # include <cstddef> | 759 | # include <cstddef> |
| 760 | # include <cstdlib> | 760 | # include <cstdlib> |
| 761 | # include <exception> | 761 | # include <exception> |
lib/libcxx/include/latch+1-1| ... | @@ -128,7 +128,7 @@ _LIBCPP_POP_MACROS | ... | @@ -128,7 +128,7 @@ _LIBCPP_POP_MACROS |
| 128 | 128 | ||
| 129 | # endif // _LIBCPP_HAS_THREADS | 129 | # endif // _LIBCPP_HAS_THREADS |
| 130 | 130 | ||
| 131 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 131 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 132 | # include <atomic> | 132 | # include <atomic> |
| 133 | # include <cstddef> | 133 | # include <cstddef> |
| 134 | # endif | 134 | # endif |
lib/libcxx/include/limits+12-4| ... | @@ -108,6 +108,7 @@ template<> class numeric_limits<cv long double>; | ... | @@ -108,6 +108,7 @@ template<> class numeric_limits<cv long double>; |
| 108 | # include <__config> | 108 | # include <__config> |
| 109 | # include <__type_traits/is_arithmetic.h> | 109 | # include <__type_traits/is_arithmetic.h> |
| 110 | # include <__type_traits/is_same.h> | 110 | # include <__type_traits/is_same.h> |
| 111 | # include <__type_traits/make_unsigned.h> | ||
| 111 | 112 | ||
| 112 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 113 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 113 | # pragma GCC system_header | 114 | # pragma GCC system_header |
| ... | @@ -184,9 +185,16 @@ protected: | ... | @@ -184,9 +185,16 @@ protected: |
| 184 | 185 | ||
| 185 | static _LIBCPP_CONSTEXPR const bool is_specialized = true; | 186 | static _LIBCPP_CONSTEXPR const bool is_specialized = true; |
| 186 | 187 | ||
| 187 | static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0); | 188 | static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0); |
| 188 | static _LIBCPP_CONSTEXPR const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed); | 189 | // Number of value bits in type. Works for any integer type, including |
| 189 | static _LIBCPP_CONSTEXPR const int digits10 = digits * 3 / 10; | 190 | // _BitInt(N), whose sizeof(type) * CHAR_BIT may include padding. |
| 191 | static _LIBCPP_CONSTEXPR const int digits = | ||
| 192 | __builtin_popcountg(static_cast<__make_unsigned_t<type> >(~__make_unsigned_t<type>(0))) - is_signed; | ||
| 193 | // digits10 = floor(digits * log10(2)). 1936274/6432163 is a continued-fraction | ||
| 194 | // convergent of log10(2) and matches floor(digits * log10(2)) exactly for every | ||
| 195 | // digits in [1, 8388608], i.e. up to __BITINT_MAXWIDTH__ on x86. | ||
| 196 | // TODO: switch to __builtin_log10 once it becomes constexpr. | ||
| 197 | static _LIBCPP_CONSTEXPR const int digits10 = static_cast<int>((digits * 1936274LL) / 6432163); | ||
| 190 | static _LIBCPP_CONSTEXPR const int max_digits10 = 0; | 198 | static _LIBCPP_CONSTEXPR const int max_digits10 = 0; |
| 191 | static _LIBCPP_CONSTEXPR const type __min = is_signed ? _Tp(_Tp(1) << digits) : 0; | 199 | static _LIBCPP_CONSTEXPR const type __min = is_signed ? _Tp(_Tp(1) << digits) : 0; |
| 192 | static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0); | 200 | static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0); |
| ... | @@ -520,7 +528,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -520,7 +528,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 520 | 528 | ||
| 521 | _LIBCPP_POP_MACROS | 529 | _LIBCPP_POP_MACROS |
| 522 | 530 | ||
| 523 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 531 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 524 | # include <type_traits> | 532 | # include <type_traits> |
| 525 | # endif | 533 | # endif |
| 526 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 534 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/list+6-6| ... | @@ -39,7 +39,7 @@ public: | ... | @@ -39,7 +39,7 @@ public: |
| 39 | noexcept(is_nothrow_default_constructible<allocator_type>::value); | 39 | noexcept(is_nothrow_default_constructible<allocator_type>::value); |
| 40 | explicit list(const allocator_type& a); | 40 | explicit list(const allocator_type& a); |
| 41 | explicit list(size_type n); | 41 | explicit list(size_type n); |
| 42 | explicit list(size_type n, const allocator_type& a); // C++14 | 42 | explicit list(size_type n, const allocator_type& a); |
| 43 | list(size_type n, const value_type& value); | 43 | list(size_type n, const value_type& value); |
| 44 | list(size_type n, const value_type& value, const allocator_type& a); | 44 | list(size_type n, const value_type& value, const allocator_type& a); |
| 45 | template <class Iter> | 45 | template <class Iter> |
| ... | @@ -708,9 +708,7 @@ public: | ... | @@ -708,9 +708,7 @@ public: |
| 708 | _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) {} | 708 | _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) {} |
| 709 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit list(const allocator_type& __a) : __base(__a) {} | 709 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit list(const allocator_type& __a) : __base(__a) {} |
| 710 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n); | 710 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n); |
| 711 | # if _LIBCPP_STD_VER >= 14 | ||
| 712 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n, const allocator_type& __a); | 711 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n, const allocator_type& __a); |
| 713 | # endif | ||
| 714 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x); | 712 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x); |
| 715 | template <__enable_if_t<__is_allocator_v<_Alloc>, int> = 0> | 713 | template <__enable_if_t<__is_allocator_v<_Alloc>, int> = 0> |
| 716 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI | 714 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI |
| ... | @@ -1066,13 +1064,15 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 list<_Tp, _Alloc>::list(size_type __n) { | ... | @@ -1066,13 +1064,15 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 list<_Tp, _Alloc>::list(size_type __n) { |
| 1066 | # endif | 1064 | # endif |
| 1067 | } | 1065 | } |
| 1068 | 1066 | ||
| 1069 | # if _LIBCPP_STD_VER >= 14 | ||
| 1070 | template <class _Tp, class _Alloc> | 1067 | template <class _Tp, class _Alloc> |
| 1071 | _LIBCPP_CONSTEXPR_SINCE_CXX26 list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : __base(__a) { | 1068 | _LIBCPP_CONSTEXPR_SINCE_CXX26 list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : __base(__a) { |
| 1072 | for (; __n > 0; --__n) | 1069 | for (; __n > 0; --__n) |
| 1070 | # ifndef _LIBCPP_CXX03_LANG | ||
| 1073 | emplace_back(); | 1071 | emplace_back(); |
| 1074 | } | 1072 | # else |
| 1073 | push_back(value_type()); | ||
| 1075 | # endif | 1074 | # endif |
| 1075 | } | ||
| 1076 | 1076 | ||
| 1077 | template <class _Tp, class _Alloc> | 1077 | template <class _Tp, class _Alloc> |
| 1078 | _LIBCPP_CONSTEXPR_SINCE_CXX26 list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) { | 1078 | _LIBCPP_CONSTEXPR_SINCE_CXX26 list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) { |
| ... | @@ -1815,7 +1815,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -1815,7 +1815,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 1815 | 1815 | ||
| 1816 | _LIBCPP_POP_MACROS | 1816 | _LIBCPP_POP_MACROS |
| 1817 | 1817 | ||
| 1818 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1818 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1819 | # include <algorithm> | 1819 | # include <algorithm> |
| 1820 | # include <atomic> | 1820 | # include <atomic> |
| 1821 | # include <concepts> | 1821 | # include <concepts> |
lib/libcxx/include/locale+1-1| ... | @@ -210,7 +210,7 @@ template <class charT> class messages_byname; | ... | @@ -210,7 +210,7 @@ template <class charT> class messages_byname; |
| 210 | 210 | ||
| 211 | # endif // _LIBCPP_HAS_LOCALIZATION | 211 | # endif // _LIBCPP_HAS_LOCALIZATION |
| 212 | 212 | ||
| 213 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 213 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 214 | # include <atomic> | 214 | # include <atomic> |
| 215 | # include <concepts> | 215 | # include <concepts> |
| 216 | # include <cstdarg> | 216 | # include <cstdarg> |
lib/libcxx/include/map+565-397| ... | @@ -57,177 +57,175 @@ public: | ... | @@ -57,177 +57,175 @@ public: |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | // construct/copy/destroy: | 59 | // construct/copy/destroy: |
| 60 | map() | 60 | constexpr map() |
| 61 | noexcept( | 61 | noexcept( |
| 62 | is_nothrow_default_constructible<allocator_type>::value && | 62 | is_nothrow_default_constructible<allocator_type>::value && |
| 63 | is_nothrow_default_constructible<key_compare>::value && | 63 | is_nothrow_default_constructible<key_compare>::value && |
| 64 | is_nothrow_copy_constructible<key_compare>::value); | 64 | is_nothrow_copy_constructible<key_compare>::value); |
| 65 | explicit map(const key_compare& comp); | 65 | constexpr explicit map(const key_compare& comp); |
| 66 | map(const key_compare& comp, const allocator_type& a); | 66 | constexpr map(const key_compare& comp, const allocator_type& a); |
| 67 | template <class InputIterator> | 67 | template <class InputIterator> |
| 68 | map(InputIterator first, InputIterator last, | 68 | constexpr map(InputIterator first, InputIterator last, |
| 69 | const key_compare& comp = key_compare()); | 69 | const key_compare& comp = key_compare()); |
| 70 | template <class InputIterator> | 70 | template <class InputIterator> |
| 71 | map(InputIterator first, InputIterator last, | 71 | constexpr map(InputIterator first, InputIterator last, |
| 72 | const key_compare& comp, const allocator_type& a); | 72 | const key_compare& comp, const allocator_type& a); |
| 73 | template<container-compatible-range<value_type> R> | 73 | template<container-compatible-range<value_type> R> |
| 74 | map(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23 | 74 | constexpr map(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23 |
| 75 | map(const map& m); | 75 | constexpr map(const map& m); |
| 76 | map(map&& m) | 76 | constexpr map(map&& m) |
| 77 | noexcept( | 77 | noexcept( |
| 78 | is_nothrow_move_constructible<allocator_type>::value && | 78 | is_nothrow_move_constructible<allocator_type>::value && |
| 79 | is_nothrow_move_constructible<key_compare>::value); | 79 | is_nothrow_move_constructible<key_compare>::value); |
| 80 | explicit map(const allocator_type& a); | 80 | constexpr explicit map(const allocator_type& a); |
| 81 | map(const map& m, const allocator_type& a); | 81 | constexpr map(const map& m, const allocator_type& a); |
| 82 | map(map&& m, const allocator_type& a); | 82 | constexpr map(map&& m, const allocator_type& a); |
| 83 | map(initializer_list<value_type> il, const key_compare& comp = key_compare()); | 83 | constexpr map(initializer_list<value_type> il, const key_compare& comp = key_compare()); |
| 84 | map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a); | 84 | constexpr map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a); |
| 85 | template <class InputIterator> | 85 | template <class InputIterator> |
| 86 | map(InputIterator first, InputIterator last, const allocator_type& a) | 86 | constexpr map(InputIterator first, InputIterator last, const allocator_type& a) |
| 87 | : map(first, last, Compare(), a) {} // C++14 | 87 | : map(first, last, Compare(), a) {} |
| 88 | template<container-compatible-range<value_type> R> | 88 | template<container-compatible-range<value_type> R> |
| 89 | map(from_range_t, R&& rg, const Allocator& a)) | 89 | constexpr map(from_range_t, R&& rg, const Allocator& a)) |
| 90 | : map(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 | 90 | : map(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 |
| 91 | map(initializer_list<value_type> il, const allocator_type& a) | 91 | constexpr map(initializer_list<value_type> il, const allocator_type& a) |
| 92 | : map(il, Compare(), a) {} // C++14 | 92 | : map(il, Compare(), a) {} |
| 93 | ~map(); | 93 | constexpr ~map(); |
| 94 | 94 | ||
| 95 | map& operator=(const map& m); | 95 | constexpr map& operator=(const map& m); |
| 96 | map& operator=(map&& m) | 96 | constexpr map& operator=(map&& m) |
| 97 | noexcept( | 97 | noexcept( |
| 98 | allocator_type::propagate_on_container_move_assignment::value && | 98 | allocator_type::propagate_on_container_move_assignment::value && |
| 99 | is_nothrow_move_assignable<allocator_type>::value && | 99 | is_nothrow_move_assignable<allocator_type>::value && |
| 100 | is_nothrow_move_assignable<key_compare>::value); | 100 | is_nothrow_move_assignable<key_compare>::value); |
| 101 | map& operator=(initializer_list<value_type> il); | 101 | constexpr map& operator=(initializer_list<value_type> il); |
| 102 | 102 | ||
| 103 | // iterators: | 103 | // iterators: |
| 104 | iterator begin() noexcept; | 104 | constexpr iterator begin() noexcept; |
| 105 | const_iterator begin() const noexcept; | 105 | constexpr const_iterator begin() const noexcept; |
| 106 | iterator end() noexcept; | 106 | constexpr iterator end() noexcept; |
| 107 | const_iterator end() const noexcept; | 107 | constexpr const_iterator end() const noexcept; |
| 108 | 108 | ||
| 109 | reverse_iterator rbegin() noexcept; | 109 | constexpr reverse_iterator rbegin() noexcept; |
| 110 | const_reverse_iterator rbegin() const noexcept; | 110 | constexpr const_reverse_iterator rbegin() const noexcept; |
| 111 | reverse_iterator rend() noexcept; | 111 | constexpr reverse_iterator rend() noexcept; |
| 112 | const_reverse_iterator rend() const noexcept; | 112 | constexpr const_reverse_iterator rend() const noexcept; |
| 113 | 113 | ||
| 114 | const_iterator cbegin() const noexcept; | 114 | constexpr const_iterator cbegin() const noexcept; |
| 115 | const_iterator cend() const noexcept; | 115 | constexpr const_iterator cend() const noexcept; |
| 116 | const_reverse_iterator crbegin() const noexcept; | 116 | constexpr const_reverse_iterator crbegin() const noexcept; |
| 117 | const_reverse_iterator crend() const noexcept; | 117 | constexpr const_reverse_iterator crend() const noexcept; |
| 118 | 118 | ||
| 119 | // capacity: | 119 | // capacity: |
| 120 | bool empty() const noexcept; | 120 | constexpr bool empty() const noexcept; |
| 121 | size_type size() const noexcept; | 121 | constexpr size_type size() const noexcept; |
| 122 | size_type max_size() const noexcept; | 122 | constexpr size_type max_size() const noexcept; |
| 123 | 123 | ||
| 124 | // element access: | 124 | // element access: |
| 125 | mapped_type& operator[](const key_type& k); | 125 | constexpr mapped_type& operator[](const key_type& k); |
| 126 | mapped_type& operator[](key_type&& k); | 126 | constexpr mapped_type& operator[](key_type&& k); |
| 127 | 127 | ||
| 128 | mapped_type& at(const key_type& k); | 128 | constexpr mapped_type& at(const key_type& k); |
| 129 | const mapped_type& at(const key_type& k) const; | 129 | constexpr const mapped_type& at(const key_type& k) const; |
| 130 | 130 | ||
| 131 | // modifiers: | 131 | // modifiers: |
| 132 | template <class... Args> | 132 | template <class... Args> |
| 133 | pair<iterator, bool> emplace(Args&&... args); | 133 | constexpr pair<iterator, bool> emplace(Args&&... args); |
| 134 | template <class... Args> | 134 | template <class... Args> |
| 135 | iterator emplace_hint(const_iterator position, Args&&... args); | 135 | constexpr iterator emplace_hint(const_iterator position, Args&&... args); |
| 136 | pair<iterator, bool> insert(const value_type& v); | 136 | constexpr pair<iterator, bool> insert(const value_type& v); |
| 137 | pair<iterator, bool> insert( value_type&& v); // C++17 | 137 | constexpr pair<iterator, bool> insert( value_type&& v); // C++17 |
| 138 | template <class P> | 138 | template <class P> constexpr pair<iterator, bool> insert(P&& p); |
| 139 | pair<iterator, bool> insert(P&& p); | 139 | constexpr iterator insert(const_iterator position, const value_type& v); |
| 140 | iterator insert(const_iterator position, const value_type& v); | 140 | constexpr iterator insert(const_iterator position, value_type&& v); // C++17 |
| 141 | iterator insert(const_iterator position, value_type&& v); // C++17 | 141 | template <class P> constexpr iterator insert(const_iterator position, P&& p); |
| 142 | template <class P> | 142 | template <class InputIterator> constexpr void insert(InputIterator first, InputIterator last); |
| 143 | iterator insert(const_iterator position, P&& p); | 143 | |
| 144 | template <class InputIterator> | ||
| 145 | void insert(InputIterator first, InputIterator last); | ||
| 146 | template<container-compatible-range<value_type> R> | 144 | template<container-compatible-range<value_type> R> |
| 147 | void insert_range(R&& rg); // C++23 | 145 | constexpr void insert_range(R&& rg); // C++23 |
| 148 | void insert(initializer_list<value_type> il); | 146 | constexpr void insert(initializer_list<value_type> il); |
| 149 | 147 | ||
| 150 | node_type extract(const_iterator position); // C++17 | 148 | constexpr node_type extract(const_iterator position); // C++17 |
| 151 | node_type extract(const key_type& x); // C++17 | 149 | constexpr node_type extract(const key_type& x); // C++17 |
| 152 | insert_return_type insert(node_type&& nh); // C++17 | 150 | constexpr insert_return_type insert(node_type&& nh); // C++17 |
| 153 | iterator insert(const_iterator hint, node_type&& nh); // C++17 | 151 | constexpr iterator insert(const_iterator hint, node_type&& nh); // C++17 |
| 154 | 152 | ||
| 155 | template <class... Args> | 153 | template <class... Args> |
| 156 | pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17 | 154 | constexpr pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17 |
| 157 | template <class... Args> | 155 | template <class... Args> |
| 158 | pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17 | 156 | constexpr pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17 |
| 159 | template <class... Args> | 157 | template <class... Args> |
| 160 | iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17 | 158 | constexpr iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17 |
| 161 | template <class... Args> | 159 | template <class... Args> |
| 162 | iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17 | 160 | constexpr iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17 |
| 163 | template <class M> | 161 | template <class M> |
| 164 | pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17 | 162 | constexpr pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17 |
| 165 | template <class M> | 163 | template <class M> |
| 166 | pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17 | 164 | constexpr pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17 |
| 167 | template <class M> | 165 | template <class M> |
| 168 | iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17 | 166 | constexpr iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17 |
| 169 | template <class M> | 167 | template <class M> |
| 170 | iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17 | 168 | constexpr iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17 |
| 171 | 169 | ||
| 172 | iterator erase(const_iterator position); | 170 | constexpr iterator erase(const_iterator position); |
| 173 | iterator erase(iterator position); // C++14 | 171 | constexpr iterator erase(iterator position); // C++14 |
| 174 | size_type erase(const key_type& k); | 172 | constexpr size_type erase(const key_type& k); |
| 175 | iterator erase(const_iterator first, const_iterator last); | 173 | constexpr iterator erase(const_iterator first, const_iterator last); |
| 176 | void clear() noexcept; | 174 | constexpr void clear() noexcept; |
| 177 | 175 | ||
| 178 | template<class C2> | 176 | template<class C2> |
| 179 | void merge(map<Key, T, C2, Allocator>& source); // C++17 | 177 | constexpr void merge(map<Key, T, C2, Allocator>& source); // C++17 |
| 180 | template<class C2> | 178 | template<class C2> |
| 181 | void merge(map<Key, T, C2, Allocator>&& source); // C++17 | 179 | constexpr void merge(map<Key, T, C2, Allocator>&& source); // C++17 |
| 182 | template<class C2> | 180 | template<class C2> |
| 183 | void merge(multimap<Key, T, C2, Allocator>& source); // C++17 | 181 | constexpr void merge(multimap<Key, T, C2, Allocator>& source); // C++17 |
| 184 | template<class C2> | 182 | template<class C2> |
| 185 | void merge(multimap<Key, T, C2, Allocator>&& source); // C++17 | 183 | constexpr void merge(multimap<Key, T, C2, Allocator>&& source); // C++17 |
| 186 | 184 | ||
| 187 | void swap(map& m) | 185 | constexpr void swap(map& m) |
| 188 | noexcept(allocator_traits<allocator_type>::is_always_equal::value && | 186 | noexcept(allocator_traits<allocator_type>::is_always_equal::value && |
| 189 | is_nothrow_swappable<key_compare>::value); // C++17 | 187 | is_nothrow_swappable<key_compare>::value); // C++17 |
| 190 | 188 | ||
| 191 | // observers: | 189 | // observers: |
| 192 | allocator_type get_allocator() const noexcept; | 190 | constexpr allocator_type get_allocator() const noexcept; |
| 193 | key_compare key_comp() const; | 191 | constexpr key_compare key_comp() const; |
| 194 | value_compare value_comp() const; | 192 | constexpr value_compare value_comp() const; |
| 195 | 193 | ||
| 196 | // map operations: | 194 | // map operations: |
| 197 | iterator find(const key_type& k); | 195 | constexpr iterator find(const key_type& k); |
| 198 | const_iterator find(const key_type& k) const; | 196 | constexpr const_iterator find(const key_type& k) const; |
| 199 | template<typename K> | 197 | template<typename K> |
| 200 | iterator find(const K& x); // C++14 | 198 | constexpr iterator find(const K& x); // C++14 |
| 201 | template<typename K> | 199 | template<typename K> |
| 202 | const_iterator find(const K& x) const; // C++14 | 200 | constexpr const_iterator find(const K& x) const; // C++14 |
| 203 | 201 | ||
| 204 | template<typename K> | 202 | template<typename K> |
| 205 | size_type count(const K& x) const; // C++14 | 203 | constexpr size_type count(const K& x) const; // C++14 |
| 206 | size_type count(const key_type& k) const; | 204 | constexpr size_type count(const key_type& k) const; |
| 207 | 205 | ||
| 208 | bool contains(const key_type& x) const; // C++20 | 206 | constexpr bool contains(const key_type& x) const; // C++20 |
| 209 | template<class K> bool contains(const K& x) const; // C++20 | 207 | template<class K> constexpr bool contains(const K& x) const; // C++20 |
| 210 | 208 | ||
| 211 | iterator lower_bound(const key_type& k); | 209 | constexpr iterator lower_bound(const key_type& k); |
| 212 | const_iterator lower_bound(const key_type& k) const; | 210 | constexpr const_iterator lower_bound(const key_type& k) const; |
| 213 | template<typename K> | 211 | template<typename K> |
| 214 | iterator lower_bound(const K& x); // C++14 | 212 | constexpr iterator lower_bound(const K& x); // C++14 |
| 215 | template<typename K> | 213 | template<typename K> |
| 216 | const_iterator lower_bound(const K& x) const; // C++14 | 214 | constexpr const_iterator lower_bound(const K& x) const; // C++14 |
| 217 | 215 | ||
| 218 | iterator upper_bound(const key_type& k); | 216 | constexpr iterator upper_bound(const key_type& k); |
| 219 | const_iterator upper_bound(const key_type& k) const; | 217 | constexpr const_iterator upper_bound(const key_type& k) const; |
| 220 | template<typename K> | 218 | template<typename K> |
| 221 | iterator upper_bound(const K& x); // C++14 | 219 | constexpr iterator upper_bound(const K& x); // C++14 |
| 222 | template<typename K> | 220 | template<typename K> |
| 223 | const_iterator upper_bound(const K& x) const; // C++14 | 221 | constexpr const_iterator upper_bound(const K& x) const; // C++14 |
| 224 | 222 | ||
| 225 | pair<iterator,iterator> equal_range(const key_type& k); | 223 | constexpr pair<iterator,iterator> equal_range(const key_type& k); |
| 226 | pair<const_iterator,const_iterator> equal_range(const key_type& k) const; | 224 | constexpr pair<const_iterator,const_iterator> equal_range(const key_type& k) const; |
| 227 | template<typename K> | 225 | template<typename K> |
| 228 | pair<iterator,iterator> equal_range(const K& x); // C++14 | 226 | constexpr pair<iterator,iterator> equal_range(const K& x); // C++14 |
| 229 | template<typename K> | 227 | template<typename K> |
| 230 | pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 | 228 | constexpr pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 |
| 231 | }; | 229 | }; |
| 232 | 230 | ||
| 233 | template <class InputIterator, | 231 | template <class InputIterator, |
| ... | @@ -370,12 +368,12 @@ public: | ... | @@ -370,12 +368,12 @@ public: |
| 370 | const allocator_type& a); | 368 | const allocator_type& a); |
| 371 | template <class InputIterator> | 369 | template <class InputIterator> |
| 372 | multimap(InputIterator first, InputIterator last, const allocator_type& a) | 370 | multimap(InputIterator first, InputIterator last, const allocator_type& a) |
| 373 | : multimap(first, last, Compare(), a) {} // C++14 | 371 | : multimap(first, last, Compare(), a) {} |
| 374 | template<container-compatible-range<value_type> R> | 372 | template<container-compatible-range<value_type> R> |
| 375 | multimap(from_range_t, R&& rg, const Allocator& a)) | 373 | multimap(from_range_t, R&& rg, const Allocator& a)) |
| 376 | : multimap(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 | 374 | : multimap(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 |
| 377 | multimap(initializer_list<value_type> il, const allocator_type& a) | 375 | multimap(initializer_list<value_type> il, const allocator_type& a) |
| 378 | : multimap(il, Compare(), a) {} // C++14 | 376 | : multimap(il, Compare(), a) {} |
| 379 | ~multimap(); | 377 | ~multimap(); |
| 380 | 378 | ||
| 381 | multimap& operator=(const multimap& m); | 379 | multimap& operator=(const multimap& m); |
| ... | @@ -411,7 +409,7 @@ public: | ... | @@ -411,7 +409,7 @@ public: |
| 411 | template <class... Args> | 409 | template <class... Args> |
| 412 | iterator emplace(Args&&... args); | 410 | iterator emplace(Args&&... args); |
| 413 | template <class... Args> | 411 | template <class... Args> |
| 414 | iterator emplace_hint(const_iterator position, Args&&... args); | 412 | iterator emplace_hint(const_iterator position, Args&&... args); |
| 415 | iterator insert(const value_type& v); | 413 | iterator insert(const value_type& v); |
| 416 | iterator insert( value_type&& v); // C++17 | 414 | iterator insert( value_type&& v); // C++17 |
| 417 | template <class P> | 415 | template <class P> |
| ... | @@ -641,28 +639,37 @@ class __map_value_compare { | ... | @@ -641,28 +639,37 @@ class __map_value_compare { |
| 641 | _LIBCPP_COMPRESSED_ELEMENT(_Compare, __comp_); | 639 | _LIBCPP_COMPRESSED_ELEMENT(_Compare, __comp_); |
| 642 | 640 | ||
| 643 | public: | 641 | public: |
| 644 | _LIBCPP_HIDE_FROM_ABI __map_value_compare() _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value) | 642 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_value_compare() |
| 643 | _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value) | ||
| 645 | : __comp_() {} | 644 | : __comp_() {} |
| 646 | _LIBCPP_HIDE_FROM_ABI __map_value_compare(_Compare __c) _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value) | 645 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_value_compare(_Compare __c) |
| 646 | _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value) | ||
| 647 | : __comp_(__c) {} | 647 | : __comp_(__c) {} |
| 648 | _LIBCPP_HIDE_FROM_ABI const _Compare& key_comp() const _NOEXCEPT { return __comp_; } | 648 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const _Compare& key_comp() const _NOEXCEPT { return __comp_; } |
| 649 | 649 | ||
| 650 | _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _CP& __y) const { return __comp_(__x.first, __y.first); } | 650 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _CP& __x, const _CP& __y) const { |
| 651 | _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _Key& __y) const { return __comp_(__x.first, __y); } | 651 | return __comp_(__x.first, __y.first); |
| 652 | _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _CP& __y) const { return __comp_(__x, __y.first); } | 652 | } |
| 653 | _LIBCPP_HIDE_FROM_ABI void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Compare>) { | 653 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _CP& __x, const _Key& __y) const { |
| 654 | return __comp_(__x.first, __y); | ||
| 655 | } | ||
| 656 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _Key& __x, const _CP& __y) const { | ||
| 657 | return __comp_(__x, __y.first); | ||
| 658 | } | ||
| 659 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(__map_value_compare& __y) | ||
| 660 | _NOEXCEPT_(__is_nothrow_swappable_v<_Compare>) { | ||
| 654 | using std::swap; | 661 | using std::swap; |
| 655 | swap(__comp_, __y.__comp_); | 662 | swap(__comp_, __y.__comp_); |
| 656 | } | 663 | } |
| 657 | 664 | ||
| 658 | # if _LIBCPP_STD_VER >= 14 | 665 | # if _LIBCPP_STD_VER >= 14 |
| 659 | template <typename _K2> | 666 | template <typename _K2> |
| 660 | _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _CP& __y) const { | 667 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _K2& __x, const _CP& __y) const { |
| 661 | return __comp_(__x, __y.first); | 668 | return __comp_(__x, __y.first); |
| 662 | } | 669 | } |
| 663 | 670 | ||
| 664 | template <typename _K2> | 671 | template <typename _K2> |
| 665 | _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _K2& __y) const { | 672 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _CP& __x, const _K2& __y) const { |
| 666 | return __comp_(__x.first, __y); | 673 | return __comp_(__x.first, __y); |
| 667 | } | 674 | } |
| 668 | # endif | 675 | # endif |
| ... | @@ -678,11 +685,11 @@ template <class _MapValueT, class _Key, class _Compare> | ... | @@ -678,11 +685,11 @@ template <class _MapValueT, class _Key, class _Compare> |
| 678 | struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _MapValueT, _MapValueT> { | 685 | struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _MapValueT, _MapValueT> { |
| 679 | __lazy_synth_three_way_comparator<_Compare, _Key, _Key> __comp_; | 686 | __lazy_synth_three_way_comparator<_Compare, _Key, _Key> __comp_; |
| 680 | 687 | ||
| 681 | __lazy_synth_three_way_comparator( | 688 | _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_synth_three_way_comparator( |
| 682 | _LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp) | 689 | _LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp) |
| 683 | : __comp_(__comp.key_comp()) {} | 690 | : __comp_(__comp.key_comp()) {} |
| 684 | 691 | ||
| 685 | _LIBCPP_HIDE_FROM_ABI auto | 692 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 auto |
| 686 | operator()(_LIBCPP_LIFETIMEBOUND const _MapValueT& __lhs, _LIBCPP_LIFETIMEBOUND const _MapValueT& __rhs) const { | 693 | operator()(_LIBCPP_LIFETIMEBOUND const _MapValueT& __lhs, _LIBCPP_LIFETIMEBOUND const _MapValueT& __rhs) const { |
| 687 | return __comp_(__lhs.first, __rhs.first); | 694 | return __comp_(__lhs.first, __rhs.first); |
| 688 | } | 695 | } |
| ... | @@ -692,11 +699,11 @@ template <class _MapValueT, class _Key, class _TransparentKey, class _Compare> | ... | @@ -692,11 +699,11 @@ template <class _MapValueT, class _Key, class _TransparentKey, class _Compare> |
| 692 | struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _TransparentKey, _MapValueT> { | 699 | struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _TransparentKey, _MapValueT> { |
| 693 | __lazy_synth_three_way_comparator<_Compare, _TransparentKey, _Key> __comp_; | 700 | __lazy_synth_three_way_comparator<_Compare, _TransparentKey, _Key> __comp_; |
| 694 | 701 | ||
| 695 | __lazy_synth_three_way_comparator( | 702 | _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_synth_three_way_comparator( |
| 696 | _LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp) | 703 | _LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp) |
| 697 | : __comp_(__comp.key_comp()) {} | 704 | : __comp_(__comp.key_comp()) {} |
| 698 | 705 | ||
| 699 | _LIBCPP_HIDE_FROM_ABI auto | 706 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 auto |
| 700 | operator()(_LIBCPP_LIFETIMEBOUND const _TransparentKey& __lhs, _LIBCPP_LIFETIMEBOUND const _MapValueT& __rhs) const { | 707 | operator()(_LIBCPP_LIFETIMEBOUND const _TransparentKey& __lhs, _LIBCPP_LIFETIMEBOUND const _MapValueT& __rhs) const { |
| 701 | return __comp_(__lhs, __rhs.first); | 708 | return __comp_(__lhs, __rhs.first); |
| 702 | } | 709 | } |
| ... | @@ -718,7 +725,7 @@ struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _ | ... | @@ -718,7 +725,7 @@ struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _ |
| 718 | # endif // _LIBCPP_STD_VER >= 14 | 725 | # endif // _LIBCPP_STD_VER >= 14 |
| 719 | 726 | ||
| 720 | template <class _Key, class _CP, class _Compare> | 727 | template <class _Key, class _CP, class _Compare> |
| 721 | inline _LIBCPP_HIDE_FROM_ABI void | 728 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 722 | swap(__map_value_compare<_Key, _CP, _Compare>& __x, __map_value_compare<_Key, _CP, _Compare>& __y) | 729 | swap(__map_value_compare<_Key, _CP, _Compare>& __x, __map_value_compare<_Key, _CP, _Compare>& __y) |
| 723 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { | 730 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { |
| 724 | __x.swap(__y); | 731 | __x.swap(__y); |
| ... | @@ -779,37 +786,41 @@ public: | ... | @@ -779,37 +786,41 @@ public: |
| 779 | using reference = value_type&; | 786 | using reference = value_type&; |
| 780 | using pointer = typename _TreeIterator::pointer; | 787 | using pointer = typename _TreeIterator::pointer; |
| 781 | 788 | ||
| 782 | _LIBCPP_HIDE_FROM_ABI __map_iterator() _NOEXCEPT {} | 789 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator() _NOEXCEPT {} |
| 783 | 790 | ||
| 784 | _LIBCPP_HIDE_FROM_ABI __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {} | 791 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {} |
| 785 | 792 | ||
| 786 | _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *__i_; } | 793 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return *__i_; } |
| 787 | _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(*__i_); } | 794 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const { |
| 795 | return pointer_traits<pointer>::pointer_to(*__i_); | ||
| 796 | } | ||
| 788 | 797 | ||
| 789 | _LIBCPP_HIDE_FROM_ABI __map_iterator& operator++() { | 798 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator& operator++() { |
| 790 | ++__i_; | 799 | ++__i_; |
| 791 | return *this; | 800 | return *this; |
| 792 | } | 801 | } |
| 793 | _LIBCPP_HIDE_FROM_ABI __map_iterator operator++(int) { | 802 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator operator++(int) { |
| 794 | __map_iterator __t(*this); | 803 | __map_iterator __t(*this); |
| 795 | ++(*this); | 804 | ++(*this); |
| 796 | return __t; | 805 | return __t; |
| 797 | } | 806 | } |
| 798 | 807 | ||
| 799 | _LIBCPP_HIDE_FROM_ABI __map_iterator& operator--() { | 808 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator& operator--() { |
| 800 | --__i_; | 809 | --__i_; |
| 801 | return *this; | 810 | return *this; |
| 802 | } | 811 | } |
| 803 | _LIBCPP_HIDE_FROM_ABI __map_iterator operator--(int) { | 812 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator operator--(int) { |
| 804 | __map_iterator __t(*this); | 813 | __map_iterator __t(*this); |
| 805 | --(*this); | 814 | --(*this); |
| 806 | return __t; | 815 | return __t; |
| 807 | } | 816 | } |
| 808 | 817 | ||
| 809 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __map_iterator& __x, const __map_iterator& __y) { | 818 | friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 819 | operator==(const __map_iterator& __x, const __map_iterator& __y) { | ||
| 810 | return __x.__i_ == __y.__i_; | 820 | return __x.__i_ == __y.__i_; |
| 811 | } | 821 | } |
| 812 | friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __map_iterator& __x, const __map_iterator& __y) { | 822 | friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 823 | operator!=(const __map_iterator& __x, const __map_iterator& __y) { | ||
| 813 | return __x.__i_ != __y.__i_; | 824 | return __x.__i_ != __y.__i_; |
| 814 | } | 825 | } |
| 815 | 826 | ||
| ... | @@ -834,7 +845,8 @@ struct __specialized_algorithm<_Alg, __iterator_pair<__map_iterator<_TreeIterato | ... | @@ -834,7 +845,8 @@ struct __specialized_algorithm<_Alg, __iterator_pair<__map_iterator<_TreeIterato |
| 834 | using __iterator _LIBCPP_NODEBUG = __map_iterator<_TreeIterator>; | 845 | using __iterator _LIBCPP_NODEBUG = __map_iterator<_TreeIterator>; |
| 835 | 846 | ||
| 836 | template <class... _Args> | 847 | template <class... _Args> |
| 837 | _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Args&&... __args) { | 848 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void |
| 849 | operator()(__iterator __first, __iterator __last, _Args&&... __args) { | ||
| 838 | __base()(__first.__i_, __last.__i_, std::forward<_Args>(__args)...); | 850 | __base()(__first.__i_, __last.__i_, std::forward<_Args>(__args)...); |
| 839 | } | 851 | } |
| 840 | }; | 852 | }; |
| ... | @@ -851,39 +863,43 @@ public: | ... | @@ -851,39 +863,43 @@ public: |
| 851 | using reference = const value_type&; | 863 | using reference = const value_type&; |
| 852 | using pointer = typename _TreeIterator::pointer; | 864 | using pointer = typename _TreeIterator::pointer; |
| 853 | 865 | ||
| 854 | _LIBCPP_HIDE_FROM_ABI __map_const_iterator() _NOEXCEPT {} | 866 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator() _NOEXCEPT {} |
| 855 | 867 | ||
| 856 | _LIBCPP_HIDE_FROM_ABI __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {} | 868 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {} |
| 857 | _LIBCPP_HIDE_FROM_ABI | 869 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 858 | __map_const_iterator(__map_iterator< typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT : __i_(__i.__i_) {} | 870 | __map_const_iterator(__map_iterator< typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT : __i_(__i.__i_) {} |
| 859 | 871 | ||
| 860 | _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *__i_; } | 872 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return *__i_; } |
| 861 | _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(*__i_); } | 873 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const { |
| 874 | return pointer_traits<pointer>::pointer_to(*__i_); | ||
| 875 | } | ||
| 862 | 876 | ||
| 863 | _LIBCPP_HIDE_FROM_ABI __map_const_iterator& operator++() { | 877 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator& operator++() { |
| 864 | ++__i_; | 878 | ++__i_; |
| 865 | return *this; | 879 | return *this; |
| 866 | } | 880 | } |
| 867 | _LIBCPP_HIDE_FROM_ABI __map_const_iterator operator++(int) { | 881 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator operator++(int) { |
| 868 | __map_const_iterator __t(*this); | 882 | __map_const_iterator __t(*this); |
| 869 | ++(*this); | 883 | ++(*this); |
| 870 | return __t; | 884 | return __t; |
| 871 | } | 885 | } |
| 872 | 886 | ||
| 873 | _LIBCPP_HIDE_FROM_ABI __map_const_iterator& operator--() { | 887 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator& operator--() { |
| 874 | --__i_; | 888 | --__i_; |
| 875 | return *this; | 889 | return *this; |
| 876 | } | 890 | } |
| 877 | _LIBCPP_HIDE_FROM_ABI __map_const_iterator operator--(int) { | 891 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator operator--(int) { |
| 878 | __map_const_iterator __t(*this); | 892 | __map_const_iterator __t(*this); |
| 879 | --(*this); | 893 | --(*this); |
| 880 | return __t; | 894 | return __t; |
| 881 | } | 895 | } |
| 882 | 896 | ||
| 883 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y) { | 897 | friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 898 | operator==(const __map_const_iterator& __x, const __map_const_iterator& __y) { | ||
| 884 | return __x.__i_ == __y.__i_; | 899 | return __x.__i_ == __y.__i_; |
| 885 | } | 900 | } |
| 886 | friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y) { | 901 | friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 902 | operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y) { | ||
| 887 | return __x.__i_ != __y.__i_; | 903 | return __x.__i_ != __y.__i_; |
| 888 | } | 904 | } |
| 889 | 905 | ||
| ... | @@ -910,7 +926,8 @@ struct __specialized_algorithm< | ... | @@ -910,7 +926,8 @@ struct __specialized_algorithm< |
| 910 | using __iterator _LIBCPP_NODEBUG = __map_const_iterator<_TreeIterator>; | 926 | using __iterator _LIBCPP_NODEBUG = __map_const_iterator<_TreeIterator>; |
| 911 | 927 | ||
| 912 | template <class... _Args> | 928 | template <class... _Args> |
| 913 | _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Args&&... __args) { | 929 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void |
| 930 | operator()(__iterator __first, __iterator __last, _Args&&... __args) { | ||
| 914 | __base()(__first.__i_, __last.__i_, std::forward<_Args>(__args)...); | 931 | __base()(__first.__i_, __last.__i_, std::forward<_Args>(__args)...); |
| 915 | } | 932 | } |
| 916 | }; | 933 | }; |
| ... | @@ -940,10 +957,11 @@ public: | ... | @@ -940,10 +957,11 @@ public: |
| 940 | protected: | 957 | protected: |
| 941 | key_compare comp; | 958 | key_compare comp; |
| 942 | 959 | ||
| 943 | _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {} | 960 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare(key_compare __c) : comp(__c) {} |
| 944 | 961 | ||
| 945 | public: | 962 | public: |
| 946 | _LIBCPP_HIDE_FROM_ABI bool operator()(const value_type& __x, const value_type& __y) const { | 963 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 964 | operator()(const value_type& __x, const value_type& __y) const { | ||
| 947 | return comp(__x.first, __y.first); | 965 | return comp(__x.first, __y.first); |
| 948 | } | 966 | } |
| 949 | }; | 967 | }; |
| ... | @@ -979,26 +997,27 @@ public: | ... | @@ -979,26 +997,27 @@ public: |
| 979 | template <class _Key2, class _Value2, class _Comp2, class _Alloc2> | 997 | template <class _Key2, class _Value2, class _Comp2, class _Alloc2> |
| 980 | friend class multimap; | 998 | friend class multimap; |
| 981 | 999 | ||
| 982 | _LIBCPP_HIDE_FROM_ABI map() _NOEXCEPT_( | 1000 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map() _NOEXCEPT_( |
| 983 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&& | 1001 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&& |
| 984 | is_nothrow_copy_constructible<key_compare>::value) | 1002 | is_nothrow_copy_constructible<key_compare>::value) |
| 985 | : __tree_(__vc(key_compare())) {} | 1003 | : __tree_(__vc(key_compare())) {} |
| 986 | 1004 | ||
| 987 | _LIBCPP_HIDE_FROM_ABI explicit map(const key_compare& __comp) _NOEXCEPT_( | 1005 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit map(const key_compare& __comp) _NOEXCEPT_( |
| 988 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value) | 1006 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value) |
| 989 | : __tree_(__vc(__comp)) {} | 1007 | : __tree_(__vc(__comp)) {} |
| 990 | 1008 | ||
| 991 | _LIBCPP_HIDE_FROM_ABI explicit map(const key_compare& __comp, const allocator_type& __a) | 1009 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit map(const key_compare& __comp, const allocator_type& __a) |
| 992 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {} | 1010 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {} |
| 993 | 1011 | ||
| 994 | template <class _InputIterator> | 1012 | template <class _InputIterator> |
| 995 | _LIBCPP_HIDE_FROM_ABI map(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare()) | 1013 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1014 | map(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare()) | ||
| 996 | : __tree_(__vc(__comp)) { | 1015 | : __tree_(__vc(__comp)) { |
| 997 | insert(__f, __l); | 1016 | insert(__f, __l); |
| 998 | } | 1017 | } |
| 999 | 1018 | ||
| 1000 | template <class _InputIterator> | 1019 | template <class _InputIterator> |
| 1001 | _LIBCPP_HIDE_FROM_ABI | 1020 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1002 | map(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a) | 1021 | map(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a) |
| 1003 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { | 1022 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { |
| 1004 | insert(__f, __l); | 1023 | insert(__f, __l); |
| ... | @@ -1006,7 +1025,7 @@ public: | ... | @@ -1006,7 +1025,7 @@ public: |
| 1006 | 1025 | ||
| 1007 | # if _LIBCPP_STD_VER >= 23 | 1026 | # if _LIBCPP_STD_VER >= 23 |
| 1008 | template <_ContainerCompatibleRange<value_type> _Range> | 1027 | template <_ContainerCompatibleRange<value_type> _Range> |
| 1009 | _LIBCPP_HIDE_FROM_ABI | 1028 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1010 | map(from_range_t, | 1029 | map(from_range_t, |
| 1011 | _Range&& __range, | 1030 | _Range&& __range, |
| 1012 | const key_compare& __comp = key_compare(), | 1031 | const key_compare& __comp = key_compare(), |
| ... | @@ -1016,46 +1035,46 @@ public: | ... | @@ -1016,46 +1035,46 @@ public: |
| 1016 | } | 1035 | } |
| 1017 | # endif | 1036 | # endif |
| 1018 | 1037 | ||
| 1019 | # if _LIBCPP_STD_VER >= 14 | ||
| 1020 | template <class _InputIterator> | 1038 | template <class _InputIterator> |
| 1021 | _LIBCPP_HIDE_FROM_ABI map(_InputIterator __f, _InputIterator __l, const allocator_type& __a) | 1039 | _LIBCPP_HIDE_FROM_ABI |
| 1040 | _LIBCPP_CONSTEXPR_SINCE_CXX26 map(_InputIterator __f, _InputIterator __l, const allocator_type& __a) | ||
| 1022 | : map(__f, __l, key_compare(), __a) {} | 1041 | : map(__f, __l, key_compare(), __a) {} |
| 1023 | # endif | ||
| 1024 | 1042 | ||
| 1025 | # if _LIBCPP_STD_VER >= 23 | 1043 | # if _LIBCPP_STD_VER >= 23 |
| 1026 | template <_ContainerCompatibleRange<value_type> _Range> | 1044 | template <_ContainerCompatibleRange<value_type> _Range> |
| 1027 | _LIBCPP_HIDE_FROM_ABI map(from_range_t, _Range&& __range, const allocator_type& __a) | 1045 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(from_range_t, _Range&& __range, const allocator_type& __a) |
| 1028 | : map(from_range, std::forward<_Range>(__range), key_compare(), __a) {} | 1046 | : map(from_range, std::forward<_Range>(__range), key_compare(), __a) {} |
| 1029 | # endif | 1047 | # endif |
| 1030 | 1048 | ||
| 1031 | _LIBCPP_HIDE_FROM_ABI map(const map& __m) = default; | 1049 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(const map& __m) = default; |
| 1032 | 1050 | ||
| 1033 | _LIBCPP_HIDE_FROM_ABI map& operator=(const map& __m) = default; | 1051 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map& operator=(const map& __m) = default; |
| 1034 | 1052 | ||
| 1035 | # ifndef _LIBCPP_CXX03_LANG | 1053 | # ifndef _LIBCPP_CXX03_LANG |
| 1036 | 1054 | ||
| 1037 | _LIBCPP_HIDE_FROM_ABI map(map&& __m) = default; | 1055 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(map&& __m) = default; |
| 1038 | 1056 | ||
| 1039 | _LIBCPP_HIDE_FROM_ABI map(map&& __m, const allocator_type& __a) : __tree_(std::move(__m.__tree_), __a) {} | 1057 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(map&& __m, const allocator_type& __a) |
| 1058 | : __tree_(std::move(__m.__tree_), __a) {} | ||
| 1040 | 1059 | ||
| 1041 | _LIBCPP_HIDE_FROM_ABI map& operator=(map&& __m) = default; | 1060 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map& operator=(map&& __m) = default; |
| 1042 | 1061 | ||
| 1043 | _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const key_compare& __comp = key_compare()) | 1062 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1063 | map(initializer_list<value_type> __il, const key_compare& __comp = key_compare()) | ||
| 1044 | : __tree_(__vc(__comp)) { | 1064 | : __tree_(__vc(__comp)) { |
| 1045 | insert(__il.begin(), __il.end()); | 1065 | insert(__il.begin(), __il.end()); |
| 1046 | } | 1066 | } |
| 1047 | 1067 | ||
| 1048 | _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a) | 1068 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1069 | map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a) | ||
| 1049 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { | 1070 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { |
| 1050 | insert(__il.begin(), __il.end()); | 1071 | insert(__il.begin(), __il.end()); |
| 1051 | } | 1072 | } |
| 1052 | 1073 | ||
| 1053 | # if _LIBCPP_STD_VER >= 14 | 1074 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(initializer_list<value_type> __il, const allocator_type& __a) |
| 1054 | _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const allocator_type& __a) | ||
| 1055 | : map(__il, key_compare(), __a) {} | 1075 | : map(__il, key_compare(), __a) {} |
| 1056 | # endif | ||
| 1057 | 1076 | ||
| 1058 | _LIBCPP_HIDE_FROM_ABI map& operator=(initializer_list<value_type> __il) { | 1077 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map& operator=(initializer_list<value_type> __il) { |
| 1059 | clear(); | 1078 | clear(); |
| 1060 | insert(__il.begin(), __il.end()); | 1079 | insert(__il.begin(), __il.end()); |
| 1061 | return *this; | 1080 | return *this; |
| ... | @@ -1063,118 +1082,157 @@ public: | ... | @@ -1063,118 +1082,157 @@ public: |
| 1063 | 1082 | ||
| 1064 | # endif // _LIBCPP_CXX03_LANG | 1083 | # endif // _LIBCPP_CXX03_LANG |
| 1065 | 1084 | ||
| 1066 | _LIBCPP_HIDE_FROM_ABI explicit map(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {} | 1085 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit map(const allocator_type& __a) |
| 1086 | : __tree_(typename __base::allocator_type(__a)) {} | ||
| 1067 | 1087 | ||
| 1068 | _LIBCPP_HIDE_FROM_ABI map(const map& __m, const allocator_type& __alloc) : __tree_(__m.__tree_, __alloc) {} | 1088 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(const map& __m, const allocator_type& __alloc) |
| 1089 | : __tree_(__m.__tree_, __alloc) {} | ||
| 1069 | 1090 | ||
| 1070 | _LIBCPP_HIDE_FROM_ABI ~map() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); } | 1091 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~map() { |
| 1092 | static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); | ||
| 1093 | } | ||
| 1071 | 1094 | ||
| 1072 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); } | 1095 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT { |
| 1073 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); } | 1096 | return __tree_.begin(); |
| 1074 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); } | 1097 | } |
| 1075 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); } | 1098 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT { |
| 1099 | return __tree_.begin(); | ||
| 1100 | } | ||
| 1101 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT { | ||
| 1102 | return __tree_.end(); | ||
| 1103 | } | ||
| 1104 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT { | ||
| 1105 | return __tree_.end(); | ||
| 1106 | } | ||
| 1076 | 1107 | ||
| 1077 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); } | 1108 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT { |
| 1078 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { | 1109 | return reverse_iterator(end()); |
| 1110 | } | ||
| 1111 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator | ||
| 1112 | rbegin() const _NOEXCEPT { | ||
| 1079 | return const_reverse_iterator(end()); | 1113 | return const_reverse_iterator(end()); |
| 1080 | } | 1114 | } |
| 1081 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); } | 1115 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT { |
| 1082 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { | 1116 | return reverse_iterator(begin()); |
| 1117 | } | ||
| 1118 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT { | ||
| 1083 | return const_reverse_iterator(begin()); | 1119 | return const_reverse_iterator(begin()); |
| 1084 | } | 1120 | } |
| 1085 | 1121 | ||
| 1086 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); } | 1122 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT { |
| 1087 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); } | 1123 | return begin(); |
| 1088 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); } | 1124 | } |
| 1089 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); } | 1125 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT { |
| 1126 | return end(); | ||
| 1127 | } | ||
| 1128 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator | ||
| 1129 | crbegin() const _NOEXCEPT { | ||
| 1130 | return rbegin(); | ||
| 1131 | } | ||
| 1132 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT { | ||
| 1133 | return rend(); | ||
| 1134 | } | ||
| 1090 | 1135 | ||
| 1091 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } | 1136 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT { |
| 1092 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); } | 1137 | return __tree_.size() == 0; |
| 1093 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); } | 1138 | } |
| 1139 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT { | ||
| 1140 | return __tree_.size(); | ||
| 1141 | } | ||
| 1142 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT { | ||
| 1143 | return __tree_.max_size(); | ||
| 1144 | } | ||
| 1094 | 1145 | ||
| 1095 | _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k); | 1146 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](const key_type& __k); |
| 1096 | # ifndef _LIBCPP_CXX03_LANG | 1147 | # ifndef _LIBCPP_CXX03_LANG |
| 1097 | _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k); | 1148 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](key_type&& __k); |
| 1098 | # endif | 1149 | # endif |
| 1099 | 1150 | ||
| 1100 | template <class _Arg, | 1151 | template <class _Arg, |
| 1101 | __enable_if_t<__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t<_Arg> >, int> = 0> | 1152 | __enable_if_t<__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t<_Arg> >, int> = 0> |
| 1102 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mapped_type& at(_Arg&& __arg) { | 1153 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(_Arg&& __arg) { |
| 1103 | auto [_, __child] = __tree_.__find_equal(__arg); | 1154 | auto [__dummy, __child] = __tree_.__find_equal(__arg); |
| 1104 | if (__child == nullptr) | 1155 | if (__child == nullptr) |
| 1105 | std::__throw_out_of_range("map::at: key not found"); | 1156 | std::__throw_out_of_range("map::at: key not found"); |
| 1106 | return static_cast<__node_pointer>(__child)->__get_value().second; | 1157 | return std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second; |
| 1107 | } | 1158 | } |
| 1108 | 1159 | ||
| 1109 | template <class _Arg, | 1160 | template <class _Arg, |
| 1110 | __enable_if_t<__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t<_Arg> >, int> = 0> | 1161 | __enable_if_t<__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t<_Arg> >, int> = 0> |
| 1111 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const mapped_type& at(_Arg&& __arg) const { | 1162 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at(_Arg&& __arg) const { |
| 1112 | auto [_, __child] = __tree_.__find_equal(__arg); | 1163 | auto [__dummy, __child] = __tree_.__find_equal(__arg); |
| 1113 | if (__child == nullptr) | 1164 | if (__child == nullptr) |
| 1114 | std::__throw_out_of_range("map::at: key not found"); | 1165 | std::__throw_out_of_range("map::at: key not found"); |
| 1115 | return static_cast<__node_pointer>(__child)->__get_value().second; | 1166 | return std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second; |
| 1116 | } | 1167 | } |
| 1117 | 1168 | ||
| 1118 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k); | 1169 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(const key_type& __k); |
| 1119 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const; | 1170 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& |
| 1171 | at(const key_type& __k) const; | ||
| 1120 | 1172 | ||
| 1121 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { | 1173 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT { |
| 1122 | return allocator_type(__tree_.__alloc()); | 1174 | return allocator_type(__tree_.__alloc()); |
| 1123 | } | 1175 | } |
| 1124 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); } | 1176 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { |
| 1125 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { | 1177 | return __tree_.value_comp().key_comp(); |
| 1178 | } | ||
| 1179 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const { | ||
| 1126 | return value_compare(__tree_.value_comp().key_comp()); | 1180 | return value_compare(__tree_.value_comp().key_comp()); |
| 1127 | } | 1181 | } |
| 1128 | 1182 | ||
| 1129 | # ifndef _LIBCPP_CXX03_LANG | 1183 | # ifndef _LIBCPP_CXX03_LANG |
| 1130 | template <class... _Args> | 1184 | template <class... _Args> |
| 1131 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) { | 1185 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> emplace(_Args&&... __args) { |
| 1132 | return __tree_.__emplace_unique(std::forward<_Args>(__args)...); | 1186 | return __tree_.__emplace_unique(std::forward<_Args>(__args)...); |
| 1133 | } | 1187 | } |
| 1134 | 1188 | ||
| 1135 | template <class... _Args> | 1189 | template <class... _Args> |
| 1136 | _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) { | 1190 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) { |
| 1137 | return __tree_.__emplace_hint_unique(__p.__i_, std::forward<_Args>(__args)...).first; | 1191 | return __tree_.__emplace_hint_unique(__p.__i_, std::forward<_Args>(__args)...).first; |
| 1138 | } | 1192 | } |
| 1139 | 1193 | ||
| 1140 | template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> | 1194 | template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> |
| 1141 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(_Pp&& __p) { | 1195 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(_Pp&& __p) { |
| 1142 | return __tree_.__emplace_unique(std::forward<_Pp>(__p)); | 1196 | return __tree_.__emplace_unique(std::forward<_Pp>(__p)); |
| 1143 | } | 1197 | } |
| 1144 | 1198 | ||
| 1145 | template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> | 1199 | template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> |
| 1146 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) { | 1200 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __pos, _Pp&& __p) { |
| 1147 | return __tree_.__emplace_hint_unique(__pos.__i_, std::forward<_Pp>(__p)).first; | 1201 | return __tree_.__emplace_hint_unique(__pos.__i_, std::forward<_Pp>(__p)).first; |
| 1148 | } | 1202 | } |
| 1149 | 1203 | ||
| 1150 | # endif // _LIBCPP_CXX03_LANG | 1204 | # endif // _LIBCPP_CXX03_LANG |
| 1151 | 1205 | ||
| 1152 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__emplace_unique(__v); } | 1206 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(const value_type& __v) { |
| 1207 | return __tree_.__emplace_unique(__v); | ||
| 1208 | } | ||
| 1153 | 1209 | ||
| 1154 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) { | 1210 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) { |
| 1155 | return __tree_.__emplace_hint_unique(__p.__i_, __v).first; | 1211 | return __tree_.__emplace_hint_unique(__p.__i_, __v).first; |
| 1156 | } | 1212 | } |
| 1157 | 1213 | ||
| 1158 | # ifndef _LIBCPP_CXX03_LANG | 1214 | # ifndef _LIBCPP_CXX03_LANG |
| 1159 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) { | 1215 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(value_type&& __v) { |
| 1160 | return __tree_.__emplace_unique(std::move(__v)); | 1216 | return __tree_.__emplace_unique(std::move(__v)); |
| 1161 | } | 1217 | } |
| 1162 | 1218 | ||
| 1163 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) { | 1219 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) { |
| 1164 | return __tree_.__emplace_hint_unique(__p.__i_, std::move(__v)).first; | 1220 | return __tree_.__emplace_hint_unique(__p.__i_, std::move(__v)).first; |
| 1165 | } | 1221 | } |
| 1166 | 1222 | ||
| 1167 | _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); } | 1223 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) { |
| 1224 | insert(__il.begin(), __il.end()); | ||
| 1225 | } | ||
| 1168 | # endif | 1226 | # endif |
| 1169 | 1227 | ||
| 1170 | template <class _InputIterator> | 1228 | template <class _InputIterator> |
| 1171 | _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) { | 1229 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) { |
| 1172 | __tree_.__insert_range_unique(__first, __last); | 1230 | __tree_.__insert_range_unique(__first, __last); |
| 1173 | } | 1231 | } |
| 1174 | 1232 | ||
| 1175 | # if _LIBCPP_STD_VER >= 23 | 1233 | # if _LIBCPP_STD_VER >= 23 |
| 1176 | template <_ContainerCompatibleRange<value_type> _Range> | 1234 | template <_ContainerCompatibleRange<value_type> _Range> |
| 1177 | _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) { | 1235 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) { |
| 1178 | __tree_.__insert_range_unique(ranges::begin(__range), ranges::end(__range)); | 1236 | __tree_.__insert_range_unique(ranges::begin(__range), ranges::end(__range)); |
| 1179 | } | 1237 | } |
| 1180 | # endif | 1238 | # endif |
| ... | @@ -1182,13 +1240,15 @@ public: | ... | @@ -1182,13 +1240,15 @@ public: |
| 1182 | # if _LIBCPP_STD_VER >= 17 | 1240 | # if _LIBCPP_STD_VER >= 17 |
| 1183 | 1241 | ||
| 1184 | template <class... _Args> | 1242 | template <class... _Args> |
| 1185 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) { | 1243 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> |
| 1244 | try_emplace(const key_type& __k, _Args&&... __args) { | ||
| 1186 | return __tree_.__emplace_unique( | 1245 | return __tree_.__emplace_unique( |
| 1187 | std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple(std::forward<_Args>(__args)...)); | 1246 | std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple(std::forward<_Args>(__args)...)); |
| 1188 | } | 1247 | } |
| 1189 | 1248 | ||
| 1190 | template <class... _Args> | 1249 | template <class... _Args> |
| 1191 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) { | 1250 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> |
| 1251 | try_emplace(key_type&& __k, _Args&&... __args) { | ||
| 1192 | return __tree_.__emplace_unique( | 1252 | return __tree_.__emplace_unique( |
| 1193 | std::piecewise_construct, | 1253 | std::piecewise_construct, |
| 1194 | std::forward_as_tuple(std::move(__k)), | 1254 | std::forward_as_tuple(std::move(__k)), |
| ... | @@ -1196,7 +1256,8 @@ public: | ... | @@ -1196,7 +1256,8 @@ public: |
| 1196 | } | 1256 | } |
| 1197 | 1257 | ||
| 1198 | template <class... _Args> | 1258 | template <class... _Args> |
| 1199 | _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) { | 1259 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator |
| 1260 | try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) { | ||
| 1200 | return __tree_ | 1261 | return __tree_ |
| 1201 | .__emplace_hint_unique( | 1262 | .__emplace_hint_unique( |
| 1202 | __h.__i_, | 1263 | __h.__i_, |
| ... | @@ -1207,7 +1268,8 @@ public: | ... | @@ -1207,7 +1268,8 @@ public: |
| 1207 | } | 1268 | } |
| 1208 | 1269 | ||
| 1209 | template <class... _Args> | 1270 | template <class... _Args> |
| 1210 | _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) { | 1271 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator |
| 1272 | try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) { | ||
| 1211 | return __tree_ | 1273 | return __tree_ |
| 1212 | .__emplace_hint_unique( | 1274 | .__emplace_hint_unique( |
| 1213 | __h.__i_, | 1275 | __h.__i_, |
| ... | @@ -1218,7 +1280,8 @@ public: | ... | @@ -1218,7 +1280,8 @@ public: |
| 1218 | } | 1280 | } |
| 1219 | 1281 | ||
| 1220 | template <class _Vp> | 1282 | template <class _Vp> |
| 1221 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v) { | 1283 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> |
| 1284 | insert_or_assign(const key_type& __k, _Vp&& __v) { | ||
| 1222 | auto __result = __tree_.__emplace_unique(__k, std::forward<_Vp>(__v)); | 1285 | auto __result = __tree_.__emplace_unique(__k, std::forward<_Vp>(__v)); |
| 1223 | auto& [__iter, __inserted] = __result; | 1286 | auto& [__iter, __inserted] = __result; |
| 1224 | if (!__inserted) | 1287 | if (!__inserted) |
| ... | @@ -1227,7 +1290,7 @@ public: | ... | @@ -1227,7 +1290,7 @@ public: |
| 1227 | } | 1290 | } |
| 1228 | 1291 | ||
| 1229 | template <class _Vp> | 1292 | template <class _Vp> |
| 1230 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) { | 1293 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) { |
| 1231 | auto __result = __tree_.__emplace_unique(std::move(__k), std::forward<_Vp>(__v)); | 1294 | auto __result = __tree_.__emplace_unique(std::move(__k), std::forward<_Vp>(__v)); |
| 1232 | auto& [__iter, __inserted] = __result; | 1295 | auto& [__iter, __inserted] = __result; |
| 1233 | if (!__inserted) | 1296 | if (!__inserted) |
| ... | @@ -1236,7 +1299,8 @@ public: | ... | @@ -1236,7 +1299,8 @@ public: |
| 1236 | } | 1299 | } |
| 1237 | 1300 | ||
| 1238 | template <class _Vp> | 1301 | template <class _Vp> |
| 1239 | _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v) { | 1302 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator |
| 1303 | insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v) { | ||
| 1240 | auto [__r, __inserted] = __tree_.__emplace_hint_unique(__h.__i_, __k, std::forward<_Vp>(__v)); | 1304 | auto [__r, __inserted] = __tree_.__emplace_hint_unique(__h.__i_, __k, std::forward<_Vp>(__v)); |
| 1241 | 1305 | ||
| 1242 | if (!__inserted) | 1306 | if (!__inserted) |
| ... | @@ -1246,7 +1310,8 @@ public: | ... | @@ -1246,7 +1310,8 @@ public: |
| 1246 | } | 1310 | } |
| 1247 | 1311 | ||
| 1248 | template <class _Vp> | 1312 | template <class _Vp> |
| 1249 | _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v) { | 1313 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator |
| 1314 | insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v) { | ||
| 1250 | auto [__r, __inserted] = __tree_.__emplace_hint_unique(__h.__i_, std::move(__k), std::forward<_Vp>(__v)); | 1315 | auto [__r, __inserted] = __tree_.__emplace_hint_unique(__h.__i_, std::move(__k), std::forward<_Vp>(__v)); |
| 1251 | 1316 | ||
| 1252 | if (!__inserted) | 1317 | if (!__inserted) |
| ... | @@ -1257,101 +1322,118 @@ public: | ... | @@ -1257,101 +1322,118 @@ public: |
| 1257 | 1322 | ||
| 1258 | # endif // _LIBCPP_STD_VER >= 17 | 1323 | # endif // _LIBCPP_STD_VER >= 17 |
| 1259 | 1324 | ||
| 1260 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p.__i_); } | 1325 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) { |
| 1261 | _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __tree_.erase(__p.__i_); } | 1326 | return __tree_.erase(__p.__i_); |
| 1262 | _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); } | 1327 | } |
| 1263 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { | 1328 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(iterator __p) { return __tree_.erase(__p.__i_); } |
| 1329 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) { | ||
| 1330 | return __tree_.__erase_unique(__k); | ||
| 1331 | } | ||
| 1332 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) { | ||
| 1264 | return __tree_.erase(__f.__i_, __l.__i_); | 1333 | return __tree_.erase(__f.__i_, __l.__i_); |
| 1265 | } | 1334 | } |
| 1266 | _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); } | 1335 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); } |
| 1267 | 1336 | ||
| 1268 | # if _LIBCPP_STD_VER >= 17 | 1337 | # if _LIBCPP_STD_VER >= 17 |
| 1269 | _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) { | 1338 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 insert_return_type insert(node_type&& __nh) { |
| 1270 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), | 1339 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 1271 | "node_type with incompatible allocator passed to map::insert()"); | 1340 | "node_type with incompatible allocator passed to map::insert()"); |
| 1272 | return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh)); | 1341 | return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh)); |
| 1273 | } | 1342 | } |
| 1274 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) { | 1343 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) { |
| 1275 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), | 1344 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 1276 | "node_type with incompatible allocator passed to map::insert()"); | 1345 | "node_type with incompatible allocator passed to map::insert()"); |
| 1277 | return __tree_.template __node_handle_insert_unique<node_type>(__hint.__i_, std::move(__nh)); | 1346 | return __tree_.template __node_handle_insert_unique<node_type>(__hint.__i_, std::move(__nh)); |
| 1278 | } | 1347 | } |
| 1279 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) { | 1348 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) { |
| 1280 | return __tree_.template __node_handle_extract<node_type>(__key); | 1349 | return __tree_.template __node_handle_extract<node_type>(__key); |
| 1281 | } | 1350 | } |
| 1282 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) { | 1351 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) { |
| 1283 | return __tree_.template __node_handle_extract<node_type>(__it.__i_); | 1352 | return __tree_.template __node_handle_extract<node_type>(__it.__i_); |
| 1284 | } | 1353 | } |
| 1285 | template <class _Compare2> | 1354 | template <class _Compare2> |
| 1286 | _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) { | 1355 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1356 | merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) { | ||
| 1287 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 1357 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1288 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 1358 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1289 | __tree_.__node_handle_merge_unique(__source.__tree_); | 1359 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 1290 | } | 1360 | } |
| 1291 | template <class _Compare2> | 1361 | template <class _Compare2> |
| 1292 | _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) { | 1362 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1363 | merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) { | ||
| 1293 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 1364 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1294 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 1365 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1295 | __tree_.__node_handle_merge_unique(__source.__tree_); | 1366 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 1296 | } | 1367 | } |
| 1297 | template <class _Compare2> | 1368 | template <class _Compare2> |
| 1298 | _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) { | 1369 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1370 | merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) { | ||
| 1299 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 1371 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1300 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 1372 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1301 | __tree_.__node_handle_merge_unique(__source.__tree_); | 1373 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 1302 | } | 1374 | } |
| 1303 | template <class _Compare2> | 1375 | template <class _Compare2> |
| 1304 | _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) { | 1376 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1377 | merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) { | ||
| 1305 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 1378 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1306 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 1379 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1307 | __tree_.__node_handle_merge_unique(__source.__tree_); | 1380 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 1308 | } | 1381 | } |
| 1309 | # endif | 1382 | # endif |
| 1310 | 1383 | ||
| 1311 | _LIBCPP_HIDE_FROM_ABI void swap(map& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__m.__tree_); } | 1384 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(map& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { |
| 1385 | __tree_.swap(__m.__tree_); | ||
| 1386 | } | ||
| 1312 | 1387 | ||
| 1313 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); } | 1388 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) { |
| 1314 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); } | 1389 | return __tree_.find(__k); |
| 1390 | } | ||
| 1391 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const { | ||
| 1392 | return __tree_.find(__k); | ||
| 1393 | } | ||
| 1315 | # if _LIBCPP_STD_VER >= 14 | 1394 | # if _LIBCPP_STD_VER >= 14 |
| 1316 | template <typename _K2, | 1395 | template <typename _K2, |
| 1317 | enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>, | 1396 | class _Comp = _Compare, |
| 1318 | int> = 0> | 1397 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> |
| 1319 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { | 1398 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) { |
| 1320 | return __tree_.find(__k); | 1399 | return __tree_.find(__k); |
| 1321 | } | 1400 | } |
| 1322 | template <typename _K2, | 1401 | template <typename _K2, |
| 1323 | enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>, | 1402 | class _Comp = _Compare, |
| 1324 | int> = 0> | 1403 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> |
| 1325 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { | 1404 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const { |
| 1326 | return __tree_.find(__k); | 1405 | return __tree_.find(__k); |
| 1327 | } | 1406 | } |
| 1328 | # endif | 1407 | # endif |
| 1329 | 1408 | ||
| 1330 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { | 1409 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const { |
| 1331 | return __tree_.__count_unique(__k); | 1410 | return __tree_.__count_unique(__k); |
| 1332 | } | 1411 | } |
| 1333 | # if _LIBCPP_STD_VER >= 14 | 1412 | # if _LIBCPP_STD_VER >= 14 |
| 1334 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1413 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 1335 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { | 1414 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const { |
| 1336 | return __tree_.__count_multi(__k); | 1415 | return __tree_.__count_multi(__k); |
| 1337 | } | 1416 | } |
| 1338 | # endif | 1417 | # endif |
| 1339 | 1418 | ||
| 1340 | # if _LIBCPP_STD_VER >= 20 | 1419 | # if _LIBCPP_STD_VER >= 20 |
| 1341 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } | 1420 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const { |
| 1421 | return find(__k) != end(); | ||
| 1422 | } | ||
| 1342 | template <typename _K2, | 1423 | template <typename _K2, |
| 1343 | enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>, | 1424 | class _Comp = _Compare, |
| 1344 | int> = 0> | 1425 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> |
| 1345 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { | 1426 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const { |
| 1346 | return find(__k) != end(); | 1427 | return find(__k) != end(); |
| 1347 | } | 1428 | } |
| 1348 | # endif // _LIBCPP_STD_VER >= 20 | 1429 | # endif // _LIBCPP_STD_VER >= 20 |
| 1349 | 1430 | ||
| 1350 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { | 1431 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) { |
| 1351 | return __tree_.__lower_bound_unique(__k); | 1432 | return __tree_.__lower_bound_unique(__k); |
| 1352 | } | 1433 | } |
| 1353 | 1434 | ||
| 1354 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { | 1435 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 1436 | lower_bound(const key_type& __k) const { | ||
| 1355 | return __tree_.__lower_bound_unique(__k); | 1437 | return __tree_.__lower_bound_unique(__k); |
| 1356 | } | 1438 | } |
| 1357 | 1439 | ||
| ... | @@ -1359,56 +1441,63 @@ public: | ... | @@ -1359,56 +1441,63 @@ public: |
| 1359 | // match multiple elements. | 1441 | // match multiple elements. |
| 1360 | # if _LIBCPP_STD_VER >= 14 | 1442 | # if _LIBCPP_STD_VER >= 14 |
| 1361 | template <typename _K2, | 1443 | template <typename _K2, |
| 1362 | enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>, | 1444 | class _Comp = _Compare, |
| 1363 | int> = 0> | 1445 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> |
| 1364 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) { | 1446 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) { |
| 1365 | return __tree_.__lower_bound_multi(__k); | 1447 | return __tree_.__lower_bound_multi(__k); |
| 1366 | } | 1448 | } |
| 1367 | 1449 | ||
| 1368 | template <typename _K2, | 1450 | template <typename _K2, |
| 1369 | enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>, | 1451 | class _Comp = _Compare, |
| 1370 | int> = 0> | 1452 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> |
| 1371 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const { | 1453 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 1454 | lower_bound(const _K2& __k) const { | ||
| 1372 | return __tree_.__lower_bound_multi(__k); | 1455 | return __tree_.__lower_bound_multi(__k); |
| 1373 | } | 1456 | } |
| 1374 | # endif | 1457 | # endif |
| 1375 | 1458 | ||
| 1376 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { | 1459 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) { |
| 1377 | return __tree_.__upper_bound_unique(__k); | 1460 | return __tree_.__upper_bound_unique(__k); |
| 1378 | } | 1461 | } |
| 1379 | 1462 | ||
| 1380 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { | 1463 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 1464 | upper_bound(const key_type& __k) const { | ||
| 1381 | return __tree_.__upper_bound_unique(__k); | 1465 | return __tree_.__upper_bound_unique(__k); |
| 1382 | } | 1466 | } |
| 1383 | 1467 | ||
| 1384 | # if _LIBCPP_STD_VER >= 14 | 1468 | # if _LIBCPP_STD_VER >= 14 |
| 1385 | template <typename _K2, | 1469 | template <typename _K2, |
| 1386 | enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>, | 1470 | class _Comp = _Compare, |
| 1387 | int> = 0> | 1471 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> |
| 1388 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) { | 1472 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) { |
| 1389 | return __tree_.__upper_bound_multi(__k); | 1473 | return __tree_.__upper_bound_multi(__k); |
| 1390 | } | 1474 | } |
| 1391 | template <typename _K2, | 1475 | template <typename _K2, |
| 1392 | enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>, | 1476 | class _Comp = _Compare, |
| 1393 | int> = 0> | 1477 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> |
| 1394 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const { | 1478 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 1479 | upper_bound(const _K2& __k) const { | ||
| 1395 | return __tree_.__upper_bound_multi(__k); | 1480 | return __tree_.__upper_bound_multi(__k); |
| 1396 | } | 1481 | } |
| 1397 | # endif | 1482 | # endif |
| 1398 | 1483 | ||
| 1399 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) { | 1484 | [[__nodiscard__]] |
| 1485 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) { | ||
| 1400 | return __tree_.__equal_range_unique(__k); | 1486 | return __tree_.__equal_range_unique(__k); |
| 1401 | } | 1487 | } |
| 1402 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const { | 1488 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator> |
| 1489 | equal_range(const key_type& __k) const { | ||
| 1403 | return __tree_.__equal_range_unique(__k); | 1490 | return __tree_.__equal_range_unique(__k); |
| 1404 | } | 1491 | } |
| 1405 | # if _LIBCPP_STD_VER >= 14 | 1492 | # if _LIBCPP_STD_VER >= 14 |
| 1406 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1493 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 1407 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { | 1494 | [[__nodiscard__]] |
| 1495 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) { | ||
| 1408 | return __tree_.__equal_range_multi(__k); | 1496 | return __tree_.__equal_range_multi(__k); |
| 1409 | } | 1497 | } |
| 1410 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1498 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 1411 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { | 1499 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator> |
| 1500 | equal_range(const _K2& __k) const { | ||
| 1412 | return __tree_.__equal_range_multi(__k); | 1501 | return __tree_.__equal_range_multi(__k); |
| 1413 | } | 1502 | } |
| 1414 | # endif | 1503 | # endif |
| ... | @@ -1487,8 +1576,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<map<_Key, | ... | @@ -1487,8 +1576,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<map<_Key, |
| 1487 | static const bool __has_algorithm = true; | 1576 | static const bool __has_algorithm = true; |
| 1488 | 1577 | ||
| 1489 | template <class _Map, class _Func, class _Proj> | 1578 | template <class _Map, class _Func, class _Proj> |
| 1490 | _LIBCPP_HIDE_FROM_ABI static auto operator()(_Map&& __map, _Func __func, _Proj __proj) { | 1579 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto operator()(_Map&& __map, _Func __func, _Proj __proj) { |
| 1491 | auto [_, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()( | 1580 | auto [__dummy, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()( |
| 1492 | __map.__tree_, std::move(__func), std::move(__proj)); | 1581 | __map.__tree_, std::move(__func), std::move(__proj)); |
| 1493 | return std::make_pair(__map.end(), std::move(__func2)); | 1582 | return std::make_pair(__map.end(), std::move(__func2)); |
| 1494 | } | 1583 | } |
| ... | @@ -1497,13 +1586,13 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<map<_Key, | ... | @@ -1497,13 +1586,13 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<map<_Key, |
| 1497 | 1586 | ||
| 1498 | # ifndef _LIBCPP_CXX03_LANG | 1587 | # ifndef _LIBCPP_CXX03_LANG |
| 1499 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1588 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1500 | _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) { | 1589 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) { |
| 1501 | return __tree_.__emplace_unique(std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple()) | 1590 | return __tree_.__emplace_unique(std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple()) |
| 1502 | .first->second; | 1591 | .first->second; |
| 1503 | } | 1592 | } |
| 1504 | 1593 | ||
| 1505 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1594 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1506 | _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) { | 1595 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) { |
| 1507 | return __tree_ | 1596 | return __tree_ |
| 1508 | .__emplace_unique(std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple()) | 1597 | .__emplace_unique(std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple()) |
| 1509 | .first->second; | 1598 | .first->second; |
| ... | @@ -1538,23 +1627,23 @@ _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) { | ... | @@ -1538,23 +1627,23 @@ _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) { |
| 1538 | # endif // _LIBCPP_CXX03_LANG | 1627 | # endif // _LIBCPP_CXX03_LANG |
| 1539 | 1628 | ||
| 1540 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1629 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1541 | _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) { | 1630 | _LIBCPP_CONSTEXPR_SINCE_CXX26 _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) { |
| 1542 | auto [_, __child] = __tree_.__find_equal(__k); | 1631 | auto [__dummy, __child] = __tree_.__find_equal(__k); |
| 1543 | if (__child == nullptr) | 1632 | if (__child == nullptr) |
| 1544 | std::__throw_out_of_range("map::at: key not found"); | 1633 | std::__throw_out_of_range("map::at: key not found"); |
| 1545 | return static_cast<__node_pointer>(__child)->__get_value().second; | 1634 | return std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second; |
| 1546 | } | 1635 | } |
| 1547 | 1636 | ||
| 1548 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1637 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1549 | const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const { | 1638 | _LIBCPP_CONSTEXPR_SINCE_CXX26 const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const { |
| 1550 | auto [_, __child] = __tree_.__find_equal(__k); | 1639 | auto [__dummy, __child] = __tree_.__find_equal(__k); |
| 1551 | if (__child == nullptr) | 1640 | if (__child == nullptr) |
| 1552 | std::__throw_out_of_range("map::at: key not found"); | 1641 | std::__throw_out_of_range("map::at: key not found"); |
| 1553 | return static_cast<__node_pointer>(__child)->__get_value().second; | 1642 | return std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second; |
| 1554 | } | 1643 | } |
| 1555 | 1644 | ||
| 1556 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1645 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1557 | inline _LIBCPP_HIDE_FROM_ABI bool | 1646 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1558 | operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { | 1647 | operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 1559 | return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); | 1648 | return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); |
| 1560 | } | 1649 | } |
| ... | @@ -1562,31 +1651,31 @@ operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, | ... | @@ -1562,31 +1651,31 @@ operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, |
| 1562 | # if _LIBCPP_STD_VER <= 17 | 1651 | # if _LIBCPP_STD_VER <= 17 |
| 1563 | 1652 | ||
| 1564 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1653 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1565 | inline _LIBCPP_HIDE_FROM_ABI bool | 1654 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1566 | operator<(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { | 1655 | operator<(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 1567 | return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); | 1656 | return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); |
| 1568 | } | 1657 | } |
| 1569 | 1658 | ||
| 1570 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1659 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1571 | inline _LIBCPP_HIDE_FROM_ABI bool | 1660 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1572 | operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { | 1661 | operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 1573 | return !(__x == __y); | 1662 | return !(__x == __y); |
| 1574 | } | 1663 | } |
| 1575 | 1664 | ||
| 1576 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1665 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1577 | inline _LIBCPP_HIDE_FROM_ABI bool | 1666 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1578 | operator>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { | 1667 | operator>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 1579 | return __y < __x; | 1668 | return __y < __x; |
| 1580 | } | 1669 | } |
| 1581 | 1670 | ||
| 1582 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1671 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1583 | inline _LIBCPP_HIDE_FROM_ABI bool | 1672 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1584 | operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { | 1673 | operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 1585 | return !(__x < __y); | 1674 | return !(__x < __y); |
| 1586 | } | 1675 | } |
| 1587 | 1676 | ||
| 1588 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1677 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1589 | inline _LIBCPP_HIDE_FROM_ABI bool | 1678 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1590 | operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { | 1679 | operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 1591 | return !(__y < __x); | 1680 | return !(__y < __x); |
| 1592 | } | 1681 | } |
| ... | @@ -1594,7 +1683,7 @@ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, | ... | @@ -1594,7 +1683,7 @@ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, |
| 1594 | # else // #if _LIBCPP_STD_VER <= 17 | 1683 | # else // #if _LIBCPP_STD_VER <= 17 |
| 1595 | 1684 | ||
| 1596 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1685 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1597 | _LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>> | 1686 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<pair<const _Key, _Tp>> |
| 1598 | operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { | 1687 | operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 1599 | return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); | 1688 | return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); |
| 1600 | } | 1689 | } |
| ... | @@ -1602,7 +1691,7 @@ operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp | ... | @@ -1602,7 +1691,7 @@ operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp |
| 1602 | # endif // #if _LIBCPP_STD_VER <= 17 | 1691 | # endif // #if _LIBCPP_STD_VER <= 17 |
| 1603 | 1692 | ||
| 1604 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 1693 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 1605 | inline _LIBCPP_HIDE_FROM_ABI void | 1694 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1606 | swap(map<_Key, _Tp, _Compare, _Allocator>& __x, map<_Key, _Tp, _Compare, _Allocator>& __y) | 1695 | swap(map<_Key, _Tp, _Compare, _Allocator>& __x, map<_Key, _Tp, _Compare, _Allocator>& __y) |
| 1607 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { | 1696 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { |
| 1608 | __x.swap(__y); | 1697 | __x.swap(__y); |
| ... | @@ -1610,7 +1699,7 @@ swap(map<_Key, _Tp, _Compare, _Allocator>& __x, map<_Key, _Tp, _Compare, _Alloca | ... | @@ -1610,7 +1699,7 @@ swap(map<_Key, _Tp, _Compare, _Allocator>& __x, map<_Key, _Tp, _Compare, _Alloca |
| 1610 | 1699 | ||
| 1611 | # if _LIBCPP_STD_VER >= 20 | 1700 | # if _LIBCPP_STD_VER >= 20 |
| 1612 | template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate> | 1701 | template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate> |
| 1613 | inline _LIBCPP_HIDE_FROM_ABI typename map<_Key, _Tp, _Compare, _Allocator>::size_type | 1702 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename map<_Key, _Tp, _Compare, _Allocator>::size_type |
| 1614 | erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) { | 1703 | erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) { |
| 1615 | return std::__libcpp_erase_if_container(__c, __pred); | 1704 | return std::__libcpp_erase_if_container(__c, __pred); |
| 1616 | } | 1705 | } |
| ... | @@ -1648,10 +1737,11 @@ public: | ... | @@ -1648,10 +1737,11 @@ public: |
| 1648 | protected: | 1737 | protected: |
| 1649 | key_compare comp; | 1738 | key_compare comp; |
| 1650 | 1739 | ||
| 1651 | _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {} | 1740 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare(key_compare __c) : comp(__c) {} |
| 1652 | 1741 | ||
| 1653 | public: | 1742 | public: |
| 1654 | _LIBCPP_HIDE_FROM_ABI bool operator()(const value_type& __x, const value_type& __y) const { | 1743 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1744 | operator()(const value_type& __x, const value_type& __y) const { | ||
| 1655 | return comp(__x.first, __y.first); | 1745 | return comp(__x.first, __y.first); |
| 1656 | } | 1746 | } |
| 1657 | }; | 1747 | }; |
| ... | @@ -1684,26 +1774,28 @@ public: | ... | @@ -1684,26 +1774,28 @@ public: |
| 1684 | template <class _Key2, class _Value2, class _Comp2, class _Alloc2> | 1774 | template <class _Key2, class _Value2, class _Comp2, class _Alloc2> |
| 1685 | friend class multimap; | 1775 | friend class multimap; |
| 1686 | 1776 | ||
| 1687 | _LIBCPP_HIDE_FROM_ABI multimap() _NOEXCEPT_( | 1777 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap() _NOEXCEPT_( |
| 1688 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&& | 1778 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&& |
| 1689 | is_nothrow_copy_constructible<key_compare>::value) | 1779 | is_nothrow_copy_constructible<key_compare>::value) |
| 1690 | : __tree_(__vc(key_compare())) {} | 1780 | : __tree_(__vc(key_compare())) {} |
| 1691 | 1781 | ||
| 1692 | _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp) _NOEXCEPT_( | 1782 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const key_compare& __comp) _NOEXCEPT_( |
| 1693 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value) | 1783 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value) |
| 1694 | : __tree_(__vc(__comp)) {} | 1784 | : __tree_(__vc(__comp)) {} |
| 1695 | 1785 | ||
| 1696 | _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp, const allocator_type& __a) | 1786 | _LIBCPP_HIDE_FROM_ABI |
| 1787 | _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const key_compare& __comp, const allocator_type& __a) | ||
| 1697 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {} | 1788 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {} |
| 1698 | 1789 | ||
| 1699 | template <class _InputIterator> | 1790 | template <class _InputIterator> |
| 1700 | _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare()) | 1791 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1792 | multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare()) | ||
| 1701 | : __tree_(__vc(__comp)) { | 1793 | : __tree_(__vc(__comp)) { |
| 1702 | insert(__f, __l); | 1794 | insert(__f, __l); |
| 1703 | } | 1795 | } |
| 1704 | 1796 | ||
| 1705 | template <class _InputIterator> | 1797 | template <class _InputIterator> |
| 1706 | _LIBCPP_HIDE_FROM_ABI | 1798 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1707 | multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a) | 1799 | multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a) |
| 1708 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { | 1800 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { |
| 1709 | insert(__f, __l); | 1801 | insert(__f, __l); |
| ... | @@ -1711,7 +1803,7 @@ public: | ... | @@ -1711,7 +1803,7 @@ public: |
| 1711 | 1803 | ||
| 1712 | # if _LIBCPP_STD_VER >= 23 | 1804 | # if _LIBCPP_STD_VER >= 23 |
| 1713 | template <_ContainerCompatibleRange<value_type> _Range> | 1805 | template <_ContainerCompatibleRange<value_type> _Range> |
| 1714 | _LIBCPP_HIDE_FROM_ABI | 1806 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1715 | multimap(from_range_t, | 1807 | multimap(from_range_t, |
| 1716 | _Range&& __range, | 1808 | _Range&& __range, |
| 1717 | const key_compare& __comp = key_compare(), | 1809 | const key_compare& __comp = key_compare(), |
| ... | @@ -1721,47 +1813,48 @@ public: | ... | @@ -1721,47 +1813,48 @@ public: |
| 1721 | } | 1813 | } |
| 1722 | # endif | 1814 | # endif |
| 1723 | 1815 | ||
| 1724 | # if _LIBCPP_STD_VER >= 14 | ||
| 1725 | template <class _InputIterator> | 1816 | template <class _InputIterator> |
| 1726 | _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a) | 1817 | _LIBCPP_HIDE_FROM_ABI |
| 1818 | _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a) | ||
| 1727 | : multimap(__f, __l, key_compare(), __a) {} | 1819 | : multimap(__f, __l, key_compare(), __a) {} |
| 1728 | # endif | ||
| 1729 | 1820 | ||
| 1730 | # if _LIBCPP_STD_VER >= 23 | 1821 | # if _LIBCPP_STD_VER >= 23 |
| 1731 | template <_ContainerCompatibleRange<value_type> _Range> | 1822 | template <_ContainerCompatibleRange<value_type> _Range> |
| 1732 | _LIBCPP_HIDE_FROM_ABI multimap(from_range_t, _Range&& __range, const allocator_type& __a) | 1823 | _LIBCPP_HIDE_FROM_ABI |
| 1824 | _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(from_range_t, _Range&& __range, const allocator_type& __a) | ||
| 1733 | : multimap(from_range, std::forward<_Range>(__range), key_compare(), __a) {} | 1825 | : multimap(from_range, std::forward<_Range>(__range), key_compare(), __a) {} |
| 1734 | # endif | 1826 | # endif |
| 1735 | 1827 | ||
| 1736 | _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m) = default; | 1828 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(const multimap& __m) = default; |
| 1737 | 1829 | ||
| 1738 | _LIBCPP_HIDE_FROM_ABI multimap& operator=(const multimap& __m) = default; | 1830 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(const multimap& __m) = default; |
| 1739 | 1831 | ||
| 1740 | # ifndef _LIBCPP_CXX03_LANG | 1832 | # ifndef _LIBCPP_CXX03_LANG |
| 1741 | 1833 | ||
| 1742 | _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m) = default; | 1834 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(multimap&& __m) = default; |
| 1743 | 1835 | ||
| 1744 | _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m, const allocator_type& __a) : __tree_(std::move(__m.__tree_), __a) {} | 1836 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(multimap&& __m, const allocator_type& __a) |
| 1837 | : __tree_(std::move(__m.__tree_), __a) {} | ||
| 1745 | 1838 | ||
| 1746 | _LIBCPP_HIDE_FROM_ABI multimap& operator=(multimap&& __m) = default; | 1839 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(multimap&& __m) = default; |
| 1747 | 1840 | ||
| 1748 | _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare()) | 1841 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1842 | multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare()) | ||
| 1749 | : __tree_(__vc(__comp)) { | 1843 | : __tree_(__vc(__comp)) { |
| 1750 | insert(__il.begin(), __il.end()); | 1844 | insert(__il.begin(), __il.end()); |
| 1751 | } | 1845 | } |
| 1752 | 1846 | ||
| 1753 | _LIBCPP_HIDE_FROM_ABI | 1847 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1754 | multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a) | 1848 | multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a) |
| 1755 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { | 1849 | : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { |
| 1756 | insert(__il.begin(), __il.end()); | 1850 | insert(__il.begin(), __il.end()); |
| 1757 | } | 1851 | } |
| 1758 | 1852 | ||
| 1759 | # if _LIBCPP_STD_VER >= 14 | 1853 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1760 | _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const allocator_type& __a) | 1854 | multimap(initializer_list<value_type> __il, const allocator_type& __a) |
| 1761 | : multimap(__il, key_compare(), __a) {} | 1855 | : multimap(__il, key_compare(), __a) {} |
| 1762 | # endif | ||
| 1763 | 1856 | ||
| 1764 | _LIBCPP_HIDE_FROM_ABI multimap& operator=(initializer_list<value_type> __il) { | 1857 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(initializer_list<value_type> __il) { |
| 1765 | clear(); | 1858 | clear(); |
| 1766 | insert(__il.begin(), __il.end()); | 1859 | insert(__il.begin(), __il.end()); |
| 1767 | return *this; | 1860 | return *this; |
| ... | @@ -1769,234 +1862,309 @@ public: | ... | @@ -1769,234 +1862,309 @@ public: |
| 1769 | 1862 | ||
| 1770 | # endif // _LIBCPP_CXX03_LANG | 1863 | # endif // _LIBCPP_CXX03_LANG |
| 1771 | 1864 | ||
| 1772 | _LIBCPP_HIDE_FROM_ABI explicit multimap(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {} | 1865 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const allocator_type& __a) |
| 1866 | : __tree_(typename __base::allocator_type(__a)) {} | ||
| 1773 | 1867 | ||
| 1774 | _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m, const allocator_type& __a) : __tree_(__m.__tree_, __a) {} | 1868 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(const multimap& __m, const allocator_type& __a) |
| 1869 | : __tree_(__m.__tree_, __a) {} | ||
| 1775 | 1870 | ||
| 1776 | _LIBCPP_HIDE_FROM_ABI ~multimap() { | 1871 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~multimap() { |
| 1777 | static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); | 1872 | static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); |
| 1778 | } | 1873 | } |
| 1779 | 1874 | ||
| 1780 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); } | 1875 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT { |
| 1781 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); } | 1876 | return __tree_.begin(); |
| 1782 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); } | 1877 | } |
| 1783 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); } | 1878 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT { |
| 1879 | return __tree_.begin(); | ||
| 1880 | } | ||
| 1881 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT { | ||
| 1882 | return __tree_.end(); | ||
| 1883 | } | ||
| 1884 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT { | ||
| 1885 | return __tree_.end(); | ||
| 1886 | } | ||
| 1784 | 1887 | ||
| 1785 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); } | 1888 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT { |
| 1786 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { | 1889 | return reverse_iterator(end()); |
| 1890 | } | ||
| 1891 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator | ||
| 1892 | rbegin() const _NOEXCEPT { | ||
| 1787 | return const_reverse_iterator(end()); | 1893 | return const_reverse_iterator(end()); |
| 1788 | } | 1894 | } |
| 1789 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); } | 1895 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT { |
| 1790 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { | 1896 | return reverse_iterator(begin()); |
| 1897 | } | ||
| 1898 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT { | ||
| 1791 | return const_reverse_iterator(begin()); | 1899 | return const_reverse_iterator(begin()); |
| 1792 | } | 1900 | } |
| 1793 | 1901 | ||
| 1794 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); } | 1902 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT { |
| 1795 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); } | 1903 | return begin(); |
| 1796 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); } | 1904 | } |
| 1797 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); } | 1905 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT { |
| 1906 | return end(); | ||
| 1907 | } | ||
| 1908 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator | ||
| 1909 | crbegin() const _NOEXCEPT { | ||
| 1910 | return rbegin(); | ||
| 1911 | } | ||
| 1912 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT { | ||
| 1913 | return rend(); | ||
| 1914 | } | ||
| 1798 | 1915 | ||
| 1799 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } | 1916 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT { |
| 1800 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); } | 1917 | return __tree_.size() == 0; |
| 1801 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); } | 1918 | } |
| 1919 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT { | ||
| 1920 | return __tree_.size(); | ||
| 1921 | } | ||
| 1922 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT { | ||
| 1923 | return __tree_.max_size(); | ||
| 1924 | } | ||
| 1802 | 1925 | ||
| 1803 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { | 1926 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT { |
| 1804 | return allocator_type(__tree_.__alloc()); | 1927 | return allocator_type(__tree_.__alloc()); |
| 1805 | } | 1928 | } |
| 1806 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); } | 1929 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { |
| 1807 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { | 1930 | return __tree_.value_comp().key_comp(); |
| 1931 | } | ||
| 1932 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const { | ||
| 1808 | return value_compare(__tree_.value_comp().key_comp()); | 1933 | return value_compare(__tree_.value_comp().key_comp()); |
| 1809 | } | 1934 | } |
| 1810 | 1935 | ||
| 1811 | # ifndef _LIBCPP_CXX03_LANG | 1936 | # ifndef _LIBCPP_CXX03_LANG |
| 1812 | 1937 | ||
| 1813 | template <class... _Args> | 1938 | template <class... _Args> |
| 1814 | _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) { | 1939 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace(_Args&&... __args) { |
| 1815 | return __tree_.__emplace_multi(std::forward<_Args>(__args)...); | 1940 | return __tree_.__emplace_multi(std::forward<_Args>(__args)...); |
| 1816 | } | 1941 | } |
| 1817 | 1942 | ||
| 1818 | template <class... _Args> | 1943 | template <class... _Args> |
| 1819 | _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) { | 1944 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) { |
| 1820 | return __tree_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...); | 1945 | return __tree_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...); |
| 1821 | } | 1946 | } |
| 1822 | 1947 | ||
| 1823 | template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> | 1948 | template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> |
| 1824 | _LIBCPP_HIDE_FROM_ABI iterator insert(_Pp&& __p) { | 1949 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(_Pp&& __p) { |
| 1825 | return __tree_.__emplace_multi(std::forward<_Pp>(__p)); | 1950 | return __tree_.__emplace_multi(std::forward<_Pp>(__p)); |
| 1826 | } | 1951 | } |
| 1827 | 1952 | ||
| 1828 | template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> | 1953 | template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0> |
| 1829 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) { | 1954 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __pos, _Pp&& __p) { |
| 1830 | return __tree_.__emplace_hint_multi(__pos.__i_, std::forward<_Pp>(__p)); | 1955 | return __tree_.__emplace_hint_multi(__pos.__i_, std::forward<_Pp>(__p)); |
| 1831 | } | 1956 | } |
| 1832 | 1957 | ||
| 1833 | _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __v) { return __tree_.__emplace_multi(std::move(__v)); } | 1958 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(value_type&& __v) { |
| 1959 | return __tree_.__emplace_multi(std::move(__v)); | ||
| 1960 | } | ||
| 1834 | 1961 | ||
| 1835 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) { | 1962 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) { |
| 1836 | return __tree_.__emplace_hint_multi(__p.__i_, std::move(__v)); | 1963 | return __tree_.__emplace_hint_multi(__p.__i_, std::move(__v)); |
| 1837 | } | 1964 | } |
| 1838 | 1965 | ||
| 1839 | _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); } | 1966 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) { |
| 1967 | insert(__il.begin(), __il.end()); | ||
| 1968 | } | ||
| 1840 | 1969 | ||
| 1841 | # endif // _LIBCPP_CXX03_LANG | 1970 | # endif // _LIBCPP_CXX03_LANG |
| 1842 | 1971 | ||
| 1843 | _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __v) { return __tree_.__emplace_multi(__v); } | 1972 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const value_type& __v) { |
| 1973 | return __tree_.__emplace_multi(__v); | ||
| 1974 | } | ||
| 1844 | 1975 | ||
| 1845 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) { | 1976 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) { |
| 1846 | return __tree_.__emplace_hint_multi(__p.__i_, __v); | 1977 | return __tree_.__emplace_hint_multi(__p.__i_, __v); |
| 1847 | } | 1978 | } |
| 1848 | 1979 | ||
| 1849 | template <class _InputIterator> | 1980 | template <class _InputIterator> |
| 1850 | _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) { | 1981 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __f, _InputIterator __l) { |
| 1851 | __tree_.__insert_range_multi(__f, __l); | 1982 | __tree_.__insert_range_multi(__f, __l); |
| 1852 | } | 1983 | } |
| 1853 | 1984 | ||
| 1854 | # if _LIBCPP_STD_VER >= 23 | 1985 | # if _LIBCPP_STD_VER >= 23 |
| 1855 | template <_ContainerCompatibleRange<value_type> _Range> | 1986 | template <_ContainerCompatibleRange<value_type> _Range> |
| 1856 | _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) { | 1987 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) { |
| 1857 | __tree_.__insert_range_multi(ranges::begin(__range), ranges::end(__range)); | 1988 | __tree_.__insert_range_multi(ranges::begin(__range), ranges::end(__range)); |
| 1858 | } | 1989 | } |
| 1859 | # endif | 1990 | # endif |
| 1860 | 1991 | ||
| 1861 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p.__i_); } | 1992 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) { |
| 1862 | _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __tree_.erase(__p.__i_); } | 1993 | return __tree_.erase(__p.__i_); |
| 1863 | _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); } | 1994 | } |
| 1864 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { | 1995 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(iterator __p) { return __tree_.erase(__p.__i_); } |
| 1996 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) { | ||
| 1997 | return __tree_.__erase_multi(__k); | ||
| 1998 | } | ||
| 1999 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) { | ||
| 1865 | return __tree_.erase(__f.__i_, __l.__i_); | 2000 | return __tree_.erase(__f.__i_, __l.__i_); |
| 1866 | } | 2001 | } |
| 1867 | 2002 | ||
| 1868 | # if _LIBCPP_STD_VER >= 17 | 2003 | # if _LIBCPP_STD_VER >= 17 |
| 1869 | _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) { | 2004 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(node_type&& __nh) { |
| 1870 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), | 2005 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 1871 | "node_type with incompatible allocator passed to multimap::insert()"); | 2006 | "node_type with incompatible allocator passed to multimap::insert()"); |
| 1872 | return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh)); | 2007 | return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh)); |
| 1873 | } | 2008 | } |
| 1874 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) { | 2009 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) { |
| 1875 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), | 2010 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 1876 | "node_type with incompatible allocator passed to multimap::insert()"); | 2011 | "node_type with incompatible allocator passed to multimap::insert()"); |
| 1877 | return __tree_.template __node_handle_insert_multi<node_type>(__hint.__i_, std::move(__nh)); | 2012 | return __tree_.template __node_handle_insert_multi<node_type>(__hint.__i_, std::move(__nh)); |
| 1878 | } | 2013 | } |
| 1879 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) { | 2014 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) { |
| 1880 | return __tree_.template __node_handle_extract<node_type>(__key); | 2015 | return __tree_.template __node_handle_extract<node_type>(__key); |
| 1881 | } | 2016 | } |
| 1882 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) { | 2017 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) { |
| 1883 | return __tree_.template __node_handle_extract<node_type>(__it.__i_); | 2018 | return __tree_.template __node_handle_extract<node_type>(__it.__i_); |
| 1884 | } | 2019 | } |
| 1885 | template <class _Compare2> | 2020 | template <class _Compare2> |
| 1886 | _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) { | 2021 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 2022 | merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) { | ||
| 1887 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 2023 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1888 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 2024 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1889 | return __tree_.__node_handle_merge_multi(__source.__tree_); | 2025 | return __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1890 | } | 2026 | } |
| 1891 | template <class _Compare2> | 2027 | template <class _Compare2> |
| 1892 | _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) { | 2028 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 2029 | merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) { | ||
| 1893 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 2030 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1894 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 2031 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1895 | return __tree_.__node_handle_merge_multi(__source.__tree_); | 2032 | return __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1896 | } | 2033 | } |
| 1897 | template <class _Compare2> | 2034 | template <class _Compare2> |
| 1898 | _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) { | 2035 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 2036 | merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) { | ||
| 1899 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 2037 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1900 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 2038 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1901 | return __tree_.__node_handle_merge_multi(__source.__tree_); | 2039 | return __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1902 | } | 2040 | } |
| 1903 | template <class _Compare2> | 2041 | template <class _Compare2> |
| 1904 | _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) { | 2042 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 2043 | merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) { | ||
| 1905 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 2044 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1906 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 2045 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1907 | return __tree_.__node_handle_merge_multi(__source.__tree_); | 2046 | return __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1908 | } | 2047 | } |
| 1909 | # endif | 2048 | # endif |
| 1910 | 2049 | ||
| 1911 | _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); } | 2050 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); } |
| 1912 | 2051 | ||
| 1913 | _LIBCPP_HIDE_FROM_ABI void swap(multimap& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { | 2052 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(multimap& __m) |
| 2053 | _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { | ||
| 1914 | __tree_.swap(__m.__tree_); | 2054 | __tree_.swap(__m.__tree_); |
| 1915 | } | 2055 | } |
| 1916 | 2056 | ||
| 1917 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); } | 2057 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) { |
| 1918 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); } | 2058 | return __tree_.find(__k); |
| 2059 | } | ||
| 2060 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const { | ||
| 2061 | return __tree_.find(__k); | ||
| 2062 | } | ||
| 1919 | # if _LIBCPP_STD_VER >= 14 | 2063 | # if _LIBCPP_STD_VER >= 14 |
| 1920 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 2064 | template <typename _K2, |
| 1921 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { | 2065 | class _Comp = _Compare, |
| 2066 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 2067 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) { | ||
| 1922 | return __tree_.find(__k); | 2068 | return __tree_.find(__k); |
| 1923 | } | 2069 | } |
| 1924 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 2070 | template <typename _K2, |
| 1925 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { | 2071 | class _Comp = _Compare, |
| 2072 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 2073 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const { | ||
| 1926 | return __tree_.find(__k); | 2074 | return __tree_.find(__k); |
| 1927 | } | 2075 | } |
| 1928 | # endif | 2076 | # endif |
| 1929 | 2077 | ||
| 1930 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { | 2078 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const { |
| 1931 | return __tree_.__count_multi(__k); | 2079 | return __tree_.__count_multi(__k); |
| 1932 | } | 2080 | } |
| 1933 | # if _LIBCPP_STD_VER >= 14 | 2081 | # if _LIBCPP_STD_VER >= 14 |
| 1934 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 2082 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 1935 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { | 2083 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const { |
| 1936 | return __tree_.__count_multi(__k); | 2084 | return __tree_.__count_multi(__k); |
| 1937 | } | 2085 | } |
| 1938 | # endif | 2086 | # endif |
| 1939 | 2087 | ||
| 1940 | # if _LIBCPP_STD_VER >= 20 | 2088 | # if _LIBCPP_STD_VER >= 20 |
| 1941 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } | 2089 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const { |
| 1942 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 2090 | return find(__k) != end(); |
| 1943 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { | 2091 | } |
| 2092 | template <typename _K2, | ||
| 2093 | class _Comp = _Compare, | ||
| 2094 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 2095 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const { | ||
| 1944 | return find(__k) != end(); | 2096 | return find(__k) != end(); |
| 1945 | } | 2097 | } |
| 1946 | # endif // _LIBCPP_STD_VER >= 20 | 2098 | # endif // _LIBCPP_STD_VER >= 20 |
| 1947 | 2099 | ||
| 1948 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { | 2100 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) { |
| 1949 | return __tree_.__lower_bound_multi(__k); | 2101 | return __tree_.__lower_bound_multi(__k); |
| 1950 | } | 2102 | } |
| 1951 | 2103 | ||
| 1952 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { | 2104 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 2105 | lower_bound(const key_type& __k) const { | ||
| 1953 | return __tree_.__lower_bound_multi(__k); | 2106 | return __tree_.__lower_bound_multi(__k); |
| 1954 | } | 2107 | } |
| 1955 | 2108 | ||
| 1956 | # if _LIBCPP_STD_VER >= 14 | 2109 | # if _LIBCPP_STD_VER >= 14 |
| 1957 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 2110 | template <typename _K2, |
| 1958 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) { | 2111 | class _Comp = _Compare, |
| 2112 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 2113 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) { | ||
| 1959 | return __tree_.__lower_bound_multi(__k); | 2114 | return __tree_.__lower_bound_multi(__k); |
| 1960 | } | 2115 | } |
| 1961 | 2116 | ||
| 1962 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 2117 | template <typename _K2, |
| 1963 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const { | 2118 | class _Comp = _Compare, |
| 2119 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 2120 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator | ||
| 2121 | lower_bound(const _K2& __k) const { | ||
| 1964 | return __tree_.__lower_bound_multi(__k); | 2122 | return __tree_.__lower_bound_multi(__k); |
| 1965 | } | 2123 | } |
| 1966 | # endif | 2124 | # endif |
| 1967 | 2125 | ||
| 1968 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { | 2126 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) { |
| 1969 | return __tree_.__upper_bound_multi(__k); | 2127 | return __tree_.__upper_bound_multi(__k); |
| 1970 | } | 2128 | } |
| 1971 | 2129 | ||
| 1972 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { | 2130 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 2131 | upper_bound(const key_type& __k) const { | ||
| 1973 | return __tree_.__upper_bound_multi(__k); | 2132 | return __tree_.__upper_bound_multi(__k); |
| 1974 | } | 2133 | } |
| 1975 | 2134 | ||
| 1976 | # if _LIBCPP_STD_VER >= 14 | 2135 | # if _LIBCPP_STD_VER >= 14 |
| 1977 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 2136 | template <typename _K2, |
| 1978 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) { | 2137 | class _Comp = _Compare, |
| 2138 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 2139 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) { | ||
| 1979 | return __tree_.__upper_bound_multi(__k); | 2140 | return __tree_.__upper_bound_multi(__k); |
| 1980 | } | 2141 | } |
| 1981 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 2142 | template <typename _K2, |
| 1982 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const { | 2143 | class _Comp = _Compare, |
| 2144 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 2145 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator | ||
| 2146 | upper_bound(const _K2& __k) const { | ||
| 1983 | return __tree_.__upper_bound_multi(__k); | 2147 | return __tree_.__upper_bound_multi(__k); |
| 1984 | } | 2148 | } |
| 1985 | # endif | 2149 | # endif |
| 1986 | 2150 | ||
| 1987 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) { | 2151 | [[__nodiscard__]] |
| 2152 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) { | ||
| 1988 | return __tree_.__equal_range_multi(__k); | 2153 | return __tree_.__equal_range_multi(__k); |
| 1989 | } | 2154 | } |
| 1990 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const { | 2155 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator> |
| 2156 | equal_range(const key_type& __k) const { | ||
| 1991 | return __tree_.__equal_range_multi(__k); | 2157 | return __tree_.__equal_range_multi(__k); |
| 1992 | } | 2158 | } |
| 1993 | # if _LIBCPP_STD_VER >= 14 | 2159 | # if _LIBCPP_STD_VER >= 14 |
| 1994 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 2160 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 1995 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { | 2161 | [[__nodiscard__]] |
| 2162 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) { | ||
| 1996 | return __tree_.__equal_range_multi(__k); | 2163 | return __tree_.__equal_range_multi(__k); |
| 1997 | } | 2164 | } |
| 1998 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 2165 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 1999 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { | 2166 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator> |
| 2167 | equal_range(const _K2& __k) const { | ||
| 2000 | return __tree_.__equal_range_multi(__k); | 2168 | return __tree_.__equal_range_multi(__k); |
| 2001 | } | 2169 | } |
| 2002 | # endif | 2170 | # endif |
| ... | @@ -2070,8 +2238,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<multimap<_ | ... | @@ -2070,8 +2238,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<multimap<_ |
| 2070 | static const bool __has_algorithm = true; | 2238 | static const bool __has_algorithm = true; |
| 2071 | 2239 | ||
| 2072 | template <class _Map, class _Func, class _Proj> | 2240 | template <class _Map, class _Func, class _Proj> |
| 2073 | _LIBCPP_HIDE_FROM_ABI static auto operator()(_Map&& __map, _Func __func, _Proj __proj) { | 2241 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto operator()(_Map&& __map, _Func __func, _Proj __proj) { |
| 2074 | auto [_, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()( | 2242 | auto [__dummy, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()( |
| 2075 | __map.__tree_, std::move(__func), std::move(__proj)); | 2243 | __map.__tree_, std::move(__func), std::move(__proj)); |
| 2076 | return std::make_pair(__map.end(), std::move(__func2)); | 2244 | return std::make_pair(__map.end(), std::move(__func2)); |
| 2077 | } | 2245 | } |
| ... | @@ -2079,7 +2247,7 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<multimap<_ | ... | @@ -2079,7 +2247,7 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<multimap<_ |
| 2079 | # endif | 2247 | # endif |
| 2080 | 2248 | ||
| 2081 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 2249 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2082 | inline _LIBCPP_HIDE_FROM_ABI bool | 2250 | inline _LIBCPP_HIDE_FROM_ABI bool _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 2083 | operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { | 2251 | operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 2084 | return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); | 2252 | return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); |
| 2085 | } | 2253 | } |
| ... | @@ -2087,31 +2255,31 @@ operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap< | ... | @@ -2087,31 +2255,31 @@ operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap< |
| 2087 | # if _LIBCPP_STD_VER <= 17 | 2255 | # if _LIBCPP_STD_VER <= 17 |
| 2088 | 2256 | ||
| 2089 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 2257 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2090 | inline _LIBCPP_HIDE_FROM_ABI bool | 2258 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 2091 | operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { | 2259 | operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 2092 | return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); | 2260 | return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); |
| 2093 | } | 2261 | } |
| 2094 | 2262 | ||
| 2095 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 2263 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2096 | inline _LIBCPP_HIDE_FROM_ABI bool | 2264 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 2097 | operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { | 2265 | operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 2098 | return !(__x == __y); | 2266 | return !(__x == __y); |
| 2099 | } | 2267 | } |
| 2100 | 2268 | ||
| 2101 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 2269 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2102 | inline _LIBCPP_HIDE_FROM_ABI bool | 2270 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 2103 | operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { | 2271 | operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 2104 | return __y < __x; | 2272 | return __y < __x; |
| 2105 | } | 2273 | } |
| 2106 | 2274 | ||
| 2107 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 2275 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2108 | inline _LIBCPP_HIDE_FROM_ABI bool | 2276 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 2109 | operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { | 2277 | operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 2110 | return !(__x < __y); | 2278 | return !(__x < __y); |
| 2111 | } | 2279 | } |
| 2112 | 2280 | ||
| 2113 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 2281 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2114 | inline _LIBCPP_HIDE_FROM_ABI bool | 2282 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 2115 | operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { | 2283 | operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 2116 | return !(__y < __x); | 2284 | return !(__y < __x); |
| 2117 | } | 2285 | } |
| ... | @@ -2119,7 +2287,7 @@ operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap< | ... | @@ -2119,7 +2287,7 @@ operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap< |
| 2119 | # else // #if _LIBCPP_STD_VER <= 17 | 2287 | # else // #if _LIBCPP_STD_VER <= 17 |
| 2120 | 2288 | ||
| 2121 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 2289 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2122 | _LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>> | 2290 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<pair<const _Key, _Tp>> |
| 2123 | operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, | 2291 | operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, |
| 2124 | const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { | 2292 | const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { |
| 2125 | return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way); | 2293 | return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way); |
| ... | @@ -2128,7 +2296,7 @@ operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, | ... | @@ -2128,7 +2296,7 @@ operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, |
| 2128 | # endif // #if _LIBCPP_STD_VER <= 17 | 2296 | # endif // #if _LIBCPP_STD_VER <= 17 |
| 2129 | 2297 | ||
| 2130 | template <class _Key, class _Tp, class _Compare, class _Allocator> | 2298 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
| 2131 | inline _LIBCPP_HIDE_FROM_ABI void | 2299 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 2132 | swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compare, _Allocator>& __y) | 2300 | swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compare, _Allocator>& __y) |
| 2133 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { | 2301 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { |
| 2134 | __x.swap(__y); | 2302 | __x.swap(__y); |
| ... | @@ -2136,7 +2304,7 @@ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compar | ... | @@ -2136,7 +2304,7 @@ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compar |
| 2136 | 2304 | ||
| 2137 | # if _LIBCPP_STD_VER >= 20 | 2305 | # if _LIBCPP_STD_VER >= 20 |
| 2138 | template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate> | 2306 | template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate> |
| 2139 | inline _LIBCPP_HIDE_FROM_ABI typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type | 2307 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type |
| 2140 | erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) { | 2308 | erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) { |
| 2141 | return std::__libcpp_erase_if_container(__c, __pred); | 2309 | return std::__libcpp_erase_if_container(__c, __pred); |
| 2142 | } | 2310 | } |
| ... | @@ -2170,7 +2338,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -2170,7 +2338,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 2170 | 2338 | ||
| 2171 | _LIBCPP_POP_MACROS | 2339 | _LIBCPP_POP_MACROS |
| 2172 | 2340 | ||
| 2173 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 2341 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 2174 | # include <concepts> | 2342 | # include <concepts> |
| 2175 | # include <cstdlib> | 2343 | # include <cstdlib> |
| 2176 | # include <functional> | 2344 | # include <functional> |
lib/libcxx/include/mdspan+46-46| ... | @@ -46,15 +46,15 @@ namespace std { | ... | @@ -46,15 +46,15 @@ namespace std { |
| 46 | // extents synopsis | 46 | // extents synopsis |
| 47 | 47 | ||
| 48 | namespace std { | 48 | namespace std { |
| 49 | template<class _IndexType, size_t... _Extents> | 49 | template<class IndexType, size_t... Extents> |
| 50 | class extents { | 50 | class extents { |
| 51 | public: | 51 | public: |
| 52 | using index_type = _IndexType; | 52 | using index_type = IndexType; |
| 53 | using size_type = make_unsigned_t<index_type>; | 53 | using size_type = make_unsigned_t<index_type>; |
| 54 | using rank_type = size_t; | 54 | using rank_type = size_t; |
| 55 | 55 | ||
| 56 | // [mdspan.extents.obs], observers of the multidimensional index space | 56 | // [mdspan.extents.obs], observers of the multidimensional index space |
| 57 | static constexpr rank_type rank() noexcept { return sizeof...(_Extents); } | 57 | static constexpr rank_type rank() noexcept { return sizeof...(Extents); } |
| 58 | static constexpr rank_type rank_dynamic() noexcept { return dynamic-index(rank()); } | 58 | static constexpr rank_type rank_dynamic() noexcept { return dynamic-index(rank()); } |
| 59 | static constexpr size_t static_extent(rank_type) noexcept; | 59 | static constexpr size_t static_extent(rank_type) noexcept; |
| 60 | constexpr index_type extent(rank_type) const noexcept; | 60 | constexpr index_type extent(rank_type) const noexcept; |
| ... | @@ -62,20 +62,20 @@ namespace std { | ... | @@ -62,20 +62,20 @@ namespace std { |
| 62 | // [mdspan.extents.cons], constructors | 62 | // [mdspan.extents.cons], constructors |
| 63 | constexpr extents() noexcept = default; | 63 | constexpr extents() noexcept = default; |
| 64 | 64 | ||
| 65 | template<class _OtherIndexType, size_t... _OtherExtents> | 65 | template<class OtherIndexType, size_t... OtherExtents> |
| 66 | constexpr explicit(see below) | 66 | constexpr explicit(see below) |
| 67 | extents(const extents<_OtherIndexType, _OtherExtents...>&) noexcept; | 67 | extents(const extents<OtherIndexType, OtherExtents...>&) noexcept; |
| 68 | template<class... _OtherIndexTypes> | 68 | template<class... OtherIndexTypes> |
| 69 | constexpr explicit extents(_OtherIndexTypes...) noexcept; | 69 | constexpr explicit extents(OtherIndexTypes...) noexcept; |
| 70 | template<class _OtherIndexType, size_t N> | 70 | template<class OtherIndexType, size_t N> |
| 71 | constexpr explicit(N != rank_dynamic()) | 71 | constexpr explicit(N != rank_dynamic()) |
| 72 | extents(span<_OtherIndexType, N>) noexcept; | 72 | extents(span<OtherIndexType, N>) noexcept; |
| 73 | template<class _OtherIndexType, size_t N> | 73 | template<class OtherIndexType, size_t N> |
| 74 | constexpr explicit(N != rank_dynamic()) | 74 | constexpr explicit(N != rank_dynamic()) |
| 75 | extents(const array<_OtherIndexType, N>&) noexcept; | 75 | extents(const array<OtherIndexType, N>&) noexcept; |
| 76 | 76 | ||
| 77 | // [mdspan.extents.cmp], comparison operators | 77 | // [mdspan.extents.cmp], comparison operators |
| 78 | template<class _OtherIndexType, size_t... _OtherExtents> | 78 | template<class OtherIndexType, size_t... OtherExtents> |
| 79 | friend constexpr bool operator==(const extents&, | 79 | friend constexpr bool operator==(const extents&, |
| 80 | const extents<_OtherIndexType, _OtherExtents...>&) noexcept; | 80 | const extents<_OtherIndexType, _OtherExtents...>&) noexcept; |
| 81 | 81 | ||
| ... | @@ -97,12 +97,12 @@ namespace std { | ... | @@ -97,12 +97,12 @@ namespace std { |
| 97 | class layout_left::mapping { | 97 | class layout_left::mapping { |
| 98 | public: | 98 | public: |
| 99 | using extents_type = Extents; | 99 | using extents_type = Extents; |
| 100 | using index_type = typename extents_type::index_type; | 100 | using index_type = extents_type::index_type; |
| 101 | using size_type = typename extents_type::size_type; | 101 | using size_type = extents_type::size_type; |
| 102 | using rank_type = typename extents_type::rank_type; | 102 | using rank_type = extents_type::rank_type; |
| 103 | using layout_type = layout_left; | 103 | using layout_type = layout_left; |
| 104 | 104 | ||
| 105 | // [mdspan.layout.right.cons], constructors | 105 | // [mdspan.layout.left.cons], constructors |
| 106 | constexpr mapping() noexcept = default; | 106 | constexpr mapping() noexcept = default; |
| 107 | constexpr mapping(const mapping&) noexcept = default; | 107 | constexpr mapping(const mapping&) noexcept = default; |
| 108 | constexpr mapping(const extents_type&) noexcept; | 108 | constexpr mapping(const extents_type&) noexcept; |
| ... | @@ -118,7 +118,7 @@ namespace std { | ... | @@ -118,7 +118,7 @@ namespace std { |
| 118 | 118 | ||
| 119 | constexpr mapping& operator=(const mapping&) noexcept = default; | 119 | constexpr mapping& operator=(const mapping&) noexcept = default; |
| 120 | 120 | ||
| 121 | // [mdspan.layout.right.obs], observers | 121 | // [mdspan.layout.left.obs], observers |
| 122 | constexpr const extents_type& extents() const noexcept { return extents_; } | 122 | constexpr const extents_type& extents() const noexcept { return extents_; } |
| 123 | 123 | ||
| 124 | constexpr index_type required_span_size() const noexcept; | 124 | constexpr index_type required_span_size() const noexcept; |
| ... | @@ -151,9 +151,9 @@ namespace std { | ... | @@ -151,9 +151,9 @@ namespace std { |
| 151 | class layout_right::mapping { | 151 | class layout_right::mapping { |
| 152 | public: | 152 | public: |
| 153 | using extents_type = Extents; | 153 | using extents_type = Extents; |
| 154 | using index_type = typename extents_type::index_type; | 154 | using index_type = extents_type::index_type; |
| 155 | using size_type = typename extents_type::size_type; | 155 | using size_type = extents_type::size_type; |
| 156 | using rank_type = typename extents_type::rank_type; | 156 | using rank_type = extents_type::rank_type; |
| 157 | using layout_type = layout_right; | 157 | using layout_type = layout_right; |
| 158 | 158 | ||
| 159 | // [mdspan.layout.right.cons], constructors | 159 | // [mdspan.layout.right.cons], constructors |
| ... | @@ -205,9 +205,9 @@ namespace std { | ... | @@ -205,9 +205,9 @@ namespace std { |
| 205 | class layout_stride::mapping { | 205 | class layout_stride::mapping { |
| 206 | public: | 206 | public: |
| 207 | using extents_type = Extents; | 207 | using extents_type = Extents; |
| 208 | using index_type = typename extents_type::index_type; | 208 | using index_type = extents_type::index_type; |
| 209 | using size_type = typename extents_type::size_type; | 209 | using size_type = extents_type::size_type; |
| 210 | using rank_type = typename extents_type::rank_type; | 210 | using rank_type = extents_type::rank_type; |
| 211 | using layout_type = layout_stride; | 211 | using layout_type = layout_stride; |
| 212 | 212 | ||
| 213 | private: | 213 | private: |
| ... | @@ -237,7 +237,7 @@ namespace std { | ... | @@ -237,7 +237,7 @@ namespace std { |
| 237 | constexpr index_type operator()(Indices...) const noexcept; | 237 | constexpr index_type operator()(Indices...) const noexcept; |
| 238 | 238 | ||
| 239 | static constexpr bool is_always_unique() noexcept { return true; } | 239 | static constexpr bool is_always_unique() noexcept { return true; } |
| 240 | static constexpr bool is_always_exhaustive() noexcept { return false; } | 240 | static constexpr bool is_always_exhaustive() noexcept; |
| 241 | static constexpr bool is_always_strided() noexcept { return true; } | 241 | static constexpr bool is_always_strided() noexcept { return true; } |
| 242 | 242 | ||
| 243 | static constexpr bool is_unique() noexcept { return true; } | 243 | static constexpr bool is_unique() noexcept { return true; } |
| ... | @@ -286,22 +286,19 @@ namespace std { | ... | @@ -286,22 +286,19 @@ namespace std { |
| 286 | static constexpr size_t byte_alignment = ByteAlignment; | 286 | static constexpr size_t byte_alignment = ByteAlignment; |
| 287 | 287 | ||
| 288 | constexpr aligned_accessor() noexcept = default; | 288 | constexpr aligned_accessor() noexcept = default; |
| 289 | |||
| 290 | template<class OtherElementType, size_t OtherByteAlignment> | 289 | template<class OtherElementType, size_t OtherByteAlignment> |
| 291 | constexpr aligned_accessor( | 290 | constexpr aligned_accessor( |
| 292 | aligned_accessor<OtherElementType, OtherByteAlignment>) noexcept; | 291 | aligned_accessor<OtherElementType, OtherByteAlignment>) noexcept; |
| 293 | |||
| 294 | template<class OtherElementType> | 292 | template<class OtherElementType> |
| 295 | explicit constexpr aligned_accessor( | 293 | constexpr explicit aligned_accessor(default_accessor<OtherElementType>) noexcept; |
| 296 | default_accessor<OtherElementType>) noexcept; | ||
| 297 | 294 | ||
| 298 | template<class OtherElementType> | 295 | template<class OtherElementType> |
| 299 | constexpr operator default_accessor<OtherElementType>() const noexcept; | 296 | constexpr operator default_accessor<OtherElementType>() const noexcept; |
| 300 | 297 | ||
| 301 | constexpr reference access(data_handle_type p, size_t i) const noexcept; | 298 | constexpr reference access(data_handle_type p, size_t i) const noexcept; |
| 302 | 299 | ||
| 303 | constexpr typename offset_policy::data_handle_type | 300 | constexpr typename offset_policy::data_handle_type offset( |
| 304 | offset(data_handle_type p, size_t i) const noexcept; | 301 | data_handle_type p, size_t i) const noexcept; |
| 305 | }; | 302 | }; |
| 306 | } | 303 | } |
| 307 | 304 | ||
| ... | @@ -315,14 +312,14 @@ namespace std { | ... | @@ -315,14 +312,14 @@ namespace std { |
| 315 | using extents_type = Extents; | 312 | using extents_type = Extents; |
| 316 | using layout_type = LayoutPolicy; | 313 | using layout_type = LayoutPolicy; |
| 317 | using accessor_type = AccessorPolicy; | 314 | using accessor_type = AccessorPolicy; |
| 318 | using mapping_type = typename layout_type::template mapping<extents_type>; | 315 | using mapping_type = layout_type::template mapping<extents_type>; |
| 319 | using element_type = ElementType; | 316 | using element_type = ElementType; |
| 320 | using value_type = remove_cv_t<element_type>; | 317 | using value_type = remove_cv_t<element_type>; |
| 321 | using index_type = typename extents_type::index_type; | 318 | using index_type = extents_type::index_type; |
| 322 | using size_type = typename extents_type::size_type; | 319 | using size_type = extents_type::size_type; |
| 323 | using rank_type = typename extents_type::rank_type; | 320 | using rank_type = extents_type::rank_type; |
| 324 | using data_handle_type = typename accessor_type::data_handle_type; | 321 | using data_handle_type = accessor_type::data_handle_type; |
| 325 | using reference = typename accessor_type::reference; | 322 | using reference = accessor_type::reference; |
| 326 | 323 | ||
| 327 | static constexpr rank_type rank() noexcept { return extents_type::rank(); } | 324 | static constexpr rank_type rank() noexcept { return extents_type::rank(); } |
| 328 | static constexpr rank_type rank_dynamic() noexcept { return extents_type::rank_dynamic(); } | 325 | static constexpr rank_type rank_dynamic() noexcept { return extents_type::rank_dynamic(); } |
| ... | @@ -364,8 +361,15 @@ namespace std { | ... | @@ -364,8 +361,15 @@ namespace std { |
| 364 | template<class OtherIndexType> | 361 | template<class OtherIndexType> |
| 365 | constexpr reference operator[](const array<OtherIndexType, rank()>& indices) const; | 362 | constexpr reference operator[](const array<OtherIndexType, rank()>& indices) const; |
| 366 | 363 | ||
| 364 | template<class... OtherIndexTypes> | ||
| 365 | constexpr reference at(OtherIndexTypes... indices) const; | ||
| 366 | template<class OtherIndexType> | ||
| 367 | constexpr reference at(span<OtherIndexType, rank()> indices) const; | ||
| 368 | template<class OtherIndexType> | ||
| 369 | constexpr reference at(const array<OtherIndexType, rank()>& indices) const; | ||
| 370 | |||
| 367 | constexpr size_type size() const noexcept; | 371 | constexpr size_type size() const noexcept; |
| 368 | [[nodiscard]] constexpr bool empty() const noexcept; | 372 | constexpr bool empty() const noexcept; |
| 369 | 373 | ||
| 370 | friend constexpr void swap(mdspan& x, mdspan& y) noexcept; | 374 | friend constexpr void swap(mdspan& x, mdspan& y) noexcept; |
| 371 | 375 | ||
| ... | @@ -398,23 +402,19 @@ namespace std { | ... | @@ -398,23 +402,19 @@ namespace std { |
| 398 | }; | 402 | }; |
| 399 | 403 | ||
| 400 | template<class CArray> | 404 | template<class CArray> |
| 401 | requires(is_array_v<CArray> && rank_v<CArray> == 1) | 405 | requires (is_array_v<CArray> && rank_v<CArray> == 1) |
| 402 | mdspan(CArray&) | 406 | mdspan(CArray&) |
| 403 | -> mdspan<remove_all_extents_t<CArray>, extents<size_t, extent_v<CArray, 0>>>; | 407 | -> mdspan<remove_all_extents_t<CArray>, extents<size_t, extent_v<CArray, 0>>>; |
| 404 | 408 | ||
| 405 | template<class Pointer> | 409 | template<class Pointer> |
| 406 | requires(is_pointer_v<remove_reference_t<Pointer>>) | 410 | requires (is_pointer_v<remove_reference_t<Pointer>>) |
| 407 | mdspan(Pointer&&) | 411 | mdspan(Pointer&&) |
| 408 | -> mdspan<remove_pointer_t<remove_reference_t<Pointer>>, extents<size_t>>; | 412 | -> mdspan<remove_pointer_t<remove_reference_t<Pointer>>, extents<size_t>>; |
| 409 | 413 | ||
| 410 | template<class ElementType, class... Integrals> | 414 | template<class ElementType, class... Integrals> |
| 411 | requires((is_convertible_v<Integrals, size_t> && ...) && sizeof...(Integrals) > 0) | 415 | requires((is_convertible_v<Integrals, size_t> && ...) && sizeof...(Integrals) > 0) |
| 412 | explicit mdspan(ElementType*, Integrals...) | 416 | explicit mdspan(ElementType*, Integrals...) |
| 413 | -> mdspan<ElementType, dextents<size_t, sizeof...(Integrals)>>; // until C++26 | 417 | -> mdspan<ElementType, extents<size_t, maybe-static-ext<Integrals>...>>; |
| 414 | template<class ElementType, class... Integrals> | ||
| 415 | requires((is_convertible_v<Integrals, size_t> && ...) && sizeof...(Integrals) > 0) | ||
| 416 | explicit mdspan(ElementType*, Integrals...) | ||
| 417 | -> mdspan<ElementType, extents<size_t, maybe-static-ext<Integrals>...>>; // since C++26 | ||
| 418 | 418 | ||
| 419 | template<class ElementType, class OtherIndexType, size_t N> | 419 | template<class ElementType, class OtherIndexType, size_t N> |
| 420 | mdspan(ElementType*, span<OtherIndexType, N>) | 420 | mdspan(ElementType*, span<OtherIndexType, N>) |
| ... | @@ -434,7 +434,7 @@ namespace std { | ... | @@ -434,7 +434,7 @@ namespace std { |
| 434 | typename MappingType::layout_type>; | 434 | typename MappingType::layout_type>; |
| 435 | 435 | ||
| 436 | template<class MappingType, class AccessorType> | 436 | template<class MappingType, class AccessorType> |
| 437 | mdspan(const typename AccessorType::data_handle_type&, const MappingType&, | 437 | mdspan(typename AccessorType::data_handle_type, const MappingType&, |
| 438 | const AccessorType&) | 438 | const AccessorType&) |
| 439 | -> mdspan<typename AccessorType::element_type, typename MappingType::extents_type, | 439 | -> mdspan<typename AccessorType::element_type, typename MappingType::extents_type, |
| 440 | typename MappingType::layout_type, AccessorType>; | 440 | typename MappingType::layout_type, AccessorType>; |
lib/libcxx/include/memory+1-1| ... | @@ -987,7 +987,7 @@ template<class Pointer = void, class Smart, class... Args> | ... | @@ -987,7 +987,7 @@ template<class Pointer = void, class Smart, class... Args> |
| 987 | # pragma GCC system_header | 987 | # pragma GCC system_header |
| 988 | # endif | 988 | # endif |
| 989 | 989 | ||
| 990 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 990 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 991 | # include <atomic> | 991 | # include <atomic> |
| 992 | # include <concepts> | 992 | # include <concepts> |
| 993 | # include <cstddef> | 993 | # include <cstddef> |
lib/libcxx/include/memory_resource+2-2| ... | @@ -69,11 +69,11 @@ namespace std::pmr { | ... | @@ -69,11 +69,11 @@ namespace std::pmr { |
| 69 | # pragma GCC system_header | 69 | # pragma GCC system_header |
| 70 | # endif | 70 | # endif |
| 71 | 71 | ||
| 72 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER >= 17 && _LIBCPP_STD_VER <= 20 | 72 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER >= 17 && _LIBCPP_STD_VER <= 20 |
| 73 | # include <mutex> | 73 | # include <mutex> |
| 74 | # endif | 74 | # endif |
| 75 | 75 | ||
| 76 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 76 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 77 | # include <stdexcept> | 77 | # include <stdexcept> |
| 78 | # endif | 78 | # endif |
| 79 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 79 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/mutex+20-11| ... | @@ -214,10 +214,11 @@ template<class Callable, class ...Args> | ... | @@ -214,10 +214,11 @@ template<class Callable, class ...Args> |
| 214 | _LIBCPP_PUSH_MACROS | 214 | _LIBCPP_PUSH_MACROS |
| 215 | # include <__undef_macros> | 215 | # include <__undef_macros> |
| 216 | 216 | ||
| 217 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 218 | |||
| 219 | # if _LIBCPP_HAS_THREADS | 217 | # if _LIBCPP_HAS_THREADS |
| 220 | 218 | ||
| 219 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 220 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 221 | |||
| 221 | class _LIBCPP_EXPORTED_FROM_ABI recursive_mutex { | 222 | class _LIBCPP_EXPORTED_FROM_ABI recursive_mutex { |
| 222 | __libcpp_recursive_mutex_t __m_; | 223 | __libcpp_recursive_mutex_t __m_; |
| 223 | 224 | ||
| ... | @@ -457,7 +458,7 @@ public: | ... | @@ -457,7 +458,7 @@ public: |
| 457 | __m_.lock(); | 458 | __m_.lock(); |
| 458 | } | 459 | } |
| 459 | 460 | ||
| 460 | _LIBCPP_RELEASE_CAPABILITY _LIBCPP_HIDE_FROM_ABI ~scoped_lock() { __m_.unlock(); } | 461 | _LIBCPP_RELEASE_CAPABILITY() _LIBCPP_HIDE_FROM_ABI ~scoped_lock() { __m_.unlock(); } |
| 461 | 462 | ||
| 462 | [[nodiscard]] | 463 | [[nodiscard]] |
| 463 | _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(adopt_lock_t, mutex_type& __m) _LIBCPP_REQUIRES_CAPABILITY(__m) | 464 | _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(adopt_lock_t, mutex_type& __m) _LIBCPP_REQUIRES_CAPABILITY(__m) |
| ... | @@ -468,25 +469,31 @@ public: | ... | @@ -468,25 +469,31 @@ public: |
| 468 | }; | 469 | }; |
| 469 | 470 | ||
| 470 | template <class... _MArgs> | 471 | template <class... _MArgs> |
| 471 | class scoped_lock { | 472 | class _LIBCPP_SCOPED_LOCKABLE scoped_lock { |
| 472 | static_assert(sizeof...(_MArgs) > 1, "At least 2 lock types required"); | 473 | static_assert(sizeof...(_MArgs) > 1, "At least 2 lock types required"); |
| 473 | typedef tuple<_MArgs&...> _MutexTuple; | 474 | typedef tuple<_MArgs&...> _MutexTuple; |
| 474 | 475 | ||
| 475 | public: | 476 | public: |
| 476 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(_MArgs&... __margs) : __t_(__margs...) { | 477 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(_MArgs&... __margs) _LIBCPP_ACQUIRE_CAPABILITY(__margs...) |
| 478 | : __t_(__margs...) { | ||
| 477 | std::lock(__margs...); | 479 | std::lock(__margs...); |
| 478 | } | 480 | } |
| 479 | 481 | ||
| 480 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI scoped_lock(adopt_lock_t, _MArgs&... __margs) : __t_(__margs...) {} | 482 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI scoped_lock(adopt_lock_t, _MArgs&... __margs) |
| 483 | _LIBCPP_REQUIRES_CAPABILITY(__margs...) | ||
| 484 | : __t_(__margs...) {} | ||
| 481 | 485 | ||
| 482 | _LIBCPP_HIDE_FROM_ABI ~scoped_lock() { __unlock_unpack(make_index_sequence<sizeof...(_MArgs)>(), __t_); } | 486 | _LIBCPP_RELEASE_CAPABILITY() _LIBCPP_HIDE_FROM_ABI ~scoped_lock() { |
| 487 | __unlock_unpack(make_index_sequence<sizeof...(_MArgs)>(), __t_); | ||
| 488 | } | ||
| 483 | 489 | ||
| 484 | scoped_lock(scoped_lock const&) = delete; | 490 | scoped_lock(scoped_lock const&) = delete; |
| 485 | scoped_lock& operator=(scoped_lock const&) = delete; | 491 | scoped_lock& operator=(scoped_lock const&) = delete; |
| 486 | 492 | ||
| 487 | private: | 493 | private: |
| 488 | template <size_t... _Indx> | 494 | template <size_t... _Indx> |
| 489 | _LIBCPP_HIDE_FROM_ABI static void __unlock_unpack(index_sequence<_Indx...>, _MutexTuple& __mt) { | 495 | _LIBCPP_HIDE_FROM_ABI static void __unlock_unpack(index_sequence<_Indx...>, _MutexTuple& __mt) |
| 496 | _LIBCPP_RELEASE_CAPABILITY(std::get<_Indx>(__mt)...) { | ||
| 490 | (std::get<_Indx>(__mt).unlock(), ...); | 497 | (std::get<_Indx>(__mt).unlock(), ...); |
| 491 | } | 498 | } |
| 492 | 499 | ||
| ... | @@ -495,17 +502,19 @@ private: | ... | @@ -495,17 +502,19 @@ private: |
| 495 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(scoped_lock); | 502 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(scoped_lock); |
| 496 | 503 | ||
| 497 | # endif // _LIBCPP_STD_VER >= 17 | 504 | # endif // _LIBCPP_STD_VER >= 17 |
| 498 | # endif // _LIBCPP_HAS_THREADS | ||
| 499 | 505 | ||
| 506 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 500 | _LIBCPP_END_NAMESPACE_STD | 507 | _LIBCPP_END_NAMESPACE_STD |
| 501 | 508 | ||
| 509 | # endif // _LIBCPP_HAS_THREADS | ||
| 510 | |||
| 502 | _LIBCPP_POP_MACROS | 511 | _LIBCPP_POP_MACROS |
| 503 | 512 | ||
| 504 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23 | 513 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 505 | # include <typeinfo> | 514 | # include <typeinfo> |
| 506 | # endif | 515 | # endif |
| 507 | 516 | ||
| 508 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 517 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 509 | # include <atomic> | 518 | # include <atomic> |
| 510 | # include <concepts> | 519 | # include <concepts> |
| 511 | # include <cstdlib> | 520 | # include <cstdlib> |
lib/libcxx/include/new+3-3| ... | @@ -81,8 +81,8 @@ void operator delete[](void* ptr, std::align_val_t alignment, | ... | @@ -81,8 +81,8 @@ void operator delete[](void* ptr, std::align_val_t alignment, |
| 81 | 81 | ||
| 82 | void* operator new (std::size_t size, void* ptr) noexcept; // nodiscard in C++20, constexpr since C++26 | 82 | void* operator new (std::size_t size, void* ptr) noexcept; // nodiscard in C++20, constexpr since C++26 |
| 83 | void* operator new[](std::size_t size, void* ptr) noexcept; // nodiscard in C++20, constexpr since C++26 | 83 | void* operator new[](std::size_t size, void* ptr) noexcept; // nodiscard in C++20, constexpr since C++26 |
| 84 | void operator delete (void* ptr, void*) noexcept; | 84 | void operator delete (void* ptr, void*) noexcept; // constexpr since C++26 |
| 85 | void operator delete[](void* ptr, void*) noexcept; | 85 | void operator delete[](void* ptr, void*) noexcept; // constexpr since C++26 |
| 86 | 86 | ||
| 87 | */ | 87 | */ |
| 88 | 88 | ||
| ... | @@ -114,7 +114,7 @@ void operator delete[](void* ptr, void*) noexcept; | ... | @@ -114,7 +114,7 @@ void operator delete[](void* ptr, void*) noexcept; |
| 114 | # pragma GCC system_header | 114 | # pragma GCC system_header |
| 115 | # endif | 115 | # endif |
| 116 | 116 | ||
| 117 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 117 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 118 | # include <cstddef> | 118 | # include <cstddef> |
| 119 | # include <cstdlib> | 119 | # include <cstdlib> |
| 120 | # include <type_traits> | 120 | # include <type_traits> |
lib/libcxx/include/numbers+1-1| ... | @@ -159,7 +159,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -159,7 +159,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 159 | 159 | ||
| 160 | # endif // _LIBCPP_STD_VER >= 20 | 160 | # endif // _LIBCPP_STD_VER >= 20 |
| 161 | 161 | ||
| 162 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 162 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 163 | # include <concepts> | 163 | # include <concepts> |
| 164 | # include <cstddef> | 164 | # include <cstddef> |
| 165 | # include <type_traits> | 165 | # include <type_traits> |
lib/libcxx/include/numeric+7-7| ... | @@ -142,15 +142,15 @@ template<class T> | ... | @@ -142,15 +142,15 @@ template<class T> |
| 142 | 142 | ||
| 143 | // [numeric.sat], saturation arithmetic | 143 | // [numeric.sat], saturation arithmetic |
| 144 | template<class T> | 144 | template<class T> |
| 145 | constexpr T add_sat(T x, T y) noexcept; // freestanding, Since C++26 | 145 | constexpr T saturating_add(T x, T y) noexcept; // freestanding, Since C++26 |
| 146 | template<class T> | 146 | template<class T> |
| 147 | constexpr T sub_sat(T x, T y) noexcept; // freestanding, Since C++26 | 147 | constexpr T saturating_sub(T x, T y) noexcept; // freestanding, Since C++26 |
| 148 | template<class T> | 148 | template<class T> |
| 149 | constexpr T mul_sat(T x, T y) noexcept; // freestanding, Since C++26 | 149 | constexpr T saturating_mul(T x, T y) noexcept; // freestanding, Since C++26 |
| 150 | template<class T> | 150 | template<class T> |
| 151 | constexpr T div_sat(T x, T y) noexcept; // freestanding, Since C++26 | 151 | constexpr T saturating_div(T x, T y) noexcept; // freestanding, Since C++26 |
| 152 | template<class T, class U> | 152 | template<class T, class U> |
| 153 | constexpr T saturate_cast(U x) noexcept; // freestanding, Since C++26 | 153 | constexpr T saturating_cast(U x) noexcept; // freestanding, Since C++26 |
| 154 | 154 | ||
| 155 | } // std | 155 | } // std |
| 156 | 156 | ||
| ... | @@ -190,12 +190,12 @@ constexpr T saturate_cast(U x) noexcept; // freestanding, Sin | ... | @@ -190,12 +190,12 @@ constexpr T saturate_cast(U x) noexcept; // freestanding, Sin |
| 190 | # pragma GCC system_header | 190 | # pragma GCC system_header |
| 191 | # endif | 191 | # endif |
| 192 | 192 | ||
| 193 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14 | 193 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 14 |
| 194 | # include <initializer_list> | 194 | # include <initializer_list> |
| 195 | # include <limits> | 195 | # include <limits> |
| 196 | # endif | 196 | # endif |
| 197 | 197 | ||
| 198 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 198 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 199 | # include <climits> | 199 | # include <climits> |
| 200 | # include <cmath> | 200 | # include <cmath> |
| 201 | # include <concepts> | 201 | # include <concepts> |
lib/libcxx/include/optional+341-383| ... | @@ -264,15 +264,14 @@ namespace std { | ... | @@ -264,15 +264,14 @@ namespace std { |
| 264 | # include <__compare/three_way_comparable.h> | 264 | # include <__compare/three_way_comparable.h> |
| 265 | # include <__concepts/invocable.h> | 265 | # include <__concepts/invocable.h> |
| 266 | # include <__config> | 266 | # include <__config> |
| 267 | # include <__cstddef/ptrdiff_t.h> | ||
| 268 | # include <__exception/exception.h> | 267 | # include <__exception/exception.h> |
| 269 | # include <__format/range_format.h> | ||
| 270 | # include <__functional/hash.h> | 268 | # include <__functional/hash.h> |
| 271 | # include <__functional/invoke.h> | 269 | # include <__functional/invoke.h> |
| 272 | # include <__functional/unary_function.h> | 270 | # include <__functional/unary_function.h> |
| 271 | # include <__fwd/format.h> | ||
| 273 | # include <__fwd/functional.h> | 272 | # include <__fwd/functional.h> |
| 274 | # include <__iterator/bounded_iter.h> | 273 | # include <__iterator/bounded_iter.h> |
| 275 | # include <__iterator/wrap_iter.h> | 274 | # include <__iterator/capacity_aware_iterator.h> |
| 276 | # include <__memory/addressof.h> | 275 | # include <__memory/addressof.h> |
| 277 | # include <__memory/construct_at.h> | 276 | # include <__memory/construct_at.h> |
| 278 | # include <__ranges/enable_borrowed_range.h> | 277 | # include <__ranges/enable_borrowed_range.h> |
| ... | @@ -493,6 +492,61 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> { | ... | @@ -493,6 +492,61 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> { |
| 493 | } | 492 | } |
| 494 | } | 493 | } |
| 495 | } | 494 | } |
| 495 | |||
| 496 | // [optional.observe] | ||
| 497 | _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp const> operator->() const noexcept { | ||
| 498 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value"); | ||
| 499 | return std::addressof(this->__get()); | ||
| 500 | } | ||
| 501 | |||
| 502 | _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() noexcept { | ||
| 503 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value"); | ||
| 504 | return std::addressof(this->__get()); | ||
| 505 | } | ||
| 506 | |||
| 507 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept { | ||
| 508 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value"); | ||
| 509 | return this->__get(); | ||
| 510 | } | ||
| 511 | |||
| 512 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept { | ||
| 513 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value"); | ||
| 514 | return this->__get(); | ||
| 515 | } | ||
| 516 | |||
| 517 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept { | ||
| 518 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value"); | ||
| 519 | return std::move(this->__get()); | ||
| 520 | } | ||
| 521 | |||
| 522 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept { | ||
| 523 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value"); | ||
| 524 | return std::move(this->__get()); | ||
| 525 | } | ||
| 526 | |||
| 527 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& value() const& { | ||
| 528 | if (!this->has_value()) | ||
| 529 | std::__throw_bad_optional_access(); | ||
| 530 | return this->__get(); | ||
| 531 | } | ||
| 532 | |||
| 533 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() & { | ||
| 534 | if (!this->has_value()) | ||
| 535 | std::__throw_bad_optional_access(); | ||
| 536 | return this->__get(); | ||
| 537 | } | ||
| 538 | |||
| 539 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() && { | ||
| 540 | if (!this->has_value()) | ||
| 541 | std::__throw_bad_optional_access(); | ||
| 542 | return std::move(this->__get()); | ||
| 543 | } | ||
| 544 | |||
| 545 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const&& value() const&& { | ||
| 546 | if (!this->has_value()) | ||
| 547 | std::__throw_bad_optional_access(); | ||
| 548 | return std::move(this->__get()); | ||
| 549 | } | ||
| 496 | }; | 550 | }; |
| 497 | 551 | ||
| 498 | template <class _Tp> | 552 | template <class _Tp> |
| ... | @@ -504,7 +558,7 @@ struct __optional_storage_base<_Tp, true> { | ... | @@ -504,7 +558,7 @@ struct __optional_storage_base<_Tp, true> { |
| 504 | _LIBCPP_HIDE_FROM_ABI constexpr __optional_storage_base() noexcept : __value_(nullptr) {} | 558 | _LIBCPP_HIDE_FROM_ABI constexpr __optional_storage_base() noexcept : __value_(nullptr) {} |
| 505 | 559 | ||
| 506 | template <class _Up> | 560 | template <class _Up> |
| 507 | _LIBCPP_HIDE_FROM_ABI constexpr void __convert_init_ref_val(_Up&& __val) noexcept { | 561 | _LIBCPP_HIDE_FROM_ABI constexpr void __convert_init_ref_val(_Up&& __val) { |
| 508 | _Tp& __r(std::forward<_Up>(__val)); | 562 | _Tp& __r(std::forward<_Up>(__val)); |
| 509 | __value_ = std::addressof(__r); | 563 | __value_ = std::addressof(__r); |
| 510 | } | 564 | } |
| ... | @@ -517,6 +571,14 @@ struct __optional_storage_base<_Tp, true> { | ... | @@ -517,6 +571,14 @@ struct __optional_storage_base<_Tp, true> { |
| 517 | __convert_init_ref_val(std::forward<_UArg>(__uarg)); | 571 | __convert_init_ref_val(std::forward<_UArg>(__uarg)); |
| 518 | } | 572 | } |
| 519 | 573 | ||
| 574 | # if _LIBCPP_STD_VER >= 23 | ||
| 575 | template <class _Fp, class... _Args> | ||
| 576 | constexpr __optional_storage_base(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args) { | ||
| 577 | __convert_init_ref_val(std::forward<invoke_result_t<_Fp, _Args...>>( | ||
| 578 | std::invoke(std::forward<_Fp>(__f), std::forward<_Args>(__args)...))); | ||
| 579 | } | ||
| 580 | # endif | ||
| 581 | |||
| 520 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; } | 582 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; } |
| 521 | 583 | ||
| 522 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __value_ != nullptr; } | 584 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __value_ != nullptr; } |
| ... | @@ -525,7 +587,6 @@ struct __optional_storage_base<_Tp, true> { | ... | @@ -525,7 +587,6 @@ struct __optional_storage_base<_Tp, true> { |
| 525 | 587 | ||
| 526 | template <class _UArg> | 588 | template <class _UArg> |
| 527 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val) { | 589 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val) { |
| 528 | _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage"); | ||
| 529 | static_assert(!__reference_constructs_from_temporary_v<_Tp, _UArg>, | 590 | static_assert(!__reference_constructs_from_temporary_v<_Tp, _UArg>, |
| 530 | "Attempted to construct a reference element in tuple from a " | 591 | "Attempted to construct a reference element in tuple from a " |
| 531 | "possible temporary"); | 592 | "possible temporary"); |
| ... | @@ -554,9 +615,26 @@ struct __optional_storage_base<_Tp, true> { | ... | @@ -554,9 +615,26 @@ struct __optional_storage_base<_Tp, true> { |
| 554 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __swap(__optional_storage_base& __rhs) noexcept { | 615 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __swap(__optional_storage_base& __rhs) noexcept { |
| 555 | std::swap(__value_, __rhs.__value_); | 616 | std::swap(__value_, __rhs.__value_); |
| 556 | } | 617 | } |
| 618 | |||
| 619 | // [optional.ref.observe] | ||
| 620 | _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() const noexcept { | ||
| 621 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value"); | ||
| 622 | return std::addressof(this->__get()); | ||
| 623 | } | ||
| 624 | |||
| 625 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() const noexcept { | ||
| 626 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value"); | ||
| 627 | return this->__get(); | ||
| 628 | } | ||
| 629 | |||
| 630 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() const { | ||
| 631 | if (!this->has_value()) | ||
| 632 | std::__throw_bad_optional_access(); | ||
| 633 | return this->__get(); | ||
| 634 | } | ||
| 557 | }; | 635 | }; |
| 558 | 636 | ||
| 559 | template <class _Tp, bool = is_trivially_copy_constructible_v<_Tp> || is_lvalue_reference_v<_Tp>> | 637 | template <class _Tp, bool = is_trivially_copy_constructible_v<_Tp>> |
| 560 | struct __optional_copy_base : __optional_storage_base<_Tp> { | 638 | struct __optional_copy_base : __optional_storage_base<_Tp> { |
| 561 | using __optional_storage_base<_Tp>::__optional_storage_base; | 639 | using __optional_storage_base<_Tp>::__optional_storage_base; |
| 562 | }; | 640 | }; |
| ... | @@ -576,7 +654,7 @@ struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> { | ... | @@ -576,7 +654,7 @@ struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> { |
| 576 | _LIBCPP_HIDE_FROM_ABI __optional_copy_base& operator=(__optional_copy_base&&) = default; | 654 | _LIBCPP_HIDE_FROM_ABI __optional_copy_base& operator=(__optional_copy_base&&) = default; |
| 577 | }; | 655 | }; |
| 578 | 656 | ||
| 579 | template <class _Tp, bool = is_trivially_move_constructible_v<_Tp> || is_lvalue_reference_v<_Tp>> | 657 | template <class _Tp, bool = is_trivially_move_constructible_v<_Tp>> |
| 580 | struct __optional_move_base : __optional_copy_base<_Tp> { | 658 | struct __optional_move_base : __optional_copy_base<_Tp> { |
| 581 | using __optional_copy_base<_Tp>::__optional_copy_base; | 659 | using __optional_copy_base<_Tp>::__optional_copy_base; |
| 582 | }; | 660 | }; |
| ... | @@ -600,8 +678,7 @@ struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp> { | ... | @@ -600,8 +678,7 @@ struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp> { |
| 600 | 678 | ||
| 601 | template <class _Tp, | 679 | template <class _Tp, |
| 602 | bool = (is_trivially_destructible_v<_Tp> && is_trivially_copy_constructible_v<_Tp> && | 680 | bool = (is_trivially_destructible_v<_Tp> && is_trivially_copy_constructible_v<_Tp> && |
| 603 | is_trivially_copy_assignable_v<_Tp>) || | 681 | is_trivially_copy_assignable_v<_Tp>)> |
| 604 | is_lvalue_reference_v<_Tp>> | ||
| 605 | struct __optional_copy_assign_base : __optional_move_base<_Tp> { | 682 | struct __optional_copy_assign_base : __optional_move_base<_Tp> { |
| 606 | using __optional_move_base<_Tp>::__optional_move_base; | 683 | using __optional_move_base<_Tp>::__optional_move_base; |
| 607 | }; | 684 | }; |
| ... | @@ -625,8 +702,7 @@ struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp> { | ... | @@ -625,8 +702,7 @@ struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp> { |
| 625 | 702 | ||
| 626 | template <class _Tp, | 703 | template <class _Tp, |
| 627 | bool = (is_trivially_destructible_v<_Tp> && is_trivially_move_constructible_v<_Tp> && | 704 | bool = (is_trivially_destructible_v<_Tp> && is_trivially_move_constructible_v<_Tp> && |
| 628 | is_trivially_move_assignable_v<_Tp>) || | 705 | is_trivially_move_assignable_v<_Tp>)> |
| 629 | is_lvalue_reference_v<_Tp>> | ||
| 630 | struct __optional_move_assign_base : __optional_copy_assign_base<_Tp> { | 706 | struct __optional_move_assign_base : __optional_copy_assign_base<_Tp> { |
| 631 | using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base; | 707 | using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base; |
| 632 | }; | 708 | }; |
| ... | @@ -655,8 +731,8 @@ using __optional_sfinae_ctor_base_t _LIBCPP_NODEBUG = | ... | @@ -655,8 +731,8 @@ using __optional_sfinae_ctor_base_t _LIBCPP_NODEBUG = |
| 655 | 731 | ||
| 656 | template <class _Tp> | 732 | template <class _Tp> |
| 657 | using __optional_sfinae_assign_base_t _LIBCPP_NODEBUG = | 733 | using __optional_sfinae_assign_base_t _LIBCPP_NODEBUG = |
| 658 | __sfinae_assign_base< (is_copy_constructible_v<_Tp> && is_copy_assignable_v<_Tp>) || is_lvalue_reference_v<_Tp>, | 734 | __sfinae_assign_base< (is_copy_constructible_v<_Tp> && is_copy_assignable_v<_Tp>), |
| 659 | (is_move_constructible_v<_Tp> && is_move_assignable_v<_Tp>) || is_lvalue_reference_v<_Tp>>; | 735 | (is_move_constructible_v<_Tp> && is_move_assignable_v<_Tp>)>; |
| 660 | 736 | ||
| 661 | template <class _Tp> | 737 | template <class _Tp> |
| 662 | class optional; | 738 | class optional; |
| ... | @@ -685,126 +761,115 @@ struct __is_std_optional : false_type {}; | ... | @@ -685,126 +761,115 @@ struct __is_std_optional : false_type {}; |
| 685 | template <class _Tp> | 761 | template <class _Tp> |
| 686 | struct __is_std_optional<optional<_Tp>> : true_type {}; | 762 | struct __is_std_optional<optional<_Tp>> : true_type {}; |
| 687 | 763 | ||
| 688 | template <class _Tp, class... _Args> | 764 | # if _LIBCPP_STD_VER < 26 |
| 689 | inline constexpr bool __is_constructible_for_optional_v = is_constructible_v<_Tp, _Args...>; | 765 | template <class _Tp> |
| 690 | 766 | inline constexpr bool __is_valid_optional_contained_type = is_object_v<_Tp>; | |
| 691 | template <class _Tp, class... _Args> | 767 | # else |
| 692 | struct __is_constructible_for_optional : bool_constant<__is_constructible_for_optional_v<_Tp, _Args...>> {}; | 768 | template <class _Tp> |
| 769 | inline constexpr bool __is_valid_optional_contained_type = is_object_v<_Tp> || is_lvalue_reference_v<_Tp>; | ||
| 770 | # endif | ||
| 693 | 771 | ||
| 694 | template <class _Tp, class _Up, class... _Args> | 772 | template <class _Tp> |
| 695 | inline constexpr bool __is_constructible_for_optional_initializer_list_v = | 773 | struct __optional_iterator_base : __optional_move_assign_base<_Tp> { |
| 696 | is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>; | 774 | using __optional_move_assign_base<_Tp>::__optional_move_assign_base; |
| 775 | }; | ||
| 697 | 776 | ||
| 698 | # if _LIBCPP_STD_VER >= 26 | 777 | # if _LIBCPP_STD_VER >= 26 |
| 699 | template <class _Tp, class... _Args> | 778 | template <class _Tp> |
| 700 | inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Args...> = false; | 779 | struct __optional_iterator_base<_Tp&> : __optional_storage_base<_Tp&> { |
| 701 | template <class _Tp, class _Arg> | 780 | using __optional_storage_base<_Tp&>::__optional_storage_base; |
| 702 | inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Arg> = | 781 | }; |
| 703 | is_constructible_v<_Tp&, _Arg> && !reference_constructs_from_temporary_v<_Tp&, _Arg>; | ||
| 704 | |||
| 705 | template <class _Tp, class _Up, class... _Args> | ||
| 706 | inline constexpr bool __is_constructible_for_optional_initializer_list_v<_Tp&, _Up, _Args...> = false; | ||
| 707 | # endif | ||
| 708 | 782 | ||
| 709 | template <class _Tp, class = void> | 783 | # if _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR |
| 710 | struct __optional_iterator {}; | ||
| 711 | |||
| 712 | # if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR | ||
| 713 | 784 | ||
| 714 | template <class _Tp> | 785 | template <class _Tp> |
| 715 | struct __optional_iterator<_Tp, enable_if_t<is_object_v<_Tp>>> { | 786 | requires is_object_v<_Tp> |
| 787 | struct __optional_iterator_base<_Tp> : __optional_move_assign_base<_Tp> { | ||
| 716 | private: | 788 | private: |
| 717 | using __pointer _LIBCPP_NODEBUG = add_pointer_t<_Tp>; | 789 | using __pointer _LIBCPP_NODEBUG = add_pointer_t<_Tp>; |
| 718 | using __const_pointer _LIBCPP_NODEBUG = add_pointer_t<const _Tp>; | 790 | using __const_pointer _LIBCPP_NODEBUG = add_pointer_t<const _Tp>; |
| 719 | 791 | ||
| 720 | public: | 792 | public: |
| 721 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL | 793 | using __optional_move_assign_base<_Tp>::__optional_move_assign_base; |
| 722 | using iterator = __bounded_iter<__wrap_iter<__pointer>>; | 794 | |
| 723 | using const_iterator = __bounded_iter<__wrap_iter<__const_pointer>>; | 795 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL |
| 724 | # else | 796 | using iterator = __bounded_iter<__pointer>; |
| 725 | using iterator = __wrap_iter<__pointer>; | 797 | using const_iterator = __bounded_iter<__const_pointer>; |
| 726 | using const_iterator = __wrap_iter<__const_pointer>; | 798 | # else |
| 727 | # endif | 799 | using iterator = __capacity_aware_iterator<__pointer, optional<_Tp>, 1>; |
| 800 | using const_iterator = __capacity_aware_iterator<__const_pointer, optional<_Tp>, 1>; | ||
| 801 | # endif | ||
| 728 | 802 | ||
| 729 | // [optional.iterators], iterator support | 803 | // [optional.iterators], iterator support |
| 730 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() noexcept { | 804 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() noexcept { |
| 731 | auto& __derived_self = static_cast<optional<_Tp>&>(*this); | 805 | auto* __ptr = std::addressof(this->__get()); |
| 732 | auto* __ptr = std::addressof(__derived_self.__get()); | ||
| 733 | 806 | ||
| 734 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL | 807 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL |
| 735 | return std::__make_bounded_iter( | 808 | return std::__make_bounded_iter(__ptr, __ptr, __ptr + (this->has_value() ? 1 : 0)); |
| 736 | __wrap_iter<__pointer>(__ptr), | 809 | # else |
| 737 | __wrap_iter<__pointer>(__ptr), | 810 | return std::__make_capacity_aware_iterator<__pointer, optional<_Tp>, 1>(__ptr); |
| 738 | __wrap_iter<__pointer>(__ptr) + (__derived_self.has_value() ? 1 : 0)); | 811 | # endif |
| 739 | # else | ||
| 740 | return iterator(__ptr); | ||
| 741 | # endif | ||
| 742 | } | 812 | } |
| 743 | 813 | ||
| 744 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_iterator begin() const noexcept { | 814 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_iterator begin() const noexcept { |
| 745 | auto& __derived_self = static_cast<const optional<_Tp>&>(*this); | 815 | auto* __ptr = std::addressof(this->__get()); |
| 746 | auto* __ptr = std::addressof(__derived_self.__get()); | ||
| 747 | 816 | ||
| 748 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL | 817 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL |
| 749 | return std::__make_bounded_iter( | 818 | return std::__make_bounded_iter(__ptr, __ptr, __ptr + (this->has_value() ? 1 : 0)); |
| 750 | __wrap_iter<__const_pointer>(__ptr), | 819 | # else |
| 751 | __wrap_iter<__const_pointer>(__ptr), | 820 | return std::__make_capacity_aware_iterator<__const_pointer, optional<_Tp>, 1>(__ptr); |
| 752 | __wrap_iter<__const_pointer>(__ptr) + (__derived_self.has_value() ? 1 : 0)); | 821 | # endif |
| 753 | # else | ||
| 754 | return const_iterator(__ptr); | ||
| 755 | # endif | ||
| 756 | } | 822 | } |
| 757 | 823 | ||
| 758 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator end() noexcept { | 824 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator end() noexcept { |
| 759 | return begin() + (static_cast<optional<_Tp>&>(*this).has_value() ? 1 : 0); | 825 | return begin() + (this->has_value() ? 1 : 0); |
| 760 | } | 826 | } |
| 761 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept { | 827 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept { |
| 762 | return begin() + (static_cast<const optional<_Tp>&>(*this).has_value() ? 1 : 0); | 828 | return begin() + (this->has_value() ? 1 : 0); |
| 763 | } | 829 | } |
| 764 | }; | 830 | }; |
| 765 | 831 | ||
| 766 | template <class _Tp> | 832 | template <class _Tp> |
| 767 | struct __optional_iterator<_Tp&, enable_if_t<is_object_v<_Tp> && !__is_unbounded_array_v<_Tp> >> { | 833 | requires(is_object_v<_Tp> && !__is_unbounded_array_v<_Tp>) |
| 834 | struct __optional_iterator_base<_Tp&> : __optional_storage_base<_Tp&> { | ||
| 768 | private: | 835 | private: |
| 769 | using __pointer _LIBCPP_NODEBUG = add_pointer_t<_Tp>; | 836 | using __pointer _LIBCPP_NODEBUG = add_pointer_t<_Tp>; |
| 770 | 837 | ||
| 771 | public: | 838 | public: |
| 772 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL | 839 | using __optional_storage_base<_Tp&>::__optional_storage_base; |
| 773 | using iterator = __bounded_iter<__wrap_iter<__pointer>>; | 840 | |
| 774 | # else | 841 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL |
| 775 | using iterator = __wrap_iter<__pointer>; | 842 | using iterator = __bounded_iter<__pointer>; |
| 776 | # endif | 843 | # else |
| 844 | using iterator = __capacity_aware_iterator<__pointer, optional<_Tp&>, 1>; | ||
| 845 | # endif | ||
| 777 | 846 | ||
| 778 | // [optional.ref.iterators], iterator support | 847 | // [optional.ref.iterators], iterator support |
| 779 | 848 | ||
| 780 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const noexcept { | 849 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const noexcept { |
| 781 | auto& __derived_self = static_cast<const optional<_Tp&>&>(*this); | 850 | auto* __ptr = this->has_value() ? std::addressof(this->__get()) : nullptr; |
| 782 | auto* __ptr = __derived_self.has_value() ? std::addressof(__derived_self.__get()) : nullptr; | ||
| 783 | 851 | ||
| 784 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL | 852 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL |
| 785 | return std::__make_bounded_iter( | 853 | return std::__make_bounded_iter(__ptr, __ptr, __ptr + (this->has_value() ? 1 : 0)); |
| 786 | __wrap_iter<__pointer>(__ptr), | 854 | # else |
| 787 | __wrap_iter<__pointer>(__ptr), | 855 | return std::__make_capacity_aware_iterator<__pointer, optional<_Tp&>, 1>(__ptr); |
| 788 | __wrap_iter<__pointer>(__ptr) + (__derived_self.has_value() ? 1 : 0)); | 856 | # endif |
| 789 | # else | ||
| 790 | return iterator(__ptr); | ||
| 791 | # endif | ||
| 792 | } | 857 | } |
| 793 | 858 | ||
| 794 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const noexcept { | 859 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const noexcept { |
| 795 | return begin() + (static_cast<const optional<_Tp&>&>(*this).has_value() ? 1 : 0); | 860 | return begin() + (this->has_value() ? 1 : 0); |
| 796 | } | 861 | } |
| 797 | }; | 862 | }; |
| 798 | 863 | ||
| 799 | # endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR | 864 | # endif // _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR |
| 865 | # endif // _LIBCPP_STD_VER >= 26 | ||
| 800 | 866 | ||
| 801 | template <class _Tp> | 867 | template <class _Tp> |
| 802 | class _LIBCPP_DECLSPEC_EMPTY_BASES optional | 868 | class _LIBCPP_DECLSPEC_EMPTY_BASES optional |
| 803 | : private __optional_move_assign_base<_Tp>, | 869 | : public __optional_iterator_base<_Tp>, |
| 804 | private __optional_sfinae_ctor_base_t<_Tp>, | 870 | private __optional_sfinae_ctor_base_t<_Tp>, |
| 805 | private __optional_sfinae_assign_base_t<_Tp>, | 871 | private __optional_sfinae_assign_base_t<_Tp> { |
| 806 | public __optional_iterator<_Tp> { | 872 | using __base _LIBCPP_NODEBUG = __optional_iterator_base<_Tp>; |
| 807 | using __base _LIBCPP_NODEBUG = __optional_move_assign_base<_Tp>; | ||
| 808 | 873 | ||
| 809 | public: | 874 | public: |
| 810 | using value_type = __libcpp_remove_reference_t<_Tp>; | 875 | using value_type = __libcpp_remove_reference_t<_Tp>; |
| ... | @@ -813,9 +878,8 @@ public: | ... | @@ -813,9 +878,8 @@ public: |
| 813 | conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value, optional, void>; | 878 | conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value, optional, void>; |
| 814 | 879 | ||
| 815 | private: | 880 | private: |
| 816 | static_assert(!is_same_v<__remove_cvref_t<_Tp>, in_place_t>, | 881 | static_assert(!is_same_v<remove_cv_t<_Tp>, in_place_t>, "instantiation of optional with in_place_t is ill-formed"); |
| 817 | "instantiation of optional with in_place_t is ill-formed"); | 882 | static_assert(!is_same_v<remove_cv_t<_Tp>, nullopt_t>, "instantiation of optional with nullopt_t is ill-formed"); |
| 818 | static_assert(!is_same_v<__remove_cvref_t<_Tp>, nullopt_t>, "instantiation of optional with nullopt_t is ill-formed"); | ||
| 819 | # if _LIBCPP_STD_VER >= 26 | 883 | # if _LIBCPP_STD_VER >= 26 |
| 820 | static_assert(!is_rvalue_reference_v<_Tp>, "instantiation of optional with an rvalue reference type is ill-formed"); | 884 | static_assert(!is_rvalue_reference_v<_Tp>, "instantiation of optional with an rvalue reference type is ill-formed"); |
| 821 | # else | 885 | # else |
| ... | @@ -824,16 +888,6 @@ private: | ... | @@ -824,16 +888,6 @@ private: |
| 824 | static_assert(is_destructible_v<_Tp>, "instantiation of optional with a non-destructible type is ill-formed"); | 888 | static_assert(is_destructible_v<_Tp>, "instantiation of optional with a non-destructible type is ill-formed"); |
| 825 | static_assert(!is_array_v<_Tp>, "instantiation of optional with an array type is ill-formed"); | 889 | static_assert(!is_array_v<_Tp>, "instantiation of optional with an array type is ill-formed"); |
| 826 | 890 | ||
| 827 | # if _LIBCPP_STD_VER >= 26 | ||
| 828 | template <class _Up> | ||
| 829 | constexpr static bool __libcpp_opt_ref_ctor_deleted = | ||
| 830 | is_lvalue_reference_v<_Tp> && reference_constructs_from_temporary_v<_Tp, _Up>; | ||
| 831 | |||
| 832 | template <class _Up> | ||
| 833 | constexpr static bool __ref_ctor_enabled = | ||
| 834 | is_lvalue_reference_v<_Tp> && !reference_constructs_from_temporary_v<_Tp, _Up>; | ||
| 835 | # endif | ||
| 836 | |||
| 837 | // LWG2756: conditionally explicit conversion from _Up | 891 | // LWG2756: conditionally explicit conversion from _Up |
| 838 | struct _CheckOptionalArgsConstructor { | 892 | struct _CheckOptionalArgsConstructor { |
| 839 | template <class _Up> | 893 | template <class _Up> |
| ... | @@ -905,131 +959,48 @@ public: | ... | @@ -905,131 +959,48 @@ public: |
| 905 | _LIBCPP_HIDE_FROM_ABI constexpr optional(optional&&) = default; | 959 | _LIBCPP_HIDE_FROM_ABI constexpr optional(optional&&) = default; |
| 906 | _LIBCPP_HIDE_FROM_ABI constexpr optional(nullopt_t) noexcept {} | 960 | _LIBCPP_HIDE_FROM_ABI constexpr optional(nullopt_t) noexcept {} |
| 907 | 961 | ||
| 908 | template < | 962 | template <class _InPlaceT, |
| 909 | class _InPlaceT, | 963 | class... _Args, |
| 910 | class... _Args, | 964 | enable_if_t<_And<_IsSame<_InPlaceT, in_place_t>, is_constructible<_Tp, _Args...>>::value, int> = 0> |
| 911 | enable_if_t<_And<_IsSame<_InPlaceT, in_place_t>, __is_constructible_for_optional<_Tp, _Args...>>::value, int> = 0> | ||
| 912 | _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_InPlaceT, _Args&&... __args) | 965 | _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_InPlaceT, _Args&&... __args) |
| 913 | : __base(in_place, std::forward<_Args>(__args)...) {} | 966 | : __base(in_place, std::forward<_Args>(__args)...) {} |
| 914 | 967 | ||
| 915 | template <class _Up, | 968 | template <class _Up, class... _Args, enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0> |
| 916 | class... _Args, | ||
| 917 | enable_if_t<__is_constructible_for_optional_initializer_list_v<_Tp, _Up, _Args...>, int> = 0> | ||
| 918 | _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args) | 969 | _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args) |
| 919 | : __base(in_place, __il, std::forward<_Args>(__args)...) {} | 970 | : __base(in_place, __il, std::forward<_Args>(__args)...) {} |
| 920 | 971 | ||
| 921 | template <class _Up = _Tp, enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0> | 972 | template <class _Up = _Tp, enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0> |
| 922 | _LIBCPP_HIDE_FROM_ABI constexpr optional(_Up&& __v) | 973 | _LIBCPP_HIDE_FROM_ABI constexpr optional(_Up&& __v) noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened |
| 923 | # if _LIBCPP_STD_VER >= 26 | 974 | : __base(in_place, std::forward<_Up>(__v)) {} |
| 924 | noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>) | ||
| 925 | # endif | ||
| 926 | : __base(in_place, std::forward<_Up>(__v)) { | ||
| 927 | } | ||
| 928 | 975 | ||
| 929 | template <class _Up = remove_cv_t<_Tp>, | 976 | template <class _Up = remove_cv_t<_Tp>, |
| 930 | enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0> | 977 | enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0> |
| 931 | _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Up&& __v) | 978 | _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Up&& __v) noexcept( |
| 932 | # if _LIBCPP_STD_VER >= 26 | 979 | is_nothrow_constructible_v<_Tp, _Up>) // strengthened |
| 933 | noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>) | 980 | : __base(in_place, std::forward<_Up>(__v)) {} |
| 934 | # endif | ||
| 935 | : __base(in_place, std::forward<_Up>(__v)) { | ||
| 936 | } | ||
| 937 | 981 | ||
| 938 | // LWG2756: conditionally explicit conversion from const optional<_Up>& | 982 | // LWG2756: conditionally explicit conversion from const optional<_Up>& |
| 939 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0> | 983 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0> |
| 940 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v) | 984 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v) { |
| 941 | # if _LIBCPP_STD_VER >= 26 | ||
| 942 | noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, const _Up&>) | ||
| 943 | # endif | ||
| 944 | { | ||
| 945 | this->__construct_from(__v); | 985 | this->__construct_from(__v); |
| 946 | } | 986 | } |
| 987 | |||
| 947 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0> | 988 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0> |
| 948 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v) | 989 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v) { |
| 949 | # if _LIBCPP_STD_VER >= 26 | ||
| 950 | noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, const _Up&>) | ||
| 951 | # endif | ||
| 952 | { | ||
| 953 | this->__construct_from(__v); | 990 | this->__construct_from(__v); |
| 954 | } | 991 | } |
| 955 | 992 | ||
| 956 | // LWG2756: conditionally explicit conversion from optional<_Up>&& | 993 | // LWG2756: conditionally explicit conversion from optional<_Up>&& |
| 957 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0> | 994 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0> |
| 958 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v) | 995 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v) { |
| 959 | # if _LIBCPP_STD_VER >= 26 | ||
| 960 | noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>) | ||
| 961 | # endif | ||
| 962 | { | ||
| 963 | this->__construct_from(std::move(__v)); | ||
| 964 | } | ||
| 965 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0> | ||
| 966 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v) | ||
| 967 | # if _LIBCPP_STD_VER >= 26 | ||
| 968 | noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>) | ||
| 969 | # endif | ||
| 970 | { | ||
| 971 | this->__construct_from(std::move(__v)); | 996 | this->__construct_from(std::move(__v)); |
| 972 | } | 997 | } |
| 973 | 998 | ||
| 974 | // deleted optional<T&> constructors and additional optional<T&> constructors | ||
| 975 | # if _LIBCPP_STD_VER >= 26 | ||
| 976 | // optional(U&&) | ||
| 977 | template <class _Up = _Tp, enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0> | ||
| 978 | requires __libcpp_opt_ref_ctor_deleted<_Up> | ||
| 979 | optional(_Up&&) = delete; | ||
| 980 | |||
| 981 | template <class _Up = remove_cv_t<_Tp>, | ||
| 982 | enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0> | ||
| 983 | requires __libcpp_opt_ref_ctor_deleted<_Up> | ||
| 984 | explicit optional(_Up&&) = delete; | ||
| 985 | |||
| 986 | // optional(optional<U>& rhs) | ||
| 987 | template <class _Up> | ||
| 988 | requires __ref_ctor_enabled<_Up&> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) && (!is_same_v<_Tp&, _Up>) && | ||
| 989 | is_constructible_v<_Tp&, _Up&> | ||
| 990 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up&, _Tp&>) | ||
| 991 | optional(optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up&>) { | ||
| 992 | this->__construct_from(__rhs); | ||
| 993 | } | ||
| 994 | |||
| 995 | template <class _Up> | ||
| 996 | requires __libcpp_opt_ref_ctor_deleted<_Up&> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) && | ||
| 997 | (!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, _Up&> | ||
| 998 | constexpr explicit optional(optional<_Up>& __rhs) noexcept = delete; | ||
| 999 | |||
| 1000 | // optional(const optional<U>&) | ||
| 1001 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0> | ||
| 1002 | requires __libcpp_opt_ref_ctor_deleted<const _Up&> | ||
| 1003 | optional(const optional<_Up>&) = delete; | ||
| 1004 | |||
| 1005 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0> | ||
| 1006 | requires __libcpp_opt_ref_ctor_deleted<const _Up&> | ||
| 1007 | explicit optional(const optional<_Up>&) = delete; | ||
| 1008 | |||
| 1009 | // optional(optional<U>&&) | ||
| 1010 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0> | ||
| 1011 | requires __libcpp_opt_ref_ctor_deleted<_Up> | ||
| 1012 | optional(optional<_Up>&&) = delete; | ||
| 1013 | |||
| 1014 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0> | 999 | template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0> |
| 1015 | requires __libcpp_opt_ref_ctor_deleted<_Up> | 1000 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v) { |
| 1016 | explicit optional(optional<_Up>&&) = delete; | ||
| 1017 | |||
| 1018 | // optional(const optional<U>&&) | ||
| 1019 | template <class _Up> | ||
| 1020 | requires __ref_ctor_enabled<const _Up> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) && | ||
| 1021 | (!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, const _Up> | ||
| 1022 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!is_convertible_v<const _Up, _Tp&>) | ||
| 1023 | optional(const optional<_Up>&& __v) noexcept(is_nothrow_constructible_v<_Tp&, const _Up>) { | ||
| 1024 | this->__construct_from(std::move(__v)); | 1001 | this->__construct_from(std::move(__v)); |
| 1025 | } | 1002 | } |
| 1026 | 1003 | ||
| 1027 | template <class _Up> | ||
| 1028 | requires __libcpp_opt_ref_ctor_deleted<const _Up> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) && | ||
| 1029 | (!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, const _Up> | ||
| 1030 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>&& __v) noexcept = delete; | ||
| 1031 | # endif | ||
| 1032 | |||
| 1033 | # if _LIBCPP_STD_VER >= 23 | 1004 | # if _LIBCPP_STD_VER >= 23 |
| 1034 | template <class _Tag, | 1005 | template <class _Tag, |
| 1035 | class _Fp, | 1006 | class _Fp, |
| ... | @@ -1052,8 +1023,7 @@ public: | ... | @@ -1052,8 +1023,7 @@ public: |
| 1052 | enable_if_t<_And<_IsNotSame<__remove_cvref_t<_Up>, optional>, | 1023 | enable_if_t<_And<_IsNotSame<__remove_cvref_t<_Up>, optional>, |
| 1053 | _Or<_IsNotSame<__remove_cvref_t<_Up>, _Tp>, _Not<is_scalar<_Tp>>>, | 1024 | _Or<_IsNotSame<__remove_cvref_t<_Up>, _Tp>, _Not<is_scalar<_Tp>>>, |
| 1054 | is_constructible<_Tp, _Up>, | 1025 | is_constructible<_Tp, _Up>, |
| 1055 | is_assignable<_Tp&, _Up>, | 1026 | is_assignable<_Tp&, _Up>>::value, |
| 1056 | is_object<_Tp>>::value, | ||
| 1057 | int> = 0> | 1027 | int> = 0> |
| 1058 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(_Up&& __v) { | 1028 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(_Up&& __v) { |
| 1059 | if (this->has_value()) | 1029 | if (this->has_value()) |
| ... | @@ -1077,138 +1047,35 @@ public: | ... | @@ -1077,138 +1047,35 @@ public: |
| 1077 | return *this; | 1047 | return *this; |
| 1078 | } | 1048 | } |
| 1079 | 1049 | ||
| 1080 | template <class... _Args, enable_if_t<__is_constructible_for_optional_v<_Tp, _Args...>, int> = 0> | 1050 | template <class... _Args, enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0> |
| 1081 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args) | 1051 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args) { |
| 1082 | # if _LIBCPP_STD_VER >= 26 | ||
| 1083 | noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp, _Args...>) | ||
| 1084 | # endif | ||
| 1085 | { | ||
| 1086 | reset(); | 1052 | reset(); |
| 1087 | this->__construct(std::forward<_Args>(__args)...); | 1053 | this->__construct(std::forward<_Args>(__args)...); |
| 1088 | return this->__get(); | 1054 | return this->__get(); |
| 1089 | } | 1055 | } |
| 1090 | 1056 | ||
| 1091 | template <class _Up, | 1057 | template <class _Up, class... _Args, enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0> |
| 1092 | class... _Args, | ||
| 1093 | enable_if_t<__is_constructible_for_optional_initializer_list_v<_Tp, _Up, _Args...>, int> = 0> | ||
| 1094 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { | 1058 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { |
| 1095 | reset(); | 1059 | reset(); |
| 1096 | this->__construct(__il, std::forward<_Args>(__args)...); | 1060 | this->__construct(__il, std::forward<_Args>(__args)...); |
| 1097 | return this->__get(); | 1061 | return this->__get(); |
| 1098 | } | 1062 | } |
| 1099 | 1063 | ||
| 1100 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional& __opt) noexcept( | 1064 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void |
| 1101 | (is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp>) | 1065 | swap(optional& __opt) noexcept((is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp>)) { |
| 1102 | # if _LIBCPP_STD_VER >= 26 | ||
| 1103 | || is_lvalue_reference_v<_Tp> | ||
| 1104 | # endif | ||
| 1105 | ) { | ||
| 1106 | this->__swap(__opt); | 1066 | this->__swap(__opt); |
| 1107 | } | 1067 | } |
| 1108 | 1068 | ||
| 1109 | _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp const> operator->() const noexcept | 1069 | using __base::operator*; |
| 1110 | # if _LIBCPP_STD_VER >= 26 | 1070 | using __base::operator->; |
| 1111 | requires(is_object_v<_Tp>) | ||
| 1112 | # endif | ||
| 1113 | { | ||
| 1114 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value"); | ||
| 1115 | return std::addressof(this->__get()); | ||
| 1116 | } | ||
| 1117 | |||
| 1118 | _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() noexcept | ||
| 1119 | # if _LIBCPP_STD_VER >= 26 | ||
| 1120 | requires(is_object_v<_Tp>) | ||
| 1121 | # endif | ||
| 1122 | { | ||
| 1123 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value"); | ||
| 1124 | return std::addressof(this->__get()); | ||
| 1125 | } | ||
| 1126 | |||
| 1127 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept | ||
| 1128 | # if _LIBCPP_STD_VER >= 26 | ||
| 1129 | requires(is_object_v<_Tp>) | ||
| 1130 | # endif | ||
| 1131 | { | ||
| 1132 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value"); | ||
| 1133 | return this->__get(); | ||
| 1134 | } | ||
| 1135 | |||
| 1136 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept | ||
| 1137 | # if _LIBCPP_STD_VER >= 26 | ||
| 1138 | requires(is_object_v<_Tp>) | ||
| 1139 | # endif | ||
| 1140 | { | ||
| 1141 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value"); | ||
| 1142 | return this->__get(); | ||
| 1143 | } | ||
| 1144 | |||
| 1145 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept | ||
| 1146 | # if _LIBCPP_STD_VER >= 26 | ||
| 1147 | requires(is_object_v<_Tp>) | ||
| 1148 | # endif | ||
| 1149 | { | ||
| 1150 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value"); | ||
| 1151 | return std::move(this->__get()); | ||
| 1152 | } | ||
| 1153 | |||
| 1154 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept | ||
| 1155 | # if _LIBCPP_STD_VER >= 26 | ||
| 1156 | requires(is_object_v<_Tp>) | ||
| 1157 | # endif | ||
| 1158 | { | ||
| 1159 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value"); | ||
| 1160 | return std::move(this->__get()); | ||
| 1161 | } | ||
| 1162 | 1071 | ||
| 1163 | _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return has_value(); } | 1072 | _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return has_value(); } |
| 1164 | 1073 | ||
| 1165 | using __base::__get; | 1074 | using __base::__get; |
| 1166 | using __base::has_value; | 1075 | using __base::has_value; |
| 1167 | 1076 | using __base::value; | |
| 1168 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& value() const& | ||
| 1169 | # if _LIBCPP_STD_VER >= 26 | ||
| 1170 | requires(is_object_v<_Tp>) | ||
| 1171 | # endif | ||
| 1172 | { | ||
| 1173 | if (!this->has_value()) | ||
| 1174 | std::__throw_bad_optional_access(); | ||
| 1175 | return this->__get(); | ||
| 1176 | } | ||
| 1177 | |||
| 1178 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() & | ||
| 1179 | # if _LIBCPP_STD_VER >= 26 | ||
| 1180 | requires(is_object_v<_Tp>) | ||
| 1181 | # endif | ||
| 1182 | { | ||
| 1183 | if (!this->has_value()) | ||
| 1184 | std::__throw_bad_optional_access(); | ||
| 1185 | return this->__get(); | ||
| 1186 | } | ||
| 1187 | |||
| 1188 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() && | ||
| 1189 | # if _LIBCPP_STD_VER >= 26 | ||
| 1190 | requires(is_object_v<_Tp>) | ||
| 1191 | # endif | ||
| 1192 | { | ||
| 1193 | if (!this->has_value()) | ||
| 1194 | std::__throw_bad_optional_access(); | ||
| 1195 | return std::move(this->__get()); | ||
| 1196 | } | ||
| 1197 | |||
| 1198 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const&& value() const&& | ||
| 1199 | # if _LIBCPP_STD_VER >= 26 | ||
| 1200 | requires(is_object_v<_Tp>) | ||
| 1201 | # endif | ||
| 1202 | { | ||
| 1203 | if (!this->has_value()) | ||
| 1204 | std::__throw_bad_optional_access(); | ||
| 1205 | return std::move(this->__get()); | ||
| 1206 | } | ||
| 1207 | 1077 | ||
| 1208 | template <class _Up = remove_cv_t<_Tp>> | 1078 | template <class _Up = remove_cv_t<_Tp>> |
| 1209 | # if _LIBCPP_STD_VER >= 26 | ||
| 1210 | requires(is_object_v<_Tp>) | ||
| 1211 | # endif | ||
| 1212 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) const& { | 1079 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) const& { |
| 1213 | static_assert(is_copy_constructible_v<_Tp>, "optional<T>::value_or: T must be copy constructible"); | 1080 | static_assert(is_copy_constructible_v<_Tp>, "optional<T>::value_or: T must be copy constructible"); |
| 1214 | static_assert(is_convertible_v<_Up, _Tp>, "optional<T>::value_or: U must be convertible to T"); | 1081 | static_assert(is_convertible_v<_Up, _Tp>, "optional<T>::value_or: U must be convertible to T"); |
| ... | @@ -1216,9 +1083,6 @@ public: | ... | @@ -1216,9 +1083,6 @@ public: |
| 1216 | } | 1083 | } |
| 1217 | 1084 | ||
| 1218 | template <class _Up = remove_cv_t<_Tp>> | 1085 | template <class _Up = remove_cv_t<_Tp>> |
| 1219 | # if _LIBCPP_STD_VER >= 26 | ||
| 1220 | requires(is_object_v<_Tp>) | ||
| 1221 | # endif | ||
| 1222 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) && { | 1086 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) && { |
| 1223 | static_assert(is_move_constructible_v<_Tp>, "optional<T>::value_or: T must be move constructible"); | 1087 | static_assert(is_move_constructible_v<_Tp>, "optional<T>::value_or: T must be move constructible"); |
| 1224 | static_assert(is_convertible_v<_Up, _Tp>, "optional<T>::value_or: U must be convertible to T"); | 1088 | static_assert(is_convertible_v<_Up, _Tp>, "optional<T>::value_or: U must be convertible to T"); |
| ... | @@ -1227,9 +1091,6 @@ public: | ... | @@ -1227,9 +1091,6 @@ public: |
| 1227 | 1091 | ||
| 1228 | # if _LIBCPP_STD_VER >= 23 | 1092 | # if _LIBCPP_STD_VER >= 23 |
| 1229 | template <class _Func> | 1093 | template <class _Func> |
| 1230 | # if _LIBCPP_STD_VER >= 26 | ||
| 1231 | requires(is_object_v<_Tp>) | ||
| 1232 | # endif | ||
| 1233 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & { | 1094 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & { |
| 1234 | using _Up = invoke_result_t<_Func, _Tp&>; | 1095 | using _Up = invoke_result_t<_Func, _Tp&>; |
| 1235 | static_assert(__is_std_optional<remove_cvref_t<_Up>>::value, | 1096 | static_assert(__is_std_optional<remove_cvref_t<_Up>>::value, |
| ... | @@ -1240,9 +1101,6 @@ public: | ... | @@ -1240,9 +1101,6 @@ public: |
| 1240 | } | 1101 | } |
| 1241 | 1102 | ||
| 1242 | template <class _Func> | 1103 | template <class _Func> |
| 1243 | # if _LIBCPP_STD_VER >= 26 | ||
| 1244 | requires(is_object_v<_Tp>) | ||
| 1245 | # endif | ||
| 1246 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& { | 1104 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& { |
| 1247 | using _Up = invoke_result_t<_Func, const _Tp&>; | 1105 | using _Up = invoke_result_t<_Func, const _Tp&>; |
| 1248 | static_assert(__is_std_optional<remove_cvref_t<_Up>>::value, | 1106 | static_assert(__is_std_optional<remove_cvref_t<_Up>>::value, |
| ... | @@ -1253,9 +1111,6 @@ public: | ... | @@ -1253,9 +1111,6 @@ public: |
| 1253 | } | 1111 | } |
| 1254 | 1112 | ||
| 1255 | template <class _Func> | 1113 | template <class _Func> |
| 1256 | # if _LIBCPP_STD_VER >= 26 | ||
| 1257 | requires(is_object_v<_Tp>) | ||
| 1258 | # endif | ||
| 1259 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && { | 1114 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && { |
| 1260 | using _Up = invoke_result_t<_Func, _Tp&&>; | 1115 | using _Up = invoke_result_t<_Func, _Tp&&>; |
| 1261 | static_assert(__is_std_optional<remove_cvref_t<_Up>>::value, | 1116 | static_assert(__is_std_optional<remove_cvref_t<_Up>>::value, |
| ... | @@ -1266,9 +1121,6 @@ public: | ... | @@ -1266,9 +1121,6 @@ public: |
| 1266 | } | 1121 | } |
| 1267 | 1122 | ||
| 1268 | template <class _Func> | 1123 | template <class _Func> |
| 1269 | # if _LIBCPP_STD_VER >= 26 | ||
| 1270 | requires(is_object_v<_Tp>) | ||
| 1271 | # endif | ||
| 1272 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& { | 1124 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& { |
| 1273 | using _Up = invoke_result_t<_Func, const _Tp&&>; | 1125 | using _Up = invoke_result_t<_Func, const _Tp&&>; |
| 1274 | static_assert(__is_std_optional<remove_cvref_t<_Up>>::value, | 1126 | static_assert(__is_std_optional<remove_cvref_t<_Up>>::value, |
| ... | @@ -1279,60 +1131,52 @@ public: | ... | @@ -1279,60 +1131,52 @@ public: |
| 1279 | } | 1131 | } |
| 1280 | 1132 | ||
| 1281 | template <class _Func> | 1133 | template <class _Func> |
| 1282 | # if _LIBCPP_STD_VER >= 26 | ||
| 1283 | requires(is_object_v<_Tp>) | ||
| 1284 | # endif | ||
| 1285 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & { | 1134 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & { |
| 1286 | using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&>>; | 1135 | using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&>>; |
| 1287 | static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array"); | 1136 | static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array"); |
| 1288 | static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t"); | 1137 | static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t"); |
| 1289 | static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t"); | 1138 | static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t"); |
| 1290 | static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type"); | 1139 | static_assert( |
| 1140 | __is_valid_optional_contained_type<_Up>, "Result of f(value()) should be a valid contained type for optional"); | ||
| 1291 | if (*this) | 1141 | if (*this) |
| 1292 | return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value()); | 1142 | return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value()); |
| 1293 | return optional<_Up>(); | 1143 | return optional<_Up>(); |
| 1294 | } | 1144 | } |
| 1295 | 1145 | ||
| 1296 | template <class _Func> | 1146 | template <class _Func> |
| 1297 | # if _LIBCPP_STD_VER >= 26 | ||
| 1298 | requires(is_object_v<_Tp>) | ||
| 1299 | # endif | ||
| 1300 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& { | 1147 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& { |
| 1301 | using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&>>; | 1148 | using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&>>; |
| 1302 | static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array"); | 1149 | static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array"); |
| 1303 | static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t"); | 1150 | static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t"); |
| 1304 | static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t"); | 1151 | static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t"); |
| 1305 | static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type"); | 1152 | static_assert( |
| 1153 | __is_valid_optional_contained_type<_Up>, "Result of f(value()) should be a valid contained type for optional"); | ||
| 1306 | if (*this) | 1154 | if (*this) |
| 1307 | return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value()); | 1155 | return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value()); |
| 1308 | return optional<_Up>(); | 1156 | return optional<_Up>(); |
| 1309 | } | 1157 | } |
| 1310 | 1158 | ||
| 1311 | template <class _Func> | 1159 | template <class _Func> |
| 1312 | # if _LIBCPP_STD_VER >= 26 | ||
| 1313 | requires(is_object_v<_Tp>) | ||
| 1314 | # endif | ||
| 1315 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && { | 1160 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && { |
| 1316 | using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&&>>; | 1161 | using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&&>>; |
| 1317 | static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array"); | 1162 | static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array"); |
| 1318 | static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t"); | 1163 | static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t"); |
| 1319 | static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t"); | 1164 | static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t"); |
| 1320 | static_assert(is_object_v<_Up>, "Result of f(std::move(value())) should be an object type"); | 1165 | static_assert( |
| 1166 | __is_valid_optional_contained_type<_Up>, "Result of f(value()) should be a valid contained type for optional"); | ||
| 1321 | if (*this) | 1167 | if (*this) |
| 1322 | return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value())); | 1168 | return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value())); |
| 1323 | return optional<_Up>(); | 1169 | return optional<_Up>(); |
| 1324 | } | 1170 | } |
| 1325 | 1171 | ||
| 1326 | template <class _Func> | 1172 | template <class _Func> |
| 1327 | # if _LIBCPP_STD_VER >= 26 | ||
| 1328 | requires(is_object_v<_Tp>) | ||
| 1329 | # endif | ||
| 1330 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& { | 1173 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& { |
| 1331 | using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&&>>; | 1174 | using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&&>>; |
| 1332 | static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array"); | 1175 | static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array"); |
| 1333 | static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t"); | 1176 | static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t"); |
| 1334 | static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t"); | 1177 | static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t"); |
| 1335 | static_assert(is_object_v<_Up>, "Result of f(std::move(value())) should be an object type"); | 1178 | static_assert( |
| 1179 | __is_valid_optional_contained_type<_Up>, "Result of f(value()) should be a valid contained type for optional"); | ||
| 1336 | if (*this) | 1180 | if (*this) |
| 1337 | return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value())); | 1181 | return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value())); |
| 1338 | return optional<_Up>(); | 1182 | return optional<_Up>(); |
| ... | @@ -1341,9 +1185,6 @@ public: | ... | @@ -1341,9 +1185,6 @@ public: |
| 1341 | template <invocable _Func> | 1185 | template <invocable _Func> |
| 1342 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const& | 1186 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const& |
| 1343 | requires is_copy_constructible_v<_Tp> | 1187 | requires is_copy_constructible_v<_Tp> |
| 1344 | # if _LIBCPP_STD_VER >= 26 | ||
| 1345 | && (is_object_v<_Tp>) | ||
| 1346 | # endif | ||
| 1347 | { | 1188 | { |
| 1348 | static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>, | 1189 | static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>, |
| 1349 | "Result of f() should be the same type as this optional"); | 1190 | "Result of f() should be the same type as this optional"); |
| ... | @@ -1355,9 +1196,6 @@ public: | ... | @@ -1355,9 +1196,6 @@ public: |
| 1355 | template <invocable _Func> | 1196 | template <invocable _Func> |
| 1356 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) && | 1197 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) && |
| 1357 | requires is_move_constructible_v<_Tp> | 1198 | requires is_move_constructible_v<_Tp> |
| 1358 | # if _LIBCPP_STD_VER >= 26 | ||
| 1359 | && (is_object_v<_Tp>) | ||
| 1360 | # endif | ||
| 1361 | { | 1199 | { |
| 1362 | static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>, | 1200 | static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>, |
| 1363 | "Result of f() should be the same type as this optional"); | 1201 | "Result of f() should be the same type as this optional"); |
| ... | @@ -1368,46 +1206,137 @@ public: | ... | @@ -1368,46 +1206,137 @@ public: |
| 1368 | # endif // _LIBCPP_STD_VER >= 23 | 1206 | # endif // _LIBCPP_STD_VER >= 23 |
| 1369 | 1207 | ||
| 1370 | using __base::reset; | 1208 | using __base::reset; |
| 1209 | }; | ||
| 1371 | 1210 | ||
| 1372 | // optional<T&> overloads | ||
| 1373 | # if _LIBCPP_STD_VER >= 26 | 1211 | # if _LIBCPP_STD_VER >= 26 |
| 1212 | template <class _Tp> | ||
| 1213 | class optional<_Tp&> : public __optional_iterator_base<_Tp&> { | ||
| 1214 | using __base _LIBCPP_NODEBUG = __optional_iterator_base<_Tp&>; | ||
| 1374 | 1215 | ||
| 1375 | _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() const noexcept | 1216 | template <class _Up, class _QualUp> |
| 1376 | requires(is_lvalue_reference_v<_Tp>) | 1217 | static constexpr bool __check_optionalU_ctor = |
| 1377 | { | 1218 | !is_same_v<remove_cv_t<_Tp>, optional<_Up>> && !is_same_v<_Tp&, _Up> && is_constructible_v<_Tp&, _QualUp>; |
| 1378 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value"); | 1219 | static_assert(!is_same_v<remove_cv_t<_Tp>, in_place_t>, "instantiation of optional with in_place_t is ill-formed"); |
| 1379 | return std::addressof(this->__get()); | 1220 | static_assert(!is_same_v<remove_cv_t<_Tp>, nullopt_t>, "instantiation of optional with nullopt_t is ill-formed"); |
| 1221 | |||
| 1222 | public: | ||
| 1223 | using value_type = _Tp; | ||
| 1224 | |||
| 1225 | constexpr optional() noexcept = default; | ||
| 1226 | constexpr optional(nullopt_t) noexcept {} | ||
| 1227 | constexpr optional(const optional&) noexcept = default; | ||
| 1228 | |||
| 1229 | template <class _Arg> | ||
| 1230 | requires(is_constructible_v<_Tp&, _Arg> && !reference_constructs_from_temporary_v<_Tp&, _Arg>) | ||
| 1231 | constexpr explicit optional(in_place_t, _Arg&& __arg) : __base(in_place, std::forward<_Arg>(__arg)) {} | ||
| 1232 | |||
| 1233 | template <class _Up> | ||
| 1234 | requires(!is_same_v<remove_cvref_t<_Up>, optional> && !is_same_v<remove_cvref_t<_Up>, in_place_t> && | ||
| 1235 | is_constructible_v<_Tp&, _Up> && !reference_constructs_from_temporary_v<_Tp&, _Up>) | ||
| 1236 | constexpr explicit(!is_convertible_v<_Up, _Tp&>) optional(_Up&& __v) noexcept(is_nothrow_constructible_v<_Tp&, _Up>) | ||
| 1237 | : __base(in_place, std::forward<_Up>(__v)) {} | ||
| 1238 | |||
| 1239 | template <class _Up> | ||
| 1240 | requires(__check_optionalU_ctor<_Up, _Up&> && !reference_constructs_from_temporary_v<_Tp&, _Up&>) | ||
| 1241 | constexpr explicit(!is_convertible_v<_Up&, _Tp&>) | ||
| 1242 | optional(optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up&>) { | ||
| 1243 | this->__construct_from(__rhs); | ||
| 1380 | } | 1244 | } |
| 1381 | 1245 | ||
| 1382 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() const noexcept | 1246 | template <class _Up> |
| 1383 | requires(is_lvalue_reference_v<_Tp>) | 1247 | requires(__check_optionalU_ctor<_Up, const _Up&> && !reference_constructs_from_temporary_v<_Tp&, const _Up&>) |
| 1384 | { | 1248 | constexpr explicit(!is_convertible_v<const _Up&, _Tp&>) |
| 1385 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value"); | 1249 | optional(const optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, const _Up&>) { |
| 1386 | return this->__get(); | 1250 | this->__construct_from(__rhs); |
| 1387 | } | 1251 | } |
| 1388 | 1252 | ||
| 1389 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() const | 1253 | template <class _Up> |
| 1390 | requires(is_lvalue_reference_v<_Tp>) | 1254 | requires(__check_optionalU_ctor<_Up, _Up> && !reference_constructs_from_temporary_v<_Tp&, _Up>) |
| 1391 | { | 1255 | constexpr explicit(!is_convertible_v<_Up, _Tp&>) |
| 1392 | if (!this->has_value()) | 1256 | optional(optional<_Up>&& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up>) { |
| 1393 | std::__throw_bad_optional_access(); | 1257 | this->__construct_from(std::move(__rhs)); |
| 1258 | } | ||
| 1259 | |||
| 1260 | template <class _Up> | ||
| 1261 | requires(__check_optionalU_ctor<_Up, const _Up> && !reference_constructs_from_temporary_v<_Tp&, const _Up>) | ||
| 1262 | constexpr explicit(!is_convertible_v<const _Up, _Tp&>) | ||
| 1263 | optional(const optional<_Up>&& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, const _Up>) { | ||
| 1264 | this->__construct_from(std::move(__rhs)); | ||
| 1265 | } | ||
| 1266 | |||
| 1267 | template <class _Tag, class _Fp, class... _Args> | ||
| 1268 | requires(is_same_v<_Tag, __optional_construct_from_invoke_tag>) | ||
| 1269 | _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Tag, _Fp&& __f, _Args&&... __args) | ||
| 1270 | : __base(__optional_construct_from_invoke_tag{}, std::forward<_Fp>(__f), std::forward<_Args>(__args)...) {} | ||
| 1271 | |||
| 1272 | // deleted overloads | ||
| 1273 | |||
| 1274 | template <class _Up> | ||
| 1275 | requires(!is_same_v<remove_cvref_t<_Up>, optional> && !is_same_v<remove_cvref_t<_Up>, in_place_t> && | ||
| 1276 | is_constructible_v<_Tp&, _Up> && reference_constructs_from_temporary_v<_Tp&, _Up>) | ||
| 1277 | constexpr explicit(!is_convertible_v<_Up, _Tp&>) | ||
| 1278 | optional(_Up&& __v) noexcept(is_nothrow_constructible_v<_Tp&, _Up>) = delete; | ||
| 1279 | |||
| 1280 | template <class _Up> | ||
| 1281 | requires(__check_optionalU_ctor<_Up, _Up&> && reference_constructs_from_temporary_v<_Tp&, _Up&>) | ||
| 1282 | constexpr explicit(!is_convertible_v<_Up&, _Tp&>) | ||
| 1283 | optional(optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up&>) = delete; | ||
| 1284 | |||
| 1285 | template <class _Up> | ||
| 1286 | requires(__check_optionalU_ctor<_Up, const _Up&> && reference_constructs_from_temporary_v<_Tp&, const _Up&>) | ||
| 1287 | constexpr explicit(!is_convertible_v<const _Up&, _Tp&>) | ||
| 1288 | optional(const optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, const _Up&>) = delete; | ||
| 1289 | |||
| 1290 | template <class _Up> | ||
| 1291 | requires(__check_optionalU_ctor<_Up, _Up> && reference_constructs_from_temporary_v<_Tp&, _Up>) | ||
| 1292 | constexpr explicit(!is_convertible_v<_Up, _Tp&>) | ||
| 1293 | optional(optional<_Up>&& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up>) = delete; | ||
| 1294 | |||
| 1295 | template <class _Up> | ||
| 1296 | requires(__check_optionalU_ctor<_Up, const _Up> && reference_constructs_from_temporary_v<_Tp&, const _Up>) | ||
| 1297 | constexpr explicit(!is_convertible_v<const _Up, _Tp&>) | ||
| 1298 | optional(const optional<_Up>&& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, const _Up>) = delete; | ||
| 1299 | |||
| 1300 | constexpr ~optional() = default; | ||
| 1301 | |||
| 1302 | using __base::__get; | ||
| 1303 | |||
| 1304 | _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(nullopt_t) noexcept { | ||
| 1305 | reset(); | ||
| 1306 | return *this; | ||
| 1307 | } | ||
| 1308 | |||
| 1309 | constexpr optional& operator=(const optional&) noexcept = default; | ||
| 1310 | |||
| 1311 | template <class _Up> | ||
| 1312 | requires(is_constructible_v<_Tp&, _Up> && !reference_constructs_from_temporary_v<_Tp&, _Up>) | ||
| 1313 | constexpr _Tp& emplace(_Up&& __u) noexcept(is_nothrow_constructible_v<_Tp&, _Up>) { | ||
| 1314 | this->__construct(std::forward<_Up>(__u)); | ||
| 1315 | |||
| 1394 | return this->__get(); | 1316 | return this->__get(); |
| 1395 | } | 1317 | } |
| 1396 | 1318 | ||
| 1397 | template <class _Up = remove_cvref_t<_Tp>> | 1319 | constexpr void swap(optional& __rhs) noexcept { this->__swap(__rhs); } |
| 1398 | requires(is_lvalue_reference_v<_Tp> && is_object_v<__libcpp_remove_reference_t<_Tp>> && | 1320 | |
| 1399 | !is_array_v<__libcpp_remove_reference_t<_Tp>>) | 1321 | using __base::operator->; |
| 1400 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decay_t<_Tp> value_or(_Up&& __v) const { | 1322 | using __base::operator*; |
| 1401 | static_assert( | 1323 | |
| 1402 | is_constructible_v<remove_cvref_t<_Tp>, _Tp&>, "optional<T&>::value_or: remove_cv_t<T> must be constructible"); | 1324 | constexpr explicit operator bool() const noexcept { return has_value(); } |
| 1403 | static_assert( | 1325 | |
| 1404 | is_convertible_v<_Up, remove_cvref_t<_Tp>>, "optional<T&>::value_or: U must be convertible to remove_cv_t<T>"); | 1326 | using __base::has_value; |
| 1405 | return this->has_value() ? this->__get() : static_cast<remove_cvref_t<_Tp>>(std::forward<_Up>(__v)); | 1327 | using __base::value; |
| 1328 | |||
| 1329 | template <class _Up = remove_cv_t<_Tp>> | ||
| 1330 | requires(!is_array_v<_Tp> && is_object_v<_Tp>) | ||
| 1331 | [[nodiscard]] constexpr decay_t<_Tp> value_or(_Up&& __v) const { | ||
| 1332 | using _XTp = remove_cv_t<_Tp>; | ||
| 1333 | static_assert(is_constructible_v<_XTp, _Tp&>, "optional<T&>::value_or: remove_cv_t<T> must be constructible"); | ||
| 1334 | static_assert(is_convertible_v<_Up, _XTp>, "optional<T&>::value_or: U must be convertible to remove_cv_t<T>"); | ||
| 1335 | return this->has_value() ? this->__get() : static_cast<_XTp>(std::forward<_Up>(__v)); | ||
| 1406 | } | 1336 | } |
| 1407 | 1337 | ||
| 1408 | template <class _Func> | 1338 | template <class _Func> |
| 1409 | requires(is_lvalue_reference_v<_Tp>) | 1339 | [[nodiscard]] constexpr auto and_then(_Func&& __f) const { |
| 1410 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const { | ||
| 1411 | using _Up = invoke_result_t<_Func, _Tp&>; | 1340 | using _Up = invoke_result_t<_Func, _Tp&>; |
| 1412 | static_assert(__is_std_optional<remove_cvref_t<_Up>>::value, | 1341 | static_assert(__is_std_optional<remove_cvref_t<_Up>>::value, |
| 1413 | "Result of f(value()) must be a specialization of std::optional"); | 1342 | "Result of f(value()) must be a specialization of std::optional"); |
| ... | @@ -1417,30 +1346,31 @@ public: | ... | @@ -1417,30 +1346,31 @@ public: |
| 1417 | } | 1346 | } |
| 1418 | 1347 | ||
| 1419 | template <class _Func> | 1348 | template <class _Func> |
| 1420 | requires(is_lvalue_reference_v<_Tp>) | 1349 | [[nodiscard]] constexpr optional<remove_cv_t<invoke_result_t<_Func, _Tp&>>> transform(_Func&& __f) const { |
| 1421 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional<remove_cv_t<invoke_result_t<_Func, _Tp&>>> | 1350 | using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&>>; |
| 1422 | transform(_Func&& __f) const { | ||
| 1423 | using _Up = remove_cvref_t<invoke_result_t<_Func, _Tp&>>; | ||
| 1424 | static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array"); | 1351 | static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array"); |
| 1425 | static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t"); | 1352 | static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t"); |
| 1426 | static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t"); | 1353 | static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t"); |
| 1427 | static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type"); | 1354 | static_assert( |
| 1355 | __is_valid_optional_contained_type<_Up>, "Result of f(value()) should be a valid contained type for optional"); | ||
| 1356 | |||
| 1428 | if (*this) | 1357 | if (*this) |
| 1429 | return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value()); | 1358 | return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value()); |
| 1430 | return optional<_Up>(); | 1359 | return optional<_Up>(); |
| 1431 | } | 1360 | } |
| 1432 | 1361 | ||
| 1433 | template <invocable _Func> | 1362 | template <invocable _Func> |
| 1434 | requires(is_lvalue_reference_v<_Tp>) | 1363 | [[nodiscard]] constexpr optional or_else(_Func&& __f) const { |
| 1435 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const { | ||
| 1436 | static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>, | 1364 | static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>, |
| 1437 | "Result of f() should be the same type as this optional"); | 1365 | "Result of f() should be the same type as this optional"); |
| 1438 | if (*this) | 1366 | if (*this) |
| 1439 | return *this; | 1367 | return *this; |
| 1440 | return std::forward<_Func>(__f)(); | 1368 | return std::forward<_Func>(__f)(); |
| 1441 | } | 1369 | } |
| 1442 | # endif | 1370 | |
| 1371 | using __base::reset; | ||
| 1443 | }; | 1372 | }; |
| 1373 | # endif | ||
| 1444 | 1374 | ||
| 1445 | template <class _Tp> | 1375 | template <class _Tp> |
| 1446 | optional(_Tp) -> optional<_Tp>; | 1376 | optional(_Tp) -> optional<_Tp>; |
| ... | @@ -1749,7 +1679,13 @@ operator<=>(const optional<_Tp>& __x, const _Up& __v) { | ... | @@ -1749,7 +1679,13 @@ operator<=>(const optional<_Tp>& __x, const _Up& __v) { |
| 1749 | 1679 | ||
| 1750 | # endif // _LIBCPP_STD_VER >= 20 | 1680 | # endif // _LIBCPP_STD_VER >= 20 |
| 1751 | 1681 | ||
| 1752 | template <class _Tp, enable_if_t< is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, int> = 0> | 1682 | template <class _Tp, |
| 1683 | enable_if_t<(is_move_constructible_v<_Tp> && is_swappable_v<_Tp>) | ||
| 1684 | # if _LIBCPP_STD_VER >= 26 | ||
| 1685 | || is_reference_v<_Tp> | ||
| 1686 | # endif | ||
| 1687 | , | ||
| 1688 | int> = 0> | ||
| 1753 | inline _LIBCPP_HIDE_FROM_ABI | 1689 | inline _LIBCPP_HIDE_FROM_ABI |
| 1754 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) { | 1690 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) { |
| 1755 | __x.swap(__y); | 1691 | __x.swap(__y); |
| ... | @@ -1759,6 +1695,28 @@ struct __make_optional_barrier_tag { | ... | @@ -1759,6 +1695,28 @@ struct __make_optional_barrier_tag { |
| 1759 | explicit __make_optional_barrier_tag() = default; | 1695 | explicit __make_optional_barrier_tag() = default; |
| 1760 | }; | 1696 | }; |
| 1761 | 1697 | ||
| 1698 | template <class _Tp, class... _Args> | ||
| 1699 | inline constexpr bool __is_constructible_for_optional_v = is_constructible_v<_Tp, _Args...>; | ||
| 1700 | |||
| 1701 | template <class _Tp, class... _Args> | ||
| 1702 | struct __is_constructible_for_optional : bool_constant<__is_constructible_for_optional_v<_Tp, _Args...>> {}; | ||
| 1703 | |||
| 1704 | template <class _Tp, class _Up, class... _Args> | ||
| 1705 | inline constexpr bool __is_constructible_for_optional_initializer_list_v = | ||
| 1706 | is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>; | ||
| 1707 | |||
| 1708 | # if _LIBCPP_STD_VER >= 26 | ||
| 1709 | template <class _Tp, class... _Args> | ||
| 1710 | inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Args...> = false; | ||
| 1711 | |||
| 1712 | template <class _Tp, class _Arg> | ||
| 1713 | inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Arg> = | ||
| 1714 | is_constructible_v<_Tp&, _Arg> && !reference_constructs_from_temporary_v<_Tp&, _Arg>; | ||
| 1715 | |||
| 1716 | template <class _Tp, class _Up, class... _Args> | ||
| 1717 | inline constexpr bool __is_constructible_for_optional_initializer_list_v<_Tp&, _Up, _Args...> = false; | ||
| 1718 | # endif | ||
| 1719 | |||
| 1762 | template < | 1720 | template < |
| 1763 | # if _LIBCPP_STD_VER >= 26 | 1721 | # if _LIBCPP_STD_VER >= 26 |
| 1764 | __make_optional_barrier_tag = __make_optional_barrier_tag{}, | 1722 | __make_optional_barrier_tag = __make_optional_barrier_tag{}, |
| ... | @@ -1801,7 +1759,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -1801,7 +1759,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 1801 | 1759 | ||
| 1802 | _LIBCPP_POP_MACROS | 1760 | _LIBCPP_POP_MACROS |
| 1803 | 1761 | ||
| 1804 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1762 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1805 | # include <atomic> | 1763 | # include <atomic> |
| 1806 | # include <climits> | 1764 | # include <climits> |
| 1807 | # include <concepts> | 1765 | # include <concepts> |
lib/libcxx/include/ostream+2-2| ... | @@ -193,7 +193,7 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args); | ... | @@ -193,7 +193,7 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args); |
| 193 | 193 | ||
| 194 | # endif // _LIBCPP_HAS_LOCALIZATION | 194 | # endif // _LIBCPP_HAS_LOCALIZATION |
| 195 | 195 | ||
| 196 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 196 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 197 | # include <atomic> | 197 | # include <atomic> |
| 198 | # include <concepts> | 198 | # include <concepts> |
| 199 | # include <cstdio> | 199 | # include <cstdio> |
| ... | @@ -206,7 +206,7 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args); | ... | @@ -206,7 +206,7 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args); |
| 206 | # include <type_traits> | 206 | # include <type_traits> |
| 207 | # endif | 207 | # endif |
| 208 | 208 | ||
| 209 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23 | 209 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 210 | # include <locale> | 210 | # include <locale> |
| 211 | # endif | 211 | # endif |
| 212 | 212 |
lib/libcxx/include/print+56-80| ... | @@ -52,12 +52,15 @@ namespace std { | ... | @@ -52,12 +52,15 @@ namespace std { |
| 52 | # pragma GCC system_header | 52 | # pragma GCC system_header |
| 53 | # endif | 53 | # endif |
| 54 | 54 | ||
| 55 | # if _LIBCPP_STD_VER >= 23 | ||
| 56 | |||
| 55 | _LIBCPP_BEGIN_NAMESPACE_STD | 57 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 56 | 58 | ||
| 57 | # ifdef _LIBCPP_WIN32API | 59 | # ifdef _LIBCPP_WIN32API |
| 60 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 58 | _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream); | 61 | _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream); |
| 59 | 62 | ||
| 60 | # if _LIBCPP_HAS_WIDE_CHARACTERS | 63 | # if _LIBCPP_HAS_WIDE_CHARACTERS |
| 61 | // A wrapper for WriteConsoleW which is used to write to the Windows | 64 | // A wrapper for WriteConsoleW which is used to write to the Windows |
| 62 | // console. This function is in the dylib to avoid pulling in windows.h | 65 | // console. This function is in the dylib to avoid pulling in windows.h |
| 63 | // in the library headers. The function itself uses some private parts | 66 | // in the library headers. The function itself uses some private parts |
| ... | @@ -68,12 +71,9 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream); | ... | @@ -68,12 +71,9 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream); |
| 68 | // | 71 | // |
| 69 | // Note the function is only implemented on the Windows platform. | 72 | // Note the function is only implemented on the Windows platform. |
| 70 | _LIBCPP_EXPORTED_FROM_ABI void __write_to_windows_console(FILE* __stream, wstring_view __view); | 73 | _LIBCPP_EXPORTED_FROM_ABI void __write_to_windows_console(FILE* __stream, wstring_view __view); |
| 71 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 74 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 72 | # elif __has_include(<unistd.h>) | 75 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS |
| 73 | _LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream); | 76 | # endif // _LIBCPP_WIN32API |
| 74 | # endif // _LIBCPP_WIN32API | ||
| 75 | |||
| 76 | # if _LIBCPP_STD_VER >= 23 | ||
| 77 | 77 | ||
| 78 | # if _LIBCPP_HAS_UNICODE | 78 | # if _LIBCPP_HAS_UNICODE |
| 79 | // This is the code to transcode UTF-8 to UTF-16. This is used on | 79 | // This is the code to transcode UTF-8 to UTF-16. This is used on |
| ... | @@ -197,36 +197,30 @@ inline constexpr bool __use_unicode_execution_charset = _MSVC_EXECUTION_CHARACTE | ... | @@ -197,36 +197,30 @@ inline constexpr bool __use_unicode_execution_charset = _MSVC_EXECUTION_CHARACTE |
| 197 | inline constexpr bool __use_unicode_execution_charset = true; | 197 | inline constexpr bool __use_unicode_execution_charset = true; |
| 198 | # endif | 198 | # endif |
| 199 | 199 | ||
| 200 | # ifdef _LIBCPP_WIN32API | ||
| 200 | _LIBCPP_HIDE_FROM_ABI inline bool __is_terminal([[maybe_unused]] FILE* __stream) { | 201 | _LIBCPP_HIDE_FROM_ABI inline bool __is_terminal([[maybe_unused]] FILE* __stream) { |
| 201 | // The macro _LIBCPP_TESTING_PRINT_IS_TERMINAL is used to change | 202 | // The macro _LIBCPP_TESTING_PRINT_IS_TERMINAL is used to change |
| 202 | // the behavior in the test. This is not part of the public API. | 203 | // the behavior in the test. This is not part of the public API. |
| 203 | # ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL | 204 | # ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL |
| 204 | return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream); | 205 | return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream); |
| 205 | # elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0 || !_LIBCPP_HAS_TERMINAL | 206 | # else |
| 206 | return false; | ||
| 207 | # elif defined(_LIBCPP_WIN32API) | ||
| 208 | return std::__is_windows_terminal(__stream); | 207 | return std::__is_windows_terminal(__stream); |
| 209 | # elif __has_include(<unistd.h>) | 208 | # endif |
| 210 | return std::__is_posix_terminal(__stream); | 209 | } |
| 211 | # else | 210 | # endif // _LIBCPP_WIN32API |
| 212 | # error "Provide a way to determine whether a FILE* is a terminal" | 211 | |
| 213 | # endif | 212 | [[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void __handle_output_error(FILE* __stream) { |
| 213 | if (std::feof(__stream)) | ||
| 214 | std::__throw_system_error(EIO, "EOF while writing the formatted output"); | ||
| 215 | std::__throw_system_error(std::ferror(__stream), "failed to write formatted output"); | ||
| 214 | } | 216 | } |
| 215 | 217 | ||
| 216 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | 218 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). |
| 217 | _LIBCPP_HIDE_FROM_ABI inline void | 219 | _LIBCPP_HIDE_FROM_ABI inline void __output_nonunicode(FILE* __stream, string_view __text) { |
| 218 | __vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl) { | ||
| 219 | _LIBCPP_ASSERT_NON_NULL(__stream, "__stream must be a valid pointer to an output C stream"); | 220 | _LIBCPP_ASSERT_NON_NULL(__stream, "__stream must be a valid pointer to an output C stream"); |
| 220 | string __str = std::vformat(__fmt, __args); | 221 | size_t __size = std::fwrite(__text.data(), 1, __text.size(), __stream); |
| 221 | if (__write_nl) | 222 | if (__size < __text.size()) |
| 222 | __str.push_back('\n'); | 223 | __print::__handle_output_error(__stream); |
| 223 | |||
| 224 | size_t __size = fwrite(__str.data(), 1, __str.size(), __stream); | ||
| 225 | if (__size < __str.size()) { | ||
| 226 | if (std::feof(__stream)) | ||
| 227 | std::__throw_system_error(EIO, "EOF while writing the formatted output"); | ||
| 228 | std::__throw_system_error(std::ferror(__stream), "failed to write formatted output"); | ||
| 229 | } | ||
| 230 | } | 224 | } |
| 231 | 225 | ||
| 232 | # if _LIBCPP_HAS_UNICODE | 226 | # if _LIBCPP_HAS_UNICODE |
| ... | @@ -236,27 +230,10 @@ __vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args, bool | ... | @@ -236,27 +230,10 @@ __vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args, bool |
| 236 | // terminal when the output is redirected. Typically during testing the | 230 | // terminal when the output is redirected. Typically during testing the |
| 237 | // output is redirected to be able to capture it. This makes it hard to | 231 | // output is redirected to be able to capture it. This makes it hard to |
| 238 | // test this code path. | 232 | // test this code path. |
| 239 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | ||
| 240 | _LIBCPP_HIDE_FROM_ABI inline void | ||
| 241 | __vprint_unicode_posix(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl, bool __is_terminal) { | ||
| 242 | // TODO PRINT Should flush errors throw too? | ||
| 243 | if (__is_terminal) | ||
| 244 | std::fflush(__stream); | ||
| 245 | |||
| 246 | __print::__vprint_nonunicode(__stream, __fmt, __args, __write_nl); | ||
| 247 | } | ||
| 248 | 233 | ||
| 249 | # if _LIBCPP_HAS_WIDE_CHARACTERS | 234 | # if _LIBCPP_HAS_WIDE_CHARACTERS |
| 250 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | 235 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). |
| 251 | _LIBCPP_HIDE_FROM_ABI inline void | 236 | _LIBCPP_HIDE_FROM_ABI inline void __output_unicode_windows([[maybe_unused]] FILE* __stream, string_view __text) { |
| 252 | __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl, bool __is_terminal) { | ||
| 253 | if (!__is_terminal) | ||
| 254 | return __print::__vprint_nonunicode(__stream, __fmt, __args, __write_nl); | ||
| 255 | |||
| 256 | // TODO PRINT Should flush errors throw too? | ||
| 257 | std::fflush(__stream); | ||
| 258 | |||
| 259 | string __str = std::vformat(__fmt, __args); | ||
| 260 | // UTF-16 uses the same number or less code units than UTF-8. | 237 | // UTF-16 uses the same number or less code units than UTF-8. |
| 261 | // However the size of the code unit is 16 bits instead of 8 bits. | 238 | // However the size of the code unit is 16 bits instead of 8 bits. |
| 262 | // | 239 | // |
| ... | @@ -266,11 +243,8 @@ __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args, | ... | @@ -266,11 +243,8 @@ __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args, |
| 266 | // the final size might be larger when the estimate is wrong. | 243 | // the final size might be larger when the estimate is wrong. |
| 267 | // | 244 | // |
| 268 | // TODO PRINT profile and improve the speed of this code. | 245 | // TODO PRINT profile and improve the speed of this code. |
| 269 | __format::__retarget_buffer<wchar_t> __buffer{__str.size()}; | 246 | __format::__retarget_buffer<wchar_t> __buffer{__text.size()}; |
| 270 | __unicode::__transcode(__str.begin(), __str.end(), __buffer.__make_output_iterator()); | 247 | __unicode::__transcode(__text.begin(), __text.end(), __buffer.__make_output_iterator()); |
| 271 | if (__write_nl) | ||
| 272 | __buffer.push_back(L'\n'); | ||
| 273 | |||
| 274 | [[maybe_unused]] wstring_view __view = __buffer.__view(); | 248 | [[maybe_unused]] wstring_view __view = __buffer.__view(); |
| 275 | 249 | ||
| 276 | // The macro _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION is used to change | 250 | // The macro _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION is used to change |
| ... | @@ -287,11 +261,7 @@ __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args, | ... | @@ -287,11 +261,7 @@ __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args, |
| 287 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 261 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 288 | 262 | ||
| 289 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | 263 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). |
| 290 | _LIBCPP_HIDE_FROM_ABI inline void | 264 | _LIBCPP_HIDE_FROM_ABI inline void __output_unicode([[maybe_unused]] FILE* __stream, string_view __text) { |
| 291 | __vprint_unicode([[maybe_unused]] FILE* __stream, | ||
| 292 | [[maybe_unused]] string_view __fmt, | ||
| 293 | [[maybe_unused]] format_args __args, | ||
| 294 | [[maybe_unused]] bool __write_nl) { | ||
| 295 | _LIBCPP_ASSERT_NON_NULL(__stream, "__stream must be a valid pointer to an output C stream"); | 265 | _LIBCPP_ASSERT_NON_NULL(__stream, "__stream must be a valid pointer to an output C stream"); |
| 296 | 266 | ||
| 297 | // [print.fun] | 267 | // [print.fun] |
| ... | @@ -302,9 +272,6 @@ __vprint_unicode([[maybe_unused]] FILE* __stream, | ... | @@ -302,9 +272,6 @@ __vprint_unicode([[maybe_unused]] FILE* __stream, |
| 302 | // Otherwise writes out to stream unchanged. If the native | 272 | // Otherwise writes out to stream unchanged. If the native |
| 303 | // Unicode API is used, the function flushes stream before | 273 | // Unicode API is used, the function flushes stream before |
| 304 | // writing out. | 274 | // writing out. |
| 305 | // 8 - Throws: Any exception thrown by the call to vformat | ||
| 306 | // ([format.err.report]). system_error if writing to the terminal | ||
| 307 | // or stream fails. May throw bad_alloc. | ||
| 308 | // 9 - Recommended practice: If invoking the native Unicode API | 275 | // 9 - Recommended practice: If invoking the native Unicode API |
| 309 | // requires transcoding, implementations should substitute | 276 | // requires transcoding, implementations should substitute |
| 310 | // invalid code units with U+FFFD replacement character per the | 277 | // invalid code units with U+FFFD replacement character per the |
| ... | @@ -316,9 +283,15 @@ __vprint_unicode([[maybe_unused]] FILE* __stream, | ... | @@ -316,9 +283,15 @@ __vprint_unicode([[maybe_unused]] FILE* __stream, |
| 316 | // Windows there is a different API. This API requires transcoding. | 283 | // Windows there is a different API. This API requires transcoding. |
| 317 | 284 | ||
| 318 | # ifndef _LIBCPP_WIN32API | 285 | # ifndef _LIBCPP_WIN32API |
| 319 | __print::__vprint_unicode_posix(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream)); | 286 | __print::__output_nonunicode(__stream, __text); |
| 320 | # elif _LIBCPP_HAS_WIDE_CHARACTERS | 287 | # elif _LIBCPP_HAS_WIDE_CHARACTERS |
| 321 | __print::__vprint_unicode_windows(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream)); | 288 | if (__print::__is_terminal(__stream)) { |
| 289 | // TODO PRINT Should flush errors throw too? | ||
| 290 | std::fflush(__stream); | ||
| 291 | __print::__output_unicode_windows(__stream, __text); | ||
| 292 | } else { | ||
| 293 | __print::__output_nonunicode(__stream, __text); | ||
| 294 | } | ||
| 322 | # else | 295 | # else |
| 323 | # error "Windows builds with wchar_t disabled are not supported." | 296 | # error "Windows builds with wchar_t disabled are not supported." |
| 324 | # endif | 297 | # endif |
| ... | @@ -329,51 +302,54 @@ __vprint_unicode([[maybe_unused]] FILE* __stream, | ... | @@ -329,51 +302,54 @@ __vprint_unicode([[maybe_unused]] FILE* __stream, |
| 329 | } // namespace __print | 302 | } // namespace __print |
| 330 | 303 | ||
| 331 | template <class... _Args> | 304 | template <class... _Args> |
| 332 | _LIBCPP_HIDE_FROM_ABI void | 305 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE void |
| 333 | print(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, format_string<_Args...> __fmt, _Args&&... __args) { | 306 | print(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, format_string<_Args...> __fmt, _Args&&... __args) { |
| 307 | auto __result = std::vformat(__fmt.get(), std::make_format_args(__args...)); | ||
| 334 | # if _LIBCPP_HAS_UNICODE | 308 | # if _LIBCPP_HAS_UNICODE |
| 335 | if constexpr (__print::__use_unicode_execution_charset) | 309 | if constexpr (__print::__use_unicode_execution_charset) |
| 336 | __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), false); | 310 | __print::__output_unicode(__stream, __result); |
| 337 | else | 311 | else |
| 338 | __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), false); | 312 | __print::__output_nonunicode(__stream, __result); |
| 339 | # else // _LIBCPP_HAS_UNICODE | 313 | # else // _LIBCPP_HAS_UNICODE |
| 340 | __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), false); | 314 | __print::__output_nonunicode(__stream, __result); |
| 341 | # endif // _LIBCPP_HAS_UNICODE | 315 | # endif // _LIBCPP_HAS_UNICODE |
| 342 | } | 316 | } |
| 343 | 317 | ||
| 344 | template <class... _Args> | 318 | template <class... _Args> |
| 345 | _LIBCPP_HIDE_FROM_ABI void print(format_string<_Args...> __fmt, _Args&&... __args) { | 319 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE void print(format_string<_Args...> __fmt, _Args&&... __args) { |
| 346 | std::print(stdout, __fmt, std::forward<_Args>(__args)...); | 320 | std::print(stdout, __fmt, std::forward<_Args>(__args)...); |
| 347 | } | 321 | } |
| 348 | 322 | ||
| 349 | template <class... _Args> | 323 | template <class... _Args> |
| 350 | _LIBCPP_HIDE_FROM_ABI void | 324 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE void |
| 351 | println(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, format_string<_Args...> __fmt, _Args&&... __args) { | 325 | println(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, format_string<_Args...> __fmt, _Args&&... __args) { |
| 326 | auto __result = std::vformat(__fmt.get(), std::make_format_args(__args...)); | ||
| 327 | __result.push_back('\n'); | ||
| 352 | # if _LIBCPP_HAS_UNICODE | 328 | # if _LIBCPP_HAS_UNICODE |
| 353 | // Note the wording in the Standard is inefficient. The output of | 329 | // Note the wording in the Standard is inefficient. The output of |
| 354 | // std::format is a std::string which is then copied. This solution | 330 | // std::format is a std::string which is then copied. This solution |
| 355 | // just appends a newline at the end of the output. | 331 | // just appends a newline at the end of the output. |
| 356 | if constexpr (__print::__use_unicode_execution_charset) | 332 | if constexpr (__print::__use_unicode_execution_charset) |
| 357 | __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), true); | 333 | __print::__output_unicode(__stream, __result); |
| 358 | else | 334 | else |
| 359 | __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), true); | 335 | __print::__output_nonunicode(__stream, __result); |
| 360 | # else // _LIBCPP_HAS_UNICODE | 336 | # else // _LIBCPP_HAS_UNICODE |
| 361 | __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), true); | 337 | __print::__output_nonunicode(__stream, __result); |
| 362 | # endif // _LIBCPP_HAS_UNICODE | 338 | # endif // _LIBCPP_HAS_UNICODE |
| 363 | } | 339 | } |
| 364 | 340 | ||
| 365 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | 341 | template <class _Void = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). |
| 366 | _LIBCPP_HIDE_FROM_ABI inline void println(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream) { | 342 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE inline void println(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream) { |
| 367 | std::print(__stream, "\n"); | 343 | std::print(__stream, (_Void(), "\n")); |
| 368 | } | 344 | } |
| 369 | 345 | ||
| 370 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | 346 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). |
| 371 | _LIBCPP_HIDE_FROM_ABI inline void println() { | 347 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE inline void println() { |
| 372 | println(stdout); | 348 | println(stdout); |
| 373 | } | 349 | } |
| 374 | 350 | ||
| 375 | template <class... _Args> | 351 | template <class... _Args> |
| 376 | _LIBCPP_HIDE_FROM_ABI void println(format_string<_Args...> __fmt, _Args&&... __args) { | 352 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE void println(format_string<_Args...> __fmt, _Args&&... __args) { |
| 377 | std::println(stdout, __fmt, std::forward<_Args>(__args)...); | 353 | std::println(stdout, __fmt, std::forward<_Args>(__args)...); |
| 378 | } | 354 | } |
| 379 | 355 | ||
| ... | @@ -381,7 +357,7 @@ _LIBCPP_HIDE_FROM_ABI void println(format_string<_Args...> __fmt, _Args&&... __a | ... | @@ -381,7 +357,7 @@ _LIBCPP_HIDE_FROM_ABI void println(format_string<_Args...> __fmt, _Args&&... __a |
| 381 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | 357 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). |
| 382 | _LIBCPP_HIDE_FROM_ABI inline void | 358 | _LIBCPP_HIDE_FROM_ABI inline void |
| 383 | vprint_unicode(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, string_view __fmt, format_args __args) { | 359 | vprint_unicode(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, string_view __fmt, format_args __args) { |
| 384 | __print::__vprint_unicode(__stream, __fmt, __args, false); | 360 | __print::__output_unicode(__stream, std::vformat(__fmt, __args)); |
| 385 | } | 361 | } |
| 386 | 362 | ||
| 387 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | 363 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). |
| ... | @@ -394,7 +370,7 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(string_view __fmt, format_args | ... | @@ -394,7 +370,7 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(string_view __fmt, format_args |
| 394 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | 370 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). |
| 395 | _LIBCPP_HIDE_FROM_ABI inline void | 371 | _LIBCPP_HIDE_FROM_ABI inline void |
| 396 | vprint_nonunicode(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, string_view __fmt, format_args __args) { | 372 | vprint_nonunicode(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, string_view __fmt, format_args __args) { |
| 397 | __print::__vprint_nonunicode(__stream, __fmt, __args, false); | 373 | __print::__output_nonunicode(__stream, std::vformat(__fmt, __args)); |
| 398 | } | 374 | } |
| 399 | 375 | ||
| 400 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). | 376 | template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). |
| ... | @@ -402,10 +378,10 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(string_view __fmt, format_ar | ... | @@ -402,10 +378,10 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(string_view __fmt, format_ar |
| 402 | std::vprint_nonunicode(stdout, __fmt, __args); | 378 | std::vprint_nonunicode(stdout, __fmt, __args); |
| 403 | } | 379 | } |
| 404 | 380 | ||
| 405 | # endif // _LIBCPP_STD_VER >= 23 | ||
| 406 | |||
| 407 | _LIBCPP_END_NAMESPACE_STD | 381 | _LIBCPP_END_NAMESPACE_STD |
| 408 | 382 | ||
| 383 | # endif // _LIBCPP_STD_VER >= 23 | ||
| 384 | |||
| 409 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 385 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 410 | 386 | ||
| 411 | #endif // _LIBCPP_PRINT | 387 | #endif // _LIBCPP_PRINT |
lib/libcxx/include/queue+1-1| ... | @@ -970,7 +970,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -970,7 +970,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 970 | 970 | ||
| 971 | _LIBCPP_POP_MACROS | 971 | _LIBCPP_POP_MACROS |
| 972 | 972 | ||
| 973 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 973 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 974 | # include <concepts> | 974 | # include <concepts> |
| 975 | # include <cstdlib> | 975 | # include <cstdlib> |
| 976 | # include <functional> | 976 | # include <functional> |
lib/libcxx/include/random+1-1| ... | @@ -1726,7 +1726,7 @@ class piecewise_linear_distribution | ... | @@ -1726,7 +1726,7 @@ class piecewise_linear_distribution |
| 1726 | # pragma GCC system_header | 1726 | # pragma GCC system_header |
| 1727 | # endif | 1727 | # endif |
| 1728 | 1728 | ||
| 1729 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1729 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1730 | # include <algorithm> | 1730 | # include <algorithm> |
| 1731 | # include <climits> | 1731 | # include <climits> |
| 1732 | # include <cmath> | 1732 | # include <cmath> |
lib/libcxx/include/ranges+39-1| ... | @@ -201,6 +201,16 @@ namespace std::ranges { | ... | @@ -201,6 +201,16 @@ namespace std::ranges { |
| 201 | inline constexpr unspecified filter = unspecified; | 201 | inline constexpr unspecified filter = unspecified; |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | // [range.concat], concat view | ||
| 205 | template <input_range... Views> | ||
| 206 | requires (view<Views> && ...) && (sizeof...(Views) > 0) && | ||
| 207 | concatable<Views...> | ||
| 208 | class concat_view; | ||
| 209 | |||
| 210 | namespace views { | ||
| 211 | inline constexpr unspecified concat = unspecified; | ||
| 212 | } | ||
| 213 | |||
| 204 | // [range.drop], drop view | 214 | // [range.drop], drop view |
| 205 | template<view V> | 215 | template<view V> |
| 206 | class drop_view; | 216 | class drop_view; |
| ... | @@ -337,6 +347,17 @@ namespace std::ranges { | ... | @@ -337,6 +347,17 @@ namespace std::ranges { |
| 337 | 347 | ||
| 338 | namespace views { template<class T> inline constexpr unspecified istream = unspecified; } | 348 | namespace views { template<class T> inline constexpr unspecified istream = unspecified; } |
| 339 | 349 | ||
| 350 | // [range.enumerate], enumerate view | ||
| 351 | template<view View> | ||
| 352 | requires see below | ||
| 353 | class enumerate_view; // since C++23 | ||
| 354 | |||
| 355 | template<class View> | ||
| 356 | constexpr bool enable_borrowed_range<enumerate_view<View>> = // since C++23 | ||
| 357 | enable_borrowed_range<View>; | ||
| 358 | |||
| 359 | namespace views { inline constexpr unspecified enumerate = unspecified; } // since C++23 | ||
| 360 | |||
| 340 | // [range.zip], zip view | 361 | // [range.zip], zip view |
| 341 | template<input_range... Views> | 362 | template<input_range... Views> |
| 342 | requires (view<Views> && ...) && (sizeof...(Views) > 0) | 363 | requires (view<Views> && ...) && (sizeof...(Views) > 0) |
| ... | @@ -396,6 +417,17 @@ namespace std::ranges { | ... | @@ -396,6 +417,17 @@ namespace std::ranges { |
| 396 | class chunk_by_view; // C++23 | 417 | class chunk_by_view; // C++23 |
| 397 | 418 | ||
| 398 | namespace views { inline constexpr unspecified chunk_by = unspecified; } // C++23 | 419 | namespace views { inline constexpr unspecified chunk_by = unspecified; } // C++23 |
| 420 | |||
| 421 | // [range.stride.view], stride view | ||
| 422 | template<input_range V> | ||
| 423 | requires view<V> | ||
| 424 | class stride_view; // C++23 | ||
| 425 | |||
| 426 | template<class V> | ||
| 427 | constexpr bool enable_borrowed_range<stride_view<V>> = | ||
| 428 | enable_borrowed_range<V>; // C++23 | ||
| 429 | |||
| 430 | namespace views { inline constexpr unspecified stride = unspecified; } // C++23 | ||
| 399 | } | 431 | } |
| 400 | 432 | ||
| 401 | namespace std { | 433 | namespace std { |
| ... | @@ -482,14 +514,20 @@ namespace std { | ... | @@ -482,14 +514,20 @@ namespace std { |
| 482 | # include <__ranges/adjacent_view.h> | 514 | # include <__ranges/adjacent_view.h> |
| 483 | # include <__ranges/as_rvalue_view.h> | 515 | # include <__ranges/as_rvalue_view.h> |
| 484 | # include <__ranges/chunk_by_view.h> | 516 | # include <__ranges/chunk_by_view.h> |
| 517 | # include <__ranges/enumerate_view.h> | ||
| 485 | # include <__ranges/from_range.h> | 518 | # include <__ranges/from_range.h> |
| 486 | # include <__ranges/join_with_view.h> | 519 | # include <__ranges/join_with_view.h> |
| 487 | # include <__ranges/repeat_view.h> | 520 | # include <__ranges/repeat_view.h> |
| 521 | # include <__ranges/stride_view.h> | ||
| 488 | # include <__ranges/to.h> | 522 | # include <__ranges/to.h> |
| 489 | # include <__ranges/zip_transform_view.h> | 523 | # include <__ranges/zip_transform_view.h> |
| 490 | # include <__ranges/zip_view.h> | 524 | # include <__ranges/zip_view.h> |
| 491 | # endif | 525 | # endif |
| 492 | 526 | ||
| 527 | # if _LIBCPP_STD_VER >= 26 | ||
| 528 | # include <__ranges/concat_view.h> | ||
| 529 | # endif | ||
| 530 | |||
| 493 | # include <version> | 531 | # include <version> |
| 494 | 532 | ||
| 495 | // standard-mandated includes | 533 | // standard-mandated includes |
| ... | @@ -507,7 +545,7 @@ namespace std { | ... | @@ -507,7 +545,7 @@ namespace std { |
| 507 | # pragma GCC system_header | 545 | # pragma GCC system_header |
| 508 | # endif | 546 | # endif |
| 509 | 547 | ||
| 510 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 548 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 511 | # include <cstdlib> | 549 | # include <cstdlib> |
| 512 | # include <iosfwd> | 550 | # include <iosfwd> |
| 513 | # include <type_traits> | 551 | # include <type_traits> |
lib/libcxx/include/ratio+1-1| ... | @@ -491,7 +491,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -491,7 +491,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 491 | 491 | ||
| 492 | _LIBCPP_POP_MACROS | 492 | _LIBCPP_POP_MACROS |
| 493 | 493 | ||
| 494 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 494 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 495 | # include <type_traits> | 495 | # include <type_traits> |
| 496 | # endif | 496 | # endif |
| 497 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 497 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/regex+5-2| ... | @@ -817,6 +817,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; | ... | @@ -817,6 +817,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; |
| 817 | # include <__iterator/wrap_iter.h> | 817 | # include <__iterator/wrap_iter.h> |
| 818 | # include <__locale> | 818 | # include <__locale> |
| 819 | # include <__memory/addressof.h> | 819 | # include <__memory/addressof.h> |
| 820 | # include <__memory/pointer_traits.h> | ||
| 820 | # include <__memory/shared_ptr.h> | 821 | # include <__memory/shared_ptr.h> |
| 821 | # include <__memory_resource/polymorphic_allocator.h> | 822 | # include <__memory_resource/polymorphic_allocator.h> |
| 822 | # include <__type_traits/is_swappable.h> | 823 | # include <__type_traits/is_swappable.h> |
| ... | @@ -840,6 +841,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -840,6 +841,7 @@ _LIBCPP_PUSH_MACROS |
| 840 | # define _LIBCPP_REGEX_COMPLEXITY_FACTOR 4096 | 841 | # define _LIBCPP_REGEX_COMPLEXITY_FACTOR 4096 |
| 841 | 842 | ||
| 842 | _LIBCPP_BEGIN_NAMESPACE_STD | 843 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 844 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 843 | 845 | ||
| 844 | namespace regex_constants { | 846 | namespace regex_constants { |
| 845 | 847 | ||
| ... | @@ -5167,7 +5169,7 @@ regex_search(__wrap_iter<_Iter> __first, | ... | @@ -5167,7 +5169,7 @@ regex_search(__wrap_iter<_Iter> __first, |
| 5167 | const basic_regex<_CharT, _Traits>& __e, | 5169 | const basic_regex<_CharT, _Traits>& __e, |
| 5168 | regex_constants::match_flag_type __flags = regex_constants::match_default) { | 5170 | regex_constants::match_flag_type __flags = regex_constants::match_default) { |
| 5169 | match_results<const _CharT*> __mc; | 5171 | match_results<const _CharT*> __mc; |
| 5170 | bool __r = __e.__search(__first.base(), __last.base(), __mc, __flags); | 5172 | bool __r = __e.__search(std::__to_address(__first), std::__to_address(__last), __mc, __flags); |
| 5171 | __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos); | 5173 | __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos); |
| 5172 | return __r; | 5174 | return __r; |
| 5173 | } | 5175 | } |
| ... | @@ -5807,6 +5809,7 @@ regex_replace(const _CharT* __s, | ... | @@ -5807,6 +5809,7 @@ regex_replace(const _CharT* __s, |
| 5807 | return __r; | 5809 | return __r; |
| 5808 | } | 5810 | } |
| 5809 | 5811 | ||
| 5812 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 5810 | _LIBCPP_END_NAMESPACE_STD | 5813 | _LIBCPP_END_NAMESPACE_STD |
| 5811 | 5814 | ||
| 5812 | # if _LIBCPP_STD_VER >= 17 | 5815 | # if _LIBCPP_STD_VER >= 17 |
| ... | @@ -5831,7 +5834,7 @@ _LIBCPP_POP_MACROS | ... | @@ -5831,7 +5834,7 @@ _LIBCPP_POP_MACROS |
| 5831 | 5834 | ||
| 5832 | # endif // _LIBCPP_HAS_LOCALIZATION | 5835 | # endif // _LIBCPP_HAS_LOCALIZATION |
| 5833 | 5836 | ||
| 5834 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 5837 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 5835 | # include <atomic> | 5838 | # include <atomic> |
| 5836 | # include <concepts> | 5839 | # include <concepts> |
| 5837 | # include <cstdlib> | 5840 | # include <cstdlib> |
lib/libcxx/include/scoped_allocator+5-5| ... | @@ -135,10 +135,10 @@ template <class OuterA1, class OuterA2, class... InnerAllocs> | ... | @@ -135,10 +135,10 @@ template <class OuterA1, class OuterA2, class... InnerAllocs> |
| 135 | _LIBCPP_PUSH_MACROS | 135 | _LIBCPP_PUSH_MACROS |
| 136 | # include <__undef_macros> | 136 | # include <__undef_macros> |
| 137 | 137 | ||
| 138 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 139 | |||
| 140 | # if !defined(_LIBCPP_CXX03_LANG) | 138 | # if !defined(_LIBCPP_CXX03_LANG) |
| 141 | 139 | ||
| 140 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 141 | |||
| 142 | // scoped_allocator_adaptor | 142 | // scoped_allocator_adaptor |
| 143 | 143 | ||
| 144 | template <class... _Allocs> | 144 | template <class... _Allocs> |
| ... | @@ -558,13 +558,13 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const scoped_allocator_adaptor<_Out | ... | @@ -558,13 +558,13 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const scoped_allocator_adaptor<_Out |
| 558 | 558 | ||
| 559 | # endif // _LIBCPP_STD_VER <= 17 | 559 | # endif // _LIBCPP_STD_VER <= 17 |
| 560 | 560 | ||
| 561 | # endif // !defined(_LIBCPP_CXX03_LANG) | ||
| 562 | |||
| 563 | _LIBCPP_END_NAMESPACE_STD | 561 | _LIBCPP_END_NAMESPACE_STD |
| 564 | 562 | ||
| 563 | # endif // !defined(_LIBCPP_CXX03_LANG) | ||
| 564 | |||
| 565 | _LIBCPP_POP_MACROS | 565 | _LIBCPP_POP_MACROS |
| 566 | 566 | ||
| 567 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 567 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 568 | # include <atomic> | 568 | # include <atomic> |
| 569 | # include <climits> | 569 | # include <climits> |
| 570 | # include <concepts> | 570 | # include <concepts> |
lib/libcxx/include/semaphore+1-1| ... | @@ -180,7 +180,7 @@ _LIBCPP_POP_MACROS | ... | @@ -180,7 +180,7 @@ _LIBCPP_POP_MACROS |
| 180 | 180 | ||
| 181 | # endif // _LIBCPP_HAS_THREADS | 181 | # endif // _LIBCPP_HAS_THREADS |
| 182 | 182 | ||
| 183 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 183 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 184 | # include <atomic> | 184 | # include <atomic> |
| 185 | # include <cstddef> | 185 | # include <cstddef> |
| 186 | # endif | 186 | # endif |
lib/libcxx/include/set+373-214| ... | @@ -71,12 +71,12 @@ public: | ... | @@ -71,12 +71,12 @@ public: |
| 71 | const allocator_type& a); | 71 | const allocator_type& a); |
| 72 | template <class InputIterator> | 72 | template <class InputIterator> |
| 73 | set(InputIterator first, InputIterator last, const allocator_type& a) | 73 | set(InputIterator first, InputIterator last, const allocator_type& a) |
| 74 | : set(first, last, Compare(), a) {} // C++14 | 74 | : set(first, last, Compare(), a) {} |
| 75 | template<container-compatible-range<value_type> R> | 75 | template<container-compatible-range<value_type> R> |
| 76 | set(from_range_t, R&& rg, const Allocator& a)) | 76 | set(from_range_t, R&& rg, const Allocator& a)) |
| 77 | : set(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 | 77 | : set(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 |
| 78 | set(initializer_list<value_type> il, const allocator_type& a) | 78 | set(initializer_list<value_type> il, const allocator_type& a) |
| 79 | : set(il, Compare(), a) {} // C++14 | 79 | : set(il, Compare(), a) {} |
| 80 | ~set(); | 80 | ~set(); |
| 81 | 81 | ||
| 82 | set& operator=(const set& s); | 82 | set& operator=(const set& s); |
| ... | @@ -316,12 +316,12 @@ public: | ... | @@ -316,12 +316,12 @@ public: |
| 316 | const allocator_type& a); | 316 | const allocator_type& a); |
| 317 | template <class InputIterator> | 317 | template <class InputIterator> |
| 318 | multiset(InputIterator first, InputIterator last, const allocator_type& a) | 318 | multiset(InputIterator first, InputIterator last, const allocator_type& a) |
| 319 | : set(first, last, Compare(), a) {} // C++14 | 319 | : set(first, last, Compare(), a) {} |
| 320 | template<container-compatible-range<value_type> R> | 320 | template<container-compatible-range<value_type> R> |
| 321 | multiset(from_range_t, R&& rg, const Allocator& a)) | 321 | multiset(from_range_t, R&& rg, const Allocator& a)) |
| 322 | : multiset(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 | 322 | : multiset(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 |
| 323 | multiset(initializer_list<value_type> il, const allocator_type& a) | 323 | multiset(initializer_list<value_type> il, const allocator_type& a) |
| 324 | : set(il, Compare(), a) {} // C++14 | 324 | : set(il, Compare(), a) {} |
| 325 | ~multiset(); | 325 | ~multiset(); |
| 326 | 326 | ||
| 327 | multiset& operator=(const multiset& s); | 327 | multiset& operator=(const multiset& s); |
| ... | @@ -615,24 +615,27 @@ public: | ... | @@ -615,24 +615,27 @@ public: |
| 615 | template <class _Key2, class _Compare2, class _Alloc2> | 615 | template <class _Key2, class _Compare2, class _Alloc2> |
| 616 | friend class multiset; | 616 | friend class multiset; |
| 617 | 617 | ||
| 618 | _LIBCPP_HIDE_FROM_ABI set() _NOEXCEPT_( | 618 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set() _NOEXCEPT_( |
| 619 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&& | 619 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&& |
| 620 | is_nothrow_copy_constructible<key_compare>::value) | 620 | is_nothrow_copy_constructible<key_compare>::value) |
| 621 | : __tree_(value_compare()) {} | 621 | : __tree_(value_compare()) {} |
| 622 | 622 | ||
| 623 | _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp) _NOEXCEPT_( | 623 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const value_compare& __comp) _NOEXCEPT_( |
| 624 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value) | 624 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value) |
| 625 | : __tree_(__comp) {} | 625 | : __tree_(__comp) {} |
| 626 | 626 | ||
| 627 | _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) {} | 627 | _LIBCPP_HIDE_FROM_ABI |
| 628 | _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const value_compare& __comp, const allocator_type& __a) | ||
| 629 | : __tree_(__comp, __a) {} | ||
| 628 | template <class _InputIterator> | 630 | template <class _InputIterator> |
| 629 | _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare()) | 631 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 632 | set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare()) | ||
| 630 | : __tree_(__comp) { | 633 | : __tree_(__comp) { |
| 631 | insert(__f, __l); | 634 | insert(__f, __l); |
| 632 | } | 635 | } |
| 633 | 636 | ||
| 634 | template <class _InputIterator> | 637 | template <class _InputIterator> |
| 635 | _LIBCPP_HIDE_FROM_ABI | 638 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 636 | set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a) | 639 | set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a) |
| 637 | : __tree_(__comp, __a) { | 640 | : __tree_(__comp, __a) { |
| 638 | insert(__f, __l); | 641 | insert(__f, __l); |
| ... | @@ -640,7 +643,7 @@ public: | ... | @@ -640,7 +643,7 @@ public: |
| 640 | 643 | ||
| 641 | # if _LIBCPP_STD_VER >= 23 | 644 | # if _LIBCPP_STD_VER >= 23 |
| 642 | template <_ContainerCompatibleRange<value_type> _Range> | 645 | template <_ContainerCompatibleRange<value_type> _Range> |
| 643 | _LIBCPP_HIDE_FROM_ABI | 646 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 644 | set(from_range_t, | 647 | set(from_range_t, |
| 645 | _Range&& __range, | 648 | _Range&& __range, |
| 646 | const key_compare& __comp = key_compare(), | 649 | const key_compare& __comp = key_compare(), |
| ... | @@ -650,263 +653,340 @@ public: | ... | @@ -650,263 +653,340 @@ public: |
| 650 | } | 653 | } |
| 651 | # endif | 654 | # endif |
| 652 | 655 | ||
| 653 | # if _LIBCPP_STD_VER >= 14 | ||
| 654 | template <class _InputIterator> | 656 | template <class _InputIterator> |
| 655 | _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const allocator_type& __a) | 657 | _LIBCPP_HIDE_FROM_ABI |
| 658 | _LIBCPP_CONSTEXPR_SINCE_CXX26 set(_InputIterator __f, _InputIterator __l, const allocator_type& __a) | ||
| 656 | : set(__f, __l, key_compare(), __a) {} | 659 | : set(__f, __l, key_compare(), __a) {} |
| 657 | # endif | ||
| 658 | 660 | ||
| 659 | # if _LIBCPP_STD_VER >= 23 | 661 | # if _LIBCPP_STD_VER >= 23 |
| 660 | template <_ContainerCompatibleRange<value_type> _Range> | 662 | template <_ContainerCompatibleRange<value_type> _Range> |
| 661 | _LIBCPP_HIDE_FROM_ABI set(from_range_t, _Range&& __range, const allocator_type& __a) | 663 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(from_range_t, _Range&& __range, const allocator_type& __a) |
| 662 | : set(from_range, std::forward<_Range>(__range), key_compare(), __a) {} | 664 | : set(from_range, std::forward<_Range>(__range), key_compare(), __a) {} |
| 663 | # endif | 665 | # endif |
| 664 | 666 | ||
| 665 | _LIBCPP_HIDE_FROM_ABI set(const set& __s) = default; | 667 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(const set& __s) = default; |
| 666 | 668 | ||
| 667 | _LIBCPP_HIDE_FROM_ABI set& operator=(const set& __s) = default; | 669 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(const set& __s) = default; |
| 668 | 670 | ||
| 669 | # ifndef _LIBCPP_CXX03_LANG | 671 | # ifndef _LIBCPP_CXX03_LANG |
| 670 | _LIBCPP_HIDE_FROM_ABI set(set&& __s) = default; | 672 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(set&& __s) = default; |
| 671 | # endif // _LIBCPP_CXX03_LANG | 673 | # endif // _LIBCPP_CXX03_LANG |
| 672 | 674 | ||
| 673 | _LIBCPP_HIDE_FROM_ABI explicit set(const allocator_type& __a) : __tree_(__a) {} | 675 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const allocator_type& __a) : __tree_(__a) {} |
| 674 | 676 | ||
| 675 | _LIBCPP_HIDE_FROM_ABI set(const set& __s, const allocator_type& __alloc) : __tree_(__s.__tree_, __alloc) {} | 677 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(const set& __s, const allocator_type& __alloc) |
| 678 | : __tree_(__s.__tree_, __alloc) {} | ||
| 676 | 679 | ||
| 677 | # ifndef _LIBCPP_CXX03_LANG | 680 | # ifndef _LIBCPP_CXX03_LANG |
| 678 | _LIBCPP_HIDE_FROM_ABI set(set&& __s, const allocator_type& __alloc) : __tree_(std::move(__s.__tree_), __alloc) {} | 681 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(set&& __s, const allocator_type& __alloc) |
| 682 | : __tree_(std::move(__s.__tree_), __alloc) {} | ||
| 679 | 683 | ||
| 680 | _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) | 684 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 685 | set(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) | ||
| 681 | : __tree_(__comp) { | 686 | : __tree_(__comp) { |
| 682 | insert(__il.begin(), __il.end()); | 687 | insert(__il.begin(), __il.end()); |
| 683 | } | 688 | } |
| 684 | 689 | ||
| 685 | _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a) | 690 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 691 | set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a) | ||
| 686 | : __tree_(__comp, __a) { | 692 | : __tree_(__comp, __a) { |
| 687 | insert(__il.begin(), __il.end()); | 693 | insert(__il.begin(), __il.end()); |
| 688 | } | 694 | } |
| 689 | 695 | ||
| 690 | # if _LIBCPP_STD_VER >= 14 | 696 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(initializer_list<value_type> __il, const allocator_type& __a) |
| 691 | _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const allocator_type& __a) | ||
| 692 | : set(__il, key_compare(), __a) {} | 697 | : set(__il, key_compare(), __a) {} |
| 693 | # endif | ||
| 694 | 698 | ||
| 695 | _LIBCPP_HIDE_FROM_ABI set& operator=(initializer_list<value_type> __il) { | 699 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(initializer_list<value_type> __il) { |
| 696 | clear(); | 700 | clear(); |
| 697 | insert(__il.begin(), __il.end()); | 701 | insert(__il.begin(), __il.end()); |
| 698 | return *this; | 702 | return *this; |
| 699 | } | 703 | } |
| 700 | 704 | ||
| 701 | _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) = default; | 705 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(set&& __s) = default; |
| 702 | # endif // _LIBCPP_CXX03_LANG | 706 | # endif // _LIBCPP_CXX03_LANG |
| 703 | 707 | ||
| 704 | _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); } | 708 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~set() { |
| 709 | static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); | ||
| 710 | } | ||
| 705 | 711 | ||
| 706 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); } | 712 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT { |
| 707 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); } | 713 | return __tree_.begin(); |
| 708 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); } | 714 | } |
| 709 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); } | 715 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT { |
| 716 | return __tree_.begin(); | ||
| 717 | } | ||
| 718 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT { | ||
| 719 | return __tree_.end(); | ||
| 720 | } | ||
| 721 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT { | ||
| 722 | return __tree_.end(); | ||
| 723 | } | ||
| 710 | 724 | ||
| 711 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); } | 725 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT { |
| 712 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { | 726 | return reverse_iterator(end()); |
| 727 | } | ||
| 728 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator | ||
| 729 | rbegin() const _NOEXCEPT { | ||
| 713 | return const_reverse_iterator(end()); | 730 | return const_reverse_iterator(end()); |
| 714 | } | 731 | } |
| 715 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); } | 732 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT { |
| 716 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { | 733 | return reverse_iterator(begin()); |
| 734 | } | ||
| 735 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT { | ||
| 717 | return const_reverse_iterator(begin()); | 736 | return const_reverse_iterator(begin()); |
| 718 | } | 737 | } |
| 719 | 738 | ||
| 720 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); } | 739 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT { |
| 721 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); } | 740 | return begin(); |
| 722 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); } | 741 | } |
| 723 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); } | 742 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT { |
| 743 | return end(); | ||
| 744 | } | ||
| 745 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator | ||
| 746 | crbegin() const _NOEXCEPT { | ||
| 747 | return rbegin(); | ||
| 748 | } | ||
| 749 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT { | ||
| 750 | return rend(); | ||
| 751 | } | ||
| 724 | 752 | ||
| 725 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } | 753 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT { |
| 726 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); } | 754 | return __tree_.size() == 0; |
| 727 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); } | 755 | } |
| 756 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT { | ||
| 757 | return __tree_.size(); | ||
| 758 | } | ||
| 759 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT { | ||
| 760 | return __tree_.max_size(); | ||
| 761 | } | ||
| 728 | 762 | ||
| 729 | // modifiers: | 763 | // modifiers: |
| 730 | # ifndef _LIBCPP_CXX03_LANG | 764 | # ifndef _LIBCPP_CXX03_LANG |
| 731 | template <class... _Args> | 765 | template <class... _Args> |
| 732 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) { | 766 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> emplace(_Args&&... __args) { |
| 733 | return __tree_.__emplace_unique(std::forward<_Args>(__args)...); | 767 | return __tree_.__emplace_unique(std::forward<_Args>(__args)...); |
| 734 | } | 768 | } |
| 735 | template <class... _Args> | 769 | template <class... _Args> |
| 736 | _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) { | 770 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) { |
| 737 | return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...).first; | 771 | return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...).first; |
| 738 | } | 772 | } |
| 739 | # endif // _LIBCPP_CXX03_LANG | 773 | # endif // _LIBCPP_CXX03_LANG |
| 740 | 774 | ||
| 741 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__emplace_unique(__v); } | 775 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(const value_type& __v) { |
| 742 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) { | 776 | return __tree_.__emplace_unique(__v); |
| 777 | } | ||
| 778 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) { | ||
| 743 | return __tree_.__emplace_hint_unique(__p, __v).first; | 779 | return __tree_.__emplace_hint_unique(__p, __v).first; |
| 744 | } | 780 | } |
| 745 | 781 | ||
| 746 | template <class _InputIterator> | 782 | template <class _InputIterator> |
| 747 | _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) { | 783 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) { |
| 748 | __tree_.__insert_range_unique(__first, __last); | 784 | __tree_.__insert_range_unique(__first, __last); |
| 749 | } | 785 | } |
| 750 | 786 | ||
| 751 | # if _LIBCPP_STD_VER >= 23 | 787 | # if _LIBCPP_STD_VER >= 23 |
| 752 | template <_ContainerCompatibleRange<value_type> _Range> | 788 | template <_ContainerCompatibleRange<value_type> _Range> |
| 753 | _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) { | 789 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) { |
| 754 | __tree_.__insert_range_unique(ranges::begin(__range), ranges::end(__range)); | 790 | __tree_.__insert_range_unique(ranges::begin(__range), ranges::end(__range)); |
| 755 | } | 791 | } |
| 756 | # endif | 792 | # endif |
| 757 | 793 | ||
| 758 | # ifndef _LIBCPP_CXX03_LANG | 794 | # ifndef _LIBCPP_CXX03_LANG |
| 759 | _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) { | 795 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(value_type&& __v) { |
| 760 | return __tree_.__emplace_unique(std::move(__v)); | 796 | return __tree_.__emplace_unique(std::move(__v)); |
| 761 | } | 797 | } |
| 762 | 798 | ||
| 763 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) { | 799 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) { |
| 764 | return __tree_.__emplace_hint_unique(__p, std::move(__v)).first; | 800 | return __tree_.__emplace_hint_unique(__p, std::move(__v)).first; |
| 765 | } | 801 | } |
| 766 | 802 | ||
| 767 | _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); } | 803 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) { |
| 804 | insert(__il.begin(), __il.end()); | ||
| 805 | } | ||
| 768 | # endif // _LIBCPP_CXX03_LANG | 806 | # endif // _LIBCPP_CXX03_LANG |
| 769 | 807 | ||
| 770 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); } | 808 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) { return __tree_.erase(__p); } |
| 771 | _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); } | 809 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) { |
| 772 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); } | 810 | return __tree_.__erase_unique(__k); |
| 773 | _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); } | 811 | } |
| 812 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) { | ||
| 813 | return __tree_.erase(__f, __l); | ||
| 814 | } | ||
| 815 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); } | ||
| 774 | 816 | ||
| 775 | # if _LIBCPP_STD_VER >= 17 | 817 | # if _LIBCPP_STD_VER >= 17 |
| 776 | _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) { | 818 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 insert_return_type insert(node_type&& __nh) { |
| 777 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), | 819 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 778 | "node_type with incompatible allocator passed to set::insert()"); | 820 | "node_type with incompatible allocator passed to set::insert()"); |
| 779 | return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh)); | 821 | return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh)); |
| 780 | } | 822 | } |
| 781 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) { | 823 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) { |
| 782 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), | 824 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 783 | "node_type with incompatible allocator passed to set::insert()"); | 825 | "node_type with incompatible allocator passed to set::insert()"); |
| 784 | return __tree_.template __node_handle_insert_unique<node_type>(__hint, std::move(__nh)); | 826 | return __tree_.template __node_handle_insert_unique<node_type>(__hint, std::move(__nh)); |
| 785 | } | 827 | } |
| 786 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) { | 828 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) { |
| 787 | return __tree_.template __node_handle_extract<node_type>(__key); | 829 | return __tree_.template __node_handle_extract<node_type>(__key); |
| 788 | } | 830 | } |
| 789 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) { | 831 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) { |
| 790 | return __tree_.template __node_handle_extract<node_type>(__it); | 832 | return __tree_.template __node_handle_extract<node_type>(__it); |
| 791 | } | 833 | } |
| 792 | template <class _Compare2> | 834 | template <class _Compare2> |
| 793 | _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) { | 835 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>& __source) { |
| 794 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 836 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 795 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 837 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 796 | __tree_.__node_handle_merge_unique(__source.__tree_); | 838 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 797 | } | 839 | } |
| 798 | template <class _Compare2> | 840 | template <class _Compare2> |
| 799 | _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) { | 841 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>&& __source) { |
| 800 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 842 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 801 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 843 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 802 | __tree_.__node_handle_merge_unique(__source.__tree_); | 844 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 803 | } | 845 | } |
| 804 | template <class _Compare2> | 846 | template <class _Compare2> |
| 805 | _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) { | 847 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 848 | merge(multiset<key_type, _Compare2, allocator_type>& __source) { | ||
| 806 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 849 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 807 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 850 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 808 | __tree_.__node_handle_merge_unique(__source.__tree_); | 851 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 809 | } | 852 | } |
| 810 | template <class _Compare2> | 853 | template <class _Compare2> |
| 811 | _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) { | 854 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 855 | merge(multiset<key_type, _Compare2, allocator_type>&& __source) { | ||
| 812 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 856 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 813 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 857 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 814 | __tree_.__node_handle_merge_unique(__source.__tree_); | 858 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 815 | } | 859 | } |
| 816 | # endif | 860 | # endif |
| 817 | 861 | ||
| 818 | _LIBCPP_HIDE_FROM_ABI void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__s.__tree_); } | 862 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { |
| 863 | __tree_.swap(__s.__tree_); | ||
| 864 | } | ||
| 819 | 865 | ||
| 820 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); } | 866 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT { |
| 821 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); } | 867 | return __tree_.__alloc(); |
| 822 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); } | 868 | } |
| 869 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { | ||
| 870 | return __tree_.value_comp(); | ||
| 871 | } | ||
| 872 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const { | ||
| 873 | return __tree_.value_comp(); | ||
| 874 | } | ||
| 823 | 875 | ||
| 824 | // set operations: | 876 | // set operations: |
| 825 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); } | 877 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) { |
| 826 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); } | 878 | return __tree_.find(__k); |
| 879 | } | ||
| 880 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const { | ||
| 881 | return __tree_.find(__k); | ||
| 882 | } | ||
| 827 | # if _LIBCPP_STD_VER >= 14 | 883 | # if _LIBCPP_STD_VER >= 14 |
| 828 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 884 | template <typename _K2, |
| 829 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { | 885 | class _Comp = _Compare, |
| 886 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 887 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) { | ||
| 830 | return __tree_.find(__k); | 888 | return __tree_.find(__k); |
| 831 | } | 889 | } |
| 832 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 890 | template <typename _K2, |
| 833 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { | 891 | class _Comp = _Compare, |
| 892 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 893 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const { | ||
| 834 | return __tree_.find(__k); | 894 | return __tree_.find(__k); |
| 835 | } | 895 | } |
| 836 | # endif | 896 | # endif |
| 837 | 897 | ||
| 838 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { | 898 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const { |
| 839 | return __tree_.__count_unique(__k); | 899 | return __tree_.__count_unique(__k); |
| 840 | } | 900 | } |
| 841 | # if _LIBCPP_STD_VER >= 14 | 901 | # if _LIBCPP_STD_VER >= 14 |
| 842 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 902 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 843 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { | 903 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const { |
| 844 | return __tree_.__count_multi(__k); | 904 | return __tree_.__count_multi(__k); |
| 845 | } | 905 | } |
| 846 | # endif | 906 | # endif |
| 847 | 907 | ||
| 848 | # if _LIBCPP_STD_VER >= 20 | 908 | # if _LIBCPP_STD_VER >= 20 |
| 849 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } | 909 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const { |
| 850 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 910 | return find(__k) != end(); |
| 851 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { | 911 | } |
| 912 | template <typename _K2, | ||
| 913 | class _Comp = _Compare, | ||
| 914 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 915 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const { | ||
| 852 | return find(__k) != end(); | 916 | return find(__k) != end(); |
| 853 | } | 917 | } |
| 854 | # endif // _LIBCPP_STD_VER >= 20 | 918 | # endif // _LIBCPP_STD_VER >= 20 |
| 855 | 919 | ||
| 856 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { | 920 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) { |
| 857 | return __tree_.__lower_bound_unique(__k); | 921 | return __tree_.__lower_bound_unique(__k); |
| 858 | } | 922 | } |
| 859 | 923 | ||
| 860 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { | 924 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 925 | lower_bound(const key_type& __k) const { | ||
| 861 | return __tree_.__lower_bound_unique(__k); | 926 | return __tree_.__lower_bound_unique(__k); |
| 862 | } | 927 | } |
| 863 | 928 | ||
| 864 | // The transparent versions of the lookup functions use the _multi version, since a non-element key is allowed to | 929 | // The transparent versions of the lookup functions use the _multi version, since a non-element key is allowed to |
| 865 | // match multiple elements. | 930 | // match multiple elements. |
| 866 | # if _LIBCPP_STD_VER >= 14 | 931 | # if _LIBCPP_STD_VER >= 14 |
| 867 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 932 | template <typename _K2, |
| 868 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) { | 933 | class _Comp = _Compare, |
| 934 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 935 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) { | ||
| 869 | return __tree_.__lower_bound_multi(__k); | 936 | return __tree_.__lower_bound_multi(__k); |
| 870 | } | 937 | } |
| 871 | 938 | ||
| 872 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 939 | template <typename _K2, |
| 873 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const { | 940 | class _Comp = _Compare, |
| 941 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 942 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator | ||
| 943 | lower_bound(const _K2& __k) const { | ||
| 874 | return __tree_.__lower_bound_multi(__k); | 944 | return __tree_.__lower_bound_multi(__k); |
| 875 | } | 945 | } |
| 876 | # endif | 946 | # endif |
| 877 | 947 | ||
| 878 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { | 948 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) { |
| 879 | return __tree_.__upper_bound_unique(__k); | 949 | return __tree_.__upper_bound_unique(__k); |
| 880 | } | 950 | } |
| 881 | 951 | ||
| 882 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { | 952 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 953 | upper_bound(const key_type& __k) const { | ||
| 883 | return __tree_.__upper_bound_unique(__k); | 954 | return __tree_.__upper_bound_unique(__k); |
| 884 | } | 955 | } |
| 885 | 956 | ||
| 886 | # if _LIBCPP_STD_VER >= 14 | 957 | # if _LIBCPP_STD_VER >= 14 |
| 887 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 958 | template <typename _K2, |
| 888 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) { | 959 | class _Comp = _Compare, |
| 960 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 961 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) { | ||
| 889 | return __tree_.__upper_bound_multi(__k); | 962 | return __tree_.__upper_bound_multi(__k); |
| 890 | } | 963 | } |
| 891 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 964 | template <typename _K2, |
| 892 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const { | 965 | class _Comp = _Compare, |
| 966 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 967 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator | ||
| 968 | upper_bound(const _K2& __k) const { | ||
| 893 | return __tree_.__upper_bound_multi(__k); | 969 | return __tree_.__upper_bound_multi(__k); |
| 894 | } | 970 | } |
| 895 | # endif | 971 | # endif |
| 896 | 972 | ||
| 897 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) { | 973 | [[__nodiscard__]] |
| 974 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) { | ||
| 898 | return __tree_.__equal_range_unique(__k); | 975 | return __tree_.__equal_range_unique(__k); |
| 899 | } | 976 | } |
| 900 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const { | 977 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator> |
| 978 | equal_range(const key_type& __k) const { | ||
| 901 | return __tree_.__equal_range_unique(__k); | 979 | return __tree_.__equal_range_unique(__k); |
| 902 | } | 980 | } |
| 903 | # if _LIBCPP_STD_VER >= 14 | 981 | # if _LIBCPP_STD_VER >= 14 |
| 904 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 982 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 905 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { | 983 | [[__nodiscard__]] |
| 984 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) { | ||
| 906 | return __tree_.__equal_range_multi(__k); | 985 | return __tree_.__equal_range_multi(__k); |
| 907 | } | 986 | } |
| 908 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 987 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 909 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { | 988 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator> |
| 989 | equal_range(const _K2& __k) const { | ||
| 910 | return __tree_.__equal_range_multi(__k); | 990 | return __tree_.__equal_range_multi(__k); |
| 911 | } | 991 | } |
| 912 | # endif | 992 | # endif |
| ... | @@ -969,7 +1049,7 @@ struct __specialized_algorithm<_Alg, __single_range<set<_Key, _Compare, _Allocat | ... | @@ -969,7 +1049,7 @@ struct __specialized_algorithm<_Alg, __single_range<set<_Key, _Compare, _Allocat |
| 969 | 1049 | ||
| 970 | // set's begin() and end() are identical with and without const qualification | 1050 | // set's begin() and end() are identical with and without const qualification |
| 971 | template <class... _Args> | 1051 | template <class... _Args> |
| 972 | _LIBCPP_HIDE_FROM_ABI static auto operator()(const __set& __set, _Args&&... __args) { | 1052 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto operator()(const __set& __set, _Args&&... __args) { |
| 973 | return __specialized_algorithm<_Alg, __single_range<typename __set::__base>>()( | 1053 | return __specialized_algorithm<_Alg, __single_range<typename __set::__base>>()( |
| 974 | __set.__tree_, std::forward<_Args>(__args)...); | 1054 | __set.__tree_, std::forward<_Args>(__args)...); |
| 975 | } | 1055 | } |
| ... | @@ -977,7 +1057,7 @@ struct __specialized_algorithm<_Alg, __single_range<set<_Key, _Compare, _Allocat | ... | @@ -977,7 +1057,7 @@ struct __specialized_algorithm<_Alg, __single_range<set<_Key, _Compare, _Allocat |
| 977 | # endif | 1057 | # endif |
| 978 | 1058 | ||
| 979 | template <class _Key, class _Compare, class _Allocator> | 1059 | template <class _Key, class _Compare, class _Allocator> |
| 980 | inline _LIBCPP_HIDE_FROM_ABI bool | 1060 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 981 | operator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { | 1061 | operator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { |
| 982 | return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); | 1062 | return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); |
| 983 | } | 1063 | } |
| ... | @@ -985,31 +1065,31 @@ operator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, | ... | @@ -985,31 +1065,31 @@ operator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, |
| 985 | # if _LIBCPP_STD_VER <= 17 | 1065 | # if _LIBCPP_STD_VER <= 17 |
| 986 | 1066 | ||
| 987 | template <class _Key, class _Compare, class _Allocator> | 1067 | template <class _Key, class _Compare, class _Allocator> |
| 988 | inline _LIBCPP_HIDE_FROM_ABI bool | 1068 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 989 | operator<(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { | 1069 | operator<(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { |
| 990 | return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); | 1070 | return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); |
| 991 | } | 1071 | } |
| 992 | 1072 | ||
| 993 | template <class _Key, class _Compare, class _Allocator> | 1073 | template <class _Key, class _Compare, class _Allocator> |
| 994 | inline _LIBCPP_HIDE_FROM_ABI bool | 1074 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 995 | operator!=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { | 1075 | operator!=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { |
| 996 | return !(__x == __y); | 1076 | return !(__x == __y); |
| 997 | } | 1077 | } |
| 998 | 1078 | ||
| 999 | template <class _Key, class _Compare, class _Allocator> | 1079 | template <class _Key, class _Compare, class _Allocator> |
| 1000 | inline _LIBCPP_HIDE_FROM_ABI bool | 1080 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1001 | operator>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { | 1081 | operator>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { |
| 1002 | return __y < __x; | 1082 | return __y < __x; |
| 1003 | } | 1083 | } |
| 1004 | 1084 | ||
| 1005 | template <class _Key, class _Compare, class _Allocator> | 1085 | template <class _Key, class _Compare, class _Allocator> |
| 1006 | inline _LIBCPP_HIDE_FROM_ABI bool | 1086 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1007 | operator>=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { | 1087 | operator>=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { |
| 1008 | return !(__x < __y); | 1088 | return !(__x < __y); |
| 1009 | } | 1089 | } |
| 1010 | 1090 | ||
| 1011 | template <class _Key, class _Compare, class _Allocator> | 1091 | template <class _Key, class _Compare, class _Allocator> |
| 1012 | inline _LIBCPP_HIDE_FROM_ABI bool | 1092 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1013 | operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { | 1093 | operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { |
| 1014 | return !(__y < __x); | 1094 | return !(__y < __x); |
| 1015 | } | 1095 | } |
| ... | @@ -1017,7 +1097,7 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, | ... | @@ -1017,7 +1097,7 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, |
| 1017 | # else // _LIBCPP_STD_VER <= 17 | 1097 | # else // _LIBCPP_STD_VER <= 17 |
| 1018 | 1098 | ||
| 1019 | template <class _Key, class _Compare, class _Allocator> | 1099 | template <class _Key, class _Compare, class _Allocator> |
| 1020 | _LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key> | 1100 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<_Key> |
| 1021 | operator<=>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { | 1101 | operator<=>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { |
| 1022 | return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); | 1102 | return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); |
| 1023 | } | 1103 | } |
| ... | @@ -1026,14 +1106,14 @@ operator<=>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare | ... | @@ -1026,14 +1106,14 @@ operator<=>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare |
| 1026 | 1106 | ||
| 1027 | // specialized algorithms: | 1107 | // specialized algorithms: |
| 1028 | template <class _Key, class _Compare, class _Allocator> | 1108 | template <class _Key, class _Compare, class _Allocator> |
| 1029 | inline _LIBCPP_HIDE_FROM_ABI void swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y) | 1109 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1030 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { | 1110 | swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { |
| 1031 | __x.swap(__y); | 1111 | __x.swap(__y); |
| 1032 | } | 1112 | } |
| 1033 | 1113 | ||
| 1034 | # if _LIBCPP_STD_VER >= 20 | 1114 | # if _LIBCPP_STD_VER >= 20 |
| 1035 | template <class _Key, class _Compare, class _Allocator, class _Predicate> | 1115 | template <class _Key, class _Compare, class _Allocator, class _Predicate> |
| 1036 | inline _LIBCPP_HIDE_FROM_ABI typename set<_Key, _Compare, _Allocator>::size_type | 1116 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename set<_Key, _Compare, _Allocator>::size_type |
| 1037 | erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) { | 1117 | erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) { |
| 1038 | return std::__libcpp_erase_if_container(__c, __pred); | 1118 | return std::__libcpp_erase_if_container(__c, __pred); |
| 1039 | } | 1119 | } |
| ... | @@ -1092,31 +1172,32 @@ public: | ... | @@ -1092,31 +1172,32 @@ public: |
| 1092 | friend class multiset; | 1172 | friend class multiset; |
| 1093 | 1173 | ||
| 1094 | // construct/copy/destroy: | 1174 | // construct/copy/destroy: |
| 1095 | _LIBCPP_HIDE_FROM_ABI multiset() _NOEXCEPT_( | 1175 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset() _NOEXCEPT_( |
| 1096 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&& | 1176 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&& |
| 1097 | is_nothrow_copy_constructible<key_compare>::value) | 1177 | is_nothrow_copy_constructible<key_compare>::value) |
| 1098 | : __tree_(value_compare()) {} | 1178 | : __tree_(value_compare()) {} |
| 1099 | 1179 | ||
| 1100 | _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp) _NOEXCEPT_( | 1180 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multiset(const value_compare& __comp) _NOEXCEPT_( |
| 1101 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value) | 1181 | is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value) |
| 1102 | : __tree_(__comp) {} | 1182 | : __tree_(__comp) {} |
| 1103 | 1183 | ||
| 1104 | _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp, const allocator_type& __a) | 1184 | _LIBCPP_HIDE_FROM_ABI |
| 1185 | _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multiset(const value_compare& __comp, const allocator_type& __a) | ||
| 1105 | : __tree_(__comp, __a) {} | 1186 | : __tree_(__comp, __a) {} |
| 1106 | template <class _InputIterator> | 1187 | template <class _InputIterator> |
| 1107 | _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare()) | 1188 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1189 | multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare()) | ||
| 1108 | : __tree_(__comp) { | 1190 | : __tree_(__comp) { |
| 1109 | insert(__f, __l); | 1191 | insert(__f, __l); |
| 1110 | } | 1192 | } |
| 1111 | 1193 | ||
| 1112 | # if _LIBCPP_STD_VER >= 14 | ||
| 1113 | template <class _InputIterator> | 1194 | template <class _InputIterator> |
| 1114 | _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a) | 1195 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1196 | multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a) | ||
| 1115 | : multiset(__f, __l, key_compare(), __a) {} | 1197 | : multiset(__f, __l, key_compare(), __a) {} |
| 1116 | # endif | ||
| 1117 | 1198 | ||
| 1118 | template <class _InputIterator> | 1199 | template <class _InputIterator> |
| 1119 | _LIBCPP_HIDE_FROM_ABI | 1200 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1120 | multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a) | 1201 | multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a) |
| 1121 | : __tree_(__comp, __a) { | 1202 | : __tree_(__comp, __a) { |
| 1122 | insert(__f, __l); | 1203 | insert(__f, __l); |
| ... | @@ -1124,7 +1205,7 @@ public: | ... | @@ -1124,7 +1205,7 @@ public: |
| 1124 | 1205 | ||
| 1125 | # if _LIBCPP_STD_VER >= 23 | 1206 | # if _LIBCPP_STD_VER >= 23 |
| 1126 | template <_ContainerCompatibleRange<value_type> _Range> | 1207 | template <_ContainerCompatibleRange<value_type> _Range> |
| 1127 | _LIBCPP_HIDE_FROM_ABI | 1208 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1128 | multiset(from_range_t, | 1209 | multiset(from_range_t, |
| 1129 | _Range&& __range, | 1210 | _Range&& __range, |
| 1130 | const key_compare& __comp = key_compare(), | 1211 | const key_compare& __comp = key_compare(), |
| ... | @@ -1134,254 +1215,332 @@ public: | ... | @@ -1134,254 +1215,332 @@ public: |
| 1134 | } | 1215 | } |
| 1135 | 1216 | ||
| 1136 | template <_ContainerCompatibleRange<value_type> _Range> | 1217 | template <_ContainerCompatibleRange<value_type> _Range> |
| 1137 | _LIBCPP_HIDE_FROM_ABI multiset(from_range_t, _Range&& __range, const allocator_type& __a) | 1218 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1219 | multiset(from_range_t, _Range&& __range, const allocator_type& __a) | ||
| 1138 | : multiset(from_range, std::forward<_Range>(__range), key_compare(), __a) {} | 1220 | : multiset(from_range, std::forward<_Range>(__range), key_compare(), __a) {} |
| 1139 | # endif | 1221 | # endif |
| 1140 | 1222 | ||
| 1141 | _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s) = default; | 1223 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(const multiset& __s) = default; |
| 1142 | 1224 | ||
| 1143 | _LIBCPP_HIDE_FROM_ABI multiset& operator=(const multiset& __s) = default; | 1225 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset& operator=(const multiset& __s) = default; |
| 1144 | 1226 | ||
| 1145 | # ifndef _LIBCPP_CXX03_LANG | 1227 | # ifndef _LIBCPP_CXX03_LANG |
| 1146 | _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) = default; | 1228 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(multiset&& __s) = default; |
| 1147 | 1229 | ||
| 1148 | _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a) : __tree_(std::move(__s.__tree_), __a) {} | 1230 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(multiset&& __s, const allocator_type& __a) |
| 1231 | : __tree_(std::move(__s.__tree_), __a) {} | ||
| 1149 | # endif // _LIBCPP_CXX03_LANG | 1232 | # endif // _LIBCPP_CXX03_LANG |
| 1150 | _LIBCPP_HIDE_FROM_ABI explicit multiset(const allocator_type& __a) : __tree_(__a) {} | 1233 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multiset(const allocator_type& __a) : __tree_(__a) {} |
| 1151 | _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s, const allocator_type& __a) : __tree_(__s.__tree_, __a) {} | 1234 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(const multiset& __s, const allocator_type& __a) |
| 1235 | : __tree_(__s.__tree_, __a) {} | ||
| 1152 | 1236 | ||
| 1153 | # ifndef _LIBCPP_CXX03_LANG | 1237 | # ifndef _LIBCPP_CXX03_LANG |
| 1154 | _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) | 1238 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1239 | multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) | ||
| 1155 | : __tree_(__comp) { | 1240 | : __tree_(__comp) { |
| 1156 | insert(__il.begin(), __il.end()); | 1241 | insert(__il.begin(), __il.end()); |
| 1157 | } | 1242 | } |
| 1158 | 1243 | ||
| 1159 | _LIBCPP_HIDE_FROM_ABI | 1244 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1160 | multiset(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a) | 1245 | multiset(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a) |
| 1161 | : __tree_(__comp, __a) { | 1246 | : __tree_(__comp, __a) { |
| 1162 | insert(__il.begin(), __il.end()); | 1247 | insert(__il.begin(), __il.end()); |
| 1163 | } | 1248 | } |
| 1164 | 1249 | ||
| 1165 | # if _LIBCPP_STD_VER >= 14 | 1250 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 |
| 1166 | _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const allocator_type& __a) | 1251 | multiset(initializer_list<value_type> __il, const allocator_type& __a) |
| 1167 | : multiset(__il, key_compare(), __a) {} | 1252 | : multiset(__il, key_compare(), __a) {} |
| 1168 | # endif | ||
| 1169 | 1253 | ||
| 1170 | _LIBCPP_HIDE_FROM_ABI multiset& operator=(initializer_list<value_type> __il) { | 1254 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset& operator=(initializer_list<value_type> __il) { |
| 1171 | clear(); | 1255 | clear(); |
| 1172 | insert(__il.begin(), __il.end()); | 1256 | insert(__il.begin(), __il.end()); |
| 1173 | return *this; | 1257 | return *this; |
| 1174 | } | 1258 | } |
| 1175 | 1259 | ||
| 1176 | _LIBCPP_HIDE_FROM_ABI multiset& operator=(multiset&& __s) = default; | 1260 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset& operator=(multiset&& __s) = default; |
| 1177 | # endif // _LIBCPP_CXX03_LANG | 1261 | # endif // _LIBCPP_CXX03_LANG |
| 1178 | 1262 | ||
| 1179 | _LIBCPP_HIDE_FROM_ABI ~multiset() { | 1263 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~multiset() { |
| 1180 | static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); | 1264 | static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); |
| 1181 | } | 1265 | } |
| 1182 | 1266 | ||
| 1183 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); } | 1267 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT { |
| 1184 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); } | 1268 | return __tree_.begin(); |
| 1185 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); } | 1269 | } |
| 1186 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); } | 1270 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT { |
| 1271 | return __tree_.begin(); | ||
| 1272 | } | ||
| 1273 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT { | ||
| 1274 | return __tree_.end(); | ||
| 1275 | } | ||
| 1276 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT { | ||
| 1277 | return __tree_.end(); | ||
| 1278 | } | ||
| 1187 | 1279 | ||
| 1188 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); } | 1280 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT { |
| 1189 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { | 1281 | return reverse_iterator(end()); |
| 1282 | } | ||
| 1283 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator | ||
| 1284 | rbegin() const _NOEXCEPT { | ||
| 1190 | return const_reverse_iterator(end()); | 1285 | return const_reverse_iterator(end()); |
| 1191 | } | 1286 | } |
| 1192 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); } | 1287 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT { |
| 1193 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { | 1288 | return reverse_iterator(begin()); |
| 1289 | } | ||
| 1290 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT { | ||
| 1194 | return const_reverse_iterator(begin()); | 1291 | return const_reverse_iterator(begin()); |
| 1195 | } | 1292 | } |
| 1196 | 1293 | ||
| 1197 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); } | 1294 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT { |
| 1198 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); } | 1295 | return begin(); |
| 1199 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); } | 1296 | } |
| 1200 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); } | 1297 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT { |
| 1298 | return end(); | ||
| 1299 | } | ||
| 1300 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator | ||
| 1301 | crbegin() const _NOEXCEPT { | ||
| 1302 | return rbegin(); | ||
| 1303 | } | ||
| 1304 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT { | ||
| 1305 | return rend(); | ||
| 1306 | } | ||
| 1201 | 1307 | ||
| 1202 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } | 1308 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT { |
| 1203 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); } | 1309 | return __tree_.size() == 0; |
| 1204 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); } | 1310 | } |
| 1311 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT { | ||
| 1312 | return __tree_.size(); | ||
| 1313 | } | ||
| 1314 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT { | ||
| 1315 | return __tree_.max_size(); | ||
| 1316 | } | ||
| 1205 | 1317 | ||
| 1206 | // modifiers: | 1318 | // modifiers: |
| 1207 | # ifndef _LIBCPP_CXX03_LANG | 1319 | # ifndef _LIBCPP_CXX03_LANG |
| 1208 | template <class... _Args> | 1320 | template <class... _Args> |
| 1209 | _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) { | 1321 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace(_Args&&... __args) { |
| 1210 | return __tree_.__emplace_multi(std::forward<_Args>(__args)...); | 1322 | return __tree_.__emplace_multi(std::forward<_Args>(__args)...); |
| 1211 | } | 1323 | } |
| 1212 | template <class... _Args> | 1324 | template <class... _Args> |
| 1213 | _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) { | 1325 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) { |
| 1214 | return __tree_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...); | 1326 | return __tree_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...); |
| 1215 | } | 1327 | } |
| 1216 | # endif // _LIBCPP_CXX03_LANG | 1328 | # endif // _LIBCPP_CXX03_LANG |
| 1217 | 1329 | ||
| 1218 | _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __v) { return __tree_.__emplace_multi(__v); } | 1330 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const value_type& __v) { |
| 1219 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) { | 1331 | return __tree_.__emplace_multi(__v); |
| 1332 | } | ||
| 1333 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) { | ||
| 1220 | return __tree_.__emplace_hint_multi(__p, __v); | 1334 | return __tree_.__emplace_hint_multi(__p, __v); |
| 1221 | } | 1335 | } |
| 1222 | 1336 | ||
| 1223 | template <class _InputIterator> | 1337 | template <class _InputIterator> |
| 1224 | _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) { | 1338 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) { |
| 1225 | __tree_.__insert_range_multi(__first, __last); | 1339 | __tree_.__insert_range_multi(__first, __last); |
| 1226 | } | 1340 | } |
| 1227 | 1341 | ||
| 1228 | # if _LIBCPP_STD_VER >= 23 | 1342 | # if _LIBCPP_STD_VER >= 23 |
| 1229 | template <_ContainerCompatibleRange<value_type> _Range> | 1343 | template <_ContainerCompatibleRange<value_type> _Range> |
| 1230 | _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) { | 1344 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) { |
| 1231 | __tree_.__insert_range_multi(ranges::begin(__range), ranges::end(__range)); | 1345 | __tree_.__insert_range_multi(ranges::begin(__range), ranges::end(__range)); |
| 1232 | } | 1346 | } |
| 1233 | # endif | 1347 | # endif |
| 1234 | 1348 | ||
| 1235 | # ifndef _LIBCPP_CXX03_LANG | 1349 | # ifndef _LIBCPP_CXX03_LANG |
| 1236 | _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __v) { return __tree_.__emplace_multi(std::move(__v)); } | 1350 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(value_type&& __v) { |
| 1351 | return __tree_.__emplace_multi(std::move(__v)); | ||
| 1352 | } | ||
| 1237 | 1353 | ||
| 1238 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) { | 1354 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) { |
| 1239 | return __tree_.__emplace_hint_multi(__p, std::move(__v)); | 1355 | return __tree_.__emplace_hint_multi(__p, std::move(__v)); |
| 1240 | } | 1356 | } |
| 1241 | 1357 | ||
| 1242 | _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); } | 1358 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) { |
| 1359 | insert(__il.begin(), __il.end()); | ||
| 1360 | } | ||
| 1243 | # endif // _LIBCPP_CXX03_LANG | 1361 | # endif // _LIBCPP_CXX03_LANG |
| 1244 | 1362 | ||
| 1245 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); } | 1363 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) { return __tree_.erase(__p); } |
| 1246 | _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); } | 1364 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) { |
| 1247 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); } | 1365 | return __tree_.__erase_multi(__k); |
| 1248 | _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); } | 1366 | } |
| 1367 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) { | ||
| 1368 | return __tree_.erase(__f, __l); | ||
| 1369 | } | ||
| 1370 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); } | ||
| 1249 | 1371 | ||
| 1250 | # if _LIBCPP_STD_VER >= 17 | 1372 | # if _LIBCPP_STD_VER >= 17 |
| 1251 | _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) { | 1373 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(node_type&& __nh) { |
| 1252 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), | 1374 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 1253 | "node_type with incompatible allocator passed to multiset::insert()"); | 1375 | "node_type with incompatible allocator passed to multiset::insert()"); |
| 1254 | return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh)); | 1376 | return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh)); |
| 1255 | } | 1377 | } |
| 1256 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) { | 1378 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) { |
| 1257 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), | 1379 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 1258 | "node_type with incompatible allocator passed to multiset::insert()"); | 1380 | "node_type with incompatible allocator passed to multiset::insert()"); |
| 1259 | return __tree_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh)); | 1381 | return __tree_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh)); |
| 1260 | } | 1382 | } |
| 1261 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) { | 1383 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) { |
| 1262 | return __tree_.template __node_handle_extract<node_type>(__key); | 1384 | return __tree_.template __node_handle_extract<node_type>(__key); |
| 1263 | } | 1385 | } |
| 1264 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) { | 1386 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) { |
| 1265 | return __tree_.template __node_handle_extract<node_type>(__it); | 1387 | return __tree_.template __node_handle_extract<node_type>(__it); |
| 1266 | } | 1388 | } |
| 1267 | template <class _Compare2> | 1389 | template <class _Compare2> |
| 1268 | _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) { | 1390 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1391 | merge(multiset<key_type, _Compare2, allocator_type>& __source) { | ||
| 1269 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 1392 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1270 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 1393 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1271 | __tree_.__node_handle_merge_multi(__source.__tree_); | 1394 | __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1272 | } | 1395 | } |
| 1273 | template <class _Compare2> | 1396 | template <class _Compare2> |
| 1274 | _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) { | 1397 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1398 | merge(multiset<key_type, _Compare2, allocator_type>&& __source) { | ||
| 1275 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 1399 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1276 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 1400 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1277 | __tree_.__node_handle_merge_multi(__source.__tree_); | 1401 | __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1278 | } | 1402 | } |
| 1279 | template <class _Compare2> | 1403 | template <class _Compare2> |
| 1280 | _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) { | 1404 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>& __source) { |
| 1281 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 1405 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1282 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 1406 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1283 | __tree_.__node_handle_merge_multi(__source.__tree_); | 1407 | __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1284 | } | 1408 | } |
| 1285 | template <class _Compare2> | 1409 | template <class _Compare2> |
| 1286 | _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) { | 1410 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>&& __source) { |
| 1287 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( | 1411 | _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( |
| 1288 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); | 1412 | __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); |
| 1289 | __tree_.__node_handle_merge_multi(__source.__tree_); | 1413 | __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1290 | } | 1414 | } |
| 1291 | # endif | 1415 | # endif |
| 1292 | 1416 | ||
| 1293 | _LIBCPP_HIDE_FROM_ABI void swap(multiset& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { | 1417 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(multiset& __s) |
| 1418 | _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { | ||
| 1294 | __tree_.swap(__s.__tree_); | 1419 | __tree_.swap(__s.__tree_); |
| 1295 | } | 1420 | } |
| 1296 | 1421 | ||
| 1297 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); } | 1422 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT { |
| 1298 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); } | 1423 | return __tree_.__alloc(); |
| 1299 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); } | 1424 | } |
| 1425 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { | ||
| 1426 | return __tree_.value_comp(); | ||
| 1427 | } | ||
| 1428 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const { | ||
| 1429 | return __tree_.value_comp(); | ||
| 1430 | } | ||
| 1300 | 1431 | ||
| 1301 | // set operations: | 1432 | // set operations: |
| 1302 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); } | 1433 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) { |
| 1303 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); } | 1434 | return __tree_.find(__k); |
| 1435 | } | ||
| 1436 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const { | ||
| 1437 | return __tree_.find(__k); | ||
| 1438 | } | ||
| 1304 | # if _LIBCPP_STD_VER >= 14 | 1439 | # if _LIBCPP_STD_VER >= 14 |
| 1305 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1440 | template <typename _K2, |
| 1306 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { | 1441 | class _Comp = _Compare, |
| 1442 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 1443 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) { | ||
| 1307 | return __tree_.find(__k); | 1444 | return __tree_.find(__k); |
| 1308 | } | 1445 | } |
| 1309 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1446 | template <typename _K2, |
| 1310 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { | 1447 | class _Comp = _Compare, |
| 1448 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 1449 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const { | ||
| 1311 | return __tree_.find(__k); | 1450 | return __tree_.find(__k); |
| 1312 | } | 1451 | } |
| 1313 | # endif | 1452 | # endif |
| 1314 | 1453 | ||
| 1315 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { | 1454 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const { |
| 1316 | return __tree_.__count_multi(__k); | 1455 | return __tree_.__count_multi(__k); |
| 1317 | } | 1456 | } |
| 1318 | # if _LIBCPP_STD_VER >= 14 | 1457 | # if _LIBCPP_STD_VER >= 14 |
| 1319 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1458 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 1320 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { | 1459 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const { |
| 1321 | return __tree_.__count_multi(__k); | 1460 | return __tree_.__count_multi(__k); |
| 1322 | } | 1461 | } |
| 1323 | # endif | 1462 | # endif |
| 1324 | 1463 | ||
| 1325 | # if _LIBCPP_STD_VER >= 20 | 1464 | # if _LIBCPP_STD_VER >= 20 |
| 1326 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } | 1465 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const { |
| 1327 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1466 | return find(__k) != end(); |
| 1328 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { | 1467 | } |
| 1468 | template <typename _K2, | ||
| 1469 | class _Comp = _Compare, | ||
| 1470 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 1471 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const { | ||
| 1329 | return find(__k) != end(); | 1472 | return find(__k) != end(); |
| 1330 | } | 1473 | } |
| 1331 | # endif // _LIBCPP_STD_VER >= 20 | 1474 | # endif // _LIBCPP_STD_VER >= 20 |
| 1332 | 1475 | ||
| 1333 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { | 1476 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) { |
| 1334 | return __tree_.__lower_bound_multi(__k); | 1477 | return __tree_.__lower_bound_multi(__k); |
| 1335 | } | 1478 | } |
| 1336 | 1479 | ||
| 1337 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { | 1480 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 1481 | lower_bound(const key_type& __k) const { | ||
| 1338 | return __tree_.__lower_bound_multi(__k); | 1482 | return __tree_.__lower_bound_multi(__k); |
| 1339 | } | 1483 | } |
| 1340 | 1484 | ||
| 1341 | # if _LIBCPP_STD_VER >= 14 | 1485 | # if _LIBCPP_STD_VER >= 14 |
| 1342 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1486 | template <typename _K2, |
| 1343 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) { | 1487 | class _Comp = _Compare, |
| 1488 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 1489 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) { | ||
| 1344 | return __tree_.__lower_bound_multi(__k); | 1490 | return __tree_.__lower_bound_multi(__k); |
| 1345 | } | 1491 | } |
| 1346 | 1492 | ||
| 1347 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1493 | template <typename _K2, |
| 1348 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const { | 1494 | class _Comp = _Compare, |
| 1495 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 1496 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator | ||
| 1497 | lower_bound(const _K2& __k) const { | ||
| 1349 | return __tree_.__lower_bound_multi(__k); | 1498 | return __tree_.__lower_bound_multi(__k); |
| 1350 | } | 1499 | } |
| 1351 | # endif | 1500 | # endif |
| 1352 | 1501 | ||
| 1353 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { | 1502 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) { |
| 1354 | return __tree_.__upper_bound_multi(__k); | 1503 | return __tree_.__upper_bound_multi(__k); |
| 1355 | } | 1504 | } |
| 1356 | 1505 | ||
| 1357 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { | 1506 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator |
| 1507 | upper_bound(const key_type& __k) const { | ||
| 1358 | return __tree_.__upper_bound_multi(__k); | 1508 | return __tree_.__upper_bound_multi(__k); |
| 1359 | } | 1509 | } |
| 1360 | 1510 | ||
| 1361 | # if _LIBCPP_STD_VER >= 14 | 1511 | # if _LIBCPP_STD_VER >= 14 |
| 1362 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1512 | template <typename _K2, |
| 1363 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) { | 1513 | class _Comp = _Compare, |
| 1514 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 1515 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) { | ||
| 1364 | return __tree_.__upper_bound_multi(__k); | 1516 | return __tree_.__upper_bound_multi(__k); |
| 1365 | } | 1517 | } |
| 1366 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1518 | template <typename _K2, |
| 1367 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const { | 1519 | class _Comp = _Compare, |
| 1520 | enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> | ||
| 1521 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator | ||
| 1522 | upper_bound(const _K2& __k) const { | ||
| 1368 | return __tree_.__upper_bound_multi(__k); | 1523 | return __tree_.__upper_bound_multi(__k); |
| 1369 | } | 1524 | } |
| 1370 | # endif | 1525 | # endif |
| 1371 | 1526 | ||
| 1372 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) { | 1527 | [[__nodiscard__]] |
| 1528 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) { | ||
| 1373 | return __tree_.__equal_range_multi(__k); | 1529 | return __tree_.__equal_range_multi(__k); |
| 1374 | } | 1530 | } |
| 1375 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const { | 1531 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator> |
| 1532 | equal_range(const key_type& __k) const { | ||
| 1376 | return __tree_.__equal_range_multi(__k); | 1533 | return __tree_.__equal_range_multi(__k); |
| 1377 | } | 1534 | } |
| 1378 | # if _LIBCPP_STD_VER >= 14 | 1535 | # if _LIBCPP_STD_VER >= 14 |
| 1379 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1536 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 1380 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { | 1537 | [[__nodiscard__]] |
| 1538 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) { | ||
| 1381 | return __tree_.__equal_range_multi(__k); | 1539 | return __tree_.__equal_range_multi(__k); |
| 1382 | } | 1540 | } |
| 1383 | template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> | 1541 | template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0> |
| 1384 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { | 1542 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator> |
| 1543 | equal_range(const _K2& __k) const { | ||
| 1385 | return __tree_.__equal_range_multi(__k); | 1544 | return __tree_.__equal_range_multi(__k); |
| 1386 | } | 1545 | } |
| 1387 | # endif | 1546 | # endif |
| ... | @@ -1445,7 +1604,7 @@ struct __specialized_algorithm<_Alg, __single_range<multiset<_Key, _Compare, _Al | ... | @@ -1445,7 +1604,7 @@ struct __specialized_algorithm<_Alg, __single_range<multiset<_Key, _Compare, _Al |
| 1445 | 1604 | ||
| 1446 | // set's begin() and end() are identical with and without const qualification | 1605 | // set's begin() and end() are identical with and without const qualification |
| 1447 | template <class... _Args> | 1606 | template <class... _Args> |
| 1448 | _LIBCPP_HIDE_FROM_ABI static auto operator()(const __set& __set, _Args&&... __args) { | 1607 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto operator()(const __set& __set, _Args&&... __args) { |
| 1449 | return __specialized_algorithm<_Alg, __single_range<typename __set::__base>>()( | 1608 | return __specialized_algorithm<_Alg, __single_range<typename __set::__base>>()( |
| 1450 | __set.__tree_, std::forward<_Args>(__args)...); | 1609 | __set.__tree_, std::forward<_Args>(__args)...); |
| 1451 | } | 1610 | } |
| ... | @@ -1453,7 +1612,7 @@ struct __specialized_algorithm<_Alg, __single_range<multiset<_Key, _Compare, _Al | ... | @@ -1453,7 +1612,7 @@ struct __specialized_algorithm<_Alg, __single_range<multiset<_Key, _Compare, _Al |
| 1453 | # endif | 1612 | # endif |
| 1454 | 1613 | ||
| 1455 | template <class _Key, class _Compare, class _Allocator> | 1614 | template <class _Key, class _Compare, class _Allocator> |
| 1456 | inline _LIBCPP_HIDE_FROM_ABI bool | 1615 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1457 | operator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { | 1616 | operator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { |
| 1458 | return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); | 1617 | return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); |
| 1459 | } | 1618 | } |
| ... | @@ -1461,31 +1620,31 @@ operator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, | ... | @@ -1461,31 +1620,31 @@ operator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, |
| 1461 | # if _LIBCPP_STD_VER <= 17 | 1620 | # if _LIBCPP_STD_VER <= 17 |
| 1462 | 1621 | ||
| 1463 | template <class _Key, class _Compare, class _Allocator> | 1622 | template <class _Key, class _Compare, class _Allocator> |
| 1464 | inline _LIBCPP_HIDE_FROM_ABI bool | 1623 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1465 | operator<(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { | 1624 | operator<(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { |
| 1466 | return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); | 1625 | return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); |
| 1467 | } | 1626 | } |
| 1468 | 1627 | ||
| 1469 | template <class _Key, class _Compare, class _Allocator> | 1628 | template <class _Key, class _Compare, class _Allocator> |
| 1470 | inline _LIBCPP_HIDE_FROM_ABI bool | 1629 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1471 | operator!=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { | 1630 | operator!=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { |
| 1472 | return !(__x == __y); | 1631 | return !(__x == __y); |
| 1473 | } | 1632 | } |
| 1474 | 1633 | ||
| 1475 | template <class _Key, class _Compare, class _Allocator> | 1634 | template <class _Key, class _Compare, class _Allocator> |
| 1476 | inline _LIBCPP_HIDE_FROM_ABI bool | 1635 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1477 | operator>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { | 1636 | operator>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { |
| 1478 | return __y < __x; | 1637 | return __y < __x; |
| 1479 | } | 1638 | } |
| 1480 | 1639 | ||
| 1481 | template <class _Key, class _Compare, class _Allocator> | 1640 | template <class _Key, class _Compare, class _Allocator> |
| 1482 | inline _LIBCPP_HIDE_FROM_ABI bool | 1641 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1483 | operator>=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { | 1642 | operator>=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { |
| 1484 | return !(__x < __y); | 1643 | return !(__x < __y); |
| 1485 | } | 1644 | } |
| 1486 | 1645 | ||
| 1487 | template <class _Key, class _Compare, class _Allocator> | 1646 | template <class _Key, class _Compare, class _Allocator> |
| 1488 | inline _LIBCPP_HIDE_FROM_ABI bool | 1647 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool |
| 1489 | operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { | 1648 | operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { |
| 1490 | return !(__y < __x); | 1649 | return !(__y < __x); |
| 1491 | } | 1650 | } |
| ... | @@ -1493,7 +1652,7 @@ operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, | ... | @@ -1493,7 +1652,7 @@ operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, |
| 1493 | # else // _LIBCPP_STD_VER <= 17 | 1652 | # else // _LIBCPP_STD_VER <= 17 |
| 1494 | 1653 | ||
| 1495 | template <class _Key, class _Compare, class _Allocator> | 1654 | template <class _Key, class _Compare, class _Allocator> |
| 1496 | _LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key> | 1655 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<_Key> |
| 1497 | operator<=>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { | 1656 | operator<=>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { |
| 1498 | return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way); | 1657 | return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way); |
| 1499 | } | 1658 | } |
| ... | @@ -1501,7 +1660,7 @@ operator<=>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key | ... | @@ -1501,7 +1660,7 @@ operator<=>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key |
| 1501 | # endif // _LIBCPP_STD_VER <= 17 | 1660 | # endif // _LIBCPP_STD_VER <= 17 |
| 1502 | 1661 | ||
| 1503 | template <class _Key, class _Compare, class _Allocator> | 1662 | template <class _Key, class _Compare, class _Allocator> |
| 1504 | inline _LIBCPP_HIDE_FROM_ABI void | 1663 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void |
| 1505 | swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Allocator>& __y) | 1664 | swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Allocator>& __y) |
| 1506 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { | 1665 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { |
| 1507 | __x.swap(__y); | 1666 | __x.swap(__y); |
| ... | @@ -1509,7 +1668,7 @@ swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Alloca | ... | @@ -1509,7 +1668,7 @@ swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Alloca |
| 1509 | 1668 | ||
| 1510 | # if _LIBCPP_STD_VER >= 20 | 1669 | # if _LIBCPP_STD_VER >= 20 |
| 1511 | template <class _Key, class _Compare, class _Allocator, class _Predicate> | 1670 | template <class _Key, class _Compare, class _Allocator, class _Predicate> |
| 1512 | inline _LIBCPP_HIDE_FROM_ABI typename multiset<_Key, _Compare, _Allocator>::size_type | 1671 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename multiset<_Key, _Compare, _Allocator>::size_type |
| 1513 | erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) { | 1672 | erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) { |
| 1514 | return std::__libcpp_erase_if_container(__c, __pred); | 1673 | return std::__libcpp_erase_if_container(__c, __pred); |
| 1515 | } | 1674 | } |
| ... | @@ -1541,7 +1700,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -1541,7 +1700,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 1541 | 1700 | ||
| 1542 | _LIBCPP_POP_MACROS | 1701 | _LIBCPP_POP_MACROS |
| 1543 | 1702 | ||
| 1544 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1703 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1545 | # include <concepts> | 1704 | # include <concepts> |
| 1546 | # include <cstdlib> | 1705 | # include <cstdlib> |
| 1547 | # include <functional> | 1706 | # include <functional> |
lib/libcxx/include/shared_mutex+34-24| ... | @@ -153,6 +153,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -153,6 +153,7 @@ _LIBCPP_PUSH_MACROS |
| 153 | # endif | 153 | # endif |
| 154 | 154 | ||
| 155 | _LIBCPP_BEGIN_NAMESPACE_STD | 155 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 156 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 156 | 157 | ||
| 157 | struct _LIBCPP_EXPORTED_FROM_ABI __shared_mutex_base { | 158 | struct _LIBCPP_EXPORTED_FROM_ABI __shared_mutex_base { |
| 158 | mutex __mut_; | 159 | mutex __mut_; |
| ... | @@ -196,12 +197,14 @@ public: | ... | @@ -196,12 +197,14 @@ public: |
| 196 | 197 | ||
| 197 | // Exclusive ownership | 198 | // Exclusive ownership |
| 198 | _LIBCPP_ACQUIRE_CAPABILITY() _LIBCPP_HIDE_FROM_ABI void lock() { return __base_.lock(); } | 199 | _LIBCPP_ACQUIRE_CAPABILITY() _LIBCPP_HIDE_FROM_ABI void lock() { return __base_.lock(); } |
| 199 | _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool try_lock() { return __base_.try_lock(); } | 200 | [[nodiscard]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool try_lock() { |
| 200 | _LIBCPP_RELEASE_CAPABILITY _LIBCPP_HIDE_FROM_ABI void unlock() { return __base_.unlock(); } | 201 | return __base_.try_lock(); |
| 202 | } | ||
| 203 | _LIBCPP_RELEASE_CAPABILITY() _LIBCPP_HIDE_FROM_ABI void unlock() { return __base_.unlock(); } | ||
| 201 | 204 | ||
| 202 | // Shared ownership | 205 | // Shared ownership |
| 203 | _LIBCPP_ACQUIRE_SHARED_CAPABILITY _LIBCPP_HIDE_FROM_ABI void lock_shared() { return __base_.lock_shared(); } | 206 | _LIBCPP_ACQUIRE_SHARED_CAPABILITY _LIBCPP_HIDE_FROM_ABI void lock_shared() { return __base_.lock_shared(); } |
| 204 | _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool try_lock_shared() { | 207 | [[nodiscard]] _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool try_lock_shared() { |
| 205 | return __base_.try_lock_shared(); | 208 | return __base_.try_lock_shared(); |
| 206 | } | 209 | } |
| 207 | _LIBCPP_RELEASE_SHARED_CAPABILITY _LIBCPP_HIDE_FROM_ABI void unlock_shared() { return __base_.unlock_shared(); } | 210 | _LIBCPP_RELEASE_SHARED_CAPABILITY _LIBCPP_HIDE_FROM_ABI void unlock_shared() { return __base_.unlock_shared(); } |
| ... | @@ -223,15 +226,15 @@ public: | ... | @@ -223,15 +226,15 @@ public: |
| 223 | 226 | ||
| 224 | // Exclusive ownership | 227 | // Exclusive ownership |
| 225 | void lock() _LIBCPP_ACQUIRE_CAPABILITY(); | 228 | void lock() _LIBCPP_ACQUIRE_CAPABILITY(); |
| 226 | _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) bool try_lock(); | 229 | [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) bool try_lock(); |
| 227 | template <class _Rep, class _Period> | 230 | template <class _Rep, class _Period> |
| 228 | _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool | 231 | [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool |
| 229 | try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time) { | 232 | try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time) { |
| 230 | return try_lock_until(chrono::steady_clock::now() + __rel_time); | 233 | return try_lock_until(chrono::steady_clock::now() + __rel_time); |
| 231 | } | 234 | } |
| 232 | 235 | ||
| 233 | template <class _Clock, class _Duration> | 236 | template <class _Clock, class _Duration> |
| 234 | _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool | 237 | [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool |
| 235 | try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time) { | 238 | try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time) { |
| 236 | unique_lock<mutex> __lk(__base_.__mut_); | 239 | unique_lock<mutex> __lk(__base_.__mut_); |
| 237 | if (__base_.__state_ & __base_.__write_entered_) { | 240 | if (__base_.__state_ & __base_.__write_entered_) { |
| ... | @@ -259,19 +262,19 @@ public: | ... | @@ -259,19 +262,19 @@ public: |
| 259 | return true; | 262 | return true; |
| 260 | } | 263 | } |
| 261 | 264 | ||
| 262 | _LIBCPP_RELEASE_CAPABILITY void unlock(); | 265 | _LIBCPP_RELEASE_CAPABILITY() void unlock(); |
| 263 | 266 | ||
| 264 | // Shared ownership | 267 | // Shared ownership |
| 265 | _LIBCPP_ACQUIRE_SHARED_CAPABILITY void lock_shared(); | 268 | _LIBCPP_ACQUIRE_SHARED_CAPABILITY void lock_shared(); |
| 266 | _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) bool try_lock_shared(); | 269 | [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) bool try_lock_shared(); |
| 267 | template <class _Rep, class _Period> | 270 | template <class _Rep, class _Period> |
| 268 | _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool | 271 | [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool |
| 269 | try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time) { | 272 | try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time) { |
| 270 | return try_lock_shared_until(chrono::steady_clock::now() + __rel_time); | 273 | return try_lock_shared_until(chrono::steady_clock::now() + __rel_time); |
| 271 | } | 274 | } |
| 272 | 275 | ||
| 273 | template <class _Clock, class _Duration> | 276 | template <class _Clock, class _Duration> |
| 274 | _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool | 277 | [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool |
| 275 | try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time) { | 278 | try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time) { |
| 276 | unique_lock<mutex> __lk(__base_.__mut_); | 279 | unique_lock<mutex> __lk(__base_.__mut_); |
| 277 | if ((__base_.__state_ & __base_.__write_entered_) || | 280 | if ((__base_.__state_ & __base_.__write_entered_) || |
| ... | @@ -304,27 +307,31 @@ private: | ... | @@ -304,27 +307,31 @@ private: |
| 304 | bool __owns_; | 307 | bool __owns_; |
| 305 | 308 | ||
| 306 | public: | 309 | public: |
| 307 | _LIBCPP_HIDE_FROM_ABI shared_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {} | 310 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {} |
| 308 | 311 | ||
| 309 | _LIBCPP_HIDE_FROM_ABI explicit shared_lock(mutex_type& __m) : __m_(std::addressof(__m)), __owns_(true) { | 312 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI explicit shared_lock(mutex_type& __m) |
| 313 | : __m_(std::addressof(__m)), __owns_(true) { | ||
| 310 | __m_->lock_shared(); | 314 | __m_->lock_shared(); |
| 311 | } | 315 | } |
| 312 | 316 | ||
| 313 | _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT | 317 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT |
| 314 | : __m_(std::addressof(__m)), | 318 | : __m_(std::addressof(__m)), |
| 315 | __owns_(false) {} | 319 | __owns_(false) {} |
| 316 | 320 | ||
| 317 | _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, try_to_lock_t) | 321 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, try_to_lock_t) |
| 318 | : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared()) {} | 322 | : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared()) {} |
| 319 | 323 | ||
| 320 | _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, adopt_lock_t) : __m_(std::addressof(__m)), __owns_(true) {} | 324 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, adopt_lock_t) |
| 325 | : __m_(std::addressof(__m)), __owns_(true) {} | ||
| 321 | 326 | ||
| 322 | template <class _Clock, class _Duration> | 327 | template <class _Clock, class _Duration> |
| 323 | _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __abs_time) | 328 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI |
| 329 | shared_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __abs_time) | ||
| 324 | : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared_until(__abs_time)) {} | 330 | : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared_until(__abs_time)) {} |
| 325 | 331 | ||
| 326 | template <class _Rep, class _Period> | 332 | template <class _Rep, class _Period> |
| 327 | _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __rel_time) | 333 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI |
| 334 | shared_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __rel_time) | ||
| 328 | : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared_for(__rel_time)) {} | 335 | : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared_for(__rel_time)) {} |
| 329 | 336 | ||
| 330 | _LIBCPP_HIDE_FROM_ABI ~shared_lock() { | 337 | _LIBCPP_HIDE_FROM_ABI ~shared_lock() { |
| ... | @@ -335,7 +342,9 @@ public: | ... | @@ -335,7 +342,9 @@ public: |
| 335 | shared_lock(shared_lock const&) = delete; | 342 | shared_lock(shared_lock const&) = delete; |
| 336 | shared_lock& operator=(shared_lock const&) = delete; | 343 | shared_lock& operator=(shared_lock const&) = delete; |
| 337 | 344 | ||
| 338 | _LIBCPP_HIDE_FROM_ABI shared_lock(shared_lock&& __u) _NOEXCEPT : __m_(__u.__m_), __owns_(__u.__owns_) { | 345 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_lock(shared_lock&& __u) _NOEXCEPT |
| 346 | : __m_(__u.__m_), | ||
| 347 | __owns_(__u.__owns_) { | ||
| 339 | __u.__m_ = nullptr; | 348 | __u.__m_ = nullptr; |
| 340 | __u.__owns_ = false; | 349 | __u.__owns_ = false; |
| 341 | } | 350 | } |
| ... | @@ -347,11 +356,11 @@ public: | ... | @@ -347,11 +356,11 @@ public: |
| 347 | } | 356 | } |
| 348 | 357 | ||
| 349 | _LIBCPP_HIDE_FROM_ABI void lock(); | 358 | _LIBCPP_HIDE_FROM_ABI void lock(); |
| 350 | _LIBCPP_HIDE_FROM_ABI bool try_lock(); | 359 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock(); |
| 351 | template <class _Rep, class _Period> | 360 | template <class _Rep, class _Period> |
| 352 | _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time); | 361 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time); |
| 353 | template <class _Clock, class _Duration> | 362 | template <class _Clock, class _Duration> |
| 354 | _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time); | 363 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time); |
| 355 | _LIBCPP_HIDE_FROM_ABI void unlock(); | 364 | _LIBCPP_HIDE_FROM_ABI void unlock(); |
| 356 | 365 | ||
| 357 | // Setters | 366 | // Setters |
| ... | @@ -368,11 +377,11 @@ public: | ... | @@ -368,11 +377,11 @@ public: |
| 368 | } | 377 | } |
| 369 | 378 | ||
| 370 | // Getters | 379 | // Getters |
| 371 | _LIBCPP_HIDE_FROM_ABI bool owns_lock() const _NOEXCEPT { return __owns_; } | 380 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool owns_lock() const _NOEXCEPT { return __owns_; } |
| 372 | 381 | ||
| 373 | _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __owns_; } | 382 | _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __owns_; } |
| 374 | 383 | ||
| 375 | _LIBCPP_HIDE_FROM_ABI mutex_type* mutex() const _NOEXCEPT { return __m_; } | 384 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mutex_type* mutex() const _NOEXCEPT { return __m_; } |
| 376 | }; | 385 | }; |
| 377 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(shared_lock); | 386 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(shared_lock); |
| 378 | 387 | ||
| ... | @@ -431,6 +440,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(shared_lock<_Mutex>& __x, shared_lock<_Mu | ... | @@ -431,6 +440,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(shared_lock<_Mutex>& __x, shared_lock<_Mu |
| 431 | __x.swap(__y); | 440 | __x.swap(__y); |
| 432 | } | 441 | } |
| 433 | 442 | ||
| 443 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 434 | _LIBCPP_END_NAMESPACE_STD | 444 | _LIBCPP_END_NAMESPACE_STD |
| 435 | 445 | ||
| 436 | # endif // _LIBCPP_STD_VER >= 14 | 446 | # endif // _LIBCPP_STD_VER >= 14 |
| ... | @@ -439,7 +449,7 @@ _LIBCPP_POP_MACROS | ... | @@ -439,7 +449,7 @@ _LIBCPP_POP_MACROS |
| 439 | 449 | ||
| 440 | # endif // _LIBCPP_HAS_THREADS | 450 | # endif // _LIBCPP_HAS_THREADS |
| 441 | 451 | ||
| 442 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 452 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 443 | # include <optional> | 453 | # include <optional> |
| 444 | # include <system_error> | 454 | # include <system_error> |
| 445 | # endif | 455 | # endif |
lib/libcxx/include/source_location+4-4| ... | @@ -36,10 +36,10 @@ namespace std { | ... | @@ -36,10 +36,10 @@ namespace std { |
| 36 | # pragma GCC system_header | 36 | # pragma GCC system_header |
| 37 | # endif | 37 | # endif |
| 38 | 38 | ||
| 39 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 40 | |||
| 41 | # if _LIBCPP_STD_VER >= 20 | 39 | # if _LIBCPP_STD_VER >= 20 |
| 42 | 40 | ||
| 41 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 42 | |||
| 43 | class source_location { | 43 | class source_location { |
| 44 | // The names source_location::__impl, _M_file_name, _M_function_name, _M_line, and _M_column | 44 | // The names source_location::__impl, _M_file_name, _M_function_name, _M_line, and _M_column |
| 45 | // are hard-coded in the compiler and must not be changed here. | 45 | // are hard-coded in the compiler and must not be changed here. |
| ... | @@ -81,10 +81,10 @@ public: | ... | @@ -81,10 +81,10 @@ public: |
| 81 | } | 81 | } |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | # endif // _LIBCPP_STD_VER >= 20 | ||
| 85 | |||
| 86 | _LIBCPP_END_NAMESPACE_STD | 84 | _LIBCPP_END_NAMESPACE_STD |
| 87 | 85 | ||
| 86 | # endif // _LIBCPP_STD_VER >= 20 | ||
| 87 | |||
| 88 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 88 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 89 | 89 | ||
| 90 | #endif // _LIBCPP_SOURCE_LOCATION | 90 | #endif // _LIBCPP_SOURCE_LOCATION |
lib/libcxx/include/span+15-36| ... | @@ -19,16 +19,16 @@ namespace std { | ... | @@ -19,16 +19,16 @@ namespace std { |
| 19 | inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max(); | 19 | inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max(); |
| 20 | 20 | ||
| 21 | template<class T> | 21 | template<class T> |
| 22 | concept integral-constant-like = // exposition only, since C++26 | 22 | concept integral-constant-like = // exposition only |
| 23 | is_integral_v<decltype(T::value)> && | 23 | is_integral_v<remove_cvref_t<decltype(T::value)>> && |
| 24 | !is_same_v<bool, remove_const_t<decltype(T::value)>> && | 24 | !is_same_v<bool, remove_cvref_t<decltype(T::value)>> && |
| 25 | convertible_to<T, decltype(T::value)> && | 25 | convertible_to<T, decltype(T::value)> && |
| 26 | equality_comparable_with<T, decltype(T::value)> && | 26 | equality_comparable_with<T, decltype(T::value)> && |
| 27 | bool_constant<T() == T::value>::value && | 27 | bool_constant<T() == T::value>::value && |
| 28 | bool_constant<static_cast<decltype(T::value)>(T()) == T::value>::value; | 28 | bool_constant<static_cast<decltype(T::value)>(T()) == T::value>::value; |
| 29 | 29 | ||
| 30 | template<class T> | 30 | template<class T> |
| 31 | constexpr size_t maybe-static-ext = dynamic_extent; // exposition only, since C++26 | 31 | constexpr size_t maybe-static-ext = dynamic_extent; // exposition only |
| 32 | template<integral-constant-like T> | 32 | template<integral-constant-like T> |
| 33 | constexpr size_t maybe-static-ext<T> = {T::value}; | 33 | constexpr size_t maybe-static-ext<T> = {T::value}; |
| 34 | 34 | ||
| ... | @@ -82,7 +82,6 @@ public: | ... | @@ -82,7 +82,6 @@ public: |
| 82 | constexpr span(const array<value_type, N>& arr) noexcept; | 82 | constexpr span(const array<value_type, N>& arr) noexcept; |
| 83 | template<class R> | 83 | template<class R> |
| 84 | constexpr explicit(Extent != dynamic_extent) span(R&& r); | 84 | constexpr explicit(Extent != dynamic_extent) span(R&& r); |
| 85 | constexpr explicit(extent != dynamic_extent) span(std::initializer_list<value_type> il); // Since C++26 | ||
| 86 | constexpr span(const span& other) noexcept = default; | 85 | constexpr span(const span& other) noexcept = default; |
| 87 | template <class OtherElementType, size_t OtherExtent> | 86 | template <class OtherElementType, size_t OtherExtent> |
| 88 | constexpr explicit(Extent != dynamic_extent) span(const span<OtherElementType, OtherExtent>& s) noexcept; | 87 | constexpr explicit(Extent != dynamic_extent) span(const span<OtherElementType, OtherExtent>& s) noexcept; |
| ... | @@ -124,9 +123,7 @@ private: | ... | @@ -124,9 +123,7 @@ private: |
| 124 | }; | 123 | }; |
| 125 | 124 | ||
| 126 | template<class It, class EndOrSize> | 125 | template<class It, class EndOrSize> |
| 127 | span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>; // until C++26 | 126 | span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<It>>, maybe-static-ext<EndOrSize>>; |
| 128 | template<class It, class EndOrSize> | ||
| 129 | span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<It>>, maybe-static-ext<EndOrSize>>; // since C++26 | ||
| 130 | 127 | ||
| 131 | template<class T, size_t N> | 128 | template<class T, size_t N> |
| 132 | span(T (&)[N]) -> span<T, N>; | 129 | span(T (&)[N]) -> span<T, N>; |
| ... | @@ -153,6 +150,7 @@ template<class R> | ... | @@ -153,6 +150,7 @@ template<class R> |
| 153 | # include <__config> | 150 | # include <__config> |
| 154 | # include <__cstddef/byte.h> | 151 | # include <__cstddef/byte.h> |
| 155 | # include <__cstddef/ptrdiff_t.h> | 152 | # include <__cstddef/ptrdiff_t.h> |
| 153 | # include <__cstddef/size_t.h> | ||
| 156 | # include <__fwd/array.h> | 154 | # include <__fwd/array.h> |
| 157 | # include <__fwd/span.h> | 155 | # include <__fwd/span.h> |
| 158 | # include <__iterator/bounded_iter.h> | 156 | # include <__iterator/bounded_iter.h> |
| ... | @@ -172,13 +170,13 @@ template<class R> | ... | @@ -172,13 +170,13 @@ template<class R> |
| 172 | # include <__type_traits/is_convertible.h> | 170 | # include <__type_traits/is_convertible.h> |
| 173 | # include <__type_traits/is_integral.h> | 171 | # include <__type_traits/is_integral.h> |
| 174 | # include <__type_traits/is_same.h> | 172 | # include <__type_traits/is_same.h> |
| 173 | # include <__type_traits/is_volatile.h> | ||
| 175 | # include <__type_traits/remove_const.h> | 174 | # include <__type_traits/remove_const.h> |
| 176 | # include <__type_traits/remove_cv.h> | 175 | # include <__type_traits/remove_cv.h> |
| 177 | # include <__type_traits/remove_cvref.h> | 176 | # include <__type_traits/remove_cvref.h> |
| 178 | # include <__type_traits/remove_reference.h> | 177 | # include <__type_traits/remove_reference.h> |
| 179 | # include <__type_traits/type_identity.h> | 178 | # include <__type_traits/type_identity.h> |
| 180 | # include <__utility/forward.h> | 179 | # include <__utility/forward.h> |
| 181 | # include <initializer_list> | ||
| 182 | # include <stdexcept> | 180 | # include <stdexcept> |
| 183 | # include <version> | 181 | # include <version> |
| 184 | 182 | ||
| ... | @@ -198,10 +196,10 @@ template<class R> | ... | @@ -198,10 +196,10 @@ template<class R> |
| 198 | _LIBCPP_PUSH_MACROS | 196 | _LIBCPP_PUSH_MACROS |
| 199 | # include <__undef_macros> | 197 | # include <__undef_macros> |
| 200 | 198 | ||
| 201 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 202 | |||
| 203 | # if _LIBCPP_STD_VER >= 20 | 199 | # if _LIBCPP_STD_VER >= 20 |
| 204 | 200 | ||
| 201 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 202 | |||
| 205 | template <class _Tp> | 203 | template <class _Tp> |
| 206 | struct __is_std_span : false_type {}; | 204 | struct __is_std_span : false_type {}; |
| 207 | 205 | ||
| ... | @@ -254,15 +252,6 @@ public: | ... | @@ -254,15 +252,6 @@ public: |
| 254 | requires(_Sz == 0) | 252 | requires(_Sz == 0) |
| 255 | _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {} | 253 | _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {} |
| 256 | 254 | ||
| 257 | # if _LIBCPP_STD_VER >= 26 | ||
| 258 | _LIBCPP_HIDE_FROM_ABI constexpr explicit span(std::initializer_list<value_type> __il) | ||
| 259 | requires is_const_v<element_type> | ||
| 260 | : __data_{__il.begin()} { | ||
| 261 | _LIBCPP_ASSERT_VALID_INPUT_RANGE( | ||
| 262 | _Extent == __il.size(), "Size mismatch in span's constructor _Extent != __il.size()."); | ||
| 263 | } | ||
| 264 | # endif | ||
| 265 | |||
| 266 | constexpr span(const span&) noexcept = default; | 255 | constexpr span(const span&) noexcept = default; |
| 267 | constexpr span& operator=(const span&) noexcept = default; | 256 | constexpr span& operator=(const span&) noexcept = default; |
| 268 | 257 | ||
| ... | @@ -443,12 +432,6 @@ public: | ... | @@ -443,12 +432,6 @@ public: |
| 443 | // [span.cons], span constructors, copy, assignment, and destructor | 432 | // [span.cons], span constructors, copy, assignment, and destructor |
| 444 | _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {} | 433 | _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {} |
| 445 | 434 | ||
| 446 | # if _LIBCPP_STD_VER >= 26 | ||
| 447 | _LIBCPP_HIDE_FROM_ABI constexpr span(std::initializer_list<value_type> __il) | ||
| 448 | requires is_const_v<element_type> | ||
| 449 | : __data_{__il.begin()}, __size_{__il.size()} {} | ||
| 450 | # endif | ||
| 451 | |||
| 452 | constexpr span(const span&) noexcept = default; | 435 | constexpr span(const span&) noexcept = default; |
| 453 | constexpr span& operator=(const span&) noexcept = default; | 436 | constexpr span& operator=(const span&) noexcept = default; |
| 454 | 437 | ||
| ... | @@ -601,20 +584,20 @@ inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true; | ... | @@ -601,20 +584,20 @@ inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true; |
| 601 | 584 | ||
| 602 | // as_bytes & as_writable_bytes | 585 | // as_bytes & as_writable_bytes |
| 603 | template <class _Tp, size_t _Extent> | 586 | template <class _Tp, size_t _Extent> |
| 587 | requires(!is_volatile_v<_Tp>) | ||
| 604 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto as_bytes(span<_Tp, _Extent> __s) noexcept { | 588 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto as_bytes(span<_Tp, _Extent> __s) noexcept { |
| 605 | return __s.__as_bytes(); | 589 | return __s.__as_bytes(); |
| 606 | } | 590 | } |
| 607 | 591 | ||
| 608 | template <class _Tp, size_t _Extent> | 592 | template <class _Tp, size_t _Extent> |
| 609 | requires(!is_const_v<_Tp>) | 593 | requires(!is_const_v<_Tp> && !is_volatile_v<_Tp>) |
| 610 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept { | 594 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept { |
| 611 | return __s.__as_writable_bytes(); | 595 | return __s.__as_writable_bytes(); |
| 612 | } | 596 | } |
| 613 | 597 | ||
| 614 | # if _LIBCPP_STD_VER >= 26 | ||
| 615 | template <class _Tp> | 598 | template <class _Tp> |
| 616 | concept __integral_constant_like = | 599 | concept __integral_constant_like = |
| 617 | is_integral_v<decltype(_Tp::value)> && !is_same_v<bool, remove_const_t<decltype(_Tp::value)>> && | 600 | is_integral_v<remove_cvref_t<decltype(_Tp::value)>> && !is_same_v<bool, remove_cvref_t<decltype(_Tp::value)>> && |
| 618 | convertible_to<_Tp, decltype(_Tp::value)> && equality_comparable_with<_Tp, decltype(_Tp::value)> && | 601 | convertible_to<_Tp, decltype(_Tp::value)> && equality_comparable_with<_Tp, decltype(_Tp::value)> && |
| 619 | bool_constant<_Tp() == _Tp::value>::value && | 602 | bool_constant<_Tp() == _Tp::value>::value && |
| 620 | bool_constant<static_cast<decltype(_Tp::value)>(_Tp()) == _Tp::value>::value; | 603 | bool_constant<static_cast<decltype(_Tp::value)>(_Tp()) == _Tp::value>::value; |
| ... | @@ -627,10 +610,6 @@ inline constexpr size_t __maybe_static_ext<_Tp> = {_Tp::value}; | ... | @@ -627,10 +610,6 @@ inline constexpr size_t __maybe_static_ext<_Tp> = {_Tp::value}; |
| 627 | 610 | ||
| 628 | template <contiguous_iterator _It, class _EndOrSize> | 611 | template <contiguous_iterator _It, class _EndOrSize> |
| 629 | span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>, __maybe_static_ext<_EndOrSize>>; | 612 | span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>, __maybe_static_ext<_EndOrSize>>; |
| 630 | # else | ||
| 631 | template <contiguous_iterator _It, class _EndOrSize> | ||
| 632 | span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>; | ||
| 633 | # endif | ||
| 634 | 613 | ||
| 635 | template <class _Tp, size_t _Sz> | 614 | template <class _Tp, size_t _Sz> |
| 636 | span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>; | 615 | span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>; |
| ... | @@ -644,13 +623,13 @@ span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>; | ... | @@ -644,13 +623,13 @@ span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>; |
| 644 | template <ranges::contiguous_range _Range> | 623 | template <ranges::contiguous_range _Range> |
| 645 | span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>; | 624 | span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>; |
| 646 | 625 | ||
| 647 | # endif // _LIBCPP_STD_VER >= 20 | ||
| 648 | |||
| 649 | _LIBCPP_END_NAMESPACE_STD | 626 | _LIBCPP_END_NAMESPACE_STD |
| 650 | 627 | ||
| 628 | # endif // _LIBCPP_STD_VER >= 20 | ||
| 629 | |||
| 651 | _LIBCPP_POP_MACROS | 630 | _LIBCPP_POP_MACROS |
| 652 | 631 | ||
| 653 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 632 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 654 | # include <array> | 633 | # include <array> |
| 655 | # include <concepts> | 634 | # include <concepts> |
| 656 | # include <functional> | 635 | # include <functional> |
lib/libcxx/include/sstream+3-1| ... | @@ -338,6 +338,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -338,6 +338,7 @@ _LIBCPP_PUSH_MACROS |
| 338 | # include <__undef_macros> | 338 | # include <__undef_macros> |
| 339 | 339 | ||
| 340 | _LIBCPP_BEGIN_NAMESPACE_STD | 340 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 341 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 341 | 342 | ||
| 342 | // Class template basic_stringbuf [stringbuf] | 343 | // Class template basic_stringbuf [stringbuf] |
| 343 | 344 | ||
| ... | @@ -1288,13 +1289,14 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostringstream<char> | ... | @@ -1288,13 +1289,14 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostringstream<char> |
| 1288 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istringstream<char>; | 1289 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istringstream<char>; |
| 1289 | # endif | 1290 | # endif |
| 1290 | 1291 | ||
| 1292 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 1291 | _LIBCPP_END_NAMESPACE_STD | 1293 | _LIBCPP_END_NAMESPACE_STD |
| 1292 | 1294 | ||
| 1293 | _LIBCPP_POP_MACROS | 1295 | _LIBCPP_POP_MACROS |
| 1294 | 1296 | ||
| 1295 | # endif // _LIBCPP_HAS_LOCALIZATION | 1297 | # endif // _LIBCPP_HAS_LOCALIZATION |
| 1296 | 1298 | ||
| 1297 | # if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) | 1299 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1298 | # include <ostream> | 1300 | # include <ostream> |
| 1299 | # include <type_traits> | 1301 | # include <type_traits> |
| 1300 | # endif | 1302 | # endif |
lib/libcxx/include/stack+1-1| ... | @@ -377,7 +377,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -377,7 +377,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 377 | 377 | ||
| 378 | _LIBCPP_POP_MACROS | 378 | _LIBCPP_POP_MACROS |
| 379 | 379 | ||
| 380 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 380 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 381 | # include <concepts> | 381 | # include <concepts> |
| 382 | # include <functional> | 382 | # include <functional> |
| 383 | # include <type_traits> | 383 | # include <type_traits> |
lib/libcxx/include/stdatomic.h+1-1| ... | @@ -231,7 +231,7 @@ using std::atomic_store_explicit _LIBCPP_USING_IF_EXISTS; | ... | @@ -231,7 +231,7 @@ using std::atomic_store_explicit _LIBCPP_USING_IF_EXISTS; |
| 231 | using std::atomic_signal_fence _LIBCPP_USING_IF_EXISTS; | 231 | using std::atomic_signal_fence _LIBCPP_USING_IF_EXISTS; |
| 232 | using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS; | 232 | using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS; |
| 233 | 233 | ||
| 234 | # elif defined(_LIBCPP_COMPILER_CLANG_BASED) | 234 | # elif !defined(__cplusplus) || defined(_LIBCPP_COMPILER_CLANG_BASED) |
| 235 | 235 | ||
| 236 | // Before C++23, we include the next <stdatomic.h> on the path to avoid hijacking | 236 | // Before C++23, we include the next <stdatomic.h> on the path to avoid hijacking |
| 237 | // the header. We do this because Clang has historically shipped a <stdatomic.h> | 237 | // the header. We do this because Clang has historically shipped a <stdatomic.h> |
lib/libcxx/include/stdbool.h deleted-44| ... | @@ -1,44 +0,0 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP_STDBOOL_H | ||
| 11 | #define _LIBCPP_STDBOOL_H | ||
| 12 | |||
| 13 | /* | ||
| 14 | stdbool.h synopsis | ||
| 15 | |||
| 16 | Macros: | ||
| 17 | |||
| 18 | __bool_true_false_are_defined | ||
| 19 | |||
| 20 | */ | ||
| 21 | |||
| 22 | #if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | ||
| 23 | # include <__cxx03/stdbool.h> | ||
| 24 | #else | ||
| 25 | # include <__config> | ||
| 26 | |||
| 27 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 28 | # pragma GCC system_header | ||
| 29 | # endif | ||
| 30 | |||
| 31 | # if __has_include_next(<stdbool.h>) | ||
| 32 | # include_next <stdbool.h> | ||
| 33 | # endif | ||
| 34 | |||
| 35 | # ifdef __cplusplus | ||
| 36 | # undef bool | ||
| 37 | # undef true | ||
| 38 | # undef false | ||
| 39 | # undef __bool_true_false_are_defined | ||
| 40 | # define __bool_true_false_are_defined 1 | ||
| 41 | # endif | ||
| 42 | #endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | ||
| 43 | |||
| 44 | #endif // _LIBCPP_STDBOOL_H | ||
lib/libcxx/include/stdexcept+3-1| ... | @@ -212,7 +212,9 @@ public: | ... | @@ -212,7 +212,9 @@ public: |
| 212 | _LIBCPP_BEGIN_NAMESPACE_STD | 212 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 213 | 213 | ||
| 214 | // in the dylib | 214 | // in the dylib |
| 215 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 215 | [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*); | 216 | [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*); |
| 217 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 216 | 218 | ||
| 217 | [[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) { | 219 | [[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) { |
| 218 | # if _LIBCPP_HAS_EXCEPTIONS | 220 | # if _LIBCPP_HAS_EXCEPTIONS |
| ... | @@ -280,7 +282,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -280,7 +282,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 280 | 282 | ||
| 281 | _LIBCPP_END_NAMESPACE_STD | 283 | _LIBCPP_END_NAMESPACE_STD |
| 282 | 284 | ||
| 283 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 285 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 284 | # include <cstddef> | 286 | # include <cstddef> |
| 285 | # include <cstdlib> | 287 | # include <cstdlib> |
| 286 | # include <exception> | 288 | # include <exception> |
lib/libcxx/include/stop_token+5-1| ... | @@ -52,7 +52,11 @@ namespace std { | ... | @@ -52,7 +52,11 @@ namespace std { |
| 52 | 52 | ||
| 53 | # endif // _LIBCPP_HAS_THREADS | 53 | # endif // _LIBCPP_HAS_THREADS |
| 54 | 54 | ||
| 55 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 55 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 56 | # include <atomic> | ||
| 57 | # endif | ||
| 58 | |||
| 59 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 | ||
| 56 | # include <cstddef> | 60 | # include <cstddef> |
| 57 | # include <iosfwd> | 61 | # include <iosfwd> |
| 58 | # endif | 62 | # endif |
lib/libcxx/include/streambuf+4-2| ... | @@ -117,8 +117,8 @@ protected: | ... | @@ -117,8 +117,8 @@ protected: |
| 117 | # include <__assert> | 117 | # include <__assert> |
| 118 | # include <__fwd/streambuf.h> | 118 | # include <__fwd/streambuf.h> |
| 119 | # include <__locale> | 119 | # include <__locale> |
| 120 | # include <__memory/valid_range.h> | ||
| 120 | # include <__type_traits/is_same.h> | 121 | # include <__type_traits/is_same.h> |
| 121 | # include <__utility/is_valid_range.h> | ||
| 122 | # include <__utility/scope_guard.h> | 122 | # include <__utility/scope_guard.h> |
| 123 | # include <climits> | 123 | # include <climits> |
| 124 | # include <ios> | 124 | # include <ios> |
| ... | @@ -133,6 +133,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -133,6 +133,7 @@ _LIBCPP_PUSH_MACROS |
| 133 | # include <__undef_macros> | 133 | # include <__undef_macros> |
| 134 | 134 | ||
| 135 | _LIBCPP_BEGIN_NAMESPACE_STD | 135 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 136 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 136 | 137 | ||
| 137 | template <class _CharT, class _Traits> | 138 | template <class _CharT, class _Traits> |
| 138 | class basic_streambuf { | 139 | class basic_streambuf { |
| ... | @@ -430,13 +431,14 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>; | ... | @@ -430,13 +431,14 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>; |
| 430 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>; | 431 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>; |
| 431 | # endif | 432 | # endif |
| 432 | 433 | ||
| 434 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 433 | _LIBCPP_END_NAMESPACE_STD | 435 | _LIBCPP_END_NAMESPACE_STD |
| 434 | 436 | ||
| 435 | _LIBCPP_POP_MACROS | 437 | _LIBCPP_POP_MACROS |
| 436 | 438 | ||
| 437 | # endif // _LIBCPP_HAS_LOCALIZATION | 439 | # endif // _LIBCPP_HAS_LOCALIZATION |
| 438 | 440 | ||
| 439 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 441 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 440 | # include <cstdint> | 442 | # include <cstdint> |
| 441 | # include <optional> | 443 | # include <optional> |
| 442 | # endif | 444 | # endif |
lib/libcxx/include/string+164-224| ... | @@ -201,6 +201,7 @@ public: | ... | @@ -201,6 +201,7 @@ public: |
| 201 | basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20 | 201 | basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20 |
| 202 | basic_string& append(const value_type* s, size_type n); // constexpr since C++20 | 202 | basic_string& append(const value_type* s, size_type n); // constexpr since C++20 |
| 203 | basic_string& append(const value_type* s); // constexpr since C++20 | 203 | basic_string& append(const value_type* s); // constexpr since C++20 |
| 204 | basic_string& append(const value_type* s, size_type pos, size_type n); // constexpr since C++20 | ||
| 204 | basic_string& append(size_type n, value_type c); // constexpr since C++20 | 205 | basic_string& append(size_type n, value_type c); // constexpr since C++20 |
| 205 | template<class InputIterator> | 206 | template<class InputIterator> |
| 206 | basic_string& append(InputIterator first, InputIterator last); // constexpr since C++20 | 207 | basic_string& append(InputIterator first, InputIterator last); // constexpr since C++20 |
| ... | @@ -224,6 +225,7 @@ public: | ... | @@ -224,6 +225,7 @@ public: |
| 224 | basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20 | 225 | basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20 |
| 225 | basic_string& assign(const value_type* s, size_type n); // constexpr since C++20 | 226 | basic_string& assign(const value_type* s, size_type n); // constexpr since C++20 |
| 226 | basic_string& assign(const value_type* s); // constexpr since C++20 | 227 | basic_string& assign(const value_type* s); // constexpr since C++20 |
| 228 | basic_string& assign(const value_type* s, size_type pos, size_type n); // constexpr since C++20 | ||
| 227 | basic_string& assign(size_type n, value_type c); // constexpr since C++20 | 229 | basic_string& assign(size_type n, value_type c); // constexpr since C++20 |
| 228 | template<class InputIterator> | 230 | template<class InputIterator> |
| 229 | basic_string& assign(InputIterator first, InputIterator last); // constexpr since C++20 | 231 | basic_string& assign(InputIterator first, InputIterator last); // constexpr since C++20 |
| ... | @@ -597,6 +599,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); | ... | @@ -597,6 +599,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); |
| 597 | # include <__algorithm/remove_if.h> | 599 | # include <__algorithm/remove_if.h> |
| 598 | # include <__assert> | 600 | # include <__assert> |
| 599 | # include <__config> | 601 | # include <__config> |
| 602 | # include <__cstddef/size_t.h> | ||
| 600 | # include <__debug_utils/sanitizers.h> | 603 | # include <__debug_utils/sanitizers.h> |
| 601 | # include <__format/enable_insertable.h> | 604 | # include <__format/enable_insertable.h> |
| 602 | # include <__functional/hash.h> | 605 | # include <__functional/hash.h> |
| ... | @@ -625,9 +628,11 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); | ... | @@ -625,9 +628,11 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); |
| 625 | # include <__string/char_traits.h> | 628 | # include <__string/char_traits.h> |
| 626 | # include <__string/extern_template_lists.h> | 629 | # include <__string/extern_template_lists.h> |
| 627 | # include <__type_traits/conditional.h> | 630 | # include <__type_traits/conditional.h> |
| 631 | # include <__type_traits/desugars_to.h> | ||
| 628 | # include <__type_traits/enable_if.h> | 632 | # include <__type_traits/enable_if.h> |
| 629 | # include <__type_traits/is_allocator.h> | 633 | # include <__type_traits/is_allocator.h> |
| 630 | # include <__type_traits/is_array.h> | 634 | # include <__type_traits/is_array.h> |
| 635 | # include <__type_traits/is_constant_evaluated.h> | ||
| 631 | # include <__type_traits/is_convertible.h> | 636 | # include <__type_traits/is_convertible.h> |
| 632 | # include <__type_traits/is_generic_transparent_comparator.h> | 637 | # include <__type_traits/is_generic_transparent_comparator.h> |
| 633 | # include <__type_traits/is_nothrow_assignable.h> | 638 | # include <__type_traits/is_nothrow_assignable.h> |
| ... | @@ -637,9 +642,11 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); | ... | @@ -637,9 +642,11 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); |
| 637 | # include <__type_traits/is_trivially_constructible.h> | 642 | # include <__type_traits/is_trivially_constructible.h> |
| 638 | # include <__type_traits/is_trivially_copyable.h> | 643 | # include <__type_traits/is_trivially_copyable.h> |
| 639 | # include <__type_traits/is_trivially_relocatable.h> | 644 | # include <__type_traits/is_trivially_relocatable.h> |
| 645 | # include <__type_traits/remove_cv.h> | ||
| 640 | # include <__type_traits/remove_cvref.h> | 646 | # include <__type_traits/remove_cvref.h> |
| 641 | # include <__utility/default_three_way_comparator.h> | 647 | # include <__utility/default_three_way_comparator.h> |
| 642 | # include <__utility/exception_guard.h> | 648 | # include <__utility/exception_guard.h> |
| 649 | # include <__utility/exchange.h> | ||
| 643 | # include <__utility/forward.h> | 650 | # include <__utility/forward.h> |
| 644 | # include <__utility/is_pointer_in_range.h> | 651 | # include <__utility/is_pointer_in_range.h> |
| 645 | # include <__utility/move.h> | 652 | # include <__utility/move.h> |
| ... | @@ -678,18 +685,18 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); | ... | @@ -678,18 +685,18 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); |
| 678 | _LIBCPP_PUSH_MACROS | 685 | _LIBCPP_PUSH_MACROS |
| 679 | # include <__undef_macros> | 686 | # include <__undef_macros> |
| 680 | 687 | ||
| 681 | # if __has_feature(address_sanitizer) && _LIBCPP_INSTRUMENTED_WITH_ASAN | 688 | // Since std::string is partially instantiated in the built library, we require that the library |
| 682 | # define _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS __attribute__((__no_sanitize__("address"))) | 689 | // has been built with ASAN support in order to enable the container checks in std::string. |
| 683 | // This macro disables AddressSanitizer (ASan) instrumentation for a specific function, | 690 | // Within the <string> implementation, use `_LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS_FOR_STRING` |
| 684 | // allowing memory accesses that would normally trigger ASan errors to proceed without crashing. | 691 | // to determine whether ASAN container checks should be provided. |
| 685 | // This is useful for accessing parts of objects memory, which should not be accessed, | 692 | # if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS && _LIBCPP_INSTRUMENTED_WITH_ASAN |
| 686 | // such as unused bytes in short strings, that should never be accessed | 693 | # define _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS_FOR_STRING 1 |
| 687 | // by other parts of the program. | ||
| 688 | # else | 694 | # else |
| 689 | # define _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS | 695 | # define _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS_FOR_STRING 0 |
| 690 | # endif | 696 | # endif |
| 691 | 697 | ||
| 692 | _LIBCPP_BEGIN_NAMESPACE_STD | 698 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 699 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 693 | 700 | ||
| 694 | // basic_string | 701 | // basic_string |
| 695 | 702 | ||
| ... | @@ -749,44 +756,10 @@ public: | ... | @@ -749,44 +756,10 @@ public: |
| 749 | // | 756 | // |
| 750 | // This string implementation doesn't contain any references into itself. It only contains a bit that says whether | 757 | // This string implementation doesn't contain any references into itself. It only contains a bit that says whether |
| 751 | // it is in small or large string mode, so the entire structure is trivially relocatable if its members are. | 758 | // it is in small or large string mode, so the entire structure is trivially relocatable if its members are. |
| 752 | # if __has_feature(address_sanitizer) && _LIBCPP_INSTRUMENTED_WITH_ASAN | ||
| 753 | // When compiling with AddressSanitizer (ASan), basic_string cannot be trivially | ||
| 754 | // relocatable. Because the object's memory might be poisoned when its content | ||
| 755 | // is kept inside objects memory (short string optimization), instead of in allocated | ||
| 756 | // external memory. In such cases, the destructor is responsible for unpoisoning | ||
| 757 | // the memory to avoid triggering false positives. | ||
| 758 | // Therefore it's crucial to ensure the destructor is called. | ||
| 759 | using __trivially_relocatable _LIBCPP_NODEBUG = void; | ||
| 760 | # else | ||
| 761 | using __trivially_relocatable _LIBCPP_NODEBUG = __conditional_t< | 759 | using __trivially_relocatable _LIBCPP_NODEBUG = __conditional_t< |
| 762 | __libcpp_is_trivially_relocatable<allocator_type>::value && __libcpp_is_trivially_relocatable<pointer>::value, | 760 | __libcpp_is_trivially_relocatable<allocator_type>::value && __libcpp_is_trivially_relocatable<pointer>::value, |
| 763 | basic_string, | 761 | basic_string, |
| 764 | void>; | 762 | void>; |
| 765 | # endif | ||
| 766 | |||
| 767 | # if __has_feature(address_sanitizer) && _LIBCPP_INSTRUMENTED_WITH_ASAN | ||
| 768 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __asan_volatile_wrapper(pointer const& __ptr) const { | ||
| 769 | if (__libcpp_is_constant_evaluated()) | ||
| 770 | return __ptr; | ||
| 771 | |||
| 772 | pointer volatile __copy_ptr = __ptr; | ||
| 773 | |||
| 774 | return const_cast<pointer&>(__copy_ptr); | ||
| 775 | } | ||
| 776 | |||
| 777 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer | ||
| 778 | __asan_volatile_wrapper(const_pointer const& __ptr) const { | ||
| 779 | if (__libcpp_is_constant_evaluated()) | ||
| 780 | return __ptr; | ||
| 781 | |||
| 782 | const_pointer volatile __copy_ptr = __ptr; | ||
| 783 | |||
| 784 | return const_cast<const_pointer&>(__copy_ptr); | ||
| 785 | } | ||
| 786 | # define _LIBCPP_ASAN_VOLATILE_WRAPPER(PTR) __asan_volatile_wrapper(PTR) | ||
| 787 | # else | ||
| 788 | # define _LIBCPP_ASAN_VOLATILE_WRAPPER(PTR) PTR | ||
| 789 | # endif | ||
| 790 | 763 | ||
| 791 | static_assert(!is_array<value_type>::value, "Character type of basic_string must not be an array"); | 764 | static_assert(!is_array<value_type>::value, "Character type of basic_string must not be an array"); |
| 792 | static_assert(is_standard_layout<value_type>::value, "Character type of basic_string must be standard-layout"); | 765 | static_assert(is_standard_layout<value_type>::value, "Character type of basic_string must be standard-layout"); |
| ... | @@ -803,8 +776,8 @@ public: | ... | @@ -803,8 +776,8 @@ public: |
| 803 | // Users might provide custom allocators, and prior to C++20 we have no existing way to detect whether the allocator's | 776 | // Users might provide custom allocators, and prior to C++20 we have no existing way to detect whether the allocator's |
| 804 | // pointer type is contiguous (though it has to be by the Standard). Using the wrapper type ensures the iterator is | 777 | // pointer type is contiguous (though it has to be by the Standard). Using the wrapper type ensures the iterator is |
| 805 | // considered contiguous. | 778 | // considered contiguous. |
| 806 | using iterator = __bounded_iter<__wrap_iter<pointer> >; | 779 | using iterator = __bounded_iter<pointer>; |
| 807 | using const_iterator = __bounded_iter<__wrap_iter<const_pointer> >; | 780 | using const_iterator = __bounded_iter<const_pointer>; |
| 808 | # else | 781 | # else |
| 809 | using iterator = __wrap_iter<pointer>; | 782 | using iterator = __wrap_iter<pointer>; |
| 810 | using const_iterator = __wrap_iter<const_pointer>; | 783 | using const_iterator = __wrap_iter<const_pointer>; |
| ... | @@ -949,10 +922,7 @@ private: | ... | @@ -949,10 +922,7 @@ private: |
| 949 | // regardless of whether reallocation occurs. This allows us to check for out-of-bounds accesses using logical size, | 922 | // regardless of whether reallocation occurs. This allows us to check for out-of-bounds accesses using logical size, |
| 950 | // a stricter check, since correct code can never rely on being able to access newly-added elements via an existing | 923 | // a stricter check, since correct code can never rely on being able to access newly-added elements via an existing |
| 951 | // iterator. | 924 | // iterator. |
| 952 | return std::__make_bounded_iter( | 925 | return std::__make_bounded_iter(__p, __get_pointer(), __get_pointer() + size()); |
| 953 | std::__wrap_iter<pointer>(__p), | ||
| 954 | std::__wrap_iter<pointer>(__get_pointer()), | ||
| 955 | std::__wrap_iter<pointer>(__get_pointer() + size())); | ||
| 956 | # else | 926 | # else |
| 957 | return iterator(__p); | 927 | return iterator(__p); |
| 958 | # endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING | 928 | # endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING |
| ... | @@ -961,10 +931,7 @@ private: | ... | @@ -961,10 +931,7 @@ private: |
| 961 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_const_iterator(const_pointer __p) const { | 931 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_const_iterator(const_pointer __p) const { |
| 962 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING | 932 | # ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING |
| 963 | // Bound the iterator according to the size (and not the capacity, unlike vector). | 933 | // Bound the iterator according to the size (and not the capacity, unlike vector). |
| 964 | return std::__make_bounded_iter( | 934 | return std::__make_bounded_iter(__p, __get_pointer(), __get_pointer() + size()); |
| 965 | std::__wrap_iter<const_pointer>(__p), | ||
| 966 | std::__wrap_iter<const_pointer>(__get_pointer()), | ||
| 967 | std::__wrap_iter<const_pointer>(__get_pointer() + size())); | ||
| 968 | # else | 935 | # else |
| 969 | return const_iterator(__p); | 936 | return const_iterator(__p); |
| 970 | # endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING | 937 | # endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING |
| ... | @@ -975,12 +942,7 @@ public: | ... | @@ -975,12 +942,7 @@ public: |
| 975 | 942 | ||
| 976 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string() | 943 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string() |
| 977 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) | 944 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| 978 | # if _LIBCPP_STD_VER >= 20 // TODO(LLVM 23): Remove this condition; this is a workaround for https://llvm.org/PR154567 | 945 | : __rep_() { |
| 979 | : __rep_(__short()) | ||
| 980 | # else | ||
| 981 | : __rep_() | ||
| 982 | # endif | ||
| 983 | { | ||
| 984 | __annotate_new(0); | 946 | __annotate_new(0); |
| 985 | } | 947 | } |
| 986 | 948 | ||
| ... | @@ -990,16 +952,11 @@ public: | ... | @@ -990,16 +952,11 @@ public: |
| 990 | # else | 952 | # else |
| 991 | _NOEXCEPT | 953 | _NOEXCEPT |
| 992 | # endif | 954 | # endif |
| 993 | # if _LIBCPP_STD_VER >= 20 // TODO(LLVM 23): Remove this condition; this is a workaround for https://llvm.org/PR154567 | 955 | : __rep_(), __alloc_(__a) { |
| 994 | : __rep_(__short()), | ||
| 995 | # else | ||
| 996 | : __rep_(), | ||
| 997 | # endif | ||
| 998 | __alloc_(__a) { | ||
| 999 | __annotate_new(0); | 956 | __annotate_new(0); |
| 1000 | } | 957 | } |
| 1001 | 958 | ||
| 1002 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string(const basic_string& __str) | 959 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str) |
| 1003 | : __alloc_(__alloc_traits::select_on_container_copy_construction(__str.__alloc_)) { | 960 | : __alloc_(__alloc_traits::select_on_container_copy_construction(__str.__alloc_)) { |
| 1004 | if (!__str.__is_long()) { | 961 | if (!__str.__is_long()) { |
| 1005 | __rep_ = __str.__rep_; | 962 | __rep_ = __str.__rep_; |
| ... | @@ -1008,9 +965,7 @@ public: | ... | @@ -1008,9 +965,7 @@ public: |
| 1008 | __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); | 965 | __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); |
| 1009 | } | 966 | } |
| 1010 | 967 | ||
| 1011 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS | 968 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str, const allocator_type& __a) : __alloc_(__a) { |
| 1012 | basic_string(const basic_string& __str, const allocator_type& __a) | ||
| 1013 | : __alloc_(__a) { | ||
| 1014 | if (!__str.__is_long()) { | 969 | if (!__str.__is_long()) { |
| 1015 | __rep_ = __str.__rep_; | 970 | __rep_ = __str.__rep_; |
| 1016 | __annotate_new(__get_short_size()); | 971 | __annotate_new(__get_short_size()); |
| ... | @@ -1025,15 +980,7 @@ public: | ... | @@ -1025,15 +980,7 @@ public: |
| 1025 | # else | 980 | # else |
| 1026 | _NOEXCEPT | 981 | _NOEXCEPT |
| 1027 | # endif | 982 | # endif |
| 1028 | // Turning off ASan instrumentation for variable initialization with _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS | 983 | : __rep_(std::move(__str.__rep_)), __alloc_(std::move(__str.__alloc_)) { |
| 1029 | // does not work consistently during initialization of __r_, so we instead unpoison __str's memory manually first. | ||
| 1030 | // __str's memory needs to be unpoisoned only in the case where it's a short string. | ||
| 1031 | : __rep_([](basic_string& __s) -> decltype(__s.__rep_)&& { | ||
| 1032 | if (!__s.__is_long()) | ||
| 1033 | __s.__annotate_delete(); | ||
| 1034 | return std::move(__s.__rep_); | ||
| 1035 | }(__str)), | ||
| 1036 | __alloc_(std::move(__str.__alloc_)) { | ||
| 1037 | __str.__rep_ = __rep(); | 984 | __str.__rep_ = __rep(); |
| 1038 | __str.__annotate_new(0); | 985 | __str.__annotate_new(0); |
| 1039 | if (!__is_long()) | 986 | if (!__is_long()) |
| ... | @@ -1058,15 +1005,9 @@ public: | ... | @@ -1058,15 +1005,9 @@ public: |
| 1058 | } | 1005 | } |
| 1059 | # endif // _LIBCPP_CXX03_LANG | 1006 | # endif // _LIBCPP_CXX03_LANG |
| 1060 | 1007 | ||
| 1061 | template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0> | ||
| 1062 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s) { | ||
| 1063 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "basic_string(const char*) detected nullptr"); | ||
| 1064 | __init(__s, traits_type::length(__s)); | ||
| 1065 | } | ||
| 1066 | |||
| 1067 | template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0> | 1008 | template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0> |
| 1068 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | 1009 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 |
| 1069 | basic_string(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, const _Allocator& __a) | 1010 | basic_string(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, const _Allocator& __a = _Allocator()) |
| 1070 | : __alloc_(__a) { | 1011 | : __alloc_(__a) { |
| 1071 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); | 1012 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); |
| 1072 | __init(__s, traits_type::length(__s)); | 1013 | __init(__s, traits_type::length(__s)); |
| ... | @@ -1076,22 +1017,14 @@ public: | ... | @@ -1076,22 +1017,14 @@ public: |
| 1076 | basic_string(nullptr_t) = delete; | 1017 | basic_string(nullptr_t) = delete; |
| 1077 | # endif | 1018 | # endif |
| 1078 | 1019 | ||
| 1079 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n) | 1020 | _LIBCPP_HIDE_FROM_ABI |
| 1080 | _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") { | 1021 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n, const _Allocator& __a = _Allocator()) |
| 1081 | _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); | ||
| 1082 | __init(__s, __n); | ||
| 1083 | } | ||
| 1084 | |||
| 1085 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | ||
| 1086 | basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) | ||
| 1087 | _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") | 1022 | _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") |
| 1088 | : __alloc_(__a) { | 1023 | : __alloc_(__a) { |
| 1089 | _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); | 1024 | _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); |
| 1090 | __init(__s, __n); | 1025 | __init(__s, __n); |
| 1091 | } | 1026 | } |
| 1092 | 1027 | ||
| 1093 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c) { __init(__n, __c); } | ||
| 1094 | |||
| 1095 | # if _LIBCPP_STD_VER >= 23 | 1028 | # if _LIBCPP_STD_VER >= 23 |
| 1096 | _LIBCPP_HIDE_FROM_ABI constexpr basic_string( | 1029 | _LIBCPP_HIDE_FROM_ABI constexpr basic_string( |
| 1097 | basic_string&& __str, size_type __pos, const _Allocator& __alloc = _Allocator()) | 1030 | basic_string&& __str, size_type __pos, const _Allocator& __alloc = _Allocator()) |
| ... | @@ -1114,7 +1047,8 @@ public: | ... | @@ -1114,7 +1047,8 @@ public: |
| 1114 | # endif | 1047 | # endif |
| 1115 | 1048 | ||
| 1116 | template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0> | 1049 | template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0> |
| 1117 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a) | 1050 | _LIBCPP_HIDE_FROM_ABI |
| 1051 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a = _Allocator()) | ||
| 1118 | : __alloc_(__a) { | 1052 | : __alloc_(__a) { |
| 1119 | __init(__n, __c); | 1053 | __init(__n, __c); |
| 1120 | } | 1054 | } |
| ... | @@ -1153,29 +1087,16 @@ public: | ... | @@ -1153,29 +1087,16 @@ public: |
| 1153 | __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> && | 1087 | __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> && |
| 1154 | !is_same<__remove_cvref_t<_Tp>, basic_string>::value, | 1088 | !is_same<__remove_cvref_t<_Tp>, basic_string>::value, |
| 1155 | int> = 0> | 1089 | int> = 0> |
| 1156 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t) { | 1090 | _LIBCPP_HIDE_FROM_ABI |
| 1157 | __self_view __sv = __t; | 1091 | _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t, const allocator_type& __a = allocator_type()) |
| 1158 | __init(__sv.data(), __sv.size()); | ||
| 1159 | } | ||
| 1160 | |||
| 1161 | template <class _Tp, | ||
| 1162 | __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> && | ||
| 1163 | !is_same<__remove_cvref_t<_Tp>, basic_string>::value, | ||
| 1164 | int> = 0> | ||
| 1165 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t, const allocator_type& __a) | ||
| 1166 | : __alloc_(__a) { | 1092 | : __alloc_(__a) { |
| 1167 | __self_view __sv = __t; | 1093 | __self_view __sv = __t; |
| 1168 | __init(__sv.data(), __sv.size()); | 1094 | __init(__sv.data(), __sv.size()); |
| 1169 | } | 1095 | } |
| 1170 | 1096 | ||
| 1171 | template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0> | ||
| 1172 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(_InputIterator __first, _InputIterator __last) { | ||
| 1173 | __init(__first, __last); | ||
| 1174 | } | ||
| 1175 | |||
| 1176 | template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0> | 1097 | template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0> |
| 1177 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | 1098 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 |
| 1178 | basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a) | 1099 | basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) |
| 1179 | : __alloc_(__a) { | 1100 | : __alloc_(__a) { |
| 1180 | __init(__first, __last); | 1101 | __init(__first, __last); |
| 1181 | } | 1102 | } |
| ... | @@ -1194,11 +1115,8 @@ public: | ... | @@ -1194,11 +1115,8 @@ public: |
| 1194 | # endif | 1115 | # endif |
| 1195 | 1116 | ||
| 1196 | # ifndef _LIBCPP_CXX03_LANG | 1117 | # ifndef _LIBCPP_CXX03_LANG |
| 1197 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il) { | 1118 | _LIBCPP_HIDE_FROM_ABI |
| 1198 | __init(__il.begin(), __il.end()); | 1119 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il, const _Allocator& __a = _Allocator()) |
| 1199 | } | ||
| 1200 | |||
| 1201 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il, const _Allocator& __a) | ||
| 1202 | : __alloc_(__a) { | 1120 | : __alloc_(__a) { |
| 1203 | __init(__il.begin(), __il.end()); | 1121 | __init(__il.begin(), __il.end()); |
| 1204 | } | 1122 | } |
| ... | @@ -1213,8 +1131,7 @@ public: | ... | @@ -1213,8 +1131,7 @@ public: |
| 1213 | return __self_view(typename __self_view::__assume_valid(), data(), size()); | 1131 | return __self_view(typename __self_view::__assume_valid(), data(), size()); |
| 1214 | } | 1132 | } |
| 1215 | 1133 | ||
| 1216 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string& | 1134 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const basic_string& __str); |
| 1217 | operator=(const basic_string& __str); | ||
| 1218 | 1135 | ||
| 1219 | template <class _Tp, | 1136 | template <class _Tp, |
| 1220 | __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> && | 1137 | __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> && |
| ... | @@ -1427,6 +1344,8 @@ public: | ... | @@ -1427,6 +1344,8 @@ public: |
| 1427 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n) | 1344 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n) |
| 1428 | _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero"); | 1345 | _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero"); |
| 1429 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s); | 1346 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s); |
| 1347 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __pos, size_type __n) | ||
| 1348 | _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero"); | ||
| 1430 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c); | 1349 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c); |
| 1431 | 1350 | ||
| 1432 | template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0> | 1351 | template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0> |
| ... | @@ -1450,7 +1369,7 @@ public: | ... | @@ -1450,7 +1369,7 @@ public: |
| 1450 | if (__cap - __sz < __n) | 1369 | if (__cap - __sz < __n) |
| 1451 | __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0); | 1370 | __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0); |
| 1452 | __annotate_increase(__n); | 1371 | __annotate_increase(__n); |
| 1453 | auto __end = __copy_non_overlapping_range(__first, __last, std::__to_address(__get_pointer() + __sz)); | 1372 | auto __end = __copy_non_overlapping_range(__first, __last, __data() + __sz); |
| 1454 | traits_type::assign(*__end, value_type()); | 1373 | traits_type::assign(*__end, value_type()); |
| 1455 | __set_size(__sz + __n); | 1374 | __set_size(__sz + __n); |
| 1456 | return *this; | 1375 | return *this; |
| ... | @@ -1510,8 +1429,7 @@ public: | ... | @@ -1510,8 +1429,7 @@ public: |
| 1510 | size_type __old_sz = __str.size(); | 1429 | size_type __old_sz = __str.size(); |
| 1511 | if (!__str.__is_long()) | 1430 | if (!__str.__is_long()) |
| 1512 | __str.__annotate_delete(); | 1431 | __str.__annotate_delete(); |
| 1513 | __rep_ = __str.__rep_; | 1432 | __rep_ = std::__exchange(__str.__rep_, __rep()); |
| 1514 | __str.__rep_ = __rep(); | ||
| 1515 | __str.__annotate_new(0); | 1433 | __str.__annotate_new(0); |
| 1516 | 1434 | ||
| 1517 | _Traits::move(data(), data() + __pos, __len); | 1435 | _Traits::move(data(), data() + __pos, __len); |
| ... | @@ -1554,6 +1472,8 @@ public: | ... | @@ -1554,6 +1472,8 @@ public: |
| 1554 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n) | 1472 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n) |
| 1555 | _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero"); | 1473 | _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero"); |
| 1556 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s); | 1474 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s); |
| 1475 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __pos, size_type __n) | ||
| 1476 | _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero"); | ||
| 1557 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c); | 1477 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c); |
| 1558 | 1478 | ||
| 1559 | template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0> | 1479 | template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0> |
| ... | @@ -1807,6 +1727,13 @@ public: | ... | @@ -1807,6 +1727,13 @@ public: |
| 1807 | } | 1727 | } |
| 1808 | # endif | 1728 | # endif |
| 1809 | 1729 | ||
| 1730 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* __data() const _NOEXCEPT { | ||
| 1731 | return std::__to_address(__get_pointer()); | ||
| 1732 | } | ||
| 1733 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 value_type* __data() _NOEXCEPT { | ||
| 1734 | return std::__to_address(__get_pointer()); | ||
| 1735 | } | ||
| 1736 | |||
| 1810 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT { | 1737 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT { |
| 1811 | return __alloc_; | 1738 | return __alloc_; |
| 1812 | } | 1739 | } |
| ... | @@ -1815,14 +1742,14 @@ public: | ... | @@ -1815,14 +1742,14 @@ public: |
| 1815 | 1742 | ||
| 1816 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1743 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1817 | find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT { | 1744 | find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT { |
| 1818 | return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __str.data(), __pos, __str.size()); | 1745 | return find(__str.data(), __pos, __str.size()); |
| 1819 | } | 1746 | } |
| 1820 | 1747 | ||
| 1821 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> | 1748 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> |
| 1822 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1749 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1823 | find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT { | 1750 | find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT { |
| 1824 | __self_view __sv = __t; | 1751 | __self_view __sv = __t; |
| 1825 | return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size()); | 1752 | return find(__sv.data(), __pos, __sv.size()); |
| 1826 | } | 1753 | } |
| 1827 | 1754 | ||
| 1828 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1755 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| ... | @@ -1835,8 +1762,7 @@ public: | ... | @@ -1835,8 +1762,7 @@ public: |
| 1835 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1762 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1836 | find(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT { | 1763 | find(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT { |
| 1837 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find(): received nullptr"); | 1764 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find(): received nullptr"); |
| 1838 | return std::__str_find<value_type, size_type, traits_type, npos>( | 1765 | return find(__s, __pos, traits_type::length(__s)); |
| 1839 | data(), size(), __s, __pos, traits_type::length(__s)); | ||
| 1840 | } | 1766 | } |
| 1841 | 1767 | ||
| 1842 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT { | 1768 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT { |
| ... | @@ -1847,15 +1773,14 @@ public: | ... | @@ -1847,15 +1773,14 @@ public: |
| 1847 | 1773 | ||
| 1848 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1774 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1849 | rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT { | 1775 | rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT { |
| 1850 | return std::__str_rfind<value_type, size_type, traits_type, npos>( | 1776 | return rfind(__str.data(), __pos, __str.size()); |
| 1851 | data(), size(), __str.data(), __pos, __str.size()); | ||
| 1852 | } | 1777 | } |
| 1853 | 1778 | ||
| 1854 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> | 1779 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> |
| 1855 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1780 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1856 | rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT { | 1781 | rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT { |
| 1857 | __self_view __sv = __t; | 1782 | __self_view __sv = __t; |
| 1858 | return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size()); | 1783 | return rfind(__sv.data(), __pos, __sv.size()); |
| 1859 | } | 1784 | } |
| 1860 | 1785 | ||
| 1861 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1786 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| ... | @@ -1868,8 +1793,7 @@ public: | ... | @@ -1868,8 +1793,7 @@ public: |
| 1868 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1793 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1869 | rfind(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT { | 1794 | rfind(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT { |
| 1870 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::rfind(): received nullptr"); | 1795 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::rfind(): received nullptr"); |
| 1871 | return std::__str_rfind<value_type, size_type, traits_type, npos>( | 1796 | return rfind(__s, __pos, traits_type::length(__s)); |
| 1872 | data(), size(), __s, __pos, traits_type::length(__s)); | ||
| 1873 | } | 1797 | } |
| 1874 | 1798 | ||
| 1875 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1799 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| ... | @@ -1881,16 +1805,14 @@ public: | ... | @@ -1881,16 +1805,14 @@ public: |
| 1881 | 1805 | ||
| 1882 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1806 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1883 | find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT { | 1807 | find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT { |
| 1884 | return std::__str_find_first_of<value_type, size_type, traits_type, npos>( | 1808 | return find_first_of(__str.data(), __pos, __str.size()); |
| 1885 | data(), size(), __str.data(), __pos, __str.size()); | ||
| 1886 | } | 1809 | } |
| 1887 | 1810 | ||
| 1888 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> | 1811 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> |
| 1889 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1812 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1890 | find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT { | 1813 | find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT { |
| 1891 | __self_view __sv = __t; | 1814 | __self_view __sv = __t; |
| 1892 | return std::__str_find_first_of<value_type, size_type, traits_type, npos>( | 1815 | return find_first_of(__sv.data(), __pos, __sv.size()); |
| 1893 | data(), size(), __sv.data(), __pos, __sv.size()); | ||
| 1894 | } | 1816 | } |
| 1895 | 1817 | ||
| 1896 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1818 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| ... | @@ -1903,8 +1825,7 @@ public: | ... | @@ -1903,8 +1825,7 @@ public: |
| 1903 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1825 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1904 | find_first_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT { | 1826 | find_first_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT { |
| 1905 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_of(): received nullptr"); | 1827 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_of(): received nullptr"); |
| 1906 | return std::__str_find_first_of<value_type, size_type, traits_type, npos>( | 1828 | return find_first_of(__s, __pos, traits_type::length(__s)); |
| 1907 | data(), size(), __s, __pos, traits_type::length(__s)); | ||
| 1908 | } | 1829 | } |
| 1909 | 1830 | ||
| 1910 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1831 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| ... | @@ -1916,16 +1837,14 @@ public: | ... | @@ -1916,16 +1837,14 @@ public: |
| 1916 | 1837 | ||
| 1917 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1838 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1918 | find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT { | 1839 | find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT { |
| 1919 | return std::__str_find_last_of<value_type, size_type, traits_type, npos>( | 1840 | return find_last_of(__str.data(), __pos, __str.size()); |
| 1920 | data(), size(), __str.data(), __pos, __str.size()); | ||
| 1921 | } | 1841 | } |
| 1922 | 1842 | ||
| 1923 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> | 1843 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> |
| 1924 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1844 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1925 | find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT { | 1845 | find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT { |
| 1926 | __self_view __sv = __t; | 1846 | __self_view __sv = __t; |
| 1927 | return std::__str_find_last_of<value_type, size_type, traits_type, npos>( | 1847 | return find_last_of(__sv.data(), __pos, __sv.size()); |
| 1928 | data(), size(), __sv.data(), __pos, __sv.size()); | ||
| 1929 | } | 1848 | } |
| 1930 | 1849 | ||
| 1931 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1850 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| ... | @@ -1938,8 +1857,7 @@ public: | ... | @@ -1938,8 +1857,7 @@ public: |
| 1938 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1857 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1939 | find_last_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT { | 1858 | find_last_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT { |
| 1940 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_of(): received nullptr"); | 1859 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_of(): received nullptr"); |
| 1941 | return std::__str_find_last_of<value_type, size_type, traits_type, npos>( | 1860 | return find_last_of(__s, __pos, traits_type::length(__s)); |
| 1942 | data(), size(), __s, __pos, traits_type::length(__s)); | ||
| 1943 | } | 1861 | } |
| 1944 | 1862 | ||
| 1945 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1863 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| ... | @@ -1951,16 +1869,14 @@ public: | ... | @@ -1951,16 +1869,14 @@ public: |
| 1951 | 1869 | ||
| 1952 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1870 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1953 | find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT { | 1871 | find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT { |
| 1954 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>( | 1872 | return find_first_not_of(__str.data(), __pos, __str.size()); |
| 1955 | data(), size(), __str.data(), __pos, __str.size()); | ||
| 1956 | } | 1873 | } |
| 1957 | 1874 | ||
| 1958 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> | 1875 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> |
| 1959 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1876 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1960 | find_first_not_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT { | 1877 | find_first_not_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT { |
| 1961 | __self_view __sv = __t; | 1878 | __self_view __sv = __t; |
| 1962 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>( | 1879 | return find_first_not_of(__sv.data(), __pos, __sv.size()); |
| 1963 | data(), size(), __sv.data(), __pos, __sv.size()); | ||
| 1964 | } | 1880 | } |
| 1965 | 1881 | ||
| 1966 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1882 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| ... | @@ -1973,8 +1889,7 @@ public: | ... | @@ -1973,8 +1889,7 @@ public: |
| 1973 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1889 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1974 | find_first_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT { | 1890 | find_first_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT { |
| 1975 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_not_of(): received nullptr"); | 1891 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_not_of(): received nullptr"); |
| 1976 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>( | 1892 | return find_first_not_of(__s, __pos, traits_type::length(__s)); |
| 1977 | data(), size(), __s, __pos, traits_type::length(__s)); | ||
| 1978 | } | 1893 | } |
| 1979 | 1894 | ||
| 1980 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1895 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| ... | @@ -1986,16 +1901,14 @@ public: | ... | @@ -1986,16 +1901,14 @@ public: |
| 1986 | 1901 | ||
| 1987 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1902 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1988 | find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT { | 1903 | find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT { |
| 1989 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>( | 1904 | return find_last_not_of(__str.data(), __pos, __str.size()); |
| 1990 | data(), size(), __str.data(), __pos, __str.size()); | ||
| 1991 | } | 1905 | } |
| 1992 | 1906 | ||
| 1993 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> | 1907 | template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0> |
| 1994 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1908 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 1995 | find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT { | 1909 | find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT { |
| 1996 | __self_view __sv = __t; | 1910 | __self_view __sv = __t; |
| 1997 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>( | 1911 | return find_last_not_of(__sv.data(), __pos, __sv.size()); |
| 1998 | data(), size(), __sv.data(), __pos, __sv.size()); | ||
| 1999 | } | 1912 | } |
| 2000 | 1913 | ||
| 2001 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1914 | [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| ... | @@ -2008,8 +1921,7 @@ public: | ... | @@ -2008,8 +1921,7 @@ public: |
| 2008 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1921 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| 2009 | find_last_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT { | 1922 | find_last_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT { |
| 2010 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_not_of(): received nullptr"); | 1923 | _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_not_of(): received nullptr"); |
| 2011 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>( | 1924 | return find_last_not_of(__s, __pos, traits_type::length(__s)); |
| 2012 | data(), size(), __s, __pos, traits_type::length(__s)); | ||
| 2013 | } | 1925 | } |
| 2014 | 1926 | ||
| 2015 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type | 1927 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type |
| ... | @@ -2134,8 +2046,7 @@ public: | ... | @@ -2134,8 +2046,7 @@ public: |
| 2134 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const; | 2046 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const; |
| 2135 | 2047 | ||
| 2136 | private: | 2048 | private: |
| 2137 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS bool | 2049 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_long() const _NOEXCEPT { |
| 2138 | __is_long() const _NOEXCEPT { | ||
| 2139 | if (__libcpp_is_constant_evaluated() && __builtin_constant_p(__rep_.__l.__is_long_)) { | 2050 | if (__libcpp_is_constant_evaluated() && __builtin_constant_p(__rep_.__l.__is_long_)) { |
| 2140 | return __rep_.__l.__is_long_; | 2051 | return __rep_.__l.__is_long_; |
| 2141 | } | 2052 | } |
| ... | @@ -2180,7 +2091,7 @@ private: | ... | @@ -2180,7 +2091,7 @@ private: |
| 2180 | value_type* __p; | 2091 | value_type* __p; |
| 2181 | if (__cap - __sz >= __n) { | 2092 | if (__cap - __sz >= __n) { |
| 2182 | __annotate_increase(__n); | 2093 | __annotate_increase(__n); |
| 2183 | __p = std::__to_address(__get_pointer()); | 2094 | __p = __data(); |
| 2184 | size_type __n_move = __sz - __ip; | 2095 | size_type __n_move = __sz - __ip; |
| 2185 | if (__n_move != 0) | 2096 | if (__n_move != 0) |
| 2186 | traits_type::move(__p + __ip + __n, __p + __ip, __n_move); | 2097 | traits_type::move(__p + __ip + __n, __p + __ip, __n_move); |
| ... | @@ -2203,15 +2114,13 @@ private: | ... | @@ -2203,15 +2114,13 @@ private: |
| 2203 | // internal buffer accessors | 2114 | // internal buffer accessors |
| 2204 | // ------------------------- | 2115 | // ------------------------- |
| 2205 | 2116 | ||
| 2206 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void | 2117 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_short_size(size_type __s) _NOEXCEPT { |
| 2207 | __set_short_size(size_type __s) _NOEXCEPT { | ||
| 2208 | _LIBCPP_ASSERT_INTERNAL(__s < __min_cap, "__s should never be greater than or equal to the short string capacity"); | 2118 | _LIBCPP_ASSERT_INTERNAL(__s < __min_cap, "__s should never be greater than or equal to the short string capacity"); |
| 2209 | __rep_.__s.__size_ = __s; | 2119 | __rep_.__s.__size_ = __s; |
| 2210 | __rep_.__s.__is_long_ = false; | 2120 | __rep_.__s.__is_long_ = false; |
| 2211 | } | 2121 | } |
| 2212 | 2122 | ||
| 2213 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS size_type | 2123 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_short_size() const _NOEXCEPT { |
| 2214 | __get_short_size() const _NOEXCEPT { | ||
| 2215 | _LIBCPP_ASSERT_INTERNAL(!__rep_.__s.__is_long_, "String has to be short when trying to get the short size"); | 2124 | _LIBCPP_ASSERT_INTERNAL(!__rep_.__s.__is_long_, "String has to be short when trying to get the short size"); |
| 2216 | return __rep_.__s.__size_; | 2125 | return __rep_.__s.__size_; |
| 2217 | } | 2126 | } |
| ... | @@ -2239,22 +2148,20 @@ private: | ... | @@ -2239,22 +2148,20 @@ private: |
| 2239 | 2148 | ||
| 2240 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_long_pointer() _NOEXCEPT { | 2149 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_long_pointer() _NOEXCEPT { |
| 2241 | _LIBCPP_ASSERT_INTERNAL(__rep_.__l.__is_long_, "String has to be long when trying to get the long pointer"); | 2150 | _LIBCPP_ASSERT_INTERNAL(__rep_.__l.__is_long_, "String has to be long when trying to get the long pointer"); |
| 2242 | return _LIBCPP_ASAN_VOLATILE_WRAPPER(__rep_.__l.__data_); | 2151 | return __rep_.__l.__data_; |
| 2243 | } | 2152 | } |
| 2244 | 2153 | ||
| 2245 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_long_pointer() const _NOEXCEPT { | 2154 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_long_pointer() const _NOEXCEPT { |
| 2246 | _LIBCPP_ASSERT_INTERNAL(__rep_.__l.__is_long_, "String has to be long when trying to get the long pointer"); | 2155 | _LIBCPP_ASSERT_INTERNAL(__rep_.__l.__is_long_, "String has to be long when trying to get the long pointer"); |
| 2247 | return _LIBCPP_ASAN_VOLATILE_WRAPPER(__rep_.__l.__data_); | 2156 | return __rep_.__l.__data_; |
| 2248 | } | 2157 | } |
| 2249 | 2158 | ||
| 2250 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS pointer | 2159 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_short_pointer() _NOEXCEPT { |
| 2251 | __get_short_pointer() _NOEXCEPT { | 2160 | return pointer_traits<pointer>::pointer_to(__rep_.__s.__data_[0]); |
| 2252 | return _LIBCPP_ASAN_VOLATILE_WRAPPER(pointer_traits<pointer>::pointer_to(__rep_.__s.__data_[0])); | ||
| 2253 | } | 2161 | } |
| 2254 | 2162 | ||
| 2255 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS const_pointer | 2163 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_short_pointer() const _NOEXCEPT { |
| 2256 | __get_short_pointer() const _NOEXCEPT { | 2164 | return pointer_traits<const_pointer>::pointer_to(__rep_.__s.__data_[0]); |
| 2257 | return _LIBCPP_ASAN_VOLATILE_WRAPPER(pointer_traits<const_pointer>::pointer_to(__rep_.__s.__data_[0])); | ||
| 2258 | } | 2165 | } |
| 2259 | 2166 | ||
| 2260 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_pointer() _NOEXCEPT { | 2167 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_pointer() _NOEXCEPT { |
| ... | @@ -2272,17 +2179,24 @@ private: | ... | @@ -2272,17 +2179,24 @@ private: |
| 2272 | 2179 | ||
| 2273 | // Allocate a buffer of __capacity size with __alloc and return it | 2180 | // Allocate a buffer of __capacity size with __alloc and return it |
| 2274 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 __long | 2181 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 __long |
| 2275 | __allocate_long_buffer(_Allocator& __alloc, size_type __capacity) { | 2182 | __allocate_long_buffer(_Allocator& __alloc, size_type __size, size_type __min_capacity) { |
| 2276 | _LIBCPP_ASSERT_INTERNAL(!__fits_in_sso(__capacity), | 2183 | _LIBCPP_ASSERT_INTERNAL( |
| 2184 | __size <= __min_capacity, "Trying to allocate a long buffer with a smaller capacity than size"); | ||
| 2185 | _LIBCPP_ASSERT_INTERNAL(!__fits_in_sso(__min_capacity), | ||
| 2277 | "Trying to allocate long buffer for a capacity what would fit into the small buffer"); | 2186 | "Trying to allocate long buffer for a capacity what would fit into the small buffer"); |
| 2278 | auto __buffer = std::__allocate_at_least(__alloc, __align_allocation_size(__capacity)); | 2187 | auto __buffer = std::__allocate_at_least(__alloc, __align_allocation_size(__min_capacity)); |
| 2279 | 2188 | ||
| 2280 | if (__libcpp_is_constant_evaluated()) { | 2189 | if (__libcpp_is_constant_evaluated()) { |
| 2281 | for (size_type __i = 0; __i != __buffer.count; ++__i) | 2190 | for (size_type __i = 0; __i != __buffer.count; ++__i) |
| 2282 | std::__construct_at(std::addressof(__buffer.ptr[__i])); | 2191 | std::__construct_at(std::addressof(__buffer.ptr[__i])); |
| 2283 | } | 2192 | } |
| 2284 | 2193 | ||
| 2285 | return __long(__buffer, __capacity); | 2194 | return __long(__buffer, __size); |
| 2195 | } | ||
| 2196 | |||
| 2197 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 __long | ||
| 2198 | __allocate_long_buffer(_Allocator& __alloc, size_type __size) { | ||
| 2199 | return __allocate_long_buffer(__alloc, __size, __size); | ||
| 2286 | } | 2200 | } |
| 2287 | 2201 | ||
| 2288 | // Replace the current buffer with __new_rep. Deallocate the old long buffer if it exists. | 2202 | // Replace the current buffer with __new_rep. Deallocate the old long buffer if it exists. |
| ... | @@ -2321,13 +2235,9 @@ private: | ... | @@ -2321,13 +2235,9 @@ private: |
| 2321 | __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const { | 2235 | __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const { |
| 2322 | (void)__old_mid; | 2236 | (void)__old_mid; |
| 2323 | (void)__new_mid; | 2237 | (void)__new_mid; |
| 2324 | # if _LIBCPP_INSTRUMENTED_WITH_ASAN | 2238 | # if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS_FOR_STRING |
| 2325 | # if defined(__APPLE__) | 2239 | if (__is_long()) |
| 2326 | // TODO: remove after addressing issue #96099 (https://llvm.org/PR96099) | 2240 | std::__annotate_contiguous_container<_Allocator>(data(), data() + capacity() + 1, __old_mid, __new_mid); |
| 2327 | if (!__is_long()) | ||
| 2328 | return; | ||
| 2329 | # endif | ||
| 2330 | std::__annotate_contiguous_container<_Allocator>(data(), data() + capacity() + 1, __old_mid, __new_mid); | ||
| 2331 | # endif | 2241 | # endif |
| 2332 | } | 2242 | } |
| 2333 | 2243 | ||
| ... | @@ -2366,7 +2276,17 @@ private: | ... | @@ -2366,7 +2276,17 @@ private: |
| 2366 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __align_it(size_type __s) _NOEXCEPT { | 2276 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __align_it(size_type __s) _NOEXCEPT { |
| 2367 | return (__s + (__a - 1)) & ~(__a - 1); | 2277 | return (__s + (__a - 1)) & ~(__a - 1); |
| 2368 | } | 2278 | } |
| 2369 | enum { __alignment = 8 }; | 2279 | |
| 2280 | // GCC currently doesn't define __STDCPP_DEFAULT_NEW_ALIGNMENT__ unconditionally | ||
| 2281 | // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123872 | ||
| 2282 | # ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__ | ||
| 2283 | static inline const size_t | ||
| 2284 | __alignment = __is_std_allocator_v<allocator_type> && __STDCPP_DEFAULT_NEW_ALIGNMENT__ > sizeof(void*) | ||
| 2285 | ? __STDCPP_DEFAULT_NEW_ALIGNMENT__ | ||
| 2286 | : sizeof(void*); | ||
| 2287 | # else | ||
| 2288 | static inline const size_t __alignment = sizeof(void*); | ||
| 2289 | # endif | ||
| 2370 | 2290 | ||
| 2371 | // This makes sure that we're using a capacity with some extra alignment, since allocators almost always over-align | 2291 | // This makes sure that we're using a capacity with some extra alignment, since allocators almost always over-align |
| 2372 | // the allocations anyways, improving memory usage. More importantly, this ensures that the lowest bit is never set | 2292 | // the allocations anyways, improving memory usage. More importantly, this ensures that the lowest bit is never set |
| ... | @@ -2458,7 +2378,7 @@ private: | ... | @@ -2458,7 +2378,7 @@ private: |
| 2458 | 2378 | ||
| 2459 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __erase_to_end(size_type __pos) { | 2379 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __erase_to_end(size_type __pos) { |
| 2460 | _LIBCPP_ASSERT_INTERNAL(__pos <= capacity(), "Trying to erase at position outside the strings capacity!"); | 2380 | _LIBCPP_ASSERT_INTERNAL(__pos <= capacity(), "Trying to erase at position outside the strings capacity!"); |
| 2461 | __null_terminate_at(std::__to_address(__get_pointer()), __pos); | 2381 | __null_terminate_at(__data(), __pos); |
| 2462 | } | 2382 | } |
| 2463 | 2383 | ||
| 2464 | // __erase_external_with_move is invoked for erase() invocations where | 2384 | // __erase_external_with_move is invoked for erase() invocations where |
| ... | @@ -2494,8 +2414,7 @@ private: | ... | @@ -2494,8 +2414,7 @@ private: |
| 2494 | # ifndef _LIBCPP_CXX03_LANG | 2414 | # ifndef _LIBCPP_CXX03_LANG |
| 2495 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void | 2415 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void |
| 2496 | __move_assign(basic_string& __str, false_type) noexcept(__alloc_traits::is_always_equal::value); | 2416 | __move_assign(basic_string& __str, false_type) noexcept(__alloc_traits::is_always_equal::value); |
| 2497 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void | 2417 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(basic_string& __str, true_type) |
| 2498 | __move_assign(basic_string& __str, true_type) | ||
| 2499 | # if _LIBCPP_STD_VER >= 17 | 2418 | # if _LIBCPP_STD_VER >= 17 |
| 2500 | noexcept; | 2419 | noexcept; |
| 2501 | # else | 2420 | # else |
| ... | @@ -2610,19 +2529,29 @@ struct __default_three_way_comparator<basic_string<_CharT, _Traits, _Alloc>, bas | ... | @@ -2610,19 +2529,29 @@ struct __default_three_way_comparator<basic_string<_CharT, _Traits, _Alloc>, bas |
| 2610 | }; | 2529 | }; |
| 2611 | # endif | 2530 | # endif |
| 2612 | 2531 | ||
| 2613 | template <class _Comparator, class _CharT, class _Traits, class _Alloc> | 2532 | template <class _Comparator, class _CharT2, class _CharT, class _Traits, class _Alloc> |
| 2614 | inline const bool __is_transparently_comparable_v<_Comparator, | 2533 | inline const bool __is_transparently_comparable_v<_Comparator, basic_string<_CharT, _Traits, _Alloc>, _CharT2*> = |
| 2615 | basic_string<_CharT, _Traits, _Alloc>, | 2534 | is_same<_CharT, __remove_cv_t<_CharT2> >::value && |
| 2616 | const _CharT*, | 2535 | (__desugars_to_v<__less_tag, |
| 2617 | __enable_if_t<__is_generic_transparent_comparator_v<_Comparator> > > = | 2536 | _Comparator, |
| 2618 | true; | 2537 | basic_string<_CharT, _Traits, _Alloc>, |
| 2538 | basic_string<_CharT, _Traits, _Alloc> > || | ||
| 2539 | __desugars_to_v<__greater_tag, | ||
| 2540 | _Comparator, | ||
| 2541 | basic_string<_CharT, _Traits, _Alloc>, | ||
| 2542 | basic_string<_CharT, _Traits, _Alloc> >); | ||
| 2543 | |||
| 2544 | template <class _Comparator, class _CharT2, class _CharT, class _Traits, class _Alloc> | ||
| 2545 | inline const bool __is_transparently_comparable_v<_Comparator, _CharT2*, basic_string<_CharT, _Traits, _Alloc> > = | ||
| 2546 | __is_transparently_comparable_v<_Comparator, basic_string<_CharT, _Traits, _Alloc>, _CharT2*>; | ||
| 2619 | 2547 | ||
| 2620 | template <class _Comparator, class _CharT, class _Traits, class _Alloc, size_t _Np> | 2548 | template <class _Comparator, class _CharT, class _Traits, class _Alloc, size_t _Np> |
| 2621 | inline const bool __is_transparently_comparable_v<_Comparator, | 2549 | inline const bool __is_transparently_comparable_v<_Comparator, basic_string<_CharT, _Traits, _Alloc>, _CharT[_Np]> = |
| 2622 | basic_string<_CharT, _Traits, _Alloc>, | 2550 | __is_transparently_comparable_v<_Comparator, basic_string<_CharT, _Traits, _Alloc>, const _CharT*>; |
| 2623 | _CharT[_Np], | 2551 | |
| 2624 | __enable_if_t<__is_generic_transparent_comparator_v<_Comparator> > > = | 2552 | template <class _Comparator, class _CharT, class _Traits, class _Alloc, size_t _Np> |
| 2625 | true; | 2553 | inline const bool __is_transparently_comparable_v<_Comparator, _CharT[_Np], basic_string<_CharT, _Traits, _Alloc> > = |
| 2554 | __is_transparently_comparable_v<_Comparator, basic_string<_CharT, _Traits, _Alloc>, const _CharT*>; | ||
| 2626 | 2555 | ||
| 2627 | # if _LIBCPP_STD_VER >= 17 | 2556 | # if _LIBCPP_STD_VER >= 17 |
| 2628 | template <class _InputIterator, | 2557 | template <class _InputIterator, |
| ... | @@ -2728,19 +2657,18 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__ | ... | @@ -2728,19 +2657,18 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__ |
| 2728 | size_type __n_del, | 2657 | size_type __n_del, |
| 2729 | size_type __n_add, | 2658 | size_type __n_add, |
| 2730 | const value_type* __p_new_stuff) { | 2659 | const value_type* __p_new_stuff) { |
| 2731 | __long __buffer = __allocate_long_buffer(__alloc_, __get_amortized_growth_capacity(__old_cap + __delta_cap)); | 2660 | __long __buffer = __allocate_long_buffer(__alloc_, 0, __get_amortized_growth_capacity(__old_cap + __delta_cap)); |
| 2732 | pointer __old_p = __get_pointer(); | 2661 | value_type* __old_p = __data(); |
| 2733 | __annotate_delete(); | 2662 | __annotate_delete(); |
| 2734 | auto __guard = std::__make_scope_guard(__annotate_new_size(*this)); | 2663 | auto __guard = std::__make_scope_guard(__annotate_new_size(*this)); |
| 2735 | if (__n_copy != 0) | 2664 | if (__n_copy != 0) |
| 2736 | traits_type::copy(std::__to_address(__buffer.__data_), std::__to_address(__old_p), __n_copy); | 2665 | traits_type::copy(std::__to_address(__buffer.__data_), __old_p, __n_copy); |
| 2737 | if (__n_add != 0) | 2666 | if (__n_add != 0) |
| 2738 | traits_type::copy(std::__to_address(__buffer.__data_) + __n_copy, __p_new_stuff, __n_add); | 2667 | traits_type::copy(std::__to_address(__buffer.__data_) + __n_copy, __p_new_stuff, __n_add); |
| 2739 | size_type __sec_cp_sz = __old_sz - __n_del - __n_copy; | 2668 | size_type __sec_cp_sz = __old_sz - __n_del - __n_copy; |
| 2740 | if (__sec_cp_sz != 0) | 2669 | if (__sec_cp_sz != 0) |
| 2741 | traits_type::copy(std::__to_address(__buffer.__data_) + __n_copy + __n_add, | 2670 | traits_type::copy( |
| 2742 | std::__to_address(__old_p) + __n_copy + __n_del, | 2671 | std::__to_address(__buffer.__data_) + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz); |
| 2743 | __sec_cp_sz); | ||
| 2744 | __buffer.__size_ = __n_copy + __n_add + __sec_cp_sz; | 2672 | __buffer.__size_ = __n_copy + __n_add + __sec_cp_sz; |
| 2745 | traits_type::assign(__buffer.__data_[__buffer.__size_], value_type()); | 2673 | traits_type::assign(__buffer.__data_[__buffer.__size_], value_type()); |
| 2746 | __reset_internal_buffer(__buffer); | 2674 | __reset_internal_buffer(__buffer); |
| ... | @@ -2761,16 +2689,14 @@ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Trait | ... | @@ -2761,16 +2689,14 @@ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Trait |
| 2761 | size_type __n_copy, | 2689 | size_type __n_copy, |
| 2762 | size_type __n_del, | 2690 | size_type __n_del, |
| 2763 | size_type __n_add) { | 2691 | size_type __n_add) { |
| 2764 | __long __buffer = __allocate_long_buffer(__alloc_, __get_amortized_growth_capacity(__old_cap + __delta_cap)); | 2692 | __long __buffer = __allocate_long_buffer(__alloc_, 0, __get_amortized_growth_capacity(__old_cap + __delta_cap)); |
| 2765 | pointer __old_p = __get_pointer(); | 2693 | value_type* __old_p = __data(); |
| 2766 | if (__n_copy != 0) | 2694 | if (__n_copy != 0) |
| 2767 | traits_type::copy(std::__to_address(__buffer.__data_), std::__to_address(__old_p), __n_copy); | 2695 | traits_type::copy(std::__to_address(__buffer.__data_), __old_p, __n_copy); |
| 2768 | size_type __sec_cp_sz = __old_sz - __n_del - __n_copy; | 2696 | size_type __sec_cp_sz = __old_sz - __n_del - __n_copy; |
| 2769 | if (__sec_cp_sz != 0) | 2697 | if (__sec_cp_sz != 0) |
| 2770 | traits_type::copy(std::__to_address(__buffer.__data_) + __n_copy + __n_add, | 2698 | traits_type::copy( |
| 2771 | std::__to_address(__old_p) + __n_copy + __n_del, | 2699 | std::__to_address(__buffer.__data_) + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz); |
| 2772 | __sec_cp_sz); | ||
| 2773 | |||
| 2774 | // This is -1 to make sure the caller sets the size properly, since old versions of this function didn't set the size | 2700 | // This is -1 to make sure the caller sets the size properly, since old versions of this function didn't set the size |
| 2775 | // at all. | 2701 | // at all. |
| 2776 | __buffer.__size_ = -1; | 2702 | __buffer.__size_ = -1; |
| ... | @@ -2831,7 +2757,7 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_external(const value_type* _ | ... | @@ -2831,7 +2757,7 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_external(const value_type* _ |
| 2831 | if (__cap >= __n) { | 2757 | if (__cap >= __n) { |
| 2832 | if (__n > __size) | 2758 | if (__n > __size) |
| 2833 | __annotate_increase(__n - __size); | 2759 | __annotate_increase(__n - __size); |
| 2834 | value_type* __p = std::__to_address(__get_pointer()); | 2760 | value_type* __p = __data(); |
| 2835 | traits_type::move(__p, __s, __n); | 2761 | traits_type::move(__p, __s, __n); |
| 2836 | return __null_terminate_at(__p, __n); | 2762 | return __null_terminate_at(__p, __n); |
| 2837 | } else { | 2763 | } else { |
| ... | @@ -2847,6 +2773,13 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_ty | ... | @@ -2847,6 +2773,13 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_ty |
| 2847 | return (__builtin_constant_p(__n) && __fits_in_sso(__n)) ? __assign_short(__s, __n) : __assign_external(__s, __n); | 2773 | return (__builtin_constant_p(__n) && __fits_in_sso(__n)) ? __assign_short(__s, __n) : __assign_external(__s, __n); |
| 2848 | } | 2774 | } |
| 2849 | 2775 | ||
| 2776 | template <class _CharT, class _Traits, class _Allocator> | ||
| 2777 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& | ||
| 2778 | basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __pos, size_type __n) { | ||
| 2779 | _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::assign received nullptr"); | ||
| 2780 | return assign(__self_view(__s).substr(__pos, __n)); | ||
| 2781 | } | ||
| 2782 | |||
| 2850 | template <class _CharT, class _Traits, class _Allocator> | 2783 | template <class _CharT, class _Traits, class _Allocator> |
| 2851 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& | 2784 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& |
| 2852 | basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) { | 2785 | basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) { |
| ... | @@ -2857,7 +2790,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) | ... | @@ -2857,7 +2790,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) |
| 2857 | __annotate_increase(__n); | 2790 | __annotate_increase(__n); |
| 2858 | } else if (__n > __old_size) | 2791 | } else if (__n > __old_size) |
| 2859 | __annotate_increase(__n - __old_size); | 2792 | __annotate_increase(__n - __old_size); |
| 2860 | value_type* __p = std::__to_address(__get_pointer()); | 2793 | value_type* __p = __data(); |
| 2861 | traits_type::assign(__p, __n, __c); | 2794 | traits_type::assign(__p, __n, __c); |
| 2862 | return __null_terminate_at(__p, __n); | 2795 | return __null_terminate_at(__p, __n); |
| 2863 | } | 2796 | } |
| ... | @@ -2884,7 +2817,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c) { | ... | @@ -2884,7 +2817,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c) { |
| 2884 | } | 2817 | } |
| 2885 | 2818 | ||
| 2886 | template <class _CharT, class _Traits, class _Allocator> | 2819 | template <class _CharT, class _Traits, class _Allocator> |
| 2887 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string<_CharT, _Traits, _Allocator>& | 2820 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& |
| 2888 | basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) { | 2821 | basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) { |
| 2889 | if (this == std::addressof(__str)) | 2822 | if (this == std::addressof(__str)) |
| 2890 | return *this; | 2823 | return *this; |
| ... | @@ -2916,7 +2849,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat | ... | @@ -2916,7 +2849,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat |
| 2916 | } | 2849 | } |
| 2917 | 2850 | ||
| 2918 | template <class _CharT, class _Traits, class _Allocator> | 2851 | template <class _CharT, class _Traits, class _Allocator> |
| 2919 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void | 2852 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void |
| 2920 | basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type) | 2853 | basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type) |
| 2921 | # if _LIBCPP_STD_VER >= 17 | 2854 | # if _LIBCPP_STD_VER >= 17 |
| 2922 | noexcept | 2855 | noexcept |
| ... | @@ -3042,7 +2975,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty | ... | @@ -3042,7 +2975,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty |
| 3042 | return *this; | 2975 | return *this; |
| 3043 | 2976 | ||
| 3044 | __annotate_increase(__n); | 2977 | __annotate_increase(__n); |
| 3045 | value_type* __p = std::__to_address(__get_pointer()); | 2978 | value_type* __p = __data(); |
| 3046 | traits_type::copy(__p + __sz, __s, __n); | 2979 | traits_type::copy(__p + __sz, __s, __n); |
| 3047 | __sz += __n; | 2980 | __sz += __n; |
| 3048 | __set_size(__sz); | 2981 | __set_size(__sz); |
| ... | @@ -3061,7 +2994,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) | ... | @@ -3061,7 +2994,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) |
| 3061 | if (__cap - __sz < __n) | 2994 | if (__cap - __sz < __n) |
| 3062 | __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0); | 2995 | __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0); |
| 3063 | __annotate_increase(__n); | 2996 | __annotate_increase(__n); |
| 3064 | pointer __p = __get_pointer(); | 2997 | value_type* __p = __data(); |
| 3065 | traits_type::assign(std::__to_address(__p) + __sz, __n, __c); | 2998 | traits_type::assign(std::__to_address(__p) + __sz, __n, __c); |
| 3066 | __sz += __n; | 2999 | __sz += __n; |
| 3067 | __set_size(__sz); | 3000 | __set_size(__sz); |
| ... | @@ -3114,6 +3047,13 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) { | ... | @@ -3114,6 +3047,13 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) { |
| 3114 | return append(__s, traits_type::length(__s)); | 3047 | return append(__s, traits_type::length(__s)); |
| 3115 | } | 3048 | } |
| 3116 | 3049 | ||
| 3050 | template <class _CharT, class _Traits, class _Allocator> | ||
| 3051 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& | ||
| 3052 | basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __pos, size_type __n) { | ||
| 3053 | _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::append received nullptr"); | ||
| 3054 | return append(__self_view(__s).substr(__pos, __n)); | ||
| 3055 | } | ||
| 3056 | |||
| 3117 | // insert | 3057 | // insert |
| 3118 | 3058 | ||
| 3119 | template <class _CharT, class _Traits, class _Allocator> | 3059 | template <class _CharT, class _Traits, class _Allocator> |
| ... | @@ -3134,7 +3074,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t | ... | @@ -3134,7 +3074,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t |
| 3134 | return *this; | 3074 | return *this; |
| 3135 | 3075 | ||
| 3136 | __annotate_increase(__n); | 3076 | __annotate_increase(__n); |
| 3137 | value_type* __p = std::__to_address(__get_pointer()); | 3077 | value_type* __p = __data(); |
| 3138 | size_type __n_move = __sz - __pos; | 3078 | size_type __n_move = __sz - __pos; |
| 3139 | if (__n_move != 0) { | 3079 | if (__n_move != 0) { |
| 3140 | if (std::__is_pointer_in_range(__p + __pos, __p + __sz, __s)) | 3080 | if (std::__is_pointer_in_range(__p + __pos, __p + __sz, __s)) |
| ... | @@ -3162,7 +3102,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n | ... | @@ -3162,7 +3102,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n |
| 3162 | value_type* __p; | 3102 | value_type* __p; |
| 3163 | if (__cap - __sz >= __n) { | 3103 | if (__cap - __sz >= __n) { |
| 3164 | __annotate_increase(__n); | 3104 | __annotate_increase(__n); |
| 3165 | __p = std::__to_address(__get_pointer()); | 3105 | __p = __data(); |
| 3166 | size_type __n_move = __sz - __pos; | 3106 | size_type __n_move = __sz - __pos; |
| 3167 | if (__n_move != 0) | 3107 | if (__n_move != 0) |
| 3168 | traits_type::move(__p + __pos + __n, __p + __pos, __n_move); | 3108 | traits_type::move(__p + __pos + __n, __p + __pos, __n_move); |
| ... | @@ -3223,7 +3163,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty | ... | @@ -3223,7 +3163,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty |
| 3223 | __p = std::__to_address(__get_long_pointer()); | 3163 | __p = std::__to_address(__get_long_pointer()); |
| 3224 | } else { | 3164 | } else { |
| 3225 | __annotate_increase(1); | 3165 | __annotate_increase(1); |
| 3226 | __p = std::__to_address(__get_pointer()); | 3166 | __p = __data(); |
| 3227 | size_type __n_move = __sz - __ip; | 3167 | size_type __n_move = __sz - __ip; |
| 3228 | if (__n_move != 0) | 3168 | if (__n_move != 0) |
| 3229 | traits_type::move(__p + __ip + 1, __p + __ip, __n_move); | 3169 | traits_type::move(__p + __ip + 1, __p + __ip, __n_move); |
| ... | @@ -3252,7 +3192,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace( | ... | @@ -3252,7 +3192,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace( |
| 3252 | return *this; | 3192 | return *this; |
| 3253 | } | 3193 | } |
| 3254 | 3194 | ||
| 3255 | value_type* __p = std::__to_address(__get_pointer()); | 3195 | value_type* __p = __data(); |
| 3256 | if (__n1 != __n2) { | 3196 | if (__n1 != __n2) { |
| 3257 | if (__n2 > __n1) | 3197 | if (__n2 > __n1) |
| 3258 | __annotate_increase(__n2 - __n1); | 3198 | __annotate_increase(__n2 - __n1); |
| ... | @@ -3291,7 +3231,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __ | ... | @@ -3291,7 +3231,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __ |
| 3291 | size_type __cap = capacity(); | 3231 | size_type __cap = capacity(); |
| 3292 | value_type* __p; | 3232 | value_type* __p; |
| 3293 | if (__cap - __sz + __n1 >= __n2) { | 3233 | if (__cap - __sz + __n1 >= __n2) { |
| 3294 | __p = std::__to_address(__get_pointer()); | 3234 | __p = __data(); |
| 3295 | if (__n1 != __n2) { | 3235 | if (__n1 != __n2) { |
| 3296 | if (__n2 > __n1) | 3236 | if (__n2 > __n1) |
| 3297 | __annotate_increase(__n2 - __n1); | 3237 | __annotate_increase(__n2 - __n1); |
| ... | @@ -3335,7 +3275,7 @@ basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(size_type | ... | @@ -3335,7 +3275,7 @@ basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(size_type |
| 3335 | return; | 3275 | return; |
| 3336 | 3276 | ||
| 3337 | size_type __sz = size(); | 3277 | size_type __sz = size(); |
| 3338 | value_type* __p = std::__to_address(__get_pointer()); | 3278 | value_type* __p = __data(); |
| 3339 | __n = std::min(__n, __sz - __pos); | 3279 | __n = std::min(__n, __sz - __pos); |
| 3340 | size_type __n_move = __sz - __pos - __n; | 3280 | size_type __n_move = __sz - __pos - __n; |
| 3341 | if (__n_move != 0) | 3281 | if (__n_move != 0) |
| ... | @@ -3419,8 +3359,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::re | ... | @@ -3419,8 +3359,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::re |
| 3419 | return; | 3359 | return; |
| 3420 | 3360 | ||
| 3421 | __annotation_guard __g(*this); | 3361 | __annotation_guard __g(*this); |
| 3422 | __long __buffer = __allocate_long_buffer(__alloc_, __requested_capacity); | 3362 | __long __buffer = __allocate_long_buffer(__alloc_, size(), __requested_capacity); |
| 3423 | __buffer.__size_ = size(); | ||
| 3424 | traits_type::copy(std::__to_address(__buffer.__data_), data(), __buffer.__size_ + 1); | 3363 | traits_type::copy(std::__to_address(__buffer.__data_), data(), __buffer.__size_ + 1); |
| 3425 | __reset_internal_buffer(__buffer); | 3364 | __reset_internal_buffer(__buffer); |
| 3426 | } | 3365 | } |
| ... | @@ -3717,7 +3656,7 @@ __concatenate_strings(const _Allocator& __alloc, | ... | @@ -3717,7 +3656,7 @@ __concatenate_strings(const _Allocator& __alloc, |
| 3717 | _String __r(__uninitialized_size_tag(), | 3656 | _String __r(__uninitialized_size_tag(), |
| 3718 | __str1.size() + __str2.size(), | 3657 | __str1.size() + __str2.size(), |
| 3719 | _String::__alloc_traits::select_on_container_copy_construction(__alloc)); | 3658 | _String::__alloc_traits::select_on_container_copy_construction(__alloc)); |
| 3720 | auto __ptr = std::__to_address(__r.__get_pointer()); | 3659 | auto __ptr = __r.__data(); |
| 3721 | _Traits::copy(__ptr, __str1.data(), __str1.size()); | 3660 | _Traits::copy(__ptr, __str1.data(), __str1.size()); |
| 3722 | _Traits::copy(__ptr + __str1.size(), __str2.data(), __str2.size()); | 3661 | _Traits::copy(__ptr + __str1.size(), __str2.data(), __str2.size()); |
| 3723 | _Traits::assign(__ptr[__str1.size() + __str2.size()], _CharT()); | 3662 | _Traits::assign(__ptr[__str1.size() + __str2.size()], _CharT()); |
| ... | @@ -4019,11 +3958,12 @@ inline constexpr bool __format::__enable_insertable<std::basic_string<wchar_t>> | ... | @@ -4019,11 +3958,12 @@ inline constexpr bool __format::__enable_insertable<std::basic_string<wchar_t>> |
| 4019 | 3958 | ||
| 4020 | # endif | 3959 | # endif |
| 4021 | 3960 | ||
| 3961 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 4022 | _LIBCPP_END_NAMESPACE_STD | 3962 | _LIBCPP_END_NAMESPACE_STD |
| 4023 | 3963 | ||
| 4024 | _LIBCPP_POP_MACROS | 3964 | _LIBCPP_POP_MACROS |
| 4025 | 3965 | ||
| 4026 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 3966 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 4027 | # include <algorithm> | 3967 | # include <algorithm> |
| 4028 | # include <concepts> | 3968 | # include <concepts> |
| 4029 | # include <cstdlib> | 3969 | # include <cstdlib> |
lib/libcxx/include/string.h+2| ... | @@ -64,6 +64,8 @@ size_t strlen(const char* s); | ... | @@ -64,6 +64,8 @@ size_t strlen(const char* s); |
| 64 | # include_next <string.h> | 64 | # include_next <string.h> |
| 65 | # endif | 65 | # endif |
| 66 | 66 | ||
| 67 | # include <stddef.h> | ||
| 68 | |||
| 67 | // MSVCRT, GNU libc and its derivates may already have the correct prototype in | 69 | // MSVCRT, GNU libc and its derivates may already have the correct prototype in |
| 68 | // <string.h>. This macro can be defined by users if their C library provides | 70 | // <string.h>. This macro can be defined by users if their C library provides |
| 69 | // the right signature. | 71 | // the right signature. |
lib/libcxx/include/string_view+1-1| ... | @@ -971,7 +971,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -971,7 +971,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 971 | 971 | ||
| 972 | _LIBCPP_POP_MACROS | 972 | _LIBCPP_POP_MACROS |
| 973 | 973 | ||
| 974 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 974 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 975 | # include <algorithm> | 975 | # include <algorithm> |
| 976 | # include <concepts> | 976 | # include <concepts> |
| 977 | # include <cstdlib> | 977 | # include <cstdlib> |
lib/libcxx/include/strstream+2| ... | @@ -151,6 +151,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -151,6 +151,7 @@ _LIBCPP_PUSH_MACROS |
| 151 | # include <__undef_macros> | 151 | # include <__undef_macros> |
| 152 | 152 | ||
| 153 | _LIBCPP_BEGIN_NAMESPACE_STD | 153 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 154 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 154 | 155 | ||
| 155 | class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf : public streambuf { | 156 | class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf : public streambuf { |
| 156 | public: | 157 | public: |
| ... | @@ -349,6 +350,7 @@ private: | ... | @@ -349,6 +350,7 @@ private: |
| 349 | strstreambuf __sb_; // exposition only | 350 | strstreambuf __sb_; // exposition only |
| 350 | }; | 351 | }; |
| 351 | 352 | ||
| 353 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 352 | _LIBCPP_END_NAMESPACE_STD | 354 | _LIBCPP_END_NAMESPACE_STD |
| 353 | 355 | ||
| 354 | _LIBCPP_POP_MACROS | 356 | _LIBCPP_POP_MACROS |
lib/libcxx/include/syncstream+6-5| ... | @@ -147,10 +147,10 @@ namespace std { | ... | @@ -147,10 +147,10 @@ namespace std { |
| 147 | _LIBCPP_PUSH_MACROS | 147 | _LIBCPP_PUSH_MACROS |
| 148 | # include <__undef_macros> | 148 | # include <__undef_macros> |
| 149 | 149 | ||
| 150 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 151 | |||
| 152 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM | 150 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM |
| 153 | 151 | ||
| 152 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 153 | |||
| 154 | // [syncstream.syncbuf.overview]/1 | 154 | // [syncstream.syncbuf.overview]/1 |
| 155 | // Class template basic_syncbuf stores character data written to it, | 155 | // Class template basic_syncbuf stores character data written to it, |
| 156 | // known as the associated output, into internal buffers allocated | 156 | // known as the associated output, into internal buffers allocated |
| ... | @@ -196,7 +196,8 @@ public: | ... | @@ -196,7 +196,8 @@ public: |
| 196 | // calling __inc_reference. | 196 | // calling __inc_reference. |
| 197 | // | 197 | // |
| 198 | // pre: __ptr is in __lut_ | 198 | // pre: __ptr is in __lut_ |
| 199 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI lock_guard<mutex> __get_lock([[maybe_unused]] void* __ptr) noexcept { | 199 | _LIBCPP_NO_THREAD_SAFETY_ANALYSIS [[nodiscard]] _LIBCPP_HIDE_FROM_ABI lock_guard<mutex> |
| 200 | __get_lock([[maybe_unused]] void* __ptr) noexcept { | ||
| 200 | shared_lock __lock{__mutex_}; | 201 | shared_lock __lock{__mutex_}; |
| 201 | return lock_guard{__get_it(__ptr)->second.__mutex}; | 202 | return lock_guard{__get_it(__ptr)->second.__mutex}; |
| 202 | } | 203 | } |
| ... | @@ -511,10 +512,10 @@ using std::osyncstream; | ... | @@ -511,10 +512,10 @@ using std::osyncstream; |
| 511 | using std::wosyncstream; | 512 | using std::wosyncstream; |
| 512 | # endif | 513 | # endif |
| 513 | 514 | ||
| 514 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM | ||
| 515 | |||
| 516 | _LIBCPP_END_NAMESPACE_STD | 515 | _LIBCPP_END_NAMESPACE_STD |
| 517 | 516 | ||
| 517 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM | ||
| 518 | |||
| 518 | _LIBCPP_POP_MACROS | 519 | _LIBCPP_POP_MACROS |
| 519 | 520 | ||
| 520 | # endif // _LIBCPP_HAS_LOCALIZATION | 521 | # endif // _LIBCPP_HAS_LOCALIZATION |
lib/libcxx/include/system_error+1-1| ... | @@ -164,7 +164,7 @@ template <> struct hash<std::error_condition>; | ... | @@ -164,7 +164,7 @@ template <> struct hash<std::error_condition>; |
| 164 | # pragma GCC system_header | 164 | # pragma GCC system_header |
| 165 | # endif | 165 | # endif |
| 166 | 166 | ||
| 167 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 167 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 168 | # include <cstdint> | 168 | # include <cstdint> |
| 169 | # include <cstring> | 169 | # include <cstring> |
| 170 | # include <limits> | 170 | # include <limits> |
lib/libcxx/include/text_encoding created+835| ... | @@ -0,0 +1,835 @@ | ||
| 1 | // -*- C++ -*- | ||
| 2 | //===----------------------------------------------------------------------===// | ||
| 3 | // | ||
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 5 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef _LIBCPP_TEXT_ENCODING | ||
| 11 | #define _LIBCPP_TEXT_ENCODING | ||
| 12 | |||
| 13 | /* text_encoding synopsis | ||
| 14 | namespace std { | ||
| 15 | |||
| 16 | struct text_encoding; | ||
| 17 | |||
| 18 | // [text.encoding.hash], hash support | ||
| 19 | template<class T> struct hash; | ||
| 20 | template<> struct hash<text_encoding>; | ||
| 21 | |||
| 22 | struct text_encoding | ||
| 23 | { | ||
| 24 | static constexpr size_t max_name_length = 63; | ||
| 25 | |||
| 26 | // [text.encoding.id], enumeration text_encoding::id | ||
| 27 | enum class id : int_least32_t { | ||
| 28 | see below | ||
| 29 | }; | ||
| 30 | using enum id; | ||
| 31 | |||
| 32 | constexpr text_encoding() = default; | ||
| 33 | constexpr explicit text_encoding(string_view enc) noexcept; | ||
| 34 | constexpr text_encoding(id i) noexcept; | ||
| 35 | |||
| 36 | constexpr id mib() const noexcept; | ||
| 37 | constexpr const char* name() const noexcept; | ||
| 38 | |||
| 39 | // [text.encoding.aliases], class text_encoding::aliases_view | ||
| 40 | // struct aliases_view; | ||
| 41 | constexpr aliases_view aliases() const noexcept; | ||
| 42 | |||
| 43 | friend constexpr bool operator==(const text_encoding& a, | ||
| 44 | const text_encoding& b) noexcept; | ||
| 45 | friend constexpr bool operator==(const text_encoding& encoding, id i) noexcept; | ||
| 46 | |||
| 47 | static consteval text_encoding literal() noexcept; | ||
| 48 | static text_encoding environment(); | ||
| 49 | template<id i> static bool environment_is(); | ||
| 50 | |||
| 51 | private: | ||
| 52 | id mib_ = id::unknown; // exposition only | ||
| 53 | char name_[max_name_length + 1] = {0}; // exposition only | ||
| 54 | static constexpr bool comp-name(string_view a, string_view b); // exposition only | ||
| 55 | }; | ||
| 56 | } | ||
| 57 | |||
| 58 | */ | ||
| 59 | |||
| 60 | #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | ||
| 61 | # include <__cxx03/__config> | ||
| 62 | #else | ||
| 63 | # include <__config> | ||
| 64 | |||
| 65 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| 66 | # pragma GCC system_header | ||
| 67 | # endif | ||
| 68 | |||
| 69 | # if _LIBCPP_STD_VER >= 26 | ||
| 70 | |||
| 71 | # include <__algorithm/count.h> | ||
| 72 | # include <__algorithm/find_if.h> | ||
| 73 | # include <__algorithm/lower_bound.h> | ||
| 74 | # include <__cstddef/ptrdiff_t.h> | ||
| 75 | # include <__functional/hash.h> | ||
| 76 | # include <__iterator/iterator_traits.h> | ||
| 77 | # include <__ranges/enable_borrowed_range.h> | ||
| 78 | # include <__ranges/view_interface.h> | ||
| 79 | # include <climits> | ||
| 80 | # include <cstdint> | ||
| 81 | # include <string_view> | ||
| 82 | # include <version> | ||
| 83 | |||
| 84 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 85 | struct text_encoding; | ||
| 86 | |||
| 87 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 88 | |||
| 89 | _LIBCPP_AVAILABILITY_TEXT_ENCODING_ENVIRONMENT _LIBCPP_EXPORTED_FROM_ABI text_encoding | ||
| 90 | __get_locale_encoding(const char* __name); | ||
| 91 | |||
| 92 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 93 | |||
| 94 | struct text_encoding { | ||
| 95 | static_assert(CHAR_BIT == 8, "libc++ only supports platforms where CHAR_BIT == 8"); | ||
| 96 | enum class id : int_least32_t { | ||
| 97 | other = 1, | ||
| 98 | unknown = 2, | ||
| 99 | ASCII = 3, | ||
| 100 | ISOLatin1 = 4, | ||
| 101 | ISOLatin2 = 5, | ||
| 102 | ISOLatin3 = 6, | ||
| 103 | ISOLatin4 = 7, | ||
| 104 | ISOLatinCyrillic = 8, | ||
| 105 | ISOLatinArabic = 9, | ||
| 106 | ISOLatinGreek = 10, | ||
| 107 | ISOLatinHebrew = 11, | ||
| 108 | ISOLatin5 = 12, | ||
| 109 | ISOLatin6 = 13, | ||
| 110 | ISOTextComm = 14, | ||
| 111 | HalfWidthKatakana = 15, | ||
| 112 | JISEncoding = 16, | ||
| 113 | ShiftJIS = 17, | ||
| 114 | EUCPkdFmtJapanese = 18, | ||
| 115 | EUCFixWidJapanese = 19, | ||
| 116 | ISO4UnitedKingdom = 20, | ||
| 117 | ISO11SwedishForNames = 21, | ||
| 118 | ISO15Italian = 22, | ||
| 119 | ISO17Spanish = 23, | ||
| 120 | ISO21German = 24, | ||
| 121 | ISO60DanishNorwegian = 25, | ||
| 122 | ISO69French = 26, | ||
| 123 | ISO10646UTF1 = 27, | ||
| 124 | ISO646basic1983 = 28, | ||
| 125 | INVARIANT = 29, | ||
| 126 | ISO2IntlRefVersion = 30, | ||
| 127 | NATSSEFI = 31, | ||
| 128 | NATSSEFIADD = 32, // NATS-DANO (33) and NATS-DANO-ADD (34) are omitted by the standard. | ||
| 129 | ISO10Swedish = 35, | ||
| 130 | KSC56011987 = 36, | ||
| 131 | ISO2022KR = 37, | ||
| 132 | EUCKR = 38, | ||
| 133 | ISO2022JP = 39, | ||
| 134 | ISO2022JP2 = 40, | ||
| 135 | ISO13JISC6220jp = 41, | ||
| 136 | ISO14JISC6220ro = 42, | ||
| 137 | ISO16Portuguese = 43, | ||
| 138 | ISO18Greek7Old = 44, | ||
| 139 | ISO19LatinGreek = 45, | ||
| 140 | ISO25French = 46, | ||
| 141 | ISO27LatinGreek1 = 47, | ||
| 142 | ISO5427Cyrillic = 48, | ||
| 143 | ISO42JISC62261978 = 49, | ||
| 144 | ISO47BSViewdata = 50, | ||
| 145 | ISO49INIS = 51, | ||
| 146 | ISO50INIS8 = 52, | ||
| 147 | ISO51INISCyrillic = 53, | ||
| 148 | ISO54271981 = 54, | ||
| 149 | ISO5428Greek = 55, | ||
| 150 | ISO57GB1988 = 56, | ||
| 151 | ISO58GB231280 = 57, | ||
| 152 | ISO61Norwegian2 = 58, | ||
| 153 | ISO70VideotexSupp1 = 59, | ||
| 154 | ISO84Portuguese2 = 60, | ||
| 155 | ISO85Spanish2 = 61, | ||
| 156 | ISO86Hungarian = 62, | ||
| 157 | ISO87JISX0208 = 63, | ||
| 158 | ISO88Greek7 = 64, | ||
| 159 | ISO89ASMO449 = 65, | ||
| 160 | ISO90 = 66, | ||
| 161 | ISO91JISC62291984a = 67, | ||
| 162 | ISO92JISC62991984b = 68, | ||
| 163 | ISO93JIS62291984badd = 69, | ||
| 164 | ISO94JIS62291984hand = 70, | ||
| 165 | ISO95JIS62291984handadd = 71, | ||
| 166 | ISO96JISC62291984kana = 72, | ||
| 167 | ISO2033 = 73, | ||
| 168 | ISO99NAPLPS = 74, | ||
| 169 | ISO102T617bit = 75, | ||
| 170 | ISO103T618bit = 76, | ||
| 171 | ISO111ECMACyrillic = 77, | ||
| 172 | ISO121Canadian1 = 78, | ||
| 173 | ISO122Canadian2 = 79, | ||
| 174 | ISO123CSAZ24341985gr = 80, | ||
| 175 | ISO88596E = 81, | ||
| 176 | ISO88596I = 82, | ||
| 177 | ISO128T101G2 = 83, | ||
| 178 | ISO88598E = 84, | ||
| 179 | ISO88598I = 85, | ||
| 180 | ISO139CSN369103 = 86, | ||
| 181 | ISO141JUSIB1002 = 87, | ||
| 182 | ISO143IECP271 = 88, | ||
| 183 | ISO146Serbian = 89, | ||
| 184 | ISO147Macedonian = 90, | ||
| 185 | ISO150 = 91, | ||
| 186 | ISO151Cuba = 92, | ||
| 187 | ISO6937Add = 93, | ||
| 188 | ISO153GOST1976874 = 94, | ||
| 189 | ISO8859Supp = 95, | ||
| 190 | ISO10367Box = 96, | ||
| 191 | ISO158Lap = 97, | ||
| 192 | ISO159JISX02121990 = 98, | ||
| 193 | ISO646Danish = 99, | ||
| 194 | USDK = 100, | ||
| 195 | DKUS = 101, | ||
| 196 | KSC5636 = 102, | ||
| 197 | Unicode11UTF7 = 103, | ||
| 198 | ISO2022CN = 104, | ||
| 199 | ISO2022CNEXT = 105, | ||
| 200 | UTF8 = 106, | ||
| 201 | ISO885913 = 109, | ||
| 202 | ISO885914 = 110, | ||
| 203 | ISO885915 = 111, | ||
| 204 | ISO885916 = 112, | ||
| 205 | GBK = 113, | ||
| 206 | GB18030 = 114, | ||
| 207 | OSDEBCDICDF0415 = 115, | ||
| 208 | OSDEBCDICDF03IRV = 116, | ||
| 209 | OSDEBCDICDF041 = 117, | ||
| 210 | ISO115481 = 118, | ||
| 211 | KZ1048 = 119, | ||
| 212 | UCS2 = 1000, | ||
| 213 | UCS4 = 1001, | ||
| 214 | UnicodeASCII = 1002, | ||
| 215 | UnicodeLatin1 = 1003, | ||
| 216 | UnicodeJapanese = 1004, | ||
| 217 | UnicodeIBM1261 = 1005, | ||
| 218 | UnicodeIBM1268 = 1006, | ||
| 219 | UnicodeIBM1276 = 1007, | ||
| 220 | UnicodeIBM1264 = 1008, | ||
| 221 | UnicodeIBM1265 = 1009, | ||
| 222 | Unicode11 = 1010, | ||
| 223 | SCSU = 1011, | ||
| 224 | UTF7 = 1012, | ||
| 225 | UTF16BE = 1013, | ||
| 226 | UTF16LE = 1014, | ||
| 227 | UTF16 = 1015, | ||
| 228 | CESU8 = 1016, | ||
| 229 | UTF32 = 1017, | ||
| 230 | UTF32BE = 1018, | ||
| 231 | UTF32LE = 1019, | ||
| 232 | BOCU1 = 1020, | ||
| 233 | UTF7IMAP = 1021, | ||
| 234 | Windows30Latin1 = 2000, | ||
| 235 | Windows31Latin1 = 2001, | ||
| 236 | Windows31Latin2 = 2002, | ||
| 237 | Windows31Latin5 = 2003, | ||
| 238 | HPRoman8 = 2004, | ||
| 239 | AdobeStandardEncoding = 2005, | ||
| 240 | VenturaUS = 2006, | ||
| 241 | VenturaInternational = 2007, | ||
| 242 | DECMCS = 2008, | ||
| 243 | PC850Multilingual = 2009, | ||
| 244 | PC8DanishNorwegian = 2012, | ||
| 245 | PC862LatinHebrew = 2013, | ||
| 246 | PC8Turkish = 2014, | ||
| 247 | IBMSymbols = 2015, | ||
| 248 | IBMThai = 2016, | ||
| 249 | HPLegal = 2017, | ||
| 250 | HPPiFont = 2018, | ||
| 251 | HPMath8 = 2019, | ||
| 252 | HPPSMath = 2020, | ||
| 253 | HPDesktop = 2021, | ||
| 254 | VenturaMath = 2022, | ||
| 255 | MicrosoftPublishing = 2023, | ||
| 256 | Windows31J = 2024, | ||
| 257 | GB2312 = 2025, | ||
| 258 | Big5 = 2026, | ||
| 259 | Macintosh = 2027, | ||
| 260 | IBM037 = 2028, | ||
| 261 | IBM038 = 2029, | ||
| 262 | IBM273 = 2030, | ||
| 263 | IBM274 = 2031, | ||
| 264 | IBM275 = 2032, | ||
| 265 | IBM277 = 2033, | ||
| 266 | IBM278 = 2034, | ||
| 267 | IBM280 = 2035, | ||
| 268 | IBM281 = 2036, | ||
| 269 | IBM284 = 2037, | ||
| 270 | IBM285 = 2038, | ||
| 271 | IBM290 = 2039, | ||
| 272 | IBM297 = 2040, | ||
| 273 | IBM420 = 2041, | ||
| 274 | IBM423 = 2042, | ||
| 275 | IBM424 = 2043, | ||
| 276 | PC8CodePage437 = 2011, | ||
| 277 | IBM500 = 2044, | ||
| 278 | IBM851 = 2045, | ||
| 279 | PCp852 = 2010, | ||
| 280 | IBM855 = 2046, | ||
| 281 | IBM857 = 2047, | ||
| 282 | IBM860 = 2048, | ||
| 283 | IBM861 = 2049, | ||
| 284 | IBM863 = 2050, | ||
| 285 | IBM864 = 2051, | ||
| 286 | IBM865 = 2052, | ||
| 287 | IBM868 = 2053, | ||
| 288 | IBM869 = 2054, | ||
| 289 | IBM870 = 2055, | ||
| 290 | IBM871 = 2056, | ||
| 291 | IBM880 = 2057, | ||
| 292 | IBM891 = 2058, | ||
| 293 | IBM903 = 2059, | ||
| 294 | IBM904 = 2060, | ||
| 295 | IBM905 = 2061, | ||
| 296 | IBM918 = 2062, | ||
| 297 | IBM1026 = 2063, | ||
| 298 | IBMEBCDICATDE = 2064, | ||
| 299 | EBCDICATDEA = 2065, | ||
| 300 | EBCDICCAFR = 2066, | ||
| 301 | EBCDICDKNO = 2067, | ||
| 302 | EBCDICDKNOA = 2068, | ||
| 303 | EBCDICFISE = 2069, | ||
| 304 | EBCDICFISEA = 2070, | ||
| 305 | EBCDICFR = 2071, | ||
| 306 | EBCDICIT = 2072, | ||
| 307 | EBCDICPT = 2073, | ||
| 308 | EBCDICES = 2074, | ||
| 309 | EBCDICESA = 2075, | ||
| 310 | EBCDICESS = 2076, | ||
| 311 | EBCDICUK = 2077, | ||
| 312 | EBCDICUS = 2078, | ||
| 313 | Unknown8BiT = 2079, | ||
| 314 | Mnemonic = 2080, | ||
| 315 | Mnem = 2081, | ||
| 316 | VISCII = 2082, | ||
| 317 | VIQR = 2083, | ||
| 318 | KOI8R = 2084, | ||
| 319 | HZGB2312 = 2085, | ||
| 320 | IBM866 = 2086, | ||
| 321 | PC775Baltic = 2087, | ||
| 322 | KOI8U = 2088, | ||
| 323 | IBM00858 = 2089, | ||
| 324 | IBM00924 = 2090, | ||
| 325 | IBM01140 = 2091, | ||
| 326 | IBM01141 = 2092, | ||
| 327 | IBM01142 = 2093, | ||
| 328 | IBM01143 = 2094, | ||
| 329 | IBM01144 = 2095, | ||
| 330 | IBM01145 = 2096, | ||
| 331 | IBM01146 = 2097, | ||
| 332 | IBM01147 = 2098, | ||
| 333 | IBM01148 = 2099, | ||
| 334 | IBM01149 = 2100, | ||
| 335 | Big5HKSCS = 2101, | ||
| 336 | IBM1047 = 2102, | ||
| 337 | PTCP154 = 2103, | ||
| 338 | Amiga1251 = 2104, | ||
| 339 | KOI7switched = 2105, | ||
| 340 | BRF = 2106, | ||
| 341 | TSCII = 2107, | ||
| 342 | CP51932 = 2108, | ||
| 343 | windows874 = 2109, | ||
| 344 | windows1250 = 2250, | ||
| 345 | windows1251 = 2251, | ||
| 346 | windows1252 = 2252, | ||
| 347 | windows1253 = 2253, | ||
| 348 | windows1254 = 2254, | ||
| 349 | windows1255 = 2255, | ||
| 350 | windows1256 = 2256, | ||
| 351 | windows1257 = 2257, | ||
| 352 | windows1258 = 2258, | ||
| 353 | TIS620 = 2259, | ||
| 354 | CP50220 = 2260 | ||
| 355 | }; | ||
| 356 | |||
| 357 | private: | ||
| 358 | static constexpr int __nats_dano_ = 33; | ||
| 359 | static constexpr int __nats_dano_add_ = 34; | ||
| 360 | |||
| 361 | // A __te_data structure stores: | ||
| 362 | // Index into a table of offsets in the giant aliases string | ||
| 363 | // The MIB of that text encoding | ||
| 364 | // Number of aliases the current MIB holds | ||
| 365 | // We only need 6 bytes of information to store this information. | ||
| 366 | |||
| 367 | // The data is structured in three different locations: | ||
| 368 | // The mib table (array of __te_data) | ||
| 369 | // Aliases string | ||
| 370 | // Table of offsets into the aliases string | ||
| 371 | |||
| 372 | // All of the alias strings were transformed from an array of char* into one giant string split by '\0'. | ||
| 373 | // This allows us to reduce runtime memory footprint by not only removing the need to store ~884 pointers, it also | ||
| 374 | // significantly reduces the disk space taken by removing the need for relocation data for those pointers. | ||
| 375 | // We also know ahead of time that the total number of characters of all of these aliases combined can fit into 2 | ||
| 376 | // bytes, so we can also save even more memory by using 2 byte offsets rather than a full pointer into the aliases | ||
| 377 | // string. | ||
| 378 | |||
| 379 | struct __te_data { | ||
| 380 | unsigned short __first_alias_index_; | ||
| 381 | unsigned short __mib_rep_; | ||
| 382 | unsigned char __num_aliases_; | ||
| 383 | |||
| 384 | friend constexpr bool operator<(const __te_data& __enc, id __i) noexcept { | ||
| 385 | return __enc.__mib_rep_ < static_cast<unsigned short>(__i); | ||
| 386 | } | ||
| 387 | }; | ||
| 388 | |||
| 389 | static constexpr bool __comp_name(string_view __a, string_view __b) noexcept { | ||
| 390 | if (__a.empty() || __b.empty()) { | ||
| 391 | return false; | ||
| 392 | } | ||
| 393 | |||
| 394 | // Map any non-alphanumeric character to 255, skip prefix 0s, else get tolower(__n). | ||
| 395 | auto __map_char = [](char __n, bool& __in_number) -> unsigned char { | ||
| 396 | if (__n == '0') { | ||
| 397 | return __in_number ? '0' : 255; | ||
| 398 | } | ||
| 399 | __in_number = __n >= '1' && __n <= '9'; | ||
| 400 | |||
| 401 | if ((__n >= '1' && __n <= '9') || (__n >= 'a' && __n <= 'z')) { | ||
| 402 | return __n; | ||
| 403 | } | ||
| 404 | if (__n >= 'A' && __n <= 'Z') { | ||
| 405 | return __n + ('a' - 'A'); // tolower | ||
| 406 | } | ||
| 407 | |||
| 408 | return 255; | ||
| 409 | }; | ||
| 410 | |||
| 411 | auto __a_ptr = __a.begin(), __b_ptr = __b.begin(); | ||
| 412 | bool __a_in_number = false, __b_in_number = false; | ||
| 413 | |||
| 414 | unsigned char __a_val = 255, __b_val = 255; | ||
| 415 | for (;; __a_ptr++, __b_ptr++) { | ||
| 416 | while (__a_ptr != __a.end() && (__a_val = __map_char(*__a_ptr, __a_in_number)) == 255) | ||
| 417 | __a_ptr++; | ||
| 418 | while (__b_ptr != __b.end() && (__b_val = __map_char(*__b_ptr, __b_in_number)) == 255) | ||
| 419 | __b_ptr++; | ||
| 420 | |||
| 421 | if (__a_ptr == __a.end()) | ||
| 422 | return __b_ptr == __b.end(); | ||
| 423 | if (__b_ptr == __b.end()) | ||
| 424 | return false; | ||
| 425 | if (__a_val != __b_val) | ||
| 426 | return false; | ||
| 427 | } | ||
| 428 | return true; | ||
| 429 | } | ||
| 430 | |||
| 431 | static constexpr unsigned short __find_data_idx(string_view __a) noexcept { | ||
| 432 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__a.size() <= max_name_length, "input string_view must have size <= 63"); | ||
| 433 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__a.contains('\0'), "input string_view must not contain '\\0'"); | ||
| 434 | |||
| 435 | auto __pred = [&__a](const __te_data& __entry) -> bool { | ||
| 436 | // Search aliases of text encoding for string | ||
| 437 | aliases_view __aliases(__entry); | ||
| 438 | return std::find_if(__aliases.begin(), __aliases.end(), [&__a](auto __alias) { | ||
| 439 | return __comp_name(__a, __alias); | ||
| 440 | }) != __aliases.end(); | ||
| 441 | }; | ||
| 442 | |||
| 443 | const __te_data* __found = std::find_if(__entries + 2, std::end(__entries), __pred); | ||
| 444 | if (__found == std::end(__entries)) { | ||
| 445 | return __other_idx_; // other | ||
| 446 | } | ||
| 447 | |||
| 448 | return __found - __entries; | ||
| 449 | } | ||
| 450 | |||
| 451 | static constexpr unsigned short __find_data_idx_by_id(id __i) noexcept { | ||
| 452 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__i >= id::other, "invalid text_encoding::id passed"); | ||
| 453 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__i <= id::CP50220, "invalid text_encoding::id passed"); | ||
| 454 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(int_least32_t(__i) != __nats_dano_, "Mib for NATS-DANO used"); | ||
| 455 | _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(int_least32_t(__i) != __nats_dano_add_, "Mib for NATS-DANO-ADD used"); | ||
| 456 | auto __found = std::lower_bound(std::begin(__entries), std::end(__entries), __i); | ||
| 457 | |||
| 458 | if (__found == std::end(__entries)) { | ||
| 459 | return __unknown_idx_; // unknown | ||
| 460 | } | ||
| 461 | |||
| 462 | return __found - __entries; | ||
| 463 | } | ||
| 464 | |||
| 465 | public: | ||
| 466 | using enum id; | ||
| 467 | static constexpr size_t max_name_length = 63; | ||
| 468 | |||
| 469 | // [text.encoding.aliases], class text_encoding::aliases_view | ||
| 470 | struct aliases_view : ranges::view_interface<aliases_view> { | ||
| 471 | struct __iterator { | ||
| 472 | using iterator_concept = random_access_iterator_tag; | ||
| 473 | using iterator_category = random_access_iterator_tag; | ||
| 474 | using value_type = const char*; | ||
| 475 | using reference = const char*; | ||
| 476 | using difference_type = int; | ||
| 477 | |||
| 478 | constexpr __iterator() noexcept = default; | ||
| 479 | |||
| 480 | [[nodiscard]] constexpr reference operator*() const noexcept { | ||
| 481 | return __get_alias_from_offset_table(__current_idx_); | ||
| 482 | } | ||
| 483 | |||
| 484 | [[nodiscard]] constexpr reference operator[](difference_type __n) const noexcept { | ||
| 485 | auto __it = *this; | ||
| 486 | return *(__it + __n); | ||
| 487 | } | ||
| 488 | |||
| 489 | [[nodiscard]] friend constexpr __iterator operator+(__iterator __it, difference_type __n) noexcept { | ||
| 490 | __it += __n; | ||
| 491 | return __it; | ||
| 492 | } | ||
| 493 | |||
| 494 | [[nodiscard]] friend constexpr __iterator operator+(difference_type __n, __iterator __it) noexcept { | ||
| 495 | __it += __n; | ||
| 496 | return __it; | ||
| 497 | } | ||
| 498 | |||
| 499 | [[nodiscard]] friend constexpr __iterator operator-(__iterator __it, difference_type __n) noexcept { | ||
| 500 | __it -= __n; | ||
| 501 | return __it; | ||
| 502 | } | ||
| 503 | |||
| 504 | [[nodiscard]] constexpr difference_type operator-(const __iterator& __other) const noexcept { | ||
| 505 | return __current_idx_ - __other.__current_idx_; | ||
| 506 | } | ||
| 507 | |||
| 508 | constexpr __iterator& operator++() noexcept { | ||
| 509 | __current_idx_++; | ||
| 510 | return *this; | ||
| 511 | } | ||
| 512 | |||
| 513 | constexpr __iterator operator++(int) noexcept { | ||
| 514 | auto __old = *this; | ||
| 515 | __current_idx_++; | ||
| 516 | return __old; | ||
| 517 | } | ||
| 518 | |||
| 519 | constexpr __iterator& operator--() noexcept { | ||
| 520 | __current_idx_--; | ||
| 521 | return *this; | ||
| 522 | } | ||
| 523 | |||
| 524 | constexpr __iterator operator--(int) noexcept { | ||
| 525 | auto __old = *this; | ||
| 526 | __current_idx_--; | ||
| 527 | return __old; | ||
| 528 | } | ||
| 529 | |||
| 530 | constexpr __iterator& operator+=(difference_type __n) noexcept { | ||
| 531 | __current_idx_ += __n; | ||
| 532 | return *this; | ||
| 533 | } | ||
| 534 | |||
| 535 | constexpr __iterator& operator-=(difference_type __n) noexcept { return (*this += -__n); } | ||
| 536 | |||
| 537 | friend constexpr auto operator<=>(const __iterator& __it, const __iterator& __it2) noexcept = default; | ||
| 538 | |||
| 539 | private: | ||
| 540 | friend struct aliases_view; | ||
| 541 | |||
| 542 | constexpr __iterator(unsigned short __enc_d) noexcept : __current_idx_(__enc_d) {} | ||
| 543 | |||
| 544 | unsigned short __current_idx_; | ||
| 545 | }; // __iterator | ||
| 546 | |||
| 547 | [[nodiscard]] constexpr __iterator begin() const noexcept { return __iterator(__first_idx_); } | ||
| 548 | |||
| 549 | [[nodiscard]] constexpr __iterator end() const noexcept { return __iterator(__last_idx_); } | ||
| 550 | |||
| 551 | private: | ||
| 552 | friend struct text_encoding; | ||
| 553 | |||
| 554 | constexpr aliases_view(const __te_data& __d) | ||
| 555 | : __first_idx_(__d.__first_alias_index_), __last_idx_(__d.__first_alias_index_ + __d.__num_aliases_) {} | ||
| 556 | |||
| 557 | unsigned short __first_idx_; | ||
| 558 | unsigned short __last_idx_; | ||
| 559 | }; // aliases_view | ||
| 560 | |||
| 561 | constexpr text_encoding() = default; | ||
| 562 | |||
| 563 | constexpr explicit text_encoding(string_view __enc) noexcept : __encoding_idx_(__find_data_idx(__enc)) { | ||
| 564 | __enc.copy(__name_, max_name_length, 0); | ||
| 565 | } | ||
| 566 | |||
| 567 | constexpr text_encoding(id __i) noexcept : __encoding_idx_(__find_data_idx_by_id(__i)) { | ||
| 568 | const char* __alias = __get_alias_from_offset_table(__get().__first_alias_index_); | ||
| 569 | if (__alias[0] != '\0') { | ||
| 570 | string_view(__alias).copy(__name_, max_name_length); | ||
| 571 | } | ||
| 572 | } | ||
| 573 | |||
| 574 | [[nodiscard]] constexpr id mib() const noexcept { return id(__get().__mib_rep_); } | ||
| 575 | |||
| 576 | [[nodiscard]] constexpr const char* name() const noexcept { return __name_; } | ||
| 577 | |||
| 578 | [[nodiscard]] constexpr aliases_view aliases() const noexcept { return aliases_view(__get()); } | ||
| 579 | |||
| 580 | friend constexpr bool operator==(const text_encoding& __a, const text_encoding& __b) noexcept { | ||
| 581 | return __a.mib() == id::other && __b.mib() == id::other | ||
| 582 | ? __comp_name(__a.__name_, __b.__name_) | ||
| 583 | : __a.mib() == __b.mib(); | ||
| 584 | } | ||
| 585 | |||
| 586 | friend constexpr bool operator==(const text_encoding& __encoding, id __i) noexcept { return __encoding.mib() == __i; } | ||
| 587 | |||
| 588 | [[nodiscard]] static consteval text_encoding literal() noexcept { | ||
| 589 | // TODO: Remove this branch once we have __GNUC_EXECUTION_CHARSET_NAME or __clang_literal_encoding__ unconditionally | ||
| 590 | # ifdef __GNUC_EXECUTION_CHARSET_NAME | ||
| 591 | return text_encoding(__GNUC_EXECUTION_CHARSET_NAME); | ||
| 592 | # elif defined(__clang_literal_encoding__) | ||
| 593 | return text_encoding(__clang_literal_encoding__); | ||
| 594 | # else | ||
| 595 | return text_encoding(); | ||
| 596 | # endif | ||
| 597 | } | ||
| 598 | |||
| 599 | # if _LIBCPP_HAS_LOCALIZATION | ||
| 600 | [[nodiscard]] _LIBCPP_AVAILABILITY_TEXT_ENCODING_ENVIRONMENT static text_encoding environment() { | ||
| 601 | # if defined(_LIBCPP_WIN32API) | ||
| 602 | return __get_locale_encoding(nullptr); | ||
| 603 | # else | ||
| 604 | return __get_locale_encoding(""); | ||
| 605 | # endif | ||
| 606 | } | ||
| 607 | |||
| 608 | template <id _Id> | ||
| 609 | [[nodiscard]] _LIBCPP_AVAILABILITY_TEXT_ENCODING_ENVIRONMENT static bool environment_is() { | ||
| 610 | // TODO: It may be worthwhile to implement an optimization for popular encodings, e.g. UTF-8, | ||
| 611 | // to allow checking the environment text encoding without needing to use the data tables. | ||
| 612 | |||
| 613 | # if defined(__ANDROID__) | ||
| 614 | return _Id == std::text_encoding::id::UTF8; | ||
| 615 | # else | ||
| 616 | return environment() == _Id; | ||
| 617 | # endif | ||
| 618 | } | ||
| 619 | # else | ||
| 620 | static text_encoding environment() = delete; | ||
| 621 | |||
| 622 | template <id> | ||
| 623 | static bool environment_is() = delete; | ||
| 624 | # endif | ||
| 625 | |||
| 626 | private: | ||
| 627 | constexpr const __te_data& __get() const { return __entries[__encoding_idx_]; } | ||
| 628 | |||
| 629 | static constexpr char const* __get_alias_from_offset_table(unsigned short __idx) { | ||
| 630 | return __aliases_string + __alias_offsets.__table[__idx]; | ||
| 631 | } | ||
| 632 | |||
| 633 | static constexpr auto __other_idx_ = 0u; | ||
| 634 | static constexpr auto __unknown_idx_ = 1u; | ||
| 635 | |||
| 636 | char __name_[max_name_length + 1]{}; | ||
| 637 | unsigned short __encoding_idx_{1u}; | ||
| 638 | |||
| 639 | static constexpr __te_data __entries[] = { | ||
| 640 | {0, 1, 0}, {1, 2, 0}, {2, 3, 11}, {13, 4, 9}, {22, 5, 7}, {29, 6, 7}, {36, 7, 7}, | ||
| 641 | {43, 8, 6}, {49, 9, 8}, {57, 10, 9}, {66, 11, 6}, {72, 12, 7}, {79, 13, 6}, {85, 14, 3}, | ||
| 642 | {88, 15, 3}, {91, 16, 2}, {93, 17, 3}, {96, 18, 3}, {99, 19, 2}, {101, 20, 6}, {107, 21, 5}, | ||
| 643 | {112, 22, 4}, {116, 23, 4}, {120, 24, 5}, {125, 25, 6}, {131, 26, 5}, {136, 27, 2}, {138, 28, 3}, | ||
| 644 | {141, 29, 2}, {143, 30, 4}, {147, 31, 3}, {150, 32, 3}, {153, 35, 7}, {160, 36, 6}, {166, 37, 2}, | ||
| 645 | {168, 38, 2}, {170, 39, 2}, {172, 40, 2}, {174, 41, 6}, {180, 42, 5}, {185, 43, 4}, {189, 44, 3}, | ||
| 646 | {192, 45, 3}, {195, 46, 4}, {199, 47, 3}, {202, 48, 3}, {205, 49, 3}, {208, 50, 3}, {211, 51, 3}, | ||
| 647 | {214, 52, 3}, {217, 53, 3}, {220, 54, 4}, {224, 55, 3}, {227, 56, 5}, {232, 57, 4}, {236, 58, 5}, | ||
| 648 | {241, 59, 3}, {244, 60, 4}, {248, 61, 4}, {252, 62, 5}, {257, 63, 5}, {262, 64, 3}, {265, 65, 5}, | ||
| 649 | {270, 66, 2}, {272, 67, 4}, {276, 68, 5}, {281, 69, 4}, {285, 70, 4}, {289, 71, 4}, {293, 72, 3}, | ||
| 650 | {296, 73, 4}, {300, 74, 5}, {305, 75, 3}, {308, 76, 4}, {312, 77, 4}, {316, 78, 7}, {323, 79, 6}, | ||
| 651 | {329, 80, 3}, {332, 81, 3}, {335, 82, 3}, {338, 83, 3}, {341, 84, 3}, {344, 85, 3}, {347, 86, 3}, | ||
| 652 | {350, 87, 6}, {356, 88, 3}, {359, 89, 4}, {363, 90, 4}, {367, 91, 4}, {371, 92, 5}, {376, 93, 3}, | ||
| 653 | {379, 94, 4}, {383, 95, 4}, {387, 96, 3}, {390, 97, 4}, {394, 98, 4}, {398, 99, 5}, {403, 100, 2}, | ||
| 654 | {405, 101, 2}, {407, 102, 3}, {410, 103, 2}, {412, 104, 2}, {414, 105, 2}, {416, 106, 2}, {418, 109, 2}, | ||
| 655 | {420, 110, 8}, {428, 111, 4}, {432, 112, 7}, {439, 113, 5}, {444, 114, 2}, {446, 115, 2}, {448, 116, 2}, | ||
| 656 | {450, 117, 2}, {452, 118, 4}, {456, 119, 4}, {460, 1000, 2}, {462, 1001, 2}, {464, 1002, 2}, {466, 1003, 3}, | ||
| 657 | {469, 1004, 2}, {471, 1005, 2}, {473, 1006, 2}, {475, 1007, 2}, {477, 1008, 2}, {479, 1009, 2}, {481, 1010, 2}, | ||
| 658 | {483, 1011, 2}, {485, 1012, 2}, {487, 1013, 2}, {489, 1014, 2}, {491, 1015, 2}, {493, 1016, 3}, {496, 1017, 2}, | ||
| 659 | {498, 1018, 2}, {500, 1019, 2}, {502, 1020, 3}, {505, 1021, 2}, {507, 2000, 2}, {509, 2001, 2}, {511, 2002, 2}, | ||
| 660 | {513, 2003, 2}, {515, 2004, 4}, {519, 2005, 2}, {521, 2006, 2}, {523, 2007, 2}, {525, 2008, 3}, {528, 2009, 4}, | ||
| 661 | {532, 2010, 4}, {536, 2011, 4}, {540, 2012, 2}, {542, 2013, 4}, {546, 2014, 2}, {548, 2015, 2}, {550, 2016, 2}, | ||
| 662 | {552, 2017, 2}, {554, 2018, 2}, {556, 2019, 2}, {558, 2020, 2}, {560, 2021, 2}, {562, 2022, 2}, {564, 2023, 2}, | ||
| 663 | {566, 2024, 2}, {568, 2025, 2}, {570, 2026, 2}, {572, 2027, 3}, {575, 2028, 7}, {582, 2029, 4}, {586, 2030, 3}, | ||
| 664 | {589, 2031, 4}, {593, 2032, 4}, {597, 2033, 4}, {601, 2034, 5}, {606, 2035, 4}, {610, 2036, 4}, {614, 2037, 4}, | ||
| 665 | {618, 2038, 4}, {622, 2039, 4}, {626, 2040, 4}, {630, 2041, 4}, {634, 2042, 4}, {638, 2043, 4}, {642, 2044, 5}, | ||
| 666 | {647, 2045, 4}, {651, 2046, 4}, {655, 2047, 4}, {659, 2048, 4}, {663, 2049, 5}, {668, 2050, 4}, {672, 2051, 3}, | ||
| 667 | {675, 2052, 4}, {679, 2053, 4}, {683, 2054, 5}, {688, 2055, 5}, {693, 2056, 4}, {697, 2057, 4}, {701, 2058, 3}, | ||
| 668 | {704, 2059, 3}, {707, 2060, 4}, {711, 2061, 4}, {715, 2062, 4}, {719, 2063, 3}, {722, 2064, 2}, {724, 2065, 2}, | ||
| 669 | {726, 2066, 2}, {728, 2067, 2}, {730, 2068, 2}, {732, 2069, 2}, {734, 2070, 2}, {736, 2071, 2}, {738, 2072, 2}, | ||
| 670 | {740, 2073, 2}, {742, 2074, 2}, {744, 2075, 2}, {746, 2076, 2}, {748, 2077, 2}, {750, 2078, 2}, {752, 2079, 2}, | ||
| 671 | {754, 2080, 2}, {756, 2081, 2}, {758, 2082, 2}, {760, 2083, 2}, {762, 2084, 2}, {764, 2085, 1}, {765, 2086, 4}, | ||
| 672 | {769, 2087, 3}, {772, 2088, 2}, {774, 2089, 5}, {779, 2090, 5}, {784, 2091, 5}, {789, 2092, 5}, {794, 2093, 6}, | ||
| 673 | {800, 2094, 6}, {806, 2095, 5}, {811, 2096, 5}, {816, 2097, 5}, {821, 2098, 5}, {826, 2099, 5}, {831, 2100, 5}, | ||
| 674 | {836, 2101, 2}, {838, 2102, 3}, {841, 2103, 5}, {846, 2104, 5}, {851, 2105, 2}, {853, 2106, 2}, {855, 2107, 2}, | ||
| 675 | {857, 2108, 2}, {859, 2109, 2}, {861, 2250, 2}, {863, 2251, 2}, {865, 2252, 2}, {867, 2253, 2}, {869, 2254, 2}, | ||
| 676 | {871, 2255, 2}, {873, 2256, 2}, {875, 2257, 2}, {877, 2258, 2}, {879, 2259, 3}, {882, 2260, 2}}; | ||
| 677 | |||
| 678 | static constexpr char __aliases_string[] = | ||
| 679 | "US-ASCII\0iso-ir-6\0ANSI_X3.4-1968\0ANSI_X3.4-1986\0ISO_646.irv:1991\0ISO646-" | ||
| 680 | "US\0us\0IBM367\0cp367\0csASCII\0ASCII\0ISO_8859-1:1987\0iso-ir-100\0ISO_8859-1\0ISO-8859-" | ||
| 681 | "1\0latin1\0l1\0IBM819\0CP819\0csISOLatin1\0ISO_8859-2:1987\0iso-ir-101\0ISO_8859-2\0ISO-8859-" | ||
| 682 | "2\0latin2\0l2\0csISOLatin2\0ISO_8859-3:1988\0iso-ir-109\0ISO_8859-3\0ISO-8859-3\0latin3\0l3\0csISOLatin3\0ISO_" | ||
| 683 | "8859-4:1988\0iso-ir-110\0ISO_8859-4\0ISO-8859-4\0latin4\0l4\0csISOLatin4\0ISO_8859-5:1988\0iso-ir-144\0ISO_8859-" | ||
| 684 | "5\0ISO-8859-5\0cyrillic\0csISOLatinCyrillic\0ISO_8859-6:1987\0iso-ir-127\0ISO_8859-6\0ISO-8859-6\0ECMA-" | ||
| 685 | "114\0ASMO-708\0arabic\0csISOLatinArabic\0ISO_8859-7:1987\0iso-ir-126\0ISO_8859-7\0ISO-8859-7\0ELOT_928\0ECMA-" | ||
| 686 | "118\0greek\0greek8\0csISOLatinGreek\0ISO_8859-8:1988\0iso-ir-138\0ISO_8859-8\0ISO-8859-" | ||
| 687 | "8\0hebrew\0csISOLatinHebrew\0ISO_8859-9:1989\0iso-ir-148\0ISO_8859-9\0ISO-8859-9\0latin5\0l5\0csISOLatin5\0ISO-" | ||
| 688 | "8859-10\0iso-ir-157\0l6\0ISO_8859-10:1992\0csISOLatin6\0latin6\0ISO_6937-2-add\0iso-ir-142\0csISOTextComm\0JIS_" | ||
| 689 | "X0201\0X0201\0csHalfWidthKatakana\0JIS_Encoding\0csJISEncoding\0Shift_JIS\0MS_Kanji\0csShiftJIS\0Extended_UNIX_" | ||
| 690 | "Code_Packed_Format_for_Japanese\0csEUCPkdFmtJapanese\0EUC-JP\0Extended_UNIX_Code_Fixed_Width_for_" | ||
| 691 | "Japanese\0csEUCFixWidJapanese\0BS_4730\0iso-ir-4\0ISO646-GB\0gb\0uk\0csISO4UnitedKingdom\0SEN_850200_C\0iso-ir-" | ||
| 692 | "11\0ISO646-SE2\0se2\0csISO11SwedishForNames\0IT\0iso-ir-15\0ISO646-IT\0csISO15Italian\0ES\0iso-ir-17\0ISO646-" | ||
| 693 | "ES\0csISO17Spanish\0DIN_66003\0iso-ir-21\0de\0ISO646-DE\0csISO21German\0NS_4551-1\0iso-ir-60\0ISO646-" | ||
| 694 | "NO\0no\0csISO60DanishNorwegian\0csISO60Norwegian1\0NF_Z_62-010\0iso-ir-69\0ISO646-FR\0fr\0csISO69French\0ISO-" | ||
| 695 | "10646-UTF-1\0csISO10646UTF1\0ISO_646.basic:1983\0ref\0csISO646basic1983\0INVARIANT\0csINVARIANT\0ISO_646.irv:" | ||
| 696 | "1983\0iso-ir-2\0irv\0csISO2IntlRefVersion\0NATS-SEFI\0iso-ir-8-1\0csNATSSEFI\0NATS-SEFI-ADD\0iso-ir-8-" | ||
| 697 | "2\0csNATSSEFIADD\0SEN_850200_B\0iso-ir-10\0FI\0ISO646-FI\0ISO646-SE\0se\0csISO10Swedish\0KS_C_5601-1987\0iso-ir-" | ||
| 698 | "149\0KS_C_5601-1989\0KSC_5601\0korean\0csKSC56011987\0ISO-2022-KR\0csISO2022KR\0EUC-KR\0csEUCKR\0ISO-2022-" | ||
| 699 | "JP\0csISO2022JP\0ISO-2022-JP-2\0csISO2022JP2\0JIS_C6220-1969-jp\0JIS_C6220-1969\0iso-ir-13\0katakana\0x0201-" | ||
| 700 | "7\0csISO13JISC6220jp\0JIS_C6220-1969-ro\0iso-ir-14\0jp\0ISO646-JP\0csISO14JISC6220ro\0PT\0iso-ir-16\0ISO646-" | ||
| 701 | "PT\0csISO16Portuguese\0greek7-old\0iso-ir-18\0csISO18Greek7Old\0latin-greek\0iso-ir-19\0csISO19LatinGreek\0NF_Z_" | ||
| 702 | "62-010_(1973)\0iso-ir-25\0ISO646-FR1\0csISO25French\0Latin-greek-1\0iso-ir-27\0csISO27LatinGreek1\0ISO_" | ||
| 703 | "5427\0iso-ir-37\0csISO5427Cyrillic\0JIS_C6226-1978\0iso-ir-42\0csISO42JISC62261978\0BS_viewdata\0iso-ir-" | ||
| 704 | "47\0csISO47BSViewdata\0INIS\0iso-ir-49\0csISO49INIS\0INIS-8\0iso-ir-50\0csISO50INIS8\0INIS-cyrillic\0iso-ir-" | ||
| 705 | "51\0csISO51INISCyrillic\0ISO_5427:1981\0iso-ir-54\0ISO5427Cyrillic1981\0csISO54271981\0ISO_5428:1980\0iso-ir-" | ||
| 706 | "55\0csISO5428Greek\0GB_1988-80\0iso-ir-57\0cn\0ISO646-CN\0csISO57GB1988\0GB_2312-80\0iso-ir-" | ||
| 707 | "58\0chinese\0csISO58GB231280\0NS_4551-2\0ISO646-NO2\0iso-ir-61\0no2\0csISO61Norwegian2\0videotex-suppl\0iso-ir-" | ||
| 708 | "70\0csISO70VideotexSupp1\0PT2\0iso-ir-84\0ISO646-PT2\0csISO84Portuguese2\0ES2\0iso-ir-85\0ISO646-" | ||
| 709 | "ES2\0csISO85Spanish2\0MSZ_7795.3\0iso-ir-86\0ISO646-HU\0hu\0csISO86Hungarian\0JIS_C6226-1983\0iso-ir-" | ||
| 710 | "87\0x0208\0JIS_X0208-1983\0csISO87JISX0208\0greek7\0iso-ir-88\0csISO88Greek7\0ASMO_449\0ISO_9036\0arabic7\0iso-" | ||
| 711 | "ir-89\0csISO89ASMO449\0iso-ir-90\0csISO90\0JIS_C6229-1984-a\0iso-ir-91\0jp-ocr-a\0csISO91JISC62291984a\0JIS_" | ||
| 712 | "C6229-1984-b\0iso-ir-92\0ISO646-JP-OCR-B\0jp-ocr-b\0csISO92JISC62991984b\0JIS_C6229-1984-b-add\0iso-ir-93\0jp-" | ||
| 713 | "ocr-b-add\0csISO93JIS62291984badd\0JIS_C6229-1984-hand\0iso-ir-94\0jp-ocr-hand\0csISO94JIS62291984hand\0JIS_" | ||
| 714 | "C6229-1984-hand-add\0iso-ir-95\0jp-ocr-hand-add\0csISO95JIS62291984handadd\0JIS_C6229-1984-kana\0iso-ir-" | ||
| 715 | "96\0csISO96JISC62291984kana\0ISO_2033-1983\0iso-ir-98\0e13b\0csISO2033\0ANSI_X3.110-1983\0iso-ir-99\0CSA_T500-" | ||
| 716 | "1983\0NAPLPS\0csISO99NAPLPS\0T.61-7bit\0iso-ir-102\0csISO102T617bit\0T.61-8bit\0T.61\0iso-ir-" | ||
| 717 | "103\0csISO103T618bit\0ECMA-cyrillic\0iso-ir-111\0KOI8-E\0csISO111ECMACyrillic\0CSA_Z243.4-1985-1\0iso-ir-" | ||
| 718 | "121\0ISO646-CA\0csa7-1\0csa71\0ca\0csISO121Canadian1\0CSA_Z243.4-1985-2\0iso-ir-122\0ISO646-CA2\0csa7-" | ||
| 719 | "2\0csa72\0csISO122Canadian2\0CSA_Z243.4-1985-gr\0iso-ir-123\0csISO123CSAZ24341985gr\0ISO_8859-6-" | ||
| 720 | "E\0csISO88596E\0ISO-8859-6-E\0ISO_8859-6-I\0csISO88596I\0ISO-8859-6-I\0T.101-G2\0iso-ir-" | ||
| 721 | "128\0csISO128T101G2\0ISO_8859-8-E\0csISO88598E\0ISO-8859-8-E\0ISO_8859-8-I\0csISO88598I\0ISO-8859-8-I\0CSN_" | ||
| 722 | "369103\0iso-ir-139\0csISO139CSN369103\0JUS_I.B1.002\0iso-ir-141\0ISO646-YU\0js\0yu\0csISO141JUSIB1002\0IEC_P27-" | ||
| 723 | "1\0iso-ir-143\0csISO143IECP271\0JUS_I.B1.003-serb\0iso-ir-146\0serbian\0csISO146Serbian\0JUS_I.B1.003-" | ||
| 724 | "mac\0macedonian\0iso-ir-147\0csISO147Macedonian\0greek-ccitt\0iso-ir-150\0csISO150\0csISO150GreekCCITT\0NC_NC00-" | ||
| 725 | "10:81\0cuba\0iso-ir-151\0ISO646-CU\0csISO151Cuba\0ISO_6937-2-25\0iso-ir-152\0csISO6937Add\0GOST_19768-74\0ST_" | ||
| 726 | "SEV_358-88\0iso-ir-153\0csISO153GOST1976874\0ISO_8859-supp\0iso-ir-154\0latin1-2-5\0csISO8859Supp\0ISO_10367-" | ||
| 727 | "box\0iso-ir-155\0csISO10367Box\0latin-lap\0lap\0iso-ir-158\0csISO158Lap\0JIS_X0212-1990\0x0212\0iso-ir-" | ||
| 728 | "159\0csISO159JISX02121990\0DS_2089\0DS2089\0ISO646-DK\0dk\0csISO646Danish\0us-dk\0csUSDK\0dk-" | ||
| 729 | "us\0csDKUS\0KSC5636\0ISO646-KR\0csKSC5636\0UNICODE-1-1-UTF-7\0csUnicode11UTF7\0ISO-2022-CN\0csISO2022CN\0ISO-" | ||
| 730 | "2022-CN-EXT\0csISO2022CNEXT\0UTF-8\0csUTF8\0ISO-8859-13\0csISO885913\0ISO-8859-14\0iso-ir-199\0ISO_8859-14:" | ||
| 731 | "1998\0ISO_8859-14\0latin8\0iso-celtic\0l8\0csISO885914\0ISO-8859-15\0ISO_8859-15\0Latin-9\0csISO885915\0ISO-" | ||
| 732 | "8859-16\0iso-ir-226\0ISO_8859-16:2001\0ISO_8859-16\0latin10\0l10\0csISO885916\0GBK\0CP936\0MS936\0windows-" | ||
| 733 | "936\0csGBK\0GB18030\0csGB18030\0OSD_EBCDIC_DF04_15\0csOSDEBCDICDF0415\0OSD_EBCDIC_DF03_" | ||
| 734 | "IRV\0csOSDEBCDICDF03IRV\0OSD_EBCDIC_DF04_1\0csOSDEBCDICDF041\0ISO-11548-1\0ISO_11548-1\0ISO_TR_11548-" | ||
| 735 | "1\0csISO115481\0KZ-1048\0STRK1048-2002\0RK1048\0csKZ1048\0ISO-10646-UCS-2\0csUnicode\0ISO-10646-UCS-" | ||
| 736 | "4\0csUCS4\0ISO-10646-UCS-Basic\0csUnicodeASCII\0ISO-10646-Unicode-Latin1\0csUnicodeLatin1\0ISO-10646\0ISO-10646-" | ||
| 737 | "J-1\0csUnicodeJapanese\0ISO-Unicode-IBM-1261\0csUnicodeIBM1261\0ISO-Unicode-IBM-1268\0csUnicodeIBM1268\0ISO-" | ||
| 738 | "Unicode-IBM-1276\0csUnicodeIBM1276\0ISO-Unicode-IBM-1264\0csUnicodeIBM1264\0ISO-Unicode-IBM-" | ||
| 739 | "1265\0csUnicodeIBM1265\0UNICODE-1-1\0csUnicode11\0SCSU\0csSCSU\0UTF-7\0csUTF7\0UTF-16BE\0csUTF16BE\0UTF-" | ||
| 740 | "16LE\0csUTF16LE\0UTF-16\0csUTF16\0CESU-8\0csCESU8\0csCESU-8\0UTF-32\0csUTF32\0UTF-32BE\0csUTF32BE\0UTF-" | ||
| 741 | "32LE\0csUTF32LE\0BOCU-1\0csBOCU1\0csBOCU-1\0UTF-7-IMAP\0csUTF7IMAP\0ISO-8859-1-Windows-3.0-Latin-" | ||
| 742 | "1\0csWindows30Latin1\0ISO-8859-1-Windows-3.1-Latin-1\0csWindows31Latin1\0ISO-8859-2-Windows-Latin-" | ||
| 743 | "2\0csWindows31Latin2\0ISO-8859-9-Windows-Latin-5\0csWindows31Latin5\0hp-roman8\0roman8\0r8\0csHPRoman8\0Adobe-" | ||
| 744 | "Standard-Encoding\0csAdobeStandardEncoding\0Ventura-US\0csVenturaUS\0Ventura-" | ||
| 745 | "International\0csVenturaInternational\0DEC-" | ||
| 746 | "MCS\0dec\0csDECMCS\0IBM850\0cp850\0850\0csPC850Multilingual\0IBM852\0cp852\0852\0csPCp852\0IBM437\0cp437\0" | ||
| 747 | "437\0csPC8CodePage437\0PC8-Danish-Norwegian\0csPC8DanishNorwegian\0IBM862\0cp862\0862\0csPC862LatinHebrew\0PC8-" | ||
| 748 | "Turkish\0csPC8Turkish\0IBM-Symbols\0csIBMSymbols\0IBM-Thai\0csIBMThai\0HP-Legal\0csHPLegal\0HP-Pi-" | ||
| 749 | "font\0csHPPiFont\0HP-Math8\0csHPMath8\0Adobe-Symbol-Encoding\0csHPPSMath\0HP-DeskTop\0csHPDesktop\0Ventura-" | ||
| 750 | "Math\0csVenturaMath\0Microsoft-Publishing\0csMicrosoftPublishing\0Windows-" | ||
| 751 | "31J\0csWindows31J\0GB2312\0csGB2312\0Big5\0csBig5\0macintosh\0mac\0csMacintosh\0IBM037\0cp037\0ebcdic-cp-" | ||
| 752 | "us\0ebcdic-cp-ca\0ebcdic-cp-wt\0ebcdic-cp-nl\0csIBM037\0IBM038\0EBCDIC-" | ||
| 753 | "INT\0cp038\0csIBM038\0IBM273\0CP273\0csIBM273\0IBM274\0EBCDIC-BE\0CP274\0csIBM274\0IBM275\0EBCDIC-" | ||
| 754 | "BR\0cp275\0csIBM275\0IBM277\0EBCDIC-CP-DK\0EBCDIC-CP-NO\0csIBM277\0IBM278\0CP278\0ebcdic-cp-fi\0ebcdic-cp-" | ||
| 755 | "se\0csIBM278\0IBM280\0CP280\0ebcdic-cp-it\0csIBM280\0IBM281\0EBCDIC-JP-" | ||
| 756 | "E\0cp281\0csIBM281\0IBM284\0CP284\0ebcdic-cp-es\0csIBM284\0IBM285\0CP285\0ebcdic-cp-" | ||
| 757 | "gb\0csIBM285\0IBM290\0cp290\0EBCDIC-JP-kana\0csIBM290\0IBM297\0cp297\0ebcdic-cp-" | ||
| 758 | "fr\0csIBM297\0IBM420\0cp420\0ebcdic-cp-ar1\0csIBM420\0IBM423\0cp423\0ebcdic-cp-" | ||
| 759 | "gr\0csIBM423\0IBM424\0cp424\0ebcdic-cp-he\0csIBM424\0IBM500\0CP500\0ebcdic-cp-be\0ebcdic-cp-" | ||
| 760 | "ch\0csIBM500\0IBM851\0cp851\0851\0csIBM851\0IBM855\0cp855\0855\0csIBM855\0IBM857\0cp857\0857\0csIBM857\0IBM860\0" | ||
| 761 | "cp860\0860\0csIBM860\0IBM861\0cp861\0861\0cp-" | ||
| 762 | "is\0csIBM861\0IBM863\0cp863\0863\0csIBM863\0IBM864\0cp864\0csIBM864\0IBM865\0cp865\0865\0csIBM865\0IBM868\0CP868" | ||
| 763 | "\0cp-ar\0csIBM868\0IBM869\0cp869\0869\0cp-gr\0csIBM869\0IBM870\0CP870\0ebcdic-cp-roece\0ebcdic-cp-" | ||
| 764 | "yu\0csIBM870\0IBM871\0CP871\0ebcdic-cp-is\0csIBM871\0IBM880\0cp880\0EBCDIC-" | ||
| 765 | "Cyrillic\0csIBM880\0IBM891\0cp891\0csIBM891\0IBM903\0cp903\0csIBM903\0IBM904\0cp904\0904\0csIBBM904\0IBM905\0CP9" | ||
| 766 | "05\0ebcdic-cp-tr\0csIBM905\0IBM918\0CP918\0ebcdic-cp-ar2\0csIBM918\0IBM1026\0CP1026\0csIBM1026\0EBCDIC-AT-" | ||
| 767 | "DE\0csIBMEBCDICATDE\0EBCDIC-AT-DE-A\0csEBCDICATDEA\0EBCDIC-CA-FR\0csEBCDICCAFR\0EBCDIC-DK-" | ||
| 768 | "NO\0csEBCDICDKNO\0EBCDIC-DK-NO-A\0csEBCDICDKNOA\0EBCDIC-FI-SE\0csEBCDICFISE\0EBCDIC-FI-SE-" | ||
| 769 | "A\0csEBCDICFISEA\0EBCDIC-FR\0csEBCDICFR\0EBCDIC-IT\0csEBCDICIT\0EBCDIC-PT\0csEBCDICPT\0EBCDIC-" | ||
| 770 | "ES\0csEBCDICES\0EBCDIC-ES-A\0csEBCDICESA\0EBCDIC-ES-S\0csEBCDICESS\0EBCDIC-UK\0csEBCDICUK\0EBCDIC-" | ||
| 771 | "US\0csEBCDICUS\0UNKNOWN-" | ||
| 772 | "8BIT\0csUnknown8BiT\0MNEMONIC\0csMnemonic\0MNEM\0csMnem\0VISCII\0csVISCII\0VIQR\0csVIQR\0KOI8-R\0csKOI8R\0HZ-GB-" | ||
| 773 | "2312\0IBM866\0cp866\0866\0csIBM866\0IBM775\0cp775\0csPC775Baltic\0KOI8-" | ||
| 774 | "U\0csKOI8U\0IBM00858\0CCSID00858\0CP00858\0PC-Multilingual-850+" | ||
| 775 | "euro\0csIBM00858\0IBM00924\0CCSID00924\0CP00924\0ebcdic-Latin9--" | ||
| 776 | "euro\0csIBM00924\0IBM01140\0CCSID01140\0CP01140\0ebcdic-us-37+" | ||
| 777 | "euro\0csIBM01140\0IBM01141\0CCSID01141\0CP01141\0ebcdic-de-273+" | ||
| 778 | "euro\0csIBM01141\0IBM01142\0CCSID01142\0CP01142\0ebcdic-dk-277+euro\0ebcdic-no-277+" | ||
| 779 | "euro\0csIBM01142\0IBM01143\0CCSID01143\0CP01143\0ebcdic-fi-278+euro\0ebcdic-se-278+" | ||
| 780 | "euro\0csIBM01143\0IBM01144\0CCSID01144\0CP01144\0ebcdic-it-280+" | ||
| 781 | "euro\0csIBM01144\0IBM01145\0CCSID01145\0CP01145\0ebcdic-es-284+" | ||
| 782 | "euro\0csIBM01145\0IBM01146\0CCSID01146\0CP01146\0ebcdic-gb-285+" | ||
| 783 | "euro\0csIBM01146\0IBM01147\0CCSID01147\0CP01147\0ebcdic-fr-297+" | ||
| 784 | "euro\0csIBM01147\0IBM01148\0CCSID01148\0CP01148\0ebcdic-international-500+" | ||
| 785 | "euro\0csIBM01148\0IBM01149\0CCSID01149\0CP01149\0ebcdic-is-871+euro\0csIBM01149\0Big5-" | ||
| 786 | "HKSCS\0csBig5HKSCS\0IBM1047\0IBM-1047\0csIBM1047\0PTCP154\0csPTCP154\0PT154\0CP154\0Cyrillic-Asian\0Amiga-" | ||
| 787 | "1251\0Ami1251\0Amiga1251\0Ami-1251\0csAmiga1251\0KOI7-" | ||
| 788 | "switched\0csKOI7switched\0BRF\0csBRF\0TSCII\0csTSCII\0CP51932\0csCP51932\0windows-874\0cswindows874\0windows-" | ||
| 789 | "1250\0cswindows1250\0windows-1251\0cswindows1251\0windows-1252\0cswindows1252\0windows-" | ||
| 790 | "1253\0cswindows1253\0windows-1254\0cswindows1254\0windows-1255\0cswindows1255\0windows-" | ||
| 791 | "1256\0cswindows1256\0windows-1257\0cswindows1257\0windows-1258\0cswindows1258\0TIS-620\0csTIS620\0ISO-8859-" | ||
| 792 | "11\0CP50220\0csCP50220\0"; | ||
| 793 | |||
| 794 | struct __offset_table { | ||
| 795 | constexpr static unsigned long long __num_aliases = | ||
| 796 | std::count(__aliases_string, __aliases_string + sizeof(__aliases_string), '\0') + 1; | ||
| 797 | unsigned short __table[__num_aliases]; | ||
| 798 | }; | ||
| 799 | |||
| 800 | static constexpr __offset_table __alias_offsets = [] { | ||
| 801 | __offset_table __aliases{}; | ||
| 802 | __aliases.__table[0] = sizeof(__aliases_string) - 1; | ||
| 803 | __aliases.__table[1] = sizeof(__aliases_string) - 1; | ||
| 804 | __aliases.__table[2] = 0; | ||
| 805 | |||
| 806 | unsigned long long __idx = 3; | ||
| 807 | |||
| 808 | for (unsigned short __pos = 0; __pos < sizeof(__aliases_string) - 1 && __idx < __offset_table::__num_aliases; | ||
| 809 | __pos++) { | ||
| 810 | if (__aliases_string[__pos] == '\0') { | ||
| 811 | __aliases.__table[__idx++] = __pos + 1; | ||
| 812 | } | ||
| 813 | } | ||
| 814 | |||
| 815 | return __aliases; | ||
| 816 | }(); | ||
| 817 | }; | ||
| 818 | |||
| 819 | template <> | ||
| 820 | struct hash<text_encoding> { | ||
| 821 | [[nodiscard]] static size_t operator()(const text_encoding& __enc) noexcept { | ||
| 822 | return std::hash<std::text_encoding::id>()(__enc.mib()); | ||
| 823 | } | ||
| 824 | }; | ||
| 825 | |||
| 826 | template <> | ||
| 827 | inline constexpr bool ranges::enable_borrowed_range<text_encoding::aliases_view> = true; | ||
| 828 | |||
| 829 | _LIBCPP_END_NAMESPACE_STD | ||
| 830 | |||
| 831 | # endif // _LIBCPP_STD_VER >= 26 | ||
| 832 | |||
| 833 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | ||
| 834 | |||
| 835 | #endif // _LIBCPP_TEXT_ENCODING | ||
lib/libcxx/include/thread+13-7| ... | @@ -91,6 +91,11 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); | ... | @@ -91,6 +91,11 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); |
| 91 | #else | 91 | #else |
| 92 | # include <__config> | 92 | # include <__config> |
| 93 | 93 | ||
| 94 | // standard-mandated includes | ||
| 95 | |||
| 96 | // [thread.syn] | ||
| 97 | # include <compare> | ||
| 98 | |||
| 94 | # if _LIBCPP_HAS_THREADS | 99 | # if _LIBCPP_HAS_THREADS |
| 95 | 100 | ||
| 96 | # include <__thread/this_thread.h> | 101 | # include <__thread/this_thread.h> |
| ... | @@ -106,28 +111,29 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); | ... | @@ -106,28 +111,29 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); |
| 106 | 111 | ||
| 107 | # include <version> | 112 | # include <version> |
| 108 | 113 | ||
| 109 | // standard-mandated includes | ||
| 110 | |||
| 111 | // [thread.syn] | ||
| 112 | # include <compare> | ||
| 113 | |||
| 114 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 114 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 115 | # pragma GCC system_header | 115 | # pragma GCC system_header |
| 116 | # endif | 116 | # endif |
| 117 | 117 | ||
| 118 | # endif // _LIBCPP_HAS_THREADS | 118 | # endif // _LIBCPP_HAS_THREADS |
| 119 | 119 | ||
| 120 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 | 120 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 17 |
| 121 | # include <chrono> | 121 | # include <chrono> |
| 122 | # endif | 122 | # endif |
| 123 | 123 | ||
| 124 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 124 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 125 | # include <cstring> | 125 | # include <cstring> |
| 126 | # include <functional> | 126 | # include <functional> |
| 127 | # include <new> | 127 | # include <new> |
| 128 | # include <system_error> | 128 | # include <system_error> |
| 129 | # include <type_traits> | 129 | # include <type_traits> |
| 130 | # endif | 130 | # endif |
| 131 | |||
| 132 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 | ||
| 133 | # include <atomic> | ||
| 134 | # include <sstream> | ||
| 135 | # endif | ||
| 136 | |||
| 131 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 137 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 132 | 138 | ||
| 133 | #endif // _LIBCPP_THREAD | 139 | #endif // _LIBCPP_THREAD |
lib/libcxx/include/tuple+53-65| ... | @@ -255,7 +255,6 @@ template <class... Types> | ... | @@ -255,7 +255,6 @@ template <class... Types> |
| 255 | # include <__type_traits/is_same.h> | 255 | # include <__type_traits/is_same.h> |
| 256 | # include <__type_traits/is_swappable.h> | 256 | # include <__type_traits/is_swappable.h> |
| 257 | # include <__type_traits/is_trivially_relocatable.h> | 257 | # include <__type_traits/is_trivially_relocatable.h> |
| 258 | # include <__type_traits/lazy.h> | ||
| 259 | # include <__type_traits/maybe_const.h> | 258 | # include <__type_traits/maybe_const.h> |
| 260 | # include <__type_traits/nat.h> | 259 | # include <__type_traits/nat.h> |
| 261 | # include <__type_traits/negation.h> | 260 | # include <__type_traits/negation.h> |
| ... | @@ -284,10 +283,10 @@ template <class... Types> | ... | @@ -284,10 +283,10 @@ template <class... Types> |
| 284 | _LIBCPP_PUSH_MACROS | 283 | _LIBCPP_PUSH_MACROS |
| 285 | # include <__undef_macros> | 284 | # include <__undef_macros> |
| 286 | 285 | ||
| 287 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 288 | |||
| 289 | # ifndef _LIBCPP_CXX03_LANG | 286 | # ifndef _LIBCPP_CXX03_LANG |
| 290 | 287 | ||
| 288 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 289 | |||
| 291 | template <size_t _Ip, class _Tp, class _Up> | 290 | template <size_t _Ip, class _Tp, class _Up> |
| 292 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool __tuple_compare_equal(const _Tp& __x, const _Up& __y) { | 291 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool __tuple_compare_equal(const _Tp& __x, const _Up& __y) { |
| 293 | if constexpr (_Ip == 0) | 292 | if constexpr (_Ip == 0) |
| ... | @@ -296,20 +295,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool __tuple_compare_equal(c | ... | @@ -296,20 +295,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool __tuple_compare_equal(c |
| 296 | return std::__tuple_compare_equal<_Ip - 1>(__x, __y) && std::get<_Ip - 1>(__x) == std::get<_Ip - 1>(__y); | 295 | return std::__tuple_compare_equal<_Ip - 1>(__x, __y) && std::get<_Ip - 1>(__x) == std::get<_Ip - 1>(__y); |
| 297 | } | 296 | } |
| 298 | 297 | ||
| 299 | # if _LIBCPP_STD_VER >= 26 | ||
| 300 | template <class _Tp, class _Up, class _IndexSeq = make_index_sequence<tuple_size_v<_Tp>>> | ||
| 301 | inline constexpr bool __can_tuple_compare_equal = false; | ||
| 302 | |||
| 303 | // TODO(LLVM 23): Remove `tuple_size_v<_Tp> == tuple_size_v<_Up>` here once once LLVM-20 support ends | ||
| 304 | // because the resolution of CWG2369 landed in LLVM-21. | ||
| 305 | template <class _Tp, class _Up, size_t... _Is> | ||
| 306 | requires(tuple_size_v<_Tp> == tuple_size_v<_Up>) | ||
| 307 | inline constexpr bool __can_tuple_compare_equal<_Tp, _Up, index_sequence<_Is...>> = | ||
| 308 | __all<requires(const tuple_element_t<_Is, _Tp>& __t, const tuple_element_t<_Is, _Up>& __u) { | ||
| 309 | { __t == __u } -> __boolean_testable; | ||
| 310 | }...>::value; | ||
| 311 | # endif // _LIBCPP_STD_VER >= 26 | ||
| 312 | |||
| 313 | # if _LIBCPP_STD_VER >= 20 | 298 | # if _LIBCPP_STD_VER >= 20 |
| 314 | template <class _Ret, class _Tp, class _Up, size_t... _Is> | 299 | template <class _Ret, class _Tp, class _Up, size_t... _Is> |
| 315 | _LIBCPP_HIDE_FROM_ABI constexpr _Ret __tuple_compare_three_way(const _Tp& __x, const _Up& __y, index_sequence<_Is...>) { | 300 | _LIBCPP_HIDE_FROM_ABI constexpr _Ret __tuple_compare_three_way(const _Tp& __x, const _Up& __y, index_sequence<_Is...>) { |
| ... | @@ -324,24 +309,16 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Ret __tuple_compare_three_way(const _Tp& __x, c | ... | @@ -324,24 +309,16 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Ret __tuple_compare_three_way(const _Tp& __x, c |
| 324 | template <class _Tp> | 309 | template <class _Tp> |
| 325 | concept __tuple_like_no_tuple = __tuple_like<_Tp> && !__is_tuple_v<_Tp>; | 310 | concept __tuple_like_no_tuple = __tuple_like<_Tp> && !__is_tuple_v<_Tp>; |
| 326 | 311 | ||
| 327 | template <class _Tp, class _Up, class _IndexSeq> | 312 | template <__tuple_like _Tp, class _IndexSequence = make_index_sequence<tuple_size_v<_Tp>>> |
| 328 | struct __tuple_common_comparison_category_impl {}; | 313 | struct __to_tuple; |
| 329 | 314 | ||
| 330 | // TODO(LLVM 23): Remove `tuple_size_v<_Tp> == tuple_size_v<_Up>` here once once LLVM-20 support ends | 315 | template <__tuple_like _Tp, size_t... _Index> |
| 331 | // because the resolution of CWG2369 landed in LLVM-21. | 316 | struct __to_tuple<_Tp, index_sequence<_Index...>> { |
| 332 | template <class _Tp, class _Up, size_t... _Is> | 317 | using type _LIBCPP_NODEBUG = tuple<tuple_element_t<_Index, _Tp>...>; |
| 333 | requires(tuple_size_v<_Tp> == tuple_size_v<_Up>) && requires { | ||
| 334 | typename common_comparison_category_t< | ||
| 335 | __synth_three_way_result<tuple_element_t<_Is, _Tp>, tuple_element_t<_Is, _Up>>...>; | ||
| 336 | } | ||
| 337 | struct __tuple_common_comparison_category_impl<_Tp, _Up, index_sequence<_Is...>> { | ||
| 338 | using type _LIBCPP_NODEBUG = | ||
| 339 | common_comparison_category_t<__synth_three_way_result<tuple_element_t<_Is, _Tp>, tuple_element_t<_Is, _Up>>...>; | ||
| 340 | }; | 318 | }; |
| 341 | 319 | ||
| 342 | template <__tuple_like _Tp, __tuple_like _Up> | 320 | template <__tuple_like _Tp> |
| 343 | using __tuple_common_comparison_category _LIBCPP_NODEBUG = | 321 | using __to_tuple_t _LIBCPP_NODEBUG = typename __to_tuple<_Tp>::type; |
| 344 | __tuple_common_comparison_category_impl<_Tp, _Up, make_index_sequence<tuple_size_v<_Tp>>>::type; | ||
| 345 | # endif // _LIBCPP_STD_VER >= 23 | 322 | # endif // _LIBCPP_STD_VER >= 23 |
| 346 | 323 | ||
| 347 | // __tuple_leaf | 324 | // __tuple_leaf |
| ... | @@ -602,30 +579,28 @@ public: | ... | @@ -602,30 +579,28 @@ public: |
| 602 | template <template <class...> class _IsImpDefault = __is_implicitly_default_constructible, | 579 | template <template <class...> class _IsImpDefault = __is_implicitly_default_constructible, |
| 603 | template <class...> class _IsDefault = is_default_constructible, | 580 | template <class...> class _IsDefault = is_default_constructible, |
| 604 | __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0> | 581 | __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0> |
| 605 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value) | 582 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_And<_IsImpDefault<_Tp>...>::value) |
| 606 | tuple() noexcept(_And<is_nothrow_default_constructible<_Tp>...>::value) {} | 583 | tuple() noexcept(_And<is_nothrow_default_constructible<_Tp>...>::value) {} |
| 607 | 584 | ||
| 608 | template <class _Alloc, | 585 | template <class _Alloc, |
| 609 | template <class...> class _IsImpDefault = __is_implicitly_default_constructible, | 586 | template <class...> class _IsImpDefault = __is_implicitly_default_constructible, |
| 610 | template <class...> class _IsDefault = is_default_constructible, | 587 | template <class...> class _IsDefault = is_default_constructible, |
| 611 | __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0> | 588 | __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0> |
| 612 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value) | 589 | _LIBCPP_HIDE_FROM_ABI |
| 613 | tuple(allocator_arg_t, _Alloc const& __a) | 590 | _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!_And<_IsImpDefault<_Tp>...>::value) tuple(allocator_arg_t, _Alloc const& __a) |
| 614 | : __base_(allocator_arg_t(), __a, __value_init{}) {} | 591 | : __base_(allocator_arg_t(), __a, __value_init{}) {} |
| 615 | 592 | ||
| 616 | // tuple(const T&...) constructors (including allocator_arg_t variants) | 593 | // tuple(const T&...) constructors (including allocator_arg_t variants) |
| 617 | template <template <class...> class _And = _And, | 594 | template <template <class...> class _And = _And, |
| 618 | __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0> | 595 | __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0> |
| 619 | _LIBCPP_HIDE_FROM_ABI | 596 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_And<is_convertible<const _Tp&, _Tp>...>::value) |
| 620 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value) | ||
| 621 | tuple(const _Tp&... __t) noexcept(_And<is_nothrow_copy_constructible<_Tp>...>::value) | 597 | tuple(const _Tp&... __t) noexcept(_And<is_nothrow_copy_constructible<_Tp>...>::value) |
| 622 | : __base_(__forward_args{}, __t...) {} | 598 | : __base_(__forward_args{}, __t...) {} |
| 623 | 599 | ||
| 624 | template <class _Alloc, | 600 | template <class _Alloc, |
| 625 | template <class...> class _And = _And, | 601 | template <class...> class _And = _And, |
| 626 | __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0> | 602 | __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0> |
| 627 | _LIBCPP_HIDE_FROM_ABI | 603 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!_And<is_convertible<const _Tp&, _Tp>...>::value) |
| 628 | _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value) | ||
| 629 | tuple(allocator_arg_t, const _Alloc& __a, const _Tp&... __t) | 604 | tuple(allocator_arg_t, const _Alloc& __a, const _Tp&... __t) |
| 630 | : __base_(allocator_arg_t(), __a, __forward_args{}, __t...) {} | 605 | : __base_(allocator_arg_t(), __a, __forward_args{}, __t...) {} |
| 631 | 606 | ||
| ... | @@ -644,7 +619,7 @@ public: | ... | @@ -644,7 +619,7 @@ public: |
| 644 | template <class... _Up, | 619 | template <class... _Up, |
| 645 | __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value, | 620 | __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value, |
| 646 | int> = 0> | 621 | int> = 0> |
| 647 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) | 622 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_And<is_convertible<_Up, _Tp>...>::value) |
| 648 | tuple(_Up&&... __u) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value) | 623 | tuple(_Up&&... __u) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value) |
| 649 | : __base_(__forward_args{}, std::forward<_Up>(__u)...) {} | 624 | : __base_(__forward_args{}, std::forward<_Up>(__u)...) {} |
| 650 | 625 | ||
| ... | @@ -652,7 +627,7 @@ public: | ... | @@ -652,7 +627,7 @@ public: |
| 652 | class... _Up, | 627 | class... _Up, |
| 653 | __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value, | 628 | __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value, |
| 654 | int> = 0> | 629 | int> = 0> |
| 655 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) | 630 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!_And<is_convertible<_Up, _Tp>...>::value) |
| 656 | tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) | 631 | tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) |
| 657 | : __base_(allocator_arg_t(), __a, __forward_args{}, std::forward<_Up>(__u)...) {} | 632 | : __base_(allocator_arg_t(), __a, __forward_args{}, std::forward<_Up>(__u)...) {} |
| 658 | 633 | ||
| ... | @@ -690,26 +665,22 @@ public: | ... | @@ -690,26 +665,22 @@ public: |
| 690 | _Not<is_same<_OtherTuple, const tuple&> >, | 665 | _Not<is_same<_OtherTuple, const tuple&> >, |
| 691 | _Not<is_same<_OtherTuple, tuple&&> >, | 666 | _Not<is_same<_OtherTuple, tuple&&> >, |
| 692 | is_constructible<_Tp, __copy_cvref_t<_OtherTuple, _Up> >..., | 667 | is_constructible<_Tp, __copy_cvref_t<_OtherTuple, _Up> >..., |
| 693 | _Lazy<_Or, | 668 | _Or<_BoolConstant<sizeof...(_Tp) != 1>, |
| 694 | _BoolConstant<sizeof...(_Tp) != 1>, | 669 | // _Tp and _Up are 1-element packs - the pack expansions look |
| 695 | // _Tp and _Up are 1-element packs - the pack expansions look | 670 | // weird to avoid tripping up the type traits in degenerate cases |
| 696 | // weird to avoid tripping up the type traits in degenerate cases | 671 | _And<_Not<is_same<_Tp, _Up> >..., |
| 697 | _Lazy<_And, | 672 | _Not<is_convertible<_OtherTuple, _Tp> >..., |
| 698 | _Not<is_same<_Tp, _Up> >..., | 673 | _Not<is_constructible<_Tp, _OtherTuple> >... > > > {}; |
| 699 | _Not<is_convertible<_OtherTuple, _Tp> >..., | ||
| 700 | _Not<is_constructible<_Tp, _OtherTuple> >... > > > {}; | ||
| 701 | 674 | ||
| 702 | template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0> | 675 | template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0> |
| 703 | _LIBCPP_HIDE_FROM_ABI | 676 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_And<is_convertible<const _Up&, _Tp>...>::value) |
| 704 | _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value) | ||
| 705 | tuple(const tuple<_Up...>& __t) noexcept(_And<is_nothrow_constructible<_Tp, const _Up&>...>::value) | 677 | tuple(const tuple<_Up...>& __t) noexcept(_And<is_nothrow_constructible<_Tp, const _Up&>...>::value) |
| 706 | : __base_(__from_tuple(), __t) {} | 678 | : __base_(__from_tuple(), __t) {} |
| 707 | 679 | ||
| 708 | template <class... _Up, | 680 | template <class... _Up, |
| 709 | class _Alloc, | 681 | class _Alloc, |
| 710 | __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0> | 682 | __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0> |
| 711 | _LIBCPP_HIDE_FROM_ABI | 683 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!_And<is_convertible<const _Up&, _Tp>...>::value) |
| 712 | _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value) | ||
| 713 | tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t) | 684 | tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t) |
| 714 | : __base_(allocator_arg_t(), __a, __from_tuple(), __t) {} | 685 | : __base_(allocator_arg_t(), __a, __from_tuple(), __t) {} |
| 715 | 686 | ||
| ... | @@ -717,25 +688,25 @@ public: | ... | @@ -717,25 +688,25 @@ public: |
| 717 | // tuple(tuple<U...>&) constructors (including allocator_arg_t variants) | 688 | // tuple(tuple<U...>&) constructors (including allocator_arg_t variants) |
| 718 | 689 | ||
| 719 | template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr> | 690 | template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr> |
| 720 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value) tuple(tuple<_Up...>& __t) | 691 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_And<is_convertible<_Up&, _Tp>...>::value) tuple(tuple<_Up...>& __t) |
| 721 | : __base_(__from_tuple(), __t) {} | 692 | : __base_(__from_tuple(), __t) {} |
| 722 | 693 | ||
| 723 | template <class _Alloc, class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr> | 694 | template <class _Alloc, class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr> |
| 724 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value) | 695 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_And<is_convertible<_Up&, _Tp>...>::value) |
| 725 | tuple(allocator_arg_t, const _Alloc& __alloc, tuple<_Up...>& __t) | 696 | tuple(allocator_arg_t, const _Alloc& __alloc, tuple<_Up...>& __t) |
| 726 | : __base_(allocator_arg_t(), __alloc, __from_tuple(), __t) {} | 697 | : __base_(allocator_arg_t(), __alloc, __from_tuple(), __t) {} |
| 727 | # endif // _LIBCPP_STD_VER >= 23 | 698 | # endif // _LIBCPP_STD_VER >= 23 |
| 728 | 699 | ||
| 729 | // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants) | 700 | // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants) |
| 730 | template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0> | 701 | template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0> |
| 731 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) | 702 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_And<is_convertible<_Up, _Tp>...>::value) |
| 732 | tuple(tuple<_Up...>&& __t) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value) | 703 | tuple(tuple<_Up...>&& __t) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value) |
| 733 | : __base_(__from_tuple(), std::move(__t)) {} | 704 | : __base_(__from_tuple(), std::move(__t)) {} |
| 734 | 705 | ||
| 735 | template <class _Alloc, | 706 | template <class _Alloc, |
| 736 | class... _Up, | 707 | class... _Up, |
| 737 | __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0> | 708 | __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0> |
| 738 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) | 709 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!_And<is_convertible<_Up, _Tp>...>::value) |
| 739 | tuple(allocator_arg_t, const _Alloc& __a, tuple<_Up...>&& __t) | 710 | tuple(allocator_arg_t, const _Alloc& __a, tuple<_Up...>&& __t) |
| 740 | : __base_(allocator_arg_t(), __a, __from_tuple(), std::move(__t)) {} | 711 | : __base_(allocator_arg_t(), __a, __from_tuple(), std::move(__t)) {} |
| 741 | 712 | ||
| ... | @@ -743,14 +714,14 @@ public: | ... | @@ -743,14 +714,14 @@ public: |
| 743 | // tuple(const tuple<U...>&&) constructors (including allocator_arg_t variants) | 714 | // tuple(const tuple<U...>&&) constructors (including allocator_arg_t variants) |
| 744 | 715 | ||
| 745 | template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr> | 716 | template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr> |
| 746 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value) | 717 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_And<is_convertible<const _Up&&, _Tp>...>::value) |
| 747 | tuple(const tuple<_Up...>&& __t) | 718 | tuple(const tuple<_Up...>&& __t) |
| 748 | : __base_(__from_tuple(), std::move(__t)) {} | 719 | : __base_(__from_tuple(), std::move(__t)) {} |
| 749 | 720 | ||
| 750 | template <class _Alloc, | 721 | template <class _Alloc, |
| 751 | class... _Up, | 722 | class... _Up, |
| 752 | enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr> | 723 | enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr> |
| 753 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value) | 724 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_And<is_convertible<const _Up&&, _Tp>...>::value) |
| 754 | tuple(allocator_arg_t, const _Alloc& __alloc, const tuple<_Up...>&& __t) | 725 | tuple(allocator_arg_t, const _Alloc& __alloc, const tuple<_Up...>&& __t) |
| 755 | : __base_(allocator_arg_t(), __alloc, __from_tuple(), std::move(__t)) {} | 726 | : __base_(allocator_arg_t(), __alloc, __from_tuple(), std::move(__t)) {} |
| 756 | # endif // _LIBCPP_STD_VER >= 23 | 727 | # endif // _LIBCPP_STD_VER >= 23 |
| ... | @@ -1011,20 +982,37 @@ public: | ... | @@ -1011,20 +982,37 @@ public: |
| 1011 | __base_.swap(__t.__base_); | 982 | __base_.swap(__t.__base_); |
| 1012 | } | 983 | } |
| 1013 | 984 | ||
| 985 | template <class _Tuple> | ||
| 986 | static constexpr bool __can_compare_equal = false; | ||
| 987 | |||
| 988 | template <class... _Up> | ||
| 989 | static constexpr bool __can_compare_equal<tuple<_Up...>> = __all<requires(const _Tp& __t, const _Up& __u) { | ||
| 990 | { __t == __u } -> __boolean_testable; | ||
| 991 | }...>::value; | ||
| 992 | |||
| 1014 | template <__tuple_like_no_tuple _UTuple> | 993 | template <__tuple_like_no_tuple _UTuple> |
| 1015 | # if _LIBCPP_STD_VER >= 26 | 994 | # if _LIBCPP_STD_VER >= 26 |
| 1016 | requires __can_tuple_compare_equal<tuple, _UTuple> && (sizeof...(_Tp) == tuple_size_v<_UTuple>) | 995 | requires(sizeof...(_Tp) == tuple_size_v<_UTuple>) && __can_compare_equal<__to_tuple_t<_UTuple>> |
| 1017 | # endif // _LIBCPP_STD_VER >= 26 | 996 | # endif // _LIBCPP_STD_VER >= 26 |
| 1018 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const tuple& __x, const _UTuple& __y) { | 997 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const tuple& __x, const _UTuple& __y) { |
| 1019 | static_assert(sizeof...(_Tp) == tuple_size_v<_UTuple>, "Can't compare tuple-like values of different sizes"); | 998 | static_assert(sizeof...(_Tp) == tuple_size_v<_UTuple>, "Can't compare tuple-like values of different sizes"); |
| 1020 | return std::__tuple_compare_equal<sizeof...(_Tp)>(__x, __y); | 999 | return std::__tuple_compare_equal<sizeof...(_Tp)>(__x, __y); |
| 1021 | } | 1000 | } |
| 1022 | 1001 | ||
| 1002 | template <class _Tuple> | ||
| 1003 | struct __common_comparison_category_with; | ||
| 1004 | |||
| 1005 | template <class... _Up> | ||
| 1006 | requires requires { typename common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...>; } | ||
| 1007 | struct __common_comparison_category_with<tuple<_Up...>> { | ||
| 1008 | using type _LIBCPP_NODEBUG = common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...>; | ||
| 1009 | }; | ||
| 1010 | |||
| 1023 | template <__tuple_like_no_tuple _UTuple> | 1011 | template <__tuple_like_no_tuple _UTuple> |
| 1024 | requires(sizeof...(_Tp) == tuple_size_v<_UTuple>) | 1012 | requires(sizeof...(_Tp) == tuple_size_v<_UTuple>) |
| 1025 | _LIBCPP_HIDE_FROM_ABI friend constexpr __tuple_common_comparison_category<tuple, _UTuple> | 1013 | _LIBCPP_HIDE_FROM_ABI friend constexpr typename __common_comparison_category_with<__to_tuple_t<_UTuple>>::type |
| 1026 | operator<=>(const tuple& __x, const _UTuple& __y) { | 1014 | operator<=>(const tuple& __x, const _UTuple& __y) { |
| 1027 | return std::__tuple_compare_three_way<__tuple_common_comparison_category<tuple, _UTuple>>( | 1015 | return std::__tuple_compare_three_way<typename __common_comparison_category_with<__to_tuple_t<_UTuple>>::type>( |
| 1028 | __x, __y, index_sequence_for<_Tp...>{}); | 1016 | __x, __y, index_sequence_for<_Tp...>{}); |
| 1029 | } | 1017 | } |
| 1030 | # endif // _LIBCPP_STD_VER >= 23 | 1018 | # endif // _LIBCPP_STD_VER >= 23 |
| ... | @@ -1455,15 +1443,15 @@ template <class _Tp, class _Tuple, class = enable_if_t<__can_make_from_tuple<_Tp | ... | @@ -1455,15 +1443,15 @@ template <class _Tp, class _Tuple, class = enable_if_t<__can_make_from_tuple<_Tp |
| 1455 | 1443 | ||
| 1456 | # endif // _LIBCPP_STD_VER >= 17 | 1444 | # endif // _LIBCPP_STD_VER >= 17 |
| 1457 | 1445 | ||
| 1458 | #endif // !defined(_LIBCPP_CXX03_LANG) | ||
| 1459 | |||
| 1460 | _LIBCPP_END_NAMESPACE_STD | 1446 | _LIBCPP_END_NAMESPACE_STD |
| 1461 | 1447 | ||
| 1448 | #endif // !defined(_LIBCPP_CXX03_LANG) | ||
| 1449 | |||
| 1462 | _LIBCPP_POP_MACROS | 1450 | _LIBCPP_POP_MACROS |
| 1463 | 1451 | ||
| 1464 | // clang-format on | 1452 | // clang-format on |
| 1465 | 1453 | ||
| 1466 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1454 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1467 | # include <cstddef> | 1455 | # include <cstddef> |
| 1468 | # include <exception> | 1456 | # include <exception> |
| 1469 | # include <iosfwd> | 1457 | # include <iosfwd> |
lib/libcxx/include/typeindex+1-1| ... | @@ -102,7 +102,7 @@ struct hash<type_index> : public __unary_function<type_index, size_t> { | ... | @@ -102,7 +102,7 @@ struct hash<type_index> : public __unary_function<type_index, size_t> { |
| 102 | 102 | ||
| 103 | _LIBCPP_END_NAMESPACE_STD | 103 | _LIBCPP_END_NAMESPACE_STD |
| 104 | 104 | ||
| 105 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 105 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 106 | # include <cstddef> | 106 | # include <cstddef> |
| 107 | # include <iosfwd> | 107 | # include <iosfwd> |
| 108 | # include <new> | 108 | # include <new> |
lib/libcxx/include/typeinfo+2-2| ... | @@ -302,7 +302,7 @@ class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_TYPE_INFO_VTABLE_POINTER_AUTH type_info | ... | @@ -302,7 +302,7 @@ class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_TYPE_INFO_VTABLE_POINTER_AUTH type_info |
| 302 | protected: | 302 | protected: |
| 303 | typedef __type_info_implementations::__impl __impl; | 303 | typedef __type_info_implementations::__impl __impl; |
| 304 | 304 | ||
| 305 | __impl::__type_name_t __type_name; | 305 | _LIBCPP_DISABLE_POINTER_FIELD_PROTECTION __impl::__type_name_t __type_name; |
| 306 | 306 | ||
| 307 | _LIBCPP_HIDE_FROM_ABI explicit type_info(const char* __n) : __type_name(__impl::__string_to_type_name(__n)) {} | 307 | _LIBCPP_HIDE_FROM_ABI explicit type_info(const char* __n) : __type_name(__impl::__string_to_type_name(__n)) {} |
| 308 | 308 | ||
| ... | @@ -389,7 +389,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -389,7 +389,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 389 | } | 389 | } |
| 390 | _LIBCPP_END_NAMESPACE_STD | 390 | _LIBCPP_END_NAMESPACE_STD |
| 391 | 391 | ||
| 392 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 392 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 393 | # include <cstddef> | 393 | # include <cstddef> |
| 394 | # include <cstdlib> | 394 | # include <cstdlib> |
| 395 | # include <type_traits> | 395 | # include <type_traits> |
lib/libcxx/include/unordered_map+67-31| ... | @@ -77,16 +77,16 @@ public: | ... | @@ -77,16 +77,16 @@ public: |
| 77 | const hasher& hf = hasher(), const key_equal& eql = key_equal(), | 77 | const hasher& hf = hasher(), const key_equal& eql = key_equal(), |
| 78 | const allocator_type& a = allocator_type()); | 78 | const allocator_type& a = allocator_type()); |
| 79 | unordered_map(size_type n, const allocator_type& a) | 79 | unordered_map(size_type n, const allocator_type& a) |
| 80 | : unordered_map(n, hasher(), key_equal(), a) {} // C++14 | 80 | : unordered_map(n, hasher(), key_equal(), a) {} |
| 81 | unordered_map(size_type n, const hasher& hf, const allocator_type& a) | 81 | unordered_map(size_type n, const hasher& hf, const allocator_type& a) |
| 82 | : unordered_map(n, hf, key_equal(), a) {} // C++14 | 82 | : unordered_map(n, hf, key_equal(), a) {} |
| 83 | template <class InputIterator> | 83 | template <class InputIterator> |
| 84 | unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a) | 84 | unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a) |
| 85 | : unordered_map(f, l, n, hasher(), key_equal(), a) {} // C++14 | 85 | : unordered_map(f, l, n, hasher(), key_equal(), a) {} |
| 86 | template <class InputIterator> | 86 | template <class InputIterator> |
| 87 | unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf, | 87 | unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf, |
| 88 | const allocator_type& a) | 88 | const allocator_type& a) |
| 89 | : unordered_map(f, l, n, hf, key_equal(), a) {} // C++14 | 89 | : unordered_map(f, l, n, hf, key_equal(), a) {} |
| 90 | template<container-compatible-range<value_type> R> | 90 | template<container-compatible-range<value_type> R> |
| 91 | unordered_map(from_range_t, R&& rg, size_type n, const allocator_type& a) | 91 | unordered_map(from_range_t, R&& rg, size_type n, const allocator_type& a) |
| 92 | : unordered_map(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23 | 92 | : unordered_map(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23 |
| ... | @@ -94,10 +94,10 @@ public: | ... | @@ -94,10 +94,10 @@ public: |
| 94 | unordered_map(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a) | 94 | unordered_map(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a) |
| 95 | : unordered_map(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23 | 95 | : unordered_map(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23 |
| 96 | unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a) | 96 | unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a) |
| 97 | : unordered_map(il, n, hasher(), key_equal(), a) {} // C++14 | 97 | : unordered_map(il, n, hasher(), key_equal(), a) {} |
| 98 | unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf, | 98 | unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf, |
| 99 | const allocator_type& a) | 99 | const allocator_type& a) |
| 100 | : unordered_map(il, n, hf, key_equal(), a) {} // C++14 | 100 | : unordered_map(il, n, hf, key_equal(), a) {} |
| 101 | ~unordered_map(); | 101 | ~unordered_map(); |
| 102 | unordered_map& operator=(const unordered_map&); | 102 | unordered_map& operator=(const unordered_map&); |
| 103 | unordered_map& operator=(unordered_map&&) | 103 | unordered_map& operator=(unordered_map&&) |
| ... | @@ -363,16 +363,16 @@ public: | ... | @@ -363,16 +363,16 @@ public: |
| 363 | const hasher& hf = hasher(), const key_equal& eql = key_equal(), | 363 | const hasher& hf = hasher(), const key_equal& eql = key_equal(), |
| 364 | const allocator_type& a = allocator_type()); | 364 | const allocator_type& a = allocator_type()); |
| 365 | unordered_multimap(size_type n, const allocator_type& a) | 365 | unordered_multimap(size_type n, const allocator_type& a) |
| 366 | : unordered_multimap(n, hasher(), key_equal(), a) {} // C++14 | 366 | : unordered_multimap(n, hasher(), key_equal(), a) {} |
| 367 | unordered_multimap(size_type n, const hasher& hf, const allocator_type& a) | 367 | unordered_multimap(size_type n, const hasher& hf, const allocator_type& a) |
| 368 | : unordered_multimap(n, hf, key_equal(), a) {} // C++14 | 368 | : unordered_multimap(n, hf, key_equal(), a) {} |
| 369 | template <class InputIterator> | 369 | template <class InputIterator> |
| 370 | unordered_multimap(InputIterator f, InputIterator l, size_type n, const allocator_type& a) | 370 | unordered_multimap(InputIterator f, InputIterator l, size_type n, const allocator_type& a) |
| 371 | : unordered_multimap(f, l, n, hasher(), key_equal(), a) {} // C++14 | 371 | : unordered_multimap(f, l, n, hasher(), key_equal(), a) {} |
| 372 | template <class InputIterator> | 372 | template <class InputIterator> |
| 373 | unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf, | 373 | unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf, |
| 374 | const allocator_type& a) | 374 | const allocator_type& a) |
| 375 | : unordered_multimap(f, l, n, hf, key_equal(), a) {} // C++14 | 375 | : unordered_multimap(f, l, n, hf, key_equal(), a) {} |
| 376 | template<container-compatible-range<value_type> R> | 376 | template<container-compatible-range<value_type> R> |
| 377 | unordered_multimap(from_range_t, R&& rg, size_type n, const allocator_type& a) | 377 | unordered_multimap(from_range_t, R&& rg, size_type n, const allocator_type& a) |
| 378 | : unordered_multimap(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23 | 378 | : unordered_multimap(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23 |
| ... | @@ -380,10 +380,10 @@ public: | ... | @@ -380,10 +380,10 @@ public: |
| 380 | unordered_multimap(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a) | 380 | unordered_multimap(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a) |
| 381 | : unordered_multimap(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23 | 381 | : unordered_multimap(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23 |
| 382 | unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a) | 382 | unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a) |
| 383 | : unordered_multimap(il, n, hasher(), key_equal(), a) {} // C++14 | 383 | : unordered_multimap(il, n, hasher(), key_equal(), a) {} |
| 384 | unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf, | 384 | unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf, |
| 385 | const allocator_type& a) | 385 | const allocator_type& a) |
| 386 | : unordered_multimap(il, n, hf, key_equal(), a) {} // C++14 | 386 | : unordered_multimap(il, n, hf, key_equal(), a) {} |
| 387 | ~unordered_multimap(); | 387 | ~unordered_multimap(); |
| 388 | unordered_multimap& operator=(const unordered_multimap&); | 388 | unordered_multimap& operator=(const unordered_multimap&); |
| 389 | unordered_multimap& operator=(unordered_multimap&&) | 389 | unordered_multimap& operator=(unordered_multimap&&) |
| ... | @@ -993,7 +993,6 @@ public: | ... | @@ -993,7 +993,6 @@ public: |
| 993 | const key_equal& __eql, | 993 | const key_equal& __eql, |
| 994 | const allocator_type& __a); | 994 | const allocator_type& __a); |
| 995 | # endif // _LIBCPP_CXX03_LANG | 995 | # endif // _LIBCPP_CXX03_LANG |
| 996 | # if _LIBCPP_STD_VER >= 14 | ||
| 997 | _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const allocator_type& __a) | 996 | _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const allocator_type& __a) |
| 998 | : unordered_map(__n, hasher(), key_equal(), __a) {} | 997 | : unordered_map(__n, hasher(), key_equal(), __a) {} |
| 999 | _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a) | 998 | _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a) |
| ... | @@ -1007,7 +1006,7 @@ public: | ... | @@ -1007,7 +1006,7 @@ public: |
| 1007 | _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) | 1006 | _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) |
| 1008 | : unordered_map(__first, __last, __n, __hf, key_equal(), __a) {} | 1007 | : unordered_map(__first, __last, __n, __hf, key_equal(), __a) {} |
| 1009 | 1008 | ||
| 1010 | # if _LIBCPP_STD_VER >= 23 | 1009 | # if _LIBCPP_STD_VER >= 23 |
| 1011 | template <_ContainerCompatibleRange<value_type> _Range> | 1010 | template <_ContainerCompatibleRange<value_type> _Range> |
| 1012 | _LIBCPP_HIDE_FROM_ABI unordered_map(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a) | 1011 | _LIBCPP_HIDE_FROM_ABI unordered_map(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a) |
| 1013 | : unordered_map(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {} | 1012 | : unordered_map(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {} |
| ... | @@ -1016,8 +1015,9 @@ public: | ... | @@ -1016,8 +1015,9 @@ public: |
| 1016 | _LIBCPP_HIDE_FROM_ABI | 1015 | _LIBCPP_HIDE_FROM_ABI |
| 1017 | unordered_map(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a) | 1016 | unordered_map(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a) |
| 1018 | : unordered_map(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {} | 1017 | : unordered_map(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {} |
| 1019 | # endif | 1018 | # endif |
| 1020 | 1019 | ||
| 1020 | # ifndef _LIBCPP_CXX03_LANG | ||
| 1021 | _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) | 1021 | _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) |
| 1022 | : unordered_map(__il, __n, hasher(), key_equal(), __a) {} | 1022 | : unordered_map(__il, __n, hasher(), key_equal(), __a) {} |
| 1023 | _LIBCPP_HIDE_FROM_ABI | 1023 | _LIBCPP_HIDE_FROM_ABI |
| ... | @@ -1216,11 +1216,17 @@ public: | ... | @@ -1216,11 +1216,17 @@ public: |
| 1216 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } | 1216 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } |
| 1217 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } | 1217 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } |
| 1218 | # if _LIBCPP_STD_VER >= 20 | 1218 | # if _LIBCPP_STD_VER >= 20 |
| 1219 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1219 | template <class _K2, |
| 1220 | class _Hasher = hasher, | ||
| 1221 | class _Comp = key_equal, | ||
| 1222 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1220 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { | 1223 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { |
| 1221 | return __table_.find(__k); | 1224 | return __table_.find(__k); |
| 1222 | } | 1225 | } |
| 1223 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1226 | template <class _K2, |
| 1227 | class _Hasher = hasher, | ||
| 1228 | class _Comp = key_equal, | ||
| 1229 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1224 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { | 1230 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { |
| 1225 | return __table_.find(__k); | 1231 | return __table_.find(__k); |
| 1226 | } | 1232 | } |
| ... | @@ -1230,7 +1236,10 @@ public: | ... | @@ -1230,7 +1236,10 @@ public: |
| 1230 | return __table_.__count_unique(__k); | 1236 | return __table_.__count_unique(__k); |
| 1231 | } | 1237 | } |
| 1232 | # if _LIBCPP_STD_VER >= 20 | 1238 | # if _LIBCPP_STD_VER >= 20 |
| 1233 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1239 | template <class _K2, |
| 1240 | class _Hasher = hasher, | ||
| 1241 | class _Comp = key_equal, | ||
| 1242 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1234 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { | 1243 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { |
| 1235 | return __table_.__count_unique(__k); | 1244 | return __table_.__count_unique(__k); |
| 1236 | } | 1245 | } |
| ... | @@ -1239,7 +1248,10 @@ public: | ... | @@ -1239,7 +1248,10 @@ public: |
| 1239 | # if _LIBCPP_STD_VER >= 20 | 1248 | # if _LIBCPP_STD_VER >= 20 |
| 1240 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } | 1249 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } |
| 1241 | 1250 | ||
| 1242 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1251 | template <class _K2, |
| 1252 | class _Hasher = hasher, | ||
| 1253 | class _Comp = key_equal, | ||
| 1254 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1243 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { | 1255 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { |
| 1244 | return find(__k) != end(); | 1256 | return find(__k) != end(); |
| 1245 | } | 1257 | } |
| ... | @@ -1252,11 +1264,17 @@ public: | ... | @@ -1252,11 +1264,17 @@ public: |
| 1252 | return __table_.__equal_range_unique(__k); | 1264 | return __table_.__equal_range_unique(__k); |
| 1253 | } | 1265 | } |
| 1254 | # if _LIBCPP_STD_VER >= 20 | 1266 | # if _LIBCPP_STD_VER >= 20 |
| 1255 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1267 | template <class _K2, |
| 1268 | class _Hasher = hasher, | ||
| 1269 | class _Comp = key_equal, | ||
| 1270 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1256 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { | 1271 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { |
| 1257 | return __table_.__equal_range_unique(__k); | 1272 | return __table_.__equal_range_unique(__k); |
| 1258 | } | 1273 | } |
| 1259 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1274 | template <class _K2, |
| 1275 | class _Hasher = hasher, | ||
| 1276 | class _Comp = key_equal, | ||
| 1277 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1260 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { | 1278 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { |
| 1261 | return __table_.__equal_range_unique(__k); | 1279 | return __table_.__equal_range_unique(__k); |
| 1262 | } | 1280 | } |
| ... | @@ -1769,7 +1787,6 @@ public: | ... | @@ -1769,7 +1787,6 @@ public: |
| 1769 | const key_equal& __eql, | 1787 | const key_equal& __eql, |
| 1770 | const allocator_type& __a); | 1788 | const allocator_type& __a); |
| 1771 | # endif // _LIBCPP_CXX03_LANG | 1789 | # endif // _LIBCPP_CXX03_LANG |
| 1772 | # if _LIBCPP_STD_VER >= 14 | ||
| 1773 | _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const allocator_type& __a) | 1790 | _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const allocator_type& __a) |
| 1774 | : unordered_multimap(__n, hasher(), key_equal(), __a) {} | 1791 | : unordered_multimap(__n, hasher(), key_equal(), __a) {} |
| 1775 | _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a) | 1792 | _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a) |
| ... | @@ -1783,7 +1800,7 @@ public: | ... | @@ -1783,7 +1800,7 @@ public: |
| 1783 | _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) | 1800 | _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) |
| 1784 | : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {} | 1801 | : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {} |
| 1785 | 1802 | ||
| 1786 | # if _LIBCPP_STD_VER >= 23 | 1803 | # if _LIBCPP_STD_VER >= 23 |
| 1787 | template <_ContainerCompatibleRange<value_type> _Range> | 1804 | template <_ContainerCompatibleRange<value_type> _Range> |
| 1788 | _LIBCPP_HIDE_FROM_ABI unordered_multimap(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a) | 1805 | _LIBCPP_HIDE_FROM_ABI unordered_multimap(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a) |
| 1789 | : unordered_multimap(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {} | 1806 | : unordered_multimap(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {} |
| ... | @@ -1792,8 +1809,9 @@ public: | ... | @@ -1792,8 +1809,9 @@ public: |
| 1792 | _LIBCPP_HIDE_FROM_ABI | 1809 | _LIBCPP_HIDE_FROM_ABI |
| 1793 | unordered_multimap(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a) | 1810 | unordered_multimap(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a) |
| 1794 | : unordered_multimap(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {} | 1811 | : unordered_multimap(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {} |
| 1795 | # endif | 1812 | # endif |
| 1796 | 1813 | ||
| 1814 | # ifndef _LIBCPP_CXX03_LANG | ||
| 1797 | _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) | 1815 | _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) |
| 1798 | : unordered_multimap(__il, __n, hasher(), key_equal(), __a) {} | 1816 | : unordered_multimap(__il, __n, hasher(), key_equal(), __a) {} |
| 1799 | _LIBCPP_HIDE_FROM_ABI | 1817 | _LIBCPP_HIDE_FROM_ABI |
| ... | @@ -1936,11 +1954,17 @@ public: | ... | @@ -1936,11 +1954,17 @@ public: |
| 1936 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } | 1954 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } |
| 1937 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } | 1955 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } |
| 1938 | # if _LIBCPP_STD_VER >= 20 | 1956 | # if _LIBCPP_STD_VER >= 20 |
| 1939 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1957 | template <class _K2, |
| 1958 | class _Hasher = hasher, | ||
| 1959 | class _Comp = key_equal, | ||
| 1960 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1940 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { | 1961 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { |
| 1941 | return __table_.find(__k); | 1962 | return __table_.find(__k); |
| 1942 | } | 1963 | } |
| 1943 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1964 | template <class _K2, |
| 1965 | class _Hasher = hasher, | ||
| 1966 | class _Comp = key_equal, | ||
| 1967 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1944 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { | 1968 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { |
| 1945 | return __table_.find(__k); | 1969 | return __table_.find(__k); |
| 1946 | } | 1970 | } |
| ... | @@ -1950,7 +1974,10 @@ public: | ... | @@ -1950,7 +1974,10 @@ public: |
| 1950 | return __table_.__count_multi(__k); | 1974 | return __table_.__count_multi(__k); |
| 1951 | } | 1975 | } |
| 1952 | # if _LIBCPP_STD_VER >= 20 | 1976 | # if _LIBCPP_STD_VER >= 20 |
| 1953 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1977 | template <class _K2, |
| 1978 | class _Hasher = hasher, | ||
| 1979 | class _Comp = key_equal, | ||
| 1980 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1954 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { | 1981 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { |
| 1955 | return __table_.__count_multi(__k); | 1982 | return __table_.__count_multi(__k); |
| 1956 | } | 1983 | } |
| ... | @@ -1959,7 +1986,10 @@ public: | ... | @@ -1959,7 +1986,10 @@ public: |
| 1959 | # if _LIBCPP_STD_VER >= 20 | 1986 | # if _LIBCPP_STD_VER >= 20 |
| 1960 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } | 1987 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } |
| 1961 | 1988 | ||
| 1962 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1989 | template <class _K2, |
| 1990 | class _Hasher = hasher, | ||
| 1991 | class _Comp = key_equal, | ||
| 1992 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1963 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { | 1993 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { |
| 1964 | return find(__k) != end(); | 1994 | return find(__k) != end(); |
| 1965 | } | 1995 | } |
| ... | @@ -1972,11 +2002,17 @@ public: | ... | @@ -1972,11 +2002,17 @@ public: |
| 1972 | return __table_.__equal_range_multi(__k); | 2002 | return __table_.__equal_range_multi(__k); |
| 1973 | } | 2003 | } |
| 1974 | # if _LIBCPP_STD_VER >= 20 | 2004 | # if _LIBCPP_STD_VER >= 20 |
| 1975 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 2005 | template <class _K2, |
| 2006 | class _Hasher = hasher, | ||
| 2007 | class _Comp = key_equal, | ||
| 2008 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1976 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { | 2009 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { |
| 1977 | return __table_.__equal_range_multi(__k); | 2010 | return __table_.__equal_range_multi(__k); |
| 1978 | } | 2011 | } |
| 1979 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 2012 | template <class _K2, |
| 2013 | class _Hasher = hasher, | ||
| 2014 | class _Comp = key_equal, | ||
| 2015 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1980 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { | 2016 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { |
| 1981 | return __table_.__equal_range_multi(__k); | 2017 | return __table_.__equal_range_multi(__k); |
| 1982 | } | 2018 | } |
| ... | @@ -2345,7 +2381,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -2345,7 +2381,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 2345 | 2381 | ||
| 2346 | _LIBCPP_POP_MACROS | 2382 | _LIBCPP_POP_MACROS |
| 2347 | 2383 | ||
| 2348 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 2384 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 2349 | # include <algorithm> | 2385 | # include <algorithm> |
| 2350 | # include <bit> | 2386 | # include <bit> |
| 2351 | # include <cmath> | 2387 | # include <cmath> |
lib/libcxx/include/unordered_set+61-37| ... | @@ -76,22 +76,22 @@ public: | ... | @@ -76,22 +76,22 @@ public: |
| 76 | unordered_set(initializer_list<value_type>, size_type n = 0, | 76 | unordered_set(initializer_list<value_type>, size_type n = 0, |
| 77 | const hasher& hf = hasher(), const key_equal& eql = key_equal(), | 77 | const hasher& hf = hasher(), const key_equal& eql = key_equal(), |
| 78 | const allocator_type& a = allocator_type()); | 78 | const allocator_type& a = allocator_type()); |
| 79 | unordered_set(size_type n, const allocator_type& a); // C++14 | 79 | unordered_set(size_type n, const allocator_type& a); |
| 80 | unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++14 | 80 | unordered_set(size_type n, const hasher& hf, const allocator_type& a); |
| 81 | template <class InputIterator> | 81 | template <class InputIterator> |
| 82 | unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14 | 82 | unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); |
| 83 | template <class InputIterator> | 83 | template <class InputIterator> |
| 84 | unordered_set(InputIterator f, InputIterator l, size_type n, | 84 | unordered_set(InputIterator f, InputIterator l, size_type n, |
| 85 | const hasher& hf, const allocator_type& a); // C++14 | 85 | const hasher& hf, const allocator_type& a); |
| 86 | template<container-compatible-range<value_type> R> | 86 | template<container-compatible-range<value_type> R> |
| 87 | unordered_set(from_range_t, R&& rg, size_type n, const allocator_type& a) | 87 | unordered_set(from_range_t, R&& rg, size_type n, const allocator_type& a) |
| 88 | : unordered_set(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23 | 88 | : unordered_set(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23 |
| 89 | template<container-compatible-range<value_type> R> | 89 | template<container-compatible-range<value_type> R> |
| 90 | unordered_set(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a) | 90 | unordered_set(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a) |
| 91 | : unordered_set(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23 | 91 | : unordered_set(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23 |
| 92 | unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14 | 92 | unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); |
| 93 | unordered_set(initializer_list<value_type> il, size_type n, | 93 | unordered_set(initializer_list<value_type> il, size_type n, |
| 94 | const hasher& hf, const allocator_type& a); // C++14 | 94 | const hasher& hf, const allocator_type& a); |
| 95 | ~unordered_set(); | 95 | ~unordered_set(); |
| 96 | unordered_set& operator=(const unordered_set&); | 96 | unordered_set& operator=(const unordered_set&); |
| 97 | unordered_set& operator=(unordered_set&&) | 97 | unordered_set& operator=(unordered_set&&) |
| ... | @@ -324,22 +324,22 @@ public: | ... | @@ -324,22 +324,22 @@ public: |
| 324 | unordered_multiset(initializer_list<value_type>, size_type n = /see below/, | 324 | unordered_multiset(initializer_list<value_type>, size_type n = /see below/, |
| 325 | const hasher& hf = hasher(), const key_equal& eql = key_equal(), | 325 | const hasher& hf = hasher(), const key_equal& eql = key_equal(), |
| 326 | const allocator_type& a = allocator_type()); | 326 | const allocator_type& a = allocator_type()); |
| 327 | unordered_multiset(size_type n, const allocator_type& a); // C++14 | 327 | unordered_multiset(size_type n, const allocator_type& a); |
| 328 | unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14 | 328 | unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); |
| 329 | template <class InputIterator> | 329 | template <class InputIterator> |
| 330 | unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14 | 330 | unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); |
| 331 | template <class InputIterator> | 331 | template <class InputIterator> |
| 332 | unordered_multiset(InputIterator f, InputIterator l, size_type n, | 332 | unordered_multiset(InputIterator f, InputIterator l, size_type n, |
| 333 | const hasher& hf, const allocator_type& a); // C++14 | 333 | const hasher& hf, const allocator_type& a); |
| 334 | template<container-compatible-range<value_type> R> | 334 | template<container-compatible-range<value_type> R> |
| 335 | unordered_multiset(from_range_t, R&& rg, size_type n, const allocator_type& a) | 335 | unordered_multiset(from_range_t, R&& rg, size_type n, const allocator_type& a) |
| 336 | : unordered_multiset(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23 | 336 | : unordered_multiset(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23 |
| 337 | template<container-compatible-range<value_type> R> | 337 | template<container-compatible-range<value_type> R> |
| 338 | unordered_multiset(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a) | 338 | unordered_multiset(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a) |
| 339 | : unordered_multiset(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23 | 339 | : unordered_multiset(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23 |
| 340 | unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14 | 340 | unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); |
| 341 | unordered_multiset(initializer_list<value_type> il, size_type n, | 341 | unordered_multiset(initializer_list<value_type> il, size_type n, |
| 342 | const hasher& hf, const allocator_type& a); // C++14 | 342 | const hasher& hf, const allocator_type& a); |
| 343 | ~unordered_multiset(); | 343 | ~unordered_multiset(); |
| 344 | unordered_multiset& operator=(const unordered_multiset&); | 344 | unordered_multiset& operator=(const unordered_multiset&); |
| 345 | unordered_multiset& operator=(unordered_multiset&&) | 345 | unordered_multiset& operator=(unordered_multiset&&) |
| ... | @@ -634,12 +634,10 @@ public: | ... | @@ -634,12 +634,10 @@ public: |
| 634 | _LIBCPP_HIDE_FROM_ABI unordered_set() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) {} | 634 | _LIBCPP_HIDE_FROM_ABI unordered_set() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) {} |
| 635 | explicit _LIBCPP_HIDE_FROM_ABI | 635 | explicit _LIBCPP_HIDE_FROM_ABI |
| 636 | unordered_set(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); | 636 | unordered_set(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); |
| 637 | # if _LIBCPP_STD_VER >= 14 | ||
| 638 | inline _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const allocator_type& __a) | 637 | inline _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const allocator_type& __a) |
| 639 | : unordered_set(__n, hasher(), key_equal(), __a) {} | 638 | : unordered_set(__n, hasher(), key_equal(), __a) {} |
| 640 | inline _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a) | 639 | inline _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a) |
| 641 | : unordered_set(__n, __hf, key_equal(), __a) {} | 640 | : unordered_set(__n, __hf, key_equal(), __a) {} |
| 642 | # endif | ||
| 643 | _LIBCPP_HIDE_FROM_ABI | 641 | _LIBCPP_HIDE_FROM_ABI |
| 644 | unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); | 642 | unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); |
| 645 | template <class _InputIterator> | 643 | template <class _InputIterator> |
| ... | @@ -677,7 +675,6 @@ public: | ... | @@ -677,7 +675,6 @@ public: |
| 677 | } | 675 | } |
| 678 | # endif | 676 | # endif |
| 679 | 677 | ||
| 680 | # if _LIBCPP_STD_VER >= 14 | ||
| 681 | template <class _InputIterator> | 678 | template <class _InputIterator> |
| 682 | inline _LIBCPP_HIDE_FROM_ABI | 679 | inline _LIBCPP_HIDE_FROM_ABI |
| 683 | unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) | 680 | unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) |
| ... | @@ -686,7 +683,6 @@ public: | ... | @@ -686,7 +683,6 @@ public: |
| 686 | _LIBCPP_HIDE_FROM_ABI unordered_set( | 683 | _LIBCPP_HIDE_FROM_ABI unordered_set( |
| 687 | _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) | 684 | _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) |
| 688 | : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {} | 685 | : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {} |
| 689 | # endif | ||
| 690 | 686 | ||
| 691 | # if _LIBCPP_STD_VER >= 23 | 687 | # if _LIBCPP_STD_VER >= 23 |
| 692 | template <_ContainerCompatibleRange<value_type> _Range> | 688 | template <_ContainerCompatibleRange<value_type> _Range> |
| ... | @@ -717,14 +713,12 @@ public: | ... | @@ -717,14 +713,12 @@ public: |
| 717 | const hasher& __hf, | 713 | const hasher& __hf, |
| 718 | const key_equal& __eql, | 714 | const key_equal& __eql, |
| 719 | const allocator_type& __a); | 715 | const allocator_type& __a); |
| 720 | # if _LIBCPP_STD_VER >= 14 | ||
| 721 | inline _LIBCPP_HIDE_FROM_ABI | 716 | inline _LIBCPP_HIDE_FROM_ABI |
| 722 | unordered_set(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) | 717 | unordered_set(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) |
| 723 | : unordered_set(__il, __n, hasher(), key_equal(), __a) {} | 718 | : unordered_set(__il, __n, hasher(), key_equal(), __a) {} |
| 724 | inline _LIBCPP_HIDE_FROM_ABI | 719 | inline _LIBCPP_HIDE_FROM_ABI |
| 725 | unordered_set(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) | 720 | unordered_set(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) |
| 726 | : unordered_set(__il, __n, __hf, key_equal(), __a) {} | 721 | : unordered_set(__il, __n, __hf, key_equal(), __a) {} |
| 727 | # endif | ||
| 728 | # endif // _LIBCPP_CXX03_LANG | 722 | # endif // _LIBCPP_CXX03_LANG |
| 729 | _LIBCPP_HIDE_FROM_ABI ~unordered_set() { | 723 | _LIBCPP_HIDE_FROM_ABI ~unordered_set() { |
| 730 | static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); | 724 | static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); |
| ... | @@ -844,11 +838,17 @@ public: | ... | @@ -844,11 +838,17 @@ public: |
| 844 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } | 838 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } |
| 845 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } | 839 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } |
| 846 | # if _LIBCPP_STD_VER >= 20 | 840 | # if _LIBCPP_STD_VER >= 20 |
| 847 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 841 | template <class _K2, |
| 842 | class _Hasher = hasher, | ||
| 843 | class _Comp = key_equal, | ||
| 844 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 848 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { | 845 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { |
| 849 | return __table_.find(__k); | 846 | return __table_.find(__k); |
| 850 | } | 847 | } |
| 851 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 848 | template <class _K2, |
| 849 | class _Hasher = hasher, | ||
| 850 | class _Comp = key_equal, | ||
| 851 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 852 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { | 852 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { |
| 853 | return __table_.find(__k); | 853 | return __table_.find(__k); |
| 854 | } | 854 | } |
| ... | @@ -858,7 +858,10 @@ public: | ... | @@ -858,7 +858,10 @@ public: |
| 858 | return __table_.__count_unique(__k); | 858 | return __table_.__count_unique(__k); |
| 859 | } | 859 | } |
| 860 | # if _LIBCPP_STD_VER >= 20 | 860 | # if _LIBCPP_STD_VER >= 20 |
| 861 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 861 | template <class _K2, |
| 862 | class _Hasher = hasher, | ||
| 863 | class _Comp = key_equal, | ||
| 864 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 862 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { | 865 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { |
| 863 | return __table_.__count_unique(__k); | 866 | return __table_.__count_unique(__k); |
| 864 | } | 867 | } |
| ... | @@ -867,7 +870,10 @@ public: | ... | @@ -867,7 +870,10 @@ public: |
| 867 | # if _LIBCPP_STD_VER >= 20 | 870 | # if _LIBCPP_STD_VER >= 20 |
| 868 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } | 871 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } |
| 869 | 872 | ||
| 870 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 873 | template <class _K2, |
| 874 | class _Hasher = hasher, | ||
| 875 | class _Comp = key_equal, | ||
| 876 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 871 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { | 877 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { |
| 872 | return find(__k) != end(); | 878 | return find(__k) != end(); |
| 873 | } | 879 | } |
| ... | @@ -880,11 +886,17 @@ public: | ... | @@ -880,11 +886,17 @@ public: |
| 880 | return __table_.__equal_range_unique(__k); | 886 | return __table_.__equal_range_unique(__k); |
| 881 | } | 887 | } |
| 882 | # if _LIBCPP_STD_VER >= 20 | 888 | # if _LIBCPP_STD_VER >= 20 |
| 883 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 889 | template <class _K2, |
| 890 | class _Hasher = hasher, | ||
| 891 | class _Comp = key_equal, | ||
| 892 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 884 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { | 893 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { |
| 885 | return __table_.__equal_range_unique(__k); | 894 | return __table_.__equal_range_unique(__k); |
| 886 | } | 895 | } |
| 887 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 896 | template <class _K2, |
| 897 | class _Hasher = hasher, | ||
| 898 | class _Comp = key_equal, | ||
| 899 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 888 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { | 900 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { |
| 889 | return __table_.__equal_range_unique(__k); | 901 | return __table_.__equal_range_unique(__k); |
| 890 | } | 902 | } |
| ... | @@ -1232,12 +1244,10 @@ public: | ... | @@ -1232,12 +1244,10 @@ public: |
| 1232 | unordered_multiset(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); | 1244 | unordered_multiset(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); |
| 1233 | _LIBCPP_HIDE_FROM_ABI | 1245 | _LIBCPP_HIDE_FROM_ABI |
| 1234 | unordered_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); | 1246 | unordered_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); |
| 1235 | # if _LIBCPP_STD_VER >= 14 | ||
| 1236 | inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const allocator_type& __a) | 1247 | inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const allocator_type& __a) |
| 1237 | : unordered_multiset(__n, hasher(), key_equal(), __a) {} | 1248 | : unordered_multiset(__n, hasher(), key_equal(), __a) {} |
| 1238 | inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a) | 1249 | inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a) |
| 1239 | : unordered_multiset(__n, __hf, key_equal(), __a) {} | 1250 | : unordered_multiset(__n, __hf, key_equal(), __a) {} |
| 1240 | # endif | ||
| 1241 | template <class _InputIterator> | 1251 | template <class _InputIterator> |
| 1242 | _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last); | 1252 | _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last); |
| 1243 | template <class _InputIterator> | 1253 | template <class _InputIterator> |
| ... | @@ -1273,7 +1283,6 @@ public: | ... | @@ -1273,7 +1283,6 @@ public: |
| 1273 | } | 1283 | } |
| 1274 | # endif | 1284 | # endif |
| 1275 | 1285 | ||
| 1276 | # if _LIBCPP_STD_VER >= 14 | ||
| 1277 | template <class _InputIterator> | 1286 | template <class _InputIterator> |
| 1278 | inline _LIBCPP_HIDE_FROM_ABI | 1287 | inline _LIBCPP_HIDE_FROM_ABI |
| 1279 | unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) | 1288 | unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) |
| ... | @@ -1282,7 +1291,6 @@ public: | ... | @@ -1282,7 +1291,6 @@ public: |
| 1282 | inline _LIBCPP_HIDE_FROM_ABI unordered_multiset( | 1291 | inline _LIBCPP_HIDE_FROM_ABI unordered_multiset( |
| 1283 | _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) | 1292 | _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) |
| 1284 | : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {} | 1293 | : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {} |
| 1285 | # endif | ||
| 1286 | 1294 | ||
| 1287 | # if _LIBCPP_STD_VER >= 23 | 1295 | # if _LIBCPP_STD_VER >= 23 |
| 1288 | template <_ContainerCompatibleRange<value_type> _Range> | 1296 | template <_ContainerCompatibleRange<value_type> _Range> |
| ... | @@ -1313,14 +1321,12 @@ public: | ... | @@ -1313,14 +1321,12 @@ public: |
| 1313 | const hasher& __hf, | 1321 | const hasher& __hf, |
| 1314 | const key_equal& __eql, | 1322 | const key_equal& __eql, |
| 1315 | const allocator_type& __a); | 1323 | const allocator_type& __a); |
| 1316 | # if _LIBCPP_STD_VER >= 14 | ||
| 1317 | inline _LIBCPP_HIDE_FROM_ABI | 1324 | inline _LIBCPP_HIDE_FROM_ABI |
| 1318 | unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) | 1325 | unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) |
| 1319 | : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {} | 1326 | : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {} |
| 1320 | inline _LIBCPP_HIDE_FROM_ABI | 1327 | inline _LIBCPP_HIDE_FROM_ABI |
| 1321 | unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) | 1328 | unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) |
| 1322 | : unordered_multiset(__il, __n, __hf, key_equal(), __a) {} | 1329 | : unordered_multiset(__il, __n, __hf, key_equal(), __a) {} |
| 1323 | # endif | ||
| 1324 | # endif // _LIBCPP_CXX03_LANG | 1330 | # endif // _LIBCPP_CXX03_LANG |
| 1325 | _LIBCPP_HIDE_FROM_ABI ~unordered_multiset() { | 1331 | _LIBCPP_HIDE_FROM_ABI ~unordered_multiset() { |
| 1326 | static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); | 1332 | static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); |
| ... | @@ -1443,11 +1449,17 @@ public: | ... | @@ -1443,11 +1449,17 @@ public: |
| 1443 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } | 1449 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } |
| 1444 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } | 1450 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } |
| 1445 | # if _LIBCPP_STD_VER >= 20 | 1451 | # if _LIBCPP_STD_VER >= 20 |
| 1446 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1452 | template <class _K2, |
| 1453 | class _Hasher = hasher, | ||
| 1454 | class _Comp = key_equal, | ||
| 1455 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1447 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { | 1456 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { |
| 1448 | return __table_.find(__k); | 1457 | return __table_.find(__k); |
| 1449 | } | 1458 | } |
| 1450 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1459 | template <class _K2, |
| 1460 | class _Hasher = hasher, | ||
| 1461 | class _Comp = key_equal, | ||
| 1462 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1451 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { | 1463 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { |
| 1452 | return __table_.find(__k); | 1464 | return __table_.find(__k); |
| 1453 | } | 1465 | } |
| ... | @@ -1457,7 +1469,10 @@ public: | ... | @@ -1457,7 +1469,10 @@ public: |
| 1457 | return __table_.__count_multi(__k); | 1469 | return __table_.__count_multi(__k); |
| 1458 | } | 1470 | } |
| 1459 | # if _LIBCPP_STD_VER >= 20 | 1471 | # if _LIBCPP_STD_VER >= 20 |
| 1460 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1472 | template <class _K2, |
| 1473 | class _Hasher = hasher, | ||
| 1474 | class _Comp = key_equal, | ||
| 1475 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1461 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { | 1476 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { |
| 1462 | return __table_.__count_multi(__k); | 1477 | return __table_.__count_multi(__k); |
| 1463 | } | 1478 | } |
| ... | @@ -1466,7 +1481,10 @@ public: | ... | @@ -1466,7 +1481,10 @@ public: |
| 1466 | # if _LIBCPP_STD_VER >= 20 | 1481 | # if _LIBCPP_STD_VER >= 20 |
| 1467 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } | 1482 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } |
| 1468 | 1483 | ||
| 1469 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1484 | template <class _K2, |
| 1485 | class _Hasher = hasher, | ||
| 1486 | class _Comp = key_equal, | ||
| 1487 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1470 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { | 1488 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { |
| 1471 | return find(__k) != end(); | 1489 | return find(__k) != end(); |
| 1472 | } | 1490 | } |
| ... | @@ -1479,11 +1497,17 @@ public: | ... | @@ -1479,11 +1497,17 @@ public: |
| 1479 | return __table_.__equal_range_multi(__k); | 1497 | return __table_.__equal_range_multi(__k); |
| 1480 | } | 1498 | } |
| 1481 | # if _LIBCPP_STD_VER >= 20 | 1499 | # if _LIBCPP_STD_VER >= 20 |
| 1482 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1500 | template <class _K2, |
| 1501 | class _Hasher = hasher, | ||
| 1502 | class _Comp = key_equal, | ||
| 1503 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1483 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { | 1504 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { |
| 1484 | return __table_.__equal_range_multi(__k); | 1505 | return __table_.__equal_range_multi(__k); |
| 1485 | } | 1506 | } |
| 1486 | template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr> | 1507 | template <class _K2, |
| 1508 | class _Hasher = hasher, | ||
| 1509 | class _Comp = key_equal, | ||
| 1510 | enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr> | ||
| 1487 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { | 1511 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { |
| 1488 | return __table_.__equal_range_multi(__k); | 1512 | return __table_.__equal_range_multi(__k); |
| 1489 | } | 1513 | } |
| ... | @@ -1812,7 +1836,7 @@ _LIBCPP_END_NAMESPACE_STD | ... | @@ -1812,7 +1836,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 1812 | 1836 | ||
| 1813 | _LIBCPP_POP_MACROS | 1837 | _LIBCPP_POP_MACROS |
| 1814 | 1838 | ||
| 1815 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1839 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1816 | # include <cmath> | 1840 | # include <cmath> |
| 1817 | # include <concepts> | 1841 | # include <concepts> |
| 1818 | # include <cstdlib> | 1842 | # include <cstdlib> |
lib/libcxx/include/utility+16-5| ... | @@ -195,6 +195,19 @@ template<class T1, class T2> | ... | @@ -195,6 +195,19 @@ template<class T1, class T2> |
| 195 | template<class T1, class T2> | 195 | template<class T1, class T2> |
| 196 | constexpr const T1&& get(const pair<T2, T1>&&) noexcept; // C++14 | 196 | constexpr const T1&& get(const pair<T2, T1>&&) noexcept; // C++14 |
| 197 | 197 | ||
| 198 | // [const.wrap.class], class template constant_wrapper | ||
| 199 | template<auto X, class = decltype(X)> | ||
| 200 | struct constant_wrapper; // since C++26 | ||
| 201 | |||
| 202 | template<class T> | ||
| 203 | concept constexpr-param = // exposition only, since C++26 | ||
| 204 | requires { typename constant_wrapper<T::value>; }; | ||
| 205 | |||
| 206 | struct cw-operators; // exposition only, since C++26 | ||
| 207 | |||
| 208 | template<auto X> | ||
| 209 | constexpr auto cw = constant_wrapper<X>{}; // since C++26 | ||
| 210 | |||
| 198 | // C++14 | 211 | // C++14 |
| 199 | 212 | ||
| 200 | template<class T, T... I> | 213 | template<class T, T... I> |
| ... | @@ -292,6 +305,7 @@ template <class T> | ... | @@ -292,6 +305,7 @@ template <class T> |
| 292 | # endif | 305 | # endif |
| 293 | 306 | ||
| 294 | # if _LIBCPP_STD_VER >= 26 | 307 | # if _LIBCPP_STD_VER >= 26 |
| 308 | # include <__utility/constant_wrapper.h> | ||
| 295 | # include <__variant/monostate.h> | 309 | # include <__variant/monostate.h> |
| 296 | # endif | 310 | # endif |
| 297 | 311 | ||
| ... | @@ -315,14 +329,11 @@ template <class T> | ... | @@ -315,14 +329,11 @@ template <class T> |
| 315 | # pragma GCC system_header | 329 | # pragma GCC system_header |
| 316 | # endif | 330 | # endif |
| 317 | 331 | ||
| 318 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 332 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 319 | # include <limits> | ||
| 320 | # endif | ||
| 321 | |||
| 322 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | ||
| 323 | # include <cstddef> | 333 | # include <cstddef> |
| 324 | # include <cstdlib> | 334 | # include <cstdlib> |
| 325 | # include <iosfwd> | 335 | # include <iosfwd> |
| 336 | # include <limits> | ||
| 326 | # include <type_traits> | 337 | # include <type_traits> |
| 327 | # endif | 338 | # endif |
| 328 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 339 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/valarray+3-1| ... | @@ -381,6 +381,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -381,6 +381,7 @@ _LIBCPP_PUSH_MACROS |
| 381 | # include <__undef_macros> | 381 | # include <__undef_macros> |
| 382 | 382 | ||
| 383 | _LIBCPP_BEGIN_NAMESPACE_STD | 383 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 384 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 384 | 385 | ||
| 385 | template <class _Tp> | 386 | template <class _Tp> |
| 386 | class valarray; | 387 | class valarray; |
| ... | @@ -3300,11 +3301,12 @@ template <class _Tp> | ... | @@ -3300,11 +3301,12 @@ template <class _Tp> |
| 3300 | return __v.__end_; | 3301 | return __v.__end_; |
| 3301 | } | 3302 | } |
| 3302 | 3303 | ||
| 3304 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 3303 | _LIBCPP_END_NAMESPACE_STD | 3305 | _LIBCPP_END_NAMESPACE_STD |
| 3304 | 3306 | ||
| 3305 | _LIBCPP_POP_MACROS | 3307 | _LIBCPP_POP_MACROS |
| 3306 | 3308 | ||
| 3307 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 3309 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 3308 | # include <algorithm> | 3310 | # include <algorithm> |
| 3309 | # include <concepts> | 3311 | # include <concepts> |
| 3310 | # include <cstdlib> | 3312 | # include <cstdlib> |
lib/libcxx/include/variant+39-19| ... | @@ -235,7 +235,6 @@ namespace std { | ... | @@ -235,7 +235,6 @@ namespace std { |
| 235 | # include <__type_traits/conditional.h> | 235 | # include <__type_traits/conditional.h> |
| 236 | # include <__type_traits/conjunction.h> | 236 | # include <__type_traits/conjunction.h> |
| 237 | # include <__type_traits/decay.h> | 237 | # include <__type_traits/decay.h> |
| 238 | # include <__type_traits/dependent_type.h> | ||
| 239 | # include <__type_traits/enable_if.h> | 238 | # include <__type_traits/enable_if.h> |
| 240 | # include <__type_traits/invoke.h> | 239 | # include <__type_traits/invoke.h> |
| 241 | # include <__type_traits/is_array.h> | 240 | # include <__type_traits/is_array.h> |
| ... | @@ -285,18 +284,33 @@ _LIBCPP_PUSH_MACROS | ... | @@ -285,18 +284,33 @@ _LIBCPP_PUSH_MACROS |
| 285 | # include <__undef_macros> | 284 | # include <__undef_macros> |
| 286 | 285 | ||
| 287 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD | 286 | _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD |
| 287 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 288 | 288 | ||
| 289 | class _LIBCPP_EXPORTED_FROM_ABI bad_variant_access : public exception { | 289 | class _LIBCPP_EXPORTED_FROM_ABI bad_variant_access : public exception { |
| 290 | public: | 290 | public: |
| 291 | [[__nodiscard__]] const char* what() const _NOEXCEPT override; | 291 | [[__nodiscard__]] const char* what() const _NOEXCEPT override; |
| 292 | }; | 292 | }; |
| 293 | 293 | ||
| 294 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | 294 | class _LIBCPP_EXPORTED_FROM_ABI __bad_variant_access_with_msg : public bad_variant_access { |
| 295 | public: | ||
| 296 | _LIBCPP_HIDE_FROM_ABI explicit __bad_variant_access_with_msg(const char* __msg) _NOEXCEPT : __msg_(__msg) {} | ||
| 297 | # if _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS_WITH_MSG_KEY_FUNCTION | ||
| 298 | [[__nodiscard__]] const char* what() const _NOEXCEPT override; | ||
| 299 | # else | ||
| 300 | [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI_VIRTUAL const char* what() const _NOEXCEPT override { return __msg_; } | ||
| 301 | # endif | ||
| 295 | 302 | ||
| 296 | _LIBCPP_BEGIN_NAMESPACE_STD | 303 | private: |
| 304 | const char* __msg_; | ||
| 305 | }; | ||
| 306 | |||
| 307 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 308 | _LIBCPP_END_UNVERSIONED_NAMESPACE_STD | ||
| 297 | 309 | ||
| 298 | # if _LIBCPP_STD_VER >= 17 | 310 | # if _LIBCPP_STD_VER >= 17 |
| 299 | 311 | ||
| 312 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 313 | |||
| 300 | // Light N-dimensional array of function pointers. Used in place of std::array to avoid | 314 | // Light N-dimensional array of function pointers. Used in place of std::array to avoid |
| 301 | // adding a dependency. | 315 | // adding a dependency. |
| 302 | template <class _Tp, size_t _Size> | 316 | template <class _Tp, size_t _Size> |
| ... | @@ -307,11 +321,11 @@ struct __farray { | ... | @@ -307,11 +321,11 @@ struct __farray { |
| 307 | _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t __n) const noexcept { return __buf_[__n]; } | 321 | _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t __n) const noexcept { return __buf_[__n]; } |
| 308 | }; | 322 | }; |
| 309 | 323 | ||
| 310 | [[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_variant_access() { | 324 | [[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_variant_access(const char* __msg) { |
| 311 | # if _LIBCPP_HAS_EXCEPTIONS | 325 | # if _LIBCPP_HAS_EXCEPTIONS |
| 312 | throw bad_variant_access(); | 326 | throw __bad_variant_access_with_msg(__msg); |
| 313 | # else | 327 | # else |
| 314 | _LIBCPP_VERBOSE_ABORT("bad_variant_access was thrown in -fno-exceptions mode"); | 328 | _LIBCPP_VERBOSE_ABORT("bad_variant_access was thrown in -fno-exceptions mode: %s", __msg); |
| 315 | # endif | 329 | # endif |
| 316 | } | 330 | } |
| 317 | 331 | ||
| ... | @@ -539,9 +553,12 @@ private: | ... | @@ -539,9 +553,12 @@ private: |
| 539 | return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>; | 553 | return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>; |
| 540 | } | 554 | } |
| 541 | 555 | ||
| 556 | template <class, class _Tp> | ||
| 557 | using __expander _LIBCPP_NODEBUG = _Tp; | ||
| 558 | |||
| 542 | template <size_t _Ip, class _Fp, class... _Vs> | 559 | template <size_t _Ip, class _Fp, class... _Vs> |
| 543 | _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal_impl() { | 560 | _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal_impl() { |
| 544 | return __make_dispatch<_Fp, _Vs...>(index_sequence<((void)__type_identity<_Vs>{}, _Ip)...>{}); | 561 | return __make_dispatch<_Fp, _Vs...>(index_sequence<static_cast<__expander<_Vs, size_t>>(_Ip)...>{}); |
| 545 | } | 562 | } |
| 546 | 563 | ||
| 547 | template <class _Fp, class... _Vs, size_t... _Is> | 564 | template <class _Fp, class... _Vs, size_t... _Is> |
| ... | @@ -614,7 +631,8 @@ private: | ... | @@ -614,7 +631,8 @@ private: |
| 614 | template <class _Visitor> | 631 | template <class _Visitor> |
| 615 | struct __value_visitor { | 632 | struct __value_visitor { |
| 616 | template <class... _Alts> | 633 | template <class... _Alts> |
| 617 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Alts&&... __alts) const { | 634 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Alts&&... __alts) const |
| 635 | -> invoke_result_t<_Visitor&&, decltype((std::forward<_Alts>(__alts).__value))...> { | ||
| 618 | __std_visit_exhaustive_visitor_check< _Visitor, decltype((std::forward<_Alts>(__alts).__value))...>(); | 636 | __std_visit_exhaustive_visitor_check< _Visitor, decltype((std::forward<_Alts>(__alts).__value))...>(); |
| 619 | return std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...); | 637 | return std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...); |
| 620 | } | 638 | } |
| ... | @@ -1164,8 +1182,7 @@ public: | ... | @@ -1164,8 +1182,7 @@ public: |
| 1164 | using __trivially_relocatable _LIBCPP_NODEBUG = | 1182 | using __trivially_relocatable _LIBCPP_NODEBUG = |
| 1165 | conditional_t<_And<__libcpp_is_trivially_relocatable<_Types>...>::value, variant, void>; | 1183 | conditional_t<_And<__libcpp_is_trivially_relocatable<_Types>...>::value, variant, void>; |
| 1166 | 1184 | ||
| 1167 | template <bool _Dummy = true, | 1185 | template <class _FirstType = __first_type, enable_if_t<is_default_constructible_v<_FirstType>, int> = 0> |
| 1168 | enable_if_t<__dependent_type<is_default_constructible<__first_type>, _Dummy>::value, int> = 0> | ||
| 1169 | _LIBCPP_HIDE_FROM_ABI constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>) | 1186 | _LIBCPP_HIDE_FROM_ABI constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>) |
| 1170 | : __impl_(in_place_index<0>) {} | 1187 | : __impl_(in_place_index<0>) {} |
| 1171 | 1188 | ||
| ... | @@ -1280,10 +1297,10 @@ public: | ... | @@ -1280,10 +1297,10 @@ public: |
| 1280 | 1297 | ||
| 1281 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept { return __impl_.index(); } | 1298 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept { return __impl_.index(); } |
| 1282 | 1299 | ||
| 1283 | template < bool _Dummy = true, | 1300 | template < |
| 1284 | enable_if_t< __all<(__dependent_type<is_move_constructible<_Types>, _Dummy>::value && | 1301 | bool _Dummy = true, |
| 1285 | __dependent_type<is_swappable<_Types>, _Dummy>::value)...>::value, | 1302 | enable_if_t<_And<_And<bool_constant<_Dummy>, is_move_constructible<_Types>, is_swappable<_Types>>...>::value, |
| 1286 | int> = 0> | 1303 | int> = 0> |
| 1287 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(variant& __that) noexcept( | 1304 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(variant& __that) noexcept( |
| 1288 | __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_swappable_v<_Types>)...>::value) { | 1305 | __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_swappable_v<_Types>)...>::value) { |
| 1289 | __impl_.__swap(__that.__impl_); | 1306 | __impl_.__swap(__that.__impl_); |
| ... | @@ -1329,7 +1346,9 @@ template <size_t _Ip, class _Vp> | ... | @@ -1329,7 +1346,9 @@ template <size_t _Ip, class _Vp> |
| 1329 | _LIBCPP_HIDE_FROM_ABI constexpr auto&& __generic_get(_Vp&& __v) { | 1346 | _LIBCPP_HIDE_FROM_ABI constexpr auto&& __generic_get(_Vp&& __v) { |
| 1330 | using __variant_detail::__access::__variant; | 1347 | using __variant_detail::__access::__variant; |
| 1331 | if (!std::__holds_alternative<_Ip>(__v)) { | 1348 | if (!std::__holds_alternative<_Ip>(__v)) { |
| 1332 | std::__throw_bad_variant_access(); | 1349 | if (__v.valueless_by_exception()) |
| 1350 | std::__throw_bad_variant_access("std::get: variant is valueless"); | ||
| 1351 | std::__throw_bad_variant_access("std::get: wrong alternative for variant"); | ||
| 1333 | } | 1352 | } |
| 1334 | return __variant::__get_alt<_Ip>(std::forward<_Vp>(__v)).__value; | 1353 | return __variant::__get_alt<_Ip>(std::forward<_Vp>(__v)).__value; |
| 1335 | } | 1354 | } |
| ... | @@ -1566,7 +1585,7 @@ template <class... _Vs> | ... | @@ -1566,7 +1585,7 @@ template <class... _Vs> |
| 1566 | _LIBCPP_HIDE_FROM_ABI constexpr void __throw_if_valueless(_Vs&&... __vs) { | 1585 | _LIBCPP_HIDE_FROM_ABI constexpr void __throw_if_valueless(_Vs&&... __vs) { |
| 1567 | const bool __valueless = (... || std::__as_variant(__vs).valueless_by_exception()); | 1586 | const bool __valueless = (... || std::__as_variant(__vs).valueless_by_exception()); |
| 1568 | if (__valueless) { | 1587 | if (__valueless) { |
| 1569 | std::__throw_bad_variant_access(); | 1588 | std::__throw_bad_variant_access("std::visit: variant is valueless"); |
| 1570 | } | 1589 | } |
| 1571 | } | 1590 | } |
| 1572 | 1591 | ||
| ... | @@ -1574,6 +1593,7 @@ template < class _Visitor, class... _Vs, typename> | ... | @@ -1574,6 +1593,7 @@ template < class _Visitor, class... _Vs, typename> |
| 1574 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) { | 1593 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) { |
| 1575 | using __variant_detail::__visitation::__variant; | 1594 | using __variant_detail::__visitation::__variant; |
| 1576 | std::__throw_if_valueless(std::forward<_Vs>(__vs)...); | 1595 | std::__throw_if_valueless(std::forward<_Vs>(__vs)...); |
| 1596 | // NOLINTNEXTLINE(bugprone-use-after-move) __throw_if_valueless doesn't actually forward the variants | ||
| 1577 | return __variant::__visit_value(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs)...); | 1597 | return __variant::__visit_value(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs)...); |
| 1578 | } | 1598 | } |
| 1579 | 1599 | ||
| ... | @@ -1635,13 +1655,13 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(variant<_Types...>& __v) | ... | @@ -1635,13 +1655,13 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(variant<_Types...>& __v) |
| 1635 | return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); | 1655 | return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); |
| 1636 | } | 1656 | } |
| 1637 | 1657 | ||
| 1638 | # endif // _LIBCPP_STD_VER >= 17 | ||
| 1639 | |||
| 1640 | _LIBCPP_END_NAMESPACE_STD | 1658 | _LIBCPP_END_NAMESPACE_STD |
| 1641 | 1659 | ||
| 1660 | # endif // _LIBCPP_STD_VER >= 17 | ||
| 1661 | |||
| 1642 | _LIBCPP_POP_MACROS | 1662 | _LIBCPP_POP_MACROS |
| 1643 | 1663 | ||
| 1644 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 1664 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 |
| 1645 | # include <cstddef> | 1665 | # include <cstddef> |
| 1646 | # include <exception> | 1666 | # include <exception> |
| 1647 | # include <tuple> | 1667 | # include <tuple> |
lib/libcxx/include/vector+12-8| ... | @@ -39,7 +39,7 @@ public: | ... | @@ -39,7 +39,7 @@ public: |
| 39 | noexcept(is_nothrow_default_constructible<allocator_type>::value); | 39 | noexcept(is_nothrow_default_constructible<allocator_type>::value); |
| 40 | explicit vector(const allocator_type&); | 40 | explicit vector(const allocator_type&); |
| 41 | explicit vector(size_type n); | 41 | explicit vector(size_type n); |
| 42 | explicit vector(size_type n, const allocator_type&); // C++14 | 42 | explicit vector(size_type n, const allocator_type&); |
| 43 | vector(size_type n, const value_type& value, const allocator_type& = allocator_type()); | 43 | vector(size_type n, const value_type& value, const allocator_type& = allocator_type()); |
| 44 | template <class InputIterator> | 44 | template <class InputIterator> |
| 45 | vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type()); | 45 | vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type()); |
| ... | @@ -171,7 +171,7 @@ public: | ... | @@ -171,7 +171,7 @@ public: |
| 171 | vector() | 171 | vector() |
| 172 | noexcept(is_nothrow_default_constructible<allocator_type>::value); | 172 | noexcept(is_nothrow_default_constructible<allocator_type>::value); |
| 173 | explicit vector(const allocator_type&) noexcept; | 173 | explicit vector(const allocator_type&) noexcept; |
| 174 | explicit vector(size_type n, const allocator_type& a = allocator_type()); // C++14 | 174 | explicit vector(size_type n, const allocator_type& a = allocator_type()); |
| 175 | vector(size_type n, const value_type& value, const allocator_type& = allocator_type()); | 175 | vector(size_type n, const value_type& value, const allocator_type& = allocator_type()); |
| 176 | template <class InputIterator> | 176 | template <class InputIterator> |
| 177 | vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type()); | 177 | vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type()); |
| ... | @@ -348,16 +348,21 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++ | ... | @@ -348,16 +348,21 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++ |
| 348 | # pragma GCC system_header | 348 | # pragma GCC system_header |
| 349 | # endif | 349 | # endif |
| 350 | 350 | ||
| 351 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 351 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23 |
| 352 | # include <algorithm> | ||
| 353 | # include <array> | 352 | # include <array> |
| 354 | # include <atomic> | ||
| 355 | # include <cctype> | ||
| 356 | # include <cerrno> | 353 | # include <cerrno> |
| 357 | # include <clocale> | 354 | # include <clocale> |
| 355 | # include <cstddef> | ||
| 356 | # include <cstdlib> | ||
| 357 | # include <typeinfo> | ||
| 358 | # endif | ||
| 359 | |||
| 360 | # if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20 | ||
| 361 | # include <algorithm> | ||
| 362 | # include <atomic> | ||
| 363 | # include <cctype> | ||
| 358 | # include <concepts> | 364 | # include <concepts> |
| 359 | # include <cstdint> | 365 | # include <cstdint> |
| 360 | # include <cstdlib> | ||
| 361 | # include <iosfwd> | 366 | # include <iosfwd> |
| 362 | # if _LIBCPP_HAS_LOCALIZATION | 367 | # if _LIBCPP_HAS_LOCALIZATION |
| 363 | # include <locale> | 368 | # include <locale> |
| ... | @@ -367,7 +372,6 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++ | ... | @@ -367,7 +372,6 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++ |
| 367 | # include <string_view> | 372 | # include <string_view> |
| 368 | # include <tuple> | 373 | # include <tuple> |
| 369 | # include <type_traits> | 374 | # include <type_traits> |
| 370 | # include <typeinfo> | ||
| 371 | # include <utility> | 375 | # include <utility> |
| 372 | # endif | 376 | # endif |
| 373 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 377 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
lib/libcxx/include/version+27-11| ... | @@ -37,7 +37,7 @@ __cpp_lib_atomic_float 201711L <atomic> | ... | @@ -37,7 +37,7 @@ __cpp_lib_atomic_float 201711L <atomic> |
| 37 | __cpp_lib_atomic_is_always_lock_free 201603L <atomic> | 37 | __cpp_lib_atomic_is_always_lock_free 201603L <atomic> |
| 38 | __cpp_lib_atomic_lock_free_type_aliases 201907L <atomic> | 38 | __cpp_lib_atomic_lock_free_type_aliases 201907L <atomic> |
| 39 | __cpp_lib_atomic_min_max 202403L <atomic> | 39 | __cpp_lib_atomic_min_max 202403L <atomic> |
| 40 | __cpp_lib_atomic_ref 202411L <atomic> | 40 | __cpp_lib_atomic_ref 202603L <atomic> |
| 41 | 201806L // C++20 | 41 | 201806L // C++20 |
| 42 | __cpp_lib_atomic_shared_ptr 201711L <atomic> | 42 | __cpp_lib_atomic_shared_ptr 201711L <atomic> |
| 43 | __cpp_lib_atomic_value_initialization 201911L <atomic> <memory> | 43 | __cpp_lib_atomic_value_initialization 201911L <atomic> <memory> |
| ... | @@ -64,6 +64,7 @@ __cpp_lib_common_reference 202302L <type_traits> | ... | @@ -64,6 +64,7 @@ __cpp_lib_common_reference 202302L <type_traits> |
| 64 | __cpp_lib_common_reference_wrapper 202302L <functional> | 64 | __cpp_lib_common_reference_wrapper 202302L <functional> |
| 65 | __cpp_lib_complex_udls 201309L <complex> | 65 | __cpp_lib_complex_udls 201309L <complex> |
| 66 | __cpp_lib_concepts 202207L <concepts> | 66 | __cpp_lib_concepts 202207L <concepts> |
| 67 | __cpp_lib_constant_wrapper 202606L <utility> | ||
| 67 | __cpp_lib_constexpr_algorithms 202306L <algorithm> <utility> | 68 | __cpp_lib_constexpr_algorithms 202306L <algorithm> <utility> |
| 68 | 201806L // C++20 | 69 | 201806L // C++20 |
| 69 | __cpp_lib_constexpr_bitset 202207L <bitset> | 70 | __cpp_lib_constexpr_bitset 202207L <bitset> |
| ... | @@ -77,11 +78,13 @@ __cpp_lib_constexpr_forward_list 202502L <forward_list> | ... | @@ -77,11 +78,13 @@ __cpp_lib_constexpr_forward_list 202502L <forward_list> |
| 77 | __cpp_lib_constexpr_functional 201907L <functional> | 78 | __cpp_lib_constexpr_functional 201907L <functional> |
| 78 | __cpp_lib_constexpr_iterator 201811L <iterator> | 79 | __cpp_lib_constexpr_iterator 201811L <iterator> |
| 79 | __cpp_lib_constexpr_list 202502L <list> | 80 | __cpp_lib_constexpr_list 202502L <list> |
| 81 | __cpp_lib_constexpr_map 202502L <map> | ||
| 80 | __cpp_lib_constexpr_memory 202202L <memory> | 82 | __cpp_lib_constexpr_memory 202202L <memory> |
| 81 | 201811L // C++20 | 83 | 201811L // C++20 |
| 82 | __cpp_lib_constexpr_new 202406L <new> | 84 | __cpp_lib_constexpr_new 202406L <new> |
| 83 | __cpp_lib_constexpr_numeric 201911L <numeric> | 85 | __cpp_lib_constexpr_numeric 201911L <numeric> |
| 84 | __cpp_lib_constexpr_queue 202502L <queue> | 86 | __cpp_lib_constexpr_queue 202502L <queue> |
| 87 | __cpp_lib_constexpr_set 202502L <set> | ||
| 85 | __cpp_lib_constexpr_string 201907L <string> | 88 | __cpp_lib_constexpr_string 201907L <string> |
| 86 | __cpp_lib_constexpr_string_view 201811L <string_view> | 89 | __cpp_lib_constexpr_string_view 201811L <string_view> |
| 87 | __cpp_lib_constexpr_tuple 201811L <tuple> | 90 | __cpp_lib_constexpr_tuple 201811L <tuple> |
| ... | @@ -209,17 +212,21 @@ __cpp_lib_ranges_chunk 202202L <ranges> | ... | @@ -209,17 +212,21 @@ __cpp_lib_ranges_chunk 202202L <ranges> |
| 209 | __cpp_lib_ranges_chunk_by 202202L <ranges> | 212 | __cpp_lib_ranges_chunk_by 202202L <ranges> |
| 210 | __cpp_lib_ranges_concat 202403L <ranges> | 213 | __cpp_lib_ranges_concat 202403L <ranges> |
| 211 | __cpp_lib_ranges_contains 202207L <algorithm> | 214 | __cpp_lib_ranges_contains 202207L <algorithm> |
| 215 | __cpp_lib_ranges_enumerate 202302L <ranges> | ||
| 212 | __cpp_lib_ranges_find_last 202207L <algorithm> | 216 | __cpp_lib_ranges_find_last 202207L <algorithm> |
| 217 | __cpp_lib_ranges_fold 202207L <algorithm> | ||
| 213 | __cpp_lib_ranges_indices 202506L <ranges> | 218 | __cpp_lib_ranges_indices 202506L <ranges> |
| 214 | __cpp_lib_ranges_iota 202202L <numeric> | 219 | __cpp_lib_ranges_iota 202202L <numeric> |
| 215 | __cpp_lib_ranges_join_with 202202L <ranges> | 220 | __cpp_lib_ranges_join_with 202202L <ranges> |
| 216 | __cpp_lib_ranges_repeat 202207L <ranges> | 221 | __cpp_lib_ranges_repeat 202207L <ranges> |
| 217 | __cpp_lib_ranges_slide 202202L <ranges> | 222 | __cpp_lib_ranges_slide 202202L <ranges> |
| 218 | __cpp_lib_ranges_starts_ends_with 202106L <algorithm> | 223 | __cpp_lib_ranges_starts_ends_with 202106L <algorithm> |
| 224 | __cpp_lib_ranges_stride 202207L <ranges> | ||
| 219 | __cpp_lib_ranges_to_container 202202L <ranges> | 225 | __cpp_lib_ranges_to_container 202202L <ranges> |
| 220 | __cpp_lib_ranges_zip 202110L <ranges> <tuple> <utility> | 226 | __cpp_lib_ranges_zip 202110L <ranges> <tuple> <utility> |
| 221 | __cpp_lib_ratio 202306L <ratio> | 227 | __cpp_lib_ratio 202306L <ratio> |
| 222 | __cpp_lib_raw_memory_algorithms 201606L <memory> | 228 | __cpp_lib_raw_memory_algorithms 202411L <memory> |
| 229 | 201606L // C++17 | ||
| 223 | __cpp_lib_rcu 202306L <rcu> | 230 | __cpp_lib_rcu 202306L <rcu> |
| 224 | __cpp_lib_reference_from_temporary 202202L <type_traits> | 231 | __cpp_lib_reference_from_temporary 202202L <type_traits> |
| 225 | __cpp_lib_reference_wrapper 202403L <functional> | 232 | __cpp_lib_reference_wrapper 202403L <functional> |
| ... | @@ -227,7 +234,7 @@ __cpp_lib_remove_cvref 201711L <type_traits> | ... | @@ -227,7 +234,7 @@ __cpp_lib_remove_cvref 201711L <type_traits> |
| 227 | __cpp_lib_result_of_sfinae 201210L <functional> <type_traits> | 234 | __cpp_lib_result_of_sfinae 201210L <functional> <type_traits> |
| 228 | __cpp_lib_robust_nonmodifying_seq_ops 201304L <algorithm> | 235 | __cpp_lib_robust_nonmodifying_seq_ops 201304L <algorithm> |
| 229 | __cpp_lib_sample 201603L <algorithm> | 236 | __cpp_lib_sample 201603L <algorithm> |
| 230 | __cpp_lib_saturation_arithmetic 202311L <numeric> | 237 | __cpp_lib_saturation_arithmetic 202603L <numeric> |
| 231 | __cpp_lib_scoped_lock 201703L <mutex> | 238 | __cpp_lib_scoped_lock 201703L <mutex> |
| 232 | __cpp_lib_semaphore 201907L <semaphore> | 239 | __cpp_lib_semaphore 201907L <semaphore> |
| 233 | __cpp_lib_senders 202406L <execution> | 240 | __cpp_lib_senders 202406L <execution> |
| ... | @@ -236,13 +243,13 @@ __cpp_lib_shared_ptr_arrays 201707L <memory> | ... | @@ -236,13 +243,13 @@ __cpp_lib_shared_ptr_arrays 201707L <memory> |
| 236 | 201611L // C++17 | 243 | 201611L // C++17 |
| 237 | __cpp_lib_shared_ptr_weak_type 201606L <memory> | 244 | __cpp_lib_shared_ptr_weak_type 201606L <memory> |
| 238 | __cpp_lib_shared_timed_mutex 201402L <shared_mutex> | 245 | __cpp_lib_shared_timed_mutex 201402L <shared_mutex> |
| 239 | __cpp_lib_shift 201806L <algorithm> | 246 | __cpp_lib_shift 202202L <algorithm> |
| 247 | 201806L // C++20 | ||
| 240 | __cpp_lib_smart_ptr_for_overwrite 202002L <memory> | 248 | __cpp_lib_smart_ptr_for_overwrite 202002L <memory> |
| 241 | __cpp_lib_smart_ptr_owner_equality 202306L <memory> | 249 | __cpp_lib_smart_ptr_owner_equality 202306L <memory> |
| 242 | __cpp_lib_source_location 201907L <source_location> | 250 | __cpp_lib_source_location 201907L <source_location> |
| 243 | __cpp_lib_span 202002L <span> | 251 | __cpp_lib_span 202002L <span> |
| 244 | __cpp_lib_span_at 202311L <span> | 252 | __cpp_lib_span_at 202311L <span> |
| 245 | __cpp_lib_span_initializer_list 202311L <span> | ||
| 246 | __cpp_lib_spanstream 202106L <spanstream> | 253 | __cpp_lib_spanstream 202106L <spanstream> |
| 247 | __cpp_lib_ssize 201902L <iterator> | 254 | __cpp_lib_ssize 201902L <iterator> |
| 248 | __cpp_lib_sstream_from_string_view 202306L <sstream> | 255 | __cpp_lib_sstream_from_string_view 202306L <sstream> |
| ... | @@ -423,7 +430,7 @@ __cpp_lib_void_t 201411L <type_traits> | ... | @@ -423,7 +430,7 @@ __cpp_lib_void_t 201411L <type_traits> |
| 423 | # define __cpp_lib_constexpr_utility 201811L | 430 | # define __cpp_lib_constexpr_utility 201811L |
| 424 | # define __cpp_lib_constexpr_vector 201907L | 431 | # define __cpp_lib_constexpr_vector 201907L |
| 425 | # define __cpp_lib_coroutine 201902L | 432 | # define __cpp_lib_coroutine 201902L |
| 426 | # if _LIBCPP_STD_VER >= 20 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L | 433 | # if defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L |
| 427 | # define __cpp_lib_destroying_delete 201806L | 434 | # define __cpp_lib_destroying_delete 201806L |
| 428 | # endif | 435 | # endif |
| 429 | # define __cpp_lib_endian 201907L | 436 | # define __cpp_lib_endian 201907L |
| ... | @@ -524,15 +531,20 @@ __cpp_lib_void_t 201411L <type_traits> | ... | @@ -524,15 +531,20 @@ __cpp_lib_void_t 201411L <type_traits> |
| 524 | // # define __cpp_lib_ranges_chunk 202202L | 531 | // # define __cpp_lib_ranges_chunk 202202L |
| 525 | # define __cpp_lib_ranges_chunk_by 202202L | 532 | # define __cpp_lib_ranges_chunk_by 202202L |
| 526 | # define __cpp_lib_ranges_contains 202207L | 533 | # define __cpp_lib_ranges_contains 202207L |
| 534 | # define __cpp_lib_ranges_enumerate 202302L | ||
| 527 | # define __cpp_lib_ranges_find_last 202207L | 535 | # define __cpp_lib_ranges_find_last 202207L |
| 536 | # define __cpp_lib_ranges_fold 202207L | ||
| 528 | # define __cpp_lib_ranges_iota 202202L | 537 | # define __cpp_lib_ranges_iota 202202L |
| 529 | # define __cpp_lib_ranges_join_with 202202L | 538 | # define __cpp_lib_ranges_join_with 202202L |
| 530 | # define __cpp_lib_ranges_repeat 202207L | 539 | # define __cpp_lib_ranges_repeat 202207L |
| 531 | // # define __cpp_lib_ranges_slide 202202L | 540 | // # define __cpp_lib_ranges_slide 202202L |
| 532 | # define __cpp_lib_ranges_starts_ends_with 202106L | 541 | # define __cpp_lib_ranges_starts_ends_with 202106L |
| 542 | # define __cpp_lib_ranges_stride 202207L | ||
| 533 | # define __cpp_lib_ranges_to_container 202202L | 543 | # define __cpp_lib_ranges_to_container 202202L |
| 534 | # define __cpp_lib_ranges_zip 202110L | 544 | # define __cpp_lib_ranges_zip 202110L |
| 535 | // # define __cpp_lib_reference_from_temporary 202202L | 545 | // # define __cpp_lib_reference_from_temporary 202202L |
| 546 | # undef __cpp_lib_shift | ||
| 547 | # define __cpp_lib_shift 202202L | ||
| 536 | // # define __cpp_lib_spanstream 202106L | 548 | // # define __cpp_lib_spanstream 202106L |
| 537 | // # define __cpp_lib_stacktrace 202011L | 549 | // # define __cpp_lib_stacktrace 202011L |
| 538 | # define __cpp_lib_stdatomic_h 202011L | 550 | # define __cpp_lib_stdatomic_h 202011L |
| ... | @@ -548,20 +560,23 @@ __cpp_lib_void_t 201411L <type_traits> | ... | @@ -548,20 +560,23 @@ __cpp_lib_void_t 201411L <type_traits> |
| 548 | // # define __cpp_lib_associative_heterogeneous_insertion 202306L | 560 | // # define __cpp_lib_associative_heterogeneous_insertion 202306L |
| 549 | // # define __cpp_lib_atomic_min_max 202403L | 561 | // # define __cpp_lib_atomic_min_max 202403L |
| 550 | # undef __cpp_lib_atomic_ref | 562 | # undef __cpp_lib_atomic_ref |
| 551 | # define __cpp_lib_atomic_ref 202411L | 563 | # define __cpp_lib_atomic_ref 202603L |
| 552 | # undef __cpp_lib_bind_front | 564 | # undef __cpp_lib_bind_front |
| 553 | # define __cpp_lib_bind_front 202306L | 565 | # define __cpp_lib_bind_front 202306L |
| 554 | # define __cpp_lib_bitset 202306L | 566 | # define __cpp_lib_bitset 202306L |
| 567 | # define __cpp_lib_constant_wrapper 202606L | ||
| 555 | # undef __cpp_lib_constexpr_algorithms | 568 | # undef __cpp_lib_constexpr_algorithms |
| 556 | # define __cpp_lib_constexpr_algorithms 202306L | 569 | # define __cpp_lib_constexpr_algorithms 202306L |
| 557 | # define __cpp_lib_constexpr_flat_map 202502L | 570 | # define __cpp_lib_constexpr_flat_map 202502L |
| 558 | # define __cpp_lib_constexpr_flat_set 202502L | 571 | # define __cpp_lib_constexpr_flat_set 202502L |
| 559 | # define __cpp_lib_constexpr_forward_list 202502L | 572 | # define __cpp_lib_constexpr_forward_list 202502L |
| 560 | # define __cpp_lib_constexpr_list 202502L | 573 | # define __cpp_lib_constexpr_list 202502L |
| 574 | # define __cpp_lib_constexpr_map 202502L | ||
| 561 | # if !defined(_LIBCPP_ABI_VCRUNTIME) | 575 | # if !defined(_LIBCPP_ABI_VCRUNTIME) |
| 562 | # define __cpp_lib_constexpr_new 202406L | 576 | # define __cpp_lib_constexpr_new 202406L |
| 563 | # endif | 577 | # endif |
| 564 | # define __cpp_lib_constexpr_queue 202502L | 578 | # define __cpp_lib_constexpr_queue 202502L |
| 579 | # define __cpp_lib_constexpr_set 202502L | ||
| 565 | # define __cpp_lib_constrained_equality 202411L | 580 | # define __cpp_lib_constrained_equality 202411L |
| 566 | // # define __cpp_lib_copyable_function 202306L | 581 | // # define __cpp_lib_copyable_function 202306L |
| 567 | // # define __cpp_lib_debugging 202311L | 582 | // # define __cpp_lib_debugging 202311L |
| ... | @@ -604,22 +619,23 @@ __cpp_lib_void_t 201411L <type_traits> | ... | @@ -604,22 +619,23 @@ __cpp_lib_void_t 201411L <type_traits> |
| 604 | # undef __cpp_lib_out_ptr | 619 | # undef __cpp_lib_out_ptr |
| 605 | # define __cpp_lib_out_ptr 202311L | 620 | # define __cpp_lib_out_ptr 202311L |
| 606 | // # define __cpp_lib_philox_engine 202406L | 621 | // # define __cpp_lib_philox_engine 202406L |
| 607 | // # define __cpp_lib_ranges_concat 202403L | 622 | # define __cpp_lib_ranges_concat 202403L |
| 608 | # define __cpp_lib_ranges_indices 202506L | 623 | # define __cpp_lib_ranges_indices 202506L |
| 609 | # define __cpp_lib_ratio 202306L | 624 | # define __cpp_lib_ratio 202306L |
| 625 | # undef __cpp_lib_raw_memory_algorithms | ||
| 626 | # define __cpp_lib_raw_memory_algorithms 202411L | ||
| 610 | // # define __cpp_lib_rcu 202306L | 627 | // # define __cpp_lib_rcu 202306L |
| 611 | # define __cpp_lib_reference_wrapper 202403L | 628 | # define __cpp_lib_reference_wrapper 202403L |
| 612 | # define __cpp_lib_saturation_arithmetic 202311L | 629 | # define __cpp_lib_saturation_arithmetic 202603L |
| 613 | // # define __cpp_lib_senders 202406L | 630 | // # define __cpp_lib_senders 202406L |
| 614 | // # define __cpp_lib_smart_ptr_owner_equality 202306L | 631 | // # define __cpp_lib_smart_ptr_owner_equality 202306L |
| 615 | # define __cpp_lib_span_at 202311L | 632 | # define __cpp_lib_span_at 202311L |
| 616 | # define __cpp_lib_span_initializer_list 202311L | ||
| 617 | # define __cpp_lib_sstream_from_string_view 202306L | 633 | # define __cpp_lib_sstream_from_string_view 202306L |
| 618 | # define __cpp_lib_string_subview 202506L | 634 | # define __cpp_lib_string_subview 202506L |
| 619 | # undef __cpp_lib_string_view | 635 | # undef __cpp_lib_string_view |
| 620 | # define __cpp_lib_string_view 202403L | 636 | # define __cpp_lib_string_view 202403L |
| 621 | // # define __cpp_lib_submdspan 202306L | 637 | // # define __cpp_lib_submdspan 202306L |
| 622 | // # define __cpp_lib_text_encoding 202306L | 638 | # define __cpp_lib_text_encoding 202306L |
| 623 | # undef __cpp_lib_to_chars | 639 | # undef __cpp_lib_to_chars |
| 624 | // # define __cpp_lib_to_chars 202306L | 640 | // # define __cpp_lib_to_chars 202306L |
| 625 | // # define __cpp_lib_to_string 202306L | 641 | // # define __cpp_lib_to_string 202306L |
lib/libcxx/include/wchar.h+2| ... | @@ -133,6 +133,8 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, | ... | @@ -133,6 +133,8 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, |
| 133 | # if defined(_CRT_CONST_CORRECT_OVERLOADS) | 133 | # if defined(_CRT_CONST_CORRECT_OVERLOADS) |
| 134 | # define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1 | 134 | # define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1 |
| 135 | # endif | 135 | # endif |
| 136 | # elif _LIBCPP_LIBC_LLVM_LIBC | ||
| 137 | # define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1 | ||
| 136 | # endif | 138 | # endif |
| 137 | 139 | ||
| 138 | # if _LIBCPP_HAS_WIDE_CHARACTERS | 140 | # if _LIBCPP_HAS_WIDE_CHARACTERS |
lib/libcxx/src/algorithm.cpp+2| ... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
| 10 | #include <bit> | 10 | #include <bit> |
| 11 | 11 | ||
| 12 | _LIBCPP_BEGIN_NAMESPACE_STD | 12 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 13 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 13 | 14 | ||
| 14 | template <class Comp, class RandomAccessIterator> | 15 | template <class Comp, class RandomAccessIterator> |
| 15 | void __sort(RandomAccessIterator first, RandomAccessIterator last, Comp comp) { | 16 | void __sort(RandomAccessIterator first, RandomAccessIterator last, Comp comp) { |
| ... | @@ -47,4 +48,5 @@ template void __sort<__less<double>&, double*>(double*, double*, __less<double>& | ... | @@ -47,4 +48,5 @@ template void __sort<__less<double>&, double*>(double*, double*, __less<double>& |
| 47 | template void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&); | 48 | template void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&); |
| 48 | // clang-format on | 49 | // clang-format on |
| 49 | 50 | ||
| 51 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 50 | _LIBCPP_END_NAMESPACE_STD | 52 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/any.cpp+4-2| ... | @@ -19,6 +19,7 @@ const char* bad_any_cast::what() const noexcept { return "bad any cast"; } | ... | @@ -19,6 +19,7 @@ const char* bad_any_cast::what() const noexcept { return "bad any cast"; } |
| 19 | // Preserve std::experimental::any_bad_cast for ABI compatibility | 19 | // Preserve std::experimental::any_bad_cast for ABI compatibility |
| 20 | // Even though it no longer exists in a header file | 20 | // Even though it no longer exists in a header file |
| 21 | _LIBCPP_BEGIN_NAMESPACE_LFTS | 21 | _LIBCPP_BEGIN_NAMESPACE_LFTS |
| 22 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 22 | 23 | ||
| 23 | class _LIBCPP_EXPORTED_FROM_ABI bad_any_cast : public bad_cast { | 24 | class _LIBCPP_EXPORTED_FROM_ABI bad_any_cast : public bad_cast { |
| 24 | public: | 25 | public: |
| ... | @@ -27,6 +28,7 @@ public: | ... | @@ -27,6 +28,7 @@ public: |
| 27 | 28 | ||
| 28 | const char* bad_any_cast::what() const noexcept { return "bad any cast"; } | 29 | const char* bad_any_cast::what() const noexcept { return "bad any cast"; } |
| 29 | 30 | ||
| 30 | #endif | 31 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS |
| 31 | |||
| 32 | _LIBCPP_END_NAMESPACE_LFTS | 32 | _LIBCPP_END_NAMESPACE_LFTS |
| 33 | |||
| 34 | #endif |
lib/libcxx/src/atomic.cpp+163-58| ... | @@ -17,7 +17,19 @@ | ... | @@ -17,7 +17,19 @@ |
| 17 | #include <thread> | 17 | #include <thread> |
| 18 | #include <type_traits> | 18 | #include <type_traits> |
| 19 | 19 | ||
| 20 | #include "include/apple_availability.h" | 20 | // Determine whether to use the public os_sync API on Apple platforms based on the deployment target. |
| 21 | // Otherwise we fall back to the private __ulock API. | ||
| 22 | #if defined(__APPLE__) | ||
| 23 | # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ | ||
| 24 | __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 140400) || \ | ||
| 25 | (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \ | ||
| 26 | __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 170400) || \ | ||
| 27 | (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 170400) || \ | ||
| 28 | (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && \ | ||
| 29 | __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 100400) | ||
| 30 | # define _LIBCPP_USE_OS_SYNC | ||
| 31 | # endif | ||
| 32 | #endif | ||
| 21 | 33 | ||
| 22 | #ifdef __linux__ | 34 | #ifdef __linux__ |
| 23 | 35 | ||
| ... | @@ -51,6 +63,16 @@ | ... | @@ -51,6 +63,16 @@ |
| 51 | # include <memory> | 63 | # include <memory> |
| 52 | # include <windows.h> | 64 | # include <windows.h> |
| 53 | 65 | ||
| 66 | #elif defined(__APPLE__) | ||
| 67 | |||
| 68 | # if defined(_LIBCPP_USE_OS_SYNC) | ||
| 69 | # include <os/os_sync_wait_on_address.h> | ||
| 70 | # endif | ||
| 71 | |||
| 72 | #elif defined(__Fuchsia__) | ||
| 73 | |||
| 74 | # include <zircon/syscalls.h> | ||
| 75 | |||
| 54 | #else // <- Add other operating systems here | 76 | #else // <- Add other operating systems here |
| 55 | 77 | ||
| 56 | // Baseline needs no new headers | 78 | // Baseline needs no new headers |
| ... | @@ -63,6 +85,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -63,6 +85,7 @@ _LIBCPP_PUSH_MACROS |
| 63 | #include <__undef_macros> | 85 | #include <__undef_macros> |
| 64 | 86 | ||
| 65 | _LIBCPP_BEGIN_NAMESPACE_STD | 87 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 88 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 66 | 89 | ||
| 67 | struct NoTimeout {}; | 90 | struct NoTimeout {}; |
| 68 | 91 | ||
| ... | @@ -90,20 +113,64 @@ static void __platform_wake_by_address(void const* __ptr, bool __notify_one) { | ... | @@ -90,20 +113,64 @@ static void __platform_wake_by_address(void const* __ptr, bool __notify_one) { |
| 90 | _LIBCPP_FUTEX(__ptr, FUTEX_WAKE_PRIVATE, __notify_one ? 1 : INT_MAX, 0, 0, 0); | 113 | _LIBCPP_FUTEX(__ptr, FUTEX_WAKE_PRIVATE, __notify_one ? 1 : INT_MAX, 0, 0, 0); |
| 91 | } | 114 | } |
| 92 | 115 | ||
| 93 | #elif defined(__APPLE__) && defined(_LIBCPP_USE_ULOCK) | 116 | #elif defined(__APPLE__) |
| 117 | |||
| 118 | # if defined(_LIBCPP_USE_OS_SYNC) | ||
| 119 | |||
| 120 | template <std::size_t _Size, class MaybeTimeout> | ||
| 121 | static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) { | ||
| 122 | std::uint64_t __value = [__val]() -> std::uint64_t { | ||
| 123 | if constexpr (_Size == 4) { | ||
| 124 | std::uint32_t __result; | ||
| 125 | std::memcpy(&__result, __val, _Size); | ||
| 126 | return __result; | ||
| 127 | } else if constexpr (_Size == 8) { | ||
| 128 | std::uint64_t __result; | ||
| 129 | std::memcpy(&__result, __val, _Size); | ||
| 130 | return __result; | ||
| 131 | } else { | ||
| 132 | static_assert(false, "Can only wait on 8 bytes or 4 bytes value"); | ||
| 133 | } | ||
| 134 | }(); | ||
| 135 | |||
| 136 | if constexpr (is_same_v<MaybeTimeout, NoTimeout>) { | ||
| 137 | os_sync_wait_on_address(const_cast<void*>(__ptr), __value, _Size, OS_SYNC_WAIT_ON_ADDRESS_NONE); | ||
| 138 | } else { | ||
| 139 | // os_sync_wait_on_address_with_timeout returns EINVAL on a 0-ns timeout, so clamp to 1ns | ||
| 140 | // when an already-expired deadline produced a zero-duration timeout. | ||
| 141 | uint64_t __timeout_ns = std::max<uint64_t>(maybe_timeout_ns, 1); | ||
| 142 | os_sync_wait_on_address_with_timeout( | ||
| 143 | const_cast<void*>(__ptr), | ||
| 144 | __value, | ||
| 145 | _Size, | ||
| 146 | OS_SYNC_WAIT_ON_ADDRESS_NONE, | ||
| 147 | OS_CLOCK_MACH_ABSOLUTE_TIME, | ||
| 148 | __timeout_ns); | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | template <std::size_t _Size> | ||
| 153 | static void __platform_wake_by_address(void const* __ptr, bool __notify_one) { | ||
| 154 | static_assert(_Size == 8 || _Size == 4, "Can only wake up on 8 bytes or 4 bytes value"); | ||
| 155 | if (__notify_one) | ||
| 156 | os_sync_wake_by_address_any(const_cast<void*>(__ptr), _Size, OS_SYNC_WAKE_BY_ADDRESS_NONE); | ||
| 157 | else | ||
| 158 | os_sync_wake_by_address_all(const_cast<void*>(__ptr), _Size, OS_SYNC_WAKE_BY_ADDRESS_NONE); | ||
| 159 | } | ||
| 160 | |||
| 161 | # else // !_LIBCPP_USE_OS_SYNC -- fall back to the private __ulock API | ||
| 94 | 162 | ||
| 95 | extern "C" int __ulock_wait( | 163 | extern "C" int __ulock_wait( |
| 96 | uint32_t operation, void* addr, uint64_t value, uint32_t timeout); /* timeout is specified in microseconds */ | 164 | uint32_t operation, void* addr, uint64_t value, uint32_t timeout); /* timeout is specified in microseconds */ |
| 97 | extern "C" int __ulock_wake(uint32_t operation, void* addr, uint64_t wake_value); | 165 | extern "C" int __ulock_wake(uint32_t operation, void* addr, uint64_t wake_value); |
| 98 | 166 | ||
| 99 | // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/ulock.h#L82 | 167 | // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/ulock.h#L82 |
| 100 | # define UL_COMPARE_AND_WAIT 1 | 168 | # define UL_COMPARE_AND_WAIT 1 |
| 101 | # define UL_COMPARE_AND_WAIT64 5 | 169 | # define UL_COMPARE_AND_WAIT64 5 |
| 102 | # define ULF_WAKE_ALL 0x00000100 | 170 | # define ULF_WAKE_ALL 0x00000100 |
| 103 | 171 | ||
| 104 | template <std::size_t _Size, class MaybeTimeout> | 172 | template <std::size_t _Size, class MaybeTimeout> |
| 105 | static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) { | 173 | static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) { |
| 106 | static_assert(_Size == 8 || _Size == 4, "Can only wait on 8 bytes or 4 bytes value"); | ||
| 107 | auto __timeout_us = [&] { | 174 | auto __timeout_us = [&] { |
| 108 | if constexpr (is_same_v<MaybeTimeout, NoTimeout>) { | 175 | if constexpr (is_same_v<MaybeTimeout, NoTimeout>) { |
| 109 | return uint32_t(0); | 176 | return uint32_t(0); |
| ... | @@ -111,17 +178,23 @@ static void __platform_wait_on_address(void const* __ptr, void const* __val, May | ... | @@ -111,17 +178,23 @@ static void __platform_wait_on_address(void const* __ptr, void const* __val, May |
| 111 | return std::max(static_cast<uint32_t>(maybe_timeout_ns / 1000), uint32_t(1)); | 178 | return std::max(static_cast<uint32_t>(maybe_timeout_ns / 1000), uint32_t(1)); |
| 112 | } | 179 | } |
| 113 | }(); | 180 | }(); |
| 114 | if constexpr (_Size == 4) { | 181 | |
| 115 | alignas(uint32_t) char buffer[_Size]; | 182 | std::uint64_t __value = [__val]() -> std::uint64_t { |
| 116 | std::memcpy(&buffer, const_cast<const void*>(__val), _Size); | 183 | if constexpr (_Size == 4) { |
| 117 | __ulock_wait( | 184 | std::uint32_t __result; |
| 118 | UL_COMPARE_AND_WAIT, const_cast<void*>(__ptr), *reinterpret_cast<uint32_t const*>(&buffer), __timeout_us); | 185 | std::memcpy(&__result, __val, _Size); |
| 119 | } else { | 186 | return __result; |
| 120 | alignas(uint64_t) char buffer[_Size]; | 187 | } else if constexpr (_Size == 8) { |
| 121 | std::memcpy(&buffer, const_cast<const void*>(__val), _Size); | 188 | std::uint64_t __result; |
| 122 | __ulock_wait( | 189 | std::memcpy(&__result, __val, _Size); |
| 123 | UL_COMPARE_AND_WAIT64, const_cast<void*>(__ptr), *reinterpret_cast<uint64_t const*>(&buffer), __timeout_us); | 190 | return __result; |
| 124 | } | 191 | } else { |
| 192 | static_assert(false, "Can only wait on 8 bytes or 4 bytes value"); | ||
| 193 | } | ||
| 194 | }(); | ||
| 195 | |||
| 196 | __ulock_wait( | ||
| 197 | _Size == 4 ? UL_COMPARE_AND_WAIT : UL_COMPARE_AND_WAIT64, const_cast<void*>(__ptr), __value, __timeout_us); | ||
| 125 | } | 198 | } |
| 126 | 199 | ||
| 127 | template <std::size_t _Size> | 200 | template <std::size_t _Size> |
| ... | @@ -134,6 +207,8 @@ static void __platform_wake_by_address(void const* __ptr, bool __notify_one) { | ... | @@ -134,6 +207,8 @@ static void __platform_wake_by_address(void const* __ptr, bool __notify_one) { |
| 134 | __ulock_wake(UL_COMPARE_AND_WAIT64 | (__notify_one ? 0 : ULF_WAKE_ALL), const_cast<void*>(__ptr), 0); | 207 | __ulock_wake(UL_COMPARE_AND_WAIT64 | (__notify_one ? 0 : ULF_WAKE_ALL), const_cast<void*>(__ptr), 0); |
| 135 | } | 208 | } |
| 136 | 209 | ||
| 210 | # endif // _LIBCPP_USE_OS_SYNC | ||
| 211 | |||
| 137 | #elif defined(__FreeBSD__) && __SIZEOF_LONG__ == 8 | 212 | #elif defined(__FreeBSD__) && __SIZEOF_LONG__ == 8 |
| 138 | /* | 213 | /* |
| 139 | * Since __cxx_contention_t is int64_t even on 32bit FreeBSD | 214 | * Since __cxx_contention_t is int64_t even on 32bit FreeBSD |
| ... | @@ -254,6 +329,37 @@ static void __platform_wake_by_address(void const* __ptr, bool __notify_one) { | ... | @@ -254,6 +329,37 @@ static void __platform_wake_by_address(void const* __ptr, bool __notify_one) { |
| 254 | } | 329 | } |
| 255 | } | 330 | } |
| 256 | 331 | ||
| 332 | #elif defined(__Fuchsia__) | ||
| 333 | |||
| 334 | template <std::size_t _Size> | ||
| 335 | static inline zx_futex_t const* __get_zx_futex(void const* __ptr) { | ||
| 336 | static_assert(_Size == sizeof(zx_futex_t), "Can only wait/wake on zx_futex_t-compatible value"); | ||
| 337 | |||
| 338 | // Implicitly link against the vDSO system call ABI without requiring the | ||
| 339 | // final link to specify -lzircon explicitly when statically linking libc++. | ||
| 340 | # pragma comment(lib, "zircon") | ||
| 341 | |||
| 342 | return reinterpret_cast<zx_futex_t const*>(__ptr); | ||
| 343 | } | ||
| 344 | |||
| 345 | template <std::size_t _Size, class MaybeTimeout> | ||
| 346 | static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) { | ||
| 347 | zx_futex_t val; | ||
| 348 | std::memcpy(&val, __val, _Size); | ||
| 349 | zx_instant_mono_t deadline; | ||
| 350 | if constexpr (is_same_v<MaybeTimeout, NoTimeout>) { | ||
| 351 | deadline = ZX_TIME_INFINITE; | ||
| 352 | } else { | ||
| 353 | deadline = _zx_deadline_after(maybe_timeout_ns); | ||
| 354 | } | ||
| 355 | _zx_futex_wait(__get_zx_futex<_Size>(__ptr), val, ZX_HANDLE_INVALID, deadline); | ||
| 356 | } | ||
| 357 | |||
| 358 | template <std::size_t _Size> | ||
| 359 | static void __platform_wake_by_address(void const* __ptr, bool __notify_one) { | ||
| 360 | _zx_futex_wake(__get_zx_futex<_Size>(__ptr), __notify_one ? 1 : UINT32_MAX); | ||
| 361 | } | ||
| 362 | |||
| 257 | #else // <- Add other operating systems here | 363 | #else // <- Add other operating systems here |
| 258 | 364 | ||
| 259 | // Baseline is just a timed backoff | 365 | // Baseline is just a timed backoff |
| ... | @@ -308,45 +414,41 @@ static constexpr size_t __contention_table_size = (1 << 8); /* < there's no magi | ... | @@ -308,45 +414,41 @@ static constexpr size_t __contention_table_size = (1 << 8); /* < there's no magi |
| 308 | 414 | ||
| 309 | static constexpr hash<void const*> __contention_hasher; | 415 | static constexpr hash<void const*> __contention_hasher; |
| 310 | 416 | ||
| 311 | // Waiter count table for all atomics with the correct size that use itself as the wait/notify address. | 417 | // Unified contention table shared by both the native path (atomics whose size matches the platform |
| 312 | 418 | // wait size and are waited on directly) and the global path (atomics with the wrong size, which use | |
| 313 | struct alignas( | 419 | // the global table's atomic as the wait/notify address). The native path only reads/writes the native |
| 314 | std::hardware_constructive_interference_size) /* aim to avoid false sharing */ __contention_state_native { | 420 | // waiter count, and the global path uses the global waiter count and the platform state. |
| 315 | __cxx_atomic_contention_t __waiter_count; | 421 | // |
| 316 | constexpr __contention_state_native() : __waiter_count(0) {} | 422 | // We use a single table for both the native and non-native states to minimize the size impact, since |
| 317 | }; | 423 | // we would have plenty of unused padding otherwise. This technically means that if both a native and |
| 318 | 424 | // a non-native atomic fall into the same bucket and are reading/writing waiter counts on the same | |
| 319 | static __contention_state_native __contention_table_native[__contention_table_size]; | 425 | // cache line, we would end up in a "false-sharing" situation. However, in practice, it would require |
| 320 | 426 | // both native and non-native atomics to be used concurrently, and to fall in the same bucket, which | |
| 321 | static __cxx_atomic_contention_t* __get_native_waiter_count(void const* p) { | 427 | // is expected to be unlikely. |
| 322 | return &__contention_table_native[__contention_hasher(p) & (__contention_table_size - 1)].__waiter_count; | 428 | struct alignas(std::hardware_destructive_interference_size) /* aim to avoid false sharing */ __contention_state { |
| 323 | } | 429 | __cxx_atomic_contention_t __waiter_count_native; |
| 324 | 430 | __cxx_atomic_contention_t __waiter_count_global; | |
| 325 | // Global contention table for all atomics with the wrong size that use the global table's atomic as wait/notify | ||
| 326 | // address. | ||
| 327 | |||
| 328 | struct alignas( | ||
| 329 | std::hardware_constructive_interference_size) /* aim to avoid false sharing */ __contention_state_global { | ||
| 330 | __cxx_atomic_contention_t __waiter_count; | ||
| 331 | __cxx_atomic_contention_t __platform_state; | 431 | __cxx_atomic_contention_t __platform_state; |
| 332 | constexpr __contention_state_global() : __waiter_count(0), __platform_state(0) {} | 432 | constexpr __contention_state() : __waiter_count_native(0), __waiter_count_global(0), __platform_state(0) {} |
| 333 | }; | 433 | }; |
| 334 | 434 | ||
| 335 | static __contention_state_global __contention_table_global[__contention_table_size]; | 435 | static constinit __contention_state __contention_table[__contention_table_size]; |
| 336 | 436 | ||
| 337 | static __contention_state_global* __get_global_contention_state(void const* p) { | 437 | static __contention_state* __get_contention_state(void const* p) { |
| 338 | return &__contention_table_global[__contention_hasher(p) & (__contention_table_size - 1)]; | 438 | return &__contention_table[__contention_hasher(p) & (__contention_table_size - 1)]; |
| 339 | } | 439 | } |
| 340 | 440 | ||
| 341 | /* When the incoming atomic is the wrong size for the platform wait size, need to | 441 | /* When the incoming atomic is the wrong size for the platform wait size, need to |
| 342 | launder the value sequence through an atomic from our table. */ | 442 | launder the value sequence through an atomic from our table. */ |
| 343 | 443 | ||
| 344 | static void __atomic_notify_global_table(void const* __location) { | 444 | static void __atomic_notify_global_table(void const* __location) { |
| 345 | auto const __entry = __get_global_contention_state(__location); | 445 | auto const __entry = __get_contention_state(__location); |
| 346 | // The value sequence laundering happens on the next line below. | 446 | // The value sequence laundering happens on the next line below. |
| 347 | __cxx_atomic_fetch_add(&__entry->__platform_state, __cxx_contention_t(1), memory_order_seq_cst); | 447 | __cxx_atomic_fetch_add(&__entry->__platform_state, __cxx_contention_t(1), memory_order_seq_cst); |
| 348 | __contention_notify<sizeof(__cxx_atomic_contention_t)>( | 448 | __contention_notify<sizeof(__cxx_atomic_contention_t)>( |
| 349 | &__entry->__waiter_count, &__entry->__platform_state, false /* when laundering, we can't handle notify_one */); | 449 | &__entry->__waiter_count_global, |
| 450 | &__entry->__platform_state, | ||
| 451 | false /* when laundering, we can't handle notify_one */); | ||
| 350 | } | 452 | } |
| 351 | 453 | ||
| 352 | // ============================= | 454 | // ============================= |
| ... | @@ -355,22 +457,22 @@ static void __atomic_notify_global_table(void const* __location) { | ... | @@ -355,22 +457,22 @@ static void __atomic_notify_global_table(void const* __location) { |
| 355 | 457 | ||
| 356 | // global | 458 | // global |
| 357 | _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __atomic_monitor_global(void const* __location) noexcept { | 459 | _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __atomic_monitor_global(void const* __location) noexcept { |
| 358 | auto const __entry = __get_global_contention_state(__location); | 460 | auto const __entry = __get_contention_state(__location); |
| 359 | return __cxx_atomic_load(&__entry->__platform_state, memory_order_acquire); | 461 | return __cxx_atomic_load(&__entry->__platform_state, memory_order_acquire); |
| 360 | } | 462 | } |
| 361 | 463 | ||
| 362 | _LIBCPP_EXPORTED_FROM_ABI void | 464 | _LIBCPP_EXPORTED_FROM_ABI void |
| 363 | __atomic_wait_global_table(void const* __location, __cxx_contention_t __old_value) noexcept { | 465 | __atomic_wait_global_table(void const* __location, __cxx_contention_t __old_value) noexcept { |
| 364 | auto const __entry = __get_global_contention_state(__location); | 466 | auto const __entry = __get_contention_state(__location); |
| 365 | __contention_wait<sizeof(__cxx_atomic_contention_t)>( | 467 | __contention_wait<sizeof(__cxx_atomic_contention_t)>( |
| 366 | &__entry->__waiter_count, &__entry->__platform_state, &__old_value, NoTimeout{}); | 468 | &__entry->__waiter_count_global, &__entry->__platform_state, &__old_value, NoTimeout{}); |
| 367 | } | 469 | } |
| 368 | 470 | ||
| 369 | _LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_global_table_with_timeout( | 471 | _LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_global_table_with_timeout( |
| 370 | void const* __location, __cxx_contention_t __old_value, uint64_t __timeout_ns) _NOEXCEPT { | 472 | void const* __location, __cxx_contention_t __old_value, uint64_t __timeout_ns) _NOEXCEPT { |
| 371 | auto const __entry = __get_global_contention_state(__location); | 473 | auto const __entry = __get_contention_state(__location); |
| 372 | __contention_wait<sizeof(__cxx_atomic_contention_t)>( | 474 | __contention_wait<sizeof(__cxx_atomic_contention_t)>( |
| 373 | &__entry->__waiter_count, &__entry->__platform_state, &__old_value, __timeout_ns); | 475 | &__entry->__waiter_count_global, &__entry->__platform_state, &__old_value, __timeout_ns); |
| 374 | } | 476 | } |
| 375 | 477 | ||
| 376 | _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one_global_table(void const* __location) noexcept { | 478 | _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one_global_table(void const* __location) noexcept { |
| ... | @@ -385,23 +487,25 @@ _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_global_table(void const* __lo | ... | @@ -385,23 +487,25 @@ _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_global_table(void const* __lo |
| 385 | 487 | ||
| 386 | template <std::size_t _Size> | 488 | template <std::size_t _Size> |
| 387 | _LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_native(void const* __address, void const* __old_value) noexcept { | 489 | _LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_native(void const* __address, void const* __old_value) noexcept { |
| 388 | __contention_wait<_Size>(__get_native_waiter_count(__address), __address, __old_value, NoTimeout{}); | 490 | __contention_wait<_Size>( |
| 491 | &__get_contention_state(__address)->__waiter_count_native, __address, __old_value, NoTimeout{}); | ||
| 389 | } | 492 | } |
| 390 | 493 | ||
| 391 | template <std::size_t _Size> | 494 | template <std::size_t _Size> |
| 392 | _LIBCPP_EXPORTED_FROM_ABI void | 495 | _LIBCPP_EXPORTED_FROM_ABI void |
| 393 | __atomic_wait_native_with_timeout(void const* __address, void const* __old_value, uint64_t __timeout_ns) noexcept { | 496 | __atomic_wait_native_with_timeout(void const* __address, void const* __old_value, uint64_t __timeout_ns) noexcept { |
| 394 | __contention_wait<_Size>(__get_native_waiter_count(__address), __address, __old_value, __timeout_ns); | 497 | __contention_wait<_Size>( |
| 498 | &__get_contention_state(__address)->__waiter_count_native, __address, __old_value, __timeout_ns); | ||
| 395 | } | 499 | } |
| 396 | 500 | ||
| 397 | template <std::size_t _Size> | 501 | template <std::size_t _Size> |
| 398 | _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one_native(void const* __location) noexcept { | 502 | _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one_native(void const* __location) noexcept { |
| 399 | __contention_notify<_Size>(__get_native_waiter_count(__location), __location, true); | 503 | __contention_notify<_Size>(&__get_contention_state(__location)->__waiter_count_native, __location, true); |
| 400 | } | 504 | } |
| 401 | 505 | ||
| 402 | template <std::size_t _Size> | 506 | template <std::size_t _Size> |
| 403 | _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_native(void const* __location) noexcept { | 507 | _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_native(void const* __location) noexcept { |
| 404 | __contention_notify<_Size>(__get_native_waiter_count(__location), __location, false); | 508 | __contention_notify<_Size>(&__get_contention_state(__location)->__waiter_count_native, __location, false); |
| 405 | } | 509 | } |
| 406 | 510 | ||
| 407 | // ================================================== | 511 | // ================================================== |
| ... | @@ -452,34 +556,34 @@ _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile* __lo | ... | @@ -452,34 +556,34 @@ _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile* __lo |
| 452 | } | 556 | } |
| 453 | 557 | ||
| 454 | _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile* __location) noexcept { | 558 | _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile* __location) noexcept { |
| 455 | auto const __entry = __get_global_contention_state(const_cast<void const*>(__location)); | 559 | auto const __entry = __get_contention_state(const_cast<void const*>(__location)); |
| 456 | return __cxx_atomic_load(&__entry->__platform_state, memory_order_acquire); | 560 | return __cxx_atomic_load(&__entry->__platform_state, memory_order_acquire); |
| 457 | } | 561 | } |
| 458 | 562 | ||
| 459 | _LIBCPP_EXPORTED_FROM_ABI void | 563 | _LIBCPP_EXPORTED_FROM_ABI void |
| 460 | __libcpp_atomic_wait(void const volatile* __location, __cxx_contention_t __old_value) noexcept { | 564 | __libcpp_atomic_wait(void const volatile* __location, __cxx_contention_t __old_value) noexcept { |
| 461 | auto const __entry = __get_global_contention_state(const_cast<void const*>(__location)); | 565 | auto const __entry = __get_contention_state(const_cast<void const*>(__location)); |
| 462 | __contention_wait<sizeof(__cxx_atomic_contention_t)>( | 566 | __contention_wait<sizeof(__cxx_atomic_contention_t)>( |
| 463 | &__entry->__waiter_count, &__entry->__platform_state, &__old_value, NoTimeout{}); | 567 | &__entry->__waiter_count_global, &__entry->__platform_state, &__old_value, NoTimeout{}); |
| 464 | } | 568 | } |
| 465 | 569 | ||
| 466 | _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile* __location) noexcept { | 570 | _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile* __location) noexcept { |
| 467 | auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location)); | 571 | auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location)); |
| 468 | __contention_notify<sizeof(__cxx_atomic_contention_t)>( | 572 | __contention_notify<sizeof(__cxx_atomic_contention_t)>( |
| 469 | __get_native_waiter_count(__location_cast), __location_cast, true); | 573 | &__get_contention_state(__location_cast)->__waiter_count_native, __location_cast, true); |
| 470 | } | 574 | } |
| 471 | 575 | ||
| 472 | _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile* __location) noexcept { | 576 | _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile* __location) noexcept { |
| 473 | auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location)); | 577 | auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location)); |
| 474 | __contention_notify<sizeof(__cxx_atomic_contention_t)>( | 578 | __contention_notify<sizeof(__cxx_atomic_contention_t)>( |
| 475 | __get_native_waiter_count(__location_cast), __location_cast, false); | 579 | &__get_contention_state(__location_cast)->__waiter_count_native, __location_cast, false); |
| 476 | } | 580 | } |
| 477 | 581 | ||
| 478 | _LIBCPP_EXPORTED_FROM_ABI void | 582 | _LIBCPP_EXPORTED_FROM_ABI void |
| 479 | __libcpp_atomic_wait(__cxx_atomic_contention_t const volatile* __location, __cxx_contention_t __old_value) noexcept { | 583 | __libcpp_atomic_wait(__cxx_atomic_contention_t const volatile* __location, __cxx_contention_t __old_value) noexcept { |
| 480 | auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location)); | 584 | auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location)); |
| 481 | __contention_wait<sizeof(__cxx_atomic_contention_t)>( | 585 | __contention_wait<sizeof(__cxx_atomic_contention_t)>( |
| 482 | __get_native_waiter_count(__location_cast), __location_cast, &__old_value, NoTimeout{}); | 586 | &__get_contention_state(__location_cast)->__waiter_count_native, __location_cast, &__old_value, NoTimeout{}); |
| 483 | } | 587 | } |
| 484 | 588 | ||
| 485 | // this function is even unused in the old ABI | 589 | // this function is even unused in the old ABI |
| ... | @@ -490,6 +594,7 @@ __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) no | ... | @@ -490,6 +594,7 @@ __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) no |
| 490 | 594 | ||
| 491 | _LIBCPP_DIAGNOSTIC_POP | 595 | _LIBCPP_DIAGNOSTIC_POP |
| 492 | 596 | ||
| 597 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 493 | _LIBCPP_END_NAMESPACE_STD | 598 | _LIBCPP_END_NAMESPACE_STD |
| 494 | 599 | ||
| 495 | _LIBCPP_POP_MACROS | 600 | _LIBCPP_POP_MACROS |
lib/libcxx/src/barrier.cpp+2| ... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
| 10 | #include <thread> | 10 | #include <thread> |
| 11 | 11 | ||
| 12 | _LIBCPP_BEGIN_NAMESPACE_STD | 12 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 13 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 13 | 14 | ||
| 14 | class __barrier_algorithm_base { | 15 | class __barrier_algorithm_base { |
| 15 | public: | 16 | public: |
| ... | @@ -69,4 +70,5 @@ __destroy_barrier_algorithm_base(_LIBCPP_NOESCAPE __barrier_algorithm_base* __ba | ... | @@ -69,4 +70,5 @@ __destroy_barrier_algorithm_base(_LIBCPP_NOESCAPE __barrier_algorithm_base* __ba |
| 69 | delete __barrier; | 70 | delete __barrier; |
| 70 | } | 71 | } |
| 71 | 72 | ||
| 73 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 72 | _LIBCPP_END_NAMESPACE_STD | 74 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/call_once.cpp+2| ... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
| 17 | #include "include/atomic_support.h" | 17 | #include "include/atomic_support.h" |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 20 | 21 | ||
| 21 | // If dispatch_once_f ever handles C++ exceptions, and if one can get to it | 22 | // If dispatch_once_f ever handles C++ exceptions, and if one can get to it |
| 22 | // without illegal macros (unexpected macros not beginning with _UpperCase or | 23 | // without illegal macros (unexpected macros not beginning with _UpperCase or |
| ... | @@ -68,4 +69,5 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)( | ... | @@ -68,4 +69,5 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)( |
| 68 | #endif // !_LIBCPP_HAS_THREADS | 69 | #endif // !_LIBCPP_HAS_THREADS |
| 69 | } | 70 | } |
| 70 | 71 | ||
| 72 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 71 | _LIBCPP_END_NAMESPACE_STD | 73 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/charconv.cpp+3| ... | @@ -13,6 +13,7 @@ | ... | @@ -13,6 +13,7 @@ |
| 13 | #include "include/to_chars_floating_point.h" | 13 | #include "include/to_chars_floating_point.h" |
| 14 | 14 | ||
| 15 | _LIBCPP_BEGIN_NAMESPACE_STD | 15 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 16 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 16 | 17 | ||
| 17 | #if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15 | 18 | #if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15 |
| 18 | 19 | ||
| ... | @@ -89,4 +90,6 @@ template __from_chars_result<float> __from_chars_floating_point( | ... | @@ -89,4 +90,6 @@ template __from_chars_result<float> __from_chars_floating_point( |
| 89 | 90 | ||
| 90 | template __from_chars_result<double> __from_chars_floating_point( | 91 | template __from_chars_result<double> __from_chars_floating_point( |
| 91 | _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt); | 92 | _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt); |
| 93 | |||
| 94 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 92 | _LIBCPP_END_NAMESPACE_STD | 95 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/chrono.cpp+3-2| ... | @@ -20,7 +20,6 @@ | ... | @@ -20,7 +20,6 @@ |
| 20 | # include <__support/ibm/gettod_zos.h> // gettimeofdayMonotonic | 20 | # include <__support/ibm/gettod_zos.h> // gettimeofdayMonotonic |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | #include "include/apple_availability.h" | ||
| 24 | #include <time.h> // clock_gettime and CLOCK_{MONOTONIC,REALTIME,MONOTONIC_RAW} | 23 | #include <time.h> // clock_gettime and CLOCK_{MONOTONIC,REALTIME,MONOTONIC_RAW} |
| 25 | 24 | ||
| 26 | #if __has_include(<unistd.h>) | 25 | #if __has_include(<unistd.h>) |
| ... | @@ -31,7 +30,7 @@ | ... | @@ -31,7 +30,7 @@ |
| 31 | # include <sys/time.h> // for gettimeofday and timeval | 30 | # include <sys/time.h> // for gettimeofday and timeval |
| 32 | #endif | 31 | #endif |
| 33 | 32 | ||
| 34 | #if defined(__LLVM_LIBC__) | 33 | #if _LIBCPP_LIBC_LLVM_LIBC |
| 35 | # define _LIBCPP_HAS_TIMESPEC_GET | 34 | # define _LIBCPP_HAS_TIMESPEC_GET |
| 36 | #endif | 35 | #endif |
| 37 | 36 | ||
| ... | @@ -64,6 +63,7 @@ | ... | @@ -64,6 +63,7 @@ |
| 64 | #endif | 63 | #endif |
| 65 | 64 | ||
| 66 | _LIBCPP_BEGIN_NAMESPACE_STD | 65 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 66 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 67 | 67 | ||
| 68 | namespace chrono { | 68 | namespace chrono { |
| 69 | 69 | ||
| ... | @@ -262,4 +262,5 @@ steady_clock::time_point steady_clock::now() noexcept { return __libcpp_steady_c | ... | @@ -262,4 +262,5 @@ steady_clock::time_point steady_clock::now() noexcept { return __libcpp_steady_c |
| 262 | 262 | ||
| 263 | } // namespace chrono | 263 | } // namespace chrono |
| 264 | 264 | ||
| 265 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 265 | _LIBCPP_END_NAMESPACE_STD | 266 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/condition_variable.cpp+2| ... | @@ -23,6 +23,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -23,6 +23,7 @@ _LIBCPP_PUSH_MACROS |
| 23 | #include <__undef_macros> | 23 | #include <__undef_macros> |
| 24 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 26 | 27 | ||
| 27 | // ~condition_variable is defined elsewhere. | 28 | // ~condition_variable is defined elsewhere. |
| 28 | 29 | ||
| ... | @@ -72,6 +73,7 @@ void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk) | ... | @@ -72,6 +73,7 @@ void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk) |
| 72 | __thread_local_data()->notify_all_at_thread_exit(&cond, lk.release()); | 73 | __thread_local_data()->notify_all_at_thread_exit(&cond, lk.release()); |
| 73 | } | 74 | } |
| 74 | 75 | ||
| 76 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 75 | _LIBCPP_END_NAMESPACE_STD | 77 | _LIBCPP_END_NAMESPACE_STD |
| 76 | 78 | ||
| 77 | _LIBCPP_POP_MACROS | 79 | _LIBCPP_POP_MACROS |
lib/libcxx/src/condition_variable_destructor.cpp+2| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 22 | 23 | ||
| 23 | #ifdef NEEDS_CONDVAR_DESTRUCTOR | 24 | #ifdef NEEDS_CONDVAR_DESTRUCTOR |
| 24 | 25 | ||
| ... | @@ -37,4 +38,5 @@ public: | ... | @@ -37,4 +38,5 @@ public: |
| 37 | condition_variable::~condition_variable() { __libcpp_condvar_destroy(&__cv_); } | 38 | condition_variable::~condition_variable() { __libcpp_condvar_destroy(&__cv_); } |
| 38 | #endif | 39 | #endif |
| 39 | 40 | ||
| 41 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 40 | _LIBCPP_END_NAMESPACE_STD | 42 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/error_category.cpp+2| ... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
| 17 | #include <system_error> | 17 | #include <system_error> |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 20 | 21 | ||
| 21 | // class error_category | 22 | // class error_category |
| 22 | 23 | ||
| ... | @@ -36,4 +37,5 @@ bool error_category::equivalent(const error_code& code, int condition) const noe | ... | @@ -36,4 +37,5 @@ bool error_category::equivalent(const error_code& code, int condition) const noe |
| 36 | return *this == code.category() && code.value() == condition; | 37 | return *this == code.category() && code.value() == condition; |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 40 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 39 | _LIBCPP_END_NAMESPACE_STD | 41 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/expected.cpp+4| ... | @@ -9,5 +9,9 @@ | ... | @@ -9,5 +9,9 @@ |
| 9 | #include <expected> | 9 | #include <expected> |
| 10 | 10 | ||
| 11 | _LIBCPP_BEGIN_NAMESPACE_STD | 11 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 12 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 13 | |||
| 12 | const char* bad_expected_access<void>::what() const noexcept { return "bad access to std::expected"; } | 14 | const char* bad_expected_access<void>::what() const noexcept { return "bad access to std::expected"; } |
| 15 | |||
| 16 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 13 | _LIBCPP_END_NAMESPACE_STD | 17 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/experimental/chrono_exception.cpp+2| ... | @@ -9,6 +9,7 @@ | ... | @@ -9,6 +9,7 @@ |
| 9 | #include <chrono> | 9 | #include <chrono> |
| 10 | 10 | ||
| 11 | _LIBCPP_BEGIN_NAMESPACE_STD | 11 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 12 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 12 | 13 | ||
| 13 | namespace chrono { | 14 | namespace chrono { |
| 14 | 15 | ||
| ... | @@ -19,4 +20,5 @@ _LIBCPP_EXPORTED_FROM_ABI ambiguous_local_time::~ambiguous_local_time() = defaul | ... | @@ -19,4 +20,5 @@ _LIBCPP_EXPORTED_FROM_ABI ambiguous_local_time::~ambiguous_local_time() = defaul |
| 19 | 20 | ||
| 20 | } // namespace chrono | 21 | } // namespace chrono |
| 21 | 22 | ||
| 23 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 22 | _LIBCPP_END_NAMESPACE_STD | 24 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/experimental/include/tzdb/tzdb_private.h+2| ... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
| 16 | #include "types_private.h" | 16 | #include "types_private.h" |
| 17 | 17 | ||
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 19 | 20 | ||
| 20 | namespace chrono { | 21 | namespace chrono { |
| 21 | 22 | ||
| ... | @@ -23,6 +24,7 @@ void __init_tzdb(tzdb& __tzdb, __tz::__rules_storage_type& __rules); | ... | @@ -23,6 +24,7 @@ void __init_tzdb(tzdb& __tzdb, __tz::__rules_storage_type& __rules); |
| 23 | 24 | ||
| 24 | } // namespace chrono | 25 | } // namespace chrono |
| 25 | 26 | ||
| 27 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 26 | _LIBCPP_END_NAMESPACE_STD | 28 | _LIBCPP_END_NAMESPACE_STD |
| 27 | 29 | ||
| 28 | #endif // _LIBCPP_SRC_INCLUDE_TZDB_TZ_PRIVATE_H | 30 | #endif // _LIBCPP_SRC_INCLUDE_TZDB_TZ_PRIVATE_H |
lib/libcxx/src/experimental/log_hardening_failure.cpp+2| ... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
| 15 | #endif // __BIONIC__ | 15 | #endif // __BIONIC__ |
| 16 | 16 | ||
| 17 | _LIBCPP_BEGIN_NAMESPACE_STD | 17 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 18 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 18 | 19 | ||
| 19 | void __log_hardening_failure(const char* message) noexcept { | 20 | void __log_hardening_failure(const char* message) noexcept { |
| 20 | // Always log the message to `stderr` in case the platform-specific system calls fail. | 21 | // Always log the message to `stderr` in case the platform-specific system calls fail. |
| ... | @@ -28,4 +29,5 @@ void __log_hardening_failure(const char* message) noexcept { | ... | @@ -28,4 +29,5 @@ void __log_hardening_failure(const char* message) noexcept { |
| 28 | #endif | 29 | #endif |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 32 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 31 | _LIBCPP_END_NAMESPACE_STD | 33 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/experimental/time_zone.cpp+2-6| ... | @@ -55,6 +55,7 @@ | ... | @@ -55,6 +55,7 @@ |
| 55 | #endif | 55 | #endif |
| 56 | 56 | ||
| 57 | _LIBCPP_BEGIN_NAMESPACE_STD | 57 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 58 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 58 | 59 | ||
| 59 | #ifdef PRINT | 60 | #ifdef PRINT |
| 60 | template <> | 61 | template <> |
| ... | @@ -209,8 +210,6 @@ __format(const __tz::__continuation& __continuation, const string& __letters, se | ... | @@ -209,8 +210,6 @@ __format(const __tz::__continuation& __continuation, const string& __letters, se |
| 209 | return chrono::seconds{0}; | 210 | return chrono::seconds{0}; |
| 210 | else | 211 | else |
| 211 | static_assert(false); | 212 | static_assert(false); |
| 212 | |||
| 213 | std::__libcpp_unreachable(); | ||
| 214 | }, | 213 | }, |
| 215 | __continuation.__rules); | 214 | __continuation.__rules); |
| 216 | 215 | ||
| ... | @@ -235,8 +234,6 @@ __format(const __tz::__continuation& __continuation, const string& __letters, se | ... | @@ -235,8 +234,6 @@ __format(const __tz::__continuation& __continuation, const string& __letters, se |
| 235 | return __value(__year, __month); | 234 | return __value(__year, __month); |
| 236 | else | 235 | else |
| 237 | static_assert(false); | 236 | static_assert(false); |
| 238 | |||
| 239 | std::__libcpp_unreachable(); | ||
| 240 | }, | 237 | }, |
| 241 | __on); | 238 | __on); |
| 242 | } | 239 | } |
| ... | @@ -698,8 +695,6 @@ __get_sys_info(sys_seconds __time, | ... | @@ -698,8 +695,6 @@ __get_sys_info(sys_seconds __time, |
| 698 | return chrono::__get_sys_info_basic(__time, __continuation_begin, __continuation, __value.__time); | 695 | return chrono::__get_sys_info_basic(__time, __continuation_begin, __continuation, __value.__time); |
| 699 | else | 696 | else |
| 700 | static_assert(false); | 697 | static_assert(false); |
| 701 | |||
| 702 | std::__libcpp_unreachable(); | ||
| 703 | }, | 698 | }, |
| 704 | __continuation.__rules); | 699 | __continuation.__rules); |
| 705 | } | 700 | } |
| ... | @@ -1061,4 +1056,5 @@ time_zone::__get_info(local_seconds __local_time) const { | ... | @@ -1061,4 +1056,5 @@ time_zone::__get_info(local_seconds __local_time) const { |
| 1061 | 1056 | ||
| 1062 | } // namespace chrono | 1057 | } // namespace chrono |
| 1063 | 1058 | ||
| 1059 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 1064 | _LIBCPP_END_NAMESPACE_STD | 1060 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/experimental/tzdb.cpp+3-1| ... | @@ -46,6 +46,7 @@ | ... | @@ -46,6 +46,7 @@ |
| 46 | // TODO TZDB Implement the Windows mapping in tzdb::current_zone | 46 | // TODO TZDB Implement the Windows mapping in tzdb::current_zone |
| 47 | 47 | ||
| 48 | _LIBCPP_BEGIN_NAMESPACE_STD | 48 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 49 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 49 | 50 | ||
| 50 | namespace chrono { | 51 | namespace chrono { |
| 51 | 52 | ||
| ... | @@ -53,7 +54,7 @@ _LIBCPP_DIAGNOSTIC_PUSH | ... | @@ -53,7 +54,7 @@ _LIBCPP_DIAGNOSTIC_PUSH |
| 53 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes") | 54 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes") |
| 54 | // This function is weak so it can be overriden in the tests. The | 55 | // This function is weak so it can be overriden in the tests. The |
| 55 | // declaration is in the test header test/support/test_tzdb.h | 56 | // declaration is in the test header test/support/test_tzdb.h |
| 56 | _LIBCPP_WEAK string_view __libcpp_tzdb_directory() { | 57 | [[gnu::weak]] string_view __libcpp_tzdb_directory() { |
| 57 | #if defined(__linux__) | 58 | #if defined(__linux__) |
| 58 | return "/usr/share/zoneinfo/"; | 59 | return "/usr/share/zoneinfo/"; |
| 59 | #else | 60 | #else |
| ... | @@ -825,4 +826,5 @@ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string remote_version() { | ... | @@ -825,4 +826,5 @@ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string remote_version() { |
| 825 | 826 | ||
| 826 | } // namespace chrono | 827 | } // namespace chrono |
| 827 | 828 | ||
| 829 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 828 | _LIBCPP_END_NAMESPACE_STD | 830 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/experimental/tzdb_list.cpp+2| ... | @@ -13,6 +13,7 @@ | ... | @@ -13,6 +13,7 @@ |
| 13 | #include "include/tzdb/tzdb_list_private.h" | 13 | #include "include/tzdb/tzdb_list_private.h" |
| 14 | 14 | ||
| 15 | _LIBCPP_BEGIN_NAMESPACE_STD | 15 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 16 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 16 | 17 | ||
| 17 | namespace chrono { | 18 | namespace chrono { |
| 18 | 19 | ||
| ... | @@ -40,4 +41,5 @@ _LIBCPP_EXPORTED_FROM_ABI tzdb_list::const_iterator tzdb_list::__erase_after(con | ... | @@ -40,4 +41,5 @@ _LIBCPP_EXPORTED_FROM_ABI tzdb_list::const_iterator tzdb_list::__erase_after(con |
| 40 | 41 | ||
| 41 | } // namespace chrono | 42 | } // namespace chrono |
| 42 | 43 | ||
| 44 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 43 | _LIBCPP_END_NAMESPACE_STD | 45 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/filesystem/directory_entry.cpp+2| ... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
| 16 | #include "time_utils.h" | 16 | #include "time_utils.h" |
| 17 | 17 | ||
| 18 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 18 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 19 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 19 | 20 | ||
| 20 | error_code directory_entry::__do_refresh() noexcept { | 21 | error_code directory_entry::__do_refresh() noexcept { |
| 21 | __data_.__reset(); | 22 | __data_.__reset(); |
| ... | @@ -70,4 +71,5 @@ error_code directory_entry::__do_refresh() noexcept { | ... | @@ -70,4 +71,5 @@ error_code directory_entry::__do_refresh() noexcept { |
| 70 | return failure_ec; | 71 | return failure_ec; |
| 71 | } | 72 | } |
| 72 | 73 | ||
| 74 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 73 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 75 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
lib/libcxx/src/filesystem/directory_iterator.cpp+2| ... | @@ -26,6 +26,7 @@ | ... | @@ -26,6 +26,7 @@ |
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 28 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 29 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 29 | 30 | ||
| 30 | using detail::ErrorHandler; | 31 | using detail::ErrorHandler; |
| 31 | 32 | ||
| ... | @@ -320,4 +321,5 @@ bool recursive_directory_iterator::__try_recursion(error_code* ec) { | ... | @@ -320,4 +321,5 @@ bool recursive_directory_iterator::__try_recursion(error_code* ec) { |
| 320 | return false; | 321 | return false; |
| 321 | } | 322 | } |
| 322 | 323 | ||
| 324 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 323 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 325 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
lib/libcxx/src/filesystem/filesystem_clock.cpp+3-1| ... | @@ -32,7 +32,7 @@ | ... | @@ -32,7 +32,7 @@ |
| 32 | # include <sys/time.h> // for gettimeofday and timeval | 32 | # include <sys/time.h> // for gettimeofday and timeval |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | #if defined(__LLVM_LIBC__) | 35 | #if _LIBCPP_LIBC_LLVM_LIBC |
| 36 | # define _LIBCPP_HAS_TIMESPEC_GET | 36 | # define _LIBCPP_HAS_TIMESPEC_GET |
| 37 | #endif | 37 | #endif |
| 38 | 38 | ||
| ... | @@ -42,6 +42,7 @@ | ... | @@ -42,6 +42,7 @@ |
| 42 | #endif | 42 | #endif |
| 43 | 43 | ||
| 44 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 44 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 45 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 45 | 46 | ||
| 46 | _LIBCPP_DIAGNOSTIC_PUSH | 47 | _LIBCPP_DIAGNOSTIC_PUSH |
| 47 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated") | 48 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated") |
| ... | @@ -76,4 +77,5 @@ _FilesystemClock::time_point _FilesystemClock::now() noexcept { | ... | @@ -76,4 +77,5 @@ _FilesystemClock::time_point _FilesystemClock::now() noexcept { |
| 76 | #endif | 77 | #endif |
| 77 | } | 78 | } |
| 78 | 79 | ||
| 80 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 79 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 81 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
lib/libcxx/src/filesystem/filesystem_error.cpp+2| ... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
| 15 | #include "format_string.h" | 15 | #include "format_string.h" |
| 16 | 16 | ||
| 17 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 17 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 18 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 18 | 19 | ||
| 19 | filesystem_error::~filesystem_error() {} | 20 | filesystem_error::~filesystem_error() {} |
| 20 | 21 | ||
| ... | @@ -37,4 +38,5 @@ void filesystem_error::__create_what(int __num_paths) { | ... | @@ -37,4 +38,5 @@ void filesystem_error::__create_what(int __num_paths) { |
| 37 | }(); | 38 | }(); |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 41 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 40 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 42 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
lib/libcxx/src/filesystem/operations.cpp+5| ... | @@ -69,6 +69,7 @@ | ... | @@ -69,6 +69,7 @@ |
| 69 | #endif | 69 | #endif |
| 70 | 70 | ||
| 71 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 71 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 72 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 72 | 73 | ||
| 73 | using detail::capture_errno; | 74 | using detail::capture_errno; |
| 74 | using detail::ErrorHandler; | 75 | using detail::ErrorHandler; |
| ... | @@ -904,6 +905,9 @@ uintmax_t remove_all_impl(int parent_directory, const path& p, error_code& ec) { | ... | @@ -904,6 +905,9 @@ uintmax_t remove_all_impl(int parent_directory, const path& p, error_code& ec) { |
| 904 | break; // we're done iterating through the directory | 905 | break; // we're done iterating through the directory |
| 905 | } else { | 906 | } else { |
| 906 | count += remove_all_impl(fd, str, ec); | 907 | count += remove_all_impl(fd, str, ec); |
| 908 | // If there's an error removing the child, return immediately to preserve the error code. | ||
| 909 | if (ec) | ||
| 910 | return count; | ||
| 907 | } | 911 | } |
| 908 | } | 912 | } |
| 909 | 913 | ||
| ... | @@ -1077,4 +1081,5 @@ path __weakly_canonical(const path& p, error_code* ec) { | ... | @@ -1077,4 +1081,5 @@ path __weakly_canonical(const path& p, error_code* ec) { |
| 1077 | return result.lexically_normal(); | 1081 | return result.lexically_normal(); |
| 1078 | } | 1082 | } |
| 1079 | 1083 | ||
| 1084 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 1080 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 1085 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
lib/libcxx/src/filesystem/path.cpp+12-11| ... | @@ -14,6 +14,7 @@ | ... | @@ -14,6 +14,7 @@ |
| 14 | #include "path_parser.h" | 14 | #include "path_parser.h" |
| 15 | 15 | ||
| 16 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM | 16 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| 17 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 17 | 18 | ||
| 18 | using detail::ErrorHandler; | 19 | using detail::ErrorHandler; |
| 19 | using parser::createView; | 20 | using parser::createView; |
| ... | @@ -139,21 +140,20 @@ string_view_t path::__extension() const { return parser::separate_filename(__fil | ... | @@ -139,21 +140,20 @@ string_view_t path::__extension() const { return parser::separate_filename(__fil |
| 139 | //////////////////////////////////////////////////////////////////////////// | 140 | //////////////////////////////////////////////////////////////////////////// |
| 140 | // path.gen | 141 | // path.gen |
| 141 | 142 | ||
| 142 | enum PathPartKind : unsigned char { PK_None, PK_RootSep, PK_Filename, PK_Dot, PK_DotDot, PK_TrailingSep }; | 143 | enum PathPartKind : unsigned char { PK_None, PK_RootName, PK_RootSep, PK_Filename, PK_Dot, PK_DotDot, PK_TrailingSep }; |
| 143 | 144 | ||
| 144 | static PathPartKind ClassifyPathPart(string_view_t Part) { | 145 | static PathPartKind ClassifyPathPart(const PathParser& PP) { |
| 146 | if (PP.inRootName()) | ||
| 147 | return PK_RootName; | ||
| 148 | if (PP.inRootDir()) | ||
| 149 | return PK_RootSep; | ||
| 150 | string_view_t Part = *PP; | ||
| 145 | if (Part.empty()) | 151 | if (Part.empty()) |
| 146 | return PK_TrailingSep; | 152 | return PK_TrailingSep; |
| 147 | if (Part == PATHSTR(".")) | 153 | if (Part == PATHSTR(".")) |
| 148 | return PK_Dot; | 154 | return PK_Dot; |
| 149 | if (Part == PATHSTR("..")) | 155 | if (Part == PATHSTR("..")) |
| 150 | return PK_DotDot; | 156 | return PK_DotDot; |
| 151 | if (Part == PATHSTR("/")) | ||
| 152 | return PK_RootSep; | ||
| 153 | #if defined(_LIBCPP_WIN32API) | ||
| 154 | if (Part == PATHSTR("\\")) | ||
| 155 | return PK_RootSep; | ||
| 156 | #endif | ||
| 157 | return PK_Filename; | 157 | return PK_Filename; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| ... | @@ -183,13 +183,13 @@ path path::lexically_normal() const { | ... | @@ -183,13 +183,13 @@ path path::lexically_normal() const { |
| 183 | // Build a stack containing the remaining elements of the path, popping off | 183 | // Build a stack containing the remaining elements of the path, popping off |
| 184 | // elements which occur before a '..' entry. | 184 | // elements which occur before a '..' entry. |
| 185 | for (auto PP = PathParser::CreateBegin(__pn_); PP; ++PP) { | 185 | for (auto PP = PathParser::CreateBegin(__pn_); PP; ++PP) { |
| 186 | auto Part = *PP; | 186 | PathPartKind Kind = ClassifyPathPart(PP); |
| 187 | PathPartKind Kind = ClassifyPathPart(Part); | ||
| 188 | switch (Kind) { | 187 | switch (Kind) { |
| 189 | case PK_Filename: | 188 | case PK_Filename: |
| 189 | case PK_RootName: | ||
| 190 | case PK_RootSep: { | 190 | case PK_RootSep: { |
| 191 | // Add all non-dot and non-dot-dot elements to the stack of elements. | 191 | // Add all non-dot and non-dot-dot elements to the stack of elements. |
| 192 | AddPart(Kind, Part); | 192 | AddPart(Kind, *PP); |
| 193 | MaybeNeedTrailingSep = false; | 193 | MaybeNeedTrailingSep = false; |
| 194 | break; | 194 | break; |
| 195 | } | 195 | } |
| ... | @@ -444,4 +444,5 @@ size_t __char_to_wide(const string& str, wchar_t* out, size_t outlen) { | ... | @@ -444,4 +444,5 @@ size_t __char_to_wide(const string& str, wchar_t* out, size_t outlen) { |
| 444 | } | 444 | } |
| 445 | #endif | 445 | #endif |
| 446 | 446 | ||
| 447 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 447 | _LIBCPP_END_NAMESPACE_FILESYSTEM | 448 | _LIBCPP_END_NAMESPACE_FILESYSTEM |
lib/libcxx/src/fstream.cpp+2| ... | @@ -18,6 +18,7 @@ | ... | @@ -18,6 +18,7 @@ |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 21 | 22 | ||
| 22 | #if defined(_LIBCPP_WIN32API) | 23 | #if defined(_LIBCPP_WIN32API) |
| 23 | 24 | ||
| ... | @@ -34,4 +35,5 @@ _LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) no | ... | @@ -34,4 +35,5 @@ _LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) no |
| 34 | 35 | ||
| 35 | #endif | 36 | #endif |
| 36 | 37 | ||
| 38 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 37 | _LIBCPP_END_NAMESPACE_STD | 39 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/functional.cpp+2| ... | @@ -9,6 +9,7 @@ | ... | @@ -9,6 +9,7 @@ |
| 9 | #include <functional> | 9 | #include <functional> |
| 10 | 10 | ||
| 11 | _LIBCPP_BEGIN_NAMESPACE_STD | 11 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 12 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 12 | 13 | ||
| 13 | bad_function_call::~bad_function_call() noexcept {} | 14 | bad_function_call::~bad_function_call() noexcept {} |
| 14 | 15 | ||
| ... | @@ -18,4 +19,5 @@ size_t __hash_memory(_LIBCPP_NOESCAPE const void* ptr, size_t size) noexcept { | ... | @@ -18,4 +19,5 @@ size_t __hash_memory(_LIBCPP_NOESCAPE const void* ptr, size_t size) noexcept { |
| 18 | return __murmur2_or_cityhash<size_t>()(ptr, size); | 19 | return __murmur2_or_cityhash<size_t>()(ptr, size); |
| 19 | } | 20 | } |
| 20 | 21 | ||
| 22 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 21 | _LIBCPP_END_NAMESPACE_STD | 23 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/future.cpp+2| ... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
| 10 | #include <string> | 10 | #include <string> |
| 11 | 11 | ||
| 12 | _LIBCPP_BEGIN_NAMESPACE_STD | 12 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 13 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 13 | 14 | ||
| 14 | class _LIBCPP_HIDDEN __future_error_category : public __do_message { | 15 | class _LIBCPP_HIDDEN __future_error_category : public __do_message { |
| 15 | public: | 16 | public: |
| ... | @@ -194,4 +195,5 @@ shared_future<void>& shared_future<void>::operator=(const shared_future& __rhs) | ... | @@ -194,4 +195,5 @@ shared_future<void>& shared_future<void>::operator=(const shared_future& __rhs) |
| 194 | return *this; | 195 | return *this; |
| 195 | } | 196 | } |
| 196 | 197 | ||
| 198 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 197 | _LIBCPP_END_NAMESPACE_STD | 199 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/hash.cpp+17-334| ... | @@ -13,6 +13,7 @@ | ... | @@ -13,6 +13,7 @@ |
| 13 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wtautological-constant-out-of-range-compare") | 13 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wtautological-constant-out-of-range-compare") |
| 14 | 14 | ||
| 15 | _LIBCPP_BEGIN_NAMESPACE_STD | 15 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 16 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 16 | 17 | ||
| 17 | namespace { | 18 | namespace { |
| 18 | 19 | ||
| ... | @@ -30,6 +31,13 @@ const unsigned indices[] = { | ... | @@ -30,6 +31,13 @@ const unsigned indices[] = { |
| 30 | 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 121, 127, 131, 137, 139, | 31 | 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 121, 127, 131, 137, 139, |
| 31 | 143, 149, 151, 157, 163, 167, 169, 173, 179, 181, 187, 191, 193, 197, 199, 209}; | 32 | 143, 149, 151, 157, 163, 167, 169, 173, 179, 181, 187, 191, 193, 197, 199, 209}; |
| 32 | 33 | ||
| 34 | // These are the amount we increment by when checking for potential | ||
| 35 | // primes in the loop in __next_prime. | ||
| 36 | const uint8_t increments[] = { | ||
| 37 | 0, 10, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, | ||
| 38 | 4, 2, 4, 8, 6, 4, 6, 2, 4, 6, 2, 6, 6, 4, 2, 4, 6, 2, 6, 4, 2, 4, 2, 10, | ||
| 39 | }; | ||
| 40 | |||
| 33 | } // namespace | 41 | } // namespace |
| 34 | 42 | ||
| 35 | // Returns: If n == 0, returns 0. Else returns the lowest prime number that | 43 | // Returns: If n == 0, returns 0. Else returns the lowest prime number that |
| ... | @@ -97,340 +105,14 @@ size_t __next_prime(size_t n) { | ... | @@ -97,340 +105,14 @@ size_t __next_prime(size_t n) { |
| 97 | { | 105 | { |
| 98 | size_t i = 211; | 106 | size_t i = 211; |
| 99 | while (true) { | 107 | while (true) { |
| 100 | std::size_t q = n / i; | 108 | for (auto inc : increments) { |
| 101 | if (q < i) | 109 | i += inc; |
| 102 | return n; | 110 | std::size_t q = n / i; |
| 103 | if (n == q * i) | 111 | if (q < i) |
| 104 | break; | 112 | return n; |
| 105 | 113 | if (n == q * i) | |
| 106 | i += 10; | 114 | goto next; |
| 107 | q = n / i; | 115 | } |
| 108 | if (q < i) | ||
| 109 | return n; | ||
| 110 | if (n == q * i) | ||
| 111 | break; | ||
| 112 | |||
| 113 | i += 2; | ||
| 114 | q = n / i; | ||
| 115 | if (q < i) | ||
| 116 | return n; | ||
| 117 | if (n == q * i) | ||
| 118 | break; | ||
| 119 | |||
| 120 | i += 4; | ||
| 121 | q = n / i; | ||
| 122 | if (q < i) | ||
| 123 | return n; | ||
| 124 | if (n == q * i) | ||
| 125 | break; | ||
| 126 | |||
| 127 | i += 2; | ||
| 128 | q = n / i; | ||
| 129 | if (q < i) | ||
| 130 | return n; | ||
| 131 | if (n == q * i) | ||
| 132 | break; | ||
| 133 | |||
| 134 | i += 4; | ||
| 135 | q = n / i; | ||
| 136 | if (q < i) | ||
| 137 | return n; | ||
| 138 | if (n == q * i) | ||
| 139 | break; | ||
| 140 | |||
| 141 | i += 6; | ||
| 142 | q = n / i; | ||
| 143 | if (q < i) | ||
| 144 | return n; | ||
| 145 | if (n == q * i) | ||
| 146 | break; | ||
| 147 | |||
| 148 | i += 2; | ||
| 149 | q = n / i; | ||
| 150 | if (q < i) | ||
| 151 | return n; | ||
| 152 | if (n == q * i) | ||
| 153 | break; | ||
| 154 | |||
| 155 | i += 6; | ||
| 156 | q = n / i; | ||
| 157 | if (q < i) | ||
| 158 | return n; | ||
| 159 | if (n == q * i) | ||
| 160 | break; | ||
| 161 | |||
| 162 | i += 4; | ||
| 163 | q = n / i; | ||
| 164 | if (q < i) | ||
| 165 | return n; | ||
| 166 | if (n == q * i) | ||
| 167 | break; | ||
| 168 | |||
| 169 | i += 2; | ||
| 170 | q = n / i; | ||
| 171 | if (q < i) | ||
| 172 | return n; | ||
| 173 | if (n == q * i) | ||
| 174 | break; | ||
| 175 | |||
| 176 | i += 4; | ||
| 177 | q = n / i; | ||
| 178 | if (q < i) | ||
| 179 | return n; | ||
| 180 | if (n == q * i) | ||
| 181 | break; | ||
| 182 | |||
| 183 | i += 6; | ||
| 184 | q = n / i; | ||
| 185 | if (q < i) | ||
| 186 | return n; | ||
| 187 | if (n == q * i) | ||
| 188 | break; | ||
| 189 | |||
| 190 | i += 6; | ||
| 191 | q = n / i; | ||
| 192 | if (q < i) | ||
| 193 | return n; | ||
| 194 | if (n == q * i) | ||
| 195 | break; | ||
| 196 | |||
| 197 | i += 2; | ||
| 198 | q = n / i; | ||
| 199 | if (q < i) | ||
| 200 | return n; | ||
| 201 | if (n == q * i) | ||
| 202 | break; | ||
| 203 | |||
| 204 | i += 6; | ||
| 205 | q = n / i; | ||
| 206 | if (q < i) | ||
| 207 | return n; | ||
| 208 | if (n == q * i) | ||
| 209 | break; | ||
| 210 | |||
| 211 | i += 4; | ||
| 212 | q = n / i; | ||
| 213 | if (q < i) | ||
| 214 | return n; | ||
| 215 | if (n == q * i) | ||
| 216 | break; | ||
| 217 | |||
| 218 | i += 2; | ||
| 219 | q = n / i; | ||
| 220 | if (q < i) | ||
| 221 | return n; | ||
| 222 | if (n == q * i) | ||
| 223 | break; | ||
| 224 | |||
| 225 | i += 6; | ||
| 226 | q = n / i; | ||
| 227 | if (q < i) | ||
| 228 | return n; | ||
| 229 | if (n == q * i) | ||
| 230 | break; | ||
| 231 | |||
| 232 | i += 4; | ||
| 233 | q = n / i; | ||
| 234 | if (q < i) | ||
| 235 | return n; | ||
| 236 | if (n == q * i) | ||
| 237 | break; | ||
| 238 | |||
| 239 | i += 6; | ||
| 240 | q = n / i; | ||
| 241 | if (q < i) | ||
| 242 | return n; | ||
| 243 | if (n == q * i) | ||
| 244 | break; | ||
| 245 | |||
| 246 | i += 8; | ||
| 247 | q = n / i; | ||
| 248 | if (q < i) | ||
| 249 | return n; | ||
| 250 | if (n == q * i) | ||
| 251 | break; | ||
| 252 | |||
| 253 | i += 4; | ||
| 254 | q = n / i; | ||
| 255 | if (q < i) | ||
| 256 | return n; | ||
| 257 | if (n == q * i) | ||
| 258 | break; | ||
| 259 | |||
| 260 | i += 2; | ||
| 261 | q = n / i; | ||
| 262 | if (q < i) | ||
| 263 | return n; | ||
| 264 | if (n == q * i) | ||
| 265 | break; | ||
| 266 | |||
| 267 | i += 4; | ||
| 268 | q = n / i; | ||
| 269 | if (q < i) | ||
| 270 | return n; | ||
| 271 | if (n == q * i) | ||
| 272 | break; | ||
| 273 | |||
| 274 | i += 2; | ||
| 275 | q = n / i; | ||
| 276 | if (q < i) | ||
| 277 | return n; | ||
| 278 | if (n == q * i) | ||
| 279 | break; | ||
| 280 | |||
| 281 | i += 4; | ||
| 282 | q = n / i; | ||
| 283 | if (q < i) | ||
| 284 | return n; | ||
| 285 | if (n == q * i) | ||
| 286 | break; | ||
| 287 | |||
| 288 | i += 8; | ||
| 289 | q = n / i; | ||
| 290 | if (q < i) | ||
| 291 | return n; | ||
| 292 | if (n == q * i) | ||
| 293 | break; | ||
| 294 | |||
| 295 | i += 6; | ||
| 296 | q = n / i; | ||
| 297 | if (q < i) | ||
| 298 | return n; | ||
| 299 | if (n == q * i) | ||
| 300 | break; | ||
| 301 | |||
| 302 | i += 4; | ||
| 303 | q = n / i; | ||
| 304 | if (q < i) | ||
| 305 | return n; | ||
| 306 | if (n == q * i) | ||
| 307 | break; | ||
| 308 | |||
| 309 | i += 6; | ||
| 310 | q = n / i; | ||
| 311 | if (q < i) | ||
| 312 | return n; | ||
| 313 | if (n == q * i) | ||
| 314 | break; | ||
| 315 | |||
| 316 | i += 2; | ||
| 317 | q = n / i; | ||
| 318 | if (q < i) | ||
| 319 | return n; | ||
| 320 | if (n == q * i) | ||
| 321 | break; | ||
| 322 | |||
| 323 | i += 4; | ||
| 324 | q = n / i; | ||
| 325 | if (q < i) | ||
| 326 | return n; | ||
| 327 | if (n == q * i) | ||
| 328 | break; | ||
| 329 | |||
| 330 | i += 6; | ||
| 331 | q = n / i; | ||
| 332 | if (q < i) | ||
| 333 | return n; | ||
| 334 | if (n == q * i) | ||
| 335 | break; | ||
| 336 | |||
| 337 | i += 2; | ||
| 338 | q = n / i; | ||
| 339 | if (q < i) | ||
| 340 | return n; | ||
| 341 | if (n == q * i) | ||
| 342 | break; | ||
| 343 | |||
| 344 | i += 6; | ||
| 345 | q = n / i; | ||
| 346 | if (q < i) | ||
| 347 | return n; | ||
| 348 | if (n == q * i) | ||
| 349 | break; | ||
| 350 | |||
| 351 | i += 6; | ||
| 352 | q = n / i; | ||
| 353 | if (q < i) | ||
| 354 | return n; | ||
| 355 | if (n == q * i) | ||
| 356 | break; | ||
| 357 | |||
| 358 | i += 4; | ||
| 359 | q = n / i; | ||
| 360 | if (q < i) | ||
| 361 | return n; | ||
| 362 | if (n == q * i) | ||
| 363 | break; | ||
| 364 | |||
| 365 | i += 2; | ||
| 366 | q = n / i; | ||
| 367 | if (q < i) | ||
| 368 | return n; | ||
| 369 | if (n == q * i) | ||
| 370 | break; | ||
| 371 | |||
| 372 | i += 4; | ||
| 373 | q = n / i; | ||
| 374 | if (q < i) | ||
| 375 | return n; | ||
| 376 | if (n == q * i) | ||
| 377 | break; | ||
| 378 | |||
| 379 | i += 6; | ||
| 380 | q = n / i; | ||
| 381 | if (q < i) | ||
| 382 | return n; | ||
| 383 | if (n == q * i) | ||
| 384 | break; | ||
| 385 | |||
| 386 | i += 2; | ||
| 387 | q = n / i; | ||
| 388 | if (q < i) | ||
| 389 | return n; | ||
| 390 | if (n == q * i) | ||
| 391 | break; | ||
| 392 | |||
| 393 | i += 6; | ||
| 394 | q = n / i; | ||
| 395 | if (q < i) | ||
| 396 | return n; | ||
| 397 | if (n == q * i) | ||
| 398 | break; | ||
| 399 | |||
| 400 | i += 4; | ||
| 401 | q = n / i; | ||
| 402 | if (q < i) | ||
| 403 | return n; | ||
| 404 | if (n == q * i) | ||
| 405 | break; | ||
| 406 | |||
| 407 | i += 2; | ||
| 408 | q = n / i; | ||
| 409 | if (q < i) | ||
| 410 | return n; | ||
| 411 | if (n == q * i) | ||
| 412 | break; | ||
| 413 | |||
| 414 | i += 4; | ||
| 415 | q = n / i; | ||
| 416 | if (q < i) | ||
| 417 | return n; | ||
| 418 | if (n == q * i) | ||
| 419 | break; | ||
| 420 | |||
| 421 | i += 2; | ||
| 422 | q = n / i; | ||
| 423 | if (q < i) | ||
| 424 | return n; | ||
| 425 | if (n == q * i) | ||
| 426 | break; | ||
| 427 | |||
| 428 | i += 10; | ||
| 429 | q = n / i; | ||
| 430 | if (q < i) | ||
| 431 | return n; | ||
| 432 | if (n == q * i) | ||
| 433 | break; | ||
| 434 | 116 | ||
| 435 | // This will loop i to the next "plane" of potential primes | 117 | // This will loop i to the next "plane" of potential primes |
| 436 | i += 2; | 118 | i += 2; |
| ... | @@ -446,4 +128,5 @@ size_t __next_prime(size_t n) { | ... | @@ -446,4 +128,5 @@ size_t __next_prime(size_t n) { |
| 446 | } | 128 | } |
| 447 | } | 129 | } |
| 448 | 130 | ||
| 131 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 449 | _LIBCPP_END_NAMESPACE_STD | 132 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/include/apple_availability.h deleted-34| ... | @@ -1,34 +0,0 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #ifndef _LIBCPP_SRC_INCLUDE_APPLE_AVAILABILITY_H | ||
| 10 | #define _LIBCPP_SRC_INCLUDE_APPLE_AVAILABILITY_H | ||
| 11 | |||
| 12 | #if defined(__APPLE__) | ||
| 13 | |||
| 14 | # if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) | ||
| 15 | # if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500 | ||
| 16 | # define _LIBCPP_USE_ULOCK | ||
| 17 | # endif | ||
| 18 | # elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) | ||
| 19 | # if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000 | ||
| 20 | # define _LIBCPP_USE_ULOCK | ||
| 21 | # endif | ||
| 22 | # elif defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) | ||
| 23 | # if __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000 | ||
| 24 | # define _LIBCPP_USE_ULOCK | ||
| 25 | # endif | ||
| 26 | # elif defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) | ||
| 27 | # if __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000 | ||
| 28 | # define _LIBCPP_USE_ULOCK | ||
| 29 | # endif | ||
| 30 | # endif // __ENVIRONMENT_.*_VERSION_MIN_REQUIRED__ | ||
| 31 | |||
| 32 | #endif // __APPLE__ | ||
| 33 | |||
| 34 | #endif // _LIBCPP_SRC_INCLUDE_APPLE_AVAILABILITY_H | ||
lib/libcxx/src/include/config_elast.h+1-1| ... | @@ -21,7 +21,7 @@ | ... | @@ -21,7 +21,7 @@ |
| 21 | // where strerror/strerror_r can't handle out-of-range errno values. | 21 | // where strerror/strerror_r can't handle out-of-range errno values. |
| 22 | #if defined(ELAST) | 22 | #if defined(ELAST) |
| 23 | # define _LIBCPP_ELAST ELAST | 23 | # define _LIBCPP_ELAST ELAST |
| 24 | #elif defined(__LLVM_LIBC__) | 24 | #elif _LIBCPP_LIBC_LLVM_LIBC |
| 25 | // No _LIBCPP_ELAST needed for LLVM libc | 25 | // No _LIBCPP_ELAST needed for LLVM libc |
| 26 | #elif _LIBCPP_LIBC_NEWLIB | 26 | #elif _LIBCPP_LIBC_NEWLIB |
| 27 | # define _LIBCPP_ELAST __ELASTERROR | 27 | # define _LIBCPP_ELAST __ELASTERROR |
lib/libcxx/src/include/overridable_function.h+80-50| ... | @@ -11,11 +11,6 @@ | ... | @@ -11,11 +11,6 @@ |
| 11 | #define _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H | 11 | #define _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H |
| 12 | 12 | ||
| 13 | #include <__config> | 13 | #include <__config> |
| 14 | #include <cstdint> | ||
| 15 | |||
| 16 | #if __has_feature(ptrauth_calls) | ||
| 17 | # include <ptrauth.h> | ||
| 18 | #endif | ||
| 19 | 14 | ||
| 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 21 | # pragma GCC system_header | 16 | # pragma GCC system_header |
| ... | @@ -42,18 +37,19 @@ | ... | @@ -42,18 +37,19 @@ |
| 42 | // ------------------- | 37 | // ------------------- |
| 43 | // | 38 | // |
| 44 | // Let's say we want to check whether a weak function `f` has been overridden by the user. | 39 | // Let's say we want to check whether a weak function `f` has been overridden by the user. |
| 45 | // The general mechanism works by placing `f`'s definition (in the libc++ built library) | 40 | // The general mechanism works by defining a local symbol `__impl_ref<f>::__impl_` with |
| 46 | // inside a special section, which we do using the `__section__` attribute via the | 41 | // the same address as `f` as a constant expression using direct PC-relative |
| 47 | // OVERRIDABLE_FUNCTION macro. | 42 | // materialization thus pointing at the symbol defined in the same TU. At runtime, it |
| 43 | // compares the address of `__impl_ref<f>::__impl_` with the address of `f` loaded from | ||
| 44 | // GOT: if `f` was overridden by the user in another TU, the addresses will be different. | ||
| 48 | // | 45 | // |
| 49 | // Then, when comes the time to check whether the function has been overridden, we take | 46 | // When pointer authentication is used, the above mechanism doesn't work (yet) so we use |
| 50 | // the address of the function and we check whether it falls inside the special function | 47 | // a different strategy placing `f`'s definition (in the libc++ built library) inside |
| 51 | // we created. This can be done by finding pointers to the start and the end of the section | 48 | // a special section, which we do using the `__section__` attribute via the |
| 52 | // (which is done differently for ELF and Mach-O), and then checking whether `f` falls | 49 | // OVERRIDABLE_FUNCTION macro. Then, when comes the time to check whether the function has |
| 53 | // within those bounds. If it falls within those bounds, then `f` is still inside the | 50 | // been overridden, we take the address of the function and we check whether it falls inside |
| 54 | // special section and so it is the version we defined in the libc++ built library, i.e. | 51 | // the special section we created. This can be done by finding pointers to the start and |
| 55 | // it was not overridden. Otherwise, it was overridden by the user because it falls | 52 | // the end of the section, and then checking whether `f` falls within those bounds. |
| 56 | // outside of the section. | ||
| 57 | // | 53 | // |
| 58 | // Important note | 54 | // Important note |
| 59 | // -------------- | 55 | // -------------- |
| ... | @@ -63,50 +59,80 @@ | ... | @@ -63,50 +59,80 @@ |
| 63 | // want to be defining special sections inside user's executables which use our headers. | 59 | // want to be defining special sections inside user's executables which use our headers. |
| 64 | // | 60 | // |
| 65 | 61 | ||
| 66 | #if defined(_LIBCPP_OBJECT_FORMAT_MACHO) | 62 | #if defined(_LIBCPP_OBJECT_FORMAT_MACHO) || (defined(_LIBCPP_OBJECT_FORMAT_ELF) && !defined(__NVPTX__)) |
| 67 | 63 | ||
| 68 | # define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1 | 64 | # define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1 |
| 69 | # define OVERRIDABLE_FUNCTION \ | ||
| 70 | __attribute__((__section__("__TEXT,__lcxx_override,regular,pure_instructions"))) _LIBCPP_WEAK | ||
| 71 | 65 | ||
| 72 | _LIBCPP_BEGIN_NAMESPACE_STD template <typename T, T* _Func> | 66 | # if !__has_feature(ptrauth_calls) |
| 73 | _LIBCPP_HIDE_FROM_ABI inline bool __is_function_overridden() noexcept { | ||
| 74 | // Declare two dummy bytes and give them these special `__asm` values. These values are | ||
| 75 | // defined by the linker, which means that referring to `&__lcxx_override_start` will | ||
| 76 | // effectively refer to the address where the section starts (and same for the end). | ||
| 77 | extern char __lcxx_override_start __asm("section$start$__TEXT$__lcxx_override"); | ||
| 78 | extern char __lcxx_override_end __asm("section$end$__TEXT$__lcxx_override"); | ||
| 79 | |||
| 80 | // Now get a uintptr_t out of these locations, and out of the function pointer. | ||
| 81 | uintptr_t __start = reinterpret_cast<uintptr_t>(&__lcxx_override_start); | ||
| 82 | uintptr_t __end = reinterpret_cast<uintptr_t>(&__lcxx_override_end); | ||
| 83 | uintptr_t __ptr = reinterpret_cast<uintptr_t>(_Func); | ||
| 84 | 67 | ||
| 85 | # if __has_feature(ptrauth_calls) | 68 | # define OVERRIDABLE_FUNCTION [[gnu::weak]] |
| 86 | // We must pass a void* to ptrauth_strip since it only accepts a pointer type. Also, in particular, | ||
| 87 | // we must NOT pass a function pointer, otherwise we will strip the function pointer, and then attempt | ||
| 88 | // to authenticate and re-sign it when casting it to a uintptr_t again, which will fail because we just | ||
| 89 | // stripped the function pointer. See rdar://122927845. | ||
| 90 | __ptr = reinterpret_cast<uintptr_t>(ptrauth_strip(reinterpret_cast<void*>(__ptr), ptrauth_key_function_pointer)); | ||
| 91 | # endif | ||
| 92 | 69 | ||
| 93 | // Finally, the function was overridden if it falls outside of the section's bounds. | 70 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 94 | return __ptr < __start || __ptr > __end; | 71 | |
| 72 | namespace { | ||
| 73 | |||
| 74 | // This is used to prevent TBAA from optimizing away the function pointer comparison. | ||
| 75 | template <typename T> | ||
| 76 | [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI T* __launder_function_pointer(T* __ptr) noexcept { | ||
| 77 | __asm__ volatile("" : "+r"(__ptr)); | ||
| 78 | return __ptr; | ||
| 95 | } | 79 | } |
| 80 | |||
| 81 | } // namespace | ||
| 82 | |||
| 83 | template <auto* _Func> | ||
| 84 | struct __impl_ref; | ||
| 85 | |||
| 86 | // __impl_ref<...>::__impl_ is expected to be defined elsewhere, so the compiler emits | ||
| 87 | // assembly references to the mangled symbol with no definition. This template saves us | ||
| 88 | // the trouble of providing manual declarations for overloads with some other local name | ||
| 89 | // for each function name being overloaded (operator new, operator new[], etc.). | ||
| 90 | template <typename _Ret, typename... _Args, _Ret (*_Func)(_Args...)> | ||
| 91 | struct __impl_ref<_Func> { | ||
| 92 | [[gnu::visibility("hidden")]] static _Ret __impl_(_Args...); | ||
| 93 | }; | ||
| 94 | |||
| 95 | // This takes a function type template argument first so that the second non-type template | ||
| 96 | // argument (pointer to the public function) gets the benefit of type-aware overload | ||
| 97 | // resolution, rather than having to use a static_cast. | ||
| 98 | template <typename T, T* _Func> | ||
| 99 | _LIBCPP_HIDE_FROM_ABI inline bool __is_function_overridden() noexcept { | ||
| 100 | # if !defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 2101 | ||
| 101 | __asm__("%cc0 = %cc1" : : "X"(__impl_ref<_Func>::__impl_), "X"(_Func)); | ||
| 102 | # else | ||
| 103 | __asm__("%c0 = %c1" : : "X"(__impl_ref<_Func>::__impl_), "X"(_Func)); | ||
| 104 | # endif | ||
| 105 | // This just has the compiler compare the two symbols. For PIC mode, this will do a | ||
| 106 | // direct PC-relative materialization for __impl_ref<...>::__impl_ and a GOT load for | ||
| 107 | // the _Func symbol. The compiler thinks __impl_ref<...>::__impl_ is defined elsewhere | ||
| 108 | // at link time and will be an undefined symbol. It doesn't know that the __asm__ tells | ||
| 109 | // the assembler to define it as a local symbol. | ||
| 110 | return __launder_function_pointer(_Func) != __impl_ref<_Func>::__impl_; | ||
| 111 | } | ||
| 112 | |||
| 96 | _LIBCPP_END_NAMESPACE_STD | 113 | _LIBCPP_END_NAMESPACE_STD |
| 97 | 114 | ||
| 98 | // The NVPTX linker cannot create '__start/__stop' sections. | 115 | # else // __has_feature(ptrauth_calls) |
| 99 | #elif defined(_LIBCPP_OBJECT_FORMAT_ELF) && !defined(__NVPTX__) | ||
| 100 | 116 | ||
| 101 | # define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1 | 117 | # include <cstdint> |
| 102 | # define OVERRIDABLE_FUNCTION __attribute__((__section__("__lcxx_override"))) _LIBCPP_WEAK | 118 | # include <ptrauth.h> |
| 103 | 119 | ||
| 120 | # if defined(_LIBCPP_OBJECT_FORMAT_MACHO) | ||
| 121 | # define OVERRIDABLE_FUNCTION [[gnu::weak, gnu::section("__TEXT,__lcxx_override,regular,pure_instructions")]] | ||
| 122 | // Declare two dummy bytes and give them these special `__asm` values. These values are | ||
| 123 | // defined by the linker, which means that referring to `&__lcxx_override_start` will | ||
| 124 | // effectively refer to the address where the section starts (and same for the end). | ||
| 125 | extern char __start___lcxx_override __asm("section$start$__TEXT$__lcxx_override"); | ||
| 126 | extern char __stop___lcxx_override __asm("section$end$__TEXT$__lcxx_override"); | ||
| 127 | # elif defined(_LIBCPP_OBJECT_FORMAT_ELF) | ||
| 104 | // This is very similar to what we do for Mach-O above. The ELF linker will implicitly define | 128 | // This is very similar to what we do for Mach-O above. The ELF linker will implicitly define |
| 105 | // variables with those names corresponding to the start and the end of the section. | 129 | // variables with those names corresponding to the start and the end of the section. |
| 106 | // | 130 | // |
| 107 | // See https://stackoverflow.com/questions/16552710/how-do-you-get-the-start-and-end-addresses-of-a-custom-elf-section | 131 | // See https://stackoverflow.com/questions/16552710/how-do-you-get-the-start-and-end-addresses-of-a-custom-elf-section |
| 132 | # define OVERRIDABLE_FUNCTION [[gnu::weak, gnu::section("__lcxx_override")]] | ||
| 108 | extern char __start___lcxx_override; | 133 | extern char __start___lcxx_override; |
| 109 | extern char __stop___lcxx_override; | 134 | extern char __stop___lcxx_override; |
| 135 | # endif | ||
| 110 | 136 | ||
| 111 | _LIBCPP_BEGIN_NAMESPACE_STD | 137 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 112 | template <typename T, T* _Func> | 138 | template <typename T, T* _Func> |
| ... | @@ -115,20 +141,24 @@ _LIBCPP_HIDE_FROM_ABI inline bool __is_function_overridden() noexcept { | ... | @@ -115,20 +141,24 @@ _LIBCPP_HIDE_FROM_ABI inline bool __is_function_overridden() noexcept { |
| 115 | uintptr_t __end = reinterpret_cast<uintptr_t>(&__stop___lcxx_override); | 141 | uintptr_t __end = reinterpret_cast<uintptr_t>(&__stop___lcxx_override); |
| 116 | uintptr_t __ptr = reinterpret_cast<uintptr_t>(_Func); | 142 | uintptr_t __ptr = reinterpret_cast<uintptr_t>(_Func); |
| 117 | 143 | ||
| 118 | # if __has_feature(ptrauth_calls) | 144 | // We must pass a void* to ptrauth_strip since it only accepts a pointer type. Also, in particular, |
| 119 | // We must pass a void* to ptrauth_strip since it only accepts a pointer type. See full explanation above. | 145 | // we must NOT pass a function pointer, otherwise we will strip the function pointer, and then attempt |
| 146 | // to authenticate and re-sign it when casting it to a uintptr_t again, which will fail because we just | ||
| 147 | // stripped the function pointer. See rdar://122927845. | ||
| 120 | __ptr = reinterpret_cast<uintptr_t>(ptrauth_strip(reinterpret_cast<void*>(__ptr), ptrauth_key_function_pointer)); | 148 | __ptr = reinterpret_cast<uintptr_t>(ptrauth_strip(reinterpret_cast<void*>(__ptr), ptrauth_key_function_pointer)); |
| 121 | # endif | ||
| 122 | 149 | ||
| 150 | // Finally, the function was overridden if it falls outside of the section's bounds. | ||
| 123 | return __ptr < __start || __ptr > __end; | 151 | return __ptr < __start || __ptr > __end; |
| 124 | } | 152 | } |
| 125 | _LIBCPP_END_NAMESPACE_STD | 153 | _LIBCPP_END_NAMESPACE_STD |
| 126 | 154 | ||
| 127 | #else | 155 | # endif // __has_feature(ptrauth_calls) |
| 156 | |||
| 157 | #else // defined(_LIBCPP_OBJECT_FORMAT_MACHO) || (defined(_LIBCPP_OBJECT_FORMAT_ELF) && !defined(__NVPTX__)) | ||
| 128 | 158 | ||
| 129 | # define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 0 | 159 | # define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 0 |
| 130 | # define OVERRIDABLE_FUNCTION _LIBCPP_WEAK | 160 | # define OVERRIDABLE_FUNCTION [[gnu::weak]] |
| 131 | 161 | ||
| 132 | #endif | 162 | #endif // defined(_LIBCPP_OBJECT_FORMAT_MACHO) || (defined(_LIBCPP_OBJECT_FORMAT_ELF) && !defined(__NVPTX__)) |
| 133 | 163 | ||
| 134 | #endif // _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H | 164 | #endif // _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H |
lib/libcxx/src/include/refstring.h+1-1| ... | @@ -15,7 +15,7 @@ | ... | @@ -15,7 +15,7 @@ |
| 15 | #include <cstring> | 15 | #include <cstring> |
| 16 | #include <stdexcept> | 16 | #include <stdexcept> |
| 17 | 17 | ||
| 18 | // MacOS and iOS used to ship with libstdc++, and still support old applications | 18 | // macOS and iOS used to ship with libstdc++, and still support old applications |
| 19 | // linking against libstdc++. The libc++ and libstdc++ exceptions are supposed | 19 | // linking against libstdc++. The libc++ and libstdc++ exceptions are supposed |
| 20 | // to be ABI compatible, such that they can be thrown from one library and caught | 20 | // to be ABI compatible, such that they can be thrown from one library and caught |
| 21 | // in the other. | 21 | // in the other. |
lib/libcxx/src/include/ryu/ryu.h-18| ... | @@ -67,24 +67,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD | ... | @@ -67,24 +67,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 67 | 67 | ||
| 68 | // https://github.com/ulfjack/ryu/tree/59661c3/ryu | 68 | // https://github.com/ulfjack/ryu/tree/59661c3/ryu |
| 69 | 69 | ||
| 70 | #if !defined(_MSC_VER) | ||
| 71 | _LIBCPP_HIDE_FROM_ABI inline unsigned char _BitScanForward64(unsigned long* __index, unsigned long long __mask) { | ||
| 72 | if (__mask == 0) { | ||
| 73 | return false; | ||
| 74 | } | ||
| 75 | *__index = __builtin_ctzll(__mask); | ||
| 76 | return true; | ||
| 77 | } | ||
| 78 | |||
| 79 | _LIBCPP_HIDE_FROM_ABI inline unsigned char _BitScanForward(unsigned long* __index, unsigned int __mask) { | ||
| 80 | if (__mask == 0) { | ||
| 81 | return false; | ||
| 82 | } | ||
| 83 | *__index = __builtin_ctz(__mask); | ||
| 84 | return true; | ||
| 85 | } | ||
| 86 | #endif // !_MSC_VER | ||
| 87 | |||
| 88 | template <class _Floating> | 70 | template <class _Floating> |
| 89 | [[nodiscard]] to_chars_result _Floating_to_chars_ryu( | 71 | [[nodiscard]] to_chars_result _Floating_to_chars_ryu( |
| 90 | char* const _First, char* const _Last, const _Floating _Value, const chars_format _Fmt) noexcept { | 72 | char* const _First, char* const _Last, const _Floating _Value, const chars_format _Fmt) noexcept { |
lib/libcxx/src/include/to_chars_floating_point.h+1-1| ... | @@ -38,7 +38,7 @@ namespace __itoa { | ... | @@ -38,7 +38,7 @@ namespace __itoa { |
| 38 | inline constexpr char _Charconv_digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', | 38 | inline constexpr char _Charconv_digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', |
| 39 | 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; | 39 | 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; |
| 40 | static_assert(std::size(_Charconv_digits) == 36); | 40 | static_assert(std::size(_Charconv_digits) == 36); |
| 41 | } // __itoa | 41 | } // namespace __itoa |
| 42 | 42 | ||
| 43 | // vvvvvvvvvv DERIVED FROM corecrt_internal_fltintrn.h vvvvvvvvvv | 43 | // vvvvvvvvvv DERIVED FROM corecrt_internal_fltintrn.h vvvvvvvvvv |
| 44 | 44 |
lib/libcxx/src/ios.cpp+38-39| ... | @@ -9,6 +9,7 @@ | ... | @@ -9,6 +9,7 @@ |
| 9 | #include <__config> | 9 | #include <__config> |
| 10 | #include <__locale> | 10 | #include <__locale> |
| 11 | #include <algorithm> | 11 | #include <algorithm> |
| 12 | #include <atomic> | ||
| 12 | #include <ios> | 13 | #include <ios> |
| 13 | #include <limits> | 14 | #include <limits> |
| 14 | #include <memory> | 15 | #include <memory> |
| ... | @@ -22,6 +23,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -22,6 +23,7 @@ _LIBCPP_PUSH_MACROS |
| 22 | #include <__undef_macros> | 23 | #include <__undef_macros> |
| 23 | 24 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 25 | 27 | ||
| 26 | class _LIBCPP_HIDDEN __iostream_category : public __do_message { | 28 | class _LIBCPP_HIDDEN __iostream_category : public __do_message { |
| 27 | public: | 29 | public: |
| ... | @@ -102,25 +104,13 @@ void ios_base::__call_callbacks(event ev) { | ... | @@ -102,25 +104,13 @@ void ios_base::__call_callbacks(event ev) { |
| 102 | // locale | 104 | // locale |
| 103 | 105 | ||
| 104 | locale ios_base::imbue(const locale& newloc) { | 106 | locale ios_base::imbue(const locale& newloc) { |
| 105 | static_assert(sizeof(locale) == sizeof(__loc_), ""); | 107 | locale loc = newloc; |
| 106 | locale& loc_storage = *reinterpret_cast<locale*>(&__loc_); | 108 | std::swap(__loc_, loc); |
| 107 | locale oldloc = loc_storage; | ||
| 108 | loc_storage = newloc; | ||
| 109 | __call_callbacks(imbue_event); | 109 | __call_callbacks(imbue_event); |
| 110 | return oldloc; | 110 | return loc; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | locale ios_base::getloc() const { | 113 | locale ios_base::getloc() const { return __loc_; } |
| 114 | const locale& loc_storage = *reinterpret_cast<const locale*>(&__loc_); | ||
| 115 | return loc_storage; | ||
| 116 | } | ||
| 117 | |||
| 118 | // xalloc | ||
| 119 | #if _LIBCPP_HAS_C_ATOMIC_IMP && _LIBCPP_HAS_THREADS | ||
| 120 | atomic<int> ios_base::__xindex_{0}; | ||
| 121 | #else | ||
| 122 | int ios_base::__xindex_ = 0; | ||
| 123 | #endif | ||
| 124 | 114 | ||
| 125 | template <typename _Tp> | 115 | template <typename _Tp> |
| 126 | static size_t __ios_new_cap(size_t __req_size, size_t __current_cap) { // Precondition: __req_size > __current_cap | 116 | static size_t __ios_new_cap(size_t __req_size, size_t __current_cap) { // Precondition: __req_size > __current_cap |
| ... | @@ -131,7 +121,17 @@ static size_t __ios_new_cap(size_t __req_size, size_t __current_cap) { // Precon | ... | @@ -131,7 +121,17 @@ static size_t __ios_new_cap(size_t __req_size, size_t __current_cap) { // Precon |
| 131 | return mx; | 121 | return mx; |
| 132 | } | 122 | } |
| 133 | 123 | ||
| 134 | int ios_base::xalloc() { return __xindex_++; } | 124 | int ios_base::xalloc() { |
| 125 | #if _LIBCPP_HAS_THREADS | ||
| 126 | constinit static atomic<int> xindex = 0; | ||
| 127 | #else | ||
| 128 | // If we don't have atomics, fall back to single-threaded implementation. | ||
| 129 | // FIXME: Should "single-threaded" be a separate option from | ||
| 130 | // _LIBCPP_HAS_THREADS? | ||
| 131 | static int xindex = 0; | ||
| 132 | #endif // _LIBCPP_HAS_THREADS | ||
| 133 | return xindex++; | ||
| 134 | } | ||
| 135 | 135 | ||
| 136 | long& ios_base::iword(int index) { | 136 | long& ios_base::iword(int index) { |
| 137 | size_t req_size = static_cast<size_t>(index) + 1; | 137 | size_t req_size = static_cast<size_t>(index) + 1; |
| ... | @@ -180,12 +180,16 @@ void ios_base::register_callback(event_callback fn, int index) { | ... | @@ -180,12 +180,16 @@ void ios_base::register_callback(event_callback fn, int index) { |
| 180 | if (req_size > __event_cap_) { | 180 | if (req_size > __event_cap_) { |
| 181 | size_t newcap = __ios_new_cap<event_callback>(req_size, __event_cap_); | 181 | size_t newcap = __ios_new_cap<event_callback>(req_size, __event_cap_); |
| 182 | event_callback* fns = static_cast<event_callback*>(realloc(__fn_, newcap * sizeof(event_callback))); | 182 | event_callback* fns = static_cast<event_callback*>(realloc(__fn_, newcap * sizeof(event_callback))); |
| 183 | if (fns == 0) | 183 | if (fns == 0) { |
| 184 | setstate(badbit); | 184 | setstate(badbit); |
| 185 | return; | ||
| 186 | } | ||
| 185 | __fn_ = fns; | 187 | __fn_ = fns; |
| 186 | int* indxs = static_cast<int*>(realloc(__index_, newcap * sizeof(int))); | 188 | int* indxs = static_cast<int*>(realloc(__index_, newcap * sizeof(int))); |
| 187 | if (indxs == 0) | 189 | if (indxs == 0) { |
| 188 | setstate(badbit); | 190 | setstate(badbit); |
| 191 | return; | ||
| 192 | } | ||
| 189 | __index_ = indxs; | 193 | __index_ = indxs; |
| 190 | __event_cap_ = newcap; | 194 | __event_cap_ = newcap; |
| 191 | } | 195 | } |
| ... | @@ -197,11 +201,10 @@ void ios_base::register_callback(event_callback fn, int index) { | ... | @@ -197,11 +201,10 @@ void ios_base::register_callback(event_callback fn, int index) { |
| 197 | ios_base::~ios_base() { | 201 | ios_base::~ios_base() { |
| 198 | // Avoid UB when not properly initialized. See ios_base::ios_base for | 202 | // Avoid UB when not properly initialized. See ios_base::ios_base for |
| 199 | // more information. | 203 | // more information. |
| 200 | if (!__loc_) | 204 | if (!__loc_.__locale_) |
| 201 | return; | 205 | return; |
| 202 | __call_callbacks(erase_event); | 206 | __call_callbacks(erase_event); |
| 203 | locale& loc_storage = *reinterpret_cast<locale*>(&__loc_); | 207 | __loc_.~locale(); |
| 204 | loc_storage.~locale(); | ||
| 205 | free(__fn_); | 208 | free(__fn_); |
| 206 | free(__index_); | 209 | free(__index_); |
| 207 | free(__iarray_); | 210 | free(__iarray_); |
| ... | @@ -273,12 +276,10 @@ void ios_base::copyfmt(const ios_base& rhs) { | ... | @@ -273,12 +276,10 @@ void ios_base::copyfmt(const ios_base& rhs) { |
| 273 | std::__throw_bad_alloc(); | 276 | std::__throw_bad_alloc(); |
| 274 | } | 277 | } |
| 275 | // Got everything we need. Copy everything but __rdstate_, __rdbuf_ and __exceptions_ | 278 | // Got everything we need. Copy everything but __rdstate_, __rdbuf_ and __exceptions_ |
| 276 | __fmtflags_ = rhs.__fmtflags_; | 279 | __fmtflags_ = rhs.__fmtflags_; |
| 277 | __precision_ = rhs.__precision_; | 280 | __precision_ = rhs.__precision_; |
| 278 | __width_ = rhs.__width_; | 281 | __width_ = rhs.__width_; |
| 279 | locale& lhs_loc = *reinterpret_cast<locale*>(&__loc_); | 282 | __loc_ = rhs.__loc_; |
| 280 | const locale& rhs_loc = *reinterpret_cast<const locale*>(&rhs.__loc_); | ||
| 281 | lhs_loc = rhs_loc; | ||
| 282 | if (__event_cap_ < rhs.__event_size_) { | 283 | if (__event_cap_ < rhs.__event_size_) { |
| 283 | free(__fn_); | 284 | free(__fn_); |
| 284 | __fn_ = new_callbacks.release(); | 285 | __fn_ = new_callbacks.release(); |
| ... | @@ -308,14 +309,13 @@ void ios_base::copyfmt(const ios_base& rhs) { | ... | @@ -308,14 +309,13 @@ void ios_base::copyfmt(const ios_base& rhs) { |
| 308 | 309 | ||
| 309 | void ios_base::move(ios_base& rhs) { | 310 | void ios_base::move(ios_base& rhs) { |
| 310 | // *this is uninitialized | 311 | // *this is uninitialized |
| 311 | __fmtflags_ = rhs.__fmtflags_; | 312 | __fmtflags_ = rhs.__fmtflags_; |
| 312 | __precision_ = rhs.__precision_; | 313 | __precision_ = rhs.__precision_; |
| 313 | __width_ = rhs.__width_; | 314 | __width_ = rhs.__width_; |
| 314 | __rdstate_ = rhs.__rdstate_; | 315 | __rdstate_ = rhs.__rdstate_; |
| 315 | __exceptions_ = rhs.__exceptions_; | 316 | __exceptions_ = rhs.__exceptions_; |
| 316 | __rdbuf_ = 0; | 317 | __rdbuf_ = 0; |
| 317 | locale& rhs_loc = *reinterpret_cast<locale*>(&rhs.__loc_); | 318 | ::new (&__loc_) locale(rhs.__loc_); |
| 318 | ::new (&__loc_) locale(rhs_loc); | ||
| 319 | __fn_ = rhs.__fn_; | 319 | __fn_ = rhs.__fn_; |
| 320 | rhs.__fn_ = 0; | 320 | rhs.__fn_ = 0; |
| 321 | __index_ = rhs.__index_; | 321 | __index_ = rhs.__index_; |
| ... | @@ -344,9 +344,7 @@ void ios_base::swap(ios_base& rhs) noexcept { | ... | @@ -344,9 +344,7 @@ void ios_base::swap(ios_base& rhs) noexcept { |
| 344 | std::swap(__width_, rhs.__width_); | 344 | std::swap(__width_, rhs.__width_); |
| 345 | std::swap(__rdstate_, rhs.__rdstate_); | 345 | std::swap(__rdstate_, rhs.__rdstate_); |
| 346 | std::swap(__exceptions_, rhs.__exceptions_); | 346 | std::swap(__exceptions_, rhs.__exceptions_); |
| 347 | locale& lhs_loc = *reinterpret_cast<locale*>(&__loc_); | 347 | std::swap(__loc_, rhs.__loc_); |
| 348 | locale& rhs_loc = *reinterpret_cast<locale*>(&rhs.__loc_); | ||
| 349 | std::swap(lhs_loc, rhs_loc); | ||
| 350 | std::swap(__fn_, rhs.__fn_); | 348 | std::swap(__fn_, rhs.__fn_); |
| 351 | std::swap(__index_, rhs.__index_); | 349 | std::swap(__index_, rhs.__index_); |
| 352 | std::swap(__event_size_, rhs.__event_size_); | 350 | std::swap(__event_size_, rhs.__event_size_); |
| ... | @@ -382,6 +380,7 @@ bool ios_base::sync_with_stdio(bool sync) { | ... | @@ -382,6 +380,7 @@ bool ios_base::sync_with_stdio(bool sync) { |
| 382 | return r; | 380 | return r; |
| 383 | } | 381 | } |
| 384 | 382 | ||
| 383 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 385 | _LIBCPP_END_NAMESPACE_STD | 384 | _LIBCPP_END_NAMESPACE_STD |
| 386 | 385 | ||
| 387 | _LIBCPP_POP_MACROS | 386 | _LIBCPP_POP_MACROS |
lib/libcxx/src/ios.instantiations.cpp+21| ... | @@ -15,6 +15,26 @@ | ... | @@ -15,6 +15,26 @@ |
| 15 | #include <streambuf> | 15 | #include <streambuf> |
| 16 | 16 | ||
| 17 | _LIBCPP_BEGIN_NAMESPACE_STD | 17 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 18 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 19 | |||
| 20 | #if _LIBCPP_HAS_FILESYSTEM | ||
| 21 | // This is provided for ABI compatiblity with programs compiled against old headers. | ||
| 22 | // TODO: Is this actually required? If so, this should be guarded with | ||
| 23 | // `_LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 24`. Otherwise this should be removed. | ||
| 24 | template <class _CharT, class _Traits> | ||
| 25 | bool basic_filebuf<_CharT, _Traits>::__read_mode() { | ||
| 26 | if (!(__cm_ & ios_base::in)) { | ||
| 27 | this->setp(nullptr, nullptr); | ||
| 28 | if (__always_noconv_) | ||
| 29 | this->setg((char_type*)__extbuf_, (char_type*)__extbuf_ + __ebs_, (char_type*)__extbuf_ + __ebs_); | ||
| 30 | else | ||
| 31 | this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_); | ||
| 32 | __cm_ = ios_base::in; | ||
| 33 | return true; | ||
| 34 | } | ||
| 35 | return false; | ||
| 36 | } | ||
| 37 | #endif | ||
| 18 | 38 | ||
| 19 | // Original explicit instantiations provided in the library | 39 | // Original explicit instantiations provided in the library |
| 20 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>; | 40 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>; |
| ... | @@ -45,4 +65,5 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_filebuf<char>; | ... | @@ -45,4 +65,5 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_filebuf<char>; |
| 45 | 65 | ||
| 46 | // Add more here if needed... | 66 | // Add more here if needed... |
| 47 | 67 | ||
| 68 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 48 | _LIBCPP_END_NAMESPACE_STD | 69 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/iostream.cpp+2| ... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
| 15 | #define ABI_NAMESPACE_STR _LIBCPP_TOSTRING(_LIBCPP_ABI_NAMESPACE) | 15 | #define ABI_NAMESPACE_STR _LIBCPP_TOSTRING(_LIBCPP_ABI_NAMESPACE) |
| 16 | 16 | ||
| 17 | _LIBCPP_BEGIN_NAMESPACE_STD | 17 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 18 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 18 | 19 | ||
| 19 | // This file implements the various stream objects provided inside <iostream>. We're doing some ODR violations in here, | 20 | // This file implements the various stream objects provided inside <iostream>. We're doing some ODR violations in here, |
| 20 | // so this quite fragile. Specifically, the size of the stream objects (i.e. cout, cin etc.) needs to stay the same. | 21 | // so this quite fragile. Specifically, the size of the stream objects (i.e. cout, cin etc.) needs to stay the same. |
| ... | @@ -154,4 +155,5 @@ ios_base::Init::Init() { | ... | @@ -154,4 +155,5 @@ ios_base::Init::Init() { |
| 154 | 155 | ||
| 155 | ios_base::Init::~Init() {} | 156 | ios_base::Init::~Init() {} |
| 156 | 157 | ||
| 158 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 157 | _LIBCPP_END_NAMESPACE_STD | 159 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/locale.cpp+22-18| ... | @@ -45,6 +45,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -45,6 +45,7 @@ _LIBCPP_PUSH_MACROS |
| 45 | #include <__undef_macros> | 45 | #include <__undef_macros> |
| 46 | 46 | ||
| 47 | _LIBCPP_BEGIN_NAMESPACE_STD | 47 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 48 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 48 | 49 | ||
| 49 | struct __libcpp_unique_locale { | 50 | struct __libcpp_unique_locale { |
| 50 | __libcpp_unique_locale(const char* nm) : __loc_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm, 0)) {} | 51 | __libcpp_unique_locale(const char* nm) : __loc_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm, 0)) {} |
| ... | @@ -158,11 +159,11 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") { | ... | @@ -158,11 +159,11 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") { |
| 158 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | 159 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 159 | install(&make<codecvt<char16_t, char, mbstate_t> >(1u)); | 160 | install(&make<codecvt<char16_t, char, mbstate_t> >(1u)); |
| 160 | install(&make<codecvt<char32_t, char, mbstate_t> >(1u)); | 161 | install(&make<codecvt<char32_t, char, mbstate_t> >(1u)); |
| 161 | _LIBCPP_SUPPRESS_DEPRECATED_POP | ||
| 162 | #if _LIBCPP_HAS_CHAR8_T | 162 | #if _LIBCPP_HAS_CHAR8_T |
| 163 | install(&make<codecvt<char16_t, char8_t, mbstate_t> >(1u)); | 163 | install(&make<codecvt<char16_t, char8_t, mbstate_t> >(1u)); |
| 164 | install(&make<codecvt<char32_t, char8_t, mbstate_t> >(1u)); | 164 | install(&make<codecvt<char32_t, char8_t, mbstate_t> >(1u)); |
| 165 | #endif | 165 | #endif |
| 166 | _LIBCPP_SUPPRESS_DEPRECATED_POP | ||
| 166 | install(&make<numpunct<char> >(1u)); | 167 | install(&make<numpunct<char> >(1u)); |
| 167 | #if _LIBCPP_HAS_WIDE_CHARACTERS | 168 | #if _LIBCPP_HAS_WIDE_CHARACTERS |
| 168 | install(&make<numpunct<wchar_t> >(1u)); | 169 | install(&make<numpunct<wchar_t> >(1u)); |
| ... | @@ -228,11 +229,11 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), | ... | @@ -228,11 +229,11 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), |
| 228 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | 229 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 229 | install(new codecvt_byname<char16_t, char, mbstate_t>(name_)); | 230 | install(new codecvt_byname<char16_t, char, mbstate_t>(name_)); |
| 230 | install(new codecvt_byname<char32_t, char, mbstate_t>(name_)); | 231 | install(new codecvt_byname<char32_t, char, mbstate_t>(name_)); |
| 231 | _LIBCPP_SUPPRESS_DEPRECATED_POP | ||
| 232 | #if _LIBCPP_HAS_CHAR8_T | 232 | #if _LIBCPP_HAS_CHAR8_T |
| 233 | install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name_)); | 233 | install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name_)); |
| 234 | install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_)); | 234 | install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_)); |
| 235 | #endif | 235 | #endif |
| 236 | _LIBCPP_SUPPRESS_DEPRECATED_POP | ||
| 236 | install(new numpunct_byname<char>(name_)); | 237 | install(new numpunct_byname<char>(name_)); |
| 237 | #if _LIBCPP_HAS_WIDE_CHARACTERS | 238 | #if _LIBCPP_HAS_WIDE_CHARACTERS |
| 238 | install(new numpunct_byname<wchar_t>(name_)); | 239 | install(new numpunct_byname<wchar_t>(name_)); |
| ... | @@ -294,11 +295,11 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c) | ... | @@ -294,11 +295,11 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c) |
| 294 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | 295 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 295 | install(new codecvt_byname<char16_t, char, mbstate_t>(name)); | 296 | install(new codecvt_byname<char16_t, char, mbstate_t>(name)); |
| 296 | install(new codecvt_byname<char32_t, char, mbstate_t>(name)); | 297 | install(new codecvt_byname<char32_t, char, mbstate_t>(name)); |
| 297 | _LIBCPP_SUPPRESS_DEPRECATED_POP | ||
| 298 | #if _LIBCPP_HAS_CHAR8_T | 298 | #if _LIBCPP_HAS_CHAR8_T |
| 299 | install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name)); | 299 | install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name)); |
| 300 | install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name)); | 300 | install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name)); |
| 301 | #endif | 301 | #endif |
| 302 | _LIBCPP_SUPPRESS_DEPRECATED_POP | ||
| 302 | } | 303 | } |
| 303 | if (c & locale::monetary) { | 304 | if (c & locale::monetary) { |
| 304 | install(new moneypunct_byname<char, false>(name)); | 305 | install(new moneypunct_byname<char, false>(name)); |
| ... | @@ -366,11 +367,11 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c) | ... | @@ -366,11 +367,11 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c) |
| 366 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | 367 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 367 | install_from<std::codecvt<char16_t, char, mbstate_t> >(one); | 368 | install_from<std::codecvt<char16_t, char, mbstate_t> >(one); |
| 368 | install_from<std::codecvt<char32_t, char, mbstate_t> >(one); | 369 | install_from<std::codecvt<char32_t, char, mbstate_t> >(one); |
| 369 | _LIBCPP_SUPPRESS_DEPRECATED_POP | ||
| 370 | #if _LIBCPP_HAS_CHAR8_T | 370 | #if _LIBCPP_HAS_CHAR8_T |
| 371 | install_from<std::codecvt<char16_t, char8_t, mbstate_t> >(one); | 371 | install_from<std::codecvt<char16_t, char8_t, mbstate_t> >(one); |
| 372 | install_from<std::codecvt<char32_t, char8_t, mbstate_t> >(one); | 372 | install_from<std::codecvt<char32_t, char8_t, mbstate_t> >(one); |
| 373 | #endif | 373 | #endif |
| 374 | _LIBCPP_SUPPRESS_DEPRECATED_POP | ||
| 374 | #if _LIBCPP_HAS_WIDE_CHARACTERS | 375 | #if _LIBCPP_HAS_WIDE_CHARACTERS |
| 375 | install_from<std::codecvt<wchar_t, char, mbstate_t> >(one); | 376 | install_from<std::codecvt<wchar_t, char, mbstate_t> >(one); |
| 376 | #endif | 377 | #endif |
| ... | @@ -2318,7 +2319,7 @@ static codecvt_base::result utf16be_to_ucs4( | ... | @@ -2318,7 +2319,7 @@ static codecvt_base::result utf16be_to_ucs4( |
| 2318 | frm_nxt += 2; | 2319 | frm_nxt += 2; |
| 2319 | } | 2320 | } |
| 2320 | for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { | 2321 | for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { |
| 2321 | uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]); | 2322 | uint16_t c1 = static_cast<uint16_t>((frm_nxt[0] << 8) | frm_nxt[1]); |
| 2322 | if ((c1 & 0xFC00) == 0xDC00) | 2323 | if ((c1 & 0xFC00) == 0xDC00) |
| 2323 | return codecvt_base::error; | 2324 | return codecvt_base::error; |
| 2324 | if ((c1 & 0xFC00) != 0xD800) { | 2325 | if ((c1 & 0xFC00) != 0xD800) { |
| ... | @@ -2329,7 +2330,7 @@ static codecvt_base::result utf16be_to_ucs4( | ... | @@ -2329,7 +2330,7 @@ static codecvt_base::result utf16be_to_ucs4( |
| 2329 | } else { | 2330 | } else { |
| 2330 | if (frm_end - frm_nxt < 4) | 2331 | if (frm_end - frm_nxt < 4) |
| 2331 | return codecvt_base::partial; | 2332 | return codecvt_base::partial; |
| 2332 | uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]); | 2333 | uint16_t c2 = static_cast<uint16_t>((frm_nxt[2] << 8) | frm_nxt[3]); |
| 2333 | if ((c2 & 0xFC00) != 0xDC00) | 2334 | if ((c2 & 0xFC00) != 0xDC00) |
| 2334 | return codecvt_base::error; | 2335 | return codecvt_base::error; |
| 2335 | uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF)); | 2336 | uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF)); |
| ... | @@ -2354,7 +2355,7 @@ static int utf16be_to_ucs4_length( | ... | @@ -2354,7 +2355,7 @@ static int utf16be_to_ucs4_length( |
| 2354 | frm_nxt += 2; | 2355 | frm_nxt += 2; |
| 2355 | } | 2356 | } |
| 2356 | for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) { | 2357 | for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) { |
| 2357 | uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]); | 2358 | uint16_t c1 = static_cast<uint16_t>((frm_nxt[0] << 8) | frm_nxt[1]); |
| 2358 | if ((c1 & 0xFC00) == 0xDC00) | 2359 | if ((c1 & 0xFC00) == 0xDC00) |
| 2359 | break; | 2360 | break; |
| 2360 | if ((c1 & 0xFC00) != 0xD800) { | 2361 | if ((c1 & 0xFC00) != 0xD800) { |
| ... | @@ -2364,7 +2365,7 @@ static int utf16be_to_ucs4_length( | ... | @@ -2364,7 +2365,7 @@ static int utf16be_to_ucs4_length( |
| 2364 | } else { | 2365 | } else { |
| 2365 | if (frm_end - frm_nxt < 4) | 2366 | if (frm_end - frm_nxt < 4) |
| 2366 | break; | 2367 | break; |
| 2367 | uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]); | 2368 | uint16_t c2 = static_cast<uint16_t>((frm_nxt[2] << 8) | frm_nxt[3]); |
| 2368 | if ((c2 & 0xFC00) != 0xDC00) | 2369 | if ((c2 & 0xFC00) != 0xDC00) |
| 2369 | break; | 2370 | break; |
| 2370 | uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF)); | 2371 | uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF)); |
| ... | @@ -2432,7 +2433,7 @@ static codecvt_base::result utf16le_to_ucs4( | ... | @@ -2432,7 +2433,7 @@ static codecvt_base::result utf16le_to_ucs4( |
| 2432 | frm_nxt += 2; | 2433 | frm_nxt += 2; |
| 2433 | } | 2434 | } |
| 2434 | for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { | 2435 | for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { |
| 2435 | uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]); | 2436 | uint16_t c1 = static_cast<uint16_t>((frm_nxt[1] << 8) | frm_nxt[0]); |
| 2436 | if ((c1 & 0xFC00) == 0xDC00) | 2437 | if ((c1 & 0xFC00) == 0xDC00) |
| 2437 | return codecvt_base::error; | 2438 | return codecvt_base::error; |
| 2438 | if ((c1 & 0xFC00) != 0xD800) { | 2439 | if ((c1 & 0xFC00) != 0xD800) { |
| ... | @@ -2443,7 +2444,7 @@ static codecvt_base::result utf16le_to_ucs4( | ... | @@ -2443,7 +2444,7 @@ static codecvt_base::result utf16le_to_ucs4( |
| 2443 | } else { | 2444 | } else { |
| 2444 | if (frm_end - frm_nxt < 4) | 2445 | if (frm_end - frm_nxt < 4) |
| 2445 | return codecvt_base::partial; | 2446 | return codecvt_base::partial; |
| 2446 | uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]); | 2447 | uint16_t c2 = static_cast<uint16_t>((frm_nxt[3] << 8) | frm_nxt[2]); |
| 2447 | if ((c2 & 0xFC00) != 0xDC00) | 2448 | if ((c2 & 0xFC00) != 0xDC00) |
| 2448 | return codecvt_base::error; | 2449 | return codecvt_base::error; |
| 2449 | uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF)); | 2450 | uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF)); |
| ... | @@ -2468,7 +2469,7 @@ static int utf16le_to_ucs4_length( | ... | @@ -2468,7 +2469,7 @@ static int utf16le_to_ucs4_length( |
| 2468 | frm_nxt += 2; | 2469 | frm_nxt += 2; |
| 2469 | } | 2470 | } |
| 2470 | for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) { | 2471 | for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) { |
| 2471 | uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]); | 2472 | uint16_t c1 = static_cast<uint16_t>((frm_nxt[1] << 8) | frm_nxt[0]); |
| 2472 | if ((c1 & 0xFC00) == 0xDC00) | 2473 | if ((c1 & 0xFC00) == 0xDC00) |
| 2473 | break; | 2474 | break; |
| 2474 | if ((c1 & 0xFC00) != 0xD800) { | 2475 | if ((c1 & 0xFC00) != 0xD800) { |
| ... | @@ -2478,7 +2479,7 @@ static int utf16le_to_ucs4_length( | ... | @@ -2478,7 +2479,7 @@ static int utf16le_to_ucs4_length( |
| 2478 | } else { | 2479 | } else { |
| 2479 | if (frm_end - frm_nxt < 4) | 2480 | if (frm_end - frm_nxt < 4) |
| 2480 | break; | 2481 | break; |
| 2481 | uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]); | 2482 | uint16_t c2 = static_cast<uint16_t>((frm_nxt[3] << 8) | frm_nxt[2]); |
| 2482 | if ((c2 & 0xFC00) != 0xDC00) | 2483 | if ((c2 & 0xFC00) != 0xDC00) |
| 2483 | break; | 2484 | break; |
| 2484 | uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF)); | 2485 | uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF)); |
| ... | @@ -2535,7 +2536,7 @@ static codecvt_base::result utf16be_to_ucs2( | ... | @@ -2535,7 +2536,7 @@ static codecvt_base::result utf16be_to_ucs2( |
| 2535 | frm_nxt += 2; | 2536 | frm_nxt += 2; |
| 2536 | } | 2537 | } |
| 2537 | for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { | 2538 | for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { |
| 2538 | uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]); | 2539 | uint16_t c1 = static_cast<uint16_t>((frm_nxt[0] << 8) | frm_nxt[1]); |
| 2539 | if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) | 2540 | if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) |
| 2540 | return codecvt_base::error; | 2541 | return codecvt_base::error; |
| 2541 | *to_nxt = c1; | 2542 | *to_nxt = c1; |
| ... | @@ -2556,7 +2557,7 @@ static int utf16be_to_ucs2_length( | ... | @@ -2556,7 +2557,7 @@ static int utf16be_to_ucs2_length( |
| 2556 | frm_nxt += 2; | 2557 | frm_nxt += 2; |
| 2557 | } | 2558 | } |
| 2558 | for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) { | 2559 | for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) { |
| 2559 | uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]); | 2560 | uint16_t c1 = static_cast<uint16_t>((frm_nxt[0] << 8) | frm_nxt[1]); |
| 2560 | if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) | 2561 | if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) |
| 2561 | break; | 2562 | break; |
| 2562 | frm_nxt += 2; | 2563 | frm_nxt += 2; |
| ... | @@ -2609,7 +2610,7 @@ static codecvt_base::result utf16le_to_ucs2( | ... | @@ -2609,7 +2610,7 @@ static codecvt_base::result utf16le_to_ucs2( |
| 2609 | frm_nxt += 2; | 2610 | frm_nxt += 2; |
| 2610 | } | 2611 | } |
| 2611 | for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { | 2612 | for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { |
| 2612 | uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]); | 2613 | uint16_t c1 = static_cast<uint16_t>((frm_nxt[1] << 8) | frm_nxt[0]); |
| 2613 | if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) | 2614 | if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) |
| 2614 | return codecvt_base::error; | 2615 | return codecvt_base::error; |
| 2615 | *to_nxt = c1; | 2616 | *to_nxt = c1; |
| ... | @@ -2631,7 +2632,7 @@ static int utf16le_to_ucs2_length( | ... | @@ -2631,7 +2632,7 @@ static int utf16le_to_ucs2_length( |
| 2631 | frm_nxt += 2; | 2632 | frm_nxt += 2; |
| 2632 | } | 2633 | } |
| 2633 | for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) { | 2634 | for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) { |
| 2634 | uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]); | 2635 | uint16_t c1 = static_cast<uint16_t>((frm_nxt[1] << 8) | frm_nxt[0]); |
| 2635 | if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) | 2636 | if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) |
| 2636 | break; | 2637 | break; |
| 2637 | frm_nxt += 2; | 2638 | frm_nxt += 2; |
| ... | @@ -5651,10 +5652,13 @@ template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_ | ... | @@ -5651,10 +5652,13 @@ template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_ |
| 5651 | template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS | 5652 | template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS |
| 5652 | codecvt_byname<char32_t, char, mbstate_t>; | 5653 | codecvt_byname<char32_t, char, mbstate_t>; |
| 5653 | #if _LIBCPP_HAS_CHAR8_T | 5654 | #if _LIBCPP_HAS_CHAR8_T |
| 5654 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char8_t, mbstate_t>; | 5655 | template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS |
| 5655 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char8_t, mbstate_t>; | 5656 | codecvt_byname<char16_t, char8_t, mbstate_t>; |
| 5657 | template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS | ||
| 5658 | codecvt_byname<char32_t, char8_t, mbstate_t>; | ||
| 5656 | #endif | 5659 | #endif |
| 5657 | 5660 | ||
| 5661 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 5658 | _LIBCPP_END_NAMESPACE_STD | 5662 | _LIBCPP_END_NAMESPACE_STD |
| 5659 | 5663 | ||
| 5660 | _LIBCPP_POP_MACROS | 5664 | _LIBCPP_POP_MACROS |
lib/libcxx/src/memory.cpp+3-2| ... | @@ -7,8 +7,7 @@ | ... | @@ -7,8 +7,7 @@ |
| 7 | //===----------------------------------------------------------------------===// | 7 | //===----------------------------------------------------------------------===// |
| 8 | 8 | ||
| 9 | #include <__config> | 9 | #include <__config> |
| 10 | #if !defined(_LIBCPP_OBJECT_FORMAT_COFF) && !defined(_LIBCPP_OBJECT_FORMAT_XCOFF) && \ | 10 | #if !defined(_LIBCPP_OBJECT_FORMAT_COFF) && _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 5 |
| 11 | _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 5 | ||
| 12 | # define _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS | 11 | # define _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS |
| 13 | #endif | 12 | #endif |
| 14 | 13 | ||
| ... | @@ -27,6 +26,7 @@ | ... | @@ -27,6 +26,7 @@ |
| 27 | #include "include/atomic_support.h" | 26 | #include "include/atomic_support.h" |
| 28 | 27 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 30 | 30 | ||
| 31 | bad_weak_ptr::~bad_weak_ptr() noexcept {} | 31 | bad_weak_ptr::~bad_weak_ptr() noexcept {} |
| 32 | 32 | ||
| ... | @@ -145,4 +145,5 @@ _LIBCPP_DIAGNOSTIC_POP | ... | @@ -145,4 +145,5 @@ _LIBCPP_DIAGNOSTIC_POP |
| 145 | 145 | ||
| 146 | #endif | 146 | #endif |
| 147 | 147 | ||
| 148 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 148 | _LIBCPP_END_NAMESPACE_STD | 149 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/memory_resource.cpp+3-34| ... | @@ -6,20 +6,13 @@ | ... | @@ -6,20 +6,13 @@ |
| 6 | // | 6 | // |
| 7 | //===----------------------------------------------------------------------===// | 7 | //===----------------------------------------------------------------------===// |
| 8 | 8 | ||
| 9 | #include <atomic> | ||
| 9 | #include <cstddef> | 10 | #include <cstddef> |
| 10 | #include <memory> | 11 | #include <memory> |
| 11 | #include <memory_resource> | 12 | #include <memory_resource> |
| 12 | 13 | ||
| 13 | #if _LIBCPP_HAS_ATOMIC_HEADER | ||
| 14 | # include <atomic> | ||
| 15 | #elif _LIBCPP_HAS_THREADS | ||
| 16 | # include <mutex> | ||
| 17 | # if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB) | ||
| 18 | # pragma comment(lib, "pthread") | ||
| 19 | # endif | ||
| 20 | #endif | ||
| 21 | |||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | 14 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 15 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 23 | 16 | ||
| 24 | namespace pmr { | 17 | namespace pmr { |
| 25 | 18 | ||
| ... | @@ -94,7 +87,6 @@ memory_resource* null_memory_resource() noexcept { return &res_init.resources.nu | ... | @@ -94,7 +87,6 @@ memory_resource* null_memory_resource() noexcept { return &res_init.resources.nu |
| 94 | // default_memory_resource() | 87 | // default_memory_resource() |
| 95 | 88 | ||
| 96 | static memory_resource* __default_memory_resource(bool set = false, memory_resource* new_res = nullptr) noexcept { | 89 | static memory_resource* __default_memory_resource(bool set = false, memory_resource* new_res = nullptr) noexcept { |
| 97 | #if _LIBCPP_HAS_ATOMIC_HEADER | ||
| 98 | static constinit atomic<memory_resource*> __res{&res_init.resources.new_delete_res}; | 90 | static constinit atomic<memory_resource*> __res{&res_init.resources.new_delete_res}; |
| 99 | if (set) { | 91 | if (set) { |
| 100 | new_res = new_res ? new_res : new_delete_resource(); | 92 | new_res = new_res ? new_res : new_delete_resource(); |
| ... | @@ -103,30 +95,6 @@ static memory_resource* __default_memory_resource(bool set = false, memory_resou | ... | @@ -103,30 +95,6 @@ static memory_resource* __default_memory_resource(bool set = false, memory_resou |
| 103 | } else { | 95 | } else { |
| 104 | return std::atomic_load_explicit(&__res, memory_order_acquire); | 96 | return std::atomic_load_explicit(&__res, memory_order_acquire); |
| 105 | } | 97 | } |
| 106 | #elif _LIBCPP_HAS_THREADS | ||
| 107 | static constinit memory_resource* res = &res_init.resources.new_delete_res; | ||
| 108 | static mutex res_lock; | ||
| 109 | if (set) { | ||
| 110 | new_res = new_res ? new_res : new_delete_resource(); | ||
| 111 | lock_guard<mutex> guard(res_lock); | ||
| 112 | memory_resource* old_res = res; | ||
| 113 | res = new_res; | ||
| 114 | return old_res; | ||
| 115 | } else { | ||
| 116 | lock_guard<mutex> guard(res_lock); | ||
| 117 | return res; | ||
| 118 | } | ||
| 119 | #else | ||
| 120 | static constinit memory_resource* res = &res_init.resources.new_delete_res; | ||
| 121 | if (set) { | ||
| 122 | new_res = new_res ? new_res : new_delete_resource(); | ||
| 123 | memory_resource* old_res = res; | ||
| 124 | res = new_res; | ||
| 125 | return old_res; | ||
| 126 | } else { | ||
| 127 | return res; | ||
| 128 | } | ||
| 129 | #endif | ||
| 130 | } | 98 | } |
| 131 | 99 | ||
| 132 | memory_resource* get_default_resource() noexcept { return __default_memory_resource(); } | 100 | memory_resource* get_default_resource() noexcept { return __default_memory_resource(); } |
| ... | @@ -497,4 +465,5 @@ void* monotonic_buffer_resource::do_allocate(size_t bytes, size_t align) { | ... | @@ -497,4 +465,5 @@ void* monotonic_buffer_resource::do_allocate(size_t bytes, size_t align) { |
| 497 | 465 | ||
| 498 | } // namespace pmr | 466 | } // namespace pmr |
| 499 | 467 | ||
| 468 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 500 | _LIBCPP_END_NAMESPACE_STD | 469 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/mutex.cpp+2| ... | @@ -23,6 +23,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -23,6 +23,7 @@ _LIBCPP_PUSH_MACROS |
| 23 | #include <__undef_macros> | 23 | #include <__undef_macros> |
| 24 | 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 26 | 27 | ||
| 27 | // ~mutex is defined elsewhere | 28 | // ~mutex is defined elsewhere |
| 28 | 29 | ||
| ... | @@ -141,6 +142,7 @@ void recursive_timed_mutex::unlock() noexcept { | ... | @@ -141,6 +142,7 @@ void recursive_timed_mutex::unlock() noexcept { |
| 141 | } | 142 | } |
| 142 | } | 143 | } |
| 143 | 144 | ||
| 145 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 144 | _LIBCPP_END_NAMESPACE_STD | 146 | _LIBCPP_END_NAMESPACE_STD |
| 145 | 147 | ||
| 146 | _LIBCPP_POP_MACROS | 148 | _LIBCPP_POP_MACROS |
lib/libcxx/src/mutex_destructor.cpp+2| ... | @@ -24,6 +24,7 @@ | ... | @@ -24,6 +24,7 @@ |
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 27 | 28 | ||
| 28 | #ifdef NEEDS_MUTEX_DESTRUCTOR | 29 | #ifdef NEEDS_MUTEX_DESTRUCTOR |
| 29 | class _LIBCPP_EXPORTED_FROM_ABI mutex { | 30 | class _LIBCPP_EXPORTED_FROM_ABI mutex { |
| ... | @@ -39,4 +40,5 @@ public: | ... | @@ -39,4 +40,5 @@ public: |
| 39 | mutex::~mutex() noexcept { __libcpp_mutex_destroy(&__m_); } | 40 | mutex::~mutex() noexcept { __libcpp_mutex_destroy(&__m_); } |
| 40 | #endif // !NEEDS_MUTEX_DESTRUCTOR | 41 | #endif // !NEEDS_MUTEX_DESTRUCTOR |
| 41 | 42 | ||
| 43 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 42 | _LIBCPP_END_NAMESPACE_STD | 44 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/new.cpp+16-16| ... | @@ -50,7 +50,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size) _THROW_BAD_ALLOC { | ... | @@ -50,7 +50,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size) _THROW_BAD_ALLOC { |
| 50 | return p; | 50 | return p; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept { | 53 | [[gnu::weak]] void* operator new(size_t size, const std::nothrow_t&) noexcept { |
| 54 | # if !_LIBCPP_HAS_EXCEPTIONS | 54 | # if !_LIBCPP_HAS_EXCEPTIONS |
| 55 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION | 55 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION |
| 56 | _LIBCPP_ASSERT_SHIM( | 56 | _LIBCPP_ASSERT_SHIM( |
| ... | @@ -76,7 +76,7 @@ _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept { | ... | @@ -76,7 +76,7 @@ _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept { |
| 76 | 76 | ||
| 77 | OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); } | 77 | OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); } |
| 78 | 78 | ||
| 79 | _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept { | 79 | [[gnu::weak]] void* operator new[](size_t size, const std::nothrow_t&) noexcept { |
| 80 | # if !_LIBCPP_HAS_EXCEPTIONS | 80 | # if !_LIBCPP_HAS_EXCEPTIONS |
| 81 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION | 81 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION |
| 82 | _LIBCPP_ASSERT_SHIM( | 82 | _LIBCPP_ASSERT_SHIM( |
| ... | @@ -100,17 +100,17 @@ _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept { | ... | @@ -100,17 +100,17 @@ _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept { |
| 100 | # endif | 100 | # endif |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | _LIBCPP_WEAK void operator delete(void* ptr) noexcept { std::free(ptr); } | 103 | [[gnu::weak]] void operator delete(void* ptr) noexcept { std::free(ptr); } |
| 104 | 104 | ||
| 105 | _LIBCPP_WEAK void operator delete(void* ptr, const std::nothrow_t&) noexcept { ::operator delete(ptr); } | 105 | [[gnu::weak]] void operator delete(void* ptr, const std::nothrow_t&) noexcept { ::operator delete(ptr); } |
| 106 | 106 | ||
| 107 | _LIBCPP_WEAK void operator delete(void* ptr, size_t) noexcept { ::operator delete(ptr); } | 107 | [[gnu::weak]] void operator delete(void* ptr, size_t) noexcept { ::operator delete(ptr); } |
| 108 | 108 | ||
| 109 | _LIBCPP_WEAK void operator delete[](void* ptr) noexcept { ::operator delete(ptr); } | 109 | [[gnu::weak]] void operator delete[](void* ptr) noexcept { ::operator delete(ptr); } |
| 110 | 110 | ||
| 111 | _LIBCPP_WEAK void operator delete[](void* ptr, const std::nothrow_t&) noexcept { ::operator delete[](ptr); } | 111 | [[gnu::weak]] void operator delete[](void* ptr, const std::nothrow_t&) noexcept { ::operator delete[](ptr); } |
| 112 | 112 | ||
| 113 | _LIBCPP_WEAK void operator delete[](void* ptr, size_t) noexcept { ::operator delete[](ptr); } | 113 | [[gnu::weak]] void operator delete[](void* ptr, size_t) noexcept { ::operator delete[](ptr); } |
| 114 | 114 | ||
| 115 | # if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION | 115 | # if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION |
| 116 | 116 | ||
| ... | @@ -141,7 +141,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size, std::align_val_t align | ... | @@ -141,7 +141,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size, std::align_val_t align |
| 141 | return p; | 141 | return p; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | _LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept { | 144 | [[gnu::weak]] void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept { |
| 145 | # if !_LIBCPP_HAS_EXCEPTIONS | 145 | # if !_LIBCPP_HAS_EXCEPTIONS |
| 146 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION | 146 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION |
| 147 | _LIBCPP_ASSERT_SHIM( | 147 | _LIBCPP_ASSERT_SHIM( |
| ... | @@ -169,7 +169,7 @@ OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignmen | ... | @@ -169,7 +169,7 @@ OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignmen |
| 169 | return ::operator new(size, alignment); | 169 | return ::operator new(size, alignment); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | _LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept { | 172 | [[gnu::weak]] void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept { |
| 173 | # if !_LIBCPP_HAS_EXCEPTIONS | 173 | # if !_LIBCPP_HAS_EXCEPTIONS |
| 174 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION | 174 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION |
| 175 | _LIBCPP_ASSERT_SHIM( | 175 | _LIBCPP_ASSERT_SHIM( |
| ... | @@ -193,25 +193,25 @@ _LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const | ... | @@ -193,25 +193,25 @@ _LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const |
| 193 | # endif | 193 | # endif |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | _LIBCPP_WEAK void operator delete(void* ptr, std::align_val_t) noexcept { std::__libcpp_aligned_free(ptr); } | 196 | [[gnu::weak]] void operator delete(void* ptr, std::align_val_t) noexcept { std::__libcpp_aligned_free(ptr); } |
| 197 | 197 | ||
| 198 | _LIBCPP_WEAK void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept { | 198 | [[gnu::weak]] void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept { |
| 199 | ::operator delete(ptr, alignment); | 199 | ::operator delete(ptr, alignment); |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | _LIBCPP_WEAK void operator delete(void* ptr, size_t, std::align_val_t alignment) noexcept { | 202 | [[gnu::weak]] void operator delete(void* ptr, size_t, std::align_val_t alignment) noexcept { |
| 203 | ::operator delete(ptr, alignment); | 203 | ::operator delete(ptr, alignment); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | _LIBCPP_WEAK void operator delete[](void* ptr, std::align_val_t alignment) noexcept { | 206 | [[gnu::weak]] void operator delete[](void* ptr, std::align_val_t alignment) noexcept { |
| 207 | ::operator delete(ptr, alignment); | 207 | ::operator delete(ptr, alignment); |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | _LIBCPP_WEAK void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept { | 210 | [[gnu::weak]] void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept { |
| 211 | ::operator delete[](ptr, alignment); | 211 | ::operator delete[](ptr, alignment); |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | _LIBCPP_WEAK void operator delete[](void* ptr, size_t, std::align_val_t alignment) noexcept { | 214 | [[gnu::weak]] void operator delete[](void* ptr, size_t, std::align_val_t alignment) noexcept { |
| 215 | ::operator delete[](ptr, alignment); | 215 | ::operator delete[](ptr, alignment); |
| 216 | } | 216 | } |
| 217 | 217 |
lib/libcxx/src/optional.cpp+2| ... | @@ -24,6 +24,7 @@ const char* bad_optional_access::what() const noexcept { return "bad_optional_ac | ... | @@ -24,6 +24,7 @@ const char* bad_optional_access::what() const noexcept { return "bad_optional_ac |
| 24 | // Preserve std::experimental::bad_optional_access for ABI compatibility | 24 | // Preserve std::experimental::bad_optional_access for ABI compatibility |
| 25 | // Even though it no longer exists in a header file | 25 | // Even though it no longer exists in a header file |
| 26 | _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL | 26 | _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL |
| 27 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 27 | 28 | ||
| 28 | class _LIBCPP_EXPORTED_FROM_ABI bad_optional_access : public std::logic_error { | 29 | class _LIBCPP_EXPORTED_FROM_ABI bad_optional_access : public std::logic_error { |
| 29 | public: | 30 | public: |
| ... | @@ -35,6 +36,7 @@ public: | ... | @@ -35,6 +36,7 @@ public: |
| 35 | 36 | ||
| 36 | bad_optional_access::~bad_optional_access() noexcept = default; | 37 | bad_optional_access::~bad_optional_access() noexcept = default; |
| 37 | 38 | ||
| 39 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 38 | _LIBCPP_END_NAMESPACE_EXPERIMENTAL | 40 | _LIBCPP_END_NAMESPACE_EXPERIMENTAL |
| 39 | 41 | ||
| 40 | #endif // _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 7 | 42 | #endif // _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 7 |
lib/libcxx/src/ostream.cpp+2| ... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
| 15 | #include "std_stream.h" | 15 | #include "std_stream.h" |
| 16 | 16 | ||
| 17 | _LIBCPP_BEGIN_NAMESPACE_STD | 17 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 18 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 18 | 19 | ||
| 19 | _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) { | 20 | _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) { |
| 20 | // dynamic_cast requires RTTI, this only affects users whose vendor builds | 21 | // dynamic_cast requires RTTI, this only affects users whose vendor builds |
| ... | @@ -38,4 +39,5 @@ _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) { | ... | @@ -38,4 +39,5 @@ _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) { |
| 38 | return nullptr; | 39 | return nullptr; |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 42 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 41 | _LIBCPP_END_NAMESPACE_STD | 43 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/print.cpp+6-1| ... | @@ -33,6 +33,7 @@ | ... | @@ -33,6 +33,7 @@ |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | _LIBCPP_BEGIN_NAMESPACE_STD | 35 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 36 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 36 | 37 | ||
| 37 | #if defined(_LIBCPP_WIN32API) | 38 | #if defined(_LIBCPP_WIN32API) |
| 38 | 39 | ||
| ... | @@ -64,9 +65,13 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst | ... | @@ -64,9 +65,13 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst |
| 64 | } | 65 | } |
| 65 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS | 66 | # endif // _LIBCPP_HAS_WIDE_CHARACTERS |
| 66 | 67 | ||
| 67 | #elif defined(HAS_FILENO_AND_ISATTY) // !_LIBCPP_WIN32API | 68 | #elif defined(HAS_FILENO_AND_ISATTY) && _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 23 // !_LIBCPP_WIN32API |
| 68 | 69 | ||
| 70 | _LIBCPP_DIAGNOSTIC_PUSH | ||
| 71 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes") | ||
| 69 | _LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream) { return isatty(fileno(__stream)); } | 72 | _LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream) { return isatty(fileno(__stream)); } |
| 73 | _LIBCPP_DIAGNOSTIC_POP | ||
| 70 | #endif | 74 | #endif |
| 71 | 75 | ||
| 76 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 72 | _LIBCPP_END_NAMESPACE_STD | 77 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/pstl/libdispatch.cpp+2| ... | @@ -12,6 +12,7 @@ | ... | @@ -12,6 +12,7 @@ |
| 12 | #include <dispatch/dispatch.h> | 12 | #include <dispatch/dispatch.h> |
| 13 | 13 | ||
| 14 | _LIBCPP_BEGIN_NAMESPACE_STD | 14 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 15 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 15 | namespace __pstl::__libdispatch { | 16 | namespace __pstl::__libdispatch { |
| 16 | 17 | ||
| 17 | void __dispatch_apply(size_t chunk_count, void* context, void (*func)(void* context, size_t chunk)) noexcept { | 18 | void __dispatch_apply(size_t chunk_count, void* context, void (*func)(void* context, size_t chunk)) noexcept { |
| ... | @@ -29,4 +30,5 @@ __chunk_partitions __partition_chunks(ptrdiff_t element_count) noexcept { | ... | @@ -29,4 +30,5 @@ __chunk_partitions __partition_chunks(ptrdiff_t element_count) noexcept { |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | } // namespace __pstl::__libdispatch | 32 | } // namespace __pstl::__libdispatch |
| 33 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 32 | _LIBCPP_END_NAMESPACE_STD | 34 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/random.cpp+2| ... | @@ -36,6 +36,7 @@ | ... | @@ -36,6 +36,7 @@ |
| 36 | #endif | 36 | #endif |
| 37 | 37 | ||
| 38 | _LIBCPP_BEGIN_NAMESPACE_STD | 38 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 39 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 39 | 40 | ||
| 40 | #if defined(_LIBCPP_USING_GETENTROPY) | 41 | #if defined(_LIBCPP_USING_GETENTROPY) |
| 41 | 42 | ||
| ... | @@ -153,4 +154,5 @@ double random_device::entropy() const noexcept { | ... | @@ -153,4 +154,5 @@ double random_device::entropy() const noexcept { |
| 153 | #endif | 154 | #endif |
| 154 | } | 155 | } |
| 155 | 156 | ||
| 157 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 156 | _LIBCPP_END_NAMESPACE_STD | 158 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/random_shuffle.cpp+2| ... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 20 | 21 | ||
| 21 | #if _LIBCPP_HAS_THREADS | 22 | #if _LIBCPP_HAS_THREADS |
| 22 | static constinit __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER; | 23 | static constinit __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER; |
| ... | @@ -48,4 +49,5 @@ __rs_default::result_type __rs_default::operator()() { | ... | @@ -48,4 +49,5 @@ __rs_default::result_type __rs_default::operator()() { |
| 48 | 49 | ||
| 49 | __rs_default __rs_get() { return __rs_default(); } | 50 | __rs_default __rs_get() { return __rs_default(); } |
| 50 | 51 | ||
| 52 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 51 | _LIBCPP_END_NAMESPACE_STD | 53 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/regex.cpp+2| ... | @@ -11,6 +11,7 @@ | ... | @@ -11,6 +11,7 @@ |
| 11 | #include <regex> | 11 | #include <regex> |
| 12 | 12 | ||
| 13 | _LIBCPP_BEGIN_NAMESPACE_STD | 13 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 14 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 14 | 15 | ||
| 15 | static const char* make_error_type_string(regex_constants::error_type ecode) { | 16 | static const char* make_error_type_string(regex_constants::error_type ecode) { |
| 16 | switch (ecode) { | 17 | switch (ecode) { |
| ... | @@ -396,4 +397,5 @@ void __match_any_but_newline<wchar_t>::__exec(__state& __s) const { | ... | @@ -396,4 +397,5 @@ void __match_any_but_newline<wchar_t>::__exec(__state& __s) const { |
| 396 | } | 397 | } |
| 397 | } | 398 | } |
| 398 | 399 | ||
| 400 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 399 | _LIBCPP_END_NAMESPACE_STD | 401 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/ryu/d2s.cpp+2-13| ... | @@ -41,6 +41,7 @@ | ... | @@ -41,6 +41,7 @@ |
| 41 | 41 | ||
| 42 | #include <__assert> | 42 | #include <__assert> |
| 43 | #include <__config> | 43 | #include <__config> |
| 44 | #include <bit> | ||
| 44 | #include <charconv> | 45 | #include <charconv> |
| 45 | #include <cstddef> | 46 | #include <cstddef> |
| 46 | 47 | ||
| ... | @@ -478,19 +479,7 @@ struct __floating_decimal_64 { | ... | @@ -478,19 +479,7 @@ struct __floating_decimal_64 { |
| 478 | 2882303761517u, 576460752303u, 115292150460u, 23058430092u, 4611686018u, 922337203u, 184467440u, | 479 | 2882303761517u, 576460752303u, 115292150460u, 23058430092u, 4611686018u, 922337203u, 184467440u, |
| 479 | 36893488u, 7378697u, 1475739u, 295147u, 59029u, 11805u, 2361u, 472u, 94u, 18u, 3u }; | 480 | 36893488u, 7378697u, 1475739u, 295147u, 59029u, 11805u, 2361u, 472u, 94u, 18u, 3u }; |
| 480 | 481 | ||
| 481 | unsigned long _Trailing_zero_bits; | 482 | unsigned long _Trailing_zero_bits = std::countr_zero(__v.__mantissa); |
| 482 | #if _LIBCPP_HAS_BITSCAN64 | ||
| 483 | (void) _BitScanForward64(&_Trailing_zero_bits, __v.__mantissa); // __v.__mantissa is guaranteed nonzero | ||
| 484 | #else // ^^^ 64-bit ^^^ / vvv 32-bit vvv | ||
| 485 | const uint32_t _Low_mantissa = static_cast<uint32_t>(__v.__mantissa); | ||
| 486 | if (_Low_mantissa != 0) { | ||
| 487 | (void) _BitScanForward(&_Trailing_zero_bits, _Low_mantissa); | ||
| 488 | } else { | ||
| 489 | const uint32_t _High_mantissa = static_cast<uint32_t>(__v.__mantissa >> 32); // nonzero here | ||
| 490 | (void) _BitScanForward(&_Trailing_zero_bits, _High_mantissa); | ||
| 491 | _Trailing_zero_bits += 32; | ||
| 492 | } | ||
| 493 | #endif // ^^^ 32-bit ^^^ | ||
| 494 | const uint64_t _Shifted_mantissa = __v.__mantissa >> _Trailing_zero_bits; | 483 | const uint64_t _Shifted_mantissa = __v.__mantissa >> _Trailing_zero_bits; |
| 495 | _Can_use_ryu = _Shifted_mantissa <= _Max_shifted_mantissa[_Ryu_exponent]; | 484 | _Can_use_ryu = _Shifted_mantissa <= _Max_shifted_mantissa[_Ryu_exponent]; |
| 496 | } | 485 | } |
lib/libcxx/src/ryu/f2s.cpp+2-2| ... | @@ -41,6 +41,7 @@ | ... | @@ -41,6 +41,7 @@ |
| 41 | 41 | ||
| 42 | #include <__assert> | 42 | #include <__assert> |
| 43 | #include <__config> | 43 | #include <__config> |
| 44 | #include <bit> | ||
| 44 | #include <charconv> | 45 | #include <charconv> |
| 45 | #include <cstdint> | 46 | #include <cstdint> |
| 46 | #include <cstddef> | 47 | #include <cstddef> |
| ... | @@ -535,8 +536,7 @@ struct __floating_decimal_32 { | ... | @@ -535,8 +536,7 @@ struct __floating_decimal_32 { |
| 535 | static constexpr uint32_t _Max_shifted_mantissa[11] = { | 536 | static constexpr uint32_t _Max_shifted_mantissa[11] = { |
| 536 | 16777215, 3355443, 671088, 134217, 26843, 5368, 1073, 214, 42, 8, 1 }; | 537 | 16777215, 3355443, 671088, 134217, 26843, 5368, 1073, 214, 42, 8, 1 }; |
| 537 | 538 | ||
| 538 | unsigned long _Trailing_zero_bits; | 539 | unsigned long _Trailing_zero_bits = std::countr_zero(__v.__mantissa); // __v.__mantissa is guaranteed nonzero |
| 539 | (void) _BitScanForward(&_Trailing_zero_bits, __v.__mantissa); // __v.__mantissa is guaranteed nonzero | ||
| 540 | const uint32_t _Shifted_mantissa = __v.__mantissa >> _Trailing_zero_bits; | 540 | const uint32_t _Shifted_mantissa = __v.__mantissa >> _Trailing_zero_bits; |
| 541 | _Can_use_ryu = _Shifted_mantissa <= _Max_shifted_mantissa[_Ryu_exponent]; | 541 | _Can_use_ryu = _Shifted_mantissa <= _Max_shifted_mantissa[_Ryu_exponent]; |
| 542 | } | 542 | } |
lib/libcxx/src/shared_mutex.cpp+2| ... | @@ -13,6 +13,7 @@ | ... | @@ -13,6 +13,7 @@ |
| 13 | #endif | 13 | #endif |
| 14 | 14 | ||
| 15 | _LIBCPP_BEGIN_NAMESPACE_STD | 15 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 16 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 16 | 17 | ||
| 17 | // Shared Mutex Base | 18 | // Shared Mutex Base |
| 18 | __shared_mutex_base::__shared_mutex_base() : __state_(0) {} | 19 | __shared_mutex_base::__shared_mutex_base() : __state_(0) {} |
| ... | @@ -96,4 +97,5 @@ void shared_timed_mutex::lock_shared() { return __base_.lock_shared(); } | ... | @@ -96,4 +97,5 @@ void shared_timed_mutex::lock_shared() { return __base_.lock_shared(); } |
| 96 | bool shared_timed_mutex::try_lock_shared() { return __base_.try_lock_shared(); } | 97 | bool shared_timed_mutex::try_lock_shared() { return __base_.try_lock_shared(); } |
| 97 | void shared_timed_mutex::unlock_shared() { return __base_.unlock_shared(); } | 98 | void shared_timed_mutex::unlock_shared() { return __base_.unlock_shared(); } |
| 98 | 99 | ||
| 100 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 99 | _LIBCPP_END_NAMESPACE_STD | 101 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/std_stream.h+2| ... | @@ -24,6 +24,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -24,6 +24,7 @@ _LIBCPP_PUSH_MACROS |
| 24 | #include <__undef_macros> | 24 | #include <__undef_macros> |
| 25 | 25 | ||
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 27 | 28 | ||
| 28 | static const int __limit = 8; | 29 | static const int __limit = 8; |
| 29 | 30 | ||
| ... | @@ -380,6 +381,7 @@ void __stdoutbuf<_CharT>::imbue(const locale& __loc) { | ... | @@ -380,6 +381,7 @@ void __stdoutbuf<_CharT>::imbue(const locale& __loc) { |
| 380 | __always_noconv_ = __cv_->always_noconv(); | 381 | __always_noconv_ = __cv_->always_noconv(); |
| 381 | } | 382 | } |
| 382 | 383 | ||
| 384 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 383 | _LIBCPP_END_NAMESPACE_STD | 385 | _LIBCPP_END_NAMESPACE_STD |
| 384 | 386 | ||
| 385 | _LIBCPP_POP_MACROS | 387 | _LIBCPP_POP_MACROS |
lib/libcxx/src/stdexcept.cpp+2| ... | @@ -18,6 +18,7 @@ | ... | @@ -18,6 +18,7 @@ |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 21 | 22 | ||
| 22 | void __throw_runtime_error(const char* msg) { | 23 | void __throw_runtime_error(const char* msg) { |
| 23 | #if _LIBCPP_HAS_EXCEPTIONS | 24 | #if _LIBCPP_HAS_EXCEPTIONS |
| ... | @@ -27,4 +28,5 @@ void __throw_runtime_error(const char* msg) { | ... | @@ -27,4 +28,5 @@ void __throw_runtime_error(const char* msg) { |
| 27 | #endif | 28 | #endif |
| 28 | } | 29 | } |
| 29 | 30 | ||
| 31 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 30 | _LIBCPP_END_NAMESPACE_STD | 32 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/string.cpp+2| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 22 | 23 | ||
| 23 | #if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 14 | 24 | #if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 14 |
| 24 | 25 | ||
| ... | @@ -367,4 +368,5 @@ wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string | ... | @@ -367,4 +368,5 @@ wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string |
| 367 | wstring to_wstring(long double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%Lf", val); } | 368 | wstring to_wstring(long double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%Lf", val); } |
| 368 | #endif | 369 | #endif |
| 369 | 370 | ||
| 371 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 370 | _LIBCPP_END_NAMESPACE_STD | 372 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/strstream.cpp+2| ... | @@ -18,6 +18,7 @@ _LIBCPP_PUSH_MACROS | ... | @@ -18,6 +18,7 @@ _LIBCPP_PUSH_MACROS |
| 18 | #include <__undef_macros> | 18 | #include <__undef_macros> |
| 19 | 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 21 | 22 | ||
| 22 | strstreambuf::strstreambuf(streamsize __alsize) | 23 | strstreambuf::strstreambuf(streamsize __alsize) |
| 23 | : __strmode_(__dynamic), __alsize_(__alsize), __palloc_(nullptr), __pfree_(nullptr) {} | 24 | : __strmode_(__dynamic), __alsize_(__alsize), __palloc_(nullptr), __pfree_(nullptr) {} |
| ... | @@ -253,6 +254,7 @@ ostrstream::~ostrstream() {} | ... | @@ -253,6 +254,7 @@ ostrstream::~ostrstream() {} |
| 253 | 254 | ||
| 254 | strstream::~strstream() {} | 255 | strstream::~strstream() {} |
| 255 | 256 | ||
| 257 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 256 | _LIBCPP_END_NAMESPACE_STD | 258 | _LIBCPP_END_NAMESPACE_STD |
| 257 | 259 | ||
| 258 | _LIBCPP_POP_MACROS | 260 | _LIBCPP_POP_MACROS |
lib/libcxx/src/support/runtime/exception_pointer_msvc.ipp+425-34| ... | @@ -7,62 +7,453 @@ | ... | @@ -7,62 +7,453 @@ |
| 7 | // | 7 | // |
| 8 | //===----------------------------------------------------------------------===// | 8 | //===----------------------------------------------------------------------===// |
| 9 | 9 | ||
| 10 | #include <exception> | 10 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmultichar") |
| 11 | #include <stdio.h> | ||
| 12 | #include <stdlib.h> | ||
| 13 | |||
| 14 | _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCreate(void*); | ||
| 15 | _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrDestroy(void*); | ||
| 16 | _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCopy(void*, const void*); | ||
| 17 | _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrAssign(void*, const void*); | ||
| 18 | _LIBCPP_CRT_FUNC bool __cdecl __ExceptionPtrCompare(const void*, const void*); | ||
| 19 | _LIBCPP_CRT_FUNC bool __cdecl __ExceptionPtrToBool(const void*); | ||
| 20 | _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrSwap(void*, void*); | ||
| 21 | _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCurrentException(void*); | ||
| 22 | [[noreturn]] _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrRethrow(const void*); | ||
| 23 | _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCopyException(void*, const void*, const void*); | ||
| 24 | 11 | ||
| 25 | namespace std { | 12 | #include <__exception/exception_ptr.h> |
| 13 | #include <__memory/shared_count.h> | ||
| 14 | #include <cstdlib> | ||
| 15 | #include <cstring> | ||
| 26 | 16 | ||
| 27 | exception_ptr::exception_ptr() noexcept { __ExceptionPtrCreate(this); } | 17 | #include <unknwn.h> |
| 28 | exception_ptr::exception_ptr(nullptr_t) noexcept { __ExceptionPtrCreate(this); } | 18 | #include <windows.h> |
| 19 | struct _ThrowInfo; | ||
| 20 | #include <eh.h> | ||
| 21 | #include <ehdata.h> | ||
| 22 | #include <malloc.h> // alloca | ||
| 29 | 23 | ||
| 30 | exception_ptr::exception_ptr(const exception_ptr& __other) noexcept { __ExceptionPtrCopy(this, &__other); } | 24 | // Pre-V4 managed exception code |
| 31 | exception_ptr& exception_ptr::operator=(const exception_ptr& __other) noexcept { | 25 | #define MANAGED_EXCEPTION_CODE 0XE0434F4D |
| 32 | __ExceptionPtrAssign(this, &__other); | 26 | |
| 33 | return *this; | 27 | // V4 and later managed exception code |
| 28 | #define MANAGED_EXCEPTION_CODE_V4 0XE0434352 | ||
| 29 | |||
| 30 | extern "C" _LIBCPP_CRT_FUNC void* __cdecl __AdjustPointer(void*, const PMD&); | ||
| 31 | extern "C" _LIBCPP_CRT_FUNC void** __cdecl __current_exception(); | ||
| 32 | |||
| 33 | namespace { | ||
| 34 | |||
| 35 | typedef void(__stdcall* __prepare_for_throw_t)(void*); | ||
| 36 | |||
| 37 | struct __winrt_exception_info { | ||
| 38 | void* __description; | ||
| 39 | void* __restricted_error_string; | ||
| 40 | void* __restricted_error_reference; | ||
| 41 | void* __capability_sid; | ||
| 42 | long __hr; | ||
| 43 | void* __restricted_info; | ||
| 44 | ThrowInfo* __throw_info; | ||
| 45 | unsigned int __size; | ||
| 46 | __prepare_for_throw_t __prepare_throw; | ||
| 47 | }; | ||
| 48 | |||
| 49 | inline EHExceptionRecord* __get_current_exception() noexcept { | ||
| 50 | return *reinterpret_cast<EHExceptionRecord**>(__current_exception()); | ||
| 34 | } | 51 | } |
| 35 | 52 | ||
| 36 | exception_ptr& exception_ptr::operator=(nullptr_t) noexcept { | 53 | inline void __call_member_function_0(void* __this, void* __mfn) { |
| 37 | exception_ptr dummy; | 54 | auto __fn = reinterpret_cast<void(__thiscall*)(void*)>(__mfn); |
| 38 | __ExceptionPtrAssign(this, &dummy); | 55 | __fn(__this); |
| 39 | return *this; | 56 | } |
| 57 | |||
| 58 | inline void __call_member_function_1(void* __this, void* __mfn, void* __arg) { | ||
| 59 | auto __fn = reinterpret_cast<void(__thiscall*)(void*, void*)>(__mfn); | ||
| 60 | __fn(__this, __arg); | ||
| 61 | } | ||
| 62 | |||
| 63 | inline void __call_member_function_2(void* __this, void* __mfn, void* __arg1, int __arg2) { | ||
| 64 | auto __fn = reinterpret_cast<void(__thiscall*)(void*, void*, int)>(__mfn); | ||
| 65 | __fn(__this, __arg1, __arg2); | ||
| 40 | } | 66 | } |
| 41 | 67 | ||
| 42 | exception_ptr::~exception_ptr() noexcept { __ExceptionPtrDestroy(this); } | 68 | void __populate_cpp_exception_record( |
| 69 | _EXCEPTION_RECORD& __record, const void* const __except_obj, ThrowInfo* __throw_info) noexcept { | ||
| 70 | __record.ExceptionCode = EH_EXCEPTION_NUMBER; | ||
| 71 | __record.ExceptionFlags = EXCEPTION_NONCONTINUABLE; | ||
| 72 | __record.ExceptionRecord = nullptr; // No SEH to chain. | ||
| 73 | __record.ExceptionAddress = nullptr; // Address of exception. This will be overwritten by OS. | ||
| 74 | __record.NumberParameters = EH_EXCEPTION_PARAMETERS; | ||
| 75 | __record.ExceptionInformation[0] = EH_MAGIC_NUMBER1; | ||
| 76 | __record.ExceptionInformation[1] = reinterpret_cast<ULONG_PTR>(__except_obj); | ||
| 77 | |||
| 78 | if (__throw_info && (__throw_info->attributes & TI_IsWinRT)) { | ||
| 79 | // The pointer to the ExceptionInfo structure is stored sizeof(void*) in front of each WinRT Exception Info. | ||
| 80 | const auto __wei = (*static_cast<__winrt_exception_info** const*>(const_cast<void*>(__except_obj)))[-1]; | ||
| 81 | __throw_info = __wei->__throw_info; | ||
| 82 | } | ||
| 83 | |||
| 84 | __record.ExceptionInformation[2] = reinterpret_cast<ULONG_PTR>(__throw_info); | ||
| 85 | |||
| 86 | #if _EH_RELATIVE_TYPEINFO | ||
| 87 | void* __throw_image_base = | ||
| 88 | __throw_info ? RtlPcToFileHeader(const_cast<void*>(static_cast<const void*>(__throw_info)), &__throw_image_base) | ||
| 89 | : nullptr; | ||
| 90 | __record.ExceptionInformation[3] = reinterpret_cast<ULONG_PTR>(__throw_image_base); | ||
| 91 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 92 | |||
| 93 | // If the throw info indicates this throw is from a pure region, set the magic number to the Pure one, so only a | ||
| 94 | // pure-region catch will see it. | ||
| 95 | // | ||
| 96 | // Also use the Pure magic number on 64-bit platforms if we were unable to determine an image base, since that was the | ||
| 97 | // old way to determine a pure throw, before the TI_IsPure bit was added to the FuncInfo attributes field. | ||
| 98 | if (__throw_info && ((__throw_info->attributes & TI_IsPure) | ||
| 99 | #if _EH_RELATIVE_TYPEINFO | ||
| 100 | || !__throw_image_base | ||
| 101 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 102 | )) | ||
| 103 | __record.ExceptionInformation[0] = EH_PURE_MAGIC_NUMBER1; | ||
| 104 | } | ||
| 105 | |||
| 106 | void __copy_exception_record(_EXCEPTION_RECORD& __dest, const _EXCEPTION_RECORD& __src) noexcept { | ||
| 107 | __dest.ExceptionCode = __src.ExceptionCode; | ||
| 108 | // We force EXCEPTION_NONCONTINUABLE because rethrow_exception is [[noreturn]]. | ||
| 109 | __dest.ExceptionFlags = __src.ExceptionFlags | EXCEPTION_NONCONTINUABLE; | ||
| 110 | __dest.ExceptionRecord = nullptr; // We don't chain SEH exceptions. | ||
| 111 | __dest.ExceptionAddress = nullptr; // Useless field to copy. It will be overwritten by RaiseException(). | ||
| 112 | const auto __parameters = __src.NumberParameters; | ||
| 113 | __dest.NumberParameters = __parameters; | ||
| 114 | |||
| 115 | // Copy the number of parameters in use. | ||
| 116 | constexpr auto __max_parameters = static_cast<DWORD>(EXCEPTION_MAXIMUM_PARAMETERS); | ||
| 117 | const auto __in_use = (__parameters < __max_parameters) ? __parameters : __max_parameters; | ||
| 118 | std::memcpy(__dest.ExceptionInformation, __src.ExceptionInformation, __in_use * sizeof(ULONG_PTR)); | ||
| 119 | std::memset(&__dest.ExceptionInformation[__in_use], 0, (__max_parameters - __in_use) * sizeof(ULONG_PTR)); | ||
| 120 | } | ||
| 121 | |||
| 122 | void __copy_exception_object(void* __dest, const void* __src, const CatchableType* const __type | ||
| 123 | #if _EH_RELATIVE_TYPEINFO | ||
| 124 | , | ||
| 125 | uintptr_t __throw_image_base | ||
| 126 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 127 | ) { | ||
| 128 | // Copy an object of type denoted by *_PType from __src to __dDest; throws whatever the copy ctor of the type denoted | ||
| 129 | // by *_PType throws. | ||
| 130 | if ((__type->properties & CT_IsSimpleType) || __type->copyFunction == 0) { | ||
| 131 | std::memcpy(__dest, __src, __type->sizeOrOffset); | ||
| 132 | |||
| 133 | if (__type->properties & CT_IsWinRTHandle) { | ||
| 134 | const auto __unknown = *static_cast<IUnknown* const*>(const_cast<void*>(__src)); | ||
| 135 | if (__unknown) | ||
| 136 | __unknown->AddRef(); | ||
| 137 | } | ||
| 138 | return; | ||
| 139 | } | ||
| 140 | |||
| 141 | #if _EH_RELATIVE_TYPEINFO | ||
| 142 | const auto __copy_func = reinterpret_cast<void*>(__throw_image_base + __type->copyFunction); | ||
| 143 | #else // _EH_RELATIVE_TYPEINFO | ||
| 144 | const auto __copy_func = reinterpret_cast<void*>(__type->copyFunction); | ||
| 145 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 146 | |||
| 147 | const auto __adjusted = __AdjustPointer(const_cast<void*>(__src), __type->thisDisplacement); | ||
| 148 | if (__type->properties & CT_HasVirtualBase) | ||
| 149 | __call_member_function_2(__dest, __copy_func, __adjusted, 1); | ||
| 150 | else | ||
| 151 | __call_member_function_1(__dest, __copy_func, __adjusted); | ||
| 152 | } | ||
| 153 | |||
| 154 | struct __exception_ptr_storage : public std::__shared_count { | ||
| 155 | _EXCEPTION_RECORD __record_; | ||
| 156 | explicit __exception_ptr_storage(long __refs = 0) noexcept : std::__shared_count(__refs) {} | ||
| 157 | }; | ||
| 158 | |||
| 159 | template <class _StaticEx> | ||
| 160 | struct __exception_ptr_static final : public __exception_ptr_storage { | ||
| 161 | _StaticEx __ex_; | ||
| 162 | |||
| 163 | __exception_ptr_static() noexcept : __exception_ptr_storage(0) { | ||
| 164 | __populate_cpp_exception_record(__record_, &__ex_, static_cast<ThrowInfo*>(__GetExceptionInfo(__ex_))); | ||
| 165 | } | ||
| 166 | |||
| 167 | void __on_zero_shared() noexcept override {} | ||
| 168 | |||
| 169 | static __exception_ptr_storage* __get() noexcept { | ||
| 170 | struct __container { | ||
| 171 | union { | ||
| 172 | __exception_ptr_static __instance_; | ||
| 173 | }; | ||
| 174 | __container() noexcept : __instance_() {} | ||
| 175 | ~__container() {} | ||
| 176 | }; | ||
| 177 | static __container __storage; | ||
| 178 | return &__storage.__instance_; | ||
| 179 | } | ||
| 180 | }; | ||
| 181 | |||
| 182 | struct alignas(__STDCPP_DEFAULT_NEW_ALIGNMENT__) __exception_ptr_normal final : public __exception_ptr_storage { | ||
| 183 | explicit __exception_ptr_normal(const _EXCEPTION_RECORD& __record) noexcept : __exception_ptr_storage(0) { | ||
| 184 | __copy_exception_record(__record_, __record); | ||
| 185 | } | ||
| 186 | |||
| 187 | void __on_zero_shared() noexcept override { | ||
| 188 | const auto& __cpp_eh_record = reinterpret_cast<EHExceptionRecord&>(__record_); | ||
| 189 | if (PER_IS_MSVC_PURE_OR_NATIVE_EH(&__cpp_eh_record)) { | ||
| 190 | const auto* __throw_info = __cpp_eh_record.params.pThrowInfo; | ||
| 191 | if (__throw_info && __cpp_eh_record.params.pExceptionObject) { | ||
| 192 | #if _EH_RELATIVE_TYPEINFO | ||
| 193 | const auto __throw_image_base = reinterpret_cast<uintptr_t>(__cpp_eh_record.params.pThrowImageBase); | ||
| 194 | const auto* __catchable_type_array = reinterpret_cast<const CatchableTypeArray*>( | ||
| 195 | static_cast<uintptr_t>(__throw_info->pCatchableTypeArray) + __throw_image_base); | ||
| 196 | const auto* __type = reinterpret_cast<CatchableType*>( | ||
| 197 | static_cast<uintptr_t>(__catchable_type_array->arrayOfCatchableTypes[0]) + __throw_image_base); | ||
| 198 | #else // _EH_RELATIVE_TYPEINFO | ||
| 199 | const auto* __type = __throw_info->pCatchableTypeArray->arrayOfCatchableTypes[0]; | ||
| 200 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 201 | if (__throw_info->pmfnUnwind) { | ||
| 202 | // The exception was a user defined type with a nontrivial destructor, call it. | ||
| 203 | #if _EH_RELATIVE_TYPEINFO | ||
| 204 | __call_member_function_0(__cpp_eh_record.params.pExceptionObject, | ||
| 205 | reinterpret_cast<void*>(__throw_info->pmfnUnwind + __throw_image_base)); | ||
| 206 | #else // _EH_RELATIVE_TYPEINFO | ||
| 207 | __call_member_function_0(__cpp_eh_record.params.pExceptionObject, | ||
| 208 | reinterpret_cast<void*>(__throw_info->pmfnUnwind)); | ||
| 209 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 210 | } else if (__type->properties & CT_IsWinRTHandle) { | ||
| 211 | const auto* __unknown = *static_cast<IUnknown* const*>(__cpp_eh_record.params.pExceptionObject); | ||
| 212 | if (__unknown) | ||
| 213 | const_cast<IUnknown*>(__unknown)->Release(); | ||
| 214 | } | ||
| 215 | } | ||
| 216 | } | ||
| 217 | std::free(this); | ||
| 218 | } | ||
| 219 | }; | ||
| 220 | |||
| 221 | static_assert(sizeof(__exception_ptr_normal) % __STDCPP_DEFAULT_NEW_ALIGNMENT__ == 0, | ||
| 222 | "Exception in exception_ptr would be constructed with the wrong alignment"); | ||
| 43 | 223 | ||
| 44 | exception_ptr::operator bool() const noexcept { return __ExceptionPtrToBool(this); } | 224 | void __assign_seh_exception_ptr_from_record( |
| 225 | void*& __dest, const _EXCEPTION_RECORD& __record, void* const __rx_raw) noexcept { | ||
| 226 | if (!__rx_raw) { | ||
| 227 | __dest = __exception_ptr_static<std::bad_alloc>::__get(); | ||
| 228 | return; | ||
| 229 | } | ||
| 45 | 230 | ||
| 46 | bool operator==(const exception_ptr& __x, const exception_ptr& __y) noexcept { | 231 | __dest = ::new (__rx_raw) __exception_ptr_normal(__record); |
| 47 | return __ExceptionPtrCompare(&__x, &__y); | ||
| 48 | } | 232 | } |
| 49 | 233 | ||
| 50 | void swap(exception_ptr& lhs, exception_ptr& rhs) noexcept { __ExceptionPtrSwap(&rhs, &lhs); } | 234 | void __assign_cpp_exception_ptr_from_record(void*& __dest, const EHExceptionRecord& __record) noexcept { |
| 235 | // Construct a reference count control block for the C++ exception recorded by __record, and bind it to __dest. | ||
| 236 | // | ||
| 237 | // * If allocating memory for the reference count control block fails, sets __dest to bad_alloc. | ||
| 238 | // * If copying the exception object referred to __record throws, constructs a reference count control block for that | ||
| 239 | // exception instead. | ||
| 240 | // * If copying the exception object thrown by copying the original exception object throws, sets __dest to | ||
| 241 | // bad_exception. | ||
| 242 | const auto* __throw_info = __record.params.pThrowInfo; | ||
| 243 | #if _EH_RELATIVE_TYPEINFO | ||
| 244 | const auto __throw_image_base = reinterpret_cast<uintptr_t>(__record.params.pThrowImageBase); | ||
| 245 | const auto* __catchable_type_array = reinterpret_cast<const CatchableTypeArray*>( | ||
| 246 | static_cast<uintptr_t>(__throw_info->pCatchableTypeArray) + __throw_image_base); | ||
| 247 | const auto* __type = reinterpret_cast<CatchableType*>( | ||
| 248 | static_cast<uintptr_t>(__catchable_type_array->arrayOfCatchableTypes[0]) + __throw_image_base); | ||
| 249 | #else // _EH_RELATIVE_TYPEINFO | ||
| 250 | const auto* __type = __throw_info->pCatchableTypeArray->arrayOfCatchableTypes[0]; | ||
| 251 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 252 | |||
| 253 | const auto __except_obj_size = static_cast<size_t>(__type->sizeOrOffset); | ||
| 254 | const auto __alloc_size = sizeof(__exception_ptr_normal) + __except_obj_size; | ||
| 255 | auto* __rx_raw = std::malloc(__alloc_size); | ||
| 256 | if (!__rx_raw) { | ||
| 257 | __dest = __exception_ptr_static<std::bad_alloc>::__get(); | ||
| 258 | return; | ||
| 259 | } | ||
| 260 | |||
| 261 | try { | ||
| 262 | __copy_exception_object(static_cast<__exception_ptr_normal*>(__rx_raw) + 1, | ||
| 263 | __record.params.pExceptionObject, | ||
| 264 | __type | ||
| 265 | #if _EH_RELATIVE_TYPEINFO | ||
| 266 | , | ||
| 267 | __throw_image_base | ||
| 268 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 269 | ); | ||
| 270 | |||
| 271 | const auto* __rx = ::new (__rx_raw) __exception_ptr_normal(reinterpret_cast<const _EXCEPTION_RECORD&>(__record)); | ||
| 272 | reinterpret_cast<EHExceptionRecord&>(const_cast<__exception_ptr_normal*>(__rx)->__record_).params.pExceptionObject = | ||
| 273 | static_cast<__exception_ptr_normal*>(__rx_raw) + 1; | ||
| 274 | __dest = const_cast<__exception_ptr_normal*>(__rx); | ||
| 275 | } catch (...) { // Copying the exception object threw an exception. | ||
| 276 | // Exception thrown by the original exception's copy ctor. | ||
| 277 | const auto* __inner_record_ptr = __get_current_exception(); | ||
| 278 | if (!__inner_record_ptr) { | ||
| 279 | std::free(__rx_raw); | ||
| 280 | __dest = __exception_ptr_static<std::bad_exception>::__get(); | ||
| 281 | return; | ||
| 282 | } | ||
| 283 | const auto& __inner_record = *__inner_record_ptr; | ||
| 284 | if (__inner_record.ExceptionCode == MANAGED_EXCEPTION_CODE || | ||
| 285 | __inner_record.ExceptionCode == MANAGED_EXCEPTION_CODE_V4) { | ||
| 286 | // We don't support managed exceptions and don't want to say there's no active exception, so give up and say | ||
| 287 | // bad_exception. | ||
| 288 | std::free(__rx_raw); | ||
| 289 | __dest = __exception_ptr_static<std::bad_exception>::__get(); | ||
| 290 | return; | ||
| 291 | } | ||
| 292 | |||
| 293 | if (!PER_IS_MSVC_PURE_OR_NATIVE_EH(&__inner_record)) { // Catching a non-C++ exception depends on /EHa. | ||
| 294 | __assign_seh_exception_ptr_from_record( | ||
| 295 | __dest, reinterpret_cast<const _EXCEPTION_RECORD&>(__inner_record), __rx_raw); | ||
| 296 | return; | ||
| 297 | } | ||
| 298 | |||
| 299 | const auto* __inner_throw = __inner_record.params.pThrowInfo; | ||
| 300 | #if _EH_RELATIVE_TYPEINFO | ||
| 301 | const auto __inner_throw_image_base = reinterpret_cast<uintptr_t>(__inner_record.params.pThrowImageBase); | ||
| 302 | const auto* __inner_catchable_type_array = reinterpret_cast<const CatchableTypeArray*>( | ||
| 303 | static_cast<uintptr_t>(__inner_throw->pCatchableTypeArray) + __inner_throw_image_base); | ||
| 304 | const auto* __inner_type = reinterpret_cast<CatchableType*>( | ||
| 305 | static_cast<uintptr_t>(__inner_catchable_type_array->arrayOfCatchableTypes[0]) + __inner_throw_image_base); | ||
| 306 | #else // _EH_RELATIVE_TYPEINFO | ||
| 307 | const auto* __inner_type = __inner_throw->pCatchableTypeArray->arrayOfCatchableTypes[0]; | ||
| 308 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 309 | |||
| 310 | const auto __inner_except_size = static_cast<size_t>(__inner_type->sizeOrOffset); | ||
| 311 | const auto __inner_alloc_size = sizeof(__exception_ptr_normal) + __inner_except_size; | ||
| 312 | if (__inner_alloc_size > __alloc_size) { | ||
| 313 | std::free(__rx_raw); | ||
| 314 | __rx_raw = std::malloc(__inner_alloc_size); | ||
| 315 | if (!__rx_raw) { | ||
| 316 | __dest = __exception_ptr_static<std::bad_alloc>::__get(); | ||
| 317 | return; | ||
| 318 | } | ||
| 319 | } | ||
| 320 | |||
| 321 | try { | ||
| 322 | __copy_exception_object(static_cast<__exception_ptr_normal*>(__rx_raw) + 1, | ||
| 323 | __inner_record.params.pExceptionObject, | ||
| 324 | __inner_type | ||
| 325 | #if _EH_RELATIVE_TYPEINFO | ||
| 326 | , | ||
| 327 | __inner_throw_image_base | ||
| 328 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 329 | ); | ||
| 330 | } catch (...) { // Copying the exception emitted while copying the original exception also threw, give up. | ||
| 331 | std::free(__rx_raw); | ||
| 332 | __dest = __exception_ptr_static<std::bad_exception>::__get(); | ||
| 333 | return; | ||
| 334 | } | ||
| 335 | |||
| 336 | // This next block must be duplicated inside the catch (even though it looks identical to the block in the try) so | ||
| 337 | // that __inner_record is held alive; exiting the catch will destroy it. | ||
| 338 | const auto* __rx = | ||
| 339 | ::new (__rx_raw) __exception_ptr_normal(reinterpret_cast<const _EXCEPTION_RECORD&>(__inner_record)); | ||
| 340 | reinterpret_cast<EHExceptionRecord&>(const_cast<__exception_ptr_normal*>(__rx)->__record_).params.pExceptionObject = | ||
| 341 | static_cast<__exception_ptr_normal*>(__rx_raw) + 1; | ||
| 342 | __dest = const_cast<__exception_ptr_normal*>(__rx); | ||
| 343 | } | ||
| 344 | } | ||
| 345 | |||
| 346 | } // namespace | ||
| 347 | |||
| 348 | namespace std { | ||
| 349 | |||
| 350 | exception_ptr::~exception_ptr() noexcept { | ||
| 351 | if (__ptr_) | ||
| 352 | static_cast<__shared_count*>(__ptr_)->__release_shared(); | ||
| 353 | } | ||
| 354 | |||
| 355 | exception_ptr::exception_ptr(const exception_ptr& __other) noexcept : __ptr_(__other.__ptr_) { | ||
| 356 | if (__ptr_) | ||
| 357 | static_cast<__shared_count*>(__ptr_)->__add_shared(); | ||
| 358 | } | ||
| 359 | |||
| 360 | exception_ptr& exception_ptr::operator=(const exception_ptr& __other) noexcept { | ||
| 361 | if (__ptr_ != __other.__ptr_) { | ||
| 362 | if (__other.__ptr_) | ||
| 363 | static_cast<__shared_count*>(__other.__ptr_)->__add_shared(); | ||
| 364 | if (__ptr_) | ||
| 365 | static_cast<__shared_count*>(__ptr_)->__release_shared(); | ||
| 366 | __ptr_ = __other.__ptr_; | ||
| 367 | } | ||
| 368 | return *this; | ||
| 369 | } | ||
| 370 | |||
| 371 | exception_ptr exception_ptr::__from_native_exception_pointer(void* __p) noexcept { | ||
| 372 | exception_ptr __ret; | ||
| 373 | __ret.__ptr_ = __p; | ||
| 374 | if (__ret.__ptr_) | ||
| 375 | static_cast<__shared_count*>(__ret.__ptr_)->__add_shared(); | ||
| 376 | return __ret; | ||
| 377 | } | ||
| 51 | 378 | ||
| 52 | exception_ptr __copy_exception_ptr(void* __except, const void* __ptr) { | 379 | exception_ptr __copy_exception_ptr(void* __except, const void* __ptr) { |
| 53 | exception_ptr __ret = nullptr; | 380 | exception_ptr __ret = nullptr; |
| 54 | if (__ptr) | 381 | if (!__ptr) |
| 55 | __ExceptionPtrCopyException(&__ret, __except, __ptr); | 382 | return __ret; |
| 383 | |||
| 384 | _EXCEPTION_RECORD __record; | ||
| 385 | __populate_cpp_exception_record(__record, __except, static_cast<ThrowInfo*>(const_cast<void*>(__ptr))); | ||
| 386 | __assign_cpp_exception_ptr_from_record(__ret.__ptr_, reinterpret_cast<const EHExceptionRecord&>(__record)); | ||
| 56 | return __ret; | 387 | return __ret; |
| 57 | } | 388 | } |
| 58 | 389 | ||
| 59 | exception_ptr current_exception() noexcept { | 390 | exception_ptr current_exception() noexcept { |
| 60 | exception_ptr __ret; | 391 | exception_ptr __ret; |
| 61 | __ExceptionPtrCurrentException(&__ret); | 392 | const auto* __record = __get_current_exception(); |
| 393 | if (!__record || __record->ExceptionCode == MANAGED_EXCEPTION_CODE || | ||
| 394 | __record->ExceptionCode == MANAGED_EXCEPTION_CODE_V4) | ||
| 395 | return __ret; | ||
| 396 | |||
| 397 | if (PER_IS_MSVC_PURE_OR_NATIVE_EH(__record)) | ||
| 398 | __assign_cpp_exception_ptr_from_record(__ret.__ptr_, *__record); | ||
| 399 | else | ||
| 400 | __assign_seh_exception_ptr_from_record( | ||
| 401 | __ret.__ptr_, reinterpret_cast<const _EXCEPTION_RECORD&>(*__record), std::malloc(sizeof(__exception_ptr_normal))); | ||
| 62 | return __ret; | 402 | return __ret; |
| 63 | } | 403 | } |
| 64 | 404 | ||
| 65 | [[noreturn]] void rethrow_exception(exception_ptr p) { __ExceptionPtrRethrow(&p); } | 405 | [[noreturn]] void rethrow_exception(exception_ptr __p) { |
| 406 | if (!__p) | ||
| 407 | throw bad_exception(); | ||
| 408 | |||
| 409 | auto* __rep = static_cast<__exception_ptr_storage*>(__p.__ptr_); | ||
| 410 | auto __record_copy = __rep->__record_; | ||
| 411 | auto& __cpp_record = reinterpret_cast<EHExceptionRecord&>(__record_copy); | ||
| 412 | if (PER_IS_MSVC_PURE_OR_NATIVE_EH(&__cpp_record)) { | ||
| 413 | const auto* __throw_info = __cpp_record.params.pThrowInfo; | ||
| 414 | if (!__cpp_record.params.pExceptionObject || !__throw_info || !__throw_info->pCatchableTypeArray) | ||
| 415 | terminate(); | ||
| 416 | |||
| 417 | #if _EH_RELATIVE_TYPEINFO | ||
| 418 | const auto __throw_image_base = reinterpret_cast<uintptr_t>(__cpp_record.params.pThrowImageBase); | ||
| 419 | const auto* __catchable_type_array = | ||
| 420 | reinterpret_cast<const CatchableTypeArray*>(__throw_image_base + __throw_info->pCatchableTypeArray); | ||
| 421 | #else // _EH_RELATIVE_TYPEINFO | ||
| 422 | const auto* __catchable_type_array = __throw_info->pCatchableTypeArray; | ||
| 423 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 424 | |||
| 425 | if (__catchable_type_array->nCatchableTypes <= 0) | ||
| 426 | terminate(); | ||
| 427 | |||
| 428 | #if _EH_RELATIVE_TYPEINFO | ||
| 429 | const auto* __type = reinterpret_cast<CatchableType*>( | ||
| 430 | static_cast<uintptr_t>(__catchable_type_array->arrayOfCatchableTypes[0]) + __throw_image_base); | ||
| 431 | #else // _EH_RELATIVE_TYPEINFO | ||
| 432 | const auto* __type = __throw_info->pCatchableTypeArray->arrayOfCatchableTypes[0]; | ||
| 433 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 434 | |||
| 435 | #pragma warning(suppress : 6255) | ||
| 436 | void* __exception_buffer = alloca(__type->sizeOrOffset); | ||
| 437 | __copy_exception_object(__exception_buffer, __cpp_record.params.pExceptionObject, __type | ||
| 438 | #if _EH_RELATIVE_TYPEINFO | ||
| 439 | , | ||
| 440 | __throw_image_base | ||
| 441 | #endif // _EH_RELATIVE_TYPEINFO | ||
| 442 | ); | ||
| 443 | |||
| 444 | __cpp_record.params.pExceptionObject = __exception_buffer; | ||
| 445 | } | ||
| 446 | |||
| 447 | // Under MSVC C++ exception handling (/EHsc), C Win32 API functions like RaiseException | ||
| 448 | // are assumed not to throw synchronous C++ exceptions. As a result, stack unwinding | ||
| 449 | // initiated by RaiseException does not execute local destructors in this frame. | ||
| 450 | // We must explicitly reset __p here so that the reference count on the stored | ||
| 451 | // exception record is properly decremented before unwinding begins. | ||
| 452 | __p = nullptr; | ||
| 453 | RaiseException(__record_copy.ExceptionCode, __record_copy.ExceptionFlags, __record_copy.NumberParameters, | ||
| 454 | __record_copy.ExceptionInformation); | ||
| 455 | terminate(); | ||
| 456 | } | ||
| 66 | 457 | ||
| 67 | nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {} | 458 | nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {} |
| 68 | 459 |
lib/libcxx/src/support/win32/locale_win32.cpp+262| ... | @@ -7,6 +7,8 @@ | ... | @@ -7,6 +7,8 @@ |
| 7 | //===----------------------------------------------------------------------===// | 7 | //===----------------------------------------------------------------------===// |
| 8 | 8 | ||
| 9 | #include <__locale_dir/support/windows.h> | 9 | #include <__locale_dir/support/windows.h> |
| 10 | #include <cctype> | ||
| 11 | #include <charconv> | ||
| 10 | #include <clocale> // std::localeconv() & friends | 12 | #include <clocale> // std::localeconv() & friends |
| 11 | #include <cstdarg> // va_start & friends | 13 | #include <cstdarg> // va_start & friends |
| 12 | #include <cstddef> | 14 | #include <cstddef> |
| ... | @@ -14,8 +16,11 @@ | ... | @@ -14,8 +16,11 @@ |
| 14 | #include <cstdlib> // std::strtof & friends | 16 | #include <cstdlib> // std::strtof & friends |
| 15 | #include <ctime> // std::strftime | 17 | #include <ctime> // std::strftime |
| 16 | #include <cwchar> // wide char manipulation | 18 | #include <cwchar> // wide char manipulation |
| 19 | #include <string_view> | ||
| 20 | #include <windows.h> | ||
| 17 | 21 | ||
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 19 | namespace __locale { | 24 | namespace __locale { |
| 20 | 25 | ||
| 21 | // | 26 | // |
| ... | @@ -34,6 +39,262 @@ __lconv_t* __localeconv(__locale_t& loc) { | ... | @@ -34,6 +39,262 @@ __lconv_t* __localeconv(__locale_t& loc) { |
| 34 | return loc.__store_lconv(lc); | 39 | return loc.__store_lconv(lc); |
| 35 | } | 40 | } |
| 36 | 41 | ||
| 42 | namespace { | ||
| 43 | const char* __codepage_name(unsigned int __codepage) { | ||
| 44 | switch (__codepage) { | ||
| 45 | case 0: | ||
| 46 | // If no ANSI code page is available, only Unicode can be used for the locale. | ||
| 47 | // In this case, the value is CP_ACP (0). | ||
| 48 | // Such a locale cannot be set as the system locale. | ||
| 49 | // Applications that do not support Unicode do not work correctly with locales | ||
| 50 | // marked as "Unicode only". | ||
| 51 | return nullptr; | ||
| 52 | case 037: | ||
| 53 | return "IBM037"; | ||
| 54 | case 437: | ||
| 55 | return "IBM437"; | ||
| 56 | case 500: | ||
| 57 | return "IBM500"; | ||
| 58 | case 708: | ||
| 59 | return "ASMO-708"; | ||
| 60 | case 709: | ||
| 61 | return "ASMO_449"; | ||
| 62 | case 775: | ||
| 63 | return "IBM775"; | ||
| 64 | case 850: | ||
| 65 | return "IBM850"; | ||
| 66 | case 852: | ||
| 67 | return "IBM852"; | ||
| 68 | case 855: | ||
| 69 | return "IBM855"; | ||
| 70 | case 857: | ||
| 71 | return "IBM857"; | ||
| 72 | case 858: | ||
| 73 | return "IBM00858"; | ||
| 74 | case 860: | ||
| 75 | return "IBM860"; | ||
| 76 | case 861: | ||
| 77 | return "IBM861"; | ||
| 78 | case 862: | ||
| 79 | return "IBM862"; | ||
| 80 | case 863: | ||
| 81 | return "IBM863"; | ||
| 82 | case 864: | ||
| 83 | return "IBM864"; | ||
| 84 | case 865: | ||
| 85 | return "IBM865"; | ||
| 86 | case 866: | ||
| 87 | return "IBM866"; | ||
| 88 | case 869: | ||
| 89 | return "IBM869"; | ||
| 90 | case 870: | ||
| 91 | return "IBM870"; | ||
| 92 | case 874: | ||
| 93 | return "windows-874"; | ||
| 94 | case 932: | ||
| 95 | return "Shift_JIS"; | ||
| 96 | case 936: | ||
| 97 | return "GB2312"; | ||
| 98 | case 949: | ||
| 99 | return "KS_C_5601-1989"; | ||
| 100 | case 950: | ||
| 101 | return "Big5"; | ||
| 102 | case 1026: | ||
| 103 | return "IBM1026"; | ||
| 104 | case 1047: | ||
| 105 | return "IBM1047"; | ||
| 106 | case 1140: | ||
| 107 | return "IBM01140"; | ||
| 108 | case 1141: | ||
| 109 | return "IBM01141"; | ||
| 110 | case 1142: | ||
| 111 | return "IBM01142"; | ||
| 112 | case 1143: | ||
| 113 | return "IBM01143"; | ||
| 114 | case 1144: | ||
| 115 | return "IBM01144"; | ||
| 116 | case 1145: | ||
| 117 | return "IBM01145"; | ||
| 118 | case 1146: | ||
| 119 | return "IBM01146"; | ||
| 120 | case 1147: | ||
| 121 | return "IBM01147"; | ||
| 122 | case 1148: | ||
| 123 | return "IBM01148"; | ||
| 124 | case 1149: | ||
| 125 | return "IBM01149"; | ||
| 126 | case 1200: | ||
| 127 | return "UTF-16LE"; | ||
| 128 | case 1201: | ||
| 129 | return "UTF-16BE"; | ||
| 130 | case 1250: | ||
| 131 | return "windows-1250"; | ||
| 132 | case 1251: | ||
| 133 | return "windows-1251"; | ||
| 134 | case 1252: | ||
| 135 | return "windows-1252"; | ||
| 136 | case 1253: | ||
| 137 | return "windows-1253"; | ||
| 138 | case 1254: | ||
| 139 | return "windows-1254"; | ||
| 140 | case 1255: | ||
| 141 | return "windows-1255"; | ||
| 142 | case 1256: | ||
| 143 | return "windows-1256"; | ||
| 144 | case 1257: | ||
| 145 | return "windows-1257"; | ||
| 146 | case 1258: | ||
| 147 | return "windows-1258"; | ||
| 148 | case 10000: | ||
| 149 | return "macintosh"; | ||
| 150 | case 12000: | ||
| 151 | return "UTF-32LE"; | ||
| 152 | case 12001: | ||
| 153 | return "UTF-32BE"; | ||
| 154 | case 20127: | ||
| 155 | return "US-ASCII"; | ||
| 156 | case 20273: | ||
| 157 | return "IBM273"; | ||
| 158 | case 20277: | ||
| 159 | return "IBM277"; | ||
| 160 | case 20278: | ||
| 161 | return "IBM278"; | ||
| 162 | case 20280: | ||
| 163 | return "IBM280"; | ||
| 164 | case 20284: | ||
| 165 | return "IBM284"; | ||
| 166 | case 20285: | ||
| 167 | return "IBM285"; | ||
| 168 | case 20290: | ||
| 169 | return "IBM290"; | ||
| 170 | case 20297: | ||
| 171 | return "IBM297"; | ||
| 172 | case 20420: | ||
| 173 | return "IBM420"; | ||
| 174 | case 20423: | ||
| 175 | return "IBM423"; | ||
| 176 | case 20424: | ||
| 177 | return "IBM424"; | ||
| 178 | case 20838: | ||
| 179 | return "IBM-Thai"; | ||
| 180 | case 20866: | ||
| 181 | return "KOI8-R"; | ||
| 182 | case 20871: | ||
| 183 | return "IBM871"; | ||
| 184 | case 20880: | ||
| 185 | return "IBM880"; | ||
| 186 | case 20905: | ||
| 187 | return "IBM905"; | ||
| 188 | case 20924: | ||
| 189 | return "IBM00924"; | ||
| 190 | case 20932: | ||
| 191 | return "EUC-JP"; | ||
| 192 | case 21866: | ||
| 193 | return "KOI8-U"; | ||
| 194 | case 28591: | ||
| 195 | return "ISO-8859-1"; | ||
| 196 | case 28592: | ||
| 197 | return "ISO-8859-2"; | ||
| 198 | case 28593: | ||
| 199 | return "ISO-8859-3"; | ||
| 200 | case 28594: | ||
| 201 | return "ISO-8859-4"; | ||
| 202 | case 28595: | ||
| 203 | return "ISO-8859-9"; | ||
| 204 | case 28596: | ||
| 205 | return "ISO-8859-10"; | ||
| 206 | case 28597: | ||
| 207 | return "ISO-8859-7"; | ||
| 208 | case 28598: | ||
| 209 | return "ISO-8859-8"; | ||
| 210 | case 28599: | ||
| 211 | return "ISO-8859-9-Windows-Latin-5"; | ||
| 212 | case 28603: | ||
| 213 | return "ISO-8859-13"; | ||
| 214 | case 28605: | ||
| 215 | return "ISO-8859-15"; | ||
| 216 | case 38598: | ||
| 217 | return "ISO-8859-8-I"; | ||
| 218 | case 50220: | ||
| 219 | case 50221: | ||
| 220 | case 50222: | ||
| 221 | return "ISO-2022-JP"; | ||
| 222 | case 51932: | ||
| 223 | return "EUC-JP"; | ||
| 224 | case 51936: | ||
| 225 | return "GB2312"; | ||
| 226 | case 51949: | ||
| 227 | return "EUC-KR"; | ||
| 228 | case 52936: | ||
| 229 | return "HZ-GB-2312"; | ||
| 230 | case 54936: | ||
| 231 | return "GB18030"; | ||
| 232 | case 65000: | ||
| 233 | return "UTF-7"; | ||
| 234 | case 65001: | ||
| 235 | return "UTF-8"; | ||
| 236 | default: | ||
| 237 | return nullptr; | ||
| 238 | } | ||
| 239 | } | ||
| 240 | } // namespace | ||
| 241 | |||
| 242 | const char* __get_locale_encoding(__locale_t loc) { | ||
| 243 | const char* locale_name = loc.__get_locale(); | ||
| 244 | if (locale_name == nullptr) { | ||
| 245 | return __codepage_name(::GetACP()); | ||
| 246 | } | ||
| 247 | |||
| 248 | std::string_view __sv(locale_name); | ||
| 249 | |||
| 250 | // locale :: "locale-name" | ||
| 251 | // | "language"[_country-region[.code-page]] | ||
| 252 | // | ".code-page" | ||
| 253 | // GetLocaleInfoEx doesn't accept anything other than BCP-47 locale names, e.g. "en_US", | ||
| 254 | // so do a best-attempt to derive the text encoding from the name. | ||
| 255 | if (__sv == "C" || __sv == "") { | ||
| 256 | // "A locale argument value of C specifies the minimal ANSI conforming environment for C translation." | ||
| 257 | // TODO: Figure out what to do for an empty string: | ||
| 258 | // "If locale points to an empty string, the locale is the implementation-defined native environment." | ||
| 259 | return __codepage_name(::GetACP()); | ||
| 260 | } else if (auto dot = __sv.find('.'); dot != std::string_view::npos) { | ||
| 261 | std::string_view __code_page(locale_name + dot + 1); | ||
| 262 | |||
| 263 | // Windows allows the codepage number as part of the name, | ||
| 264 | // e.g. "en_US.1252" for English US, Windows-1252. | ||
| 265 | if (std::isdigit(__code_page[0])) { | ||
| 266 | unsigned int __cpage{}; | ||
| 267 | auto __res = std::from_chars(__code_page.data(), __code_page.data() + __code_page.size(), __cpage); | ||
| 268 | if (__res) { | ||
| 269 | return __codepage_name(__cpage); | ||
| 270 | } | ||
| 271 | } else { // POSIX-style name | ||
| 272 | return locale_name + dot + 1; | ||
| 273 | } | ||
| 274 | } | ||
| 275 | |||
| 276 | wchar_t locale_wbuffer[LOCALE_NAME_MAX_LENGTH + 1]{}; | ||
| 277 | wchar_t number_buffer[11]{}; | ||
| 278 | |||
| 279 | bool is_ansi = ::AreFileApisANSI(); | ||
| 280 | auto codepage = is_ansi ? CP_ACP : CP_OEMCP; | ||
| 281 | int ret = ::MultiByteToWideChar( | ||
| 282 | codepage, MB_ERR_INVALID_CHARS, locale_name, __sv.size(), locale_wbuffer, LOCALE_NAME_MAX_LENGTH); | ||
| 283 | |||
| 284 | if (ret <= 0) | ||
| 285 | return nullptr; | ||
| 286 | |||
| 287 | // The below function fills the string with the number in text. | ||
| 288 | auto lctype = is_ansi ? LOCALE_IDEFAULTANSICODEPAGE : LOCALE_IDEFAULTCODEPAGE; | ||
| 289 | int result = ::GetLocaleInfoEx(locale_wbuffer, lctype, number_buffer, 10); | ||
| 290 | |||
| 291 | if (result <= 0) | ||
| 292 | return nullptr; | ||
| 293 | |||
| 294 | unsigned int acp = std::wcstoul(number_buffer, nullptr, 10); | ||
| 295 | return __codepage_name(acp); | ||
| 296 | } | ||
| 297 | |||
| 37 | // | 298 | // |
| 38 | // Strtonum functions | 299 | // Strtonum functions |
| 39 | // | 300 | // |
| ... | @@ -182,4 +443,5 @@ int __asprintf(char** ret, __locale_t loc, const char* format, ...) { | ... | @@ -182,4 +443,5 @@ int __asprintf(char** ret, __locale_t loc, const char* format, ...) { |
| 182 | } | 443 | } |
| 183 | 444 | ||
| 184 | } // namespace __locale | 445 | } // namespace __locale |
| 446 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 185 | _LIBCPP_END_NAMESPACE_STD | 447 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/support/win32/thread_win32.cpp+2| ... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
| 16 | #include <fibersapi.h> | 16 | #include <fibersapi.h> |
| 17 | 17 | ||
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 19 | 20 | ||
| 20 | static_assert(sizeof(__libcpp_mutex_t) == sizeof(SRWLOCK), ""); | 21 | static_assert(sizeof(__libcpp_mutex_t) == sizeof(SRWLOCK), ""); |
| 21 | static_assert(alignof(__libcpp_mutex_t) == alignof(SRWLOCK), ""); | 22 | static_assert(alignof(__libcpp_mutex_t) == alignof(SRWLOCK), ""); |
| ... | @@ -211,4 +212,5 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) { | ... | @@ -211,4 +212,5 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) { |
| 211 | return 0; | 212 | return 0; |
| 212 | } | 213 | } |
| 213 | 214 | ||
| 215 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 214 | _LIBCPP_END_NAMESPACE_STD | 216 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/system_error.cpp+2| ... | @@ -27,6 +27,7 @@ | ... | @@ -27,6 +27,7 @@ |
| 27 | #endif | 27 | #endif |
| 28 | 28 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 30 | 31 | ||
| 31 | #if defined(_LIBCPP_WIN32API) | 32 | #if defined(_LIBCPP_WIN32API) |
| 32 | 33 | ||
| ... | @@ -368,4 +369,5 @@ void __throw_system_error(int ev, const char* what_arg) { | ... | @@ -368,4 +369,5 @@ void __throw_system_error(int ev, const char* what_arg) { |
| 368 | #endif | 369 | #endif |
| 369 | } | 370 | } |
| 370 | 371 | ||
| 372 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 371 | _LIBCPP_END_NAMESPACE_STD | 373 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/text_encoding.cpp created+54| ... | @@ -0,0 +1,54 @@ | ||
| 1 | //===----------------------------------------------------------------------===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | |||
| 9 | #include <__config> | ||
| 10 | #include <__locale_dir/locale_base_api.h> | ||
| 11 | #include <__utility/scope_guard.h> | ||
| 12 | #include <text_encoding> | ||
| 13 | |||
| 14 | _LIBCPP_BEGIN_NAMESPACE_STD | ||
| 15 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 16 | |||
| 17 | #if defined(__ANDROID__) | ||
| 18 | // UTF-8 is the always the environment encoding on Android. | ||
| 19 | std::text_encoding __get_locale_encoding([[maybe_unused]] const char* __name) { return std::text_encoding::id::UTF8; } | ||
| 20 | #else | ||
| 21 | static text_encoding __make_text_encoding(const char* __name) { | ||
| 22 | if (__name == nullptr) | ||
| 23 | return text_encoding{}; | ||
| 24 | |||
| 25 | string_view __name_view(__name); | ||
| 26 | if (__name_view.size() > text_encoding::max_name_length) | ||
| 27 | return text_encoding{}; | ||
| 28 | |||
| 29 | return text_encoding(__name_view); | ||
| 30 | } | ||
| 31 | |||
| 32 | std::text_encoding __get_locale_encoding(const char* __name) { | ||
| 33 | if (__name == nullptr) | ||
| 34 | return __make_text_encoding(__locale::__get_locale_encoding(static_cast<__locale::__locale_t>(0))); | ||
| 35 | |||
| 36 | __locale::__locale_t __l = __locale::__newlocale(_LIBCPP_CTYPE_MASK, __name, static_cast<__locale::__locale_t>(0)); | ||
| 37 | |||
| 38 | __scope_guard __locale_guard([&__l] { | ||
| 39 | if (__l) { | ||
| 40 | __locale::__freelocale(__l); | ||
| 41 | } | ||
| 42 | }); | ||
| 43 | |||
| 44 | if (!__l) { | ||
| 45 | return text_encoding{}; | ||
| 46 | } | ||
| 47 | |||
| 48 | return __make_text_encoding(__locale::__get_locale_encoding(__l)); | ||
| 49 | } | ||
| 50 | |||
| 51 | #endif // __ANDROID__ | ||
| 52 | |||
| 53 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 54 | _LIBCPP_END_NAMESPACE_STD | ||
lib/libcxx/src/thread.cpp+2| ... | @@ -33,6 +33,7 @@ | ... | @@ -33,6 +33,7 @@ |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | _LIBCPP_BEGIN_NAMESPACE_STD | 35 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 36 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 36 | 37 | ||
| 37 | thread::~thread() { | 38 | thread::~thread() { |
| 38 | if (!__libcpp_thread_isnull(&__t_)) | 39 | if (!__libcpp_thread_isnull(&__t_)) |
| ... | @@ -170,4 +171,5 @@ void __thread_struct::notify_all_at_thread_exit(condition_variable* cv, mutex* m | ... | @@ -170,4 +171,5 @@ void __thread_struct::notify_all_at_thread_exit(condition_variable* cv, mutex* m |
| 170 | 171 | ||
| 171 | void __thread_struct::__make_ready_at_thread_exit(__assoc_sub_state* __s) { __p_->__make_ready_at_thread_exit(__s); } | 172 | void __thread_struct::__make_ready_at_thread_exit(__assoc_sub_state* __s) { __p_->__make_ready_at_thread_exit(__s); } |
| 172 | 173 | ||
| 174 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 173 | _LIBCPP_END_NAMESPACE_STD | 175 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/valarray.cpp+2| ... | @@ -9,6 +9,7 @@ | ... | @@ -9,6 +9,7 @@ |
| 9 | #include <valarray> | 9 | #include <valarray> |
| 10 | 10 | ||
| 11 | _LIBCPP_BEGIN_NAMESPACE_STD | 11 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 12 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 12 | 13 | ||
| 13 | #if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 9 | 14 | #if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 9 |
| 14 | template _LIBCPP_EXPORTED_FROM_ABI valarray<size_t>::valarray(size_t); | 15 | template _LIBCPP_EXPORTED_FROM_ABI valarray<size_t>::valarray(size_t); |
| ... | @@ -45,4 +46,5 @@ void gslice::__init(size_t __start) { | ... | @@ -45,4 +46,5 @@ void gslice::__init(size_t __start) { |
| 45 | } | 46 | } |
| 46 | } | 47 | } |
| 47 | 48 | ||
| 49 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 48 | _LIBCPP_END_NAMESPACE_STD | 50 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/variant.cpp+2| ... | @@ -12,4 +12,6 @@ namespace std { | ... | @@ -12,4 +12,6 @@ namespace std { |
| 12 | 12 | ||
| 13 | const char* bad_variant_access::what() const noexcept { return "bad_variant_access"; } | 13 | const char* bad_variant_access::what() const noexcept { return "bad_variant_access"; } |
| 14 | 14 | ||
| 15 | const char* __bad_variant_access_with_msg::what() const noexcept { return __msg_; } | ||
| 16 | |||
| 15 | } // namespace std | 17 | } // namespace std |
lib/libcxx/src/vector.cpp+2| ... | @@ -9,6 +9,7 @@ | ... | @@ -9,6 +9,7 @@ |
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | 10 | ||
| 11 | _LIBCPP_BEGIN_NAMESPACE_STD | 11 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 12 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 12 | 13 | ||
| 13 | #if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15 | 14 | #if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15 |
| 14 | 15 | ||
| ... | @@ -27,4 +28,5 @@ void __vector_base_common<true>::__throw_out_of_range() const { std::__throw_out | ... | @@ -27,4 +28,5 @@ void __vector_base_common<true>::__throw_out_of_range() const { std::__throw_out |
| 27 | 28 | ||
| 28 | #endif // _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15 | 29 | #endif // _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15 |
| 29 | 30 | ||
| 31 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 30 | _LIBCPP_END_NAMESPACE_STD | 32 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/verbose_abort.cpp+3-1| ... | @@ -22,8 +22,9 @@ extern "C" void android_set_abort_message(const char* msg); | ... | @@ -22,8 +22,9 @@ extern "C" void android_set_abort_message(const char* msg); |
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | 24 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS | ||
| 25 | 26 | ||
| 26 | _LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) noexcept { | 27 | [[gnu::weak]] void __libcpp_verbose_abort(char const* format, ...) noexcept { |
| 27 | // Write message to stderr. We do this before formatting into a | 28 | // Write message to stderr. We do this before formatting into a |
| 28 | // buffer so that we still get some information out if that fails. | 29 | // buffer so that we still get some information out if that fails. |
| 29 | { | 30 | { |
| ... | @@ -62,4 +63,5 @@ _LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) noexcept { | ... | @@ -62,4 +63,5 @@ _LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) noexcept { |
| 62 | std::abort(); | 63 | std::abort(); |
| 63 | } | 64 | } |
| 64 | 65 | ||
| 66 | _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS | ||
| 65 | _LIBCPP_END_NAMESPACE_STD | 67 | _LIBCPP_END_NAMESPACE_STD |
src/libs/libcxx.zig+3-2| ... | @@ -82,6 +82,7 @@ const libcxx_base_files = [_][]const u8{ | ... | @@ -82,6 +82,7 @@ const libcxx_base_files = [_][]const u8{ |
| 82 | "src/support/win32/locale_win32.cpp", | 82 | "src/support/win32/locale_win32.cpp", |
| 83 | "src/support/win32/support.cpp", | 83 | "src/support/win32/support.cpp", |
| 84 | "src/system_error.cpp", | 84 | "src/system_error.cpp", |
| 85 | "src/text_encoding.cpp", | ||
| 85 | "src/typeinfo.cpp", | 86 | "src/typeinfo.cpp", |
| 86 | "src/valarray.cpp", | 87 | "src/valarray.cpp", |
| 87 | "src/variant.cpp", | 88 | "src/variant.cpp", |
| ... | @@ -222,7 +223,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! | ... | @@ -222,7 +223,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 222 | try cflags.append("-faligned-allocation"); | 223 | try cflags.append("-faligned-allocation"); |
| 223 | 224 | ||
| 224 | try cflags.append("-nostdinc++"); | 225 | try cflags.append("-nostdinc++"); |
| 225 | try cflags.append("-std=c++23"); | 226 | try cflags.append("-std=c++26"); |
| 226 | 227 | ||
| 227 | // These depend on only the zig lib directory file path, which is | 228 | // These depend on only the zig lib directory file path, which is |
| 228 | // purposefully either in the cache or not in the cache. The decision | 229 | // purposefully either in the cache or not in the cache. The decision |
| ... | @@ -417,7 +418,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr | ... | @@ -417,7 +418,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 417 | 418 | ||
| 418 | try cflags.append("-nostdinc++"); | 419 | try cflags.append("-nostdinc++"); |
| 419 | try cflags.append("-fstrict-aliasing"); | 420 | try cflags.append("-fstrict-aliasing"); |
| 420 | try cflags.append("-std=c++23"); | 421 | try cflags.append("-std=c++26"); |
| 421 | 422 | ||
| 422 | // These depend on only the zig lib directory file path, which is | 423 | // These depend on only the zig lib directory file path, which is |
| 423 | // purposefully either in the cache or not in the cache. The decision | 424 | // purposefully either in the cache or not in the cache. The decision |