| author | |
| committer | |
| log | 1eaf180dd04efcf65ef981b1e1064658b5ec09c3 |
| tree | c12e99871e9ba098bea523da0bde266d9afbd065 |
| parent | 85be0b8c6589f58d5667d0a8a8f94524d5de5ba6 |
770 files changed, 27324 insertions(+), 15388 deletions(-)
lib/libcxx/include/__algorithm/adjacent_find.h+4-5| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | |
| 25 | 25 | template <class _Iter, class _Sent, class _BinaryPredicate> |
| 26 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter | |
| 26 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter | |
| 27 | 27 | __adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) { |
| 28 | 28 | if (__first == __last) |
| 29 | 29 | return __first; |
| ... | ... | @@ -37,16 +37,15 @@ __adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) { |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | template <class _ForwardIterator, class _BinaryPredicate> |
| 40 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 40 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 41 | 41 | adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) { |
| 42 | 42 | return std::__adjacent_find(std::move(__first), std::move(__last), __pred); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | template <class _ForwardIterator> |
| 46 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 46 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 47 | 47 | adjacent_find(_ForwardIterator __first, _ForwardIterator __last) { |
| 48 | typedef typename iterator_traits<_ForwardIterator>::value_type __v; | |
| 49 | return std::adjacent_find(std::move(__first), std::move(__last), __equal_to<__v>()); | |
| 48 | return std::adjacent_find(std::move(__first), std::move(__last), __equal_to()); | |
| 50 | 49 | } |
| 51 | 50 | |
| 52 | 51 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/all_of.h+1-1| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _InputIterator, class _Predicate> |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 23 | 23 | all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { |
| 24 | 24 | for (; __first != __last; ++__first) |
| 25 | 25 | if (!__pred(*__first)) |
lib/libcxx/include/__algorithm/any_of.h+1-1| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _InputIterator, class _Predicate> |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 23 | 23 | any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { |
| 24 | 24 | for (; __first != __last; ++__first) |
| 25 | 25 | if (__pred(*__first)) |
lib/libcxx/include/__algorithm/binary_search.h+3-4| ... | ... | @@ -23,18 +23,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | |
| 24 | 24 | template <class _ForwardIterator, class _Tp, class _Compare> |
| 25 | 25 | _LIBCPP_NODISCARD_EXT inline |
| 26 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 26 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 27 | 27 | bool |
| 28 | 28 | binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) |
| 29 | 29 | { |
| 30 | using _Comp_ref = typename __comp_ref_type<_Compare>::type; | |
| 31 | __first = std::lower_bound<_ForwardIterator, _Tp, _Comp_ref>(__first, __last, __value, __comp); | |
| 30 | __first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp); | |
| 32 | 31 | return __first != __last && !__comp(__value, *__first); |
| 33 | 32 | } |
| 34 | 33 | |
| 35 | 34 | template <class _ForwardIterator, class _Tp> |
| 36 | 35 | _LIBCPP_NODISCARD_EXT inline |
| 37 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 36 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 38 | 37 | bool |
| 39 | 38 | binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) |
| 40 | 39 | { |
lib/libcxx/include/__algorithm/comp.h+12-38| ... | ... | @@ -17,73 +17,47 @@ |
| 17 | 17 | |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | // I'd like to replace these with _VSTD::equal_to<void>, but can't because: | |
| 21 | // * That only works with C++14 and later, and | |
| 22 | // * We haven't included <functional> here. | |
| 23 | template <class _T1, class _T2 = _T1> | |
| 24 | struct __equal_to | |
| 25 | { | |
| 26 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} | |
| 27 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _T1& __x, const _T2& __y) const {return __x == __y;} | |
| 28 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _T2& __x, const _T1& __y) const {return __x == __y;} | |
| 29 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _T2& __x, const _T2& __y) const {return __x == __y;} | |
| 30 | }; | |
| 31 | ||
| 32 | template <class _T1> | |
| 33 | struct __equal_to<_T1, _T1> | |
| 34 | { | |
| 35 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 36 | bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} | |
| 37 | }; | |
| 38 | ||
| 39 | template <class _T1> | |
| 40 | struct __equal_to<const _T1, _T1> | |
| 41 | { | |
| 42 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 43 | bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} | |
| 44 | }; | |
| 45 | ||
| 46 | template <class _T1> | |
| 47 | struct __equal_to<_T1, const _T1> | |
| 48 | { | |
| 49 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 50 | bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} | |
| 20 | struct __equal_to { | |
| 21 | template <class _T1, class _T2> | |
| 22 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _T1& __x, const _T2& __y) const { | |
| 23 | return __x == __y; | |
| 24 | } | |
| 51 | 25 | }; |
| 52 | 26 | |
| 53 | 27 | template <class _T1, class _T2 = _T1> |
| 54 | 28 | struct __less |
| 55 | 29 | { |
| 56 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 30 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 57 | 31 | bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} |
| 58 | 32 | |
| 59 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 33 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 60 | 34 | bool operator()(const _T1& __x, const _T2& __y) const {return __x < __y;} |
| 61 | 35 | |
| 62 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 36 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 63 | 37 | bool operator()(const _T2& __x, const _T1& __y) const {return __x < __y;} |
| 64 | 38 | |
| 65 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 39 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 66 | 40 | bool operator()(const _T2& __x, const _T2& __y) const {return __x < __y;} |
| 67 | 41 | }; |
| 68 | 42 | |
| 69 | 43 | template <class _T1> |
| 70 | 44 | struct __less<_T1, _T1> |
| 71 | 45 | { |
| 72 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 46 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 73 | 47 | bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} |
| 74 | 48 | }; |
| 75 | 49 | |
| 76 | 50 | template <class _T1> |
| 77 | 51 | struct __less<const _T1, _T1> |
| 78 | 52 | { |
| 79 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 53 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 80 | 54 | bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} |
| 81 | 55 | }; |
| 82 | 56 | |
| 83 | 57 | template <class _T1> |
| 84 | 58 | struct __less<_T1, const _T1> |
| 85 | 59 | { |
| 86 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 60 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 87 | 61 | bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} |
| 88 | 62 | }; |
| 89 | 63 |
lib/libcxx/include/__algorithm/comp_ref_type.h+13-14| ... | ... | @@ -23,11 +23,11 @@ template <class _Compare> |
| 23 | 23 | struct __debug_less |
| 24 | 24 | { |
| 25 | 25 | _Compare &__comp_; |
| 26 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 26 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 27 | 27 | __debug_less(_Compare& __c) : __comp_(__c) {} |
| 28 | 28 | |
| 29 | 29 | template <class _Tp, class _Up> |
| 30 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 30 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 31 | 31 | bool operator()(const _Tp& __x, const _Up& __y) |
| 32 | 32 | { |
| 33 | 33 | bool __r = __comp_(__x, __y); |
| ... | ... | @@ -37,7 +37,7 @@ struct __debug_less |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | template <class _Tp, class _Up> |
| 40 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 40 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 41 | 41 | bool operator()(_Tp& __x, _Up& __y) |
| 42 | 42 | { |
| 43 | 43 | bool __r = __comp_(__x, __y); |
| ... | ... | @@ -47,10 +47,10 @@ struct __debug_less |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | template <class _LHS, class _RHS> |
| 50 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 50 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 51 | 51 | inline _LIBCPP_INLINE_VISIBILITY |
| 52 | decltype((void)declval<_Compare&>()( | |
| 53 | declval<_LHS &>(), declval<_RHS &>())) | |
| 52 | decltype((void)std::declval<_Compare&>()( | |
| 53 | std::declval<_LHS &>(), std::declval<_RHS &>())) | |
| 54 | 54 | __do_compare_assert(int, _LHS & __l, _RHS & __r) { |
| 55 | 55 | _LIBCPP_DEBUG_ASSERT(!__comp_(__l, __r), |
| 56 | 56 | "Comparator does not induce a strict weak ordering"); |
| ... | ... | @@ -59,21 +59,20 @@ struct __debug_less |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | template <class _LHS, class _RHS> |
| 62 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 62 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 63 | 63 | inline _LIBCPP_INLINE_VISIBILITY |
| 64 | 64 | void __do_compare_assert(long, _LHS &, _RHS &) {} |
| 65 | 65 | }; |
| 66 | 66 | |
| 67 | template <class _Comp> | |
| 68 | struct __comp_ref_type { | |
| 69 | // Pass the comparator by lvalue reference. Or in debug mode, using a | |
| 70 | // debugging wrapper that stores a reference. | |
| 67 | // Pass the comparator by lvalue reference. Or in debug mode, using a | |
| 68 | // debugging wrapper that stores a reference. | |
| 71 | 69 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 72 | typedef __debug_less<_Comp> type; | |
| 70 | template <class _Comp> | |
| 71 | using __comp_ref_type = __debug_less<_Comp>; | |
| 73 | 72 | #else |
| 74 | typedef _Comp& type; | |
| 73 | template <class _Comp> | |
| 74 | using __comp_ref_type = _Comp&; | |
| 75 | 75 | #endif |
| 76 | }; | |
| 77 | 76 | |
| 78 | 77 | _LIBCPP_END_NAMESPACE_STD |
| 79 | 78 |
lib/libcxx/include/__algorithm/copy.h+90-72| ... | ... | @@ -9,100 +9,118 @@ |
| 9 | 9 | #ifndef _LIBCPP___ALGORITHM_COPY_H |
| 10 | 10 | #define _LIBCPP___ALGORITHM_COPY_H |
| 11 | 11 | |
| 12 | #include <__algorithm/unwrap_iter.h> | |
| 13 | #include <__algorithm/unwrap_range.h> | |
| 12 | #include <__algorithm/copy_move_common.h> | |
| 13 | #include <__algorithm/iterator_operations.h> | |
| 14 | #include <__algorithm/min.h> | |
| 14 | 15 | #include <__config> |
| 15 | #include <__iterator/iterator_traits.h> | |
| 16 | #include <__iterator/reverse_iterator.h> | |
| 16 | #include <__iterator/segmented_iterator.h> | |
| 17 | #include <__type_traits/common_type.h> | |
| 17 | 18 | #include <__utility/move.h> |
| 18 | 19 | #include <__utility/pair.h> |
| 19 | #include <cstring> | |
| 20 | #include <type_traits> | |
| 21 | 20 | |
| 22 | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | 22 | # pragma GCC system_header |
| 24 | 23 | #endif |
| 25 | 24 | |
| 25 | _LIBCPP_PUSH_MACROS | |
| 26 | #include <__undef_macros> | |
| 27 | ||
| 26 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 29 | |
| 28 | // copy | |
| 30 | template <class, class _InIter, class _Sent, class _OutIter> | |
| 31 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> __copy(_InIter, _Sent, _OutIter); | |
| 32 | ||
| 33 | template <class _AlgPolicy> | |
| 34 | struct __copy_loop { | |
| 35 | template <class _InIter, class _Sent, class _OutIter> | |
| 36 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 37 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { | |
| 38 | while (__first != __last) { | |
| 39 | *__result = *__first; | |
| 40 | ++__first; | |
| 41 | ++__result; | |
| 42 | } | |
| 29 | 43 | |
| 30 | template <class _InIter, class _Sent, class _OutIter> | |
| 31 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 32 | pair<_InIter, _OutIter> __copy_impl(_InIter __first, _Sent __last, _OutIter __result) { | |
| 33 | while (__first != __last) { | |
| 34 | *__result = *__first; | |
| 35 | ++__first; | |
| 36 | ++__result; | |
| 44 | return std::make_pair(std::move(__first), std::move(__result)); | |
| 37 | 45 | } |
| 38 | return pair<_InIter, _OutIter>(std::move(__first), std::move(__result)); | |
| 39 | } | |
| 40 | 46 | |
| 41 | template <class _InValueT, | |
| 42 | class _OutValueT, | |
| 43 | class = __enable_if_t<is_same<typename remove_const<_InValueT>::type, _OutValueT>::value | |
| 44 | && is_trivially_copy_assignable<_OutValueT>::value> > | |
| 45 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 46 | pair<_InValueT*, _OutValueT*> __copy_impl(_InValueT* __first, _InValueT* __last, _OutValueT* __result) { | |
| 47 | if (__libcpp_is_constant_evaluated() | |
| 48 | // TODO: Remove this once GCC supports __builtin_memmove during constant evaluation | |
| 49 | #ifndef _LIBCPP_COMPILER_GCC | |
| 50 | && !is_trivially_copyable<_InValueT>::value | |
| 51 | #endif | |
| 52 | ) | |
| 53 | return std::__copy_impl<_InValueT*, _InValueT*, _OutValueT*>(__first, __last, __result); | |
| 54 | const size_t __n = static_cast<size_t>(__last - __first); | |
| 55 | if (__n > 0) | |
| 56 | ::__builtin_memmove(__result, __first, __n * sizeof(_OutValueT)); | |
| 57 | return std::make_pair(__first + __n, __result + __n); | |
| 58 | } | |
| 47 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0> | |
| 48 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 49 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | |
| 50 | using _Traits = __segmented_iterator_traits<_InIter>; | |
| 51 | auto __sfirst = _Traits::__segment(__first); | |
| 52 | auto __slast = _Traits::__segment(__last); | |
| 53 | if (__sfirst == __slast) { | |
| 54 | auto __iters = std::__copy<_AlgPolicy>(_Traits::__local(__first), _Traits::__local(__last), std::move(__result)); | |
| 55 | return std::make_pair(__last, std::move(__iters.second)); | |
| 56 | } | |
| 59 | 57 | |
| 60 | template <class _InIter, class _OutIter, | |
| 61 | __enable_if_t<is_same<typename remove_const<__iter_value_type<_InIter> >::type, __iter_value_type<_OutIter> >::value | |
| 62 | && __is_cpp17_contiguous_iterator<typename _InIter::iterator_type>::value | |
| 63 | && __is_cpp17_contiguous_iterator<typename _OutIter::iterator_type>::value | |
| 64 | && is_trivially_copy_assignable<__iter_value_type<_OutIter> >::value | |
| 65 | && __is_reverse_iterator<_InIter>::value | |
| 66 | && __is_reverse_iterator<_OutIter>::value, int> = 0> | |
| 67 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 68 | pair<_InIter, _OutIter> | |
| 69 | __copy_impl(_InIter __first, _InIter __last, _OutIter __result) { | |
| 70 | auto __first_base = std::__unwrap_iter(__first.base()); | |
| 71 | auto __last_base = std::__unwrap_iter(__last.base()); | |
| 72 | auto __result_base = std::__unwrap_iter(__result.base()); | |
| 73 | auto __result_first = __result_base - (__first_base - __last_base); | |
| 74 | std::__copy_impl(__last_base, __first_base, __result_first); | |
| 75 | return std::make_pair(__last, _OutIter(std::__rewrap_iter(__result.base(), __result_first))); | |
| 76 | } | |
| 58 | __result = std::__copy<_AlgPolicy>(_Traits::__local(__first), _Traits::__end(__sfirst), std::move(__result)).second; | |
| 59 | ++__sfirst; | |
| 60 | while (__sfirst != __slast) { | |
| 61 | __result = | |
| 62 | std::__copy<_AlgPolicy>(_Traits::__begin(__sfirst), _Traits::__end(__sfirst), std::move(__result)).second; | |
| 63 | ++__sfirst; | |
| 64 | } | |
| 65 | __result = | |
| 66 | std::__copy<_AlgPolicy>(_Traits::__begin(__sfirst), _Traits::__local(__last), std::move(__result)).second; | |
| 67 | return std::make_pair(__last, std::move(__result)); | |
| 68 | } | |
| 77 | 69 | |
| 78 | template <class _InIter, class _Sent, class _OutIter, | |
| 79 | __enable_if_t<!(is_copy_constructible<_InIter>::value | |
| 80 | && is_copy_constructible<_Sent>::value | |
| 81 | && is_copy_constructible<_OutIter>::value), int> = 0 > | |
| 82 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 83 | pair<_InIter, _OutIter> __copy(_InIter __first, _Sent __last, _OutIter __result) { | |
| 84 | return std::__copy_impl(std::move(__first), std::move(__last), std::move(__result)); | |
| 85 | } | |
| 70 | template <class _InIter, | |
| 71 | class _OutIter, | |
| 72 | __enable_if_t<__is_cpp17_random_access_iterator<_InIter>::value && | |
| 73 | !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value, | |
| 74 | int> = 0> | |
| 75 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 76 | operator()(_InIter __first, _InIter __last, _OutIter __result) { | |
| 77 | using _Traits = __segmented_iterator_traits<_OutIter>; | |
| 78 | using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type; | |
| 86 | 79 | |
| 87 | template <class _InIter, class _Sent, class _OutIter, | |
| 88 | __enable_if_t<is_copy_constructible<_InIter>::value | |
| 89 | && is_copy_constructible<_Sent>::value | |
| 90 | && is_copy_constructible<_OutIter>::value, int> = 0> | |
| 91 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 92 | pair<_InIter, _OutIter> __copy(_InIter __first, _Sent __last, _OutIter __result) { | |
| 93 | auto __range = std::__unwrap_range(__first, __last); | |
| 94 | auto __ret = std::__copy_impl(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__result)); | |
| 95 | return std::make_pair( | |
| 96 | std::__rewrap_range<_Sent>(__first, __ret.first), std::__rewrap_iter(__result, __ret.second)); | |
| 80 | if (__first == __last) | |
| 81 | return std::make_pair(std::move(__first), std::move(__result)); | |
| 82 | ||
| 83 | auto __local_first = _Traits::__local(__result); | |
| 84 | auto __segment_iterator = _Traits::__segment(__result); | |
| 85 | while (true) { | |
| 86 | auto __local_last = _Traits::__end(__segment_iterator); | |
| 87 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); | |
| 88 | auto __iters = std::__copy<_AlgPolicy>(__first, __first + __size, __local_first); | |
| 89 | __first = std::move(__iters.first); | |
| 90 | ||
| 91 | if (__first == __last) | |
| 92 | return std::make_pair(std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.second))); | |
| 93 | ||
| 94 | __local_first = _Traits::__begin(++__segment_iterator); | |
| 95 | } | |
| 96 | } | |
| 97 | }; | |
| 98 | ||
| 99 | struct __copy_trivial { | |
| 100 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. | |
| 101 | template <class _In, class _Out, | |
| 102 | __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0> | |
| 103 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*> | |
| 104 | operator()(_In* __first, _In* __last, _Out* __result) const { | |
| 105 | return std::__copy_trivial_impl(__first, __last, __result); | |
| 106 | } | |
| 107 | }; | |
| 108 | ||
| 109 | template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter> | |
| 110 | pair<_InIter, _OutIter> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 111 | __copy(_InIter __first, _Sent __last, _OutIter __result) { | |
| 112 | return std::__dispatch_copy_or_move<_AlgPolicy, __copy_loop<_AlgPolicy>, __copy_trivial>( | |
| 113 | std::move(__first), std::move(__last), std::move(__result)); | |
| 97 | 114 | } |
| 98 | 115 | |
| 99 | 116 | template <class _InputIterator, class _OutputIterator> |
| 100 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 101 | _OutputIterator | |
| 117 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | |
| 102 | 118 | copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { |
| 103 | return std::__copy(__first, __last, __result).second; | |
| 119 | return std::__copy<_ClassicAlgPolicy>(__first, __last, __result).second; | |
| 104 | 120 | } |
| 105 | 121 | |
| 106 | 122 | _LIBCPP_END_NAMESPACE_STD |
| 107 | 123 | |
| 124 | _LIBCPP_POP_MACROS | |
| 125 | ||
| 108 | 126 | #endif // _LIBCPP___ALGORITHM_COPY_H |
lib/libcxx/include/__algorithm/copy_backward.h+112-30| ... | ... | @@ -9,53 +9,135 @@ |
| 9 | 9 | #ifndef _LIBCPP___ALGORITHM_COPY_BACKWARD_H |
| 10 | 10 | #define _LIBCPP___ALGORITHM_COPY_BACKWARD_H |
| 11 | 11 | |
| 12 | #include <__algorithm/copy.h> | |
| 12 | #include <__algorithm/copy_move_common.h> | |
| 13 | 13 | #include <__algorithm/iterator_operations.h> |
| 14 | #include <__algorithm/ranges_copy.h> | |
| 15 | #include <__algorithm/unwrap_iter.h> | |
| 16 | #include <__concepts/same_as.h> | |
| 14 | #include <__algorithm/min.h> | |
| 17 | 15 | #include <__config> |
| 18 | #include <__iterator/iterator_traits.h> | |
| 19 | #include <__iterator/reverse_iterator.h> | |
| 20 | #include <__ranges/subrange.h> | |
| 16 | #include <__iterator/segmented_iterator.h> | |
| 17 | #include <__type_traits/common_type.h> | |
| 18 | #include <__type_traits/is_copy_constructible.h> | |
| 21 | 19 | #include <__utility/move.h> |
| 22 | 20 | #include <__utility/pair.h> |
| 23 | #include <type_traits> | |
| 24 | 21 | |
| 25 | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 26 | 23 | # pragma GCC system_header |
| 27 | 24 | #endif |
| 28 | 25 | |
| 26 | _LIBCPP_PUSH_MACROS | |
| 27 | #include <__undef_macros> | |
| 28 | ||
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| 31 | template <class _AlgPolicy, class _InputIterator, class _OutputIterator, | |
| 32 | __enable_if_t<is_same<_AlgPolicy, _ClassicAlgPolicy>::value, int> = 0> | |
| 33 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_InputIterator, _OutputIterator> | |
| 34 | __copy_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { | |
| 35 | auto __ret = std::__copy( | |
| 36 | __unconstrained_reverse_iterator<_InputIterator>(__last), | |
| 37 | __unconstrained_reverse_iterator<_InputIterator>(__first), | |
| 38 | __unconstrained_reverse_iterator<_OutputIterator>(__result)); | |
| 39 | return pair<_InputIterator, _OutputIterator>(__ret.first.base(), __ret.second.base()); | |
| 40 | } | |
| 31 | template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter> | |
| 32 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InIter, _OutIter> | |
| 33 | __copy_backward(_InIter __first, _Sent __last, _OutIter __result); | |
| 34 | ||
| 35 | template <class _AlgPolicy> | |
| 36 | struct __copy_backward_loop { | |
| 37 | template <class _InIter, class _Sent, class _OutIter> | |
| 38 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 39 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { | |
| 40 | auto __last_iter = _IterOps<_AlgPolicy>::next(__first, __last); | |
| 41 | auto __original_last_iter = __last_iter; | |
| 42 | ||
| 43 | while (__first != __last_iter) { | |
| 44 | *--__result = *--__last_iter; | |
| 45 | } | |
| 46 | ||
| 47 | return std::make_pair(std::move(__original_last_iter), std::move(__result)); | |
| 48 | } | |
| 49 | ||
| 50 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0> | |
| 51 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 52 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | |
| 53 | using _Traits = __segmented_iterator_traits<_InIter>; | |
| 54 | auto __sfirst = _Traits::__segment(__first); | |
| 55 | auto __slast = _Traits::__segment(__last); | |
| 56 | if (__sfirst == __slast) { | |
| 57 | auto __iters = | |
| 58 | std::__copy_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__local(__last), std::move(__result)); | |
| 59 | return std::make_pair(__last, __iters.second); | |
| 60 | } | |
| 61 | ||
| 62 | __result = | |
| 63 | std::__copy_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__local(__last), std::move(__result)) | |
| 64 | .second; | |
| 65 | --__slast; | |
| 66 | while (__sfirst != __slast) { | |
| 67 | __result = | |
| 68 | std::__copy_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__end(__slast), std::move(__result)) | |
| 69 | .second; | |
| 70 | --__slast; | |
| 71 | } | |
| 72 | __result = std::__copy_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__end(__slast), std::move(__result)) | |
| 73 | .second; | |
| 74 | return std::make_pair(__last, std::move(__result)); | |
| 75 | } | |
| 76 | ||
| 77 | template <class _InIter, | |
| 78 | class _OutIter, | |
| 79 | __enable_if_t<__is_cpp17_random_access_iterator<_InIter>::value && | |
| 80 | !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value, | |
| 81 | int> = 0> | |
| 82 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 83 | operator()(_InIter __first, _InIter __last, _OutIter __result) { | |
| 84 | using _Traits = __segmented_iterator_traits<_OutIter>; | |
| 85 | auto __orig_last = __last; | |
| 86 | auto __segment_iterator = _Traits::__segment(__result); | |
| 41 | 87 | |
| 42 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 43 | template <class _AlgPolicy, class _Iter1, class _Sent1, class _Iter2, | |
| 44 | __enable_if_t<is_same<_AlgPolicy, _RangeAlgPolicy>::value, int> = 0> | |
| 45 | _LIBCPP_HIDE_FROM_ABI constexpr pair<_Iter1, _Iter2> __copy_backward(_Iter1 __first, _Sent1 __last, _Iter2 __result) { | |
| 46 | auto __last_iter = _IterOps<_AlgPolicy>::next(__first, std::move(__last)); | |
| 47 | auto __reverse_range = std::__reverse_range(std::ranges::subrange(std::move(__first), __last_iter)); | |
| 48 | auto __ret = ranges::copy(std::move(__reverse_range), std::make_reverse_iterator(__result)); | |
| 49 | return std::make_pair(__last_iter, __ret.out.base()); | |
| 88 | // When the range contains no elements, __result might not be a valid iterator | |
| 89 | if (__first == __last) | |
| 90 | return std::make_pair(__first, __result); | |
| 91 | ||
| 92 | auto __local_last = _Traits::__local(__result); | |
| 93 | while (true) { | |
| 94 | using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type; | |
| 95 | ||
| 96 | auto __local_first = _Traits::__begin(__segment_iterator); | |
| 97 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); | |
| 98 | auto __iter = std::__copy_backward<_AlgPolicy>(__last - __size, __last, __local_last).second; | |
| 99 | __last -= __size; | |
| 100 | ||
| 101 | if (__first == __last) | |
| 102 | return std::make_pair(std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter))); | |
| 103 | --__segment_iterator; | |
| 104 | __local_last = _Traits::__end(__segment_iterator); | |
| 105 | } | |
| 106 | } | |
| 107 | }; | |
| 108 | ||
| 109 | struct __copy_backward_trivial { | |
| 110 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. | |
| 111 | template <class _In, class _Out, | |
| 112 | __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 | operator()(_In* __first, _In* __last, _Out* __result) const { | |
| 115 | return std::__copy_backward_trivial_impl(__first, __last, __result); | |
| 116 | } | |
| 117 | }; | |
| 118 | ||
| 119 | template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2> | |
| 120 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2> | |
| 121 | __copy_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) { | |
| 122 | return std::__dispatch_copy_or_move<_AlgPolicy, __copy_backward_loop<_AlgPolicy>, __copy_backward_trivial>( | |
| 123 | std::move(__first), std::move(__last), std::move(__result)); | |
| 50 | 124 | } |
| 51 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 52 | 125 | |
| 53 | 126 | template <class _BidirectionalIterator1, class _BidirectionalIterator2> |
| 54 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _BidirectionalIterator2 | |
| 55 | copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) { | |
| 56 | return std::__copy_backward<_ClassicAlgPolicy>(__first, __last, __result).second; | |
| 127 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 128 | _BidirectionalIterator2 | |
| 129 | copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, | |
| 130 | _BidirectionalIterator2 __result) | |
| 131 | { | |
| 132 | static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value && | |
| 133 | std::is_copy_constructible<_BidirectionalIterator1>::value, "Iterators must be copy constructible."); | |
| 134 | ||
| 135 | return std::__copy_backward<_ClassicAlgPolicy>( | |
| 136 | std::move(__first), std::move(__last), std::move(__result)).second; | |
| 57 | 137 | } |
| 58 | 138 | |
| 59 | 139 | _LIBCPP_END_NAMESPACE_STD |
| 60 | 140 | |
| 141 | _LIBCPP_POP_MACROS | |
| 142 | ||
| 61 | 143 | #endif // _LIBCPP___ALGORITHM_COPY_BACKWARD_H |
lib/libcxx/include/__algorithm/copy_if.h+1-1| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | 20 | template<class _InputIterator, class _OutputIterator, class _Predicate> |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 22 | 22 | _OutputIterator |
| 23 | 23 | copy_if(_InputIterator __first, _InputIterator __last, |
| 24 | 24 | _OutputIterator __result, _Predicate __pred) |
lib/libcxx/include/__algorithm/copy_move_common.h created+163| ... | ... | @@ -0,0 +1,163 @@ |
| 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_COPY_MOVE_COMMON_H | |
| 10 | #define _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H | |
| 11 | ||
| 12 | #include <__algorithm/iterator_operations.h> | |
| 13 | #include <__algorithm/unwrap_iter.h> | |
| 14 | #include <__algorithm/unwrap_range.h> | |
| 15 | #include <__config> | |
| 16 | #include <__iterator/iterator_traits.h> | |
| 17 | #include <__memory/pointer_traits.h> | |
| 18 | #include <__type_traits/enable_if.h> | |
| 19 | #include <__type_traits/is_always_bitcastable.h> | |
| 20 | #include <__type_traits/is_constant_evaluated.h> | |
| 21 | #include <__type_traits/is_copy_constructible.h> | |
| 22 | #include <__type_traits/is_trivially_assignable.h> | |
| 23 | #include <__type_traits/is_trivially_copyable.h> | |
| 24 | #include <__type_traits/is_volatile.h> | |
| 25 | #include <__utility/move.h> | |
| 26 | #include <__utility/pair.h> | |
| 27 | #include <cstddef> | |
| 28 | ||
| 29 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 30 | # pragma GCC system_header | |
| 31 | #endif | |
| 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 34 | ||
| 35 | // Type traits. | |
| 36 | ||
| 37 | template <class _From, class _To> | |
| 38 | struct __can_lower_copy_assignment_to_memmove { | |
| 39 | static const bool value = | |
| 40 | // If the types are always bitcastable, it's valid to do a bitwise copy between them. | |
| 41 | __is_always_bitcastable<_From, _To>::value && | |
| 42 | // Reject conversions that wouldn't be performed by the regular built-in assignment (e.g. between arrays). | |
| 43 | is_trivially_assignable<_To&, const _From&>::value && | |
| 44 | // `memmove` doesn't accept `volatile` pointers, make sure the optimization SFINAEs away in that case. | |
| 45 | !is_volatile<_From>::value && | |
| 46 | !is_volatile<_To>::value; | |
| 47 | }; | |
| 48 | ||
| 49 | template <class _From, class _To> | |
| 50 | struct __can_lower_move_assignment_to_memmove { | |
| 51 | static const bool value = | |
| 52 | __is_always_bitcastable<_From, _To>::value && | |
| 53 | is_trivially_assignable<_To&, _From&&>::value && | |
| 54 | !is_volatile<_From>::value && | |
| 55 | !is_volatile<_To>::value; | |
| 56 | }; | |
| 57 | ||
| 58 | // `memmove` algorithms implementation. | |
| 59 | ||
| 60 | template <class _In, class _Out> | |
| 61 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*> | |
| 62 | __copy_trivial_impl(_In* __first, _In* __last, _Out* __result) { | |
| 63 | const size_t __n = static_cast<size_t>(__last - __first); | |
| 64 | ::__builtin_memmove(__result, __first, __n * sizeof(_Out)); | |
| 65 | ||
| 66 | return std::make_pair(__last, __result + __n); | |
| 67 | } | |
| 68 | ||
| 69 | template <class _In, class _Out> | |
| 70 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*> | |
| 71 | __copy_backward_trivial_impl(_In* __first, _In* __last, _Out* __result) { | |
| 72 | const size_t __n = static_cast<size_t>(__last - __first); | |
| 73 | __result -= __n; | |
| 74 | ||
| 75 | ::__builtin_memmove(__result, __first, __n * sizeof(_Out)); | |
| 76 | ||
| 77 | return std::make_pair(__last, __result); | |
| 78 | } | |
| 79 | ||
| 80 | // Iterator unwrapping and dispatching to the correct overload. | |
| 81 | ||
| 82 | template <class _F1, class _F2> | |
| 83 | struct __overload : _F1, _F2 { | |
| 84 | using _F1::operator(); | |
| 85 | using _F2::operator(); | |
| 86 | }; | |
| 87 | ||
| 88 | template <class _InIter, class _Sent, class _OutIter, class = void> | |
| 89 | struct __can_rewrap : false_type {}; | |
| 90 | ||
| 91 | template <class _InIter, class _Sent, class _OutIter> | |
| 92 | struct __can_rewrap<_InIter, | |
| 93 | _Sent, | |
| 94 | _OutIter, | |
| 95 | // Note that sentinels are always copy-constructible. | |
| 96 | __enable_if_t< is_copy_constructible<_InIter>::value && | |
| 97 | is_copy_constructible<_OutIter>::value > > : true_type {}; | |
| 98 | ||
| 99 | template <class _Algorithm, | |
| 100 | class _InIter, | |
| 101 | class _Sent, | |
| 102 | class _OutIter, | |
| 103 | __enable_if_t<__can_rewrap<_InIter, _Sent, _OutIter>::value, int> = 0> | |
| 104 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter> | |
| 105 | __unwrap_and_dispatch(_InIter __first, _Sent __last, _OutIter __out_first) { | |
| 106 | auto __range = std::__unwrap_range(__first, std::move(__last)); | |
| 107 | auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first)); | |
| 108 | return std::make_pair(std::__rewrap_range<_Sent>(std::move(__first), std::move(__result.first)), | |
| 109 | std::__rewrap_iter(std::move(__out_first), std::move(__result.second))); | |
| 110 | } | |
| 111 | ||
| 112 | template <class _Algorithm, | |
| 113 | class _InIter, | |
| 114 | class _Sent, | |
| 115 | class _OutIter, | |
| 116 | __enable_if_t<!__can_rewrap<_InIter, _Sent, _OutIter>::value, int> = 0> | |
| 117 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter> | |
| 118 | __unwrap_and_dispatch(_InIter __first, _Sent __last, _OutIter __out_first) { | |
| 119 | return _Algorithm()(std::move(__first), std::move(__last), std::move(__out_first)); | |
| 120 | } | |
| 121 | ||
| 122 | template <class _IterOps, class _InValue, class _OutIter, class = void> | |
| 123 | struct __can_copy_without_conversion : false_type {}; | |
| 124 | ||
| 125 | template <class _IterOps, class _InValue, class _OutIter> | |
| 126 | struct __can_copy_without_conversion< | |
| 127 | _IterOps, | |
| 128 | _InValue, | |
| 129 | _OutIter, | |
| 130 | __enable_if_t<is_same<_InValue, typename _IterOps::template __value_type<_OutIter> >::value> > : true_type {}; | |
| 131 | ||
| 132 | template <class _AlgPolicy, | |
| 133 | class _NaiveAlgorithm, | |
| 134 | class _OptimizedAlgorithm, | |
| 135 | class _InIter, | |
| 136 | class _Sent, | |
| 137 | class _OutIter> | |
| 138 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter> | |
| 139 | __dispatch_copy_or_move(_InIter __first, _Sent __last, _OutIter __out_first) { | |
| 140 | #ifdef _LIBCPP_COMPILER_GCC | |
| 141 | // GCC doesn't support `__builtin_memmove` during constant evaluation. | |
| 142 | if (__libcpp_is_constant_evaluated()) { | |
| 143 | return std::__unwrap_and_dispatch<_NaiveAlgorithm>(std::move(__first), std::move(__last), std::move(__out_first)); | |
| 144 | } | |
| 145 | #else | |
| 146 | // In Clang, `__builtin_memmove` only supports fully trivially copyable types (just having trivial copy assignment is | |
| 147 | // insufficient). Also, conversions are not supported. | |
| 148 | if (__libcpp_is_constant_evaluated()) { | |
| 149 | using _InValue = typename _IterOps<_AlgPolicy>::template __value_type<_InIter>; | |
| 150 | if (!is_trivially_copyable<_InValue>::value || | |
| 151 | !__can_copy_without_conversion<_IterOps<_AlgPolicy>, _InValue, _OutIter>::value) { | |
| 152 | return std::__unwrap_and_dispatch<_NaiveAlgorithm>(std::move(__first), std::move(__last), std::move(__out_first)); | |
| 153 | } | |
| 154 | } | |
| 155 | #endif // _LIBCPP_COMPILER_GCC | |
| 156 | ||
| 157 | using _Algorithm = __overload<_NaiveAlgorithm, _OptimizedAlgorithm>; | |
| 158 | return std::__unwrap_and_dispatch<_Algorithm>(std::move(__first), std::move(__last), std::move(__out_first)); | |
| 159 | } | |
| 160 | ||
| 161 | _LIBCPP_END_NAMESPACE_STD | |
| 162 | ||
| 163 | #endif // _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H |
lib/libcxx/include/__algorithm/copy_n.h+3-2| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | #include <__algorithm/copy.h> |
| 13 | 13 | #include <__config> |
| 14 | 14 | #include <__iterator/iterator_traits.h> |
| 15 | #include <__utility/convert_to_integral.h> | |
| 15 | 16 | #include <type_traits> |
| 16 | 17 | |
| 17 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -21,7 +22,7 @@ |
| 21 | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 23 | |
| 23 | 24 | template<class _InputIterator, class _Size, class _OutputIterator> |
| 24 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 25 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 25 | 26 | typename enable_if |
| 26 | 27 | < |
| 27 | 28 | __is_cpp17_input_iterator<_InputIterator>::value && |
| ... | ... | @@ -47,7 +48,7 @@ copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) |
| 47 | 48 | } |
| 48 | 49 | |
| 49 | 50 | template<class _InputIterator, class _Size, class _OutputIterator> |
| 50 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 51 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 51 | 52 | typename enable_if |
| 52 | 53 | < |
| 53 | 54 | __is_cpp17_random_access_iterator<_InputIterator>::value, |
lib/libcxx/include/__algorithm/count.h+1-1| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | 22 | template <class _InputIterator, class _Tp> |
| 23 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 23 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 24 | 24 | typename iterator_traits<_InputIterator>::difference_type |
| 25 | 25 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) { |
| 26 | 26 | typename iterator_traits<_InputIterator>::difference_type __r(0); |
lib/libcxx/include/__algorithm/count_if.h+1-1| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | 22 | template <class _InputIterator, class _Predicate> |
| 23 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 23 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 24 | 24 | typename iterator_traits<_InputIterator>::difference_type |
| 25 | 25 | count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { |
| 26 | 26 | typename iterator_traits<_InputIterator>::difference_type __r(0); |
lib/libcxx/include/__algorithm/equal.h+15-14| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | |
| 24 | 24 | template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> |
| 25 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 25 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 26 | 26 | equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { |
| 27 | 27 | for (; __first1 != __last1; ++__first1, (void)++__first2) |
| 28 | 28 | if (!__pred(*__first1, *__first2)) |
| ... | ... | @@ -31,16 +31,14 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | template <class _InputIterator1, class _InputIterator2> |
| 34 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 34 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 35 | 35 | equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) { |
| 36 | typedef typename iterator_traits<_InputIterator1>::value_type __v1; | |
| 37 | typedef typename iterator_traits<_InputIterator2>::value_type __v2; | |
| 38 | return _VSTD::equal(__first1, __last1, __first2, __equal_to<__v1, __v2>()); | |
| 36 | return std::equal(__first1, __last1, __first2, __equal_to()); | |
| 39 | 37 | } |
| 40 | 38 | |
| 41 | 39 | #if _LIBCPP_STD_VER > 11 |
| 42 | 40 | template <class _BinaryPredicate, class _InputIterator1, class _InputIterator2> |
| 43 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 41 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 44 | 42 | __equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, |
| 45 | 43 | _BinaryPredicate __pred, input_iterator_tag, input_iterator_tag) { |
| 46 | 44 | for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void)++__first2) |
| ... | ... | @@ -50,7 +48,7 @@ __equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fir |
| 50 | 48 | } |
| 51 | 49 | |
| 52 | 50 | template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2> |
| 53 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 51 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 54 | 52 | __equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2, |
| 55 | 53 | _RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag, |
| 56 | 54 | random_access_iterator_tag) { |
| ... | ... | @@ -61,7 +59,7 @@ __equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _Random |
| 61 | 59 | } |
| 62 | 60 | |
| 63 | 61 | template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> |
| 64 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 62 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 65 | 63 | equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, |
| 66 | 64 | _BinaryPredicate __pred) { |
| 67 | 65 | return _VSTD::__equal<_BinaryPredicate&>( |
| ... | ... | @@ -70,13 +68,16 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first |
| 70 | 68 | } |
| 71 | 69 | |
| 72 | 70 | template <class _InputIterator1, class _InputIterator2> |
| 73 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 71 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 74 | 72 | equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { |
| 75 | typedef typename iterator_traits<_InputIterator1>::value_type __v1; | |
| 76 | typedef typename iterator_traits<_InputIterator2>::value_type __v2; | |
| 77 | return _VSTD::__equal(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>(), | |
| 78 | typename iterator_traits<_InputIterator1>::iterator_category(), | |
| 79 | typename iterator_traits<_InputIterator2>::iterator_category()); | |
| 73 | return std::__equal( | |
| 74 | __first1, | |
| 75 | __last1, | |
| 76 | __first2, | |
| 77 | __last2, | |
| 78 | __equal_to(), | |
| 79 | typename iterator_traits<_InputIterator1>::iterator_category(), | |
| 80 | typename iterator_traits<_InputIterator2>::iterator_category()); | |
| 80 | 81 | } |
| 81 | 82 | #endif |
| 82 | 83 |
lib/libcxx/include/__algorithm/equal_range.h+8-5| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 35 | 35 | |
| 36 | 36 | template <class _AlgPolicy, class _Compare, class _Iter, class _Sent, class _Tp, class _Proj> |
| 37 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_Iter, _Iter> | |
| 37 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter, _Iter> | |
| 38 | 38 | __equal_range(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp, _Proj&& __proj) { |
| 39 | 39 | auto __len = _IterOps<_AlgPolicy>::distance(__first, __last); |
| 40 | 40 | _Iter __end = _IterOps<_AlgPolicy>::next(__first, __last); |
| ... | ... | @@ -58,19 +58,22 @@ __equal_range(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | template <class _ForwardIterator, class _Tp, class _Compare> |
| 61 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator> | |
| 61 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator> | |
| 62 | 62 | equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) { |
| 63 | 63 | static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value, |
| 64 | 64 | "The comparator has to be callable"); |
| 65 | 65 | static_assert(is_copy_constructible<_ForwardIterator>::value, |
| 66 | 66 | "Iterator has to be copy constructible"); |
| 67 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 68 | 67 | return std::__equal_range<_ClassicAlgPolicy>( |
| 69 | std::move(__first), std::move(__last), __value, static_cast<_Comp_ref>(__comp), std::__identity()); | |
| 68 | std::move(__first), | |
| 69 | std::move(__last), | |
| 70 | __value, | |
| 71 | static_cast<__comp_ref_type<_Compare> >(__comp), | |
| 72 | std::__identity()); | |
| 70 | 73 | } |
| 71 | 74 | |
| 72 | 75 | template <class _ForwardIterator, class _Tp> |
| 73 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator> | |
| 76 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator> | |
| 74 | 77 | equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { |
| 75 | 78 | return std::equal_range( |
| 76 | 79 | std::move(__first), |
lib/libcxx/include/__algorithm/fill.h+3-3| ... | ... | @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | // fill isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset. |
| 24 | 24 | |
| 25 | 25 | template <class _ForwardIterator, class _Tp> |
| 26 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 26 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 27 | 27 | void |
| 28 | 28 | __fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag) |
| 29 | 29 | { |
| ... | ... | @@ -32,7 +32,7 @@ __fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, fo |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | template <class _RandomAccessIterator, class _Tp> |
| 35 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 35 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 36 | 36 | void |
| 37 | 37 | __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag) |
| 38 | 38 | { |
| ... | ... | @@ -40,7 +40,7 @@ __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& _ |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | template <class _ForwardIterator, class _Tp> |
| 43 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 43 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 44 | 44 | void |
| 45 | 45 | fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) |
| 46 | 46 | { |
lib/libcxx/include/__algorithm/fill_n.h+3-2| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__iterator/iterator_traits.h> |
| 14 | #include <__utility/convert_to_integral.h> | |
| 14 | 15 | #include <type_traits> |
| 15 | 16 | |
| 16 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -22,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 23 | // fill_n isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset. |
| 23 | 24 | |
| 24 | 25 | template <class _OutputIterator, class _Size, class _Tp> |
| 25 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 26 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 26 | 27 | _OutputIterator |
| 27 | 28 | __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) |
| 28 | 29 | { |
| ... | ... | @@ -32,7 +33,7 @@ __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) |
| 32 | 33 | } |
| 33 | 34 | |
| 34 | 35 | template <class _OutputIterator, class _Size, class _Tp> |
| 35 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 36 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 36 | 37 | _OutputIterator |
| 37 | 38 | fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) |
| 38 | 39 | { |
lib/libcxx/include/__algorithm/find.h+1-1| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _InputIterator, class _Tp> |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator | |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator | |
| 23 | 23 | find(_InputIterator __first, _InputIterator __last, const _Tp& __value) { |
| 24 | 24 | for (; __first != __last; ++__first) |
| 25 | 25 | if (*__first == __value) |
lib/libcxx/include/__algorithm/find_end.h+7-9| ... | ... | @@ -37,7 +37,7 @@ template < |
| 37 | 37 | class _Pred, |
| 38 | 38 | class _Proj1, |
| 39 | 39 | class _Proj2> |
| 40 | _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_Iter1, _Iter1> __find_end_impl( | |
| 40 | _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __find_end_impl( | |
| 41 | 41 | _Iter1 __first1, |
| 42 | 42 | _Sent1 __last1, |
| 43 | 43 | _Iter2 __first2, |
| ... | ... | @@ -91,7 +91,7 @@ template < |
| 91 | 91 | class _Sent2, |
| 92 | 92 | class _Proj1, |
| 93 | 93 | class _Proj2> |
| 94 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter1 __find_end( | |
| 94 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter1 __find_end( | |
| 95 | 95 | _Iter1 __first1, |
| 96 | 96 | _Sent1 __sent1, |
| 97 | 97 | _Iter2 __first2, |
| ... | ... | @@ -144,7 +144,7 @@ template < |
| 144 | 144 | class _Sent2, |
| 145 | 145 | class _Proj1, |
| 146 | 146 | class _Proj2> |
| 147 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _Iter1 __find_end( | |
| 147 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter1 __find_end( | |
| 148 | 148 | _Iter1 __first1, |
| 149 | 149 | _Sent1 __sent1, |
| 150 | 150 | _Iter2 __first2, |
| ... | ... | @@ -189,7 +189,7 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 _Iter1 __find_end( |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> |
| 192 | _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 192 | _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 193 | 193 | _ForwardIterator1 __find_end_classic(_ForwardIterator1 __first1, _ForwardIterator1 __last1, |
| 194 | 194 | _ForwardIterator2 __first2, _ForwardIterator2 __last2, |
| 195 | 195 | _BinaryPredicate& __pred) { |
| ... | ... | @@ -208,7 +208,7 @@ _ForwardIterator1 __find_end_classic(_ForwardIterator1 __first1, _ForwardIterato |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> |
| 211 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 211 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 212 | 212 | _ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, |
| 213 | 213 | _ForwardIterator2 __first2, _ForwardIterator2 __last2, |
| 214 | 214 | _BinaryPredicate __pred) { |
| ... | ... | @@ -216,12 +216,10 @@ _ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1 |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | template <class _ForwardIterator1, class _ForwardIterator2> |
| 219 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 219 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 220 | 220 | _ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, |
| 221 | 221 | _ForwardIterator2 __first2, _ForwardIterator2 __last2) { |
| 222 | using __v1 = typename iterator_traits<_ForwardIterator1>::value_type; | |
| 223 | using __v2 = typename iterator_traits<_ForwardIterator2>::value_type; | |
| 224 | return std::find_end(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); | |
| 222 | return std::find_end(__first1, __last1, __first2, __last2, __equal_to()); | |
| 225 | 223 | } |
| 226 | 224 | |
| 227 | 225 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/find_first_of.h+5-6| ... | ... | @@ -21,7 +21,8 @@ |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> |
| 24 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator1 __find_first_of_ce(_ForwardIterator1 __first1, | |
| 24 | _LIBCPP_HIDE_FROM_ABI | |
| 25 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_first_of_ce(_ForwardIterator1 __first1, | |
| 25 | 26 | _ForwardIterator1 __last1, |
| 26 | 27 | _ForwardIterator2 __first2, |
| 27 | 28 | _ForwardIterator2 __last2, |
| ... | ... | @@ -34,18 +35,16 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator1 __find_first_of_ce(_ForwardItera |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> |
| 37 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 | |
| 38 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 | |
| 38 | 39 | find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, |
| 39 | 40 | _ForwardIterator2 __last2, _BinaryPredicate __pred) { |
| 40 | 41 | return _VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __pred); |
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | template <class _ForwardIterator1, class _ForwardIterator2> |
| 44 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 find_first_of( | |
| 45 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of( | |
| 45 | 46 | _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { |
| 46 | typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; | |
| 47 | typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; | |
| 48 | return _VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); | |
| 47 | return std::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to()); | |
| 49 | 48 | } |
| 50 | 49 | |
| 51 | 50 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/find_if.h+1-1| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _InputIterator, class _Predicate> |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator | |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator | |
| 23 | 23 | find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { |
| 24 | 24 | for (; __first != __last; ++__first) |
| 25 | 25 | if (__pred(*__first)) |
lib/libcxx/include/__algorithm/find_if_not.h+1-1| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _InputIterator, class _Predicate> |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator | |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator | |
| 23 | 23 | find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) { |
| 24 | 24 | for (; __first != __last; ++__first) |
| 25 | 25 | if (!__pred(*__first)) |
lib/libcxx/include/__algorithm/for_each.h+1-1| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _InputIterator, class _Function> |
| 22 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Function for_each(_InputIterator __first, | |
| 22 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _Function for_each(_InputIterator __first, | |
| 23 | 23 | _InputIterator __last, |
| 24 | 24 | _Function __f) { |
| 25 | 25 | for (; __first != __last; ++__first) |
lib/libcxx/include/__algorithm/for_each_n.h+2-1| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | #define _LIBCPP___ALGORITHM_FOR_EACH_N_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <__utility/convert_to_integral.h> | |
| 14 | 15 | #include <type_traits> |
| 15 | 16 | |
| 16 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -22,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 23 | #if _LIBCPP_STD_VER > 14 |
| 23 | 24 | |
| 24 | 25 | template <class _InputIterator, class _Size, class _Function> |
| 25 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator for_each_n(_InputIterator __first, | |
| 26 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator for_each_n(_InputIterator __first, | |
| 26 | 27 | _Size __orig_n, |
| 27 | 28 | _Function __f) { |
| 28 | 29 | typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize; |
lib/libcxx/include/__algorithm/generate.h+1-1| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | 20 | template <class _ForwardIterator, class _Generator> |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 22 | 22 | void |
| 23 | 23 | generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen) |
| 24 | 24 | { |
lib/libcxx/include/__algorithm/generate_n.h+2-1| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | #define _LIBCPP___ALGORITHM_GENERATE_N_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__utility/convert_to_integral.h> | |
| 13 | 14 | #include <type_traits> |
| 14 | 15 | |
| 15 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -19,7 +20,7 @@ |
| 19 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 21 | |
| 21 | 22 | template <class _OutputIterator, class _Size, class _Generator> |
| 22 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 23 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 23 | 24 | _OutputIterator |
| 24 | 25 | generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen) |
| 25 | 26 | { |
lib/libcxx/include/__algorithm/half_positive.h+1-1| ... | ... | @@ -29,7 +29,7 @@ typename enable_if |
| 29 | 29 | >::type |
| 30 | 30 | __half_positive(_Integral __value) |
| 31 | 31 | { |
| 32 | return static_cast<_Integral>(static_cast<typename make_unsigned<_Integral>::type>(__value) / 2); | |
| 32 | return static_cast<_Integral>(static_cast<__make_unsigned_t<_Integral> >(__value) / 2); | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | template <typename _Tp> |
lib/libcxx/include/__algorithm/in_found_result.h+2-2| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | # pragma GCC system_header |
| 19 | 19 | #endif |
| 20 | 20 | |
| 21 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 21 | #if _LIBCPP_STD_VER > 17 | |
| 22 | 22 | |
| 23 | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | |
| ... | ... | @@ -44,6 +44,6 @@ struct in_found_result { |
| 44 | 44 | |
| 45 | 45 | _LIBCPP_END_NAMESPACE_STD |
| 46 | 46 | |
| 47 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 47 | #endif // _LIBCPP_STD_VER > 17 | |
| 48 | 48 | |
| 49 | 49 | #endif // _LIBCPP___ALGORITHM_IN_FOUND_RESULT_H |
lib/libcxx/include/__algorithm/in_fun_result.h+2-2| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 23 | #if _LIBCPP_STD_VER > 17 | |
| 24 | 24 | |
| 25 | 25 | namespace ranges { |
| 26 | 26 | template <class _InIter1, class _Func1> |
| ... | ... | @@ -42,7 +42,7 @@ struct in_fun_result { |
| 42 | 42 | }; |
| 43 | 43 | } // namespace ranges |
| 44 | 44 | |
| 45 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 45 | #endif // _LIBCPP_STD_VER > 17 | |
| 46 | 46 | |
| 47 | 47 | _LIBCPP_END_NAMESPACE_STD |
| 48 | 48 |
lib/libcxx/include/__algorithm/in_in_out_result.h+2-2| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 23 | #if _LIBCPP_STD_VER > 17 | |
| 24 | 24 | |
| 25 | 25 | namespace ranges { |
| 26 | 26 | |
| ... | ... | @@ -49,7 +49,7 @@ struct in_in_out_result { |
| 49 | 49 | |
| 50 | 50 | } // namespace ranges |
| 51 | 51 | |
| 52 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 52 | #endif // _LIBCPP_STD_VER > 17 | |
| 53 | 53 | |
| 54 | 54 | _LIBCPP_END_NAMESPACE_STD |
| 55 | 55 |
lib/libcxx/include/__algorithm/in_in_result.h+2-2| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 23 | #if _LIBCPP_STD_VER > 17 | |
| 24 | 24 | |
| 25 | 25 | namespace ranges { |
| 26 | 26 | |
| ... | ... | @@ -46,7 +46,7 @@ struct in_in_result { |
| 46 | 46 | |
| 47 | 47 | } // namespace ranges |
| 48 | 48 | |
| 49 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 49 | #endif // _LIBCPP_STD_VER > 17 | |
| 50 | 50 | |
| 51 | 51 | _LIBCPP_END_NAMESPACE_STD |
| 52 | 52 |
lib/libcxx/include/__algorithm/in_out_out_result.h+2-2| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 23 | #if _LIBCPP_STD_VER > 17 | |
| 24 | 24 | |
| 25 | 25 | namespace ranges { |
| 26 | 26 | template <class _InIter1, class _OutIter1, class _OutIter2> |
| ... | ... | @@ -47,7 +47,7 @@ struct in_out_out_result { |
| 47 | 47 | }; |
| 48 | 48 | } // namespace ranges |
| 49 | 49 | |
| 50 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 50 | #endif // _LIBCPP_STD_VER > 17 | |
| 51 | 51 | |
| 52 | 52 | _LIBCPP_END_NAMESPACE_STD |
| 53 | 53 |
lib/libcxx/include/__algorithm/in_out_result.h+2-2| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 23 | #if _LIBCPP_STD_VER > 17 | |
| 24 | 24 | |
| 25 | 25 | namespace ranges { |
| 26 | 26 | |
| ... | ... | @@ -46,7 +46,7 @@ struct in_out_result { |
| 46 | 46 | |
| 47 | 47 | } // namespace ranges |
| 48 | 48 | |
| 49 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 49 | #endif // _LIBCPP_STD_VER > 17 | |
| 50 | 50 | |
| 51 | 51 | _LIBCPP_END_NAMESPACE_STD |
| 52 | 52 |
lib/libcxx/include/__algorithm/includes.h+10-6| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| 27 | 27 | template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Comp, class _Proj1, class _Proj2> |
| 28 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 28 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 29 | 29 | __includes(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, |
| 30 | 30 | _Comp&& __comp, _Proj1&& __proj1, _Proj2&& __proj2) { |
| 31 | 31 | for (; __first2 != __last2; ++__first1) { |
| ... | ... | @@ -39,7 +39,7 @@ __includes(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | template <class _InputIterator1, class _InputIterator2, class _Compare> |
| 42 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool includes( | |
| 42 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool includes( | |
| 43 | 43 | _InputIterator1 __first1, |
| 44 | 44 | _InputIterator1 __last1, |
| 45 | 45 | _InputIterator2 __first2, |
| ... | ... | @@ -48,14 +48,18 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| 48 | 48 | static_assert(__is_callable<_Compare, decltype(*__first1), decltype(*__first2)>::value, |
| 49 | 49 | "Comparator has to be callable"); |
| 50 | 50 | |
| 51 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 52 | 51 | return std::__includes( |
| 53 | std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), | |
| 54 | static_cast<_Comp_ref>(__comp), __identity(), __identity()); | |
| 52 | std::move(__first1), | |
| 53 | std::move(__last1), | |
| 54 | std::move(__first2), | |
| 55 | std::move(__last2), | |
| 56 | static_cast<__comp_ref_type<_Compare> >(__comp), | |
| 57 | __identity(), | |
| 58 | __identity()); | |
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | template <class _InputIterator1, class _InputIterator2> |
| 58 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 62 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 59 | 63 | includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { |
| 60 | 64 | return std::includes( |
| 61 | 65 | std::move(__first1), |
lib/libcxx/include/__algorithm/inplace_merge.h+8-3| ... | ... | @@ -23,7 +23,11 @@ |
| 23 | 23 | #include <__iterator/distance.h> |
| 24 | 24 | #include <__iterator/iterator_traits.h> |
| 25 | 25 | #include <__iterator/reverse_iterator.h> |
| 26 | #include <memory> | |
| 26 | #include <__memory/destruct_n.h> | |
| 27 | #include <__memory/temporary_buffer.h> | |
| 28 | #include <__memory/unique_ptr.h> | |
| 29 | #include <__utility/pair.h> | |
| 30 | #include <new> | |
| 27 | 31 | |
| 28 | 32 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 29 | 33 | # pragma GCC system_header |
| ... | ... | @@ -56,6 +60,7 @@ public: |
| 56 | 60 | |
| 57 | 61 | template <class _AlgPolicy, class _Compare, class _InputIterator1, class _Sent1, |
| 58 | 62 | class _InputIterator2, class _Sent2, class _OutputIterator> |
| 63 | _LIBCPP_HIDE_FROM_ABI | |
| 59 | 64 | void __half_inplace_merge(_InputIterator1 __first1, _Sent1 __last1, |
| 60 | 65 | _InputIterator2 __first2, _Sent2 __last2, |
| 61 | 66 | _OutputIterator __result, _Compare&& __comp) |
| ... | ... | @@ -83,6 +88,7 @@ void __half_inplace_merge(_InputIterator1 __first1, _Sent1 __last1, |
| 83 | 88 | } |
| 84 | 89 | |
| 85 | 90 | template <class _AlgPolicy, class _Compare, class _BidirectionalIterator> |
| 91 | _LIBCPP_HIDE_FROM_ABI | |
| 86 | 92 | void __buffered_inplace_merge( |
| 87 | 93 | _BidirectionalIterator __first, |
| 88 | 94 | _BidirectionalIterator __middle, |
| ... | ... | @@ -231,9 +237,8 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 231 | 237 | template <class _BidirectionalIterator, class _Compare> |
| 232 | 238 | inline _LIBCPP_HIDE_FROM_ABI void inplace_merge( |
| 233 | 239 | _BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Compare __comp) { |
| 234 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 235 | 240 | std::__inplace_merge<_ClassicAlgPolicy>( |
| 236 | std::move(__first), std::move(__middle), std::move(__last), static_cast<_Comp_ref>(__comp)); | |
| 241 | std::move(__first), std::move(__middle), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp)); | |
| 237 | 242 | } |
| 238 | 243 | |
| 239 | 244 | template <class _BidirectionalIterator> |
lib/libcxx/include/__algorithm/is_heap.h+3-4| ... | ... | @@ -23,17 +23,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | |
| 24 | 24 | template <class _RandomAccessIterator, class _Compare> |
| 25 | 25 | _LIBCPP_NODISCARD_EXT inline |
| 26 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 26 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 27 | 27 | bool |
| 28 | 28 | is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) |
| 29 | 29 | { |
| 30 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 31 | return std::__is_heap_until(__first, __last, static_cast<_Comp_ref>(__comp)) == __last; | |
| 30 | return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp)) == __last; | |
| 32 | 31 | } |
| 33 | 32 | |
| 34 | 33 | template<class _RandomAccessIterator> |
| 35 | 34 | _LIBCPP_NODISCARD_EXT inline |
| 36 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 35 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 37 | 36 | bool |
| 38 | 37 | is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) |
| 39 | 38 | { |
lib/libcxx/include/__algorithm/is_heap_until.h+4-5| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | template <class _Compare, class _RandomAccessIterator> |
| 24 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator | |
| 24 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator | |
| 25 | 25 | __is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) |
| 26 | 26 | { |
| 27 | 27 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; |
| ... | ... | @@ -48,15 +48,14 @@ __is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | template <class _RandomAccessIterator, class _Compare> |
| 51 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator | |
| 51 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator | |
| 52 | 52 | is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) |
| 53 | 53 | { |
| 54 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 55 | return std::__is_heap_until(__first, __last, static_cast<_Comp_ref>(__comp)); | |
| 54 | return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp)); | |
| 56 | 55 | } |
| 57 | 56 | |
| 58 | 57 | template<class _RandomAccessIterator> |
| 59 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator | |
| 58 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator | |
| 60 | 59 | is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) |
| 61 | 60 | { |
| 62 | 61 | return _VSTD::__is_heap_until(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); |
lib/libcxx/include/__algorithm/is_partitioned.h+1-1| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | 20 | template <class _InputIterator, class _Predicate> |
| 21 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 21 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 22 | 22 | is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred) |
| 23 | 23 | { |
| 24 | 24 | for (; __first != __last; ++__first) |
lib/libcxx/include/__algorithm/is_permutation.h+18-19| ... | ... | @@ -55,7 +55,7 @@ struct _ConstTimeDistance<_Iter1, _Iter1, _Iter2, _Iter2, __enable_if_t< |
| 55 | 55 | template <class _AlgPolicy, |
| 56 | 56 | class _Iter1, class _Sent1, class _Iter2, class _Sent2, |
| 57 | 57 | class _Proj1, class _Proj2, class _Pred> |
| 58 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 58 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 59 | 59 | __is_permutation_impl(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, |
| 60 | 60 | _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2) { |
| 61 | 61 | using _D1 = __iter_diff_t<_Iter1>; |
| ... | ... | @@ -94,7 +94,7 @@ __is_permutation_impl(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 _ |
| 94 | 94 | |
| 95 | 95 | // 2+1 iterators, predicate. Not used by range algorithms. |
| 96 | 96 | template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2, class _BinaryPredicate> |
| 97 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 97 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 98 | 98 | __is_permutation(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2, |
| 99 | 99 | _BinaryPredicate&& __pred) { |
| 100 | 100 | // Shorten sequences as much as possible by lopping of any equal prefix. |
| ... | ... | @@ -122,7 +122,7 @@ __is_permutation(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterato |
| 122 | 122 | template <class _AlgPolicy, |
| 123 | 123 | class _Iter1, class _Sent1, class _Iter2, class _Sent2, |
| 124 | 124 | class _Proj1, class _Proj2, class _Pred> |
| 125 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 125 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 126 | 126 | __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, |
| 127 | 127 | _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2, |
| 128 | 128 | /*_ConstTimeDistance=*/false_type) { |
| ... | ... | @@ -156,7 +156,7 @@ __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last |
| 156 | 156 | template <class _AlgPolicy, |
| 157 | 157 | class _Iter1, class _Sent1, class _Iter2, class _Sent2, |
| 158 | 158 | class _Proj1, class _Proj2, class _Pred> |
| 159 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 159 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 160 | 160 | __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, |
| 161 | 161 | _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2, |
| 162 | 162 | /*_ConstTimeDistance=*/true_type) { |
| ... | ... | @@ -172,7 +172,7 @@ __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last |
| 172 | 172 | template <class _AlgPolicy, |
| 173 | 173 | class _Iter1, class _Sent1, class _Iter2, class _Sent2, |
| 174 | 174 | class _Proj1, class _Proj2, class _Pred> |
| 175 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 175 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 176 | 176 | __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, |
| 177 | 177 | _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2) { |
| 178 | 178 | return std::__is_permutation<_AlgPolicy>( |
| ... | ... | @@ -185,7 +185,7 @@ __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last |
| 185 | 185 | |
| 186 | 186 | // 2+1 iterators, predicate |
| 187 | 187 | template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> |
| 188 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 188 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 189 | 189 | is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, |
| 190 | 190 | _BinaryPredicate __pred) { |
| 191 | 191 | static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value, |
| ... | ... | @@ -197,31 +197,30 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIt |
| 197 | 197 | |
| 198 | 198 | // 2+1 iterators |
| 199 | 199 | template <class _ForwardIterator1, class _ForwardIterator2> |
| 200 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 200 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 201 | 201 | is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) { |
| 202 | using __v1 = __iter_value_type<_ForwardIterator1>; | |
| 203 | using __v2 = __iter_value_type<_ForwardIterator2>; | |
| 204 | return std::is_permutation(__first1, __last1, __first2, __equal_to<__v1, __v2>()); | |
| 202 | return std::is_permutation(__first1, __last1, __first2, __equal_to()); | |
| 205 | 203 | } |
| 206 | 204 | |
| 207 | 205 | #if _LIBCPP_STD_VER > 11 |
| 208 | 206 | |
| 209 | 207 | // 2+2 iterators |
| 210 | 208 | template <class _ForwardIterator1, class _ForwardIterator2> |
| 211 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 212 | is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | |
| 213 | _ForwardIterator2 __last2) { | |
| 214 | using __v1 = __iter_value_type<_ForwardIterator1>; | |
| 215 | using __v2 = __iter_value_type<_ForwardIterator2>; | |
| 216 | ||
| 209 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation( | |
| 210 | _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { | |
| 217 | 211 | return std::__is_permutation<_ClassicAlgPolicy>( |
| 218 | std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), | |
| 219 | __equal_to<__v1, __v2>(), __identity(), __identity()); | |
| 212 | std::move(__first1), | |
| 213 | std::move(__last1), | |
| 214 | std::move(__first2), | |
| 215 | std::move(__last2), | |
| 216 | __equal_to(), | |
| 217 | __identity(), | |
| 218 | __identity()); | |
| 220 | 219 | } |
| 221 | 220 | |
| 222 | 221 | // 2+2 iterators, predicate |
| 223 | 222 | template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> |
| 224 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 223 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 225 | 224 | is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, |
| 226 | 225 | _ForwardIterator2 __last2, _BinaryPredicate __pred) { |
| 227 | 226 | static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value, |
lib/libcxx/include/__algorithm/is_sorted.h+3-4| ... | ... | @@ -23,17 +23,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | |
| 24 | 24 | template <class _ForwardIterator, class _Compare> |
| 25 | 25 | _LIBCPP_NODISCARD_EXT inline |
| 26 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 26 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 27 | 27 | bool |
| 28 | 28 | is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) |
| 29 | 29 | { |
| 30 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 31 | return _VSTD::__is_sorted_until<_Comp_ref>(__first, __last, __comp) == __last; | |
| 30 | return _VSTD::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp) == __last; | |
| 32 | 31 | } |
| 33 | 32 | |
| 34 | 33 | template<class _ForwardIterator> |
| 35 | 34 | _LIBCPP_NODISCARD_EXT inline |
| 36 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 35 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 37 | 36 | bool |
| 38 | 37 | is_sorted(_ForwardIterator __first, _ForwardIterator __last) |
| 39 | 38 | { |
lib/libcxx/include/__algorithm/is_sorted_until.h+4-5| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | template <class _Compare, class _ForwardIterator> |
| 24 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 24 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 25 | 25 | __is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) |
| 26 | 26 | { |
| 27 | 27 | if (__first != __last) |
| ... | ... | @@ -38,15 +38,14 @@ __is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __ |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | template <class _ForwardIterator, class _Compare> |
| 41 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 41 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 42 | 42 | is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) |
| 43 | 43 | { |
| 44 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 45 | return _VSTD::__is_sorted_until<_Comp_ref>(__first, __last, __comp); | |
| 44 | return _VSTD::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp); | |
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | template<class _ForwardIterator> |
| 49 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 48 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 50 | 49 | is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) |
| 51 | 50 | { |
| 52 | 51 | return _VSTD::is_sorted_until(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>()); |
lib/libcxx/include/__algorithm/iter_swap.h+2-2| ... | ... | @@ -20,10 +20,10 @@ |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | 22 | template <class _ForwardIterator1, class _ForwardIterator2> |
| 23 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void iter_swap(_ForwardIterator1 __a, | |
| 23 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void iter_swap(_ForwardIterator1 __a, | |
| 24 | 24 | _ForwardIterator2 __b) |
| 25 | 25 | // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b))) |
| 26 | _NOEXCEPT_(_NOEXCEPT_(swap(*declval<_ForwardIterator1>(), *declval<_ForwardIterator2>()))) { | |
| 26 | _NOEXCEPT_(_NOEXCEPT_(swap(*std::declval<_ForwardIterator1>(), *std::declval<_ForwardIterator2>()))) { | |
| 27 | 27 | swap(*__a, *__b); |
| 28 | 28 | } |
| 29 | 29 |
lib/libcxx/include/__algorithm/iterator_operations.h+20-17| ... | ... | @@ -21,10 +21,13 @@ |
| 21 | 21 | #include <__iterator/next.h> |
| 22 | 22 | #include <__iterator/prev.h> |
| 23 | 23 | #include <__iterator/readable_traits.h> |
| 24 | #include <__type_traits/enable_if.h> | |
| 25 | #include <__type_traits/is_reference.h> | |
| 26 | #include <__type_traits/is_same.h> | |
| 27 | #include <__type_traits/remove_cvref.h> | |
| 24 | 28 | #include <__utility/declval.h> |
| 25 | 29 | #include <__utility/forward.h> |
| 26 | 30 | #include <__utility/move.h> |
| 27 | #include <type_traits> | |
| 28 | 31 | |
| 29 | 32 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 30 | 33 | # pragma GCC system_header |
| ... | ... | @@ -34,7 +37,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 34 | 37 | |
| 35 | 38 | template <class _AlgPolicy> struct _IterOps; |
| 36 | 39 | |
| 37 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 40 | #if _LIBCPP_STD_VER > 17 | |
| 38 | 41 | struct _RangeAlgPolicy {}; |
| 39 | 42 | |
| 40 | 43 | template <> |
| ... | ... | @@ -76,14 +79,14 @@ struct _IterOps<_ClassicAlgPolicy> { |
| 76 | 79 | |
| 77 | 80 | // advance |
| 78 | 81 | template <class _Iter, class _Distance> |
| 79 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 82 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 80 | 83 | static void advance(_Iter& __iter, _Distance __count) { |
| 81 | 84 | std::advance(__iter, __count); |
| 82 | 85 | } |
| 83 | 86 | |
| 84 | 87 | // distance |
| 85 | 88 | template <class _Iter> |
| 86 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 89 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 87 | 90 | static typename iterator_traits<_Iter>::difference_type distance(_Iter __first, _Iter __last) { |
| 88 | 91 | return std::distance(__first, __last); |
| 89 | 92 | } |
| ... | ... | @@ -95,9 +98,9 @@ struct _IterOps<_ClassicAlgPolicy> { |
| 95 | 98 | using __move_t = decltype(std::move(*std::declval<_Iter&>())); |
| 96 | 99 | |
| 97 | 100 | template <class _Iter> |
| 98 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 101 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 99 | 102 | static void __validate_iter_reference() { |
| 100 | static_assert(is_same<__deref_t<_Iter>, typename iterator_traits<__uncvref_t<_Iter> >::reference>::value, | |
| 103 | static_assert(is_same<__deref_t<_Iter>, typename iterator_traits<__remove_cvref_t<_Iter> >::reference>::value, | |
| 101 | 104 | "It looks like your iterator's `iterator_traits<It>::reference` does not match the return type of " |
| 102 | 105 | "dereferencing the iterator, i.e., calling `*it`. This is undefined behavior according to [input.iterators] " |
| 103 | 106 | "and can lead to dangling reference issues at runtime, so we are flagging this."); |
| ... | ... | @@ -105,7 +108,7 @@ struct _IterOps<_ClassicAlgPolicy> { |
| 105 | 108 | |
| 106 | 109 | // iter_move |
| 107 | 110 | template <class _Iter> |
| 108 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 static | |
| 111 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static | |
| 109 | 112 | // If the result of dereferencing `_Iter` is a reference type, deduce the result of calling `std::move` on it. Note |
| 110 | 113 | // that the C++03 mode doesn't support `decltype(auto)` as the return type. |
| 111 | 114 | __enable_if_t< |
| ... | ... | @@ -118,7 +121,7 @@ struct _IterOps<_ClassicAlgPolicy> { |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | 123 | template <class _Iter> |
| 121 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 static | |
| 124 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static | |
| 122 | 125 | // If the result of dereferencing `_Iter` is a value type, deduce the return value of this function to also be a |
| 123 | 126 | // value -- otherwise, after `operator*` returns a temporary, this function would return a dangling reference to that |
| 124 | 127 | // temporary. Note that the C++03 mode doesn't support `auto` as the return type. |
| ... | ... | @@ -133,35 +136,35 @@ struct _IterOps<_ClassicAlgPolicy> { |
| 133 | 136 | |
| 134 | 137 | // iter_swap |
| 135 | 138 | template <class _Iter1, class _Iter2> |
| 136 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 139 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 137 | 140 | static void iter_swap(_Iter1&& __a, _Iter2&& __b) { |
| 138 | 141 | std::iter_swap(std::forward<_Iter1>(__a), std::forward<_Iter2>(__b)); |
| 139 | 142 | } |
| 140 | 143 | |
| 141 | 144 | // next |
| 142 | 145 | template <class _Iterator> |
| 143 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 146 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 144 | 147 | _Iterator next(_Iterator, _Iterator __last) { |
| 145 | 148 | return __last; |
| 146 | 149 | } |
| 147 | 150 | |
| 148 | 151 | template <class _Iter> |
| 149 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 150 | __uncvref_t<_Iter> next(_Iter&& __it, | |
| 151 | typename iterator_traits<__uncvref_t<_Iter> >::difference_type __n = 1) { | |
| 152 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 153 | __remove_cvref_t<_Iter> next(_Iter&& __it, | |
| 154 | typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) { | |
| 152 | 155 | return std::next(std::forward<_Iter>(__it), __n); |
| 153 | 156 | } |
| 154 | 157 | |
| 155 | 158 | // prev |
| 156 | 159 | template <class _Iter> |
| 157 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 158 | __uncvref_t<_Iter> prev(_Iter&& __iter, | |
| 159 | typename iterator_traits<__uncvref_t<_Iter> >::difference_type __n = 1) { | |
| 160 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 161 | __remove_cvref_t<_Iter> prev(_Iter&& __iter, | |
| 162 | typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) { | |
| 160 | 163 | return std::prev(std::forward<_Iter>(__iter), __n); |
| 161 | 164 | } |
| 162 | 165 | |
| 163 | 166 | template <class _Iter> |
| 164 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 167 | _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 165 | 168 | void __advance_to(_Iter& __first, _Iter __last) { |
| 166 | 169 | __first = __last; |
| 167 | 170 | } |
lib/libcxx/include/__algorithm/lexicographical_compare.h+4-5| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | template <class _Compare, class _InputIterator1, class _InputIterator2> |
| 24 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 24 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 25 | 25 | __lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, |
| 26 | 26 | _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) |
| 27 | 27 | { |
| ... | ... | @@ -37,18 +37,17 @@ __lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, |
| 37 | 37 | |
| 38 | 38 | template <class _InputIterator1, class _InputIterator2, class _Compare> |
| 39 | 39 | _LIBCPP_NODISCARD_EXT inline |
| 40 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 40 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 41 | 41 | bool |
| 42 | 42 | lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, |
| 43 | 43 | _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) |
| 44 | 44 | { |
| 45 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 46 | return _VSTD::__lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp); | |
| 45 | return _VSTD::__lexicographical_compare<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __comp); | |
| 47 | 46 | } |
| 48 | 47 | |
| 49 | 48 | template <class _InputIterator1, class _InputIterator2> |
| 50 | 49 | _LIBCPP_NODISCARD_EXT inline |
| 51 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 50 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 52 | 51 | bool |
| 53 | 52 | lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, |
| 54 | 53 | _InputIterator2 __first2, _InputIterator2 __last2) |
lib/libcxx/include/__algorithm/lower_bound.h+3-3| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| 31 | 31 | template <class _AlgPolicy, class _Iter, class _Sent, class _Type, class _Proj, class _Comp> |
| 32 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 32 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 33 | 33 | _Iter __lower_bound_impl(_Iter __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) { |
| 34 | 34 | auto __len = _IterOps<_AlgPolicy>::distance(__first, __last); |
| 35 | 35 | |
| ... | ... | @@ -48,7 +48,7 @@ _Iter __lower_bound_impl(_Iter __first, _Sent __last, const _Type& __value, _Com |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | template <class _ForwardIterator, class _Tp, class _Compare> |
| 51 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 51 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 52 | 52 | _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) { |
| 53 | 53 | static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value, |
| 54 | 54 | "The comparator has to be callable"); |
| ... | ... | @@ -57,7 +57,7 @@ _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | template <class _ForwardIterator, class _Tp> |
| 60 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 60 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 61 | 61 | _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { |
| 62 | 62 | return std::lower_bound(__first, __last, __value, |
| 63 | 63 | __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>()); |
lib/libcxx/include/__algorithm/make_heap.h+4-5| ... | ... | @@ -24,10 +24,9 @@ |
| 24 | 24 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | 25 | |
| 26 | 26 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> |
| 27 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 27 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 28 | 28 | void __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) { |
| 29 | using _CompRef = typename __comp_ref_type<_Compare>::type; | |
| 30 | _CompRef __comp_ref = __comp; | |
| 29 | __comp_ref_type<_Compare> __comp_ref = __comp; | |
| 31 | 30 | |
| 32 | 31 | using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type; |
| 33 | 32 | difference_type __n = __last - __first; |
| ... | ... | @@ -40,13 +39,13 @@ void __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _C |
| 40 | 39 | } |
| 41 | 40 | |
| 42 | 41 | template <class _RandomAccessIterator, class _Compare> |
| 43 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 42 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 44 | 43 | void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { |
| 45 | 44 | std::__make_heap<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp); |
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | template <class _RandomAccessIterator> |
| 49 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 48 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 50 | 49 | void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { |
| 51 | 50 | std::make_heap(std::move(__first), std::move(__last), |
| 52 | 51 | __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); |
lib/libcxx/include/__algorithm/make_projected.h+2-2| ... | ... | @@ -93,7 +93,7 @@ __make_projected(_Pred& __pred, _Proj&) { |
| 93 | 93 | |
| 94 | 94 | _LIBCPP_END_NAMESPACE_STD |
| 95 | 95 | |
| 96 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 96 | #if _LIBCPP_STD_VER > 17 | |
| 97 | 97 | |
| 98 | 98 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 99 | 99 | |
| ... | ... | @@ -121,6 +121,6 @@ decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __p |
| 121 | 121 | |
| 122 | 122 | _LIBCPP_END_NAMESPACE_STD |
| 123 | 123 | |
| 124 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 124 | #endif // _LIBCPP_STD_VER > 17 | |
| 125 | 125 | |
| 126 | 126 | #endif // _LIBCPP___ALGORITHM_MAKE_PROJECTED_H |
lib/libcxx/include/__algorithm/max.h+5-6| ... | ... | @@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| 27 | 27 | template <class _Tp, class _Compare> |
| 28 | 28 | _LIBCPP_NODISCARD_EXT inline |
| 29 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 29 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 30 | 30 | const _Tp& |
| 31 | 31 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) |
| 32 | 32 | { |
| ... | ... | @@ -35,7 +35,7 @@ max(const _Tp& __a, const _Tp& __b, _Compare __comp) |
| 35 | 35 | |
| 36 | 36 | template <class _Tp> |
| 37 | 37 | _LIBCPP_NODISCARD_EXT inline |
| 38 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 38 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 39 | 39 | const _Tp& |
| 40 | 40 | max(const _Tp& __a, const _Tp& __b) |
| 41 | 41 | { |
| ... | ... | @@ -46,17 +46,16 @@ max(const _Tp& __a, const _Tp& __b) |
| 46 | 46 | |
| 47 | 47 | template<class _Tp, class _Compare> |
| 48 | 48 | _LIBCPP_NODISCARD_EXT inline |
| 49 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 49 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 50 | 50 | _Tp |
| 51 | 51 | max(initializer_list<_Tp> __t, _Compare __comp) |
| 52 | 52 | { |
| 53 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 54 | return *_VSTD::__max_element<_Comp_ref>(__t.begin(), __t.end(), __comp); | |
| 53 | return *_VSTD::__max_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp); | |
| 55 | 54 | } |
| 56 | 55 | |
| 57 | 56 | template<class _Tp> |
| 58 | 57 | _LIBCPP_NODISCARD_EXT inline |
| 59 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 58 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 60 | 59 | _Tp |
| 61 | 60 | max(initializer_list<_Tp> __t) |
| 62 | 61 | { |
lib/libcxx/include/__algorithm/max_element.h+4-5| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | template <class _Compare, class _ForwardIterator> |
| 24 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator | |
| 24 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator | |
| 25 | 25 | __max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) |
| 26 | 26 | { |
| 27 | 27 | static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, |
| ... | ... | @@ -37,16 +37,15 @@ __max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | template <class _ForwardIterator, class _Compare> |
| 40 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator | |
| 40 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator | |
| 41 | 41 | max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) |
| 42 | 42 | { |
| 43 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 44 | return _VSTD::__max_element<_Comp_ref>(__first, __last, __comp); | |
| 43 | return _VSTD::__max_element<__comp_ref_type<_Compare> >(__first, __last, __comp); | |
| 45 | 44 | } |
| 46 | 45 | |
| 47 | 46 | |
| 48 | 47 | template <class _ForwardIterator> |
| 49 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator | |
| 48 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator | |
| 50 | 49 | max_element(_ForwardIterator __first, _ForwardIterator __last) |
| 51 | 50 | { |
| 52 | 51 | return _VSTD::max_element(__first, __last, |
lib/libcxx/include/__algorithm/merge.h+4-5| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | |
| 24 | 24 | template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 25 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 25 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 26 | 26 | _OutputIterator |
| 27 | 27 | __merge(_InputIterator1 __first1, _InputIterator1 __last1, |
| 28 | 28 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) |
| ... | ... | @@ -46,17 +46,16 @@ __merge(_InputIterator1 __first1, _InputIterator1 __last1, |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> |
| 49 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 49 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 50 | 50 | _OutputIterator |
| 51 | 51 | merge(_InputIterator1 __first1, _InputIterator1 __last1, |
| 52 | 52 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) |
| 53 | 53 | { |
| 54 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 55 | return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); | |
| 54 | return _VSTD::__merge<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __result, __comp); | |
| 56 | 55 | } |
| 57 | 56 | |
| 58 | 57 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 59 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 58 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 60 | 59 | _OutputIterator |
| 61 | 60 | merge(_InputIterator1 __first1, _InputIterator1 __last1, |
| 62 | 61 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) |
lib/libcxx/include/__algorithm/min.h+5-6| ... | ... | @@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| 27 | 27 | template <class _Tp, class _Compare> |
| 28 | 28 | _LIBCPP_NODISCARD_EXT inline |
| 29 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 29 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 30 | 30 | const _Tp& |
| 31 | 31 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) |
| 32 | 32 | { |
| ... | ... | @@ -35,7 +35,7 @@ min(const _Tp& __a, const _Tp& __b, _Compare __comp) |
| 35 | 35 | |
| 36 | 36 | template <class _Tp> |
| 37 | 37 | _LIBCPP_NODISCARD_EXT inline |
| 38 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 38 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 39 | 39 | const _Tp& |
| 40 | 40 | min(const _Tp& __a, const _Tp& __b) |
| 41 | 41 | { |
| ... | ... | @@ -46,17 +46,16 @@ min(const _Tp& __a, const _Tp& __b) |
| 46 | 46 | |
| 47 | 47 | template<class _Tp, class _Compare> |
| 48 | 48 | _LIBCPP_NODISCARD_EXT inline |
| 49 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 49 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 50 | 50 | _Tp |
| 51 | 51 | min(initializer_list<_Tp> __t, _Compare __comp) |
| 52 | 52 | { |
| 53 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 54 | return *_VSTD::__min_element<_Comp_ref>(__t.begin(), __t.end(), __comp); | |
| 53 | return *_VSTD::__min_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp); | |
| 55 | 54 | } |
| 56 | 55 | |
| 57 | 56 | template<class _Tp> |
| 58 | 57 | _LIBCPP_NODISCARD_EXT inline |
| 59 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 58 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 60 | 59 | _Tp |
| 61 | 60 | min(initializer_list<_Tp> __t) |
| 62 | 61 | { |
lib/libcxx/include/__algorithm/min_element.h+5-6| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| 27 | 27 | template <class _Comp, class _Iter, class _Sent, class _Proj> |
| 28 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 28 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 29 | 29 | _Iter __min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) { |
| 30 | 30 | if (__first == __last) |
| 31 | 31 | return __first; |
| ... | ... | @@ -39,14 +39,14 @@ _Iter __min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) { |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | template <class _Comp, class _Iter, class _Sent> |
| 42 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 42 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 43 | 43 | _Iter __min_element(_Iter __first, _Sent __last, _Comp __comp) { |
| 44 | 44 | auto __proj = __identity(); |
| 45 | 45 | return std::__min_element<_Comp>(std::move(__first), std::move(__last), __comp, __proj); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | template <class _ForwardIterator, class _Compare> |
| 49 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator | |
| 49 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator | |
| 50 | 50 | min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) |
| 51 | 51 | { |
| 52 | 52 | static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, |
| ... | ... | @@ -54,12 +54,11 @@ min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) |
| 54 | 54 | static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__first)>::value, |
| 55 | 55 | "The comparator has to be callable"); |
| 56 | 56 | |
| 57 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 58 | return std::__min_element<_Comp_ref>(std::move(__first), std::move(__last), __comp); | |
| 57 | return std::__min_element<__comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp); | |
| 59 | 58 | } |
| 60 | 59 | |
| 61 | 60 | template <class _ForwardIterator> |
| 62 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator | |
| 61 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator | |
| 63 | 62 | min_element(_ForwardIterator __first, _ForwardIterator __last) |
| 64 | 63 | { |
| 65 | 64 | return _VSTD::min_element(__first, __last, |
lib/libcxx/include/__algorithm/min_max_result.h+2-2| ... | ... | @@ -23,7 +23,7 @@ _LIBCPP_PUSH_MACROS |
| 23 | 23 | |
| 24 | 24 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | 25 | |
| 26 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 26 | #if _LIBCPP_STD_VER > 17 | |
| 27 | 27 | |
| 28 | 28 | namespace ranges { |
| 29 | 29 | |
| ... | ... | @@ -47,7 +47,7 @@ struct min_max_result { |
| 47 | 47 | |
| 48 | 48 | } // namespace ranges |
| 49 | 49 | |
| 50 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 50 | #endif // _LIBCPP_STD_VER > 17 | |
| 51 | 51 | |
| 52 | 52 | _LIBCPP_END_NAMESPACE_STD |
| 53 | 53 |
lib/libcxx/include/__algorithm/minmax.h+4-4| ... | ... | @@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | 25 | |
| 26 | 26 | template<class _Tp, class _Compare> |
| 27 | 27 | _LIBCPP_NODISCARD_EXT inline |
| 28 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 28 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 29 | 29 | pair<const _Tp&, const _Tp&> |
| 30 | 30 | minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) |
| 31 | 31 | { |
| ... | ... | @@ -35,7 +35,7 @@ minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) |
| 35 | 35 | |
| 36 | 36 | template<class _Tp> |
| 37 | 37 | _LIBCPP_NODISCARD_EXT inline |
| 38 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 38 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 39 | 39 | pair<const _Tp&, const _Tp&> |
| 40 | 40 | minmax(const _Tp& __a, const _Tp& __b) |
| 41 | 41 | { |
| ... | ... | @@ -45,7 +45,7 @@ minmax(const _Tp& __a, const _Tp& __b) |
| 45 | 45 | #ifndef _LIBCPP_CXX03_LANG |
| 46 | 46 | |
| 47 | 47 | template<class _Tp, class _Compare> |
| 48 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 48 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 49 | 49 | pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t, _Compare __comp) { |
| 50 | 50 | static_assert(__is_callable<_Compare, _Tp, _Tp>::value, "The comparator has to be callable"); |
| 51 | 51 | __identity __proj; |
| ... | ... | @@ -55,7 +55,7 @@ pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t, _Compare __comp) { |
| 55 | 55 | |
| 56 | 56 | template<class _Tp> |
| 57 | 57 | _LIBCPP_NODISCARD_EXT inline |
| 58 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 58 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 59 | 59 | pair<_Tp, _Tp> |
| 60 | 60 | minmax(initializer_list<_Tp> __t) |
| 61 | 61 | { |
lib/libcxx/include/__algorithm/minmax_element.h+4-4| ... | ... | @@ -32,14 +32,14 @@ public: |
| 32 | 32 | _MinmaxElementLessFunc(_Comp& __comp, _Proj& __proj) : __comp_(__comp), __proj_(__proj) {} |
| 33 | 33 | |
| 34 | 34 | template <class _Iter> |
| 35 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 35 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 36 | 36 | bool operator()(_Iter& __it1, _Iter& __it2) { |
| 37 | 37 | return std::__invoke(__comp_, std::__invoke(__proj_, *__it1), std::__invoke(__proj_, *__it2)); |
| 38 | 38 | } |
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | 41 | template <class _Iter, class _Sent, class _Proj, class _Comp> |
| 42 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 42 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 43 | 43 | pair<_Iter, _Iter> __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) { |
| 44 | 44 | auto __less = _MinmaxElementLessFunc<_Comp, _Proj>(__comp, __proj); |
| 45 | 45 | |
| ... | ... | @@ -79,7 +79,7 @@ pair<_Iter, _Iter> __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __c |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | template <class _ForwardIterator, class _Compare> |
| 82 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 82 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 83 | 83 | pair<_ForwardIterator, _ForwardIterator> |
| 84 | 84 | minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { |
| 85 | 85 | static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, |
| ... | ... | @@ -91,7 +91,7 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | template <class _ForwardIterator> |
| 94 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 94 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 95 | 95 | pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last) { |
| 96 | 96 | return std::minmax_element(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>()); |
| 97 | 97 | } |
lib/libcxx/include/__algorithm/mismatch.h+6-10| ... | ... | @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | |
| 24 | 24 | template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> |
| 25 | 25 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY |
| 26 | _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2> | |
| 26 | _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> | |
| 27 | 27 | mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { |
| 28 | 28 | for (; __first1 != __last1; ++__first1, (void)++__first2) |
| 29 | 29 | if (!__pred(*__first1, *__first2)) |
| ... | ... | @@ -33,17 +33,15 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY |
| 33 | 33 | |
| 34 | 34 | template <class _InputIterator1, class _InputIterator2> |
| 35 | 35 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY |
| 36 | _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2> | |
| 36 | _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> | |
| 37 | 37 | mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) { |
| 38 | typedef typename iterator_traits<_InputIterator1>::value_type __v1; | |
| 39 | typedef typename iterator_traits<_InputIterator2>::value_type __v2; | |
| 40 | return _VSTD::mismatch(__first1, __last1, __first2, __equal_to<__v1, __v2>()); | |
| 38 | return std::mismatch(__first1, __last1, __first2, __equal_to()); | |
| 41 | 39 | } |
| 42 | 40 | |
| 43 | 41 | #if _LIBCPP_STD_VER > 11 |
| 44 | 42 | template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> |
| 45 | 43 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY |
| 46 | _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2> | |
| 44 | _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> | |
| 47 | 45 | mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, |
| 48 | 46 | _BinaryPredicate __pred) { |
| 49 | 47 | for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void)++__first2) |
| ... | ... | @@ -54,11 +52,9 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY |
| 54 | 52 | |
| 55 | 53 | template <class _InputIterator1, class _InputIterator2> |
| 56 | 54 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY |
| 57 | _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2> | |
| 55 | _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> | |
| 58 | 56 | mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { |
| 59 | typedef typename iterator_traits<_InputIterator1>::value_type __v1; | |
| 60 | typedef typename iterator_traits<_InputIterator2>::value_type __v2; | |
| 61 | return _VSTD::mismatch(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); | |
| 57 | return std::mismatch(__first1, __last1, __first2, __last2, __equal_to()); | |
| 62 | 58 | } |
| 63 | 59 | #endif |
| 64 | 60 |
lib/libcxx/include/__algorithm/move.h+93-82| ... | ... | @@ -9,111 +9,122 @@ |
| 9 | 9 | #ifndef _LIBCPP___ALGORITHM_MOVE_H |
| 10 | 10 | #define _LIBCPP___ALGORITHM_MOVE_H |
| 11 | 11 | |
| 12 | #include <__algorithm/copy_move_common.h> | |
| 12 | 13 | #include <__algorithm/iterator_operations.h> |
| 13 | #include <__algorithm/unwrap_iter.h> | |
| 14 | #include <__algorithm/min.h> | |
| 14 | 15 | #include <__config> |
| 15 | #include <__iterator/iterator_traits.h> | |
| 16 | #include <__iterator/reverse_iterator.h> | |
| 16 | #include <__iterator/segmented_iterator.h> | |
| 17 | #include <__type_traits/common_type.h> | |
| 18 | #include <__type_traits/is_copy_constructible.h> | |
| 17 | 19 | #include <__utility/move.h> |
| 18 | 20 | #include <__utility/pair.h> |
| 19 | #include <cstring> | |
| 20 | #include <type_traits> | |
| 21 | 21 | |
| 22 | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | 23 | # pragma GCC system_header |
| 24 | 24 | #endif |
| 25 | 25 | |
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 26 | _LIBCPP_PUSH_MACROS | |
| 27 | #include <__undef_macros> | |
| 27 | 28 | |
| 28 | // move | |
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 29 | 30 | |
| 30 | 31 | template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter> |
| 31 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 32 | pair<_InIter, _OutIter> __move_impl(_InIter __first, _Sent __last, _OutIter __result) { | |
| 33 | while (__first != __last) { | |
| 34 | *__result = _IterOps<_AlgPolicy>::__iter_move(__first); | |
| 35 | ++__first; | |
| 36 | ++__result; | |
| 32 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 33 | __move(_InIter __first, _Sent __last, _OutIter __result); | |
| 34 | ||
| 35 | template <class _AlgPolicy> | |
| 36 | struct __move_loop { | |
| 37 | template <class _InIter, class _Sent, class _OutIter> | |
| 38 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 39 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { | |
| 40 | while (__first != __last) { | |
| 41 | *__result = _IterOps<_AlgPolicy>::__iter_move(__first); | |
| 42 | ++__first; | |
| 43 | ++__result; | |
| 44 | } | |
| 45 | return std::make_pair(std::move(__first), std::move(__result)); | |
| 37 | 46 | } |
| 38 | return std::make_pair(std::move(__first), std::move(__result)); | |
| 39 | } | |
| 40 | ||
| 41 | template <class _AlgPolicy, | |
| 42 | class _InType, | |
| 43 | class _OutType, | |
| 44 | class = __enable_if_t<is_same<typename remove_const<_InType>::type, _OutType>::value | |
| 45 | && is_trivially_move_assignable<_OutType>::value> > | |
| 46 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 47 | pair<_InType*, _OutType*> __move_impl(_InType* __first, _InType* __last, _OutType* __result) { | |
| 48 | if (__libcpp_is_constant_evaluated() | |
| 49 | // TODO: Remove this once GCC supports __builtin_memmove during constant evaluation | |
| 50 | #ifndef _LIBCPP_COMPILER_GCC | |
| 51 | && !is_trivially_copyable<_InType>::value | |
| 52 | #endif | |
| 53 | ) | |
| 54 | return std::__move_impl<_AlgPolicy, _InType*, _InType*, _OutType*>(__first, __last, __result); | |
| 55 | const size_t __n = static_cast<size_t>(__last - __first); | |
| 56 | ::__builtin_memmove(__result, __first, __n * sizeof(_OutType)); | |
| 57 | return std::make_pair(__first + __n, __result + __n); | |
| 58 | } | |
| 59 | 47 | |
| 60 | template <class> | |
| 61 | struct __is_trivially_move_assignable_unwrapped_impl : false_type {}; | |
| 62 | ||
| 63 | template <class _Type> | |
| 64 | struct __is_trivially_move_assignable_unwrapped_impl<_Type*> : is_trivially_move_assignable<_Type> {}; | |
| 65 | ||
| 66 | template <class _Iter> | |
| 67 | struct __is_trivially_move_assignable_unwrapped | |
| 68 | : __is_trivially_move_assignable_unwrapped_impl<decltype(std::__unwrap_iter<_Iter>(std::declval<_Iter>()))> {}; | |
| 69 | ||
| 70 | template <class _AlgPolicy, | |
| 71 | class _InIter, | |
| 72 | class _OutIter, | |
| 73 | __enable_if_t<is_same<typename remove_const<typename iterator_traits<_InIter>::value_type>::type, | |
| 74 | typename iterator_traits<_OutIter>::value_type>::value | |
| 75 | && __is_cpp17_contiguous_iterator<_InIter>::value | |
| 76 | && __is_cpp17_contiguous_iterator<_OutIter>::value | |
| 77 | && is_trivially_move_assignable<__iter_value_type<_OutIter> >::value, int> = 0> | |
| 78 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 79 | pair<reverse_iterator<_InIter>, reverse_iterator<_OutIter> > | |
| 80 | __move_impl(reverse_iterator<_InIter> __first, | |
| 81 | reverse_iterator<_InIter> __last, | |
| 82 | reverse_iterator<_OutIter> __result) { | |
| 83 | auto __first_base = std::__unwrap_iter(__first.base()); | |
| 84 | auto __last_base = std::__unwrap_iter(__last.base()); | |
| 85 | auto __result_base = std::__unwrap_iter(__result.base()); | |
| 86 | auto __result_first = __result_base - (__first_base - __last_base); | |
| 87 | std::__move_impl<_AlgPolicy>(__last_base, __first_base, __result_first); | |
| 88 | return std::make_pair(__last, reverse_iterator<_OutIter>(std::__rewrap_iter(__result.base(), __result_first))); | |
| 89 | } | |
| 48 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0> | |
| 49 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 50 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | |
| 51 | using _Traits = __segmented_iterator_traits<_InIter>; | |
| 52 | auto __sfirst = _Traits::__segment(__first); | |
| 53 | auto __slast = _Traits::__segment(__last); | |
| 54 | if (__sfirst == __slast) { | |
| 55 | auto __iters = std::__move<_AlgPolicy>(_Traits::__local(__first), _Traits::__local(__last), std::move(__result)); | |
| 56 | return std::make_pair(__last, std::move(__iters.second)); | |
| 57 | } | |
| 58 | ||
| 59 | __result = std::__move<_AlgPolicy>(_Traits::__local(__first), _Traits::__end(__sfirst), std::move(__result)).second; | |
| 60 | ++__sfirst; | |
| 61 | while (__sfirst != __slast) { | |
| 62 | __result = | |
| 63 | std::__move<_AlgPolicy>(_Traits::__begin(__sfirst), _Traits::__end(__sfirst), std::move(__result)).second; | |
| 64 | ++__sfirst; | |
| 65 | } | |
| 66 | __result = | |
| 67 | std::__move<_AlgPolicy>(_Traits::__begin(__sfirst), _Traits::__local(__last), std::move(__result)).second; | |
| 68 | return std::make_pair(__last, std::move(__result)); | |
| 69 | } | |
| 90 | 70 | |
| 91 | template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter> | |
| 92 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 93 | __enable_if_t<is_copy_constructible<_InIter>::value | |
| 94 | && is_copy_constructible<_Sent>::value | |
| 95 | && is_copy_constructible<_OutIter>::value, pair<_InIter, _OutIter> > | |
| 96 | __move(_InIter __first, _Sent __last, _OutIter __result) { | |
| 97 | auto __ret = std::__move_impl<_AlgPolicy>( | |
| 98 | std::__unwrap_iter(__first), std::__unwrap_iter(__last), std::__unwrap_iter(__result)); | |
| 99 | return std::make_pair(std::__rewrap_iter(__first, __ret.first), std::__rewrap_iter(__result, __ret.second)); | |
| 100 | } | |
| 71 | template <class _InIter, | |
| 72 | class _OutIter, | |
| 73 | __enable_if_t<__is_cpp17_random_access_iterator<_InIter>::value && | |
| 74 | !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value, | |
| 75 | int> = 0> | |
| 76 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 77 | operator()(_InIter __first, _InIter __last, _OutIter __result) { | |
| 78 | using _Traits = __segmented_iterator_traits<_OutIter>; | |
| 79 | using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type; | |
| 80 | ||
| 81 | if (__first == __last) | |
| 82 | return std::make_pair(std::move(__first), std::move(__result)); | |
| 83 | ||
| 84 | auto __local_first = _Traits::__local(__result); | |
| 85 | auto __segment_iterator = _Traits::__segment(__result); | |
| 86 | while (true) { | |
| 87 | auto __local_last = _Traits::__end(__segment_iterator); | |
| 88 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); | |
| 89 | auto __iters = std::__move<_AlgPolicy>(__first, __first + __size, __local_first); | |
| 90 | __first = std::move(__iters.first); | |
| 91 | ||
| 92 | if (__first == __last) | |
| 93 | return std::make_pair(std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.second))); | |
| 94 | ||
| 95 | __local_first = _Traits::__begin(++__segment_iterator); | |
| 96 | } | |
| 97 | } | |
| 98 | }; | |
| 99 | ||
| 100 | struct __move_trivial { | |
| 101 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. | |
| 102 | template <class _In, class _Out, | |
| 103 | __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0> | |
| 104 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*> | |
| 105 | operator()(_In* __first, _In* __last, _Out* __result) const { | |
| 106 | return std::__copy_trivial_impl(__first, __last, __result); | |
| 107 | } | |
| 108 | }; | |
| 101 | 109 | |
| 102 | 110 | template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter> |
| 103 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 104 | __enable_if_t<!is_copy_constructible<_InIter>::value | |
| 105 | || !is_copy_constructible<_Sent>::value | |
| 106 | || !is_copy_constructible<_OutIter>::value, pair<_InIter, _OutIter> > | |
| 111 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 107 | 112 | __move(_InIter __first, _Sent __last, _OutIter __result) { |
| 108 | return std::__move_impl<_AlgPolicy>(std::move(__first), std::move(__last), std::move(__result)); | |
| 113 | return std::__dispatch_copy_or_move<_AlgPolicy, __move_loop<_AlgPolicy>, __move_trivial>( | |
| 114 | std::move(__first), std::move(__last), std::move(__result)); | |
| 109 | 115 | } |
| 110 | 116 | |
| 111 | 117 | template <class _InputIterator, class _OutputIterator> |
| 112 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 113 | _OutputIterator move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { | |
| 114 | return std::__move<_ClassicAlgPolicy>(__first, __last, __result).second; | |
| 118 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | |
| 119 | move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { | |
| 120 | static_assert(is_copy_constructible<_InputIterator>::value, "Iterators has to be copy constructible."); | |
| 121 | static_assert(is_copy_constructible<_OutputIterator>::value, "The output iterator has to be copy constructible."); | |
| 122 | ||
| 123 | return std::__move<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second; | |
| 115 | 124 | } |
| 116 | 125 | |
| 117 | 126 | _LIBCPP_END_NAMESPACE_STD |
| 118 | 127 | |
| 128 | _LIBCPP_POP_MACROS | |
| 129 | ||
| 119 | 130 | #endif // _LIBCPP___ALGORITHM_MOVE_H |
lib/libcxx/include/__algorithm/move_backward.h+105-55| ... | ... | @@ -9,81 +9,131 @@ |
| 9 | 9 | #ifndef _LIBCPP___ALGORITHM_MOVE_BACKWARD_H |
| 10 | 10 | #define _LIBCPP___ALGORITHM_MOVE_BACKWARD_H |
| 11 | 11 | |
| 12 | #include <__algorithm/copy_move_common.h> | |
| 12 | 13 | #include <__algorithm/iterator_operations.h> |
| 13 | #include <__algorithm/unwrap_iter.h> | |
| 14 | #include <__algorithm/min.h> | |
| 14 | 15 | #include <__config> |
| 16 | #include <__iterator/segmented_iterator.h> | |
| 17 | #include <__type_traits/common_type.h> | |
| 18 | #include <__type_traits/is_copy_constructible.h> | |
| 15 | 19 | #include <__utility/move.h> |
| 16 | #include <cstring> | |
| 17 | #include <type_traits> | |
| 20 | #include <__utility/pair.h> | |
| 18 | 21 | |
| 19 | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | 23 | # pragma GCC system_header |
| 21 | 24 | #endif |
| 22 | 25 | |
| 26 | _LIBCPP_PUSH_MACROS | |
| 27 | #include <__undef_macros> | |
| 28 | ||
| 23 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 30 | |
| 25 | template <class _AlgPolicy, class _InputIterator, class _OutputIterator> | |
| 26 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 27 | _OutputIterator | |
| 28 | __move_backward_constexpr(_InputIterator __first, _InputIterator __last, _OutputIterator __result) | |
| 29 | { | |
| 30 | while (__first != __last) | |
| 31 | *--__result = _IterOps<_AlgPolicy>::__iter_move(--__last); | |
| 32 | return __result; | |
| 33 | } | |
| 31 | template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2> | |
| 32 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2> | |
| 33 | __move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result); | |
| 34 | 34 | |
| 35 | template <class _AlgPolicy, class _InputIterator, class _OutputIterator> | |
| 36 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 37 | _OutputIterator | |
| 38 | __move_backward_impl(_InputIterator __first, _InputIterator __last, _OutputIterator __result) | |
| 39 | { | |
| 40 | return _VSTD::__move_backward_constexpr<_AlgPolicy>(__first, __last, __result); | |
| 41 | } | |
| 35 | template <class _AlgPolicy> | |
| 36 | struct __move_backward_loop { | |
| 37 | template <class _InIter, class _Sent, class _OutIter> | |
| 38 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 39 | operator()(_InIter __first, _Sent __last, _OutIter __result) const { | |
| 40 | auto __last_iter = _IterOps<_AlgPolicy>::next(__first, __last); | |
| 41 | auto __original_last_iter = __last_iter; | |
| 42 | 42 | |
| 43 | template <class _AlgPolicy, class _Tp, class _Up> | |
| 44 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 45 | typename enable_if | |
| 46 | < | |
| 47 | is_same<typename remove_const<_Tp>::type, _Up>::value && | |
| 48 | is_trivially_move_assignable<_Up>::value, | |
| 49 | _Up* | |
| 50 | >::type | |
| 51 | __move_backward_impl(_Tp* __first, _Tp* __last, _Up* __result) | |
| 52 | { | |
| 53 | const size_t __n = static_cast<size_t>(__last - __first); | |
| 54 | if (__n > 0) | |
| 55 | { | |
| 56 | __result -= __n; | |
| 57 | _VSTD::memmove(__result, __first, __n * sizeof(_Up)); | |
| 43 | while (__first != __last_iter) { | |
| 44 | *--__result = _IterOps<_AlgPolicy>::__iter_move(--__last_iter); | |
| 58 | 45 | } |
| 59 | return __result; | |
| 60 | } | |
| 61 | 46 | |
| 62 | template <class _AlgPolicy, class _BidirectionalIterator1, class _BidirectionalIterator2> | |
| 63 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 64 | _BidirectionalIterator2 | |
| 65 | __move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, | |
| 66 | _BidirectionalIterator2 __result) | |
| 67 | { | |
| 68 | if (__libcpp_is_constant_evaluated()) { | |
| 69 | return _VSTD::__move_backward_constexpr<_AlgPolicy>(__first, __last, __result); | |
| 70 | } else { | |
| 71 | return _VSTD::__rewrap_iter(__result, | |
| 72 | _VSTD::__move_backward_impl<_AlgPolicy>(_VSTD::__unwrap_iter(__first), | |
| 73 | _VSTD::__unwrap_iter(__last), | |
| 74 | _VSTD::__unwrap_iter(__result))); | |
| 47 | return std::make_pair(std::move(__original_last_iter), std::move(__result)); | |
| 48 | } | |
| 49 | ||
| 50 | template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0> | |
| 51 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 52 | operator()(_InIter __first, _InIter __last, _OutIter __result) const { | |
| 53 | using _Traits = __segmented_iterator_traits<_InIter>; | |
| 54 | auto __sfirst = _Traits::__segment(__first); | |
| 55 | auto __slast = _Traits::__segment(__last); | |
| 56 | if (__sfirst == __slast) { | |
| 57 | auto __iters = | |
| 58 | std::__move_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__local(__last), std::move(__result)); | |
| 59 | return std::make_pair(__last, __iters.second); | |
| 60 | } | |
| 61 | ||
| 62 | __result = | |
| 63 | std::__move_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__local(__last), std::move(__result)) | |
| 64 | .second; | |
| 65 | --__slast; | |
| 66 | while (__sfirst != __slast) { | |
| 67 | __result = | |
| 68 | std::__move_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__end(__slast), std::move(__result)) | |
| 69 | .second; | |
| 70 | --__slast; | |
| 71 | } | |
| 72 | __result = std::__move_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__end(__slast), std::move(__result)) | |
| 73 | .second; | |
| 74 | return std::make_pair(__last, std::move(__result)); | |
| 75 | } | |
| 76 | ||
| 77 | template <class _InIter, | |
| 78 | class _OutIter, | |
| 79 | __enable_if_t<__is_cpp17_random_access_iterator<_InIter>::value && | |
| 80 | !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value, | |
| 81 | int> = 0> | |
| 82 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> | |
| 83 | operator()(_InIter __first, _InIter __last, _OutIter __result) { | |
| 84 | using _Traits = __segmented_iterator_traits<_OutIter>; | |
| 85 | using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type; | |
| 86 | ||
| 87 | // When the range contains no elements, __result might not be a valid iterator | |
| 88 | if (__first == __last) | |
| 89 | return std::make_pair(__first, __result); | |
| 90 | ||
| 91 | auto __orig_last = __last; | |
| 92 | ||
| 93 | auto __local_last = _Traits::__local(__result); | |
| 94 | auto __segment_iterator = _Traits::__segment(__result); | |
| 95 | while (true) { | |
| 96 | auto __local_first = _Traits::__begin(__segment_iterator); | |
| 97 | auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first); | |
| 98 | auto __iter = std::__move_backward<_AlgPolicy>(__last - __size, __last, __local_last).second; | |
| 99 | __last -= __size; | |
| 100 | ||
| 101 | if (__first == __last) | |
| 102 | return std::make_pair(std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter))); | |
| 103 | ||
| 104 | __local_last = _Traits::__end(--__segment_iterator); | |
| 75 | 105 | } |
| 106 | } | |
| 107 | }; | |
| 108 | ||
| 109 | struct __move_backward_trivial { | |
| 110 | // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer. | |
| 111 | template <class _In, class _Out, | |
| 112 | __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0> | |
| 113 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*> | |
| 114 | operator()(_In* __first, _In* __last, _Out* __result) const { | |
| 115 | return std::__copy_backward_trivial_impl(__first, __last, __result); | |
| 116 | } | |
| 117 | }; | |
| 118 | ||
| 119 | template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2> | |
| 120 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2> | |
| 121 | __move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) { | |
| 122 | static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value && | |
| 123 | std::is_copy_constructible<_BidirectionalIterator1>::value, "Iterators must be copy constructible."); | |
| 124 | ||
| 125 | return std::__dispatch_copy_or_move<_AlgPolicy, __move_backward_loop<_AlgPolicy>, __move_backward_trivial>( | |
| 126 | std::move(__first), std::move(__last), std::move(__result)); | |
| 76 | 127 | } |
| 77 | 128 | |
| 78 | 129 | template <class _BidirectionalIterator1, class _BidirectionalIterator2> |
| 79 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 80 | _BidirectionalIterator2 | |
| 81 | move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, | |
| 82 | _BidirectionalIterator2 __result) | |
| 83 | { | |
| 84 | return std::__move_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)); | |
| 130 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator2 | |
| 131 | move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) { | |
| 132 | return std::__move_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second; | |
| 85 | 133 | } |
| 86 | 134 | |
| 87 | 135 | _LIBCPP_END_NAMESPACE_STD |
| 88 | 136 | |
| 137 | _LIBCPP_POP_MACROS | |
| 138 | ||
| 89 | 139 | #endif // _LIBCPP___ALGORITHM_MOVE_BACKWARD_H |
lib/libcxx/include/__algorithm/next_permutation.h+4-6| ... | ... | @@ -25,8 +25,7 @@ |
| 25 | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| 27 | 27 | template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel> |
| 28 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 29 | pair<_BidirectionalIterator, bool> | |
| 28 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator, bool> | |
| 30 | 29 | __next_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp) |
| 31 | 30 | { |
| 32 | 31 | using _Result = pair<_BidirectionalIterator, bool>; |
| ... | ... | @@ -57,17 +56,16 @@ __next_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& |
| 57 | 56 | } |
| 58 | 57 | |
| 59 | 58 | template <class _BidirectionalIterator, class _Compare> |
| 60 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 59 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 61 | 60 | bool |
| 62 | 61 | next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) |
| 63 | 62 | { |
| 64 | using _Comp_ref = typename __comp_ref_type<_Compare>::type; | |
| 65 | 63 | return std::__next_permutation<_ClassicAlgPolicy>( |
| 66 | std::move(__first), std::move(__last), static_cast<_Comp_ref>(__comp)).second; | |
| 64 | std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp)).second; | |
| 67 | 65 | } |
| 68 | 66 | |
| 69 | 67 | template <class _BidirectionalIterator> |
| 70 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 68 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 71 | 69 | bool |
| 72 | 70 | next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) |
| 73 | 71 | { |
lib/libcxx/include/__algorithm/none_of.h+1-1| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _InputIterator, class _Predicate> |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 22 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 23 | 23 | none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { |
| 24 | 24 | for (; __first != __last; ++__first) |
| 25 | 25 | if (__pred(*__first)) |
lib/libcxx/include/__algorithm/nth_element.h+6-7| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 27 | |
| 28 | 28 | template<class _Compare, class _RandomAccessIterator> |
| 29 | _LIBCPP_CONSTEXPR_AFTER_CXX11 bool | |
| 29 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool | |
| 30 | 30 | __nth_element_find_guard(_RandomAccessIterator& __i, _RandomAccessIterator& __j, |
| 31 | 31 | _RandomAccessIterator __m, _Compare __comp) |
| 32 | 32 | { |
| ... | ... | @@ -42,7 +42,7 @@ __nth_element_find_guard(_RandomAccessIterator& __i, _RandomAccessIterator& __j, |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> |
| 45 | _LIBCPP_CONSTEXPR_AFTER_CXX11 void | |
| 45 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void | |
| 46 | 46 | __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp) |
| 47 | 47 | { |
| 48 | 48 | using _Ops = _IterOps<_AlgPolicy>; |
| ... | ... | @@ -223,7 +223,7 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | template <class _AlgPolicy, class _RandomAccessIterator, class _Compare> |
| 226 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 226 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 227 | 227 | void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, |
| 228 | 228 | _Compare& __comp) { |
| 229 | 229 | if (__nth == __last) |
| ... | ... | @@ -231,8 +231,7 @@ void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __n |
| 231 | 231 | |
| 232 | 232 | std::__debug_randomize_range<_AlgPolicy>(__first, __last); |
| 233 | 233 | |
| 234 | using _Comp_ref = typename __comp_ref_type<_Compare>::type; | |
| 235 | std::__nth_element<_AlgPolicy, _Comp_ref>(__first, __nth, __last, __comp); | |
| 234 | std::__nth_element<_AlgPolicy, __comp_ref_type<_Compare> >(__first, __nth, __last, __comp); | |
| 236 | 235 | |
| 237 | 236 | std::__debug_randomize_range<_AlgPolicy>(__first, __nth); |
| 238 | 237 | if (__nth != __last) { |
| ... | ... | @@ -241,14 +240,14 @@ void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __n |
| 241 | 240 | } |
| 242 | 241 | |
| 243 | 242 | template <class _RandomAccessIterator, class _Compare> |
| 244 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 243 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 245 | 244 | void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, |
| 246 | 245 | _Compare __comp) { |
| 247 | 246 | std::__nth_element_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__nth), std::move(__last), __comp); |
| 248 | 247 | } |
| 249 | 248 | |
| 250 | 249 | template <class _RandomAccessIterator> |
| 251 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 250 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 252 | 251 | void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last) { |
| 253 | 252 | std::nth_element(std::move(__first), std::move(__nth), std::move(__last), __less<typename |
| 254 | 253 | iterator_traits<_RandomAccessIterator>::value_type>()); |
lib/libcxx/include/__algorithm/partial_sort.h+6-7| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| 31 | 31 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel> |
| 32 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 32 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 33 | 33 | _RandomAccessIterator __partial_sort_impl( |
| 34 | 34 | _RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last, _Compare&& __comp) { |
| 35 | 35 | if (__first == __middle) { |
| ... | ... | @@ -47,7 +47,6 @@ _RandomAccessIterator __partial_sort_impl( |
| 47 | 47 | _IterOps<_AlgPolicy>::iter_swap(__i, __first); |
| 48 | 48 | std::__sift_down<_AlgPolicy>(__first, __comp, __len, __first); |
| 49 | 49 | } |
| 50 | ||
| 51 | 50 | } |
| 52 | 51 | std::__sort_heap<_AlgPolicy>(std::move(__first), std::move(__middle), __comp); |
| 53 | 52 | |
| ... | ... | @@ -55,7 +54,7 @@ _RandomAccessIterator __partial_sort_impl( |
| 55 | 54 | } |
| 56 | 55 | |
| 57 | 56 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel> |
| 58 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 57 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 59 | 58 | _RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last, |
| 60 | 59 | _Compare& __comp) { |
| 61 | 60 | if (__first == __middle) |
| ... | ... | @@ -63,8 +62,8 @@ _RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAcces |
| 63 | 62 | |
| 64 | 63 | std::__debug_randomize_range<_AlgPolicy>(__first, __last); |
| 65 | 64 | |
| 66 | using _Comp_ref = typename __comp_ref_type<_Compare>::type; | |
| 67 | auto __last_iter = std::__partial_sort_impl<_AlgPolicy>(__first, __middle, __last, static_cast<_Comp_ref>(__comp)); | |
| 65 | auto __last_iter = | |
| 66 | std::__partial_sort_impl<_AlgPolicy>(__first, __middle, __last, static_cast<__comp_ref_type<_Compare> >(__comp)); | |
| 68 | 67 | |
| 69 | 68 | std::__debug_randomize_range<_AlgPolicy>(__middle, __last); |
| 70 | 69 | |
| ... | ... | @@ -72,7 +71,7 @@ _RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAcces |
| 72 | 71 | } |
| 73 | 72 | |
| 74 | 73 | template <class _RandomAccessIterator, class _Compare> |
| 75 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 74 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 76 | 75 | void |
| 77 | 76 | partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, |
| 78 | 77 | _Compare __comp) |
| ... | ... | @@ -84,7 +83,7 @@ partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran |
| 84 | 83 | } |
| 85 | 84 | |
| 86 | 85 | template <class _RandomAccessIterator> |
| 87 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 86 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 88 | 87 | void |
| 89 | 88 | partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) |
| 90 | 89 | { |
lib/libcxx/include/__algorithm/partial_sort_copy.h+4-5| ... | ... | @@ -33,7 +33,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 33 | template <class _AlgPolicy, class _Compare, |
| 34 | 34 | class _InputIterator, class _Sentinel1, class _RandomAccessIterator, class _Sentinel2, |
| 35 | 35 | class _Proj1, class _Proj2> |
| 36 | _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator, _RandomAccessIterator> | |
| 36 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _RandomAccessIterator> | |
| 37 | 37 | __partial_sort_copy(_InputIterator __first, _Sentinel1 __last, |
| 38 | 38 | _RandomAccessIterator __result_first, _Sentinel2 __result_last, |
| 39 | 39 | _Compare&& __comp, _Proj1&& __proj1, _Proj2&& __proj2) |
| ... | ... | @@ -60,7 +60,7 @@ __partial_sort_copy(_InputIterator __first, _Sentinel1 __last, |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | template <class _InputIterator, class _RandomAccessIterator, class _Compare> |
| 63 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 63 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 64 | 64 | _RandomAccessIterator |
| 65 | 65 | partial_sort_copy(_InputIterator __first, _InputIterator __last, |
| 66 | 66 | _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp) |
| ... | ... | @@ -68,14 +68,13 @@ partial_sort_copy(_InputIterator __first, _InputIterator __last, |
| 68 | 68 | static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__result_first)>::value, |
| 69 | 69 | "Comparator has to be callable"); |
| 70 | 70 | |
| 71 | using _Comp_ref = typename __comp_ref_type<_Compare>::type; | |
| 72 | 71 | auto __result = std::__partial_sort_copy<_ClassicAlgPolicy>(__first, __last, __result_first, __result_last, |
| 73 | static_cast<_Comp_ref>(__comp), __identity(), __identity()); | |
| 72 | static_cast<__comp_ref_type<_Compare> >(__comp), __identity(), __identity()); | |
| 74 | 73 | return __result.second; |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | 76 | template <class _InputIterator, class _RandomAccessIterator> |
| 78 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 77 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 79 | 78 | _RandomAccessIterator |
| 80 | 79 | partial_sort_copy(_InputIterator __first, _InputIterator __last, |
| 81 | 80 | _RandomAccessIterator __result_first, _RandomAccessIterator __result_last) |
lib/libcxx/include/__algorithm/partition.h+5-5| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | |
| 25 | 25 | template <class _Predicate, class _AlgPolicy, class _ForwardIterator, class _Sentinel> |
| 26 | _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator> | |
| 26 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator> | |
| 27 | 27 | __partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred, forward_iterator_tag) |
| 28 | 28 | { |
| 29 | 29 | while (true) |
| ... | ... | @@ -48,7 +48,7 @@ __partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred, |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | template <class _Predicate, class _AlgPolicy, class _BidirectionalIterator, class _Sentinel> |
| 51 | _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_BidirectionalIterator, _BidirectionalIterator> | |
| 51 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator, _BidirectionalIterator> | |
| 52 | 52 | __partition_impl(_BidirectionalIterator __first, _Sentinel __sentinel, _Predicate __pred, |
| 53 | 53 | bidirectional_iterator_tag) |
| 54 | 54 | { |
| ... | ... | @@ -76,15 +76,15 @@ __partition_impl(_BidirectionalIterator __first, _Sentinel __sentinel, _Predicat |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | template <class _AlgPolicy, class _ForwardIterator, class _Sentinel, class _Predicate, class _IterCategory> |
| 79 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 79 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 80 | 80 | pair<_ForwardIterator, _ForwardIterator> __partition( |
| 81 | 81 | _ForwardIterator __first, _Sentinel __last, _Predicate&& __pred, _IterCategory __iter_category) { |
| 82 | return std::__partition_impl<__uncvref_t<_Predicate>&, _AlgPolicy>( | |
| 82 | return std::__partition_impl<__remove_cvref_t<_Predicate>&, _AlgPolicy>( | |
| 83 | 83 | std::move(__first), std::move(__last), __pred, __iter_category); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | template <class _ForwardIterator, class _Predicate> |
| 87 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 87 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 88 | 88 | _ForwardIterator |
| 89 | 89 | partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) |
| 90 | 90 | { |
lib/libcxx/include/__algorithm/partition_copy.h+1-1| ... | ... | @@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | 22 | template <class _InputIterator, class _OutputIterator1, |
| 23 | 23 | class _OutputIterator2, class _Predicate> |
| 24 | _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_OutputIterator1, _OutputIterator2> | |
| 24 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_OutputIterator1, _OutputIterator2> | |
| 25 | 25 | partition_copy(_InputIterator __first, _InputIterator __last, |
| 26 | 26 | _OutputIterator1 __out_true, _OutputIterator2 __out_false, |
| 27 | 27 | _Predicate __pred) |
lib/libcxx/include/__algorithm/partition_point.h+1-1| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | |
| 24 | 24 | template<class _ForwardIterator, class _Predicate> |
| 25 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 25 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 26 | 26 | partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) |
| 27 | 27 | { |
| 28 | 28 | typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; |
lib/libcxx/include/__algorithm/pop_heap.h+4-5| ... | ... | @@ -27,13 +27,12 @@ |
| 27 | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 28 | |
| 29 | 29 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> |
| 30 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 30 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 31 | 31 | void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp, |
| 32 | 32 | typename iterator_traits<_RandomAccessIterator>::difference_type __len) { |
| 33 | 33 | _LIBCPP_ASSERT(__len > 0, "The heap given to pop_heap must be non-empty"); |
| 34 | 34 | |
| 35 | using _CompRef = typename __comp_ref_type<_Compare>::type; | |
| 36 | _CompRef __comp_ref = __comp; | |
| 35 | __comp_ref_type<_Compare> __comp_ref = __comp; | |
| 37 | 36 | |
| 38 | 37 | using value_type = typename iterator_traits<_RandomAccessIterator>::value_type; |
| 39 | 38 | if (__len > 1) { |
| ... | ... | @@ -53,7 +52,7 @@ void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co |
| 53 | 52 | } |
| 54 | 53 | |
| 55 | 54 | template <class _RandomAccessIterator, class _Compare> |
| 56 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 55 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 57 | 56 | void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { |
| 58 | 57 | static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible."); |
| 59 | 58 | static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable."); |
| ... | ... | @@ -63,7 +62,7 @@ void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp |
| 63 | 62 | } |
| 64 | 63 | |
| 65 | 64 | template <class _RandomAccessIterator> |
| 66 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 65 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 67 | 66 | void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { |
| 68 | 67 | std::pop_heap(std::move(__first), std::move(__last), |
| 69 | 68 | __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); |
lib/libcxx/include/__algorithm/prev_permutation.h+4-5| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| 27 | 27 | template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel> |
| 28 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 28 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 29 | 29 | pair<_BidirectionalIterator, bool> |
| 30 | 30 | __prev_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp) |
| 31 | 31 | { |
| ... | ... | @@ -57,17 +57,16 @@ __prev_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | template <class _BidirectionalIterator, class _Compare> |
| 60 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 60 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 61 | 61 | bool |
| 62 | 62 | prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) |
| 63 | 63 | { |
| 64 | using _Comp_ref = typename __comp_ref_type<_Compare>::type; | |
| 65 | 64 | return std::__prev_permutation<_ClassicAlgPolicy>( |
| 66 | std::move(__first), std::move(__last), static_cast<_Comp_ref>(__comp)).second; | |
| 65 | std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp)).second; | |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | 68 | template <class _BidirectionalIterator> |
| 70 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 69 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 71 | 70 | bool |
| 72 | 71 | prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) |
| 73 | 72 | { |
lib/libcxx/include/__algorithm/push_heap.h+5-6| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | 25 | |
| 26 | 26 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> |
| 27 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 27 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 28 | 28 | void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp, |
| 29 | 29 | typename iterator_traits<_RandomAccessIterator>::difference_type __len) { |
| 30 | 30 | using value_type = typename iterator_traits<_RandomAccessIterator>::value_type; |
| ... | ... | @@ -50,15 +50,14 @@ void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | template <class _AlgPolicy, class _RandomAccessIterator, class _Compare> |
| 53 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 53 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 54 | 54 | void __push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) { |
| 55 | using _CompRef = typename __comp_ref_type<_Compare>::type; | |
| 56 | 55 | typename iterator_traits<_RandomAccessIterator>::difference_type __len = __last - __first; |
| 57 | std::__sift_up<_AlgPolicy, _CompRef>(std::move(__first), std::move(__last), __comp, __len); | |
| 56 | std::__sift_up<_AlgPolicy, __comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp, __len); | |
| 58 | 57 | } |
| 59 | 58 | |
| 60 | 59 | template <class _RandomAccessIterator, class _Compare> |
| 61 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 60 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 62 | 61 | void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { |
| 63 | 62 | static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible."); |
| 64 | 63 | static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable."); |
| ... | ... | @@ -67,7 +66,7 @@ void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | 68 | template <class _RandomAccessIterator> |
| 70 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 69 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 71 | 70 | void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { |
| 72 | 71 | std::push_heap(std::move(__first), std::move(__last), |
| 73 | 72 | __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); |
lib/libcxx/include/__algorithm/ranges_adjacent_find.h+4-4| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -50,7 +50,7 @@ struct __fn { |
| 50 | 50 | template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, |
| 51 | 51 | class _Proj = identity, |
| 52 | 52 | indirect_binary_predicate<projected<_Iter, _Proj>, projected<_Iter, _Proj>> _Pred = ranges::equal_to> |
| 53 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 53 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 54 | 54 | _Iter operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const { |
| 55 | 55 | return __adjacent_find_impl(std::move(__first), std::move(__last), __pred, __proj); |
| 56 | 56 | } |
| ... | ... | @@ -59,7 +59,7 @@ struct __fn { |
| 59 | 59 | class _Proj = identity, |
| 60 | 60 | indirect_binary_predicate<projected<iterator_t<_Range>, _Proj>, |
| 61 | 61 | projected<iterator_t<_Range>, _Proj>> _Pred = ranges::equal_to> |
| 62 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 62 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 63 | 63 | borrowed_iterator_t<_Range> operator()(_Range&& __range, _Pred __pred = {}, _Proj __proj = {}) const { |
| 64 | 64 | return __adjacent_find_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); |
| 65 | 65 | } |
| ... | ... | @@ -73,6 +73,6 @@ inline namespace __cpo { |
| 73 | 73 | |
| 74 | 74 | _LIBCPP_END_NAMESPACE_STD |
| 75 | 75 | |
| 76 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 76 | #endif // _LIBCPP_STD_VER > 17 | |
| 77 | 77 | |
| 78 | 78 | #endif // _LIBCPP___ALGORITHM_RANGES_ADJACENT_FIND_H |
lib/libcxx/include/__algorithm/ranges_all_of.h+4-4| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | # pragma GCC system_header |
| 23 | 23 | #endif |
| 24 | 24 | |
| 25 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 25 | #if _LIBCPP_STD_VER > 17 | |
| 26 | 26 | |
| 27 | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 28 | |
| ... | ... | @@ -42,14 +42,14 @@ struct __fn { |
| 42 | 42 | |
| 43 | 43 | template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, |
| 44 | 44 | indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> |
| 45 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 45 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 46 | 46 | bool operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const { |
| 47 | 47 | return __all_of_impl(std::move(__first), std::move(__last), __pred, __proj); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | template <input_range _Range, class _Proj = identity, |
| 51 | 51 | indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred> |
| 52 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 52 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 53 | 53 | bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const { |
| 54 | 54 | return __all_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); |
| 55 | 55 | } |
| ... | ... | @@ -63,6 +63,6 @@ inline namespace __cpo { |
| 63 | 63 | |
| 64 | 64 | _LIBCPP_END_NAMESPACE_STD |
| 65 | 65 | |
| 66 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 66 | #endif // _LIBCPP_STD_VER > 17 | |
| 67 | 67 | |
| 68 | 68 | #endif // _LIBCPP___ALGORITHM_RANGES_ALL_OF_H |
lib/libcxx/include/__algorithm/ranges_any_of.h+4-4| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | # pragma GCC system_header |
| 23 | 23 | #endif |
| 24 | 24 | |
| 25 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 25 | #if _LIBCPP_STD_VER > 17 | |
| 26 | 26 | |
| 27 | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 28 | |
| ... | ... | @@ -42,14 +42,14 @@ struct __fn { |
| 42 | 42 | |
| 43 | 43 | template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, |
| 44 | 44 | indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> |
| 45 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 45 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 46 | 46 | bool operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const { |
| 47 | 47 | return __any_of_impl(std::move(__first), std::move(__last), __pred, __proj); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | template <input_range _Range, class _Proj = identity, |
| 51 | 51 | indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred> |
| 52 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 52 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 53 | 53 | bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const { |
| 54 | 54 | return __any_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); |
| 55 | 55 | } |
| ... | ... | @@ -63,6 +63,6 @@ inline namespace __cpo { |
| 63 | 63 | |
| 64 | 64 | _LIBCPP_END_NAMESPACE_STD |
| 65 | 65 | |
| 66 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 66 | #endif // _LIBCPP_STD_VER > 17 | |
| 67 | 67 | |
| 68 | 68 | #endif // _LIBCPP___ALGORITHM_RANGES_ANY_OF_H |
lib/libcxx/include/__algorithm/ranges_binary_search.h+4-4| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -33,7 +33,7 @@ namespace __binary_search { |
| 33 | 33 | struct __fn { |
| 34 | 34 | template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity, |
| 35 | 35 | indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less> |
| 36 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 36 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 37 | 37 | bool operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const { |
| 38 | 38 | auto __ret = std::__lower_bound_impl<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj); |
| 39 | 39 | return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__first)); |
| ... | ... | @@ -41,7 +41,7 @@ struct __fn { |
| 41 | 41 | |
| 42 | 42 | template <forward_range _Range, class _Type, class _Proj = identity, |
| 43 | 43 | indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> |
| 44 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 44 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 45 | 45 | bool operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const { |
| 46 | 46 | auto __first = ranges::begin(__r); |
| 47 | 47 | auto __last = ranges::end(__r); |
| ... | ... | @@ -58,6 +58,6 @@ inline namespace __cpo { |
| 58 | 58 | |
| 59 | 59 | _LIBCPP_END_NAMESPACE_STD |
| 60 | 60 | |
| 61 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 61 | #endif // _LIBCPP_STD_VER > 17 | |
| 62 | 62 | |
| 63 | 63 | #endif // _LIBCPP___ALGORITHM_RANGES_BINARY_SEARCH_H |
lib/libcxx/include/__algorithm/ranges_clamp.h+3-3| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | # pragma GCC system_header |
| 23 | 23 | #endif |
| 24 | 24 | |
| 25 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 25 | #if _LIBCPP_STD_VER > 17 | |
| 26 | 26 | |
| 27 | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 28 | |
| ... | ... | @@ -33,7 +33,7 @@ struct __fn { |
| 33 | 33 | template <class _Type, |
| 34 | 34 | class _Proj = identity, |
| 35 | 35 | indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less> |
| 36 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 36 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 37 | 37 | const _Type& operator()(const _Type& __value, |
| 38 | 38 | const _Type& __low, |
| 39 | 39 | const _Type& __high, |
| ... | ... | @@ -60,6 +60,6 @@ inline namespace __cpo { |
| 60 | 60 | |
| 61 | 61 | _LIBCPP_END_NAMESPACE_STD |
| 62 | 62 | |
| 63 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 63 | #endif // _LIBCPP_STD_VER > 17 | |
| 64 | 64 | |
| 65 | 65 | #endif // _LIBCPP___ALGORITHM_RANGES_CLAMP_H |
lib/libcxx/include/__algorithm/ranges_copy.h+6-4| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__algorithm/copy.h> |
| 13 | 13 | #include <__algorithm/in_out_result.h> |
| 14 | #include <__algorithm/iterator_operations.h> | |
| 14 | 15 | #include <__config> |
| 15 | 16 | #include <__functional/identity.h> |
| 16 | 17 | #include <__iterator/concepts.h> |
| ... | ... | @@ -18,12 +19,13 @@ |
| 18 | 19 | #include <__ranges/concepts.h> |
| 19 | 20 | #include <__ranges/dangling.h> |
| 20 | 21 | #include <__utility/move.h> |
| 22 | #include <__utility/pair.h> | |
| 21 | 23 | |
| 22 | 24 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | 25 | # pragma GCC system_header |
| 24 | 26 | #endif |
| 25 | 27 | |
| 26 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 28 | #if _LIBCPP_STD_VER > 17 | |
| 27 | 29 | |
| 28 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 31 | |
| ... | ... | @@ -39,7 +41,7 @@ struct __fn { |
| 39 | 41 | requires indirectly_copyable<_InIter, _OutIter> |
| 40 | 42 | _LIBCPP_HIDE_FROM_ABI constexpr |
| 41 | 43 | copy_result<_InIter, _OutIter> operator()(_InIter __first, _Sent __last, _OutIter __result) const { |
| 42 | auto __ret = std::__copy(std::move(__first), std::move(__last), std::move(__result)); | |
| 44 | auto __ret = std::__copy<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)); | |
| 43 | 45 | return {std::move(__ret.first), std::move(__ret.second)}; |
| 44 | 46 | } |
| 45 | 47 | |
| ... | ... | @@ -47,7 +49,7 @@ struct __fn { |
| 47 | 49 | requires indirectly_copyable<iterator_t<_Range>, _OutIter> |
| 48 | 50 | _LIBCPP_HIDE_FROM_ABI constexpr |
| 49 | 51 | copy_result<borrowed_iterator_t<_Range>, _OutIter> operator()(_Range&& __r, _OutIter __result) const { |
| 50 | auto __ret = std::__copy(ranges::begin(__r), ranges::end(__r), std::move(__result)); | |
| 52 | auto __ret = std::__copy<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), std::move(__result)); | |
| 51 | 53 | return {std::move(__ret.first), std::move(__ret.second)}; |
| 52 | 54 | } |
| 53 | 55 | }; |
| ... | ... | @@ -60,6 +62,6 @@ inline namespace __cpo { |
| 60 | 62 | |
| 61 | 63 | _LIBCPP_END_NAMESPACE_STD |
| 62 | 64 | |
| 63 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 65 | #endif // _LIBCPP_STD_VER > 17 | |
| 64 | 66 | |
| 65 | 67 | #endif // _LIBCPP___ALGORITHM_RANGES_COPY_H |
lib/libcxx/include/__algorithm/ranges_copy_backward.h+2-3| ... | ... | @@ -14,7 +14,6 @@ |
| 14 | 14 | #include <__algorithm/iterator_operations.h> |
| 15 | 15 | #include <__config> |
| 16 | 16 | #include <__iterator/concepts.h> |
| 17 | #include <__iterator/reverse_iterator.h> | |
| 18 | 17 | #include <__ranges/access.h> |
| 19 | 18 | #include <__ranges/concepts.h> |
| 20 | 19 | #include <__ranges/dangling.h> |
| ... | ... | @@ -24,7 +23,7 @@ |
| 24 | 23 | # pragma GCC system_header |
| 25 | 24 | #endif |
| 26 | 25 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 26 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 27 | |
| 29 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 29 | |
| ... | ... | @@ -61,6 +60,6 @@ inline namespace __cpo { |
| 61 | 60 | |
| 62 | 61 | _LIBCPP_END_NAMESPACE_STD |
| 63 | 62 | |
| 64 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 63 | #endif // _LIBCPP_STD_VER > 17 | |
| 65 | 64 | |
| 66 | 65 | #endif // _LIBCPP___ALGORITHM_RANGES_COPY_BACKWARD_H |
lib/libcxx/include/__algorithm/ranges_copy_if.h+2-2| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -76,6 +76,6 @@ inline namespace __cpo { |
| 76 | 76 | |
| 77 | 77 | _LIBCPP_END_NAMESPACE_STD |
| 78 | 78 | |
| 79 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 79 | #endif // _LIBCPP_STD_VER > 17 | |
| 80 | 80 | |
| 81 | 81 | #endif // _LIBCPP___ALGORITHM_RANGES_COPY_IF_H |
lib/libcxx/include/__algorithm/ranges_copy_n.h+4-3| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__algorithm/copy.h> |
| 13 | 13 | #include <__algorithm/in_out_result.h> |
| 14 | #include <__algorithm/iterator_operations.h> | |
| 14 | 15 | #include <__algorithm/ranges_copy.h> |
| 15 | 16 | #include <__config> |
| 16 | 17 | #include <__functional/identity.h> |
| ... | ... | @@ -26,7 +27,7 @@ |
| 26 | 27 | |
| 27 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 29 | |
| 29 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 30 | 31 | |
| 31 | 32 | namespace ranges { |
| 32 | 33 | |
| ... | ... | @@ -51,7 +52,7 @@ struct __fn { |
| 51 | 52 | template <random_access_iterator _InIter, class _DiffType, random_access_iterator _OutIter> |
| 52 | 53 | _LIBCPP_HIDE_FROM_ABI constexpr static |
| 53 | 54 | copy_n_result<_InIter, _OutIter> __go(_InIter __first, _DiffType __n, _OutIter __result) { |
| 54 | auto __ret = std::__copy(__first, __first + __n, __result); | |
| 55 | auto __ret = std::__copy<_RangeAlgPolicy>(__first, __first + __n, __result); | |
| 55 | 56 | return {__ret.first, __ret.second}; |
| 56 | 57 | } |
| 57 | 58 | |
| ... | ... | @@ -69,7 +70,7 @@ inline namespace __cpo { |
| 69 | 70 | } // namespace __cpo |
| 70 | 71 | } // namespace ranges |
| 71 | 72 | |
| 72 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 73 | #endif // _LIBCPP_STD_VER > 17 | |
| 73 | 74 | |
| 74 | 75 | _LIBCPP_END_NAMESPACE_STD |
| 75 | 76 |
lib/libcxx/include/__algorithm/ranges_count.h+4-4| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | # pragma GCC system_header |
| 26 | 26 | #endif |
| 27 | 27 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 28 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 31 | |
| ... | ... | @@ -34,7 +34,7 @@ namespace __count { |
| 34 | 34 | struct __fn { |
| 35 | 35 | template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity> |
| 36 | 36 | requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*> |
| 37 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 37 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 38 | 38 | iter_difference_t<_Iter> operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) const { |
| 39 | 39 | auto __pred = [&](auto&& __e) { return __e == __value; }; |
| 40 | 40 | return ranges::__count_if_impl(std::move(__first), std::move(__last), __pred, __proj); |
| ... | ... | @@ -42,7 +42,7 @@ struct __fn { |
| 42 | 42 | |
| 43 | 43 | template <input_range _Range, class _Type, class _Proj = identity> |
| 44 | 44 | requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*> |
| 45 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 45 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 46 | 46 | range_difference_t<_Range> operator()(_Range&& __r, const _Type& __value, _Proj __proj = {}) const { |
| 47 | 47 | auto __pred = [&](auto&& __e) { return __e == __value; }; |
| 48 | 48 | return ranges::__count_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj); |
| ... | ... | @@ -57,6 +57,6 @@ inline namespace __cpo { |
| 57 | 57 | |
| 58 | 58 | _LIBCPP_END_NAMESPACE_STD |
| 59 | 59 | |
| 60 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 60 | #endif // _LIBCPP_STD_VER > 17 | |
| 61 | 61 | |
| 62 | 62 | #endif // _LIBCPP___ALGORITHM_RANGES_COUNT_H |
lib/libcxx/include/__algorithm/ranges_count_if.h+4-4| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | # pragma GCC system_header |
| 26 | 26 | #endif |
| 27 | 27 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 28 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 31 | |
| ... | ... | @@ -46,14 +46,14 @@ namespace __count_if { |
| 46 | 46 | struct __fn { |
| 47 | 47 | template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, |
| 48 | 48 | indirect_unary_predicate<projected<_Iter, _Proj>> _Predicate> |
| 49 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 49 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 50 | 50 | iter_difference_t<_Iter> operator()(_Iter __first, _Sent __last, _Predicate __pred, _Proj __proj = {}) const { |
| 51 | 51 | return ranges::__count_if_impl(std::move(__first), std::move(__last), __pred, __proj); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | template <input_range _Range, class _Proj = identity, |
| 55 | 55 | indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Predicate> |
| 56 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 56 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 57 | 57 | range_difference_t<_Range> operator()(_Range&& __r, _Predicate __pred, _Proj __proj = {}) const { |
| 58 | 58 | return ranges::__count_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj); |
| 59 | 59 | } |
| ... | ... | @@ -67,6 +67,6 @@ inline namespace __cpo { |
| 67 | 67 | |
| 68 | 68 | _LIBCPP_END_NAMESPACE_STD |
| 69 | 69 | |
| 70 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 70 | #endif // _LIBCPP_STD_VER > 17 | |
| 71 | 71 | |
| 72 | 72 | #endif // _LIBCPP___ALGORITHM_RANGES_COUNT_IF_H |
lib/libcxx/include/__algorithm/ranges_equal.h+4-4| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -60,7 +60,7 @@ public: |
| 60 | 60 | class _Proj1 = identity, |
| 61 | 61 | class _Proj2 = identity> |
| 62 | 62 | requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2> |
| 63 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 63 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 64 | 64 | bool operator()(_Iter1 __first1, _Sent1 __last1, |
| 65 | 65 | _Iter2 __first2, _Sent2 __last2, |
| 66 | 66 | _Pred __pred = {}, |
| ... | ... | @@ -83,7 +83,7 @@ public: |
| 83 | 83 | class _Proj1 = identity, |
| 84 | 84 | class _Proj2 = identity> |
| 85 | 85 | requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> |
| 86 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 86 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 87 | 87 | bool operator()(_Range1&& __range1, |
| 88 | 88 | _Range2&& __range2, |
| 89 | 89 | _Pred __pred = {}, |
| ... | ... | @@ -110,6 +110,6 @@ inline namespace __cpo { |
| 110 | 110 | |
| 111 | 111 | _LIBCPP_END_NAMESPACE_STD |
| 112 | 112 | |
| 113 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 113 | #endif // _LIBCPP_STD_VER > 17 | |
| 114 | 114 | |
| 115 | 115 | #endif // _LIBCPP___ALGORITHM_RANGES_EQUAL_H |
lib/libcxx/include/__algorithm/ranges_equal_range.h+5-4| ... | ... | @@ -24,12 +24,13 @@ |
| 24 | 24 | #include <__ranges/subrange.h> |
| 25 | 25 | #include <__utility/forward.h> |
| 26 | 26 | #include <__utility/move.h> |
| 27 | #include <__utility/pair.h> | |
| 27 | 28 | |
| 28 | 29 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 29 | 30 | # pragma GCC system_header |
| 30 | 31 | #endif |
| 31 | 32 | |
| 32 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 33 | #if _LIBCPP_STD_VER > 17 | |
| 33 | 34 | |
| 34 | 35 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 35 | 36 | |
| ... | ... | @@ -43,7 +44,7 @@ struct __fn { |
| 43 | 44 | class _Tp, |
| 44 | 45 | class _Proj = identity, |
| 45 | 46 | indirect_strict_weak_order<const _Tp*, projected<_Iter, _Proj>> _Comp = ranges::less> |
| 46 | _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter> | |
| 47 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter> | |
| 47 | 48 | operator()(_Iter __first, _Sent __last, const _Tp& __value, _Comp __comp = {}, _Proj __proj = {}) const { |
| 48 | 49 | auto __ret = std::__equal_range<_RangeAlgPolicy>( |
| 49 | 50 | std::move(__first), std::move(__last), __value, __comp, __proj); |
| ... | ... | @@ -55,7 +56,7 @@ struct __fn { |
| 55 | 56 | class _Tp, |
| 56 | 57 | class _Proj = identity, |
| 57 | 58 | indirect_strict_weak_order<const _Tp*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> |
| 58 | _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range> | |
| 59 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range> | |
| 59 | 60 | operator()(_Range&& __range, const _Tp& __value, _Comp __comp = {}, _Proj __proj = {}) const { |
| 60 | 61 | auto __ret = std::__equal_range<_RangeAlgPolicy>( |
| 61 | 62 | ranges::begin(__range), ranges::end(__range), __value, __comp, __proj); |
| ... | ... | @@ -72,6 +73,6 @@ inline namespace __cpo { |
| 72 | 73 | |
| 73 | 74 | _LIBCPP_END_NAMESPACE_STD |
| 74 | 75 | |
| 75 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 76 | #endif // _LIBCPP_STD_VER > 17 | |
| 76 | 77 | |
| 77 | 78 | #endif // _LIBCPP___ALGORITHM_RANGES_EQUAL_RANGE_H |
lib/libcxx/include/__algorithm/ranges_fill.h+2-2| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | # pragma GCC system_header |
| 21 | 21 | #endif |
| 22 | 22 | |
| 23 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 23 | #if _LIBCPP_STD_VER > 17 | |
| 24 | 24 | |
| 25 | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| ... | ... | @@ -54,6 +54,6 @@ inline namespace __cpo { |
| 54 | 54 | |
| 55 | 55 | _LIBCPP_END_NAMESPACE_STD |
| 56 | 56 | |
| 57 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 57 | #endif // _LIBCPP_STD_VER > 17 | |
| 58 | 58 | |
| 59 | 59 | #endif // _LIBCPP___ALGORITHM_RANGES_FILL_H |
lib/libcxx/include/__algorithm/ranges_fill_n.h+2-2| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | # pragma GCC system_header |
| 18 | 18 | #endif |
| 19 | 19 | |
| 20 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 20 | #if _LIBCPP_STD_VER > 17 | |
| 21 | 21 | |
| 22 | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | |
| ... | ... | @@ -43,6 +43,6 @@ inline namespace __cpo { |
| 43 | 43 | |
| 44 | 44 | _LIBCPP_END_NAMESPACE_STD |
| 45 | 45 | |
| 46 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 46 | #endif // _LIBCPP_STD_VER > 17 | |
| 47 | 47 | |
| 48 | 48 | #endif // _LIBCPP___ALGORITHM_RANGES_FILL_N_H |
lib/libcxx/include/__algorithm/ranges_find.h+4-4| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | # pragma GCC system_header |
| 27 | 27 | #endif |
| 28 | 28 | |
| 29 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 30 | 30 | |
| 31 | 31 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 32 | 32 | |
| ... | ... | @@ -35,7 +35,7 @@ namespace __find { |
| 35 | 35 | struct __fn { |
| 36 | 36 | template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, class _Proj = identity> |
| 37 | 37 | requires indirect_binary_predicate<ranges::equal_to, projected<_Ip, _Proj>, const _Tp*> |
| 38 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 38 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 39 | 39 | _Ip operator()(_Ip __first, _Sp __last, const _Tp& __value, _Proj __proj = {}) const { |
| 40 | 40 | auto __pred = [&](auto&& __e) { return std::forward<decltype(__e)>(__e) == __value; }; |
| 41 | 41 | return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj); |
| ... | ... | @@ -43,7 +43,7 @@ struct __fn { |
| 43 | 43 | |
| 44 | 44 | template <input_range _Rp, class _Tp, class _Proj = identity> |
| 45 | 45 | requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Rp>, _Proj>, const _Tp*> |
| 46 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 46 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 47 | 47 | borrowed_iterator_t<_Rp> operator()(_Rp&& __r, const _Tp& __value, _Proj __proj = {}) const { |
| 48 | 48 | auto __pred = [&](auto&& __e) { return std::forward<decltype(__e)>(__e) == __value; }; |
| 49 | 49 | return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj); |
| ... | ... | @@ -58,6 +58,6 @@ inline namespace __cpo { |
| 58 | 58 | |
| 59 | 59 | _LIBCPP_END_NAMESPACE_STD |
| 60 | 60 | |
| 61 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 61 | #endif // _LIBCPP_STD_VER > 17 | |
| 62 | 62 | |
| 63 | 63 | #endif // _LIBCPP___ALGORITHM_RANGES_FIND_H |
lib/libcxx/include/__algorithm/ranges_find_end.h+5-4| ... | ... | @@ -21,12 +21,13 @@ |
| 21 | 21 | #include <__ranges/access.h> |
| 22 | 22 | #include <__ranges/concepts.h> |
| 23 | 23 | #include <__ranges/subrange.h> |
| 24 | #include <__utility/pair.h> | |
| 24 | 25 | |
| 25 | 26 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 26 | 27 | # pragma GCC system_header |
| 27 | 28 | #endif |
| 28 | 29 | |
| 29 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 30 | 31 | |
| 31 | 32 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 32 | 33 | |
| ... | ... | @@ -39,7 +40,7 @@ struct __fn { |
| 39 | 40 | class _Proj1 = identity, |
| 40 | 41 | class _Proj2 = identity> |
| 41 | 42 | requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2> |
| 42 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 43 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 43 | 44 | subrange<_Iter1> operator()(_Iter1 __first1, _Sent1 __last1, |
| 44 | 45 | _Iter2 __first2, _Sent2 __last2, |
| 45 | 46 | _Pred __pred = {}, |
| ... | ... | @@ -64,7 +65,7 @@ struct __fn { |
| 64 | 65 | class _Proj1 = identity, |
| 65 | 66 | class _Proj2 = identity> |
| 66 | 67 | requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> |
| 67 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 68 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 68 | 69 | borrowed_subrange_t<_Range1> operator()(_Range1&& __range1, |
| 69 | 70 | _Range2&& __range2, |
| 70 | 71 | _Pred __pred = {}, |
| ... | ... | @@ -92,6 +93,6 @@ inline namespace __cpo { |
| 92 | 93 | |
| 93 | 94 | _LIBCPP_END_NAMESPACE_STD |
| 94 | 95 | |
| 95 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 96 | #endif // _LIBCPP_STD_VER > 17 | |
| 96 | 97 | |
| 97 | 98 | #endif // _LIBCPP___ALGORITHM_RANGES_FIND_END_H |
lib/libcxx/include/__algorithm/ranges_find_first_of.h+4-4| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -54,7 +54,7 @@ struct __fn { |
| 54 | 54 | class _Proj1 = identity, |
| 55 | 55 | class _Proj2 = identity> |
| 56 | 56 | requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2> |
| 57 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 57 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 58 | 58 | _Iter1 operator()(_Iter1 __first1, _Sent1 __last1, |
| 59 | 59 | _Iter2 __first2, _Sent2 __last2, |
| 60 | 60 | _Pred __pred = {}, |
| ... | ... | @@ -73,7 +73,7 @@ struct __fn { |
| 73 | 73 | class _Proj1 = identity, |
| 74 | 74 | class _Proj2 = identity> |
| 75 | 75 | requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> |
| 76 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 76 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 77 | 77 | borrowed_iterator_t<_Range1> operator()(_Range1&& __range1, |
| 78 | 78 | _Range2&& __range2, |
| 79 | 79 | _Pred __pred = {}, |
| ... | ... | @@ -96,6 +96,6 @@ inline namespace __cpo { |
| 96 | 96 | |
| 97 | 97 | _LIBCPP_END_NAMESPACE_STD |
| 98 | 98 | |
| 99 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 99 | #endif // _LIBCPP_STD_VER > 17 | |
| 100 | 100 | |
| 101 | 101 | #endif // _LIBCPP___ALGORITHM_RANGES_FIND_FIRST_OF_H |
lib/libcxx/include/__algorithm/ranges_find_if.h+4-4| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -45,14 +45,14 @@ struct __fn { |
| 45 | 45 | |
| 46 | 46 | template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, |
| 47 | 47 | indirect_unary_predicate<projected<_Ip, _Proj>> _Pred> |
| 48 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 48 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 49 | 49 | _Ip operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const { |
| 50 | 50 | return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | template <input_range _Rp, class _Proj = identity, |
| 54 | 54 | indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred> |
| 55 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 55 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 56 | 56 | borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const { |
| 57 | 57 | return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj); |
| 58 | 58 | } |
| ... | ... | @@ -66,6 +66,6 @@ inline namespace __cpo { |
| 66 | 66 | |
| 67 | 67 | _LIBCPP_END_NAMESPACE_STD |
| 68 | 68 | |
| 69 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 69 | #endif // _LIBCPP_STD_VER > 17 | |
| 70 | 70 | |
| 71 | 71 | #endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_H |
lib/libcxx/include/__algorithm/ranges_find_if_not.h+4-4| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | # pragma GCC system_header |
| 27 | 27 | #endif |
| 28 | 28 | |
| 29 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 30 | 30 | |
| 31 | 31 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 32 | 32 | |
| ... | ... | @@ -35,7 +35,7 @@ namespace __find_if_not { |
| 35 | 35 | struct __fn { |
| 36 | 36 | template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, |
| 37 | 37 | indirect_unary_predicate<projected<_Ip, _Proj>> _Pred> |
| 38 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 38 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 39 | 39 | _Ip operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const { |
| 40 | 40 | auto __pred2 = [&](auto&& __e) { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); }; |
| 41 | 41 | return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred2, __proj); |
| ... | ... | @@ -43,7 +43,7 @@ struct __fn { |
| 43 | 43 | |
| 44 | 44 | template <input_range _Rp, class _Proj = identity, |
| 45 | 45 | indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred> |
| 46 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 46 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 47 | 47 | borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const { |
| 48 | 48 | auto __pred2 = [&](auto&& __e) { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); }; |
| 49 | 49 | return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred2, __proj); |
| ... | ... | @@ -58,6 +58,6 @@ inline namespace __cpo { |
| 58 | 58 | |
| 59 | 59 | _LIBCPP_END_NAMESPACE_STD |
| 60 | 60 | |
| 61 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 61 | #endif // _LIBCPP_STD_VER > 17 | |
| 62 | 62 | |
| 63 | 63 | #endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H |
lib/libcxx/include/__algorithm/ranges_for_each.h+2-2| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -73,6 +73,6 @@ inline namespace __cpo { |
| 73 | 73 | |
| 74 | 74 | _LIBCPP_END_NAMESPACE_STD |
| 75 | 75 | |
| 76 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 76 | #endif // _LIBCPP_STD_VER > 17 | |
| 77 | 77 | |
| 78 | 78 | #endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_H |
lib/libcxx/include/__algorithm/ranges_for_each_n.h+2-2| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -61,6 +61,6 @@ inline namespace __cpo { |
| 61 | 61 | |
| 62 | 62 | _LIBCPP_END_NAMESPACE_STD |
| 63 | 63 | |
| 64 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 64 | #endif // _LIBCPP_STD_VER > 17 | |
| 65 | 65 | |
| 66 | 66 | #endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_N_H |
lib/libcxx/include/__algorithm/ranges_generate.h+2-2| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -68,6 +68,6 @@ inline namespace __cpo { |
| 68 | 68 | |
| 69 | 69 | _LIBCPP_END_NAMESPACE_STD |
| 70 | 70 | |
| 71 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 71 | #endif // _LIBCPP_STD_VER > 17 | |
| 72 | 72 | |
| 73 | 73 | #endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_H |
lib/libcxx/include/__algorithm/ranges_generate_n.h+2-2| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | # pragma GCC system_header |
| 26 | 26 | #endif |
| 27 | 27 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 28 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 31 | |
| ... | ... | @@ -57,6 +57,6 @@ inline namespace __cpo { |
| 57 | 57 | |
| 58 | 58 | _LIBCPP_END_NAMESPACE_STD |
| 59 | 59 | |
| 60 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 60 | #endif // _LIBCPP_STD_VER > 17 | |
| 61 | 61 | |
| 62 | 62 | #endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H |
lib/libcxx/include/__algorithm/ranges_includes.h+4-4| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | # pragma GCC system_header |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 31 | |
| 32 | 32 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 33 | |
| ... | ... | @@ -43,7 +43,7 @@ struct __fn { |
| 43 | 43 | class _Proj1 = identity, |
| 44 | 44 | class _Proj2 = identity, |
| 45 | 45 | indirect_strict_weak_order<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Comp = ranges::less> |
| 46 | _LIBCPP_HIDE_FROM_ABI constexpr bool operator()( | |
| 46 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()( | |
| 47 | 47 | _Iter1 __first1, |
| 48 | 48 | _Sent1 __last1, |
| 49 | 49 | _Iter2 __first2, |
| ... | ... | @@ -68,7 +68,7 @@ struct __fn { |
| 68 | 68 | class _Proj2 = identity, |
| 69 | 69 | indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>> |
| 70 | 70 | _Comp = ranges::less> |
| 71 | _LIBCPP_HIDE_FROM_ABI constexpr bool operator()( | |
| 71 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()( | |
| 72 | 72 | _Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { |
| 73 | 73 | return std::__includes( |
| 74 | 74 | ranges::begin(__range1), |
| ... | ... | @@ -90,6 +90,6 @@ inline namespace __cpo { |
| 90 | 90 | |
| 91 | 91 | _LIBCPP_END_NAMESPACE_STD |
| 92 | 92 | |
| 93 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 93 | #endif // _LIBCPP_STD_VER > 17 | |
| 94 | 94 | |
| 95 | 95 | #endif // _LIBCPP___ALGORITHM_RANGES_INCLUDES_H |
lib/libcxx/include/__algorithm/ranges_inplace_merge.h+2-2| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | # pragma GCC system_header |
| 32 | 32 | #endif |
| 33 | 33 | |
| 34 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 34 | #if _LIBCPP_STD_VER > 17 | |
| 35 | 35 | |
| 36 | 36 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 37 | 37 | |
| ... | ... | @@ -80,6 +80,6 @@ inline namespace __cpo { |
| 80 | 80 | |
| 81 | 81 | _LIBCPP_END_NAMESPACE_STD |
| 82 | 82 | |
| 83 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 83 | #endif // _LIBCPP_STD_VER > 17 | |
| 84 | 84 | |
| 85 | 85 | #endif // _LIBCPP___ALGORITHM_RANGES_INPLACE_MERGE_H |
lib/libcxx/include/__algorithm/ranges_is_heap.h+4-4| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | # pragma GCC system_header |
| 27 | 27 | #endif |
| 28 | 28 | |
| 29 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 30 | 30 | |
| 31 | 31 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 32 | 32 | |
| ... | ... | @@ -47,14 +47,14 @@ struct __fn { |
| 47 | 47 | |
| 48 | 48 | template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, |
| 49 | 49 | indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less> |
| 50 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 50 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 51 | 51 | bool operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const { |
| 52 | 52 | return __is_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | template <random_access_range _Range, class _Proj = identity, |
| 56 | 56 | indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> |
| 57 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 57 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 58 | 58 | bool operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const { |
| 59 | 59 | return __is_heap_fn_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj); |
| 60 | 60 | } |
| ... | ... | @@ -69,6 +69,6 @@ inline namespace __cpo { |
| 69 | 69 | |
| 70 | 70 | _LIBCPP_END_NAMESPACE_STD |
| 71 | 71 | |
| 72 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 72 | #endif // _LIBCPP_STD_VER > 17 | |
| 73 | 73 | |
| 74 | 74 | #endif // _LIBCPP___ALGORITHM_RANGES_IS_HEAP_H |
lib/libcxx/include/__algorithm/ranges_is_heap_until.h+4-4| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | # pragma GCC system_header |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 31 | |
| 32 | 32 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 33 | |
| ... | ... | @@ -47,14 +47,14 @@ struct __fn { |
| 47 | 47 | |
| 48 | 48 | template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, |
| 49 | 49 | indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less> |
| 50 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 50 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 51 | 51 | _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const { |
| 52 | 52 | return __is_heap_until_fn_impl(std::move(__first), std::move(__last), __comp, __proj); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | template <random_access_range _Range, class _Proj = identity, |
| 56 | 56 | indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> |
| 57 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 57 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 58 | 58 | borrowed_iterator_t<_Range> operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const { |
| 59 | 59 | return __is_heap_until_fn_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj); |
| 60 | 60 | } |
| ... | ... | @@ -70,6 +70,6 @@ inline namespace __cpo { |
| 70 | 70 | |
| 71 | 71 | _LIBCPP_END_NAMESPACE_STD |
| 72 | 72 | |
| 73 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 73 | #endif // _LIBCPP_STD_VER > 17 | |
| 74 | 74 | |
| 75 | 75 | #endif // _LIBCPP___ALGORITHM_RANGES_IS_HEAP_UNTIL_H |
lib/libcxx/include/__algorithm/ranges_is_partitioned.h+4-4| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | # pragma GCC system_header |
| 24 | 24 | #endif |
| 25 | 25 | |
| 26 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 26 | #if _LIBCPP_STD_VER > 17 | |
| 27 | 27 | |
| 28 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | |
| ... | ... | @@ -54,7 +54,7 @@ struct __fn { |
| 54 | 54 | template <input_iterator _Iter, sentinel_for<_Iter> _Sent, |
| 55 | 55 | class _Proj = identity, |
| 56 | 56 | indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> |
| 57 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 57 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 58 | 58 | bool operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const { |
| 59 | 59 | return __is_parititioned_impl(std::move(__first), std::move(__last), __pred, __proj); |
| 60 | 60 | } |
| ... | ... | @@ -62,7 +62,7 @@ struct __fn { |
| 62 | 62 | template <input_range _Range, |
| 63 | 63 | class _Proj = identity, |
| 64 | 64 | indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred> |
| 65 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 65 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 66 | 66 | bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const { |
| 67 | 67 | return __is_parititioned_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); |
| 68 | 68 | } |
| ... | ... | @@ -76,6 +76,6 @@ inline namespace __cpo { |
| 76 | 76 | |
| 77 | 77 | _LIBCPP_END_NAMESPACE_STD |
| 78 | 78 | |
| 79 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 79 | #endif // _LIBCPP_STD_VER > 17 | |
| 80 | 80 | |
| 81 | 81 | #endif // _LIBCPP___ALGORITHM_RANGES_IS_PARTITIONED_H |
lib/libcxx/include/__algorithm/ranges_is_permutation.h+4-4| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | # pragma GCC system_header |
| 26 | 26 | #endif |
| 27 | 27 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 28 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 31 | |
| ... | ... | @@ -49,7 +49,7 @@ struct __fn { |
| 49 | 49 | class _Proj2 = identity, |
| 50 | 50 | indirect_equivalence_relation<projected<_Iter1, _Proj1>, |
| 51 | 51 | projected<_Iter2, _Proj2>> _Pred = ranges::equal_to> |
| 52 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 52 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 53 | 53 | bool operator()(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, |
| 54 | 54 | _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { |
| 55 | 55 | return __is_permutation_func_impl( |
| ... | ... | @@ -62,7 +62,7 @@ struct __fn { |
| 62 | 62 | class _Proj1 = identity, |
| 63 | 63 | class _Proj2 = identity, |
| 64 | 64 | indirect_equivalence_relation<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>> _Pred = ranges::equal_to> |
| 65 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 65 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 66 | 66 | bool operator()(_Range1&& __range1, _Range2&& __range2, |
| 67 | 67 | _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { |
| 68 | 68 | if constexpr (sized_range<_Range1> && sized_range<_Range2>) { |
| ... | ... | @@ -84,6 +84,6 @@ inline namespace __cpo { |
| 84 | 84 | |
| 85 | 85 | _LIBCPP_END_NAMESPACE_STD |
| 86 | 86 | |
| 87 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 87 | #endif // _LIBCPP_STD_VER > 17 | |
| 88 | 88 | |
| 89 | 89 | #endif // _LIBCPP___ALGORITHM_RANGES_IS_PERMUTATION_H |
lib/libcxx/include/__algorithm/ranges_is_sorted.h+4-4| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | # pragma GCC system_header |
| 24 | 24 | #endif |
| 25 | 25 | |
| 26 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 26 | #if _LIBCPP_STD_VER > 17 | |
| 27 | 27 | |
| 28 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | |
| ... | ... | @@ -33,7 +33,7 @@ struct __fn { |
| 33 | 33 | template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, |
| 34 | 34 | class _Proj = identity, |
| 35 | 35 | indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less> |
| 36 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 36 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 37 | 37 | bool operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const { |
| 38 | 38 | return ranges::__is_sorted_until_impl(std::move(__first), __last, __comp, __proj) == __last; |
| 39 | 39 | } |
| ... | ... | @@ -41,7 +41,7 @@ struct __fn { |
| 41 | 41 | template <forward_range _Range, |
| 42 | 42 | class _Proj = identity, |
| 43 | 43 | indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> |
| 44 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 44 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 45 | 45 | bool operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const { |
| 46 | 46 | auto __last = ranges::end(__range); |
| 47 | 47 | return ranges::__is_sorted_until_impl(ranges::begin(__range), __last, __comp, __proj) == __last; |
| ... | ... | @@ -56,6 +56,6 @@ inline namespace __cpo { |
| 56 | 56 | |
| 57 | 57 | _LIBCPP_END_NAMESPACE_STD |
| 58 | 58 | |
| 59 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 59 | #endif // _LIBCPP_STD_VER > 17 | |
| 60 | 60 | |
| 61 | 61 | #endif // _LIBCPP__ALGORITHM_RANGES_IS_SORTED_H |
lib/libcxx/include/__algorithm/ranges_is_sorted_until.h+4-4| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -49,7 +49,7 @@ struct __fn { |
| 49 | 49 | template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, |
| 50 | 50 | class _Proj = identity, |
| 51 | 51 | indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less> |
| 52 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 52 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 53 | 53 | _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const { |
| 54 | 54 | return ranges::__is_sorted_until_impl(std::move(__first), std::move(__last), __comp, __proj); |
| 55 | 55 | } |
| ... | ... | @@ -57,7 +57,7 @@ struct __fn { |
| 57 | 57 | template <forward_range _Range, |
| 58 | 58 | class _Proj = identity, |
| 59 | 59 | indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> |
| 60 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 60 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 61 | 61 | borrowed_iterator_t<_Range> operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const { |
| 62 | 62 | return ranges::__is_sorted_until_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj); |
| 63 | 63 | } |
| ... | ... | @@ -71,6 +71,6 @@ inline namespace __cpo { |
| 71 | 71 | |
| 72 | 72 | _LIBCPP_END_NAMESPACE_STD |
| 73 | 73 | |
| 74 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 74 | #endif // _LIBCPP_STD_VER > 17 | |
| 75 | 75 | |
| 76 | 76 | #endif // _LIBCPP__ALGORITHM_RANGES_IS_SORTED_UNTIL_H |
lib/libcxx/include/__algorithm/ranges_iterator_concept.h+4-4| ... | ... | @@ -12,13 +12,13 @@ |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__iterator/concepts.h> |
| 14 | 14 | #include <__iterator/iterator_traits.h> |
| 15 | #include <type_traits> | |
| 15 | #include <__type_traits/remove_cvref.h> | |
| 16 | 16 | |
| 17 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 18 | # pragma GCC system_header |
| 19 | 19 | #endif |
| 20 | 20 | |
| 21 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 21 | #if _LIBCPP_STD_VER > 17 | |
| 22 | 22 | |
| 23 | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | |
| ... | ... | @@ -26,7 +26,7 @@ namespace ranges { |
| 26 | 26 | |
| 27 | 27 | template <class _IterMaybeQualified> |
| 28 | 28 | consteval auto __get_iterator_concept() { |
| 29 | using _Iter = __uncvref_t<_IterMaybeQualified>; | |
| 29 | using _Iter = __remove_cvref_t<_IterMaybeQualified>; | |
| 30 | 30 | |
| 31 | 31 | if constexpr (contiguous_iterator<_Iter>) |
| 32 | 32 | return contiguous_iterator_tag(); |
| ... | ... | @@ -46,6 +46,6 @@ using __iterator_concept = decltype(__get_iterator_concept<_Iter>()); |
| 46 | 46 | } // namespace ranges |
| 47 | 47 | _LIBCPP_END_NAMESPACE_STD |
| 48 | 48 | |
| 49 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 49 | #endif // _LIBCPP_STD_VER > 17 | |
| 50 | 50 | |
| 51 | 51 | #endif // _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H |
lib/libcxx/include/__algorithm/ranges_lexicographical_compare.h+4-4| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | # pragma GCC system_header |
| 24 | 24 | #endif |
| 25 | 25 | |
| 26 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 26 | #if _LIBCPP_STD_VER > 17 | |
| 27 | 27 | |
| 28 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | |
| ... | ... | @@ -55,7 +55,7 @@ struct __fn { |
| 55 | 55 | class _Proj1 = identity, |
| 56 | 56 | class _Proj2 = identity, |
| 57 | 57 | indirect_strict_weak_order<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Comp = ranges::less> |
| 58 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 58 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 59 | 59 | bool operator()(_Iter1 __first1, _Sent1 __last1, |
| 60 | 60 | _Iter2 __first2, _Sent2 __last2, |
| 61 | 61 | _Comp __comp = {}, |
| ... | ... | @@ -74,7 +74,7 @@ struct __fn { |
| 74 | 74 | class _Proj2 = identity, |
| 75 | 75 | indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>, |
| 76 | 76 | projected<iterator_t<_Range2>, _Proj2>> _Comp = ranges::less> |
| 77 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 77 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 78 | 78 | bool operator()(_Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { |
| 79 | 79 | return __lexicographical_compare_impl(ranges::begin(__range1), ranges::end(__range1), |
| 80 | 80 | ranges::begin(__range2), ranges::end(__range2), |
| ... | ... | @@ -93,6 +93,6 @@ inline namespace __cpo { |
| 93 | 93 | |
| 94 | 94 | _LIBCPP_END_NAMESPACE_STD |
| 95 | 95 | |
| 96 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 96 | #endif // _LIBCPP_STD_VER > 17 | |
| 97 | 97 | |
| 98 | 98 | #endif // _LIBCPP___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H |
lib/libcxx/include/__algorithm/ranges_lower_bound.h+4-4| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | # pragma GCC system_header |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 31 | |
| 32 | 32 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 33 | |
| ... | ... | @@ -37,14 +37,14 @@ namespace __lower_bound { |
| 37 | 37 | struct __fn { |
| 38 | 38 | template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity, |
| 39 | 39 | indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less> |
| 40 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 40 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 41 | 41 | _Iter operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const { |
| 42 | 42 | return std::__lower_bound_impl<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | template <forward_range _Range, class _Type, class _Proj = identity, |
| 46 | 46 | indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> |
| 47 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 47 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 48 | 48 | borrowed_iterator_t<_Range> operator()(_Range&& __r, |
| 49 | 49 | const _Type& __value, |
| 50 | 50 | _Comp __comp = {}, |
| ... | ... | @@ -61,6 +61,6 @@ inline namespace __cpo { |
| 61 | 61 | |
| 62 | 62 | _LIBCPP_END_NAMESPACE_STD |
| 63 | 63 | |
| 64 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 64 | #endif // _LIBCPP_STD_VER > 17 | |
| 65 | 65 | |
| 66 | 66 | #endif // _LIBCPP___ALGORITHM_RANGES_LOWER_BOUND_H |
lib/libcxx/include/__algorithm/ranges_make_heap.h+2-2| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | # pragma GCC system_header |
| 33 | 33 | #endif |
| 34 | 34 | |
| 35 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 35 | #if _LIBCPP_STD_VER > 17 | |
| 36 | 36 | |
| 37 | 37 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 38 | 38 | |
| ... | ... | @@ -75,6 +75,6 @@ inline namespace __cpo { |
| 75 | 75 | |
| 76 | 76 | _LIBCPP_END_NAMESPACE_STD |
| 77 | 77 | |
| 78 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 78 | #endif // _LIBCPP_STD_VER > 17 | |
| 79 | 79 | |
| 80 | 80 | #endif // _LIBCPP___ALGORITHM_RANGES_MAKE_HEAP_H |
lib/libcxx/include/__algorithm/ranges_max.h+5-5| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | # pragma GCC system_header |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 31 | |
| 32 | 32 | _LIBCPP_PUSH_MACROS |
| 33 | 33 | #include <__undef_macros> |
| ... | ... | @@ -39,14 +39,14 @@ namespace __max { |
| 39 | 39 | struct __fn { |
| 40 | 40 | template <class _Tp, class _Proj = identity, |
| 41 | 41 | indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> |
| 42 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 42 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 43 | 43 | const _Tp& operator()(const _Tp& __a, const _Tp& __b, _Comp __comp = {}, _Proj __proj = {}) const { |
| 44 | 44 | return std::invoke(__comp, std::invoke(__proj, __a), std::invoke(__proj, __b)) ? __b : __a; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | template <copyable _Tp, class _Proj = identity, |
| 48 | 48 | indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> |
| 49 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 49 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 50 | 50 | _Tp operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const { |
| 51 | 51 | _LIBCPP_ASSERT(__il.begin() != __il.end(), "initializer_list must contain at least one element"); |
| 52 | 52 | |
| ... | ... | @@ -57,7 +57,7 @@ struct __fn { |
| 57 | 57 | template <input_range _Rp, class _Proj = identity, |
| 58 | 58 | indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less> |
| 59 | 59 | requires indirectly_copyable_storable<iterator_t<_Rp>, range_value_t<_Rp>*> |
| 60 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 60 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 61 | 61 | range_value_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const { |
| 62 | 62 | auto __first = ranges::begin(__r); |
| 63 | 63 | auto __last = ranges::end(__r); |
| ... | ... | @@ -88,6 +88,6 @@ _LIBCPP_END_NAMESPACE_STD |
| 88 | 88 | |
| 89 | 89 | _LIBCPP_POP_MACROS |
| 90 | 90 | |
| 91 | #endif // _LIBCPP_STD_VER > 17 && && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 91 | #endif // _LIBCPP_STD_VER > 17 && | |
| 92 | 92 | |
| 93 | 93 | #endif // _LIBCPP___ALGORITHM_RANGES_MAX_H |
lib/libcxx/include/__algorithm/ranges_max_element.h+4-4| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -33,7 +33,7 @@ namespace __max_element { |
| 33 | 33 | struct __fn { |
| 34 | 34 | template <forward_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, |
| 35 | 35 | indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less> |
| 36 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 36 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 37 | 37 | _Ip operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const { |
| 38 | 38 | auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); }; |
| 39 | 39 | return ranges::__min_element_impl(__first, __last, __comp_lhs_rhs_swapped, __proj); |
| ... | ... | @@ -41,7 +41,7 @@ struct __fn { |
| 41 | 41 | |
| 42 | 42 | template <forward_range _Rp, class _Proj = identity, |
| 43 | 43 | indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less> |
| 44 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 44 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 45 | 45 | borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const { |
| 46 | 46 | auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); }; |
| 47 | 47 | return ranges::__min_element_impl(ranges::begin(__r), ranges::end(__r), __comp_lhs_rhs_swapped, __proj); |
| ... | ... | @@ -56,6 +56,6 @@ inline namespace __cpo { |
| 56 | 56 | |
| 57 | 57 | _LIBCPP_END_NAMESPACE_STD |
| 58 | 58 | |
| 59 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 59 | #endif // _LIBCPP_STD_VER > 17 | |
| 60 | 60 | |
| 61 | 61 | #endif // _LIBCPP___ALGORITHM_RANGES_MAX_ELEMENT_H |
lib/libcxx/include/__algorithm/ranges_merge.h+4-4| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | # pragma GCC system_header |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 31 | |
| 32 | 32 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 33 | |
| ... | ... | @@ -47,7 +47,7 @@ template < |
| 47 | 47 | class _Comp, |
| 48 | 48 | class _Proj1, |
| 49 | 49 | class _Proj2> |
| 50 | _LIBCPP_HIDE_FROM_ABI constexpr merge_result<__uncvref_t<_InIter1>, __uncvref_t<_InIter2>, __uncvref_t<_OutIter>> | |
| 50 | _LIBCPP_HIDE_FROM_ABI constexpr merge_result<__remove_cvref_t<_InIter1>, __remove_cvref_t<_InIter2>, __remove_cvref_t<_OutIter>> | |
| 51 | 51 | __merge_impl( |
| 52 | 52 | _InIter1&& __first1, |
| 53 | 53 | _Sent1&& __last1, |
| ... | ... | @@ -107,7 +107,7 @@ struct __fn { |
| 107 | 107 | _OutIter, |
| 108 | 108 | _Comp, |
| 109 | 109 | _Proj1, |
| 110 | _Proj2> | |
| 110 | _Proj2> | |
| 111 | 111 | _LIBCPP_HIDE_FROM_ABI constexpr merge_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>, _OutIter> |
| 112 | 112 | operator()( |
| 113 | 113 | _Range1&& __range1, |
| ... | ... | @@ -137,6 +137,6 @@ inline namespace __cpo { |
| 137 | 137 | |
| 138 | 138 | _LIBCPP_END_NAMESPACE_STD |
| 139 | 139 | |
| 140 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 140 | #endif // _LIBCPP_STD_VER > 17 | |
| 141 | 141 | |
| 142 | 142 | #endif // _LIBCPP___ALGORITHM_RANGES_MERGE_H |
lib/libcxx/include/__algorithm/ranges_min.h+5-5| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | # pragma GCC system_header |
| 27 | 27 | #endif |
| 28 | 28 | |
| 29 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 30 | 30 | |
| 31 | 31 | _LIBCPP_PUSH_MACROS |
| 32 | 32 | #include <__undef_macros> |
| ... | ... | @@ -38,14 +38,14 @@ namespace __min { |
| 38 | 38 | struct __fn { |
| 39 | 39 | template <class _Tp, class _Proj = identity, |
| 40 | 40 | indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> |
| 41 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 41 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 42 | 42 | const _Tp& operator()(const _Tp& __a, const _Tp& __b, _Comp __comp = {}, _Proj __proj = {}) const { |
| 43 | 43 | return std::invoke(__comp, std::invoke(__proj, __b), std::invoke(__proj, __a)) ? __b : __a; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | template <copyable _Tp, class _Proj = identity, |
| 47 | 47 | indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> |
| 48 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 48 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 49 | 49 | _Tp operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const { |
| 50 | 50 | _LIBCPP_ASSERT(__il.begin() != __il.end(), "initializer_list must contain at least one element"); |
| 51 | 51 | return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp, __proj); |
| ... | ... | @@ -54,7 +54,7 @@ struct __fn { |
| 54 | 54 | template <input_range _Rp, class _Proj = identity, |
| 55 | 55 | indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less> |
| 56 | 56 | requires indirectly_copyable_storable<iterator_t<_Rp>, range_value_t<_Rp>*> |
| 57 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 57 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 58 | 58 | range_value_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const { |
| 59 | 59 | auto __first = ranges::begin(__r); |
| 60 | 60 | auto __last = ranges::end(__r); |
| ... | ... | @@ -84,6 +84,6 @@ _LIBCPP_END_NAMESPACE_STD |
| 84 | 84 | |
| 85 | 85 | _LIBCPP_POP_MACROS |
| 86 | 86 | |
| 87 | #endif // _LIBCPP_STD_VER > 17 && && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 87 | #endif // _LIBCPP_STD_VER > 17 && | |
| 88 | 88 | |
| 89 | 89 | #endif // _LIBCPP___ALGORITHM_RANGES_MIN_H |
lib/libcxx/include/__algorithm/ranges_min_element.h+4-4| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -48,14 +48,14 @@ namespace __min_element { |
| 48 | 48 | struct __fn { |
| 49 | 49 | template <forward_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, |
| 50 | 50 | indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less> |
| 51 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 51 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 52 | 52 | _Ip operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const { |
| 53 | 53 | return ranges::__min_element_impl(__first, __last, __comp, __proj); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | template <forward_range _Rp, class _Proj = identity, |
| 57 | 57 | indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less> |
| 58 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 58 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 59 | 59 | borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const { |
| 60 | 60 | return ranges::__min_element_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj); |
| 61 | 61 | } |
| ... | ... | @@ -69,6 +69,6 @@ inline namespace __cpo { |
| 69 | 69 | |
| 70 | 70 | _LIBCPP_END_NAMESPACE_STD |
| 71 | 71 | |
| 72 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 72 | #endif // _LIBCPP_STD_VER > 17 | |
| 73 | 73 | |
| 74 | 74 | #endif // _LIBCPP___ALGORITHM_RANGES_MIN_ELEMENT_H |
lib/libcxx/include/__algorithm/ranges_minmax.h+6-5| ... | ... | @@ -23,13 +23,14 @@ |
| 23 | 23 | #include <__ranges/concepts.h> |
| 24 | 24 | #include <__utility/forward.h> |
| 25 | 25 | #include <__utility/move.h> |
| 26 | #include <__utility/pair.h> | |
| 26 | 27 | #include <initializer_list> |
| 27 | 28 | |
| 28 | 29 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 29 | 30 | # pragma GCC system_header |
| 30 | 31 | #endif |
| 31 | 32 | |
| 32 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 33 | #if _LIBCPP_STD_VER > 17 | |
| 33 | 34 | |
| 34 | 35 | _LIBCPP_PUSH_MACROS |
| 35 | 36 | #include <__undef_macros> |
| ... | ... | @@ -44,7 +45,7 @@ namespace __minmax { |
| 44 | 45 | struct __fn { |
| 45 | 46 | template <class _Type, class _Proj = identity, |
| 46 | 47 | indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less> |
| 47 | _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<const _Type&> | |
| 48 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<const _Type&> | |
| 48 | 49 | operator()(const _Type& __a, const _Type& __b, _Comp __comp = {}, _Proj __proj = {}) const { |
| 49 | 50 | if (std::invoke(__comp, std::invoke(__proj, __b), std::invoke(__proj, __a))) |
| 50 | 51 | return {__b, __a}; |
| ... | ... | @@ -53,7 +54,7 @@ struct __fn { |
| 53 | 54 | |
| 54 | 55 | template <copyable _Type, class _Proj = identity, |
| 55 | 56 | indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less> |
| 56 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 57 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 57 | 58 | ranges::minmax_result<_Type> operator()(initializer_list<_Type> __il, _Comp __comp = {}, _Proj __proj = {}) const { |
| 58 | 59 | _LIBCPP_ASSERT(__il.begin() != __il.end(), "initializer_list has to contain at least one element"); |
| 59 | 60 | auto __iters = std::__minmax_element_impl(__il.begin(), __il.end(), __comp, __proj); |
| ... | ... | @@ -63,7 +64,7 @@ struct __fn { |
| 63 | 64 | template <input_range _Range, class _Proj = identity, |
| 64 | 65 | indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> |
| 65 | 66 | requires indirectly_copyable_storable<iterator_t<_Range>, range_value_t<_Range>*> |
| 66 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 67 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 67 | 68 | ranges::minmax_result<range_value_t<_Range>> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { |
| 68 | 69 | auto __first = ranges::begin(__r); |
| 69 | 70 | auto __last = ranges::end(__r); |
| ... | ... | @@ -128,6 +129,6 @@ _LIBCPP_END_NAMESPACE_STD |
| 128 | 129 | |
| 129 | 130 | _LIBCPP_POP_MACROS |
| 130 | 131 | |
| 131 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 132 | #endif // _LIBCPP_STD_VER > 17 | |
| 132 | 133 | |
| 133 | 134 | #endif // _LIBCPP___ALGORITHM_RANGES_MINMAX_H |
lib/libcxx/include/__algorithm/ranges_minmax_element.h+4-4| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | # pragma GCC system_header |
| 30 | 30 | #endif |
| 31 | 31 | |
| 32 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 32 | #if _LIBCPP_STD_VER > 17 | |
| 33 | 33 | |
| 34 | 34 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 35 | 35 | |
| ... | ... | @@ -42,7 +42,7 @@ namespace __minmax_element { |
| 42 | 42 | struct __fn { |
| 43 | 43 | template <forward_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, |
| 44 | 44 | indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less> |
| 45 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 45 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 46 | 46 | ranges::minmax_element_result<_Ip> operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const { |
| 47 | 47 | auto __ret = std::__minmax_element_impl(std::move(__first), std::move(__last), __comp, __proj); |
| 48 | 48 | return {__ret.first, __ret.second}; |
| ... | ... | @@ -50,7 +50,7 @@ struct __fn { |
| 50 | 50 | |
| 51 | 51 | template <forward_range _Rp, class _Proj = identity, |
| 52 | 52 | indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less> |
| 53 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 53 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 54 | 54 | ranges::minmax_element_result<borrowed_iterator_t<_Rp>> |
| 55 | 55 | operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const { |
| 56 | 56 | auto __ret = std::__minmax_element_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj); |
| ... | ... | @@ -67,6 +67,6 @@ inline namespace __cpo { |
| 67 | 67 | |
| 68 | 68 | _LIBCPP_END_NAMESPACE_STD |
| 69 | 69 | |
| 70 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 70 | #endif // _LIBCPP_STD_VER > 17 | |
| 71 | 71 | |
| 72 | 72 | #endif // _LIBCPP___ALGORITHM_RANGES_MINMAX_H |
lib/libcxx/include/__algorithm/ranges_mismatch.h+4-4| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | |
| 28 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 31 | |
| 32 | 32 | namespace ranges { |
| 33 | 33 | |
| ... | ... | @@ -55,7 +55,7 @@ struct __fn { |
| 55 | 55 | input_iterator _I2, sentinel_for<_I2> _S2, |
| 56 | 56 | class _Pred = ranges::equal_to, class _Proj1 = identity, class _Proj2 = identity> |
| 57 | 57 | requires indirectly_comparable<_I1, _I2, _Pred, _Proj1, _Proj2> |
| 58 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 58 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 59 | 59 | mismatch_result<_I1, _I2> operator()(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2, |
| 60 | 60 | _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { |
| 61 | 61 | return __go(std::move(__first1), __last1, std::move(__first2), __last2, __pred, __proj1, __proj2); |
| ... | ... | @@ -64,7 +64,7 @@ struct __fn { |
| 64 | 64 | template <input_range _R1, input_range _R2, |
| 65 | 65 | class _Pred = ranges::equal_to, class _Proj1 = identity, class _Proj2 = identity> |
| 66 | 66 | requires indirectly_comparable<iterator_t<_R1>, iterator_t<_R2>, _Pred, _Proj1, _Proj2> |
| 67 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 67 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 68 | 68 | mismatch_result<borrowed_iterator_t<_R1>, borrowed_iterator_t<_R2>> |
| 69 | 69 | operator()(_R1&& __r1, _R2&& __r2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { |
| 70 | 70 | return __go(ranges::begin(__r1), ranges::end(__r1), ranges::begin(__r2), ranges::end(__r2), |
| ... | ... | @@ -78,7 +78,7 @@ inline namespace __cpo { |
| 78 | 78 | } // namespace __cpo |
| 79 | 79 | } // namespace ranges |
| 80 | 80 | |
| 81 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 81 | #endif // _LIBCPP_STD_VER > 17 | |
| 82 | 82 | |
| 83 | 83 | _LIBCPP_END_NAMESPACE_STD |
| 84 | 84 |
lib/libcxx/include/__algorithm/ranges_move.h+2-3| ... | ... | @@ -14,7 +14,6 @@ |
| 14 | 14 | #include <__algorithm/move.h> |
| 15 | 15 | #include <__config> |
| 16 | 16 | #include <__iterator/concepts.h> |
| 17 | #include <__iterator/iter_move.h> | |
| 18 | 17 | #include <__ranges/access.h> |
| 19 | 18 | #include <__ranges/concepts.h> |
| 20 | 19 | #include <__ranges/dangling.h> |
| ... | ... | @@ -24,7 +23,7 @@ |
| 24 | 23 | # pragma GCC system_header |
| 25 | 24 | #endif |
| 26 | 25 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 26 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 27 | |
| 29 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 29 | |
| ... | ... | @@ -67,6 +66,6 @@ inline namespace __cpo { |
| 67 | 66 | |
| 68 | 67 | _LIBCPP_END_NAMESPACE_STD |
| 69 | 68 | |
| 70 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 69 | #endif // _LIBCPP_STD_VER > 17 | |
| 71 | 70 | |
| 72 | 71 | #endif // _LIBCPP___ALGORITHM_RANGES_MOVE_H |
lib/libcxx/include/__algorithm/ranges_move_backward.h+6-9| ... | ... | @@ -10,12 +10,12 @@ |
| 10 | 10 | #define _LIBCPP___ALGORITHM_RANGES_MOVE_BACKWARD_H |
| 11 | 11 | |
| 12 | 12 | #include <__algorithm/in_out_result.h> |
| 13 | #include <__algorithm/ranges_move.h> | |
| 13 | #include <__algorithm/iterator_operations.h> | |
| 14 | #include <__algorithm/move_backward.h> | |
| 14 | 15 | #include <__config> |
| 15 | 16 | #include <__iterator/concepts.h> |
| 16 | 17 | #include <__iterator/iter_move.h> |
| 17 | 18 | #include <__iterator/next.h> |
| 18 | #include <__iterator/reverse_iterator.h> | |
| 19 | 19 | #include <__ranges/access.h> |
| 20 | 20 | #include <__ranges/concepts.h> |
| 21 | 21 | #include <__ranges/dangling.h> |
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | # pragma GCC system_header |
| 26 | 26 | #endif |
| 27 | 27 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 28 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 31 | |
| ... | ... | @@ -40,11 +40,8 @@ struct __fn { |
| 40 | 40 | template <class _InIter, class _Sent, class _OutIter> |
| 41 | 41 | _LIBCPP_HIDE_FROM_ABI constexpr static |
| 42 | 42 | move_backward_result<_InIter, _OutIter> __move_backward_impl(_InIter __first, _Sent __last, _OutIter __result) { |
| 43 | auto __last_iter = ranges::next(__first, std::move(__last)); | |
| 44 | auto __ret = ranges::move(std::make_reverse_iterator(__last_iter), | |
| 45 | std::make_reverse_iterator(__first), | |
| 46 | std::make_reverse_iterator(__result)); | |
| 47 | return {std::move(__last_iter), std::move(__ret.out.base())}; | |
| 43 | auto __ret = std::__move_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)); | |
| 44 | return {std::move(__ret.first), std::move(__ret.second)}; | |
| 48 | 45 | } |
| 49 | 46 | |
| 50 | 47 | template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, bidirectional_iterator _OutIter> |
| ... | ... | @@ -71,6 +68,6 @@ inline namespace __cpo { |
| 71 | 68 | |
| 72 | 69 | _LIBCPP_END_NAMESPACE_STD |
| 73 | 70 | |
| 74 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 71 | #endif // _LIBCPP_STD_VER > 17 | |
| 75 | 72 | |
| 76 | 73 | #endif // _LIBCPP___ALGORITHM_RANGES_MOVE_BACKWARD_H |
lib/libcxx/include/__algorithm/ranges_next_permutation.h+3-2| ... | ... | @@ -22,12 +22,13 @@ |
| 22 | 22 | #include <__ranges/concepts.h> |
| 23 | 23 | #include <__ranges/dangling.h> |
| 24 | 24 | #include <__utility/move.h> |
| 25 | #include <__utility/pair.h> | |
| 25 | 26 | |
| 26 | 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 27 | 28 | # pragma GCC system_header |
| 28 | 29 | #endif |
| 29 | 30 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 31 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 32 | |
| 32 | 33 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 34 | |
| ... | ... | @@ -67,6 +68,6 @@ constexpr inline auto next_permutation = __next_permutation::__fn{}; |
| 67 | 68 | |
| 68 | 69 | _LIBCPP_END_NAMESPACE_STD |
| 69 | 70 | |
| 70 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 71 | #endif // _LIBCPP_STD_VER > 17 | |
| 71 | 72 | |
| 72 | 73 | #endif // _LIBCPP___ALGORITHM_RANGES_NEXT_PERMUTATION_H |
lib/libcxx/include/__algorithm/ranges_none_of.h+4-4| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | # pragma GCC system_header |
| 23 | 23 | #endif |
| 24 | 24 | |
| 25 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 25 | #if _LIBCPP_STD_VER > 17 | |
| 26 | 26 | |
| 27 | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 28 | |
| ... | ... | @@ -42,14 +42,14 @@ struct __fn { |
| 42 | 42 | |
| 43 | 43 | template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, |
| 44 | 44 | indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> |
| 45 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 45 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 46 | 46 | bool operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const { |
| 47 | 47 | return __none_of_impl(std::move(__first), std::move(__last), __pred, __proj); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | template <input_range _Range, class _Proj = identity, |
| 51 | 51 | indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred> |
| 52 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 52 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 53 | 53 | bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const { |
| 54 | 54 | return __none_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); |
| 55 | 55 | } |
| ... | ... | @@ -63,6 +63,6 @@ inline namespace __cpo { |
| 63 | 63 | |
| 64 | 64 | _LIBCPP_END_NAMESPACE_STD |
| 65 | 65 | |
| 66 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 66 | #endif // _LIBCPP_STD_VER > 17 | |
| 67 | 67 | |
| 68 | 68 | #endif // _LIBCPP___ALGORITHM_RANGES_NONE_OF_H |
lib/libcxx/include/__algorithm/ranges_nth_element.h+2-2| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | # pragma GCC system_header |
| 32 | 32 | #endif |
| 33 | 33 | |
| 34 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 34 | #if _LIBCPP_STD_VER > 17 | |
| 35 | 35 | |
| 36 | 36 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 37 | 37 | |
| ... | ... | @@ -75,6 +75,6 @@ inline namespace __cpo { |
| 75 | 75 | |
| 76 | 76 | _LIBCPP_END_NAMESPACE_STD |
| 77 | 77 | |
| 78 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 78 | #endif // _LIBCPP_STD_VER > 17 | |
| 79 | 79 | |
| 80 | 80 | #endif // _LIBCPP___ALGORITHM_RANGES_NTH_ELEMENT_H |
lib/libcxx/include/__algorithm/ranges_partial_sort.h+3-2| ... | ... | @@ -27,12 +27,13 @@ |
| 27 | 27 | #include <__ranges/dangling.h> |
| 28 | 28 | #include <__utility/forward.h> |
| 29 | 29 | #include <__utility/move.h> |
| 30 | #include <__utility/pair.h> | |
| 30 | 31 | |
| 31 | 32 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 32 | 33 | # pragma GCC system_header |
| 33 | 34 | #endif |
| 34 | 35 | |
| 35 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 36 | #if _LIBCPP_STD_VER > 17 | |
| 36 | 37 | |
| 37 | 38 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 38 | 39 | |
| ... | ... | @@ -72,6 +73,6 @@ inline namespace __cpo { |
| 72 | 73 | |
| 73 | 74 | _LIBCPP_END_NAMESPACE_STD |
| 74 | 75 | |
| 75 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 76 | #endif // _LIBCPP_STD_VER > 17 | |
| 76 | 77 | |
| 77 | 78 | #endif // _LIBCPP___ALGORITHM_RANGES_PARTIAL_SORT_H |
lib/libcxx/include/__algorithm/ranges_partial_sort_copy.h+3-2| ... | ... | @@ -24,12 +24,13 @@ |
| 24 | 24 | #include <__ranges/concepts.h> |
| 25 | 25 | #include <__ranges/dangling.h> |
| 26 | 26 | #include <__utility/move.h> |
| 27 | #include <__utility/pair.h> | |
| 27 | 28 | |
| 28 | 29 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 29 | 30 | # pragma GCC system_header |
| 30 | 31 | #endif |
| 31 | 32 | |
| 32 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 33 | #if _LIBCPP_STD_VER > 17 | |
| 33 | 34 | |
| 34 | 35 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 35 | 36 | |
| ... | ... | @@ -86,6 +87,6 @@ inline namespace __cpo { |
| 86 | 87 | |
| 87 | 88 | _LIBCPP_END_NAMESPACE_STD |
| 88 | 89 | |
| 89 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 90 | #endif // _LIBCPP_STD_VER > 17 | |
| 90 | 91 | |
| 91 | 92 | #endif // _LIBCPP___ALGORITHM_RANGES_PARTIAL_SORT_COPY_H |
lib/libcxx/include/__algorithm/ranges_partition.h+4-3| ... | ... | @@ -26,13 +26,14 @@ |
| 26 | 26 | #include <__ranges/subrange.h> |
| 27 | 27 | #include <__utility/forward.h> |
| 28 | 28 | #include <__utility/move.h> |
| 29 | #include <__utility/pair.h> | |
| 29 | 30 | #include <type_traits> |
| 30 | 31 | |
| 31 | 32 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 32 | 33 | # pragma GCC system_header |
| 33 | 34 | #endif |
| 34 | 35 | |
| 35 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 36 | #if _LIBCPP_STD_VER > 17 | |
| 36 | 37 | |
| 37 | 38 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 38 | 39 | |
| ... | ... | @@ -43,7 +44,7 @@ struct __fn { |
| 43 | 44 | |
| 44 | 45 | template <class _Iter, class _Sent, class _Proj, class _Pred> |
| 45 | 46 | _LIBCPP_HIDE_FROM_ABI static constexpr |
| 46 | subrange<__uncvref_t<_Iter>> __partition_fn_impl(_Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) { | |
| 47 | subrange<__remove_cvref_t<_Iter>> __partition_fn_impl(_Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) { | |
| 47 | 48 | auto&& __projected_pred = std::__make_projected(__pred, __proj); |
| 48 | 49 | auto __result = std::__partition<_RangeAlgPolicy>( |
| 49 | 50 | std::move(__first), std::move(__last), __projected_pred, __iterator_concept<_Iter>()); |
| ... | ... | @@ -77,6 +78,6 @@ inline namespace __cpo { |
| 77 | 78 | |
| 78 | 79 | _LIBCPP_END_NAMESPACE_STD |
| 79 | 80 | |
| 80 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 81 | #endif // _LIBCPP_STD_VER > 17 | |
| 81 | 82 | |
| 82 | 83 | #endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_H |
lib/libcxx/include/__algorithm/ranges_partition_copy.h+3-3| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | # pragma GCC system_header |
| 27 | 27 | #endif |
| 28 | 28 | |
| 29 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 30 | 30 | |
| 31 | 31 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 32 | 32 | |
| ... | ... | @@ -43,7 +43,7 @@ struct __fn { |
| 43 | 43 | template <class _InIter, class _Sent, class _OutIter1, class _OutIter2, class _Proj, class _Pred> |
| 44 | 44 | _LIBCPP_HIDE_FROM_ABI constexpr |
| 45 | 45 | static partition_copy_result< |
| 46 | __uncvref_t<_InIter>, __uncvref_t<_OutIter1>, __uncvref_t<_OutIter2> | |
| 46 | __remove_cvref_t<_InIter>, __remove_cvref_t<_OutIter1>, __remove_cvref_t<_OutIter2> | |
| 47 | 47 | > __partition_copy_fn_impl( _InIter&& __first, _Sent&& __last, _OutIter1&& __out_true, _OutIter2&& __out_false, |
| 48 | 48 | _Pred& __pred, _Proj& __proj) { |
| 49 | 49 | for (; __first != __last; ++__first) { |
| ... | ... | @@ -93,6 +93,6 @@ inline namespace __cpo { |
| 93 | 93 | |
| 94 | 94 | _LIBCPP_END_NAMESPACE_STD |
| 95 | 95 | |
| 96 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 96 | #endif // _LIBCPP_STD_VER > 17 | |
| 97 | 97 | |
| 98 | 98 | #endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_COPY_H |
lib/libcxx/include/__algorithm/ranges_partition_point.h+2-2| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | # pragma GCC system_header |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 31 | |
| 32 | 32 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 33 | |
| ... | ... | @@ -83,6 +83,6 @@ inline namespace __cpo { |
| 83 | 83 | |
| 84 | 84 | _LIBCPP_END_NAMESPACE_STD |
| 85 | 85 | |
| 86 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 86 | #endif // _LIBCPP_STD_VER > 17 | |
| 87 | 87 | |
| 88 | 88 | #endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_POINT_H |
lib/libcxx/include/__algorithm/ranges_pop_heap.h+2-2| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | # pragma GCC system_header |
| 33 | 33 | #endif |
| 34 | 34 | |
| 35 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 35 | #if _LIBCPP_STD_VER > 17 | |
| 36 | 36 | |
| 37 | 37 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 38 | 38 | |
| ... | ... | @@ -76,6 +76,6 @@ inline namespace __cpo { |
| 76 | 76 | |
| 77 | 77 | _LIBCPP_END_NAMESPACE_STD |
| 78 | 78 | |
| 79 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 79 | #endif // _LIBCPP_STD_VER > 17 | |
| 80 | 80 | |
| 81 | 81 | #endif // _LIBCPP___ALGORITHM_RANGES_POP_HEAP_H |
lib/libcxx/include/__algorithm/ranges_prev_permutation.h+3-2| ... | ... | @@ -22,12 +22,13 @@ |
| 22 | 22 | #include <__ranges/concepts.h> |
| 23 | 23 | #include <__ranges/dangling.h> |
| 24 | 24 | #include <__utility/move.h> |
| 25 | #include <__utility/pair.h> | |
| 25 | 26 | |
| 26 | 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 27 | 28 | # pragma GCC system_header |
| 28 | 29 | #endif |
| 29 | 30 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 31 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 32 | |
| 32 | 33 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 34 | |
| ... | ... | @@ -71,6 +72,6 @@ constexpr inline auto prev_permutation = __prev_permutation::__fn{}; |
| 71 | 72 | |
| 72 | 73 | _LIBCPP_END_NAMESPACE_STD |
| 73 | 74 | |
| 74 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 75 | #endif // _LIBCPP_STD_VER > 17 | |
| 75 | 76 | |
| 76 | 77 | #endif // _LIBCPP___ALGORITHM_RANGES_PREV_PERMUTATION_H |
lib/libcxx/include/__algorithm/ranges_push_heap.h+2-2| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | # pragma GCC system_header |
| 33 | 33 | #endif |
| 34 | 34 | |
| 35 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 35 | #if _LIBCPP_STD_VER > 17 | |
| 36 | 36 | |
| 37 | 37 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 38 | 38 | |
| ... | ... | @@ -75,6 +75,6 @@ inline namespace __cpo { |
| 75 | 75 | |
| 76 | 76 | _LIBCPP_END_NAMESPACE_STD |
| 77 | 77 | |
| 78 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 78 | #endif // _LIBCPP_STD_VER > 17 | |
| 79 | 79 | |
| 80 | 80 | #endif // _LIBCPP___ALGORITHM_RANGES_PUSH_HEAP_H |
lib/libcxx/include/__algorithm/ranges_remove.h+4-4| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | # pragma GCC system_header |
| 26 | 26 | #endif |
| 27 | 27 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 28 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 31 | |
| ... | ... | @@ -35,7 +35,7 @@ struct __fn { |
| 35 | 35 | |
| 36 | 36 | template <permutable _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity> |
| 37 | 37 | requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*> |
| 38 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 38 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 39 | 39 | subrange<_Iter> operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) const { |
| 40 | 40 | auto __pred = [&](auto&& __other) { return __value == __other; }; |
| 41 | 41 | return ranges::__remove_if_impl(std::move(__first), std::move(__last), __pred, __proj); |
| ... | ... | @@ -44,7 +44,7 @@ struct __fn { |
| 44 | 44 | template <forward_range _Range, class _Type, class _Proj = identity> |
| 45 | 45 | requires permutable<iterator_t<_Range>> |
| 46 | 46 | && indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*> |
| 47 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 47 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 48 | 48 | borrowed_subrange_t<_Range> operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const { |
| 49 | 49 | auto __pred = [&](auto&& __other) { return __value == __other; }; |
| 50 | 50 | return ranges::__remove_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); |
| ... | ... | @@ -59,6 +59,6 @@ inline namespace __cpo { |
| 59 | 59 | |
| 60 | 60 | _LIBCPP_END_NAMESPACE_STD |
| 61 | 61 | |
| 62 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 62 | #endif // _LIBCPP_STD_VER > 17 | |
| 63 | 63 | |
| 64 | 64 | #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_H |
lib/libcxx/include/__algorithm/ranges_remove_copy.h+2-2| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | # pragma GCC system_header |
| 27 | 27 | #endif |
| 28 | 28 | |
| 29 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 30 | 30 | |
| 31 | 31 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 32 | 32 | |
| ... | ... | @@ -71,6 +71,6 @@ inline namespace __cpo { |
| 71 | 71 | |
| 72 | 72 | _LIBCPP_END_NAMESPACE_STD |
| 73 | 73 | |
| 74 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 74 | #endif // _LIBCPP_STD_VER > 17 | |
| 75 | 75 | |
| 76 | 76 | #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_COPY_H |
lib/libcxx/include/__algorithm/ranges_remove_copy_if.h+2-2| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | # pragma GCC system_header |
| 30 | 30 | #endif |
| 31 | 31 | |
| 32 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 32 | #if _LIBCPP_STD_VER > 17 | |
| 33 | 33 | |
| 34 | 34 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 35 | 35 | |
| ... | ... | @@ -85,6 +85,6 @@ inline namespace __cpo { |
| 85 | 85 | |
| 86 | 86 | _LIBCPP_END_NAMESPACE_STD |
| 87 | 87 | |
| 88 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 88 | #endif // _LIBCPP_STD_VER > 17 | |
| 89 | 89 | |
| 90 | 90 | #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_COPY_IF_H |
lib/libcxx/include/__algorithm/ranges_remove_if.h+4-4| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | # pragma GCC system_header |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 31 | |
| 32 | 32 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 33 | |
| ... | ... | @@ -56,7 +56,7 @@ struct __fn { |
| 56 | 56 | template <permutable _Iter, sentinel_for<_Iter> _Sent, |
| 57 | 57 | class _Proj = identity, |
| 58 | 58 | indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> |
| 59 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 59 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 60 | 60 | subrange<_Iter> operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const { |
| 61 | 61 | return ranges::__remove_if_impl(std::move(__first), std::move(__last), __pred, __proj); |
| 62 | 62 | } |
| ... | ... | @@ -65,7 +65,7 @@ struct __fn { |
| 65 | 65 | class _Proj = identity, |
| 66 | 66 | indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred> |
| 67 | 67 | requires permutable<iterator_t<_Range>> |
| 68 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 68 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 69 | 69 | borrowed_subrange_t<_Range> operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const { |
| 70 | 70 | return ranges::__remove_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); |
| 71 | 71 | } |
| ... | ... | @@ -80,6 +80,6 @@ inline namespace __cpo { |
| 80 | 80 | |
| 81 | 81 | _LIBCPP_END_NAMESPACE_STD |
| 82 | 82 | |
| 83 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 83 | #endif // _LIBCPP_STD_VER > 17 | |
| 84 | 84 | |
| 85 | 85 | #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_IF_H |
lib/libcxx/include/__algorithm/ranges_replace.h+2-2| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined (_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -69,6 +69,6 @@ inline namespace __cpo { |
| 69 | 69 | |
| 70 | 70 | _LIBCPP_END_NAMESPACE_STD |
| 71 | 71 | |
| 72 | #endif // _LIBCPP_STD_VER > 17 && !defined (_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 72 | #endif // _LIBCPP_STD_VER > 17 | |
| 73 | 73 | |
| 74 | 74 | #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_H |
lib/libcxx/include/__algorithm/ranges_replace_copy.h+2-2| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | # pragma GCC system_header |
| 27 | 27 | #endif |
| 28 | 28 | |
| 29 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 30 | 30 | |
| 31 | 31 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 32 | 32 | |
| ... | ... | @@ -86,6 +86,6 @@ inline namespace __cpo { |
| 86 | 86 | |
| 87 | 87 | _LIBCPP_END_NAMESPACE_STD |
| 88 | 88 | |
| 89 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 89 | #endif // _LIBCPP_STD_VER > 17 | |
| 90 | 90 | |
| 91 | 91 | #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_COPY_H |
lib/libcxx/include/__algorithm/ranges_replace_copy_if.h+2-2| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -88,6 +88,6 @@ inline namespace __cpo { |
| 88 | 88 | |
| 89 | 89 | _LIBCPP_END_NAMESPACE_STD |
| 90 | 90 | |
| 91 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 91 | #endif // _LIBCPP_STD_VER > 17 | |
| 92 | 92 | |
| 93 | 93 | #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_COPY_IF_H |
lib/libcxx/include/__algorithm/ranges_replace_if.h+2-2| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | # pragma GCC system_header |
| 24 | 24 | #endif |
| 25 | 25 | |
| 26 | #if _LIBCPP_STD_VER > 17 && !defined (_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 26 | #if _LIBCPP_STD_VER > 17 | |
| 27 | 27 | |
| 28 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | |
| ... | ... | @@ -72,6 +72,6 @@ inline namespace __cpo { |
| 72 | 72 | |
| 73 | 73 | _LIBCPP_END_NAMESPACE_STD |
| 74 | 74 | |
| 75 | #endif // _LIBCPP_STD_VER > 17 && !defined (_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 75 | #endif // _LIBCPP_STD_VER > 17 | |
| 76 | 76 | |
| 77 | 77 | #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_IF_H |
lib/libcxx/include/__algorithm/ranges_reverse.h+2-2| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | # pragma GCC system_header |
| 23 | 23 | #endif |
| 24 | 24 | |
| 25 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 25 | #if _LIBCPP_STD_VER > 17 | |
| 26 | 26 | |
| 27 | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 28 | |
| ... | ... | @@ -78,6 +78,6 @@ inline namespace __cpo { |
| 78 | 78 | |
| 79 | 79 | _LIBCPP_END_NAMESPACE_STD |
| 80 | 80 | |
| 81 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 81 | #endif // _LIBCPP_STD_VER > 17 | |
| 82 | 82 | |
| 83 | 83 | #endif // _LIBCPP___ALGORITHM_RANGES_REVERSE_H |
lib/libcxx/include/__algorithm/ranges_reverse_copy.h+2-2| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | # pragma GCC system_header |
| 26 | 26 | #endif |
| 27 | 27 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 28 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 31 | |
| ... | ... | @@ -62,6 +62,6 @@ inline namespace __cpo { |
| 62 | 62 | |
| 63 | 63 | _LIBCPP_END_NAMESPACE_STD |
| 64 | 64 | |
| 65 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 65 | #endif // _LIBCPP_STD_VER > 17 | |
| 66 | 66 | |
| 67 | 67 | #endif // _LIBCPP___ALGORITHM_RANGES_REVERSE_COPY_H |
lib/libcxx/include/__algorithm/ranges_rotate.h+2-2| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | # pragma GCC system_header |
| 26 | 26 | #endif |
| 27 | 27 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 28 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 31 | |
| ... | ... | @@ -66,6 +66,6 @@ inline namespace __cpo { |
| 66 | 66 | |
| 67 | 67 | _LIBCPP_END_NAMESPACE_STD |
| 68 | 68 | |
| 69 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 69 | #endif // _LIBCPP_STD_VER > 17 | |
| 70 | 70 | |
| 71 | 71 | #endif // _LIBCPP___ALGORITHM_RANGES_ROTATE_H |
lib/libcxx/include/__algorithm/ranges_rotate_copy.h+2-2| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | # pragma GCC system_header |
| 24 | 24 | #endif |
| 25 | 25 | |
| 26 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 26 | #if _LIBCPP_STD_VER > 17 | |
| 27 | 27 | |
| 28 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | |
| ... | ... | @@ -63,6 +63,6 @@ inline namespace __cpo { |
| 63 | 63 | |
| 64 | 64 | _LIBCPP_END_NAMESPACE_STD |
| 65 | 65 | |
| 66 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 66 | #endif // _LIBCPP_STD_VER > 17 | |
| 67 | 67 | |
| 68 | 68 | #endif // _LIBCPP___ALGORITHM_RANGES_ROTATE_COPY_H |
lib/libcxx/include/__algorithm/ranges_sample.h+2-2| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | # pragma GCC system_header |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 31 | |
| 32 | 32 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 33 | |
| ... | ... | @@ -69,6 +69,6 @@ inline namespace __cpo { |
| 69 | 69 | |
| 70 | 70 | _LIBCPP_END_NAMESPACE_STD |
| 71 | 71 | |
| 72 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 72 | #endif // _LIBCPP_STD_VER > 17 | |
| 73 | 73 | |
| 74 | 74 | #endif // _LIBCPP___ALGORITHM_RANGES_SAMPLE_H |
lib/libcxx/include/__algorithm/ranges_search.h+5-4| ... | ... | @@ -22,12 +22,13 @@ |
| 22 | 22 | #include <__ranges/concepts.h> |
| 23 | 23 | #include <__ranges/size.h> |
| 24 | 24 | #include <__ranges/subrange.h> |
| 25 | #include <__utility/pair.h> | |
| 25 | 26 | |
| 26 | 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 27 | 28 | # pragma GCC system_header |
| 28 | 29 | #endif |
| 29 | 30 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 31 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 32 | |
| 32 | 33 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 34 | |
| ... | ... | @@ -74,7 +75,7 @@ struct __fn { |
| 74 | 75 | class _Proj1 = identity, |
| 75 | 76 | class _Proj2 = identity> |
| 76 | 77 | requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2> |
| 77 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 78 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 78 | 79 | subrange<_Iter1> operator()(_Iter1 __first1, _Sent1 __last1, |
| 79 | 80 | _Iter2 __first2, _Sent2 __last2, |
| 80 | 81 | _Pred __pred = {}, |
| ... | ... | @@ -89,7 +90,7 @@ struct __fn { |
| 89 | 90 | class _Proj1 = identity, |
| 90 | 91 | class _Proj2 = identity> |
| 91 | 92 | requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> |
| 92 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 93 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 93 | 94 | borrowed_subrange_t<_Range1> operator()(_Range1&& __range1, |
| 94 | 95 | _Range2&& __range2, |
| 95 | 96 | _Pred __pred = {}, |
| ... | ... | @@ -129,6 +130,6 @@ inline namespace __cpo { |
| 129 | 130 | |
| 130 | 131 | _LIBCPP_END_NAMESPACE_STD |
| 131 | 132 | |
| 132 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 133 | #endif // _LIBCPP_STD_VER > 17 | |
| 133 | 134 | |
| 134 | 135 | #endif // _LIBCPP___ALGORITHM_RANGES_SEARCH_H |
lib/libcxx/include/__algorithm/ranges_search_n.h+7-10| ... | ... | @@ -25,12 +25,13 @@ |
| 25 | 25 | #include <__ranges/size.h> |
| 26 | 26 | #include <__ranges/subrange.h> |
| 27 | 27 | #include <__utility/move.h> |
| 28 | #include <__utility/pair.h> | |
| 28 | 29 | |
| 29 | 30 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 30 | 31 | # pragma GCC system_header |
| 31 | 32 | #endif |
| 32 | 33 | |
| 33 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 34 | #if _LIBCPP_STD_VER > 17 | |
| 34 | 35 | |
| 35 | 36 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 36 | 37 | |
| ... | ... | @@ -52,12 +53,8 @@ struct __fn { |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | if constexpr (random_access_iterator<_Iter1>) { |
| 55 | auto __ret = __search_n_random_access_impl<_RangeAlgPolicy>(__first, __last, | |
| 56 | __count, | |
| 57 | __value, | |
| 58 | __pred, | |
| 59 | __proj, | |
| 60 | __size); | |
| 56 | auto __ret = std::__search_n_random_access_impl<_RangeAlgPolicy>( | |
| 57 | __first, __last, __count, __value, __pred, __proj, __size); | |
| 61 | 58 | return {std::move(__ret.first), std::move(__ret.second)}; |
| 62 | 59 | } |
| 63 | 60 | } |
| ... | ... | @@ -75,7 +72,7 @@ struct __fn { |
| 75 | 72 | class _Pred = ranges::equal_to, |
| 76 | 73 | class _Proj = identity> |
| 77 | 74 | requires indirectly_comparable<_Iter, const _Type*, _Pred, _Proj> |
| 78 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 75 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 79 | 76 | subrange<_Iter> operator()(_Iter __first, _Sent __last, |
| 80 | 77 | iter_difference_t<_Iter> __count, |
| 81 | 78 | const _Type& __value, |
| ... | ... | @@ -86,7 +83,7 @@ struct __fn { |
| 86 | 83 | |
| 87 | 84 | template <forward_range _Range, class _Type, class _Pred = ranges::equal_to, class _Proj = identity> |
| 88 | 85 | requires indirectly_comparable<iterator_t<_Range>, const _Type*, _Pred, _Proj> |
| 89 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 86 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 90 | 87 | borrowed_subrange_t<_Range> operator()(_Range&& __range, |
| 91 | 88 | range_difference_t<_Range> __count, |
| 92 | 89 | const _Type& __value, |
| ... | ... | @@ -115,6 +112,6 @@ inline namespace __cpo { |
| 115 | 112 | |
| 116 | 113 | _LIBCPP_END_NAMESPACE_STD |
| 117 | 114 | |
| 118 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 115 | #endif // _LIBCPP_STD_VER > 17 | |
| 119 | 116 | |
| 120 | 117 | #endif // _LIBCPP___ALGORITHM_RANGES_SEARCH_N_H |
lib/libcxx/include/__algorithm/ranges_set_difference.h+7-5| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | #define _LIBCPP___ALGORITHM_RANGES_SET_DIFFERENCE_H |
| 11 | 11 | |
| 12 | 12 | #include <__algorithm/in_out_result.h> |
| 13 | #include <__algorithm/iterator_operations.h> | |
| 13 | 14 | #include <__algorithm/make_projected.h> |
| 14 | 15 | #include <__algorithm/set_difference.h> |
| 15 | 16 | #include <__config> |
| ... | ... | @@ -23,12 +24,13 @@ |
| 23 | 24 | #include <__ranges/dangling.h> |
| 24 | 25 | #include <__type_traits/decay.h> |
| 25 | 26 | #include <__utility/move.h> |
| 27 | #include <__utility/pair.h> | |
| 26 | 28 | |
| 27 | 29 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 28 | 30 | # pragma GCC system_header |
| 29 | 31 | #endif |
| 30 | 32 | |
| 31 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 33 | #if _LIBCPP_STD_VER > 17 | |
| 32 | 34 | |
| 33 | 35 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 34 | 36 | |
| ... | ... | @@ -59,7 +61,7 @@ struct __fn { |
| 59 | 61 | _Comp __comp = {}, |
| 60 | 62 | _Proj1 __proj1 = {}, |
| 61 | 63 | _Proj2 __proj2 = {}) const { |
| 62 | auto __ret = std::__set_difference( | |
| 64 | auto __ret = std::__set_difference<_RangeAlgPolicy>( | |
| 63 | 65 | __first1, __last1, __first2, __last2, __result, ranges::__make_projected_comp(__comp, __proj1, __proj2)); |
| 64 | 66 | return {std::move(__ret.first), std::move(__ret.second)}; |
| 65 | 67 | } |
| ... | ... | @@ -71,7 +73,7 @@ struct __fn { |
| 71 | 73 | class _Comp = less, |
| 72 | 74 | class _Proj1 = identity, |
| 73 | 75 | class _Proj2 = identity> |
| 74 | requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2> | |
| 76 | requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2> | |
| 75 | 77 | _LIBCPP_HIDE_FROM_ABI constexpr set_difference_result<borrowed_iterator_t<_Range1>, _OutIter> |
| 76 | 78 | operator()( |
| 77 | 79 | _Range1&& __range1, |
| ... | ... | @@ -80,7 +82,7 @@ struct __fn { |
| 80 | 82 | _Comp __comp = {}, |
| 81 | 83 | _Proj1 __proj1 = {}, |
| 82 | 84 | _Proj2 __proj2 = {}) const { |
| 83 | auto __ret = std::__set_difference( | |
| 85 | auto __ret = std::__set_difference<_RangeAlgPolicy>( | |
| 84 | 86 | ranges::begin(__range1), |
| 85 | 87 | ranges::end(__range1), |
| 86 | 88 | ranges::begin(__range2), |
| ... | ... | @@ -100,5 +102,5 @@ inline namespace __cpo { |
| 100 | 102 | |
| 101 | 103 | _LIBCPP_END_NAMESPACE_STD |
| 102 | 104 | |
| 103 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 105 | #endif // _LIBCPP_STD_VER > 17 | |
| 104 | 106 | #endif // _LIBCPP___ALGORITHM_RANGES_SET_DIFFERENCE_H |
lib/libcxx/include/__algorithm/ranges_set_intersection.h+3-3| ... | ... | @@ -28,7 +28,7 @@ |
| 28 | 28 | # pragma GCC system_header |
| 29 | 29 | #endif |
| 30 | 30 | |
| 31 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 31 | #if _LIBCPP_STD_VER > 17 | |
| 32 | 32 | |
| 33 | 33 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 34 | 34 | |
| ... | ... | @@ -82,7 +82,7 @@ struct __fn { |
| 82 | 82 | _OutIter, |
| 83 | 83 | _Comp, |
| 84 | 84 | _Proj1, |
| 85 | _Proj2> | |
| 85 | _Proj2> | |
| 86 | 86 | _LIBCPP_HIDE_FROM_ABI constexpr set_intersection_result<borrowed_iterator_t<_Range1>, |
| 87 | 87 | borrowed_iterator_t<_Range2>, |
| 88 | 88 | _OutIter> |
| ... | ... | @@ -113,5 +113,5 @@ inline namespace __cpo { |
| 113 | 113 | |
| 114 | 114 | _LIBCPP_END_NAMESPACE_STD |
| 115 | 115 | |
| 116 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 116 | #endif // _LIBCPP_STD_VER > 17 | |
| 117 | 117 | #endif // _LIBCPP___ALGORITHM_RANGES_SET_INTERSECTION_H |
lib/libcxx/include/__algorithm/ranges_set_symmetric_difference.h+6-5| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | #define _LIBCPP___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H |
| 11 | 11 | |
| 12 | 12 | #include <__algorithm/in_in_out_result.h> |
| 13 | #include <__algorithm/iterator_operations.h> | |
| 13 | 14 | #include <__algorithm/make_projected.h> |
| 14 | 15 | #include <__algorithm/set_symmetric_difference.h> |
| 15 | 16 | #include <__config> |
| ... | ... | @@ -27,7 +28,7 @@ |
| 27 | 28 | # pragma GCC system_header |
| 28 | 29 | #endif |
| 29 | 30 | |
| 30 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 31 | #if _LIBCPP_STD_VER > 17 | |
| 31 | 32 | |
| 32 | 33 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 34 | |
| ... | ... | @@ -58,7 +59,7 @@ struct __fn { |
| 58 | 59 | _Comp __comp = {}, |
| 59 | 60 | _Proj1 __proj1 = {}, |
| 60 | 61 | _Proj2 __proj2 = {}) const { |
| 61 | auto __ret = std::__set_symmetric_difference( | |
| 62 | auto __ret = std::__set_symmetric_difference<_RangeAlgPolicy>( | |
| 62 | 63 | std::move(__first1), |
| 63 | 64 | std::move(__last1), |
| 64 | 65 | std::move(__first2), |
| ... | ... | @@ -81,7 +82,7 @@ struct __fn { |
| 81 | 82 | _OutIter, |
| 82 | 83 | _Comp, |
| 83 | 84 | _Proj1, |
| 84 | _Proj2> | |
| 85 | _Proj2> | |
| 85 | 86 | _LIBCPP_HIDE_FROM_ABI constexpr set_symmetric_difference_result<borrowed_iterator_t<_Range1>, |
| 86 | 87 | borrowed_iterator_t<_Range2>, |
| 87 | 88 | _OutIter> |
| ... | ... | @@ -92,7 +93,7 @@ struct __fn { |
| 92 | 93 | _Comp __comp = {}, |
| 93 | 94 | _Proj1 __proj1 = {}, |
| 94 | 95 | _Proj2 __proj2 = {}) const { |
| 95 | auto __ret = std::__set_symmetric_difference( | |
| 96 | auto __ret = std::__set_symmetric_difference<_RangeAlgPolicy>( | |
| 96 | 97 | ranges::begin(__range1), |
| 97 | 98 | ranges::end(__range1), |
| 98 | 99 | ranges::begin(__range2), |
| ... | ... | @@ -112,5 +113,5 @@ inline namespace __cpo { |
| 112 | 113 | |
| 113 | 114 | _LIBCPP_END_NAMESPACE_STD |
| 114 | 115 | |
| 115 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 116 | #endif // _LIBCPP_STD_VER > 17 | |
| 116 | 117 | #endif // _LIBCPP___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H |
lib/libcxx/include/__algorithm/ranges_set_union.h+6-5| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | #define _LIBCPP___ALGORITHM_RANGES_SET_UNION_H |
| 11 | 11 | |
| 12 | 12 | #include <__algorithm/in_in_out_result.h> |
| 13 | #include <__algorithm/iterator_operations.h> | |
| 13 | 14 | #include <__algorithm/make_projected.h> |
| 14 | 15 | #include <__algorithm/set_union.h> |
| 15 | 16 | #include <__config> |
| ... | ... | @@ -30,7 +31,7 @@ |
| 30 | 31 | # pragma GCC system_header |
| 31 | 32 | #endif |
| 32 | 33 | |
| 33 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 34 | #if _LIBCPP_STD_VER > 17 | |
| 34 | 35 | |
| 35 | 36 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 36 | 37 | |
| ... | ... | @@ -61,7 +62,7 @@ struct __fn { |
| 61 | 62 | _Comp __comp = {}, |
| 62 | 63 | _Proj1 __proj1 = {}, |
| 63 | 64 | _Proj2 __proj2 = {}) const { |
| 64 | auto __ret = std::__set_union( | |
| 65 | auto __ret = std::__set_union<_RangeAlgPolicy>( | |
| 65 | 66 | std::move(__first1), |
| 66 | 67 | std::move(__last1), |
| 67 | 68 | std::move(__first2), |
| ... | ... | @@ -84,7 +85,7 @@ struct __fn { |
| 84 | 85 | _OutIter, |
| 85 | 86 | _Comp, |
| 86 | 87 | _Proj1, |
| 87 | _Proj2> | |
| 88 | _Proj2> | |
| 88 | 89 | _LIBCPP_HIDE_FROM_ABI constexpr set_union_result<borrowed_iterator_t<_Range1>, |
| 89 | 90 | borrowed_iterator_t<_Range2>, |
| 90 | 91 | _OutIter> |
| ... | ... | @@ -95,7 +96,7 @@ struct __fn { |
| 95 | 96 | _Comp __comp = {}, |
| 96 | 97 | _Proj1 __proj1 = {}, |
| 97 | 98 | _Proj2 __proj2 = {}) const { |
| 98 | auto __ret = std::__set_union( | |
| 99 | auto __ret = std::__set_union<_RangeAlgPolicy>( | |
| 99 | 100 | ranges::begin(__range1), |
| 100 | 101 | ranges::end(__range1), |
| 101 | 102 | ranges::begin(__range2), |
| ... | ... | @@ -115,6 +116,6 @@ inline namespace __cpo { |
| 115 | 116 | |
| 116 | 117 | _LIBCPP_END_NAMESPACE_STD |
| 117 | 118 | |
| 118 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 119 | #endif // _LIBCPP_STD_VER > 17 | |
| 119 | 120 | |
| 120 | 121 | #endif // _LIBCPP___ALGORITHM_RANGES_SET_UNION_H |
lib/libcxx/include/__algorithm/ranges_shuffle.h+2-2| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | # pragma GCC system_header |
| 32 | 32 | #endif |
| 33 | 33 | |
| 34 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 34 | #if _LIBCPP_STD_VER > 17 | |
| 35 | 35 | |
| 36 | 36 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 37 | 37 | |
| ... | ... | @@ -66,6 +66,6 @@ inline namespace __cpo { |
| 66 | 66 | |
| 67 | 67 | _LIBCPP_END_NAMESPACE_STD |
| 68 | 68 | |
| 69 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 69 | #endif // _LIBCPP_STD_VER > 17 | |
| 70 | 70 | |
| 71 | 71 | #endif // _LIBCPP___ALGORITHM_RANGES_SHUFFLE_H |
lib/libcxx/include/__algorithm/ranges_sort.h+2-2| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | # pragma GCC system_header |
| 32 | 32 | #endif |
| 33 | 33 | |
| 34 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 34 | #if _LIBCPP_STD_VER > 17 | |
| 35 | 35 | |
| 36 | 36 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 37 | 37 | |
| ... | ... | @@ -74,6 +74,6 @@ inline namespace __cpo { |
| 74 | 74 | |
| 75 | 75 | _LIBCPP_END_NAMESPACE_STD |
| 76 | 76 | |
| 77 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 77 | #endif // _LIBCPP_STD_VER > 17 | |
| 78 | 78 | |
| 79 | 79 | #endif // _LIBCPP___ALGORITHM_RANGES_SORT_H |
lib/libcxx/include/__algorithm/ranges_sort_heap.h+2-2| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | # pragma GCC system_header |
| 33 | 33 | #endif |
| 34 | 34 | |
| 35 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 35 | #if _LIBCPP_STD_VER > 17 | |
| 36 | 36 | |
| 37 | 37 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 38 | 38 | |
| ... | ... | @@ -75,6 +75,6 @@ inline namespace __cpo { |
| 75 | 75 | |
| 76 | 76 | _LIBCPP_END_NAMESPACE_STD |
| 77 | 77 | |
| 78 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 78 | #endif // _LIBCPP_STD_VER > 17 | |
| 79 | 79 | |
| 80 | 80 | #endif // _LIBCPP___ALGORITHM_RANGES_SORT_HEAP_H |
lib/libcxx/include/__algorithm/ranges_stable_partition.h+3-3| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | # pragma GCC system_header |
| 35 | 35 | #endif |
| 36 | 36 | |
| 37 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 37 | #if _LIBCPP_STD_VER > 17 | |
| 38 | 38 | |
| 39 | 39 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 40 | 40 | |
| ... | ... | @@ -45,7 +45,7 @@ struct __fn { |
| 45 | 45 | |
| 46 | 46 | template <class _Iter, class _Sent, class _Proj, class _Pred> |
| 47 | 47 | _LIBCPP_HIDE_FROM_ABI static |
| 48 | subrange<__uncvref_t<_Iter>> __stable_partition_fn_impl( | |
| 48 | subrange<__remove_cvref_t<_Iter>> __stable_partition_fn_impl( | |
| 49 | 49 | _Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) { |
| 50 | 50 | auto __last_iter = ranges::next(__first, __last); |
| 51 | 51 | |
| ... | ... | @@ -83,6 +83,6 @@ inline namespace __cpo { |
| 83 | 83 | |
| 84 | 84 | _LIBCPP_END_NAMESPACE_STD |
| 85 | 85 | |
| 86 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 86 | #endif // _LIBCPP_STD_VER > 17 | |
| 87 | 87 | |
| 88 | 88 | #endif // _LIBCPP___ALGORITHM_RANGES_STABLE_PARTITION_H |
lib/libcxx/include/__algorithm/ranges_stable_sort.h+2-2| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | # pragma GCC system_header |
| 32 | 32 | #endif |
| 33 | 33 | |
| 34 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 34 | #if _LIBCPP_STD_VER > 17 | |
| 35 | 35 | |
| 36 | 36 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 37 | 37 | |
| ... | ... | @@ -74,6 +74,6 @@ inline namespace __cpo { |
| 74 | 74 | |
| 75 | 75 | _LIBCPP_END_NAMESPACE_STD |
| 76 | 76 | |
| 77 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 77 | #endif // _LIBCPP_STD_VER > 17 | |
| 78 | 78 | |
| 79 | 79 | #endif // _LIBCPP___ALGORITHM_RANGES_STABLE_SORT_H |
lib/libcxx/include/__algorithm/ranges_swap_ranges.h+2-2| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | # pragma GCC system_header |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| ... | ... | @@ -63,6 +63,6 @@ inline namespace __cpo { |
| 63 | 63 | |
| 64 | 64 | _LIBCPP_END_NAMESPACE_STD |
| 65 | 65 | |
| 66 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 66 | #endif // _LIBCPP_STD_VER > 17 | |
| 67 | 67 | |
| 68 | 68 | #endif // _LIBCPP___ALGORITHM_RANGES_SWAP_RANGES_H |
lib/libcxx/include/__algorithm/ranges_transform.h+2-2| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | # pragma GCC system_header |
| 27 | 27 | #endif |
| 28 | 28 | |
| 29 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 30 | 30 | |
| 31 | 31 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 32 | 32 | |
| ... | ... | @@ -165,6 +165,6 @@ inline namespace __cpo { |
| 165 | 165 | |
| 166 | 166 | _LIBCPP_END_NAMESPACE_STD |
| 167 | 167 | |
| 168 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 168 | #endif // _LIBCPP_STD_VER > 17 | |
| 169 | 169 | |
| 170 | 170 | #endif // _LIBCPP___ALGORITHM_RANGES_TRANSFORM_H |
lib/libcxx/include/__algorithm/ranges_unique.h+5-4| ... | ... | @@ -26,12 +26,13 @@ |
| 26 | 26 | #include <__ranges/subrange.h> |
| 27 | 27 | #include <__utility/forward.h> |
| 28 | 28 | #include <__utility/move.h> |
| 29 | #include <__utility/pair.h> | |
| 29 | 30 | |
| 30 | 31 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 31 | 32 | # pragma GCC system_header |
| 32 | 33 | #endif |
| 33 | 34 | |
| 34 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 35 | #if _LIBCPP_STD_VER > 17 | |
| 35 | 36 | |
| 36 | 37 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 37 | 38 | |
| ... | ... | @@ -44,7 +45,7 @@ namespace __unique { |
| 44 | 45 | sentinel_for<_Iter> _Sent, |
| 45 | 46 | class _Proj = identity, |
| 46 | 47 | indirect_equivalence_relation<projected<_Iter, _Proj>> _Comp = ranges::equal_to> |
| 47 | _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter> | |
| 48 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter> | |
| 48 | 49 | operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const { |
| 49 | 50 | auto __ret = std::__unique<_RangeAlgPolicy>( |
| 50 | 51 | std::move(__first), std::move(__last), std::__make_projected(__comp, __proj)); |
| ... | ... | @@ -56,7 +57,7 @@ namespace __unique { |
| 56 | 57 | class _Proj = identity, |
| 57 | 58 | indirect_equivalence_relation<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::equal_to> |
| 58 | 59 | requires permutable<iterator_t<_Range>> |
| 59 | _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range> | |
| 60 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range> | |
| 60 | 61 | operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const { |
| 61 | 62 | auto __ret = std::__unique<_RangeAlgPolicy>( |
| 62 | 63 | ranges::begin(__range), ranges::end(__range), std::__make_projected(__comp, __proj)); |
| ... | ... | @@ -73,6 +74,6 @@ inline namespace __cpo { |
| 73 | 74 | |
| 74 | 75 | _LIBCPP_END_NAMESPACE_STD |
| 75 | 76 | |
| 76 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 77 | #endif // _LIBCPP_STD_VER > 17 | |
| 77 | 78 | |
| 78 | 79 | #endif // _LIBCPP___ALGORITHM_RANGES_UNIQUE_H |
lib/libcxx/include/__algorithm/ranges_unique_copy.h+3-2| ... | ... | @@ -27,12 +27,13 @@ |
| 27 | 27 | #include <__ranges/dangling.h> |
| 28 | 28 | #include <__utility/forward.h> |
| 29 | 29 | #include <__utility/move.h> |
| 30 | #include <__utility/pair.h> | |
| 30 | 31 | |
| 31 | 32 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 32 | 33 | # pragma GCC system_header |
| 33 | 34 | #endif |
| 34 | 35 | |
| 35 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 36 | #if _LIBCPP_STD_VER > 17 | |
| 36 | 37 | |
| 37 | 38 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 38 | 39 | |
| ... | ... | @@ -110,6 +111,6 @@ inline constexpr auto unique_copy = __unique_copy::__fn{}; |
| 110 | 111 | |
| 111 | 112 | _LIBCPP_END_NAMESPACE_STD |
| 112 | 113 | |
| 113 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 114 | #endif // _LIBCPP_STD_VER > 17 | |
| 114 | 115 | |
| 115 | 116 | #endif // _LIBCPP___ALGORITHM_RANGES_UNIQUE_COPY_H |
lib/libcxx/include/__algorithm/ranges_upper_bound.h+4-4| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | # pragma GCC system_header |
| 26 | 26 | #endif |
| 27 | 27 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 28 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 31 | |
| ... | ... | @@ -34,7 +34,7 @@ namespace __upper_bound { |
| 34 | 34 | struct __fn { |
| 35 | 35 | template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity, |
| 36 | 36 | indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less> |
| 37 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 37 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 38 | 38 | _Iter operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const { |
| 39 | 39 | auto __comp_lhs_rhs_swapped = [&](const auto& __lhs, const auto& __rhs) { |
| 40 | 40 | return !std::invoke(__comp, __rhs, __lhs); |
| ... | ... | @@ -45,7 +45,7 @@ struct __fn { |
| 45 | 45 | |
| 46 | 46 | template <forward_range _Range, class _Type, class _Proj = identity, |
| 47 | 47 | indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> |
| 48 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 48 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr | |
| 49 | 49 | borrowed_iterator_t<_Range> operator()(_Range&& __r, |
| 50 | 50 | const _Type& __value, |
| 51 | 51 | _Comp __comp = {}, |
| ... | ... | @@ -70,6 +70,6 @@ inline namespace __cpo { |
| 70 | 70 | |
| 71 | 71 | _LIBCPP_END_NAMESPACE_STD |
| 72 | 72 | |
| 73 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 73 | #endif // _LIBCPP_STD_VER > 17 | |
| 74 | 74 | |
| 75 | 75 | #endif // _LIBCPP___ALGORITHM_RANGES_UPPER_BOUND_H |
lib/libcxx/include/__algorithm/remove.h+1-1| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | template <class _ForwardIterator, class _Tp> |
| 24 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 24 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 25 | 25 | remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) |
| 26 | 26 | { |
| 27 | 27 | __first = _VSTD::find(__first, __last, __value); |
lib/libcxx/include/__algorithm/remove_copy.h+1-1| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | 20 | template <class _InputIterator, class _OutputIterator, class _Tp> |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 22 | 22 | _OutputIterator |
| 23 | 23 | remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value) |
| 24 | 24 | { |
lib/libcxx/include/__algorithm/remove_copy_if.h+1-1| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | 20 | template <class _InputIterator, class _OutputIterator, class _Predicate> |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 22 | 22 | _OutputIterator |
| 23 | 23 | remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) |
| 24 | 24 | { |
lib/libcxx/include/__algorithm/remove_if.h+1-1| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | 22 | template <class _ForwardIterator, class _Predicate> |
| 23 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 23 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 24 | 24 | remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) |
| 25 | 25 | { |
| 26 | 26 | __first = _VSTD::find_if<_ForwardIterator, _Predicate&>(__first, __last, __pred); |
lib/libcxx/include/__algorithm/replace.h+1-1| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | 20 | template <class _ForwardIterator, class _Tp> |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 22 | 22 | void |
| 23 | 23 | replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value, const _Tp& __new_value) |
| 24 | 24 | { |
lib/libcxx/include/__algorithm/replace_copy.h+1-1| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | 20 | template <class _InputIterator, class _OutputIterator, class _Tp> |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 22 | 22 | _OutputIterator |
| 23 | 23 | replace_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, |
| 24 | 24 | const _Tp& __old_value, const _Tp& __new_value) |
lib/libcxx/include/__algorithm/replace_copy_if.h+1-1| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | 20 | template <class _InputIterator, class _OutputIterator, class _Predicate, class _Tp> |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 22 | 22 | _OutputIterator |
| 23 | 23 | replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, |
| 24 | 24 | _Predicate __pred, const _Tp& __new_value) |
lib/libcxx/include/__algorithm/replace_if.h+1-1| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | 20 | template <class _ForwardIterator, class _Predicate, class _Tp> |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 22 | 22 | void |
| 23 | 23 | replace_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, const _Tp& __new_value) |
| 24 | 24 | { |
lib/libcxx/include/__algorithm/reverse.h+4-4| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | |
| 24 | 24 | template <class _AlgPolicy, class _BidirectionalIterator> |
| 25 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 25 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 26 | 26 | void |
| 27 | 27 | __reverse_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirectional_iterator_tag) |
| 28 | 28 | { |
| ... | ... | @@ -36,7 +36,7 @@ __reverse_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, bi |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | template <class _AlgPolicy, class _RandomAccessIterator> |
| 39 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 39 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 40 | 40 | void |
| 41 | 41 | __reverse_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag) |
| 42 | 42 | { |
| ... | ... | @@ -46,14 +46,14 @@ __reverse_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, rand |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | template <class _AlgPolicy, class _BidirectionalIterator, class _Sentinel> |
| 49 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 49 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 50 | 50 | void __reverse(_BidirectionalIterator __first, _Sentinel __last) { |
| 51 | 51 | using _IterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_BidirectionalIterator>; |
| 52 | 52 | std::__reverse_impl<_AlgPolicy>(std::move(__first), std::move(__last), _IterCategory()); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | template <class _BidirectionalIterator> |
| 56 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 56 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 57 | 57 | void |
| 58 | 58 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) |
| 59 | 59 | { |
lib/libcxx/include/__algorithm/reverse_copy.h+1-1| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | 20 | template <class _BidirectionalIterator, class _OutputIterator> |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 22 | 22 | _OutputIterator |
| 23 | 23 | reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) |
| 24 | 24 | { |
lib/libcxx/include/__algorithm/rotate.h+11-11| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 27 | |
| 28 | 28 | template <class _AlgPolicy, class _ForwardIterator> |
| 29 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator | |
| 29 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator | |
| 30 | 30 | __rotate_left(_ForwardIterator __first, _ForwardIterator __last) |
| 31 | 31 | { |
| 32 | 32 | typedef typename iterator_traits<_ForwardIterator>::value_type value_type; |
| ... | ... | @@ -40,7 +40,7 @@ __rotate_left(_ForwardIterator __first, _ForwardIterator __last) |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | template <class _AlgPolicy, class _BidirectionalIterator> |
| 43 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _BidirectionalIterator | |
| 43 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _BidirectionalIterator | |
| 44 | 44 | __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) |
| 45 | 45 | { |
| 46 | 46 | typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; |
| ... | ... | @@ -48,13 +48,13 @@ __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) |
| 48 | 48 | |
| 49 | 49 | _BidirectionalIterator __lm1 = _Ops::prev(__last); |
| 50 | 50 | value_type __tmp = _Ops::__iter_move(__lm1); |
| 51 | _BidirectionalIterator __fp1 = std::__move_backward<_AlgPolicy>(__first, __lm1, std::move(__last)); | |
| 51 | _BidirectionalIterator __fp1 = std::__move_backward<_AlgPolicy>(__first, __lm1, std::move(__last)).second; | |
| 52 | 52 | *__first = _VSTD::move(__tmp); |
| 53 | 53 | return __fp1; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | template <class _AlgPolicy, class _ForwardIterator> |
| 57 | _LIBCPP_CONSTEXPR_AFTER_CXX14 _ForwardIterator | |
| 57 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _ForwardIterator | |
| 58 | 58 | __rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) |
| 59 | 59 | { |
| 60 | 60 | _ForwardIterator __i = __middle; |
| ... | ... | @@ -90,7 +90,7 @@ __rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIt |
| 90 | 90 | |
| 91 | 91 | template<typename _Integral> |
| 92 | 92 | inline _LIBCPP_INLINE_VISIBILITY |
| 93 | _LIBCPP_CONSTEXPR_AFTER_CXX14 _Integral | |
| 93 | _LIBCPP_CONSTEXPR_SINCE_CXX17 _Integral | |
| 94 | 94 | __algo_gcd(_Integral __x, _Integral __y) |
| 95 | 95 | { |
| 96 | 96 | do |
| ... | ... | @@ -103,7 +103,7 @@ __algo_gcd(_Integral __x, _Integral __y) |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | template <class _AlgPolicy, typename _RandomAccessIterator> |
| 106 | _LIBCPP_CONSTEXPR_AFTER_CXX14 _RandomAccessIterator | |
| 106 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _RandomAccessIterator | |
| 107 | 107 | __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) |
| 108 | 108 | { |
| 109 | 109 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; |
| ... | ... | @@ -140,7 +140,7 @@ __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran |
| 140 | 140 | |
| 141 | 141 | template <class _AlgPolicy, class _ForwardIterator> |
| 142 | 142 | inline _LIBCPP_INLINE_VISIBILITY |
| 143 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator | |
| 143 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator | |
| 144 | 144 | __rotate_impl(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, |
| 145 | 145 | _VSTD::forward_iterator_tag) |
| 146 | 146 | { |
| ... | ... | @@ -155,7 +155,7 @@ __rotate_impl(_ForwardIterator __first, _ForwardIterator __middle, _ForwardItera |
| 155 | 155 | |
| 156 | 156 | template <class _AlgPolicy, class _BidirectionalIterator> |
| 157 | 157 | inline _LIBCPP_INLINE_VISIBILITY |
| 158 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _BidirectionalIterator | |
| 158 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _BidirectionalIterator | |
| 159 | 159 | __rotate_impl(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, |
| 160 | 160 | bidirectional_iterator_tag) |
| 161 | 161 | { |
| ... | ... | @@ -172,7 +172,7 @@ __rotate_impl(_BidirectionalIterator __first, _BidirectionalIterator __middle, _ |
| 172 | 172 | |
| 173 | 173 | template <class _AlgPolicy, class _RandomAccessIterator> |
| 174 | 174 | inline _LIBCPP_INLINE_VISIBILITY |
| 175 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator | |
| 175 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator | |
| 176 | 176 | __rotate_impl(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, |
| 177 | 177 | random_access_iterator_tag) |
| 178 | 178 | { |
| ... | ... | @@ -189,7 +189,7 @@ __rotate_impl(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ra |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | template <class _AlgPolicy, class _Iterator, class _Sentinel> |
| 192 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 192 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 193 | 193 | pair<_Iterator, _Iterator> |
| 194 | 194 | __rotate(_Iterator __first, _Iterator __middle, _Sentinel __last) { |
| 195 | 195 | using _Ret = pair<_Iterator, _Iterator>; |
| ... | ... | @@ -209,7 +209,7 @@ __rotate(_Iterator __first, _Iterator __middle, _Sentinel __last) { |
| 209 | 209 | |
| 210 | 210 | template <class _ForwardIterator> |
| 211 | 211 | inline _LIBCPP_INLINE_VISIBILITY |
| 212 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 212 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 213 | 213 | rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) |
| 214 | 214 | { |
| 215 | 215 | return std::__rotate<_ClassicAlgPolicy>( |
lib/libcxx/include/__algorithm/rotate_copy.h+1-1| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _ForwardIterator, class _OutputIterator> |
| 22 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 22 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 23 | 23 | _OutputIterator |
| 24 | 24 | rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result) |
| 25 | 25 | { |
lib/libcxx/include/__algorithm/search.h+8-10| ... | ... | @@ -33,7 +33,7 @@ template <class _AlgPolicy, |
| 33 | 33 | class _Pred, |
| 34 | 34 | class _Proj1, |
| 35 | 35 | class _Proj2> |
| 36 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 36 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 37 | 37 | pair<_Iter1, _Iter1> __search_forward_impl(_Iter1 __first1, _Sent1 __last1, |
| 38 | 38 | _Iter2 __first2, _Sent2 __last2, |
| 39 | 39 | _Pred& __pred, |
| ... | ... | @@ -80,7 +80,7 @@ template <class _AlgPolicy, |
| 80 | 80 | class _Proj2, |
| 81 | 81 | class _DiffT1, |
| 82 | 82 | class _DiffT2> |
| 83 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 83 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 84 | 84 | pair<_Iter1, _Iter1> __search_random_access_impl(_Iter1 __first1, _Sent1 __last1, |
| 85 | 85 | _Iter2 __first2, _Sent2 __last2, |
| 86 | 86 | _Pred& __pred, |
| ... | ... | @@ -120,7 +120,7 @@ template <class _Iter1, class _Sent1, |
| 120 | 120 | class _Pred, |
| 121 | 121 | class _Proj1, |
| 122 | 122 | class _Proj2> |
| 123 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 123 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 124 | 124 | pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1, |
| 125 | 125 | _Iter2 __first2, _Sent2 __last2, |
| 126 | 126 | _Pred& __pred, |
| ... | ... | @@ -152,7 +152,7 @@ template <class _Iter1, class _Sent1, |
| 152 | 152 | class _Pred, |
| 153 | 153 | class _Proj1, |
| 154 | 154 | class _Proj2> |
| 155 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 155 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 156 | 156 | pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1, |
| 157 | 157 | _Iter2 __first2, _Sent2 __last2, |
| 158 | 158 | _Pred& __pred, |
| ... | ... | @@ -170,7 +170,7 @@ pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1, |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> |
| 173 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 173 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 174 | 174 | _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, |
| 175 | 175 | _ForwardIterator2 __first2, _ForwardIterator2 __last2, |
| 176 | 176 | _BinaryPredicate __pred) { |
| ... | ... | @@ -181,17 +181,15 @@ _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | template <class _ForwardIterator1, class _ForwardIterator2> |
| 184 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 184 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 185 | 185 | _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, |
| 186 | 186 | _ForwardIterator2 __first2, _ForwardIterator2 __last2) { |
| 187 | using __v1 = typename iterator_traits<_ForwardIterator1>::value_type; | |
| 188 | using __v2 = typename iterator_traits<_ForwardIterator2>::value_type; | |
| 189 | return std::search(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); | |
| 187 | return std::search(__first1, __last1, __first2, __last2, __equal_to()); | |
| 190 | 188 | } |
| 191 | 189 | |
| 192 | 190 | #if _LIBCPP_STD_VER > 14 |
| 193 | 191 | template <class _ForwardIterator, class _Searcher> |
| 194 | _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 192 | _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 195 | 193 | search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher& __s) { |
| 196 | 194 | return __s(__f, __l).first; |
| 197 | 195 | } |
lib/libcxx/include/__algorithm/search_n.h+8-8| ... | ... | @@ -19,6 +19,7 @@ |
| 19 | 19 | #include <__iterator/distance.h> |
| 20 | 20 | #include <__iterator/iterator_traits.h> |
| 21 | 21 | #include <__ranges/concepts.h> |
| 22 | #include <__utility/convert_to_integral.h> | |
| 22 | 23 | #include <__utility/pair.h> |
| 23 | 24 | #include <type_traits> // __convert_to_integral |
| 24 | 25 | |
| ... | ... | @@ -29,7 +30,7 @@ |
| 29 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 31 | |
| 31 | 32 | template <class _AlgPolicy, class _Pred, class _Iter, class _Sent, class _SizeT, class _Type, class _Proj> |
| 32 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 33 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 33 | 34 | pair<_Iter, _Iter> __search_n_forward_impl(_Iter __first, _Sent __last, |
| 34 | 35 | _SizeT __count, |
| 35 | 36 | const _Type& __value, |
| ... | ... | @@ -71,7 +72,7 @@ pair<_Iter, _Iter> __search_n_forward_impl(_Iter __first, _Sent __last, |
| 71 | 72 | } |
| 72 | 73 | |
| 73 | 74 | template <class _AlgPolicy, class _Pred, class _Iter, class _Sent, class _SizeT, class _Type, class _Proj, class _DiffT> |
| 74 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 75 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 75 | 76 | std::pair<_Iter, _Iter> __search_n_random_access_impl(_Iter __first, _Sent __last, |
| 76 | 77 | _SizeT __count, |
| 77 | 78 | const _Type& __value, |
| ... | ... | @@ -122,7 +123,7 @@ template <class _Iter, class _Sent, |
| 122 | 123 | class _Type, |
| 123 | 124 | class _Pred, |
| 124 | 125 | class _Proj> |
| 125 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 126 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 126 | 127 | pair<_Iter, _Iter> __search_n_impl(_Iter __first, _Sent __last, |
| 127 | 128 | _DiffT __count, |
| 128 | 129 | const _Type& __value, |
| ... | ... | @@ -142,7 +143,7 @@ template <class _Iter1, class _Sent1, |
| 142 | 143 | class _Type, |
| 143 | 144 | class _Pred, |
| 144 | 145 | class _Proj> |
| 145 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 146 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 146 | 147 | pair<_Iter1, _Iter1> __search_n_impl(_Iter1 __first, _Sent1 __last, |
| 147 | 148 | _DiffT __count, |
| 148 | 149 | const _Type& __value, |
| ... | ... | @@ -158,7 +159,7 @@ pair<_Iter1, _Iter1> __search_n_impl(_Iter1 __first, _Sent1 __last, |
| 158 | 159 | } |
| 159 | 160 | |
| 160 | 161 | template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate> |
| 161 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 162 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 162 | 163 | _ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, |
| 163 | 164 | _Size __count, |
| 164 | 165 | const _Tp& __value, |
| ... | ... | @@ -170,10 +171,9 @@ _ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, |
| 170 | 171 | } |
| 171 | 172 | |
| 172 | 173 | template <class _ForwardIterator, class _Size, class _Tp> |
| 173 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 174 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 174 | 175 | _ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value) { |
| 175 | typedef typename iterator_traits<_ForwardIterator>::value_type __v; | |
| 176 | return std::search_n(__first, __last, std::__convert_to_integral(__count), __value, __equal_to<__v, _Tp>()); | |
| 176 | return std::search_n(__first, __last, std::__convert_to_integral(__count), __value, __equal_to()); | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/set_difference.h+10-8| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | #include <__algorithm/comp.h> |
| 13 | 13 | #include <__algorithm/comp_ref_type.h> |
| 14 | 14 | #include <__algorithm/copy.h> |
| 15 | #include <__algorithm/iterator_operations.h> | |
| 15 | 16 | #include <__config> |
| 16 | 17 | #include <__functional/identity.h> |
| 17 | 18 | #include <__functional/invoke.h> |
| ... | ... | @@ -26,8 +27,8 @@ |
| 26 | 27 | |
| 27 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 29 | |
| 29 | template < class _Comp, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> | |
| 30 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<__uncvref_t<_InIter1>, __uncvref_t<_OutIter> > | |
| 30 | template <class _AlgPolicy, class _Comp, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> | |
| 31 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__remove_cvref_t<_InIter1>, __remove_cvref_t<_OutIter> > | |
| 31 | 32 | __set_difference( |
| 32 | 33 | _InIter1&& __first1, _Sent1&& __last1, _InIter2&& __first2, _Sent2&& __last2, _OutIter&& __result, _Comp&& __comp) { |
| 33 | 34 | while (__first1 != __last1 && __first2 != __last2) { |
| ... | ... | @@ -42,29 +43,30 @@ __set_difference( |
| 42 | 43 | ++__first2; |
| 43 | 44 | } |
| 44 | 45 | } |
| 45 | return std::__copy(std::move(__first1), std::move(__last1), std::move(__result)); | |
| 46 | return std::__copy<_AlgPolicy>(std::move(__first1), std::move(__last1), std::move(__result)); | |
| 46 | 47 | } |
| 47 | 48 | |
| 48 | 49 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> |
| 49 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_difference( | |
| 50 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_difference( | |
| 50 | 51 | _InputIterator1 __first1, |
| 51 | 52 | _InputIterator1 __last1, |
| 52 | 53 | _InputIterator2 __first2, |
| 53 | 54 | _InputIterator2 __last2, |
| 54 | 55 | _OutputIterator __result, |
| 55 | 56 | _Compare __comp) { |
| 56 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 57 | return std::__set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp).second; | |
| 57 | return std::__set_difference<_ClassicAlgPolicy, __comp_ref_type<_Compare> >( | |
| 58 | __first1, __last1, __first2, __last2, __result, __comp) | |
| 59 | .second; | |
| 58 | 60 | } |
| 59 | 61 | |
| 60 | 62 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 61 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_difference( | |
| 63 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_difference( | |
| 62 | 64 | _InputIterator1 __first1, |
| 63 | 65 | _InputIterator1 __last1, |
| 64 | 66 | _InputIterator2 __first2, |
| 65 | 67 | _InputIterator2 __last2, |
| 66 | 68 | _OutputIterator __result) { |
| 67 | return std::__set_difference( | |
| 69 | return std::__set_difference<_ClassicAlgPolicy>( | |
| 68 | 70 | __first1, |
| 69 | 71 | __last1, |
| 70 | 72 | __first2, |
lib/libcxx/include/__algorithm/set_intersection.h+5-6| ... | ... | @@ -30,13 +30,13 @@ struct __set_intersection_result { |
| 30 | 30 | _OutIter __out_; |
| 31 | 31 | |
| 32 | 32 | // need a constructor as C++03 aggregate init is hard |
| 33 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 33 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 34 | 34 | __set_intersection_result(_InIter1&& __in_iter1, _InIter2&& __in_iter2, _OutIter&& __out_iter) |
| 35 | 35 | : __in1_(std::move(__in_iter1)), __in2_(std::move(__in_iter2)), __out_(std::move(__out_iter)) {} |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | 38 | template <class _AlgPolicy, class _Compare, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> |
| 39 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 __set_intersection_result<_InIter1, _InIter2, _OutIter> | |
| 39 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __set_intersection_result<_InIter1, _InIter2, _OutIter> | |
| 40 | 40 | __set_intersection( |
| 41 | 41 | _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Sent2 __last2, _OutIter __result, _Compare&& __comp) { |
| 42 | 42 | while (__first1 != __last1 && __first2 != __last2) { |
| ... | ... | @@ -59,15 +59,14 @@ __set_intersection( |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> |
| 62 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_intersection( | |
| 62 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_intersection( | |
| 63 | 63 | _InputIterator1 __first1, |
| 64 | 64 | _InputIterator1 __last1, |
| 65 | 65 | _InputIterator2 __first2, |
| 66 | 66 | _InputIterator2 __last2, |
| 67 | 67 | _OutputIterator __result, |
| 68 | 68 | _Compare __comp) { |
| 69 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 70 | return std::__set_intersection<_ClassicAlgPolicy, _Comp_ref>( | |
| 69 | return std::__set_intersection<_ClassicAlgPolicy, __comp_ref_type<_Compare> >( | |
| 71 | 70 | std::move(__first1), |
| 72 | 71 | std::move(__last1), |
| 73 | 72 | std::move(__first2), |
| ... | ... | @@ -78,7 +77,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_i |
| 78 | 77 | } |
| 79 | 78 | |
| 80 | 79 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 81 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_intersection( | |
| 80 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_intersection( | |
| 82 | 81 | _InputIterator1 __first1, |
| 83 | 82 | _InputIterator1 __last1, |
| 84 | 83 | _InputIterator2 __first2, |
lib/libcxx/include/__algorithm/set_symmetric_difference.h+10-9| ... | ... | @@ -12,9 +12,11 @@ |
| 12 | 12 | #include <__algorithm/comp.h> |
| 13 | 13 | #include <__algorithm/comp_ref_type.h> |
| 14 | 14 | #include <__algorithm/copy.h> |
| 15 | #include <__algorithm/iterator_operations.h> | |
| 15 | 16 | #include <__config> |
| 16 | 17 | #include <__iterator/iterator_traits.h> |
| 17 | 18 | #include <__utility/move.h> |
| 19 | #include <__utility/pair.h> | |
| 18 | 20 | |
| 19 | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | 22 | # pragma GCC system_header |
| ... | ... | @@ -29,18 +31,18 @@ struct __set_symmetric_difference_result { |
| 29 | 31 | _OutIter __out_; |
| 30 | 32 | |
| 31 | 33 | // need a constructor as C++03 aggregate init is hard |
| 32 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 34 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 33 | 35 | __set_symmetric_difference_result(_InIter1&& __in_iter1, _InIter2&& __in_iter2, _OutIter&& __out_iter) |
| 34 | 36 | : __in1_(std::move(__in_iter1)), __in2_(std::move(__in_iter2)), __out_(std::move(__out_iter)) {} |
| 35 | 37 | }; |
| 36 | 38 | |
| 37 | template <class _Compare, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> | |
| 38 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter> | |
| 39 | template <class _AlgPolicy, class _Compare, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> | |
| 40 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter> | |
| 39 | 41 | __set_symmetric_difference( |
| 40 | 42 | _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Sent2 __last2, _OutIter __result, _Compare&& __comp) { |
| 41 | 43 | while (__first1 != __last1) { |
| 42 | 44 | if (__first2 == __last2) { |
| 43 | auto __ret1 = std::__copy_impl(std::move(__first1), std::move(__last1), std::move(__result)); | |
| 45 | auto __ret1 = std::__copy<_AlgPolicy>(std::move(__first1), std::move(__last1), std::move(__result)); | |
| 44 | 46 | return __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter>( |
| 45 | 47 | std::move(__ret1.first), std::move(__first2), std::move((__ret1.second))); |
| 46 | 48 | } |
| ... | ... | @@ -58,21 +60,20 @@ __set_symmetric_difference( |
| 58 | 60 | ++__first2; |
| 59 | 61 | } |
| 60 | 62 | } |
| 61 | auto __ret2 = std::__copy_impl(std::move(__first2), std::move(__last2), std::move(__result)); | |
| 63 | auto __ret2 = std::__copy<_AlgPolicy>(std::move(__first2), std::move(__last2), std::move(__result)); | |
| 62 | 64 | return __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter>( |
| 63 | 65 | std::move(__first1), std::move(__ret2.first), std::move((__ret2.second))); |
| 64 | 66 | } |
| 65 | 67 | |
| 66 | 68 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> |
| 67 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_symmetric_difference( | |
| 69 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_symmetric_difference( | |
| 68 | 70 | _InputIterator1 __first1, |
| 69 | 71 | _InputIterator1 __last1, |
| 70 | 72 | _InputIterator2 __first2, |
| 71 | 73 | _InputIterator2 __last2, |
| 72 | 74 | _OutputIterator __result, |
| 73 | 75 | _Compare __comp) { |
| 74 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 75 | return std::__set_symmetric_difference<_Comp_ref>( | |
| 76 | return std::__set_symmetric_difference<_ClassicAlgPolicy, __comp_ref_type<_Compare> >( | |
| 76 | 77 | std::move(__first1), |
| 77 | 78 | std::move(__last1), |
| 78 | 79 | std::move(__first2), |
| ... | ... | @@ -83,7 +84,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_symmetri |
| 83 | 84 | } |
| 84 | 85 | |
| 85 | 86 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 86 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_symmetric_difference( | |
| 87 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_symmetric_difference( | |
| 87 | 88 | _InputIterator1 __first1, |
| 88 | 89 | _InputIterator1 __last1, |
| 89 | 90 | _InputIterator2 __first2, |
lib/libcxx/include/__algorithm/set_union.h+10-9| ... | ... | @@ -12,9 +12,11 @@ |
| 12 | 12 | #include <__algorithm/comp.h> |
| 13 | 13 | #include <__algorithm/comp_ref_type.h> |
| 14 | 14 | #include <__algorithm/copy.h> |
| 15 | #include <__algorithm/iterator_operations.h> | |
| 15 | 16 | #include <__config> |
| 16 | 17 | #include <__iterator/iterator_traits.h> |
| 17 | 18 | #include <__utility/move.h> |
| 19 | #include <__utility/pair.h> | |
| 18 | 20 | |
| 19 | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | 22 | # pragma GCC system_header |
| ... | ... | @@ -29,17 +31,17 @@ struct __set_union_result { |
| 29 | 31 | _OutIter __out_; |
| 30 | 32 | |
| 31 | 33 | // need a constructor as C++03 aggregate init is hard |
| 32 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 34 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 33 | 35 | __set_union_result(_InIter1&& __in_iter1, _InIter2&& __in_iter2, _OutIter&& __out_iter) |
| 34 | 36 | : __in1_(std::move(__in_iter1)), __in2_(std::move(__in_iter2)), __out_(std::move(__out_iter)) {} |
| 35 | 37 | }; |
| 36 | 38 | |
| 37 | template <class _Compare, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> | |
| 38 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 __set_union_result<_InIter1, _InIter2, _OutIter> __set_union( | |
| 39 | template <class _AlgPolicy, class _Compare, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> | |
| 40 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __set_union_result<_InIter1, _InIter2, _OutIter> __set_union( | |
| 39 | 41 | _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Sent2 __last2, _OutIter __result, _Compare&& __comp) { |
| 40 | 42 | for (; __first1 != __last1; ++__result) { |
| 41 | 43 | if (__first2 == __last2) { |
| 42 | auto __ret1 = std::__copy_impl(std::move(__first1), std::move(__last1), std::move(__result)); | |
| 44 | auto __ret1 = std::__copy<_AlgPolicy>(std::move(__first1), std::move(__last1), std::move(__result)); | |
| 43 | 45 | return __set_union_result<_InIter1, _InIter2, _OutIter>( |
| 44 | 46 | std::move(__ret1.first), std::move(__first2), std::move((__ret1.second))); |
| 45 | 47 | } |
| ... | ... | @@ -54,21 +56,20 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 __set_union_result<_InIter1, |
| 54 | 56 | ++__first1; |
| 55 | 57 | } |
| 56 | 58 | } |
| 57 | auto __ret2 = std::__copy_impl(std::move(__first2), std::move(__last2), std::move(__result)); | |
| 59 | auto __ret2 = std::__copy<_AlgPolicy>(std::move(__first2), std::move(__last2), std::move(__result)); | |
| 58 | 60 | return __set_union_result<_InIter1, _InIter2, _OutIter>( |
| 59 | 61 | std::move(__first1), std::move(__ret2.first), std::move((__ret2.second))); |
| 60 | 62 | } |
| 61 | 63 | |
| 62 | 64 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> |
| 63 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_union( | |
| 65 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_union( | |
| 64 | 66 | _InputIterator1 __first1, |
| 65 | 67 | _InputIterator1 __last1, |
| 66 | 68 | _InputIterator2 __first2, |
| 67 | 69 | _InputIterator2 __last2, |
| 68 | 70 | _OutputIterator __result, |
| 69 | 71 | _Compare __comp) { |
| 70 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; | |
| 71 | return std::__set_union<_Comp_ref>( | |
| 72 | return std::__set_union<_ClassicAlgPolicy, __comp_ref_type<_Compare> >( | |
| 72 | 73 | std::move(__first1), |
| 73 | 74 | std::move(__last1), |
| 74 | 75 | std::move(__first2), |
| ... | ... | @@ -79,7 +80,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_union( |
| 79 | 80 | } |
| 80 | 81 | |
| 81 | 82 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 82 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_union( | |
| 83 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_union( | |
| 83 | 84 | _InputIterator1 __first1, |
| 84 | 85 | _InputIterator1 __last1, |
| 85 | 86 | _InputIterator2 __first2, |
lib/libcxx/include/__algorithm/shuffle.h+13-12| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | #include <__random/uniform_int_distribution.h> |
| 17 | 17 | #include <__utility/forward.h> |
| 18 | 18 | #include <__utility/move.h> |
| 19 | #include <__utility/swap.h> | |
| 19 | 20 | #include <cstddef> |
| 20 | 21 | #include <cstdint> |
| 21 | 22 | |
| ... | ... | @@ -31,9 +32,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 32 | class _LIBCPP_TYPE_VIS __libcpp_debug_randomizer { |
| 32 | 33 | public: |
| 33 | 34 | __libcpp_debug_randomizer() { |
| 34 | __state = __seed(); | |
| 35 | __inc = __state + 0xda3e39cb94b95bdbULL; | |
| 36 | __inc = (__inc << 1) | 1; | |
| 35 | __state_ = __seed(); | |
| 36 | __inc_ = __state_ + 0xda3e39cb94b95bdbULL; | |
| 37 | __inc_ = (__inc_ << 1) | 1; | |
| 37 | 38 | } |
| 38 | 39 | typedef uint_fast32_t result_type; |
| 39 | 40 | |
| ... | ... | @@ -41,8 +42,8 @@ public: |
| 41 | 42 | static const result_type _Max = 0xFFFFFFFF; |
| 42 | 43 | |
| 43 | 44 | _LIBCPP_HIDE_FROM_ABI result_type operator()() { |
| 44 | uint_fast64_t __oldstate = __state; | |
| 45 | __state = __oldstate * 6364136223846793005ULL + __inc; | |
| 45 | uint_fast64_t __oldstate = __state_; | |
| 46 | __state_ = __oldstate * 6364136223846793005ULL + __inc_; | |
| 46 | 47 | return __oldstate >> 32; |
| 47 | 48 | } |
| 48 | 49 | |
| ... | ... | @@ -50,8 +51,8 @@ public: |
| 50 | 51 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR result_type max() { return _Max; } |
| 51 | 52 | |
| 52 | 53 | private: |
| 53 | uint_fast64_t __state; | |
| 54 | uint_fast64_t __inc; | |
| 54 | uint_fast64_t __state_; | |
| 55 | uint_fast64_t __inc_; | |
| 55 | 56 | _LIBCPP_HIDE_FROM_ABI static uint_fast64_t __seed() { |
| 56 | 57 | #ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY_SEED |
| 57 | 58 | return _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY_SEED; |
| ... | ... | @@ -93,7 +94,7 @@ public: |
| 93 | 94 | _LIBCPP_FUNC_VIS __rs_default __rs_get(); |
| 94 | 95 | |
| 95 | 96 | template <class _RandomAccessIterator> |
| 96 | _LIBCPP_DEPRECATED_IN_CXX14 void | |
| 97 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void | |
| 97 | 98 | random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) |
| 98 | 99 | { |
| 99 | 100 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; |
| ... | ... | @@ -114,7 +115,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) |
| 114 | 115 | } |
| 115 | 116 | |
| 116 | 117 | template <class _RandomAccessIterator, class _RandomNumberGenerator> |
| 117 | _LIBCPP_DEPRECATED_IN_CXX14 void | |
| 118 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void | |
| 118 | 119 | random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, |
| 119 | 120 | #ifndef _LIBCPP_CXX03_LANG |
| 120 | 121 | _RandomNumberGenerator&& __rand) |
| ... | ... | @@ -137,7 +138,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, |
| 137 | 138 | #endif |
| 138 | 139 | |
| 139 | 140 | template <class _AlgPolicy, class _RandomAccessIterator, class _Sentinel, class _UniformRandomNumberGenerator> |
| 140 | _RandomAccessIterator __shuffle( | |
| 141 | _LIBCPP_HIDE_FROM_ABI _RandomAccessIterator __shuffle( | |
| 141 | 142 | _RandomAccessIterator __first, _Sentinel __last_sentinel, _UniformRandomNumberGenerator&& __g) { |
| 142 | 143 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; |
| 143 | 144 | typedef uniform_int_distribution<ptrdiff_t> _Dp; |
| ... | ... | @@ -161,8 +162,8 @@ _RandomAccessIterator __shuffle( |
| 161 | 162 | } |
| 162 | 163 | |
| 163 | 164 | template <class _RandomAccessIterator, class _UniformRandomNumberGenerator> |
| 164 | void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, | |
| 165 | _UniformRandomNumberGenerator&& __g) { | |
| 165 | _LIBCPP_HIDE_FROM_ABI void | |
| 166 | shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _UniformRandomNumberGenerator&& __g) { | |
| 166 | 167 | (void)std::__shuffle<_ClassicAlgPolicy>( |
| 167 | 168 | std::move(__first), std::move(__last), std::forward<_UniformRandomNumberGenerator>(__g)); |
| 168 | 169 | } |
lib/libcxx/include/__algorithm/sift_down.h+2-2| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | |
| 24 | 24 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> |
| 25 | _LIBCPP_CONSTEXPR_AFTER_CXX11 void | |
| 25 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void | |
| 26 | 26 | __sift_down(_RandomAccessIterator __first, _Compare&& __comp, |
| 27 | 27 | typename iterator_traits<_RandomAccessIterator>::difference_type __len, |
| 28 | 28 | _RandomAccessIterator __start) |
| ... | ... | @@ -78,7 +78,7 @@ __sift_down(_RandomAccessIterator __first, _Compare&& __comp, |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> |
| 81 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator | |
| 81 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator | |
| 82 | 82 | __floyd_sift_down(_RandomAccessIterator __first, _Compare&& __comp, |
| 83 | 83 | typename iterator_traits<_RandomAccessIterator>::difference_type __len) |
| 84 | 84 | { |
lib/libcxx/include/__algorithm/sort.h+470-174| ... | ... | @@ -11,19 +11,29 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__algorithm/comp.h> |
| 13 | 13 | #include <__algorithm/comp_ref_type.h> |
| 14 | #include <__algorithm/iter_swap.h> | |
| 14 | 15 | #include <__algorithm/iterator_operations.h> |
| 15 | 16 | #include <__algorithm/min_element.h> |
| 16 | 17 | #include <__algorithm/partial_sort.h> |
| 17 | 18 | #include <__algorithm/unwrap_iter.h> |
| 18 | #include <__bits> | |
| 19 | #include <__assert> | |
| 20 | #include <__bit/blsr.h> | |
| 21 | #include <__bit/countl.h> | |
| 22 | #include <__bit/countr.h> | |
| 19 | 23 | #include <__config> |
| 20 | 24 | #include <__debug> |
| 21 | 25 | #include <__debug_utils/randomize_range.h> |
| 22 | 26 | #include <__functional/operations.h> |
| 23 | 27 | #include <__functional/ranges_operations.h> |
| 24 | 28 | #include <__iterator/iterator_traits.h> |
| 29 | #include <__memory/destruct_n.h> | |
| 30 | #include <__memory/unique_ptr.h> | |
| 31 | #include <__type_traits/conditional.h> | |
| 32 | #include <__type_traits/is_arithmetic.h> | |
| 33 | #include <__utility/move.h> | |
| 34 | #include <__utility/pair.h> | |
| 25 | 35 | #include <climits> |
| 26 | #include <memory> | |
| 36 | #include <cstdint> | |
| 27 | 37 | |
| 28 | 38 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 29 | 39 | # pragma GCC system_header |
| ... | ... | @@ -43,7 +53,7 @@ struct _WrapAlgPolicy { |
| 43 | 53 | using _Comp = _CompT; |
| 44 | 54 | _Comp& __comp; |
| 45 | 55 | |
| 46 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 56 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 47 | 57 | _WrapAlgPolicy(_Comp& __c) : __comp(__c) {} |
| 48 | 58 | }; |
| 49 | 59 | |
| ... | ... | @@ -62,7 +72,7 @@ struct _UnwrapAlgPolicy { |
| 62 | 72 | using _AlgPolicy = _ClassicAlgPolicy; |
| 63 | 73 | using _Comp = _CompT; |
| 64 | 74 | |
| 65 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 static | |
| 75 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static | |
| 66 | 76 | _Comp __get_comp(_Comp __comp) { return __comp; } |
| 67 | 77 | }; |
| 68 | 78 | |
| ... | ... | @@ -73,14 +83,15 @@ struct _UnwrapAlgPolicy<_WrapAlgPolicy<_Ts...> > { |
| 73 | 83 | using _AlgPolicy = typename _Wrapped::_AlgPolicy; |
| 74 | 84 | using _Comp = typename _Wrapped::_Comp; |
| 75 | 85 | |
| 76 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 static | |
| 86 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static | |
| 77 | 87 | _Comp __get_comp(_Wrapped& __w) { return __w.__comp; } |
| 78 | 88 | }; |
| 79 | 89 | |
| 80 | 90 | // stable, 2-3 compares, 0-2 swaps |
| 81 | 91 | |
| 82 | 92 | template <class _AlgPolicy, class _Compare, class _ForwardIterator> |
| 83 | _LIBCPP_CONSTEXPR_AFTER_CXX11 unsigned __sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z, | |
| 93 | _LIBCPP_HIDE_FROM_ABI | |
| 94 | _LIBCPP_CONSTEXPR_SINCE_CXX14 unsigned __sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z, | |
| 84 | 95 | _Compare __c) { |
| 85 | 96 | using _Ops = _IterOps<_AlgPolicy>; |
| 86 | 97 | |
| ... | ... | @@ -118,10 +129,10 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 unsigned __sort3(_ForwardIterator __x, _ForwardIte |
| 118 | 129 | // stable, 3-6 compares, 0-5 swaps |
| 119 | 130 | |
| 120 | 131 | template <class _AlgPolicy, class _Compare, class _ForwardIterator> |
| 132 | _LIBCPP_HIDE_FROM_ABI | |
| 121 | 133 | unsigned __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4, |
| 122 | 134 | _Compare __c) { |
| 123 | using _Ops = _IterOps<_AlgPolicy>; | |
| 124 | ||
| 135 | using _Ops = _IterOps<_AlgPolicy>; | |
| 125 | 136 | unsigned __r = std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c); |
| 126 | 137 | if (__c(*__x4, *__x3)) { |
| 127 | 138 | _Ops::iter_swap(__x3, __x4); |
| ... | ... | @@ -171,12 +182,12 @@ _LIBCPP_HIDDEN unsigned __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _F |
| 171 | 182 | } |
| 172 | 183 | |
| 173 | 184 | template <class _AlgPolicy, class _Compare, class _ForwardIterator> |
| 174 | _LIBCPP_HIDDEN unsigned __sort5_wrap_policy( | |
| 185 | _LIBCPP_HIDE_FROM_ABI unsigned __sort5_wrap_policy( | |
| 175 | 186 | _ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4, _ForwardIterator __x5, |
| 176 | 187 | _Compare __c) { |
| 177 | 188 | using _WrappedComp = typename _WrapAlgPolicy<_AlgPolicy, _Compare>::type; |
| 178 | 189 | _WrappedComp __wrapped_comp(__c); |
| 179 | return std::__sort5<_WrappedComp>( | |
| 190 | return std::__sort5<_WrappedComp, _ForwardIterator>( | |
| 180 | 191 | std::move(__x1), std::move(__x2), std::move(__x3), std::move(__x4), std::move(__x5), __wrapped_comp); |
| 181 | 192 | } |
| 182 | 193 | |
| ... | ... | @@ -201,6 +212,13 @@ using __use_branchless_sort = |
| 201 | 212 | integral_constant<bool, __is_cpp17_contiguous_iterator<_Iter>::value && sizeof(_Tp) <= sizeof(void*) && |
| 202 | 213 | is_arithmetic<_Tp>::value && __is_simple_comparator<_Compare>::value>; |
| 203 | 214 | |
| 215 | namespace __detail { | |
| 216 | ||
| 217 | // Size in bits for the bitset in use. | |
| 218 | enum { __block_size = sizeof(uint64_t) * 8 }; | |
| 219 | ||
| 220 | } // namespace __detail | |
| 221 | ||
| 204 | 222 | // Ensures that __c(*__x, *__y) is true by swapping *__x and *__y if necessary. |
| 205 | 223 | template <class _Compare, class _RandomAccessIterator> |
| 206 | 224 | inline _LIBCPP_HIDE_FROM_ABI void __cond_swap(_RandomAccessIterator __x, _RandomAccessIterator __y, _Compare __c) { |
| ... | ... | @@ -231,8 +249,8 @@ template <class, class _Compare, class _RandomAccessIterator> |
| 231 | 249 | inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void> |
| 232 | 250 | __sort3_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, |
| 233 | 251 | _Compare __c) { |
| 234 | _VSTD::__cond_swap<_Compare>(__x2, __x3, __c); | |
| 235 | _VSTD::__partially_sorted_swap<_Compare>(__x1, __x2, __x3, __c); | |
| 252 | std::__cond_swap<_Compare>(__x2, __x3, __c); | |
| 253 | std::__partially_sorted_swap<_Compare>(__x1, __x2, __x3, __c); | |
| 236 | 254 | } |
| 237 | 255 | |
| 238 | 256 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> |
| ... | ... | @@ -246,11 +264,11 @@ template <class, class _Compare, class _RandomAccessIterator> |
| 246 | 264 | inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void> |
| 247 | 265 | __sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, |
| 248 | 266 | _RandomAccessIterator __x4, _Compare __c) { |
| 249 | _VSTD::__cond_swap<_Compare>(__x1, __x3, __c); | |
| 250 | _VSTD::__cond_swap<_Compare>(__x2, __x4, __c); | |
| 251 | _VSTD::__cond_swap<_Compare>(__x1, __x2, __c); | |
| 252 | _VSTD::__cond_swap<_Compare>(__x3, __x4, __c); | |
| 253 | _VSTD::__cond_swap<_Compare>(__x2, __x3, __c); | |
| 267 | std::__cond_swap<_Compare>(__x1, __x3, __c); | |
| 268 | std::__cond_swap<_Compare>(__x2, __x4, __c); | |
| 269 | std::__cond_swap<_Compare>(__x1, __x2, __c); | |
| 270 | std::__cond_swap<_Compare>(__x3, __x4, __c); | |
| 271 | std::__cond_swap<_Compare>(__x2, __x3, __c); | |
| 254 | 272 | } |
| 255 | 273 | |
| 256 | 274 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> |
| ... | ... | @@ -260,16 +278,21 @@ __sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, |
| 260 | 278 | std::__sort4<_AlgPolicy, _Compare>(__x1, __x2, __x3, __x4, __c); |
| 261 | 279 | } |
| 262 | 280 | |
| 263 | template <class, class _Compare, class _RandomAccessIterator> | |
| 281 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> | |
| 264 | 282 | inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void> |
| 265 | __sort5_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, | |
| 266 | _RandomAccessIterator __x4, _RandomAccessIterator __x5, _Compare __c) { | |
| 267 | _VSTD::__cond_swap<_Compare>(__x1, __x2, __c); | |
| 268 | _VSTD::__cond_swap<_Compare>(__x4, __x5, __c); | |
| 269 | _VSTD::__partially_sorted_swap<_Compare>(__x3, __x4, __x5, __c); | |
| 270 | _VSTD::__cond_swap<_Compare>(__x2, __x5, __c); | |
| 271 | _VSTD::__partially_sorted_swap<_Compare>(__x1, __x3, __x4, __c); | |
| 272 | _VSTD::__partially_sorted_swap<_Compare>(__x2, __x3, __x4, __c); | |
| 283 | __sort5_maybe_branchless( | |
| 284 | _RandomAccessIterator __x1, | |
| 285 | _RandomAccessIterator __x2, | |
| 286 | _RandomAccessIterator __x3, | |
| 287 | _RandomAccessIterator __x4, | |
| 288 | _RandomAccessIterator __x5, | |
| 289 | _Compare __c) { | |
| 290 | std::__cond_swap<_Compare>(__x1, __x2, __c); | |
| 291 | std::__cond_swap<_Compare>(__x4, __x5, __c); | |
| 292 | std::__partially_sorted_swap<_Compare>(__x3, __x4, __x5, __c); | |
| 293 | std::__cond_swap<_Compare>(__x2, __x5, __c); | |
| 294 | std::__partially_sorted_swap<_Compare>(__x1, __x3, __x4, __c); | |
| 295 | std::__partially_sorted_swap<_Compare>(__x2, __x3, __x4, __c); | |
| 273 | 296 | } |
| 274 | 297 | |
| 275 | 298 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> |
| ... | ... | @@ -281,7 +304,8 @@ __sort5_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, |
| 281 | 304 | |
| 282 | 305 | // Assumes size > 0 |
| 283 | 306 | template <class _AlgPolicy, class _Compare, class _BidirectionalIterator> |
| 284 | _LIBCPP_CONSTEXPR_AFTER_CXX11 void __selection_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, | |
| 307 | _LIBCPP_HIDE_FROM_ABI | |
| 308 | _LIBCPP_CONSTEXPR_SINCE_CXX14 void __selection_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, | |
| 285 | 309 | _Compare __comp) { |
| 286 | 310 | _BidirectionalIterator __lm1 = __last; |
| 287 | 311 | for (--__lm1; __first != __lm1; ++__first) { |
| ... | ... | @@ -291,32 +315,48 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 void __selection_sort(_BidirectionalIterator __fir |
| 291 | 315 | } |
| 292 | 316 | } |
| 293 | 317 | |
| 318 | // Sort the iterator range [__first, __last) using the comparator __comp using | |
| 319 | // the insertion sort algorithm. | |
| 294 | 320 | template <class _AlgPolicy, class _Compare, class _BidirectionalIterator> |
| 321 | _LIBCPP_HIDE_FROM_ABI | |
| 295 | 322 | void __insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) { |
| 296 | 323 | using _Ops = _IterOps<_AlgPolicy>; |
| 297 | 324 | |
| 298 | 325 | typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; |
| 299 | if (__first != __last) { | |
| 300 | _BidirectionalIterator __i = __first; | |
| 301 | for (++__i; __i != __last; ++__i) { | |
| 302 | _BidirectionalIterator __j = __i; | |
| 303 | value_type __t(_Ops::__iter_move(__j)); | |
| 304 | for (_BidirectionalIterator __k = __i; __k != __first && __comp(__t, *--__k); --__j) | |
| 326 | if (__first == __last) | |
| 327 | return; | |
| 328 | _BidirectionalIterator __i = __first; | |
| 329 | for (++__i; __i != __last; ++__i) { | |
| 330 | _BidirectionalIterator __j = __i; | |
| 331 | --__j; | |
| 332 | if (__comp(*__i, *__j)) { | |
| 333 | value_type __t(_Ops::__iter_move(__i)); | |
| 334 | _BidirectionalIterator __k = __j; | |
| 335 | __j = __i; | |
| 336 | do { | |
| 305 | 337 | *__j = _Ops::__iter_move(__k); |
| 306 | *__j = _VSTD::move(__t); | |
| 338 | __j = __k; | |
| 339 | } while (__j != __first && __comp(__t, *--__k)); | |
| 340 | *__j = std::move(__t); | |
| 307 | 341 | } |
| 308 | 342 | } |
| 309 | 343 | } |
| 310 | 344 | |
| 345 | // Sort the iterator range [__first, __last) using the comparator __comp using | |
| 346 | // the insertion sort algorithm. Insertion sort has two loops, outer and inner. | |
| 347 | // The implementation below has not bounds check (unguarded) for the inner loop. | |
| 348 | // Assumes that there is an element in the position (__first - 1) and that each | |
| 349 | // element in the input range is greater or equal to the element at __first - 1. | |
| 311 | 350 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> |
| 312 | void __insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { | |
| 351 | _LIBCPP_HIDE_FROM_ABI void | |
| 352 | __insertion_sort_unguarded(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { | |
| 313 | 353 | using _Ops = _IterOps<_AlgPolicy>; |
| 314 | ||
| 315 | 354 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; |
| 316 | 355 | typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; |
| 317 | _RandomAccessIterator __j = __first + difference_type(2); | |
| 318 | std::__sort3_maybe_branchless<_AlgPolicy, _Compare>(__first, __first + difference_type(1), __j, __comp); | |
| 319 | for (_RandomAccessIterator __i = __j + difference_type(1); __i != __last; ++__i) { | |
| 356 | if (__first == __last) | |
| 357 | return; | |
| 358 | for (_RandomAccessIterator __i = __first + difference_type(1); __i != __last; ++__i) { | |
| 359 | _RandomAccessIterator __j = __i - difference_type(1); | |
| 320 | 360 | if (__comp(*__i, *__j)) { |
| 321 | 361 | value_type __t(_Ops::__iter_move(__i)); |
| 322 | 362 | _RandomAccessIterator __k = __j; |
| ... | ... | @@ -324,15 +364,14 @@ void __insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __l |
| 324 | 364 | do { |
| 325 | 365 | *__j = _Ops::__iter_move(__k); |
| 326 | 366 | __j = __k; |
| 327 | } while (__j != __first && __comp(__t, *--__k)); | |
| 328 | *__j = _VSTD::move(__t); | |
| 367 | } while (__comp(__t, *--__k)); // No need for bounds check due to the assumption stated above. | |
| 368 | *__j = std::move(__t); | |
| 329 | 369 | } |
| 330 | __j = __i; | |
| 331 | 370 | } |
| 332 | 371 | } |
| 333 | 372 | |
| 334 | 373 | template <class _WrappedComp, class _RandomAccessIterator> |
| 335 | bool __insertion_sort_incomplete( | |
| 374 | _LIBCPP_HIDDEN bool __insertion_sort_incomplete( | |
| 336 | 375 | _RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) { |
| 337 | 376 | using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>; |
| 338 | 377 | using _AlgPolicy = typename _Unwrap::_AlgPolicy; |
| ... | ... | @@ -348,7 +387,7 @@ bool __insertion_sort_incomplete( |
| 348 | 387 | return true; |
| 349 | 388 | case 2: |
| 350 | 389 | if (__comp(*--__last, *__first)) |
| 351 | _IterOps<_AlgPolicy>::iter_swap(__first, __last); | |
| 390 | _Ops::iter_swap(__first, __last); | |
| 352 | 391 | return true; |
| 353 | 392 | case 3: |
| 354 | 393 | std::__sort3_maybe_branchless<_AlgPolicy, _Compare>(__first, __first + difference_type(1), --__last, __comp); |
| ... | ... | @@ -377,7 +416,7 @@ bool __insertion_sort_incomplete( |
| 377 | 416 | *__j = _Ops::__iter_move(__k); |
| 378 | 417 | __j = __k; |
| 379 | 418 | } while (__j != __first && __comp(__t, *--__k)); |
| 380 | *__j = _VSTD::move(__t); | |
| 419 | *__j = std::move(__t); | |
| 381 | 420 | if (++__count == __limit) |
| 382 | 421 | return ++__i == __last; |
| 383 | 422 | } |
| ... | ... | @@ -387,6 +426,7 @@ bool __insertion_sort_incomplete( |
| 387 | 426 | } |
| 388 | 427 | |
| 389 | 428 | template <class _AlgPolicy, class _Compare, class _BidirectionalIterator> |
| 429 | _LIBCPP_HIDE_FROM_ABI | |
| 390 | 430 | void __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterator __last1, |
| 391 | 431 | typename iterator_traits<_BidirectionalIterator>::value_type* __first2, _Compare __comp) { |
| 392 | 432 | using _Ops = _IterOps<_AlgPolicy>; |
| ... | ... | @@ -416,17 +456,336 @@ void __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterat |
| 416 | 456 | } |
| 417 | 457 | } |
| 418 | 458 | |
| 419 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> | |
| 420 | void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, | |
| 421 | typename iterator_traits<_RandomAccessIterator>::difference_type __depth) { | |
| 459 | template <class _AlgPolicy, class _RandomAccessIterator> | |
| 460 | inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos( | |
| 461 | _RandomAccessIterator __first, _RandomAccessIterator __last, uint64_t& __left_bitset, uint64_t& __right_bitset) { | |
| 462 | using _Ops = _IterOps<_AlgPolicy>; | |
| 463 | typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type difference_type; | |
| 464 | // Swap one pair on each iteration as long as both bitsets have at least one | |
| 465 | // element for swapping. | |
| 466 | while (__left_bitset != 0 && __right_bitset != 0) { | |
| 467 | difference_type tz_left = __libcpp_ctz(__left_bitset); | |
| 468 | __left_bitset = __libcpp_blsr(__left_bitset); | |
| 469 | difference_type tz_right = __libcpp_ctz(__right_bitset); | |
| 470 | __right_bitset = __libcpp_blsr(__right_bitset); | |
| 471 | _Ops::iter_swap(__first + tz_left, __last - tz_right); | |
| 472 | } | |
| 473 | } | |
| 474 | ||
| 475 | template <class _Compare, | |
| 476 | class _RandomAccessIterator, | |
| 477 | class _ValueType = typename iterator_traits<_RandomAccessIterator>::value_type> | |
| 478 | inline _LIBCPP_HIDE_FROM_ABI void | |
| 479 | __populate_left_bitset(_RandomAccessIterator __first, _Compare __comp, _ValueType& __pivot, uint64_t& __left_bitset) { | |
| 480 | // Possible vectorization. With a proper "-march" flag, the following loop | |
| 481 | // will be compiled into a set of SIMD instructions. | |
| 482 | _RandomAccessIterator __iter = __first; | |
| 483 | for (int __j = 0; __j < __detail::__block_size;) { | |
| 484 | bool __comp_result = !__comp(*__iter, __pivot); | |
| 485 | __left_bitset |= (static_cast<uint64_t>(__comp_result) << __j); | |
| 486 | __j++; | |
| 487 | ++__iter; | |
| 488 | } | |
| 489 | } | |
| 490 | ||
| 491 | template <class _Compare, | |
| 492 | class _RandomAccessIterator, | |
| 493 | class _ValueType = typename iterator_traits<_RandomAccessIterator>::value_type> | |
| 494 | inline _LIBCPP_HIDE_FROM_ABI void | |
| 495 | __populate_right_bitset(_RandomAccessIterator __lm1, _Compare __comp, _ValueType& __pivot, uint64_t& __right_bitset) { | |
| 496 | // Possible vectorization. With a proper "-march" flag, the following loop | |
| 497 | // will be compiled into a set of SIMD instructions. | |
| 498 | _RandomAccessIterator __iter = __lm1; | |
| 499 | for (int __j = 0; __j < __detail::__block_size;) { | |
| 500 | bool __comp_result = __comp(*__iter, __pivot); | |
| 501 | __right_bitset |= (static_cast<uint64_t>(__comp_result) << __j); | |
| 502 | __j++; | |
| 503 | --__iter; | |
| 504 | } | |
| 505 | } | |
| 506 | ||
| 507 | template <class _AlgPolicy, | |
| 508 | class _Compare, | |
| 509 | class _RandomAccessIterator, | |
| 510 | class _ValueType = typename iterator_traits<_RandomAccessIterator>::value_type> | |
| 511 | inline _LIBCPP_HIDE_FROM_ABI void __bitset_partition_partial_blocks( | |
| 512 | _RandomAccessIterator& __first, | |
| 513 | _RandomAccessIterator& __lm1, | |
| 514 | _Compare __comp, | |
| 515 | _ValueType& __pivot, | |
| 516 | uint64_t& __left_bitset, | |
| 517 | uint64_t& __right_bitset) { | |
| 518 | typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type difference_type; | |
| 519 | difference_type __remaining_len = __lm1 - __first + 1; | |
| 520 | difference_type __l_size; | |
| 521 | difference_type __r_size; | |
| 522 | if (__left_bitset == 0 && __right_bitset == 0) { | |
| 523 | __l_size = __remaining_len / 2; | |
| 524 | __r_size = __remaining_len - __l_size; | |
| 525 | } else if (__left_bitset == 0) { | |
| 526 | // We know at least one side is a full block. | |
| 527 | __l_size = __remaining_len - __detail::__block_size; | |
| 528 | __r_size = __detail::__block_size; | |
| 529 | } else { // if (__right_bitset == 0) | |
| 530 | __l_size = __detail::__block_size; | |
| 531 | __r_size = __remaining_len - __detail::__block_size; | |
| 532 | } | |
| 533 | // Record the comparison outcomes for the elements currently on the left side. | |
| 534 | if (__left_bitset == 0) { | |
| 535 | _RandomAccessIterator __iter = __first; | |
| 536 | for (int j = 0; j < __l_size; j++) { | |
| 537 | bool __comp_result = !__comp(*__iter, __pivot); | |
| 538 | __left_bitset |= (static_cast<uint64_t>(__comp_result) << j); | |
| 539 | ++__iter; | |
| 540 | } | |
| 541 | } | |
| 542 | // Record the comparison outcomes for the elements currently on the right | |
| 543 | // side. | |
| 544 | if (__right_bitset == 0) { | |
| 545 | _RandomAccessIterator __iter = __lm1; | |
| 546 | for (int j = 0; j < __r_size; j++) { | |
| 547 | bool __comp_result = __comp(*__iter, __pivot); | |
| 548 | __right_bitset |= (static_cast<uint64_t>(__comp_result) << j); | |
| 549 | --__iter; | |
| 550 | } | |
| 551 | } | |
| 552 | std::__swap_bitmap_pos<_AlgPolicy, _RandomAccessIterator>(__first, __lm1, __left_bitset, __right_bitset); | |
| 553 | __first += (__left_bitset == 0) ? __l_size : 0; | |
| 554 | __lm1 -= (__right_bitset == 0) ? __r_size : 0; | |
| 555 | } | |
| 556 | ||
| 557 | template <class _AlgPolicy, class _RandomAccessIterator> | |
| 558 | inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos_within( | |
| 559 | _RandomAccessIterator& __first, _RandomAccessIterator& __lm1, uint64_t& __left_bitset, uint64_t& __right_bitset) { | |
| 560 | using _Ops = _IterOps<_AlgPolicy>; | |
| 561 | typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type difference_type; | |
| 562 | if (__left_bitset) { | |
| 563 | // Swap within the left side. Need to find set positions in the reverse | |
| 564 | // order. | |
| 565 | while (__left_bitset != 0) { | |
| 566 | difference_type __tz_left = __detail::__block_size - 1 - __libcpp_clz(__left_bitset); | |
| 567 | __left_bitset &= (static_cast<uint64_t>(1) << __tz_left) - 1; | |
| 568 | _RandomAccessIterator it = __first + __tz_left; | |
| 569 | if (it != __lm1) { | |
| 570 | _Ops::iter_swap(it, __lm1); | |
| 571 | } | |
| 572 | --__lm1; | |
| 573 | } | |
| 574 | __first = __lm1 + difference_type(1); | |
| 575 | } else if (__right_bitset) { | |
| 576 | // Swap within the right side. Need to find set positions in the reverse | |
| 577 | // order. | |
| 578 | while (__right_bitset != 0) { | |
| 579 | difference_type __tz_right = __detail::__block_size - 1 - __libcpp_clz(__right_bitset); | |
| 580 | __right_bitset &= (static_cast<uint64_t>(1) << __tz_right) - 1; | |
| 581 | _RandomAccessIterator it = __lm1 - __tz_right; | |
| 582 | if (it != __first) { | |
| 583 | _Ops::iter_swap(it, __first); | |
| 584 | } | |
| 585 | ++__first; | |
| 586 | } | |
| 587 | } | |
| 588 | } | |
| 589 | ||
| 590 | // Partition [__first, __last) using the comparator __comp. *__first has the | |
| 591 | // chosen pivot. Elements that are equivalent are kept to the left of the | |
| 592 | // pivot. Returns the iterator for the pivot and a bool value which is true if | |
| 593 | // the provided range is already sorted, false otherwise. We assume that the | |
| 594 | // length of the range is at least three elements. | |
| 595 | // | |
| 596 | // __bitset_partition uses bitsets for storing outcomes of the comparisons | |
| 597 | // between the pivot and other elements. | |
| 598 | template <class _AlgPolicy, class _RandomAccessIterator, class _Compare> | |
| 599 | _LIBCPP_HIDE_FROM_ABI std::pair<_RandomAccessIterator, bool> | |
| 600 | __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { | |
| 422 | 601 | using _Ops = _IterOps<_AlgPolicy>; |
| 602 | typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type; | |
| 603 | typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type difference_type; | |
| 604 | _LIBCPP_ASSERT(__last - __first >= difference_type(3), ""); | |
| 605 | ||
| 606 | _RandomAccessIterator __begin = __first; | |
| 607 | value_type __pivot(_Ops::__iter_move(__first)); | |
| 608 | // Find the first element greater than the pivot. | |
| 609 | if (__comp(__pivot, *(__last - difference_type(1)))) { | |
| 610 | // Not guarded since we know the last element is greater than the pivot. | |
| 611 | while (!__comp(__pivot, *++__first)) { | |
| 612 | } | |
| 613 | } else { | |
| 614 | while (++__first < __last && !__comp(__pivot, *__first)) { | |
| 615 | } | |
| 616 | } | |
| 617 | // Find the last element less than or equal to the pivot. | |
| 618 | if (__first < __last) { | |
| 619 | // It will be always guarded because __introsort will do the median-of-three | |
| 620 | // before calling this. | |
| 621 | while (__comp(__pivot, *--__last)) { | |
| 622 | } | |
| 623 | } | |
| 624 | // If the first element greater than the pivot is at or after the | |
| 625 | // last element less than or equal to the pivot, then we have covered the | |
| 626 | // entire range without swapping elements. This implies the range is already | |
| 627 | // partitioned. | |
| 628 | bool __already_partitioned = __first >= __last; | |
| 629 | if (!__already_partitioned) { | |
| 630 | _Ops::iter_swap(__first, __last); | |
| 631 | ++__first; | |
| 632 | } | |
| 633 | ||
| 634 | // In [__first, __last) __last is not inclusive. From now on, it uses last | |
| 635 | // minus one to be inclusive on both sides. | |
| 636 | _RandomAccessIterator __lm1 = __last - difference_type(1); | |
| 637 | uint64_t __left_bitset = 0; | |
| 638 | uint64_t __right_bitset = 0; | |
| 639 | ||
| 640 | // Reminder: length = __lm1 - __first + 1. | |
| 641 | while (__lm1 - __first >= 2 * __detail::__block_size - 1) { | |
| 642 | // Record the comparison outcomes for the elements currently on the left | |
| 643 | // side. | |
| 644 | if (__left_bitset == 0) | |
| 645 | std::__populate_left_bitset<_Compare>(__first, __comp, __pivot, __left_bitset); | |
| 646 | // Record the comparison outcomes for the elements currently on the right | |
| 647 | // side. | |
| 648 | if (__right_bitset == 0) | |
| 649 | std::__populate_right_bitset<_Compare>(__lm1, __comp, __pivot, __right_bitset); | |
| 650 | // Swap the elements recorded to be the candidates for swapping in the | |
| 651 | // bitsets. | |
| 652 | std::__swap_bitmap_pos<_AlgPolicy, _RandomAccessIterator>(__first, __lm1, __left_bitset, __right_bitset); | |
| 653 | // Only advance the iterator if all the elements that need to be moved to | |
| 654 | // other side were moved. | |
| 655 | __first += (__left_bitset == 0) ? difference_type(__detail::__block_size) : difference_type(0); | |
| 656 | __lm1 -= (__right_bitset == 0) ? difference_type(__detail::__block_size) : difference_type(0); | |
| 657 | } | |
| 658 | // Now, we have a less-than a block worth of elements on at least one of the | |
| 659 | // sides. | |
| 660 | std::__bitset_partition_partial_blocks<_AlgPolicy, _Compare>( | |
| 661 | __first, __lm1, __comp, __pivot, __left_bitset, __right_bitset); | |
| 662 | // At least one the bitsets would be empty. For the non-empty one, we need to | |
| 663 | // properly partition the elements that appear within that bitset. | |
| 664 | std::__swap_bitmap_pos_within<_AlgPolicy>(__first, __lm1, __left_bitset, __right_bitset); | |
| 665 | ||
| 666 | // Move the pivot to its correct position. | |
| 667 | _RandomAccessIterator __pivot_pos = __first - difference_type(1); | |
| 668 | if (__begin != __pivot_pos) { | |
| 669 | *__begin = _Ops::__iter_move(__pivot_pos); | |
| 670 | } | |
| 671 | *__pivot_pos = std::move(__pivot); | |
| 672 | return std::make_pair(__pivot_pos, __already_partitioned); | |
| 673 | } | |
| 423 | 674 | |
| 675 | // Partition [__first, __last) using the comparator __comp. *__first has the | |
| 676 | // chosen pivot. Elements that are equivalent are kept to the right of the | |
| 677 | // pivot. Returns the iterator for the pivot and a bool value which is true if | |
| 678 | // the provided range is already sorted, false otherwise. We assume that the | |
| 679 | // length of the range is at least three elements. | |
| 680 | template <class _AlgPolicy, class _RandomAccessIterator, class _Compare> | |
| 681 | _LIBCPP_HIDE_FROM_ABI std::pair<_RandomAccessIterator, bool> | |
| 682 | __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { | |
| 683 | using _Ops = _IterOps<_AlgPolicy>; | |
| 424 | 684 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; |
| 425 | typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; | |
| 426 | const difference_type __limit = | |
| 427 | is_trivially_copy_constructible<value_type>::value && is_trivially_copy_assignable<value_type>::value ? 30 : 6; | |
| 685 | typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type; | |
| 686 | _LIBCPP_ASSERT(__last - __first >= difference_type(3), ""); | |
| 687 | _RandomAccessIterator __begin = __first; | |
| 688 | value_type __pivot(_Ops::__iter_move(__first)); | |
| 689 | // Find the first element greater or equal to the pivot. It will be always | |
| 690 | // guarded because __introsort will do the median-of-three before calling | |
| 691 | // this. | |
| 692 | while (__comp(*++__first, __pivot)) | |
| 693 | ; | |
| 694 | ||
| 695 | // Find the last element less than the pivot. | |
| 696 | if (__begin == __first - difference_type(1)) { | |
| 697 | while (__first < __last && !__comp(*--__last, __pivot)) | |
| 698 | ; | |
| 699 | } else { | |
| 700 | // Guarded. | |
| 701 | while (!__comp(*--__last, __pivot)) | |
| 702 | ; | |
| 703 | } | |
| 704 | ||
| 705 | // If the first element greater than or equal to the pivot is at or after the | |
| 706 | // last element less than the pivot, then we have covered the entire range | |
| 707 | // without swapping elements. This implies the range is already partitioned. | |
| 708 | bool __already_partitioned = __first >= __last; | |
| 709 | // Go through the remaining elements. Swap pairs of elements (one to the | |
| 710 | // right of the pivot and the other to left of the pivot) that are not on the | |
| 711 | // correct side of the pivot. | |
| 712 | while (__first < __last) { | |
| 713 | _Ops::iter_swap(__first, __last); | |
| 714 | while (__comp(*++__first, __pivot)) | |
| 715 | ; | |
| 716 | while (!__comp(*--__last, __pivot)) | |
| 717 | ; | |
| 718 | } | |
| 719 | // Move the pivot to its correct position. | |
| 720 | _RandomAccessIterator __pivot_pos = __first - difference_type(1); | |
| 721 | if (__begin != __pivot_pos) { | |
| 722 | *__begin = _Ops::__iter_move(__pivot_pos); | |
| 723 | } | |
| 724 | *__pivot_pos = std::move(__pivot); | |
| 725 | return std::make_pair(__pivot_pos, __already_partitioned); | |
| 726 | } | |
| 727 | ||
| 728 | // Similar to the above function. Elements equivalent to the pivot are put to | |
| 729 | // the left of the pivot. Returns the iterator to the pivot element. | |
| 730 | template <class _AlgPolicy, class _RandomAccessIterator, class _Compare> | |
| 731 | _LIBCPP_HIDE_FROM_ABI _RandomAccessIterator | |
| 732 | __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { | |
| 733 | using _Ops = _IterOps<_AlgPolicy>; | |
| 734 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; | |
| 735 | typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type; | |
| 736 | _RandomAccessIterator __begin = __first; | |
| 737 | value_type __pivot(_Ops::__iter_move(__first)); | |
| 738 | if (__comp(__pivot, *(__last - difference_type(1)))) { | |
| 739 | // Guarded. | |
| 740 | while (!__comp(__pivot, *++__first)) { | |
| 741 | } | |
| 742 | } else { | |
| 743 | while (++__first < __last && !__comp(__pivot, *__first)) { | |
| 744 | } | |
| 745 | } | |
| 746 | ||
| 747 | if (__first < __last) { | |
| 748 | // It will be always guarded because __introsort will do the | |
| 749 | // median-of-three before calling this. | |
| 750 | while (__comp(__pivot, *--__last)) { | |
| 751 | } | |
| 752 | } | |
| 753 | while (__first < __last) { | |
| 754 | _Ops::iter_swap(__first, __last); | |
| 755 | while (!__comp(__pivot, *++__first)) | |
| 756 | ; | |
| 757 | while (__comp(__pivot, *--__last)) | |
| 758 | ; | |
| 759 | } | |
| 760 | _RandomAccessIterator __pivot_pos = __first - difference_type(1); | |
| 761 | if (__begin != __pivot_pos) { | |
| 762 | *__begin = _Ops::__iter_move(__pivot_pos); | |
| 763 | } | |
| 764 | *__pivot_pos = std::move(__pivot); | |
| 765 | return __first; | |
| 766 | } | |
| 767 | ||
| 768 | // The main sorting function. Implements introsort combined with other ideas: | |
| 769 | // - option of using block quick sort for partitioning, | |
| 770 | // - guarded and unguarded insertion sort for small lengths, | |
| 771 | // - Tuckey's ninther technique for computing the pivot, | |
| 772 | // - check on whether partition was not required. | |
| 773 | // The implementation is partly based on Orson Peters' pattern-defeating | |
| 774 | // quicksort, published at: <https://github.com/orlp/pdqsort>. | |
| 775 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, bool _UseBitSetPartition> | |
| 776 | void __introsort(_RandomAccessIterator __first, | |
| 777 | _RandomAccessIterator __last, | |
| 778 | _Compare __comp, | |
| 779 | typename iterator_traits<_RandomAccessIterator>::difference_type __depth, | |
| 780 | bool __leftmost = true) { | |
| 781 | using _Ops = _IterOps<_AlgPolicy>; | |
| 782 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; | |
| 783 | using _Comp_ref = __comp_ref_type<_Compare>; | |
| 784 | // Upper bound for using insertion sort for sorting. | |
| 785 | _LIBCPP_CONSTEXPR difference_type __limit = 24; | |
| 786 | // Lower bound for using Tuckey's ninther technique for median computation. | |
| 787 | _LIBCPP_CONSTEXPR difference_type __ninther_threshold = 128; | |
| 428 | 788 | while (true) { |
| 429 | __restart: | |
| 430 | 789 | difference_type __len = __last - __first; |
| 431 | 790 | switch (__len) { |
| 432 | 791 | case 0: |
| ... | ... | @@ -434,7 +793,7 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C |
| 434 | 793 | return; |
| 435 | 794 | case 2: |
| 436 | 795 | if (__comp(*--__last, *__first)) |
| 437 | _IterOps<_AlgPolicy>::iter_swap(__first, __last); | |
| 796 | _Ops::iter_swap(__first, __last); | |
| 438 | 797 | return; |
| 439 | 798 | case 3: |
| 440 | 799 | std::__sort3_maybe_branchless<_AlgPolicy, _Compare>(__first, __first + difference_type(1), --__last, __comp); |
| ... | ... | @@ -449,127 +808,60 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C |
| 449 | 808 | --__last, __comp); |
| 450 | 809 | return; |
| 451 | 810 | } |
| 452 | if (__len <= __limit) { | |
| 453 | std::__insertion_sort_3<_AlgPolicy, _Compare>(__first, __last, __comp); | |
| 811 | // Use insertion sort if the length of the range is below the specified limit. | |
| 812 | if (__len < __limit) { | |
| 813 | if (__leftmost) { | |
| 814 | std::__insertion_sort<_AlgPolicy, _Compare>(__first, __last, __comp); | |
| 815 | } else { | |
| 816 | std::__insertion_sort_unguarded<_AlgPolicy, _Compare>(__first, __last, __comp); | |
| 817 | } | |
| 454 | 818 | return; |
| 455 | 819 | } |
| 456 | // __len > 5 | |
| 457 | 820 | if (__depth == 0) { |
| 458 | 821 | // Fallback to heap sort as Introsort suggests. |
| 459 | 822 | std::__partial_sort<_AlgPolicy, _Compare>(__first, __last, __last, __comp); |
| 460 | 823 | return; |
| 461 | 824 | } |
| 462 | 825 | --__depth; |
| 463 | _RandomAccessIterator __m = __first; | |
| 464 | _RandomAccessIterator __lm1 = __last; | |
| 465 | --__lm1; | |
| 466 | unsigned __n_swaps; | |
| 467 | 826 | { |
| 468 | difference_type __delta; | |
| 469 | if (__len >= 1000) { | |
| 470 | __delta = __len / 2; | |
| 471 | __m += __delta; | |
| 472 | __delta /= 2; | |
| 473 | __n_swaps = std::__sort5_wrap_policy<_AlgPolicy, _Compare>( | |
| 474 | __first, __first + __delta, __m, __m + __delta, __lm1, __comp); | |
| 827 | difference_type __half_len = __len / 2; | |
| 828 | // Use Tuckey's ninther technique or median of 3 for pivot selection | |
| 829 | // depending on the length of the range being sorted. | |
| 830 | if (__len > __ninther_threshold) { | |
| 831 | std::__sort3<_AlgPolicy, _Compare>(__first, __first + __half_len, __last - difference_type(1), __comp); | |
| 832 | std::__sort3<_AlgPolicy, _Compare>( | |
| 833 | __first + difference_type(1), __first + (__half_len - 1), __last - difference_type(2), __comp); | |
| 834 | std::__sort3<_AlgPolicy, _Compare>( | |
| 835 | __first + difference_type(2), __first + (__half_len + 1), __last - difference_type(3), __comp); | |
| 836 | std::__sort3<_AlgPolicy, _Compare>( | |
| 837 | __first + (__half_len - 1), __first + __half_len, __first + (__half_len + 1), __comp); | |
| 838 | _Ops::iter_swap(__first, __first + __half_len); | |
| 475 | 839 | } else { |
| 476 | __delta = __len / 2; | |
| 477 | __m += __delta; | |
| 478 | __n_swaps = std::__sort3<_AlgPolicy, _Compare>(__first, __m, __lm1, __comp); | |
| 840 | std::__sort3<_AlgPolicy, _Compare>(__first + __half_len, __first, __last - difference_type(1), __comp); | |
| 479 | 841 | } |
| 480 | 842 | } |
| 481 | // *__m is median | |
| 482 | // partition [__first, __m) < *__m and *__m <= [__m, __last) | |
| 483 | // (this inhibits tossing elements equivalent to __m around unnecessarily) | |
| 484 | _RandomAccessIterator __i = __first; | |
| 485 | _RandomAccessIterator __j = __lm1; | |
| 486 | // j points beyond range to be tested, *__m is known to be <= *__lm1 | |
| 487 | // The search going up is known to be guarded but the search coming down isn't. | |
| 488 | // Prime the downward search with a guard. | |
| 489 | if (!__comp(*__i, *__m)) // if *__first == *__m | |
| 490 | { | |
| 491 | // *__first == *__m, *__first doesn't go in first part | |
| 492 | // manually guard downward moving __j against __i | |
| 493 | while (true) { | |
| 494 | if (__i == --__j) { | |
| 495 | // *__first == *__m, *__m <= all other elements | |
| 496 | // Parition instead into [__first, __i) == *__first and *__first < [__i, __last) | |
| 497 | ++__i; // __first + 1 | |
| 498 | __j = __last; | |
| 499 | if (!__comp(*__first, *--__j)) // we need a guard if *__first == *(__last-1) | |
| 500 | { | |
| 501 | while (true) { | |
| 502 | if (__i == __j) | |
| 503 | return; // [__first, __last) all equivalent elements | |
| 504 | if (__comp(*__first, *__i)) { | |
| 505 | _Ops::iter_swap(__i, __j); | |
| 506 | ++__n_swaps; | |
| 507 | ++__i; | |
| 508 | break; | |
| 509 | } | |
| 510 | ++__i; | |
| 511 | } | |
| 512 | } | |
| 513 | // [__first, __i) == *__first and *__first < [__j, __last) and __j == __last - 1 | |
| 514 | if (__i == __j) | |
| 515 | return; | |
| 516 | while (true) { | |
| 517 | while (!__comp(*__first, *__i)) | |
| 518 | ++__i; | |
| 519 | while (__comp(*__first, *--__j)) | |
| 520 | ; | |
| 521 | if (__i >= __j) | |
| 522 | break; | |
| 523 | _Ops::iter_swap(__i, __j); | |
| 524 | ++__n_swaps; | |
| 525 | ++__i; | |
| 526 | } | |
| 527 | // [__first, __i) == *__first and *__first < [__i, __last) | |
| 528 | // The first part is sorted, sort the second part | |
| 529 | // _VSTD::__sort<_Compare>(__i, __last, __comp); | |
| 530 | __first = __i; | |
| 531 | goto __restart; | |
| 532 | } | |
| 533 | if (__comp(*__j, *__m)) { | |
| 534 | _Ops::iter_swap(__i, __j); | |
| 535 | ++__n_swaps; | |
| 536 | break; // found guard for downward moving __j, now use unguarded partition | |
| 537 | } | |
| 538 | } | |
| 539 | } | |
| 540 | // It is known that *__i < *__m | |
| 541 | ++__i; | |
| 542 | // j points beyond range to be tested, *__m is known to be <= *__lm1 | |
| 543 | // if not yet partitioned... | |
| 544 | if (__i < __j) { | |
| 545 | // known that *(__i - 1) < *__m | |
| 546 | // known that __i <= __m | |
| 547 | while (true) { | |
| 548 | // __m still guards upward moving __i | |
| 549 | while (__comp(*__i, *__m)) | |
| 550 | ++__i; | |
| 551 | // It is now known that a guard exists for downward moving __j | |
| 552 | while (!__comp(*--__j, *__m)) | |
| 553 | ; | |
| 554 | if (__i > __j) | |
| 555 | break; | |
| 556 | _Ops::iter_swap(__i, __j); | |
| 557 | ++__n_swaps; | |
| 558 | // It is known that __m != __j | |
| 559 | // If __m just moved, follow it | |
| 560 | if (__m == __i) | |
| 561 | __m = __j; | |
| 562 | ++__i; | |
| 563 | } | |
| 564 | } | |
| 565 | // [__first, __i) < *__m and *__m <= [__i, __last) | |
| 566 | if (__i != __m && __comp(*__m, *__i)) { | |
| 567 | _Ops::iter_swap(__i, __m); | |
| 568 | ++__n_swaps; | |
| 843 | // The elements to the left of the current iterator range are already | |
| 844 | // sorted. If the current iterator range to be sorted is not the | |
| 845 | // leftmost part of the entire iterator range and the pivot is same as | |
| 846 | // the highest element in the range to the left, then we know that all | |
| 847 | // the elements in the range [first, pivot] would be equal to the pivot, | |
| 848 | // assuming the equal elements are put on the left side when | |
| 849 | // partitioned. This also means that we do not need to sort the left | |
| 850 | // side of the partition. | |
| 851 | if (!__leftmost && !__comp(*(__first - difference_type(1)), *__first)) { | |
| 852 | __first = std::__partition_with_equals_on_left<_AlgPolicy, _RandomAccessIterator, _Comp_ref>( | |
| 853 | __first, __last, _Comp_ref(__comp)); | |
| 854 | continue; | |
| 569 | 855 | } |
| 856 | // Use bitset partition only if asked for. | |
| 857 | auto __ret = | |
| 858 | _UseBitSetPartition | |
| 859 | ? std::__bitset_partition<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp) | |
| 860 | : std::__partition_with_equals_on_right<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp); | |
| 861 | _RandomAccessIterator __i = __ret.first; | |
| 570 | 862 | // [__first, __i) < *__i and *__i <= [__i+1, __last) |
| 571 | 863 | // If we were given a perfect partition, see if insertion sort is quick... |
| 572 | if (__n_swaps == 0) { | |
| 864 | if (__ret.second) { | |
| 573 | 865 | using _WrappedComp = typename _WrapAlgPolicy<_AlgPolicy, _Compare>::type; |
| 574 | 866 | _WrappedComp __wrapped_comp(__comp); |
| 575 | 867 | bool __fs = std::__insertion_sort_incomplete<_WrappedComp>(__first, __i, __wrapped_comp); |
| ... | ... | @@ -585,14 +877,11 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C |
| 585 | 877 | } |
| 586 | 878 | } |
| 587 | 879 | } |
| 588 | // sort smaller range with recursive call and larger with tail recursion elimination | |
| 589 | if (__i - __first < __last - __i) { | |
| 590 | std::__introsort<_AlgPolicy, _Compare>(__first, __i, __comp, __depth); | |
| 591 | __first = ++__i; | |
| 592 | } else { | |
| 593 | std::__introsort<_AlgPolicy, _Compare>(__i + difference_type(1), __last, __comp, __depth); | |
| 594 | __last = __i; | |
| 595 | } | |
| 880 | // Sort the left partiton recursively and the right partition with tail recursion elimination. | |
| 881 | std::__introsort<_AlgPolicy, _Compare, _RandomAccessIterator, _UseBitSetPartition>( | |
| 882 | __first, __i, __comp, __depth, __leftmost); | |
| 883 | __leftmost = false; | |
| 884 | __first = ++__i; | |
| 596 | 885 | } |
| 597 | 886 | } |
| 598 | 887 | |
| ... | ... | @@ -616,15 +905,22 @@ inline _LIBCPP_HIDE_FROM_ABI _Number __log2i(_Number __n) { |
| 616 | 905 | } |
| 617 | 906 | |
| 618 | 907 | template <class _WrappedComp, class _RandomAccessIterator> |
| 619 | void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) { | |
| 908 | _LIBCPP_HIDDEN void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) { | |
| 620 | 909 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; |
| 621 | difference_type __depth_limit = 2 * __log2i(__last - __first); | |
| 910 | difference_type __depth_limit = 2 * std::__log2i(__last - __first); | |
| 622 | 911 | |
| 623 | 912 | using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>; |
| 624 | 913 | using _AlgPolicy = typename _Unwrap::_AlgPolicy; |
| 625 | 914 | using _Compare = typename _Unwrap::_Comp; |
| 626 | 915 | _Compare __comp = _Unwrap::__get_comp(__wrapped_comp); |
| 627 | std::__introsort<_AlgPolicy, _Compare>(__first, __last, __comp, __depth_limit); | |
| 916 | // Only use bitset partitioning for arithmetic types. We should also check | |
| 917 | // that the default comparator is in use so that we are sure that there are no | |
| 918 | // branches in the comparator. | |
| 919 | std::__introsort<_AlgPolicy, | |
| 920 | _Compare, | |
| 921 | _RandomAccessIterator, | |
| 922 | __use_branchless_sort<_Compare, _RandomAccessIterator>::value>( | |
| 923 | __first, __last, __comp, __depth_limit); | |
| 628 | 924 | } |
| 629 | 925 | |
| 630 | 926 | template <class _Compare, class _Tp> |
| ... | ... | @@ -672,11 +968,11 @@ extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long do |
| 672 | 968 | extern template _LIBCPP_FUNC_VIS unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&); |
| 673 | 969 | |
| 674 | 970 | template <class _AlgPolicy, class _RandomAccessIterator, class _Comp> |
| 675 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 971 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 676 | 972 | void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) { |
| 677 | 973 | std::__debug_randomize_range<_AlgPolicy>(__first, __last); |
| 678 | 974 | |
| 679 | using _Comp_ref = typename __comp_ref_type<_Comp>::type; | |
| 975 | using _Comp_ref = __comp_ref_type<_Comp>; | |
| 680 | 976 | if (__libcpp_is_constant_evaluated()) { |
| 681 | 977 | std::__partial_sort<_AlgPolicy>(__first, __last, __last, __comp); |
| 682 | 978 | |
| ... | ... | @@ -689,13 +985,13 @@ void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _C |
| 689 | 985 | } |
| 690 | 986 | |
| 691 | 987 | template <class _RandomAccessIterator, class _Comp> |
| 692 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 988 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 693 | 989 | void sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) { |
| 694 | 990 | std::__sort_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp); |
| 695 | 991 | } |
| 696 | 992 | |
| 697 | 993 | template <class _RandomAccessIterator> |
| 698 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 994 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 699 | 995 | void sort(_RandomAccessIterator __first, _RandomAccessIterator __last) { |
| 700 | 996 | std::sort(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); |
| 701 | 997 | } |
lib/libcxx/include/__algorithm/sort_heap.h+4-5| ... | ... | @@ -25,10 +25,9 @@ |
| 25 | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| 27 | 27 | template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> |
| 28 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 28 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 29 | 29 | void __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) { |
| 30 | using _CompRef = typename __comp_ref_type<_Compare>::type; | |
| 31 | _CompRef __comp_ref = __comp; | |
| 30 | __comp_ref_type<_Compare> __comp_ref = __comp; | |
| 32 | 31 | |
| 33 | 32 | using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type; |
| 34 | 33 | for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n) |
| ... | ... | @@ -36,7 +35,7 @@ void __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _C |
| 36 | 35 | } |
| 37 | 36 | |
| 38 | 37 | template <class _RandomAccessIterator, class _Compare> |
| 39 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 38 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 40 | 39 | void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { |
| 41 | 40 | static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible."); |
| 42 | 41 | static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable."); |
| ... | ... | @@ -45,7 +44,7 @@ void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com |
| 45 | 44 | } |
| 46 | 45 | |
| 47 | 46 | template <class _RandomAccessIterator> |
| 48 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 47 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 49 | 48 | void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { |
| 50 | 49 | std::sort_heap(std::move(__first), std::move(__last), |
| 51 | 50 | __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); |
lib/libcxx/include/__algorithm/stable_partition.h+10-5| ... | ... | @@ -15,7 +15,12 @@ |
| 15 | 15 | #include <__iterator/advance.h> |
| 16 | 16 | #include <__iterator/distance.h> |
| 17 | 17 | #include <__iterator/iterator_traits.h> |
| 18 | #include <memory> | |
| 18 | #include <__memory/destruct_n.h> | |
| 19 | #include <__memory/temporary_buffer.h> | |
| 20 | #include <__memory/unique_ptr.h> | |
| 21 | #include <__utility/move.h> | |
| 22 | #include <__utility/pair.h> | |
| 23 | #include <new> | |
| 19 | 24 | #include <type_traits> |
| 20 | 25 | |
| 21 | 26 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -25,7 +30,7 @@ |
| 25 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 31 | |
| 27 | 32 | template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _Distance, class _Pair> |
| 28 | _ForwardIterator | |
| 33 | _LIBCPP_HIDE_FROM_ABI _ForwardIterator | |
| 29 | 34 | __stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, |
| 30 | 35 | _Distance __len, _Pair __p, forward_iterator_tag __fit) |
| 31 | 36 | { |
| ... | ... | @@ -114,7 +119,7 @@ __second_half_done: |
| 114 | 119 | } |
| 115 | 120 | |
| 116 | 121 | template <class _AlgPolicy, class _Predicate, class _ForwardIterator> |
| 117 | _ForwardIterator | |
| 122 | _LIBCPP_HIDE_FROM_ABI _ForwardIterator | |
| 118 | 123 | __stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, |
| 119 | 124 | forward_iterator_tag) |
| 120 | 125 | { |
| ... | ... | @@ -259,7 +264,7 @@ __second_half_done: |
| 259 | 264 | } |
| 260 | 265 | |
| 261 | 266 | template <class _AlgPolicy, class _Predicate, class _BidirectionalIterator> |
| 262 | _BidirectionalIterator | |
| 267 | _LIBCPP_HIDE_FROM_ABI _BidirectionalIterator | |
| 263 | 268 | __stable_partition_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, |
| 264 | 269 | bidirectional_iterator_tag) |
| 265 | 270 | { |
| ... | ... | @@ -305,7 +310,7 @@ template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _Ite |
| 305 | 310 | _LIBCPP_HIDE_FROM_ABI |
| 306 | 311 | _ForwardIterator __stable_partition( |
| 307 | 312 | _ForwardIterator __first, _ForwardIterator __last, _Predicate&& __pred, _IterCategory __iter_category) { |
| 308 | return std::__stable_partition_impl<_AlgPolicy, __uncvref_t<_Predicate>&>( | |
| 313 | return std::__stable_partition_impl<_AlgPolicy, __remove_cvref_t<_Predicate>&>( | |
| 309 | 314 | std::move(__first), std::move(__last), __pred, __iter_category); |
| 310 | 315 | } |
| 311 | 316 |
lib/libcxx/include/__algorithm/stable_sort.h+8-5| ... | ... | @@ -16,8 +16,12 @@ |
| 16 | 16 | #include <__algorithm/sort.h> |
| 17 | 17 | #include <__config> |
| 18 | 18 | #include <__iterator/iterator_traits.h> |
| 19 | #include <__memory/destruct_n.h> | |
| 20 | #include <__memory/temporary_buffer.h> | |
| 21 | #include <__memory/unique_ptr.h> | |
| 19 | 22 | #include <__utility/move.h> |
| 20 | #include <memory> | |
| 23 | #include <__utility/pair.h> | |
| 24 | #include <new> | |
| 21 | 25 | #include <type_traits> |
| 22 | 26 | |
| 23 | 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -27,7 +31,7 @@ |
| 27 | 31 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 32 | |
| 29 | 33 | template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2> |
| 30 | void | |
| 34 | _LIBCPP_HIDE_FROM_ABI void | |
| 31 | 35 | __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1, |
| 32 | 36 | _InputIterator2 __first2, _InputIterator2 __last2, |
| 33 | 37 | typename iterator_traits<_InputIterator1>::value_type* __result, _Compare __comp) |
| ... | ... | @@ -69,7 +73,7 @@ __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1, |
| 69 | 73 | } |
| 70 | 74 | |
| 71 | 75 | template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 72 | void | |
| 76 | _LIBCPP_HIDE_FROM_ABI void | |
| 73 | 77 | __merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1, |
| 74 | 78 | _InputIterator2 __first2, _InputIterator2 __last2, |
| 75 | 79 | _OutputIterator __result, _Compare __comp) |
| ... | ... | @@ -223,8 +227,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 223 | 227 | __h.reset(__buf.first); |
| 224 | 228 | } |
| 225 | 229 | |
| 226 | using _Comp_ref = typename __comp_ref_type<_Compare>::type; | |
| 227 | std::__stable_sort<_AlgPolicy, _Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second); | |
| 230 | std::__stable_sort<_AlgPolicy, __comp_ref_type<_Compare> >(__first, __last, __comp, __len, __buf.first, __buf.second); | |
| 228 | 231 | } |
| 229 | 232 | |
| 230 | 233 | template <class _RandomAccessIterator, class _Compare> |
lib/libcxx/include/__algorithm/swap_ranges.h+3-3| ... | ... | @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | // 2+2 iterators: the shorter size will be used. |
| 24 | 24 | template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2, class _Sentinel2> |
| 25 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 25 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 26 | 26 | pair<_ForwardIterator1, _ForwardIterator2> |
| 27 | 27 | __swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2, _Sentinel2 __last2) { |
| 28 | 28 | while (__first1 != __last1 && __first2 != __last2) { |
| ... | ... | @@ -36,7 +36,7 @@ __swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 |
| 36 | 36 | |
| 37 | 37 | // 2+1 iterators: size2 >= size1. |
| 38 | 38 | template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2> |
| 39 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 39 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 40 | 40 | pair<_ForwardIterator1, _ForwardIterator2> |
| 41 | 41 | __swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2) { |
| 42 | 42 | while (__first1 != __last1) { |
| ... | ... | @@ -49,7 +49,7 @@ __swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | template <class _ForwardIterator1, class _ForwardIterator2> |
| 52 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator2 | |
| 52 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator2 | |
| 53 | 53 | swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) { |
| 54 | 54 | return std::__swap_ranges<_ClassicAlgPolicy>( |
| 55 | 55 | std::move(__first1), std::move(__last1), std::move(__first2)).second; |
lib/libcxx/include/__algorithm/transform.h+2-2| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | 20 | template <class _InputIterator, class _OutputIterator, class _UnaryOperation> |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 21 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 22 | 22 | _OutputIterator |
| 23 | 23 | transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __op) |
| 24 | 24 | { |
| ... | ... | @@ -28,7 +28,7 @@ transform(_InputIterator __first, _InputIterator __last, _OutputIterator __resul |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _BinaryOperation> |
| 31 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 31 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 32 | 32 | _OutputIterator |
| 33 | 33 | transform(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, |
| 34 | 34 | _OutputIterator __result, _BinaryOperation __binary_op) |
lib/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h+5-5| ... | ... | @@ -36,21 +36,21 @@ template <class _Gen> |
| 36 | 36 | class _ClassicGenAdaptor { |
| 37 | 37 | private: |
| 38 | 38 | // The generator is not required to be copyable or movable, so it has to be stored as a reference. |
| 39 | _Gen& __gen; | |
| 39 | _Gen& __gen_; | |
| 40 | 40 | |
| 41 | 41 | public: |
| 42 | 42 | using result_type = invoke_result_t<_Gen&>; |
| 43 | 43 | |
| 44 | 44 | _LIBCPP_HIDE_FROM_ABI |
| 45 | static constexpr auto min() { return __uncvref_t<_Gen>::min(); } | |
| 45 | static constexpr auto min() { return __remove_cvref_t<_Gen>::min(); } | |
| 46 | 46 | _LIBCPP_HIDE_FROM_ABI |
| 47 | static constexpr auto max() { return __uncvref_t<_Gen>::max(); } | |
| 47 | static constexpr auto max() { return __remove_cvref_t<_Gen>::max(); } | |
| 48 | 48 | |
| 49 | 49 | _LIBCPP_HIDE_FROM_ABI |
| 50 | constexpr explicit _ClassicGenAdaptor(_Gen& __g) : __gen(__g) {} | |
| 50 | constexpr explicit _ClassicGenAdaptor(_Gen& __g) : __gen_(__g) {} | |
| 51 | 51 | |
| 52 | 52 | _LIBCPP_HIDE_FROM_ABI |
| 53 | constexpr auto operator()() const { return __gen(); } | |
| 53 | constexpr auto operator()() const { return __gen_(); } | |
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | 56 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/unique.h+4-5| ... | ... | @@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | // unique |
| 27 | 27 | |
| 28 | 28 | template <class _AlgPolicy, class _Iter, class _Sent, class _BinaryPredicate> |
| 29 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 std::pair<_Iter, _Iter> | |
| 29 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 std::pair<_Iter, _Iter> | |
| 30 | 30 | __unique(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) { |
| 31 | 31 | __first = std::__adjacent_find(__first, __last, __pred); |
| 32 | 32 | if (__first != __last) { |
| ... | ... | @@ -43,16 +43,15 @@ __unique(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) { |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | template <class _ForwardIterator, class _BinaryPredicate> |
| 46 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 46 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 47 | 47 | unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) { |
| 48 | 48 | return std::__unique<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __pred).first; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | template <class _ForwardIterator> |
| 52 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 52 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 53 | 53 | unique(_ForwardIterator __first, _ForwardIterator __last) { |
| 54 | typedef typename iterator_traits<_ForwardIterator>::value_type __v; | |
| 55 | return std::unique(__first, __last, __equal_to<__v>()); | |
| 54 | return std::unique(__first, __last, __equal_to()); | |
| 56 | 55 | } |
| 57 | 56 | |
| 58 | 57 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/unique_copy.h+9-10| ... | ... | @@ -34,7 +34,7 @@ struct __read_from_tmp_value_tag {}; |
| 34 | 34 | } // namespace __unique_copy_tags |
| 35 | 35 | |
| 36 | 36 | template <class _AlgPolicy, class _BinaryPredicate, class _InputIterator, class _Sent, class _OutputIterator> |
| 37 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _OutputIterator> | |
| 37 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _OutputIterator> | |
| 38 | 38 | __unique_copy(_InputIterator __first, |
| 39 | 39 | _Sent __last, |
| 40 | 40 | _OutputIterator __result, |
| ... | ... | @@ -56,7 +56,7 @@ __unique_copy(_InputIterator __first, |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | template <class _AlgPolicy, class _BinaryPredicate, class _ForwardIterator, class _Sent, class _OutputIterator> |
| 59 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI pair<_ForwardIterator, _OutputIterator> | |
| 59 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pair<_ForwardIterator, _OutputIterator> | |
| 60 | 60 | __unique_copy(_ForwardIterator __first, |
| 61 | 61 | _Sent __last, |
| 62 | 62 | _OutputIterator __result, |
| ... | ... | @@ -78,7 +78,7 @@ __unique_copy(_ForwardIterator __first, |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | template <class _AlgPolicy, class _BinaryPredicate, class _InputIterator, class _Sent, class _InputAndOutputIterator> |
| 81 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _InputAndOutputIterator> | |
| 81 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _InputAndOutputIterator> | |
| 82 | 82 | __unique_copy(_InputIterator __first, |
| 83 | 83 | _Sent __last, |
| 84 | 84 | _InputAndOutputIterator __result, |
| ... | ... | @@ -95,27 +95,26 @@ __unique_copy(_InputIterator __first, |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | template <class _InputIterator, class _OutputIterator, class _BinaryPredicate> |
| 98 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator | |
| 98 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | |
| 99 | 99 | unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredicate __pred) { |
| 100 | using __algo_tag = typename conditional< | |
| 100 | using __algo_tag = __conditional_t< | |
| 101 | 101 | is_base_of<forward_iterator_tag, typename iterator_traits<_InputIterator>::iterator_category>::value, |
| 102 | 102 | __unique_copy_tags::__reread_from_input_tag, |
| 103 | typename conditional< | |
| 103 | __conditional_t< | |
| 104 | 104 | is_base_of<forward_iterator_tag, typename iterator_traits<_OutputIterator>::iterator_category>::value && |
| 105 | 105 | is_same< typename iterator_traits<_InputIterator>::value_type, |
| 106 | 106 | typename iterator_traits<_OutputIterator>::value_type>::value, |
| 107 | 107 | __unique_copy_tags::__reread_from_output_tag, |
| 108 | __unique_copy_tags::__read_from_tmp_value_tag>::type >::type; | |
| 108 | __unique_copy_tags::__read_from_tmp_value_tag> >; | |
| 109 | 109 | return std::__unique_copy<_ClassicAlgPolicy>( |
| 110 | 110 | std::move(__first), std::move(__last), std::move(__result), __pred, __algo_tag()) |
| 111 | 111 | .second; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | template <class _InputIterator, class _OutputIterator> |
| 115 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator | |
| 115 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | |
| 116 | 116 | unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { |
| 117 | typedef typename iterator_traits<_InputIterator>::value_type __v; | |
| 118 | return std::unique_copy(std::move(__first), std::move(__last), std::move(__result), __equal_to<__v>()); | |
| 117 | return std::unique_copy(std::move(__first), std::move(__last), std::move(__result), __equal_to()); | |
| 119 | 118 | } |
| 120 | 119 | |
| 121 | 120 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__algorithm/unwrap_iter.h+4-2| ... | ... | @@ -12,8 +12,10 @@ |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__iterator/iterator_traits.h> |
| 14 | 14 | #include <__memory/pointer_traits.h> |
| 15 | #include <__type_traits/enable_if.h> | |
| 16 | #include <__type_traits/is_copy_constructible.h> | |
| 17 | #include <__utility/declval.h> | |
| 15 | 18 | #include <__utility/move.h> |
| 16 | #include <type_traits> | |
| 17 | 19 | |
| 18 | 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 21 | # pragma GCC system_header |
| ... | ... | @@ -57,7 +59,7 @@ struct __unwrap_iter_impl<_Iter, true> { |
| 57 | 59 | template<class _Iter, |
| 58 | 60 | class _Impl = __unwrap_iter_impl<_Iter>, |
| 59 | 61 | __enable_if_t<is_copy_constructible<_Iter>::value, int> = 0> |
| 60 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 62 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 61 | 63 | decltype(_Impl::__unwrap(std::declval<_Iter>())) __unwrap_iter(_Iter __i) _NOEXCEPT { |
| 62 | 64 | return _Impl::__unwrap(__i); |
| 63 | 65 | } |
lib/libcxx/include/__algorithm/unwrap_range.h+1-1| ... | ... | @@ -28,7 +28,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 28 | // __unwrap_iter and __rewrap_iter don't work for this, because they assume that the iterator and sentinel have |
| 29 | 29 | // the same type. __unwrap_range tries to get two iterators and then forward to __unwrap_iter. |
| 30 | 30 | |
| 31 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 31 | #if _LIBCPP_STD_VER > 17 | |
| 32 | 32 | template <class _Iter, class _Sent> |
| 33 | 33 | struct __unwrap_range_impl { |
| 34 | 34 | _LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Sent __sent) |
lib/libcxx/include/__algorithm/upper_bound.h+3-3| ... | ... | @@ -28,7 +28,7 @@ |
| 28 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | |
| 30 | 30 | template <class _AlgPolicy, class _Compare, class _Iter, class _Sent, class _Tp, class _Proj> |
| 31 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter | |
| 31 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter | |
| 32 | 32 | __upper_bound(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp, _Proj&& __proj) { |
| 33 | 33 | auto __len = _IterOps<_AlgPolicy>::distance(__first, __last); |
| 34 | 34 | while (__len != 0) { |
| ... | ... | @@ -45,7 +45,7 @@ __upper_bound(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | template <class _ForwardIterator, class _Tp, class _Compare> |
| 48 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 48 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 49 | 49 | upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) { |
| 50 | 50 | static_assert(is_copy_constructible<_ForwardIterator>::value, |
| 51 | 51 | "Iterator has to be copy constructible"); |
| ... | ... | @@ -54,7 +54,7 @@ upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | template <class _ForwardIterator, class _Tp> |
| 57 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 57 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | |
| 58 | 58 | upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { |
| 59 | 59 | return std::upper_bound( |
| 60 | 60 | std::move(__first), |
lib/libcxx/include/__assert+3-7| ... | ... | @@ -17,13 +17,9 @@ |
| 17 | 17 | # pragma GCC system_header |
| 18 | 18 | #endif |
| 19 | 19 | |
| 20 | // This is for backwards compatibility with code that might have been enabling | |
| 21 | // assertions through the Debug mode previously. | |
| 22 | // TODO: In LLVM 16, make it an error to define _LIBCPP_DEBUG | |
| 20 | // TODO: Remove in LLVM 17. | |
| 23 | 21 | #if defined(_LIBCPP_DEBUG) |
| 24 | # ifndef _LIBCPP_ENABLE_ASSERTIONS | |
| 25 | # define _LIBCPP_ENABLE_ASSERTIONS 1 | |
| 26 | # endif | |
| 22 | # error "Defining _LIBCPP_DEBUG is not supported anymore. Please use _LIBCPP_ENABLE_DEBUG_MODE instead." | |
| 27 | 23 | #endif |
| 28 | 24 | |
| 29 | 25 | // Automatically enable assertions when the debug mode is enabled. |
| ... | ... | @@ -45,7 +41,7 @@ |
| 45 | 41 | # define _LIBCPP_ASSERT(expression, message) \ |
| 46 | 42 | (__builtin_expect(static_cast<bool>(expression), 1) ? \ |
| 47 | 43 | (void)0 : \ |
| 48 | ::std::__libcpp_verbose_abort("%s:%d: assertion %s failed: %s", __FILE__, __LINE__, #expression, message)) | |
| 44 | _LIBCPP_VERBOSE_ABORT("%s:%d: assertion %s failed: %s", __FILE__, __LINE__, #expression, message)) | |
| 49 | 45 | #elif !defined(_LIBCPP_ASSERTIONS_DISABLE_ASSUME) && __has_builtin(__builtin_assume) |
| 50 | 46 | # define _LIBCPP_ASSERT(expression, message) \ |
| 51 | 47 | (_LIBCPP_DIAGNOSTIC_PUSH \ |
lib/libcxx/include/__availability+3-14| ... | ... | @@ -156,20 +156,9 @@ |
| 156 | 156 | # define _LIBCPP_AVAILABILITY_FORMAT |
| 157 | 157 | // # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format |
| 158 | 158 | |
| 159 | // This controls whether the default verbose termination function is | |
| 160 | // provided by the library. | |
| 161 | // | |
| 162 | // Note that when users provide their own custom function, it doesn't | |
| 163 | // matter whether the dylib provides a default function, and the | |
| 164 | // availability markup can actually give a false positive diagnostic | |
| 165 | // (it will think that no function is provided, when in reality the | |
| 166 | // user has provided their own). | |
| 167 | // | |
| 168 | // Users can pass -D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED | |
| 169 | // to the compiler to tell the library not to define its own verbose abort. | |
| 170 | // Note that defining this macro but failing to define a custom function | |
| 171 | // will lead to a load-time error on back-deployment targets, so it should | |
| 172 | // be avoided. | |
| 159 | // This controls whether the library claims to provide a default verbose | |
| 160 | // termination function, and consequently whether the headers will try | |
| 161 | // to use it when the mechanism isn't overriden at compile-time. | |
| 173 | 162 | // # define _LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY |
| 174 | 163 | |
| 175 | 164 | #elif defined(__APPLE__) |
lib/libcxx/include/__bit/bit_cast.h+1-1| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | #define _LIBCPP___BIT_BIT_CAST_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <type_traits> | |
| 14 | #include <__type_traits/is_trivially_copyable.h> | |
| 15 | 15 | |
| 16 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 17 | # pragma GCC system_header |
lib/libcxx/include/__bit/bit_ceil.h created+46| ... | ... | @@ -0,0 +1,46 @@ |
| 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___BIT_BIT_CEIL_H | |
| 10 | #define _LIBCPP___BIT_BIT_CEIL_H | |
| 11 | ||
| 12 | #include <__assert> | |
| 13 | #include <__bit/countl.h> | |
| 14 | #include <__concepts/arithmetic.h> | |
| 15 | #include <__config> | |
| 16 | #include <limits> | |
| 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 | #if _LIBCPP_STD_VER >= 20 | |
| 25 | ||
| 26 | template <__libcpp_unsigned_integer _Tp> | |
| 27 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_ceil(_Tp __t) noexcept { | |
| 28 | if (__t < 2) | |
| 29 | return 1; | |
| 30 | const unsigned __n = numeric_limits<_Tp>::digits - std::countl_zero((_Tp)(__t - 1u)); | |
| 31 | _LIBCPP_ASSERT(__n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil"); | |
| 32 | ||
| 33 | if constexpr (sizeof(_Tp) >= sizeof(unsigned)) | |
| 34 | return _Tp{1} << __n; | |
| 35 | else { | |
| 36 | const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits; | |
| 37 | const unsigned __retVal = 1u << (__n + __extra); | |
| 38 | return (_Tp)(__retVal >> __extra); | |
| 39 | } | |
| 40 | } | |
| 41 | ||
| 42 | #endif // _LIBCPP_STD_VER >= 20 | |
| 43 | ||
| 44 | _LIBCPP_END_NAMESPACE_STD | |
| 45 | ||
| 46 | #endif // _LIBCPP___BIT_BIT_CEIL_H |
lib/libcxx/include/__bit/bit_floor.h created+34| ... | ... | @@ -0,0 +1,34 @@ |
| 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___BIT_BIT_FLOOR_H | |
| 10 | #define _LIBCPP___BIT_BIT_FLOOR_H | |
| 11 | ||
| 12 | #include <__bit/bit_log2.h> | |
| 13 | #include <__concepts/arithmetic.h> | |
| 14 | #include <__config> | |
| 15 | #include <limits> | |
| 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 | #if _LIBCPP_STD_VER >= 20 | |
| 24 | ||
| 25 | template <__libcpp_unsigned_integer _Tp> | |
| 26 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_floor(_Tp __t) noexcept { | |
| 27 | return __t == 0 ? 0 : _Tp{1} << std::__bit_log2(__t); | |
| 28 | } | |
| 29 | ||
| 30 | #endif // _LIBCPP_STD_VER >= 20 | |
| 31 | ||
| 32 | _LIBCPP_END_NAMESPACE_STD | |
| 33 | ||
| 34 | #endif // _LIBCPP___BIT_BIT_FLOOR_H |
lib/libcxx/include/__bit/bit_log2.h created+34| ... | ... | @@ -0,0 +1,34 @@ |
| 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___BIT_BIT_LOG2_H | |
| 10 | #define _LIBCPP___BIT_BIT_LOG2_H | |
| 11 | ||
| 12 | #include <__bit/countl.h> | |
| 13 | #include <__concepts/arithmetic.h> | |
| 14 | #include <__config> | |
| 15 | #include <limits> | |
| 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 | #if _LIBCPP_STD_VER >= 20 | |
| 24 | ||
| 25 | template <__libcpp_unsigned_integer _Tp> | |
| 26 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __bit_log2(_Tp __t) noexcept { | |
| 27 | return numeric_limits<_Tp>::digits - 1 - std::countl_zero(__t); | |
| 28 | } | |
| 29 | ||
| 30 | #endif // _LIBCPP_STD_VER >= 20 | |
| 31 | ||
| 32 | _LIBCPP_END_NAMESPACE_STD | |
| 33 | ||
| 34 | #endif // _LIBCPP___BIT_BIT_LOG2_H |
lib/libcxx/include/__bit/bit_width.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___BIT_BIT_WIDTH_H | |
| 10 | #define _LIBCPP___BIT_BIT_WIDTH_H | |
| 11 | ||
| 12 | #include <__bit/bit_log2.h> | |
| 13 | #include <__concepts/arithmetic.h> | |
| 14 | #include <__config> | |
| 15 | ||
| 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 17 | # pragma GCC system_header | |
| 18 | #endif | |
| 19 | ||
| 20 | #if _LIBCPP_STD_VER >= 20 | |
| 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 23 | ||
| 24 | template <__libcpp_unsigned_integer _Tp> | |
| 25 | _LIBCPP_HIDE_FROM_ABI constexpr int bit_width(_Tp __t) noexcept { | |
| 26 | return __t == 0 ? 0 : std::__bit_log2(__t) + 1; | |
| 27 | } | |
| 28 | ||
| 29 | _LIBCPP_END_NAMESPACE_STD | |
| 30 | ||
| 31 | #endif // _LIBCPP_STD_VER >= 20 | |
| 32 | ||
| 33 | #endif // _LIBCPP___BIT_BIT_WIDTH_H |
lib/libcxx/include/__bit/blsr.h created+34| ... | ... | @@ -0,0 +1,34 @@ |
| 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___BIT_BLSR_H | |
| 10 | #define _LIBCPP___BIT_BLSR_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 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unsigned __libcpp_blsr(unsigned __x) _NOEXCEPT { | |
| 21 | return __x ^ (__x & -__x); | |
| 22 | } | |
| 23 | ||
| 24 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unsigned long __libcpp_blsr(unsigned long __x) _NOEXCEPT { | |
| 25 | return __x ^ (__x & -__x); | |
| 26 | } | |
| 27 | ||
| 28 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unsigned long long __libcpp_blsr(unsigned long long __x) _NOEXCEPT { | |
| 29 | return __x ^ (__x & -__x); | |
| 30 | } | |
| 31 | ||
| 32 | _LIBCPP_END_NAMESPACE_STD | |
| 33 | ||
| 34 | #endif // _LIBCPP___BIT_BLSR_H |
lib/libcxx/include/__bit/countl.h created+104| ... | ... | @@ -0,0 +1,104 @@ |
| 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___BIT_COUNTL_H | |
| 10 | #define _LIBCPP___BIT_COUNTL_H | |
| 11 | ||
| 12 | #include <__bit/rotate.h> | |
| 13 | #include <__concepts/arithmetic.h> | |
| 14 | #include <__config> | |
| 15 | #include <__type_traits/is_unsigned_integer.h> | |
| 16 | #include <limits> | |
| 17 | ||
| 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 19 | # pragma GCC system_header | |
| 20 | #endif | |
| 21 | ||
| 22 | _LIBCPP_PUSH_MACROS | |
| 23 | #include <__undef_macros> | |
| 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 26 | ||
| 27 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 28 | int __libcpp_clz(unsigned __x) _NOEXCEPT { return __builtin_clz(__x); } | |
| 29 | ||
| 30 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 31 | int __libcpp_clz(unsigned long __x) _NOEXCEPT { return __builtin_clzl(__x); } | |
| 32 | ||
| 33 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 34 | int __libcpp_clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); } | |
| 35 | ||
| 36 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 37 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 38 | int __libcpp_clz(__uint128_t __x) _NOEXCEPT { | |
| 39 | // The function is written in this form due to C++ constexpr limitations. | |
| 40 | // The algorithm: | |
| 41 | // - Test whether any bit in the high 64-bits is set | |
| 42 | // - No bits set: | |
| 43 | // - The high 64-bits contain 64 leading zeros, | |
| 44 | // - Add the result of the low 64-bits. | |
| 45 | // - Any bits set: | |
| 46 | // - The number of leading zeros of the input is the number of leading | |
| 47 | // zeros in the high 64-bits. | |
| 48 | return ((__x >> 64) == 0) | |
| 49 | ? (64 + __builtin_clzll(static_cast<unsigned long long>(__x))) | |
| 50 | : __builtin_clzll(static_cast<unsigned long long>(__x >> 64)); | |
| 51 | } | |
| 52 | # endif // _LIBCPP_HAS_NO_INT128 | |
| 53 | ||
| 54 | template<class _Tp> | |
| 55 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 56 | int __countl_zero(_Tp __t) _NOEXCEPT | |
| 57 | { | |
| 58 | static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires an unsigned integer type"); | |
| 59 | if (__t == 0) | |
| 60 | return numeric_limits<_Tp>::digits; | |
| 61 | ||
| 62 | if (sizeof(_Tp) <= sizeof(unsigned int)) | |
| 63 | return std::__libcpp_clz(static_cast<unsigned int>(__t)) | |
| 64 | - (numeric_limits<unsigned int>::digits - numeric_limits<_Tp>::digits); | |
| 65 | else if (sizeof(_Tp) <= sizeof(unsigned long)) | |
| 66 | return std::__libcpp_clz(static_cast<unsigned long>(__t)) | |
| 67 | - (numeric_limits<unsigned long>::digits - numeric_limits<_Tp>::digits); | |
| 68 | else if (sizeof(_Tp) <= sizeof(unsigned long long)) | |
| 69 | return std::__libcpp_clz(static_cast<unsigned long long>(__t)) | |
| 70 | - (numeric_limits<unsigned long long>::digits - numeric_limits<_Tp>::digits); | |
| 71 | else | |
| 72 | { | |
| 73 | int __ret = 0; | |
| 74 | int __iter = 0; | |
| 75 | const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits; | |
| 76 | while (true) { | |
| 77 | __t = std::__rotr(__t, __ulldigits); | |
| 78 | if ((__iter = std::__countl_zero(static_cast<unsigned long long>(__t))) != __ulldigits) | |
| 79 | break; | |
| 80 | __ret += __iter; | |
| 81 | } | |
| 82 | return __ret + __iter; | |
| 83 | } | |
| 84 | } | |
| 85 | ||
| 86 | #if _LIBCPP_STD_VER >= 20 | |
| 87 | ||
| 88 | template <__libcpp_unsigned_integer _Tp> | |
| 89 | _LIBCPP_HIDE_FROM_ABI constexpr int countl_zero(_Tp __t) noexcept { | |
| 90 | return std::__countl_zero(__t); | |
| 91 | } | |
| 92 | ||
| 93 | template <__libcpp_unsigned_integer _Tp> | |
| 94 | _LIBCPP_HIDE_FROM_ABI constexpr int countl_one(_Tp __t) noexcept { | |
| 95 | return __t != numeric_limits<_Tp>::max() ? std::countl_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits; | |
| 96 | } | |
| 97 | ||
| 98 | #endif // _LIBCPP_STD_VER >= 20 | |
| 99 | ||
| 100 | _LIBCPP_END_NAMESPACE_STD | |
| 101 | ||
| 102 | _LIBCPP_POP_MACROS | |
| 103 | ||
| 104 | #endif // _LIBCPP___BIT_COUNTL_H |
lib/libcxx/include/__bit/countr.h created+70| ... | ... | @@ -0,0 +1,70 @@ |
| 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___BIT_COUNTR_H | |
| 10 | #define _LIBCPP___BIT_COUNTR_H | |
| 11 | ||
| 12 | #include <__bit/rotate.h> | |
| 13 | #include <__concepts/arithmetic.h> | |
| 14 | #include <__config> | |
| 15 | #include <limits> | |
| 16 | ||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 18 | # pragma GCC system_header | |
| 19 | #endif | |
| 20 | ||
| 21 | _LIBCPP_PUSH_MACROS | |
| 22 | #include <__undef_macros> | |
| 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 25 | ||
| 26 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 27 | int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); } | |
| 28 | ||
| 29 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 30 | int __libcpp_ctz(unsigned long __x) _NOEXCEPT { return __builtin_ctzl(__x); } | |
| 31 | ||
| 32 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 33 | int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); } | |
| 34 | ||
| 35 | #if _LIBCPP_STD_VER >= 20 | |
| 36 | ||
| 37 | template <__libcpp_unsigned_integer _Tp> | |
| 38 | _LIBCPP_HIDE_FROM_ABI constexpr int countr_zero(_Tp __t) noexcept { | |
| 39 | if (__t == 0) | |
| 40 | return numeric_limits<_Tp>::digits; | |
| 41 | ||
| 42 | if (sizeof(_Tp) <= sizeof(unsigned int)) | |
| 43 | return std::__libcpp_ctz(static_cast<unsigned int>(__t)); | |
| 44 | else if (sizeof(_Tp) <= sizeof(unsigned long)) | |
| 45 | return std::__libcpp_ctz(static_cast<unsigned long>(__t)); | |
| 46 | else if (sizeof(_Tp) <= sizeof(unsigned long long)) | |
| 47 | return std::__libcpp_ctz(static_cast<unsigned long long>(__t)); | |
| 48 | else { | |
| 49 | int __ret = 0; | |
| 50 | const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits; | |
| 51 | while (static_cast<unsigned long long>(__t) == 0uLL) { | |
| 52 | __ret += __ulldigits; | |
| 53 | __t >>= __ulldigits; | |
| 54 | } | |
| 55 | return __ret + std::__libcpp_ctz(static_cast<unsigned long long>(__t)); | |
| 56 | } | |
| 57 | } | |
| 58 | ||
| 59 | template <__libcpp_unsigned_integer _Tp> | |
| 60 | _LIBCPP_HIDE_FROM_ABI constexpr int countr_one(_Tp __t) noexcept { | |
| 61 | return __t != numeric_limits<_Tp>::max() ? std::countr_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits; | |
| 62 | } | |
| 63 | ||
| 64 | #endif // _LIBCPP_STD_VER >= 20 | |
| 65 | ||
| 66 | _LIBCPP_END_NAMESPACE_STD | |
| 67 | ||
| 68 | _LIBCPP_POP_MACROS | |
| 69 | ||
| 70 | #endif // _LIBCPP___BIT_COUNTR_H |
lib/libcxx/include/__bit/endian.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 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___BIT_ENDIAN_H | |
| 10 | #define _LIBCPP___BIT_ENDIAN_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | ||
| 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 15 | # pragma GCC system_header | |
| 16 | #endif | |
| 17 | ||
| 18 | #if _LIBCPP_STD_VER >= 20 | |
| 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 21 | ||
| 22 | enum class endian { | |
| 23 | little = 0xDEAD, | |
| 24 | big = 0xFACE, | |
| 25 | # if defined(_LIBCPP_LITTLE_ENDIAN) | |
| 26 | native = little | |
| 27 | # elif defined(_LIBCPP_BIG_ENDIAN) | |
| 28 | native = big | |
| 29 | # else | |
| 30 | native = 0xCAFE | |
| 31 | # endif | |
| 32 | }; | |
| 33 | ||
| 34 | _LIBCPP_END_NAMESPACE_STD | |
| 35 | ||
| 36 | #endif // _LIBCPP_STD_VER >= 20 | |
| 37 | ||
| 38 | #endif // _LIBCPP___BIT_ENDIAN_H |
lib/libcxx/include/__bit/has_single_bit.h created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 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___BIT_HAS_SINGLE_BIT_H | |
| 10 | #define _LIBCPP___BIT_HAS_SINGLE_BIT_H | |
| 11 | ||
| 12 | #include <__concepts/arithmetic.h> | |
| 13 | #include <__config> | |
| 14 | ||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 16 | # pragma GCC system_header | |
| 17 | #endif | |
| 18 | ||
| 19 | _LIBCPP_PUSH_MACROS | |
| 20 | #include <__undef_macros> | |
| 21 | ||
| 22 | #if _LIBCPP_STD_VER >= 20 | |
| 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 25 | ||
| 26 | template <__libcpp_unsigned_integer _Tp> | |
| 27 | _LIBCPP_HIDE_FROM_ABI constexpr bool has_single_bit(_Tp __t) noexcept { | |
| 28 | return __t != 0 && (((__t & (__t - 1)) == 0)); | |
| 29 | } | |
| 30 | ||
| 31 | _LIBCPP_END_NAMESPACE_STD | |
| 32 | ||
| 33 | #endif // _LIBCPP_STD_VER >= 20 | |
| 34 | ||
| 35 | _LIBCPP_POP_MACROS | |
| 36 | ||
| 37 | #endif // _LIBCPP___BIT_HAS_SINGLE_BIT_H |
lib/libcxx/include/__bit/popcount.h created+61| ... | ... | @@ -0,0 +1,61 @@ |
| 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___BIT_POPCOUNT_H | |
| 10 | #define _LIBCPP___BIT_POPCOUNT_H | |
| 11 | ||
| 12 | #include <__bit/rotate.h> | |
| 13 | #include <__concepts/arithmetic.h> | |
| 14 | #include <__config> | |
| 15 | #include <limits> | |
| 16 | ||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 18 | # pragma GCC system_header | |
| 19 | #endif | |
| 20 | ||
| 21 | _LIBCPP_PUSH_MACROS | |
| 22 | #include <__undef_macros> | |
| 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 25 | ||
| 26 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 27 | int __libcpp_popcount(unsigned __x) _NOEXCEPT { return __builtin_popcount(__x); } | |
| 28 | ||
| 29 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 30 | int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popcountl(__x); } | |
| 31 | ||
| 32 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 33 | int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); } | |
| 34 | ||
| 35 | #if _LIBCPP_STD_VER >= 20 | |
| 36 | ||
| 37 | template <__libcpp_unsigned_integer _Tp> | |
| 38 | _LIBCPP_HIDE_FROM_ABI constexpr int popcount(_Tp __t) noexcept { | |
| 39 | if (sizeof(_Tp) <= sizeof(unsigned int)) | |
| 40 | return std::__libcpp_popcount(static_cast<unsigned int>(__t)); | |
| 41 | else if (sizeof(_Tp) <= sizeof(unsigned long)) | |
| 42 | return std::__libcpp_popcount(static_cast<unsigned long>(__t)); | |
| 43 | else if (sizeof(_Tp) <= sizeof(unsigned long long)) | |
| 44 | return std::__libcpp_popcount(static_cast<unsigned long long>(__t)); | |
| 45 | else { | |
| 46 | int __ret = 0; | |
| 47 | while (__t != 0) { | |
| 48 | __ret += std::__libcpp_popcount(static_cast<unsigned long long>(__t)); | |
| 49 | __t >>= numeric_limits<unsigned long long>::digits; | |
| 50 | } | |
| 51 | return __ret; | |
| 52 | } | |
| 53 | } | |
| 54 | ||
| 55 | #endif // _LIBCPP_STD_VER >= 20 | |
| 56 | ||
| 57 | _LIBCPP_END_NAMESPACE_STD | |
| 58 | ||
| 59 | _LIBCPP_POP_MACROS | |
| 60 | ||
| 61 | #endif // _LIBCPP___BIT_POPCOUNT_H |
lib/libcxx/include/__bit/rotate.h created+53| ... | ... | @@ -0,0 +1,53 @@ |
| 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___BIT_ROTATE_H | |
| 10 | #define _LIBCPP___BIT_ROTATE_H | |
| 11 | ||
| 12 | #include <__concepts/arithmetic.h> | |
| 13 | #include <__config> | |
| 14 | #include <__type_traits/is_unsigned_integer.h> | |
| 15 | #include <limits> | |
| 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 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 25 | _Tp __rotr(_Tp __t, unsigned int __cnt) _NOEXCEPT | |
| 26 | { | |
| 27 | static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotr requires an unsigned integer type"); | |
| 28 | const unsigned int __dig = numeric_limits<_Tp>::digits; | |
| 29 | if ((__cnt % __dig) == 0) | |
| 30 | return __t; | |
| 31 | return (__t >> (__cnt % __dig)) | (__t << (__dig - (__cnt % __dig))); | |
| 32 | } | |
| 33 | ||
| 34 | #if _LIBCPP_STD_VER >= 20 | |
| 35 | ||
| 36 | template <__libcpp_unsigned_integer _Tp> | |
| 37 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp rotl(_Tp __t, unsigned int __cnt) noexcept { | |
| 38 | const unsigned int __dig = numeric_limits<_Tp>::digits; | |
| 39 | if ((__cnt % __dig) == 0) | |
| 40 | return __t; | |
| 41 | return (__t << (__cnt % __dig)) | (__t >> (__dig - (__cnt % __dig))); | |
| 42 | } | |
| 43 | ||
| 44 | template <__libcpp_unsigned_integer _Tp> | |
| 45 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp rotr(_Tp __t, unsigned int __cnt) noexcept { | |
| 46 | return std::__rotr(__t, __cnt); | |
| 47 | } | |
| 48 | ||
| 49 | #endif // _LIBCPP_STD_VER >= 20 | |
| 50 | ||
| 51 | _LIBCPP_END_NAMESPACE_STD | |
| 52 | ||
| 53 | #endif // _LIBCPP___BIT_ROTATE_H |
lib/libcxx/include/__bit_reference+88-86| ... | ... | @@ -13,7 +13,8 @@ |
| 13 | 13 | #include <__algorithm/copy_n.h> |
| 14 | 14 | #include <__algorithm/fill_n.h> |
| 15 | 15 | #include <__algorithm/min.h> |
| 16 | #include <__bits> | |
| 16 | #include <__bit/countr.h> | |
| 17 | #include <__bit/popcount.h> | |
| 17 | 18 | #include <__config> |
| 18 | 19 | #include <__iterator/iterator_traits.h> |
| 19 | 20 | #include <__memory/construct_at.h> |
| ... | ... | @@ -54,15 +55,17 @@ class __bit_reference |
| 54 | 55 | friend class __bit_const_reference<_Cp>; |
| 55 | 56 | friend class __bit_iterator<_Cp, false>; |
| 56 | 57 | public: |
| 57 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 58 | using __container = typename _Cp::__self; | |
| 59 | ||
| 60 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 58 | 61 | __bit_reference(const __bit_reference&) = default; |
| 59 | 62 | |
| 60 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 operator bool() const _NOEXCEPT | |
| 63 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 operator bool() const _NOEXCEPT | |
| 61 | 64 | {return static_cast<bool>(*__seg_ & __mask_);} |
| 62 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool operator ~() const _NOEXCEPT | |
| 65 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool operator ~() const _NOEXCEPT | |
| 63 | 66 | {return !static_cast<bool>(*this);} |
| 64 | 67 | |
| 65 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 68 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 66 | 69 | __bit_reference& operator=(bool __x) _NOEXCEPT |
| 67 | 70 | { |
| 68 | 71 | if (__x) |
| ... | ... | @@ -82,15 +85,15 @@ public: |
| 82 | 85 | } |
| 83 | 86 | #endif |
| 84 | 87 | |
| 85 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 88 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 86 | 89 | __bit_reference& operator=(const __bit_reference& __x) _NOEXCEPT |
| 87 | 90 | {return operator=(static_cast<bool>(__x));} |
| 88 | 91 | |
| 89 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void flip() _NOEXCEPT {*__seg_ ^= __mask_;} | |
| 90 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, false> operator&() const _NOEXCEPT | |
| 91 | {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));} | |
| 92 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void flip() _NOEXCEPT {*__seg_ ^= __mask_;} | |
| 93 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cp, false> operator&() const _NOEXCEPT | |
| 94 | {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(std::__libcpp_ctz(__mask_)));} | |
| 92 | 95 | private: |
| 93 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 96 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 94 | 97 | explicit __bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT |
| 95 | 98 | : __seg_(__s), __mask_(__m) {} |
| 96 | 99 | }; |
| ... | ... | @@ -101,7 +104,7 @@ class __bit_reference<_Cp, false> |
| 101 | 104 | }; |
| 102 | 105 | |
| 103 | 106 | template <class _Cp> |
| 104 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 107 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 105 | 108 | void |
| 106 | 109 | swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) _NOEXCEPT |
| 107 | 110 | { |
| ... | ... | @@ -111,7 +114,7 @@ swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) _NOEXCEPT |
| 111 | 114 | } |
| 112 | 115 | |
| 113 | 116 | template <class _Cp, class _Dp> |
| 114 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 117 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 115 | 118 | void |
| 116 | 119 | swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT |
| 117 | 120 | { |
| ... | ... | @@ -121,7 +124,7 @@ swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT |
| 121 | 124 | } |
| 122 | 125 | |
| 123 | 126 | template <class _Cp> |
| 124 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 127 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 125 | 128 | void |
| 126 | 129 | swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT |
| 127 | 130 | { |
| ... | ... | @@ -131,7 +134,7 @@ swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT |
| 131 | 134 | } |
| 132 | 135 | |
| 133 | 136 | template <class _Cp> |
| 134 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 137 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 135 | 138 | void |
| 136 | 139 | swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT |
| 137 | 140 | { |
| ... | ... | @@ -155,15 +158,15 @@ public: |
| 155 | 158 | _LIBCPP_INLINE_VISIBILITY |
| 156 | 159 | __bit_const_reference(const __bit_const_reference&) = default; |
| 157 | 160 | |
| 158 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 161 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 159 | 162 | __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT |
| 160 | 163 | : __seg_(__x.__seg_), __mask_(__x.__mask_) {} |
| 161 | 164 | |
| 162 | 165 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT |
| 163 | 166 | {return static_cast<bool>(*__seg_ & __mask_);} |
| 164 | 167 | |
| 165 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, true> operator&() const _NOEXCEPT | |
| 166 | {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));} | |
| 168 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cp, true> operator&() const _NOEXCEPT | |
| 169 | {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(std::__libcpp_ctz(__mask_)));} | |
| 167 | 170 | private: |
| 168 | 171 | _LIBCPP_INLINE_VISIBILITY |
| 169 | 172 | _LIBCPP_CONSTEXPR |
| ... | ... | @@ -176,7 +179,7 @@ private: |
| 176 | 179 | // find |
| 177 | 180 | |
| 178 | 181 | template <class _Cp, bool _IsConst> |
| 179 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, _IsConst> | |
| 182 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, _IsConst> | |
| 180 | 183 | __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) |
| 181 | 184 | { |
| 182 | 185 | typedef __bit_iterator<_Cp, _IsConst> _It; |
| ... | ... | @@ -212,7 +215,7 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type |
| 212 | 215 | } |
| 213 | 216 | |
| 214 | 217 | template <class _Cp, bool _IsConst> |
| 215 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, _IsConst> | |
| 218 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, _IsConst> | |
| 216 | 219 | __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) |
| 217 | 220 | { |
| 218 | 221 | typedef __bit_iterator<_Cp, _IsConst> _It; |
| ... | ... | @@ -251,7 +254,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type |
| 251 | 254 | } |
| 252 | 255 | |
| 253 | 256 | template <class _Cp, bool _IsConst, class _Tp> |
| 254 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 257 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 255 | 258 | __bit_iterator<_Cp, _IsConst> |
| 256 | 259 | find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value) |
| 257 | 260 | { |
| ... | ... | @@ -263,7 +266,7 @@ find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last |
| 263 | 266 | // count |
| 264 | 267 | |
| 265 | 268 | template <class _Cp, bool _IsConst> |
| 266 | typename __bit_iterator<_Cp, _IsConst>::difference_type | |
| 269 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 typename __bit_iterator<_Cp, _IsConst>::difference_type | |
| 267 | 270 | __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) |
| 268 | 271 | { |
| 269 | 272 | typedef __bit_iterator<_Cp, _IsConst> _It; |
| ... | ... | @@ -294,7 +297,7 @@ __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type |
| 294 | 297 | } |
| 295 | 298 | |
| 296 | 299 | template <class _Cp, bool _IsConst> |
| 297 | typename __bit_iterator<_Cp, _IsConst>::difference_type | |
| 300 | _LIBCPP_HIDE_FROM_ABI typename __bit_iterator<_Cp, _IsConst>::difference_type | |
| 298 | 301 | __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) |
| 299 | 302 | { |
| 300 | 303 | typedef __bit_iterator<_Cp, _IsConst> _It; |
| ... | ... | @@ -337,7 +340,7 @@ count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __las |
| 337 | 340 | // fill_n |
| 338 | 341 | |
| 339 | 342 | template <class _Cp> |
| 340 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 343 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | |
| 341 | 344 | __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) |
| 342 | 345 | { |
| 343 | 346 | typedef __bit_iterator<_Cp, false> _It; |
| ... | ... | @@ -367,7 +370,7 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) |
| 367 | 370 | } |
| 368 | 371 | |
| 369 | 372 | template <class _Cp> |
| 370 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 373 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | |
| 371 | 374 | __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) |
| 372 | 375 | { |
| 373 | 376 | typedef __bit_iterator<_Cp, false> _It; |
| ... | ... | @@ -398,7 +401,7 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) |
| 398 | 401 | } |
| 399 | 402 | |
| 400 | 403 | template <class _Cp> |
| 401 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 404 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 402 | 405 | void |
| 403 | 406 | fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value) |
| 404 | 407 | { |
| ... | ... | @@ -414,7 +417,7 @@ fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __v |
| 414 | 417 | // fill |
| 415 | 418 | |
| 416 | 419 | template <class _Cp> |
| 417 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 420 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 418 | 421 | void |
| 419 | 422 | fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value) |
| 420 | 423 | { |
| ... | ... | @@ -424,8 +427,7 @@ fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool |
| 424 | 427 | // copy |
| 425 | 428 | |
| 426 | 429 | template <class _Cp, bool _IsConst> |
| 427 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 428 | __bit_iterator<_Cp, false> | |
| 430 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false> | |
| 429 | 431 | __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, |
| 430 | 432 | __bit_iterator<_Cp, false> __result) |
| 431 | 433 | { |
| ... | ... | @@ -472,8 +474,7 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon |
| 472 | 474 | } |
| 473 | 475 | |
| 474 | 476 | template <class _Cp, bool _IsConst> |
| 475 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 476 | __bit_iterator<_Cp, false> | |
| 477 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false> | |
| 477 | 478 | __copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, |
| 478 | 479 | __bit_iterator<_Cp, false> __result) |
| 479 | 480 | { |
| ... | ... | @@ -551,7 +552,7 @@ __copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsC |
| 551 | 552 | } |
| 552 | 553 | |
| 553 | 554 | template <class _Cp, bool _IsConst> |
| 554 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 555 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 555 | 556 | __bit_iterator<_Cp, false> |
| 556 | 557 | copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) |
| 557 | 558 | { |
| ... | ... | @@ -563,7 +564,7 @@ copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last |
| 563 | 564 | // copy_backward |
| 564 | 565 | |
| 565 | 566 | template <class _Cp, bool _IsConst> |
| 566 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, false> | |
| 567 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false> | |
| 567 | 568 | __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, |
| 568 | 569 | __bit_iterator<_Cp, false> __result) |
| 569 | 570 | { |
| ... | ... | @@ -610,7 +611,7 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C |
| 610 | 611 | } |
| 611 | 612 | |
| 612 | 613 | template <class _Cp, bool _IsConst> |
| 613 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, false> | |
| 614 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false> | |
| 614 | 615 | __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, |
| 615 | 616 | __bit_iterator<_Cp, false> __result) |
| 616 | 617 | { |
| ... | ... | @@ -696,7 +697,7 @@ __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator< |
| 696 | 697 | } |
| 697 | 698 | |
| 698 | 699 | template <class _Cp, bool _IsConst> |
| 699 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 700 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 700 | 701 | __bit_iterator<_Cp, false> |
| 701 | 702 | copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) |
| 702 | 703 | { |
| ... | ... | @@ -728,7 +729,7 @@ move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCons |
| 728 | 729 | // swap_ranges |
| 729 | 730 | |
| 730 | 731 | template <class __C1, class __C2> |
| 731 | __bit_iterator<__C2, false> | |
| 732 | _LIBCPP_HIDE_FROM_ABI __bit_iterator<__C2, false> | |
| 732 | 733 | __swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last, |
| 733 | 734 | __bit_iterator<__C2, false> __result) |
| 734 | 735 | { |
| ... | ... | @@ -778,7 +779,7 @@ __swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, |
| 778 | 779 | } |
| 779 | 780 | |
| 780 | 781 | template <class __C1, class __C2> |
| 781 | __bit_iterator<__C2, false> | |
| 782 | _LIBCPP_HIDE_FROM_ABI __bit_iterator<__C2, false> | |
| 782 | 783 | __swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last, |
| 783 | 784 | __bit_iterator<__C2, false> __result) |
| 784 | 785 | { |
| ... | ... | @@ -903,19 +904,19 @@ struct __bit_array |
| 903 | 904 | difference_type __size_; |
| 904 | 905 | __storage_type __word_[_Np]; |
| 905 | 906 | |
| 906 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 static difference_type capacity() | |
| 907 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 static difference_type capacity() | |
| 907 | 908 | {return static_cast<difference_type>(_Np * __bits_per_word);} |
| 908 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit __bit_array(difference_type __s) : __size_(__s) { | |
| 909 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bit_array(difference_type __s) : __size_(__s) { | |
| 909 | 910 | if (__libcpp_is_constant_evaluated()) { |
| 910 | 911 | for (size_t __i = 0; __i != __bit_array<_Cp>::_Np; ++__i) |
| 911 | 912 | std::__construct_at(__word_ + __i, 0); |
| 912 | 913 | } |
| 913 | 914 | } |
| 914 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator begin() | |
| 915 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() | |
| 915 | 916 | { |
| 916 | 917 | return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0); |
| 917 | 918 | } |
| 918 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator end() | |
| 919 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() | |
| 919 | 920 | { |
| 920 | 921 | return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word, |
| 921 | 922 | static_cast<unsigned>(__size_ % __bits_per_word)); |
| ... | ... | @@ -923,7 +924,7 @@ struct __bit_array |
| 923 | 924 | }; |
| 924 | 925 | |
| 925 | 926 | template <class _Cp> |
| 926 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, false> | |
| 927 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false> | |
| 927 | 928 | rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last) |
| 928 | 929 | { |
| 929 | 930 | typedef __bit_iterator<_Cp, false> _I1; |
| ... | ... | @@ -974,7 +975,7 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, |
| 974 | 975 | // equal |
| 975 | 976 | |
| 976 | 977 | template <class _Cp, bool _IC1, bool _IC2> |
| 977 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 978 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool | |
| 978 | 979 | __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, |
| 979 | 980 | __bit_iterator<_Cp, _IC2> __first2) |
| 980 | 981 | { |
| ... | ... | @@ -1056,7 +1057,7 @@ __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> |
| 1056 | 1057 | } |
| 1057 | 1058 | |
| 1058 | 1059 | template <class _Cp, bool _IC1, bool _IC2> |
| 1059 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 1060 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool | |
| 1060 | 1061 | __equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, |
| 1061 | 1062 | __bit_iterator<_Cp, _IC2> __first2) |
| 1062 | 1063 | { |
| ... | ... | @@ -1099,7 +1100,7 @@ __equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __ |
| 1099 | 1100 | } |
| 1100 | 1101 | |
| 1101 | 1102 | template <class _Cp, bool _IC1, bool _IC2> |
| 1102 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1103 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1103 | 1104 | bool |
| 1104 | 1105 | equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2) |
| 1105 | 1106 | { |
| ... | ... | @@ -1117,23 +1118,23 @@ public: |
| 1117 | 1118 | typedef bool value_type; |
| 1118 | 1119 | typedef __bit_iterator pointer; |
| 1119 | 1120 | #ifndef _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL |
| 1120 | typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference; | |
| 1121 | typedef __conditional_t<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> > reference; | |
| 1121 | 1122 | #else |
| 1122 | using reference = typename conditional<_IsConst, bool, __bit_reference<_Cp> >::type; | |
| 1123 | using reference = __conditional_t<_IsConst, bool, __bit_reference<_Cp> >; | |
| 1123 | 1124 | #endif |
| 1124 | 1125 | typedef random_access_iterator_tag iterator_category; |
| 1125 | 1126 | |
| 1126 | 1127 | private: |
| 1127 | 1128 | typedef typename _Cp::__storage_type __storage_type; |
| 1128 | typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer, | |
| 1129 | typename _Cp::__storage_pointer>::type __storage_pointer; | |
| 1129 | typedef __conditional_t<_IsConst, typename _Cp::__const_storage_pointer, typename _Cp::__storage_pointer> | |
| 1130 | __storage_pointer; | |
| 1130 | 1131 | static const unsigned __bits_per_word = _Cp::__bits_per_word; |
| 1131 | 1132 | |
| 1132 | 1133 | __storage_pointer __seg_; |
| 1133 | 1134 | unsigned __ctz_; |
| 1134 | 1135 | |
| 1135 | 1136 | public: |
| 1136 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator() _NOEXCEPT | |
| 1137 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator() _NOEXCEPT | |
| 1137 | 1138 | #if _LIBCPP_STD_VER > 11 |
| 1138 | 1139 | : __seg_(nullptr), __ctz_(0) |
| 1139 | 1140 | #endif |
| ... | ... | @@ -1144,7 +1145,7 @@ public: |
| 1144 | 1145 | // When _IsConst=true, this is a converting constructor; |
| 1145 | 1146 | // the copy and move constructors are implicitly generated |
| 1146 | 1147 | // and trivial. |
| 1147 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1148 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1148 | 1149 | __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT |
| 1149 | 1150 | : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {} |
| 1150 | 1151 | |
| ... | ... | @@ -1153,19 +1154,19 @@ public: |
| 1153 | 1154 | // the implicit generation of a defaulted one is deprecated. |
| 1154 | 1155 | // When _IsConst=true, the assignment operators are |
| 1155 | 1156 | // implicitly generated and trivial. |
| 1156 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1157 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1157 | 1158 | __bit_iterator& operator=(const _If<_IsConst, struct __private_nat, __bit_iterator>& __it) { |
| 1158 | 1159 | __seg_ = __it.__seg_; |
| 1159 | 1160 | __ctz_ = __it.__ctz_; |
| 1160 | 1161 | return *this; |
| 1161 | 1162 | } |
| 1162 | 1163 | |
| 1163 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 reference operator*() const _NOEXCEPT { | |
| 1164 | return typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> > | |
| 1165 | ::type(__seg_, __storage_type(1) << __ctz_); | |
| 1164 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator*() const _NOEXCEPT { | |
| 1165 | return __conditional_t<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >( | |
| 1166 | __seg_, __storage_type(1) << __ctz_); | |
| 1166 | 1167 | } |
| 1167 | 1168 | |
| 1168 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator& operator++() | |
| 1169 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator& operator++() | |
| 1169 | 1170 | { |
| 1170 | 1171 | if (__ctz_ != __bits_per_word-1) |
| 1171 | 1172 | ++__ctz_; |
| ... | ... | @@ -1177,14 +1178,14 @@ public: |
| 1177 | 1178 | return *this; |
| 1178 | 1179 | } |
| 1179 | 1180 | |
| 1180 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator operator++(int) | |
| 1181 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator operator++(int) | |
| 1181 | 1182 | { |
| 1182 | 1183 | __bit_iterator __tmp = *this; |
| 1183 | 1184 | ++(*this); |
| 1184 | 1185 | return __tmp; |
| 1185 | 1186 | } |
| 1186 | 1187 | |
| 1187 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator& operator--() | |
| 1188 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator& operator--() | |
| 1188 | 1189 | { |
| 1189 | 1190 | if (__ctz_ != 0) |
| 1190 | 1191 | --__ctz_; |
| ... | ... | @@ -1196,14 +1197,14 @@ public: |
| 1196 | 1197 | return *this; |
| 1197 | 1198 | } |
| 1198 | 1199 | |
| 1199 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator operator--(int) | |
| 1200 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator operator--(int) | |
| 1200 | 1201 | { |
| 1201 | 1202 | __bit_iterator __tmp = *this; |
| 1202 | 1203 | --(*this); |
| 1203 | 1204 | return __tmp; |
| 1204 | 1205 | } |
| 1205 | 1206 | |
| 1206 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator& operator+=(difference_type __n) | |
| 1207 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator& operator+=(difference_type __n) | |
| 1207 | 1208 | { |
| 1208 | 1209 | if (__n >= 0) |
| 1209 | 1210 | __seg_ += (__n + __ctz_) / __bits_per_word; |
| ... | ... | @@ -1215,54 +1216,54 @@ public: |
| 1215 | 1216 | return *this; |
| 1216 | 1217 | } |
| 1217 | 1218 | |
| 1218 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator& operator-=(difference_type __n) | |
| 1219 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator& operator-=(difference_type __n) | |
| 1219 | 1220 | { |
| 1220 | 1221 | return *this += -__n; |
| 1221 | 1222 | } |
| 1222 | 1223 | |
| 1223 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator operator+(difference_type __n) const | |
| 1224 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator operator+(difference_type __n) const | |
| 1224 | 1225 | { |
| 1225 | 1226 | __bit_iterator __t(*this); |
| 1226 | 1227 | __t += __n; |
| 1227 | 1228 | return __t; |
| 1228 | 1229 | } |
| 1229 | 1230 | |
| 1230 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator operator-(difference_type __n) const | |
| 1231 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator operator-(difference_type __n) const | |
| 1231 | 1232 | { |
| 1232 | 1233 | __bit_iterator __t(*this); |
| 1233 | 1234 | __t -= __n; |
| 1234 | 1235 | return __t; |
| 1235 | 1236 | } |
| 1236 | 1237 | |
| 1237 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1238 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1238 | 1239 | friend __bit_iterator operator+(difference_type __n, const __bit_iterator& __it) {return __it + __n;} |
| 1239 | 1240 | |
| 1240 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1241 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1241 | 1242 | friend difference_type operator-(const __bit_iterator& __x, const __bit_iterator& __y) |
| 1242 | 1243 | {return (__x.__seg_ - __y.__seg_) * __bits_per_word + __x.__ctz_ - __y.__ctz_;} |
| 1243 | 1244 | |
| 1244 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 reference operator[](difference_type __n) const {return *(*this + __n);} | |
| 1245 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](difference_type __n) const {return *(*this + __n);} | |
| 1245 | 1246 | |
| 1246 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 friend bool operator==(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1247 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 friend bool operator==(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1247 | 1248 | {return __x.__seg_ == __y.__seg_ && __x.__ctz_ == __y.__ctz_;} |
| 1248 | 1249 | |
| 1249 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 friend bool operator!=(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1250 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 friend bool operator!=(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1250 | 1251 | {return !(__x == __y);} |
| 1251 | 1252 | |
| 1252 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 friend bool operator<(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1253 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 friend bool operator<(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1253 | 1254 | {return __x.__seg_ < __y.__seg_ || (__x.__seg_ == __y.__seg_ && __x.__ctz_ < __y.__ctz_);} |
| 1254 | 1255 | |
| 1255 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 friend bool operator>(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1256 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 friend bool operator>(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1256 | 1257 | {return __y < __x;} |
| 1257 | 1258 | |
| 1258 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 friend bool operator<=(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1259 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 friend bool operator<=(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1259 | 1260 | {return !(__y < __x);} |
| 1260 | 1261 | |
| 1261 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 friend bool operator>=(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1262 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 friend bool operator>=(const __bit_iterator& __x, const __bit_iterator& __y) | |
| 1262 | 1263 | {return !(__x < __y);} |
| 1263 | 1264 | |
| 1264 | 1265 | private: |
| 1265 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1266 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1266 | 1267 | explicit __bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT |
| 1267 | 1268 | : __seg_(__s), __ctz_(__ctz) {} |
| 1268 | 1269 | |
| ... | ... | @@ -1273,40 +1274,40 @@ private: |
| 1273 | 1274 | friend class __bit_iterator<_Cp, true>; |
| 1274 | 1275 | template <class _Dp> friend struct __bit_array; |
| 1275 | 1276 | template <class _Dp> |
| 1276 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1277 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1277 | 1278 | friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n); |
| 1278 | 1279 | |
| 1279 | 1280 | template <class _Dp> |
| 1280 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1281 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1281 | 1282 | friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n); |
| 1282 | 1283 | |
| 1283 | 1284 | template <class _Dp, bool _IC> |
| 1284 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1285 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1285 | 1286 | friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first, |
| 1286 | 1287 | __bit_iterator<_Dp, _IC> __last, |
| 1287 | 1288 | __bit_iterator<_Dp, false> __result); |
| 1288 | 1289 | template <class _Dp, bool _IC> |
| 1289 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1290 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1290 | 1291 | friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first, |
| 1291 | 1292 | __bit_iterator<_Dp, _IC> __last, |
| 1292 | 1293 | __bit_iterator<_Dp, false> __result); |
| 1293 | 1294 | template <class _Dp, bool _IC> |
| 1294 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1295 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1295 | 1296 | friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first, |
| 1296 | 1297 | __bit_iterator<_Dp, _IC> __last, |
| 1297 | 1298 | __bit_iterator<_Dp, false> __result); |
| 1298 | 1299 | template <class _Dp, bool _IC> |
| 1299 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1300 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1300 | 1301 | friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first, |
| 1301 | 1302 | __bit_iterator<_Dp, _IC> __last, |
| 1302 | 1303 | __bit_iterator<_Dp, false> __result); |
| 1303 | 1304 | template <class _Dp, bool _IC> |
| 1304 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1305 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1305 | 1306 | friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first, |
| 1306 | 1307 | __bit_iterator<_Dp, _IC> __last, |
| 1307 | 1308 | __bit_iterator<_Dp, false> __result); |
| 1308 | 1309 | template <class _Dp, bool _IC> |
| 1309 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1310 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1310 | 1311 | friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first, |
| 1311 | 1312 | __bit_iterator<_Dp, _IC> __last, |
| 1312 | 1313 | __bit_iterator<_Dp, false> __result); |
| ... | ... | @@ -1320,32 +1321,33 @@ private: |
| 1320 | 1321 | __bit_iterator<__C1, false>, |
| 1321 | 1322 | __bit_iterator<__C2, false>); |
| 1322 | 1323 | template <class _Dp> |
| 1323 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1324 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1324 | 1325 | friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>, |
| 1325 | 1326 | __bit_iterator<_Dp, false>, |
| 1326 | 1327 | __bit_iterator<_Dp, false>); |
| 1327 | 1328 | template <class _Dp, bool _IC1, bool _IC2> |
| 1328 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1329 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1329 | 1330 | friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>, |
| 1330 | 1331 | __bit_iterator<_Dp, _IC1>, |
| 1331 | 1332 | __bit_iterator<_Dp, _IC2>); |
| 1332 | 1333 | template <class _Dp, bool _IC1, bool _IC2> |
| 1333 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1334 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1334 | 1335 | friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>, |
| 1335 | 1336 | __bit_iterator<_Dp, _IC1>, |
| 1336 | 1337 | __bit_iterator<_Dp, _IC2>); |
| 1337 | 1338 | template <class _Dp, bool _IC1, bool _IC2> |
| 1338 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1339 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1339 | 1340 | friend bool equal(__bit_iterator<_Dp, _IC1>, |
| 1340 | 1341 | __bit_iterator<_Dp, _IC1>, |
| 1341 | 1342 | __bit_iterator<_Dp, _IC2>); |
| 1342 | 1343 | template <class _Dp, bool _IC> |
| 1343 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1344 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1344 | 1345 | friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); |
| 1345 | 1346 | template <class _Dp, bool _IC> |
| 1346 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1347 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1347 | 1348 | friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); |
| 1348 | 1349 | template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type |
| 1350 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 1349 | 1351 | __count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); |
| 1350 | 1352 | template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type |
| 1351 | 1353 | __count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); |
lib/libcxx/include/__bits deleted-162| ... | ... | @@ -1,162 +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___BITS | |
| 11 | #define _LIBCPP___BITS | |
| 12 | ||
| 13 | #include <__config> | |
| 14 | ||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 16 | # pragma GCC system_header | |
| 17 | #endif | |
| 18 | ||
| 19 | _LIBCPP_PUSH_MACROS | |
| 20 | #include <__undef_macros> | |
| 21 | ||
| 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 24 | ||
| 25 | #ifndef _LIBCPP_COMPILER_MSVC | |
| 26 | ||
| 27 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 28 | int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); } | |
| 29 | ||
| 30 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 31 | int __libcpp_ctz(unsigned long __x) _NOEXCEPT { return __builtin_ctzl(__x); } | |
| 32 | ||
| 33 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 34 | int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); } | |
| 35 | ||
| 36 | ||
| 37 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 38 | int __libcpp_clz(unsigned __x) _NOEXCEPT { return __builtin_clz(__x); } | |
| 39 | ||
| 40 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 41 | int __libcpp_clz(unsigned long __x) _NOEXCEPT { return __builtin_clzl(__x); } | |
| 42 | ||
| 43 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 44 | int __libcpp_clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); } | |
| 45 | ||
| 46 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 47 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 48 | int __libcpp_clz(__uint128_t __x) _NOEXCEPT { | |
| 49 | // The function is written in this form due to C++ constexpr limitations. | |
| 50 | // The algorithm: | |
| 51 | // - Test whether any bit in the high 64-bits is set | |
| 52 | // - No bits set: | |
| 53 | // - The high 64-bits contain 64 leading zeros, | |
| 54 | // - Add the result of the low 64-bits. | |
| 55 | // - Any bits set: | |
| 56 | // - The number of leading zeros of the input is the number of leading | |
| 57 | // zeros in the high 64-bits. | |
| 58 | return ((__x >> 64) == 0) | |
| 59 | ? (64 + __builtin_clzll(static_cast<unsigned long long>(__x))) | |
| 60 | : __builtin_clzll(static_cast<unsigned long long>(__x >> 64)); | |
| 61 | } | |
| 62 | # endif | |
| 63 | ||
| 64 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 65 | int __libcpp_popcount(unsigned __x) _NOEXCEPT { return __builtin_popcount(__x); } | |
| 66 | ||
| 67 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 68 | int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popcountl(__x); } | |
| 69 | ||
| 70 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 71 | int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); } | |
| 72 | ||
| 73 | #else // _LIBCPP_COMPILER_MSVC | |
| 74 | ||
| 75 | // Precondition: __x != 0 | |
| 76 | inline _LIBCPP_INLINE_VISIBILITY | |
| 77 | int __libcpp_ctz(unsigned __x) { | |
| 78 | static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); | |
| 79 | static_assert(sizeof(unsigned long) == 4, ""); | |
| 80 | unsigned long __where; | |
| 81 | if (_BitScanForward(&__where, __x)) | |
| 82 | return static_cast<int>(__where); | |
| 83 | return 32; | |
| 84 | } | |
| 85 | ||
| 86 | inline _LIBCPP_INLINE_VISIBILITY | |
| 87 | int __libcpp_ctz(unsigned long __x) { | |
| 88 | static_assert(sizeof(unsigned long) == sizeof(unsigned), ""); | |
| 89 | return __ctz(static_cast<unsigned>(__x)); | |
| 90 | } | |
| 91 | ||
| 92 | inline _LIBCPP_INLINE_VISIBILITY | |
| 93 | int __libcpp_ctz(unsigned long long __x) { | |
| 94 | unsigned long __where; | |
| 95 | #if defined(_LIBCPP_HAS_BITSCAN64) | |
| 96 | if (_BitScanForward64(&__where, __x)) | |
| 97 | return static_cast<int>(__where); | |
| 98 | #else | |
| 99 | // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls. | |
| 100 | if (_BitScanForward(&__where, static_cast<unsigned long>(__x))) | |
| 101 | return static_cast<int>(__where); | |
| 102 | if (_BitScanForward(&__where, static_cast<unsigned long>(__x >> 32))) | |
| 103 | return static_cast<int>(__where + 32); | |
| 104 | #endif | |
| 105 | return 64; | |
| 106 | } | |
| 107 | ||
| 108 | // Precondition: __x != 0 | |
| 109 | inline _LIBCPP_INLINE_VISIBILITY | |
| 110 | int __libcpp_clz(unsigned __x) { | |
| 111 | static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); | |
| 112 | static_assert(sizeof(unsigned long) == 4, ""); | |
| 113 | unsigned long __where; | |
| 114 | if (_BitScanReverse(&__where, __x)) | |
| 115 | return static_cast<int>(31 - __where); | |
| 116 | return 32; // Undefined Behavior. | |
| 117 | } | |
| 118 | ||
| 119 | inline _LIBCPP_INLINE_VISIBILITY | |
| 120 | int __libcpp_clz(unsigned long __x) { | |
| 121 | static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); | |
| 122 | return __libcpp_clz(static_cast<unsigned>(__x)); | |
| 123 | } | |
| 124 | ||
| 125 | inline _LIBCPP_INLINE_VISIBILITY | |
| 126 | int __libcpp_clz(unsigned long long __x) { | |
| 127 | unsigned long __where; | |
| 128 | #if defined(_LIBCPP_HAS_BITSCAN64) | |
| 129 | if (_BitScanReverse64(&__where, __x)) | |
| 130 | return static_cast<int>(63 - __where); | |
| 131 | #else | |
| 132 | // Win32 doesn't have _BitScanReverse64 so emulate it with two 32 bit calls. | |
| 133 | if (_BitScanReverse(&__where, static_cast<unsigned long>(__x >> 32))) | |
| 134 | return static_cast<int>(63 - (__where + 32)); | |
| 135 | if (_BitScanReverse(&__where, static_cast<unsigned long>(__x))) | |
| 136 | return static_cast<int>(63 - __where); | |
| 137 | #endif | |
| 138 | return 64; // Undefined Behavior. | |
| 139 | } | |
| 140 | ||
| 141 | inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned __x) { | |
| 142 | static_assert(sizeof(unsigned) == 4, ""); | |
| 143 | return __popcnt(__x); | |
| 144 | } | |
| 145 | ||
| 146 | inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long __x) { | |
| 147 | static_assert(sizeof(unsigned long) == 4, ""); | |
| 148 | return __popcnt(__x); | |
| 149 | } | |
| 150 | ||
| 151 | inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long long __x) { | |
| 152 | static_assert(sizeof(unsigned long long) == 8, ""); | |
| 153 | return __popcnt64(__x); | |
| 154 | } | |
| 155 | ||
| 156 | #endif // _LIBCPP_COMPILER_MSVC | |
| 157 | ||
| 158 | _LIBCPP_END_NAMESPACE_STD | |
| 159 | ||
| 160 | _LIBCPP_POP_MACROS | |
| 161 | ||
| 162 | #endif // _LIBCPP___BITS |
lib/libcxx/include/__bsd_locale_fallbacks.h-1| ... | ... | @@ -13,7 +13,6 @@ |
| 13 | 13 | #ifndef _LIBCPP___BSD_LOCALE_FALLBACKS_H |
| 14 | 14 | #define _LIBCPP___BSD_LOCALE_FALLBACKS_H |
| 15 | 15 | |
| 16 | #include <memory> | |
| 17 | 16 | #include <stdarg.h> |
| 18 | 17 | #include <stdlib.h> |
| 19 | 18 |
lib/libcxx/include/__charconv/chars_format.h+5-5| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | #ifndef _LIBCPP_CXX03_LANG | |
| 22 | #if _LIBCPP_STD_VER > 14 | |
| 23 | 23 | |
| 24 | 24 | enum class _LIBCPP_ENUM_VIS chars_format |
| 25 | 25 | { |
| ... | ... | @@ -52,25 +52,25 @@ operator^(chars_format __x, chars_format __y) { |
| 52 | 52 | _VSTD::__to_underlying(__y)); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 chars_format& | |
| 55 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format& | |
| 56 | 56 | operator&=(chars_format& __x, chars_format __y) { |
| 57 | 57 | __x = __x & __y; |
| 58 | 58 | return __x; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 chars_format& | |
| 61 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format& | |
| 62 | 62 | operator|=(chars_format& __x, chars_format __y) { |
| 63 | 63 | __x = __x | __y; |
| 64 | 64 | return __x; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 chars_format& | |
| 67 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format& | |
| 68 | 68 | operator^=(chars_format& __x, chars_format __y) { |
| 69 | 69 | __x = __x ^ __y; |
| 70 | 70 | return __x; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | #endif // _LIBCPP_CXX03_LANG | |
| 73 | #endif // _LIBCPP_STD_VER > 14 | |
| 74 | 74 | |
| 75 | 75 | _LIBCPP_END_NAMESPACE_STD |
| 76 | 76 |
lib/libcxx/include/__charconv/from_chars_result.h+2-2| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | #ifndef _LIBCPP_CXX03_LANG | |
| 22 | #if _LIBCPP_STD_VER > 14 | |
| 23 | 23 | |
| 24 | 24 | struct _LIBCPP_TYPE_VIS from_chars_result |
| 25 | 25 | { |
| ... | ... | @@ -30,7 +30,7 @@ struct _LIBCPP_TYPE_VIS from_chars_result |
| 30 | 30 | # endif |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | #endif // _LIBCPP_CXX03_LANG | |
| 33 | #endif // _LIBCPP_STD_VER > 14 | |
| 34 | 34 | |
| 35 | 35 | _LIBCPP_END_NAMESPACE_STD |
| 36 | 36 |
lib/libcxx/include/__charconv/tables.h+10-36| ... | ... | @@ -19,38 +19,16 @@ |
| 19 | 19 | |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | #ifndef _LIBCPP_CXX03_LANG | |
| 22 | #if _LIBCPP_STD_VER > 14 | |
| 23 | 23 | |
| 24 | 24 | namespace __itoa { |
| 25 | 25 | |
| 26 | /// Contains the charconv helper tables. | |
| 27 | /// | |
| 28 | /// In C++17 these could be inline constexpr variable, but libc++ supports | |
| 29 | /// charconv for integrals in C++11 mode. | |
| 30 | template <class = void> | |
| 31 | struct __table { | |
| 32 | static const char __base_2_lut[64]; | |
| 33 | static const char __base_8_lut[128]; | |
| 34 | static const char __base_16_lut[512]; | |
| 35 | ||
| 36 | static const uint32_t __pow10_32[10]; | |
| 37 | static const uint64_t __pow10_64[20]; | |
| 38 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 39 | // TODO FMT Reduce the number of entries in this table. | |
| 40 | static const __uint128_t __pow10_128[40]; | |
| 41 | static const int __pow10_128_offset = 0; | |
| 42 | # endif | |
| 43 | static const char __digits_base_10[200]; | |
| 44 | }; | |
| 45 | ||
| 46 | template <class _Tp> | |
| 47 | const char __table<_Tp>::__base_2_lut[64] = { | |
| 26 | inline constexpr char __base_2_lut[64] = { | |
| 48 | 27 | '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '1', '0', '0', '0', '1', '1', '0', '1', '0', '0', '0', '1', |
| 49 | 28 | '0', '1', '0', '1', '1', '0', '0', '1', '1', '1', '1', '0', '0', '0', '1', '0', '0', '1', '1', '0', '1', '0', |
| 50 | 29 | '1', '0', '1', '1', '1', '1', '0', '0', '1', '1', '0', '1', '1', '1', '1', '0', '1', '1', '1', '1'}; |
| 51 | 30 | |
| 52 | template <class _Tp> | |
| 53 | const char __table<_Tp>::__base_8_lut[128] = { | |
| 31 | inline constexpr char __base_8_lut[128] = { | |
| 54 | 32 | '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '1', '0', '1', '1', '1', '2', |
| 55 | 33 | '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', |
| 56 | 34 | '2', '6', '2', '7', '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '4', '0', |
| ... | ... | @@ -58,8 +36,7 @@ const char __table<_Tp>::__base_8_lut[128] = { |
| 58 | 36 | '5', '4', '5', '5', '5', '6', '5', '7', '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', |
| 59 | 37 | '6', '7', '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7'}; |
| 60 | 38 | |
| 61 | template <class _Tp> | |
| 62 | const char __table<_Tp>::__base_16_lut[512] = { | |
| 39 | inline constexpr char __base_16_lut[512] = { | |
| 63 | 40 | '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', '0', 'a', '0', |
| 64 | 41 | 'b', '0', 'c', '0', 'd', '0', 'e', '0', 'f', '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', |
| 65 | 42 | '1', '7', '1', '8', '1', '9', '1', 'a', '1', 'b', '1', 'c', '1', 'd', '1', 'e', '1', 'f', '2', '0', '2', '1', '2', |
| ... | ... | @@ -84,13 +61,11 @@ const char __table<_Tp>::__base_16_lut[512] = { |
| 84 | 61 | '1', 'f', '2', 'f', '3', 'f', '4', 'f', '5', 'f', '6', 'f', '7', 'f', '8', 'f', '9', 'f', 'a', 'f', 'b', 'f', 'c', |
| 85 | 62 | 'f', 'd', 'f', 'e', 'f', 'f'}; |
| 86 | 63 | |
| 87 | template <class _Tp> | |
| 88 | const uint32_t __table<_Tp>::__pow10_32[10] = { | |
| 64 | inline constexpr uint32_t __pow10_32[10] = { | |
| 89 | 65 | UINT32_C(0), UINT32_C(10), UINT32_C(100), UINT32_C(1000), UINT32_C(10000), |
| 90 | 66 | UINT32_C(100000), UINT32_C(1000000), UINT32_C(10000000), UINT32_C(100000000), UINT32_C(1000000000)}; |
| 91 | 67 | |
| 92 | template <class _Tp> | |
| 93 | const uint64_t __table<_Tp>::__pow10_64[20] = {UINT64_C(0), | |
| 68 | inline constexpr uint64_t __pow10_64[20] = {UINT64_C(0), | |
| 94 | 69 | UINT64_C(10), |
| 95 | 70 | UINT64_C(100), |
| 96 | 71 | UINT64_C(1000), |
| ... | ... | @@ -112,8 +87,8 @@ const uint64_t __table<_Tp>::__pow10_64[20] = {UINT64_C(0), |
| 112 | 87 | UINT64_C(10000000000000000000)}; |
| 113 | 88 | |
| 114 | 89 | # ifndef _LIBCPP_HAS_NO_INT128 |
| 115 | template <class _Tp> | |
| 116 | const __uint128_t __table<_Tp>::__pow10_128[40] = { | |
| 90 | inline constexpr int __pow10_128_offset = 0; | |
| 91 | inline constexpr __uint128_t __pow10_128[40] = { | |
| 117 | 92 | UINT64_C(0), |
| 118 | 93 | UINT64_C(10), |
| 119 | 94 | UINT64_C(100), |
| ... | ... | @@ -156,8 +131,7 @@ const __uint128_t __table<_Tp>::__pow10_128[40] = { |
| 156 | 131 | (__uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000000000000)) * 10}; |
| 157 | 132 | # endif |
| 158 | 133 | |
| 159 | template <class _Tp> | |
| 160 | const char __table<_Tp>::__digits_base_10[200] = { | |
| 134 | inline constexpr char __digits_base_10[200] = { | |
| 161 | 135 | // clang-format off |
| 162 | 136 | '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', |
| 163 | 137 | '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', |
| ... | ... | @@ -173,7 +147,7 @@ const char __table<_Tp>::__digits_base_10[200] = { |
| 173 | 147 | |
| 174 | 148 | } // namespace __itoa |
| 175 | 149 | |
| 176 | #endif // _LIBCPP_CXX03_LANG | |
| 150 | #endif // _LIBCPP_STD_VER > 14 | |
| 177 | 151 | |
| 178 | 152 | _LIBCPP_END_NAMESPACE_STD |
| 179 | 153 |
lib/libcxx/include/__charconv/to_chars_base_10.h+19-19| ... | ... | @@ -25,54 +25,54 @@ _LIBCPP_PUSH_MACROS |
| 25 | 25 | |
| 26 | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 27 | |
| 28 | #ifndef _LIBCPP_CXX03_LANG | |
| 28 | #if _LIBCPP_STD_VER > 14 | |
| 29 | 29 | |
| 30 | 30 | namespace __itoa { |
| 31 | 31 | |
| 32 | _LIBCPP_HIDE_FROM_ABI inline char* __append1(char* __first, uint32_t __value) noexcept { | |
| 32 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append1(char* __first, uint32_t __value) noexcept { | |
| 33 | 33 | *__first = '0' + static_cast<char>(__value); |
| 34 | 34 | return __first + 1; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | _LIBCPP_HIDE_FROM_ABI inline char* __append2(char* __first, uint32_t __value) noexcept { | |
| 38 | return std::copy_n(&__table<>::__digits_base_10[__value * 2], 2, __first); | |
| 37 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append2(char* __first, uint32_t __value) noexcept { | |
| 38 | return std::copy_n(&__digits_base_10[__value * 2], 2, __first); | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | _LIBCPP_HIDE_FROM_ABI inline char* __append3(char* __first, uint32_t __value) noexcept { | |
| 41 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append3(char* __first, uint32_t __value) noexcept { | |
| 42 | 42 | return __itoa::__append2(__itoa::__append1(__first, __value / 100), __value % 100); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | _LIBCPP_HIDE_FROM_ABI inline char* __append4(char* __first, uint32_t __value) noexcept { | |
| 45 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append4(char* __first, uint32_t __value) noexcept { | |
| 46 | 46 | return __itoa::__append2(__itoa::__append2(__first, __value / 100), __value % 100); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | _LIBCPP_HIDE_FROM_ABI inline char* __append5(char* __first, uint32_t __value) noexcept { | |
| 49 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append5(char* __first, uint32_t __value) noexcept { | |
| 50 | 50 | return __itoa::__append4(__itoa::__append1(__first, __value / 10000), __value % 10000); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | _LIBCPP_HIDE_FROM_ABI inline char* __append6(char* __first, uint32_t __value) noexcept { | |
| 53 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append6(char* __first, uint32_t __value) noexcept { | |
| 54 | 54 | return __itoa::__append4(__itoa::__append2(__first, __value / 10000), __value % 10000); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | _LIBCPP_HIDE_FROM_ABI inline char* __append7(char* __first, uint32_t __value) noexcept { | |
| 57 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append7(char* __first, uint32_t __value) noexcept { | |
| 58 | 58 | return __itoa::__append6(__itoa::__append1(__first, __value / 1000000), __value % 1000000); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | _LIBCPP_HIDE_FROM_ABI inline char* __append8(char* __first, uint32_t __value) noexcept { | |
| 61 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append8(char* __first, uint32_t __value) noexcept { | |
| 62 | 62 | return __itoa::__append6(__itoa::__append2(__first, __value / 1000000), __value % 1000000); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | _LIBCPP_HIDE_FROM_ABI inline char* __append9(char* __first, uint32_t __value) noexcept { | |
| 65 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append9(char* __first, uint32_t __value) noexcept { | |
| 66 | 66 | return __itoa::__append8(__itoa::__append1(__first, __value / 100000000), __value % 100000000); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | template <class _Tp> |
| 70 | _LIBCPP_HIDE_FROM_ABI char* __append10(char* __first, _Tp __value) noexcept { | |
| 70 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __append10(char* __first, _Tp __value) noexcept { | |
| 71 | 71 | return __itoa::__append8(__itoa::__append2(__first, static_cast<uint32_t>(__value / 100000000)), |
| 72 | 72 | static_cast<uint32_t>(__value % 100000000)); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u32(char* __first, uint32_t __value) noexcept { | |
| 75 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u32(char* __first, uint32_t __value) noexcept { | |
| 76 | 76 | if (__value < 1000000) { |
| 77 | 77 | if (__value < 10000) { |
| 78 | 78 | if (__value < 100) { |
| ... | ... | @@ -107,7 +107,7 @@ _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u32(char* __first, uint32_t __value |
| 107 | 107 | return __itoa::__append10(__first, __value); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u64(char* __buffer, uint64_t __value) noexcept { | |
| 110 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u64(char* __buffer, uint64_t __value) noexcept { | |
| 111 | 111 | if (__value <= UINT32_MAX) |
| 112 | 112 | return __itoa::__base_10_u32(__buffer, static_cast<uint32_t>(__value)); |
| 113 | 113 | |
| ... | ... | @@ -129,12 +129,12 @@ _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u64(char* __buffer, uint64_t __valu |
| 129 | 129 | /// \note The lookup table contains a partial set of exponents limiting the |
| 130 | 130 | /// range that can be used. However the range is sufficient for |
| 131 | 131 | /// \ref __base_10_u128. |
| 132 | _LIBCPP_HIDE_FROM_ABI inline __uint128_t __pow_10(int __exp) noexcept { | |
| 133 | _LIBCPP_ASSERT(__exp >= __table<>::__pow10_128_offset, "Index out of bounds"); | |
| 134 | return __table<>::__pow10_128[__exp - __table<>::__pow10_128_offset]; | |
| 132 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline __uint128_t __pow_10(int __exp) noexcept { | |
| 133 | _LIBCPP_ASSERT(__exp >= __pow10_128_offset, "Index out of bounds"); | |
| 134 | return __pow10_128[__exp - __pow10_128_offset]; | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u128(char* __buffer, __uint128_t __value) noexcept { | |
| 137 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u128(char* __buffer, __uint128_t __value) noexcept { | |
| 138 | 138 | _LIBCPP_ASSERT( |
| 139 | 139 | __value > numeric_limits<uint64_t>::max(), "The optimizations for this algorithm fail when this isn't true."); |
| 140 | 140 | |
| ... | ... | @@ -176,7 +176,7 @@ _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u128(char* __buffer, __uint128_t __ |
| 176 | 176 | # endif |
| 177 | 177 | } // namespace __itoa |
| 178 | 178 | |
| 179 | #endif // _LIBCPP_CXX03_LANG | |
| 179 | #endif // _LIBCPP_STD_VER > 14 | |
| 180 | 180 | |
| 181 | 181 | _LIBCPP_END_NAMESPACE_STD |
| 182 | 182 |
lib/libcxx/include/__charconv/to_chars_result.h+2-2| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | #ifndef _LIBCPP_CXX03_LANG | |
| 22 | #if _LIBCPP_STD_VER > 14 | |
| 23 | 23 | |
| 24 | 24 | struct _LIBCPP_TYPE_VIS to_chars_result |
| 25 | 25 | { |
| ... | ... | @@ -30,7 +30,7 @@ struct _LIBCPP_TYPE_VIS to_chars_result |
| 30 | 30 | # endif |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | #endif // _LIBCPP_CXX03_LANG | |
| 33 | #endif // _LIBCPP_STD_VER > 14 | |
| 34 | 34 | |
| 35 | 35 | _LIBCPP_END_NAMESPACE_STD |
| 36 | 36 |
lib/libcxx/include/__chrono/convert_to_timespec.h+1| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___CHRONO_CONVERT_TO_TIMESPEC_H |
| 10 | 11 | #define _LIBCPP___CHRONO_CONVERT_TO_TIMESPEC_H |
| 11 | 12 |
lib/libcxx/include/__chrono/convert_to_tm.h created+127| ... | ... | @@ -0,0 +1,127 @@ |
| 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___CHRONO_CONVERT_TO_TM_H | |
| 11 | #define _LIBCPP___CHRONO_CONVERT_TO_TM_H | |
| 12 | ||
| 13 | #include <__chrono/day.h> | |
| 14 | #include <__chrono/duration.h> | |
| 15 | #include <__chrono/hh_mm_ss.h> | |
| 16 | #include <__chrono/month.h> | |
| 17 | #include <__chrono/month_weekday.h> | |
| 18 | #include <__chrono/monthday.h> | |
| 19 | #include <__chrono/statically_widen.h> | |
| 20 | #include <__chrono/system_clock.h> | |
| 21 | #include <__chrono/time_point.h> | |
| 22 | #include <__chrono/weekday.h> | |
| 23 | #include <__chrono/year.h> | |
| 24 | #include <__chrono/year_month.h> | |
| 25 | #include <__chrono/year_month_day.h> | |
| 26 | #include <__chrono/year_month_weekday.h> | |
| 27 | #include <__concepts/same_as.h> | |
| 28 | #include <__config> | |
| 29 | #include <__memory/addressof.h> | |
| 30 | #include <cstdint> | |
| 31 | #include <ctime> | |
| 32 | ||
| 33 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 34 | # pragma GCC system_header | |
| 35 | #endif | |
| 36 | ||
| 37 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 38 | ||
| 39 | #if _LIBCPP_STD_VER > 17 | |
| 40 | ||
| 41 | // Conerts a chrono date and weekday to a given _Tm type. | |
| 42 | // | |
| 43 | // This is an implementation detail for the function | |
| 44 | // template <class _Tm, class _ChronoT> | |
| 45 | // _Tm __convert_to_tm(const _ChronoT& __value) | |
| 46 | // | |
| 47 | // This manually converts the two values to the proper type. It is possible to | |
| 48 | // convert from sys_days to time_t and then to _Tm. But this leads to the Y2K | |
| 49 | // bug when time_t is a 32-bit signed integer. Chrono considers years beyond | |
| 50 | // the year 2038 valid, so instead do the transformation manually. | |
| 51 | template <class _Tm, class _Date> | |
| 52 | requires(same_as<_Date, chrono::year_month_day> || same_as<_Date, chrono::year_month_day_last>) | |
| 53 | _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _Date& __date, chrono::weekday __weekday) { | |
| 54 | _Tm __result = {}; | |
| 55 | # ifdef __GLIBC__ | |
| 56 | __result.tm_zone = "UTC"; | |
| 57 | # endif | |
| 58 | __result.tm_year = static_cast<int>(__date.year()) - 1900; | |
| 59 | __result.tm_mon = static_cast<unsigned>(__date.month()) - 1; | |
| 60 | __result.tm_mday = static_cast<unsigned>(__date.day()); | |
| 61 | __result.tm_wday = static_cast<unsigned>(__weekday.c_encoding()); | |
| 62 | __result.tm_yday = | |
| 63 | (static_cast<chrono::sys_days>(__date) - | |
| 64 | static_cast<chrono::sys_days>(chrono::year_month_day{__date.year(), chrono::January, chrono::day{1}})) | |
| 65 | .count(); | |
| 66 | ||
| 67 | return __result; | |
| 68 | } | |
| 69 | ||
| 70 | // Convert a chrono (calendar) time point, or dururation to the given _Tm type, | |
| 71 | // which must have the same properties as std::tm. | |
| 72 | template <class _Tm, class _ChronoT> | |
| 73 | _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) { | |
| 74 | _Tm __result = {}; | |
| 75 | # ifdef __GLIBC__ | |
| 76 | __result.tm_zone = "UTC"; | |
| 77 | # endif | |
| 78 | ||
| 79 | if constexpr (chrono::__is_duration<_ChronoT>::value) { | |
| 80 | // [time.format]/6 | |
| 81 | // ... However, if a flag refers to a "time of day" (e.g. %H, %I, %p, | |
| 82 | // etc.), then a specialization of duration is interpreted as the time of | |
| 83 | // day elapsed since midnight. | |
| 84 | uint64_t __sec = chrono::duration_cast<chrono::seconds>(__value).count(); | |
| 85 | __sec %= 24 * 3600; | |
| 86 | __result.tm_hour = __sec / 3600; | |
| 87 | __sec %= 3600; | |
| 88 | __result.tm_min = __sec / 60; | |
| 89 | __result.tm_sec = __sec % 60; | |
| 90 | } else if constexpr (same_as<_ChronoT, chrono::day>) | |
| 91 | __result.tm_mday = static_cast<unsigned>(__value); | |
| 92 | else if constexpr (same_as<_ChronoT, chrono::month>) | |
| 93 | __result.tm_mon = static_cast<unsigned>(__value) - 1; | |
| 94 | else if constexpr (same_as<_ChronoT, chrono::year>) | |
| 95 | __result.tm_year = static_cast<int>(__value) - 1900; | |
| 96 | else if constexpr (same_as<_ChronoT, chrono::weekday>) | |
| 97 | __result.tm_wday = __value.c_encoding(); | |
| 98 | else if constexpr (same_as<_ChronoT, chrono::weekday_indexed> || same_as<_ChronoT, chrono::weekday_last>) | |
| 99 | __result.tm_wday = __value.weekday().c_encoding(); | |
| 100 | else if constexpr (same_as<_ChronoT, chrono::month_day>) { | |
| 101 | __result.tm_mday = static_cast<unsigned>(__value.day()); | |
| 102 | __result.tm_mon = static_cast<unsigned>(__value.month()) - 1; | |
| 103 | } else if constexpr (same_as<_ChronoT, chrono::month_day_last>) { | |
| 104 | __result.tm_mon = static_cast<unsigned>(__value.month()) - 1; | |
| 105 | } else if constexpr (same_as<_ChronoT, chrono::month_weekday> || same_as<_ChronoT, chrono::month_weekday_last>) { | |
| 106 | __result.tm_wday = __value.weekday_indexed().weekday().c_encoding(); | |
| 107 | __result.tm_mon = static_cast<unsigned>(__value.month()) - 1; | |
| 108 | } else if constexpr (same_as<_ChronoT, chrono::year_month>) { | |
| 109 | __result.tm_year = static_cast<int>(__value.year()) - 1900; | |
| 110 | __result.tm_mon = static_cast<unsigned>(__value.month()) - 1; | |
| 111 | } else if constexpr (same_as<_ChronoT, chrono::year_month_day> || same_as<_ChronoT, chrono::year_month_day_last>) { | |
| 112 | return std::__convert_to_tm<_Tm>( | |
| 113 | chrono::year_month_day{__value}, chrono::weekday{static_cast<chrono::sys_days>(__value)}); | |
| 114 | } else if constexpr (same_as<_ChronoT, chrono::year_month_weekday> || | |
| 115 | same_as<_ChronoT, chrono::year_month_weekday_last>) { | |
| 116 | return std::__convert_to_tm<_Tm>(chrono::year_month_day{static_cast<chrono::sys_days>(__value)}, __value.weekday()); | |
| 117 | } else | |
| 118 | static_assert(sizeof(_ChronoT) == 0, "Add the missing type specialization"); | |
| 119 | ||
| 120 | return __result; | |
| 121 | } | |
| 122 | ||
| 123 | #endif //if _LIBCPP_STD_VER > 17 | |
| 124 | ||
| 125 | _LIBCPP_END_NAMESPACE_STD | |
| 126 | ||
| 127 | #endif // _LIBCPP___CHRONO_CONVERT_TO_TM_H |
lib/libcxx/include/__chrono/day.h+6-6| ... | ... | @@ -27,18 +27,18 @@ namespace chrono |
| 27 | 27 | |
| 28 | 28 | class day { |
| 29 | 29 | private: |
| 30 | unsigned char __d; | |
| 30 | unsigned char __d_; | |
| 31 | 31 | public: |
| 32 | 32 | _LIBCPP_HIDE_FROM_ABI day() = default; |
| 33 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr day(unsigned __val) noexcept : __d(static_cast<unsigned char>(__val)) {} | |
| 34 | _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator++() noexcept { ++__d; return *this; } | |
| 33 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr day(unsigned __val) noexcept : __d_(static_cast<unsigned char>(__val)) {} | |
| 34 | _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator++() noexcept { ++__d_; return *this; } | |
| 35 | 35 | _LIBCPP_HIDE_FROM_ABI inline constexpr day operator++(int) noexcept { day __tmp = *this; ++(*this); return __tmp; } |
| 36 | _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator--() noexcept { --__d; return *this; } | |
| 36 | _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator--() noexcept { --__d_; return *this; } | |
| 37 | 37 | _LIBCPP_HIDE_FROM_ABI inline constexpr day operator--(int) noexcept { day __tmp = *this; --(*this); return __tmp; } |
| 38 | 38 | _LIBCPP_HIDE_FROM_ABI constexpr day& operator+=(const days& __dd) noexcept; |
| 39 | 39 | _LIBCPP_HIDE_FROM_ABI constexpr day& operator-=(const days& __dd) noexcept; |
| 40 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __d; } | |
| 41 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d >= 1 && __d <= 31; } | |
| 40 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __d_; } | |
| 41 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d_ >= 1 && __d_ <= 31; } | |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | 44 |
lib/libcxx/include/__chrono/duration.h+33-26| ... | ... | @@ -11,9 +11,12 @@ |
| 11 | 11 | #define _LIBCPP___CHRONO_DURATION_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <__type_traits/common_type.h> | |
| 15 | #include <__type_traits/enable_if.h> | |
| 16 | #include <__type_traits/is_convertible.h> | |
| 17 | #include <__type_traits/is_floating_point.h> | |
| 14 | 18 | #include <limits> |
| 15 | 19 | #include <ratio> |
| 16 | #include <type_traits> | |
| 17 | 20 | |
| 18 | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 22 | # pragma GCC system_header |
| ... | ... | @@ -151,7 +154,7 @@ typename enable_if |
| 151 | 154 | >::type |
| 152 | 155 | floor(const duration<_Rep, _Period>& __d) |
| 153 | 156 | { |
| 154 | _ToDuration __t = duration_cast<_ToDuration>(__d); | |
| 157 | _ToDuration __t = chrono::duration_cast<_ToDuration>(__d); | |
| 155 | 158 | if (__t > __d) |
| 156 | 159 | __t = __t - _ToDuration{1}; |
| 157 | 160 | return __t; |
| ... | ... | @@ -166,7 +169,7 @@ typename enable_if |
| 166 | 169 | >::type |
| 167 | 170 | ceil(const duration<_Rep, _Period>& __d) |
| 168 | 171 | { |
| 169 | _ToDuration __t = duration_cast<_ToDuration>(__d); | |
| 172 | _ToDuration __t = chrono::duration_cast<_ToDuration>(__d); | |
| 170 | 173 | if (__t < __d) |
| 171 | 174 | __t = __t + _ToDuration{1}; |
| 172 | 175 | return __t; |
| ... | ... | @@ -181,7 +184,7 @@ typename enable_if |
| 181 | 184 | >::type |
| 182 | 185 | round(const duration<_Rep, _Period>& __d) |
| 183 | 186 | { |
| 184 | _ToDuration __lower = floor<_ToDuration>(__d); | |
| 187 | _ToDuration __lower = chrono::floor<_ToDuration>(__d); | |
| 185 | 188 | _ToDuration __upper = __lower + _ToDuration{1}; |
| 186 | 189 | auto __lowerDiff = __d - __lower; |
| 187 | 190 | auto __upperDiff = __upper - __d; |
| ... | ... | @@ -278,18 +281,18 @@ public: |
| 278 | 281 | |
| 279 | 282 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);} |
| 280 | 283 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {return typename common_type<duration>::type(-__rep_);} |
| 281 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator++() {++__rep_; return *this;} | |
| 282 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration operator++(int) {return duration(__rep_++);} | |
| 283 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator--() {--__rep_; return *this;} | |
| 284 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration operator--(int) {return duration(__rep_--);} | |
| 284 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator++() {++__rep_; return *this;} | |
| 285 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator++(int) {return duration(__rep_++);} | |
| 286 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator--() {--__rep_; return *this;} | |
| 287 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator--(int) {return duration(__rep_--);} | |
| 285 | 288 | |
| 286 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator+=(const duration& __d) {__rep_ += __d.count(); return *this;} | |
| 287 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator-=(const duration& __d) {__rep_ -= __d.count(); return *this;} | |
| 289 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator+=(const duration& __d) {__rep_ += __d.count(); return *this;} | |
| 290 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator-=(const duration& __d) {__rep_ -= __d.count(); return *this;} | |
| 288 | 291 | |
| 289 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator*=(const rep& __rhs) {__rep_ *= __rhs; return *this;} | |
| 290 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator/=(const rep& __rhs) {__rep_ /= __rhs; return *this;} | |
| 291 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator%=(const rep& __rhs) {__rep_ %= __rhs; return *this;} | |
| 292 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator%=(const duration& __rhs) {__rep_ %= __rhs.count(); return *this;} | |
| 292 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator*=(const rep& __rhs) {__rep_ *= __rhs; return *this;} | |
| 293 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator/=(const rep& __rhs) {__rep_ /= __rhs; return *this;} | |
| 294 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const rep& __rhs) {__rep_ %= __rhs; return *this;} | |
| 295 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const duration& __rhs) {__rep_ %= __rhs.count(); return *this;} | |
| 293 | 296 | |
| 294 | 297 | // special values |
| 295 | 298 | |
| ... | ... | @@ -534,67 +537,67 @@ inline namespace literals |
| 534 | 537 | inline namespace chrono_literals |
| 535 | 538 | { |
| 536 | 539 | |
| 537 | constexpr chrono::hours operator""h(unsigned long long __h) | |
| 540 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours operator""h(unsigned long long __h) | |
| 538 | 541 | { |
| 539 | 542 | return chrono::hours(static_cast<chrono::hours::rep>(__h)); |
| 540 | 543 | } |
| 541 | 544 | |
| 542 | constexpr chrono::duration<long double, ratio<3600,1>> operator""h(long double __h) | |
| 545 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<3600,1>> operator""h(long double __h) | |
| 543 | 546 | { |
| 544 | 547 | return chrono::duration<long double, ratio<3600,1>>(__h); |
| 545 | 548 | } |
| 546 | 549 | |
| 547 | 550 | |
| 548 | constexpr chrono::minutes operator""min(unsigned long long __m) | |
| 551 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes operator""min(unsigned long long __m) | |
| 549 | 552 | { |
| 550 | 553 | return chrono::minutes(static_cast<chrono::minutes::rep>(__m)); |
| 551 | 554 | } |
| 552 | 555 | |
| 553 | constexpr chrono::duration<long double, ratio<60,1>> operator""min(long double __m) | |
| 556 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<60,1>> operator""min(long double __m) | |
| 554 | 557 | { |
| 555 | 558 | return chrono::duration<long double, ratio<60,1>> (__m); |
| 556 | 559 | } |
| 557 | 560 | |
| 558 | 561 | |
| 559 | constexpr chrono::seconds operator""s(unsigned long long __s) | |
| 562 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds operator""s(unsigned long long __s) | |
| 560 | 563 | { |
| 561 | 564 | return chrono::seconds(static_cast<chrono::seconds::rep>(__s)); |
| 562 | 565 | } |
| 563 | 566 | |
| 564 | constexpr chrono::duration<long double> operator""s(long double __s) | |
| 567 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double> operator""s(long double __s) | |
| 565 | 568 | { |
| 566 | 569 | return chrono::duration<long double> (__s); |
| 567 | 570 | } |
| 568 | 571 | |
| 569 | 572 | |
| 570 | constexpr chrono::milliseconds operator""ms(unsigned long long __ms) | |
| 573 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::milliseconds operator""ms(unsigned long long __ms) | |
| 571 | 574 | { |
| 572 | 575 | return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms)); |
| 573 | 576 | } |
| 574 | 577 | |
| 575 | constexpr chrono::duration<long double, milli> operator""ms(long double __ms) | |
| 578 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, milli> operator""ms(long double __ms) | |
| 576 | 579 | { |
| 577 | 580 | return chrono::duration<long double, milli>(__ms); |
| 578 | 581 | } |
| 579 | 582 | |
| 580 | 583 | |
| 581 | constexpr chrono::microseconds operator""us(unsigned long long __us) | |
| 584 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::microseconds operator""us(unsigned long long __us) | |
| 582 | 585 | { |
| 583 | 586 | return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us)); |
| 584 | 587 | } |
| 585 | 588 | |
| 586 | constexpr chrono::duration<long double, micro> operator""us(long double __us) | |
| 589 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, micro> operator""us(long double __us) | |
| 587 | 590 | { |
| 588 | 591 | return chrono::duration<long double, micro> (__us); |
| 589 | 592 | } |
| 590 | 593 | |
| 591 | 594 | |
| 592 | constexpr chrono::nanoseconds operator""ns(unsigned long long __ns) | |
| 595 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::nanoseconds operator""ns(unsigned long long __ns) | |
| 593 | 596 | { |
| 594 | 597 | return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns)); |
| 595 | 598 | } |
| 596 | 599 | |
| 597 | constexpr chrono::duration<long double, nano> operator""ns(long double __ns) | |
| 600 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, nano> operator""ns(long double __ns) | |
| 598 | 601 | { |
| 599 | 602 | return chrono::duration<long double, nano> (__ns); |
| 600 | 603 | } |
| ... | ... | @@ -612,4 +615,8 @@ _LIBCPP_END_NAMESPACE_STD |
| 612 | 615 | |
| 613 | 616 | _LIBCPP_POP_MACROS |
| 614 | 617 | |
| 618 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 619 | # include <type_traits> | |
| 620 | #endif | |
| 621 | ||
| 615 | 622 | #endif // _LIBCPP___CHRONO_DURATION_H |
lib/libcxx/include/__chrono/file_clock.h+1-1| ... | ... | @@ -61,7 +61,7 @@ struct _FilesystemClock { |
| 61 | 61 | typedef chrono::time_point<_FilesystemClock> time_point; |
| 62 | 62 | |
| 63 | 63 | _LIBCPP_EXPORTED_FROM_ABI |
| 64 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false; | |
| 64 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false; | |
| 65 | 65 | |
| 66 | 66 | _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept; |
| 67 | 67 |
lib/libcxx/include/__chrono/formatter.h created+716| ... | ... | @@ -0,0 +1,716 @@ |
| 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___CHRONO_FORMATTER_H | |
| 11 | #define _LIBCPP___CHRONO_FORMATTER_H | |
| 12 | ||
| 13 | #include <__chrono/calendar.h> | |
| 14 | #include <__chrono/convert_to_tm.h> | |
| 15 | #include <__chrono/day.h> | |
| 16 | #include <__chrono/duration.h> | |
| 17 | #include <__chrono/hh_mm_ss.h> | |
| 18 | #include <__chrono/month.h> | |
| 19 | #include <__chrono/month_weekday.h> | |
| 20 | #include <__chrono/monthday.h> | |
| 21 | #include <__chrono/ostream.h> | |
| 22 | #include <__chrono/parser_std_format_spec.h> | |
| 23 | #include <__chrono/statically_widen.h> | |
| 24 | #include <__chrono/time_point.h> | |
| 25 | #include <__chrono/weekday.h> | |
| 26 | #include <__chrono/year.h> | |
| 27 | #include <__chrono/year_month.h> | |
| 28 | #include <__chrono/year_month_day.h> | |
| 29 | #include <__chrono/year_month_weekday.h> | |
| 30 | #include <__concepts/arithmetic.h> | |
| 31 | #include <__concepts/same_as.h> | |
| 32 | #include <__config> | |
| 33 | #include <__format/concepts.h> | |
| 34 | #include <__format/format_error.h> | |
| 35 | #include <__format/format_functions.h> | |
| 36 | #include <__format/format_parse_context.h> | |
| 37 | #include <__format/formatter.h> | |
| 38 | #include <__format/formatter_output.h> | |
| 39 | #include <__format/parser_std_format_spec.h> | |
| 40 | #include <__memory/addressof.h> | |
| 41 | #include <cmath> | |
| 42 | #include <ctime> | |
| 43 | #include <sstream> | |
| 44 | #include <string> | |
| 45 | #include <string_view> | |
| 46 | ||
| 47 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 48 | # pragma GCC system_header | |
| 49 | #endif | |
| 50 | ||
| 51 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 52 | ||
| 53 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) | |
| 54 | ||
| 55 | namespace __formatter { | |
| 56 | ||
| 57 | /// Formats a time based on a tm struct. | |
| 58 | /// | |
| 59 | /// This formatter passes the formatting to time_put which uses strftime. When | |
| 60 | /// the value is outside the valid range it's unspecified what strftime will | |
| 61 | /// output. For example weekday 8 can print 1 when the day is processed modulo | |
| 62 | /// 7 since that handles the Sunday for 0-based weekday. It can also print 8 if | |
| 63 | /// 7 is handled as a special case. | |
| 64 | /// | |
| 65 | /// The Standard doesn't specify what to do in this case so the result depends | |
| 66 | /// on the result of the underlying code. | |
| 67 | /// | |
| 68 | /// \pre When the (abbreviated) weekday or month name are used, the caller | |
| 69 | /// validates whether the value is valid. So the caller handles that | |
| 70 | /// requirement of Table 97: Meaning of conversion specifiers | |
| 71 | /// [tab:time.format.spec]. | |
| 72 | /// | |
| 73 | /// When no chrono-specs are provided it uses the stream formatter. | |
| 74 | ||
| 75 | // For tiny ratios it's not possible to convert a duration to a hh_mm_ss. This | |
| 76 | // fails compile-time due to the limited precision of the ratio (64-bit is too | |
| 77 | // small). Therefore a duration uses its own conversion. | |
| 78 | template <class _CharT, class _Tp> | |
| 79 | requires(chrono::__is_duration<_Tp>::value) | |
| 80 | _LIBCPP_HIDE_FROM_ABI void __format_sub_seconds(const _Tp& __value, basic_stringstream<_CharT>& __sstr) { | |
| 81 | __sstr << std::use_facet<numpunct<_CharT>>(__sstr.getloc()).decimal_point(); | |
| 82 | ||
| 83 | auto __fraction = __value - chrono::duration_cast<chrono::seconds>(__value); | |
| 84 | if constexpr (chrono::treat_as_floating_point_v<typename _Tp::rep>) | |
| 85 | // When the floating-point value has digits itself they are ignored based | |
| 86 | // on the wording in [tab:time.format.spec] | |
| 87 | // If the precision of the input cannot be exactly represented with | |
| 88 | // seconds, then the format is a decimal floating-point number with a | |
| 89 | // fixed format and a precision matching that of the precision of the | |
| 90 | // input (or to a microseconds precision if the conversion to | |
| 91 | // floating-point decimal seconds cannot be made within 18 fractional | |
| 92 | // digits). | |
| 93 | // | |
| 94 | // This matches the behaviour of MSVC STL, fmtlib interprets this | |
| 95 | // differently and uses 3 decimals. | |
| 96 | // https://godbolt.org/z/6dsbnW8ba | |
| 97 | std::format_to(std::ostreambuf_iterator<_CharT>{__sstr}, | |
| 98 | _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}.0f}"), | |
| 99 | __fraction.count(), | |
| 100 | chrono::hh_mm_ss<_Tp>::fractional_width); | |
| 101 | else | |
| 102 | std::format_to(std::ostreambuf_iterator<_CharT>{__sstr}, | |
| 103 | _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}}"), | |
| 104 | __fraction.count(), | |
| 105 | chrono::hh_mm_ss<_Tp>::fractional_width); | |
| 106 | } | |
| 107 | ||
| 108 | template <class _Tp> | |
| 109 | consteval bool __use_fraction() { | |
| 110 | if constexpr (chrono::__is_duration<_Tp>::value) | |
| 111 | return chrono::hh_mm_ss<_Tp>::fractional_width; | |
| 112 | else | |
| 113 | return false; | |
| 114 | } | |
| 115 | ||
| 116 | template <class _CharT> | |
| 117 | _LIBCPP_HIDE_FROM_ABI void __format_year(int __year, basic_stringstream<_CharT>& __sstr) { | |
| 118 | if (__year < 0) { | |
| 119 | __sstr << _CharT('-'); | |
| 120 | __year = -__year; | |
| 121 | } | |
| 122 | ||
| 123 | // TODO FMT Write an issue | |
| 124 | // If the result has less than four digits it is zero-padded with 0 to two digits. | |
| 125 | // is less -> has less | |
| 126 | // left-padded -> zero-padded, otherwise the proper value would be 000-0. | |
| 127 | ||
| 128 | // Note according to the wording it should be left padded, which is odd. | |
| 129 | __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:04}"), __year); | |
| 130 | } | |
| 131 | ||
| 132 | template <class _CharT> | |
| 133 | _LIBCPP_HIDE_FROM_ABI void __format_century(int __year, basic_stringstream<_CharT>& __sstr) { | |
| 134 | // TODO FMT Write an issue | |
| 135 | // [tab:time.format.spec] | |
| 136 | // %C The year divided by 100 using floored division. If the result is a | |
| 137 | // single decimal digit, it is prefixed with 0. | |
| 138 | ||
| 139 | bool __negative = __year < 0; | |
| 140 | int __century = (__year - (99 * __negative)) / 100; // floored division | |
| 141 | __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), __century); | |
| 142 | } | |
| 143 | ||
| 144 | template <class _CharT, class _Tp> | |
| 145 | _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs( | |
| 146 | const _Tp& __value, basic_stringstream<_CharT>& __sstr, basic_string_view<_CharT> __chrono_specs) { | |
| 147 | tm __t = std::__convert_to_tm<tm>(__value); | |
| 148 | const auto& __facet = std::use_facet<time_put<_CharT>>(__sstr.getloc()); | |
| 149 | for (auto __it = __chrono_specs.begin(); __it != __chrono_specs.end(); ++__it) { | |
| 150 | if (*__it == _CharT('%')) { | |
| 151 | auto __s = __it; | |
| 152 | ++__it; | |
| 153 | // We only handle the types that can't be directly handled by time_put. | |
| 154 | // (as an optimization n, t, and % are also handled directly.) | |
| 155 | switch (*__it) { | |
| 156 | case _CharT('n'): | |
| 157 | __sstr << _CharT('\n'); | |
| 158 | break; | |
| 159 | case _CharT('t'): | |
| 160 | __sstr << _CharT('\t'); | |
| 161 | break; | |
| 162 | case _CharT('%'): | |
| 163 | __sstr << *__it; | |
| 164 | break; | |
| 165 | ||
| 166 | case _CharT('C'): { | |
| 167 | // strftime's output is only defined in the range [00, 99]. | |
| 168 | int __year = __t.tm_year + 1900; | |
| 169 | if (__year < 1000 || __year > 9999) | |
| 170 | __formatter::__format_century(__year, __sstr); | |
| 171 | else | |
| 172 | __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); | |
| 173 | } break; | |
| 174 | ||
| 175 | case _CharT('j'): | |
| 176 | if constexpr (chrono::__is_duration<_Tp>::value) | |
| 177 | // Converting a duration where the period has a small ratio to days | |
| 178 | // may fail to compile. This due to loss of precision in the | |
| 179 | // conversion. In order to avoid that issue convert to seconds as | |
| 180 | // an intemediate step. | |
| 181 | __sstr << chrono::duration_cast<chrono::days>(chrono::duration_cast<chrono::seconds>(__value)).count(); | |
| 182 | else | |
| 183 | __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); | |
| 184 | break; | |
| 185 | ||
| 186 | case _CharT('q'): | |
| 187 | if constexpr (chrono::__is_duration<_Tp>::value) { | |
| 188 | __sstr << chrono::__units_suffix<_CharT, typename _Tp::period>(); | |
| 189 | break; | |
| 190 | } | |
| 191 | __builtin_unreachable(); | |
| 192 | ||
| 193 | case _CharT('Q'): | |
| 194 | // TODO FMT Determine the proper ideas | |
| 195 | // - Should it honour the precision? | |
| 196 | // - Shoult it honour the locale setting for the separators? | |
| 197 | // The wording for Q doesn't use the word locale and the effect of | |
| 198 | // precision is unspecified. | |
| 199 | // | |
| 200 | // MSVC STL ignores precision but uses separator | |
| 201 | // FMT honours precision and has a bug for separator | |
| 202 | // https://godbolt.org/z/78b7sMxns | |
| 203 | if constexpr (chrono::__is_duration<_Tp>::value) { | |
| 204 | __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{}"), __value.count()); | |
| 205 | break; | |
| 206 | } | |
| 207 | __builtin_unreachable(); | |
| 208 | ||
| 209 | case _CharT('S'): | |
| 210 | case _CharT('T'): | |
| 211 | __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); | |
| 212 | if constexpr (__use_fraction<_Tp>()) | |
| 213 | __formatter::__format_sub_seconds(__value, __sstr); | |
| 214 | break; | |
| 215 | ||
| 216 | // Unlike time_put and strftime the formatting library requires %Y | |
| 217 | // | |
| 218 | // [tab:time.format.spec] | |
| 219 | // The year as a decimal number. If the result is less than four digits | |
| 220 | // it is left-padded with 0 to four digits. | |
| 221 | // | |
| 222 | // This means years in the range (-1000, 1000) need manual formatting. | |
| 223 | // It's unclear whether %EY needs the same treatment. For example the | |
| 224 | // Japanese EY contains the era name and year. This is zero-padded to 2 | |
| 225 | // digits in time_put (note that older glibc versions didn't do | |
| 226 | // padding.) However most eras won't reach 100 years, let alone 1000. | |
| 227 | // So padding to 4 digits seems unwanted for Japanese. | |
| 228 | // | |
| 229 | // The same applies to %Ex since that too depends on the era. | |
| 230 | // | |
| 231 | // %x the locale's date representation is currently doesn't handle the | |
| 232 | // zero-padding too. | |
| 233 | // | |
| 234 | // The 4 digits can be implemented better at a later time. On POSIX | |
| 235 | // systems the required information can be extracted by nl_langinfo | |
| 236 | // https://man7.org/linux/man-pages/man3/nl_langinfo.3.html | |
| 237 | // | |
| 238 | // Note since year < -1000 is expected to be rare it uses the more | |
| 239 | // expensive year routine. | |
| 240 | // | |
| 241 | // TODO FMT evaluate the comment above. | |
| 242 | ||
| 243 | # if defined(__GLIBC__) || defined(_AIX) | |
| 244 | case _CharT('y'): | |
| 245 | // Glibc fails for negative values, AIX for positive values too. | |
| 246 | __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), (std::abs(__t.tm_year + 1900)) % 100); | |
| 247 | break; | |
| 248 | # endif // defined(__GLIBC__) || defined(_AIX) | |
| 249 | ||
| 250 | case _CharT('Y'): { | |
| 251 | int __year = __t.tm_year + 1900; | |
| 252 | if (__year < 1000) | |
| 253 | __formatter::__format_year(__year, __sstr); | |
| 254 | else | |
| 255 | __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); | |
| 256 | } break; | |
| 257 | ||
| 258 | case _CharT('F'): { | |
| 259 | int __year = __t.tm_year + 1900; | |
| 260 | if (__year < 1000) { | |
| 261 | __formatter::__format_year(__year, __sstr); | |
| 262 | __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "-{:02}-{:02}"), __t.tm_mon + 1, __t.tm_mday); | |
| 263 | } else | |
| 264 | __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); | |
| 265 | } break; | |
| 266 | ||
| 267 | case _CharT('O'): | |
| 268 | if constexpr (__use_fraction<_Tp>()) { | |
| 269 | // Handle OS using the normal representation for the non-fractional | |
| 270 | // part. There seems to be no locale information regarding how the | |
| 271 | // fractional part should be formatted. | |
| 272 | if (*(__it + 1) == 'S') { | |
| 273 | ++__it; | |
| 274 | __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); | |
| 275 | __formatter::__format_sub_seconds(__value, __sstr); | |
| 276 | break; | |
| 277 | } | |
| 278 | } | |
| 279 | [[fallthrough]]; | |
| 280 | case _CharT('E'): | |
| 281 | ++__it; | |
| 282 | [[fallthrough]]; | |
| 283 | default: | |
| 284 | __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); | |
| 285 | break; | |
| 286 | } | |
| 287 | } else { | |
| 288 | __sstr << *__it; | |
| 289 | } | |
| 290 | } | |
| 291 | } | |
| 292 | ||
| 293 | template <class _Tp> | |
| 294 | _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const _Tp& __value) { | |
| 295 | if constexpr (same_as<_Tp, chrono::day>) | |
| 296 | return true; | |
| 297 | else if constexpr (same_as<_Tp, chrono::month>) | |
| 298 | return __value.ok(); | |
| 299 | else if constexpr (same_as<_Tp, chrono::year>) | |
| 300 | return true; | |
| 301 | else if constexpr (same_as<_Tp, chrono::weekday>) | |
| 302 | return true; | |
| 303 | else if constexpr (same_as<_Tp, chrono::weekday_indexed>) | |
| 304 | return true; | |
| 305 | else if constexpr (same_as<_Tp, chrono::weekday_last>) | |
| 306 | return true; | |
| 307 | else if constexpr (same_as<_Tp, chrono::month_day>) | |
| 308 | return true; | |
| 309 | else if constexpr (same_as<_Tp, chrono::month_day_last>) | |
| 310 | return true; | |
| 311 | else if constexpr (same_as<_Tp, chrono::month_weekday>) | |
| 312 | return true; | |
| 313 | else if constexpr (same_as<_Tp, chrono::month_weekday_last>) | |
| 314 | return true; | |
| 315 | else if constexpr (same_as<_Tp, chrono::year_month>) | |
| 316 | return true; | |
| 317 | else if constexpr (same_as<_Tp, chrono::year_month_day>) | |
| 318 | return __value.ok(); | |
| 319 | else if constexpr (same_as<_Tp, chrono::year_month_day_last>) | |
| 320 | return __value.ok(); | |
| 321 | else if constexpr (same_as<_Tp, chrono::year_month_weekday>) | |
| 322 | return __value.weekday().ok(); | |
| 323 | else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>) | |
| 324 | return __value.weekday().ok(); | |
| 325 | else | |
| 326 | static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); | |
| 327 | } | |
| 328 | ||
| 329 | template <class _Tp> | |
| 330 | _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_name_ok(const _Tp& __value) { | |
| 331 | if constexpr (same_as<_Tp, chrono::day>) | |
| 332 | return true; | |
| 333 | else if constexpr (same_as<_Tp, chrono::month>) | |
| 334 | return __value.ok(); | |
| 335 | else if constexpr (same_as<_Tp, chrono::year>) | |
| 336 | return true; | |
| 337 | else if constexpr (same_as<_Tp, chrono::weekday>) | |
| 338 | return __value.ok(); | |
| 339 | else if constexpr (same_as<_Tp, chrono::weekday_indexed>) | |
| 340 | return __value.weekday().ok(); | |
| 341 | else if constexpr (same_as<_Tp, chrono::weekday_last>) | |
| 342 | return __value.weekday().ok(); | |
| 343 | else if constexpr (same_as<_Tp, chrono::month_day>) | |
| 344 | return true; | |
| 345 | else if constexpr (same_as<_Tp, chrono::month_day_last>) | |
| 346 | return true; | |
| 347 | else if constexpr (same_as<_Tp, chrono::month_weekday>) | |
| 348 | return __value.weekday_indexed().ok(); | |
| 349 | else if constexpr (same_as<_Tp, chrono::month_weekday_last>) | |
| 350 | return __value.weekday_indexed().ok(); | |
| 351 | else if constexpr (same_as<_Tp, chrono::year_month>) | |
| 352 | return true; | |
| 353 | else if constexpr (same_as<_Tp, chrono::year_month_day>) | |
| 354 | return __value.ok(); | |
| 355 | else if constexpr (same_as<_Tp, chrono::year_month_day_last>) | |
| 356 | return __value.ok(); | |
| 357 | else if constexpr (same_as<_Tp, chrono::year_month_weekday>) | |
| 358 | return __value.weekday().ok(); | |
| 359 | else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>) | |
| 360 | return __value.weekday().ok(); | |
| 361 | else | |
| 362 | static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); | |
| 363 | } | |
| 364 | ||
| 365 | template <class _Tp> | |
| 366 | _LIBCPP_HIDE_FROM_ABI constexpr bool __date_ok(const _Tp& __value) { | |
| 367 | if constexpr (same_as<_Tp, chrono::day>) | |
| 368 | return true; | |
| 369 | else if constexpr (same_as<_Tp, chrono::month>) | |
| 370 | return __value.ok(); | |
| 371 | else if constexpr (same_as<_Tp, chrono::year>) | |
| 372 | return true; | |
| 373 | else if constexpr (same_as<_Tp, chrono::weekday>) | |
| 374 | return true; | |
| 375 | else if constexpr (same_as<_Tp, chrono::weekday_indexed>) | |
| 376 | return true; | |
| 377 | else if constexpr (same_as<_Tp, chrono::weekday_last>) | |
| 378 | return true; | |
| 379 | else if constexpr (same_as<_Tp, chrono::month_day>) | |
| 380 | return true; | |
| 381 | else if constexpr (same_as<_Tp, chrono::month_day_last>) | |
| 382 | return true; | |
| 383 | else if constexpr (same_as<_Tp, chrono::month_weekday>) | |
| 384 | return true; | |
| 385 | else if constexpr (same_as<_Tp, chrono::month_weekday_last>) | |
| 386 | return true; | |
| 387 | else if constexpr (same_as<_Tp, chrono::year_month>) | |
| 388 | return true; | |
| 389 | else if constexpr (same_as<_Tp, chrono::year_month_day>) | |
| 390 | return __value.ok(); | |
| 391 | else if constexpr (same_as<_Tp, chrono::year_month_day_last>) | |
| 392 | return __value.ok(); | |
| 393 | else if constexpr (same_as<_Tp, chrono::year_month_weekday>) | |
| 394 | return __value.ok(); | |
| 395 | else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>) | |
| 396 | return __value.ok(); | |
| 397 | else | |
| 398 | static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); | |
| 399 | } | |
| 400 | ||
| 401 | template <class _Tp> | |
| 402 | _LIBCPP_HIDE_FROM_ABI constexpr bool __month_name_ok(const _Tp& __value) { | |
| 403 | if constexpr (same_as<_Tp, chrono::day>) | |
| 404 | return true; | |
| 405 | else if constexpr (same_as<_Tp, chrono::month>) | |
| 406 | return __value.ok(); | |
| 407 | else if constexpr (same_as<_Tp, chrono::year>) | |
| 408 | return true; | |
| 409 | else if constexpr (same_as<_Tp, chrono::weekday>) | |
| 410 | return true; | |
| 411 | else if constexpr (same_as<_Tp, chrono::weekday_indexed>) | |
| 412 | return true; | |
| 413 | else if constexpr (same_as<_Tp, chrono::weekday_last>) | |
| 414 | return true; | |
| 415 | else if constexpr (same_as<_Tp, chrono::month_day>) | |
| 416 | return __value.month().ok(); | |
| 417 | else if constexpr (same_as<_Tp, chrono::month_day_last>) | |
| 418 | return __value.month().ok(); | |
| 419 | else if constexpr (same_as<_Tp, chrono::month_weekday>) | |
| 420 | return __value.month().ok(); | |
| 421 | else if constexpr (same_as<_Tp, chrono::month_weekday_last>) | |
| 422 | return __value.month().ok(); | |
| 423 | else if constexpr (same_as<_Tp, chrono::year_month>) | |
| 424 | return __value.month().ok(); | |
| 425 | else if constexpr (same_as<_Tp, chrono::year_month_day>) | |
| 426 | return __value.month().ok(); | |
| 427 | else if constexpr (same_as<_Tp, chrono::year_month_day_last>) | |
| 428 | return __value.month().ok(); | |
| 429 | else if constexpr (same_as<_Tp, chrono::year_month_weekday>) | |
| 430 | return __value.month().ok(); | |
| 431 | else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>) | |
| 432 | return __value.month().ok(); | |
| 433 | else | |
| 434 | static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); | |
| 435 | } | |
| 436 | ||
| 437 | template <class _CharT, class _Tp> | |
| 438 | _LIBCPP_HIDE_FROM_ABI auto | |
| 439 | __format_chrono(const _Tp& __value, | |
| 440 | auto& __ctx, | |
| 441 | __format_spec::__parsed_specifications<_CharT> __specs, | |
| 442 | basic_string_view<_CharT> __chrono_specs) -> decltype(__ctx.out()) { | |
| 443 | basic_stringstream<_CharT> __sstr; | |
| 444 | // [time.format]/2 | |
| 445 | // 2.1 - the "C" locale if the L option is not present in chrono-format-spec, otherwise | |
| 446 | // 2.2 - the locale passed to the formatting function if any, otherwise | |
| 447 | // 2.3 - the global locale. | |
| 448 | // Note that the __ctx's locale() call does 2.2 and 2.3. | |
| 449 | if (__specs.__chrono_.__locale_specific_form_) | |
| 450 | __sstr.imbue(__ctx.locale()); | |
| 451 | else | |
| 452 | __sstr.imbue(locale::classic()); | |
| 453 | ||
| 454 | if (__chrono_specs.empty()) | |
| 455 | __sstr << __value; | |
| 456 | else { | |
| 457 | if constexpr (chrono::__is_duration<_Tp>::value) { | |
| 458 | if (__value < __value.zero()) | |
| 459 | __sstr << _CharT('-'); | |
| 460 | __formatter::__format_chrono_using_chrono_specs(chrono::abs(__value), __sstr, __chrono_specs); | |
| 461 | // TODO FMT When keeping the precision it will truncate the string. | |
| 462 | // Note that the behaviour what the precision does isn't specified. | |
| 463 | __specs.__precision_ = -1; | |
| 464 | } else { | |
| 465 | // Test __weekday_name_ before __weekday_ to give a better error. | |
| 466 | if (__specs.__chrono_.__weekday_name_ && !__formatter::__weekday_name_ok(__value)) | |
| 467 | std::__throw_format_error("formatting a weekday name needs a valid weekday"); | |
| 468 | ||
| 469 | if (__specs.__chrono_.__weekday_ && !__formatter::__weekday_ok(__value)) | |
| 470 | std::__throw_format_error("formatting a weekday needs a valid weekday"); | |
| 471 | ||
| 472 | if (__specs.__chrono_.__day_of_year_ && !__formatter::__date_ok(__value)) | |
| 473 | std::__throw_format_error("formatting a day of year needs a valid date"); | |
| 474 | ||
| 475 | if (__specs.__chrono_.__week_of_year_ && !__formatter::__date_ok(__value)) | |
| 476 | std::__throw_format_error("formatting a week of year needs a valid date"); | |
| 477 | ||
| 478 | if (__specs.__chrono_.__month_name_ && !__formatter::__month_name_ok(__value)) | |
| 479 | std::__throw_format_error("formatting a month name from an invalid month number"); | |
| 480 | ||
| 481 | __formatter::__format_chrono_using_chrono_specs(__value, __sstr, __chrono_specs); | |
| 482 | } | |
| 483 | } | |
| 484 | ||
| 485 | // TODO FMT Use the stringstream's view after P0408R7 has been implemented. | |
| 486 | basic_string<_CharT> __str = __sstr.str(); | |
| 487 | return __formatter::__write_string(basic_string_view<_CharT>{__str}, __ctx.out(), __specs); | |
| 488 | } | |
| 489 | ||
| 490 | } // namespace __formatter | |
| 491 | ||
| 492 | template <__fmt_char_type _CharT> | |
| 493 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatter_chrono { | |
| 494 | public: | |
| 495 | _LIBCPP_HIDE_FROM_ABI constexpr auto __parse( | |
| 496 | basic_format_parse_context<_CharT>& __parse_ctx, __format_spec::__fields __fields, __format_spec::__flags __flags) | |
| 497 | -> decltype(__parse_ctx.begin()) { | |
| 498 | return __parser_.__parse(__parse_ctx, __fields, __flags); | |
| 499 | } | |
| 500 | ||
| 501 | template <class _Tp> | |
| 502 | _LIBCPP_HIDE_FROM_ABI auto format(const _Tp& __value, auto& __ctx) const -> decltype(__ctx.out()) const { | |
| 503 | return __formatter::__format_chrono( | |
| 504 | __value, __ctx, __parser_.__parser_.__get_parsed_chrono_specifications(__ctx), __parser_.__chrono_specs_); | |
| 505 | } | |
| 506 | ||
| 507 | __format_spec::__parser_chrono<_CharT> __parser_; | |
| 508 | }; | |
| 509 | ||
| 510 | template <class _Rep, class _Period, __fmt_char_type _CharT> | |
| 511 | struct formatter<chrono::duration<_Rep, _Period>, _CharT> : public __formatter_chrono<_CharT> { | |
| 512 | public: | |
| 513 | using _Base = __formatter_chrono<_CharT>; | |
| 514 | ||
| 515 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 516 | -> decltype(__parse_ctx.begin()) { | |
| 517 | // [time.format]/1 | |
| 518 | // Giving a precision specification in the chrono-format-spec is valid only | |
| 519 | // for std::chrono::duration types where the representation type Rep is a | |
| 520 | // floating-point type. For all other Rep types, an exception of type | |
| 521 | // format_error is thrown if the chrono-format-spec contains a precision | |
| 522 | // specification. | |
| 523 | // | |
| 524 | // Note this doesn't refer to chrono::treat_as_floating_point_v<_Rep>. | |
| 525 | if constexpr (std::floating_point<_Rep>) | |
| 526 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono_fractional, __format_spec::__flags::__duration); | |
| 527 | else | |
| 528 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__duration); | |
| 529 | } | |
| 530 | }; | |
| 531 | ||
| 532 | template <__fmt_char_type _CharT> | |
| 533 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::day, _CharT> | |
| 534 | : public __formatter_chrono<_CharT> { | |
| 535 | public: | |
| 536 | using _Base = __formatter_chrono<_CharT>; | |
| 537 | ||
| 538 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 539 | -> decltype(__parse_ctx.begin()) { | |
| 540 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__day); | |
| 541 | } | |
| 542 | }; | |
| 543 | ||
| 544 | template <__fmt_char_type _CharT> | |
| 545 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::month, _CharT> | |
| 546 | : public __formatter_chrono<_CharT> { | |
| 547 | public: | |
| 548 | using _Base = __formatter_chrono<_CharT>; | |
| 549 | ||
| 550 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 551 | -> decltype(__parse_ctx.begin()) { | |
| 552 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month); | |
| 553 | } | |
| 554 | }; | |
| 555 | ||
| 556 | template <__fmt_char_type _CharT> | |
| 557 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year, _CharT> | |
| 558 | : public __formatter_chrono<_CharT> { | |
| 559 | public: | |
| 560 | using _Base = __formatter_chrono<_CharT>; | |
| 561 | ||
| 562 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 563 | -> decltype(__parse_ctx.begin()) { | |
| 564 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__year); | |
| 565 | } | |
| 566 | }; | |
| 567 | ||
| 568 | template <__fmt_char_type _CharT> | |
| 569 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::weekday, _CharT> | |
| 570 | : public __formatter_chrono<_CharT> { | |
| 571 | public: | |
| 572 | using _Base = __formatter_chrono<_CharT>; | |
| 573 | ||
| 574 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 575 | -> decltype(__parse_ctx.begin()) { | |
| 576 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__weekday); | |
| 577 | } | |
| 578 | }; | |
| 579 | ||
| 580 | template <__fmt_char_type _CharT> | |
| 581 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::weekday_indexed, _CharT> | |
| 582 | : public __formatter_chrono<_CharT> { | |
| 583 | public: | |
| 584 | using _Base = __formatter_chrono<_CharT>; | |
| 585 | ||
| 586 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 587 | -> decltype(__parse_ctx.begin()) { | |
| 588 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__weekday); | |
| 589 | } | |
| 590 | }; | |
| 591 | ||
| 592 | template <__fmt_char_type _CharT> | |
| 593 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::weekday_last, _CharT> | |
| 594 | : public __formatter_chrono<_CharT> { | |
| 595 | public: | |
| 596 | using _Base = __formatter_chrono<_CharT>; | |
| 597 | ||
| 598 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 599 | -> decltype(__parse_ctx.begin()) { | |
| 600 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__weekday); | |
| 601 | } | |
| 602 | }; | |
| 603 | ||
| 604 | template <__fmt_char_type _CharT> | |
| 605 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::month_day, _CharT> | |
| 606 | : public __formatter_chrono<_CharT> { | |
| 607 | public: | |
| 608 | using _Base = __formatter_chrono<_CharT>; | |
| 609 | ||
| 610 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 611 | -> decltype(__parse_ctx.begin()) { | |
| 612 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month_day); | |
| 613 | } | |
| 614 | }; | |
| 615 | ||
| 616 | template <__fmt_char_type _CharT> | |
| 617 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::month_day_last, _CharT> | |
| 618 | : public __formatter_chrono<_CharT> { | |
| 619 | public: | |
| 620 | using _Base = __formatter_chrono<_CharT>; | |
| 621 | ||
| 622 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 623 | -> decltype(__parse_ctx.begin()) { | |
| 624 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month); | |
| 625 | } | |
| 626 | }; | |
| 627 | ||
| 628 | template <__fmt_char_type _CharT> | |
| 629 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::month_weekday, _CharT> | |
| 630 | : public __formatter_chrono<_CharT> { | |
| 631 | public: | |
| 632 | using _Base = __formatter_chrono<_CharT>; | |
| 633 | ||
| 634 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 635 | -> decltype(__parse_ctx.begin()) { | |
| 636 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month_weekday); | |
| 637 | } | |
| 638 | }; | |
| 639 | ||
| 640 | template <__fmt_char_type _CharT> | |
| 641 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::month_weekday_last, _CharT> | |
| 642 | : public __formatter_chrono<_CharT> { | |
| 643 | public: | |
| 644 | using _Base = __formatter_chrono<_CharT>; | |
| 645 | ||
| 646 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 647 | -> decltype(__parse_ctx.begin()) { | |
| 648 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month_weekday); | |
| 649 | } | |
| 650 | }; | |
| 651 | ||
| 652 | template <__fmt_char_type _CharT> | |
| 653 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year_month, _CharT> | |
| 654 | : public __formatter_chrono<_CharT> { | |
| 655 | public: | |
| 656 | using _Base = __formatter_chrono<_CharT>; | |
| 657 | ||
| 658 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 659 | -> decltype(__parse_ctx.begin()) { | |
| 660 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__year_month); | |
| 661 | } | |
| 662 | }; | |
| 663 | ||
| 664 | template <__fmt_char_type _CharT> | |
| 665 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year_month_day, _CharT> | |
| 666 | : public __formatter_chrono<_CharT> { | |
| 667 | public: | |
| 668 | using _Base = __formatter_chrono<_CharT>; | |
| 669 | ||
| 670 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 671 | -> decltype(__parse_ctx.begin()) { | |
| 672 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date); | |
| 673 | } | |
| 674 | }; | |
| 675 | ||
| 676 | template <__fmt_char_type _CharT> | |
| 677 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year_month_day_last, _CharT> | |
| 678 | : public __formatter_chrono<_CharT> { | |
| 679 | public: | |
| 680 | using _Base = __formatter_chrono<_CharT>; | |
| 681 | ||
| 682 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 683 | -> decltype(__parse_ctx.begin()) { | |
| 684 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date); | |
| 685 | } | |
| 686 | }; | |
| 687 | ||
| 688 | template <__fmt_char_type _CharT> | |
| 689 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year_month_weekday, _CharT> | |
| 690 | : public __formatter_chrono<_CharT> { | |
| 691 | public: | |
| 692 | using _Base = __formatter_chrono<_CharT>; | |
| 693 | ||
| 694 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 695 | -> decltype(__parse_ctx.begin()) { | |
| 696 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date); | |
| 697 | } | |
| 698 | }; | |
| 699 | ||
| 700 | template <__fmt_char_type _CharT> | |
| 701 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year_month_weekday_last, _CharT> | |
| 702 | : public __formatter_chrono<_CharT> { | |
| 703 | public: | |
| 704 | using _Base = __formatter_chrono<_CharT>; | |
| 705 | ||
| 706 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) | |
| 707 | -> decltype(__parse_ctx.begin()) { | |
| 708 | return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date); | |
| 709 | } | |
| 710 | }; | |
| 711 | ||
| 712 | #endif // if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) | |
| 713 | ||
| 714 | _LIBCPP_END_NAMESPACE_STD | |
| 715 | ||
| 716 | #endif // _LIBCPP___CHRONO_FORMATTER_H |
lib/libcxx/include/__chrono/hh_mm_ss.h+17-17| ... | ... | @@ -57,33 +57,33 @@ public: |
| 57 | 57 | _LIBCPP_HIDE_FROM_ABI constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {} |
| 58 | 58 | |
| 59 | 59 | _LIBCPP_HIDE_FROM_ABI constexpr explicit hh_mm_ss(_Duration __d) noexcept : |
| 60 | __is_neg(__d < _Duration(0)), | |
| 61 | __h(duration_cast<chrono::hours> (abs(__d))), | |
| 62 | __m(duration_cast<chrono::minutes>(abs(__d) - hours())), | |
| 63 | __s(duration_cast<chrono::seconds>(abs(__d) - hours() - minutes())), | |
| 64 | __f(duration_cast<precision> (abs(__d) - hours() - minutes() - seconds())) | |
| 60 | __is_neg_(__d < _Duration(0)), | |
| 61 | __h_(chrono::duration_cast<chrono::hours> (chrono::abs(__d))), | |
| 62 | __m_(chrono::duration_cast<chrono::minutes>(chrono::abs(__d) - hours())), | |
| 63 | __s_(chrono::duration_cast<chrono::seconds>(chrono::abs(__d) - hours() - minutes())), | |
| 64 | __f_(chrono::duration_cast<precision> (chrono::abs(__d) - hours() - minutes() - seconds())) | |
| 65 | 65 | {} |
| 66 | 66 | |
| 67 | _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg; } | |
| 68 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h; } | |
| 69 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m; } | |
| 70 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s; } | |
| 71 | _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f; } | |
| 67 | _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; } | |
| 68 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h_; } | |
| 69 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m_; } | |
| 70 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s_; } | |
| 71 | _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f_; } | |
| 72 | 72 | |
| 73 | 73 | _LIBCPP_HIDE_FROM_ABI constexpr precision to_duration() const noexcept |
| 74 | 74 | { |
| 75 | auto __dur = __h + __m + __s + __f; | |
| 76 | return __is_neg ? -__dur : __dur; | |
| 75 | auto __dur = __h_ + __m_ + __s_ + __f_; | |
| 76 | return __is_neg_ ? -__dur : __dur; | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | _LIBCPP_HIDE_FROM_ABI constexpr explicit operator precision() const noexcept { return to_duration(); } |
| 80 | 80 | |
| 81 | 81 | private: |
| 82 | bool __is_neg; | |
| 83 | chrono::hours __h; | |
| 84 | chrono::minutes __m; | |
| 85 | chrono::seconds __s; | |
| 86 | precision __f; | |
| 82 | bool __is_neg_; | |
| 83 | chrono::hours __h_; | |
| 84 | chrono::minutes __m_; | |
| 85 | chrono::seconds __s_; | |
| 86 | precision __f_; | |
| 87 | 87 | }; |
| 88 | 88 | |
| 89 | 89 | _LIBCPP_HIDE_FROM_ABI constexpr bool is_am(const hours& __h) noexcept { return __h >= hours( 0) && __h < hours(12); } |
lib/libcxx/include/__chrono/month.h+10-25| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | |
| 13 | 13 | #include <__chrono/duration.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <compare> | |
| 15 | 16 | |
| 16 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 18 | # pragma GCC system_header |
| ... | ... | @@ -26,18 +27,18 @@ namespace chrono |
| 26 | 27 | |
| 27 | 28 | class month { |
| 28 | 29 | private: |
| 29 | unsigned char __m; | |
| 30 | unsigned char __m_; | |
| 30 | 31 | public: |
| 31 | 32 | _LIBCPP_HIDE_FROM_ABI month() = default; |
| 32 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr month(unsigned __val) noexcept : __m(static_cast<unsigned char>(__val)) {} | |
| 33 | _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator++() noexcept { ++__m; return *this; } | |
| 33 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr month(unsigned __val) noexcept : __m_(static_cast<unsigned char>(__val)) {} | |
| 34 | _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator++() noexcept { ++__m_; return *this; } | |
| 34 | 35 | _LIBCPP_HIDE_FROM_ABI inline constexpr month operator++(int) noexcept { month __tmp = *this; ++(*this); return __tmp; } |
| 35 | _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator--() noexcept { --__m; return *this; } | |
| 36 | _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator--() noexcept { --__m_; return *this; } | |
| 36 | 37 | _LIBCPP_HIDE_FROM_ABI inline constexpr month operator--(int) noexcept { month __tmp = *this; --(*this); return __tmp; } |
| 37 | 38 | _LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept; |
| 38 | 39 | _LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept; |
| 39 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m; } | |
| 40 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m >= 1 && __m <= 12; } | |
| 40 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; } | |
| 41 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; } | |
| 41 | 42 | }; |
| 42 | 43 | |
| 43 | 44 | |
| ... | ... | @@ -45,25 +46,9 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 45 | 46 | bool operator==(const month& __lhs, const month& __rhs) noexcept |
| 46 | 47 | { return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs); } |
| 47 | 48 | |
| 48 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 49 | bool operator!=(const month& __lhs, const month& __rhs) noexcept | |
| 50 | { return !(__lhs == __rhs); } | |
| 51 | ||
| 52 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 53 | bool operator< (const month& __lhs, const month& __rhs) noexcept | |
| 54 | { return static_cast<unsigned>(__lhs) < static_cast<unsigned>(__rhs); } | |
| 55 | ||
| 56 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 57 | bool operator> (const month& __lhs, const month& __rhs) noexcept | |
| 58 | { return __rhs < __lhs; } | |
| 59 | ||
| 60 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 61 | bool operator<=(const month& __lhs, const month& __rhs) noexcept | |
| 62 | { return !(__rhs < __lhs); } | |
| 63 | ||
| 64 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 65 | bool operator>=(const month& __lhs, const month& __rhs) noexcept | |
| 66 | { return !(__lhs < __rhs); } | |
| 49 | _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const month& __lhs, const month& __rhs) noexcept { | |
| 50 | return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs); | |
| 51 | } | |
| 67 | 52 | |
| 68 | 53 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 69 | 54 | month operator+ (const month& __lhs, const months& __rhs) noexcept |
lib/libcxx/include/__chrono/month_weekday.h+12-12| ... | ... | @@ -27,14 +27,14 @@ namespace chrono |
| 27 | 27 | |
| 28 | 28 | class month_weekday { |
| 29 | 29 | private: |
| 30 | chrono::month __m; | |
| 31 | chrono::weekday_indexed __wdi; | |
| 30 | chrono::month __m_; | |
| 31 | chrono::weekday_indexed __wdi_; | |
| 32 | 32 | public: |
| 33 | 33 | _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval, const chrono::weekday_indexed& __wdival) noexcept |
| 34 | : __m{__mval}, __wdi{__wdival} {} | |
| 35 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m; } | |
| 36 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi; } | |
| 37 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m.ok() && __wdi.ok(); } | |
| 34 | : __m_{__mval}, __wdi_{__wdival} {} | |
| 35 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | |
| 36 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; } | |
| 37 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); } | |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | 40 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| ... | ... | @@ -63,14 +63,14 @@ month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | class month_weekday_last { |
| 66 | chrono::month __m; | |
| 67 | chrono::weekday_last __wdl; | |
| 66 | chrono::month __m_; | |
| 67 | chrono::weekday_last __wdl_; | |
| 68 | 68 | public: |
| 69 | 69 | _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval, const chrono::weekday_last& __wdlval) noexcept |
| 70 | : __m{__mval}, __wdl{__wdlval} {} | |
| 71 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m; } | |
| 72 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl; } | |
| 73 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m.ok() && __wdl.ok(); } | |
| 70 | : __m_{__mval}, __wdl_{__wdlval} {} | |
| 71 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | |
| 72 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; } | |
| 73 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); } | |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | 76 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
lib/libcxx/include/__chrono/monthday.h+22-53| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | #include <__chrono/day.h> |
| 15 | 15 | #include <__chrono/month.h> |
| 16 | 16 | #include <__config> |
| 17 | #include <compare> | |
| 17 | 18 | |
| 18 | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 20 | # pragma GCC system_header |
| ... | ... | @@ -28,26 +29,26 @@ namespace chrono |
| 28 | 29 | |
| 29 | 30 | class month_day { |
| 30 | 31 | private: |
| 31 | chrono::month __m; | |
| 32 | chrono::day __d; | |
| 32 | chrono::month __m_; | |
| 33 | chrono::day __d_; | |
| 33 | 34 | public: |
| 34 | 35 | _LIBCPP_HIDE_FROM_ABI month_day() = default; |
| 35 | 36 | _LIBCPP_HIDE_FROM_ABI constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept |
| 36 | : __m{__mval}, __d{__dval} {} | |
| 37 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m; } | |
| 38 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d; } | |
| 37 | : __m_{__mval}, __d_{__dval} {} | |
| 38 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | |
| 39 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; } | |
| 39 | 40 | _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept; |
| 40 | 41 | }; |
| 41 | 42 | |
| 42 | 43 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 43 | 44 | bool month_day::ok() const noexcept |
| 44 | 45 | { |
| 45 | if (!__m.ok()) return false; | |
| 46 | const unsigned __dval = static_cast<unsigned>(__d); | |
| 46 | if (!__m_.ok()) return false; | |
| 47 | const unsigned __dval = static_cast<unsigned>(__d_); | |
| 47 | 48 | if (__dval < 1 || __dval > 31) return false; |
| 48 | 49 | if (__dval <= 29) return true; |
| 49 | 50 | // Now we've got either 30 or 31 |
| 50 | const unsigned __mval = static_cast<unsigned>(__m); | |
| 51 | const unsigned __mval = static_cast<unsigned>(__m_); | |
| 51 | 52 | if (__mval == 2) return false; |
| 52 | 53 | if (__mval == 4 || __mval == 6 || __mval == 9 || __mval == 11) |
| 53 | 54 | return __dval == 30; |
| ... | ... | @@ -58,9 +59,11 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 58 | 59 | bool operator==(const month_day& __lhs, const month_day& __rhs) noexcept |
| 59 | 60 | { return __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day(); } |
| 60 | 61 | |
| 61 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 62 | bool operator!=(const month_day& __lhs, const month_day& __rhs) noexcept | |
| 63 | { return !(__lhs == __rhs); } | |
| 62 | _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const month_day& __lhs, const month_day& __rhs) noexcept { | |
| 63 | if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0) | |
| 64 | return __c; | |
| 65 | return __lhs.day() <=> __rhs.day(); | |
| 66 | } | |
| 64 | 67 | |
| 65 | 68 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 66 | 69 | month_day operator/(const month& __lhs, const day& __rhs) noexcept |
| ... | ... | @@ -82,58 +85,24 @@ _LIBCPP_HIDE_FROM_ABI constexpr |
| 82 | 85 | month_day operator/(const day& __lhs, int __rhs) noexcept |
| 83 | 86 | { return month(__rhs) / __lhs; } |
| 84 | 87 | |
| 85 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 87 | bool operator< (const month_day& __lhs, const month_day& __rhs) noexcept | |
| 88 | { return __lhs.month() != __rhs.month() ? __lhs.month() < __rhs.month() : __lhs.day() < __rhs.day(); } | |
| 89 | ||
| 90 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 91 | bool operator> (const month_day& __lhs, const month_day& __rhs) noexcept | |
| 92 | { return __rhs < __lhs; } | |
| 93 | ||
| 94 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 95 | bool operator<=(const month_day& __lhs, const month_day& __rhs) noexcept | |
| 96 | { return !(__rhs < __lhs);} | |
| 97 | ||
| 98 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 99 | bool operator>=(const month_day& __lhs, const month_day& __rhs) noexcept | |
| 100 | { return !(__lhs < __rhs); } | |
| 101 | ||
| 102 | ||
| 103 | ||
| 104 | 88 | class month_day_last { |
| 105 | 89 | private: |
| 106 | chrono::month __m; | |
| 90 | chrono::month __m_; | |
| 107 | 91 | public: |
| 108 | 92 | _LIBCPP_HIDE_FROM_ABI explicit constexpr month_day_last(const chrono::month& __val) noexcept |
| 109 | : __m{__val} {} | |
| 110 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m; } | |
| 111 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m.ok(); } | |
| 93 | : __m_{__val} {} | |
| 94 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | |
| 95 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok(); } | |
| 112 | 96 | }; |
| 113 | 97 | |
| 114 | 98 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 115 | 99 | bool operator==(const month_day_last& __lhs, const month_day_last& __rhs) noexcept |
| 116 | 100 | { return __lhs.month() == __rhs.month(); } |
| 117 | 101 | |
| 118 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 119 | bool operator!=(const month_day_last& __lhs, const month_day_last& __rhs) noexcept | |
| 120 | { return !(__lhs == __rhs); } | |
| 121 | ||
| 122 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 123 | bool operator< (const month_day_last& __lhs, const month_day_last& __rhs) noexcept | |
| 124 | { return __lhs.month() < __rhs.month(); } | |
| 125 | ||
| 126 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 127 | bool operator> (const month_day_last& __lhs, const month_day_last& __rhs) noexcept | |
| 128 | { return __rhs < __lhs; } | |
| 129 | ||
| 130 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 131 | bool operator<=(const month_day_last& __lhs, const month_day_last& __rhs) noexcept | |
| 132 | { return !(__rhs < __lhs);} | |
| 133 | ||
| 134 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 135 | bool operator>=(const month_day_last& __lhs, const month_day_last& __rhs) noexcept | |
| 136 | { return !(__lhs < __rhs); } | |
| 102 | _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering | |
| 103 | operator<=>(const month_day_last& __lhs, const month_day_last& __rhs) noexcept { | |
| 104 | return __lhs.month() <=> __rhs.month(); | |
| 105 | } | |
| 137 | 106 | |
| 138 | 107 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 139 | 108 | month_day_last operator/(const month& __lhs, last_spec) noexcept |
lib/libcxx/include/__chrono/ostream.h created+238| ... | ... | @@ -0,0 +1,238 @@ |
| 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___CHRONO_OSTREAM_H | |
| 11 | #define _LIBCPP___CHRONO_OSTREAM_H | |
| 12 | ||
| 13 | #include <__chrono/day.h> | |
| 14 | #include <__chrono/duration.h> | |
| 15 | #include <__chrono/month.h> | |
| 16 | #include <__chrono/month_weekday.h> | |
| 17 | #include <__chrono/monthday.h> | |
| 18 | #include <__chrono/statically_widen.h> | |
| 19 | #include <__chrono/weekday.h> | |
| 20 | #include <__chrono/year.h> | |
| 21 | #include <__chrono/year_month.h> | |
| 22 | #include <__chrono/year_month_day.h> | |
| 23 | #include <__chrono/year_month_weekday.h> | |
| 24 | #include <__concepts/same_as.h> | |
| 25 | #include <__config> | |
| 26 | #include <__format/format_functions.h> | |
| 27 | #include <ostream> | |
| 28 | #include <ratio> | |
| 29 | ||
| 30 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 31 | # pragma GCC system_header | |
| 32 | #endif | |
| 33 | ||
| 34 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 35 | ||
| 36 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) | |
| 37 | ||
| 38 | namespace chrono { | |
| 39 | ||
| 40 | // Depending on the type the return is a const _CharT* or a basic_string<_CharT> | |
| 41 | template <class _CharT, class _Period> | |
| 42 | _LIBCPP_HIDE_FROM_ABI auto __units_suffix() { | |
| 43 | // TODO FMT LWG issue the suffixes are always char and not STATICALLY-WIDEN'ed. | |
| 44 | if constexpr (same_as<typename _Period::type, atto>) | |
| 45 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "as"); | |
| 46 | else if constexpr (same_as<typename _Period::type, femto>) | |
| 47 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "fs"); | |
| 48 | else if constexpr (same_as<typename _Period::type, pico>) | |
| 49 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "ps"); | |
| 50 | else if constexpr (same_as<typename _Period::type, nano>) | |
| 51 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "ns"); | |
| 52 | else if constexpr (same_as<typename _Period::type, micro>) | |
| 53 | # ifndef _LIBCPP_HAS_NO_UNICODE | |
| 54 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "\u00b5s"); | |
| 55 | # else | |
| 56 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "us"); | |
| 57 | # endif | |
| 58 | else if constexpr (same_as<typename _Period::type, milli>) | |
| 59 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "ms"); | |
| 60 | else if constexpr (same_as<typename _Period::type, centi>) | |
| 61 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "cs"); | |
| 62 | else if constexpr (same_as<typename _Period::type, deci>) | |
| 63 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "ds"); | |
| 64 | else if constexpr (same_as<typename _Period::type, ratio<1>>) | |
| 65 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "s"); | |
| 66 | else if constexpr (same_as<typename _Period::type, deca>) | |
| 67 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "das"); | |
| 68 | else if constexpr (same_as<typename _Period::type, hecto>) | |
| 69 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "hs"); | |
| 70 | else if constexpr (same_as<typename _Period::type, kilo>) | |
| 71 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "ks"); | |
| 72 | else if constexpr (same_as<typename _Period::type, mega>) | |
| 73 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "Ms"); | |
| 74 | else if constexpr (same_as<typename _Period::type, giga>) | |
| 75 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "Gs"); | |
| 76 | else if constexpr (same_as<typename _Period::type, tera>) | |
| 77 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "Ts"); | |
| 78 | else if constexpr (same_as<typename _Period::type, peta>) | |
| 79 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "Ps"); | |
| 80 | else if constexpr (same_as<typename _Period::type, exa>) | |
| 81 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "Es"); | |
| 82 | else if constexpr (same_as<typename _Period::type, ratio<60>>) | |
| 83 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "min"); | |
| 84 | else if constexpr (same_as<typename _Period::type, ratio<3600>>) | |
| 85 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "h"); | |
| 86 | else if constexpr (same_as<typename _Period::type, ratio<86400>>) | |
| 87 | return _LIBCPP_STATICALLY_WIDEN(_CharT, "d"); | |
| 88 | else if constexpr (_Period::den == 1) | |
| 89 | return std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "[{}]s"), _Period::num); | |
| 90 | else | |
| 91 | return std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "[{}/{}]s"), _Period::num, _Period::den); | |
| 92 | } | |
| 93 | ||
| 94 | template <class _CharT, class _Traits, class _Rep, class _Period> | |
| 95 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 96 | operator<<(basic_ostream<_CharT, _Traits>& __os, const duration<_Rep, _Period>& __d) { | |
| 97 | basic_ostringstream<_CharT, _Traits> __s; | |
| 98 | __s.flags(__os.flags()); | |
| 99 | __s.imbue(__os.getloc()); | |
| 100 | __s.precision(__os.precision()); | |
| 101 | __s << __d.count() << chrono::__units_suffix<_CharT, _Period>(); | |
| 102 | return __os << __s.str(); | |
| 103 | } | |
| 104 | ||
| 105 | template <class _CharT, class _Traits> | |
| 106 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 107 | operator<<(basic_ostream<_CharT, _Traits>& __os, const day& __d) { | |
| 108 | return __os | |
| 109 | << (__d.ok() | |
| 110 | ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%d}"), __d) | |
| 111 | // Note this error differs from the wording of the Standard. The | |
| 112 | // Standard wording doesn't work well on AIX or Windows. There | |
| 113 | // the formatted day seems to be either modulo 100 or completely | |
| 114 | // omitted. Judging by the wording this is valid. | |
| 115 | // TODO FMT Write a paper of file an LWG issue. | |
| 116 | : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02} is not a valid day"), static_cast<unsigned>(__d))); | |
| 117 | } | |
| 118 | ||
| 119 | template <class _CharT, class _Traits> | |
| 120 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 121 | operator<<(basic_ostream<_CharT, _Traits>& __os, const month& __m) { | |
| 122 | return __os << (__m.ok() ? std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%b}"), __m) | |
| 123 | : std::format(__os.getloc(), | |
| 124 | _LIBCPP_STATICALLY_WIDEN(_CharT, "{} is not a valid month"), | |
| 125 | static_cast<unsigned>(__m))); // TODO FMT Standard mandated locale isn't used. | |
| 126 | } | |
| 127 | ||
| 128 | template <class _CharT, class _Traits> | |
| 129 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 130 | operator<<(basic_ostream<_CharT, _Traits>& __os, const year& __y) { | |
| 131 | return __os << (__y.ok() ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%Y}"), __y) | |
| 132 | : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%Y} is not a valid year"), __y)); | |
| 133 | } | |
| 134 | ||
| 135 | template <class _CharT, class _Traits> | |
| 136 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 137 | operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday& __wd) { | |
| 138 | return __os << (__wd.ok() ? std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%a}"), __wd) | |
| 139 | : std::format(__os.getloc(), // TODO FMT Standard mandated locale isn't used. | |
| 140 | _LIBCPP_STATICALLY_WIDEN(_CharT, "{} is not a valid weekday"), | |
| 141 | static_cast<unsigned>(__wd.c_encoding()))); | |
| 142 | } | |
| 143 | ||
| 144 | template <class _CharT, class _Traits> | |
| 145 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 146 | operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday_indexed& __wdi) { | |
| 147 | auto __i = __wdi.index(); | |
| 148 | return __os << (__i >= 1 && __i <= 5 | |
| 149 | ? std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}[{}]"), __wdi.weekday(), __i) | |
| 150 | : std::format(__os.getloc(), | |
| 151 | _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}[{} is not a valid index]"), | |
| 152 | __wdi.weekday(), | |
| 153 | __i)); | |
| 154 | } | |
| 155 | ||
| 156 | template <class _CharT, class _Traits> | |
| 157 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 158 | operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday_last& __wdl) { | |
| 159 | return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}[last]"), __wdl.weekday()); | |
| 160 | } | |
| 161 | ||
| 162 | template <class _CharT, class _Traits> | |
| 163 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 164 | operator<<(basic_ostream<_CharT, _Traits>& __os, const month_day& __md) { | |
| 165 | // TODO FMT The Standard allows 30th of February to be printed. | |
| 166 | // It would be nice to show an error message instead. | |
| 167 | return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/{}"), __md.month(), __md.day()); | |
| 168 | } | |
| 169 | ||
| 170 | template <class _CharT, class _Traits> | |
| 171 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 172 | operator<<(basic_ostream<_CharT, _Traits>& __os, const month_day_last& __mdl) { | |
| 173 | return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/last"), __mdl.month()); | |
| 174 | } | |
| 175 | ||
| 176 | template <class _CharT, class _Traits> | |
| 177 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 178 | operator<<(basic_ostream<_CharT, _Traits>& __os, const month_weekday& __mwd) { | |
| 179 | return __os << std::format( | |
| 180 | __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/{:L}"), __mwd.month(), __mwd.weekday_indexed()); | |
| 181 | } | |
| 182 | ||
| 183 | template <class _CharT, class _Traits> | |
| 184 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 185 | operator<<(basic_ostream<_CharT, _Traits>& __os, const month_weekday_last& __mwdl) { | |
| 186 | return __os << std::format( | |
| 187 | __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/{:L}"), __mwdl.month(), __mwdl.weekday_last()); | |
| 188 | } | |
| 189 | ||
| 190 | template <class _CharT, class _Traits> | |
| 191 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 192 | operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month& __ym) { | |
| 193 | return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}"), __ym.year(), __ym.month()); | |
| 194 | } | |
| 195 | ||
| 196 | template <class _CharT, class _Traits> | |
| 197 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 198 | operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_day& __ymd) { | |
| 199 | return __os << (__ymd.ok() ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%F}"), __ymd) | |
| 200 | : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%F} is not a valid date"), __ymd)); | |
| 201 | } | |
| 202 | ||
| 203 | template <class _CharT, class _Traits> | |
| 204 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 205 | operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_day_last& __ymdl) { | |
| 206 | return __os << std::format( | |
| 207 | __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}"), __ymdl.year(), __ymdl.month_day_last()); | |
| 208 | } | |
| 209 | ||
| 210 | template <class _CharT, class _Traits> | |
| 211 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 212 | operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_weekday& __ymwd) { | |
| 213 | return __os << std::format( | |
| 214 | __os.getloc(), | |
| 215 | _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}/{:L}"), | |
| 216 | __ymwd.year(), | |
| 217 | __ymwd.month(), | |
| 218 | __ymwd.weekday_indexed()); | |
| 219 | } | |
| 220 | ||
| 221 | template <class _CharT, class _Traits> | |
| 222 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& | |
| 223 | operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_weekday_last& __ymwdl) { | |
| 224 | return __os << std::format( | |
| 225 | __os.getloc(), | |
| 226 | _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}/{:L}"), | |
| 227 | __ymwdl.year(), | |
| 228 | __ymwdl.month(), | |
| 229 | __ymwdl.weekday_last()); | |
| 230 | } | |
| 231 | ||
| 232 | } // namespace chrono | |
| 233 | ||
| 234 | #endif //if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) | |
| 235 | ||
| 236 | _LIBCPP_END_NAMESPACE_STD | |
| 237 | ||
| 238 | #endif // _LIBCPP___CHRONO_OSTREAM_H |
lib/libcxx/include/__chrono/parser_std_format_spec.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___CHRONO_PARSER_STD_FORMAT_SPEC_H | |
| 11 | #define _LIBCPP___CHRONO_PARSER_STD_FORMAT_SPEC_H | |
| 12 | ||
| 13 | #include <__config> | |
| 14 | #include <__format/concepts.h> | |
| 15 | #include <__format/format_error.h> | |
| 16 | #include <__format/format_parse_context.h> | |
| 17 | #include <__format/formatter_string.h> | |
| 18 | #include <__format/parser_std_format_spec.h> | |
| 19 | #include <string_view> | |
| 20 | ||
| 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 22 | # pragma GCC system_header | |
| 23 | #endif | |
| 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 26 | ||
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) | |
| 28 | ||
| 29 | namespace __format_spec { | |
| 30 | ||
| 31 | // By not placing this constant in the formatter class it's not duplicated for char and wchar_t | |
| 32 | inline constexpr __fields __fields_chrono_fractional{ | |
| 33 | .__precision_ = true, .__locale_specific_form_ = true, .__type_ = false}; | |
| 34 | inline constexpr __fields __fields_chrono{.__locale_specific_form_ = true, .__type_ = false}; | |
| 35 | ||
| 36 | /// Flags available or required in a chrono type. | |
| 37 | /// | |
| 38 | /// The caller of the chrono formatter lists the types it has available and the | |
| 39 | /// validation tests whether the requested type spec (e.g. %M) is available in | |
| 40 | /// the formatter. | |
| 41 | /// When the type in the chrono-format-spec isn't present in the data a | |
| 42 | /// \ref format_error is thrown. | |
| 43 | enum class __flags { | |
| 44 | __second = 0x1, | |
| 45 | __minute = 0x2, | |
| 46 | __hour = 0x4, | |
| 47 | __time = __hour | __minute | __second, | |
| 48 | ||
| 49 | __day = 0x8, | |
| 50 | __month = 0x10, | |
| 51 | __year = 0x20, | |
| 52 | ||
| 53 | __weekday = 0x40, | |
| 54 | ||
| 55 | __month_day = __day | __month, | |
| 56 | __month_weekday = __weekday | __month, | |
| 57 | __year_month = __month | __year, | |
| 58 | __date = __day | __month | __year | __weekday, | |
| 59 | ||
| 60 | __date_time = __date | __time, | |
| 61 | ||
| 62 | __duration = 0x80 | __time, | |
| 63 | ||
| 64 | __time_zone = 0x100, | |
| 65 | ||
| 66 | __clock = __date_time | __time_zone | |
| 67 | }; | |
| 68 | ||
| 69 | _LIBCPP_HIDE_FROM_ABI constexpr __flags operator&(__flags __lhs, __flags __rhs) { | |
| 70 | return static_cast<__flags>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs)); | |
| 71 | } | |
| 72 | ||
| 73 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_second(__flags __flags) { | |
| 74 | if ((__flags & __flags::__second) != __flags::__second) | |
| 75 | std::__throw_format_error("The supplied date time doesn't contain a second"); | |
| 76 | } | |
| 77 | ||
| 78 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_minute(__flags __flags) { | |
| 79 | if ((__flags & __flags::__minute) != __flags::__minute) | |
| 80 | std::__throw_format_error("The supplied date time doesn't contain a minute"); | |
| 81 | } | |
| 82 | ||
| 83 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_hour(__flags __flags) { | |
| 84 | if ((__flags & __flags::__hour) != __flags::__hour) | |
| 85 | std::__throw_format_error("The supplied date time doesn't contain an hour"); | |
| 86 | } | |
| 87 | ||
| 88 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_time(__flags __flags) { | |
| 89 | if ((__flags & __flags::__time) != __flags::__time) | |
| 90 | std::__throw_format_error("The supplied date time doesn't contain a time"); | |
| 91 | } | |
| 92 | ||
| 93 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_day(__flags __flags) { | |
| 94 | if ((__flags & __flags::__day) != __flags::__day) | |
| 95 | std::__throw_format_error("The supplied date time doesn't contain a day"); | |
| 96 | } | |
| 97 | ||
| 98 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_month(__flags __flags) { | |
| 99 | if ((__flags & __flags::__month) != __flags::__month) | |
| 100 | std::__throw_format_error("The supplied date time doesn't contain a month"); | |
| 101 | } | |
| 102 | ||
| 103 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_year(__flags __flags) { | |
| 104 | if ((__flags & __flags::__year) != __flags::__year) | |
| 105 | std::__throw_format_error("The supplied date time doesn't contain a year"); | |
| 106 | } | |
| 107 | ||
| 108 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_date(__flags __flags) { | |
| 109 | if ((__flags & __flags::__date) != __flags::__date) | |
| 110 | std::__throw_format_error("The supplied date time doesn't contain a date"); | |
| 111 | } | |
| 112 | ||
| 113 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_date_or_duration(__flags __flags) { | |
| 114 | if (((__flags & __flags::__date) != __flags::__date) && ((__flags & __flags::__duration) != __flags::__duration)) | |
| 115 | std::__throw_format_error("The supplied date time doesn't contain a date or duration"); | |
| 116 | } | |
| 117 | ||
| 118 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_date_time(__flags __flags) { | |
| 119 | if ((__flags & __flags::__date_time) != __flags::__date_time) | |
| 120 | std::__throw_format_error("The supplied date time doesn't contain a date and time"); | |
| 121 | } | |
| 122 | ||
| 123 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_weekday(__flags __flags) { | |
| 124 | if ((__flags & __flags::__weekday) != __flags::__weekday) | |
| 125 | std::__throw_format_error("The supplied date time doesn't contain a weekday"); | |
| 126 | } | |
| 127 | ||
| 128 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_duration(__flags __flags) { | |
| 129 | if ((__flags & __flags::__duration) != __flags::__duration) | |
| 130 | std::__throw_format_error("The supplied date time doesn't contain a duration"); | |
| 131 | } | |
| 132 | ||
| 133 | _LIBCPP_HIDE_FROM_ABI constexpr void __validate_time_zone(__flags __flags) { | |
| 134 | if ((__flags & __flags::__time_zone) != __flags::__time_zone) | |
| 135 | std::__throw_format_error("The supplied date time doesn't contain a time zone"); | |
| 136 | } | |
| 137 | ||
| 138 | template <class _CharT> | |
| 139 | class _LIBCPP_TEMPLATE_VIS __parser_chrono { | |
| 140 | public: | |
| 141 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 142 | __parse(basic_format_parse_context<_CharT>& __parse_ctx, __fields __fields, __flags __flags) | |
| 143 | -> decltype(__parse_ctx.begin()) { | |
| 144 | const _CharT* __begin = __parser_.__parse(__parse_ctx, __fields); | |
| 145 | const _CharT* __end = __parse_ctx.end(); | |
| 146 | if (__begin == __end) | |
| 147 | return __begin; | |
| 148 | ||
| 149 | const _CharT* __last = __parse_chrono_specs(__begin, __end, __flags); | |
| 150 | __chrono_specs_ = basic_string_view<_CharT>{__begin, __last}; | |
| 151 | ||
| 152 | return __last; | |
| 153 | } | |
| 154 | ||
| 155 | __parser<_CharT> __parser_; | |
| 156 | basic_string_view<_CharT> __chrono_specs_; | |
| 157 | ||
| 158 | private: | |
| 159 | _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* | |
| 160 | __parse_chrono_specs(const _CharT* __begin, const _CharT* __end, __flags __flags) { | |
| 161 | _LIBCPP_ASSERT(__begin != __end, | |
| 162 | "When called with an empty input the function will cause " | |
| 163 | "undefined behavior by evaluating data not in the input"); | |
| 164 | ||
| 165 | if (*__begin != _CharT('%') && *__begin != _CharT('}')) | |
| 166 | std::__throw_format_error("Expected '%' or '}' in the chrono format-string"); | |
| 167 | ||
| 168 | do { | |
| 169 | switch (*__begin) { | |
| 170 | case _CharT('{'): | |
| 171 | std::__throw_format_error("The chrono-specs contains a '{'"); | |
| 172 | ||
| 173 | case _CharT('}'): | |
| 174 | return __begin; | |
| 175 | ||
| 176 | case _CharT('%'): | |
| 177 | __parse_conversion_spec(__begin, __end, __flags); | |
| 178 | [[fallthrough]]; | |
| 179 | ||
| 180 | default: | |
| 181 | // All other literals | |
| 182 | ++__begin; | |
| 183 | } | |
| 184 | ||
| 185 | } while (__begin != __end && *__begin != _CharT('}')); | |
| 186 | ||
| 187 | return __begin; | |
| 188 | } | |
| 189 | ||
| 190 | /// \pre *__begin == '%' | |
| 191 | /// \post __begin points at the end parsed conversion-spec | |
| 192 | _LIBCPP_HIDE_FROM_ABI constexpr void | |
| 193 | __parse_conversion_spec(const _CharT*& __begin, const _CharT* __end, __flags __flags) { | |
| 194 | ++__begin; | |
| 195 | if (__begin == __end) | |
| 196 | std::__throw_format_error("End of input while parsing the modifier chrono conversion-spec"); | |
| 197 | ||
| 198 | switch (*__begin) { | |
| 199 | case _CharT('n'): | |
| 200 | case _CharT('t'): | |
| 201 | case _CharT('%'): | |
| 202 | break; | |
| 203 | ||
| 204 | case _CharT('S'): | |
| 205 | __format_spec::__validate_second(__flags); | |
| 206 | break; | |
| 207 | ||
| 208 | case _CharT('M'): | |
| 209 | __format_spec::__validate_minute(__flags); | |
| 210 | break; | |
| 211 | ||
| 212 | case _CharT('p'): // TODO FMT does the formater require an hour or a time? | |
| 213 | case _CharT('H'): | |
| 214 | case _CharT('I'): | |
| 215 | __validate_hour(__flags); | |
| 216 | break; | |
| 217 | ||
| 218 | case _CharT('r'): | |
| 219 | case _CharT('R'): | |
| 220 | case _CharT('T'): | |
| 221 | case _CharT('X'): | |
| 222 | __format_spec::__validate_time(__flags); | |
| 223 | break; | |
| 224 | ||
| 225 | case _CharT('d'): | |
| 226 | case _CharT('e'): | |
| 227 | __format_spec::__validate_day(__flags); | |
| 228 | break; | |
| 229 | ||
| 230 | case _CharT('b'): | |
| 231 | case _CharT('h'): | |
| 232 | case _CharT('B'): | |
| 233 | __parser_.__month_name_ = true; | |
| 234 | [[fallthrough]]; | |
| 235 | case _CharT('m'): | |
| 236 | __format_spec::__validate_month(__flags); | |
| 237 | break; | |
| 238 | ||
| 239 | case _CharT('y'): | |
| 240 | case _CharT('C'): | |
| 241 | case _CharT('Y'): | |
| 242 | __format_spec::__validate_year(__flags); | |
| 243 | break; | |
| 244 | ||
| 245 | case _CharT('j'): | |
| 246 | __parser_.__day_of_year_ = true; | |
| 247 | __format_spec::__validate_date_or_duration(__flags); | |
| 248 | break; | |
| 249 | ||
| 250 | case _CharT('g'): | |
| 251 | case _CharT('G'): | |
| 252 | case _CharT('U'): | |
| 253 | case _CharT('V'): | |
| 254 | case _CharT('W'): | |
| 255 | __parser_.__week_of_year_ = true; | |
| 256 | [[fallthrough]]; | |
| 257 | case _CharT('x'): | |
| 258 | case _CharT('D'): | |
| 259 | case _CharT('F'): | |
| 260 | __format_spec::__validate_date(__flags); | |
| 261 | break; | |
| 262 | ||
| 263 | case _CharT('c'): | |
| 264 | __format_spec::__validate_date_time(__flags); | |
| 265 | break; | |
| 266 | ||
| 267 | case _CharT('a'): | |
| 268 | case _CharT('A'): | |
| 269 | __parser_.__weekday_name_ = true; | |
| 270 | [[fallthrough]]; | |
| 271 | case _CharT('u'): | |
| 272 | case _CharT('w'): | |
| 273 | __parser_.__weekday_ = true; | |
| 274 | __validate_weekday(__flags); | |
| 275 | __format_spec::__validate_weekday(__flags); | |
| 276 | break; | |
| 277 | ||
| 278 | case _CharT('q'): | |
| 279 | case _CharT('Q'): | |
| 280 | __format_spec::__validate_duration(__flags); | |
| 281 | break; | |
| 282 | ||
| 283 | case _CharT('E'): | |
| 284 | __parse_modifier_E(__begin, __end, __flags); | |
| 285 | break; | |
| 286 | ||
| 287 | case _CharT('O'): | |
| 288 | __parse_modifier_O(__begin, __end, __flags); | |
| 289 | break; | |
| 290 | ||
| 291 | case _CharT('z'): | |
| 292 | case _CharT('Z'): | |
| 293 | // Currently there's no time zone information. However some clocks have a | |
| 294 | // hard-coded "time zone", for these clocks the information can be used. | |
| 295 | // TODO FMT implement time zones. | |
| 296 | __format_spec::__validate_time_zone(__flags); | |
| 297 | break; | |
| 298 | ||
| 299 | default: // unknown type; | |
| 300 | std::__throw_format_error("The date time type specifier is invalid"); | |
| 301 | } | |
| 302 | } | |
| 303 | ||
| 304 | /// \pre *__begin == 'E' | |
| 305 | /// \post __begin is incremented by one. | |
| 306 | _LIBCPP_HIDE_FROM_ABI constexpr void | |
| 307 | __parse_modifier_E(const _CharT*& __begin, const _CharT* __end, __flags __flags) { | |
| 308 | ++__begin; | |
| 309 | if (__begin == __end) | |
| 310 | std::__throw_format_error("End of input while parsing the modifier E"); | |
| 311 | ||
| 312 | switch (*__begin) { | |
| 313 | case _CharT('X'): | |
| 314 | __format_spec::__validate_time(__flags); | |
| 315 | break; | |
| 316 | ||
| 317 | case _CharT('y'): | |
| 318 | case _CharT('C'): | |
| 319 | case _CharT('Y'): | |
| 320 | __format_spec::__validate_year(__flags); | |
| 321 | break; | |
| 322 | ||
| 323 | case _CharT('x'): | |
| 324 | __format_spec::__validate_date(__flags); | |
| 325 | break; | |
| 326 | ||
| 327 | case _CharT('c'): | |
| 328 | __format_spec::__validate_date_time(__flags); | |
| 329 | break; | |
| 330 | ||
| 331 | case _CharT('z'): | |
| 332 | // Currently there's no time zone information. However some clocks have a | |
| 333 | // hard-coded "time zone", for these clocks the information can be used. | |
| 334 | // TODO FMT implement time zones. | |
| 335 | __format_spec::__validate_time_zone(__flags); | |
| 336 | break; | |
| 337 | ||
| 338 | default: | |
| 339 | std::__throw_format_error("The date time type specifier for modifier E is invalid"); | |
| 340 | } | |
| 341 | } | |
| 342 | ||
| 343 | /// \pre *__begin == 'O' | |
| 344 | /// \post __begin is incremented by one. | |
| 345 | _LIBCPP_HIDE_FROM_ABI constexpr void | |
| 346 | __parse_modifier_O(const _CharT*& __begin, const _CharT* __end, __flags __flags) { | |
| 347 | ++__begin; | |
| 348 | if (__begin == __end) | |
| 349 | std::__throw_format_error("End of input while parsing the modifier O"); | |
| 350 | ||
| 351 | switch (*__begin) { | |
| 352 | case _CharT('S'): | |
| 353 | __format_spec::__validate_second(__flags); | |
| 354 | break; | |
| 355 | ||
| 356 | case _CharT('M'): | |
| 357 | __format_spec::__validate_minute(__flags); | |
| 358 | break; | |
| 359 | ||
| 360 | case _CharT('I'): | |
| 361 | case _CharT('H'): | |
| 362 | __format_spec::__validate_hour(__flags); | |
| 363 | break; | |
| 364 | ||
| 365 | case _CharT('d'): | |
| 366 | case _CharT('e'): | |
| 367 | __format_spec::__validate_day(__flags); | |
| 368 | break; | |
| 369 | ||
| 370 | case _CharT('m'): | |
| 371 | __format_spec::__validate_month(__flags); | |
| 372 | break; | |
| 373 | ||
| 374 | case _CharT('y'): | |
| 375 | __format_spec::__validate_year(__flags); | |
| 376 | break; | |
| 377 | ||
| 378 | case _CharT('U'): | |
| 379 | case _CharT('V'): | |
| 380 | case _CharT('W'): | |
| 381 | __parser_.__week_of_year_ = true; | |
| 382 | __format_spec::__validate_date(__flags); | |
| 383 | break; | |
| 384 | ||
| 385 | case _CharT('u'): | |
| 386 | case _CharT('w'): | |
| 387 | __parser_.__weekday_ = true; | |
| 388 | __format_spec::__validate_weekday(__flags); | |
| 389 | break; | |
| 390 | ||
| 391 | case _CharT('z'): | |
| 392 | // Currently there's no time zone information. However some clocks have a | |
| 393 | // hard-coded "time zone", for these clocks the information can be used. | |
| 394 | // TODO FMT implement time zones. | |
| 395 | __format_spec::__validate_time_zone(__flags); | |
| 396 | break; | |
| 397 | ||
| 398 | default: | |
| 399 | std::__throw_format_error("The date time type specifier for modifier O is invalid"); | |
| 400 | } | |
| 401 | } | |
| 402 | }; | |
| 403 | ||
| 404 | } // namespace __format_spec | |
| 405 | ||
| 406 | #endif //_LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) | |
| 407 | ||
| 408 | _LIBCPP_END_NAMESPACE_STD | |
| 409 | ||
| 410 | #endif // _LIBCPP___CHRONO_PARSER_STD_FORMAT_SPEC_H |
lib/libcxx/include/__chrono/statically_widen.h created+52| ... | ... | @@ -0,0 +1,52 @@ |
| 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___CHRONO_STATICALLY_WIDEN_H | |
| 11 | #define _LIBCPP___CHRONO_STATICALLY_WIDEN_H | |
| 12 | ||
| 13 | // Implements the STATICALLY-WIDEN exposition-only function. ([time.general]/2) | |
| 14 | ||
| 15 | #include <__concepts/same_as.h> | |
| 16 | #include <__config> | |
| 17 | #include <__format/concepts.h> | |
| 18 | ||
| 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 20 | # pragma GCC system_header | |
| 21 | #endif | |
| 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 24 | ||
| 25 | #if _LIBCPP_STD_VER > 17 | |
| 26 | ||
| 27 | # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 28 | template <__fmt_char_type _CharT> | |
| 29 | _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str, const wchar_t* __wstr) { | |
| 30 | if constexpr (same_as<_CharT, char>) | |
| 31 | return __str; | |
| 32 | else | |
| 33 | return __wstr; | |
| 34 | } | |
| 35 | # define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str, L##__str) | |
| 36 | # else // _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 37 | ||
| 38 | // Without this indirection the unit test test/libcxx/modules_include.sh.cpp | |
| 39 | // fails for the CI build "No wide characters". This seems like a bug. | |
| 40 | // TODO FMT investigate why this is needed. | |
| 41 | template <__fmt_char_type _CharT> | |
| 42 | _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str) { | |
| 43 | return __str; | |
| 44 | } | |
| 45 | # define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str) | |
| 46 | # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 47 | ||
| 48 | #endif //_LIBCPP_STD_VER > 17 | |
| 49 | ||
| 50 | _LIBCPP_END_NAMESPACE_STD | |
| 51 | ||
| 52 | #endif // _LIBCPP___CHRONO_STATICALLY_WIDEN_H |
lib/libcxx/include/__chrono/steady_clock.h+1-1| ... | ... | @@ -31,7 +31,7 @@ public: |
| 31 | 31 | typedef duration::rep rep; |
| 32 | 32 | typedef duration::period period; |
| 33 | 33 | typedef chrono::time_point<steady_clock, duration> time_point; |
| 34 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = true; | |
| 34 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = true; | |
| 35 | 35 | |
| 36 | 36 | static time_point now() _NOEXCEPT; |
| 37 | 37 | }; |
lib/libcxx/include/__chrono/system_clock.h+1-1| ... | ... | @@ -31,7 +31,7 @@ public: |
| 31 | 31 | typedef duration::rep rep; |
| 32 | 32 | typedef duration::period period; |
| 33 | 33 | typedef chrono::time_point<system_clock> time_point; |
| 34 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false; | |
| 34 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false; | |
| 35 | 35 | |
| 36 | 36 | static time_point now() _NOEXCEPT; |
| 37 | 37 | static time_t to_time_t (const time_point& __t) _NOEXCEPT; |
lib/libcxx/include/__chrono/time_point.h+23-21| ... | ... | @@ -12,8 +12,10 @@ |
| 12 | 12 | |
| 13 | 13 | #include <__chrono/duration.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <__type_traits/common_type.h> | |
| 16 | #include <__type_traits/enable_if.h> | |
| 17 | #include <__type_traits/is_convertible.h> | |
| 15 | 18 | #include <limits> |
| 16 | #include <type_traits> | |
| 17 | 19 | |
| 18 | 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 21 | # pragma GCC system_header |
| ... | ... | @@ -41,12 +43,12 @@ private: |
| 41 | 43 | duration __d_; |
| 42 | 44 | |
| 43 | 45 | public: |
| 44 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 time_point() : __d_(duration::zero()) {} | |
| 45 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit time_point(const duration& __d) : __d_(__d) {} | |
| 46 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point() : __d_(duration::zero()) {} | |
| 47 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit time_point(const duration& __d) : __d_(__d) {} | |
| 46 | 48 | |
| 47 | 49 | // conversions |
| 48 | 50 | template <class _Duration2> |
| 49 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 51 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 50 | 52 | time_point(const time_point<clock, _Duration2>& __t, |
| 51 | 53 | typename enable_if |
| 52 | 54 | < |
| ... | ... | @@ -56,12 +58,12 @@ public: |
| 56 | 58 | |
| 57 | 59 | // observer |
| 58 | 60 | |
| 59 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 duration time_since_epoch() const {return __d_;} | |
| 61 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 duration time_since_epoch() const {return __d_;} | |
| 60 | 62 | |
| 61 | 63 | // arithmetic |
| 62 | 64 | |
| 63 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 time_point& operator+=(const duration& __d) {__d_ += __d; return *this;} | |
| 64 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;} | |
| 65 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator+=(const duration& __d) {__d_ += __d; return *this;} | |
| 66 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;} | |
| 65 | 67 | |
| 66 | 68 | // special values |
| 67 | 69 | |
| ... | ... | @@ -81,7 +83,7 @@ struct _LIBCPP_TEMPLATE_VIS common_type<chrono::time_point<_Clock, _Duration1>, |
| 81 | 83 | namespace chrono { |
| 82 | 84 | |
| 83 | 85 | template <class _ToDuration, class _Clock, class _Duration> |
| 84 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 86 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 85 | 87 | time_point<_Clock, _ToDuration> |
| 86 | 88 | time_point_cast(const time_point<_Clock, _Duration>& __t) |
| 87 | 89 | { |
| ... | ... | @@ -98,7 +100,7 @@ typename enable_if |
| 98 | 100 | >::type |
| 99 | 101 | floor(const time_point<_Clock, _Duration>& __t) |
| 100 | 102 | { |
| 101 | return time_point<_Clock, _ToDuration>{floor<_ToDuration>(__t.time_since_epoch())}; | |
| 103 | return time_point<_Clock, _ToDuration>{chrono::floor<_ToDuration>(__t.time_since_epoch())}; | |
| 102 | 104 | } |
| 103 | 105 | |
| 104 | 106 | template <class _ToDuration, class _Clock, class _Duration> |
| ... | ... | @@ -110,7 +112,7 @@ typename enable_if |
| 110 | 112 | >::type |
| 111 | 113 | ceil(const time_point<_Clock, _Duration>& __t) |
| 112 | 114 | { |
| 113 | return time_point<_Clock, _ToDuration>{ceil<_ToDuration>(__t.time_since_epoch())}; | |
| 115 | return time_point<_Clock, _ToDuration>{chrono::ceil<_ToDuration>(__t.time_since_epoch())}; | |
| 114 | 116 | } |
| 115 | 117 | |
| 116 | 118 | template <class _ToDuration, class _Clock, class _Duration> |
| ... | ... | @@ -122,7 +124,7 @@ typename enable_if |
| 122 | 124 | >::type |
| 123 | 125 | round(const time_point<_Clock, _Duration>& __t) |
| 124 | 126 | { |
| 125 | return time_point<_Clock, _ToDuration>{round<_ToDuration>(__t.time_since_epoch())}; | |
| 127 | return time_point<_Clock, _ToDuration>{chrono::round<_ToDuration>(__t.time_since_epoch())}; | |
| 126 | 128 | } |
| 127 | 129 | |
| 128 | 130 | template <class _Rep, class _Period> |
| ... | ... | @@ -141,7 +143,7 @@ abs(duration<_Rep, _Period> __d) |
| 141 | 143 | // time_point == |
| 142 | 144 | |
| 143 | 145 | template <class _Clock, class _Duration1, class _Duration2> |
| 144 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 146 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 145 | 147 | bool |
| 146 | 148 | operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) |
| 147 | 149 | { |
| ... | ... | @@ -151,7 +153,7 @@ operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, |
| 151 | 153 | // time_point != |
| 152 | 154 | |
| 153 | 155 | template <class _Clock, class _Duration1, class _Duration2> |
| 154 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 156 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 155 | 157 | bool |
| 156 | 158 | operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) |
| 157 | 159 | { |
| ... | ... | @@ -161,7 +163,7 @@ operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, |
| 161 | 163 | // time_point < |
| 162 | 164 | |
| 163 | 165 | template <class _Clock, class _Duration1, class _Duration2> |
| 164 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 166 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 165 | 167 | bool |
| 166 | 168 | operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) |
| 167 | 169 | { |
| ... | ... | @@ -171,7 +173,7 @@ operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, |
| 171 | 173 | // time_point > |
| 172 | 174 | |
| 173 | 175 | template <class _Clock, class _Duration1, class _Duration2> |
| 174 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 176 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 175 | 177 | bool |
| 176 | 178 | operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) |
| 177 | 179 | { |
| ... | ... | @@ -181,7 +183,7 @@ operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, |
| 181 | 183 | // time_point <= |
| 182 | 184 | |
| 183 | 185 | template <class _Clock, class _Duration1, class _Duration2> |
| 184 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 186 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 185 | 187 | bool |
| 186 | 188 | operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) |
| 187 | 189 | { |
| ... | ... | @@ -191,7 +193,7 @@ operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, |
| 191 | 193 | // time_point >= |
| 192 | 194 | |
| 193 | 195 | template <class _Clock, class _Duration1, class _Duration2> |
| 194 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 196 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 195 | 197 | bool |
| 196 | 198 | operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) |
| 197 | 199 | { |
| ... | ... | @@ -201,7 +203,7 @@ operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, |
| 201 | 203 | // time_point operator+(time_point x, duration y); |
| 202 | 204 | |
| 203 | 205 | template <class _Clock, class _Duration1, class _Rep2, class _Period2> |
| 204 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 206 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 205 | 207 | time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> |
| 206 | 208 | operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) |
| 207 | 209 | { |
| ... | ... | @@ -212,7 +214,7 @@ operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Pe |
| 212 | 214 | // time_point operator+(duration x, time_point y); |
| 213 | 215 | |
| 214 | 216 | template <class _Rep1, class _Period1, class _Clock, class _Duration2> |
| 215 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 217 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 216 | 218 | time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type> |
| 217 | 219 | operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) |
| 218 | 220 | { |
| ... | ... | @@ -222,7 +224,7 @@ operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Dura |
| 222 | 224 | // time_point operator-(time_point x, duration y); |
| 223 | 225 | |
| 224 | 226 | template <class _Clock, class _Duration1, class _Rep2, class _Period2> |
| 225 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 227 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 226 | 228 | time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> |
| 227 | 229 | operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) |
| 228 | 230 | { |
| ... | ... | @@ -233,7 +235,7 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Pe |
| 233 | 235 | // duration operator-(time_point x, time_point y); |
| 234 | 236 | |
| 235 | 237 | template <class _Clock, class _Duration1, class _Duration2> |
| 236 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 238 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 237 | 239 | typename common_type<_Duration1, _Duration2>::type |
| 238 | 240 | operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) |
| 239 | 241 | { |
lib/libcxx/include/__chrono/weekday.h+19-19| ... | ... | @@ -32,25 +32,25 @@ class weekday_last; |
| 32 | 32 | |
| 33 | 33 | class weekday { |
| 34 | 34 | private: |
| 35 | unsigned char __wd; | |
| 35 | unsigned char __wd_; | |
| 36 | 36 | _LIBCPP_HIDE_FROM_ABI static constexpr unsigned char __weekday_from_days(int __days) noexcept; |
| 37 | 37 | public: |
| 38 | 38 | _LIBCPP_HIDE_FROM_ABI weekday() = default; |
| 39 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {} | |
| 39 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(unsigned __val) noexcept : __wd_(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {} | |
| 40 | 40 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday(const sys_days& __sysd) noexcept |
| 41 | : __wd(__weekday_from_days(__sysd.time_since_epoch().count())) {} | |
| 41 | : __wd_(__weekday_from_days(__sysd.time_since_epoch().count())) {} | |
| 42 | 42 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(const local_days& __locd) noexcept |
| 43 | : __wd(__weekday_from_days(__locd.time_since_epoch().count())) {} | |
| 43 | : __wd_(__weekday_from_days(__locd.time_since_epoch().count())) {} | |
| 44 | 44 | |
| 45 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator++() noexcept { __wd = (__wd == 6 ? 0 : __wd + 1); return *this; } | |
| 45 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator++() noexcept { __wd_ = (__wd_ == 6 ? 0 : __wd_ + 1); return *this; } | |
| 46 | 46 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator++(int) noexcept { weekday __tmp = *this; ++(*this); return __tmp; } |
| 47 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator--() noexcept { __wd = (__wd == 0 ? 6 : __wd - 1); return *this; } | |
| 47 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator--() noexcept { __wd_ = (__wd_ == 0 ? 6 : __wd_ - 1); return *this; } | |
| 48 | 48 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; } |
| 49 | 49 | _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator+=(const days& __dd) noexcept; |
| 50 | 50 | _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator-=(const days& __dd) noexcept; |
| 51 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd; } | |
| 52 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned iso_encoding() const noexcept { return __wd == 0u ? 7 : __wd; } | |
| 53 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd <= 6; } | |
| 51 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd_; } | |
| 52 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned iso_encoding() const noexcept { return __wd_ == 0u ? 7 : __wd_; } | |
| 53 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_ <= 6; } | |
| 54 | 54 | _LIBCPP_HIDE_FROM_ABI constexpr weekday_indexed operator[](unsigned __index) const noexcept; |
| 55 | 55 | _LIBCPP_HIDE_FROM_ABI constexpr weekday_last operator[](last_spec) const noexcept; |
| 56 | 56 | }; |
| ... | ... | @@ -123,15 +123,15 @@ weekday& weekday::operator-=(const days& __dd) noexcept |
| 123 | 123 | |
| 124 | 124 | class weekday_indexed { |
| 125 | 125 | private: |
| 126 | chrono::weekday __wd; | |
| 127 | unsigned char __idx; | |
| 126 | chrono::weekday __wd_; | |
| 127 | unsigned char __idx_; | |
| 128 | 128 | public: |
| 129 | 129 | _LIBCPP_HIDE_FROM_ABI weekday_indexed() = default; |
| 130 | 130 | _LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed(const chrono::weekday& __wdval, unsigned __idxval) noexcept |
| 131 | : __wd{__wdval}, __idx(__idxval) {} | |
| 132 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd; } | |
| 133 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx; } | |
| 134 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd.ok() && __idx >= 1 && __idx <= 5; } | |
| 131 | : __wd_{__wdval}, __idx_(__idxval) {} | |
| 132 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd_; } | |
| 133 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx_; } | |
| 134 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_.ok() && __idx_ >= 1 && __idx_ <= 5; } | |
| 135 | 135 | }; |
| 136 | 136 | |
| 137 | 137 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| ... | ... | @@ -145,12 +145,12 @@ bool operator!=(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noex |
| 145 | 145 | |
| 146 | 146 | class weekday_last { |
| 147 | 147 | private: |
| 148 | chrono::weekday __wd; | |
| 148 | chrono::weekday __wd_; | |
| 149 | 149 | public: |
| 150 | 150 | _LIBCPP_HIDE_FROM_ABI explicit constexpr weekday_last(const chrono::weekday& __val) noexcept |
| 151 | : __wd{__val} {} | |
| 152 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd; } | |
| 153 | _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd.ok(); } | |
| 151 | : __wd_{__val} {} | |
| 152 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd_; } | |
| 153 | _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd_.ok(); } | |
| 154 | 154 | }; |
| 155 | 155 | |
| 156 | 156 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
lib/libcxx/include/__chrono/year.h+13-28| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | |
| 13 | 13 | #include <__chrono/duration.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <compare> | |
| 15 | 16 | #include <limits> |
| 16 | 17 | |
| 17 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -30,22 +31,22 @@ namespace chrono |
| 30 | 31 | |
| 31 | 32 | class year { |
| 32 | 33 | private: |
| 33 | short __y; | |
| 34 | short __y_; | |
| 34 | 35 | public: |
| 35 | 36 | _LIBCPP_HIDE_FROM_ABI year() = default; |
| 36 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr year(int __val) noexcept : __y(static_cast<short>(__val)) {} | |
| 37 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr year(int __val) noexcept : __y_(static_cast<short>(__val)) {} | |
| 37 | 38 | |
| 38 | _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator++() noexcept { ++__y; return *this; } | |
| 39 | _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator++() noexcept { ++__y_; return *this; } | |
| 39 | 40 | _LIBCPP_HIDE_FROM_ABI inline constexpr year operator++(int) noexcept { year __tmp = *this; ++(*this); return __tmp; } |
| 40 | _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator--() noexcept { --__y; return *this; } | |
| 41 | _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator--() noexcept { --__y_; return *this; } | |
| 41 | 42 | _LIBCPP_HIDE_FROM_ABI inline constexpr year operator--(int) noexcept { year __tmp = *this; --(*this); return __tmp; } |
| 42 | 43 | _LIBCPP_HIDE_FROM_ABI constexpr year& operator+=(const years& __dy) noexcept; |
| 43 | 44 | _LIBCPP_HIDE_FROM_ABI constexpr year& operator-=(const years& __dy) noexcept; |
| 44 | 45 | _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+() const noexcept { return *this; } |
| 45 | _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y}; } | |
| 46 | _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y_}; } | |
| 46 | 47 | |
| 47 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept { return __y % 4 == 0 && (__y % 100 != 0 || __y % 400 == 0); } | |
| 48 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator int() const noexcept { return __y; } | |
| 48 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept { return __y_ % 4 == 0 && (__y_ % 100 != 0 || __y_ % 400 == 0); } | |
| 49 | _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator int() const noexcept { return __y_; } | |
| 49 | 50 | _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept; |
| 50 | 51 | _LIBCPP_HIDE_FROM_ABI static inline constexpr year min() noexcept { return year{-32767}; } |
| 51 | 52 | _LIBCPP_HIDE_FROM_ABI static inline constexpr year max() noexcept { return year{ 32767}; } |
| ... | ... | @@ -56,25 +57,9 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 56 | 57 | bool operator==(const year& __lhs, const year& __rhs) noexcept |
| 57 | 58 | { return static_cast<int>(__lhs) == static_cast<int>(__rhs); } |
| 58 | 59 | |
| 59 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 60 | bool operator!=(const year& __lhs, const year& __rhs) noexcept | |
| 61 | { return !(__lhs == __rhs); } | |
| 62 | ||
| 63 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 64 | bool operator< (const year& __lhs, const year& __rhs) noexcept | |
| 65 | { return static_cast<int>(__lhs) < static_cast<int>(__rhs); } | |
| 66 | ||
| 67 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 68 | bool operator> (const year& __lhs, const year& __rhs) noexcept | |
| 69 | { return __rhs < __lhs; } | |
| 70 | ||
| 71 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 72 | bool operator<=(const year& __lhs, const year& __rhs) noexcept | |
| 73 | { return !(__rhs < __lhs); } | |
| 74 | ||
| 75 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 76 | bool operator>=(const year& __lhs, const year& __rhs) noexcept | |
| 77 | { return !(__lhs < __rhs); } | |
| 60 | _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const year& __lhs, const year& __rhs) noexcept { | |
| 61 | return static_cast<int>(__lhs) <=> static_cast<int>(__rhs); | |
| 62 | } | |
| 78 | 63 | |
| 79 | 64 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 80 | 65 | year operator+ (const year& __lhs, const years& __rhs) noexcept |
| ... | ... | @@ -102,8 +87,8 @@ year& year::operator-=(const years& __dy) noexcept |
| 102 | 87 | { *this = *this - __dy; return *this; } |
| 103 | 88 | |
| 104 | 89 | _LIBCPP_HIDE_FROM_ABI constexpr bool year::ok() const noexcept { |
| 105 | static_assert(static_cast<int>(std::numeric_limits<decltype(__y)>::max()) == static_cast<int>(max())); | |
| 106 | return static_cast<int>(min()) <= __y; | |
| 90 | static_assert(static_cast<int>(std::numeric_limits<decltype(__y_)>::max()) == static_cast<int>(max())); | |
| 91 | return static_cast<int>(min()) <= __y_; | |
| 107 | 92 | } |
| 108 | 93 | |
| 109 | 94 | } // namespace chrono |
lib/libcxx/include/__chrono/year_month.h+16-29| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | #include <__chrono/month.h> |
| 15 | 15 | #include <__chrono/year.h> |
| 16 | 16 | #include <__config> |
| 17 | #include <compare> | |
| 17 | 18 | |
| 18 | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 20 | # pragma GCC system_header |
| ... | ... | @@ -27,19 +28,19 @@ namespace chrono |
| 27 | 28 | { |
| 28 | 29 | |
| 29 | 30 | class year_month { |
| 30 | chrono::year __y; | |
| 31 | chrono::month __m; | |
| 31 | chrono::year __y_; | |
| 32 | chrono::month __m_; | |
| 32 | 33 | public: |
| 33 | 34 | _LIBCPP_HIDE_FROM_ABI year_month() = default; |
| 34 | 35 | _LIBCPP_HIDE_FROM_ABI constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept |
| 35 | : __y{__yval}, __m{__mval} {} | |
| 36 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y; } | |
| 37 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m; } | |
| 38 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const months& __dm) noexcept { this->__m += __dm; return *this; } | |
| 39 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const months& __dm) noexcept { this->__m -= __dm; return *this; } | |
| 40 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const years& __dy) noexcept { this->__y += __dy; return *this; } | |
| 41 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const years& __dy) noexcept { this->__y -= __dy; return *this; } | |
| 42 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y.ok() && __m.ok(); } | |
| 36 | : __y_{__yval}, __m_{__mval} {} | |
| 37 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } | |
| 38 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | |
| 39 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const months& __dm) noexcept { this->__m_ += __dm; return *this; } | |
| 40 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const months& __dm) noexcept { this->__m_ -= __dm; return *this; } | |
| 41 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const years& __dy) noexcept { this->__y_ += __dy; return *this; } | |
| 42 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const years& __dy) noexcept { this->__y_ -= __dy; return *this; } | |
| 43 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok(); } | |
| 43 | 44 | }; |
| 44 | 45 | |
| 45 | 46 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| ... | ... | @@ -52,25 +53,11 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 52 | 53 | bool operator==(const year_month& __lhs, const year_month& __rhs) noexcept |
| 53 | 54 | { return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month(); } |
| 54 | 55 | |
| 55 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 56 | bool operator!=(const year_month& __lhs, const year_month& __rhs) noexcept | |
| 57 | { return !(__lhs == __rhs); } | |
| 58 | ||
| 59 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 60 | bool operator< (const year_month& __lhs, const year_month& __rhs) noexcept | |
| 61 | { return __lhs.year() != __rhs.year() ? __lhs.year() < __rhs.year() : __lhs.month() < __rhs.month(); } | |
| 62 | ||
| 63 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 64 | bool operator> (const year_month& __lhs, const year_month& __rhs) noexcept | |
| 65 | { return __rhs < __lhs; } | |
| 66 | ||
| 67 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 68 | bool operator<=(const year_month& __lhs, const year_month& __rhs) noexcept | |
| 69 | { return !(__rhs < __lhs);} | |
| 70 | ||
| 71 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 72 | bool operator>=(const year_month& __lhs, const year_month& __rhs) noexcept | |
| 73 | { return !(__lhs < __rhs); } | |
| 56 | _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const year_month& __lhs, const year_month& __rhs) noexcept { | |
| 57 | if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0) | |
| 58 | return __c; | |
| 59 | return __lhs.month() <=> __rhs.month(); | |
| 60 | } | |
| 74 | 61 | |
| 75 | 62 | _LIBCPP_HIDE_FROM_ABI constexpr |
| 76 | 63 | year_month operator+(const year_month& __lhs, const months& __rhs) noexcept |
lib/libcxx/include/__chrono/year_month_day.h+29-45| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | #include <__chrono/year.h> |
| 21 | 21 | #include <__chrono/year_month.h> |
| 22 | 22 | #include <__config> |
| 23 | #include <compare> | |
| 23 | 24 | #include <limits> |
| 24 | 25 | |
| 25 | 26 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -37,14 +38,14 @@ class year_month_day_last; |
| 37 | 38 | |
| 38 | 39 | class year_month_day { |
| 39 | 40 | private: |
| 40 | chrono::year __y; | |
| 41 | chrono::month __m; | |
| 42 | chrono::day __d; | |
| 41 | chrono::year __y_; | |
| 42 | chrono::month __m_; | |
| 43 | chrono::day __d_; | |
| 43 | 44 | public: |
| 44 | 45 | _LIBCPP_HIDE_FROM_ABI year_month_day() = default; |
| 45 | 46 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day( |
| 46 | 47 | const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept |
| 47 | : __y{__yval}, __m{__mval}, __d{__dval} {} | |
| 48 | : __y_{__yval}, __m_{__mval}, __d_{__dval} {} | |
| 48 | 49 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day(const year_month_day_last& __ymdl) noexcept; |
| 49 | 50 | _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(const sys_days& __sysd) noexcept |
| 50 | 51 | : year_month_day(__from_days(__sysd.time_since_epoch())) {} |
| ... | ... | @@ -56,9 +57,9 @@ public: |
| 56 | 57 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const years& __dy) noexcept; |
| 57 | 58 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const years& __dy) noexcept; |
| 58 | 59 | |
| 59 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y; } | |
| 60 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m; } | |
| 61 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d; } | |
| 60 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } | |
| 61 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | |
| 62 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; } | |
| 62 | 63 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } |
| 63 | 64 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; } |
| 64 | 65 | |
| ... | ... | @@ -94,9 +95,9 @@ days year_month_day::__to_days() const noexcept |
| 94 | 95 | static_assert(numeric_limits<unsigned>::digits >= 18, ""); |
| 95 | 96 | static_assert(numeric_limits<int>::digits >= 20 , ""); |
| 96 | 97 | |
| 97 | const int __yr = static_cast<int>(__y) - (__m <= February); | |
| 98 | const unsigned __mth = static_cast<unsigned>(__m); | |
| 99 | const unsigned __dy = static_cast<unsigned>(__d); | |
| 98 | const int __yr = static_cast<int>(__y_) - (__m_ <= February); | |
| 99 | const unsigned __mth = static_cast<unsigned>(__m_); | |
| 100 | const unsigned __dy = static_cast<unsigned>(__d_); | |
| 100 | 101 | |
| 101 | 102 | const int __era = (__yr >= 0 ? __yr : __yr - 399) / 400; |
| 102 | 103 | const unsigned __yoe = static_cast<unsigned>(__yr - __era * 400); // [0, 399] |
| ... | ... | @@ -109,32 +110,15 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 109 | 110 | bool operator==(const year_month_day& __lhs, const year_month_day& __rhs) noexcept |
| 110 | 111 | { return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day(); } |
| 111 | 112 | |
| 112 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 113 | bool operator!=(const year_month_day& __lhs, const year_month_day& __rhs) noexcept | |
| 114 | { return !(__lhs == __rhs); } | |
| 115 | ||
| 116 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 117 | bool operator< (const year_month_day& __lhs, const year_month_day& __rhs) noexcept | |
| 118 | { | |
| 119 | if (__lhs.year() < __rhs.year()) return true; | |
| 120 | if (__lhs.year() > __rhs.year()) return false; | |
| 121 | if (__lhs.month() < __rhs.month()) return true; | |
| 122 | if (__lhs.month() > __rhs.month()) return false; | |
| 123 | return __lhs.day() < __rhs.day(); | |
| 113 | _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering | |
| 114 | operator<=>(const year_month_day& __lhs, const year_month_day& __rhs) noexcept { | |
| 115 | if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0) | |
| 116 | return __c; | |
| 117 | if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0) | |
| 118 | return __c; | |
| 119 | return __lhs.day() <=> __rhs.day(); | |
| 124 | 120 | } |
| 125 | 121 | |
| 126 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 127 | bool operator> (const year_month_day& __lhs, const year_month_day& __rhs) noexcept | |
| 128 | { return __rhs < __lhs; } | |
| 129 | ||
| 130 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 131 | bool operator<=(const year_month_day& __lhs, const year_month_day& __rhs) noexcept | |
| 132 | { return !(__rhs < __lhs);} | |
| 133 | ||
| 134 | _LIBCPP_HIDE_FROM_ABI inline constexpr | |
| 135 | bool operator>=(const year_month_day& __lhs, const year_month_day& __rhs) noexcept | |
| 136 | { return !(__lhs < __rhs); } | |
| 137 | ||
| 138 | 122 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 139 | 123 | year_month_day operator/(const year_month& __lhs, const day& __rhs) noexcept |
| 140 | 124 | { return year_month_day{__lhs.year(), __lhs.month(), __rhs}; } |
| ... | ... | @@ -191,24 +175,24 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator- |
| 191 | 175 | |
| 192 | 176 | class year_month_day_last { |
| 193 | 177 | private: |
| 194 | chrono::year __y; | |
| 195 | chrono::month_day_last __mdl; | |
| 178 | chrono::year __y_; | |
| 179 | chrono::month_day_last __mdl_; | |
| 196 | 180 | public: |
| 197 | 181 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last(const year& __yval, const month_day_last& __mdlval) noexcept |
| 198 | : __y{__yval}, __mdl{__mdlval} {} | |
| 182 | : __y_{__yval}, __mdl_{__mdlval} {} | |
| 199 | 183 | |
| 200 | 184 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const months& __m) noexcept; |
| 201 | 185 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const months& __m) noexcept; |
| 202 | 186 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const years& __y) noexcept; |
| 203 | 187 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const years& __y) noexcept; |
| 204 | 188 | |
| 205 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y; } | |
| 206 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl.month(); } | |
| 207 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept { return __mdl; } | |
| 189 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } | |
| 190 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl_.month(); } | |
| 191 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept { return __mdl_; } | |
| 208 | 192 | _LIBCPP_HIDE_FROM_ABI constexpr chrono::day day() const noexcept; |
| 209 | 193 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{year()/month()/day()}; } |
| 210 | 194 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{year()/month()/day()}; } |
| 211 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y.ok() && __mdl.ok(); } | |
| 195 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __mdl_.ok(); } | |
| 212 | 196 | }; |
| 213 | 197 | |
| 214 | 198 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| ... | ... | @@ -221,7 +205,7 @@ chrono::day year_month_day_last::day() const noexcept |
| 221 | 205 | chrono::day(31), chrono::day(31), chrono::day(30), |
| 222 | 206 | chrono::day(31), chrono::day(30), chrono::day(31) |
| 223 | 207 | }; |
| 224 | return (month() != February || !__y.is_leap()) && month().ok() ? | |
| 208 | return (month() != February || !__y_.is_leap()) && month().ok() ? | |
| 225 | 209 | __d[static_cast<unsigned>(month()) - 1] : chrono::day{29}; |
| 226 | 210 | } |
| 227 | 211 | |
| ... | ... | @@ -305,13 +289,13 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last& year_month_day_last: |
| 305 | 289 | |
| 306 | 290 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 307 | 291 | year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept |
| 308 | : __y{__ymdl.year()}, __m{__ymdl.month()}, __d{__ymdl.day()} {} | |
| 292 | : __y_{__ymdl.year()}, __m_{__ymdl.month()}, __d_{__ymdl.day()} {} | |
| 309 | 293 | |
| 310 | 294 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 311 | 295 | bool year_month_day::ok() const noexcept |
| 312 | 296 | { |
| 313 | if (!__y.ok() || !__m.ok()) return false; | |
| 314 | return chrono::day{1} <= __d && __d <= (__y / __m / last).day(); | |
| 297 | if (!__y_.ok() || !__m_.ok()) return false; | |
| 298 | return chrono::day{1} <= __d_ && __d_ <= (__y_ / __m_ / last).day(); | |
| 315 | 299 | } |
| 316 | 300 | |
| 317 | 301 | } // namespace chrono |
lib/libcxx/include/__chrono/year_month_weekday.h+28-28| ... | ... | @@ -35,14 +35,14 @@ namespace chrono |
| 35 | 35 | { |
| 36 | 36 | |
| 37 | 37 | class year_month_weekday { |
| 38 | chrono::year __y; | |
| 39 | chrono::month __m; | |
| 40 | chrono::weekday_indexed __wdi; | |
| 38 | chrono::year __y_; | |
| 39 | chrono::month __m_; | |
| 40 | chrono::weekday_indexed __wdi_; | |
| 41 | 41 | public: |
| 42 | 42 | _LIBCPP_HIDE_FROM_ABI year_month_weekday() = default; |
| 43 | 43 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(const chrono::year& __yval, const chrono::month& __mval, |
| 44 | 44 | const chrono::weekday_indexed& __wdival) noexcept |
| 45 | : __y{__yval}, __m{__mval}, __wdi{__wdival} {} | |
| 45 | : __y_{__yval}, __m_{__mval}, __wdi_{__wdival} {} | |
| 46 | 46 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(const sys_days& __sysd) noexcept |
| 47 | 47 | : year_month_weekday(__from_days(__sysd.time_since_epoch())) {} |
| 48 | 48 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_weekday(const local_days& __locd) noexcept |
| ... | ... | @@ -52,24 +52,24 @@ public: |
| 52 | 52 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const years&) noexcept; |
| 53 | 53 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const years&) noexcept; |
| 54 | 54 | |
| 55 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y; } | |
| 56 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m; } | |
| 57 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdi.weekday(); } | |
| 58 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi.index(); } | |
| 59 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi; } | |
| 55 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } | |
| 56 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | |
| 57 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdi_.weekday(); } | |
| 58 | _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi_.index(); } | |
| 59 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; } | |
| 60 | 60 | |
| 61 | 61 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } |
| 62 | 62 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; } |
| 63 | 63 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept |
| 64 | 64 | { |
| 65 | if (!__y.ok() || !__m.ok() || !__wdi.ok()) return false; | |
| 66 | if (__wdi.index() <= 4) return true; | |
| 65 | if (!__y_.ok() || !__m_.ok() || !__wdi_.ok()) return false; | |
| 66 | if (__wdi_.index() <= 4) return true; | |
| 67 | 67 | auto __nth_weekday_day = |
| 68 | __wdi.weekday() - | |
| 69 | chrono::weekday{static_cast<sys_days>(__y / __m / 1)} + | |
| 70 | days{(__wdi.index() - 1) * 7 + 1}; | |
| 68 | __wdi_.weekday() - | |
| 69 | chrono::weekday{static_cast<sys_days>(__y_ / __m_ / 1)} + | |
| 70 | days{(__wdi_.index() - 1) * 7 + 1}; | |
| 71 | 71 | return static_cast<unsigned>(__nth_weekday_day.count()) <= |
| 72 | static_cast<unsigned>((__y / __m / last).day()); | |
| 72 | static_cast<unsigned>((__y_ / __m_ / last).day()); | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | _LIBCPP_HIDE_FROM_ABI static constexpr year_month_weekday __from_days(days __d) noexcept; |
| ... | ... | @@ -89,8 +89,8 @@ year_month_weekday year_month_weekday::__from_days(days __d) noexcept |
| 89 | 89 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 90 | 90 | days year_month_weekday::__to_days() const noexcept |
| 91 | 91 | { |
| 92 | const sys_days __sysd = sys_days(__y/__m/1); | |
| 93 | return (__sysd + (__wdi.weekday() - chrono::weekday(__sysd) + days{(__wdi.index()-1)*7})) | |
| 92 | const sys_days __sysd = sys_days(__y_/__m_/1); | |
| 93 | return (__sysd + (__wdi_.weekday() - chrono::weekday(__sysd) + days{(__wdi_.index()-1)*7})) | |
| 94 | 94 | .time_since_epoch(); |
| 95 | 95 | } |
| 96 | 96 | |
| ... | ... | @@ -155,25 +155,25 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::o |
| 155 | 155 | |
| 156 | 156 | class year_month_weekday_last { |
| 157 | 157 | private: |
| 158 | chrono::year __y; | |
| 159 | chrono::month __m; | |
| 160 | chrono::weekday_last __wdl; | |
| 158 | chrono::year __y_; | |
| 159 | chrono::month __m_; | |
| 160 | chrono::weekday_last __wdl_; | |
| 161 | 161 | public: |
| 162 | 162 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last(const chrono::year& __yval, const chrono::month& __mval, |
| 163 | 163 | const chrono::weekday_last& __wdlval) noexcept |
| 164 | : __y{__yval}, __m{__mval}, __wdl{__wdlval} {} | |
| 164 | : __y_{__yval}, __m_{__mval}, __wdl_{__wdlval} {} | |
| 165 | 165 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const months& __dm) noexcept; |
| 166 | 166 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const months& __dm) noexcept; |
| 167 | 167 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept; |
| 168 | 168 | _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept; |
| 169 | 169 | |
| 170 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y; } | |
| 171 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m; } | |
| 172 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdl.weekday(); } | |
| 173 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl; } | |
| 170 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; } | |
| 171 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } | |
| 172 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdl_.weekday(); } | |
| 173 | _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; } | |
| 174 | 174 | _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } |
| 175 | 175 | _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; } |
| 176 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y.ok() && __m.ok() && __wdl.ok(); } | |
| 176 | _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok() && __wdl_.ok(); } | |
| 177 | 177 | |
| 178 | 178 | _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept; |
| 179 | 179 | |
| ... | ... | @@ -182,8 +182,8 @@ public: |
| 182 | 182 | _LIBCPP_HIDE_FROM_ABI inline constexpr |
| 183 | 183 | days year_month_weekday_last::__to_days() const noexcept |
| 184 | 184 | { |
| 185 | const sys_days __last = sys_days{__y/__m/last}; | |
| 186 | return (__last - (chrono::weekday{__last} - __wdl.weekday())).time_since_epoch(); | |
| 185 | const sys_days __last = sys_days{__y_/__m_/last}; | |
| 186 | return (__last - (chrono::weekday{__last} - __wdl_.weekday())).time_since_epoch(); | |
| 187 | 187 | |
| 188 | 188 | } |
| 189 | 189 |
lib/libcxx/include/__compare/common_comparison_category.h+3-2| ... | ... | @@ -11,7 +11,8 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__compare/ordering.h> |
| 13 | 13 | #include <__config> |
| 14 | #include <type_traits> | |
| 14 | #include <__type_traits/is_same.h> | |
| 15 | #include <cstddef> | |
| 15 | 16 | |
| 16 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 18 | # pragma GCC system_header |
| ... | ... | @@ -64,7 +65,7 @@ _LIBCPP_HIDE_FROM_ABI |
| 64 | 65 | constexpr auto __get_comp_type() { |
| 65 | 66 | using _CCC = _ClassifyCompCategory; |
| 66 | 67 | constexpr _CCC __type_kinds[] = {_StrongOrd, __type_to_enum<_Ts>()...}; |
| 67 | constexpr _CCC _Cat = __compute_comp_type(__type_kinds); | |
| 68 | constexpr _CCC _Cat = __comp_detail::__compute_comp_type(__type_kinds); | |
| 68 | 69 | if constexpr (_Cat == _None) |
| 69 | 70 | return void(); |
| 70 | 71 | else if constexpr (_Cat == _PartialOrd) |
lib/libcxx/include/__compare/compare_partial_order_fallback.h+2-1| ... | ... | @@ -12,9 +12,10 @@ |
| 12 | 12 | #include <__compare/ordering.h> |
| 13 | 13 | #include <__compare/partial_order.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <__type_traits/decay.h> | |
| 16 | #include <__type_traits/is_same.h> | |
| 15 | 17 | #include <__utility/forward.h> |
| 16 | 18 | #include <__utility/priority_tag.h> |
| 17 | #include <type_traits> | |
| 18 | 19 | |
| 19 | 20 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
| 20 | 21 | # pragma GCC system_header |
lib/libcxx/include/__compare/compare_strong_order_fallback.h+2-1| ... | ... | @@ -12,9 +12,10 @@ |
| 12 | 12 | #include <__compare/ordering.h> |
| 13 | 13 | #include <__compare/strong_order.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <__type_traits/decay.h> | |
| 16 | #include <__type_traits/is_same.h> | |
| 15 | 17 | #include <__utility/forward.h> |
| 16 | 18 | #include <__utility/priority_tag.h> |
| 17 | #include <type_traits> | |
| 18 | 19 | |
| 19 | 20 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
| 20 | 21 | # pragma GCC system_header |
lib/libcxx/include/__compare/compare_three_way_result.h+4-3| ... | ... | @@ -10,7 +10,8 @@ |
| 10 | 10 | #define _LIBCPP___COMPARE_COMPARE_THREE_WAY_RESULT_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <type_traits> | |
| 13 | #include <__type_traits/make_const_lvalue_ref.h> | |
| 14 | #include <__utility/declval.h> | |
| 14 | 15 | |
| 15 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 17 | # pragma GCC system_header |
| ... | ... | @@ -25,9 +26,9 @@ struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result { }; |
| 25 | 26 | |
| 26 | 27 | template<class _Tp, class _Up> |
| 27 | 28 | struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result<_Tp, _Up, decltype( |
| 28 | declval<__make_const_lvalue_ref<_Tp>>() <=> declval<__make_const_lvalue_ref<_Up>>(), void() | |
| 29 | std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>(), void() | |
| 29 | 30 | )> { |
| 30 | using type = decltype(declval<__make_const_lvalue_ref<_Tp>>() <=> declval<__make_const_lvalue_ref<_Up>>()); | |
| 31 | using type = decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>()); | |
| 31 | 32 | }; |
| 32 | 33 | |
| 33 | 34 | template<class _Tp, class _Up = _Tp> |
lib/libcxx/include/__compare/compare_weak_order_fallback.h+2-1| ... | ... | @@ -12,9 +12,10 @@ |
| 12 | 12 | #include <__compare/ordering.h> |
| 13 | 13 | #include <__compare/weak_order.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <__type_traits/decay.h> | |
| 16 | #include <__type_traits/is_same.h> | |
| 15 | 17 | #include <__utility/forward.h> |
| 16 | 18 | #include <__utility/priority_tag.h> |
| 17 | #include <type_traits> | |
| 18 | 19 | |
| 19 | 20 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
| 20 | 21 | # pragma GCC system_header |
lib/libcxx/include/__compare/ordering.h+8-1| ... | ... | @@ -10,7 +10,8 @@ |
| 10 | 10 | #define _LIBCPP___COMPARE_ORDERING_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <type_traits> | |
| 13 | #include <__type_traits/enable_if.h> | |
| 14 | #include <__type_traits/is_same.h> | |
| 14 | 15 | |
| 15 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 17 | # pragma GCC system_header |
| ... | ... | @@ -312,6 +313,12 @@ inline constexpr strong_ordering strong_ordering::equal(_OrdResult::__equiv); |
| 312 | 313 | inline constexpr strong_ordering strong_ordering::equivalent(_OrdResult::__equiv); |
| 313 | 314 | inline constexpr strong_ordering strong_ordering::greater(_OrdResult::__greater); |
| 314 | 315 | |
| 316 | /// [cmp.categories.pre]/1 | |
| 317 | /// The types partial_ordering, weak_ordering, and strong_ordering are | |
| 318 | /// collectively termed the comparison category types. | |
| 319 | template <class _Tp> | |
| 320 | concept __comparison_category = __one_of_v<_Tp, partial_ordering, weak_ordering, strong_ordering>; | |
| 321 | ||
| 315 | 322 | #endif // _LIBCPP_STD_VER > 17 |
| 316 | 323 | |
| 317 | 324 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__compare/partial_order.h+4-1| ... | ... | @@ -13,9 +13,10 @@ |
| 13 | 13 | #include <__compare/ordering.h> |
| 14 | 14 | #include <__compare/weak_order.h> |
| 15 | 15 | #include <__config> |
| 16 | #include <__type_traits/decay.h> | |
| 17 | #include <__type_traits/is_same.h> | |
| 16 | 18 | #include <__utility/forward.h> |
| 17 | 19 | #include <__utility/priority_tag.h> |
| 18 | #include <type_traits> | |
| 19 | 20 | |
| 20 | 21 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
| 21 | 22 | # pragma GCC system_header |
| ... | ... | @@ -28,6 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 29 | // [cmp.alg] |
| 29 | 30 | namespace __partial_order { |
| 30 | 31 | struct __fn { |
| 32 | // NOLINTBEGIN(libcpp-robust-against-adl) partial_order should use ADL, but only here | |
| 31 | 33 | template<class _Tp, class _Up> |
| 32 | 34 | requires is_same_v<decay_t<_Tp>, decay_t<_Up>> |
| 33 | 35 | _LIBCPP_HIDE_FROM_ABI static constexpr auto |
| ... | ... | @@ -35,6 +37,7 @@ namespace __partial_order { |
| 35 | 37 | noexcept(noexcept(partial_ordering(partial_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))))) |
| 36 | 38 | -> decltype( partial_ordering(partial_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))) |
| 37 | 39 | { return partial_ordering(partial_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))); } |
| 40 | // NOLINTEND(libcpp-robust-against-adl) | |
| 38 | 41 | |
| 39 | 42 | template<class _Tp, class _Up> |
| 40 | 43 | requires is_same_v<decay_t<_Tp>, decay_t<_Up>> |
lib/libcxx/include/__compare/strong_order.h+4-1| ... | ... | @@ -13,12 +13,13 @@ |
| 13 | 13 | #include <__compare/compare_three_way.h> |
| 14 | 14 | #include <__compare/ordering.h> |
| 15 | 15 | #include <__config> |
| 16 | #include <__type_traits/conditional.h> | |
| 17 | #include <__type_traits/decay.h> | |
| 16 | 18 | #include <__utility/forward.h> |
| 17 | 19 | #include <__utility/priority_tag.h> |
| 18 | 20 | #include <cmath> |
| 19 | 21 | #include <cstdint> |
| 20 | 22 | #include <limits> |
| 21 | #include <type_traits> | |
| 22 | 23 | |
| 23 | 24 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
| 24 | 25 | # pragma GCC system_header |
| ... | ... | @@ -34,6 +35,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 34 | 35 | // [cmp.alg] |
| 35 | 36 | namespace __strong_order { |
| 36 | 37 | struct __fn { |
| 38 | // NOLINTBEGIN(libcpp-robust-against-adl) strong_order should use ADL, but only here | |
| 37 | 39 | template<class _Tp, class _Up> |
| 38 | 40 | requires is_same_v<decay_t<_Tp>, decay_t<_Up>> |
| 39 | 41 | _LIBCPP_HIDE_FROM_ABI static constexpr auto |
| ... | ... | @@ -41,6 +43,7 @@ namespace __strong_order { |
| 41 | 43 | noexcept(noexcept(strong_ordering(strong_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))))) |
| 42 | 44 | -> decltype( strong_ordering(strong_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))) |
| 43 | 45 | { return strong_ordering(strong_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))); } |
| 46 | // NOLINTEND(libcpp-robust-against-adl) | |
| 44 | 47 | |
| 45 | 48 | template<class _Tp, class _Up, class _Dp = decay_t<_Tp>> |
| 46 | 49 | requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp> |
lib/libcxx/include/__compare/synth_three_way.h+1-1| ... | ... | @@ -42,7 +42,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way = |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | 44 | template <class _Tp, class _Up = _Tp> |
| 45 | using __synth_three_way_result = decltype(std::__synth_three_way(declval<_Tp&>(), declval<_Up&>())); | |
| 45 | using __synth_three_way_result = decltype(std::__synth_three_way(std::declval<_Tp&>(), std::declval<_Up&>())); | |
| 46 | 46 | |
| 47 | 47 | #endif // _LIBCPP_STD_VER > 17 |
| 48 | 48 |
lib/libcxx/include/__compare/three_way_comparable.h+2-1| ... | ... | @@ -16,7 +16,8 @@ |
| 16 | 16 | #include <__concepts/same_as.h> |
| 17 | 17 | #include <__concepts/totally_ordered.h> |
| 18 | 18 | #include <__config> |
| 19 | #include <type_traits> | |
| 19 | #include <__type_traits/common_reference.h> | |
| 20 | #include <__type_traits/make_const_lvalue_ref.h> | |
| 20 | 21 | |
| 21 | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 22 | 23 | # pragma GCC system_header |
lib/libcxx/include/__compare/weak_order.h+3-1| ... | ... | @@ -13,10 +13,10 @@ |
| 13 | 13 | #include <__compare/ordering.h> |
| 14 | 14 | #include <__compare/strong_order.h> |
| 15 | 15 | #include <__config> |
| 16 | #include <__type_traits/decay.h> | |
| 16 | 17 | #include <__utility/forward.h> |
| 17 | 18 | #include <__utility/priority_tag.h> |
| 18 | 19 | #include <cmath> |
| 19 | #include <type_traits> | |
| 20 | 20 | |
| 21 | 21 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
| 22 | 22 | # pragma GCC system_header |
| ... | ... | @@ -29,6 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | // [cmp.alg] |
| 30 | 30 | namespace __weak_order { |
| 31 | 31 | struct __fn { |
| 32 | // NOLINTBEGIN(libcpp-robust-against-adl) weak_order should use ADL, but only here | |
| 32 | 33 | template<class _Tp, class _Up> |
| 33 | 34 | requires is_same_v<decay_t<_Tp>, decay_t<_Up>> |
| 34 | 35 | _LIBCPP_HIDE_FROM_ABI static constexpr auto |
| ... | ... | @@ -36,6 +37,7 @@ namespace __weak_order { |
| 36 | 37 | noexcept(noexcept(weak_ordering(weak_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))))) |
| 37 | 38 | -> decltype( weak_ordering(weak_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))) |
| 38 | 39 | { return weak_ordering(weak_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))); } |
| 40 | // NOLINTEND(libcpp-robust-against-adl) | |
| 39 | 41 | |
| 40 | 42 | template<class _Tp, class _Up, class _Dp = decay_t<_Tp>> |
| 41 | 43 | requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp> |
lib/libcxx/include/__concepts/arithmetic.h+3-1| ... | ... | @@ -10,9 +10,11 @@ |
| 10 | 10 | #define _LIBCPP___CONCEPTS_ARITHMETIC_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/is_floating_point.h> | |
| 14 | #include <__type_traits/is_integral.h> | |
| 15 | #include <__type_traits/is_signed.h> | |
| 13 | 16 | #include <__type_traits/is_signed_integer.h> |
| 14 | 17 | #include <__type_traits/is_unsigned_integer.h> |
| 15 | #include <type_traits> | |
| 16 | 18 | |
| 17 | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 20 | # pragma GCC system_header |
lib/libcxx/include/__concepts/assignable.h+2-1| ... | ... | @@ -12,8 +12,9 @@ |
| 12 | 12 | #include <__concepts/common_reference_with.h> |
| 13 | 13 | #include <__concepts/same_as.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <__type_traits/is_reference.h> | |
| 16 | #include <__type_traits/make_const_lvalue_ref.h> | |
| 15 | 17 | #include <__utility/forward.h> |
| 16 | #include <type_traits> | |
| 17 | 18 | |
| 18 | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 20 | # pragma GCC system_header |
lib/libcxx/include/__concepts/class_or_enum.h+5-2| ... | ... | @@ -10,7 +10,10 @@ |
| 10 | 10 | #define _LIBCPP___CONCEPTS_CLASS_OR_ENUM_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <type_traits> | |
| 13 | #include <__type_traits/is_class.h> | |
| 14 | #include <__type_traits/is_enum.h> | |
| 15 | #include <__type_traits/is_union.h> | |
| 16 | #include <__type_traits/remove_cvref.h> | |
| 14 | 17 | |
| 15 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 19 | # pragma GCC system_header |
| ... | ... | @@ -28,7 +31,7 @@ concept __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>; |
| 28 | 31 | // Work around Clang bug https://llvm.org/PR52970 |
| 29 | 32 | // TODO: remove this workaround once libc++ no longer has to support Clang 13 (it was fixed in Clang 14). |
| 30 | 33 | template<class _Tp> |
| 31 | concept __workaround_52970 = is_class_v<__uncvref_t<_Tp>> || is_union_v<__uncvref_t<_Tp>>; | |
| 34 | concept __workaround_52970 = is_class_v<__remove_cvref_t<_Tp>> || is_union_v<__remove_cvref_t<_Tp>>; | |
| 32 | 35 | |
| 33 | 36 | #endif // _LIBCPP_STD_VER > 17 |
| 34 | 37 |
lib/libcxx/include/__concepts/common_reference_with.h+1-1| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | #include <__concepts/convertible_to.h> |
| 13 | 13 | #include <__concepts/same_as.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <type_traits> | |
| 15 | #include <__type_traits/common_reference.h> | |
| 16 | 16 | |
| 17 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 18 | # pragma GCC system_header |
lib/libcxx/include/__concepts/common_with.h+6-3| ... | ... | @@ -12,7 +12,10 @@ |
| 12 | 12 | #include <__concepts/common_reference_with.h> |
| 13 | 13 | #include <__concepts/same_as.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <type_traits> | |
| 15 | #include <__type_traits/add_lvalue_reference.h> | |
| 16 | #include <__type_traits/common_reference.h> | |
| 17 | #include <__type_traits/common_type.h> | |
| 18 | #include <__utility/declval.h> | |
| 16 | 19 | |
| 17 | 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 21 | # pragma GCC system_header |
| ... | ... | @@ -28,8 +31,8 @@ template<class _Tp, class _Up> |
| 28 | 31 | concept common_with = |
| 29 | 32 | same_as<common_type_t<_Tp, _Up>, common_type_t<_Up, _Tp>> && |
| 30 | 33 | requires { |
| 31 | static_cast<common_type_t<_Tp, _Up>>(declval<_Tp>()); | |
| 32 | static_cast<common_type_t<_Tp, _Up>>(declval<_Up>()); | |
| 34 | static_cast<common_type_t<_Tp, _Up>>(std::declval<_Tp>()); | |
| 35 | static_cast<common_type_t<_Tp, _Up>>(std::declval<_Up>()); | |
| 33 | 36 | } && |
| 34 | 37 | common_reference_with< |
| 35 | 38 | add_lvalue_reference_t<const _Tp>, |
lib/libcxx/include/__concepts/constructible.h+1-1| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | #include <__concepts/convertible_to.h> |
| 13 | 13 | #include <__concepts/destructible.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <type_traits> | |
| 15 | #include <__type_traits/is_constructible.h> | |
| 16 | 16 | |
| 17 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 18 | # pragma GCC system_header |
lib/libcxx/include/__concepts/convertible_to.h+2-2| ... | ... | @@ -10,8 +10,8 @@ |
| 10 | 10 | #define _LIBCPP___CONCEPTS_CONVERTIBLE_TO_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/is_convertible.h> | |
| 13 | 14 | #include <__utility/declval.h> |
| 14 | #include <type_traits> | |
| 15 | 15 | |
| 16 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 17 | # pragma GCC system_header |
| ... | ... | @@ -27,7 +27,7 @@ template<class _From, class _To> |
| 27 | 27 | concept convertible_to = |
| 28 | 28 | is_convertible_v<_From, _To> && |
| 29 | 29 | requires { |
| 30 | static_cast<_To>(declval<_From>()); | |
| 30 | static_cast<_To>(std::declval<_From>()); | |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | 33 | #endif // _LIBCPP_STD_VER > 17 |
lib/libcxx/include/__concepts/derived_from.h+2-1| ... | ... | @@ -10,7 +10,8 @@ |
| 10 | 10 | #define _LIBCPP___CONCEPTS_DERIVED_FROM_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <type_traits> | |
| 13 | #include <__type_traits/is_base_of.h> | |
| 14 | #include <__type_traits/is_convertible.h> | |
| 14 | 15 | |
| 15 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 17 | # pragma GCC system_header |
lib/libcxx/include/__concepts/destructible.h+1-1| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | #define _LIBCPP___CONCEPTS_DESTRUCTIBLE_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <type_traits> | |
| 13 | #include <__type_traits/is_nothrow_destructible.h> | |
| 14 | 14 | |
| 15 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 16 | # pragma GCC system_header |
lib/libcxx/include/__concepts/different_from.h+1-1| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__concepts/same_as.h> |
| 13 | 13 | #include <__config> |
| 14 | #include <type_traits> | |
| 14 | #include <__type_traits/remove_cvref.h> | |
| 15 | 15 | |
| 16 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 17 | # pragma GCC system_header |
lib/libcxx/include/__concepts/equality_comparable.h+2-1| ... | ... | @@ -12,7 +12,8 @@ |
| 12 | 12 | #include <__concepts/boolean_testable.h> |
| 13 | 13 | #include <__concepts/common_reference_with.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <type_traits> | |
| 15 | #include <__type_traits/common_reference.h> | |
| 16 | #include <__type_traits/make_const_lvalue_ref.h> | |
| 16 | 17 | |
| 17 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 19 | # pragma GCC system_header |
lib/libcxx/include/__concepts/invocable.h-1| ... | ... | @@ -12,7 +12,6 @@ |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__functional/invoke.h> |
| 14 | 14 | #include <__utility/forward.h> |
| 15 | #include <type_traits> | |
| 16 | 15 | |
| 17 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 17 | # pragma GCC system_header |
lib/libcxx/include/__concepts/movable.h+1-1| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | #include <__concepts/constructible.h> |
| 14 | 14 | #include <__concepts/swappable.h> |
| 15 | 15 | #include <__config> |
| 16 | #include <type_traits> | |
| 16 | #include <__type_traits/is_object.h> | |
| 17 | 17 | |
| 18 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 19 | # pragma GCC system_header |
lib/libcxx/include/__concepts/predicate.h+1-1| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | #include <__concepts/boolean_testable.h> |
| 13 | 13 | #include <__concepts/invocable.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <type_traits> | |
| 15 | #include <__functional/invoke.h> | |
| 16 | 16 | |
| 17 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 18 | # pragma GCC system_header |
lib/libcxx/include/__concepts/same_as.h+1-1| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | #define _LIBCPP___CONCEPTS_SAME_AS_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <type_traits> | |
| 13 | #include <__type_traits/is_same.h> | |
| 14 | 14 | |
| 15 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 16 | # pragma GCC system_header |
lib/libcxx/include/__concepts/swappable.h+6-1| ... | ... | @@ -14,10 +14,15 @@ |
| 14 | 14 | #include <__concepts/common_reference_with.h> |
| 15 | 15 | #include <__concepts/constructible.h> |
| 16 | 16 | #include <__config> |
| 17 | #include <__type_traits/extent.h> | |
| 18 | #include <__type_traits/is_nothrow_move_assignable.h> | |
| 19 | #include <__type_traits/is_nothrow_move_constructible.h> | |
| 20 | #include <__type_traits/remove_cvref.h> | |
| 17 | 21 | #include <__utility/exchange.h> |
| 18 | 22 | #include <__utility/forward.h> |
| 19 | 23 | #include <__utility/move.h> |
| 20 | #include <type_traits> | |
| 24 | #include <__utility/swap.h> | |
| 25 | #include <cstddef> | |
| 21 | 26 | |
| 22 | 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | 28 | # pragma GCC system_header |
lib/libcxx/include/__concepts/totally_ordered.h+2-1| ... | ... | @@ -12,7 +12,8 @@ |
| 12 | 12 | #include <__concepts/boolean_testable.h> |
| 13 | 13 | #include <__concepts/equality_comparable.h> |
| 14 | 14 | #include <__config> |
| 15 | #include <type_traits> | |
| 15 | #include <__type_traits/common_reference.h> | |
| 16 | #include <__type_traits/make_const_lvalue_ref.h> | |
| 16 | 17 | |
| 17 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 19 | # pragma GCC system_header |
lib/libcxx/include/__config+114-93| ... | ... | @@ -10,6 +10,8 @@ |
| 10 | 10 | #ifndef _LIBCPP___CONFIG |
| 11 | 11 | #define _LIBCPP___CONFIG |
| 12 | 12 | |
| 13 | #include <__config_site> | |
| 14 | ||
| 13 | 15 | #if defined(_MSC_VER) && !defined(__clang__) |
| 14 | 16 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 15 | 17 | # define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
| ... | ... | @@ -28,13 +30,14 @@ |
| 28 | 30 | # define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) |
| 29 | 31 | #elif defined(__GNUC__) |
| 30 | 32 | # define _LIBCPP_COMPILER_GCC |
| 31 | #elif defined(_MSC_VER) | |
| 32 | # define _LIBCPP_COMPILER_MSVC | |
| 33 | 33 | #endif |
| 34 | 34 | |
| 35 | 35 | #ifdef __cplusplus |
| 36 | 36 | |
| 37 | # define _LIBCPP_VERSION 15003 | |
| 37 | // _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM. | |
| 38 | // Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 16.0.1 == 16.00.01), _LIBCPP_VERSION is | |
| 39 | // defined to XXYYZZ. | |
| 40 | # define _LIBCPP_VERSION 160000 | |
| 38 | 41 | |
| 39 | 42 | # define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y |
| 40 | 43 | # define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) |
| ... | ... | @@ -57,7 +60,8 @@ |
| 57 | 60 | # elif __cplusplus <= 202002L |
| 58 | 61 | # define _LIBCPP_STD_VER 20 |
| 59 | 62 | # else |
| 60 | # define _LIBCPP_STD_VER 22 // current year, or date of c++2b ratification | |
| 63 | // Expected release year of the next C++ standard | |
| 64 | # define _LIBCPP_STD_VER 23 | |
| 61 | 65 | # endif |
| 62 | 66 | # endif // _LIBCPP_STD_VER |
| 63 | 67 | |
| ... | ... | @@ -148,7 +152,7 @@ |
| 148 | 152 | # endif |
| 149 | 153 | // Feature macros for disabling pre ABI v1 features. All of these options |
| 150 | 154 | // are deprecated. |
| 151 | # if defined(__FreeBSD__) || defined(__DragonFly__) | |
| 155 | # if defined(__FreeBSD__) | |
| 152 | 156 | # define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR |
| 153 | 157 | # endif |
| 154 | 158 | # endif |
| ... | ... | @@ -165,7 +169,7 @@ |
| 165 | 169 | # define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION |
| 166 | 170 | # endif |
| 167 | 171 | |
| 168 | # define _LIBCPP_TOSTRING2(x) # x | |
| 172 | # define _LIBCPP_TOSTRING2(x) #x | |
| 169 | 173 | # define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) |
| 170 | 174 | |
| 171 | 175 | # if __cplusplus < 201103L |
| ... | ... | @@ -192,6 +196,10 @@ |
| 192 | 196 | # define __has_cpp_attribute(__x) 0 |
| 193 | 197 | # endif |
| 194 | 198 | |
| 199 | # ifndef __has_constexpr_builtin | |
| 200 | # define __has_constexpr_builtin(x) 0 | |
| 201 | # endif | |
| 202 | ||
| 195 | 203 | // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by |
| 196 | 204 | // the compiler and '1' otherwise. |
| 197 | 205 | # ifndef __is_identifier |
| ... | ... | @@ -212,12 +220,6 @@ |
| 212 | 220 | # error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11" |
| 213 | 221 | # endif |
| 214 | 222 | |
| 215 | # ifdef _LIBCPP_COMPILER_MSVC | |
| 216 | # error If you successfully use libc++ with MSVC please tell the libc++ developers and consider upstreaming your \ | |
| 217 | changes. We are not aware of anybody using this configuration and know that at least some code is currently broken. \ | |
| 218 | If there are users of this configuration we are happy to provide support. | |
| 219 | # endif | |
| 220 | ||
| 221 | 223 | // FIXME: ABI detection should be done via compiler builtin macros. This |
| 222 | 224 | // is just a placeholder until Clang implements such macros. For now assume |
| 223 | 225 | // that Windows compilers pretending to be MSVC++ target the Microsoft ABI, |
| ... | ... | @@ -251,7 +253,6 @@ If there are users of this configuration we are happy to provide support. |
| 251 | 253 | // easier to grep for target specific flags once the feature is complete. |
| 252 | 254 | # if !defined(_LIBCPP_ENABLE_EXPERIMENTAL) && !defined(_LIBCPP_BUILDING_LIBRARY) |
| 253 | 255 | # define _LIBCPP_HAS_NO_INCOMPLETE_FORMAT |
| 254 | # define _LIBCPP_HAS_NO_INCOMPLETE_RANGES | |
| 255 | 256 | # endif |
| 256 | 257 | |
| 257 | 258 | // Need to detect which libc we're using if we're on Linux. |
| ... | ... | @@ -416,17 +417,21 @@ If there are users of this configuration we are happy to provide support. |
| 416 | 417 | # define _LIBCPP_NORETURN [[noreturn]] |
| 417 | 418 | # define _NOEXCEPT noexcept |
| 418 | 419 | # define _NOEXCEPT_(x) noexcept(x) |
| 420 | # define _LIBCPP_CONSTEXPR constexpr | |
| 419 | 421 | |
| 420 | 422 | # else |
| 421 | 423 | |
| 422 | 424 | # define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp) |
| 423 | 425 | # define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) |
| 424 | 426 | # define _ALIGNAS(x) __attribute__((__aligned__(x))) |
| 425 | # define _LIBCPP_NORETURN __attribute__((noreturn)) | |
| 427 | # define _LIBCPP_NORETURN __attribute__((__noreturn__)) | |
| 426 | 428 | # define _LIBCPP_HAS_NO_NOEXCEPT |
| 427 | 429 | # define nullptr __nullptr |
| 428 | 430 | # define _NOEXCEPT throw() |
| 429 | 431 | # define _NOEXCEPT_(x) |
| 432 | # define static_assert(...) _Static_assert(__VA_ARGS__) | |
| 433 | # define decltype(...) __decltype(__VA_ARGS__) | |
| 434 | # define _LIBCPP_CONSTEXPR | |
| 430 | 435 | |
| 431 | 436 | typedef __char16_t char16_t; |
| 432 | 437 | typedef __char32_t char32_t; |
| ... | ... | @@ -485,27 +490,7 @@ typedef __char32_t char32_t; |
| 485 | 490 | |
| 486 | 491 | # define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ |
| 487 | 492 | |
| 488 | # elif defined(_LIBCPP_COMPILER_MSVC) | |
| 489 | ||
| 490 | # define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) | |
| 491 | ||
| 492 | # if _MSC_VER < 1900 | |
| 493 | # error "MSVC versions prior to Visual Studio 2015 are not supported" | |
| 494 | # endif | |
| 495 | ||
| 496 | # define _LIBCPP_NORETURN __declspec(noreturn) | |
| 497 | ||
| 498 | # define _LIBCPP_WEAK | |
| 499 | ||
| 500 | # define _LIBCPP_HAS_NO_ASAN | |
| 501 | ||
| 502 | # define _LIBCPP_ALWAYS_INLINE __forceinline | |
| 503 | ||
| 504 | # define _LIBCPP_HAS_NO_VECTOR_EXTENSION | |
| 505 | ||
| 506 | # define _LIBCPP_DISABLE_EXTENSION_WARNING | |
| 507 | ||
| 508 | # endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC] | |
| 493 | # endif // _LIBCPP_COMPILER_[CLANG|GCC] | |
| 509 | 494 | |
| 510 | 495 | # if defined(_LIBCPP_OBJECT_FORMAT_COFF) |
| 511 | 496 | |
| ... | ... | @@ -625,6 +610,15 @@ typedef __char32_t char32_t; |
| 625 | 610 | // Note that we use _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION to ensure that we don't depend |
| 626 | 611 | // on _LIBCPP_HIDE_FROM_ABI methods of classes explicitly instantiated in the dynamic library. |
| 627 | 612 | // |
| 613 | // Also note that the _LIBCPP_HIDE_FROM_ABI_VIRTUAL macro should be used on virtual functions | |
| 614 | // instead of _LIBCPP_HIDE_FROM_ABI. That macro does not use an ABI tag. Indeed, the mangled | |
| 615 | // name of a virtual function is part of its ABI, since some architectures like arm64e can sign | |
| 616 | // the virtual function pointer in the vtable based on the mangled name of the function. Since | |
| 617 | // we use an ABI tag that changes with each released version, the mangled name of the virtual | |
| 618 | // function would change, which is incorrect. Note that it doesn't make much sense to change | |
| 619 | // the implementation of a virtual function in an ABI-incompatible way in the first place, | |
| 620 | // since that would be an ABI break anyway. Hence, the lack of ABI tag should not be noticeable. | |
| 621 | // | |
| 628 | 622 | // TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing |
| 629 | 623 | // the length of symbols with an ABI tag. In practice, we should remove the escape hatch and |
| 630 | 624 | // use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70. |
| ... | ... | @@ -635,6 +629,7 @@ typedef __char32_t char32_t; |
| 635 | 629 | # else |
| 636 | 630 | # define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION |
| 637 | 631 | # endif |
| 632 | # define _LIBCPP_HIDE_FROM_ABI_VIRTUAL _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION | |
| 638 | 633 | |
| 639 | 634 | # ifdef _LIBCPP_BUILDING_LIBRARY |
| 640 | 635 | # if _LIBCPP_ABI_VERSION > 1 |
| ... | ... | @@ -678,31 +673,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 678 | 673 | # define _LIBCPP_HAS_NO_INT128 |
| 679 | 674 | # endif |
| 680 | 675 | |
| 681 | # ifdef _LIBCPP_CXX03_LANG | |
| 682 | # define static_assert(...) _Static_assert(__VA_ARGS__) | |
| 683 | # define decltype(...) __decltype(__VA_ARGS__) | |
| 684 | # endif // _LIBCPP_CXX03_LANG | |
| 685 | ||
| 686 | # ifdef _LIBCPP_CXX03_LANG | |
| 687 | # define _LIBCPP_CONSTEXPR | |
| 688 | # else | |
| 689 | # define _LIBCPP_CONSTEXPR constexpr | |
| 690 | # endif | |
| 691 | ||
| 692 | 676 | # ifndef __cpp_consteval |
| 693 | 677 | # define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR |
| 694 | 678 | # else |
| 695 | 679 | # define _LIBCPP_CONSTEVAL consteval |
| 696 | 680 | # endif |
| 697 | 681 | |
| 698 | # ifdef __GNUC__ | |
| 682 | # if __has_attribute(__malloc__) | |
| 699 | 683 | # define _LIBCPP_NOALIAS __attribute__((__malloc__)) |
| 700 | 684 | # else |
| 701 | 685 | # define _LIBCPP_NOALIAS |
| 702 | 686 | # endif |
| 703 | 687 | |
| 704 | # if __has_attribute(using_if_exists) | |
| 705 | # define _LIBCPP_USING_IF_EXISTS __attribute__((using_if_exists)) | |
| 688 | # if __has_attribute(__using_if_exists__) | |
| 689 | # define _LIBCPP_USING_IF_EXISTS __attribute__((__using_if_exists__)) | |
| 706 | 690 | # else |
| 707 | 691 | # define _LIBCPP_USING_IF_EXISTS |
| 708 | 692 | # endif |
| ... | ... | @@ -726,11 +710,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 726 | 710 | # endif // _LIBCPP_CXX03_LANG |
| 727 | 711 | |
| 728 | 712 | # if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || defined(__sun__) || \ |
| 729 | defined(__NetBSD__) || defined(__DragonFly__) | |
| 713 | defined(__NetBSD__) | |
| 730 | 714 | # define _LIBCPP_LOCALE__L_EXTENSIONS 1 |
| 731 | 715 | # endif |
| 732 | 716 | |
| 733 | # if defined(__FreeBSD__) || defined(__DragonFly__) | |
| 717 | # ifdef __FreeBSD__ | |
| 734 | 718 | # define _DECLARE_C99_LDBL_MATH 1 |
| 735 | 719 | # endif |
| 736 | 720 | |
| ... | ... | @@ -750,11 +734,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 750 | 734 | # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION |
| 751 | 735 | # endif |
| 752 | 736 | |
| 753 | # if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) | |
| 737 | // It is not yet possible to use aligned_alloc() on all Apple platforms since | |
| 738 | // 10.15 was the first version to ship an implementation of aligned_alloc(). | |
| 739 | # if defined(__APPLE__) | |
| 740 | # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ | |
| 741 | __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) | |
| 742 | # define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC | |
| 743 | # endif | |
| 744 | # elif defined(__ANDROID__) && __ANDROID_API__ < 28 | |
| 745 | // Android only provides aligned_alloc when targeting API 28 or higher. | |
| 746 | # define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC | |
| 747 | # endif | |
| 748 | ||
| 749 | # if defined(__APPLE__) || defined(__FreeBSD__) | |
| 754 | 750 | # define _LIBCPP_HAS_DEFAULTRUNELOCALE |
| 755 | 751 | # endif |
| 756 | 752 | |
| 757 | # if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) || defined(__DragonFly__) | |
| 753 | # if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) | |
| 758 | 754 | # define _LIBCPP_WCTYPE_IS_MASK |
| 759 | 755 | # endif |
| 760 | 756 | |
| ... | ... | @@ -769,7 +765,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 769 | 765 | # if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) |
| 770 | 766 | # if __has_attribute(deprecated) |
| 771 | 767 | # define _LIBCPP_DEPRECATED __attribute__((deprecated)) |
| 772 | # define _LIBCPP_DEPRECATED_(m) __attribute__((deprected(m))) | |
| 768 | # define _LIBCPP_DEPRECATED_(m) __attribute__((deprecated(m))) | |
| 773 | 769 | # elif _LIBCPP_STD_VER > 11 |
| 774 | 770 | # define _LIBCPP_DEPRECATED [[deprecated]] |
| 775 | 771 | # define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]] |
| ... | ... | @@ -806,6 +802,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 806 | 802 | # define _LIBCPP_DEPRECATED_IN_CXX20 |
| 807 | 803 | # endif |
| 808 | 804 | |
| 805 | #if _LIBCPP_STD_VER >= 23 | |
| 806 | # define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED | |
| 807 | #else | |
| 808 | # define _LIBCPP_DEPRECATED_IN_CXX23 | |
| 809 | #endif | |
| 810 | ||
| 809 | 811 | # if !defined(_LIBCPP_HAS_NO_CHAR8_T) |
| 810 | 812 | # define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED |
| 811 | 813 | # else |
| ... | ... | @@ -830,27 +832,31 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 830 | 832 | # endif |
| 831 | 833 | |
| 832 | 834 | # if _LIBCPP_STD_VER > 11 |
| 833 | # define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr | |
| 835 | # define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr | |
| 834 | 836 | # else |
| 835 | # define _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 837 | # define _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 836 | 838 | # endif |
| 837 | 839 | |
| 838 | 840 | # if _LIBCPP_STD_VER > 14 |
| 839 | # define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr | |
| 841 | # define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr | |
| 840 | 842 | # else |
| 841 | # define _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 843 | # define _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 842 | 844 | # endif |
| 843 | 845 | |
| 844 | 846 | # if _LIBCPP_STD_VER > 17 |
| 845 | # define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr | |
| 847 | # define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr | |
| 846 | 848 | # else |
| 847 | # define _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 849 | # define _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 848 | 850 | # endif |
| 849 | 851 | |
| 850 | # if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC) | |
| 852 | # if _LIBCPP_STD_VER > 20 | |
| 853 | # define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr | |
| 854 | # else | |
| 855 | # define _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 856 | # endif | |
| 857 | ||
| 858 | # if __has_cpp_attribute(nodiscard) | |
| 851 | 859 | # define _LIBCPP_NODISCARD [[nodiscard]] |
| 852 | # elif defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(_LIBCPP_CXX03_LANG) | |
| 853 | # define _LIBCPP_NODISCARD [[clang::warn_unused_result]] | |
| 854 | 860 | # else |
| 855 | 861 | // We can't use GCC's [[gnu::warn_unused_result]] and |
| 856 | 862 | // __attribute__((warn_unused_result)), because GCC does not silence them via |
| ... | ... | @@ -860,19 +866,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 860 | 866 | |
| 861 | 867 | // _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not |
| 862 | 868 | // specified as such as an extension. |
| 863 | # if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT) | |
| 869 | # if !defined(_LIBCPP_DISABLE_NODISCARD_EXT) | |
| 864 | 870 | # define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD |
| 865 | 871 | # else |
| 866 | 872 | # define _LIBCPP_NODISCARD_EXT |
| 867 | 873 | # endif |
| 868 | 874 | |
| 869 | # if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && (_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD)) | |
| 875 | # if _LIBCPP_STD_VER > 17 || !defined(_LIBCPP_DISABLE_NODISCARD_EXT) | |
| 870 | 876 | # define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD |
| 871 | 877 | # else |
| 872 | 878 | # define _LIBCPP_NODISCARD_AFTER_CXX17 |
| 873 | 879 | # endif |
| 874 | 880 | |
| 875 | # if __has_attribute(no_destroy) | |
| 881 | # if __has_attribute(__no_destroy__) | |
| 876 | 882 | # define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__)) |
| 877 | 883 | # else |
| 878 | 884 | # define _LIBCPP_NO_DESTROY |
| ... | ... | @@ -901,7 +907,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 901 | 907 | |
| 902 | 908 | # if defined(__FreeBSD__) || \ |
| 903 | 909 | defined(__wasi__) || \ |
| 904 | defined(__DragonFly__) || \ | |
| 905 | 910 | defined(__NetBSD__) || \ |
| 906 | 911 | defined(__OpenBSD__) || \ |
| 907 | 912 | defined(__NuttX__) || \ |
| ... | ... | @@ -1035,18 +1040,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 1035 | 1040 | |
| 1036 | 1041 | # if _LIBCPP_STD_VER > 17 |
| 1037 | 1042 | # define _LIBCPP_CONSTINIT constinit |
| 1038 | # elif __has_attribute(require_constant_initialization) | |
| 1043 | # elif __has_attribute(__require_constant_initialization__) | |
| 1039 | 1044 | # define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__)) |
| 1040 | 1045 | # else |
| 1041 | 1046 | # define _LIBCPP_CONSTINIT |
| 1042 | 1047 | # endif |
| 1043 | 1048 | |
| 1044 | # if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) | |
| 1045 | # define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((diagnose_if(__VA_ARGS__, "warning"))) | |
| 1046 | # define _LIBCPP_DIAGNOSE_ERROR(...) __attribute__((diagnose_if(__VA_ARGS__, "error"))) | |
| 1049 | # if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) | |
| 1050 | # define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning"))) | |
| 1047 | 1051 | # else |
| 1048 | 1052 | # define _LIBCPP_DIAGNOSE_WARNING(...) |
| 1049 | # define _LIBCPP_DIAGNOSE_ERROR(...) | |
| 1050 | 1053 | # endif |
| 1051 | 1054 | |
| 1052 | 1055 | // Use a function like macro to imply that it must be followed by a semicolon |
| ... | ... | @@ -1058,6 +1061,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 1058 | 1061 | # define _LIBCPP_FALLTHROUGH() ((void)0) |
| 1059 | 1062 | # endif |
| 1060 | 1063 | |
| 1064 | # if __has_cpp_attribute(_Clang::__lifetimebound__) | |
| 1065 | # define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]] | |
| 1066 | # else | |
| 1067 | # define _LIBCPP_LIFETIMEBOUND | |
| 1068 | # endif | |
| 1069 | ||
| 1061 | 1070 | # if __has_attribute(__nodebug__) |
| 1062 | 1071 | # define _LIBCPP_NODEBUG __attribute__((__nodebug__)) |
| 1063 | 1072 | # else |
| ... | ... | @@ -1086,7 +1095,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 1086 | 1095 | # define _LIBCPP_IF_WIDE_CHARACTERS(...) __VA_ARGS__ |
| 1087 | 1096 | # endif |
| 1088 | 1097 | |
| 1089 | # if defined(_LIBCPP_ABI_MICROSOFT) && (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) | |
| 1098 | # if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases) | |
| 1090 | 1099 | # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) |
| 1091 | 1100 | # else |
| 1092 | 1101 | # define _LIBCPP_DECLSPEC_EMPTY_BASES |
| ... | ... | @@ -1100,13 +1109,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 1100 | 1109 | # define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION |
| 1101 | 1110 | # endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES |
| 1102 | 1111 | |
| 1103 | // Leave the deprecation notices in by default, but don't remove unary_function and | |
| 1104 | // binary_function entirely just yet. That way, folks will have one release to act | |
| 1105 | // on the deprecation warnings. | |
| 1106 | # ifndef _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION | |
| 1107 | # define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION | |
| 1108 | # endif | |
| 1109 | ||
| 1110 | 1112 | # if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES) |
| 1111 | 1113 | # define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS |
| 1112 | 1114 | # define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION |
| ... | ... | @@ -1116,10 +1118,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 1116 | 1118 | # define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS |
| 1117 | 1119 | # endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES |
| 1118 | 1120 | |
| 1119 | # if !defined(__cpp_impl_coroutine) || __cpp_impl_coroutine < 201902L | |
| 1120 | # define _LIBCPP_HAS_NO_CXX20_COROUTINES | |
| 1121 | # endif | |
| 1122 | ||
| 1123 | 1121 | # define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") |
| 1124 | 1122 | # define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") |
| 1125 | 1123 | |
| ... | ... | @@ -1151,19 +1149,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 1151 | 1149 | # define _LIBCPP_HAS_NO_FGETPOS_FSETPOS |
| 1152 | 1150 | # endif |
| 1153 | 1151 | |
| 1154 | # if __has_attribute(init_priority) | |
| 1155 | // TODO: Remove this once we drop support for building libc++ with old Clangs | |
| 1156 | # if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1200) || \ | |
| 1157 | (defined(__apple_build_version__) && __apple_build_version__ < 13000000) | |
| 1158 | # define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101))) | |
| 1159 | # else | |
| 1160 | # define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(100))) | |
| 1161 | # endif | |
| 1152 | # if __has_attribute(__init_priority__) | |
| 1153 | # define _LIBCPP_INIT_PRIORITY_MAX __attribute__((__init_priority__(100))) | |
| 1162 | 1154 | # else |
| 1163 | 1155 | # define _LIBCPP_INIT_PRIORITY_MAX |
| 1164 | 1156 | # endif |
| 1165 | 1157 | |
| 1166 | # if defined(__GNUC__) || defined(__clang__) | |
| 1158 | # if __has_attribute(__format__) | |
| 1167 | 1159 | // The attribute uses 1-based indices for ordinary and static member functions. |
| 1168 | 1160 | // The attribute uses 2-based indices for non-static member functions. |
| 1169 | 1161 | # define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \ |
| ... | ... | @@ -1225,6 +1217,35 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD |
| 1225 | 1217 | # define _LIBCPP_PACKED |
| 1226 | 1218 | # endif |
| 1227 | 1219 | |
| 1220 | // c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these | |
| 1221 | // functions is gradually being added to existing C libraries. The conditions | |
| 1222 | // below check for known C library versions and conditions under which these | |
| 1223 | // functions are declared by the C library. | |
| 1224 | # define _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8 | |
| 1225 | // GNU libc 2.36 and newer declare c8rtomb() and mbrtoc8() in C++ modes if | |
| 1226 | // __cpp_char8_t is defined or if C2X extensions are enabled. Unfortunately, | |
| 1227 | // determining the latter depends on internal GNU libc details. If the | |
| 1228 | // __cpp_char8_t feature test macro is not defined, then a char8_t typedef | |
| 1229 | // will be declared as well. | |
| 1230 | # if defined(_LIBCPP_GLIBC_PREREQ) && defined(__GLIBC_USE) | |
| 1231 | # if _LIBCPP_GLIBC_PREREQ(2, 36) && (defined(__cpp_char8_t) || __GLIBC_USE(ISOC2X)) | |
| 1232 | # undef _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8 | |
| 1233 | # endif | |
| 1234 | # endif | |
| 1235 | ||
| 1236 | // There are a handful of public standard library types that are intended to | |
| 1237 | // support CTAD but don't need any explicit deduction guides to do so. This | |
| 1238 | // macro is used to mark them as such, which suppresses the | |
| 1239 | // '-Wctad-maybe-unsupported' compiler warning when CTAD is used in user code | |
| 1240 | // with these classes. | |
| 1241 | #if _LIBCPP_STD_VER >= 17 | |
| 1242 | # define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \ | |
| 1243 | template <class ..._Tag> \ | |
| 1244 | _ClassName(typename _Tag::__allow_ctad...) -> _ClassName<_Tag...> | |
| 1245 | #else | |
| 1246 | # define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") | |
| 1247 | #endif | |
| 1248 | ||
| 1228 | 1249 | #endif // __cplusplus |
| 1229 | 1250 | |
| 1230 | 1251 | #endif // _LIBCPP___CONFIG |
lib/libcxx/include/__coroutine/coroutine_handle.h+5-4| ... | ... | @@ -13,14 +13,15 @@ |
| 13 | 13 | #include <__config> |
| 14 | 14 | #include <__functional/hash.h> |
| 15 | 15 | #include <__memory/addressof.h> |
| 16 | #include <__type_traits/remove_cv.h> | |
| 16 | 17 | #include <compare> |
| 17 | #include <type_traits> | |
| 18 | #include <cstddef> | |
| 18 | 19 | |
| 19 | 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | 21 | # pragma GCC system_header |
| 21 | 22 | #endif |
| 22 | 23 | |
| 23 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) | |
| 24 | #if _LIBCPP_STD_VER > 17 | |
| 24 | 25 | |
| 25 | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 27 | |
| ... | ... | @@ -115,7 +116,7 @@ public: |
| 115 | 116 | |
| 116 | 117 | _LIBCPP_HIDE_FROM_ABI |
| 117 | 118 | static coroutine_handle from_promise(_Promise& __promise) { |
| 118 | using _RawPromise = typename remove_cv<_Promise>::type; | |
| 119 | using _RawPromise = __remove_cv_t<_Promise>; | |
| 119 | 120 | coroutine_handle __tmp; |
| 120 | 121 | __tmp.__handle_ = |
| 121 | 122 | __builtin_coro_promise(_VSTD::addressof(const_cast<_RawPromise&>(__promise)), alignof(_Promise), true); |
| ... | ... | @@ -197,6 +198,6 @@ struct hash<coroutine_handle<_Tp>> { |
| 197 | 198 | |
| 198 | 199 | _LIBCPP_END_NAMESPACE_STD |
| 199 | 200 | |
| 200 | #endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) | |
| 201 | #endif // __LIBCPP_STD_VER > 17 | |
| 201 | 202 | |
| 202 | 203 | #endif // _LIBCPP___COROUTINE_COROUTINE_HANDLE_H |
lib/libcxx/include/__coroutine/coroutine_traits.h+4-4| ... | ... | @@ -10,13 +10,13 @@ |
| 10 | 10 | #define _LIBCPP___COROUTINE_COROUTINE_TRAITS_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <type_traits> | |
| 13 | #include <__type_traits/void_t.h> | |
| 14 | 14 | |
| 15 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 16 | # pragma GCC system_header |
| 17 | 17 | #endif |
| 18 | 18 | |
| 19 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) | |
| 19 | #if _LIBCPP_STD_VER > 17 | |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| ... | ... | @@ -35,7 +35,7 @@ struct __coroutine_traits_sfinae {}; |
| 35 | 35 | |
| 36 | 36 | template <class _Tp> |
| 37 | 37 | struct __coroutine_traits_sfinae< |
| 38 | _Tp, typename __void_t<typename _Tp::promise_type>::type> | |
| 38 | _Tp, __void_t<typename _Tp::promise_type> > | |
| 39 | 39 | { |
| 40 | 40 | using promise_type = typename _Tp::promise_type; |
| 41 | 41 | }; |
| ... | ... | @@ -48,6 +48,6 @@ struct coroutine_traits |
| 48 | 48 | |
| 49 | 49 | _LIBCPP_END_NAMESPACE_STD |
| 50 | 50 | |
| 51 | #endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) | |
| 51 | #endif // __LIBCPP_STD_VER > 17 | |
| 52 | 52 | |
| 53 | 53 | #endif // _LIBCPP___COROUTINE_COROUTINE_TRAITS_H |
lib/libcxx/include/__coroutine/noop_coroutine_handle.h+2-2| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | # pragma GCC system_header |
| 17 | 17 | #endif |
| 18 | 18 | |
| 19 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) | |
| 19 | #if _LIBCPP_STD_VER > 17 | |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| ... | ... | @@ -107,6 +107,6 @@ noop_coroutine_handle noop_coroutine() noexcept { return noop_coroutine_handle() |
| 107 | 107 | |
| 108 | 108 | _LIBCPP_END_NAMESPACE_STD |
| 109 | 109 | |
| 110 | #endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) | |
| 110 | #endif // __LIBCPP_STD_VER > 17 | |
| 111 | 111 | |
| 112 | 112 | #endif // _LIBCPP___COROUTINE_NOOP_COROUTINE_HANDLE_H |
lib/libcxx/include/__coroutine/trivial_awaitables.h+2-2| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | # pragma GCC system_header |
| 17 | 17 | #endif |
| 18 | 18 | |
| 19 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) | |
| 19 | #if _LIBCPP_STD_VER > 17 | |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| ... | ... | @@ -41,6 +41,6 @@ struct suspend_always { |
| 41 | 41 | |
| 42 | 42 | _LIBCPP_END_NAMESPACE_STD |
| 43 | 43 | |
| 44 | #endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) | |
| 44 | #endif // __LIBCPP_STD_VER > 17 | |
| 45 | 45 | |
| 46 | 46 | #endif // __LIBCPP___COROUTINE_TRIVIAL_AWAITABLES_H |
lib/libcxx/include/__debug+14-15| ... | ... | @@ -12,22 +12,21 @@ |
| 12 | 12 | |
| 13 | 13 | #include <__assert> |
| 14 | 14 | #include <__config> |
| 15 | #include <__type_traits/is_constant_evaluated.h> | |
| 15 | 16 | #include <cstddef> |
| 16 | #include <type_traits> | |
| 17 | 17 | |
| 18 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 19 | # pragma GCC system_header |
| 20 | 20 | #endif |
| 21 | 21 | |
| 22 | // Catch invalid uses of the legacy _LIBCPP_DEBUG toggle. | |
| 23 | #if defined(_LIBCPP_DEBUG) && _LIBCPP_DEBUG != 0 && !defined(_LIBCPP_ENABLE_DEBUG_MODE) | |
| 24 | # error "Enabling the debug mode now requires having configured the library with support for the debug mode" | |
| 25 | #endif | |
| 26 | ||
| 27 | 22 | #if defined(_LIBCPP_ENABLE_DEBUG_MODE) && !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY) |
| 28 | 23 | # define _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY |
| 29 | 24 | #endif |
| 30 | 25 | |
| 26 | #if defined(_LIBCPP_ENABLE_DEBUG_MODE) && !defined(_LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING) | |
| 27 | # define _LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING | |
| 28 | #endif | |
| 29 | ||
| 31 | 30 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 32 | 31 | # define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(::std::__libcpp_is_constant_evaluated() || (x), m) |
| 33 | 32 | #else |
| ... | ... | @@ -87,10 +86,10 @@ struct _C_node |
| 87 | 86 | explicit _C_node(void* __c, __c_node* __n) |
| 88 | 87 | : __c_node(__c, __n) {} |
| 89 | 88 | |
| 90 | virtual bool __dereferenceable(const void*) const; | |
| 91 | virtual bool __decrementable(const void*) const; | |
| 92 | virtual bool __addable(const void*, ptrdiff_t) const; | |
| 93 | virtual bool __subscriptable(const void*, ptrdiff_t) const; | |
| 89 | bool __dereferenceable(const void*) const override; | |
| 90 | bool __decrementable(const void*) const override; | |
| 91 | bool __addable(const void*, ptrdiff_t) const override; | |
| 92 | bool __subscriptable(const void*, ptrdiff_t) const override; | |
| 94 | 93 | }; |
| 95 | 94 | |
| 96 | 95 | template <class _Cont> |
| ... | ... | @@ -212,7 +211,7 @@ _LIBCPP_END_NAMESPACE_STD |
| 212 | 211 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 213 | 212 | |
| 214 | 213 | template <class _Tp> |
| 215 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_c(_Tp* __c) { | |
| 214 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 inline void __debug_db_insert_c(_Tp* __c) { | |
| 216 | 215 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 217 | 216 | if (!__libcpp_is_constant_evaluated()) |
| 218 | 217 | __get_db()->__insert_c(__c); |
| ... | ... | @@ -222,7 +221,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_inser |
| 222 | 221 | } |
| 223 | 222 | |
| 224 | 223 | template <class _Tp> |
| 225 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_i(_Tp* __i) { | |
| 224 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 inline void __debug_db_insert_i(_Tp* __i) { | |
| 226 | 225 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 227 | 226 | if (!__libcpp_is_constant_evaluated()) |
| 228 | 227 | __get_db()->__insert_i(__i); |
| ... | ... | @@ -232,7 +231,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_inser |
| 232 | 231 | } |
| 233 | 232 | |
| 234 | 233 | template <class _Tp> |
| 235 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_erase_c(_Tp* __c) { | |
| 234 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 inline void __debug_db_erase_c(_Tp* __c) { | |
| 236 | 235 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 237 | 236 | if (!__libcpp_is_constant_evaluated()) |
| 238 | 237 | __get_db()->__erase_c(__c); |
| ... | ... | @@ -242,7 +241,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_erase |
| 242 | 241 | } |
| 243 | 242 | |
| 244 | 243 | template <class _Tp> |
| 245 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_swap(_Tp* __lhs, _Tp* __rhs) { | |
| 244 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 inline void __debug_db_swap(_Tp* __lhs, _Tp* __rhs) { | |
| 246 | 245 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 247 | 246 | if (!__libcpp_is_constant_evaluated()) |
| 248 | 247 | __get_db()->swap(__lhs, __rhs); |
| ... | ... | @@ -253,7 +252,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_swap( |
| 253 | 252 | } |
| 254 | 253 | |
| 255 | 254 | template <class _Tp> |
| 256 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_invalidate_all(_Tp* __c) { | |
| 255 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 inline void __debug_db_invalidate_all(_Tp* __c) { | |
| 257 | 256 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 258 | 257 | if (!__libcpp_is_constant_evaluated()) |
| 259 | 258 | __get_db()->__invalidate_all(__c); |
lib/libcxx/include/__debug_utils/randomize_range.h+1-1| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | |
| 25 | 25 | template <class _AlgPolicy, class _Iterator, class _Sentinel> |
| 26 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 26 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 27 | 27 | void __debug_randomize_range(_Iterator __first, _Sentinel __last) { |
| 28 | 28 | #ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY |
| 29 | 29 | # ifdef _LIBCPP_CXX03_LANG |
lib/libcxx/include/__expected/bad_expected_access.h created+64| ... | ... | @@ -0,0 +1,64 @@ |
| 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 | #ifndef _LIBCPP___EXPECTED_BAD_EXPECTED_ACCESS_H | |
| 10 | #define _LIBCPP___EXPECTED_BAD_EXPECTED_ACCESS_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__utility/move.h> | |
| 14 | ||
| 15 | #include <exception> | |
| 16 | ||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 18 | # pragma GCC system_header | |
| 19 | #endif | |
| 20 | ||
| 21 | #if _LIBCPP_STD_VER >= 23 | |
| 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 24 | ||
| 25 | template <class _Err> | |
| 26 | class bad_expected_access; | |
| 27 | ||
| 28 | template <> | |
| 29 | class bad_expected_access<void> : public exception { | |
| 30 | protected: | |
| 31 | _LIBCPP_HIDE_FROM_ABI bad_expected_access() noexcept = default; | |
| 32 | _LIBCPP_HIDE_FROM_ABI bad_expected_access(const bad_expected_access&) = default; | |
| 33 | _LIBCPP_HIDE_FROM_ABI bad_expected_access(bad_expected_access&&) = default; | |
| 34 | _LIBCPP_HIDE_FROM_ABI bad_expected_access& operator=(const bad_expected_access&) = default; | |
| 35 | _LIBCPP_HIDE_FROM_ABI bad_expected_access& operator=(bad_expected_access&&) = default; | |
| 36 | ~bad_expected_access() override = default; | |
| 37 | ||
| 38 | public: | |
| 39 | // The way this has been designed (by using a class template below) means that we'll already | |
| 40 | // have a profusion of these vtables in TUs, and the dynamic linker will already have a bunch | |
| 41 | // of work to do. So it is not worth hiding the <void> specialization in the dylib, given that | |
| 42 | // it adds deployment target restrictions. | |
| 43 | const char* what() const noexcept override { return "bad access to std::expected"; } | |
| 44 | }; | |
| 45 | ||
| 46 | template <class _Err> | |
| 47 | class bad_expected_access : public bad_expected_access<void> { | |
| 48 | public: | |
| 49 | _LIBCPP_HIDE_FROM_ABI explicit bad_expected_access(_Err __e) : __unex_(std::move(__e)) {} | |
| 50 | ||
| 51 | _LIBCPP_HIDE_FROM_ABI _Err& error() & noexcept { return __unex_; } | |
| 52 | _LIBCPP_HIDE_FROM_ABI const _Err& error() const& noexcept { return __unex_; } | |
| 53 | _LIBCPP_HIDE_FROM_ABI _Err&& error() && noexcept { return std::move(__unex_); } | |
| 54 | _LIBCPP_HIDE_FROM_ABI const _Err&& error() const&& noexcept { return std::move(__unex_); } | |
| 55 | ||
| 56 | private: | |
| 57 | _Err __unex_; | |
| 58 | }; | |
| 59 | ||
| 60 | _LIBCPP_END_NAMESPACE_STD | |
| 61 | ||
| 62 | #endif // _LIBCPP_STD_VER >= 23 | |
| 63 | ||
| 64 | #endif // _LIBCPP___EXPECTED_BAD_EXPECTED_ACCESS_H |
lib/libcxx/include/__expected/expected.h created+973| ... | ... | @@ -0,0 +1,973 @@ |
| 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 | #ifndef _LIBCPP___EXPECTED_EXPECTED_H | |
| 10 | #define _LIBCPP___EXPECTED_EXPECTED_H | |
| 11 | ||
| 12 | #include <__assert> | |
| 13 | #include <__config> | |
| 14 | #include <__expected/bad_expected_access.h> | |
| 15 | #include <__expected/unexpect.h> | |
| 16 | #include <__expected/unexpected.h> | |
| 17 | #include <__memory/addressof.h> | |
| 18 | #include <__memory/construct_at.h> | |
| 19 | #include <__type_traits/conjunction.h> | |
| 20 | #include <__type_traits/disjunction.h> | |
| 21 | #include <__type_traits/is_assignable.h> | |
| 22 | #include <__type_traits/is_constructible.h> | |
| 23 | #include <__type_traits/is_convertible.h> | |
| 24 | #include <__type_traits/is_copy_assignable.h> | |
| 25 | #include <__type_traits/is_copy_constructible.h> | |
| 26 | #include <__type_traits/is_default_constructible.h> | |
| 27 | #include <__type_traits/is_function.h> | |
| 28 | #include <__type_traits/is_move_assignable.h> | |
| 29 | #include <__type_traits/is_move_constructible.h> | |
| 30 | #include <__type_traits/is_nothrow_constructible.h> | |
| 31 | #include <__type_traits/is_nothrow_copy_assignable.h> | |
| 32 | #include <__type_traits/is_nothrow_copy_constructible.h> | |
| 33 | #include <__type_traits/is_nothrow_default_constructible.h> | |
| 34 | #include <__type_traits/is_nothrow_move_assignable.h> | |
| 35 | #include <__type_traits/is_nothrow_move_constructible.h> | |
| 36 | #include <__type_traits/is_reference.h> | |
| 37 | #include <__type_traits/is_same.h> | |
| 38 | #include <__type_traits/is_swappable.h> | |
| 39 | #include <__type_traits/is_trivially_copy_constructible.h> | |
| 40 | #include <__type_traits/is_trivially_destructible.h> | |
| 41 | #include <__type_traits/is_trivially_move_constructible.h> | |
| 42 | #include <__type_traits/is_void.h> | |
| 43 | #include <__type_traits/lazy.h> | |
| 44 | #include <__type_traits/negation.h> | |
| 45 | #include <__type_traits/remove_cv.h> | |
| 46 | #include <__type_traits/remove_cvref.h> | |
| 47 | #include <__utility/exception_guard.h> | |
| 48 | #include <__utility/forward.h> | |
| 49 | #include <__utility/in_place.h> | |
| 50 | #include <__utility/move.h> | |
| 51 | #include <__utility/swap.h> | |
| 52 | #include <cstdlib> // for std::abort | |
| 53 | #include <initializer_list> | |
| 54 | ||
| 55 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 56 | # pragma GCC system_header | |
| 57 | #endif | |
| 58 | ||
| 59 | #if _LIBCPP_STD_VER >= 23 | |
| 60 | ||
| 61 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 62 | ||
| 63 | namespace __expected { | |
| 64 | ||
| 65 | template <class _Err, class _Arg> | |
| 66 | _LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) { | |
| 67 | # ifndef _LIBCPP_NO_EXCEPTIONS | |
| 68 | throw bad_expected_access<_Err>(std::forward<_Arg>(__arg)); | |
| 69 | # else | |
| 70 | (void)__arg; | |
| 71 | std::abort(); | |
| 72 | # endif | |
| 73 | } | |
| 74 | ||
| 75 | } // namespace __expected | |
| 76 | ||
| 77 | template <class _Tp, class _Err> | |
| 78 | class expected { | |
| 79 | static_assert( | |
| 80 | !is_reference_v<_Tp> && | |
| 81 | !is_function_v<_Tp> && | |
| 82 | !is_same_v<remove_cv_t<_Tp>, in_place_t> && | |
| 83 | !is_same_v<remove_cv_t<_Tp>, unexpect_t> && | |
| 84 | !__is_std_unexpected<remove_cv_t<_Tp>>::value && | |
| 85 | __valid_std_unexpected<_Err>::value | |
| 86 | , | |
| 87 | "[expected.object.general] A program that instantiates the definition of template expected<T, E> for a " | |
| 88 | "reference type, a function type, or for possibly cv-qualified types in_place_t, unexpect_t, or a " | |
| 89 | "specialization of unexpected for the T parameter is ill-formed. A program that instantiates the " | |
| 90 | "definition of the template expected<T, E> with a type for the E parameter that is not a valid " | |
| 91 | "template argument for unexpected is ill-formed."); | |
| 92 | ||
| 93 | template <class _Up, class _OtherErr> | |
| 94 | friend class expected; | |
| 95 | ||
| 96 | public: | |
| 97 | using value_type = _Tp; | |
| 98 | using error_type = _Err; | |
| 99 | using unexpected_type = unexpected<_Err>; | |
| 100 | ||
| 101 | template <class _Up> | |
| 102 | using rebind = expected<_Up, error_type>; | |
| 103 | ||
| 104 | // [expected.object.ctor], constructors | |
| 105 | _LIBCPP_HIDE_FROM_ABI constexpr expected() | |
| 106 | noexcept(is_nothrow_default_constructible_v<_Tp>) // strengthened | |
| 107 | requires is_default_constructible_v<_Tp> | |
| 108 | : __has_val_(true) { | |
| 109 | std::construct_at(std::addressof(__union_.__val_)); | |
| 110 | } | |
| 111 | ||
| 112 | _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete; | |
| 113 | ||
| 114 | _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) | |
| 115 | requires(is_copy_constructible_v<_Tp> && | |
| 116 | is_copy_constructible_v<_Err> && | |
| 117 | is_trivially_copy_constructible_v<_Tp> && | |
| 118 | is_trivially_copy_constructible_v<_Err>) | |
| 119 | = default; | |
| 120 | ||
| 121 | _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __other) | |
| 122 | noexcept(is_nothrow_copy_constructible_v<_Tp> && is_nothrow_copy_constructible_v<_Err>) // strengthened | |
| 123 | requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> && | |
| 124 | !(is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>)) | |
| 125 | : __has_val_(__other.__has_val_) { | |
| 126 | if (__has_val_) { | |
| 127 | std::construct_at(std::addressof(__union_.__val_), __other.__union_.__val_); | |
| 128 | } else { | |
| 129 | std::construct_at(std::addressof(__union_.__unex_), __other.__union_.__unex_); | |
| 130 | } | |
| 131 | } | |
| 132 | ||
| 133 | ||
| 134 | _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&) | |
| 135 | requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> | |
| 136 | && is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>) | |
| 137 | = default; | |
| 138 | ||
| 139 | _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __other) | |
| 140 | noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_constructible_v<_Err>) | |
| 141 | requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> && | |
| 142 | !(is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>)) | |
| 143 | : __has_val_(__other.__has_val_) { | |
| 144 | if (__has_val_) { | |
| 145 | std::construct_at(std::addressof(__union_.__val_), std::move(__other.__union_.__val_)); | |
| 146 | } else { | |
| 147 | std::construct_at(std::addressof(__union_.__unex_), std::move(__other.__union_.__unex_)); | |
| 148 | } | |
| 149 | } | |
| 150 | ||
| 151 | private: | |
| 152 | template <class _Up, class _OtherErr, class _UfQual, class _OtherErrQual> | |
| 153 | using __can_convert = | |
| 154 | _And< is_constructible<_Tp, _UfQual>, | |
| 155 | is_constructible<_Err, _OtherErrQual>, | |
| 156 | _Not<is_constructible<_Tp, expected<_Up, _OtherErr>&>>, | |
| 157 | _Not<is_constructible<_Tp, expected<_Up, _OtherErr>>>, | |
| 158 | _Not<is_constructible<_Tp, const expected<_Up, _OtherErr>&>>, | |
| 159 | _Not<is_constructible<_Tp, const expected<_Up, _OtherErr>>>, | |
| 160 | _Not<is_convertible<expected<_Up, _OtherErr>&, _Tp>>, | |
| 161 | _Not<is_convertible<expected<_Up, _OtherErr>&&, _Tp>>, | |
| 162 | _Not<is_convertible<const expected<_Up, _OtherErr>&, _Tp>>, | |
| 163 | _Not<is_convertible<const expected<_Up, _OtherErr>&&, _Tp>>, | |
| 164 | _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>&>>, | |
| 165 | _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>>>, | |
| 166 | _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>&>>, | |
| 167 | _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>>> >; | |
| 168 | ||
| 169 | ||
| 170 | public: | |
| 171 | template <class _Up, class _OtherErr> | |
| 172 | requires __can_convert<_Up, _OtherErr, const _Up&, const _OtherErr&>::value | |
| 173 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _Up&, _Tp> || | |
| 174 | !is_convertible_v<const _OtherErr&, _Err>) | |
| 175 | expected(const expected<_Up, _OtherErr>& __other) | |
| 176 | noexcept(is_nothrow_constructible_v<_Tp, const _Up&> && | |
| 177 | is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened | |
| 178 | : __has_val_(__other.__has_val_) { | |
| 179 | if (__has_val_) { | |
| 180 | std::construct_at(std::addressof(__union_.__val_), __other.__union_.__val_); | |
| 181 | } else { | |
| 182 | std::construct_at(std::addressof(__union_.__unex_), __other.__union_.__unex_); | |
| 183 | } | |
| 184 | } | |
| 185 | ||
| 186 | template <class _Up, class _OtherErr> | |
| 187 | requires __can_convert<_Up, _OtherErr, _Up, _OtherErr>::value | |
| 188 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp> || !is_convertible_v<_OtherErr, _Err>) | |
| 189 | expected(expected<_Up, _OtherErr>&& __other) | |
| 190 | noexcept(is_nothrow_constructible_v<_Tp, _Up> && is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened | |
| 191 | : __has_val_(__other.__has_val_) { | |
| 192 | if (__has_val_) { | |
| 193 | std::construct_at(std::addressof(__union_.__val_), std::move(__other.__union_.__val_)); | |
| 194 | } else { | |
| 195 | std::construct_at(std::addressof(__union_.__unex_), std::move(__other.__union_.__unex_)); | |
| 196 | } | |
| 197 | } | |
| 198 | ||
| 199 | template <class _Up = _Tp> | |
| 200 | requires(!is_same_v<remove_cvref_t<_Up>, in_place_t> && !is_same_v<expected, remove_cvref_t<_Up>> && | |
| 201 | !__is_std_unexpected<remove_cvref_t<_Up>>::value && is_constructible_v<_Tp, _Up>) | |
| 202 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp>) | |
| 203 | expected(_Up&& __u) | |
| 204 | noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened | |
| 205 | : __has_val_(true) { | |
| 206 | std::construct_at(std::addressof(__union_.__val_), std::forward<_Up>(__u)); | |
| 207 | } | |
| 208 | ||
| 209 | ||
| 210 | template <class _OtherErr> | |
| 211 | requires is_constructible_v<_Err, const _OtherErr&> | |
| 212 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) | |
| 213 | expected(const unexpected<_OtherErr>& __unex) | |
| 214 | noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened | |
| 215 | : __has_val_(false) { | |
| 216 | std::construct_at(std::addressof(__union_.__unex_), __unex.error()); | |
| 217 | } | |
| 218 | ||
| 219 | template <class _OtherErr> | |
| 220 | requires is_constructible_v<_Err, _OtherErr> | |
| 221 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>) | |
| 222 | expected(unexpected<_OtherErr>&& __unex) | |
| 223 | noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened | |
| 224 | : __has_val_(false) { | |
| 225 | std::construct_at(std::addressof(__union_.__unex_), std::move(__unex.error())); | |
| 226 | } | |
| 227 | ||
| 228 | template <class... _Args> | |
| 229 | requires is_constructible_v<_Tp, _Args...> | |
| 230 | _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, _Args&&... __args) | |
| 231 | noexcept(is_nothrow_constructible_v<_Tp, _Args...>) // strengthened | |
| 232 | : __has_val_(true) { | |
| 233 | std::construct_at(std::addressof(__union_.__val_), std::forward<_Args>(__args)...); | |
| 234 | } | |
| 235 | ||
| 236 | template <class _Up, class... _Args> | |
| 237 | requires is_constructible_v< _Tp, initializer_list<_Up>&, _Args... > | |
| 238 | _LIBCPP_HIDE_FROM_ABI constexpr explicit | |
| 239 | expected(in_place_t, initializer_list<_Up> __il, _Args&&... __args) | |
| 240 | noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) // strengthened | |
| 241 | : __has_val_(true) { | |
| 242 | std::construct_at(std::addressof(__union_.__val_), __il, std::forward<_Args>(__args)...); | |
| 243 | } | |
| 244 | ||
| 245 | template <class... _Args> | |
| 246 | requires is_constructible_v<_Err, _Args...> | |
| 247 | _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) | |
| 248 | noexcept(is_nothrow_constructible_v<_Err, _Args...>) // strengthened | |
| 249 | : __has_val_(false) { | |
| 250 | std::construct_at(std::addressof(__union_.__unex_), std::forward<_Args>(__args)...); | |
| 251 | } | |
| 252 | ||
| 253 | template <class _Up, class... _Args> | |
| 254 | requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... > | |
| 255 | _LIBCPP_HIDE_FROM_ABI constexpr explicit | |
| 256 | expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) | |
| 257 | noexcept(is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened | |
| 258 | : __has_val_(false) { | |
| 259 | std::construct_at(std::addressof(__union_.__unex_), __il, std::forward<_Args>(__args)...); | |
| 260 | } | |
| 261 | ||
| 262 | // [expected.object.dtor], destructor | |
| 263 | ||
| 264 | _LIBCPP_HIDE_FROM_ABI constexpr ~expected() | |
| 265 | requires(is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>) | |
| 266 | = default; | |
| 267 | ||
| 268 | _LIBCPP_HIDE_FROM_ABI constexpr ~expected() | |
| 269 | requires(!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>) | |
| 270 | { | |
| 271 | if (__has_val_) { | |
| 272 | std::destroy_at(std::addressof(__union_.__val_)); | |
| 273 | } else { | |
| 274 | std::destroy_at(std::addressof(__union_.__unex_)); | |
| 275 | } | |
| 276 | } | |
| 277 | ||
| 278 | private: | |
| 279 | template <class _T1, class _T2, class... _Args> | |
| 280 | _LIBCPP_HIDE_FROM_ABI static constexpr void __reinit_expected(_T1& __newval, _T2& __oldval, _Args&&... __args) { | |
| 281 | if constexpr (is_nothrow_constructible_v<_T1, _Args...>) { | |
| 282 | std::destroy_at(std::addressof(__oldval)); | |
| 283 | std::construct_at(std::addressof(__newval), std::forward<_Args>(__args)...); | |
| 284 | } else if constexpr (is_nothrow_move_constructible_v<_T1>) { | |
| 285 | _T1 __tmp(std::forward<_Args>(__args)...); | |
| 286 | std::destroy_at(std::addressof(__oldval)); | |
| 287 | std::construct_at(std::addressof(__newval), std::move(__tmp)); | |
| 288 | } else { | |
| 289 | static_assert( | |
| 290 | is_nothrow_move_constructible_v<_T2>, | |
| 291 | "To provide strong exception guarantee, T2 has to satisfy `is_nothrow_move_constructible_v` so that it can " | |
| 292 | "be reverted to the previous state in case an exception is thrown during the assignment."); | |
| 293 | _T2 __tmp(std::move(__oldval)); | |
| 294 | std::destroy_at(std::addressof(__oldval)); | |
| 295 | __exception_guard __trans([&] { std::construct_at(std::addressof(__oldval), std::move(__tmp)); }); | |
| 296 | std::construct_at(std::addressof(__newval), std::forward<_Args>(__args)...); | |
| 297 | __trans.__complete(); | |
| 298 | } | |
| 299 | } | |
| 300 | ||
| 301 | public: | |
| 302 | // [expected.object.assign], assignment | |
| 303 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete; | |
| 304 | ||
| 305 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) | |
| 306 | noexcept(is_nothrow_copy_assignable_v<_Tp> && | |
| 307 | is_nothrow_copy_constructible_v<_Tp> && | |
| 308 | is_nothrow_copy_assignable_v<_Err> && | |
| 309 | is_nothrow_copy_constructible_v<_Err>) // strengthened | |
| 310 | requires(is_copy_assignable_v<_Tp> && | |
| 311 | is_copy_constructible_v<_Tp> && | |
| 312 | is_copy_assignable_v<_Err> && | |
| 313 | is_copy_constructible_v<_Err> && | |
| 314 | (is_nothrow_move_constructible_v<_Tp> || | |
| 315 | is_nothrow_move_constructible_v<_Err>)) | |
| 316 | { | |
| 317 | if (__has_val_ && __rhs.__has_val_) { | |
| 318 | __union_.__val_ = __rhs.__union_.__val_; | |
| 319 | } else if (__has_val_) { | |
| 320 | __reinit_expected(__union_.__unex_, __union_.__val_, __rhs.__union_.__unex_); | |
| 321 | } else if (__rhs.__has_val_) { | |
| 322 | __reinit_expected(__union_.__val_, __union_.__unex_, __rhs.__union_.__val_); | |
| 323 | } else { | |
| 324 | __union_.__unex_ = __rhs.__union_.__unex_; | |
| 325 | } | |
| 326 | // note: only reached if no exception+rollback was done inside __reinit_expected | |
| 327 | __has_val_ = __rhs.__has_val_; | |
| 328 | return *this; | |
| 329 | } | |
| 330 | ||
| 331 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(expected&& __rhs) | |
| 332 | noexcept(is_nothrow_move_assignable_v<_Tp> && | |
| 333 | is_nothrow_move_constructible_v<_Tp> && | |
| 334 | is_nothrow_move_assignable_v<_Err> && | |
| 335 | is_nothrow_move_constructible_v<_Err>) | |
| 336 | requires(is_move_constructible_v<_Tp> && | |
| 337 | is_move_assignable_v<_Tp> && | |
| 338 | is_move_constructible_v<_Err> && | |
| 339 | is_move_assignable_v<_Err> && | |
| 340 | (is_nothrow_move_constructible_v<_Tp> || | |
| 341 | is_nothrow_move_constructible_v<_Err>)) | |
| 342 | { | |
| 343 | if (__has_val_ && __rhs.__has_val_) { | |
| 344 | __union_.__val_ = std::move(__rhs.__union_.__val_); | |
| 345 | } else if (__has_val_) { | |
| 346 | __reinit_expected(__union_.__unex_, __union_.__val_, std::move(__rhs.__union_.__unex_)); | |
| 347 | } else if (__rhs.__has_val_) { | |
| 348 | __reinit_expected(__union_.__val_, __union_.__unex_, std::move(__rhs.__union_.__val_)); | |
| 349 | } else { | |
| 350 | __union_.__unex_ = std::move(__rhs.__union_.__unex_); | |
| 351 | } | |
| 352 | // note: only reached if no exception+rollback was done inside __reinit_expected | |
| 353 | __has_val_ = __rhs.__has_val_; | |
| 354 | return *this; | |
| 355 | } | |
| 356 | ||
| 357 | template <class _Up = _Tp> | |
| 358 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(_Up&& __v) | |
| 359 | requires(!is_same_v<expected, remove_cvref_t<_Up>> && | |
| 360 | !__is_std_unexpected<remove_cvref_t<_Up>>::value && | |
| 361 | is_constructible_v<_Tp, _Up> && | |
| 362 | is_assignable_v<_Tp&, _Up> && | |
| 363 | (is_nothrow_constructible_v<_Tp, _Up> || | |
| 364 | is_nothrow_move_constructible_v<_Tp> || | |
| 365 | is_nothrow_move_constructible_v<_Err>)) | |
| 366 | { | |
| 367 | if (__has_val_) { | |
| 368 | __union_.__val_ = std::forward<_Up>(__v); | |
| 369 | } else { | |
| 370 | __reinit_expected(__union_.__val_, __union_.__unex_, std::forward<_Up>(__v)); | |
| 371 | __has_val_ = true; | |
| 372 | } | |
| 373 | return *this; | |
| 374 | } | |
| 375 | ||
| 376 | private: | |
| 377 | template <class _OtherErrQual> | |
| 378 | static constexpr bool __can_assign_from_unexpected = | |
| 379 | _And< is_constructible<_Err, _OtherErrQual>, | |
| 380 | is_assignable<_Err&, _OtherErrQual>, | |
| 381 | _Lazy<_Or, | |
| 382 | is_nothrow_constructible<_Err, _OtherErrQual>, | |
| 383 | is_nothrow_move_constructible<_Tp>, | |
| 384 | is_nothrow_move_constructible<_Err>> >::value; | |
| 385 | ||
| 386 | public: | |
| 387 | template <class _OtherErr> | |
| 388 | requires(__can_assign_from_unexpected<const _OtherErr&>) | |
| 389 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const unexpected<_OtherErr>& __un) { | |
| 390 | if (__has_val_) { | |
| 391 | __reinit_expected(__union_.__unex_, __union_.__val_, __un.error()); | |
| 392 | __has_val_ = false; | |
| 393 | } else { | |
| 394 | __union_.__unex_ = __un.error(); | |
| 395 | } | |
| 396 | return *this; | |
| 397 | } | |
| 398 | ||
| 399 | template <class _OtherErr> | |
| 400 | requires(__can_assign_from_unexpected<_OtherErr>) | |
| 401 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(unexpected<_OtherErr>&& __un) { | |
| 402 | if (__has_val_) { | |
| 403 | __reinit_expected(__union_.__unex_, __union_.__val_, std::move(__un.error())); | |
| 404 | __has_val_ = false; | |
| 405 | } else { | |
| 406 | __union_.__unex_ = std::move(__un.error()); | |
| 407 | } | |
| 408 | return *this; | |
| 409 | } | |
| 410 | ||
| 411 | template <class... _Args> | |
| 412 | requires is_nothrow_constructible_v<_Tp, _Args...> | |
| 413 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp& emplace(_Args&&... __args) noexcept { | |
| 414 | if (__has_val_) { | |
| 415 | std::destroy_at(std::addressof(__union_.__val_)); | |
| 416 | } else { | |
| 417 | std::destroy_at(std::addressof(__union_.__unex_)); | |
| 418 | __has_val_ = true; | |
| 419 | } | |
| 420 | return *std::construct_at(std::addressof(__union_.__val_), std::forward<_Args>(__args)...); | |
| 421 | } | |
| 422 | ||
| 423 | template <class _Up, class... _Args> | |
| 424 | requires is_nothrow_constructible_v< _Tp, initializer_list<_Up>&, _Args... > | |
| 425 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) noexcept { | |
| 426 | if (__has_val_) { | |
| 427 | std::destroy_at(std::addressof(__union_.__val_)); | |
| 428 | } else { | |
| 429 | std::destroy_at(std::addressof(__union_.__unex_)); | |
| 430 | __has_val_ = true; | |
| 431 | } | |
| 432 | return *std::construct_at(std::addressof(__union_.__val_), __il, std::forward<_Args>(__args)...); | |
| 433 | } | |
| 434 | ||
| 435 | ||
| 436 | public: | |
| 437 | // [expected.object.swap], swap | |
| 438 | _LIBCPP_HIDE_FROM_ABI constexpr void swap(expected& __rhs) | |
| 439 | noexcept(is_nothrow_move_constructible_v<_Tp> && | |
| 440 | is_nothrow_swappable_v<_Tp> && | |
| 441 | is_nothrow_move_constructible_v<_Err> && | |
| 442 | is_nothrow_swappable_v<_Err>) | |
| 443 | requires(is_swappable_v<_Tp> && | |
| 444 | is_swappable_v<_Err> && | |
| 445 | is_move_constructible_v<_Tp> && | |
| 446 | is_move_constructible_v<_Err> && | |
| 447 | (is_nothrow_move_constructible_v<_Tp> || | |
| 448 | is_nothrow_move_constructible_v<_Err>)) | |
| 449 | { | |
| 450 | auto __swap_val_unex_impl = [&](expected& __with_val, expected& __with_err) { | |
| 451 | if constexpr (is_nothrow_move_constructible_v<_Err>) { | |
| 452 | _Err __tmp(std::move(__with_err.__union_.__unex_)); | |
| 453 | std::destroy_at(std::addressof(__with_err.__union_.__unex_)); | |
| 454 | __exception_guard __trans([&] { | |
| 455 | std::construct_at(std::addressof(__with_err.__union_.__unex_), std::move(__tmp)); | |
| 456 | }); | |
| 457 | std::construct_at(std::addressof(__with_err.__union_.__val_), std::move(__with_val.__union_.__val_)); | |
| 458 | __trans.__complete(); | |
| 459 | std::destroy_at(std::addressof(__with_val.__union_.__val_)); | |
| 460 | std::construct_at(std::addressof(__with_val.__union_.__unex_), std::move(__tmp)); | |
| 461 | } else { | |
| 462 | static_assert(is_nothrow_move_constructible_v<_Tp>, | |
| 463 | "To provide strong exception guarantee, Tp has to satisfy `is_nothrow_move_constructible_v` so " | |
| 464 | "that it can be reverted to the previous state in case an exception is thrown during swap."); | |
| 465 | _Tp __tmp(std::move(__with_val.__union_.__val_)); | |
| 466 | std::destroy_at(std::addressof(__with_val.__union_.__val_)); | |
| 467 | __exception_guard __trans([&] { | |
| 468 | std::construct_at(std::addressof(__with_val.__union_.__val_), std::move(__tmp)); | |
| 469 | }); | |
| 470 | std::construct_at(std::addressof(__with_val.__union_.__unex_), std::move(__with_err.__union_.__unex_)); | |
| 471 | __trans.__complete(); | |
| 472 | std::destroy_at(std::addressof(__with_err.__union_.__unex_)); | |
| 473 | std::construct_at(std::addressof(__with_err.__union_.__val_), std::move(__tmp)); | |
| 474 | } | |
| 475 | __with_val.__has_val_ = false; | |
| 476 | __with_err.__has_val_ = true; | |
| 477 | }; | |
| 478 | ||
| 479 | if (__has_val_) { | |
| 480 | if (__rhs.__has_val_) { | |
| 481 | using std::swap; | |
| 482 | swap(__union_.__val_, __rhs.__union_.__val_); | |
| 483 | } else { | |
| 484 | __swap_val_unex_impl(*this, __rhs); | |
| 485 | } | |
| 486 | } else { | |
| 487 | if (__rhs.__has_val_) { | |
| 488 | __swap_val_unex_impl(__rhs, *this); | |
| 489 | } else { | |
| 490 | using std::swap; | |
| 491 | swap(__union_.__unex_, __rhs.__union_.__unex_); | |
| 492 | } | |
| 493 | } | |
| 494 | } | |
| 495 | ||
| 496 | _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y) | |
| 497 | noexcept(noexcept(__x.swap(__y))) | |
| 498 | requires requires { __x.swap(__y); } | |
| 499 | { | |
| 500 | __x.swap(__y); | |
| 501 | } | |
| 502 | ||
| 503 | // [expected.object.obs], observers | |
| 504 | _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* operator->() const noexcept { | |
| 505 | _LIBCPP_ASSERT(__has_val_, "expected::operator-> requires the expected to contain a value"); | |
| 506 | return std::addressof(__union_.__val_); | |
| 507 | } | |
| 508 | ||
| 509 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator->() noexcept { | |
| 510 | _LIBCPP_ASSERT(__has_val_, "expected::operator-> requires the expected to contain a value"); | |
| 511 | return std::addressof(__union_.__val_); | |
| 512 | } | |
| 513 | ||
| 514 | _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept { | |
| 515 | _LIBCPP_ASSERT(__has_val_, "expected::operator* requires the expected to contain a value"); | |
| 516 | return __union_.__val_; | |
| 517 | } | |
| 518 | ||
| 519 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept { | |
| 520 | _LIBCPP_ASSERT(__has_val_, "expected::operator* requires the expected to contain a value"); | |
| 521 | return __union_.__val_; | |
| 522 | } | |
| 523 | ||
| 524 | _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept { | |
| 525 | _LIBCPP_ASSERT(__has_val_, "expected::operator* requires the expected to contain a value"); | |
| 526 | return std::move(__union_.__val_); | |
| 527 | } | |
| 528 | ||
| 529 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept { | |
| 530 | _LIBCPP_ASSERT(__has_val_, "expected::operator* requires the expected to contain a value"); | |
| 531 | return std::move(__union_.__val_); | |
| 532 | } | |
| 533 | ||
| 534 | _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __has_val_; } | |
| 535 | ||
| 536 | _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __has_val_; } | |
| 537 | ||
| 538 | _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& value() const& { | |
| 539 | if (!__has_val_) { | |
| 540 | __expected::__throw_bad_expected_access<_Err>(__union_.__unex_); | |
| 541 | } | |
| 542 | return __union_.__val_; | |
| 543 | } | |
| 544 | ||
| 545 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() & { | |
| 546 | if (!__has_val_) { | |
| 547 | __expected::__throw_bad_expected_access<_Err>(__union_.__unex_); | |
| 548 | } | |
| 549 | return __union_.__val_; | |
| 550 | } | |
| 551 | ||
| 552 | _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& value() const&& { | |
| 553 | if (!__has_val_) { | |
| 554 | __expected::__throw_bad_expected_access<_Err>(std::move(__union_.__unex_)); | |
| 555 | } | |
| 556 | return std::move(__union_.__val_); | |
| 557 | } | |
| 558 | ||
| 559 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() && { | |
| 560 | if (!__has_val_) { | |
| 561 | __expected::__throw_bad_expected_access<_Err>(std::move(__union_.__unex_)); | |
| 562 | } | |
| 563 | return std::move(__union_.__val_); | |
| 564 | } | |
| 565 | ||
| 566 | _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept { | |
| 567 | _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); | |
| 568 | return __union_.__unex_; | |
| 569 | } | |
| 570 | ||
| 571 | _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept { | |
| 572 | _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); | |
| 573 | return __union_.__unex_; | |
| 574 | } | |
| 575 | ||
| 576 | _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept { | |
| 577 | _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); | |
| 578 | return std::move(__union_.__unex_); | |
| 579 | } | |
| 580 | ||
| 581 | _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept { | |
| 582 | _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); | |
| 583 | return std::move(__union_.__unex_); | |
| 584 | } | |
| 585 | ||
| 586 | template <class _Up> | |
| 587 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) const& { | |
| 588 | static_assert(is_copy_constructible_v<_Tp>, "value_type has to be copy constructible"); | |
| 589 | static_assert(is_convertible_v<_Up, _Tp>, "argument has to be convertible to value_type"); | |
| 590 | return __has_val_ ? __union_.__val_ : static_cast<_Tp>(std::forward<_Up>(__v)); | |
| 591 | } | |
| 592 | ||
| 593 | template <class _Up> | |
| 594 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) && { | |
| 595 | static_assert(is_move_constructible_v<_Tp>, "value_type has to be move constructible"); | |
| 596 | static_assert(is_convertible_v<_Up, _Tp>, "argument has to be convertible to value_type"); | |
| 597 | return __has_val_ ? std::move(__union_.__val_) : static_cast<_Tp>(std::forward<_Up>(__v)); | |
| 598 | } | |
| 599 | ||
| 600 | // [expected.object.eq], equality operators | |
| 601 | template <class _T2, class _E2> | |
| 602 | requires(!is_void_v<_T2>) | |
| 603 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y) { | |
| 604 | if (__x.__has_val_ != __y.__has_val_) { | |
| 605 | return false; | |
| 606 | } else { | |
| 607 | if (__x.__has_val_) { | |
| 608 | return __x.__union_.__val_ == __y.__union_.__val_; | |
| 609 | } else { | |
| 610 | return __x.__union_.__unex_ == __y.__union_.__unex_; | |
| 611 | } | |
| 612 | } | |
| 613 | } | |
| 614 | ||
| 615 | template <class _T2> | |
| 616 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const _T2& __v) { | |
| 617 | return __x.__has_val_ && static_cast<bool>(__x.__union_.__val_ == __v); | |
| 618 | } | |
| 619 | ||
| 620 | template <class _E2> | |
| 621 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const unexpected<_E2>& __e) { | |
| 622 | return !__x.__has_val_ && static_cast<bool>(__x.__union_.__unex_ == __e.error()); | |
| 623 | } | |
| 624 | ||
| 625 | private: | |
| 626 | struct __empty_t {}; | |
| 627 | // use named union because [[no_unique_address]] cannot be applied to an unnamed union | |
| 628 | _LIBCPP_NO_UNIQUE_ADDRESS union __union_t { | |
| 629 | _LIBCPP_HIDE_FROM_ABI constexpr __union_t() : __empty_() {} | |
| 630 | ||
| 631 | _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() | |
| 632 | requires(is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>) | |
| 633 | = default; | |
| 634 | ||
| 635 | // the expected's destructor handles this | |
| 636 | _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() | |
| 637 | requires(!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>) | |
| 638 | {} | |
| 639 | ||
| 640 | _LIBCPP_NO_UNIQUE_ADDRESS __empty_t __empty_; | |
| 641 | _LIBCPP_NO_UNIQUE_ADDRESS _Tp __val_; | |
| 642 | _LIBCPP_NO_UNIQUE_ADDRESS _Err __unex_; | |
| 643 | } __union_; | |
| 644 | ||
| 645 | bool __has_val_; | |
| 646 | }; | |
| 647 | ||
| 648 | template <class _Tp, class _Err> | |
| 649 | requires is_void_v<_Tp> | |
| 650 | class expected<_Tp, _Err> { | |
| 651 | static_assert(__valid_std_unexpected<_Err>::value, | |
| 652 | "[expected.void.general] A program that instantiates expected<T, E> with a E that is not a " | |
| 653 | "valid argument for unexpected<E> is ill-formed"); | |
| 654 | ||
| 655 | template <class, class> | |
| 656 | friend class expected; | |
| 657 | ||
| 658 | template <class _Up, class _OtherErr, class _OtherErrQual> | |
| 659 | using __can_convert = | |
| 660 | _And< is_void<_Up>, | |
| 661 | is_constructible<_Err, _OtherErrQual>, | |
| 662 | _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>&>>, | |
| 663 | _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>>>, | |
| 664 | _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>&>>, | |
| 665 | _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>>>>; | |
| 666 | ||
| 667 | public: | |
| 668 | using value_type = _Tp; | |
| 669 | using error_type = _Err; | |
| 670 | using unexpected_type = unexpected<_Err>; | |
| 671 | ||
| 672 | template <class _Up> | |
| 673 | using rebind = expected<_Up, error_type>; | |
| 674 | ||
| 675 | // [expected.void.ctor], constructors | |
| 676 | _LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept : __has_val_(true) {} | |
| 677 | ||
| 678 | _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete; | |
| 679 | ||
| 680 | _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) | |
| 681 | requires(is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Err>) | |
| 682 | = default; | |
| 683 | ||
| 684 | _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __rhs) | |
| 685 | noexcept(is_nothrow_copy_constructible_v<_Err>) // strengthened | |
| 686 | requires(is_copy_constructible_v<_Err> && !is_trivially_copy_constructible_v<_Err>) | |
| 687 | : __has_val_(__rhs.__has_val_) { | |
| 688 | if (!__rhs.__has_val_) { | |
| 689 | std::construct_at(std::addressof(__union_.__unex_), __rhs.__union_.__unex_); | |
| 690 | } | |
| 691 | } | |
| 692 | ||
| 693 | _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&) | |
| 694 | requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>) | |
| 695 | = default; | |
| 696 | ||
| 697 | _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __rhs) | |
| 698 | noexcept(is_nothrow_move_constructible_v<_Err>) | |
| 699 | requires(is_move_constructible_v<_Err> && !is_trivially_move_constructible_v<_Err>) | |
| 700 | : __has_val_(__rhs.__has_val_) { | |
| 701 | if (!__rhs.__has_val_) { | |
| 702 | std::construct_at(std::addressof(__union_.__unex_), std::move(__rhs.__union_.__unex_)); | |
| 703 | } | |
| 704 | } | |
| 705 | ||
| 706 | template <class _Up, class _OtherErr> | |
| 707 | requires __can_convert<_Up, _OtherErr, const _OtherErr&>::value | |
| 708 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) | |
| 709 | expected(const expected<_Up, _OtherErr>& __rhs) | |
| 710 | noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened | |
| 711 | : __has_val_(__rhs.__has_val_) { | |
| 712 | if (!__rhs.__has_val_) { | |
| 713 | std::construct_at(std::addressof(__union_.__unex_), __rhs.__union_.__unex_); | |
| 714 | } | |
| 715 | } | |
| 716 | ||
| 717 | template <class _Up, class _OtherErr> | |
| 718 | requires __can_convert<_Up, _OtherErr, _OtherErr>::value | |
| 719 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>) | |
| 720 | expected(expected<_Up, _OtherErr>&& __rhs) | |
| 721 | noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened | |
| 722 | : __has_val_(__rhs.__has_val_) { | |
| 723 | if (!__rhs.__has_val_) { | |
| 724 | std::construct_at(std::addressof(__union_.__unex_), std::move(__rhs.__union_.__unex_)); | |
| 725 | } | |
| 726 | } | |
| 727 | ||
| 728 | template <class _OtherErr> | |
| 729 | requires is_constructible_v<_Err, const _OtherErr&> | |
| 730 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) | |
| 731 | expected(const unexpected<_OtherErr>& __unex) | |
| 732 | noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened | |
| 733 | : __has_val_(false) { | |
| 734 | std::construct_at(std::addressof(__union_.__unex_), __unex.error()); | |
| 735 | } | |
| 736 | ||
| 737 | template <class _OtherErr> | |
| 738 | requires is_constructible_v<_Err, _OtherErr> | |
| 739 | _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>) | |
| 740 | expected(unexpected<_OtherErr>&& __unex) | |
| 741 | noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened | |
| 742 | : __has_val_(false) { | |
| 743 | std::construct_at(std::addressof(__union_.__unex_), std::move(__unex.error())); | |
| 744 | } | |
| 745 | ||
| 746 | _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t) noexcept : __has_val_(true) {} | |
| 747 | ||
| 748 | template <class... _Args> | |
| 749 | requires is_constructible_v<_Err, _Args...> | |
| 750 | _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) | |
| 751 | noexcept(is_nothrow_constructible_v<_Err, _Args...>) // strengthened | |
| 752 | : __has_val_(false) { | |
| 753 | std::construct_at(std::addressof(__union_.__unex_), std::forward<_Args>(__args)...); | |
| 754 | } | |
| 755 | ||
| 756 | template <class _Up, class... _Args> | |
| 757 | requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... > | |
| 758 | _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) | |
| 759 | noexcept(is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened | |
| 760 | : __has_val_(false) { | |
| 761 | std::construct_at(std::addressof(__union_.__unex_), __il, std::forward<_Args>(__args)...); | |
| 762 | } | |
| 763 | ||
| 764 | // [expected.void.dtor], destructor | |
| 765 | ||
| 766 | _LIBCPP_HIDE_FROM_ABI constexpr ~expected() | |
| 767 | requires is_trivially_destructible_v<_Err> | |
| 768 | = default; | |
| 769 | ||
| 770 | _LIBCPP_HIDE_FROM_ABI constexpr ~expected() | |
| 771 | requires(!is_trivially_destructible_v<_Err>) | |
| 772 | { | |
| 773 | if (!__has_val_) { | |
| 774 | std::destroy_at(std::addressof(__union_.__unex_)); | |
| 775 | } | |
| 776 | } | |
| 777 | ||
| 778 | // [expected.void.assign], assignment | |
| 779 | ||
| 780 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete; | |
| 781 | ||
| 782 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) | |
| 783 | noexcept(is_nothrow_copy_assignable_v<_Err> && is_nothrow_copy_constructible_v<_Err>) // strengthened | |
| 784 | requires(is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err>) | |
| 785 | { | |
| 786 | if (__has_val_) { | |
| 787 | if (!__rhs.__has_val_) { | |
| 788 | std::construct_at(std::addressof(__union_.__unex_), __rhs.__union_.__unex_); | |
| 789 | __has_val_ = false; | |
| 790 | } | |
| 791 | } else { | |
| 792 | if (__rhs.__has_val_) { | |
| 793 | std::destroy_at(std::addressof(__union_.__unex_)); | |
| 794 | __has_val_ = true; | |
| 795 | } else { | |
| 796 | __union_.__unex_ = __rhs.__union_.__unex_; | |
| 797 | } | |
| 798 | } | |
| 799 | return *this; | |
| 800 | } | |
| 801 | ||
| 802 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(expected&&) = delete; | |
| 803 | ||
| 804 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(expected&& __rhs) | |
| 805 | noexcept(is_nothrow_move_assignable_v<_Err> && | |
| 806 | is_nothrow_move_constructible_v<_Err>) | |
| 807 | requires(is_move_assignable_v<_Err> && | |
| 808 | is_move_constructible_v<_Err>) | |
| 809 | { | |
| 810 | if (__has_val_) { | |
| 811 | if (!__rhs.__has_val_) { | |
| 812 | std::construct_at(std::addressof(__union_.__unex_), std::move(__rhs.__union_.__unex_)); | |
| 813 | __has_val_ = false; | |
| 814 | } | |
| 815 | } else { | |
| 816 | if (__rhs.__has_val_) { | |
| 817 | std::destroy_at(std::addressof(__union_.__unex_)); | |
| 818 | __has_val_ = true; | |
| 819 | } else { | |
| 820 | __union_.__unex_ = std::move(__rhs.__union_.__unex_); | |
| 821 | } | |
| 822 | } | |
| 823 | return *this; | |
| 824 | } | |
| 825 | ||
| 826 | template <class _OtherErr> | |
| 827 | requires(is_constructible_v<_Err, const _OtherErr&> && is_assignable_v<_Err&, const _OtherErr&>) | |
| 828 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const unexpected<_OtherErr>& __un) { | |
| 829 | if (__has_val_) { | |
| 830 | std::construct_at(std::addressof(__union_.__unex_), __un.error()); | |
| 831 | __has_val_ = false; | |
| 832 | } else { | |
| 833 | __union_.__unex_ = __un.error(); | |
| 834 | } | |
| 835 | return *this; | |
| 836 | } | |
| 837 | ||
| 838 | template <class _OtherErr> | |
| 839 | requires(is_constructible_v<_Err, _OtherErr> && is_assignable_v<_Err&, _OtherErr>) | |
| 840 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(unexpected<_OtherErr>&& __un) { | |
| 841 | if (__has_val_) { | |
| 842 | std::construct_at(std::addressof(__union_.__unex_), std::move(__un.error())); | |
| 843 | __has_val_ = false; | |
| 844 | } else { | |
| 845 | __union_.__unex_ = std::move(__un.error()); | |
| 846 | } | |
| 847 | return *this; | |
| 848 | } | |
| 849 | ||
| 850 | _LIBCPP_HIDE_FROM_ABI constexpr void emplace() noexcept { | |
| 851 | if (!__has_val_) { | |
| 852 | std::destroy_at(std::addressof(__union_.__unex_)); | |
| 853 | __has_val_ = true; | |
| 854 | } | |
| 855 | } | |
| 856 | ||
| 857 | // [expected.void.swap], swap | |
| 858 | _LIBCPP_HIDE_FROM_ABI constexpr void swap(expected& __rhs) | |
| 859 | noexcept(is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Err>) | |
| 860 | requires(is_swappable_v<_Err> && is_move_constructible_v<_Err>) | |
| 861 | { | |
| 862 | auto __swap_val_unex_impl = [&](expected& __with_val, expected& __with_err) { | |
| 863 | std::construct_at(std::addressof(__with_val.__union_.__unex_), std::move(__with_err.__union_.__unex_)); | |
| 864 | std::destroy_at(std::addressof(__with_err.__union_.__unex_)); | |
| 865 | __with_val.__has_val_ = false; | |
| 866 | __with_err.__has_val_ = true; | |
| 867 | }; | |
| 868 | ||
| 869 | if (__has_val_) { | |
| 870 | if (!__rhs.__has_val_) { | |
| 871 | __swap_val_unex_impl(*this, __rhs); | |
| 872 | } | |
| 873 | } else { | |
| 874 | if (__rhs.__has_val_) { | |
| 875 | __swap_val_unex_impl(__rhs, *this); | |
| 876 | } else { | |
| 877 | using std::swap; | |
| 878 | swap(__union_.__unex_, __rhs.__union_.__unex_); | |
| 879 | } | |
| 880 | } | |
| 881 | } | |
| 882 | ||
| 883 | _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y) | |
| 884 | noexcept(noexcept(__x.swap(__y))) | |
| 885 | requires requires { __x.swap(__y); } | |
| 886 | { | |
| 887 | __x.swap(__y); | |
| 888 | } | |
| 889 | ||
| 890 | // [expected.void.obs], observers | |
| 891 | _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __has_val_; } | |
| 892 | ||
| 893 | _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __has_val_; } | |
| 894 | ||
| 895 | _LIBCPP_HIDE_FROM_ABI constexpr void operator*() const noexcept { | |
| 896 | _LIBCPP_ASSERT(__has_val_, "expected::operator* requires the expected to contain a value"); | |
| 897 | } | |
| 898 | ||
| 899 | _LIBCPP_HIDE_FROM_ABI constexpr void value() const& { | |
| 900 | if (!__has_val_) { | |
| 901 | __expected::__throw_bad_expected_access<_Err>(__union_.__unex_); | |
| 902 | } | |
| 903 | } | |
| 904 | ||
| 905 | _LIBCPP_HIDE_FROM_ABI constexpr void value() && { | |
| 906 | if (!__has_val_) { | |
| 907 | __expected::__throw_bad_expected_access<_Err>(std::move(__union_.__unex_)); | |
| 908 | } | |
| 909 | } | |
| 910 | ||
| 911 | _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept { | |
| 912 | _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); | |
| 913 | return __union_.__unex_; | |
| 914 | } | |
| 915 | ||
| 916 | _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept { | |
| 917 | _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); | |
| 918 | return __union_.__unex_; | |
| 919 | } | |
| 920 | ||
| 921 | _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept { | |
| 922 | _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); | |
| 923 | return std::move(__union_.__unex_); | |
| 924 | } | |
| 925 | ||
| 926 | _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept { | |
| 927 | _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); | |
| 928 | return std::move(__union_.__unex_); | |
| 929 | } | |
| 930 | ||
| 931 | // [expected.void.eq], equality operators | |
| 932 | template <class _T2, class _E2> | |
| 933 | requires is_void_v<_T2> | |
| 934 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y) { | |
| 935 | if (__x.__has_val_ != __y.__has_val_) { | |
| 936 | return false; | |
| 937 | } else { | |
| 938 | return __x.__has_val_ || static_cast<bool>(__x.__union_.__unex_ == __y.__union_.__unex_); | |
| 939 | } | |
| 940 | } | |
| 941 | ||
| 942 | template <class _E2> | |
| 943 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const unexpected<_E2>& __y) { | |
| 944 | return !__x.__has_val_ && static_cast<bool>(__x.__union_.__unex_ == __y.error()); | |
| 945 | } | |
| 946 | ||
| 947 | private: | |
| 948 | struct __empty_t {}; | |
| 949 | // use named union because [[no_unique_address]] cannot be applied to an unnamed union | |
| 950 | _LIBCPP_NO_UNIQUE_ADDRESS union __union_t { | |
| 951 | _LIBCPP_HIDE_FROM_ABI constexpr __union_t() : __empty_() {} | |
| 952 | ||
| 953 | _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() | |
| 954 | requires(is_trivially_destructible_v<_Err>) | |
| 955 | = default; | |
| 956 | ||
| 957 | // the expected's destructor handles this | |
| 958 | _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() | |
| 959 | requires(!is_trivially_destructible_v<_Err>) | |
| 960 | {} | |
| 961 | ||
| 962 | _LIBCPP_NO_UNIQUE_ADDRESS __empty_t __empty_; | |
| 963 | _LIBCPP_NO_UNIQUE_ADDRESS _Err __unex_; | |
| 964 | } __union_; | |
| 965 | ||
| 966 | bool __has_val_; | |
| 967 | }; | |
| 968 | ||
| 969 | _LIBCPP_END_NAMESPACE_STD | |
| 970 | ||
| 971 | #endif // _LIBCPP_STD_VER >= 23 | |
| 972 | ||
| 973 | #endif // _LIBCPP___EXPECTED_EXPECTED_H |
lib/libcxx/include/__expected/unexpect.h created+32| ... | ... | @@ -0,0 +1,32 @@ |
| 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 | #ifndef _LIBCPP___EXPECTED_UNEXPECT_H | |
| 10 | #define _LIBCPP___EXPECTED_UNEXPECT_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | ||
| 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 15 | # pragma GCC system_header | |
| 16 | #endif | |
| 17 | ||
| 18 | #if _LIBCPP_STD_VER >= 23 | |
| 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 21 | ||
| 22 | struct unexpect_t { | |
| 23 | _LIBCPP_HIDE_FROM_ABI explicit unexpect_t() = default; | |
| 24 | }; | |
| 25 | ||
| 26 | inline constexpr unexpect_t unexpect{}; | |
| 27 | ||
| 28 | _LIBCPP_END_NAMESPACE_STD | |
| 29 | ||
| 30 | #endif // _LIBCPP_STD_VER >= 23 | |
| 31 | ||
| 32 | #endif // _LIBCPP___EXPECTED_UNEXPECT_H |
lib/libcxx/include/__expected/unexpected.h created+122| ... | ... | @@ -0,0 +1,122 @@ |
| 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 | #ifndef _LIBCPP___EXPECTED_UNEXPECTED_H | |
| 10 | #define _LIBCPP___EXPECTED_UNEXPECTED_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/conjunction.h> | |
| 14 | #include <__type_traits/is_array.h> | |
| 15 | #include <__type_traits/is_const.h> | |
| 16 | #include <__type_traits/is_constructible.h> | |
| 17 | #include <__type_traits/is_nothrow_constructible.h> | |
| 18 | #include <__type_traits/is_object.h> | |
| 19 | #include <__type_traits/is_same.h> | |
| 20 | #include <__type_traits/is_swappable.h> | |
| 21 | #include <__type_traits/is_volatile.h> | |
| 22 | #include <__type_traits/negation.h> | |
| 23 | #include <__type_traits/remove_cvref.h> | |
| 24 | #include <__utility/forward.h> | |
| 25 | #include <__utility/in_place.h> | |
| 26 | #include <__utility/move.h> | |
| 27 | #include <__utility/swap.h> | |
| 28 | #include <initializer_list> | |
| 29 | ||
| 30 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 31 | # pragma GCC system_header | |
| 32 | #endif | |
| 33 | ||
| 34 | #if _LIBCPP_STD_VER >= 23 | |
| 35 | ||
| 36 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 37 | ||
| 38 | template <class _Err> | |
| 39 | class unexpected; | |
| 40 | ||
| 41 | template <class _Tp> | |
| 42 | struct __is_std_unexpected : false_type {}; | |
| 43 | ||
| 44 | template <class _Err> | |
| 45 | struct __is_std_unexpected<unexpected<_Err>> : true_type {}; | |
| 46 | ||
| 47 | template <class _Tp> | |
| 48 | using __valid_std_unexpected = _BoolConstant< // | |
| 49 | is_object_v<_Tp> && // | |
| 50 | !is_array_v<_Tp> && // | |
| 51 | !__is_std_unexpected<_Tp>::value && // | |
| 52 | !is_const_v<_Tp> && // | |
| 53 | !is_volatile_v<_Tp> // | |
| 54 | >; | |
| 55 | ||
| 56 | template <class _Err> | |
| 57 | class unexpected { | |
| 58 | static_assert(__valid_std_unexpected<_Err>::value, | |
| 59 | "[expected.un.general] states a program that instantiates std::unexpected for a non-object type, an " | |
| 60 | "array type, a specialization of unexpected, or a cv-qualified type is ill-formed."); | |
| 61 | ||
| 62 | public: | |
| 63 | _LIBCPP_HIDE_FROM_ABI constexpr unexpected(const unexpected&) = default; | |
| 64 | _LIBCPP_HIDE_FROM_ABI constexpr unexpected(unexpected&&) = default; | |
| 65 | ||
| 66 | template <class _Error = _Err> | |
| 67 | requires(!is_same_v<remove_cvref_t<_Error>, unexpected> && // | |
| 68 | !is_same_v<remove_cvref_t<_Error>, in_place_t> && // | |
| 69 | is_constructible_v<_Err, _Error>) | |
| 70 | _LIBCPP_HIDE_FROM_ABI constexpr explicit unexpected(_Error&& __error) // | |
| 71 | noexcept(is_nothrow_constructible_v<_Err, _Error>) // strengthened | |
| 72 | : __unex_(std::forward<_Error>(__error)) {} | |
| 73 | ||
| 74 | template <class... _Args> | |
| 75 | requires is_constructible_v<_Err, _Args...> | |
| 76 | _LIBCPP_HIDE_FROM_ABI constexpr explicit unexpected(in_place_t, _Args&&... __args) // | |
| 77 | noexcept(is_nothrow_constructible_v<_Err, _Args...>) // strengthened | |
| 78 | : __unex_(std::forward<_Args>(__args)...) {} | |
| 79 | ||
| 80 | template <class _Up, class... _Args> | |
| 81 | requires is_constructible_v<_Err, initializer_list<_Up>&, _Args...> | |
| 82 | _LIBCPP_HIDE_FROM_ABI constexpr explicit unexpected(in_place_t, initializer_list<_Up> __il, _Args&&... __args) // | |
| 83 | noexcept(is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened | |
| 84 | : __unex_(__il, std::forward<_Args>(__args)...) {} | |
| 85 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI constexpr unexpected& operator=(const unexpected&) = default; | |
| 87 | _LIBCPP_HIDE_FROM_ABI constexpr unexpected& operator=(unexpected&&) = default; | |
| 88 | ||
| 89 | _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept { return __unex_; } | |
| 90 | _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept { return __unex_; } | |
| 91 | _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept { return std::move(__unex_); } | |
| 92 | _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept { return std::move(__unex_); } | |
| 93 | ||
| 94 | _LIBCPP_HIDE_FROM_ABI constexpr void swap(unexpected& __other) noexcept(is_nothrow_swappable_v<_Err>) { | |
| 95 | static_assert(is_swappable_v<_Err>, "unexpected::swap requires is_swappable_v<E> to be true"); | |
| 96 | using std::swap; | |
| 97 | swap(__unex_, __other.__unex_); | |
| 98 | } | |
| 99 | ||
| 100 | _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(unexpected& __x, unexpected& __y) noexcept(noexcept(__x.swap(__y))) | |
| 101 | requires is_swappable_v<_Err> | |
| 102 | { | |
| 103 | __x.swap(__y); | |
| 104 | } | |
| 105 | ||
| 106 | template <class _Err2> | |
| 107 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const unexpected& __x, const unexpected<_Err2>& __y) { | |
| 108 | return __x.__unex_ == __y.__unex_; | |
| 109 | } | |
| 110 | ||
| 111 | private: | |
| 112 | _Err __unex_; | |
| 113 | }; | |
| 114 | ||
| 115 | template <class _Err> | |
| 116 | unexpected(_Err) -> unexpected<_Err>; | |
| 117 | ||
| 118 | _LIBCPP_END_NAMESPACE_STD | |
| 119 | ||
| 120 | #endif // _LIBCPP_STD_VER >= 23 | |
| 121 | ||
| 122 | #endif // _LIBCPP___EXPECTED_UNEXPECTED_H |
lib/libcxx/include/__filesystem/directory_entry.h+15-4| ... | ... | @@ -215,21 +215,23 @@ public: |
| 215 | 215 | return __get_symlink_status(&__ec); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | _LIBCPP_INLINE_VISIBILITY | |
| 219 | bool operator<(directory_entry const& __rhs) const noexcept { | |
| 220 | return __p_ < __rhs.__p_; | |
| 221 | } | |
| 222 | 218 | |
| 223 | 219 | _LIBCPP_INLINE_VISIBILITY |
| 224 | 220 | bool operator==(directory_entry const& __rhs) const noexcept { |
| 225 | 221 | return __p_ == __rhs.__p_; |
| 226 | 222 | } |
| 227 | 223 | |
| 224 | #if _LIBCPP_STD_VER <= 17 | |
| 228 | 225 | _LIBCPP_INLINE_VISIBILITY |
| 229 | 226 | bool operator!=(directory_entry const& __rhs) const noexcept { |
| 230 | 227 | return __p_ != __rhs.__p_; |
| 231 | 228 | } |
| 232 | 229 | |
| 230 | _LIBCPP_INLINE_VISIBILITY | |
| 231 | bool operator<(directory_entry const& __rhs) const noexcept { | |
| 232 | return __p_ < __rhs.__p_; | |
| 233 | } | |
| 234 | ||
| 233 | 235 | _LIBCPP_INLINE_VISIBILITY |
| 234 | 236 | bool operator<=(directory_entry const& __rhs) const noexcept { |
| 235 | 237 | return __p_ <= __rhs.__p_; |
| ... | ... | @@ -245,6 +247,15 @@ public: |
| 245 | 247 | return __p_ >= __rhs.__p_; |
| 246 | 248 | } |
| 247 | 249 | |
| 250 | #else // _LIBCPP_STD_VER <= 17 | |
| 251 | ||
| 252 | _LIBCPP_HIDE_FROM_ABI | |
| 253 | strong_ordering operator<=>(const directory_entry& __rhs) const noexcept { | |
| 254 | return __p_ <=> __rhs.__p_; | |
| 255 | } | |
| 256 | ||
| 257 | #endif // _LIBCPP_STD_VER <= 17 | |
| 258 | ||
| 248 | 259 | template <class _CharT, class _Traits> |
| 249 | 260 | _LIBCPP_INLINE_VISIBILITY |
| 250 | 261 | friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const directory_entry& __d) { |
lib/libcxx/include/__filesystem/filesystem_error.h+2-1| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | #include <__config> |
| 15 | 15 | #include <__filesystem/path.h> |
| 16 | 16 | #include <__memory/shared_ptr.h> |
| 17 | #include <__utility/forward.h> | |
| 17 | 18 | #include <iosfwd> |
| 18 | 19 | #include <new> |
| 19 | 20 | #include <system_error> |
| ... | ... | @@ -60,7 +61,7 @@ public: |
| 60 | 61 | filesystem_error(const filesystem_error&) = default; |
| 61 | 62 | ~filesystem_error() override; // key function |
| 62 | 63 | |
| 63 | _LIBCPP_INLINE_VISIBILITY | |
| 64 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL | |
| 64 | 65 | const char* what() const noexcept override { |
| 65 | 66 | return __storage_->__what_.c_str(); |
| 66 | 67 | } |
lib/libcxx/include/__filesystem/path.h+37-30| ... | ... | @@ -141,15 +141,15 @@ struct __is_pathable_string< |
| 141 | 141 | |
| 142 | 142 | template <class _Source, class _DS = typename decay<_Source>::type, |
| 143 | 143 | class _UnqualPtrType = |
| 144 | typename remove_const<typename remove_pointer<_DS>::type>::type, | |
| 144 | __remove_const_t<__remove_pointer_t<_DS> >, | |
| 145 | 145 | bool _IsCharPtr = is_pointer<_DS>::value&& |
| 146 | 146 | __can_convert_char<_UnqualPtrType>::value> |
| 147 | 147 | struct __is_pathable_char_array : false_type {}; |
| 148 | 148 | |
| 149 | 149 | template <class _Source, class _ECharT, class _UPtr> |
| 150 | 150 | struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> |
| 151 | : __can_convert_char<typename remove_const<_ECharT>::type> { | |
| 152 | using _Base = __can_convert_char<typename remove_const<_ECharT>::type>; | |
| 151 | : __can_convert_char<__remove_const_t<_ECharT> > { | |
| 152 | using _Base = __can_convert_char<__remove_const_t<_ECharT> >; | |
| 153 | 153 | |
| 154 | 154 | _LIBCPP_HIDE_FROM_ABI |
| 155 | 155 | static _ECharT const* __range_begin(const _ECharT* __b) { return __b; } |
| ... | ... | @@ -619,7 +619,7 @@ public: |
| 619 | 619 | _EnableIfPathable<_Source> append(const _Source& __src) { |
| 620 | 620 | using _Traits = __is_pathable<_Source>; |
| 621 | 621 | using _CVT = _PathCVT<_SourceChar<_Source> >; |
| 622 | bool __source_is_absolute = __is_separator(_Traits::__first_or_null(__src)); | |
| 622 | bool __source_is_absolute = _VSTD_FS::__is_separator(_Traits::__first_or_null(__src)); | |
| 623 | 623 | if (__source_is_absolute) |
| 624 | 624 | __pn_.clear(); |
| 625 | 625 | else if (has_filename()) |
| ... | ... | @@ -634,7 +634,7 @@ public: |
| 634 | 634 | typedef typename iterator_traits<_InputIt>::value_type _ItVal; |
| 635 | 635 | static_assert(__can_convert_char<_ItVal>::value, "Must convertible"); |
| 636 | 636 | using _CVT = _PathCVT<_ItVal>; |
| 637 | if (__first != __last && __is_separator(*__first)) | |
| 637 | if (__first != __last && _VSTD_FS::__is_separator(*__first)) | |
| 638 | 638 | __pn_.clear(); |
| 639 | 639 | else if (has_filename()) |
| 640 | 640 | __pn_ += preferred_separator; |
| ... | ... | @@ -732,6 +732,37 @@ public: |
| 732 | 732 | |
| 733 | 733 | path& replace_extension(const path& __replacement = path()); |
| 734 | 734 | |
| 735 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const path& __lhs, const path& __rhs) noexcept { | |
| 736 | return __lhs.__compare(__rhs.__pn_) == 0; | |
| 737 | } | |
| 738 | # if _LIBCPP_STD_VER <= 17 | |
| 739 | friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const path& __lhs, const path& __rhs) noexcept { | |
| 740 | return __lhs.__compare(__rhs.__pn_) != 0; | |
| 741 | } | |
| 742 | friend _LIBCPP_HIDE_FROM_ABI bool operator<(const path& __lhs, const path& __rhs) noexcept { | |
| 743 | return __lhs.__compare(__rhs.__pn_) < 0; | |
| 744 | } | |
| 745 | friend _LIBCPP_HIDE_FROM_ABI bool operator<=(const path& __lhs, const path& __rhs) noexcept { | |
| 746 | return __lhs.__compare(__rhs.__pn_) <= 0; | |
| 747 | } | |
| 748 | friend _LIBCPP_HIDE_FROM_ABI bool operator>(const path& __lhs, const path& __rhs) noexcept { | |
| 749 | return __lhs.__compare(__rhs.__pn_) > 0; | |
| 750 | } | |
| 751 | friend _LIBCPP_HIDE_FROM_ABI bool operator>=(const path& __lhs, const path& __rhs) noexcept { | |
| 752 | return __lhs.__compare(__rhs.__pn_) >= 0; | |
| 753 | } | |
| 754 | # else // _LIBCPP_STD_VER <= 17 | |
| 755 | friend _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const path& __lhs, const path& __rhs) noexcept { | |
| 756 | return __lhs.__compare(__rhs.__pn_) <=> 0; | |
| 757 | } | |
| 758 | # endif // _LIBCPP_STD_VER <= 17 | |
| 759 | ||
| 760 | friend _LIBCPP_HIDE_FROM_ABI path operator/(const path& __lhs, const path& __rhs) { | |
| 761 | path __result(__lhs); | |
| 762 | __result /= __rhs; | |
| 763 | return __result; | |
| 764 | } | |
| 765 | ||
| 735 | 766 | _LIBCPP_HIDE_FROM_ABI |
| 736 | 767 | void swap(path& __rhs) noexcept { __pn_.swap(__rhs.__pn_); } |
| 737 | 768 | |
| ... | ... | @@ -835,7 +866,7 @@ public: |
| 835 | 866 | using _Str = basic_string<_ECharT, _Traits, _Allocator>; |
| 836 | 867 | _Str __s(__a); |
| 837 | 868 | __s.reserve(__pn_.size()); |
| 838 | _CVT()(back_inserter(__s), __pn_.data(), __pn_.data() + __pn_.size()); | |
| 869 | _CVT()(std::back_inserter(__s), __pn_.data(), __pn_.data() + __pn_.size()); | |
| 839 | 870 | return __s; |
| 840 | 871 | } |
| 841 | 872 | |
| ... | ... | @@ -1035,30 +1066,6 @@ public: |
| 1035 | 1066 | } |
| 1036 | 1067 | #endif // !_LIBCPP_HAS_NO_LOCALIZATION |
| 1037 | 1068 | |
| 1038 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const path& __lhs, const path& __rhs) noexcept { | |
| 1039 | return __lhs.__compare(__rhs.__pn_) == 0; | |
| 1040 | } | |
| 1041 | friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const path& __lhs, const path& __rhs) noexcept { | |
| 1042 | return __lhs.__compare(__rhs.__pn_) != 0; | |
| 1043 | } | |
| 1044 | friend _LIBCPP_HIDE_FROM_ABI bool operator<(const path& __lhs, const path& __rhs) noexcept { | |
| 1045 | return __lhs.__compare(__rhs.__pn_) < 0; | |
| 1046 | } | |
| 1047 | friend _LIBCPP_HIDE_FROM_ABI bool operator<=(const path& __lhs, const path& __rhs) noexcept { | |
| 1048 | return __lhs.__compare(__rhs.__pn_) <= 0; | |
| 1049 | } | |
| 1050 | friend _LIBCPP_HIDE_FROM_ABI bool operator>(const path& __lhs, const path& __rhs) noexcept { | |
| 1051 | return __lhs.__compare(__rhs.__pn_) > 0; | |
| 1052 | } | |
| 1053 | friend _LIBCPP_HIDE_FROM_ABI bool operator>=(const path& __lhs, const path& __rhs) noexcept { | |
| 1054 | return __lhs.__compare(__rhs.__pn_) >= 0; | |
| 1055 | } | |
| 1056 | ||
| 1057 | friend _LIBCPP_HIDE_FROM_ABI path operator/(const path& __lhs, const path& __rhs) { | |
| 1058 | path __result(__lhs); | |
| 1059 | __result /= __rhs; | |
| 1060 | return __result; | |
| 1061 | } | |
| 1062 | 1069 | private: |
| 1063 | 1070 | inline _LIBCPP_HIDE_FROM_ABI path& |
| 1064 | 1071 | __assign_view(__string_view const& __s) noexcept { |
lib/libcxx/include/__filesystem/space_info.h+4| ... | ... | @@ -28,6 +28,10 @@ struct _LIBCPP_TYPE_VIS space_info { |
| 28 | 28 | uintmax_t capacity; |
| 29 | 29 | uintmax_t free; |
| 30 | 30 | uintmax_t available; |
| 31 | ||
| 32 | # if _LIBCPP_STD_VER > 17 | |
| 33 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(const space_info&, const space_info&) = default; | |
| 34 | # endif | |
| 31 | 35 | }; |
| 32 | 36 | |
| 33 | 37 | _LIBCPP_AVAILABILITY_FILESYSTEM_POP |
lib/libcxx/include/__format/buffer.h+283-79| ... | ... | @@ -11,22 +11,27 @@ |
| 11 | 11 | #define _LIBCPP___FORMAT_BUFFER_H |
| 12 | 12 | |
| 13 | 13 | #include <__algorithm/copy_n.h> |
| 14 | #include <__algorithm/fill_n.h> | |
| 14 | 15 | #include <__algorithm/max.h> |
| 15 | 16 | #include <__algorithm/min.h> |
| 17 | #include <__algorithm/ranges_copy_n.h> | |
| 18 | #include <__algorithm/transform.h> | |
| 16 | 19 | #include <__algorithm/unwrap_iter.h> |
| 20 | #include <__concepts/same_as.h> | |
| 17 | 21 | #include <__config> |
| 22 | #include <__format/concepts.h> | |
| 18 | 23 | #include <__format/enable_insertable.h> |
| 19 | 24 | #include <__format/format_to_n_result.h> |
| 20 | #include <__format/formatter.h> // for __char_type TODO FMT Move the concept? | |
| 21 | 25 | #include <__iterator/back_insert_iterator.h> |
| 22 | 26 | #include <__iterator/concepts.h> |
| 23 | 27 | #include <__iterator/incrementable_traits.h> |
| 24 | 28 | #include <__iterator/iterator_traits.h> |
| 25 | 29 | #include <__iterator/wrap_iter.h> |
| 26 | 30 | #include <__utility/move.h> |
| 27 | #include <concepts> | |
| 28 | 31 | #include <cstddef> |
| 32 | #include <string_view> | |
| 29 | 33 | #include <type_traits> |
| 34 | #include <vector> | |
| 30 | 35 | |
| 31 | 36 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 32 | 37 | # pragma GCC system_header |
| ... | ... | @@ -46,41 +51,125 @@ namespace __format { |
| 46 | 51 | /// This helper is used together with the @ref back_insert_iterator to offer |
| 47 | 52 | /// type-erasure for the formatting functions. This reduces the number to |
| 48 | 53 | /// template instantiations. |
| 49 | template <__formatter::__char_type _CharT> | |
| 54 | template <__fmt_char_type _CharT> | |
| 50 | 55 | class _LIBCPP_TEMPLATE_VIS __output_buffer { |
| 51 | 56 | public: |
| 52 | 57 | using value_type = _CharT; |
| 53 | 58 | |
| 54 | 59 | template <class _Tp> |
| 55 | _LIBCPP_HIDE_FROM_ABI explicit __output_buffer(_CharT* __ptr, | |
| 56 | size_t __capacity, _Tp* __obj) | |
| 57 | : __ptr_(__ptr), __capacity_(__capacity), | |
| 58 | __flush_([](_CharT* __p, size_t __size, void* __o) { | |
| 59 | static_cast<_Tp*>(__o)->flush(__p, __size); | |
| 60 | }), | |
| 60 | _LIBCPP_HIDE_FROM_ABI explicit __output_buffer(_CharT* __ptr, size_t __capacity, _Tp* __obj) | |
| 61 | : __ptr_(__ptr), | |
| 62 | __capacity_(__capacity), | |
| 63 | __flush_([](_CharT* __p, size_t __n, void* __o) { static_cast<_Tp*>(__o)->__flush(__p, __n); }), | |
| 61 | 64 | __obj_(__obj) {} |
| 62 | 65 | |
| 63 | _LIBCPP_HIDE_FROM_ABI void reset(_CharT* __ptr, size_t __capacity) { | |
| 66 | _LIBCPP_HIDE_FROM_ABI void __reset(_CharT* __ptr, size_t __capacity) { | |
| 64 | 67 | __ptr_ = __ptr; |
| 65 | 68 | __capacity_ = __capacity; |
| 66 | 69 | } |
| 67 | 70 | |
| 68 | _LIBCPP_HIDE_FROM_ABI auto make_output_iterator() { | |
| 69 | return back_insert_iterator{*this}; | |
| 70 | } | |
| 71 | _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return std::back_insert_iterator{*this}; } | |
| 71 | 72 | |
| 72 | // TODO FMT It would be nice to have an overload taking a | |
| 73 | // basic_string_view<_CharT> and append it directly. | |
| 73 | // Used in std::back_insert_iterator. | |
| 74 | 74 | _LIBCPP_HIDE_FROM_ABI void push_back(_CharT __c) { |
| 75 | 75 | __ptr_[__size_++] = __c; |
| 76 | 76 | |
| 77 | 77 | // Profiling showed flushing after adding is more efficient than flushing |
| 78 | 78 | // when entering the function. |
| 79 | 79 | if (__size_ == __capacity_) |
| 80 | flush(); | |
| 80 | __flush(); | |
| 81 | } | |
| 82 | ||
| 83 | /// Copies the input __str to the buffer. | |
| 84 | /// | |
| 85 | /// Since some of the input is generated by std::to_chars, there needs to be a | |
| 86 | /// conversion when _CharT is wchar_t. | |
| 87 | template <__fmt_char_type _InCharT> | |
| 88 | _LIBCPP_HIDE_FROM_ABI void __copy(basic_string_view<_InCharT> __str) { | |
| 89 | // When the underlying iterator is a simple iterator the __capacity_ is | |
| 90 | // infinite. For a string or container back_inserter it isn't. This means | |
| 91 | // adding a large string the the buffer can cause some overhead. In that | |
| 92 | // case a better approach could be: | |
| 93 | // - flush the buffer | |
| 94 | // - container.append(__str.begin(), __str.end()); | |
| 95 | // The same holds true for the fill. | |
| 96 | // For transform it might be slightly harder, however the use case for | |
| 97 | // transform is slightly less common; it converts hexadecimal values to | |
| 98 | // upper case. For integral these strings are short. | |
| 99 | // TODO FMT Look at the improvements above. | |
| 100 | size_t __n = __str.size(); | |
| 101 | ||
| 102 | __flush_on_overflow(__n); | |
| 103 | if (__n <= __capacity_) { | |
| 104 | _VSTD::copy_n(__str.data(), __n, _VSTD::addressof(__ptr_[__size_])); | |
| 105 | __size_ += __n; | |
| 106 | return; | |
| 107 | } | |
| 108 | ||
| 109 | // The output doesn't fit in the internal buffer. | |
| 110 | // Copy the data in "__capacity_" sized chunks. | |
| 111 | _LIBCPP_ASSERT(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); | |
| 112 | const _InCharT* __first = __str.data(); | |
| 113 | do { | |
| 114 | size_t __chunk = _VSTD::min(__n, __capacity_); | |
| 115 | _VSTD::copy_n(__first, __chunk, _VSTD::addressof(__ptr_[__size_])); | |
| 116 | __size_ = __chunk; | |
| 117 | __first += __chunk; | |
| 118 | __n -= __chunk; | |
| 119 | __flush(); | |
| 120 | } while (__n); | |
| 121 | } | |
| 122 | ||
| 123 | /// A std::transform wrapper. | |
| 124 | /// | |
| 125 | /// Like @ref __copy it may need to do type conversion. | |
| 126 | template <__fmt_char_type _InCharT, class _UnaryOperation> | |
| 127 | _LIBCPP_HIDE_FROM_ABI void __transform(const _InCharT* __first, const _InCharT* __last, _UnaryOperation __operation) { | |
| 128 | _LIBCPP_ASSERT(__first <= __last, "not a valid range"); | |
| 129 | ||
| 130 | size_t __n = static_cast<size_t>(__last - __first); | |
| 131 | __flush_on_overflow(__n); | |
| 132 | if (__n <= __capacity_) { | |
| 133 | _VSTD::transform(__first, __last, _VSTD::addressof(__ptr_[__size_]), _VSTD::move(__operation)); | |
| 134 | __size_ += __n; | |
| 135 | return; | |
| 136 | } | |
| 137 | ||
| 138 | // The output doesn't fit in the internal buffer. | |
| 139 | // Transform the data in "__capacity_" sized chunks. | |
| 140 | _LIBCPP_ASSERT(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); | |
| 141 | do { | |
| 142 | size_t __chunk = _VSTD::min(__n, __capacity_); | |
| 143 | _VSTD::transform(__first, __first + __chunk, _VSTD::addressof(__ptr_[__size_]), __operation); | |
| 144 | __size_ = __chunk; | |
| 145 | __first += __chunk; | |
| 146 | __n -= __chunk; | |
| 147 | __flush(); | |
| 148 | } while (__n); | |
| 149 | } | |
| 150 | ||
| 151 | /// A \c fill_n wrapper. | |
| 152 | _LIBCPP_HIDE_FROM_ABI void __fill(size_t __n, _CharT __value) { | |
| 153 | __flush_on_overflow(__n); | |
| 154 | if (__n <= __capacity_) { | |
| 155 | _VSTD::fill_n(_VSTD::addressof(__ptr_[__size_]), __n, __value); | |
| 156 | __size_ += __n; | |
| 157 | return; | |
| 158 | } | |
| 159 | ||
| 160 | // The output doesn't fit in the internal buffer. | |
| 161 | // Fill the buffer in "__capacity_" sized chunks. | |
| 162 | _LIBCPP_ASSERT(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); | |
| 163 | do { | |
| 164 | size_t __chunk = _VSTD::min(__n, __capacity_); | |
| 165 | _VSTD::fill_n(_VSTD::addressof(__ptr_[__size_]), __chunk, __value); | |
| 166 | __size_ = __chunk; | |
| 167 | __n -= __chunk; | |
| 168 | __flush(); | |
| 169 | } while (__n); | |
| 81 | 170 | } |
| 82 | 171 | |
| 83 | _LIBCPP_HIDE_FROM_ABI void flush() { | |
| 172 | _LIBCPP_HIDE_FROM_ABI void __flush() { | |
| 84 | 173 | __flush_(__ptr_, __size_, __obj_); |
| 85 | 174 | __size_ = 0; |
| 86 | 175 | } |
| ... | ... | @@ -91,16 +180,54 @@ private: |
| 91 | 180 | size_t __size_{0}; |
| 92 | 181 | void (*__flush_)(_CharT*, size_t, void*); |
| 93 | 182 | void* __obj_; |
| 183 | ||
| 184 | /// Flushes the buffer when the output operation would overflow the buffer. | |
| 185 | /// | |
| 186 | /// A simple approach for the overflow detection would be something along the | |
| 187 | /// lines: | |
| 188 | /// \code | |
| 189 | /// // The internal buffer is large enough. | |
| 190 | /// if (__n <= __capacity_) { | |
| 191 | /// // Flush when we really would overflow. | |
| 192 | /// if (__size_ + __n >= __capacity_) | |
| 193 | /// __flush(); | |
| 194 | /// ... | |
| 195 | /// } | |
| 196 | /// \endcode | |
| 197 | /// | |
| 198 | /// This approach works for all cases but one: | |
| 199 | /// A __format_to_n_buffer_base where \ref __enable_direct_output is true. | |
| 200 | /// In that case the \ref __capacity_ of the buffer changes during the first | |
| 201 | /// \ref __flush. During that operation the output buffer switches from its | |
| 202 | /// __writer_ to its __storage_. The \ref __capacity_ of the former depends | |
| 203 | /// on the value of n, of the latter is a fixed size. For example: | |
| 204 | /// - a format_to_n call with a 10'000 char buffer, | |
| 205 | /// - the buffer is filled with 9'500 chars, | |
| 206 | /// - adding 1'000 elements would overflow the buffer so the buffer gets | |
| 207 | /// changed and the \ref __capacity_ decreases from 10'000 to | |
| 208 | /// __buffer_size (256 at the time of writing). | |
| 209 | /// | |
| 210 | /// This means that the \ref __flush for this class may need to copy a part of | |
| 211 | /// the internal buffer to the proper output. In this example there will be | |
| 212 | /// 500 characters that need this copy operation. | |
| 213 | /// | |
| 214 | /// Note it would be more efficient to write 500 chars directly and then swap | |
| 215 | /// the buffers. This would make the code more complex and \ref format_to_n is | |
| 216 | /// not the most common use case. Therefore the optimization isn't done. | |
| 217 | _LIBCPP_HIDE_FROM_ABI void __flush_on_overflow(size_t __n) { | |
| 218 | if (__size_ + __n >= __capacity_) | |
| 219 | __flush(); | |
| 220 | } | |
| 94 | 221 | }; |
| 95 | 222 | |
| 96 | 223 | /// A storage using an internal buffer. |
| 97 | 224 | /// |
| 98 | 225 | /// This storage is used when writing a single element to the output iterator |
| 99 | 226 | /// is expensive. |
| 100 | template <__formatter::__char_type _CharT> | |
| 227 | template <__fmt_char_type _CharT> | |
| 101 | 228 | class _LIBCPP_TEMPLATE_VIS __internal_storage { |
| 102 | 229 | public: |
| 103 | _LIBCPP_HIDE_FROM_ABI _CharT* begin() { return __buffer_; } | |
| 230 | _LIBCPP_HIDE_FROM_ABI _CharT* __begin() { return __buffer_; } | |
| 104 | 231 | |
| 105 | 232 | static constexpr size_t __buffer_size = 256 / sizeof(_CharT); |
| 106 | 233 | |
| ... | ... | @@ -113,11 +240,11 @@ private: |
| 113 | 240 | /// This requires the storage to be a contiguous buffer of \a _CharT. |
| 114 | 241 | /// Since the output is directly written to the underlying storage this class |
| 115 | 242 | /// is just an empty class. |
| 116 | template <__formatter::__char_type _CharT> | |
| 243 | template <__fmt_char_type _CharT> | |
| 117 | 244 | class _LIBCPP_TEMPLATE_VIS __direct_storage {}; |
| 118 | 245 | |
| 119 | 246 | template <class _OutIt, class _CharT> |
| 120 | concept __enable_direct_output = __formatter::__char_type<_CharT> && | |
| 247 | concept __enable_direct_output = __fmt_char_type<_CharT> && | |
| 121 | 248 | (same_as<_OutIt, _CharT*> |
| 122 | 249 | #ifndef _LIBCPP_ENABLE_DEBUG_MODE |
| 123 | 250 | || same_as<_OutIt, __wrap_iter<_CharT*>> |
| ... | ... | @@ -125,18 +252,18 @@ concept __enable_direct_output = __formatter::__char_type<_CharT> && |
| 125 | 252 | ); |
| 126 | 253 | |
| 127 | 254 | /// Write policy for directly writing to the underlying output. |
| 128 | template <class _OutIt, __formatter::__char_type _CharT> | |
| 255 | template <class _OutIt, __fmt_char_type _CharT> | |
| 129 | 256 | class _LIBCPP_TEMPLATE_VIS __writer_direct { |
| 130 | 257 | public: |
| 131 | 258 | _LIBCPP_HIDE_FROM_ABI explicit __writer_direct(_OutIt __out_it) |
| 132 | 259 | : __out_it_(__out_it) {} |
| 133 | 260 | |
| 134 | _LIBCPP_HIDE_FROM_ABI auto out() { return __out_it_; } | |
| 261 | _LIBCPP_HIDE_FROM_ABI _OutIt __out_it() { return __out_it_; } | |
| 135 | 262 | |
| 136 | _LIBCPP_HIDE_FROM_ABI void flush(_CharT*, size_t __size) { | |
| 263 | _LIBCPP_HIDE_FROM_ABI void __flush(_CharT*, size_t __n) { | |
| 137 | 264 | // _OutIt can be a __wrap_iter<CharT*>. Therefore the original iterator |
| 138 | 265 | // is adjusted. |
| 139 | __out_it_ += __size; | |
| 266 | __out_it_ += __n; | |
| 140 | 267 | } |
| 141 | 268 | |
| 142 | 269 | private: |
| ... | ... | @@ -144,16 +271,16 @@ private: |
| 144 | 271 | }; |
| 145 | 272 | |
| 146 | 273 | /// Write policy for copying the buffer to the output. |
| 147 | template <class _OutIt, __formatter::__char_type _CharT> | |
| 274 | template <class _OutIt, __fmt_char_type _CharT> | |
| 148 | 275 | class _LIBCPP_TEMPLATE_VIS __writer_iterator { |
| 149 | 276 | public: |
| 150 | 277 | _LIBCPP_HIDE_FROM_ABI explicit __writer_iterator(_OutIt __out_it) |
| 151 | 278 | : __out_it_{_VSTD::move(__out_it)} {} |
| 152 | 279 | |
| 153 | _LIBCPP_HIDE_FROM_ABI auto out() { return __out_it_; } | |
| 280 | _LIBCPP_HIDE_FROM_ABI _OutIt __out_it() && { return std::move(__out_it_); } | |
| 154 | 281 | |
| 155 | _LIBCPP_HIDE_FROM_ABI void flush(_CharT* __ptr, size_t __size) { | |
| 156 | __out_it_ = _VSTD::copy_n(__ptr, __size, _VSTD::move(__out_it_)); | |
| 282 | _LIBCPP_HIDE_FROM_ABI void __flush(_CharT* __ptr, size_t __n) { | |
| 283 | __out_it_ = std::ranges::copy_n(__ptr, __n, std::move(__out_it_)).out; | |
| 157 | 284 | } |
| 158 | 285 | |
| 159 | 286 | private: |
| ... | ... | @@ -169,7 +296,7 @@ private: |
| 169 | 296 | /// \ref __enable_insertable. |
| 170 | 297 | template <class _Container> |
| 171 | 298 | concept __insertable = |
| 172 | __enable_insertable<_Container> && __formatter::__char_type<typename _Container::value_type> && | |
| 299 | __enable_insertable<_Container> && __fmt_char_type<typename _Container::value_type> && | |
| 173 | 300 | requires(_Container& __t, add_pointer_t<typename _Container::value_type> __first, |
| 174 | 301 | add_pointer_t<typename _Container::value_type> __last) { __t.insert(__t.end(), __first, __last); }; |
| 175 | 302 | |
| ... | ... | @@ -193,10 +320,10 @@ public: |
| 193 | 320 | _LIBCPP_HIDE_FROM_ABI explicit __writer_container(back_insert_iterator<_Container> __out_it) |
| 194 | 321 | : __container_{__out_it.__get_container()} {} |
| 195 | 322 | |
| 196 | _LIBCPP_HIDE_FROM_ABI auto out() { return back_inserter(*__container_); } | |
| 323 | _LIBCPP_HIDE_FROM_ABI auto __out_it() { return std::back_inserter(*__container_); } | |
| 197 | 324 | |
| 198 | _LIBCPP_HIDE_FROM_ABI void flush(_CharT* __ptr, size_t __size) { | |
| 199 | __container_->insert(__container_->end(), __ptr, __ptr + __size); | |
| 325 | _LIBCPP_HIDE_FROM_ABI void __flush(_CharT* __ptr, size_t __n) { | |
| 326 | __container_->insert(__container_->end(), __ptr, __ptr + __n); | |
| 200 | 327 | } |
| 201 | 328 | |
| 202 | 329 | private: |
| ... | ... | @@ -215,7 +342,7 @@ public: |
| 215 | 342 | }; |
| 216 | 343 | |
| 217 | 344 | /// The generic formatting buffer. |
| 218 | template <class _OutIt, __formatter::__char_type _CharT> | |
| 345 | template <class _OutIt, __fmt_char_type _CharT> | |
| 219 | 346 | requires(output_iterator<_OutIt, const _CharT&>) class _LIBCPP_TEMPLATE_VIS |
| 220 | 347 | __format_buffer { |
| 221 | 348 | using _Storage = |
| ... | ... | @@ -225,24 +352,20 @@ requires(output_iterator<_OutIt, const _CharT&>) class _LIBCPP_TEMPLATE_VIS |
| 225 | 352 | public: |
| 226 | 353 | _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it) |
| 227 | 354 | requires(same_as<_Storage, __internal_storage<_CharT>>) |
| 228 | : __output_(__storage_.begin(), __storage_.__buffer_size, this), __writer_(_VSTD::move(__out_it)) {} | |
| 355 | : __output_(__storage_.__begin(), __storage_.__buffer_size, this), __writer_(_VSTD::move(__out_it)) {} | |
| 229 | 356 | |
| 230 | 357 | _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it) requires( |
| 231 | 358 | same_as<_Storage, __direct_storage<_CharT>>) |
| 232 | 359 | : __output_(_VSTD::__unwrap_iter(__out_it), size_t(-1), this), |
| 233 | 360 | __writer_(_VSTD::move(__out_it)) {} |
| 234 | 361 | |
| 235 | _LIBCPP_HIDE_FROM_ABI auto make_output_iterator() { | |
| 236 | return __output_.make_output_iterator(); | |
| 237 | } | |
| 362 | _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return __output_.__make_output_iterator(); } | |
| 238 | 363 | |
| 239 | _LIBCPP_HIDE_FROM_ABI void flush(_CharT* __ptr, size_t __size) { | |
| 240 | __writer_.flush(__ptr, __size); | |
| 241 | } | |
| 364 | _LIBCPP_HIDE_FROM_ABI void __flush(_CharT* __ptr, size_t __n) { __writer_.__flush(__ptr, __n); } | |
| 242 | 365 | |
| 243 | _LIBCPP_HIDE_FROM_ABI _OutIt out() && { | |
| 244 | __output_.flush(); | |
| 245 | return _VSTD::move(__writer_).out(); | |
| 366 | _LIBCPP_HIDE_FROM_ABI _OutIt __out_it() && { | |
| 367 | __output_.__flush(); | |
| 368 | return _VSTD::move(__writer_).__out_it(); | |
| 246 | 369 | } |
| 247 | 370 | |
| 248 | 371 | private: |
| ... | ... | @@ -255,46 +378,46 @@ private: |
| 255 | 378 | /// |
| 256 | 379 | /// Since \ref formatted_size only needs to know the size, the output itself is |
| 257 | 380 | /// discarded. |
| 258 | template <__formatter::__char_type _CharT> | |
| 381 | template <__fmt_char_type _CharT> | |
| 259 | 382 | class _LIBCPP_TEMPLATE_VIS __formatted_size_buffer { |
| 260 | 383 | public: |
| 261 | _LIBCPP_HIDE_FROM_ABI auto make_output_iterator() { return __output_.make_output_iterator(); } | |
| 384 | _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return __output_.__make_output_iterator(); } | |
| 262 | 385 | |
| 263 | _LIBCPP_HIDE_FROM_ABI void flush(const _CharT*, size_t __size) { __size_ += __size; } | |
| 386 | _LIBCPP_HIDE_FROM_ABI void __flush(const _CharT*, size_t __n) { __size_ += __n; } | |
| 264 | 387 | |
| 265 | _LIBCPP_HIDE_FROM_ABI size_t result() && { | |
| 266 | __output_.flush(); | |
| 388 | _LIBCPP_HIDE_FROM_ABI size_t __result() && { | |
| 389 | __output_.__flush(); | |
| 267 | 390 | return __size_; |
| 268 | 391 | } |
| 269 | 392 | |
| 270 | 393 | private: |
| 271 | 394 | __internal_storage<_CharT> __storage_; |
| 272 | __output_buffer<_CharT> __output_{__storage_.begin(), __storage_.__buffer_size, this}; | |
| 395 | __output_buffer<_CharT> __output_{__storage_.__begin(), __storage_.__buffer_size, this}; | |
| 273 | 396 | size_t __size_{0}; |
| 274 | 397 | }; |
| 275 | 398 | |
| 276 | 399 | /// The base of a buffer that counts and limits the number of insertions. |
| 277 | template <class _OutIt, __formatter::__char_type _CharT, bool> | |
| 400 | template <class _OutIt, __fmt_char_type _CharT, bool> | |
| 278 | 401 | requires(output_iterator<_OutIt, const _CharT&>) |
| 279 | 402 | struct _LIBCPP_TEMPLATE_VIS __format_to_n_buffer_base { |
| 280 | 403 | using _Size = iter_difference_t<_OutIt>; |
| 281 | 404 | |
| 282 | 405 | public: |
| 283 | _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer_base(_OutIt __out_it, _Size __n) | |
| 284 | : __writer_(_VSTD::move(__out_it)), __n_(_VSTD::max(_Size(0), __n)) {} | |
| 406 | _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer_base(_OutIt __out_it, _Size __max_size) | |
| 407 | : __writer_(_VSTD::move(__out_it)), __max_size_(_VSTD::max(_Size(0), __max_size)) {} | |
| 285 | 408 | |
| 286 | _LIBCPP_HIDE_FROM_ABI void flush(_CharT* __ptr, size_t __size) { | |
| 287 | if (_Size(__size_) <= __n_) | |
| 288 | __writer_.flush(__ptr, _VSTD::min(_Size(__size), __n_ - __size_)); | |
| 289 | __size_ += __size; | |
| 409 | _LIBCPP_HIDE_FROM_ABI void __flush(_CharT* __ptr, size_t __n) { | |
| 410 | if (_Size(__size_) <= __max_size_) | |
| 411 | __writer_.__flush(__ptr, _VSTD::min(_Size(__n), __max_size_ - __size_)); | |
| 412 | __size_ += __n; | |
| 290 | 413 | } |
| 291 | 414 | |
| 292 | 415 | protected: |
| 293 | 416 | __internal_storage<_CharT> __storage_; |
| 294 | __output_buffer<_CharT> __output_{__storage_.begin(), __storage_.__buffer_size, this}; | |
| 417 | __output_buffer<_CharT> __output_{__storage_.__begin(), __storage_.__buffer_size, this}; | |
| 295 | 418 | typename __writer_selector<_OutIt, _CharT>::type __writer_; |
| 296 | 419 | |
| 297 | _Size __n_; | |
| 420 | _Size __max_size_; | |
| 298 | 421 | _Size __size_{0}; |
| 299 | 422 | }; |
| 300 | 423 | |
| ... | ... | @@ -302,35 +425,46 @@ protected: |
| 302 | 425 | /// |
| 303 | 426 | /// This version is used when \c __enable_direct_output<_OutIt, _CharT> == true. |
| 304 | 427 | /// |
| 305 | /// This class limits the size available the the direct writer so it will not | |
| 428 | /// This class limits the size available to the direct writer so it will not | |
| 306 | 429 | /// exceed the maximum number of code units. |
| 307 | template <class _OutIt, __formatter::__char_type _CharT> | |
| 430 | template <class _OutIt, __fmt_char_type _CharT> | |
| 308 | 431 | requires(output_iterator<_OutIt, const _CharT&>) |
| 309 | 432 | class _LIBCPP_TEMPLATE_VIS __format_to_n_buffer_base<_OutIt, _CharT, true> { |
| 310 | 433 | using _Size = iter_difference_t<_OutIt>; |
| 311 | 434 | |
| 312 | 435 | public: |
| 313 | _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer_base(_OutIt __out_it, _Size __n) | |
| 314 | : __output_(_VSTD::__unwrap_iter(__out_it), __n, this), __writer_(_VSTD::move(__out_it)) { | |
| 315 | if (__n <= 0) [[unlikely]] | |
| 316 | __output_.reset(__storage_.begin(), __storage_.__buffer_size); | |
| 436 | _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer_base(_OutIt __out_it, _Size __max_size) | |
| 437 | : __output_(_VSTD::__unwrap_iter(__out_it), __max_size, this), | |
| 438 | __writer_(_VSTD::move(__out_it)), | |
| 439 | __max_size_(__max_size) { | |
| 440 | if (__max_size <= 0) [[unlikely]] | |
| 441 | __output_.__reset(__storage_.__begin(), __storage_.__buffer_size); | |
| 317 | 442 | } |
| 318 | 443 | |
| 319 | _LIBCPP_HIDE_FROM_ABI void flush(_CharT* __ptr, size_t __size) { | |
| 320 | // A flush to the direct writer happens in two occasions: | |
| 444 | _LIBCPP_HIDE_FROM_ABI void __flush(_CharT* __ptr, size_t __n) { | |
| 445 | // A __flush to the direct writer happens in the following occasions: | |
| 321 | 446 | // - The format function has written the maximum number of allowed code |
| 322 | 447 | // units. At this point it's no longer valid to write to this writer. So |
| 323 | 448 | // switch to the internal storage. This internal storage doesn't need to |
| 324 | // be written anywhere so the flush for that storage writes no output. | |
| 449 | // be written anywhere so the __flush for that storage writes no output. | |
| 450 | // - Like above, but the next "mass write" operation would overflow the | |
| 451 | // buffer. In that case the buffer is pre-emptively switched. The still | |
| 452 | // valid code units will be written separately. | |
| 325 | 453 | // - The format_to_n function is finished. In this case there's no need to |
| 326 | 454 | // switch the buffer, but for simplicity the buffers are still switched. |
| 327 | // When the __n <= 0 the constructor already switched the buffers. | |
| 328 | if (__size_ == 0 && __ptr != __storage_.begin()) { | |
| 329 | __writer_.flush(__ptr, __size); | |
| 330 | __output_.reset(__storage_.begin(), __storage_.__buffer_size); | |
| 455 | // When the __max_size <= 0 the constructor already switched the buffers. | |
| 456 | if (__size_ == 0 && __ptr != __storage_.__begin()) { | |
| 457 | __writer_.__flush(__ptr, __n); | |
| 458 | __output_.__reset(__storage_.__begin(), __storage_.__buffer_size); | |
| 459 | } else if (__size_ < __max_size_) { | |
| 460 | // Copies a part of the internal buffer to the output up to n characters. | |
| 461 | // See __output_buffer<_CharT>::__flush_on_overflow for more information. | |
| 462 | _Size __s = _VSTD::min(_Size(__n), __max_size_ - __size_); | |
| 463 | std::copy_n(__ptr, __s, __writer_.__out_it()); | |
| 464 | __writer_.__flush(__ptr, __s); | |
| 331 | 465 | } |
| 332 | 466 | |
| 333 | __size_ += __size; | |
| 467 | __size_ += __n; | |
| 334 | 468 | } |
| 335 | 469 | |
| 336 | 470 | protected: |
| ... | ... | @@ -338,11 +472,12 @@ protected: |
| 338 | 472 | __output_buffer<_CharT> __output_; |
| 339 | 473 | __writer_direct<_OutIt, _CharT> __writer_; |
| 340 | 474 | |
| 475 | _Size __max_size_; | |
| 341 | 476 | _Size __size_{0}; |
| 342 | 477 | }; |
| 343 | 478 | |
| 344 | 479 | /// The buffer that counts and limits the number of insertions. |
| 345 | template <class _OutIt, __formatter::__char_type _CharT> | |
| 480 | template <class _OutIt, __fmt_char_type _CharT> | |
| 346 | 481 | requires(output_iterator<_OutIt, const _CharT&>) |
| 347 | 482 | struct _LIBCPP_TEMPLATE_VIS __format_to_n_buffer final |
| 348 | 483 | : public __format_to_n_buffer_base< _OutIt, _CharT, __enable_direct_output<_OutIt, _CharT>> { |
| ... | ... | @@ -350,14 +485,83 @@ struct _LIBCPP_TEMPLATE_VIS __format_to_n_buffer final |
| 350 | 485 | using _Size = iter_difference_t<_OutIt>; |
| 351 | 486 | |
| 352 | 487 | public: |
| 353 | _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer(_OutIt __out_it, _Size __n) : _Base(_VSTD::move(__out_it), __n) {} | |
| 354 | _LIBCPP_HIDE_FROM_ABI auto make_output_iterator() { return this->__output_.make_output_iterator(); } | |
| 488 | _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer(_OutIt __out_it, _Size __max_size) | |
| 489 | : _Base(_VSTD::move(__out_it), __max_size) {} | |
| 490 | _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return this->__output_.__make_output_iterator(); } | |
| 491 | ||
| 492 | _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __result() && { | |
| 493 | this->__output_.__flush(); | |
| 494 | return {_VSTD::move(this->__writer_).__out_it(), this->__size_}; | |
| 495 | } | |
| 496 | }; | |
| 497 | ||
| 498 | // A dynamically growing buffer intended to be used for retargeting a context. | |
| 499 | // | |
| 500 | // P2286 Formatting ranges adds range formatting support. It allows the user to | |
| 501 | // specify the minimum width for the entire formatted range. The width of the | |
| 502 | // range is not known until the range is formatted. Formatting is done to an | |
| 503 | // output_iterator so there's no guarantee it would be possible to add the fill | |
| 504 | // to the front of the output. Instead the range is formatted to a temporary | |
| 505 | // buffer and that buffer is formatted as a string. | |
| 506 | // | |
| 507 | // There is an issue with that approach, the format context used in | |
| 508 | // std::formatter<T>::format contains the output iterator used as part of its | |
| 509 | // type. So using this output iterator means there needs to be a new format | |
| 510 | // context and the format arguments need to be retargeted to the new context. | |
| 511 | // This retargeting is done by a basic_format_context specialized for the | |
| 512 | // __iterator of this container. | |
| 513 | template <__fmt_char_type _CharT> | |
| 514 | class _LIBCPP_TEMPLATE_VIS __retarget_buffer { | |
| 515 | public: | |
| 516 | using value_type = _CharT; | |
| 517 | ||
| 518 | struct __iterator { | |
| 519 | using difference_type = ptrdiff_t; | |
| 520 | ||
| 521 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(__retarget_buffer& __buffer) | |
| 522 | : __buffer_(std::addressof(__buffer)) {} | |
| 523 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator=(const _CharT& __c) { | |
| 524 | __buffer_->push_back(__c); | |
| 525 | return *this; | |
| 526 | } | |
| 527 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator=(_CharT&& __c) { | |
| 528 | __buffer_->push_back(__c); | |
| 529 | return *this; | |
| 530 | } | |
| 531 | ||
| 532 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator*() { return *this; } | |
| 533 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { return *this; } | |
| 534 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) { return *this; } | |
| 535 | __retarget_buffer* __buffer_; | |
| 536 | }; | |
| 355 | 537 | |
| 356 | _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> result() && { | |
| 357 | this->__output_.flush(); | |
| 358 | return {_VSTD::move(this->__writer_).out(), this->__size_}; | |
| 538 | _LIBCPP_HIDE_FROM_ABI explicit __retarget_buffer(size_t __size_hint) { __buffer_.reserve(__size_hint); } | |
| 539 | ||
| 540 | _LIBCPP_HIDE_FROM_ABI __iterator __make_output_iterator() { return __iterator{*this}; } | |
| 541 | ||
| 542 | _LIBCPP_HIDE_FROM_ABI void push_back(_CharT __c) { __buffer_.push_back(__c); } | |
| 543 | ||
| 544 | template <__fmt_char_type _InCharT> | |
| 545 | _LIBCPP_HIDE_FROM_ABI void __copy(basic_string_view<_InCharT> __str) { | |
| 546 | __buffer_.insert(__buffer_.end(), __str.begin(), __str.end()); | |
| 547 | } | |
| 548 | ||
| 549 | template <__fmt_char_type _InCharT, class _UnaryOperation> | |
| 550 | _LIBCPP_HIDE_FROM_ABI void __transform(const _InCharT* __first, const _InCharT* __last, _UnaryOperation __operation) { | |
| 551 | _LIBCPP_ASSERT(__first <= __last, "not a valid range"); | |
| 552 | std::transform(__first, __last, std::back_inserter(__buffer_), std::move(__operation)); | |
| 359 | 553 | } |
| 554 | ||
| 555 | _LIBCPP_HIDE_FROM_ABI void __fill(size_t __n, _CharT __value) { __buffer_.insert(__buffer_.end(), __n, __value); } | |
| 556 | ||
| 557 | _LIBCPP_HIDE_FROM_ABI basic_string_view<_CharT> __view() { return {__buffer_.data(), __buffer_.size()}; } | |
| 558 | ||
| 559 | private: | |
| 560 | // Use vector instead of string to avoid adding zeros after every append | |
| 561 | // operation. The buffer is exposed as a string_view and not as a c-string. | |
| 562 | vector<_CharT> __buffer_; | |
| 360 | 563 | }; |
| 564 | ||
| 361 | 565 | } // namespace __format |
| 362 | 566 | |
| 363 | 567 | #endif //_LIBCPP_STD_VER > 17 |
lib/libcxx/include/__format/concepts.h+37-12| ... | ... | @@ -15,6 +15,9 @@ |
| 15 | 15 | #include <__config> |
| 16 | 16 | #include <__format/format_fwd.h> |
| 17 | 17 | #include <__format/format_parse_context.h> |
| 18 | #include <__type_traits/is_specialization.h> | |
| 19 | #include <__utility/pair.h> | |
| 20 | #include <tuple> | |
| 18 | 21 | #include <type_traits> |
| 19 | 22 | |
| 20 | 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -25,6 +28,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | 28 | |
| 26 | 29 | #if _LIBCPP_STD_VER > 17 |
| 27 | 30 | |
| 31 | /// The character type specializations of \ref formatter. | |
| 32 | template <class _CharT> | |
| 33 | concept __fmt_char_type = | |
| 34 | same_as<_CharT, char> | |
| 35 | # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 36 | || same_as<_CharT, wchar_t> | |
| 37 | # endif | |
| 38 | ; | |
| 39 | ||
| 28 | 40 | // The output iterator isn't specified. A formatter should accept any |
| 29 | 41 | // output_iterator. This iterator is a minimal iterator to test the concept. |
| 30 | 42 | // (Note testing for (w)format_context would be a valid choice, but requires |
| ... | ... | @@ -32,20 +44,33 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 32 | 44 | template <class _CharT> |
| 33 | 45 | using __fmt_iter_for = _CharT*; |
| 34 | 46 | |
| 35 | // The concept is based on P2286R6 | |
| 36 | // It lacks the const of __cf as required by, the not yet accepted, LWG-3636. | |
| 37 | // The current formatters can't be easily adapted, but that is WIP. | |
| 38 | // TODO FMT properly implement this concepts once accepted. | |
| 39 | 47 | template <class _Tp, class _CharT> |
| 40 | concept __formattable = (semiregular<formatter<remove_cvref_t<_Tp>, _CharT>>) && | |
| 41 | requires(formatter<remove_cvref_t<_Tp>, _CharT> __f, | |
| 42 | formatter<remove_cvref_t<_Tp>, _CharT> __cf, _Tp __t, | |
| 43 | basic_format_context<__fmt_iter_for<_CharT>, _CharT> __fc, | |
| 44 | basic_format_parse_context<_CharT> __pc) { | |
| 45 | { __f.parse(__pc) } -> same_as<typename basic_format_parse_context<_CharT>::iterator>; | |
| 46 | { __cf.format(__t, __fc) } -> same_as<__fmt_iter_for<_CharT>>; | |
| 47 | }; | |
| 48 | concept __formattable = | |
| 49 | (semiregular<formatter<remove_cvref_t<_Tp>, _CharT>>) && | |
| 50 | requires(formatter<remove_cvref_t<_Tp>, _CharT> __f, | |
| 51 | const formatter<remove_cvref_t<_Tp>, _CharT> __cf, | |
| 52 | _Tp __t, | |
| 53 | basic_format_context<__fmt_iter_for<_CharT>, _CharT> __fc, | |
| 54 | basic_format_parse_context<_CharT> __pc) { | |
| 55 | { __f.parse(__pc) } -> same_as<typename basic_format_parse_context<_CharT>::iterator>; | |
| 56 | { __cf.format(__t, __fc) } -> same_as<__fmt_iter_for<_CharT>>; | |
| 57 | }; | |
| 58 | ||
| 59 | # if _LIBCPP_STD_VER > 20 | |
| 60 | template <class _Tp, class _CharT> | |
| 61 | concept formattable = __formattable<_Tp, _CharT>; | |
| 62 | ||
| 63 | // [tuple.like] defines a tuple-like exposition only concept. This concept is | |
| 64 | // not related to that. Therefore it uses a different name for the concept. | |
| 65 | // | |
| 66 | // TODO FMT Add a test to validate we fail when using that concept after P2165 | |
| 67 | // has been implemented. | |
| 68 | template <class _Tp> | |
| 69 | concept __fmt_pair_like = __is_specialization_v<_Tp, pair> || | |
| 70 | // Use a requires since tuple_size_v may fail to instantiate, | |
| 71 | (__is_specialization_v<_Tp, tuple> && requires { tuple_size_v<_Tp> == 2; }); | |
| 48 | 72 | |
| 73 | # endif //_LIBCPP_STD_VER > 20 | |
| 49 | 74 | #endif //_LIBCPP_STD_VER > 17 |
| 50 | 75 | |
| 51 | 76 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__format/container_adaptor.h created+70| ... | ... | @@ -0,0 +1,70 @@ |
| 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_CONTAINER_ADAPTOR_H | |
| 11 | #define _LIBCPP___FORMAT_CONTAINER_ADAPTOR_H | |
| 12 | ||
| 13 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 14 | # pragma GCC system_header | |
| 15 | #endif | |
| 16 | ||
| 17 | #include <__availability> | |
| 18 | #include <__config> | |
| 19 | #include <__format/concepts.h> | |
| 20 | #include <__format/formatter.h> | |
| 21 | #include <__format/range_default_formatter.h> | |
| 22 | #include <queue> | |
| 23 | #include <stack> | |
| 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 26 | ||
| 27 | #if _LIBCPP_STD_VER > 20 | |
| 28 | ||
| 29 | // [container.adaptors.format] only specifies the library should provide the | |
| 30 | // formatter specializations, not which header should provide them. | |
| 31 | // Since <format> includes a lot of headers, add these headers here instead of | |
| 32 | // adding more dependencies like, locale, optinal, string, tuple, etc. to the | |
| 33 | // adaptor headers. To use the format functions users already include <format>. | |
| 34 | ||
| 35 | template <class _Adaptor, class _CharT> | |
| 36 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatter_container_adaptor { | |
| 37 | private: | |
| 38 | using __maybe_const_adaptor = __fmt_maybe_const<_Adaptor, _CharT>; | |
| 39 | formatter<typename _Adaptor::container_type, _CharT> __underlying_; | |
| 40 | ||
| 41 | public: | |
| 42 | template <class _ParseContext> | |
| 43 | _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { | |
| 44 | return __underlying_.parse(__ctx); | |
| 45 | } | |
| 46 | ||
| 47 | template <class _FormatContext> | |
| 48 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator | |
| 49 | format(__maybe_const_adaptor& __adaptor, _FormatContext& __ctx) const { | |
| 50 | return __underlying_.format(__adaptor.__get_container(), __ctx); | |
| 51 | } | |
| 52 | }; | |
| 53 | ||
| 54 | template <class _CharT, class _Tp, formattable<_CharT> _Container> | |
| 55 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<queue<_Tp, _Container>, _CharT> | |
| 56 | : public __formatter_container_adaptor<queue<_Tp, _Container>, _CharT> {}; | |
| 57 | ||
| 58 | template <class _CharT, class _Tp, class _Container, class _Compare> | |
| 59 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<priority_queue<_Tp, _Container, _Compare>, _CharT> | |
| 60 | : public __formatter_container_adaptor<priority_queue<_Tp, _Container, _Compare>, _CharT> {}; | |
| 61 | ||
| 62 | template <class _CharT, class _Tp, formattable<_CharT> _Container> | |
| 63 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<stack<_Tp, _Container>, _CharT> | |
| 64 | : public __formatter_container_adaptor<stack<_Tp, _Container>, _CharT> {}; | |
| 65 | ||
| 66 | #endif //_LIBCPP_STD_VER > 20 | |
| 67 | ||
| 68 | _LIBCPP_END_NAMESPACE_STD | |
| 69 | ||
| 70 | #endif // _LIBCPP___FORMAT_CONTAINER_ADAPTOR_H |
lib/libcxx/include/__format/escaped_output_table.h created+1038| ... | ... | @@ -0,0 +1,1038 @@ |
| 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 | // WARNING, this entire header is generated by | |
| 11 | // utils/generate_escaped_output_table.py | |
| 12 | // DO NOT MODIFY! | |
| 13 | ||
| 14 | // UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE | |
| 15 | // | |
| 16 | // See Terms of Use <https://www.unicode.org/copyright.html> | |
| 17 | // for definitions of Unicode Inc.'s Data Files and Software. | |
| 18 | // | |
| 19 | // NOTICE TO USER: Carefully read the following legal agreement. | |
| 20 | // BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S | |
| 21 | // DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), | |
| 22 | // YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE | |
| 23 | // TERMS AND CONDITIONS OF THIS AGREEMENT. | |
| 24 | // IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE | |
| 25 | // THE DATA FILES OR SOFTWARE. | |
| 26 | // | |
| 27 | // COPYRIGHT AND PERMISSION NOTICE | |
| 28 | // | |
| 29 | // Copyright (c) 1991-2022 Unicode, Inc. All rights reserved. | |
| 30 | // Distributed under the Terms of Use in https://www.unicode.org/copyright.html. | |
| 31 | // | |
| 32 | // Permission is hereby granted, free of charge, to any person obtaining | |
| 33 | // a copy of the Unicode data files and any associated documentation | |
| 34 | // (the "Data Files") or Unicode software and any associated documentation | |
| 35 | // (the "Software") to deal in the Data Files or Software | |
| 36 | // without restriction, including without limitation the rights to use, | |
| 37 | // copy, modify, merge, publish, distribute, and/or sell copies of | |
| 38 | // the Data Files or Software, and to permit persons to whom the Data Files | |
| 39 | // or Software are furnished to do so, provided that either | |
| 40 | // (a) this copyright and permission notice appear with all copies | |
| 41 | // of the Data Files or Software, or | |
| 42 | // (b) this copyright and permission notice appear in associated | |
| 43 | // Documentation. | |
| 44 | // | |
| 45 | // THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF | |
| 46 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | |
| 47 | // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
| 48 | // NONINFRINGEMENT OF THIRD PARTY RIGHTS. | |
| 49 | // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS | |
| 50 | // NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL | |
| 51 | // DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | |
| 52 | // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |
| 53 | // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |
| 54 | // PERFORMANCE OF THE DATA FILES OR SOFTWARE. | |
| 55 | // | |
| 56 | // Except as contained in this notice, the name of a copyright holder | |
| 57 | // shall not be used in advertising or otherwise to promote the sale, | |
| 58 | // use or other dealings in these Data Files or Software without prior | |
| 59 | // written authorization of the copyright holder. | |
| 60 | ||
| 61 | #ifndef _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H | |
| 62 | #define _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H | |
| 63 | ||
| 64 | #include <__algorithm/ranges_upper_bound.h> | |
| 65 | #include <__config> | |
| 66 | #include <cstddef> | |
| 67 | #include <cstdint> | |
| 68 | ||
| 69 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 70 | # pragma GCC system_header | |
| 71 | #endif | |
| 72 | ||
| 73 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 74 | ||
| 75 | #if _LIBCPP_STD_VER > 20 | |
| 76 | ||
| 77 | namespace __escaped_output_table { | |
| 78 | ||
| 79 | /// The entries of the characters to escape in format's debug string. | |
| 80 | /// | |
| 81 | /// Contains the entries for [format.string.escaped]/2.2.1.2.1 | |
| 82 | /// CE is a Unicode encoding and C corresponds to either a UCS scalar value | |
| 83 | /// whose Unicode property General_Category has a value in the groups | |
| 84 | /// Separator (Z) or Other (C) or to a UCS scalar value which has the Unicode | |
| 85 | /// property Grapheme_Extend=Yes, as described by table 12 of UAX #44 | |
| 86 | /// | |
| 87 | /// Separator (Z) consists of General_Category | |
| 88 | /// - Space_Separator, | |
| 89 | /// - Line_Separator, | |
| 90 | /// - Paragraph_Separator. | |
| 91 | /// | |
| 92 | /// Other (C) consists of General_Category | |
| 93 | /// - Control, | |
| 94 | /// - Format, | |
| 95 | /// - Surrogate, | |
| 96 | /// - Private_Use, | |
| 97 | /// - Unassigned. | |
| 98 | /// | |
| 99 | /// The data is generated from | |
| 100 | /// - https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt | |
| 101 | /// - https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedGeneralCategory.txt | |
| 102 | /// | |
| 103 | /// The table is similar to the table | |
| 104 | /// __extended_grapheme_custer_property_boundary::__entries | |
| 105 | /// which explains the details of these classes. The only difference is this | |
| 106 | /// table lacks a property, thus having more bits available for the size. | |
| 107 | /// | |
| 108 | /// The data has 2 values: | |
| 109 | /// - bits [0, 10] The size of the range, allowing 2048 elements. | |
| 110 | /// - bits [11, 31] The lower bound code point of the range. The upper bound of | |
| 111 | /// the range is lower bound + size. | |
| 112 | inline constexpr uint32_t __entries[893] = { | |
| 113 | 0x00000020, | |
| 114 | 0x0003f821, | |
| 115 | 0x00056800, | |
| 116 | 0x0018006f, | |
| 117 | 0x001bc001, | |
| 118 | 0x001c0003, | |
| 119 | 0x001c5800, | |
| 120 | 0x001c6800, | |
| 121 | 0x001d1000, | |
| 122 | 0x00241806, | |
| 123 | 0x00298000, | |
| 124 | 0x002ab801, | |
| 125 | 0x002c5801, | |
| 126 | 0x002c802d, | |
| 127 | 0x002df800, | |
| 128 | 0x002e0801, | |
| 129 | 0x002e2001, | |
| 130 | 0x002e3808, | |
| 131 | 0x002f5803, | |
| 132 | 0x002fa810, | |
| 133 | 0x0030800a, | |
| 134 | 0x0030e000, | |
| 135 | 0x00325814, | |
| 136 | 0x00338000, | |
| 137 | 0x0036b007, | |
| 138 | 0x0036f805, | |
| 139 | 0x00373801, | |
| 140 | 0x00375003, | |
| 141 | 0x00387001, | |
| 142 | 0x00388800, | |
| 143 | 0x0039801c, | |
| 144 | 0x003d300a, | |
| 145 | 0x003d900d, | |
| 146 | 0x003f5808, | |
| 147 | 0x003fd802, | |
| 148 | 0x0040b003, | |
| 149 | 0x0040d808, | |
| 150 | 0x00412802, | |
| 151 | 0x00414806, | |
| 152 | 0x0041f800, | |
| 153 | 0x0042c804, | |
| 154 | 0x0042f800, | |
| 155 | 0x00435804, | |
| 156 | 0x00447810, | |
| 157 | 0x00465038, | |
| 158 | 0x0049d000, | |
| 159 | 0x0049e000, | |
| 160 | 0x004a0807, | |
| 161 | 0x004a6800, | |
| 162 | 0x004a8806, | |
| 163 | 0x004b1001, | |
| 164 | 0x004c0800, | |
| 165 | 0x004c2000, | |
| 166 | 0x004c6801, | |
| 167 | 0x004c8801, | |
| 168 | 0x004d4800, | |
| 169 | 0x004d8800, | |
| 170 | 0x004d9802, | |
| 171 | 0x004dd002, | |
| 172 | 0x004df000, | |
| 173 | 0x004e0805, | |
| 174 | 0x004e4801, | |
| 175 | 0x004e6800, | |
| 176 | 0x004e780c, | |
| 177 | 0x004ef000, | |
| 178 | 0x004f1003, | |
| 179 | 0x004ff004, | |
| 180 | 0x00502000, | |
| 181 | 0x00505803, | |
| 182 | 0x00508801, | |
| 183 | 0x00514800, | |
| 184 | 0x00518800, | |
| 185 | 0x0051a000, | |
| 186 | 0x0051b800, | |
| 187 | 0x0051d003, | |
| 188 | 0x00520817, | |
| 189 | 0x0052e800, | |
| 190 | 0x0052f806, | |
| 191 | 0x00538001, | |
| 192 | 0x0053a800, | |
| 193 | 0x0053b80b, | |
| 194 | 0x00542000, | |
| 195 | 0x00547000, | |
| 196 | 0x00549000, | |
| 197 | 0x00554800, | |
| 198 | 0x00558800, | |
| 199 | 0x0055a000, | |
| 200 | 0x0055d002, | |
| 201 | 0x00560807, | |
| 202 | 0x00565000, | |
| 203 | 0x00566802, | |
| 204 | 0x0056880e, | |
| 205 | 0x00571003, | |
| 206 | 0x00579006, | |
| 207 | 0x0057d007, | |
| 208 | 0x00582000, | |
| 209 | 0x00586801, | |
| 210 | 0x00588801, | |
| 211 | 0x00594800, | |
| 212 | 0x00598800, | |
| 213 | 0x0059a000, | |
| 214 | 0x0059d002, | |
| 215 | 0x0059f001, | |
| 216 | 0x005a0805, | |
| 217 | 0x005a4801, | |
| 218 | 0x005a680e, | |
| 219 | 0x005af000, | |
| 220 | 0x005b1003, | |
| 221 | 0x005bc00a, | |
| 222 | 0x005c2000, | |
| 223 | 0x005c5802, | |
| 224 | 0x005c8800, | |
| 225 | 0x005cb002, | |
| 226 | 0x005cd800, | |
| 227 | 0x005ce800, | |
| 228 | 0x005d0002, | |
| 229 | 0x005d2802, | |
| 230 | 0x005d5802, | |
| 231 | 0x005dd004, | |
| 232 | 0x005e0000, | |
| 233 | 0x005e1802, | |
| 234 | 0x005e4800, | |
| 235 | 0x005e6802, | |
| 236 | 0x005e8814, | |
| 237 | 0x005fd805, | |
| 238 | 0x00602000, | |
| 239 | 0x00606800, | |
| 240 | 0x00608800, | |
| 241 | 0x00614800, | |
| 242 | 0x0061d002, | |
| 243 | 0x0061f002, | |
| 244 | 0x00622812, | |
| 245 | 0x0062d801, | |
| 246 | 0x0062f001, | |
| 247 | 0x00631003, | |
| 248 | 0x00638006, | |
| 249 | 0x00640800, | |
| 250 | 0x00646800, | |
| 251 | 0x00648800, | |
| 252 | 0x00654800, | |
| 253 | 0x0065a000, | |
| 254 | 0x0065d002, | |
| 255 | 0x0065f800, | |
| 256 | 0x00661000, | |
| 257 | 0x00662801, | |
| 258 | 0x00664800, | |
| 259 | 0x00666010, | |
| 260 | 0x0066f800, | |
| 261 | 0x00671003, | |
| 262 | 0x00678000, | |
| 263 | 0x0067a00d, | |
| 264 | 0x00686800, | |
| 265 | 0x00688800, | |
| 266 | 0x0069d801, | |
| 267 | 0x0069f000, | |
| 268 | 0x006a0804, | |
| 269 | 0x006a4800, | |
| 270 | 0x006a6800, | |
| 271 | 0x006a8003, | |
| 272 | 0x006ab800, | |
| 273 | 0x006b1003, | |
| 274 | 0x006c0001, | |
| 275 | 0x006c2000, | |
| 276 | 0x006cb802, | |
| 277 | 0x006d9000, | |
| 278 | 0x006de000, | |
| 279 | 0x006df001, | |
| 280 | 0x006e3808, | |
| 281 | 0x006e9005, | |
| 282 | 0x006ef806, | |
| 283 | 0x006f8001, | |
| 284 | 0x006fa80b, | |
| 285 | 0x00718800, | |
| 286 | 0x0071a00a, | |
| 287 | 0x00723807, | |
| 288 | 0x0072e024, | |
| 289 | 0x00741800, | |
| 290 | 0x00742800, | |
| 291 | 0x00745800, | |
| 292 | 0x00752000, | |
| 293 | 0x00753000, | |
| 294 | 0x00758800, | |
| 295 | 0x0075a008, | |
| 296 | 0x0075f001, | |
| 297 | 0x00762800, | |
| 298 | 0x00763808, | |
| 299 | 0x0076d001, | |
| 300 | 0x0077001f, | |
| 301 | 0x0078c001, | |
| 302 | 0x0079a800, | |
| 303 | 0x0079b800, | |
| 304 | 0x0079c800, | |
| 305 | 0x007a4000, | |
| 306 | 0x007b6811, | |
| 307 | 0x007c0004, | |
| 308 | 0x007c3001, | |
| 309 | 0x007c6830, | |
| 310 | 0x007e3000, | |
| 311 | 0x007e6800, | |
| 312 | 0x007ed824, | |
| 313 | 0x00816803, | |
| 314 | 0x00819005, | |
| 315 | 0x0081c801, | |
| 316 | 0x0081e801, | |
| 317 | 0x0082c001, | |
| 318 | 0x0082f002, | |
| 319 | 0x00838803, | |
| 320 | 0x00841000, | |
| 321 | 0x00842801, | |
| 322 | 0x00846800, | |
| 323 | 0x0084e800, | |
| 324 | 0x00863000, | |
| 325 | 0x00864004, | |
| 326 | 0x00867001, | |
| 327 | 0x00924800, | |
| 328 | 0x00927001, | |
| 329 | 0x0092b800, | |
| 330 | 0x0092c800, | |
| 331 | 0x0092f001, | |
| 332 | 0x00944800, | |
| 333 | 0x00947001, | |
| 334 | 0x00958800, | |
| 335 | 0x0095b001, | |
| 336 | 0x0095f800, | |
| 337 | 0x00960800, | |
| 338 | 0x00963001, | |
| 339 | 0x0096b800, | |
| 340 | 0x00988800, | |
| 341 | 0x0098b001, | |
| 342 | 0x009ad804, | |
| 343 | 0x009be802, | |
| 344 | 0x009cd005, | |
| 345 | 0x009fb001, | |
| 346 | 0x009ff001, | |
| 347 | 0x00b40000, | |
| 348 | 0x00b4e802, | |
| 349 | 0x00b7c806, | |
| 350 | 0x00b89002, | |
| 351 | 0x00b8b008, | |
| 352 | 0x00b99001, | |
| 353 | 0x00b9b808, | |
| 354 | 0x00ba900d, | |
| 355 | 0x00bb6800, | |
| 356 | 0x00bb880e, | |
| 357 | 0x00bda001, | |
| 358 | 0x00bdb806, | |
| 359 | 0x00be3000, | |
| 360 | 0x00be480a, | |
| 361 | 0x00bee802, | |
| 362 | 0x00bf5005, | |
| 363 | 0x00bfd005, | |
| 364 | 0x00c05804, | |
| 365 | 0x00c0d005, | |
| 366 | 0x00c3c806, | |
| 367 | 0x00c42801, | |
| 368 | 0x00c54800, | |
| 369 | 0x00c55804, | |
| 370 | 0x00c7b009, | |
| 371 | 0x00c8f803, | |
| 372 | 0x00c93801, | |
| 373 | 0x00c96003, | |
| 374 | 0x00c99000, | |
| 375 | 0x00c9c806, | |
| 376 | 0x00ca0802, | |
| 377 | 0x00cb7001, | |
| 378 | 0x00cba80a, | |
| 379 | 0x00cd6003, | |
| 380 | 0x00ce5005, | |
| 381 | 0x00ced802, | |
| 382 | 0x00d0b801, | |
| 383 | 0x00d0d802, | |
| 384 | 0x00d2b000, | |
| 385 | 0x00d2c008, | |
| 386 | 0x00d31000, | |
| 387 | 0x00d32807, | |
| 388 | 0x00d3980c, | |
| 389 | 0x00d45005, | |
| 390 | 0x00d4d005, | |
| 391 | 0x00d57055, | |
| 392 | 0x00d9a006, | |
| 393 | 0x00d9e000, | |
| 394 | 0x00da1000, | |
| 395 | 0x00da6802, | |
| 396 | 0x00db5808, | |
| 397 | 0x00dbf802, | |
| 398 | 0x00dd1003, | |
| 399 | 0x00dd4001, | |
| 400 | 0x00dd5802, | |
| 401 | 0x00df3000, | |
| 402 | 0x00df4001, | |
| 403 | 0x00df6800, | |
| 404 | 0x00df7802, | |
| 405 | 0x00dfa007, | |
| 406 | 0x00e16007, | |
| 407 | 0x00e1b004, | |
| 408 | 0x00e25002, | |
| 409 | 0x00e44806, | |
| 410 | 0x00e5d801, | |
| 411 | 0x00e6400a, | |
| 412 | 0x00e6a00c, | |
| 413 | 0x00e71006, | |
| 414 | 0x00e76800, | |
| 415 | 0x00e7a000, | |
| 416 | 0x00e7c001, | |
| 417 | 0x00e7d804, | |
| 418 | 0x00ee003f, | |
| 419 | 0x00f8b001, | |
| 420 | 0x00f8f001, | |
| 421 | 0x00fa3001, | |
| 422 | 0x00fa7001, | |
| 423 | 0x00fac000, | |
| 424 | 0x00fad000, | |
| 425 | 0x00fae000, | |
| 426 | 0x00faf000, | |
| 427 | 0x00fbf001, | |
| 428 | 0x00fda800, | |
| 429 | 0x00fe2800, | |
| 430 | 0x00fea001, | |
| 431 | 0x00fee000, | |
| 432 | 0x00ff8001, | |
| 433 | 0x00ffa800, | |
| 434 | 0x00fff810, | |
| 435 | 0x01014007, | |
| 436 | 0x0102f810, | |
| 437 | 0x01039001, | |
| 438 | 0x01047800, | |
| 439 | 0x0104e802, | |
| 440 | 0x0106083e, | |
| 441 | 0x010c6003, | |
| 442 | 0x01213818, | |
| 443 | 0x01225814, | |
| 444 | 0x015ba001, | |
| 445 | 0x015cb000, | |
| 446 | 0x01677802, | |
| 447 | 0x0167a004, | |
| 448 | 0x01693000, | |
| 449 | 0x01694004, | |
| 450 | 0x01697001, | |
| 451 | 0x016b4006, | |
| 452 | 0x016b880e, | |
| 453 | 0x016cb808, | |
| 454 | 0x016d3800, | |
| 455 | 0x016d7800, | |
| 456 | 0x016db800, | |
| 457 | 0x016df800, | |
| 458 | 0x016e3800, | |
| 459 | 0x016e7800, | |
| 460 | 0x016eb800, | |
| 461 | 0x016ef820, | |
| 462 | 0x0172f021, | |
| 463 | 0x0174d000, | |
| 464 | 0x0177a00b, | |
| 465 | 0x017eb019, | |
| 466 | 0x017fe004, | |
| 467 | 0x01815005, | |
| 468 | 0x01820000, | |
| 469 | 0x0184b803, | |
| 470 | 0x01880004, | |
| 471 | 0x01898000, | |
| 472 | 0x018c7800, | |
| 473 | 0x018f200b, | |
| 474 | 0x0190f800, | |
| 475 | 0x05246802, | |
| 476 | 0x05263808, | |
| 477 | 0x05316013, | |
| 478 | 0x05337803, | |
| 479 | 0x0533a009, | |
| 480 | 0x0534f001, | |
| 481 | 0x05378001, | |
| 482 | 0x0537c007, | |
| 483 | 0x053e5804, | |
| 484 | 0x053e9000, | |
| 485 | 0x053ea000, | |
| 486 | 0x053ed017, | |
| 487 | 0x05401000, | |
| 488 | 0x05403000, | |
| 489 | 0x05405800, | |
| 490 | 0x05412801, | |
| 491 | 0x05416003, | |
| 492 | 0x0541d005, | |
| 493 | 0x0543c007, | |
| 494 | 0x05462009, | |
| 495 | 0x0546d017, | |
| 496 | 0x0547f800, | |
| 497 | 0x05493007, | |
| 498 | 0x054a380a, | |
| 499 | 0x054aa00a, | |
| 500 | 0x054be805, | |
| 501 | 0x054d9800, | |
| 502 | 0x054db003, | |
| 503 | 0x054de001, | |
| 504 | 0x054e7000, | |
| 505 | 0x054ed003, | |
| 506 | 0x054f2800, | |
| 507 | 0x054ff800, | |
| 508 | 0x05514805, | |
| 509 | 0x05518801, | |
| 510 | 0x0551a80a, | |
| 511 | 0x05521800, | |
| 512 | 0x05526000, | |
| 513 | 0x05527001, | |
| 514 | 0x0552d001, | |
| 515 | 0x0553e000, | |
| 516 | 0x05558000, | |
| 517 | 0x05559002, | |
| 518 | 0x0555b801, | |
| 519 | 0x0555f001, | |
| 520 | 0x05560800, | |
| 521 | 0x05561817, | |
| 522 | 0x05576001, | |
| 523 | 0x0557b00a, | |
| 524 | 0x05583801, | |
| 525 | 0x05587801, | |
| 526 | 0x0558b808, | |
| 527 | 0x05593800, | |
| 528 | 0x05597800, | |
| 529 | 0x055b6003, | |
| 530 | 0x055f2800, | |
| 531 | 0x055f4000, | |
| 532 | 0x055f6802, | |
| 533 | 0x055fd005, | |
| 534 | 0x06bd200b, | |
| 535 | 0x06be3803, | |
| 536 | 0x06bfe7ff, | |
| 537 | 0x06ffe7ff, | |
| 538 | 0x073fe7ff, | |
| 539 | 0x077fe7ff, | |
| 540 | 0x07bfe103, | |
| 541 | 0x07d37001, | |
| 542 | 0x07d6d025, | |
| 543 | 0x07d8380b, | |
| 544 | 0x07d8c004, | |
| 545 | 0x07d8f000, | |
| 546 | 0x07d9b800, | |
| 547 | 0x07d9e800, | |
| 548 | 0x07d9f800, | |
| 549 | 0x07da1000, | |
| 550 | 0x07da2800, | |
| 551 | 0x07de180f, | |
| 552 | 0x07ec8001, | |
| 553 | 0x07ee4006, | |
| 554 | 0x07ee801f, | |
| 555 | 0x07f0000f, | |
| 556 | 0x07f0d015, | |
| 557 | 0x07f29800, | |
| 558 | 0x07f33800, | |
| 559 | 0x07f36003, | |
| 560 | 0x07f3a800, | |
| 561 | 0x07f7e803, | |
| 562 | 0x07fcf001, | |
| 563 | 0x07fdf802, | |
| 564 | 0x07fe4001, | |
| 565 | 0x07fe8001, | |
| 566 | 0x07fec001, | |
| 567 | 0x07fee802, | |
| 568 | 0x07ff3800, | |
| 569 | 0x07ff780c, | |
| 570 | 0x07fff001, | |
| 571 | 0x08006000, | |
| 572 | 0x08013800, | |
| 573 | 0x0801d800, | |
| 574 | 0x0801f000, | |
| 575 | 0x08027001, | |
| 576 | 0x0802f021, | |
| 577 | 0x0807d804, | |
| 578 | 0x08081803, | |
| 579 | 0x0809a002, | |
| 580 | 0x080c7800, | |
| 581 | 0x080ce802, | |
| 582 | 0x080d082e, | |
| 583 | 0x080fe882, | |
| 584 | 0x0814e802, | |
| 585 | 0x0816880f, | |
| 586 | 0x0817e003, | |
| 587 | 0x08192008, | |
| 588 | 0x081a5804, | |
| 589 | 0x081bb009, | |
| 590 | 0x081cf000, | |
| 591 | 0x081e2003, | |
| 592 | 0x081eb029, | |
| 593 | 0x0824f001, | |
| 594 | 0x08255005, | |
| 595 | 0x0826a003, | |
| 596 | 0x0827e003, | |
| 597 | 0x08294007, | |
| 598 | 0x082b200a, | |
| 599 | 0x082bd800, | |
| 600 | 0x082c5800, | |
| 601 | 0x082c9800, | |
| 602 | 0x082cb000, | |
| 603 | 0x082d1000, | |
| 604 | 0x082d9000, | |
| 605 | 0x082dd000, | |
| 606 | 0x082de842, | |
| 607 | 0x0839b808, | |
| 608 | 0x083ab009, | |
| 609 | 0x083b4017, | |
| 610 | 0x083c3000, | |
| 611 | 0x083d8800, | |
| 612 | 0x083dd844, | |
| 613 | 0x08403001, | |
| 614 | 0x08404800, | |
| 615 | 0x0841b000, | |
| 616 | 0x0841c802, | |
| 617 | 0x0841e801, | |
| 618 | 0x0842b000, | |
| 619 | 0x0844f807, | |
| 620 | 0x0845802f, | |
| 621 | 0x08479800, | |
| 622 | 0x0847b004, | |
| 623 | 0x0848e002, | |
| 624 | 0x0849d004, | |
| 625 | 0x084a003f, | |
| 626 | 0x084dc003, | |
| 627 | 0x084e8001, | |
| 628 | 0x0850080e, | |
| 629 | 0x0850a000, | |
| 630 | 0x0850c000, | |
| 631 | 0x0851b009, | |
| 632 | 0x08524806, | |
| 633 | 0x0852c806, | |
| 634 | 0x0855001f, | |
| 635 | 0x08572805, | |
| 636 | 0x0857b808, | |
| 637 | 0x0859b002, | |
| 638 | 0x085ab001, | |
| 639 | 0x085b9804, | |
| 640 | 0x085c9006, | |
| 641 | 0x085ce80b, | |
| 642 | 0x085d804f, | |
| 643 | 0x08624836, | |
| 644 | 0x0865980c, | |
| 645 | 0x08679806, | |
| 646 | 0x0869200b, | |
| 647 | 0x0869d125, | |
| 648 | 0x0873f800, | |
| 649 | 0x08755002, | |
| 650 | 0x08757001, | |
| 651 | 0x0875904d, | |
| 652 | 0x08794007, | |
| 653 | 0x087a300a, | |
| 654 | 0x087ad015, | |
| 655 | 0x087c1003, | |
| 656 | 0x087c5025, | |
| 657 | 0x087e6013, | |
| 658 | 0x087fb808, | |
| 659 | 0x08800800, | |
| 660 | 0x0881c00e, | |
| 661 | 0x08827003, | |
| 662 | 0x08838000, | |
| 663 | 0x08839801, | |
| 664 | 0x0883b00b, | |
| 665 | 0x08859803, | |
| 666 | 0x0885c801, | |
| 667 | 0x0885e800, | |
| 668 | 0x0886100d, | |
| 669 | 0x08874806, | |
| 670 | 0x0887d008, | |
| 671 | 0x08893804, | |
| 672 | 0x08896808, | |
| 673 | 0x088a4007, | |
| 674 | 0x088b9800, | |
| 675 | 0x088bb80a, | |
| 676 | 0x088db008, | |
| 677 | 0x088e4803, | |
| 678 | 0x088e7800, | |
| 679 | 0x088f0000, | |
| 680 | 0x088fa80a, | |
| 681 | 0x08909000, | |
| 682 | 0x08917802, | |
| 683 | 0x0891a000, | |
| 684 | 0x0891b001, | |
| 685 | 0x0891f000, | |
| 686 | 0x0892083e, | |
| 687 | 0x08943800, | |
| 688 | 0x08944800, | |
| 689 | 0x08947000, | |
| 690 | 0x0894f000, | |
| 691 | 0x08955005, | |
| 692 | 0x0896f800, | |
| 693 | 0x0897180c, | |
| 694 | 0x0897d007, | |
| 695 | 0x08982000, | |
| 696 | 0x08986801, | |
| 697 | 0x08988801, | |
| 698 | 0x08994800, | |
| 699 | 0x08998800, | |
| 700 | 0x0899a000, | |
| 701 | 0x0899d002, | |
| 702 | 0x0899f000, | |
| 703 | 0x089a0000, | |
| 704 | 0x089a2801, | |
| 705 | 0x089a4801, | |
| 706 | 0x089a7001, | |
| 707 | 0x089a880b, | |
| 708 | 0x089b209b, | |
| 709 | 0x08a1c007, | |
| 710 | 0x08a21002, | |
| 711 | 0x08a23000, | |
| 712 | 0x08a2e000, | |
| 713 | 0x08a2f000, | |
| 714 | 0x08a3101d, | |
| 715 | 0x08a58000, | |
| 716 | 0x08a59805, | |
| 717 | 0x08a5d000, | |
| 718 | 0x08a5e800, | |
| 719 | 0x08a5f801, | |
| 720 | 0x08a61001, | |
| 721 | 0x08a64007, | |
| 722 | 0x08a6d0a5, | |
| 723 | 0x08ad7800, | |
| 724 | 0x08ad9005, | |
| 725 | 0x08ade001, | |
| 726 | 0x08adf801, | |
| 727 | 0x08aee023, | |
| 728 | 0x08b19807, | |
| 729 | 0x08b1e800, | |
| 730 | 0x08b1f801, | |
| 731 | 0x08b2280a, | |
| 732 | 0x08b2d005, | |
| 733 | 0x08b36812, | |
| 734 | 0x08b55800, | |
| 735 | 0x08b56800, | |
| 736 | 0x08b58005, | |
| 737 | 0x08b5b800, | |
| 738 | 0x08b5d005, | |
| 739 | 0x08b65035, | |
| 740 | 0x08b8d804, | |
| 741 | 0x08b91003, | |
| 742 | 0x08b93808, | |
| 743 | 0x08ba38b8, | |
| 744 | 0x08c17808, | |
| 745 | 0x08c1c801, | |
| 746 | 0x08c1e063, | |
| 747 | 0x08c7980b, | |
| 748 | 0x08c83801, | |
| 749 | 0x08c85001, | |
| 750 | 0x08c8a000, | |
| 751 | 0x08c8b800, | |
| 752 | 0x08c98000, | |
| 753 | 0x08c9b000, | |
| 754 | 0x08c9c803, | |
| 755 | 0x08c9f000, | |
| 756 | 0x08ca1800, | |
| 757 | 0x08ca3808, | |
| 758 | 0x08cad045, | |
| 759 | 0x08cd4001, | |
| 760 | 0x08cea007, | |
| 761 | 0x08cf0000, | |
| 762 | 0x08cf281a, | |
| 763 | 0x08d00809, | |
| 764 | 0x08d19805, | |
| 765 | 0x08d1d803, | |
| 766 | 0x08d23808, | |
| 767 | 0x08d28805, | |
| 768 | 0x08d2c802, | |
| 769 | 0x08d4500c, | |
| 770 | 0x08d4c001, | |
| 771 | 0x08d5180c, | |
| 772 | 0x08d7c806, | |
| 773 | 0x08d850f5, | |
| 774 | 0x08e04800, | |
| 775 | 0x08e1800d, | |
| 776 | 0x08e1f800, | |
| 777 | 0x08e23009, | |
| 778 | 0x08e36802, | |
| 779 | 0x08e48018, | |
| 780 | 0x08e55006, | |
| 781 | 0x08e59001, | |
| 782 | 0x08e5a84a, | |
| 783 | 0x08e83800, | |
| 784 | 0x08e85000, | |
| 785 | 0x08e98814, | |
| 786 | 0x08ea3808, | |
| 787 | 0x08ead005, | |
| 788 | 0x08eb3000, | |
| 789 | 0x08eb4800, | |
| 790 | 0x08ec7803, | |
| 791 | 0x08eca800, | |
| 792 | 0x08ecb800, | |
| 793 | 0x08ecc806, | |
| 794 | 0x08ed5135, | |
| 795 | 0x08f79801, | |
| 796 | 0x08f7c808, | |
| 797 | 0x08f88800, | |
| 798 | 0x08f9b007, | |
| 799 | 0x08fa0000, | |
| 800 | 0x08fa1000, | |
| 801 | 0x08fad055, | |
| 802 | 0x08fd880e, | |
| 803 | 0x08ff900c, | |
| 804 | 0x091cd065, | |
| 805 | 0x09237800, | |
| 806 | 0x0923a80a, | |
| 807 | 0x092a27ff, | |
| 808 | 0x096a224b, | |
| 809 | 0x097f980c, | |
| 810 | 0x09a18010, | |
| 811 | 0x09a23fff, | |
| 812 | 0x09e23fb8, | |
| 813 | 0x0a323fff, | |
| 814 | 0x0a723fff, | |
| 815 | 0x0ab23fff, | |
| 816 | 0x0af23fff, | |
| 817 | 0x0b3239b8, | |
| 818 | 0x0b51c806, | |
| 819 | 0x0b52f800, | |
| 820 | 0x0b535003, | |
| 821 | 0x0b55f800, | |
| 822 | 0x0b565005, | |
| 823 | 0x0b577006, | |
| 824 | 0x0b57b009, | |
| 825 | 0x0b598006, | |
| 826 | 0x0b5a3009, | |
| 827 | 0x0b5ad000, | |
| 828 | 0x0b5b1000, | |
| 829 | 0x0b5bc004, | |
| 830 | 0x0b5c82af, | |
| 831 | 0x0b74d864, | |
| 832 | 0x0b7a5804, | |
| 833 | 0x0b7c400a, | |
| 834 | 0x0b7d003f, | |
| 835 | 0x0b7f200b, | |
| 836 | 0x0b7f900d, | |
| 837 | 0x0c3fc007, | |
| 838 | 0x0c66b029, | |
| 839 | 0x0c684fff, | |
| 840 | 0x0ca84fff, | |
| 841 | 0x0ce84fff, | |
| 842 | 0x0d284fff, | |
| 843 | 0x0d684ae6, | |
| 844 | 0x0d7fa000, | |
| 845 | 0x0d7fe000, | |
| 846 | 0x0d7ff800, | |
| 847 | 0x0d89180e, | |
| 848 | 0x0d89981c, | |
| 849 | 0x0d8a9801, | |
| 850 | 0x0d8ab00d, | |
| 851 | 0x0d8b4007, | |
| 852 | 0x0d97e7ff, | |
| 853 | 0x0dd7e103, | |
| 854 | 0x0de35804, | |
| 855 | 0x0de3e802, | |
| 856 | 0x0de44806, | |
| 857 | 0x0de4d001, | |
| 858 | 0x0de4e801, | |
| 859 | 0x0de507ff, | |
| 860 | 0x0e2507ff, | |
| 861 | 0x0e6502af, | |
| 862 | 0x0e7e203b, | |
| 863 | 0x0e87b009, | |
| 864 | 0x0e893801, | |
| 865 | 0x0e8b2800, | |
| 866 | 0x0e8b3802, | |
| 867 | 0x0e8b7014, | |
| 868 | 0x0e8c2806, | |
| 869 | 0x0e8d5003, | |
| 870 | 0x0e8f5814, | |
| 871 | 0x0e921002, | |
| 872 | 0x0e923079, | |
| 873 | 0x0e96a00b, | |
| 874 | 0x0e97a00b, | |
| 875 | 0x0e9ab808, | |
| 876 | 0x0e9bc886, | |
| 877 | 0x0ea2a800, | |
| 878 | 0x0ea4e800, | |
| 879 | 0x0ea50001, | |
| 880 | 0x0ea51801, | |
| 881 | 0x0ea53801, | |
| 882 | 0x0ea56800, | |
| 883 | 0x0ea5d000, | |
| 884 | 0x0ea5e000, | |
| 885 | 0x0ea62000, | |
| 886 | 0x0ea83000, | |
| 887 | 0x0ea85801, | |
| 888 | 0x0ea8a800, | |
| 889 | 0x0ea8e800, | |
| 890 | 0x0ea9d000, | |
| 891 | 0x0ea9f800, | |
| 892 | 0x0eaa2800, | |
| 893 | 0x0eaa3802, | |
| 894 | 0x0eaa8800, | |
| 895 | 0x0eb53001, | |
| 896 | 0x0ebe6001, | |
| 897 | 0x0ed00036, | |
| 898 | 0x0ed1d831, | |
| 899 | 0x0ed3a800, | |
| 900 | 0x0ed42000, | |
| 901 | 0x0ed46473, | |
| 902 | 0x0ef8f805, | |
| 903 | 0x0ef95904, | |
| 904 | 0x0f037091, | |
| 905 | 0x0f096809, | |
| 906 | 0x0f09f001, | |
| 907 | 0x0f0a5003, | |
| 908 | 0x0f0a813f, | |
| 909 | 0x0f157011, | |
| 910 | 0x0f176003, | |
| 911 | 0x0f17d004, | |
| 912 | 0x0f1801cf, | |
| 913 | 0x0f276003, | |
| 914 | 0x0f27d2e5, | |
| 915 | 0x0f3f3800, | |
| 916 | 0x0f3f6000, | |
| 917 | 0x0f3f7800, | |
| 918 | 0x0f3ff800, | |
| 919 | 0x0f462801, | |
| 920 | 0x0f46802f, | |
| 921 | 0x0f4a2006, | |
| 922 | 0x0f4a6003, | |
| 923 | 0x0f4ad003, | |
| 924 | 0x0f4b0310, | |
| 925 | 0x0f65a84b, | |
| 926 | 0x0f69f0c1, | |
| 927 | 0x0f702000, | |
| 928 | 0x0f710000, | |
| 929 | 0x0f711800, | |
| 930 | 0x0f712801, | |
| 931 | 0x0f714000, | |
| 932 | 0x0f719800, | |
| 933 | 0x0f71c000, | |
| 934 | 0x0f71d000, | |
| 935 | 0x0f71e005, | |
| 936 | 0x0f721803, | |
| 937 | 0x0f724000, | |
| 938 | 0x0f725000, | |
| 939 | 0x0f726000, | |
| 940 | 0x0f728000, | |
| 941 | 0x0f729800, | |
| 942 | 0x0f72a801, | |
| 943 | 0x0f72c000, | |
| 944 | 0x0f72d000, | |
| 945 | 0x0f72e000, | |
| 946 | 0x0f72f000, | |
| 947 | 0x0f730000, | |
| 948 | 0x0f731800, | |
| 949 | 0x0f732801, | |
| 950 | 0x0f735800, | |
| 951 | 0x0f739800, | |
| 952 | 0x0f73c000, | |
| 953 | 0x0f73e800, | |
| 954 | 0x0f73f800, | |
| 955 | 0x0f745000, | |
| 956 | 0x0f74e004, | |
| 957 | 0x0f752000, | |
| 958 | 0x0f755000, | |
| 959 | 0x0f75e033, | |
| 960 | 0x0f77910d, | |
| 961 | 0x0f816003, | |
| 962 | 0x0f84a00b, | |
| 963 | 0x0f857801, | |
| 964 | 0x0f860000, | |
| 965 | 0x0f868000, | |
| 966 | 0x0f87b009, | |
| 967 | 0x0f8d7037, | |
| 968 | 0x0f90180c, | |
| 969 | 0x0f91e003, | |
| 970 | 0x0f924806, | |
| 971 | 0x0f92900d, | |
| 972 | 0x0f933099, | |
| 973 | 0x0fb6c003, | |
| 974 | 0x0fb76802, | |
| 975 | 0x0fb7e802, | |
| 976 | 0x0fbbb803, | |
| 977 | 0x0fbed005, | |
| 978 | 0x0fbf6003, | |
| 979 | 0x0fbf880e, | |
| 980 | 0x0fc06003, | |
| 981 | 0x0fc24007, | |
| 982 | 0x0fc2d005, | |
| 983 | 0x0fc44007, | |
| 984 | 0x0fc57001, | |
| 985 | 0x0fc5904d, | |
| 986 | 0x0fd2a00b, | |
| 987 | 0x0fd37001, | |
| 988 | 0x0fd3e802, | |
| 989 | 0x0fd44806, | |
| 990 | 0x0fd5f000, | |
| 991 | 0x0fd63007, | |
| 992 | 0x0fd6e003, | |
| 993 | 0x0fd74806, | |
| 994 | 0x0fd7c806, | |
| 995 | 0x0fdc9800, | |
| 996 | 0x0fde5824, | |
| 997 | 0x0fdfd405, | |
| 998 | 0x1537001f, | |
| 999 | 0x15b9d005, | |
| 1000 | 0x15c0f001, | |
| 1001 | 0x1675100d, | |
| 1002 | 0x175f0fff, | |
| 1003 | 0x179f0c1e, | |
| 1004 | 0x17d0f5e1, | |
| 1005 | 0x189a5804}; | |
| 1006 | ||
| 1007 | /// At the end of the valid Unicode code points space a lot of code points are | |
| 1008 | /// either reserved or a noncharacter. Adding all these entries to the | |
| 1009 | /// lookup table would add 446 entries to the table (in Unicode 14). | |
| 1010 | /// Instead the only the start of the region is stored, every code point in | |
| 1011 | /// this region needs to be escaped. | |
| 1012 | inline constexpr uint32_t __unallocated_region_lower_bound = 0x000323b0; | |
| 1013 | ||
| 1014 | /// Returns whether the code unit needs to be escaped. | |
| 1015 | /// | |
| 1016 | /// \pre The code point is a valid Unicode code point. | |
| 1017 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool __needs_escape(const char32_t __code_point) noexcept { | |
| 1018 | // Since __unallocated_region_lower_bound contains the unshifted range do the | |
| 1019 | // comparison without shifting. | |
| 1020 | if (__code_point >= __unallocated_region_lower_bound) | |
| 1021 | return true; | |
| 1022 | ||
| 1023 | ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries; | |
| 1024 | if (__i == 0) | |
| 1025 | return false; | |
| 1026 | ||
| 1027 | --__i; | |
| 1028 | uint32_t __upper_bound = (__entries[__i] >> 11) + (__entries[__i] & 0x7ffu); | |
| 1029 | return __code_point <= __upper_bound; | |
| 1030 | } | |
| 1031 | ||
| 1032 | } // namespace __escaped_output_table | |
| 1033 | ||
| 1034 | #endif //_LIBCPP_STD_VER > 20 | |
| 1035 | ||
| 1036 | _LIBCPP_END_NAMESPACE_STD | |
| 1037 | ||
| 1038 | #endif // _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H |
lib/libcxx/include/__format/extended_grapheme_cluster_table.h+1501-172| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | 10 | // WARNING, this entire header is generated by |
| 11 | // utiles/generate_extended_grapheme_cluster_table.py | |
| 11 | // utils/generate_extended_grapheme_cluster_table.py | |
| 12 | 12 | // DO NOT MODIFY! |
| 13 | 13 | |
| 14 | 14 | // UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE |
| ... | ... | @@ -61,7 +61,7 @@ |
| 61 | 61 | #ifndef _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H |
| 62 | 62 | #define _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H |
| 63 | 63 | |
| 64 | #include <__algorithm/upper_bound.h> | |
| 64 | #include <__algorithm/ranges_upper_bound.h> | |
| 65 | 65 | #include <__config> |
| 66 | 66 | #include <__iterator/access.h> |
| 67 | 67 | #include <cstddef> |
| ... | ... | @@ -111,7 +111,7 @@ enum class __property : uint8_t { |
| 111 | 111 | /// - https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt |
| 112 | 112 | /// |
| 113 | 113 | /// The data has 3 values |
| 114 | /// - bits [0, 3] The property. One of the values generated form the datafiles | |
| 114 | /// - bits [0, 3] The property. One of the values generated from the datafiles | |
| 115 | 115 | /// of \ref __property |
| 116 | 116 | /// - bits [4, 10] The size of the range. |
| 117 | 117 | /// - bits [11, 31] The lower bound code point of the range. The upper bound of |
| ... | ... | @@ -124,177 +124,1506 @@ enum class __property : uint8_t { |
| 124 | 124 | /// this approach uses less space for the data and is about 4% faster in the |
| 125 | 125 | /// following benchmark. |
| 126 | 126 | /// libcxx/benchmarks/std_format_spec_string_unicode.bench.cpp |
| 127 | inline constexpr uint32_t __entries[1480] = { | |
| 128 | 0x00000091, 0x00005005, 0x00005811, 0x00006800, 0x00007111, 0x0003fa01, 0x00054803, 0x00056801, 0x00057003, | |
| 129 | 0x001806f2, 0x00241862, 0x002c8ac2, 0x002df802, 0x002e0812, 0x002e2012, 0x002e3802, 0x00300058, 0x003080a2, | |
| 130 | 0x0030e001, 0x00325942, 0x00338002, 0x0036b062, 0x0036e808, 0x0036f852, 0x00373812, 0x00375032, 0x00387808, | |
| 131 | 0x00388802, 0x003981a2, 0x003d30a2, 0x003f5882, 0x003fe802, 0x0040b032, 0x0040d882, 0x00412822, 0x00414842, | |
| 132 | 0x0042c822, 0x00448018, 0x0044c072, 0x00465172, 0x00471008, 0x004719f2, 0x0048180a, 0x0049d002, 0x0049d80a, | |
| 133 | 0x0049e002, 0x0049f02a, 0x004a0872, 0x004a483a, 0x004a6802, 0x004a701a, 0x004a8862, 0x004b1012, 0x004c0802, | |
| 134 | 0x004c101a, 0x004de002, 0x004df002, 0x004df81a, 0x004e0832, 0x004e381a, 0x004e581a, 0x004e6802, 0x004eb802, | |
| 135 | 0x004f1012, 0x004ff002, 0x00500812, 0x0050180a, 0x0051e002, 0x0051f02a, 0x00520812, 0x00523812, 0x00525822, | |
| 136 | 0x00528802, 0x00538012, 0x0053a802, 0x00540812, 0x0054180a, 0x0055e002, 0x0055f02a, 0x00560842, 0x00563812, | |
| 137 | 0x0056480a, 0x0056581a, 0x00566802, 0x00571012, 0x0057d052, 0x00580802, 0x0058101a, 0x0059e002, 0x0059f012, | |
| 138 | 0x005a000a, 0x005a0832, 0x005a381a, 0x005a581a, 0x005a6802, 0x005aa822, 0x005b1012, 0x005c1002, 0x005df002, | |
| 139 | 0x005df80a, 0x005e0002, 0x005e081a, 0x005e302a, 0x005e502a, 0x005e6802, 0x005eb802, 0x00600002, 0x0060082a, | |
| 140 | 0x00602002, 0x0061e002, 0x0061f022, 0x0062083a, 0x00623022, 0x00625032, 0x0062a812, 0x00631012, 0x00640802, | |
| 141 | 0x0064101a, 0x0065e002, 0x0065f00a, 0x0065f802, 0x0066001a, 0x00661002, 0x0066181a, 0x00663002, 0x0066381a, | |
| 142 | 0x0066501a, 0x00666012, 0x0066a812, 0x00671012, 0x00680012, 0x0068101a, 0x0069d812, 0x0069f002, 0x0069f81a, | |
| 143 | 0x006a0832, 0x006a302a, 0x006a502a, 0x006a6802, 0x006a7008, 0x006ab802, 0x006b1012, 0x006c0802, 0x006c101a, | |
| 144 | 0x006e5002, 0x006e7802, 0x006e801a, 0x006e9022, 0x006eb002, 0x006ec06a, 0x006ef802, 0x006f901a, 0x00718802, | |
| 145 | 0x0071980a, 0x0071a062, 0x00723872, 0x00758802, 0x0075980a, 0x0075a082, 0x00764052, 0x0078c012, 0x0079a802, | |
| 146 | 0x0079b802, 0x0079c802, 0x0079f01a, 0x007b88d2, 0x007bf80a, 0x007c0042, 0x007c3012, 0x007c68a2, 0x007cca32, | |
| 147 | 0x007e3002, 0x00816832, 0x0081880a, 0x00819052, 0x0081c812, 0x0081d81a, 0x0081e812, 0x0082b01a, 0x0082c012, | |
| 148 | 0x0082f022, 0x00838832, 0x00841002, 0x0084200a, 0x00842812, 0x00846802, 0x0084e802, 0x008805f4, 0x008b047c, | |
| 149 | 0x008d457b, 0x009ae822, 0x00b89022, 0x00b8a80a, 0x00b99012, 0x00b9a00a, 0x00ba9012, 0x00bb9012, 0x00bda012, | |
| 150 | 0x00bdb00a, 0x00bdb862, 0x00bdf07a, 0x00be3002, 0x00be381a, 0x00be48a2, 0x00bee802, 0x00c05822, 0x00c07001, | |
| 151 | 0x00c07802, 0x00c42812, 0x00c54802, 0x00c90022, 0x00c9183a, 0x00c93812, 0x00c9482a, 0x00c9801a, 0x00c99002, | |
| 152 | 0x00c9985a, 0x00c9c822, 0x00d0b812, 0x00d0c81a, 0x00d0d802, 0x00d2a80a, 0x00d2b002, 0x00d2b80a, 0x00d2c062, | |
| 153 | 0x00d30002, 0x00d31002, 0x00d32872, 0x00d3685a, 0x00d39892, 0x00d3f802, 0x00d581e2, 0x00d80032, 0x00d8200a, | |
| 154 | 0x00d9a062, 0x00d9d80a, 0x00d9e002, 0x00d9e84a, 0x00da1002, 0x00da181a, 0x00db5882, 0x00dc0012, 0x00dc100a, | |
| 155 | 0x00dd080a, 0x00dd1032, 0x00dd301a, 0x00dd4012, 0x00dd500a, 0x00dd5822, 0x00df3002, 0x00df380a, 0x00df4012, | |
| 156 | 0x00df502a, 0x00df6802, 0x00df700a, 0x00df7822, 0x00df901a, 0x00e1207a, 0x00e16072, 0x00e1a01a, 0x00e1b012, | |
| 157 | 0x00e68022, 0x00e6a0c2, 0x00e7080a, 0x00e71062, 0x00e76802, 0x00e7a002, 0x00e7b80a, 0x00e7c012, 0x00ee03f2, | |
| 158 | 0x01005801, 0x01006002, 0x0100680d, 0x01007011, 0x01014061, 0x0101e003, 0x01024803, 0x010300f1, 0x01068202, | |
| 159 | 0x01091003, 0x0109c803, 0x010ca053, 0x010d4813, 0x0118d013, 0x01194003, 0x011c4003, 0x011e7803, 0x011f48a3, | |
| 160 | 0x011fc023, 0x01261003, 0x012d5013, 0x012db003, 0x012e0003, 0x012fd833, 0x01300053, 0x013038b3, 0x0130a713, | |
| 161 | 0x01348753, 0x013840a3, 0x0138a003, 0x0138b003, 0x0138e803, 0x01390803, 0x01394003, 0x01399813, 0x013a2003, | |
| 162 | 0x013a3803, 0x013a6003, 0x013a7003, 0x013a9823, 0x013ab803, 0x013b1843, 0x013ca823, 0x013d0803, 0x013d8003, | |
| 163 | 0x013df803, 0x0149a013, 0x01582823, 0x0158d813, 0x015a8003, 0x015aa803, 0x01677822, 0x016bf802, 0x016f01f2, | |
| 164 | 0x01815052, 0x01818003, 0x0181e803, 0x0184c812, 0x0194b803, 0x0194c803, 0x05337832, 0x0533a092, 0x0534f012, | |
| 165 | 0x05378012, 0x05401002, 0x05403002, 0x05405802, 0x0541181a, 0x05412812, 0x0541380a, 0x05416002, 0x0544001a, | |
| 166 | 0x0545a0fa, 0x05462012, 0x05470112, 0x0547f802, 0x05493072, 0x054a38a2, 0x054a901a, 0x054b01c4, 0x054c0022, | |
| 167 | 0x054c180a, 0x054d9802, 0x054da01a, 0x054db032, 0x054dd01a, 0x054de012, 0x054df02a, 0x054f2802, 0x05514852, | |
| 168 | 0x0551781a, 0x05518812, 0x0551981a, 0x0551a812, 0x05521802, 0x05526002, 0x0552680a, 0x0553e002, 0x05558002, | |
| 169 | 0x05559022, 0x0555b812, 0x0555f012, 0x05560802, 0x0557580a, 0x05576012, 0x0557701a, 0x0557a80a, 0x0557b002, | |
| 170 | 0x055f181a, 0x055f2802, 0x055f301a, 0x055f4002, 0x055f481a, 0x055f600a, 0x055f6802, 0x05600006, 0x056009a7, | |
| 171 | 0x0560e006, 0x0560e9a7, 0x0561c006, 0x0561c9a7, 0x0562a006, 0x0562a9a7, 0x05638006, 0x056389a7, 0x05646006, | |
| 172 | 0x056469a7, 0x05654006, 0x056549a7, 0x05662006, 0x056629a7, 0x05670006, 0x056709a7, 0x0567e006, 0x0567e9a7, | |
| 173 | 0x0568c006, 0x0568c9a7, 0x0569a006, 0x0569a9a7, 0x056a8006, 0x056a89a7, 0x056b6006, 0x056b69a7, 0x056c4006, | |
| 174 | 0x056c49a7, 0x056d2006, 0x056d29a7, 0x056e0006, 0x056e09a7, 0x056ee006, 0x056ee9a7, 0x056fc006, 0x056fc9a7, | |
| 175 | 0x0570a006, 0x0570a9a7, 0x05718006, 0x057189a7, 0x05726006, 0x057269a7, 0x05734006, 0x057349a7, 0x05742006, | |
| 176 | 0x057429a7, 0x05750006, 0x057509a7, 0x0575e006, 0x0575e9a7, 0x0576c006, 0x0576c9a7, 0x0577a006, 0x0577a9a7, | |
| 177 | 0x05788006, 0x057889a7, 0x05796006, 0x057969a7, 0x057a4006, 0x057a49a7, 0x057b2006, 0x057b29a7, 0x057c0006, | |
| 178 | 0x057c09a7, 0x057ce006, 0x057ce9a7, 0x057dc006, 0x057dc9a7, 0x057ea006, 0x057ea9a7, 0x057f8006, 0x057f89a7, | |
| 179 | 0x05806006, 0x058069a7, 0x05814006, 0x058149a7, 0x05822006, 0x058229a7, 0x05830006, 0x058309a7, 0x0583e006, | |
| 180 | 0x0583e9a7, 0x0584c006, 0x0584c9a7, 0x0585a006, 0x0585a9a7, 0x05868006, 0x058689a7, 0x05876006, 0x058769a7, | |
| 181 | 0x05884006, 0x058849a7, 0x05892006, 0x058929a7, 0x058a0006, 0x058a09a7, 0x058ae006, 0x058ae9a7, 0x058bc006, | |
| 182 | 0x058bc9a7, 0x058ca006, 0x058ca9a7, 0x058d8006, 0x058d89a7, 0x058e6006, 0x058e69a7, 0x058f4006, 0x058f49a7, | |
| 183 | 0x05902006, 0x059029a7, 0x05910006, 0x059109a7, 0x0591e006, 0x0591e9a7, 0x0592c006, 0x0592c9a7, 0x0593a006, | |
| 184 | 0x0593a9a7, 0x05948006, 0x059489a7, 0x05956006, 0x059569a7, 0x05964006, 0x059649a7, 0x05972006, 0x059729a7, | |
| 185 | 0x05980006, 0x059809a7, 0x0598e006, 0x0598e9a7, 0x0599c006, 0x0599c9a7, 0x059aa006, 0x059aa9a7, 0x059b8006, | |
| 186 | 0x059b89a7, 0x059c6006, 0x059c69a7, 0x059d4006, 0x059d49a7, 0x059e2006, 0x059e29a7, 0x059f0006, 0x059f09a7, | |
| 187 | 0x059fe006, 0x059fe9a7, 0x05a0c006, 0x05a0c9a7, 0x05a1a006, 0x05a1a9a7, 0x05a28006, 0x05a289a7, 0x05a36006, | |
| 188 | 0x05a369a7, 0x05a44006, 0x05a449a7, 0x05a52006, 0x05a529a7, 0x05a60006, 0x05a609a7, 0x05a6e006, 0x05a6e9a7, | |
| 189 | 0x05a7c006, 0x05a7c9a7, 0x05a8a006, 0x05a8a9a7, 0x05a98006, 0x05a989a7, 0x05aa6006, 0x05aa69a7, 0x05ab4006, | |
| 190 | 0x05ab49a7, 0x05ac2006, 0x05ac29a7, 0x05ad0006, 0x05ad09a7, 0x05ade006, 0x05ade9a7, 0x05aec006, 0x05aec9a7, | |
| 191 | 0x05afa006, 0x05afa9a7, 0x05b08006, 0x05b089a7, 0x05b16006, 0x05b169a7, 0x05b24006, 0x05b249a7, 0x05b32006, | |
| 192 | 0x05b329a7, 0x05b40006, 0x05b409a7, 0x05b4e006, 0x05b4e9a7, 0x05b5c006, 0x05b5c9a7, 0x05b6a006, 0x05b6a9a7, | |
| 193 | 0x05b78006, 0x05b789a7, 0x05b86006, 0x05b869a7, 0x05b94006, 0x05b949a7, 0x05ba2006, 0x05ba29a7, 0x05bb0006, | |
| 194 | 0x05bb09a7, 0x05bbe006, 0x05bbe9a7, 0x05bcc006, 0x05bcc9a7, 0x05bda006, 0x05bda9a7, 0x05be8006, 0x05be89a7, | |
| 195 | 0x05bf6006, 0x05bf69a7, 0x05c04006, 0x05c049a7, 0x05c12006, 0x05c129a7, 0x05c20006, 0x05c209a7, 0x05c2e006, | |
| 196 | 0x05c2e9a7, 0x05c3c006, 0x05c3c9a7, 0x05c4a006, 0x05c4a9a7, 0x05c58006, 0x05c589a7, 0x05c66006, 0x05c669a7, | |
| 197 | 0x05c74006, 0x05c749a7, 0x05c82006, 0x05c829a7, 0x05c90006, 0x05c909a7, 0x05c9e006, 0x05c9e9a7, 0x05cac006, | |
| 198 | 0x05cac9a7, 0x05cba006, 0x05cba9a7, 0x05cc8006, 0x05cc89a7, 0x05cd6006, 0x05cd69a7, 0x05ce4006, 0x05ce49a7, | |
| 199 | 0x05cf2006, 0x05cf29a7, 0x05d00006, 0x05d009a7, 0x05d0e006, 0x05d0e9a7, 0x05d1c006, 0x05d1c9a7, 0x05d2a006, | |
| 200 | 0x05d2a9a7, 0x05d38006, 0x05d389a7, 0x05d46006, 0x05d469a7, 0x05d54006, 0x05d549a7, 0x05d62006, 0x05d629a7, | |
| 201 | 0x05d70006, 0x05d709a7, 0x05d7e006, 0x05d7e9a7, 0x05d8c006, 0x05d8c9a7, 0x05d9a006, 0x05d9a9a7, 0x05da8006, | |
| 202 | 0x05da89a7, 0x05db6006, 0x05db69a7, 0x05dc4006, 0x05dc49a7, 0x05dd2006, 0x05dd29a7, 0x05de0006, 0x05de09a7, | |
| 203 | 0x05dee006, 0x05dee9a7, 0x05dfc006, 0x05dfc9a7, 0x05e0a006, 0x05e0a9a7, 0x05e18006, 0x05e189a7, 0x05e26006, | |
| 204 | 0x05e269a7, 0x05e34006, 0x05e349a7, 0x05e42006, 0x05e429a7, 0x05e50006, 0x05e509a7, 0x05e5e006, 0x05e5e9a7, | |
| 205 | 0x05e6c006, 0x05e6c9a7, 0x05e7a006, 0x05e7a9a7, 0x05e88006, 0x05e889a7, 0x05e96006, 0x05e969a7, 0x05ea4006, | |
| 206 | 0x05ea49a7, 0x05eb2006, 0x05eb29a7, 0x05ec0006, 0x05ec09a7, 0x05ece006, 0x05ece9a7, 0x05edc006, 0x05edc9a7, | |
| 207 | 0x05eea006, 0x05eea9a7, 0x05ef8006, 0x05ef89a7, 0x05f06006, 0x05f069a7, 0x05f14006, 0x05f149a7, 0x05f22006, | |
| 208 | 0x05f229a7, 0x05f30006, 0x05f309a7, 0x05f3e006, 0x05f3e9a7, 0x05f4c006, 0x05f4c9a7, 0x05f5a006, 0x05f5a9a7, | |
| 209 | 0x05f68006, 0x05f689a7, 0x05f76006, 0x05f769a7, 0x05f84006, 0x05f849a7, 0x05f92006, 0x05f929a7, 0x05fa0006, | |
| 210 | 0x05fa09a7, 0x05fae006, 0x05fae9a7, 0x05fbc006, 0x05fbc9a7, 0x05fca006, 0x05fca9a7, 0x05fd8006, 0x05fd89a7, | |
| 211 | 0x05fe6006, 0x05fe69a7, 0x05ff4006, 0x05ff49a7, 0x06002006, 0x060029a7, 0x06010006, 0x060109a7, 0x0601e006, | |
| 212 | 0x0601e9a7, 0x0602c006, 0x0602c9a7, 0x0603a006, 0x0603a9a7, 0x06048006, 0x060489a7, 0x06056006, 0x060569a7, | |
| 213 | 0x06064006, 0x060649a7, 0x06072006, 0x060729a7, 0x06080006, 0x060809a7, 0x0608e006, 0x0608e9a7, 0x0609c006, | |
| 214 | 0x0609c9a7, 0x060aa006, 0x060aa9a7, 0x060b8006, 0x060b89a7, 0x060c6006, 0x060c69a7, 0x060d4006, 0x060d49a7, | |
| 215 | 0x060e2006, 0x060e29a7, 0x060f0006, 0x060f09a7, 0x060fe006, 0x060fe9a7, 0x0610c006, 0x0610c9a7, 0x0611a006, | |
| 216 | 0x0611a9a7, 0x06128006, 0x061289a7, 0x06136006, 0x061369a7, 0x06144006, 0x061449a7, 0x06152006, 0x061529a7, | |
| 217 | 0x06160006, 0x061609a7, 0x0616e006, 0x0616e9a7, 0x0617c006, 0x0617c9a7, 0x0618a006, 0x0618a9a7, 0x06198006, | |
| 218 | 0x061989a7, 0x061a6006, 0x061a69a7, 0x061b4006, 0x061b49a7, 0x061c2006, 0x061c29a7, 0x061d0006, 0x061d09a7, | |
| 219 | 0x061de006, 0x061de9a7, 0x061ec006, 0x061ec9a7, 0x061fa006, 0x061fa9a7, 0x06208006, 0x062089a7, 0x06216006, | |
| 220 | 0x062169a7, 0x06224006, 0x062249a7, 0x06232006, 0x062329a7, 0x06240006, 0x062409a7, 0x0624e006, 0x0624e9a7, | |
| 221 | 0x0625c006, 0x0625c9a7, 0x0626a006, 0x0626a9a7, 0x06278006, 0x062789a7, 0x06286006, 0x062869a7, 0x06294006, | |
| 222 | 0x062949a7, 0x062a2006, 0x062a29a7, 0x062b0006, 0x062b09a7, 0x062be006, 0x062be9a7, 0x062cc006, 0x062cc9a7, | |
| 223 | 0x062da006, 0x062da9a7, 0x062e8006, 0x062e89a7, 0x062f6006, 0x062f69a7, 0x06304006, 0x063049a7, 0x06312006, | |
| 224 | 0x063129a7, 0x06320006, 0x063209a7, 0x0632e006, 0x0632e9a7, 0x0633c006, 0x0633c9a7, 0x0634a006, 0x0634a9a7, | |
| 225 | 0x06358006, 0x063589a7, 0x06366006, 0x063669a7, 0x06374006, 0x063749a7, 0x06382006, 0x063829a7, 0x06390006, | |
| 226 | 0x063909a7, 0x0639e006, 0x0639e9a7, 0x063ac006, 0x063ac9a7, 0x063ba006, 0x063ba9a7, 0x063c8006, 0x063c89a7, | |
| 227 | 0x063d6006, 0x063d69a7, 0x063e4006, 0x063e49a7, 0x063f2006, 0x063f29a7, 0x06400006, 0x064009a7, 0x0640e006, | |
| 228 | 0x0640e9a7, 0x0641c006, 0x0641c9a7, 0x0642a006, 0x0642a9a7, 0x06438006, 0x064389a7, 0x06446006, 0x064469a7, | |
| 229 | 0x06454006, 0x064549a7, 0x06462006, 0x064629a7, 0x06470006, 0x064709a7, 0x0647e006, 0x0647e9a7, 0x0648c006, | |
| 230 | 0x0648c9a7, 0x0649a006, 0x0649a9a7, 0x064a8006, 0x064a89a7, 0x064b6006, 0x064b69a7, 0x064c4006, 0x064c49a7, | |
| 231 | 0x064d2006, 0x064d29a7, 0x064e0006, 0x064e09a7, 0x064ee006, 0x064ee9a7, 0x064fc006, 0x064fc9a7, 0x0650a006, | |
| 232 | 0x0650a9a7, 0x06518006, 0x065189a7, 0x06526006, 0x065269a7, 0x06534006, 0x065349a7, 0x06542006, 0x065429a7, | |
| 233 | 0x06550006, 0x065509a7, 0x0655e006, 0x0655e9a7, 0x0656c006, 0x0656c9a7, 0x0657a006, 0x0657a9a7, 0x06588006, | |
| 234 | 0x065889a7, 0x06596006, 0x065969a7, 0x065a4006, 0x065a49a7, 0x065b2006, 0x065b29a7, 0x065c0006, 0x065c09a7, | |
| 235 | 0x065ce006, 0x065ce9a7, 0x065dc006, 0x065dc9a7, 0x065ea006, 0x065ea9a7, 0x065f8006, 0x065f89a7, 0x06606006, | |
| 236 | 0x066069a7, 0x06614006, 0x066149a7, 0x06622006, 0x066229a7, 0x06630006, 0x066309a7, 0x0663e006, 0x0663e9a7, | |
| 237 | 0x0664c006, 0x0664c9a7, 0x0665a006, 0x0665a9a7, 0x06668006, 0x066689a7, 0x06676006, 0x066769a7, 0x06684006, | |
| 238 | 0x066849a7, 0x06692006, 0x066929a7, 0x066a0006, 0x066a09a7, 0x066ae006, 0x066ae9a7, 0x066bc006, 0x066bc9a7, | |
| 239 | 0x066ca006, 0x066ca9a7, 0x066d8006, 0x066d89a7, 0x066e6006, 0x066e69a7, 0x066f4006, 0x066f49a7, 0x06702006, | |
| 240 | 0x067029a7, 0x06710006, 0x067109a7, 0x0671e006, 0x0671e9a7, 0x0672c006, 0x0672c9a7, 0x0673a006, 0x0673a9a7, | |
| 241 | 0x06748006, 0x067489a7, 0x06756006, 0x067569a7, 0x06764006, 0x067649a7, 0x06772006, 0x067729a7, 0x06780006, | |
| 242 | 0x067809a7, 0x0678e006, 0x0678e9a7, 0x0679c006, 0x0679c9a7, 0x067aa006, 0x067aa9a7, 0x067b8006, 0x067b89a7, | |
| 243 | 0x067c6006, 0x067c69a7, 0x067d4006, 0x067d49a7, 0x067e2006, 0x067e29a7, 0x067f0006, 0x067f09a7, 0x067fe006, | |
| 244 | 0x067fe9a7, 0x0680c006, 0x0680c9a7, 0x0681a006, 0x0681a9a7, 0x06828006, 0x068289a7, 0x06836006, 0x068369a7, | |
| 245 | 0x06844006, 0x068449a7, 0x06852006, 0x068529a7, 0x06860006, 0x068609a7, 0x0686e006, 0x0686e9a7, 0x0687c006, | |
| 246 | 0x0687c9a7, 0x0688a006, 0x0688a9a7, 0x06898006, 0x068989a7, 0x068a6006, 0x068a69a7, 0x068b4006, 0x068b49a7, | |
| 247 | 0x068c2006, 0x068c29a7, 0x068d0006, 0x068d09a7, 0x068de006, 0x068de9a7, 0x068ec006, 0x068ec9a7, 0x068fa006, | |
| 248 | 0x068fa9a7, 0x06908006, 0x069089a7, 0x06916006, 0x069169a7, 0x06924006, 0x069249a7, 0x06932006, 0x069329a7, | |
| 249 | 0x06940006, 0x069409a7, 0x0694e006, 0x0694e9a7, 0x0695c006, 0x0695c9a7, 0x0696a006, 0x0696a9a7, 0x06978006, | |
| 250 | 0x069789a7, 0x06986006, 0x069869a7, 0x06994006, 0x069949a7, 0x069a2006, 0x069a29a7, 0x069b0006, 0x069b09a7, | |
| 251 | 0x069be006, 0x069be9a7, 0x069cc006, 0x069cc9a7, 0x069da006, 0x069da9a7, 0x069e8006, 0x069e89a7, 0x069f6006, | |
| 252 | 0x069f69a7, 0x06a04006, 0x06a049a7, 0x06a12006, 0x06a129a7, 0x06a20006, 0x06a209a7, 0x06a2e006, 0x06a2e9a7, | |
| 253 | 0x06a3c006, 0x06a3c9a7, 0x06a4a006, 0x06a4a9a7, 0x06a58006, 0x06a589a7, 0x06a66006, 0x06a669a7, 0x06a74006, | |
| 254 | 0x06a749a7, 0x06a82006, 0x06a829a7, 0x06a90006, 0x06a909a7, 0x06a9e006, 0x06a9e9a7, 0x06aac006, 0x06aac9a7, | |
| 255 | 0x06aba006, 0x06aba9a7, 0x06ac8006, 0x06ac89a7, 0x06ad6006, 0x06ad69a7, 0x06ae4006, 0x06ae49a7, 0x06af2006, | |
| 256 | 0x06af29a7, 0x06b00006, 0x06b009a7, 0x06b0e006, 0x06b0e9a7, 0x06b1c006, 0x06b1c9a7, 0x06b2a006, 0x06b2a9a7, | |
| 257 | 0x06b38006, 0x06b389a7, 0x06b46006, 0x06b469a7, 0x06b54006, 0x06b549a7, 0x06b62006, 0x06b629a7, 0x06b70006, | |
| 258 | 0x06b709a7, 0x06b7e006, 0x06b7e9a7, 0x06b8c006, 0x06b8c9a7, 0x06b9a006, 0x06b9a9a7, 0x06ba8006, 0x06ba89a7, | |
| 259 | 0x06bb6006, 0x06bb69a7, 0x06bc4006, 0x06bc49a7, 0x06bd816c, 0x06be5b0b, 0x07d8f002, 0x07f000f2, 0x07f100f2, | |
| 260 | 0x07f7f801, 0x07fcf012, 0x07ff80b1, 0x080fe802, 0x08170002, 0x081bb042, 0x08500822, 0x08502812, 0x08506032, | |
| 261 | 0x0851c022, 0x0851f802, 0x08572812, 0x08692032, 0x08755812, 0x087a30a2, 0x087c1032, 0x0880000a, 0x08800802, | |
| 262 | 0x0880100a, 0x0881c0e2, 0x08838002, 0x08839812, 0x0883f822, 0x0884100a, 0x0885802a, 0x08859832, 0x0885b81a, | |
| 263 | 0x0885c812, 0x0885e808, 0x08861002, 0x08866808, 0x08880022, 0x08893842, 0x0889600a, 0x08896872, 0x088a281a, | |
| 264 | 0x088b9802, 0x088c0012, 0x088c100a, 0x088d982a, 0x088db082, 0x088df81a, 0x088e1018, 0x088e4832, 0x088e700a, | |
| 265 | 0x088e7802, 0x0891602a, 0x08917822, 0x0891901a, 0x0891a002, 0x0891a80a, 0x0891b012, 0x0891f002, 0x0896f802, | |
| 266 | 0x0897002a, 0x08971872, 0x08980012, 0x0898101a, 0x0899d812, 0x0899f002, 0x0899f80a, 0x089a0002, 0x089a083a, | |
| 267 | 0x089a381a, 0x089a582a, 0x089ab802, 0x089b101a, 0x089b3062, 0x089b8042, 0x08a1a82a, 0x08a1c072, 0x08a2001a, | |
| 268 | 0x08a21022, 0x08a2280a, 0x08a23002, 0x08a2f002, 0x08a58002, 0x08a5881a, 0x08a59852, 0x08a5c80a, 0x08a5d002, | |
| 269 | 0x08a5d81a, 0x08a5e802, 0x08a5f00a, 0x08a5f812, 0x08a6080a, 0x08a61012, 0x08ad7802, 0x08ad801a, 0x08ad9032, | |
| 270 | 0x08adc03a, 0x08ade012, 0x08adf00a, 0x08adf812, 0x08aee012, 0x08b1802a, 0x08b19872, 0x08b1d81a, 0x08b1e802, | |
| 271 | 0x08b1f00a, 0x08b1f812, 0x08b55802, 0x08b5600a, 0x08b56802, 0x08b5701a, 0x08b58052, 0x08b5b00a, 0x08b5b802, | |
| 272 | 0x08b8e822, 0x08b91032, 0x08b9300a, 0x08b93842, 0x08c1602a, 0x08c17882, 0x08c1c00a, 0x08c1c812, 0x08c98002, | |
| 273 | 0x08c9884a, 0x08c9b81a, 0x08c9d812, 0x08c9e80a, 0x08c9f002, 0x08c9f808, 0x08ca000a, 0x08ca0808, 0x08ca100a, | |
| 274 | 0x08ca1802, 0x08ce882a, 0x08cea032, 0x08ced012, 0x08cee03a, 0x08cf0002, 0x08cf200a, 0x08d00892, 0x08d19852, | |
| 275 | 0x08d1c80a, 0x08d1d008, 0x08d1d832, 0x08d23802, 0x08d28852, 0x08d2b81a, 0x08d2c822, 0x08d42058, 0x08d450c2, | |
| 276 | 0x08d4b80a, 0x08d4c012, 0x08e1780a, 0x08e18062, 0x08e1c052, 0x08e1f00a, 0x08e1f802, 0x08e49152, 0x08e5480a, | |
| 277 | 0x08e55062, 0x08e5880a, 0x08e59012, 0x08e5a00a, 0x08e5a812, 0x08e98852, 0x08e9d002, 0x08e9e012, 0x08e9f862, | |
| 278 | 0x08ea3008, 0x08ea3802, 0x08ec504a, 0x08ec8012, 0x08ec981a, 0x08eca802, 0x08ecb00a, 0x08ecb802, 0x08f79812, | |
| 279 | 0x08f7a81a, 0x09a18081, 0x0b578042, 0x0b598062, 0x0b7a7802, 0x0b7a8b6a, 0x0b7c7832, 0x0b7f2002, 0x0b7f801a, | |
| 280 | 0x0de4e812, 0x0de50031, 0x0e7802d2, 0x0e798162, 0x0e8b2802, 0x0e8b300a, 0x0e8b3822, 0x0e8b680a, 0x0e8b7042, | |
| 281 | 0x0e8b9871, 0x0e8bd872, 0x0e8c2862, 0x0e8d5032, 0x0e921022, 0x0ed00362, 0x0ed1db12, 0x0ed3a802, 0x0ed42002, | |
| 282 | 0x0ed4d842, 0x0ed508e2, 0x0f000062, 0x0f004102, 0x0f00d862, 0x0f011812, 0x0f013042, 0x0f098062, 0x0f157002, | |
| 283 | 0x0f176032, 0x0f468062, 0x0f4a2062, 0x0f8007f3, 0x0f8407f3, 0x0f886823, 0x0f897803, 0x0f8b6053, 0x0f8bf013, | |
| 284 | 0x0f8c7003, 0x0f8c8893, 0x0f8d6b83, 0x0f8f3199, 0x0f9008e3, 0x0f90d003, 0x0f917803, 0x0f919083, 0x0f91e033, | |
| 285 | 0x0f924ff3, 0x0f964ff3, 0x0f9a4ff3, 0x0f9e4b13, 0x0f9fd842, 0x0fa007f3, 0x0fa407f3, 0x0fa803d3, 0x0faa37f3, | |
| 286 | 0x0fae37f3, 0x0fb23093, 0x0fb407f3, 0x0fbba0b3, 0x0fbeaaa3, 0x0fc06033, 0x0fc24073, 0x0fc2d053, 0x0fc44073, | |
| 287 | 0x0fc57513, 0x0fc862e3, 0x0fc9e093, 0x0fca3ff3, 0x0fce3ff3, 0x0fd23ff3, 0x0fd63b83, 0x0fe007f3, 0x0fe407f3, | |
| 288 | 0x0fe807f3, 0x0fec07f3, 0x0ff007f3, 0x0ff407f3, 0x0ff807f3, 0x0ffc07d3, 0x700001f1, 0x700105f2, 0x700407f1, | |
| 289 | 0x700807f2, 0x700c06f2, 0x700f87f1, 0x701387f1, 0x701787f1, 0x701b87f1, 0x701f87f1, 0x702387f1, 0x702787f1, | |
| 290 | 0x702b87f1, 0x702f87f1, 0x703387f1, 0x703787f1, 0x703b87f1, 0x703f87f1, 0x704387f1, 0x704787f1, 0x704b87f1, | |
| 291 | 0x704f87f1, 0x705387f1, 0x705787f1, 0x705b87f1, 0x705f87f1, 0x706387f1, 0x706787f1, 0x706b87f1, 0x706f87f1, | |
| 292 | 0x707387f1, 0x707787f1, 0x707b87f1, 0x707f80f1}; | |
| 127 | inline constexpr uint32_t __entries[1496] = { | |
| 128 | 0x00000091, | |
| 129 | 0x00005005, | |
| 130 | 0x00005811, | |
| 131 | 0x00006800, | |
| 132 | 0x00007111, | |
| 133 | 0x0003fa01, | |
| 134 | 0x00054803, | |
| 135 | 0x00056801, | |
| 136 | 0x00057003, | |
| 137 | 0x001806f2, | |
| 138 | 0x00241862, | |
| 139 | 0x002c8ac2, | |
| 140 | 0x002df802, | |
| 141 | 0x002e0812, | |
| 142 | 0x002e2012, | |
| 143 | 0x002e3802, | |
| 144 | 0x00300058, | |
| 145 | 0x003080a2, | |
| 146 | 0x0030e001, | |
| 147 | 0x00325942, | |
| 148 | 0x00338002, | |
| 149 | 0x0036b062, | |
| 150 | 0x0036e808, | |
| 151 | 0x0036f852, | |
| 152 | 0x00373812, | |
| 153 | 0x00375032, | |
| 154 | 0x00387808, | |
| 155 | 0x00388802, | |
| 156 | 0x003981a2, | |
| 157 | 0x003d30a2, | |
| 158 | 0x003f5882, | |
| 159 | 0x003fe802, | |
| 160 | 0x0040b032, | |
| 161 | 0x0040d882, | |
| 162 | 0x00412822, | |
| 163 | 0x00414842, | |
| 164 | 0x0042c822, | |
| 165 | 0x00448018, | |
| 166 | 0x0044c072, | |
| 167 | 0x00465172, | |
| 168 | 0x00471008, | |
| 169 | 0x004719f2, | |
| 170 | 0x0048180a, | |
| 171 | 0x0049d002, | |
| 172 | 0x0049d80a, | |
| 173 | 0x0049e002, | |
| 174 | 0x0049f02a, | |
| 175 | 0x004a0872, | |
| 176 | 0x004a483a, | |
| 177 | 0x004a6802, | |
| 178 | 0x004a701a, | |
| 179 | 0x004a8862, | |
| 180 | 0x004b1012, | |
| 181 | 0x004c0802, | |
| 182 | 0x004c101a, | |
| 183 | 0x004de002, | |
| 184 | 0x004df002, | |
| 185 | 0x004df81a, | |
| 186 | 0x004e0832, | |
| 187 | 0x004e381a, | |
| 188 | 0x004e581a, | |
| 189 | 0x004e6802, | |
| 190 | 0x004eb802, | |
| 191 | 0x004f1012, | |
| 192 | 0x004ff002, | |
| 193 | 0x00500812, | |
| 194 | 0x0050180a, | |
| 195 | 0x0051e002, | |
| 196 | 0x0051f02a, | |
| 197 | 0x00520812, | |
| 198 | 0x00523812, | |
| 199 | 0x00525822, | |
| 200 | 0x00528802, | |
| 201 | 0x00538012, | |
| 202 | 0x0053a802, | |
| 203 | 0x00540812, | |
| 204 | 0x0054180a, | |
| 205 | 0x0055e002, | |
| 206 | 0x0055f02a, | |
| 207 | 0x00560842, | |
| 208 | 0x00563812, | |
| 209 | 0x0056480a, | |
| 210 | 0x0056581a, | |
| 211 | 0x00566802, | |
| 212 | 0x00571012, | |
| 213 | 0x0057d052, | |
| 214 | 0x00580802, | |
| 215 | 0x0058101a, | |
| 216 | 0x0059e002, | |
| 217 | 0x0059f012, | |
| 218 | 0x005a000a, | |
| 219 | 0x005a0832, | |
| 220 | 0x005a381a, | |
| 221 | 0x005a581a, | |
| 222 | 0x005a6802, | |
| 223 | 0x005aa822, | |
| 224 | 0x005b1012, | |
| 225 | 0x005c1002, | |
| 226 | 0x005df002, | |
| 227 | 0x005df80a, | |
| 228 | 0x005e0002, | |
| 229 | 0x005e081a, | |
| 230 | 0x005e302a, | |
| 231 | 0x005e502a, | |
| 232 | 0x005e6802, | |
| 233 | 0x005eb802, | |
| 234 | 0x00600002, | |
| 235 | 0x0060082a, | |
| 236 | 0x00602002, | |
| 237 | 0x0061e002, | |
| 238 | 0x0061f022, | |
| 239 | 0x0062083a, | |
| 240 | 0x00623022, | |
| 241 | 0x00625032, | |
| 242 | 0x0062a812, | |
| 243 | 0x00631012, | |
| 244 | 0x00640802, | |
| 245 | 0x0064101a, | |
| 246 | 0x0065e002, | |
| 247 | 0x0065f00a, | |
| 248 | 0x0065f802, | |
| 249 | 0x0066001a, | |
| 250 | 0x00661002, | |
| 251 | 0x0066181a, | |
| 252 | 0x00663002, | |
| 253 | 0x0066381a, | |
| 254 | 0x0066501a, | |
| 255 | 0x00666012, | |
| 256 | 0x0066a812, | |
| 257 | 0x00671012, | |
| 258 | 0x0067980a, | |
| 259 | 0x00680012, | |
| 260 | 0x0068101a, | |
| 261 | 0x0069d812, | |
| 262 | 0x0069f002, | |
| 263 | 0x0069f81a, | |
| 264 | 0x006a0832, | |
| 265 | 0x006a302a, | |
| 266 | 0x006a502a, | |
| 267 | 0x006a6802, | |
| 268 | 0x006a7008, | |
| 269 | 0x006ab802, | |
| 270 | 0x006b1012, | |
| 271 | 0x006c0802, | |
| 272 | 0x006c101a, | |
| 273 | 0x006e5002, | |
| 274 | 0x006e7802, | |
| 275 | 0x006e801a, | |
| 276 | 0x006e9022, | |
| 277 | 0x006eb002, | |
| 278 | 0x006ec06a, | |
| 279 | 0x006ef802, | |
| 280 | 0x006f901a, | |
| 281 | 0x00718802, | |
| 282 | 0x0071980a, | |
| 283 | 0x0071a062, | |
| 284 | 0x00723872, | |
| 285 | 0x00758802, | |
| 286 | 0x0075980a, | |
| 287 | 0x0075a082, | |
| 288 | 0x00764062, | |
| 289 | 0x0078c012, | |
| 290 | 0x0079a802, | |
| 291 | 0x0079b802, | |
| 292 | 0x0079c802, | |
| 293 | 0x0079f01a, | |
| 294 | 0x007b88d2, | |
| 295 | 0x007bf80a, | |
| 296 | 0x007c0042, | |
| 297 | 0x007c3012, | |
| 298 | 0x007c68a2, | |
| 299 | 0x007cca32, | |
| 300 | 0x007e3002, | |
| 301 | 0x00816832, | |
| 302 | 0x0081880a, | |
| 303 | 0x00819052, | |
| 304 | 0x0081c812, | |
| 305 | 0x0081d81a, | |
| 306 | 0x0081e812, | |
| 307 | 0x0082b01a, | |
| 308 | 0x0082c012, | |
| 309 | 0x0082f022, | |
| 310 | 0x00838832, | |
| 311 | 0x00841002, | |
| 312 | 0x0084200a, | |
| 313 | 0x00842812, | |
| 314 | 0x00846802, | |
| 315 | 0x0084e802, | |
| 316 | 0x008805f4, | |
| 317 | 0x008b047c, | |
| 318 | 0x008d457b, | |
| 319 | 0x009ae822, | |
| 320 | 0x00b89022, | |
| 321 | 0x00b8a80a, | |
| 322 | 0x00b99012, | |
| 323 | 0x00b9a00a, | |
| 324 | 0x00ba9012, | |
| 325 | 0x00bb9012, | |
| 326 | 0x00bda012, | |
| 327 | 0x00bdb00a, | |
| 328 | 0x00bdb862, | |
| 329 | 0x00bdf07a, | |
| 330 | 0x00be3002, | |
| 331 | 0x00be381a, | |
| 332 | 0x00be48a2, | |
| 333 | 0x00bee802, | |
| 334 | 0x00c05822, | |
| 335 | 0x00c07001, | |
| 336 | 0x00c07802, | |
| 337 | 0x00c42812, | |
| 338 | 0x00c54802, | |
| 339 | 0x00c90022, | |
| 340 | 0x00c9183a, | |
| 341 | 0x00c93812, | |
| 342 | 0x00c9482a, | |
| 343 | 0x00c9801a, | |
| 344 | 0x00c99002, | |
| 345 | 0x00c9985a, | |
| 346 | 0x00c9c822, | |
| 347 | 0x00d0b812, | |
| 348 | 0x00d0c81a, | |
| 349 | 0x00d0d802, | |
| 350 | 0x00d2a80a, | |
| 351 | 0x00d2b002, | |
| 352 | 0x00d2b80a, | |
| 353 | 0x00d2c062, | |
| 354 | 0x00d30002, | |
| 355 | 0x00d31002, | |
| 356 | 0x00d32872, | |
| 357 | 0x00d3685a, | |
| 358 | 0x00d39892, | |
| 359 | 0x00d3f802, | |
| 360 | 0x00d581e2, | |
| 361 | 0x00d80032, | |
| 362 | 0x00d8200a, | |
| 363 | 0x00d9a062, | |
| 364 | 0x00d9d80a, | |
| 365 | 0x00d9e002, | |
| 366 | 0x00d9e84a, | |
| 367 | 0x00da1002, | |
| 368 | 0x00da181a, | |
| 369 | 0x00db5882, | |
| 370 | 0x00dc0012, | |
| 371 | 0x00dc100a, | |
| 372 | 0x00dd080a, | |
| 373 | 0x00dd1032, | |
| 374 | 0x00dd301a, | |
| 375 | 0x00dd4012, | |
| 376 | 0x00dd500a, | |
| 377 | 0x00dd5822, | |
| 378 | 0x00df3002, | |
| 379 | 0x00df380a, | |
| 380 | 0x00df4012, | |
| 381 | 0x00df502a, | |
| 382 | 0x00df6802, | |
| 383 | 0x00df700a, | |
| 384 | 0x00df7822, | |
| 385 | 0x00df901a, | |
| 386 | 0x00e1207a, | |
| 387 | 0x00e16072, | |
| 388 | 0x00e1a01a, | |
| 389 | 0x00e1b012, | |
| 390 | 0x00e68022, | |
| 391 | 0x00e6a0c2, | |
| 392 | 0x00e7080a, | |
| 393 | 0x00e71062, | |
| 394 | 0x00e76802, | |
| 395 | 0x00e7a002, | |
| 396 | 0x00e7b80a, | |
| 397 | 0x00e7c012, | |
| 398 | 0x00ee03f2, | |
| 399 | 0x01005801, | |
| 400 | 0x01006002, | |
| 401 | 0x0100680d, | |
| 402 | 0x01007011, | |
| 403 | 0x01014061, | |
| 404 | 0x0101e003, | |
| 405 | 0x01024803, | |
| 406 | 0x010300f1, | |
| 407 | 0x01068202, | |
| 408 | 0x01091003, | |
| 409 | 0x0109c803, | |
| 410 | 0x010ca053, | |
| 411 | 0x010d4813, | |
| 412 | 0x0118d013, | |
| 413 | 0x01194003, | |
| 414 | 0x011c4003, | |
| 415 | 0x011e7803, | |
| 416 | 0x011f48a3, | |
| 417 | 0x011fc023, | |
| 418 | 0x01261003, | |
| 419 | 0x012d5013, | |
| 420 | 0x012db003, | |
| 421 | 0x012e0003, | |
| 422 | 0x012fd833, | |
| 423 | 0x01300053, | |
| 424 | 0x013038b3, | |
| 425 | 0x0130a713, | |
| 426 | 0x01348753, | |
| 427 | 0x013840a3, | |
| 428 | 0x0138a003, | |
| 429 | 0x0138b003, | |
| 430 | 0x0138e803, | |
| 431 | 0x01390803, | |
| 432 | 0x01394003, | |
| 433 | 0x01399813, | |
| 434 | 0x013a2003, | |
| 435 | 0x013a3803, | |
| 436 | 0x013a6003, | |
| 437 | 0x013a7003, | |
| 438 | 0x013a9823, | |
| 439 | 0x013ab803, | |
| 440 | 0x013b1843, | |
| 441 | 0x013ca823, | |
| 442 | 0x013d0803, | |
| 443 | 0x013d8003, | |
| 444 | 0x013df803, | |
| 445 | 0x0149a013, | |
| 446 | 0x01582823, | |
| 447 | 0x0158d813, | |
| 448 | 0x015a8003, | |
| 449 | 0x015aa803, | |
| 450 | 0x01677822, | |
| 451 | 0x016bf802, | |
| 452 | 0x016f01f2, | |
| 453 | 0x01815052, | |
| 454 | 0x01818003, | |
| 455 | 0x0181e803, | |
| 456 | 0x0184c812, | |
| 457 | 0x0194b803, | |
| 458 | 0x0194c803, | |
| 459 | 0x05337832, | |
| 460 | 0x0533a092, | |
| 461 | 0x0534f012, | |
| 462 | 0x05378012, | |
| 463 | 0x05401002, | |
| 464 | 0x05403002, | |
| 465 | 0x05405802, | |
| 466 | 0x0541181a, | |
| 467 | 0x05412812, | |
| 468 | 0x0541380a, | |
| 469 | 0x05416002, | |
| 470 | 0x0544001a, | |
| 471 | 0x0545a0fa, | |
| 472 | 0x05462012, | |
| 473 | 0x05470112, | |
| 474 | 0x0547f802, | |
| 475 | 0x05493072, | |
| 476 | 0x054a38a2, | |
| 477 | 0x054a901a, | |
| 478 | 0x054b01c4, | |
| 479 | 0x054c0022, | |
| 480 | 0x054c180a, | |
| 481 | 0x054d9802, | |
| 482 | 0x054da01a, | |
| 483 | 0x054db032, | |
| 484 | 0x054dd01a, | |
| 485 | 0x054de012, | |
| 486 | 0x054df02a, | |
| 487 | 0x054f2802, | |
| 488 | 0x05514852, | |
| 489 | 0x0551781a, | |
| 490 | 0x05518812, | |
| 491 | 0x0551981a, | |
| 492 | 0x0551a812, | |
| 493 | 0x05521802, | |
| 494 | 0x05526002, | |
| 495 | 0x0552680a, | |
| 496 | 0x0553e002, | |
| 497 | 0x05558002, | |
| 498 | 0x05559022, | |
| 499 | 0x0555b812, | |
| 500 | 0x0555f012, | |
| 501 | 0x05560802, | |
| 502 | 0x0557580a, | |
| 503 | 0x05576012, | |
| 504 | 0x0557701a, | |
| 505 | 0x0557a80a, | |
| 506 | 0x0557b002, | |
| 507 | 0x055f181a, | |
| 508 | 0x055f2802, | |
| 509 | 0x055f301a, | |
| 510 | 0x055f4002, | |
| 511 | 0x055f481a, | |
| 512 | 0x055f600a, | |
| 513 | 0x055f6802, | |
| 514 | 0x05600006, | |
| 515 | 0x056009a7, | |
| 516 | 0x0560e006, | |
| 517 | 0x0560e9a7, | |
| 518 | 0x0561c006, | |
| 519 | 0x0561c9a7, | |
| 520 | 0x0562a006, | |
| 521 | 0x0562a9a7, | |
| 522 | 0x05638006, | |
| 523 | 0x056389a7, | |
| 524 | 0x05646006, | |
| 525 | 0x056469a7, | |
| 526 | 0x05654006, | |
| 527 | 0x056549a7, | |
| 528 | 0x05662006, | |
| 529 | 0x056629a7, | |
| 530 | 0x05670006, | |
| 531 | 0x056709a7, | |
| 532 | 0x0567e006, | |
| 533 | 0x0567e9a7, | |
| 534 | 0x0568c006, | |
| 535 | 0x0568c9a7, | |
| 536 | 0x0569a006, | |
| 537 | 0x0569a9a7, | |
| 538 | 0x056a8006, | |
| 539 | 0x056a89a7, | |
| 540 | 0x056b6006, | |
| 541 | 0x056b69a7, | |
| 542 | 0x056c4006, | |
| 543 | 0x056c49a7, | |
| 544 | 0x056d2006, | |
| 545 | 0x056d29a7, | |
| 546 | 0x056e0006, | |
| 547 | 0x056e09a7, | |
| 548 | 0x056ee006, | |
| 549 | 0x056ee9a7, | |
| 550 | 0x056fc006, | |
| 551 | 0x056fc9a7, | |
| 552 | 0x0570a006, | |
| 553 | 0x0570a9a7, | |
| 554 | 0x05718006, | |
| 555 | 0x057189a7, | |
| 556 | 0x05726006, | |
| 557 | 0x057269a7, | |
| 558 | 0x05734006, | |
| 559 | 0x057349a7, | |
| 560 | 0x05742006, | |
| 561 | 0x057429a7, | |
| 562 | 0x05750006, | |
| 563 | 0x057509a7, | |
| 564 | 0x0575e006, | |
| 565 | 0x0575e9a7, | |
| 566 | 0x0576c006, | |
| 567 | 0x0576c9a7, | |
| 568 | 0x0577a006, | |
| 569 | 0x0577a9a7, | |
| 570 | 0x05788006, | |
| 571 | 0x057889a7, | |
| 572 | 0x05796006, | |
| 573 | 0x057969a7, | |
| 574 | 0x057a4006, | |
| 575 | 0x057a49a7, | |
| 576 | 0x057b2006, | |
| 577 | 0x057b29a7, | |
| 578 | 0x057c0006, | |
| 579 | 0x057c09a7, | |
| 580 | 0x057ce006, | |
| 581 | 0x057ce9a7, | |
| 582 | 0x057dc006, | |
| 583 | 0x057dc9a7, | |
| 584 | 0x057ea006, | |
| 585 | 0x057ea9a7, | |
| 586 | 0x057f8006, | |
| 587 | 0x057f89a7, | |
| 588 | 0x05806006, | |
| 589 | 0x058069a7, | |
| 590 | 0x05814006, | |
| 591 | 0x058149a7, | |
| 592 | 0x05822006, | |
| 593 | 0x058229a7, | |
| 594 | 0x05830006, | |
| 595 | 0x058309a7, | |
| 596 | 0x0583e006, | |
| 597 | 0x0583e9a7, | |
| 598 | 0x0584c006, | |
| 599 | 0x0584c9a7, | |
| 600 | 0x0585a006, | |
| 601 | 0x0585a9a7, | |
| 602 | 0x05868006, | |
| 603 | 0x058689a7, | |
| 604 | 0x05876006, | |
| 605 | 0x058769a7, | |
| 606 | 0x05884006, | |
| 607 | 0x058849a7, | |
| 608 | 0x05892006, | |
| 609 | 0x058929a7, | |
| 610 | 0x058a0006, | |
| 611 | 0x058a09a7, | |
| 612 | 0x058ae006, | |
| 613 | 0x058ae9a7, | |
| 614 | 0x058bc006, | |
| 615 | 0x058bc9a7, | |
| 616 | 0x058ca006, | |
| 617 | 0x058ca9a7, | |
| 618 | 0x058d8006, | |
| 619 | 0x058d89a7, | |
| 620 | 0x058e6006, | |
| 621 | 0x058e69a7, | |
| 622 | 0x058f4006, | |
| 623 | 0x058f49a7, | |
| 624 | 0x05902006, | |
| 625 | 0x059029a7, | |
| 626 | 0x05910006, | |
| 627 | 0x059109a7, | |
| 628 | 0x0591e006, | |
| 629 | 0x0591e9a7, | |
| 630 | 0x0592c006, | |
| 631 | 0x0592c9a7, | |
| 632 | 0x0593a006, | |
| 633 | 0x0593a9a7, | |
| 634 | 0x05948006, | |
| 635 | 0x059489a7, | |
| 636 | 0x05956006, | |
| 637 | 0x059569a7, | |
| 638 | 0x05964006, | |
| 639 | 0x059649a7, | |
| 640 | 0x05972006, | |
| 641 | 0x059729a7, | |
| 642 | 0x05980006, | |
| 643 | 0x059809a7, | |
| 644 | 0x0598e006, | |
| 645 | 0x0598e9a7, | |
| 646 | 0x0599c006, | |
| 647 | 0x0599c9a7, | |
| 648 | 0x059aa006, | |
| 649 | 0x059aa9a7, | |
| 650 | 0x059b8006, | |
| 651 | 0x059b89a7, | |
| 652 | 0x059c6006, | |
| 653 | 0x059c69a7, | |
| 654 | 0x059d4006, | |
| 655 | 0x059d49a7, | |
| 656 | 0x059e2006, | |
| 657 | 0x059e29a7, | |
| 658 | 0x059f0006, | |
| 659 | 0x059f09a7, | |
| 660 | 0x059fe006, | |
| 661 | 0x059fe9a7, | |
| 662 | 0x05a0c006, | |
| 663 | 0x05a0c9a7, | |
| 664 | 0x05a1a006, | |
| 665 | 0x05a1a9a7, | |
| 666 | 0x05a28006, | |
| 667 | 0x05a289a7, | |
| 668 | 0x05a36006, | |
| 669 | 0x05a369a7, | |
| 670 | 0x05a44006, | |
| 671 | 0x05a449a7, | |
| 672 | 0x05a52006, | |
| 673 | 0x05a529a7, | |
| 674 | 0x05a60006, | |
| 675 | 0x05a609a7, | |
| 676 | 0x05a6e006, | |
| 677 | 0x05a6e9a7, | |
| 678 | 0x05a7c006, | |
| 679 | 0x05a7c9a7, | |
| 680 | 0x05a8a006, | |
| 681 | 0x05a8a9a7, | |
| 682 | 0x05a98006, | |
| 683 | 0x05a989a7, | |
| 684 | 0x05aa6006, | |
| 685 | 0x05aa69a7, | |
| 686 | 0x05ab4006, | |
| 687 | 0x05ab49a7, | |
| 688 | 0x05ac2006, | |
| 689 | 0x05ac29a7, | |
| 690 | 0x05ad0006, | |
| 691 | 0x05ad09a7, | |
| 692 | 0x05ade006, | |
| 693 | 0x05ade9a7, | |
| 694 | 0x05aec006, | |
| 695 | 0x05aec9a7, | |
| 696 | 0x05afa006, | |
| 697 | 0x05afa9a7, | |
| 698 | 0x05b08006, | |
| 699 | 0x05b089a7, | |
| 700 | 0x05b16006, | |
| 701 | 0x05b169a7, | |
| 702 | 0x05b24006, | |
| 703 | 0x05b249a7, | |
| 704 | 0x05b32006, | |
| 705 | 0x05b329a7, | |
| 706 | 0x05b40006, | |
| 707 | 0x05b409a7, | |
| 708 | 0x05b4e006, | |
| 709 | 0x05b4e9a7, | |
| 710 | 0x05b5c006, | |
| 711 | 0x05b5c9a7, | |
| 712 | 0x05b6a006, | |
| 713 | 0x05b6a9a7, | |
| 714 | 0x05b78006, | |
| 715 | 0x05b789a7, | |
| 716 | 0x05b86006, | |
| 717 | 0x05b869a7, | |
| 718 | 0x05b94006, | |
| 719 | 0x05b949a7, | |
| 720 | 0x05ba2006, | |
| 721 | 0x05ba29a7, | |
| 722 | 0x05bb0006, | |
| 723 | 0x05bb09a7, | |
| 724 | 0x05bbe006, | |
| 725 | 0x05bbe9a7, | |
| 726 | 0x05bcc006, | |
| 727 | 0x05bcc9a7, | |
| 728 | 0x05bda006, | |
| 729 | 0x05bda9a7, | |
| 730 | 0x05be8006, | |
| 731 | 0x05be89a7, | |
| 732 | 0x05bf6006, | |
| 733 | 0x05bf69a7, | |
| 734 | 0x05c04006, | |
| 735 | 0x05c049a7, | |
| 736 | 0x05c12006, | |
| 737 | 0x05c129a7, | |
| 738 | 0x05c20006, | |
| 739 | 0x05c209a7, | |
| 740 | 0x05c2e006, | |
| 741 | 0x05c2e9a7, | |
| 742 | 0x05c3c006, | |
| 743 | 0x05c3c9a7, | |
| 744 | 0x05c4a006, | |
| 745 | 0x05c4a9a7, | |
| 746 | 0x05c58006, | |
| 747 | 0x05c589a7, | |
| 748 | 0x05c66006, | |
| 749 | 0x05c669a7, | |
| 750 | 0x05c74006, | |
| 751 | 0x05c749a7, | |
| 752 | 0x05c82006, | |
| 753 | 0x05c829a7, | |
| 754 | 0x05c90006, | |
| 755 | 0x05c909a7, | |
| 756 | 0x05c9e006, | |
| 757 | 0x05c9e9a7, | |
| 758 | 0x05cac006, | |
| 759 | 0x05cac9a7, | |
| 760 | 0x05cba006, | |
| 761 | 0x05cba9a7, | |
| 762 | 0x05cc8006, | |
| 763 | 0x05cc89a7, | |
| 764 | 0x05cd6006, | |
| 765 | 0x05cd69a7, | |
| 766 | 0x05ce4006, | |
| 767 | 0x05ce49a7, | |
| 768 | 0x05cf2006, | |
| 769 | 0x05cf29a7, | |
| 770 | 0x05d00006, | |
| 771 | 0x05d009a7, | |
| 772 | 0x05d0e006, | |
| 773 | 0x05d0e9a7, | |
| 774 | 0x05d1c006, | |
| 775 | 0x05d1c9a7, | |
| 776 | 0x05d2a006, | |
| 777 | 0x05d2a9a7, | |
| 778 | 0x05d38006, | |
| 779 | 0x05d389a7, | |
| 780 | 0x05d46006, | |
| 781 | 0x05d469a7, | |
| 782 | 0x05d54006, | |
| 783 | 0x05d549a7, | |
| 784 | 0x05d62006, | |
| 785 | 0x05d629a7, | |
| 786 | 0x05d70006, | |
| 787 | 0x05d709a7, | |
| 788 | 0x05d7e006, | |
| 789 | 0x05d7e9a7, | |
| 790 | 0x05d8c006, | |
| 791 | 0x05d8c9a7, | |
| 792 | 0x05d9a006, | |
| 793 | 0x05d9a9a7, | |
| 794 | 0x05da8006, | |
| 795 | 0x05da89a7, | |
| 796 | 0x05db6006, | |
| 797 | 0x05db69a7, | |
| 798 | 0x05dc4006, | |
| 799 | 0x05dc49a7, | |
| 800 | 0x05dd2006, | |
| 801 | 0x05dd29a7, | |
| 802 | 0x05de0006, | |
| 803 | 0x05de09a7, | |
| 804 | 0x05dee006, | |
| 805 | 0x05dee9a7, | |
| 806 | 0x05dfc006, | |
| 807 | 0x05dfc9a7, | |
| 808 | 0x05e0a006, | |
| 809 | 0x05e0a9a7, | |
| 810 | 0x05e18006, | |
| 811 | 0x05e189a7, | |
| 812 | 0x05e26006, | |
| 813 | 0x05e269a7, | |
| 814 | 0x05e34006, | |
| 815 | 0x05e349a7, | |
| 816 | 0x05e42006, | |
| 817 | 0x05e429a7, | |
| 818 | 0x05e50006, | |
| 819 | 0x05e509a7, | |
| 820 | 0x05e5e006, | |
| 821 | 0x05e5e9a7, | |
| 822 | 0x05e6c006, | |
| 823 | 0x05e6c9a7, | |
| 824 | 0x05e7a006, | |
| 825 | 0x05e7a9a7, | |
| 826 | 0x05e88006, | |
| 827 | 0x05e889a7, | |
| 828 | 0x05e96006, | |
| 829 | 0x05e969a7, | |
| 830 | 0x05ea4006, | |
| 831 | 0x05ea49a7, | |
| 832 | 0x05eb2006, | |
| 833 | 0x05eb29a7, | |
| 834 | 0x05ec0006, | |
| 835 | 0x05ec09a7, | |
| 836 | 0x05ece006, | |
| 837 | 0x05ece9a7, | |
| 838 | 0x05edc006, | |
| 839 | 0x05edc9a7, | |
| 840 | 0x05eea006, | |
| 841 | 0x05eea9a7, | |
| 842 | 0x05ef8006, | |
| 843 | 0x05ef89a7, | |
| 844 | 0x05f06006, | |
| 845 | 0x05f069a7, | |
| 846 | 0x05f14006, | |
| 847 | 0x05f149a7, | |
| 848 | 0x05f22006, | |
| 849 | 0x05f229a7, | |
| 850 | 0x05f30006, | |
| 851 | 0x05f309a7, | |
| 852 | 0x05f3e006, | |
| 853 | 0x05f3e9a7, | |
| 854 | 0x05f4c006, | |
| 855 | 0x05f4c9a7, | |
| 856 | 0x05f5a006, | |
| 857 | 0x05f5a9a7, | |
| 858 | 0x05f68006, | |
| 859 | 0x05f689a7, | |
| 860 | 0x05f76006, | |
| 861 | 0x05f769a7, | |
| 862 | 0x05f84006, | |
| 863 | 0x05f849a7, | |
| 864 | 0x05f92006, | |
| 865 | 0x05f929a7, | |
| 866 | 0x05fa0006, | |
| 867 | 0x05fa09a7, | |
| 868 | 0x05fae006, | |
| 869 | 0x05fae9a7, | |
| 870 | 0x05fbc006, | |
| 871 | 0x05fbc9a7, | |
| 872 | 0x05fca006, | |
| 873 | 0x05fca9a7, | |
| 874 | 0x05fd8006, | |
| 875 | 0x05fd89a7, | |
| 876 | 0x05fe6006, | |
| 877 | 0x05fe69a7, | |
| 878 | 0x05ff4006, | |
| 879 | 0x05ff49a7, | |
| 880 | 0x06002006, | |
| 881 | 0x060029a7, | |
| 882 | 0x06010006, | |
| 883 | 0x060109a7, | |
| 884 | 0x0601e006, | |
| 885 | 0x0601e9a7, | |
| 886 | 0x0602c006, | |
| 887 | 0x0602c9a7, | |
| 888 | 0x0603a006, | |
| 889 | 0x0603a9a7, | |
| 890 | 0x06048006, | |
| 891 | 0x060489a7, | |
| 892 | 0x06056006, | |
| 893 | 0x060569a7, | |
| 894 | 0x06064006, | |
| 895 | 0x060649a7, | |
| 896 | 0x06072006, | |
| 897 | 0x060729a7, | |
| 898 | 0x06080006, | |
| 899 | 0x060809a7, | |
| 900 | 0x0608e006, | |
| 901 | 0x0608e9a7, | |
| 902 | 0x0609c006, | |
| 903 | 0x0609c9a7, | |
| 904 | 0x060aa006, | |
| 905 | 0x060aa9a7, | |
| 906 | 0x060b8006, | |
| 907 | 0x060b89a7, | |
| 908 | 0x060c6006, | |
| 909 | 0x060c69a7, | |
| 910 | 0x060d4006, | |
| 911 | 0x060d49a7, | |
| 912 | 0x060e2006, | |
| 913 | 0x060e29a7, | |
| 914 | 0x060f0006, | |
| 915 | 0x060f09a7, | |
| 916 | 0x060fe006, | |
| 917 | 0x060fe9a7, | |
| 918 | 0x0610c006, | |
| 919 | 0x0610c9a7, | |
| 920 | 0x0611a006, | |
| 921 | 0x0611a9a7, | |
| 922 | 0x06128006, | |
| 923 | 0x061289a7, | |
| 924 | 0x06136006, | |
| 925 | 0x061369a7, | |
| 926 | 0x06144006, | |
| 927 | 0x061449a7, | |
| 928 | 0x06152006, | |
| 929 | 0x061529a7, | |
| 930 | 0x06160006, | |
| 931 | 0x061609a7, | |
| 932 | 0x0616e006, | |
| 933 | 0x0616e9a7, | |
| 934 | 0x0617c006, | |
| 935 | 0x0617c9a7, | |
| 936 | 0x0618a006, | |
| 937 | 0x0618a9a7, | |
| 938 | 0x06198006, | |
| 939 | 0x061989a7, | |
| 940 | 0x061a6006, | |
| 941 | 0x061a69a7, | |
| 942 | 0x061b4006, | |
| 943 | 0x061b49a7, | |
| 944 | 0x061c2006, | |
| 945 | 0x061c29a7, | |
| 946 | 0x061d0006, | |
| 947 | 0x061d09a7, | |
| 948 | 0x061de006, | |
| 949 | 0x061de9a7, | |
| 950 | 0x061ec006, | |
| 951 | 0x061ec9a7, | |
| 952 | 0x061fa006, | |
| 953 | 0x061fa9a7, | |
| 954 | 0x06208006, | |
| 955 | 0x062089a7, | |
| 956 | 0x06216006, | |
| 957 | 0x062169a7, | |
| 958 | 0x06224006, | |
| 959 | 0x062249a7, | |
| 960 | 0x06232006, | |
| 961 | 0x062329a7, | |
| 962 | 0x06240006, | |
| 963 | 0x062409a7, | |
| 964 | 0x0624e006, | |
| 965 | 0x0624e9a7, | |
| 966 | 0x0625c006, | |
| 967 | 0x0625c9a7, | |
| 968 | 0x0626a006, | |
| 969 | 0x0626a9a7, | |
| 970 | 0x06278006, | |
| 971 | 0x062789a7, | |
| 972 | 0x06286006, | |
| 973 | 0x062869a7, | |
| 974 | 0x06294006, | |
| 975 | 0x062949a7, | |
| 976 | 0x062a2006, | |
| 977 | 0x062a29a7, | |
| 978 | 0x062b0006, | |
| 979 | 0x062b09a7, | |
| 980 | 0x062be006, | |
| 981 | 0x062be9a7, | |
| 982 | 0x062cc006, | |
| 983 | 0x062cc9a7, | |
| 984 | 0x062da006, | |
| 985 | 0x062da9a7, | |
| 986 | 0x062e8006, | |
| 987 | 0x062e89a7, | |
| 988 | 0x062f6006, | |
| 989 | 0x062f69a7, | |
| 990 | 0x06304006, | |
| 991 | 0x063049a7, | |
| 992 | 0x06312006, | |
| 993 | 0x063129a7, | |
| 994 | 0x06320006, | |
| 995 | 0x063209a7, | |
| 996 | 0x0632e006, | |
| 997 | 0x0632e9a7, | |
| 998 | 0x0633c006, | |
| 999 | 0x0633c9a7, | |
| 1000 | 0x0634a006, | |
| 1001 | 0x0634a9a7, | |
| 1002 | 0x06358006, | |
| 1003 | 0x063589a7, | |
| 1004 | 0x06366006, | |
| 1005 | 0x063669a7, | |
| 1006 | 0x06374006, | |
| 1007 | 0x063749a7, | |
| 1008 | 0x06382006, | |
| 1009 | 0x063829a7, | |
| 1010 | 0x06390006, | |
| 1011 | 0x063909a7, | |
| 1012 | 0x0639e006, | |
| 1013 | 0x0639e9a7, | |
| 1014 | 0x063ac006, | |
| 1015 | 0x063ac9a7, | |
| 1016 | 0x063ba006, | |
| 1017 | 0x063ba9a7, | |
| 1018 | 0x063c8006, | |
| 1019 | 0x063c89a7, | |
| 1020 | 0x063d6006, | |
| 1021 | 0x063d69a7, | |
| 1022 | 0x063e4006, | |
| 1023 | 0x063e49a7, | |
| 1024 | 0x063f2006, | |
| 1025 | 0x063f29a7, | |
| 1026 | 0x06400006, | |
| 1027 | 0x064009a7, | |
| 1028 | 0x0640e006, | |
| 1029 | 0x0640e9a7, | |
| 1030 | 0x0641c006, | |
| 1031 | 0x0641c9a7, | |
| 1032 | 0x0642a006, | |
| 1033 | 0x0642a9a7, | |
| 1034 | 0x06438006, | |
| 1035 | 0x064389a7, | |
| 1036 | 0x06446006, | |
| 1037 | 0x064469a7, | |
| 1038 | 0x06454006, | |
| 1039 | 0x064549a7, | |
| 1040 | 0x06462006, | |
| 1041 | 0x064629a7, | |
| 1042 | 0x06470006, | |
| 1043 | 0x064709a7, | |
| 1044 | 0x0647e006, | |
| 1045 | 0x0647e9a7, | |
| 1046 | 0x0648c006, | |
| 1047 | 0x0648c9a7, | |
| 1048 | 0x0649a006, | |
| 1049 | 0x0649a9a7, | |
| 1050 | 0x064a8006, | |
| 1051 | 0x064a89a7, | |
| 1052 | 0x064b6006, | |
| 1053 | 0x064b69a7, | |
| 1054 | 0x064c4006, | |
| 1055 | 0x064c49a7, | |
| 1056 | 0x064d2006, | |
| 1057 | 0x064d29a7, | |
| 1058 | 0x064e0006, | |
| 1059 | 0x064e09a7, | |
| 1060 | 0x064ee006, | |
| 1061 | 0x064ee9a7, | |
| 1062 | 0x064fc006, | |
| 1063 | 0x064fc9a7, | |
| 1064 | 0x0650a006, | |
| 1065 | 0x0650a9a7, | |
| 1066 | 0x06518006, | |
| 1067 | 0x065189a7, | |
| 1068 | 0x06526006, | |
| 1069 | 0x065269a7, | |
| 1070 | 0x06534006, | |
| 1071 | 0x065349a7, | |
| 1072 | 0x06542006, | |
| 1073 | 0x065429a7, | |
| 1074 | 0x06550006, | |
| 1075 | 0x065509a7, | |
| 1076 | 0x0655e006, | |
| 1077 | 0x0655e9a7, | |
| 1078 | 0x0656c006, | |
| 1079 | 0x0656c9a7, | |
| 1080 | 0x0657a006, | |
| 1081 | 0x0657a9a7, | |
| 1082 | 0x06588006, | |
| 1083 | 0x065889a7, | |
| 1084 | 0x06596006, | |
| 1085 | 0x065969a7, | |
| 1086 | 0x065a4006, | |
| 1087 | 0x065a49a7, | |
| 1088 | 0x065b2006, | |
| 1089 | 0x065b29a7, | |
| 1090 | 0x065c0006, | |
| 1091 | 0x065c09a7, | |
| 1092 | 0x065ce006, | |
| 1093 | 0x065ce9a7, | |
| 1094 | 0x065dc006, | |
| 1095 | 0x065dc9a7, | |
| 1096 | 0x065ea006, | |
| 1097 | 0x065ea9a7, | |
| 1098 | 0x065f8006, | |
| 1099 | 0x065f89a7, | |
| 1100 | 0x06606006, | |
| 1101 | 0x066069a7, | |
| 1102 | 0x06614006, | |
| 1103 | 0x066149a7, | |
| 1104 | 0x06622006, | |
| 1105 | 0x066229a7, | |
| 1106 | 0x06630006, | |
| 1107 | 0x066309a7, | |
| 1108 | 0x0663e006, | |
| 1109 | 0x0663e9a7, | |
| 1110 | 0x0664c006, | |
| 1111 | 0x0664c9a7, | |
| 1112 | 0x0665a006, | |
| 1113 | 0x0665a9a7, | |
| 1114 | 0x06668006, | |
| 1115 | 0x066689a7, | |
| 1116 | 0x06676006, | |
| 1117 | 0x066769a7, | |
| 1118 | 0x06684006, | |
| 1119 | 0x066849a7, | |
| 1120 | 0x06692006, | |
| 1121 | 0x066929a7, | |
| 1122 | 0x066a0006, | |
| 1123 | 0x066a09a7, | |
| 1124 | 0x066ae006, | |
| 1125 | 0x066ae9a7, | |
| 1126 | 0x066bc006, | |
| 1127 | 0x066bc9a7, | |
| 1128 | 0x066ca006, | |
| 1129 | 0x066ca9a7, | |
| 1130 | 0x066d8006, | |
| 1131 | 0x066d89a7, | |
| 1132 | 0x066e6006, | |
| 1133 | 0x066e69a7, | |
| 1134 | 0x066f4006, | |
| 1135 | 0x066f49a7, | |
| 1136 | 0x06702006, | |
| 1137 | 0x067029a7, | |
| 1138 | 0x06710006, | |
| 1139 | 0x067109a7, | |
| 1140 | 0x0671e006, | |
| 1141 | 0x0671e9a7, | |
| 1142 | 0x0672c006, | |
| 1143 | 0x0672c9a7, | |
| 1144 | 0x0673a006, | |
| 1145 | 0x0673a9a7, | |
| 1146 | 0x06748006, | |
| 1147 | 0x067489a7, | |
| 1148 | 0x06756006, | |
| 1149 | 0x067569a7, | |
| 1150 | 0x06764006, | |
| 1151 | 0x067649a7, | |
| 1152 | 0x06772006, | |
| 1153 | 0x067729a7, | |
| 1154 | 0x06780006, | |
| 1155 | 0x067809a7, | |
| 1156 | 0x0678e006, | |
| 1157 | 0x0678e9a7, | |
| 1158 | 0x0679c006, | |
| 1159 | 0x0679c9a7, | |
| 1160 | 0x067aa006, | |
| 1161 | 0x067aa9a7, | |
| 1162 | 0x067b8006, | |
| 1163 | 0x067b89a7, | |
| 1164 | 0x067c6006, | |
| 1165 | 0x067c69a7, | |
| 1166 | 0x067d4006, | |
| 1167 | 0x067d49a7, | |
| 1168 | 0x067e2006, | |
| 1169 | 0x067e29a7, | |
| 1170 | 0x067f0006, | |
| 1171 | 0x067f09a7, | |
| 1172 | 0x067fe006, | |
| 1173 | 0x067fe9a7, | |
| 1174 | 0x0680c006, | |
| 1175 | 0x0680c9a7, | |
| 1176 | 0x0681a006, | |
| 1177 | 0x0681a9a7, | |
| 1178 | 0x06828006, | |
| 1179 | 0x068289a7, | |
| 1180 | 0x06836006, | |
| 1181 | 0x068369a7, | |
| 1182 | 0x06844006, | |
| 1183 | 0x068449a7, | |
| 1184 | 0x06852006, | |
| 1185 | 0x068529a7, | |
| 1186 | 0x06860006, | |
| 1187 | 0x068609a7, | |
| 1188 | 0x0686e006, | |
| 1189 | 0x0686e9a7, | |
| 1190 | 0x0687c006, | |
| 1191 | 0x0687c9a7, | |
| 1192 | 0x0688a006, | |
| 1193 | 0x0688a9a7, | |
| 1194 | 0x06898006, | |
| 1195 | 0x068989a7, | |
| 1196 | 0x068a6006, | |
| 1197 | 0x068a69a7, | |
| 1198 | 0x068b4006, | |
| 1199 | 0x068b49a7, | |
| 1200 | 0x068c2006, | |
| 1201 | 0x068c29a7, | |
| 1202 | 0x068d0006, | |
| 1203 | 0x068d09a7, | |
| 1204 | 0x068de006, | |
| 1205 | 0x068de9a7, | |
| 1206 | 0x068ec006, | |
| 1207 | 0x068ec9a7, | |
| 1208 | 0x068fa006, | |
| 1209 | 0x068fa9a7, | |
| 1210 | 0x06908006, | |
| 1211 | 0x069089a7, | |
| 1212 | 0x06916006, | |
| 1213 | 0x069169a7, | |
| 1214 | 0x06924006, | |
| 1215 | 0x069249a7, | |
| 1216 | 0x06932006, | |
| 1217 | 0x069329a7, | |
| 1218 | 0x06940006, | |
| 1219 | 0x069409a7, | |
| 1220 | 0x0694e006, | |
| 1221 | 0x0694e9a7, | |
| 1222 | 0x0695c006, | |
| 1223 | 0x0695c9a7, | |
| 1224 | 0x0696a006, | |
| 1225 | 0x0696a9a7, | |
| 1226 | 0x06978006, | |
| 1227 | 0x069789a7, | |
| 1228 | 0x06986006, | |
| 1229 | 0x069869a7, | |
| 1230 | 0x06994006, | |
| 1231 | 0x069949a7, | |
| 1232 | 0x069a2006, | |
| 1233 | 0x069a29a7, | |
| 1234 | 0x069b0006, | |
| 1235 | 0x069b09a7, | |
| 1236 | 0x069be006, | |
| 1237 | 0x069be9a7, | |
| 1238 | 0x069cc006, | |
| 1239 | 0x069cc9a7, | |
| 1240 | 0x069da006, | |
| 1241 | 0x069da9a7, | |
| 1242 | 0x069e8006, | |
| 1243 | 0x069e89a7, | |
| 1244 | 0x069f6006, | |
| 1245 | 0x069f69a7, | |
| 1246 | 0x06a04006, | |
| 1247 | 0x06a049a7, | |
| 1248 | 0x06a12006, | |
| 1249 | 0x06a129a7, | |
| 1250 | 0x06a20006, | |
| 1251 | 0x06a209a7, | |
| 1252 | 0x06a2e006, | |
| 1253 | 0x06a2e9a7, | |
| 1254 | 0x06a3c006, | |
| 1255 | 0x06a3c9a7, | |
| 1256 | 0x06a4a006, | |
| 1257 | 0x06a4a9a7, | |
| 1258 | 0x06a58006, | |
| 1259 | 0x06a589a7, | |
| 1260 | 0x06a66006, | |
| 1261 | 0x06a669a7, | |
| 1262 | 0x06a74006, | |
| 1263 | 0x06a749a7, | |
| 1264 | 0x06a82006, | |
| 1265 | 0x06a829a7, | |
| 1266 | 0x06a90006, | |
| 1267 | 0x06a909a7, | |
| 1268 | 0x06a9e006, | |
| 1269 | 0x06a9e9a7, | |
| 1270 | 0x06aac006, | |
| 1271 | 0x06aac9a7, | |
| 1272 | 0x06aba006, | |
| 1273 | 0x06aba9a7, | |
| 1274 | 0x06ac8006, | |
| 1275 | 0x06ac89a7, | |
| 1276 | 0x06ad6006, | |
| 1277 | 0x06ad69a7, | |
| 1278 | 0x06ae4006, | |
| 1279 | 0x06ae49a7, | |
| 1280 | 0x06af2006, | |
| 1281 | 0x06af29a7, | |
| 1282 | 0x06b00006, | |
| 1283 | 0x06b009a7, | |
| 1284 | 0x06b0e006, | |
| 1285 | 0x06b0e9a7, | |
| 1286 | 0x06b1c006, | |
| 1287 | 0x06b1c9a7, | |
| 1288 | 0x06b2a006, | |
| 1289 | 0x06b2a9a7, | |
| 1290 | 0x06b38006, | |
| 1291 | 0x06b389a7, | |
| 1292 | 0x06b46006, | |
| 1293 | 0x06b469a7, | |
| 1294 | 0x06b54006, | |
| 1295 | 0x06b549a7, | |
| 1296 | 0x06b62006, | |
| 1297 | 0x06b629a7, | |
| 1298 | 0x06b70006, | |
| 1299 | 0x06b709a7, | |
| 1300 | 0x06b7e006, | |
| 1301 | 0x06b7e9a7, | |
| 1302 | 0x06b8c006, | |
| 1303 | 0x06b8c9a7, | |
| 1304 | 0x06b9a006, | |
| 1305 | 0x06b9a9a7, | |
| 1306 | 0x06ba8006, | |
| 1307 | 0x06ba89a7, | |
| 1308 | 0x06bb6006, | |
| 1309 | 0x06bb69a7, | |
| 1310 | 0x06bc4006, | |
| 1311 | 0x06bc49a7, | |
| 1312 | 0x06bd816c, | |
| 1313 | 0x06be5b0b, | |
| 1314 | 0x07d8f002, | |
| 1315 | 0x07f000f2, | |
| 1316 | 0x07f100f2, | |
| 1317 | 0x07f7f801, | |
| 1318 | 0x07fcf012, | |
| 1319 | 0x07ff80b1, | |
| 1320 | 0x080fe802, | |
| 1321 | 0x08170002, | |
| 1322 | 0x081bb042, | |
| 1323 | 0x08500822, | |
| 1324 | 0x08502812, | |
| 1325 | 0x08506032, | |
| 1326 | 0x0851c022, | |
| 1327 | 0x0851f802, | |
| 1328 | 0x08572812, | |
| 1329 | 0x08692032, | |
| 1330 | 0x08755812, | |
| 1331 | 0x0877e822, | |
| 1332 | 0x087a30a2, | |
| 1333 | 0x087c1032, | |
| 1334 | 0x0880000a, | |
| 1335 | 0x08800802, | |
| 1336 | 0x0880100a, | |
| 1337 | 0x0881c0e2, | |
| 1338 | 0x08838002, | |
| 1339 | 0x08839812, | |
| 1340 | 0x0883f822, | |
| 1341 | 0x0884100a, | |
| 1342 | 0x0885802a, | |
| 1343 | 0x08859832, | |
| 1344 | 0x0885b81a, | |
| 1345 | 0x0885c812, | |
| 1346 | 0x0885e808, | |
| 1347 | 0x08861002, | |
| 1348 | 0x08866808, | |
| 1349 | 0x08880022, | |
| 1350 | 0x08893842, | |
| 1351 | 0x0889600a, | |
| 1352 | 0x08896872, | |
| 1353 | 0x088a281a, | |
| 1354 | 0x088b9802, | |
| 1355 | 0x088c0012, | |
| 1356 | 0x088c100a, | |
| 1357 | 0x088d982a, | |
| 1358 | 0x088db082, | |
| 1359 | 0x088df81a, | |
| 1360 | 0x088e1018, | |
| 1361 | 0x088e4832, | |
| 1362 | 0x088e700a, | |
| 1363 | 0x088e7802, | |
| 1364 | 0x0891602a, | |
| 1365 | 0x08917822, | |
| 1366 | 0x0891901a, | |
| 1367 | 0x0891a002, | |
| 1368 | 0x0891a80a, | |
| 1369 | 0x0891b012, | |
| 1370 | 0x0891f002, | |
| 1371 | 0x08920802, | |
| 1372 | 0x0896f802, | |
| 1373 | 0x0897002a, | |
| 1374 | 0x08971872, | |
| 1375 | 0x08980012, | |
| 1376 | 0x0898101a, | |
| 1377 | 0x0899d812, | |
| 1378 | 0x0899f002, | |
| 1379 | 0x0899f80a, | |
| 1380 | 0x089a0002, | |
| 1381 | 0x089a083a, | |
| 1382 | 0x089a381a, | |
| 1383 | 0x089a582a, | |
| 1384 | 0x089ab802, | |
| 1385 | 0x089b101a, | |
| 1386 | 0x089b3062, | |
| 1387 | 0x089b8042, | |
| 1388 | 0x08a1a82a, | |
| 1389 | 0x08a1c072, | |
| 1390 | 0x08a2001a, | |
| 1391 | 0x08a21022, | |
| 1392 | 0x08a2280a, | |
| 1393 | 0x08a23002, | |
| 1394 | 0x08a2f002, | |
| 1395 | 0x08a58002, | |
| 1396 | 0x08a5881a, | |
| 1397 | 0x08a59852, | |
| 1398 | 0x08a5c80a, | |
| 1399 | 0x08a5d002, | |
| 1400 | 0x08a5d81a, | |
| 1401 | 0x08a5e802, | |
| 1402 | 0x08a5f00a, | |
| 1403 | 0x08a5f812, | |
| 1404 | 0x08a6080a, | |
| 1405 | 0x08a61012, | |
| 1406 | 0x08ad7802, | |
| 1407 | 0x08ad801a, | |
| 1408 | 0x08ad9032, | |
| 1409 | 0x08adc03a, | |
| 1410 | 0x08ade012, | |
| 1411 | 0x08adf00a, | |
| 1412 | 0x08adf812, | |
| 1413 | 0x08aee012, | |
| 1414 | 0x08b1802a, | |
| 1415 | 0x08b19872, | |
| 1416 | 0x08b1d81a, | |
| 1417 | 0x08b1e802, | |
| 1418 | 0x08b1f00a, | |
| 1419 | 0x08b1f812, | |
| 1420 | 0x08b55802, | |
| 1421 | 0x08b5600a, | |
| 1422 | 0x08b56802, | |
| 1423 | 0x08b5701a, | |
| 1424 | 0x08b58052, | |
| 1425 | 0x08b5b00a, | |
| 1426 | 0x08b5b802, | |
| 1427 | 0x08b8e822, | |
| 1428 | 0x08b91032, | |
| 1429 | 0x08b9300a, | |
| 1430 | 0x08b93842, | |
| 1431 | 0x08c1602a, | |
| 1432 | 0x08c17882, | |
| 1433 | 0x08c1c00a, | |
| 1434 | 0x08c1c812, | |
| 1435 | 0x08c98002, | |
| 1436 | 0x08c9884a, | |
| 1437 | 0x08c9b81a, | |
| 1438 | 0x08c9d812, | |
| 1439 | 0x08c9e80a, | |
| 1440 | 0x08c9f002, | |
| 1441 | 0x08c9f808, | |
| 1442 | 0x08ca000a, | |
| 1443 | 0x08ca0808, | |
| 1444 | 0x08ca100a, | |
| 1445 | 0x08ca1802, | |
| 1446 | 0x08ce882a, | |
| 1447 | 0x08cea032, | |
| 1448 | 0x08ced012, | |
| 1449 | 0x08cee03a, | |
| 1450 | 0x08cf0002, | |
| 1451 | 0x08cf200a, | |
| 1452 | 0x08d00892, | |
| 1453 | 0x08d19852, | |
| 1454 | 0x08d1c80a, | |
| 1455 | 0x08d1d008, | |
| 1456 | 0x08d1d832, | |
| 1457 | 0x08d23802, | |
| 1458 | 0x08d28852, | |
| 1459 | 0x08d2b81a, | |
| 1460 | 0x08d2c822, | |
| 1461 | 0x08d42058, | |
| 1462 | 0x08d450c2, | |
| 1463 | 0x08d4b80a, | |
| 1464 | 0x08d4c012, | |
| 1465 | 0x08e1780a, | |
| 1466 | 0x08e18062, | |
| 1467 | 0x08e1c052, | |
| 1468 | 0x08e1f00a, | |
| 1469 | 0x08e1f802, | |
| 1470 | 0x08e49152, | |
| 1471 | 0x08e5480a, | |
| 1472 | 0x08e55062, | |
| 1473 | 0x08e5880a, | |
| 1474 | 0x08e59012, | |
| 1475 | 0x08e5a00a, | |
| 1476 | 0x08e5a812, | |
| 1477 | 0x08e98852, | |
| 1478 | 0x08e9d002, | |
| 1479 | 0x08e9e012, | |
| 1480 | 0x08e9f862, | |
| 1481 | 0x08ea3008, | |
| 1482 | 0x08ea3802, | |
| 1483 | 0x08ec504a, | |
| 1484 | 0x08ec8012, | |
| 1485 | 0x08ec981a, | |
| 1486 | 0x08eca802, | |
| 1487 | 0x08ecb00a, | |
| 1488 | 0x08ecb802, | |
| 1489 | 0x08f79812, | |
| 1490 | 0x08f7a81a, | |
| 1491 | 0x08f80012, | |
| 1492 | 0x08f81008, | |
| 1493 | 0x08f8180a, | |
| 1494 | 0x08f9a01a, | |
| 1495 | 0x08f9b042, | |
| 1496 | 0x08f9f01a, | |
| 1497 | 0x08fa0002, | |
| 1498 | 0x08fa080a, | |
| 1499 | 0x08fa1002, | |
| 1500 | 0x09a180f1, | |
| 1501 | 0x09a20002, | |
| 1502 | 0x09a238e2, | |
| 1503 | 0x0b578042, | |
| 1504 | 0x0b598062, | |
| 1505 | 0x0b7a7802, | |
| 1506 | 0x0b7a8b6a, | |
| 1507 | 0x0b7c7832, | |
| 1508 | 0x0b7f2002, | |
| 1509 | 0x0b7f801a, | |
| 1510 | 0x0de4e812, | |
| 1511 | 0x0de50031, | |
| 1512 | 0x0e7802d2, | |
| 1513 | 0x0e798162, | |
| 1514 | 0x0e8b2802, | |
| 1515 | 0x0e8b300a, | |
| 1516 | 0x0e8b3822, | |
| 1517 | 0x0e8b680a, | |
| 1518 | 0x0e8b7042, | |
| 1519 | 0x0e8b9871, | |
| 1520 | 0x0e8bd872, | |
| 1521 | 0x0e8c2862, | |
| 1522 | 0x0e8d5032, | |
| 1523 | 0x0e921022, | |
| 1524 | 0x0ed00362, | |
| 1525 | 0x0ed1db12, | |
| 1526 | 0x0ed3a802, | |
| 1527 | 0x0ed42002, | |
| 1528 | 0x0ed4d842, | |
| 1529 | 0x0ed508e2, | |
| 1530 | 0x0f000062, | |
| 1531 | 0x0f004102, | |
| 1532 | 0x0f00d862, | |
| 1533 | 0x0f011812, | |
| 1534 | 0x0f013042, | |
| 1535 | 0x0f047802, | |
| 1536 | 0x0f098062, | |
| 1537 | 0x0f157002, | |
| 1538 | 0x0f176032, | |
| 1539 | 0x0f276032, | |
| 1540 | 0x0f468062, | |
| 1541 | 0x0f4a2062, | |
| 1542 | 0x0f8007f3, | |
| 1543 | 0x0f8407f3, | |
| 1544 | 0x0f886823, | |
| 1545 | 0x0f897803, | |
| 1546 | 0x0f8b6053, | |
| 1547 | 0x0f8bf013, | |
| 1548 | 0x0f8c7003, | |
| 1549 | 0x0f8c8893, | |
| 1550 | 0x0f8d6b83, | |
| 1551 | 0x0f8f3199, | |
| 1552 | 0x0f9008e3, | |
| 1553 | 0x0f90d003, | |
| 1554 | 0x0f917803, | |
| 1555 | 0x0f919083, | |
| 1556 | 0x0f91e033, | |
| 1557 | 0x0f924ff3, | |
| 1558 | 0x0f964ff3, | |
| 1559 | 0x0f9a4ff3, | |
| 1560 | 0x0f9e4b13, | |
| 1561 | 0x0f9fd842, | |
| 1562 | 0x0fa007f3, | |
| 1563 | 0x0fa407f3, | |
| 1564 | 0x0fa803d3, | |
| 1565 | 0x0faa37f3, | |
| 1566 | 0x0fae37f3, | |
| 1567 | 0x0fb23093, | |
| 1568 | 0x0fb407f3, | |
| 1569 | 0x0fbba0b3, | |
| 1570 | 0x0fbeaaa3, | |
| 1571 | 0x0fc06033, | |
| 1572 | 0x0fc24073, | |
| 1573 | 0x0fc2d053, | |
| 1574 | 0x0fc44073, | |
| 1575 | 0x0fc57513, | |
| 1576 | 0x0fc862e3, | |
| 1577 | 0x0fc9e093, | |
| 1578 | 0x0fca3ff3, | |
| 1579 | 0x0fce3ff3, | |
| 1580 | 0x0fd23ff3, | |
| 1581 | 0x0fd63b83, | |
| 1582 | 0x0fe007f3, | |
| 1583 | 0x0fe407f3, | |
| 1584 | 0x0fe807f3, | |
| 1585 | 0x0fec07f3, | |
| 1586 | 0x0ff007f3, | |
| 1587 | 0x0ff407f3, | |
| 1588 | 0x0ff807f3, | |
| 1589 | 0x0ffc07d3, | |
| 1590 | 0x700001f1, | |
| 1591 | 0x700105f2, | |
| 1592 | 0x700407f1, | |
| 1593 | 0x700807f2, | |
| 1594 | 0x700c06f2, | |
| 1595 | 0x700f87f1, | |
| 1596 | 0x701387f1, | |
| 1597 | 0x701787f1, | |
| 1598 | 0x701b87f1, | |
| 1599 | 0x701f87f1, | |
| 1600 | 0x702387f1, | |
| 1601 | 0x702787f1, | |
| 1602 | 0x702b87f1, | |
| 1603 | 0x702f87f1, | |
| 1604 | 0x703387f1, | |
| 1605 | 0x703787f1, | |
| 1606 | 0x703b87f1, | |
| 1607 | 0x703f87f1, | |
| 1608 | 0x704387f1, | |
| 1609 | 0x704787f1, | |
| 1610 | 0x704b87f1, | |
| 1611 | 0x704f87f1, | |
| 1612 | 0x705387f1, | |
| 1613 | 0x705787f1, | |
| 1614 | 0x705b87f1, | |
| 1615 | 0x705f87f1, | |
| 1616 | 0x706387f1, | |
| 1617 | 0x706787f1, | |
| 1618 | 0x706b87f1, | |
| 1619 | 0x706f87f1, | |
| 1620 | 0x707387f1, | |
| 1621 | 0x707787f1, | |
| 1622 | 0x707b87f1, | |
| 1623 | 0x707f80f1}; | |
| 293 | 1624 | |
| 294 | 1625 | /// Returns the extended grapheme cluster bondary property of a code point. |
| 295 | 1626 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __property __get_property(const char32_t __code_point) noexcept { |
| 296 | // TODO FMT use std::ranges::upper_bound. | |
| 297 | ||
| 298 | 1627 | // The algorithm searches for the upper bound of the range and, when found, |
| 299 | 1628 | // steps back one entry. This algorithm is used since the code point can be |
| 300 | 1629 | // anywhere in the range. After a lower bound is found the next step is to |
| ... | ... | @@ -311,7 +1640,7 @@ inline constexpr uint32_t __entries[1480] = { |
| 311 | 1640 | // size. Then the upper bound for code point 3 will return the entry after |
| 312 | 1641 | // 0x1810. After moving to the previous entry the algorithm arrives at the |
| 313 | 1642 | // correct entry. |
| 314 | ptrdiff_t __i = std::upper_bound(__entries, std::end(__entries), (__code_point << 11) | 0x7ffu) - __entries; | |
| 1643 | ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries; | |
| 315 | 1644 | if (__i == 0) |
| 316 | 1645 | return __property::__none; |
| 317 | 1646 |
lib/libcxx/include/__format/format_arg.h+35-5| ... | ... | @@ -45,16 +45,22 @@ namespace __format { |
| 45 | 45 | /// It could be packed in 4-bits but that means a new type directly becomes an |
| 46 | 46 | /// ABI break. The packed type is 64-bit so this reduces the maximum number of |
| 47 | 47 | /// packed elements from 16 to 12. |
| 48 | /// | |
| 49 | /// @note Some members of this enum are an extension. These extensions need | |
| 50 | /// special behaviour in visit_format_arg. There they need to be wrapped in a | |
| 51 | /// handle to satisfy the user observable behaviour. The internal function | |
| 52 | /// __visit_format_arg doesn't do this wrapping. So in the format functions | |
| 53 | /// this function is used to avoid unneeded overhead. | |
| 48 | 54 | enum class _LIBCPP_ENUM_VIS __arg_t : uint8_t { |
| 49 | 55 | __none, |
| 50 | 56 | __boolean, |
| 51 | 57 | __char_type, |
| 52 | 58 | __int, |
| 53 | 59 | __long_long, |
| 54 | __i128, | |
| 60 | __i128, // extension | |
| 55 | 61 | __unsigned, |
| 56 | 62 | __unsigned_long_long, |
| 57 | __u128, | |
| 63 | __u128, // extension | |
| 58 | 64 | __float, |
| 59 | 65 | __double, |
| 60 | 66 | __long_double, |
| ... | ... | @@ -85,9 +91,11 @@ constexpr __arg_t __get_packed_type(uint64_t __types, size_t __id) { |
| 85 | 91 | |
| 86 | 92 | } // namespace __format |
| 87 | 93 | |
| 94 | // This function is not user obervable, so it can directly use the non-standard | |
| 95 | // types of the "variant". See __arg_t for more details. | |
| 88 | 96 | template <class _Visitor, class _Context> |
| 89 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT decltype(auto) visit_format_arg(_Visitor&& __vis, | |
| 90 | basic_format_arg<_Context> __arg) { | |
| 97 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT decltype(auto) | |
| 98 | __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { | |
| 91 | 99 | switch (__arg.__type_) { |
| 92 | 100 | case __format::__arg_t::__none: |
| 93 | 101 | return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__value_.__monostate_); |
| ... | ... | @@ -153,7 +161,7 @@ public: |
| 153 | 161 | using _Dp = remove_cvref_t<_Tp>; |
| 154 | 162 | using _Formatter = typename _Context::template formatter_type<_Dp>; |
| 155 | 163 | constexpr bool __const_formattable = |
| 156 | requires { _Formatter().format(declval<const _Dp&>(), declval<_Context&>()); }; | |
| 164 | requires { _Formatter().format(std::declval<const _Dp&>(), std::declval<_Context&>()); }; | |
| 157 | 165 | using _Qp = conditional_t<__const_formattable, const _Dp, _Dp>; |
| 158 | 166 | |
| 159 | 167 | static_assert(__const_formattable || !is_const_v<remove_reference_t<_Tp>>, "Mandated by [format.arg]/18"); |
| ... | ... | @@ -265,6 +273,28 @@ private: |
| 265 | 273 | typename __basic_format_arg_value<_Context>::__handle& __handle_; |
| 266 | 274 | }; |
| 267 | 275 | |
| 276 | // This function is user facing, so it must wrap the non-standard types of | |
| 277 | // the "variant" in a handle to stay conforming. See __arg_t for more details. | |
| 278 | template <class _Visitor, class _Context> | |
| 279 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT decltype(auto) | |
| 280 | visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { | |
| 281 | switch (__arg.__type_) { | |
| 282 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 283 | case __format::__arg_t::__i128: { | |
| 284 | typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__i128_}; | |
| 285 | return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h}); | |
| 286 | } | |
| 287 | ||
| 288 | case __format::__arg_t::__u128: { | |
| 289 | typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__u128_}; | |
| 290 | return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h}); | |
| 291 | } | |
| 292 | # endif | |
| 293 | default: | |
| 294 | return _VSTD::__visit_format_arg(_VSTD::forward<_Visitor>(__vis), __arg); | |
| 295 | } | |
| 296 | } | |
| 297 | ||
| 268 | 298 | #endif //_LIBCPP_STD_VER > 17 |
| 269 | 299 | |
| 270 | 300 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__format/format_arg_store.h+3-2| ... | ... | @@ -19,6 +19,7 @@ |
| 19 | 19 | #include <__config> |
| 20 | 20 | #include <__format/concepts.h> |
| 21 | 21 | #include <__format/format_arg.h> |
| 22 | #include <__utility/forward.h> | |
| 22 | 23 | #include <cstring> |
| 23 | 24 | #include <string> |
| 24 | 25 | #include <string_view> |
| ... | ... | @@ -197,7 +198,7 @@ _LIBCPP_HIDE_FROM_ABI void __create_packed_storage(uint64_t& __types, __basic_fo |
| 197 | 198 | int __shift = 0; |
| 198 | 199 | ( |
| 199 | 200 | [&] { |
| 200 | basic_format_arg<_Context> __arg = __create_format_arg<_Context>(__args); | |
| 201 | basic_format_arg<_Context> __arg = __format::__create_format_arg<_Context>(__args); | |
| 201 | 202 | if (__shift != 0) |
| 202 | 203 | __types |= static_cast<uint64_t>(__arg.__type_) << __shift; |
| 203 | 204 | else |
| ... | ... | @@ -211,7 +212,7 @@ _LIBCPP_HIDE_FROM_ABI void __create_packed_storage(uint64_t& __types, __basic_fo |
| 211 | 212 | |
| 212 | 213 | template <class _Context, class... _Args> |
| 213 | 214 | _LIBCPP_HIDE_FROM_ABI void __store_basic_format_arg(basic_format_arg<_Context>* __data, _Args&&... __args) noexcept { |
| 214 | ([&] { *__data++ = __create_format_arg<_Context>(__args); }(), ...); | |
| 215 | ([&] { *__data++ = __format::__create_format_arg<_Context>(__args); }(), ...); | |
| 215 | 216 | } |
| 216 | 217 | |
| 217 | 218 | template <class _Context, size_t N> |
lib/libcxx/include/__format/format_args.h+1| ... | ... | @@ -71,6 +71,7 @@ private: |
| 71 | 71 | const basic_format_arg<_Context>* __args_; |
| 72 | 72 | }; |
| 73 | 73 | }; |
| 74 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_args); | |
| 74 | 75 | |
| 75 | 76 | #endif //_LIBCPP_STD_VER > 17 |
| 76 | 77 |
lib/libcxx/include/__format/format_context.h+80-8| ... | ... | @@ -11,14 +11,19 @@ |
| 11 | 11 | #define _LIBCPP___FORMAT_FORMAT_CONTEXT_H |
| 12 | 12 | |
| 13 | 13 | #include <__availability> |
| 14 | #include <__concepts/same_as.h> | |
| 14 | 15 | #include <__config> |
| 15 | 16 | #include <__format/buffer.h> |
| 17 | #include <__format/format_arg.h> | |
| 18 | #include <__format/format_arg_store.h> | |
| 16 | 19 | #include <__format/format_args.h> |
| 20 | #include <__format/format_error.h> | |
| 17 | 21 | #include <__format/format_fwd.h> |
| 18 | 22 | #include <__iterator/back_insert_iterator.h> |
| 19 | 23 | #include <__iterator/concepts.h> |
| 24 | #include <__memory/addressof.h> | |
| 20 | 25 | #include <__utility/move.h> |
| 21 | #include <concepts> | |
| 26 | #include <__variant/monostate.h> | |
| 22 | 27 | #include <cstddef> |
| 23 | 28 | |
| 24 | 29 | #ifndef _LIBCPP_HAS_NO_LOCALIZATION |
| ... | ... | @@ -50,8 +55,7 @@ __format_context_create( |
| 50 | 55 | _OutIt __out_it, |
| 51 | 56 | basic_format_args<basic_format_context<_OutIt, _CharT>> __args, |
| 52 | 57 | optional<_VSTD::locale>&& __loc = nullopt) { |
| 53 | return _VSTD::basic_format_context(_VSTD::move(__out_it), __args, | |
| 54 | _VSTD::move(__loc)); | |
| 58 | return _VSTD::basic_format_context(_VSTD::move(__out_it), __args, _VSTD::move(__loc)); | |
| 55 | 59 | } |
| 56 | 60 | #else |
| 57 | 61 | template <class _OutIt, class _CharT> |
| ... | ... | @@ -87,9 +91,6 @@ public: |
| 87 | 91 | template <class _Tp> |
| 88 | 92 | using formatter_type = formatter<_Tp, _CharT>; |
| 89 | 93 | |
| 90 | basic_format_context(const basic_format_context&) = delete; | |
| 91 | basic_format_context& operator=(const basic_format_context&) = delete; | |
| 92 | ||
| 93 | 94 | _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> |
| 94 | 95 | arg(size_t __id) const noexcept { |
| 95 | 96 | return __args_.get(__id); |
| ... | ... | @@ -101,8 +102,8 @@ public: |
| 101 | 102 | return *__loc_; |
| 102 | 103 | } |
| 103 | 104 | #endif |
| 104 | _LIBCPP_HIDE_FROM_ABI iterator out() { return __out_it_; } | |
| 105 | _LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = __it; } | |
| 105 | _LIBCPP_HIDE_FROM_ABI iterator out() { return std::move(__out_it_); } | |
| 106 | _LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = std::move(__it); } | |
| 106 | 107 | |
| 107 | 108 | private: |
| 108 | 109 | iterator __out_it_; |
| ... | ... | @@ -144,6 +145,77 @@ private: |
| 144 | 145 | #endif |
| 145 | 146 | }; |
| 146 | 147 | |
| 148 | // A specialization for __retarget_buffer | |
| 149 | // | |
| 150 | // See __retarget_buffer for the motivation for this specialization. | |
| 151 | // | |
| 152 | // This context holds a reference to the instance of the basic_format_context | |
| 153 | // that is retargeted. It converts a formatting argument when it is requested | |
| 154 | // during formatting. It is expected that the usage of the arguments is rare so | |
| 155 | // the lookups are not expected to be used often. An alternative would be to | |
| 156 | // convert all elements during construction. | |
| 157 | // | |
| 158 | // The elements of the retargets context are only used when an underlying | |
| 159 | // formatter uses a locale specific formatting or an formatting argument is | |
| 160 | // part for the format spec. For example | |
| 161 | // format("{:256:{}}", input, 8); | |
| 162 | // Here the width of an element in input is determined dynamically. | |
| 163 | // Note when the top-level element has no width the retargeting is not needed. | |
| 164 | template <class _CharT> | |
| 165 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT | |
| 166 | basic_format_context<typename __format::__retarget_buffer<_CharT>::__iterator, _CharT> { | |
| 167 | public: | |
| 168 | using iterator = typename __format::__retarget_buffer<_CharT>::__iterator; | |
| 169 | using char_type = _CharT; | |
| 170 | template <class _Tp> | |
| 171 | using formatter_type = formatter<_Tp, _CharT>; | |
| 172 | ||
| 173 | template <class _Context> | |
| 174 | _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(iterator __out_it, _Context& __ctx) | |
| 175 | : __out_it_(std::move(__out_it)), | |
| 176 | # ifndef _LIBCPP_HAS_NO_LOCALIZATION | |
| 177 | __loc_([](void* __c) { return static_cast<_Context*>(__c)->locale(); }), | |
| 178 | # endif | |
| 179 | __ctx_(std::addressof(__ctx)), | |
| 180 | __arg_([](void* __c, size_t __id) { | |
| 181 | return std::visit_format_arg( | |
| 182 | [&](auto __arg) -> basic_format_arg<basic_format_context> { | |
| 183 | if constexpr (same_as<decltype(__arg), monostate>) | |
| 184 | return {}; | |
| 185 | else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Context>::handle>) | |
| 186 | // At the moment it's not possible for formatting to use a re-targeted handle. | |
| 187 | // TODO FMT add this when support is needed. | |
| 188 | std::__throw_format_error("Re-targeting handle not supported"); | |
| 189 | else | |
| 190 | return basic_format_arg<basic_format_context>{ | |
| 191 | __format::__determine_arg_t<basic_format_context, decltype(__arg)>(), | |
| 192 | __basic_format_arg_value<basic_format_context>(__arg)}; | |
| 193 | }, | |
| 194 | static_cast<_Context*>(__c)->arg(__id)); | |
| 195 | }) { | |
| 196 | } | |
| 197 | ||
| 198 | _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept { | |
| 199 | return __arg_(__ctx_, __id); | |
| 200 | } | |
| 201 | # ifndef _LIBCPP_HAS_NO_LOCALIZATION | |
| 202 | _LIBCPP_HIDE_FROM_ABI _VSTD::locale locale() { return __loc_(__ctx_); } | |
| 203 | # endif | |
| 204 | _LIBCPP_HIDE_FROM_ABI iterator out() { return std::move(__out_it_); } | |
| 205 | _LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = std::move(__it); } | |
| 206 | ||
| 207 | private: | |
| 208 | iterator __out_it_; | |
| 209 | ||
| 210 | # ifndef _LIBCPP_HAS_NO_LOCALIZATION | |
| 211 | std::locale (*__loc_)(void* __ctx); | |
| 212 | # endif | |
| 213 | ||
| 214 | void* __ctx_; | |
| 215 | basic_format_arg<basic_format_context> (*__arg_)(void* __ctx, size_t __id); | |
| 216 | }; | |
| 217 | ||
| 218 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_context); | |
| 147 | 219 | #endif //_LIBCPP_STD_VER > 17 |
| 148 | 220 | |
| 149 | 221 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__format/format_error.h+9-5| ... | ... | @@ -11,11 +11,8 @@ |
| 11 | 11 | #define _LIBCPP___FORMAT_FORMAT_ERROR_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <stdexcept> | |
| 15 | ||
| 16 | #ifdef _LIBCPP_NO_EXCEPTIONS | |
| 17 | 14 | #include <cstdlib> |
| 18 | #endif | |
| 15 | #include <stdexcept> | |
| 19 | 16 | |
| 20 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 21 | 18 | # pragma GCC system_header |
| ... | ... | @@ -31,7 +28,14 @@ public: |
| 31 | 28 | : runtime_error(__s) {} |
| 32 | 29 | _LIBCPP_HIDE_FROM_ABI explicit format_error(const char* __s) |
| 33 | 30 | : runtime_error(__s) {} |
| 34 | virtual ~format_error() noexcept; | |
| 31 | // TODO FMT Remove when format is no longer experimental. | |
| 32 | // Avoids linker errors when building the Clang-cl Windows DLL which doesn't | |
| 33 | // support the experimental library. | |
| 34 | # ifndef _LIBCPP_INLINE_FORMAT_ERROR_DTOR | |
| 35 | ~format_error() noexcept override; | |
| 36 | # else | |
| 37 | ~format_error() noexcept override {} | |
| 38 | # endif | |
| 35 | 39 | }; |
| 36 | 40 | |
| 37 | 41 | _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void |
lib/libcxx/include/__format/format_functions.h created+661| ... | ... | @@ -0,0 +1,661 @@ |
| 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_FORMAT_FUNCTIONS | |
| 11 | #define _LIBCPP___FORMAT_FORMAT_FUNCTIONS | |
| 12 | ||
| 13 | // TODO FMT This is added to fix Apple back-deployment. | |
| 14 | #include <version> | |
| 15 | #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) | |
| 16 | ||
| 17 | #include <__algorithm/clamp.h> | |
| 18 | #include <__availability> | |
| 19 | #include <__concepts/convertible_to.h> | |
| 20 | #include <__concepts/same_as.h> | |
| 21 | #include <__config> | |
| 22 | #include <__debug> | |
| 23 | #include <__format/buffer.h> | |
| 24 | #include <__format/format_arg.h> | |
| 25 | #include <__format/format_arg_store.h> | |
| 26 | #include <__format/format_args.h> | |
| 27 | #include <__format/format_context.h> | |
| 28 | #include <__format/format_error.h> | |
| 29 | #include <__format/format_parse_context.h> | |
| 30 | #include <__format/format_string.h> | |
| 31 | #include <__format/format_to_n_result.h> | |
| 32 | #include <__format/formatter.h> | |
| 33 | #include <__format/formatter_bool.h> | |
| 34 | #include <__format/formatter_char.h> | |
| 35 | #include <__format/formatter_floating_point.h> | |
| 36 | #include <__format/formatter_integer.h> | |
| 37 | #include <__format/formatter_pointer.h> | |
| 38 | #include <__format/formatter_string.h> | |
| 39 | #include <__format/parser_std_format_spec.h> | |
| 40 | #include <__iterator/back_insert_iterator.h> | |
| 41 | #include <__iterator/incrementable_traits.h> | |
| 42 | #include <__variant/monostate.h> | |
| 43 | #include <array> | |
| 44 | #include <string> | |
| 45 | #include <string_view> | |
| 46 | ||
| 47 | #ifndef _LIBCPP_HAS_NO_LOCALIZATION | |
| 48 | #include <locale> | |
| 49 | #endif | |
| 50 | ||
| 51 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 52 | # pragma GCC system_header | |
| 53 | #endif | |
| 54 | ||
| 55 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 56 | ||
| 57 | #if _LIBCPP_STD_VER > 17 | |
| 58 | ||
| 59 | // TODO FMT Evaluate which templates should be external templates. This | |
| 60 | // improves the efficiency of the header. However since the header is still | |
| 61 | // under heavy development and not all classes are stable it makes no sense | |
| 62 | // to do this optimization now. | |
| 63 | ||
| 64 | using format_args = basic_format_args<format_context>; | |
| 65 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 66 | using wformat_args = basic_format_args<wformat_context>; | |
| 67 | #endif | |
| 68 | ||
| 69 | template <class _Context = format_context, class... _Args> | |
| 70 | _LIBCPP_HIDE_FROM_ABI __format_arg_store<_Context, _Args...> make_format_args(_Args&&... __args) { | |
| 71 | return _VSTD::__format_arg_store<_Context, _Args...>(__args...); | |
| 72 | } | |
| 73 | ||
| 74 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 75 | template <class... _Args> | |
| 76 | _LIBCPP_HIDE_FROM_ABI __format_arg_store<wformat_context, _Args...> make_wformat_args(_Args&&... __args) { | |
| 77 | return _VSTD::__format_arg_store<wformat_context, _Args...>(__args...); | |
| 78 | } | |
| 79 | #endif | |
| 80 | ||
| 81 | namespace __format { | |
| 82 | ||
| 83 | /// Helper class parse and handle argument. | |
| 84 | /// | |
| 85 | /// When parsing a handle which is not enabled the code is ill-formed. | |
| 86 | /// This helper uses the parser of the appropriate formatter for the stored type. | |
| 87 | template <class _CharT> | |
| 88 | class _LIBCPP_TEMPLATE_VIS __compile_time_handle { | |
| 89 | public: | |
| 90 | _LIBCPP_HIDE_FROM_ABI | |
| 91 | constexpr void __parse(basic_format_parse_context<_CharT>& __parse_ctx) const { __parse_(__parse_ctx); } | |
| 92 | ||
| 93 | template <class _Tp> | |
| 94 | _LIBCPP_HIDE_FROM_ABI constexpr void __enable() { | |
| 95 | __parse_ = [](basic_format_parse_context<_CharT>& __parse_ctx) { | |
| 96 | formatter<_Tp, _CharT> __f; | |
| 97 | __parse_ctx.advance_to(__f.parse(__parse_ctx)); | |
| 98 | }; | |
| 99 | } | |
| 100 | ||
| 101 | // Before calling __parse the proper handler needs to be set with __enable. | |
| 102 | // The default handler isn't a core constant expression. | |
| 103 | _LIBCPP_HIDE_FROM_ABI constexpr __compile_time_handle() | |
| 104 | : __parse_([](basic_format_parse_context<_CharT>&) { std::__throw_format_error("Not a handle"); }) {} | |
| 105 | ||
| 106 | private: | |
| 107 | void (*__parse_)(basic_format_parse_context<_CharT>&); | |
| 108 | }; | |
| 109 | ||
| 110 | // Dummy format_context only providing the parts used during constant | |
| 111 | // validation of the basic_format_string. | |
| 112 | template <class _CharT> | |
| 113 | struct _LIBCPP_TEMPLATE_VIS __compile_time_basic_format_context { | |
| 114 | public: | |
| 115 | using char_type = _CharT; | |
| 116 | ||
| 117 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __compile_time_basic_format_context( | |
| 118 | const __arg_t* __args, const __compile_time_handle<_CharT>* __handles, size_t __size) | |
| 119 | : __args_(__args), __handles_(__handles), __size_(__size) {} | |
| 120 | ||
| 121 | // During the compile-time validation nothing needs to be written. | |
| 122 | // Therefore all operations of this iterator are a NOP. | |
| 123 | struct iterator { | |
| 124 | _LIBCPP_HIDE_FROM_ABI constexpr iterator& operator=(_CharT) { return *this; } | |
| 125 | _LIBCPP_HIDE_FROM_ABI constexpr iterator& operator*() { return *this; } | |
| 126 | _LIBCPP_HIDE_FROM_ABI constexpr iterator operator++(int) { return *this; } | |
| 127 | }; | |
| 128 | ||
| 129 | _LIBCPP_HIDE_FROM_ABI constexpr __arg_t arg(size_t __id) const { | |
| 130 | if (__id >= __size_) | |
| 131 | std::__throw_format_error("Argument index out of bounds"); | |
| 132 | return __args_[__id]; | |
| 133 | } | |
| 134 | ||
| 135 | _LIBCPP_HIDE_FROM_ABI constexpr const __compile_time_handle<_CharT>& __handle(size_t __id) const { | |
| 136 | if (__id >= __size_) | |
| 137 | std::__throw_format_error("Argument index out of bounds"); | |
| 138 | return __handles_[__id]; | |
| 139 | } | |
| 140 | ||
| 141 | _LIBCPP_HIDE_FROM_ABI constexpr iterator out() { return {}; } | |
| 142 | _LIBCPP_HIDE_FROM_ABI constexpr void advance_to(iterator) {} | |
| 143 | ||
| 144 | private: | |
| 145 | const __arg_t* __args_; | |
| 146 | const __compile_time_handle<_CharT>* __handles_; | |
| 147 | size_t __size_; | |
| 148 | }; | |
| 149 | ||
| 150 | _LIBCPP_HIDE_FROM_ABI | |
| 151 | constexpr void __compile_time_validate_integral(__arg_t __type) { | |
| 152 | switch (__type) { | |
| 153 | case __arg_t::__int: | |
| 154 | case __arg_t::__long_long: | |
| 155 | case __arg_t::__i128: | |
| 156 | case __arg_t::__unsigned: | |
| 157 | case __arg_t::__unsigned_long_long: | |
| 158 | case __arg_t::__u128: | |
| 159 | return; | |
| 160 | ||
| 161 | default: | |
| 162 | std::__throw_format_error("Argument isn't an integral type"); | |
| 163 | } | |
| 164 | } | |
| 165 | ||
| 166 | // _HasPrecision does the formatter have a precision? | |
| 167 | template <class _CharT, class _Tp, bool _HasPrecision = false> | |
| 168 | _LIBCPP_HIDE_FROM_ABI constexpr void | |
| 169 | __compile_time_validate_argument(basic_format_parse_context<_CharT>& __parse_ctx, | |
| 170 | __compile_time_basic_format_context<_CharT>& __ctx) { | |
| 171 | formatter<_Tp, _CharT> __formatter; | |
| 172 | __parse_ctx.advance_to(__formatter.parse(__parse_ctx)); | |
| 173 | // [format.string.std]/7 | |
| 174 | // ... If the corresponding formatting argument is not of integral type, or | |
| 175 | // its value is negative for precision or non-positive for width, an | |
| 176 | // exception of type format_error is thrown. | |
| 177 | // | |
| 178 | // Validate whether the arguments are integrals. | |
| 179 | if (__formatter.__parser_.__width_as_arg_) | |
| 180 | __format::__compile_time_validate_integral(__ctx.arg(__formatter.__parser_.__width_)); | |
| 181 | ||
| 182 | if constexpr (_HasPrecision) | |
| 183 | if (__formatter.__parser_.__precision_as_arg_) | |
| 184 | __format::__compile_time_validate_integral(__ctx.arg(__formatter.__parser_.__precision_)); | |
| 185 | } | |
| 186 | ||
| 187 | // This function is not user facing, so it can directly use the non-standard types of the "variant". | |
| 188 | template <class _CharT> | |
| 189 | _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_format_parse_context<_CharT>& __parse_ctx, | |
| 190 | __compile_time_basic_format_context<_CharT>& __ctx, | |
| 191 | __arg_t __type) { | |
| 192 | switch (__type) { | |
| 193 | case __arg_t::__none: | |
| 194 | std::__throw_format_error("Invalid argument"); | |
| 195 | case __arg_t::__boolean: | |
| 196 | return __format::__compile_time_validate_argument<_CharT, bool>(__parse_ctx, __ctx); | |
| 197 | case __arg_t::__char_type: | |
| 198 | return __format::__compile_time_validate_argument<_CharT, _CharT>(__parse_ctx, __ctx); | |
| 199 | case __arg_t::__int: | |
| 200 | return __format::__compile_time_validate_argument<_CharT, int>(__parse_ctx, __ctx); | |
| 201 | case __arg_t::__long_long: | |
| 202 | return __format::__compile_time_validate_argument<_CharT, long long>(__parse_ctx, __ctx); | |
| 203 | case __arg_t::__i128: | |
| 204 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 205 | return __format::__compile_time_validate_argument<_CharT, __int128_t>(__parse_ctx, __ctx); | |
| 206 | # else | |
| 207 | std::__throw_format_error("Invalid argument"); | |
| 208 | # endif | |
| 209 | return; | |
| 210 | case __arg_t::__unsigned: | |
| 211 | return __format::__compile_time_validate_argument<_CharT, unsigned>(__parse_ctx, __ctx); | |
| 212 | case __arg_t::__unsigned_long_long: | |
| 213 | return __format::__compile_time_validate_argument<_CharT, unsigned long long>(__parse_ctx, __ctx); | |
| 214 | case __arg_t::__u128: | |
| 215 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 216 | return __format::__compile_time_validate_argument<_CharT, __uint128_t>(__parse_ctx, __ctx); | |
| 217 | # else | |
| 218 | std::__throw_format_error("Invalid argument"); | |
| 219 | # endif | |
| 220 | return; | |
| 221 | case __arg_t::__float: | |
| 222 | return __format::__compile_time_validate_argument<_CharT, float, true>(__parse_ctx, __ctx); | |
| 223 | case __arg_t::__double: | |
| 224 | return __format::__compile_time_validate_argument<_CharT, double, true>(__parse_ctx, __ctx); | |
| 225 | case __arg_t::__long_double: | |
| 226 | return __format::__compile_time_validate_argument<_CharT, long double, true>(__parse_ctx, __ctx); | |
| 227 | case __arg_t::__const_char_type_ptr: | |
| 228 | return __format::__compile_time_validate_argument<_CharT, const _CharT*, true>(__parse_ctx, __ctx); | |
| 229 | case __arg_t::__string_view: | |
| 230 | return __format::__compile_time_validate_argument<_CharT, basic_string_view<_CharT>, true>(__parse_ctx, __ctx); | |
| 231 | case __arg_t::__ptr: | |
| 232 | return __format::__compile_time_validate_argument<_CharT, const void*>(__parse_ctx, __ctx); | |
| 233 | case __arg_t::__handle: | |
| 234 | std::__throw_format_error("Handle should use __compile_time_validate_handle_argument"); | |
| 235 | } | |
| 236 | std::__throw_format_error("Invalid argument"); | |
| 237 | } | |
| 238 | ||
| 239 | template <class _CharT, class _ParseCtx, class _Ctx> | |
| 240 | _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* | |
| 241 | __handle_replacement_field(const _CharT* __begin, const _CharT* __end, | |
| 242 | _ParseCtx& __parse_ctx, _Ctx& __ctx) { | |
| 243 | __format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx); | |
| 244 | ||
| 245 | bool __parse = *__r.__ptr == _CharT(':'); | |
| 246 | switch (*__r.__ptr) { | |
| 247 | case _CharT(':'): | |
| 248 | // The arg-id has a format-specifier, advance the input to the format-spec. | |
| 249 | __parse_ctx.advance_to(__r.__ptr + 1); | |
| 250 | break; | |
| 251 | case _CharT('}'): | |
| 252 | // The arg-id has no format-specifier. | |
| 253 | __parse_ctx.advance_to(__r.__ptr); | |
| 254 | break; | |
| 255 | default: | |
| 256 | std::__throw_format_error("The replacement field arg-id should terminate at a ':' or '}'"); | |
| 257 | } | |
| 258 | ||
| 259 | if constexpr (same_as<_Ctx, __compile_time_basic_format_context<_CharT>>) { | |
| 260 | __arg_t __type = __ctx.arg(__r.__value); | |
| 261 | if (__type == __arg_t::__handle) | |
| 262 | __ctx.__handle(__r.__value).__parse(__parse_ctx); | |
| 263 | else | |
| 264 | __format::__compile_time_visit_format_arg(__parse_ctx, __ctx, __type); | |
| 265 | } else | |
| 266 | _VSTD::__visit_format_arg( | |
| 267 | [&](auto __arg) { | |
| 268 | if constexpr (same_as<decltype(__arg), monostate>) | |
| 269 | std::__throw_format_error("Argument index out of bounds"); | |
| 270 | else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Ctx>::handle>) | |
| 271 | __arg.format(__parse_ctx, __ctx); | |
| 272 | else { | |
| 273 | formatter<decltype(__arg), _CharT> __formatter; | |
| 274 | if (__parse) | |
| 275 | __parse_ctx.advance_to(__formatter.parse(__parse_ctx)); | |
| 276 | __ctx.advance_to(__formatter.format(__arg, __ctx)); | |
| 277 | } | |
| 278 | }, | |
| 279 | __ctx.arg(__r.__value)); | |
| 280 | ||
| 281 | __begin = __parse_ctx.begin(); | |
| 282 | if (__begin == __end || *__begin != _CharT('}')) | |
| 283 | std::__throw_format_error("The replacement field misses a terminating '}'"); | |
| 284 | ||
| 285 | return ++__begin; | |
| 286 | } | |
| 287 | ||
| 288 | template <class _ParseCtx, class _Ctx> | |
| 289 | _LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator | |
| 290 | __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) { | |
| 291 | using _CharT = typename _ParseCtx::char_type; | |
| 292 | static_assert(same_as<typename _Ctx::char_type, _CharT>); | |
| 293 | ||
| 294 | const _CharT* __begin = __parse_ctx.begin(); | |
| 295 | const _CharT* __end = __parse_ctx.end(); | |
| 296 | typename _Ctx::iterator __out_it = __ctx.out(); | |
| 297 | while (__begin != __end) { | |
| 298 | switch (*__begin) { | |
| 299 | case _CharT('{'): | |
| 300 | ++__begin; | |
| 301 | if (__begin == __end) | |
| 302 | std::__throw_format_error("The format string terminates at a '{'"); | |
| 303 | ||
| 304 | if (*__begin != _CharT('{')) [[likely]] { | |
| 305 | __ctx.advance_to(_VSTD::move(__out_it)); | |
| 306 | __begin = | |
| 307 | __format::__handle_replacement_field(__begin, __end, __parse_ctx, __ctx); | |
| 308 | __out_it = __ctx.out(); | |
| 309 | ||
| 310 | // The output is written and __begin points to the next character. So | |
| 311 | // start the next iteration. | |
| 312 | continue; | |
| 313 | } | |
| 314 | // The string is an escape character. | |
| 315 | break; | |
| 316 | ||
| 317 | case _CharT('}'): | |
| 318 | ++__begin; | |
| 319 | if (__begin == __end || *__begin != _CharT('}')) | |
| 320 | std::__throw_format_error("The format string contains an invalid escape sequence"); | |
| 321 | ||
| 322 | break; | |
| 323 | } | |
| 324 | ||
| 325 | // Copy the character to the output verbatim. | |
| 326 | *__out_it++ = *__begin++; | |
| 327 | } | |
| 328 | return __out_it; | |
| 329 | } | |
| 330 | ||
| 331 | } // namespace __format | |
| 332 | ||
| 333 | template <class _CharT, class... _Args> | |
| 334 | struct _LIBCPP_TEMPLATE_VIS basic_format_string { | |
| 335 | template <class _Tp> | |
| 336 | requires convertible_to<const _Tp&, basic_string_view<_CharT>> | |
| 337 | consteval basic_format_string(const _Tp& __str) : __str_{__str} { | |
| 338 | __format::__vformat_to(basic_format_parse_context<_CharT>{__str_, sizeof...(_Args)}, | |
| 339 | _Context{__types_.data(), __handles_.data(), sizeof...(_Args)}); | |
| 340 | } | |
| 341 | ||
| 342 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT constexpr basic_string_view<_CharT> get() const noexcept { | |
| 343 | return __str_; | |
| 344 | } | |
| 345 | ||
| 346 | private: | |
| 347 | basic_string_view<_CharT> __str_; | |
| 348 | ||
| 349 | using _Context = __format::__compile_time_basic_format_context<_CharT>; | |
| 350 | ||
| 351 | static constexpr array<__format::__arg_t, sizeof...(_Args)> __types_{ | |
| 352 | __format::__determine_arg_t<_Context, remove_cvref_t<_Args>>()...}; | |
| 353 | ||
| 354 | // TODO FMT remove this work-around when the AIX ICE has been resolved. | |
| 355 | # if defined(_AIX) && defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1400 | |
| 356 | template <class _Tp> | |
| 357 | static constexpr __format::__compile_time_handle<_CharT> __get_handle() { | |
| 358 | __format::__compile_time_handle<_CharT> __handle; | |
| 359 | if (__format::__determine_arg_t<_Context, _Tp>() == __format::__arg_t::__handle) | |
| 360 | __handle.template __enable<_Tp>(); | |
| 361 | ||
| 362 | return __handle; | |
| 363 | } | |
| 364 | ||
| 365 | static constexpr array<__format::__compile_time_handle<_CharT>, sizeof...(_Args)> __handles_{ | |
| 366 | __get_handle<_Args>()...}; | |
| 367 | # else | |
| 368 | static constexpr array<__format::__compile_time_handle<_CharT>, sizeof...(_Args)> __handles_{[] { | |
| 369 | using _Tp = remove_cvref_t<_Args>; | |
| 370 | __format::__compile_time_handle<_CharT> __handle; | |
| 371 | if (__format::__determine_arg_t<_Context, _Tp>() == __format::__arg_t::__handle) | |
| 372 | __handle.template __enable<_Tp>(); | |
| 373 | ||
| 374 | return __handle; | |
| 375 | }()...}; | |
| 376 | # endif | |
| 377 | }; | |
| 378 | ||
| 379 | template <class... _Args> | |
| 380 | using format_string = basic_format_string<char, type_identity_t<_Args>...>; | |
| 381 | ||
| 382 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 383 | template <class... _Args> | |
| 384 | using wformat_string = basic_format_string<wchar_t, type_identity_t<_Args>...>; | |
| 385 | #endif | |
| 386 | ||
| 387 | template <class _OutIt, class _CharT, class _FormatOutIt> | |
| 388 | requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt | |
| 389 | __vformat_to( | |
| 390 | _OutIt __out_it, basic_string_view<_CharT> __fmt, | |
| 391 | basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) { | |
| 392 | if constexpr (same_as<_OutIt, _FormatOutIt>) | |
| 393 | return _VSTD::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()}, | |
| 394 | _VSTD::__format_context_create(_VSTD::move(__out_it), __args)); | |
| 395 | else { | |
| 396 | __format::__format_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it)}; | |
| 397 | _VSTD::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()}, | |
| 398 | _VSTD::__format_context_create(__buffer.__make_output_iterator(), __args)); | |
| 399 | return _VSTD::move(__buffer).__out_it(); | |
| 400 | } | |
| 401 | } | |
| 402 | ||
| 403 | // The function is _LIBCPP_ALWAYS_INLINE since the compiler is bad at inlining | |
| 404 | // https://reviews.llvm.org/D110499#inline-1180704 | |
| 405 | // TODO FMT Evaluate whether we want to file a Clang bug report regarding this. | |
| 406 | template <output_iterator<const char&> _OutIt> | |
| 407 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 408 | vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) { | |
| 409 | return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args); | |
| 410 | } | |
| 411 | ||
| 412 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 413 | template <output_iterator<const wchar_t&> _OutIt> | |
| 414 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 415 | vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) { | |
| 416 | return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args); | |
| 417 | } | |
| 418 | #endif | |
| 419 | ||
| 420 | template <output_iterator<const char&> _OutIt, class... _Args> | |
| 421 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 422 | format_to(_OutIt __out_it, format_string<_Args...> __fmt, _Args&&... __args) { | |
| 423 | return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt.get(), | |
| 424 | _VSTD::make_format_args(__args...)); | |
| 425 | } | |
| 426 | ||
| 427 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 428 | template <output_iterator<const wchar_t&> _OutIt, class... _Args> | |
| 429 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 430 | format_to(_OutIt __out_it, wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 431 | return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt.get(), | |
| 432 | _VSTD::make_wformat_args(__args...)); | |
| 433 | } | |
| 434 | #endif | |
| 435 | ||
| 436 | _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string | |
| 437 | vformat(string_view __fmt, format_args __args) { | |
| 438 | string __res; | |
| 439 | _VSTD::vformat_to(_VSTD::back_inserter(__res), __fmt, __args); | |
| 440 | return __res; | |
| 441 | } | |
| 442 | ||
| 443 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 444 | _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring | |
| 445 | vformat(wstring_view __fmt, wformat_args __args) { | |
| 446 | wstring __res; | |
| 447 | _VSTD::vformat_to(_VSTD::back_inserter(__res), __fmt, __args); | |
| 448 | return __res; | |
| 449 | } | |
| 450 | #endif | |
| 451 | ||
| 452 | template <class... _Args> | |
| 453 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string format(format_string<_Args...> __fmt, | |
| 454 | _Args&&... __args) { | |
| 455 | return _VSTD::vformat(__fmt.get(), _VSTD::make_format_args(__args...)); | |
| 456 | } | |
| 457 | ||
| 458 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 459 | template <class... _Args> | |
| 460 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring | |
| 461 | format(wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 462 | return _VSTD::vformat(__fmt.get(), _VSTD::make_wformat_args(__args...)); | |
| 463 | } | |
| 464 | #endif | |
| 465 | ||
| 466 | template <class _Context, class _OutIt, class _CharT> | |
| 467 | _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, | |
| 468 | basic_string_view<_CharT> __fmt, | |
| 469 | basic_format_args<_Context> __args) { | |
| 470 | __format::__format_to_n_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it), __n}; | |
| 471 | _VSTD::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()}, | |
| 472 | _VSTD::__format_context_create(__buffer.__make_output_iterator(), __args)); | |
| 473 | return _VSTD::move(__buffer).__result(); | |
| 474 | } | |
| 475 | ||
| 476 | template <output_iterator<const char&> _OutIt, class... _Args> | |
| 477 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> | |
| 478 | format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, format_string<_Args...> __fmt, _Args&&... __args) { | |
| 479 | return _VSTD::__vformat_to_n<format_context>(_VSTD::move(__out_it), __n, __fmt.get(), _VSTD::make_format_args(__args...)); | |
| 480 | } | |
| 481 | ||
| 482 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 483 | template <output_iterator<const wchar_t&> _OutIt, class... _Args> | |
| 484 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> | |
| 485 | format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wformat_string<_Args...> __fmt, | |
| 486 | _Args&&... __args) { | |
| 487 | return _VSTD::__vformat_to_n<wformat_context>(_VSTD::move(__out_it), __n, __fmt.get(), _VSTD::make_wformat_args(__args...)); | |
| 488 | } | |
| 489 | #endif | |
| 490 | ||
| 491 | template <class _CharT> | |
| 492 | _LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(basic_string_view<_CharT> __fmt, auto __args) { | |
| 493 | __format::__formatted_size_buffer<_CharT> __buffer; | |
| 494 | _VSTD::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()}, | |
| 495 | _VSTD::__format_context_create(__buffer.__make_output_iterator(), __args)); | |
| 496 | return _VSTD::move(__buffer).__result(); | |
| 497 | } | |
| 498 | ||
| 499 | template <class... _Args> | |
| 500 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t | |
| 501 | formatted_size(format_string<_Args...> __fmt, _Args&&... __args) { | |
| 502 | return _VSTD::__vformatted_size(__fmt.get(), basic_format_args{_VSTD::make_format_args(__args...)}); | |
| 503 | } | |
| 504 | ||
| 505 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 506 | template <class... _Args> | |
| 507 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t | |
| 508 | formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 509 | return _VSTD::__vformatted_size(__fmt.get(), basic_format_args{_VSTD::make_wformat_args(__args...)}); | |
| 510 | } | |
| 511 | #endif | |
| 512 | ||
| 513 | #ifndef _LIBCPP_HAS_NO_LOCALIZATION | |
| 514 | ||
| 515 | template <class _OutIt, class _CharT, class _FormatOutIt> | |
| 516 | requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt | |
| 517 | __vformat_to( | |
| 518 | _OutIt __out_it, locale __loc, basic_string_view<_CharT> __fmt, | |
| 519 | basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) { | |
| 520 | if constexpr (same_as<_OutIt, _FormatOutIt>) | |
| 521 | return _VSTD::__format::__vformat_to( | |
| 522 | basic_format_parse_context{__fmt, __args.__size()}, | |
| 523 | _VSTD::__format_context_create(_VSTD::move(__out_it), __args, _VSTD::move(__loc))); | |
| 524 | else { | |
| 525 | __format::__format_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it)}; | |
| 526 | _VSTD::__format::__vformat_to( | |
| 527 | basic_format_parse_context{__fmt, __args.__size()}, | |
| 528 | _VSTD::__format_context_create(__buffer.__make_output_iterator(), __args, _VSTD::move(__loc))); | |
| 529 | return _VSTD::move(__buffer).__out_it(); | |
| 530 | } | |
| 531 | } | |
| 532 | ||
| 533 | template <output_iterator<const char&> _OutIt> | |
| 534 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt vformat_to( | |
| 535 | _OutIt __out_it, locale __loc, string_view __fmt, format_args __args) { | |
| 536 | return _VSTD::__vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, | |
| 537 | __args); | |
| 538 | } | |
| 539 | ||
| 540 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 541 | template <output_iterator<const wchar_t&> _OutIt> | |
| 542 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt vformat_to( | |
| 543 | _OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) { | |
| 544 | return _VSTD::__vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, | |
| 545 | __args); | |
| 546 | } | |
| 547 | #endif | |
| 548 | ||
| 549 | template <output_iterator<const char&> _OutIt, class... _Args> | |
| 550 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 551 | format_to(_OutIt __out_it, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) { | |
| 552 | return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt.get(), | |
| 553 | _VSTD::make_format_args(__args...)); | |
| 554 | } | |
| 555 | ||
| 556 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 557 | template <output_iterator<const wchar_t&> _OutIt, class... _Args> | |
| 558 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 559 | format_to(_OutIt __out_it, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 560 | return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt.get(), | |
| 561 | _VSTD::make_wformat_args(__args...)); | |
| 562 | } | |
| 563 | #endif | |
| 564 | ||
| 565 | _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string | |
| 566 | vformat(locale __loc, string_view __fmt, format_args __args) { | |
| 567 | string __res; | |
| 568 | _VSTD::vformat_to(_VSTD::back_inserter(__res), _VSTD::move(__loc), __fmt, | |
| 569 | __args); | |
| 570 | return __res; | |
| 571 | } | |
| 572 | ||
| 573 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 574 | _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring | |
| 575 | vformat(locale __loc, wstring_view __fmt, wformat_args __args) { | |
| 576 | wstring __res; | |
| 577 | _VSTD::vformat_to(_VSTD::back_inserter(__res), _VSTD::move(__loc), __fmt, | |
| 578 | __args); | |
| 579 | return __res; | |
| 580 | } | |
| 581 | #endif | |
| 582 | ||
| 583 | template <class... _Args> | |
| 584 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string format(locale __loc, | |
| 585 | format_string<_Args...> __fmt, | |
| 586 | _Args&&... __args) { | |
| 587 | return _VSTD::vformat(_VSTD::move(__loc), __fmt.get(), | |
| 588 | _VSTD::make_format_args(__args...)); | |
| 589 | } | |
| 590 | ||
| 591 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 592 | template <class... _Args> | |
| 593 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring | |
| 594 | format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 595 | return _VSTD::vformat(_VSTD::move(__loc), __fmt.get(), | |
| 596 | _VSTD::make_wformat_args(__args...)); | |
| 597 | } | |
| 598 | #endif | |
| 599 | ||
| 600 | template <class _Context, class _OutIt, class _CharT> | |
| 601 | _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, | |
| 602 | locale __loc, basic_string_view<_CharT> __fmt, | |
| 603 | basic_format_args<_Context> __args) { | |
| 604 | __format::__format_to_n_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it), __n}; | |
| 605 | _VSTD::__format::__vformat_to( | |
| 606 | basic_format_parse_context{__fmt, __args.__size()}, | |
| 607 | _VSTD::__format_context_create(__buffer.__make_output_iterator(), __args, _VSTD::move(__loc))); | |
| 608 | return _VSTD::move(__buffer).__result(); | |
| 609 | } | |
| 610 | ||
| 611 | template <output_iterator<const char&> _OutIt, class... _Args> | |
| 612 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> | |
| 613 | format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, format_string<_Args...> __fmt, | |
| 614 | _Args&&... __args) { | |
| 615 | return _VSTD::__vformat_to_n<format_context>(_VSTD::move(__out_it), __n, _VSTD::move(__loc), __fmt.get(), | |
| 616 | _VSTD::make_format_args(__args...)); | |
| 617 | } | |
| 618 | ||
| 619 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 620 | template <output_iterator<const wchar_t&> _OutIt, class... _Args> | |
| 621 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> | |
| 622 | format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, wformat_string<_Args...> __fmt, | |
| 623 | _Args&&... __args) { | |
| 624 | return _VSTD::__vformat_to_n<wformat_context>(_VSTD::move(__out_it), __n, _VSTD::move(__loc), __fmt.get(), | |
| 625 | _VSTD::make_wformat_args(__args...)); | |
| 626 | } | |
| 627 | #endif | |
| 628 | ||
| 629 | template <class _CharT> | |
| 630 | _LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(locale __loc, basic_string_view<_CharT> __fmt, auto __args) { | |
| 631 | __format::__formatted_size_buffer<_CharT> __buffer; | |
| 632 | _VSTD::__format::__vformat_to( | |
| 633 | basic_format_parse_context{__fmt, __args.__size()}, | |
| 634 | _VSTD::__format_context_create(__buffer.__make_output_iterator(), __args, _VSTD::move(__loc))); | |
| 635 | return _VSTD::move(__buffer).__result(); | |
| 636 | } | |
| 637 | ||
| 638 | template <class... _Args> | |
| 639 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t | |
| 640 | formatted_size(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) { | |
| 641 | return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt.get(), basic_format_args{_VSTD::make_format_args(__args...)}); | |
| 642 | } | |
| 643 | ||
| 644 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 645 | template <class... _Args> | |
| 646 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t | |
| 647 | formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 648 | return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt.get(), basic_format_args{_VSTD::make_wformat_args(__args...)}); | |
| 649 | } | |
| 650 | #endif | |
| 651 | ||
| 652 | #endif // _LIBCPP_HAS_NO_LOCALIZATION | |
| 653 | ||
| 654 | ||
| 655 | #endif //_LIBCPP_STD_VER > 17 | |
| 656 | ||
| 657 | _LIBCPP_END_NAMESPACE_STD | |
| 658 | ||
| 659 | #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) | |
| 660 | ||
| 661 | #endif // _LIBCPP___FORMAT_FORMAT_FUNCTIONS |
lib/libcxx/include/__format/format_parse_context.h+4-5| ... | ... | @@ -54,8 +54,7 @@ public: |
| 54 | 54 | |
| 55 | 55 | _LIBCPP_HIDE_FROM_ABI constexpr size_t next_arg_id() { |
| 56 | 56 | if (__indexing_ == __manual) |
| 57 | __throw_format_error("Using automatic argument numbering in manual " | |
| 58 | "argument numbering mode"); | |
| 57 | std::__throw_format_error("Using automatic argument numbering in manual argument numbering mode"); | |
| 59 | 58 | |
| 60 | 59 | if (__indexing_ == __unknown) |
| 61 | 60 | __indexing_ = __automatic; |
| ... | ... | @@ -63,8 +62,7 @@ public: |
| 63 | 62 | } |
| 64 | 63 | _LIBCPP_HIDE_FROM_ABI constexpr void check_arg_id(size_t __id) { |
| 65 | 64 | if (__indexing_ == __automatic) |
| 66 | __throw_format_error("Using manual argument numbering in automatic " | |
| 67 | "argument numbering mode"); | |
| 65 | std::__throw_format_error("Using manual argument numbering in automatic argument numbering mode"); | |
| 68 | 66 | |
| 69 | 67 | if (__indexing_ == __unknown) |
| 70 | 68 | __indexing_ = __manual; |
| ... | ... | @@ -77,7 +75,7 @@ public: |
| 77 | 75 | // Note: the Throws clause [format.parse.ctx]/10 doesn't specify the |
| 78 | 76 | // behavior when id >= num_args_. |
| 79 | 77 | if (is_constant_evaluated() && __id >= __num_args_) |
| 80 | __throw_format_error("Argument index outside the valid range"); | |
| 78 | std::__throw_format_error("Argument index outside the valid range"); | |
| 81 | 79 | } |
| 82 | 80 | |
| 83 | 81 | private: |
| ... | ... | @@ -88,6 +86,7 @@ private: |
| 88 | 86 | size_t __next_arg_id_; |
| 89 | 87 | size_t __num_args_; |
| 90 | 88 | }; |
| 89 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_parse_context); | |
| 91 | 90 | |
| 92 | 91 | using format_parse_context = basic_format_parse_context<char>; |
| 93 | 92 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
lib/libcxx/include/__format/format_string.h+6-4| ... | ... | @@ -32,6 +32,9 @@ struct _LIBCPP_TEMPLATE_VIS __parse_number_result { |
| 32 | 32 | uint32_t __value; |
| 33 | 33 | }; |
| 34 | 34 | |
| 35 | template <class _CharT> | |
| 36 | __parse_number_result(const _CharT*, uint32_t) -> __parse_number_result<_CharT>; | |
| 37 | ||
| 35 | 38 | template <class _CharT> |
| 36 | 39 | _LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_CharT> |
| 37 | 40 | __parse_number(const _CharT* __begin, const _CharT* __end); |
| ... | ... | @@ -70,7 +73,7 @@ __parse_automatic(const _CharT* __begin, const _CharT*, auto& __parse_ctx) { |
| 70 | 73 | template <class _CharT> |
| 71 | 74 | _LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_CharT> |
| 72 | 75 | __parse_manual(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) { |
| 73 | __parse_number_result<_CharT> __r = __parse_number(__begin, __end); | |
| 76 | __parse_number_result<_CharT> __r = __format::__parse_number(__begin, __end); | |
| 74 | 77 | __parse_ctx.check_arg_id(__r.__value); |
| 75 | 78 | return __r; |
| 76 | 79 | } |
| ... | ... | @@ -117,7 +120,7 @@ __parse_number(const _CharT* __begin, const _CharT* __end_input) { |
| 117 | 120 | if (__v > __number_max || |
| 118 | 121 | (__begin != __end_input && *__begin >= _CharT('0') && |
| 119 | 122 | *__begin <= _CharT('9'))) |
| 120 | __throw_format_error("The numeric value of the format-spec is too large"); | |
| 123 | std::__throw_format_error("The numeric value of the format-spec is too large"); | |
| 121 | 124 | |
| 122 | 125 | __value = __v; |
| 123 | 126 | } |
| ... | ... | @@ -146,8 +149,7 @@ __parse_arg_id(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) { |
| 146 | 149 | return __detail::__parse_automatic(__begin, __end, __parse_ctx); |
| 147 | 150 | } |
| 148 | 151 | if (*__begin < _CharT('0') || *__begin > _CharT('9')) |
| 149 | __throw_format_error( | |
| 150 | "The arg-id of the format-spec starts with an invalid character"); | |
| 152 | std::__throw_format_error("The arg-id of the format-spec starts with an invalid character"); | |
| 151 | 153 | |
| 152 | 154 | return __detail::__parse_manual(__begin, __end, __parse_ctx); |
| 153 | 155 | } |
lib/libcxx/include/__format/format_to_n_result.h+1| ... | ... | @@ -26,6 +26,7 @@ struct _LIBCPP_TEMPLATE_VIS format_to_n_result { |
| 26 | 26 | _OutIt out; |
| 27 | 27 | iter_difference_t<_OutIt> size; |
| 28 | 28 | }; |
| 29 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(format_to_n_result); | |
| 29 | 30 | |
| 30 | 31 | #endif //_LIBCPP_STD_VER > 17 |
| 31 | 32 |
lib/libcxx/include/__format/formatter.h+8-8| ... | ... | @@ -11,7 +11,6 @@ |
| 11 | 11 | #define _LIBCPP___FORMAT_FORMATTER_H |
| 12 | 12 | |
| 13 | 13 | #include <__availability> |
| 14 | #include <__concepts/same_as.h> | |
| 15 | 14 | #include <__config> |
| 16 | 15 | #include <__format/format_fwd.h> |
| 17 | 16 | |
| ... | ... | @@ -39,15 +38,16 @@ struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter { |
| 39 | 38 | formatter& operator=(const formatter&) = delete; |
| 40 | 39 | }; |
| 41 | 40 | |
| 42 | namespace __formatter { | |
| 41 | # if _LIBCPP_STD_VER > 20 | |
| 43 | 42 | |
| 44 | /** The character types that formatters are specialized for. */ | |
| 45 | template <class _CharT> | |
| 46 | concept __char_type = same_as<_CharT, char> || same_as<_CharT, wchar_t>; | |
| 43 | template <class _Tp> | |
| 44 | _LIBCPP_HIDE_FROM_ABI constexpr void __set_debug_format(_Tp& __formatter) { | |
| 45 | if constexpr (requires { __formatter.set_debug_format(); }) | |
| 46 | __formatter.set_debug_format(); | |
| 47 | } | |
| 47 | 48 | |
| 48 | } // namespace __formatter | |
| 49 | ||
| 50 | #endif //_LIBCPP_STD_VER > 17 | |
| 49 | # endif // _LIBCPP_STD_VER > 20 | |
| 50 | #endif // _LIBCPP_STD_VER > 17 | |
| 51 | 51 | |
| 52 | 52 | _LIBCPP_END_NAMESPACE_STD |
| 53 | 53 |
lib/libcxx/include/__format/formatter_bool.h+2-2| ... | ... | @@ -14,8 +14,8 @@ |
| 14 | 14 | #include <__availability> |
| 15 | 15 | #include <__config> |
| 16 | 16 | #include <__debug> |
| 17 | #include <__format/concepts.h> | |
| 17 | 18 | #include <__format/format_error.h> |
| 18 | #include <__format/format_fwd.h> | |
| 19 | 19 | #include <__format/format_parse_context.h> |
| 20 | 20 | #include <__format/formatter.h> |
| 21 | 21 | #include <__format/formatter_integral.h> |
| ... | ... | @@ -35,7 +35,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 35 | 35 | |
| 36 | 36 | #if _LIBCPP_STD_VER > 17 |
| 37 | 37 | |
| 38 | template <__formatter::__char_type _CharT> | |
| 38 | template <__fmt_char_type _CharT> | |
| 39 | 39 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<bool, _CharT> { |
| 40 | 40 | public: |
| 41 | 41 | _LIBCPP_HIDE_FROM_ABI constexpr auto |
lib/libcxx/include/__format/formatter_char.h+11-2| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | #include <__availability> |
| 14 | 14 | #include <__concepts/same_as.h> |
| 15 | 15 | #include <__config> |
| 16 | #include <__format/format_fwd.h> | |
| 16 | #include <__format/concepts.h> | |
| 17 | 17 | #include <__format/format_parse_context.h> |
| 18 | 18 | #include <__format/formatter.h> |
| 19 | 19 | #include <__format/formatter_integral.h> |
| ... | ... | @@ -30,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 30 | |
| 31 | 31 | #if _LIBCPP_STD_VER > 17 |
| 32 | 32 | |
| 33 | template <__formatter::__char_type _CharT> | |
| 33 | template <__fmt_char_type _CharT> | |
| 34 | 34 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatter_char { |
| 35 | 35 | public: |
| 36 | 36 | _LIBCPP_HIDE_FROM_ABI constexpr auto |
| ... | ... | @@ -44,6 +44,11 @@ public: |
| 44 | 44 | if (__parser_.__type_ == __format_spec::__type::__default || __parser_.__type_ == __format_spec::__type::__char) |
| 45 | 45 | return __formatter::__format_char(__value, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx)); |
| 46 | 46 | |
| 47 | # if _LIBCPP_STD_VER > 20 | |
| 48 | if (__parser_.__type_ == __format_spec::__type::__debug) | |
| 49 | return __formatter::__format_escaped_char(__value, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx)); | |
| 50 | # endif | |
| 51 | ||
| 47 | 52 | if constexpr (sizeof(_CharT) <= sizeof(int)) |
| 48 | 53 | // Promotes _CharT to an integral type. This reduces the number of |
| 49 | 54 | // instantiations of __format_integer reducing code size. |
| ... | ... | @@ -61,6 +66,10 @@ public: |
| 61 | 66 | return format(static_cast<wchar_t>(__value), __ctx); |
| 62 | 67 | } |
| 63 | 68 | |
| 69 | # if _LIBCPP_STD_VER > 20 | |
| 70 | _LIBCPP_HIDE_FROM_ABI constexpr void set_debug_format() { __parser_.__type_ = __format_spec::__type::__debug; } | |
| 71 | # endif | |
| 72 | ||
| 64 | 73 | __format_spec::__parser<_CharT> __parser_; |
| 65 | 74 | }; |
| 66 | 75 |
lib/libcxx/include/__format/formatter_floating_point.h+72-36| ... | ... | @@ -10,17 +10,16 @@ |
| 10 | 10 | #ifndef _LIBCPP___FORMAT_FORMATTER_FLOATING_POINT_H |
| 11 | 11 | #define _LIBCPP___FORMAT_FORMATTER_FLOATING_POINT_H |
| 12 | 12 | |
| 13 | #include <__algorithm/copy.h> | |
| 14 | 13 | #include <__algorithm/copy_n.h> |
| 15 | #include <__algorithm/fill_n.h> | |
| 16 | 14 | #include <__algorithm/find.h> |
| 15 | #include <__algorithm/max.h> | |
| 17 | 16 | #include <__algorithm/min.h> |
| 18 | 17 | #include <__algorithm/rotate.h> |
| 19 | 18 | #include <__algorithm/transform.h> |
| 20 | 19 | #include <__concepts/arithmetic.h> |
| 21 | 20 | #include <__concepts/same_as.h> |
| 22 | 21 | #include <__config> |
| 23 | #include <__format/format_fwd.h> | |
| 22 | #include <__format/concepts.h> | |
| 24 | 23 | #include <__format/format_parse_context.h> |
| 25 | 24 | #include <__format/formatter.h> |
| 26 | 25 | #include <__format/formatter_integral.h> |
| ... | ... | @@ -103,7 +102,7 @@ template <class _Tp> |
| 103 | 102 | struct __traits; |
| 104 | 103 | |
| 105 | 104 | template <floating_point _Fp> |
| 106 | static constexpr size_t __float_buffer_size(int __precision) { | |
| 105 | _LIBCPP_HIDE_FROM_ABI constexpr size_t __float_buffer_size(int __precision) { | |
| 107 | 106 | using _Traits = __traits<_Fp>; |
| 108 | 107 | return 4 + _Traits::__max_integral + __precision + _Traits::__max_fractional_value; |
| 109 | 108 | } |
| ... | ... | @@ -183,6 +182,7 @@ public: |
| 183 | 182 | _LIBCPP_HIDE_FROM_ABI int __precision() const { return __precision_; } |
| 184 | 183 | _LIBCPP_HIDE_FROM_ABI int __num_trailing_zeros() const { return __num_trailing_zeros_; } |
| 185 | 184 | _LIBCPP_HIDE_FROM_ABI void __remove_trailing_zeros() { __num_trailing_zeros_ = 0; } |
| 185 | _LIBCPP_HIDE_FROM_ABI void __add_trailing_zeros(int __zeros) { __num_trailing_zeros_ += __zeros; } | |
| 186 | 186 | |
| 187 | 187 | private: |
| 188 | 188 | int __precision_; |
| ... | ... | @@ -216,7 +216,7 @@ struct __float_result { |
| 216 | 216 | /// \returns a pointer to the exponent or __last when not found. |
| 217 | 217 | constexpr inline _LIBCPP_HIDE_FROM_ABI char* __find_exponent(char* __first, char* __last) { |
| 218 | 218 | ptrdiff_t __size = __last - __first; |
| 219 | if (__size > 4) { | |
| 219 | if (__size >= 4) { | |
| 220 | 220 | __first = __last - _VSTD::min(__size, ptrdiff_t(6)); |
| 221 | 221 | for (; __first != __last - 3; ++__first) { |
| 222 | 222 | if (*__first == 'e') |
| ... | ... | @@ -404,6 +404,7 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_general_lower_case(__float_ |
| 404 | 404 | // In fixed mode the algorithm truncates trailing spaces and possibly the |
| 405 | 405 | // radix point. There's no good guess for the position of the radix point |
| 406 | 406 | // therefore scan the output after the first digit. |
| 407 | ||
| 407 | 408 | __result.__radix_point = _VSTD::find(__first, __result.__last, '.'); |
| 408 | 409 | } |
| 409 | 410 | } |
| ... | ... | @@ -454,7 +455,10 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer( |
| 454 | 455 | char* __first = __formatter::__insert_sign(__buffer.begin(), __negative, __sign); |
| 455 | 456 | switch (__type) { |
| 456 | 457 | case __format_spec::__type::__default: |
| 457 | return __formatter::__format_buffer_default(__buffer, __value, __first); | |
| 458 | if (__has_precision) | |
| 459 | return __formatter::__format_buffer_general_lower_case(__buffer, __value, __buffer.__precision(), __first); | |
| 460 | else | |
| 461 | return __formatter::__format_buffer_default(__buffer, __value, __first); | |
| 458 | 462 | |
| 459 | 463 | case __format_spec::__type::__hexfloat_lower_case: |
| 460 | 464 | return __formatter::__format_buffer_hexadecimal_lower_case( |
| ... | ... | @@ -494,7 +498,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form( |
| 494 | 498 | const __float_result& __result, |
| 495 | 499 | _VSTD::locale __loc, |
| 496 | 500 | __format_spec::__parsed_specifications<_CharT> __specs) { |
| 497 | const auto& __np = use_facet<numpunct<_CharT>>(__loc); | |
| 501 | const auto& __np = std::use_facet<numpunct<_CharT>>(__loc); | |
| 498 | 502 | string __grouping = __np.grouping(); |
| 499 | 503 | char* __first = __result.__integral; |
| 500 | 504 | // When no radix point or exponent are present __last will be __result.__last. |
| ... | ... | @@ -528,13 +532,13 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form( |
| 528 | 532 | // sign and (zero padding or alignment) |
| 529 | 533 | if (__zero_padding && __first != __buffer.begin()) |
| 530 | 534 | *__out_it++ = *__buffer.begin(); |
| 531 | __out_it = _VSTD::fill_n(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_); | |
| 535 | __out_it = __formatter::__fill(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_); | |
| 532 | 536 | if (!__zero_padding && __first != __buffer.begin()) |
| 533 | 537 | *__out_it++ = *__buffer.begin(); |
| 534 | 538 | |
| 535 | 539 | // integral part |
| 536 | 540 | if (__grouping.empty()) { |
| 537 | __out_it = _VSTD::copy_n(__first, __digits, _VSTD::move(__out_it)); | |
| 541 | __out_it = __formatter::__copy(__first, __digits, _VSTD::move(__out_it)); | |
| 538 | 542 | } else { |
| 539 | 543 | auto __r = __grouping.rbegin(); |
| 540 | 544 | auto __e = __grouping.rend() - 1; |
| ... | ... | @@ -546,7 +550,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form( |
| 546 | 550 | // This loop achieves that process by testing the termination condition |
| 547 | 551 | // midway in the loop. |
| 548 | 552 | while (true) { |
| 549 | __out_it = _VSTD::copy_n(__first, *__r, _VSTD::move(__out_it)); | |
| 553 | __out_it = __formatter::__copy(__first, *__r, _VSTD::move(__out_it)); | |
| 550 | 554 | __first += *__r; |
| 551 | 555 | |
| 552 | 556 | if (__r == __e) |
| ... | ... | @@ -560,16 +564,16 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form( |
| 560 | 564 | // fractional part |
| 561 | 565 | if (__result.__radix_point != __result.__last) { |
| 562 | 566 | *__out_it++ = __np.decimal_point(); |
| 563 | __out_it = _VSTD::copy(__result.__radix_point + 1, __result.__exponent, _VSTD::move(__out_it)); | |
| 564 | __out_it = _VSTD::fill_n(_VSTD::move(__out_it), __buffer.__num_trailing_zeros(), _CharT('0')); | |
| 567 | __out_it = __formatter::__copy(__result.__radix_point + 1, __result.__exponent, _VSTD::move(__out_it)); | |
| 568 | __out_it = __formatter::__fill(_VSTD::move(__out_it), __buffer.__num_trailing_zeros(), _CharT('0')); | |
| 565 | 569 | } |
| 566 | 570 | |
| 567 | 571 | // exponent |
| 568 | 572 | if (__result.__exponent != __result.__last) |
| 569 | __out_it = _VSTD::copy(__result.__exponent, __result.__last, _VSTD::move(__out_it)); | |
| 573 | __out_it = __formatter::__copy(__result.__exponent, __result.__last, _VSTD::move(__out_it)); | |
| 570 | 574 | |
| 571 | 575 | // alignment |
| 572 | return _VSTD::fill_n(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_); | |
| 576 | return __formatter::__fill(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_); | |
| 573 | 577 | } |
| 574 | 578 | # endif // _LIBCPP_HAS_NO_LOCALIZATION |
| 575 | 579 | |
| ... | ... | @@ -625,20 +629,51 @@ __format_floating_point(_Tp __value, auto& __ctx, __format_spec::__parsed_specif |
| 625 | 629 | __float_result __result = __formatter::__format_buffer( |
| 626 | 630 | __buffer, __value, __negative, (__specs.__has_precision()), __specs.__std_.__sign_, __specs.__std_.__type_); |
| 627 | 631 | |
| 628 | if (__specs.__std_.__alternate_form_ && __result.__radix_point == __result.__last) { | |
| 629 | *__result.__last++ = '.'; | |
| 630 | ||
| 631 | // When there is an exponent the point needs to be moved before the | |
| 632 | // exponent. When there's no exponent the rotate does nothing. Since | |
| 633 | // rotate tests whether the operation is a nop, call it unconditionally. | |
| 634 | _VSTD::rotate(__result.__exponent, __result.__last - 1, __result.__last); | |
| 635 | __result.__radix_point = __result.__exponent; | |
| 632 | if (__specs.__std_.__alternate_form_) { | |
| 633 | if (__result.__radix_point == __result.__last) { | |
| 634 | *__result.__last++ = '.'; | |
| 635 | ||
| 636 | // When there is an exponent the point needs to be moved before the | |
| 637 | // exponent. When there's no exponent the rotate does nothing. Since | |
| 638 | // rotate tests whether the operation is a nop, call it unconditionally. | |
| 639 | _VSTD::rotate(__result.__exponent, __result.__last - 1, __result.__last); | |
| 640 | __result.__radix_point = __result.__exponent; | |
| 641 | ||
| 642 | // The radix point is always placed before the exponent. | |
| 643 | // - No exponent needs to point to the new last. | |
| 644 | // - An exponent needs to move one position to the right. | |
| 645 | // So it's safe to increment the value unconditionally. | |
| 646 | ++__result.__exponent; | |
| 647 | } | |
| 636 | 648 | |
| 637 | // The radix point is always placed before the exponent. | |
| 638 | // - No exponent needs to point to the new last. | |
| 639 | // - An exponent needs to move one position to the right. | |
| 640 | // So it's safe to increment the value unconditionally. | |
| 641 | ++__result.__exponent; | |
| 649 | // [format.string.std]/6 | |
| 650 | // In addition, for g and G conversions, trailing zeros are not removed | |
| 651 | // from the result. | |
| 652 | // | |
| 653 | // If the type option for a floating-point type is none it may use the | |
| 654 | // general formatting, but it's not a g or G conversion. So in that case | |
| 655 | // the formatting should not append trailing zeros. | |
| 656 | bool __is_general = __specs.__std_.__type_ == __format_spec::__type::__general_lower_case || | |
| 657 | __specs.__std_.__type_ == __format_spec::__type::__general_upper_case; | |
| 658 | ||
| 659 | if (__is_general) { | |
| 660 | // https://en.cppreference.com/w/c/io/fprintf | |
| 661 | // Let P equal the precision if nonzero, 6 if the precision is not | |
| 662 | // specified, or 1 if the precision is 0. Then, if a conversion with | |
| 663 | // style E would have an exponent of X: | |
| 664 | int __p = _VSTD::max(1, (__specs.__has_precision() ? __specs.__precision_ : 6)); | |
| 665 | if (__result.__exponent == __result.__last) | |
| 666 | // if P > X >= -4, the conversion is with style f or F and precision P - 1 - X. | |
| 667 | // By including the radix point it calculates P - (1 + X) | |
| 668 | __p -= __result.__radix_point - __buffer.begin(); | |
| 669 | else | |
| 670 | // otherwise, the conversion is with style e or E and precision P - 1. | |
| 671 | --__p; | |
| 672 | ||
| 673 | ptrdiff_t __precision = (__result.__exponent - __result.__radix_point) - 1; | |
| 674 | if (__precision < __p) | |
| 675 | __buffer.__add_trailing_zeros(__p - __precision); | |
| 676 | } | |
| 642 | 677 | } |
| 643 | 678 | |
| 644 | 679 | # ifndef _LIBCPP_HAS_NO_LOCALIZATION |
| ... | ... | @@ -651,14 +686,15 @@ __format_floating_point(_Tp __value, auto& __ctx, __format_spec::__parsed_specif |
| 651 | 686 | if (__size + __num_trailing_zeros >= __specs.__width_) { |
| 652 | 687 | if (__num_trailing_zeros && __result.__exponent != __result.__last) |
| 653 | 688 | // Insert trailing zeros before exponent character. |
| 654 | return _VSTD::copy( | |
| 689 | return __formatter::__copy( | |
| 655 | 690 | __result.__exponent, |
| 656 | 691 | __result.__last, |
| 657 | _VSTD::fill_n( | |
| 658 | _VSTD::copy(__buffer.begin(), __result.__exponent, __ctx.out()), __num_trailing_zeros, _CharT('0'))); | |
| 692 | __formatter::__fill(__formatter::__copy(__buffer.begin(), __result.__exponent, __ctx.out()), | |
| 693 | __num_trailing_zeros, | |
| 694 | _CharT('0'))); | |
| 659 | 695 | |
| 660 | return _VSTD::fill_n( | |
| 661 | _VSTD::copy(__buffer.begin(), __result.__last, __ctx.out()), __num_trailing_zeros, _CharT('0')); | |
| 696 | return __formatter::__fill( | |
| 697 | __formatter::__copy(__buffer.begin(), __result.__last, __ctx.out()), __num_trailing_zeros, _CharT('0')); | |
| 662 | 698 | } |
| 663 | 699 | |
| 664 | 700 | auto __out_it = __ctx.out(); |
| ... | ... | @@ -684,7 +720,7 @@ __format_floating_point(_Tp __value, auto& __ctx, __format_spec::__parsed_specif |
| 684 | 720 | |
| 685 | 721 | } // namespace __formatter |
| 686 | 722 | |
| 687 | template <__formatter::__char_type _CharT> | |
| 723 | template <__fmt_char_type _CharT> | |
| 688 | 724 | struct _LIBCPP_TEMPLATE_VIS __formatter_floating_point { |
| 689 | 725 | public: |
| 690 | 726 | _LIBCPP_HIDE_FROM_ABI constexpr auto |
| ... | ... | @@ -702,13 +738,13 @@ public: |
| 702 | 738 | __format_spec::__parser<_CharT> __parser_; |
| 703 | 739 | }; |
| 704 | 740 | |
| 705 | template <__formatter::__char_type _CharT> | |
| 741 | template <__fmt_char_type _CharT> | |
| 706 | 742 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<float, _CharT> |
| 707 | 743 | : public __formatter_floating_point<_CharT> {}; |
| 708 | template <__formatter::__char_type _CharT> | |
| 744 | template <__fmt_char_type _CharT> | |
| 709 | 745 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<double, _CharT> |
| 710 | 746 | : public __formatter_floating_point<_CharT> {}; |
| 711 | template <__formatter::__char_type _CharT> | |
| 747 | template <__fmt_char_type _CharT> | |
| 712 | 748 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<long double, _CharT> |
| 713 | 749 | : public __formatter_floating_point<_CharT> {}; |
| 714 | 750 |
lib/libcxx/include/__format/formatter_integer.h+14-14| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | #include <__availability> |
| 14 | 14 | #include <__concepts/arithmetic.h> |
| 15 | 15 | #include <__config> |
| 16 | #include <__format/format_fwd.h> | |
| 16 | #include <__format/concepts.h> | |
| 17 | 17 | #include <__format/format_parse_context.h> |
| 18 | 18 | #include <__format/formatter.h> |
| 19 | 19 | #include <__format/formatter_integral.h> |
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | |
| 31 | 31 | #if _LIBCPP_STD_VER > 17 |
| 32 | 32 | |
| 33 | template <__formatter::__char_type _CharT> | |
| 33 | template <__fmt_char_type _CharT> | |
| 34 | 34 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatter_integer { |
| 35 | 35 | |
| 36 | 36 | public: |
| ... | ... | @@ -59,43 +59,43 @@ public: |
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | 61 | // Signed integral types. |
| 62 | template <__formatter::__char_type _CharT> | |
| 62 | template <__fmt_char_type _CharT> | |
| 63 | 63 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<signed char, _CharT> |
| 64 | 64 | : public __formatter_integer<_CharT> {}; |
| 65 | template <__formatter::__char_type _CharT> | |
| 65 | template <__fmt_char_type _CharT> | |
| 66 | 66 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<short, _CharT> : public __formatter_integer<_CharT> { |
| 67 | 67 | }; |
| 68 | template <__formatter::__char_type _CharT> | |
| 68 | template <__fmt_char_type _CharT> | |
| 69 | 69 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<int, _CharT> : public __formatter_integer<_CharT> {}; |
| 70 | template <__formatter::__char_type _CharT> | |
| 70 | template <__fmt_char_type _CharT> | |
| 71 | 71 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<long, _CharT> : public __formatter_integer<_CharT> {}; |
| 72 | template <__formatter::__char_type _CharT> | |
| 72 | template <__fmt_char_type _CharT> | |
| 73 | 73 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<long long, _CharT> |
| 74 | 74 | : public __formatter_integer<_CharT> {}; |
| 75 | 75 | # ifndef _LIBCPP_HAS_NO_INT128 |
| 76 | template <__formatter::__char_type _CharT> | |
| 76 | template <__fmt_char_type _CharT> | |
| 77 | 77 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<__int128_t, _CharT> |
| 78 | 78 | : public __formatter_integer<_CharT> {}; |
| 79 | 79 | # endif |
| 80 | 80 | |
| 81 | 81 | // Unsigned integral types. |
| 82 | template <__formatter::__char_type _CharT> | |
| 82 | template <__fmt_char_type _CharT> | |
| 83 | 83 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<unsigned char, _CharT> |
| 84 | 84 | : public __formatter_integer<_CharT> {}; |
| 85 | template <__formatter::__char_type _CharT> | |
| 85 | template <__fmt_char_type _CharT> | |
| 86 | 86 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<unsigned short, _CharT> |
| 87 | 87 | : public __formatter_integer<_CharT> {}; |
| 88 | template <__formatter::__char_type _CharT> | |
| 88 | template <__fmt_char_type _CharT> | |
| 89 | 89 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<unsigned, _CharT> |
| 90 | 90 | : public __formatter_integer<_CharT> {}; |
| 91 | template <__formatter::__char_type _CharT> | |
| 91 | template <__fmt_char_type _CharT> | |
| 92 | 92 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<unsigned long, _CharT> |
| 93 | 93 | : public __formatter_integer<_CharT> {}; |
| 94 | template <__formatter::__char_type _CharT> | |
| 94 | template <__fmt_char_type _CharT> | |
| 95 | 95 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<unsigned long long, _CharT> |
| 96 | 96 | : public __formatter_integer<_CharT> {}; |
| 97 | 97 | # ifndef _LIBCPP_HAS_NO_INT128 |
| 98 | template <__formatter::__char_type _CharT> | |
| 98 | template <__fmt_char_type _CharT> | |
| 99 | 99 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<__uint128_t, _CharT> |
| 100 | 100 | : public __formatter_integer<_CharT> {}; |
| 101 | 101 | # endif |
lib/libcxx/include/__format/formatter_integral.h+7-6| ... | ... | @@ -13,11 +13,12 @@ |
| 13 | 13 | #include <__concepts/arithmetic.h> |
| 14 | 14 | #include <__concepts/same_as.h> |
| 15 | 15 | #include <__config> |
| 16 | #include <__format/concepts.h> | |
| 16 | 17 | #include <__format/format_error.h> |
| 17 | #include <__format/formatter.h> // for __char_type TODO FMT Move the concept? | |
| 18 | 18 | #include <__format/formatter_output.h> |
| 19 | 19 | #include <__format/parser_std_format_spec.h> |
| 20 | 20 | #include <__utility/unreachable.h> |
| 21 | #include <array> | |
| 21 | 22 | #include <charconv> |
| 22 | 23 | #include <limits> |
| 23 | 24 | #include <string> |
| ... | ... | @@ -112,7 +113,7 @@ _LIBCPP_HIDE_FROM_ABI inline string __determine_grouping(ptrdiff_t __size, const |
| 112 | 113 | // Char |
| 113 | 114 | // |
| 114 | 115 | |
| 115 | template <__formatter::__char_type _CharT> | |
| 116 | template <__fmt_char_type _CharT> | |
| 116 | 117 | _LIBCPP_HIDE_FROM_ABI auto __format_char( |
| 117 | 118 | integral auto __value, |
| 118 | 119 | output_iterator<const _CharT&> auto __out_it, |
| ... | ... | @@ -216,7 +217,7 @@ _LIBCPP_HIDE_FROM_ABI auto __format_integer( |
| 216 | 217 | |
| 217 | 218 | # ifndef _LIBCPP_HAS_NO_LOCALIZATION |
| 218 | 219 | if (__specs.__std_.__locale_specific_form_) { |
| 219 | const auto& __np = use_facet<numpunct<_CharT>>(__ctx.locale()); | |
| 220 | const auto& __np = std::use_facet<numpunct<_CharT>>(__ctx.locale()); | |
| 220 | 221 | string __grouping = __np.grouping(); |
| 221 | 222 | ptrdiff_t __size = __last - __first; |
| 222 | 223 | // Writing the grouped form has more overhead than the normal output |
| ... | ... | @@ -243,7 +244,7 @@ _LIBCPP_HIDE_FROM_ABI auto __format_integer( |
| 243 | 244 | // The zero padding is done like: |
| 244 | 245 | // - Write [sign][prefix] |
| 245 | 246 | // - Write data right aligned with '0' as fill character. |
| 246 | __out_it = _VSTD::copy(__begin, __first, _VSTD::move(__out_it)); | |
| 247 | __out_it = __formatter::__copy(__begin, __first, _VSTD::move(__out_it)); | |
| 247 | 248 | __specs.__alignment_ = __format_spec::__alignment::__right; |
| 248 | 249 | __specs.__fill_ = _CharT('0'); |
| 249 | 250 | int32_t __size = __first - __begin; |
| ... | ... | @@ -309,7 +310,7 @@ __format_integer(_Tp __value, auto& __ctx, __format_spec::__parsed_specification |
| 309 | 310 | auto __r = std::__to_unsigned_like(__value); |
| 310 | 311 | bool __negative = __value < 0; |
| 311 | 312 | if (__negative) |
| 312 | __r = __complement(__r); | |
| 313 | __r = std::__complement(__r); | |
| 313 | 314 | |
| 314 | 315 | return __formatter::__format_integer(__r, __ctx, __specs, __negative); |
| 315 | 316 | } |
| ... | ... | @@ -341,7 +342,7 @@ __format_bool(bool __value, auto& __ctx, __format_spec::__parsed_specifications< |
| 341 | 342 | -> decltype(__ctx.out()) { |
| 342 | 343 | # ifndef _LIBCPP_HAS_NO_LOCALIZATION |
| 343 | 344 | if (__specs.__std_.__locale_specific_form_) { |
| 344 | const auto& __np = use_facet<numpunct<_CharT>>(__ctx.locale()); | |
| 345 | const auto& __np = std::use_facet<numpunct<_CharT>>(__ctx.locale()); | |
| 345 | 346 | basic_string<_CharT> __str = __value ? __np.truename() : __np.falsename(); |
| 346 | 347 | return __formatter::__write_string_no_precision(basic_string_view<_CharT>{__str}, __ctx.out(), __specs); |
| 347 | 348 | } |
lib/libcxx/include/__format/formatter_output.h+308-46| ... | ... | @@ -10,16 +10,23 @@ |
| 10 | 10 | #ifndef _LIBCPP___FORMAT_FORMATTER_OUTPUT_H |
| 11 | 11 | #define _LIBCPP___FORMAT_FORMATTER_OUTPUT_H |
| 12 | 12 | |
| 13 | #include <__algorithm/copy.h> | |
| 14 | #include <__algorithm/copy_n.h> | |
| 15 | #include <__algorithm/fill_n.h> | |
| 16 | #include <__algorithm/transform.h> | |
| 13 | #include <__algorithm/ranges_copy.h> | |
| 14 | #include <__algorithm/ranges_fill_n.h> | |
| 15 | #include <__algorithm/ranges_transform.h> | |
| 16 | #include <__chrono/statically_widen.h> | |
| 17 | #include <__concepts/same_as.h> | |
| 17 | 18 | #include <__config> |
| 19 | #include <__format/buffer.h> | |
| 20 | #include <__format/concepts.h> | |
| 21 | #include <__format/escaped_output_table.h> | |
| 18 | 22 | #include <__format/formatter.h> |
| 19 | 23 | #include <__format/parser_std_format_spec.h> |
| 20 | 24 | #include <__format/unicode.h> |
| 25 | #include <__iterator/back_insert_iterator.h> | |
| 26 | #include <__type_traits/make_unsigned.h> | |
| 21 | 27 | #include <__utility/move.h> |
| 22 | 28 | #include <__utility/unreachable.h> |
| 29 | #include <charconv> | |
| 23 | 30 | #include <cstddef> |
| 24 | 31 | #include <string> |
| 25 | 32 | #include <string_view> |
| ... | ... | @@ -86,6 +93,74 @@ __padding_size(size_t __size, size_t __width, __format_spec::__alignment __align |
| 86 | 93 | __libcpp_unreachable(); |
| 87 | 94 | } |
| 88 | 95 | |
| 96 | /// Copy wrapper. | |
| 97 | /// | |
| 98 | /// This uses a "mass output function" of __format::__output_buffer when possible. | |
| 99 | template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT> | |
| 100 | _LIBCPP_HIDE_FROM_ABI auto __copy(basic_string_view<_CharT> __str, output_iterator<const _OutCharT&> auto __out_it) | |
| 101 | -> decltype(__out_it) { | |
| 102 | if constexpr (_VSTD::same_as<decltype(__out_it), _VSTD::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) { | |
| 103 | __out_it.__get_container()->__copy(__str); | |
| 104 | return __out_it; | |
| 105 | } else if constexpr (_VSTD::same_as<decltype(__out_it), | |
| 106 | typename __format::__retarget_buffer<_OutCharT>::__iterator>) { | |
| 107 | __out_it.__buffer_->__copy(__str); | |
| 108 | return __out_it; | |
| 109 | } else { | |
| 110 | return std::ranges::copy(__str, _VSTD::move(__out_it)).out; | |
| 111 | } | |
| 112 | } | |
| 113 | ||
| 114 | template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT> | |
| 115 | _LIBCPP_HIDE_FROM_ABI auto | |
| 116 | __copy(const _CharT* __first, const _CharT* __last, output_iterator<const _OutCharT&> auto __out_it) | |
| 117 | -> decltype(__out_it) { | |
| 118 | return __formatter::__copy(basic_string_view{__first, __last}, _VSTD::move(__out_it)); | |
| 119 | } | |
| 120 | ||
| 121 | template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT> | |
| 122 | _LIBCPP_HIDE_FROM_ABI auto __copy(const _CharT* __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it) | |
| 123 | -> decltype(__out_it) { | |
| 124 | return __formatter::__copy(basic_string_view{__first, __n}, _VSTD::move(__out_it)); | |
| 125 | } | |
| 126 | ||
| 127 | /// Transform wrapper. | |
| 128 | /// | |
| 129 | /// This uses a "mass output function" of __format::__output_buffer when possible. | |
| 130 | template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT, class _UnaryOperation> | |
| 131 | _LIBCPP_HIDE_FROM_ABI auto | |
| 132 | __transform(const _CharT* __first, | |
| 133 | const _CharT* __last, | |
| 134 | output_iterator<const _OutCharT&> auto __out_it, | |
| 135 | _UnaryOperation __operation) -> decltype(__out_it) { | |
| 136 | if constexpr (_VSTD::same_as<decltype(__out_it), _VSTD::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) { | |
| 137 | __out_it.__get_container()->__transform(__first, __last, _VSTD::move(__operation)); | |
| 138 | return __out_it; | |
| 139 | } else if constexpr (_VSTD::same_as<decltype(__out_it), | |
| 140 | typename __format::__retarget_buffer<_OutCharT>::__iterator>) { | |
| 141 | __out_it.__buffer_->__transform(__first, __last, _VSTD::move(__operation)); | |
| 142 | return __out_it; | |
| 143 | } else { | |
| 144 | return std::ranges::transform(__first, __last, _VSTD::move(__out_it), __operation).out; | |
| 145 | } | |
| 146 | } | |
| 147 | ||
| 148 | /// Fill wrapper. | |
| 149 | /// | |
| 150 | /// This uses a "mass output function" of __format::__output_buffer when possible. | |
| 151 | template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt> | |
| 152 | _LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, _CharT __value) { | |
| 153 | if constexpr (_VSTD::same_as<decltype(__out_it), _VSTD::back_insert_iterator<__format::__output_buffer<_CharT>>>) { | |
| 154 | __out_it.__get_container()->__fill(__n, __value); | |
| 155 | return __out_it; | |
| 156 | } else if constexpr (_VSTD::same_as<decltype(__out_it), typename __format::__retarget_buffer<_CharT>::__iterator>) { | |
| 157 | __out_it.__buffer_->__fill(__n, __value); | |
| 158 | return __out_it; | |
| 159 | } else { | |
| 160 | return std::ranges::fill_n(_VSTD::move(__out_it), __n, __value); | |
| 161 | } | |
| 162 | } | |
| 163 | ||
| 89 | 164 | template <class _OutIt, class _CharT> |
| 90 | 165 | _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, const char* __begin, const char* __first, |
| 91 | 166 | const char* __last, string&& __grouping, _CharT __sep, |
| ... | ... | @@ -97,22 +172,22 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c |
| 97 | 172 | __padding_size_result __padding = {0, 0}; |
| 98 | 173 | if (__specs.__alignment_ == __format_spec::__alignment::__zero_padding) { |
| 99 | 174 | // Write [sign][prefix]. |
| 100 | __out_it = _VSTD::copy(__begin, __first, _VSTD::move(__out_it)); | |
| 175 | __out_it = __formatter::__copy(__begin, __first, _VSTD::move(__out_it)); | |
| 101 | 176 | |
| 102 | 177 | if (__specs.__width_ > __size) { |
| 103 | 178 | // Write zero padding. |
| 104 | 179 | __padding.__before_ = __specs.__width_ - __size; |
| 105 | __out_it = _VSTD::fill_n(_VSTD::move(__out_it), __specs.__width_ - __size, _CharT('0')); | |
| 180 | __out_it = __formatter::__fill(_VSTD::move(__out_it), __specs.__width_ - __size, _CharT('0')); | |
| 106 | 181 | } |
| 107 | 182 | } else { |
| 108 | 183 | if (__specs.__width_ > __size) { |
| 109 | 184 | // Determine padding and write padding. |
| 110 | __padding = __padding_size(__size, __specs.__width_, __specs.__alignment_); | |
| 185 | __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__alignment_); | |
| 111 | 186 | |
| 112 | __out_it = _VSTD::fill_n(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_); | |
| 187 | __out_it = __formatter::__fill(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_); | |
| 113 | 188 | } |
| 114 | 189 | // Write [sign][prefix]. |
| 115 | __out_it = _VSTD::copy(__begin, __first, _VSTD::move(__out_it)); | |
| 190 | __out_it = __formatter::__copy(__begin, __first, _VSTD::move(__out_it)); | |
| 116 | 191 | } |
| 117 | 192 | |
| 118 | 193 | auto __r = __grouping.rbegin(); |
| ... | ... | @@ -133,10 +208,10 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c |
| 133 | 208 | while (true) { |
| 134 | 209 | if (__specs.__std_.__type_ == __format_spec::__type::__hexadecimal_upper_case) { |
| 135 | 210 | __last = __first + *__r; |
| 136 | __out_it = _VSTD::transform(__first, __last, _VSTD::move(__out_it), __hex_to_upper); | |
| 211 | __out_it = __formatter::__transform(__first, __last, _VSTD::move(__out_it), __hex_to_upper); | |
| 137 | 212 | __first = __last; |
| 138 | 213 | } else { |
| 139 | __out_it = _VSTD::copy_n(__first, *__r, _VSTD::move(__out_it)); | |
| 214 | __out_it = __formatter::__copy(__first, *__r, _VSTD::move(__out_it)); | |
| 140 | 215 | __first += *__r; |
| 141 | 216 | } |
| 142 | 217 | |
| ... | ... | @@ -147,7 +222,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c |
| 147 | 222 | *__out_it++ = __sep; |
| 148 | 223 | } |
| 149 | 224 | |
| 150 | return _VSTD::fill_n(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_); | |
| 225 | return __formatter::__fill(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_); | |
| 151 | 226 | } |
| 152 | 227 | |
| 153 | 228 | /// Writes the input to the output with the required padding. |
| ... | ... | @@ -155,12 +230,10 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c |
| 155 | 230 | /// Since the output column width is specified the function can be used for |
| 156 | 231 | /// ASCII and Unicode output. |
| 157 | 232 | /// |
| 158 | /// \pre [\a __first, \a __last) is a valid range. | |
| 159 | 233 | /// \pre \a __size <= \a __width. Using this function when this pre-condition |
| 160 | 234 | /// doesn't hold incurs an unwanted overhead. |
| 161 | 235 | /// |
| 162 | /// \param __first Pointer to the first element to write. | |
| 163 | /// \param __last Pointer beyond the last element to write. | |
| 236 | /// \param __str The string to write. | |
| 164 | 237 | /// \param __out_it The output iterator to write to. |
| 165 | 238 | /// \param __specs The parsed formatting specifications. |
| 166 | 239 | /// \param __size The (estimated) output column width. When the elements |
| ... | ... | @@ -174,31 +247,42 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c |
| 174 | 247 | /// conversion, which means the [\a __first, \a __last) always contains elements |
| 175 | 248 | /// of the type \c char. |
| 176 | 249 | template <class _CharT, class _ParserCharT> |
| 177 | _LIBCPP_HIDE_FROM_ABI auto __write( | |
| 178 | const _CharT* __first, | |
| 179 | const _CharT* __last, | |
| 180 | output_iterator<const _CharT&> auto __out_it, | |
| 181 | __format_spec::__parsed_specifications<_ParserCharT> __specs, | |
| 182 | ptrdiff_t __size) -> decltype(__out_it) { | |
| 183 | _LIBCPP_ASSERT(__first <= __last, "Not a valid range"); | |
| 184 | ||
| 250 | _LIBCPP_HIDE_FROM_ABI auto | |
| 251 | __write(basic_string_view<_CharT> __str, | |
| 252 | output_iterator<const _CharT&> auto __out_it, | |
| 253 | __format_spec::__parsed_specifications<_ParserCharT> __specs, | |
| 254 | ptrdiff_t __size) -> decltype(__out_it) { | |
| 185 | 255 | if (__size >= __specs.__width_) |
| 186 | return _VSTD::copy(__first, __last, _VSTD::move(__out_it)); | |
| 256 | return __formatter::__copy(__str, _VSTD::move(__out_it)); | |
| 187 | 257 | |
| 188 | 258 | __padding_size_result __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__std_.__alignment_); |
| 189 | __out_it = _VSTD::fill_n(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_); | |
| 190 | __out_it = _VSTD::copy(__first, __last, _VSTD::move(__out_it)); | |
| 191 | return _VSTD::fill_n(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_); | |
| 259 | __out_it = __formatter::__fill(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_); | |
| 260 | __out_it = __formatter::__copy(__str, _VSTD::move(__out_it)); | |
| 261 | return __formatter::__fill(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_); | |
| 262 | } | |
| 263 | ||
| 264 | template <class _CharT, class _ParserCharT> | |
| 265 | _LIBCPP_HIDE_FROM_ABI auto | |
| 266 | __write(const _CharT* __first, | |
| 267 | const _CharT* __last, | |
| 268 | output_iterator<const _CharT&> auto __out_it, | |
| 269 | __format_spec::__parsed_specifications<_ParserCharT> __specs, | |
| 270 | ptrdiff_t __size) -> decltype(__out_it) { | |
| 271 | _LIBCPP_ASSERT(__first <= __last, "Not a valid range"); | |
| 272 | return __formatter::__write(basic_string_view{__first, __last}, _VSTD::move(__out_it), __specs, __size); | |
| 192 | 273 | } |
| 193 | 274 | |
| 194 | 275 | /// \overload |
| 195 | 276 | /// |
| 196 | 277 | /// Calls the function above where \a __size = \a __last - \a __first. |
| 197 | 278 | template <class _CharT, class _ParserCharT> |
| 198 | _LIBCPP_HIDE_FROM_ABI auto __write(const _CharT* __first, const _CharT* __last, | |
| 199 | output_iterator<const _CharT&> auto __out_it, | |
| 200 | __format_spec::__parsed_specifications<_ParserCharT> __specs) -> decltype(__out_it) { | |
| 201 | return __write(__first, __last, _VSTD::move(__out_it), __specs, __last - __first); | |
| 279 | _LIBCPP_HIDE_FROM_ABI auto | |
| 280 | __write(const _CharT* __first, | |
| 281 | const _CharT* __last, | |
| 282 | output_iterator<const _CharT&> auto __out_it, | |
| 283 | __format_spec::__parsed_specifications<_ParserCharT> __specs) -> decltype(__out_it) { | |
| 284 | _LIBCPP_ASSERT(__first <= __last, "Not a valid range"); | |
| 285 | return __formatter::__write(__first, __last, _VSTD::move(__out_it), __specs, __last - __first); | |
| 202 | 286 | } |
| 203 | 287 | |
| 204 | 288 | template <class _CharT, class _ParserCharT, class _UnaryOperation> |
| ... | ... | @@ -210,12 +294,12 @@ _LIBCPP_HIDE_FROM_ABI auto __write_transformed(const _CharT* __first, const _Cha |
| 210 | 294 | |
| 211 | 295 | ptrdiff_t __size = __last - __first; |
| 212 | 296 | if (__size >= __specs.__width_) |
| 213 | return _VSTD::transform(__first, __last, _VSTD::move(__out_it), __op); | |
| 297 | return __formatter::__transform(__first, __last, _VSTD::move(__out_it), __op); | |
| 214 | 298 | |
| 215 | __padding_size_result __padding = __padding_size(__size, __specs.__width_, __specs.__alignment_); | |
| 216 | __out_it = _VSTD::fill_n(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_); | |
| 217 | __out_it = _VSTD::transform(__first, __last, _VSTD::move(__out_it), __op); | |
| 218 | return _VSTD::fill_n(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_); | |
| 299 | __padding_size_result __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__alignment_); | |
| 300 | __out_it = __formatter::__fill(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_); | |
| 301 | __out_it = __formatter::__transform(__first, __last, _VSTD::move(__out_it), __op); | |
| 302 | return __formatter::__fill(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_); | |
| 219 | 303 | } |
| 220 | 304 | |
| 221 | 305 | /// Writes additional zero's for the precision before the exponent. |
| ... | ... | @@ -239,12 +323,12 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros( |
| 239 | 323 | _LIBCPP_ASSERT(__num_trailing_zeros > 0, "The overload not writing trailing zeros should have been used"); |
| 240 | 324 | |
| 241 | 325 | __padding_size_result __padding = |
| 242 | __padding_size(__size + __num_trailing_zeros, __specs.__width_, __specs.__alignment_); | |
| 243 | __out_it = _VSTD::fill_n(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_); | |
| 244 | __out_it = _VSTD::copy(__first, __exponent, _VSTD::move(__out_it)); | |
| 245 | __out_it = _VSTD::fill_n(_VSTD::move(__out_it), __num_trailing_zeros, _CharT('0')); | |
| 246 | __out_it = _VSTD::copy(__exponent, __last, _VSTD::move(__out_it)); | |
| 247 | return _VSTD::fill_n(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_); | |
| 326 | __formatter::__padding_size(__size + __num_trailing_zeros, __specs.__width_, __specs.__alignment_); | |
| 327 | __out_it = __formatter::__fill(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_); | |
| 328 | __out_it = __formatter::__copy(__first, __exponent, _VSTD::move(__out_it)); | |
| 329 | __out_it = __formatter::__fill(_VSTD::move(__out_it), __num_trailing_zeros, _CharT('0')); | |
| 330 | __out_it = __formatter::__copy(__exponent, __last, _VSTD::move(__out_it)); | |
| 331 | return __formatter::__fill(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_); | |
| 248 | 332 | } |
| 249 | 333 | |
| 250 | 334 | /// Writes a string using format's width estimation algorithm. |
| ... | ... | @@ -262,7 +346,7 @@ _LIBCPP_HIDE_FROM_ABI auto __write_string_no_precision( |
| 262 | 346 | |
| 263 | 347 | // No padding -> copy the string |
| 264 | 348 | if (!__specs.__has_width()) |
| 265 | return _VSTD::copy(__str.begin(), __str.end(), _VSTD::move(__out_it)); | |
| 349 | return __formatter::__copy(__str, _VSTD::move(__out_it)); | |
| 266 | 350 | |
| 267 | 351 | // Note when the estimated width is larger than size there's no padding. So |
| 268 | 352 | // there's no reason to get the real size when the estimate is larger than or |
| ... | ... | @@ -270,8 +354,7 @@ _LIBCPP_HIDE_FROM_ABI auto __write_string_no_precision( |
| 270 | 354 | size_t __size = |
| 271 | 355 | __format_spec::__estimate_column_width(__str, __specs.__width_, __format_spec::__column_width_rounding::__up) |
| 272 | 356 | .__width_; |
| 273 | ||
| 274 | return __formatter::__write(__str.begin(), __str.end(), _VSTD::move(__out_it), __specs, __size); | |
| 357 | return __formatter::__write(__str, _VSTD::move(__out_it), __specs, __size); | |
| 275 | 358 | } |
| 276 | 359 | |
| 277 | 360 | template <class _CharT> |
| ... | ... | @@ -296,9 +379,188 @@ _LIBCPP_HIDE_FROM_ABI auto __write_string( |
| 296 | 379 | |
| 297 | 380 | int __size = __formatter::__truncate(__str, __specs.__precision_); |
| 298 | 381 | |
| 299 | return __write(__str.begin(), __str.end(), _VSTD::move(__out_it), __specs, __size); | |
| 382 | return __formatter::__write(__str.begin(), __str.end(), _VSTD::move(__out_it), __specs, __size); | |
| 383 | } | |
| 384 | ||
| 385 | # if _LIBCPP_STD_VER > 20 | |
| 386 | ||
| 387 | struct __nul_terminator {}; | |
| 388 | ||
| 389 | template <class _CharT> | |
| 390 | _LIBCPP_HIDE_FROM_ABI bool operator==(const _CharT* __cstr, __nul_terminator) { | |
| 391 | return *__cstr == _CharT('\0'); | |
| 392 | } | |
| 393 | ||
| 394 | template <class _CharT> | |
| 395 | _LIBCPP_HIDE_FROM_ABI void | |
| 396 | __write_escaped_code_unit(basic_string<_CharT>& __str, char32_t __value, const _CharT* __prefix) { | |
| 397 | back_insert_iterator __out_it{__str}; | |
| 398 | std::ranges::copy(__prefix, __nul_terminator{}, __out_it); | |
| 399 | ||
| 400 | char __buffer[8]; | |
| 401 | to_chars_result __r = std::to_chars(std::begin(__buffer), std::end(__buffer), __value, 16); | |
| 402 | _LIBCPP_ASSERT(__r.ec == errc(0), "Internal buffer too small"); | |
| 403 | std::ranges::copy(std::begin(__buffer), __r.ptr, __out_it); | |
| 404 | ||
| 405 | __str += _CharT('}'); | |
| 406 | } | |
| 407 | ||
| 408 | // [format.string.escaped]/2.2.1.2 | |
| 409 | // ... | |
| 410 | // then the sequence \u{hex-digit-sequence} is appended to E, where | |
| 411 | // hex-digit-sequence is the shortest hexadecimal representation of C using | |
| 412 | // lower-case hexadecimal digits. | |
| 413 | template <class _CharT> | |
| 414 | _LIBCPP_HIDE_FROM_ABI void __write_well_formed_escaped_code_unit(basic_string<_CharT>& __str, char32_t __value) { | |
| 415 | __formatter::__write_escaped_code_unit(__str, __value, _LIBCPP_STATICALLY_WIDEN(_CharT, "\\u{")); | |
| 416 | } | |
| 417 | ||
| 418 | // [format.string.escaped]/2.2.3 | |
| 419 | // Otherwise (X is a sequence of ill-formed code units), each code unit U is | |
| 420 | // appended to E in order as the sequence \x{hex-digit-sequence}, where | |
| 421 | // hex-digit-sequence is the shortest hexadecimal representation of U using | |
| 422 | // lower-case hexadecimal digits. | |
| 423 | template <class _CharT> | |
| 424 | _LIBCPP_HIDE_FROM_ABI void __write_escape_ill_formed_code_unit(basic_string<_CharT>& __str, char32_t __value) { | |
| 425 | __formatter::__write_escaped_code_unit(__str, __value, _LIBCPP_STATICALLY_WIDEN(_CharT, "\\x{")); | |
| 426 | } | |
| 427 | ||
| 428 | template <class _CharT> | |
| 429 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool __is_escaped_sequence_written(basic_string<_CharT>& __str, char32_t __value) { | |
| 430 | # ifdef _LIBCPP_HAS_NO_UNICODE | |
| 431 | // For ASCII assume everything above 127 is printable. | |
| 432 | if (__value > 127) | |
| 433 | return false; | |
| 434 | # endif | |
| 435 | ||
| 436 | if (!__escaped_output_table::__needs_escape(__value)) | |
| 437 | return false; | |
| 438 | ||
| 439 | __formatter::__write_well_formed_escaped_code_unit(__str, __value); | |
| 440 | return true; | |
| 441 | } | |
| 442 | ||
| 443 | template <class _CharT> | |
| 444 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr char32_t __to_char32(_CharT __value) { | |
| 445 | return static_cast<make_unsigned_t<_CharT>>(__value); | |
| 446 | } | |
| 447 | ||
| 448 | enum class _LIBCPP_ENUM_VIS __escape_quotation_mark { __apostrophe, __double_quote }; | |
| 449 | ||
| 450 | // [format.string.escaped]/2 | |
| 451 | template <class _CharT> | |
| 452 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool | |
| 453 | __is_escaped_sequence_written(basic_string<_CharT>& __str, char32_t __value, __escape_quotation_mark __mark) { | |
| 454 | // 2.2.1.1 - Mapped character in [tab:format.escape.sequences] | |
| 455 | switch (__value) { | |
| 456 | case _CharT('\t'): | |
| 457 | __str += _LIBCPP_STATICALLY_WIDEN(_CharT, "\\t"); | |
| 458 | return true; | |
| 459 | case _CharT('\n'): | |
| 460 | __str += _LIBCPP_STATICALLY_WIDEN(_CharT, "\\n"); | |
| 461 | return true; | |
| 462 | case _CharT('\r'): | |
| 463 | __str += _LIBCPP_STATICALLY_WIDEN(_CharT, "\\r"); | |
| 464 | return true; | |
| 465 | case _CharT('\''): | |
| 466 | if (__mark == __escape_quotation_mark::__apostrophe) | |
| 467 | __str += _LIBCPP_STATICALLY_WIDEN(_CharT, R"(\')"); | |
| 468 | else | |
| 469 | __str += __value; | |
| 470 | return true; | |
| 471 | case _CharT('"'): | |
| 472 | if (__mark == __escape_quotation_mark::__double_quote) | |
| 473 | __str += _LIBCPP_STATICALLY_WIDEN(_CharT, R"(\")"); | |
| 474 | else | |
| 475 | __str += __value; | |
| 476 | return true; | |
| 477 | case _CharT('\\'): | |
| 478 | __str += _LIBCPP_STATICALLY_WIDEN(_CharT, R"(\\)"); | |
| 479 | return true; | |
| 480 | ||
| 481 | // 2.2.1.2 - Space | |
| 482 | case _CharT(' '): | |
| 483 | __str += __value; | |
| 484 | return true; | |
| 485 | } | |
| 486 | ||
| 487 | // 2.2.2 | |
| 488 | // Otherwise, if X is a shift sequence, the effect on E and further | |
| 489 | // decoding of S is unspecified. | |
| 490 | // For now shift sequences are ignored and treated as Unicode. Other parts | |
| 491 | // of the format library do the same. It's unknown how ostream treats them. | |
| 492 | // TODO FMT determine what to do with shift sequences. | |
| 493 | ||
| 494 | // 2.2.1.2.1 and 2.2.1.2.2 - Escape | |
| 495 | return __formatter::__is_escaped_sequence_written(__str, __formatter::__to_char32(__value)); | |
| 300 | 496 | } |
| 301 | 497 | |
| 498 | template <class _CharT> | |
| 499 | _LIBCPP_HIDE_FROM_ABI void | |
| 500 | __escape(basic_string<_CharT>& __str, basic_string_view<_CharT> __values, __escape_quotation_mark __mark) { | |
| 501 | __unicode::__code_point_view<_CharT> __view{__values.begin(), __values.end()}; | |
| 502 | ||
| 503 | while (!__view.__at_end()) { | |
| 504 | const _CharT* __first = __view.__position(); | |
| 505 | typename __unicode::__consume_p2286_result __result = __view.__consume_p2286(); | |
| 506 | if (__result.__ill_formed_size == 0) { | |
| 507 | if (!__formatter::__is_escaped_sequence_written(__str, __result.__value, __mark)) | |
| 508 | // 2.2.1.3 - Add the character | |
| 509 | ranges::copy(__first, __view.__position(), std::back_insert_iterator(__str)); | |
| 510 | ||
| 511 | } else { | |
| 512 | // 2.2.3 sequence of ill-formed code units | |
| 513 | // The number of code-units in __result.__value depends on the character type being used. | |
| 514 | if constexpr (sizeof(_CharT) == 1) { | |
| 515 | _LIBCPP_ASSERT(__result.__ill_formed_size == 1 || __result.__ill_formed_size == 4, | |
| 516 | "illegal number of invalid code units."); | |
| 517 | if (__result.__ill_formed_size == 1) // ill-formed, one code unit | |
| 518 | __formatter::__write_escape_ill_formed_code_unit(__str, __result.__value & 0xff); | |
| 519 | else { // out of valid range, four code units | |
| 520 | // The code point was properly encoded, decode the value. | |
| 521 | __formatter::__write_escape_ill_formed_code_unit(__str, __result.__value >> 18 | 0xf0); | |
| 522 | __formatter::__write_escape_ill_formed_code_unit(__str, (__result.__value >> 12 & 0x3f) | 0x80); | |
| 523 | __formatter::__write_escape_ill_formed_code_unit(__str, (__result.__value >> 6 & 0x3f) | 0x80); | |
| 524 | __formatter::__write_escape_ill_formed_code_unit(__str, (__result.__value & 0x3f) | 0x80); | |
| 525 | } | |
| 526 | } else if constexpr (sizeof(_CharT) == 2) { | |
| 527 | _LIBCPP_ASSERT(__result.__ill_formed_size == 1, "for UTF-16 at most one invalid code unit"); | |
| 528 | __formatter::__write_escape_ill_formed_code_unit(__str, __result.__value & 0xffff); | |
| 529 | } else { | |
| 530 | static_assert(sizeof(_CharT) == 4, "unsupported character width"); | |
| 531 | _LIBCPP_ASSERT(__result.__ill_formed_size == 1, "for UTF-32 one code unit is one code point"); | |
| 532 | __formatter::__write_escape_ill_formed_code_unit(__str, __result.__value); | |
| 533 | } | |
| 534 | } | |
| 535 | } | |
| 536 | } | |
| 537 | ||
| 538 | template <class _CharT> | |
| 539 | _LIBCPP_HIDE_FROM_ABI auto | |
| 540 | __format_escaped_char(_CharT __value, | |
| 541 | output_iterator<const _CharT&> auto __out_it, | |
| 542 | __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) { | |
| 543 | basic_string<_CharT> __str; | |
| 544 | __str += _CharT('\''); | |
| 545 | __formatter::__escape(__str, basic_string_view{std::addressof(__value), 1}, __escape_quotation_mark::__apostrophe); | |
| 546 | __str += _CharT('\''); | |
| 547 | return __formatter::__write(__str.data(), __str.data() + __str.size(), _VSTD::move(__out_it), __specs, __str.size()); | |
| 548 | } | |
| 549 | ||
| 550 | template <class _CharT> | |
| 551 | _LIBCPP_HIDE_FROM_ABI auto | |
| 552 | __format_escaped_string(basic_string_view<_CharT> __values, | |
| 553 | output_iterator<const _CharT&> auto __out_it, | |
| 554 | __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) { | |
| 555 | basic_string<_CharT> __str; | |
| 556 | __str += _CharT('"'); | |
| 557 | __formatter::__escape(__str, __values, __escape_quotation_mark::__double_quote); | |
| 558 | __str += _CharT('"'); | |
| 559 | return __formatter::__write_string(basic_string_view{__str}, _VSTD::move(__out_it), __specs); | |
| 560 | } | |
| 561 | ||
| 562 | # endif // _LIBCPP_STD_VER > 20 | |
| 563 | ||
| 302 | 564 | } // namespace __formatter |
| 303 | 565 | |
| 304 | 566 | #endif //_LIBCPP_STD_VER > 17 |
lib/libcxx/include/__format/formatter_pointer.h+5-5| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | |
| 13 | 13 | #include <__availability> |
| 14 | 14 | #include <__config> |
| 15 | #include <__format/format_fwd.h> | |
| 15 | #include <__format/concepts.h> | |
| 16 | 16 | #include <__format/format_parse_context.h> |
| 17 | 17 | #include <__format/formatter.h> |
| 18 | 18 | #include <__format/formatter_integral.h> |
| ... | ... | @@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | |
| 30 | 30 | #if _LIBCPP_STD_VER > 17 |
| 31 | 31 | |
| 32 | template <__formatter::__char_type _CharT> | |
| 32 | template <__fmt_char_type _CharT> | |
| 33 | 33 | struct _LIBCPP_TEMPLATE_VIS __formatter_pointer { |
| 34 | 34 | public: |
| 35 | 35 | constexpr __formatter_pointer() { __parser_.__alignment_ = __format_spec::__alignment::__right; } |
| ... | ... | @@ -56,13 +56,13 @@ public: |
| 56 | 56 | // - struct formatter<nullptr_t, charT>; |
| 57 | 57 | // - template<> struct formatter<void*, charT>; |
| 58 | 58 | // - template<> struct formatter<const void*, charT>; |
| 59 | template <__formatter::__char_type _CharT> | |
| 59 | template <__fmt_char_type _CharT> | |
| 60 | 60 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<nullptr_t, _CharT> |
| 61 | 61 | : public __formatter_pointer<_CharT> {}; |
| 62 | template <__formatter::__char_type _CharT> | |
| 62 | template <__fmt_char_type _CharT> | |
| 63 | 63 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<void*, _CharT> : public __formatter_pointer<_CharT> { |
| 64 | 64 | }; |
| 65 | template <__formatter::__char_type _CharT> | |
| 65 | template <__fmt_char_type _CharT> | |
| 66 | 66 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<const void*, _CharT> |
| 67 | 67 | : public __formatter_pointer<_CharT> {}; |
| 68 | 68 |
lib/libcxx/include/__format/formatter_string.h+24-10| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | |
| 13 | 13 | #include <__availability> |
| 14 | 14 | #include <__config> |
| 15 | #include <__format/format_fwd.h> | |
| 15 | #include <__format/concepts.h> | |
| 16 | 16 | #include <__format/format_parse_context.h> |
| 17 | 17 | #include <__format/formatter.h> |
| 18 | 18 | #include <__format/formatter_output.h> |
| ... | ... | @@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | |
| 30 | 30 | #if _LIBCPP_STD_VER > 17 |
| 31 | 31 | |
| 32 | template <__formatter::__char_type _CharT> | |
| 32 | template <__fmt_char_type _CharT> | |
| 33 | 33 | struct _LIBCPP_TEMPLATE_VIS __formatter_string { |
| 34 | 34 | public: |
| 35 | 35 | _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) |
| ... | ... | @@ -40,14 +40,23 @@ public: |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | _LIBCPP_HIDE_FROM_ABI auto format(basic_string_view<_CharT> __str, auto& __ctx) const -> decltype(__ctx.out()) { |
| 43 | # if _LIBCPP_STD_VER > 20 | |
| 44 | if (__parser_.__type_ == __format_spec::__type::__debug) | |
| 45 | return __formatter::__format_escaped_string(__str, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx)); | |
| 46 | # endif | |
| 47 | ||
| 43 | 48 | return __formatter::__write_string(__str, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx)); |
| 44 | 49 | } |
| 45 | 50 | |
| 46 | __format_spec::__parser<_CharT> __parser_; | |
| 51 | # if _LIBCPP_STD_VER > 20 | |
| 52 | _LIBCPP_HIDE_FROM_ABI constexpr void set_debug_format() { __parser_.__type_ = __format_spec::__type::__debug; } | |
| 53 | # endif | |
| 54 | ||
| 55 | __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__left}; | |
| 47 | 56 | }; |
| 48 | 57 | |
| 49 | 58 | // Formatter const char*. |
| 50 | template <__formatter::__char_type _CharT> | |
| 59 | template <__fmt_char_type _CharT> | |
| 51 | 60 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<const _CharT*, _CharT> |
| 52 | 61 | : public __formatter_string<_CharT> { |
| 53 | 62 | using _Base = __formatter_string<_CharT>; |
| ... | ... | @@ -56,6 +65,12 @@ struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<const _CharT*, |
| 56 | 65 | _LIBCPP_ASSERT(__str, "The basic_format_arg constructor should have " |
| 57 | 66 | "prevented an invalid pointer."); |
| 58 | 67 | |
| 68 | __format_spec::__parsed_specifications<_CharT> __specs = _Base::__parser_.__get_parsed_std_specifications(__ctx); | |
| 69 | # if _LIBCPP_STD_VER > 20 | |
| 70 | if (_Base::__parser_.__type_ == __format_spec::__type::__debug) | |
| 71 | return __formatter::__format_escaped_string(basic_string_view<_CharT>{__str}, __ctx.out(), __specs); | |
| 72 | # endif | |
| 73 | ||
| 59 | 74 | // When using a center or right alignment and the width option the length |
| 60 | 75 | // of __str must be known to add the padding upfront. This case is handled |
| 61 | 76 | // by the base class by converting the argument to a basic_string_view. |
| ... | ... | @@ -67,7 +82,6 @@ struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<const _CharT*, |
| 67 | 82 | // now these optimizations aren't implemented. Instead the base class |
| 68 | 83 | // handles these options. |
| 69 | 84 | // TODO FMT Implement these improvements. |
| 70 | __format_spec::__parsed_specifications<_CharT> __specs = _Base::__parser_.__get_parsed_std_specifications(__ctx); | |
| 71 | 85 | if (__specs.__has_width() || __specs.__has_precision()) |
| 72 | 86 | return __formatter::__write_string(basic_string_view<_CharT>{__str}, __ctx.out(), __specs); |
| 73 | 87 | |
| ... | ... | @@ -80,7 +94,7 @@ struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<const _CharT*, |
| 80 | 94 | }; |
| 81 | 95 | |
| 82 | 96 | // Formatter char*. |
| 83 | template <__formatter::__char_type _CharT> | |
| 97 | template <__fmt_char_type _CharT> | |
| 84 | 98 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<_CharT*, _CharT> |
| 85 | 99 | : public formatter<const _CharT*, _CharT> { |
| 86 | 100 | using _Base = formatter<const _CharT*, _CharT>; |
| ... | ... | @@ -91,7 +105,7 @@ struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<_CharT*, _Char |
| 91 | 105 | }; |
| 92 | 106 | |
| 93 | 107 | // Formatter char[]. |
| 94 | template <__formatter::__char_type _CharT, size_t _Size> | |
| 108 | template <__fmt_char_type _CharT, size_t _Size> | |
| 95 | 109 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<_CharT[_Size], _CharT> |
| 96 | 110 | : public __formatter_string<_CharT> { |
| 97 | 111 | using _Base = __formatter_string<_CharT>; |
| ... | ... | @@ -102,7 +116,7 @@ struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<_CharT[_Size], |
| 102 | 116 | }; |
| 103 | 117 | |
| 104 | 118 | // Formatter const char[]. |
| 105 | template <__formatter::__char_type _CharT, size_t _Size> | |
| 119 | template <__fmt_char_type _CharT, size_t _Size> | |
| 106 | 120 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<const _CharT[_Size], _CharT> |
| 107 | 121 | : public __formatter_string<_CharT> { |
| 108 | 122 | using _Base = __formatter_string<_CharT>; |
| ... | ... | @@ -113,7 +127,7 @@ struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<const _CharT[_ |
| 113 | 127 | }; |
| 114 | 128 | |
| 115 | 129 | // Formatter std::string. |
| 116 | template <__formatter::__char_type _CharT, class _Traits, class _Allocator> | |
| 130 | template <__fmt_char_type _CharT, class _Traits, class _Allocator> | |
| 117 | 131 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<basic_string<_CharT, _Traits, _Allocator>, _CharT> |
| 118 | 132 | : public __formatter_string<_CharT> { |
| 119 | 133 | using _Base = __formatter_string<_CharT>; |
| ... | ... | @@ -126,7 +140,7 @@ struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<basic_string<_ |
| 126 | 140 | }; |
| 127 | 141 | |
| 128 | 142 | // Formatter std::string_view. |
| 129 | template <__formatter::__char_type _CharT, class _Traits> | |
| 143 | template <__fmt_char_type _CharT, class _Traits> | |
| 130 | 144 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<basic_string_view<_CharT, _Traits>, _CharT> |
| 131 | 145 | : public __formatter_string<_CharT> { |
| 132 | 146 | using _Base = __formatter_string<_CharT>; |
lib/libcxx/include/__format/formatter_tuple.h created+178| ... | ... | @@ -0,0 +1,178 @@ |
| 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_TUPLE_H | |
| 11 | #define _LIBCPP___FORMAT_FORMATTER_TUPLE_H | |
| 12 | ||
| 13 | #include <__algorithm/ranges_copy.h> | |
| 14 | #include <__availability> | |
| 15 | #include <__chrono/statically_widen.h> | |
| 16 | #include <__config> | |
| 17 | #include <__format/concepts.h> | |
| 18 | #include <__format/format_args.h> | |
| 19 | #include <__format/format_context.h> | |
| 20 | #include <__format/format_error.h> | |
| 21 | #include <__format/format_parse_context.h> | |
| 22 | #include <__format/formatter.h> | |
| 23 | #include <__format/formatter_output.h> | |
| 24 | #include <__format/parser_std_format_spec.h> | |
| 25 | #include <__iterator/back_insert_iterator.h> | |
| 26 | #include <__type_traits/remove_cvref.h> | |
| 27 | #include <__utility/integer_sequence.h> | |
| 28 | #include <__utility/pair.h> | |
| 29 | #include <string_view> | |
| 30 | #include <tuple> | |
| 31 | ||
| 32 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 33 | # pragma GCC system_header | |
| 34 | #endif | |
| 35 | ||
| 36 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 37 | ||
| 38 | #if _LIBCPP_STD_VER > 20 | |
| 39 | ||
| 40 | template <__fmt_char_type _CharT, class _Tuple, formattable<_CharT>... _Args> | |
| 41 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatter_tuple { | |
| 42 | _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) { | |
| 43 | __separator_ = __separator; | |
| 44 | } | |
| 45 | _LIBCPP_HIDE_FROM_ABI constexpr void | |
| 46 | set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) { | |
| 47 | __opening_bracket_ = __opening_bracket; | |
| 48 | __closing_bracket_ = __closing_bracket; | |
| 49 | } | |
| 50 | ||
| 51 | template <class _ParseContext> | |
| 52 | _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __parse_ctx) { | |
| 53 | const _CharT* __begin = __parser_.__parse(__parse_ctx, __format_spec::__fields_tuple); | |
| 54 | ||
| 55 | // [format.tuple]/7 | |
| 56 | // ... For each element e in underlying_, if e.set_debug_format() | |
| 57 | // is a valid expression, calls e.set_debug_format(). | |
| 58 | // TODO FMT this can be removed when P2733 is accepted. | |
| 59 | std::__for_each_index_sequence(make_index_sequence<sizeof...(_Args)>(), [&]<size_t _Index> { | |
| 60 | std::__set_debug_format(std::get<_Index>(__underlying_)); | |
| 61 | }); | |
| 62 | ||
| 63 | const _CharT* __end = __parse_ctx.end(); | |
| 64 | if (__begin == __end) | |
| 65 | return __begin; | |
| 66 | ||
| 67 | if (*__begin == _CharT('m')) { | |
| 68 | if constexpr (sizeof...(_Args) == 2) { | |
| 69 | set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ": ")); | |
| 70 | set_brackets({}, {}); | |
| 71 | ++__begin; | |
| 72 | } else | |
| 73 | std::__throw_format_error("The format specifier m requires a pair or a two-element tuple"); | |
| 74 | } else if (*__begin == _CharT('n')) { | |
| 75 | set_brackets({}, {}); | |
| 76 | ++__begin; | |
| 77 | } | |
| 78 | ||
| 79 | if (__begin != __end && *__begin != _CharT('}')) | |
| 80 | std::__throw_format_error("The format-spec should consume the input or end with a '}'"); | |
| 81 | ||
| 82 | return __begin; | |
| 83 | } | |
| 84 | ||
| 85 | template <class _FormatContext> | |
| 86 | typename _FormatContext::iterator _LIBCPP_HIDE_FROM_ABI | |
| 87 | format(conditional_t<(formattable<const _Args, _CharT> && ...), const _Tuple&, _Tuple&> __tuple, | |
| 88 | _FormatContext& __ctx) const { | |
| 89 | __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx); | |
| 90 | ||
| 91 | if (!__specs.__has_width()) | |
| 92 | return __format_tuple(__tuple, __ctx); | |
| 93 | ||
| 94 | basic_string<_CharT> __str; | |
| 95 | ||
| 96 | // Since the output is written to a different iterator a new context is | |
| 97 | // created. Since the underlying formatter uses the default formatting it | |
| 98 | // doesn't need a locale or the formatting arguments. So creating a new | |
| 99 | // context works. | |
| 100 | // | |
| 101 | // This solution works for this formatter, but it will not work for the | |
| 102 | // range_formatter. In that patch a generic solution is work in progress. | |
| 103 | // Once that is finished it can be used here. (The range_formatter will use | |
| 104 | // these features so it's easier to add it there and then port it.) | |
| 105 | // | |
| 106 | // TODO FMT Use formatting wrapping used in the range_formatter. | |
| 107 | basic_format_context __c = std::__format_context_create( | |
| 108 | back_insert_iterator{__str}, | |
| 109 | basic_format_args<basic_format_context<back_insert_iterator<basic_string<_CharT>>, _CharT>>{}); | |
| 110 | ||
| 111 | __format_tuple(__tuple, __c); | |
| 112 | ||
| 113 | return __formatter::__write_string_no_precision(basic_string_view{__str}, __ctx.out(), __specs); | |
| 114 | } | |
| 115 | ||
| 116 | template <class _FormatContext> | |
| 117 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_tuple(auto&& __tuple, _FormatContext& __ctx) const { | |
| 118 | __ctx.advance_to(std::ranges::copy(__opening_bracket_, __ctx.out()).out); | |
| 119 | ||
| 120 | std::__for_each_index_sequence(make_index_sequence<sizeof...(_Args)>(), [&]<size_t _Index> { | |
| 121 | if constexpr (_Index) | |
| 122 | __ctx.advance_to(std::ranges::copy(__separator_, __ctx.out()).out); | |
| 123 | ||
| 124 | // During review Victor suggested to make the exposition only | |
| 125 | // __underlying_ member a local variable. Currently the Standard | |
| 126 | // requires nested debug-enabled formatter specializations not to | |
| 127 | // output escaped output. P2733 fixes that bug, once accepted the | |
| 128 | // code below can be used. | |
| 129 | // (Note when a paper allows parsing a tuple-underlying-spec the | |
| 130 | // exposition only member needs to be a class member. Earlier | |
| 131 | // revisions of P2286 proposed that, but this was not pursued, | |
| 132 | // due to time constrains and complexity of the matter.) | |
| 133 | // TODO FMT This can be updated after P2733 is accepted. | |
| 134 | # if 0 | |
| 135 | // P2286 uses an exposition only member in the formatter | |
| 136 | // tuple<formatter<remove_cvref_t<_Args>, _CharT>...> __underlying_; | |
| 137 | // This was used in earlier versions of the paper since | |
| 138 | // __underlying_.parse(...) was called. This is no longer the case | |
| 139 | // so we can reduce the scope of the formatter. | |
| 140 | // | |
| 141 | // It does require the underlying's parse effect to be moved here too. | |
| 142 | using _Arg = tuple_element<_Index, decltype(__tuple)>; | |
| 143 | formatter<remove_cvref_t<_Args>, _CharT> __underlying; | |
| 144 | ||
| 145 | // [format.tuple]/7 | |
| 146 | // ... For each element e in underlying_, if e.set_debug_format() | |
| 147 | // is a valid expression, calls e.set_debug_format(). | |
| 148 | std::__set_debug_format(__underlying); | |
| 149 | # else | |
| 150 | __ctx.advance_to(std::get<_Index>(__underlying_).format(std::get<_Index>(__tuple), __ctx)); | |
| 151 | # endif | |
| 152 | }); | |
| 153 | ||
| 154 | return std::ranges::copy(__closing_bracket_, __ctx.out()).out; | |
| 155 | } | |
| 156 | ||
| 157 | __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__left}; | |
| 158 | ||
| 159 | private: | |
| 160 | tuple<formatter<remove_cvref_t<_Args>, _CharT>...> __underlying_; | |
| 161 | basic_string_view<_CharT> __separator_ = _LIBCPP_STATICALLY_WIDEN(_CharT, ", "); | |
| 162 | basic_string_view<_CharT> __opening_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "("); | |
| 163 | basic_string_view<_CharT> __closing_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, ")"); | |
| 164 | }; | |
| 165 | ||
| 166 | template <__fmt_char_type _CharT, formattable<_CharT>... _Args> | |
| 167 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<pair<_Args...>, _CharT> | |
| 168 | : public __formatter_tuple<_CharT, pair<_Args...>, _Args...> {}; | |
| 169 | ||
| 170 | template <__fmt_char_type _CharT, formattable<_CharT>... _Args> | |
| 171 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<tuple<_Args...>, _CharT> | |
| 172 | : public __formatter_tuple<_CharT, tuple<_Args...>, _Args...> {}; | |
| 173 | ||
| 174 | #endif //_LIBCPP_STD_VER > 20 | |
| 175 | ||
| 176 | _LIBCPP_END_NAMESPACE_STD | |
| 177 | ||
| 178 | #endif // _LIBCPP___FORMAT_FORMATTER_TUPLE_H |
lib/libcxx/include/__format/parser_std_format_spec.h+90-42| ... | ... | @@ -19,6 +19,8 @@ |
| 19 | 19 | #include <__algorithm/find_if.h> |
| 20 | 20 | #include <__algorithm/min.h> |
| 21 | 21 | #include <__assert> |
| 22 | #include <__concepts/arithmetic.h> | |
| 23 | #include <__concepts/same_as.h> | |
| 22 | 24 | #include <__config> |
| 23 | 25 | #include <__debug> |
| 24 | 26 | #include <__format/format_arg.h> |
| ... | ... | @@ -28,7 +30,6 @@ |
| 28 | 30 | #include <__format/unicode.h> |
| 29 | 31 | #include <__variant/monostate.h> |
| 30 | 32 | #include <bit> |
| 31 | #include <concepts> | |
| 32 | 33 | #include <cstdint> |
| 33 | 34 | #include <string_view> |
| 34 | 35 | #include <type_traits> |
| ... | ... | @@ -52,13 +53,12 @@ __parse_arg_id(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) { |
| 52 | 53 | // This function is a wrapper to call the real parser. But it does the |
| 53 | 54 | // validation for the pre-conditions and post-conditions. |
| 54 | 55 | if (__begin == __end) |
| 55 | __throw_format_error("End of input while parsing format-spec arg-id"); | |
| 56 | std::__throw_format_error("End of input while parsing format-spec arg-id"); | |
| 56 | 57 | |
| 57 | __format::__parse_number_result __r = | |
| 58 | __format::__parse_arg_id(__begin, __end, __parse_ctx); | |
| 58 | __format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx); | |
| 59 | 59 | |
| 60 | 60 | if (__r.__ptr == __end || *__r.__ptr != _CharT('}')) |
| 61 | __throw_format_error("Invalid arg-id"); | |
| 61 | std::__throw_format_error("Invalid arg-id"); | |
| 62 | 62 | |
| 63 | 63 | ++__r.__ptr; |
| 64 | 64 | return __r; |
| ... | ... | @@ -67,28 +67,33 @@ __parse_arg_id(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) { |
| 67 | 67 | template <class _Context> |
| 68 | 68 | _LIBCPP_HIDE_FROM_ABI constexpr uint32_t |
| 69 | 69 | __substitute_arg_id(basic_format_arg<_Context> __format_arg) { |
| 70 | return visit_format_arg( | |
| 70 | // [format.string.std]/8 | |
| 71 | // If the corresponding formatting argument is not of integral type... | |
| 72 | // This wording allows char and bool too. LWG-3720 changes the wording to | |
| 73 | // If the corresponding formatting argument is not of standard signed or | |
| 74 | // unsigned integer type, | |
| 75 | // This means the 128-bit will not be valid anymore. | |
| 76 | // TODO FMT Verify this resolution is accepted and add a test to verify | |
| 77 | // 128-bit integrals fail and switch to visit_format_arg. | |
| 78 | return _VSTD::__visit_format_arg( | |
| 71 | 79 | [](auto __arg) -> uint32_t { |
| 72 | 80 | using _Type = decltype(__arg); |
| 73 | 81 | if constexpr (integral<_Type>) { |
| 74 | 82 | if constexpr (signed_integral<_Type>) { |
| 75 | 83 | if (__arg < 0) |
| 76 | __throw_format_error("A format-spec arg-id replacement shouldn't " | |
| 77 | "have a negative value"); | |
| 84 | std::__throw_format_error("A format-spec arg-id replacement shouldn't have a negative value"); | |
| 78 | 85 | } |
| 79 | 86 | |
| 80 | 87 | using _CT = common_type_t<_Type, decltype(__format::__number_max)>; |
| 81 | 88 | if (static_cast<_CT>(__arg) > |
| 82 | 89 | static_cast<_CT>(__format::__number_max)) |
| 83 | __throw_format_error("A format-spec arg-id replacement exceeds " | |
| 84 | "the maximum supported value"); | |
| 90 | std::__throw_format_error("A format-spec arg-id replacement exceeds the maximum supported value"); | |
| 85 | 91 | |
| 86 | 92 | return __arg; |
| 87 | 93 | } else if constexpr (same_as<_Type, monostate>) |
| 88 | __throw_format_error("Argument index out of bounds"); | |
| 94 | std::__throw_format_error("Argument index out of bounds"); | |
| 89 | 95 | else |
| 90 | __throw_format_error("A format-spec arg-id replacement argument " | |
| 91 | "isn't an integral type"); | |
| 96 | std::__throw_format_error("A format-spec arg-id replacement argument isn't an integral type"); | |
| 92 | 97 | }, |
| 93 | 98 | __format_arg); |
| 94 | 99 | } |
| ... | ... | @@ -97,6 +102,7 @@ __substitute_arg_id(basic_format_arg<_Context> __format_arg) { |
| 97 | 102 | /// |
| 98 | 103 | /// They default to false so when a new field is added it needs to be opted in |
| 99 | 104 | /// explicitly. |
| 105 | // TODO FMT Use an ABI tag for this struct. | |
| 100 | 106 | struct __fields { |
| 101 | 107 | uint8_t __sign_ : 1 {false}; |
| 102 | 108 | uint8_t __alternate_form_ : 1 {false}; |
| ... | ... | @@ -104,6 +110,13 @@ struct __fields { |
| 104 | 110 | uint8_t __precision_ : 1 {false}; |
| 105 | 111 | uint8_t __locale_specific_form_ : 1 {false}; |
| 106 | 112 | uint8_t __type_ : 1 {false}; |
| 113 | // Determines the valid values for fill. | |
| 114 | // | |
| 115 | // Originally the fill could be any character except { and }. Range-based | |
| 116 | // formatters use the colon to mark the beginning of the | |
| 117 | // underlying-format-spec. To avoid parsing ambiguities these formatter | |
| 118 | // specializations prohibit the use of the colon as a fill character. | |
| 119 | uint8_t __allow_colon_in_fill_ : 1 {false}; | |
| 107 | 120 | }; |
| 108 | 121 | |
| 109 | 122 | // By not placing this constant in the formatter class it's not duplicated for |
| ... | ... | @@ -124,6 +137,11 @@ inline constexpr __fields __fields_floating_point{ |
| 124 | 137 | inline constexpr __fields __fields_string{.__precision_ = true, .__type_ = true}; |
| 125 | 138 | inline constexpr __fields __fields_pointer{.__type_ = true}; |
| 126 | 139 | |
| 140 | # if _LIBCPP_STD_VER > 20 | |
| 141 | inline constexpr __fields __fields_tuple{.__type_ = false, .__allow_colon_in_fill_ = true}; | |
| 142 | inline constexpr __fields __fields_range{.__type_ = false, .__allow_colon_in_fill_ = true}; | |
| 143 | # endif | |
| 144 | ||
| 127 | 145 | enum class _LIBCPP_ENUM_VIS __alignment : uint8_t { |
| 128 | 146 | /// No alignment is set in the format string. |
| 129 | 147 | __default, |
| ... | ... | @@ -163,7 +181,8 @@ enum class _LIBCPP_ENUM_VIS __type : uint8_t { |
| 163 | 181 | __fixed_lower_case, |
| 164 | 182 | __fixed_upper_case, |
| 165 | 183 | __general_lower_case, |
| 166 | __general_upper_case | |
| 184 | __general_upper_case, | |
| 185 | __debug | |
| 167 | 186 | }; |
| 168 | 187 | |
| 169 | 188 | struct __std { |
| ... | ... | @@ -176,7 +195,11 @@ struct __std { |
| 176 | 195 | |
| 177 | 196 | struct __chrono { |
| 178 | 197 | __alignment __alignment_ : 3; |
| 198 | bool __locale_specific_form_ : 1; | |
| 179 | 199 | bool __weekday_name_ : 1; |
| 200 | bool __weekday_ : 1; | |
| 201 | bool __day_of_year_ : 1; | |
| 202 | bool __week_of_year_ : 1; | |
| 180 | 203 | bool __month_name_ : 1; |
| 181 | 204 | }; |
| 182 | 205 | |
| ... | ... | @@ -250,7 +273,7 @@ public: |
| 250 | 273 | if (__begin == __end) |
| 251 | 274 | return __begin; |
| 252 | 275 | |
| 253 | if (__parse_fill_align(__begin, __end) && __begin == __end) | |
| 276 | if (__parse_fill_align(__begin, __end, __fields.__allow_colon_in_fill_) && __begin == __end) | |
| 254 | 277 | return __begin; |
| 255 | 278 | |
| 256 | 279 | if (__fields.__sign_ && __parse_sign(__begin) && __begin == __end) |
| ... | ... | @@ -278,7 +301,7 @@ public: |
| 278 | 301 | // parsing. In that case that parser should do the end of format string |
| 279 | 302 | // validation. |
| 280 | 303 | if (__begin != __end && *__begin != _CharT('}')) |
| 281 | __throw_format_error("The format-spec should consume the input or end with a '}'"); | |
| 304 | std::__throw_format_error("The format-spec should consume the input or end with a '}'"); | |
| 282 | 305 | } |
| 283 | 306 | |
| 284 | 307 | return __begin; |
| ... | ... | @@ -288,12 +311,26 @@ public: |
| 288 | 311 | _LIBCPP_HIDE_FROM_ABI |
| 289 | 312 | __parsed_specifications<_CharT> __get_parsed_std_specifications(auto& __ctx) const { |
| 290 | 313 | return __parsed_specifications<_CharT>{ |
| 291 | .__std_ = | |
| 292 | __std{.__alignment_ = __alignment_, | |
| 293 | .__sign_ = __sign_, | |
| 294 | .__alternate_form_ = __alternate_form_, | |
| 295 | .__locale_specific_form_ = __locale_specific_form_, | |
| 296 | .__type_ = __type_}, | |
| 314 | .__std_ = __std{.__alignment_ = __alignment_, | |
| 315 | .__sign_ = __sign_, | |
| 316 | .__alternate_form_ = __alternate_form_, | |
| 317 | .__locale_specific_form_ = __locale_specific_form_, | |
| 318 | .__type_ = __type_}, | |
| 319 | .__width_{__get_width(__ctx)}, | |
| 320 | .__precision_{__get_precision(__ctx)}, | |
| 321 | .__fill_{__fill_}}; | |
| 322 | } | |
| 323 | ||
| 324 | _LIBCPP_HIDE_FROM_ABI __parsed_specifications<_CharT> __get_parsed_chrono_specifications(auto& __ctx) const { | |
| 325 | return __parsed_specifications<_CharT>{ | |
| 326 | .__chrono_ = | |
| 327 | __chrono{.__alignment_ = __alignment_, | |
| 328 | .__locale_specific_form_ = __locale_specific_form_, | |
| 329 | .__weekday_name_ = __weekday_name_, | |
| 330 | .__weekday_ = __weekday_, | |
| 331 | .__day_of_year_ = __day_of_year_, | |
| 332 | .__week_of_year_ = __week_of_year_, | |
| 333 | .__month_name_ = __month_name_}, | |
| 297 | 334 | .__width_{__get_width(__ctx)}, |
| 298 | 335 | .__precision_{__get_precision(__ctx)}, |
| 299 | 336 | .__fill_{__fill_}}; |
| ... | ... | @@ -306,12 +343,17 @@ public: |
| 306 | 343 | bool __reserved_0_ : 1 {false}; |
| 307 | 344 | __type __type_{__type::__default}; |
| 308 | 345 | |
| 309 | // These two flags are used for formatting chrono. Since the struct has | |
| 346 | // These flags are only used for formatting chrono. Since the struct has | |
| 310 | 347 | // padding space left it's added to this structure. |
| 311 | 348 | bool __weekday_name_ : 1 {false}; |
| 349 | bool __weekday_ : 1 {false}; | |
| 350 | ||
| 351 | bool __day_of_year_ : 1 {false}; | |
| 352 | bool __week_of_year_ : 1 {false}; | |
| 353 | ||
| 312 | 354 | bool __month_name_ : 1 {false}; |
| 313 | 355 | |
| 314 | uint8_t __reserved_1_ : 6 {0}; | |
| 356 | uint8_t __reserved_1_ : 3 {0}; | |
| 315 | 357 | uint8_t __reserved_2_ : 6 {0}; |
| 316 | 358 | // These two flags are only used internally and not part of the |
| 317 | 359 | // __parsed_specifications. Therefore put them at the end. |
| ... | ... | @@ -348,13 +390,17 @@ private: |
| 348 | 390 | return false; |
| 349 | 391 | } |
| 350 | 392 | |
| 351 | _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(const _CharT*& __begin, const _CharT* __end) { | |
| 393 | // range-fill and tuple-fill are identical | |
| 394 | _LIBCPP_HIDE_FROM_ABI constexpr bool | |
| 395 | __parse_fill_align(const _CharT*& __begin, const _CharT* __end, bool __use_range_fill) { | |
| 352 | 396 | _LIBCPP_ASSERT(__begin != __end, "when called with an empty input the function will cause " |
| 353 | 397 | "undefined behavior by evaluating data not in the input"); |
| 354 | 398 | if (__begin + 1 != __end) { |
| 355 | 399 | if (__parse_alignment(*(__begin + 1))) { |
| 356 | if (*__begin == _CharT('{') || *__begin == _CharT('}')) | |
| 357 | __throw_format_error("The format-spec fill field contains an invalid character"); | |
| 400 | if (__use_range_fill && (*__begin == _CharT('{') || *__begin == _CharT('}') || *__begin == _CharT(':'))) | |
| 401 | std::__throw_format_error("The format-spec range-fill field contains an invalid character"); | |
| 402 | else if (*__begin == _CharT('{') || *__begin == _CharT('}')) | |
| 403 | std::__throw_format_error("The format-spec fill field contains an invalid character"); | |
| 358 | 404 | |
| 359 | 405 | __fill_ = *__begin; |
| 360 | 406 | __begin += 2; |
| ... | ... | @@ -408,7 +454,7 @@ private: |
| 408 | 454 | |
| 409 | 455 | _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_width(const _CharT*& __begin, const _CharT* __end, auto& __parse_ctx) { |
| 410 | 456 | if (*__begin == _CharT('0')) |
| 411 | __throw_format_error("A format-spec width field shouldn't have a leading zero"); | |
| 457 | std::__throw_format_error("A format-spec width field shouldn't have a leading zero"); | |
| 412 | 458 | |
| 413 | 459 | if (*__begin == _CharT('{')) { |
| 414 | 460 | __format::__parse_number_result __r = __format_spec::__parse_arg_id(++__begin, __end, __parse_ctx); |
| ... | ... | @@ -436,7 +482,7 @@ private: |
| 436 | 482 | |
| 437 | 483 | ++__begin; |
| 438 | 484 | if (__begin == __end) |
| 439 | __throw_format_error("End of input while parsing format-spec precision"); | |
| 485 | std::__throw_format_error("End of input while parsing format-spec precision"); | |
| 440 | 486 | |
| 441 | 487 | if (*__begin == _CharT('{')) { |
| 442 | 488 | __format::__parse_number_result __arg_id = __format_spec::__parse_arg_id(++__begin, __end, __parse_ctx); |
| ... | ... | @@ -447,7 +493,7 @@ private: |
| 447 | 493 | } |
| 448 | 494 | |
| 449 | 495 | if (*__begin < _CharT('0') || *__begin > _CharT('9')) |
| 450 | __throw_format_error("The format-spec precision field doesn't contain a value or arg-id"); | |
| 496 | std::__throw_format_error("The format-spec precision field doesn't contain a value or arg-id"); | |
| 451 | 497 | |
| 452 | 498 | __format::__parse_number_result __r = __format::__parse_number(__begin, __end); |
| 453 | 499 | __precision_ = __r.__value; |
| ... | ... | @@ -523,6 +569,11 @@ private: |
| 523 | 569 | case 'x': |
| 524 | 570 | __type_ = __type::__hexadecimal_lower_case; |
| 525 | 571 | break; |
| 572 | # if _LIBCPP_STD_VER > 20 | |
| 573 | case '?': | |
| 574 | __type_ = __type::__debug; | |
| 575 | break; | |
| 576 | # endif | |
| 526 | 577 | default: |
| 527 | 578 | return; |
| 528 | 579 | } |
| ... | ... | @@ -534,10 +585,7 @@ private: |
| 534 | 585 | if (!__width_as_arg_) |
| 535 | 586 | return __width_; |
| 536 | 587 | |
| 537 | int32_t __result = __format_spec::__substitute_arg_id(__ctx.arg(__width_)); | |
| 538 | if (__result == 0) | |
| 539 | __throw_format_error("A format-spec width field replacement should have a positive value"); | |
| 540 | return __result; | |
| 588 | return __format_spec::__substitute_arg_id(__ctx.arg(__width_)); | |
| 541 | 589 | } |
| 542 | 590 | |
| 543 | 591 | _LIBCPP_HIDE_FROM_ABI |
| ... | ... | @@ -559,6 +607,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_string(__format_spec |
| 559 | 607 | switch (__type) { |
| 560 | 608 | case __format_spec::__type::__default: |
| 561 | 609 | case __format_spec::__type::__string: |
| 610 | case __format_spec::__type::__debug: | |
| 562 | 611 | break; |
| 563 | 612 | |
| 564 | 613 | default: |
| ... | ... | @@ -612,6 +661,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_char(__parser<_CharT>& __p |
| 612 | 661 | switch (__parser.__type_) { |
| 613 | 662 | case __format_spec::__type::__default: |
| 614 | 663 | case __format_spec::__type::__char: |
| 664 | case __format_spec::__type::__debug: | |
| 615 | 665 | __format_spec::__process_display_type_char(__parser); |
| 616 | 666 | break; |
| 617 | 667 | |
| ... | ... | @@ -653,11 +703,6 @@ template <class _CharT> |
| 653 | 703 | _LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_floating_point(__parser<_CharT>& __parser) { |
| 654 | 704 | switch (__parser.__type_) { |
| 655 | 705 | case __format_spec::__type::__default: |
| 656 | // When no precision specified then it keeps default since that | |
| 657 | // formatting differs from the other types. | |
| 658 | if (__parser.__precision_as_arg_ || __parser.__precision_ != -1) | |
| 659 | __parser.__type_ = __format_spec::__type::__general_lower_case; | |
| 660 | break; | |
| 661 | 706 | case __format_spec::__type::__hexfloat_lower_case: |
| 662 | 707 | case __format_spec::__type::__hexfloat_upper_case: |
| 663 | 708 | // Precision specific behavior will be handled later. |
| ... | ... | @@ -699,6 +744,9 @@ struct __column_width_result { |
| 699 | 744 | const _CharT* __last_; |
| 700 | 745 | }; |
| 701 | 746 | |
| 747 | template <class _CharT> | |
| 748 | __column_width_result(size_t, const _CharT*) -> __column_width_result<_CharT>; | |
| 749 | ||
| 702 | 750 | /// Since a column width can be two it's possible that the requested column |
| 703 | 751 | /// width can't be achieved. Depending on the intended usage the policy can be |
| 704 | 752 | /// selected. |
| ... | ... | @@ -857,7 +905,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT> __estimate_column_ |
| 857 | 905 | // unit is non-ASCII we omit the current code unit and let the Grapheme |
| 858 | 906 | // clustering algorithm do its work. |
| 859 | 907 | const _CharT* __it = __str.begin(); |
| 860 | if (__is_ascii(*__it)) { | |
| 908 | if (__format_spec::__is_ascii(*__it)) { | |
| 861 | 909 | do { |
| 862 | 910 | --__maximum; |
| 863 | 911 | ++__it; |
| ... | ... | @@ -865,12 +913,12 @@ _LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT> __estimate_column_ |
| 865 | 913 | return {__str.size(), __str.end()}; |
| 866 | 914 | |
| 867 | 915 | if (__maximum == 0) { |
| 868 | if (__is_ascii(*__it)) | |
| 916 | if (__format_spec::__is_ascii(*__it)) | |
| 869 | 917 | return {static_cast<size_t>(__it - __str.begin()), __it}; |
| 870 | 918 | |
| 871 | 919 | break; |
| 872 | 920 | } |
| 873 | } while (__is_ascii(*__it)); | |
| 921 | } while (__format_spec::__is_ascii(*__it)); | |
| 874 | 922 | --__it; |
| 875 | 923 | ++__maximum; |
| 876 | 924 | } |
lib/libcxx/include/__format/range_default_formatter.h created+201| ... | ... | @@ -0,0 +1,201 @@ |
| 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_RANGE_DEFAULT_FORMATTER_H | |
| 11 | #define _LIBCPP___FORMAT_RANGE_DEFAULT_FORMATTER_H | |
| 12 | ||
| 13 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 14 | # pragma GCC system_header | |
| 15 | #endif | |
| 16 | ||
| 17 | #include <__availability> | |
| 18 | #include <__chrono/statically_widen.h> | |
| 19 | #include <__concepts/same_as.h> | |
| 20 | #include <__config> | |
| 21 | #include <__format/concepts.h> | |
| 22 | #include <__format/formatter.h> | |
| 23 | #include <__format/range_formatter.h> | |
| 24 | #include <__ranges/concepts.h> | |
| 25 | #include <__type_traits/remove_cvref.h> | |
| 26 | #include <__utility/pair.h> | |
| 27 | #include <string_view> | |
| 28 | #include <tuple> | |
| 29 | ||
| 30 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 31 | ||
| 32 | #if _LIBCPP_STD_VER > 20 | |
| 33 | ||
| 34 | template <class _Rp, class _CharT> | |
| 35 | concept __const_formattable_range = | |
| 36 | ranges::input_range<const _Rp> && formattable<ranges::range_reference_t<const _Rp>, _CharT>; | |
| 37 | ||
| 38 | template <class _Rp, class _CharT> | |
| 39 | using __fmt_maybe_const = conditional_t<__const_formattable_range<_Rp, _CharT>, const _Rp, _Rp>; | |
| 40 | ||
| 41 | _LIBCPP_DIAGNOSTIC_PUSH | |
| 42 | _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wshadow") | |
| 43 | _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wshadow") | |
| 44 | // This shadows map, set, and string. | |
| 45 | enum class range_format { disabled, map, set, sequence, string, debug_string }; | |
| 46 | _LIBCPP_DIAGNOSTIC_POP | |
| 47 | ||
| 48 | // There is no definition of this struct, it's purely intended to be used to | |
| 49 | // generate diagnostics. | |
| 50 | template <class _Rp> | |
| 51 | struct _LIBCPP_TEMPLATE_VIS __instantiated_the_primary_template_of_format_kind; | |
| 52 | ||
| 53 | template <class _Rp> | |
| 54 | constexpr range_format format_kind = [] { | |
| 55 | // [format.range.fmtkind]/1 | |
| 56 | // A program that instantiates the primary template of format_kind is ill-formed. | |
| 57 | static_assert(sizeof(_Rp) != sizeof(_Rp), "create a template specialization of format_kind for your type"); | |
| 58 | return range_format::disabled; | |
| 59 | }(); | |
| 60 | ||
| 61 | template <ranges::input_range _Rp> | |
| 62 | requires same_as<_Rp, remove_cvref_t<_Rp>> | |
| 63 | inline constexpr range_format format_kind<_Rp> = [] { | |
| 64 | // [format.range.fmtkind]/2 | |
| 65 | ||
| 66 | // 2.1 If same_as<remove_cvref_t<ranges::range_reference_t<R>>, R> is true, | |
| 67 | // Otherwise format_kind<R> is range_format::disabled. | |
| 68 | if constexpr (same_as<remove_cvref_t<ranges::range_reference_t<_Rp>>, _Rp>) | |
| 69 | return range_format::disabled; | |
| 70 | // 2.2 Otherwise, if the qualified-id R::key_type is valid and denotes a type: | |
| 71 | else if constexpr (requires { typename _Rp::key_type; }) { | |
| 72 | // 2.2.1 If the qualified-id R::mapped_type is valid and denotes a type ... | |
| 73 | if constexpr (requires { typename _Rp::mapped_type; } && | |
| 74 | // 2.2.1 ... If either U is a specialization of pair or U is a specialization | |
| 75 | // of tuple and tuple_size_v<U> == 2 | |
| 76 | __fmt_pair_like<remove_cvref_t<ranges::range_reference_t<_Rp>>>) | |
| 77 | return range_format::map; | |
| 78 | else | |
| 79 | // 2.2.2 Otherwise format_kind<R> is range_format::set. | |
| 80 | return range_format::set; | |
| 81 | } else | |
| 82 | // 2.3 Otherwise, format_kind<R> is range_format::sequence. | |
| 83 | return range_format::sequence; | |
| 84 | }(); | |
| 85 | ||
| 86 | // This is a non-standard work-around to fix instantiation of | |
| 87 | // formatter<const _CharT[N], _CharT> | |
| 88 | // const _CharT[N] satisfies the ranges::input_range concept. | |
| 89 | // remove_cvref_t<const _CharT[N]> is _CharT[N] so it does not satisfy the | |
| 90 | // requirement of the above specialization. Instead it will instantiate the | |
| 91 | // primary template, which is ill-formed. | |
| 92 | // | |
| 93 | // An alternative solution is to remove the offending formatter. | |
| 94 | // | |
| 95 | // https://godbolt.org/z/bqjhhaexx | |
| 96 | // | |
| 97 | // The removal is proposed in LWG3833, but use the work-around until the issue | |
| 98 | // has been adopted. | |
| 99 | // TODO FMT Implement LWG3833. | |
| 100 | template <class _CharT, size_t N> | |
| 101 | inline constexpr range_format format_kind<const _CharT[N]> = range_format::disabled; | |
| 102 | ||
| 103 | template <range_format _Kp, ranges::input_range _Rp, class _CharT> | |
| 104 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __range_default_formatter; | |
| 105 | ||
| 106 | // Required specializations | |
| 107 | ||
| 108 | template <ranges::input_range _Rp, class _CharT> | |
| 109 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __range_default_formatter<range_format::sequence, _Rp, _CharT> { | |
| 110 | private: | |
| 111 | using __maybe_const_r = __fmt_maybe_const<_Rp, _CharT>; | |
| 112 | range_formatter<remove_cvref_t<ranges::range_reference_t<__maybe_const_r>>, _CharT> __underlying_; | |
| 113 | ||
| 114 | public: | |
| 115 | _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) { | |
| 116 | __underlying_.set_separator(__separator); | |
| 117 | } | |
| 118 | _LIBCPP_HIDE_FROM_ABI constexpr void | |
| 119 | set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) { | |
| 120 | __underlying_.set_brackets(__opening_bracket, __closing_bracket); | |
| 121 | } | |
| 122 | ||
| 123 | template <class _ParseContext> | |
| 124 | _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { | |
| 125 | return __underlying_.parse(__ctx); | |
| 126 | } | |
| 127 | ||
| 128 | template <class FormatContext> | |
| 129 | _LIBCPP_HIDE_FROM_ABI typename FormatContext::iterator format(__maybe_const_r& __range, FormatContext& __ctx) const { | |
| 130 | return __underlying_.format(__range, __ctx); | |
| 131 | } | |
| 132 | }; | |
| 133 | ||
| 134 | template <ranges::input_range _Rp, class _CharT> | |
| 135 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __range_default_formatter<range_format::map, _Rp, _CharT> { | |
| 136 | private: | |
| 137 | using __maybe_const_map = __fmt_maybe_const<_Rp, _CharT>; | |
| 138 | using __element_type = remove_cvref_t<ranges::range_reference_t<__maybe_const_map>>; | |
| 139 | range_formatter<__element_type, _CharT> __underlying_; | |
| 140 | ||
| 141 | public: | |
| 142 | _LIBCPP_HIDE_FROM_ABI constexpr __range_default_formatter() | |
| 143 | requires(__fmt_pair_like<__element_type>) | |
| 144 | { | |
| 145 | __underlying_.set_brackets(_LIBCPP_STATICALLY_WIDEN(_CharT, "{"), _LIBCPP_STATICALLY_WIDEN(_CharT, "}")); | |
| 146 | __underlying_.underlying().set_brackets({}, {}); | |
| 147 | __underlying_.underlying().set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ": ")); | |
| 148 | } | |
| 149 | ||
| 150 | template <class _ParseContext> | |
| 151 | _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { | |
| 152 | return __underlying_.parse(__ctx); | |
| 153 | } | |
| 154 | ||
| 155 | template <class _FormatContext> | |
| 156 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator | |
| 157 | format(__maybe_const_map& __range, _FormatContext& __ctx) const { | |
| 158 | return __underlying_.format(__range, __ctx); | |
| 159 | } | |
| 160 | }; | |
| 161 | ||
| 162 | template <ranges::input_range _Rp, class _CharT> | |
| 163 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __range_default_formatter<range_format::set, _Rp, _CharT> { | |
| 164 | private: | |
| 165 | using __maybe_const_set = __fmt_maybe_const<_Rp, _CharT>; | |
| 166 | using __element_type = remove_cvref_t<ranges::range_reference_t<__maybe_const_set>>; | |
| 167 | range_formatter<__element_type, _CharT> __underlying_; | |
| 168 | ||
| 169 | public: | |
| 170 | _LIBCPP_HIDE_FROM_ABI constexpr __range_default_formatter() { | |
| 171 | __underlying_.set_brackets(_LIBCPP_STATICALLY_WIDEN(_CharT, "{"), _LIBCPP_STATICALLY_WIDEN(_CharT, "}")); | |
| 172 | } | |
| 173 | ||
| 174 | template <class _ParseContext> | |
| 175 | _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { | |
| 176 | return __underlying_.parse(__ctx); | |
| 177 | } | |
| 178 | ||
| 179 | template <class _FormatContext> | |
| 180 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator | |
| 181 | format(__maybe_const_set& __range, _FormatContext& __ctx) const { | |
| 182 | return __underlying_.format(__range, __ctx); | |
| 183 | } | |
| 184 | }; | |
| 185 | ||
| 186 | template <range_format _Kp, ranges::input_range _Rp, class _CharT> | |
| 187 | requires(_Kp == range_format::string || _Kp == range_format::debug_string) | |
| 188 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __range_default_formatter<_Kp, _Rp, _CharT> { | |
| 189 | __range_default_formatter() = delete; // TODO FMT Implement | |
| 190 | }; | |
| 191 | ||
| 192 | template <ranges::input_range _Rp, class _CharT> | |
| 193 | requires(format_kind<_Rp> != range_format::disabled && formattable<ranges::range_reference_t<_Rp>, _CharT>) | |
| 194 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<_Rp, _CharT> | |
| 195 | : __range_default_formatter<format_kind<_Rp>, _Rp, _CharT> {}; | |
| 196 | ||
| 197 | #endif //_LIBCPP_STD_VER > 20 | |
| 198 | ||
| 199 | _LIBCPP_END_NAMESPACE_STD | |
| 200 | ||
| 201 | #endif // _LIBCPP___FORMAT_RANGE_DEFAULT_FORMATTER_H |
lib/libcxx/include/__format/range_formatter.h created+255| ... | ... | @@ -0,0 +1,255 @@ |
| 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_RANGE_FORMATTER_H | |
| 11 | #define _LIBCPP___FORMAT_RANGE_FORMATTER_H | |
| 12 | ||
| 13 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 14 | # pragma GCC system_header | |
| 15 | #endif | |
| 16 | ||
| 17 | #include <__algorithm/ranges_copy.h> | |
| 18 | #include <__availability> | |
| 19 | #include <__chrono/statically_widen.h> | |
| 20 | #include <__concepts/same_as.h> | |
| 21 | #include <__config> | |
| 22 | #include <__format/buffer.h> | |
| 23 | #include <__format/concepts.h> | |
| 24 | #include <__format/format_args.h> | |
| 25 | #include <__format/format_context.h> | |
| 26 | #include <__format/format_error.h> | |
| 27 | #include <__format/formatter.h> | |
| 28 | #include <__format/formatter_output.h> | |
| 29 | #include <__format/parser_std_format_spec.h> | |
| 30 | #include <__iterator/back_insert_iterator.h> | |
| 31 | #include <__ranges/concepts.h> | |
| 32 | #include <__ranges/data.h> | |
| 33 | #include <__ranges/size.h> | |
| 34 | #include <__type_traits/remove_cvref.h> | |
| 35 | #include <string_view> | |
| 36 | ||
| 37 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 38 | ||
| 39 | #if _LIBCPP_STD_VER > 20 | |
| 40 | ||
| 41 | template <class _Tp, class _CharT = char> | |
| 42 | requires same_as<remove_cvref_t<_Tp>, _Tp> && formattable<_Tp, _CharT> | |
| 43 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT range_formatter { | |
| 44 | _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) { | |
| 45 | __separator_ = __separator; | |
| 46 | } | |
| 47 | _LIBCPP_HIDE_FROM_ABI constexpr void | |
| 48 | set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) { | |
| 49 | __opening_bracket_ = __opening_bracket; | |
| 50 | __closing_bracket_ = __closing_bracket; | |
| 51 | } | |
| 52 | ||
| 53 | _LIBCPP_HIDE_FROM_ABI constexpr formatter<_Tp, _CharT>& underlying() { return __underlying_; } | |
| 54 | _LIBCPP_HIDE_FROM_ABI constexpr const formatter<_Tp, _CharT>& underlying() const { return __underlying_; } | |
| 55 | ||
| 56 | template <class _ParseContext> | |
| 57 | _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __parse_ctx) { | |
| 58 | const _CharT* __begin = __parser_.__parse(__parse_ctx, __format_spec::__fields_range); | |
| 59 | const _CharT* __end = __parse_ctx.end(); | |
| 60 | if (__begin == __end) | |
| 61 | return __begin; | |
| 62 | ||
| 63 | // The n field overrides a possible m type, therefore delay applying the | |
| 64 | // effect of n until the type has been procesed. | |
| 65 | bool __clear_brackets = (*__begin == _CharT('n')); | |
| 66 | if (__clear_brackets) { | |
| 67 | ++__begin; | |
| 68 | if (__begin == __end) { | |
| 69 | // Since there is no more data, clear the brackets before returning. | |
| 70 | set_brackets({}, {}); | |
| 71 | return __begin; | |
| 72 | } | |
| 73 | } | |
| 74 | ||
| 75 | __parse_type(__begin, __end); | |
| 76 | if (__clear_brackets) | |
| 77 | set_brackets({}, {}); | |
| 78 | if (__begin == __end) | |
| 79 | return __begin; | |
| 80 | ||
| 81 | bool __has_range_underlying_spec = *__begin == _CharT(':'); | |
| 82 | if (__parser_.__type_ != __format_spec::__type::__default) { | |
| 83 | // [format.range.formatter]/6 | |
| 84 | // If the range-type is s or ?s, then there shall be no n option and no | |
| 85 | // range-underlying-spec. | |
| 86 | if (__clear_brackets) { | |
| 87 | if (__parser_.__type_ == __format_spec::__type::__string) | |
| 88 | std::__throw_format_error("The n option and type s can't be used together"); | |
| 89 | std::__throw_format_error("The n option and type ?s can't be used together"); | |
| 90 | } | |
| 91 | if (__has_range_underlying_spec) { | |
| 92 | if (__parser_.__type_ == __format_spec::__type::__string) | |
| 93 | std::__throw_format_error("Type s and an underlying format specification can't be used together"); | |
| 94 | std::__throw_format_error("Type ?s and an underlying format specification can't be used together"); | |
| 95 | } | |
| 96 | } else if (!__has_range_underlying_spec) | |
| 97 | std::__set_debug_format(__underlying_); | |
| 98 | ||
| 99 | if (__has_range_underlying_spec) { | |
| 100 | // range-underlying-spec: | |
| 101 | // : format-spec | |
| 102 | ++__begin; | |
| 103 | if (__begin == __end) | |
| 104 | return __begin; | |
| 105 | ||
| 106 | __parse_ctx.advance_to(__begin); | |
| 107 | __begin = __underlying_.parse(__parse_ctx); | |
| 108 | } | |
| 109 | ||
| 110 | if (__begin != __end && *__begin != _CharT('}')) | |
| 111 | std::__throw_format_error("The format-spec should consume the input or end with a '}'"); | |
| 112 | ||
| 113 | return __begin; | |
| 114 | } | |
| 115 | ||
| 116 | template <ranges::input_range _Rp, class _FormatContext> | |
| 117 | requires formattable<ranges::range_reference_t<_Rp>, _CharT> && | |
| 118 | same_as<remove_cvref_t<ranges::range_reference_t<_Rp>>, _Tp> | |
| 119 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(_Rp&& __range, _FormatContext& __ctx) const { | |
| 120 | __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx); | |
| 121 | ||
| 122 | if (!__specs.__has_width()) | |
| 123 | return __format_range(__range, __ctx, __specs); | |
| 124 | ||
| 125 | // The size of the buffer needed is: | |
| 126 | // - open bracket characters | |
| 127 | // - close bracket character | |
| 128 | // - n elements where every element may have a different size | |
| 129 | // - (n -1) separators | |
| 130 | // The size of the element is hard to predict, knowing the type helps but | |
| 131 | // it depends on the format-spec. As an initial estimate we guess 6 | |
| 132 | // characters. | |
| 133 | // Typically both brackets are 1 character and the separator is 2 | |
| 134 | // characters. Which means there will be | |
| 135 | // (n - 1) * 2 + 1 + 1 = n * 2 character | |
| 136 | // So estimate 8 times the range size as buffer. | |
| 137 | std::size_t __capacity_hint = 0; | |
| 138 | if constexpr (std::ranges::sized_range<_Rp>) | |
| 139 | __capacity_hint = 8 * ranges::size(__range); | |
| 140 | __format::__retarget_buffer<_CharT> __buffer{__capacity_hint}; | |
| 141 | basic_format_context<typename __format::__retarget_buffer<_CharT>::__iterator, _CharT> __c{ | |
| 142 | __buffer.__make_output_iterator(), __ctx}; | |
| 143 | ||
| 144 | __format_range(__range, __c, __specs); | |
| 145 | ||
| 146 | return __formatter::__write_string_no_precision(__buffer.__view(), __ctx.out(), __specs); | |
| 147 | } | |
| 148 | ||
| 149 | template <ranges::input_range _Rp, class _FormatContext> | |
| 150 | typename _FormatContext::iterator _LIBCPP_HIDE_FROM_ABI | |
| 151 | __format_range(_Rp&& __range, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) const { | |
| 152 | if constexpr (same_as<_Tp, _CharT>) { | |
| 153 | switch (__specs.__std_.__type_) { | |
| 154 | case __format_spec::__type::__string: | |
| 155 | case __format_spec::__type::__debug: | |
| 156 | return __format_as_string(__range, __ctx, __specs.__std_.__type_ == __format_spec::__type::__debug); | |
| 157 | default: | |
| 158 | return __format_as_sequence(__range, __ctx); | |
| 159 | } | |
| 160 | } else | |
| 161 | return __format_as_sequence(__range, __ctx); | |
| 162 | } | |
| 163 | ||
| 164 | template <ranges::input_range _Rp, class _FormatContext> | |
| 165 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator | |
| 166 | __format_as_string(_Rp&& __range, _FormatContext& __ctx, bool __debug_format) const { | |
| 167 | // When the range is contiguous use a basic_string_view instead to avoid a | |
| 168 | // copy of the underlying data. The basic_string_view formatter | |
| 169 | // specialization is the "basic" string formatter in libc++. | |
| 170 | if constexpr (ranges::contiguous_range<_Rp> && std::ranges::sized_range<_Rp>) { | |
| 171 | std::formatter<basic_string_view<_CharT>, _CharT> __formatter; | |
| 172 | if (__debug_format) | |
| 173 | __formatter.set_debug_format(); | |
| 174 | return __formatter.format( | |
| 175 | basic_string_view<_CharT>{ | |
| 176 | ranges::data(__range), | |
| 177 | ranges::size(__range), | |
| 178 | }, | |
| 179 | __ctx); | |
| 180 | } else { | |
| 181 | std::formatter<basic_string<_CharT>, _CharT> __formatter; | |
| 182 | if (__debug_format) | |
| 183 | __formatter.set_debug_format(); | |
| 184 | // P2106's from_range has not been implemented yet. Instead use a simple | |
| 185 | // copy operation. | |
| 186 | // TODO FMT use basic_string's "from_range" constructor. | |
| 187 | // return std::formatter<basic_string<_CharT>, _CharT>{}.format(basic_string<_CharT>{from_range, __range}, __ctx); | |
| 188 | basic_string<_CharT> __str; | |
| 189 | ranges::copy(__range, back_insert_iterator{__str}); | |
| 190 | return __formatter.format(__str, __ctx); | |
| 191 | } | |
| 192 | } | |
| 193 | ||
| 194 | template <ranges::input_range _Rp, class _FormatContext> | |
| 195 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator | |
| 196 | __format_as_sequence(_Rp&& __range, _FormatContext& __ctx) const { | |
| 197 | __ctx.advance_to(ranges::copy(__opening_bracket_, __ctx.out()).out); | |
| 198 | bool __use_separator = false; | |
| 199 | for (auto&& __e : __range) { | |
| 200 | if (__use_separator) | |
| 201 | __ctx.advance_to(ranges::copy(__separator_, __ctx.out()).out); | |
| 202 | else | |
| 203 | __use_separator = true; | |
| 204 | ||
| 205 | __ctx.advance_to(__underlying_.format(__e, __ctx)); | |
| 206 | } | |
| 207 | ||
| 208 | return ranges::copy(__closing_bracket_, __ctx.out()).out; | |
| 209 | } | |
| 210 | ||
| 211 | __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__left}; | |
| 212 | ||
| 213 | private: | |
| 214 | _LIBCPP_HIDE_FROM_ABI constexpr void __parse_type(const _CharT*& __begin, const _CharT* __end) { | |
| 215 | switch (*__begin) { | |
| 216 | case _CharT('m'): | |
| 217 | if constexpr (__fmt_pair_like<_Tp>) { | |
| 218 | set_brackets(_LIBCPP_STATICALLY_WIDEN(_CharT, "{"), _LIBCPP_STATICALLY_WIDEN(_CharT, "}")); | |
| 219 | set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ", ")); | |
| 220 | ++__begin; | |
| 221 | } else | |
| 222 | std::__throw_format_error("The range-format-spec type m requires two elements for a pair or tuple"); | |
| 223 | break; | |
| 224 | ||
| 225 | case _CharT('s'): | |
| 226 | if constexpr (same_as<_Tp, _CharT>) { | |
| 227 | __parser_.__type_ = __format_spec::__type::__string; | |
| 228 | ++__begin; | |
| 229 | } else | |
| 230 | std::__throw_format_error("The range-format-spec type s requires formatting a character type"); | |
| 231 | break; | |
| 232 | ||
| 233 | case _CharT('?'): | |
| 234 | ++__begin; | |
| 235 | if (__begin == __end || *__begin != _CharT('s')) | |
| 236 | std::__throw_format_error("The format-spec should consume the input or end with a '}'"); | |
| 237 | if constexpr (same_as<_Tp, _CharT>) { | |
| 238 | __parser_.__type_ = __format_spec::__type::__debug; | |
| 239 | ++__begin; | |
| 240 | } else | |
| 241 | std::__throw_format_error("The range-format-spec type ?s requires formatting a character type"); | |
| 242 | } | |
| 243 | } | |
| 244 | ||
| 245 | formatter<_Tp, _CharT> __underlying_; | |
| 246 | basic_string_view<_CharT> __separator_ = _LIBCPP_STATICALLY_WIDEN(_CharT, ", "); | |
| 247 | basic_string_view<_CharT> __opening_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "["); | |
| 248 | basic_string_view<_CharT> __closing_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "]"); | |
| 249 | }; | |
| 250 | ||
| 251 | #endif //_LIBCPP_STD_VER > 20 | |
| 252 | ||
| 253 | _LIBCPP_END_NAMESPACE_STD | |
| 254 | ||
| 255 | #endif // _LIBCPP___FORMAT_RANGE_FORMATTER_H |
lib/libcxx/include/__format/unicode.h+161-11| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | #include <__assert> |
| 14 | 14 | #include <__config> |
| 15 | 15 | #include <__format/extended_grapheme_cluster_table.h> |
| 16 | #include <__type_traits/make_unsigned.h> | |
| 16 | 17 | #include <__utility/unreachable.h> |
| 17 | 18 | #include <bit> |
| 18 | 19 | |
| ... | ... | @@ -24,6 +25,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 25 | |
| 25 | 26 | #if _LIBCPP_STD_VER > 17 |
| 26 | 27 | |
| 28 | namespace __unicode { | |
| 29 | ||
| 30 | # if _LIBCPP_STD_VER > 20 | |
| 31 | ||
| 32 | /// The result of consuming a code point using P2286' semantics | |
| 33 | /// | |
| 34 | /// TODO FMT Combine __consume and __consume_p2286 in one function. | |
| 35 | struct __consume_p2286_result { | |
| 36 | // A size of 0 means well formed. This to differenciate between | |
| 37 | // a valid code point and a code unit that's invalid like 0b11111xxx. | |
| 38 | int __ill_formed_size; | |
| 39 | ||
| 40 | // If well formed the consumed code point. | |
| 41 | // Otherwise the ill-formed code units as unsigned 8-bit values. They are | |
| 42 | // stored in reverse order, to make it easier to extract the values. | |
| 43 | char32_t __value; | |
| 44 | }; | |
| 45 | ||
| 46 | # endif // _LIBCPP_STD_VER > 20 | |
| 47 | ||
| 27 | 48 | # ifndef _LIBCPP_HAS_NO_UNICODE |
| 28 | 49 | |
| 29 | 50 | /// Implements the grapheme cluster boundary rules |
| ... | ... | @@ -39,8 +60,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 39 | 60 | /// https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt |
| 40 | 61 | /// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt (for testing only) |
| 41 | 62 | |
| 42 | namespace __unicode { | |
| 43 | ||
| 44 | 63 | inline constexpr char32_t __replacement_character = U'\ufffd'; |
| 45 | 64 | |
| 46 | 65 | _LIBCPP_HIDE_FROM_ABI constexpr bool __is_continuation(const char* __char, int __count) { |
| ... | ... | @@ -123,18 +142,92 @@ public: |
| 123 | 142 | return __replacement_character; |
| 124 | 143 | } |
| 125 | 144 | |
| 145 | # if _LIBCPP_STD_VER > 20 | |
| 146 | _LIBCPP_HIDE_FROM_ABI constexpr __consume_p2286_result __consume_p2286() noexcept { | |
| 147 | _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); | |
| 148 | ||
| 149 | // Based on the number of leading 1 bits the number of code units in the | |
| 150 | // code point can be determined. See | |
| 151 | // https://en.wikipedia.org/wiki/UTF-8#Encoding | |
| 152 | switch (std::countl_one(static_cast<unsigned char>(*__first_))) { | |
| 153 | case 0: | |
| 154 | return {0, static_cast<unsigned char>(*__first_++)}; | |
| 155 | ||
| 156 | case 2: | |
| 157 | if (__last_ - __first_ < 2) [[unlikely]] | |
| 158 | break; | |
| 159 | ||
| 160 | if (__unicode::__is_continuation(__first_ + 1, 1)) { | |
| 161 | char32_t __value = static_cast<unsigned char>(*__first_++) & 0x1f; | |
| 162 | __value <<= 6; | |
| 163 | __value |= static_cast<unsigned char>(*__first_++) & 0x3f; | |
| 164 | return {0, __value}; | |
| 165 | } | |
| 166 | break; | |
| 167 | ||
| 168 | case 3: | |
| 169 | if (__last_ - __first_ < 3) [[unlikely]] | |
| 170 | break; | |
| 171 | ||
| 172 | if (__unicode::__is_continuation(__first_ + 1, 2)) { | |
| 173 | char32_t __value = static_cast<unsigned char>(*__first_++) & 0x0f; | |
| 174 | __value <<= 6; | |
| 175 | __value |= static_cast<unsigned char>(*__first_++) & 0x3f; | |
| 176 | __value <<= 6; | |
| 177 | __value |= static_cast<unsigned char>(*__first_++) & 0x3f; | |
| 178 | return {0, __value}; | |
| 179 | } | |
| 180 | break; | |
| 181 | ||
| 182 | case 4: | |
| 183 | if (__last_ - __first_ < 4) [[unlikely]] | |
| 184 | break; | |
| 185 | ||
| 186 | if (__unicode::__is_continuation(__first_ + 1, 3)) { | |
| 187 | char32_t __value = static_cast<unsigned char>(*__first_++) & 0x07; | |
| 188 | __value <<= 6; | |
| 189 | __value |= static_cast<unsigned char>(*__first_++) & 0x3f; | |
| 190 | __value <<= 6; | |
| 191 | __value |= static_cast<unsigned char>(*__first_++) & 0x3f; | |
| 192 | __value <<= 6; | |
| 193 | __value |= static_cast<unsigned char>(*__first_++) & 0x3f; | |
| 194 | ||
| 195 | if (__value > 0x10FFFF) // Outside the valid Unicode range? | |
| 196 | return {4, __value}; | |
| 197 | ||
| 198 | return {0, __value}; | |
| 199 | } | |
| 200 | break; | |
| 201 | } | |
| 202 | // An invalid number of leading ones can be garbage or a code unit in the | |
| 203 | // middle of a code point. By consuming one code unit the parser may get | |
| 204 | // "in sync" after a few code units. | |
| 205 | return {1, static_cast<unsigned char>(*__first_++)}; | |
| 206 | } | |
| 207 | # endif // _LIBCPP_STD_VER > 20 | |
| 208 | ||
| 126 | 209 | private: |
| 127 | 210 | const char* __first_; |
| 128 | 211 | const char* __last_; |
| 129 | 212 | }; |
| 130 | 213 | |
| 131 | # ifndef TEST_HAS_NO_WIDE_CHARACTERS | |
| 214 | # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 215 | _LIBCPP_HIDE_FROM_ABI constexpr bool __is_surrogate_pair_high(wchar_t __value) { | |
| 216 | return __value >= 0xd800 && __value <= 0xdbff; | |
| 217 | } | |
| 218 | ||
| 219 | _LIBCPP_HIDE_FROM_ABI constexpr bool __is_surrogate_pair_low(wchar_t __value) { | |
| 220 | return __value >= 0xdc00 && __value <= 0xdfff; | |
| 221 | } | |
| 222 | ||
| 132 | 223 | /// This specialization depends on the size of wchar_t |
| 133 | 224 | /// - 2 UTF-16 (for example Windows and AIX) |
| 134 | 225 | /// - 4 UTF-32 (for example Linux) |
| 135 | 226 | template <> |
| 136 | 227 | class __code_point_view<wchar_t> { |
| 137 | 228 | public: |
| 229 | static_assert(sizeof(wchar_t) == 2 || sizeof(wchar_t) == 4, "sizeof(wchar_t) has a not implemented value"); | |
| 230 | ||
| 138 | 231 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(const wchar_t* __first, const wchar_t* __last) |
| 139 | 232 | : __first_(__first), __last_(__last) {} |
| 140 | 233 | |
| ... | ... | @@ -166,17 +259,43 @@ public: |
| 166 | 259 | return __replacement_character; |
| 167 | 260 | return __result; |
| 168 | 261 | } else { |
| 169 | // TODO FMT P2593R0 Use static_assert(false, "sizeof(wchar_t) has a not implemented value"); | |
| 170 | _LIBCPP_ASSERT(sizeof(wchar_t) == 0, "sizeof(wchar_t) has a not implemented value"); | |
| 171 | 262 | __libcpp_unreachable(); |
| 172 | 263 | } |
| 173 | 264 | } |
| 174 | 265 | |
| 266 | # if _LIBCPP_STD_VER > 20 | |
| 267 | _LIBCPP_HIDE_FROM_ABI constexpr __consume_p2286_result __consume_p2286() noexcept { | |
| 268 | _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); | |
| 269 | ||
| 270 | char32_t __result = *__first_++; | |
| 271 | if constexpr (sizeof(wchar_t) == 2) { | |
| 272 | // https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF | |
| 273 | if (__is_surrogate_pair_high(__result)) { | |
| 274 | // Malformed Unicode. | |
| 275 | if (__first_ == __last_ || !__is_surrogate_pair_low(*(__first_ + 1))) [[unlikely]] | |
| 276 | return {1, __result}; | |
| 277 | ||
| 278 | __result -= 0xd800; | |
| 279 | __result <<= 10; | |
| 280 | __result += *__first_++ - 0xdc00; | |
| 281 | __result += 0x10000; | |
| 282 | } else if (__is_surrogate_pair_low(__result)) | |
| 283 | // A code point shouldn't start with the low surrogate pair | |
| 284 | return {1, __result}; | |
| 285 | } else { | |
| 286 | if (__result > 0x10FFFF) [[unlikely]] | |
| 287 | return {1, __result}; | |
| 288 | } | |
| 289 | ||
| 290 | return {0, __result}; | |
| 291 | } | |
| 292 | # endif // _LIBCPP_STD_VER > 20 | |
| 293 | ||
| 175 | 294 | private: |
| 176 | 295 | const wchar_t* __first_; |
| 177 | 296 | const wchar_t* __last_; |
| 178 | 297 | }; |
| 179 | # endif | |
| 298 | # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 180 | 299 | |
| 181 | 300 | _LIBCPP_HIDE_FROM_ABI constexpr bool __at_extended_grapheme_cluster_break( |
| 182 | 301 | bool& __ri_break_allowed, |
| ... | ... | @@ -251,10 +370,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __at_extended_grapheme_cluster_break( |
| 251 | 370 | |
| 252 | 371 | if (__prev == __property::__Regional_Indicator && __next == __property::__Regional_Indicator) { // GB12 + GB13 |
| 253 | 372 | __ri_break_allowed = !__ri_break_allowed; |
| 254 | if (__ri_break_allowed) | |
| 255 | return true; | |
| 256 | ||
| 257 | return false; | |
| 373 | return __ri_break_allowed; | |
| 258 | 374 | } |
| 259 | 375 | |
| 260 | 376 | // *** Otherwise, break everywhere. *** |
| ... | ... | @@ -328,10 +444,44 @@ private: |
| 328 | 444 | } |
| 329 | 445 | }; |
| 330 | 446 | |
| 331 | } // namespace __unicode | |
| 447 | template <class _CharT> | |
| 448 | __extended_grapheme_cluster_view(const _CharT*, const _CharT*) -> __extended_grapheme_cluster_view<_CharT>; | |
| 449 | ||
| 450 | # else // _LIBCPP_HAS_NO_UNICODE | |
| 451 | ||
| 452 | // For ASCII every character is a "code point". | |
| 453 | // This makes it easier to write code agnostic of the _LIBCPP_HAS_NO_UNICODE define. | |
| 454 | template <class _CharT> | |
| 455 | class __code_point_view { | |
| 456 | public: | |
| 457 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(const _CharT* __first, const _CharT* __last) | |
| 458 | : __first_(__first), __last_(__last) {} | |
| 459 | ||
| 460 | _LIBCPP_HIDE_FROM_ABI constexpr bool __at_end() const noexcept { return __first_ == __last_; } | |
| 461 | _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __position() const noexcept { return __first_; } | |
| 462 | ||
| 463 | _LIBCPP_HIDE_FROM_ABI constexpr char32_t __consume() noexcept { | |
| 464 | _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); | |
| 465 | return *__first_++; | |
| 466 | } | |
| 467 | ||
| 468 | # if _LIBCPP_STD_VER > 20 | |
| 469 | _LIBCPP_HIDE_FROM_ABI constexpr __consume_p2286_result __consume_p2286() noexcept { | |
| 470 | _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); | |
| 471 | ||
| 472 | return {0, std::make_unsigned_t<_CharT>(*__first_++)}; | |
| 473 | } | |
| 474 | # endif // _LIBCPP_STD_VER > 20 | |
| 475 | ||
| 476 | private: | |
| 477 | const _CharT* __first_; | |
| 478 | const _CharT* __last_; | |
| 479 | }; | |
| 332 | 480 | |
| 333 | 481 | # endif // _LIBCPP_HAS_NO_UNICODE |
| 334 | 482 | |
| 483 | } // namespace __unicode | |
| 484 | ||
| 335 | 485 | #endif //_LIBCPP_STD_VER > 17 |
| 336 | 486 | |
| 337 | 487 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__functional/binary_negate.h+3-3| ... | ... | @@ -29,17 +29,17 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 binary_negate |
| 29 | 29 | { |
| 30 | 30 | _Predicate __pred_; |
| 31 | 31 | public: |
| 32 | _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 32 | _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 33 | 33 | binary_negate(const _Predicate& __pred) : __pred_(__pred) {} |
| 34 | 34 | |
| 35 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 35 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 36 | 36 | bool operator()(const typename _Predicate::first_argument_type& __x, |
| 37 | 37 | const typename _Predicate::second_argument_type& __y) const |
| 38 | 38 | {return !__pred_(__x, __y);} |
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | 41 | template <class _Predicate> |
| 42 | _LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 42 | _LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 43 | 43 | binary_negate<_Predicate> |
| 44 | 44 | not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);} |
| 45 | 45 |
lib/libcxx/include/__functional/bind.h+14-14| ... | ... | @@ -25,9 +25,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | 25 | |
| 26 | 26 | template<class _Tp> |
| 27 | 27 | struct is_bind_expression : _If< |
| 28 | _IsSame<_Tp, __uncvref_t<_Tp> >::value, | |
| 28 | _IsSame<_Tp, __remove_cvref_t<_Tp> >::value, | |
| 29 | 29 | false_type, |
| 30 | is_bind_expression<__uncvref_t<_Tp> > | |
| 30 | is_bind_expression<__remove_cvref_t<_Tp> > | |
| 31 | 31 | > {}; |
| 32 | 32 | |
| 33 | 33 | #if _LIBCPP_STD_VER > 14 |
| ... | ... | @@ -37,9 +37,9 @@ inline constexpr size_t is_bind_expression_v = is_bind_expression<_Tp>::value; |
| 37 | 37 | |
| 38 | 38 | template<class _Tp> |
| 39 | 39 | struct is_placeholder : _If< |
| 40 | _IsSame<_Tp, __uncvref_t<_Tp> >::value, | |
| 40 | _IsSame<_Tp, __remove_cvref_t<_Tp> >::value, | |
| 41 | 41 | integral_constant<int, 0>, |
| 42 | is_placeholder<__uncvref_t<_Tp> > | |
| 42 | is_placeholder<__remove_cvref_t<_Tp> > | |
| 43 | 43 | > {}; |
| 44 | 44 | |
| 45 | 45 | #if _LIBCPP_STD_VER > 14 |
| ... | ... | @@ -279,16 +279,16 @@ public: |
| 279 | 279 | class = typename enable_if |
| 280 | 280 | < |
| 281 | 281 | is_constructible<_Fd, _Gp>::value && |
| 282 | !is_same<typename remove_reference<_Gp>::type, | |
| 282 | !is_same<__libcpp_remove_reference_t<_Gp>, | |
| 283 | 283 | __bind>::value |
| 284 | 284 | >::type> |
| 285 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 285 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 286 | 286 | explicit __bind(_Gp&& __f, _BA&& ...__bound_args) |
| 287 | 287 | : __f_(_VSTD::forward<_Gp>(__f)), |
| 288 | 288 | __bound_args_(_VSTD::forward<_BA>(__bound_args)...) {} |
| 289 | 289 | |
| 290 | 290 | template <class ..._Args> |
| 291 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 291 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 292 | 292 | typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type |
| 293 | 293 | operator()(_Args&& ...__args) |
| 294 | 294 | { |
| ... | ... | @@ -297,7 +297,7 @@ public: |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | template <class ..._Args> |
| 300 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 300 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 301 | 301 | typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type |
| 302 | 302 | operator()(_Args&& ...__args) const |
| 303 | 303 | { |
| ... | ... | @@ -324,16 +324,16 @@ public: |
| 324 | 324 | class = typename enable_if |
| 325 | 325 | < |
| 326 | 326 | is_constructible<_Fd, _Gp>::value && |
| 327 | !is_same<typename remove_reference<_Gp>::type, | |
| 327 | !is_same<__libcpp_remove_reference_t<_Gp>, | |
| 328 | 328 | __bind_r>::value |
| 329 | 329 | >::type> |
| 330 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 330 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 331 | 331 | explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args) |
| 332 | 332 | : base(_VSTD::forward<_Gp>(__f), |
| 333 | 333 | _VSTD::forward<_BA>(__bound_args)...) {} |
| 334 | 334 | |
| 335 | 335 | template <class ..._Args> |
| 336 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 336 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 337 | 337 | typename enable_if |
| 338 | 338 | < |
| 339 | 339 | is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type, |
| ... | ... | @@ -347,7 +347,7 @@ public: |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | template <class ..._Args> |
| 350 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 350 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 351 | 351 | typename enable_if |
| 352 | 352 | < |
| 353 | 353 | is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type, |
| ... | ... | @@ -365,7 +365,7 @@ template<class _Rp, class _Fp, class ..._BoundArgs> |
| 365 | 365 | struct is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {}; |
| 366 | 366 | |
| 367 | 367 | template<class _Fp, class ..._BoundArgs> |
| 368 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 368 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 369 | 369 | __bind<_Fp, _BoundArgs...> |
| 370 | 370 | bind(_Fp&& __f, _BoundArgs&&... __bound_args) |
| 371 | 371 | { |
| ... | ... | @@ -374,7 +374,7 @@ bind(_Fp&& __f, _BoundArgs&&... __bound_args) |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | template<class _Rp, class _Fp, class ..._BoundArgs> |
| 377 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 377 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 378 | 378 | __bind_r<_Rp, _Fp, _BoundArgs...> |
| 379 | 379 | bind(_Fp&& __f, _BoundArgs&&... __bound_args) |
| 380 | 380 | { |
lib/libcxx/include/__functional/boyer_moore_searcher.h+2| ... | ... | @@ -223,6 +223,7 @@ private: |
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | }; |
| 226 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(boyer_moore_searcher); | |
| 226 | 227 | |
| 227 | 228 | template <class _RandomAccessIterator1, |
| 228 | 229 | class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, |
| ... | ... | @@ -303,6 +304,7 @@ private: |
| 303 | 304 | return std::make_pair(__l, __l); |
| 304 | 305 | } |
| 305 | 306 | }; |
| 307 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(boyer_moore_horspool_searcher); | |
| 306 | 308 | |
| 307 | 309 | _LIBCPP_END_NAMESPACE_STD |
| 308 | 310 |
lib/libcxx/include/__functional/default_searcher.h+3-2| ... | ... | @@ -29,13 +29,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 29 | template<class _ForwardIterator, class _BinaryPredicate = equal_to<>> |
| 30 | 30 | class _LIBCPP_TEMPLATE_VIS default_searcher { |
| 31 | 31 | public: |
| 32 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 32 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 33 | 33 | default_searcher(_ForwardIterator __f, _ForwardIterator __l, |
| 34 | 34 | _BinaryPredicate __p = _BinaryPredicate()) |
| 35 | 35 | : __first_(__f), __last_(__l), __pred_(__p) {} |
| 36 | 36 | |
| 37 | 37 | template <typename _ForwardIterator2> |
| 38 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 38 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 39 | 39 | pair<_ForwardIterator2, _ForwardIterator2> |
| 40 | 40 | operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const |
| 41 | 41 | { |
| ... | ... | @@ -48,6 +48,7 @@ private: |
| 48 | 48 | _ForwardIterator __last_; |
| 49 | 49 | _BinaryPredicate __pred_; |
| 50 | 50 | }; |
| 51 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(default_searcher); | |
| 51 | 52 | |
| 52 | 53 | #endif // _LIBCPP_STD_VER > 14 |
| 53 | 54 |
lib/libcxx/include/__functional/function.h+29-1636| ... | ... | @@ -17,20 +17,29 @@ |
| 17 | 17 | #include <__functional/unary_function.h> |
| 18 | 18 | #include <__iterator/iterator_traits.h> |
| 19 | 19 | #include <__memory/addressof.h> |
| 20 | #include <__memory/allocator.h> | |
| 21 | #include <__memory/allocator_destructor.h> | |
| 20 | 22 | #include <__memory/allocator_traits.h> |
| 23 | #include <__memory/builtin_new_allocator.h> | |
| 21 | 24 | #include <__memory/compressed_pair.h> |
| 22 | #include <__memory/shared_ptr.h> | |
| 25 | #include <__memory/unique_ptr.h> | |
| 26 | #include <__type_traits/strip_signature.h> | |
| 23 | 27 | #include <__utility/forward.h> |
| 24 | 28 | #include <__utility/move.h> |
| 29 | #include <__utility/piecewise_construct.h> | |
| 25 | 30 | #include <__utility/swap.h> |
| 26 | 31 | #include <exception> |
| 27 | #include <memory> // TODO: replace with <__memory/__builtin_new_allocator.h> | |
| 32 | #include <new> | |
| 33 | #include <tuple> | |
| 28 | 34 | #include <type_traits> |
| 35 | #include <typeinfo> | |
| 29 | 36 | |
| 30 | 37 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 31 | 38 | # pragma GCC system_header |
| 32 | 39 | #endif |
| 33 | 40 | |
| 41 | #ifndef _LIBCPP_CXX03_LANG | |
| 42 | ||
| 34 | 43 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 35 | 44 | |
| 36 | 45 | // bad_function_call |
| ... | ... | @@ -45,13 +54,13 @@ public: |
| 45 | 54 | // bad_function_call will end up containing a weak definition of the vtable and |
| 46 | 55 | // typeinfo. |
| 47 | 56 | #ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION |
| 48 | virtual ~bad_function_call() _NOEXCEPT; | |
| 57 | ~bad_function_call() _NOEXCEPT override; | |
| 49 | 58 | #else |
| 50 | virtual ~bad_function_call() _NOEXCEPT {} | |
| 59 | ~bad_function_call() _NOEXCEPT override {} | |
| 51 | 60 | #endif |
| 52 | 61 | |
| 53 | 62 | #ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE |
| 54 | virtual const char* what() const _NOEXCEPT; | |
| 63 | const char* what() const _NOEXCEPT override; | |
| 55 | 64 | #endif |
| 56 | 65 | }; |
| 57 | 66 | _LIBCPP_DIAGNOSTIC_POP |
| ... | ... | @@ -66,14 +75,7 @@ void __throw_bad_function_call() |
| 66 | 75 | #endif |
| 67 | 76 | } |
| 68 | 77 | |
| 69 | #if defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) && __has_attribute(deprecated) | |
| 70 | # define _LIBCPP_DEPRECATED_CXX03_FUNCTION \ | |
| 71 | __attribute__((deprecated("Using std::function in C++03 is not supported anymore. Please upgrade to C++11 or later, or use a different type"))) | |
| 72 | #else | |
| 73 | # define _LIBCPP_DEPRECATED_CXX03_FUNCTION /* nothing */ | |
| 74 | #endif | |
| 75 | ||
| 76 | template<class _Fp> class _LIBCPP_DEPRECATED_CXX03_FUNCTION _LIBCPP_TEMPLATE_VIS function; // undefined | |
| 78 | template<class _Fp> class _LIBCPP_TEMPLATE_VIS function; // undefined | |
| 77 | 79 | |
| 78 | 80 | namespace __function |
| 79 | 81 | { |
| ... | ... | @@ -124,8 +126,6 @@ bool __not_null(_Rp (^__p)(_Args...)) { return __p; } |
| 124 | 126 | |
| 125 | 127 | } // namespace __function |
| 126 | 128 | |
| 127 | #ifndef _LIBCPP_CXX03_LANG | |
| 128 | ||
| 129 | 129 | namespace __function { |
| 130 | 130 | |
| 131 | 131 | // __alloc_func holds a functor and an allocator. |
| ... | ... | @@ -190,9 +190,7 @@ class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)> |
| 190 | 190 | __alloc_func* __clone() const |
| 191 | 191 | { |
| 192 | 192 | typedef allocator_traits<_Alloc> __alloc_traits; |
| 193 | typedef | |
| 194 | typename __rebind_alloc_helper<__alloc_traits, __alloc_func>::type | |
| 195 | _AA; | |
| 193 | typedef __rebind_alloc<__alloc_traits, __alloc_func> _AA; | |
| 196 | 194 | _AA __a(__f_.second()); |
| 197 | 195 | typedef __allocator_destructor<_AA> _Dp; |
| 198 | 196 | unique_ptr<__alloc_func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| ... | ... | @@ -205,8 +203,7 @@ class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)> |
| 205 | 203 | |
| 206 | 204 | static void __destroy_and_delete(__alloc_func* __f) { |
| 207 | 205 | typedef allocator_traits<_Alloc> __alloc_traits; |
| 208 | typedef typename __rebind_alloc_helper<__alloc_traits, __alloc_func>::type | |
| 209 | _FunAlloc; | |
| 206 | typedef __rebind_alloc<__alloc_traits, __alloc_func> _FunAlloc; | |
| 210 | 207 | _FunAlloc __a(__f->__get_allocator()); |
| 211 | 208 | __f->destroy(); |
| 212 | 209 | __a.deallocate(__f, 1); |
| ... | ... | @@ -265,7 +262,7 @@ class __base<_Rp(_ArgTypes...)> |
| 265 | 262 | __base& operator=(const __base&); |
| 266 | 263 | public: |
| 267 | 264 | _LIBCPP_INLINE_VISIBILITY __base() {} |
| 268 | _LIBCPP_INLINE_VISIBILITY virtual ~__base() {} | |
| 265 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__base() {} | |
| 269 | 266 | virtual __base* __clone() const = 0; |
| 270 | 267 | virtual void __clone(__base*) const = 0; |
| 271 | 268 | virtual void destroy() _NOEXCEPT = 0; |
| ... | ... | @@ -319,7 +316,7 @@ __base<_Rp(_ArgTypes...)>* |
| 319 | 316 | __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const |
| 320 | 317 | { |
| 321 | 318 | typedef allocator_traits<_Alloc> __alloc_traits; |
| 322 | typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; | |
| 319 | typedef __rebind_alloc<__alloc_traits, __func> _Ap; | |
| 323 | 320 | _Ap __a(__f_.__get_allocator()); |
| 324 | 321 | typedef __allocator_destructor<_Ap> _Dp; |
| 325 | 322 | unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| ... | ... | @@ -346,7 +343,7 @@ void |
| 346 | 343 | __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT |
| 347 | 344 | { |
| 348 | 345 | typedef allocator_traits<_Alloc> __alloc_traits; |
| 349 | typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; | |
| 346 | typedef __rebind_alloc<__alloc_traits, __func> _Ap; | |
| 350 | 347 | _Ap __a(__f_.__get_allocator()); |
| 351 | 348 | __f_.destroy(); |
| 352 | 349 | __a.deallocate(this, 1); |
| ... | ... | @@ -385,7 +382,9 @@ template <class _Fp> class __value_func; |
| 385 | 382 | |
| 386 | 383 | template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 387 | 384 | { |
| 385 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 388 | 386 | typename aligned_storage<3 * sizeof(void*)>::type __buf_; |
| 387 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 389 | 388 | |
| 390 | 389 | typedef __base<_Rp(_ArgTypes...)> __func; |
| 391 | 390 | __func* __f_; |
| ... | ... | @@ -405,8 +404,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 405 | 404 | { |
| 406 | 405 | typedef allocator_traits<_Alloc> __alloc_traits; |
| 407 | 406 | typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun; |
| 408 | typedef typename __rebind_alloc_helper<__alloc_traits, _Fun>::type | |
| 409 | _FunAlloc; | |
| 407 | typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc; | |
| 410 | 408 | |
| 411 | 409 | if (__function::__not_null(__f)) |
| 412 | 410 | { |
| ... | ... | @@ -519,7 +517,9 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 519 | 517 | return; |
| 520 | 518 | if ((void*)__f_ == &__buf_ && (void*)__f.__f_ == &__f.__buf_) |
| 521 | 519 | { |
| 520 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 522 | 521 | typename aligned_storage<sizeof(__buf_)>::type __tempbuf; |
| 522 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 523 | 523 | __func* __t = __as_base(&__tempbuf); |
| 524 | 524 | __f_->__clone(__t); |
| 525 | 525 | __f_->destroy(); |
| ... | ... | @@ -670,8 +670,7 @@ struct __policy |
| 670 | 670 | // Used to choose between perfect forwarding or pass-by-value. Pass-by-value is |
| 671 | 671 | // faster for types that can be passed in registers. |
| 672 | 672 | template <typename _Tp> |
| 673 | using __fast_forward = | |
| 674 | typename conditional<is_scalar<_Tp>::value, _Tp, _Tp&&>::type; | |
| 673 | using __fast_forward = __conditional_t<is_scalar<_Tp>::value, _Tp, _Tp&&>; | |
| 675 | 674 | |
| 676 | 675 | // __policy_invoker calls an instance of __alloc_func held in __policy_storage. |
| 677 | 676 | |
| ... | ... | @@ -747,8 +746,7 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)> |
| 747 | 746 | { |
| 748 | 747 | typedef __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun; |
| 749 | 748 | typedef allocator_traits<_Alloc> __alloc_traits; |
| 750 | typedef typename __rebind_alloc_helper<__alloc_traits, _Fun>::type | |
| 751 | _FunAlloc; | |
| 749 | typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc; | |
| 752 | 750 | |
| 753 | 751 | if (__function::__not_null(__f)) |
| 754 | 752 | { |
| ... | ... | @@ -978,7 +976,7 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)> |
| 978 | 976 | __func __f_; |
| 979 | 977 | |
| 980 | 978 | template <class _Fp, bool = _And< |
| 981 | _IsNotSame<__uncvref_t<_Fp>, function>, | |
| 979 | _IsNotSame<__remove_cvref_t<_Fp>, function>, | |
| 982 | 980 | __invokable<_Fp, _ArgTypes...> |
| 983 | 981 | >::value> |
| 984 | 982 | struct __callable; |
| ... | ... | @@ -1070,45 +1068,6 @@ public: |
| 1070 | 1068 | template<class _Rp, class ..._Ap> |
| 1071 | 1069 | function(_Rp(*)(_Ap...)) -> function<_Rp(_Ap...)>; |
| 1072 | 1070 | |
| 1073 | template<class _Fp> | |
| 1074 | struct __strip_signature; | |
| 1075 | ||
| 1076 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1077 | struct __strip_signature<_Rp (_Gp::*) (_Ap...)> { using type = _Rp(_Ap...); }; | |
| 1078 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1079 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const> { using type = _Rp(_Ap...); }; | |
| 1080 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1081 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile> { using type = _Rp(_Ap...); }; | |
| 1082 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1083 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile> { using type = _Rp(_Ap...); }; | |
| 1084 | ||
| 1085 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1086 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) &> { using type = _Rp(_Ap...); }; | |
| 1087 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1088 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const &> { using type = _Rp(_Ap...); }; | |
| 1089 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1090 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile &> { using type = _Rp(_Ap...); }; | |
| 1091 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1092 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile &> { using type = _Rp(_Ap...); }; | |
| 1093 | ||
| 1094 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1095 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) noexcept> { using type = _Rp(_Ap...); }; | |
| 1096 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1097 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const noexcept> { using type = _Rp(_Ap...); }; | |
| 1098 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1099 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile noexcept> { using type = _Rp(_Ap...); }; | |
| 1100 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1101 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile noexcept> { using type = _Rp(_Ap...); }; | |
| 1102 | ||
| 1103 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1104 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) & noexcept> { using type = _Rp(_Ap...); }; | |
| 1105 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1106 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const & noexcept> { using type = _Rp(_Ap...); }; | |
| 1107 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1108 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile & noexcept> { using type = _Rp(_Ap...); }; | |
| 1109 | template<class _Rp, class _Gp, class ..._Ap> | |
| 1110 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile & noexcept> { using type = _Rp(_Ap...); }; | |
| 1111 | ||
| 1112 | 1071 | template<class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type> |
| 1113 | 1072 | function(_Fp) -> function<_Stripped>; |
| 1114 | 1073 | #endif // _LIBCPP_STD_VER >= 17 |
| ... | ... | @@ -1250,1574 +1209,8 @@ void |
| 1250 | 1209 | swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT |
| 1251 | 1210 | {return __x.swap(__y);} |
| 1252 | 1211 | |
| 1253 | #elif defined(_LIBCPP_ENABLE_CXX03_FUNCTION) | |
| 1254 | ||
| 1255 | namespace __function { | |
| 1256 | ||
| 1257 | template<class _Fp> class __base; | |
| 1258 | ||
| 1259 | template<class _Rp> | |
| 1260 | class __base<_Rp()> | |
| 1261 | { | |
| 1262 | __base(const __base&); | |
| 1263 | __base& operator=(const __base&); | |
| 1264 | public: | |
| 1265 | __base() {} | |
| 1266 | virtual ~__base() {} | |
| 1267 | virtual __base* __clone() const = 0; | |
| 1268 | virtual void __clone(__base*) const = 0; | |
| 1269 | virtual void destroy() = 0; | |
| 1270 | virtual void destroy_deallocate() = 0; | |
| 1271 | virtual _Rp operator()() = 0; | |
| 1272 | #ifndef _LIBCPP_NO_RTTI | |
| 1273 | virtual const void* target(const type_info&) const = 0; | |
| 1274 | virtual const std::type_info& target_type() const = 0; | |
| 1275 | #endif // _LIBCPP_NO_RTTI | |
| 1276 | }; | |
| 1277 | ||
| 1278 | template<class _Rp, class _A0> | |
| 1279 | class __base<_Rp(_A0)> | |
| 1280 | { | |
| 1281 | __base(const __base&); | |
| 1282 | __base& operator=(const __base&); | |
| 1283 | public: | |
| 1284 | __base() {} | |
| 1285 | virtual ~__base() {} | |
| 1286 | virtual __base* __clone() const = 0; | |
| 1287 | virtual void __clone(__base*) const = 0; | |
| 1288 | virtual void destroy() = 0; | |
| 1289 | virtual void destroy_deallocate() = 0; | |
| 1290 | virtual _Rp operator()(_A0) = 0; | |
| 1291 | #ifndef _LIBCPP_NO_RTTI | |
| 1292 | virtual const void* target(const type_info&) const = 0; | |
| 1293 | virtual const std::type_info& target_type() const = 0; | |
| 1294 | #endif // _LIBCPP_NO_RTTI | |
| 1295 | }; | |
| 1296 | ||
| 1297 | template<class _Rp, class _A0, class _A1> | |
| 1298 | class __base<_Rp(_A0, _A1)> | |
| 1299 | { | |
| 1300 | __base(const __base&); | |
| 1301 | __base& operator=(const __base&); | |
| 1302 | public: | |
| 1303 | __base() {} | |
| 1304 | virtual ~__base() {} | |
| 1305 | virtual __base* __clone() const = 0; | |
| 1306 | virtual void __clone(__base*) const = 0; | |
| 1307 | virtual void destroy() = 0; | |
| 1308 | virtual void destroy_deallocate() = 0; | |
| 1309 | virtual _Rp operator()(_A0, _A1) = 0; | |
| 1310 | #ifndef _LIBCPP_NO_RTTI | |
| 1311 | virtual const void* target(const type_info&) const = 0; | |
| 1312 | virtual const std::type_info& target_type() const = 0; | |
| 1313 | #endif // _LIBCPP_NO_RTTI | |
| 1314 | }; | |
| 1315 | ||
| 1316 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 1317 | class __base<_Rp(_A0, _A1, _A2)> | |
| 1318 | { | |
| 1319 | __base(const __base&); | |
| 1320 | __base& operator=(const __base&); | |
| 1321 | public: | |
| 1322 | __base() {} | |
| 1323 | virtual ~__base() {} | |
| 1324 | virtual __base* __clone() const = 0; | |
| 1325 | virtual void __clone(__base*) const = 0; | |
| 1326 | virtual void destroy() = 0; | |
| 1327 | virtual void destroy_deallocate() = 0; | |
| 1328 | virtual _Rp operator()(_A0, _A1, _A2) = 0; | |
| 1329 | #ifndef _LIBCPP_NO_RTTI | |
| 1330 | virtual const void* target(const type_info&) const = 0; | |
| 1331 | virtual const std::type_info& target_type() const = 0; | |
| 1332 | #endif // _LIBCPP_NO_RTTI | |
| 1333 | }; | |
| 1334 | ||
| 1335 | template<class _FD, class _Alloc, class _FB> class __func; | |
| 1336 | ||
| 1337 | template<class _Fp, class _Alloc, class _Rp> | |
| 1338 | class __func<_Fp, _Alloc, _Rp()> | |
| 1339 | : public __base<_Rp()> | |
| 1340 | { | |
| 1341 | __compressed_pair<_Fp, _Alloc> __f_; | |
| 1342 | public: | |
| 1343 | explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {} | |
| 1344 | explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} | |
| 1345 | virtual __base<_Rp()>* __clone() const; | |
| 1346 | virtual void __clone(__base<_Rp()>*) const; | |
| 1347 | virtual void destroy(); | |
| 1348 | virtual void destroy_deallocate(); | |
| 1349 | virtual _Rp operator()(); | |
| 1350 | #ifndef _LIBCPP_NO_RTTI | |
| 1351 | virtual const void* target(const type_info&) const; | |
| 1352 | virtual const std::type_info& target_type() const; | |
| 1353 | #endif // _LIBCPP_NO_RTTI | |
| 1354 | }; | |
| 1355 | ||
| 1356 | template<class _Fp, class _Alloc, class _Rp> | |
| 1357 | __base<_Rp()>* | |
| 1358 | __func<_Fp, _Alloc, _Rp()>::__clone() const | |
| 1359 | { | |
| 1360 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 1361 | typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; | |
| 1362 | _Ap __a(__f_.second()); | |
| 1363 | typedef __allocator_destructor<_Ap> _Dp; | |
| 1364 | unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 1365 | ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 1366 | return __hold.release(); | |
| 1367 | } | |
| 1368 | ||
| 1369 | template<class _Fp, class _Alloc, class _Rp> | |
| 1370 | void | |
| 1371 | __func<_Fp, _Alloc, _Rp()>::__clone(__base<_Rp()>* __p) const | |
| 1372 | { | |
| 1373 | ::new ((void*)__p) __func(__f_.first(), __f_.second()); | |
| 1374 | } | |
| 1375 | ||
| 1376 | template<class _Fp, class _Alloc, class _Rp> | |
| 1377 | void | |
| 1378 | __func<_Fp, _Alloc, _Rp()>::destroy() | |
| 1379 | { | |
| 1380 | __f_.~__compressed_pair<_Fp, _Alloc>(); | |
| 1381 | } | |
| 1382 | ||
| 1383 | template<class _Fp, class _Alloc, class _Rp> | |
| 1384 | void | |
| 1385 | __func<_Fp, _Alloc, _Rp()>::destroy_deallocate() | |
| 1386 | { | |
| 1387 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 1388 | typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; | |
| 1389 | _Ap __a(__f_.second()); | |
| 1390 | __f_.~__compressed_pair<_Fp, _Alloc>(); | |
| 1391 | __a.deallocate(this, 1); | |
| 1392 | } | |
| 1393 | ||
| 1394 | template<class _Fp, class _Alloc, class _Rp> | |
| 1395 | _Rp | |
| 1396 | __func<_Fp, _Alloc, _Rp()>::operator()() | |
| 1397 | { | |
| 1398 | typedef __invoke_void_return_wrapper<_Rp> _Invoker; | |
| 1399 | return _Invoker::__call(__f_.first()); | |
| 1400 | } | |
| 1401 | ||
| 1402 | #ifndef _LIBCPP_NO_RTTI | |
| 1403 | ||
| 1404 | template<class _Fp, class _Alloc, class _Rp> | |
| 1405 | const void* | |
| 1406 | __func<_Fp, _Alloc, _Rp()>::target(const type_info& __ti) const | |
| 1407 | { | |
| 1408 | if (__ti == typeid(_Fp)) | |
| 1409 | return _VSTD::addressof(__f_.first()); | |
| 1410 | return (const void*)0; | |
| 1411 | } | |
| 1412 | ||
| 1413 | template<class _Fp, class _Alloc, class _Rp> | |
| 1414 | const std::type_info& | |
| 1415 | __func<_Fp, _Alloc, _Rp()>::target_type() const | |
| 1416 | { | |
| 1417 | return typeid(_Fp); | |
| 1418 | } | |
| 1419 | ||
| 1420 | #endif // _LIBCPP_NO_RTTI | |
| 1421 | ||
| 1422 | template<class _Fp, class _Alloc, class _Rp, class _A0> | |
| 1423 | class __func<_Fp, _Alloc, _Rp(_A0)> | |
| 1424 | : public __base<_Rp(_A0)> | |
| 1425 | { | |
| 1426 | __compressed_pair<_Fp, _Alloc> __f_; | |
| 1427 | public: | |
| 1428 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {} | |
| 1429 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a) | |
| 1430 | : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} | |
| 1431 | virtual __base<_Rp(_A0)>* __clone() const; | |
| 1432 | virtual void __clone(__base<_Rp(_A0)>*) const; | |
| 1433 | virtual void destroy(); | |
| 1434 | virtual void destroy_deallocate(); | |
| 1435 | virtual _Rp operator()(_A0); | |
| 1436 | #ifndef _LIBCPP_NO_RTTI | |
| 1437 | virtual const void* target(const type_info&) const; | |
| 1438 | virtual const std::type_info& target_type() const; | |
| 1439 | #endif // _LIBCPP_NO_RTTI | |
| 1440 | }; | |
| 1441 | ||
| 1442 | template<class _Fp, class _Alloc, class _Rp, class _A0> | |
| 1443 | __base<_Rp(_A0)>* | |
| 1444 | __func<_Fp, _Alloc, _Rp(_A0)>::__clone() const | |
| 1445 | { | |
| 1446 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 1447 | typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; | |
| 1448 | _Ap __a(__f_.second()); | |
| 1449 | typedef __allocator_destructor<_Ap> _Dp; | |
| 1450 | unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 1451 | ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 1452 | return __hold.release(); | |
| 1453 | } | |
| 1454 | ||
| 1455 | template<class _Fp, class _Alloc, class _Rp, class _A0> | |
| 1456 | void | |
| 1457 | __func<_Fp, _Alloc, _Rp(_A0)>::__clone(__base<_Rp(_A0)>* __p) const | |
| 1458 | { | |
| 1459 | ::new ((void*)__p) __func(__f_.first(), __f_.second()); | |
| 1460 | } | |
| 1461 | ||
| 1462 | template<class _Fp, class _Alloc, class _Rp, class _A0> | |
| 1463 | void | |
| 1464 | __func<_Fp, _Alloc, _Rp(_A0)>::destroy() | |
| 1465 | { | |
| 1466 | __f_.~__compressed_pair<_Fp, _Alloc>(); | |
| 1467 | } | |
| 1468 | ||
| 1469 | template<class _Fp, class _Alloc, class _Rp, class _A0> | |
| 1470 | void | |
| 1471 | __func<_Fp, _Alloc, _Rp(_A0)>::destroy_deallocate() | |
| 1472 | { | |
| 1473 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 1474 | typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; | |
| 1475 | _Ap __a(__f_.second()); | |
| 1476 | __f_.~__compressed_pair<_Fp, _Alloc>(); | |
| 1477 | __a.deallocate(this, 1); | |
| 1478 | } | |
| 1479 | ||
| 1480 | template<class _Fp, class _Alloc, class _Rp, class _A0> | |
| 1481 | _Rp | |
| 1482 | __func<_Fp, _Alloc, _Rp(_A0)>::operator()(_A0 __a0) | |
| 1483 | { | |
| 1484 | typedef __invoke_void_return_wrapper<_Rp> _Invoker; | |
| 1485 | return _Invoker::__call(__f_.first(), __a0); | |
| 1486 | } | |
| 1487 | ||
| 1488 | #ifndef _LIBCPP_NO_RTTI | |
| 1489 | ||
| 1490 | template<class _Fp, class _Alloc, class _Rp, class _A0> | |
| 1491 | const void* | |
| 1492 | __func<_Fp, _Alloc, _Rp(_A0)>::target(const type_info& __ti) const | |
| 1493 | { | |
| 1494 | if (__ti == typeid(_Fp)) | |
| 1495 | return &__f_.first(); | |
| 1496 | return (const void*)0; | |
| 1497 | } | |
| 1498 | ||
| 1499 | template<class _Fp, class _Alloc, class _Rp, class _A0> | |
| 1500 | const std::type_info& | |
| 1501 | __func<_Fp, _Alloc, _Rp(_A0)>::target_type() const | |
| 1502 | { | |
| 1503 | return typeid(_Fp); | |
| 1504 | } | |
| 1505 | ||
| 1506 | #endif // _LIBCPP_NO_RTTI | |
| 1507 | ||
| 1508 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1> | |
| 1509 | class __func<_Fp, _Alloc, _Rp(_A0, _A1)> | |
| 1510 | : public __base<_Rp(_A0, _A1)> | |
| 1511 | { | |
| 1512 | __compressed_pair<_Fp, _Alloc> __f_; | |
| 1513 | public: | |
| 1514 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {} | |
| 1515 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a) | |
| 1516 | : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} | |
| 1517 | virtual __base<_Rp(_A0, _A1)>* __clone() const; | |
| 1518 | virtual void __clone(__base<_Rp(_A0, _A1)>*) const; | |
| 1519 | virtual void destroy(); | |
| 1520 | virtual void destroy_deallocate(); | |
| 1521 | virtual _Rp operator()(_A0, _A1); | |
| 1522 | #ifndef _LIBCPP_NO_RTTI | |
| 1523 | virtual const void* target(const type_info&) const; | |
| 1524 | virtual const std::type_info& target_type() const; | |
| 1525 | #endif // _LIBCPP_NO_RTTI | |
| 1526 | }; | |
| 1527 | ||
| 1528 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1> | |
| 1529 | __base<_Rp(_A0, _A1)>* | |
| 1530 | __func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone() const | |
| 1531 | { | |
| 1532 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 1533 | typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; | |
| 1534 | _Ap __a(__f_.second()); | |
| 1535 | typedef __allocator_destructor<_Ap> _Dp; | |
| 1536 | unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 1537 | ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 1538 | return __hold.release(); | |
| 1539 | } | |
| 1540 | ||
| 1541 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1> | |
| 1542 | void | |
| 1543 | __func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone(__base<_Rp(_A0, _A1)>* __p) const | |
| 1544 | { | |
| 1545 | ::new ((void*)__p) __func(__f_.first(), __f_.second()); | |
| 1546 | } | |
| 1547 | ||
| 1548 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1> | |
| 1549 | void | |
| 1550 | __func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy() | |
| 1551 | { | |
| 1552 | __f_.~__compressed_pair<_Fp, _Alloc>(); | |
| 1553 | } | |
| 1554 | ||
| 1555 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1> | |
| 1556 | void | |
| 1557 | __func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy_deallocate() | |
| 1558 | { | |
| 1559 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 1560 | typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; | |
| 1561 | _Ap __a(__f_.second()); | |
| 1562 | __f_.~__compressed_pair<_Fp, _Alloc>(); | |
| 1563 | __a.deallocate(this, 1); | |
| 1564 | } | |
| 1565 | ||
| 1566 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1> | |
| 1567 | _Rp | |
| 1568 | __func<_Fp, _Alloc, _Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) | |
| 1569 | { | |
| 1570 | typedef __invoke_void_return_wrapper<_Rp> _Invoker; | |
| 1571 | return _Invoker::__call(__f_.first(), __a0, __a1); | |
| 1572 | } | |
| 1573 | ||
| 1574 | #ifndef _LIBCPP_NO_RTTI | |
| 1575 | ||
| 1576 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1> | |
| 1577 | const void* | |
| 1578 | __func<_Fp, _Alloc, _Rp(_A0, _A1)>::target(const type_info& __ti) const | |
| 1579 | { | |
| 1580 | if (__ti == typeid(_Fp)) | |
| 1581 | return &__f_.first(); | |
| 1582 | return (const void*)0; | |
| 1583 | } | |
| 1584 | ||
| 1585 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1> | |
| 1586 | const std::type_info& | |
| 1587 | __func<_Fp, _Alloc, _Rp(_A0, _A1)>::target_type() const | |
| 1588 | { | |
| 1589 | return typeid(_Fp); | |
| 1590 | } | |
| 1591 | ||
| 1592 | #endif // _LIBCPP_NO_RTTI | |
| 1593 | ||
| 1594 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2> | |
| 1595 | class __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> | |
| 1596 | : public __base<_Rp(_A0, _A1, _A2)> | |
| 1597 | { | |
| 1598 | __compressed_pair<_Fp, _Alloc> __f_; | |
| 1599 | public: | |
| 1600 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {} | |
| 1601 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a) | |
| 1602 | : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} | |
| 1603 | virtual __base<_Rp(_A0, _A1, _A2)>* __clone() const; | |
| 1604 | virtual void __clone(__base<_Rp(_A0, _A1, _A2)>*) const; | |
| 1605 | virtual void destroy(); | |
| 1606 | virtual void destroy_deallocate(); | |
| 1607 | virtual _Rp operator()(_A0, _A1, _A2); | |
| 1608 | #ifndef _LIBCPP_NO_RTTI | |
| 1609 | virtual const void* target(const type_info&) const; | |
| 1610 | virtual const std::type_info& target_type() const; | |
| 1611 | #endif // _LIBCPP_NO_RTTI | |
| 1612 | }; | |
| 1613 | ||
| 1614 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2> | |
| 1615 | __base<_Rp(_A0, _A1, _A2)>* | |
| 1616 | __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone() const | |
| 1617 | { | |
| 1618 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 1619 | typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; | |
| 1620 | _Ap __a(__f_.second()); | |
| 1621 | typedef __allocator_destructor<_Ap> _Dp; | |
| 1622 | unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 1623 | ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 1624 | return __hold.release(); | |
| 1625 | } | |
| 1626 | ||
| 1627 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2> | |
| 1628 | void | |
| 1629 | __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone(__base<_Rp(_A0, _A1, _A2)>* __p) const | |
| 1630 | { | |
| 1631 | ::new ((void*)__p) __func(__f_.first(), __f_.second()); | |
| 1632 | } | |
| 1633 | ||
| 1634 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2> | |
| 1635 | void | |
| 1636 | __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy() | |
| 1637 | { | |
| 1638 | __f_.~__compressed_pair<_Fp, _Alloc>(); | |
| 1639 | } | |
| 1640 | ||
| 1641 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2> | |
| 1642 | void | |
| 1643 | __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy_deallocate() | |
| 1644 | { | |
| 1645 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 1646 | typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; | |
| 1647 | _Ap __a(__f_.second()); | |
| 1648 | __f_.~__compressed_pair<_Fp, _Alloc>(); | |
| 1649 | __a.deallocate(this, 1); | |
| 1650 | } | |
| 1651 | ||
| 1652 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2> | |
| 1653 | _Rp | |
| 1654 | __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) | |
| 1655 | { | |
| 1656 | typedef __invoke_void_return_wrapper<_Rp> _Invoker; | |
| 1657 | return _Invoker::__call(__f_.first(), __a0, __a1, __a2); | |
| 1658 | } | |
| 1659 | ||
| 1660 | #ifndef _LIBCPP_NO_RTTI | |
| 1661 | ||
| 1662 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2> | |
| 1663 | const void* | |
| 1664 | __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target(const type_info& __ti) const | |
| 1665 | { | |
| 1666 | if (__ti == typeid(_Fp)) | |
| 1667 | return &__f_.first(); | |
| 1668 | return (const void*)0; | |
| 1669 | } | |
| 1670 | ||
| 1671 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2> | |
| 1672 | const std::type_info& | |
| 1673 | __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target_type() const | |
| 1674 | { | |
| 1675 | return typeid(_Fp); | |
| 1676 | } | |
| 1677 | ||
| 1678 | #endif // _LIBCPP_NO_RTTI | |
| 1679 | ||
| 1680 | } // namespace __function | |
| 1681 | ||
| 1682 | template<class _Rp> | |
| 1683 | class _LIBCPP_TEMPLATE_VIS function<_Rp()> | |
| 1684 | { | |
| 1685 | typedef __function::__base<_Rp()> __base; | |
| 1686 | aligned_storage<3*sizeof(void*)>::type __buf_; | |
| 1687 | __base* __f_; | |
| 1688 | ||
| 1689 | public: | |
| 1690 | typedef _Rp result_type; | |
| 1691 | ||
| 1692 | // 20.7.16.2.1, construct/copy/destroy: | |
| 1693 | _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {} | |
| 1694 | _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {} | |
| 1695 | function(const function&); | |
| 1696 | template<class _Fp> | |
| 1697 | function(_Fp, | |
| 1698 | typename enable_if<!is_integral<_Fp>::value>::type* = 0); | |
| 1699 | ||
| 1700 | template<class _Alloc> | |
| 1701 | _LIBCPP_INLINE_VISIBILITY | |
| 1702 | function(allocator_arg_t, const _Alloc&) : __f_(0) {} | |
| 1703 | template<class _Alloc> | |
| 1704 | _LIBCPP_INLINE_VISIBILITY | |
| 1705 | function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {} | |
| 1706 | template<class _Alloc> | |
| 1707 | function(allocator_arg_t, const _Alloc&, const function&); | |
| 1708 | template<class _Fp, class _Alloc> | |
| 1709 | function(allocator_arg_t, const _Alloc& __a, _Fp __f, | |
| 1710 | typename enable_if<!is_integral<_Fp>::value>::type* = 0); | |
| 1711 | ||
| 1712 | function& operator=(const function&); | |
| 1713 | function& operator=(nullptr_t); | |
| 1714 | template<class _Fp> | |
| 1715 | typename enable_if | |
| 1716 | < | |
| 1717 | !is_integral<_Fp>::value, | |
| 1718 | function& | |
| 1719 | >::type | |
| 1720 | operator=(_Fp); | |
| 1721 | ||
| 1722 | ~function(); | |
| 1723 | ||
| 1724 | // 20.7.16.2.2, function modifiers: | |
| 1725 | void swap(function&); | |
| 1726 | template<class _Fp, class _Alloc> | |
| 1727 | _LIBCPP_INLINE_VISIBILITY | |
| 1728 | void assign(_Fp __f, const _Alloc& __a) | |
| 1729 | {function(allocator_arg, __a, __f).swap(*this);} | |
| 1730 | ||
| 1731 | // 20.7.16.2.3, function capacity: | |
| 1732 | _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;} | |
| 1733 | ||
| 1734 | template<class _R2> | |
| 1735 | bool operator==(const function<_R2()>&) const = delete; | |
| 1736 | template<class _R2> | |
| 1737 | bool operator!=(const function<_R2()>&) const = delete; | |
| 1738 | ||
| 1739 | // 20.7.16.2.4, function invocation: | |
| 1740 | _Rp operator()() const; | |
| 1741 | ||
| 1742 | #ifndef _LIBCPP_NO_RTTI | |
| 1743 | // 20.7.16.2.5, function target access: | |
| 1744 | const std::type_info& target_type() const; | |
| 1745 | template <typename _Tp> _Tp* target(); | |
| 1746 | template <typename _Tp> const _Tp* target() const; | |
| 1747 | #endif // _LIBCPP_NO_RTTI | |
| 1748 | }; | |
| 1749 | ||
| 1750 | template<class _Rp> | |
| 1751 | function<_Rp()>::function(const function& __f) | |
| 1752 | { | |
| 1753 | if (__f.__f_ == 0) | |
| 1754 | __f_ = 0; | |
| 1755 | else if (__f.__f_ == (const __base*)&__f.__buf_) | |
| 1756 | { | |
| 1757 | __f_ = (__base*)&__buf_; | |
| 1758 | __f.__f_->__clone(__f_); | |
| 1759 | } | |
| 1760 | else | |
| 1761 | __f_ = __f.__f_->__clone(); | |
| 1762 | } | |
| 1763 | ||
| 1764 | template<class _Rp> | |
| 1765 | template<class _Alloc> | |
| 1766 | function<_Rp()>::function(allocator_arg_t, const _Alloc&, const function& __f) | |
| 1767 | { | |
| 1768 | if (__f.__f_ == 0) | |
| 1769 | __f_ = 0; | |
| 1770 | else if (__f.__f_ == (const __base*)&__f.__buf_) | |
| 1771 | { | |
| 1772 | __f_ = (__base*)&__buf_; | |
| 1773 | __f.__f_->__clone(__f_); | |
| 1774 | } | |
| 1775 | else | |
| 1776 | __f_ = __f.__f_->__clone(); | |
| 1777 | } | |
| 1778 | ||
| 1779 | template<class _Rp> | |
| 1780 | template <class _Fp> | |
| 1781 | function<_Rp()>::function(_Fp __f, | |
| 1782 | typename enable_if<!is_integral<_Fp>::value>::type*) | |
| 1783 | : __f_(0) | |
| 1784 | { | |
| 1785 | if (__function::__not_null(__f)) | |
| 1786 | { | |
| 1787 | typedef __function::__func<_Fp, allocator<_Fp>, _Rp()> _FF; | |
| 1788 | if (sizeof(_FF) <= sizeof(__buf_)) | |
| 1789 | { | |
| 1790 | __f_ = (__base*)&__buf_; | |
| 1791 | ::new ((void*)__f_) _FF(__f); | |
| 1792 | } | |
| 1793 | else | |
| 1794 | { | |
| 1795 | typedef allocator<_FF> _Ap; | |
| 1796 | _Ap __a; | |
| 1797 | typedef __allocator_destructor<_Ap> _Dp; | |
| 1798 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 1799 | ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 1800 | __f_ = __hold.release(); | |
| 1801 | } | |
| 1802 | } | |
| 1803 | } | |
| 1804 | ||
| 1805 | template<class _Rp> | |
| 1806 | template <class _Fp, class _Alloc> | |
| 1807 | function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, | |
| 1808 | typename enable_if<!is_integral<_Fp>::value>::type*) | |
| 1809 | : __f_(0) | |
| 1810 | { | |
| 1811 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 1812 | if (__function::__not_null(__f)) | |
| 1813 | { | |
| 1814 | typedef __function::__func<_Fp, _Alloc, _Rp()> _FF; | |
| 1815 | if (sizeof(_FF) <= sizeof(__buf_)) | |
| 1816 | { | |
| 1817 | __f_ = (__base*)&__buf_; | |
| 1818 | ::new ((void*)__f_) _FF(__f, __a0); | |
| 1819 | } | |
| 1820 | else | |
| 1821 | { | |
| 1822 | typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap; | |
| 1823 | _Ap __a(__a0); | |
| 1824 | typedef __allocator_destructor<_Ap> _Dp; | |
| 1825 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 1826 | ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); | |
| 1827 | __f_ = __hold.release(); | |
| 1828 | } | |
| 1829 | } | |
| 1830 | } | |
| 1831 | ||
| 1832 | template<class _Rp> | |
| 1833 | function<_Rp()>& | |
| 1834 | function<_Rp()>::operator=(const function& __f) | |
| 1835 | { | |
| 1836 | if (__f) | |
| 1837 | function(__f).swap(*this); | |
| 1838 | else | |
| 1839 | *this = nullptr; | |
| 1840 | return *this; | |
| 1841 | } | |
| 1842 | ||
| 1843 | template<class _Rp> | |
| 1844 | function<_Rp()>& | |
| 1845 | function<_Rp()>::operator=(nullptr_t) | |
| 1846 | { | |
| 1847 | __base* __t = __f_; | |
| 1848 | __f_ = 0; | |
| 1849 | if (__t == (__base*)&__buf_) | |
| 1850 | __t->destroy(); | |
| 1851 | else if (__t) | |
| 1852 | __t->destroy_deallocate(); | |
| 1853 | return *this; | |
| 1854 | } | |
| 1855 | ||
| 1856 | template<class _Rp> | |
| 1857 | template <class _Fp> | |
| 1858 | typename enable_if | |
| 1859 | < | |
| 1860 | !is_integral<_Fp>::value, | |
| 1861 | function<_Rp()>& | |
| 1862 | >::type | |
| 1863 | function<_Rp()>::operator=(_Fp __f) | |
| 1864 | { | |
| 1865 | function(_VSTD::move(__f)).swap(*this); | |
| 1866 | return *this; | |
| 1867 | } | |
| 1868 | ||
| 1869 | template<class _Rp> | |
| 1870 | function<_Rp()>::~function() | |
| 1871 | { | |
| 1872 | if (__f_ == (__base*)&__buf_) | |
| 1873 | __f_->destroy(); | |
| 1874 | else if (__f_) | |
| 1875 | __f_->destroy_deallocate(); | |
| 1876 | } | |
| 1877 | ||
| 1878 | template<class _Rp> | |
| 1879 | void | |
| 1880 | function<_Rp()>::swap(function& __f) | |
| 1881 | { | |
| 1882 | if (_VSTD::addressof(__f) == this) | |
| 1883 | return; | |
| 1884 | if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) | |
| 1885 | { | |
| 1886 | typename aligned_storage<sizeof(__buf_)>::type __tempbuf; | |
| 1887 | __base* __t = (__base*)&__tempbuf; | |
| 1888 | __f_->__clone(__t); | |
| 1889 | __f_->destroy(); | |
| 1890 | __f_ = 0; | |
| 1891 | __f.__f_->__clone((__base*)&__buf_); | |
| 1892 | __f.__f_->destroy(); | |
| 1893 | __f.__f_ = 0; | |
| 1894 | __f_ = (__base*)&__buf_; | |
| 1895 | __t->__clone((__base*)&__f.__buf_); | |
| 1896 | __t->destroy(); | |
| 1897 | __f.__f_ = (__base*)&__f.__buf_; | |
| 1898 | } | |
| 1899 | else if (__f_ == (__base*)&__buf_) | |
| 1900 | { | |
| 1901 | __f_->__clone((__base*)&__f.__buf_); | |
| 1902 | __f_->destroy(); | |
| 1903 | __f_ = __f.__f_; | |
| 1904 | __f.__f_ = (__base*)&__f.__buf_; | |
| 1905 | } | |
| 1906 | else if (__f.__f_ == (__base*)&__f.__buf_) | |
| 1907 | { | |
| 1908 | __f.__f_->__clone((__base*)&__buf_); | |
| 1909 | __f.__f_->destroy(); | |
| 1910 | __f.__f_ = __f_; | |
| 1911 | __f_ = (__base*)&__buf_; | |
| 1912 | } | |
| 1913 | else | |
| 1914 | _VSTD::swap(__f_, __f.__f_); | |
| 1915 | } | |
| 1916 | ||
| 1917 | template<class _Rp> | |
| 1918 | _Rp | |
| 1919 | function<_Rp()>::operator()() const | |
| 1920 | { | |
| 1921 | if (__f_ == 0) | |
| 1922 | __throw_bad_function_call(); | |
| 1923 | return (*__f_)(); | |
| 1924 | } | |
| 1925 | ||
| 1926 | #ifndef _LIBCPP_NO_RTTI | |
| 1927 | ||
| 1928 | template<class _Rp> | |
| 1929 | const std::type_info& | |
| 1930 | function<_Rp()>::target_type() const | |
| 1931 | { | |
| 1932 | if (__f_ == 0) | |
| 1933 | return typeid(void); | |
| 1934 | return __f_->target_type(); | |
| 1935 | } | |
| 1936 | ||
| 1937 | template<class _Rp> | |
| 1938 | template <typename _Tp> | |
| 1939 | _Tp* | |
| 1940 | function<_Rp()>::target() | |
| 1941 | { | |
| 1942 | if (__f_ == 0) | |
| 1943 | return (_Tp*)0; | |
| 1944 | return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp))); | |
| 1945 | } | |
| 1946 | ||
| 1947 | template<class _Rp> | |
| 1948 | template <typename _Tp> | |
| 1949 | const _Tp* | |
| 1950 | function<_Rp()>::target() const | |
| 1951 | { | |
| 1952 | if (__f_ == 0) | |
| 1953 | return (const _Tp*)0; | |
| 1954 | return (const _Tp*)__f_->target(typeid(_Tp)); | |
| 1955 | } | |
| 1956 | ||
| 1957 | #endif // _LIBCPP_NO_RTTI | |
| 1958 | ||
| 1959 | template<class _Rp, class _A0> | |
| 1960 | class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0)> | |
| 1961 | : public unary_function<_A0, _Rp> | |
| 1962 | { | |
| 1963 | typedef __function::__base<_Rp(_A0)> __base; | |
| 1964 | aligned_storage<3*sizeof(void*)>::type __buf_; | |
| 1965 | __base* __f_; | |
| 1966 | ||
| 1967 | public: | |
| 1968 | typedef _Rp result_type; | |
| 1969 | ||
| 1970 | // 20.7.16.2.1, construct/copy/destroy: | |
| 1971 | _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {} | |
| 1972 | _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {} | |
| 1973 | function(const function&); | |
| 1974 | template<class _Fp> | |
| 1975 | function(_Fp, | |
| 1976 | typename enable_if<!is_integral<_Fp>::value>::type* = 0); | |
| 1977 | ||
| 1978 | template<class _Alloc> | |
| 1979 | _LIBCPP_INLINE_VISIBILITY | |
| 1980 | function(allocator_arg_t, const _Alloc&) : __f_(0) {} | |
| 1981 | template<class _Alloc> | |
| 1982 | _LIBCPP_INLINE_VISIBILITY | |
| 1983 | function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {} | |
| 1984 | template<class _Alloc> | |
| 1985 | function(allocator_arg_t, const _Alloc&, const function&); | |
| 1986 | template<class _Fp, class _Alloc> | |
| 1987 | function(allocator_arg_t, const _Alloc& __a, _Fp __f, | |
| 1988 | typename enable_if<!is_integral<_Fp>::value>::type* = 0); | |
| 1989 | ||
| 1990 | function& operator=(const function&); | |
| 1991 | function& operator=(nullptr_t); | |
| 1992 | template<class _Fp> | |
| 1993 | typename enable_if | |
| 1994 | < | |
| 1995 | !is_integral<_Fp>::value, | |
| 1996 | function& | |
| 1997 | >::type | |
| 1998 | operator=(_Fp); | |
| 1999 | ||
| 2000 | ~function(); | |
| 2001 | ||
| 2002 | // 20.7.16.2.2, function modifiers: | |
| 2003 | void swap(function&); | |
| 2004 | template<class _Fp, class _Alloc> | |
| 2005 | _LIBCPP_INLINE_VISIBILITY | |
| 2006 | void assign(_Fp __f, const _Alloc& __a) | |
| 2007 | {function(allocator_arg, __a, __f).swap(*this);} | |
| 2008 | ||
| 2009 | // 20.7.16.2.3, function capacity: | |
| 2010 | _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;} | |
| 2011 | ||
| 2012 | template<class _R2, class _B0> | |
| 2013 | bool operator==(const function<_R2(_B0)>&) const = delete; | |
| 2014 | template<class _R2, class _B0> | |
| 2015 | bool operator!=(const function<_R2(_B0)>&) const = delete; | |
| 2016 | ||
| 2017 | // 20.7.16.2.4, function invocation: | |
| 2018 | _Rp operator()(_A0) const; | |
| 2019 | ||
| 2020 | #ifndef _LIBCPP_NO_RTTI | |
| 2021 | // 20.7.16.2.5, function target access: | |
| 2022 | const std::type_info& target_type() const; | |
| 2023 | template <typename _Tp> _Tp* target(); | |
| 2024 | template <typename _Tp> const _Tp* target() const; | |
| 2025 | #endif // _LIBCPP_NO_RTTI | |
| 2026 | }; | |
| 2027 | ||
| 2028 | template<class _Rp, class _A0> | |
| 2029 | function<_Rp(_A0)>::function(const function& __f) | |
| 2030 | { | |
| 2031 | if (__f.__f_ == 0) | |
| 2032 | __f_ = 0; | |
| 2033 | else if (__f.__f_ == (const __base*)&__f.__buf_) | |
| 2034 | { | |
| 2035 | __f_ = (__base*)&__buf_; | |
| 2036 | __f.__f_->__clone(__f_); | |
| 2037 | } | |
| 2038 | else | |
| 2039 | __f_ = __f.__f_->__clone(); | |
| 2040 | } | |
| 2041 | ||
| 2042 | template<class _Rp, class _A0> | |
| 2043 | template<class _Alloc> | |
| 2044 | function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc&, const function& __f) | |
| 2045 | { | |
| 2046 | if (__f.__f_ == 0) | |
| 2047 | __f_ = 0; | |
| 2048 | else if (__f.__f_ == (const __base*)&__f.__buf_) | |
| 2049 | { | |
| 2050 | __f_ = (__base*)&__buf_; | |
| 2051 | __f.__f_->__clone(__f_); | |
| 2052 | } | |
| 2053 | else | |
| 2054 | __f_ = __f.__f_->__clone(); | |
| 2055 | } | |
| 2056 | ||
| 2057 | template<class _Rp, class _A0> | |
| 2058 | template <class _Fp> | |
| 2059 | function<_Rp(_A0)>::function(_Fp __f, | |
| 2060 | typename enable_if<!is_integral<_Fp>::value>::type*) | |
| 2061 | : __f_(0) | |
| 2062 | { | |
| 2063 | if (__function::__not_null(__f)) | |
| 2064 | { | |
| 2065 | typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0)> _FF; | |
| 2066 | if (sizeof(_FF) <= sizeof(__buf_)) | |
| 2067 | { | |
| 2068 | __f_ = (__base*)&__buf_; | |
| 2069 | ::new ((void*)__f_) _FF(__f); | |
| 2070 | } | |
| 2071 | else | |
| 2072 | { | |
| 2073 | typedef allocator<_FF> _Ap; | |
| 2074 | _Ap __a; | |
| 2075 | typedef __allocator_destructor<_Ap> _Dp; | |
| 2076 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 2077 | ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 2078 | __f_ = __hold.release(); | |
| 2079 | } | |
| 2080 | } | |
| 2081 | } | |
| 2082 | ||
| 2083 | template<class _Rp, class _A0> | |
| 2084 | template <class _Fp, class _Alloc> | |
| 2085 | function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, | |
| 2086 | typename enable_if<!is_integral<_Fp>::value>::type*) | |
| 2087 | : __f_(0) | |
| 2088 | { | |
| 2089 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 2090 | if (__function::__not_null(__f)) | |
| 2091 | { | |
| 2092 | typedef __function::__func<_Fp, _Alloc, _Rp(_A0)> _FF; | |
| 2093 | if (sizeof(_FF) <= sizeof(__buf_)) | |
| 2094 | { | |
| 2095 | __f_ = (__base*)&__buf_; | |
| 2096 | ::new ((void*)__f_) _FF(__f, __a0); | |
| 2097 | } | |
| 2098 | else | |
| 2099 | { | |
| 2100 | typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap; | |
| 2101 | _Ap __a(__a0); | |
| 2102 | typedef __allocator_destructor<_Ap> _Dp; | |
| 2103 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 2104 | ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); | |
| 2105 | __f_ = __hold.release(); | |
| 2106 | } | |
| 2107 | } | |
| 2108 | } | |
| 2109 | ||
| 2110 | template<class _Rp, class _A0> | |
| 2111 | function<_Rp(_A0)>& | |
| 2112 | function<_Rp(_A0)>::operator=(const function& __f) | |
| 2113 | { | |
| 2114 | if (__f) | |
| 2115 | function(__f).swap(*this); | |
| 2116 | else | |
| 2117 | *this = nullptr; | |
| 2118 | return *this; | |
| 2119 | } | |
| 2120 | ||
| 2121 | template<class _Rp, class _A0> | |
| 2122 | function<_Rp(_A0)>& | |
| 2123 | function<_Rp(_A0)>::operator=(nullptr_t) | |
| 2124 | { | |
| 2125 | __base* __t = __f_; | |
| 2126 | __f_ = 0; | |
| 2127 | if (__t == (__base*)&__buf_) | |
| 2128 | __t->destroy(); | |
| 2129 | else if (__t) | |
| 2130 | __t->destroy_deallocate(); | |
| 2131 | return *this; | |
| 2132 | } | |
| 2133 | ||
| 2134 | template<class _Rp, class _A0> | |
| 2135 | template <class _Fp> | |
| 2136 | typename enable_if | |
| 2137 | < | |
| 2138 | !is_integral<_Fp>::value, | |
| 2139 | function<_Rp(_A0)>& | |
| 2140 | >::type | |
| 2141 | function<_Rp(_A0)>::operator=(_Fp __f) | |
| 2142 | { | |
| 2143 | function(_VSTD::move(__f)).swap(*this); | |
| 2144 | return *this; | |
| 2145 | } | |
| 2146 | ||
| 2147 | template<class _Rp, class _A0> | |
| 2148 | function<_Rp(_A0)>::~function() | |
| 2149 | { | |
| 2150 | if (__f_ == (__base*)&__buf_) | |
| 2151 | __f_->destroy(); | |
| 2152 | else if (__f_) | |
| 2153 | __f_->destroy_deallocate(); | |
| 2154 | } | |
| 2155 | ||
| 2156 | template<class _Rp, class _A0> | |
| 2157 | void | |
| 2158 | function<_Rp(_A0)>::swap(function& __f) | |
| 2159 | { | |
| 2160 | if (_VSTD::addressof(__f) == this) | |
| 2161 | return; | |
| 2162 | if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) | |
| 2163 | { | |
| 2164 | typename aligned_storage<sizeof(__buf_)>::type __tempbuf; | |
| 2165 | __base* __t = (__base*)&__tempbuf; | |
| 2166 | __f_->__clone(__t); | |
| 2167 | __f_->destroy(); | |
| 2168 | __f_ = 0; | |
| 2169 | __f.__f_->__clone((__base*)&__buf_); | |
| 2170 | __f.__f_->destroy(); | |
| 2171 | __f.__f_ = 0; | |
| 2172 | __f_ = (__base*)&__buf_; | |
| 2173 | __t->__clone((__base*)&__f.__buf_); | |
| 2174 | __t->destroy(); | |
| 2175 | __f.__f_ = (__base*)&__f.__buf_; | |
| 2176 | } | |
| 2177 | else if (__f_ == (__base*)&__buf_) | |
| 2178 | { | |
| 2179 | __f_->__clone((__base*)&__f.__buf_); | |
| 2180 | __f_->destroy(); | |
| 2181 | __f_ = __f.__f_; | |
| 2182 | __f.__f_ = (__base*)&__f.__buf_; | |
| 2183 | } | |
| 2184 | else if (__f.__f_ == (__base*)&__f.__buf_) | |
| 2185 | { | |
| 2186 | __f.__f_->__clone((__base*)&__buf_); | |
| 2187 | __f.__f_->destroy(); | |
| 2188 | __f.__f_ = __f_; | |
| 2189 | __f_ = (__base*)&__buf_; | |
| 2190 | } | |
| 2191 | else | |
| 2192 | _VSTD::swap(__f_, __f.__f_); | |
| 2193 | } | |
| 2194 | ||
| 2195 | template<class _Rp, class _A0> | |
| 2196 | _Rp | |
| 2197 | function<_Rp(_A0)>::operator()(_A0 __a0) const | |
| 2198 | { | |
| 2199 | if (__f_ == 0) | |
| 2200 | __throw_bad_function_call(); | |
| 2201 | return (*__f_)(__a0); | |
| 2202 | } | |
| 2203 | ||
| 2204 | #ifndef _LIBCPP_NO_RTTI | |
| 2205 | ||
| 2206 | template<class _Rp, class _A0> | |
| 2207 | const std::type_info& | |
| 2208 | function<_Rp(_A0)>::target_type() const | |
| 2209 | { | |
| 2210 | if (__f_ == 0) | |
| 2211 | return typeid(void); | |
| 2212 | return __f_->target_type(); | |
| 2213 | } | |
| 2214 | ||
| 2215 | template<class _Rp, class _A0> | |
| 2216 | template <typename _Tp> | |
| 2217 | _Tp* | |
| 2218 | function<_Rp(_A0)>::target() | |
| 2219 | { | |
| 2220 | if (__f_ == 0) | |
| 2221 | return (_Tp*)0; | |
| 2222 | return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp))); | |
| 2223 | } | |
| 2224 | ||
| 2225 | template<class _Rp, class _A0> | |
| 2226 | template <typename _Tp> | |
| 2227 | const _Tp* | |
| 2228 | function<_Rp(_A0)>::target() const | |
| 2229 | { | |
| 2230 | if (__f_ == 0) | |
| 2231 | return (const _Tp*)0; | |
| 2232 | return (const _Tp*)__f_->target(typeid(_Tp)); | |
| 2233 | } | |
| 2234 | ||
| 2235 | #endif // _LIBCPP_NO_RTTI | |
| 2236 | ||
| 2237 | template<class _Rp, class _A0, class _A1> | |
| 2238 | class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0, _A1)> | |
| 2239 | : public binary_function<_A0, _A1, _Rp> | |
| 2240 | { | |
| 2241 | typedef __function::__base<_Rp(_A0, _A1)> __base; | |
| 2242 | aligned_storage<3*sizeof(void*)>::type __buf_; | |
| 2243 | __base* __f_; | |
| 2244 | ||
| 2245 | public: | |
| 2246 | typedef _Rp result_type; | |
| 2247 | ||
| 2248 | // 20.7.16.2.1, construct/copy/destroy: | |
| 2249 | _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {} | |
| 2250 | _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {} | |
| 2251 | function(const function&); | |
| 2252 | template<class _Fp> | |
| 2253 | function(_Fp, | |
| 2254 | typename enable_if<!is_integral<_Fp>::value>::type* = 0); | |
| 2255 | ||
| 2256 | template<class _Alloc> | |
| 2257 | _LIBCPP_INLINE_VISIBILITY | |
| 2258 | function(allocator_arg_t, const _Alloc&) : __f_(0) {} | |
| 2259 | template<class _Alloc> | |
| 2260 | _LIBCPP_INLINE_VISIBILITY | |
| 2261 | function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {} | |
| 2262 | template<class _Alloc> | |
| 2263 | function(allocator_arg_t, const _Alloc&, const function&); | |
| 2264 | template<class _Fp, class _Alloc> | |
| 2265 | function(allocator_arg_t, const _Alloc& __a, _Fp __f, | |
| 2266 | typename enable_if<!is_integral<_Fp>::value>::type* = 0); | |
| 2267 | ||
| 2268 | function& operator=(const function&); | |
| 2269 | function& operator=(nullptr_t); | |
| 2270 | template<class _Fp> | |
| 2271 | typename enable_if | |
| 2272 | < | |
| 2273 | !is_integral<_Fp>::value, | |
| 2274 | function& | |
| 2275 | >::type | |
| 2276 | operator=(_Fp); | |
| 2277 | ||
| 2278 | ~function(); | |
| 2279 | ||
| 2280 | // 20.7.16.2.2, function modifiers: | |
| 2281 | void swap(function&); | |
| 2282 | template<class _Fp, class _Alloc> | |
| 2283 | _LIBCPP_INLINE_VISIBILITY | |
| 2284 | void assign(_Fp __f, const _Alloc& __a) | |
| 2285 | {function(allocator_arg, __a, __f).swap(*this);} | |
| 2286 | ||
| 2287 | // 20.7.16.2.3, function capacity: | |
| 2288 | _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;} | |
| 2289 | ||
| 2290 | template<class _R2, class _B0, class _B1> | |
| 2291 | bool operator==(const function<_R2(_B0, _B1)>&) const = delete; | |
| 2292 | template<class _R2, class _B0, class _B1> | |
| 2293 | bool operator!=(const function<_R2(_B0, _B1)>&) const = delete; | |
| 2294 | ||
| 2295 | // 20.7.16.2.4, function invocation: | |
| 2296 | _Rp operator()(_A0, _A1) const; | |
| 2297 | ||
| 2298 | #ifndef _LIBCPP_NO_RTTI | |
| 2299 | // 20.7.16.2.5, function target access: | |
| 2300 | const std::type_info& target_type() const; | |
| 2301 | template <typename _Tp> _Tp* target(); | |
| 2302 | template <typename _Tp> const _Tp* target() const; | |
| 2303 | #endif // _LIBCPP_NO_RTTI | |
| 2304 | }; | |
| 2305 | ||
| 2306 | template<class _Rp, class _A0, class _A1> | |
| 2307 | function<_Rp(_A0, _A1)>::function(const function& __f) | |
| 2308 | { | |
| 2309 | if (__f.__f_ == 0) | |
| 2310 | __f_ = 0; | |
| 2311 | else if (__f.__f_ == (const __base*)&__f.__buf_) | |
| 2312 | { | |
| 2313 | __f_ = (__base*)&__buf_; | |
| 2314 | __f.__f_->__clone(__f_); | |
| 2315 | } | |
| 2316 | else | |
| 2317 | __f_ = __f.__f_->__clone(); | |
| 2318 | } | |
| 2319 | ||
| 2320 | template<class _Rp, class _A0, class _A1> | |
| 2321 | template<class _Alloc> | |
| 2322 | function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc&, const function& __f) | |
| 2323 | { | |
| 2324 | if (__f.__f_ == 0) | |
| 2325 | __f_ = 0; | |
| 2326 | else if (__f.__f_ == (const __base*)&__f.__buf_) | |
| 2327 | { | |
| 2328 | __f_ = (__base*)&__buf_; | |
| 2329 | __f.__f_->__clone(__f_); | |
| 2330 | } | |
| 2331 | else | |
| 2332 | __f_ = __f.__f_->__clone(); | |
| 2333 | } | |
| 2334 | ||
| 2335 | template<class _Rp, class _A0, class _A1> | |
| 2336 | template <class _Fp> | |
| 2337 | function<_Rp(_A0, _A1)>::function(_Fp __f, | |
| 2338 | typename enable_if<!is_integral<_Fp>::value>::type*) | |
| 2339 | : __f_(0) | |
| 2340 | { | |
| 2341 | if (__function::__not_null(__f)) | |
| 2342 | { | |
| 2343 | typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1)> _FF; | |
| 2344 | if (sizeof(_FF) <= sizeof(__buf_)) | |
| 2345 | { | |
| 2346 | __f_ = (__base*)&__buf_; | |
| 2347 | ::new ((void*)__f_) _FF(__f); | |
| 2348 | } | |
| 2349 | else | |
| 2350 | { | |
| 2351 | typedef allocator<_FF> _Ap; | |
| 2352 | _Ap __a; | |
| 2353 | typedef __allocator_destructor<_Ap> _Dp; | |
| 2354 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 2355 | ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 2356 | __f_ = __hold.release(); | |
| 2357 | } | |
| 2358 | } | |
| 2359 | } | |
| 2360 | ||
| 2361 | template<class _Rp, class _A0, class _A1> | |
| 2362 | template <class _Fp, class _Alloc> | |
| 2363 | function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, | |
| 2364 | typename enable_if<!is_integral<_Fp>::value>::type*) | |
| 2365 | : __f_(0) | |
| 2366 | { | |
| 2367 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 2368 | if (__function::__not_null(__f)) | |
| 2369 | { | |
| 2370 | typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1)> _FF; | |
| 2371 | if (sizeof(_FF) <= sizeof(__buf_)) | |
| 2372 | { | |
| 2373 | __f_ = (__base*)&__buf_; | |
| 2374 | ::new ((void*)__f_) _FF(__f, __a0); | |
| 2375 | } | |
| 2376 | else | |
| 2377 | { | |
| 2378 | typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap; | |
| 2379 | _Ap __a(__a0); | |
| 2380 | typedef __allocator_destructor<_Ap> _Dp; | |
| 2381 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 2382 | ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); | |
| 2383 | __f_ = __hold.release(); | |
| 2384 | } | |
| 2385 | } | |
| 2386 | } | |
| 2387 | ||
| 2388 | template<class _Rp, class _A0, class _A1> | |
| 2389 | function<_Rp(_A0, _A1)>& | |
| 2390 | function<_Rp(_A0, _A1)>::operator=(const function& __f) | |
| 2391 | { | |
| 2392 | if (__f) | |
| 2393 | function(__f).swap(*this); | |
| 2394 | else | |
| 2395 | *this = nullptr; | |
| 2396 | return *this; | |
| 2397 | } | |
| 2398 | ||
| 2399 | template<class _Rp, class _A0, class _A1> | |
| 2400 | function<_Rp(_A0, _A1)>& | |
| 2401 | function<_Rp(_A0, _A1)>::operator=(nullptr_t) | |
| 2402 | { | |
| 2403 | __base* __t = __f_; | |
| 2404 | __f_ = 0; | |
| 2405 | if (__t == (__base*)&__buf_) | |
| 2406 | __t->destroy(); | |
| 2407 | else if (__t) | |
| 2408 | __t->destroy_deallocate(); | |
| 2409 | return *this; | |
| 2410 | } | |
| 2411 | ||
| 2412 | template<class _Rp, class _A0, class _A1> | |
| 2413 | template <class _Fp> | |
| 2414 | typename enable_if | |
| 2415 | < | |
| 2416 | !is_integral<_Fp>::value, | |
| 2417 | function<_Rp(_A0, _A1)>& | |
| 2418 | >::type | |
| 2419 | function<_Rp(_A0, _A1)>::operator=(_Fp __f) | |
| 2420 | { | |
| 2421 | function(_VSTD::move(__f)).swap(*this); | |
| 2422 | return *this; | |
| 2423 | } | |
| 2424 | ||
| 2425 | template<class _Rp, class _A0, class _A1> | |
| 2426 | function<_Rp(_A0, _A1)>::~function() | |
| 2427 | { | |
| 2428 | if (__f_ == (__base*)&__buf_) | |
| 2429 | __f_->destroy(); | |
| 2430 | else if (__f_) | |
| 2431 | __f_->destroy_deallocate(); | |
| 2432 | } | |
| 2433 | ||
| 2434 | template<class _Rp, class _A0, class _A1> | |
| 2435 | void | |
| 2436 | function<_Rp(_A0, _A1)>::swap(function& __f) | |
| 2437 | { | |
| 2438 | if (_VSTD::addressof(__f) == this) | |
| 2439 | return; | |
| 2440 | if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) | |
| 2441 | { | |
| 2442 | typename aligned_storage<sizeof(__buf_)>::type __tempbuf; | |
| 2443 | __base* __t = (__base*)&__tempbuf; | |
| 2444 | __f_->__clone(__t); | |
| 2445 | __f_->destroy(); | |
| 2446 | __f_ = 0; | |
| 2447 | __f.__f_->__clone((__base*)&__buf_); | |
| 2448 | __f.__f_->destroy(); | |
| 2449 | __f.__f_ = 0; | |
| 2450 | __f_ = (__base*)&__buf_; | |
| 2451 | __t->__clone((__base*)&__f.__buf_); | |
| 2452 | __t->destroy(); | |
| 2453 | __f.__f_ = (__base*)&__f.__buf_; | |
| 2454 | } | |
| 2455 | else if (__f_ == (__base*)&__buf_) | |
| 2456 | { | |
| 2457 | __f_->__clone((__base*)&__f.__buf_); | |
| 2458 | __f_->destroy(); | |
| 2459 | __f_ = __f.__f_; | |
| 2460 | __f.__f_ = (__base*)&__f.__buf_; | |
| 2461 | } | |
| 2462 | else if (__f.__f_ == (__base*)&__f.__buf_) | |
| 2463 | { | |
| 2464 | __f.__f_->__clone((__base*)&__buf_); | |
| 2465 | __f.__f_->destroy(); | |
| 2466 | __f.__f_ = __f_; | |
| 2467 | __f_ = (__base*)&__buf_; | |
| 2468 | } | |
| 2469 | else | |
| 2470 | _VSTD::swap(__f_, __f.__f_); | |
| 2471 | } | |
| 2472 | ||
| 2473 | template<class _Rp, class _A0, class _A1> | |
| 2474 | _Rp | |
| 2475 | function<_Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const | |
| 2476 | { | |
| 2477 | if (__f_ == 0) | |
| 2478 | __throw_bad_function_call(); | |
| 2479 | return (*__f_)(__a0, __a1); | |
| 2480 | } | |
| 2481 | ||
| 2482 | #ifndef _LIBCPP_NO_RTTI | |
| 2483 | ||
| 2484 | template<class _Rp, class _A0, class _A1> | |
| 2485 | const std::type_info& | |
| 2486 | function<_Rp(_A0, _A1)>::target_type() const | |
| 2487 | { | |
| 2488 | if (__f_ == 0) | |
| 2489 | return typeid(void); | |
| 2490 | return __f_->target_type(); | |
| 2491 | } | |
| 2492 | ||
| 2493 | template<class _Rp, class _A0, class _A1> | |
| 2494 | template <typename _Tp> | |
| 2495 | _Tp* | |
| 2496 | function<_Rp(_A0, _A1)>::target() | |
| 2497 | { | |
| 2498 | if (__f_ == 0) | |
| 2499 | return (_Tp*)0; | |
| 2500 | return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp))); | |
| 2501 | } | |
| 2502 | ||
| 2503 | template<class _Rp, class _A0, class _A1> | |
| 2504 | template <typename _Tp> | |
| 2505 | const _Tp* | |
| 2506 | function<_Rp(_A0, _A1)>::target() const | |
| 2507 | { | |
| 2508 | if (__f_ == 0) | |
| 2509 | return (const _Tp*)0; | |
| 2510 | return (const _Tp*)__f_->target(typeid(_Tp)); | |
| 2511 | } | |
| 2512 | ||
| 2513 | #endif // _LIBCPP_NO_RTTI | |
| 2514 | ||
| 2515 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2516 | class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0, _A1, _A2)> | |
| 2517 | { | |
| 2518 | typedef __function::__base<_Rp(_A0, _A1, _A2)> __base; | |
| 2519 | aligned_storage<3*sizeof(void*)>::type __buf_; | |
| 2520 | __base* __f_; | |
| 2521 | ||
| 2522 | public: | |
| 2523 | typedef _Rp result_type; | |
| 2524 | ||
| 2525 | // 20.7.16.2.1, construct/copy/destroy: | |
| 2526 | _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {} | |
| 2527 | _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {} | |
| 2528 | function(const function&); | |
| 2529 | template<class _Fp> | |
| 2530 | function(_Fp, | |
| 2531 | typename enable_if<!is_integral<_Fp>::value>::type* = 0); | |
| 2532 | ||
| 2533 | template<class _Alloc> | |
| 2534 | _LIBCPP_INLINE_VISIBILITY | |
| 2535 | function(allocator_arg_t, const _Alloc&) : __f_(0) {} | |
| 2536 | template<class _Alloc> | |
| 2537 | _LIBCPP_INLINE_VISIBILITY | |
| 2538 | function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {} | |
| 2539 | template<class _Alloc> | |
| 2540 | function(allocator_arg_t, const _Alloc&, const function&); | |
| 2541 | template<class _Fp, class _Alloc> | |
| 2542 | function(allocator_arg_t, const _Alloc& __a, _Fp __f, | |
| 2543 | typename enable_if<!is_integral<_Fp>::value>::type* = 0); | |
| 2544 | ||
| 2545 | function& operator=(const function&); | |
| 2546 | function& operator=(nullptr_t); | |
| 2547 | template<class _Fp> | |
| 2548 | typename enable_if | |
| 2549 | < | |
| 2550 | !is_integral<_Fp>::value, | |
| 2551 | function& | |
| 2552 | >::type | |
| 2553 | operator=(_Fp); | |
| 2554 | ||
| 2555 | ~function(); | |
| 2556 | ||
| 2557 | // 20.7.16.2.2, function modifiers: | |
| 2558 | void swap(function&); | |
| 2559 | template<class _Fp, class _Alloc> | |
| 2560 | _LIBCPP_INLINE_VISIBILITY | |
| 2561 | void assign(_Fp __f, const _Alloc& __a) | |
| 2562 | {function(allocator_arg, __a, __f).swap(*this);} | |
| 2563 | ||
| 2564 | // 20.7.16.2.3, function capacity: | |
| 2565 | _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;} | |
| 2566 | ||
| 2567 | template<class _R2, class _B0, class _B1, class _B2> | |
| 2568 | bool operator==(const function<_R2(_B0, _B1, _B2)>&) const = delete; | |
| 2569 | template<class _R2, class _B0, class _B1, class _B2> | |
| 2570 | bool operator!=(const function<_R2(_B0, _B1, _B2)>&) const = delete; | |
| 2571 | ||
| 2572 | // 20.7.16.2.4, function invocation: | |
| 2573 | _Rp operator()(_A0, _A1, _A2) const; | |
| 2574 | ||
| 2575 | #ifndef _LIBCPP_NO_RTTI | |
| 2576 | // 20.7.16.2.5, function target access: | |
| 2577 | const std::type_info& target_type() const; | |
| 2578 | template <typename _Tp> _Tp* target(); | |
| 2579 | template <typename _Tp> const _Tp* target() const; | |
| 2580 | #endif // _LIBCPP_NO_RTTI | |
| 2581 | }; | |
| 2582 | ||
| 2583 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2584 | function<_Rp(_A0, _A1, _A2)>::function(const function& __f) | |
| 2585 | { | |
| 2586 | if (__f.__f_ == 0) | |
| 2587 | __f_ = 0; | |
| 2588 | else if (__f.__f_ == (const __base*)&__f.__buf_) | |
| 2589 | { | |
| 2590 | __f_ = (__base*)&__buf_; | |
| 2591 | __f.__f_->__clone(__f_); | |
| 2592 | } | |
| 2593 | else | |
| 2594 | __f_ = __f.__f_->__clone(); | |
| 2595 | } | |
| 2596 | ||
| 2597 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2598 | template<class _Alloc> | |
| 2599 | function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc&, | |
| 2600 | const function& __f) | |
| 2601 | { | |
| 2602 | if (__f.__f_ == 0) | |
| 2603 | __f_ = 0; | |
| 2604 | else if (__f.__f_ == (const __base*)&__f.__buf_) | |
| 2605 | { | |
| 2606 | __f_ = (__base*)&__buf_; | |
| 2607 | __f.__f_->__clone(__f_); | |
| 2608 | } | |
| 2609 | else | |
| 2610 | __f_ = __f.__f_->__clone(); | |
| 2611 | } | |
| 2612 | ||
| 2613 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2614 | template <class _Fp> | |
| 2615 | function<_Rp(_A0, _A1, _A2)>::function(_Fp __f, | |
| 2616 | typename enable_if<!is_integral<_Fp>::value>::type*) | |
| 2617 | : __f_(0) | |
| 2618 | { | |
| 2619 | if (__function::__not_null(__f)) | |
| 2620 | { | |
| 2621 | typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1, _A2)> _FF; | |
| 2622 | if (sizeof(_FF) <= sizeof(__buf_)) | |
| 2623 | { | |
| 2624 | __f_ = (__base*)&__buf_; | |
| 2625 | ::new ((void*)__f_) _FF(__f); | |
| 2626 | } | |
| 2627 | else | |
| 2628 | { | |
| 2629 | typedef allocator<_FF> _Ap; | |
| 2630 | _Ap __a; | |
| 2631 | typedef __allocator_destructor<_Ap> _Dp; | |
| 2632 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 2633 | ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 2634 | __f_ = __hold.release(); | |
| 2635 | } | |
| 2636 | } | |
| 2637 | } | |
| 2638 | ||
| 2639 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2640 | template <class _Fp, class _Alloc> | |
| 2641 | function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, | |
| 2642 | typename enable_if<!is_integral<_Fp>::value>::type*) | |
| 2643 | : __f_(0) | |
| 2644 | { | |
| 2645 | typedef allocator_traits<_Alloc> __alloc_traits; | |
| 2646 | if (__function::__not_null(__f)) | |
| 2647 | { | |
| 2648 | typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> _FF; | |
| 2649 | if (sizeof(_FF) <= sizeof(__buf_)) | |
| 2650 | { | |
| 2651 | __f_ = (__base*)&__buf_; | |
| 2652 | ::new ((void*)__f_) _FF(__f, __a0); | |
| 2653 | } | |
| 2654 | else | |
| 2655 | { | |
| 2656 | typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap; | |
| 2657 | _Ap __a(__a0); | |
| 2658 | typedef __allocator_destructor<_Ap> _Dp; | |
| 2659 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 2660 | ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); | |
| 2661 | __f_ = __hold.release(); | |
| 2662 | } | |
| 2663 | } | |
| 2664 | } | |
| 2665 | ||
| 2666 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2667 | function<_Rp(_A0, _A1, _A2)>& | |
| 2668 | function<_Rp(_A0, _A1, _A2)>::operator=(const function& __f) | |
| 2669 | { | |
| 2670 | if (__f) | |
| 2671 | function(__f).swap(*this); | |
| 2672 | else | |
| 2673 | *this = nullptr; | |
| 2674 | return *this; | |
| 2675 | } | |
| 2676 | ||
| 2677 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2678 | function<_Rp(_A0, _A1, _A2)>& | |
| 2679 | function<_Rp(_A0, _A1, _A2)>::operator=(nullptr_t) | |
| 2680 | { | |
| 2681 | __base* __t = __f_; | |
| 2682 | __f_ = 0; | |
| 2683 | if (__t == (__base*)&__buf_) | |
| 2684 | __t->destroy(); | |
| 2685 | else if (__t) | |
| 2686 | __t->destroy_deallocate(); | |
| 2687 | return *this; | |
| 2688 | } | |
| 2689 | ||
| 2690 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2691 | template <class _Fp> | |
| 2692 | typename enable_if | |
| 2693 | < | |
| 2694 | !is_integral<_Fp>::value, | |
| 2695 | function<_Rp(_A0, _A1, _A2)>& | |
| 2696 | >::type | |
| 2697 | function<_Rp(_A0, _A1, _A2)>::operator=(_Fp __f) | |
| 2698 | { | |
| 2699 | function(_VSTD::move(__f)).swap(*this); | |
| 2700 | return *this; | |
| 2701 | } | |
| 2702 | ||
| 2703 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2704 | function<_Rp(_A0, _A1, _A2)>::~function() | |
| 2705 | { | |
| 2706 | if (__f_ == (__base*)&__buf_) | |
| 2707 | __f_->destroy(); | |
| 2708 | else if (__f_) | |
| 2709 | __f_->destroy_deallocate(); | |
| 2710 | } | |
| 2711 | ||
| 2712 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2713 | void | |
| 2714 | function<_Rp(_A0, _A1, _A2)>::swap(function& __f) | |
| 2715 | { | |
| 2716 | if (_VSTD::addressof(__f) == this) | |
| 2717 | return; | |
| 2718 | if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) | |
| 2719 | { | |
| 2720 | typename aligned_storage<sizeof(__buf_)>::type __tempbuf; | |
| 2721 | __base* __t = (__base*)&__tempbuf; | |
| 2722 | __f_->__clone(__t); | |
| 2723 | __f_->destroy(); | |
| 2724 | __f_ = 0; | |
| 2725 | __f.__f_->__clone((__base*)&__buf_); | |
| 2726 | __f.__f_->destroy(); | |
| 2727 | __f.__f_ = 0; | |
| 2728 | __f_ = (__base*)&__buf_; | |
| 2729 | __t->__clone((__base*)&__f.__buf_); | |
| 2730 | __t->destroy(); | |
| 2731 | __f.__f_ = (__base*)&__f.__buf_; | |
| 2732 | } | |
| 2733 | else if (__f_ == (__base*)&__buf_) | |
| 2734 | { | |
| 2735 | __f_->__clone((__base*)&__f.__buf_); | |
| 2736 | __f_->destroy(); | |
| 2737 | __f_ = __f.__f_; | |
| 2738 | __f.__f_ = (__base*)&__f.__buf_; | |
| 2739 | } | |
| 2740 | else if (__f.__f_ == (__base*)&__f.__buf_) | |
| 2741 | { | |
| 2742 | __f.__f_->__clone((__base*)&__buf_); | |
| 2743 | __f.__f_->destroy(); | |
| 2744 | __f.__f_ = __f_; | |
| 2745 | __f_ = (__base*)&__buf_; | |
| 2746 | } | |
| 2747 | else | |
| 2748 | _VSTD::swap(__f_, __f.__f_); | |
| 2749 | } | |
| 2750 | ||
| 2751 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2752 | _Rp | |
| 2753 | function<_Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const | |
| 2754 | { | |
| 2755 | if (__f_ == 0) | |
| 2756 | __throw_bad_function_call(); | |
| 2757 | return (*__f_)(__a0, __a1, __a2); | |
| 2758 | } | |
| 2759 | ||
| 2760 | #ifndef _LIBCPP_NO_RTTI | |
| 2761 | ||
| 2762 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2763 | const std::type_info& | |
| 2764 | function<_Rp(_A0, _A1, _A2)>::target_type() const | |
| 2765 | { | |
| 2766 | if (__f_ == 0) | |
| 2767 | return typeid(void); | |
| 2768 | return __f_->target_type(); | |
| 2769 | } | |
| 2770 | ||
| 2771 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2772 | template <typename _Tp> | |
| 2773 | _Tp* | |
| 2774 | function<_Rp(_A0, _A1, _A2)>::target() | |
| 2775 | { | |
| 2776 | if (__f_ == 0) | |
| 2777 | return (_Tp*)0; | |
| 2778 | return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp))); | |
| 2779 | } | |
| 2780 | ||
| 2781 | template<class _Rp, class _A0, class _A1, class _A2> | |
| 2782 | template <typename _Tp> | |
| 2783 | const _Tp* | |
| 2784 | function<_Rp(_A0, _A1, _A2)>::target() const | |
| 2785 | { | |
| 2786 | if (__f_ == 0) | |
| 2787 | return (const _Tp*)0; | |
| 2788 | return (const _Tp*)__f_->target(typeid(_Tp)); | |
| 2789 | } | |
| 2790 | ||
| 2791 | #endif // _LIBCPP_NO_RTTI | |
| 2792 | ||
| 2793 | template <class _Fp> | |
| 2794 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2795 | bool | |
| 2796 | operator==(const function<_Fp>& __f, nullptr_t) {return !__f;} | |
| 2797 | ||
| 2798 | template <class _Fp> | |
| 2799 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2800 | bool | |
| 2801 | operator==(nullptr_t, const function<_Fp>& __f) {return !__f;} | |
| 2802 | ||
| 2803 | template <class _Fp> | |
| 2804 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2805 | bool | |
| 2806 | operator!=(const function<_Fp>& __f, nullptr_t) {return (bool)__f;} | |
| 2807 | ||
| 2808 | template <class _Fp> | |
| 2809 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2810 | bool | |
| 2811 | operator!=(nullptr_t, const function<_Fp>& __f) {return (bool)__f;} | |
| 2812 | ||
| 2813 | template <class _Fp> | |
| 2814 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2815 | void | |
| 2816 | swap(function<_Fp>& __x, function<_Fp>& __y) | |
| 2817 | {return __x.swap(__y);} | |
| 1212 | _LIBCPP_END_NAMESPACE_STD | |
| 2818 | 1213 | |
| 2819 | 1214 | #endif // _LIBCPP_CXX03_LANG |
| 2820 | 1215 | |
| 2821 | _LIBCPP_END_NAMESPACE_STD | |
| 2822 | ||
| 2823 | 1216 | #endif // _LIBCPP___FUNCTIONAL_FUNCTION_H |
lib/libcxx/include/__functional/hash.h+41-35| ... | ... | @@ -10,8 +10,15 @@ |
| 10 | 10 | #define _LIBCPP___FUNCTIONAL_HASH_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__functional/invoke.h> | |
| 13 | 14 | #include <__functional/unary_function.h> |
| 14 | #include <__tuple> | |
| 15 | #include <__fwd/hash.h> | |
| 16 | #include <__tuple_dir/sfinae_helpers.h> | |
| 17 | #include <__type_traits/is_copy_constructible.h> | |
| 18 | #include <__type_traits/is_default_constructible.h> | |
| 19 | #include <__type_traits/is_enum.h> | |
| 20 | #include <__type_traits/is_move_constructible.h> | |
| 21 | #include <__type_traits/underlying_type.h> | |
| 15 | 22 | #include <__utility/forward.h> |
| 16 | 23 | #include <__utility/move.h> |
| 17 | 24 | #include <__utility/pair.h> |
| ... | ... | @@ -20,7 +27,6 @@ |
| 20 | 27 | #include <cstdint> |
| 21 | 28 | #include <cstring> |
| 22 | 29 | #include <limits> |
| 23 | #include <type_traits> | |
| 24 | 30 | |
| 25 | 31 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 26 | 32 | # pragma GCC system_header |
| ... | ... | @@ -62,7 +68,7 @@ __murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) |
| 62 | 68 | const unsigned char* __data = static_cast<const unsigned char*>(__key); |
| 63 | 69 | for (; __len >= 4; __data += 4, __len -= 4) |
| 64 | 70 | { |
| 65 | _Size __k = __loadword<_Size>(__data); | |
| 71 | _Size __k = std::__loadword<_Size>(__data); | |
| 66 | 72 | __k *= __m; |
| 67 | 73 | __k ^= __k >> __r; |
| 68 | 74 | __k *= __m; |
| ... | ... | @@ -127,14 +133,14 @@ struct __murmur2_or_cityhash<_Size, 64> |
| 127 | 133 | _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 128 | 134 | { |
| 129 | 135 | if (__len > 8) { |
| 130 | const _Size __a = __loadword<_Size>(__s); | |
| 131 | const _Size __b = __loadword<_Size>(__s + __len - 8); | |
| 136 | const _Size __a = std::__loadword<_Size>(__s); | |
| 137 | const _Size __b = std::__loadword<_Size>(__s + __len - 8); | |
| 132 | 138 | return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b; |
| 133 | 139 | } |
| 134 | 140 | if (__len >= 4) { |
| 135 | const uint32_t __a = __loadword<uint32_t>(__s); | |
| 136 | const uint32_t __b = __loadword<uint32_t>(__s + __len - 4); | |
| 137 | return __hash_len_16(__len + (__a << 3), __b); | |
| 141 | const uint32_t __a = std::__loadword<uint32_t>(__s); | |
| 142 | const uint32_t __b = std::__loadword<uint32_t>(__s + __len - 4); | |
| 143 | return __hash_len_16(__len + (static_cast<_Size>(__a) << 3), __b); | |
| 138 | 144 | } |
| 139 | 145 | if (__len > 0) { |
| 140 | 146 | const unsigned char __a = static_cast<unsigned char>(__s[0]); |
| ... | ... | @@ -151,10 +157,10 @@ struct __murmur2_or_cityhash<_Size, 64> |
| 151 | 157 | static _Size __hash_len_17_to_32(const char *__s, _Size __len) |
| 152 | 158 | _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 153 | 159 | { |
| 154 | const _Size __a = __loadword<_Size>(__s) * __k1; | |
| 155 | const _Size __b = __loadword<_Size>(__s + 8); | |
| 156 | const _Size __c = __loadword<_Size>(__s + __len - 8) * __k2; | |
| 157 | const _Size __d = __loadword<_Size>(__s + __len - 16) * __k0; | |
| 160 | const _Size __a = std::__loadword<_Size>(__s) * __k1; | |
| 161 | const _Size __b = std::__loadword<_Size>(__s + 8); | |
| 162 | const _Size __c = std::__loadword<_Size>(__s + __len - 8) * __k2; | |
| 163 | const _Size __d = std::__loadword<_Size>(__s + __len - 16) * __k0; | |
| 158 | 164 | return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d, |
| 159 | 165 | __a + __rotate(__b ^ __k3, 20) - __c + __len); |
| 160 | 166 | } |
| ... | ... | @@ -179,10 +185,10 @@ struct __murmur2_or_cityhash<_Size, 64> |
| 179 | 185 | const char* __s, _Size __a, _Size __b) |
| 180 | 186 | _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 181 | 187 | { |
| 182 | return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s), | |
| 183 | __loadword<_Size>(__s + 8), | |
| 184 | __loadword<_Size>(__s + 16), | |
| 185 | __loadword<_Size>(__s + 24), | |
| 188 | return __weak_hash_len_32_with_seeds(std::__loadword<_Size>(__s), | |
| 189 | std::__loadword<_Size>(__s + 8), | |
| 190 | std::__loadword<_Size>(__s + 16), | |
| 191 | std::__loadword<_Size>(__s + 24), | |
| 186 | 192 | __a, |
| 187 | 193 | __b); |
| 188 | 194 | } |
| ... | ... | @@ -191,23 +197,23 @@ struct __murmur2_or_cityhash<_Size, 64> |
| 191 | 197 | static _Size __hash_len_33_to_64(const char *__s, size_t __len) |
| 192 | 198 | _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 193 | 199 | { |
| 194 | _Size __z = __loadword<_Size>(__s + 24); | |
| 195 | _Size __a = __loadword<_Size>(__s) + | |
| 196 | (__len + __loadword<_Size>(__s + __len - 16)) * __k0; | |
| 200 | _Size __z = std::__loadword<_Size>(__s + 24); | |
| 201 | _Size __a = std::__loadword<_Size>(__s) + | |
| 202 | (__len + std::__loadword<_Size>(__s + __len - 16)) * __k0; | |
| 197 | 203 | _Size __b = __rotate(__a + __z, 52); |
| 198 | 204 | _Size __c = __rotate(__a, 37); |
| 199 | __a += __loadword<_Size>(__s + 8); | |
| 205 | __a += std::__loadword<_Size>(__s + 8); | |
| 200 | 206 | __c += __rotate(__a, 7); |
| 201 | __a += __loadword<_Size>(__s + 16); | |
| 207 | __a += std::__loadword<_Size>(__s + 16); | |
| 202 | 208 | _Size __vf = __a + __z; |
| 203 | 209 | _Size __vs = __b + __rotate(__a, 31) + __c; |
| 204 | __a = __loadword<_Size>(__s + 16) + __loadword<_Size>(__s + __len - 32); | |
| 205 | __z += __loadword<_Size>(__s + __len - 8); | |
| 210 | __a = std::__loadword<_Size>(__s + 16) + std::__loadword<_Size>(__s + __len - 32); | |
| 211 | __z += std::__loadword<_Size>(__s + __len - 8); | |
| 206 | 212 | __b = __rotate(__a + __z, 52); |
| 207 | 213 | __c = __rotate(__a, 37); |
| 208 | __a += __loadword<_Size>(__s + __len - 24); | |
| 214 | __a += std::__loadword<_Size>(__s + __len - 24); | |
| 209 | 215 | __c += __rotate(__a, 7); |
| 210 | __a += __loadword<_Size>(__s + __len - 16); | |
| 216 | __a += std::__loadword<_Size>(__s + __len - 16); | |
| 211 | 217 | _Size __wf = __a + __z; |
| 212 | 218 | _Size __ws = __b + __rotate(__a, 31) + __c; |
| 213 | 219 | _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0); |
| ... | ... | @@ -233,26 +239,26 @@ __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) |
| 233 | 239 | |
| 234 | 240 | // For strings over 64 bytes we hash the end first, and then as we |
| 235 | 241 | // loop we keep 56 bytes of state: v, w, x, y, and z. |
| 236 | _Size __x = __loadword<_Size>(__s + __len - 40); | |
| 237 | _Size __y = __loadword<_Size>(__s + __len - 16) + | |
| 238 | __loadword<_Size>(__s + __len - 56); | |
| 239 | _Size __z = __hash_len_16(__loadword<_Size>(__s + __len - 48) + __len, | |
| 240 | __loadword<_Size>(__s + __len - 24)); | |
| 242 | _Size __x = std::__loadword<_Size>(__s + __len - 40); | |
| 243 | _Size __y = std::__loadword<_Size>(__s + __len - 16) + | |
| 244 | std::__loadword<_Size>(__s + __len - 56); | |
| 245 | _Size __z = __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, | |
| 246 | std::__loadword<_Size>(__s + __len - 24)); | |
| 241 | 247 | pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z); |
| 242 | 248 | pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x); |
| 243 | __x = __x * __k1 + __loadword<_Size>(__s); | |
| 249 | __x = __x * __k1 + std::__loadword<_Size>(__s); | |
| 244 | 250 | |
| 245 | 251 | // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks. |
| 246 | 252 | __len = (__len - 1) & ~static_cast<_Size>(63); |
| 247 | 253 | do { |
| 248 | __x = __rotate(__x + __y + __v.first + __loadword<_Size>(__s + 8), 37) * __k1; | |
| 249 | __y = __rotate(__y + __v.second + __loadword<_Size>(__s + 48), 42) * __k1; | |
| 254 | __x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1; | |
| 255 | __y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1; | |
| 250 | 256 | __x ^= __w.second; |
| 251 | __y += __v.first + __loadword<_Size>(__s + 40); | |
| 257 | __y += __v.first + std::__loadword<_Size>(__s + 40); | |
| 252 | 258 | __z = __rotate(__z + __w.first, 33) * __k1; |
| 253 | 259 | __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first); |
| 254 | 260 | __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, |
| 255 | __y + __loadword<_Size>(__s + 16)); | |
| 261 | __y + std::__loadword<_Size>(__s + 16)); | |
| 256 | 262 | _VSTD::swap(__z, __x); |
| 257 | 263 | __s += 64; |
| 258 | 264 | __len -= 64; |
lib/libcxx/include/__functional/invoke.h+16-8| ... | ... | @@ -248,7 +248,7 @@ struct __member_pointer_traits_imp<_Rp _Class::*, false, true> |
| 248 | 248 | |
| 249 | 249 | template <class _MP> |
| 250 | 250 | struct __member_pointer_traits |
| 251 | : public __member_pointer_traits_imp<typename remove_cv<_MP>::type, | |
| 251 | : public __member_pointer_traits_imp<__remove_cv_t<_MP>, | |
| 252 | 252 | is_member_function_pointer<_MP>::value, |
| 253 | 253 | is_member_object_pointer<_MP>::value> |
| 254 | 254 | { |
| ... | ... | @@ -398,7 +398,7 @@ template <class _Ret, class _Fp, class ..._Args> |
| 398 | 398 | struct __invokable_r |
| 399 | 399 | { |
| 400 | 400 | template <class _XFp, class ..._XArgs> |
| 401 | static decltype(std::__invoke(declval<_XFp>(), declval<_XArgs>()...)) __try_call(int); | |
| 401 | static decltype(std::__invoke(std::declval<_XFp>(), std::declval<_XArgs>()...)) __try_call(int); | |
| 402 | 402 | template <class _XFp, class ..._XArgs> |
| 403 | 403 | static __nat __try_call(...); |
| 404 | 404 | |
| ... | ... | @@ -406,10 +406,10 @@ struct __invokable_r |
| 406 | 406 | // or incomplete array types as required by the standard. |
| 407 | 407 | using _Result = decltype(__try_call<_Fp, _Args...>(0)); |
| 408 | 408 | |
| 409 | using type = typename conditional< | |
| 409 | using type = __conditional_t< | |
| 410 | 410 | _IsNotSame<_Result, __nat>::value, |
| 411 | typename conditional< is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >::type, | |
| 412 | false_type >::type; | |
| 411 | __conditional_t<is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >, | |
| 412 | false_type>; | |
| 413 | 413 | static const bool value = type::value; |
| 414 | 414 | }; |
| 415 | 415 | template <class _Fp, class ..._Args> |
| ... | ... | @@ -428,15 +428,23 @@ struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...> |
| 428 | 428 | template <class _Tp> |
| 429 | 429 | static void __test_noexcept(_Tp) _NOEXCEPT; |
| 430 | 430 | |
| 431 | #ifdef _LIBCPP_CXX03_LANG | |
| 432 | static const bool value = false; | |
| 433 | #else | |
| 431 | 434 | static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>( |
| 432 | _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...))); | |
| 435 | _VSTD::__invoke(std::declval<_Fp>(), std::declval<_Args>()...))); | |
| 436 | #endif | |
| 433 | 437 | }; |
| 434 | 438 | |
| 435 | 439 | template <class _Ret, class _Fp, class ..._Args> |
| 436 | 440 | struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...> |
| 437 | 441 | { |
| 442 | #ifdef _LIBCPP_CXX03_LANG | |
| 443 | static const bool value = false; | |
| 444 | #else | |
| 438 | 445 | static const bool value = noexcept( |
| 439 | _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...)); | |
| 446 | _VSTD::__invoke(std::declval<_Fp>(), std::declval<_Args>()...)); | |
| 447 | #endif | |
| 440 | 448 | }; |
| 441 | 449 | |
| 442 | 450 | template <class _Ret, class _Fp, class ..._Args> |
| ... | ... | @@ -524,7 +532,7 @@ template <class _Fn, class... _Args> |
| 524 | 532 | using invoke_result_t = typename invoke_result<_Fn, _Args...>::type; |
| 525 | 533 | |
| 526 | 534 | template <class _Fn, class ..._Args> |
| 527 | _LIBCPP_CONSTEXPR_AFTER_CXX17 invoke_result_t<_Fn, _Args...> | |
| 535 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 invoke_result_t<_Fn, _Args...> | |
| 528 | 536 | invoke(_Fn&& __f, _Args&&... __args) |
| 529 | 537 | noexcept(is_nothrow_invocable_v<_Fn, _Args...>) |
| 530 | 538 | { |
lib/libcxx/include/__functional/is_transparent.h+1-2| ... | ... | @@ -25,8 +25,7 @@ template <class _Tp, class, class = void> |
| 25 | 25 | struct __is_transparent : false_type {}; |
| 26 | 26 | |
| 27 | 27 | template <class _Tp, class _Up> |
| 28 | struct __is_transparent<_Tp, _Up, | |
| 29 | typename __void_t<typename _Tp::is_transparent>::type> | |
| 28 | struct __is_transparent<_Tp, _Up, __void_t<typename _Tp::is_transparent> > | |
| 30 | 29 | : true_type {}; |
| 31 | 30 | |
| 32 | 31 | #endif |
lib/libcxx/include/__functional/mem_fn.h+3-3| ... | ... | @@ -33,12 +33,12 @@ private: |
| 33 | 33 | type __f_; |
| 34 | 34 | |
| 35 | 35 | public: |
| 36 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 36 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 37 | 37 | __mem_fn(type __f) _NOEXCEPT : __f_(__f) {} |
| 38 | 38 | |
| 39 | 39 | // invoke |
| 40 | 40 | template <class... _ArgTypes> |
| 41 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 41 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 42 | 42 | |
| 43 | 43 | typename __invoke_return<type, _ArgTypes...>::type |
| 44 | 44 | operator() (_ArgTypes&&... __args) const { |
| ... | ... | @@ -47,7 +47,7 @@ public: |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | 49 | template<class _Rp, class _Tp> |
| 50 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 50 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 51 | 51 | __mem_fn<_Rp _Tp::*> |
| 52 | 52 | mem_fn(_Rp _Tp::* __pm) _NOEXCEPT |
| 53 | 53 | { |
lib/libcxx/include/__functional/not_fn.h+2-2| ... | ... | @@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 27 | struct __not_fn_op { |
| 28 | 28 | template <class... _Args> |
| 29 | 29 | _LIBCPP_HIDE_FROM_ABI |
| 30 | _LIBCPP_CONSTEXPR_AFTER_CXX17 auto operator()(_Args&&... __args) const | |
| 30 | _LIBCPP_CONSTEXPR_SINCE_CXX20 auto operator()(_Args&&... __args) const | |
| 31 | 31 | noexcept(noexcept(!_VSTD::invoke(_VSTD::forward<_Args>(__args)...))) |
| 32 | 32 | -> decltype( !_VSTD::invoke(_VSTD::forward<_Args>(__args)...)) |
| 33 | 33 | { return !_VSTD::invoke(_VSTD::forward<_Args>(__args)...); } |
| ... | ... | @@ -43,7 +43,7 @@ template <class _Fn, class = enable_if_t< |
| 43 | 43 | is_move_constructible_v<decay_t<_Fn>> |
| 44 | 44 | >> |
| 45 | 45 | _LIBCPP_HIDE_FROM_ABI |
| 46 | _LIBCPP_CONSTEXPR_AFTER_CXX17 auto not_fn(_Fn&& __f) { | |
| 46 | _LIBCPP_CONSTEXPR_SINCE_CXX20 auto not_fn(_Fn&& __f) { | |
| 47 | 47 | return __not_fn_t<decay_t<_Fn>>(_VSTD::forward<_Fn>(__f)); |
| 48 | 48 | } |
| 49 | 49 |
lib/libcxx/include/__functional/operations.h+57-38| ... | ... | @@ -32,17 +32,18 @@ struct _LIBCPP_TEMPLATE_VIS plus |
| 32 | 32 | : __binary_function<_Tp, _Tp, _Tp> |
| 33 | 33 | { |
| 34 | 34 | typedef _Tp __result_type; // used by valarray |
| 35 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 35 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 36 | 36 | _Tp operator()(const _Tp& __x, const _Tp& __y) const |
| 37 | 37 | {return __x + __y;} |
| 38 | 38 | }; |
| 39 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(plus); | |
| 39 | 40 | |
| 40 | 41 | #if _LIBCPP_STD_VER > 11 |
| 41 | 42 | template <> |
| 42 | 43 | struct _LIBCPP_TEMPLATE_VIS plus<void> |
| 43 | 44 | { |
| 44 | 45 | template <class _T1, class _T2> |
| 45 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 46 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 46 | 47 | auto operator()(_T1&& __t, _T2&& __u) const |
| 47 | 48 | noexcept(noexcept(_VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u))) |
| 48 | 49 | -> decltype( _VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -60,17 +61,18 @@ struct _LIBCPP_TEMPLATE_VIS minus |
| 60 | 61 | : __binary_function<_Tp, _Tp, _Tp> |
| 61 | 62 | { |
| 62 | 63 | typedef _Tp __result_type; // used by valarray |
| 63 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 64 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 64 | 65 | _Tp operator()(const _Tp& __x, const _Tp& __y) const |
| 65 | 66 | {return __x - __y;} |
| 66 | 67 | }; |
| 68 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus); | |
| 67 | 69 | |
| 68 | 70 | #if _LIBCPP_STD_VER > 11 |
| 69 | 71 | template <> |
| 70 | 72 | struct _LIBCPP_TEMPLATE_VIS minus<void> |
| 71 | 73 | { |
| 72 | 74 | template <class _T1, class _T2> |
| 73 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 75 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 74 | 76 | auto operator()(_T1&& __t, _T2&& __u) const |
| 75 | 77 | noexcept(noexcept(_VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u))) |
| 76 | 78 | -> decltype( _VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -88,17 +90,18 @@ struct _LIBCPP_TEMPLATE_VIS multiplies |
| 88 | 90 | : __binary_function<_Tp, _Tp, _Tp> |
| 89 | 91 | { |
| 90 | 92 | typedef _Tp __result_type; // used by valarray |
| 91 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 93 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 92 | 94 | _Tp operator()(const _Tp& __x, const _Tp& __y) const |
| 93 | 95 | {return __x * __y;} |
| 94 | 96 | }; |
| 97 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies); | |
| 95 | 98 | |
| 96 | 99 | #if _LIBCPP_STD_VER > 11 |
| 97 | 100 | template <> |
| 98 | 101 | struct _LIBCPP_TEMPLATE_VIS multiplies<void> |
| 99 | 102 | { |
| 100 | 103 | template <class _T1, class _T2> |
| 101 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 104 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 102 | 105 | auto operator()(_T1&& __t, _T2&& __u) const |
| 103 | 106 | noexcept(noexcept(_VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u))) |
| 104 | 107 | -> decltype( _VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -116,17 +119,18 @@ struct _LIBCPP_TEMPLATE_VIS divides |
| 116 | 119 | : __binary_function<_Tp, _Tp, _Tp> |
| 117 | 120 | { |
| 118 | 121 | typedef _Tp __result_type; // used by valarray |
| 119 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 122 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 120 | 123 | _Tp operator()(const _Tp& __x, const _Tp& __y) const |
| 121 | 124 | {return __x / __y;} |
| 122 | 125 | }; |
| 126 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides); | |
| 123 | 127 | |
| 124 | 128 | #if _LIBCPP_STD_VER > 11 |
| 125 | 129 | template <> |
| 126 | 130 | struct _LIBCPP_TEMPLATE_VIS divides<void> |
| 127 | 131 | { |
| 128 | 132 | template <class _T1, class _T2> |
| 129 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 133 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 130 | 134 | auto operator()(_T1&& __t, _T2&& __u) const |
| 131 | 135 | noexcept(noexcept(_VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u))) |
| 132 | 136 | -> decltype( _VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -144,17 +148,18 @@ struct _LIBCPP_TEMPLATE_VIS modulus |
| 144 | 148 | : __binary_function<_Tp, _Tp, _Tp> |
| 145 | 149 | { |
| 146 | 150 | typedef _Tp __result_type; // used by valarray |
| 147 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 151 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 148 | 152 | _Tp operator()(const _Tp& __x, const _Tp& __y) const |
| 149 | 153 | {return __x % __y;} |
| 150 | 154 | }; |
| 155 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus); | |
| 151 | 156 | |
| 152 | 157 | #if _LIBCPP_STD_VER > 11 |
| 153 | 158 | template <> |
| 154 | 159 | struct _LIBCPP_TEMPLATE_VIS modulus<void> |
| 155 | 160 | { |
| 156 | 161 | template <class _T1, class _T2> |
| 157 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 162 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 158 | 163 | auto operator()(_T1&& __t, _T2&& __u) const |
| 159 | 164 | noexcept(noexcept(_VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u))) |
| 160 | 165 | -> decltype( _VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -172,17 +177,18 @@ struct _LIBCPP_TEMPLATE_VIS negate |
| 172 | 177 | : __unary_function<_Tp, _Tp> |
| 173 | 178 | { |
| 174 | 179 | typedef _Tp __result_type; // used by valarray |
| 175 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 180 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 176 | 181 | _Tp operator()(const _Tp& __x) const |
| 177 | 182 | {return -__x;} |
| 178 | 183 | }; |
| 184 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate); | |
| 179 | 185 | |
| 180 | 186 | #if _LIBCPP_STD_VER > 11 |
| 181 | 187 | template <> |
| 182 | 188 | struct _LIBCPP_TEMPLATE_VIS negate<void> |
| 183 | 189 | { |
| 184 | 190 | template <class _Tp> |
| 185 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 191 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 186 | 192 | auto operator()(_Tp&& __x) const |
| 187 | 193 | noexcept(noexcept(- _VSTD::forward<_Tp>(__x))) |
| 188 | 194 | -> decltype( - _VSTD::forward<_Tp>(__x)) |
| ... | ... | @@ -202,17 +208,18 @@ struct _LIBCPP_TEMPLATE_VIS bit_and |
| 202 | 208 | : __binary_function<_Tp, _Tp, _Tp> |
| 203 | 209 | { |
| 204 | 210 | typedef _Tp __result_type; // used by valarray |
| 205 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 211 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 206 | 212 | _Tp operator()(const _Tp& __x, const _Tp& __y) const |
| 207 | 213 | {return __x & __y;} |
| 208 | 214 | }; |
| 215 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and); | |
| 209 | 216 | |
| 210 | 217 | #if _LIBCPP_STD_VER > 11 |
| 211 | 218 | template <> |
| 212 | 219 | struct _LIBCPP_TEMPLATE_VIS bit_and<void> |
| 213 | 220 | { |
| 214 | 221 | template <class _T1, class _T2> |
| 215 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 222 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 216 | 223 | auto operator()(_T1&& __t, _T2&& __u) const |
| 217 | 224 | noexcept(noexcept(_VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u))) |
| 218 | 225 | -> decltype( _VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -226,16 +233,17 @@ template <class _Tp = void> |
| 226 | 233 | struct _LIBCPP_TEMPLATE_VIS bit_not |
| 227 | 234 | : __unary_function<_Tp, _Tp> |
| 228 | 235 | { |
| 229 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 236 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 230 | 237 | _Tp operator()(const _Tp& __x) const |
| 231 | 238 | {return ~__x;} |
| 232 | 239 | }; |
| 240 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_not); | |
| 233 | 241 | |
| 234 | 242 | template <> |
| 235 | 243 | struct _LIBCPP_TEMPLATE_VIS bit_not<void> |
| 236 | 244 | { |
| 237 | 245 | template <class _Tp> |
| 238 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 246 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 239 | 247 | auto operator()(_Tp&& __x) const |
| 240 | 248 | noexcept(noexcept(~_VSTD::forward<_Tp>(__x))) |
| 241 | 249 | -> decltype( ~_VSTD::forward<_Tp>(__x)) |
| ... | ... | @@ -253,17 +261,18 @@ struct _LIBCPP_TEMPLATE_VIS bit_or |
| 253 | 261 | : __binary_function<_Tp, _Tp, _Tp> |
| 254 | 262 | { |
| 255 | 263 | typedef _Tp __result_type; // used by valarray |
| 256 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 264 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 257 | 265 | _Tp operator()(const _Tp& __x, const _Tp& __y) const |
| 258 | 266 | {return __x | __y;} |
| 259 | 267 | }; |
| 268 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or); | |
| 260 | 269 | |
| 261 | 270 | #if _LIBCPP_STD_VER > 11 |
| 262 | 271 | template <> |
| 263 | 272 | struct _LIBCPP_TEMPLATE_VIS bit_or<void> |
| 264 | 273 | { |
| 265 | 274 | template <class _T1, class _T2> |
| 266 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 275 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 267 | 276 | auto operator()(_T1&& __t, _T2&& __u) const |
| 268 | 277 | noexcept(noexcept(_VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u))) |
| 269 | 278 | -> decltype( _VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -281,17 +290,18 @@ struct _LIBCPP_TEMPLATE_VIS bit_xor |
| 281 | 290 | : __binary_function<_Tp, _Tp, _Tp> |
| 282 | 291 | { |
| 283 | 292 | typedef _Tp __result_type; // used by valarray |
| 284 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 293 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 285 | 294 | _Tp operator()(const _Tp& __x, const _Tp& __y) const |
| 286 | 295 | {return __x ^ __y;} |
| 287 | 296 | }; |
| 297 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor); | |
| 288 | 298 | |
| 289 | 299 | #if _LIBCPP_STD_VER > 11 |
| 290 | 300 | template <> |
| 291 | 301 | struct _LIBCPP_TEMPLATE_VIS bit_xor<void> |
| 292 | 302 | { |
| 293 | 303 | template <class _T1, class _T2> |
| 294 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 304 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 295 | 305 | auto operator()(_T1&& __t, _T2&& __u) const |
| 296 | 306 | noexcept(noexcept(_VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u))) |
| 297 | 307 | -> decltype( _VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -311,17 +321,18 @@ struct _LIBCPP_TEMPLATE_VIS equal_to |
| 311 | 321 | : __binary_function<_Tp, _Tp, bool> |
| 312 | 322 | { |
| 313 | 323 | typedef bool __result_type; // used by valarray |
| 314 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 324 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 315 | 325 | bool operator()(const _Tp& __x, const _Tp& __y) const |
| 316 | 326 | {return __x == __y;} |
| 317 | 327 | }; |
| 328 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to); | |
| 318 | 329 | |
| 319 | 330 | #if _LIBCPP_STD_VER > 11 |
| 320 | 331 | template <> |
| 321 | 332 | struct _LIBCPP_TEMPLATE_VIS equal_to<void> |
| 322 | 333 | { |
| 323 | 334 | template <class _T1, class _T2> |
| 324 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 335 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 325 | 336 | auto operator()(_T1&& __t, _T2&& __u) const |
| 326 | 337 | noexcept(noexcept(_VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u))) |
| 327 | 338 | -> decltype( _VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -339,17 +350,18 @@ struct _LIBCPP_TEMPLATE_VIS not_equal_to |
| 339 | 350 | : __binary_function<_Tp, _Tp, bool> |
| 340 | 351 | { |
| 341 | 352 | typedef bool __result_type; // used by valarray |
| 342 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 353 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 343 | 354 | bool operator()(const _Tp& __x, const _Tp& __y) const |
| 344 | 355 | {return __x != __y;} |
| 345 | 356 | }; |
| 357 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to); | |
| 346 | 358 | |
| 347 | 359 | #if _LIBCPP_STD_VER > 11 |
| 348 | 360 | template <> |
| 349 | 361 | struct _LIBCPP_TEMPLATE_VIS not_equal_to<void> |
| 350 | 362 | { |
| 351 | 363 | template <class _T1, class _T2> |
| 352 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 364 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 353 | 365 | auto operator()(_T1&& __t, _T2&& __u) const |
| 354 | 366 | noexcept(noexcept(_VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u))) |
| 355 | 367 | -> decltype( _VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -367,17 +379,18 @@ struct _LIBCPP_TEMPLATE_VIS less |
| 367 | 379 | : __binary_function<_Tp, _Tp, bool> |
| 368 | 380 | { |
| 369 | 381 | typedef bool __result_type; // used by valarray |
| 370 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 382 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 371 | 383 | bool operator()(const _Tp& __x, const _Tp& __y) const |
| 372 | 384 | {return __x < __y;} |
| 373 | 385 | }; |
| 386 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less); | |
| 374 | 387 | |
| 375 | 388 | #if _LIBCPP_STD_VER > 11 |
| 376 | 389 | template <> |
| 377 | 390 | struct _LIBCPP_TEMPLATE_VIS less<void> |
| 378 | 391 | { |
| 379 | 392 | template <class _T1, class _T2> |
| 380 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 393 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 381 | 394 | auto operator()(_T1&& __t, _T2&& __u) const |
| 382 | 395 | noexcept(noexcept(_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u))) |
| 383 | 396 | -> decltype( _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -395,17 +408,18 @@ struct _LIBCPP_TEMPLATE_VIS less_equal |
| 395 | 408 | : __binary_function<_Tp, _Tp, bool> |
| 396 | 409 | { |
| 397 | 410 | typedef bool __result_type; // used by valarray |
| 398 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 411 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 399 | 412 | bool operator()(const _Tp& __x, const _Tp& __y) const |
| 400 | 413 | {return __x <= __y;} |
| 401 | 414 | }; |
| 415 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal); | |
| 402 | 416 | |
| 403 | 417 | #if _LIBCPP_STD_VER > 11 |
| 404 | 418 | template <> |
| 405 | 419 | struct _LIBCPP_TEMPLATE_VIS less_equal<void> |
| 406 | 420 | { |
| 407 | 421 | template <class _T1, class _T2> |
| 408 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 422 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 409 | 423 | auto operator()(_T1&& __t, _T2&& __u) const |
| 410 | 424 | noexcept(noexcept(_VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u))) |
| 411 | 425 | -> decltype( _VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -423,17 +437,18 @@ struct _LIBCPP_TEMPLATE_VIS greater_equal |
| 423 | 437 | : __binary_function<_Tp, _Tp, bool> |
| 424 | 438 | { |
| 425 | 439 | typedef bool __result_type; // used by valarray |
| 426 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 440 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 427 | 441 | bool operator()(const _Tp& __x, const _Tp& __y) const |
| 428 | 442 | {return __x >= __y;} |
| 429 | 443 | }; |
| 444 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal); | |
| 430 | 445 | |
| 431 | 446 | #if _LIBCPP_STD_VER > 11 |
| 432 | 447 | template <> |
| 433 | 448 | struct _LIBCPP_TEMPLATE_VIS greater_equal<void> |
| 434 | 449 | { |
| 435 | 450 | template <class _T1, class _T2> |
| 436 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 451 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 437 | 452 | auto operator()(_T1&& __t, _T2&& __u) const |
| 438 | 453 | noexcept(noexcept(_VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u))) |
| 439 | 454 | -> decltype( _VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -451,17 +466,18 @@ struct _LIBCPP_TEMPLATE_VIS greater |
| 451 | 466 | : __binary_function<_Tp, _Tp, bool> |
| 452 | 467 | { |
| 453 | 468 | typedef bool __result_type; // used by valarray |
| 454 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 469 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 455 | 470 | bool operator()(const _Tp& __x, const _Tp& __y) const |
| 456 | 471 | {return __x > __y;} |
| 457 | 472 | }; |
| 473 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater); | |
| 458 | 474 | |
| 459 | 475 | #if _LIBCPP_STD_VER > 11 |
| 460 | 476 | template <> |
| 461 | 477 | struct _LIBCPP_TEMPLATE_VIS greater<void> |
| 462 | 478 | { |
| 463 | 479 | template <class _T1, class _T2> |
| 464 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 480 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 465 | 481 | auto operator()(_T1&& __t, _T2&& __u) const |
| 466 | 482 | noexcept(noexcept(_VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u))) |
| 467 | 483 | -> decltype( _VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -481,17 +497,18 @@ struct _LIBCPP_TEMPLATE_VIS logical_and |
| 481 | 497 | : __binary_function<_Tp, _Tp, bool> |
| 482 | 498 | { |
| 483 | 499 | typedef bool __result_type; // used by valarray |
| 484 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 500 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 485 | 501 | bool operator()(const _Tp& __x, const _Tp& __y) const |
| 486 | 502 | {return __x && __y;} |
| 487 | 503 | }; |
| 504 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and); | |
| 488 | 505 | |
| 489 | 506 | #if _LIBCPP_STD_VER > 11 |
| 490 | 507 | template <> |
| 491 | 508 | struct _LIBCPP_TEMPLATE_VIS logical_and<void> |
| 492 | 509 | { |
| 493 | 510 | template <class _T1, class _T2> |
| 494 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 511 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 495 | 512 | auto operator()(_T1&& __t, _T2&& __u) const |
| 496 | 513 | noexcept(noexcept(_VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u))) |
| 497 | 514 | -> decltype( _VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u)) |
| ... | ... | @@ -509,17 +526,18 @@ struct _LIBCPP_TEMPLATE_VIS logical_not |
| 509 | 526 | : __unary_function<_Tp, bool> |
| 510 | 527 | { |
| 511 | 528 | typedef bool __result_type; // used by valarray |
| 512 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 529 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 513 | 530 | bool operator()(const _Tp& __x) const |
| 514 | 531 | {return !__x;} |
| 515 | 532 | }; |
| 533 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not); | |
| 516 | 534 | |
| 517 | 535 | #if _LIBCPP_STD_VER > 11 |
| 518 | 536 | template <> |
| 519 | 537 | struct _LIBCPP_TEMPLATE_VIS logical_not<void> |
| 520 | 538 | { |
| 521 | 539 | template <class _Tp> |
| 522 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 540 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 523 | 541 | auto operator()(_Tp&& __x) const |
| 524 | 542 | noexcept(noexcept(!_VSTD::forward<_Tp>(__x))) |
| 525 | 543 | -> decltype( !_VSTD::forward<_Tp>(__x)) |
| ... | ... | @@ -537,17 +555,18 @@ struct _LIBCPP_TEMPLATE_VIS logical_or |
| 537 | 555 | : __binary_function<_Tp, _Tp, bool> |
| 538 | 556 | { |
| 539 | 557 | typedef bool __result_type; // used by valarray |
| 540 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 558 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 541 | 559 | bool operator()(const _Tp& __x, const _Tp& __y) const |
| 542 | 560 | {return __x || __y;} |
| 543 | 561 | }; |
| 562 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or); | |
| 544 | 563 | |
| 545 | 564 | #if _LIBCPP_STD_VER > 11 |
| 546 | 565 | template <> |
| 547 | 566 | struct _LIBCPP_TEMPLATE_VIS logical_or<void> |
| 548 | 567 | { |
| 549 | 568 | template <class _T1, class _T2> |
| 550 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 569 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 551 | 570 | auto operator()(_T1&& __t, _T2&& __u) const |
| 552 | 571 | noexcept(noexcept(_VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u))) |
| 553 | 572 | -> decltype( _VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u)) |
lib/libcxx/include/__functional/ranges_operations.h+2-1| ... | ... | @@ -10,9 +10,10 @@ |
| 10 | 10 | #ifndef _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H |
| 11 | 11 | #define _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H |
| 12 | 12 | |
| 13 | #include <__concepts/equality_comparable.h> | |
| 14 | #include <__concepts/totally_ordered.h> | |
| 13 | 15 | #include <__config> |
| 14 | 16 | #include <__utility/forward.h> |
| 15 | #include <concepts> | |
| 16 | 17 | |
| 17 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 19 | # pragma GCC system_header |
lib/libcxx/include/__functional/reference_wrapper.h+14-11| ... | ... | @@ -11,10 +11,13 @@ |
| 11 | 11 | #define _LIBCPP___FUNCTIONAL_REFERENCE_WRAPPER_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <__functional/invoke.h> | |
| 14 | 15 | #include <__functional/weak_result_type.h> |
| 15 | 16 | #include <__memory/addressof.h> |
| 17 | #include <__type_traits/enable_if.h> | |
| 18 | #include <__type_traits/remove_cvref.h> | |
| 19 | #include <__utility/declval.h> | |
| 16 | 20 | #include <__utility/forward.h> |
| 17 | #include <type_traits> | |
| 18 | 21 | |
| 19 | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | 23 | # pragma GCC system_header |
| ... | ... | @@ -35,22 +38,22 @@ private: |
| 35 | 38 | static void __fun(_Tp&&) = delete; |
| 36 | 39 | |
| 37 | 40 | public: |
| 38 | template <class _Up, class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(declval<_Up>())) > > | |
| 39 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 40 | reference_wrapper(_Up&& __u) _NOEXCEPT_(noexcept(__fun(declval<_Up>()))) { | |
| 41 | template <class _Up, class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(std::declval<_Up>())) > > | |
| 42 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 43 | reference_wrapper(_Up&& __u) _NOEXCEPT_(noexcept(__fun(std::declval<_Up>()))) { | |
| 41 | 44 | type& __f = static_cast<_Up&&>(__u); |
| 42 | 45 | __f_ = _VSTD::addressof(__f); |
| 43 | 46 | } |
| 44 | 47 | |
| 45 | 48 | // access |
| 46 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 49 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 47 | 50 | operator type&() const _NOEXCEPT {return *__f_;} |
| 48 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 51 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 49 | 52 | type& get() const _NOEXCEPT {return *__f_;} |
| 50 | 53 | |
| 51 | 54 | // invoke |
| 52 | 55 | template <class... _ArgTypes> |
| 53 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 56 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 54 | 57 | typename __invoke_of<type&, _ArgTypes...>::type |
| 55 | 58 | operator() (_ArgTypes&&... __args) const { |
| 56 | 59 | return std::__invoke(get(), std::forward<_ArgTypes>(__args)...); |
| ... | ... | @@ -63,7 +66,7 @@ reference_wrapper(_Tp&) -> reference_wrapper<_Tp>; |
| 63 | 66 | #endif |
| 64 | 67 | |
| 65 | 68 | template <class _Tp> |
| 66 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 69 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 67 | 70 | reference_wrapper<_Tp> |
| 68 | 71 | ref(_Tp& __t) _NOEXCEPT |
| 69 | 72 | { |
| ... | ... | @@ -71,7 +74,7 @@ ref(_Tp& __t) _NOEXCEPT |
| 71 | 74 | } |
| 72 | 75 | |
| 73 | 76 | template <class _Tp> |
| 74 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 77 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 75 | 78 | reference_wrapper<_Tp> |
| 76 | 79 | ref(reference_wrapper<_Tp> __t) _NOEXCEPT |
| 77 | 80 | { |
| ... | ... | @@ -79,7 +82,7 @@ ref(reference_wrapper<_Tp> __t) _NOEXCEPT |
| 79 | 82 | } |
| 80 | 83 | |
| 81 | 84 | template <class _Tp> |
| 82 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 85 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 83 | 86 | reference_wrapper<const _Tp> |
| 84 | 87 | cref(const _Tp& __t) _NOEXCEPT |
| 85 | 88 | { |
| ... | ... | @@ -87,7 +90,7 @@ cref(const _Tp& __t) _NOEXCEPT |
| 87 | 90 | } |
| 88 | 91 | |
| 89 | 92 | template <class _Tp> |
| 90 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 93 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 91 | 94 | reference_wrapper<const _Tp> |
| 92 | 95 | cref(reference_wrapper<_Tp> __t) _NOEXCEPT |
| 93 | 96 | { |
lib/libcxx/include/__functional/unary_negate.h+3-3| ... | ... | @@ -27,16 +27,16 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate |
| 27 | 27 | { |
| 28 | 28 | _Predicate __pred_; |
| 29 | 29 | public: |
| 30 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 30 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 31 | 31 | explicit unary_negate(const _Predicate& __pred) |
| 32 | 32 | : __pred_(__pred) {} |
| 33 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 33 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 34 | 34 | bool operator()(const typename _Predicate::argument_type& __x) const |
| 35 | 35 | {return !__pred_(__x);} |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | 38 | template <class _Predicate> |
| 39 | _LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 39 | _LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 40 | 40 | unary_negate<_Predicate> |
| 41 | 41 | not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);} |
| 42 | 42 |
lib/libcxx/include/__functional/unwrap_ref.h+1| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | #define _LIBCPP___FUNCTIONAL_UNWRAP_REF_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/decay.h> | |
| 13 | 14 | |
| 14 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 15 | 16 | # pragma GCC system_header |
lib/libcxx/include/__functional/weak_result_type.h+5-2| ... | ... | @@ -12,8 +12,11 @@ |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | 14 | #include <__functional/binary_function.h> |
| 15 | #include <__functional/invoke.h> | |
| 15 | 16 | #include <__functional/unary_function.h> |
| 16 | #include <type_traits> | |
| 17 | #include <__type_traits/integral_constant.h> | |
| 18 | #include <__type_traits/is_same.h> | |
| 19 | #include <__utility/declval.h> | |
| 17 | 20 | |
| 18 | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 22 | # pragma GCC system_header |
| ... | ... | @@ -283,7 +286,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> |
| 283 | 286 | template <class _Tp, class ..._Args> |
| 284 | 287 | struct __invoke_return |
| 285 | 288 | { |
| 286 | typedef decltype(_VSTD::__invoke(declval<_Tp>(), declval<_Args>()...)) type; | |
| 289 | typedef decltype(_VSTD::__invoke(std::declval<_Tp>(), std::declval<_Args>()...)) type; | |
| 287 | 290 | }; |
| 288 | 291 | |
| 289 | 292 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__fwd/array.h created+26| ... | ... | @@ -0,0 +1,26 @@ |
| 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_ARRAY_H | |
| 10 | #define _LIBCPP___FWD_ARRAY_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <cstddef> | |
| 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, size_t _Size> | |
| 22 | struct _LIBCPP_TEMPLATE_VIS array; | |
| 23 | ||
| 24 | _LIBCPP_END_NAMESPACE_STD | |
| 25 | ||
| 26 | #endif // _LIBCPP___FWD_ARRAY_H |
lib/libcxx/include/__fwd/get.h created+115| ... | ... | @@ -0,0 +1,115 @@ |
| 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_GET_H | |
| 10 | #define _LIBCPP___FWD_GET_H | |
| 11 | ||
| 12 | #include <__concepts/copyable.h> | |
| 13 | #include <__config> | |
| 14 | #include <__fwd/array.h> | |
| 15 | #include <__fwd/pair.h> | |
| 16 | #include <__fwd/subrange.h> | |
| 17 | #include <__fwd/tuple.h> | |
| 18 | #include <__tuple_dir/tuple_element.h> | |
| 19 | #include <cstddef> | |
| 20 | ||
| 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 22 | # pragma GCC system_header | |
| 23 | #endif | |
| 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 26 | ||
| 27 | #ifndef _LIBCPP_CXX03_LANG | |
| 28 | ||
| 29 | template <size_t _Ip, class ..._Tp> | |
| 30 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 31 | typename tuple_element<_Ip, tuple<_Tp...> >::type& | |
| 32 | get(tuple<_Tp...>&) _NOEXCEPT; | |
| 33 | ||
| 34 | template <size_t _Ip, class ..._Tp> | |
| 35 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 36 | const typename tuple_element<_Ip, tuple<_Tp...> >::type& | |
| 37 | get(const tuple<_Tp...>&) _NOEXCEPT; | |
| 38 | ||
| 39 | template <size_t _Ip, class ..._Tp> | |
| 40 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 41 | typename tuple_element<_Ip, tuple<_Tp...> >::type&& | |
| 42 | get(tuple<_Tp...>&&) _NOEXCEPT; | |
| 43 | ||
| 44 | template <size_t _Ip, class ..._Tp> | |
| 45 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 46 | const typename tuple_element<_Ip, tuple<_Tp...> >::type&& | |
| 47 | get(const tuple<_Tp...>&&) _NOEXCEPT; | |
| 48 | ||
| 49 | #endif //_LIBCPP_CXX03_LANG | |
| 50 | ||
| 51 | template <size_t _Ip, class _T1, class _T2> | |
| 52 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 53 | typename tuple_element<_Ip, pair<_T1, _T2> >::type& | |
| 54 | get(pair<_T1, _T2>&) _NOEXCEPT; | |
| 55 | ||
| 56 | template <size_t _Ip, class _T1, class _T2> | |
| 57 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 58 | const typename tuple_element<_Ip, pair<_T1, _T2> >::type& | |
| 59 | get(const pair<_T1, _T2>&) _NOEXCEPT; | |
| 60 | ||
| 61 | #ifndef _LIBCPP_CXX03_LANG | |
| 62 | template <size_t _Ip, class _T1, class _T2> | |
| 63 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 64 | typename tuple_element<_Ip, pair<_T1, _T2> >::type&& | |
| 65 | get(pair<_T1, _T2>&&) _NOEXCEPT; | |
| 66 | ||
| 67 | template <size_t _Ip, class _T1, class _T2> | |
| 68 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 69 | const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& | |
| 70 | get(const pair<_T1, _T2>&&) _NOEXCEPT; | |
| 71 | #endif | |
| 72 | ||
| 73 | template <size_t _Ip, class _Tp, size_t _Size> | |
| 74 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 75 | _Tp& | |
| 76 | get(array<_Tp, _Size>&) _NOEXCEPT; | |
| 77 | ||
| 78 | template <size_t _Ip, class _Tp, size_t _Size> | |
| 79 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 80 | const _Tp& | |
| 81 | get(const array<_Tp, _Size>&) _NOEXCEPT; | |
| 82 | ||
| 83 | #ifndef _LIBCPP_CXX03_LANG | |
| 84 | template <size_t _Ip, class _Tp, size_t _Size> | |
| 85 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 86 | _Tp&& | |
| 87 | get(array<_Tp, _Size>&&) _NOEXCEPT; | |
| 88 | ||
| 89 | template <size_t _Ip, class _Tp, size_t _Size> | |
| 90 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 91 | const _Tp&& | |
| 92 | get(const array<_Tp, _Size>&&) _NOEXCEPT; | |
| 93 | #endif | |
| 94 | ||
| 95 | #if _LIBCPP_STD_VER >= 20 | |
| 96 | ||
| 97 | namespace ranges { | |
| 98 | ||
| 99 | template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> | |
| 100 | requires((_Index == 0 && copyable<_Iter>) || _Index == 1) | |
| 101 | _LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange); | |
| 102 | ||
| 103 | template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> | |
| 104 | requires(_Index < 2) | |
| 105 | _LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange); | |
| 106 | ||
| 107 | } // namespace ranges | |
| 108 | ||
| 109 | using ranges::get; | |
| 110 | ||
| 111 | #endif // _LIBCPP_STD_VER >= 20 | |
| 112 | ||
| 113 | _LIBCPP_END_NAMESPACE_STD | |
| 114 | ||
| 115 | #endif // _LIBCPP___FWD_GET_H |
lib/libcxx/include/__fwd/hash.h created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 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_HASH_H | |
| 10 | #define _LIBCPP___FWD_HASH_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> | |
| 21 | struct _LIBCPP_TEMPLATE_VIS hash; | |
| 22 | ||
| 23 | _LIBCPP_END_NAMESPACE_STD | |
| 24 | ||
| 25 | #endif // _LIBCPP___FWD_HASH_H |
lib/libcxx/include/__fwd/memory_resource.h created+27| ... | ... | @@ -0,0 +1,27 @@ |
| 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_MEMORY_RESOURCE_H | |
| 10 | #define _LIBCPP___FWD_MEMORY_RESOURCE_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 | namespace pmr { | |
| 21 | template <class _ValueType> | |
| 22 | class _LIBCPP_TEMPLATE_VIS polymorphic_allocator; | |
| 23 | } // namespace pmr | |
| 24 | ||
| 25 | _LIBCPP_END_NAMESPACE_STD | |
| 26 | ||
| 27 | #endif // _LIBCPP___FWD_MEMORY_RESOURCE_H |
lib/libcxx/include/__fwd/pair.h created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 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_PAIR_H | |
| 10 | #define _LIBCPP___FWD_PAIR_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, class> | |
| 21 | struct _LIBCPP_TEMPLATE_VIS pair; | |
| 22 | ||
| 23 | _LIBCPP_END_NAMESPACE_STD | |
| 24 | ||
| 25 | #endif // _LIBCPP___FWD_PAIR_H |
lib/libcxx/include/__fwd/span.h+3-3| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | // |
| 8 | 8 | //===---------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | #ifndef _LIBCPP_FWD_SPAN_H | |
| 11 | #define _LIBCPP_FWD_SPAN_H | |
| 10 | #ifndef _LIBCPP___FWD_SPAN_H | |
| 11 | #define _LIBCPP___FWD_SPAN_H | |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | 14 | #include <cstddef> |
| ... | ... | @@ -34,4 +34,4 @@ _LIBCPP_END_NAMESPACE_STD |
| 34 | 34 | |
| 35 | 35 | _LIBCPP_POP_MACROS |
| 36 | 36 | |
| 37 | #endif // _LIBCPP_FWD_SPAN_H | |
| 37 | #endif // _LIBCPP___FWD_SPAN_H |
lib/libcxx/include/__fwd/string.h created+110| ... | ... | @@ -0,0 +1,110 @@ |
| 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_STRING_H | |
| 10 | #define _LIBCPP___FWD_STRING_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__fwd/memory_resource.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 _CharT> | |
| 22 | struct _LIBCPP_TEMPLATE_VIS char_traits; | |
| 23 | template <> | |
| 24 | struct char_traits<char>; | |
| 25 | ||
| 26 | #ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 27 | template <> | |
| 28 | struct char_traits<char8_t>; | |
| 29 | #endif | |
| 30 | ||
| 31 | template <> | |
| 32 | struct char_traits<char16_t>; | |
| 33 | template <> | |
| 34 | struct char_traits<char32_t>; | |
| 35 | ||
| 36 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 37 | template <> | |
| 38 | struct char_traits<wchar_t>; | |
| 39 | #endif | |
| 40 | ||
| 41 | template <class _Tp> | |
| 42 | class _LIBCPP_TEMPLATE_VIS allocator; | |
| 43 | ||
| 44 | template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> > | |
| 45 | class _LIBCPP_TEMPLATE_VIS basic_string; | |
| 46 | ||
| 47 | using string = basic_string<char>; | |
| 48 | ||
| 49 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 50 | using wstring = basic_string<wchar_t>; | |
| 51 | #endif | |
| 52 | ||
| 53 | #ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 54 | using u8string = basic_string<char8_t>; | |
| 55 | #endif | |
| 56 | ||
| 57 | using u16string = basic_string<char16_t>; | |
| 58 | using u32string = basic_string<char32_t>; | |
| 59 | ||
| 60 | #if _LIBCPP_STD_VER >= 17 | |
| 61 | ||
| 62 | namespace pmr { | |
| 63 | template <class _CharT, class _Traits = char_traits<_CharT>> | |
| 64 | using basic_string = std::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>; | |
| 65 | ||
| 66 | using string = basic_string<char>; | |
| 67 | ||
| 68 | # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 69 | using wstring = basic_string<wchar_t>; | |
| 70 | # endif | |
| 71 | ||
| 72 | # ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 73 | using u8string = basic_string<char8_t>; | |
| 74 | # endif | |
| 75 | ||
| 76 | using u16string = basic_string<char16_t>; | |
| 77 | using u32string = basic_string<char32_t>; | |
| 78 | ||
| 79 | } // namespace pmr | |
| 80 | ||
| 81 | #endif // _LIBCPP_STD_VER >= 17 | |
| 82 | ||
| 83 | // clang-format off | |
| 84 | template <class _CharT, class _Traits, class _Allocator> | |
| 85 | class _LIBCPP_PREFERRED_NAME(string) | |
| 86 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 87 | _LIBCPP_PREFERRED_NAME(wstring) | |
| 88 | #endif | |
| 89 | #ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 90 | _LIBCPP_PREFERRED_NAME(u8string) | |
| 91 | #endif | |
| 92 | _LIBCPP_PREFERRED_NAME(u16string) | |
| 93 | _LIBCPP_PREFERRED_NAME(u32string) | |
| 94 | #if _LIBCPP_STD_VER >= 17 | |
| 95 | _LIBCPP_PREFERRED_NAME(pmr::string) | |
| 96 | # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 97 | _LIBCPP_PREFERRED_NAME(pmr::wstring) | |
| 98 | # endif | |
| 99 | # ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 100 | _LIBCPP_PREFERRED_NAME(pmr::u8string) | |
| 101 | # endif | |
| 102 | _LIBCPP_PREFERRED_NAME(pmr::u16string) | |
| 103 | _LIBCPP_PREFERRED_NAME(pmr::u32string) | |
| 104 | #endif | |
| 105 | basic_string; | |
| 106 | // clang-format on | |
| 107 | ||
| 108 | _LIBCPP_END_NAMESPACE_STD | |
| 109 | ||
| 110 | #endif // _LIBCPP___FWD_STRING_H |
lib/libcxx/include/__fwd/string_view.h+16-3| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | // |
| 8 | 8 | //===---------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | #ifndef _LIBCPP_FWD_STRING_VIEW_H | |
| 11 | #define _LIBCPP_FWD_STRING_VIEW_H | |
| 10 | #ifndef _LIBCPP___FWD_STRING_VIEW_H | |
| 11 | #define _LIBCPP___FWD_STRING_VIEW_H | |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | 14 | #include <iosfwd> // char_traits |
| ... | ... | @@ -32,6 +32,19 @@ typedef basic_string_view<char32_t> u32string_view; |
| 32 | 32 | typedef basic_string_view<wchar_t> wstring_view; |
| 33 | 33 | #endif |
| 34 | 34 | |
| 35 | // clang-format off | |
| 36 | template <class _CharT, class _Traits> | |
| 37 | class _LIBCPP_PREFERRED_NAME(string_view) | |
| 38 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 39 | _LIBCPP_PREFERRED_NAME(wstring_view) | |
| 40 | #endif | |
| 41 | #ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 42 | _LIBCPP_PREFERRED_NAME(u8string_view) | |
| 43 | #endif | |
| 44 | _LIBCPP_PREFERRED_NAME(u16string_view) | |
| 45 | _LIBCPP_PREFERRED_NAME(u32string_view) | |
| 46 | basic_string_view; | |
| 47 | // clang-format on | |
| 35 | 48 | _LIBCPP_END_NAMESPACE_STD |
| 36 | 49 | |
| 37 | #endif // _LIBCPP_FWD_STRING_VIEW_H | |
| 50 | #endif // _LIBCPP___FWD_STRING_VIEW_H |
lib/libcxx/include/__fwd/subrange.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 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_SUBRANGE_H | |
| 10 | #define _LIBCPP___FWD_SUBRANGE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | ||
| 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 15 | # pragma GCC system_header | |
| 16 | #endif | |
| 17 | ||
| 18 | #if _LIBCPP_STD_VER >= 20 | |
| 19 | ||
| 20 | #include <__iterator/concepts.h> | |
| 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 23 | ||
| 24 | namespace ranges { | |
| 25 | ||
| 26 | enum class _LIBCPP_ENUM_VIS subrange_kind : bool { unsized, sized }; | |
| 27 | ||
| 28 | template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent, subrange_kind _Kind> | |
| 29 | requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>) | |
| 30 | class _LIBCPP_TEMPLATE_VIS subrange; | |
| 31 | ||
| 32 | } // namespace ranges | |
| 33 | ||
| 34 | _LIBCPP_END_NAMESPACE_STD | |
| 35 | ||
| 36 | #endif // _LIBCPP_STD_VER >= 20 | |
| 37 | ||
| 38 | #endif // _LIBCPP___FWD_SUBRANGE_H |
lib/libcxx/include/__fwd/tuple.h created+29| ... | ... | @@ -0,0 +1,29 @@ |
| 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_TUPLE_H | |
| 10 | #define _LIBCPP___FWD_TUPLE_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 | #ifndef _LIBCPP_CXX03_LANG | |
| 21 | ||
| 22 | template <class...> | |
| 23 | class _LIBCPP_TEMPLATE_VIS tuple; | |
| 24 | ||
| 25 | #endif // _LIBCPP_CXX03_LANG | |
| 26 | ||
| 27 | _LIBCPP_END_NAMESPACE_STD | |
| 28 | ||
| 29 | #endif // _LIBCPP___FWD_TUPLE_H |
lib/libcxx/include/__hash_table+76-71| ... | ... | @@ -13,16 +13,25 @@ |
| 13 | 13 | #include <__algorithm/max.h> |
| 14 | 14 | #include <__algorithm/min.h> |
| 15 | 15 | #include <__assert> |
| 16 | #include <__bits> // __libcpp_clz | |
| 16 | #include <__bit/countl.h> | |
| 17 | 17 | #include <__config> |
| 18 | 18 | #include <__debug> |
| 19 | 19 | #include <__functional/hash.h> |
| 20 | 20 | #include <__iterator/iterator_traits.h> |
| 21 | #include <__memory/addressof.h> | |
| 22 | #include <__memory/allocator_traits.h> | |
| 23 | #include <__memory/compressed_pair.h> | |
| 24 | #include <__memory/pointer_traits.h> | |
| 21 | 25 | #include <__memory/swap_allocator.h> |
| 26 | #include <__memory/unique_ptr.h> | |
| 27 | #include <__type_traits/can_extract_key.h> | |
| 28 | #include <__utility/forward.h> | |
| 29 | #include <__utility/move.h> | |
| 30 | #include <__utility/pair.h> | |
| 22 | 31 | #include <__utility/swap.h> |
| 23 | 32 | #include <cmath> |
| 33 | #include <cstring> | |
| 24 | 34 | #include <initializer_list> |
| 25 | #include <memory> | |
| 26 | 35 | #include <type_traits> |
| 27 | 36 | |
| 28 | 37 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -48,7 +57,7 @@ template <class ..._Args> |
| 48 | 57 | struct __is_hash_value_type : false_type {}; |
| 49 | 58 | |
| 50 | 59 | template <class _One> |
| 51 | struct __is_hash_value_type<_One> : __is_hash_value_type_imp<__uncvref_t<_One> > {}; | |
| 60 | struct __is_hash_value_type<_One> : __is_hash_value_type_imp<__remove_cvref_t<_One> > {}; | |
| 52 | 61 | |
| 53 | 62 | _LIBCPP_FUNC_VIS |
| 54 | 63 | size_t __next_prime(size_t __n); |
| ... | ... | @@ -58,16 +67,13 @@ struct __hash_node_base |
| 58 | 67 | { |
| 59 | 68 | typedef typename pointer_traits<_NodePtr>::element_type __node_type; |
| 60 | 69 | typedef __hash_node_base __first_node; |
| 61 | typedef typename __rebind_pointer<_NodePtr, __first_node>::type __node_base_pointer; | |
| 70 | typedef __rebind_pointer_t<_NodePtr, __first_node> __node_base_pointer; | |
| 62 | 71 | typedef _NodePtr __node_pointer; |
| 63 | 72 | |
| 64 | 73 | #if defined(_LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB) |
| 65 | 74 | typedef __node_base_pointer __next_pointer; |
| 66 | 75 | #else |
| 67 | typedef typename conditional< | |
| 68 | is_pointer<__node_pointer>::value, | |
| 69 | __node_base_pointer, | |
| 70 | __node_pointer>::type __next_pointer; | |
| 76 | typedef __conditional_t<is_pointer<__node_pointer>::value, __node_base_pointer, __node_pointer> __next_pointer; | |
| 71 | 77 | #endif |
| 72 | 78 | |
| 73 | 79 | __next_pointer __next_; |
| ... | ... | @@ -96,7 +102,7 @@ template <class _Tp, class _VoidPtr> |
| 96 | 102 | struct _LIBCPP_STANDALONE_DEBUG __hash_node |
| 97 | 103 | : public __hash_node_base |
| 98 | 104 | < |
| 99 | typename __rebind_pointer<_VoidPtr, __hash_node<_Tp, _VoidPtr> >::type | |
| 105 | __rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> > | |
| 100 | 106 | > |
| 101 | 107 | { |
| 102 | 108 | typedef _Tp __node_value_type; |
| ... | ... | @@ -208,9 +214,9 @@ struct __hash_map_pointer_types {}; |
| 208 | 214 | template <class _Tp, class _AllocPtr, class _KVTypes> |
| 209 | 215 | struct __hash_map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> { |
| 210 | 216 | typedef typename _KVTypes::__map_value_type _Mv; |
| 211 | typedef typename __rebind_pointer<_AllocPtr, _Mv>::type | |
| 217 | typedef __rebind_pointer_t<_AllocPtr, _Mv> | |
| 212 | 218 | __map_value_type_pointer; |
| 213 | typedef typename __rebind_pointer<_AllocPtr, const _Mv>::type | |
| 219 | typedef __rebind_pointer_t<_AllocPtr, const _Mv> | |
| 214 | 220 | __const_map_value_type_pointer; |
| 215 | 221 | }; |
| 216 | 222 | |
| ... | ... | @@ -228,21 +234,21 @@ public: |
| 228 | 234 | typedef ptrdiff_t difference_type; |
| 229 | 235 | typedef size_t size_type; |
| 230 | 236 | |
| 231 | typedef typename __rebind_pointer<_NodePtr, void>::type __void_pointer; | |
| 237 | typedef __rebind_pointer_t<_NodePtr, void> __void_pointer; | |
| 232 | 238 | |
| 233 | 239 | typedef typename pointer_traits<_NodePtr>::element_type __node_type; |
| 234 | 240 | typedef _NodePtr __node_pointer; |
| 235 | 241 | |
| 236 | 242 | typedef __hash_node_base<__node_pointer> __node_base_type; |
| 237 | typedef typename __rebind_pointer<_NodePtr, __node_base_type>::type | |
| 243 | typedef __rebind_pointer_t<_NodePtr, __node_base_type> | |
| 238 | 244 | __node_base_pointer; |
| 239 | 245 | |
| 240 | 246 | typedef typename __node_base_type::__next_pointer __next_pointer; |
| 241 | 247 | |
| 242 | 248 | typedef _Tp __node_value_type; |
| 243 | typedef typename __rebind_pointer<_VoidPtr, __node_value_type>::type | |
| 249 | typedef __rebind_pointer_t<_VoidPtr, __node_value_type> | |
| 244 | 250 | __node_value_type_pointer; |
| 245 | typedef typename __rebind_pointer<_VoidPtr, const __node_value_type>::type | |
| 251 | typedef __rebind_pointer_t<_VoidPtr, const __node_value_type> | |
| 246 | 252 | __const_node_value_type_pointer; |
| 247 | 253 | |
| 248 | 254 | private: |
| ... | ... | @@ -250,7 +256,7 @@ private: |
| 250 | 256 | "_NodePtr should never be a pointer to const"); |
| 251 | 257 | static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value), |
| 252 | 258 | "_VoidPtr does not point to unqualified void type"); |
| 253 | static_assert((is_same<typename __rebind_pointer<_VoidPtr, __node_type>::type, | |
| 259 | static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>, | |
| 254 | 260 | _NodePtr>::value), "_VoidPtr does not rebind to _NodePtr."); |
| 255 | 261 | }; |
| 256 | 262 | |
| ... | ... | @@ -269,7 +275,7 @@ struct __hash_node_types_from_iterator<__hash_const_local_iterator<_NodePtr> > : |
| 269 | 275 | template <class _NodeValueTp, class _VoidPtr> |
| 270 | 276 | struct __make_hash_node_types { |
| 271 | 277 | typedef __hash_node<_NodeValueTp, _VoidPtr> _NodeTp; |
| 272 | typedef typename __rebind_pointer<_VoidPtr, _NodeTp>::type _NodePtr; | |
| 278 | typedef __rebind_pointer_t<_VoidPtr, _NodeTp> _NodePtr; | |
| 273 | 279 | typedef __hash_node_types<_NodePtr> type; |
| 274 | 280 | }; |
| 275 | 281 | |
| ... | ... | @@ -559,7 +565,7 @@ public: |
| 559 | 565 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), |
| 560 | 566 | "Attempted to increment a non-incrementable unordered container local_iterator"); |
| 561 | 567 | __node_ = __node_->__next_; |
| 562 | if (__node_ != nullptr && __constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_) | |
| 568 | if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_) | |
| 563 | 569 | __node_ = nullptr; |
| 564 | 570 | return *this; |
| 565 | 571 | } |
| ... | ... | @@ -614,8 +620,8 @@ class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator |
| 614 | 620 | |
| 615 | 621 | typedef pointer_traits<__node_pointer> __pointer_traits; |
| 616 | 622 | typedef typename __pointer_traits::element_type __node; |
| 617 | typedef typename remove_const<__node>::type __non_const_node; | |
| 618 | typedef typename __rebind_pointer<__node_pointer, __non_const_node>::type | |
| 623 | typedef __remove_const_t<__node> __non_const_node; | |
| 624 | typedef __rebind_pointer_t<__node_pointer, __non_const_node> | |
| 619 | 625 | __non_const_node_pointer; |
| 620 | 626 | public: |
| 621 | 627 | typedef __hash_local_iterator<__non_const_node_pointer> |
| ... | ... | @@ -692,7 +698,7 @@ public: |
| 692 | 698 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), |
| 693 | 699 | "Attempted to increment a non-incrementable unordered container const_local_iterator"); |
| 694 | 700 | __node_ = __node_->__next_; |
| 695 | if (__node_ != nullptr && __constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_) | |
| 701 | if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_) | |
| 696 | 702 | __node_ = nullptr; |
| 697 | 703 | return *this; |
| 698 | 704 | } |
| ... | ... | @@ -892,7 +898,7 @@ public: |
| 892 | 898 | // Create __node |
| 893 | 899 | |
| 894 | 900 | typedef typename _NodeTypes::__node_type __node; |
| 895 | typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; | |
| 901 | typedef __rebind_alloc<__alloc_traits, __node> __node_allocator; | |
| 896 | 902 | typedef allocator_traits<__node_allocator> __node_traits; |
| 897 | 903 | typedef typename _NodeTypes::__void_pointer __void_pointer; |
| 898 | 904 | typedef typename _NodeTypes::__node_pointer __node_pointer; |
| ... | ... | @@ -907,15 +913,14 @@ private: |
| 907 | 913 | // the pointer using 'pointer_traits'. |
| 908 | 914 | static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value), |
| 909 | 915 | "Allocator does not rebind pointers in a sane manner."); |
| 910 | typedef typename __rebind_alloc_helper<__node_traits, __first_node>::type | |
| 911 | __node_base_allocator; | |
| 916 | typedef __rebind_alloc<__node_traits, __first_node> __node_base_allocator; | |
| 912 | 917 | typedef allocator_traits<__node_base_allocator> __node_base_traits; |
| 913 | 918 | static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value), |
| 914 | 919 | "Allocator does not rebind pointers in a sane manner."); |
| 915 | 920 | |
| 916 | 921 | private: |
| 917 | 922 | |
| 918 | typedef typename __rebind_alloc_helper<__node_traits, __next_pointer>::type __pointer_allocator; | |
| 923 | typedef __rebind_alloc<__node_traits, __next_pointer> __pointer_allocator; | |
| 919 | 924 | typedef __bucket_list_deallocator<__pointer_allocator> __bucket_list_deleter; |
| 920 | 925 | typedef unique_ptr<__next_pointer[], __bucket_list_deleter> __bucket_list; |
| 921 | 926 | typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits; |
| ... | ... | @@ -1151,11 +1156,11 @@ public: |
| 1151 | 1156 | _LIBCPP_INLINE_VISIBILITY void __rehash_multi(size_type __n) { __rehash<false>(__n); } |
| 1152 | 1157 | _LIBCPP_INLINE_VISIBILITY void __reserve_unique(size_type __n) |
| 1153 | 1158 | { |
| 1154 | __rehash_unique(static_cast<size_type>(ceil(__n / max_load_factor()))); | |
| 1159 | __rehash_unique(static_cast<size_type>(std::ceil(__n / max_load_factor()))); | |
| 1155 | 1160 | } |
| 1156 | 1161 | _LIBCPP_INLINE_VISIBILITY void __reserve_multi(size_type __n) |
| 1157 | 1162 | { |
| 1158 | __rehash_multi(static_cast<size_type>(ceil(__n / max_load_factor()))); | |
| 1163 | __rehash_multi(static_cast<size_type>(std::ceil(__n / max_load_factor()))); | |
| 1159 | 1164 | } |
| 1160 | 1165 | |
| 1161 | 1166 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1179,7 +1184,7 @@ public: |
| 1179 | 1184 | { |
| 1180 | 1185 | _LIBCPP_ASSERT(bucket_count() > 0, |
| 1181 | 1186 | "unordered container::bucket(key) called when bucket_count() == 0"); |
| 1182 | return __constrain_hash(hash_function()(__k), bucket_count()); | |
| 1187 | return std::__constrain_hash(hash_function()(__k), bucket_count()); | |
| 1183 | 1188 | } |
| 1184 | 1189 | |
| 1185 | 1190 | template <class _Key> |
| ... | ... | @@ -1428,7 +1433,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u) |
| 1428 | 1433 | { |
| 1429 | 1434 | if (size() > 0) |
| 1430 | 1435 | { |
| 1431 | __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = | |
| 1436 | __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = | |
| 1432 | 1437 | __p1_.first().__ptr(); |
| 1433 | 1438 | __u.__p1_.first().__next_ = nullptr; |
| 1434 | 1439 | __u.size() = 0; |
| ... | ... | @@ -1452,7 +1457,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, |
| 1452 | 1457 | { |
| 1453 | 1458 | __p1_.first().__next_ = __u.__p1_.first().__next_; |
| 1454 | 1459 | __u.__p1_.first().__next_ = nullptr; |
| 1455 | __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = | |
| 1460 | __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = | |
| 1456 | 1461 | __p1_.first().__ptr(); |
| 1457 | 1462 | size() = __u.size(); |
| 1458 | 1463 | __u.size() = 0; |
| ... | ... | @@ -1569,7 +1574,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign( |
| 1569 | 1574 | __p1_.first().__next_ = __u.__p1_.first().__next_; |
| 1570 | 1575 | if (size() > 0) |
| 1571 | 1576 | { |
| 1572 | __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = | |
| 1577 | __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = | |
| 1573 | 1578 | __p1_.first().__ptr(); |
| 1574 | 1579 | __u.__p1_.first().__next_ = nullptr; |
| 1575 | 1580 | __u.size() = 0; |
| ... | ... | @@ -1784,12 +1789,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare( |
| 1784 | 1789 | |
| 1785 | 1790 | if (__bc != 0) |
| 1786 | 1791 | { |
| 1787 | size_t __chash = __constrain_hash(__hash, __bc); | |
| 1792 | size_t __chash = std::__constrain_hash(__hash, __bc); | |
| 1788 | 1793 | __next_pointer __ndptr = __bucket_list_[__chash]; |
| 1789 | 1794 | if (__ndptr != nullptr) |
| 1790 | 1795 | { |
| 1791 | 1796 | for (__ndptr = __ndptr->__next_; __ndptr != nullptr && |
| 1792 | __constrain_hash(__ndptr->__hash(), __bc) == __chash; | |
| 1797 | std::__constrain_hash(__ndptr->__hash(), __bc) == __chash; | |
| 1793 | 1798 | __ndptr = __ndptr->__next_) |
| 1794 | 1799 | { |
| 1795 | 1800 | if (key_eq()(__ndptr->__upcast()->__value_, __value)) |
| ... | ... | @@ -1799,8 +1804,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare( |
| 1799 | 1804 | } |
| 1800 | 1805 | if (size()+1 > __bc * max_load_factor() || __bc == 0) |
| 1801 | 1806 | { |
| 1802 | __rehash_unique(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc), | |
| 1803 | size_type(ceil(float(size() + 1) / max_load_factor())))); | |
| 1807 | __rehash_unique(_VSTD::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc), | |
| 1808 | size_type(std::ceil(float(size() + 1) / max_load_factor())))); | |
| 1804 | 1809 | } |
| 1805 | 1810 | return nullptr; |
| 1806 | 1811 | } |
| ... | ... | @@ -1816,7 +1821,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_perform( |
| 1816 | 1821 | __node_pointer __nd) _NOEXCEPT |
| 1817 | 1822 | { |
| 1818 | 1823 | size_type __bc = bucket_count(); |
| 1819 | size_t __chash = __constrain_hash(__nd->__hash(), __bc); | |
| 1824 | size_t __chash = std::__constrain_hash(__nd->__hash(), __bc); | |
| 1820 | 1825 | // insert_after __bucket_list_[__chash], or __first_node if bucket is null |
| 1821 | 1826 | __next_pointer __pn = __bucket_list_[__chash]; |
| 1822 | 1827 | if (__pn == nullptr) |
| ... | ... | @@ -1827,7 +1832,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_perform( |
| 1827 | 1832 | // fix up __bucket_list_ |
| 1828 | 1833 | __bucket_list_[__chash] = __pn; |
| 1829 | 1834 | if (__nd->__next_ != nullptr) |
| 1830 | __bucket_list_[__constrain_hash(__nd->__next_->__hash(), __bc)] = __nd->__ptr(); | |
| 1835 | __bucket_list_[std::__constrain_hash(__nd->__next_->__hash(), __bc)] = __nd->__ptr(); | |
| 1831 | 1836 | } |
| 1832 | 1837 | else |
| 1833 | 1838 | { |
| ... | ... | @@ -1871,16 +1876,16 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare( |
| 1871 | 1876 | size_type __bc = bucket_count(); |
| 1872 | 1877 | if (size()+1 > __bc * max_load_factor() || __bc == 0) |
| 1873 | 1878 | { |
| 1874 | __rehash_multi(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc), | |
| 1875 | size_type(ceil(float(size() + 1) / max_load_factor())))); | |
| 1879 | __rehash_multi(_VSTD::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc), | |
| 1880 | size_type(std::ceil(float(size() + 1) / max_load_factor())))); | |
| 1876 | 1881 | __bc = bucket_count(); |
| 1877 | 1882 | } |
| 1878 | size_t __chash = __constrain_hash(__cp_hash, __bc); | |
| 1883 | size_t __chash = std::__constrain_hash(__cp_hash, __bc); | |
| 1879 | 1884 | __next_pointer __pn = __bucket_list_[__chash]; |
| 1880 | 1885 | if (__pn != nullptr) |
| 1881 | 1886 | { |
| 1882 | 1887 | for (bool __found = false; __pn->__next_ != nullptr && |
| 1883 | __constrain_hash(__pn->__next_->__hash(), __bc) == __chash; | |
| 1888 | std::__constrain_hash(__pn->__next_->__hash(), __bc) == __chash; | |
| 1884 | 1889 | __pn = __pn->__next_) |
| 1885 | 1890 | { |
| 1886 | 1891 | // __found key_eq() action |
| ... | ... | @@ -1912,7 +1917,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform( |
| 1912 | 1917 | __node_pointer __cp, __next_pointer __pn) _NOEXCEPT |
| 1913 | 1918 | { |
| 1914 | 1919 | size_type __bc = bucket_count(); |
| 1915 | size_t __chash = __constrain_hash(__cp->__hash_, __bc); | |
| 1920 | size_t __chash = std::__constrain_hash(__cp->__hash_, __bc); | |
| 1916 | 1921 | if (__pn == nullptr) |
| 1917 | 1922 | { |
| 1918 | 1923 | __pn =__p1_.first().__ptr(); |
| ... | ... | @@ -1921,7 +1926,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform( |
| 1921 | 1926 | // fix up __bucket_list_ |
| 1922 | 1927 | __bucket_list_[__chash] = __pn; |
| 1923 | 1928 | if (__cp->__next_ != nullptr) |
| 1924 | __bucket_list_[__constrain_hash(__cp->__next_->__hash(), __bc)] | |
| 1929 | __bucket_list_[std::__constrain_hash(__cp->__next_->__hash(), __bc)] | |
| 1925 | 1930 | = __cp->__ptr(); |
| 1926 | 1931 | } |
| 1927 | 1932 | else |
| ... | ... | @@ -1930,7 +1935,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform( |
| 1930 | 1935 | __pn->__next_ = __cp->__ptr(); |
| 1931 | 1936 | if (__cp->__next_ != nullptr) |
| 1932 | 1937 | { |
| 1933 | size_t __nhash = __constrain_hash(__cp->__next_->__hash(), __bc); | |
| 1938 | size_t __nhash = std::__constrain_hash(__cp->__next_->__hash(), __bc); | |
| 1934 | 1939 | if (__nhash != __chash) |
| 1935 | 1940 | __bucket_list_[__nhash] = __cp->__ptr(); |
| 1936 | 1941 | } |
| ... | ... | @@ -1965,11 +1970,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi( |
| 1965 | 1970 | size_type __bc = bucket_count(); |
| 1966 | 1971 | if (size()+1 > __bc * max_load_factor() || __bc == 0) |
| 1967 | 1972 | { |
| 1968 | __rehash_multi(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc), | |
| 1969 | size_type(ceil(float(size() + 1) / max_load_factor())))); | |
| 1973 | __rehash_multi(_VSTD::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc), | |
| 1974 | size_type(std::ceil(float(size() + 1) / max_load_factor())))); | |
| 1970 | 1975 | __bc = bucket_count(); |
| 1971 | 1976 | } |
| 1972 | size_t __chash = __constrain_hash(__cp->__hash_, __bc); | |
| 1977 | size_t __chash = std::__constrain_hash(__cp->__hash_, __bc); | |
| 1973 | 1978 | __next_pointer __pp = __bucket_list_[__chash]; |
| 1974 | 1979 | while (__pp->__next_ != __np) |
| 1975 | 1980 | __pp = __pp->__next_; |
| ... | ... | @@ -1996,12 +2001,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& |
| 1996 | 2001 | size_t __chash; |
| 1997 | 2002 | if (__bc != 0) |
| 1998 | 2003 | { |
| 1999 | __chash = __constrain_hash(__hash, __bc); | |
| 2004 | __chash = std::__constrain_hash(__hash, __bc); | |
| 2000 | 2005 | __nd = __bucket_list_[__chash]; |
| 2001 | 2006 | if (__nd != nullptr) |
| 2002 | 2007 | { |
| 2003 | 2008 | for (__nd = __nd->__next_; __nd != nullptr && |
| 2004 | (__nd->__hash() == __hash || __constrain_hash(__nd->__hash(), __bc) == __chash); | |
| 2009 | (__nd->__hash() == __hash || std::__constrain_hash(__nd->__hash(), __bc) == __chash); | |
| 2005 | 2010 | __nd = __nd->__next_) |
| 2006 | 2011 | { |
| 2007 | 2012 | if (key_eq()(__nd->__upcast()->__value_, __k)) |
| ... | ... | @@ -2013,10 +2018,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& |
| 2013 | 2018 | __node_holder __h = __construct_node_hash(__hash, _VSTD::forward<_Args>(__args)...); |
| 2014 | 2019 | if (size()+1 > __bc * max_load_factor() || __bc == 0) |
| 2015 | 2020 | { |
| 2016 | __rehash_unique(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc), | |
| 2017 | size_type(ceil(float(size() + 1) / max_load_factor())))); | |
| 2021 | __rehash_unique(_VSTD::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc), | |
| 2022 | size_type(std::ceil(float(size() + 1) / max_load_factor())))); | |
| 2018 | 2023 | __bc = bucket_count(); |
| 2019 | __chash = __constrain_hash(__hash, __bc); | |
| 2024 | __chash = std::__constrain_hash(__hash, __bc); | |
| 2020 | 2025 | } |
| 2021 | 2026 | // insert_after __bucket_list_[__chash], or __first_node if bucket is null |
| 2022 | 2027 | __next_pointer __pn = __bucket_list_[__chash]; |
| ... | ... | @@ -2028,7 +2033,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& |
| 2028 | 2033 | // fix up __bucket_list_ |
| 2029 | 2034 | __bucket_list_[__chash] = __pn; |
| 2030 | 2035 | if (__h->__next_ != nullptr) |
| 2031 | __bucket_list_[__constrain_hash(__h->__next_->__hash(), __bc)] | |
| 2036 | __bucket_list_[std::__constrain_hash(__h->__next_->__hash(), __bc)] | |
| 2032 | 2037 | = __h.get()->__ptr(); |
| 2033 | 2038 | } |
| 2034 | 2039 | else |
| ... | ... | @@ -2224,7 +2229,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 2224 | 2229 | if (__n == 1) |
| 2225 | 2230 | __n = 2; |
| 2226 | 2231 | else if (__n & (__n - 1)) |
| 2227 | __n = __next_prime(__n); | |
| 2232 | __n = std::__next_prime(__n); | |
| 2228 | 2233 | size_type __bc = bucket_count(); |
| 2229 | 2234 | if (__n > __bc) |
| 2230 | 2235 | __do_rehash<_UniqueKeys>(__n); |
| ... | ... | @@ -2233,8 +2238,8 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 2233 | 2238 | __n = _VSTD::max<size_type> |
| 2234 | 2239 | ( |
| 2235 | 2240 | __n, |
| 2236 | __is_hash_power2(__bc) ? __next_hash_pow2(size_t(ceil(float(size()) / max_load_factor()))) : | |
| 2237 | __next_prime(size_t(ceil(float(size()) / max_load_factor()))) | |
| 2241 | std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(std::ceil(float(size()) / max_load_factor()))) : | |
| 2242 | std::__next_prime(size_t(std::ceil(float(size()) / max_load_factor()))) | |
| 2238 | 2243 | ); |
| 2239 | 2244 | if (__n < __bc) |
| 2240 | 2245 | __do_rehash<_UniqueKeys>(__n); |
| ... | ... | @@ -2259,13 +2264,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __nbc) |
| 2259 | 2264 | __next_pointer __cp = __pp->__next_; |
| 2260 | 2265 | if (__cp != nullptr) |
| 2261 | 2266 | { |
| 2262 | size_type __chash = __constrain_hash(__cp->__hash(), __nbc); | |
| 2267 | size_type __chash = std::__constrain_hash(__cp->__hash(), __nbc); | |
| 2263 | 2268 | __bucket_list_[__chash] = __pp; |
| 2264 | 2269 | size_type __phash = __chash; |
| 2265 | 2270 | for (__pp = __cp, void(), __cp = __cp->__next_; __cp != nullptr; |
| 2266 | 2271 | __cp = __pp->__next_) |
| 2267 | 2272 | { |
| 2268 | __chash = __constrain_hash(__cp->__hash(), __nbc); | |
| 2273 | __chash = std::__constrain_hash(__cp->__hash(), __nbc); | |
| 2269 | 2274 | if (__chash == __phash) |
| 2270 | 2275 | __pp = __cp; |
| 2271 | 2276 | else |
| ... | ... | @@ -2279,7 +2284,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __nbc) |
| 2279 | 2284 | else |
| 2280 | 2285 | { |
| 2281 | 2286 | __next_pointer __np = __cp; |
| 2282 | if _LIBCPP_CONSTEXPR_AFTER_CXX14 (!_UniqueKeys) | |
| 2287 | if _LIBCPP_CONSTEXPR_SINCE_CXX17 (!_UniqueKeys) | |
| 2283 | 2288 | { |
| 2284 | 2289 | for (; __np->__next_ != nullptr && |
| 2285 | 2290 | key_eq()(__cp->__upcast()->__value_, |
| ... | ... | @@ -2307,13 +2312,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) |
| 2307 | 2312 | size_type __bc = bucket_count(); |
| 2308 | 2313 | if (__bc != 0) |
| 2309 | 2314 | { |
| 2310 | size_t __chash = __constrain_hash(__hash, __bc); | |
| 2315 | size_t __chash = std::__constrain_hash(__hash, __bc); | |
| 2311 | 2316 | __next_pointer __nd = __bucket_list_[__chash]; |
| 2312 | 2317 | if (__nd != nullptr) |
| 2313 | 2318 | { |
| 2314 | 2319 | for (__nd = __nd->__next_; __nd != nullptr && |
| 2315 | 2320 | (__nd->__hash() == __hash |
| 2316 | || __constrain_hash(__nd->__hash(), __bc) == __chash); | |
| 2321 | || std::__constrain_hash(__nd->__hash(), __bc) == __chash); | |
| 2317 | 2322 | __nd = __nd->__next_) |
| 2318 | 2323 | { |
| 2319 | 2324 | if ((__nd->__hash() == __hash) |
| ... | ... | @@ -2334,13 +2339,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const |
| 2334 | 2339 | size_type __bc = bucket_count(); |
| 2335 | 2340 | if (__bc != 0) |
| 2336 | 2341 | { |
| 2337 | size_t __chash = __constrain_hash(__hash, __bc); | |
| 2342 | size_t __chash = std::__constrain_hash(__hash, __bc); | |
| 2338 | 2343 | __next_pointer __nd = __bucket_list_[__chash]; |
| 2339 | 2344 | if (__nd != nullptr) |
| 2340 | 2345 | { |
| 2341 | 2346 | for (__nd = __nd->__next_; __nd != nullptr && |
| 2342 | 2347 | (__hash == __nd->__hash() |
| 2343 | || __constrain_hash(__nd->__hash(), __bc) == __chash); | |
| 2348 | || std::__constrain_hash(__nd->__hash(), __bc) == __chash); | |
| 2344 | 2349 | __nd = __nd->__next_) |
| 2345 | 2350 | { |
| 2346 | 2351 | if ((__nd->__hash() == __hash) |
| ... | ... | @@ -2462,7 +2467,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT |
| 2462 | 2467 | // current node |
| 2463 | 2468 | __next_pointer __cn = __p.__node_; |
| 2464 | 2469 | size_type __bc = bucket_count(); |
| 2465 | size_t __chash = __constrain_hash(__cn->__hash(), __bc); | |
| 2470 | size_t __chash = std::__constrain_hash(__cn->__hash(), __bc); | |
| 2466 | 2471 | // find previous node |
| 2467 | 2472 | __next_pointer __pn = __bucket_list_[__chash]; |
| 2468 | 2473 | for (; __pn->__next_ != __cn; __pn = __pn->__next_) |
| ... | ... | @@ -2471,16 +2476,16 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT |
| 2471 | 2476 | // if __pn is not in same bucket (before begin is not in same bucket) && |
| 2472 | 2477 | // if __cn->__next_ is not in same bucket (nullptr is not in same bucket) |
| 2473 | 2478 | if (__pn == __p1_.first().__ptr() |
| 2474 | || __constrain_hash(__pn->__hash(), __bc) != __chash) | |
| 2479 | || std::__constrain_hash(__pn->__hash(), __bc) != __chash) | |
| 2475 | 2480 | { |
| 2476 | 2481 | if (__cn->__next_ == nullptr |
| 2477 | || __constrain_hash(__cn->__next_->__hash(), __bc) != __chash) | |
| 2482 | || std::__constrain_hash(__cn->__next_->__hash(), __bc) != __chash) | |
| 2478 | 2483 | __bucket_list_[__chash] = nullptr; |
| 2479 | 2484 | } |
| 2480 | 2485 | // if __cn->__next_ is not in same bucket (nullptr is in same bucket) |
| 2481 | 2486 | if (__cn->__next_ != nullptr) |
| 2482 | 2487 | { |
| 2483 | size_t __nhash = __constrain_hash(__cn->__next_->__hash(), __bc); | |
| 2488 | size_t __nhash = std::__constrain_hash(__cn->__next_->__hash(), __bc); | |
| 2484 | 2489 | if (__nhash != __chash) |
| 2485 | 2490 | __bucket_list_[__nhash] = __pn; |
| 2486 | 2491 | } |
| ... | ... | @@ -2634,10 +2639,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u) |
| 2634 | 2639 | __p2_.swap(__u.__p2_); |
| 2635 | 2640 | __p3_.swap(__u.__p3_); |
| 2636 | 2641 | if (size() > 0) |
| 2637 | __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = | |
| 2642 | __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = | |
| 2638 | 2643 | __p1_.first().__ptr(); |
| 2639 | 2644 | if (__u.size() > 0) |
| 2640 | __u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] = | |
| 2645 | __u.__bucket_list_[std::__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] = | |
| 2641 | 2646 | __u.__p1_.first().__ptr(); |
| 2642 | 2647 | std::__debug_db_swap(this, std::addressof(__u)); |
| 2643 | 2648 | } |
| ... | ... | @@ -2654,8 +2659,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const |
| 2654 | 2659 | if (__np != nullptr) |
| 2655 | 2660 | { |
| 2656 | 2661 | for (__np = __np->__next_; __np != nullptr && |
| 2657 | __constrain_hash(__np->__hash(), __bc) == __n; | |
| 2658 | __np = __np->__next_, (void) ++__r) | |
| 2662 | std::__constrain_hash(__np->__hash(), __bc) == __n; | |
| 2663 | __np = __np->__next_, (void) ++__r) | |
| 2659 | 2664 | ; |
| 2660 | 2665 | } |
| 2661 | 2666 | return __r; |
lib/libcxx/include/__iterator/access.h+8-8| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | 22 | template <class _Tp, size_t _Np> |
| 23 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 23 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 24 | 24 | _Tp* |
| 25 | 25 | begin(_Tp (&__array)[_Np]) |
| 26 | 26 | { |
| ... | ... | @@ -28,7 +28,7 @@ begin(_Tp (&__array)[_Np]) |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | template <class _Tp, size_t _Np> |
| 31 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 31 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 32 | 32 | _Tp* |
| 33 | 33 | end(_Tp (&__array)[_Np]) |
| 34 | 34 | { |
| ... | ... | @@ -38,7 +38,7 @@ end(_Tp (&__array)[_Np]) |
| 38 | 38 | #if !defined(_LIBCPP_CXX03_LANG) |
| 39 | 39 | |
| 40 | 40 | template <class _Cp> |
| 41 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 41 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 42 | 42 | auto |
| 43 | 43 | begin(_Cp& __c) -> decltype(__c.begin()) |
| 44 | 44 | { |
| ... | ... | @@ -46,7 +46,7 @@ begin(_Cp& __c) -> decltype(__c.begin()) |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | template <class _Cp> |
| 49 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 49 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 50 | 50 | auto |
| 51 | 51 | begin(const _Cp& __c) -> decltype(__c.begin()) |
| 52 | 52 | { |
| ... | ... | @@ -54,7 +54,7 @@ begin(const _Cp& __c) -> decltype(__c.begin()) |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | template <class _Cp> |
| 57 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 57 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 58 | 58 | auto |
| 59 | 59 | end(_Cp& __c) -> decltype(__c.end()) |
| 60 | 60 | { |
| ... | ... | @@ -62,7 +62,7 @@ end(_Cp& __c) -> decltype(__c.end()) |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | template <class _Cp> |
| 65 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 65 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 66 | 66 | auto |
| 67 | 67 | end(const _Cp& __c) -> decltype(__c.end()) |
| 68 | 68 | { |
| ... | ... | @@ -72,14 +72,14 @@ end(const _Cp& __c) -> decltype(__c.end()) |
| 72 | 72 | #if _LIBCPP_STD_VER > 11 |
| 73 | 73 | |
| 74 | 74 | template <class _Cp> |
| 75 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 75 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 76 | 76 | auto cbegin(const _Cp& __c) -> decltype(_VSTD::begin(__c)) |
| 77 | 77 | { |
| 78 | 78 | return _VSTD::begin(__c); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | template <class _Cp> |
| 82 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 82 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 83 | 83 | auto cend(const _Cp& __c) -> decltype(_VSTD::end(__c)) |
| 84 | 84 | { |
| 85 | 85 | return _VSTD::end(__c); |
lib/libcxx/include/__iterator/advance.h+13-9| ... | ... | @@ -11,16 +11,20 @@ |
| 11 | 11 | #define _LIBCPP___ITERATOR_ADVANCE_H |
| 12 | 12 | |
| 13 | 13 | #include <__assert> |
| 14 | #include <__concepts/assignable.h> | |
| 15 | #include <__concepts/same_as.h> | |
| 14 | 16 | #include <__config> |
| 15 | 17 | #include <__iterator/concepts.h> |
| 16 | 18 | #include <__iterator/incrementable_traits.h> |
| 17 | 19 | #include <__iterator/iterator_traits.h> |
| 20 | #include <__type_traits/enable_if.h> | |
| 21 | #include <__type_traits/is_integral.h> | |
| 22 | #include <__utility/convert_to_integral.h> | |
| 23 | #include <__utility/declval.h> | |
| 18 | 24 | #include <__utility/move.h> |
| 19 | 25 | #include <__utility/unreachable.h> |
| 20 | #include <concepts> | |
| 21 | 26 | #include <cstdlib> |
| 22 | 27 | #include <limits> |
| 23 | #include <type_traits> | |
| 24 | 28 | |
| 25 | 29 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 26 | 30 | # pragma GCC system_header |
| ... | ... | @@ -29,14 +33,14 @@ |
| 29 | 33 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 34 | |
| 31 | 35 | template <class _InputIter> |
| 32 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 36 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 33 | 37 | void __advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag) { |
| 34 | 38 | for (; __n > 0; --__n) |
| 35 | 39 | ++__i; |
| 36 | 40 | } |
| 37 | 41 | |
| 38 | 42 | template <class _BiDirIter> |
| 39 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 43 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 40 | 44 | void __advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag) { |
| 41 | 45 | if (__n >= 0) |
| 42 | 46 | for (; __n > 0; --__n) |
| ... | ... | @@ -47,16 +51,16 @@ void __advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference |
| 47 | 51 | } |
| 48 | 52 | |
| 49 | 53 | template <class _RandIter> |
| 50 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 54 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 51 | 55 | void __advance(_RandIter& __i, typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag) { |
| 52 | 56 | __i += __n; |
| 53 | 57 | } |
| 54 | 58 | |
| 55 | 59 | template < |
| 56 | 60 | class _InputIter, class _Distance, |
| 57 | class _IntegralDistance = decltype(_VSTD::__convert_to_integral(declval<_Distance>())), | |
| 61 | class _IntegralDistance = decltype(_VSTD::__convert_to_integral(std::declval<_Distance>())), | |
| 58 | 62 | class = __enable_if_t<is_integral<_IntegralDistance>::value> > |
| 59 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 63 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 60 | 64 | void advance(_InputIter& __i, _Distance __orig_n) { |
| 61 | 65 | typedef typename iterator_traits<_InputIter>::difference_type _Difference; |
| 62 | 66 | _Difference __n = static_cast<_Difference>(_VSTD::__convert_to_integral(__orig_n)); |
| ... | ... | @@ -65,7 +69,7 @@ void advance(_InputIter& __i, _Distance __orig_n) { |
| 65 | 69 | _VSTD::__advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category()); |
| 66 | 70 | } |
| 67 | 71 | |
| 68 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 72 | #if _LIBCPP_STD_VER > 17 | |
| 69 | 73 | |
| 70 | 74 | // [range.iter.op.advance] |
| 71 | 75 | |
| ... | ... | @@ -192,7 +196,7 @@ inline namespace __cpo { |
| 192 | 196 | } // namespace __cpo |
| 193 | 197 | } // namespace ranges |
| 194 | 198 | |
| 195 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 199 | #endif // _LIBCPP_STD_VER > 17 | |
| 196 | 200 | |
| 197 | 201 | _LIBCPP_END_NAMESPACE_STD |
| 198 | 202 |
lib/libcxx/include/__iterator/back_insert_iterator.h+9-8| ... | ... | @@ -45,22 +45,23 @@ public: |
| 45 | 45 | typedef void reference; |
| 46 | 46 | typedef _Container container_type; |
| 47 | 47 | |
| 48 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} | |
| 49 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator& operator=(const typename _Container::value_type& __value) | |
| 48 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} | |
| 49 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator=(const typename _Container::value_type& __value) | |
| 50 | 50 | {container->push_back(__value); return *this;} |
| 51 | 51 | #ifndef _LIBCPP_CXX03_LANG |
| 52 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator& operator=(typename _Container::value_type&& __value) | |
| 52 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator=(typename _Container::value_type&& __value) | |
| 53 | 53 | {container->push_back(_VSTD::move(__value)); return *this;} |
| 54 | 54 | #endif // _LIBCPP_CXX03_LANG |
| 55 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator& operator*() {return *this;} | |
| 56 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator& operator++() {return *this;} | |
| 57 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator operator++(int) {return *this;} | |
| 55 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator*() {return *this;} | |
| 56 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator++() {return *this;} | |
| 57 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator operator++(int) {return *this;} | |
| 58 | 58 | |
| 59 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _Container* __get_container() const { return container; } | |
| 59 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Container* __get_container() const { return container; } | |
| 60 | 60 | }; |
| 61 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(back_insert_iterator); | |
| 61 | 62 | |
| 62 | 63 | template <class _Container> |
| 63 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 64 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 64 | 65 | back_insert_iterator<_Container> |
| 65 | 66 | back_inserter(_Container& __x) |
| 66 | 67 | { |
lib/libcxx/include/__iterator/bounded_iter.h+17-15| ... | ... | @@ -14,8 +14,10 @@ |
| 14 | 14 | #include <__config> |
| 15 | 15 | #include <__iterator/iterator_traits.h> |
| 16 | 16 | #include <__memory/pointer_traits.h> |
| 17 | #include <__type_traits/enable_if.h> | |
| 18 | #include <__type_traits/integral_constant.h> | |
| 19 | #include <__type_traits/is_convertible.h> | |
| 17 | 20 | #include <__utility/move.h> |
| 18 | #include <type_traits> | |
| 19 | 21 | |
| 20 | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 21 | 23 | # pragma GCC system_header |
| ... | ... | @@ -73,7 +75,7 @@ private: |
| 73 | 75 | // |
| 74 | 76 | // Since it is non-standard for iterators to have this constructor, __bounded_iter must |
| 75 | 77 | // be created via `std::__make_bounded_iter`. |
| 76 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __bounded_iter( | |
| 78 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __bounded_iter( | |
| 77 | 79 | _Iterator __current, _Iterator __begin, _Iterator __end) |
| 78 | 80 | : __current_(__current), __begin_(__begin), __end_(__end) { |
| 79 | 81 | _LIBCPP_ASSERT(__begin <= __end, "__bounded_iter(current, begin, end): [begin, end) is not a valid range"); |
| ... | ... | @@ -86,19 +88,19 @@ public: |
| 86 | 88 | // Dereference and indexing operations. |
| 87 | 89 | // |
| 88 | 90 | // These operations check that the iterator is dereferenceable, that is within [begin, end). |
| 89 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 reference operator*() const _NOEXCEPT { | |
| 91 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { | |
| 90 | 92 | _LIBCPP_ASSERT( |
| 91 | 93 | __in_bounds(__current_), "__bounded_iter::operator*: Attempt to dereference an out-of-range iterator"); |
| 92 | 94 | return *__current_; |
| 93 | 95 | } |
| 94 | 96 | |
| 95 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 pointer operator->() const _NOEXCEPT { | |
| 97 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pointer operator->() const _NOEXCEPT { | |
| 96 | 98 | _LIBCPP_ASSERT( |
| 97 | 99 | __in_bounds(__current_), "__bounded_iter::operator->: Attempt to dereference an out-of-range iterator"); |
| 98 | 100 | return std::__to_address(__current_); |
| 99 | 101 | } |
| 100 | 102 | |
| 101 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 reference operator[](difference_type __n) const _NOEXCEPT { | |
| 103 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT { | |
| 102 | 104 | _LIBCPP_ASSERT( |
| 103 | 105 | __in_bounds(__current_ + __n), "__bounded_iter::operator[]: Attempt to index an iterator out-of-range"); |
| 104 | 106 | return __current_[__n]; |
| ... | ... | @@ -108,54 +110,54 @@ public: |
| 108 | 110 | // |
| 109 | 111 | // These operations do not check that the resulting iterator is within the bounds, since that |
| 110 | 112 | // would make it impossible to create a past-the-end iterator. |
| 111 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __bounded_iter& operator++() _NOEXCEPT { | |
| 113 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __bounded_iter& operator++() _NOEXCEPT { | |
| 112 | 114 | ++__current_; |
| 113 | 115 | return *this; |
| 114 | 116 | } |
| 115 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __bounded_iter operator++(int) _NOEXCEPT { | |
| 117 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __bounded_iter operator++(int) _NOEXCEPT { | |
| 116 | 118 | __bounded_iter __tmp(*this); |
| 117 | 119 | ++*this; |
| 118 | 120 | return __tmp; |
| 119 | 121 | } |
| 120 | 122 | |
| 121 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __bounded_iter& operator--() _NOEXCEPT { | |
| 123 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __bounded_iter& operator--() _NOEXCEPT { | |
| 122 | 124 | --__current_; |
| 123 | 125 | return *this; |
| 124 | 126 | } |
| 125 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __bounded_iter operator--(int) _NOEXCEPT { | |
| 127 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __bounded_iter operator--(int) _NOEXCEPT { | |
| 126 | 128 | __bounded_iter __tmp(*this); |
| 127 | 129 | --*this; |
| 128 | 130 | return __tmp; |
| 129 | 131 | } |
| 130 | 132 | |
| 131 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __bounded_iter& operator+=(difference_type __n) _NOEXCEPT { | |
| 133 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __bounded_iter& operator+=(difference_type __n) _NOEXCEPT { | |
| 132 | 134 | __current_ += __n; |
| 133 | 135 | return *this; |
| 134 | 136 | } |
| 135 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 friend __bounded_iter | |
| 137 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter | |
| 136 | 138 | operator+(__bounded_iter const& __self, difference_type __n) _NOEXCEPT { |
| 137 | 139 | __bounded_iter __tmp(__self); |
| 138 | 140 | __tmp += __n; |
| 139 | 141 | return __tmp; |
| 140 | 142 | } |
| 141 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 friend __bounded_iter | |
| 143 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter | |
| 142 | 144 | operator+(difference_type __n, __bounded_iter const& __self) _NOEXCEPT { |
| 143 | 145 | __bounded_iter __tmp(__self); |
| 144 | 146 | __tmp += __n; |
| 145 | 147 | return __tmp; |
| 146 | 148 | } |
| 147 | 149 | |
| 148 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __bounded_iter& operator-=(difference_type __n) _NOEXCEPT { | |
| 150 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __bounded_iter& operator-=(difference_type __n) _NOEXCEPT { | |
| 149 | 151 | __current_ -= __n; |
| 150 | 152 | return *this; |
| 151 | 153 | } |
| 152 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 friend __bounded_iter | |
| 154 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter | |
| 153 | 155 | operator-(__bounded_iter const& __self, difference_type __n) _NOEXCEPT { |
| 154 | 156 | __bounded_iter __tmp(__self); |
| 155 | 157 | __tmp -= __n; |
| 156 | 158 | return __tmp; |
| 157 | 159 | } |
| 158 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 friend difference_type | |
| 160 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend difference_type | |
| 159 | 161 | operator-(__bounded_iter const& __x, __bounded_iter const& __y) _NOEXCEPT { |
| 160 | 162 | return __x.__current_ - __y.__current_; |
| 161 | 163 | } |
lib/libcxx/include/__iterator/common_iterator.h+25-14| ... | ... | @@ -11,6 +11,13 @@ |
| 11 | 11 | #define _LIBCPP___ITERATOR_COMMON_ITERATOR_H |
| 12 | 12 | |
| 13 | 13 | #include <__assert> |
| 14 | #include <__concepts/assignable.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/same_as.h> | |
| 14 | 21 | #include <__config> |
| 15 | 22 | #include <__iterator/concepts.h> |
| 16 | 23 | #include <__iterator/incrementable_traits.h> |
| ... | ... | @@ -18,7 +25,8 @@ |
| 18 | 25 | #include <__iterator/iter_swap.h> |
| 19 | 26 | #include <__iterator/iterator_traits.h> |
| 20 | 27 | #include <__iterator/readable_traits.h> |
| 21 | #include <concepts> | |
| 28 | #include <__type_traits/is_pointer.h> | |
| 29 | #include <__utility/declval.h> | |
| 22 | 30 | #include <variant> |
| 23 | 31 | |
| 24 | 32 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -95,14 +103,14 @@ public: |
| 95 | 103 | |
| 96 | 104 | constexpr decltype(auto) operator*() |
| 97 | 105 | { |
| 98 | _LIBCPP_ASSERT(holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); | |
| 106 | _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); | |
| 99 | 107 | return *_VSTD::__unchecked_get<_Iter>(__hold_); |
| 100 | 108 | } |
| 101 | 109 | |
| 102 | 110 | constexpr decltype(auto) operator*() const |
| 103 | 111 | requires __dereferenceable<const _Iter> |
| 104 | 112 | { |
| 105 | _LIBCPP_ASSERT(holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); | |
| 113 | _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); | |
| 106 | 114 | return *_VSTD::__unchecked_get<_Iter>(__hold_); |
| 107 | 115 | } |
| 108 | 116 | |
| ... | ... | @@ -113,7 +121,7 @@ public: |
| 113 | 121 | is_reference_v<iter_reference_t<_I2>> || |
| 114 | 122 | constructible_from<iter_value_t<_I2>, iter_reference_t<_I2>>) |
| 115 | 123 | { |
| 116 | _LIBCPP_ASSERT(holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); | |
| 124 | _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); | |
| 117 | 125 | if constexpr (is_pointer_v<_Iter> || requires(const _Iter& __i) { __i.operator->(); }) { |
| 118 | 126 | return _VSTD::__unchecked_get<_Iter>(__hold_); |
| 119 | 127 | } else if constexpr (is_reference_v<iter_reference_t<_Iter>>) { |
| ... | ... | @@ -125,12 +133,12 @@ public: |
| 125 | 133 | } |
| 126 | 134 | |
| 127 | 135 | common_iterator& operator++() { |
| 128 | _LIBCPP_ASSERT(holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator"); | |
| 136 | _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator"); | |
| 129 | 137 | ++_VSTD::__unchecked_get<_Iter>(__hold_); return *this; |
| 130 | 138 | } |
| 131 | 139 | |
| 132 | 140 | decltype(auto) operator++(int) { |
| 133 | _LIBCPP_ASSERT(holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator"); | |
| 141 | _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator"); | |
| 134 | 142 | if constexpr (forward_iterator<_Iter>) { |
| 135 | 143 | auto __tmp = *this; |
| 136 | 144 | ++*this; |
| ... | ... | @@ -147,6 +155,7 @@ public: |
| 147 | 155 | |
| 148 | 156 | template<class _I2, sentinel_for<_Iter> _S2> |
| 149 | 157 | requires sentinel_for<_Sent, _I2> |
| 158 | _LIBCPP_HIDE_FROM_ABI | |
| 150 | 159 | friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) { |
| 151 | 160 | _LIBCPP_ASSERT(!__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); |
| 152 | 161 | _LIBCPP_ASSERT(!__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); |
| ... | ... | @@ -165,6 +174,7 @@ public: |
| 165 | 174 | |
| 166 | 175 | template<class _I2, sentinel_for<_Iter> _S2> |
| 167 | 176 | requires sentinel_for<_Sent, _I2> && equality_comparable_with<_Iter, _I2> |
| 177 | _LIBCPP_HIDE_FROM_ABI | |
| 168 | 178 | friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) { |
| 169 | 179 | _LIBCPP_ASSERT(!__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); |
| 170 | 180 | _LIBCPP_ASSERT(!__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); |
| ... | ... | @@ -186,6 +196,7 @@ public: |
| 186 | 196 | |
| 187 | 197 | template<sized_sentinel_for<_Iter> _I2, sized_sentinel_for<_Iter> _S2> |
| 188 | 198 | requires sized_sentinel_for<_Sent, _I2> |
| 199 | _LIBCPP_HIDE_FROM_ABI | |
| 189 | 200 | friend constexpr iter_difference_t<_I2> operator-(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) { |
| 190 | 201 | _LIBCPP_ASSERT(!__x.__hold_.valueless_by_exception(), "Attempted to subtract from a valueless common_iterator"); |
| 191 | 202 | _LIBCPP_ASSERT(!__y.__hold_.valueless_by_exception(), "Attempted to subtract a valueless common_iterator"); |
| ... | ... | @@ -205,20 +216,20 @@ public: |
| 205 | 216 | return _VSTD::__unchecked_get<_Sent>(__x.__hold_) - _VSTD::__unchecked_get<_I2>(__y.__hold_); |
| 206 | 217 | } |
| 207 | 218 | |
| 208 | friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const common_iterator& __i) | |
| 209 | noexcept(noexcept(ranges::iter_move(declval<const _Iter&>()))) | |
| 219 | _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const common_iterator& __i) | |
| 220 | noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>()))) | |
| 210 | 221 | requires input_iterator<_Iter> |
| 211 | 222 | { |
| 212 | _LIBCPP_ASSERT(holds_alternative<_Iter>(__i.__hold_), "Attempted to iter_move a non-dereferenceable common_iterator"); | |
| 223 | _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__i.__hold_), "Attempted to iter_move a non-dereferenceable common_iterator"); | |
| 213 | 224 | return ranges::iter_move( _VSTD::__unchecked_get<_Iter>(__i.__hold_)); |
| 214 | 225 | } |
| 215 | 226 | |
| 216 | 227 | template<indirectly_swappable<_Iter> _I2, class _S2> |
| 217 | friend constexpr void iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) | |
| 218 | noexcept(noexcept(ranges::iter_swap(declval<const _Iter&>(), declval<const _I2&>()))) | |
| 228 | _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) | |
| 229 | noexcept(noexcept(ranges::iter_swap(std::declval<const _Iter&>(), std::declval<const _I2&>()))) | |
| 219 | 230 | { |
| 220 | _LIBCPP_ASSERT(holds_alternative<_Iter>(__x.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator"); | |
| 221 | _LIBCPP_ASSERT(holds_alternative<_I2>(__y.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator"); | |
| 231 | _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__x.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator"); | |
| 232 | _LIBCPP_ASSERT(std::holds_alternative<_I2>(__y.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator"); | |
| 222 | 233 | return ranges::iter_swap(_VSTD::__unchecked_get<_Iter>(__x.__hold_), _VSTD::__unchecked_get<_I2>(__y.__hold_)); |
| 223 | 234 | } |
| 224 | 235 | }; |
| ... | ... | @@ -246,7 +257,7 @@ struct __arrow_type_or_void { |
| 246 | 257 | template<class _Iter, class _Sent> |
| 247 | 258 | requires __common_iter_has_ptr_op<_Iter, _Sent> |
| 248 | 259 | struct __arrow_type_or_void<_Iter, _Sent> { |
| 249 | using type = decltype(declval<const common_iterator<_Iter, _Sent>&>().operator->()); | |
| 260 | using type = decltype(std::declval<const common_iterator<_Iter, _Sent>&>().operator->()); | |
| 250 | 261 | }; |
| 251 | 262 | |
| 252 | 263 | template<input_iterator _Iter, class _Sent> |
lib/libcxx/include/__iterator/concepts.h+22-2| ... | ... | @@ -10,15 +10,35 @@ |
| 10 | 10 | #ifndef _LIBCPP___ITERATOR_CONCEPTS_H |
| 11 | 11 | #define _LIBCPP___ITERATOR_CONCEPTS_H |
| 12 | 12 | |
| 13 | #include <__concepts/arithmetic.h> | |
| 14 | #include <__concepts/assignable.h> | |
| 15 | #include <__concepts/common_reference_with.h> | |
| 16 | #include <__concepts/constructible.h> | |
| 17 | #include <__concepts/copyable.h> | |
| 18 | #include <__concepts/derived_from.h> | |
| 19 | #include <__concepts/equality_comparable.h> | |
| 20 | #include <__concepts/invocable.h> | |
| 21 | #include <__concepts/movable.h> | |
| 22 | #include <__concepts/predicate.h> | |
| 23 | #include <__concepts/regular.h> | |
| 24 | #include <__concepts/relation.h> | |
| 25 | #include <__concepts/same_as.h> | |
| 26 | #include <__concepts/semiregular.h> | |
| 27 | #include <__concepts/totally_ordered.h> | |
| 13 | 28 | #include <__config> |
| 29 | #include <__functional/invoke.h> | |
| 14 | 30 | #include <__iterator/incrementable_traits.h> |
| 15 | 31 | #include <__iterator/iter_move.h> |
| 16 | 32 | #include <__iterator/iterator_traits.h> |
| 17 | 33 | #include <__iterator/readable_traits.h> |
| 18 | 34 | #include <__memory/pointer_traits.h> |
| 35 | #include <__type_traits/add_pointer.h> | |
| 36 | #include <__type_traits/common_reference.h> | |
| 37 | #include <__type_traits/is_pointer.h> | |
| 38 | #include <__type_traits/is_reference.h> | |
| 39 | #include <__type_traits/remove_cv.h> | |
| 40 | #include <__type_traits/remove_cvref.h> | |
| 19 | 41 | #include <__utility/forward.h> |
| 20 | #include <concepts> | |
| 21 | #include <type_traits> | |
| 22 | 42 | |
| 23 | 43 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 24 | 44 | # pragma GCC system_header |
lib/libcxx/include/__iterator/counted_iterator.h+10-3| ... | ... | @@ -6,10 +6,16 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___ITERATOR_COUNTED_ITERATOR_H |
| 10 | 11 | #define _LIBCPP___ITERATOR_COUNTED_ITERATOR_H |
| 11 | 12 | |
| 12 | 13 | #include <__assert> |
| 14 | #include <__concepts/assignable.h> | |
| 15 | #include <__concepts/common_with.h> | |
| 16 | #include <__concepts/constructible.h> | |
| 17 | #include <__concepts/convertible_to.h> | |
| 18 | #include <__concepts/same_as.h> | |
| 13 | 19 | #include <__config> |
| 14 | 20 | #include <__iterator/concepts.h> |
| 15 | 21 | #include <__iterator/default_sentinel.h> |
| ... | ... | @@ -19,10 +25,10 @@ |
| 19 | 25 | #include <__iterator/iterator_traits.h> |
| 20 | 26 | #include <__iterator/readable_traits.h> |
| 21 | 27 | #include <__memory/pointer_traits.h> |
| 28 | #include <__type_traits/add_pointer.h> | |
| 29 | #include <__type_traits/conditional.h> | |
| 22 | 30 | #include <__utility/move.h> |
| 23 | 31 | #include <compare> |
| 24 | #include <concepts> | |
| 25 | #include <type_traits> | |
| 26 | 32 | |
| 27 | 33 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 28 | 34 | # pragma GCC system_header |
| ... | ... | @@ -263,7 +269,7 @@ public: |
| 263 | 269 | } |
| 264 | 270 | |
| 265 | 271 | template<common_with<_Iter> _I2> |
| 266 | friend constexpr strong_ordering operator<=>( | |
| 272 | _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering operator<=>( | |
| 267 | 273 | const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) |
| 268 | 274 | { |
| 269 | 275 | return __rhs.__count_ <=> __lhs.__count_; |
| ... | ... | @@ -288,6 +294,7 @@ public: |
| 288 | 294 | return ranges::iter_swap(__x.__current_, __y.__current_); |
| 289 | 295 | } |
| 290 | 296 | }; |
| 297 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(counted_iterator); | |
| 291 | 298 | |
| 292 | 299 | template<input_iterator _Iter> |
| 293 | 300 | requires same_as<_ITER_TRAITS<_Iter>, iterator_traits<_Iter>> |
lib/libcxx/include/__iterator/distance.h+8-7| ... | ... | @@ -17,7 +17,8 @@ |
| 17 | 17 | #include <__ranges/access.h> |
| 18 | 18 | #include <__ranges/concepts.h> |
| 19 | 19 | #include <__ranges/size.h> |
| 20 | #include <type_traits> | |
| 20 | #include <__type_traits/decay.h> | |
| 21 | #include <__type_traits/remove_cvref.h> | |
| 21 | 22 | |
| 22 | 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | 24 | # pragma GCC system_header |
| ... | ... | @@ -26,7 +27,7 @@ |
| 26 | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 28 | |
| 28 | 29 | template <class _InputIter> |
| 29 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 30 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 30 | 31 | typename iterator_traits<_InputIter>::difference_type |
| 31 | 32 | __distance(_InputIter __first, _InputIter __last, input_iterator_tag) |
| 32 | 33 | { |
| ... | ... | @@ -37,7 +38,7 @@ __distance(_InputIter __first, _InputIter __last, input_iterator_tag) |
| 37 | 38 | } |
| 38 | 39 | |
| 39 | 40 | template <class _RandIter> |
| 40 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 41 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 41 | 42 | typename iterator_traits<_RandIter>::difference_type |
| 42 | 43 | __distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) |
| 43 | 44 | { |
| ... | ... | @@ -45,14 +46,14 @@ __distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) |
| 45 | 46 | } |
| 46 | 47 | |
| 47 | 48 | template <class _InputIter> |
| 48 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 49 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 49 | 50 | typename iterator_traits<_InputIter>::difference_type |
| 50 | 51 | distance(_InputIter __first, _InputIter __last) |
| 51 | 52 | { |
| 52 | 53 | return _VSTD::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category()); |
| 53 | 54 | } |
| 54 | 55 | |
| 55 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 56 | #if _LIBCPP_STD_VER > 17 | |
| 56 | 57 | |
| 57 | 58 | // [range.iter.op.distance] |
| 58 | 59 | |
| ... | ... | @@ -75,7 +76,7 @@ struct __fn { |
| 75 | 76 | template<class _Ip, sized_sentinel_for<decay_t<_Ip>> _Sp> |
| 76 | 77 | _LIBCPP_HIDE_FROM_ABI |
| 77 | 78 | constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const { |
| 78 | if constexpr (sized_sentinel_for<_Sp, __uncvref_t<_Ip>>) { | |
| 79 | if constexpr (sized_sentinel_for<_Sp, __remove_cvref_t<_Ip>>) { | |
| 79 | 80 | return __last - __first; |
| 80 | 81 | } else { |
| 81 | 82 | return __last - decay_t<_Ip>(__first); |
| ... | ... | @@ -100,7 +101,7 @@ inline namespace __cpo { |
| 100 | 101 | } // namespace __cpo |
| 101 | 102 | } // namespace ranges |
| 102 | 103 | |
| 103 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 104 | #endif // _LIBCPP_STD_VER > 17 | |
| 104 | 105 | |
| 105 | 106 | _LIBCPP_END_NAMESPACE_STD |
| 106 | 107 |
lib/libcxx/include/__iterator/front_insert_iterator.h+8-7| ... | ... | @@ -45,20 +45,21 @@ public: |
| 45 | 45 | typedef void reference; |
| 46 | 46 | typedef _Container container_type; |
| 47 | 47 | |
| 48 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} | |
| 49 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator& operator=(const typename _Container::value_type& __value) | |
| 48 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} | |
| 49 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator=(const typename _Container::value_type& __value) | |
| 50 | 50 | {container->push_front(__value); return *this;} |
| 51 | 51 | #ifndef _LIBCPP_CXX03_LANG |
| 52 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator& operator=(typename _Container::value_type&& __value) | |
| 52 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator=(typename _Container::value_type&& __value) | |
| 53 | 53 | {container->push_front(_VSTD::move(__value)); return *this;} |
| 54 | 54 | #endif // _LIBCPP_CXX03_LANG |
| 55 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator& operator*() {return *this;} | |
| 56 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator& operator++() {return *this;} | |
| 57 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator operator++(int) {return *this;} | |
| 55 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator*() {return *this;} | |
| 56 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator++() {return *this;} | |
| 57 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator operator++(int) {return *this;} | |
| 58 | 58 | }; |
| 59 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(front_insert_iterator); | |
| 59 | 60 | |
| 60 | 61 | template <class _Container> |
| 61 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 62 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 62 | 63 | front_insert_iterator<_Container> |
| 63 | 64 | front_inserter(_Container& __x) |
| 64 | 65 | { |
lib/libcxx/include/__iterator/incrementable_traits.h+7-3| ... | ... | @@ -10,11 +10,15 @@ |
| 10 | 10 | #ifndef _LIBCPP___ITERATOR_INCREMENTABLE_TRAITS_H |
| 11 | 11 | #define _LIBCPP___ITERATOR_INCREMENTABLE_TRAITS_H |
| 12 | 12 | |
| 13 | #include <__concepts/arithmetic.h> | |
| 13 | 14 | #include <__config> |
| 15 | #include <__type_traits/conditional.h> | |
| 16 | #include <__type_traits/is_object.h> | |
| 14 | 17 | #include <__type_traits/is_primary_template.h> |
| 15 | #include <concepts> | |
| 18 | #include <__type_traits/make_signed.h> | |
| 19 | #include <__type_traits/remove_cvref.h> | |
| 20 | #include <__utility/declval.h> | |
| 16 | 21 | #include <cstddef> |
| 17 | #include <type_traits> | |
| 18 | 22 | |
| 19 | 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | 24 | # pragma GCC system_header |
| ... | ... | @@ -53,7 +57,7 @@ concept __has_integral_minus = |
| 53 | 57 | template<__has_integral_minus _Tp> |
| 54 | 58 | requires (!__has_member_difference_type<_Tp>) |
| 55 | 59 | struct incrementable_traits<_Tp> { |
| 56 | using difference_type = make_signed_t<decltype(declval<_Tp>() - declval<_Tp>())>; | |
| 60 | using difference_type = make_signed_t<decltype(std::declval<_Tp>() - std::declval<_Tp>())>; | |
| 57 | 61 | }; |
| 58 | 62 | |
| 59 | 63 | template <class> |
lib/libcxx/include/__iterator/insert_iterator.h+8-8| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | |
| 25 | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | template <class _Container> |
| 29 | 29 | using __insert_iterator_iter_t = ranges::iterator_t<_Container>; |
| 30 | 30 | #else |
| ... | ... | @@ -55,21 +55,21 @@ public: |
| 55 | 55 | typedef void reference; |
| 56 | 56 | typedef _Container container_type; |
| 57 | 57 | |
| 58 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator(_Container& __x, __insert_iterator_iter_t<_Container> __i) | |
| 58 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator(_Container& __x, __insert_iterator_iter_t<_Container> __i) | |
| 59 | 59 | : container(_VSTD::addressof(__x)), iter(__i) {} |
| 60 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator& operator=(const typename _Container::value_type& __value) | |
| 60 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator=(const typename _Container::value_type& __value) | |
| 61 | 61 | {iter = container->insert(iter, __value); ++iter; return *this;} |
| 62 | 62 | #ifndef _LIBCPP_CXX03_LANG |
| 63 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator& operator=(typename _Container::value_type&& __value) | |
| 63 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator=(typename _Container::value_type&& __value) | |
| 64 | 64 | {iter = container->insert(iter, _VSTD::move(__value)); ++iter; return *this;} |
| 65 | 65 | #endif // _LIBCPP_CXX03_LANG |
| 66 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator& operator*() {return *this;} | |
| 67 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator& operator++() {return *this;} | |
| 68 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator& operator++(int) {return *this;} | |
| 66 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator*() {return *this;} | |
| 67 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++() {return *this;} | |
| 68 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++(int) {return *this;} | |
| 69 | 69 | }; |
| 70 | 70 | |
| 71 | 71 | template <class _Container> |
| 72 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 72 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 73 | 73 | insert_iterator<_Container> |
| 74 | 74 | inserter(_Container& __x, __insert_iterator_iter_t<_Container> __i) |
| 75 | 75 | { |
lib/libcxx/include/__iterator/iter_move.h+7-2| ... | ... | @@ -13,9 +13,11 @@ |
| 13 | 13 | #include <__concepts/class_or_enum.h> |
| 14 | 14 | #include <__config> |
| 15 | 15 | #include <__iterator/iterator_traits.h> |
| 16 | #include <__type_traits/is_reference.h> | |
| 17 | #include <__type_traits/remove_cvref.h> | |
| 18 | #include <__utility/declval.h> | |
| 16 | 19 | #include <__utility/forward.h> |
| 17 | 20 | #include <__utility/move.h> |
| 18 | #include <type_traits> | |
| 19 | 21 | |
| 20 | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 21 | 23 | # pragma GCC system_header |
| ... | ... | @@ -36,6 +38,7 @@ template <class _Tp> |
| 36 | 38 | concept __unqualified_iter_move = |
| 37 | 39 | __class_or_enum<remove_cvref_t<_Tp>> && |
| 38 | 40 | requires (_Tp&& __t) { |
| 41 | // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap | |
| 39 | 42 | iter_move(std::forward<_Tp>(__t)); |
| 40 | 43 | }; |
| 41 | 44 | |
| ... | ... | @@ -59,6 +62,7 @@ concept __just_deref = |
| 59 | 62 | // [iterator.cust.move] |
| 60 | 63 | |
| 61 | 64 | struct __fn { |
| 65 | // NOLINTBEGIN(libcpp-robust-against-adl) iter_move ADL calls should only be made through ranges::iter_move | |
| 62 | 66 | template<class _Ip> |
| 63 | 67 | requires __unqualified_iter_move<_Ip> |
| 64 | 68 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Ip&& __i) const |
| ... | ... | @@ -66,6 +70,7 @@ struct __fn { |
| 66 | 70 | { |
| 67 | 71 | return iter_move(std::forward<_Ip>(__i)); |
| 68 | 72 | } |
| 73 | // NOLINTEND(libcpp-robust-against-adl) | |
| 69 | 74 | |
| 70 | 75 | template<class _Ip> |
| 71 | 76 | requires __move_deref<_Ip> |
| ... | ... | @@ -90,7 +95,7 @@ inline namespace __cpo { |
| 90 | 95 | |
| 91 | 96 | template<__dereferenceable _Tp> |
| 92 | 97 | requires requires(_Tp& __t) { { ranges::iter_move(__t) } -> __can_reference; } |
| 93 | using iter_rvalue_reference_t = decltype(ranges::iter_move(declval<_Tp&>())); | |
| 98 | using iter_rvalue_reference_t = decltype(ranges::iter_move(std::declval<_Tp&>())); | |
| 94 | 99 | |
| 95 | 100 | #endif // _LIBCPP_STD_VER > 17 |
| 96 | 101 |
lib/libcxx/include/__iterator/iter_swap.h+10-3| ... | ... | @@ -6,18 +6,21 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___ITERATOR_ITER_SWAP_H |
| 10 | 11 | #define _LIBCPP___ITERATOR_ITER_SWAP_H |
| 11 | 12 | |
| 13 | #include <__concepts/class_or_enum.h> | |
| 14 | #include <__concepts/swappable.h> | |
| 12 | 15 | #include <__config> |
| 13 | 16 | #include <__iterator/concepts.h> |
| 14 | 17 | #include <__iterator/iter_move.h> |
| 15 | 18 | #include <__iterator/iterator_traits.h> |
| 16 | 19 | #include <__iterator/readable_traits.h> |
| 20 | #include <__type_traits/remove_cvref.h> | |
| 21 | #include <__utility/declval.h> | |
| 17 | 22 | #include <__utility/forward.h> |
| 18 | 23 | #include <__utility/move.h> |
| 19 | #include <concepts> | |
| 20 | #include <type_traits> | |
| 21 | 24 | |
| 22 | 25 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | 26 | # pragma GCC system_header |
| ... | ... | @@ -38,6 +41,7 @@ namespace __iter_swap { |
| 38 | 41 | concept __unqualified_iter_swap = |
| 39 | 42 | (__class_or_enum<remove_cvref_t<_T1>> || __class_or_enum<remove_cvref_t<_T2>>) && |
| 40 | 43 | requires (_T1&& __x, _T2&& __y) { |
| 44 | // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap | |
| 41 | 45 | iter_swap(_VSTD::forward<_T1>(__x), _VSTD::forward<_T2>(__y)); |
| 42 | 46 | }; |
| 43 | 47 | |
| ... | ... | @@ -46,7 +50,9 @@ namespace __iter_swap { |
| 46 | 50 | indirectly_readable<_T1> && indirectly_readable<_T2> && |
| 47 | 51 | swappable_with<iter_reference_t<_T1>, iter_reference_t<_T2>>; |
| 48 | 52 | |
| 53 | ||
| 49 | 54 | struct __fn { |
| 55 | // NOLINTBEGIN(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap | |
| 50 | 56 | template <class _T1, class _T2> |
| 51 | 57 | requires __unqualified_iter_swap<_T1, _T2> |
| 52 | 58 | _LIBCPP_HIDE_FROM_ABI |
| ... | ... | @@ -55,6 +61,7 @@ namespace __iter_swap { |
| 55 | 61 | { |
| 56 | 62 | (void)iter_swap(_VSTD::forward<_T1>(__x), _VSTD::forward<_T2>(__y)); |
| 57 | 63 | } |
| 64 | // NOLINTEND(libcpp-robust-against-adl) | |
| 58 | 65 | |
| 59 | 66 | template <class _T1, class _T2> |
| 60 | 67 | requires (!__unqualified_iter_swap<_T1, _T2>) && |
| ... | ... | @@ -75,7 +82,7 @@ namespace __iter_swap { |
| 75 | 82 | constexpr void operator()(_T1&& __x, _T2&& __y) const |
| 76 | 83 | noexcept(noexcept(iter_value_t<_T2>(ranges::iter_move(__y))) && |
| 77 | 84 | noexcept(*__y = ranges::iter_move(__x)) && |
| 78 | noexcept(*_VSTD::forward<_T1>(__x) = declval<iter_value_t<_T2>>())) | |
| 85 | noexcept(*_VSTD::forward<_T1>(__x) = std::declval<iter_value_t<_T2>>())) | |
| 79 | 86 | { |
| 80 | 87 | iter_value_t<_T2> __old(ranges::iter_move(__y)); |
| 81 | 88 | *__y = ranges::iter_move(__x); |
lib/libcxx/include/__iterator/iterator_traits.h+31-11| ... | ... | @@ -10,12 +10,32 @@ |
| 10 | 10 | #ifndef _LIBCPP___ITERATOR_ITERATOR_TRAITS_H |
| 11 | 11 | #define _LIBCPP___ITERATOR_ITERATOR_TRAITS_H |
| 12 | 12 | |
| 13 | #include <__concepts/arithmetic.h> | |
| 14 | #include <__concepts/constructible.h> | |
| 15 | #include <__concepts/convertible_to.h> | |
| 16 | #include <__concepts/copyable.h> | |
| 17 | #include <__concepts/equality_comparable.h> | |
| 18 | #include <__concepts/same_as.h> | |
| 19 | #include <__concepts/totally_ordered.h> | |
| 13 | 20 | #include <__config> |
| 21 | #include <__fwd/pair.h> | |
| 14 | 22 | #include <__iterator/incrementable_traits.h> |
| 15 | 23 | #include <__iterator/readable_traits.h> |
| 16 | #include <concepts> | |
| 24 | #include <__type_traits/add_const.h> | |
| 25 | #include <__type_traits/common_reference.h> | |
| 26 | #include <__type_traits/conditional.h> | |
| 27 | #include <__type_traits/disjunction.h> | |
| 28 | #include <__type_traits/is_convertible.h> | |
| 29 | #include <__type_traits/is_object.h> | |
| 30 | #include <__type_traits/is_primary_template.h> | |
| 31 | #include <__type_traits/is_reference.h> | |
| 32 | #include <__type_traits/is_valid_expansion.h> | |
| 33 | #include <__type_traits/remove_const.h> | |
| 34 | #include <__type_traits/remove_cv.h> | |
| 35 | #include <__type_traits/remove_cvref.h> | |
| 36 | #include <__type_traits/void_t.h> | |
| 37 | #include <__utility/declval.h> | |
| 17 | 38 | #include <cstddef> |
| 18 | #include <type_traits> | |
| 19 | 39 | |
| 20 | 40 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 21 | 41 | # pragma GCC system_header |
| ... | ... | @@ -40,7 +60,7 @@ concept __dereferenceable = requires(_Tp& __t) { |
| 40 | 60 | |
| 41 | 61 | // [iterator.traits] |
| 42 | 62 | template<__dereferenceable _Tp> |
| 43 | using iter_reference_t = decltype(*declval<_Tp&>()); | |
| 63 | using iter_reference_t = decltype(*std::declval<_Tp&>()); | |
| 44 | 64 | |
| 45 | 65 | #endif // _LIBCPP_STD_VER > 17 |
| 46 | 66 | |
| ... | ... | @@ -107,11 +127,11 @@ struct __has_iterator_typedefs |
| 107 | 127 | { |
| 108 | 128 | private: |
| 109 | 129 | template <class _Up> static false_type __test(...); |
| 110 | template <class _Up> static true_type __test(typename __void_t<typename _Up::iterator_category>::type* = 0, | |
| 111 | typename __void_t<typename _Up::difference_type>::type* = 0, | |
| 112 | typename __void_t<typename _Up::value_type>::type* = 0, | |
| 113 | typename __void_t<typename _Up::reference>::type* = 0, | |
| 114 | typename __void_t<typename _Up::pointer>::type* = 0); | |
| 130 | template <class _Up> static true_type __test(__void_t<typename _Up::iterator_category>* = nullptr, | |
| 131 | __void_t<typename _Up::difference_type>* = nullptr, | |
| 132 | __void_t<typename _Up::value_type>* = nullptr, | |
| 133 | __void_t<typename _Up::reference>* = nullptr, | |
| 134 | __void_t<typename _Up::pointer>* = nullptr); | |
| 115 | 135 | public: |
| 116 | 136 | static const bool value = decltype(__test<_Tp>(0,0,0,0,0))::value; |
| 117 | 137 | }; |
| ... | ... | @@ -253,7 +273,7 @@ struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> { using type = typ |
| 253 | 273 | template<class _Ip> |
| 254 | 274 | requires requires(_Ip& __i) { __i.operator->(); } && (!__has_member_pointer<_Ip>) |
| 255 | 275 | struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> { |
| 256 | using type = decltype(declval<_Ip&>().operator->()); | |
| 276 | using type = decltype(std::declval<_Ip&>().operator->()); | |
| 257 | 277 | }; |
| 258 | 278 | |
| 259 | 279 | // Otherwise, `reference` names `iter-reference-t<I>`. |
| ... | ... | @@ -407,7 +427,7 @@ requires is_object_v<_Tp> |
| 407 | 427 | struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> |
| 408 | 428 | { |
| 409 | 429 | typedef ptrdiff_t difference_type; |
| 410 | typedef typename remove_cv<_Tp>::type value_type; | |
| 430 | typedef __remove_cv_t<_Tp> value_type; | |
| 411 | 431 | typedef _Tp* pointer; |
| 412 | 432 | typedef _Tp& reference; |
| 413 | 433 | typedef random_access_iterator_tag iterator_category; |
| ... | ... | @@ -492,7 +512,7 @@ template<class _InputIterator> |
| 492 | 512 | using __iter_value_type = typename iterator_traits<_InputIterator>::value_type; |
| 493 | 513 | |
| 494 | 514 | template<class _InputIterator> |
| 495 | using __iter_key_type = typename remove_const<typename iterator_traits<_InputIterator>::value_type::first_type>::type; | |
| 515 | using __iter_key_type = __remove_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>; | |
| 496 | 516 | |
| 497 | 517 | template<class _InputIterator> |
| 498 | 518 | using __iter_mapped_type = typename iterator_traits<_InputIterator>::value_type::second_type; |
lib/libcxx/include/__iterator/iterator_with_data.h created+100| ... | ... | @@ -0,0 +1,100 @@ |
| 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___ITERATOR_ITERATOR_WITH_DATA_H | |
| 10 | #define _LIBCPP___ITERATOR_ITERATOR_WITH_DATA_H | |
| 11 | ||
| 12 | #include <__compare/compare_three_way_result.h> | |
| 13 | #include <__compare/three_way_comparable.h> | |
| 14 | #include <__config> | |
| 15 | #include <__iterator/concepts.h> | |
| 16 | #include <__iterator/incrementable_traits.h> | |
| 17 | #include <__iterator/iter_move.h> | |
| 18 | #include <__iterator/iter_swap.h> | |
| 19 | #include <__iterator/iterator_traits.h> | |
| 20 | #include <__iterator/readable_traits.h> | |
| 21 | #include <__utility/move.h> | |
| 22 | ||
| 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 24 | # pragma GCC system_header | |
| 25 | #endif | |
| 26 | ||
| 27 | #if _LIBCPP_STD_VER >= 20 | |
| 28 | ||
| 29 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 30 | ||
| 31 | template <forward_iterator _Iterator, class _Data> | |
| 32 | class __iterator_with_data { | |
| 33 | _Iterator __iter_{}; | |
| 34 | _Data __data_{}; | |
| 35 | ||
| 36 | public: | |
| 37 | using value_type = iter_value_t<_Iterator>; | |
| 38 | using difference_type = iter_difference_t<_Iterator>; | |
| 39 | ||
| 40 | _LIBCPP_HIDE_FROM_ABI __iterator_with_data() = default; | |
| 41 | ||
| 42 | constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data(_Iterator __iter, _Data __data) | |
| 43 | : __iter_(std::move(__iter)), __data_(std::move(__data)) {} | |
| 44 | ||
| 45 | constexpr _LIBCPP_HIDE_FROM_ABI _Iterator __get_iter() const { return __iter_; } | |
| 46 | ||
| 47 | constexpr _LIBCPP_HIDE_FROM_ABI _Data __get_data() && { return std::move(__data_); } | |
| 48 | ||
| 49 | friend constexpr _LIBCPP_HIDE_FROM_ABI bool | |
| 50 | operator==(const __iterator_with_data& __lhs, const __iterator_with_data& __rhs) { | |
| 51 | return __lhs.__iter_ == __rhs.__iter_; | |
| 52 | } | |
| 53 | ||
| 54 | constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data& operator++() { | |
| 55 | ++__iter_; | |
| 56 | return *this; | |
| 57 | } | |
| 58 | ||
| 59 | constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data operator++(int) { | |
| 60 | auto __tmp = *this; | |
| 61 | __iter_++; | |
| 62 | return __tmp; | |
| 63 | } | |
| 64 | ||
| 65 | constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data& operator--() | |
| 66 | requires bidirectional_iterator<_Iterator> | |
| 67 | { | |
| 68 | --__iter_; | |
| 69 | return *this; | |
| 70 | } | |
| 71 | ||
| 72 | constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data operator--(int) | |
| 73 | requires bidirectional_iterator<_Iterator> | |
| 74 | { | |
| 75 | auto __tmp = *this; | |
| 76 | --__iter_; | |
| 77 | return __tmp; | |
| 78 | } | |
| 79 | ||
| 80 | constexpr _LIBCPP_HIDE_FROM_ABI iter_reference_t<_Iterator> operator*() const { return *__iter_; } | |
| 81 | ||
| 82 | _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iterator> | |
| 83 | iter_move(const __iterator_with_data& __iter) noexcept(noexcept(ranges::iter_move(__iter.__iter_))) { | |
| 84 | return ranges::iter_move(__iter.__iter_); | |
| 85 | } | |
| 86 | ||
| 87 | _LIBCPP_HIDE_FROM_ABI friend constexpr void | |
| 88 | iter_swap(const __iterator_with_data& __lhs, | |
| 89 | const __iterator_with_data& __rhs) noexcept(noexcept(ranges::iter_swap(__lhs.__iter_, __rhs.__iter_))) | |
| 90 | requires indirectly_swappable<_Iterator> | |
| 91 | { | |
| 92 | return ranges::iter_swap(__lhs.__data_, __rhs.__iter_); | |
| 93 | } | |
| 94 | }; | |
| 95 | ||
| 96 | _LIBCPP_END_NAMESPACE_STD | |
| 97 | ||
| 98 | #endif // _LIBCPP_STD_VER >= 20 | |
| 99 | ||
| 100 | #endif // _LIBCPP___ITERATOR_ITERATOR_WITH_DATA_H |
lib/libcxx/include/__iterator/move_iterator.h+37-28| ... | ... | @@ -24,8 +24,16 @@ |
| 24 | 24 | #include <__iterator/iterator_traits.h> |
| 25 | 25 | #include <__iterator/move_sentinel.h> |
| 26 | 26 | #include <__iterator/readable_traits.h> |
| 27 | #include <__type_traits/conditional.h> | |
| 28 | #include <__type_traits/enable_if.h> | |
| 29 | #include <__type_traits/is_assignable.h> | |
| 30 | #include <__type_traits/is_constructible.h> | |
| 31 | #include <__type_traits/is_convertible.h> | |
| 32 | #include <__type_traits/is_reference.h> | |
| 33 | #include <__type_traits/is_same.h> | |
| 34 | #include <__type_traits/remove_reference.h> | |
| 35 | #include <__utility/declval.h> | |
| 27 | 36 | #include <__utility/move.h> |
| 28 | #include <type_traits> | |
| 29 | 37 | |
| 30 | 38 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 31 | 39 | # pragma GCC system_header |
| ... | ... | @@ -49,7 +57,7 @@ struct __move_iter_category_base<_Iter> { |
| 49 | 57 | |
| 50 | 58 | template<class _Iter, class _Sent> |
| 51 | 59 | concept __move_iter_comparable = requires { |
| 52 | { declval<const _Iter&>() == declval<_Sent>() } -> convertible_to<bool>; | |
| 60 | { std::declval<const _Iter&>() == std::declval<_Sent>() } -> convertible_to<bool>; | |
| 53 | 61 | }; |
| 54 | 62 | #endif // _LIBCPP_STD_VER > 17 |
| 55 | 63 | |
| ... | ... | @@ -82,18 +90,18 @@ public: |
| 82 | 90 | typedef typename iterator_traits<iterator_type>::reference __reference; |
| 83 | 91 | typedef typename conditional< |
| 84 | 92 | is_reference<__reference>::value, |
| 85 | typename remove_reference<__reference>::type&&, | |
| 93 | __libcpp_remove_reference_t<__reference>&&, | |
| 86 | 94 | __reference |
| 87 | 95 | >::type reference; |
| 88 | 96 | #endif // _LIBCPP_STD_VER > 17 |
| 89 | 97 | |
| 90 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 98 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 91 | 99 | explicit move_iterator(_Iter __i) : __current_(std::move(__i)) {} |
| 92 | 100 | |
| 93 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 101 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 94 | 102 | move_iterator& operator++() { ++__current_; return *this; } |
| 95 | 103 | |
| 96 | _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 104 | _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 97 | 105 | pointer operator->() const { return __current_; } |
| 98 | 106 | |
| 99 | 107 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -133,13 +141,13 @@ public: |
| 133 | 141 | _LIBCPP_HIDE_FROM_ABI constexpr |
| 134 | 142 | void operator++(int) { ++__current_; } |
| 135 | 143 | #else |
| 136 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 144 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 137 | 145 | move_iterator() : __current_() {} |
| 138 | 146 | |
| 139 | 147 | template <class _Up, class = __enable_if_t< |
| 140 | 148 | !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value |
| 141 | 149 | > > |
| 142 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 150 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 143 | 151 | move_iterator(const move_iterator<_Up>& __u) : __current_(__u.base()) {} |
| 144 | 152 | |
| 145 | 153 | template <class _Up, class = __enable_if_t< |
| ... | ... | @@ -147,35 +155,35 @@ public: |
| 147 | 155 | is_convertible<const _Up&, _Iter>::value && |
| 148 | 156 | is_assignable<_Iter&, const _Up&>::value |
| 149 | 157 | > > |
| 150 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 158 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 151 | 159 | move_iterator& operator=(const move_iterator<_Up>& __u) { |
| 152 | 160 | __current_ = __u.base(); |
| 153 | 161 | return *this; |
| 154 | 162 | } |
| 155 | 163 | |
| 156 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 164 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 157 | 165 | _Iter base() const { return __current_; } |
| 158 | 166 | |
| 159 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 167 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 160 | 168 | reference operator*() const { return static_cast<reference>(*__current_); } |
| 161 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 169 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 162 | 170 | reference operator[](difference_type __n) const { return static_cast<reference>(__current_[__n]); } |
| 163 | 171 | |
| 164 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 172 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 165 | 173 | move_iterator operator++(int) { move_iterator __tmp(*this); ++__current_; return __tmp; } |
| 166 | 174 | #endif // _LIBCPP_STD_VER > 17 |
| 167 | 175 | |
| 168 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 176 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 169 | 177 | move_iterator& operator--() { --__current_; return *this; } |
| 170 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 178 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 171 | 179 | move_iterator operator--(int) { move_iterator __tmp(*this); --__current_; return __tmp; } |
| 172 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 180 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 173 | 181 | move_iterator operator+(difference_type __n) const { return move_iterator(__current_ + __n); } |
| 174 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 182 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 175 | 183 | move_iterator& operator+=(difference_type __n) { __current_ += __n; return *this; } |
| 176 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 184 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 177 | 185 | move_iterator operator-(difference_type __n) const { return move_iterator(__current_ - __n); } |
| 178 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 186 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 179 | 187 | move_iterator& operator-=(difference_type __n) { __current_ -= __n; return *this; } |
| 180 | 188 | |
| 181 | 189 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -222,9 +230,10 @@ private: |
| 222 | 230 | |
| 223 | 231 | _Iter __current_; |
| 224 | 232 | }; |
| 233 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_iterator); | |
| 225 | 234 | |
| 226 | 235 | template <class _Iter1, class _Iter2> |
| 227 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 236 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 228 | 237 | bool operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) |
| 229 | 238 | { |
| 230 | 239 | return __x.base() == __y.base(); |
| ... | ... | @@ -232,7 +241,7 @@ bool operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& _ |
| 232 | 241 | |
| 233 | 242 | #if _LIBCPP_STD_VER <= 17 |
| 234 | 243 | template <class _Iter1, class _Iter2> |
| 235 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 244 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 236 | 245 | bool operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) |
| 237 | 246 | { |
| 238 | 247 | return __x.base() != __y.base(); |
| ... | ... | @@ -240,28 +249,28 @@ bool operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& _ |
| 240 | 249 | #endif // _LIBCPP_STD_VER <= 17 |
| 241 | 250 | |
| 242 | 251 | template <class _Iter1, class _Iter2> |
| 243 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 252 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 244 | 253 | bool operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) |
| 245 | 254 | { |
| 246 | 255 | return __x.base() < __y.base(); |
| 247 | 256 | } |
| 248 | 257 | |
| 249 | 258 | template <class _Iter1, class _Iter2> |
| 250 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 259 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 251 | 260 | bool operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) |
| 252 | 261 | { |
| 253 | 262 | return __x.base() > __y.base(); |
| 254 | 263 | } |
| 255 | 264 | |
| 256 | 265 | template <class _Iter1, class _Iter2> |
| 257 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 266 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 258 | 267 | bool operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) |
| 259 | 268 | { |
| 260 | 269 | return __x.base() <= __y.base(); |
| 261 | 270 | } |
| 262 | 271 | |
| 263 | 272 | template <class _Iter1, class _Iter2> |
| 264 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 273 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 265 | 274 | bool operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) |
| 266 | 275 | { |
| 267 | 276 | return __x.base() >= __y.base(); |
| ... | ... | @@ -279,7 +288,7 @@ auto operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& |
| 279 | 288 | |
| 280 | 289 | #ifndef _LIBCPP_CXX03_LANG |
| 281 | 290 | template <class _Iter1, class _Iter2> |
| 282 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 291 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 283 | 292 | auto operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) |
| 284 | 293 | -> decltype(__x.base() - __y.base()) |
| 285 | 294 | { |
| ... | ... | @@ -305,7 +314,7 @@ move_iterator<_Iter> operator+(iter_difference_t<_Iter> __n, const move_iterator |
| 305 | 314 | } |
| 306 | 315 | #else |
| 307 | 316 | template <class _Iter> |
| 308 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 317 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 309 | 318 | move_iterator<_Iter> |
| 310 | 319 | operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) |
| 311 | 320 | { |
| ... | ... | @@ -314,7 +323,7 @@ operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterato |
| 314 | 323 | #endif // _LIBCPP_STD_VER > 17 |
| 315 | 324 | |
| 316 | 325 | template <class _Iter> |
| 317 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 326 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 318 | 327 | move_iterator<_Iter> |
| 319 | 328 | make_move_iterator(_Iter __i) |
| 320 | 329 | { |
lib/libcxx/include/__iterator/move_sentinel.h+2| ... | ... | @@ -50,6 +50,8 @@ private: |
| 50 | 50 | _Sent __last_ = _Sent(); |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_sentinel); | |
| 54 | ||
| 53 | 55 | #endif // _LIBCPP_STD_VER > 17 |
| 54 | 56 | |
| 55 | 57 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__iterator/next.h+4-4| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | #include <__iterator/concepts.h> |
| 17 | 17 | #include <__iterator/incrementable_traits.h> |
| 18 | 18 | #include <__iterator/iterator_traits.h> |
| 19 | #include <type_traits> | |
| 19 | #include <__type_traits/enable_if.h> | |
| 20 | 20 | |
| 21 | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 22 | 22 | # pragma GCC system_header |
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| 27 | 27 | template <class _InputIter> |
| 28 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 28 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 29 | 29 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value, _InputIter>::type |
| 30 | 30 | next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) { |
| 31 | 31 | _LIBCPP_ASSERT(__n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value, |
| ... | ... | @@ -35,7 +35,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 35 | 35 | return __x; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 38 | #if _LIBCPP_STD_VER > 17 | |
| 39 | 39 | |
| 40 | 40 | // [range.iter.op.next] |
| 41 | 41 | |
| ... | ... | @@ -77,7 +77,7 @@ inline namespace __cpo { |
| 77 | 77 | } // namespace __cpo |
| 78 | 78 | } // namespace ranges |
| 79 | 79 | |
| 80 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 80 | #endif // _LIBCPP_STD_VER > 17 | |
| 81 | 81 | |
| 82 | 82 | _LIBCPP_END_NAMESPACE_STD |
| 83 | 83 |
lib/libcxx/include/__iterator/ostreambuf_iterator.h+1-1| ... | ... | @@ -65,7 +65,7 @@ public: |
| 65 | 65 | |
| 66 | 66 | template <class _Ch, class _Tr> |
| 67 | 67 | friend |
| 68 | _LIBCPP_HIDDEN | |
| 68 | _LIBCPP_HIDE_FROM_ABI | |
| 69 | 69 | ostreambuf_iterator<_Ch, _Tr> |
| 70 | 70 | __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s, |
| 71 | 71 | const _Ch* __ob, const _Ch* __op, const _Ch* __oe, |
lib/libcxx/include/__iterator/prev.h+4-4| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | #include <__iterator/concepts.h> |
| 17 | 17 | #include <__iterator/incrementable_traits.h> |
| 18 | 18 | #include <__iterator/iterator_traits.h> |
| 19 | #include <type_traits> | |
| 19 | #include <__type_traits/enable_if.h> | |
| 20 | 20 | |
| 21 | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 22 | 22 | # pragma GCC system_header |
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| 27 | 27 | template <class _InputIter> |
| 28 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 28 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 29 | 29 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value, _InputIter>::type |
| 30 | 30 | prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) { |
| 31 | 31 | _LIBCPP_ASSERT(__n <= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value, |
| ... | ... | @@ -34,7 +34,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 34 | 34 | return __x; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 37 | #if _LIBCPP_STD_VER > 17 | |
| 38 | 38 | |
| 39 | 39 | // [range.iter.op.prev] |
| 40 | 40 | |
| ... | ... | @@ -70,7 +70,7 @@ inline namespace __cpo { |
| 70 | 70 | } // namespace __cpo |
| 71 | 71 | } // namespace ranges |
| 72 | 72 | |
| 73 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 73 | #endif // _LIBCPP_STD_VER > 17 | |
| 74 | 74 | |
| 75 | 75 | _LIBCPP_END_NAMESPACE_STD |
| 76 | 76 |
lib/libcxx/include/__iterator/projected.h+2-1| ... | ... | @@ -6,13 +6,14 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___ITERATOR_PROJECTED_H |
| 10 | 11 | #define _LIBCPP___ITERATOR_PROJECTED_H |
| 11 | 12 | |
| 12 | 13 | #include <__config> |
| 13 | 14 | #include <__iterator/concepts.h> |
| 14 | 15 | #include <__iterator/incrementable_traits.h> |
| 15 | #include <type_traits> | |
| 16 | #include <__type_traits/remove_cvref.h> | |
| 16 | 17 | |
| 17 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 19 | # pragma GCC system_header |
lib/libcxx/include/__iterator/readable_traits.h+8-2| ... | ... | @@ -10,9 +10,15 @@ |
| 10 | 10 | #ifndef _LIBCPP___ITERATOR_READABLE_TRAITS_H |
| 11 | 11 | #define _LIBCPP___ITERATOR_READABLE_TRAITS_H |
| 12 | 12 | |
| 13 | #include <__concepts/same_as.h> | |
| 13 | 14 | #include <__config> |
| 14 | #include <concepts> | |
| 15 | #include <type_traits> | |
| 15 | #include <__type_traits/conditional.h> | |
| 16 | #include <__type_traits/is_array.h> | |
| 17 | #include <__type_traits/is_object.h> | |
| 18 | #include <__type_traits/is_primary_template.h> | |
| 19 | #include <__type_traits/remove_cv.h> | |
| 20 | #include <__type_traits/remove_cvref.h> | |
| 21 | #include <__type_traits/remove_extent.h> | |
| 16 | 22 | |
| 17 | 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 24 | # pragma GCC system_header |
lib/libcxx/include/__iterator/reverse_access.h+10-10| ... | ... | @@ -24,70 +24,70 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | #if _LIBCPP_STD_VER > 11 |
| 25 | 25 | |
| 26 | 26 | template <class _Tp, size_t _Np> |
| 27 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 27 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 28 | 28 | reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) |
| 29 | 29 | { |
| 30 | 30 | return reverse_iterator<_Tp*>(__array + _Np); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | template <class _Tp, size_t _Np> |
| 34 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 34 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 35 | 35 | reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) |
| 36 | 36 | { |
| 37 | 37 | return reverse_iterator<_Tp*>(__array); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | template <class _Ep> |
| 41 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 41 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 42 | 42 | reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il) |
| 43 | 43 | { |
| 44 | 44 | return reverse_iterator<const _Ep*>(__il.end()); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | template <class _Ep> |
| 48 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 48 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 49 | 49 | reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il) |
| 50 | 50 | { |
| 51 | 51 | return reverse_iterator<const _Ep*>(__il.begin()); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | template <class _Cp> |
| 55 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 55 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 56 | 56 | auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) |
| 57 | 57 | { |
| 58 | 58 | return __c.rbegin(); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | template <class _Cp> |
| 62 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 62 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 63 | 63 | auto rbegin(const _Cp& __c) -> decltype(__c.rbegin()) |
| 64 | 64 | { |
| 65 | 65 | return __c.rbegin(); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | template <class _Cp> |
| 69 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 69 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 70 | 70 | auto rend(_Cp& __c) -> decltype(__c.rend()) |
| 71 | 71 | { |
| 72 | 72 | return __c.rend(); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | template <class _Cp> |
| 76 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 76 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 77 | 77 | auto rend(const _Cp& __c) -> decltype(__c.rend()) |
| 78 | 78 | { |
| 79 | 79 | return __c.rend(); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | template <class _Cp> |
| 83 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 83 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 84 | 84 | auto crbegin(const _Cp& __c) -> decltype(_VSTD::rbegin(__c)) |
| 85 | 85 | { |
| 86 | 86 | return _VSTD::rbegin(__c); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | template <class _Cp> |
| 90 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 90 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 91 | 91 | auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c)) |
| 92 | 92 | { |
| 93 | 93 | return _VSTD::rend(__c); |
lib/libcxx/include/__iterator/reverse_iterator.h+47-48| ... | ... | @@ -25,12 +25,20 @@ |
| 25 | 25 | #include <__iterator/next.h> |
| 26 | 26 | #include <__iterator/prev.h> |
| 27 | 27 | #include <__iterator/readable_traits.h> |
| 28 | #include <__iterator/segmented_iterator.h> | |
| 28 | 29 | #include <__memory/addressof.h> |
| 29 | 30 | #include <__ranges/access.h> |
| 30 | 31 | #include <__ranges/concepts.h> |
| 31 | 32 | #include <__ranges/subrange.h> |
| 33 | #include <__type_traits/conditional.h> | |
| 34 | #include <__type_traits/enable_if.h> | |
| 35 | #include <__type_traits/is_assignable.h> | |
| 36 | #include <__type_traits/is_convertible.h> | |
| 37 | #include <__type_traits/is_nothrow_copy_constructible.h> | |
| 38 | #include <__type_traits/is_pointer.h> | |
| 39 | #include <__type_traits/is_same.h> | |
| 40 | #include <__utility/declval.h> | |
| 32 | 41 | #include <__utility/move.h> |
| 33 | #include <type_traits> | |
| 34 | 42 | |
| 35 | 43 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 36 | 44 | # pragma GCC system_header |
| ... | ... | @@ -52,7 +60,7 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator |
| 52 | 60 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 53 | 61 | private: |
| 54 | 62 | #ifndef _LIBCPP_ABI_NO_ITERATOR_BASES |
| 55 | _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break | |
| 63 | _Iter __t_; // no longer used as of LWG #2360, not removed due to ABI break | |
| 56 | 64 | #endif |
| 57 | 65 | |
| 58 | 66 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -81,18 +89,18 @@ public: |
| 81 | 89 | #endif |
| 82 | 90 | |
| 83 | 91 | #ifndef _LIBCPP_ABI_NO_ITERATOR_BASES |
| 84 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 85 | reverse_iterator() : __t(), current() {} | |
| 92 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 93 | reverse_iterator() : __t_(), current() {} | |
| 86 | 94 | |
| 87 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 88 | explicit reverse_iterator(_Iter __x) : __t(__x), current(__x) {} | |
| 95 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 96 | explicit reverse_iterator(_Iter __x) : __t_(__x), current(__x) {} | |
| 89 | 97 | |
| 90 | 98 | template <class _Up, class = __enable_if_t< |
| 91 | 99 | !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value |
| 92 | 100 | > > |
| 93 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 101 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 94 | 102 | reverse_iterator(const reverse_iterator<_Up>& __u) |
| 95 | : __t(__u.base()), current(__u.base()) | |
| 103 | : __t_(__u.base()), current(__u.base()) | |
| 96 | 104 | { } |
| 97 | 105 | |
| 98 | 106 | template <class _Up, class = __enable_if_t< |
| ... | ... | @@ -100,22 +108,22 @@ public: |
| 100 | 108 | is_convertible<_Up const&, _Iter>::value && |
| 101 | 109 | is_assignable<_Iter&, _Up const&>::value |
| 102 | 110 | > > |
| 103 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 111 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 104 | 112 | reverse_iterator& operator=(const reverse_iterator<_Up>& __u) { |
| 105 | __t = current = __u.base(); | |
| 113 | __t_ = current = __u.base(); | |
| 106 | 114 | return *this; |
| 107 | 115 | } |
| 108 | 116 | #else |
| 109 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 117 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 110 | 118 | reverse_iterator() : current() {} |
| 111 | 119 | |
| 112 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 120 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 113 | 121 | explicit reverse_iterator(_Iter __x) : current(__x) {} |
| 114 | 122 | |
| 115 | 123 | template <class _Up, class = __enable_if_t< |
| 116 | 124 | !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value |
| 117 | 125 | > > |
| 118 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 126 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 119 | 127 | reverse_iterator(const reverse_iterator<_Up>& __u) |
| 120 | 128 | : current(__u.base()) |
| 121 | 129 | { } |
| ... | ... | @@ -125,15 +133,15 @@ public: |
| 125 | 133 | is_convertible<_Up const&, _Iter>::value && |
| 126 | 134 | is_assignable<_Iter&, _Up const&>::value |
| 127 | 135 | > > |
| 128 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 136 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 129 | 137 | reverse_iterator& operator=(const reverse_iterator<_Up>& __u) { |
| 130 | 138 | current = __u.base(); |
| 131 | 139 | return *this; |
| 132 | 140 | } |
| 133 | 141 | #endif |
| 134 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 142 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 135 | 143 | _Iter base() const {return current;} |
| 136 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 144 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 137 | 145 | reference operator*() const {_Iter __tmp = current; return *--__tmp;} |
| 138 | 146 | |
| 139 | 147 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -148,36 +156,36 @@ public: |
| 148 | 156 | } |
| 149 | 157 | } |
| 150 | 158 | #else |
| 151 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 159 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 152 | 160 | pointer operator->() const { |
| 153 | 161 | return std::addressof(operator*()); |
| 154 | 162 | } |
| 155 | 163 | #endif // _LIBCPP_STD_VER > 17 |
| 156 | 164 | |
| 157 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 165 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 158 | 166 | reverse_iterator& operator++() {--current; return *this;} |
| 159 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 167 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 160 | 168 | reverse_iterator operator++(int) {reverse_iterator __tmp(*this); --current; return __tmp;} |
| 161 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 169 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 162 | 170 | reverse_iterator& operator--() {++current; return *this;} |
| 163 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 171 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 164 | 172 | reverse_iterator operator--(int) {reverse_iterator __tmp(*this); ++current; return __tmp;} |
| 165 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 173 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 166 | 174 | reverse_iterator operator+(difference_type __n) const {return reverse_iterator(current - __n);} |
| 167 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 175 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 168 | 176 | reverse_iterator& operator+=(difference_type __n) {current -= __n; return *this;} |
| 169 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 177 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 170 | 178 | reverse_iterator operator-(difference_type __n) const {return reverse_iterator(current + __n);} |
| 171 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 179 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 172 | 180 | reverse_iterator& operator-=(difference_type __n) {current += __n; return *this;} |
| 173 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 181 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 174 | 182 | reference operator[](difference_type __n) const {return *(*this + __n);} |
| 175 | 183 | |
| 176 | 184 | #if _LIBCPP_STD_VER > 17 |
| 177 | 185 | _LIBCPP_HIDE_FROM_ABI friend constexpr |
| 178 | 186 | iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i) |
| 179 | 187 | noexcept(is_nothrow_copy_constructible_v<_Iter> && |
| 180 | noexcept(ranges::iter_move(--declval<_Iter&>()))) { | |
| 188 | noexcept(ranges::iter_move(--std::declval<_Iter&>()))) { | |
| 181 | 189 | auto __tmp = __i.base(); |
| 182 | 190 | return ranges::iter_move(--__tmp); |
| 183 | 191 | } |
| ... | ... | @@ -187,7 +195,7 @@ public: |
| 187 | 195 | void iter_swap(const reverse_iterator& __x, const reverse_iterator<_Iter2>& __y) |
| 188 | 196 | noexcept(is_nothrow_copy_constructible_v<_Iter> && |
| 189 | 197 | is_nothrow_copy_constructible_v<_Iter2> && |
| 190 | noexcept(ranges::iter_swap(--declval<_Iter&>(), --declval<_Iter2&>()))) { | |
| 198 | noexcept(ranges::iter_swap(--std::declval<_Iter&>(), --std::declval<_Iter2&>()))) { | |
| 191 | 199 | auto __xtmp = __x.base(); |
| 192 | 200 | auto __ytmp = __y.base(); |
| 193 | 201 | ranges::iter_swap(--__xtmp, --__ytmp); |
| ... | ... | @@ -195,14 +203,8 @@ public: |
| 195 | 203 | #endif // _LIBCPP_STD_VER > 17 |
| 196 | 204 | }; |
| 197 | 205 | |
| 198 | template <class _Iter> | |
| 199 | struct __is_reverse_iterator : false_type {}; | |
| 200 | ||
| 201 | template <class _Iter> | |
| 202 | struct __is_reverse_iterator<reverse_iterator<_Iter> > : true_type {}; | |
| 203 | ||
| 204 | 206 | template <class _Iter1, class _Iter2> |
| 205 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 207 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 206 | 208 | bool |
| 207 | 209 | operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) |
| 208 | 210 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -215,7 +217,7 @@ operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& |
| 215 | 217 | } |
| 216 | 218 | |
| 217 | 219 | template <class _Iter1, class _Iter2> |
| 218 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 220 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 219 | 221 | bool |
| 220 | 222 | operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) |
| 221 | 223 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -228,7 +230,7 @@ operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& _ |
| 228 | 230 | } |
| 229 | 231 | |
| 230 | 232 | template <class _Iter1, class _Iter2> |
| 231 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 233 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 232 | 234 | bool |
| 233 | 235 | operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) |
| 234 | 236 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -241,7 +243,7 @@ operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& |
| 241 | 243 | } |
| 242 | 244 | |
| 243 | 245 | template <class _Iter1, class _Iter2> |
| 244 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 246 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 245 | 247 | bool |
| 246 | 248 | operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) |
| 247 | 249 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -254,7 +256,7 @@ operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& _ |
| 254 | 256 | } |
| 255 | 257 | |
| 256 | 258 | template <class _Iter1, class _Iter2> |
| 257 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 259 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 258 | 260 | bool |
| 259 | 261 | operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) |
| 260 | 262 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -267,7 +269,7 @@ operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& |
| 267 | 269 | } |
| 268 | 270 | |
| 269 | 271 | template <class _Iter1, class _Iter2> |
| 270 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 272 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 271 | 273 | bool |
| 272 | 274 | operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) |
| 273 | 275 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -291,7 +293,7 @@ operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& |
| 291 | 293 | |
| 292 | 294 | #ifndef _LIBCPP_CXX03_LANG |
| 293 | 295 | template <class _Iter1, class _Iter2> |
| 294 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 296 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 295 | 297 | auto |
| 296 | 298 | operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) |
| 297 | 299 | -> decltype(__y.base() - __x.base()) |
| ... | ... | @@ -309,7 +311,7 @@ operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& _ |
| 309 | 311 | #endif |
| 310 | 312 | |
| 311 | 313 | template <class _Iter> |
| 312 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 314 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 313 | 315 | reverse_iterator<_Iter> |
| 314 | 316 | operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x) |
| 315 | 317 | { |
| ... | ... | @@ -324,7 +326,7 @@ inline constexpr bool disable_sized_sentinel_for<reverse_iterator<_Iter1>, rever |
| 324 | 326 | |
| 325 | 327 | #if _LIBCPP_STD_VER > 11 |
| 326 | 328 | template <class _Iter> |
| 327 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 329 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 328 | 330 | reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) |
| 329 | 331 | { |
| 330 | 332 | return reverse_iterator<_Iter>(__i); |
| ... | ... | @@ -394,7 +396,7 @@ public: |
| 394 | 396 | _LIBCPP_HIDE_FROM_ABI friend constexpr |
| 395 | 397 | iter_rvalue_reference_t<_Iter> iter_move(const __unconstrained_reverse_iterator& __i) |
| 396 | 398 | noexcept(is_nothrow_copy_constructible_v<_Iter> && |
| 397 | noexcept(ranges::iter_move(--declval<_Iter&>()))) { | |
| 399 | noexcept(ranges::iter_move(--std::declval<_Iter&>()))) { | |
| 398 | 400 | auto __tmp = __i.base(); |
| 399 | 401 | return ranges::iter_move(--__tmp); |
| 400 | 402 | } |
| ... | ... | @@ -478,9 +480,6 @@ public: |
| 478 | 480 | } |
| 479 | 481 | }; |
| 480 | 482 | |
| 481 | template <class _Iter> | |
| 482 | struct __is_reverse_iterator<__unconstrained_reverse_iterator<_Iter>> : true_type {}; | |
| 483 | ||
| 484 | 483 | #endif // _LIBCPP_STD_VER <= 17 |
| 485 | 484 | |
| 486 | 485 | template <template <class> class _RevIter1, template <class> class _RevIter2, class _Iter> |
| ... | ... | @@ -499,7 +498,7 @@ struct __unwrap_reverse_iter_impl { |
| 499 | 498 | } |
| 500 | 499 | }; |
| 501 | 500 | |
| 502 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 501 | #if _LIBCPP_STD_VER > 17 | |
| 503 | 502 | template <ranges::bidirectional_range _Range> |
| 504 | 503 | _LIBCPP_HIDE_FROM_ABI constexpr ranges:: |
| 505 | 504 | subrange<reverse_iterator<ranges::iterator_t<_Range>>, reverse_iterator<ranges::iterator_t<_Range>>> |
lib/libcxx/include/__iterator/segmented_iterator.h created+79| ... | ... | @@ -0,0 +1,79 @@ |
| 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___SEGMENTED_ITERATOR_H | |
| 10 | #define _LIBCPP___SEGMENTED_ITERATOR_H | |
| 11 | ||
| 12 | // Segmented iterators are iterators over (not necessarily contiguous) sub-ranges. | |
| 13 | // | |
| 14 | // For example, std::deque stores its data into multiple blocks of contiguous memory, | |
| 15 | // which are not stored contiguously themselves. The concept of segmented iterators | |
| 16 | // allows algorithms to operate over these multi-level iterators natively, opening the | |
| 17 | // door to various optimizations. See http://lafstern.org/matt/segmented.pdf for details. | |
| 18 | // | |
| 19 | // If __segmented_iterator_traits can be instantiated, the following functions and associated types must be provided: | |
| 20 | // - Traits::__local_iterator | |
| 21 | // The type of iterators used to iterate inside a segment. | |
| 22 | // | |
| 23 | // - Traits::__segment_iterator | |
| 24 | // The type of iterators used to iterate over segments. | |
| 25 | // Segment iterators can be forward iterators or bidirectional iterators, depending on the | |
| 26 | // underlying data structure. | |
| 27 | // | |
| 28 | // - static __segment_iterator Traits::__segment(It __it) | |
| 29 | // Returns an iterator to the segment that the provided iterator is in. | |
| 30 | // | |
| 31 | // - static __local_iterator Traits::__local(It __it) | |
| 32 | // Returns the local iterator pointing to the element that the provided iterator points to. | |
| 33 | // | |
| 34 | // - static __local_iterator Traits::__begin(__segment_iterator __it) | |
| 35 | // Returns the local iterator to the beginning of the segment that the provided iterator is pointing into. | |
| 36 | // | |
| 37 | // - static __local_iterator Traits::__end(__segment_iterator __it) | |
| 38 | // Returns the one-past-the-end local iterator to the segment that the provided iterator is pointing into. | |
| 39 | // | |
| 40 | // - static It Traits::__compose(__segment_iterator, __local_iterator) | |
| 41 | // Returns the iterator composed of the segment iterator and local iterator. | |
| 42 | ||
| 43 | #include <__config> | |
| 44 | #include <__type_traits/integral_constant.h> | |
| 45 | #include <cstddef> | |
| 46 | ||
| 47 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 48 | # pragma GCC system_header | |
| 49 | #endif | |
| 50 | ||
| 51 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 52 | ||
| 53 | template <class _Iterator> | |
| 54 | struct __segmented_iterator_traits; | |
| 55 | /* exposition-only: | |
| 56 | { | |
| 57 | using __segment_iterator = ...; | |
| 58 | using __local_iterator = ...; | |
| 59 | ||
| 60 | static __segment_iterator __segment(_Iterator); | |
| 61 | static __local_iterator __local(_Iterator); | |
| 62 | static __local_iterator __begin(__segment_iterator); | |
| 63 | static __local_iterator __end(__segment_iterator); | |
| 64 | static _Iterator __compose(__segment_iterator, __local_iterator); | |
| 65 | }; | |
| 66 | */ | |
| 67 | ||
| 68 | template <class _Tp, size_t = 0> | |
| 69 | struct __has_specialization : false_type {}; | |
| 70 | ||
| 71 | template <class _Tp> | |
| 72 | struct __has_specialization<_Tp, sizeof(_Tp) * 0> : true_type {}; | |
| 73 | ||
| 74 | template <class _Iterator> | |
| 75 | using __is_segmented_iterator = __has_specialization<__segmented_iterator_traits<_Iterator> >; | |
| 76 | ||
| 77 | _LIBCPP_END_NAMESPACE_STD | |
| 78 | ||
| 79 | #endif // _LIBCPP___SEGMENTED_ITERATOR_H |
lib/libcxx/include/__iterator/size.h+2-1| ... | ... | @@ -11,8 +11,9 @@ |
| 11 | 11 | #define _LIBCPP___ITERATOR_SIZE_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <__type_traits/common_type.h> | |
| 15 | #include <__type_traits/make_signed.h> | |
| 14 | 16 | #include <cstddef> |
| 15 | #include <type_traits> | |
| 16 | 17 | |
| 17 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 19 | # pragma GCC system_header |
lib/libcxx/include/__iterator/wrap_iter.h+36-35| ... | ... | @@ -15,7 +15,8 @@ |
| 15 | 15 | #include <__iterator/iterator_traits.h> |
| 16 | 16 | #include <__memory/addressof.h> |
| 17 | 17 | #include <__memory/pointer_traits.h> |
| 18 | #include <type_traits> | |
| 18 | #include <__type_traits/enable_if.h> | |
| 19 | #include <__type_traits/is_convertible.h> | |
| 19 | 20 | |
| 20 | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 21 | 22 | # pragma GCC system_header |
| ... | ... | @@ -38,17 +39,17 @@ public: |
| 38 | 39 | #endif |
| 39 | 40 | |
| 40 | 41 | private: |
| 41 | iterator_type __i; | |
| 42 | iterator_type __i_; | |
| 42 | 43 | public: |
| 43 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter() _NOEXCEPT | |
| 44 | : __i() | |
| 44 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter() _NOEXCEPT | |
| 45 | : __i_() | |
| 45 | 46 | { |
| 46 | 47 | _VSTD::__debug_db_insert_i(this); |
| 47 | 48 | } |
| 48 | template <class _Up> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 49 | template <class _Up> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 49 | 50 | __wrap_iter(const __wrap_iter<_Up>& __u, |
| 50 | 51 | typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = nullptr) _NOEXCEPT |
| 51 | : __i(__u.base()) | |
| 52 | : __i_(__u.base()) | |
| 52 | 53 | { |
| 53 | 54 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 54 | 55 | if (!__libcpp_is_constant_evaluated()) |
| ... | ... | @@ -56,87 +57,87 @@ public: |
| 56 | 57 | #endif |
| 57 | 58 | } |
| 58 | 59 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 59 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 60 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 60 | 61 | __wrap_iter(const __wrap_iter& __x) |
| 61 | : __i(__x.base()) | |
| 62 | : __i_(__x.base()) | |
| 62 | 63 | { |
| 63 | 64 | if (!__libcpp_is_constant_evaluated()) |
| 64 | 65 | __get_db()->__iterator_copy(this, _VSTD::addressof(__x)); |
| 65 | 66 | } |
| 66 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 67 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 67 | 68 | __wrap_iter& operator=(const __wrap_iter& __x) |
| 68 | 69 | { |
| 69 | 70 | if (this != _VSTD::addressof(__x)) |
| 70 | 71 | { |
| 71 | 72 | if (!__libcpp_is_constant_evaluated()) |
| 72 | 73 | __get_db()->__iterator_copy(this, _VSTD::addressof(__x)); |
| 73 | __i = __x.__i; | |
| 74 | __i_ = __x.__i_; | |
| 74 | 75 | } |
| 75 | 76 | return *this; |
| 76 | 77 | } |
| 77 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 78 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 78 | 79 | ~__wrap_iter() |
| 79 | 80 | { |
| 80 | 81 | if (!__libcpp_is_constant_evaluated()) |
| 81 | 82 | __get_db()->__erase_i(this); |
| 82 | 83 | } |
| 83 | 84 | #endif |
| 84 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 reference operator*() const _NOEXCEPT | |
| 85 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT | |
| 85 | 86 | { |
| 86 | 87 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), |
| 87 | 88 | "Attempted to dereference a non-dereferenceable iterator"); |
| 88 | return *__i; | |
| 89 | return *__i_; | |
| 89 | 90 | } |
| 90 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 pointer operator->() const _NOEXCEPT | |
| 91 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pointer operator->() const _NOEXCEPT | |
| 91 | 92 | { |
| 92 | 93 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), |
| 93 | 94 | "Attempted to dereference a non-dereferenceable iterator"); |
| 94 | return _VSTD::__to_address(__i); | |
| 95 | return _VSTD::__to_address(__i_); | |
| 95 | 96 | } |
| 96 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter& operator++() _NOEXCEPT | |
| 97 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator++() _NOEXCEPT | |
| 97 | 98 | { |
| 98 | 99 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), |
| 99 | 100 | "Attempted to increment a non-incrementable iterator"); |
| 100 | ++__i; | |
| 101 | ++__i_; | |
| 101 | 102 | return *this; |
| 102 | 103 | } |
| 103 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter operator++(int) _NOEXCEPT | |
| 104 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator++(int) _NOEXCEPT | |
| 104 | 105 | {__wrap_iter __tmp(*this); ++(*this); return __tmp;} |
| 105 | 106 | |
| 106 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter& operator--() _NOEXCEPT | |
| 107 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator--() _NOEXCEPT | |
| 107 | 108 | { |
| 108 | 109 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__decrementable(this), |
| 109 | 110 | "Attempted to decrement a non-decrementable iterator"); |
| 110 | --__i; | |
| 111 | --__i_; | |
| 111 | 112 | return *this; |
| 112 | 113 | } |
| 113 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter operator--(int) _NOEXCEPT | |
| 114 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator--(int) _NOEXCEPT | |
| 114 | 115 | {__wrap_iter __tmp(*this); --(*this); return __tmp;} |
| 115 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter operator+ (difference_type __n) const _NOEXCEPT | |
| 116 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator+ (difference_type __n) const _NOEXCEPT | |
| 116 | 117 | {__wrap_iter __w(*this); __w += __n; return __w;} |
| 117 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter& operator+=(difference_type __n) _NOEXCEPT | |
| 118 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator+=(difference_type __n) _NOEXCEPT | |
| 118 | 119 | { |
| 119 | 120 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__addable(this, __n), |
| 120 | 121 | "Attempted to add/subtract an iterator outside its valid range"); |
| 121 | __i += __n; | |
| 122 | __i_ += __n; | |
| 122 | 123 | return *this; |
| 123 | 124 | } |
| 124 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter operator- (difference_type __n) const _NOEXCEPT | |
| 125 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator- (difference_type __n) const _NOEXCEPT | |
| 125 | 126 | {return *this + (-__n);} |
| 126 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter& operator-=(difference_type __n) _NOEXCEPT | |
| 127 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator-=(difference_type __n) _NOEXCEPT | |
| 127 | 128 | {*this += -__n; return *this;} |
| 128 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 reference operator[](difference_type __n) const _NOEXCEPT | |
| 129 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT | |
| 129 | 130 | { |
| 130 | 131 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__subscriptable(this, __n), |
| 131 | 132 | "Attempted to subscript an iterator outside its valid range"); |
| 132 | return __i[__n]; | |
| 133 | return __i_[__n]; | |
| 133 | 134 | } |
| 134 | 135 | |
| 135 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 iterator_type base() const _NOEXCEPT {return __i;} | |
| 136 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 iterator_type base() const _NOEXCEPT {return __i_;} | |
| 136 | 137 | |
| 137 | 138 | private: |
| 138 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 139 | explicit __wrap_iter(const void* __p, iterator_type __x) _NOEXCEPT : __i(__x) | |
| 139 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 140 | explicit __wrap_iter(const void* __p, iterator_type __x) _NOEXCEPT : __i_(__x) | |
| 140 | 141 | { |
| 141 | 142 | (void)__p; |
| 142 | 143 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| ... | ... | @@ -166,7 +167,7 @@ bool operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) |
| 166 | 167 | } |
| 167 | 168 | |
| 168 | 169 | template <class _Iter1> |
| 169 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 170 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 170 | 171 | bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT |
| 171 | 172 | { |
| 172 | 173 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__less_than_comparable(_VSTD::addressof(__x), _VSTD::addressof(__y)), |
| ... | ... | @@ -175,7 +176,7 @@ bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _ |
| 175 | 176 | } |
| 176 | 177 | |
| 177 | 178 | template <class _Iter1, class _Iter2> |
| 178 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 179 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 179 | 180 | bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT |
| 180 | 181 | { |
| 181 | 182 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), |
| ... | ... | @@ -240,7 +241,7 @@ bool operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) |
| 240 | 241 | } |
| 241 | 242 | |
| 242 | 243 | template <class _Iter1, class _Iter2> |
| 243 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 244 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 244 | 245 | #ifndef _LIBCPP_CXX03_LANG |
| 245 | 246 | auto operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT |
| 246 | 247 | -> decltype(__x.base() - __y.base()) |
| ... | ... | @@ -255,7 +256,7 @@ operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC |
| 255 | 256 | } |
| 256 | 257 | |
| 257 | 258 | template <class _Iter1> |
| 258 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 259 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 259 | 260 | __wrap_iter<_Iter1> operator+(typename __wrap_iter<_Iter1>::difference_type __n, __wrap_iter<_Iter1> __x) _NOEXCEPT |
| 260 | 261 | { |
| 261 | 262 | __x += __n; |
lib/libcxx/include/__locale+76-72| ... | ... | @@ -15,13 +15,15 @@ |
| 15 | 15 | #include <cctype> |
| 16 | 16 | #include <cstdint> |
| 17 | 17 | #include <locale.h> |
| 18 | #include <memory> | |
| 19 | 18 | #include <mutex> |
| 20 | 19 | #include <string> |
| 21 | 20 | |
| 21 | // Some platforms require more includes than others. Keep the includes on all plaforms for now. | |
| 22 | #include <cstddef> | |
| 23 | #include <cstring> | |
| 24 | ||
| 22 | 25 | #if defined(_LIBCPP_MSVCRT_LIKE) |
| 23 | 26 | # include <__support/win32/locale_win32.h> |
| 24 | # include <cstring> | |
| 25 | 27 | #elif defined(_AIX) || defined(__MVS__) |
| 26 | 28 | # include <__support/ibm/xlocale.h> |
| 27 | 29 | #elif defined(__ANDROID__) |
| ... | ... | @@ -33,7 +35,7 @@ |
| 33 | 35 | # include <__support/newlib/xlocale.h> |
| 34 | 36 | #elif defined(__OpenBSD__) |
| 35 | 37 | # include <__support/openbsd/xlocale.h> |
| 36 | #elif (defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)) | |
| 38 | #elif (defined(__APPLE__) || defined(__FreeBSD__)) | |
| 37 | 39 | # include <xlocale.h> |
| 38 | 40 | #elif defined(__Fuchsia__) |
| 39 | 41 | # include <__support/fuchsia/xlocale.h> |
| ... | ... | @@ -191,12 +193,12 @@ protected: |
| 191 | 193 | explicit facet(size_t __refs = 0) |
| 192 | 194 | : __shared_count(static_cast<long>(__refs)-1) {} |
| 193 | 195 | |
| 194 | virtual ~facet(); | |
| 196 | ~facet() override; | |
| 195 | 197 | |
| 196 | 198 | // facet(const facet&) = delete; // effectively done in __shared_count |
| 197 | 199 | // void operator=(const facet&) = delete; |
| 198 | 200 | private: |
| 199 | virtual void __on_zero_shared() _NOEXCEPT; | |
| 201 | void __on_zero_shared() _NOEXCEPT override; | |
| 200 | 202 | }; |
| 201 | 203 | |
| 202 | 204 | class _LIBCPP_TYPE_VIS locale::id |
| ... | ... | @@ -291,7 +293,7 @@ public: |
| 291 | 293 | static locale::id id; |
| 292 | 294 | |
| 293 | 295 | protected: |
| 294 | ~collate(); | |
| 296 | ~collate() override; | |
| 295 | 297 | virtual int do_compare(const char_type* __lo1, const char_type* __hi1, |
| 296 | 298 | const char_type* __lo2, const char_type* __hi2) const; |
| 297 | 299 | virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const |
| ... | ... | @@ -350,7 +352,7 @@ template <> |
| 350 | 352 | class _LIBCPP_TYPE_VIS collate_byname<char> |
| 351 | 353 | : public collate<char> |
| 352 | 354 | { |
| 353 | locale_t __l; | |
| 355 | locale_t __l_; | |
| 354 | 356 | public: |
| 355 | 357 | typedef char char_type; |
| 356 | 358 | typedef basic_string<char_type> string_type; |
| ... | ... | @@ -359,10 +361,10 @@ public: |
| 359 | 361 | explicit collate_byname(const string& __n, size_t __refs = 0); |
| 360 | 362 | |
| 361 | 363 | protected: |
| 362 | ~collate_byname(); | |
| 363 | virtual int do_compare(const char_type* __lo1, const char_type* __hi1, | |
| 364 | const char_type* __lo2, const char_type* __hi2) const; | |
| 365 | virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; | |
| 364 | ~collate_byname() override; | |
| 365 | int do_compare(const char_type* __lo1, const char_type* __hi1, | |
| 366 | const char_type* __lo2, const char_type* __hi2) const override; | |
| 367 | string_type do_transform(const char_type* __lo, const char_type* __hi) const override; | |
| 366 | 368 | }; |
| 367 | 369 | |
| 368 | 370 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| ... | ... | @@ -370,7 +372,7 @@ template <> |
| 370 | 372 | class _LIBCPP_TYPE_VIS collate_byname<wchar_t> |
| 371 | 373 | : public collate<wchar_t> |
| 372 | 374 | { |
| 373 | locale_t __l; | |
| 375 | locale_t __l_; | |
| 374 | 376 | public: |
| 375 | 377 | typedef wchar_t char_type; |
| 376 | 378 | typedef basic_string<char_type> string_type; |
| ... | ... | @@ -379,11 +381,11 @@ public: |
| 379 | 381 | explicit collate_byname(const string& __n, size_t __refs = 0); |
| 380 | 382 | |
| 381 | 383 | protected: |
| 382 | ~collate_byname(); | |
| 384 | ~collate_byname() override; | |
| 383 | 385 | |
| 384 | virtual int do_compare(const char_type* __lo1, const char_type* __hi1, | |
| 385 | const char_type* __lo2, const char_type* __hi2) const; | |
| 386 | virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; | |
| 386 | int do_compare(const char_type* __lo1, const char_type* __hi1, | |
| 387 | const char_type* __lo2, const char_type* __hi2) const override; | |
| 388 | string_type do_transform(const char_type* __lo, const char_type* __hi) const override; | |
| 387 | 389 | }; |
| 388 | 390 | #endif |
| 389 | 391 | |
| ... | ... | @@ -453,10 +455,10 @@ public: |
| 453 | 455 | static const mask __regex_word = 0x4000; // 0x8000 and 0x0100 and 0x00ff are used |
| 454 | 456 | # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT |
| 455 | 457 | # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA |
| 456 | #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(__DragonFly__) | |
| 458 | #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) | |
| 457 | 459 | # ifdef __APPLE__ |
| 458 | 460 | typedef __uint32_t mask; |
| 459 | # elif defined(__FreeBSD__) || defined(__DragonFly__) | |
| 461 | # elif defined(__FreeBSD__) | |
| 460 | 462 | typedef unsigned long mask; |
| 461 | 463 | # elif defined(__EMSCRIPTEN__) || defined(__NetBSD__) |
| 462 | 464 | typedef unsigned short mask; |
| ... | ... | @@ -510,7 +512,8 @@ public: |
| 510 | 512 | static const mask punct = _P; |
| 511 | 513 | static const mask xdigit = _X | _N; |
| 512 | 514 | static const mask blank = _B; |
| 513 | static const mask __regex_word = 0x80; | |
| 515 | // mask is already fully saturated, use a different type in regex_type_traits. | |
| 516 | static const unsigned short __regex_word = 0x100; | |
| 514 | 517 | # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT |
| 515 | 518 | # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA |
| 516 | 519 | # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT |
| ... | ... | @@ -549,7 +552,8 @@ public: |
| 549 | 552 | |
| 550 | 553 | _LIBCPP_INLINE_VISIBILITY ctype_base() {} |
| 551 | 554 | |
| 552 | static_assert((__regex_word & ~(space | print | cntrl | upper | lower | alpha | digit | punct | xdigit | blank)) == __regex_word, | |
| 555 | static_assert((__regex_word & ~(std::make_unsigned<mask>::type)(space | print | cntrl | upper | lower | alpha | | |
| 556 | digit | punct | xdigit | blank)) == __regex_word, | |
| 553 | 557 | "__regex_word can't overlap other bits"); |
| 554 | 558 | }; |
| 555 | 559 | |
| ... | ... | @@ -643,7 +647,7 @@ public: |
| 643 | 647 | static locale::id id; |
| 644 | 648 | |
| 645 | 649 | protected: |
| 646 | ~ctype(); | |
| 650 | ~ctype() override; | |
| 647 | 651 | virtual bool do_is(mask __m, char_type __c) const; |
| 648 | 652 | virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; |
| 649 | 653 | virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; |
| ... | ... | @@ -697,7 +701,7 @@ public: |
| 697 | 701 | const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const |
| 698 | 702 | { |
| 699 | 703 | for (; __low != __high; ++__low) |
| 700 | if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))) | |
| 704 | if (!isascii(*__low) || !(__tab_[static_cast<int>(*__low)] & __m)) | |
| 701 | 705 | break; |
| 702 | 706 | return __low; |
| 703 | 707 | } |
| ... | ... | @@ -773,7 +777,7 @@ public: |
| 773 | 777 | #endif |
| 774 | 778 | |
| 775 | 779 | protected: |
| 776 | ~ctype(); | |
| 780 | ~ctype() override; | |
| 777 | 781 | virtual char_type do_toupper(char_type __c) const; |
| 778 | 782 | virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; |
| 779 | 783 | virtual char_type do_tolower(char_type __c) const; |
| ... | ... | @@ -792,18 +796,18 @@ template <> |
| 792 | 796 | class _LIBCPP_TYPE_VIS ctype_byname<char> |
| 793 | 797 | : public ctype<char> |
| 794 | 798 | { |
| 795 | locale_t __l; | |
| 799 | locale_t __l_; | |
| 796 | 800 | |
| 797 | 801 | public: |
| 798 | 802 | explicit ctype_byname(const char*, size_t = 0); |
| 799 | 803 | explicit ctype_byname(const string&, size_t = 0); |
| 800 | 804 | |
| 801 | 805 | protected: |
| 802 | ~ctype_byname(); | |
| 803 | virtual char_type do_toupper(char_type) const; | |
| 804 | virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; | |
| 805 | virtual char_type do_tolower(char_type) const; | |
| 806 | virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; | |
| 806 | ~ctype_byname() override; | |
| 807 | char_type do_toupper(char_type) const override; | |
| 808 | const char_type* do_toupper(char_type* __low, const char_type* __high) const override; | |
| 809 | char_type do_tolower(char_type) const override; | |
| 810 | const char_type* do_tolower(char_type* __low, const char_type* __high) const override; | |
| 807 | 811 | }; |
| 808 | 812 | |
| 809 | 813 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| ... | ... | @@ -811,26 +815,26 @@ template <> |
| 811 | 815 | class _LIBCPP_TYPE_VIS ctype_byname<wchar_t> |
| 812 | 816 | : public ctype<wchar_t> |
| 813 | 817 | { |
| 814 | locale_t __l; | |
| 818 | locale_t __l_; | |
| 815 | 819 | |
| 816 | 820 | public: |
| 817 | 821 | explicit ctype_byname(const char*, size_t = 0); |
| 818 | 822 | explicit ctype_byname(const string&, size_t = 0); |
| 819 | 823 | |
| 820 | 824 | protected: |
| 821 | ~ctype_byname(); | |
| 822 | virtual bool do_is(mask __m, char_type __c) const; | |
| 823 | virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; | |
| 824 | virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; | |
| 825 | virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; | |
| 826 | virtual char_type do_toupper(char_type) const; | |
| 827 | virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; | |
| 828 | virtual char_type do_tolower(char_type) const; | |
| 829 | virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; | |
| 830 | virtual char_type do_widen(char) const; | |
| 831 | virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; | |
| 832 | virtual char do_narrow(char_type, char __dfault) const; | |
| 833 | virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; | |
| 825 | ~ctype_byname() override; | |
| 826 | bool do_is(mask __m, char_type __c) const override; | |
| 827 | const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const override; | |
| 828 | const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const override; | |
| 829 | const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const override; | |
| 830 | char_type do_toupper(char_type) const override; | |
| 831 | const char_type* do_toupper(char_type* __low, const char_type* __high) const override; | |
| 832 | char_type do_tolower(char_type) const override; | |
| 833 | const char_type* do_tolower(char_type* __low, const char_type* __high) const override; | |
| 834 | char_type do_widen(char) const override; | |
| 835 | const char* do_widen(const char* __low, const char* __high, char_type* __dest) const override; | |
| 836 | char do_narrow(char_type, char __dfault) const override; | |
| 837 | const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const override; | |
| 834 | 838 | }; |
| 835 | 839 | #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 836 | 840 | |
| ... | ... | @@ -839,7 +843,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 839 | 843 | bool |
| 840 | 844 | isspace(_CharT __c, const locale& __loc) |
| 841 | 845 | { |
| 842 | return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); | |
| 846 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); | |
| 843 | 847 | } |
| 844 | 848 | |
| 845 | 849 | template <class _CharT> |
| ... | ... | @@ -847,7 +851,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 847 | 851 | bool |
| 848 | 852 | isprint(_CharT __c, const locale& __loc) |
| 849 | 853 | { |
| 850 | return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); | |
| 854 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); | |
| 851 | 855 | } |
| 852 | 856 | |
| 853 | 857 | template <class _CharT> |
| ... | ... | @@ -855,7 +859,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 855 | 859 | bool |
| 856 | 860 | iscntrl(_CharT __c, const locale& __loc) |
| 857 | 861 | { |
| 858 | return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); | |
| 862 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); | |
| 859 | 863 | } |
| 860 | 864 | |
| 861 | 865 | template <class _CharT> |
| ... | ... | @@ -863,7 +867,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 863 | 867 | bool |
| 864 | 868 | isupper(_CharT __c, const locale& __loc) |
| 865 | 869 | { |
| 866 | return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); | |
| 870 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); | |
| 867 | 871 | } |
| 868 | 872 | |
| 869 | 873 | template <class _CharT> |
| ... | ... | @@ -871,7 +875,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 871 | 875 | bool |
| 872 | 876 | islower(_CharT __c, const locale& __loc) |
| 873 | 877 | { |
| 874 | return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); | |
| 878 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); | |
| 875 | 879 | } |
| 876 | 880 | |
| 877 | 881 | template <class _CharT> |
| ... | ... | @@ -879,7 +883,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 879 | 883 | bool |
| 880 | 884 | isalpha(_CharT __c, const locale& __loc) |
| 881 | 885 | { |
| 882 | return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); | |
| 886 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); | |
| 883 | 887 | } |
| 884 | 888 | |
| 885 | 889 | template <class _CharT> |
| ... | ... | @@ -887,7 +891,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 887 | 891 | bool |
| 888 | 892 | isdigit(_CharT __c, const locale& __loc) |
| 889 | 893 | { |
| 890 | return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); | |
| 894 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); | |
| 891 | 895 | } |
| 892 | 896 | |
| 893 | 897 | template <class _CharT> |
| ... | ... | @@ -895,7 +899,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 895 | 899 | bool |
| 896 | 900 | ispunct(_CharT __c, const locale& __loc) |
| 897 | 901 | { |
| 898 | return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); | |
| 902 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); | |
| 899 | 903 | } |
| 900 | 904 | |
| 901 | 905 | template <class _CharT> |
| ... | ... | @@ -903,7 +907,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 903 | 907 | bool |
| 904 | 908 | isxdigit(_CharT __c, const locale& __loc) |
| 905 | 909 | { |
| 906 | return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); | |
| 910 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); | |
| 907 | 911 | } |
| 908 | 912 | |
| 909 | 913 | template <class _CharT> |
| ... | ... | @@ -911,7 +915,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 911 | 915 | bool |
| 912 | 916 | isalnum(_CharT __c, const locale& __loc) |
| 913 | 917 | { |
| 914 | return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); | |
| 918 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); | |
| 915 | 919 | } |
| 916 | 920 | |
| 917 | 921 | template <class _CharT> |
| ... | ... | @@ -919,7 +923,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 919 | 923 | bool |
| 920 | 924 | isgraph(_CharT __c, const locale& __loc) |
| 921 | 925 | { |
| 922 | return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); | |
| 926 | return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); | |
| 923 | 927 | } |
| 924 | 928 | |
| 925 | 929 | template <class _CharT> |
| ... | ... | @@ -927,7 +931,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 927 | 931 | _CharT |
| 928 | 932 | toupper(_CharT __c, const locale& __loc) |
| 929 | 933 | { |
| 930 | return use_facet<ctype<_CharT> >(__loc).toupper(__c); | |
| 934 | return std::use_facet<ctype<_CharT> >(__loc).toupper(__c); | |
| 931 | 935 | } |
| 932 | 936 | |
| 933 | 937 | template <class _CharT> |
| ... | ... | @@ -935,7 +939,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 935 | 939 | _CharT |
| 936 | 940 | tolower(_CharT __c, const locale& __loc) |
| 937 | 941 | { |
| 938 | return use_facet<ctype<_CharT> >(__loc).tolower(__c); | |
| 942 | return std::use_facet<ctype<_CharT> >(__loc).tolower(__c); | |
| 939 | 943 | } |
| 940 | 944 | |
| 941 | 945 | // codecvt_base |
| ... | ... | @@ -1021,7 +1025,7 @@ protected: |
| 1021 | 1025 | explicit codecvt(const char*, size_t __refs = 0) |
| 1022 | 1026 | : locale::facet(__refs) {} |
| 1023 | 1027 | |
| 1024 | ~codecvt(); | |
| 1028 | ~codecvt() override; | |
| 1025 | 1029 | |
| 1026 | 1030 | virtual result do_out(state_type& __st, |
| 1027 | 1031 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, |
| ... | ... | @@ -1045,7 +1049,7 @@ class _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t> |
| 1045 | 1049 | : public locale::facet, |
| 1046 | 1050 | public codecvt_base |
| 1047 | 1051 | { |
| 1048 | locale_t __l; | |
| 1052 | locale_t __l_; | |
| 1049 | 1053 | public: |
| 1050 | 1054 | typedef wchar_t intern_type; |
| 1051 | 1055 | typedef char extern_type; |
| ... | ... | @@ -1105,7 +1109,7 @@ public: |
| 1105 | 1109 | protected: |
| 1106 | 1110 | explicit codecvt(const char*, size_t __refs = 0); |
| 1107 | 1111 | |
| 1108 | ~codecvt(); | |
| 1112 | ~codecvt() override; | |
| 1109 | 1113 | |
| 1110 | 1114 | virtual result do_out(state_type& __st, |
| 1111 | 1115 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, |
| ... | ... | @@ -1192,7 +1196,7 @@ protected: |
| 1192 | 1196 | explicit codecvt(const char*, size_t __refs = 0) |
| 1193 | 1197 | : locale::facet(__refs) {} |
| 1194 | 1198 | |
| 1195 | ~codecvt(); | |
| 1199 | ~codecvt() override; | |
| 1196 | 1200 | |
| 1197 | 1201 | virtual result do_out(state_type& __st, |
| 1198 | 1202 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, |
| ... | ... | @@ -1280,7 +1284,7 @@ protected: |
| 1280 | 1284 | explicit codecvt(const char*, size_t __refs = 0) |
| 1281 | 1285 | : locale::facet(__refs) {} |
| 1282 | 1286 | |
| 1283 | ~codecvt(); | |
| 1287 | ~codecvt() override; | |
| 1284 | 1288 | |
| 1285 | 1289 | virtual result do_out(state_type& __st, |
| 1286 | 1290 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, |
| ... | ... | @@ -1368,7 +1372,7 @@ protected: |
| 1368 | 1372 | explicit codecvt(const char*, size_t __refs = 0) |
| 1369 | 1373 | : locale::facet(__refs) {} |
| 1370 | 1374 | |
| 1371 | ~codecvt(); | |
| 1375 | ~codecvt() override; | |
| 1372 | 1376 | |
| 1373 | 1377 | virtual result do_out(state_type& __st, |
| 1374 | 1378 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, |
| ... | ... | @@ -1456,7 +1460,7 @@ protected: |
| 1456 | 1460 | explicit codecvt(const char*, size_t __refs = 0) |
| 1457 | 1461 | : locale::facet(__refs) {} |
| 1458 | 1462 | |
| 1459 | ~codecvt(); | |
| 1463 | ~codecvt() override; | |
| 1460 | 1464 | |
| 1461 | 1465 | virtual result do_out(state_type& __st, |
| 1462 | 1466 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, |
| ... | ... | @@ -1488,7 +1492,7 @@ public: |
| 1488 | 1492 | explicit codecvt_byname(const string& __nm, size_t __refs = 0) |
| 1489 | 1493 | : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {} |
| 1490 | 1494 | protected: |
| 1491 | ~codecvt_byname(); | |
| 1495 | ~codecvt_byname() override; | |
| 1492 | 1496 | }; |
| 1493 | 1497 | |
| 1494 | 1498 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| ... | ... | @@ -1540,7 +1544,7 @@ struct _LIBCPP_TYPE_VIS __narrow_to_utf8<16> |
| 1540 | 1544 | __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} |
| 1541 | 1545 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 1542 | 1546 | |
| 1543 | ~__narrow_to_utf8(); | |
| 1547 | ~__narrow_to_utf8() override; | |
| 1544 | 1548 | |
| 1545 | 1549 | template <class _OutputIterator, class _CharT> |
| 1546 | 1550 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1576,7 +1580,7 @@ struct _LIBCPP_TYPE_VIS __narrow_to_utf8<32> |
| 1576 | 1580 | __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} |
| 1577 | 1581 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 1578 | 1582 | |
| 1579 | ~__narrow_to_utf8(); | |
| 1583 | ~__narrow_to_utf8() override; | |
| 1580 | 1584 | |
| 1581 | 1585 | template <class _OutputIterator, class _CharT> |
| 1582 | 1586 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1634,7 +1638,7 @@ struct _LIBCPP_TYPE_VIS __widen_from_utf8<16> |
| 1634 | 1638 | __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} |
| 1635 | 1639 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 1636 | 1640 | |
| 1637 | ~__widen_from_utf8(); | |
| 1641 | ~__widen_from_utf8() override; | |
| 1638 | 1642 | |
| 1639 | 1643 | template <class _OutputIterator> |
| 1640 | 1644 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1670,7 +1674,7 @@ struct _LIBCPP_TYPE_VIS __widen_from_utf8<32> |
| 1670 | 1674 | __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} |
| 1671 | 1675 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 1672 | 1676 | |
| 1673 | ~__widen_from_utf8(); | |
| 1677 | ~__widen_from_utf8() override; | |
| 1674 | 1678 | |
| 1675 | 1679 | template <class _OutputIterator> |
| 1676 | 1680 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1720,7 +1724,7 @@ public: |
| 1720 | 1724 | static locale::id id; |
| 1721 | 1725 | |
| 1722 | 1726 | protected: |
| 1723 | ~numpunct(); | |
| 1727 | ~numpunct() override; | |
| 1724 | 1728 | virtual char_type do_decimal_point() const; |
| 1725 | 1729 | virtual char_type do_thousands_sep() const; |
| 1726 | 1730 | virtual string do_grouping() const; |
| ... | ... | @@ -1752,7 +1756,7 @@ public: |
| 1752 | 1756 | static locale::id id; |
| 1753 | 1757 | |
| 1754 | 1758 | protected: |
| 1755 | ~numpunct(); | |
| 1759 | ~numpunct() override; | |
| 1756 | 1760 | virtual char_type do_decimal_point() const; |
| 1757 | 1761 | virtual char_type do_thousands_sep() const; |
| 1758 | 1762 | virtual string do_grouping() const; |
| ... | ... | @@ -1781,7 +1785,7 @@ public: |
| 1781 | 1785 | explicit numpunct_byname(const string& __nm, size_t __refs = 0); |
| 1782 | 1786 | |
| 1783 | 1787 | protected: |
| 1784 | ~numpunct_byname(); | |
| 1788 | ~numpunct_byname() override; | |
| 1785 | 1789 | |
| 1786 | 1790 | private: |
| 1787 | 1791 | void __init(const char*); |
| ... | ... | @@ -1800,7 +1804,7 @@ public: |
| 1800 | 1804 | explicit numpunct_byname(const string& __nm, size_t __refs = 0); |
| 1801 | 1805 | |
| 1802 | 1806 | protected: |
| 1803 | ~numpunct_byname(); | |
| 1807 | ~numpunct_byname() override; | |
| 1804 | 1808 | |
| 1805 | 1809 | private: |
| 1806 | 1810 | void __init(const char*); |
lib/libcxx/include/__memory/addressof.h+1-1| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _Tp> |
| 22 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 22 | inline _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 23 | 23 | _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY |
| 24 | 24 | _Tp* |
| 25 | 25 | addressof(_Tp& __x) _NOEXCEPT |
lib/libcxx/include/__memory/align.h created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 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_ALIGN_H | |
| 10 | #define _LIBCPP___MEMORY_ALIGN_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <cstddef> | |
| 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 | _LIBCPP_FUNC_VIS void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space); | |
| 22 | ||
| 23 | _LIBCPP_END_NAMESPACE_STD | |
| 24 | ||
| 25 | #endif // _LIBCPP___MEMORY_ALIGN_H |
lib/libcxx/include/__memory/allocate_at_least.h+1| ... | ... | @@ -25,6 +25,7 @@ struct allocation_result { |
| 25 | 25 | _Pointer ptr; |
| 26 | 26 | size_t count; |
| 27 | 27 | }; |
| 28 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(allocation_result); | |
| 28 | 29 | |
| 29 | 30 | template <class _Alloc> |
| 30 | 31 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr |
lib/libcxx/include/__memory/allocator.h+14-11| ... | ... | @@ -13,11 +13,14 @@ |
| 13 | 13 | #include <__config> |
| 14 | 14 | #include <__memory/allocate_at_least.h> |
| 15 | 15 | #include <__memory/allocator_traits.h> |
| 16 | #include <__type_traits/is_constant_evaluated.h> | |
| 17 | #include <__type_traits/is_same.h> | |
| 18 | #include <__type_traits/is_void.h> | |
| 19 | #include <__type_traits/is_volatile.h> | |
| 16 | 20 | #include <__utility/forward.h> |
| 17 | 21 | #include <cstddef> |
| 18 | 22 | #include <new> |
| 19 | 23 | #include <stdexcept> |
| 20 | #include <type_traits> | |
| 21 | 24 | |
| 22 | 25 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | 26 | # pragma GCC system_header |
| ... | ... | @@ -95,14 +98,14 @@ public: |
| 95 | 98 | typedef true_type propagate_on_container_move_assignment; |
| 96 | 99 | typedef true_type is_always_equal; |
| 97 | 100 | |
| 98 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 101 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 99 | 102 | allocator() _NOEXCEPT = default; |
| 100 | 103 | |
| 101 | 104 | template <class _Up> |
| 102 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 105 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 103 | 106 | allocator(const allocator<_Up>&) _NOEXCEPT { } |
| 104 | 107 | |
| 105 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 108 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 106 | 109 | _Tp* allocate(size_t __n) { |
| 107 | 110 | if (__n > allocator_traits<allocator>::max_size(*this)) |
| 108 | 111 | __throw_bad_array_new_length(); |
| ... | ... | @@ -120,7 +123,7 @@ public: |
| 120 | 123 | } |
| 121 | 124 | #endif |
| 122 | 125 | |
| 123 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 126 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 124 | 127 | void deallocate(_Tp* __p, size_t __n) _NOEXCEPT { |
| 125 | 128 | if (__libcpp_is_constant_evaluated()) { |
| 126 | 129 | ::operator delete(__p); |
| ... | ... | @@ -184,14 +187,14 @@ public: |
| 184 | 187 | typedef true_type propagate_on_container_move_assignment; |
| 185 | 188 | typedef true_type is_always_equal; |
| 186 | 189 | |
| 187 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 190 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 188 | 191 | allocator() _NOEXCEPT = default; |
| 189 | 192 | |
| 190 | 193 | template <class _Up> |
| 191 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 194 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 192 | 195 | allocator(const allocator<_Up>&) _NOEXCEPT { } |
| 193 | 196 | |
| 194 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 197 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 195 | 198 | const _Tp* allocate(size_t __n) { |
| 196 | 199 | if (__n > allocator_traits<allocator>::max_size(*this)) |
| 197 | 200 | __throw_bad_array_new_length(); |
| ... | ... | @@ -209,7 +212,7 @@ public: |
| 209 | 212 | } |
| 210 | 213 | #endif |
| 211 | 214 | |
| 212 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 215 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 213 | 216 | void deallocate(const _Tp* __p, size_t __n) { |
| 214 | 217 | if (__libcpp_is_constant_evaluated()) { |
| 215 | 218 | ::operator delete(const_cast<_Tp*>(__p)); |
| ... | ... | @@ -258,11 +261,11 @@ public: |
| 258 | 261 | }; |
| 259 | 262 | |
| 260 | 263 | template <class _Tp, class _Up> |
| 261 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 264 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 262 | 265 | bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;} |
| 263 | 266 | |
| 264 | 267 | template <class _Tp, class _Up> |
| 265 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 268 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 266 | 269 | bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;} |
| 267 | 270 | |
| 268 | 271 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__memory/allocator_arg_t.h+4-2| ... | ... | @@ -12,8 +12,10 @@ |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | 14 | #include <__memory/uses_allocator.h> |
| 15 | #include <__type_traits/integral_constant.h> | |
| 16 | #include <__type_traits/is_constructible.h> | |
| 17 | #include <__type_traits/remove_cvref.h> | |
| 15 | 18 | #include <__utility/forward.h> |
| 16 | #include <type_traits> | |
| 17 | 19 | |
| 18 | 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 21 | # pragma GCC system_header |
| ... | ... | @@ -36,7 +38,7 @@ extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg; |
| 36 | 38 | template <class _Tp, class _Alloc, class ..._Args> |
| 37 | 39 | struct __uses_alloc_ctor_imp |
| 38 | 40 | { |
| 39 | typedef _LIBCPP_NODEBUG __uncvref_t<_Alloc> _RawAlloc; | |
| 41 | typedef _LIBCPP_NODEBUG __remove_cvref_t<_Alloc> _RawAlloc; | |
| 40 | 42 | static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value; |
| 41 | 43 | static const bool __ic = |
| 42 | 44 | is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; |
lib/libcxx/include/__memory/allocator_destructor.h created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 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_ALLOCATOR_DESTRUCTOR_H | |
| 10 | #define _LIBCPP___MEMORY_ALLOCATOR_DESTRUCTOR_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__memory/allocator_traits.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 _Alloc> | |
| 22 | class __allocator_destructor | |
| 23 | { | |
| 24 | typedef _LIBCPP_NODEBUG allocator_traits<_Alloc> __alloc_traits; | |
| 25 | public: | |
| 26 | typedef _LIBCPP_NODEBUG typename __alloc_traits::pointer pointer; | |
| 27 | typedef _LIBCPP_NODEBUG typename __alloc_traits::size_type size_type; | |
| 28 | private: | |
| 29 | _Alloc& __alloc_; | |
| 30 | size_type __s_; | |
| 31 | public: | |
| 32 | _LIBCPP_INLINE_VISIBILITY __allocator_destructor(_Alloc& __a, size_type __s) | |
| 33 | _NOEXCEPT | |
| 34 | : __alloc_(__a), __s_(__s) {} | |
| 35 | _LIBCPP_INLINE_VISIBILITY | |
| 36 | void operator()(pointer __p) _NOEXCEPT | |
| 37 | {__alloc_traits::deallocate(__alloc_, __p, __s_);} | |
| 38 | }; | |
| 39 | ||
| 40 | _LIBCPP_END_NAMESPACE_STD | |
| 41 | ||
| 42 | #endif // _LIBCPP___MEMORY_ALLOCATOR_DESTRUCTOR_H |
lib/libcxx/include/__memory/allocator_traits.h+34-29| ... | ... | @@ -13,9 +13,16 @@ |
| 13 | 13 | #include <__config> |
| 14 | 14 | #include <__memory/construct_at.h> |
| 15 | 15 | #include <__memory/pointer_traits.h> |
| 16 | #include <__type_traits/enable_if.h> | |
| 17 | #include <__type_traits/is_copy_constructible.h> | |
| 18 | #include <__type_traits/is_empty.h> | |
| 19 | #include <__type_traits/is_move_constructible.h> | |
| 20 | #include <__type_traits/make_unsigned.h> | |
| 21 | #include <__type_traits/remove_reference.h> | |
| 22 | #include <__type_traits/void_t.h> | |
| 23 | #include <__utility/declval.h> | |
| 16 | 24 | #include <__utility/forward.h> |
| 17 | 25 | #include <limits> |
| 18 | #include <type_traits> | |
| 19 | 26 | |
| 20 | 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 21 | 28 | # pragma GCC system_header |
| ... | ... | @@ -28,12 +35,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 35 | |
| 29 | 36 | #define _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \ |
| 30 | 37 | template <class _Tp, class = void> struct NAME : false_type { }; \ |
| 31 | template <class _Tp> struct NAME<_Tp, typename __void_t<typename _Tp:: PROPERTY >::type> : true_type { } | |
| 38 | template <class _Tp> struct NAME<_Tp, __void_t<typename _Tp:: PROPERTY > > : true_type { } | |
| 32 | 39 | |
| 33 | 40 | // __pointer |
| 34 | 41 | _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_pointer, pointer); |
| 35 | 42 | template <class _Tp, class _Alloc, |
| 36 | class _RawAlloc = typename remove_reference<_Alloc>::type, | |
| 43 | class _RawAlloc = __libcpp_remove_reference_t<_Alloc>, | |
| 37 | 44 | bool = __has_pointer<_RawAlloc>::value> |
| 38 | 45 | struct __pointer { |
| 39 | 46 | using type _LIBCPP_NODEBUG = typename _RawAlloc::pointer; |
| ... | ... | @@ -152,13 +159,12 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 152 | 159 | template <class _Tp, class _Up, class = void> |
| 153 | 160 | struct __has_rebind_other : false_type { }; |
| 154 | 161 | template <class _Tp, class _Up> |
| 155 | struct __has_rebind_other<_Tp, _Up, typename __void_t< | |
| 156 | typename _Tp::template rebind<_Up>::other | |
| 157 | >::type> : true_type { }; | |
| 162 | struct __has_rebind_other<_Tp, _Up, __void_t<typename _Tp::template rebind<_Up>::other> > : true_type { }; | |
| 158 | 163 | |
| 159 | 164 | template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value> |
| 160 | 165 | struct __allocator_traits_rebind { |
| 161 | using type _LIBCPP_NODEBUG = typename _Tp::template rebind<_Up>::other; | |
| 166 | static_assert(__has_rebind_other<_Tp, _Up>::value, "This allocator has to implement rebind"); | |
| 167 | using type _LIBCPP_NODEBUG = typename _Tp::template rebind<_Up>::other; | |
| 162 | 168 | }; |
| 163 | 169 | template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up> |
| 164 | 170 | struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true> { |
| ... | ... | @@ -181,7 +187,7 @@ struct __has_allocate_hint : false_type { }; |
| 181 | 187 | |
| 182 | 188 | template <class _Alloc, class _SizeType, class _ConstVoidPtr> |
| 183 | 189 | struct __has_allocate_hint<_Alloc, _SizeType, _ConstVoidPtr, decltype( |
| 184 | (void)declval<_Alloc>().allocate(declval<_SizeType>(), declval<_ConstVoidPtr>()) | |
| 190 | (void)std::declval<_Alloc>().allocate(std::declval<_SizeType>(), std::declval<_ConstVoidPtr>()) | |
| 185 | 191 | )> : true_type { }; |
| 186 | 192 | |
| 187 | 193 | // __has_construct |
| ... | ... | @@ -190,7 +196,7 @@ struct __has_construct_impl : false_type { }; |
| 190 | 196 | |
| 191 | 197 | template <class _Alloc, class ..._Args> |
| 192 | 198 | struct __has_construct_impl<decltype( |
| 193 | (void)declval<_Alloc>().construct(declval<_Args>()...) | |
| 199 | (void)std::declval<_Alloc>().construct(std::declval<_Args>()...) | |
| 194 | 200 | ), _Alloc, _Args...> : true_type { }; |
| 195 | 201 | |
| 196 | 202 | template <class _Alloc, class ..._Args> |
| ... | ... | @@ -202,7 +208,7 @@ struct __has_destroy : false_type { }; |
| 202 | 208 | |
| 203 | 209 | template <class _Alloc, class _Pointer> |
| 204 | 210 | struct __has_destroy<_Alloc, _Pointer, decltype( |
| 205 | (void)declval<_Alloc>().destroy(declval<_Pointer>()) | |
| 211 | (void)std::declval<_Alloc>().destroy(std::declval<_Pointer>()) | |
| 206 | 212 | )> : true_type { }; |
| 207 | 213 | |
| 208 | 214 | // __has_max_size |
| ... | ... | @@ -211,7 +217,7 @@ struct __has_max_size : false_type { }; |
| 211 | 217 | |
| 212 | 218 | template <class _Alloc> |
| 213 | 219 | struct __has_max_size<_Alloc, decltype( |
| 214 | (void)declval<_Alloc&>().max_size() | |
| 220 | (void)std::declval<_Alloc&>().max_size() | |
| 215 | 221 | )> : true_type { }; |
| 216 | 222 | |
| 217 | 223 | // __has_select_on_container_copy_construction |
| ... | ... | @@ -220,7 +226,7 @@ struct __has_select_on_container_copy_construction : false_type { }; |
| 220 | 226 | |
| 221 | 227 | template <class _Alloc> |
| 222 | 228 | struct __has_select_on_container_copy_construction<_Alloc, decltype( |
| 223 | (void)declval<_Alloc>().select_on_container_copy_construction() | |
| 229 | (void)std::declval<_Alloc>().select_on_container_copy_construction() | |
| 224 | 230 | )> : true_type { }; |
| 225 | 231 | |
| 226 | 232 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| ... | ... | @@ -257,14 +263,14 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 257 | 263 | }; |
| 258 | 264 | #endif // _LIBCPP_CXX03_LANG |
| 259 | 265 | |
| 260 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 266 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 261 | 267 | static pointer allocate(allocator_type& __a, size_type __n) { |
| 262 | 268 | return __a.allocate(__n); |
| 263 | 269 | } |
| 264 | 270 | |
| 265 | 271 | template <class _Ap = _Alloc, class = |
| 266 | 272 | __enable_if_t<__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> > |
| 267 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 273 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 268 | 274 | static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) { |
| 269 | 275 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 270 | 276 | return __a.allocate(__n, __hint); |
| ... | ... | @@ -272,19 +278,19 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 272 | 278 | } |
| 273 | 279 | template <class _Ap = _Alloc, class = void, class = |
| 274 | 280 | __enable_if_t<!__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> > |
| 275 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 281 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 276 | 282 | static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer) { |
| 277 | 283 | return __a.allocate(__n); |
| 278 | 284 | } |
| 279 | 285 | |
| 280 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 286 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 281 | 287 | static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT { |
| 282 | 288 | __a.deallocate(__p, __n); |
| 283 | 289 | } |
| 284 | 290 | |
| 285 | 291 | template <class _Tp, class... _Args, class = |
| 286 | 292 | __enable_if_t<__has_construct<allocator_type, _Tp*, _Args...>::value> > |
| 287 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 293 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 288 | 294 | static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args) { |
| 289 | 295 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 290 | 296 | __a.construct(__p, _VSTD::forward<_Args>(__args)...); |
| ... | ... | @@ -292,7 +298,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 292 | 298 | } |
| 293 | 299 | template <class _Tp, class... _Args, class = void, class = |
| 294 | 300 | __enable_if_t<!__has_construct<allocator_type, _Tp*, _Args...>::value> > |
| 295 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 301 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 296 | 302 | static void construct(allocator_type&, _Tp* __p, _Args&&... __args) { |
| 297 | 303 | #if _LIBCPP_STD_VER > 17 |
| 298 | 304 | _VSTD::construct_at(__p, _VSTD::forward<_Args>(__args)...); |
| ... | ... | @@ -303,7 +309,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 303 | 309 | |
| 304 | 310 | template <class _Tp, class = |
| 305 | 311 | __enable_if_t<__has_destroy<allocator_type, _Tp*>::value> > |
| 306 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 312 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 307 | 313 | static void destroy(allocator_type& __a, _Tp* __p) { |
| 308 | 314 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 309 | 315 | __a.destroy(__p); |
| ... | ... | @@ -311,7 +317,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 311 | 317 | } |
| 312 | 318 | template <class _Tp, class = void, class = |
| 313 | 319 | __enable_if_t<!__has_destroy<allocator_type, _Tp*>::value> > |
| 314 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 320 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 315 | 321 | static void destroy(allocator_type&, _Tp* __p) { |
| 316 | 322 | #if _LIBCPP_STD_VER > 17 |
| 317 | 323 | _VSTD::destroy_at(__p); |
| ... | ... | @@ -322,7 +328,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 322 | 328 | |
| 323 | 329 | template <class _Ap = _Alloc, class = |
| 324 | 330 | __enable_if_t<__has_max_size<const _Ap>::value> > |
| 325 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 331 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 326 | 332 | static size_type max_size(const allocator_type& __a) _NOEXCEPT { |
| 327 | 333 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 328 | 334 | return __a.max_size(); |
| ... | ... | @@ -330,33 +336,32 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 330 | 336 | } |
| 331 | 337 | template <class _Ap = _Alloc, class = void, class = |
| 332 | 338 | __enable_if_t<!__has_max_size<const _Ap>::value> > |
| 333 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 339 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 334 | 340 | static size_type max_size(const allocator_type&) _NOEXCEPT { |
| 335 | 341 | return numeric_limits<size_type>::max() / sizeof(value_type); |
| 336 | 342 | } |
| 337 | 343 | |
| 338 | 344 | template <class _Ap = _Alloc, class = |
| 339 | 345 | __enable_if_t<__has_select_on_container_copy_construction<const _Ap>::value> > |
| 340 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 346 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 341 | 347 | static allocator_type select_on_container_copy_construction(const allocator_type& __a) { |
| 342 | 348 | return __a.select_on_container_copy_construction(); |
| 343 | 349 | } |
| 344 | 350 | template <class _Ap = _Alloc, class = void, class = |
| 345 | 351 | __enable_if_t<!__has_select_on_container_copy_construction<const _Ap>::value> > |
| 346 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 352 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 347 | 353 | static allocator_type select_on_container_copy_construction(const allocator_type& __a) { |
| 348 | 354 | return __a; |
| 349 | 355 | } |
| 350 | 356 | }; |
| 351 | 357 | |
| 352 | template <class _Traits, class _Tp> | |
| 353 | struct __rebind_alloc_helper { | |
| 354 | 358 | #ifndef _LIBCPP_CXX03_LANG |
| 355 | using type _LIBCPP_NODEBUG = typename _Traits::template rebind_alloc<_Tp>; | |
| 359 | template <class _Traits, class _Tp> | |
| 360 | using __rebind_alloc _LIBCPP_NODEBUG = typename _Traits::template rebind_alloc<_Tp>; | |
| 356 | 361 | #else |
| 357 | using type = typename _Traits::template rebind_alloc<_Tp>::other; | |
| 362 | template <class _Traits, class _Tp> | |
| 363 | using __rebind_alloc = typename _Traits::template rebind_alloc<_Tp>::other; | |
| 358 | 364 | #endif |
| 359 | }; | |
| 360 | 365 | |
| 361 | 366 | // __is_default_allocator |
| 362 | 367 | template <class _Tp> |
lib/libcxx/include/__memory/assume_aligned.h+1-1| ... | ... | @@ -12,9 +12,9 @@ |
| 12 | 12 | |
| 13 | 13 | #include <__assert> |
| 14 | 14 | #include <__config> |
| 15 | #include <__type_traits/is_constant_evaluated.h> | |
| 15 | 16 | #include <cstddef> |
| 16 | 17 | #include <cstdint> |
| 17 | #include <type_traits> // for is_constant_evaluated() | |
| 18 | 18 | |
| 19 | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | 20 | # pragma GCC system_header |
lib/libcxx/include/__memory/builtin_new_allocator.h created+70| ... | ... | @@ -0,0 +1,70 @@ |
| 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_BUILTIN_NEW_ALLOCATOR_H | |
| 10 | #define _LIBCPP___MEMORY_BUILTIN_NEW_ALLOCATOR_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__memory/unique_ptr.h> | |
| 14 | #include <cstddef> | |
| 15 | #include <new> | |
| 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 | // __builtin_new_allocator -- A non-templated helper for allocating and | |
| 24 | // deallocating memory using __builtin_operator_new and | |
| 25 | // __builtin_operator_delete. It should be used in preference to | |
| 26 | // `std::allocator<T>` to avoid additional instantiations. | |
| 27 | struct __builtin_new_allocator { | |
| 28 | struct __builtin_new_deleter { | |
| 29 | typedef void* pointer_type; | |
| 30 | ||
| 31 | _LIBCPP_CONSTEXPR explicit __builtin_new_deleter(size_t __size, size_t __align) | |
| 32 | : __size_(__size), __align_(__align) {} | |
| 33 | ||
| 34 | void operator()(void* __p) const _NOEXCEPT { | |
| 35 | _VSTD::__libcpp_deallocate(__p, __size_, __align_); | |
| 36 | } | |
| 37 | ||
| 38 | private: | |
| 39 | size_t __size_; | |
| 40 | size_t __align_; | |
| 41 | }; | |
| 42 | ||
| 43 | typedef unique_ptr<void, __builtin_new_deleter> __holder_t; | |
| 44 | ||
| 45 | static __holder_t __allocate_bytes(size_t __s, size_t __align) { | |
| 46 | return __holder_t(_VSTD::__libcpp_allocate(__s, __align), | |
| 47 | __builtin_new_deleter(__s, __align)); | |
| 48 | } | |
| 49 | ||
| 50 | static void __deallocate_bytes(void* __p, size_t __s, | |
| 51 | size_t __align) _NOEXCEPT { | |
| 52 | _VSTD::__libcpp_deallocate(__p, __s, __align); | |
| 53 | } | |
| 54 | ||
| 55 | template <class _Tp> | |
| 56 | _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE | |
| 57 | static __holder_t __allocate_type(size_t __n) { | |
| 58 | return __allocate_bytes(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); | |
| 59 | } | |
| 60 | ||
| 61 | template <class _Tp> | |
| 62 | _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE | |
| 63 | static void __deallocate_type(void* __p, size_t __n) _NOEXCEPT { | |
| 64 | __deallocate_bytes(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); | |
| 65 | } | |
| 66 | }; | |
| 67 | ||
| 68 | _LIBCPP_END_NAMESPACE_STD | |
| 69 | ||
| 70 | #endif // _LIBCPP___MEMORY_BUILTIN_NEW_ALLOCATOR_H |
lib/libcxx/include/__memory/compressed_pair.h+22-11| ... | ... | @@ -11,10 +11,21 @@ |
| 11 | 11 | #define _LIBCPP___MEMORY_COMPRESSED_PAIR_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <__fwd/get.h> | |
| 15 | #include <__fwd/tuple.h> | |
| 16 | #include <__tuple_dir/tuple_indices.h> | |
| 17 | #include <__type_traits/decay.h> | |
| 18 | #include <__type_traits/dependent_type.h> | |
| 19 | #include <__type_traits/enable_if.h> | |
| 20 | #include <__type_traits/is_default_constructible.h> | |
| 21 | #include <__type_traits/is_empty.h> | |
| 22 | #include <__type_traits/is_final.h> | |
| 23 | #include <__type_traits/is_same.h> | |
| 24 | #include <__type_traits/is_swappable.h> | |
| 14 | 25 | #include <__utility/forward.h> |
| 15 | 26 | #include <__utility/move.h> |
| 16 | #include <tuple> // needed in c++03 for some constructors | |
| 17 | #include <type_traits> | |
| 27 | #include <__utility/piecewise_construct.h> | |
| 28 | #include <cstddef> | |
| 18 | 29 | |
| 19 | 30 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | 31 | # pragma GCC system_header |
| ... | ... | @@ -41,12 +52,12 @@ struct __compressed_pair_elem { |
| 41 | 52 | |
| 42 | 53 | #ifndef _LIBCPP_CXX03_LANG |
| 43 | 54 | template <class... _Args, size_t... _Indices> |
| 44 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 55 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 45 | 56 | explicit __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indices...>) |
| 46 | 57 | : __value_(std::forward<_Args>(std::get<_Indices>(__args))...) {} |
| 47 | 58 | #endif |
| 48 | 59 | |
| 49 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 reference __get() _NOEXCEPT { return __value_; } | |
| 60 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference __get() _NOEXCEPT { return __value_; } | |
| 50 | 61 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __get() const _NOEXCEPT { return __value_; } |
| 51 | 62 | |
| 52 | 63 | private: |
| ... | ... | @@ -70,12 +81,12 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { |
| 70 | 81 | |
| 71 | 82 | #ifndef _LIBCPP_CXX03_LANG |
| 72 | 83 | template <class... _Args, size_t... _Indices> |
| 73 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 84 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 74 | 85 | __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indices...>) |
| 75 | 86 | : __value_type(std::forward<_Args>(std::get<_Indices>(__args))...) {} |
| 76 | 87 | #endif |
| 77 | 88 | |
| 78 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 reference __get() _NOEXCEPT { return *this; } | |
| 89 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference __get() _NOEXCEPT { return *this; } | |
| 79 | 90 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __get() const _NOEXCEPT { return *this; } |
| 80 | 91 | }; |
| 81 | 92 | |
| ... | ... | @@ -109,14 +120,14 @@ public: |
| 109 | 120 | |
| 110 | 121 | #ifndef _LIBCPP_CXX03_LANG |
| 111 | 122 | template <class... _Args1, class... _Args2> |
| 112 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 123 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 113 | 124 | explicit __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, |
| 114 | 125 | tuple<_Args2...> __second_args) |
| 115 | 126 | : _Base1(__pc, std::move(__first_args), typename __make_tuple_indices<sizeof...(_Args1)>::type()), |
| 116 | 127 | _Base2(__pc, std::move(__second_args), typename __make_tuple_indices<sizeof...(_Args2)>::type()) {} |
| 117 | 128 | #endif |
| 118 | 129 | |
| 119 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 130 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 120 | 131 | typename _Base1::reference first() _NOEXCEPT { |
| 121 | 132 | return static_cast<_Base1&>(*this).__get(); |
| 122 | 133 | } |
| ... | ... | @@ -126,7 +137,7 @@ public: |
| 126 | 137 | return static_cast<_Base1 const&>(*this).__get(); |
| 127 | 138 | } |
| 128 | 139 | |
| 129 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 140 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 130 | 141 | typename _Base2::reference second() _NOEXCEPT { |
| 131 | 142 | return static_cast<_Base2&>(*this).__get(); |
| 132 | 143 | } |
| ... | ... | @@ -145,7 +156,7 @@ public: |
| 145 | 156 | return static_cast<_Base2*>(__pair); |
| 146 | 157 | } |
| 147 | 158 | |
| 148 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 159 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 149 | 160 | void swap(__compressed_pair& __x) |
| 150 | 161 | _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) { |
| 151 | 162 | using std::swap; |
| ... | ... | @@ -155,7 +166,7 @@ public: |
| 155 | 166 | }; |
| 156 | 167 | |
| 157 | 168 | template <class _T1, class _T2> |
| 158 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 169 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 159 | 170 | void swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y) |
| 160 | 171 | _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) { |
| 161 | 172 | __x.swap(__y); |
lib/libcxx/include/__memory/concepts.h+5-4| ... | ... | @@ -10,14 +10,15 @@ |
| 10 | 10 | #ifndef _LIBCPP___MEMORY_CONCEPTS_H |
| 11 | 11 | #define _LIBCPP___MEMORY_CONCEPTS_H |
| 12 | 12 | |
| 13 | #include <__concepts/same_as.h> | |
| 13 | 14 | #include <__config> |
| 14 | 15 | #include <__iterator/concepts.h> |
| 15 | 16 | #include <__iterator/iterator_traits.h> |
| 16 | 17 | #include <__iterator/readable_traits.h> |
| 17 | 18 | #include <__ranges/access.h> |
| 18 | 19 | #include <__ranges/concepts.h> |
| 19 | #include <concepts> | |
| 20 | #include <type_traits> | |
| 20 | #include <__type_traits/is_reference.h> | |
| 21 | #include <__type_traits/remove_cvref.h> | |
| 21 | 22 | |
| 22 | 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | 24 | # pragma GCC system_header |
| ... | ... | @@ -25,7 +26,7 @@ |
| 25 | 26 | |
| 26 | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 28 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 30 | |
| 30 | 31 | namespace ranges { |
| 31 | 32 | |
| ... | ... | @@ -61,7 +62,7 @@ concept __nothrow_forward_range = |
| 61 | 62 | |
| 62 | 63 | } // namespace ranges |
| 63 | 64 | |
| 64 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 65 | #endif // _LIBCPP_STD_VER > 17 | |
| 65 | 66 | |
| 66 | 67 | _LIBCPP_END_NAMESPACE_STD |
| 67 | 68 |
lib/libcxx/include/__memory/construct_at.h+14-11| ... | ... | @@ -15,9 +15,12 @@ |
| 15 | 15 | #include <__iterator/access.h> |
| 16 | 16 | #include <__memory/addressof.h> |
| 17 | 17 | #include <__memory/voidify.h> |
| 18 | #include <__type_traits/enable_if.h> | |
| 19 | #include <__type_traits/is_array.h> | |
| 20 | #include <__utility/declval.h> | |
| 18 | 21 | #include <__utility/forward.h> |
| 19 | 22 | #include <__utility/move.h> |
| 20 | #include <type_traits> | |
| 23 | #include <new> | |
| 21 | 24 | |
| 22 | 25 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | 26 | # pragma GCC system_header |
| ... | ... | @@ -29,7 +32,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 29 | 32 | |
| 30 | 33 | #if _LIBCPP_STD_VER > 17 |
| 31 | 34 | |
| 32 | template <class _Tp, class... _Args, class = decltype(::new(declval<void*>()) _Tp(declval<_Args>()...))> | |
| 35 | template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))> | |
| 33 | 36 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&&... __args) { |
| 34 | 37 | _LIBCPP_ASSERT(__location != nullptr, "null pointer given to construct_at"); |
| 35 | 38 | return ::new (_VSTD::__voidify(*__location)) _Tp(_VSTD::forward<_Args>(__args)...); |
| ... | ... | @@ -37,7 +40,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&&... __ |
| 37 | 40 | |
| 38 | 41 | #endif |
| 39 | 42 | |
| 40 | template <class _Tp, class... _Args, class = decltype(::new(declval<void*>()) _Tp(declval<_Args>()...))> | |
| 43 | template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))> | |
| 41 | 44 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __construct_at(_Tp* __location, _Args&&... __args) { |
| 42 | 45 | #if _LIBCPP_STD_VER > 17 |
| 43 | 46 | return std::construct_at(__location, std::forward<_Args>(__args)...); |
| ... | ... | @@ -53,11 +56,11 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __construct_at(_Tp* __location, _Ar |
| 53 | 56 | // taking an array). |
| 54 | 57 | |
| 55 | 58 | template <class _ForwardIterator> |
| 56 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 59 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 57 | 60 | _ForwardIterator __destroy(_ForwardIterator, _ForwardIterator); |
| 58 | 61 | |
| 59 | 62 | template <class _Tp, typename enable_if<!is_array<_Tp>::value, int>::type = 0> |
| 60 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 63 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 61 | 64 | void __destroy_at(_Tp* __loc) { |
| 62 | 65 | _LIBCPP_ASSERT(__loc != nullptr, "null pointer given to destroy_at"); |
| 63 | 66 | __loc->~_Tp(); |
| ... | ... | @@ -65,7 +68,7 @@ void __destroy_at(_Tp* __loc) { |
| 65 | 68 | |
| 66 | 69 | #if _LIBCPP_STD_VER > 17 |
| 67 | 70 | template <class _Tp, typename enable_if<is_array<_Tp>::value, int>::type = 0> |
| 68 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 71 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 69 | 72 | void __destroy_at(_Tp* __loc) { |
| 70 | 73 | _LIBCPP_ASSERT(__loc != nullptr, "null pointer given to destroy_at"); |
| 71 | 74 | _VSTD::__destroy(_VSTD::begin(*__loc), _VSTD::end(*__loc)); |
| ... | ... | @@ -73,7 +76,7 @@ void __destroy_at(_Tp* __loc) { |
| 73 | 76 | #endif |
| 74 | 77 | |
| 75 | 78 | template <class _ForwardIterator> |
| 76 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 79 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 77 | 80 | _ForwardIterator __destroy(_ForwardIterator __first, _ForwardIterator __last) { |
| 78 | 81 | for (; __first != __last; ++__first) |
| 79 | 82 | _VSTD::__destroy_at(_VSTD::addressof(*__first)); |
| ... | ... | @@ -83,27 +86,27 @@ _ForwardIterator __destroy(_ForwardIterator __first, _ForwardIterator __last) { |
| 83 | 86 | #if _LIBCPP_STD_VER > 14 |
| 84 | 87 | |
| 85 | 88 | template <class _Tp, enable_if_t<!is_array_v<_Tp>, int> = 0> |
| 86 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 89 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 87 | 90 | void destroy_at(_Tp* __loc) { |
| 88 | 91 | _VSTD::__destroy_at(__loc); |
| 89 | 92 | } |
| 90 | 93 | |
| 91 | 94 | #if _LIBCPP_STD_VER > 17 |
| 92 | 95 | template <class _Tp, enable_if_t<is_array_v<_Tp>, int> = 0> |
| 93 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 96 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 94 | 97 | void destroy_at(_Tp* __loc) { |
| 95 | 98 | _VSTD::__destroy_at(__loc); |
| 96 | 99 | } |
| 97 | 100 | #endif |
| 98 | 101 | |
| 99 | 102 | template <class _ForwardIterator> |
| 100 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 103 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 101 | 104 | void destroy(_ForwardIterator __first, _ForwardIterator __last) { |
| 102 | 105 | (void)_VSTD::__destroy(_VSTD::move(__first), _VSTD::move(__last)); |
| 103 | 106 | } |
| 104 | 107 | |
| 105 | 108 | template <class _ForwardIterator, class _Size> |
| 106 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 109 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 107 | 110 | _ForwardIterator destroy_n(_ForwardIterator __first, _Size __n) { |
| 108 | 111 | for (; __n > 0; (void)++__first, --__n) |
| 109 | 112 | _VSTD::__destroy_at(_VSTD::addressof(*__first)); |
lib/libcxx/include/__memory/destruct_n.h created+64| ... | ... | @@ -0,0 +1,64 @@ |
| 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_DESTRUCT_N_H | |
| 10 | #define _LIBCPP___MEMORY_DESTRUCT_N_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/integral_constant.h> | |
| 14 | #include <__type_traits/is_trivially_destructible.h> | |
| 15 | #include <cstddef> | |
| 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 | struct __destruct_n | |
| 24 | { | |
| 25 | private: | |
| 26 | size_t __size_; | |
| 27 | ||
| 28 | template <class _Tp> | |
| 29 | _LIBCPP_INLINE_VISIBILITY void __process(_Tp* __p, false_type) _NOEXCEPT | |
| 30 | {for (size_t __i = 0; __i < __size_; ++__i, ++__p) __p->~_Tp();} | |
| 31 | ||
| 32 | template <class _Tp> | |
| 33 | _LIBCPP_INLINE_VISIBILITY void __process(_Tp*, true_type) _NOEXCEPT | |
| 34 | {} | |
| 35 | ||
| 36 | _LIBCPP_INLINE_VISIBILITY void __incr(false_type) _NOEXCEPT | |
| 37 | {++__size_;} | |
| 38 | _LIBCPP_INLINE_VISIBILITY void __incr(true_type) _NOEXCEPT | |
| 39 | {} | |
| 40 | ||
| 41 | _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, false_type) _NOEXCEPT | |
| 42 | {__size_ = __s;} | |
| 43 | _LIBCPP_INLINE_VISIBILITY void __set(size_t, true_type) _NOEXCEPT | |
| 44 | {} | |
| 45 | public: | |
| 46 | _LIBCPP_INLINE_VISIBILITY explicit __destruct_n(size_t __s) _NOEXCEPT | |
| 47 | : __size_(__s) {} | |
| 48 | ||
| 49 | template <class _Tp> | |
| 50 | _LIBCPP_INLINE_VISIBILITY void __incr() _NOEXCEPT | |
| 51 | {__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());} | |
| 52 | ||
| 53 | template <class _Tp> | |
| 54 | _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, _Tp*) _NOEXCEPT | |
| 55 | {__set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());} | |
| 56 | ||
| 57 | template <class _Tp> | |
| 58 | _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __p) _NOEXCEPT | |
| 59 | {__process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());} | |
| 60 | }; | |
| 61 | ||
| 62 | _LIBCPP_END_NAMESPACE_STD | |
| 63 | ||
| 64 | #endif // _LIBCPP___MEMORY_DESTRUCT_N_H |
lib/libcxx/include/__memory/pointer_traits.h+24-22| ... | ... | @@ -12,8 +12,15 @@ |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | 14 | #include <__memory/addressof.h> |
| 15 | #include <__type_traits/conditional.h> | |
| 16 | #include <__type_traits/conjunction.h> | |
| 17 | #include <__type_traits/decay.h> | |
| 18 | #include <__type_traits/is_class.h> | |
| 19 | #include <__type_traits/is_function.h> | |
| 20 | #include <__type_traits/is_void.h> | |
| 21 | #include <__type_traits/void_t.h> | |
| 22 | #include <__utility/declval.h> | |
| 15 | 23 | #include <cstddef> |
| 16 | #include <type_traits> | |
| 17 | 24 | |
| 18 | 25 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 26 | # pragma GCC system_header |
| ... | ... | @@ -25,8 +32,7 @@ template <class _Tp, class = void> |
| 25 | 32 | struct __has_element_type : false_type {}; |
| 26 | 33 | |
| 27 | 34 | template <class _Tp> |
| 28 | struct __has_element_type<_Tp, | |
| 29 | typename __void_t<typename _Tp::element_type>::type> : true_type {}; | |
| 35 | struct __has_element_type<_Tp, __void_t<typename _Tp::element_type> > : true_type {}; | |
| 30 | 36 | |
| 31 | 37 | template <class _Ptr, bool = __has_element_type<_Ptr>::value> |
| 32 | 38 | struct __pointer_traits_element_type; |
| ... | ... | @@ -53,8 +59,7 @@ template <class _Tp, class = void> |
| 53 | 59 | struct __has_difference_type : false_type {}; |
| 54 | 60 | |
| 55 | 61 | template <class _Tp> |
| 56 | struct __has_difference_type<_Tp, | |
| 57 | typename __void_t<typename _Tp::difference_type>::type> : true_type {}; | |
| 62 | struct __has_difference_type<_Tp, __void_t<typename _Tp::difference_type> > : true_type {}; | |
| 58 | 63 | |
| 59 | 64 | template <class _Ptr, bool = __has_difference_type<_Ptr>::value> |
| 60 | 65 | struct __pointer_traits_difference_type |
| ... | ... | @@ -123,9 +128,8 @@ struct _LIBCPP_TEMPLATE_VIS pointer_traits |
| 123 | 128 | private: |
| 124 | 129 | struct __nat {}; |
| 125 | 130 | public: |
| 126 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 127 | static pointer pointer_to(typename conditional<is_void<element_type>::value, | |
| 128 | __nat, element_type>::type& __r) | |
| 131 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 132 | static pointer pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) | |
| 129 | 133 | {return pointer::pointer_to(__r);} |
| 130 | 134 | }; |
| 131 | 135 | |
| ... | ... | @@ -145,20 +149,18 @@ struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*> |
| 145 | 149 | private: |
| 146 | 150 | struct __nat {}; |
| 147 | 151 | public: |
| 148 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 149 | static pointer pointer_to(typename conditional<is_void<element_type>::value, | |
| 150 | __nat, element_type>::type& __r) _NOEXCEPT | |
| 152 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 153 | static pointer pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) _NOEXCEPT | |
| 151 | 154 | {return _VSTD::addressof(__r);} |
| 152 | 155 | }; |
| 153 | 156 | |
| 154 | template <class _From, class _To> | |
| 155 | struct __rebind_pointer { | |
| 156 | 157 | #ifndef _LIBCPP_CXX03_LANG |
| 157 | typedef typename pointer_traits<_From>::template rebind<_To> type; | |
| 158 | template <class _From, class _To> | |
| 159 | using __rebind_pointer_t = typename pointer_traits<_From>::template rebind<_To>; | |
| 158 | 160 | #else |
| 159 | typedef typename pointer_traits<_From>::template rebind<_To>::other type; | |
| 161 | template <class _From, class _To> | |
| 162 | using __rebind_pointer_t = typename pointer_traits<_From>::template rebind<_To>::other; | |
| 160 | 163 | #endif |
| 161 | }; | |
| 162 | 164 | |
| 163 | 165 | // to_address |
| 164 | 166 | |
| ... | ... | @@ -177,7 +179,7 @@ struct _HasToAddress : false_type {}; |
| 177 | 179 | |
| 178 | 180 | template <class _Pointer> |
| 179 | 181 | struct _HasToAddress<_Pointer, |
| 180 | decltype((void)pointer_traits<_Pointer>::to_address(declval<const _Pointer&>())) | |
| 182 | decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>())) | |
| 181 | 183 | > : true_type {}; |
| 182 | 184 | |
| 183 | 185 | template <class _Pointer, class = void> |
| ... | ... | @@ -185,7 +187,7 @@ struct _HasArrow : false_type {}; |
| 185 | 187 | |
| 186 | 188 | template <class _Pointer> |
| 187 | 189 | struct _HasArrow<_Pointer, |
| 188 | decltype((void)declval<const _Pointer&>().operator->()) | |
| 190 | decltype((void)std::declval<const _Pointer&>().operator->()) | |
| 189 | 191 | > : true_type {}; |
| 190 | 192 | |
| 191 | 193 | template <class _Pointer> |
| ... | ... | @@ -198,7 +200,7 @@ template <class _Pointer, class = __enable_if_t< |
| 198 | 200 | _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value |
| 199 | 201 | > > |
| 200 | 202 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 201 | typename decay<decltype(__to_address_helper<_Pointer>::__call(declval<const _Pointer&>()))>::type | |
| 203 | typename decay<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>::type | |
| 202 | 204 | __to_address(const _Pointer& __p) _NOEXCEPT { |
| 203 | 205 | return __to_address_helper<_Pointer>::__call(__p); |
| 204 | 206 | } |
| ... | ... | @@ -206,16 +208,16 @@ __to_address(const _Pointer& __p) _NOEXCEPT { |
| 206 | 208 | template <class _Pointer, class> |
| 207 | 209 | struct __to_address_helper { |
| 208 | 210 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 209 | static decltype(_VSTD::__to_address(declval<const _Pointer&>().operator->())) | |
| 211 | static decltype(_VSTD::__to_address(std::declval<const _Pointer&>().operator->())) | |
| 210 | 212 | __call(const _Pointer& __p) _NOEXCEPT { |
| 211 | 213 | return _VSTD::__to_address(__p.operator->()); |
| 212 | 214 | } |
| 213 | 215 | }; |
| 214 | 216 | |
| 215 | 217 | template <class _Pointer> |
| 216 | struct __to_address_helper<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(declval<const _Pointer&>()))> { | |
| 218 | struct __to_address_helper<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> { | |
| 217 | 219 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 218 | static decltype(pointer_traits<_Pointer>::to_address(declval<const _Pointer&>())) | |
| 220 | static decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>())) | |
| 219 | 221 | __call(const _Pointer& __p) _NOEXCEPT { |
| 220 | 222 | return pointer_traits<_Pointer>::to_address(__p); |
| 221 | 223 | } |
lib/libcxx/include/__memory/ranges_construct_at.h+4-3| ... | ... | @@ -22,6 +22,7 @@ |
| 22 | 22 | #include <__utility/declval.h> |
| 23 | 23 | #include <__utility/forward.h> |
| 24 | 24 | #include <__utility/move.h> |
| 25 | #include <new> | |
| 25 | 26 | |
| 26 | 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 27 | 28 | # pragma GCC system_header |
| ... | ... | @@ -29,7 +30,7 @@ |
| 29 | 30 | |
| 30 | 31 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 32 | |
| 32 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 33 | #if _LIBCPP_STD_VER > 17 | |
| 33 | 34 | namespace ranges { |
| 34 | 35 | |
| 35 | 36 | // construct_at |
| ... | ... | @@ -38,7 +39,7 @@ namespace __construct_at { |
| 38 | 39 | |
| 39 | 40 | struct __fn { |
| 40 | 41 | template<class _Tp, class... _Args, class = decltype( |
| 41 | ::new (declval<void*>()) _Tp(declval<_Args>()...) | |
| 42 | ::new (std::declval<void*>()) _Tp(std::declval<_Args>()...) | |
| 42 | 43 | )> |
| 43 | 44 | _LIBCPP_HIDE_FROM_ABI |
| 44 | 45 | constexpr _Tp* operator()(_Tp* __location, _Args&& ...__args) const { |
| ... | ... | @@ -117,7 +118,7 @@ inline namespace __cpo { |
| 117 | 118 | |
| 118 | 119 | } // namespace ranges |
| 119 | 120 | |
| 120 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 121 | #endif // _LIBCPP_STD_VER > 17 | |
| 121 | 122 | |
| 122 | 123 | _LIBCPP_END_NAMESPACE_STD |
| 123 | 124 |
lib/libcxx/include/__memory/ranges_uninitialized_algorithms.h+7-6| ... | ... | @@ -23,8 +23,9 @@ |
| 23 | 23 | #include <__ranges/access.h> |
| 24 | 24 | #include <__ranges/concepts.h> |
| 25 | 25 | #include <__ranges/dangling.h> |
| 26 | #include <__type_traits/remove_reference.h> | |
| 26 | 27 | #include <__utility/move.h> |
| 27 | #include <type_traits> | |
| 28 | #include <new> | |
| 28 | 29 | |
| 29 | 30 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 30 | 31 | # pragma GCC system_header |
| ... | ... | @@ -32,7 +33,7 @@ |
| 32 | 33 | |
| 33 | 34 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 34 | 35 | |
| 35 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 36 | #if _LIBCPP_STD_VER > 17 | |
| 36 | 37 | |
| 37 | 38 | namespace ranges { |
| 38 | 39 | |
| ... | ... | @@ -255,7 +256,7 @@ struct __fn { |
| 255 | 256 | sentinel_for<_InputIterator> _Sentinel1, |
| 256 | 257 | __nothrow_forward_iterator _OutputIterator, |
| 257 | 258 | __nothrow_sentinel_for<_OutputIterator> _Sentinel2> |
| 258 | requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>> | |
| 259 | requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>> | |
| 259 | 260 | uninitialized_move_result<_InputIterator, _OutputIterator> |
| 260 | 261 | operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const { |
| 261 | 262 | using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; |
| ... | ... | @@ -266,7 +267,7 @@ struct __fn { |
| 266 | 267 | } |
| 267 | 268 | |
| 268 | 269 | template <input_range _InputRange, __nothrow_forward_range _OutputRange> |
| 269 | requires constructible_from<range_value_t<_OutputRange>, range_reference_t<_InputRange>> | |
| 270 | requires constructible_from<range_value_t<_OutputRange>, range_rvalue_reference_t<_InputRange>> | |
| 270 | 271 | uninitialized_move_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>> |
| 271 | 272 | operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const { |
| 272 | 273 | return (*this)(ranges::begin(__in_range), ranges::end(__in_range), |
| ... | ... | @@ -291,7 +292,7 @@ struct __fn { |
| 291 | 292 | template <input_iterator _InputIterator, |
| 292 | 293 | __nothrow_forward_iterator _OutputIterator, |
| 293 | 294 | __nothrow_sentinel_for<_OutputIterator> _Sentinel> |
| 294 | requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>> | |
| 295 | requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>> | |
| 295 | 296 | uninitialized_move_n_result<_InputIterator, _OutputIterator> |
| 296 | 297 | operator()(_InputIterator __ifirst, iter_difference_t<_InputIterator> __n, |
| 297 | 298 | _OutputIterator __ofirst, _Sentinel __olast) const { |
| ... | ... | @@ -311,7 +312,7 @@ inline namespace __cpo { |
| 311 | 312 | |
| 312 | 313 | } // namespace ranges |
| 313 | 314 | |
| 314 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 315 | #endif // _LIBCPP_STD_VER > 17 | |
| 315 | 316 | |
| 316 | 317 | _LIBCPP_END_NAMESPACE_STD |
| 317 | 318 |
lib/libcxx/include/__memory/raw_storage_iterator.h+1| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | #include <__memory/addressof.h> |
| 17 | 17 | #include <__utility/move.h> |
| 18 | 18 | #include <cstddef> |
| 19 | #include <new> | |
| 19 | 20 | |
| 20 | 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 21 | 22 | # pragma GCC system_header |
lib/libcxx/include/__memory/shared_ptr.h+159-65| ... | ... | @@ -11,6 +11,8 @@ |
| 11 | 11 | #define _LIBCPP___MEMORY_SHARED_PTR_H |
| 12 | 12 | |
| 13 | 13 | #include <__availability> |
| 14 | #include <__compare/compare_three_way.h> | |
| 15 | #include <__compare/ordering.h> | |
| 14 | 16 | #include <__config> |
| 15 | 17 | #include <__functional/binary_function.h> |
| 16 | 18 | #include <__functional/operations.h> |
| ... | ... | @@ -19,6 +21,7 @@ |
| 19 | 21 | #include <__memory/addressof.h> |
| 20 | 22 | #include <__memory/allocation_guard.h> |
| 21 | 23 | #include <__memory/allocator.h> |
| 24 | #include <__memory/allocator_destructor.h> | |
| 22 | 25 | #include <__memory/allocator_traits.h> |
| 23 | 26 | #include <__memory/auto_ptr.h> |
| 24 | 27 | #include <__memory/compressed_pair.h> |
| ... | ... | @@ -32,39 +35,19 @@ |
| 32 | 35 | #include <cstddef> |
| 33 | 36 | #include <cstdlib> // abort |
| 34 | 37 | #include <iosfwd> |
| 38 | #include <new> | |
| 35 | 39 | #include <stdexcept> |
| 36 | #include <type_traits> | |
| 37 | 40 | #include <typeinfo> |
| 38 | 41 | #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) |
| 39 | 42 | # include <atomic> |
| 40 | 43 | #endif |
| 41 | 44 | |
| 42 | ||
| 43 | 45 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 44 | 46 | # pragma GCC system_header |
| 45 | 47 | #endif |
| 46 | 48 | |
| 47 | 49 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 48 | 50 | |
| 49 | template <class _Alloc> | |
| 50 | class __allocator_destructor | |
| 51 | { | |
| 52 | typedef _LIBCPP_NODEBUG allocator_traits<_Alloc> __alloc_traits; | |
| 53 | public: | |
| 54 | typedef _LIBCPP_NODEBUG typename __alloc_traits::pointer pointer; | |
| 55 | typedef _LIBCPP_NODEBUG typename __alloc_traits::size_type size_type; | |
| 56 | private: | |
| 57 | _Alloc& __alloc_; | |
| 58 | size_type __s_; | |
| 59 | public: | |
| 60 | _LIBCPP_INLINE_VISIBILITY __allocator_destructor(_Alloc& __a, size_type __s) | |
| 61 | _NOEXCEPT | |
| 62 | : __alloc_(__a), __s_(__s) {} | |
| 63 | _LIBCPP_INLINE_VISIBILITY | |
| 64 | void operator()(pointer __p) _NOEXCEPT | |
| 65 | {__alloc_traits::deallocate(__alloc_, __p, __s_);} | |
| 66 | }; | |
| 67 | ||
| 68 | 51 | // NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively) |
| 69 | 52 | // should be sufficient for thread safety. |
| 70 | 53 | // See https://llvm.org/PR22803 |
| ... | ... | @@ -128,8 +111,8 @@ class _LIBCPP_EXCEPTION_ABI bad_weak_ptr |
| 128 | 111 | public: |
| 129 | 112 | bad_weak_ptr() _NOEXCEPT = default; |
| 130 | 113 | bad_weak_ptr(const bad_weak_ptr&) _NOEXCEPT = default; |
| 131 | virtual ~bad_weak_ptr() _NOEXCEPT; | |
| 132 | virtual const char* what() const _NOEXCEPT; | |
| 114 | ~bad_weak_ptr() _NOEXCEPT override; | |
| 115 | const char* what() const _NOEXCEPT override; | |
| 133 | 116 | }; |
| 134 | 117 | |
| 135 | 118 | _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -194,7 +177,7 @@ public: |
| 194 | 177 | : __shared_count(__refs), |
| 195 | 178 | __shared_weak_owners_(__refs) {} |
| 196 | 179 | protected: |
| 197 | virtual ~__shared_weak_count(); | |
| 180 | ~__shared_weak_count() override; | |
| 198 | 181 | |
| 199 | 182 | public: |
| 200 | 183 | #if defined(_LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS) |
| ... | ... | @@ -237,12 +220,12 @@ public: |
| 237 | 220 | : __data_(__compressed_pair<_Tp, _Dp>(__p, _VSTD::move(__d)), _VSTD::move(__a)) {} |
| 238 | 221 | |
| 239 | 222 | #ifndef _LIBCPP_NO_RTTI |
| 240 | virtual const void* __get_deleter(const type_info&) const _NOEXCEPT; | |
| 223 | const void* __get_deleter(const type_info&) const _NOEXCEPT override; | |
| 241 | 224 | #endif |
| 242 | 225 | |
| 243 | 226 | private: |
| 244 | virtual void __on_zero_shared() _NOEXCEPT; | |
| 245 | virtual void __on_zero_shared_weak() _NOEXCEPT; | |
| 227 | void __on_zero_shared() _NOEXCEPT override; | |
| 228 | void __on_zero_shared_weak() _NOEXCEPT override; | |
| 246 | 229 | }; |
| 247 | 230 | |
| 248 | 231 | #ifndef _LIBCPP_NO_RTTI |
| ... | ... | @@ -277,6 +260,8 @@ __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT |
| 277 | 260 | __a.deallocate(_PTraits::pointer_to(*this), 1); |
| 278 | 261 | } |
| 279 | 262 | |
| 263 | struct __default_initialize_tag {}; | |
| 264 | ||
| 280 | 265 | template <class _Tp, class _Alloc> |
| 281 | 266 | struct __shared_ptr_emplace |
| 282 | 267 | : __shared_weak_count |
| ... | ... | @@ -295,6 +280,16 @@ struct __shared_ptr_emplace |
| 295 | 280 | #endif |
| 296 | 281 | } |
| 297 | 282 | |
| 283 | ||
| 284 | #if _LIBCPP_STD_VER >= 20 | |
| 285 | _LIBCPP_HIDE_FROM_ABI | |
| 286 | explicit __shared_ptr_emplace(__default_initialize_tag, _Alloc __a) | |
| 287 | : __storage_(std::move(__a)) | |
| 288 | { | |
| 289 | ::new ((void*)__get_elem()) _Tp; | |
| 290 | } | |
| 291 | #endif | |
| 292 | ||
| 298 | 293 | _LIBCPP_HIDE_FROM_ABI |
| 299 | 294 | _Alloc* __get_alloc() _NOEXCEPT { return __storage_.__get_alloc(); } |
| 300 | 295 | |
| ... | ... | @@ -302,7 +297,7 @@ struct __shared_ptr_emplace |
| 302 | 297 | _Tp* __get_elem() _NOEXCEPT { return __storage_.__get_elem(); } |
| 303 | 298 | |
| 304 | 299 | private: |
| 305 | virtual void __on_zero_shared() _NOEXCEPT { | |
| 300 | void __on_zero_shared() _NOEXCEPT override { | |
| 306 | 301 | #if _LIBCPP_STD_VER > 17 |
| 307 | 302 | using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type; |
| 308 | 303 | _TpAlloc __tmp(*__get_alloc()); |
| ... | ... | @@ -312,7 +307,7 @@ private: |
| 312 | 307 | #endif |
| 313 | 308 | } |
| 314 | 309 | |
| 315 | virtual void __on_zero_shared_weak() _NOEXCEPT { | |
| 310 | void __on_zero_shared_weak() _NOEXCEPT override { | |
| 316 | 311 | using _ControlBlockAlloc = typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type; |
| 317 | 312 | using _ControlBlockPointer = typename allocator_traits<_ControlBlockAlloc>::pointer; |
| 318 | 313 | _ControlBlockAlloc __tmp(*__get_alloc()); |
| ... | ... | @@ -383,22 +378,22 @@ struct __compatible_with |
| 383 | 378 | template <class _Ptr, class = void> |
| 384 | 379 | struct __is_deletable : false_type { }; |
| 385 | 380 | template <class _Ptr> |
| 386 | struct __is_deletable<_Ptr, decltype(delete declval<_Ptr>())> : true_type { }; | |
| 381 | struct __is_deletable<_Ptr, decltype(delete std::declval<_Ptr>())> : true_type { }; | |
| 387 | 382 | |
| 388 | 383 | template <class _Ptr, class = void> |
| 389 | 384 | struct __is_array_deletable : false_type { }; |
| 390 | 385 | template <class _Ptr> |
| 391 | struct __is_array_deletable<_Ptr, decltype(delete[] declval<_Ptr>())> : true_type { }; | |
| 386 | struct __is_array_deletable<_Ptr, decltype(delete[] std::declval<_Ptr>())> : true_type { }; | |
| 392 | 387 | |
| 393 | 388 | template <class _Dp, class _Pt, |
| 394 | class = decltype(declval<_Dp>()(declval<_Pt>()))> | |
| 389 | class = decltype(std::declval<_Dp>()(std::declval<_Pt>()))> | |
| 395 | 390 | static true_type __well_formed_deleter_test(int); |
| 396 | 391 | |
| 397 | 392 | template <class, class> |
| 398 | 393 | static false_type __well_formed_deleter_test(...); |
| 399 | 394 | |
| 400 | 395 | template <class _Dp, class _Pt> |
| 401 | struct __well_formed_deleter : decltype(__well_formed_deleter_test<_Dp, _Pt>(0)) {}; | |
| 396 | struct __well_formed_deleter : decltype(std::__well_formed_deleter_test<_Dp, _Pt>(0)) {}; | |
| 402 | 397 | |
| 403 | 398 | template<class _Dp, class _Tp, class _Yp> |
| 404 | 399 | struct __shared_ptr_deleter_ctor_reqs |
| ... | ... | @@ -687,7 +682,7 @@ public: |
| 687 | 682 | { |
| 688 | 683 | typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; |
| 689 | 684 | typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer, |
| 690 | reference_wrapper<typename remove_reference<_Dp>::type>, | |
| 685 | reference_wrapper<__libcpp_remove_reference_t<_Dp> >, | |
| 691 | 686 | _AllocT> _CntrlBlk; |
| 692 | 687 | __cntrl_ = new _CntrlBlk(__r.get(), _VSTD::ref(__r.get_deleter()), _AllocT()); |
| 693 | 688 | __enable_weak_this(__r.get(), __r.get()); |
| ... | ... | @@ -802,7 +797,7 @@ public: |
| 802 | 797 | } |
| 803 | 798 | |
| 804 | 799 | _LIBCPP_HIDE_FROM_ABI |
| 805 | typename add_lvalue_reference<element_type>::type operator*() const _NOEXCEPT | |
| 800 | __add_lvalue_reference_t<element_type> operator*() const _NOEXCEPT | |
| 806 | 801 | { |
| 807 | 802 | return *__ptr_; |
| 808 | 803 | } |
| ... | ... | @@ -855,7 +850,7 @@ public: |
| 855 | 850 | |
| 856 | 851 | #if _LIBCPP_STD_VER > 14 |
| 857 | 852 | _LIBCPP_HIDE_FROM_ABI |
| 858 | typename add_lvalue_reference<element_type>::type operator[](ptrdiff_t __i) const | |
| 853 | __add_lvalue_reference_t<element_type> operator[](ptrdiff_t __i) const | |
| 859 | 854 | { |
| 860 | 855 | static_assert(is_array<_Tp>::value, |
| 861 | 856 | "std::shared_ptr<T>::operator[] is only valid when T is an array type."); |
| ... | ... | @@ -904,7 +899,7 @@ private: |
| 904 | 899 | _LIBCPP_HIDE_FROM_ABI |
| 905 | 900 | void __enable_weak_this(const enable_shared_from_this<_Yp>* __e, _OrigPtr* __ptr) _NOEXCEPT |
| 906 | 901 | { |
| 907 | typedef typename remove_cv<_Yp>::type _RawYp; | |
| 902 | typedef __remove_cv_t<_Yp> _RawYp; | |
| 908 | 903 | if (__e && __e->__weak_this_.expired()) |
| 909 | 904 | { |
| 910 | 905 | __e->__weak_this_ = shared_ptr<_RawYp>(*this, |
| ... | ... | @@ -962,6 +957,29 @@ shared_ptr<_Tp> make_shared(_Args&& ...__args) |
| 962 | 957 | return _VSTD::allocate_shared<_Tp>(allocator<_Tp>(), _VSTD::forward<_Args>(__args)...); |
| 963 | 958 | } |
| 964 | 959 | |
| 960 | #if _LIBCPP_STD_VER >= 20 | |
| 961 | ||
| 962 | template<class _Tp, class _Alloc, __enable_if_t<!is_array<_Tp>::value, int> = 0> | |
| 963 | _LIBCPP_HIDE_FROM_ABI | |
| 964 | shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) | |
| 965 | { | |
| 966 | using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>; | |
| 967 | using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type; | |
| 968 | __allocation_guard<_ControlBlockAllocator> __guard(__a, 1); | |
| 969 | ::new ((void*)_VSTD::addressof(*__guard.__get())) _ControlBlock(__default_initialize_tag{}, __a); | |
| 970 | auto __control_block = __guard.__release_ptr(); | |
| 971 | return shared_ptr<_Tp>::__create_with_control_block((*__control_block).__get_elem(), _VSTD::addressof(*__control_block)); | |
| 972 | } | |
| 973 | ||
| 974 | template<class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0> | |
| 975 | _LIBCPP_HIDE_FROM_ABI | |
| 976 | shared_ptr<_Tp> make_shared_for_overwrite() | |
| 977 | { | |
| 978 | return std::allocate_shared_for_overwrite<_Tp>(allocator<_Tp>()); | |
| 979 | } | |
| 980 | ||
| 981 | #endif // _LIBCPP_STD_VER >= 20 | |
| 982 | ||
| 965 | 983 | #if _LIBCPP_STD_VER > 14 |
| 966 | 984 | |
| 967 | 985 | template <size_t _Alignment> |
| ... | ... | @@ -992,6 +1010,17 @@ struct __unbounded_array_control_block<_Tp[], _Alloc> : __shared_weak_count |
| 992 | 1010 | std::__uninitialized_allocator_value_construct_n(__alloc_, std::begin(__data_), __count_); |
| 993 | 1011 | } |
| 994 | 1012 | |
| 1013 | #if _LIBCPP_STD_VER >= 20 | |
| 1014 | _LIBCPP_HIDE_FROM_ABI | |
| 1015 | explicit __unbounded_array_control_block(_Alloc const& __alloc, size_t __count, __default_initialize_tag) | |
| 1016 | : __alloc_(__alloc), __count_(__count) | |
| 1017 | { | |
| 1018 | // We are purposefully not using an allocator-aware default construction because the spec says so. | |
| 1019 | // There's currently no way of expressing default initialization in an allocator-aware manner anyway. | |
| 1020 | std::uninitialized_default_construct_n(std::begin(__data_), __count_); | |
| 1021 | } | |
| 1022 | #endif | |
| 1023 | ||
| 995 | 1024 | // Returns the number of bytes required to store a control block followed by the given number |
| 996 | 1025 | // of elements of _Tp, with the whole storage being aligned to a multiple of _Tp's alignment. |
| 997 | 1026 | _LIBCPP_HIDE_FROM_ABI |
| ... | ... | @@ -1008,7 +1037,7 @@ struct __unbounded_array_control_block<_Tp[], _Alloc> : __shared_weak_count |
| 1008 | 1037 | return (__bytes + __align - 1) & ~(__align - 1); |
| 1009 | 1038 | } |
| 1010 | 1039 | |
| 1011 | _LIBCPP_HIDE_FROM_ABI | |
| 1040 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL | |
| 1012 | 1041 | ~__unbounded_array_control_block() override { } // can't be `= default` because of the sometimes-non-trivial union member __data_ |
| 1013 | 1042 | |
| 1014 | 1043 | private: |
| ... | ... | @@ -1075,7 +1104,16 @@ struct __bounded_array_control_block<_Tp[_Count], _Alloc> |
| 1075 | 1104 | std::__uninitialized_allocator_value_construct_n(__alloc_, std::addressof(__data_[0]), _Count); |
| 1076 | 1105 | } |
| 1077 | 1106 | |
| 1107 | #if _LIBCPP_STD_VER >= 20 | |
| 1078 | 1108 | _LIBCPP_HIDE_FROM_ABI |
| 1109 | explicit __bounded_array_control_block(_Alloc const& __alloc, __default_initialize_tag) : __alloc_(__alloc) { | |
| 1110 | // We are purposefully not using an allocator-aware default construction because the spec says so. | |
| 1111 | // There's currently no way of expressing default initialization in an allocator-aware manner anyway. | |
| 1112 | std::uninitialized_default_construct_n(std::addressof(__data_[0]), _Count); | |
| 1113 | } | |
| 1114 | #endif | |
| 1115 | ||
| 1116 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL | |
| 1079 | 1117 | ~__bounded_array_control_block() override { } // can't be `= default` because of the sometimes-non-trivial union member __data_ |
| 1080 | 1118 | |
| 1081 | 1119 | private: |
| ... | ... | @@ -1118,6 +1156,7 @@ shared_ptr<_Array> __allocate_shared_bounded_array(const _Alloc& __a, _Arg&& ... |
| 1118 | 1156 | |
| 1119 | 1157 | #if _LIBCPP_STD_VER > 17 |
| 1120 | 1158 | |
| 1159 | // bounded array variants | |
| 1121 | 1160 | template<class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>> |
| 1122 | 1161 | _LIBCPP_HIDE_FROM_ABI |
| 1123 | 1162 | shared_ptr<_Tp> allocate_shared(const _Alloc& __a) |
| ... | ... | @@ -1132,18 +1171,11 @@ shared_ptr<_Tp> allocate_shared(const _Alloc& __a, const remove_extent_t<_Tp>& _ |
| 1132 | 1171 | return std::__allocate_shared_bounded_array<_Tp>(__a, __u); |
| 1133 | 1172 | } |
| 1134 | 1173 | |
| 1135 | template<class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>> | |
| 1174 | template<class _Tp, class _Alloc, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0> | |
| 1136 | 1175 | _LIBCPP_HIDE_FROM_ABI |
| 1137 | shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n) | |
| 1176 | shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) | |
| 1138 | 1177 | { |
| 1139 | return std::__allocate_shared_unbounded_array<_Tp>(__a, __n); | |
| 1140 | } | |
| 1141 | ||
| 1142 | template<class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>> | |
| 1143 | _LIBCPP_HIDE_FROM_ABI | |
| 1144 | shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n, const remove_extent_t<_Tp>& __u) | |
| 1145 | { | |
| 1146 | return std::__allocate_shared_unbounded_array<_Tp>(__a, __n, __u); | |
| 1178 | return std::__allocate_shared_bounded_array<_Tp>(__a, __default_initialize_tag{}); | |
| 1147 | 1179 | } |
| 1148 | 1180 | |
| 1149 | 1181 | template<class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>> |
| ... | ... | @@ -1160,6 +1192,35 @@ shared_ptr<_Tp> make_shared(const remove_extent_t<_Tp>& __u) |
| 1160 | 1192 | return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>(), __u); |
| 1161 | 1193 | } |
| 1162 | 1194 | |
| 1195 | template<class _Tp, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0> | |
| 1196 | _LIBCPP_HIDE_FROM_ABI | |
| 1197 | shared_ptr<_Tp> make_shared_for_overwrite() | |
| 1198 | { | |
| 1199 | return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>(), __default_initialize_tag{}); | |
| 1200 | } | |
| 1201 | ||
| 1202 | // unbounded array variants | |
| 1203 | template<class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>> | |
| 1204 | _LIBCPP_HIDE_FROM_ABI | |
| 1205 | shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n) | |
| 1206 | { | |
| 1207 | return std::__allocate_shared_unbounded_array<_Tp>(__a, __n); | |
| 1208 | } | |
| 1209 | ||
| 1210 | template<class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>> | |
| 1211 | _LIBCPP_HIDE_FROM_ABI | |
| 1212 | shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n, const remove_extent_t<_Tp>& __u) | |
| 1213 | { | |
| 1214 | return std::__allocate_shared_unbounded_array<_Tp>(__a, __n, __u); | |
| 1215 | } | |
| 1216 | ||
| 1217 | template<class _Tp, class _Alloc, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0> | |
| 1218 | _LIBCPP_HIDE_FROM_ABI | |
| 1219 | shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a, size_t __n) | |
| 1220 | { | |
| 1221 | return std::__allocate_shared_unbounded_array<_Tp>(__a, __n, __default_initialize_tag{}); | |
| 1222 | } | |
| 1223 | ||
| 1163 | 1224 | template<class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>> |
| 1164 | 1225 | _LIBCPP_HIDE_FROM_ABI |
| 1165 | 1226 | shared_ptr<_Tp> make_shared(size_t __n) |
| ... | ... | @@ -1174,6 +1235,13 @@ shared_ptr<_Tp> make_shared(size_t __n, const remove_extent_t<_Tp>& __u) |
| 1174 | 1235 | return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n, __u); |
| 1175 | 1236 | } |
| 1176 | 1237 | |
| 1238 | template<class _Tp, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0> | |
| 1239 | _LIBCPP_HIDE_FROM_ABI | |
| 1240 | shared_ptr<_Tp> make_shared_for_overwrite(size_t __n) | |
| 1241 | { | |
| 1242 | return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n, __default_initialize_tag{}); | |
| 1243 | } | |
| 1244 | ||
| 1177 | 1245 | #endif // _LIBCPP_STD_VER > 17 |
| 1178 | 1246 | |
| 1179 | 1247 | template<class _Tp, class _Up> |
| ... | ... | @@ -1184,6 +1252,8 @@ operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT |
| 1184 | 1252 | return __x.get() == __y.get(); |
| 1185 | 1253 | } |
| 1186 | 1254 | |
| 1255 | #if _LIBCPP_STD_VER <= 17 | |
| 1256 | ||
| 1187 | 1257 | template<class _Tp, class _Up> |
| 1188 | 1258 | inline _LIBCPP_INLINE_VISIBILITY |
| 1189 | 1259 | bool |
| ... | ... | @@ -1230,6 +1300,17 @@ operator>=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT |
| 1230 | 1300 | return !(__x < __y); |
| 1231 | 1301 | } |
| 1232 | 1302 | |
| 1303 | #endif // _LIBCPP_STD_VER <= 17 | |
| 1304 | ||
| 1305 | #if _LIBCPP_STD_VER > 17 | |
| 1306 | template<class _Tp, class _Up> | |
| 1307 | _LIBCPP_HIDE_FROM_ABI strong_ordering | |
| 1308 | operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept | |
| 1309 | { | |
| 1310 | return compare_three_way()(__x.get(), __y.get()); | |
| 1311 | } | |
| 1312 | #endif | |
| 1313 | ||
| 1233 | 1314 | template<class _Tp> |
| 1234 | 1315 | inline _LIBCPP_INLINE_VISIBILITY |
| 1235 | 1316 | bool |
| ... | ... | @@ -1238,6 +1319,8 @@ operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT |
| 1238 | 1319 | return !__x; |
| 1239 | 1320 | } |
| 1240 | 1321 | |
| 1322 | #if _LIBCPP_STD_VER <= 17 | |
| 1323 | ||
| 1241 | 1324 | template<class _Tp> |
| 1242 | 1325 | inline _LIBCPP_INLINE_VISIBILITY |
| 1243 | 1326 | bool |
| ... | ... | @@ -1326,6 +1409,17 @@ operator>=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT |
| 1326 | 1409 | return !(nullptr < __x); |
| 1327 | 1410 | } |
| 1328 | 1411 | |
| 1412 | #endif // _LIBCPP_STD_VER <= 17 | |
| 1413 | ||
| 1414 | #if _LIBCPP_STD_VER > 17 | |
| 1415 | template<class _Tp> | |
| 1416 | _LIBCPP_HIDE_FROM_ABI strong_ordering | |
| 1417 | operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept | |
| 1418 | { | |
| 1419 | return compare_three_way()(__x.get(), static_cast<typename shared_ptr<_Tp>::element_type*>(nullptr)); | |
| 1420 | } | |
| 1421 | #endif | |
| 1422 | ||
| 1329 | 1423 | template<class _Tp> |
| 1330 | 1424 | inline _LIBCPP_INLINE_VISIBILITY |
| 1331 | 1425 | void |
| ... | ... | @@ -1355,7 +1449,7 @@ dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT |
| 1355 | 1449 | } |
| 1356 | 1450 | |
| 1357 | 1451 | template<class _Tp, class _Up> |
| 1358 | shared_ptr<_Tp> | |
| 1452 | _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> | |
| 1359 | 1453 | const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT |
| 1360 | 1454 | { |
| 1361 | 1455 | typedef typename shared_ptr<_Tp>::element_type _RTp; |
| ... | ... | @@ -1363,7 +1457,7 @@ const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT |
| 1363 | 1457 | } |
| 1364 | 1458 | |
| 1365 | 1459 | template<class _Tp, class _Up> |
| 1366 | shared_ptr<_Tp> | |
| 1460 | _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> | |
| 1367 | 1461 | reinterpret_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT |
| 1368 | 1462 | { |
| 1369 | 1463 | return shared_ptr<_Tp>(__r, |
| ... | ... | @@ -1771,7 +1865,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p); |
| 1771 | 1865 | |
| 1772 | 1866 | class _LIBCPP_TYPE_VIS __sp_mut |
| 1773 | 1867 | { |
| 1774 | void* __lx; | |
| 1868 | void* __lx_; | |
| 1775 | 1869 | public: |
| 1776 | 1870 | void lock() _NOEXCEPT; |
| 1777 | 1871 | void unlock() _NOEXCEPT; |
| ... | ... | @@ -1797,10 +1891,10 @@ atomic_is_lock_free(const shared_ptr<_Tp>*) |
| 1797 | 1891 | |
| 1798 | 1892 | template <class _Tp> |
| 1799 | 1893 | _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR |
| 1800 | shared_ptr<_Tp> | |
| 1894 | _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> | |
| 1801 | 1895 | atomic_load(const shared_ptr<_Tp>* __p) |
| 1802 | 1896 | { |
| 1803 | __sp_mut& __m = __get_sp_mut(__p); | |
| 1897 | __sp_mut& __m = std::__get_sp_mut(__p); | |
| 1804 | 1898 | __m.lock(); |
| 1805 | 1899 | shared_ptr<_Tp> __q = *__p; |
| 1806 | 1900 | __m.unlock(); |
| ... | ... | @@ -1813,15 +1907,15 @@ _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR |
| 1813 | 1907 | shared_ptr<_Tp> |
| 1814 | 1908 | atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) |
| 1815 | 1909 | { |
| 1816 | return atomic_load(__p); | |
| 1910 | return std::atomic_load(__p); | |
| 1817 | 1911 | } |
| 1818 | 1912 | |
| 1819 | 1913 | template <class _Tp> |
| 1820 | 1914 | _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR |
| 1821 | void | |
| 1915 | _LIBCPP_HIDE_FROM_ABI void | |
| 1822 | 1916 | atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) |
| 1823 | 1917 | { |
| 1824 | __sp_mut& __m = __get_sp_mut(__p); | |
| 1918 | __sp_mut& __m = std::__get_sp_mut(__p); | |
| 1825 | 1919 | __m.lock(); |
| 1826 | 1920 | __p->swap(__r); |
| 1827 | 1921 | __m.unlock(); |
| ... | ... | @@ -1833,15 +1927,15 @@ _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR |
| 1833 | 1927 | void |
| 1834 | 1928 | atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) |
| 1835 | 1929 | { |
| 1836 | atomic_store(__p, __r); | |
| 1930 | std::atomic_store(__p, __r); | |
| 1837 | 1931 | } |
| 1838 | 1932 | |
| 1839 | 1933 | template <class _Tp> |
| 1840 | 1934 | _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR |
| 1841 | shared_ptr<_Tp> | |
| 1935 | _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> | |
| 1842 | 1936 | atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) |
| 1843 | 1937 | { |
| 1844 | __sp_mut& __m = __get_sp_mut(__p); | |
| 1938 | __sp_mut& __m = std::__get_sp_mut(__p); | |
| 1845 | 1939 | __m.lock(); |
| 1846 | 1940 | __p->swap(__r); |
| 1847 | 1941 | __m.unlock(); |
| ... | ... | @@ -1854,16 +1948,16 @@ _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR |
| 1854 | 1948 | shared_ptr<_Tp> |
| 1855 | 1949 | atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) |
| 1856 | 1950 | { |
| 1857 | return atomic_exchange(__p, __r); | |
| 1951 | return std::atomic_exchange(__p, __r); | |
| 1858 | 1952 | } |
| 1859 | 1953 | |
| 1860 | 1954 | template <class _Tp> |
| 1861 | 1955 | _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR |
| 1862 | bool | |
| 1956 | _LIBCPP_HIDE_FROM_ABI bool | |
| 1863 | 1957 | atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) |
| 1864 | 1958 | { |
| 1865 | 1959 | shared_ptr<_Tp> __temp; |
| 1866 | __sp_mut& __m = __get_sp_mut(__p); | |
| 1960 | __sp_mut& __m = std::__get_sp_mut(__p); | |
| 1867 | 1961 | __m.lock(); |
| 1868 | 1962 | if (__p->__owner_equivalent(*__v)) |
| 1869 | 1963 | { |
| ... | ... | @@ -1884,7 +1978,7 @@ _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR |
| 1884 | 1978 | bool |
| 1885 | 1979 | atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) |
| 1886 | 1980 | { |
| 1887 | return atomic_compare_exchange_strong(__p, __v, __w); | |
| 1981 | return std::atomic_compare_exchange_strong(__p, __v, __w); | |
| 1888 | 1982 | } |
| 1889 | 1983 | |
| 1890 | 1984 | template <class _Tp> |
| ... | ... | @@ -1894,7 +1988,7 @@ bool |
| 1894 | 1988 | atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, |
| 1895 | 1989 | shared_ptr<_Tp> __w, memory_order, memory_order) |
| 1896 | 1990 | { |
| 1897 | return atomic_compare_exchange_strong(__p, __v, __w); | |
| 1991 | return std::atomic_compare_exchange_strong(__p, __v, __w); | |
| 1898 | 1992 | } |
| 1899 | 1993 | |
| 1900 | 1994 | template <class _Tp> |
| ... | ... | @@ -1904,7 +1998,7 @@ bool |
| 1904 | 1998 | atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, |
| 1905 | 1999 | shared_ptr<_Tp> __w, memory_order, memory_order) |
| 1906 | 2000 | { |
| 1907 | return atomic_compare_exchange_weak(__p, __v, __w); | |
| 2001 | return std::atomic_compare_exchange_weak(__p, __v, __w); | |
| 1908 | 2002 | } |
| 1909 | 2003 | |
| 1910 | 2004 | #endif // !defined(_LIBCPP_HAS_NO_THREADS) |
lib/libcxx/include/__memory/swap_allocator.h+4-3| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__memory/allocator_traits.h> |
| 14 | 14 | #include <__type_traits/integral_constant.h> |
| 15 | #include <__type_traits/is_swappable.h> | |
| 15 | 16 | #include <__utility/swap.h> |
| 16 | 17 | |
| 17 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -21,7 +22,7 @@ |
| 21 | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 23 | |
| 23 | 24 | template <typename _Alloc> |
| 24 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 void __swap_allocator(_Alloc& __a1, _Alloc& __a2, true_type) | |
| 25 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swap_allocator(_Alloc& __a1, _Alloc& __a2, true_type) | |
| 25 | 26 | #if _LIBCPP_STD_VER > 11 |
| 26 | 27 | _NOEXCEPT |
| 27 | 28 | #else |
| ... | ... | @@ -33,11 +34,11 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 void __swap_allocator(_Alloc |
| 33 | 34 | } |
| 34 | 35 | |
| 35 | 36 | template <typename _Alloc> |
| 36 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 void | |
| 37 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void | |
| 37 | 38 | __swap_allocator(_Alloc&, _Alloc&, false_type) _NOEXCEPT {} |
| 38 | 39 | |
| 39 | 40 | template <typename _Alloc> |
| 40 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 void __swap_allocator(_Alloc& __a1, _Alloc& __a2) | |
| 41 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swap_allocator(_Alloc& __a1, _Alloc& __a2) | |
| 41 | 42 | #if _LIBCPP_STD_VER > 11 |
| 42 | 43 | _NOEXCEPT |
| 43 | 44 | #else |
lib/libcxx/include/__memory/temp_value.h created+56| ... | ... | @@ -0,0 +1,56 @@ |
| 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_TEMP_VALUE_H | |
| 10 | #define _LIBCPP___MEMORY_TEMP_VALUE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__memory/addressof.h> | |
| 14 | #include <__memory/allocator_traits.h> | |
| 15 | #include <__type_traits/aligned_storage.h> | |
| 16 | #include <__utility/forward.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 | template <class _Tp, class _Alloc> | |
| 25 | struct __temp_value { | |
| 26 | typedef allocator_traits<_Alloc> _Traits; | |
| 27 | ||
| 28 | #ifdef _LIBCPP_CXX03_LANG | |
| 29 | typename aligned_storage<sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)>::type __v; | |
| 30 | #else | |
| 31 | union { _Tp __v; }; | |
| 32 | #endif | |
| 33 | _Alloc &__a; | |
| 34 | ||
| 35 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp *__addr() { | |
| 36 | #ifdef _LIBCPP_CXX03_LANG | |
| 37 | return reinterpret_cast<_Tp*>(std::addressof(__v)); | |
| 38 | #else | |
| 39 | return std::addressof(__v); | |
| 40 | #endif | |
| 41 | } | |
| 42 | ||
| 43 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp & get() { return *__addr(); } | |
| 44 | ||
| 45 | template<class... _Args> | |
| 46 | _LIBCPP_NO_CFI | |
| 47 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc) { | |
| 48 | _Traits::construct(__a, __addr(), std::forward<_Args>(__args)...); | |
| 49 | } | |
| 50 | ||
| 51 | _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__temp_value() { _Traits::destroy(__a, __addr()); } | |
| 52 | }; | |
| 53 | ||
| 54 | _LIBCPP_END_NAMESPACE_STD | |
| 55 | ||
| 56 | #endif // _LIBCPP___MEMORY_TEMP_VALUE_H |
lib/libcxx/include/__memory/temporary_buffer.h+1-1| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | |
| 25 | 25 | template <class _Tp> |
| 26 | _LIBCPP_NODISCARD_EXT _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17 | |
| 26 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17 | |
| 27 | 27 | pair<_Tp*, ptrdiff_t> |
| 28 | 28 | get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT |
| 29 | 29 | { |
lib/libcxx/include/__memory/uninitialized_algorithms.h+37-33| ... | ... | @@ -20,11 +20,21 @@ |
| 20 | 20 | #include <__memory/construct_at.h> |
| 21 | 21 | #include <__memory/pointer_traits.h> |
| 22 | 22 | #include <__memory/voidify.h> |
| 23 | #include <__type_traits/extent.h> | |
| 24 | #include <__type_traits/is_array.h> | |
| 23 | 25 | #include <__type_traits/is_constant_evaluated.h> |
| 26 | #include <__type_traits/is_trivially_copy_assignable.h> | |
| 27 | #include <__type_traits/is_trivially_copy_constructible.h> | |
| 28 | #include <__type_traits/is_trivially_move_assignable.h> | |
| 29 | #include <__type_traits/is_trivially_move_constructible.h> | |
| 30 | #include <__type_traits/is_unbounded_array.h> | |
| 31 | #include <__type_traits/negation.h> | |
| 32 | #include <__type_traits/remove_const.h> | |
| 33 | #include <__type_traits/remove_extent.h> | |
| 34 | #include <__utility/exception_guard.h> | |
| 24 | 35 | #include <__utility/move.h> |
| 25 | 36 | #include <__utility/pair.h> |
| 26 | #include <__utility/transaction.h> | |
| 27 | #include <type_traits> | |
| 37 | #include <new> | |
| 28 | 38 | |
| 29 | 39 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 30 | 40 | # pragma GCC system_header |
| ... | ... | @@ -64,6 +74,7 @@ __uninitialized_copy(_InputIterator __ifirst, _Sentinel1 __ilast, |
| 64 | 74 | } |
| 65 | 75 | |
| 66 | 76 | template <class _InputIterator, class _ForwardIterator> |
| 77 | _LIBCPP_HIDE_FROM_ABI | |
| 67 | 78 | _ForwardIterator uninitialized_copy(_InputIterator __ifirst, _InputIterator __ilast, |
| 68 | 79 | _ForwardIterator __ofirst) { |
| 69 | 80 | typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; |
| ... | ... | @@ -282,7 +293,7 @@ template <class _ForwardIterator, class _Size> |
| 282 | 293 | inline _LIBCPP_HIDE_FROM_ABI |
| 283 | 294 | _ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) { |
| 284 | 295 | using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; |
| 285 | return __uninitialized_value_construct_n<_ValueType>(_VSTD::move(__first), __n); | |
| 296 | return std::__uninitialized_value_construct_n<_ValueType>(_VSTD::move(__first), __n); | |
| 286 | 297 | } |
| 287 | 298 | |
| 288 | 299 | // uninitialized_move |
| ... | ... | @@ -410,7 +421,10 @@ constexpr void __allocator_construct_at(_Alloc& __alloc, _Tp* __loc) { |
| 410 | 421 | _Tp& __array = *__loc; |
| 411 | 422 | |
| 412 | 423 | // If an exception is thrown, destroy what we have constructed so far in reverse order. |
| 413 | __transaction __guard([&]() { std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i); }); | |
| 424 | __exception_guard __guard([&]() { | |
| 425 | std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i); | |
| 426 | }); | |
| 427 | ||
| 414 | 428 | for (; __i != extent_v<_Tp>; ++__i) { |
| 415 | 429 | std::__allocator_construct_at(__elem_alloc, std::addressof(__array[__i])); |
| 416 | 430 | } |
| ... | ... | @@ -447,7 +461,9 @@ constexpr void __allocator_construct_at(_Alloc& __alloc, _Tp* __loc, _Arg const& |
| 447 | 461 | _Tp& __array = *__loc; |
| 448 | 462 | |
| 449 | 463 | // If an exception is thrown, destroy what we have constructed so far in reverse order. |
| 450 | __transaction __guard([&]() { std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i); }); | |
| 464 | __exception_guard __guard([&]() { | |
| 465 | std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i); | |
| 466 | }); | |
| 451 | 467 | for (; __i != extent_v<_Tp>; ++__i) { |
| 452 | 468 | std::__allocator_construct_at(__elem_alloc, std::addressof(__array[__i]), __arg[__i]); |
| 453 | 469 | } |
| ... | ... | @@ -472,7 +488,7 @@ constexpr void __uninitialized_allocator_fill_n(_Alloc& __alloc, _BidirIter __it |
| 472 | 488 | _BidirIter __begin = __it; |
| 473 | 489 | |
| 474 | 490 | // If an exception is thrown, destroy what we have constructed so far in reverse order. |
| 475 | __transaction __guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); | |
| 491 | __exception_guard __guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); | |
| 476 | 492 | for (; __n != 0; --__n, ++__it) { |
| 477 | 493 | std::__allocator_construct_at(__value_alloc, std::addressof(*__it), __value); |
| 478 | 494 | } |
| ... | ... | @@ -489,7 +505,7 @@ constexpr void __uninitialized_allocator_value_construct_n(_Alloc& __alloc, _Bid |
| 489 | 505 | _BidirIter __begin = __it; |
| 490 | 506 | |
| 491 | 507 | // If an exception is thrown, destroy what we have constructed so far in reverse order. |
| 492 | __transaction __guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); | |
| 508 | __exception_guard __guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); | |
| 493 | 509 | for (; __n != 0; --__n, ++__it) { |
| 494 | 510 | std::__allocator_construct_at(__value_alloc, std::addressof(*__it)); |
| 495 | 511 | } |
| ... | ... | @@ -500,7 +516,7 @@ constexpr void __uninitialized_allocator_value_construct_n(_Alloc& __alloc, _Bid |
| 500 | 516 | |
| 501 | 517 | // Destroy all elements in [__first, __last) from left to right using allocator destruction. |
| 502 | 518 | template <class _Alloc, class _Iter, class _Sent> |
| 503 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 519 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 504 | 520 | __allocator_destroy(_Alloc& __alloc, _Iter __first, _Sent __last) { |
| 505 | 521 | for (; __first != __last; ++__first) |
| 506 | 522 | allocator_traits<_Alloc>::destroy(__alloc, std::__to_address(__first)); |
| ... | ... | @@ -509,11 +525,11 @@ __allocator_destroy(_Alloc& __alloc, _Iter __first, _Sent __last) { |
| 509 | 525 | template <class _Alloc, class _Iter> |
| 510 | 526 | class _AllocatorDestroyRangeReverse { |
| 511 | 527 | public: |
| 512 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 528 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 513 | 529 | _AllocatorDestroyRangeReverse(_Alloc& __alloc, _Iter& __first, _Iter& __last) |
| 514 | 530 | : __alloc_(__alloc), __first_(__first), __last_(__last) {} |
| 515 | 531 | |
| 516 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 void operator()() const { | |
| 532 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void operator()() const { | |
| 517 | 533 | std::__allocator_destroy(__alloc_, std::reverse_iterator<_Iter>(__last_), std::reverse_iterator<_Iter>(__first_)); |
| 518 | 534 | } |
| 519 | 535 | |
| ... | ... | @@ -528,23 +544,17 @@ private: |
| 528 | 544 | // The caller has to ensure that __first2 can hold at least N uninitialized elements. If an exception is thrown the |
| 529 | 545 | // already copied elements are destroyed in reverse order of their construction. |
| 530 | 546 | template <class _Alloc, class _Iter1, class _Sent1, class _Iter2> |
| 531 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter2 | |
| 547 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 | |
| 532 | 548 | __uninitialized_allocator_copy(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2) { |
| 533 | #ifndef _LIBCPP_NO_EXCEPTIONS | |
| 534 | 549 | auto __destruct_first = __first2; |
| 535 | try { | |
| 536 | #endif | |
| 550 | auto __guard = | |
| 551 | std::__make_exception_guard(_AllocatorDestroyRangeReverse<_Alloc, _Iter2>(__alloc, __destruct_first, __first2)); | |
| 537 | 552 | while (__first1 != __last1) { |
| 538 | 553 | allocator_traits<_Alloc>::construct(__alloc, std::__to_address(__first2), *__first1); |
| 539 | 554 | ++__first1; |
| 540 | 555 | ++__first2; |
| 541 | 556 | } |
| 542 | #ifndef _LIBCPP_NO_EXCEPTIONS | |
| 543 | } catch (...) { | |
| 544 | _AllocatorDestroyRangeReverse<_Alloc, _Iter2>(__alloc, __destruct_first, __first2)(); | |
| 545 | throw; | |
| 546 | } | |
| 547 | #endif | |
| 557 | __guard.__complete(); | |
| 548 | 558 | return __first2; |
| 549 | 559 | } |
| 550 | 560 | |
| ... | ... | @@ -556,12 +566,12 @@ struct __allocator_has_trivial_copy_construct<allocator<_Type>, _Type> : true_ty |
| 556 | 566 | |
| 557 | 567 | template <class _Alloc, |
| 558 | 568 | class _Type, |
| 559 | class _RawType = typename remove_const<_Type>::type, | |
| 569 | class _RawType = __remove_const_t<_Type>, | |
| 560 | 570 | __enable_if_t< |
| 561 | 571 | // using _RawType because of the allocator<T const> extension |
| 562 | 572 | is_trivially_copy_constructible<_RawType>::value && is_trivially_copy_assignable<_RawType>::value && |
| 563 | 573 | __allocator_has_trivial_copy_construct<_Alloc, _RawType>::value>* = nullptr> |
| 564 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _Type* | |
| 574 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Type* | |
| 565 | 575 | __uninitialized_allocator_copy(_Alloc&, const _Type* __first1, const _Type* __last1, _Type* __first2) { |
| 566 | 576 | // TODO: Remove the const_cast once we drop support for std::allocator<T const> |
| 567 | 577 | if (__libcpp_is_constant_evaluated()) { |
| ... | ... | @@ -582,14 +592,13 @@ __uninitialized_allocator_copy(_Alloc&, const _Type* __first1, const _Type* __la |
| 582 | 592 | // Otherwise try to copy all elements. If an exception is thrown the already copied |
| 583 | 593 | // elements are destroyed in reverse order of their construction. |
| 584 | 594 | template <class _Alloc, class _Iter1, class _Sent1, class _Iter2> |
| 585 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter2 __uninitialized_allocator_move_if_noexcept( | |
| 595 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 __uninitialized_allocator_move_if_noexcept( | |
| 586 | 596 | _Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2) { |
| 587 | 597 | static_assert(__is_cpp17_move_insertable<_Alloc>::value, |
| 588 | 598 | "The specified type does not meet the requirements of Cpp17MoveInsertable"); |
| 589 | #ifndef _LIBCPP_NO_EXCEPTIONS | |
| 590 | 599 | auto __destruct_first = __first2; |
| 591 | try { | |
| 592 | #endif | |
| 600 | auto __guard = | |
| 601 | std::__make_exception_guard(_AllocatorDestroyRangeReverse<_Alloc, _Iter2>(__alloc, __destruct_first, __first2)); | |
| 593 | 602 | while (__first1 != __last1) { |
| 594 | 603 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 595 | 604 | allocator_traits<_Alloc>::construct(__alloc, std::__to_address(__first2), std::move_if_noexcept(*__first1)); |
| ... | ... | @@ -599,12 +608,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter2 __uninitialized_alloc |
| 599 | 608 | ++__first1; |
| 600 | 609 | ++__first2; |
| 601 | 610 | } |
| 602 | #ifndef _LIBCPP_NO_EXCEPTIONS | |
| 603 | } catch (...) { | |
| 604 | _AllocatorDestroyRangeReverse<_Alloc, _Iter2>(__alloc, __destruct_first, __first2)(); | |
| 605 | throw; | |
| 606 | } | |
| 607 | #endif | |
| 611 | __guard.__complete(); | |
| 608 | 612 | return __first2; |
| 609 | 613 | } |
| 610 | 614 | |
| ... | ... | @@ -622,7 +626,7 @@ template < |
| 622 | 626 | class _Type = typename iterator_traits<_Iter1>::value_type, |
| 623 | 627 | class = __enable_if_t<is_trivially_move_constructible<_Type>::value && is_trivially_move_assignable<_Type>::value && |
| 624 | 628 | __allocator_has_trivial_move_construct<_Alloc, _Type>::value> > |
| 625 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter2 | |
| 629 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 | |
| 626 | 630 | __uninitialized_allocator_move_if_noexcept(_Alloc&, _Iter1 __first1, _Iter1 __last1, _Iter2 __first2) { |
| 627 | 631 | if (__libcpp_is_constant_evaluated()) { |
| 628 | 632 | while (__first1 != __last1) { |
lib/libcxx/include/__memory/unique_ptr.h+197-208| ... | ... | @@ -10,16 +10,35 @@ |
| 10 | 10 | #ifndef _LIBCPP___MEMORY_UNIQUE_PTR_H |
| 11 | 11 | #define _LIBCPP___MEMORY_UNIQUE_PTR_H |
| 12 | 12 | |
| 13 | #include <__compare/compare_three_way.h> | |
| 14 | #include <__compare/compare_three_way_result.h> | |
| 15 | #include <__compare/three_way_comparable.h> | |
| 13 | 16 | #include <__config> |
| 14 | 17 | #include <__functional/hash.h> |
| 15 | 18 | #include <__functional/operations.h> |
| 16 | 19 | #include <__memory/allocator_traits.h> // __pointer |
| 17 | 20 | #include <__memory/auto_ptr.h> |
| 18 | 21 | #include <__memory/compressed_pair.h> |
| 22 | #include <__type_traits/add_lvalue_reference.h> | |
| 23 | #include <__type_traits/common_type.h> | |
| 24 | #include <__type_traits/dependent_type.h> | |
| 25 | #include <__type_traits/integral_constant.h> | |
| 26 | #include <__type_traits/is_array.h> | |
| 27 | #include <__type_traits/is_assignable.h> | |
| 28 | #include <__type_traits/is_constructible.h> | |
| 29 | #include <__type_traits/is_convertible.h> | |
| 30 | #include <__type_traits/is_default_constructible.h> | |
| 31 | #include <__type_traits/is_function.h> | |
| 32 | #include <__type_traits/is_pointer.h> | |
| 33 | #include <__type_traits/is_reference.h> | |
| 34 | #include <__type_traits/is_same.h> | |
| 35 | #include <__type_traits/is_swappable.h> | |
| 36 | #include <__type_traits/is_void.h> | |
| 37 | #include <__type_traits/remove_extent.h> | |
| 38 | #include <__type_traits/type_identity.h> | |
| 19 | 39 | #include <__utility/forward.h> |
| 20 | 40 | #include <__utility/move.h> |
| 21 | 41 | #include <cstddef> |
| 22 | #include <type_traits> | |
| 23 | 42 | |
| 24 | 43 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 25 | 44 | # pragma GCC system_header |
| ... | ... | @@ -37,12 +56,10 @@ struct _LIBCPP_TEMPLATE_VIS default_delete { |
| 37 | 56 | _LIBCPP_INLINE_VISIBILITY default_delete() {} |
| 38 | 57 | #endif |
| 39 | 58 | template <class _Up> |
| 40 | _LIBCPP_INLINE_VISIBILITY | |
| 41 | default_delete(const default_delete<_Up>&, | |
| 42 | typename enable_if<is_convertible<_Up*, _Tp*>::value>::type* = | |
| 43 | 0) _NOEXCEPT {} | |
| 59 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 default_delete( | |
| 60 | const default_delete<_Up>&, typename enable_if<is_convertible<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {} | |
| 44 | 61 | |
| 45 | _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __ptr) const _NOEXCEPT { | |
| 62 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator()(_Tp* __ptr) const _NOEXCEPT { | |
| 46 | 63 | static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type"); |
| 47 | 64 | static_assert(!is_void<_Tp>::value, "cannot delete an incomplete type"); |
| 48 | 65 | delete __ptr; |
| ... | ... | @@ -64,13 +81,11 @@ public: |
| 64 | 81 | #endif |
| 65 | 82 | |
| 66 | 83 | template <class _Up> |
| 67 | _LIBCPP_INLINE_VISIBILITY | |
| 68 | default_delete(const default_delete<_Up[]>&, | |
| 69 | typename _EnableIfConvertible<_Up>::type* = 0) _NOEXCEPT {} | |
| 84 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 85 | default_delete(const default_delete<_Up[]>&, typename _EnableIfConvertible<_Up>::type* = 0) _NOEXCEPT {} | |
| 70 | 86 | |
| 71 | 87 | template <class _Up> |
| 72 | _LIBCPP_INLINE_VISIBILITY | |
| 73 | typename _EnableIfConvertible<_Up>::type | |
| 88 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 typename _EnableIfConvertible<_Up>::type | |
| 74 | 89 | operator()(_Up* __ptr) const _NOEXCEPT { |
| 75 | 90 | static_assert(sizeof(_Up) >= 0, "cannot delete an incomplete type"); |
| 76 | 91 | delete[] __ptr; |
| ... | ... | @@ -172,22 +187,17 @@ public: |
| 172 | 187 | _LIBCPP_INLINE_VISIBILITY |
| 173 | 188 | _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} |
| 174 | 189 | |
| 175 | template <bool _Dummy = true, | |
| 176 | class = _EnableIfDeleterDefaultConstructible<_Dummy> > | |
| 177 | _LIBCPP_INLINE_VISIBILITY | |
| 178 | explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p, __value_init_tag()) {} | |
| 190 | template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > | |
| 191 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT | |
| 192 | : __ptr_(__p, __value_init_tag()) {} | |
| 179 | 193 | |
| 180 | template <bool _Dummy = true, | |
| 181 | class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > | |
| 182 | _LIBCPP_INLINE_VISIBILITY | |
| 183 | unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT | |
| 194 | template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > | |
| 195 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT | |
| 184 | 196 | : __ptr_(__p, __d) {} |
| 185 | 197 | |
| 186 | template <bool _Dummy = true, | |
| 187 | class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > | |
| 188 | _LIBCPP_INLINE_VISIBILITY | |
| 189 | unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT | |
| 190 | : __ptr_(__p, _VSTD::move(__d)) { | |
| 198 | template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > | |
| 199 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 200 | unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT : __ptr_(__p, _VSTD::move(__d)) { | |
| 191 | 201 | static_assert(!is_reference<deleter_type>::value, |
| 192 | 202 | "rvalue deleter bound to reference"); |
| 193 | 203 | } |
| ... | ... | @@ -197,17 +207,14 @@ public: |
| 197 | 207 | _LIBCPP_INLINE_VISIBILITY |
| 198 | 208 | unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete; |
| 199 | 209 | |
| 200 | _LIBCPP_INLINE_VISIBILITY | |
| 201 | unique_ptr(unique_ptr&& __u) _NOEXCEPT | |
| 202 | : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) { | |
| 203 | } | |
| 210 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT | |
| 211 | : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {} | |
| 204 | 212 | |
| 205 | template <class _Up, class _Ep, | |
| 206 | class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, | |
| 207 | class = _EnableIfDeleterConvertible<_Ep> | |
| 208 | > | |
| 209 | _LIBCPP_INLINE_VISIBILITY | |
| 210 | unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT | |
| 213 | template <class _Up, | |
| 214 | class _Ep, | |
| 215 | class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, | |
| 216 | class = _EnableIfDeleterConvertible<_Ep> > | |
| 217 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT | |
| 211 | 218 | : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {} |
| 212 | 219 | |
| 213 | 220 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) |
| ... | ... | @@ -220,19 +227,17 @@ public: |
| 220 | 227 | : __ptr_(__p.release(), __value_init_tag()) {} |
| 221 | 228 | #endif |
| 222 | 229 | |
| 223 | _LIBCPP_INLINE_VISIBILITY | |
| 224 | unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { | |
| 230 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { | |
| 225 | 231 | reset(__u.release()); |
| 226 | 232 | __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter()); |
| 227 | 233 | return *this; |
| 228 | 234 | } |
| 229 | 235 | |
| 230 | template <class _Up, class _Ep, | |
| 231 | class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, | |
| 232 | class = _EnableIfDeleterAssignable<_Ep> | |
| 233 | > | |
| 234 | _LIBCPP_INLINE_VISIBILITY | |
| 235 | unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { | |
| 236 | template <class _Up, | |
| 237 | class _Ep, | |
| 238 | class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, | |
| 239 | class = _EnableIfDeleterAssignable<_Ep> > | |
| 240 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { | |
| 236 | 241 | reset(__u.release()); |
| 237 | 242 | __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); |
| 238 | 243 | return *this; |
| ... | ... | @@ -255,58 +260,44 @@ public: |
| 255 | 260 | unique_ptr& operator=(unique_ptr const&) = delete; |
| 256 | 261 | #endif |
| 257 | 262 | |
| 258 | _LIBCPP_INLINE_VISIBILITY | |
| 259 | ~unique_ptr() { reset(); } | |
| 263 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } | |
| 260 | 264 | |
| 261 | _LIBCPP_INLINE_VISIBILITY | |
| 262 | unique_ptr& operator=(nullptr_t) _NOEXCEPT { | |
| 265 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(nullptr_t) _NOEXCEPT { | |
| 263 | 266 | reset(); |
| 264 | 267 | return *this; |
| 265 | 268 | } |
| 266 | 269 | |
| 267 | _LIBCPP_INLINE_VISIBILITY | |
| 268 | typename add_lvalue_reference<_Tp>::type | |
| 269 | operator*() const { | |
| 270 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const { | |
| 270 | 271 | return *__ptr_.first(); |
| 271 | 272 | } |
| 272 | _LIBCPP_INLINE_VISIBILITY | |
| 273 | pointer operator->() const _NOEXCEPT { | |
| 274 | return __ptr_.first(); | |
| 275 | } | |
| 276 | _LIBCPP_INLINE_VISIBILITY | |
| 277 | pointer get() const _NOEXCEPT { | |
| 273 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator->() const _NOEXCEPT { | |
| 278 | 274 | return __ptr_.first(); |
| 279 | 275 | } |
| 280 | _LIBCPP_INLINE_VISIBILITY | |
| 281 | deleter_type& get_deleter() _NOEXCEPT { | |
| 276 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); } | |
| 277 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { | |
| 282 | 278 | return __ptr_.second(); |
| 283 | 279 | } |
| 284 | _LIBCPP_INLINE_VISIBILITY | |
| 285 | const deleter_type& get_deleter() const _NOEXCEPT { | |
| 280 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT { | |
| 286 | 281 | return __ptr_.second(); |
| 287 | 282 | } |
| 288 | _LIBCPP_INLINE_VISIBILITY | |
| 289 | explicit operator bool() const _NOEXCEPT { | |
| 283 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT { | |
| 290 | 284 | return __ptr_.first() != nullptr; |
| 291 | 285 | } |
| 292 | 286 | |
| 293 | _LIBCPP_INLINE_VISIBILITY | |
| 294 | pointer release() _NOEXCEPT { | |
| 287 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT { | |
| 295 | 288 | pointer __t = __ptr_.first(); |
| 296 | 289 | __ptr_.first() = pointer(); |
| 297 | 290 | return __t; |
| 298 | 291 | } |
| 299 | 292 | |
| 300 | _LIBCPP_INLINE_VISIBILITY | |
| 301 | void reset(pointer __p = pointer()) _NOEXCEPT { | |
| 293 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(pointer __p = pointer()) _NOEXCEPT { | |
| 302 | 294 | pointer __tmp = __ptr_.first(); |
| 303 | 295 | __ptr_.first() = __p; |
| 304 | 296 | if (__tmp) |
| 305 | 297 | __ptr_.second()(__tmp); |
| 306 | 298 | } |
| 307 | 299 | |
| 308 | _LIBCPP_INLINE_VISIBILITY | |
| 309 | void swap(unique_ptr& __u) _NOEXCEPT { | |
| 300 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { | |
| 310 | 301 | __ptr_.swap(__u.__ptr_); |
| 311 | 302 | } |
| 312 | 303 | }; |
| ... | ... | @@ -394,40 +385,36 @@ public: |
| 394 | 385 | _LIBCPP_INLINE_VISIBILITY |
| 395 | 386 | _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} |
| 396 | 387 | |
| 397 | template <class _Pp, bool _Dummy = true, | |
| 398 | class = _EnableIfDeleterDefaultConstructible<_Dummy>, | |
| 399 | class = _EnableIfPointerConvertible<_Pp> > | |
| 400 | _LIBCPP_INLINE_VISIBILITY | |
| 401 | explicit unique_ptr(_Pp __p) _NOEXCEPT | |
| 388 | template <class _Pp, | |
| 389 | bool _Dummy = true, | |
| 390 | class = _EnableIfDeleterDefaultConstructible<_Dummy>, | |
| 391 | class = _EnableIfPointerConvertible<_Pp> > | |
| 392 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(_Pp __p) _NOEXCEPT | |
| 402 | 393 | : __ptr_(__p, __value_init_tag()) {} |
| 403 | 394 | |
| 404 | template <class _Pp, bool _Dummy = true, | |
| 405 | class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >, | |
| 406 | class = _EnableIfPointerConvertible<_Pp> > | |
| 407 | _LIBCPP_INLINE_VISIBILITY | |
| 408 | unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) _NOEXCEPT | |
| 395 | template <class _Pp, | |
| 396 | bool _Dummy = true, | |
| 397 | class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >, | |
| 398 | class = _EnableIfPointerConvertible<_Pp> > | |
| 399 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) _NOEXCEPT | |
| 409 | 400 | : __ptr_(__p, __d) {} |
| 410 | 401 | |
| 411 | template <bool _Dummy = true, | |
| 412 | class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > | |
| 413 | _LIBCPP_INLINE_VISIBILITY | |
| 414 | unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) _NOEXCEPT | |
| 402 | template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > | |
| 403 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) _NOEXCEPT | |
| 415 | 404 | : __ptr_(nullptr, __d) {} |
| 416 | 405 | |
| 417 | template <class _Pp, bool _Dummy = true, | |
| 418 | class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> >, | |
| 419 | class = _EnableIfPointerConvertible<_Pp> > | |
| 420 | _LIBCPP_INLINE_VISIBILITY | |
| 421 | unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT | |
| 406 | template <class _Pp, | |
| 407 | bool _Dummy = true, | |
| 408 | class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> >, | |
| 409 | class = _EnableIfPointerConvertible<_Pp> > | |
| 410 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT | |
| 422 | 411 | : __ptr_(__p, _VSTD::move(__d)) { |
| 423 | 412 | static_assert(!is_reference<deleter_type>::value, |
| 424 | 413 | "rvalue deleter bound to reference"); |
| 425 | 414 | } |
| 426 | 415 | |
| 427 | template <bool _Dummy = true, | |
| 428 | class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > | |
| 429 | _LIBCPP_INLINE_VISIBILITY | |
| 430 | unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) _NOEXCEPT | |
| 416 | template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > | |
| 417 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) _NOEXCEPT | |
| 431 | 418 | : __ptr_(nullptr, _VSTD::move(__d)) { |
| 432 | 419 | static_assert(!is_reference<deleter_type>::value, |
| 433 | 420 | "rvalue deleter bound to reference"); |
| ... | ... | @@ -439,34 +426,27 @@ public: |
| 439 | 426 | _LIBCPP_INLINE_VISIBILITY |
| 440 | 427 | unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete; |
| 441 | 428 | |
| 442 | _LIBCPP_INLINE_VISIBILITY | |
| 443 | unique_ptr(unique_ptr&& __u) _NOEXCEPT | |
| 444 | : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) { | |
| 445 | } | |
| 429 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT | |
| 430 | : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {} | |
| 446 | 431 | |
| 447 | _LIBCPP_INLINE_VISIBILITY | |
| 448 | unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { | |
| 432 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { | |
| 449 | 433 | reset(__u.release()); |
| 450 | 434 | __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter()); |
| 451 | 435 | return *this; |
| 452 | 436 | } |
| 453 | 437 | |
| 454 | template <class _Up, class _Ep, | |
| 455 | class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, | |
| 456 | class = _EnableIfDeleterConvertible<_Ep> | |
| 457 | > | |
| 458 | _LIBCPP_INLINE_VISIBILITY | |
| 459 | unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT | |
| 460 | : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) { | |
| 461 | } | |
| 438 | template <class _Up, | |
| 439 | class _Ep, | |
| 440 | class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, | |
| 441 | class = _EnableIfDeleterConvertible<_Ep> > | |
| 442 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT | |
| 443 | : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {} | |
| 462 | 444 | |
| 463 | template <class _Up, class _Ep, | |
| 464 | class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, | |
| 465 | class = _EnableIfDeleterAssignable<_Ep> | |
| 466 | > | |
| 467 | _LIBCPP_INLINE_VISIBILITY | |
| 468 | unique_ptr& | |
| 469 | operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { | |
| 445 | template <class _Up, | |
| 446 | class _Ep, | |
| 447 | class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, | |
| 448 | class = _EnableIfDeleterAssignable<_Ep> > | |
| 449 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { | |
| 470 | 450 | reset(__u.release()); |
| 471 | 451 | __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); |
| 472 | 452 | return *this; |
| ... | ... | @@ -477,90 +457,77 @@ public: |
| 477 | 457 | unique_ptr& operator=(unique_ptr const&) = delete; |
| 478 | 458 | #endif |
| 479 | 459 | public: |
| 480 | _LIBCPP_INLINE_VISIBILITY | |
| 481 | ~unique_ptr() { reset(); } | |
| 460 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } | |
| 482 | 461 | |
| 483 | _LIBCPP_INLINE_VISIBILITY | |
| 484 | unique_ptr& operator=(nullptr_t) _NOEXCEPT { | |
| 462 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(nullptr_t) _NOEXCEPT { | |
| 485 | 463 | reset(); |
| 486 | 464 | return *this; |
| 487 | 465 | } |
| 488 | 466 | |
| 489 | _LIBCPP_INLINE_VISIBILITY | |
| 490 | typename add_lvalue_reference<_Tp>::type | |
| 467 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> | |
| 491 | 468 | operator[](size_t __i) const { |
| 492 | 469 | return __ptr_.first()[__i]; |
| 493 | 470 | } |
| 494 | _LIBCPP_INLINE_VISIBILITY | |
| 495 | pointer get() const _NOEXCEPT { | |
| 496 | return __ptr_.first(); | |
| 497 | } | |
| 471 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); } | |
| 498 | 472 | |
| 499 | _LIBCPP_INLINE_VISIBILITY | |
| 500 | deleter_type& get_deleter() _NOEXCEPT { | |
| 473 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { | |
| 501 | 474 | return __ptr_.second(); |
| 502 | 475 | } |
| 503 | 476 | |
| 504 | _LIBCPP_INLINE_VISIBILITY | |
| 505 | const deleter_type& get_deleter() const _NOEXCEPT { | |
| 477 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT { | |
| 506 | 478 | return __ptr_.second(); |
| 507 | 479 | } |
| 508 | _LIBCPP_INLINE_VISIBILITY | |
| 509 | explicit operator bool() const _NOEXCEPT { | |
| 480 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT { | |
| 510 | 481 | return __ptr_.first() != nullptr; |
| 511 | 482 | } |
| 512 | 483 | |
| 513 | _LIBCPP_INLINE_VISIBILITY | |
| 514 | pointer release() _NOEXCEPT { | |
| 484 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT { | |
| 515 | 485 | pointer __t = __ptr_.first(); |
| 516 | 486 | __ptr_.first() = pointer(); |
| 517 | 487 | return __t; |
| 518 | 488 | } |
| 519 | 489 | |
| 520 | 490 | template <class _Pp> |
| 521 | _LIBCPP_INLINE_VISIBILITY | |
| 522 | typename enable_if< | |
| 523 | _CheckArrayPointerConversion<_Pp>::value | |
| 524 | >::type | |
| 525 | reset(_Pp __p) _NOEXCEPT { | |
| 491 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 492 | typename enable_if< _CheckArrayPointerConversion<_Pp>::value >::type | |
| 493 | reset(_Pp __p) _NOEXCEPT { | |
| 526 | 494 | pointer __tmp = __ptr_.first(); |
| 527 | 495 | __ptr_.first() = __p; |
| 528 | 496 | if (__tmp) |
| 529 | 497 | __ptr_.second()(__tmp); |
| 530 | 498 | } |
| 531 | 499 | |
| 532 | _LIBCPP_INLINE_VISIBILITY | |
| 533 | void reset(nullptr_t = nullptr) _NOEXCEPT { | |
| 500 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(nullptr_t = nullptr) _NOEXCEPT { | |
| 534 | 501 | pointer __tmp = __ptr_.first(); |
| 535 | 502 | __ptr_.first() = nullptr; |
| 536 | 503 | if (__tmp) |
| 537 | 504 | __ptr_.second()(__tmp); |
| 538 | 505 | } |
| 539 | 506 | |
| 540 | _LIBCPP_INLINE_VISIBILITY | |
| 541 | void swap(unique_ptr& __u) _NOEXCEPT { | |
| 507 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { | |
| 542 | 508 | __ptr_.swap(__u.__ptr_); |
| 543 | 509 | } |
| 544 | ||
| 545 | 510 | }; |
| 546 | 511 | |
| 547 | 512 | template <class _Tp, class _Dp> |
| 548 | inline _LIBCPP_INLINE_VISIBILITY | |
| 549 | typename enable_if< | |
| 550 | __is_swappable<_Dp>::value, | |
| 551 | void | |
| 552 | >::type | |
| 553 | swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) _NOEXCEPT {__x.swap(__y);} | |
| 513 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 514 | typename enable_if< __is_swappable<_Dp>::value, void >::type | |
| 515 | swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) _NOEXCEPT { | |
| 516 | __x.swap(__y); | |
| 517 | } | |
| 554 | 518 | |
| 555 | 519 | template <class _T1, class _D1, class _T2, class _D2> |
| 556 | inline _LIBCPP_INLINE_VISIBILITY | |
| 557 | bool | |
| 558 | operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __x.get() == __y.get();} | |
| 520 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 521 | operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) { | |
| 522 | return __x.get() == __y.get(); | |
| 523 | } | |
| 559 | 524 | |
| 525 | #if _LIBCPP_STD_VER <= 17 | |
| 560 | 526 | template <class _T1, class _D1, class _T2, class _D2> |
| 561 | 527 | inline _LIBCPP_INLINE_VISIBILITY |
| 562 | 528 | bool |
| 563 | 529 | operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x == __y);} |
| 530 | #endif | |
| 564 | 531 | |
| 565 | 532 | template <class _T1, class _D1, class _T2, class _D2> |
| 566 | 533 | inline _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -588,14 +555,26 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 588 | 555 | bool |
| 589 | 556 | operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x < __y);} |
| 590 | 557 | |
| 558 | ||
| 559 | #if _LIBCPP_STD_VER > 17 | |
| 560 | template <class _T1, class _D1, class _T2, class _D2> | |
| 561 | requires three_way_comparable_with<typename unique_ptr<_T1, _D1>::pointer, | |
| 562 | typename unique_ptr<_T2, _D2>::pointer> | |
| 563 | _LIBCPP_HIDE_FROM_ABI | |
| 564 | compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer, | |
| 565 | typename unique_ptr<_T2, _D2>::pointer> | |
| 566 | operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) { | |
| 567 | return compare_three_way()(__x.get(), __y.get()); | |
| 568 | } | |
| 569 | #endif | |
| 570 | ||
| 591 | 571 | template <class _T1, class _D1> |
| 592 | inline _LIBCPP_INLINE_VISIBILITY | |
| 593 | bool | |
| 594 | operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT | |
| 595 | { | |
| 596 | return !__x; | |
| 572 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 573 | operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT { | |
| 574 | return !__x; | |
| 597 | 575 | } |
| 598 | 576 | |
| 577 | #if _LIBCPP_STD_VER <= 17 | |
| 599 | 578 | template <class _T1, class _D1> |
| 600 | 579 | inline _LIBCPP_INLINE_VISIBILITY |
| 601 | 580 | bool |
| ... | ... | @@ -619,72 +598,67 @@ operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT |
| 619 | 598 | { |
| 620 | 599 | return static_cast<bool>(__x); |
| 621 | 600 | } |
| 601 | #endif // _LIBCPP_STD_VER <= 17 | |
| 622 | 602 | |
| 623 | 603 | template <class _T1, class _D1> |
| 624 | inline _LIBCPP_INLINE_VISIBILITY | |
| 625 | bool | |
| 626 | operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t) | |
| 627 | { | |
| 628 | typedef typename unique_ptr<_T1, _D1>::pointer _P1; | |
| 629 | return less<_P1>()(__x.get(), nullptr); | |
| 604 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 605 | operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t) { | |
| 606 | typedef typename unique_ptr<_T1, _D1>::pointer _P1; | |
| 607 | return less<_P1>()(__x.get(), nullptr); | |
| 630 | 608 | } |
| 631 | 609 | |
| 632 | 610 | template <class _T1, class _D1> |
| 633 | inline _LIBCPP_INLINE_VISIBILITY | |
| 634 | bool | |
| 635 | operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x) | |
| 636 | { | |
| 637 | typedef typename unique_ptr<_T1, _D1>::pointer _P1; | |
| 638 | return less<_P1>()(nullptr, __x.get()); | |
| 611 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 612 | operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x) { | |
| 613 | typedef typename unique_ptr<_T1, _D1>::pointer _P1; | |
| 614 | return less<_P1>()(nullptr, __x.get()); | |
| 639 | 615 | } |
| 640 | 616 | |
| 641 | 617 | template <class _T1, class _D1> |
| 642 | inline _LIBCPP_INLINE_VISIBILITY | |
| 643 | bool | |
| 644 | operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t) | |
| 645 | { | |
| 646 | return nullptr < __x; | |
| 618 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 619 | operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t) { | |
| 620 | return nullptr < __x; | |
| 647 | 621 | } |
| 648 | 622 | |
| 649 | 623 | template <class _T1, class _D1> |
| 650 | inline _LIBCPP_INLINE_VISIBILITY | |
| 651 | bool | |
| 652 | operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x) | |
| 653 | { | |
| 654 | return __x < nullptr; | |
| 624 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 625 | operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x) { | |
| 626 | return __x < nullptr; | |
| 655 | 627 | } |
| 656 | 628 | |
| 657 | 629 | template <class _T1, class _D1> |
| 658 | inline _LIBCPP_INLINE_VISIBILITY | |
| 659 | bool | |
| 660 | operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t) | |
| 661 | { | |
| 662 | return !(nullptr < __x); | |
| 630 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 631 | operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t) { | |
| 632 | return !(nullptr < __x); | |
| 663 | 633 | } |
| 664 | 634 | |
| 665 | 635 | template <class _T1, class _D1> |
| 666 | inline _LIBCPP_INLINE_VISIBILITY | |
| 667 | bool | |
| 668 | operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x) | |
| 669 | { | |
| 670 | return !(__x < nullptr); | |
| 636 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 637 | operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x) { | |
| 638 | return !(__x < nullptr); | |
| 671 | 639 | } |
| 672 | 640 | |
| 673 | 641 | template <class _T1, class _D1> |
| 674 | inline _LIBCPP_INLINE_VISIBILITY | |
| 675 | bool | |
| 676 | operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t) | |
| 677 | { | |
| 678 | return !(__x < nullptr); | |
| 642 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 643 | operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t) { | |
| 644 | return !(__x < nullptr); | |
| 679 | 645 | } |
| 680 | 646 | |
| 681 | 647 | template <class _T1, class _D1> |
| 682 | inline _LIBCPP_INLINE_VISIBILITY | |
| 683 | bool | |
| 684 | operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x) | |
| 685 | { | |
| 686 | return !(nullptr < __x); | |
| 648 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 649 | operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x) { | |
| 650 | return !(nullptr < __x); | |
| 651 | } | |
| 652 | ||
| 653 | #if _LIBCPP_STD_VER > 17 | |
| 654 | template <class _T1, class _D1> | |
| 655 | requires three_way_comparable< | |
| 656 | typename unique_ptr<_T1, _D1>::pointer> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 657 | compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer> | |
| 658 | operator<=>(const unique_ptr<_T1, _D1>& __x, nullptr_t) { | |
| 659 | return compare_three_way()(__x.get(), static_cast<typename unique_ptr<_T1, _D1>::pointer>(nullptr)); | |
| 687 | 660 | } |
| 661 | #endif | |
| 688 | 662 | |
| 689 | 663 | #if _LIBCPP_STD_VER > 11 |
| 690 | 664 | |
| ... | ... | @@ -706,21 +680,17 @@ struct __unique_if<_Tp[_Np]> |
| 706 | 680 | typedef void __unique_array_known_bound; |
| 707 | 681 | }; |
| 708 | 682 | |
| 709 | template<class _Tp, class... _Args> | |
| 710 | inline _LIBCPP_INLINE_VISIBILITY | |
| 711 | typename __unique_if<_Tp>::__unique_single | |
| 712 | make_unique(_Args&&... __args) | |
| 713 | { | |
| 714 | return unique_ptr<_Tp>(new _Tp(_VSTD::forward<_Args>(__args)...)); | |
| 683 | template <class _Tp, class... _Args> | |
| 684 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 typename __unique_if<_Tp>::__unique_single | |
| 685 | make_unique(_Args&&... __args) { | |
| 686 | return unique_ptr<_Tp>(new _Tp(_VSTD::forward<_Args>(__args)...)); | |
| 715 | 687 | } |
| 716 | 688 | |
| 717 | template<class _Tp> | |
| 718 | inline _LIBCPP_INLINE_VISIBILITY | |
| 719 | typename __unique_if<_Tp>::__unique_array_unknown_bound | |
| 720 | make_unique(size_t __n) | |
| 721 | { | |
| 722 | typedef typename remove_extent<_Tp>::type _Up; | |
| 723 | return unique_ptr<_Tp>(new _Up[__n]()); | |
| 689 | template <class _Tp> | |
| 690 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 typename __unique_if<_Tp>::__unique_array_unknown_bound | |
| 691 | make_unique(size_t __n) { | |
| 692 | typedef __remove_extent_t<_Tp> _Up; | |
| 693 | return unique_ptr<_Tp>(new _Up[__n]()); | |
| 724 | 694 | } |
| 725 | 695 | |
| 726 | 696 | template<class _Tp, class... _Args> |
| ... | ... | @@ -729,6 +699,25 @@ template<class _Tp, class... _Args> |
| 729 | 699 | |
| 730 | 700 | #endif // _LIBCPP_STD_VER > 11 |
| 731 | 701 | |
| 702 | #if _LIBCPP_STD_VER >= 20 | |
| 703 | ||
| 704 | template <class _Tp> | |
| 705 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 typename __unique_if<_Tp>::__unique_single | |
| 706 | make_unique_for_overwrite() { | |
| 707 | return unique_ptr<_Tp>(new _Tp); | |
| 708 | } | |
| 709 | ||
| 710 | template <class _Tp> | |
| 711 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 typename __unique_if<_Tp>::__unique_array_unknown_bound | |
| 712 | make_unique_for_overwrite(size_t __n) { | |
| 713 | return unique_ptr<_Tp>(new __remove_extent_t<_Tp>[__n]); | |
| 714 | } | |
| 715 | ||
| 716 | template<class _Tp, class... _Args> | |
| 717 | typename __unique_if<_Tp>::__unique_array_known_bound make_unique_for_overwrite(_Args&&...) = delete; | |
| 718 | ||
| 719 | #endif // _LIBCPP_STD_VER >= 20 | |
| 720 | ||
| 732 | 721 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash; |
| 733 | 722 | |
| 734 | 723 | template <class _Tp, class _Dp> |
lib/libcxx/include/__memory/uses_allocator.h+1-1| ... | ... | @@ -11,8 +11,8 @@ |
| 11 | 11 | #define _LIBCPP___MEMORY_USES_ALLOCATOR_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <__type_traits/is_convertible.h> | |
| 14 | 15 | #include <cstddef> |
| 15 | #include <type_traits> | |
| 16 | 16 | |
| 17 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 18 | # pragma GCC system_header |
lib/libcxx/include/__memory/uses_allocator_construction.h created+221| ... | ... | @@ -0,0 +1,221 @@ |
| 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_USES_ALLOCATOR_CONSTRUCTION_H | |
| 10 | #define _LIBCPP___MEMORY_USES_ALLOCATOR_CONSTRUCTION_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__memory/construct_at.h> | |
| 14 | #include <__memory/uses_allocator.h> | |
| 15 | #include <__type_traits/enable_if.h> | |
| 16 | #include <__type_traits/is_same.h> | |
| 17 | #include <__type_traits/remove_cv.h> | |
| 18 | #include <__utility/declval.h> | |
| 19 | #include <__utility/pair.h> | |
| 20 | #include <tuple> | |
| 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 | #if _LIBCPP_STD_VER >= 17 | |
| 29 | ||
| 30 | template <class _Type> | |
| 31 | inline constexpr bool __is_std_pair = false; | |
| 32 | ||
| 33 | template <class _Type1, class _Type2> | |
| 34 | inline constexpr bool __is_std_pair<pair<_Type1, _Type2>> = true; | |
| 35 | ||
| 36 | template <class _Type, class _Alloc, class... _Args, __enable_if_t<!__is_std_pair<_Type>, int> = 0> | |
| 37 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 38 | __uses_allocator_construction_args(const _Alloc& __alloc, _Args&&... __args) noexcept { | |
| 39 | if constexpr (!uses_allocator_v<_Type, _Alloc> && is_constructible_v<_Type, _Args...>) { | |
| 40 | return std::forward_as_tuple(std::forward<_Args>(__args)...); | |
| 41 | } else if constexpr (uses_allocator_v<_Type, _Alloc> && | |
| 42 | is_constructible_v<_Type, allocator_arg_t, const _Alloc&, _Args...>) { | |
| 43 | return tuple<allocator_arg_t, const _Alloc&, _Args&&...>(allocator_arg, __alloc, std::forward<_Args>(__args)...); | |
| 44 | } else if constexpr (uses_allocator_v<_Type, _Alloc> && is_constructible_v<_Type, _Args..., const _Alloc&>) { | |
| 45 | return std::forward_as_tuple(std::forward<_Args>(__args)..., __alloc); | |
| 46 | } else { | |
| 47 | static_assert( | |
| 48 | sizeof(_Type) + 1 == 0, "If uses_allocator_v<Type> is true, the type has to be allocator-constructible"); | |
| 49 | } | |
| 50 | } | |
| 51 | ||
| 52 | template <class _Pair, class _Alloc, class _Tuple1, class _Tuple2, __enable_if_t<__is_std_pair<_Pair>, int> = 0> | |
| 53 | _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args( | |
| 54 | const _Alloc& __alloc, piecewise_construct_t, _Tuple1&& __x, _Tuple2&& __y) noexcept { | |
| 55 | return std::make_tuple( | |
| 56 | piecewise_construct, | |
| 57 | std::apply( | |
| 58 | [&__alloc](auto&&... __args1) { | |
| 59 | return std::__uses_allocator_construction_args<typename _Pair::first_type>( | |
| 60 | __alloc, std::forward<decltype(__args1)>(__args1)...); | |
| 61 | }, | |
| 62 | std::forward<_Tuple1>(__x)), | |
| 63 | std::apply( | |
| 64 | [&__alloc](auto&&... __args2) { | |
| 65 | return std::__uses_allocator_construction_args<typename _Pair::second_type>( | |
| 66 | __alloc, std::forward<decltype(__args2)>(__args2)...); | |
| 67 | }, | |
| 68 | std::forward<_Tuple2>(__y))); | |
| 69 | } | |
| 70 | ||
| 71 | template <class _Pair, class _Alloc, __enable_if_t<__is_std_pair<_Pair>, int> = 0> | |
| 72 | _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc) noexcept { | |
| 73 | return std::__uses_allocator_construction_args<_Pair>(__alloc, piecewise_construct, tuple<>{}, tuple<>{}); | |
| 74 | } | |
| 75 | ||
| 76 | template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> | |
| 77 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 78 | __uses_allocator_construction_args(const _Alloc& __alloc, _Up&& __u, _Vp&& __v) noexcept { | |
| 79 | return std::__uses_allocator_construction_args<_Pair>( | |
| 80 | __alloc, | |
| 81 | piecewise_construct, | |
| 82 | std::forward_as_tuple(std::forward<_Up>(__u)), | |
| 83 | std::forward_as_tuple(std::forward<_Vp>(__v))); | |
| 84 | } | |
| 85 | ||
| 86 | # if _LIBCPP_STD_VER > 20 | |
| 87 | template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> | |
| 88 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 89 | __uses_allocator_construction_args(const _Alloc& __alloc, pair<_Up, _Vp>& __pair) noexcept { | |
| 90 | return std::__uses_allocator_construction_args<_Pair>( | |
| 91 | __alloc, piecewise_construct, std::forward_as_tuple(__pair.first), std::forward_as_tuple(__pair.second)); | |
| 92 | } | |
| 93 | # endif | |
| 94 | ||
| 95 | template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> | |
| 96 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 97 | __uses_allocator_construction_args(const _Alloc& __alloc, const pair<_Up, _Vp>& __pair) noexcept { | |
| 98 | return std::__uses_allocator_construction_args<_Pair>( | |
| 99 | __alloc, piecewise_construct, std::forward_as_tuple(__pair.first), std::forward_as_tuple(__pair.second)); | |
| 100 | } | |
| 101 | ||
| 102 | template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> | |
| 103 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 104 | __uses_allocator_construction_args(const _Alloc& __alloc, pair<_Up, _Vp>&& __pair) noexcept { | |
| 105 | return std::__uses_allocator_construction_args<_Pair>( | |
| 106 | __alloc, | |
| 107 | piecewise_construct, | |
| 108 | std::forward_as_tuple(std::get<0>(std::move(__pair))), | |
| 109 | std::forward_as_tuple(std::get<1>(std::move(__pair)))); | |
| 110 | } | |
| 111 | ||
| 112 | # if _LIBCPP_STD_VER > 20 | |
| 113 | template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> | |
| 114 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 115 | __uses_allocator_construction_args(const _Alloc& __alloc, const pair<_Up, _Vp>&& __pair) noexcept { | |
| 116 | return std::__uses_allocator_construction_args<_Pair>( | |
| 117 | __alloc, | |
| 118 | piecewise_construct, | |
| 119 | std::forward_as_tuple(std::get<0>(std::move(__pair))), | |
| 120 | std::forward_as_tuple(std::get<1>(std::move(__pair)))); | |
| 121 | } | |
| 122 | # endif | |
| 123 | ||
| 124 | namespace __uses_allocator_detail { | |
| 125 | ||
| 126 | template <class _Ap, class _Bp> | |
| 127 | void __fun(const pair<_Ap, _Bp>&); | |
| 128 | ||
| 129 | template <class _Tp> | |
| 130 | decltype(__uses_allocator_detail::__fun(std::declval<_Tp>()), true_type()) __convertible_to_const_pair_ref_impl(int); | |
| 131 | ||
| 132 | template <class> | |
| 133 | false_type __convertible_to_const_pair_ref_impl(...); | |
| 134 | ||
| 135 | template <class _Tp> | |
| 136 | inline constexpr bool __convertible_to_const_pair_ref = | |
| 137 | decltype(__uses_allocator_detail::__convertible_to_const_pair_ref_impl<_Tp>(0))::value; | |
| 138 | ||
| 139 | } // namespace __uses_allocator_detail | |
| 140 | ||
| 141 | template < | |
| 142 | class _Pair, | |
| 143 | class _Alloc, | |
| 144 | class _Type, | |
| 145 | __enable_if_t<__is_std_pair<_Pair> && !__uses_allocator_detail::__convertible_to_const_pair_ref<_Type>, int> = 0> | |
| 146 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 147 | __uses_allocator_construction_args(const _Alloc& __alloc, _Type&& __value) noexcept; | |
| 148 | ||
| 149 | template <class _Type, class _Alloc, class... _Args> | |
| 150 | _LIBCPP_HIDE_FROM_ABI constexpr _Type __make_obj_using_allocator(const _Alloc& __alloc, _Args&&... __args); | |
| 151 | ||
| 152 | template <class _Pair, | |
| 153 | class _Alloc, | |
| 154 | class _Type, | |
| 155 | __enable_if_t<__is_std_pair<_Pair> && !__uses_allocator_detail::__convertible_to_const_pair_ref<_Type>, int>> | |
| 156 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 157 | __uses_allocator_construction_args(const _Alloc& __alloc, _Type&& __value) noexcept { | |
| 158 | struct __pair_constructor { | |
| 159 | using _PairMutable = remove_cv_t<_Pair>; | |
| 160 | ||
| 161 | _LIBCPP_HIDE_FROM_ABI constexpr auto __do_construct(const _PairMutable& __pair) const { | |
| 162 | return std::__make_obj_using_allocator<_PairMutable>(__alloc_, __pair); | |
| 163 | } | |
| 164 | ||
| 165 | _LIBCPP_HIDE_FROM_ABI constexpr auto __do_construct(_PairMutable&& __pair) const { | |
| 166 | return std::__make_obj_using_allocator<_PairMutable>(__alloc_, std::move(__pair)); | |
| 167 | } | |
| 168 | ||
| 169 | const _Alloc& __alloc_; | |
| 170 | _Type& __value_; | |
| 171 | ||
| 172 | _LIBCPP_HIDE_FROM_ABI constexpr operator _PairMutable() const { | |
| 173 | return __do_construct(std::forward<_Type>(this->__value_)); | |
| 174 | } | |
| 175 | }; | |
| 176 | ||
| 177 | return std::make_tuple(__pair_constructor{__alloc, __value}); | |
| 178 | } | |
| 179 | ||
| 180 | template <class _Type, class _Alloc, class... _Args> | |
| 181 | _LIBCPP_HIDE_FROM_ABI constexpr _Type __make_obj_using_allocator(const _Alloc& __alloc, _Args&&... __args) { | |
| 182 | return std::make_from_tuple<_Type>( | |
| 183 | std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...)); | |
| 184 | } | |
| 185 | ||
| 186 | template <class _Type, class _Alloc, class... _Args> | |
| 187 | _LIBCPP_HIDE_FROM_ABI constexpr _Type* | |
| 188 | __uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _Args&&... __args) { | |
| 189 | return std::apply( | |
| 190 | [&__ptr](auto&&... __xs) { return std::__construct_at(__ptr, std::forward<decltype(__xs)>(__xs)...); }, | |
| 191 | std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...)); | |
| 192 | } | |
| 193 | ||
| 194 | #endif // _LIBCPP_STD_VER >= 17 | |
| 195 | ||
| 196 | #if _LIBCPP_STD_VER >= 20 | |
| 197 | ||
| 198 | template <class _Type, class _Alloc, class... _Args> | |
| 199 | _LIBCPP_HIDE_FROM_ABI constexpr auto uses_allocator_construction_args(const _Alloc& __alloc, _Args&&... __args) noexcept | |
| 200 | -> decltype(std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...)) { | |
| 201 | return /*--*/ std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...); | |
| 202 | } | |
| 203 | ||
| 204 | template <class _Type, class _Alloc, class... _Args> | |
| 205 | _LIBCPP_HIDE_FROM_ABI constexpr auto make_obj_using_allocator(const _Alloc& __alloc, _Args&&... __args) | |
| 206 | -> decltype(std::__make_obj_using_allocator<_Type>(__alloc, std::forward<_Args>(__args)...)) { | |
| 207 | return /*--*/ std::__make_obj_using_allocator<_Type>(__alloc, std::forward<_Args>(__args)...); | |
| 208 | } | |
| 209 | ||
| 210 | template <class _Type, class _Alloc, class... _Args> | |
| 211 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 212 | uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _Args&&... __args) | |
| 213 | -> decltype(std::__uninitialized_construct_using_allocator(__ptr, __alloc, std::forward<_Args>(__args)...)) { | |
| 214 | return /*--*/ std::__uninitialized_construct_using_allocator(__ptr, __alloc, std::forward<_Args>(__args)...); | |
| 215 | } | |
| 216 | ||
| 217 | #endif // _LIBCPP_STD_VER >= 20 | |
| 218 | ||
| 219 | _LIBCPP_END_NAMESPACE_STD | |
| 220 | ||
| 221 | #endif // _LIBCPP___MEMORY_USES_ALLOCATOR_CONSTRUCTION_H |
lib/libcxx/include/__memory/voidify.h+1-1| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | 22 | template <typename _Tp> |
| 23 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void* __voidify(_Tp& __from) { | |
| 23 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void* __voidify(_Tp& __from) { | |
| 24 | 24 | // Cast away cv-qualifiers to allow modifying elements of a range through const iterators. |
| 25 | 25 | return const_cast<void*>(static_cast<const volatile void*>(_VSTD::addressof(__from))); |
| 26 | 26 | } |
lib/libcxx/include/__memory_resource/memory_resource.h created+75| ... | ... | @@ -0,0 +1,75 @@ |
| 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_RESOURCE_MEMORY_RESOURCE_H | |
| 10 | #define _LIBCPP___MEMORY_RESOURCE_MEMORY_RESOURCE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <cstddef> | |
| 14 | ||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 16 | # pragma GCC system_header | |
| 17 | #endif | |
| 18 | ||
| 19 | #if _LIBCPP_STD_VER > 14 | |
| 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 22 | ||
| 23 | namespace pmr { | |
| 24 | ||
| 25 | // [mem.res.class] | |
| 26 | ||
| 27 | class _LIBCPP_TYPE_VIS memory_resource { | |
| 28 | static const size_t __max_align = alignof(max_align_t); | |
| 29 | ||
| 30 | public: | |
| 31 | virtual ~memory_resource(); | |
| 32 | ||
| 33 | _LIBCPP_NODISCARD_AFTER_CXX17 | |
| 34 | [[using __gnu__: __returns_nonnull__, __alloc_size__(2), __alloc_align__(3)]] _LIBCPP_HIDE_FROM_ABI void* | |
| 35 | allocate(size_t __bytes, size_t __align = __max_align) { | |
| 36 | return do_allocate(__bytes, __align); | |
| 37 | } | |
| 38 | ||
| 39 | [[__gnu__::__nonnull__]] _LIBCPP_HIDE_FROM_ABI void | |
| 40 | deallocate(void* __p, size_t __bytes, size_t __align = __max_align) { | |
| 41 | do_deallocate(__p, __bytes, __align); | |
| 42 | } | |
| 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI bool is_equal(const memory_resource& __other) const noexcept { return do_is_equal(__other); } | |
| 45 | ||
| 46 | private: | |
| 47 | virtual void* do_allocate(size_t, size_t) = 0; | |
| 48 | virtual void do_deallocate(void*, size_t, size_t) = 0; | |
| 49 | virtual bool do_is_equal(memory_resource const&) const noexcept = 0; | |
| 50 | }; | |
| 51 | ||
| 52 | // [mem.res.eq] | |
| 53 | ||
| 54 | inline _LIBCPP_HIDE_FROM_ABI bool operator==(const memory_resource& __lhs, const memory_resource& __rhs) noexcept { | |
| 55 | return &__lhs == &__rhs || __lhs.is_equal(__rhs); | |
| 56 | } | |
| 57 | ||
| 58 | inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const memory_resource& __lhs, const memory_resource& __rhs) noexcept { | |
| 59 | return !(__lhs == __rhs); | |
| 60 | } | |
| 61 | ||
| 62 | // [mem.res.global] | |
| 63 | ||
| 64 | [[__gnu__::__returns_nonnull__]] _LIBCPP_FUNC_VIS memory_resource* get_default_resource() noexcept; | |
| 65 | [[__gnu__::__returns_nonnull__]] _LIBCPP_FUNC_VIS memory_resource* set_default_resource(memory_resource*) noexcept; | |
| 66 | [[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_FUNC_VIS memory_resource* new_delete_resource() noexcept; | |
| 67 | [[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_FUNC_VIS memory_resource* null_memory_resource() noexcept; | |
| 68 | ||
| 69 | } // namespace pmr | |
| 70 | ||
| 71 | _LIBCPP_END_NAMESPACE_STD | |
| 72 | ||
| 73 | #endif // _LIBCPP_STD_VER > 14 | |
| 74 | ||
| 75 | #endif // _LIBCPP___MEMORY_RESOURCE_MEMORY_RESOURCE_H |
lib/libcxx/include/__memory_resource/monotonic_buffer_resource.h created+120| ... | ... | @@ -0,0 +1,120 @@ |
| 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_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H | |
| 10 | #define _LIBCPP___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__memory/addressof.h> | |
| 14 | #include <__memory_resource/memory_resource.h> | |
| 15 | #include <cstddef> | |
| 16 | ||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 18 | # pragma GCC system_header | |
| 19 | #endif | |
| 20 | ||
| 21 | #if _LIBCPP_STD_VER > 14 | |
| 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 24 | ||
| 25 | namespace pmr { | |
| 26 | ||
| 27 | // [mem.res.monotonic.buffer] | |
| 28 | ||
| 29 | class _LIBCPP_TYPE_VIS monotonic_buffer_resource : public memory_resource { | |
| 30 | static const size_t __default_buffer_capacity = 1024; | |
| 31 | static const size_t __default_buffer_alignment = 16; | |
| 32 | ||
| 33 | struct __chunk_footer { | |
| 34 | __chunk_footer* __next_; | |
| 35 | char* __start_; | |
| 36 | char* __cur_; | |
| 37 | size_t __align_; | |
| 38 | size_t __allocation_size() { return (reinterpret_cast<char*>(this) - __start_) + sizeof(*this); } | |
| 39 | void* __try_allocate_from_chunk(size_t, size_t); | |
| 40 | }; | |
| 41 | ||
| 42 | struct __initial_descriptor { | |
| 43 | char* __start_; | |
| 44 | char* __cur_; | |
| 45 | union { | |
| 46 | char* __end_; | |
| 47 | size_t __size_; | |
| 48 | }; | |
| 49 | void* __try_allocate_from_chunk(size_t, size_t); | |
| 50 | }; | |
| 51 | ||
| 52 | public: | |
| 53 | _LIBCPP_HIDE_FROM_ABI monotonic_buffer_resource() | |
| 54 | : monotonic_buffer_resource(nullptr, __default_buffer_capacity, get_default_resource()) {} | |
| 55 | ||
| 56 | _LIBCPP_HIDE_FROM_ABI explicit monotonic_buffer_resource(size_t __initial_size) | |
| 57 | : monotonic_buffer_resource(nullptr, __initial_size, get_default_resource()) {} | |
| 58 | ||
| 59 | _LIBCPP_HIDE_FROM_ABI monotonic_buffer_resource(void* __buffer, size_t __buffer_size) | |
| 60 | : monotonic_buffer_resource(__buffer, __buffer_size, get_default_resource()) {} | |
| 61 | ||
| 62 | _LIBCPP_HIDE_FROM_ABI explicit monotonic_buffer_resource(memory_resource* __upstream) | |
| 63 | : monotonic_buffer_resource(nullptr, __default_buffer_capacity, __upstream) {} | |
| 64 | ||
| 65 | _LIBCPP_HIDE_FROM_ABI monotonic_buffer_resource(size_t __initial_size, memory_resource* __upstream) | |
| 66 | : monotonic_buffer_resource(nullptr, __initial_size, __upstream) {} | |
| 67 | ||
| 68 | _LIBCPP_HIDE_FROM_ABI monotonic_buffer_resource(void* __buffer, size_t __buffer_size, memory_resource* __upstream) | |
| 69 | : __res_(__upstream) { | |
| 70 | __initial_.__start_ = static_cast<char*>(__buffer); | |
| 71 | if (__buffer != nullptr) { | |
| 72 | __initial_.__cur_ = static_cast<char*>(__buffer) + __buffer_size; | |
| 73 | __initial_.__end_ = static_cast<char*>(__buffer) + __buffer_size; | |
| 74 | } else { | |
| 75 | __initial_.__cur_ = nullptr; | |
| 76 | __initial_.__size_ = __buffer_size; | |
| 77 | } | |
| 78 | __chunks_ = nullptr; | |
| 79 | } | |
| 80 | ||
| 81 | monotonic_buffer_resource(const monotonic_buffer_resource&) = delete; | |
| 82 | ||
| 83 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~monotonic_buffer_resource() override { release(); } | |
| 84 | ||
| 85 | monotonic_buffer_resource& operator=(const monotonic_buffer_resource&) = delete; | |
| 86 | ||
| 87 | _LIBCPP_HIDE_FROM_ABI void release() { | |
| 88 | if (__initial_.__start_ != nullptr) | |
| 89 | __initial_.__cur_ = __initial_.__end_; | |
| 90 | while (__chunks_ != nullptr) { | |
| 91 | __chunk_footer* __next = __chunks_->__next_; | |
| 92 | __res_->deallocate(__chunks_->__start_, __chunks_->__allocation_size(), __chunks_->__align_); | |
| 93 | __chunks_ = __next; | |
| 94 | } | |
| 95 | } | |
| 96 | ||
| 97 | _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __res_; } | |
| 98 | ||
| 99 | protected: | |
| 100 | void* do_allocate(size_t __bytes, size_t __alignment) override; // key function | |
| 101 | ||
| 102 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void do_deallocate(void*, size_t, size_t) override {} | |
| 103 | ||
| 104 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool do_is_equal(const memory_resource& __other) const _NOEXCEPT override { | |
| 105 | return this == std::addressof(__other); | |
| 106 | } | |
| 107 | ||
| 108 | private: | |
| 109 | __initial_descriptor __initial_; | |
| 110 | __chunk_footer* __chunks_; | |
| 111 | memory_resource* __res_; | |
| 112 | }; | |
| 113 | ||
| 114 | } // namespace pmr | |
| 115 | ||
| 116 | _LIBCPP_END_NAMESPACE_STD | |
| 117 | ||
| 118 | #endif // _LIBCPP_STD_VER > 14 | |
| 119 | ||
| 120 | #endif // _LIBCPP___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H |
lib/libcxx/include/__memory_resource/polymorphic_allocator.h created+224| ... | ... | @@ -0,0 +1,224 @@ |
| 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_RESOURCE_POLYMORPHIC_ALLOCATOR_H | |
| 10 | #define _LIBCPP___MEMORY_RESOURCE_POLYMORPHIC_ALLOCATOR_H | |
| 11 | ||
| 12 | #include <__assert> | |
| 13 | #include <__config> | |
| 14 | #include <__memory_resource/memory_resource.h> | |
| 15 | #include <__utility/exception_guard.h> | |
| 16 | #include <cstddef> | |
| 17 | #include <limits> | |
| 18 | #include <new> | |
| 19 | #include <stdexcept> | |
| 20 | #include <tuple> | |
| 21 | ||
| 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 23 | # pragma GCC system_header | |
| 24 | #endif | |
| 25 | ||
| 26 | _LIBCPP_PUSH_MACROS | |
| 27 | #include <__undef_macros> | |
| 28 | ||
| 29 | #if _LIBCPP_STD_VER > 14 | |
| 30 | ||
| 31 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 32 | ||
| 33 | namespace pmr { | |
| 34 | ||
| 35 | // [mem.poly.allocator.class] | |
| 36 | ||
| 37 | template <class _ValueType | |
| 38 | # if _LIBCPP_STD_VER >= 20 | |
| 39 | = byte | |
| 40 | # endif | |
| 41 | > | |
| 42 | class _LIBCPP_TEMPLATE_VIS polymorphic_allocator { | |
| 43 | ||
| 44 | public: | |
| 45 | using value_type = _ValueType; | |
| 46 | ||
| 47 | // [mem.poly.allocator.ctor] | |
| 48 | ||
| 49 | _LIBCPP_HIDE_FROM_ABI polymorphic_allocator() noexcept : __res_(std::pmr::get_default_resource()) {} | |
| 50 | ||
| 51 | _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(memory_resource* __r) noexcept : __res_(__r) {} | |
| 52 | ||
| 53 | polymorphic_allocator(const polymorphic_allocator&) = default; | |
| 54 | ||
| 55 | template <class _Tp> | |
| 56 | _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(const polymorphic_allocator<_Tp>& __other) noexcept | |
| 57 | : __res_(__other.resource()) {} | |
| 58 | ||
| 59 | polymorphic_allocator& operator=(const polymorphic_allocator&) = delete; | |
| 60 | ||
| 61 | // [mem.poly.allocator.mem] | |
| 62 | ||
| 63 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _ValueType* allocate(size_t __n) { | |
| 64 | if (__n > __max_size()) { | |
| 65 | __throw_bad_array_new_length(); | |
| 66 | } | |
| 67 | return static_cast<_ValueType*>(__res_->allocate(__n * sizeof(_ValueType), alignof(_ValueType))); | |
| 68 | } | |
| 69 | ||
| 70 | _LIBCPP_HIDE_FROM_ABI void deallocate(_ValueType* __p, size_t __n) { | |
| 71 | _LIBCPP_ASSERT(__n <= __max_size(), "deallocate called for size which exceeds max_size()"); | |
| 72 | __res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType)); | |
| 73 | } | |
| 74 | ||
| 75 | # if _LIBCPP_STD_VER >= 20 | |
| 76 | ||
| 77 | [[nodiscard]] [[using __gnu__: __alloc_size__(2), __alloc_align__(3)]] void* | |
| 78 | allocate_bytes(size_t __nbytes, size_t __alignment = alignof(max_align_t)) { | |
| 79 | return __res_->allocate(__nbytes, __alignment); | |
| 80 | } | |
| 81 | ||
| 82 | void deallocate_bytes(void* __ptr, size_t __nbytes, size_t __alignment = alignof(max_align_t)) { | |
| 83 | __res_->deallocate(__ptr, __nbytes, __alignment); | |
| 84 | } | |
| 85 | ||
| 86 | template <class _Type> | |
| 87 | [[nodiscard]] _Type* allocate_object(size_t __n = 1) { | |
| 88 | if (numeric_limits<size_t>::max() / sizeof(_Type) < __n) | |
| 89 | std::__throw_bad_array_new_length(); | |
| 90 | return static_cast<_Type*>(allocate_bytes(__n * sizeof(_Type), alignof(_Type))); | |
| 91 | } | |
| 92 | ||
| 93 | template <class _Type> | |
| 94 | void deallocate_object(_Type* __ptr, size_t __n = 1) { | |
| 95 | deallocate_bytes(__ptr, __n * sizeof(_Type), alignof(_Type)); | |
| 96 | } | |
| 97 | ||
| 98 | template <class _Type, class... _CtorArgs> | |
| 99 | [[nodiscard]] _Type* new_object(_CtorArgs&&... __ctor_args) { | |
| 100 | _Type* __ptr = allocate_object<_Type>(); | |
| 101 | __exception_guard __guard([&] { deallocate_object(__ptr); }); | |
| 102 | construct(__ptr, std::forward<_CtorArgs>(__ctor_args)...); | |
| 103 | __guard.__complete(); | |
| 104 | return __ptr; | |
| 105 | } | |
| 106 | ||
| 107 | template <class _Type> | |
| 108 | void delete_object(_Type* __ptr) { | |
| 109 | destroy(__ptr); | |
| 110 | deallocate_object(__ptr); | |
| 111 | } | |
| 112 | ||
| 113 | # endif // _LIBCPP_STD_VER >= 20 | |
| 114 | ||
| 115 | template <class _Tp, class... _Ts> | |
| 116 | _LIBCPP_HIDE_FROM_ABI void construct(_Tp* __p, _Ts&&... __args) { | |
| 117 | std::__user_alloc_construct_impl( | |
| 118 | typename __uses_alloc_ctor<_Tp, polymorphic_allocator&, _Ts...>::type(), | |
| 119 | __p, | |
| 120 | *this, | |
| 121 | std::forward<_Ts>(__args)...); | |
| 122 | } | |
| 123 | ||
| 124 | template <class _T1, class _T2, class... _Args1, class... _Args2> | |
| 125 | _LIBCPP_HIDE_FROM_ABI void | |
| 126 | construct(pair<_T1, _T2>* __p, piecewise_construct_t, tuple<_Args1...> __x, tuple<_Args2...> __y) { | |
| 127 | ::new ((void*)__p) pair<_T1, _T2>( | |
| 128 | piecewise_construct, | |
| 129 | __transform_tuple(typename __uses_alloc_ctor< _T1, polymorphic_allocator&, _Args1... >::type(), | |
| 130 | std::move(__x), | |
| 131 | typename __make_tuple_indices<sizeof...(_Args1)>::type{}), | |
| 132 | __transform_tuple(typename __uses_alloc_ctor< _T2, polymorphic_allocator&, _Args2... >::type(), | |
| 133 | std::move(__y), | |
| 134 | typename __make_tuple_indices<sizeof...(_Args2)>::type{})); | |
| 135 | } | |
| 136 | ||
| 137 | template <class _T1, class _T2> | |
| 138 | _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p) { | |
| 139 | construct(__p, piecewise_construct, tuple<>(), tuple<>()); | |
| 140 | } | |
| 141 | ||
| 142 | template <class _T1, class _T2, class _Up, class _Vp> | |
| 143 | _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, _Up&& __u, _Vp&& __v) { | |
| 144 | construct(__p, | |
| 145 | piecewise_construct, | |
| 146 | std::forward_as_tuple(std::forward<_Up>(__u)), | |
| 147 | std::forward_as_tuple(std::forward<_Vp>(__v))); | |
| 148 | } | |
| 149 | ||
| 150 | template <class _T1, class _T2, class _U1, class _U2> | |
| 151 | _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, const pair<_U1, _U2>& __pr) { | |
| 152 | construct(__p, piecewise_construct, std::forward_as_tuple(__pr.first), std::forward_as_tuple(__pr.second)); | |
| 153 | } | |
| 154 | ||
| 155 | template <class _T1, class _T2, class _U1, class _U2> | |
| 156 | _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, pair<_U1, _U2>&& __pr) { | |
| 157 | construct(__p, | |
| 158 | piecewise_construct, | |
| 159 | std::forward_as_tuple(std::forward<_U1>(__pr.first)), | |
| 160 | std::forward_as_tuple(std::forward<_U2>(__pr.second))); | |
| 161 | } | |
| 162 | ||
| 163 | template <class _Tp> | |
| 164 | _LIBCPP_HIDE_FROM_ABI void destroy(_Tp* __p) { | |
| 165 | __p->~_Tp(); | |
| 166 | } | |
| 167 | ||
| 168 | _LIBCPP_HIDE_FROM_ABI polymorphic_allocator select_on_container_copy_construction() const noexcept { | |
| 169 | return polymorphic_allocator(); | |
| 170 | } | |
| 171 | ||
| 172 | _LIBCPP_HIDE_FROM_ABI memory_resource* resource() const noexcept { return __res_; } | |
| 173 | ||
| 174 | private: | |
| 175 | template <class... _Args, size_t... _Is> | |
| 176 | _LIBCPP_HIDE_FROM_ABI tuple<_Args&&...> | |
| 177 | __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) { | |
| 178 | return std::forward_as_tuple(std::get<_Is>(std::move(__t))...); | |
| 179 | } | |
| 180 | ||
| 181 | template <class... _Args, size_t... _Is> | |
| 182 | _LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...> | |
| 183 | __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) { | |
| 184 | using _Tup = tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>; | |
| 185 | return _Tup(allocator_arg, *this, std::get<_Is>(std::move(__t))...); | |
| 186 | } | |
| 187 | ||
| 188 | template <class... _Args, size_t... _Is> | |
| 189 | _LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., polymorphic_allocator&> | |
| 190 | __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) { | |
| 191 | using _Tup = tuple<_Args&&..., polymorphic_allocator&>; | |
| 192 | return _Tup(std::get<_Is>(std::move(__t))..., *this); | |
| 193 | } | |
| 194 | ||
| 195 | _LIBCPP_HIDE_FROM_ABI size_t __max_size() const noexcept { | |
| 196 | return numeric_limits<size_t>::max() / sizeof(value_type); | |
| 197 | } | |
| 198 | ||
| 199 | memory_resource* __res_; | |
| 200 | }; | |
| 201 | ||
| 202 | // [mem.poly.allocator.eq] | |
| 203 | ||
| 204 | template <class _Tp, class _Up> | |
| 205 | inline _LIBCPP_HIDE_FROM_ABI bool | |
| 206 | operator==(const polymorphic_allocator<_Tp>& __lhs, const polymorphic_allocator<_Up>& __rhs) noexcept { | |
| 207 | return *__lhs.resource() == *__rhs.resource(); | |
| 208 | } | |
| 209 | ||
| 210 | template <class _Tp, class _Up> | |
| 211 | inline _LIBCPP_HIDE_FROM_ABI bool | |
| 212 | operator!=(const polymorphic_allocator<_Tp>& __lhs, const polymorphic_allocator<_Up>& __rhs) noexcept { | |
| 213 | return !(__lhs == __rhs); | |
| 214 | } | |
| 215 | ||
| 216 | } // namespace pmr | |
| 217 | ||
| 218 | _LIBCPP_END_NAMESPACE_STD | |
| 219 | ||
| 220 | #endif // _LIBCPP_STD_VER > 14 | |
| 221 | ||
| 222 | _LIBCPP_POP_MACROS | |
| 223 | ||
| 224 | #endif // _LIBCPP___MEMORY_RESOURCE_POLYMORPHIC_ALLOCATOR_H |
lib/libcxx/include/__memory_resource/pool_options.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 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_RESOURCE_POOL_OPTIONS_H | |
| 10 | #define _LIBCPP___MEMORY_RESOURCE_POOL_OPTIONS_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <cstddef> | |
| 14 | ||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 16 | # pragma GCC system_header | |
| 17 | #endif | |
| 18 | ||
| 19 | #if _LIBCPP_STD_VER > 14 | |
| 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 22 | ||
| 23 | namespace pmr { | |
| 24 | ||
| 25 | // [mem.res.pool.options] | |
| 26 | ||
| 27 | struct _LIBCPP_TYPE_VIS pool_options { | |
| 28 | size_t max_blocks_per_chunk = 0; | |
| 29 | size_t largest_required_pool_block = 0; | |
| 30 | }; | |
| 31 | ||
| 32 | } // namespace pmr | |
| 33 | ||
| 34 | _LIBCPP_END_NAMESPACE_STD | |
| 35 | ||
| 36 | #endif // _LIBCPP_STD_VER > 14 | |
| 37 | ||
| 38 | #endif // _LIBCPP___MEMORY_RESOURCE_POOL_OPTIONS_H |
lib/libcxx/include/__memory_resource/synchronized_pool_resource.h created+94| ... | ... | @@ -0,0 +1,94 @@ |
| 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_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H | |
| 10 | #define _LIBCPP___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__memory_resource/memory_resource.h> | |
| 14 | #include <__memory_resource/pool_options.h> | |
| 15 | #include <__memory_resource/unsynchronized_pool_resource.h> | |
| 16 | #include <cstddef> | |
| 17 | #if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 18 | # include <mutex> | |
| 19 | #endif | |
| 20 | ||
| 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 22 | # pragma GCC system_header | |
| 23 | #endif | |
| 24 | ||
| 25 | #if _LIBCPP_STD_VER > 14 | |
| 26 | ||
| 27 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 28 | ||
| 29 | namespace pmr { | |
| 30 | ||
| 31 | // [mem.res.pool.overview] | |
| 32 | ||
| 33 | class _LIBCPP_TYPE_VIS synchronized_pool_resource : public memory_resource { | |
| 34 | public: | |
| 35 | _LIBCPP_HIDE_FROM_ABI synchronized_pool_resource(const pool_options& __opts, memory_resource* __upstream) | |
| 36 | : __unsync_(__opts, __upstream) {} | |
| 37 | ||
| 38 | _LIBCPP_HIDE_FROM_ABI synchronized_pool_resource() | |
| 39 | : synchronized_pool_resource(pool_options(), get_default_resource()) {} | |
| 40 | ||
| 41 | _LIBCPP_HIDE_FROM_ABI explicit synchronized_pool_resource(memory_resource* __upstream) | |
| 42 | : synchronized_pool_resource(pool_options(), __upstream) {} | |
| 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI explicit synchronized_pool_resource(const pool_options& __opts) | |
| 45 | : synchronized_pool_resource(__opts, get_default_resource()) {} | |
| 46 | ||
| 47 | synchronized_pool_resource(const synchronized_pool_resource&) = delete; | |
| 48 | ||
| 49 | ~synchronized_pool_resource() override = default; | |
| 50 | ||
| 51 | synchronized_pool_resource& operator=(const synchronized_pool_resource&) = delete; | |
| 52 | ||
| 53 | _LIBCPP_HIDE_FROM_ABI void release() { | |
| 54 | # if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 55 | unique_lock<mutex> __lk(__mut_); | |
| 56 | # endif | |
| 57 | __unsync_.release(); | |
| 58 | } | |
| 59 | ||
| 60 | _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __unsync_.upstream_resource(); } | |
| 61 | ||
| 62 | _LIBCPP_HIDE_FROM_ABI pool_options options() const { return __unsync_.options(); } | |
| 63 | ||
| 64 | protected: | |
| 65 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void* do_allocate(size_t __bytes, size_t __align) override { | |
| 66 | # if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 67 | unique_lock<mutex> __lk(__mut_); | |
| 68 | # endif | |
| 69 | return __unsync_.allocate(__bytes, __align); | |
| 70 | } | |
| 71 | ||
| 72 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL void do_deallocate(void* __p, size_t __bytes, size_t __align) override { | |
| 73 | # if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 74 | unique_lock<mutex> __lk(__mut_); | |
| 75 | # endif | |
| 76 | return __unsync_.deallocate(__p, __bytes, __align); | |
| 77 | } | |
| 78 | ||
| 79 | bool do_is_equal(const memory_resource& __other) const noexcept override; // key function | |
| 80 | ||
| 81 | private: | |
| 82 | # if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 83 | mutex __mut_; | |
| 84 | # endif | |
| 85 | unsynchronized_pool_resource __unsync_; | |
| 86 | }; | |
| 87 | ||
| 88 | } // namespace pmr | |
| 89 | ||
| 90 | _LIBCPP_END_NAMESPACE_STD | |
| 91 | ||
| 92 | #endif // _LIBCPP_STD_VER > 14 | |
| 93 | ||
| 94 | #endif // _LIBCPP___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H |
lib/libcxx/include/__memory_resource/unsynchronized_pool_resource.h created+106| ... | ... | @@ -0,0 +1,106 @@ |
| 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_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H | |
| 10 | #define _LIBCPP___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__memory_resource/memory_resource.h> | |
| 14 | #include <__memory_resource/pool_options.h> | |
| 15 | #include <cstddef> | |
| 16 | #include <cstdint> | |
| 17 | ||
| 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 19 | # pragma GCC system_header | |
| 20 | #endif | |
| 21 | ||
| 22 | #if _LIBCPP_STD_VER > 14 | |
| 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 25 | ||
| 26 | namespace pmr { | |
| 27 | ||
| 28 | // [mem.res.pool.overview] | |
| 29 | ||
| 30 | class _LIBCPP_TYPE_VIS unsynchronized_pool_resource : public memory_resource { | |
| 31 | class __fixed_pool; | |
| 32 | ||
| 33 | class __adhoc_pool { | |
| 34 | struct __chunk_footer; | |
| 35 | __chunk_footer* __first_; | |
| 36 | ||
| 37 | public: | |
| 38 | _LIBCPP_HIDE_FROM_ABI explicit __adhoc_pool() : __first_(nullptr) {} | |
| 39 | ||
| 40 | void __release_ptr(memory_resource* __upstream); | |
| 41 | void* __do_allocate(memory_resource* __upstream, size_t __bytes, size_t __align); | |
| 42 | void __do_deallocate(memory_resource* __upstream, void* __p, size_t __bytes, size_t __align); | |
| 43 | }; | |
| 44 | ||
| 45 | static const size_t __min_blocks_per_chunk = 16; | |
| 46 | static const size_t __min_bytes_per_chunk = 1024; | |
| 47 | static const size_t __max_blocks_per_chunk = (size_t(1) << 20); | |
| 48 | static const size_t __max_bytes_per_chunk = (size_t(1) << 30); | |
| 49 | ||
| 50 | static const int __log2_smallest_block_size = 3; | |
| 51 | static const size_t __smallest_block_size = 8; | |
| 52 | static const size_t __default_largest_block_size = (size_t(1) << 20); | |
| 53 | static const size_t __max_largest_block_size = (size_t(1) << 30); | |
| 54 | ||
| 55 | size_t __pool_block_size(int __i) const; | |
| 56 | int __log2_pool_block_size(int __i) const; | |
| 57 | int __pool_index(size_t __bytes, size_t __align) const; | |
| 58 | ||
| 59 | public: | |
| 60 | unsynchronized_pool_resource(const pool_options& __opts, memory_resource* __upstream); | |
| 61 | ||
| 62 | _LIBCPP_HIDE_FROM_ABI unsynchronized_pool_resource() | |
| 63 | : unsynchronized_pool_resource(pool_options(), get_default_resource()) {} | |
| 64 | ||
| 65 | _LIBCPP_HIDE_FROM_ABI explicit unsynchronized_pool_resource(memory_resource* __upstream) | |
| 66 | : unsynchronized_pool_resource(pool_options(), __upstream) {} | |
| 67 | ||
| 68 | _LIBCPP_HIDE_FROM_ABI explicit unsynchronized_pool_resource(const pool_options& __opts) | |
| 69 | : unsynchronized_pool_resource(__opts, get_default_resource()) {} | |
| 70 | ||
| 71 | unsynchronized_pool_resource(const unsynchronized_pool_resource&) = delete; | |
| 72 | ||
| 73 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~unsynchronized_pool_resource() override { release(); } | |
| 74 | ||
| 75 | unsynchronized_pool_resource& operator=(const unsynchronized_pool_resource&) = delete; | |
| 76 | ||
| 77 | void release(); | |
| 78 | ||
| 79 | _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __res_; } | |
| 80 | ||
| 81 | [[__gnu__::__pure__]] pool_options options() const; | |
| 82 | ||
| 83 | protected: | |
| 84 | void* do_allocate(size_t __bytes, size_t __align) override; // key function | |
| 85 | ||
| 86 | void do_deallocate(void* __p, size_t __bytes, size_t __align) override; | |
| 87 | ||
| 88 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool do_is_equal(const memory_resource& __other) const _NOEXCEPT override { | |
| 89 | return &__other == this; | |
| 90 | } | |
| 91 | ||
| 92 | private: | |
| 93 | memory_resource* __res_; | |
| 94 | __adhoc_pool __adhoc_pool_; | |
| 95 | __fixed_pool* __fixed_pools_; | |
| 96 | int __num_fixed_pools_; | |
| 97 | uint32_t __options_max_blocks_per_chunk_; | |
| 98 | }; | |
| 99 | ||
| 100 | } // namespace pmr | |
| 101 | ||
| 102 | _LIBCPP_END_NAMESPACE_STD | |
| 103 | ||
| 104 | #endif // _LIBCPP_STD_VER > 14 | |
| 105 | ||
| 106 | #endif // _LIBCPP___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H |
lib/libcxx/include/__mutex_base+2| ... | ... | @@ -103,6 +103,7 @@ private: |
| 103 | 103 | lock_guard(lock_guard const&) = delete; |
| 104 | 104 | lock_guard& operator=(lock_guard const&) = delete; |
| 105 | 105 | }; |
| 106 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(lock_guard); | |
| 106 | 107 | |
| 107 | 108 | template <class _Mutex> |
| 108 | 109 | class _LIBCPP_TEMPLATE_VIS unique_lock |
| ... | ... | @@ -195,6 +196,7 @@ public: |
| 195 | 196 | _LIBCPP_INLINE_VISIBILITY |
| 196 | 197 | mutex_type* mutex() const _NOEXCEPT {return __m_;} |
| 197 | 198 | }; |
| 199 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(unique_lock); | |
| 198 | 200 | |
| 199 | 201 | template <class _Mutex> |
| 200 | 202 | void |
lib/libcxx/include/__node_handle+4-3| ... | ... | @@ -60,7 +60,8 @@ public: |
| 60 | 60 | |
| 61 | 61 | #include <__assert> |
| 62 | 62 | #include <__config> |
| 63 | #include <memory> | |
| 63 | #include <__memory/allocator_traits.h> | |
| 64 | #include <__memory/pointer_traits.h> | |
| 64 | 65 | #include <optional> |
| 65 | 66 | |
| 66 | 67 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -90,8 +91,8 @@ class _LIBCPP_TEMPLATE_VIS __basic_node_handle |
| 90 | 91 | _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>; |
| 91 | 92 | |
| 92 | 93 | typedef allocator_traits<_Alloc> __alloc_traits; |
| 93 | typedef typename __rebind_pointer<typename __alloc_traits::void_pointer, | |
| 94 | _NodeType>::type | |
| 94 | typedef __rebind_pointer_t<typename __alloc_traits::void_pointer, | |
| 95 | _NodeType> | |
| 95 | 96 | __node_pointer_type; |
| 96 | 97 | |
| 97 | 98 | public: |
lib/libcxx/include/__numeric/accumulate.h+2-2| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | 22 | template <class _InputIterator, class _Tp> |
| 23 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 23 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 24 | 24 | _Tp |
| 25 | 25 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) |
| 26 | 26 | { |
| ... | ... | @@ -34,7 +34,7 @@ accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | template <class _InputIterator, class _Tp, class _BinaryOperation> |
| 37 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 37 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 38 | 38 | _Tp |
| 39 | 39 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) |
| 40 | 40 | { |
lib/libcxx/include/__numeric/adjacent_difference.h+2-2| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | template <class _InputIterator, class _OutputIterator> |
| 24 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 24 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 25 | 25 | _OutputIterator |
| 26 | 26 | adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) |
| 27 | 27 | { |
| ... | ... | @@ -44,7 +44,7 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | template <class _InputIterator, class _OutputIterator, class _BinaryOperation> |
| 47 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 47 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 48 | 48 | _OutputIterator |
| 49 | 49 | adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result, |
| 50 | 50 | _BinaryOperation __binary_op) |
lib/libcxx/include/__numeric/exclusive_scan.h+2-2| ... | ... | @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | #if _LIBCPP_STD_VER > 14 |
| 24 | 24 | |
| 25 | 25 | template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> |
| 26 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator | |
| 26 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | |
| 27 | 27 | exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init, _BinaryOp __b) { |
| 28 | 28 | if (__first != __last) { |
| 29 | 29 | _Tp __tmp(__b(__init, *__first)); |
| ... | ... | @@ -41,7 +41,7 @@ exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __ |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | template <class _InputIterator, class _OutputIterator, class _Tp> |
| 44 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator | |
| 44 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | |
| 45 | 45 | exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init) { |
| 46 | 46 | return _VSTD::exclusive_scan(__first, __last, __result, __init, _VSTD::plus<>()); |
| 47 | 47 | } |
lib/libcxx/include/__numeric/gcd_lcm.h+9-5| ... | ... | @@ -12,8 +12,12 @@ |
| 12 | 12 | |
| 13 | 13 | #include <__assert> |
| 14 | 14 | #include <__config> |
| 15 | #include <__type_traits/common_type.h> | |
| 16 | #include <__type_traits/is_integral.h> | |
| 17 | #include <__type_traits/is_same.h> | |
| 18 | #include <__type_traits/is_signed.h> | |
| 19 | #include <__type_traits/make_unsigned.h> | |
| 15 | 20 | #include <limits> |
| 16 | #include <type_traits> | |
| 17 | 21 | |
| 18 | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 23 | # pragma GCC system_header |
| ... | ... | @@ -60,8 +64,8 @@ common_type_t<_Tp,_Up> |
| 60 | 64 | gcd(_Tp __m, _Up __n) |
| 61 | 65 | { |
| 62 | 66 | static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types"); |
| 63 | static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to gcd cannot be bool" ); | |
| 64 | static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to gcd cannot be bool" ); | |
| 67 | static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to gcd cannot be bool" ); | |
| 68 | static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to gcd cannot be bool" ); | |
| 65 | 69 | using _Rp = common_type_t<_Tp,_Up>; |
| 66 | 70 | using _Wp = make_unsigned_t<_Rp>; |
| 67 | 71 | return static_cast<_Rp>(_VSTD::__gcd( |
| ... | ... | @@ -75,8 +79,8 @@ common_type_t<_Tp,_Up> |
| 75 | 79 | lcm(_Tp __m, _Up __n) |
| 76 | 80 | { |
| 77 | 81 | static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types"); |
| 78 | static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to lcm cannot be bool" ); | |
| 79 | static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to lcm cannot be bool" ); | |
| 82 | static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to lcm cannot be bool" ); | |
| 83 | static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to lcm cannot be bool" ); | |
| 80 | 84 | if (__m == 0 || __n == 0) |
| 81 | 85 | return 0; |
| 82 | 86 |
lib/libcxx/include/__numeric/inclusive_scan.h+3-3| ... | ... | @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | #if _LIBCPP_STD_VER > 14 |
| 25 | 25 | |
| 26 | 26 | template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> |
| 27 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator | |
| 27 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | |
| 28 | 28 | inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _Tp __init) { |
| 29 | 29 | for (; __first != __last; ++__first, (void)++__result) { |
| 30 | 30 | __init = __b(__init, *__first); |
| ... | ... | @@ -34,7 +34,7 @@ inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __ |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | template <class _InputIterator, class _OutputIterator, class _BinaryOp> |
| 37 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator | |
| 37 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator | |
| 38 | 38 | inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b) { |
| 39 | 39 | if (__first != __last) { |
| 40 | 40 | typename iterator_traits<_InputIterator>::value_type __init = *__first; |
| ... | ... | @@ -47,7 +47,7 @@ inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __ |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | template <class _InputIterator, class _OutputIterator> |
| 50 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator inclusive_scan(_InputIterator __first, | |
| 50 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator inclusive_scan(_InputIterator __first, | |
| 51 | 51 | _InputIterator __last, |
| 52 | 52 | _OutputIterator __result) { |
| 53 | 53 | return _VSTD::inclusive_scan(__first, __last, __result, _VSTD::plus<>()); |
lib/libcxx/include/__numeric/inner_product.h+2-2| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | 22 | template <class _InputIterator1, class _InputIterator2, class _Tp> |
| 23 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 23 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 24 | 24 | _Tp |
| 25 | 25 | inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) |
| 26 | 26 | { |
| ... | ... | @@ -34,7 +34,7 @@ inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2> |
| 37 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 37 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 38 | 38 | _Tp |
| 39 | 39 | inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, |
| 40 | 40 | _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) |
lib/libcxx/include/__numeric/iota.h+1-1| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _ForwardIterator, class _Tp> |
| 22 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 22 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 23 | 23 | void |
| 24 | 24 | iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) |
| 25 | 25 | { |
lib/libcxx/include/__numeric/midpoint.h+16-6| ... | ... | @@ -11,8 +11,18 @@ |
| 11 | 11 | #define _LIBCPP___NUMERIC_MIDPOINT_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <__type_traits/enable_if.h> | |
| 15 | #include <__type_traits/is_floating_point.h> | |
| 16 | #include <__type_traits/is_integral.h> | |
| 17 | #include <__type_traits/is_null_pointer.h> | |
| 18 | #include <__type_traits/is_object.h> | |
| 19 | #include <__type_traits/is_pointer.h> | |
| 20 | #include <__type_traits/is_same.h> | |
| 21 | #include <__type_traits/is_void.h> | |
| 22 | #include <__type_traits/make_unsigned.h> | |
| 23 | #include <__type_traits/remove_pointer.h> | |
| 24 | #include <cstddef> | |
| 14 | 25 | #include <limits> |
| 15 | #include <type_traits> | |
| 16 | 26 | |
| 17 | 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 28 | # pragma GCC system_header |
| ... | ... | @@ -55,12 +65,12 @@ midpoint(_TPtr __a, _TPtr __b) noexcept |
| 55 | 65 | |
| 56 | 66 | |
| 57 | 67 | template <typename _Tp> |
| 58 | constexpr int __sign(_Tp __val) { | |
| 68 | _LIBCPP_HIDE_FROM_ABI constexpr int __sign(_Tp __val) { | |
| 59 | 69 | return (_Tp(0) < __val) - (__val < _Tp(0)); |
| 60 | 70 | } |
| 61 | 71 | |
| 62 | 72 | template <typename _Fp> |
| 63 | constexpr _Fp __fp_abs(_Fp __f) { return __f >= 0 ? __f : -__f; } | |
| 73 | _LIBCPP_HIDE_FROM_ABI constexpr _Fp __fp_abs(_Fp __f) { return __f >= 0 ? __f : -__f; } | |
| 64 | 74 | |
| 65 | 75 | template <class _Fp> |
| 66 | 76 | _LIBCPP_INLINE_VISIBILITY constexpr |
| ... | ... | @@ -69,10 +79,10 @@ midpoint(_Fp __a, _Fp __b) noexcept |
| 69 | 79 | { |
| 70 | 80 | constexpr _Fp __lo = numeric_limits<_Fp>::min()*2; |
| 71 | 81 | constexpr _Fp __hi = numeric_limits<_Fp>::max()/2; |
| 72 | return __fp_abs(__a) <= __hi && __fp_abs(__b) <= __hi ? // typical case: overflow is impossible | |
| 82 | return std::__fp_abs(__a) <= __hi && std::__fp_abs(__b) <= __hi ? // typical case: overflow is impossible | |
| 73 | 83 | (__a + __b)/2 : // always correctly rounded |
| 74 | __fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a | |
| 75 | __fp_abs(__b) < __lo ? __a/2 + __b : // not safe to halve b | |
| 84 | std::__fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a | |
| 85 | std::__fp_abs(__b) < __lo ? __a/2 + __b : // not safe to halve b | |
| 76 | 86 | __a/2 + __b/2; // otherwise correctly rounded |
| 77 | 87 | } |
| 78 | 88 |
lib/libcxx/include/__numeric/partial_sum.h+2-2| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | template <class _InputIterator, class _OutputIterator> |
| 24 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 24 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 25 | 25 | _OutputIterator |
| 26 | 26 | partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) |
| 27 | 27 | { |
| ... | ... | @@ -43,7 +43,7 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | template <class _InputIterator, class _OutputIterator, class _BinaryOperation> |
| 46 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 46 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 47 | 47 | _OutputIterator |
| 48 | 48 | partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result, |
| 49 | 49 | _BinaryOperation __binary_op) |
lib/libcxx/include/__numeric/reduce.h+3-3| ... | ... | @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | #if _LIBCPP_STD_VER > 14 |
| 24 | 24 | template <class _InputIterator, class _Tp, class _BinaryOp> |
| 25 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp reduce(_InputIterator __first, _InputIterator __last, | |
| 25 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp reduce(_InputIterator __first, _InputIterator __last, | |
| 26 | 26 | _Tp __init, _BinaryOp __b) { |
| 27 | 27 | for (; __first != __last; ++__first) |
| 28 | 28 | __init = __b(__init, *__first); |
| ... | ... | @@ -30,13 +30,13 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp reduce(_InputIterato |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | template <class _InputIterator, class _Tp> |
| 33 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp reduce(_InputIterator __first, _InputIterator __last, | |
| 33 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp reduce(_InputIterator __first, _InputIterator __last, | |
| 34 | 34 | _Tp __init) { |
| 35 | 35 | return _VSTD::reduce(__first, __last, __init, _VSTD::plus<>()); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | template <class _InputIterator> |
| 39 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename iterator_traits<_InputIterator>::value_type | |
| 39 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 typename iterator_traits<_InputIterator>::value_type | |
| 40 | 40 | reduce(_InputIterator __first, _InputIterator __last) { |
| 41 | 41 | return _VSTD::reduce(__first, __last, typename iterator_traits<_InputIterator>::value_type{}); |
| 42 | 42 | } |
lib/libcxx/include/__numeric/transform_exclusive_scan.h+1-1| ... | ... | @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | template <class _InputIterator, class _OutputIterator, class _Tp, |
| 24 | 24 | class _BinaryOp, class _UnaryOp> |
| 25 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 25 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 26 | 26 | _OutputIterator |
| 27 | 27 | transform_exclusive_scan(_InputIterator __first, _InputIterator __last, |
| 28 | 28 | _OutputIterator __result, _Tp __init, |
lib/libcxx/include/__numeric/transform_inclusive_scan.h+2-2| ... | ... | @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | #if _LIBCPP_STD_VER > 14 |
| 23 | 23 | |
| 24 | 24 | template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp> |
| 25 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 25 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 26 | 26 | _OutputIterator |
| 27 | 27 | transform_inclusive_scan(_InputIterator __first, _InputIterator __last, |
| 28 | 28 | _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init) |
| ... | ... | @@ -36,7 +36,7 @@ transform_inclusive_scan(_InputIterator __first, _InputIterator __last, |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | template <class _InputIterator, class _OutputIterator, class _BinaryOp, class _UnaryOp> |
| 39 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 39 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 40 | 40 | _OutputIterator |
| 41 | 41 | transform_inclusive_scan(_InputIterator __first, _InputIterator __last, |
| 42 | 42 | _OutputIterator __result, _BinaryOp __b, _UnaryOp __u) |
lib/libcxx/include/__numeric/transform_reduce.h+3-3| ... | ... | @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | #if _LIBCPP_STD_VER > 14 |
| 24 | 24 | template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp> |
| 25 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp transform_reduce(_InputIterator __first, | |
| 25 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(_InputIterator __first, | |
| 26 | 26 | _InputIterator __last, _Tp __init, |
| 27 | 27 | _BinaryOp __b, _UnaryOp __u) { |
| 28 | 28 | for (; __first != __last; ++__first) |
| ... | ... | @@ -31,7 +31,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp transform_reduce(_In |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOp1, class _BinaryOp2> |
| 34 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp transform_reduce(_InputIterator1 __first1, | |
| 34 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(_InputIterator1 __first1, | |
| 35 | 35 | _InputIterator1 __last1, |
| 36 | 36 | _InputIterator2 __first2, _Tp __init, |
| 37 | 37 | _BinaryOp1 __b1, _BinaryOp2 __b2) { |
| ... | ... | @@ -41,7 +41,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp transform_reduce(_In |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | template <class _InputIterator1, class _InputIterator2, class _Tp> |
| 44 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp transform_reduce(_InputIterator1 __first1, | |
| 44 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(_InputIterator1 __first1, | |
| 45 | 45 | _InputIterator1 __last1, |
| 46 | 46 | _InputIterator2 __first2, _Tp __init) { |
| 47 | 47 | return _VSTD::transform_reduce(__first1, __last1, __first2, _VSTD::move(__init), _VSTD::plus<>(), |
lib/libcxx/include/__random/bernoulli_distribution.h+2-2| ... | ... | @@ -110,7 +110,7 @@ bernoulli_distribution::operator()(_URNG& __g, const param_type& __p) |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | template <class _CharT, class _Traits> |
| 113 | basic_ostream<_CharT, _Traits>& | |
| 113 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 114 | 114 | operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x) |
| 115 | 115 | { |
| 116 | 116 | __save_flags<_CharT, _Traits> __lx(__os); |
| ... | ... | @@ -123,7 +123,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& _ |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | template <class _CharT, class _Traits> |
| 126 | basic_istream<_CharT, _Traits>& | |
| 126 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 127 | 127 | operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x) |
| 128 | 128 | { |
| 129 | 129 | typedef bernoulli_distribution _Eng; |
lib/libcxx/include/__random/binomial_distribution.h+5-5| ... | ... | @@ -133,9 +133,9 @@ binomial_distribution<_IntType>::param_type::param_type(result_type __t, double |
| 133 | 133 | if (0 < __p_ && __p_ < 1) |
| 134 | 134 | { |
| 135 | 135 | __r0_ = static_cast<result_type>((__t_ + 1) * __p_); |
| 136 | __pr_ = _VSTD::exp(__libcpp_lgamma(__t_ + 1.) - | |
| 137 | __libcpp_lgamma(__r0_ + 1.) - | |
| 138 | __libcpp_lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) + | |
| 136 | __pr_ = _VSTD::exp(std::__libcpp_lgamma(__t_ + 1.) - | |
| 137 | std::__libcpp_lgamma(__r0_ + 1.) - | |
| 138 | std::__libcpp_lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) + | |
| 139 | 139 | (__t_ - __r0_) * _VSTD::log(1 - __p_)); |
| 140 | 140 | __odds_ratio_ = __p_ / (1 - __p_); |
| 141 | 141 | } |
| ... | ... | @@ -189,7 +189,7 @@ binomial_distribution<_IntType>::operator()(_URNG& __g, const param_type& __pr) |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | template <class _CharT, class _Traits, class _IntType> |
| 192 | basic_ostream<_CharT, _Traits>& | |
| 192 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 193 | 193 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 194 | 194 | const binomial_distribution<_IntType>& __x) |
| 195 | 195 | { |
| ... | ... | @@ -203,7 +203,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | template <class _CharT, class _Traits, class _IntType> |
| 206 | basic_istream<_CharT, _Traits>& | |
| 206 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 207 | 207 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 208 | 208 | binomial_distribution<_IntType>& __x) |
| 209 | 209 | { |
lib/libcxx/include/__random/cauchy_distribution.h+2-2| ... | ... | @@ -124,7 +124,7 @@ cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | template <class _CharT, class _Traits, class _RT> |
| 127 | basic_ostream<_CharT, _Traits>& | |
| 127 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 128 | 128 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 129 | 129 | const cauchy_distribution<_RT>& __x) |
| 130 | 130 | { |
| ... | ... | @@ -139,7 +139,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | template <class _CharT, class _Traits, class _RT> |
| 142 | basic_istream<_CharT, _Traits>& | |
| 142 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 143 | 143 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 144 | 144 | cauchy_distribution<_RT>& __x) |
| 145 | 145 | { |
lib/libcxx/include/__random/chi_squared_distribution.h+2-2| ... | ... | @@ -107,7 +107,7 @@ public: |
| 107 | 107 | }; |
| 108 | 108 | |
| 109 | 109 | template <class _CharT, class _Traits, class _RT> |
| 110 | basic_ostream<_CharT, _Traits>& | |
| 110 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 111 | 111 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 112 | 112 | const chi_squared_distribution<_RT>& __x) |
| 113 | 113 | { |
| ... | ... | @@ -120,7 +120,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | template <class _CharT, class _Traits, class _RT> |
| 123 | basic_istream<_CharT, _Traits>& | |
| 123 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 124 | 124 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 125 | 125 | chi_squared_distribution<_RT>& __x) |
| 126 | 126 | { |
lib/libcxx/include/__random/discard_block_engine.h+6-4| ... | ... | @@ -12,8 +12,8 @@ |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__random/is_seed_sequence.h> |
| 14 | 14 | #include <__utility/move.h> |
| 15 | #include <climits> | |
| 16 | 15 | #include <iosfwd> |
| 16 | #include <limits> | |
| 17 | 17 | #include <type_traits> |
| 18 | 18 | |
| 19 | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -33,7 +33,9 @@ class _LIBCPP_TEMPLATE_VIS discard_block_engine |
| 33 | 33 | |
| 34 | 34 | static_assert( 0 < __r, "discard_block_engine invalid parameters"); |
| 35 | 35 | static_assert(__r <= __p, "discard_block_engine invalid parameters"); |
| 36 | static_assert(__r <= INT_MAX, "discard_block_engine invalid parameters"); | |
| 36 | #ifndef _LIBCPP_CXX03_LANG // numeric_limits::max() is not constexpr in C++03 | |
| 37 | static_assert(__r <= numeric_limits<int>::max(), "discard_block_engine invalid parameters"); | |
| 38 | #endif | |
| 37 | 39 | public: |
| 38 | 40 | // types |
| 39 | 41 | typedef typename _Engine::result_type result_type; |
| ... | ... | @@ -164,7 +166,7 @@ operator!=(const discard_block_engine<_Eng, _Pp, _Rp>& __x, |
| 164 | 166 | |
| 165 | 167 | template <class _CharT, class _Traits, |
| 166 | 168 | class _Eng, size_t _Pp, size_t _Rp> |
| 167 | basic_ostream<_CharT, _Traits>& | |
| 169 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 168 | 170 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 169 | 171 | const discard_block_engine<_Eng, _Pp, _Rp>& __x) |
| 170 | 172 | { |
| ... | ... | @@ -178,7 +180,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 178 | 180 | |
| 179 | 181 | template <class _CharT, class _Traits, |
| 180 | 182 | class _Eng, size_t _Pp, size_t _Rp> |
| 181 | basic_istream<_CharT, _Traits>& | |
| 183 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 182 | 184 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 183 | 185 | discard_block_engine<_Eng, _Pp, _Rp>& __x) |
| 184 | 186 | { |
lib/libcxx/include/__random/discrete_distribution.h+2-2| ... | ... | @@ -221,7 +221,7 @@ discrete_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p) |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | template <class _CharT, class _Traits, class _IT> |
| 224 | basic_ostream<_CharT, _Traits>& | |
| 224 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 225 | 225 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 226 | 226 | const discrete_distribution<_IT>& __x) |
| 227 | 227 | { |
| ... | ... | @@ -239,7 +239,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | template <class _CharT, class _Traits, class _IT> |
| 242 | basic_istream<_CharT, _Traits>& | |
| 242 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 243 | 243 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 244 | 244 | discrete_distribution<_IT>& __x) |
| 245 | 245 | { |
lib/libcxx/include/__random/exponential_distribution.h+2-2| ... | ... | @@ -121,7 +121,7 @@ exponential_distribution<_RealType>::operator()(_URNG& __g, const param_type& __ |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | template <class _CharT, class _Traits, class _RealType> |
| 124 | basic_ostream<_CharT, _Traits>& | |
| 124 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 125 | 125 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 126 | 126 | const exponential_distribution<_RealType>& __x) |
| 127 | 127 | { |
| ... | ... | @@ -133,7 +133,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | template <class _CharT, class _Traits, class _RealType> |
| 136 | basic_istream<_CharT, _Traits>& | |
| 136 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 137 | 137 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 138 | 138 | exponential_distribution<_RealType>& __x) |
| 139 | 139 | { |
lib/libcxx/include/__random/extreme_value_distribution.h+2-2| ... | ... | @@ -123,7 +123,7 @@ extreme_value_distribution<_RealType>::operator()(_URNG& __g, const param_type& |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | template <class _CharT, class _Traits, class _RT> |
| 126 | basic_ostream<_CharT, _Traits>& | |
| 126 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 127 | 127 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 128 | 128 | const extreme_value_distribution<_RT>& __x) |
| 129 | 129 | { |
| ... | ... | @@ -138,7 +138,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | template <class _CharT, class _Traits, class _RT> |
| 141 | basic_istream<_CharT, _Traits>& | |
| 141 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 142 | 142 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 143 | 143 | extreme_value_distribution<_RT>& __x) |
| 144 | 144 | { |
lib/libcxx/include/__random/fisher_f_distribution.h+2-2| ... | ... | @@ -122,7 +122,7 @@ fisher_f_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | template <class _CharT, class _Traits, class _RT> |
| 125 | basic_ostream<_CharT, _Traits>& | |
| 125 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 126 | 126 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 127 | 127 | const fisher_f_distribution<_RT>& __x) |
| 128 | 128 | { |
| ... | ... | @@ -137,7 +137,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | template <class _CharT, class _Traits, class _RT> |
| 140 | basic_istream<_CharT, _Traits>& | |
| 140 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 141 | 141 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 142 | 142 | fisher_f_distribution<_RT>& __x) |
| 143 | 143 | { |
lib/libcxx/include/__random/gamma_distribution.h+2-2| ... | ... | @@ -175,7 +175,7 @@ gamma_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | template <class _CharT, class _Traits, class _RT> |
| 178 | basic_ostream<_CharT, _Traits>& | |
| 178 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 179 | 179 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 180 | 180 | const gamma_distribution<_RT>& __x) |
| 181 | 181 | { |
| ... | ... | @@ -190,7 +190,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | template <class _CharT, class _Traits, class _RT> |
| 193 | basic_istream<_CharT, _Traits>& | |
| 193 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 194 | 194 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 195 | 195 | gamma_distribution<_RT>& __x) |
| 196 | 196 | { |
lib/libcxx/include/__random/generate_canonical.h+1-1| ... | ... | @@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 27 | // generate_canonical |
| 28 | 28 | |
| 29 | 29 | template<class _RealType, size_t __bits, class _URNG> |
| 30 | _RealType | |
| 30 | _LIBCPP_HIDE_FROM_ABI _RealType | |
| 31 | 31 | generate_canonical(_URNG& __g) |
| 32 | 32 | { |
| 33 | 33 | const size_t _Dt = numeric_limits<_RealType>::digits; |
lib/libcxx/include/__random/geometric_distribution.h+2-2| ... | ... | @@ -108,7 +108,7 @@ public: |
| 108 | 108 | }; |
| 109 | 109 | |
| 110 | 110 | template <class _CharT, class _Traits, class _IntType> |
| 111 | basic_ostream<_CharT, _Traits>& | |
| 111 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 112 | 112 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 113 | 113 | const geometric_distribution<_IntType>& __x) |
| 114 | 114 | { |
| ... | ... | @@ -120,7 +120,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | template <class _CharT, class _Traits, class _IntType> |
| 123 | basic_istream<_CharT, _Traits>& | |
| 123 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 124 | 124 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 125 | 125 | geometric_distribution<_IntType>& __x) |
| 126 | 126 | { |
lib/libcxx/include/__random/independent_bits_engine.h+4-8| ... | ... | @@ -51,12 +51,8 @@ private: |
| 51 | 51 | static_assert(__w <= _Dt, "independent_bits_engine invalid parameters"); |
| 52 | 52 | |
| 53 | 53 | typedef typename _Engine::result_type _Engine_result_type; |
| 54 | typedef typename conditional | |
| 55 | < | |
| 56 | sizeof(_Engine_result_type) <= sizeof(result_type), | |
| 57 | result_type, | |
| 58 | _Engine_result_type | |
| 59 | >::type _Working_result_type; | |
| 54 | typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type> | |
| 55 | _Working_result_type; | |
| 60 | 56 | #ifdef _LIBCPP_CXX03_LANG |
| 61 | 57 | static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min |
| 62 | 58 | + _Working_result_type(1); |
| ... | ... | @@ -244,7 +240,7 @@ operator!=( |
| 244 | 240 | |
| 245 | 241 | template <class _CharT, class _Traits, |
| 246 | 242 | class _Eng, size_t _Wp, class _UInt> |
| 247 | basic_ostream<_CharT, _Traits>& | |
| 243 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 248 | 244 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 249 | 245 | const independent_bits_engine<_Eng, _Wp, _UInt>& __x) |
| 250 | 246 | { |
| ... | ... | @@ -253,7 +249,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 253 | 249 | |
| 254 | 250 | template <class _CharT, class _Traits, |
| 255 | 251 | class _Eng, size_t _Wp, class _UInt> |
| 256 | basic_istream<_CharT, _Traits>& | |
| 252 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 257 | 253 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 258 | 254 | independent_bits_engine<_Eng, _Wp, _UInt>& __x) |
| 259 | 255 | { |
lib/libcxx/include/__random/is_seed_sequence.h+1-1| ... | ... | @@ -23,7 +23,7 @@ struct __is_seed_sequence |
| 23 | 23 | { |
| 24 | 24 | static _LIBCPP_CONSTEXPR const bool value = |
| 25 | 25 | !is_convertible<_Sseq, typename _Engine::result_type>::value && |
| 26 | !is_same<typename remove_cv<_Sseq>::type, _Engine>::value; | |
| 26 | !is_same<__remove_cv_t<_Sseq>, _Engine>::value; | |
| 27 | 27 | }; |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__random/is_valid.h+1-1| ... | ... | @@ -53,7 +53,7 @@ template<> struct __libcpp_random_is_valid_inttype<__uint128_t> : true_type {}; |
| 53 | 53 | template<class, class = void> struct __libcpp_random_is_valid_urng : false_type {}; |
| 54 | 54 | template<class _Gp> struct __libcpp_random_is_valid_urng<_Gp, __enable_if_t< |
| 55 | 55 | is_unsigned<typename _Gp::result_type>::value && |
| 56 | _IsSame<decltype(declval<_Gp&>()()), typename _Gp::result_type>::value | |
| 56 | _IsSame<decltype(std::declval<_Gp&>()()), typename _Gp::result_type>::value | |
| 57 | 57 | > > : true_type {}; |
| 58 | 58 | |
| 59 | 59 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__random/linear_congruential_engine.h+2-2| ... | ... | @@ -198,7 +198,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 198 | 198 | |
| 199 | 199 | template <class _CharT, class _Traits, |
| 200 | 200 | class _Up, _Up _Ap, _Up _Cp, _Up _Np> |
| 201 | basic_istream<_CharT, _Traits>& | |
| 201 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 202 | 202 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 203 | 203 | linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x); |
| 204 | 204 | |
| ... | ... | @@ -372,7 +372,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 372 | 372 | |
| 373 | 373 | template <class _CharT, class _Traits, |
| 374 | 374 | class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> |
| 375 | basic_istream<_CharT, _Traits>& | |
| 375 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 376 | 376 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 377 | 377 | linear_congruential_engine<_UIntType, __a, __c, __m>& __x) |
| 378 | 378 | { |
lib/libcxx/include/__random/log2.h+3-6| ... | ... | @@ -58,15 +58,12 @@ struct __log2 |
| 58 | 58 | { |
| 59 | 59 | static const size_t value = __log2_imp< |
| 60 | 60 | #ifndef _LIBCPP_HAS_NO_INT128 |
| 61 | typename conditional< | |
| 62 | sizeof(_UIntType) <= sizeof(unsigned long long), | |
| 63 | unsigned long long, | |
| 64 | __uint128_t | |
| 65 | >::type, | |
| 61 | __conditional_t<sizeof(_UIntType) <= sizeof(unsigned long long), unsigned long long, __uint128_t>, | |
| 66 | 62 | #else |
| 67 | 63 | unsigned long long, |
| 68 | 64 | #endif // _LIBCPP_HAS_NO_INT128 |
| 69 | _Xp, sizeof(_UIntType) * __CHAR_BIT__ - 1>::value; | |
| 65 | _Xp, | |
| 66 | sizeof(_UIntType) * __CHAR_BIT__ - 1>::value; | |
| 70 | 67 | }; |
| 71 | 68 | |
| 72 | 69 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__random/mersenne_twister_engine.h+6-6| ... | ... | @@ -36,7 +36,7 @@ class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine; |
| 36 | 36 | template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, |
| 37 | 37 | _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, |
| 38 | 38 | _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> |
| 39 | bool | |
| 39 | _LIBCPP_HIDE_FROM_ABI bool | |
| 40 | 40 | operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, |
| 41 | 41 | _Bp, _Tp, _Cp, _Lp, _Fp>& __x, |
| 42 | 42 | const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, |
| ... | ... | @@ -56,7 +56,7 @@ template <class _CharT, class _Traits, |
| 56 | 56 | class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, |
| 57 | 57 | _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, |
| 58 | 58 | _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> |
| 59 | basic_ostream<_CharT, _Traits>& | |
| 59 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 60 | 60 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 61 | 61 | const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, |
| 62 | 62 | _Bp, _Tp, _Cp, _Lp, _Fp>& __x); |
| ... | ... | @@ -65,7 +65,7 @@ template <class _CharT, class _Traits, |
| 65 | 65 | class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, |
| 66 | 66 | _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, |
| 67 | 67 | _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> |
| 68 | basic_istream<_CharT, _Traits>& | |
| 68 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 69 | 69 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 70 | 70 | mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, |
| 71 | 71 | _Bp, _Tp, _Cp, _Lp, _Fp>& __x); |
| ... | ... | @@ -416,7 +416,7 @@ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, |
| 416 | 416 | template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, |
| 417 | 417 | _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, |
| 418 | 418 | _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> |
| 419 | bool | |
| 419 | _LIBCPP_HIDE_FROM_ABI bool | |
| 420 | 420 | operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, |
| 421 | 421 | _Bp, _Tp, _Cp, _Lp, _Fp>& __x, |
| 422 | 422 | const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, |
| ... | ... | @@ -474,7 +474,7 @@ template <class _CharT, class _Traits, |
| 474 | 474 | class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, |
| 475 | 475 | _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, |
| 476 | 476 | _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> |
| 477 | basic_ostream<_CharT, _Traits>& | |
| 477 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 478 | 478 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 479 | 479 | const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, |
| 480 | 480 | _Bp, _Tp, _Cp, _Lp, _Fp>& __x) |
| ... | ... | @@ -496,7 +496,7 @@ template <class _CharT, class _Traits, |
| 496 | 496 | class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, |
| 497 | 497 | _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, |
| 498 | 498 | _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> |
| 499 | basic_istream<_CharT, _Traits>& | |
| 499 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 500 | 500 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 501 | 501 | mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, |
| 502 | 502 | _Bp, _Tp, _Cp, _Lp, _Fp>& __x) |
lib/libcxx/include/__random/negative_binomial_distribution.h+2-2| ... | ... | @@ -144,7 +144,7 @@ negative_binomial_distribution<_IntType>::operator()(_URNG& __urng, const param_ |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | template <class _CharT, class _Traits, class _IntType> |
| 147 | basic_ostream<_CharT, _Traits>& | |
| 147 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 148 | 148 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 149 | 149 | const negative_binomial_distribution<_IntType>& __x) |
| 150 | 150 | { |
| ... | ... | @@ -158,7 +158,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | template <class _CharT, class _Traits, class _IntType> |
| 161 | basic_istream<_CharT, _Traits>& | |
| 161 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 162 | 162 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 163 | 163 | negative_binomial_distribution<_IntType>& __x) |
| 164 | 164 | { |
lib/libcxx/include/__random/normal_distribution.h+20-20| ... | ... | @@ -58,8 +58,8 @@ public: |
| 58 | 58 | |
| 59 | 59 | private: |
| 60 | 60 | param_type __p_; |
| 61 | result_type _V_; | |
| 62 | bool _V_hot_; | |
| 61 | result_type __v_; | |
| 62 | bool __v_hot_; | |
| 63 | 63 | |
| 64 | 64 | public: |
| 65 | 65 | // constructors and reset functions |
| ... | ... | @@ -68,18 +68,18 @@ public: |
| 68 | 68 | normal_distribution() : normal_distribution(0) {} |
| 69 | 69 | _LIBCPP_INLINE_VISIBILITY |
| 70 | 70 | explicit normal_distribution(result_type __mean, result_type __stddev = 1) |
| 71 | : __p_(param_type(__mean, __stddev)), _V_hot_(false) {} | |
| 71 | : __p_(param_type(__mean, __stddev)), __v_hot_(false) {} | |
| 72 | 72 | #else |
| 73 | 73 | _LIBCPP_INLINE_VISIBILITY |
| 74 | 74 | explicit normal_distribution(result_type __mean = 0, |
| 75 | 75 | result_type __stddev = 1) |
| 76 | : __p_(param_type(__mean, __stddev)), _V_hot_(false) {} | |
| 76 | : __p_(param_type(__mean, __stddev)), __v_hot_(false) {} | |
| 77 | 77 | #endif |
| 78 | 78 | _LIBCPP_INLINE_VISIBILITY |
| 79 | 79 | explicit normal_distribution(const param_type& __p) |
| 80 | : __p_(__p), _V_hot_(false) {} | |
| 80 | : __p_(__p), __v_hot_(false) {} | |
| 81 | 81 | _LIBCPP_INLINE_VISIBILITY |
| 82 | void reset() {_V_hot_ = false;} | |
| 82 | void reset() {__v_hot_ = false;} | |
| 83 | 83 | |
| 84 | 84 | // generating functions |
| 85 | 85 | template<class _URNG> |
| ... | ... | @@ -107,8 +107,8 @@ public: |
| 107 | 107 | friend _LIBCPP_INLINE_VISIBILITY |
| 108 | 108 | bool operator==(const normal_distribution& __x, |
| 109 | 109 | const normal_distribution& __y) |
| 110 | {return __x.__p_ == __y.__p_ && __x._V_hot_ == __y._V_hot_ && | |
| 111 | (!__x._V_hot_ || __x._V_ == __y._V_);} | |
| 110 | {return __x.__p_ == __y.__p_ && __x.__v_hot_ == __y.__v_hot_ && | |
| 111 | (!__x.__v_hot_ || __x.__v_ == __y.__v_);} | |
| 112 | 112 | friend _LIBCPP_INLINE_VISIBILITY |
| 113 | 113 | bool operator!=(const normal_distribution& __x, |
| 114 | 114 | const normal_distribution& __y) |
| ... | ... | @@ -134,10 +134,10 @@ normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) |
| 134 | 134 | { |
| 135 | 135 | static_assert(__libcpp_random_is_valid_urng<_URNG>::value, ""); |
| 136 | 136 | result_type _Up; |
| 137 | if (_V_hot_) | |
| 137 | if (__v_hot_) | |
| 138 | 138 | { |
| 139 | _V_hot_ = false; | |
| 140 | _Up = _V_; | |
| 139 | __v_hot_ = false; | |
| 140 | _Up = __v_; | |
| 141 | 141 | } |
| 142 | 142 | else |
| 143 | 143 | { |
| ... | ... | @@ -152,15 +152,15 @@ normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) |
| 152 | 152 | __s = __u * __u + __v * __v; |
| 153 | 153 | } while (__s > 1 || __s == 0); |
| 154 | 154 | result_type _Fp = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s); |
| 155 | _V_ = __v * _Fp; | |
| 156 | _V_hot_ = true; | |
| 155 | __v_ = __v * _Fp; | |
| 156 | __v_hot_ = true; | |
| 157 | 157 | _Up = __u * _Fp; |
| 158 | 158 | } |
| 159 | 159 | return _Up * __p.stddev() + __p.mean(); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | template <class _CharT, class _Traits, class _RT> |
| 163 | basic_ostream<_CharT, _Traits>& | |
| 163 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 164 | 164 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 165 | 165 | const normal_distribution<_RT>& __x) |
| 166 | 166 | { |
| ... | ... | @@ -170,14 +170,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 170 | 170 | _OStream::scientific); |
| 171 | 171 | _CharT __sp = __os.widen(' '); |
| 172 | 172 | __os.fill(__sp); |
| 173 | __os << __x.mean() << __sp << __x.stddev() << __sp << __x._V_hot_; | |
| 174 | if (__x._V_hot_) | |
| 175 | __os << __sp << __x._V_; | |
| 173 | __os << __x.mean() << __sp << __x.stddev() << __sp << __x.__v_hot_; | |
| 174 | if (__x.__v_hot_) | |
| 175 | __os << __sp << __x.__v_; | |
| 176 | 176 | return __os; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | template <class _CharT, class _Traits, class _RT> |
| 180 | basic_istream<_CharT, _Traits>& | |
| 180 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 181 | 181 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 182 | 182 | normal_distribution<_RT>& __x) |
| 183 | 183 | { |
| ... | ... | @@ -197,8 +197,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 197 | 197 | if (!__is.fail()) |
| 198 | 198 | { |
| 199 | 199 | __x.param(param_type(__mean, __stddev)); |
| 200 | __x._V_hot_ = _V_hot; | |
| 201 | __x._V_ = _Vp; | |
| 200 | __x.__v_hot_ = _V_hot; | |
| 201 | __x.__v_ = _Vp; | |
| 202 | 202 | } |
| 203 | 203 | return __is; |
| 204 | 204 | } |
lib/libcxx/include/__random/piecewise_constant_distribution.h+2-2| ... | ... | @@ -294,7 +294,7 @@ piecewise_constant_distribution<_RealType>::operator()(_URNG& __g, const param_t |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | template <class _CharT, class _Traits, class _RT> |
| 297 | basic_ostream<_CharT, _Traits>& | |
| 297 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 298 | 298 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 299 | 299 | const piecewise_constant_distribution<_RT>& __x) |
| 300 | 300 | { |
| ... | ... | @@ -320,7 +320,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | template <class _CharT, class _Traits, class _RT> |
| 323 | basic_istream<_CharT, _Traits>& | |
| 323 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 324 | 324 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 325 | 325 | piecewise_constant_distribution<_RT>& __x) |
| 326 | 326 | { |
lib/libcxx/include/__random/piecewise_linear_distribution.h+2-2| ... | ... | @@ -310,7 +310,7 @@ piecewise_linear_distribution<_RealType>::operator()(_URNG& __g, const param_typ |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | template <class _CharT, class _Traits, class _RT> |
| 313 | basic_ostream<_CharT, _Traits>& | |
| 313 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 314 | 314 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 315 | 315 | const piecewise_linear_distribution<_RT>& __x) |
| 316 | 316 | { |
| ... | ... | @@ -336,7 +336,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | template <class _CharT, class _Traits, class _RT> |
| 339 | basic_istream<_CharT, _Traits>& | |
| 339 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 340 | 340 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 341 | 341 | piecewise_linear_distribution<_RT>& __x) |
| 342 | 342 | { |
lib/libcxx/include/__random/poisson_distribution.h+2-2| ... | ... | @@ -245,7 +245,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | template <class _CharT, class _Traits, class _IntType> |
| 248 | basic_ostream<_CharT, _Traits>& | |
| 248 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 249 | 249 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 250 | 250 | const poisson_distribution<_IntType>& __x) |
| 251 | 251 | { |
| ... | ... | @@ -257,7 +257,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | template <class _CharT, class _Traits, class _IntType> |
| 260 | basic_istream<_CharT, _Traits>& | |
| 260 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 261 | 261 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 262 | 262 | poisson_distribution<_IntType>& __x) |
| 263 | 263 | { |
lib/libcxx/include/__random/shuffle_order_engine.h+21-21| ... | ... | @@ -60,8 +60,8 @@ public: |
| 60 | 60 | |
| 61 | 61 | private: |
| 62 | 62 | _Engine __e_; |
| 63 | result_type _V_[__k]; | |
| 64 | result_type _Y_; | |
| 63 | result_type __v_[__k]; | |
| 64 | result_type __y_; | |
| 65 | 65 | |
| 66 | 66 | public: |
| 67 | 67 | // engine characteristics |
| ... | ... | @@ -157,8 +157,8 @@ private: |
| 157 | 157 | void __init() |
| 158 | 158 | { |
| 159 | 159 | for (size_t __i = 0; __i < __k; ++__i) |
| 160 | _V_[__i] = __e_(); | |
| 161 | _Y_ = __e_(); | |
| 160 | __v_[__i] = __e_(); | |
| 161 | __y_ = __e_(); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -190,11 +190,11 @@ private: |
| 190 | 190 | >::type |
| 191 | 191 | __eval(__uratio<_Np, _Dp>) |
| 192 | 192 | { |
| 193 | const size_t __j = static_cast<size_t>(__uratio<_Np, _Dp>::num * (_Y_ - _Min) | |
| 193 | const size_t __j = static_cast<size_t>(__uratio<_Np, _Dp>::num * (__y_ - _Min) | |
| 194 | 194 | / __uratio<_Np, _Dp>::den); |
| 195 | _Y_ = _V_[__j]; | |
| 196 | _V_[__j] = __e_(); | |
| 197 | return _Y_; | |
| 195 | __y_ = __v_[__j]; | |
| 196 | __v_[__j] = __e_(); | |
| 197 | return __y_; | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | template <uint64_t __n, uint64_t __d> |
| ... | ... | @@ -204,10 +204,10 @@ private: |
| 204 | 204 | const double _Fp = __d == 0 ? |
| 205 | 205 | __n / (2. * 0x8000000000000000ull) : |
| 206 | 206 | __n / (double)__d; |
| 207 | const size_t __j = static_cast<size_t>(_Fp * (_Y_ - _Min)); | |
| 208 | _Y_ = _V_[__j]; | |
| 209 | _V_[__j] = __e_(); | |
| 210 | return _Y_; | |
| 207 | const size_t __j = static_cast<size_t>(_Fp * (__y_ - _Min)); | |
| 208 | __y_ = __v_[__j]; | |
| 209 | __v_[__j] = __e_(); | |
| 210 | return __y_; | |
| 211 | 211 | } |
| 212 | 212 | }; |
| 213 | 213 | |
| ... | ... | @@ -215,12 +215,12 @@ template<class _Engine, size_t __k> |
| 215 | 215 | _LIBCPP_CONSTEXPR const size_t shuffle_order_engine<_Engine, __k>::table_size; |
| 216 | 216 | |
| 217 | 217 | template<class _Eng, size_t _Kp> |
| 218 | bool | |
| 218 | _LIBCPP_HIDE_FROM_ABI bool | |
| 219 | 219 | operator==( |
| 220 | 220 | const shuffle_order_engine<_Eng, _Kp>& __x, |
| 221 | 221 | const shuffle_order_engine<_Eng, _Kp>& __y) |
| 222 | 222 | { |
| 223 | return __x._Y_ == __y._Y_ && _VSTD::equal(__x._V_, __x._V_ + _Kp, __y._V_) && | |
| 223 | return __x.__y_ == __y.__y_ && _VSTD::equal(__x.__v_, __x.__v_ + _Kp, __y.__v_) && | |
| 224 | 224 | __x.__e_ == __y.__e_; |
| 225 | 225 | } |
| 226 | 226 | |
| ... | ... | @@ -236,7 +236,7 @@ operator!=( |
| 236 | 236 | |
| 237 | 237 | template <class _CharT, class _Traits, |
| 238 | 238 | class _Eng, size_t _Kp> |
| 239 | basic_ostream<_CharT, _Traits>& | |
| 239 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 240 | 240 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 241 | 241 | const shuffle_order_engine<_Eng, _Kp>& __x) |
| 242 | 242 | { |
| ... | ... | @@ -245,15 +245,15 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 245 | 245 | __os.flags(_Ostream::dec | _Ostream::left); |
| 246 | 246 | _CharT __sp = __os.widen(' '); |
| 247 | 247 | __os.fill(__sp); |
| 248 | __os << __x.__e_ << __sp << __x._V_[0]; | |
| 248 | __os << __x.__e_ << __sp << __x.__v_[0]; | |
| 249 | 249 | for (size_t __i = 1; __i < _Kp; ++__i) |
| 250 | __os << __sp << __x._V_[__i]; | |
| 251 | return __os << __sp << __x._Y_; | |
| 250 | __os << __sp << __x.__v_[__i]; | |
| 251 | return __os << __sp << __x.__y_; | |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | template <class _CharT, class _Traits, |
| 255 | 255 | class _Eng, size_t _Kp> |
| 256 | basic_istream<_CharT, _Traits>& | |
| 256 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 257 | 257 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 258 | 258 | shuffle_order_engine<_Eng, _Kp>& __x) |
| 259 | 259 | { |
| ... | ... | @@ -270,8 +270,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 270 | 270 | { |
| 271 | 271 | __x.__e_ = __e; |
| 272 | 272 | for (size_t __i = 0; __i < _Kp; ++__i) |
| 273 | __x._V_[__i] = _Vp[__i]; | |
| 274 | __x._Y_ = _Vp[_Kp]; | |
| 273 | __x.__v_[__i] = _Vp[__i]; | |
| 274 | __x.__y_ = _Vp[_Kp]; | |
| 275 | 275 | } |
| 276 | 276 | return __is; |
| 277 | 277 | } |
lib/libcxx/include/__random/student_t_distribution.h+2-2| ... | ... | @@ -118,7 +118,7 @@ student_t_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | template <class _CharT, class _Traits, class _RT> |
| 121 | basic_ostream<_CharT, _Traits>& | |
| 121 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 122 | 122 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 123 | 123 | const student_t_distribution<_RT>& __x) |
| 124 | 124 | { |
| ... | ... | @@ -131,7 +131,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | template <class _CharT, class _Traits, class _RT> |
| 134 | basic_istream<_CharT, _Traits>& | |
| 134 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 135 | 135 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 136 | 136 | student_t_distribution<_RT>& __x) |
| 137 | 137 | { |
lib/libcxx/include/__random/subtract_with_carry_engine.h+6-6| ... | ... | @@ -33,7 +33,7 @@ template<class _UIntType, size_t __w, size_t __s, size_t __r> |
| 33 | 33 | class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine; |
| 34 | 34 | |
| 35 | 35 | template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> |
| 36 | bool | |
| 36 | _LIBCPP_HIDE_FROM_ABI bool | |
| 37 | 37 | operator==( |
| 38 | 38 | const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, |
| 39 | 39 | const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); |
| ... | ... | @@ -47,13 +47,13 @@ operator!=( |
| 47 | 47 | |
| 48 | 48 | template <class _CharT, class _Traits, |
| 49 | 49 | class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> |
| 50 | basic_ostream<_CharT, _Traits>& | |
| 50 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 51 | 51 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 52 | 52 | const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); |
| 53 | 53 | |
| 54 | 54 | template <class _CharT, class _Traits, |
| 55 | 55 | class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> |
| 56 | basic_istream<_CharT, _Traits>& | |
| 56 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 57 | 57 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 58 | 58 | subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); |
| 59 | 59 | |
| ... | ... | @@ -251,7 +251,7 @@ subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()() |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> |
| 254 | bool | |
| 254 | _LIBCPP_HIDE_FROM_ABI bool | |
| 255 | 255 | operator==( |
| 256 | 256 | const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, |
| 257 | 257 | const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y) |
| ... | ... | @@ -305,7 +305,7 @@ operator!=( |
| 305 | 305 | |
| 306 | 306 | template <class _CharT, class _Traits, |
| 307 | 307 | class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> |
| 308 | basic_ostream<_CharT, _Traits>& | |
| 308 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 309 | 309 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 310 | 310 | const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) |
| 311 | 311 | { |
| ... | ... | @@ -325,7 +325,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 325 | 325 | |
| 326 | 326 | template <class _CharT, class _Traits, |
| 327 | 327 | class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> |
| 328 | basic_istream<_CharT, _Traits>& | |
| 328 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 329 | 329 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 330 | 330 | subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) |
| 331 | 331 | { |
lib/libcxx/include/__random/uniform_int_distribution.h+11-12| ... | ... | @@ -9,7 +9,6 @@ |
| 9 | 9 | #ifndef _LIBCPP___RANDOM_UNIFORM_INT_DISTRIBUTION_H |
| 10 | 10 | #define _LIBCPP___RANDOM_UNIFORM_INT_DISTRIBUTION_H |
| 11 | 11 | |
| 12 | #include <__bits> | |
| 13 | 12 | #include <__config> |
| 14 | 13 | #include <__random/is_valid.h> |
| 15 | 14 | #include <__random/log2.h> |
| ... | ... | @@ -38,12 +37,8 @@ public: |
| 38 | 37 | |
| 39 | 38 | private: |
| 40 | 39 | typedef typename _Engine::result_type _Engine_result_type; |
| 41 | typedef typename conditional | |
| 42 | < | |
| 43 | sizeof(_Engine_result_type) <= sizeof(result_type), | |
| 44 | result_type, | |
| 45 | _Engine_result_type | |
| 46 | >::type _Working_result_type; | |
| 40 | typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type> | |
| 41 | _Working_result_type; | |
| 47 | 42 | |
| 48 | 43 | _Engine& __e_; |
| 49 | 44 | size_t __w_; |
| ... | ... | @@ -178,8 +173,10 @@ public: |
| 178 | 173 | result_type a() const {return __a_;} |
| 179 | 174 | result_type b() const {return __b_;} |
| 180 | 175 | |
| 176 | _LIBCPP_HIDE_FROM_ABI | |
| 181 | 177 | friend bool operator==(const param_type& __x, const param_type& __y) |
| 182 | 178 | {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;} |
| 179 | _LIBCPP_HIDE_FROM_ABI | |
| 183 | 180 | friend bool operator!=(const param_type& __x, const param_type& __y) |
| 184 | 181 | {return !(__x == __y);} |
| 185 | 182 | }; |
| ... | ... | @@ -218,9 +215,11 @@ public: |
| 218 | 215 | result_type min() const {return a();} |
| 219 | 216 | result_type max() const {return b();} |
| 220 | 217 | |
| 218 | _LIBCPP_HIDE_FROM_ABI | |
| 221 | 219 | friend bool operator==(const uniform_int_distribution& __x, |
| 222 | 220 | const uniform_int_distribution& __y) |
| 223 | 221 | {return __x.__p_ == __y.__p_;} |
| 222 | _LIBCPP_HIDE_FROM_ABI | |
| 224 | 223 | friend bool operator!=(const uniform_int_distribution& __x, |
| 225 | 224 | const uniform_int_distribution& __y) |
| 226 | 225 | {return !(__x == __y);} |
| ... | ... | @@ -233,8 +232,8 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p |
| 233 | 232 | _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 234 | 233 | { |
| 235 | 234 | static_assert(__libcpp_random_is_valid_urng<_URNG>::value, ""); |
| 236 | typedef typename conditional<sizeof(result_type) <= sizeof(uint32_t), uint32_t, | |
| 237 | typename make_unsigned<result_type>::type>::type _UIntType; | |
| 235 | typedef __conditional_t<sizeof(result_type) <= sizeof(uint32_t), uint32_t, __make_unsigned_t<result_type> > | |
| 236 | _UIntType; | |
| 238 | 237 | const _UIntType _Rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1); |
| 239 | 238 | if (_Rp == 1) |
| 240 | 239 | return __p.a(); |
| ... | ... | @@ -242,7 +241,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 242 | 241 | typedef __independent_bits_engine<_URNG, _UIntType> _Eng; |
| 243 | 242 | if (_Rp == 0) |
| 244 | 243 | return static_cast<result_type>(_Eng(__g, _Dt)()); |
| 245 | size_t __w = _Dt - __countl_zero(_Rp) - 1; | |
| 244 | size_t __w = _Dt - std::__countl_zero(_Rp) - 1; | |
| 246 | 245 | if ((_Rp & (numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0) |
| 247 | 246 | ++__w; |
| 248 | 247 | _Eng __e(__g, __w); |
| ... | ... | @@ -255,7 +254,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 255 | 254 | } |
| 256 | 255 | |
| 257 | 256 | template <class _CharT, class _Traits, class _IT> |
| 258 | basic_ostream<_CharT, _Traits>& | |
| 257 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 259 | 258 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 260 | 259 | const uniform_int_distribution<_IT>& __x) |
| 261 | 260 | { |
| ... | ... | @@ -268,7 +267,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 268 | 267 | } |
| 269 | 268 | |
| 270 | 269 | template <class _CharT, class _Traits, class _IT> |
| 271 | basic_istream<_CharT, _Traits>& | |
| 270 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 272 | 271 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 273 | 272 | uniform_int_distribution<_IT>& __x) |
| 274 | 273 | { |
lib/libcxx/include/__random/uniform_real_distribution.h+2-2| ... | ... | @@ -123,7 +123,7 @@ uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& _ |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | template <class _CharT, class _Traits, class _RT> |
| 126 | basic_ostream<_CharT, _Traits>& | |
| 126 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 127 | 127 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 128 | 128 | const uniform_real_distribution<_RT>& __x) |
| 129 | 129 | { |
| ... | ... | @@ -137,7 +137,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | template <class _CharT, class _Traits, class _RT> |
| 140 | basic_istream<_CharT, _Traits>& | |
| 140 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 141 | 141 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 142 | 142 | uniform_real_distribution<_RT>& __x) |
| 143 | 143 | { |
lib/libcxx/include/__random/weibull_distribution.h+2-2| ... | ... | @@ -115,7 +115,7 @@ public: |
| 115 | 115 | }; |
| 116 | 116 | |
| 117 | 117 | template <class _CharT, class _Traits, class _RT> |
| 118 | basic_ostream<_CharT, _Traits>& | |
| 118 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 119 | 119 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 120 | 120 | const weibull_distribution<_RT>& __x) |
| 121 | 121 | { |
| ... | ... | @@ -130,7 +130,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | template <class _CharT, class _Traits, class _RT> |
| 133 | basic_istream<_CharT, _Traits>& | |
| 133 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 134 | 134 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 135 | 135 | weibull_distribution<_RT>& __x) |
| 136 | 136 | { |
lib/libcxx/include/__ranges/access.h+8-2| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_ACCESS_H |
| 10 | 11 | #define _LIBCPP___RANGES_ACCESS_H |
| 11 | 12 | |
| ... | ... | @@ -14,8 +15,13 @@ |
| 14 | 15 | #include <__iterator/concepts.h> |
| 15 | 16 | #include <__iterator/readable_traits.h> |
| 16 | 17 | #include <__ranges/enable_borrowed_range.h> |
| 18 | #include <__type_traits/decay.h> | |
| 19 | #include <__type_traits/is_reference.h> | |
| 20 | #include <__type_traits/remove_cvref.h> | |
| 21 | #include <__type_traits/remove_reference.h> | |
| 17 | 22 | #include <__utility/auto_cast.h> |
| 18 | #include <type_traits> | |
| 23 | #include <__utility/declval.h> | |
| 24 | #include <cstddef> | |
| 19 | 25 | |
| 20 | 26 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 21 | 27 | # pragma GCC system_header |
| ... | ... | @@ -99,7 +105,7 @@ inline namespace __cpo { |
| 99 | 105 | |
| 100 | 106 | namespace ranges { |
| 101 | 107 | template <class _Tp> |
| 102 | using iterator_t = decltype(ranges::begin(declval<_Tp&>())); | |
| 108 | using iterator_t = decltype(ranges::begin(std::declval<_Tp&>())); | |
| 103 | 109 | } // namespace ranges |
| 104 | 110 | |
| 105 | 111 | // [range.access.end] |
lib/libcxx/include/__ranges/all.h+4-3| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_ALL_H |
| 10 | 11 | #define _LIBCPP___RANGES_ALL_H |
| 11 | 12 | |
| ... | ... | @@ -28,7 +29,7 @@ |
| 28 | 29 | |
| 29 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 31 | |
| 31 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 32 | #if _LIBCPP_STD_VER > 17 | |
| 32 | 33 | |
| 33 | 34 | namespace ranges::views { |
| 34 | 35 | |
| ... | ... | @@ -72,11 +73,11 @@ inline namespace __cpo { |
| 72 | 73 | } // namespace __cpo |
| 73 | 74 | |
| 74 | 75 | template<ranges::viewable_range _Range> |
| 75 | using all_t = decltype(views::all(declval<_Range>())); | |
| 76 | using all_t = decltype(views::all(std::declval<_Range>())); | |
| 76 | 77 | |
| 77 | 78 | } // namespace ranges::views |
| 78 | 79 | |
| 79 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 80 | #endif // _LIBCPP_STD_VER > 17 | |
| 80 | 81 | |
| 81 | 82 | _LIBCPP_END_NAMESPACE_STD |
| 82 | 83 |
lib/libcxx/include/__ranges/as_rvalue_view.h created+137| ... | ... | @@ -0,0 +1,137 @@ |
| 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___RANGES_AS_RVALUE_H | |
| 10 | #define _LIBCPP___RANGES_AS_RVALUE_H | |
| 11 | ||
| 12 | #include <__concepts/constructible.h> | |
| 13 | #include <__concepts/same_as.h> | |
| 14 | #include <__config> | |
| 15 | #include <__iterator/move_iterator.h> | |
| 16 | #include <__iterator/move_sentinel.h> | |
| 17 | #include <__ranges/access.h> | |
| 18 | #include <__ranges/all.h> | |
| 19 | #include <__ranges/concepts.h> | |
| 20 | #include <__ranges/enable_borrowed_range.h> | |
| 21 | #include <__ranges/range_adaptor.h> | |
| 22 | #include <__ranges/size.h> | |
| 23 | #include <__ranges/view_interface.h> | |
| 24 | #include <__utility/forward.h> | |
| 25 | #include <__utility/move.h> | |
| 26 | ||
| 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 28 | # pragma GCC system_header | |
| 29 | #endif | |
| 30 | ||
| 31 | #if _LIBCPP_STD_VER >= 23 | |
| 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 34 | ||
| 35 | namespace ranges { | |
| 36 | template <view _View> | |
| 37 | requires input_range<_View> | |
| 38 | class as_rvalue_view : public view_interface<as_rvalue_view<_View>> { | |
| 39 | _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); | |
| 40 | ||
| 41 | public: | |
| 42 | _LIBCPP_HIDE_FROM_ABI as_rvalue_view() | |
| 43 | requires default_initializable<_View> | |
| 44 | = default; | |
| 45 | ||
| 46 | _LIBCPP_HIDE_FROM_ABI constexpr explicit as_rvalue_view(_View __base) : __base_(std::move(__base)) {} | |
| 47 | ||
| 48 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | |
| 49 | requires copy_constructible<_View> | |
| 50 | { | |
| 51 | return __base_; | |
| 52 | } | |
| 53 | ||
| 54 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | |
| 55 | ||
| 56 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() | |
| 57 | requires(!__simple_view<_View>) | |
| 58 | { | |
| 59 | return move_iterator(ranges::begin(__base_)); | |
| 60 | } | |
| 61 | ||
| 62 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | |
| 63 | requires range<const _View> | |
| 64 | { | |
| 65 | return move_iterator(ranges::begin(__base_)); | |
| 66 | } | |
| 67 | ||
| 68 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() | |
| 69 | requires(!__simple_view<_View>) | |
| 70 | { | |
| 71 | if constexpr (common_range<_View>) { | |
| 72 | return move_iterator(ranges::end(__base_)); | |
| 73 | } else { | |
| 74 | return move_sentinel(ranges::end(__base_)); | |
| 75 | } | |
| 76 | } | |
| 77 | ||
| 78 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | |
| 79 | requires range<const _View> | |
| 80 | { | |
| 81 | if constexpr (common_range<const _View>) { | |
| 82 | return move_iterator(ranges::end(__base_)); | |
| 83 | } else { | |
| 84 | return move_sentinel(ranges::end(__base_)); | |
| 85 | } | |
| 86 | } | |
| 87 | ||
| 88 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() | |
| 89 | requires sized_range<_View> | |
| 90 | { | |
| 91 | return ranges::size(__base_); | |
| 92 | } | |
| 93 | ||
| 94 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | |
| 95 | requires sized_range<const _View> | |
| 96 | { | |
| 97 | return ranges::size(__base_); | |
| 98 | } | |
| 99 | }; | |
| 100 | ||
| 101 | template <class _Range> | |
| 102 | as_rvalue_view(_Range&&) -> as_rvalue_view<views::all_t<_Range>>; | |
| 103 | ||
| 104 | template <class _View> | |
| 105 | inline constexpr bool enable_borrowed_range<as_rvalue_view<_View>> = enable_borrowed_range<_View>; | |
| 106 | ||
| 107 | namespace views { | |
| 108 | namespace __as_rvalue { | |
| 109 | struct __fn : __range_adaptor_closure<__fn> { | |
| 110 | template <class _Range> | |
| 111 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const | |
| 112 | noexcept(noexcept(/**/ as_rvalue_view(std::forward<_Range>(__range)))) | |
| 113 | -> decltype(/*--*/ as_rvalue_view(std::forward<_Range>(__range))) { | |
| 114 | return /*-------------*/ as_rvalue_view(std::forward<_Range>(__range)); | |
| 115 | } | |
| 116 | ||
| 117 | template <class _Range> | |
| 118 | requires same_as<range_rvalue_reference_t<_Range>, range_reference_t<_Range>> | |
| 119 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const | |
| 120 | noexcept(noexcept(/**/ views::all(std::forward<_Range>(__range)))) | |
| 121 | -> decltype(/*--*/ views::all(std::forward<_Range>(__range))) { | |
| 122 | return /*-------------*/ views::all(std::forward<_Range>(__range)); | |
| 123 | } | |
| 124 | }; | |
| 125 | } // namespace __as_rvalue | |
| 126 | ||
| 127 | inline namespace __cpo { | |
| 128 | constexpr auto as_rvalue = __as_rvalue::__fn{}; | |
| 129 | } // namespace __cpo | |
| 130 | } // namespace views | |
| 131 | } // namespace ranges | |
| 132 | ||
| 133 | _LIBCPP_END_NAMESPACE_STD | |
| 134 | ||
| 135 | #endif // _LIBCPP_STD_VER >= 23 | |
| 136 | ||
| 137 | #endif // _LIBCPP___RANGES_AS_RVALUE_H |
lib/libcxx/include/__ranges/common_view.h+5-3| ... | ... | @@ -6,9 +6,12 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_COMMON_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_COMMON_VIEW_H |
| 11 | 12 | |
| 13 | #include <__concepts/constructible.h> | |
| 14 | #include <__concepts/copyable.h> | |
| 12 | 15 | #include <__config> |
| 13 | 16 | #include <__iterator/common_iterator.h> |
| 14 | 17 | #include <__iterator/iterator_traits.h> |
| ... | ... | @@ -21,7 +24,6 @@ |
| 21 | 24 | #include <__ranges/view_interface.h> |
| 22 | 25 | #include <__utility/forward.h> |
| 23 | 26 | #include <__utility/move.h> |
| 24 | #include <concepts> | |
| 25 | 27 | #include <type_traits> |
| 26 | 28 | |
| 27 | 29 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -30,7 +32,7 @@ |
| 30 | 32 | |
| 31 | 33 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 32 | 34 | |
| 33 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 35 | #if _LIBCPP_STD_VER > 17 | |
| 34 | 36 | |
| 35 | 37 | namespace ranges { |
| 36 | 38 | |
| ... | ... | @@ -128,7 +130,7 @@ inline namespace __cpo { |
| 128 | 130 | } // namespace views |
| 129 | 131 | } // namespace ranges |
| 130 | 132 | |
| 131 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 133 | #endif // _LIBCPP_STD_VER > 17 | |
| 132 | 134 | |
| 133 | 135 | _LIBCPP_END_NAMESPACE_STD |
| 134 | 136 |
lib/libcxx/include/__ranges/concepts.h+8-3| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_CONCEPTS_H |
| 10 | 11 | #define _LIBCPP___RANGES_CONCEPTS_H |
| 11 | 12 | |
| ... | ... | @@ -23,8 +24,12 @@ |
| 23 | 24 | #include <__ranges/enable_borrowed_range.h> |
| 24 | 25 | #include <__ranges/enable_view.h> |
| 25 | 26 | #include <__ranges/size.h> |
| 27 | #include <__type_traits/add_pointer.h> | |
| 28 | #include <__type_traits/is_reference.h> | |
| 29 | #include <__type_traits/remove_cvref.h> | |
| 30 | #include <__type_traits/remove_reference.h> | |
| 31 | #include <__utility/declval.h> | |
| 26 | 32 | #include <initializer_list> |
| 27 | #include <type_traits> | |
| 28 | 33 | |
| 29 | 34 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 30 | 35 | # pragma GCC system_header |
| ... | ... | @@ -54,7 +59,7 @@ namespace ranges { |
| 54 | 59 | // `iterator_t` defined in <__ranges/access.h> |
| 55 | 60 | |
| 56 | 61 | template <range _Rp> |
| 57 | using sentinel_t = decltype(ranges::end(declval<_Rp&>())); | |
| 62 | using sentinel_t = decltype(ranges::end(std::declval<_Rp&>())); | |
| 58 | 63 | |
| 59 | 64 | template <range _Rp> |
| 60 | 65 | using range_difference_t = iter_difference_t<iterator_t<_Rp>>; |
| ... | ... | @@ -73,7 +78,7 @@ namespace ranges { |
| 73 | 78 | concept sized_range = range<_Tp> && requires(_Tp& __t) { ranges::size(__t); }; |
| 74 | 79 | |
| 75 | 80 | template<sized_range _Rp> |
| 76 | using range_size_t = decltype(ranges::size(declval<_Rp&>())); | |
| 81 | using range_size_t = decltype(ranges::size(std::declval<_Rp&>())); | |
| 77 | 82 | |
| 78 | 83 | // `disable_sized_range` defined in `<__ranges/size.h>` |
| 79 | 84 |
lib/libcxx/include/__ranges/copyable_box.h+5-3| ... | ... | @@ -10,11 +10,13 @@ |
| 10 | 10 | #ifndef _LIBCPP___RANGES_COPYABLE_BOX_H |
| 11 | 11 | #define _LIBCPP___RANGES_COPYABLE_BOX_H |
| 12 | 12 | |
| 13 | #include <__concepts/constructible.h> | |
| 14 | #include <__concepts/copyable.h> | |
| 15 | #include <__concepts/movable.h> | |
| 13 | 16 | #include <__config> |
| 14 | 17 | #include <__memory/addressof.h> |
| 15 | 18 | #include <__memory/construct_at.h> |
| 16 | 19 | #include <__utility/move.h> |
| 17 | #include <concepts> | |
| 18 | 20 | #include <optional> |
| 19 | 21 | #include <type_traits> |
| 20 | 22 | |
| ... | ... | @@ -24,7 +26,7 @@ |
| 24 | 26 | |
| 25 | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 28 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 30 | |
| 29 | 31 | // __copyable_box allows turning a type that is copy-constructible (but maybe not copy-assignable) into |
| 30 | 32 | // a type that is both copy-constructible and copy-assignable. It does that by introducing an empty state |
| ... | ... | @@ -171,7 +173,7 @@ namespace ranges { |
| 171 | 173 | }; |
| 172 | 174 | } // namespace ranges |
| 173 | 175 | |
| 174 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 176 | #endif // _LIBCPP_STD_VER > 17 | |
| 175 | 177 | |
| 176 | 178 | _LIBCPP_END_NAMESPACE_STD |
| 177 | 179 |
lib/libcxx/include/__ranges/counted.h+3-2| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_COUNTED_H |
| 10 | 11 | #define _LIBCPP___RANGES_COUNTED_H |
| 11 | 12 | |
| ... | ... | @@ -29,7 +30,7 @@ |
| 29 | 30 | |
| 30 | 31 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 32 | |
| 32 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 33 | #if _LIBCPP_STD_VER > 17 | |
| 33 | 34 | |
| 34 | 35 | namespace ranges::views { |
| 35 | 36 | |
| ... | ... | @@ -74,7 +75,7 @@ inline namespace __cpo { |
| 74 | 75 | |
| 75 | 76 | } // namespace ranges::views |
| 76 | 77 | |
| 77 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 78 | #endif // _LIBCPP_STD_VER > 17 | |
| 78 | 79 | |
| 79 | 80 | _LIBCPP_END_NAMESPACE_STD |
| 80 | 81 |
lib/libcxx/include/__ranges/dangling.h+1-1| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | #include <__config> |
| 14 | 14 | #include <__ranges/access.h> |
| 15 | 15 | #include <__ranges/concepts.h> |
| 16 | #include <type_traits> | |
| 16 | #include <__type_traits/conditional.h> | |
| 17 | 17 | |
| 18 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 19 | # pragma GCC system_header |
lib/libcxx/include/__ranges/data.h+7-1| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_DATA_H |
| 10 | 11 | #define _LIBCPP___RANGES_DATA_H |
| 11 | 12 | |
| ... | ... | @@ -15,8 +16,13 @@ |
| 15 | 16 | #include <__iterator/iterator_traits.h> |
| 16 | 17 | #include <__memory/pointer_traits.h> |
| 17 | 18 | #include <__ranges/access.h> |
| 19 | #include <__type_traits/decay.h> | |
| 20 | #include <__type_traits/is_object.h> | |
| 21 | #include <__type_traits/is_pointer.h> | |
| 22 | #include <__type_traits/is_reference.h> | |
| 23 | #include <__type_traits/remove_pointer.h> | |
| 24 | #include <__type_traits/remove_reference.h> | |
| 18 | 25 | #include <__utility/auto_cast.h> |
| 19 | #include <type_traits> | |
| 20 | 26 | |
| 21 | 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 22 | 28 | # pragma GCC system_header |
lib/libcxx/include/__ranges/drop_view.h+5-3| ... | ... | @@ -6,11 +6,14 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_DROP_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_DROP_VIEW_H |
| 11 | 12 | |
| 12 | 13 | #include <__algorithm/min.h> |
| 13 | 14 | #include <__assert> |
| 15 | #include <__concepts/constructible.h> | |
| 16 | #include <__concepts/convertible_to.h> | |
| 14 | 17 | #include <__config> |
| 15 | 18 | #include <__functional/bind_back.h> |
| 16 | 19 | #include <__fwd/span.h> |
| ... | ... | @@ -33,7 +36,6 @@ |
| 33 | 36 | #include <__utility/auto_cast.h> |
| 34 | 37 | #include <__utility/forward.h> |
| 35 | 38 | #include <__utility/move.h> |
| 36 | #include <concepts> | |
| 37 | 39 | #include <type_traits> |
| 38 | 40 | |
| 39 | 41 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -45,7 +47,7 @@ _LIBCPP_PUSH_MACROS |
| 45 | 47 | |
| 46 | 48 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 47 | 49 | |
| 48 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 50 | #if _LIBCPP_STD_VER > 17 | |
| 49 | 51 | |
| 50 | 52 | namespace ranges { |
| 51 | 53 | template<view _View> |
| ... | ... | @@ -297,7 +299,7 @@ inline namespace __cpo { |
| 297 | 299 | |
| 298 | 300 | } // namespace ranges |
| 299 | 301 | |
| 300 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 302 | #endif // _LIBCPP_STD_VER > 17 | |
| 301 | 303 | |
| 302 | 304 | _LIBCPP_END_NAMESPACE_STD |
| 303 | 305 |
lib/libcxx/include/__ranges/drop_while_view.h created+129| ... | ... | @@ -0,0 +1,129 @@ |
| 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_DROP_WHILE_VIEW_H | |
| 11 | #define _LIBCPP___RANGES_DROP_WHILE_VIEW_H | |
| 12 | ||
| 13 | #include <__algorithm/ranges_find_if_not.h> | |
| 14 | #include <__assert> | |
| 15 | #include <__concepts/constructible.h> | |
| 16 | #include <__config> | |
| 17 | #include <__functional/bind_back.h> | |
| 18 | #include <__functional/reference_wrapper.h> | |
| 19 | #include <__iterator/concepts.h> | |
| 20 | #include <__ranges/access.h> | |
| 21 | #include <__ranges/all.h> | |
| 22 | #include <__ranges/concepts.h> | |
| 23 | #include <__ranges/copyable_box.h> | |
| 24 | #include <__ranges/enable_borrowed_range.h> | |
| 25 | #include <__ranges/non_propagating_cache.h> | |
| 26 | #include <__ranges/range_adaptor.h> | |
| 27 | #include <__ranges/view_interface.h> | |
| 28 | #include <__type_traits/conditional.h> | |
| 29 | #include <__type_traits/decay.h> | |
| 30 | #include <__type_traits/is_nothrow_constructible.h> | |
| 31 | #include <__type_traits/is_object.h> | |
| 32 | #include <__utility/forward.h> | |
| 33 | #include <__utility/in_place.h> | |
| 34 | #include <__utility/move.h> | |
| 35 | ||
| 36 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 37 | # pragma GCC system_header | |
| 38 | #endif | |
| 39 | ||
| 40 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 41 | ||
| 42 | #if _LIBCPP_STD_VER >= 20 | |
| 43 | ||
| 44 | namespace ranges { | |
| 45 | ||
| 46 | template <view _View, class _Pred> | |
| 47 | requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>> | |
| 48 | class drop_while_view : public view_interface<drop_while_view<_View, _Pred>> { | |
| 49 | public: | |
| 50 | _LIBCPP_HIDE_FROM_ABI drop_while_view() | |
| 51 | requires default_initializable<_View> && default_initializable<_Pred> | |
| 52 | = default; | |
| 53 | ||
| 54 | _LIBCPP_HIDE_FROM_ABI constexpr drop_while_view(_View __base, _Pred __pred) | |
| 55 | : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {} | |
| 56 | ||
| 57 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | |
| 58 | requires copy_constructible<_View> | |
| 59 | { | |
| 60 | return __base_; | |
| 61 | } | |
| 62 | ||
| 63 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | |
| 64 | ||
| 65 | _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; } | |
| 66 | ||
| 67 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { | |
| 68 | _LIBCPP_ASSERT(__pred_.__has_value(), | |
| 69 | "drop_while_view needs to have a non-empty predicate before calling begin() -- did a previous " | |
| 70 | "assignment to this drop_while_view fail?"); | |
| 71 | if constexpr (_UseCache) { | |
| 72 | if (!__cached_begin_.__has_value()) { | |
| 73 | __cached_begin_.__emplace(ranges::find_if_not(__base_, std::cref(*__pred_))); | |
| 74 | } | |
| 75 | return *__cached_begin_; | |
| 76 | } else { | |
| 77 | return ranges::find_if_not(__base_, std::cref(*__pred_)); | |
| 78 | } | |
| 79 | } | |
| 80 | ||
| 81 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() { return ranges::end(__base_); } | |
| 82 | ||
| 83 | private: | |
| 84 | _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); | |
| 85 | _LIBCPP_NO_UNIQUE_ADDRESS __copyable_box<_Pred> __pred_; | |
| 86 | ||
| 87 | static constexpr bool _UseCache = forward_range<_View>; | |
| 88 | using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>; | |
| 89 | _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache(); | |
| 90 | }; | |
| 91 | ||
| 92 | template <class _View, class _Pred> | |
| 93 | inline constexpr bool enable_borrowed_range<drop_while_view<_View, _Pred>> = enable_borrowed_range<_View>; | |
| 94 | ||
| 95 | template <class _Range, class _Pred> | |
| 96 | drop_while_view(_Range&&, _Pred) -> drop_while_view<views::all_t<_Range>, _Pred>; | |
| 97 | ||
| 98 | namespace views { | |
| 99 | namespace __drop_while { | |
| 100 | ||
| 101 | struct __fn { | |
| 102 | template <class _Range, class _Pred> | |
| 103 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const | |
| 104 | noexcept(noexcept(/**/ drop_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)))) | |
| 105 | -> decltype(/*--*/ drop_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) { | |
| 106 | return /*-------------*/ drop_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)); | |
| 107 | } | |
| 108 | ||
| 109 | template <class _Pred> | |
| 110 | requires constructible_from<decay_t<_Pred>, _Pred> | |
| 111 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const | |
| 112 | noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) { | |
| 113 | return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred))); | |
| 114 | } | |
| 115 | }; | |
| 116 | ||
| 117 | } // namespace __drop_while | |
| 118 | ||
| 119 | inline namespace __cpo { | |
| 120 | inline constexpr auto drop_while = __drop_while::__fn{}; | |
| 121 | } // namespace __cpo | |
| 122 | } // namespace views | |
| 123 | } // namespace ranges | |
| 124 | ||
| 125 | #endif // _LIBCPP_STD_VER >= 20 | |
| 126 | ||
| 127 | _LIBCPP_END_NAMESPACE_STD | |
| 128 | ||
| 129 | #endif // _LIBCPP___RANGES_DROP_WHILE_VIEW_H |
lib/libcxx/include/__ranges/elements_view.h created+423| ... | ... | @@ -0,0 +1,423 @@ |
| 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_ELEMENTS_VIEW_H | |
| 11 | #define _LIBCPP___RANGES_ELEMENTS_VIEW_H | |
| 12 | ||
| 13 | #include <__compare/three_way_comparable.h> | |
| 14 | #include <__concepts/constructible.h> | |
| 15 | #include <__concepts/convertible_to.h> | |
| 16 | #include <__concepts/derived_from.h> | |
| 17 | #include <__concepts/equality_comparable.h> | |
| 18 | #include <__config> | |
| 19 | #include <__fwd/get.h> | |
| 20 | #include <__iterator/concepts.h> | |
| 21 | #include <__iterator/iterator_traits.h> | |
| 22 | #include <__ranges/access.h> | |
| 23 | #include <__ranges/all.h> | |
| 24 | #include <__ranges/concepts.h> | |
| 25 | #include <__ranges/enable_borrowed_range.h> | |
| 26 | #include <__ranges/range_adaptor.h> | |
| 27 | #include <__ranges/size.h> | |
| 28 | #include <__ranges/view_interface.h> | |
| 29 | #include <__tuple_dir/tuple_element.h> | |
| 30 | #include <__tuple_dir/tuple_like.h> | |
| 31 | #include <__tuple_dir/tuple_size.h> | |
| 32 | #include <__type_traits/is_reference.h> | |
| 33 | #include <__type_traits/maybe_const.h> | |
| 34 | #include <__type_traits/remove_cv.h> | |
| 35 | #include <__type_traits/remove_cvref.h> | |
| 36 | #include <__type_traits/remove_reference.h> | |
| 37 | #include <__utility/declval.h> | |
| 38 | #include <__utility/forward.h> | |
| 39 | #include <__utility/move.h> | |
| 40 | #include <cstddef> | |
| 41 | ||
| 42 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 43 | # pragma GCC system_header | |
| 44 | #endif | |
| 45 | ||
| 46 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 47 | ||
| 48 | #if _LIBCPP_STD_VER >= 20 | |
| 49 | ||
| 50 | namespace ranges { | |
| 51 | ||
| 52 | template <class _View, size_t _Np, bool _Const> | |
| 53 | class __elements_view_iterator; | |
| 54 | ||
| 55 | template <class _View, size_t _Np, bool _Const> | |
| 56 | class __elements_view_sentinel; | |
| 57 | ||
| 58 | template <class _Tp, size_t _Np> | |
| 59 | concept __has_tuple_element = __tuple_like<_Tp> && _Np < tuple_size<_Tp>::value; | |
| 60 | ||
| 61 | template <class _Tp, size_t _Np> | |
| 62 | concept __returnable_element = is_reference_v<_Tp> || move_constructible<tuple_element_t<_Np, _Tp>>; | |
| 63 | ||
| 64 | template <input_range _View, size_t _Np> | |
| 65 | requires view<_View> && __has_tuple_element<range_value_t<_View>, _Np> && | |
| 66 | __has_tuple_element<remove_reference_t<range_reference_t<_View>>, _Np> && | |
| 67 | __returnable_element<range_reference_t<_View>, _Np> | |
| 68 | class elements_view : public view_interface<elements_view<_View, _Np>> { | |
| 69 | public: | |
| 70 | _LIBCPP_HIDE_FROM_ABI elements_view() | |
| 71 | requires default_initializable<_View> | |
| 72 | = default; | |
| 73 | ||
| 74 | _LIBCPP_HIDE_FROM_ABI constexpr explicit elements_view(_View __base) : __base_(std::move(__base)) {} | |
| 75 | ||
| 76 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | |
| 77 | requires copy_constructible<_View> | |
| 78 | { | |
| 79 | return __base_; | |
| 80 | } | |
| 81 | ||
| 82 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | |
| 83 | ||
| 84 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() | |
| 85 | requires(!__simple_view<_View>) | |
| 86 | { | |
| 87 | return __iterator</*_Const=*/false>(ranges::begin(__base_)); | |
| 88 | } | |
| 89 | ||
| 90 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | |
| 91 | requires range<const _View> | |
| 92 | { | |
| 93 | return __iterator</*_Const=*/true>(ranges::begin(__base_)); | |
| 94 | } | |
| 95 | ||
| 96 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() | |
| 97 | requires(!__simple_view<_View> && !common_range<_View>) | |
| 98 | { | |
| 99 | return __sentinel</*_Const=*/false>{ranges::end(__base_)}; | |
| 100 | } | |
| 101 | ||
| 102 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() | |
| 103 | requires(!__simple_view<_View> && common_range<_View>) | |
| 104 | { | |
| 105 | return __iterator</*_Const=*/false>{ranges::end(__base_)}; | |
| 106 | } | |
| 107 | ||
| 108 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | |
| 109 | requires range<const _View> | |
| 110 | { | |
| 111 | return __sentinel</*_Const=*/true>{ranges::end(__base_)}; | |
| 112 | } | |
| 113 | ||
| 114 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | |
| 115 | requires common_range<const _View> | |
| 116 | { | |
| 117 | return __iterator</*_Const=*/true>{ranges::end(__base_)}; | |
| 118 | } | |
| 119 | ||
| 120 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() | |
| 121 | requires sized_range<_View> | |
| 122 | { | |
| 123 | return ranges::size(__base_); | |
| 124 | } | |
| 125 | ||
| 126 | _LIBCPP_HIDE_FROM_ABI constexpr auto size() const | |
| 127 | requires sized_range<const _View> | |
| 128 | { | |
| 129 | return ranges::size(__base_); | |
| 130 | } | |
| 131 | ||
| 132 | private: | |
| 133 | template <bool _Const> | |
| 134 | using __iterator = __elements_view_iterator<_View, _Np, _Const>; | |
| 135 | ||
| 136 | template <bool _Const> | |
| 137 | using __sentinel = __elements_view_sentinel<_View, _Np, _Const>; | |
| 138 | ||
| 139 | _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); | |
| 140 | }; | |
| 141 | ||
| 142 | template <class, size_t> | |
| 143 | struct __elements_view_iterator_category_base {}; | |
| 144 | ||
| 145 | template <forward_range _Base, size_t _Np> | |
| 146 | struct __elements_view_iterator_category_base<_Base, _Np> { | |
| 147 | static consteval auto __get_iterator_category() { | |
| 148 | using _Result = decltype(std::get<_Np>(*std::declval<iterator_t<_Base>>())); | |
| 149 | using _Cat = typename iterator_traits<iterator_t<_Base>>::iterator_category; | |
| 150 | ||
| 151 | if constexpr (!is_lvalue_reference_v<_Result>) { | |
| 152 | return input_iterator_tag{}; | |
| 153 | } else if constexpr (derived_from<_Cat, random_access_iterator_tag>) { | |
| 154 | return random_access_iterator_tag{}; | |
| 155 | } else { | |
| 156 | return _Cat{}; | |
| 157 | } | |
| 158 | } | |
| 159 | ||
| 160 | using iterator_category = decltype(__get_iterator_category()); | |
| 161 | }; | |
| 162 | ||
| 163 | template <class _View, size_t _Np, bool _Const> | |
| 164 | class __elements_view_iterator : public __elements_view_iterator_category_base<__maybe_const<_Const, _View>, _Np> { | |
| 165 | template <class, size_t, bool > | |
| 166 | friend class __elements_view_iterator; | |
| 167 | ||
| 168 | template <class, size_t, bool > | |
| 169 | friend class __elements_view_sentinel; | |
| 170 | ||
| 171 | using _Base = __maybe_const<_Const, _View>; | |
| 172 | ||
| 173 | iterator_t<_Base> __current_ = iterator_t<_Base>(); | |
| 174 | ||
| 175 | _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __get_element(const iterator_t<_Base>& __i) { | |
| 176 | if constexpr (is_reference_v<range_reference_t<_Base>>) { | |
| 177 | return std::get<_Np>(*__i); | |
| 178 | } else { | |
| 179 | using _Element = remove_cv_t<tuple_element_t<_Np, range_reference_t<_Base>>>; | |
| 180 | return static_cast<_Element>(std::get<_Np>(*__i)); | |
| 181 | } | |
| 182 | } | |
| 183 | ||
| 184 | static consteval auto __get_iterator_concept() { | |
| 185 | if constexpr (random_access_range<_Base>) { | |
| 186 | return random_access_iterator_tag{}; | |
| 187 | } else if constexpr (bidirectional_range<_Base>) { | |
| 188 | return bidirectional_iterator_tag{}; | |
| 189 | } else if constexpr (forward_range<_Base>) { | |
| 190 | return forward_iterator_tag{}; | |
| 191 | } else { | |
| 192 | return input_iterator_tag{}; | |
| 193 | } | |
| 194 | } | |
| 195 | ||
| 196 | public: | |
| 197 | using iterator_concept = decltype(__get_iterator_concept()); | |
| 198 | using value_type = remove_cvref_t<tuple_element_t<_Np, range_value_t<_Base>>>; | |
| 199 | using difference_type = range_difference_t<_Base>; | |
| 200 | ||
| 201 | _LIBCPP_HIDE_FROM_ABI __elements_view_iterator() | |
| 202 | requires default_initializable<iterator_t<_Base>> | |
| 203 | = default; | |
| 204 | ||
| 205 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __elements_view_iterator(iterator_t<_Base> __current) | |
| 206 | : __current_(std::move(__current)) {} | |
| 207 | ||
| 208 | _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator(__elements_view_iterator<_View, _Np, !_Const> __i) | |
| 209 | requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> | |
| 210 | : __current_(std::move(__i.__current_)) {} | |
| 211 | ||
| 212 | _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; } | |
| 213 | ||
| 214 | _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); } | |
| 215 | ||
| 216 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return __get_element(__current_); } | |
| 217 | ||
| 218 | _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator& operator++() { | |
| 219 | ++__current_; | |
| 220 | return *this; | |
| 221 | } | |
| 222 | ||
| 223 | _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++__current_; } | |
| 224 | ||
| 225 | _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator operator++(int) | |
| 226 | requires forward_range<_Base> | |
| 227 | { | |
| 228 | auto temp = *this; | |
| 229 | ++__current_; | |
| 230 | return temp; | |
| 231 | } | |
| 232 | ||
| 233 | _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator& operator--() | |
| 234 | requires bidirectional_range<_Base> | |
| 235 | { | |
| 236 | --__current_; | |
| 237 | return *this; | |
| 238 | } | |
| 239 | ||
| 240 | _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator operator--(int) | |
| 241 | requires bidirectional_range<_Base> | |
| 242 | { | |
| 243 | auto temp = *this; | |
| 244 | --__current_; | |
| 245 | return temp; | |
| 246 | } | |
| 247 | ||
| 248 | _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator& operator+=(difference_type __n) | |
| 249 | requires random_access_range<_Base> | |
| 250 | { | |
| 251 | __current_ += __n; | |
| 252 | return *this; | |
| 253 | } | |
| 254 | ||
| 255 | _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator& operator-=(difference_type __n) | |
| 256 | requires random_access_range<_Base> | |
| 257 | { | |
| 258 | __current_ -= __n; | |
| 259 | return *this; | |
| 260 | } | |
| 261 | ||
| 262 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const | |
| 263 | requires random_access_range<_Base> | |
| 264 | { | |
| 265 | return __get_element(__current_ + __n); | |
| 266 | } | |
| 267 | ||
| 268 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | |
| 269 | operator==(const __elements_view_iterator& __x, const __elements_view_iterator& __y) | |
| 270 | requires equality_comparable<iterator_t<_Base>> | |
| 271 | { | |
| 272 | return __x.__current_ == __y.__current_; | |
| 273 | } | |
| 274 | ||
| 275 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | |
| 276 | operator<(const __elements_view_iterator& __x, const __elements_view_iterator& __y) | |
| 277 | requires random_access_range<_Base> | |
| 278 | { | |
| 279 | return __x.__current_ < __y.__current_; | |
| 280 | } | |
| 281 | ||
| 282 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | |
| 283 | operator>(const __elements_view_iterator& __x, const __elements_view_iterator& __y) | |
| 284 | requires random_access_range<_Base> | |
| 285 | { | |
| 286 | return __y < __x; | |
| 287 | } | |
| 288 | ||
| 289 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | |
| 290 | operator<=(const __elements_view_iterator& __x, const __elements_view_iterator& __y) | |
| 291 | requires random_access_range<_Base> | |
| 292 | { | |
| 293 | return !(__y < __x); | |
| 294 | } | |
| 295 | ||
| 296 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | |
| 297 | operator>=(const __elements_view_iterator& __x, const __elements_view_iterator& __y) | |
| 298 | requires random_access_range<_Base> | |
| 299 | { | |
| 300 | return !(__x < __y); | |
| 301 | } | |
| 302 | ||
| 303 | _LIBCPP_HIDE_FROM_ABI friend constexpr auto | |
| 304 | operator<=>(const __elements_view_iterator& __x, const __elements_view_iterator& __y) | |
| 305 | requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>> | |
| 306 | { | |
| 307 | return __x.__current_ <=> __y.__current_; | |
| 308 | } | |
| 309 | ||
| 310 | _LIBCPP_HIDE_FROM_ABI friend constexpr __elements_view_iterator | |
| 311 | operator+(const __elements_view_iterator& __x, difference_type __y) | |
| 312 | requires random_access_range<_Base> | |
| 313 | { | |
| 314 | return __elements_view_iterator{__x} += __y; | |
| 315 | } | |
| 316 | ||
| 317 | _LIBCPP_HIDE_FROM_ABI friend constexpr __elements_view_iterator | |
| 318 | operator+(difference_type __x, const __elements_view_iterator& __y) | |
| 319 | requires random_access_range<_Base> | |
| 320 | { | |
| 321 | return __y + __x; | |
| 322 | } | |
| 323 | ||
| 324 | _LIBCPP_HIDE_FROM_ABI friend constexpr __elements_view_iterator | |
| 325 | operator-(const __elements_view_iterator& __x, difference_type __y) | |
| 326 | requires random_access_range<_Base> | |
| 327 | { | |
| 328 | return __elements_view_iterator{__x} -= __y; | |
| 329 | } | |
| 330 | ||
| 331 | _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type | |
| 332 | operator-(const __elements_view_iterator& __x, const __elements_view_iterator& __y) | |
| 333 | requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> | |
| 334 | { | |
| 335 | return __x.__current_ - __y.__current_; | |
| 336 | } | |
| 337 | }; | |
| 338 | ||
| 339 | template <class _View, size_t _Np, bool _Const> | |
| 340 | class __elements_view_sentinel { | |
| 341 | private: | |
| 342 | using _Base = __maybe_const<_Const, _View>; | |
| 343 | _LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_Base> __end_ = sentinel_t<_Base>(); | |
| 344 | ||
| 345 | template <class, size_t, bool > | |
| 346 | friend class __elements_view_sentinel; | |
| 347 | ||
| 348 | template <bool _AnyConst> | |
| 349 | _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) | |
| 350 | __get_current(const __elements_view_iterator<_View, _Np, _AnyConst>& __iter) { | |
| 351 | return (__iter.__current_); | |
| 352 | } | |
| 353 | ||
| 354 | public: | |
| 355 | _LIBCPP_HIDE_FROM_ABI __elements_view_sentinel() = default; | |
| 356 | ||
| 357 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __elements_view_sentinel(sentinel_t<_Base> __end) | |
| 358 | : __end_(std::move(__end)) {} | |
| 359 | ||
| 360 | _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_sentinel(__elements_view_sentinel<_View, _Np, !_Const> __other) | |
| 361 | requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> | |
| 362 | : __end_(std::move(__other.__end_)) {} | |
| 363 | ||
| 364 | _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } | |
| 365 | ||
| 366 | template <bool _OtherConst> | |
| 367 | requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | |
| 368 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | |
| 369 | operator==(const __elements_view_iterator<_View, _Np, _OtherConst>& __x, const __elements_view_sentinel& __y) { | |
| 370 | return __get_current(__x) == __y.__end_; | |
| 371 | } | |
| 372 | ||
| 373 | template <bool _OtherConst> | |
| 374 | 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 | operator-(const __elements_view_iterator<_View, _Np, _OtherConst>& __x, const __elements_view_sentinel& __y) { | |
| 377 | return __get_current(__x) - __y.__end_; | |
| 378 | } | |
| 379 | ||
| 380 | template <bool _OtherConst> | |
| 381 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | |
| 382 | _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> | |
| 383 | operator-(const __elements_view_sentinel& __x, const __elements_view_iterator<_View, _Np, _OtherConst>& __y) { | |
| 384 | return __x.__end_ - __get_current(__y); | |
| 385 | } | |
| 386 | }; | |
| 387 | ||
| 388 | template <class _Tp, size_t _Np> | |
| 389 | inline constexpr bool enable_borrowed_range<elements_view<_Tp, _Np>> = enable_borrowed_range<_Tp>; | |
| 390 | ||
| 391 | template <class _Tp> | |
| 392 | using keys_view = elements_view<_Tp, 0>; | |
| 393 | template <class _Tp> | |
| 394 | using values_view = elements_view<_Tp, 1>; | |
| 395 | ||
| 396 | namespace views { | |
| 397 | namespace __elements { | |
| 398 | ||
| 399 | template <size_t _Np> | |
| 400 | struct __fn : __range_adaptor_closure<__fn<_Np>> { | |
| 401 | template <class _Range> | |
| 402 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const | |
| 403 | /**/ noexcept(noexcept(elements_view<all_t<_Range&&>, _Np>(std::forward<_Range>(__range)))) | |
| 404 | /*------*/ -> decltype(elements_view<all_t<_Range&&>, _Np>(std::forward<_Range>(__range))) { | |
| 405 | /*-------------*/ return elements_view<all_t<_Range&&>, _Np>(std::forward<_Range>(__range)); | |
| 406 | } | |
| 407 | }; | |
| 408 | } // namespace __elements | |
| 409 | ||
| 410 | inline namespace __cpo { | |
| 411 | template <size_t _Np> | |
| 412 | inline constexpr auto elements = __elements::__fn<_Np>{}; | |
| 413 | inline constexpr auto keys = elements<0>; | |
| 414 | inline constexpr auto values = elements<1>; | |
| 415 | } // namespace __cpo | |
| 416 | } // namespace views | |
| 417 | } // namespace ranges | |
| 418 | ||
| 419 | #endif // _LIBCPP_STD_VER >= 20 | |
| 420 | ||
| 421 | _LIBCPP_END_NAMESPACE_STD | |
| 422 | ||
| 423 | #endif // _LIBCPP___RANGES_ELEMENTS_VIEW_H |
lib/libcxx/include/__ranges/empty.h+3-3| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_EMPTY_H |
| 10 | 11 | #define _LIBCPP___RANGES_EMPTY_H |
| 11 | 12 | |
| ... | ... | @@ -14,7 +15,6 @@ |
| 14 | 15 | #include <__iterator/concepts.h> |
| 15 | 16 | #include <__ranges/access.h> |
| 16 | 17 | #include <__ranges/size.h> |
| 17 | #include <type_traits> | |
| 18 | 18 | |
| 19 | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | 20 | # pragma GCC system_header |
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | |
| 23 | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 24 | |
| 25 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 25 | #if _LIBCPP_STD_VER > 17 | |
| 26 | 26 | |
| 27 | 27 | // [range.prim.empty] |
| 28 | 28 | |
| ... | ... | @@ -75,7 +75,7 @@ inline namespace __cpo { |
| 75 | 75 | } // namespace __cpo |
| 76 | 76 | } // namespace ranges |
| 77 | 77 | |
| 78 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 78 | #endif // _LIBCPP_STD_VER > 17 | |
| 79 | 79 | |
| 80 | 80 | _LIBCPP_END_NAMESPACE_STD |
| 81 | 81 |
lib/libcxx/include/__ranges/empty_view.h+3-2| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_EMPTY_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_EMPTY_VIEW_H |
| 11 | 12 | |
| ... | ... | @@ -20,7 +21,7 @@ |
| 20 | 21 | |
| 21 | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 23 | |
| 23 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 24 | #if _LIBCPP_STD_VER > 17 | |
| 24 | 25 | |
| 25 | 26 | namespace ranges { |
| 26 | 27 | template<class _Tp> |
| ... | ... | @@ -45,7 +46,7 @@ namespace ranges { |
| 45 | 46 | } // namespace views |
| 46 | 47 | } // namespace ranges |
| 47 | 48 | |
| 48 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 49 | #endif // _LIBCPP_STD_VER > 17 | |
| 49 | 50 | |
| 50 | 51 | _LIBCPP_END_NAMESPACE_STD |
| 51 | 52 |
lib/libcxx/include/__ranges/enable_view.h+5-2| ... | ... | @@ -10,9 +10,12 @@ |
| 10 | 10 | #ifndef _LIBCPP___RANGES_ENABLE_VIEW_H |
| 11 | 11 | #define _LIBCPP___RANGES_ENABLE_VIEW_H |
| 12 | 12 | |
| 13 | #include <__concepts/derived_from.h> | |
| 14 | #include <__concepts/same_as.h> | |
| 13 | 15 | #include <__config> |
| 14 | #include <concepts> | |
| 15 | #include <type_traits> | |
| 16 | #include <__type_traits/is_class.h> | |
| 17 | #include <__type_traits/is_convertible.h> | |
| 18 | #include <__type_traits/remove_cv.h> | |
| 16 | 19 | |
| 17 | 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 21 | # pragma GCC system_header |
lib/libcxx/include/__ranges/filter_view.h+42-21| ... | ... | @@ -6,10 +6,15 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_FILTER_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_FILTER_VIEW_H |
| 11 | 12 | |
| 12 | 13 | #include <__algorithm/ranges_find_if.h> |
| 14 | #include <__concepts/constructible.h> | |
| 15 | #include <__concepts/copyable.h> | |
| 16 | #include <__concepts/derived_from.h> | |
| 17 | #include <__concepts/equality_comparable.h> | |
| 13 | 18 | #include <__config> |
| 14 | 19 | #include <__debug> |
| 15 | 20 | #include <__functional/bind_back.h> |
| ... | ... | @@ -30,7 +35,6 @@ |
| 30 | 35 | #include <__utility/forward.h> |
| 31 | 36 | #include <__utility/in_place.h> |
| 32 | 37 | #include <__utility/move.h> |
| 33 | #include <concepts> | |
| 34 | 38 | #include <type_traits> |
| 35 | 39 | |
| 36 | 40 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -39,9 +43,18 @@ |
| 39 | 43 | |
| 40 | 44 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 41 | 45 | |
| 42 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 46 | #if _LIBCPP_STD_VER > 17 | |
| 43 | 47 | |
| 44 | 48 | namespace ranges { |
| 49 | ||
| 50 | template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> | |
| 51 | requires view<_View> && is_object_v<_Pred> | |
| 52 | class __filter_view_iterator; | |
| 53 | ||
| 54 | template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> | |
| 55 | requires view<_View> && is_object_v<_Pred> | |
| 56 | class __filter_view_sentinel; | |
| 57 | ||
| 45 | 58 | template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> |
| 46 | 59 | requires view<_View> && is_object_v<_Pred> |
| 47 | 60 | class filter_view : public view_interface<filter_view<_View, _Pred>> { |
| ... | ... | @@ -54,8 +67,11 @@ namespace ranges { |
| 54 | 67 | using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>; |
| 55 | 68 | _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache(); |
| 56 | 69 | |
| 57 | class __iterator; | |
| 58 | class __sentinel; | |
| 70 | using __iterator = __filter_view_iterator<_View, _Pred>; | |
| 71 | using __sentinel = __filter_view_sentinel<_View, _Pred>; | |
| 72 | ||
| 73 | friend __iterator; | |
| 74 | friend __sentinel; | |
| 59 | 75 | |
| 60 | 76 | public: |
| 61 | 77 | _LIBCPP_HIDE_FROM_ABI |
| ... | ... | @@ -115,10 +131,13 @@ namespace ranges { |
| 115 | 131 | |
| 116 | 132 | template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> |
| 117 | 133 | requires view<_View> && is_object_v<_Pred> |
| 118 | class filter_view<_View, _Pred>::__iterator : public __filter_iterator_category<_View> { | |
| 134 | class __filter_view_iterator : public __filter_iterator_category<_View> { | |
| 135 | ||
| 136 | using __filter_view = filter_view<_View, _Pred>; | |
| 137 | ||
| 119 | 138 | public: |
| 120 | 139 | _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __current_ = iterator_t<_View>(); |
| 121 | _LIBCPP_NO_UNIQUE_ADDRESS filter_view* __parent_ = nullptr; | |
| 140 | _LIBCPP_NO_UNIQUE_ADDRESS __filter_view* __parent_ = nullptr; | |
| 122 | 141 | |
| 123 | 142 | using iterator_concept = |
| 124 | 143 | _If<bidirectional_range<_View>, bidirectional_iterator_tag, |
| ... | ... | @@ -130,10 +149,10 @@ namespace ranges { |
| 130 | 149 | using difference_type = range_difference_t<_View>; |
| 131 | 150 | |
| 132 | 151 | _LIBCPP_HIDE_FROM_ABI |
| 133 | __iterator() requires default_initializable<iterator_t<_View>> = default; | |
| 152 | __filter_view_iterator() requires default_initializable<iterator_t<_View>> = default; | |
| 134 | 153 | |
| 135 | 154 | _LIBCPP_HIDE_FROM_ABI |
| 136 | constexpr __iterator(filter_view& __parent, iterator_t<_View> __current) | |
| 155 | constexpr __filter_view_iterator(__filter_view& __parent, iterator_t<_View> __current) | |
| 137 | 156 | : __current_(std::move(__current)), __parent_(std::addressof(__parent)) |
| 138 | 157 | { } |
| 139 | 158 | |
| ... | ... | @@ -152,7 +171,7 @@ namespace ranges { |
| 152 | 171 | } |
| 153 | 172 | |
| 154 | 173 | _LIBCPP_HIDE_FROM_ABI |
| 155 | constexpr __iterator& operator++() { | |
| 174 | constexpr __filter_view_iterator& operator++() { | |
| 156 | 175 | __current_ = ranges::find_if(std::move(++__current_), ranges::end(__parent_->__base_), |
| 157 | 176 | std::ref(*__parent_->__pred_)); |
| 158 | 177 | return *this; |
| ... | ... | @@ -160,42 +179,42 @@ namespace ranges { |
| 160 | 179 | _LIBCPP_HIDE_FROM_ABI |
| 161 | 180 | constexpr void operator++(int) { ++*this; } |
| 162 | 181 | _LIBCPP_HIDE_FROM_ABI |
| 163 | constexpr __iterator operator++(int) requires forward_range<_View> { | |
| 182 | constexpr __filter_view_iterator operator++(int) requires forward_range<_View> { | |
| 164 | 183 | auto __tmp = *this; |
| 165 | 184 | ++*this; |
| 166 | 185 | return __tmp; |
| 167 | 186 | } |
| 168 | 187 | |
| 169 | 188 | _LIBCPP_HIDE_FROM_ABI |
| 170 | constexpr __iterator& operator--() requires bidirectional_range<_View> { | |
| 189 | constexpr __filter_view_iterator& operator--() requires bidirectional_range<_View> { | |
| 171 | 190 | do { |
| 172 | 191 | --__current_; |
| 173 | 192 | } while (!std::invoke(*__parent_->__pred_, *__current_)); |
| 174 | 193 | return *this; |
| 175 | 194 | } |
| 176 | 195 | _LIBCPP_HIDE_FROM_ABI |
| 177 | constexpr __iterator operator--(int) requires bidirectional_range<_View> { | |
| 196 | constexpr __filter_view_iterator operator--(int) requires bidirectional_range<_View> { | |
| 178 | 197 | auto tmp = *this; |
| 179 | 198 | --*this; |
| 180 | 199 | return tmp; |
| 181 | 200 | } |
| 182 | 201 | |
| 183 | 202 | _LIBCPP_HIDE_FROM_ABI |
| 184 | friend constexpr bool operator==(__iterator const& __x, __iterator const& __y) | |
| 203 | friend constexpr bool operator==(__filter_view_iterator const& __x, __filter_view_iterator const& __y) | |
| 185 | 204 | requires equality_comparable<iterator_t<_View>> |
| 186 | 205 | { |
| 187 | 206 | return __x.__current_ == __y.__current_; |
| 188 | 207 | } |
| 189 | 208 | |
| 190 | 209 | _LIBCPP_HIDE_FROM_ABI |
| 191 | friend constexpr range_rvalue_reference_t<_View> iter_move(__iterator const& __it) | |
| 210 | friend constexpr range_rvalue_reference_t<_View> iter_move(__filter_view_iterator const& __it) | |
| 192 | 211 | noexcept(noexcept(ranges::iter_move(__it.__current_))) |
| 193 | 212 | { |
| 194 | 213 | return ranges::iter_move(__it.__current_); |
| 195 | 214 | } |
| 196 | 215 | |
| 197 | 216 | _LIBCPP_HIDE_FROM_ABI |
| 198 | friend constexpr void iter_swap(__iterator const& __x, __iterator const& __y) | |
| 217 | friend constexpr void iter_swap(__filter_view_iterator const& __x, __filter_view_iterator const& __y) | |
| 199 | 218 | noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) |
| 200 | 219 | requires indirectly_swappable<iterator_t<_View>> |
| 201 | 220 | { |
| ... | ... | @@ -205,23 +224,25 @@ namespace ranges { |
| 205 | 224 | |
| 206 | 225 | template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> |
| 207 | 226 | requires view<_View> && is_object_v<_Pred> |
| 208 | class filter_view<_View, _Pred>::__sentinel { | |
| 227 | class __filter_view_sentinel { | |
| 228 | using __filter_view = filter_view<_View, _Pred>; | |
| 229 | ||
| 209 | 230 | public: |
| 210 | 231 | sentinel_t<_View> __end_ = sentinel_t<_View>(); |
| 211 | 232 | |
| 212 | 233 | _LIBCPP_HIDE_FROM_ABI |
| 213 | __sentinel() = default; | |
| 234 | __filter_view_sentinel() = default; | |
| 214 | 235 | |
| 215 | 236 | _LIBCPP_HIDE_FROM_ABI |
| 216 | constexpr explicit __sentinel(filter_view& __parent) | |
| 237 | constexpr explicit __filter_view_sentinel(__filter_view& __parent) | |
| 217 | 238 | : __end_(ranges::end(__parent.__base_)) |
| 218 | 239 | { } |
| 219 | 240 | |
| 220 | 241 | _LIBCPP_HIDE_FROM_ABI |
| 221 | 242 | constexpr sentinel_t<_View> base() const { return __end_; } |
| 222 | 243 | |
| 223 | _LIBCPP_HIDE_FROM_ABI | |
| 224 | friend constexpr bool operator==(__iterator const& __x, __sentinel const& __y) { | |
| 244 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | |
| 245 | operator==(__filter_view_iterator<_View, _Pred> const& __x, __filter_view_sentinel const& __y) { | |
| 225 | 246 | return __x.__current_ == __y.__end_; |
| 226 | 247 | } |
| 227 | 248 | }; |
| ... | ... | @@ -252,7 +273,7 @@ inline namespace __cpo { |
| 252 | 273 | |
| 253 | 274 | } // namespace ranges |
| 254 | 275 | |
| 255 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 276 | #endif // _LIBCPP_STD_VER > 17 | |
| 256 | 277 | |
| 257 | 278 | _LIBCPP_END_NAMESPACE_STD |
| 258 | 279 |
lib/libcxx/include/__ranges/iota_view.h+231-205| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_IOTA_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_IOTA_VIEW_H |
| 11 | 12 | |
| ... | ... | @@ -39,7 +40,7 @@ |
| 39 | 40 | |
| 40 | 41 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 41 | 42 | |
| 42 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 43 | #if _LIBCPP_STD_VER > 17 | |
| 43 | 44 | |
| 44 | 45 | namespace ranges { |
| 45 | 46 | template<class _Int> |
| ... | ... | @@ -82,6 +83,14 @@ namespace ranges { |
| 82 | 83 | { __j - __j } -> convertible_to<_IotaDiffT<_Iter>>; |
| 83 | 84 | }; |
| 84 | 85 | |
| 86 | template <weakly_incrementable _Start> | |
| 87 | requires copyable<_Start> | |
| 88 | struct __iota_view_iterator; | |
| 89 | ||
| 90 | template <weakly_incrementable _Start, semiregular _BoundSentinel> | |
| 91 | requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start> | |
| 92 | struct __iota_view_sentinel; | |
| 93 | ||
| 85 | 94 | template<class> |
| 86 | 95 | struct __iota_iterator_category {}; |
| 87 | 96 | |
| ... | ... | @@ -93,210 +102,9 @@ namespace ranges { |
| 93 | 102 | template <weakly_incrementable _Start, semiregular _BoundSentinel = unreachable_sentinel_t> |
| 94 | 103 | requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start> |
| 95 | 104 | class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> { |
| 96 | struct __iterator : public __iota_iterator_category<_Start> { | |
| 97 | friend class iota_view; | |
| 98 | ||
| 99 | using iterator_concept = | |
| 100 | _If<__advanceable<_Start>, random_access_iterator_tag, | |
| 101 | _If<__decrementable<_Start>, bidirectional_iterator_tag, | |
| 102 | _If<incrementable<_Start>, forward_iterator_tag, | |
| 103 | /*Else*/ input_iterator_tag>>>; | |
| 104 | ||
| 105 | using value_type = _Start; | |
| 106 | using difference_type = _IotaDiffT<_Start>; | |
| 107 | ||
| 108 | _Start __value_ = _Start(); | |
| 109 | ||
| 110 | _LIBCPP_HIDE_FROM_ABI | |
| 111 | __iterator() requires default_initializable<_Start> = default; | |
| 112 | ||
| 113 | _LIBCPP_HIDE_FROM_ABI | |
| 114 | constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {} | |
| 115 | ||
| 116 | _LIBCPP_HIDE_FROM_ABI | |
| 117 | constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) { | |
| 118 | return __value_; | |
| 119 | } | |
| 120 | ||
| 121 | _LIBCPP_HIDE_FROM_ABI | |
| 122 | constexpr __iterator& operator++() { | |
| 123 | ++__value_; | |
| 124 | return *this; | |
| 125 | } | |
| 126 | ||
| 127 | _LIBCPP_HIDE_FROM_ABI | |
| 128 | constexpr void operator++(int) { ++*this; } | |
| 129 | ||
| 130 | _LIBCPP_HIDE_FROM_ABI | |
| 131 | constexpr __iterator operator++(int) requires incrementable<_Start> { | |
| 132 | auto __tmp = *this; | |
| 133 | ++*this; | |
| 134 | return __tmp; | |
| 135 | } | |
| 136 | ||
| 137 | _LIBCPP_HIDE_FROM_ABI | |
| 138 | constexpr __iterator& operator--() requires __decrementable<_Start> { | |
| 139 | --__value_; | |
| 140 | return *this; | |
| 141 | } | |
| 142 | ||
| 143 | _LIBCPP_HIDE_FROM_ABI | |
| 144 | constexpr __iterator operator--(int) requires __decrementable<_Start> { | |
| 145 | auto __tmp = *this; | |
| 146 | --*this; | |
| 147 | return __tmp; | |
| 148 | } | |
| 149 | ||
| 150 | _LIBCPP_HIDE_FROM_ABI | |
| 151 | constexpr __iterator& operator+=(difference_type __n) | |
| 152 | requires __advanceable<_Start> | |
| 153 | { | |
| 154 | if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { | |
| 155 | if (__n >= difference_type(0)) { | |
| 156 | __value_ += static_cast<_Start>(__n); | |
| 157 | } else { | |
| 158 | __value_ -= static_cast<_Start>(-__n); | |
| 159 | } | |
| 160 | } else { | |
| 161 | __value_ += __n; | |
| 162 | } | |
| 163 | return *this; | |
| 164 | } | |
| 165 | ||
| 166 | _LIBCPP_HIDE_FROM_ABI | |
| 167 | constexpr __iterator& operator-=(difference_type __n) | |
| 168 | requires __advanceable<_Start> | |
| 169 | { | |
| 170 | if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { | |
| 171 | if (__n >= difference_type(0)) { | |
| 172 | __value_ -= static_cast<_Start>(__n); | |
| 173 | } else { | |
| 174 | __value_ += static_cast<_Start>(-__n); | |
| 175 | } | |
| 176 | } else { | |
| 177 | __value_ -= __n; | |
| 178 | } | |
| 179 | return *this; | |
| 180 | } | |
| 181 | ||
| 182 | _LIBCPP_HIDE_FROM_ABI | |
| 183 | constexpr _Start operator[](difference_type __n) const | |
| 184 | requires __advanceable<_Start> | |
| 185 | { | |
| 186 | return _Start(__value_ + __n); | |
| 187 | } | |
| 188 | ||
| 189 | _LIBCPP_HIDE_FROM_ABI | |
| 190 | friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) | |
| 191 | requires equality_comparable<_Start> | |
| 192 | { | |
| 193 | return __x.__value_ == __y.__value_; | |
| 194 | } | |
| 195 | ||
| 196 | _LIBCPP_HIDE_FROM_ABI | |
| 197 | friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) | |
| 198 | requires totally_ordered<_Start> | |
| 199 | { | |
| 200 | return __x.__value_ < __y.__value_; | |
| 201 | } | |
| 202 | ||
| 203 | _LIBCPP_HIDE_FROM_ABI | |
| 204 | friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) | |
| 205 | requires totally_ordered<_Start> | |
| 206 | { | |
| 207 | return __y < __x; | |
| 208 | } | |
| 209 | ||
| 210 | _LIBCPP_HIDE_FROM_ABI | |
| 211 | friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) | |
| 212 | requires totally_ordered<_Start> | |
| 213 | { | |
| 214 | return !(__y < __x); | |
| 215 | } | |
| 216 | ||
| 217 | _LIBCPP_HIDE_FROM_ABI | |
| 218 | friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) | |
| 219 | requires totally_ordered<_Start> | |
| 220 | { | |
| 221 | return !(__x < __y); | |
| 222 | } | |
| 223 | ||
| 224 | friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) | |
| 225 | requires totally_ordered<_Start> && three_way_comparable<_Start> | |
| 226 | { | |
| 227 | return __x.__value_ <=> __y.__value_; | |
| 228 | } | |
| 229 | 105 | |
| 230 | _LIBCPP_HIDE_FROM_ABI | |
| 231 | friend constexpr __iterator operator+(__iterator __i, difference_type __n) | |
| 232 | requires __advanceable<_Start> | |
| 233 | { | |
| 234 | __i += __n; | |
| 235 | return __i; | |
| 236 | } | |
| 237 | ||
| 238 | _LIBCPP_HIDE_FROM_ABI | |
| 239 | friend constexpr __iterator operator+(difference_type __n, __iterator __i) | |
| 240 | requires __advanceable<_Start> | |
| 241 | { | |
| 242 | return __i + __n; | |
| 243 | } | |
| 244 | ||
| 245 | _LIBCPP_HIDE_FROM_ABI | |
| 246 | friend constexpr __iterator operator-(__iterator __i, difference_type __n) | |
| 247 | requires __advanceable<_Start> | |
| 248 | { | |
| 249 | __i -= __n; | |
| 250 | return __i; | |
| 251 | } | |
| 252 | ||
| 253 | _LIBCPP_HIDE_FROM_ABI | |
| 254 | friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) | |
| 255 | requires __advanceable<_Start> | |
| 256 | { | |
| 257 | if constexpr (__integer_like<_Start>) { | |
| 258 | if constexpr (__signed_integer_like<_Start>) { | |
| 259 | return difference_type(difference_type(__x.__value_) - difference_type(__y.__value_)); | |
| 260 | } | |
| 261 | if (__y.__value_ > __x.__value_) { | |
| 262 | return difference_type(-difference_type(__y.__value_ - __x.__value_)); | |
| 263 | } | |
| 264 | return difference_type(__x.__value_ - __y.__value_); | |
| 265 | } | |
| 266 | return __x.__value_ - __y.__value_; | |
| 267 | } | |
| 268 | }; | |
| 269 | ||
| 270 | struct __sentinel { | |
| 271 | friend class iota_view; | |
| 272 | ||
| 273 | private: | |
| 274 | _BoundSentinel __bound_sentinel_ = _BoundSentinel(); | |
| 275 | ||
| 276 | public: | |
| 277 | _LIBCPP_HIDE_FROM_ABI | |
| 278 | __sentinel() = default; | |
| 279 | constexpr explicit __sentinel(_BoundSentinel __bound_sentinel) : __bound_sentinel_(std::move(__bound_sentinel)) {} | |
| 280 | ||
| 281 | _LIBCPP_HIDE_FROM_ABI | |
| 282 | friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) { | |
| 283 | return __x.__value_ == __y.__bound_sentinel_; | |
| 284 | } | |
| 285 | ||
| 286 | _LIBCPP_HIDE_FROM_ABI | |
| 287 | friend constexpr iter_difference_t<_Start> operator-(const __iterator& __x, const __sentinel& __y) | |
| 288 | requires sized_sentinel_for<_BoundSentinel, _Start> | |
| 289 | { | |
| 290 | return __x.__value_ - __y.__bound_sentinel_; | |
| 291 | } | |
| 292 | ||
| 293 | _LIBCPP_HIDE_FROM_ABI | |
| 294 | friend constexpr iter_difference_t<_Start> operator-(const __sentinel& __x, const __iterator& __y) | |
| 295 | requires sized_sentinel_for<_BoundSentinel, _Start> | |
| 296 | { | |
| 297 | return -(__y - __x); | |
| 298 | } | |
| 299 | }; | |
| 106 | using __iterator = __iota_view_iterator<_Start>; | |
| 107 | using __sentinel = __iota_view_sentinel<_Start, _BoundSentinel>; | |
| 300 | 108 | |
| 301 | 109 | _Start __value_ = _Start(); |
| 302 | 110 | _BoundSentinel __bound_sentinel_ = _BoundSentinel(); |
| ... | ... | @@ -377,6 +185,224 @@ namespace ranges { |
| 377 | 185 | template <class _Start, class _BoundSentinel> |
| 378 | 186 | inline constexpr bool enable_borrowed_range<iota_view<_Start, _BoundSentinel>> = true; |
| 379 | 187 | |
| 188 | template <weakly_incrementable _Start> | |
| 189 | requires copyable<_Start> | |
| 190 | struct __iota_view_iterator : public __iota_iterator_category<_Start> { | |
| 191 | ||
| 192 | template <weakly_incrementable _StartT, semiregular _BoundSentinelT> | |
| 193 | requires __weakly_equality_comparable_with<_StartT, _BoundSentinelT> && copyable<_StartT> | |
| 194 | friend class iota_view; | |
| 195 | ||
| 196 | using iterator_concept = | |
| 197 | _If<__advanceable<_Start>, random_access_iterator_tag, | |
| 198 | _If<__decrementable<_Start>, bidirectional_iterator_tag, | |
| 199 | _If<incrementable<_Start>, forward_iterator_tag, | |
| 200 | /*Else*/ input_iterator_tag>>>; | |
| 201 | ||
| 202 | using value_type = _Start; | |
| 203 | using difference_type = _IotaDiffT<_Start>; | |
| 204 | ||
| 205 | _Start __value_ = _Start(); | |
| 206 | ||
| 207 | _LIBCPP_HIDE_FROM_ABI | |
| 208 | __iota_view_iterator() requires default_initializable<_Start> = default; | |
| 209 | ||
| 210 | _LIBCPP_HIDE_FROM_ABI | |
| 211 | constexpr explicit __iota_view_iterator(_Start __value) : __value_(std::move(__value)) {} | |
| 212 | ||
| 213 | _LIBCPP_HIDE_FROM_ABI | |
| 214 | constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) { | |
| 215 | return __value_; | |
| 216 | } | |
| 217 | ||
| 218 | _LIBCPP_HIDE_FROM_ABI | |
| 219 | constexpr __iota_view_iterator& operator++() { | |
| 220 | ++__value_; | |
| 221 | return *this; | |
| 222 | } | |
| 223 | ||
| 224 | _LIBCPP_HIDE_FROM_ABI | |
| 225 | constexpr void operator++(int) { ++*this; } | |
| 226 | ||
| 227 | _LIBCPP_HIDE_FROM_ABI | |
| 228 | constexpr __iota_view_iterator operator++(int) requires incrementable<_Start> { | |
| 229 | auto __tmp = *this; | |
| 230 | ++*this; | |
| 231 | return __tmp; | |
| 232 | } | |
| 233 | ||
| 234 | _LIBCPP_HIDE_FROM_ABI | |
| 235 | constexpr __iota_view_iterator& operator--() requires __decrementable<_Start> { | |
| 236 | --__value_; | |
| 237 | return *this; | |
| 238 | } | |
| 239 | ||
| 240 | _LIBCPP_HIDE_FROM_ABI | |
| 241 | constexpr __iota_view_iterator operator--(int) requires __decrementable<_Start> { | |
| 242 | auto __tmp = *this; | |
| 243 | --*this; | |
| 244 | return __tmp; | |
| 245 | } | |
| 246 | ||
| 247 | _LIBCPP_HIDE_FROM_ABI | |
| 248 | constexpr __iota_view_iterator& operator+=(difference_type __n) | |
| 249 | requires __advanceable<_Start> | |
| 250 | { | |
| 251 | if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { | |
| 252 | if (__n >= difference_type(0)) { | |
| 253 | __value_ += static_cast<_Start>(__n); | |
| 254 | } else { | |
| 255 | __value_ -= static_cast<_Start>(-__n); | |
| 256 | } | |
| 257 | } else { | |
| 258 | __value_ += __n; | |
| 259 | } | |
| 260 | return *this; | |
| 261 | } | |
| 262 | ||
| 263 | _LIBCPP_HIDE_FROM_ABI | |
| 264 | constexpr __iota_view_iterator& operator-=(difference_type __n) | |
| 265 | requires __advanceable<_Start> | |
| 266 | { | |
| 267 | if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { | |
| 268 | if (__n >= difference_type(0)) { | |
| 269 | __value_ -= static_cast<_Start>(__n); | |
| 270 | } else { | |
| 271 | __value_ += static_cast<_Start>(-__n); | |
| 272 | } | |
| 273 | } else { | |
| 274 | __value_ -= __n; | |
| 275 | } | |
| 276 | return *this; | |
| 277 | } | |
| 278 | ||
| 279 | _LIBCPP_HIDE_FROM_ABI | |
| 280 | constexpr _Start operator[](difference_type __n) const | |
| 281 | requires __advanceable<_Start> | |
| 282 | { | |
| 283 | return _Start(__value_ + __n); | |
| 284 | } | |
| 285 | ||
| 286 | _LIBCPP_HIDE_FROM_ABI | |
| 287 | friend constexpr bool operator==(const __iota_view_iterator& __x, const __iota_view_iterator& __y) | |
| 288 | requires equality_comparable<_Start> | |
| 289 | { | |
| 290 | return __x.__value_ == __y.__value_; | |
| 291 | } | |
| 292 | ||
| 293 | _LIBCPP_HIDE_FROM_ABI | |
| 294 | friend constexpr bool operator<(const __iota_view_iterator& __x, const __iota_view_iterator& __y) | |
| 295 | requires totally_ordered<_Start> | |
| 296 | { | |
| 297 | return __x.__value_ < __y.__value_; | |
| 298 | } | |
| 299 | ||
| 300 | _LIBCPP_HIDE_FROM_ABI | |
| 301 | friend constexpr bool operator>(const __iota_view_iterator& __x, const __iota_view_iterator& __y) | |
| 302 | requires totally_ordered<_Start> | |
| 303 | { | |
| 304 | return __y < __x; | |
| 305 | } | |
| 306 | ||
| 307 | _LIBCPP_HIDE_FROM_ABI | |
| 308 | friend constexpr bool operator<=(const __iota_view_iterator& __x, const __iota_view_iterator& __y) | |
| 309 | requires totally_ordered<_Start> | |
| 310 | { | |
| 311 | return !(__y < __x); | |
| 312 | } | |
| 313 | ||
| 314 | _LIBCPP_HIDE_FROM_ABI | |
| 315 | friend constexpr bool operator>=(const __iota_view_iterator& __x, const __iota_view_iterator& __y) | |
| 316 | requires totally_ordered<_Start> | |
| 317 | { | |
| 318 | return !(__x < __y); | |
| 319 | } | |
| 320 | ||
| 321 | _LIBCPP_HIDE_FROM_ABI | |
| 322 | friend constexpr auto operator<=>(const __iota_view_iterator& __x, const __iota_view_iterator& __y) | |
| 323 | requires totally_ordered<_Start> && three_way_comparable<_Start> | |
| 324 | { | |
| 325 | return __x.__value_ <=> __y.__value_; | |
| 326 | } | |
| 327 | ||
| 328 | _LIBCPP_HIDE_FROM_ABI | |
| 329 | friend constexpr __iota_view_iterator operator+(__iota_view_iterator __i, difference_type __n) | |
| 330 | requires __advanceable<_Start> | |
| 331 | { | |
| 332 | __i += __n; | |
| 333 | return __i; | |
| 334 | } | |
| 335 | ||
| 336 | _LIBCPP_HIDE_FROM_ABI | |
| 337 | friend constexpr __iota_view_iterator operator+(difference_type __n, __iota_view_iterator __i) | |
| 338 | requires __advanceable<_Start> | |
| 339 | { | |
| 340 | return __i + __n; | |
| 341 | } | |
| 342 | ||
| 343 | _LIBCPP_HIDE_FROM_ABI | |
| 344 | friend constexpr __iota_view_iterator operator-(__iota_view_iterator __i, difference_type __n) | |
| 345 | requires __advanceable<_Start> | |
| 346 | { | |
| 347 | __i -= __n; | |
| 348 | return __i; | |
| 349 | } | |
| 350 | ||
| 351 | _LIBCPP_HIDE_FROM_ABI | |
| 352 | friend constexpr difference_type operator-(const __iota_view_iterator& __x, const __iota_view_iterator& __y) | |
| 353 | requires __advanceable<_Start> | |
| 354 | { | |
| 355 | if constexpr (__integer_like<_Start>) { | |
| 356 | if constexpr (__signed_integer_like<_Start>) { | |
| 357 | return difference_type(difference_type(__x.__value_) - difference_type(__y.__value_)); | |
| 358 | } | |
| 359 | if (__y.__value_ > __x.__value_) { | |
| 360 | return difference_type(-difference_type(__y.__value_ - __x.__value_)); | |
| 361 | } | |
| 362 | return difference_type(__x.__value_ - __y.__value_); | |
| 363 | } | |
| 364 | return __x.__value_ - __y.__value_; | |
| 365 | } | |
| 366 | }; | |
| 367 | ||
| 368 | template <weakly_incrementable _Start, semiregular _BoundSentinel> | |
| 369 | requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start> | |
| 370 | struct __iota_view_sentinel { | |
| 371 | ||
| 372 | template <weakly_incrementable _StartT, semiregular _BoundSentinelT> | |
| 373 | requires __weakly_equality_comparable_with<_StartT, _BoundSentinelT> && copyable<_StartT> | |
| 374 | friend class iota_view; | |
| 375 | ||
| 376 | using __iterator = __iota_view_iterator<_Start>; | |
| 377 | ||
| 378 | private: | |
| 379 | _BoundSentinel __bound_sentinel_ = _BoundSentinel(); | |
| 380 | ||
| 381 | public: | |
| 382 | _LIBCPP_HIDE_FROM_ABI | |
| 383 | __iota_view_sentinel() = default; | |
| 384 | constexpr explicit __iota_view_sentinel(_BoundSentinel __bound_sentinel) : __bound_sentinel_(std::move(__bound_sentinel)) {} | |
| 385 | ||
| 386 | _LIBCPP_HIDE_FROM_ABI | |
| 387 | friend constexpr bool operator==(const __iterator& __x, const __iota_view_sentinel& __y) { | |
| 388 | return __x.__value_ == __y.__bound_sentinel_; | |
| 389 | } | |
| 390 | ||
| 391 | _LIBCPP_HIDE_FROM_ABI | |
| 392 | friend constexpr iter_difference_t<_Start> operator-(const __iterator& __x, const __iota_view_sentinel& __y) | |
| 393 | requires sized_sentinel_for<_BoundSentinel, _Start> | |
| 394 | { | |
| 395 | return __x.__value_ - __y.__bound_sentinel_; | |
| 396 | } | |
| 397 | ||
| 398 | _LIBCPP_HIDE_FROM_ABI | |
| 399 | friend constexpr iter_difference_t<_Start> operator-(const __iota_view_sentinel& __x, const __iterator& __y) | |
| 400 | requires sized_sentinel_for<_BoundSentinel, _Start> | |
| 401 | { | |
| 402 | return -(__y - __x); | |
| 403 | } | |
| 404 | }; | |
| 405 | ||
| 380 | 406 | namespace views { |
| 381 | 407 | namespace __iota { |
| 382 | 408 | struct __fn { |
| ... | ... | @@ -401,7 +427,7 @@ inline namespace __cpo { |
| 401 | 427 | } // namespace views |
| 402 | 428 | } // namespace ranges |
| 403 | 429 | |
| 404 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 430 | #endif // _LIBCPP_STD_VER > 17 | |
| 405 | 431 | |
| 406 | 432 | _LIBCPP_END_NAMESPACE_STD |
| 407 | 433 |
lib/libcxx/include/__ranges/istream_view.h created+149| ... | ... | @@ -0,0 +1,149 @@ |
| 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_ISTREAM_VIEW_H | |
| 11 | #define _LIBCPP___RANGES_ISTREAM_VIEW_H | |
| 12 | ||
| 13 | #include <__concepts/constructible.h> | |
| 14 | #include <__concepts/derived_from.h> | |
| 15 | #include <__concepts/movable.h> | |
| 16 | #include <__config> | |
| 17 | #include <__iterator/default_sentinel.h> | |
| 18 | #include <__iterator/iterator_traits.h> | |
| 19 | #include <__memory/addressof.h> | |
| 20 | #include <__ranges/view_interface.h> | |
| 21 | #include <__type_traits/remove_cvref.h> | |
| 22 | #include <__utility/forward.h> | |
| 23 | #include <cstddef> | |
| 24 | #include <iosfwd> | |
| 25 | ||
| 26 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 27 | # pragma GCC system_header | |
| 28 | #endif | |
| 29 | ||
| 30 | #if _LIBCPP_STD_VER >= 20 | |
| 31 | ||
| 32 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 33 | ||
| 34 | namespace ranges { | |
| 35 | ||
| 36 | template <class _Val, class _CharT, class _Traits> | |
| 37 | concept __stream_extractable = requires(basic_istream<_CharT, _Traits>& __is, _Val& __t) { __is >> __t; }; | |
| 38 | ||
| 39 | template <movable _Val, class _CharT, class _Traits> | |
| 40 | requires default_initializable<_Val> && __stream_extractable<_Val, _CharT, _Traits> | |
| 41 | class __basic_istream_view_iterator; | |
| 42 | ||
| 43 | template <movable _Val, class _CharT, class _Traits = char_traits<_CharT>> | |
| 44 | requires default_initializable<_Val> && __stream_extractable<_Val, _CharT, _Traits> | |
| 45 | class basic_istream_view : public view_interface<basic_istream_view<_Val, _CharT, _Traits>> { | |
| 46 | using __iterator = __basic_istream_view_iterator<_Val, _CharT, _Traits>; | |
| 47 | ||
| 48 | template <movable _ValueType, class _CharType, class _TraitsType> | |
| 49 | requires default_initializable<_ValueType> && __stream_extractable<_ValueType, _CharType, _TraitsType> | |
| 50 | friend class __basic_istream_view_iterator; | |
| 51 | ||
| 52 | public: | |
| 53 | _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_istream_view(basic_istream<_CharT, _Traits>& __stream) | |
| 54 | : __stream_(std::addressof(__stream)) {} | |
| 55 | ||
| 56 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { | |
| 57 | *__stream_ >> __value_; | |
| 58 | return __iterator{*this}; | |
| 59 | } | |
| 60 | ||
| 61 | _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; } | |
| 62 | ||
| 63 | private: | |
| 64 | basic_istream<_CharT, _Traits>* __stream_; | |
| 65 | _LIBCPP_NO_UNIQUE_ADDRESS _Val __value_ = _Val(); | |
| 66 | }; | |
| 67 | ||
| 68 | template <movable _Val, class _CharT, class _Traits> | |
| 69 | requires default_initializable<_Val> && __stream_extractable<_Val, _CharT, _Traits> | |
| 70 | class __basic_istream_view_iterator { | |
| 71 | public: | |
| 72 | using iterator_concept = input_iterator_tag; | |
| 73 | using difference_type = ptrdiff_t; | |
| 74 | using value_type = _Val; | |
| 75 | ||
| 76 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __basic_istream_view_iterator( | |
| 77 | basic_istream_view<_Val, _CharT, _Traits>& __parent) noexcept | |
| 78 | : __parent_(std::addressof(__parent)) {} | |
| 79 | ||
| 80 | __basic_istream_view_iterator(const __basic_istream_view_iterator&) = delete; | |
| 81 | _LIBCPP_HIDE_FROM_ABI __basic_istream_view_iterator(__basic_istream_view_iterator&&) = default; | |
| 82 | ||
| 83 | __basic_istream_view_iterator& operator=(const __basic_istream_view_iterator&) = delete; | |
| 84 | _LIBCPP_HIDE_FROM_ABI __basic_istream_view_iterator& operator=(__basic_istream_view_iterator&&) = default; | |
| 85 | ||
| 86 | _LIBCPP_HIDE_FROM_ABI __basic_istream_view_iterator& operator++() { | |
| 87 | *__parent_->__stream_ >> __parent_->__value_; | |
| 88 | return *this; | |
| 89 | } | |
| 90 | ||
| 91 | _LIBCPP_HIDE_FROM_ABI void operator++(int) { ++*this; } | |
| 92 | ||
| 93 | _LIBCPP_HIDE_FROM_ABI _Val& operator*() const { return __parent_->__value_; } | |
| 94 | ||
| 95 | _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __basic_istream_view_iterator& __x, default_sentinel_t) { | |
| 96 | return !*__x.__get_parent_stream(); | |
| 97 | } | |
| 98 | ||
| 99 | private: | |
| 100 | basic_istream_view<_Val, _CharT, _Traits>* __parent_; | |
| 101 | ||
| 102 | _LIBCPP_HIDE_FROM_ABI constexpr basic_istream<_CharT, _Traits>* __get_parent_stream() const { | |
| 103 | return __parent_->__stream_; | |
| 104 | } | |
| 105 | }; | |
| 106 | ||
| 107 | template <class _Val> | |
| 108 | using istream_view = basic_istream_view<_Val, char>; | |
| 109 | ||
| 110 | # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 111 | template <class _Val> | |
| 112 | using wistream_view = basic_istream_view<_Val, wchar_t>; | |
| 113 | # endif | |
| 114 | ||
| 115 | namespace views { | |
| 116 | namespace __istream { | |
| 117 | ||
| 118 | // clang-format off | |
| 119 | template <class _Tp> | |
| 120 | struct __fn { | |
| 121 | template <class _Up, class _UnCVRef = remove_cvref_t<_Up>> | |
| 122 | requires derived_from<_UnCVRef, basic_istream<typename _UnCVRef::char_type, | |
| 123 | typename _UnCVRef::traits_type>> | |
| 124 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Up&& __u) const | |
| 125 | noexcept(noexcept(basic_istream_view<_Tp, typename _UnCVRef::char_type, | |
| 126 | typename _UnCVRef::traits_type>(std::forward<_Up>(__u)))) | |
| 127 | -> decltype( basic_istream_view<_Tp, typename _UnCVRef::char_type, | |
| 128 | typename _UnCVRef::traits_type>(std::forward<_Up>(__u))) | |
| 129 | { return basic_istream_view<_Tp, typename _UnCVRef::char_type, | |
| 130 | typename _UnCVRef::traits_type>(std::forward<_Up>(__u)); | |
| 131 | } | |
| 132 | }; | |
| 133 | // clang-format on | |
| 134 | ||
| 135 | } // namespace __istream | |
| 136 | ||
| 137 | inline namespace __cpo { | |
| 138 | template <class _Tp> | |
| 139 | inline constexpr auto istream = __istream::__fn<_Tp>{}; | |
| 140 | } // namespace __cpo | |
| 141 | } // namespace views | |
| 142 | ||
| 143 | } // namespace ranges | |
| 144 | ||
| 145 | _LIBCPP_END_NAMESPACE_STD | |
| 146 | ||
| 147 | #endif // _LIBCPP_STD_VER >= 20 | |
| 148 | ||
| 149 | #endif // _LIBCPP___RANGES_ISTREAM_VIEW_H |
lib/libcxx/include/__ranges/join_view.h+110-28| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_JOIN_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_JOIN_VIEW_H |
| 11 | 12 | |
| ... | ... | @@ -19,12 +20,16 @@ |
| 19 | 20 | #include <__iterator/iter_move.h> |
| 20 | 21 | #include <__iterator/iter_swap.h> |
| 21 | 22 | #include <__iterator/iterator_traits.h> |
| 23 | #include <__iterator/iterator_with_data.h> | |
| 24 | #include <__iterator/segmented_iterator.h> | |
| 22 | 25 | #include <__ranges/access.h> |
| 23 | 26 | #include <__ranges/all.h> |
| 24 | 27 | #include <__ranges/concepts.h> |
| 28 | #include <__ranges/empty.h> | |
| 25 | 29 | #include <__ranges/non_propagating_cache.h> |
| 26 | 30 | #include <__ranges/range_adaptor.h> |
| 27 | 31 | #include <__ranges/view_interface.h> |
| 32 | #include <__type_traits/maybe_const.h> | |
| 28 | 33 | #include <__utility/forward.h> |
| 29 | 34 | #include <optional> |
| 30 | 35 | #include <type_traits> |
| ... | ... | @@ -35,7 +40,7 @@ |
| 35 | 40 | |
| 36 | 41 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 37 | 42 | |
| 38 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 43 | #if _LIBCPP_STD_VER > 17 | |
| 39 | 44 | |
| 40 | 45 | namespace ranges { |
| 41 | 46 | template<class> |
| ... | ... | @@ -61,6 +66,14 @@ namespace ranges { |
| 61 | 66 | >; |
| 62 | 67 | }; |
| 63 | 68 | |
| 69 | template <input_range _View, bool _Const> | |
| 70 | requires view<_View> && input_range<range_reference_t<_View>> | |
| 71 | struct __join_view_iterator; | |
| 72 | ||
| 73 | template <input_range _View, bool _Const> | |
| 74 | requires view<_View> && input_range<range_reference_t<_View>> | |
| 75 | struct __join_view_sentinel; | |
| 76 | ||
| 64 | 77 | template<input_range _View> |
| 65 | 78 | requires view<_View> && input_range<range_reference_t<_View>> |
| 66 | 79 | class join_view |
| ... | ... | @@ -68,8 +81,22 @@ namespace ranges { |
| 68 | 81 | private: |
| 69 | 82 | using _InnerRange = range_reference_t<_View>; |
| 70 | 83 | |
| 71 | template<bool> struct __iterator; | |
| 72 | template<bool> struct __sentinel; | |
| 84 | template<bool _Const> | |
| 85 | using __iterator = __join_view_iterator<_View, _Const>; | |
| 86 | ||
| 87 | template<bool _Const> | |
| 88 | using __sentinel = __join_view_sentinel<_View, _Const>; | |
| 89 | ||
| 90 | template <input_range _View2, bool _Const2> | |
| 91 | requires view<_View2> && input_range<range_reference_t<_View2>> | |
| 92 | friend struct __join_view_iterator; | |
| 93 | ||
| 94 | template <input_range _View2, bool _Const2> | |
| 95 | requires view<_View2> && input_range<range_reference_t<_View2>> | |
| 96 | friend struct __join_view_sentinel; | |
| 97 | ||
| 98 | template <class> | |
| 99 | friend struct std::__segmented_iterator_traits; | |
| 73 | 100 | |
| 74 | 101 | static constexpr bool _UseCache = !is_reference_v<_InnerRange>; |
| 75 | 102 | using _Cache = _If<_UseCache, __non_propagating_cache<remove_cvref_t<_InnerRange>>, __empty_cache>; |
| ... | ... | @@ -137,49 +164,57 @@ namespace ranges { |
| 137 | 164 | } |
| 138 | 165 | }; |
| 139 | 166 | |
| 140 | template<input_range _View> | |
| 167 | template<input_range _View, bool _Const> | |
| 141 | 168 | requires view<_View> && input_range<range_reference_t<_View>> |
| 142 | template<bool _Const> struct join_view<_View>::__sentinel { | |
| 143 | template<bool> friend struct __sentinel; | |
| 169 | struct __join_view_sentinel { | |
| 170 | template<input_range _View2, bool> | |
| 171 | requires view<_View2> && input_range<range_reference_t<_View2>> | |
| 172 | friend struct __join_view_sentinel; | |
| 144 | 173 | |
| 145 | 174 | private: |
| 146 | using _Parent = __maybe_const<_Const, join_view>; | |
| 175 | using _Parent = __maybe_const<_Const, join_view<_View>>; | |
| 147 | 176 | using _Base = __maybe_const<_Const, _View>; |
| 148 | 177 | sentinel_t<_Base> __end_ = sentinel_t<_Base>(); |
| 149 | 178 | |
| 150 | 179 | public: |
| 151 | 180 | _LIBCPP_HIDE_FROM_ABI |
| 152 | __sentinel() = default; | |
| 181 | __join_view_sentinel() = default; | |
| 153 | 182 | |
| 154 | 183 | _LIBCPP_HIDE_FROM_ABI |
| 155 | constexpr explicit __sentinel(_Parent& __parent) | |
| 184 | constexpr explicit __join_view_sentinel(_Parent& __parent) | |
| 156 | 185 | : __end_(ranges::end(__parent.__base_)) {} |
| 157 | 186 | |
| 158 | 187 | _LIBCPP_HIDE_FROM_ABI |
| 159 | constexpr __sentinel(__sentinel<!_Const> __s) | |
| 188 | constexpr __join_view_sentinel(__join_view_sentinel<_View, !_Const> __s) | |
| 160 | 189 | requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> |
| 161 | 190 | : __end_(std::move(__s.__end_)) {} |
| 162 | 191 | |
| 163 | 192 | template<bool _OtherConst> |
| 164 | 193 | requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| 165 | 194 | _LIBCPP_HIDE_FROM_ABI |
| 166 | friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | |
| 195 | friend constexpr bool operator==(const __join_view_iterator<_View, _OtherConst>& __x, const __join_view_sentinel& __y) { | |
| 167 | 196 | return __x.__outer_ == __y.__end_; |
| 168 | 197 | } |
| 169 | 198 | }; |
| 170 | 199 | |
| 171 | template<input_range _View> | |
| 200 | template<input_range _View, bool _Const> | |
| 172 | 201 | requires view<_View> && input_range<range_reference_t<_View>> |
| 173 | template<bool _Const> struct join_view<_View>::__iterator | |
| 202 | struct __join_view_iterator | |
| 174 | 203 | : public __join_view_iterator_category<__maybe_const<_Const, _View>> { |
| 175 | 204 | |
| 176 | template<bool> friend struct __iterator; | |
| 205 | template<input_range _View2, bool> | |
| 206 | requires view<_View2> && input_range<range_reference_t<_View2>> | |
| 207 | friend struct __join_view_iterator; | |
| 208 | ||
| 209 | template <class> | |
| 210 | friend struct std::__segmented_iterator_traits; | |
| 177 | 211 | |
| 178 | 212 | private: |
| 179 | using _Parent = __maybe_const<_Const, join_view>; | |
| 213 | using _Parent = __maybe_const<_Const, join_view<_View>>; | |
| 180 | 214 | using _Base = __maybe_const<_Const, _View>; |
| 181 | 215 | using _Outer = iterator_t<_Base>; |
| 182 | 216 | using _Inner = iterator_t<range_reference_t<_Base>>; |
| 217 | using _InnerRange = range_reference_t<_View>; | |
| 183 | 218 | |
| 184 | 219 | static constexpr bool __ref_is_glvalue = is_reference_v<range_reference_t<_Base>>; |
| 185 | 220 | |
| ... | ... | @@ -208,9 +243,12 @@ namespace ranges { |
| 208 | 243 | __inner_.reset(); |
| 209 | 244 | } |
| 210 | 245 | |
| 246 | _LIBCPP_HIDE_FROM_ABI constexpr __join_view_iterator(_Parent* __parent, _Outer __outer, _Inner __inner) | |
| 247 | : __outer_(std::move(__outer)), __inner_(std::move(__inner)), __parent_(__parent) {} | |
| 248 | ||
| 211 | 249 | public: |
| 212 | 250 | using iterator_concept = _If< |
| 213 | __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> && | |
| 251 | __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> && | |
| 214 | 252 | common_range<range_reference_t<_Base>>, |
| 215 | 253 | bidirectional_iterator_tag, |
| 216 | 254 | _If< |
| ... | ... | @@ -226,17 +264,17 @@ namespace ranges { |
| 226 | 264 | range_difference_t<_Base>, range_difference_t<range_reference_t<_Base>>>; |
| 227 | 265 | |
| 228 | 266 | _LIBCPP_HIDE_FROM_ABI |
| 229 | __iterator() requires default_initializable<_Outer> = default; | |
| 267 | __join_view_iterator() requires default_initializable<_Outer> = default; | |
| 230 | 268 | |
| 231 | 269 | _LIBCPP_HIDE_FROM_ABI |
| 232 | constexpr __iterator(_Parent& __parent, _Outer __outer) | |
| 270 | constexpr __join_view_iterator(_Parent& __parent, _Outer __outer) | |
| 233 | 271 | : __outer_(std::move(__outer)) |
| 234 | 272 | , __parent_(std::addressof(__parent)) { |
| 235 | 273 | __satisfy(); |
| 236 | 274 | } |
| 237 | 275 | |
| 238 | 276 | _LIBCPP_HIDE_FROM_ABI |
| 239 | constexpr __iterator(__iterator<!_Const> __i) | |
| 277 | constexpr __join_view_iterator(__join_view_iterator<_View, !_Const> __i) | |
| 240 | 278 | requires _Const && |
| 241 | 279 | convertible_to<iterator_t<_View>, _Outer> && |
| 242 | 280 | convertible_to<iterator_t<_InnerRange>, _Inner> |
| ... | ... | @@ -257,7 +295,7 @@ namespace ranges { |
| 257 | 295 | } |
| 258 | 296 | |
| 259 | 297 | _LIBCPP_HIDE_FROM_ABI |
| 260 | constexpr __iterator& operator++() { | |
| 298 | constexpr __join_view_iterator& operator++() { | |
| 261 | 299 | auto&& __inner = [&]() -> auto&& { |
| 262 | 300 | if constexpr (__ref_is_glvalue) |
| 263 | 301 | return *__outer_; |
| ... | ... | @@ -277,7 +315,7 @@ namespace ranges { |
| 277 | 315 | } |
| 278 | 316 | |
| 279 | 317 | _LIBCPP_HIDE_FROM_ABI |
| 280 | constexpr __iterator operator++(int) | |
| 318 | constexpr __join_view_iterator operator++(int) | |
| 281 | 319 | requires __ref_is_glvalue && |
| 282 | 320 | forward_range<_Base> && |
| 283 | 321 | forward_range<range_reference_t<_Base>> |
| ... | ... | @@ -288,7 +326,7 @@ namespace ranges { |
| 288 | 326 | } |
| 289 | 327 | |
| 290 | 328 | _LIBCPP_HIDE_FROM_ABI |
| 291 | constexpr __iterator& operator--() | |
| 329 | constexpr __join_view_iterator& operator--() | |
| 292 | 330 | requires __ref_is_glvalue && |
| 293 | 331 | bidirectional_range<_Base> && |
| 294 | 332 | bidirectional_range<range_reference_t<_Base>> && |
| ... | ... | @@ -307,7 +345,7 @@ namespace ranges { |
| 307 | 345 | } |
| 308 | 346 | |
| 309 | 347 | _LIBCPP_HIDE_FROM_ABI |
| 310 | constexpr __iterator operator--(int) | |
| 348 | constexpr __join_view_iterator operator--(int) | |
| 311 | 349 | requires __ref_is_glvalue && |
| 312 | 350 | bidirectional_range<_Base> && |
| 313 | 351 | bidirectional_range<range_reference_t<_Base>> && |
| ... | ... | @@ -319,7 +357,7 @@ namespace ranges { |
| 319 | 357 | } |
| 320 | 358 | |
| 321 | 359 | _LIBCPP_HIDE_FROM_ABI |
| 322 | friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) | |
| 360 | friend constexpr bool operator==(const __join_view_iterator& __x, const __join_view_iterator& __y) | |
| 323 | 361 | requires __ref_is_glvalue && |
| 324 | 362 | equality_comparable<iterator_t<_Base>> && |
| 325 | 363 | equality_comparable<iterator_t<range_reference_t<_Base>>> |
| ... | ... | @@ -328,14 +366,14 @@ namespace ranges { |
| 328 | 366 | } |
| 329 | 367 | |
| 330 | 368 | _LIBCPP_HIDE_FROM_ABI |
| 331 | friend constexpr decltype(auto) iter_move(const __iterator& __i) | |
| 369 | friend constexpr decltype(auto) iter_move(const __join_view_iterator& __i) | |
| 332 | 370 | noexcept(noexcept(ranges::iter_move(*__i.__inner_))) |
| 333 | 371 | { |
| 334 | 372 | return ranges::iter_move(*__i.__inner_); |
| 335 | 373 | } |
| 336 | 374 | |
| 337 | 375 | _LIBCPP_HIDE_FROM_ABI |
| 338 | friend constexpr void iter_swap(const __iterator& __x, const __iterator& __y) | |
| 376 | friend constexpr void iter_swap(const __join_view_iterator& __x, const __join_view_iterator& __y) | |
| 339 | 377 | noexcept(noexcept(ranges::iter_swap(*__x.__inner_, *__y.__inner_))) |
| 340 | 378 | requires indirectly_swappable<_Inner> |
| 341 | 379 | { |
| ... | ... | @@ -345,7 +383,7 @@ namespace ranges { |
| 345 | 383 | |
| 346 | 384 | template<class _Range> |
| 347 | 385 | explicit join_view(_Range&&) -> join_view<views::all_t<_Range>>; |
| 348 | ||
| 386 | ||
| 349 | 387 | namespace views { |
| 350 | 388 | namespace __join_view { |
| 351 | 389 | struct __fn : __range_adaptor_closure<__fn> { |
| ... | ... | @@ -363,7 +401,51 @@ inline namespace __cpo { |
| 363 | 401 | } // namespace views |
| 364 | 402 | } // namespace ranges |
| 365 | 403 | |
| 366 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 404 | template <class _View, bool _Const> | |
| 405 | requires(ranges::common_range<typename ranges::__join_view_iterator<_View, _Const>::_Parent> && | |
| 406 | __is_cpp17_random_access_iterator<typename ranges::__join_view_iterator<_View, _Const>::_Outer>::value && | |
| 407 | __is_cpp17_random_access_iterator<typename ranges::__join_view_iterator<_View, _Const>::_Inner>::value) | |
| 408 | struct __segmented_iterator_traits<ranges::__join_view_iterator<_View, _Const>> { | |
| 409 | using _JoinViewIterator = ranges::__join_view_iterator<_View, _Const>; | |
| 410 | ||
| 411 | using __segment_iterator = | |
| 412 | _LIBCPP_NODEBUG __iterator_with_data<typename _JoinViewIterator::_Outer, typename _JoinViewIterator::_Parent*>; | |
| 413 | using __local_iterator = typename _JoinViewIterator::_Inner; | |
| 414 | ||
| 415 | // TODO: Would it make sense to enable the optimization for other iterator types? | |
| 416 | ||
| 417 | static constexpr _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_JoinViewIterator __iter) { | |
| 418 | if (ranges::empty(__iter.__parent_->__base_)) | |
| 419 | return {}; | |
| 420 | if (!__iter.__inner_.has_value()) | |
| 421 | return __segment_iterator(--__iter.__outer_, __iter.__parent_); | |
| 422 | return __segment_iterator(__iter.__outer_, __iter.__parent_); | |
| 423 | } | |
| 424 | ||
| 425 | static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_JoinViewIterator __iter) { | |
| 426 | if (ranges::empty(__iter.__parent_->__base_)) | |
| 427 | return {}; | |
| 428 | if (!__iter.__inner_.has_value()) | |
| 429 | return ranges::end(*--__iter.__outer_); | |
| 430 | return *__iter.__inner_; | |
| 431 | } | |
| 432 | ||
| 433 | static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __begin(__segment_iterator __iter) { | |
| 434 | return ranges::begin(*__iter.__get_iter()); | |
| 435 | } | |
| 436 | ||
| 437 | static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __end(__segment_iterator __iter) { | |
| 438 | return ranges::end(*__iter.__get_iter()); | |
| 439 | } | |
| 440 | ||
| 441 | static constexpr _LIBCPP_HIDE_FROM_ABI _JoinViewIterator | |
| 442 | __compose(__segment_iterator __seg_iter, __local_iterator __local_iter) { | |
| 443 | return _JoinViewIterator( | |
| 444 | std::move(__seg_iter).__get_data(), std::move(__seg_iter).__get_iter(), std::move(__local_iter)); | |
| 445 | } | |
| 446 | }; | |
| 447 | ||
| 448 | #endif // _LIBCPP_STD_VER > 17 | |
| 367 | 449 | |
| 368 | 450 | _LIBCPP_END_NAMESPACE_STD |
| 369 | 451 |
lib/libcxx/include/__ranges/lazy_split_view.h+3-3| ... | ... | @@ -10,7 +10,6 @@ |
| 10 | 10 | #ifndef _LIBCPP___RANGES_LAZY_SPLIT_VIEW_H |
| 11 | 11 | #define _LIBCPP___RANGES_LAZY_SPLIT_VIEW_H |
| 12 | 12 | |
| 13 | #include <__algorithm/in_in_result.h> | |
| 14 | 13 | #include <__algorithm/ranges_find.h> |
| 15 | 14 | #include <__algorithm/ranges_mismatch.h> |
| 16 | 15 | #include <__concepts/constructible.h> |
| ... | ... | @@ -35,6 +34,7 @@ |
| 35 | 34 | #include <__ranges/single_view.h> |
| 36 | 35 | #include <__ranges/subrange.h> |
| 37 | 36 | #include <__ranges/view_interface.h> |
| 37 | #include <__type_traits/maybe_const.h> | |
| 38 | 38 | #include <__utility/forward.h> |
| 39 | 39 | #include <__utility/move.h> |
| 40 | 40 | #include <type_traits> |
| ... | ... | @@ -45,7 +45,7 @@ |
| 45 | 45 | |
| 46 | 46 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 47 | 47 | |
| 48 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 48 | #if _LIBCPP_STD_VER > 17 | |
| 49 | 49 | |
| 50 | 50 | namespace ranges { |
| 51 | 51 | |
| ... | ... | @@ -458,7 +458,7 @@ inline namespace __cpo { |
| 458 | 458 | |
| 459 | 459 | } // namespace ranges |
| 460 | 460 | |
| 461 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 461 | #endif // _LIBCPP_STD_VER > 17 | |
| 462 | 462 | |
| 463 | 463 | _LIBCPP_END_NAMESPACE_STD |
| 464 | 464 |
lib/libcxx/include/__ranges/non_propagating_cache.h+3-3| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_NON_PROPAGATING_CACHE_H |
| 10 | 11 | #define _LIBCPP___RANGES_NON_PROPAGATING_CACHE_H |
| 11 | 12 | |
| ... | ... | @@ -14,7 +15,6 @@ |
| 14 | 15 | #include <__iterator/iterator_traits.h> // iter_reference_t |
| 15 | 16 | #include <__memory/addressof.h> |
| 16 | 17 | #include <__utility/forward.h> |
| 17 | #include <concepts> // constructible_from | |
| 18 | 18 | #include <optional> |
| 19 | 19 | #include <type_traits> |
| 20 | 20 | |
| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | |
| 25 | 25 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | |
| 27 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 27 | #if _LIBCPP_STD_VER > 17 | |
| 28 | 28 | |
| 29 | 29 | namespace ranges { |
| 30 | 30 | // __non_propagating_cache is a helper type that allows storing an optional value in it, |
| ... | ... | @@ -107,7 +107,7 @@ namespace ranges { |
| 107 | 107 | struct __empty_cache { }; |
| 108 | 108 | } // namespace ranges |
| 109 | 109 | |
| 110 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 110 | #endif // _LIBCPP_STD_VER > 17 | |
| 111 | 111 | |
| 112 | 112 | _LIBCPP_END_NAMESPACE_STD |
| 113 | 113 |
lib/libcxx/include/__ranges/owning_view.h+4-2| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_OWNING_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_OWNING_VIEW_H |
| 11 | 12 | |
| ... | ... | @@ -28,7 +29,7 @@ |
| 28 | 29 | |
| 29 | 30 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 31 | |
| 31 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 32 | #if _LIBCPP_STD_VER > 17 | |
| 32 | 33 | |
| 33 | 34 | namespace ranges { |
| 34 | 35 | template<range _Rp> |
| ... | ... | @@ -68,13 +69,14 @@ public: |
| 68 | 69 | _LIBCPP_HIDE_FROM_ABI constexpr auto data() const requires contiguous_range<const _Rp> |
| 69 | 70 | { return ranges::data(__r_); } |
| 70 | 71 | }; |
| 72 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(owning_view); | |
| 71 | 73 | |
| 72 | 74 | template<class _Tp> |
| 73 | 75 | inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_range<_Tp>; |
| 74 | 76 | |
| 75 | 77 | } // namespace ranges |
| 76 | 78 | |
| 77 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 79 | #endif // _LIBCPP_STD_VER > 17 | |
| 78 | 80 | |
| 79 | 81 | _LIBCPP_END_NAMESPACE_STD |
| 80 | 82 |
lib/libcxx/include/__ranges/range_adaptor.h+7-3| ... | ... | @@ -10,13 +10,16 @@ |
| 10 | 10 | #ifndef _LIBCPP___RANGES_RANGE_ADAPTOR_H |
| 11 | 11 | #define _LIBCPP___RANGES_RANGE_ADAPTOR_H |
| 12 | 12 | |
| 13 | #include <__concepts/constructible.h> | |
| 14 | #include <__concepts/derived_from.h> | |
| 15 | #include <__concepts/invocable.h> | |
| 16 | #include <__concepts/same_as.h> | |
| 13 | 17 | #include <__config> |
| 14 | 18 | #include <__functional/compose.h> |
| 15 | 19 | #include <__functional/invoke.h> |
| 16 | 20 | #include <__ranges/concepts.h> |
| 17 | 21 | #include <__utility/forward.h> |
| 18 | 22 | #include <__utility/move.h> |
| 19 | #include <concepts> | |
| 20 | 23 | #include <type_traits> |
| 21 | 24 | |
| 22 | 25 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -25,7 +28,7 @@ |
| 25 | 28 | |
| 26 | 29 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 30 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 31 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 32 | |
| 30 | 33 | // CRTP base that one can derive from in order to be considered a range adaptor closure |
| 31 | 34 | // by the library. When deriving from this class, a pipe operator will be provided to |
| ... | ... | @@ -41,6 +44,7 @@ template <class _Fn> |
| 41 | 44 | struct __range_adaptor_closure_t : _Fn, __range_adaptor_closure<__range_adaptor_closure_t<_Fn>> { |
| 42 | 45 | constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(std::move(__f)) { } |
| 43 | 46 | }; |
| 47 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__range_adaptor_closure_t); | |
| 44 | 48 | |
| 45 | 49 | template <class _Tp> |
| 46 | 50 | concept _RangeAdaptorClosure = derived_from<remove_cvref_t<_Tp>, __range_adaptor_closure<remove_cvref_t<_Tp>>>; |
| ... | ... | @@ -66,7 +70,7 @@ struct __range_adaptor_closure { |
| 66 | 70 | { return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1))); } |
| 67 | 71 | }; |
| 68 | 72 | |
| 69 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 73 | #endif // _LIBCPP_STD_VER > 17 | |
| 70 | 74 | |
| 71 | 75 | _LIBCPP_END_NAMESPACE_STD |
| 72 | 76 |
lib/libcxx/include/__ranges/rbegin.h+3-2| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_RBEGIN_H |
| 10 | 11 | #define _LIBCPP___RANGES_RBEGIN_H |
| 11 | 12 | |
| ... | ... | @@ -25,7 +26,7 @@ |
| 25 | 26 | |
| 26 | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 28 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 30 | |
| 30 | 31 | // [ranges.access.rbegin] |
| 31 | 32 | |
| ... | ... | @@ -123,7 +124,7 @@ inline namespace __cpo { |
| 123 | 124 | } // namespace __cpo |
| 124 | 125 | } // namespace ranges |
| 125 | 126 | |
| 126 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 127 | #endif // _LIBCPP_STD_VER > 17 | |
| 127 | 128 | |
| 128 | 129 | _LIBCPP_END_NAMESPACE_STD |
| 129 | 130 |
lib/libcxx/include/__ranges/ref_view.h+6-4| ... | ... | @@ -6,9 +6,12 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_REF_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_REF_VIEW_H |
| 11 | 12 | |
| 13 | #include <__concepts/convertible_to.h> | |
| 14 | #include <__concepts/different_from.h> | |
| 12 | 15 | #include <__config> |
| 13 | 16 | #include <__iterator/concepts.h> |
| 14 | 17 | #include <__iterator/incrementable_traits.h> |
| ... | ... | @@ -22,7 +25,6 @@ |
| 22 | 25 | #include <__ranges/size.h> |
| 23 | 26 | #include <__ranges/view_interface.h> |
| 24 | 27 | #include <__utility/forward.h> |
| 25 | #include <concepts> | |
| 26 | 28 | #include <type_traits> |
| 27 | 29 | |
| 28 | 30 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -31,7 +33,7 @@ |
| 31 | 33 | |
| 32 | 34 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 33 | 35 | |
| 34 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 36 | #if _LIBCPP_STD_VER > 17 | |
| 35 | 37 | |
| 36 | 38 | namespace ranges { |
| 37 | 39 | template<range _Range> |
| ... | ... | @@ -45,7 +47,7 @@ namespace ranges { |
| 45 | 47 | public: |
| 46 | 48 | template<class _Tp> |
| 47 | 49 | requires __different_from<_Tp, ref_view> && |
| 48 | convertible_to<_Tp, _Range&> && requires { __fun(declval<_Tp>()); } | |
| 50 | convertible_to<_Tp, _Range&> && requires { __fun(std::declval<_Tp>()); } | |
| 49 | 51 | _LIBCPP_HIDE_FROM_ABI |
| 50 | 52 | constexpr ref_view(_Tp&& __t) |
| 51 | 53 | : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t)))) |
| ... | ... | @@ -79,7 +81,7 @@ public: |
| 79 | 81 | inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true; |
| 80 | 82 | } // namespace ranges |
| 81 | 83 | |
| 82 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 84 | #endif // _LIBCPP_STD_VER > 17 | |
| 83 | 85 | |
| 84 | 86 | _LIBCPP_END_NAMESPACE_STD |
| 85 | 87 |
lib/libcxx/include/__ranges/rend.h+3-2| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_REND_H |
| 10 | 11 | #define _LIBCPP___RANGES_REND_H |
| 11 | 12 | |
| ... | ... | @@ -26,7 +27,7 @@ |
| 26 | 27 | |
| 27 | 28 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 29 | |
| 29 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 30 | #if _LIBCPP_STD_VER > 17 | |
| 30 | 31 | |
| 31 | 32 | // [range.access.rend] |
| 32 | 33 | |
| ... | ... | @@ -127,7 +128,7 @@ inline namespace __cpo { |
| 127 | 128 | } // namespace __cpo |
| 128 | 129 | } // namespace ranges |
| 129 | 130 | |
| 130 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 131 | #endif // _LIBCPP_STD_VER > 17 | |
| 131 | 132 | |
| 132 | 133 | _LIBCPP_END_NAMESPACE_STD |
| 133 | 134 |
lib/libcxx/include/__ranges/reverse_view.h+3-2| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_REVERSE_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_REVERSE_VIEW_H |
| 11 | 12 | |
| ... | ... | @@ -33,7 +34,7 @@ |
| 33 | 34 | |
| 34 | 35 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 35 | 36 | |
| 36 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 37 | #if _LIBCPP_STD_VER > 17 | |
| 37 | 38 | |
| 38 | 39 | namespace ranges { |
| 39 | 40 | template<view _View> |
| ... | ... | @@ -183,7 +184,7 @@ namespace ranges { |
| 183 | 184 | } // namespace views |
| 184 | 185 | } // namespace ranges |
| 185 | 186 | |
| 186 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 187 | #endif // _LIBCPP_STD_VER > 17 | |
| 187 | 188 | |
| 188 | 189 | _LIBCPP_END_NAMESPACE_STD |
| 189 | 190 |
lib/libcxx/include/__ranges/single_view.h+4-3| ... | ... | @@ -6,9 +6,11 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_SINGLE_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_SINGLE_VIEW_H |
| 11 | 12 | |
| 13 | #include <__concepts/constructible.h> | |
| 12 | 14 | #include <__config> |
| 13 | 15 | #include <__ranges/copyable_box.h> |
| 14 | 16 | #include <__ranges/range_adaptor.h> |
| ... | ... | @@ -16,7 +18,6 @@ |
| 16 | 18 | #include <__utility/forward.h> |
| 17 | 19 | #include <__utility/in_place.h> |
| 18 | 20 | #include <__utility/move.h> |
| 19 | #include <concepts> | |
| 20 | 21 | #include <type_traits> |
| 21 | 22 | |
| 22 | 23 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -25,7 +26,7 @@ |
| 25 | 26 | |
| 26 | 27 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 28 | |
| 28 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 29 | #if _LIBCPP_STD_VER > 17 | |
| 29 | 30 | |
| 30 | 31 | namespace ranges { |
| 31 | 32 | template<copy_constructible _Tp> |
| ... | ... | @@ -94,7 +95,7 @@ inline namespace __cpo { |
| 94 | 95 | } // namespace views |
| 95 | 96 | } // namespace ranges |
| 96 | 97 | |
| 97 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 98 | #endif // _LIBCPP_STD_VER > 17 | |
| 98 | 99 | |
| 99 | 100 | _LIBCPP_END_NAMESPACE_STD |
| 100 | 101 |
lib/libcxx/include/__ranges/size.h+8-3| ... | ... | @@ -6,18 +6,23 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_SIZE_H |
| 10 | 11 | #define _LIBCPP___RANGES_SIZE_H |
| 11 | 12 | |
| 13 | #include <__concepts/arithmetic.h> | |
| 12 | 14 | #include <__concepts/class_or_enum.h> |
| 13 | 15 | #include <__config> |
| 14 | 16 | #include <__iterator/concepts.h> |
| 15 | 17 | #include <__iterator/iterator_traits.h> |
| 16 | 18 | #include <__ranges/access.h> |
| 19 | #include <__type_traits/decay.h> | |
| 20 | #include <__type_traits/make_signed.h> | |
| 21 | #include <__type_traits/make_unsigned.h> | |
| 22 | #include <__type_traits/remove_cvref.h> | |
| 17 | 23 | #include <__utility/auto_cast.h> |
| 18 | #include <concepts> | |
| 24 | #include <__utility/declval.h> | |
| 19 | 25 | #include <cstddef> |
| 20 | #include <type_traits> | |
| 21 | 26 | |
| 22 | 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | 28 | # pragma GCC system_header |
| ... | ... | @@ -66,7 +71,7 @@ concept __difference = |
| 66 | 71 | __class_or_enum<remove_cvref_t<_Tp>> && |
| 67 | 72 | requires(_Tp&& __t) { |
| 68 | 73 | { ranges::begin(__t) } -> forward_iterator; |
| 69 | { ranges::end(__t) } -> sized_sentinel_for<decltype(ranges::begin(declval<_Tp>()))>; | |
| 74 | { ranges::end(__t) } -> sized_sentinel_for<decltype(ranges::begin(std::declval<_Tp>()))>; | |
| 70 | 75 | }; |
| 71 | 76 | |
| 72 | 77 | struct __fn { |
lib/libcxx/include/__ranges/split_view.h created+232| ... | ... | @@ -0,0 +1,232 @@ |
| 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_SPLIT_VIEW_H | |
| 11 | #define _LIBCPP___RANGES_SPLIT_VIEW_H | |
| 12 | ||
| 13 | #include <__algorithm/ranges_search.h> | |
| 14 | #include <__concepts/constructible.h> | |
| 15 | #include <__config> | |
| 16 | #include <__functional/bind_back.h> | |
| 17 | #include <__functional/ranges_operations.h> | |
| 18 | #include <__iterator/indirectly_comparable.h> | |
| 19 | #include <__iterator/iterator_traits.h> | |
| 20 | #include <__memory/addressof.h> | |
| 21 | #include <__ranges/access.h> | |
| 22 | #include <__ranges/all.h> | |
| 23 | #include <__ranges/concepts.h> | |
| 24 | #include <__ranges/empty.h> | |
| 25 | #include <__ranges/non_propagating_cache.h> | |
| 26 | #include <__ranges/range_adaptor.h> | |
| 27 | #include <__ranges/single_view.h> | |
| 28 | #include <__ranges/subrange.h> | |
| 29 | #include <__ranges/view_interface.h> | |
| 30 | #include <__type_traits/decay.h> | |
| 31 | #include <__type_traits/is_nothrow_constructible.h> | |
| 32 | #include <__utility/forward.h> | |
| 33 | #include <__utility/move.h> | |
| 34 | ||
| 35 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 36 | # pragma GCC system_header | |
| 37 | #endif | |
| 38 | ||
| 39 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 40 | ||
| 41 | #if _LIBCPP_STD_VER >= 20 | |
| 42 | ||
| 43 | namespace ranges { | |
| 44 | ||
| 45 | template <class _View, class _Pattern> | |
| 46 | struct __split_view_iterator; | |
| 47 | ||
| 48 | template <class _View, class _Pattern> | |
| 49 | struct __split_view_sentinel; | |
| 50 | ||
| 51 | template <forward_range _View, forward_range _Pattern> | |
| 52 | requires view<_View> && view<_Pattern> && | |
| 53 | indirectly_comparable<iterator_t<_View>, iterator_t<_Pattern>, ranges::equal_to> | |
| 54 | class split_view : public view_interface<split_view<_View, _Pattern>> { | |
| 55 | private: | |
| 56 | _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); | |
| 57 | _LIBCPP_NO_UNIQUE_ADDRESS _Pattern __pattern_ = _Pattern(); | |
| 58 | using _Cache = __non_propagating_cache<subrange<iterator_t<_View>>>; | |
| 59 | _Cache __cached_begin_ = _Cache(); | |
| 60 | ||
| 61 | template <class, class> | |
| 62 | friend struct __split_view_iterator; | |
| 63 | ||
| 64 | template <class, class> | |
| 65 | friend struct __split_view_sentinel; | |
| 66 | ||
| 67 | using __iterator = __split_view_iterator<_View, _Pattern>; | |
| 68 | using __sentinel = __split_view_sentinel<_View, _Pattern>; | |
| 69 | ||
| 70 | _LIBCPP_HIDE_FROM_ABI constexpr subrange<iterator_t<_View>> __find_next(iterator_t<_View> __it) { | |
| 71 | auto [__begin, __end] = ranges::search(subrange(__it, ranges::end(__base_)), __pattern_); | |
| 72 | if (__begin != ranges::end(__base_) && ranges::empty(__pattern_)) { | |
| 73 | ++__begin; | |
| 74 | ++__end; | |
| 75 | } | |
| 76 | return {__begin, __end}; | |
| 77 | } | |
| 78 | ||
| 79 | public: | |
| 80 | _LIBCPP_HIDE_FROM_ABI split_view() | |
| 81 | requires default_initializable<_View> && default_initializable<_Pattern> | |
| 82 | = default; | |
| 83 | ||
| 84 | _LIBCPP_HIDE_FROM_ABI constexpr split_view(_View __base, _Pattern __pattern) | |
| 85 | : __base_(std::move(__base)), __pattern_(std::move((__pattern))) {} | |
| 86 | ||
| 87 | template <forward_range _Range> | |
| 88 | requires constructible_from<_View, views::all_t<_Range>> && | |
| 89 | constructible_from<_Pattern, single_view<range_value_t<_Range>>> | |
| 90 | _LIBCPP_HIDE_FROM_ABI constexpr split_view(_Range&& __range, range_value_t<_Range> __elem) | |
| 91 | : __base_(views::all(std::forward<_Range>(__range))), __pattern_(views::single(std::move(__elem))) {} | |
| 92 | ||
| 93 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | |
| 94 | requires copy_constructible<_View> | |
| 95 | { | |
| 96 | return __base_; | |
| 97 | } | |
| 98 | ||
| 99 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | |
| 100 | ||
| 101 | _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() { | |
| 102 | if (!__cached_begin_.__has_value()) { | |
| 103 | __cached_begin_.__emplace(__find_next(ranges::begin(__base_))); | |
| 104 | } | |
| 105 | return {*this, ranges::begin(__base_), *__cached_begin_}; | |
| 106 | } | |
| 107 | ||
| 108 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() { | |
| 109 | if constexpr (common_range<_View>) { | |
| 110 | return __iterator{*this, ranges::end(__base_), {}}; | |
| 111 | } else { | |
| 112 | return __sentinel{*this}; | |
| 113 | } | |
| 114 | } | |
| 115 | }; | |
| 116 | ||
| 117 | template <class _Range, class _Pattern> | |
| 118 | split_view(_Range&&, _Pattern&&) -> split_view<views::all_t<_Range>, views::all_t<_Pattern>>; | |
| 119 | ||
| 120 | template <forward_range _Range> | |
| 121 | split_view(_Range&&, range_value_t<_Range>) -> split_view<views::all_t<_Range>, single_view<range_value_t<_Range>>>; | |
| 122 | ||
| 123 | template <class _View, class _Pattern> | |
| 124 | struct __split_view_iterator { | |
| 125 | private: | |
| 126 | split_view<_View, _Pattern>* __parent_ = nullptr; | |
| 127 | _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __cur_ = iterator_t<_View>(); | |
| 128 | _LIBCPP_NO_UNIQUE_ADDRESS subrange<iterator_t<_View>> __next_ = subrange<iterator_t<_View>>(); | |
| 129 | bool __trailing_empty_ = false; | |
| 130 | ||
| 131 | template <class, class> | |
| 132 | friend struct __split_view_sentinel; | |
| 133 | ||
| 134 | public: | |
| 135 | using iterator_concept = forward_iterator_tag; | |
| 136 | using iterator_category = input_iterator_tag; | |
| 137 | using value_type = subrange<iterator_t<_View>>; | |
| 138 | using difference_type = range_difference_t<_View>; | |
| 139 | ||
| 140 | _LIBCPP_HIDE_FROM_ABI __split_view_iterator() = default; | |
| 141 | ||
| 142 | _LIBCPP_HIDE_FROM_ABI constexpr __split_view_iterator( | |
| 143 | split_view<_View, _Pattern>& __parent, iterator_t<_View> __current, subrange<iterator_t<_View>> __next) | |
| 144 | : __parent_(std::addressof(__parent)), __cur_(std::move(__current)), __next_(std::move(__next)) {} | |
| 145 | ||
| 146 | _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() const { return __cur_; } | |
| 147 | ||
| 148 | _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return {__cur_, __next_.begin()}; } | |
| 149 | ||
| 150 | _LIBCPP_HIDE_FROM_ABI constexpr __split_view_iterator& operator++() { | |
| 151 | __cur_ = __next_.begin(); | |
| 152 | if (__cur_ != ranges::end(__parent_->__base_)) { | |
| 153 | __cur_ = __next_.end(); | |
| 154 | if (__cur_ == ranges::end(__parent_->__base_)) { | |
| 155 | __trailing_empty_ = true; | |
| 156 | __next_ = {__cur_, __cur_}; | |
| 157 | } else { | |
| 158 | __next_ = __parent_->__find_next(__cur_); | |
| 159 | } | |
| 160 | } else { | |
| 161 | __trailing_empty_ = false; | |
| 162 | } | |
| 163 | return *this; | |
| 164 | } | |
| 165 | ||
| 166 | _LIBCPP_HIDE_FROM_ABI constexpr __split_view_iterator operator++(int) { | |
| 167 | auto __tmp = *this; | |
| 168 | ++*this; | |
| 169 | return __tmp; | |
| 170 | } | |
| 171 | ||
| 172 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | |
| 173 | operator==(const __split_view_iterator& __x, const __split_view_iterator& __y) { | |
| 174 | return __x.__cur_ == __y.__cur_ && __x.__trailing_empty_ == __y.__trailing_empty_; | |
| 175 | } | |
| 176 | }; | |
| 177 | ||
| 178 | template <class _View, class _Pattern> | |
| 179 | struct __split_view_sentinel { | |
| 180 | private: | |
| 181 | _LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_View> __end_ = sentinel_t<_View>(); | |
| 182 | ||
| 183 | _LIBCPP_HIDE_FROM_ABI static constexpr bool | |
| 184 | __equals(const __split_view_iterator<_View, _Pattern>& __x, const __split_view_sentinel& __y) { | |
| 185 | return __x.__cur_ == __y.__end_ && !__x.__trailing_empty_; | |
| 186 | } | |
| 187 | ||
| 188 | public: | |
| 189 | _LIBCPP_HIDE_FROM_ABI __split_view_sentinel() = default; | |
| 190 | ||
| 191 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __split_view_sentinel(split_view<_View, _Pattern>& __parent) | |
| 192 | : __end_(ranges::end(__parent.__base_)) {} | |
| 193 | ||
| 194 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | |
| 195 | operator==(const __split_view_iterator<_View, _Pattern>& __x, const __split_view_sentinel& __y) { | |
| 196 | return __equals(__x, __y); | |
| 197 | } | |
| 198 | }; | |
| 199 | ||
| 200 | namespace views { | |
| 201 | namespace __split_view { | |
| 202 | struct __fn : __range_adaptor_closure<__fn> { | |
| 203 | // clang-format off | |
| 204 | template <class _Range, class _Pattern> | |
| 205 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI | |
| 206 | constexpr auto operator()(_Range&& __range, _Pattern&& __pattern) const | |
| 207 | noexcept(noexcept(split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)))) | |
| 208 | -> decltype( split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))) | |
| 209 | { return split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)); } | |
| 210 | // clang-format on | |
| 211 | ||
| 212 | template <class _Pattern> | |
| 213 | requires constructible_from<decay_t<_Pattern>, _Pattern> | |
| 214 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pattern&& __pattern) const | |
| 215 | noexcept(is_nothrow_constructible_v<decay_t<_Pattern>, _Pattern>) { | |
| 216 | return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pattern>(__pattern))); | |
| 217 | } | |
| 218 | }; | |
| 219 | } // namespace __split_view | |
| 220 | ||
| 221 | inline namespace __cpo { | |
| 222 | inline constexpr auto split = __split_view::__fn{}; | |
| 223 | } // namespace __cpo | |
| 224 | } // namespace views | |
| 225 | ||
| 226 | } // namespace ranges | |
| 227 | ||
| 228 | #endif // _LIBCPP_STD_VER >= 20 | |
| 229 | ||
| 230 | _LIBCPP_END_NAMESPACE_STD | |
| 231 | ||
| 232 | #endif // _LIBCPP___RANGES_SPLIT_VIEW_H |
lib/libcxx/include/__ranges/subrange.h+16-17| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_SUBRANGE_H |
| 10 | 11 | #define _LIBCPP___RANGES_SUBRANGE_H |
| 11 | 12 | |
| ... | ... | @@ -16,6 +17,8 @@ |
| 16 | 17 | #include <__concepts/derived_from.h> |
| 17 | 18 | #include <__concepts/different_from.h> |
| 18 | 19 | #include <__config> |
| 20 | #include <__fwd/get.h> | |
| 21 | #include <__fwd/subrange.h> | |
| 19 | 22 | #include <__iterator/advance.h> |
| 20 | 23 | #include <__iterator/concepts.h> |
| 21 | 24 | #include <__iterator/incrementable_traits.h> |
| ... | ... | @@ -26,9 +29,18 @@ |
| 26 | 29 | #include <__ranges/enable_borrowed_range.h> |
| 27 | 30 | #include <__ranges/size.h> |
| 28 | 31 | #include <__ranges/view_interface.h> |
| 29 | #include <__tuple> | |
| 32 | #include <__tuple_dir/pair_like.h> | |
| 33 | #include <__tuple_dir/tuple_element.h> | |
| 34 | #include <__tuple_dir/tuple_size.h> | |
| 35 | #include <__type_traits/conditional.h> | |
| 36 | #include <__type_traits/decay.h> | |
| 37 | #include <__type_traits/is_pointer.h> | |
| 38 | #include <__type_traits/is_reference.h> | |
| 39 | #include <__type_traits/make_unsigned.h> | |
| 40 | #include <__type_traits/remove_const.h> | |
| 41 | #include <__type_traits/remove_pointer.h> | |
| 30 | 42 | #include <__utility/move.h> |
| 31 | #include <type_traits> | |
| 43 | #include <cstddef> | |
| 32 | 44 | |
| 33 | 45 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 34 | 46 | # pragma GCC system_header |
| ... | ... | @@ -36,7 +48,7 @@ |
| 36 | 48 | |
| 37 | 49 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 38 | 50 | |
| 39 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 51 | #if _LIBCPP_STD_VER > 17 | |
| 40 | 52 | |
| 41 | 53 | namespace ranges { |
| 42 | 54 | template<class _From, class _To> |
| ... | ... | @@ -49,17 +61,6 @@ namespace ranges { |
| 49 | 61 | convertible_to<_From, _To> && |
| 50 | 62 | !__uses_nonqualification_pointer_conversion<decay_t<_From>, decay_t<_To>>; |
| 51 | 63 | |
| 52 | template<class _Tp> | |
| 53 | concept __pair_like = | |
| 54 | !is_reference_v<_Tp> && requires(_Tp __t) { | |
| 55 | typename tuple_size<_Tp>::type; // Ensures `tuple_size<T>` is complete. | |
| 56 | requires derived_from<tuple_size<_Tp>, integral_constant<size_t, 2>>; | |
| 57 | typename tuple_element_t<0, remove_const_t<_Tp>>; | |
| 58 | typename tuple_element_t<1, remove_const_t<_Tp>>; | |
| 59 | { std::get<0>(__t) } -> convertible_to<const tuple_element_t<0, _Tp>&>; | |
| 60 | { std::get<1>(__t) } -> convertible_to<const tuple_element_t<1, _Tp>&>; | |
| 61 | }; | |
| 62 | ||
| 63 | 64 | template<class _Pair, class _Iter, class _Sent> |
| 64 | 65 | concept __pair_like_convertible_from = |
| 65 | 66 | !range<_Pair> && __pair_like<_Pair> && |
| ... | ... | @@ -67,8 +68,6 @@ namespace ranges { |
| 67 | 68 | __convertible_to_non_slicing<_Iter, tuple_element_t<0, _Pair>> && |
| 68 | 69 | convertible_to<_Sent, tuple_element_t<1, _Pair>>; |
| 69 | 70 | |
| 70 | enum class _LIBCPP_ENUM_VIS subrange_kind : bool { unsized, sized }; | |
| 71 | ||
| 72 | 71 | template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent = _Iter, |
| 73 | 72 | subrange_kind _Kind = sized_sentinel_for<_Sent, _Iter> |
| 74 | 73 | ? subrange_kind::sized |
| ... | ... | @@ -285,7 +284,7 @@ struct tuple_element<1, const ranges::subrange<_Ip, _Sp, _Kp>> { |
| 285 | 284 | using type = _Sp; |
| 286 | 285 | }; |
| 287 | 286 | |
| 288 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 287 | #endif // _LIBCPP_STD_VER > 17 | |
| 289 | 288 | |
| 290 | 289 | _LIBCPP_END_NAMESPACE_STD |
| 291 | 290 |
lib/libcxx/include/__ranges/take_view.h+12-6| ... | ... | @@ -6,11 +6,15 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_TAKE_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_TAKE_VIEW_H |
| 11 | 12 | |
| 12 | 13 | #include <__algorithm/min.h> |
| 13 | 14 | #include <__algorithm/ranges_min.h> |
| 15 | #include <__assert> | |
| 16 | #include <__concepts/constructible.h> | |
| 17 | #include <__concepts/convertible_to.h> | |
| 14 | 18 | #include <__config> |
| 15 | 19 | #include <__functional/bind_back.h> |
| 16 | 20 | #include <__fwd/span.h> |
| ... | ... | @@ -30,10 +34,10 @@ |
| 30 | 34 | #include <__ranges/size.h> |
| 31 | 35 | #include <__ranges/subrange.h> |
| 32 | 36 | #include <__ranges/view_interface.h> |
| 37 | #include <__type_traits/maybe_const.h> | |
| 33 | 38 | #include <__utility/auto_cast.h> |
| 34 | 39 | #include <__utility/forward.h> |
| 35 | 40 | #include <__utility/move.h> |
| 36 | #include <concepts> | |
| 37 | 41 | #include <type_traits> |
| 38 | 42 | |
| 39 | 43 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -45,7 +49,7 @@ _LIBCPP_PUSH_MACROS |
| 45 | 49 | |
| 46 | 50 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 47 | 51 | |
| 48 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 52 | #if _LIBCPP_STD_VER > 17 | |
| 49 | 53 | |
| 50 | 54 | namespace ranges { |
| 51 | 55 | |
| ... | ... | @@ -60,9 +64,10 @@ public: |
| 60 | 64 | _LIBCPP_HIDE_FROM_ABI |
| 61 | 65 | take_view() requires default_initializable<_View> = default; |
| 62 | 66 | |
| 63 | _LIBCPP_HIDE_FROM_ABI | |
| 64 | constexpr take_view(_View __base, range_difference_t<_View> __count) | |
| 65 | : __base_(std::move(__base)), __count_(__count) {} | |
| 67 | _LIBCPP_HIDE_FROM_ABI constexpr take_view(_View __base, range_difference_t<_View> __count) | |
| 68 | : __base_(std::move(__base)), __count_(__count) { | |
| 69 | _LIBCPP_ASSERT(__count >= 0, "count has to be greater than or equal to zero"); | |
| 70 | } | |
| 66 | 71 | |
| 67 | 72 | _LIBCPP_HIDE_FROM_ABI |
| 68 | 73 | constexpr _View base() const& requires copy_constructible<_View> { return __base_; } |
| ... | ... | @@ -225,6 +230,7 @@ struct __passthrough_type<basic_string_view<_CharT, _Traits>> { |
| 225 | 230 | }; |
| 226 | 231 | |
| 227 | 232 | template <class _Iter, class _Sent, subrange_kind _Kind> |
| 233 | requires requires{typename subrange<_Iter>;} | |
| 228 | 234 | struct __passthrough_type<subrange<_Iter, _Sent, _Kind>> { |
| 229 | 235 | using type = subrange<_Iter>; |
| 230 | 236 | }; |
| ... | ... | @@ -328,7 +334,7 @@ inline namespace __cpo { |
| 328 | 334 | |
| 329 | 335 | } // namespace ranges |
| 330 | 336 | |
| 331 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 337 | #endif // _LIBCPP_STD_VER > 17 | |
| 332 | 338 | |
| 333 | 339 | _LIBCPP_END_NAMESPACE_STD |
| 334 | 340 |
lib/libcxx/include/__ranges/take_while_view.h created+183| ... | ... | @@ -0,0 +1,183 @@ |
| 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_TAKE_WHILE_VIEW_H | |
| 11 | #define _LIBCPP___RANGES_TAKE_WHILE_VIEW_H | |
| 12 | ||
| 13 | #include <__concepts/constructible.h> | |
| 14 | #include <__concepts/convertible_to.h> | |
| 15 | #include <__config> | |
| 16 | #include <__functional/bind_back.h> | |
| 17 | #include <__functional/invoke.h> | |
| 18 | #include <__iterator/concepts.h> | |
| 19 | #include <__memory/addressof.h> | |
| 20 | #include <__ranges/access.h> | |
| 21 | #include <__ranges/all.h> | |
| 22 | #include <__ranges/concepts.h> | |
| 23 | #include <__ranges/copyable_box.h> | |
| 24 | #include <__ranges/range_adaptor.h> | |
| 25 | #include <__ranges/view_interface.h> | |
| 26 | #include <__type_traits/decay.h> | |
| 27 | #include <__type_traits/is_nothrow_constructible.h> | |
| 28 | #include <__type_traits/is_object.h> | |
| 29 | #include <__type_traits/maybe_const.h> | |
| 30 | #include <__utility/forward.h> | |
| 31 | #include <__utility/in_place.h> | |
| 32 | #include <__utility/move.h> | |
| 33 | ||
| 34 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 35 | # pragma GCC system_header | |
| 36 | #endif | |
| 37 | ||
| 38 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 39 | ||
| 40 | #if _LIBCPP_STD_VER >= 20 | |
| 41 | ||
| 42 | namespace ranges { | |
| 43 | ||
| 44 | // The spec uses the unnamed requirement inside the `begin` and `end` member functions: | |
| 45 | // constexpr auto begin() const | |
| 46 | // requires range<const V> && indirect_unary_predicate<const Pred, iterator_t<const V>> | |
| 47 | // However, due to a clang-14 and clang-15 bug, the above produces a hard error when `const V` is not a range. | |
| 48 | // The workaround is to create a named concept and use the concept instead. | |
| 49 | // As of take_while_view is implemented, the clang-trunk has already fixed the bug. | |
| 50 | // It is OK to remove the workaround once our CI no longer uses clang-14, clang-15 based compilers, | |
| 51 | // because we don't actually expect a lot of vendors to ship a new libc++ with an old clang. | |
| 52 | template <class _View, class _Pred> | |
| 53 | concept __take_while_const_is_range = | |
| 54 | range<const _View> && indirect_unary_predicate<const _Pred, iterator_t<const _View>>; | |
| 55 | ||
| 56 | template <class, class, bool> | |
| 57 | class __take_while_view_sentinel; | |
| 58 | ||
| 59 | template <view _View, class _Pred> | |
| 60 | requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>> | |
| 61 | class take_while_view : public view_interface<take_while_view<_View, _Pred>> { | |
| 62 | template <class, class, bool> | |
| 63 | friend class __take_while_view_sentinel; | |
| 64 | ||
| 65 | template <bool _Const> | |
| 66 | using __sentinel = __take_while_view_sentinel<_View, _Pred, _Const>; | |
| 67 | ||
| 68 | _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); | |
| 69 | _LIBCPP_NO_UNIQUE_ADDRESS __copyable_box<_Pred> __pred_; | |
| 70 | ||
| 71 | public: | |
| 72 | _LIBCPP_HIDE_FROM_ABI take_while_view() | |
| 73 | requires default_initializable<_View> && default_initializable<_Pred> | |
| 74 | = default; | |
| 75 | ||
| 76 | _LIBCPP_HIDE_FROM_ABI constexpr take_while_view(_View __base, _Pred __pred) | |
| 77 | : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {} | |
| 78 | ||
| 79 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | |
| 80 | requires copy_constructible<_View> | |
| 81 | { | |
| 82 | return __base_; | |
| 83 | } | |
| 84 | ||
| 85 | _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | |
| 86 | ||
| 87 | _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; } | |
| 88 | ||
| 89 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() | |
| 90 | requires(!__simple_view<_View>) | |
| 91 | { | |
| 92 | return ranges::begin(__base_); | |
| 93 | } | |
| 94 | ||
| 95 | _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | |
| 96 | requires __take_while_const_is_range<_View, _Pred> | |
| 97 | { | |
| 98 | return ranges::begin(__base_); | |
| 99 | } | |
| 100 | ||
| 101 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() | |
| 102 | requires(!__simple_view<_View>) | |
| 103 | { | |
| 104 | return __sentinel</*_Const=*/false>(ranges::end(__base_), std::addressof(*__pred_)); | |
| 105 | } | |
| 106 | ||
| 107 | _LIBCPP_HIDE_FROM_ABI constexpr auto end() const | |
| 108 | requires __take_while_const_is_range<_View, _Pred> | |
| 109 | { | |
| 110 | return __sentinel</*_Const=*/true>(ranges::end(__base_), std::addressof(*__pred_)); | |
| 111 | } | |
| 112 | }; | |
| 113 | ||
| 114 | template <class _Range, class _Pred> | |
| 115 | take_while_view(_Range&&, _Pred) -> take_while_view<views::all_t<_Range>, _Pred>; | |
| 116 | ||
| 117 | template <class _View, class _Pred, bool _Const> | |
| 118 | class __take_while_view_sentinel { | |
| 119 | using _Base = __maybe_const<_Const, _View>; | |
| 120 | ||
| 121 | sentinel_t<_Base> __end_ = sentinel_t<_Base>(); | |
| 122 | const _Pred* __pred_ = nullptr; | |
| 123 | ||
| 124 | template <class, class, bool> | |
| 125 | friend class __take_while_view_sentinel; | |
| 126 | ||
| 127 | public: | |
| 128 | _LIBCPP_HIDE_FROM_ABI __take_while_view_sentinel() = default; | |
| 129 | ||
| 130 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __take_while_view_sentinel(sentinel_t<_Base> __end, const _Pred* __pred) | |
| 131 | : __end_(std::move(__end)), __pred_(__pred) {} | |
| 132 | ||
| 133 | _LIBCPP_HIDE_FROM_ABI constexpr __take_while_view_sentinel(__take_while_view_sentinel<_View, _Pred, !_Const> __s) | |
| 134 | requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> | |
| 135 | : __end_(std::move(__s.__end_)), __pred_(__s.__pred_) {} | |
| 136 | ||
| 137 | _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } | |
| 138 | ||
| 139 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | |
| 140 | operator==(const iterator_t<_Base>& __x, const __take_while_view_sentinel& __y) { | |
| 141 | return __x == __y.__end_ || !std::invoke(*__y.__pred_, *__x); | |
| 142 | } | |
| 143 | ||
| 144 | template <bool _OtherConst = !_Const> | |
| 145 | requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> | |
| 146 | _LIBCPP_HIDE_FROM_ABI friend constexpr bool | |
| 147 | operator==(const iterator_t<__maybe_const<_OtherConst, _View>>& __x, const __take_while_view_sentinel& __y) { | |
| 148 | return __x == __y.__end_ || !std::invoke(*__y.__pred_, *__x); | |
| 149 | } | |
| 150 | }; | |
| 151 | ||
| 152 | namespace views { | |
| 153 | namespace __take_while { | |
| 154 | ||
| 155 | struct __fn { | |
| 156 | template <class _Range, class _Pred> | |
| 157 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const | |
| 158 | noexcept(noexcept(/**/ take_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)))) | |
| 159 | -> decltype(/*--*/ take_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) { | |
| 160 | return /*-------------*/ take_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)); | |
| 161 | } | |
| 162 | ||
| 163 | template <class _Pred> | |
| 164 | requires constructible_from<decay_t<_Pred>, _Pred> | |
| 165 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const | |
| 166 | noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) { | |
| 167 | return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred))); | |
| 168 | } | |
| 169 | }; | |
| 170 | ||
| 171 | } // namespace __take_while | |
| 172 | ||
| 173 | inline namespace __cpo { | |
| 174 | inline constexpr auto take_while = __take_while::__fn{}; | |
| 175 | } // namespace __cpo | |
| 176 | } // namespace views | |
| 177 | } // namespace ranges | |
| 178 | ||
| 179 | #endif // _LIBCPP_STD_VER >= 20 | |
| 180 | ||
| 181 | _LIBCPP_END_NAMESPACE_STD | |
| 182 | ||
| 183 | #endif // _LIBCPP___RANGES_TAKE_WHILE_VIEW_H |
lib/libcxx/include/__ranges/transform_view.h+80-53| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_TRANSFORM_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_TRANSFORM_VIEW_H |
| 11 | 12 | |
| ... | ... | @@ -30,6 +31,7 @@ |
| 30 | 31 | #include <__ranges/range_adaptor.h> |
| 31 | 32 | #include <__ranges/size.h> |
| 32 | 33 | #include <__ranges/view_interface.h> |
| 34 | #include <__type_traits/maybe_const.h> | |
| 33 | 35 | #include <__utility/forward.h> |
| 34 | 36 | #include <__utility/in_place.h> |
| 35 | 37 | #include <__utility/move.h> |
| ... | ... | @@ -41,7 +43,7 @@ |
| 41 | 43 | |
| 42 | 44 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 43 | 45 | |
| 44 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 46 | #if _LIBCPP_STD_VER > 17 | |
| 45 | 47 | |
| 46 | 48 | namespace ranges { |
| 47 | 49 | |
| ... | ... | @@ -55,11 +57,31 @@ concept __transform_view_constraints = |
| 55 | 57 | regular_invocable<_Fn&, range_reference_t<_View>> && |
| 56 | 58 | __can_reference<invoke_result_t<_Fn&, range_reference_t<_View>>>; |
| 57 | 59 | |
| 60 | template <input_range _View, copy_constructible _Function, bool _IsConst> | |
| 61 | requires __transform_view_constraints<_View, _Function> | |
| 62 | class __transform_view_iterator; | |
| 63 | ||
| 64 | template <input_range _View, copy_constructible _Function, bool _IsConst> | |
| 65 | requires __transform_view_constraints<_View, _Function> | |
| 66 | class __transform_view_sentinel; | |
| 67 | ||
| 58 | 68 | template<input_range _View, copy_constructible _Fn> |
| 59 | 69 | requires __transform_view_constraints<_View, _Fn> |
| 60 | 70 | class transform_view : public view_interface<transform_view<_View, _Fn>> { |
| 61 | template<bool> class __iterator; | |
| 62 | template<bool> class __sentinel; | |
| 71 | ||
| 72 | template <bool _IsConst> | |
| 73 | using __iterator = __transform_view_iterator<_View, _Fn, _IsConst>; | |
| 74 | ||
| 75 | template <bool _IsConst> | |
| 76 | using __sentinel = __transform_view_sentinel<_View, _Fn, _IsConst>; | |
| 77 | ||
| 78 | template <input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> | |
| 79 | requires __transform_view_constraints<_ViewType, _FunctionType> | |
| 80 | friend class __transform_view_iterator; | |
| 81 | ||
| 82 | template <input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> | |
| 83 | requires __transform_view_constraints<_ViewType, _FunctionType> | |
| 84 | friend class __transform_view_sentinel; | |
| 63 | 85 | |
| 64 | 86 | _LIBCPP_NO_UNIQUE_ADDRESS __copyable_box<_Fn> __func_; |
| 65 | 87 | _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); |
| ... | ... | @@ -154,22 +176,23 @@ struct __transform_view_iterator_category_base<_View, _Fn> { |
| 154 | 176 | >; |
| 155 | 177 | }; |
| 156 | 178 | |
| 157 | template<input_range _View, copy_constructible _Fn> | |
| 179 | template<input_range _View, copy_constructible _Fn, bool _Const> | |
| 158 | 180 | requires __transform_view_constraints<_View, _Fn> |
| 159 | template<bool _Const> | |
| 160 | class transform_view<_View, _Fn>::__iterator | |
| 181 | class __transform_view_iterator | |
| 161 | 182 | : public __transform_view_iterator_category_base<_View, _Fn> { |
| 162 | 183 | |
| 163 | using _Parent = __maybe_const<_Const, transform_view>; | |
| 184 | using _Parent = __maybe_const<_Const, transform_view<_View, _Fn>>; | |
| 164 | 185 | using _Base = __maybe_const<_Const, _View>; |
| 165 | 186 | |
| 166 | 187 | _Parent *__parent_ = nullptr; |
| 167 | 188 | |
| 168 | template<bool> | |
| 169 | friend class transform_view<_View, _Fn>::__iterator; | |
| 189 | template<input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> | |
| 190 | requires __transform_view_constraints<_ViewType, _FunctionType> | |
| 191 | friend class __transform_view_iterator; | |
| 170 | 192 | |
| 171 | template<bool> | |
| 172 | friend class transform_view<_View, _Fn>::__sentinel; | |
| 193 | template<input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> | |
| 194 | requires __transform_view_constraints<_ViewType, _FunctionType> | |
| 195 | friend class __transform_view_sentinel; | |
| 173 | 196 | |
| 174 | 197 | public: |
| 175 | 198 | iterator_t<_Base> __current_ = iterator_t<_Base>(); |
| ... | ... | @@ -179,17 +202,17 @@ public: |
| 179 | 202 | using difference_type = range_difference_t<_Base>; |
| 180 | 203 | |
| 181 | 204 | _LIBCPP_HIDE_FROM_ABI |
| 182 | __iterator() requires default_initializable<iterator_t<_Base>> = default; | |
| 205 | __transform_view_iterator() requires default_initializable<iterator_t<_Base>> = default; | |
| 183 | 206 | |
| 184 | 207 | _LIBCPP_HIDE_FROM_ABI |
| 185 | constexpr __iterator(_Parent& __parent, iterator_t<_Base> __current) | |
| 208 | constexpr __transform_view_iterator(_Parent& __parent, iterator_t<_Base> __current) | |
| 186 | 209 | : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {} |
| 187 | 210 | |
| 188 | // Note: `__i` should always be `__iterator<false>`, but directly using | |
| 189 | // `__iterator<false>` is ill-formed when `_Const` is false | |
| 211 | // Note: `__i` should always be `__transform_view_iterator<false>`, but directly using | |
| 212 | // `__transform_view_iterator<false>` is ill-formed when `_Const` is false | |
| 190 | 213 | // (see http://wg21.link/class.copy.ctor#5). |
| 191 | 214 | _LIBCPP_HIDE_FROM_ABI |
| 192 | constexpr __iterator(__iterator<!_Const> __i) | |
| 215 | constexpr __transform_view_iterator(__transform_view_iterator<_View, _Fn, !_Const> __i) | |
| 193 | 216 | requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> |
| 194 | 217 | : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {} |
| 195 | 218 | |
| ... | ... | @@ -211,7 +234,7 @@ public: |
| 211 | 234 | } |
| 212 | 235 | |
| 213 | 236 | _LIBCPP_HIDE_FROM_ABI |
| 214 | constexpr __iterator& operator++() { | |
| 237 | constexpr __transform_view_iterator& operator++() { | |
| 215 | 238 | ++__current_; |
| 216 | 239 | return *this; |
| 217 | 240 | } |
| ... | ... | @@ -220,7 +243,7 @@ public: |
| 220 | 243 | constexpr void operator++(int) { ++__current_; } |
| 221 | 244 | |
| 222 | 245 | _LIBCPP_HIDE_FROM_ABI |
| 223 | constexpr __iterator operator++(int) | |
| 246 | constexpr __transform_view_iterator operator++(int) | |
| 224 | 247 | requires forward_range<_Base> |
| 225 | 248 | { |
| 226 | 249 | auto __tmp = *this; |
| ... | ... | @@ -229,7 +252,7 @@ public: |
| 229 | 252 | } |
| 230 | 253 | |
| 231 | 254 | _LIBCPP_HIDE_FROM_ABI |
| 232 | constexpr __iterator& operator--() | |
| 255 | constexpr __transform_view_iterator& operator--() | |
| 233 | 256 | requires bidirectional_range<_Base> |
| 234 | 257 | { |
| 235 | 258 | --__current_; |
| ... | ... | @@ -237,7 +260,7 @@ public: |
| 237 | 260 | } |
| 238 | 261 | |
| 239 | 262 | _LIBCPP_HIDE_FROM_ABI |
| 240 | constexpr __iterator operator--(int) | |
| 263 | constexpr __transform_view_iterator operator--(int) | |
| 241 | 264 | requires bidirectional_range<_Base> |
| 242 | 265 | { |
| 243 | 266 | auto __tmp = *this; |
| ... | ... | @@ -246,7 +269,7 @@ public: |
| 246 | 269 | } |
| 247 | 270 | |
| 248 | 271 | _LIBCPP_HIDE_FROM_ABI |
| 249 | constexpr __iterator& operator+=(difference_type __n) | |
| 272 | constexpr __transform_view_iterator& operator+=(difference_type __n) | |
| 250 | 273 | requires random_access_range<_Base> |
| 251 | 274 | { |
| 252 | 275 | __current_ += __n; |
| ... | ... | @@ -254,7 +277,7 @@ public: |
| 254 | 277 | } |
| 255 | 278 | |
| 256 | 279 | _LIBCPP_HIDE_FROM_ABI |
| 257 | constexpr __iterator& operator-=(difference_type __n) | |
| 280 | constexpr __transform_view_iterator& operator-=(difference_type __n) | |
| 258 | 281 | requires random_access_range<_Base> |
| 259 | 282 | { |
| 260 | 283 | __current_ -= __n; |
| ... | ... | @@ -270,77 +293,77 @@ public: |
| 270 | 293 | } |
| 271 | 294 | |
| 272 | 295 | _LIBCPP_HIDE_FROM_ABI |
| 273 | friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) | |
| 296 | friend constexpr bool operator==(const __transform_view_iterator& __x, const __transform_view_iterator& __y) | |
| 274 | 297 | requires equality_comparable<iterator_t<_Base>> |
| 275 | 298 | { |
| 276 | 299 | return __x.__current_ == __y.__current_; |
| 277 | 300 | } |
| 278 | 301 | |
| 279 | 302 | _LIBCPP_HIDE_FROM_ABI |
| 280 | friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) | |
| 303 | friend constexpr bool operator<(const __transform_view_iterator& __x, const __transform_view_iterator& __y) | |
| 281 | 304 | requires random_access_range<_Base> |
| 282 | 305 | { |
| 283 | 306 | return __x.__current_ < __y.__current_; |
| 284 | 307 | } |
| 285 | 308 | |
| 286 | 309 | _LIBCPP_HIDE_FROM_ABI |
| 287 | friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) | |
| 310 | friend constexpr bool operator>(const __transform_view_iterator& __x, const __transform_view_iterator& __y) | |
| 288 | 311 | requires random_access_range<_Base> |
| 289 | 312 | { |
| 290 | 313 | return __x.__current_ > __y.__current_; |
| 291 | 314 | } |
| 292 | 315 | |
| 293 | 316 | _LIBCPP_HIDE_FROM_ABI |
| 294 | friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) | |
| 317 | friend constexpr bool operator<=(const __transform_view_iterator& __x, const __transform_view_iterator& __y) | |
| 295 | 318 | requires random_access_range<_Base> |
| 296 | 319 | { |
| 297 | 320 | return __x.__current_ <= __y.__current_; |
| 298 | 321 | } |
| 299 | 322 | |
| 300 | 323 | _LIBCPP_HIDE_FROM_ABI |
| 301 | friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) | |
| 324 | friend constexpr bool operator>=(const __transform_view_iterator& __x, const __transform_view_iterator& __y) | |
| 302 | 325 | requires random_access_range<_Base> |
| 303 | 326 | { |
| 304 | 327 | return __x.__current_ >= __y.__current_; |
| 305 | 328 | } |
| 306 | 329 | |
| 307 | 330 | _LIBCPP_HIDE_FROM_ABI |
| 308 | friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) | |
| 331 | friend constexpr auto operator<=>(const __transform_view_iterator& __x, const __transform_view_iterator& __y) | |
| 309 | 332 | requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>> |
| 310 | 333 | { |
| 311 | 334 | return __x.__current_ <=> __y.__current_; |
| 312 | 335 | } |
| 313 | 336 | |
| 314 | 337 | _LIBCPP_HIDE_FROM_ABI |
| 315 | friend constexpr __iterator operator+(__iterator __i, difference_type __n) | |
| 338 | friend constexpr __transform_view_iterator operator+(__transform_view_iterator __i, difference_type __n) | |
| 316 | 339 | requires random_access_range<_Base> |
| 317 | 340 | { |
| 318 | return __iterator{*__i.__parent_, __i.__current_ + __n}; | |
| 341 | return __transform_view_iterator{*__i.__parent_, __i.__current_ + __n}; | |
| 319 | 342 | } |
| 320 | 343 | |
| 321 | 344 | _LIBCPP_HIDE_FROM_ABI |
| 322 | friend constexpr __iterator operator+(difference_type __n, __iterator __i) | |
| 345 | friend constexpr __transform_view_iterator operator+(difference_type __n, __transform_view_iterator __i) | |
| 323 | 346 | requires random_access_range<_Base> |
| 324 | 347 | { |
| 325 | return __iterator{*__i.__parent_, __i.__current_ + __n}; | |
| 348 | return __transform_view_iterator{*__i.__parent_, __i.__current_ + __n}; | |
| 326 | 349 | } |
| 327 | 350 | |
| 328 | 351 | _LIBCPP_HIDE_FROM_ABI |
| 329 | friend constexpr __iterator operator-(__iterator __i, difference_type __n) | |
| 352 | friend constexpr __transform_view_iterator operator-(__transform_view_iterator __i, difference_type __n) | |
| 330 | 353 | requires random_access_range<_Base> |
| 331 | 354 | { |
| 332 | return __iterator{*__i.__parent_, __i.__current_ - __n}; | |
| 355 | return __transform_view_iterator{*__i.__parent_, __i.__current_ - __n}; | |
| 333 | 356 | } |
| 334 | 357 | |
| 335 | 358 | _LIBCPP_HIDE_FROM_ABI |
| 336 | friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) | |
| 359 | friend constexpr difference_type operator-(const __transform_view_iterator& __x, const __transform_view_iterator& __y) | |
| 337 | 360 | requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> |
| 338 | 361 | { |
| 339 | 362 | return __x.__current_ - __y.__current_; |
| 340 | 363 | } |
| 341 | 364 | |
| 342 | 365 | _LIBCPP_HIDE_FROM_ABI |
| 343 | friend constexpr decltype(auto) iter_move(const __iterator& __i) | |
| 366 | friend constexpr decltype(auto) iter_move(const __transform_view_iterator& __i) | |
| 344 | 367 | noexcept(noexcept(*__i)) |
| 345 | 368 | { |
| 346 | 369 | if constexpr (is_lvalue_reference_v<decltype(*__i)>) |
| ... | ... | @@ -350,33 +373,37 @@ public: |
| 350 | 373 | } |
| 351 | 374 | }; |
| 352 | 375 | |
| 353 | template<input_range _View, copy_constructible _Fn> | |
| 376 | template<input_range _View, copy_constructible _Fn, bool _Const> | |
| 354 | 377 | requires __transform_view_constraints<_View, _Fn> |
| 355 | template<bool _Const> | |
| 356 | class transform_view<_View, _Fn>::__sentinel { | |
| 357 | using _Parent = __maybe_const<_Const, transform_view>; | |
| 378 | class __transform_view_sentinel { | |
| 379 | using _Parent = __maybe_const<_Const, transform_view<_View, _Fn>>; | |
| 358 | 380 | using _Base = __maybe_const<_Const, _View>; |
| 359 | 381 | |
| 382 | template <bool _IsConst> | |
| 383 | using __iterator = __transform_view_iterator<_View, _Fn, _IsConst>; | |
| 384 | ||
| 360 | 385 | sentinel_t<_Base> __end_ = sentinel_t<_Base>(); |
| 361 | 386 | |
| 362 | template<bool> | |
| 363 | friend class transform_view<_View, _Fn>::__iterator; | |
| 387 | template<input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> | |
| 388 | requires __transform_view_constraints<_ViewType, _FunctionType> | |
| 389 | friend class __transform_view_iterator; | |
| 364 | 390 | |
| 365 | template<bool> | |
| 366 | friend class transform_view<_View, _Fn>::__sentinel; | |
| 391 | template<input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> | |
| 392 | requires __transform_view_constraints<_ViewType, _FunctionType> | |
| 393 | friend class __transform_view_sentinel; | |
| 367 | 394 | |
| 368 | 395 | public: |
| 369 | 396 | _LIBCPP_HIDE_FROM_ABI |
| 370 | __sentinel() = default; | |
| 397 | __transform_view_sentinel() = default; | |
| 371 | 398 | |
| 372 | 399 | _LIBCPP_HIDE_FROM_ABI |
| 373 | constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(__end) {} | |
| 400 | constexpr explicit __transform_view_sentinel(sentinel_t<_Base> __end) : __end_(__end) {} | |
| 374 | 401 | |
| 375 | // Note: `__i` should always be `__sentinel<false>`, but directly using | |
| 376 | // `__sentinel<false>` is ill-formed when `_Const` is false | |
| 402 | // Note: `__i` should always be `__transform_view_sentinel<false>`, but directly using | |
| 403 | // `__transform_view_sentinel<false>` is ill-formed when `_Const` is false | |
| 377 | 404 | // (see http://wg21.link/class.copy.ctor#5). |
| 378 | 405 | _LIBCPP_HIDE_FROM_ABI |
| 379 | constexpr __sentinel(__sentinel<!_Const> __i) | |
| 406 | constexpr __transform_view_sentinel(__transform_view_sentinel<_View, _Fn, !_Const> __i) | |
| 380 | 407 | requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> |
| 381 | 408 | : __end_(std::move(__i.__end_)) {} |
| 382 | 409 | |
| ... | ... | @@ -386,7 +413,7 @@ public: |
| 386 | 413 | template<bool _OtherConst> |
| 387 | 414 | requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| 388 | 415 | _LIBCPP_HIDE_FROM_ABI |
| 389 | friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | |
| 416 | friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __transform_view_sentinel& __y) { | |
| 390 | 417 | return __x.__current_ == __y.__end_; |
| 391 | 418 | } |
| 392 | 419 | |
| ... | ... | @@ -394,7 +421,7 @@ public: |
| 394 | 421 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| 395 | 422 | _LIBCPP_HIDE_FROM_ABI |
| 396 | 423 | friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> |
| 397 | operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { | |
| 424 | operator-(const __iterator<_OtherConst>& __x, const __transform_view_sentinel& __y) { | |
| 398 | 425 | return __x.__current_ - __y.__end_; |
| 399 | 426 | } |
| 400 | 427 | |
| ... | ... | @@ -402,7 +429,7 @@ public: |
| 402 | 429 | requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> |
| 403 | 430 | _LIBCPP_HIDE_FROM_ABI |
| 404 | 431 | friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> |
| 405 | operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { | |
| 432 | operator-(const __transform_view_sentinel& __x, const __iterator<_OtherConst>& __y) { | |
| 406 | 433 | return __x.__end_ - __y.__current_; |
| 407 | 434 | } |
| 408 | 435 | }; |
| ... | ... | @@ -433,7 +460,7 @@ inline namespace __cpo { |
| 433 | 460 | |
| 434 | 461 | } // namespace ranges |
| 435 | 462 | |
| 436 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 463 | #endif // _LIBCPP_STD_VER > 17 | |
| 437 | 464 | |
| 438 | 465 | _LIBCPP_END_NAMESPACE_STD |
| 439 | 466 |
lib/libcxx/include/__ranges/view_interface.h+8-5| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_VIEW_INTERFACE_H |
| 10 | 11 | #define _LIBCPP___RANGES_VIEW_INTERFACE_H |
| 11 | 12 | |
| ... | ... | @@ -20,7 +21,9 @@ |
| 20 | 21 | #include <__ranges/access.h> |
| 21 | 22 | #include <__ranges/concepts.h> |
| 22 | 23 | #include <__ranges/empty.h> |
| 23 | #include <type_traits> | |
| 24 | #include <__type_traits/is_class.h> | |
| 25 | #include <__type_traits/make_unsigned.h> | |
| 26 | #include <__type_traits/remove_cv.h> | |
| 24 | 27 | |
| 25 | 28 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 26 | 29 | # pragma GCC system_header |
| ... | ... | @@ -28,7 +31,7 @@ |
| 28 | 31 | |
| 29 | 32 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 30 | 33 | |
| 31 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 34 | #if _LIBCPP_STD_VER > 17 | |
| 32 | 35 | |
| 33 | 36 | namespace ranges { |
| 34 | 37 | |
| ... | ... | @@ -99,7 +102,7 @@ public: |
| 99 | 102 | constexpr auto size() |
| 100 | 103 | requires forward_range<_D2> && sized_sentinel_for<sentinel_t<_D2>, iterator_t<_D2>> |
| 101 | 104 | { |
| 102 | return ranges::end(__derived()) - ranges::begin(__derived()); | |
| 105 | return std::__to_unsigned_like(ranges::end(__derived()) - ranges::begin(__derived())); | |
| 103 | 106 | } |
| 104 | 107 | |
| 105 | 108 | template<class _D2 = _Derived> |
| ... | ... | @@ -107,7 +110,7 @@ public: |
| 107 | 110 | constexpr auto size() const |
| 108 | 111 | requires forward_range<const _D2> && sized_sentinel_for<sentinel_t<const _D2>, iterator_t<const _D2>> |
| 109 | 112 | { |
| 110 | return ranges::end(__derived()) - ranges::begin(__derived()); | |
| 113 | return std::__to_unsigned_like(ranges::end(__derived()) - ranges::begin(__derived())); | |
| 111 | 114 | } |
| 112 | 115 | |
| 113 | 116 | template<class _D2 = _Derived> |
| ... | ... | @@ -167,7 +170,7 @@ public: |
| 167 | 170 | |
| 168 | 171 | } // namespace ranges |
| 169 | 172 | |
| 170 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 173 | #endif // _LIBCPP_STD_VER > 17 | |
| 171 | 174 | |
| 172 | 175 | _LIBCPP_END_NAMESPACE_STD |
| 173 | 176 |
lib/libcxx/include/__ranges/views.h+2-2| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 21 | #if _LIBCPP_STD_VER > 17 | |
| 22 | 22 | |
| 23 | 23 | namespace ranges { |
| 24 | 24 | |
| ... | ... | @@ -28,7 +28,7 @@ namespace views { } |
| 28 | 28 | |
| 29 | 29 | namespace views = ranges::views; |
| 30 | 30 | |
| 31 | #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 31 | #endif // _LIBCPP_STD_VER > 17 | |
| 32 | 32 | |
| 33 | 33 | _LIBCPP_END_NAMESPACE_STD |
| 34 | 34 |
lib/libcxx/include/__ranges/zip_view.h+6-5| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___RANGES_ZIP_VIEW_H |
| 10 | 11 | #define _LIBCPP___RANGES_ZIP_VIEW_H |
| 11 | 12 | |
| ... | ... | @@ -44,7 +45,7 @@ _LIBCPP_PUSH_MACROS |
| 44 | 45 | |
| 45 | 46 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 46 | 47 | |
| 47 | #if _LIBCPP_STD_VER > 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 48 | #if _LIBCPP_STD_VER > 20 | |
| 48 | 49 | |
| 49 | 50 | namespace ranges { |
| 50 | 51 | |
| ... | ... | @@ -402,15 +403,15 @@ public: |
| 402 | 403 | |
| 403 | 404 | _LIBCPP_HIDE_FROM_ABI |
| 404 | 405 | friend constexpr auto iter_move(const __iterator& __i) noexcept( |
| 405 | (noexcept(ranges::iter_move(declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) && ...) && | |
| 406 | (noexcept(ranges::iter_move(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) && ...) && | |
| 406 | 407 | (is_nothrow_move_constructible_v<range_rvalue_reference_t<__maybe_const<_Const, _Views>>> && ...)) { |
| 407 | 408 | return ranges::__tuple_transform(ranges::iter_move, __i.__current_); |
| 408 | 409 | } |
| 409 | 410 | |
| 410 | 411 | _LIBCPP_HIDE_FROM_ABI |
| 411 | 412 | friend constexpr void iter_swap(const __iterator& __l, const __iterator& __r) noexcept( |
| 412 | (noexcept(ranges::iter_swap(declval<const iterator_t<__maybe_const<_Const, _Views>>&>(), | |
| 413 | declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) && | |
| 413 | (noexcept(ranges::iter_swap(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>(), | |
| 414 | std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) && | |
| 414 | 415 | ...)) |
| 415 | 416 | requires(indirectly_swappable<iterator_t<__maybe_const<_Const, _Views>>> && ...) { |
| 416 | 417 | ranges::__tuple_zip_for_each(ranges::iter_swap, __l.__current_, __r.__current_); |
| ... | ... | @@ -502,7 +503,7 @@ inline namespace __cpo { |
| 502 | 503 | } // namespace views |
| 503 | 504 | } // namespace ranges |
| 504 | 505 | |
| 505 | #endif // _LIBCPP_STD_VER > 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 506 | #endif // _LIBCPP_STD_VER > 20 | |
| 506 | 507 | |
| 507 | 508 | _LIBCPP_END_NAMESPACE_STD |
| 508 | 509 |
lib/libcxx/include/__split_buffer+99-92| ... | ... | @@ -17,11 +17,14 @@ |
| 17 | 17 | #include <__iterator/distance.h> |
| 18 | 18 | #include <__iterator/iterator_traits.h> |
| 19 | 19 | #include <__iterator/move_iterator.h> |
| 20 | #include <__memory/allocate_at_least.h> | |
| 20 | 21 | #include <__memory/allocator.h> |
| 22 | #include <__memory/allocator_traits.h> | |
| 21 | 23 | #include <__memory/compressed_pair.h> |
| 24 | #include <__memory/pointer_traits.h> | |
| 22 | 25 | #include <__memory/swap_allocator.h> |
| 23 | 26 | #include <__utility/forward.h> |
| 24 | #include <memory> | |
| 27 | #include <__utility/move.h> | |
| 25 | 28 | #include <type_traits> |
| 26 | 29 | |
| 27 | 30 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -34,6 +37,10 @@ _LIBCPP_PUSH_MACROS |
| 34 | 37 | |
| 35 | 38 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 36 | 39 | |
| 40 | // __split_buffer allocates a contiguous chunk of memory and stores objects in the range [__begin_, __end_). | |
| 41 | // It has uninitialized memory in the ranges [__first_, __begin_) and [__end_, __end_cap_.first()). That allows | |
| 42 | // it to grow both in the front and back without having to move the data. | |
| 43 | ||
| 37 | 44 | template <class _Tp, class _Allocator = allocator<_Tp> > |
| 38 | 45 | struct __split_buffer |
| 39 | 46 | { |
| ... | ... | @@ -43,7 +50,7 @@ private: |
| 43 | 50 | public: |
| 44 | 51 | typedef _Tp value_type; |
| 45 | 52 | typedef _Allocator allocator_type; |
| 46 | typedef typename remove_reference<allocator_type>::type __alloc_rr; | |
| 53 | typedef __libcpp_remove_reference_t<allocator_type> __alloc_rr; | |
| 47 | 54 | typedef allocator_traits<__alloc_rr> __alloc_traits; |
| 48 | 55 | typedef value_type& reference; |
| 49 | 56 | typedef const value_type& const_reference; |
| ... | ... | @@ -59,110 +66,110 @@ public: |
| 59 | 66 | pointer __end_; |
| 60 | 67 | __compressed_pair<pointer, allocator_type> __end_cap_; |
| 61 | 68 | |
| 62 | typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref; | |
| 63 | typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref; | |
| 69 | typedef __add_lvalue_reference_t<allocator_type> __alloc_ref; | |
| 70 | typedef __add_lvalue_reference_t<allocator_type> __alloc_const_ref; | |
| 64 | 71 | |
| 65 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();} | |
| 66 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();} | |
| 67 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();} | |
| 68 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();} | |
| 72 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();} | |
| 73 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();} | |
| 74 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();} | |
| 75 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();} | |
| 69 | 76 | |
| 70 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 77 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 71 | 78 | __split_buffer() |
| 72 | 79 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value); |
| 73 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 80 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 74 | 81 | explicit __split_buffer(__alloc_rr& __a); |
| 75 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 82 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 76 | 83 | explicit __split_buffer(const __alloc_rr& __a); |
| 77 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); | |
| 78 | _LIBCPP_CONSTEXPR_AFTER_CXX17 ~__split_buffer(); | |
| 84 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); | |
| 85 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~__split_buffer(); | |
| 79 | 86 | |
| 80 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer(__split_buffer&& __c) | |
| 87 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(__split_buffer&& __c) | |
| 81 | 88 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); |
| 82 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); | |
| 83 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer& operator=(__split_buffer&& __c) | |
| 89 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); | |
| 90 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer& operator=(__split_buffer&& __c) | |
| 84 | 91 | _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value && |
| 85 | 92 | is_nothrow_move_assignable<allocator_type>::value) || |
| 86 | 93 | !__alloc_traits::propagate_on_container_move_assignment::value); |
| 87 | 94 | |
| 88 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;} | |
| 89 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;} | |
| 90 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;} | |
| 91 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;} | |
| 95 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {return __begin_;} | |
| 96 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {return __begin_;} | |
| 97 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {return __end_;} | |
| 98 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {return __end_;} | |
| 92 | 99 | |
| 93 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 100 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 94 | 101 | void clear() _NOEXCEPT |
| 95 | 102 | {__destruct_at_end(__begin_);} |
| 96 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);} | |
| 97 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;} | |
| 98 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);} | |
| 99 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type __front_spare() const {return static_cast<size_type>(__begin_ - __first_);} | |
| 100 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type __back_spare() const {return static_cast<size_type>(__end_cap() - __end_);} | |
| 101 | ||
| 102 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reference front() {return *__begin_;} | |
| 103 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reference front() const {return *__begin_;} | |
| 104 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reference back() {return *(__end_ - 1);} | |
| 105 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);} | |
| 106 | ||
| 107 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void reserve(size_type __n); | |
| 108 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void shrink_to_fit() _NOEXCEPT; | |
| 109 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void push_front(const_reference __x); | |
| 110 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); | |
| 111 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void push_front(value_type&& __x); | |
| 112 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void push_back(value_type&& __x); | |
| 103 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const {return static_cast<size_type>(__end_ - __begin_);} | |
| 104 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const {return __end_ == __begin_;} | |
| 105 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);} | |
| 106 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __front_spare() const {return static_cast<size_type>(__begin_ - __first_);} | |
| 107 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __back_spare() const {return static_cast<size_type>(__end_cap() - __end_);} | |
| 108 | ||
| 109 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() {return *__begin_;} | |
| 110 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const {return *__begin_;} | |
| 111 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() {return *(__end_ - 1);} | |
| 112 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const {return *(__end_ - 1);} | |
| 113 | ||
| 114 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n); | |
| 115 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT; | |
| 116 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_front(const_reference __x); | |
| 117 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(const_reference __x); | |
| 118 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __x); | |
| 119 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x); | |
| 113 | 120 | template <class... _Args> |
| 114 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void emplace_back(_Args&&... __args); | |
| 121 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args); | |
| 115 | 122 | |
| 116 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);} | |
| 117 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);} | |
| 123 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_front() {__destruct_at_begin(__begin_+1);} | |
| 124 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_back() {__destruct_at_end(__end_-1);} | |
| 118 | 125 | |
| 119 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct_at_end(size_type __n); | |
| 120 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct_at_end(size_type __n, const_reference __x); | |
| 126 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n); | |
| 127 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n, const_reference __x); | |
| 121 | 128 | template <class _InputIter> |
| 122 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIter>::value> | |
| 129 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIter>::value> | |
| 123 | 130 | __construct_at_end(_InputIter __first, _InputIter __last); |
| 124 | 131 | template <class _ForwardIterator> |
| 125 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value> | |
| 132 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value> | |
| 126 | 133 | __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); |
| 127 | 134 | |
| 128 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin) | |
| 135 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_begin(pointer __new_begin) | |
| 129 | 136 | {__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());} |
| 130 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 137 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 131 | 138 | void __destruct_at_begin(pointer __new_begin, false_type); |
| 132 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 139 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 133 | 140 | void __destruct_at_begin(pointer __new_begin, true_type); |
| 134 | 141 | |
| 135 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 142 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 136 | 143 | void __destruct_at_end(pointer __new_last) _NOEXCEPT |
| 137 | 144 | {__destruct_at_end(__new_last, false_type());} |
| 138 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 145 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 139 | 146 | void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT; |
| 140 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 147 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 141 | 148 | void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT; |
| 142 | 149 | |
| 143 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(__split_buffer& __x) | |
| 150 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(__split_buffer& __x) | |
| 144 | 151 | _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value|| |
| 145 | 152 | __is_nothrow_swappable<__alloc_rr>::value); |
| 146 | 153 | |
| 147 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __invariants() const; | |
| 154 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const; | |
| 148 | 155 | |
| 149 | 156 | private: |
| 150 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 157 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 151 | 158 | void __move_assign_alloc(__split_buffer& __c, true_type) |
| 152 | 159 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) |
| 153 | 160 | { |
| 154 | 161 | __alloc() = _VSTD::move(__c.__alloc()); |
| 155 | 162 | } |
| 156 | 163 | |
| 157 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 164 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 158 | 165 | void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT |
| 159 | 166 | {} |
| 160 | 167 | |
| 161 | 168 | struct _ConstructTransaction { |
| 162 | _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT | |
| 169 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT | |
| 163 | 170 | : __pos_(*__p), __end_(*__p + __n), __dest_(__p) { |
| 164 | 171 | } |
| 165 | _LIBCPP_CONSTEXPR_AFTER_CXX17 ~_ConstructTransaction() { | |
| 172 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { | |
| 166 | 173 | *__dest_ = __pos_; |
| 167 | 174 | } |
| 168 | 175 | pointer __pos_; |
| ... | ... | @@ -173,7 +180,7 @@ private: |
| 173 | 180 | }; |
| 174 | 181 | |
| 175 | 182 | template <class _Tp, class _Allocator> |
| 176 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 183 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 177 | 184 | bool |
| 178 | 185 | __split_buffer<_Tp, _Allocator>::__invariants() const |
| 179 | 186 | { |
| ... | ... | @@ -204,7 +211,7 @@ __split_buffer<_Tp, _Allocator>::__invariants() const |
| 204 | 211 | // Precondition: size() + __n <= capacity() |
| 205 | 212 | // Postcondition: size() == size() + __n |
| 206 | 213 | template <class _Tp, class _Allocator> |
| 207 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 214 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 208 | 215 | void |
| 209 | 216 | __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) |
| 210 | 217 | { |
| ... | ... | @@ -221,7 +228,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) |
| 221 | 228 | // Postcondition: size() == old size() + __n |
| 222 | 229 | // Postcondition: [i] == __x for all i in [size() - __n, __n) |
| 223 | 230 | template <class _Tp, class _Allocator> |
| 224 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 231 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 225 | 232 | void |
| 226 | 233 | __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) |
| 227 | 234 | { |
| ... | ... | @@ -234,7 +241,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_referen |
| 234 | 241 | |
| 235 | 242 | template <class _Tp, class _Allocator> |
| 236 | 243 | template <class _InputIter> |
| 237 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIter>::value> | |
| 244 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIter>::value> | |
| 238 | 245 | __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last) |
| 239 | 246 | { |
| 240 | 247 | __alloc_rr& __a = this->__alloc(); |
| ... | ... | @@ -257,7 +264,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIt |
| 257 | 264 | |
| 258 | 265 | template <class _Tp, class _Allocator> |
| 259 | 266 | template <class _ForwardIterator> |
| 260 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value> | |
| 267 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value> | |
| 261 | 268 | __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) |
| 262 | 269 | { |
| 263 | 270 | _ConstructTransaction __tx(&this->__end_, _VSTD::distance(__first, __last)); |
| ... | ... | @@ -268,7 +275,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F |
| 268 | 275 | } |
| 269 | 276 | |
| 270 | 277 | template <class _Tp, class _Allocator> |
| 271 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 278 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 272 | 279 | inline |
| 273 | 280 | void |
| 274 | 281 | __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) |
| ... | ... | @@ -278,7 +285,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_ |
| 278 | 285 | } |
| 279 | 286 | |
| 280 | 287 | template <class _Tp, class _Allocator> |
| 281 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 288 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 282 | 289 | inline |
| 283 | 290 | void |
| 284 | 291 | __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type) |
| ... | ... | @@ -287,8 +294,8 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_t |
| 287 | 294 | } |
| 288 | 295 | |
| 289 | 296 | template <class _Tp, class _Allocator> |
| 290 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 291 | inline _LIBCPP_INLINE_VISIBILITY | |
| 297 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 298 | inline _LIBCPP_HIDE_FROM_ABI | |
| 292 | 299 | void |
| 293 | 300 | __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT |
| 294 | 301 | { |
| ... | ... | @@ -297,8 +304,8 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_typ |
| 297 | 304 | } |
| 298 | 305 | |
| 299 | 306 | template <class _Tp, class _Allocator> |
| 300 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 301 | inline _LIBCPP_INLINE_VISIBILITY | |
| 307 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 308 | inline _LIBCPP_HIDE_FROM_ABI | |
| 302 | 309 | void |
| 303 | 310 | __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT |
| 304 | 311 | { |
| ... | ... | @@ -306,7 +313,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type |
| 306 | 313 | } |
| 307 | 314 | |
| 308 | 315 | template <class _Tp, class _Allocator> |
| 309 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 316 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 310 | 317 | __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a) |
| 311 | 318 | : __end_cap_(nullptr, __a) |
| 312 | 319 | { |
| ... | ... | @@ -322,7 +329,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta |
| 322 | 329 | } |
| 323 | 330 | |
| 324 | 331 | template <class _Tp, class _Allocator> |
| 325 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 332 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 326 | 333 | inline |
| 327 | 334 | __split_buffer<_Tp, _Allocator>::__split_buffer() |
| 328 | 335 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| ... | ... | @@ -331,7 +338,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer() |
| 331 | 338 | } |
| 332 | 339 | |
| 333 | 340 | template <class _Tp, class _Allocator> |
| 334 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 341 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 335 | 342 | inline |
| 336 | 343 | __split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a) |
| 337 | 344 | : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) |
| ... | ... | @@ -339,7 +346,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a) |
| 339 | 346 | } |
| 340 | 347 | |
| 341 | 348 | template <class _Tp, class _Allocator> |
| 342 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 349 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 343 | 350 | inline |
| 344 | 351 | __split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a) |
| 345 | 352 | : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) |
| ... | ... | @@ -347,7 +354,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a) |
| 347 | 354 | } |
| 348 | 355 | |
| 349 | 356 | template <class _Tp, class _Allocator> |
| 350 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 357 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 351 | 358 | __split_buffer<_Tp, _Allocator>::~__split_buffer() |
| 352 | 359 | { |
| 353 | 360 | clear(); |
| ... | ... | @@ -356,7 +363,7 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer() |
| 356 | 363 | } |
| 357 | 364 | |
| 358 | 365 | template <class _Tp, class _Allocator> |
| 359 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 366 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 360 | 367 | __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) |
| 361 | 368 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) |
| 362 | 369 | : __first_(_VSTD::move(__c.__first_)), |
| ... | ... | @@ -371,7 +378,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) |
| 371 | 378 | } |
| 372 | 379 | |
| 373 | 380 | template <class _Tp, class _Allocator> |
| 374 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 381 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 375 | 382 | __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a) |
| 376 | 383 | : __end_cap_(nullptr, __a) |
| 377 | 384 | { |
| ... | ... | @@ -398,7 +405,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al |
| 398 | 405 | } |
| 399 | 406 | |
| 400 | 407 | template <class _Tp, class _Allocator> |
| 401 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 408 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 402 | 409 | __split_buffer<_Tp, _Allocator>& |
| 403 | 410 | __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c) |
| 404 | 411 | _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value && |
| ... | ... | @@ -419,7 +426,7 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c) |
| 419 | 426 | } |
| 420 | 427 | |
| 421 | 428 | template <class _Tp, class _Allocator> |
| 422 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 429 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 423 | 430 | void |
| 424 | 431 | __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x) |
| 425 | 432 | _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value|| |
| ... | ... | @@ -433,7 +440,7 @@ __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x) |
| 433 | 440 | } |
| 434 | 441 | |
| 435 | 442 | template <class _Tp, class _Allocator> |
| 436 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 443 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 437 | 444 | void |
| 438 | 445 | __split_buffer<_Tp, _Allocator>::reserve(size_type __n) |
| 439 | 446 | { |
| ... | ... | @@ -450,7 +457,7 @@ __split_buffer<_Tp, _Allocator>::reserve(size_type __n) |
| 450 | 457 | } |
| 451 | 458 | |
| 452 | 459 | template <class _Tp, class _Allocator> |
| 453 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 460 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 454 | 461 | void |
| 455 | 462 | __split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT |
| 456 | 463 | { |
| ... | ... | @@ -478,7 +485,7 @@ __split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT |
| 478 | 485 | } |
| 479 | 486 | |
| 480 | 487 | template <class _Tp, class _Allocator> |
| 481 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 488 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 482 | 489 | void |
| 483 | 490 | __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) |
| 484 | 491 | { |
| ... | ... | @@ -493,7 +500,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) |
| 493 | 500 | } |
| 494 | 501 | else |
| 495 | 502 | { |
| 496 | size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); | |
| 503 | size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); | |
| 497 | 504 | __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); |
| 498 | 505 | __t.__construct_at_end(move_iterator<pointer>(__begin_), |
| 499 | 506 | move_iterator<pointer>(__end_)); |
| ... | ... | @@ -508,7 +515,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) |
| 508 | 515 | } |
| 509 | 516 | |
| 510 | 517 | template <class _Tp, class _Allocator> |
| 511 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 518 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 512 | 519 | void |
| 513 | 520 | __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) |
| 514 | 521 | { |
| ... | ... | @@ -523,7 +530,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) |
| 523 | 530 | } |
| 524 | 531 | else |
| 525 | 532 | { |
| 526 | size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); | |
| 533 | size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); | |
| 527 | 534 | __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); |
| 528 | 535 | __t.__construct_at_end(move_iterator<pointer>(__begin_), |
| 529 | 536 | move_iterator<pointer>(__end_)); |
| ... | ... | @@ -539,8 +546,8 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) |
| 539 | 546 | } |
| 540 | 547 | |
| 541 | 548 | template <class _Tp, class _Allocator> |
| 542 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 543 | inline _LIBCPP_INLINE_VISIBILITY | |
| 549 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 550 | inline _LIBCPP_HIDE_FROM_ABI | |
| 544 | 551 | void |
| 545 | 552 | __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) |
| 546 | 553 | { |
| ... | ... | @@ -555,7 +562,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) |
| 555 | 562 | } |
| 556 | 563 | else |
| 557 | 564 | { |
| 558 | size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); | |
| 565 | size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); | |
| 559 | 566 | __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); |
| 560 | 567 | __t.__construct_at_end(move_iterator<pointer>(__begin_), |
| 561 | 568 | move_iterator<pointer>(__end_)); |
| ... | ... | @@ -570,7 +577,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) |
| 570 | 577 | } |
| 571 | 578 | |
| 572 | 579 | template <class _Tp, class _Allocator> |
| 573 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 580 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 574 | 581 | void |
| 575 | 582 | __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) |
| 576 | 583 | { |
| ... | ... | @@ -585,7 +592,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) |
| 585 | 592 | } |
| 586 | 593 | else |
| 587 | 594 | { |
| 588 | size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); | |
| 595 | size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); | |
| 589 | 596 | __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); |
| 590 | 597 | __t.__construct_at_end(move_iterator<pointer>(__begin_), |
| 591 | 598 | move_iterator<pointer>(__end_)); |
| ... | ... | @@ -602,7 +609,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) |
| 602 | 609 | |
| 603 | 610 | template <class _Tp, class _Allocator> |
| 604 | 611 | template <class... _Args> |
| 605 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 612 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 606 | 613 | void |
| 607 | 614 | __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) |
| 608 | 615 | { |
| ... | ... | @@ -617,7 +624,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) |
| 617 | 624 | } |
| 618 | 625 | else |
| 619 | 626 | { |
| 620 | size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); | |
| 627 | size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); | |
| 621 | 628 | __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); |
| 622 | 629 | __t.__construct_at_end(move_iterator<pointer>(__begin_), |
| 623 | 630 | move_iterator<pointer>(__end_)); |
| ... | ... | @@ -633,8 +640,8 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) |
| 633 | 640 | } |
| 634 | 641 | |
| 635 | 642 | template <class _Tp, class _Allocator> |
| 636 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 637 | inline _LIBCPP_INLINE_VISIBILITY | |
| 643 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 644 | inline _LIBCPP_HIDE_FROM_ABI | |
| 638 | 645 | void |
| 639 | 646 | swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y) |
| 640 | 647 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) |
lib/libcxx/include/__string/char_traits.h+229-320| ... | ... | @@ -14,14 +14,16 @@ |
| 14 | 14 | #include <__algorithm/find_end.h> |
| 15 | 15 | #include <__algorithm/find_first_of.h> |
| 16 | 16 | #include <__algorithm/min.h> |
| 17 | #include <__compare/ordering.h> | |
| 17 | 18 | #include <__config> |
| 18 | 19 | #include <__functional/hash.h> |
| 19 | 20 | #include <__iterator/iterator_traits.h> |
| 21 | #include <__type_traits/is_constant_evaluated.h> | |
| 22 | #include <cstddef> | |
| 20 | 23 | #include <cstdint> |
| 21 | 24 | #include <cstdio> |
| 22 | 25 | #include <cstring> |
| 23 | 26 | #include <iosfwd> |
| 24 | #include <type_traits> | |
| 25 | 27 | |
| 26 | 28 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 27 | 29 | # include <cwchar> // for wmemcpy |
| ... | ... | @@ -37,35 +39,124 @@ _LIBCPP_PUSH_MACROS |
| 37 | 39 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 38 | 40 | |
| 39 | 41 | template <class _CharT> |
| 40 | struct _LIBCPP_TEMPLATE_VIS char_traits | |
| 42 | struct char_traits; | |
| 43 | /* | |
| 44 | The Standard does not define the base template for char_traits because it is impossible to provide | |
| 45 | a correct definition for arbitrary character types. Instead, it requires implementations to provide | |
| 46 | specializations for predefined character types like `char`, `wchar_t` and others. We provide this as | |
| 47 | exposition-only to document what members a char_traits specialization should provide: | |
| 48 | { | |
| 49 | using char_type = _CharT; | |
| 50 | using int_type = ...; | |
| 51 | using off_type = ...; | |
| 52 | using pos_type = ...; | |
| 53 | using state_type = ...; | |
| 54 | ||
| 55 | static void assign(char_type&, const char_type&); | |
| 56 | static bool eq(char_type, char_type); | |
| 57 | static bool lt(char_type, char_type); | |
| 58 | ||
| 59 | static int compare(const char_type*, const char_type*, size_t); | |
| 60 | static size_t length(const char_type*); | |
| 61 | static const char_type* find(const char_type*, size_t, const char_type&); | |
| 62 | static char_type* move(char_type*, const char_type*, size_t); | |
| 63 | static char_type* copy(char_type*, const char_type*, size_t); | |
| 64 | static char_type* assign(char_type*, size_t, char_type); | |
| 65 | ||
| 66 | static int_type not_eof(int_type); | |
| 67 | static char_type to_char_type(int_type); | |
| 68 | static int_type to_int_type(char_type); | |
| 69 | static bool eq_int_type(int_type, int_type); | |
| 70 | static int_type eof(); | |
| 71 | }; | |
| 72 | */ | |
| 73 | ||
| 74 | // | |
| 75 | // Temporary extension to provide a base template for std::char_traits. | |
| 76 | // TODO: Remove in LLVM 18. | |
| 77 | // | |
| 78 | template <class _CharT> | |
| 79 | struct _LIBCPP_DEPRECATED_("char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it.") | |
| 80 | char_traits | |
| 41 | 81 | { |
| 42 | typedef _CharT char_type; | |
| 43 | typedef int int_type; | |
| 44 | typedef streamoff off_type; | |
| 45 | typedef streampos pos_type; | |
| 46 | typedef mbstate_t state_type; | |
| 82 | using char_type = _CharT; | |
| 83 | using int_type = int; | |
| 84 | using off_type = streamoff; | |
| 85 | using pos_type = streampos; | |
| 86 | using state_type = mbstate_t; | |
| 47 | 87 | |
| 48 | static inline void _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 88 | static inline void _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 49 | 89 | assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} |
| 50 | 90 | static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT |
| 51 | 91 | {return __c1 == __c2;} |
| 52 | 92 | static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT |
| 53 | 93 | {return __c1 < __c2;} |
| 54 | 94 | |
| 55 | static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 56 | int compare(const char_type* __s1, const char_type* __s2, size_t __n); | |
| 57 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 58 | size_t length(const char_type* __s); | |
| 59 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 60 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a); | |
| 61 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 62 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n); | |
| 95 | static _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 96 | int compare(const char_type* __s1, const char_type* __s2, size_t __n) { | |
| 97 | for (; __n; --__n, ++__s1, ++__s2) | |
| 98 | { | |
| 99 | if (lt(*__s1, *__s2)) | |
| 100 | return -1; | |
| 101 | if (lt(*__s2, *__s1)) | |
| 102 | return 1; | |
| 103 | } | |
| 104 | return 0; | |
| 105 | } | |
| 106 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 107 | size_t length(const char_type* __s) { | |
| 108 | size_t __len = 0; | |
| 109 | for (; !eq(*__s, char_type(0)); ++__s) | |
| 110 | ++__len; | |
| 111 | return __len; | |
| 112 | } | |
| 113 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 114 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { | |
| 115 | for (; __n; --__n) | |
| 116 | { | |
| 117 | if (eq(*__s, __a)) | |
| 118 | return __s; | |
| 119 | ++__s; | |
| 120 | } | |
| 121 | return nullptr; | |
| 122 | } | |
| 123 | static _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 124 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n) { | |
| 125 | if (__n == 0) return __s1; | |
| 126 | char_type* __r = __s1; | |
| 127 | if (__s1 < __s2) | |
| 128 | { | |
| 129 | for (; __n; --__n, ++__s1, ++__s2) | |
| 130 | assign(*__s1, *__s2); | |
| 131 | } | |
| 132 | else if (__s2 < __s1) | |
| 133 | { | |
| 134 | __s1 += __n; | |
| 135 | __s2 += __n; | |
| 136 | for (; __n; --__n) | |
| 137 | assign(*--__s1, *--__s2); | |
| 138 | } | |
| 139 | return __r; | |
| 140 | } | |
| 63 | 141 | _LIBCPP_INLINE_VISIBILITY |
| 64 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 65 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); | |
| 142 | static _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 143 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) { | |
| 144 | if (!__libcpp_is_constant_evaluated()) { | |
| 145 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); | |
| 146 | } | |
| 147 | char_type* __r = __s1; | |
| 148 | for (; __n; --__n, ++__s1, ++__s2) | |
| 149 | assign(*__s1, *__s2); | |
| 150 | return __r; | |
| 151 | } | |
| 66 | 152 | _LIBCPP_INLINE_VISIBILITY |
| 67 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 68 | char_type* assign(char_type* __s, size_t __n, char_type __a); | |
| 153 | static _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 154 | char_type* assign(char_type* __s, size_t __n, char_type __a) { | |
| 155 | char_type* __r = __s; | |
| 156 | for (; __n; --__n, ++__s) | |
| 157 | assign(*__s, __a); | |
| 158 | return __r; | |
| 159 | } | |
| 69 | 160 | |
| 70 | 161 | static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT |
| 71 | 162 | {return eq_int_type(__c, eof()) ? ~eof() : __c;} |
| ... | ... | @@ -80,92 +171,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits |
| 80 | 171 | }; |
| 81 | 172 | |
| 82 | 173 | template <class _CharT> |
| 83 | _LIBCPP_CONSTEXPR_AFTER_CXX14 int | |
| 84 | char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n) | |
| 85 | { | |
| 86 | for (; __n; --__n, ++__s1, ++__s2) | |
| 87 | { | |
| 88 | if (lt(*__s1, *__s2)) | |
| 89 | return -1; | |
| 90 | if (lt(*__s2, *__s1)) | |
| 91 | return 1; | |
| 92 | } | |
| 93 | return 0; | |
| 94 | } | |
| 95 | ||
| 96 | template <class _CharT> | |
| 97 | inline | |
| 98 | _LIBCPP_CONSTEXPR_AFTER_CXX14 size_t | |
| 99 | char_traits<_CharT>::length(const char_type* __s) | |
| 100 | { | |
| 101 | size_t __len = 0; | |
| 102 | for (; !eq(*__s, char_type(0)); ++__s) | |
| 103 | ++__len; | |
| 104 | return __len; | |
| 105 | } | |
| 106 | ||
| 107 | template <class _CharT> | |
| 108 | inline | |
| 109 | _LIBCPP_CONSTEXPR_AFTER_CXX14 const _CharT* | |
| 110 | char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a) | |
| 111 | { | |
| 112 | for (; __n; --__n) | |
| 113 | { | |
| 114 | if (eq(*__s, __a)) | |
| 115 | return __s; | |
| 116 | ++__s; | |
| 117 | } | |
| 118 | return nullptr; | |
| 119 | } | |
| 120 | ||
| 121 | template <class _CharT> | |
| 122 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _CharT* | |
| 123 | char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n) | |
| 124 | { | |
| 125 | if (__n == 0) return __s1; | |
| 126 | char_type* __r = __s1; | |
| 127 | if (__s1 < __s2) | |
| 128 | { | |
| 129 | for (; __n; --__n, ++__s1, ++__s2) | |
| 130 | assign(*__s1, *__s2); | |
| 131 | } | |
| 132 | else if (__s2 < __s1) | |
| 133 | { | |
| 134 | __s1 += __n; | |
| 135 | __s2 += __n; | |
| 136 | for (; __n; --__n) | |
| 137 | assign(*--__s1, *--__s2); | |
| 138 | } | |
| 139 | return __r; | |
| 140 | } | |
| 141 | ||
| 142 | template <class _CharT> | |
| 143 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 144 | _CharT* | |
| 145 | char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n) | |
| 146 | { | |
| 147 | if (!__libcpp_is_constant_evaluated()) { | |
| 148 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); | |
| 149 | } | |
| 150 | char_type* __r = __s1; | |
| 151 | for (; __n; --__n, ++__s1, ++__s2) | |
| 152 | assign(*__s1, *__s2); | |
| 153 | return __r; | |
| 154 | } | |
| 155 | ||
| 156 | template <class _CharT> | |
| 157 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 158 | _CharT* | |
| 159 | char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) | |
| 160 | { | |
| 161 | char_type* __r = __s; | |
| 162 | for (; __n; --__n, ++__s) | |
| 163 | assign(*__s, __a); | |
| 164 | return __r; | |
| 165 | } | |
| 166 | ||
| 167 | template <class _CharT> | |
| 168 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 174 | _LIBCPP_HIDE_FROM_ABI static inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 169 | 175 | _CharT* __char_traits_move(_CharT* __dest, const _CharT* __source, size_t __n) _NOEXCEPT |
| 170 | 176 | { |
| 171 | 177 | #ifdef _LIBCPP_COMPILER_GCC |
| ... | ... | @@ -188,45 +194,45 @@ _CharT* __char_traits_move(_CharT* __dest, const _CharT* __source, size_t __n) _ |
| 188 | 194 | template <> |
| 189 | 195 | struct _LIBCPP_TEMPLATE_VIS char_traits<char> |
| 190 | 196 | { |
| 191 | typedef char char_type; | |
| 192 | typedef int int_type; | |
| 193 | typedef streamoff off_type; | |
| 194 | typedef streampos pos_type; | |
| 195 | typedef mbstate_t state_type; | |
| 197 | using char_type = char; | |
| 198 | using int_type = int; | |
| 199 | using off_type = streamoff; | |
| 200 | using pos_type = streampos; | |
| 201 | using state_type = mbstate_t; | |
| 202 | #if _LIBCPP_STD_VER > 17 | |
| 203 | using comparison_category = strong_ordering; | |
| 204 | #endif | |
| 196 | 205 | |
| 197 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 206 | static inline _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 198 | 207 | void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} |
| 199 | 208 | static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT |
| 200 | 209 | {return __c1 == __c2;} |
| 201 | 210 | static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT |
| 202 | 211 | {return (unsigned char)__c1 < (unsigned char)__c2;} |
| 203 | 212 | |
| 204 | static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 205 | int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; | |
| 213 | static _LIBCPP_CONSTEXPR_SINCE_CXX17 int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { | |
| 214 | if (__n == 0) | |
| 215 | return 0; | |
| 216 | return std::__constexpr_memcmp(__s1, __s2, __n); | |
| 217 | } | |
| 206 | 218 | |
| 207 | static inline size_t _LIBCPP_CONSTEXPR_AFTER_CXX14 length(const char_type* __s) _NOEXCEPT { | |
| 208 | // GCC currently does not support __builtin_strlen during constant evaluation. | |
| 209 | // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70816 | |
| 210 | #ifdef _LIBCPP_COMPILER_GCC | |
| 211 | if (__libcpp_is_constant_evaluated()) { | |
| 212 | size_t __i = 0; | |
| 213 | for (; __s[__i] != char_type('\0'); ++__i) | |
| 214 | ; | |
| 215 | return __i; | |
| 216 | } | |
| 217 | #endif | |
| 218 | return __builtin_strlen(__s); | |
| 219 | } | |
| 219 | static inline size_t _LIBCPP_CONSTEXPR_SINCE_CXX17 length(const char_type* __s) _NOEXCEPT { | |
| 220 | return std::__constexpr_strlen(__s); | |
| 221 | } | |
| 220 | 222 | |
| 221 | static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 222 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; | |
| 223 | static _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 224 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT { | |
| 225 | if (__n == 0) | |
| 226 | return nullptr; | |
| 227 | return std::__constexpr_char_memchr(__s, static_cast<int>(__a), __n); | |
| 228 | } | |
| 223 | 229 | |
| 224 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 230 | static inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 225 | 231 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { |
| 226 | 232 | return std::__char_traits_move(__s1, __s2, __n); |
| 227 | 233 | } |
| 228 | 234 | |
| 229 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 235 | static inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 230 | 236 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { |
| 231 | 237 | if (!__libcpp_is_constant_evaluated()) |
| 232 | 238 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); |
| ... | ... | @@ -234,7 +240,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char> |
| 234 | 240 | return __s1; |
| 235 | 241 | } |
| 236 | 242 | |
| 237 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 243 | static inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 238 | 244 | char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { |
| 239 | 245 | std::fill_n(__s, __n, __a); |
| 240 | 246 | return __s; |
| ... | ... | @@ -252,82 +258,51 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char> |
| 252 | 258 | {return int_type(EOF);} |
| 253 | 259 | }; |
| 254 | 260 | |
| 255 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 256 | int | |
| 257 | char_traits<char>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 258 | { | |
| 259 | if (__n == 0) | |
| 260 | return 0; | |
| 261 | #if __has_feature(cxx_constexpr_string_builtins) | |
| 262 | return __builtin_memcmp(__s1, __s2, __n); | |
| 263 | #elif _LIBCPP_STD_VER <= 14 | |
| 264 | return _VSTD::memcmp(__s1, __s2, __n); | |
| 265 | #else | |
| 266 | for (; __n; --__n, ++__s1, ++__s2) | |
| 267 | { | |
| 268 | if (lt(*__s1, *__s2)) | |
| 269 | return -1; | |
| 270 | if (lt(*__s2, *__s1)) | |
| 271 | return 1; | |
| 272 | } | |
| 273 | return 0; | |
| 274 | #endif | |
| 275 | } | |
| 276 | ||
| 277 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 278 | const char* | |
| 279 | char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT | |
| 280 | { | |
| 281 | if (__n == 0) | |
| 282 | return nullptr; | |
| 283 | #if __has_feature(cxx_constexpr_string_builtins) | |
| 284 | return __builtin_char_memchr(__s, to_int_type(__a), __n); | |
| 285 | #elif _LIBCPP_STD_VER <= 14 | |
| 286 | return (const char_type*) _VSTD::memchr(__s, to_int_type(__a), __n); | |
| 287 | #else | |
| 288 | for (; __n; --__n) | |
| 289 | { | |
| 290 | if (eq(*__s, __a)) | |
| 291 | return __s; | |
| 292 | ++__s; | |
| 293 | } | |
| 294 | return nullptr; | |
| 295 | #endif | |
| 296 | } | |
| 297 | ||
| 298 | ||
| 299 | 261 | // char_traits<wchar_t> |
| 300 | 262 | |
| 301 | 263 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 302 | 264 | template <> |
| 303 | 265 | struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> |
| 304 | 266 | { |
| 305 | typedef wchar_t char_type; | |
| 306 | typedef wint_t int_type; | |
| 307 | typedef streamoff off_type; | |
| 308 | typedef streampos pos_type; | |
| 309 | typedef mbstate_t state_type; | |
| 267 | using char_type = wchar_t; | |
| 268 | using int_type = wint_t; | |
| 269 | using off_type = streamoff; | |
| 270 | using pos_type = streampos; | |
| 271 | using state_type = mbstate_t; | |
| 272 | #if _LIBCPP_STD_VER > 17 | |
| 273 | using comparison_category = strong_ordering; | |
| 274 | #endif | |
| 310 | 275 | |
| 311 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 276 | static inline _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 312 | 277 | void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} |
| 313 | 278 | static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT |
| 314 | 279 | {return __c1 == __c2;} |
| 315 | 280 | static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT |
| 316 | 281 | {return __c1 < __c2;} |
| 317 | 282 | |
| 318 | static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 319 | int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; | |
| 320 | static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 321 | size_t length(const char_type* __s) _NOEXCEPT; | |
| 322 | static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 323 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; | |
| 283 | static _LIBCPP_CONSTEXPR_SINCE_CXX17 int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { | |
| 284 | if (__n == 0) | |
| 285 | return 0; | |
| 286 | return std::__constexpr_wmemcmp(__s1, __s2, __n); | |
| 287 | } | |
| 288 | ||
| 289 | static _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t length(const char_type* __s) _NOEXCEPT { | |
| 290 | return std::__constexpr_wcslen(__s); | |
| 291 | } | |
| 292 | ||
| 293 | static _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 294 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT { | |
| 295 | if (__n == 0) | |
| 296 | return nullptr; | |
| 297 | return std::__constexpr_wmemchr(__s, __a, __n); | |
| 298 | } | |
| 324 | 299 | |
| 325 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 300 | static inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 326 | 301 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { |
| 327 | 302 | return std::__char_traits_move(__s1, __s2, __n); |
| 328 | 303 | } |
| 329 | 304 | |
| 330 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 305 | static inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 331 | 306 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { |
| 332 | 307 | if (!__libcpp_is_constant_evaluated()) |
| 333 | 308 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); |
| ... | ... | @@ -335,7 +310,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> |
| 335 | 310 | return __s1; |
| 336 | 311 | } |
| 337 | 312 | |
| 338 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 313 | static inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 339 | 314 | char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { |
| 340 | 315 | std::fill_n(__s, __n, __a); |
| 341 | 316 | return __s; |
| ... | ... | @@ -352,65 +327,6 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> |
| 352 | 327 | static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT |
| 353 | 328 | {return int_type(WEOF);} |
| 354 | 329 | }; |
| 355 | ||
| 356 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 357 | int | |
| 358 | char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 359 | { | |
| 360 | if (__n == 0) | |
| 361 | return 0; | |
| 362 | #if __has_feature(cxx_constexpr_string_builtins) | |
| 363 | return __builtin_wmemcmp(__s1, __s2, __n); | |
| 364 | #elif _LIBCPP_STD_VER <= 14 | |
| 365 | return _VSTD::wmemcmp(__s1, __s2, __n); | |
| 366 | #else | |
| 367 | for (; __n; --__n, ++__s1, ++__s2) | |
| 368 | { | |
| 369 | if (lt(*__s1, *__s2)) | |
| 370 | return -1; | |
| 371 | if (lt(*__s2, *__s1)) | |
| 372 | return 1; | |
| 373 | } | |
| 374 | return 0; | |
| 375 | #endif | |
| 376 | } | |
| 377 | ||
| 378 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 379 | size_t | |
| 380 | char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT | |
| 381 | { | |
| 382 | #if __has_feature(cxx_constexpr_string_builtins) | |
| 383 | return __builtin_wcslen(__s); | |
| 384 | #elif _LIBCPP_STD_VER <= 14 | |
| 385 | return _VSTD::wcslen(__s); | |
| 386 | #else | |
| 387 | size_t __len = 0; | |
| 388 | for (; !eq(*__s, char_type(0)); ++__s) | |
| 389 | ++__len; | |
| 390 | return __len; | |
| 391 | #endif | |
| 392 | } | |
| 393 | ||
| 394 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 395 | const wchar_t* | |
| 396 | char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT | |
| 397 | { | |
| 398 | if (__n == 0) | |
| 399 | return nullptr; | |
| 400 | #if __has_feature(cxx_constexpr_string_builtins) | |
| 401 | return __builtin_wmemchr(__s, __a, __n); | |
| 402 | #elif _LIBCPP_STD_VER <= 14 | |
| 403 | return _VSTD::wmemchr(__s, __a, __n); | |
| 404 | #else | |
| 405 | for (; __n; --__n) | |
| 406 | { | |
| 407 | if (eq(*__s, __a)) | |
| 408 | return __s; | |
| 409 | ++__s; | |
| 410 | } | |
| 411 | return nullptr; | |
| 412 | #endif | |
| 413 | } | |
| 414 | 330 | #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 415 | 331 | |
| 416 | 332 | #ifndef _LIBCPP_HAS_NO_CHAR8_T |
| ... | ... | @@ -418,11 +334,14 @@ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __ |
| 418 | 334 | template <> |
| 419 | 335 | struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> |
| 420 | 336 | { |
| 421 | typedef char8_t char_type; | |
| 422 | typedef unsigned int int_type; | |
| 423 | typedef streamoff off_type; | |
| 424 | typedef u8streampos pos_type; | |
| 425 | typedef mbstate_t state_type; | |
| 337 | using char_type = char8_t; | |
| 338 | using int_type = unsigned int; | |
| 339 | using off_type = streamoff; | |
| 340 | using pos_type = u8streampos; | |
| 341 | using state_type = mbstate_t; | |
| 342 | #if _LIBCPP_STD_VER > 17 | |
| 343 | using comparison_category = strong_ordering; | |
| 344 | #endif | |
| 426 | 345 | |
| 427 | 346 | static inline constexpr void assign(char_type& __c1, const char_type& __c2) noexcept |
| 428 | 347 | {__c1 = __c2;} |
| ... | ... | @@ -431,8 +350,10 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> |
| 431 | 350 | static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept |
| 432 | 351 | {return __c1 < __c2;} |
| 433 | 352 | |
| 434 | static constexpr | |
| 435 | int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; | |
| 353 | static _LIBCPP_HIDE_FROM_ABI constexpr int | |
| 354 | compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { | |
| 355 | return std::__constexpr_memcmp(__s1, __s2, __n); | |
| 356 | } | |
| 436 | 357 | |
| 437 | 358 | static constexpr |
| 438 | 359 | size_t length(const char_type* __s) _NOEXCEPT; |
| ... | ... | @@ -440,12 +361,12 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> |
| 440 | 361 | _LIBCPP_INLINE_VISIBILITY static constexpr |
| 441 | 362 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; |
| 442 | 363 | |
| 443 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 364 | static _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 444 | 365 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { |
| 445 | 366 | return std::__char_traits_move(__s1, __s2, __n); |
| 446 | 367 | } |
| 447 | 368 | |
| 448 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 369 | static _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 449 | 370 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { |
| 450 | 371 | if (!__libcpp_is_constant_evaluated()) |
| 451 | 372 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); |
| ... | ... | @@ -453,7 +374,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> |
| 453 | 374 | return __s1; |
| 454 | 375 | } |
| 455 | 376 | |
| 456 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 377 | static _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 457 | 378 | char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { |
| 458 | 379 | std::fill_n(__s, __n, __a); |
| 459 | 380 | return __s; |
| ... | ... | @@ -482,24 +403,6 @@ char_traits<char8_t>::length(const char_type* __s) _NOEXCEPT |
| 482 | 403 | return __len; |
| 483 | 404 | } |
| 484 | 405 | |
| 485 | inline constexpr | |
| 486 | int | |
| 487 | char_traits<char8_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 488 | { | |
| 489 | #if __has_feature(cxx_constexpr_string_builtins) | |
| 490 | return __builtin_memcmp(__s1, __s2, __n); | |
| 491 | #else | |
| 492 | for (; __n; --__n, ++__s1, ++__s2) | |
| 493 | { | |
| 494 | if (lt(*__s1, *__s2)) | |
| 495 | return -1; | |
| 496 | if (lt(*__s2, *__s1)) | |
| 497 | return 1; | |
| 498 | } | |
| 499 | return 0; | |
| 500 | #endif | |
| 501 | } | |
| 502 | ||
| 503 | 406 | // TODO use '__builtin_char_memchr' if it ever supports char8_t ?? |
| 504 | 407 | inline constexpr |
| 505 | 408 | const char8_t* |
| ... | ... | @@ -519,32 +422,35 @@ char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __ |
| 519 | 422 | template <> |
| 520 | 423 | struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> |
| 521 | 424 | { |
| 522 | typedef char16_t char_type; | |
| 523 | typedef uint_least16_t int_type; | |
| 524 | typedef streamoff off_type; | |
| 525 | typedef u16streampos pos_type; | |
| 526 | typedef mbstate_t state_type; | |
| 425 | using char_type = char16_t; | |
| 426 | using int_type = uint_least16_t; | |
| 427 | using off_type = streamoff; | |
| 428 | using pos_type = u16streampos; | |
| 429 | using state_type = mbstate_t; | |
| 430 | #if _LIBCPP_STD_VER > 17 | |
| 431 | using comparison_category = strong_ordering; | |
| 432 | #endif | |
| 527 | 433 | |
| 528 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 434 | static inline _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 529 | 435 | void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} |
| 530 | 436 | static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT |
| 531 | 437 | {return __c1 == __c2;} |
| 532 | 438 | static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT |
| 533 | 439 | {return __c1 < __c2;} |
| 534 | 440 | |
| 535 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 441 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 536 | 442 | int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; |
| 537 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 443 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 538 | 444 | size_t length(const char_type* __s) _NOEXCEPT; |
| 539 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 445 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 540 | 446 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; |
| 541 | 447 | |
| 542 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 448 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 543 | 449 | static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { |
| 544 | 450 | return std::__char_traits_move(__s1, __s2, __n); |
| 545 | 451 | } |
| 546 | 452 | |
| 547 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 453 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 548 | 454 | static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { |
| 549 | 455 | if (!__libcpp_is_constant_evaluated()) |
| 550 | 456 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); |
| ... | ... | @@ -552,7 +458,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> |
| 552 | 458 | return __s1; |
| 553 | 459 | } |
| 554 | 460 | |
| 555 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 461 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 556 | 462 | static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { |
| 557 | 463 | std::fill_n(__s, __n, __a); |
| 558 | 464 | return __s; |
| ... | ... | @@ -570,7 +476,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> |
| 570 | 476 | {return int_type(0xFFFF);} |
| 571 | 477 | }; |
| 572 | 478 | |
| 573 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 479 | inline _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 574 | 480 | int |
| 575 | 481 | char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 576 | 482 | { |
| ... | ... | @@ -584,7 +490,7 @@ char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, siz |
| 584 | 490 | return 0; |
| 585 | 491 | } |
| 586 | 492 | |
| 587 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 493 | inline _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 588 | 494 | size_t |
| 589 | 495 | char_traits<char16_t>::length(const char_type* __s) _NOEXCEPT |
| 590 | 496 | { |
| ... | ... | @@ -594,7 +500,7 @@ char_traits<char16_t>::length(const char_type* __s) _NOEXCEPT |
| 594 | 500 | return __len; |
| 595 | 501 | } |
| 596 | 502 | |
| 597 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 503 | inline _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 598 | 504 | const char16_t* |
| 599 | 505 | char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT |
| 600 | 506 | { |
| ... | ... | @@ -610,38 +516,41 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _ |
| 610 | 516 | template <> |
| 611 | 517 | struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t> |
| 612 | 518 | { |
| 613 | typedef char32_t char_type; | |
| 614 | typedef uint_least32_t int_type; | |
| 615 | typedef streamoff off_type; | |
| 616 | typedef u32streampos pos_type; | |
| 617 | typedef mbstate_t state_type; | |
| 519 | using char_type = char32_t; | |
| 520 | using int_type = uint_least32_t; | |
| 521 | using off_type = streamoff; | |
| 522 | using pos_type = u32streampos; | |
| 523 | using state_type = mbstate_t; | |
| 524 | #if _LIBCPP_STD_VER > 17 | |
| 525 | using comparison_category = strong_ordering; | |
| 526 | #endif | |
| 618 | 527 | |
| 619 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 528 | static inline _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 620 | 529 | void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} |
| 621 | 530 | static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT |
| 622 | 531 | {return __c1 == __c2;} |
| 623 | 532 | static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT |
| 624 | 533 | {return __c1 < __c2;} |
| 625 | 534 | |
| 626 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 535 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 627 | 536 | int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; |
| 628 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 537 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 629 | 538 | size_t length(const char_type* __s) _NOEXCEPT; |
| 630 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 539 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 631 | 540 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; |
| 632 | 541 | |
| 633 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 542 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 634 | 543 | static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { |
| 635 | 544 | return std::__char_traits_move(__s1, __s2, __n); |
| 636 | 545 | } |
| 637 | 546 | |
| 638 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 547 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 639 | 548 | static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { |
| 640 | 549 | std::copy_n(__s2, __n, __s1); |
| 641 | 550 | return __s1; |
| 642 | 551 | } |
| 643 | 552 | |
| 644 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 553 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 645 | 554 | static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { |
| 646 | 555 | std::fill_n(__s, __n, __a); |
| 647 | 556 | return __s; |
| ... | ... | @@ -659,7 +568,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t> |
| 659 | 568 | {return int_type(0xFFFFFFFF);} |
| 660 | 569 | }; |
| 661 | 570 | |
| 662 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 571 | inline _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 663 | 572 | int |
| 664 | 573 | char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 665 | 574 | { |
| ... | ... | @@ -673,7 +582,7 @@ char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, siz |
| 673 | 582 | return 0; |
| 674 | 583 | } |
| 675 | 584 | |
| 676 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 585 | inline _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 677 | 586 | size_t |
| 678 | 587 | char_traits<char32_t>::length(const char_type* __s) _NOEXCEPT |
| 679 | 588 | { |
| ... | ... | @@ -683,7 +592,7 @@ char_traits<char32_t>::length(const char_type* __s) _NOEXCEPT |
| 683 | 592 | return __len; |
| 684 | 593 | } |
| 685 | 594 | |
| 686 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 595 | inline _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 687 | 596 | const char32_t* |
| 688 | 597 | char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT |
| 689 | 598 | { |
| ... | ... | @@ -700,7 +609,7 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _ |
| 700 | 609 | |
| 701 | 610 | // __str_find |
| 702 | 611 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 703 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 612 | inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 704 | 613 | __str_find(const _CharT *__p, _SizeT __sz, |
| 705 | 614 | _CharT __c, _SizeT __pos) _NOEXCEPT |
| 706 | 615 | { |
| ... | ... | @@ -713,7 +622,7 @@ __str_find(const _CharT *__p, _SizeT __sz, |
| 713 | 622 | } |
| 714 | 623 | |
| 715 | 624 | template <class _CharT, class _Traits> |
| 716 | inline _LIBCPP_CONSTEXPR_AFTER_CXX11 const _CharT * | |
| 625 | _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 const _CharT * | |
| 717 | 626 | __search_substring(const _CharT *__first1, const _CharT *__last1, |
| 718 | 627 | const _CharT *__first2, const _CharT *__last2) _NOEXCEPT { |
| 719 | 628 | // Take advantage of knowing source and pattern lengths. |
| ... | ... | @@ -752,7 +661,7 @@ __search_substring(const _CharT *__first1, const _CharT *__last1, |
| 752 | 661 | } |
| 753 | 662 | |
| 754 | 663 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 755 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 664 | inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 756 | 665 | __str_find(const _CharT *__p, _SizeT __sz, |
| 757 | 666 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT |
| 758 | 667 | { |
| ... | ... | @@ -762,7 +671,7 @@ __str_find(const _CharT *__p, _SizeT __sz, |
| 762 | 671 | if (__n == 0) // There is nothing to search, just return __pos. |
| 763 | 672 | return __pos; |
| 764 | 673 | |
| 765 | const _CharT *__r = __search_substring<_CharT, _Traits>( | |
| 674 | const _CharT *__r = std::__search_substring<_CharT, _Traits>( | |
| 766 | 675 | __p + __pos, __p + __sz, __s, __s + __n); |
| 767 | 676 | |
| 768 | 677 | if (__r == __p + __sz) |
| ... | ... | @@ -774,7 +683,7 @@ __str_find(const _CharT *__p, _SizeT __sz, |
| 774 | 683 | // __str_rfind |
| 775 | 684 | |
| 776 | 685 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 777 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 686 | inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 778 | 687 | __str_rfind(const _CharT *__p, _SizeT __sz, |
| 779 | 688 | _CharT __c, _SizeT __pos) _NOEXCEPT |
| 780 | 689 | { |
| ... | ... | @@ -793,7 +702,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz, |
| 793 | 702 | } |
| 794 | 703 | |
| 795 | 704 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 796 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 705 | inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 797 | 706 | __str_rfind(const _CharT *__p, _SizeT __sz, |
| 798 | 707 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT |
| 799 | 708 | { |
| ... | ... | @@ -810,7 +719,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz, |
| 810 | 719 | |
| 811 | 720 | // __str_find_first_of |
| 812 | 721 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 813 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 722 | inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 814 | 723 | __str_find_first_of(const _CharT *__p, _SizeT __sz, |
| 815 | 724 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT |
| 816 | 725 | { |
| ... | ... | @@ -826,7 +735,7 @@ __str_find_first_of(const _CharT *__p, _SizeT __sz, |
| 826 | 735 | |
| 827 | 736 | // __str_find_last_of |
| 828 | 737 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 829 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 738 | inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 830 | 739 | __str_find_last_of(const _CharT *__p, _SizeT __sz, |
| 831 | 740 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT |
| 832 | 741 | { |
| ... | ... | @@ -849,7 +758,7 @@ __str_find_last_of(const _CharT *__p, _SizeT __sz, |
| 849 | 758 | |
| 850 | 759 | // __str_find_first_not_of |
| 851 | 760 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 852 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 761 | inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 853 | 762 | __str_find_first_not_of(const _CharT *__p, _SizeT __sz, |
| 854 | 763 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT |
| 855 | 764 | { |
| ... | ... | @@ -865,7 +774,7 @@ __str_find_first_not_of(const _CharT *__p, _SizeT __sz, |
| 865 | 774 | |
| 866 | 775 | |
| 867 | 776 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 868 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 777 | inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 869 | 778 | __str_find_first_not_of(const _CharT *__p, _SizeT __sz, |
| 870 | 779 | _CharT __c, _SizeT __pos) _NOEXCEPT |
| 871 | 780 | { |
| ... | ... | @@ -882,7 +791,7 @@ __str_find_first_not_of(const _CharT *__p, _SizeT __sz, |
| 882 | 791 | |
| 883 | 792 | // __str_find_last_not_of |
| 884 | 793 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 885 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 794 | inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 886 | 795 | __str_find_last_not_of(const _CharT *__p, _SizeT __sz, |
| 887 | 796 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT |
| 888 | 797 | { |
| ... | ... | @@ -898,7 +807,7 @@ __str_find_last_not_of(const _CharT *__p, _SizeT __sz, |
| 898 | 807 | |
| 899 | 808 | |
| 900 | 809 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 901 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 810 | inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 902 | 811 | __str_find_last_not_of(const _CharT *__p, _SizeT __sz, |
| 903 | 812 | _CharT __c, _SizeT __pos) _NOEXCEPT |
| 904 | 813 | { |
lib/libcxx/include/__support/android/locale_bionic.h+3-3| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | #ifndef _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H | |
| 11 | #define _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H | |
| 10 | #ifndef _LIBCPP___SUPPORT_ANDROID_LOCALE_BIONIC_H | |
| 11 | #define _LIBCPP___SUPPORT_ANDROID_LOCALE_BIONIC_H | |
| 12 | 12 | |
| 13 | 13 | #if defined(__BIONIC__) |
| 14 | 14 | |
| ... | ... | @@ -72,4 +72,4 @@ strtol_l(const char* __nptr, char** __endptr, int __base, locale_t) { |
| 72 | 72 | #endif // defined(__ANDROID__) |
| 73 | 73 | |
| 74 | 74 | #endif // defined(__BIONIC__) |
| 75 | #endif // _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H | |
| 75 | #endif // _LIBCPP___SUPPORT_ANDROID_LOCALE_BIONIC_H |
lib/libcxx/include/__support/fuchsia/xlocale.h+3-3| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | #ifndef _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H | |
| 11 | #define _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H | |
| 10 | #ifndef _LIBCPP___SUPPORT_FUCHSIA_XLOCALE_H | |
| 11 | #define _LIBCPP___SUPPORT_FUCHSIA_XLOCALE_H | |
| 12 | 12 | |
| 13 | 13 | #if defined(__Fuchsia__) |
| 14 | 14 | |
| ... | ... | @@ -19,4 +19,4 @@ |
| 19 | 19 | |
| 20 | 20 | #endif // defined(__Fuchsia__) |
| 21 | 21 | |
| 22 | #endif // _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H | |
| 22 | #endif // _LIBCPP___SUPPORT_FUCHSIA_XLOCALE_H |
lib/libcxx/include/__support/ibm/gettod_zos.h+3-3| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | #ifndef _LIBCPP_SUPPORT_IBM_GETTOD_ZOS_H | |
| 11 | #define _LIBCPP_SUPPORT_IBM_GETTOD_ZOS_H | |
| 10 | #ifndef _LIBCPP___SUPPORT_IBM_GETTOD_ZOS_H | |
| 11 | #define _LIBCPP___SUPPORT_IBM_GETTOD_ZOS_H | |
| 12 | 12 | |
| 13 | 13 | #include <time.h> |
| 14 | 14 | |
| ... | ... | @@ -51,4 +51,4 @@ gettimeofdayMonotonic(struct timespec64* Output) { |
| 51 | 51 | return 0; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | #endif // _LIBCPP_SUPPORT_IBM_GETTOD_ZOS_H | |
| 54 | #endif // _LIBCPP___SUPPORT_IBM_GETTOD_ZOS_H |
lib/libcxx/include/__support/ibm/locale_mgmt_zos.h+3-3| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | #ifndef _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_ZOS_H | |
| 11 | #define _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_ZOS_H | |
| 10 | #ifndef _LIBCPP___SUPPORT_IBM_LOCALE_MGMT_ZOS_H | |
| 11 | #define _LIBCPP___SUPPORT_IBM_LOCALE_MGMT_ZOS_H | |
| 12 | 12 | |
| 13 | 13 | #if defined(__MVS__) |
| 14 | 14 | #include <locale.h> |
| ... | ... | @@ -50,4 +50,4 @@ locale_t uselocale(locale_t newloc); |
| 50 | 50 | } |
| 51 | 51 | #endif |
| 52 | 52 | #endif // defined(__MVS__) |
| 53 | #endif // _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_ZOS_H | |
| 53 | #endif // _LIBCPP___SUPPORT_IBM_LOCALE_MGMT_ZOS_H |
lib/libcxx/include/__support/ibm/nanosleep.h+3-3| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | #ifndef _LIBCPP_SUPPORT_IBM_NANOSLEEP_H | |
| 11 | #define _LIBCPP_SUPPORT_IBM_NANOSLEEP_H | |
| 10 | #ifndef _LIBCPP___SUPPORT_IBM_NANOSLEEP_H | |
| 11 | #define _LIBCPP___SUPPORT_IBM_NANOSLEEP_H | |
| 12 | 12 | |
| 13 | 13 | #include <unistd.h> |
| 14 | 14 | |
| ... | ... | @@ -52,4 +52,4 @@ inline int nanosleep(const struct timespec* __req, struct timespec* __rem) { |
| 52 | 52 | return 0; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | #endif // _LIBCPP_SUPPORT_IBM_NANOSLEEP_H | |
| 55 | #endif // _LIBCPP___SUPPORT_IBM_NANOSLEEP_H |
lib/libcxx/include/__support/ibm/xlocale.h+3-3| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | #ifndef _LIBCPP_SUPPORT_IBM_XLOCALE_H | |
| 11 | #define _LIBCPP_SUPPORT_IBM_XLOCALE_H | |
| 10 | #ifndef _LIBCPP___SUPPORT_IBM_XLOCALE_H | |
| 11 | #define _LIBCPP___SUPPORT_IBM_XLOCALE_H | |
| 12 | 12 | |
| 13 | 13 | #if defined(__MVS__) |
| 14 | 14 | #include <__support/ibm/locale_mgmt_zos.h> |
| ... | ... | @@ -126,4 +126,4 @@ vasprintf(char **strp, const char *fmt, va_list ap) { |
| 126 | 126 | #ifdef __cplusplus |
| 127 | 127 | } |
| 128 | 128 | #endif |
| 129 | #endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H | |
| 129 | #endif // _LIBCPP___SUPPORT_IBM_XLOCALE_H |
lib/libcxx/include/__support/musl/xlocale.h+4-4| ... | ... | @@ -14,8 +14,8 @@ |
| 14 | 14 | // in Musl. |
| 15 | 15 | //===----------------------------------------------------------------------===// |
| 16 | 16 | |
| 17 | #ifndef _LIBCPP_SUPPORT_MUSL_XLOCALE_H | |
| 18 | #define _LIBCPP_SUPPORT_MUSL_XLOCALE_H | |
| 17 | #ifndef _LIBCPP___SUPPORT_MUSL_XLOCALE_H | |
| 18 | #define _LIBCPP___SUPPORT_MUSL_XLOCALE_H | |
| 19 | 19 | |
| 20 | 20 | #include <cstdlib> |
| 21 | 21 | #include <cwchar> |
| ... | ... | @@ -39,7 +39,7 @@ wcstoll_l(const wchar_t *__nptr, wchar_t **__endptr, int __base, locale_t) { |
| 39 | 39 | return ::wcstoll(__nptr, __endptr, __base); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | inline _LIBCPP_HIDE_FROM_ABI long long | |
| 42 | inline _LIBCPP_HIDE_FROM_ABI unsigned long long | |
| 43 | 43 | wcstoull_l(const wchar_t *__nptr, wchar_t **__endptr, int __base, locale_t) { |
| 44 | 44 | return ::wcstoull(__nptr, __endptr, __base); |
| 45 | 45 | } |
| ... | ... | @@ -53,4 +53,4 @@ wcstold_l(const wchar_t *__nptr, wchar_t **__endptr, locale_t) { |
| 53 | 53 | } |
| 54 | 54 | #endif |
| 55 | 55 | |
| 56 | #endif // _LIBCPP_SUPPORT_MUSL_XLOCALE_H | |
| 56 | #endif // _LIBCPP___SUPPORT_MUSL_XLOCALE_H |
lib/libcxx/include/__support/newlib/xlocale.h+2-6| ... | ... | @@ -6,15 +6,11 @@ |
| 6 | 6 | // |
| 7 | 7 | //===----------------------------------------------------------------------===// |
| 8 | 8 | |
| 9 | #ifndef _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H | |
| 10 | #define _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H | |
| 9 | #ifndef _LIBCPP___SUPPORT_NEWLIB_XLOCALE_H | |
| 10 | #define _LIBCPP___SUPPORT_NEWLIB_XLOCALE_H | |
| 11 | 11 | |
| 12 | 12 | #if defined(_NEWLIB_VERSION) |
| 13 | 13 | |
| 14 | #include <cstdlib> | |
| 15 | #include <clocale> | |
| 16 | #include <cwctype> | |
| 17 | #include <ctype.h> | |
| 18 | 14 | #if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \ |
| 19 | 15 | __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5 |
| 20 | 16 | #include <__support/xlocale/__nop_locale_mgmt.h> |
lib/libcxx/include/__support/openbsd/xlocale.h+2-2| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | #ifndef _LIBCPP_SUPPORT_OPENBSD_XLOCALE_H | |
| 11 | #define _LIBCPP_SUPPORT_OPENBSD_XLOCALE_H | |
| 10 | #ifndef _LIBCPP___SUPPORT_OPENBSD_XLOCALE_H | |
| 11 | #define _LIBCPP___SUPPORT_OPENBSD_XLOCALE_H | |
| 12 | 12 | |
| 13 | 13 | #include <__support/xlocale/__strtonum_fallback.h> |
| 14 | 14 | #include <clocale> |
lib/libcxx/include/__support/solaris/xlocale.h+1-1| ... | ... | @@ -43,7 +43,7 @@ strtol_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) { |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | inline _LIBCPP_HIDE_FROM_ABI unsigned long long |
| 46 | strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) | |
| 46 | strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) | |
| 47 | 47 | return ::strtoull(__nptr, __endptr, __base); |
| 48 | 48 | } |
| 49 | 49 |
lib/libcxx/include/__support/win32/limits_msvc_win32.h deleted-71| ... | ... | @@ -1,71 +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_WIN32_LIMITS_MSVC_WIN32_H | |
| 11 | #define _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H | |
| 12 | ||
| 13 | #if !defined(_LIBCPP_MSVCRT) | |
| 14 | #error "This header complements the Microsoft C Runtime library, and should not be included otherwise." | |
| 15 | #endif | |
| 16 | #if defined(__clang__) | |
| 17 | #error "This header should only be included when using Microsoft's C1XX frontend" | |
| 18 | #endif | |
| 19 | ||
| 20 | #include <float.h> // limit constants | |
| 21 | #include <limits.h> // CHAR_BIT | |
| 22 | #include <math.h> // HUGE_VAL | |
| 23 | #include <ymath.h> // internal MSVC header providing the needed functionality | |
| 24 | ||
| 25 | #define __CHAR_BIT__ CHAR_BIT | |
| 26 | ||
| 27 | #define __FLT_MANT_DIG__ FLT_MANT_DIG | |
| 28 | #define __FLT_DIG__ FLT_DIG | |
| 29 | #define __FLT_RADIX__ FLT_RADIX | |
| 30 | #define __FLT_MIN_EXP__ FLT_MIN_EXP | |
| 31 | #define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP | |
| 32 | #define __FLT_MAX_EXP__ FLT_MAX_EXP | |
| 33 | #define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP | |
| 34 | #define __FLT_MIN__ FLT_MIN | |
| 35 | #define __FLT_MAX__ FLT_MAX | |
| 36 | #define __FLT_EPSILON__ FLT_EPSILON | |
| 37 | // predefined by MinGW GCC | |
| 38 | #define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F | |
| 39 | ||
| 40 | #define __DBL_MANT_DIG__ DBL_MANT_DIG | |
| 41 | #define __DBL_DIG__ DBL_DIG | |
| 42 | #define __DBL_RADIX__ DBL_RADIX | |
| 43 | #define __DBL_MIN_EXP__ DBL_MIN_EXP | |
| 44 | #define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP | |
| 45 | #define __DBL_MAX_EXP__ DBL_MAX_EXP | |
| 46 | #define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP | |
| 47 | #define __DBL_MIN__ DBL_MIN | |
| 48 | #define __DBL_MAX__ DBL_MAX | |
| 49 | #define __DBL_EPSILON__ DBL_EPSILON | |
| 50 | // predefined by MinGW GCC | |
| 51 | #define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L) | |
| 52 | ||
| 53 | #define __LDBL_MANT_DIG__ LDBL_MANT_DIG | |
| 54 | #define __LDBL_DIG__ LDBL_DIG | |
| 55 | #define __LDBL_RADIX__ LDBL_RADIX | |
| 56 | #define __LDBL_MIN_EXP__ LDBL_MIN_EXP | |
| 57 | #define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP | |
| 58 | #define __LDBL_MAX_EXP__ LDBL_MAX_EXP | |
| 59 | #define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP | |
| 60 | #define __LDBL_MIN__ LDBL_MIN | |
| 61 | #define __LDBL_MAX__ LDBL_MAX | |
| 62 | #define __LDBL_EPSILON__ LDBL_EPSILON | |
| 63 | // predefined by MinGW GCC | |
| 64 | #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L | |
| 65 | ||
| 66 | // __builtin replacements/workarounds | |
| 67 | #define __builtin_huge_vall() _LInf._Long_double | |
| 68 | #define __builtin_nanl(__dummmy) _LNan._Long_double | |
| 69 | #define __builtin_nansl(__dummy) _LSnan._Long_double | |
| 70 | ||
| 71 | #endif // _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H |
lib/libcxx/include/__support/win32/locale_win32.h+62-61| ... | ... | @@ -7,13 +7,14 @@ |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | #ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H | |
| 11 | #define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H | |
| 10 | #ifndef _LIBCPP___SUPPORT_WIN32_LOCALE_WIN32_H | |
| 11 | #define _LIBCPP___SUPPORT_WIN32_LOCALE_WIN32_H | |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | 14 | #include <cstddef> |
| 15 | 15 | #include <locale.h> // _locale_t |
| 16 | 16 | #include <stdio.h> |
| 17 | #include <string> | |
| 17 | 18 | |
| 18 | 19 | #define _X_ALL LC_ALL |
| 19 | 20 | #define _X_COLLATE LC_COLLATE |
| ... | ... | @@ -50,92 +51,92 @@ |
| 50 | 51 | class __lconv_storage { |
| 51 | 52 | public: |
| 52 | 53 | __lconv_storage(const lconv *__lc_input) { |
| 53 | __lc = *__lc_input; | |
| 54 | ||
| 55 | __decimal_point = __lc_input->decimal_point; | |
| 56 | __thousands_sep = __lc_input->thousands_sep; | |
| 57 | __grouping = __lc_input->grouping; | |
| 58 | __int_curr_symbol = __lc_input->int_curr_symbol; | |
| 59 | __currency_symbol = __lc_input->currency_symbol; | |
| 60 | __mon_decimal_point = __lc_input->mon_decimal_point; | |
| 61 | __mon_thousands_sep = __lc_input->mon_thousands_sep; | |
| 62 | __mon_grouping = __lc_input->mon_grouping; | |
| 63 | __positive_sign = __lc_input->positive_sign; | |
| 64 | __negative_sign = __lc_input->negative_sign; | |
| 65 | ||
| 66 | __lc.decimal_point = const_cast<char *>(__decimal_point.c_str()); | |
| 67 | __lc.thousands_sep = const_cast<char *>(__thousands_sep.c_str()); | |
| 68 | __lc.grouping = const_cast<char *>(__grouping.c_str()); | |
| 69 | __lc.int_curr_symbol = const_cast<char *>(__int_curr_symbol.c_str()); | |
| 70 | __lc.currency_symbol = const_cast<char *>(__currency_symbol.c_str()); | |
| 71 | __lc.mon_decimal_point = const_cast<char *>(__mon_decimal_point.c_str()); | |
| 72 | __lc.mon_thousands_sep = const_cast<char *>(__mon_thousands_sep.c_str()); | |
| 73 | __lc.mon_grouping = const_cast<char *>(__mon_grouping.c_str()); | |
| 74 | __lc.positive_sign = const_cast<char *>(__positive_sign.c_str()); | |
| 75 | __lc.negative_sign = const_cast<char *>(__negative_sign.c_str()); | |
| 54 | __lc_ = *__lc_input; | |
| 55 | ||
| 56 | __decimal_point_ = __lc_input->decimal_point; | |
| 57 | __thousands_sep_ = __lc_input->thousands_sep; | |
| 58 | __grouping_ = __lc_input->grouping; | |
| 59 | __int_curr_symbol_ = __lc_input->int_curr_symbol; | |
| 60 | __currency_symbol_ = __lc_input->currency_symbol; | |
| 61 | __mon_decimal_point_ = __lc_input->mon_decimal_point; | |
| 62 | __mon_thousands_sep_ = __lc_input->mon_thousands_sep; | |
| 63 | __mon_grouping_ = __lc_input->mon_grouping; | |
| 64 | __positive_sign_ = __lc_input->positive_sign; | |
| 65 | __negative_sign_ = __lc_input->negative_sign; | |
| 66 | ||
| 67 | __lc_.decimal_point = const_cast<char *>(__decimal_point_.c_str()); | |
| 68 | __lc_.thousands_sep = const_cast<char *>(__thousands_sep_.c_str()); | |
| 69 | __lc_.grouping = const_cast<char *>(__grouping_.c_str()); | |
| 70 | __lc_.int_curr_symbol = const_cast<char *>(__int_curr_symbol_.c_str()); | |
| 71 | __lc_.currency_symbol = const_cast<char *>(__currency_symbol_.c_str()); | |
| 72 | __lc_.mon_decimal_point = const_cast<char *>(__mon_decimal_point_.c_str()); | |
| 73 | __lc_.mon_thousands_sep = const_cast<char *>(__mon_thousands_sep_.c_str()); | |
| 74 | __lc_.mon_grouping = const_cast<char *>(__mon_grouping_.c_str()); | |
| 75 | __lc_.positive_sign = const_cast<char *>(__positive_sign_.c_str()); | |
| 76 | __lc_.negative_sign = const_cast<char *>(__negative_sign_.c_str()); | |
| 76 | 77 | } |
| 77 | 78 | |
| 78 | 79 | lconv *__get() { |
| 79 | return &__lc; | |
| 80 | return &__lc_; | |
| 80 | 81 | } |
| 81 | 82 | private: |
| 82 | lconv __lc; | |
| 83 | std::string __decimal_point; | |
| 84 | std::string __thousands_sep; | |
| 85 | std::string __grouping; | |
| 86 | std::string __int_curr_symbol; | |
| 87 | std::string __currency_symbol; | |
| 88 | std::string __mon_decimal_point; | |
| 89 | std::string __mon_thousands_sep; | |
| 90 | std::string __mon_grouping; | |
| 91 | std::string __positive_sign; | |
| 92 | std::string __negative_sign; | |
| 83 | lconv __lc_; | |
| 84 | std::string __decimal_point_; | |
| 85 | std::string __thousands_sep_; | |
| 86 | std::string __grouping_; | |
| 87 | std::string __int_curr_symbol_; | |
| 88 | std::string __currency_symbol_; | |
| 89 | std::string __mon_decimal_point_; | |
| 90 | std::string __mon_thousands_sep_; | |
| 91 | std::string __mon_grouping_; | |
| 92 | std::string __positive_sign_; | |
| 93 | std::string __negative_sign_; | |
| 93 | 94 | }; |
| 94 | 95 | |
| 95 | 96 | class locale_t { |
| 96 | 97 | public: |
| 97 | 98 | locale_t() |
| 98 | : __locale(nullptr), __locale_str(nullptr), __lc(nullptr) {} | |
| 99 | : __locale_(nullptr), __locale_str_(nullptr), __lc_(nullptr) {} | |
| 99 | 100 | locale_t(std::nullptr_t) |
| 100 | : __locale(nullptr), __locale_str(nullptr), __lc(nullptr) {} | |
| 101 | : __locale_(nullptr), __locale_str_(nullptr), __lc_(nullptr) {} | |
| 101 | 102 | locale_t(_locale_t __xlocale, const char* __xlocale_str) |
| 102 | : __locale(__xlocale), __locale_str(__xlocale_str), __lc(nullptr) {} | |
| 103 | : __locale_(__xlocale), __locale_str_(__xlocale_str), __lc_(nullptr) {} | |
| 103 | 104 | locale_t(const locale_t &__l) |
| 104 | : __locale(__l.__locale), __locale_str(__l.__locale_str), __lc(nullptr) {} | |
| 105 | : __locale_(__l.__locale_), __locale_str_(__l.__locale_str_), __lc_(nullptr) {} | |
| 105 | 106 | |
| 106 | 107 | ~locale_t() { |
| 107 | delete __lc; | |
| 108 | delete __lc_; | |
| 108 | 109 | } |
| 109 | 110 | |
| 110 | 111 | locale_t &operator =(const locale_t &__l) { |
| 111 | __locale = __l.__locale; | |
| 112 | __locale_str = __l.__locale_str; | |
| 113 | // __lc not copied | |
| 112 | __locale_ = __l.__locale_; | |
| 113 | __locale_str_ = __l.__locale_str_; | |
| 114 | // __lc_ not copied | |
| 114 | 115 | return *this; |
| 115 | 116 | } |
| 116 | 117 | |
| 117 | 118 | friend bool operator==(const locale_t& __left, const locale_t& __right) { |
| 118 | return __left.__locale == __right.__locale; | |
| 119 | return __left.__locale_ == __right.__locale_; | |
| 119 | 120 | } |
| 120 | 121 | |
| 121 | 122 | friend bool operator==(const locale_t& __left, int __right) { |
| 122 | return __left.__locale == nullptr && __right == 0; | |
| 123 | return __left.__locale_ == nullptr && __right == 0; | |
| 123 | 124 | } |
| 124 | 125 | |
| 125 | 126 | friend bool operator==(const locale_t& __left, long long __right) { |
| 126 | return __left.__locale == nullptr && __right == 0; | |
| 127 | return __left.__locale_ == nullptr && __right == 0; | |
| 127 | 128 | } |
| 128 | 129 | |
| 129 | 130 | friend bool operator==(const locale_t& __left, std::nullptr_t) { |
| 130 | return __left.__locale == nullptr; | |
| 131 | return __left.__locale_ == nullptr; | |
| 131 | 132 | } |
| 132 | 133 | |
| 133 | 134 | friend bool operator==(int __left, const locale_t& __right) { |
| 134 | return __left == 0 && nullptr == __right.__locale; | |
| 135 | return __left == 0 && nullptr == __right.__locale_; | |
| 135 | 136 | } |
| 136 | 137 | |
| 137 | 138 | friend bool operator==(std::nullptr_t, const locale_t& __right) { |
| 138 | return nullptr == __right.__locale; | |
| 139 | return nullptr == __right.__locale_; | |
| 139 | 140 | } |
| 140 | 141 | |
| 141 | 142 | friend bool operator!=(const locale_t& __left, const locale_t& __right) { |
| ... | ... | @@ -163,24 +164,24 @@ public: |
| 163 | 164 | } |
| 164 | 165 | |
| 165 | 166 | operator bool() const { |
| 166 | return __locale != nullptr; | |
| 167 | return __locale_ != nullptr; | |
| 167 | 168 | } |
| 168 | 169 | |
| 169 | const char* __get_locale() const { return __locale_str; } | |
| 170 | const char* __get_locale() const { return __locale_str_; } | |
| 170 | 171 | |
| 171 | 172 | operator _locale_t() const { |
| 172 | return __locale; | |
| 173 | return __locale_; | |
| 173 | 174 | } |
| 174 | 175 | |
| 175 | 176 | lconv *__store_lconv(const lconv *__input_lc) { |
| 176 | delete __lc; | |
| 177 | __lc = new __lconv_storage(__input_lc); | |
| 178 | return __lc->__get(); | |
| 177 | delete __lc_; | |
| 178 | __lc_ = new __lconv_storage(__input_lc); | |
| 179 | return __lc_->__get(); | |
| 179 | 180 | } |
| 180 | 181 | private: |
| 181 | _locale_t __locale; | |
| 182 | const char* __locale_str; | |
| 183 | __lconv_storage *__lc = nullptr; | |
| 182 | _locale_t __locale_; | |
| 183 | const char* __locale_str_; | |
| 184 | __lconv_storage *__lc_ = nullptr; | |
| 184 | 185 | }; |
| 185 | 186 | |
| 186 | 187 | // Locale management functions |
| ... | ... | @@ -278,4 +279,4 @@ inline int iswblank_l( wint_t __c, locale_t /*loc*/ ) |
| 278 | 279 | return ( __c == L' ' || __c == L'\t' ); |
| 279 | 280 | } |
| 280 | 281 | |
| 281 | #endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H | |
| 282 | #endif // _LIBCPP___SUPPORT_WIN32_LOCALE_WIN32_H |
lib/libcxx/include/__support/xlocale/__nop_locale_mgmt.h+5-3| ... | ... | @@ -7,8 +7,10 @@ |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | 9 | |
| 10 | #ifndef _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H | |
| 11 | #define _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H | |
| 10 | #ifndef _LIBCPP___SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H | |
| 11 | #define _LIBCPP___SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H | |
| 12 | ||
| 13 | #include <__config> | |
| 12 | 14 | |
| 13 | 15 | #ifdef __cplusplus |
| 14 | 16 | extern "C" { |
| ... | ... | @@ -53,4 +55,4 @@ uselocale(locale_t) { |
| 53 | 55 | } // extern "C" |
| 54 | 56 | #endif |
| 55 | 57 | |
| 56 | #endif // _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H | |
| 58 | #endif // _LIBCPP___SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H |
lib/libcxx/include/__support/xlocale/__posix_l_fallback.h+23-11| ... | ... | @@ -12,8 +12,16 @@ |
| 12 | 12 | // Android's bionic and Newlib). |
| 13 | 13 | //===----------------------------------------------------------------------===// |
| 14 | 14 | |
| 15 | #ifndef _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H | |
| 16 | #define _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H | |
| 15 | #ifndef _LIBCPP___SUPPORT_XLOCALE_POSIX_L_FALLBACK_H | |
| 16 | #define _LIBCPP___SUPPORT_XLOCALE_POSIX_L_FALLBACK_H | |
| 17 | ||
| 18 | #include <__config> | |
| 19 | #include <ctype.h> | |
| 20 | #include <time.h> | |
| 21 | ||
| 22 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 23 | # include <wctype.h> | |
| 24 | #endif | |
| 17 | 25 | |
| 18 | 26 | #ifdef __cplusplus |
| 19 | 27 | extern "C" { |
| ... | ... | @@ -67,6 +75,15 @@ inline _LIBCPP_HIDE_FROM_ABI int isxdigit_l(int __c, locale_t) { |
| 67 | 75 | return ::isxdigit(__c); |
| 68 | 76 | } |
| 69 | 77 | |
| 78 | inline _LIBCPP_HIDE_FROM_ABI int toupper_l(int __c, locale_t) { | |
| 79 | return ::toupper(__c); | |
| 80 | } | |
| 81 | ||
| 82 | inline _LIBCPP_HIDE_FROM_ABI int tolower_l(int __c, locale_t) { | |
| 83 | return ::tolower(__c); | |
| 84 | } | |
| 85 | ||
| 86 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 70 | 87 | inline _LIBCPP_HIDE_FROM_ABI int iswalnum_l(wint_t __c, locale_t) { |
| 71 | 88 | return ::iswalnum(__c); |
| 72 | 89 | } |
| ... | ... | @@ -115,14 +132,6 @@ inline _LIBCPP_HIDE_FROM_ABI int iswxdigit_l(wint_t __c, locale_t) { |
| 115 | 132 | return ::iswxdigit(__c); |
| 116 | 133 | } |
| 117 | 134 | |
| 118 | inline _LIBCPP_HIDE_FROM_ABI int toupper_l(int __c, locale_t) { | |
| 119 | return ::toupper(__c); | |
| 120 | } | |
| 121 | ||
| 122 | inline _LIBCPP_HIDE_FROM_ABI int tolower_l(int __c, locale_t) { | |
| 123 | return ::tolower(__c); | |
| 124 | } | |
| 125 | ||
| 126 | 135 | inline _LIBCPP_HIDE_FROM_ABI wint_t towupper_l(wint_t __c, locale_t) { |
| 127 | 136 | return ::towupper(__c); |
| 128 | 137 | } |
| ... | ... | @@ -130,6 +139,7 @@ inline _LIBCPP_HIDE_FROM_ABI wint_t towupper_l(wint_t __c, locale_t) { |
| 130 | 139 | inline _LIBCPP_HIDE_FROM_ABI wint_t towlower_l(wint_t __c, locale_t) { |
| 131 | 140 | return ::towlower(__c); |
| 132 | 141 | } |
| 142 | #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 133 | 143 | |
| 134 | 144 | inline _LIBCPP_HIDE_FROM_ABI int |
| 135 | 145 | strcoll_l(const char *__s1, const char *__s2, locale_t) { |
| ... | ... | @@ -147,6 +157,7 @@ strftime_l(char *__s, size_t __max, const char *__format, const struct tm *__tm, |
| 147 | 157 | return ::strftime(__s, __max, __format, __tm); |
| 148 | 158 | } |
| 149 | 159 | |
| 160 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 150 | 161 | inline _LIBCPP_HIDE_FROM_ABI int |
| 151 | 162 | wcscoll_l(const wchar_t *__ws1, const wchar_t *__ws2, locale_t) { |
| 152 | 163 | return ::wcscoll(__ws1, __ws2); |
| ... | ... | @@ -156,9 +167,10 @@ inline _LIBCPP_HIDE_FROM_ABI size_t |
| 156 | 167 | wcsxfrm_l(wchar_t *__dest, const wchar_t *__src, size_t __n, locale_t) { |
| 157 | 168 | return ::wcsxfrm(__dest, __src, __n); |
| 158 | 169 | } |
| 170 | #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 159 | 171 | |
| 160 | 172 | #ifdef __cplusplus |
| 161 | 173 | } |
| 162 | 174 | #endif |
| 163 | 175 | |
| 164 | #endif // _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H | |
| 176 | #endif // _LIBCPP___SUPPORT_XLOCALE_POSIX_L_FALLBACK_H |
lib/libcxx/include/__support/xlocale/__strtonum_fallback.h+12-3| ... | ... | @@ -12,8 +12,15 @@ |
| 12 | 12 | // convert strings to some numeric type. |
| 13 | 13 | //===----------------------------------------------------------------------===// |
| 14 | 14 | |
| 15 | #ifndef _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H | |
| 16 | #define _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H | |
| 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 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 22 | # include <wchar.h> | |
| 23 | #endif | |
| 17 | 24 | |
| 18 | 25 | #ifdef __cplusplus |
| 19 | 26 | extern "C" { |
| ... | ... | @@ -44,6 +51,7 @@ strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t) { |
| 44 | 51 | return ::strtoull(__nptr, __endptr, __base); |
| 45 | 52 | } |
| 46 | 53 | |
| 54 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 47 | 55 | inline _LIBCPP_HIDE_FROM_ABI long long |
| 48 | 56 | wcstoll_l(const wchar_t *__nptr, wchar_t **__endptr, int __base, locale_t) { |
| 49 | 57 | return ::wcstoll(__nptr, __endptr, __base); |
| ... | ... | @@ -58,9 +66,10 @@ inline _LIBCPP_HIDE_FROM_ABI long double |
| 58 | 66 | wcstold_l(const wchar_t *__nptr, wchar_t **__endptr, locale_t) { |
| 59 | 67 | return ::wcstold(__nptr, __endptr); |
| 60 | 68 | } |
| 69 | #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 61 | 70 | |
| 62 | 71 | #ifdef __cplusplus |
| 63 | 72 | } |
| 64 | 73 | #endif |
| 65 | 74 | |
| 66 | #endif // _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H | |
| 75 | #endif // _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H |
lib/libcxx/include/__thread/poll_with_backoff.h+1-3| ... | ... | @@ -6,16 +6,14 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___THREAD_POLL_WITH_BACKOFF_H |
| 10 | 11 | #define _LIBCPP___THREAD_POLL_WITH_BACKOFF_H |
| 11 | 12 | |
| 12 | 13 | #include <__availability> |
| 13 | 14 | #include <__chrono/duration.h> |
| 14 | 15 | #include <__chrono/high_resolution_clock.h> |
| 15 | #include <__chrono/steady_clock.h> | |
| 16 | #include <__chrono/time_point.h> | |
| 17 | 16 | #include <__config> |
| 18 | #include <__filesystem/file_time_type.h> | |
| 19 | 17 | |
| 20 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 21 | 19 | # pragma GCC system_header |
lib/libcxx/include/__thread/timed_backoff_policy.h+1| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP___THREAD_TIMED_BACKOFF_POLICY_H |
| 10 | 11 | #define _LIBCPP___THREAD_TIMED_BACKOFF_POLICY_H |
| 11 | 12 |
lib/libcxx/include/__threading_support+54-25| ... | ... | @@ -13,7 +13,9 @@ |
| 13 | 13 | #include <__availability> |
| 14 | 14 | #include <__chrono/convert_to_timespec.h> |
| 15 | 15 | #include <__chrono/duration.h> |
| 16 | #include <__compare/ordering.h> | |
| 16 | 17 | #include <__config> |
| 18 | #include <__fwd/hash.h> | |
| 17 | 19 | #include <__thread/poll_with_backoff.h> |
| 18 | 20 | #include <errno.h> |
| 19 | 21 | #include <iosfwd> |
| ... | ... | @@ -609,40 +611,28 @@ class _LIBCPP_TEMPLATE_VIS __thread_id |
| 609 | 611 | // on other platforms. We assume 0 works everywhere for now. |
| 610 | 612 | __libcpp_thread_id __id_; |
| 611 | 613 | |
| 612 | public: | |
| 613 | _LIBCPP_INLINE_VISIBILITY | |
| 614 | __thread_id() _NOEXCEPT : __id_(0) {} | |
| 615 | ||
| 616 | friend _LIBCPP_INLINE_VISIBILITY | |
| 617 | bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT | |
| 618 | { // don't pass id==0 to underlying routines | |
| 619 | if (__x.__id_ == 0) return __y.__id_ == 0; | |
| 620 | if (__y.__id_ == 0) return false; | |
| 621 | return __libcpp_thread_id_equal(__x.__id_, __y.__id_); | |
| 622 | } | |
| 623 | friend _LIBCPP_INLINE_VISIBILITY | |
| 624 | bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT | |
| 625 | {return !(__x == __y);} | |
| 626 | friend _LIBCPP_INLINE_VISIBILITY | |
| 627 | bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT | |
| 614 | static _LIBCPP_HIDE_FROM_ABI | |
| 615 | bool __lt_impl(__thread_id __x, __thread_id __y) _NOEXCEPT | |
| 628 | 616 | { // id==0 is always less than any other thread_id |
| 629 | 617 | if (__x.__id_ == 0) return __y.__id_ != 0; |
| 630 | 618 | if (__y.__id_ == 0) return false; |
| 631 | 619 | return __libcpp_thread_id_less(__x.__id_, __y.__id_); |
| 632 | 620 | } |
| 633 | friend _LIBCPP_INLINE_VISIBILITY | |
| 634 | bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT | |
| 635 | {return !(__y < __x);} | |
| 636 | friend _LIBCPP_INLINE_VISIBILITY | |
| 637 | bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT | |
| 638 | {return __y < __x ;} | |
| 639 | friend _LIBCPP_INLINE_VISIBILITY | |
| 640 | bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT | |
| 641 | {return !(__x < __y);} | |
| 621 | ||
| 622 | public: | |
| 623 | _LIBCPP_INLINE_VISIBILITY | |
| 624 | __thread_id() _NOEXCEPT : __id_(0) {} | |
| 642 | 625 | |
| 643 | 626 | _LIBCPP_INLINE_VISIBILITY |
| 644 | 627 | void __reset() { __id_ = 0; } |
| 645 | 628 | |
| 629 | friend _LIBCPP_HIDE_FROM_ABI bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT; | |
| 630 | #if _LIBCPP_STD_VER <= 17 | |
| 631 | friend _LIBCPP_HIDE_FROM_ABI bool operator<(__thread_id __x, __thread_id __y) _NOEXCEPT; | |
| 632 | #else // _LIBCPP_STD_VER <= 17 | |
| 633 | friend _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(__thread_id __x, __thread_id __y) noexcept; | |
| 634 | #endif // _LIBCPP_STD_VER <= 17 | |
| 635 | ||
| 646 | 636 | template<class _CharT, class _Traits> |
| 647 | 637 | friend |
| 648 | 638 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -658,6 +648,45 @@ private: |
| 658 | 648 | friend struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>; |
| 659 | 649 | }; |
| 660 | 650 | |
| 651 | inline _LIBCPP_HIDE_FROM_ABI | |
| 652 | bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT { | |
| 653 | // Don't pass id==0 to underlying routines | |
| 654 | if (__x.__id_ == 0) | |
| 655 | return __y.__id_ == 0; | |
| 656 | if (__y.__id_ == 0) | |
| 657 | return false; | |
| 658 | return __libcpp_thread_id_equal(__x.__id_, __y.__id_); | |
| 659 | } | |
| 660 | ||
| 661 | #if _LIBCPP_STD_VER <= 17 | |
| 662 | ||
| 663 | inline _LIBCPP_HIDE_FROM_ABI | |
| 664 | bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT { | |
| 665 | return !(__x == __y); | |
| 666 | } | |
| 667 | ||
| 668 | inline _LIBCPP_HIDE_FROM_ABI | |
| 669 | bool operator<(__thread_id __x, __thread_id __y) _NOEXCEPT { | |
| 670 | return __thread_id::__lt_impl(__x.__id_, __y.__id_); | |
| 671 | } | |
| 672 | ||
| 673 | inline _LIBCPP_HIDE_FROM_ABI bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT { return !(__y < __x); } | |
| 674 | inline _LIBCPP_HIDE_FROM_ABI bool operator>(__thread_id __x, __thread_id __y) _NOEXCEPT { return __y < __x; } | |
| 675 | inline _LIBCPP_HIDE_FROM_ABI bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT { return !(__x < __y); } | |
| 676 | ||
| 677 | #else // _LIBCPP_STD_VER <= 17 | |
| 678 | ||
| 679 | inline _LIBCPP_HIDE_FROM_ABI | |
| 680 | strong_ordering operator<=>(__thread_id __x, __thread_id __y) noexcept { | |
| 681 | if (__x == __y) | |
| 682 | return strong_ordering::equal; | |
| 683 | if (__thread_id::__lt_impl(__x, __y)) | |
| 684 | return strong_ordering::less; | |
| 685 | return strong_ordering::greater; | |
| 686 | } | |
| 687 | ||
| 688 | #endif // _LIBCPP_STD_VER <= 17 | |
| 689 | ||
| 661 | 690 | namespace this_thread |
| 662 | 691 | { |
| 663 | 692 |
lib/libcxx/include/__tree+43-30| ... | ... | @@ -14,14 +14,32 @@ |
| 14 | 14 | #include <__assert> |
| 15 | 15 | #include <__config> |
| 16 | 16 | #include <__debug> |
| 17 | #include <__functional/invoke.h> | |
| 17 | 18 | #include <__iterator/distance.h> |
| 18 | 19 | #include <__iterator/iterator_traits.h> |
| 19 | 20 | #include <__iterator/next.h> |
| 21 | #include <__memory/allocator_traits.h> | |
| 22 | #include <__memory/compressed_pair.h> | |
| 23 | #include <__memory/pointer_traits.h> | |
| 20 | 24 | #include <__memory/swap_allocator.h> |
| 25 | #include <__memory/unique_ptr.h> | |
| 26 | #include <__type_traits/can_extract_key.h> | |
| 27 | #include <__type_traits/conditional.h> | |
| 28 | #include <__type_traits/is_const.h> | |
| 29 | #include <__type_traits/is_nothrow_copy_constructible.h> | |
| 30 | #include <__type_traits/is_nothrow_default_constructible.h> | |
| 31 | #include <__type_traits/is_nothrow_move_assignable.h> | |
| 32 | #include <__type_traits/is_nothrow_move_constructible.h> | |
| 33 | #include <__type_traits/is_pointer.h> | |
| 34 | #include <__type_traits/is_same.h> | |
| 35 | #include <__type_traits/is_swappable.h> | |
| 36 | #include <__type_traits/remove_const_ref.h> | |
| 37 | #include <__type_traits/remove_cvref.h> | |
| 21 | 38 | #include <__utility/forward.h> |
| 39 | #include <__utility/move.h> | |
| 40 | #include <__utility/pair.h> | |
| 22 | 41 | #include <__utility/swap.h> |
| 23 | 42 | #include <limits> |
| 24 | #include <memory> | |
| 25 | 43 | #include <stdexcept> |
| 26 | 44 | |
| 27 | 45 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -126,7 +144,7 @@ __tree_sub_invariant(_NodePtr __x) |
| 126 | 144 | // __root == nullptr is a proper tree. Returns true is __root is a proper |
| 127 | 145 | // red black tree, else returns false. |
| 128 | 146 | template <class _NodePtr> |
| 129 | bool | |
| 147 | _LIBCPP_HIDE_FROM_ABI bool | |
| 130 | 148 | __tree_invariant(_NodePtr __root) |
| 131 | 149 | { |
| 132 | 150 | if (__root == nullptr) |
| ... | ... | @@ -169,7 +187,7 @@ __tree_max(_NodePtr __x) _NOEXCEPT |
| 169 | 187 | |
| 170 | 188 | // Returns: pointer to the next in-order node after __x. |
| 171 | 189 | template <class _NodePtr> |
| 172 | _NodePtr | |
| 190 | _LIBCPP_HIDE_FROM_ABI _NodePtr | |
| 173 | 191 | __tree_next(_NodePtr __x) _NOEXCEPT |
| 174 | 192 | { |
| 175 | 193 | _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null"); |
| ... | ... | @@ -211,7 +229,7 @@ __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT |
| 211 | 229 | |
| 212 | 230 | // Returns: pointer to a node which has no children |
| 213 | 231 | template <class _NodePtr> |
| 214 | _NodePtr | |
| 232 | _LIBCPP_HIDE_FROM_ABI _NodePtr | |
| 215 | 233 | __tree_leaf(_NodePtr __x) _NOEXCEPT |
| 216 | 234 | { |
| 217 | 235 | _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null"); |
| ... | ... | @@ -235,7 +253,7 @@ __tree_leaf(_NodePtr __x) _NOEXCEPT |
| 235 | 253 | // Effects: Makes __x->__right_ the subtree root with __x as its left child |
| 236 | 254 | // while preserving in-order order. |
| 237 | 255 | template <class _NodePtr> |
| 238 | void | |
| 256 | _LIBCPP_HIDE_FROM_ABI void | |
| 239 | 257 | __tree_left_rotate(_NodePtr __x) _NOEXCEPT |
| 240 | 258 | { |
| 241 | 259 | _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null"); |
| ... | ... | @@ -256,7 +274,7 @@ __tree_left_rotate(_NodePtr __x) _NOEXCEPT |
| 256 | 274 | // Effects: Makes __x->__left_ the subtree root with __x as its right child |
| 257 | 275 | // while preserving in-order order. |
| 258 | 276 | template <class _NodePtr> |
| 259 | void | |
| 277 | _LIBCPP_HIDE_FROM_ABI void | |
| 260 | 278 | __tree_right_rotate(_NodePtr __x) _NOEXCEPT |
| 261 | 279 | { |
| 262 | 280 | _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null"); |
| ... | ... | @@ -282,7 +300,7 @@ __tree_right_rotate(_NodePtr __x) _NOEXCEPT |
| 282 | 300 | // Postcondition: __tree_invariant(end_node->__left_) == true. end_node->__left_ |
| 283 | 301 | // may be different than the value passed in as __root. |
| 284 | 302 | template <class _NodePtr> |
| 285 | void | |
| 303 | _LIBCPP_HIDE_FROM_ABI void | |
| 286 | 304 | __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT |
| 287 | 305 | { |
| 288 | 306 | _LIBCPP_ASSERT(__root != nullptr, "Root of the tree shouldn't be null"); |
| ... | ... | @@ -352,7 +370,7 @@ __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT |
| 352 | 370 | // nor any of its children refer to __z. end_node->__left_ |
| 353 | 371 | // may be different than the value passed in as __root. |
| 354 | 372 | template <class _NodePtr> |
| 355 | void | |
| 373 | _LIBCPP_HIDE_FROM_ABI void | |
| 356 | 374 | __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT |
| 357 | 375 | { |
| 358 | 376 | _LIBCPP_ASSERT(__root != nullptr, "Root node should not be null"); |
| ... | ... | @@ -554,7 +572,7 @@ template <class ..._Args> |
| 554 | 572 | struct __is_tree_value_type : false_type {}; |
| 555 | 573 | |
| 556 | 574 | template <class _One> |
| 557 | struct __is_tree_value_type<_One> : __is_tree_value_type_imp<__uncvref_t<_One> > {}; | |
| 575 | struct __is_tree_value_type<_One> : __is_tree_value_type_imp<__remove_cvref_t<_One> > {}; | |
| 558 | 576 | |
| 559 | 577 | template <class _Tp> |
| 560 | 578 | struct __tree_key_value_types { |
| ... | ... | @@ -632,19 +650,17 @@ struct __tree_node_base_types { |
| 632 | 650 | typedef _VoidPtr __void_pointer; |
| 633 | 651 | |
| 634 | 652 | typedef __tree_node_base<__void_pointer> __node_base_type; |
| 635 | typedef typename __rebind_pointer<_VoidPtr, __node_base_type>::type | |
| 653 | typedef __rebind_pointer_t<_VoidPtr, __node_base_type> | |
| 636 | 654 | __node_base_pointer; |
| 637 | 655 | |
| 638 | 656 | typedef __tree_end_node<__node_base_pointer> __end_node_type; |
| 639 | typedef typename __rebind_pointer<_VoidPtr, __end_node_type>::type | |
| 657 | typedef __rebind_pointer_t<_VoidPtr, __end_node_type> | |
| 640 | 658 | __end_node_pointer; |
| 641 | 659 | #if defined(_LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB) |
| 642 | 660 | typedef __end_node_pointer __parent_pointer; |
| 643 | 661 | #else |
| 644 | typedef typename conditional< | |
| 645 | is_pointer<__end_node_pointer>::value, | |
| 646 | __end_node_pointer, | |
| 647 | __node_base_pointer>::type __parent_pointer; | |
| 662 | typedef __conditional_t< is_pointer<__end_node_pointer>::value, __end_node_pointer, __node_base_pointer> | |
| 663 | __parent_pointer; | |
| 648 | 664 | #endif |
| 649 | 665 | |
| 650 | 666 | private: |
| ... | ... | @@ -659,9 +675,9 @@ struct __tree_map_pointer_types {}; |
| 659 | 675 | template <class _Tp, class _AllocPtr, class _KVTypes> |
| 660 | 676 | struct __tree_map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> { |
| 661 | 677 | typedef typename _KVTypes::__map_value_type _Mv; |
| 662 | typedef typename __rebind_pointer<_AllocPtr, _Mv>::type | |
| 678 | typedef __rebind_pointer_t<_AllocPtr, _Mv> | |
| 663 | 679 | __map_value_type_pointer; |
| 664 | typedef typename __rebind_pointer<_AllocPtr, const _Mv>::type | |
| 680 | typedef __rebind_pointer_t<_AllocPtr, const _Mv> | |
| 665 | 681 | __const_map_value_type_pointer; |
| 666 | 682 | }; |
| 667 | 683 | |
| ... | ... | @@ -683,28 +699,26 @@ public: |
| 683 | 699 | typedef _NodePtr __node_pointer; |
| 684 | 700 | |
| 685 | 701 | typedef _Tp __node_value_type; |
| 686 | typedef typename __rebind_pointer<_VoidPtr, __node_value_type>::type | |
| 702 | typedef __rebind_pointer_t<_VoidPtr, __node_value_type> | |
| 687 | 703 | __node_value_type_pointer; |
| 688 | typedef typename __rebind_pointer<_VoidPtr, const __node_value_type>::type | |
| 704 | typedef __rebind_pointer_t<_VoidPtr, const __node_value_type> | |
| 689 | 705 | __const_node_value_type_pointer; |
| 690 | 706 | #if defined(_LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB) |
| 691 | 707 | typedef typename __base::__end_node_pointer __iter_pointer; |
| 692 | 708 | #else |
| 693 | typedef typename conditional< | |
| 694 | is_pointer<__node_pointer>::value, | |
| 695 | typename __base::__end_node_pointer, | |
| 696 | __node_pointer>::type __iter_pointer; | |
| 709 | typedef __conditional_t< is_pointer<__node_pointer>::value, typename __base::__end_node_pointer, __node_pointer> | |
| 710 | __iter_pointer; | |
| 697 | 711 | #endif |
| 698 | 712 | private: |
| 699 | 713 | static_assert(!is_const<__node_type>::value, |
| 700 | 714 | "_NodePtr should never be a pointer to const"); |
| 701 | static_assert((is_same<typename __rebind_pointer<_VoidPtr, __node_type>::type, | |
| 715 | static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>, | |
| 702 | 716 | _NodePtr>::value), "_VoidPtr does not rebind to _NodePtr."); |
| 703 | 717 | }; |
| 704 | 718 | |
| 705 | 719 | template <class _ValueTp, class _VoidPtr> |
| 706 | 720 | struct __make_tree_node_types { |
| 707 | typedef typename __rebind_pointer<_VoidPtr, __tree_node<_ValueTp, _VoidPtr> >::type | |
| 721 | typedef __rebind_pointer_t<_VoidPtr, __tree_node<_ValueTp, _VoidPtr> > | |
| 708 | 722 | _NodePtr; |
| 709 | 723 | typedef __tree_node_types<_NodePtr> type; |
| 710 | 724 | }; |
| ... | ... | @@ -1019,7 +1033,7 @@ public: |
| 1019 | 1033 | typedef typename _NodeTypes::__parent_pointer __parent_pointer; |
| 1020 | 1034 | typedef typename _NodeTypes::__iter_pointer __iter_pointer; |
| 1021 | 1035 | |
| 1022 | typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; | |
| 1036 | typedef __rebind_alloc<__alloc_traits, __node> __node_allocator; | |
| 1023 | 1037 | typedef allocator_traits<__node_allocator> __node_traits; |
| 1024 | 1038 | |
| 1025 | 1039 | private: |
| ... | ... | @@ -1028,8 +1042,7 @@ private: |
| 1028 | 1042 | // the pointer using 'pointer_traits'. |
| 1029 | 1043 | static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value), |
| 1030 | 1044 | "Allocator does not rebind pointers in a sane manner."); |
| 1031 | typedef typename __rebind_alloc_helper<__node_traits, __node_base>::type | |
| 1032 | __node_base_allocator; | |
| 1045 | typedef __rebind_alloc<__node_traits, __node_base> __node_base_allocator; | |
| 1033 | 1046 | typedef allocator_traits<__node_base_allocator> __node_base_traits; |
| 1034 | 1047 | static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value), |
| 1035 | 1048 | "Allocator does not rebind pointers in a sane manner."); |
| ... | ... | @@ -1271,14 +1284,14 @@ public: |
| 1271 | 1284 | } |
| 1272 | 1285 | |
| 1273 | 1286 | template <class _Vp, |
| 1274 | class = __enable_if_t<!is_same<typename __unconstref<_Vp>::type, __container_value_type>::value> > | |
| 1287 | class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> > | |
| 1275 | 1288 | _LIBCPP_INLINE_VISIBILITY |
| 1276 | 1289 | pair<iterator, bool> __insert_unique(_Vp&& __v) { |
| 1277 | 1290 | return __emplace_unique(_VSTD::forward<_Vp>(__v)); |
| 1278 | 1291 | } |
| 1279 | 1292 | |
| 1280 | 1293 | template <class _Vp, |
| 1281 | class = __enable_if_t<!is_same<typename __unconstref<_Vp>::type, __container_value_type>::value> > | |
| 1294 | class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> > | |
| 1282 | 1295 | _LIBCPP_INLINE_VISIBILITY |
| 1283 | 1296 | iterator __insert_unique(const_iterator __p, _Vp&& __v) { |
| 1284 | 1297 | return __emplace_hint_unique(__p, _VSTD::forward<_Vp>(__v)); |
lib/libcxx/include/__tuple deleted-550| ... | ... | @@ -1,550 +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___TUPLE | |
| 11 | #define _LIBCPP___TUPLE | |
| 12 | ||
| 13 | #include <__config> | |
| 14 | #include <cstddef> | |
| 15 | #include <type_traits> | |
| 16 | ||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 18 | # pragma GCC system_header | |
| 19 | #endif | |
| 20 | ||
| 21 | ||
| 22 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 23 | ||
| 24 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size; | |
| 25 | ||
| 26 | #if !defined(_LIBCPP_CXX03_LANG) | |
| 27 | template <class _Tp, class...> | |
| 28 | using __enable_if_tuple_size_imp = _Tp; | |
| 29 | ||
| 30 | template <class _Tp> | |
| 31 | struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< | |
| 32 | const _Tp, | |
| 33 | __enable_if_t<!is_volatile<_Tp>::value>, | |
| 34 | integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> | |
| 35 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; | |
| 36 | ||
| 37 | template <class _Tp> | |
| 38 | struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< | |
| 39 | volatile _Tp, | |
| 40 | __enable_if_t<!is_const<_Tp>::value>, | |
| 41 | integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> | |
| 42 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; | |
| 43 | ||
| 44 | template <class _Tp> | |
| 45 | struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< | |
| 46 | const volatile _Tp, | |
| 47 | integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> | |
| 48 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; | |
| 49 | ||
| 50 | #else | |
| 51 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {}; | |
| 52 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {}; | |
| 53 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {}; | |
| 54 | #endif | |
| 55 | ||
| 56 | template <size_t _Ip, class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_element; | |
| 57 | ||
| 58 | template <size_t _Ip, class _Tp> | |
| 59 | struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp> | |
| 60 | { | |
| 61 | typedef _LIBCPP_NODEBUG typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type; | |
| 62 | }; | |
| 63 | ||
| 64 | template <size_t _Ip, class _Tp> | |
| 65 | struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp> | |
| 66 | { | |
| 67 | typedef _LIBCPP_NODEBUG typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type; | |
| 68 | }; | |
| 69 | ||
| 70 | template <size_t _Ip, class _Tp> | |
| 71 | struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp> | |
| 72 | { | |
| 73 | typedef _LIBCPP_NODEBUG typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type; | |
| 74 | }; | |
| 75 | ||
| 76 | template <class _Tp> struct __tuple_like : false_type {}; | |
| 77 | ||
| 78 | template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {}; | |
| 79 | template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {}; | |
| 80 | template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {}; | |
| 81 | ||
| 82 | // tuple specializations | |
| 83 | ||
| 84 | #ifndef _LIBCPP_CXX03_LANG | |
| 85 | ||
| 86 | template <size_t...> struct __tuple_indices {}; | |
| 87 | ||
| 88 | template <class _IdxType, _IdxType... _Values> | |
| 89 | struct __integer_sequence { | |
| 90 | template <template <class _OIdxType, _OIdxType...> class _ToIndexSeq, class _ToIndexType> | |
| 91 | using __convert = _ToIndexSeq<_ToIndexType, _Values...>; | |
| 92 | ||
| 93 | template <size_t _Sp> | |
| 94 | using __to_tuple_indices = __tuple_indices<(_Values + _Sp)...>; | |
| 95 | }; | |
| 96 | ||
| 97 | #if !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) | |
| 98 | namespace __detail { | |
| 99 | ||
| 100 | template<typename _Tp, size_t ..._Extra> struct __repeat; | |
| 101 | template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> { | |
| 102 | typedef _LIBCPP_NODEBUG __integer_sequence<_Tp, | |
| 103 | _Np..., | |
| 104 | sizeof...(_Np) + _Np..., | |
| 105 | 2 * sizeof...(_Np) + _Np..., | |
| 106 | 3 * sizeof...(_Np) + _Np..., | |
| 107 | 4 * sizeof...(_Np) + _Np..., | |
| 108 | 5 * sizeof...(_Np) + _Np..., | |
| 109 | 6 * sizeof...(_Np) + _Np..., | |
| 110 | 7 * sizeof...(_Np) + _Np..., | |
| 111 | _Extra...> type; | |
| 112 | }; | |
| 113 | ||
| 114 | template<size_t _Np> struct __parity; | |
| 115 | template<size_t _Np> struct __make : __parity<_Np % 8>::template __pmake<_Np> {}; | |
| 116 | ||
| 117 | template<> struct __make<0> { typedef __integer_sequence<size_t> type; }; | |
| 118 | template<> struct __make<1> { typedef __integer_sequence<size_t, 0> type; }; | |
| 119 | template<> struct __make<2> { typedef __integer_sequence<size_t, 0, 1> type; }; | |
| 120 | template<> struct __make<3> { typedef __integer_sequence<size_t, 0, 1, 2> type; }; | |
| 121 | template<> struct __make<4> { typedef __integer_sequence<size_t, 0, 1, 2, 3> type; }; | |
| 122 | template<> struct __make<5> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4> type; }; | |
| 123 | template<> struct __make<6> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5> type; }; | |
| 124 | template<> struct __make<7> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5, 6> type; }; | |
| 125 | ||
| 126 | template<> struct __parity<0> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type> {}; }; | |
| 127 | template<> struct __parity<1> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 1> {}; }; | |
| 128 | template<> struct __parity<2> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 2, _Np - 1> {}; }; | |
| 129 | template<> struct __parity<3> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 3, _Np - 2, _Np - 1> {}; }; | |
| 130 | template<> struct __parity<4> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; | |
| 131 | template<> struct __parity<5> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; | |
| 132 | template<> struct __parity<6> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; | |
| 133 | template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 7, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; | |
| 134 | ||
| 135 | } // namespace detail | |
| 136 | ||
| 137 | #endif // !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) | |
| 138 | ||
| 139 | #if __has_builtin(__make_integer_seq) | |
| 140 | template <size_t _Ep, size_t _Sp> | |
| 141 | using __make_indices_imp = | |
| 142 | typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template | |
| 143 | __to_tuple_indices<_Sp>; | |
| 144 | #else | |
| 145 | template <size_t _Ep, size_t _Sp> | |
| 146 | using __make_indices_imp = | |
| 147 | typename __detail::__make<_Ep - _Sp>::type::template __to_tuple_indices<_Sp>; | |
| 148 | ||
| 149 | #endif | |
| 150 | ||
| 151 | template <size_t _Ep, size_t _Sp = 0> | |
| 152 | struct __make_tuple_indices | |
| 153 | { | |
| 154 | static_assert(_Sp <= _Ep, "__make_tuple_indices input error"); | |
| 155 | typedef __make_indices_imp<_Ep, _Sp> type; | |
| 156 | }; | |
| 157 | ||
| 158 | ||
| 159 | template <class ..._Tp> class _LIBCPP_TEMPLATE_VIS tuple; | |
| 160 | ||
| 161 | template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {}; | |
| 162 | ||
| 163 | template <class ..._Tp> | |
| 164 | struct _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> > | |
| 165 | : public integral_constant<size_t, sizeof...(_Tp)> | |
| 166 | { | |
| 167 | }; | |
| 168 | ||
| 169 | template <size_t _Ip, class ..._Tp> | |
| 170 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 171 | typename tuple_element<_Ip, tuple<_Tp...> >::type& | |
| 172 | get(tuple<_Tp...>&) _NOEXCEPT; | |
| 173 | ||
| 174 | template <size_t _Ip, class ..._Tp> | |
| 175 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 176 | const typename tuple_element<_Ip, tuple<_Tp...> >::type& | |
| 177 | get(const tuple<_Tp...>&) _NOEXCEPT; | |
| 178 | ||
| 179 | template <size_t _Ip, class ..._Tp> | |
| 180 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 181 | typename tuple_element<_Ip, tuple<_Tp...> >::type&& | |
| 182 | get(tuple<_Tp...>&&) _NOEXCEPT; | |
| 183 | ||
| 184 | template <size_t _Ip, class ..._Tp> | |
| 185 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 186 | const typename tuple_element<_Ip, tuple<_Tp...> >::type&& | |
| 187 | get(const tuple<_Tp...>&&) _NOEXCEPT; | |
| 188 | ||
| 189 | #endif // !defined(_LIBCPP_CXX03_LANG) | |
| 190 | ||
| 191 | // pair specializations | |
| 192 | ||
| 193 | template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {}; | |
| 194 | ||
| 195 | template <size_t _Ip, class _T1, class _T2> | |
| 196 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 197 | typename tuple_element<_Ip, pair<_T1, _T2> >::type& | |
| 198 | get(pair<_T1, _T2>&) _NOEXCEPT; | |
| 199 | ||
| 200 | template <size_t _Ip, class _T1, class _T2> | |
| 201 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 202 | const typename tuple_element<_Ip, pair<_T1, _T2> >::type& | |
| 203 | get(const pair<_T1, _T2>&) _NOEXCEPT; | |
| 204 | ||
| 205 | #ifndef _LIBCPP_CXX03_LANG | |
| 206 | template <size_t _Ip, class _T1, class _T2> | |
| 207 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 208 | typename tuple_element<_Ip, pair<_T1, _T2> >::type&& | |
| 209 | get(pair<_T1, _T2>&&) _NOEXCEPT; | |
| 210 | ||
| 211 | template <size_t _Ip, class _T1, class _T2> | |
| 212 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 213 | const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& | |
| 214 | get(const pair<_T1, _T2>&&) _NOEXCEPT; | |
| 215 | #endif | |
| 216 | ||
| 217 | // array specializations | |
| 218 | ||
| 219 | template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array; | |
| 220 | ||
| 221 | template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {}; | |
| 222 | ||
| 223 | template <size_t _Ip, class _Tp, size_t _Size> | |
| 224 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 225 | _Tp& | |
| 226 | get(array<_Tp, _Size>&) _NOEXCEPT; | |
| 227 | ||
| 228 | template <size_t _Ip, class _Tp, size_t _Size> | |
| 229 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 230 | const _Tp& | |
| 231 | get(const array<_Tp, _Size>&) _NOEXCEPT; | |
| 232 | ||
| 233 | #ifndef _LIBCPP_CXX03_LANG | |
| 234 | template <size_t _Ip, class _Tp, size_t _Size> | |
| 235 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 236 | _Tp&& | |
| 237 | get(array<_Tp, _Size>&&) _NOEXCEPT; | |
| 238 | ||
| 239 | template <size_t _Ip, class _Tp, size_t _Size> | |
| 240 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 241 | const _Tp&& | |
| 242 | get(const array<_Tp, _Size>&&) _NOEXCEPT; | |
| 243 | #endif | |
| 244 | ||
| 245 | #ifndef _LIBCPP_CXX03_LANG | |
| 246 | ||
| 247 | // __tuple_types | |
| 248 | ||
| 249 | template <class ..._Tp> struct __tuple_types {}; | |
| 250 | ||
| 251 | #if !__has_builtin(__type_pack_element) | |
| 252 | ||
| 253 | namespace __indexer_detail { | |
| 254 | ||
| 255 | template <size_t _Idx, class _Tp> | |
| 256 | struct __indexed { using type _LIBCPP_NODEBUG = _Tp; }; | |
| 257 | ||
| 258 | template <class _Types, class _Indexes> struct __indexer; | |
| 259 | ||
| 260 | template <class ..._Types, size_t ..._Idx> | |
| 261 | struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>> | |
| 262 | : __indexed<_Idx, _Types>... | |
| 263 | {}; | |
| 264 | ||
| 265 | template <size_t _Idx, class _Tp> | |
| 266 | __indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&); | |
| 267 | ||
| 268 | } // namespace __indexer_detail | |
| 269 | ||
| 270 | template <size_t _Idx, class ..._Types> | |
| 271 | using __type_pack_element _LIBCPP_NODEBUG = typename decltype( | |
| 272 | __indexer_detail::__at_index<_Idx>( | |
| 273 | __indexer_detail::__indexer< | |
| 274 | __tuple_types<_Types...>, | |
| 275 | typename __make_tuple_indices<sizeof...(_Types)>::type | |
| 276 | >{}) | |
| 277 | )::type; | |
| 278 | #endif | |
| 279 | ||
| 280 | template <size_t _Ip, class ..._Types> | |
| 281 | struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> > | |
| 282 | { | |
| 283 | static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range"); | |
| 284 | typedef _LIBCPP_NODEBUG __type_pack_element<_Ip, _Types...> type; | |
| 285 | }; | |
| 286 | ||
| 287 | ||
| 288 | template <class ..._Tp> | |
| 289 | struct _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> > | |
| 290 | : public integral_constant<size_t, sizeof...(_Tp)> | |
| 291 | { | |
| 292 | }; | |
| 293 | ||
| 294 | template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {}; | |
| 295 | ||
| 296 | template <bool _ApplyLV, bool _ApplyConst, bool _ApplyVolatile> | |
| 297 | struct __apply_cv_mf; | |
| 298 | template <> | |
| 299 | struct __apply_cv_mf<false, false, false> { | |
| 300 | template <class _Tp> using __apply = _Tp; | |
| 301 | }; | |
| 302 | template <> | |
| 303 | struct __apply_cv_mf<false, true, false> { | |
| 304 | template <class _Tp> using __apply _LIBCPP_NODEBUG = const _Tp; | |
| 305 | }; | |
| 306 | template <> | |
| 307 | struct __apply_cv_mf<false, false, true> { | |
| 308 | template <class _Tp> using __apply _LIBCPP_NODEBUG = volatile _Tp; | |
| 309 | }; | |
| 310 | template <> | |
| 311 | struct __apply_cv_mf<false, true, true> { | |
| 312 | template <class _Tp> using __apply _LIBCPP_NODEBUG = const volatile _Tp; | |
| 313 | }; | |
| 314 | template <> | |
| 315 | struct __apply_cv_mf<true, false, false> { | |
| 316 | template <class _Tp> using __apply _LIBCPP_NODEBUG = _Tp&; | |
| 317 | }; | |
| 318 | template <> | |
| 319 | struct __apply_cv_mf<true, true, false> { | |
| 320 | template <class _Tp> using __apply _LIBCPP_NODEBUG = const _Tp&; | |
| 321 | }; | |
| 322 | template <> | |
| 323 | struct __apply_cv_mf<true, false, true> { | |
| 324 | template <class _Tp> using __apply _LIBCPP_NODEBUG = volatile _Tp&; | |
| 325 | }; | |
| 326 | template <> | |
| 327 | struct __apply_cv_mf<true, true, true> { | |
| 328 | template <class _Tp> using __apply _LIBCPP_NODEBUG = const volatile _Tp&; | |
| 329 | }; | |
| 330 | template <class _Tp, class _RawTp = typename remove_reference<_Tp>::type> | |
| 331 | using __apply_cv_t _LIBCPP_NODEBUG = __apply_cv_mf< | |
| 332 | is_lvalue_reference<_Tp>::value, | |
| 333 | is_const<_RawTp>::value, | |
| 334 | is_volatile<_RawTp>::value>; | |
| 335 | ||
| 336 | // __make_tuple_types | |
| 337 | ||
| 338 | // __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a | |
| 339 | // __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep). | |
| 340 | // _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a | |
| 341 | // lvalue_reference type, then __tuple_types<_Types&...> is the result. | |
| 342 | ||
| 343 | template <class _TupleTypes, class _TupleIndices> | |
| 344 | struct __make_tuple_types_flat; | |
| 345 | ||
| 346 | template <template <class...> class _Tuple, class ..._Types, size_t ..._Idx> | |
| 347 | struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> { | |
| 348 | // Specialization for pair, tuple, and __tuple_types | |
| 349 | template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>> | |
| 350 | using __apply_quals _LIBCPP_NODEBUG = __tuple_types< | |
| 351 | typename _ApplyFn::template __apply<__type_pack_element<_Idx, _Types...>>... | |
| 352 | >; | |
| 353 | }; | |
| 354 | ||
| 355 | template <class _Vt, size_t _Np, size_t ..._Idx> | |
| 356 | struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> { | |
| 357 | template <size_t> | |
| 358 | using __value_type = _Vt; | |
| 359 | template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>> | |
| 360 | using __apply_quals = __tuple_types< | |
| 361 | typename _ApplyFn::template __apply<__value_type<_Idx>>... | |
| 362 | >; | |
| 363 | }; | |
| 364 | ||
| 365 | template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, | |
| 366 | size_t _Sp = 0, | |
| 367 | bool _SameSize = (_Ep == tuple_size<typename remove_reference<_Tp>::type>::value)> | |
| 368 | struct __make_tuple_types | |
| 369 | { | |
| 370 | static_assert(_Sp <= _Ep, "__make_tuple_types input error"); | |
| 371 | using _RawTp = typename remove_cv<typename remove_reference<_Tp>::type>::type; | |
| 372 | using _Maker = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>; | |
| 373 | using type = typename _Maker::template __apply_quals<_Tp>; | |
| 374 | }; | |
| 375 | ||
| 376 | template <class ..._Types, size_t _Ep> | |
| 377 | struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> { | |
| 378 | typedef _LIBCPP_NODEBUG __tuple_types<_Types...> type; | |
| 379 | }; | |
| 380 | ||
| 381 | template <class ..._Types, size_t _Ep> | |
| 382 | struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> { | |
| 383 | typedef _LIBCPP_NODEBUG __tuple_types<_Types...> type; | |
| 384 | }; | |
| 385 | ||
| 386 | template <bool ..._Preds> | |
| 387 | struct __all_dummy; | |
| 388 | ||
| 389 | template <bool ..._Pred> | |
| 390 | struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>> {}; | |
| 391 | ||
| 392 | struct __tuple_sfinae_base { | |
| 393 | template <template <class, class...> class _Trait, | |
| 394 | class ..._LArgs, class ..._RArgs> | |
| 395 | static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>) | |
| 396 | -> __all<__enable_if_t<_Trait<_LArgs, _RArgs>::value, bool>{true}...>; | |
| 397 | template <template <class...> class> | |
| 398 | static auto __do_test(...) -> false_type; | |
| 399 | ||
| 400 | template <class _FromArgs, class _ToArgs> | |
| 401 | using __constructible = decltype(__do_test<is_constructible>(_ToArgs{}, _FromArgs{})); | |
| 402 | template <class _FromArgs, class _ToArgs> | |
| 403 | using __convertible = decltype(__do_test<is_convertible>(_FromArgs{}, _ToArgs{})); | |
| 404 | template <class _FromArgs, class _ToArgs> | |
| 405 | using __assignable = decltype(__do_test<is_assignable>(_ToArgs{}, _FromArgs{})); | |
| 406 | }; | |
| 407 | ||
| 408 | // __tuple_convertible | |
| 409 | ||
| 410 | template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, | |
| 411 | bool = __tuple_like<_Up>::value> | |
| 412 | struct __tuple_convertible | |
| 413 | : public false_type {}; | |
| 414 | ||
| 415 | template <class _Tp, class _Up> | |
| 416 | struct __tuple_convertible<_Tp, _Up, true, true> | |
| 417 | : public __tuple_sfinae_base::__convertible< | |
| 418 | typename __make_tuple_types<_Tp>::type | |
| 419 | , typename __make_tuple_types<_Up>::type | |
| 420 | > | |
| 421 | {}; | |
| 422 | ||
| 423 | // __tuple_constructible | |
| 424 | ||
| 425 | template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, | |
| 426 | bool = __tuple_like<_Up>::value> | |
| 427 | struct __tuple_constructible | |
| 428 | : public false_type {}; | |
| 429 | ||
| 430 | template <class _Tp, class _Up> | |
| 431 | struct __tuple_constructible<_Tp, _Up, true, true> | |
| 432 | : public __tuple_sfinae_base::__constructible< | |
| 433 | typename __make_tuple_types<_Tp>::type | |
| 434 | , typename __make_tuple_types<_Up>::type | |
| 435 | > | |
| 436 | {}; | |
| 437 | ||
| 438 | // __tuple_assignable | |
| 439 | ||
| 440 | template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, | |
| 441 | bool = __tuple_like<_Up>::value> | |
| 442 | struct __tuple_assignable | |
| 443 | : public false_type {}; | |
| 444 | ||
| 445 | template <class _Tp, class _Up> | |
| 446 | struct __tuple_assignable<_Tp, _Up, true, true> | |
| 447 | : public __tuple_sfinae_base::__assignable< | |
| 448 | typename __make_tuple_types<_Tp>::type | |
| 449 | , typename __make_tuple_types<_Up&>::type | |
| 450 | > | |
| 451 | {}; | |
| 452 | ||
| 453 | ||
| 454 | template <size_t _Ip, class ..._Tp> | |
| 455 | struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> > | |
| 456 | { | |
| 457 | typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type; | |
| 458 | }; | |
| 459 | ||
| 460 | #if _LIBCPP_STD_VER > 11 | |
| 461 | template <size_t _Ip, class ..._Tp> | |
| 462 | using tuple_element_t _LIBCPP_NODEBUG = typename tuple_element <_Ip, _Tp...>::type; | |
| 463 | #endif | |
| 464 | ||
| 465 | template <bool _IsTuple, class _SizeTrait, size_t _Expected> | |
| 466 | struct __tuple_like_with_size_imp : false_type {}; | |
| 467 | ||
| 468 | template <class _SizeTrait, size_t _Expected> | |
| 469 | struct __tuple_like_with_size_imp<true, _SizeTrait, _Expected> | |
| 470 | : integral_constant<bool, _SizeTrait::value == _Expected> {}; | |
| 471 | ||
| 472 | template <class _Tuple, size_t _ExpectedSize, class _RawTuple = __uncvref_t<_Tuple> > | |
| 473 | using __tuple_like_with_size _LIBCPP_NODEBUG = __tuple_like_with_size_imp< | |
| 474 | __tuple_like<_RawTuple>::value, | |
| 475 | tuple_size<_RawTuple>, _ExpectedSize | |
| 476 | >; | |
| 477 | ||
| 478 | struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail { | |
| 479 | ||
| 480 | static constexpr bool __enable_explicit_default() { return false; } | |
| 481 | static constexpr bool __enable_implicit_default() { return false; } | |
| 482 | template <class ...> | |
| 483 | static constexpr bool __enable_explicit() { return false; } | |
| 484 | template <class ...> | |
| 485 | static constexpr bool __enable_implicit() { return false; } | |
| 486 | template <class ...> | |
| 487 | static constexpr bool __enable_assign() { return false; } | |
| 488 | }; | |
| 489 | #endif // !defined(_LIBCPP_CXX03_LANG) | |
| 490 | ||
| 491 | #if _LIBCPP_STD_VER > 14 | |
| 492 | ||
| 493 | template <bool _CanCopy, bool _CanMove> | |
| 494 | struct __sfinae_ctor_base {}; | |
| 495 | template <> | |
| 496 | struct __sfinae_ctor_base<false, false> { | |
| 497 | __sfinae_ctor_base() = default; | |
| 498 | __sfinae_ctor_base(__sfinae_ctor_base const&) = delete; | |
| 499 | __sfinae_ctor_base(__sfinae_ctor_base &&) = delete; | |
| 500 | __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; | |
| 501 | __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; | |
| 502 | }; | |
| 503 | template <> | |
| 504 | struct __sfinae_ctor_base<true, false> { | |
| 505 | __sfinae_ctor_base() = default; | |
| 506 | __sfinae_ctor_base(__sfinae_ctor_base const&) = default; | |
| 507 | __sfinae_ctor_base(__sfinae_ctor_base &&) = delete; | |
| 508 | __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; | |
| 509 | __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; | |
| 510 | }; | |
| 511 | template <> | |
| 512 | struct __sfinae_ctor_base<false, true> { | |
| 513 | __sfinae_ctor_base() = default; | |
| 514 | __sfinae_ctor_base(__sfinae_ctor_base const&) = delete; | |
| 515 | __sfinae_ctor_base(__sfinae_ctor_base &&) = default; | |
| 516 | __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; | |
| 517 | __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; | |
| 518 | }; | |
| 519 | ||
| 520 | template <bool _CanCopy, bool _CanMove> | |
| 521 | struct __sfinae_assign_base {}; | |
| 522 | template <> | |
| 523 | struct __sfinae_assign_base<false, false> { | |
| 524 | __sfinae_assign_base() = default; | |
| 525 | __sfinae_assign_base(__sfinae_assign_base const&) = default; | |
| 526 | __sfinae_assign_base(__sfinae_assign_base &&) = default; | |
| 527 | __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete; | |
| 528 | __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete; | |
| 529 | }; | |
| 530 | template <> | |
| 531 | struct __sfinae_assign_base<true, false> { | |
| 532 | __sfinae_assign_base() = default; | |
| 533 | __sfinae_assign_base(__sfinae_assign_base const&) = default; | |
| 534 | __sfinae_assign_base(__sfinae_assign_base &&) = default; | |
| 535 | __sfinae_assign_base& operator=(__sfinae_assign_base const&) = default; | |
| 536 | __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete; | |
| 537 | }; | |
| 538 | template <> | |
| 539 | struct __sfinae_assign_base<false, true> { | |
| 540 | __sfinae_assign_base() = default; | |
| 541 | __sfinae_assign_base(__sfinae_assign_base const&) = default; | |
| 542 | __sfinae_assign_base(__sfinae_assign_base &&) = default; | |
| 543 | __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete; | |
| 544 | __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default; | |
| 545 | }; | |
| 546 | #endif // _LIBCPP_STD_VER > 14 | |
| 547 | ||
| 548 | _LIBCPP_END_NAMESPACE_STD | |
| 549 | ||
| 550 | #endif // _LIBCPP___TUPLE |
lib/libcxx/include/__tuple_dir/apply_cv.h created+70| ... | ... | @@ -0,0 +1,70 @@ |
| 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_APPLY_CV_H | |
| 10 | #define _LIBCPP___TUPLE_APPLY_CV_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/is_const.h> | |
| 14 | #include <__type_traits/is_reference.h> | |
| 15 | #include <__type_traits/is_volatile.h> | |
| 16 | #include <__type_traits/remove_reference.h> | |
| 17 | ||
| 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 19 | # pragma GCC system_header | |
| 20 | #endif | |
| 21 | ||
| 22 | #ifndef _LIBCPP_CXX03_LANG | |
| 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 25 | ||
| 26 | template <bool _ApplyLV, bool _ApplyConst, bool _ApplyVolatile> | |
| 27 | struct __apply_cv_mf; | |
| 28 | template <> | |
| 29 | struct __apply_cv_mf<false, false, false> { | |
| 30 | template <class _Tp> using __apply = _Tp; | |
| 31 | }; | |
| 32 | template <> | |
| 33 | struct __apply_cv_mf<false, true, false> { | |
| 34 | template <class _Tp> using __apply _LIBCPP_NODEBUG = const _Tp; | |
| 35 | }; | |
| 36 | template <> | |
| 37 | struct __apply_cv_mf<false, false, true> { | |
| 38 | template <class _Tp> using __apply _LIBCPP_NODEBUG = volatile _Tp; | |
| 39 | }; | |
| 40 | template <> | |
| 41 | struct __apply_cv_mf<false, true, true> { | |
| 42 | template <class _Tp> using __apply _LIBCPP_NODEBUG = const volatile _Tp; | |
| 43 | }; | |
| 44 | template <> | |
| 45 | struct __apply_cv_mf<true, false, false> { | |
| 46 | template <class _Tp> using __apply _LIBCPP_NODEBUG = _Tp&; | |
| 47 | }; | |
| 48 | template <> | |
| 49 | struct __apply_cv_mf<true, true, false> { | |
| 50 | template <class _Tp> using __apply _LIBCPP_NODEBUG = const _Tp&; | |
| 51 | }; | |
| 52 | template <> | |
| 53 | struct __apply_cv_mf<true, false, true> { | |
| 54 | template <class _Tp> using __apply _LIBCPP_NODEBUG = volatile _Tp&; | |
| 55 | }; | |
| 56 | template <> | |
| 57 | struct __apply_cv_mf<true, true, true> { | |
| 58 | template <class _Tp> using __apply _LIBCPP_NODEBUG = const volatile _Tp&; | |
| 59 | }; | |
| 60 | template <class _Tp, class _RawTp = __libcpp_remove_reference_t<_Tp> > | |
| 61 | using __apply_cv_t _LIBCPP_NODEBUG = __apply_cv_mf< | |
| 62 | is_lvalue_reference<_Tp>::value, | |
| 63 | is_const<_RawTp>::value, | |
| 64 | is_volatile<_RawTp>::value>; | |
| 65 | ||
| 66 | _LIBCPP_END_NAMESPACE_STD | |
| 67 | ||
| 68 | #endif // _LIBCPP_CXX03_LANG | |
| 69 | ||
| 70 | #endif // _LIBCPP___TUPLE_APPLY_CV_H |
lib/libcxx/include/__tuple_dir/make_tuple_types.h created+84| ... | ... | @@ -0,0 +1,84 @@ |
| 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 <__fwd/array.h> | |
| 14 | #include <__fwd/tuple.h> | |
| 15 | #include <__tuple_dir/apply_cv.h> | |
| 16 | #include <__tuple_dir/tuple_element.h> | |
| 17 | #include <__tuple_dir/tuple_indices.h> | |
| 18 | #include <__tuple_dir/tuple_size.h> | |
| 19 | #include <__tuple_dir/tuple_types.h> | |
| 20 | #include <__type_traits/remove_cv.h> | |
| 21 | #include <__type_traits/remove_reference.h> | |
| 22 | #include <cstddef> | |
| 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, class _ApplyFn = __apply_cv_t<_Tp>> | |
| 44 | using __apply_quals _LIBCPP_NODEBUG = __tuple_types< | |
| 45 | typename _ApplyFn::template __apply<__type_pack_element<_Idx, _Types...>>... | |
| 46 | >; | |
| 47 | }; | |
| 48 | ||
| 49 | template <class _Vt, size_t _Np, size_t ..._Idx> | |
| 50 | struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> { | |
| 51 | template <size_t> | |
| 52 | using __value_type = _Vt; | |
| 53 | template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>> | |
| 54 | using __apply_quals = __tuple_types< | |
| 55 | typename _ApplyFn::template __apply<__value_type<_Idx>>... | |
| 56 | >; | |
| 57 | }; | |
| 58 | ||
| 59 | template <class _Tp, size_t _Ep = tuple_size<__libcpp_remove_reference_t<_Tp> >::value, | |
| 60 | size_t _Sp = 0, | |
| 61 | bool _SameSize = (_Ep == tuple_size<__libcpp_remove_reference_t<_Tp> >::value)> | |
| 62 | struct __make_tuple_types | |
| 63 | { | |
| 64 | static_assert(_Sp <= _Ep, "__make_tuple_types input error"); | |
| 65 | using _RawTp = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >; | |
| 66 | using _Maker = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>; | |
| 67 | using type = typename _Maker::template __apply_quals<_Tp>; | |
| 68 | }; | |
| 69 | ||
| 70 | template <class ..._Types, size_t _Ep> | |
| 71 | struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> { | |
| 72 | typedef _LIBCPP_NODEBUG __tuple_types<_Types...> type; | |
| 73 | }; | |
| 74 | ||
| 75 | template <class ..._Types, size_t _Ep> | |
| 76 | struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> { | |
| 77 | typedef _LIBCPP_NODEBUG __tuple_types<_Types...> type; | |
| 78 | }; | |
| 79 | ||
| 80 | _LIBCPP_END_NAMESPACE_STD | |
| 81 | ||
| 82 | #endif // _LIBCPP_CXX03_LANG | |
| 83 | ||
| 84 | #endif // _LIBCPP___TUPLE_MAKE_TUPLE_TYPES_H |
lib/libcxx/include/__tuple_dir/pair_like.h created+32| ... | ... | @@ -0,0 +1,32 @@ |
| 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_PAIR_LIKE_H | |
| 10 | #define _LIBCPP___TUPLE_PAIR_LIKE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__tuple_dir/tuple_like.h> | |
| 14 | #include <__tuple_dir/tuple_size.h> | |
| 15 | #include <__type_traits/remove_cvref.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 | #if _LIBCPP_STD_VER >= 20 | |
| 24 | ||
| 25 | template <class _Tp> | |
| 26 | concept __pair_like = __tuple_like<_Tp> && tuple_size<remove_cvref_t<_Tp>>::value == 2; | |
| 27 | ||
| 28 | #endif // _LIBCPP_STD_VER >= 20 | |
| 29 | ||
| 30 | _LIBCPP_END_NAMESPACE_STD | |
| 31 | ||
| 32 | #endif // _LIBCPP___TUPLE_PAIR_LIKE_H |
lib/libcxx/include/__tuple_dir/sfinae_helpers.h created+196| ... | ... | @@ -0,0 +1,196 @@ |
| 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_SFINAE_HELPERS_H | |
| 10 | #define _LIBCPP___TUPLE_SFINAE_HELPERS_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__fwd/tuple.h> | |
| 14 | #include <__tuple_dir/make_tuple_types.h> | |
| 15 | #include <__tuple_dir/tuple_element.h> | |
| 16 | #include <__tuple_dir/tuple_like_ext.h> | |
| 17 | #include <__tuple_dir/tuple_size.h> | |
| 18 | #include <__tuple_dir/tuple_types.h> | |
| 19 | #include <__type_traits/enable_if.h> | |
| 20 | #include <__type_traits/integral_constant.h> | |
| 21 | #include <__type_traits/is_assignable.h> | |
| 22 | #include <__type_traits/is_constructible.h> | |
| 23 | #include <__type_traits/is_convertible.h> | |
| 24 | #include <__type_traits/is_same.h> | |
| 25 | #include <__type_traits/remove_cvref.h> | |
| 26 | #include <__type_traits/remove_reference.h> | |
| 27 | #include <cstddef> | |
| 28 | ||
| 29 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 30 | # pragma GCC system_header | |
| 31 | #endif | |
| 32 | ||
| 33 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 34 | ||
| 35 | #ifndef _LIBCPP_CXX03_LANG | |
| 36 | ||
| 37 | template <bool ..._Preds> | |
| 38 | struct __all_dummy; | |
| 39 | ||
| 40 | template <bool ..._Pred> | |
| 41 | struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>> {}; | |
| 42 | ||
| 43 | struct __tuple_sfinae_base { | |
| 44 | template <template <class, class...> class _Trait, | |
| 45 | class ..._LArgs, class ..._RArgs> | |
| 46 | static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>) | |
| 47 | -> __all<__enable_if_t<_Trait<_LArgs, _RArgs>::value, bool>{true}...>; | |
| 48 | template <template <class...> class> | |
| 49 | static auto __do_test(...) -> false_type; | |
| 50 | ||
| 51 | template <class _FromArgs, class _ToArgs> | |
| 52 | using __constructible = decltype(__do_test<is_constructible>(_ToArgs{}, _FromArgs{})); | |
| 53 | template <class _FromArgs, class _ToArgs> | |
| 54 | using __convertible = decltype(__do_test<is_convertible>(_FromArgs{}, _ToArgs{})); | |
| 55 | template <class _FromArgs, class _ToArgs> | |
| 56 | using __assignable = decltype(__do_test<is_assignable>(_ToArgs{}, _FromArgs{})); | |
| 57 | }; | |
| 58 | ||
| 59 | // __tuple_convertible | |
| 60 | ||
| 61 | template <class _Tp, class _Up, bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value, | |
| 62 | bool = __tuple_like_ext<_Up>::value> | |
| 63 | struct __tuple_convertible | |
| 64 | : public false_type {}; | |
| 65 | ||
| 66 | template <class _Tp, class _Up> | |
| 67 | struct __tuple_convertible<_Tp, _Up, true, true> | |
| 68 | : public __tuple_sfinae_base::__convertible< | |
| 69 | typename __make_tuple_types<_Tp>::type | |
| 70 | , typename __make_tuple_types<_Up>::type | |
| 71 | > | |
| 72 | {}; | |
| 73 | ||
| 74 | // __tuple_constructible | |
| 75 | ||
| 76 | template <class _Tp, class _Up, bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value, | |
| 77 | bool = __tuple_like_ext<_Up>::value> | |
| 78 | struct __tuple_constructible | |
| 79 | : public false_type {}; | |
| 80 | ||
| 81 | template <class _Tp, class _Up> | |
| 82 | struct __tuple_constructible<_Tp, _Up, true, true> | |
| 83 | : public __tuple_sfinae_base::__constructible< | |
| 84 | typename __make_tuple_types<_Tp>::type | |
| 85 | , typename __make_tuple_types<_Up>::type | |
| 86 | > | |
| 87 | {}; | |
| 88 | ||
| 89 | // __tuple_assignable | |
| 90 | ||
| 91 | template <class _Tp, class _Up, bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value, | |
| 92 | bool = __tuple_like_ext<_Up>::value> | |
| 93 | struct __tuple_assignable | |
| 94 | : public false_type {}; | |
| 95 | ||
| 96 | template <class _Tp, class _Up> | |
| 97 | struct __tuple_assignable<_Tp, _Up, true, true> | |
| 98 | : public __tuple_sfinae_base::__assignable< | |
| 99 | typename __make_tuple_types<_Tp>::type | |
| 100 | , typename __make_tuple_types<_Up&>::type | |
| 101 | > | |
| 102 | {}; | |
| 103 | ||
| 104 | ||
| 105 | template <size_t _Ip, class ..._Tp> | |
| 106 | struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> > | |
| 107 | { | |
| 108 | typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type; | |
| 109 | }; | |
| 110 | ||
| 111 | template <bool _IsTuple, class _SizeTrait, size_t _Expected> | |
| 112 | struct __tuple_like_with_size_imp : false_type {}; | |
| 113 | ||
| 114 | template <class _SizeTrait, size_t _Expected> | |
| 115 | struct __tuple_like_with_size_imp<true, _SizeTrait, _Expected> | |
| 116 | : integral_constant<bool, _SizeTrait::value == _Expected> {}; | |
| 117 | ||
| 118 | template <class _Tuple, size_t _ExpectedSize, class _RawTuple = __libcpp_remove_reference_t<_Tuple> > | |
| 119 | using __tuple_like_with_size _LIBCPP_NODEBUG = __tuple_like_with_size_imp< | |
| 120 | __tuple_like_ext<_RawTuple>::value, | |
| 121 | tuple_size<_RawTuple>, _ExpectedSize | |
| 122 | >; | |
| 123 | ||
| 124 | struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail { | |
| 125 | ||
| 126 | static constexpr bool __enable_explicit_default() { return false; } | |
| 127 | static constexpr bool __enable_implicit_default() { return false; } | |
| 128 | template <class ...> | |
| 129 | static constexpr bool __enable_explicit() { return false; } | |
| 130 | template <class ...> | |
| 131 | static constexpr bool __enable_implicit() { return false; } | |
| 132 | template <class ...> | |
| 133 | static constexpr bool __enable_assign() { return false; } | |
| 134 | }; | |
| 135 | #endif // !defined(_LIBCPP_CXX03_LANG) | |
| 136 | ||
| 137 | #if _LIBCPP_STD_VER > 14 | |
| 138 | ||
| 139 | template <bool _CanCopy, bool _CanMove> | |
| 140 | struct __sfinae_ctor_base {}; | |
| 141 | template <> | |
| 142 | struct __sfinae_ctor_base<false, false> { | |
| 143 | __sfinae_ctor_base() = default; | |
| 144 | __sfinae_ctor_base(__sfinae_ctor_base const&) = delete; | |
| 145 | __sfinae_ctor_base(__sfinae_ctor_base &&) = delete; | |
| 146 | __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; | |
| 147 | __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; | |
| 148 | }; | |
| 149 | template <> | |
| 150 | struct __sfinae_ctor_base<true, false> { | |
| 151 | __sfinae_ctor_base() = default; | |
| 152 | __sfinae_ctor_base(__sfinae_ctor_base const&) = default; | |
| 153 | __sfinae_ctor_base(__sfinae_ctor_base &&) = delete; | |
| 154 | __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; | |
| 155 | __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; | |
| 156 | }; | |
| 157 | template <> | |
| 158 | struct __sfinae_ctor_base<false, true> { | |
| 159 | __sfinae_ctor_base() = default; | |
| 160 | __sfinae_ctor_base(__sfinae_ctor_base const&) = delete; | |
| 161 | __sfinae_ctor_base(__sfinae_ctor_base &&) = default; | |
| 162 | __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; | |
| 163 | __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; | |
| 164 | }; | |
| 165 | ||
| 166 | template <bool _CanCopy, bool _CanMove> | |
| 167 | struct __sfinae_assign_base {}; | |
| 168 | template <> | |
| 169 | struct __sfinae_assign_base<false, false> { | |
| 170 | __sfinae_assign_base() = default; | |
| 171 | __sfinae_assign_base(__sfinae_assign_base const&) = default; | |
| 172 | __sfinae_assign_base(__sfinae_assign_base &&) = default; | |
| 173 | __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete; | |
| 174 | __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete; | |
| 175 | }; | |
| 176 | template <> | |
| 177 | struct __sfinae_assign_base<true, false> { | |
| 178 | __sfinae_assign_base() = default; | |
| 179 | __sfinae_assign_base(__sfinae_assign_base const&) = default; | |
| 180 | __sfinae_assign_base(__sfinae_assign_base &&) = default; | |
| 181 | __sfinae_assign_base& operator=(__sfinae_assign_base const&) = default; | |
| 182 | __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete; | |
| 183 | }; | |
| 184 | template <> | |
| 185 | struct __sfinae_assign_base<false, true> { | |
| 186 | __sfinae_assign_base() = default; | |
| 187 | __sfinae_assign_base(__sfinae_assign_base const&) = default; | |
| 188 | __sfinae_assign_base(__sfinae_assign_base &&) = default; | |
| 189 | __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete; | |
| 190 | __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default; | |
| 191 | }; | |
| 192 | #endif // _LIBCPP_STD_VER > 14 | |
| 193 | ||
| 194 | _LIBCPP_END_NAMESPACE_STD | |
| 195 | ||
| 196 | #endif // _LIBCPP___TUPLE_SFINAE_HELPERS_H |
lib/libcxx/include/__tuple_dir/tuple_element.h created+93| ... | ... | @@ -0,0 +1,93 @@ |
| 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_ELEMENT_H | |
| 10 | #define _LIBCPP___TUPLE_TUPLE_ELEMENT_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__tuple_dir/tuple_indices.h> | |
| 14 | #include <__tuple_dir/tuple_types.h> | |
| 15 | #include <__type_traits/add_const.h> | |
| 16 | #include <__type_traits/add_cv.h> | |
| 17 | #include <__type_traits/add_volatile.h> | |
| 18 | #include <cstddef> | |
| 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 <size_t _Ip, class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_element; | |
| 27 | ||
| 28 | template <size_t _Ip, class _Tp> | |
| 29 | struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp> | |
| 30 | { | |
| 31 | typedef _LIBCPP_NODEBUG typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type; | |
| 32 | }; | |
| 33 | ||
| 34 | template <size_t _Ip, class _Tp> | |
| 35 | struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp> | |
| 36 | { | |
| 37 | typedef _LIBCPP_NODEBUG typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type; | |
| 38 | }; | |
| 39 | ||
| 40 | template <size_t _Ip, class _Tp> | |
| 41 | struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp> | |
| 42 | { | |
| 43 | typedef _LIBCPP_NODEBUG typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type; | |
| 44 | }; | |
| 45 | ||
| 46 | #ifndef _LIBCPP_CXX03_LANG | |
| 47 | ||
| 48 | #if !__has_builtin(__type_pack_element) | |
| 49 | ||
| 50 | namespace __indexer_detail { | |
| 51 | ||
| 52 | template <size_t _Idx, class _Tp> | |
| 53 | struct __indexed { using type _LIBCPP_NODEBUG = _Tp; }; | |
| 54 | ||
| 55 | template <class _Types, class _Indexes> struct __indexer; | |
| 56 | ||
| 57 | template <class ..._Types, size_t ..._Idx> | |
| 58 | struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>> | |
| 59 | : __indexed<_Idx, _Types>... | |
| 60 | {}; | |
| 61 | ||
| 62 | template <size_t _Idx, class _Tp> | |
| 63 | __indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&); | |
| 64 | ||
| 65 | } // namespace __indexer_detail | |
| 66 | ||
| 67 | template <size_t _Idx, class ..._Types> | |
| 68 | using __type_pack_element _LIBCPP_NODEBUG = typename decltype( | |
| 69 | __indexer_detail::__at_index<_Idx>( | |
| 70 | __indexer_detail::__indexer< | |
| 71 | __tuple_types<_Types...>, | |
| 72 | typename __make_tuple_indices<sizeof...(_Types)>::type | |
| 73 | >{}) | |
| 74 | )::type; | |
| 75 | #endif | |
| 76 | ||
| 77 | template <size_t _Ip, class ..._Types> | |
| 78 | struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> > | |
| 79 | { | |
| 80 | static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range"); | |
| 81 | typedef _LIBCPP_NODEBUG __type_pack_element<_Ip, _Types...> type; | |
| 82 | }; | |
| 83 | ||
| 84 | #if _LIBCPP_STD_VER > 11 | |
| 85 | template <size_t _Ip, class ..._Tp> | |
| 86 | using tuple_element_t _LIBCPP_NODEBUG = typename tuple_element <_Ip, _Tp...>::type; | |
| 87 | #endif | |
| 88 | ||
| 89 | #endif // _LIBCPP_CXX03_LANG | |
| 90 | ||
| 91 | _LIBCPP_END_NAMESPACE_STD | |
| 92 | ||
| 93 | #endif // _LIBCPP___TUPLE_TUPLE_ELEMENT_H |
lib/libcxx/include/__tuple_dir/tuple_indices.h created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 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 <__utility/integer_sequence.h> | |
| 14 | #include <cstddef> | |
| 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...> struct __tuple_indices {}; | |
| 25 | ||
| 26 | template <size_t _Ep, size_t _Sp = 0> | |
| 27 | struct __make_tuple_indices | |
| 28 | { | |
| 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_dir/tuple_like.h created+51| ... | ... | @@ -0,0 +1,51 @@ |
| 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_H | |
| 10 | #define _LIBCPP___TUPLE_TUPLE_LIKE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__fwd/array.h> | |
| 14 | #include <__fwd/pair.h> | |
| 15 | #include <__fwd/subrange.h> | |
| 16 | #include <__fwd/tuple.h> | |
| 17 | #include <__type_traits/integral_constant.h> | |
| 18 | #include <__type_traits/remove_cvref.h> | |
| 19 | #include <cstddef> | |
| 20 | ||
| 21 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 22 | # pragma GCC system_header | |
| 23 | #endif | |
| 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 26 | ||
| 27 | #if _LIBCPP_STD_VER >= 20 | |
| 28 | ||
| 29 | template <class _Tp> | |
| 30 | struct __tuple_like_impl : false_type {}; | |
| 31 | ||
| 32 | template <class... _Tp> | |
| 33 | struct __tuple_like_impl<tuple<_Tp...> > : true_type {}; | |
| 34 | ||
| 35 | template <class _T1, class _T2> | |
| 36 | struct __tuple_like_impl<pair<_T1, _T2> > : true_type {}; | |
| 37 | ||
| 38 | template <class _Tp, size_t _Size> | |
| 39 | struct __tuple_like_impl<array<_Tp, _Size> > : true_type {}; | |
| 40 | ||
| 41 | template <class _Ip, class _Sp, ranges::subrange_kind _Kp> | |
| 42 | struct __tuple_like_impl<ranges::subrange<_Ip, _Sp, _Kp> > : true_type {}; | |
| 43 | ||
| 44 | template <class _Tp> | |
| 45 | concept __tuple_like = __tuple_like_impl<remove_cvref_t<_Tp>>::value; | |
| 46 | ||
| 47 | #endif // _LIBCPP_STD_VER >= 20 | |
| 48 | ||
| 49 | _LIBCPP_END_NAMESPACE_STD | |
| 50 | ||
| 51 | #endif // _LIBCPP___TUPLE_TUPLE_LIKE_H |
lib/libcxx/include/__tuple_dir/tuple_like_ext.h created+44| ... | ... | @@ -0,0 +1,44 @@ |
| 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 <__fwd/array.h> | |
| 14 | #include <__fwd/pair.h> | |
| 15 | #include <__fwd/tuple.h> | |
| 16 | #include <__tuple_dir/tuple_types.h> | |
| 17 | #include <__type_traits/integral_constant.h> | |
| 18 | #include <cstddef> | |
| 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> struct __tuple_like_ext : false_type {}; | |
| 27 | ||
| 28 | template <class _Tp> struct __tuple_like_ext<const _Tp> : public __tuple_like_ext<_Tp> {}; | |
| 29 | template <class _Tp> struct __tuple_like_ext<volatile _Tp> : public __tuple_like_ext<_Tp> {}; | |
| 30 | template <class _Tp> struct __tuple_like_ext<const volatile _Tp> : public __tuple_like_ext<_Tp> {}; | |
| 31 | ||
| 32 | #ifndef _LIBCPP_CXX03_LANG | |
| 33 | template <class... _Tp> struct __tuple_like_ext<tuple<_Tp...> > : true_type {}; | |
| 34 | #endif | |
| 35 | ||
| 36 | template <class _T1, class _T2> struct __tuple_like_ext<pair<_T1, _T2> > : true_type {}; | |
| 37 | ||
| 38 | template <class _Tp, size_t _Size> struct __tuple_like_ext<array<_Tp, _Size> > : true_type {}; | |
| 39 | ||
| 40 | template <class... _Tp> struct __tuple_like_ext<__tuple_types<_Tp...> > : true_type {}; | |
| 41 | ||
| 42 | _LIBCPP_END_NAMESPACE_STD | |
| 43 | ||
| 44 | #endif // _LIBCPP___TUPLE_TUPLE_LIKE_EXT_H |
lib/libcxx/include/__tuple_dir/tuple_size.h created+75| ... | ... | @@ -0,0 +1,75 @@ |
| 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_SIZE_H | |
| 10 | #define _LIBCPP___TUPLE_TUPLE_SIZE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__fwd/tuple.h> | |
| 14 | #include <__tuple_dir/tuple_types.h> | |
| 15 | #include <__type_traits/is_const.h> | |
| 16 | #include <__type_traits/is_volatile.h> | |
| 17 | #include <cstddef> | |
| 18 | ||
| 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 20 | # pragma GCC system_header | |
| 21 | #endif | |
| 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 24 | ||
| 25 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size; | |
| 26 | ||
| 27 | #if !defined(_LIBCPP_CXX03_LANG) | |
| 28 | template <class _Tp, class...> | |
| 29 | using __enable_if_tuple_size_imp = _Tp; | |
| 30 | ||
| 31 | template <class _Tp> | |
| 32 | struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< | |
| 33 | const _Tp, | |
| 34 | __enable_if_t<!is_volatile<_Tp>::value>, | |
| 35 | integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> | |
| 36 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; | |
| 37 | ||
| 38 | template <class _Tp> | |
| 39 | struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< | |
| 40 | volatile _Tp, | |
| 41 | __enable_if_t<!is_const<_Tp>::value>, | |
| 42 | integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> | |
| 43 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; | |
| 44 | ||
| 45 | template <class _Tp> | |
| 46 | struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< | |
| 47 | const volatile _Tp, | |
| 48 | integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> | |
| 49 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; | |
| 50 | ||
| 51 | #else | |
| 52 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {}; | |
| 53 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {}; | |
| 54 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {}; | |
| 55 | #endif | |
| 56 | ||
| 57 | #ifndef _LIBCPP_CXX03_LANG | |
| 58 | ||
| 59 | template <class ..._Tp> | |
| 60 | struct _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> > | |
| 61 | : public integral_constant<size_t, sizeof...(_Tp)> | |
| 62 | { | |
| 63 | }; | |
| 64 | ||
| 65 | template <class ..._Tp> | |
| 66 | struct _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> > | |
| 67 | : public integral_constant<size_t, sizeof...(_Tp)> | |
| 68 | { | |
| 69 | }; | |
| 70 | ||
| 71 | #endif // _LIBCPP_CXX03_LANG | |
| 72 | ||
| 73 | _LIBCPP_END_NAMESPACE_STD | |
| 74 | ||
| 75 | #endif // _LIBCPP___TUPLE_TUPLE_SIZE_H |
lib/libcxx/include/__tuple_dir/tuple_types.h created+24| ... | ... | @@ -0,0 +1,24 @@ |
| 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> struct __tuple_types {}; | |
| 21 | ||
| 22 | _LIBCPP_END_NAMESPACE_STD | |
| 23 | ||
| 24 | #endif // _LIBCPP___TUPLE_TUPLE_TYPES_H |
lib/libcxx/include/__type_traits/add_lvalue_reference.h+25-5| ... | ... | @@ -18,14 +18,34 @@ |
| 18 | 18 | |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef _LIBCPP_NODEBUG _Tp type; }; | |
| 22 | template <class _Tp > struct __add_lvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG _Tp& type; }; | |
| 21 | #if __has_builtin(__add_lvalue_reference) | |
| 23 | 22 | |
| 24 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_lvalue_reference | |
| 25 | {typedef _LIBCPP_NODEBUG typename __add_lvalue_reference_impl<_Tp>::type type;}; | |
| 23 | template <class _Tp> | |
| 24 | using __add_lvalue_reference_t = __add_lvalue_reference(_Tp); | |
| 25 | ||
| 26 | #else | |
| 27 | ||
| 28 | template <class _Tp, bool = __libcpp_is_referenceable<_Tp>::value> | |
| 29 | struct __add_lvalue_reference_impl { | |
| 30 | typedef _LIBCPP_NODEBUG _Tp type; | |
| 31 | }; | |
| 32 | template <class _Tp > | |
| 33 | struct __add_lvalue_reference_impl<_Tp, true> { | |
| 34 | typedef _LIBCPP_NODEBUG _Tp& type; | |
| 35 | }; | |
| 36 | ||
| 37 | template <class _Tp> | |
| 38 | using __add_lvalue_reference_t = typename __add_lvalue_reference_impl<_Tp>::type; | |
| 39 | ||
| 40 | #endif // __has_builtin(__add_lvalue_reference) | |
| 41 | ||
| 42 | template <class _Tp> | |
| 43 | struct add_lvalue_reference { | |
| 44 | using type _LIBCPP_NODEBUG = __add_lvalue_reference_t<_Tp>; | |
| 45 | }; | |
| 26 | 46 | |
| 27 | 47 | #if _LIBCPP_STD_VER > 11 |
| 28 | template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; | |
| 48 | template <class _Tp> using add_lvalue_reference_t = __add_lvalue_reference_t<_Tp>; | |
| 29 | 49 | #endif |
| 30 | 50 | |
| 31 | 51 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/add_pointer.h+21-7| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/is_referenceable.h> |
| 14 | 14 | #include <__type_traits/is_same.h> |
| 15 | #include <__type_traits/is_void.h> | |
| 15 | 16 | #include <__type_traits/remove_cv.h> |
| 16 | 17 | #include <__type_traits/remove_reference.h> |
| 17 | 18 | |
| ... | ... | @@ -21,19 +22,32 @@ |
| 21 | 22 | |
| 22 | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 24 | |
| 25 | #if __has_builtin(__add_pointer) | |
| 26 | ||
| 27 | template <class _Tp> | |
| 28 | using __add_pointer_t = __add_pointer(_Tp); | |
| 29 | ||
| 30 | #else | |
| 24 | 31 | template <class _Tp, |
| 25 | bool = __is_referenceable<_Tp>::value || | |
| 26 | _IsSame<typename remove_cv<_Tp>::type, void>::value> | |
| 27 | struct __add_pointer_impl | |
| 28 | {typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type* type;}; | |
| 32 | bool = __libcpp_is_referenceable<_Tp>::value || is_void<_Tp>::value> | |
| 33 | struct __add_pointer_impl { | |
| 34 | typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp>* type; | |
| 35 | }; | |
| 29 | 36 | template <class _Tp> struct __add_pointer_impl<_Tp, false> |
| 30 | 37 | {typedef _LIBCPP_NODEBUG _Tp type;}; |
| 31 | 38 | |
| 32 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer | |
| 33 | {typedef _LIBCPP_NODEBUG typename __add_pointer_impl<_Tp>::type type;}; | |
| 39 | template <class _Tp> | |
| 40 | using __add_pointer_t = typename __add_pointer_impl<_Tp>::type; | |
| 41 | ||
| 42 | #endif // __has_builtin(__add_pointer) | |
| 43 | ||
| 44 | template <class _Tp> | |
| 45 | struct add_pointer { | |
| 46 | using type _LIBCPP_NODEBUG = __add_pointer_t<_Tp>; | |
| 47 | }; | |
| 34 | 48 | |
| 35 | 49 | #if _LIBCPP_STD_VER > 11 |
| 36 | template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; | |
| 50 | template <class _Tp> using add_pointer_t = __add_pointer_t<_Tp>; | |
| 37 | 51 | #endif |
| 38 | 52 | |
| 39 | 53 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/add_rvalue_reference.h+26-5| ... | ... | @@ -18,14 +18,35 @@ |
| 18 | 18 | |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef _LIBCPP_NODEBUG _Tp type; }; | |
| 22 | template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG _Tp&& type; }; | |
| 21 | #if __has_builtin(__add_rvalue_reference) | |
| 23 | 22 | |
| 24 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference | |
| 25 | {typedef _LIBCPP_NODEBUG typename __add_rvalue_reference_impl<_Tp>::type type;}; | |
| 23 | template <class _Tp> | |
| 24 | using __add_rvalue_reference_t = __add_rvalue_reference(_Tp); | |
| 25 | ||
| 26 | #else | |
| 27 | ||
| 28 | template <class _Tp, bool = __libcpp_is_referenceable<_Tp>::value> | |
| 29 | struct __add_rvalue_reference_impl { | |
| 30 | typedef _LIBCPP_NODEBUG _Tp type; | |
| 31 | }; | |
| 32 | template <class _Tp > | |
| 33 | struct __add_rvalue_reference_impl<_Tp, true> { | |
| 34 | typedef _LIBCPP_NODEBUG _Tp&& type; | |
| 35 | }; | |
| 36 | ||
| 37 | template <class _Tp> | |
| 38 | using __add_rvalue_reference_t = typename __add_rvalue_reference_impl<_Tp>::type; | |
| 39 | ||
| 40 | #endif // __has_builtin(__add_rvalue_reference) | |
| 41 | ||
| 42 | template <class _Tp> | |
| 43 | struct add_rvalue_reference { | |
| 44 | using type = __add_rvalue_reference_t<_Tp>; | |
| 45 | }; | |
| 26 | 46 | |
| 27 | 47 | #if _LIBCPP_STD_VER > 11 |
| 28 | template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; | |
| 48 | template <class _Tp> | |
| 49 | using add_rvalue_reference_t = __add_rvalue_reference_t<_Tp>; | |
| 29 | 50 | #endif |
| 30 | 51 | |
| 31 | 52 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/aligned_storage.h+9-13| ... | ... | @@ -54,21 +54,13 @@ template <class _TL, size_t _Align> struct __find_pod; |
| 54 | 54 | template <class _Hp, size_t _Align> |
| 55 | 55 | struct __find_pod<__type_list<_Hp, __nat>, _Align> |
| 56 | 56 | { |
| 57 | typedef typename conditional< | |
| 58 | _Align == _Hp::value, | |
| 59 | typename _Hp::type, | |
| 60 | __fallback_overaligned<_Align> | |
| 61 | >::type type; | |
| 57 | typedef __conditional_t<_Align == _Hp::value, typename _Hp::type, __fallback_overaligned<_Align> > type; | |
| 62 | 58 | }; |
| 63 | 59 | |
| 64 | 60 | template <class _Hp, class _Tp, size_t _Align> |
| 65 | 61 | struct __find_pod<__type_list<_Hp, _Tp>, _Align> |
| 66 | 62 | { |
| 67 | typedef typename conditional< | |
| 68 | _Align == _Hp::value, | |
| 69 | typename _Hp::type, | |
| 70 | typename __find_pod<_Tp, _Align>::type | |
| 71 | >::type type; | |
| 63 | typedef __conditional_t<_Align == _Hp::value, typename _Hp::type, typename __find_pod<_Tp, _Align>::type> type; | |
| 72 | 64 | }; |
| 73 | 65 | |
| 74 | 66 | template <class _TL, size_t _Len> struct __find_max_align; |
| ... | ... | @@ -91,7 +83,7 @@ struct __find_max_align<__type_list<_Hp, _Tp>, _Len> |
| 91 | 83 | : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {}; |
| 92 | 84 | |
| 93 | 85 | template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> |
| 94 | struct _LIBCPP_TEMPLATE_VIS aligned_storage | |
| 86 | struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_TEMPLATE_VIS aligned_storage | |
| 95 | 87 | { |
| 96 | 88 | typedef typename __find_pod<__all_types, _Align>::type _Aligner; |
| 97 | 89 | union type |
| ... | ... | @@ -102,13 +94,17 @@ struct _LIBCPP_TEMPLATE_VIS aligned_storage |
| 102 | 94 | }; |
| 103 | 95 | |
| 104 | 96 | #if _LIBCPP_STD_VER > 11 |
| 97 | ||
| 98 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 105 | 99 | template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> |
| 106 | using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; | |
| 100 | using aligned_storage_t _LIBCPP_DEPRECATED_IN_CXX23 = typename aligned_storage<_Len, _Align>::type; | |
| 101 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 102 | ||
| 107 | 103 | #endif |
| 108 | 104 | |
| 109 | 105 | #define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ |
| 110 | 106 | template <size_t _Len>\ |
| 111 | struct _LIBCPP_TEMPLATE_VIS aligned_storage<_Len, n>\ | |
| 107 | struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_TEMPLATE_VIS aligned_storage<_Len, n>\ | |
| 112 | 108 | {\ |
| 113 | 109 | struct _ALIGNAS(n) type\ |
| 114 | 110 | {\ |
lib/libcxx/include/__type_traits/aligned_union.h+3-2| ... | ... | @@ -37,7 +37,7 @@ struct __static_max<_I0, _I1, _In...> |
| 37 | 37 | }; |
| 38 | 38 | |
| 39 | 39 | template <size_t _Len, class _Type0, class ..._Types> |
| 40 | struct aligned_union | |
| 40 | struct _LIBCPP_DEPRECATED_IN_CXX23 aligned_union | |
| 41 | 41 | { |
| 42 | 42 | static const size_t alignment_value = __static_max<_LIBCPP_PREFERRED_ALIGNOF(_Type0), |
| 43 | 43 | _LIBCPP_PREFERRED_ALIGNOF(_Types)...>::value; |
| ... | ... | @@ -47,7 +47,8 @@ struct aligned_union |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | 49 | #if _LIBCPP_STD_VER > 11 |
| 50 | template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type; | |
| 50 | template <size_t _Len, class... _Types> | |
| 51 | using aligned_union_t _LIBCPP_DEPRECATED_IN_CXX23 = typename aligned_union<_Len, _Types...>::type; | |
| 51 | 52 | #endif |
| 52 | 53 | |
| 53 | 54 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/alignment_of.h+1-1| ... | ... | @@ -24,7 +24,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS alignment_of |
| 24 | 24 | |
| 25 | 25 | #if _LIBCPP_STD_VER > 14 |
| 26 | 26 | template <class _Tp> |
| 27 | inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; | |
| 27 | inline constexpr size_t alignment_of_v = _LIBCPP_ALIGNOF(_Tp); | |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/apply_cv.h+2-3| ... | ... | @@ -10,7 +10,6 @@ |
| 10 | 10 | #define _LIBCPP___TYPE_TRAITS_APPLY_CV_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/integral_constant.h> | |
| 14 | 13 | #include <__type_traits/is_const.h> |
| 15 | 14 | #include <__type_traits/is_volatile.h> |
| 16 | 15 | #include <__type_traits/remove_reference.h> |
| ... | ... | @@ -22,8 +21,8 @@ |
| 22 | 21 | |
| 23 | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 23 | |
| 25 | template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, | |
| 26 | bool = is_volatile<typename remove_reference<_Tp>::type>::value> | |
| 24 | template <class _Tp, class _Up, bool = is_const<__libcpp_remove_reference_t<_Tp> >::value, | |
| 25 | bool = is_volatile<__libcpp_remove_reference_t<_Tp> >::value> | |
| 27 | 26 | struct __apply_cv |
| 28 | 27 | { |
| 29 | 28 | typedef _LIBCPP_NODEBUG _Up type; |
lib/libcxx/include/__type_traits/can_extract_key.h created+56| ... | ... | @@ -0,0 +1,56 @@ |
| 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, | |
| 44 | class _RawValTy = __remove_const_ref_t<_ValTy> > | |
| 45 | struct __can_extract_map_key | |
| 46 | : integral_constant<bool, _IsSame<_RawValTy, _Key>::value> {}; | |
| 47 | ||
| 48 | // This specialization returns __extract_key_fail_tag for non-map containers | |
| 49 | // because _Key == _ContainerValueTy | |
| 50 | template <class _ValTy, class _Key, class _RawValTy> | |
| 51 | struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> | |
| 52 | : false_type {}; | |
| 53 | ||
| 54 | _LIBCPP_END_NAMESPACE_STD | |
| 55 | ||
| 56 | #endif // _LIBCPP___TYPE_TRAITS_CAN_EXTRACT_KEY_H |
lib/libcxx/include/__type_traits/common_reference.h+1-1| ... | ... | @@ -31,7 +31,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 31 | 31 | // Let COND_RES(X, Y) be: |
| 32 | 32 | template <class _Xp, class _Yp> |
| 33 | 33 | using __cond_res = |
| 34 | decltype(false ? declval<_Xp(&)()>()() : declval<_Yp(&)()>()()); | |
| 34 | decltype(false ? std::declval<_Xp(&)()>()() : std::declval<_Yp(&)()>()()); | |
| 35 | 35 | |
| 36 | 36 | // Let `XREF(A)` denote a unary alias template `T` such that `T<U>` denotes the same type as `U` |
| 37 | 37 | // with the addition of `A`'s cv and reference qualifiers, for a non-reference cv-unqualified type |
lib/libcxx/include/__type_traits/common_type.h+5-9| ... | ... | @@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 26 | 26 | #if _LIBCPP_STD_VER > 17 |
| 27 | 27 | // Let COND_RES(X, Y) be: |
| 28 | 28 | template <class _Tp, class _Up> |
| 29 | using __cond_type = decltype(false ? declval<_Tp>() : declval<_Up>()); | |
| 29 | using __cond_type = decltype(false ? std::declval<_Tp>() : std::declval<_Up>()); | |
| 30 | 30 | |
| 31 | 31 | template <class _Tp, class _Up, class = void> |
| 32 | 32 | struct __common_type3 {}; |
| ... | ... | @@ -47,13 +47,10 @@ struct __common_type2_imp {}; |
| 47 | 47 | |
| 48 | 48 | // sub-bullet 3 - "if decay_t<decltype(false ? declval<D1>() : declval<D2>())> ..." |
| 49 | 49 | template <class _Tp, class _Up> |
| 50 | struct __common_type2_imp<_Tp, _Up, | |
| 51 | typename __void_t<decltype( | |
| 52 | true ? declval<_Tp>() : declval<_Up>() | |
| 53 | )>::type> | |
| 50 | struct __common_type2_imp<_Tp, _Up, __void_t<decltype(true ? std::declval<_Tp>() : std::declval<_Up>())> > | |
| 54 | 51 | { |
| 55 | 52 | typedef _LIBCPP_NODEBUG typename decay<decltype( |
| 56 | true ? declval<_Tp>() : declval<_Up>() | |
| 53 | true ? std::declval<_Tp>() : std::declval<_Up>() | |
| 57 | 54 | )>::type type; |
| 58 | 55 | }; |
| 59 | 56 | |
| ... | ... | @@ -82,8 +79,7 @@ struct common_type { |
| 82 | 79 | |
| 83 | 80 | template <class _Tp, class _Up> |
| 84 | 81 | struct __common_type_impl< |
| 85 | __common_types<_Tp, _Up>, | |
| 86 | typename __void_t<typename common_type<_Tp, _Up>::type>::type> | |
| 82 | __common_types<_Tp, _Up>, __void_t<typename common_type<_Tp, _Up>::type> > | |
| 87 | 83 | { |
| 88 | 84 | typedef typename common_type<_Tp, _Up>::type type; |
| 89 | 85 | }; |
| ... | ... | @@ -91,7 +87,7 @@ struct __common_type_impl< |
| 91 | 87 | template <class _Tp, class _Up, class _Vp _LIBCPP_OPTIONAL_PACK(class... _Rest)> |
| 92 | 88 | struct __common_type_impl< |
| 93 | 89 | __common_types<_Tp, _Up, _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)>, |
| 94 | typename __void_t<typename common_type<_Tp, _Up>::type>::type> | |
| 90 | __void_t<typename common_type<_Tp, _Up>::type> > | |
| 95 | 91 | : __common_type_impl<__common_types<typename common_type<_Tp, _Up>::type, |
| 96 | 92 | _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)> > { |
| 97 | 93 | }; |
lib/libcxx/include/__type_traits/conditional.h+9-4| ... | ... | @@ -36,17 +36,22 @@ template <bool _Cond, class _IfRes, class _ElseRes> |
| 36 | 36 | using _If _LIBCPP_NODEBUG = typename _IfImpl<_Cond>::template _Select<_IfRes, _ElseRes>; |
| 37 | 37 | |
| 38 | 38 | template <bool _Bp, class _If, class _Then> |
| 39 | struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;}; | |
| 39 | struct _LIBCPP_TEMPLATE_VIS conditional { | |
| 40 | using type _LIBCPP_NODEBUG = _If; | |
| 41 | }; | |
| 40 | 42 | template <class _If, class _Then> |
| 41 | struct _LIBCPP_TEMPLATE_VIS conditional<false, _If, _Then> {typedef _Then type;}; | |
| 43 | struct _LIBCPP_TEMPLATE_VIS conditional<false, _If, _Then> { | |
| 44 | using type _LIBCPP_NODEBUG = _Then; | |
| 45 | }; | |
| 42 | 46 | |
| 43 | 47 | #if _LIBCPP_STD_VER > 11 |
| 44 | 48 | template <bool _Bp, class _IfRes, class _ElseRes> |
| 45 | using conditional_t = typename conditional<_Bp, _IfRes, _ElseRes>::type; | |
| 49 | using conditional_t _LIBCPP_NODEBUG = typename conditional<_Bp, _IfRes, _ElseRes>::type; | |
| 46 | 50 | #endif |
| 47 | 51 | |
| 48 | 52 | // Helper so we can use "conditional_t" in all language versions. |
| 49 | template <bool _Bp, class _If, class _Then> using __conditional_t = typename conditional<_Bp, _If, _Then>::type; | |
| 53 | template <bool _Bp, class _If, class _Then> | |
| 54 | using __conditional_t _LIBCPP_NODEBUG = typename conditional<_Bp, _If, _Then>::type; | |
| 50 | 55 | |
| 51 | 56 | _LIBCPP_END_NAMESPACE_STD |
| 52 | 57 |
lib/libcxx/include/__type_traits/conjunction.h+22-21| ... | ... | @@ -20,26 +20,6 @@ |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | #if _LIBCPP_STD_VER > 14 | |
| 24 | ||
| 25 | template <class _Arg, class... _Args> | |
| 26 | struct __conjunction_impl { | |
| 27 | using type = conditional_t<!bool(_Arg::value), _Arg, typename __conjunction_impl<_Args...>::type>; | |
| 28 | }; | |
| 29 | ||
| 30 | template <class _Arg> | |
| 31 | struct __conjunction_impl<_Arg> { | |
| 32 | using type = _Arg; | |
| 33 | }; | |
| 34 | ||
| 35 | template <class... _Args> | |
| 36 | struct conjunction : __conjunction_impl<true_type, _Args...>::type {}; | |
| 37 | ||
| 38 | template<class... _Args> | |
| 39 | inline constexpr bool conjunction_v = conjunction<_Args...>::value; | |
| 40 | ||
| 41 | #endif // _LIBCPP_STD_VER > 14 | |
| 42 | ||
| 43 | 23 | template <class...> |
| 44 | 24 | using __expand_to_true = true_type; |
| 45 | 25 | |
| ... | ... | @@ -49,8 +29,29 @@ __expand_to_true<__enable_if_t<_Pred::value>...> __and_helper(int); |
| 49 | 29 | template <class...> |
| 50 | 30 | false_type __and_helper(...); |
| 51 | 31 | |
| 32 | // _And always performs lazy evaluation of its arguments. | |
| 33 | // | |
| 34 | // However, `_And<_Pred...>` itself will evaluate its result immediately (without having to | |
| 35 | // be instantiated) since it is an alias, unlike `conjunction<_Pred...>`, which is a struct. | |
| 36 | // If you want to defer the evaluation of `_And<_Pred...>` itself, use `_Lazy<_And, _Pred...>`. | |
| 52 | 37 | template <class... _Pred> |
| 53 | using _And _LIBCPP_NODEBUG = decltype(__and_helper<_Pred...>(0)); | |
| 38 | using _And _LIBCPP_NODEBUG = decltype(std::__and_helper<_Pred...>(0)); | |
| 39 | ||
| 40 | #if _LIBCPP_STD_VER > 14 | |
| 41 | ||
| 42 | template <class...> | |
| 43 | struct conjunction : true_type {}; | |
| 44 | ||
| 45 | template <class _Arg> | |
| 46 | struct conjunction<_Arg> : _Arg {}; | |
| 47 | ||
| 48 | template <class _Arg, class... _Args> | |
| 49 | struct conjunction<_Arg, _Args...> : conditional_t<!bool(_Arg::value), _Arg, conjunction<_Args...>> {}; | |
| 50 | ||
| 51 | template <class... _Args> | |
| 52 | inline constexpr bool conjunction_v = conjunction<_Args...>::value; | |
| 53 | ||
| 54 | #endif // _LIBCPP_STD_VER > 14 | |
| 54 | 55 | |
| 55 | 56 | _LIBCPP_END_NAMESPACE_STD |
| 56 | 57 |
lib/libcxx/include/__type_traits/copy_cvref.h+2-2| ... | ... | @@ -29,13 +29,13 @@ struct __copy_cvref |
| 29 | 29 | template <class _From, class _To> |
| 30 | 30 | struct __copy_cvref<_From&, _To> |
| 31 | 31 | { |
| 32 | using type = typename add_lvalue_reference<__copy_cv_t<_From, _To> >::type; | |
| 32 | using type = __add_lvalue_reference_t<__copy_cv_t<_From, _To> >; | |
| 33 | 33 | }; |
| 34 | 34 | |
| 35 | 35 | template <class _From, class _To> |
| 36 | 36 | struct __copy_cvref<_From&&, _To> |
| 37 | 37 | { |
| 38 | using type = typename add_rvalue_reference<__copy_cv_t<_From, _To> >::type; | |
| 38 | using type = __add_rvalue_reference_t<__copy_cv_t<_From, _To> >; | |
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | 41 | template <class _From, class _To> |
lib/libcxx/include/__type_traits/decay.h+12-6| ... | ... | @@ -12,7 +12,6 @@ |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/add_pointer.h> |
| 14 | 14 | #include <__type_traits/conditional.h> |
| 15 | #include <__type_traits/integral_constant.h> | |
| 16 | 15 | #include <__type_traits/is_array.h> |
| 17 | 16 | #include <__type_traits/is_function.h> |
| 18 | 17 | #include <__type_traits/is_referenceable.h> |
| ... | ... | @@ -26,9 +25,15 @@ |
| 26 | 25 | |
| 27 | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 27 | |
| 28 | #if __has_builtin(__decay) | |
| 29 | template <class _Tp> | |
| 30 | struct decay { | |
| 31 | using type _LIBCPP_NODEBUG = __decay(_Tp); | |
| 32 | }; | |
| 33 | #else | |
| 29 | 34 | template <class _Up, bool> |
| 30 | 35 | struct __decay { |
| 31 | typedef _LIBCPP_NODEBUG typename remove_cv<_Up>::type type; | |
| 36 | typedef _LIBCPP_NODEBUG __remove_cv_t<_Up> type; | |
| 32 | 37 | }; |
| 33 | 38 | |
| 34 | 39 | template <class _Up> |
| ... | ... | @@ -37,12 +42,12 @@ public: |
| 37 | 42 | typedef _LIBCPP_NODEBUG typename conditional |
| 38 | 43 | < |
| 39 | 44 | is_array<_Up>::value, |
| 40 | typename remove_extent<_Up>::type*, | |
| 45 | __add_pointer_t<__remove_extent_t<_Up> >, | |
| 41 | 46 | typename conditional |
| 42 | 47 | < |
| 43 | 48 | is_function<_Up>::value, |
| 44 | 49 | typename add_pointer<_Up>::type, |
| 45 | typename remove_cv<_Up>::type | |
| 50 | __remove_cv_t<_Up> | |
| 46 | 51 | >::type |
| 47 | 52 | >::type type; |
| 48 | 53 | }; |
| ... | ... | @@ -51,10 +56,11 @@ template <class _Tp> |
| 51 | 56 | struct _LIBCPP_TEMPLATE_VIS decay |
| 52 | 57 | { |
| 53 | 58 | private: |
| 54 | typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type _Up; | |
| 59 | typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp> _Up; | |
| 55 | 60 | public: |
| 56 | typedef _LIBCPP_NODEBUG typename __decay<_Up, __is_referenceable<_Up>::value>::type type; | |
| 61 | typedef _LIBCPP_NODEBUG typename __decay<_Up, __libcpp_is_referenceable<_Up>::value>::type type; | |
| 57 | 62 | }; |
| 63 | #endif // __has_builtin(__decay) | |
| 58 | 64 | |
| 59 | 65 | #if _LIBCPP_STD_VER > 11 |
| 60 | 66 | template <class _Tp> using decay_t = typename decay<_Tp>::type; |
lib/libcxx/include/__type_traits/dependent_type.h created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 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 _LIBCPP_TEMPLATE_VIS __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+6-1| ... | ... | @@ -10,7 +10,6 @@ |
| 10 | 10 | #define _LIBCPP___TYPE_TRAITS_DISJUNCTION_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/conditional.h> | |
| 14 | 13 | #include <__type_traits/integral_constant.h> |
| 15 | 14 | |
| 16 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -35,6 +34,12 @@ struct _OrImpl<false> { |
| 35 | 34 | using _Result = _Res; |
| 36 | 35 | }; |
| 37 | 36 | |
| 37 | // _Or always performs lazy evaluation of its arguments. | |
| 38 | // | |
| 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. | |
| 41 | // If you want to defer the evaluation of `_Or<_Pred...>` itself, use `_Lazy<_Or, _Pred...>` | |
| 42 | // or `disjunction<_Pred...>` directly. | |
| 38 | 43 | template <class... _Args> |
| 39 | 44 | using _Or _LIBCPP_NODEBUG = typename _OrImpl<sizeof...(_Args) != 0>::template _Result<false_type, _Args...>; |
| 40 | 45 |
lib/libcxx/include/__type_traits/has_virtual_destructor.h+1-10| ... | ... | @@ -18,21 +18,12 @@ |
| 18 | 18 | |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | #if __has_builtin(__has_virtual_destructor) | |
| 22 | ||
| 23 | 21 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor |
| 24 | 22 | : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; |
| 25 | 23 | |
| 26 | #else | |
| 27 | ||
| 28 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor | |
| 29 | : public false_type {}; | |
| 30 | ||
| 31 | #endif | |
| 32 | ||
| 33 | 24 | #if _LIBCPP_STD_VER > 14 |
| 34 | 25 | template <class _Tp> |
| 35 | inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value; | |
| 26 | inline constexpr bool has_virtual_destructor_v = __has_virtual_destructor(_Tp); | |
| 36 | 27 | #endif |
| 37 | 28 | |
| 38 | 29 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_allocator.h created+36| ... | ... | @@ -0,0 +1,36 @@ |
| 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_IS_ALLOCATOR_H | |
| 10 | #define _LIBCPP___TYPE_IS_ALLOCATOR_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/integral_constant.h> | |
| 14 | #include <__type_traits/void_t.h> | |
| 15 | #include <__utility/declval.h> | |
| 16 | #include <cstddef> | |
| 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 | template<typename _Alloc, typename = void, typename = void> | |
| 25 | struct __is_allocator : false_type {}; | |
| 26 | ||
| 27 | template<typename _Alloc> | |
| 28 | struct __is_allocator<_Alloc, | |
| 29 | __void_t<typename _Alloc::value_type>, | |
| 30 | __void_t<decltype(std::declval<_Alloc&>().allocate(size_t(0)))> | |
| 31 | > | |
| 32 | : true_type {}; | |
| 33 | ||
| 34 | _LIBCPP_END_NAMESPACE_STD | |
| 35 | ||
| 36 | #endif // _LIBCPP___TYPE_IS_ALLOCATOR_H |
lib/libcxx/include/__type_traits/is_always_bitcastable.h created+82| ... | ... | @@ -0,0 +1,82 @@ |
| 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_ALWAYS_BITCASTABLE_H | |
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_ALWAYS_BITCASTABLE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/integral_constant.h> | |
| 14 | #include <__type_traits/is_integral.h> | |
| 15 | #include <__type_traits/is_object.h> | |
| 16 | #include <__type_traits/is_same.h> | |
| 17 | #include <__type_traits/is_trivially_copyable.h> | |
| 18 | #include <__type_traits/remove_cv.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 | // Checks whether an object of type `From` can always be bit-cast to an object of type `To` and represent a valid value | |
| 27 | // of type `To`. In other words, `From` and `To` have the same value representation and the set of values of `From` is | |
| 28 | // a subset of the set of values of `To`. | |
| 29 | // | |
| 30 | // Note that types that cannot be assigned to each other using built-in assignment (e.g. arrays) might still be | |
| 31 | // considered bit-castable. | |
| 32 | template <class _From, class _To> | |
| 33 | struct __is_always_bitcastable { | |
| 34 | using _UnqualFrom = __remove_cv_t<_From>; | |
| 35 | using _UnqualTo = __remove_cv_t<_To>; | |
| 36 | ||
| 37 | static const bool value = | |
| 38 | // First, the simple case -- `From` and `To` are the same object type. | |
| 39 | (is_same<_UnqualFrom, _UnqualTo>::value && is_trivially_copyable<_UnqualFrom>::value) || | |
| 40 | ||
| 41 | // Beyond the simple case, we say that one type is "always bit-castable" to another if: | |
| 42 | // - (1) `From` and `To` have the same value representation, and in addition every possible value of `From` has | |
| 43 | // a corresponding value in the `To` type (in other words, the set of values of `To` is a superset of the set of | |
| 44 | // values of `From`); | |
| 45 | // - (2) When the corresponding values are not the same value (as, for example, between an unsigned and a signed | |
| 46 | // integer, where a large positive value of the unsigned integer corresponds to a negative value in the signed | |
| 47 | // integer type), the value of `To` that results from a bitwise copy of `From` is the same what would be produced | |
| 48 | // by the built-in assignment (if it were defined for the two types, to which there are minor exceptions, e.g. | |
| 49 | // built-in arrays). | |
| 50 | // | |
| 51 | // In practice, that means: | |
| 52 | // - all integral types (except `bool`, see below) -- that is, character types and `int` types, both signed and | |
| 53 | // unsigned... | |
| 54 | // - as well as arrays of such types... | |
| 55 | // - ...that have the same size. | |
| 56 | // | |
| 57 | // Other trivially-copyable types can't be validly bit-cast outside of their own type: | |
| 58 | // - floating-point types normally have different sizes and thus aren't bit-castable between each other (fails #1); | |
| 59 | // - integral types and floating-point types use different representations, so for example bit-casting an integral | |
| 60 | // `1` to `float` results in a very small less-than-one value, unlike built-in assignment that produces `1.0` | |
| 61 | // (fails #2); | |
| 62 | // - booleans normally use only a single bit of their object representation; bit-casting an integer to a boolean | |
| 63 | // will result in a boolean object with an incorrect representation, which is undefined behavior (fails #2). | |
| 64 | // Bit-casting from a boolean into an integer, however, is valid; | |
| 65 | // - enumeration types may have different ranges of possible values (fails #1); | |
| 66 | // - for pointers, it is not guaranteed that pointers to different types use the same set of values to represent | |
| 67 | // addresses, and the conversion results are explicitly unspecified for types with different alignments | |
| 68 | // (fails #1); | |
| 69 | // - for structs and unions it is impossible to determine whether the set of values of one of them is a subset of | |
| 70 | // the other (fails #1); | |
| 71 | // - there is no need to consider `nullptr_t` for practical purposes. | |
| 72 | ( | |
| 73 | sizeof(_From) == sizeof(_To) && | |
| 74 | is_integral<_From>::value && | |
| 75 | is_integral<_To>::value && | |
| 76 | !is_same<_UnqualTo, bool>::value | |
| 77 | ); | |
| 78 | }; | |
| 79 | ||
| 80 | _LIBCPP_END_NAMESPACE_STD | |
| 81 | ||
| 82 | #endif // _LIBCPP___TYPE_TRAITS_IS_ALWAYS_BITCASTABLE_H |
lib/libcxx/include/__type_traits/is_assignable.h-35| ... | ... | @@ -18,10 +18,6 @@ |
| 18 | 18 | |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | template<typename, typename _Tp> struct __select_2nd { typedef _LIBCPP_NODEBUG _Tp type; }; | |
| 22 | ||
| 23 | #if __has_builtin(__is_assignable) | |
| 24 | ||
| 25 | 21 | template<class _Tp, class _Up> |
| 26 | 22 | struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { }; |
| 27 | 23 | |
| ... | ... | @@ -30,37 +26,6 @@ template <class _Tp, class _Arg> |
| 30 | 26 | inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg); |
| 31 | 27 | #endif |
| 32 | 28 | |
| 33 | #else // __has_builtin(__is_assignable) | |
| 34 | ||
| 35 | template <class _Tp, class _Arg> | |
| 36 | typename __select_2nd<decltype((declval<_Tp>() = declval<_Arg>())), true_type>::type | |
| 37 | __is_assignable_test(int); | |
| 38 | ||
| 39 | template <class, class> | |
| 40 | false_type __is_assignable_test(...); | |
| 41 | ||
| 42 | ||
| 43 | template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> | |
| 44 | struct __is_assignable_imp | |
| 45 | : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {}; | |
| 46 | ||
| 47 | template <class _Tp, class _Arg> | |
| 48 | struct __is_assignable_imp<_Tp, _Arg, true> | |
| 49 | : public false_type | |
| 50 | { | |
| 51 | }; | |
| 52 | ||
| 53 | template <class _Tp, class _Arg> | |
| 54 | struct is_assignable | |
| 55 | : public __is_assignable_imp<_Tp, _Arg> {}; | |
| 56 | ||
| 57 | #if _LIBCPP_STD_VER > 14 | |
| 58 | template <class _Tp, class _Arg> | |
| 59 | inline constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value; | |
| 60 | #endif | |
| 61 | ||
| 62 | #endif // __has_builtin(__is_assignable) | |
| 63 | ||
| 64 | 29 | _LIBCPP_END_NAMESPACE_STD |
| 65 | 30 | |
| 66 | 31 | #endif // _LIBCPP___TYPE_TRAITS_IS_ASSIGNABLE_H |
lib/libcxx/include/__type_traits/is_callable.h+1-1| ... | ... | @@ -25,7 +25,7 @@ template<class...> |
| 25 | 25 | false_type __is_callable_helper(...); |
| 26 | 26 | |
| 27 | 27 | template<class _Func, class... _Args> |
| 28 | struct __is_callable : decltype(__is_callable_helper<_Func, _Args...>(0)) {}; | |
| 28 | struct __is_callable : decltype(std::__is_callable_helper<_Func, _Args...>(0)) {}; | |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_END_NAMESPACE_STD |
| 31 | 31 |
lib/libcxx/include/__type_traits/is_char_like_type.h created+28| ... | ... | @@ -0,0 +1,28 @@ |
| 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_CHAR_LIKE_TYPE_H | |
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_CHAR_LIKE_TYPE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/conjunction.h> | |
| 14 | #include <__type_traits/is_standard_layout.h> | |
| 15 | #include <__type_traits/is_trivial.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 _CharT> | |
| 24 | using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >; | |
| 25 | ||
| 26 | _LIBCPP_END_NAMESPACE_STD | |
| 27 | ||
| 28 | #endif // _LIBCPP___TYPE_TRAITS_IS_CHAR_LIKE_TYPE_H |
lib/libcxx/include/__type_traits/is_class.h-2| ... | ... | @@ -11,8 +11,6 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/integral_constant.h> |
| 14 | #include <__type_traits/is_union.h> | |
| 15 | #include <__type_traits/remove_cv.h> | |
| 16 | 14 | |
| 17 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 16 | # pragma GCC system_header |
lib/libcxx/include/__type_traits/is_constant_evaluated.h+1-1| ... | ... | @@ -24,7 +24,7 @@ inline constexpr bool is_constant_evaluated() noexcept { |
| 24 | 24 | } |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | inline _LIBCPP_CONSTEXPR | |
| 27 | _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR | |
| 28 | 28 | bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); } |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_constructible.h+1-1| ... | ... | @@ -25,7 +25,7 @@ struct _LIBCPP_TEMPLATE_VIS is_constructible |
| 25 | 25 | |
| 26 | 26 | #if _LIBCPP_STD_VER > 14 |
| 27 | 27 | template <class _Tp, class ..._Args> |
| 28 | inline constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value; | |
| 28 | inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...); | |
| 29 | 29 | #endif |
| 30 | 30 | |
| 31 | 31 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_convertible.h+2-2| ... | ... | @@ -40,7 +40,7 @@ struct __is_convertible_test : public false_type {}; |
| 40 | 40 | |
| 41 | 41 | template <class _From, class _To> |
| 42 | 42 | struct __is_convertible_test<_From, _To, |
| 43 | decltype(__is_convertible_imp::__test_convert<_To>(declval<_From>()))> : public true_type | |
| 43 | decltype(__is_convertible_imp::__test_convert<_To>(std::declval<_From>()))> : public true_type | |
| 44 | 44 | {}; |
| 45 | 45 | |
| 46 | 46 | template <class _Tp, bool _IsArray = is_array<_Tp>::value, |
| ... | ... | @@ -53,7 +53,7 @@ template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | template <class _Tp, |
| 56 | unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value> | |
| 56 | unsigned = __is_convertible_imp::__is_array_function_or_void<__libcpp_remove_reference_t<_Tp> >::value> | |
| 57 | 57 | struct __is_convertible_check |
| 58 | 58 | { |
| 59 | 59 | static const size_t __v = 0; |
lib/libcxx/include/__type_traits/is_copy_assignable.h+6-4| ... | ... | @@ -13,7 +13,6 @@ |
| 13 | 13 | #include <__type_traits/add_const.h> |
| 14 | 14 | #include <__type_traits/add_lvalue_reference.h> |
| 15 | 15 | #include <__type_traits/integral_constant.h> |
| 16 | #include <__type_traits/is_assignable.h> | |
| 17 | 16 | |
| 18 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 18 | # pragma GCC system_header |
| ... | ... | @@ -21,9 +20,12 @@ |
| 21 | 20 | |
| 22 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 22 | |
| 24 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_copy_assignable | |
| 25 | : public is_assignable<typename add_lvalue_reference<_Tp>::type, | |
| 26 | typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; | |
| 23 | template <class _Tp> | |
| 24 | struct _LIBCPP_TEMPLATE_VIS is_copy_assignable | |
| 25 | : public integral_constant< | |
| 26 | bool, | |
| 27 | __is_assignable(__add_lvalue_reference_t<_Tp>, | |
| 28 | __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {}; | |
| 27 | 29 | |
| 28 | 30 | #if _LIBCPP_STD_VER > 14 |
| 29 | 31 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_copy_constructible.h+3-3| ... | ... | @@ -13,7 +13,6 @@ |
| 13 | 13 | #include <__type_traits/add_const.h> |
| 14 | 14 | #include <__type_traits/add_lvalue_reference.h> |
| 15 | 15 | #include <__type_traits/integral_constant.h> |
| 16 | #include <__type_traits/is_constructible.h> | |
| 17 | 16 | |
| 18 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 18 | # pragma GCC system_header |
| ... | ... | @@ -23,8 +22,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 22 | |
| 24 | 23 | template <class _Tp> |
| 25 | 24 | struct _LIBCPP_TEMPLATE_VIS is_copy_constructible |
| 26 | : public is_constructible<_Tp, | |
| 27 | typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; | |
| 25 | : public integral_constant< | |
| 26 | bool, | |
| 27 | __is_constructible(_Tp, __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {}; | |
| 28 | 28 | |
| 29 | 29 | #if _LIBCPP_STD_VER > 14 |
| 30 | 30 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_default_constructible.h+2-3| ... | ... | @@ -11,7 +11,6 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/integral_constant.h> |
| 14 | #include <__type_traits/is_constructible.h> | |
| 15 | 14 | |
| 16 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 16 | # pragma GCC system_header |
| ... | ... | @@ -21,12 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 20 | |
| 22 | 21 | template <class _Tp> |
| 23 | 22 | struct _LIBCPP_TEMPLATE_VIS is_default_constructible |
| 24 | : public is_constructible<_Tp> | |
| 23 | : public integral_constant<bool, __is_constructible(_Tp)> | |
| 25 | 24 | {}; |
| 26 | 25 | |
| 27 | 26 | #if _LIBCPP_STD_VER > 14 |
| 28 | 27 | template <class _Tp> |
| 29 | inline constexpr bool is_default_constructible_v = is_default_constructible<_Tp>::value; | |
| 28 | inline constexpr bool is_default_constructible_v = __is_constructible(_Tp); | |
| 30 | 29 | #endif |
| 31 | 30 | |
| 32 | 31 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_destructible.h+2-2| ... | ... | @@ -48,7 +48,7 @@ template <typename _Tp> |
| 48 | 48 | struct __is_destructor_wellformed { |
| 49 | 49 | template <typename _Tp1> |
| 50 | 50 | static true_type __test ( |
| 51 | typename __is_destructible_apply<decltype(declval<_Tp1&>().~_Tp1())>::type | |
| 51 | typename __is_destructible_apply<decltype(std::declval<_Tp1&>().~_Tp1())>::type | |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | 54 | template <typename _Tp1> |
| ... | ... | @@ -63,7 +63,7 @@ struct __destructible_imp; |
| 63 | 63 | template <class _Tp> |
| 64 | 64 | struct __destructible_imp<_Tp, false> |
| 65 | 65 | : public integral_constant<bool, |
| 66 | __is_destructor_wellformed<typename remove_all_extents<_Tp>::type>::value> {}; | |
| 66 | __is_destructor_wellformed<__remove_all_extents_t<_Tp> >::value> {}; | |
| 67 | 67 | |
| 68 | 68 | template <class _Tp> |
| 69 | 69 | struct __destructible_imp<_Tp, true> |
lib/libcxx/include/__type_traits/is_enum.h-1| ... | ... | @@ -11,7 +11,6 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/integral_constant.h> |
| 14 | #include <__type_traits/remove_cv.h> | |
| 15 | 14 | |
| 16 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 16 | # pragma GCC system_header |
lib/libcxx/include/__type_traits/is_floating_point.h+1-1| ... | ... | @@ -25,7 +25,7 @@ template <> struct __libcpp_is_floating_point<double> : public tru |
| 25 | 25 | template <> struct __libcpp_is_floating_point<long double> : public true_type {}; |
| 26 | 26 | |
| 27 | 27 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_floating_point |
| 28 | : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {}; | |
| 28 | : public __libcpp_is_floating_point<__remove_cv_t<_Tp> > {}; | |
| 29 | 29 | |
| 30 | 30 | #if _LIBCPP_STD_VER > 14 |
| 31 | 31 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_implicitly_default_constructible.h created+48| ... | ... | @@ -0,0 +1,48 @@ |
| 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_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H | |
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/integral_constant.h> | |
| 14 | #include <__type_traits/is_default_constructible.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 | #ifndef _LIBCPP_CXX03_LANG | |
| 23 | // First of all, we can't implement this check in C++03 mode because the {} | |
| 24 | // default initialization syntax isn't valid. | |
| 25 | // Second, we implement the trait in a funny manner with two defaulted template | |
| 26 | // arguments to workaround Clang's PR43454. | |
| 27 | template <class _Tp> | |
| 28 | void __test_implicit_default_constructible(_Tp); | |
| 29 | ||
| 30 | template <class _Tp, class = void, class = typename is_default_constructible<_Tp>::type> | |
| 31 | struct __is_implicitly_default_constructible | |
| 32 | : false_type | |
| 33 | { }; | |
| 34 | ||
| 35 | template <class _Tp> | |
| 36 | struct __is_implicitly_default_constructible<_Tp, decltype(std::__test_implicit_default_constructible<_Tp const&>({})), true_type> | |
| 37 | : true_type | |
| 38 | { }; | |
| 39 | ||
| 40 | template <class _Tp> | |
| 41 | struct __is_implicitly_default_constructible<_Tp, decltype(std::__test_implicit_default_constructible<_Tp const&>({})), false_type> | |
| 42 | : false_type | |
| 43 | { }; | |
| 44 | #endif // !C++03 | |
| 45 | ||
| 46 | _LIBCPP_END_NAMESPACE_STD | |
| 47 | ||
| 48 | #endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H |
lib/libcxx/include/__type_traits/is_integral.h+1-1| ... | ... | @@ -58,7 +58,7 @@ inline constexpr bool is_integral_v = __is_integral(_Tp); |
| 58 | 58 | #else |
| 59 | 59 | |
| 60 | 60 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_integral |
| 61 | : public _BoolConstant<__libcpp_is_integral<typename remove_cv<_Tp>::type>::value> {}; | |
| 61 | : public _BoolConstant<__libcpp_is_integral<__remove_cv_t<_Tp> >::value> {}; | |
| 62 | 62 | |
| 63 | 63 | #if _LIBCPP_STD_VER > 14 |
| 64 | 64 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_literal_type.h+1-1| ... | ... | @@ -25,7 +25,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_ |
| 25 | 25 | |
| 26 | 26 | #if _LIBCPP_STD_VER > 14 |
| 27 | 27 | template <class _Tp> |
| 28 | _LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; | |
| 28 | _LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = __is_literal_type(_Tp); | |
| 29 | 29 | #endif // _LIBCPP_STD_VER > 14 |
| 30 | 30 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) |
| 31 | 31 |
lib/libcxx/include/__type_traits/is_member_function_pointer.h+1-1| ... | ... | @@ -50,7 +50,7 @@ inline constexpr bool is_member_function_pointer_v = __is_member_function_pointe |
| 50 | 50 | #else // __has_builtin(__is_member_function_pointer) |
| 51 | 51 | |
| 52 | 52 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer |
| 53 | : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_func > {}; | |
| 53 | : public _BoolConstant< __libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_func > {}; | |
| 54 | 54 | |
| 55 | 55 | #if _LIBCPP_STD_VER > 14 |
| 56 | 56 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_member_object_pointer.h+1-1| ... | ... | @@ -32,7 +32,7 @@ inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_T |
| 32 | 32 | #else // __has_builtin(__is_member_object_pointer) |
| 33 | 33 | |
| 34 | 34 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer |
| 35 | : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_obj > {}; | |
| 35 | : public _BoolConstant< __libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_obj > {}; | |
| 36 | 36 | |
| 37 | 37 | #if _LIBCPP_STD_VER > 14 |
| 38 | 38 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_member_pointer.h+2-1| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/integral_constant.h> |
| 14 | #include <__type_traits/is_member_function_pointer.h> | |
| 14 | 15 | |
| 15 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 17 | # pragma GCC system_header |
| ... | ... | @@ -31,7 +32,7 @@ inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); |
| 31 | 32 | #else // __has_builtin(__is_member_pointer) |
| 32 | 33 | |
| 33 | 34 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer |
| 34 | : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_member > {}; | |
| 35 | : public _BoolConstant< __libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_member > {}; | |
| 35 | 36 | |
| 36 | 37 | #if _LIBCPP_STD_VER > 14 |
| 37 | 38 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_move_assignable.h+5-5| ... | ... | @@ -10,11 +10,9 @@ |
| 10 | 10 | #define _LIBCPP___TYPE_TRAITS_IS_MOVE_ASSIGNABLE_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/add_const.h> | |
| 14 | 13 | #include <__type_traits/add_lvalue_reference.h> |
| 15 | 14 | #include <__type_traits/add_rvalue_reference.h> |
| 16 | 15 | #include <__type_traits/integral_constant.h> |
| 17 | #include <__type_traits/is_assignable.h> | |
| 18 | 16 | |
| 19 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | 18 | # pragma GCC system_header |
| ... | ... | @@ -22,9 +20,11 @@ |
| 22 | 20 | |
| 23 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 22 | |
| 25 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_move_assignable | |
| 26 | : public is_assignable<typename add_lvalue_reference<_Tp>::type, | |
| 27 | typename add_rvalue_reference<_Tp>::type> {}; | |
| 23 | template <class _Tp> | |
| 24 | struct _LIBCPP_TEMPLATE_VIS is_move_assignable | |
| 25 | : public integral_constant< | |
| 26 | bool, | |
| 27 | __is_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {}; | |
| 28 | 28 | |
| 29 | 29 | #if _LIBCPP_STD_VER > 14 |
| 30 | 30 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_move_constructible.h+1-2| ... | ... | @@ -12,7 +12,6 @@ |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/add_rvalue_reference.h> |
| 14 | 14 | #include <__type_traits/integral_constant.h> |
| 15 | #include <__type_traits/is_constructible.h> | |
| 16 | 15 | |
| 17 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 17 | # pragma GCC system_header |
| ... | ... | @@ -22,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 21 | |
| 23 | 22 | template <class _Tp> |
| 24 | 23 | struct _LIBCPP_TEMPLATE_VIS is_move_constructible |
| 25 | : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> | |
| 24 | : public integral_constant<bool, __is_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> | |
| 26 | 25 | {}; |
| 27 | 26 | |
| 28 | 27 | #if _LIBCPP_STD_VER > 14 |
lib/libcxx/include/__type_traits/is_nothrow_assignable.h+1-28| ... | ... | @@ -10,7 +10,6 @@ |
| 10 | 10 | #define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_ASSIGNABLE_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/add_const.h> | |
| 14 | 13 | #include <__type_traits/integral_constant.h> |
| 15 | 14 | |
| 16 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -19,39 +18,13 @@ |
| 19 | 18 | |
| 20 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 20 | |
| 22 | #if __has_builtin(__is_nothrow_assignable) | |
| 23 | ||
| 24 | 21 | template <class _Tp, class _Arg> |
| 25 | 22 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable |
| 26 | 23 | : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {}; |
| 27 | 24 | |
| 28 | #else | |
| 29 | ||
| 30 | template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable; | |
| 31 | ||
| 32 | template <class _Tp, class _Arg> | |
| 33 | struct __libcpp_is_nothrow_assignable<false, _Tp, _Arg> | |
| 34 | : public false_type | |
| 35 | { | |
| 36 | }; | |
| 37 | ||
| 38 | template <class _Tp, class _Arg> | |
| 39 | struct __libcpp_is_nothrow_assignable<true, _Tp, _Arg> | |
| 40 | : public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Arg>()) > | |
| 41 | { | |
| 42 | }; | |
| 43 | ||
| 44 | template <class _Tp, class _Arg> | |
| 45 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable | |
| 46 | : public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> | |
| 47 | { | |
| 48 | }; | |
| 49 | ||
| 50 | #endif // __has_builtin(__is_nothrow_assignable) | |
| 51 | ||
| 52 | 25 | #if _LIBCPP_STD_VER > 14 |
| 53 | 26 | template <class _Tp, class _Arg> |
| 54 | inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable<_Tp, _Arg>::value; | |
| 27 | inline constexpr bool is_nothrow_assignable_v = __is_nothrow_assignable(_Tp, _Arg); | |
| 55 | 28 | #endif |
| 56 | 29 | |
| 57 | 30 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_nothrow_constructible.h+7-4| ... | ... | @@ -11,7 +11,10 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/integral_constant.h> |
| 14 | #include <__type_traits/is_constructible.h> | |
| 15 | #include <__type_traits/is_reference.h> | |
| 14 | 16 | #include <__utility/declval.h> |
| 17 | #include <cstddef> | |
| 15 | 18 | |
| 16 | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 20 | # pragma GCC system_header |
| ... | ... | @@ -21,17 +24,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 24 | |
| 22 | 25 | #if __has_builtin(__is_nothrow_constructible) |
| 23 | 26 | |
| 24 | template <class _Tp, class... _Args> | |
| 27 | template < | |
| 28 | class _Tp, class... _Args> | |
| 25 | 29 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible |
| 26 | 30 | : public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {}; |
| 27 | ||
| 28 | 31 | #else |
| 29 | 32 | |
| 30 | 33 | template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible; |
| 31 | 34 | |
| 32 | 35 | template <class _Tp, class... _Args> |
| 33 | 36 | struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/false, _Tp, _Args...> |
| 34 | : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> | |
| 37 | : public integral_constant<bool, noexcept(_Tp(std::declval<_Args>()...))> | |
| 35 | 38 | { |
| 36 | 39 | }; |
| 37 | 40 | |
| ... | ... | @@ -40,7 +43,7 @@ void __implicit_conversion_to(_Tp) noexcept { } |
| 40 | 43 | |
| 41 | 44 | template <class _Tp, class _Arg> |
| 42 | 45 | struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg> |
| 43 | : public integral_constant<bool, noexcept(_VSTD::__implicit_conversion_to<_Tp>(declval<_Arg>()))> | |
| 46 | : public integral_constant<bool, noexcept(_VSTD::__implicit_conversion_to<_Tp>(std::declval<_Arg>()))> | |
| 44 | 47 | { |
| 45 | 48 | }; |
| 46 | 49 |
lib/libcxx/include/__type_traits/is_nothrow_convertible.h+1-1| ... | ... | @@ -30,7 +30,7 @@ template <typename _Tp> |
| 30 | 30 | static void __test_noexcept(_Tp) noexcept; |
| 31 | 31 | |
| 32 | 32 | template<typename _Fm, typename _To> |
| 33 | static bool_constant<noexcept(_VSTD::__test_noexcept<_To>(declval<_Fm>()))> | |
| 33 | static bool_constant<noexcept(_VSTD::__test_noexcept<_To>(std::declval<_Fm>()))> | |
| 34 | 34 | __is_nothrow_convertible_test(); |
| 35 | 35 | |
| 36 | 36 | template <typename _Fm, typename _To> |
lib/libcxx/include/__type_traits/is_nothrow_copy_assignable.h+7-4| ... | ... | @@ -13,7 +13,6 @@ |
| 13 | 13 | #include <__type_traits/add_const.h> |
| 14 | 14 | #include <__type_traits/add_lvalue_reference.h> |
| 15 | 15 | #include <__type_traits/integral_constant.h> |
| 16 | #include <__type_traits/is_nothrow_assignable.h> | |
| 17 | 16 | |
| 18 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 18 | # pragma GCC system_header |
| ... | ... | @@ -21,9 +20,13 @@ |
| 21 | 20 | |
| 22 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 22 | |
| 24 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable | |
| 25 | : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, | |
| 26 | typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; | |
| 23 | template <class _Tp> | |
| 24 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable | |
| 25 | : public integral_constant< | |
| 26 | bool, | |
| 27 | __is_nothrow_assignable( | |
| 28 | __add_lvalue_reference_t<_Tp>, | |
| 29 | __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {}; | |
| 27 | 30 | |
| 28 | 31 | #if _LIBCPP_STD_VER > 14 |
| 29 | 32 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_nothrow_copy_constructible.h+14-1| ... | ... | @@ -21,9 +21,22 @@ |
| 21 | 21 | |
| 22 | 22 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 23 | |
| 24 | // TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed | |
| 25 | #ifdef _LIBCPP_COMPILER_GCC | |
| 26 | ||
| 24 | 27 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible |
| 25 | 28 | : public is_nothrow_constructible<_Tp, |
| 26 | typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; | |
| 29 | __add_lvalue_reference_t<typename add_const<_Tp>::type> > {}; | |
| 30 | ||
| 31 | #else // _LIBCPP_COMPILER_GCC | |
| 32 | ||
| 33 | template <class _Tp> | |
| 34 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible | |
| 35 | : public integral_constant< | |
| 36 | bool, | |
| 37 | __is_nothrow_constructible(_Tp, typename add_lvalue_reference<typename add_const<_Tp>::type>::type)> {}; | |
| 38 | ||
| 39 | #endif // _LIBCPP_COMPILER_GCC | |
| 27 | 40 | |
| 28 | 41 | #if _LIBCPP_STD_VER > 14 |
| 29 | 42 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_nothrow_default_constructible.h+2-3| ... | ... | @@ -11,7 +11,6 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/integral_constant.h> |
| 14 | #include <__type_traits/is_nothrow_constructible.h> | |
| 15 | 14 | |
| 16 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 16 | # pragma GCC system_header |
| ... | ... | @@ -20,12 +19,12 @@ |
| 20 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 20 | |
| 22 | 21 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructible |
| 23 | : public is_nothrow_constructible<_Tp> | |
| 22 | : public integral_constant<bool, __is_nothrow_constructible(_Tp)> | |
| 24 | 23 | {}; |
| 25 | 24 | |
| 26 | 25 | #if _LIBCPP_STD_VER > 14 |
| 27 | 26 | template <class _Tp> |
| 28 | inline constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible<_Tp>::value; | |
| 27 | inline constexpr bool is_nothrow_default_constructible_v = __is_nothrow_constructible(_Tp); | |
| 29 | 28 | #endif |
| 30 | 29 | |
| 31 | 30 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_nothrow_destructible.h+2-3| ... | ... | @@ -10,7 +10,6 @@ |
| 10 | 10 | #define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_DESTRUCTIBLE_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/add_const.h> | |
| 14 | 13 | #include <__type_traits/integral_constant.h> |
| 15 | 14 | #include <__type_traits/is_destructible.h> |
| 16 | 15 | #include <__type_traits/is_reference.h> |
| ... | ... | @@ -37,7 +36,7 @@ struct __libcpp_is_nothrow_destructible<false, _Tp> |
| 37 | 36 | |
| 38 | 37 | template <class _Tp> |
| 39 | 38 | struct __libcpp_is_nothrow_destructible<true, _Tp> |
| 40 | : public integral_constant<bool, noexcept(declval<_Tp>().~_Tp()) > | |
| 39 | : public integral_constant<bool, noexcept(std::declval<_Tp>().~_Tp()) > | |
| 41 | 40 | { |
| 42 | 41 | }; |
| 43 | 42 | |
| ... | ... | @@ -72,7 +71,7 @@ template <class _Tp> struct __libcpp_nothrow_destructor |
| 72 | 71 | is_reference<_Tp>::value> {}; |
| 73 | 72 | |
| 74 | 73 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible |
| 75 | : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; | |
| 74 | : public __libcpp_nothrow_destructor<__remove_all_extents_t<_Tp> > {}; | |
| 76 | 75 | |
| 77 | 76 | template <class _Tp> |
| 78 | 77 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[]> |
lib/libcxx/include/__type_traits/is_nothrow_move_assignable.h+6-5| ... | ... | @@ -13,7 +13,6 @@ |
| 13 | 13 | #include <__type_traits/add_lvalue_reference.h> |
| 14 | 14 | #include <__type_traits/add_rvalue_reference.h> |
| 15 | 15 | #include <__type_traits/integral_constant.h> |
| 16 | #include <__type_traits/is_nothrow_assignable.h> | |
| 17 | 16 | |
| 18 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 18 | # pragma GCC system_header |
| ... | ... | @@ -21,10 +20,12 @@ |
| 21 | 20 | |
| 22 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 22 | |
| 24 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable | |
| 25 | : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, | |
| 26 | typename add_rvalue_reference<_Tp>::type> | |
| 27 | {}; | |
| 23 | template <class _Tp> | |
| 24 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable | |
| 25 | : public integral_constant< | |
| 26 | bool, | |
| 27 | __is_nothrow_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> { | |
| 28 | }; | |
| 28 | 29 | |
| 29 | 30 | #if _LIBCPP_STD_VER > 14 |
| 30 | 31 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_nothrow_move_constructible.h+12-1| ... | ... | @@ -20,10 +20,21 @@ |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | // TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed | |
| 24 | #ifndef _LIBCPP_COMPILER_GCC | |
| 25 | ||
| 26 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible | |
| 27 | : public integral_constant<bool, __is_nothrow_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> | |
| 28 | {}; | |
| 29 | ||
| 30 | #else // _LIBCPP_COMPILER_GCC | |
| 31 | ||
| 23 | 32 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible |
| 24 | : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> | |
| 33 | : public is_nothrow_constructible<_Tp, __add_rvalue_reference_t<_Tp> > | |
| 25 | 34 | {}; |
| 26 | 35 | |
| 36 | #endif // _LIBCPP_COMPILER_GCC | |
| 37 | ||
| 27 | 38 | #if _LIBCPP_STD_VER > 14 |
| 28 | 39 | template <class _Tp> |
| 29 | 40 | inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value; |
lib/libcxx/include/__type_traits/is_null_pointer.h+2-2| ... | ... | @@ -24,11 +24,11 @@ template <class _Tp> struct __is_nullptr_t_impl : public false_type {}; |
| 24 | 24 | template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {}; |
| 25 | 25 | |
| 26 | 26 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __is_nullptr_t |
| 27 | : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; | |
| 27 | : public __is_nullptr_t_impl<__remove_cv_t<_Tp> > {}; | |
| 28 | 28 | |
| 29 | 29 | #if _LIBCPP_STD_VER > 11 |
| 30 | 30 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_null_pointer |
| 31 | : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; | |
| 31 | : public __is_nullptr_t_impl<__remove_cv_t<_Tp> > {}; | |
| 32 | 32 | |
| 33 | 33 | #if _LIBCPP_STD_VER > 14 |
| 34 | 34 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_pod.h+1-13| ... | ... | @@ -18,24 +18,12 @@ |
| 18 | 18 | |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | #if __has_builtin(__is_pod) | |
| 22 | ||
| 23 | 21 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod |
| 24 | 22 | : public integral_constant<bool, __is_pod(_Tp)> {}; |
| 25 | 23 | |
| 26 | #else | |
| 27 | ||
| 28 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod | |
| 29 | : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && | |
| 30 | is_trivially_copy_constructible<_Tp>::value && | |
| 31 | is_trivially_copy_assignable<_Tp>::value && | |
| 32 | is_trivially_destructible<_Tp>::value> {}; | |
| 33 | ||
| 34 | #endif // __has_builtin(__is_pod) | |
| 35 | ||
| 36 | 24 | #if _LIBCPP_STD_VER > 14 |
| 37 | 25 | template <class _Tp> |
| 38 | inline constexpr bool is_pod_v = is_pod<_Tp>::value; | |
| 26 | inline constexpr bool is_pod_v = __is_pod(_Tp); | |
| 39 | 27 | #endif |
| 40 | 28 | |
| 41 | 29 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_pointer.h+1-1| ... | ... | @@ -43,7 +43,7 @@ template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __unsafe_unretai |
| 43 | 43 | #endif |
| 44 | 44 | |
| 45 | 45 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer |
| 46 | : public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<typename remove_cv<_Tp>::type>::type> {}; | |
| 46 | : public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<__remove_cv_t<_Tp> >::type> {}; | |
| 47 | 47 | |
| 48 | 48 | #if _LIBCPP_STD_VER > 14 |
| 49 | 49 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_reference_wrapper.h+1-1| ... | ... | @@ -24,7 +24,7 @@ template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper; |
| 24 | 24 | template <class _Tp> struct __is_reference_wrapper_impl : public false_type {}; |
| 25 | 25 | template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {}; |
| 26 | 26 | template <class _Tp> struct __is_reference_wrapper |
| 27 | : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {}; | |
| 27 | : public __is_reference_wrapper_impl<__remove_cv_t<_Tp> > {}; | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_END_NAMESPACE_STD |
| 30 | 30 |
lib/libcxx/include/__type_traits/is_referenceable.h+13-5| ... | ... | @@ -19,14 +19,22 @@ |
| 19 | 19 | |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | struct __is_referenceable_impl { | |
| 23 | template <class _Tp> static _Tp& __test(int); | |
| 24 | template <class _Tp> static false_type __test(...); | |
| 22 | #if __has_builtin(__is_referenceable) | |
| 23 | template <class _Tp> | |
| 24 | struct __libcpp_is_referenceable : integral_constant<bool, __is_referenceable(_Tp)> {}; | |
| 25 | #else | |
| 26 | struct __libcpp_is_referenceable_impl { | |
| 27 | template <class _Tp> | |
| 28 | static _Tp& __test(int); | |
| 29 | template <class _Tp> | |
| 30 | static false_type __test(...); | |
| 25 | 31 | }; |
| 26 | 32 | |
| 27 | 33 | template <class _Tp> |
| 28 | struct __is_referenceable : integral_constant<bool, | |
| 29 | _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), false_type>::value> {}; | |
| 34 | struct __libcpp_is_referenceable | |
| 35 | : integral_constant<bool, _IsNotSame<decltype(__libcpp_is_referenceable_impl::__test<_Tp>(0)), false_type>::value> { | |
| 36 | }; | |
| 37 | #endif // __has_builtin(__is_referenceable) | |
| 30 | 38 | |
| 31 | 39 | _LIBCPP_END_NAMESPACE_STD |
| 32 | 40 |
lib/libcxx/include/__type_traits/is_scalar.h+1| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | #include <__type_traits/is_arithmetic.h> |
| 15 | 15 | #include <__type_traits/is_enum.h> |
| 16 | 16 | #include <__type_traits/is_member_pointer.h> |
| 17 | #include <__type_traits/is_null_pointer.h> | |
| 17 | 18 | #include <__type_traits/is_pointer.h> |
| 18 | 19 | |
| 19 | 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
lib/libcxx/include/__type_traits/is_signed.h+2| ... | ... | @@ -11,6 +11,8 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/integral_constant.h> |
| 14 | #include <__type_traits/is_arithmetic.h> | |
| 15 | #include <__type_traits/is_integral.h> | |
| 14 | 16 | |
| 15 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 18 | # pragma GCC system_header |
lib/libcxx/include/__type_traits/is_specialization.h created+45| ... | ... | @@ -0,0 +1,45 @@ |
| 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___TYPE_TRAITS_IS_SPECIALIZATION | |
| 11 | #define _LIBCPP___TYPE_TRAITS_IS_SPECIALIZATION | |
| 12 | ||
| 13 | // This contains parts of P2098R1 but is based on MSVC STL's implementation. | |
| 14 | // | |
| 15 | // The paper has been rejected | |
| 16 | // We will not pursue P2098R0 (std::is_specialization_of) at this time; we'd | |
| 17 | // like to see a solution to this problem, but it requires language evolution | |
| 18 | // too. | |
| 19 | // | |
| 20 | // Since it is expected a real solution will be provided in the future only the | |
| 21 | // minimal part is implemented. | |
| 22 | // | |
| 23 | // Note a cvref qualified _Tp is never considered a specialization. | |
| 24 | ||
| 25 | #include <__config> | |
| 26 | ||
| 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 28 | # pragma GCC system_header | |
| 29 | #endif | |
| 30 | ||
| 31 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 32 | ||
| 33 | #if _LIBCPP_STD_VER > 14 | |
| 34 | ||
| 35 | template <class _Tp, template <class...> class _Template> | |
| 36 | inline constexpr bool __is_specialization_v = false; // true if and only if _Tp is a specialization of _Template | |
| 37 | ||
| 38 | template <template <class...> class _Template, class... _Args> | |
| 39 | inline constexpr bool __is_specialization_v<_Template<_Args...>, _Template> = true; | |
| 40 | ||
| 41 | #endif // _LIBCPP_STD_VER > 14 | |
| 42 | ||
| 43 | _LIBCPP_END_NAMESPACE_STD | |
| 44 | ||
| 45 | #endif // _LIBCPP___TYPE_TRAITS_IS_SPECIALIZATION |
lib/libcxx/include/__type_traits/is_standard_layout.h+1-5| ... | ... | @@ -19,16 +19,12 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout |
| 22 | #if __has_builtin(__is_standard_layout) | |
| 23 | 22 | : public integral_constant<bool, __is_standard_layout(_Tp)> |
| 24 | #else | |
| 25 | : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> | |
| 26 | #endif | |
| 27 | 23 | {}; |
| 28 | 24 | |
| 29 | 25 | #if _LIBCPP_STD_VER > 14 |
| 30 | 26 | template <class _Tp> |
| 31 | inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; | |
| 27 | inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp); | |
| 32 | 28 | #endif |
| 33 | 29 | |
| 34 | 30 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_swappable.h created+165| ... | ... | @@ -0,0 +1,165 @@ |
| 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_SWAPPABLE_H | |
| 10 | #define _LIBCPP___TYPE_TRAITS_IS_SWAPPABLE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/add_lvalue_reference.h> | |
| 14 | #include <__type_traits/conditional.h> | |
| 15 | #include <__type_traits/enable_if.h> | |
| 16 | #include <__type_traits/is_move_assignable.h> | |
| 17 | #include <__type_traits/is_move_constructible.h> | |
| 18 | #include <__type_traits/is_nothrow_move_assignable.h> | |
| 19 | #include <__type_traits/is_nothrow_move_constructible.h> | |
| 20 | #include <__type_traits/is_referenceable.h> | |
| 21 | #include <__type_traits/is_same.h> | |
| 22 | #include <__type_traits/is_void.h> | |
| 23 | #include <__type_traits/nat.h> | |
| 24 | #include <__utility/declval.h> | |
| 25 | #include <cstddef> | |
| 26 | ||
| 27 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 28 | # pragma GCC system_header | |
| 29 | #endif | |
| 30 | ||
| 31 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 32 | ||
| 33 | template <class _Tp> struct __is_swappable; | |
| 34 | template <class _Tp> struct __is_nothrow_swappable; | |
| 35 | ||
| 36 | ||
| 37 | #ifndef _LIBCPP_CXX03_LANG | |
| 38 | template <class _Tp> | |
| 39 | using __swap_result_t = typename enable_if<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>::type; | |
| 40 | #else | |
| 41 | template <class> | |
| 42 | using __swap_result_t = void; | |
| 43 | #endif | |
| 44 | ||
| 45 | template <class _Tp> | |
| 46 | inline _LIBCPP_INLINE_VISIBILITY | |
| 47 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __swap_result_t<_Tp> | |
| 48 | swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && | |
| 49 | is_nothrow_move_assignable<_Tp>::value); | |
| 50 | ||
| 51 | template<class _Tp, size_t _Np> | |
| 52 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 53 | typename enable_if< | |
| 54 | __is_swappable<_Tp>::value | |
| 55 | >::type | |
| 56 | swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value); | |
| 57 | ||
| 58 | namespace __detail | |
| 59 | { | |
| 60 | // ALL generic swap overloads MUST already have a declaration available at this point. | |
| 61 | ||
| 62 | template <class _Tp, class _Up = _Tp, | |
| 63 | bool _NotVoid = !is_void<_Tp>::value && !is_void<_Up>::value> | |
| 64 | struct __swappable_with | |
| 65 | { | |
| 66 | template <class _LHS, class _RHS> | |
| 67 | static decltype(swap(std::declval<_LHS>(), std::declval<_RHS>())) | |
| 68 | __test_swap(int); | |
| 69 | template <class, class> | |
| 70 | static __nat __test_swap(long); | |
| 71 | ||
| 72 | // Extra parens are needed for the C++03 definition of decltype. | |
| 73 | typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1; | |
| 74 | typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2; | |
| 75 | ||
| 76 | static const bool value = _IsNotSame<__swap1, __nat>::value | |
| 77 | && _IsNotSame<__swap2, __nat>::value; | |
| 78 | }; | |
| 79 | ||
| 80 | template <class _Tp, class _Up> | |
| 81 | struct __swappable_with<_Tp, _Up, false> : false_type {}; | |
| 82 | ||
| 83 | template <class _Tp, class _Up = _Tp, bool _Swappable = __swappable_with<_Tp, _Up>::value> | |
| 84 | struct __nothrow_swappable_with { | |
| 85 | static const bool value = | |
| 86 | #ifndef _LIBCPP_HAS_NO_NOEXCEPT | |
| 87 | noexcept(swap(std::declval<_Tp>(), std::declval<_Up>())) | |
| 88 | && noexcept(swap(std::declval<_Up>(), std::declval<_Tp>())); | |
| 89 | #else | |
| 90 | false; | |
| 91 | #endif | |
| 92 | }; | |
| 93 | ||
| 94 | template <class _Tp, class _Up> | |
| 95 | struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {}; | |
| 96 | ||
| 97 | } // namespace __detail | |
| 98 | ||
| 99 | template <class _Tp> | |
| 100 | struct __is_swappable | |
| 101 | : public integral_constant<bool, __detail::__swappable_with<_Tp&>::value> | |
| 102 | { | |
| 103 | }; | |
| 104 | ||
| 105 | template <class _Tp> | |
| 106 | struct __is_nothrow_swappable | |
| 107 | : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp&>::value> | |
| 108 | { | |
| 109 | }; | |
| 110 | ||
| 111 | #if _LIBCPP_STD_VER > 14 | |
| 112 | ||
| 113 | template <class _Tp, class _Up> | |
| 114 | struct _LIBCPP_TEMPLATE_VIS is_swappable_with | |
| 115 | : public integral_constant<bool, __detail::__swappable_with<_Tp, _Up>::value> | |
| 116 | { | |
| 117 | }; | |
| 118 | ||
| 119 | template <class _Tp> | |
| 120 | struct _LIBCPP_TEMPLATE_VIS is_swappable | |
| 121 | : public __conditional_t< | |
| 122 | __libcpp_is_referenceable<_Tp>::value, | |
| 123 | is_swappable_with< | |
| 124 | __add_lvalue_reference_t<_Tp>, | |
| 125 | __add_lvalue_reference_t<_Tp> >, | |
| 126 | false_type | |
| 127 | > | |
| 128 | { | |
| 129 | }; | |
| 130 | ||
| 131 | template <class _Tp, class _Up> | |
| 132 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with | |
| 133 | : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp, _Up>::value> | |
| 134 | { | |
| 135 | }; | |
| 136 | ||
| 137 | template <class _Tp> | |
| 138 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable | |
| 139 | : public __conditional_t< | |
| 140 | __libcpp_is_referenceable<_Tp>::value, | |
| 141 | is_nothrow_swappable_with< | |
| 142 | __add_lvalue_reference_t<_Tp>, | |
| 143 | __add_lvalue_reference_t<_Tp> >, | |
| 144 | false_type | |
| 145 | > | |
| 146 | { | |
| 147 | }; | |
| 148 | ||
| 149 | template <class _Tp, class _Up> | |
| 150 | inline constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value; | |
| 151 | ||
| 152 | template <class _Tp> | |
| 153 | inline constexpr bool is_swappable_v = is_swappable<_Tp>::value; | |
| 154 | ||
| 155 | template <class _Tp, class _Up> | |
| 156 | inline constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<_Tp, _Up>::value; | |
| 157 | ||
| 158 | template <class _Tp> | |
| 159 | inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value; | |
| 160 | ||
| 161 | #endif // _LIBCPP_STD_VER > 14 | |
| 162 | ||
| 163 | _LIBCPP_END_NAMESPACE_STD | |
| 164 | ||
| 165 | #endif // _LIBCPP___TYPE_TRAITS_IS_SWAPPABLE_H |
lib/libcxx/include/__type_traits/is_trivial.h+1-6| ... | ... | @@ -19,17 +19,12 @@ |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | 21 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial |
| 22 | #if __has_builtin(__is_trivial) | |
| 23 | 22 | : public integral_constant<bool, __is_trivial(_Tp)> |
| 24 | #else | |
| 25 | : integral_constant<bool, is_trivially_copyable<_Tp>::value && | |
| 26 | is_trivially_default_constructible<_Tp>::value> | |
| 27 | #endif | |
| 28 | 23 | {}; |
| 29 | 24 | |
| 30 | 25 | #if _LIBCPP_STD_VER > 14 |
| 31 | 26 | template <class _Tp> |
| 32 | inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; | |
| 27 | inline constexpr bool is_trivial_v = __is_trivial(_Tp); | |
| 33 | 28 | #endif |
| 34 | 29 | |
| 35 | 30 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_trivially_assignable.h+1-1| ... | ... | @@ -25,7 +25,7 @@ struct is_trivially_assignable |
| 25 | 25 | |
| 26 | 26 | #if _LIBCPP_STD_VER > 14 |
| 27 | 27 | template <class _Tp, class _Arg> |
| 28 | inline constexpr bool is_trivially_assignable_v = is_trivially_assignable<_Tp, _Arg>::value; | |
| 28 | inline constexpr bool is_trivially_assignable_v = __is_trivially_assignable(_Tp, _Arg); | |
| 29 | 29 | #endif |
| 30 | 30 | |
| 31 | 31 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_trivially_constructible.h+1-1| ... | ... | @@ -26,7 +26,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible |
| 26 | 26 | |
| 27 | 27 | #if _LIBCPP_STD_VER > 14 |
| 28 | 28 | template <class _Tp, class... _Args> |
| 29 | inline constexpr bool is_trivially_constructible_v = is_trivially_constructible<_Tp, _Args...>::value; | |
| 29 | inline constexpr bool is_trivially_constructible_v = __is_trivially_constructible(_Tp, _Args...); | |
| 30 | 30 | #endif |
| 31 | 31 | |
| 32 | 32 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_trivially_copy_assignable.h+7-4| ... | ... | @@ -13,7 +13,6 @@ |
| 13 | 13 | #include <__type_traits/add_const.h> |
| 14 | 14 | #include <__type_traits/add_lvalue_reference.h> |
| 15 | 15 | #include <__type_traits/integral_constant.h> |
| 16 | #include <__type_traits/is_trivially_assignable.h> | |
| 17 | 16 | |
| 18 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 18 | # pragma GCC system_header |
| ... | ... | @@ -21,9 +20,13 @@ |
| 21 | 20 | |
| 22 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 22 | |
| 24 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable | |
| 25 | : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, | |
| 26 | typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; | |
| 23 | template <class _Tp> | |
| 24 | struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable | |
| 25 | : public integral_constant< | |
| 26 | bool, | |
| 27 | __is_trivially_assignable( | |
| 28 | __add_lvalue_reference_t<_Tp>, | |
| 29 | __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {}; | |
| 27 | 30 | |
| 28 | 31 | #if _LIBCPP_STD_VER > 14 |
| 29 | 32 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_trivially_copy_constructible.h+1-2| ... | ... | @@ -12,7 +12,6 @@ |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/add_lvalue_reference.h> |
| 14 | 14 | #include <__type_traits/integral_constant.h> |
| 15 | #include <__type_traits/is_trivially_constructible.h> | |
| 16 | 15 | |
| 17 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 17 | # pragma GCC system_header |
| ... | ... | @@ -21,7 +20,7 @@ |
| 21 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 21 | |
| 23 | 22 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible |
| 24 | : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> | |
| 23 | : public integral_constant<bool, __is_trivially_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)> | |
| 25 | 24 | {}; |
| 26 | 25 | |
| 27 | 26 | #if _LIBCPP_STD_VER > 14 |
lib/libcxx/include/__type_traits/is_trivially_copyable.h+1-1| ... | ... | @@ -24,7 +24,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable |
| 24 | 24 | |
| 25 | 25 | #if _LIBCPP_STD_VER > 14 |
| 26 | 26 | template <class _Tp> |
| 27 | inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value; | |
| 27 | inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp); | |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | 30 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_trivially_default_constructible.h+2-3| ... | ... | @@ -11,7 +11,6 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/integral_constant.h> |
| 14 | #include <__type_traits/is_trivially_constructible.h> | |
| 15 | 14 | |
| 16 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 16 | # pragma GCC system_header |
| ... | ... | @@ -20,12 +19,12 @@ |
| 20 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 20 | |
| 22 | 21 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructible |
| 23 | : public is_trivially_constructible<_Tp> | |
| 22 | : public integral_constant<bool, __is_trivially_constructible(_Tp)> | |
| 24 | 23 | {}; |
| 25 | 24 | |
| 26 | 25 | #if _LIBCPP_STD_VER > 14 |
| 27 | 26 | template <class _Tp> |
| 28 | inline constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible<_Tp>::value; | |
| 27 | inline constexpr bool is_trivially_default_constructible_v = __is_trivially_constructible(_Tp); | |
| 29 | 28 | #endif |
| 30 | 29 | |
| 31 | 30 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/is_trivially_destructible.h+2-9| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/integral_constant.h> |
| 14 | #include <__type_traits/is_destructible.h> | |
| 14 | 15 | |
| 15 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 17 | # pragma GCC system_header |
| ... | ... | @@ -30,15 +31,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible |
| 30 | 31 | |
| 31 | 32 | #else |
| 32 | 33 | |
| 33 | template <class _Tp> struct __libcpp_trivial_destructor | |
| 34 | : public integral_constant<bool, is_scalar<_Tp>::value || | |
| 35 | is_reference<_Tp>::value> {}; | |
| 36 | ||
| 37 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible | |
| 38 | : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; | |
| 39 | ||
| 40 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible<_Tp[]> | |
| 41 | : public false_type {}; | |
| 34 | #error is_trivially_destructible is not implemented | |
| 42 | 35 | |
| 43 | 36 | #endif // __has_builtin(__is_trivially_destructible) |
| 44 | 37 |
lib/libcxx/include/__type_traits/is_trivially_move_assignable.h+5-5| ... | ... | @@ -13,7 +13,6 @@ |
| 13 | 13 | #include <__type_traits/add_lvalue_reference.h> |
| 14 | 14 | #include <__type_traits/add_rvalue_reference.h> |
| 15 | 15 | #include <__type_traits/integral_constant.h> |
| 16 | #include <__type_traits/is_trivially_assignable.h> | |
| 17 | 16 | |
| 18 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 18 | # pragma GCC system_header |
| ... | ... | @@ -21,10 +20,11 @@ |
| 21 | 20 | |
| 22 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 22 | |
| 24 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable | |
| 25 | : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, | |
| 26 | typename add_rvalue_reference<_Tp>::type> | |
| 27 | {}; | |
| 23 | template <class _Tp> | |
| 24 | struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable | |
| 25 | : public integral_constant< | |
| 26 | bool, | |
| 27 | __is_trivially_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {}; | |
| 28 | 28 | |
| 29 | 29 | #if _LIBCPP_STD_VER > 14 |
| 30 | 30 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_trivially_move_constructible.h+3-4| ... | ... | @@ -12,7 +12,6 @@ |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/add_rvalue_reference.h> |
| 14 | 14 | #include <__type_traits/integral_constant.h> |
| 15 | #include <__type_traits/is_trivially_constructible.h> | |
| 16 | 15 | |
| 17 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 17 | # pragma GCC system_header |
| ... | ... | @@ -20,9 +19,9 @@ |
| 20 | 19 | |
| 21 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 21 | |
| 23 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible | |
| 24 | : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> | |
| 25 | {}; | |
| 22 | template <class _Tp> | |
| 23 | struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible | |
| 24 | : public integral_constant<bool, __is_trivially_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {}; | |
| 26 | 25 | |
| 27 | 26 | #if _LIBCPP_STD_VER > 14 |
| 28 | 27 | template <class _Tp> |
lib/libcxx/include/__type_traits/is_union.h-1| ... | ... | @@ -11,7 +11,6 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/integral_constant.h> |
| 14 | #include <__type_traits/remove_cv.h> | |
| 15 | 14 | |
| 16 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 16 | # pragma GCC system_header |
lib/libcxx/include/__type_traits/is_unsigned.h+1-2| ... | ... | @@ -20,8 +20,7 @@ |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | // Before AppleClang 14, __is_unsigned returned true for enums with signed underlying type. | |
| 24 | #if __has_builtin(__is_unsigned) && !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1400) | |
| 23 | #if __has_builtin(__is_unsigned) | |
| 25 | 24 | |
| 26 | 25 | template<class _Tp> |
| 27 | 26 | struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> { }; |
lib/libcxx/include/__type_traits/is_valid_expansion.h+1-1| ... | ... | @@ -24,7 +24,7 @@ template <template <class...> class, class ...> |
| 24 | 24 | false_type __sfinae_test_impl(...); |
| 25 | 25 | |
| 26 | 26 | template <template <class ...> class _Templ, class ..._Args> |
| 27 | using _IsValidExpansion _LIBCPP_NODEBUG = decltype(__sfinae_test_impl<_Templ, _Args...>(0)); | |
| 27 | using _IsValidExpansion _LIBCPP_NODEBUG = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0)); | |
| 28 | 28 | |
| 29 | 29 | _LIBCPP_END_NAMESPACE_STD |
| 30 | 30 |
lib/libcxx/include/__type_traits/is_void.h+3-1| ... | ... | @@ -11,6 +11,8 @@ |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | 13 | #include <__type_traits/integral_constant.h> |
| 14 | #include <__type_traits/is_same.h> | |
| 15 | #include <__type_traits/remove_cv.h> | |
| 14 | 16 | |
| 15 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 18 | # pragma GCC system_header |
| ... | ... | @@ -31,7 +33,7 @@ inline constexpr bool is_void_v = __is_void(_Tp); |
| 31 | 33 | #else |
| 32 | 34 | |
| 33 | 35 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_void |
| 34 | : public is_same<typename remove_cv<_Tp>::type, void> {}; | |
| 36 | : public is_same<__remove_cv_t<_Tp>, void> {}; | |
| 35 | 37 | |
| 36 | 38 | #if _LIBCPP_STD_VER > 14 |
| 37 | 39 | template <class _Tp> |
lib/libcxx/include/__type_traits/make_const_lvalue_ref.h created+26| ... | ... | @@ -0,0 +1,26 @@ |
| 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_MAKE_CONST_LVALUE_REF_H | |
| 10 | #define _LIBCPP___TYPE_TRAITS_MAKE_CONST_LVALUE_REF_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/remove_reference.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 | using __make_const_lvalue_ref = const __libcpp_remove_reference_t<_Tp>&; | |
| 23 | ||
| 24 | _LIBCPP_END_NAMESPACE_STD | |
| 25 | ||
| 26 | #endif // _LIBCPP___TYPE_TRAITS_MAKE_CONST_LVALUE_REF_H |
lib/libcxx/include/__type_traits/make_signed.h+20-10| ... | ... | @@ -23,19 +23,25 @@ |
| 23 | 23 | |
| 24 | 24 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 25 | 25 | |
| 26 | #if __has_builtin(__make_signed) | |
| 27 | ||
| 28 | template <class _Tp> | |
| 29 | using __make_signed_t = __make_signed(_Tp); | |
| 30 | ||
| 31 | #else | |
| 26 | 32 | typedef |
| 27 | 33 | __type_list<signed char, |
| 28 | 34 | __type_list<signed short, |
| 29 | 35 | __type_list<signed int, |
| 30 | 36 | __type_list<signed long, |
| 31 | 37 | __type_list<signed long long, |
| 32 | #ifndef _LIBCPP_HAS_NO_INT128 | |
| 38 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 33 | 39 | __type_list<__int128_t, |
| 34 | #endif | |
| 40 | # endif | |
| 35 | 41 | __nat |
| 36 | #ifndef _LIBCPP_HAS_NO_INT128 | |
| 42 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 37 | 43 | > |
| 38 | #endif | |
| 44 | # endif | |
| 39 | 45 | > > > > > __signed_types; |
| 40 | 46 | |
| 41 | 47 | template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> |
| ... | ... | @@ -56,19 +62,23 @@ template <> struct __make_signed< signed long, true> {typedef long ty |
| 56 | 62 | template <> struct __make_signed<unsigned long, true> {typedef long type;}; |
| 57 | 63 | template <> struct __make_signed< signed long long, true> {typedef long long type;}; |
| 58 | 64 | template <> struct __make_signed<unsigned long long, true> {typedef long long type;}; |
| 59 | #ifndef _LIBCPP_HAS_NO_INT128 | |
| 65 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 60 | 66 | template <> struct __make_signed<__int128_t, true> {typedef __int128_t type;}; |
| 61 | 67 | template <> struct __make_signed<__uint128_t, true> {typedef __int128_t type;}; |
| 62 | #endif | |
| 68 | # endif | |
| 63 | 69 | |
| 64 | 70 | template <class _Tp> |
| 65 | struct _LIBCPP_TEMPLATE_VIS make_signed | |
| 66 | { | |
| 67 | typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type; | |
| 71 | using __make_signed_t = typename __apply_cv<_Tp, typename __make_signed<__remove_cv_t<_Tp> >::type>::type; | |
| 72 | ||
| 73 | #endif // __has_builtin(__make_signed) | |
| 74 | ||
| 75 | template <class _Tp> | |
| 76 | struct make_signed { | |
| 77 | using type _LIBCPP_NODEBUG = __make_signed_t<_Tp>; | |
| 68 | 78 | }; |
| 69 | 79 | |
| 70 | 80 | #if _LIBCPP_STD_VER > 11 |
| 71 | template <class _Tp> using make_signed_t = typename make_signed<_Tp>::type; | |
| 81 | template <class _Tp> using make_signed_t = __make_signed_t<_Tp>; | |
| 72 | 82 | #endif |
| 73 | 83 | |
| 74 | 84 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/make_unsigned.h+23-13| ... | ... | @@ -25,19 +25,25 @@ |
| 25 | 25 | |
| 26 | 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 27 | |
| 28 | #if __has_builtin(__make_unsigned) | |
| 29 | ||
| 30 | template <class _Tp> | |
| 31 | using __make_unsigned_t = __make_unsigned(_Tp); | |
| 32 | ||
| 33 | #else | |
| 28 | 34 | typedef |
| 29 | 35 | __type_list<unsigned char, |
| 30 | 36 | __type_list<unsigned short, |
| 31 | 37 | __type_list<unsigned int, |
| 32 | 38 | __type_list<unsigned long, |
| 33 | 39 | __type_list<unsigned long long, |
| 34 | #ifndef _LIBCPP_HAS_NO_INT128 | |
| 40 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 35 | 41 | __type_list<__uint128_t, |
| 36 | #endif | |
| 42 | # endif | |
| 37 | 43 | __nat |
| 38 | #ifndef _LIBCPP_HAS_NO_INT128 | |
| 44 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 39 | 45 | > |
| 40 | #endif | |
| 46 | # endif | |
| 41 | 47 | > > > > > __unsigned_types; |
| 42 | 48 | |
| 43 | 49 | template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> |
| ... | ... | @@ -58,31 +64,35 @@ template <> struct __make_unsigned< signed long, true> {typedef unsigned l |
| 58 | 64 | template <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;}; |
| 59 | 65 | template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; |
| 60 | 66 | template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;}; |
| 61 | #ifndef _LIBCPP_HAS_NO_INT128 | |
| 67 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 62 | 68 | template <> struct __make_unsigned<__int128_t, true> {typedef __uint128_t type;}; |
| 63 | 69 | template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_t type;}; |
| 64 | #endif | |
| 70 | # endif | |
| 65 | 71 | |
| 66 | 72 | template <class _Tp> |
| 67 | struct _LIBCPP_TEMPLATE_VIS make_unsigned | |
| 68 | { | |
| 69 | typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type; | |
| 73 | using __make_unsigned_t = typename __apply_cv<_Tp, typename __make_unsigned<__remove_cv_t<_Tp> >::type>::type; | |
| 74 | ||
| 75 | #endif // __has_builtin(__make_unsigned) | |
| 76 | ||
| 77 | template <class _Tp> | |
| 78 | struct make_unsigned { | |
| 79 | using type _LIBCPP_NODEBUG = __make_unsigned_t<_Tp>; | |
| 70 | 80 | }; |
| 71 | 81 | |
| 72 | 82 | #if _LIBCPP_STD_VER > 11 |
| 73 | template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type; | |
| 83 | template <class _Tp> using make_unsigned_t = __make_unsigned_t<_Tp>; | |
| 74 | 84 | #endif |
| 75 | 85 | |
| 76 | 86 | #ifndef _LIBCPP_CXX03_LANG |
| 77 | 87 | template <class _Tp> |
| 78 | 88 | _LIBCPP_HIDE_FROM_ABI constexpr |
| 79 | typename make_unsigned<_Tp>::type __to_unsigned_like(_Tp __x) noexcept { | |
| 80 | return static_cast<typename make_unsigned<_Tp>::type>(__x); | |
| 89 | __make_unsigned_t<_Tp> __to_unsigned_like(_Tp __x) noexcept { | |
| 90 | return static_cast<__make_unsigned_t<_Tp> >(__x); | |
| 81 | 91 | } |
| 82 | 92 | #endif |
| 83 | 93 | |
| 84 | 94 | template <class _Tp, class _Up> |
| 85 | using __copy_unsigned_t = __conditional_t<is_unsigned<_Tp>::value, typename make_unsigned<_Up>::type, _Up>; | |
| 95 | using __copy_unsigned_t = __conditional_t<is_unsigned<_Tp>::value, __make_unsigned_t<_Up>, _Up>; | |
| 86 | 96 | |
| 87 | 97 | _LIBCPP_END_NAMESPACE_STD |
| 88 | 98 |
lib/libcxx/include/__type_traits/maybe_const.h created+26| ... | ... | @@ -0,0 +1,26 @@ |
| 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_MAYBE_CONST_H | |
| 10 | #define _LIBCPP___TYPE_TRAITS_MAYBE_CONST_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/conditional.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<bool _Const, class _Tp> | |
| 22 | using __maybe_const = __conditional_t<_Const, const _Tp, _Tp>; | |
| 23 | ||
| 24 | _LIBCPP_END_NAMESPACE_STD | |
| 25 | ||
| 26 | #endif // _LIBCPP___TYPE_TRAITS_MAYBE_CONST_H |
lib/libcxx/include/__type_traits/negation.h+1-1| ... | ... | @@ -25,7 +25,7 @@ struct _Not : _BoolConstant<!_Pred::value> {}; |
| 25 | 25 | template <class _Tp> |
| 26 | 26 | struct negation : _Not<_Tp> {}; |
| 27 | 27 | template<class _Tp> |
| 28 | inline constexpr bool negation_v = negation<_Tp>::value; | |
| 28 | inline constexpr bool negation_v = !_Tp::value; | |
| 29 | 29 | #endif // _LIBCPP_STD_VER > 14 |
| 30 | 30 | |
| 31 | 31 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/noexcept_move_assign_container.h created+35| ... | ... | @@ -0,0 +1,35 @@ |
| 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_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H | |
| 10 | #define _LIBCPP___TYPE_TRAITS_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__memory/allocator_traits.h> | |
| 14 | #include <__type_traits/integral_constant.h> | |
| 15 | #include <__type_traits/is_nothrow_move_assignable.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 <typename _Alloc, typename _Traits=allocator_traits<_Alloc> > | |
| 24 | struct __noexcept_move_assign_container : public integral_constant<bool, | |
| 25 | _Traits::propagate_on_container_move_assignment::value | |
| 26 | #if _LIBCPP_STD_VER > 14 | |
| 27 | || _Traits::is_always_equal::value | |
| 28 | #else | |
| 29 | && is_nothrow_move_assignable<_Alloc>::value | |
| 30 | #endif | |
| 31 | > {}; | |
| 32 | ||
| 33 | _LIBCPP_END_NAMESPACE_STD | |
| 34 | ||
| 35 | #endif // _LIBCPP___TYPE_TRAITS_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H |
lib/libcxx/include/__type_traits/promote.h+5-1| ... | ... | @@ -33,10 +33,14 @@ struct __numeric_type |
| 33 | 33 | static double __test(unsigned long); |
| 34 | 34 | static double __test(long long); |
| 35 | 35 | static double __test(unsigned long long); |
| 36 | #ifndef _LIBCPP_HAS_NO_INT128 | |
| 37 | static double __test(__int128_t); | |
| 38 | static double __test(__uint128_t); | |
| 39 | #endif | |
| 36 | 40 | static double __test(double); |
| 37 | 41 | static long double __test(long double); |
| 38 | 42 | |
| 39 | typedef decltype(__test(declval<_Tp>())) type; | |
| 43 | typedef decltype(__test(std::declval<_Tp>())) type; | |
| 40 | 44 | static const bool value = _IsNotSame<type, void>::value; |
| 41 | 45 | }; |
| 42 | 46 |
lib/libcxx/include/__type_traits/rank.h+10| ... | ... | @@ -19,6 +19,14 @@ |
| 19 | 19 | |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | // TODO: Enable using the builtin __array_rank when https://llvm.org/PR57133 is resolved | |
| 23 | #if __has_builtin(__array_rank) && 0 | |
| 24 | ||
| 25 | template <class _Tp> | |
| 26 | struct rank : integral_constant<size_t, __array_rank(_Tp)> {}; | |
| 27 | ||
| 28 | #else | |
| 29 | ||
| 22 | 30 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank |
| 23 | 31 | : public integral_constant<size_t, 0> {}; |
| 24 | 32 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]> |
| ... | ... | @@ -26,6 +34,8 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]> |
| 26 | 34 | template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]> |
| 27 | 35 | : public integral_constant<size_t, rank<_Tp>::value + 1> {}; |
| 28 | 36 | |
| 37 | #endif // __has_builtin(__array_rank) | |
| 38 | ||
| 29 | 39 | #if _LIBCPP_STD_VER > 14 |
| 30 | 40 | template <class _Tp> |
| 31 | 41 | inline constexpr size_t rank_v = rank<_Tp>::value; |
lib/libcxx/include/__type_traits/remove_all_extents.h+14-1| ... | ... | @@ -18,6 +18,15 @@ |
| 18 | 18 | |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | #if __has_builtin(__remove_all_extents) | |
| 22 | template <class _Tp> | |
| 23 | struct remove_all_extents { | |
| 24 | using type _LIBCPP_NODEBUG = __remove_all_extents(_Tp); | |
| 25 | }; | |
| 26 | ||
| 27 | template <class _Tp> | |
| 28 | using __remove_all_extents_t = __remove_all_extents(_Tp); | |
| 29 | #else | |
| 21 | 30 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_all_extents |
| 22 | 31 | {typedef _Tp type;}; |
| 23 | 32 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[]> |
| ... | ... | @@ -25,8 +34,12 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[]> |
| 25 | 34 | template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[_Np]> |
| 26 | 35 | {typedef typename remove_all_extents<_Tp>::type type;}; |
| 27 | 36 | |
| 37 | template <class _Tp> | |
| 38 | using __remove_all_extents_t = typename remove_all_extents<_Tp>::type; | |
| 39 | #endif // __has_builtin(__remove_all_extents) | |
| 40 | ||
| 28 | 41 | #if _LIBCPP_STD_VER > 11 |
| 29 | template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type; | |
| 42 | template <class _Tp> using remove_all_extents_t = __remove_all_extents_t<_Tp>; | |
| 30 | 43 | #endif |
| 31 | 44 | |
| 32 | 45 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/remove_const.h+15-1| ... | ... | @@ -17,10 +17,24 @@ |
| 17 | 17 | |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | #if __has_builtin(__remove_const) | |
| 21 | template <class _Tp> | |
| 22 | struct remove_const { | |
| 23 | using type _LIBCPP_NODEBUG = __remove_const(_Tp); | |
| 24 | }; | |
| 25 | ||
| 26 | template <class _Tp> | |
| 27 | using __remove_const_t = __remove_const(_Tp); | |
| 28 | #else | |
| 20 | 29 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const {typedef _Tp type;}; |
| 21 | 30 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const<const _Tp> {typedef _Tp type;}; |
| 31 | ||
| 32 | template <class _Tp> | |
| 33 | using __remove_const_t = typename remove_const<_Tp>::type; | |
| 34 | #endif // __has_builtin(__remove_const) | |
| 35 | ||
| 22 | 36 | #if _LIBCPP_STD_VER > 11 |
| 23 | template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type; | |
| 37 | template <class _Tp> using remove_const_t = __remove_const_t<_Tp>; | |
| 24 | 38 | #endif |
| 25 | 39 | |
| 26 | 40 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/remove_const_ref.h created+27| ... | ... | @@ -0,0 +1,27 @@ |
| 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_REMOVE_CONST_REF_H | |
| 10 | #define _LIBCPP___TYPE_TRAITS_REMOVE_CONST_REF_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/remove_const.h> | |
| 14 | #include <__type_traits/remove_reference.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 | using __remove_const_ref_t = __remove_const_t<__libcpp_remove_reference_t<_Tp> >; | |
| 24 | ||
| 25 | _LIBCPP_END_NAMESPACE_STD | |
| 26 | ||
| 27 | #endif // _LIBCPP___TYPE_TRAITS_REMOVE_CONST_REF_H |
lib/libcxx/include/__type_traits/remove_cv.h+16-2| ... | ... | @@ -19,10 +19,24 @@ |
| 19 | 19 | |
| 20 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | |
| 22 | #if __has_builtin(__remove_cv) | |
| 23 | template <class _Tp> | |
| 24 | struct remove_cv { | |
| 25 | using type _LIBCPP_NODEBUG = __remove_cv(_Tp); | |
| 26 | }; | |
| 27 | ||
| 28 | template <class _Tp> | |
| 29 | using __remove_cv_t = __remove_cv(_Tp); | |
| 30 | #else | |
| 22 | 31 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv |
| 23 | {typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;}; | |
| 32 | {typedef __remove_volatile_t<__remove_const_t<_Tp> > type;}; | |
| 33 | ||
| 34 | template <class _Tp> | |
| 35 | using __remove_cv_t = __remove_volatile_t<__remove_const_t<_Tp> >; | |
| 36 | #endif // __has_builtin(__remove_cv) | |
| 37 | ||
| 24 | 38 | #if _LIBCPP_STD_VER > 11 |
| 25 | template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type; | |
| 39 | template <class _Tp> using remove_cv_t = __remove_cv_t<_Tp>; | |
| 26 | 40 | #endif |
| 27 | 41 | |
| 28 | 42 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/remove_cvref.h+9-5| ... | ... | @@ -20,20 +20,24 @@ |
| 20 | 20 | |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | #if __has_builtin(__remove_cvref) | |
| 23 | 24 | template <class _Tp> |
| 24 | using __uncvref_t _LIBCPP_NODEBUG = typename remove_cv<typename remove_reference<_Tp>::type>::type; | |
| 25 | using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp); | |
| 26 | #else | |
| 27 | template <class _Tp> | |
| 28 | using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >; | |
| 29 | #endif // __has_builtin(__remove_cvref) | |
| 25 | 30 | |
| 26 | 31 | template <class _Tp, class _Up> |
| 27 | struct __is_same_uncvref : _IsSame<__uncvref_t<_Tp>, __uncvref_t<_Up> > {}; | |
| 32 | struct __is_same_uncvref : _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> > {}; | |
| 28 | 33 | |
| 29 | 34 | #if _LIBCPP_STD_VER > 17 |
| 30 | // remove_cvref - same as __uncvref | |
| 31 | 35 | template <class _Tp> |
| 32 | 36 | struct remove_cvref { |
| 33 | using type _LIBCPP_NODEBUG = __uncvref_t<_Tp>; | |
| 37 | using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>; | |
| 34 | 38 | }; |
| 35 | 39 | |
| 36 | template <class _Tp> using remove_cvref_t = typename remove_cvref<_Tp>::type; | |
| 40 | template <class _Tp> using remove_cvref_t = __remove_cvref_t<_Tp>; | |
| 37 | 41 | #endif |
| 38 | 42 | |
| 39 | 43 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/remove_extent.h+14-1| ... | ... | @@ -18,6 +18,15 @@ |
| 18 | 18 | |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | #if __has_builtin(__remove_extent) | |
| 22 | template <class _Tp> | |
| 23 | struct remove_extent { | |
| 24 | using type _LIBCPP_NODEBUG = __remove_extent(_Tp); | |
| 25 | }; | |
| 26 | ||
| 27 | template <class _Tp> | |
| 28 | using __remove_extent_t = __remove_extent(_Tp); | |
| 29 | #else | |
| 21 | 30 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent |
| 22 | 31 | {typedef _Tp type;}; |
| 23 | 32 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[]> |
| ... | ... | @@ -25,8 +34,12 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[]> |
| 25 | 34 | template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[_Np]> |
| 26 | 35 | {typedef _Tp type;}; |
| 27 | 36 | |
| 37 | template <class _Tp> | |
| 38 | using __remove_extent_t = typename remove_extent<_Tp>::type; | |
| 39 | #endif // __has_builtin(__remove_extent) | |
| 40 | ||
| 28 | 41 | #if _LIBCPP_STD_VER > 11 |
| 29 | template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type; | |
| 42 | template <class _Tp> using remove_extent_t = __remove_extent_t<_Tp>; | |
| 30 | 43 | #endif |
| 31 | 44 | |
| 32 | 45 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/remove_pointer.h+14-1| ... | ... | @@ -17,14 +17,27 @@ |
| 17 | 17 | |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | #if __has_builtin(__remove_pointer) | |
| 21 | template <class _Tp> | |
| 22 | struct remove_pointer { | |
| 23 | using type _LIBCPP_NODEBUG = __remove_pointer(_Tp); | |
| 24 | }; | |
| 25 | ||
| 26 | template <class _Tp> | |
| 27 | using __remove_pointer_t = __remove_pointer(_Tp); | |
| 28 | #else | |
| 20 | 29 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG _Tp type;}; |
| 21 | 30 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp*> {typedef _LIBCPP_NODEBUG _Tp type;}; |
| 22 | 31 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const> {typedef _LIBCPP_NODEBUG _Tp type;}; |
| 23 | 32 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _LIBCPP_NODEBUG _Tp type;}; |
| 24 | 33 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _LIBCPP_NODEBUG _Tp type;}; |
| 25 | 34 | |
| 35 | template <class _Tp> | |
| 36 | using __remove_pointer_t = typename remove_pointer<_Tp>::type; | |
| 37 | #endif // __has_builtin(__remove_pointer) | |
| 38 | ||
| 26 | 39 | #if _LIBCPP_STD_VER > 11 |
| 27 | template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type; | |
| 40 | template <class _Tp> using remove_pointer_t = __remove_pointer_t<_Tp>; | |
| 28 | 41 | #endif |
| 29 | 42 | |
| 30 | 43 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/remove_reference.h+14-1| ... | ... | @@ -18,12 +18,25 @@ |
| 18 | 18 | |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | #if __has_builtin(__remove_reference_t) | |
| 22 | template <class _Tp> | |
| 23 | struct remove_reference { | |
| 24 | using type _LIBCPP_NODEBUG = __remove_reference_t(_Tp); | |
| 25 | }; | |
| 26 | ||
| 27 | template <class _Tp> | |
| 28 | using __libcpp_remove_reference_t = __remove_reference_t(_Tp); | |
| 29 | #else | |
| 21 | 30 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG _Tp type;}; |
| 22 | 31 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG _Tp type;}; |
| 23 | 32 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG _Tp type;}; |
| 24 | 33 | |
| 34 | template <class _Tp> | |
| 35 | using __libcpp_remove_reference_t = typename remove_reference<_Tp>::type; | |
| 36 | #endif // __has_builtin(__remove_reference_t) | |
| 37 | ||
| 25 | 38 | #if _LIBCPP_STD_VER > 11 |
| 26 | template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type; | |
| 39 | template <class _Tp> using remove_reference_t = __libcpp_remove_reference_t<_Tp>; | |
| 27 | 40 | #endif |
| 28 | 41 | |
| 29 | 42 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/remove_volatile.h+15-1| ... | ... | @@ -17,10 +17,24 @@ |
| 17 | 17 | |
| 18 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | 19 | |
| 20 | #if __has_builtin(__remove_volatile) | |
| 21 | template <class _Tp> | |
| 22 | struct remove_volatile { | |
| 23 | using type _LIBCPP_NODEBUG = __remove_volatile(_Tp); | |
| 24 | }; | |
| 25 | ||
| 26 | template <class _Tp> | |
| 27 | using __remove_volatile_t = __remove_volatile(_Tp); | |
| 28 | #else | |
| 20 | 29 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile {typedef _Tp type;}; |
| 21 | 30 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile<volatile _Tp> {typedef _Tp type;}; |
| 31 | ||
| 32 | template <class _Tp> | |
| 33 | using __remove_volatile_t = typename remove_volatile<_Tp>::type; | |
| 34 | #endif // __has_builtin(__remove_volatile) | |
| 35 | ||
| 22 | 36 | #if _LIBCPP_STD_VER > 11 |
| 23 | template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type; | |
| 37 | template <class _Tp> using remove_volatile_t = __remove_volatile_t<_Tp>; | |
| 24 | 38 | #endif |
| 25 | 39 | |
| 26 | 40 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__type_traits/result_of.h created+39| ... | ... | @@ -0,0 +1,39 @@ |
| 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_RESULT_OF_H | |
| 10 | #define _LIBCPP___TYPE_TRAITS_RESULT_OF_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__functional/invoke.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 | // result_of | |
| 22 | ||
| 23 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | |
| 24 | template <class _Callable> class _LIBCPP_DEPRECATED_IN_CXX17 result_of; | |
| 25 | ||
| 26 | template <class _Fp, class ..._Args> | |
| 27 | class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)> | |
| 28 | : public __invoke_of<_Fp, _Args...> | |
| 29 | { | |
| 30 | }; | |
| 31 | ||
| 32 | #if _LIBCPP_STD_VER > 11 | |
| 33 | template <class _Tp> using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type; | |
| 34 | #endif // _LIBCPP_STD_VER > 11 | |
| 35 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | |
| 36 | ||
| 37 | _LIBCPP_END_NAMESPACE_STD | |
| 38 | ||
| 39 | #endif // _LIBCPP___TYPE_TRAITS_RESULT_OF_H |
lib/libcxx/include/__type_traits/strip_signature.h created+79| ... | ... | @@ -0,0 +1,79 @@ |
| 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_STRIP_SIGNATURE_H | |
| 10 | #define _LIBCPP___TYPE_TRAITS_STRIP_SIGNATURE_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | ||
| 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 15 | # pragma GCC system_header | |
| 16 | #endif | |
| 17 | ||
| 18 | #if _LIBCPP_STD_VER >= 17 | |
| 19 | ||
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 21 | ||
| 22 | template<class _Fp> | |
| 23 | struct __strip_signature; | |
| 24 | ||
| 25 | # if defined(__cpp_static_call_operator) && __cpp_static_call_operator >= 202207L | |
| 26 | ||
| 27 | template <class _Rp, class... _Args> | |
| 28 | struct __strip_signature<_Rp(*)(_Args...)> { | |
| 29 | using type = _Rp(_Args...); | |
| 30 | }; | |
| 31 | ||
| 32 | template <class _Rp, class... _Args> | |
| 33 | struct __strip_signature<_Rp(*)(_Args...) noexcept> { | |
| 34 | using type = _Rp(_Args...); | |
| 35 | }; | |
| 36 | ||
| 37 | # endif // defined(__cpp_static_call_operator) && __cpp_static_call_operator >= 202207L | |
| 38 | ||
| 39 | template<class _Rp, class _Gp, class ..._Ap> | |
| 40 | struct __strip_signature<_Rp (_Gp::*) (_Ap...)> { using type = _Rp(_Ap...); }; | |
| 41 | template<class _Rp, class _Gp, class ..._Ap> | |
| 42 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const> { using type = _Rp(_Ap...); }; | |
| 43 | template<class _Rp, class _Gp, class ..._Ap> | |
| 44 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile> { using type = _Rp(_Ap...); }; | |
| 45 | template<class _Rp, class _Gp, class ..._Ap> | |
| 46 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile> { using type = _Rp(_Ap...); }; | |
| 47 | ||
| 48 | template<class _Rp, class _Gp, class ..._Ap> | |
| 49 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) &> { using type = _Rp(_Ap...); }; | |
| 50 | template<class _Rp, class _Gp, class ..._Ap> | |
| 51 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const &> { using type = _Rp(_Ap...); }; | |
| 52 | template<class _Rp, class _Gp, class ..._Ap> | |
| 53 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile &> { using type = _Rp(_Ap...); }; | |
| 54 | template<class _Rp, class _Gp, class ..._Ap> | |
| 55 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile &> { using type = _Rp(_Ap...); }; | |
| 56 | ||
| 57 | template<class _Rp, class _Gp, class ..._Ap> | |
| 58 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) noexcept> { using type = _Rp(_Ap...); }; | |
| 59 | template<class _Rp, class _Gp, class ..._Ap> | |
| 60 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const noexcept> { using type = _Rp(_Ap...); }; | |
| 61 | template<class _Rp, class _Gp, class ..._Ap> | |
| 62 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile noexcept> { using type = _Rp(_Ap...); }; | |
| 63 | template<class _Rp, class _Gp, class ..._Ap> | |
| 64 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile noexcept> { using type = _Rp(_Ap...); }; | |
| 65 | ||
| 66 | template<class _Rp, class _Gp, class ..._Ap> | |
| 67 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) & noexcept> { using type = _Rp(_Ap...); }; | |
| 68 | template<class _Rp, class _Gp, class ..._Ap> | |
| 69 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const & noexcept> { using type = _Rp(_Ap...); }; | |
| 70 | template<class _Rp, class _Gp, class ..._Ap> | |
| 71 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile & noexcept> { using type = _Rp(_Ap...); }; | |
| 72 | template<class _Rp, class _Gp, class ..._Ap> | |
| 73 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile & noexcept> { using type = _Rp(_Ap...); }; | |
| 74 | ||
| 75 | _LIBCPP_END_NAMESPACE_STD | |
| 76 | ||
| 77 | #endif // _LIBCPP_STD_VER >= 17 | |
| 78 | ||
| 79 | #endif // _LIBCPP___TYPE_TRAITS_STRIP_SIGNATURE_H |
lib/libcxx/include/__type_traits/void_t.h+2-2| ... | ... | @@ -21,8 +21,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 21 | template <class...> using void_t = void; |
| 22 | 22 | #endif |
| 23 | 23 | |
| 24 | template <class> | |
| 25 | struct __void_t { typedef void type; }; | |
| 24 | template <class...> | |
| 25 | using __void_t = void; | |
| 26 | 26 | |
| 27 | 27 | _LIBCPP_END_NAMESPACE_STD |
| 28 | 28 |
lib/libcxx/include/__utility/as_const.h+2-2| ... | ... | @@ -10,9 +10,9 @@ |
| 10 | 10 | #define _LIBCPP___UTILITY_AS_CONST_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/add_const.h> | |
| 13 | 14 | #include <__utility/forward.h> |
| 14 | 15 | #include <__utility/move.h> |
| 15 | #include <type_traits> | |
| 16 | 16 | |
| 17 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 18 | # pragma GCC system_header |
| ... | ... | @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | #if _LIBCPP_STD_VER > 14 |
| 24 | 24 | template <class _Tp> |
| 25 | _LIBCPP_NODISCARD_EXT constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; } | |
| 25 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; } | |
| 26 | 26 | |
| 27 | 27 | template <class _Tp> |
| 28 | 28 | void as_const(const _Tp&&) = delete; |
lib/libcxx/include/__utility/auto_cast.h+1-1| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | #define _LIBCPP___UTILITY_AUTO_CAST_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <type_traits> | |
| 14 | #include <__type_traits/decay.h> | |
| 15 | 15 | |
| 16 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 17 | # pragma GCC system_header |
lib/libcxx/include/__utility/cmp.h+5-1| ... | ... | @@ -10,10 +10,14 @@ |
| 10 | 10 | #define _LIBCPP___UTILITY_CMP_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/disjunction.h> | |
| 14 | #include <__type_traits/is_integral.h> | |
| 15 | #include <__type_traits/is_same.h> | |
| 16 | #include <__type_traits/is_signed.h> | |
| 17 | #include <__type_traits/make_unsigned.h> | |
| 13 | 18 | #include <__utility/forward.h> |
| 14 | 19 | #include <__utility/move.h> |
| 15 | 20 | #include <limits> |
| 16 | #include <type_traits> | |
| 17 | 21 | |
| 18 | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 23 | # pragma GCC system_header |
lib/libcxx/include/__utility/convert_to_integral.h created+72| ... | ... | @@ -0,0 +1,72 @@ |
| 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_CONVERT_TO_INTEGRAL_H | |
| 10 | #define _LIBCPP___UTILITY_CONVERT_TO_INTEGRAL_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__type_traits/enable_if.h> | |
| 14 | #include <__type_traits/is_enum.h> | |
| 15 | #include <__type_traits/is_floating_point.h> | |
| 16 | #include <__type_traits/underlying_type.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 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 25 | int __convert_to_integral(int __val) { return __val; } | |
| 26 | ||
| 27 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 28 | unsigned __convert_to_integral(unsigned __val) { return __val; } | |
| 29 | ||
| 30 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 31 | long __convert_to_integral(long __val) { return __val; } | |
| 32 | ||
| 33 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 34 | unsigned long __convert_to_integral(unsigned long __val) { return __val; } | |
| 35 | ||
| 36 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 37 | long long __convert_to_integral(long long __val) { return __val; } | |
| 38 | ||
| 39 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 40 | unsigned long long __convert_to_integral(unsigned long long __val) {return __val; } | |
| 41 | ||
| 42 | template<typename _Fp> | |
| 43 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 44 | typename enable_if<is_floating_point<_Fp>::value, long long>::type | |
| 45 | __convert_to_integral(_Fp __val) { return __val; } | |
| 46 | ||
| 47 | #ifndef _LIBCPP_HAS_NO_INT128 | |
| 48 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 49 | __int128_t __convert_to_integral(__int128_t __val) { return __val; } | |
| 50 | ||
| 51 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 52 | __uint128_t __convert_to_integral(__uint128_t __val) { return __val; } | |
| 53 | #endif | |
| 54 | ||
| 55 | template <class _Tp, bool = is_enum<_Tp>::value> | |
| 56 | struct __sfinae_underlying_type | |
| 57 | { | |
| 58 | typedef typename underlying_type<_Tp>::type type; | |
| 59 | typedef decltype(((type)1) + 0) __promoted_type; | |
| 60 | }; | |
| 61 | ||
| 62 | template <class _Tp> | |
| 63 | struct __sfinae_underlying_type<_Tp, false> {}; | |
| 64 | ||
| 65 | template <class _Tp> | |
| 66 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 67 | typename __sfinae_underlying_type<_Tp>::__promoted_type | |
| 68 | __convert_to_integral(_Tp __val) { return __val; } | |
| 69 | ||
| 70 | _LIBCPP_END_NAMESPACE_STD | |
| 71 | ||
| 72 | #endif // _LIBCPP___UTILITY_CONVERT_TO_INTEGRAL_H |
lib/libcxx/include/__utility/declval.h+1-1| ... | ... | @@ -27,7 +27,7 @@ _Tp __declval(long); |
| 27 | 27 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 28 | 28 | |
| 29 | 29 | template <class _Tp> |
| 30 | decltype(__declval<_Tp>(0)) declval() _NOEXCEPT; | |
| 30 | decltype(std::__declval<_Tp>(0)) declval() _NOEXCEPT; | |
| 31 | 31 | |
| 32 | 32 | _LIBCPP_END_NAMESPACE_STD |
| 33 | 33 |
lib/libcxx/include/__utility/exception_guard.h created+128| ... | ... | @@ -0,0 +1,128 @@ |
| 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_TRANSACTION_H | |
| 10 | #define _LIBCPP___UTILITY_TRANSACTION_H | |
| 11 | ||
| 12 | #include <__assert> | |
| 13 | #include <__config> | |
| 14 | #include <__type_traits/is_nothrow_move_constructible.h> | |
| 15 | #include <__utility/exchange.h> | |
| 16 | #include <__utility/move.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 | // __exception_guard is a helper class for writing code with the strong exception guarantee. | |
| 25 | // | |
| 26 | // When writing code that can throw an exception, one can store rollback instructions in an | |
| 27 | // exception guard so that if an exception is thrown at any point during the lifetime of the | |
| 28 | // exception guard, it will be rolled back automatically. When the exception guard is done, one | |
| 29 | // must mark it as being complete so it isn't rolled back when the exception guard is destroyed. | |
| 30 | // | |
| 31 | // Exception guards are not default constructible, they can't be copied or assigned to, but | |
| 32 | // they can be moved around for convenience. | |
| 33 | // | |
| 34 | // __exception_guard is a no-op in -fno-exceptions mode to produce better code-gen. This means | |
| 35 | // that we don't provide the strong exception guarantees. However, Clang doesn't generate cleanup | |
| 36 | // code with exceptions disabled, so even if we wanted to provide the strong exception guarantees | |
| 37 | // we couldn't. This is also only relevant for constructs with a stack of | |
| 38 | // -fexceptions > -fno-exceptions > -fexceptions code, since the exception can't be caught where | |
| 39 | // exceptions are disabled. While -fexceptions > -fno-exceptions is quite common | |
| 40 | // (e.g. libc++.dylib > -fno-exceptions), having another layer with exceptions enabled seems a lot | |
| 41 | // less common, especially one that tries to catch an exception through -fno-exceptions code. | |
| 42 | // | |
| 43 | // __exception_guard can help greatly simplify code that would normally be cluttered by | |
| 44 | // `#if _LIBCPP_NO_EXCEPTIONS`. For example: | |
| 45 | // | |
| 46 | // template <class Iterator, class Size, class OutputIterator> | |
| 47 | // Iterator uninitialized_copy_n(Iterator iter, Size n, OutputIterator out) { | |
| 48 | // typedef typename iterator_traits<Iterator>::value_type value_type; | |
| 49 | // __exception_guard guard([start=out, &out] { | |
| 50 | // std::destroy(start, out); | |
| 51 | // }); | |
| 52 | // | |
| 53 | // for (; n > 0; ++iter, ++out, --n) { | |
| 54 | // ::new ((void*)std::addressof(*out)) value_type(*iter); | |
| 55 | // } | |
| 56 | // guard.__complete(); | |
| 57 | // return out; | |
| 58 | // } | |
| 59 | // | |
| 60 | ||
| 61 | #ifndef _LIBCPP_NO_EXCEPTIONS | |
| 62 | template <class _Rollback> | |
| 63 | struct __exception_guard { | |
| 64 | __exception_guard() = delete; | |
| 65 | ||
| 66 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __exception_guard(_Rollback __rollback) | |
| 67 | : __rollback_(std::move(__rollback)), __completed_(false) {} | |
| 68 | ||
| 69 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __exception_guard(__exception_guard&& __other) | |
| 70 | _NOEXCEPT_(is_nothrow_move_constructible<_Rollback>::value) | |
| 71 | : __rollback_(std::move(__other.__rollback_)), __completed_(__other.__completed_) { | |
| 72 | __other.__completed_ = true; | |
| 73 | } | |
| 74 | ||
| 75 | __exception_guard(__exception_guard const&) = delete; | |
| 76 | __exception_guard& operator=(__exception_guard const&) = delete; | |
| 77 | __exception_guard& operator=(__exception_guard&&) = delete; | |
| 78 | ||
| 79 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __complete() _NOEXCEPT { __completed_ = true; } | |
| 80 | ||
| 81 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__exception_guard() { | |
| 82 | if (!__completed_) | |
| 83 | __rollback_(); | |
| 84 | } | |
| 85 | ||
| 86 | private: | |
| 87 | _Rollback __rollback_; | |
| 88 | bool __completed_; | |
| 89 | }; | |
| 90 | #else // _LIBCPP_NO_EXCEPTIONS | |
| 91 | template <class _Rollback> | |
| 92 | struct __exception_guard { | |
| 93 | __exception_guard() = delete; | |
| 94 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG explicit __exception_guard(_Rollback) {} | |
| 95 | ||
| 96 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG __exception_guard(__exception_guard&& __other) | |
| 97 | _NOEXCEPT_(is_nothrow_move_constructible<_Rollback>::value) | |
| 98 | : __completed_(__other.__completed_) { | |
| 99 | __other.__completed_ = true; | |
| 100 | } | |
| 101 | ||
| 102 | __exception_guard(__exception_guard const&) = delete; | |
| 103 | __exception_guard& operator=(__exception_guard const&) = delete; | |
| 104 | __exception_guard& operator=(__exception_guard&&) = delete; | |
| 105 | ||
| 106 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG void __complete() _NOEXCEPT { | |
| 107 | __completed_ = true; | |
| 108 | } | |
| 109 | ||
| 110 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG ~__exception_guard() { | |
| 111 | _LIBCPP_ASSERT(__completed_, "__exception_guard not completed with exceptions disabled"); | |
| 112 | } | |
| 113 | ||
| 114 | private: | |
| 115 | bool __completed_ = false; | |
| 116 | }; | |
| 117 | #endif // _LIBCPP_NO_EXCEPTIONS | |
| 118 | ||
| 119 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__exception_guard); | |
| 120 | ||
| 121 | template <class _Rollback> | |
| 122 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __exception_guard<_Rollback> __make_exception_guard(_Rollback __rollback) { | |
| 123 | return __exception_guard<_Rollback>(std::move(__rollback)); | |
| 124 | } | |
| 125 | ||
| 126 | _LIBCPP_END_NAMESPACE_STD | |
| 127 | ||
| 128 | #endif // _LIBCPP___UTILITY_TRANSACTION_H |
lib/libcxx/include/__utility/exchange.h+3-2| ... | ... | @@ -10,9 +10,10 @@ |
| 10 | 10 | #define _LIBCPP___UTILITY_EXCHANGE_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/is_nothrow_assignable.h> | |
| 14 | #include <__type_traits/is_nothrow_move_constructible.h> | |
| 13 | 15 | #include <__utility/forward.h> |
| 14 | 16 | #include <__utility/move.h> |
| 15 | #include <type_traits> | |
| 16 | 17 | |
| 17 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 19 | # pragma GCC system_header |
| ... | ... | @@ -22,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 23 | |
| 23 | 24 | #if _LIBCPP_STD_VER > 11 |
| 24 | 25 | template<class _T1, class _T2 = _T1> |
| 25 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 26 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 26 | 27 | _T1 exchange(_T1& __obj, _T2&& __new_value) |
| 27 | 28 | noexcept(is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) |
| 28 | 29 | { |
lib/libcxx/include/__utility/forward.h+4-4| ... | ... | @@ -21,14 +21,14 @@ |
| 21 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | 22 | |
| 23 | 23 | template <class _Tp> |
| 24 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& | |
| 25 | forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT { | |
| 24 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& | |
| 25 | forward(_LIBCPP_LIFETIMEBOUND __libcpp_remove_reference_t<_Tp>& __t) _NOEXCEPT { | |
| 26 | 26 | return static_cast<_Tp&&>(__t); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | template <class _Tp> |
| 30 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& | |
| 31 | forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT { | |
| 30 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& | |
| 31 | forward(_LIBCPP_LIFETIMEBOUND __libcpp_remove_reference_t<_Tp>&& __t) _NOEXCEPT { | |
| 32 | 32 | static_assert(!is_lvalue_reference<_Tp>::value, "cannot forward an rvalue as an lvalue"); |
| 33 | 33 | return static_cast<_Tp&&>(__t); |
| 34 | 34 | } |
lib/libcxx/include/__utility/forward_like.h created+46| ... | ... | @@ -0,0 +1,46 @@ |
| 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___UTILITY_FORWARD_LIKE_H | |
| 11 | #define _LIBCPP___UTILITY_FORWARD_LIKE_H | |
| 12 | ||
| 13 | #include <__config> | |
| 14 | #include <__type_traits/conditional.h> | |
| 15 | #include <__type_traits/is_const.h> | |
| 16 | #include <__type_traits/is_reference.h> | |
| 17 | #include <__type_traits/remove_reference.h> | |
| 18 | ||
| 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 20 | # pragma GCC system_header | |
| 21 | #endif | |
| 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 24 | ||
| 25 | #if _LIBCPP_STD_VER > 20 | |
| 26 | ||
| 27 | template <class _Ap, class _Bp> | |
| 28 | using _CopyConst = _If<is_const_v<_Ap>, const _Bp, _Bp>; | |
| 29 | ||
| 30 | template <class _Ap, class _Bp> | |
| 31 | using _OverrideRef = _If<is_rvalue_reference_v<_Ap>, remove_reference_t<_Bp>&&, _Bp&>; | |
| 32 | ||
| 33 | template <class _Ap, class _Bp> | |
| 34 | using _ForwardLike = _OverrideRef<_Ap&&, _CopyConst<remove_reference_t<_Ap>, remove_reference_t<_Bp>>>; | |
| 35 | ||
| 36 | template <class _Tp, class _Up> | |
| 37 | [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto forward_like(_LIBCPP_LIFETIMEBOUND _Up&& __ux) noexcept | |
| 38 | -> _ForwardLike<_Tp, _Up> { | |
| 39 | return static_cast<_ForwardLike<_Tp, _Up>>(__ux); | |
| 40 | } | |
| 41 | ||
| 42 | #endif // _LIBCPP_STD_VER > 20 | |
| 43 | ||
| 44 | _LIBCPP_END_NAMESPACE_STD | |
| 45 | ||
| 46 | #endif // _LIBCPP___UTILITY_FORWARD_LIKE_H |
lib/libcxx/include/__utility/in_place.h+4-3| ... | ... | @@ -10,7 +10,8 @@ |
| 10 | 10 | #define _LIBCPP___UTILITY_IN_PLACE_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <type_traits> | |
| 13 | #include <__type_traits/remove_cvref.h> | |
| 14 | #include <cstddef> | |
| 14 | 15 | |
| 15 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 17 | # pragma GCC system_header |
| ... | ... | @@ -43,13 +44,13 @@ template <class _Tp> struct __is_inplace_type_imp : false_type {}; |
| 43 | 44 | template <class _Tp> struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {}; |
| 44 | 45 | |
| 45 | 46 | template <class _Tp> |
| 46 | using __is_inplace_type = __is_inplace_type_imp<__uncvref_t<_Tp>>; | |
| 47 | using __is_inplace_type = __is_inplace_type_imp<__remove_cvref_t<_Tp>>; | |
| 47 | 48 | |
| 48 | 49 | template <class _Tp> struct __is_inplace_index_imp : false_type {}; |
| 49 | 50 | template <size_t _Idx> struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {}; |
| 50 | 51 | |
| 51 | 52 | template <class _Tp> |
| 52 | using __is_inplace_index = __is_inplace_index_imp<__uncvref_t<_Tp>>; | |
| 53 | using __is_inplace_index = __is_inplace_index_imp<__remove_cvref_t<_Tp>>; | |
| 53 | 54 | |
| 54 | 55 | #endif // _LIBCPP_STD_VER > 14 |
| 55 | 56 |
lib/libcxx/include/__utility/integer_sequence.h+76-1| ... | ... | @@ -10,7 +10,8 @@ |
| 10 | 10 | #define _LIBCPP___UTILITY_INTEGER_SEQUENCE_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <type_traits> | |
| 13 | #include <__type_traits/is_integral.h> | |
| 14 | #include <cstddef> | |
| 14 | 15 | |
| 15 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 17 | # pragma GCC system_header |
| ... | ... | @@ -18,6 +19,72 @@ |
| 18 | 19 | |
| 19 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 21 | |
| 22 | template <size_t...> struct __tuple_indices; | |
| 23 | ||
| 24 | template <class _IdxType, _IdxType... _Values> | |
| 25 | struct __integer_sequence { | |
| 26 | template <template <class _OIdxType, _OIdxType...> class _ToIndexSeq, class _ToIndexType> | |
| 27 | using __convert = _ToIndexSeq<_ToIndexType, _Values...>; | |
| 28 | ||
| 29 | template <size_t _Sp> | |
| 30 | using __to_tuple_indices = __tuple_indices<(_Values + _Sp)...>; | |
| 31 | }; | |
| 32 | ||
| 33 | #if !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) | |
| 34 | ||
| 35 | namespace __detail { | |
| 36 | ||
| 37 | template<typename _Tp, size_t ..._Extra> struct __repeat; | |
| 38 | template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> { | |
| 39 | typedef _LIBCPP_NODEBUG __integer_sequence<_Tp, | |
| 40 | _Np..., | |
| 41 | sizeof...(_Np) + _Np..., | |
| 42 | 2 * sizeof...(_Np) + _Np..., | |
| 43 | 3 * sizeof...(_Np) + _Np..., | |
| 44 | 4 * sizeof...(_Np) + _Np..., | |
| 45 | 5 * sizeof...(_Np) + _Np..., | |
| 46 | 6 * sizeof...(_Np) + _Np..., | |
| 47 | 7 * sizeof...(_Np) + _Np..., | |
| 48 | _Extra...> type; | |
| 49 | }; | |
| 50 | ||
| 51 | template<size_t _Np> struct __parity; | |
| 52 | template<size_t _Np> struct __make : __parity<_Np % 8>::template __pmake<_Np> {}; | |
| 53 | ||
| 54 | template<> struct __make<0> { typedef __integer_sequence<size_t> type; }; | |
| 55 | template<> struct __make<1> { typedef __integer_sequence<size_t, 0> type; }; | |
| 56 | template<> struct __make<2> { typedef __integer_sequence<size_t, 0, 1> type; }; | |
| 57 | template<> struct __make<3> { typedef __integer_sequence<size_t, 0, 1, 2> type; }; | |
| 58 | template<> struct __make<4> { typedef __integer_sequence<size_t, 0, 1, 2, 3> type; }; | |
| 59 | template<> struct __make<5> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4> type; }; | |
| 60 | template<> struct __make<6> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5> type; }; | |
| 61 | template<> struct __make<7> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5, 6> type; }; | |
| 62 | ||
| 63 | template<> struct __parity<0> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type> {}; }; | |
| 64 | template<> struct __parity<1> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 1> {}; }; | |
| 65 | template<> struct __parity<2> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 2, _Np - 1> {}; }; | |
| 66 | template<> struct __parity<3> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 3, _Np - 2, _Np - 1> {}; }; | |
| 67 | template<> struct __parity<4> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; | |
| 68 | template<> struct __parity<5> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; | |
| 69 | template<> struct __parity<6> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; | |
| 70 | template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 7, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; | |
| 71 | ||
| 72 | } // namespace detail | |
| 73 | ||
| 74 | #endif | |
| 75 | ||
| 76 | #if __has_builtin(__make_integer_seq) | |
| 77 | template <size_t _Ep, size_t _Sp> | |
| 78 | using __make_indices_imp = | |
| 79 | typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template | |
| 80 | __to_tuple_indices<_Sp>; | |
| 81 | #else | |
| 82 | template <size_t _Ep, size_t _Sp> | |
| 83 | using __make_indices_imp = | |
| 84 | typename __detail::__make<_Ep - _Sp>::type::template __to_tuple_indices<_Sp>; | |
| 85 | ||
| 86 | #endif | |
| 87 | ||
| 21 | 88 | #if _LIBCPP_STD_VER > 11 |
| 22 | 89 | |
| 23 | 90 | template<class _Tp, _Tp... _Ip> |
| ... | ... | @@ -71,6 +138,14 @@ template<size_t _Np> |
| 71 | 138 | template<class... _Tp> |
| 72 | 139 | using index_sequence_for = make_index_sequence<sizeof...(_Tp)>; |
| 73 | 140 | |
| 141 | # if _LIBCPP_STD_VER > 17 | |
| 142 | // Executes __func for every element in an index_sequence. | |
| 143 | template <size_t... _Index, class _Function> | |
| 144 | _LIBCPP_HIDE_FROM_ABI constexpr void __for_each_index_sequence(index_sequence<_Index...>, _Function __func) { | |
| 145 | (__func.template operator()<_Index>(), ...); | |
| 146 | } | |
| 147 | # endif // _LIBCPP_STD_VER > 17 | |
| 148 | ||
| 74 | 149 | #endif // _LIBCPP_STD_VER > 11 |
| 75 | 150 | |
| 76 | 151 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__utility/move.h+11-9| ... | ... | @@ -11,7 +11,10 @@ |
| 11 | 11 | #define _LIBCPP___UTILITY_MOVE_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <type_traits> | |
| 14 | #include <__type_traits/conditional.h> | |
| 15 | #include <__type_traits/is_copy_constructible.h> | |
| 16 | #include <__type_traits/is_nothrow_move_constructible.h> | |
| 17 | #include <__type_traits/remove_reference.h> | |
| 15 | 18 | |
| 16 | 19 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 20 | # pragma GCC system_header |
| ... | ... | @@ -20,21 +23,20 @@ |
| 20 | 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | 24 | |
| 22 | 25 | template <class _Tp> |
| 23 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename remove_reference<_Tp>::type&& | |
| 24 | move(_Tp&& __t) _NOEXCEPT { | |
| 25 | typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type _Up; | |
| 26 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __libcpp_remove_reference_t<_Tp>&& | |
| 27 | move(_LIBCPP_LIFETIMEBOUND _Tp&& __t) _NOEXCEPT { | |
| 28 | typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp> _Up; | |
| 26 | 29 | return static_cast<_Up&&>(__t); |
| 27 | 30 | } |
| 28 | 31 | |
| 29 | 32 | template <class _Tp> |
| 30 | 33 | using __move_if_noexcept_result_t = |
| 31 | typename conditional<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, | |
| 32 | _Tp&&>::type; | |
| 34 | __conditional_t<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&&>; | |
| 33 | 35 | |
| 34 | 36 | template <class _Tp> |
| 35 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __move_if_noexcept_result_t<_Tp> | |
| 36 | move_if_noexcept(_Tp& __x) _NOEXCEPT { | |
| 37 | return _VSTD::move(__x); | |
| 37 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __move_if_noexcept_result_t<_Tp> | |
| 38 | move_if_noexcept(_LIBCPP_LIFETIMEBOUND _Tp& __x) _NOEXCEPT { | |
| 39 | return std::move(__x); | |
| 38 | 40 | } |
| 39 | 41 | |
| 40 | 42 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__utility/pair.h+173-77| ... | ... | @@ -13,12 +13,35 @@ |
| 13 | 13 | #include <__compare/synth_three_way.h> |
| 14 | 14 | #include <__config> |
| 15 | 15 | #include <__functional/unwrap_ref.h> |
| 16 | #include <__tuple> | |
| 16 | #include <__fwd/get.h> | |
| 17 | #include <__fwd/tuple.h> | |
| 18 | #include <__tuple_dir/sfinae_helpers.h> | |
| 19 | #include <__tuple_dir/tuple_element.h> | |
| 20 | #include <__tuple_dir/tuple_indices.h> | |
| 21 | #include <__tuple_dir/tuple_size.h> | |
| 22 | #include <__type_traits/common_reference.h> | |
| 23 | #include <__type_traits/common_type.h> | |
| 24 | #include <__type_traits/conditional.h> | |
| 25 | #include <__type_traits/is_assignable.h> | |
| 26 | #include <__type_traits/is_constructible.h> | |
| 27 | #include <__type_traits/is_convertible.h> | |
| 28 | #include <__type_traits/is_copy_assignable.h> | |
| 29 | #include <__type_traits/is_default_constructible.h> | |
| 30 | #include <__type_traits/is_implicitly_default_constructible.h> | |
| 31 | #include <__type_traits/is_move_assignable.h> | |
| 32 | #include <__type_traits/is_nothrow_assignable.h> | |
| 33 | #include <__type_traits/is_nothrow_constructible.h> | |
| 34 | #include <__type_traits/is_nothrow_copy_assignable.h> | |
| 35 | #include <__type_traits/is_nothrow_copy_constructible.h> | |
| 36 | #include <__type_traits/is_nothrow_default_constructible.h> | |
| 37 | #include <__type_traits/is_nothrow_move_assignable.h> | |
| 38 | #include <__type_traits/is_same.h> | |
| 39 | #include <__type_traits/is_swappable.h> | |
| 40 | #include <__type_traits/nat.h> | |
| 17 | 41 | #include <__utility/forward.h> |
| 18 | 42 | #include <__utility/move.h> |
| 19 | 43 | #include <__utility/piecewise_construct.h> |
| 20 | 44 | #include <cstddef> |
| 21 | #include <type_traits> | |
| 22 | 45 | |
| 23 | 46 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 24 | 47 | # pragma GCC system_header |
| ... | ... | @@ -31,7 +54,7 @@ template <class, class> |
| 31 | 54 | struct __non_trivially_copyable_base { |
| 32 | 55 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 33 | 56 | __non_trivially_copyable_base() _NOEXCEPT {} |
| 34 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 57 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 35 | 58 | __non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {} |
| 36 | 59 | }; |
| 37 | 60 | #endif |
| ... | ... | @@ -48,12 +71,8 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 48 | 71 | _T1 first; |
| 49 | 72 | _T2 second; |
| 50 | 73 | |
| 51 | #if !defined(_LIBCPP_CXX03_LANG) | |
| 52 | 74 | pair(pair const&) = default; |
| 53 | 75 | pair(pair&&) = default; |
| 54 | #else | |
| 55 | // Use the implicitly declared copy constructor in C++03 | |
| 56 | #endif | |
| 57 | 76 | |
| 58 | 77 | #ifdef _LIBCPP_CXX03_LANG |
| 59 | 78 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -88,20 +107,26 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 88 | 107 | } |
| 89 | 108 | |
| 90 | 109 | template <class _U1, class _U2> |
| 91 | static constexpr bool __enable_explicit() { | |
| 110 | static constexpr bool __is_pair_constructible() { | |
| 92 | 111 | return is_constructible<first_type, _U1>::value |
| 93 | && is_constructible<second_type, _U2>::value | |
| 94 | && (!is_convertible<_U1, first_type>::value | |
| 95 | || !is_convertible<_U2, second_type>::value); | |
| 112 | && is_constructible<second_type, _U2>::value; | |
| 96 | 113 | } |
| 97 | 114 | |
| 98 | 115 | template <class _U1, class _U2> |
| 99 | static constexpr bool __enable_implicit() { | |
| 100 | return is_constructible<first_type, _U1>::value | |
| 101 | && is_constructible<second_type, _U2>::value | |
| 102 | && is_convertible<_U1, first_type>::value | |
| 116 | static constexpr bool __is_implicit() { | |
| 117 | return is_convertible<_U1, first_type>::value | |
| 103 | 118 | && is_convertible<_U2, second_type>::value; |
| 104 | 119 | } |
| 120 | ||
| 121 | template <class _U1, class _U2> | |
| 122 | static constexpr bool __enable_explicit() { | |
| 123 | return __is_pair_constructible<_U1, _U2>() && !__is_implicit<_U1, _U2>(); | |
| 124 | } | |
| 125 | ||
| 126 | template <class _U1, class _U2> | |
| 127 | static constexpr bool __enable_implicit() { | |
| 128 | return __is_pair_constructible<_U1, _U2>() && __is_implicit<_U1, _U2>(); | |
| 129 | } | |
| 105 | 130 | }; |
| 106 | 131 | |
| 107 | 132 | template <bool _MaybeEnable> |
| ... | ... | @@ -127,12 +152,12 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 127 | 152 | }; |
| 128 | 153 | |
| 129 | 154 | template <class _Tuple> |
| 130 | using _CheckTLC _LIBCPP_NODEBUG = typename conditional< | |
| 155 | using _CheckTLC _LIBCPP_NODEBUG = __conditional_t< | |
| 131 | 156 | __tuple_like_with_size<_Tuple, 2>::value |
| 132 | 157 | && !is_same<typename decay<_Tuple>::type, pair>::value, |
| 133 | 158 | _CheckTupleLikeConstructor, |
| 134 | 159 | __check_tuple_constructor_fail |
| 135 | >::type; | |
| 160 | >; | |
| 136 | 161 | |
| 137 | 162 | template<bool _Dummy = true, typename enable_if< |
| 138 | 163 | _CheckArgsDep<_Dummy>::__enable_explicit_default() |
| ... | ... | @@ -153,7 +178,7 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 153 | 178 | template <bool _Dummy = true, typename enable_if< |
| 154 | 179 | _CheckArgsDep<_Dummy>::template __enable_explicit<_T1 const&, _T2 const&>() |
| 155 | 180 | >::type* = nullptr> |
| 156 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 181 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 157 | 182 | explicit pair(_T1 const& __t1, _T2 const& __t2) |
| 158 | 183 | _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value && |
| 159 | 184 | is_nothrow_copy_constructible<second_type>::value) |
| ... | ... | @@ -162,7 +187,7 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 162 | 187 | template<bool _Dummy = true, typename enable_if< |
| 163 | 188 | _CheckArgsDep<_Dummy>::template __enable_implicit<_T1 const&, _T2 const&>() |
| 164 | 189 | >::type* = nullptr> |
| 165 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 190 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 166 | 191 | pair(_T1 const& __t1, _T2 const& __t2) |
| 167 | 192 | _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value && |
| 168 | 193 | is_nothrow_copy_constructible<second_type>::value) |
| ... | ... | @@ -176,7 +201,7 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 176 | 201 | #endif |
| 177 | 202 | typename enable_if<_CheckArgs::template __enable_explicit<_U1, _U2>()>::type* = nullptr |
| 178 | 203 | > |
| 179 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 204 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 180 | 205 | explicit pair(_U1&& __u1, _U2&& __u2) |
| 181 | 206 | _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value && |
| 182 | 207 | is_nothrow_constructible<second_type, _U2>::value)) |
| ... | ... | @@ -190,16 +215,27 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 190 | 215 | #endif |
| 191 | 216 | typename enable_if<_CheckArgs::template __enable_implicit<_U1, _U2>()>::type* = nullptr |
| 192 | 217 | > |
| 193 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 218 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 194 | 219 | pair(_U1&& __u1, _U2&& __u2) |
| 195 | 220 | _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value && |
| 196 | 221 | is_nothrow_constructible<second_type, _U2>::value)) |
| 197 | 222 | : first(_VSTD::forward<_U1>(__u1)), second(_VSTD::forward<_U2>(__u2)) {} |
| 198 | 223 | |
| 224 | #if _LIBCPP_STD_VER > 20 | |
| 225 | template<class _U1, class _U2, __enable_if_t< | |
| 226 | _CheckArgs::template __is_pair_constructible<_U1&, _U2&>() | |
| 227 | >* = nullptr> | |
| 228 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 229 | explicit(!_CheckArgs::template __is_implicit<_U1&, _U2&>()) pair(pair<_U1, _U2>& __p) | |
| 230 | noexcept((is_nothrow_constructible<first_type, _U1&>::value && | |
| 231 | is_nothrow_constructible<second_type, _U2&>::value)) | |
| 232 | : first(__p.first), second(__p.second) {} | |
| 233 | #endif | |
| 234 | ||
| 199 | 235 | template<class _U1, class _U2, typename enable_if< |
| 200 | 236 | _CheckArgs::template __enable_explicit<_U1 const&, _U2 const&>() |
| 201 | 237 | >::type* = nullptr> |
| 202 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 238 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 203 | 239 | explicit pair(pair<_U1, _U2> const& __p) |
| 204 | 240 | _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value && |
| 205 | 241 | is_nothrow_constructible<second_type, _U2 const&>::value)) |
| ... | ... | @@ -208,7 +244,7 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 208 | 244 | template<class _U1, class _U2, typename enable_if< |
| 209 | 245 | _CheckArgs::template __enable_implicit<_U1 const&, _U2 const&>() |
| 210 | 246 | >::type* = nullptr> |
| 211 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 247 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 212 | 248 | pair(pair<_U1, _U2> const& __p) |
| 213 | 249 | _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value && |
| 214 | 250 | is_nothrow_constructible<second_type, _U2 const&>::value)) |
| ... | ... | @@ -217,7 +253,7 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 217 | 253 | template<class _U1, class _U2, typename enable_if< |
| 218 | 254 | _CheckArgs::template __enable_explicit<_U1, _U2>() |
| 219 | 255 | >::type* = nullptr> |
| 220 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 256 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 221 | 257 | explicit pair(pair<_U1, _U2>&&__p) |
| 222 | 258 | _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value && |
| 223 | 259 | is_nothrow_constructible<second_type, _U2&&>::value)) |
| ... | ... | @@ -226,16 +262,28 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 226 | 262 | template<class _U1, class _U2, typename enable_if< |
| 227 | 263 | _CheckArgs::template __enable_implicit<_U1, _U2>() |
| 228 | 264 | >::type* = nullptr> |
| 229 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 265 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 230 | 266 | pair(pair<_U1, _U2>&& __p) |
| 231 | 267 | _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value && |
| 232 | 268 | is_nothrow_constructible<second_type, _U2&&>::value)) |
| 233 | 269 | : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} |
| 234 | 270 | |
| 271 | #if _LIBCPP_STD_VER > 20 | |
| 272 | template<class _U1, class _U2, __enable_if_t< | |
| 273 | _CheckArgs::template __is_pair_constructible<const _U1&&, const _U2&&>() | |
| 274 | >* = nullptr> | |
| 275 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 276 | explicit(!_CheckArgs::template __is_implicit<const _U1&&, const _U2&&>()) | |
| 277 | pair(const pair<_U1, _U2>&& __p) | |
| 278 | noexcept(is_nothrow_constructible<first_type, const _U1&&>::value && | |
| 279 | is_nothrow_constructible<second_type, const _U2&&>::value) | |
| 280 | : first(std::move(__p.first)), second(std::move(__p.second)) {} | |
| 281 | #endif | |
| 282 | ||
| 235 | 283 | template<class _Tuple, typename enable_if< |
| 236 | 284 | _CheckTLC<_Tuple>::template __enable_explicit<_Tuple>() |
| 237 | 285 | >::type* = nullptr> |
| 238 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 286 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 239 | 287 | explicit pair(_Tuple&& __p) |
| 240 | 288 | : first(_VSTD::get<0>(_VSTD::forward<_Tuple>(__p))), |
| 241 | 289 | second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {} |
| ... | ... | @@ -243,13 +291,13 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 243 | 291 | template<class _Tuple, typename enable_if< |
| 244 | 292 | _CheckTLC<_Tuple>::template __enable_implicit<_Tuple>() |
| 245 | 293 | >::type* = nullptr> |
| 246 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 294 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 247 | 295 | pair(_Tuple&& __p) |
| 248 | 296 | : first(_VSTD::get<0>(_VSTD::forward<_Tuple>(__p))), |
| 249 | 297 | second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {} |
| 250 | 298 | |
| 251 | 299 | template <class... _Args1, class... _Args2> |
| 252 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 300 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 253 | 301 | pair(piecewise_construct_t __pc, |
| 254 | 302 | tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) |
| 255 | 303 | _NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value && |
| ... | ... | @@ -258,11 +306,11 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 258 | 306 | typename __make_tuple_indices<sizeof...(_Args1)>::type(), |
| 259 | 307 | typename __make_tuple_indices<sizeof...(_Args2) >::type()) {} |
| 260 | 308 | |
| 261 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 262 | pair& operator=(typename conditional< | |
| 309 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 310 | pair& operator=(__conditional_t< | |
| 263 | 311 | is_copy_assignable<first_type>::value && |
| 264 | 312 | is_copy_assignable<second_type>::value, |
| 265 | pair, __nat>::type const& __p) | |
| 313 | pair, __nat> const& __p) | |
| 266 | 314 | _NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value && |
| 267 | 315 | is_nothrow_copy_assignable<second_type>::value) |
| 268 | 316 | { |
| ... | ... | @@ -271,11 +319,11 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 271 | 319 | return *this; |
| 272 | 320 | } |
| 273 | 321 | |
| 274 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 275 | pair& operator=(typename conditional< | |
| 322 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 323 | pair& operator=(__conditional_t< | |
| 276 | 324 | is_move_assignable<first_type>::value && |
| 277 | 325 | is_move_assignable<second_type>::value, |
| 278 | pair, __nat>::type&& __p) | |
| 326 | pair, __nat>&& __p) | |
| 279 | 327 | _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value && |
| 280 | 328 | is_nothrow_move_assignable<second_type>::value) |
| 281 | 329 | { |
| ... | ... | @@ -284,10 +332,54 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 284 | 332 | return *this; |
| 285 | 333 | } |
| 286 | 334 | |
| 335 | #if _LIBCPP_STD_VER > 20 | |
| 336 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 337 | const pair& operator=(pair const& __p) const | |
| 338 | noexcept(is_nothrow_copy_assignable_v<const first_type> && | |
| 339 | is_nothrow_copy_assignable_v<const second_type>) | |
| 340 | requires(is_copy_assignable_v<const first_type> && | |
| 341 | is_copy_assignable_v<const second_type>) { | |
| 342 | first = __p.first; | |
| 343 | second = __p.second; | |
| 344 | return *this; | |
| 345 | } | |
| 346 | ||
| 347 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 348 | const pair& operator=(pair&& __p) const | |
| 349 | noexcept(is_nothrow_assignable_v<const first_type&, first_type> && | |
| 350 | is_nothrow_assignable_v<const second_type&, second_type>) | |
| 351 | requires(is_assignable_v<const first_type&, first_type> && | |
| 352 | is_assignable_v<const second_type&, second_type>) { | |
| 353 | first = std::forward<first_type>(__p.first); | |
| 354 | second = std::forward<second_type>(__p.second); | |
| 355 | return *this; | |
| 356 | } | |
| 357 | ||
| 358 | template<class _U1, class _U2> | |
| 359 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 360 | const pair& operator=(const pair<_U1, _U2>& __p) const | |
| 361 | requires(is_assignable_v<const first_type&, const _U1&> && | |
| 362 | is_assignable_v<const second_type&, const _U2&>) { | |
| 363 | first = __p.first; | |
| 364 | second = __p.second; | |
| 365 | return *this; | |
| 366 | } | |
| 367 | ||
| 368 | template<class _U1, class _U2> | |
| 369 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 370 | const pair& operator=(pair<_U1, _U2>&& __p) const | |
| 371 | requires(is_assignable_v<const first_type&, _U1> && | |
| 372 | is_assignable_v<const second_type&, _U2>) { | |
| 373 | first = std::forward<_U1>(__p.first); | |
| 374 | second = std::forward<_U2>(__p.second); | |
| 375 | return *this; | |
| 376 | } | |
| 377 | #endif // _LIBCPP_STD_VER > 20 | |
| 378 | ||
| 287 | 379 | template <class _Tuple, typename enable_if< |
| 288 | 380 | _CheckTLC<_Tuple>::template __enable_assign<_Tuple>() |
| 289 | 381 | >::type* = nullptr> |
| 290 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 382 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 291 | 383 | pair& operator=(_Tuple&& __p) { |
| 292 | 384 | first = _VSTD::get<0>(_VSTD::forward<_Tuple>(__p)); |
| 293 | 385 | second = _VSTD::get<1>(_VSTD::forward<_Tuple>(__p)); |
| ... | ... | @@ -295,7 +387,7 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 295 | 387 | } |
| 296 | 388 | #endif |
| 297 | 389 | |
| 298 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 390 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 299 | 391 | void |
| 300 | 392 | swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value && |
| 301 | 393 | __is_nothrow_swappable<second_type>::value) |
| ... | ... | @@ -304,11 +396,23 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 304 | 396 | swap(first, __p.first); |
| 305 | 397 | swap(second, __p.second); |
| 306 | 398 | } |
| 399 | ||
| 400 | #if _LIBCPP_STD_VER > 20 | |
| 401 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 402 | void swap(const pair& __p) const | |
| 403 | noexcept(__is_nothrow_swappable<const first_type>::value && | |
| 404 | __is_nothrow_swappable<const second_type>::value) | |
| 405 | { | |
| 406 | using std::swap; | |
| 407 | swap(first, __p.first); | |
| 408 | swap(second, __p.second); | |
| 409 | } | |
| 410 | #endif | |
| 307 | 411 | private: |
| 308 | 412 | |
| 309 | 413 | #ifndef _LIBCPP_CXX03_LANG |
| 310 | 414 | template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2> |
| 311 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 415 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 312 | 416 | pair(piecewise_construct_t, |
| 313 | 417 | tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, |
| 314 | 418 | __tuple_indices<_I1...>, __tuple_indices<_I2...>); |
| ... | ... | @@ -323,7 +427,7 @@ pair(_T1, _T2) -> pair<_T1, _T2>; |
| 323 | 427 | // [pairs.spec], specialized algorithms |
| 324 | 428 | |
| 325 | 429 | template <class _T1, class _T2> |
| 326 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 430 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 327 | 431 | bool |
| 328 | 432 | operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 329 | 433 | { |
| ... | ... | @@ -348,7 +452,7 @@ operator<=>(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 348 | 452 | #else // _LIBCPP_STD_VER > 17 |
| 349 | 453 | |
| 350 | 454 | template <class _T1, class _T2> |
| 351 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 455 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 352 | 456 | bool |
| 353 | 457 | operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 354 | 458 | { |
| ... | ... | @@ -356,7 +460,7 @@ operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 356 | 460 | } |
| 357 | 461 | |
| 358 | 462 | template <class _T1, class _T2> |
| 359 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 463 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 360 | 464 | bool |
| 361 | 465 | operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 362 | 466 | { |
| ... | ... | @@ -364,7 +468,7 @@ operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 364 | 468 | } |
| 365 | 469 | |
| 366 | 470 | template <class _T1, class _T2> |
| 367 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 471 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 368 | 472 | bool |
| 369 | 473 | operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 370 | 474 | { |
| ... | ... | @@ -372,7 +476,7 @@ operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 372 | 476 | } |
| 373 | 477 | |
| 374 | 478 | template <class _T1, class _T2> |
| 375 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 479 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 376 | 480 | bool |
| 377 | 481 | operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 378 | 482 | { |
| ... | ... | @@ -380,7 +484,7 @@ operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 380 | 484 | } |
| 381 | 485 | |
| 382 | 486 | template <class _T1, class _T2> |
| 383 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 487 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 384 | 488 | bool |
| 385 | 489 | operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 386 | 490 | { |
| ... | ... | @@ -406,7 +510,7 @@ struct common_type<pair<_T1, _T2>, pair<_U1, _U2>> { |
| 406 | 510 | #endif // _LIBCPP_STD_VER > 20 |
| 407 | 511 | |
| 408 | 512 | template <class _T1, class _T2> |
| 409 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 513 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 410 | 514 | typename enable_if |
| 411 | 515 | < |
| 412 | 516 | __is_swappable<_T1>::value && |
| ... | ... | @@ -420,10 +524,20 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) |
| 420 | 524 | __x.swap(__y); |
| 421 | 525 | } |
| 422 | 526 | |
| 423 | #ifndef _LIBCPP_CXX03_LANG | |
| 527 | #if _LIBCPP_STD_VER > 20 | |
| 528 | template <class _T1, class _T2> | |
| 529 | requires (__is_swappable<const _T1>::value && | |
| 530 | __is_swappable<const _T2>::value) | |
| 531 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 532 | void swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | |
| 533 | noexcept(noexcept(__x.swap(__y))) | |
| 534 | { | |
| 535 | __x.swap(__y); | |
| 536 | } | |
| 537 | #endif | |
| 424 | 538 | |
| 425 | 539 | template <class _T1, class _T2> |
| 426 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 540 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 427 | 541 | pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type> |
| 428 | 542 | make_pair(_T1&& __t1, _T2&& __t2) |
| 429 | 543 | { |
| ... | ... | @@ -431,18 +545,6 @@ make_pair(_T1&& __t1, _T2&& __t2) |
| 431 | 545 | (_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2)); |
| 432 | 546 | } |
| 433 | 547 | |
| 434 | #else // _LIBCPP_CXX03_LANG | |
| 435 | ||
| 436 | template <class _T1, class _T2> | |
| 437 | inline _LIBCPP_INLINE_VISIBILITY | |
| 438 | pair<_T1,_T2> | |
| 439 | make_pair(_T1 __x, _T2 __y) | |
| 440 | { | |
| 441 | return pair<_T1, _T2>(__x, __y); | |
| 442 | } | |
| 443 | ||
| 444 | #endif // _LIBCPP_CXX03_LANG | |
| 445 | ||
| 446 | 548 | template <class _T1, class _T2> |
| 447 | 549 | struct _LIBCPP_TEMPLATE_VIS tuple_size<pair<_T1, _T2> > |
| 448 | 550 | : public integral_constant<size_t, 2> {}; |
| ... | ... | @@ -472,29 +574,27 @@ struct __get_pair<0> |
| 472 | 574 | { |
| 473 | 575 | template <class _T1, class _T2> |
| 474 | 576 | static |
| 475 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 577 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 476 | 578 | _T1& |
| 477 | 579 | get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} |
| 478 | 580 | |
| 479 | 581 | template <class _T1, class _T2> |
| 480 | 582 | static |
| 481 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 583 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 482 | 584 | const _T1& |
| 483 | 585 | get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} |
| 484 | 586 | |
| 485 | #ifndef _LIBCPP_CXX03_LANG | |
| 486 | 587 | template <class _T1, class _T2> |
| 487 | 588 | static |
| 488 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 589 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 489 | 590 | _T1&& |
| 490 | 591 | get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);} |
| 491 | 592 | |
| 492 | 593 | template <class _T1, class _T2> |
| 493 | 594 | static |
| 494 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 595 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 495 | 596 | const _T1&& |
| 496 | 597 | get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T1>(__p.first);} |
| 497 | #endif // _LIBCPP_CXX03_LANG | |
| 498 | 598 | }; |
| 499 | 599 | |
| 500 | 600 | template <> |
| ... | ... | @@ -502,33 +602,31 @@ struct __get_pair<1> |
| 502 | 602 | { |
| 503 | 603 | template <class _T1, class _T2> |
| 504 | 604 | static |
| 505 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 605 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 506 | 606 | _T2& |
| 507 | 607 | get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} |
| 508 | 608 | |
| 509 | 609 | template <class _T1, class _T2> |
| 510 | 610 | static |
| 511 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 611 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 512 | 612 | const _T2& |
| 513 | 613 | get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} |
| 514 | 614 | |
| 515 | #ifndef _LIBCPP_CXX03_LANG | |
| 516 | 615 | template <class _T1, class _T2> |
| 517 | 616 | static |
| 518 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 617 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 519 | 618 | _T2&& |
| 520 | 619 | get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);} |
| 521 | 620 | |
| 522 | 621 | template <class _T1, class _T2> |
| 523 | 622 | static |
| 524 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 623 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 525 | 624 | const _T2&& |
| 526 | 625 | get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T2>(__p.second);} |
| 527 | #endif // _LIBCPP_CXX03_LANG | |
| 528 | 626 | }; |
| 529 | 627 | |
| 530 | 628 | template <size_t _Ip, class _T1, class _T2> |
| 531 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 629 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 532 | 630 | typename tuple_element<_Ip, pair<_T1, _T2> >::type& |
| 533 | 631 | get(pair<_T1, _T2>& __p) _NOEXCEPT |
| 534 | 632 | { |
| ... | ... | @@ -536,16 +634,15 @@ get(pair<_T1, _T2>& __p) _NOEXCEPT |
| 536 | 634 | } |
| 537 | 635 | |
| 538 | 636 | template <size_t _Ip, class _T1, class _T2> |
| 539 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 637 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 540 | 638 | const typename tuple_element<_Ip, pair<_T1, _T2> >::type& |
| 541 | 639 | get(const pair<_T1, _T2>& __p) _NOEXCEPT |
| 542 | 640 | { |
| 543 | 641 | return __get_pair<_Ip>::get(__p); |
| 544 | 642 | } |
| 545 | 643 | |
| 546 | #ifndef _LIBCPP_CXX03_LANG | |
| 547 | 644 | template <size_t _Ip, class _T1, class _T2> |
| 548 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 645 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 549 | 646 | typename tuple_element<_Ip, pair<_T1, _T2> >::type&& |
| 550 | 647 | get(pair<_T1, _T2>&& __p) _NOEXCEPT |
| 551 | 648 | { |
| ... | ... | @@ -553,13 +650,12 @@ get(pair<_T1, _T2>&& __p) _NOEXCEPT |
| 553 | 650 | } |
| 554 | 651 | |
| 555 | 652 | template <size_t _Ip, class _T1, class _T2> |
| 556 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 653 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 557 | 654 | const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& |
| 558 | 655 | get(const pair<_T1, _T2>&& __p) _NOEXCEPT |
| 559 | 656 | { |
| 560 | 657 | return __get_pair<_Ip>::get(_VSTD::move(__p)); |
| 561 | 658 | } |
| 562 | #endif // _LIBCPP_CXX03_LANG | |
| 563 | 659 | |
| 564 | 660 | #if _LIBCPP_STD_VER > 11 |
| 565 | 661 | template <class _T1, class _T2> |
| ... | ... | @@ -618,7 +714,7 @@ constexpr _T1 const && get(pair<_T2, _T1> const&& __p) _NOEXCEPT |
| 618 | 714 | return __get_pair<1>::get(_VSTD::move(__p)); |
| 619 | 715 | } |
| 620 | 716 | |
| 621 | #endif | |
| 717 | #endif // _LIBCPP_STD_VER > 11 | |
| 622 | 718 | |
| 623 | 719 | _LIBCPP_END_NAMESPACE_STD |
| 624 | 720 |
lib/libcxx/include/__utility/rel_ops.h-3| ... | ... | @@ -10,9 +10,6 @@ |
| 10 | 10 | #define _LIBCPP___UTILITY_REL_OPS_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__utility/forward.h> | |
| 14 | #include <__utility/move.h> | |
| 15 | #include <type_traits> | |
| 16 | 13 | |
| 17 | 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 15 | # pragma GCC system_header |
lib/libcxx/include/__utility/swap.h+7-3| ... | ... | @@ -10,10 +10,14 @@ |
| 10 | 10 | #define _LIBCPP___UTILITY_SWAP_H |
| 11 | 11 | |
| 12 | 12 | #include <__config> |
| 13 | #include <__type_traits/is_move_assignable.h> | |
| 14 | #include <__type_traits/is_move_constructible.h> | |
| 15 | #include <__type_traits/is_nothrow_move_assignable.h> | |
| 16 | #include <__type_traits/is_nothrow_move_constructible.h> | |
| 17 | #include <__type_traits/is_swappable.h> | |
| 13 | 18 | #include <__utility/declval.h> |
| 14 | 19 | #include <__utility/move.h> |
| 15 | 20 | #include <cstddef> |
| 16 | #include <type_traits> | |
| 17 | 21 | |
| 18 | 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 19 | 23 | # pragma GCC system_header |
| ... | ... | @@ -30,7 +34,7 @@ using __swap_result_t = void; |
| 30 | 34 | #endif |
| 31 | 35 | |
| 32 | 36 | template <class _Tp> |
| 33 | inline _LIBCPP_INLINE_VISIBILITY __swap_result_t<_Tp> _LIBCPP_CONSTEXPR_AFTER_CXX17 swap(_Tp& __x, _Tp& __y) | |
| 37 | inline _LIBCPP_INLINE_VISIBILITY __swap_result_t<_Tp> _LIBCPP_CONSTEXPR_SINCE_CXX20 swap(_Tp& __x, _Tp& __y) | |
| 34 | 38 | _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value&& is_nothrow_move_assignable<_Tp>::value) { |
| 35 | 39 | _Tp __t(_VSTD::move(__x)); |
| 36 | 40 | __x = _VSTD::move(__y); |
| ... | ... | @@ -38,7 +42,7 @@ inline _LIBCPP_INLINE_VISIBILITY __swap_result_t<_Tp> _LIBCPP_CONSTEXPR_AFTER_CX |
| 38 | 42 | } |
| 39 | 43 | |
| 40 | 44 | template <class _Tp, size_t _Np> |
| 41 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if<__is_swappable<_Tp>::value>::type | |
| 45 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 typename enable_if<__is_swappable<_Tp>::value>::type | |
| 42 | 46 | swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) { |
| 43 | 47 | for (size_t __i = 0; __i != _Np; ++__i) { |
| 44 | 48 | swap(__a[__i], __b[__i]); |
lib/libcxx/include/__utility/to_underlying.h+1-1| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | #define _LIBCPP___UTILITY_TO_UNDERLYING_H |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <type_traits> | |
| 14 | #include <__type_traits/underlying_type.h> | |
| 15 | 15 | |
| 16 | 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | 17 | # pragma GCC system_header |
lib/libcxx/include/__utility/transaction.h deleted-96| ... | ... | @@ -1,96 +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_TRANSACTION_H | |
| 10 | #define _LIBCPP___UTILITY_TRANSACTION_H | |
| 11 | ||
| 12 | #include <__config> | |
| 13 | #include <__utility/exchange.h> | |
| 14 | #include <__utility/move.h> | |
| 15 | #include <type_traits> | |
| 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 | // __transaction is a helper class for writing code with the strong exception guarantee. | |
| 24 | // | |
| 25 | // When writing code that can throw an exception, one can store rollback instructions in a | |
| 26 | // transaction so that if an exception is thrown at any point during the lifetime of the | |
| 27 | // transaction, it will be rolled back automatically. When the transaction is done, one | |
| 28 | // must mark it as being complete so it isn't rolled back when the transaction is destroyed. | |
| 29 | // | |
| 30 | // Transactions are not default constructible, they can't be copied or assigned to, but | |
| 31 | // they can be moved around for convenience. | |
| 32 | // | |
| 33 | // __transaction can help greatly simplify code that would normally be cluttered by | |
| 34 | // `#if _LIBCPP_NO_EXCEPTIONS`. For example: | |
| 35 | // | |
| 36 | // template <class Iterator, class Size, class OutputIterator> | |
| 37 | // Iterator uninitialized_copy_n(Iterator iter, Size n, OutputIterator out) { | |
| 38 | // typedef typename iterator_traits<Iterator>::value_type value_type; | |
| 39 | // __transaction transaction([start=out, &out] { | |
| 40 | // std::destroy(start, out); | |
| 41 | // }); | |
| 42 | // | |
| 43 | // for (; n > 0; ++iter, ++out, --n) { | |
| 44 | // ::new ((void*)std::addressof(*out)) value_type(*iter); | |
| 45 | // } | |
| 46 | // transaction.__complete(); | |
| 47 | // return out; | |
| 48 | // } | |
| 49 | // | |
| 50 | template <class _Rollback> | |
| 51 | struct __transaction { | |
| 52 | __transaction() = delete; | |
| 53 | ||
| 54 | _LIBCPP_HIDE_FROM_ABI | |
| 55 | _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit __transaction(_Rollback __rollback) | |
| 56 | : __rollback_(_VSTD::move(__rollback)) | |
| 57 | , __completed_(false) | |
| 58 | { } | |
| 59 | ||
| 60 | _LIBCPP_HIDE_FROM_ABI | |
| 61 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __transaction(__transaction&& __other) | |
| 62 | _NOEXCEPT_(is_nothrow_move_constructible<_Rollback>::value) | |
| 63 | : __rollback_(_VSTD::move(__other.__rollback_)) | |
| 64 | , __completed_(__other.__completed_) | |
| 65 | { | |
| 66 | __other.__completed_ = true; | |
| 67 | } | |
| 68 | ||
| 69 | __transaction(__transaction const&) = delete; | |
| 70 | __transaction& operator=(__transaction const&) = delete; | |
| 71 | __transaction& operator=(__transaction&&) = delete; | |
| 72 | ||
| 73 | _LIBCPP_HIDE_FROM_ABI | |
| 74 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __complete() _NOEXCEPT { | |
| 75 | __completed_ = true; | |
| 76 | } | |
| 77 | ||
| 78 | _LIBCPP_HIDE_FROM_ABI | |
| 79 | _LIBCPP_CONSTEXPR_AFTER_CXX17 ~__transaction() { | |
| 80 | if (!__completed_) | |
| 81 | __rollback_(); | |
| 82 | } | |
| 83 | ||
| 84 | private: | |
| 85 | _Rollback __rollback_; | |
| 86 | bool __completed_; | |
| 87 | }; | |
| 88 | ||
| 89 | template <class _Rollback> | |
| 90 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __transaction<_Rollback> __make_transaction(_Rollback __rollback) { | |
| 91 | return __transaction<_Rollback>(std::move(__rollback)); | |
| 92 | } | |
| 93 | ||
| 94 | _LIBCPP_END_NAMESPACE_STD | |
| 95 | ||
| 96 | #endif // _LIBCPP___UTILITY_TRANSACTION_H |
lib/libcxx/include/__utility/unreachable.h+6-10| ... | ... | @@ -9,8 +9,8 @@ |
| 9 | 9 | #ifndef _LIBCPP___UTILITY_UNREACHABLE_H |
| 10 | 10 | #define _LIBCPP___UTILITY_UNREACHABLE_H |
| 11 | 11 | |
| 12 | #include <__assert> | |
| 12 | 13 | #include <__config> |
| 13 | #include <cstdlib> | |
| 14 | 14 | |
| 15 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | 16 | # pragma GCC system_header |
| ... | ... | @@ -18,21 +18,17 @@ |
| 18 | 18 | |
| 19 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | 20 | |
| 21 | _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() | |
| 22 | { | |
| 23 | #if __has_builtin(__builtin_unreachable) | |
| 24 | __builtin_unreachable(); | |
| 25 | #else | |
| 26 | std::abort(); | |
| 27 | #endif | |
| 21 | _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() { | |
| 22 | _LIBCPP_ASSERT(false, "std::unreachable() was reached"); | |
| 23 | __builtin_unreachable(); | |
| 28 | 24 | } |
| 29 | 25 | |
| 30 | 26 | #if _LIBCPP_STD_VER > 20 |
| 31 | 27 | |
| 32 | 28 | [[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void unreachable() { __libcpp_unreachable(); } |
| 33 | 29 | |
| 34 | #endif // _LIBCPP_STD_VER > 20 | |
| 30 | #endif | |
| 35 | 31 | |
| 36 | 32 | _LIBCPP_END_NAMESPACE_STD |
| 37 | 33 | |
| 38 | #endif | |
| 34 | #endif // _LIBCPP___UTILITY_UNREACHABLE_H |
lib/libcxx/include/__variant/monostate.h+18-14| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | #ifndef _LIBCPP___VARIANT_MONOSTATE_H |
| 11 | 11 | #define _LIBCPP___VARIANT_MONOSTATE_H |
| 12 | 12 | |
| 13 | #include <__compare/ordering.h> | |
| 13 | 14 | #include <__config> |
| 14 | 15 | #include <__functional/hash.h> |
| 15 | 16 | #include <cstddef> |
| ... | ... | @@ -24,31 +25,34 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | 25 | |
| 25 | 26 | struct _LIBCPP_TEMPLATE_VIS monostate {}; |
| 26 | 27 | |
| 27 | inline _LIBCPP_INLINE_VISIBILITY | |
| 28 | constexpr bool operator<(monostate, monostate) noexcept { return false; } | |
| 28 | _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(monostate, monostate) noexcept { return true; } | |
| 29 | 29 | |
| 30 | inline _LIBCPP_INLINE_VISIBILITY | |
| 31 | constexpr bool operator>(monostate, monostate) noexcept { return false; } | |
| 30 | # if _LIBCPP_STD_VER > 17 | |
| 32 | 31 | |
| 33 | inline _LIBCPP_INLINE_VISIBILITY | |
| 34 | constexpr bool operator<=(monostate, monostate) noexcept { return true; } | |
| 32 | _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(monostate, monostate) noexcept { | |
| 33 | return strong_ordering::equal; | |
| 34 | } | |
| 35 | 35 | |
| 36 | inline _LIBCPP_INLINE_VISIBILITY | |
| 37 | constexpr bool operator>=(monostate, monostate) noexcept { return true; } | |
| 36 | # else // _LIBCPP_STD_VER > 17 | |
| 38 | 37 | |
| 39 | inline _LIBCPP_INLINE_VISIBILITY | |
| 40 | constexpr bool operator==(monostate, monostate) noexcept { return true; } | |
| 38 | _LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(monostate, monostate) noexcept { return false; } | |
| 41 | 39 | |
| 42 | inline _LIBCPP_INLINE_VISIBILITY | |
| 43 | constexpr bool operator!=(monostate, monostate) noexcept { return false; } | |
| 40 | _LIBCPP_HIDE_FROM_ABI constexpr bool operator<(monostate, monostate) noexcept { return false; } | |
| 41 | ||
| 42 | _LIBCPP_HIDE_FROM_ABI constexpr bool operator>(monostate, monostate) noexcept { return false; } | |
| 43 | ||
| 44 | _LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(monostate, monostate) noexcept { return true; } | |
| 45 | ||
| 46 | _LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(monostate, monostate) noexcept { return true; } | |
| 47 | ||
| 48 | # endif // _LIBCPP_STD_VER > 17 | |
| 44 | 49 | |
| 45 | 50 | template <> |
| 46 | 51 | struct _LIBCPP_TEMPLATE_VIS hash<monostate> { |
| 47 | 52 | using argument_type = monostate; |
| 48 | 53 | using result_type = size_t; |
| 49 | 54 | |
| 50 | inline _LIBCPP_INLINE_VISIBILITY | |
| 51 | result_type operator()(const argument_type&) const _NOEXCEPT { | |
| 55 | inline _LIBCPP_HIDE_FROM_ABI result_type operator()(const argument_type&) const _NOEXCEPT { | |
| 52 | 56 | return 66740831; // return a fundamentally attractive random value. |
| 53 | 57 | } |
| 54 | 58 | }; |
lib/libcxx/include/__verbose_abort+30-24| ... | ... | @@ -17,35 +17,41 @@ |
| 17 | 17 | # pragma GCC system_header |
| 18 | 18 | #endif |
| 19 | 19 | |
| 20 | // Provide a default implementation of __libcpp_verbose_abort if we know that neither the built | |
| 21 | // library not the user is providing one. Otherwise, just declare it and use the one from the | |
| 22 | // built library or the one provided by the user. | |
| 23 | // | |
| 24 | // We can't provide a great implementation because it needs to be pretty much | |
| 25 | // dependency-free (this is included everywhere else in the library). | |
| 26 | #if defined(_LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY) && !defined(_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED) | |
| 27 | ||
| 28 | extern "C" void abort(); | |
| 29 | ||
| 30 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 31 | ||
| 32 | _LIBCPP_NORETURN _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) _LIBCPP_HIDE_FROM_ABI inline | |
| 33 | void __libcpp_verbose_abort(const char *, ...) { | |
| 34 | ::abort(); | |
| 35 | __builtin_unreachable(); // never reached, but needed to tell the compiler that the function never returns | |
| 36 | } | |
| 37 | ||
| 38 | _LIBCPP_END_NAMESPACE_STD | |
| 39 | ||
| 40 | #else | |
| 41 | ||
| 42 | 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 43 | 21 | |
| 22 | // This function should never be called directly from the code -- it should only be called through | |
| 23 | // the _LIBCPP_VERBOSE_ABORT macro. | |
| 44 | 24 | _LIBCPP_NORETURN _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) |
| 45 | 25 | void __libcpp_verbose_abort(const char *__format, ...); |
| 46 | 26 | |
| 47 | _LIBCPP_END_NAMESPACE_STD | |
| 27 | // _LIBCPP_VERBOSE_ABORT(format, args...) | |
| 28 | // | |
| 29 | // This macro is used to abort the program abnormally while providing additional diagnostic information. | |
| 30 | // | |
| 31 | // The first argument is a printf-style format string, and the remaining arguments are values to format | |
| 32 | // into the format-string. This macro can be customized by users to provide fine-grained control over | |
| 33 | // how verbose termination is triggered. | |
| 34 | // | |
| 35 | // If the user does not supply their own version of the _LIBCPP_VERBOSE_ABORT macro, we pick the default | |
| 36 | // behavior based on whether we know the built library we're running against provides support for the | |
| 37 | // verbose termination handler or not. If it does, we call it. If it doesn't, we call __builtin_abort to | |
| 38 | // make sure that the program terminates but without taking any complex dependencies in this header. | |
| 39 | #if !defined(_LIBCPP_VERBOSE_ABORT) | |
| 40 | ||
| 41 | // Support _LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED until LLVM 18, but tell people | |
| 42 | // to move to customizing _LIBCPP_VERBOSE_ABORT instead. | |
| 43 | # if defined(_LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY) && defined(_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED) | |
| 44 | # undef _LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY | |
| 45 | # warning _LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED is deprecated, please customize _LIBCPP_VERBOSE_ABORT instead | |
| 46 | # endif | |
| 47 | ||
| 48 | # if defined(_LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY) | |
| 49 | # define _LIBCPP_VERBOSE_ABORT(...) __builtin_abort() | |
| 50 | # else | |
| 51 | # define _LIBCPP_VERBOSE_ABORT(...) ::std::__libcpp_verbose_abort(__VA_ARGS__) | |
| 52 | # endif | |
| 53 | #endif // !defined(_LIBCPP_VERBOSE_ABORT) | |
| 48 | 54 | |
| 49 | #endif | |
| 55 | _LIBCPP_END_NAMESPACE_STD | |
| 50 | 56 | |
| 51 | 57 | #endif // _LIBCPP___VERBOSE_ABORT |
lib/libcxx/include/algorithm+17-10| ... | ... | @@ -1704,12 +1704,9 @@ template <class BidirectionalIterator, class Compare> |
| 1704 | 1704 | */ |
| 1705 | 1705 | |
| 1706 | 1706 | #include <__assert> // all public C++ headers provide the assertion handler |
| 1707 | #include <__bits> | |
| 1708 | 1707 | #include <__config> |
| 1709 | 1708 | #include <__debug> |
| 1710 | 1709 | #include <cstddef> |
| 1711 | #include <cstring> | |
| 1712 | #include <memory> | |
| 1713 | 1710 | #include <type_traits> |
| 1714 | 1711 | #include <version> |
| 1715 | 1712 | |
| ... | ... | @@ -1899,13 +1896,9 @@ template <class BidirectionalIterator, class Compare> |
| 1899 | 1896 | #include <__algorithm/unwrap_iter.h> |
| 1900 | 1897 | #include <__algorithm/upper_bound.h> |
| 1901 | 1898 | |
| 1902 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 1903 | # include <chrono> | |
| 1904 | # include <iterator> | |
| 1905 | # include <utility> | |
| 1906 | #endif | |
| 1907 | ||
| 1908 | 1899 | // standard-mandated includes |
| 1900 | ||
| 1901 | // [algorithm.syn] | |
| 1909 | 1902 | #include <initializer_list> |
| 1910 | 1903 | |
| 1911 | 1904 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -1913,7 +1906,21 @@ template <class BidirectionalIterator, class Compare> |
| 1913 | 1906 | #endif |
| 1914 | 1907 | |
| 1915 | 1908 | #if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 |
| 1916 | # include <__pstl_algorithm> | |
| 1909 | # include <__pstl_algorithm> | |
| 1910 | #endif | |
| 1911 | ||
| 1912 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 | |
| 1913 | # include <chrono> | |
| 1914 | #endif | |
| 1915 | ||
| 1916 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1917 | # include <atomic> | |
| 1918 | # include <concepts> | |
| 1919 | # include <cstring> | |
| 1920 | # include <iterator> | |
| 1921 | # include <memory> | |
| 1922 | # include <stdexcept> | |
| 1923 | # include <utility> | |
| 1917 | 1924 | #endif |
| 1918 | 1925 | |
| 1919 | 1926 | #endif // _LIBCPP_ALGORITHM |
lib/libcxx/include/any+57-43| ... | ... | @@ -83,21 +83,20 @@ namespace std { |
| 83 | 83 | #include <__assert> // all public C++ headers provide the assertion handler |
| 84 | 84 | #include <__availability> |
| 85 | 85 | #include <__config> |
| 86 | #include <__memory/allocator.h> | |
| 87 | #include <__memory/allocator_destructor.h> | |
| 88 | #include <__memory/allocator_traits.h> | |
| 89 | #include <__memory/unique_ptr.h> | |
| 86 | 90 | #include <__utility/forward.h> |
| 87 | 91 | #include <__utility/in_place.h> |
| 88 | 92 | #include <__utility/move.h> |
| 89 | 93 | #include <__utility/unreachable.h> |
| 90 | 94 | #include <cstdlib> |
| 91 | 95 | #include <initializer_list> |
| 92 | #include <memory> | |
| 93 | 96 | #include <type_traits> |
| 94 | 97 | #include <typeinfo> |
| 95 | 98 | #include <version> |
| 96 | 99 | |
| 97 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 98 | # include <chrono> | |
| 99 | #endif | |
| 100 | ||
| 101 | 100 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 102 | 101 | # pragma GCC system_header |
| 103 | 102 | #endif |
| ... | ... | @@ -106,7 +105,7 @@ namespace std { |
| 106 | 105 | class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast |
| 107 | 106 | { |
| 108 | 107 | public: |
| 109 | virtual const char* what() const _NOEXCEPT; | |
| 108 | const char* what() const _NOEXCEPT override; | |
| 110 | 109 | }; |
| 111 | 110 | } // namespace std |
| 112 | 111 | |
| ... | ... | @@ -139,7 +138,9 @@ add_pointer_t<_ValueType> any_cast(any *) _NOEXCEPT; |
| 139 | 138 | |
| 140 | 139 | namespace __any_imp |
| 141 | 140 | { |
| 141 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 142 | 142 | using _Buffer = aligned_storage_t<3*sizeof(void*), alignment_of<void*>::value>; |
| 143 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 143 | 144 | |
| 144 | 145 | template <class _Tp> |
| 145 | 146 | using _IsSmallObject = integral_constant<bool |
| ... | ... | @@ -194,18 +195,18 @@ class _LIBCPP_TEMPLATE_VIS any |
| 194 | 195 | public: |
| 195 | 196 | // construct/destruct |
| 196 | 197 | _LIBCPP_INLINE_VISIBILITY |
| 197 | constexpr any() _NOEXCEPT : __h(nullptr) {} | |
| 198 | constexpr any() _NOEXCEPT : __h_(nullptr) {} | |
| 198 | 199 | |
| 199 | 200 | _LIBCPP_INLINE_VISIBILITY |
| 200 | any(any const & __other) : __h(nullptr) | |
| 201 | any(any const & __other) : __h_(nullptr) | |
| 201 | 202 | { |
| 202 | if (__other.__h) __other.__call(_Action::_Copy, this); | |
| 203 | if (__other.__h_) __other.__call(_Action::_Copy, this); | |
| 203 | 204 | } |
| 204 | 205 | |
| 205 | 206 | _LIBCPP_INLINE_VISIBILITY |
| 206 | any(any && __other) _NOEXCEPT : __h(nullptr) | |
| 207 | any(any && __other) _NOEXCEPT : __h_(nullptr) | |
| 207 | 208 | { |
| 208 | if (__other.__h) __other.__call(_Action::_Move, this); | |
| 209 | if (__other.__h_) __other.__call(_Action::_Move, this); | |
| 209 | 210 | } |
| 210 | 211 | |
| 211 | 212 | template < |
| ... | ... | @@ -284,19 +285,19 @@ public: |
| 284 | 285 | |
| 285 | 286 | // 6.3.3 any modifiers |
| 286 | 287 | _LIBCPP_INLINE_VISIBILITY |
| 287 | void reset() _NOEXCEPT { if (__h) this->__call(_Action::_Destroy); } | |
| 288 | void reset() _NOEXCEPT { if (__h_) this->__call(_Action::_Destroy); } | |
| 288 | 289 | |
| 289 | 290 | _LIBCPP_INLINE_VISIBILITY |
| 290 | 291 | void swap(any & __rhs) _NOEXCEPT; |
| 291 | 292 | |
| 292 | 293 | // 6.3.4 any observers |
| 293 | 294 | _LIBCPP_INLINE_VISIBILITY |
| 294 | bool has_value() const _NOEXCEPT { return __h != nullptr; } | |
| 295 | bool has_value() const _NOEXCEPT { return __h_ != nullptr; } | |
| 295 | 296 | |
| 296 | 297 | #if !defined(_LIBCPP_NO_RTTI) |
| 297 | 298 | _LIBCPP_INLINE_VISIBILITY |
| 298 | 299 | const type_info & type() const _NOEXCEPT { |
| 299 | if (__h) { | |
| 300 | if (__h_) { | |
| 300 | 301 | return *static_cast<type_info const *>(this->__call(_Action::_TypeInfo)); |
| 301 | 302 | } else { |
| 302 | 303 | return typeid(void); |
| ... | ... | @@ -320,7 +321,7 @@ private: |
| 320 | 321 | type_info const * __info = nullptr, |
| 321 | 322 | const void* __fallback_info = nullptr) const |
| 322 | 323 | { |
| 323 | return __h(__a, this, __other, __info, __fallback_info); | |
| 324 | return __h_(__a, this, __other, __info, __fallback_info); | |
| 324 | 325 | } |
| 325 | 326 | |
| 326 | 327 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -328,7 +329,7 @@ private: |
| 328 | 329 | type_info const * __info = nullptr, |
| 329 | 330 | const void* __fallback_info = nullptr) |
| 330 | 331 | { |
| 331 | return __h(__a, this, __other, __info, __fallback_info); | |
| 332 | return __h_(__a, this, __other, __info, __fallback_info); | |
| 332 | 333 | } |
| 333 | 334 | |
| 334 | 335 | template <class> |
| ... | ... | @@ -344,8 +345,8 @@ private: |
| 344 | 345 | friend add_pointer_t<_ValueType> |
| 345 | 346 | any_cast(any *) _NOEXCEPT; |
| 346 | 347 | |
| 347 | _HandleFuncPtr __h = nullptr; | |
| 348 | _Storage __s; | |
| 348 | _HandleFuncPtr __h_ = nullptr; | |
| 349 | _Storage __s_; | |
| 349 | 350 | }; |
| 350 | 351 | |
| 351 | 352 | namespace __any_imp |
| ... | ... | @@ -382,9 +383,9 @@ namespace __any_imp |
| 382 | 383 | typedef allocator<_Tp> _Alloc; |
| 383 | 384 | typedef allocator_traits<_Alloc> _ATraits; |
| 384 | 385 | _Alloc __a; |
| 385 | _Tp * __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s.__buf)); | |
| 386 | _Tp * __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s_.__buf)); | |
| 386 | 387 | _ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...); |
| 387 | __dest.__h = &_SmallHandler::__handle; | |
| 388 | __dest.__h_ = &_SmallHandler::__handle; | |
| 388 | 389 | return *__ret; |
| 389 | 390 | } |
| 390 | 391 | |
| ... | ... | @@ -394,21 +395,21 @@ namespace __any_imp |
| 394 | 395 | typedef allocator<_Tp> _Alloc; |
| 395 | 396 | typedef allocator_traits<_Alloc> _ATraits; |
| 396 | 397 | _Alloc __a; |
| 397 | _Tp * __p = static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf)); | |
| 398 | _Tp * __p = static_cast<_Tp *>(static_cast<void*>(&__this.__s_.__buf)); | |
| 398 | 399 | _ATraits::destroy(__a, __p); |
| 399 | __this.__h = nullptr; | |
| 400 | __this.__h_ = nullptr; | |
| 400 | 401 | } |
| 401 | 402 | |
| 402 | 403 | _LIBCPP_INLINE_VISIBILITY |
| 403 | 404 | static void __copy(any const & __this, any & __dest) { |
| 404 | 405 | _SmallHandler::__create(__dest, *static_cast<_Tp const *>( |
| 405 | static_cast<void const *>(&__this.__s.__buf))); | |
| 406 | static_cast<void const *>(&__this.__s_.__buf))); | |
| 406 | 407 | } |
| 407 | 408 | |
| 408 | 409 | _LIBCPP_INLINE_VISIBILITY |
| 409 | 410 | static void __move(any & __this, any & __dest) { |
| 410 | 411 | _SmallHandler::__create(__dest, _VSTD::move( |
| 411 | *static_cast<_Tp*>(static_cast<void*>(&__this.__s.__buf)))); | |
| 412 | *static_cast<_Tp*>(static_cast<void*>(&__this.__s_.__buf)))); | |
| 412 | 413 | __destroy(__this); |
| 413 | 414 | } |
| 414 | 415 | |
| ... | ... | @@ -418,7 +419,7 @@ namespace __any_imp |
| 418 | 419 | const void* __fallback_id) |
| 419 | 420 | { |
| 420 | 421 | if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_id)) |
| 421 | return static_cast<void*>(&__this.__s.__buf); | |
| 422 | return static_cast<void*>(&__this.__s_.__buf); | |
| 422 | 423 | return nullptr; |
| 423 | 424 | } |
| 424 | 425 | |
| ... | ... | @@ -470,8 +471,8 @@ namespace __any_imp |
| 470 | 471 | unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1)); |
| 471 | 472 | _Tp * __ret = __hold.get(); |
| 472 | 473 | _ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...); |
| 473 | __dest.__s.__ptr = __hold.release(); | |
| 474 | __dest.__h = &_LargeHandler::__handle; | |
| 474 | __dest.__s_.__ptr = __hold.release(); | |
| 475 | __dest.__h_ = &_LargeHandler::__handle; | |
| 475 | 476 | return *__ret; |
| 476 | 477 | } |
| 477 | 478 | |
| ... | ... | @@ -482,22 +483,22 @@ namespace __any_imp |
| 482 | 483 | typedef allocator<_Tp> _Alloc; |
| 483 | 484 | typedef allocator_traits<_Alloc> _ATraits; |
| 484 | 485 | _Alloc __a; |
| 485 | _Tp * __p = static_cast<_Tp *>(__this.__s.__ptr); | |
| 486 | _Tp * __p = static_cast<_Tp *>(__this.__s_.__ptr); | |
| 486 | 487 | _ATraits::destroy(__a, __p); |
| 487 | 488 | _ATraits::deallocate(__a, __p, 1); |
| 488 | __this.__h = nullptr; | |
| 489 | __this.__h_ = nullptr; | |
| 489 | 490 | } |
| 490 | 491 | |
| 491 | 492 | _LIBCPP_INLINE_VISIBILITY |
| 492 | 493 | static void __copy(any const & __this, any & __dest) { |
| 493 | _LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s.__ptr)); | |
| 494 | _LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s_.__ptr)); | |
| 494 | 495 | } |
| 495 | 496 | |
| 496 | 497 | _LIBCPP_INLINE_VISIBILITY |
| 497 | 498 | static void __move(any & __this, any & __dest) { |
| 498 | __dest.__s.__ptr = __this.__s.__ptr; | |
| 499 | __dest.__h = &_LargeHandler::__handle; | |
| 500 | __this.__h = nullptr; | |
| 499 | __dest.__s_.__ptr = __this.__s_.__ptr; | |
| 500 | __dest.__h_ = &_LargeHandler::__handle; | |
| 501 | __this.__h_ = nullptr; | |
| 501 | 502 | } |
| 502 | 503 | |
| 503 | 504 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -505,7 +506,7 @@ namespace __any_imp |
| 505 | 506 | void const* __fallback_info) |
| 506 | 507 | { |
| 507 | 508 | if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_info)) |
| 508 | return static_cast<void*>(__this.__s.__ptr); | |
| 509 | return static_cast<void*>(__this.__s_.__ptr); | |
| 509 | 510 | return nullptr; |
| 510 | 511 | |
| 511 | 512 | } |
| ... | ... | @@ -525,7 +526,7 @@ namespace __any_imp |
| 525 | 526 | |
| 526 | 527 | |
| 527 | 528 | template <class _ValueType, class _Tp, class> |
| 528 | any::any(_ValueType && __v) : __h(nullptr) | |
| 529 | any::any(_ValueType && __v) : __h_(nullptr) | |
| 529 | 530 | { |
| 530 | 531 | __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_ValueType>(__v)); |
| 531 | 532 | } |
| ... | ... | @@ -567,16 +568,16 @@ void any::swap(any & __rhs) _NOEXCEPT |
| 567 | 568 | { |
| 568 | 569 | if (this == &__rhs) |
| 569 | 570 | return; |
| 570 | if (__h && __rhs.__h) { | |
| 571 | if (__h_ && __rhs.__h_) { | |
| 571 | 572 | any __tmp; |
| 572 | 573 | __rhs.__call(_Action::_Move, &__tmp); |
| 573 | 574 | this->__call(_Action::_Move, &__rhs); |
| 574 | 575 | __tmp.__call(_Action::_Move, this); |
| 575 | 576 | } |
| 576 | else if (__h) { | |
| 577 | else if (__h_) { | |
| 577 | 578 | this->__call(_Action::_Move, &__rhs); |
| 578 | 579 | } |
| 579 | else if (__rhs.__h) { | |
| 580 | else if (__rhs.__h_) { | |
| 580 | 581 | __rhs.__call(_Action::_Move, this); |
| 581 | 582 | } |
| 582 | 583 | } |
| ... | ... | @@ -606,7 +607,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 606 | 607 | _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST |
| 607 | 608 | _ValueType any_cast(any const & __v) |
| 608 | 609 | { |
| 609 | using _RawValueType = __uncvref_t<_ValueType>; | |
| 610 | using _RawValueType = __remove_cvref_t<_ValueType>; | |
| 610 | 611 | static_assert(is_constructible<_ValueType, _RawValueType const &>::value, |
| 611 | 612 | "ValueType is required to be a const lvalue reference " |
| 612 | 613 | "or a CopyConstructible type"); |
| ... | ... | @@ -621,7 +622,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 621 | 622 | _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST |
| 622 | 623 | _ValueType any_cast(any & __v) |
| 623 | 624 | { |
| 624 | using _RawValueType = __uncvref_t<_ValueType>; | |
| 625 | using _RawValueType = __remove_cvref_t<_ValueType>; | |
| 625 | 626 | static_assert(is_constructible<_ValueType, _RawValueType &>::value, |
| 626 | 627 | "ValueType is required to be an lvalue reference " |
| 627 | 628 | "or a CopyConstructible type"); |
| ... | ... | @@ -636,7 +637,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 636 | 637 | _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST |
| 637 | 638 | _ValueType any_cast(any && __v) |
| 638 | 639 | { |
| 639 | using _RawValueType = __uncvref_t<_ValueType>; | |
| 640 | using _RawValueType = __remove_cvref_t<_ValueType>; | |
| 640 | 641 | static_assert(is_constructible<_ValueType, _RawValueType>::value, |
| 641 | 642 | "ValueType is required to be an rvalue reference " |
| 642 | 643 | "or a CopyConstructible type"); |
| ... | ... | @@ -676,8 +677,8 @@ any_cast(any * __any) _NOEXCEPT |
| 676 | 677 | using __any_imp::_Action; |
| 677 | 678 | static_assert(!is_reference<_ValueType>::value, |
| 678 | 679 | "_ValueType may not be a reference."); |
| 679 | typedef typename add_pointer<_ValueType>::type _ReturnType; | |
| 680 | if (__any && __any->__h) { | |
| 680 | typedef add_pointer_t<_ValueType> _ReturnType; | |
| 681 | if (__any && __any->__h_) { | |
| 681 | 682 | void *__p = __any->__call(_Action::_Get, nullptr, |
| 682 | 683 | #if !defined(_LIBCPP_NO_RTTI) |
| 683 | 684 | &typeid(_ValueType), |
| ... | ... | @@ -695,4 +696,17 @@ any_cast(any * __any) _NOEXCEPT |
| 695 | 696 | |
| 696 | 697 | _LIBCPP_END_NAMESPACE_STD |
| 697 | 698 | |
| 699 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 | |
| 700 | # include <chrono> | |
| 701 | #endif | |
| 702 | ||
| 703 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 704 | # include <atomic> | |
| 705 | # include <concepts> | |
| 706 | # include <iosfwd> | |
| 707 | # include <iterator> | |
| 708 | # include <memory> | |
| 709 | # include <variant> | |
| 710 | #endif | |
| 711 | ||
| 698 | 712 | #endif // _LIBCPP_ANY |
lib/libcxx/include/array+72-68| ... | ... | @@ -115,7 +115,7 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce |
| 115 | 115 | #include <__assert> // all public C++ headers provide the assertion handler |
| 116 | 116 | #include <__config> |
| 117 | 117 | #include <__iterator/reverse_iterator.h> |
| 118 | #include <__tuple> | |
| 118 | #include <__tuple_dir/sfinae_helpers.h> | |
| 119 | 119 | #include <__utility/integer_sequence.h> |
| 120 | 120 | #include <__utility/move.h> |
| 121 | 121 | #include <__utility/unreachable.h> |
| ... | ... | @@ -123,12 +123,6 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce |
| 123 | 123 | #include <type_traits> |
| 124 | 124 | #include <version> |
| 125 | 125 | |
| 126 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 127 | # include <algorithm> | |
| 128 | # include <iterator> | |
| 129 | # include <utility> | |
| 130 | #endif | |
| 131 | ||
| 132 | 126 | // standard-mandated includes |
| 133 | 127 | |
| 134 | 128 | // [iterator.range] |
| ... | ... | @@ -142,6 +136,10 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce |
| 142 | 136 | #include <compare> |
| 143 | 137 | #include <initializer_list> |
| 144 | 138 | |
| 139 | // [tuple.helper] | |
| 140 | #include <__tuple_dir/tuple_element.h> | |
| 141 | #include <__tuple_dir/tuple_size.h> | |
| 142 | ||
| 145 | 143 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 146 | 144 | # pragma GCC system_header |
| 147 | 145 | #endif |
| ... | ... | @@ -168,42 +166,42 @@ struct _LIBCPP_TEMPLATE_VIS array |
| 168 | 166 | _Tp __elems_[_Size]; |
| 169 | 167 | |
| 170 | 168 | // No explicit construct/copy/destroy for aggregate type |
| 171 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 169 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 172 | 170 | void fill(const value_type& __u) { |
| 173 | 171 | _VSTD::fill_n(data(), _Size, __u); |
| 174 | 172 | } |
| 175 | 173 | |
| 176 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 174 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 177 | 175 | void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) { |
| 178 | 176 | _VSTD::swap_ranges(data(), data() + _Size, __a.data()); |
| 179 | 177 | } |
| 180 | 178 | |
| 181 | 179 | // iterators: |
| 182 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 180 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 183 | 181 | iterator begin() _NOEXCEPT {return iterator(data());} |
| 184 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 182 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 185 | 183 | const_iterator begin() const _NOEXCEPT {return const_iterator(data());} |
| 186 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 184 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 187 | 185 | iterator end() _NOEXCEPT {return iterator(data() + _Size);} |
| 188 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 186 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 189 | 187 | const_iterator end() const _NOEXCEPT {return const_iterator(data() + _Size);} |
| 190 | 188 | |
| 191 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 189 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 192 | 190 | reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} |
| 193 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 191 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 194 | 192 | const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());} |
| 195 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 193 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 196 | 194 | reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());} |
| 197 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 195 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 198 | 196 | const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());} |
| 199 | 197 | |
| 200 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 198 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 201 | 199 | const_iterator cbegin() const _NOEXCEPT {return begin();} |
| 202 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 200 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 203 | 201 | const_iterator cend() const _NOEXCEPT {return end();} |
| 204 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 202 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 205 | 203 | const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} |
| 206 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 204 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 207 | 205 | const_reverse_iterator crend() const _NOEXCEPT {return rend();} |
| 208 | 206 | |
| 209 | 207 | // capacity: |
| ... | ... | @@ -215,39 +213,39 @@ struct _LIBCPP_TEMPLATE_VIS array |
| 215 | 213 | _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;} |
| 216 | 214 | |
| 217 | 215 | // element access: |
| 218 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 216 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 219 | 217 | reference operator[](size_type __n) _NOEXCEPT { |
| 220 | 218 | _LIBCPP_ASSERT(__n < _Size, "out-of-bounds access in std::array<T, N>"); |
| 221 | 219 | return __elems_[__n]; |
| 222 | 220 | } |
| 223 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 221 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 224 | 222 | const_reference operator[](size_type __n) const _NOEXCEPT { |
| 225 | 223 | _LIBCPP_ASSERT(__n < _Size, "out-of-bounds access in std::array<T, N>"); |
| 226 | 224 | return __elems_[__n]; |
| 227 | 225 | } |
| 228 | 226 | |
| 229 | _LIBCPP_CONSTEXPR_AFTER_CXX14 reference at(size_type __n) | |
| 227 | _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type __n) | |
| 230 | 228 | { |
| 231 | 229 | if (__n >= _Size) |
| 232 | 230 | __throw_out_of_range("array::at"); |
| 233 | 231 | return __elems_[__n]; |
| 234 | 232 | } |
| 235 | 233 | |
| 236 | _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const | |
| 234 | _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type __n) const | |
| 237 | 235 | { |
| 238 | 236 | if (__n >= _Size) |
| 239 | 237 | __throw_out_of_range("array::at"); |
| 240 | 238 | return __elems_[__n]; |
| 241 | 239 | } |
| 242 | 240 | |
| 243 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front() _NOEXCEPT {return (*this)[0];} | |
| 244 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const _NOEXCEPT {return (*this)[0];} | |
| 245 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() _NOEXCEPT {return (*this)[_Size - 1];} | |
| 246 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const _NOEXCEPT {return (*this)[_Size - 1];} | |
| 241 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT {return (*this)[0];} | |
| 242 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT {return (*this)[0];} | |
| 243 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT {return (*this)[_Size - 1];} | |
| 244 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT {return (*this)[_Size - 1];} | |
| 247 | 245 | |
| 248 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 246 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 249 | 247 | value_type* data() _NOEXCEPT {return __elems_;} |
| 250 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 248 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 251 | 249 | const value_type* data() const _NOEXCEPT {return __elems_;} |
| 252 | 250 | }; |
| 253 | 251 | |
| ... | ... | @@ -268,56 +266,55 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> |
| 268 | 266 | typedef _VSTD::reverse_iterator<iterator> reverse_iterator; |
| 269 | 267 | typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; |
| 270 | 268 | |
| 271 | typedef typename conditional<is_const<_Tp>::value, const char, | |
| 272 | char>::type _CharType; | |
| 269 | typedef __conditional_t<is_const<_Tp>::value, const char, char> _CharType; | |
| 273 | 270 | |
| 274 | 271 | struct _ArrayInStructT { _Tp __data_[1]; }; |
| 275 | 272 | _ALIGNAS_TYPE(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)]; |
| 276 | 273 | |
| 277 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 274 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 278 | 275 | value_type* data() _NOEXCEPT {return nullptr;} |
| 279 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 276 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 280 | 277 | const value_type* data() const _NOEXCEPT {return nullptr;} |
| 281 | 278 | |
| 282 | 279 | // No explicit construct/copy/destroy for aggregate type |
| 283 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 280 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 284 | 281 | void fill(const value_type&) { |
| 285 | 282 | static_assert(!is_const<_Tp>::value, |
| 286 | 283 | "cannot fill zero-sized array of type 'const T'"); |
| 287 | 284 | } |
| 288 | 285 | |
| 289 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 286 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 290 | 287 | void swap(array&) _NOEXCEPT { |
| 291 | 288 | static_assert(!is_const<_Tp>::value, |
| 292 | 289 | "cannot swap zero-sized array of type 'const T'"); |
| 293 | 290 | } |
| 294 | 291 | |
| 295 | 292 | // iterators: |
| 296 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 293 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 297 | 294 | iterator begin() _NOEXCEPT {return iterator(data());} |
| 298 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 295 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 299 | 296 | const_iterator begin() const _NOEXCEPT {return const_iterator(data());} |
| 300 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 297 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 301 | 298 | iterator end() _NOEXCEPT {return iterator(data());} |
| 302 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 299 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 303 | 300 | const_iterator end() const _NOEXCEPT {return const_iterator(data());} |
| 304 | 301 | |
| 305 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 302 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 306 | 303 | reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} |
| 307 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 304 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 308 | 305 | const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());} |
| 309 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 306 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 310 | 307 | reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());} |
| 311 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 308 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 312 | 309 | const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());} |
| 313 | 310 | |
| 314 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 311 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 315 | 312 | const_iterator cbegin() const _NOEXCEPT {return begin();} |
| 316 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 313 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 317 | 314 | const_iterator cend() const _NOEXCEPT {return end();} |
| 318 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 315 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 319 | 316 | const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} |
| 320 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 317 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 321 | 318 | const_reverse_iterator crend() const _NOEXCEPT {return rend();} |
| 322 | 319 | |
| 323 | 320 | // capacity: |
| ... | ... | @@ -329,49 +326,49 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> |
| 329 | 326 | _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return true;} |
| 330 | 327 | |
| 331 | 328 | // element access: |
| 332 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 329 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 333 | 330 | reference operator[](size_type) _NOEXCEPT { |
| 334 | 331 | _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array"); |
| 335 | 332 | __libcpp_unreachable(); |
| 336 | 333 | } |
| 337 | 334 | |
| 338 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 335 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 339 | 336 | const_reference operator[](size_type) const _NOEXCEPT { |
| 340 | 337 | _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array"); |
| 341 | 338 | __libcpp_unreachable(); |
| 342 | 339 | } |
| 343 | 340 | |
| 344 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 341 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 345 | 342 | reference at(size_type) { |
| 346 | 343 | __throw_out_of_range("array<T, 0>::at"); |
| 347 | 344 | __libcpp_unreachable(); |
| 348 | 345 | } |
| 349 | 346 | |
| 350 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 347 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 351 | 348 | const_reference at(size_type) const { |
| 352 | 349 | __throw_out_of_range("array<T, 0>::at"); |
| 353 | 350 | __libcpp_unreachable(); |
| 354 | 351 | } |
| 355 | 352 | |
| 356 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 353 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 357 | 354 | reference front() _NOEXCEPT { |
| 358 | 355 | _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array"); |
| 359 | 356 | __libcpp_unreachable(); |
| 360 | 357 | } |
| 361 | 358 | |
| 362 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 359 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 363 | 360 | const_reference front() const _NOEXCEPT { |
| 364 | 361 | _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array"); |
| 365 | 362 | __libcpp_unreachable(); |
| 366 | 363 | } |
| 367 | 364 | |
| 368 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 365 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 | |
| 369 | 366 | reference back() _NOEXCEPT { |
| 370 | 367 | _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array"); |
| 371 | 368 | __libcpp_unreachable(); |
| 372 | 369 | } |
| 373 | 370 | |
| 374 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 371 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 375 | 372 | const_reference back() const _NOEXCEPT { |
| 376 | 373 | _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array"); |
| 377 | 374 | __libcpp_unreachable(); |
| ... | ... | @@ -389,7 +386,7 @@ array(_Tp, _Args...) |
| 389 | 386 | |
| 390 | 387 | template <class _Tp, size_t _Size> |
| 391 | 388 | inline _LIBCPP_INLINE_VISIBILITY |
| 392 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 389 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 393 | 390 | operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) |
| 394 | 391 | { |
| 395 | 392 | return _VSTD::equal(__x.begin(), __x.end(), __y.begin()); |
| ... | ... | @@ -397,7 +394,7 @@ operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) |
| 397 | 394 | |
| 398 | 395 | template <class _Tp, size_t _Size> |
| 399 | 396 | inline _LIBCPP_INLINE_VISIBILITY |
| 400 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 397 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 401 | 398 | operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) |
| 402 | 399 | { |
| 403 | 400 | return !(__x == __y); |
| ... | ... | @@ -405,7 +402,7 @@ operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) |
| 405 | 402 | |
| 406 | 403 | template <class _Tp, size_t _Size> |
| 407 | 404 | inline _LIBCPP_INLINE_VISIBILITY |
| 408 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 405 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 409 | 406 | operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) |
| 410 | 407 | { |
| 411 | 408 | return _VSTD::lexicographical_compare(__x.begin(), __x.end(), |
| ... | ... | @@ -414,7 +411,7 @@ operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) |
| 414 | 411 | |
| 415 | 412 | template <class _Tp, size_t _Size> |
| 416 | 413 | inline _LIBCPP_INLINE_VISIBILITY |
| 417 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 414 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 418 | 415 | operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) |
| 419 | 416 | { |
| 420 | 417 | return __y < __x; |
| ... | ... | @@ -422,7 +419,7 @@ operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) |
| 422 | 419 | |
| 423 | 420 | template <class _Tp, size_t _Size> |
| 424 | 421 | inline _LIBCPP_INLINE_VISIBILITY |
| 425 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 422 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 426 | 423 | operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) |
| 427 | 424 | { |
| 428 | 425 | return !(__y < __x); |
| ... | ... | @@ -430,14 +427,14 @@ operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) |
| 430 | 427 | |
| 431 | 428 | template <class _Tp, size_t _Size> |
| 432 | 429 | inline _LIBCPP_INLINE_VISIBILITY |
| 433 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 430 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 434 | 431 | operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) |
| 435 | 432 | { |
| 436 | 433 | return !(__x < __y); |
| 437 | 434 | } |
| 438 | 435 | |
| 439 | 436 | template <class _Tp, size_t _Size> |
| 440 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 437 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 441 | 438 | __enable_if_t<_Size == 0 || __is_swappable<_Tp>::value, void> |
| 442 | 439 | swap(array<_Tp, _Size>& __x, array<_Tp, _Size>& __y) |
| 443 | 440 | _NOEXCEPT_(noexcept(__x.swap(__y))) |
| ... | ... | @@ -457,7 +454,7 @@ struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> > |
| 457 | 454 | }; |
| 458 | 455 | |
| 459 | 456 | template <size_t _Ip, class _Tp, size_t _Size> |
| 460 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 457 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 461 | 458 | _Tp& |
| 462 | 459 | get(array<_Tp, _Size>& __a) _NOEXCEPT |
| 463 | 460 | { |
| ... | ... | @@ -466,7 +463,7 @@ get(array<_Tp, _Size>& __a) _NOEXCEPT |
| 466 | 463 | } |
| 467 | 464 | |
| 468 | 465 | template <size_t _Ip, class _Tp, size_t _Size> |
| 469 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 466 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 470 | 467 | const _Tp& |
| 471 | 468 | get(const array<_Tp, _Size>& __a) _NOEXCEPT |
| 472 | 469 | { |
| ... | ... | @@ -475,7 +472,7 @@ get(const array<_Tp, _Size>& __a) _NOEXCEPT |
| 475 | 472 | } |
| 476 | 473 | |
| 477 | 474 | template <size_t _Ip, class _Tp, size_t _Size> |
| 478 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 475 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 479 | 476 | _Tp&& |
| 480 | 477 | get(array<_Tp, _Size>&& __a) _NOEXCEPT |
| 481 | 478 | { |
| ... | ... | @@ -484,7 +481,7 @@ get(array<_Tp, _Size>&& __a) _NOEXCEPT |
| 484 | 481 | } |
| 485 | 482 | |
| 486 | 483 | template <size_t _Ip, class _Tp, size_t _Size> |
| 487 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 484 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 488 | 485 | const _Tp&& |
| 489 | 486 | get(const array<_Tp, _Size>&& __a) _NOEXCEPT |
| 490 | 487 | { |
| ... | ... | @@ -535,4 +532,11 @@ to_array(_Tp(&&__arr)[_Size]) noexcept(is_nothrow_move_constructible_v<_Tp>) { |
| 535 | 532 | |
| 536 | 533 | _LIBCPP_END_NAMESPACE_STD |
| 537 | 534 | |
| 535 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 536 | # include <algorithm> | |
| 537 | # include <concepts> | |
| 538 | # include <iterator> | |
| 539 | # include <utility> | |
| 540 | #endif | |
| 541 | ||
| 538 | 542 | #endif // _LIBCPP_ARRAY |
lib/libcxx/include/atomic+85-89| ... | ... | @@ -377,23 +377,23 @@ template<class T> |
| 377 | 377 | memory_order) noexcept; |
| 378 | 378 | |
| 379 | 379 | template<class T> |
| 380 | void atomic_wait(const volatile atomic<T>*, atomic<T>::value_type); | |
| 380 | void atomic_wait(const volatile atomic<T>*, atomic<T>::value_type) noexcept; | |
| 381 | 381 | template<class T> |
| 382 | void atomic_wait(const atomic<T>*, atomic<T>::value_type); | |
| 382 | void atomic_wait(const atomic<T>*, atomic<T>::value_type) noexcept; | |
| 383 | 383 | template<class T> |
| 384 | 384 | void atomic_wait_explicit(const volatile atomic<T>*, atomic<T>::value_type, |
| 385 | memory_order); | |
| 385 | memory_order) noexcept; | |
| 386 | 386 | template<class T> |
| 387 | 387 | void atomic_wait_explicit(const atomic<T>*, atomic<T>::value_type, |
| 388 | memory_order); | |
| 388 | memory_order) noexcept; | |
| 389 | 389 | template<class T> |
| 390 | void atomic_notify_one(volatile atomic<T>*); | |
| 390 | void atomic_notify_one(volatile atomic<T>*) noexcept; | |
| 391 | 391 | template<class T> |
| 392 | void atomic_notify_one(atomic<T>*); | |
| 392 | void atomic_notify_one(atomic<T>*) noexcept; | |
| 393 | 393 | template<class T> |
| 394 | void atomic_notify_all(volatile atomic<T>*); | |
| 394 | void atomic_notify_all(volatile atomic<T>*) noexcept; | |
| 395 | 395 | template<class T> |
| 396 | void atomic_notify_all(atomic<T>*); | |
| 396 | void atomic_notify_all(atomic<T>*) noexcept; | |
| 397 | 397 | |
| 398 | 398 | // Atomics for standard typedef types |
| 399 | 399 | |
| ... | ... | @@ -524,20 +524,25 @@ template <class T> |
| 524 | 524 | #include <__config> |
| 525 | 525 | #include <__thread/poll_with_backoff.h> |
| 526 | 526 | #include <__thread/timed_backoff_policy.h> |
| 527 | #include <__type_traits/conditional.h> | |
| 528 | #include <__type_traits/decay.h> | |
| 529 | #include <__type_traits/is_assignable.h> | |
| 530 | #include <__type_traits/is_function.h> | |
| 531 | #include <__type_traits/is_nothrow_default_constructible.h> | |
| 532 | #include <__type_traits/is_same.h> | |
| 533 | #include <__type_traits/is_trivially_copyable.h> | |
| 534 | #include <__type_traits/remove_const.h> | |
| 535 | #include <__type_traits/remove_pointer.h> | |
| 536 | #include <__type_traits/underlying_type.h> | |
| 527 | 537 | #include <cstddef> |
| 528 | 538 | #include <cstdint> |
| 529 | 539 | #include <cstring> |
| 530 | #include <type_traits> | |
| 531 | 540 | #include <version> |
| 532 | 541 | |
| 533 | 542 | #ifndef _LIBCPP_HAS_NO_THREADS |
| 534 | 543 | # include <__threading_support> |
| 535 | 544 | #endif |
| 536 | 545 | |
| 537 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 538 | # include <chrono> | |
| 539 | #endif | |
| 540 | ||
| 541 | 546 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 542 | 547 | # pragma GCC system_header |
| 543 | 548 | #endif |
| ... | ... | @@ -948,13 +953,13 @@ void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val, memory_ord |
| 948 | 953 | template<class _Tp> |
| 949 | 954 | _LIBCPP_INLINE_VISIBILITY |
| 950 | 955 | _Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const volatile* __a, memory_order __order) _NOEXCEPT { |
| 951 | using __ptr_type = typename remove_const<decltype(__a->__a_value)>::type*; | |
| 956 | using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*; | |
| 952 | 957 | return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order)); |
| 953 | 958 | } |
| 954 | 959 | template<class _Tp> |
| 955 | 960 | _LIBCPP_INLINE_VISIBILITY |
| 956 | 961 | _Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) _NOEXCEPT { |
| 957 | using __ptr_type = typename remove_const<decltype(__a->__a_value)>::type*; | |
| 962 | using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*; | |
| 958 | 963 | return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order)); |
| 959 | 964 | } |
| 960 | 965 | |
| ... | ... | @@ -1435,17 +1440,7 @@ struct __cxx_atomic_impl : public _Base { |
| 1435 | 1440 | |
| 1436 | 1441 | using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>; |
| 1437 | 1442 | |
| 1438 | #if defined(_LIBCPP_HAS_NO_THREADS) | |
| 1439 | # define _LIBCPP_HAS_NO_PLATFORM_WAIT | |
| 1440 | #endif | |
| 1441 | ||
| 1442 | // TODO: | |
| 1443 | // _LIBCPP_HAS_NO_PLATFORM_WAIT is currently a "dead" macro, in the sense that | |
| 1444 | // it is not tied anywhere into the build system or even documented. We should | |
| 1445 | // clean it up because it is technically never defined except when threads are | |
| 1446 | // disabled. We should clean it up in its own changeset in case we break "bad" | |
| 1447 | // users. | |
| 1448 | #ifndef _LIBCPP_HAS_NO_PLATFORM_WAIT | |
| 1443 | #ifndef _LIBCPP_HAS_NO_THREADS | |
| 1449 | 1444 | |
| 1450 | 1445 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*); |
| 1451 | 1446 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile*); |
| ... | ... | @@ -1466,10 +1461,10 @@ struct __libcpp_atomic_wait_backoff_impl { |
| 1466 | 1461 | { |
| 1467 | 1462 | if(__elapsed > chrono::microseconds(64)) |
| 1468 | 1463 | { |
| 1469 | auto const __monitor = __libcpp_atomic_monitor(__a); | |
| 1464 | auto const __monitor = std::__libcpp_atomic_monitor(__a); | |
| 1470 | 1465 | if(__test_fn()) |
| 1471 | 1466 | return true; |
| 1472 | __libcpp_atomic_wait(__a, __monitor); | |
| 1467 | std::__libcpp_atomic_wait(__a, __monitor); | |
| 1473 | 1468 | } |
| 1474 | 1469 | else if(__elapsed > chrono::microseconds(4)) |
| 1475 | 1470 | __libcpp_thread_yield(); |
| ... | ... | @@ -1484,10 +1479,10 @@ _LIBCPP_AVAILABILITY_SYNC |
| 1484 | 1479 | _LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn) |
| 1485 | 1480 | { |
| 1486 | 1481 | __libcpp_atomic_wait_backoff_impl<_Atp, typename decay<_Fn>::type> __backoff_fn = {__a, __test_fn}; |
| 1487 | return __libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn); | |
| 1482 | return std::__libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn); | |
| 1488 | 1483 | } |
| 1489 | 1484 | |
| 1490 | #else // _LIBCPP_HAS_NO_PLATFORM_WAIT | |
| 1485 | #else // _LIBCPP_HAS_NO_THREADS | |
| 1491 | 1486 | |
| 1492 | 1487 | template <class _Tp> |
| 1493 | 1488 | _LIBCPP_INLINE_VISIBILITY void __cxx_atomic_notify_all(__cxx_atomic_impl<_Tp> const volatile*) { } |
| ... | ... | @@ -1496,15 +1491,10 @@ _LIBCPP_INLINE_VISIBILITY void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp> co |
| 1496 | 1491 | template <class _Atp, class _Fn> |
| 1497 | 1492 | _LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp*, _Fn && __test_fn) |
| 1498 | 1493 | { |
| 1499 | #if defined(_LIBCPP_HAS_NO_THREADS) | |
| 1500 | using _Policy = __spinning_backoff_policy; | |
| 1501 | #else | |
| 1502 | using _Policy = __libcpp_timed_backoff_policy; | |
| 1503 | #endif | |
| 1504 | return __libcpp_thread_poll_with_backoff(__test_fn, _Policy()); | |
| 1494 | return __libcpp_thread_poll_with_backoff(__test_fn, __spinning_backoff_policy()); | |
| 1505 | 1495 | } |
| 1506 | 1496 | |
| 1507 | #endif // _LIBCPP_HAS_NO_PLATFORM_WAIT | |
| 1497 | #endif // _LIBCPP_HAS_NO_THREADS | |
| 1508 | 1498 | |
| 1509 | 1499 | template <class _Atp, class _Tp> |
| 1510 | 1500 | struct __cxx_atomic_wait_test_fn_impl { |
| ... | ... | @@ -1513,7 +1503,7 @@ struct __cxx_atomic_wait_test_fn_impl { |
| 1513 | 1503 | memory_order __order; |
| 1514 | 1504 | _LIBCPP_INLINE_VISIBILITY bool operator()() const |
| 1515 | 1505 | { |
| 1516 | return !__cxx_nonatomic_compare_equal(__cxx_atomic_load(__a, __order), __val); | |
| 1506 | return !std::__cxx_nonatomic_compare_equal(std::__cxx_atomic_load(__a, __order), __val); | |
| 1517 | 1507 | } |
| 1518 | 1508 | }; |
| 1519 | 1509 | |
| ... | ... | @@ -1522,7 +1512,7 @@ _LIBCPP_AVAILABILITY_SYNC |
| 1522 | 1512 | _LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, memory_order __order) |
| 1523 | 1513 | { |
| 1524 | 1514 | __cxx_atomic_wait_test_fn_impl<_Atp, _Tp> __test_fn = {__a, __val, __order}; |
| 1525 | return __cxx_atomic_wait(__a, __test_fn); | |
| 1515 | return std::__cxx_atomic_wait(__a, __test_fn); | |
| 1526 | 1516 | } |
| 1527 | 1517 | |
| 1528 | 1518 | // general atomic<T> |
| ... | ... | @@ -1545,78 +1535,78 @@ struct __atomic_base // false |
| 1545 | 1535 | _LIBCPP_INLINE_VISIBILITY |
| 1546 | 1536 | void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT |
| 1547 | 1537 | _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) |
| 1548 | {__cxx_atomic_store(&__a_, __d, __m);} | |
| 1538 | {std::__cxx_atomic_store(&__a_, __d, __m);} | |
| 1549 | 1539 | _LIBCPP_INLINE_VISIBILITY |
| 1550 | 1540 | void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT |
| 1551 | 1541 | _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) |
| 1552 | {__cxx_atomic_store(&__a_, __d, __m);} | |
| 1542 | {std::__cxx_atomic_store(&__a_, __d, __m);} | |
| 1553 | 1543 | _LIBCPP_INLINE_VISIBILITY |
| 1554 | 1544 | _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT |
| 1555 | 1545 | _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) |
| 1556 | {return __cxx_atomic_load(&__a_, __m);} | |
| 1546 | {return std::__cxx_atomic_load(&__a_, __m);} | |
| 1557 | 1547 | _LIBCPP_INLINE_VISIBILITY |
| 1558 | 1548 | _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT |
| 1559 | 1549 | _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) |
| 1560 | {return __cxx_atomic_load(&__a_, __m);} | |
| 1550 | {return std::__cxx_atomic_load(&__a_, __m);} | |
| 1561 | 1551 | _LIBCPP_INLINE_VISIBILITY |
| 1562 | 1552 | operator _Tp() const volatile _NOEXCEPT {return load();} |
| 1563 | 1553 | _LIBCPP_INLINE_VISIBILITY |
| 1564 | 1554 | operator _Tp() const _NOEXCEPT {return load();} |
| 1565 | 1555 | _LIBCPP_INLINE_VISIBILITY |
| 1566 | 1556 | _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT |
| 1567 | {return __cxx_atomic_exchange(&__a_, __d, __m);} | |
| 1557 | {return std::__cxx_atomic_exchange(&__a_, __d, __m);} | |
| 1568 | 1558 | _LIBCPP_INLINE_VISIBILITY |
| 1569 | 1559 | _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT |
| 1570 | {return __cxx_atomic_exchange(&__a_, __d, __m);} | |
| 1560 | {return std::__cxx_atomic_exchange(&__a_, __d, __m);} | |
| 1571 | 1561 | _LIBCPP_INLINE_VISIBILITY |
| 1572 | 1562 | bool compare_exchange_weak(_Tp& __e, _Tp __d, |
| 1573 | 1563 | memory_order __s, memory_order __f) volatile _NOEXCEPT |
| 1574 | 1564 | _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) |
| 1575 | {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} | |
| 1565 | {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} | |
| 1576 | 1566 | _LIBCPP_INLINE_VISIBILITY |
| 1577 | 1567 | bool compare_exchange_weak(_Tp& __e, _Tp __d, |
| 1578 | 1568 | memory_order __s, memory_order __f) _NOEXCEPT |
| 1579 | 1569 | _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) |
| 1580 | {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} | |
| 1570 | {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} | |
| 1581 | 1571 | _LIBCPP_INLINE_VISIBILITY |
| 1582 | 1572 | bool compare_exchange_strong(_Tp& __e, _Tp __d, |
| 1583 | 1573 | memory_order __s, memory_order __f) volatile _NOEXCEPT |
| 1584 | 1574 | _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) |
| 1585 | {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} | |
| 1575 | {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} | |
| 1586 | 1576 | _LIBCPP_INLINE_VISIBILITY |
| 1587 | 1577 | bool compare_exchange_strong(_Tp& __e, _Tp __d, |
| 1588 | 1578 | memory_order __s, memory_order __f) _NOEXCEPT |
| 1589 | 1579 | _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) |
| 1590 | {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} | |
| 1580 | {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} | |
| 1591 | 1581 | _LIBCPP_INLINE_VISIBILITY |
| 1592 | 1582 | bool compare_exchange_weak(_Tp& __e, _Tp __d, |
| 1593 | 1583 | memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT |
| 1594 | {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} | |
| 1584 | {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} | |
| 1595 | 1585 | _LIBCPP_INLINE_VISIBILITY |
| 1596 | 1586 | bool compare_exchange_weak(_Tp& __e, _Tp __d, |
| 1597 | 1587 | memory_order __m = memory_order_seq_cst) _NOEXCEPT |
| 1598 | {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} | |
| 1588 | {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} | |
| 1599 | 1589 | _LIBCPP_INLINE_VISIBILITY |
| 1600 | 1590 | bool compare_exchange_strong(_Tp& __e, _Tp __d, |
| 1601 | 1591 | memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT |
| 1602 | {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} | |
| 1592 | {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} | |
| 1603 | 1593 | _LIBCPP_INLINE_VISIBILITY |
| 1604 | 1594 | bool compare_exchange_strong(_Tp& __e, _Tp __d, |
| 1605 | 1595 | memory_order __m = memory_order_seq_cst) _NOEXCEPT |
| 1606 | {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} | |
| 1596 | {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} | |
| 1607 | 1597 | |
| 1608 | 1598 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT |
| 1609 | {__cxx_atomic_wait(&__a_, __v, __m);} | |
| 1599 | {std::__cxx_atomic_wait(&__a_, __v, __m);} | |
| 1610 | 1600 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT |
| 1611 | {__cxx_atomic_wait(&__a_, __v, __m);} | |
| 1601 | {std::__cxx_atomic_wait(&__a_, __v, __m);} | |
| 1612 | 1602 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_one() volatile _NOEXCEPT |
| 1613 | {__cxx_atomic_notify_one(&__a_);} | |
| 1603 | {std::__cxx_atomic_notify_one(&__a_);} | |
| 1614 | 1604 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_one() _NOEXCEPT |
| 1615 | {__cxx_atomic_notify_one(&__a_);} | |
| 1605 | {std::__cxx_atomic_notify_one(&__a_);} | |
| 1616 | 1606 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_all() volatile _NOEXCEPT |
| 1617 | {__cxx_atomic_notify_all(&__a_);} | |
| 1607 | {std::__cxx_atomic_notify_all(&__a_);} | |
| 1618 | 1608 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_all() _NOEXCEPT |
| 1619 | {__cxx_atomic_notify_all(&__a_);} | |
| 1609 | {std::__cxx_atomic_notify_all(&__a_);} | |
| 1620 | 1610 | |
| 1621 | 1611 | #if _LIBCPP_STD_VER > 17 |
| 1622 | 1612 | _LIBCPP_INLINE_VISIBILITY constexpr |
| ... | ... | @@ -1645,7 +1635,7 @@ struct __atomic_base<_Tp, true> |
| 1645 | 1635 | { |
| 1646 | 1636 | typedef __atomic_base<_Tp, false> __base; |
| 1647 | 1637 | |
| 1648 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1638 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1649 | 1639 | __atomic_base() _NOEXCEPT = default; |
| 1650 | 1640 | |
| 1651 | 1641 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1653,34 +1643,34 @@ struct __atomic_base<_Tp, true> |
| 1653 | 1643 | |
| 1654 | 1644 | _LIBCPP_INLINE_VISIBILITY |
| 1655 | 1645 | _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT |
| 1656 | {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} | |
| 1646 | {return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m);} | |
| 1657 | 1647 | _LIBCPP_INLINE_VISIBILITY |
| 1658 | 1648 | _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT |
| 1659 | {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} | |
| 1649 | {return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m);} | |
| 1660 | 1650 | _LIBCPP_INLINE_VISIBILITY |
| 1661 | 1651 | _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT |
| 1662 | {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} | |
| 1652 | {return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m);} | |
| 1663 | 1653 | _LIBCPP_INLINE_VISIBILITY |
| 1664 | 1654 | _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT |
| 1665 | {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} | |
| 1655 | {return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m);} | |
| 1666 | 1656 | _LIBCPP_INLINE_VISIBILITY |
| 1667 | 1657 | _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT |
| 1668 | {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);} | |
| 1658 | {return std::__cxx_atomic_fetch_and(&this->__a_, __op, __m);} | |
| 1669 | 1659 | _LIBCPP_INLINE_VISIBILITY |
| 1670 | 1660 | _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT |
| 1671 | {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);} | |
| 1661 | {return std::__cxx_atomic_fetch_and(&this->__a_, __op, __m);} | |
| 1672 | 1662 | _LIBCPP_INLINE_VISIBILITY |
| 1673 | 1663 | _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT |
| 1674 | {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);} | |
| 1664 | {return std::__cxx_atomic_fetch_or(&this->__a_, __op, __m);} | |
| 1675 | 1665 | _LIBCPP_INLINE_VISIBILITY |
| 1676 | 1666 | _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT |
| 1677 | {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);} | |
| 1667 | {return std::__cxx_atomic_fetch_or(&this->__a_, __op, __m);} | |
| 1678 | 1668 | _LIBCPP_INLINE_VISIBILITY |
| 1679 | 1669 | _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT |
| 1680 | {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);} | |
| 1670 | {return std::__cxx_atomic_fetch_xor(&this->__a_, __op, __m);} | |
| 1681 | 1671 | _LIBCPP_INLINE_VISIBILITY |
| 1682 | 1672 | _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT |
| 1683 | {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);} | |
| 1673 | {return std::__cxx_atomic_fetch_xor(&this->__a_, __op, __m);} | |
| 1684 | 1674 | |
| 1685 | 1675 | _LIBCPP_INLINE_VISIBILITY |
| 1686 | 1676 | _Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));} |
| ... | ... | @@ -1778,29 +1768,29 @@ struct atomic<_Tp*> |
| 1778 | 1768 | _LIBCPP_INLINE_VISIBILITY |
| 1779 | 1769 | _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { |
| 1780 | 1770 | // __atomic_fetch_add accepts function pointers, guard against them. |
| 1781 | static_assert(!is_function<typename remove_pointer<_Tp>::type>::value, "Pointer to function isn't allowed"); | |
| 1782 | return __cxx_atomic_fetch_add(&this->__a_, __op, __m); | |
| 1771 | static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); | |
| 1772 | return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m); | |
| 1783 | 1773 | } |
| 1784 | 1774 | |
| 1785 | 1775 | _LIBCPP_INLINE_VISIBILITY |
| 1786 | 1776 | _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { |
| 1787 | 1777 | // __atomic_fetch_add accepts function pointers, guard against them. |
| 1788 | static_assert(!is_function<typename remove_pointer<_Tp>::type>::value, "Pointer to function isn't allowed"); | |
| 1789 | return __cxx_atomic_fetch_add(&this->__a_, __op, __m); | |
| 1778 | static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); | |
| 1779 | return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m); | |
| 1790 | 1780 | } |
| 1791 | 1781 | |
| 1792 | 1782 | _LIBCPP_INLINE_VISIBILITY |
| 1793 | 1783 | _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { |
| 1794 | 1784 | // __atomic_fetch_add accepts function pointers, guard against them. |
| 1795 | static_assert(!is_function<typename remove_pointer<_Tp>::type>::value, "Pointer to function isn't allowed"); | |
| 1796 | return __cxx_atomic_fetch_sub(&this->__a_, __op, __m); | |
| 1785 | static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); | |
| 1786 | return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m); | |
| 1797 | 1787 | } |
| 1798 | 1788 | |
| 1799 | 1789 | _LIBCPP_INLINE_VISIBILITY |
| 1800 | 1790 | _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { |
| 1801 | 1791 | // __atomic_fetch_add accepts function pointers, guard against them. |
| 1802 | static_assert(!is_function<typename remove_pointer<_Tp>::type>::value, "Pointer to function isn't allowed"); | |
| 1803 | return __cxx_atomic_fetch_sub(&this->__a_, __op, __m); | |
| 1792 | static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); | |
| 1793 | return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m); | |
| 1804 | 1794 | } |
| 1805 | 1795 | |
| 1806 | 1796 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1857,7 +1847,7 @@ _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_INLINE_VISIBILITY |
| 1857 | 1847 | void |
| 1858 | 1848 | atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT |
| 1859 | 1849 | { |
| 1860 | __cxx_atomic_init(&__o->__a_, __d); | |
| 1850 | std::__cxx_atomic_init(&__o->__a_, __d); | |
| 1861 | 1851 | } |
| 1862 | 1852 | |
| 1863 | 1853 | template <class _Tp> |
| ... | ... | @@ -1865,7 +1855,7 @@ _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_INLINE_VISIBILITY |
| 1865 | 1855 | void |
| 1866 | 1856 | atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT |
| 1867 | 1857 | { |
| 1868 | __cxx_atomic_init(&__o->__a_, __d); | |
| 1858 | std::__cxx_atomic_init(&__o->__a_, __d); | |
| 1869 | 1859 | } |
| 1870 | 1860 | |
| 1871 | 1861 | // atomic_store |
| ... | ... | @@ -2118,7 +2108,7 @@ void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT |
| 2118 | 2108 | __o->notify_one(); |
| 2119 | 2109 | } |
| 2120 | 2110 | |
| 2121 | // atomic_notify_one | |
| 2111 | // atomic_notify_all | |
| 2122 | 2112 | |
| 2123 | 2113 | template <class _Tp> |
| 2124 | 2114 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -2642,17 +2632,17 @@ typedef atomic<uintmax_t> atomic_uintmax_t; |
| 2642 | 2632 | #endif |
| 2643 | 2633 | |
| 2644 | 2634 | #if ATOMIC_LLONG_LOCK_FREE == 2 |
| 2645 | typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, long long>::type __libcpp_signed_lock_free; | |
| 2646 | typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned long long>::type __libcpp_unsigned_lock_free; | |
| 2635 | typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, long long> __libcpp_signed_lock_free; | |
| 2636 | typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned long long> __libcpp_unsigned_lock_free; | |
| 2647 | 2637 | #elif ATOMIC_INT_LOCK_FREE == 2 |
| 2648 | typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, int>::type __libcpp_signed_lock_free; | |
| 2649 | typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned int>::type __libcpp_unsigned_lock_free; | |
| 2638 | typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, int> __libcpp_signed_lock_free; | |
| 2639 | typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned int> __libcpp_unsigned_lock_free; | |
| 2650 | 2640 | #elif ATOMIC_SHORT_LOCK_FREE == 2 |
| 2651 | typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, short>::type __libcpp_signed_lock_free; | |
| 2652 | typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned short>::type __libcpp_unsigned_lock_free; | |
| 2641 | typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, short> __libcpp_signed_lock_free; | |
| 2642 | typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned short> __libcpp_unsigned_lock_free; | |
| 2653 | 2643 | #elif ATOMIC_CHAR_LOCK_FREE == 2 |
| 2654 | typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char>::type __libcpp_signed_lock_free; | |
| 2655 | typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char>::type __libcpp_unsigned_lock_free; | |
| 2644 | typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char> __libcpp_signed_lock_free; | |
| 2645 | typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char> __libcpp_unsigned_lock_free; | |
| 2656 | 2646 | #else |
| 2657 | 2647 | // No signed/unsigned lock-free types |
| 2658 | 2648 | #define _LIBCPP_NO_LOCK_FREE_TYPES |
| ... | ... | @@ -2674,4 +2664,10 @@ typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free; |
| 2674 | 2664 | |
| 2675 | 2665 | _LIBCPP_END_NAMESPACE_STD |
| 2676 | 2666 | |
| 2667 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 2668 | # include <cmath> | |
| 2669 | # include <compare> | |
| 2670 | # include <type_traits> | |
| 2671 | #endif | |
| 2672 | ||
| 2677 | 2673 | #endif // _LIBCPP_ATOMIC |
lib/libcxx/include/barrier+17-8| ... | ... | @@ -48,10 +48,11 @@ namespace std |
| 48 | 48 | #include <__assert> // all public C++ headers provide the assertion handler |
| 49 | 49 | #include <__availability> |
| 50 | 50 | #include <__config> |
| 51 | #include <__memory/unique_ptr.h> | |
| 51 | 52 | #include <__thread/timed_backoff_policy.h> |
| 53 | #include <__utility/move.h> | |
| 52 | 54 | #include <atomic> |
| 53 | 55 | #include <limits> |
| 54 | #include <memory> | |
| 55 | 56 | |
| 56 | 57 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 57 | 58 | # pragma GCC system_header |
| ... | ... | @@ -124,7 +125,7 @@ public: |
| 124 | 125 | |
| 125 | 126 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 126 | 127 | __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF()) |
| 127 | : __expected_(__expected), __base_(__construct_barrier_algorithm_base(this->__expected_), | |
| 128 | : __expected_(__expected), __base_(std::__construct_barrier_algorithm_base(this->__expected_), | |
| 128 | 129 | &__destroy_barrier_algorithm_base), |
| 129 | 130 | __expected_adjustment_(0), __completion_(std::move(__completion)), __phase_(0) |
| 130 | 131 | { |
| ... | ... | @@ -149,7 +150,7 @@ public: |
| 149 | 150 | auto const __test_fn = [this, __old_phase]() -> bool { |
| 150 | 151 | return __phase_.load(memory_order_acquire) != __old_phase; |
| 151 | 152 | }; |
| 152 | __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy()); | |
| 153 | std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy()); | |
| 153 | 154 | } |
| 154 | 155 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 155 | 156 | void arrive_and_drop() |
| ... | ... | @@ -283,7 +284,7 @@ public: |
| 283 | 284 | template<class _CompletionF = __empty_completion> |
| 284 | 285 | class barrier { |
| 285 | 286 | |
| 286 | __barrier_base<_CompletionF> __b; | |
| 287 | __barrier_base<_CompletionF> __b_; | |
| 287 | 288 | public: |
| 288 | 289 | using arrival_token = typename __barrier_base<_CompletionF>::arrival_token; |
| 289 | 290 | |
| ... | ... | @@ -293,7 +294,7 @@ public: |
| 293 | 294 | |
| 294 | 295 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 295 | 296 | barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF()) |
| 296 | : __b(__count, _VSTD::move(__completion)) { | |
| 297 | : __b_(__count, _VSTD::move(__completion)) { | |
| 297 | 298 | } |
| 298 | 299 | |
| 299 | 300 | barrier(barrier const&) = delete; |
| ... | ... | @@ -302,12 +303,12 @@ public: |
| 302 | 303 | [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 303 | 304 | arrival_token arrive(ptrdiff_t __update = 1) |
| 304 | 305 | { |
| 305 | return __b.arrive(__update); | |
| 306 | return __b_.arrive(__update); | |
| 306 | 307 | } |
| 307 | 308 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 308 | 309 | void wait(arrival_token&& __phase) const |
| 309 | 310 | { |
| 310 | __b.wait(_VSTD::move(__phase)); | |
| 311 | __b_.wait(_VSTD::move(__phase)); | |
| 311 | 312 | } |
| 312 | 313 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 313 | 314 | void arrive_and_wait() |
| ... | ... | @@ -317,7 +318,7 @@ public: |
| 317 | 318 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 318 | 319 | void arrive_and_drop() |
| 319 | 320 | { |
| 320 | __b.arrive_and_drop(); | |
| 321 | __b_.arrive_and_drop(); | |
| 321 | 322 | } |
| 322 | 323 | }; |
| 323 | 324 | |
| ... | ... | @@ -327,4 +328,12 @@ _LIBCPP_END_NAMESPACE_STD |
| 327 | 328 | |
| 328 | 329 | _LIBCPP_POP_MACROS |
| 329 | 330 | |
| 331 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 332 | # include <concepts> | |
| 333 | # include <iterator> | |
| 334 | # include <memory> | |
| 335 | # include <stdexcept> | |
| 336 | # include <variant> | |
| 337 | #endif | |
| 338 | ||
| 330 | 339 | #endif //_LIBCPP_BARRIER |
lib/libcxx/include/bit+16-184| ... | ... | @@ -63,197 +63,29 @@ namespace std { |
| 63 | 63 | |
| 64 | 64 | #include <__assert> // all public C++ headers provide the assertion handler |
| 65 | 65 | #include <__bit/bit_cast.h> |
| 66 | #include <__bit/bit_ceil.h> | |
| 67 | #include <__bit/bit_floor.h> | |
| 68 | #include <__bit/bit_log2.h> | |
| 69 | #include <__bit/bit_width.h> | |
| 70 | #include <__bit/blsr.h> | |
| 66 | 71 | #include <__bit/byteswap.h> |
| 67 | #include <__bits> // __libcpp_clz | |
| 68 | #include <__concepts/arithmetic.h> | |
| 72 | #include <__bit/countl.h> | |
| 73 | #include <__bit/countr.h> | |
| 74 | #include <__bit/endian.h> | |
| 75 | #include <__bit/has_single_bit.h> | |
| 76 | #include <__bit/popcount.h> | |
| 77 | #include <__bit/rotate.h> | |
| 69 | 78 | #include <__config> |
| 70 | #include <limits> | |
| 71 | #include <type_traits> | |
| 72 | 79 | #include <version> |
| 73 | 80 | |
| 74 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 75 | # include <iosfwd> | |
| 76 | #endif | |
| 77 | ||
| 78 | #if defined(_LIBCPP_COMPILER_MSVC) | |
| 79 | # include <intrin.h> | |
| 80 | #endif | |
| 81 | ||
| 82 | 81 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 83 | 82 | # pragma GCC system_header |
| 84 | 83 | #endif |
| 85 | 84 | |
| 86 | _LIBCPP_PUSH_MACROS | |
| 87 | #include <__undef_macros> | |
| 88 | ||
| 89 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 90 | ||
| 91 | template<class _Tp> | |
| 92 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 93 | _Tp __rotr(_Tp __t, unsigned int __cnt) _NOEXCEPT | |
| 94 | { | |
| 95 | static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotr requires an unsigned integer type"); | |
| 96 | const unsigned int __dig = numeric_limits<_Tp>::digits; | |
| 97 | if ((__cnt % __dig) == 0) | |
| 98 | return __t; | |
| 99 | return (__t >> (__cnt % __dig)) | (__t << (__dig - (__cnt % __dig))); | |
| 100 | } | |
| 101 | ||
| 102 | template<class _Tp> | |
| 103 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 104 | int __countl_zero(_Tp __t) _NOEXCEPT | |
| 105 | { | |
| 106 | static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires an unsigned integer type"); | |
| 107 | if (__t == 0) | |
| 108 | return numeric_limits<_Tp>::digits; | |
| 109 | ||
| 110 | if (sizeof(_Tp) <= sizeof(unsigned int)) | |
| 111 | return std::__libcpp_clz(static_cast<unsigned int>(__t)) | |
| 112 | - (numeric_limits<unsigned int>::digits - numeric_limits<_Tp>::digits); | |
| 113 | else if (sizeof(_Tp) <= sizeof(unsigned long)) | |
| 114 | return std::__libcpp_clz(static_cast<unsigned long>(__t)) | |
| 115 | - (numeric_limits<unsigned long>::digits - numeric_limits<_Tp>::digits); | |
| 116 | else if (sizeof(_Tp) <= sizeof(unsigned long long)) | |
| 117 | return std::__libcpp_clz(static_cast<unsigned long long>(__t)) | |
| 118 | - (numeric_limits<unsigned long long>::digits - numeric_limits<_Tp>::digits); | |
| 119 | else | |
| 120 | { | |
| 121 | int __ret = 0; | |
| 122 | int __iter = 0; | |
| 123 | const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits; | |
| 124 | while (true) { | |
| 125 | __t = std::__rotr(__t, __ulldigits); | |
| 126 | if ((__iter = std::__countl_zero(static_cast<unsigned long long>(__t))) != __ulldigits) | |
| 127 | break; | |
| 128 | __ret += __iter; | |
| 129 | } | |
| 130 | return __ret + __iter; | |
| 131 | } | |
| 132 | } | |
| 133 | ||
| 134 | #if _LIBCPP_STD_VER > 17 | |
| 135 | ||
| 136 | template <__libcpp_unsigned_integer _Tp> | |
| 137 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp rotl(_Tp __t, unsigned int __cnt) noexcept { | |
| 138 | const unsigned int __dig = numeric_limits<_Tp>::digits; | |
| 139 | if ((__cnt % __dig) == 0) | |
| 140 | return __t; | |
| 141 | return (__t << (__cnt % __dig)) | (__t >> (__dig - (__cnt % __dig))); | |
| 142 | } | |
| 143 | ||
| 144 | template <__libcpp_unsigned_integer _Tp> | |
| 145 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp rotr(_Tp __t, unsigned int __cnt) noexcept { | |
| 146 | return std::__rotr(__t, __cnt); | |
| 147 | } | |
| 148 | ||
| 149 | template <__libcpp_unsigned_integer _Tp> | |
| 150 | _LIBCPP_HIDE_FROM_ABI constexpr int countl_zero(_Tp __t) noexcept { | |
| 151 | return std::__countl_zero(__t); | |
| 152 | } | |
| 153 | ||
| 154 | template <__libcpp_unsigned_integer _Tp> | |
| 155 | _LIBCPP_HIDE_FROM_ABI constexpr int countl_one(_Tp __t) noexcept { | |
| 156 | return __t != numeric_limits<_Tp>::max() ? std::countl_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits; | |
| 157 | } | |
| 158 | ||
| 159 | template <__libcpp_unsigned_integer _Tp> | |
| 160 | _LIBCPP_HIDE_FROM_ABI constexpr int countr_zero(_Tp __t) noexcept { | |
| 161 | if (__t == 0) | |
| 162 | return numeric_limits<_Tp>::digits; | |
| 163 | ||
| 164 | if (sizeof(_Tp) <= sizeof(unsigned int)) | |
| 165 | return std::__libcpp_ctz(static_cast<unsigned int>(__t)); | |
| 166 | else if (sizeof(_Tp) <= sizeof(unsigned long)) | |
| 167 | return std::__libcpp_ctz(static_cast<unsigned long>(__t)); | |
| 168 | else if (sizeof(_Tp) <= sizeof(unsigned long long)) | |
| 169 | return std::__libcpp_ctz(static_cast<unsigned long long>(__t)); | |
| 170 | else { | |
| 171 | int __ret = 0; | |
| 172 | const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits; | |
| 173 | while (static_cast<unsigned long long>(__t) == 0uLL) { | |
| 174 | __ret += __ulldigits; | |
| 175 | __t >>= __ulldigits; | |
| 176 | } | |
| 177 | return __ret + std::__libcpp_ctz(static_cast<unsigned long long>(__t)); | |
| 178 | } | |
| 179 | } | |
| 180 | ||
| 181 | template <__libcpp_unsigned_integer _Tp> | |
| 182 | _LIBCPP_HIDE_FROM_ABI constexpr int countr_one(_Tp __t) noexcept { | |
| 183 | return __t != numeric_limits<_Tp>::max() ? std::countr_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits; | |
| 184 | } | |
| 185 | ||
| 186 | template <__libcpp_unsigned_integer _Tp> | |
| 187 | _LIBCPP_HIDE_FROM_ABI constexpr int popcount(_Tp __t) noexcept { | |
| 188 | if (sizeof(_Tp) <= sizeof(unsigned int)) | |
| 189 | return std::__libcpp_popcount(static_cast<unsigned int>(__t)); | |
| 190 | else if (sizeof(_Tp) <= sizeof(unsigned long)) | |
| 191 | return std::__libcpp_popcount(static_cast<unsigned long>(__t)); | |
| 192 | else if (sizeof(_Tp) <= sizeof(unsigned long long)) | |
| 193 | return std::__libcpp_popcount(static_cast<unsigned long long>(__t)); | |
| 194 | else { | |
| 195 | int __ret = 0; | |
| 196 | while (__t != 0) { | |
| 197 | __ret += std::__libcpp_popcount(static_cast<unsigned long long>(__t)); | |
| 198 | __t >>= numeric_limits<unsigned long long>::digits; | |
| 199 | } | |
| 200 | return __ret; | |
| 201 | } | |
| 202 | } | |
| 203 | ||
| 204 | template <__libcpp_unsigned_integer _Tp> | |
| 205 | _LIBCPP_HIDE_FROM_ABI constexpr bool has_single_bit(_Tp __t) noexcept { | |
| 206 | return __t != 0 && (((__t & (__t - 1)) == 0)); | |
| 207 | } | |
| 208 | ||
| 209 | // integral log base 2 | |
| 210 | template <__libcpp_unsigned_integer _Tp> | |
| 211 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __bit_log2(_Tp __t) noexcept { | |
| 212 | return numeric_limits<_Tp>::digits - 1 - std::countl_zero(__t); | |
| 213 | } | |
| 214 | ||
| 215 | template <__libcpp_unsigned_integer _Tp> | |
| 216 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_floor(_Tp __t) noexcept { | |
| 217 | return __t == 0 ? 0 : _Tp{1} << std::__bit_log2(__t); | |
| 218 | } | |
| 219 | ||
| 220 | template <__libcpp_unsigned_integer _Tp> | |
| 221 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_ceil(_Tp __t) noexcept { | |
| 222 | if (__t < 2) | |
| 223 | return 1; | |
| 224 | const unsigned __n = numeric_limits<_Tp>::digits - std::countl_zero((_Tp)(__t - 1u)); | |
| 225 | _LIBCPP_ASSERT(__n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil"); | |
| 226 | ||
| 227 | if constexpr (sizeof(_Tp) >= sizeof(unsigned)) | |
| 228 | return _Tp{1} << __n; | |
| 229 | else { | |
| 230 | const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits; | |
| 231 | const unsigned __retVal = 1u << (__n + __extra); | |
| 232 | return (_Tp)(__retVal >> __extra); | |
| 233 | } | |
| 234 | } | |
| 235 | ||
| 236 | template <__libcpp_unsigned_integer _Tp> | |
| 237 | _LIBCPP_HIDE_FROM_ABI constexpr int bit_width(_Tp __t) noexcept { | |
| 238 | return __t == 0 ? 0 : std::__bit_log2(__t) + 1; | |
| 239 | } | |
| 240 | ||
| 241 | enum class endian { | |
| 242 | little = 0xDEAD, | |
| 243 | big = 0xFACE, | |
| 244 | # if defined(_LIBCPP_LITTLE_ENDIAN) | |
| 245 | native = little | |
| 246 | # elif defined(_LIBCPP_BIG_ENDIAN) | |
| 247 | native = big | |
| 248 | # else | |
| 249 | native = 0xCAFE | |
| 250 | # endif | |
| 251 | }; | |
| 252 | ||
| 253 | #endif // _LIBCPP_STD_VER > 17 | |
| 254 | ||
| 255 | _LIBCPP_END_NAMESPACE_STD | |
| 256 | ||
| 257 | _LIBCPP_POP_MACROS | |
| 85 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 86 | # include <iosfwd> | |
| 87 | # include <limits> | |
| 88 | # include <type_traits> | |
| 89 | #endif | |
| 258 | 90 | |
| 259 | 91 | #endif // _LIBCPP_BIT |
lib/libcxx/include/bitset+164-117| ... | ... | @@ -42,61 +42,61 @@ public: |
| 42 | 42 | template <class charT> |
| 43 | 43 | explicit bitset(const charT* str, |
| 44 | 44 | typename basic_string<charT>::size_type n = basic_string<charT>::npos, |
| 45 | charT zero = charT('0'), charT one = charT('1')); | |
| 45 | charT zero = charT('0'), charT one = charT('1')); // constexpr since C++23 | |
| 46 | 46 | template<class charT, class traits, class Allocator> |
| 47 | 47 | explicit bitset(const basic_string<charT,traits,Allocator>& str, |
| 48 | 48 | typename basic_string<charT,traits,Allocator>::size_type pos = 0, |
| 49 | 49 | typename basic_string<charT,traits,Allocator>::size_type n = |
| 50 | 50 | basic_string<charT,traits,Allocator>::npos, |
| 51 | charT zero = charT('0'), charT one = charT('1')); | |
| 51 | charT zero = charT('0'), charT one = charT('1')); // constexpr since C++23 | |
| 52 | 52 | |
| 53 | 53 | // 23.3.5.2 bitset operations: |
| 54 | bitset& operator&=(const bitset& rhs) noexcept; | |
| 55 | bitset& operator|=(const bitset& rhs) noexcept; | |
| 56 | bitset& operator^=(const bitset& rhs) noexcept; | |
| 57 | bitset& operator<<=(size_t pos) noexcept; | |
| 58 | bitset& operator>>=(size_t pos) noexcept; | |
| 59 | bitset& set() noexcept; | |
| 60 | bitset& set(size_t pos, bool val = true); | |
| 61 | bitset& reset() noexcept; | |
| 62 | bitset& reset(size_t pos); | |
| 63 | bitset operator~() const noexcept; | |
| 64 | bitset& flip() noexcept; | |
| 65 | bitset& flip(size_t pos); | |
| 54 | bitset& operator&=(const bitset& rhs) noexcept; // constexpr since C++23 | |
| 55 | bitset& operator|=(const bitset& rhs) noexcept; // constexpr since C++23 | |
| 56 | bitset& operator^=(const bitset& rhs) noexcept; // constexpr since C++23 | |
| 57 | bitset& operator<<=(size_t pos) noexcept; // constexpr since C++23 | |
| 58 | bitset& operator>>=(size_t pos) noexcept; // constexpr since C++23 | |
| 59 | bitset& set() noexcept; // constexpr since C++23 | |
| 60 | bitset& set(size_t pos, bool val = true); // constexpr since C++23 | |
| 61 | bitset& reset() noexcept; // constexpr since C++23 | |
| 62 | bitset& reset(size_t pos); // constexpr since C++23 | |
| 63 | bitset operator~() const noexcept; // constexpr since C++23 | |
| 64 | bitset& flip() noexcept; // constexpr since C++23 | |
| 65 | bitset& flip(size_t pos); // constexpr since C++23 | |
| 66 | 66 | |
| 67 | 67 | // element access: |
| 68 | constexpr bool operator[](size_t pos) const; // for b[i]; | |
| 69 | reference operator[](size_t pos); // for b[i]; | |
| 70 | unsigned long to_ulong() const; | |
| 71 | unsigned long long to_ullong() const; | |
| 72 | template <class charT, class traits, class Allocator> | |
| 68 | constexpr bool operator[](size_t pos) const; | |
| 69 | reference operator[](size_t pos); // constexpr since C++23 | |
| 70 | unsigned long to_ulong() const; // constexpr since C++23 | |
| 71 | unsigned long long to_ullong() const; // constexpr since C++23 | |
| 72 | template <class charT, class traits, class Allocator> // constexpr since C++23 | |
| 73 | 73 | basic_string<charT, traits, Allocator> to_string(charT zero = charT('0'), charT one = charT('1')) const; |
| 74 | template <class charT, class traits> | |
| 74 | template <class charT, class traits> // constexpr since C++23 | |
| 75 | 75 | basic_string<charT, traits, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const; |
| 76 | template <class charT> | |
| 76 | template <class charT> // constexpr since C++23 | |
| 77 | 77 | basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const; |
| 78 | basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const; | |
| 79 | size_t count() const noexcept; | |
| 80 | constexpr size_t size() const noexcept; | |
| 81 | bool operator==(const bitset& rhs) const noexcept; | |
| 82 | bool operator!=(const bitset& rhs) const noexcept; | |
| 83 | bool test(size_t pos) const; | |
| 84 | bool all() const noexcept; | |
| 85 | bool any() const noexcept; | |
| 86 | bool none() const noexcept; | |
| 87 | bitset operator<<(size_t pos) const noexcept; | |
| 88 | bitset operator>>(size_t pos) const noexcept; | |
| 78 | basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const; // constexpr since C++23 | |
| 79 | size_t count() const noexcept; // constexpr since C++23 | |
| 80 | constexpr size_t size() const noexcept; // constexpr since C++23 | |
| 81 | bool operator==(const bitset& rhs) const noexcept; // constexpr since C++23 | |
| 82 | bool operator!=(const bitset& rhs) const noexcept; // constexpr since C++23 | |
| 83 | bool test(size_t pos) const; // constexpr since C++23 | |
| 84 | bool all() const noexcept; // constexpr since C++23 | |
| 85 | bool any() const noexcept; // constexpr since C++23 | |
| 86 | bool none() const noexcept; // constexpr since C++23 | |
| 87 | bitset<N> operator<<(size_t pos) const noexcept; // constexpr since C++23 | |
| 88 | bitset<N> operator>>(size_t pos) const noexcept; // constexpr since C++23 | |
| 89 | 89 | }; |
| 90 | 90 | |
| 91 | 91 | // 23.3.5.3 bitset operators: |
| 92 | 92 | template <size_t N> |
| 93 | bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept; | |
| 93 | bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept; // constexpr since C++23 | |
| 94 | 94 | |
| 95 | 95 | template <size_t N> |
| 96 | bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept; | |
| 96 | bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept; // constexpr since C++23 | |
| 97 | 97 | |
| 98 | 98 | template <size_t N> |
| 99 | bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept; | |
| 99 | bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept; // constexpr since C++23 | |
| 100 | 100 | |
| 101 | 101 | template <class charT, class traits, size_t N> |
| 102 | 102 | basic_istream<charT, traits>& |
| ... | ... | @@ -118,12 +118,15 @@ template <size_t N> struct hash<std::bitset<N>>; |
| 118 | 118 | #include <__config> |
| 119 | 119 | #include <__functional/hash.h> |
| 120 | 120 | #include <__functional/unary_function.h> |
| 121 | #include <__type_traits/is_char_like_type.h> | |
| 121 | 122 | #include <climits> |
| 122 | 123 | #include <cstddef> |
| 123 | 124 | #include <stdexcept> |
| 124 | 125 | #include <version> |
| 125 | 126 | |
| 126 | 127 | // standard-mandated includes |
| 128 | ||
| 129 | // [bitset.syn] | |
| 127 | 130 | #include <iosfwd> |
| 128 | 131 | #include <string> |
| 129 | 132 | |
| ... | ... | @@ -177,30 +180,30 @@ protected: |
| 177 | 180 | _LIBCPP_INLINE_VISIBILITY |
| 178 | 181 | explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; |
| 179 | 182 | |
| 180 | _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT | |
| 183 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT | |
| 181 | 184 | {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} |
| 182 | 185 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT |
| 183 | 186 | {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} |
| 184 | _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT | |
| 187 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT | |
| 185 | 188 | {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} |
| 186 | _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT | |
| 189 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT | |
| 187 | 190 | {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} |
| 188 | 191 | |
| 189 | _LIBCPP_INLINE_VISIBILITY | |
| 192 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 190 | 193 | void operator&=(const __bitset& __v) _NOEXCEPT; |
| 191 | _LIBCPP_INLINE_VISIBILITY | |
| 194 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 192 | 195 | void operator|=(const __bitset& __v) _NOEXCEPT; |
| 193 | _LIBCPP_INLINE_VISIBILITY | |
| 196 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 194 | 197 | void operator^=(const __bitset& __v) _NOEXCEPT; |
| 195 | 198 | |
| 196 | void flip() _NOEXCEPT; | |
| 197 | _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const | |
| 199 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT; | |
| 200 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const | |
| 198 | 201 | {return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());} |
| 199 | _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const | |
| 202 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const | |
| 200 | 203 | {return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());} |
| 201 | 204 | |
| 202 | bool all() const _NOEXCEPT; | |
| 203 | bool any() const _NOEXCEPT; | |
| 205 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT; | |
| 206 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT; | |
| 204 | 207 | _LIBCPP_INLINE_VISIBILITY |
| 205 | 208 | size_t __hash_code() const _NOEXCEPT; |
| 206 | 209 | private: |
| ... | ... | @@ -209,14 +212,17 @@ private: |
| 209 | 212 | _LIBCPP_INLINE_VISIBILITY |
| 210 | 213 | void __init(unsigned long long __v, true_type) _NOEXCEPT; |
| 211 | 214 | #endif // _LIBCPP_CXX03_LANG |
| 215 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 212 | 216 | unsigned long to_ulong(false_type) const; |
| 213 | _LIBCPP_INLINE_VISIBILITY | |
| 217 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 214 | 218 | unsigned long to_ulong(true_type) const; |
| 219 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 215 | 220 | unsigned long long to_ullong(false_type) const; |
| 216 | _LIBCPP_INLINE_VISIBILITY | |
| 221 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 217 | 222 | unsigned long long to_ullong(true_type) const; |
| 218 | _LIBCPP_INLINE_VISIBILITY | |
| 223 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 219 | 224 | unsigned long long to_ullong(true_type, false_type) const; |
| 225 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 220 | 226 | unsigned long long to_ullong(true_type, true_type) const; |
| 221 | 227 | }; |
| 222 | 228 | |
| ... | ... | @@ -289,7 +295,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT |
| 289 | 295 | |
| 290 | 296 | template <size_t _N_words, size_t _Size> |
| 291 | 297 | inline |
| 292 | void | |
| 298 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void | |
| 293 | 299 | __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT |
| 294 | 300 | { |
| 295 | 301 | for (size_type __i = 0; __i < _N_words; ++__i) |
| ... | ... | @@ -298,7 +304,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT |
| 298 | 304 | |
| 299 | 305 | template <size_t _N_words, size_t _Size> |
| 300 | 306 | inline |
| 301 | void | |
| 307 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void | |
| 302 | 308 | __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT |
| 303 | 309 | { |
| 304 | 310 | for (size_type __i = 0; __i < _N_words; ++__i) |
| ... | ... | @@ -307,7 +313,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT |
| 307 | 313 | |
| 308 | 314 | template <size_t _N_words, size_t _Size> |
| 309 | 315 | inline |
| 310 | void | |
| 316 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void | |
| 311 | 317 | __bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT |
| 312 | 318 | { |
| 313 | 319 | for (size_type __i = 0; __i < _N_words; ++__i) |
| ... | ... | @@ -315,7 +321,7 @@ __bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT |
| 315 | 321 | } |
| 316 | 322 | |
| 317 | 323 | template <size_t _N_words, size_t _Size> |
| 318 | void | |
| 324 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void | |
| 319 | 325 | __bitset<_N_words, _Size>::flip() _NOEXCEPT |
| 320 | 326 | { |
| 321 | 327 | // do middle whole words |
| ... | ... | @@ -334,7 +340,7 @@ __bitset<_N_words, _Size>::flip() _NOEXCEPT |
| 334 | 340 | } |
| 335 | 341 | |
| 336 | 342 | template <size_t _N_words, size_t _Size> |
| 337 | unsigned long | |
| 343 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long | |
| 338 | 344 | __bitset<_N_words, _Size>::to_ulong(false_type) const |
| 339 | 345 | { |
| 340 | 346 | const_iterator __e = __make_iter(_Size); |
| ... | ... | @@ -347,14 +353,14 @@ __bitset<_N_words, _Size>::to_ulong(false_type) const |
| 347 | 353 | |
| 348 | 354 | template <size_t _N_words, size_t _Size> |
| 349 | 355 | inline |
| 350 | unsigned long | |
| 356 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long | |
| 351 | 357 | __bitset<_N_words, _Size>::to_ulong(true_type) const |
| 352 | 358 | { |
| 353 | 359 | return __first_[0]; |
| 354 | 360 | } |
| 355 | 361 | |
| 356 | 362 | template <size_t _N_words, size_t _Size> |
| 357 | unsigned long long | |
| 363 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long | |
| 358 | 364 | __bitset<_N_words, _Size>::to_ullong(false_type) const |
| 359 | 365 | { |
| 360 | 366 | const_iterator __e = __make_iter(_Size); |
| ... | ... | @@ -367,7 +373,7 @@ __bitset<_N_words, _Size>::to_ullong(false_type) const |
| 367 | 373 | |
| 368 | 374 | template <size_t _N_words, size_t _Size> |
| 369 | 375 | inline |
| 370 | unsigned long long | |
| 376 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long | |
| 371 | 377 | __bitset<_N_words, _Size>::to_ullong(true_type) const |
| 372 | 378 | { |
| 373 | 379 | return to_ullong(true_type(), integral_constant<bool, sizeof(__storage_type) < sizeof(unsigned long long)>()); |
| ... | ... | @@ -375,14 +381,14 @@ __bitset<_N_words, _Size>::to_ullong(true_type) const |
| 375 | 381 | |
| 376 | 382 | template <size_t _N_words, size_t _Size> |
| 377 | 383 | inline |
| 378 | unsigned long long | |
| 384 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long | |
| 379 | 385 | __bitset<_N_words, _Size>::to_ullong(true_type, false_type) const |
| 380 | 386 | { |
| 381 | 387 | return __first_[0]; |
| 382 | 388 | } |
| 383 | 389 | |
| 384 | 390 | template <size_t _N_words, size_t _Size> |
| 385 | unsigned long long | |
| 391 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long | |
| 386 | 392 | __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const |
| 387 | 393 | { |
| 388 | 394 | unsigned long long __r = __first_[0]; |
| ... | ... | @@ -392,7 +398,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const |
| 392 | 398 | } |
| 393 | 399 | |
| 394 | 400 | template <size_t _N_words, size_t _Size> |
| 395 | bool | |
| 401 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 396 | 402 | __bitset<_N_words, _Size>::all() const _NOEXCEPT |
| 397 | 403 | { |
| 398 | 404 | // do middle whole words |
| ... | ... | @@ -412,7 +418,7 @@ __bitset<_N_words, _Size>::all() const _NOEXCEPT |
| 412 | 418 | } |
| 413 | 419 | |
| 414 | 420 | template <size_t _N_words, size_t _Size> |
| 415 | bool | |
| 421 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 416 | 422 | __bitset<_N_words, _Size>::any() const _NOEXCEPT |
| 417 | 423 | { |
| 418 | 424 | // do middle whole words |
| ... | ... | @@ -473,33 +479,33 @@ protected: |
| 473 | 479 | _LIBCPP_INLINE_VISIBILITY |
| 474 | 480 | explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; |
| 475 | 481 | |
| 476 | _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT | |
| 482 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT | |
| 477 | 483 | {return reference(&__first_, __storage_type(1) << __pos);} |
| 478 | 484 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT |
| 479 | 485 | {return const_reference(&__first_, __storage_type(1) << __pos);} |
| 480 | _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT | |
| 486 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT | |
| 481 | 487 | {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} |
| 482 | _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT | |
| 488 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT | |
| 483 | 489 | {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} |
| 484 | 490 | |
| 485 | _LIBCPP_INLINE_VISIBILITY | |
| 491 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 486 | 492 | void operator&=(const __bitset& __v) _NOEXCEPT; |
| 487 | _LIBCPP_INLINE_VISIBILITY | |
| 493 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 488 | 494 | void operator|=(const __bitset& __v) _NOEXCEPT; |
| 489 | _LIBCPP_INLINE_VISIBILITY | |
| 495 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 490 | 496 | void operator^=(const __bitset& __v) _NOEXCEPT; |
| 491 | 497 | |
| 492 | _LIBCPP_INLINE_VISIBILITY | |
| 498 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 493 | 499 | void flip() _NOEXCEPT; |
| 494 | 500 | |
| 495 | _LIBCPP_INLINE_VISIBILITY | |
| 501 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 496 | 502 | unsigned long to_ulong() const; |
| 497 | _LIBCPP_INLINE_VISIBILITY | |
| 503 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 498 | 504 | unsigned long long to_ullong() const; |
| 499 | 505 | |
| 500 | _LIBCPP_INLINE_VISIBILITY | |
| 506 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 501 | 507 | bool all() const _NOEXCEPT; |
| 502 | _LIBCPP_INLINE_VISIBILITY | |
| 508 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 503 | 509 | bool any() const _NOEXCEPT; |
| 504 | 510 | |
| 505 | 511 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -527,7 +533,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT |
| 527 | 533 | |
| 528 | 534 | template <size_t _Size> |
| 529 | 535 | inline |
| 530 | void | |
| 536 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void | |
| 531 | 537 | __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT |
| 532 | 538 | { |
| 533 | 539 | __first_ &= __v.__first_; |
| ... | ... | @@ -535,7 +541,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT |
| 535 | 541 | |
| 536 | 542 | template <size_t _Size> |
| 537 | 543 | inline |
| 538 | void | |
| 544 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void | |
| 539 | 545 | __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT |
| 540 | 546 | { |
| 541 | 547 | __first_ |= __v.__first_; |
| ... | ... | @@ -543,7 +549,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT |
| 543 | 549 | |
| 544 | 550 | template <size_t _Size> |
| 545 | 551 | inline |
| 546 | void | |
| 552 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void | |
| 547 | 553 | __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT |
| 548 | 554 | { |
| 549 | 555 | __first_ ^= __v.__first_; |
| ... | ... | @@ -551,7 +557,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT |
| 551 | 557 | |
| 552 | 558 | template <size_t _Size> |
| 553 | 559 | inline |
| 554 | void | |
| 560 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void | |
| 555 | 561 | __bitset<1, _Size>::flip() _NOEXCEPT |
| 556 | 562 | { |
| 557 | 563 | __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); |
| ... | ... | @@ -561,7 +567,7 @@ __bitset<1, _Size>::flip() _NOEXCEPT |
| 561 | 567 | |
| 562 | 568 | template <size_t _Size> |
| 563 | 569 | inline |
| 564 | unsigned long | |
| 570 | _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long | |
| 565 | 571 | __bitset<1, _Size>::to_ulong() const |
| 566 | 572 | { |
| 567 | 573 | return __first_; |
| ... | ... | @@ -569,7 +575,7 @@ __bitset<1, _Size>::to_ulong() const |
| 569 | 575 | |
| 570 | 576 | template <size_t _Size> |
| 571 | 577 | inline |
| 572 | unsigned long long | |
| 578 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long | |
| 573 | 579 | __bitset<1, _Size>::to_ullong() const |
| 574 | 580 | { |
| 575 | 581 | return __first_; |
| ... | ... | @@ -577,7 +583,7 @@ __bitset<1, _Size>::to_ullong() const |
| 577 | 583 | |
| 578 | 584 | template <size_t _Size> |
| 579 | 585 | inline |
| 580 | bool | |
| 586 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 581 | 587 | __bitset<1, _Size>::all() const _NOEXCEPT |
| 582 | 588 | { |
| 583 | 589 | __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); |
| ... | ... | @@ -586,7 +592,7 @@ __bitset<1, _Size>::all() const _NOEXCEPT |
| 586 | 592 | |
| 587 | 593 | template <size_t _Size> |
| 588 | 594 | inline |
| 589 | bool | |
| 595 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool | |
| 590 | 596 | __bitset<1, _Size>::any() const _NOEXCEPT |
| 591 | 597 | { |
| 592 | 598 | __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); |
| ... | ... | @@ -630,26 +636,26 @@ protected: |
| 630 | 636 | _LIBCPP_INLINE_VISIBILITY |
| 631 | 637 | explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT; |
| 632 | 638 | |
| 633 | _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT | |
| 639 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t) _NOEXCEPT | |
| 634 | 640 | {return reference(nullptr, 1);} |
| 635 | 641 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT |
| 636 | 642 | {return const_reference(nullptr, 1);} |
| 637 | _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT | |
| 643 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t) _NOEXCEPT | |
| 638 | 644 | {return iterator(nullptr, 0);} |
| 639 | _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT | |
| 645 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t) const _NOEXCEPT | |
| 640 | 646 | {return const_iterator(nullptr, 0);} |
| 641 | 647 | |
| 642 | _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {} | |
| 643 | _LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {} | |
| 644 | _LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) _NOEXCEPT {} | |
| 648 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset&) _NOEXCEPT {} | |
| 649 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset&) _NOEXCEPT {} | |
| 650 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset&) _NOEXCEPT {} | |
| 645 | 651 | |
| 646 | _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {} | |
| 652 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT {} | |
| 647 | 653 | |
| 648 | _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;} | |
| 649 | _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;} | |
| 654 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const {return 0;} | |
| 655 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const {return 0;} | |
| 650 | 656 | |
| 651 | _LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT {return true;} | |
| 652 | _LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT {return false;} | |
| 657 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT {return true;} | |
| 658 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT {return false;} | |
| 653 | 659 | |
| 654 | 660 | _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;} |
| 655 | 661 | }; |
| ... | ... | @@ -686,10 +692,12 @@ public: |
| 686 | 692 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 687 | 693 | bitset(unsigned long long __v) _NOEXCEPT : base(__v) {} |
| 688 | 694 | template<class _CharT, class = __enable_if_t<_IsCharLikeType<_CharT>::value> > |
| 695 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 689 | 696 | explicit bitset(const _CharT* __str, |
| 690 | 697 | typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos, |
| 691 | 698 | _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); |
| 692 | 699 | template<class _CharT, class _Traits, class _Allocator> |
| 700 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 693 | 701 | explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, |
| 694 | 702 | typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0, |
| 695 | 703 | typename basic_string<_CharT,_Traits,_Allocator>::size_type __n = |
| ... | ... | @@ -697,24 +705,29 @@ public: |
| 697 | 705 | _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); |
| 698 | 706 | |
| 699 | 707 | // 23.3.5.2 bitset operations: |
| 700 | _LIBCPP_INLINE_VISIBILITY | |
| 708 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 701 | 709 | bitset& operator&=(const bitset& __rhs) _NOEXCEPT; |
| 702 | _LIBCPP_INLINE_VISIBILITY | |
| 710 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 703 | 711 | bitset& operator|=(const bitset& __rhs) _NOEXCEPT; |
| 704 | _LIBCPP_INLINE_VISIBILITY | |
| 712 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 705 | 713 | bitset& operator^=(const bitset& __rhs) _NOEXCEPT; |
| 714 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 706 | 715 | bitset& operator<<=(size_t __pos) _NOEXCEPT; |
| 716 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 707 | 717 | bitset& operator>>=(size_t __pos) _NOEXCEPT; |
| 708 | _LIBCPP_INLINE_VISIBILITY | |
| 718 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 709 | 719 | bitset& set() _NOEXCEPT; |
| 720 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 710 | 721 | bitset& set(size_t __pos, bool __val = true); |
| 711 | _LIBCPP_INLINE_VISIBILITY | |
| 722 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 712 | 723 | bitset& reset() _NOEXCEPT; |
| 724 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 713 | 725 | bitset& reset(size_t __pos); |
| 714 | _LIBCPP_INLINE_VISIBILITY | |
| 726 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 715 | 727 | bitset operator~() const _NOEXCEPT; |
| 716 | _LIBCPP_INLINE_VISIBILITY | |
| 728 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 717 | 729 | bitset& flip() _NOEXCEPT; |
| 730 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 718 | 731 | bitset& flip(size_t __pos); |
| 719 | 732 | |
| 720 | 733 | // element access: |
| ... | ... | @@ -723,41 +736,43 @@ public: |
| 723 | 736 | #else |
| 724 | 737 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const {return base::__make_ref(__p);} |
| 725 | 738 | #endif |
| 726 | _LIBCPP_HIDE_FROM_ABI reference operator[](size_t __p) {return base::__make_ref(__p);} | |
| 727 | _LIBCPP_INLINE_VISIBILITY | |
| 739 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) {return base::__make_ref(__p);} | |
| 740 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 728 | 741 | unsigned long to_ulong() const; |
| 729 | _LIBCPP_INLINE_VISIBILITY | |
| 742 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 730 | 743 | unsigned long long to_ullong() const; |
| 731 | 744 | template <class _CharT, class _Traits, class _Allocator> |
| 745 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 732 | 746 | basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'), |
| 733 | 747 | _CharT __one = _CharT('1')) const; |
| 734 | 748 | template <class _CharT, class _Traits> |
| 735 | _LIBCPP_INLINE_VISIBILITY | |
| 749 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 736 | 750 | basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), |
| 737 | 751 | _CharT __one = _CharT('1')) const; |
| 738 | 752 | template <class _CharT> |
| 739 | _LIBCPP_INLINE_VISIBILITY | |
| 753 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 740 | 754 | basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), |
| 741 | 755 | _CharT __one = _CharT('1')) const; |
| 742 | _LIBCPP_INLINE_VISIBILITY | |
| 756 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 743 | 757 | basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0', |
| 744 | 758 | char __one = '1') const; |
| 745 | _LIBCPP_INLINE_VISIBILITY | |
| 759 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 746 | 760 | size_t count() const _NOEXCEPT; |
| 747 | 761 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;} |
| 748 | _LIBCPP_INLINE_VISIBILITY | |
| 762 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 749 | 763 | bool operator==(const bitset& __rhs) const _NOEXCEPT; |
| 750 | _LIBCPP_INLINE_VISIBILITY | |
| 764 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 751 | 765 | bool operator!=(const bitset& __rhs) const _NOEXCEPT; |
| 766 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 752 | 767 | bool test(size_t __pos) const; |
| 753 | _LIBCPP_INLINE_VISIBILITY | |
| 768 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 754 | 769 | bool all() const _NOEXCEPT; |
| 755 | _LIBCPP_INLINE_VISIBILITY | |
| 770 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 756 | 771 | bool any() const _NOEXCEPT; |
| 757 | _LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();} | |
| 758 | _LIBCPP_INLINE_VISIBILITY | |
| 772 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool none() const _NOEXCEPT {return !any();} | |
| 773 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 759 | 774 | bitset operator<<(size_t __pos) const _NOEXCEPT; |
| 760 | _LIBCPP_INLINE_VISIBILITY | |
| 775 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 761 | 776 | bitset operator>>(size_t __pos) const _NOEXCEPT; |
| 762 | 777 | |
| 763 | 778 | private: |
| ... | ... | @@ -770,6 +785,7 @@ private: |
| 770 | 785 | |
| 771 | 786 | template <size_t _Size> |
| 772 | 787 | template<class _CharT, class> |
| 788 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 773 | 789 | bitset<_Size>::bitset(const _CharT* __str, |
| 774 | 790 | typename basic_string<_CharT>::size_type __n, |
| 775 | 791 | _CharT __zero, _CharT __one) |
| ... | ... | @@ -791,6 +807,7 @@ bitset<_Size>::bitset(const _CharT* __str, |
| 791 | 807 | |
| 792 | 808 | template <size_t _Size> |
| 793 | 809 | template<class _CharT, class _Traits, class _Allocator> |
| 810 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 794 | 811 | bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, |
| 795 | 812 | typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos, |
| 796 | 813 | typename basic_string<_CharT,_Traits,_Allocator>::size_type __n, |
| ... | ... | @@ -816,6 +833,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, |
| 816 | 833 | |
| 817 | 834 | template <size_t _Size> |
| 818 | 835 | inline |
| 836 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 819 | 837 | bitset<_Size>& |
| 820 | 838 | bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT |
| 821 | 839 | { |
| ... | ... | @@ -825,6 +843,7 @@ bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT |
| 825 | 843 | |
| 826 | 844 | template <size_t _Size> |
| 827 | 845 | inline |
| 846 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 828 | 847 | bitset<_Size>& |
| 829 | 848 | bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT |
| 830 | 849 | { |
| ... | ... | @@ -834,6 +853,7 @@ bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT |
| 834 | 853 | |
| 835 | 854 | template <size_t _Size> |
| 836 | 855 | inline |
| 856 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 837 | 857 | bitset<_Size>& |
| 838 | 858 | bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT |
| 839 | 859 | { |
| ... | ... | @@ -842,6 +862,7 @@ bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT |
| 842 | 862 | } |
| 843 | 863 | |
| 844 | 864 | template <size_t _Size> |
| 865 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 845 | 866 | bitset<_Size>& |
| 846 | 867 | bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT |
| 847 | 868 | { |
| ... | ... | @@ -852,6 +873,7 @@ bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT |
| 852 | 873 | } |
| 853 | 874 | |
| 854 | 875 | template <size_t _Size> |
| 876 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 855 | 877 | bitset<_Size>& |
| 856 | 878 | bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT |
| 857 | 879 | { |
| ... | ... | @@ -863,6 +885,7 @@ bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT |
| 863 | 885 | |
| 864 | 886 | template <size_t _Size> |
| 865 | 887 | inline |
| 888 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 866 | 889 | bitset<_Size>& |
| 867 | 890 | bitset<_Size>::set() _NOEXCEPT |
| 868 | 891 | { |
| ... | ... | @@ -871,6 +894,7 @@ bitset<_Size>::set() _NOEXCEPT |
| 871 | 894 | } |
| 872 | 895 | |
| 873 | 896 | template <size_t _Size> |
| 897 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 874 | 898 | bitset<_Size>& |
| 875 | 899 | bitset<_Size>::set(size_t __pos, bool __val) |
| 876 | 900 | { |
| ... | ... | @@ -883,6 +907,7 @@ bitset<_Size>::set(size_t __pos, bool __val) |
| 883 | 907 | |
| 884 | 908 | template <size_t _Size> |
| 885 | 909 | inline |
| 910 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 886 | 911 | bitset<_Size>& |
| 887 | 912 | bitset<_Size>::reset() _NOEXCEPT |
| 888 | 913 | { |
| ... | ... | @@ -891,6 +916,7 @@ bitset<_Size>::reset() _NOEXCEPT |
| 891 | 916 | } |
| 892 | 917 | |
| 893 | 918 | template <size_t _Size> |
| 919 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 894 | 920 | bitset<_Size>& |
| 895 | 921 | bitset<_Size>::reset(size_t __pos) |
| 896 | 922 | { |
| ... | ... | @@ -903,6 +929,7 @@ bitset<_Size>::reset(size_t __pos) |
| 903 | 929 | |
| 904 | 930 | template <size_t _Size> |
| 905 | 931 | inline |
| 932 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 906 | 933 | bitset<_Size> |
| 907 | 934 | bitset<_Size>::operator~() const _NOEXCEPT |
| 908 | 935 | { |
| ... | ... | @@ -913,6 +940,7 @@ bitset<_Size>::operator~() const _NOEXCEPT |
| 913 | 940 | |
| 914 | 941 | template <size_t _Size> |
| 915 | 942 | inline |
| 943 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 916 | 944 | bitset<_Size>& |
| 917 | 945 | bitset<_Size>::flip() _NOEXCEPT |
| 918 | 946 | { |
| ... | ... | @@ -921,6 +949,7 @@ bitset<_Size>::flip() _NOEXCEPT |
| 921 | 949 | } |
| 922 | 950 | |
| 923 | 951 | template <size_t _Size> |
| 952 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 924 | 953 | bitset<_Size>& |
| 925 | 954 | bitset<_Size>::flip(size_t __pos) |
| 926 | 955 | { |
| ... | ... | @@ -934,6 +963,7 @@ bitset<_Size>::flip(size_t __pos) |
| 934 | 963 | |
| 935 | 964 | template <size_t _Size> |
| 936 | 965 | inline |
| 966 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 937 | 967 | unsigned long |
| 938 | 968 | bitset<_Size>::to_ulong() const |
| 939 | 969 | { |
| ... | ... | @@ -942,6 +972,7 @@ bitset<_Size>::to_ulong() const |
| 942 | 972 | |
| 943 | 973 | template <size_t _Size> |
| 944 | 974 | inline |
| 975 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 945 | 976 | unsigned long long |
| 946 | 977 | bitset<_Size>::to_ullong() const |
| 947 | 978 | { |
| ... | ... | @@ -950,6 +981,7 @@ bitset<_Size>::to_ullong() const |
| 950 | 981 | |
| 951 | 982 | template <size_t _Size> |
| 952 | 983 | template <class _CharT, class _Traits, class _Allocator> |
| 984 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 953 | 985 | basic_string<_CharT, _Traits, _Allocator> |
| 954 | 986 | bitset<_Size>::to_string(_CharT __zero, _CharT __one) const |
| 955 | 987 | { |
| ... | ... | @@ -965,6 +997,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const |
| 965 | 997 | template <size_t _Size> |
| 966 | 998 | template <class _CharT, class _Traits> |
| 967 | 999 | inline |
| 1000 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 968 | 1001 | basic_string<_CharT, _Traits, allocator<_CharT> > |
| 969 | 1002 | bitset<_Size>::to_string(_CharT __zero, _CharT __one) const |
| 970 | 1003 | { |
| ... | ... | @@ -974,6 +1007,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const |
| 974 | 1007 | template <size_t _Size> |
| 975 | 1008 | template <class _CharT> |
| 976 | 1009 | inline |
| 1010 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 977 | 1011 | basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > |
| 978 | 1012 | bitset<_Size>::to_string(_CharT __zero, _CharT __one) const |
| 979 | 1013 | { |
| ... | ... | @@ -982,6 +1016,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const |
| 982 | 1016 | |
| 983 | 1017 | template <size_t _Size> |
| 984 | 1018 | inline |
| 1019 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 985 | 1020 | basic_string<char, char_traits<char>, allocator<char> > |
| 986 | 1021 | bitset<_Size>::to_string(char __zero, char __one) const |
| 987 | 1022 | { |
| ... | ... | @@ -990,6 +1025,7 @@ bitset<_Size>::to_string(char __zero, char __one) const |
| 990 | 1025 | |
| 991 | 1026 | template <size_t _Size> |
| 992 | 1027 | inline |
| 1028 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 993 | 1029 | size_t |
| 994 | 1030 | bitset<_Size>::count() const _NOEXCEPT |
| 995 | 1031 | { |
| ... | ... | @@ -998,6 +1034,7 @@ bitset<_Size>::count() const _NOEXCEPT |
| 998 | 1034 | |
| 999 | 1035 | template <size_t _Size> |
| 1000 | 1036 | inline |
| 1037 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 1001 | 1038 | bool |
| 1002 | 1039 | bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT |
| 1003 | 1040 | { |
| ... | ... | @@ -1006,6 +1043,7 @@ bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT |
| 1006 | 1043 | |
| 1007 | 1044 | template <size_t _Size> |
| 1008 | 1045 | inline |
| 1046 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 1009 | 1047 | bool |
| 1010 | 1048 | bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT |
| 1011 | 1049 | { |
| ... | ... | @@ -1013,6 +1051,7 @@ bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT |
| 1013 | 1051 | } |
| 1014 | 1052 | |
| 1015 | 1053 | template <size_t _Size> |
| 1054 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 1016 | 1055 | bool |
| 1017 | 1056 | bitset<_Size>::test(size_t __pos) const |
| 1018 | 1057 | { |
| ... | ... | @@ -1024,6 +1063,7 @@ bitset<_Size>::test(size_t __pos) const |
| 1024 | 1063 | |
| 1025 | 1064 | template <size_t _Size> |
| 1026 | 1065 | inline |
| 1066 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 1027 | 1067 | bool |
| 1028 | 1068 | bitset<_Size>::all() const _NOEXCEPT |
| 1029 | 1069 | { |
| ... | ... | @@ -1032,6 +1072,7 @@ bitset<_Size>::all() const _NOEXCEPT |
| 1032 | 1072 | |
| 1033 | 1073 | template <size_t _Size> |
| 1034 | 1074 | inline |
| 1075 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 1035 | 1076 | bool |
| 1036 | 1077 | bitset<_Size>::any() const _NOEXCEPT |
| 1037 | 1078 | { |
| ... | ... | @@ -1040,6 +1081,7 @@ bitset<_Size>::any() const _NOEXCEPT |
| 1040 | 1081 | |
| 1041 | 1082 | template <size_t _Size> |
| 1042 | 1083 | inline |
| 1084 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 1043 | 1085 | bitset<_Size> |
| 1044 | 1086 | bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT |
| 1045 | 1087 | { |
| ... | ... | @@ -1050,6 +1092,7 @@ bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT |
| 1050 | 1092 | |
| 1051 | 1093 | template <size_t _Size> |
| 1052 | 1094 | inline |
| 1095 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 1053 | 1096 | bitset<_Size> |
| 1054 | 1097 | bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT |
| 1055 | 1098 | { |
| ... | ... | @@ -1059,7 +1102,7 @@ bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT |
| 1059 | 1102 | } |
| 1060 | 1103 | |
| 1061 | 1104 | template <size_t _Size> |
| 1062 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1105 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 1063 | 1106 | bitset<_Size> |
| 1064 | 1107 | operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT |
| 1065 | 1108 | { |
| ... | ... | @@ -1069,7 +1112,7 @@ operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT |
| 1069 | 1112 | } |
| 1070 | 1113 | |
| 1071 | 1114 | template <size_t _Size> |
| 1072 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1115 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 1073 | 1116 | bitset<_Size> |
| 1074 | 1117 | operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT |
| 1075 | 1118 | { |
| ... | ... | @@ -1079,7 +1122,7 @@ operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT |
| 1079 | 1122 | } |
| 1080 | 1123 | |
| 1081 | 1124 | template <size_t _Size> |
| 1082 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1125 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 | |
| 1083 | 1126 | bitset<_Size> |
| 1084 | 1127 | operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT |
| 1085 | 1128 | { |
| ... | ... | @@ -1098,15 +1141,19 @@ struct _LIBCPP_TEMPLATE_VIS hash<bitset<_Size> > |
| 1098 | 1141 | }; |
| 1099 | 1142 | |
| 1100 | 1143 | template <class _CharT, class _Traits, size_t _Size> |
| 1101 | basic_istream<_CharT, _Traits>& | |
| 1144 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 1102 | 1145 | operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x); |
| 1103 | 1146 | |
| 1104 | 1147 | template <class _CharT, class _Traits, size_t _Size> |
| 1105 | basic_ostream<_CharT, _Traits>& | |
| 1148 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 1106 | 1149 | operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x); |
| 1107 | 1150 | |
| 1108 | 1151 | _LIBCPP_END_NAMESPACE_STD |
| 1109 | 1152 | |
| 1110 | 1153 | _LIBCPP_POP_MACROS |
| 1111 | 1154 | |
| 1155 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1156 | # include <concepts> | |
| 1157 | #endif | |
| 1158 | ||
| 1112 | 1159 | #endif // _LIBCPP_BITSET |
lib/libcxx/include/cassert+8-1| ... | ... | @@ -18,7 +18,14 @@ Macros: |
| 18 | 18 | |
| 19 | 19 | #include <__assert> // all public C++ headers provide the assertion handler |
| 20 | 20 | #include <__config> |
| 21 | #include <assert.h> | |
| 21 | ||
| 22 | // <assert.h> is not provided by libc++ | |
| 23 | #if __has_include(<assert.h>) | |
| 24 | # include <assert.h> | |
| 25 | # ifdef _LIBCPP_ASSERT_H | |
| 26 | # error "If libc++ starts defining <assert.h>, the __has_include check should move to libc++'s <assert.h>" | |
| 27 | # endif | |
| 28 | #endif | |
| 22 | 29 | |
| 23 | 30 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 24 | 31 | # pragma GCC system_header |
lib/libcxx/include/cctype+8| ... | ... | @@ -36,8 +36,16 @@ int toupper(int c); |
| 36 | 36 | |
| 37 | 37 | #include <__assert> // all public C++ headers provide the assertion handler |
| 38 | 38 | #include <__config> |
| 39 | ||
| 39 | 40 | #include <ctype.h> |
| 40 | 41 | |
| 42 | #ifndef _LIBCPP_CTYPE_H | |
| 43 | # error <cctype> tried including <ctype.h> but didn't find libc++'s <ctype.h> header. \ | |
| 44 | This usually means that your header search paths are not configured properly. \ | |
| 45 | The header search paths should contain the C++ Standard Library headers before \ | |
| 46 | any C Standard Library. | |
| 47 | #endif | |
| 48 | ||
| 41 | 49 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 42 | 50 | # pragma GCC system_header |
| 43 | 51 | #endif |
lib/libcxx/include/cerrno+9| ... | ... | @@ -24,8 +24,17 @@ Macros: |
| 24 | 24 | |
| 25 | 25 | #include <__assert> // all public C++ headers provide the assertion handler |
| 26 | 26 | #include <__config> |
| 27 | ||
| 27 | 28 | #include <errno.h> |
| 28 | 29 | |
| 30 | #ifndef _LIBCPP_ERRNO_H | |
| 31 | # error <cerrno> tried including <errno.h> but didn't find libc++'s <errno.h> header. \ | |
| 32 | This usually means that your header search paths are not configured properly. \ | |
| 33 | The header search paths should contain the C++ Standard Library headers before \ | |
| 34 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 35 | not be the case. | |
| 36 | #endif | |
| 37 | ||
| 29 | 38 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 30 | 39 | # pragma GCC system_header |
| 31 | 40 | #endif |
lib/libcxx/include/cfenv+9| ... | ... | @@ -54,8 +54,17 @@ int feupdateenv(const fenv_t* envp); |
| 54 | 54 | |
| 55 | 55 | #include <__assert> // all public C++ headers provide the assertion handler |
| 56 | 56 | #include <__config> |
| 57 | ||
| 57 | 58 | #include <fenv.h> |
| 58 | 59 | |
| 60 | #ifndef _LIBCPP_FENV_H | |
| 61 | # error <cfenv> tried including <fenv.h> but didn't find libc++'s <fenv.h> header. \ | |
| 62 | This usually means that your header search paths are not configured properly. \ | |
| 63 | The header search paths should contain the C++ Standard Library headers before \ | |
| 64 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 65 | not be the case. | |
| 66 | #endif | |
| 67 | ||
| 59 | 68 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 60 | 69 | # pragma GCC system_header |
| 61 | 70 | #endif |
lib/libcxx/include/cfloat+9| ... | ... | @@ -71,8 +71,17 @@ Macros: |
| 71 | 71 | |
| 72 | 72 | #include <__assert> // all public C++ headers provide the assertion handler |
| 73 | 73 | #include <__config> |
| 74 | ||
| 74 | 75 | #include <float.h> |
| 75 | 76 | |
| 77 | #ifndef _LIBCPP_FLOAT_H | |
| 78 | # error <cfloat> tried including <float.h> but didn't find libc++'s <float.h> header. \ | |
| 79 | This usually means that your header search paths are not configured properly. \ | |
| 80 | The header search paths should contain the C++ Standard Library headers before \ | |
| 81 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 82 | not be the case. | |
| 83 | #endif | |
| 84 | ||
| 76 | 85 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 77 | 86 | # pragma GCC system_header |
| 78 | 87 | #endif |
lib/libcxx/include/charconv+125-105| ... | ... | @@ -30,8 +30,8 @@ namespace std { |
| 30 | 30 | friend bool operator==(const to_chars_result&, const to_chars_result&) = default; // since C++20 |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | to_chars_result to_chars(char* first, char* last, see below value, | |
| 34 | int base = 10); | |
| 33 | constexpr to_chars_result to_chars(char* first, char* last, see below value, | |
| 34 | int base = 10); // constexpr since C++23 | |
| 35 | 35 | to_chars_result to_chars(char* first, char* last, bool value, |
| 36 | 36 | int base = 10) = delete; |
| 37 | 37 | |
| ... | ... | @@ -60,8 +60,8 @@ namespace std { |
| 60 | 60 | friend bool operator==(const from_chars_result&, const from_chars_result&) = default; // since C++20 |
| 61 | 61 | }; |
| 62 | 62 | |
| 63 | from_chars_result from_chars(const char* first, const char* last, | |
| 64 | see below& value, int base = 10); | |
| 63 | constexpr from_chars_result from_chars(const char* first, const char* last, | |
| 64 | see below& value, int base = 10); // constexpr since C++23 | |
| 65 | 65 | |
| 66 | 66 | from_chars_result from_chars(const char* first, const char* last, |
| 67 | 67 | float& value, |
| ... | ... | @@ -77,9 +77,10 @@ namespace std { |
| 77 | 77 | |
| 78 | 78 | */ |
| 79 | 79 | |
| 80 | #include <__algorithm/copy_n.h> | |
| 80 | 81 | #include <__assert> // all public C++ headers provide the assertion handler |
| 81 | 82 | #include <__availability> |
| 82 | #include <__bits> | |
| 83 | #include <__bit/countl.h> | |
| 83 | 84 | #include <__charconv/chars_format.h> |
| 84 | 85 | #include <__charconv/from_chars_result.h> |
| 85 | 86 | #include <__charconv/tables.h> |
| ... | ... | @@ -88,6 +89,7 @@ namespace std { |
| 88 | 89 | #include <__config> |
| 89 | 90 | #include <__debug> |
| 90 | 91 | #include <__errc> |
| 92 | #include <__memory/addressof.h> | |
| 91 | 93 | #include <__type_traits/make_32_64_or_128_bit.h> |
| 92 | 94 | #include <__utility/unreachable.h> |
| 93 | 95 | #include <cmath> // for log2f |
| ... | ... | @@ -97,10 +99,6 @@ namespace std { |
| 97 | 99 | #include <limits> |
| 98 | 100 | #include <type_traits> |
| 99 | 101 | |
| 100 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 101 | # include <iosfwd> | |
| 102 | #endif | |
| 103 | ||
| 104 | 102 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 105 | 103 | # pragma GCC system_header |
| 106 | 104 | #endif |
| ... | ... | @@ -110,7 +108,7 @@ _LIBCPP_PUSH_MACROS |
| 110 | 108 | |
| 111 | 109 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 112 | 110 | |
| 113 | #ifndef _LIBCPP_CXX03_LANG | |
| 111 | #if _LIBCPP_STD_VER > 14 | |
| 114 | 112 | |
| 115 | 113 | to_chars_result to_chars(char*, char*, bool, int = 10) = delete; |
| 116 | 114 | from_chars_result from_chars(const char*, const char*, bool, int = 10) = delete; |
| ... | ... | @@ -134,18 +132,18 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) <= sizeof(uin |
| 134 | 132 | /// function requires its input to have at least one bit set the value of |
| 135 | 133 | /// zero is set to one. This means the first element of the lookup table is |
| 136 | 134 | /// zero. |
| 137 | static _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) | |
| 135 | static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) | |
| 138 | 136 | { |
| 139 | 137 | auto __t = (32 - std::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12; |
| 140 | return __t - (__v < __table<>::__pow10_32[__t]) + 1; | |
| 138 | return __t - (__v < __itoa::__pow10_32[__t]) + 1; | |
| 141 | 139 | } |
| 142 | 140 | |
| 143 | static _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) | |
| 141 | static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) | |
| 144 | 142 | { |
| 145 | 143 | return __itoa::__base_10_u32(__p, __v); |
| 146 | 144 | } |
| 147 | 145 | |
| 148 | static _LIBCPP_HIDE_FROM_ABI decltype(__table<>::__pow10_32)& __pow() { return __table<>::__pow10_32; } | |
| 146 | static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_32)& __pow() { return __itoa::__pow10_32; } | |
| 149 | 147 | }; |
| 150 | 148 | |
| 151 | 149 | template <typename _Tp> |
| ... | ... | @@ -161,14 +159,14 @@ struct _LIBCPP_HIDDEN |
| 161 | 159 | /// function requires its input to have at least one bit set the value of |
| 162 | 160 | /// zero is set to one. This means the first element of the lookup table is |
| 163 | 161 | /// zero. |
| 164 | static _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { | |
| 162 | static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { | |
| 165 | 163 | auto __t = (64 - std::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12; |
| 166 | return __t - (__v < __table<>::__pow10_64[__t]) + 1; | |
| 164 | return __t - (__v < __itoa::__pow10_64[__t]) + 1; | |
| 167 | 165 | } |
| 168 | 166 | |
| 169 | static _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { return __itoa::__base_10_u64(__p, __v); } | |
| 167 | static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { return __itoa::__base_10_u64(__p, __v); } | |
| 170 | 168 | |
| 171 | static _LIBCPP_HIDE_FROM_ABI decltype(__table<>::__pow10_64)& __pow() { return __table<>::__pow10_64; } | |
| 169 | static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_64)& __pow() { return __itoa::__pow10_64; } | |
| 172 | 170 | }; |
| 173 | 171 | |
| 174 | 172 | |
| ... | ... | @@ -186,25 +184,25 @@ struct _LIBCPP_HIDDEN |
| 186 | 184 | /// function requires its input to have at least one bit set the value of |
| 187 | 185 | /// zero is set to one. This means the first element of the lookup table is |
| 188 | 186 | /// zero. |
| 189 | static _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { | |
| 187 | static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { | |
| 190 | 188 | _LIBCPP_ASSERT(__v > numeric_limits<uint64_t>::max(), "The optimizations for this algorithm fail when this isn't true."); |
| 191 | 189 | // There's always a bit set in the upper 64-bits. |
| 192 | 190 | auto __t = (128 - std::__libcpp_clz(static_cast<uint64_t>(__v >> 64))) * 1233 >> 12; |
| 193 | _LIBCPP_ASSERT(__t >= __table<>::__pow10_128_offset, "Index out of bounds"); | |
| 191 | _LIBCPP_ASSERT(__t >= __itoa::__pow10_128_offset, "Index out of bounds"); | |
| 194 | 192 | // __t is adjusted since the lookup table misses the lower entries. |
| 195 | return __t - (__v < __table<>::__pow10_128[__t - __table<>::__pow10_128_offset]) + 1; | |
| 193 | return __t - (__v < __itoa::__pow10_128[__t - __itoa::__pow10_128_offset]) + 1; | |
| 196 | 194 | } |
| 197 | 195 | |
| 198 | static _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { return __itoa::__base_10_u128(__p, __v); } | |
| 196 | static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { return __itoa::__base_10_u128(__p, __v); } | |
| 199 | 197 | |
| 200 | 198 | // TODO FMT This pow function should get an index. |
| 201 | 199 | // By moving this to its own header it can be reused by the pow function in to_chars_base_10. |
| 202 | static _LIBCPP_HIDE_FROM_ABI decltype(__table<>::__pow10_128)& __pow() { return __table<>::__pow10_128; } | |
| 200 | static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_128)& __pow() { return __itoa::__pow10_128; } | |
| 203 | 201 | }; |
| 204 | 202 | #endif |
| 205 | 203 | |
| 206 | 204 | template <typename _Tp> |
| 207 | inline _LIBCPP_HIDE_FROM_ABI bool | |
| 205 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool | |
| 208 | 206 | __mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r) |
| 209 | 207 | { |
| 210 | 208 | auto __c = __a * __b; |
| ... | ... | @@ -213,7 +211,7 @@ __mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r) |
| 213 | 211 | } |
| 214 | 212 | |
| 215 | 213 | template <typename _Tp> |
| 216 | inline _LIBCPP_HIDE_FROM_ABI bool | |
| 214 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool | |
| 217 | 215 | __mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r) |
| 218 | 216 | { |
| 219 | 217 | auto __c = __a * __b; |
| ... | ... | @@ -222,24 +220,18 @@ __mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r) |
| 222 | 220 | } |
| 223 | 221 | |
| 224 | 222 | template <typename _Tp> |
| 225 | inline _LIBCPP_HIDE_FROM_ABI bool | |
| 223 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool | |
| 226 | 224 | __mul_overflowed(_Tp __a, _Tp __b, _Tp& __r) |
| 227 | 225 | { |
| 228 | 226 | static_assert(is_unsigned<_Tp>::value, ""); |
| 229 | #if !defined(_LIBCPP_COMPILER_MSVC) | |
| 230 | 227 | return __builtin_mul_overflow(__a, __b, &__r); |
| 231 | #else | |
| 232 | bool __did = __b && (numeric_limits<_Tp>::max() / __b) < __a; | |
| 233 | __r = __a * __b; | |
| 234 | return __did; | |
| 235 | #endif | |
| 236 | 228 | } |
| 237 | 229 | |
| 238 | 230 | template <typename _Tp, typename _Up> |
| 239 | 231 | inline _LIBCPP_HIDE_FROM_ABI bool |
| 240 | __mul_overflowed(_Tp __a, _Up __b, _Tp& __r) | |
| 232 | _LIBCPP_CONSTEXPR_SINCE_CXX23 __mul_overflowed(_Tp __a, _Up __b, _Tp& __r) | |
| 241 | 233 | { |
| 242 | return __mul_overflowed(__a, static_cast<_Tp>(__b), __r); | |
| 234 | return __itoa::__mul_overflowed(__a, static_cast<_Tp>(__b), __r); | |
| 243 | 235 | } |
| 244 | 236 | |
| 245 | 237 | template <typename _Tp> |
| ... | ... | @@ -250,7 +242,7 @@ struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp> |
| 250 | 242 | using typename __traits_base<_Tp>::type; |
| 251 | 243 | |
| 252 | 244 | // precondition: at least one non-zero character available |
| 253 | static _LIBCPP_HIDE_FROM_ABI char const* | |
| 245 | static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char const* | |
| 254 | 246 | __read(char const* __p, char const* __ep, type& __a, type& __b) |
| 255 | 247 | { |
| 256 | 248 | type __cprod[digits]; |
| ... | ... | @@ -258,20 +250,20 @@ struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp> |
| 258 | 250 | int __i = digits; |
| 259 | 251 | do |
| 260 | 252 | { |
| 261 | if (!('0' <= *__p && *__p <= '9')) | |
| 253 | if (*__p < '0' || *__p > '9') | |
| 262 | 254 | break; |
| 263 | 255 | __cprod[--__i] = *__p++ - '0'; |
| 264 | 256 | } while (__p != __ep && __i != 0); |
| 265 | 257 | |
| 266 | 258 | __a = __inner_product(__cprod + __i + 1, __cprod + __j, __pow() + 1, |
| 267 | 259 | __cprod[__i]); |
| 268 | if (__mul_overflowed(__cprod[__j], __pow()[__j - __i], __b)) | |
| 260 | if (__itoa::__mul_overflowed(__cprod[__j], __pow()[__j - __i], __b)) | |
| 269 | 261 | --__p; |
| 270 | 262 | return __p; |
| 271 | 263 | } |
| 272 | 264 | |
| 273 | 265 | template <typename _It1, typename _It2, class _Up> |
| 274 | static _LIBCPP_HIDE_FROM_ABI _Up | |
| 266 | static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _Up | |
| 275 | 267 | __inner_product(_It1 __first1, _It1 __last1, _It2 __first2, _Up __init) |
| 276 | 268 | { |
| 277 | 269 | for (; __first1 < __last1; ++__first1, ++__first2) |
| ... | ... | @@ -283,7 +275,7 @@ struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp> |
| 283 | 275 | } // namespace __itoa |
| 284 | 276 | |
| 285 | 277 | template <typename _Tp> |
| 286 | inline _LIBCPP_HIDE_FROM_ABI _Tp | |
| 278 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _Tp | |
| 287 | 279 | __complement(_Tp __x) |
| 288 | 280 | { |
| 289 | 281 | static_assert(is_unsigned<_Tp>::value, "cast to unsigned first"); |
| ... | ... | @@ -291,21 +283,25 @@ __complement(_Tp __x) |
| 291 | 283 | } |
| 292 | 284 | |
| 293 | 285 | template <typename _Tp> |
| 294 | inline _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 286 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 287 | __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type); | |
| 288 | ||
| 289 | template <typename _Tp> | |
| 290 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 295 | 291 | __to_chars_itoa(char* __first, char* __last, _Tp __value, true_type) |
| 296 | 292 | { |
| 297 | auto __x = __to_unsigned_like(__value); | |
| 293 | auto __x = std::__to_unsigned_like(__value); | |
| 298 | 294 | if (__value < 0 && __first != __last) |
| 299 | 295 | { |
| 300 | 296 | *__first++ = '-'; |
| 301 | __x = __complement(__x); | |
| 297 | __x = std::__complement(__x); | |
| 302 | 298 | } |
| 303 | 299 | |
| 304 | return __to_chars_itoa(__first, __last, __x, false_type()); | |
| 300 | return std::__to_chars_itoa(__first, __last, __x, false_type()); | |
| 305 | 301 | } |
| 306 | 302 | |
| 307 | 303 | template <typename _Tp> |
| 308 | inline _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 304 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 309 | 305 | __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) |
| 310 | 306 | { |
| 311 | 307 | using __tx = __itoa::__traits<_Tp>; |
| ... | ... | @@ -319,7 +315,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) |
| 319 | 315 | |
| 320 | 316 | # ifndef _LIBCPP_HAS_NO_INT128 |
| 321 | 317 | template <> |
| 322 | inline _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 318 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 323 | 319 | __to_chars_itoa(char* __first, char* __last, __uint128_t __value, false_type) |
| 324 | 320 | { |
| 325 | 321 | // When the value fits in 64-bits use the 64-bit code path. This reduces |
| ... | ... | @@ -339,19 +335,23 @@ __to_chars_itoa(char* __first, char* __last, __uint128_t __value, false_type) |
| 339 | 335 | } |
| 340 | 336 | #endif |
| 341 | 337 | |
| 338 | template <class _Tp> | |
| 339 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 340 | __to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_type); | |
| 341 | ||
| 342 | 342 | template <typename _Tp> |
| 343 | inline _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 343 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 344 | 344 | __to_chars_integral(char* __first, char* __last, _Tp __value, int __base, |
| 345 | 345 | true_type) |
| 346 | 346 | { |
| 347 | auto __x = __to_unsigned_like(__value); | |
| 347 | auto __x = std::__to_unsigned_like(__value); | |
| 348 | 348 | if (__value < 0 && __first != __last) |
| 349 | 349 | { |
| 350 | 350 | *__first++ = '-'; |
| 351 | __x = __complement(__x); | |
| 351 | __x = std::__complement(__x); | |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | return __to_chars_integral(__first, __last, __x, __base, false_type()); | |
| 354 | return std::__to_chars_integral(__first, __last, __x, __base, false_type()); | |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | namespace __itoa { |
| ... | ... | @@ -370,7 +370,7 @@ struct _LIBCPP_HIDDEN __integral<2> { |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | template <typename _Tp> |
| 373 | _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) { | |
| 373 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) { | |
| 374 | 374 | ptrdiff_t __cap = __last - __first; |
| 375 | 375 | int __n = __width(__value); |
| 376 | 376 | if (__n > __cap) |
| ... | ... | @@ -383,7 +383,7 @@ struct _LIBCPP_HIDDEN __integral<2> { |
| 383 | 383 | unsigned __c = __value % __divisor; |
| 384 | 384 | __value /= __divisor; |
| 385 | 385 | __p -= 4; |
| 386 | std::memcpy(__p, &__table<>::__base_2_lut[4 * __c], 4); | |
| 386 | std::copy_n(&__base_2_lut[4 * __c], 4, __p); | |
| 387 | 387 | } |
| 388 | 388 | do { |
| 389 | 389 | unsigned __c = __value % 2; |
| ... | ... | @@ -405,7 +405,7 @@ struct _LIBCPP_HIDDEN __integral<8> { |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | template <typename _Tp> |
| 408 | _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) { | |
| 408 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) { | |
| 409 | 409 | ptrdiff_t __cap = __last - __first; |
| 410 | 410 | int __n = __width(__value); |
| 411 | 411 | if (__n > __cap) |
| ... | ... | @@ -418,7 +418,7 @@ struct _LIBCPP_HIDDEN __integral<8> { |
| 418 | 418 | unsigned __c = __value % __divisor; |
| 419 | 419 | __value /= __divisor; |
| 420 | 420 | __p -= 2; |
| 421 | std::memcpy(__p, &__table<>::__base_8_lut[2 * __c], 2); | |
| 421 | std::copy_n(&__base_8_lut[2 * __c], 2, __p); | |
| 422 | 422 | } |
| 423 | 423 | do { |
| 424 | 424 | unsigned __c = __value % 8; |
| ... | ... | @@ -441,7 +441,7 @@ struct _LIBCPP_HIDDEN __integral<16> { |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | template <typename _Tp> |
| 444 | _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) { | |
| 444 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) { | |
| 445 | 445 | ptrdiff_t __cap = __last - __first; |
| 446 | 446 | int __n = __width(__value); |
| 447 | 447 | if (__n > __cap) |
| ... | ... | @@ -454,7 +454,7 @@ struct _LIBCPP_HIDDEN __integral<16> { |
| 454 | 454 | unsigned __c = __value % __divisor; |
| 455 | 455 | __value /= __divisor; |
| 456 | 456 | __p -= 2; |
| 457 | std::memcpy(__p, &__table<>::__base_16_lut[2 * __c], 2); | |
| 457 | std::copy_n(&__base_16_lut[2 * __c], 2, __p); | |
| 458 | 458 | } |
| 459 | 459 | if (__first != __last) |
| 460 | 460 | do { |
| ... | ... | @@ -470,34 +470,34 @@ struct _LIBCPP_HIDDEN __integral<16> { |
| 470 | 470 | |
| 471 | 471 | template <unsigned _Base, typename _Tp, |
| 472 | 472 | typename enable_if<(sizeof(_Tp) >= sizeof(unsigned)), int>::type = 0> |
| 473 | _LIBCPP_HIDE_FROM_ABI int | |
| 473 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int | |
| 474 | 474 | __to_chars_integral_width(_Tp __value) { |
| 475 | 475 | return __itoa::__integral<_Base>::__width(__value); |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | template <unsigned _Base, typename _Tp, |
| 479 | 479 | typename enable_if<(sizeof(_Tp) < sizeof(unsigned)), int>::type = 0> |
| 480 | _LIBCPP_HIDE_FROM_ABI int | |
| 480 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int | |
| 481 | 481 | __to_chars_integral_width(_Tp __value) { |
| 482 | 482 | return std::__to_chars_integral_width<_Base>(static_cast<unsigned>(__value)); |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | template <unsigned _Base, typename _Tp, |
| 486 | 486 | typename enable_if<(sizeof(_Tp) >= sizeof(unsigned)), int>::type = 0> |
| 487 | _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 487 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 488 | 488 | __to_chars_integral(char* __first, char* __last, _Tp __value) { |
| 489 | 489 | return __itoa::__integral<_Base>::__to_chars(__first, __last, __value); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | template <unsigned _Base, typename _Tp, |
| 493 | 493 | typename enable_if<(sizeof(_Tp) < sizeof(unsigned)), int>::type = 0> |
| 494 | _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 494 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 495 | 495 | __to_chars_integral(char* __first, char* __last, _Tp __value) { |
| 496 | 496 | return std::__to_chars_integral<_Base>(__first, __last, static_cast<unsigned>(__value)); |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | template <typename _Tp> |
| 500 | _LIBCPP_HIDE_FROM_ABI int | |
| 500 | _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int | |
| 501 | 501 | __to_chars_integral_width(_Tp __value, unsigned __base) { |
| 502 | 502 | _LIBCPP_ASSERT(__value >= 0, "The function requires a non-negative value."); |
| 503 | 503 | |
| ... | ... | @@ -524,24 +524,24 @@ __to_chars_integral_width(_Tp __value, unsigned __base) { |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | template <typename _Tp> |
| 527 | inline _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 527 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 528 | 528 | __to_chars_integral(char* __first, char* __last, _Tp __value, int __base, |
| 529 | 529 | false_type) |
| 530 | 530 | { |
| 531 | 531 | if (__base == 10) [[likely]] |
| 532 | return __to_chars_itoa(__first, __last, __value, false_type()); | |
| 532 | return std::__to_chars_itoa(__first, __last, __value, false_type()); | |
| 533 | 533 | |
| 534 | 534 | switch (__base) { |
| 535 | 535 | case 2: |
| 536 | return __to_chars_integral<2>(__first, __last, __value); | |
| 536 | return std::__to_chars_integral<2>(__first, __last, __value); | |
| 537 | 537 | case 8: |
| 538 | return __to_chars_integral<8>(__first, __last, __value); | |
| 538 | return std::__to_chars_integral<8>(__first, __last, __value); | |
| 539 | 539 | case 16: |
| 540 | return __to_chars_integral<16>(__first, __last, __value); | |
| 540 | return std::__to_chars_integral<16>(__first, __last, __value); | |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | ptrdiff_t __cap = __last - __first; |
| 544 | int __n = __to_chars_integral_width(__value, __base); | |
| 544 | int __n = std::__to_chars_integral_width(__value, __base); | |
| 545 | 545 | if (__n > __cap) |
| 546 | 546 | return {__last, errc::value_too_large}; |
| 547 | 547 | |
| ... | ... | @@ -556,7 +556,7 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base, |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> |
| 559 | inline _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 559 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 560 | 560 | to_chars(char* __first, char* __last, _Tp __value) |
| 561 | 561 | { |
| 562 | 562 | using _Type = __make_32_64_or_128_bit_t<_Tp>; |
| ... | ... | @@ -565,7 +565,7 @@ to_chars(char* __first, char* __last, _Tp __value) |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> |
| 568 | inline _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 568 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result | |
| 569 | 569 | to_chars(char* __first, char* __last, _Tp __value, int __base) |
| 570 | 570 | { |
| 571 | 571 | _LIBCPP_ASSERT(2 <= __base && __base <= 36, "base not in [2, 36]"); |
| ... | ... | @@ -575,11 +575,11 @@ to_chars(char* __first, char* __last, _Tp __value, int __base) |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | template <typename _It, typename _Tp, typename _Fn, typename... _Ts> |
| 578 | inline _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 578 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 579 | 579 | __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) |
| 580 | 580 | { |
| 581 | 581 | using __tl = numeric_limits<_Tp>; |
| 582 | decltype(__to_unsigned_like(__value)) __x; | |
| 582 | decltype(std::__to_unsigned_like(__value)) __x; | |
| 583 | 583 | |
| 584 | 584 | bool __neg = (__first != __last && *__first == '-'); |
| 585 | 585 | auto __r = __f(__neg ? __first + 1 : __first, __last, __x, __args...); |
| ... | ... | @@ -595,16 +595,16 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) |
| 595 | 595 | |
| 596 | 596 | if (__neg) |
| 597 | 597 | { |
| 598 | if (__x <= __complement(__to_unsigned_like(__tl::min()))) | |
| 598 | if (__x <= std::__complement(std::__to_unsigned_like(__tl::min()))) | |
| 599 | 599 | { |
| 600 | __x = __complement(__x); | |
| 601 | std::memcpy(&__value, &__x, sizeof(__x)); | |
| 600 | __x = std::__complement(__x); | |
| 601 | std::copy_n(std::addressof(__x), 1, std::addressof(__value)); | |
| 602 | 602 | return __r; |
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | else |
| 606 | 606 | { |
| 607 | if (__x <= __to_unsigned_like(__tl::max())) | |
| 607 | if (__x <= std::__to_unsigned_like(__tl::max())) | |
| 608 | 608 | { |
| 609 | 609 | __value = __x; |
| 610 | 610 | return __r; |
| ... | ... | @@ -615,7 +615,7 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | template <typename _Tp> |
| 618 | inline _LIBCPP_HIDE_FROM_ABI bool | |
| 618 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool | |
| 619 | 619 | __in_pattern(_Tp __c) |
| 620 | 620 | { |
| 621 | 621 | return '0' <= __c && __c <= '9'; |
| ... | ... | @@ -626,16 +626,16 @@ struct _LIBCPP_HIDDEN __in_pattern_result |
| 626 | 626 | bool __ok; |
| 627 | 627 | int __val; |
| 628 | 628 | |
| 629 | explicit _LIBCPP_HIDE_FROM_ABI operator bool() const { return __ok; } | |
| 629 | explicit _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI operator bool() const { return __ok; } | |
| 630 | 630 | }; |
| 631 | 631 | |
| 632 | 632 | template <typename _Tp> |
| 633 | inline _LIBCPP_HIDE_FROM_ABI __in_pattern_result | |
| 633 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __in_pattern_result | |
| 634 | 634 | __in_pattern(_Tp __c, int __base) |
| 635 | 635 | { |
| 636 | 636 | if (__base <= 10) |
| 637 | 637 | return {'0' <= __c && __c < '0' + __base, __c - '0'}; |
| 638 | else if (__in_pattern(__c)) | |
| 638 | else if (std::__in_pattern(__c)) | |
| 639 | 639 | return {true, __c - '0'}; |
| 640 | 640 | else if ('a' <= __c && __c < 'a' + __base - 10) |
| 641 | 641 | return {true, __c - 'a' + 10}; |
| ... | ... | @@ -644,7 +644,7 @@ __in_pattern(_Tp __c, int __base) |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | template <typename _It, typename _Tp, typename _Fn, typename... _Ts> |
| 647 | inline _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 647 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 648 | 648 | __subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, |
| 649 | 649 | _Ts... __args) |
| 650 | 650 | { |
| ... | ... | @@ -656,7 +656,7 @@ __subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, |
| 656 | 656 | }; |
| 657 | 657 | |
| 658 | 658 | auto __p = __find_non_zero(__first, __last); |
| 659 | if (__p == __last || !__in_pattern(*__p, __args...)) | |
| 659 | if (__p == __last || !std::__in_pattern(*__p, __args...)) | |
| 660 | 660 | { |
| 661 | 661 | if (__p == __first) |
| 662 | 662 | return {__first, errc::invalid_argument}; |
| ... | ... | @@ -672,7 +672,7 @@ __subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, |
| 672 | 672 | { |
| 673 | 673 | for (; __r.ptr != __last; ++__r.ptr) |
| 674 | 674 | { |
| 675 | if (!__in_pattern(*__r.ptr, __args...)) | |
| 675 | if (!std::__in_pattern(*__r.ptr, __args...)) | |
| 676 | 676 | break; |
| 677 | 677 | } |
| 678 | 678 | } |
| ... | ... | @@ -681,19 +681,19 @@ __subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0> |
| 684 | inline _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 684 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 685 | 685 | __from_chars_atoi(const char* __first, const char* __last, _Tp& __value) |
| 686 | 686 | { |
| 687 | 687 | using __tx = __itoa::__traits<_Tp>; |
| 688 | 688 | using __output_type = typename __tx::type; |
| 689 | 689 | |
| 690 | return __subject_seq_combinator( | |
| 690 | return std::__subject_seq_combinator( | |
| 691 | 691 | __first, __last, __value, |
| 692 | 692 | [](const char* __f, const char* __l, |
| 693 | 693 | _Tp& __val) -> from_chars_result { |
| 694 | 694 | __output_type __a, __b; |
| 695 | 695 | auto __p = __tx::__read(__f, __l, __a, __b); |
| 696 | if (__p == __l || !__in_pattern(*__p)) | |
| 696 | if (__p == __l || !std::__in_pattern(*__p)) | |
| 697 | 697 | { |
| 698 | 698 | __output_type __m = numeric_limits<_Tp>::max(); |
| 699 | 699 | if (__m >= __a && __m - __a >= __b) |
| ... | ... | @@ -707,27 +707,47 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value) |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0> |
| 710 | inline _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 710 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 711 | 711 | __from_chars_atoi(const char* __first, const char* __last, _Tp& __value) |
| 712 | 712 | { |
| 713 | using __t = decltype(__to_unsigned_like(__value)); | |
| 714 | return __sign_combinator(__first, __last, __value, __from_chars_atoi<__t>); | |
| 713 | using __t = decltype(std::__to_unsigned_like(__value)); | |
| 714 | return std::__sign_combinator(__first, __last, __value, __from_chars_atoi<__t>); | |
| 715 | } | |
| 716 | ||
| 717 | ||
| 718 | /* | |
| 719 | // Code used to generate __from_chars_log2f_lut. | |
| 720 | #include <cmath> | |
| 721 | #include <iostream> | |
| 722 | #include <format> | |
| 723 | ||
| 724 | int main() { | |
| 725 | for (int i = 2; i <= 36; ++i) | |
| 726 | std::cout << std::format("{},\n", log2f(i)); | |
| 715 | 727 | } |
| 728 | */ | |
| 729 | /// log2f table for bases [2, 36]. | |
| 730 | inline constexpr float __from_chars_log2f_lut[35] = { | |
| 731 | 1, 1.5849625, 2, 2.321928, 2.5849626, 2.807355, 3, 3.169925, 3.321928, | |
| 732 | 3.4594316, 3.5849626, 3.7004397, 3.807355, 3.9068906, 4, 4.087463, 4.169925, 4.2479277, | |
| 733 | 4.321928, 4.3923173, 4.4594316, 4.523562, 4.5849624, 4.643856, 4.70044, 4.7548876, 4.807355, | |
| 734 | 4.857981, 4.9068904, 4.9541965, 5, 5.044394, 5.087463, 5.129283, 5.169925}; | |
| 716 | 735 | |
| 717 | 736 | template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0> |
| 718 | inline _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 737 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 719 | 738 | __from_chars_integral(const char* __first, const char* __last, _Tp& __value, |
| 720 | 739 | int __base) |
| 721 | 740 | { |
| 722 | 741 | if (__base == 10) |
| 723 | return __from_chars_atoi(__first, __last, __value); | |
| 742 | return std::__from_chars_atoi(__first, __last, __value); | |
| 724 | 743 | |
| 725 | return __subject_seq_combinator( | |
| 744 | return std::__subject_seq_combinator( | |
| 726 | 745 | __first, __last, __value, |
| 727 | 746 | [](const char* __p, const char* __lastp, _Tp& __val, |
| 728 | 747 | int __b) -> from_chars_result { |
| 729 | 748 | using __tl = numeric_limits<_Tp>; |
| 730 | auto __digits = __tl::digits / log2f(float(__b)); | |
| 749 | // __base is always between 2 and 36 inclusive. | |
| 750 | auto __digits = __tl::digits / __from_chars_log2f_lut[__b - 2]; | |
| 731 | 751 | _Tp __x = __in_pattern(*__p++, __b).__val, __y = 0; |
| 732 | 752 | |
| 733 | 753 | for (int __i = 1; __p != __lastp; ++__i, ++__p) |
| ... | ... | @@ -762,34 +782,30 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value, |
| 762 | 782 | } |
| 763 | 783 | |
| 764 | 784 | template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0> |
| 765 | inline _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 785 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 766 | 786 | __from_chars_integral(const char* __first, const char* __last, _Tp& __value, |
| 767 | 787 | int __base) |
| 768 | 788 | { |
| 769 | using __t = decltype(__to_unsigned_like(__value)); | |
| 770 | return __sign_combinator(__first, __last, __value, | |
| 771 | __from_chars_integral<__t>, __base); | |
| 789 | using __t = decltype(std::__to_unsigned_like(__value)); | |
| 790 | return std::__sign_combinator(__first, __last, __value, | |
| 791 | __from_chars_integral<__t>, __base); | |
| 772 | 792 | } |
| 773 | 793 | |
| 774 | 794 | template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> |
| 775 | inline _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 795 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 776 | 796 | from_chars(const char* __first, const char* __last, _Tp& __value) |
| 777 | 797 | { |
| 778 | return __from_chars_atoi(__first, __last, __value); | |
| 798 | return std::__from_chars_atoi(__first, __last, __value); | |
| 779 | 799 | } |
| 780 | 800 | |
| 781 | 801 | template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> |
| 782 | inline _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 802 | inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| 783 | 803 | from_chars(const char* __first, const char* __last, _Tp& __value, int __base) |
| 784 | 804 | { |
| 785 | 805 | _LIBCPP_ASSERT(2 <= __base && __base <= 36, "base not in [2, 36]"); |
| 786 | return __from_chars_integral(__first, __last, __value, __base); | |
| 806 | return std::__from_chars_integral(__first, __last, __value, __base); | |
| 787 | 807 | } |
| 788 | 808 | |
| 789 | // Floating-point implementation starts here. | |
| 790 | // Unlike the other parts of charconv this is only available in C++17 and newer. | |
| 791 | #if _LIBCPP_STD_VER > 14 | |
| 792 | ||
| 793 | 809 | _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS |
| 794 | 810 | to_chars_result to_chars(char* __first, char* __last, float __value); |
| 795 | 811 | |
| ... | ... | @@ -817,11 +833,15 @@ to_chars_result to_chars(char* __first, char* __last, double __value, chars_form |
| 817 | 833 | _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS |
| 818 | 834 | to_chars_result to_chars(char* __first, char* __last, long double __value, chars_format __fmt, int __precision); |
| 819 | 835 | |
| 820 | # endif // _LIBCPP_STD_VER > 14 | |
| 821 | #endif // _LIBCPP_CXX03_LANG | |
| 836 | #endif // _LIBCPP_STD_VER > 14 | |
| 822 | 837 | |
| 823 | 838 | _LIBCPP_END_NAMESPACE_STD |
| 824 | 839 | |
| 825 | 840 | _LIBCPP_POP_MACROS |
| 826 | 841 | |
| 842 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 843 | # include <concepts> | |
| 844 | # include <iosfwd> | |
| 845 | #endif | |
| 846 | ||
| 827 | 847 | #endif // _LIBCPP_CHARCONV |
lib/libcxx/include/chrono+106-43| ... | ... | @@ -207,7 +207,11 @@ template <class ToDuration, class Rep, class Period> |
| 207 | 207 | template <class ToDuration, class Rep, class Period> |
| 208 | 208 | constexpr ToDuration round(const duration<Rep, Period>& d); // C++17 |
| 209 | 209 | |
| 210 | // duration I/O is elsewhere | |
| 210 | // duration I/O | |
| 211 | template<class charT, class traits, class Rep, class Period> // C++20 | |
| 212 | basic_ostream<charT, traits>& | |
| 213 | operator<<(basic_ostream<charT, traits>& os, | |
| 214 | const duration<Rep, Period>& d); | |
| 211 | 215 | |
| 212 | 216 | // time_point arithmetic (all constexpr in C++14) |
| 213 | 217 | template <class Clock, class Duration1, class Rep2, class Period2> |
| ... | ... | @@ -332,32 +336,35 @@ constexpr day operator+(const day& x, const days& y) noexcept; |
| 332 | 336 | constexpr day operator+(const days& x, const day& y) noexcept; |
| 333 | 337 | constexpr day operator-(const day& x, const days& y) noexcept; |
| 334 | 338 | constexpr days operator-(const day& x, const day& y) noexcept; |
| 339 | template<class charT, class traits> | |
| 340 | basic_ostream<charT, traits>& | |
| 341 | operator<<(basic_ostream<charT, traits>& os, const day& d); | |
| 335 | 342 | |
| 336 | 343 | // 25.8.4, class month // C++20 |
| 337 | 344 | class month; |
| 338 | 345 | constexpr bool operator==(const month& x, const month& y) noexcept; |
| 339 | constexpr bool operator!=(const month& x, const month& y) noexcept; | |
| 340 | constexpr bool operator< (const month& x, const month& y) noexcept; | |
| 341 | constexpr bool operator> (const month& x, const month& y) noexcept; | |
| 342 | constexpr bool operator<=(const month& x, const month& y) noexcept; | |
| 343 | constexpr bool operator>=(const month& x, const month& y) noexcept; | |
| 346 | constexpr strong_ordering operator<=>(const month& x, const month& y) noexcept; | |
| 347 | ||
| 344 | 348 | constexpr month operator+(const month& x, const months& y) noexcept; |
| 345 | 349 | constexpr month operator+(const months& x, const month& y) noexcept; |
| 346 | 350 | constexpr month operator-(const month& x, const months& y) noexcept; |
| 347 | 351 | constexpr months operator-(const month& x, const month& y) noexcept; |
| 352 | template<class charT, class traits> | |
| 353 | basic_ostream<charT, traits>& | |
| 354 | operator<<(basic_ostream<charT, traits>& os, const month& m); | |
| 348 | 355 | |
| 349 | 356 | // 25.8.5, class year // C++20 |
| 350 | 357 | class year; |
| 351 | 358 | constexpr bool operator==(const year& x, const year& y) noexcept; |
| 352 | constexpr bool operator!=(const year& x, const year& y) noexcept; | |
| 353 | constexpr bool operator< (const year& x, const year& y) noexcept; | |
| 354 | constexpr bool operator> (const year& x, const year& y) noexcept; | |
| 355 | constexpr bool operator<=(const year& x, const year& y) noexcept; | |
| 356 | constexpr bool operator>=(const year& x, const year& y) noexcept; | |
| 359 | constexpr strong_ordering operator<=>(const year& x, const year& y) noexcept; | |
| 360 | ||
| 357 | 361 | constexpr year operator+(const year& x, const years& y) noexcept; |
| 358 | 362 | constexpr year operator+(const years& x, const year& y) noexcept; |
| 359 | 363 | constexpr year operator-(const year& x, const years& y) noexcept; |
| 360 | 364 | constexpr years operator-(const year& x, const year& y) noexcept; |
| 365 | template<class charT, class traits> | |
| 366 | basic_ostream<charT, traits>& | |
| 367 | operator<<(basic_ostream<charT, traits>& os, const year& y); | |
| 361 | 368 | |
| 362 | 369 | // 25.8.6, class weekday // C++20 |
| 363 | 370 | class weekday; |
| ... | ... | @@ -368,6 +375,9 @@ constexpr weekday operator+(const weekday& x, const days& y) noexcept; |
| 368 | 375 | constexpr weekday operator+(const days& x, const weekday& y) noexcept; |
| 369 | 376 | constexpr weekday operator-(const weekday& x, const days& y) noexcept; |
| 370 | 377 | constexpr days operator-(const weekday& x, const weekday& y) noexcept; |
| 378 | template<class charT, class traits> | |
| 379 | basic_ostream<charT, traits>& | |
| 380 | operator<<(basic_ostream<charT, traits>& os, const weekday& wd); | |
| 371 | 381 | |
| 372 | 382 | // 25.8.7, class weekday_indexed // C++20 |
| 373 | 383 | |
| ... | ... | @@ -375,32 +385,39 @@ class weekday_indexed; |
| 375 | 385 | constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept; |
| 376 | 386 | constexpr bool operator!=(const weekday_indexed& x, const weekday_indexed& y) noexcept; |
| 377 | 387 | |
| 388 | template<class charT, class traits> | |
| 389 | basic_ostream<charT, traits>& | |
| 390 | operator<<(basic_ostream<charT, traits>& os, const weekday_indexed& wdi); | |
| 391 | ||
| 378 | 392 | // 25.8.8, class weekday_last // C++20 |
| 379 | 393 | class weekday_last; |
| 380 | 394 | |
| 381 | 395 | constexpr bool operator==(const weekday_last& x, const weekday_last& y) noexcept; |
| 382 | 396 | constexpr bool operator!=(const weekday_last& x, const weekday_last& y) noexcept; |
| 383 | 397 | |
| 398 | template<class charT, class traits> | |
| 399 | basic_ostream<charT, traits>& | |
| 400 | operator<<(basic_ostream<charT, traits>& os, const weekday_last& wdl); | |
| 401 | ||
| 384 | 402 | // 25.8.9, class month_day // C++20 |
| 385 | 403 | class month_day; |
| 386 | 404 | |
| 387 | 405 | constexpr bool operator==(const month_day& x, const month_day& y) noexcept; |
| 388 | constexpr bool operator!=(const month_day& x, const month_day& y) noexcept; | |
| 389 | constexpr bool operator< (const month_day& x, const month_day& y) noexcept; | |
| 390 | constexpr bool operator> (const month_day& x, const month_day& y) noexcept; | |
| 391 | constexpr bool operator<=(const month_day& x, const month_day& y) noexcept; | |
| 392 | constexpr bool operator>=(const month_day& x, const month_day& y) noexcept; | |
| 406 | constexpr strong_ordering operator<=>(const month_day& x, const month_day& y) noexcept; | |
| 393 | 407 | |
| 408 | template<class charT, class traits> | |
| 409 | basic_ostream<charT, traits>& | |
| 410 | operator<<(basic_ostream<charT, traits>& os, const month_day& md); | |
| 394 | 411 | |
| 395 | 412 | // 25.8.10, class month_day_last // C++20 |
| 396 | 413 | class month_day_last; |
| 397 | 414 | |
| 398 | 415 | constexpr bool operator==(const month_day_last& x, const month_day_last& y) noexcept; |
| 399 | constexpr bool operator!=(const month_day_last& x, const month_day_last& y) noexcept; | |
| 400 | constexpr bool operator< (const month_day_last& x, const month_day_last& y) noexcept; | |
| 401 | constexpr bool operator> (const month_day_last& x, const month_day_last& y) noexcept; | |
| 402 | constexpr bool operator<=(const month_day_last& x, const month_day_last& y) noexcept; | |
| 403 | constexpr bool operator>=(const month_day_last& x, const month_day_last& y) noexcept; | |
| 416 | constexpr strong_ordering operator<=>(const month_day_last& x, const month_day_last& y) noexcept; | |
| 417 | ||
| 418 | template<class charT, class traits> | |
| 419 | basic_ostream<charT, traits>& | |
| 420 | operator<<(basic_ostream<charT, traits>& os, const month_day_last& mdl); | |
| 404 | 421 | |
| 405 | 422 | // 25.8.11, class month_weekday // C++20 |
| 406 | 423 | class month_weekday; |
| ... | ... | @@ -408,22 +425,26 @@ class month_weekday; |
| 408 | 425 | constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept; |
| 409 | 426 | constexpr bool operator!=(const month_weekday& x, const month_weekday& y) noexcept; |
| 410 | 427 | |
| 428 | template<class charT, class traits> | |
| 429 | basic_ostream<charT, traits>& | |
| 430 | operator<<(basic_ostream<charT, traits>& os, const month_weekday& mwd); | |
| 431 | ||
| 411 | 432 | // 25.8.12, class month_weekday_last // C++20 |
| 412 | 433 | class month_weekday_last; |
| 413 | 434 | |
| 414 | 435 | constexpr bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept; |
| 415 | 436 | constexpr bool operator!=(const month_weekday_last& x, const month_weekday_last& y) noexcept; |
| 416 | 437 | |
| 438 | template<class charT, class traits> | |
| 439 | basic_ostream<charT, traits>& | |
| 440 | operator<<(basic_ostream<charT, traits>& os, const month_weekday_last& mwdl); | |
| 441 | ||
| 417 | 442 | |
| 418 | 443 | // 25.8.13, class year_month // C++20 |
| 419 | 444 | class year_month; |
| 420 | 445 | |
| 421 | 446 | constexpr bool operator==(const year_month& x, const year_month& y) noexcept; |
| 422 | constexpr bool operator!=(const year_month& x, const year_month& y) noexcept; | |
| 423 | constexpr bool operator< (const year_month& x, const year_month& y) noexcept; | |
| 424 | constexpr bool operator> (const year_month& x, const year_month& y) noexcept; | |
| 425 | constexpr bool operator<=(const year_month& x, const year_month& y) noexcept; | |
| 426 | constexpr bool operator>=(const year_month& x, const year_month& y) noexcept; | |
| 447 | constexpr strong_ordering operator<=>(const year_month& x, const year_month& y) noexcept; | |
| 427 | 448 | |
| 428 | 449 | constexpr year_month operator+(const year_month& ym, const months& dm) noexcept; |
| 429 | 450 | constexpr year_month operator+(const months& dm, const year_month& ym) noexcept; |
| ... | ... | @@ -433,15 +454,15 @@ constexpr year_month operator+(const year_month& ym, const years& dy) noexcept; |
| 433 | 454 | constexpr year_month operator+(const years& dy, const year_month& ym) noexcept; |
| 434 | 455 | constexpr year_month operator-(const year_month& ym, const years& dy) noexcept; |
| 435 | 456 | |
| 457 | template<class charT, class traits> | |
| 458 | basic_ostream<charT, traits>& | |
| 459 | operator<<(basic_ostream<charT, traits>& os, const year_month& ym); | |
| 460 | ||
| 436 | 461 | // 25.8.14, class year_month_day class // C++20 |
| 437 | 462 | year_month_day; |
| 438 | 463 | |
| 439 | 464 | constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept; |
| 440 | constexpr bool operator!=(const year_month_day& x, const year_month_day& y) noexcept; | |
| 441 | constexpr bool operator< (const year_month_day& x, const year_month_day& y) noexcept; | |
| 442 | constexpr bool operator> (const year_month_day& x, const year_month_day& y) noexcept; | |
| 443 | constexpr bool operator<=(const year_month_day& x, const year_month_day& y) noexcept; | |
| 444 | constexpr bool operator>=(const year_month_day& x, const year_month_day& y) noexcept; | |
| 465 | constexpr strong_ordering operator<=>(const year_month_day& x, const year_month_day& y) noexcept; | |
| 445 | 466 | |
| 446 | 467 | constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept; |
| 447 | 468 | constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept; |
| ... | ... | @@ -450,22 +471,15 @@ constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) n |
| 450 | 471 | constexpr year_month_day operator-(const year_month_day& ymd, const months& dm) noexcept; |
| 451 | 472 | constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept; |
| 452 | 473 | |
| 474 | template<class charT, class traits> | |
| 475 | basic_ostream<charT, traits>& | |
| 476 | operator<<(basic_ostream<charT, traits>& os, const year_month_day& ymd); | |
| 453 | 477 | |
| 454 | 478 | // 25.8.15, class year_month_day_last // C++20 |
| 455 | 479 | class year_month_day_last; |
| 456 | 480 | |
| 457 | constexpr bool operator==(const year_month_day_last& x, | |
| 458 | const year_month_day_last& y) noexcept; | |
| 459 | constexpr bool operator!=(const year_month_day_last& x, | |
| 460 | const year_month_day_last& y) noexcept; | |
| 461 | constexpr bool operator< (const year_month_day_last& x, | |
| 462 | const year_month_day_last& y) noexcept; | |
| 463 | constexpr bool operator> (const year_month_day_last& x, | |
| 464 | const year_month_day_last& y) noexcept; | |
| 465 | constexpr bool operator<=(const year_month_day_last& x, | |
| 466 | const year_month_day_last& y) noexcept; | |
| 467 | constexpr bool operator>=(const year_month_day_last& x, | |
| 468 | const year_month_day_last& y) noexcept; | |
| 481 | constexpr bool operator==(const year_month_day_last& x, const year_month_day_last& y) noexcept; | |
| 482 | constexpr strong_ordering operator<=>(const year_month_day_last_day& x, const year_month_day_last_day& y) noexcept; | |
| 469 | 483 | |
| 470 | 484 | constexpr year_month_day_last |
| 471 | 485 | operator+(const year_month_day_last& ymdl, const months& dm) noexcept; |
| ... | ... | @@ -480,6 +494,10 @@ constexpr year_month_day_last |
| 480 | 494 | constexpr year_month_day_last |
| 481 | 495 | operator-(const year_month_day_last& ymdl, const years& dy) noexcept; |
| 482 | 496 | |
| 497 | template<class charT, class traits> | |
| 498 | basic_ostream<charT, traits>& | |
| 499 | operator<<(basic_ostream<charT, traits>& os, const year_month_day_last& ymdl); | |
| 500 | ||
| 483 | 501 | // 25.8.16, class year_month_weekday // C++20 |
| 484 | 502 | class year_month_weekday; |
| 485 | 503 | |
| ... | ... | @@ -501,6 +519,10 @@ constexpr year_month_weekday |
| 501 | 519 | constexpr year_month_weekday |
| 502 | 520 | operator-(const year_month_weekday& ymwd, const years& dy) noexcept; |
| 503 | 521 | |
| 522 | template<class charT, class traits> | |
| 523 | basic_ostream<charT, traits>& | |
| 524 | operator<<(basic_ostream<charT, traits>& os, const year_month_weekday& ymwd); | |
| 525 | ||
| 504 | 526 | // 25.8.17, class year_month_weekday_last // C++20 |
| 505 | 527 | class year_month_weekday_last; |
| 506 | 528 | |
| ... | ... | @@ -521,6 +543,10 @@ constexpr year_month_weekday_last |
| 521 | 543 | constexpr year_month_weekday_last |
| 522 | 544 | operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept; |
| 523 | 545 | |
| 546 | template<class charT, class traits> | |
| 547 | basic_ostream<charT, traits>& | |
| 548 | operator<<(basic_ostream<charT, traits>& os, const year_month_weekday_last& ymwdl); | |
| 549 | ||
| 524 | 550 | // 25.8.18, civil calendar conventional syntax operators // C++20 |
| 525 | 551 | constexpr year_month |
| 526 | 552 | operator/(const year& y, const month& m) noexcept; |
| ... | ... | @@ -645,7 +671,29 @@ bool operator<(const time_zone& x, const time_zone& y) noexcept; |
| 645 | 671 | bool operator>(const time_zone& x, const time_zone& y) noexcept; |
| 646 | 672 | bool operator<=(const time_zone& x, const time_zone& y) noexcept; |
| 647 | 673 | bool operator>=(const time_zone& x, const time_zone& y) noexcept; |
| 674 | } // chrono | |
| 675 | ||
| 676 | namespace std { | |
| 677 | template<class Rep, class Period, class charT> | |
| 678 | struct formatter<chrono::duration<Rep, Period>, charT>; // C++20 | |
| 679 | template<class charT> struct formatter<chrono::day, charT>; // C++20 | |
| 680 | template<class charT> struct formatter<chrono::month, charT>; // C++20 | |
| 681 | template<class charT> struct formatter<chrono::year, charT>; // C++20 | |
| 682 | template<class charT> struct formatter<chrono::weekday, charT>; // C++20 | |
| 683 | template<class charT> struct formatter<chrono::weekday_indexed, charT>; // C++20 | |
| 684 | template<class charT> struct formatter<chrono::weekday_last, charT>; // C++20 | |
| 685 | template<class charT> struct formatter<chrono::month_day, charT>; // C++20 | |
| 686 | template<class charT> struct formatter<chrono::month_day_last, charT>; // C++20 | |
| 687 | template<class charT> struct formatter<chrono::month_weekday, charT>; // C++20 | |
| 688 | template<class charT> struct formatter<chrono::month_weekday_last, charT>; // C++20 | |
| 689 | template<class charT> struct formatter<chrono::year_month, charT>; // C++20 | |
| 690 | template<class charT> struct formatter<chrono::year_month_day, charT>; // C++20 | |
| 691 | template<class charT> struct formatter<chrono::year_month_day_last, charT>; // C++20 | |
| 692 | template<class charT> struct formatter<chrono::year_month_weekday, charT>; // C++20 | |
| 693 | template<class charT> struct formatter<chrono::year_month_weekday_last, charT>; // C++20 | |
| 694 | } // namespace std | |
| 648 | 695 | |
| 696 | namespace chrono { | |
| 649 | 697 | // calendrical constants |
| 650 | 698 | inline constexpr last_spec last{}; // C++20 |
| 651 | 699 | inline constexpr chrono::weekday Sunday{0}; // C++20 |
| ... | ... | @@ -695,6 +743,7 @@ constexpr chrono::year operator ""y(unsigned lo |
| 695 | 743 | #include <__assert> // all public C++ headers provide the assertion handler |
| 696 | 744 | #include <__chrono/calendar.h> |
| 697 | 745 | #include <__chrono/convert_to_timespec.h> |
| 746 | #include <__chrono/convert_to_tm.h> | |
| 698 | 747 | #include <__chrono/day.h> |
| 699 | 748 | #include <__chrono/duration.h> |
| 700 | 749 | #include <__chrono/file_clock.h> |
| ... | ... | @@ -716,10 +765,24 @@ constexpr chrono::year operator ""y(unsigned lo |
| 716 | 765 | #include <version> |
| 717 | 766 | |
| 718 | 767 | // standard-mandated includes |
| 768 | ||
| 769 | // [time.syn] | |
| 719 | 770 | #include <compare> |
| 720 | 771 | |
| 772 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) && _LIBCPP_STD_VER > 17 | |
| 773 | # include <__chrono/formatter.h> | |
| 774 | # include <__chrono/ostream.h> | |
| 775 | # include <__chrono/parser_std_format_spec.h> | |
| 776 | # include <__chrono/statically_widen.h> | |
| 777 | #endif | |
| 778 | ||
| 779 | ||
| 721 | 780 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 722 | 781 | # pragma GCC system_header |
| 723 | 782 | #endif |
| 724 | 783 | |
| 784 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 785 | # include <concepts> | |
| 786 | #endif | |
| 787 | ||
| 725 | 788 | #endif // _LIBCPP_CHRONO |
lib/libcxx/include/cinttypes+13| ... | ... | @@ -236,9 +236,22 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int |
| 236 | 236 | |
| 237 | 237 | #include <__assert> // all public C++ headers provide the assertion handler |
| 238 | 238 | #include <__config> |
| 239 | ||
| 240 | // standard-mandated includes | |
| 241 | ||
| 242 | // [cinttypes.syn] | |
| 239 | 243 | #include <cstdint> |
| 244 | ||
| 240 | 245 | #include <inttypes.h> |
| 241 | 246 | |
| 247 | #ifndef _LIBCPP_INTTYPES_H | |
| 248 | # error <cinttypes> tried including <inttypes.h> but didn't find libc++'s <inttypes.h> header. \ | |
| 249 | This usually means that your header search paths are not configured properly. \ | |
| 250 | The header search paths should contain the C++ Standard Library headers before \ | |
| 251 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 252 | not be the case. | |
| 253 | #endif | |
| 254 | ||
| 242 | 255 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 243 | 256 | # pragma GCC system_header |
| 244 | 257 | #endif |
lib/libcxx/include/climits+9| ... | ... | @@ -39,8 +39,17 @@ Macros: |
| 39 | 39 | |
| 40 | 40 | #include <__assert> // all public C++ headers provide the assertion handler |
| 41 | 41 | #include <__config> |
| 42 | ||
| 42 | 43 | #include <limits.h> |
| 43 | 44 | |
| 45 | #ifndef _LIBCPP_LIMITS_H | |
| 46 | # error <climits> tried including <limits.h> but didn't find libc++'s <limits.h> header. \ | |
| 47 | This usually means that your header search paths are not configured properly. \ | |
| 48 | The header search paths should contain the C++ Standard Library headers before \ | |
| 49 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 50 | not be the case. | |
| 51 | #endif | |
| 52 | ||
| 44 | 53 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 45 | 54 | # pragma GCC system_header |
| 46 | 55 | #endif |
lib/libcxx/include/clocale+9| ... | ... | @@ -36,8 +36,17 @@ lconv* localeconv(); |
| 36 | 36 | |
| 37 | 37 | #include <__assert> // all public C++ headers provide the assertion handler |
| 38 | 38 | #include <__config> |
| 39 | ||
| 39 | 40 | #include <locale.h> |
| 40 | 41 | |
| 42 | #ifndef _LIBCPP_LOCALE_H | |
| 43 | # error <clocale> tried including <locale.h> but didn't find libc++'s <locale.h> header. \ | |
| 44 | This usually means that your header search paths are not configured properly. \ | |
| 45 | The header search paths should contain the C++ Standard Library headers before \ | |
| 46 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 47 | not be the case. | |
| 48 | #endif | |
| 49 | ||
| 41 | 50 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 42 | 51 | # pragma GCC system_header |
| 43 | 52 | #endif |
lib/libcxx/include/cmath+190-17| ... | ... | @@ -306,10 +306,24 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept |
| 306 | 306 | |
| 307 | 307 | #include <__assert> // all public C++ headers provide the assertion handler |
| 308 | 308 | #include <__config> |
| 309 | #include <math.h> | |
| 310 | #include <type_traits> | |
| 309 | #include <__type_traits/enable_if.h> | |
| 310 | #include <__type_traits/is_arithmetic.h> | |
| 311 | #include <__type_traits/is_constant_evaluated.h> | |
| 312 | #include <__type_traits/is_floating_point.h> | |
| 313 | #include <__type_traits/is_same.h> | |
| 314 | #include <__type_traits/remove_cv.h> | |
| 311 | 315 | #include <version> |
| 312 | 316 | |
| 317 | #include <math.h> | |
| 318 | ||
| 319 | #ifndef _LIBCPP_MATH_H | |
| 320 | # error <cmath> tried including <math.h> but didn't find libc++'s <math.h> header. \ | |
| 321 | This usually means that your header search paths are not configured properly. \ | |
| 322 | The header search paths should contain the C++ Standard Library headers before \ | |
| 323 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 324 | not be the case. | |
| 325 | #endif | |
| 326 | ||
| 313 | 327 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 314 | 328 | # pragma GCC system_header |
| 315 | 329 | #endif |
| ... | ... | @@ -549,14 +563,14 @@ hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT |
| 549 | 563 | static_assert((!(is_same<_A1, __result_type>::value && |
| 550 | 564 | is_same<_A2, __result_type>::value && |
| 551 | 565 | is_same<_A3, __result_type>::value)), ""); |
| 552 | return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); | |
| 566 | return std::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); | |
| 553 | 567 | } |
| 554 | 568 | #endif |
| 555 | 569 | |
| 556 | 570 | template <class _A1> |
| 557 | 571 | _LIBCPP_INLINE_VISIBILITY |
| 558 | 572 | _LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type |
| 559 | __libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT | |
| 573 | __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT | |
| 560 | 574 | { |
| 561 | 575 | #if __has_builtin(__builtin_isnan) |
| 562 | 576 | return __builtin_isnan(__lcpp_x); |
| ... | ... | @@ -568,15 +582,15 @@ __libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT |
| 568 | 582 | template <class _A1> |
| 569 | 583 | _LIBCPP_INLINE_VISIBILITY |
| 570 | 584 | _LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type |
| 571 | __libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT | |
| 585 | __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT | |
| 572 | 586 | { |
| 573 | return isnan(__lcpp_x); | |
| 587 | return std::isnan(__lcpp_x); | |
| 574 | 588 | } |
| 575 | 589 | |
| 576 | 590 | template <class _A1> |
| 577 | 591 | _LIBCPP_INLINE_VISIBILITY |
| 578 | 592 | _LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type |
| 579 | __libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT | |
| 593 | __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT | |
| 580 | 594 | { |
| 581 | 595 | #if __has_builtin(__builtin_isinf) |
| 582 | 596 | return __builtin_isinf(__lcpp_x); |
| ... | ... | @@ -588,15 +602,15 @@ __libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT |
| 588 | 602 | template <class _A1> |
| 589 | 603 | _LIBCPP_INLINE_VISIBILITY |
| 590 | 604 | _LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type |
| 591 | __libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT | |
| 605 | __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT | |
| 592 | 606 | { |
| 593 | return isinf(__lcpp_x); | |
| 607 | return std::isinf(__lcpp_x); | |
| 594 | 608 | } |
| 595 | 609 | |
| 596 | 610 | template <class _A1> |
| 597 | 611 | _LIBCPP_INLINE_VISIBILITY |
| 598 | 612 | _LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type |
| 599 | __libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT | |
| 613 | __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT | |
| 600 | 614 | { |
| 601 | 615 | #if __has_builtin(__builtin_isfinite) |
| 602 | 616 | return __builtin_isfinite(__lcpp_x); |
| ... | ... | @@ -608,14 +622,169 @@ __libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT |
| 608 | 622 | template <class _A1> |
| 609 | 623 | _LIBCPP_INLINE_VISIBILITY |
| 610 | 624 | _LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type |
| 611 | __libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT | |
| 625 | __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT | |
| 612 | 626 | { |
| 613 | return isfinite(__lcpp_x); | |
| 627 | return __builtin_isfinite(__lcpp_x); | |
| 628 | } | |
| 629 | ||
| 630 | _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI float __constexpr_copysign(float __x, float __y) _NOEXCEPT { | |
| 631 | return __builtin_copysignf(__x, __y); | |
| 632 | } | |
| 633 | ||
| 634 | _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI double __constexpr_copysign(double __x, double __y) _NOEXCEPT { | |
| 635 | return __builtin_copysign(__x, __y); | |
| 636 | } | |
| 637 | ||
| 638 | _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI long double | |
| 639 | __constexpr_copysign(long double __x, long double __y) _NOEXCEPT { | |
| 640 | return __builtin_copysignl(__x, __y); | |
| 641 | } | |
| 642 | ||
| 643 | template <class _A1, class _A2> | |
| 644 | _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI | |
| 645 | typename std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, | |
| 646 | std::__promote<_A1, _A2> >::type | |
| 647 | __constexpr_copysign(_A1 __x, _A2 __y) _NOEXCEPT { | |
| 648 | typedef typename std::__promote<_A1, _A2>::type __result_type; | |
| 649 | static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); | |
| 650 | return __builtin_copysign((__result_type)__x, (__result_type)__y); | |
| 651 | } | |
| 652 | ||
| 653 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float __constexpr_fabs(float __x) _NOEXCEPT { | |
| 654 | return __builtin_fabsf(__x); | |
| 655 | } | |
| 656 | ||
| 657 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double __constexpr_fabs(double __x) _NOEXCEPT { | |
| 658 | return __builtin_fabs(__x); | |
| 659 | } | |
| 660 | ||
| 661 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double __constexpr_fabs(long double __x) _NOEXCEPT { | |
| 662 | return __builtin_fabsl(__x); | |
| 663 | } | |
| 664 | ||
| 665 | template <class _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0> | |
| 666 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double __constexpr_fabs(_Tp __x) _NOEXCEPT { | |
| 667 | return __builtin_fabs(static_cast<double>(__x)); | |
| 668 | } | |
| 669 | ||
| 670 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 float __constexpr_fmax(float __x, float __y) _NOEXCEPT { | |
| 671 | #if !__has_constexpr_builtin(__builtin_fmaxf) | |
| 672 | if (__libcpp_is_constant_evaluated()) { | |
| 673 | if (std::__constexpr_isnan(__x)) | |
| 674 | return __y; | |
| 675 | if (std::__constexpr_isnan(__y)) | |
| 676 | return __x; | |
| 677 | return __x < __y ? __y : __x; | |
| 678 | } | |
| 679 | #endif | |
| 680 | return __builtin_fmaxf(__x, __y); | |
| 681 | } | |
| 682 | ||
| 683 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 double __constexpr_fmax(double __x, double __y) _NOEXCEPT { | |
| 684 | #if !__has_constexpr_builtin(__builtin_fmax) | |
| 685 | if (__libcpp_is_constant_evaluated()) { | |
| 686 | if (std::__constexpr_isnan(__x)) | |
| 687 | return __y; | |
| 688 | if (std::__constexpr_isnan(__y)) | |
| 689 | return __x; | |
| 690 | return __x < __y ? __y : __x; | |
| 691 | } | |
| 692 | #endif | |
| 693 | return __builtin_fmax(__x, __y); | |
| 694 | } | |
| 695 | ||
| 696 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 long double | |
| 697 | __constexpr_fmax(long double __x, long double __y) _NOEXCEPT { | |
| 698 | #if !__has_constexpr_builtin(__builtin_fmaxl) | |
| 699 | if (__libcpp_is_constant_evaluated()) { | |
| 700 | if (std::__constexpr_isnan(__x)) | |
| 701 | return __y; | |
| 702 | if (std::__constexpr_isnan(__y)) | |
| 703 | return __x; | |
| 704 | return __x < __y ? __y : __x; | |
| 705 | } | |
| 706 | #endif | |
| 707 | return __builtin_fmaxl(__x, __y); | |
| 708 | } | |
| 709 | ||
| 710 | template <class _Tp, class _Up, __enable_if_t<is_arithmetic<_Tp>::value && is_arithmetic<_Up>::value, int> = 0> | |
| 711 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __promote<_Tp, _Up>::type | |
| 712 | __constexpr_fmax(_Tp __x, _Up __y) _NOEXCEPT { | |
| 713 | using __result_type = typename __promote<_Tp, _Up>::type; | |
| 714 | return std::__constexpr_fmax(static_cast<__result_type>(__x), static_cast<__result_type>(__y)); | |
| 715 | } | |
| 716 | ||
| 717 | template <class _Tp> | |
| 718 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __constexpr_logb(_Tp __x) { | |
| 719 | #if !__has_constexpr_builtin(__builtin_logb) | |
| 720 | if (__libcpp_is_constant_evaluated()) { | |
| 721 | if (__x == _Tp(0)) { | |
| 722 | // raise FE_DIVBYZERO | |
| 723 | return -numeric_limits<_Tp>::infinity(); | |
| 724 | } | |
| 725 | ||
| 726 | if (std::__constexpr_isinf(__x)) | |
| 727 | return numeric_limits<_Tp>::infinity(); | |
| 728 | ||
| 729 | if (std::__constexpr_isnan(__x)) | |
| 730 | return numeric_limits<_Tp>::quiet_NaN(); | |
| 731 | ||
| 732 | __x = std::__constexpr_fabs(__x); | |
| 733 | unsigned long long __exp = 0; | |
| 734 | while (__x >= numeric_limits<_Tp>::radix) { | |
| 735 | __x /= numeric_limits<_Tp>::radix; | |
| 736 | __exp += 1; | |
| 737 | } | |
| 738 | return _Tp(__exp); | |
| 739 | } | |
| 740 | #endif // !__has_constexpr_builtin(__builtin_logb) | |
| 741 | return __builtin_logb(__x); | |
| 742 | } | |
| 743 | ||
| 744 | template <class _Tp> | |
| 745 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp __constexpr_scalbn(_Tp __x, int __exp) { | |
| 746 | #if !__has_constexpr_builtin(__builtin_scalbln) | |
| 747 | if (__libcpp_is_constant_evaluated()) { | |
| 748 | if (__x == _Tp(0)) | |
| 749 | return __x; | |
| 750 | ||
| 751 | if (std::__constexpr_isinf(__x)) | |
| 752 | return __x; | |
| 753 | ||
| 754 | if (__exp == _Tp(0)) | |
| 755 | return __x; | |
| 756 | ||
| 757 | if (std::__constexpr_isnan(__x)) | |
| 758 | return numeric_limits<_Tp>::quiet_NaN(); | |
| 759 | ||
| 760 | _Tp __mult(1); | |
| 761 | if (__exp > 0) { | |
| 762 | __mult = numeric_limits<_Tp>::radix; | |
| 763 | --__exp; | |
| 764 | } else { | |
| 765 | ++__exp; | |
| 766 | __exp = -__exp; | |
| 767 | __mult /= numeric_limits<_Tp>::radix; | |
| 768 | } | |
| 769 | ||
| 770 | while (__exp > 0) { | |
| 771 | if (!(__exp & 1)) { | |
| 772 | __mult *= __mult; | |
| 773 | __exp >>= 1; | |
| 774 | } else { | |
| 775 | __x *= __mult; | |
| 776 | --__exp; | |
| 777 | } | |
| 778 | } | |
| 779 | return __x; | |
| 780 | } | |
| 781 | #endif // !__has_constexpr_builtin(__builtin_scalbln) | |
| 782 | return __builtin_scalbn(__x, __exp); | |
| 614 | 783 | } |
| 615 | 784 | |
| 616 | 785 | #if _LIBCPP_STD_VER > 17 |
| 617 | 786 | template <typename _Fp> |
| 618 | constexpr | |
| 787 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 619 | 788 | _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept { |
| 620 | 789 | if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0)) |
| 621 | 790 | return __t * __b + (1 - __t) * __a; |
| ... | ... | @@ -628,13 +797,13 @@ _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept { |
| 628 | 797 | return __x < __b ? __x : __b; |
| 629 | 798 | } |
| 630 | 799 | |
| 631 | constexpr float | |
| 800 | _LIBCPP_HIDE_FROM_ABI constexpr float | |
| 632 | 801 | lerp(float __a, float __b, float __t) _NOEXCEPT { return __lerp(__a, __b, __t); } |
| 633 | 802 | |
| 634 | constexpr double | |
| 803 | _LIBCPP_HIDE_FROM_ABI constexpr double | |
| 635 | 804 | lerp(double __a, double __b, double __t) _NOEXCEPT { return __lerp(__a, __b, __t); } |
| 636 | 805 | |
| 637 | constexpr long double | |
| 806 | _LIBCPP_HIDE_FROM_ABI constexpr long double | |
| 638 | 807 | lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __lerp(__a, __b, __t); } |
| 639 | 808 | |
| 640 | 809 | template <class _A1, class _A2, class _A3> |
| ... | ... | @@ -652,7 +821,7 @@ lerp(_A1 __a, _A2 __b, _A3 __t) noexcept |
| 652 | 821 | static_assert(!(_IsSame<_A1, __result_type>::value && |
| 653 | 822 | _IsSame<_A2, __result_type>::value && |
| 654 | 823 | _IsSame<_A3, __result_type>::value)); |
| 655 | return __lerp((__result_type)__a, (__result_type)__b, (__result_type)__t); | |
| 824 | return std::__lerp((__result_type)__a, (__result_type)__b, (__result_type)__t); | |
| 656 | 825 | } |
| 657 | 826 | #endif // _LIBCPP_STD_VER > 17 |
| 658 | 827 | |
| ... | ... | @@ -660,4 +829,8 @@ _LIBCPP_END_NAMESPACE_STD |
| 660 | 829 | |
| 661 | 830 | _LIBCPP_POP_MACROS |
| 662 | 831 | |
| 832 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 833 | # include <type_traits> | |
| 834 | #endif | |
| 835 | ||
| 663 | 836 | #endif // _LIBCPP_CMATH |
lib/libcxx/include/codecvt+208-240| ... | ... | @@ -81,9 +81,9 @@ template <> |
| 81 | 81 | class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t> |
| 82 | 82 | : public codecvt<wchar_t, char, mbstate_t> |
| 83 | 83 | { |
| 84 | unsigned long _Maxcode_; | |
| 84 | unsigned long __maxcode_; | |
| 85 | 85 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 86 | codecvt_mode _Mode_; | |
| 86 | codecvt_mode __mode_; | |
| 87 | 87 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 88 | 88 | public: |
| 89 | 89 | typedef wchar_t intern_type; |
| ... | ... | @@ -94,26 +94,22 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 94 | 94 | _LIBCPP_INLINE_VISIBILITY |
| 95 | 95 | explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, |
| 96 | 96 | codecvt_mode __mode) |
| 97 | : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 98 | _Mode_(__mode) {} | |
| 97 | : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 98 | __mode_(__mode) {} | |
| 99 | 99 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 100 | 100 | protected: |
| 101 | virtual result | |
| 102 | do_out(state_type& __st, | |
| 103 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 104 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 105 | virtual result | |
| 106 | do_in(state_type& __st, | |
| 107 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 108 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 109 | virtual result | |
| 110 | do_unshift(state_type& __st, | |
| 111 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 112 | virtual int do_encoding() const _NOEXCEPT; | |
| 113 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 114 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 115 | size_t __mx) const; | |
| 116 | virtual int do_max_length() const _NOEXCEPT; | |
| 101 | result do_out(state_type& __st, | |
| 102 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 103 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 104 | result do_in(state_type& __st, | |
| 105 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 106 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 107 | result do_unshift(state_type& __st, | |
| 108 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 109 | int do_encoding() const _NOEXCEPT override; | |
| 110 | bool do_always_noconv() const _NOEXCEPT override; | |
| 111 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; | |
| 112 | int do_max_length() const _NOEXCEPT override; | |
| 117 | 113 | }; |
| 118 | 114 | #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 119 | 115 | |
| ... | ... | @@ -122,8 +118,8 @@ template <> |
| 122 | 118 | class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t> |
| 123 | 119 | : public codecvt<char16_t, char, mbstate_t> |
| 124 | 120 | { |
| 125 | unsigned long _Maxcode_; | |
| 126 | codecvt_mode _Mode_; | |
| 121 | unsigned long __maxcode_; | |
| 122 | codecvt_mode __mode_; | |
| 127 | 123 | public: |
| 128 | 124 | typedef char16_t intern_type; |
| 129 | 125 | typedef char extern_type; |
| ... | ... | @@ -132,27 +128,23 @@ public: |
| 132 | 128 | _LIBCPP_INLINE_VISIBILITY |
| 133 | 129 | explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, |
| 134 | 130 | codecvt_mode __mode) |
| 135 | : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 136 | _Mode_(__mode) {} | |
| 131 | : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 132 | __mode_(__mode) {} | |
| 137 | 133 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 138 | 134 | |
| 139 | 135 | protected: |
| 140 | virtual result | |
| 141 | do_out(state_type& __st, | |
| 142 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 143 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 144 | virtual result | |
| 145 | do_in(state_type& __st, | |
| 146 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 147 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 148 | virtual result | |
| 149 | do_unshift(state_type& __st, | |
| 150 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 151 | virtual int do_encoding() const _NOEXCEPT; | |
| 152 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 153 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 154 | size_t __mx) const; | |
| 155 | virtual int do_max_length() const _NOEXCEPT; | |
| 136 | result do_out(state_type& __st, | |
| 137 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 138 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 139 | result do_in(state_type& __st, | |
| 140 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 141 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 142 | result do_unshift(state_type& __st, | |
| 143 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 144 | int do_encoding() const _NOEXCEPT override; | |
| 145 | bool do_always_noconv() const _NOEXCEPT override; | |
| 146 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; | |
| 147 | int do_max_length() const _NOEXCEPT override; | |
| 156 | 148 | }; |
| 157 | 149 | |
| 158 | 150 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| ... | ... | @@ -160,8 +152,8 @@ template <> |
| 160 | 152 | class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t> |
| 161 | 153 | : public codecvt<char32_t, char, mbstate_t> |
| 162 | 154 | { |
| 163 | unsigned long _Maxcode_; | |
| 164 | codecvt_mode _Mode_; | |
| 155 | unsigned long __maxcode_; | |
| 156 | codecvt_mode __mode_; | |
| 165 | 157 | public: |
| 166 | 158 | typedef char32_t intern_type; |
| 167 | 159 | typedef char extern_type; |
| ... | ... | @@ -170,27 +162,23 @@ public: |
| 170 | 162 | _LIBCPP_INLINE_VISIBILITY |
| 171 | 163 | explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, |
| 172 | 164 | codecvt_mode __mode) |
| 173 | : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 174 | _Mode_(__mode) {} | |
| 165 | : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 166 | __mode_(__mode) {} | |
| 175 | 167 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 176 | 168 | |
| 177 | 169 | protected: |
| 178 | virtual result | |
| 179 | do_out(state_type& __st, | |
| 180 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 181 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 182 | virtual result | |
| 183 | do_in(state_type& __st, | |
| 184 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 185 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 186 | virtual result | |
| 187 | do_unshift(state_type& __st, | |
| 188 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 189 | virtual int do_encoding() const _NOEXCEPT; | |
| 190 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 191 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 192 | size_t __mx) const; | |
| 193 | virtual int do_max_length() const _NOEXCEPT; | |
| 170 | result do_out(state_type& __st, | |
| 171 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 172 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 173 | result do_in(state_type& __st, | |
| 174 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 175 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 176 | result do_unshift(state_type& __st, | |
| 177 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 178 | int do_encoding() const _NOEXCEPT override; | |
| 179 | bool do_always_noconv() const _NOEXCEPT override; | |
| 180 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; | |
| 181 | int do_max_length() const _NOEXCEPT override; | |
| 194 | 182 | }; |
| 195 | 183 | |
| 196 | 184 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| ... | ... | @@ -218,9 +206,9 @@ template <> |
| 218 | 206 | class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false> |
| 219 | 207 | : public codecvt<wchar_t, char, mbstate_t> |
| 220 | 208 | { |
| 221 | unsigned long _Maxcode_; | |
| 209 | unsigned long __maxcode_; | |
| 222 | 210 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 223 | codecvt_mode _Mode_; | |
| 211 | codecvt_mode __mode_; | |
| 224 | 212 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 225 | 213 | public: |
| 226 | 214 | typedef wchar_t intern_type; |
| ... | ... | @@ -231,35 +219,32 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 231 | 219 | _LIBCPP_INLINE_VISIBILITY |
| 232 | 220 | explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, |
| 233 | 221 | codecvt_mode __mode) |
| 234 | : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 235 | _Mode_(__mode) {} | |
| 222 | : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 223 | __mode_(__mode) {} | |
| 236 | 224 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 237 | 225 | protected: |
| 238 | virtual result | |
| 239 | do_out(state_type& __st, | |
| 240 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 241 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 242 | virtual result | |
| 243 | do_in(state_type& __st, | |
| 244 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 245 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 246 | virtual result | |
| 247 | do_unshift(state_type& __st, | |
| 248 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 249 | virtual int do_encoding() const _NOEXCEPT; | |
| 250 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 251 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 252 | size_t __mx) const; | |
| 253 | virtual int do_max_length() const _NOEXCEPT; | |
| 226 | result do_out(state_type& __st, | |
| 227 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 228 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 229 | result do_in(state_type& __st, | |
| 230 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 231 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 232 | result do_unshift(state_type& __st, | |
| 233 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 234 | int do_encoding() const _NOEXCEPT override; | |
| 235 | bool do_always_noconv() const _NOEXCEPT override; | |
| 236 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 237 | size_t __mx) const override; | |
| 238 | int do_max_length() const _NOEXCEPT override; | |
| 254 | 239 | }; |
| 255 | 240 | |
| 256 | 241 | template <> |
| 257 | 242 | class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true> |
| 258 | 243 | : public codecvt<wchar_t, char, mbstate_t> |
| 259 | 244 | { |
| 260 | unsigned long _Maxcode_; | |
| 245 | unsigned long __maxcode_; | |
| 261 | 246 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 262 | codecvt_mode _Mode_; | |
| 247 | codecvt_mode __mode_; | |
| 263 | 248 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 264 | 249 | public: |
| 265 | 250 | typedef wchar_t intern_type; |
| ... | ... | @@ -270,26 +255,22 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 270 | 255 | _LIBCPP_INLINE_VISIBILITY |
| 271 | 256 | explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, |
| 272 | 257 | codecvt_mode __mode) |
| 273 | : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 274 | _Mode_(__mode) {} | |
| 258 | : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 259 | __mode_(__mode) {} | |
| 275 | 260 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 276 | 261 | protected: |
| 277 | virtual result | |
| 278 | do_out(state_type& __st, | |
| 279 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 280 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 281 | virtual result | |
| 282 | do_in(state_type& __st, | |
| 283 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 284 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 285 | virtual result | |
| 286 | do_unshift(state_type& __st, | |
| 287 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 288 | virtual int do_encoding() const _NOEXCEPT; | |
| 289 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 290 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 291 | size_t __mx) const; | |
| 292 | virtual int do_max_length() const _NOEXCEPT; | |
| 262 | result do_out(state_type& __st, | |
| 263 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 264 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 265 | result do_in(state_type& __st, | |
| 266 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 267 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 268 | result do_unshift(state_type& __st, | |
| 269 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 270 | int do_encoding() const _NOEXCEPT override; | |
| 271 | bool do_always_noconv() const _NOEXCEPT override; | |
| 272 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; | |
| 273 | int do_max_length() const _NOEXCEPT override; | |
| 293 | 274 | }; |
| 294 | 275 | #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 295 | 276 | |
| ... | ... | @@ -298,8 +279,8 @@ template <> |
| 298 | 279 | class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false> |
| 299 | 280 | : public codecvt<char16_t, char, mbstate_t> |
| 300 | 281 | { |
| 301 | unsigned long _Maxcode_; | |
| 302 | codecvt_mode _Mode_; | |
| 282 | unsigned long __maxcode_; | |
| 283 | codecvt_mode __mode_; | |
| 303 | 284 | public: |
| 304 | 285 | typedef char16_t intern_type; |
| 305 | 286 | typedef char extern_type; |
| ... | ... | @@ -308,27 +289,23 @@ public: |
| 308 | 289 | _LIBCPP_INLINE_VISIBILITY |
| 309 | 290 | explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, |
| 310 | 291 | codecvt_mode __mode) |
| 311 | : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 312 | _Mode_(__mode) {} | |
| 292 | : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 293 | __mode_(__mode) {} | |
| 313 | 294 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 314 | 295 | |
| 315 | 296 | protected: |
| 316 | virtual result | |
| 317 | do_out(state_type& __st, | |
| 318 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 319 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 320 | virtual result | |
| 321 | do_in(state_type& __st, | |
| 322 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 323 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 324 | virtual result | |
| 325 | do_unshift(state_type& __st, | |
| 326 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 327 | virtual int do_encoding() const _NOEXCEPT; | |
| 328 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 329 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 330 | size_t __mx) const; | |
| 331 | virtual int do_max_length() const _NOEXCEPT; | |
| 297 | result do_out(state_type& __st, | |
| 298 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 299 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 300 | result do_in(state_type& __st, | |
| 301 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 302 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 303 | result do_unshift(state_type& __st, | |
| 304 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 305 | int do_encoding() const _NOEXCEPT override; | |
| 306 | bool do_always_noconv() const _NOEXCEPT override; | |
| 307 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; | |
| 308 | int do_max_length() const _NOEXCEPT override; | |
| 332 | 309 | }; |
| 333 | 310 | |
| 334 | 311 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| ... | ... | @@ -336,8 +313,8 @@ template <> |
| 336 | 313 | class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true> |
| 337 | 314 | : public codecvt<char16_t, char, mbstate_t> |
| 338 | 315 | { |
| 339 | unsigned long _Maxcode_; | |
| 340 | codecvt_mode _Mode_; | |
| 316 | unsigned long __maxcode_; | |
| 317 | codecvt_mode __mode_; | |
| 341 | 318 | public: |
| 342 | 319 | typedef char16_t intern_type; |
| 343 | 320 | typedef char extern_type; |
| ... | ... | @@ -346,27 +323,23 @@ public: |
| 346 | 323 | _LIBCPP_INLINE_VISIBILITY |
| 347 | 324 | explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, |
| 348 | 325 | codecvt_mode __mode) |
| 349 | : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 350 | _Mode_(__mode) {} | |
| 326 | : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 327 | __mode_(__mode) {} | |
| 351 | 328 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 352 | 329 | |
| 353 | 330 | protected: |
| 354 | virtual result | |
| 355 | do_out(state_type& __st, | |
| 356 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 357 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 358 | virtual result | |
| 359 | do_in(state_type& __st, | |
| 360 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 361 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 362 | virtual result | |
| 363 | do_unshift(state_type& __st, | |
| 364 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 365 | virtual int do_encoding() const _NOEXCEPT; | |
| 366 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 367 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 368 | size_t __mx) const; | |
| 369 | virtual int do_max_length() const _NOEXCEPT; | |
| 331 | result do_out(state_type& __st, | |
| 332 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 333 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 334 | result do_in(state_type& __st, | |
| 335 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 336 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 337 | result do_unshift(state_type& __st, | |
| 338 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 339 | int do_encoding() const _NOEXCEPT override; | |
| 340 | bool do_always_noconv() const _NOEXCEPT override; | |
| 341 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; | |
| 342 | int do_max_length() const _NOEXCEPT override; | |
| 370 | 343 | }; |
| 371 | 344 | |
| 372 | 345 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| ... | ... | @@ -374,8 +347,8 @@ template <> |
| 374 | 347 | class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false> |
| 375 | 348 | : public codecvt<char32_t, char, mbstate_t> |
| 376 | 349 | { |
| 377 | unsigned long _Maxcode_; | |
| 378 | codecvt_mode _Mode_; | |
| 350 | unsigned long __maxcode_; | |
| 351 | codecvt_mode __mode_; | |
| 379 | 352 | public: |
| 380 | 353 | typedef char32_t intern_type; |
| 381 | 354 | typedef char extern_type; |
| ... | ... | @@ -384,27 +357,23 @@ public: |
| 384 | 357 | _LIBCPP_INLINE_VISIBILITY |
| 385 | 358 | explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, |
| 386 | 359 | codecvt_mode __mode) |
| 387 | : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 388 | _Mode_(__mode) {} | |
| 360 | : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 361 | __mode_(__mode) {} | |
| 389 | 362 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 390 | 363 | |
| 391 | 364 | protected: |
| 392 | virtual result | |
| 393 | do_out(state_type& __st, | |
| 394 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 395 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 396 | virtual result | |
| 397 | do_in(state_type& __st, | |
| 398 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 399 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 400 | virtual result | |
| 401 | do_unshift(state_type& __st, | |
| 402 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 403 | virtual int do_encoding() const _NOEXCEPT; | |
| 404 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 405 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 406 | size_t __mx) const; | |
| 407 | virtual int do_max_length() const _NOEXCEPT; | |
| 365 | result do_out(state_type& __st, | |
| 366 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 367 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 368 | result do_in(state_type& __st, | |
| 369 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 370 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 371 | result do_unshift(state_type& __st, | |
| 372 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 373 | int do_encoding() const _NOEXCEPT override; | |
| 374 | bool do_always_noconv() const _NOEXCEPT override; | |
| 375 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; | |
| 376 | int do_max_length() const _NOEXCEPT override; | |
| 408 | 377 | }; |
| 409 | 378 | |
| 410 | 379 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| ... | ... | @@ -412,8 +381,8 @@ template <> |
| 412 | 381 | class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true> |
| 413 | 382 | : public codecvt<char32_t, char, mbstate_t> |
| 414 | 383 | { |
| 415 | unsigned long _Maxcode_; | |
| 416 | codecvt_mode _Mode_; | |
| 384 | unsigned long __maxcode_; | |
| 385 | codecvt_mode __mode_; | |
| 417 | 386 | public: |
| 418 | 387 | typedef char32_t intern_type; |
| 419 | 388 | typedef char extern_type; |
| ... | ... | @@ -422,27 +391,23 @@ public: |
| 422 | 391 | _LIBCPP_INLINE_VISIBILITY |
| 423 | 392 | explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, |
| 424 | 393 | codecvt_mode __mode) |
| 425 | : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 426 | _Mode_(__mode) {} | |
| 394 | : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 395 | __mode_(__mode) {} | |
| 427 | 396 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 428 | 397 | |
| 429 | 398 | protected: |
| 430 | virtual result | |
| 431 | do_out(state_type& __st, | |
| 432 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 433 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 434 | virtual result | |
| 435 | do_in(state_type& __st, | |
| 436 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 437 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 438 | virtual result | |
| 439 | do_unshift(state_type& __st, | |
| 440 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 441 | virtual int do_encoding() const _NOEXCEPT; | |
| 442 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 443 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 444 | size_t __mx) const; | |
| 445 | virtual int do_max_length() const _NOEXCEPT; | |
| 399 | result do_out(state_type& __st, | |
| 400 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 401 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 402 | result do_in(state_type& __st, | |
| 403 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 404 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 405 | result do_unshift(state_type& __st, | |
| 406 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 407 | int do_encoding() const _NOEXCEPT override; | |
| 408 | bool do_always_noconv() const _NOEXCEPT override; | |
| 409 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; | |
| 410 | int do_max_length() const _NOEXCEPT override; | |
| 446 | 411 | }; |
| 447 | 412 | |
| 448 | 413 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| ... | ... | @@ -470,9 +435,9 @@ template <> |
| 470 | 435 | class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t> |
| 471 | 436 | : public codecvt<wchar_t, char, mbstate_t> |
| 472 | 437 | { |
| 473 | unsigned long _Maxcode_; | |
| 438 | unsigned long __maxcode_; | |
| 474 | 439 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 475 | codecvt_mode _Mode_; | |
| 440 | codecvt_mode __mode_; | |
| 476 | 441 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 477 | 442 | public: |
| 478 | 443 | typedef wchar_t intern_type; |
| ... | ... | @@ -483,26 +448,22 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 483 | 448 | _LIBCPP_INLINE_VISIBILITY |
| 484 | 449 | explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, |
| 485 | 450 | codecvt_mode __mode) |
| 486 | : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 487 | _Mode_(__mode) {} | |
| 451 | : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 452 | __mode_(__mode) {} | |
| 488 | 453 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 489 | 454 | protected: |
| 490 | virtual result | |
| 491 | do_out(state_type& __st, | |
| 492 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 493 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 494 | virtual result | |
| 495 | do_in(state_type& __st, | |
| 496 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 497 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 498 | virtual result | |
| 499 | do_unshift(state_type& __st, | |
| 500 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 501 | virtual int do_encoding() const _NOEXCEPT; | |
| 502 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 503 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 504 | size_t __mx) const; | |
| 505 | virtual int do_max_length() const _NOEXCEPT; | |
| 455 | result do_out(state_type& __st, | |
| 456 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 457 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 458 | result do_in(state_type& __st, | |
| 459 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 460 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 461 | result do_unshift(state_type& __st, | |
| 462 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 463 | int do_encoding() const _NOEXCEPT override; | |
| 464 | bool do_always_noconv() const _NOEXCEPT override; | |
| 465 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; | |
| 466 | int do_max_length() const _NOEXCEPT override; | |
| 506 | 467 | }; |
| 507 | 468 | #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 508 | 469 | |
| ... | ... | @@ -511,8 +472,8 @@ template <> |
| 511 | 472 | class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t> |
| 512 | 473 | : public codecvt<char32_t, char, mbstate_t> |
| 513 | 474 | { |
| 514 | unsigned long _Maxcode_; | |
| 515 | codecvt_mode _Mode_; | |
| 475 | unsigned long __maxcode_; | |
| 476 | codecvt_mode __mode_; | |
| 516 | 477 | public: |
| 517 | 478 | typedef char32_t intern_type; |
| 518 | 479 | typedef char extern_type; |
| ... | ... | @@ -521,27 +482,23 @@ public: |
| 521 | 482 | _LIBCPP_INLINE_VISIBILITY |
| 522 | 483 | explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, |
| 523 | 484 | codecvt_mode __mode) |
| 524 | : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 525 | _Mode_(__mode) {} | |
| 485 | : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 486 | __mode_(__mode) {} | |
| 526 | 487 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 527 | 488 | |
| 528 | 489 | protected: |
| 529 | virtual result | |
| 530 | do_out(state_type& __st, | |
| 531 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 532 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 533 | virtual result | |
| 534 | do_in(state_type& __st, | |
| 535 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 536 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 537 | virtual result | |
| 538 | do_unshift(state_type& __st, | |
| 539 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 540 | virtual int do_encoding() const _NOEXCEPT; | |
| 541 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 542 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 543 | size_t __mx) const; | |
| 544 | virtual int do_max_length() const _NOEXCEPT; | |
| 490 | result do_out(state_type& __st, | |
| 491 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 492 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 493 | result do_in(state_type& __st, | |
| 494 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 495 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 496 | result do_unshift(state_type& __st, | |
| 497 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 498 | int do_encoding() const _NOEXCEPT override; | |
| 499 | bool do_always_noconv() const _NOEXCEPT override; | |
| 500 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; | |
| 501 | int do_max_length() const _NOEXCEPT override; | |
| 545 | 502 | }; |
| 546 | 503 | |
| 547 | 504 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| ... | ... | @@ -549,8 +506,8 @@ template <> |
| 549 | 506 | class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t> |
| 550 | 507 | : public codecvt<char16_t, char, mbstate_t> |
| 551 | 508 | { |
| 552 | unsigned long _Maxcode_; | |
| 553 | codecvt_mode _Mode_; | |
| 509 | unsigned long __maxcode_; | |
| 510 | codecvt_mode __mode_; | |
| 554 | 511 | public: |
| 555 | 512 | typedef char16_t intern_type; |
| 556 | 513 | typedef char extern_type; |
| ... | ... | @@ -559,27 +516,23 @@ public: |
| 559 | 516 | _LIBCPP_INLINE_VISIBILITY |
| 560 | 517 | explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, |
| 561 | 518 | codecvt_mode __mode) |
| 562 | : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(__maxcode), | |
| 563 | _Mode_(__mode) {} | |
| 519 | : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), | |
| 520 | __mode_(__mode) {} | |
| 564 | 521 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 565 | 522 | |
| 566 | 523 | protected: |
| 567 | virtual result | |
| 568 | do_out(state_type& __st, | |
| 569 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 570 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 571 | virtual result | |
| 572 | do_in(state_type& __st, | |
| 573 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 574 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 575 | virtual result | |
| 576 | do_unshift(state_type& __st, | |
| 577 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 578 | virtual int do_encoding() const _NOEXCEPT; | |
| 579 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 580 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, | |
| 581 | size_t __mx) const; | |
| 582 | virtual int do_max_length() const _NOEXCEPT; | |
| 524 | result do_out(state_type& __st, | |
| 525 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 526 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 527 | result do_in(state_type& __st, | |
| 528 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 529 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; | |
| 530 | result do_unshift(state_type& __st, | |
| 531 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; | |
| 532 | int do_encoding() const _NOEXCEPT override; | |
| 533 | bool do_always_noconv() const _NOEXCEPT override; | |
| 534 | int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; | |
| 535 | int do_max_length() const _NOEXCEPT override; | |
| 583 | 536 | }; |
| 584 | 537 | |
| 585 | 538 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| ... | ... | @@ -600,4 +553,19 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 600 | 553 | |
| 601 | 554 | _LIBCPP_END_NAMESPACE_STD |
| 602 | 555 | |
| 556 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 557 | # include <atomic> | |
| 558 | # include <concepts> | |
| 559 | # include <cstddef> | |
| 560 | # include <cstdlib> | |
| 561 | # include <cstring> | |
| 562 | # include <initializer_list> | |
| 563 | # include <iosfwd> | |
| 564 | # include <limits> | |
| 565 | # include <new> | |
| 566 | # include <stdexcept> | |
| 567 | # include <type_traits> | |
| 568 | # include <typeinfo> | |
| 569 | #endif | |
| 570 | ||
| 603 | 571 | #endif // _LIBCPP_CODECVT |
lib/libcxx/include/compare+4| ... | ... | @@ -160,4 +160,8 @@ namespace std { |
| 160 | 160 | # pragma GCC system_header |
| 161 | 161 | #endif |
| 162 | 162 | |
| 163 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 164 | # include <type_traits> | |
| 165 | #endif | |
| 166 | ||
| 163 | 167 | #endif // _LIBCPP_COMPARE |
lib/libcxx/include/complex+422-349| ... | ... | @@ -29,21 +29,21 @@ public: |
| 29 | 29 | T real() const; // constexpr in C++14 |
| 30 | 30 | T imag() const; // constexpr in C++14 |
| 31 | 31 | |
| 32 | void real(T); | |
| 33 | void imag(T); | |
| 34 | ||
| 35 | complex<T>& operator= (const T&); | |
| 36 | complex<T>& operator+=(const T&); | |
| 37 | complex<T>& operator-=(const T&); | |
| 38 | complex<T>& operator*=(const T&); | |
| 39 | complex<T>& operator/=(const T&); | |
| 40 | ||
| 41 | complex& operator=(const complex&); | |
| 42 | template<class X> complex<T>& operator= (const complex<X>&); | |
| 43 | template<class X> complex<T>& operator+=(const complex<X>&); | |
| 44 | template<class X> complex<T>& operator-=(const complex<X>&); | |
| 45 | template<class X> complex<T>& operator*=(const complex<X>&); | |
| 46 | template<class X> complex<T>& operator/=(const complex<X>&); | |
| 32 | void real(T); // constexpr in C++20 | |
| 33 | void imag(T); // constexpr in C++20 | |
| 34 | ||
| 35 | complex<T>& operator= (const T&); // constexpr in C++20 | |
| 36 | complex<T>& operator+=(const T&); // constexpr in C++20 | |
| 37 | complex<T>& operator-=(const T&); // constexpr in C++20 | |
| 38 | complex<T>& operator*=(const T&); // constexpr in C++20 | |
| 39 | complex<T>& operator/=(const T&); // constexpr in C++20 | |
| 40 | ||
| 41 | complex& operator=(const complex&); // constexpr in C++20 | |
| 42 | template<class X> complex<T>& operator= (const complex<X>&); // constexpr in C++20 | |
| 43 | template<class X> complex<T>& operator+=(const complex<X>&); // constexpr in C++20 | |
| 44 | template<class X> complex<T>& operator-=(const complex<X>&); // constexpr in C++20 | |
| 45 | template<class X> complex<T>& operator*=(const complex<X>&); // constexpr in C++20 | |
| 46 | template<class X> complex<T>& operator/=(const complex<X>&); // constexpr in C++20 | |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | 49 | template<> |
| ... | ... | @@ -57,22 +57,22 @@ public: |
| 57 | 57 | explicit constexpr complex(const complex<long double>&); |
| 58 | 58 | |
| 59 | 59 | constexpr float real() const; |
| 60 | void real(float); | |
| 60 | void real(float); // constexpr in C++20 | |
| 61 | 61 | constexpr float imag() const; |
| 62 | void imag(float); | |
| 63 | ||
| 64 | complex<float>& operator= (float); | |
| 65 | complex<float>& operator+=(float); | |
| 66 | complex<float>& operator-=(float); | |
| 67 | complex<float>& operator*=(float); | |
| 68 | complex<float>& operator/=(float); | |
| 69 | ||
| 70 | complex<float>& operator=(const complex<float>&); | |
| 71 | template<class X> complex<float>& operator= (const complex<X>&); | |
| 72 | template<class X> complex<float>& operator+=(const complex<X>&); | |
| 73 | template<class X> complex<float>& operator-=(const complex<X>&); | |
| 74 | template<class X> complex<float>& operator*=(const complex<X>&); | |
| 75 | template<class X> complex<float>& operator/=(const complex<X>&); | |
| 62 | void imag(float); // constexpr in C++20 | |
| 63 | ||
| 64 | complex<float>& operator= (float); // constexpr in C++20 | |
| 65 | complex<float>& operator+=(float); // constexpr in C++20 | |
| 66 | complex<float>& operator-=(float); // constexpr in C++20 | |
| 67 | complex<float>& operator*=(float); // constexpr in C++20 | |
| 68 | complex<float>& operator/=(float); // constexpr in C++20 | |
| 69 | ||
| 70 | complex<float>& operator=(const complex<float>&); // constexpr in C++20 | |
| 71 | template<class X> complex<float>& operator= (const complex<X>&); // constexpr in C++20 | |
| 72 | template<class X> complex<float>& operator+=(const complex<X>&); // constexpr in C++20 | |
| 73 | template<class X> complex<float>& operator-=(const complex<X>&); // constexpr in C++20 | |
| 74 | template<class X> complex<float>& operator*=(const complex<X>&); // constexpr in C++20 | |
| 75 | template<class X> complex<float>& operator/=(const complex<X>&); // constexpr in C++20 | |
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | 78 | template<> |
| ... | ... | @@ -86,22 +86,22 @@ public: |
| 86 | 86 | explicit constexpr complex(const complex<long double>&); |
| 87 | 87 | |
| 88 | 88 | constexpr double real() const; |
| 89 | void real(double); | |
| 89 | void real(double); // constexpr in C++20 | |
| 90 | 90 | constexpr double imag() const; |
| 91 | void imag(double); | |
| 92 | ||
| 93 | complex<double>& operator= (double); | |
| 94 | complex<double>& operator+=(double); | |
| 95 | complex<double>& operator-=(double); | |
| 96 | complex<double>& operator*=(double); | |
| 97 | complex<double>& operator/=(double); | |
| 98 | complex<double>& operator=(const complex<double>&); | |
| 99 | ||
| 100 | template<class X> complex<double>& operator= (const complex<X>&); | |
| 101 | template<class X> complex<double>& operator+=(const complex<X>&); | |
| 102 | template<class X> complex<double>& operator-=(const complex<X>&); | |
| 103 | template<class X> complex<double>& operator*=(const complex<X>&); | |
| 104 | template<class X> complex<double>& operator/=(const complex<X>&); | |
| 91 | void imag(double); // constexpr in C++20 | |
| 92 | ||
| 93 | complex<double>& operator= (double); // constexpr in C++20 | |
| 94 | complex<double>& operator+=(double); // constexpr in C++20 | |
| 95 | complex<double>& operator-=(double); // constexpr in C++20 | |
| 96 | complex<double>& operator*=(double); // constexpr in C++20 | |
| 97 | complex<double>& operator/=(double); // constexpr in C++20 | |
| 98 | complex<double>& operator=(const complex<double>&); // constexpr in C++20 | |
| 99 | ||
| 100 | template<class X> complex<double>& operator= (const complex<X>&); // constexpr in C++20 | |
| 101 | template<class X> complex<double>& operator+=(const complex<X>&); // constexpr in C++20 | |
| 102 | template<class X> complex<double>& operator-=(const complex<X>&); // constexpr in C++20 | |
| 103 | template<class X> complex<double>& operator*=(const complex<X>&); // constexpr in C++20 | |
| 104 | template<class X> complex<double>& operator/=(const complex<X>&); // constexpr in C++20 | |
| 105 | 105 | }; |
| 106 | 106 | |
| 107 | 107 | template<> |
| ... | ... | @@ -115,39 +115,39 @@ public: |
| 115 | 115 | constexpr complex(const complex<double>&); |
| 116 | 116 | |
| 117 | 117 | constexpr long double real() const; |
| 118 | void real(long double); | |
| 118 | void real(long double); // constexpr in C++20 | |
| 119 | 119 | constexpr long double imag() const; |
| 120 | void imag(long double); | |
| 121 | ||
| 122 | complex<long double>& operator=(const complex<long double>&); | |
| 123 | complex<long double>& operator= (long double); | |
| 124 | complex<long double>& operator+=(long double); | |
| 125 | complex<long double>& operator-=(long double); | |
| 126 | complex<long double>& operator*=(long double); | |
| 127 | complex<long double>& operator/=(long double); | |
| 128 | ||
| 129 | template<class X> complex<long double>& operator= (const complex<X>&); | |
| 130 | template<class X> complex<long double>& operator+=(const complex<X>&); | |
| 131 | template<class X> complex<long double>& operator-=(const complex<X>&); | |
| 132 | template<class X> complex<long double>& operator*=(const complex<X>&); | |
| 133 | template<class X> complex<long double>& operator/=(const complex<X>&); | |
| 120 | void imag(long double); // constexpr in C++20 | |
| 121 | ||
| 122 | complex<long double>& operator=(const complex<long double>&); // constexpr in C++20 | |
| 123 | complex<long double>& operator= (long double); // constexpr in C++20 | |
| 124 | complex<long double>& operator+=(long double); // constexpr in C++20 | |
| 125 | complex<long double>& operator-=(long double); // constexpr in C++20 | |
| 126 | complex<long double>& operator*=(long double); // constexpr in C++20 | |
| 127 | complex<long double>& operator/=(long double); // constexpr in C++20 | |
| 128 | ||
| 129 | template<class X> complex<long double>& operator= (const complex<X>&); // constexpr in C++20 | |
| 130 | template<class X> complex<long double>& operator+=(const complex<X>&); // constexpr in C++20 | |
| 131 | template<class X> complex<long double>& operator-=(const complex<X>&); // constexpr in C++20 | |
| 132 | template<class X> complex<long double>& operator*=(const complex<X>&); // constexpr in C++20 | |
| 133 | template<class X> complex<long double>& operator/=(const complex<X>&); // constexpr in C++20 | |
| 134 | 134 | }; |
| 135 | 135 | |
| 136 | 136 | // 26.3.6 operators: |
| 137 | template<class T> complex<T> operator+(const complex<T>&, const complex<T>&); | |
| 138 | template<class T> complex<T> operator+(const complex<T>&, const T&); | |
| 139 | template<class T> complex<T> operator+(const T&, const complex<T>&); | |
| 140 | template<class T> complex<T> operator-(const complex<T>&, const complex<T>&); | |
| 141 | template<class T> complex<T> operator-(const complex<T>&, const T&); | |
| 142 | template<class T> complex<T> operator-(const T&, const complex<T>&); | |
| 143 | template<class T> complex<T> operator*(const complex<T>&, const complex<T>&); | |
| 144 | template<class T> complex<T> operator*(const complex<T>&, const T&); | |
| 145 | template<class T> complex<T> operator*(const T&, const complex<T>&); | |
| 146 | template<class T> complex<T> operator/(const complex<T>&, const complex<T>&); | |
| 147 | template<class T> complex<T> operator/(const complex<T>&, const T&); | |
| 148 | template<class T> complex<T> operator/(const T&, const complex<T>&); | |
| 149 | template<class T> complex<T> operator+(const complex<T>&); | |
| 150 | template<class T> complex<T> operator-(const complex<T>&); | |
| 137 | template<class T> complex<T> operator+(const complex<T>&, const complex<T>&); // constexpr in C++20 | |
| 138 | template<class T> complex<T> operator+(const complex<T>&, const T&); // constexpr in C++20 | |
| 139 | template<class T> complex<T> operator+(const T&, const complex<T>&); // constexpr in C++20 | |
| 140 | template<class T> complex<T> operator-(const complex<T>&, const complex<T>&); // constexpr in C++20 | |
| 141 | template<class T> complex<T> operator-(const complex<T>&, const T&); // constexpr in C++20 | |
| 142 | template<class T> complex<T> operator-(const T&, const complex<T>&); // constexpr in C++20 | |
| 143 | template<class T> complex<T> operator*(const complex<T>&, const complex<T>&); // constexpr in C++20 | |
| 144 | template<class T> complex<T> operator*(const complex<T>&, const T&); // constexpr in C++20 | |
| 145 | template<class T> complex<T> operator*(const T&, const complex<T>&); // constexpr in C++20 | |
| 146 | template<class T> complex<T> operator/(const complex<T>&, const complex<T>&); // constexpr in C++20 | |
| 147 | template<class T> complex<T> operator/(const complex<T>&, const T&); // constexpr in C++20 | |
| 148 | template<class T> complex<T> operator/(const T&, const complex<T>&); // constexpr in C++20 | |
| 149 | template<class T> complex<T> operator+(const complex<T>&); // constexpr in C++20 | |
| 150 | template<class T> complex<T> operator-(const complex<T>&); // constexpr in C++20 | |
| 151 | 151 | template<class T> bool operator==(const complex<T>&, const complex<T>&); // constexpr in C++14 |
| 152 | 152 | template<class T> bool operator==(const complex<T>&, const T&); // constexpr in C++14 |
| 153 | 153 | template<class T> bool operator==(const T&, const complex<T>&); // constexpr in C++14 |
| ... | ... | @@ -184,17 +184,17 @@ template<class T> T arg(const complex<T>&); |
| 184 | 184 | template<Integral T> double arg(T); |
| 185 | 185 | float arg(float); |
| 186 | 186 | |
| 187 | template<class T> T norm(const complex<T>&); | |
| 188 | long double norm(long double); | |
| 189 | double norm(double); | |
| 190 | template<Integral T> double norm(T); | |
| 191 | float norm(float); | |
| 187 | template<class T> T norm(const complex<T>&); // constexpr in C++20 | |
| 188 | long double norm(long double); // constexpr in C++20 | |
| 189 | double norm(double); // constexpr in C++20 | |
| 190 | template<Integral T> double norm(T); // constexpr in C++20 | |
| 191 | float norm(float); // constexpr in C++20 | |
| 192 | 192 | |
| 193 | template<class T> complex<T> conj(const complex<T>&); | |
| 194 | complex<long double> conj(long double); | |
| 195 | complex<double> conj(double); | |
| 196 | template<Integral T> complex<double> conj(T); | |
| 197 | complex<float> conj(float); | |
| 193 | template<class T> complex<T> conj(const complex<T>&); // constexpr in C++20 | |
| 194 | complex<long double> conj(long double); // constexpr in C++20 | |
| 195 | complex<double> conj(double); // constexpr in C++20 | |
| 196 | template<Integral T> complex<double> conj(T); // constexpr in C++20 | |
| 197 | complex<float> conj(float); // constexpr in C++20 | |
| 198 | 198 | |
| 199 | 199 | template<class T> complex<T> proj(const complex<T>&); |
| 200 | 200 | complex<long double> proj(long double); |
| ... | ... | @@ -251,8 +251,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 251 | 251 | |
| 252 | 252 | template<class _Tp> class _LIBCPP_TEMPLATE_VIS complex; |
| 253 | 253 | |
| 254 | template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w); | |
| 255 | template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y); | |
| 254 | template<class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w); | |
| 255 | template<class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y); | |
| 256 | 256 | |
| 257 | 257 | template<class _Tp> |
| 258 | 258 | class _LIBCPP_TEMPLATE_VIS complex |
| ... | ... | @@ -263,50 +263,50 @@ private: |
| 263 | 263 | value_type __re_; |
| 264 | 264 | value_type __im_; |
| 265 | 265 | public: |
| 266 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 266 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 267 | 267 | complex(const value_type& __re = value_type(), const value_type& __im = value_type()) |
| 268 | 268 | : __re_(__re), __im_(__im) {} |
| 269 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 269 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 270 | 270 | complex(const complex<_Xp>& __c) |
| 271 | 271 | : __re_(__c.real()), __im_(__c.imag()) {} |
| 272 | 272 | |
| 273 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type real() const {return __re_;} | |
| 274 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type imag() const {return __im_;} | |
| 273 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type real() const {return __re_;} | |
| 274 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type imag() const {return __im_;} | |
| 275 | 275 | |
| 276 | _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} | |
| 277 | _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} | |
| 276 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;} | |
| 277 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;} | |
| 278 | 278 | |
| 279 | _LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) | |
| 279 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const value_type& __re) | |
| 280 | 280 | {__re_ = __re; __im_ = value_type(); return *this;} |
| 281 | _LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;} | |
| 282 | _LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;} | |
| 283 | _LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;} | |
| 284 | _LIBCPP_INLINE_VISIBILITY complex& operator/=(const value_type& __re) {__re_ /= __re; __im_ /= __re; return *this;} | |
| 281 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const value_type& __re) {__re_ += __re; return *this;} | |
| 282 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;} | |
| 283 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;} | |
| 284 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const value_type& __re) {__re_ /= __re; __im_ /= __re; return *this;} | |
| 285 | 285 | |
| 286 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c) | |
| 286 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c) | |
| 287 | 287 | { |
| 288 | 288 | __re_ = __c.real(); |
| 289 | 289 | __im_ = __c.imag(); |
| 290 | 290 | return *this; |
| 291 | 291 | } |
| 292 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c) | |
| 292 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) | |
| 293 | 293 | { |
| 294 | 294 | __re_ += __c.real(); |
| 295 | 295 | __im_ += __c.imag(); |
| 296 | 296 | return *this; |
| 297 | 297 | } |
| 298 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c) | |
| 298 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) | |
| 299 | 299 | { |
| 300 | 300 | __re_ -= __c.real(); |
| 301 | 301 | __im_ -= __c.imag(); |
| 302 | 302 | return *this; |
| 303 | 303 | } |
| 304 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c) | |
| 304 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) | |
| 305 | 305 | { |
| 306 | 306 | *this = *this * complex(__c.real(), __c.imag()); |
| 307 | 307 | return *this; |
| 308 | 308 | } |
| 309 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c) | |
| 309 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) | |
| 310 | 310 | { |
| 311 | 311 | *this = *this / complex(__c.real(), __c.imag()); |
| 312 | 312 | return *this; |
| ... | ... | @@ -334,40 +334,40 @@ public: |
| 334 | 334 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;} |
| 335 | 335 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;} |
| 336 | 336 | |
| 337 | _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} | |
| 338 | _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} | |
| 337 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;} | |
| 338 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;} | |
| 339 | 339 | |
| 340 | _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) | |
| 340 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (float __re) | |
| 341 | 341 | {__re_ = __re; __im_ = value_type(); return *this;} |
| 342 | _LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;} | |
| 343 | _LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;} | |
| 344 | _LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;} | |
| 345 | _LIBCPP_INLINE_VISIBILITY complex& operator/=(float __re) {__re_ /= __re; __im_ /= __re; return *this;} | |
| 342 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(float __re) {__re_ += __re; return *this;} | |
| 343 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(float __re) {__re_ -= __re; return *this;} | |
| 344 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;} | |
| 345 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(float __re) {__re_ /= __re; __im_ /= __re; return *this;} | |
| 346 | 346 | |
| 347 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c) | |
| 347 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c) | |
| 348 | 348 | { |
| 349 | 349 | __re_ = __c.real(); |
| 350 | 350 | __im_ = __c.imag(); |
| 351 | 351 | return *this; |
| 352 | 352 | } |
| 353 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c) | |
| 353 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) | |
| 354 | 354 | { |
| 355 | 355 | __re_ += __c.real(); |
| 356 | 356 | __im_ += __c.imag(); |
| 357 | 357 | return *this; |
| 358 | 358 | } |
| 359 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c) | |
| 359 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) | |
| 360 | 360 | { |
| 361 | 361 | __re_ -= __c.real(); |
| 362 | 362 | __im_ -= __c.imag(); |
| 363 | 363 | return *this; |
| 364 | 364 | } |
| 365 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c) | |
| 365 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) | |
| 366 | 366 | { |
| 367 | 367 | *this = *this * complex(__c.real(), __c.imag()); |
| 368 | 368 | return *this; |
| 369 | 369 | } |
| 370 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c) | |
| 370 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) | |
| 371 | 371 | { |
| 372 | 372 | *this = *this / complex(__c.real(), __c.imag()); |
| 373 | 373 | return *this; |
| ... | ... | @@ -392,40 +392,40 @@ public: |
| 392 | 392 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;} |
| 393 | 393 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;} |
| 394 | 394 | |
| 395 | _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} | |
| 396 | _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} | |
| 395 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;} | |
| 396 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;} | |
| 397 | 397 | |
| 398 | _LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) | |
| 398 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (double __re) | |
| 399 | 399 | {__re_ = __re; __im_ = value_type(); return *this;} |
| 400 | _LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;} | |
| 401 | _LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;} | |
| 402 | _LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;} | |
| 403 | _LIBCPP_INLINE_VISIBILITY complex& operator/=(double __re) {__re_ /= __re; __im_ /= __re; return *this;} | |
| 400 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(double __re) {__re_ += __re; return *this;} | |
| 401 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(double __re) {__re_ -= __re; return *this;} | |
| 402 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;} | |
| 403 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(double __re) {__re_ /= __re; __im_ /= __re; return *this;} | |
| 404 | 404 | |
| 405 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c) | |
| 405 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c) | |
| 406 | 406 | { |
| 407 | 407 | __re_ = __c.real(); |
| 408 | 408 | __im_ = __c.imag(); |
| 409 | 409 | return *this; |
| 410 | 410 | } |
| 411 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c) | |
| 411 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) | |
| 412 | 412 | { |
| 413 | 413 | __re_ += __c.real(); |
| 414 | 414 | __im_ += __c.imag(); |
| 415 | 415 | return *this; |
| 416 | 416 | } |
| 417 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c) | |
| 417 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) | |
| 418 | 418 | { |
| 419 | 419 | __re_ -= __c.real(); |
| 420 | 420 | __im_ -= __c.imag(); |
| 421 | 421 | return *this; |
| 422 | 422 | } |
| 423 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c) | |
| 423 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) | |
| 424 | 424 | { |
| 425 | 425 | *this = *this * complex(__c.real(), __c.imag()); |
| 426 | 426 | return *this; |
| 427 | 427 | } |
| 428 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c) | |
| 428 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) | |
| 429 | 429 | { |
| 430 | 430 | *this = *this / complex(__c.real(), __c.imag()); |
| 431 | 431 | return *this; |
| ... | ... | @@ -450,40 +450,40 @@ public: |
| 450 | 450 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;} |
| 451 | 451 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;} |
| 452 | 452 | |
| 453 | _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} | |
| 454 | _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} | |
| 453 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;} | |
| 454 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;} | |
| 455 | 455 | |
| 456 | _LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) | |
| 456 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (long double __re) | |
| 457 | 457 | {__re_ = __re; __im_ = value_type(); return *this;} |
| 458 | _LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;} | |
| 459 | _LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;} | |
| 460 | _LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;} | |
| 461 | _LIBCPP_INLINE_VISIBILITY complex& operator/=(long double __re) {__re_ /= __re; __im_ /= __re; return *this;} | |
| 458 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(long double __re) {__re_ += __re; return *this;} | |
| 459 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(long double __re) {__re_ -= __re; return *this;} | |
| 460 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;} | |
| 461 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(long double __re) {__re_ /= __re; __im_ /= __re; return *this;} | |
| 462 | 462 | |
| 463 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c) | |
| 463 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c) | |
| 464 | 464 | { |
| 465 | 465 | __re_ = __c.real(); |
| 466 | 466 | __im_ = __c.imag(); |
| 467 | 467 | return *this; |
| 468 | 468 | } |
| 469 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c) | |
| 469 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) | |
| 470 | 470 | { |
| 471 | 471 | __re_ += __c.real(); |
| 472 | 472 | __im_ += __c.imag(); |
| 473 | 473 | return *this; |
| 474 | 474 | } |
| 475 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c) | |
| 475 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) | |
| 476 | 476 | { |
| 477 | 477 | __re_ -= __c.real(); |
| 478 | 478 | __im_ -= __c.imag(); |
| 479 | 479 | return *this; |
| 480 | 480 | } |
| 481 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c) | |
| 481 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) | |
| 482 | 482 | { |
| 483 | 483 | *this = *this * complex(__c.real(), __c.imag()); |
| 484 | 484 | return *this; |
| 485 | 485 | } |
| 486 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c) | |
| 486 | template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) | |
| 487 | 487 | { |
| 488 | 488 | *this = *this / complex(__c.real(), __c.imag()); |
| 489 | 489 | return *this; |
| ... | ... | @@ -523,7 +523,7 @@ complex<long double>::complex(const complex<double>& __c) |
| 523 | 523 | // 26.3.6 operators: |
| 524 | 524 | |
| 525 | 525 | template<class _Tp> |
| 526 | inline _LIBCPP_INLINE_VISIBILITY | |
| 526 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 527 | 527 | complex<_Tp> |
| 528 | 528 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) |
| 529 | 529 | { |
| ... | ... | @@ -533,7 +533,7 @@ operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | template<class _Tp> |
| 536 | inline _LIBCPP_INLINE_VISIBILITY | |
| 536 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 537 | 537 | complex<_Tp> |
| 538 | 538 | operator+(const complex<_Tp>& __x, const _Tp& __y) |
| 539 | 539 | { |
| ... | ... | @@ -543,7 +543,7 @@ operator+(const complex<_Tp>& __x, const _Tp& __y) |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | template<class _Tp> |
| 546 | inline _LIBCPP_INLINE_VISIBILITY | |
| 546 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 547 | 547 | complex<_Tp> |
| 548 | 548 | operator+(const _Tp& __x, const complex<_Tp>& __y) |
| 549 | 549 | { |
| ... | ... | @@ -553,7 +553,7 @@ operator+(const _Tp& __x, const complex<_Tp>& __y) |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | template<class _Tp> |
| 556 | inline _LIBCPP_INLINE_VISIBILITY | |
| 556 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 557 | 557 | complex<_Tp> |
| 558 | 558 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) |
| 559 | 559 | { |
| ... | ... | @@ -563,7 +563,7 @@ operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | template<class _Tp> |
| 566 | inline _LIBCPP_INLINE_VISIBILITY | |
| 566 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 567 | 567 | complex<_Tp> |
| 568 | 568 | operator-(const complex<_Tp>& __x, const _Tp& __y) |
| 569 | 569 | { |
| ... | ... | @@ -573,7 +573,7 @@ operator-(const complex<_Tp>& __x, const _Tp& __y) |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | template<class _Tp> |
| 576 | inline _LIBCPP_INLINE_VISIBILITY | |
| 576 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 577 | 577 | complex<_Tp> |
| 578 | 578 | operator-(const _Tp& __x, const complex<_Tp>& __y) |
| 579 | 579 | { |
| ... | ... | @@ -583,53 +583,86 @@ operator-(const _Tp& __x, const complex<_Tp>& __y) |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | template<class _Tp> |
| 586 | complex<_Tp> | |
| 586 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> | |
| 587 | 587 | operator*(const complex<_Tp>& __z, const complex<_Tp>& __w) |
| 588 | 588 | { |
| 589 | 589 | _Tp __a = __z.real(); |
| 590 | 590 | _Tp __b = __z.imag(); |
| 591 | 591 | _Tp __c = __w.real(); |
| 592 | 592 | _Tp __d = __w.imag(); |
| 593 | ||
| 594 | // Avoid floating point operations that are invalid during constant evaluation | |
| 595 | if (__libcpp_is_constant_evaluated()) { | |
| 596 | bool __z_zero = __a == _Tp(0) && __b == _Tp(0); | |
| 597 | bool __w_zero = __c == _Tp(0) && __d == _Tp(0); | |
| 598 | bool __z_inf = std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b); | |
| 599 | bool __w_inf = std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d); | |
| 600 | bool __z_nan = !__z_inf && ( | |
| 601 | (std::__constexpr_isnan(__a) && std::__constexpr_isnan(__b)) | |
| 602 | || (std::__constexpr_isnan(__a) && __b == _Tp(0)) | |
| 603 | || (__a == _Tp(0) && std::__constexpr_isnan(__b)) | |
| 604 | ); | |
| 605 | bool __w_nan = !__w_inf && ( | |
| 606 | (std::__constexpr_isnan(__c) && std::__constexpr_isnan(__d)) | |
| 607 | || (std::__constexpr_isnan(__c) && __d == _Tp(0)) | |
| 608 | || (__c == _Tp(0) && std::__constexpr_isnan(__d)) | |
| 609 | ); | |
| 610 | if (__z_nan || __w_nan) { | |
| 611 | return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); | |
| 612 | } | |
| 613 | if (__z_inf || __w_inf) { | |
| 614 | if (__z_zero || __w_zero) { | |
| 615 | return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); | |
| 616 | } | |
| 617 | return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity())); | |
| 618 | } | |
| 619 | bool __z_nonzero_nan = !__z_inf && !__z_nan && (std::__constexpr_isnan(__a) || std::__constexpr_isnan(__b)); | |
| 620 | bool __w_nonzero_nan = !__w_inf && !__w_nan && (std::__constexpr_isnan(__c) || std::__constexpr_isnan(__d)); | |
| 621 | if (__z_nonzero_nan || __w_nonzero_nan) { | |
| 622 | return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); | |
| 623 | } | |
| 624 | } | |
| 625 | ||
| 593 | 626 | _Tp __ac = __a * __c; |
| 594 | 627 | _Tp __bd = __b * __d; |
| 595 | 628 | _Tp __ad = __a * __d; |
| 596 | 629 | _Tp __bc = __b * __c; |
| 597 | 630 | _Tp __x = __ac - __bd; |
| 598 | 631 | _Tp __y = __ad + __bc; |
| 599 | if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y)) | |
| 632 | if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y)) | |
| 600 | 633 | { |
| 601 | 634 | bool __recalc = false; |
| 602 | if (__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b)) | |
| 635 | if (std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b)) | |
| 603 | 636 | { |
| 604 | __a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a); | |
| 605 | __b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b); | |
| 606 | if (__libcpp_isnan_or_builtin(__c)) | |
| 607 | __c = copysign(_Tp(0), __c); | |
| 608 | if (__libcpp_isnan_or_builtin(__d)) | |
| 609 | __d = copysign(_Tp(0), __d); | |
| 637 | __a = std::__constexpr_copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a); | |
| 638 | __b = std::__constexpr_copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b); | |
| 639 | if (std::__constexpr_isnan(__c)) | |
| 640 | __c = std::__constexpr_copysign(_Tp(0), __c); | |
| 641 | if (std::__constexpr_isnan(__d)) | |
| 642 | __d = std::__constexpr_copysign(_Tp(0), __d); | |
| 610 | 643 | __recalc = true; |
| 611 | 644 | } |
| 612 | if (__libcpp_isinf_or_builtin(__c) || __libcpp_isinf_or_builtin(__d)) | |
| 645 | if (std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d)) | |
| 613 | 646 | { |
| 614 | __c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c); | |
| 615 | __d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d); | |
| 616 | if (__libcpp_isnan_or_builtin(__a)) | |
| 617 | __a = copysign(_Tp(0), __a); | |
| 618 | if (__libcpp_isnan_or_builtin(__b)) | |
| 619 | __b = copysign(_Tp(0), __b); | |
| 647 | __c = std::__constexpr_copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c); | |
| 648 | __d = std::__constexpr_copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d); | |
| 649 | if (std::__constexpr_isnan(__a)) | |
| 650 | __a = std::__constexpr_copysign(_Tp(0), __a); | |
| 651 | if (std::__constexpr_isnan(__b)) | |
| 652 | __b = std::__constexpr_copysign(_Tp(0), __b); | |
| 620 | 653 | __recalc = true; |
| 621 | 654 | } |
| 622 | if (!__recalc && (__libcpp_isinf_or_builtin(__ac) || __libcpp_isinf_or_builtin(__bd) || | |
| 623 | __libcpp_isinf_or_builtin(__ad) || __libcpp_isinf_or_builtin(__bc))) | |
| 655 | if (!__recalc && (std::__constexpr_isinf(__ac) || std::__constexpr_isinf(__bd) || | |
| 656 | std::__constexpr_isinf(__ad) || std::__constexpr_isinf(__bc))) | |
| 624 | 657 | { |
| 625 | if (__libcpp_isnan_or_builtin(__a)) | |
| 626 | __a = copysign(_Tp(0), __a); | |
| 627 | if (__libcpp_isnan_or_builtin(__b)) | |
| 628 | __b = copysign(_Tp(0), __b); | |
| 629 | if (__libcpp_isnan_or_builtin(__c)) | |
| 630 | __c = copysign(_Tp(0), __c); | |
| 631 | if (__libcpp_isnan_or_builtin(__d)) | |
| 632 | __d = copysign(_Tp(0), __d); | |
| 658 | if (std::__constexpr_isnan(__a)) | |
| 659 | __a = std::__constexpr_copysign(_Tp(0), __a); | |
| 660 | if (std::__constexpr_isnan(__b)) | |
| 661 | __b = std::__constexpr_copysign(_Tp(0), __b); | |
| 662 | if (std::__constexpr_isnan(__c)) | |
| 663 | __c = std::__constexpr_copysign(_Tp(0), __c); | |
| 664 | if (std::__constexpr_isnan(__d)) | |
| 665 | __d = std::__constexpr_copysign(_Tp(0), __d); | |
| 633 | 666 | __recalc = true; |
| 634 | 667 | } |
| 635 | 668 | if (__recalc) |
| ... | ... | @@ -642,7 +675,7 @@ operator*(const complex<_Tp>& __z, const complex<_Tp>& __w) |
| 642 | 675 | } |
| 643 | 676 | |
| 644 | 677 | template<class _Tp> |
| 645 | inline _LIBCPP_INLINE_VISIBILITY | |
| 678 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 646 | 679 | complex<_Tp> |
| 647 | 680 | operator*(const complex<_Tp>& __x, const _Tp& __y) |
| 648 | 681 | { |
| ... | ... | @@ -652,7 +685,7 @@ operator*(const complex<_Tp>& __x, const _Tp& __y) |
| 652 | 685 | } |
| 653 | 686 | |
| 654 | 687 | template<class _Tp> |
| 655 | inline _LIBCPP_INLINE_VISIBILITY | |
| 688 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 656 | 689 | complex<_Tp> |
| 657 | 690 | operator*(const _Tp& __x, const complex<_Tp>& __y) |
| 658 | 691 | { |
| ... | ... | @@ -662,7 +695,7 @@ operator*(const _Tp& __x, const complex<_Tp>& __y) |
| 662 | 695 | } |
| 663 | 696 | |
| 664 | 697 | template<class _Tp> |
| 665 | complex<_Tp> | |
| 698 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> | |
| 666 | 699 | operator/(const complex<_Tp>& __z, const complex<_Tp>& __w) |
| 667 | 700 | { |
| 668 | 701 | int __ilogbw = 0; |
| ... | ... | @@ -670,34 +703,74 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>& __w) |
| 670 | 703 | _Tp __b = __z.imag(); |
| 671 | 704 | _Tp __c = __w.real(); |
| 672 | 705 | _Tp __d = __w.imag(); |
| 673 | _Tp __logbw = logb(fmax(fabs(__c), fabs(__d))); | |
| 674 | if (__libcpp_isfinite_or_builtin(__logbw)) | |
| 706 | _Tp __logbw = std::__constexpr_logb(std::__constexpr_fmax(std::__constexpr_fabs(__c), std::__constexpr_fabs(__d))); | |
| 707 | if (std::__constexpr_isfinite(__logbw)) | |
| 675 | 708 | { |
| 676 | 709 | __ilogbw = static_cast<int>(__logbw); |
| 677 | __c = scalbn(__c, -__ilogbw); | |
| 678 | __d = scalbn(__d, -__ilogbw); | |
| 710 | __c = std::__constexpr_scalbn(__c, -__ilogbw); | |
| 711 | __d = std::__constexpr_scalbn(__d, -__ilogbw); | |
| 712 | } | |
| 713 | ||
| 714 | // Avoid floating point operations that are invalid during constant evaluation | |
| 715 | if (__libcpp_is_constant_evaluated()) { | |
| 716 | bool __z_zero = __a == _Tp(0) && __b == _Tp(0); | |
| 717 | bool __w_zero = __c == _Tp(0) && __d == _Tp(0); | |
| 718 | bool __z_inf = std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b); | |
| 719 | bool __w_inf = std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d); | |
| 720 | bool __z_nan = !__z_inf && ( | |
| 721 | (std::__constexpr_isnan(__a) && std::__constexpr_isnan(__b)) | |
| 722 | || (std::__constexpr_isnan(__a) && __b == _Tp(0)) | |
| 723 | || (__a == _Tp(0) && std::__constexpr_isnan(__b)) | |
| 724 | ); | |
| 725 | bool __w_nan = !__w_inf && ( | |
| 726 | (std::__constexpr_isnan(__c) && std::__constexpr_isnan(__d)) | |
| 727 | || (std::__constexpr_isnan(__c) && __d == _Tp(0)) | |
| 728 | || (__c == _Tp(0) && std::__constexpr_isnan(__d)) | |
| 729 | ); | |
| 730 | if ((__z_nan || __w_nan) || (__z_inf && __w_inf)) { | |
| 731 | return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); | |
| 732 | } | |
| 733 | bool __z_nonzero_nan = !__z_inf && !__z_nan && (std::__constexpr_isnan(__a) || std::__constexpr_isnan(__b)); | |
| 734 | bool __w_nonzero_nan = !__w_inf && !__w_nan && (std::__constexpr_isnan(__c) || std::__constexpr_isnan(__d)); | |
| 735 | if (__z_nonzero_nan || __w_nonzero_nan) { | |
| 736 | if (__w_zero) { | |
| 737 | return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity())); | |
| 738 | } | |
| 739 | return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); | |
| 740 | } | |
| 741 | if (__w_inf) { | |
| 742 | return complex<_Tp>(_Tp(0), _Tp(0)); | |
| 743 | } | |
| 744 | if (__z_inf) { | |
| 745 | return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity())); | |
| 746 | } | |
| 747 | if (__w_zero) { | |
| 748 | if (__z_zero) { | |
| 749 | return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); | |
| 750 | } | |
| 751 | return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity())); | |
| 752 | } | |
| 679 | 753 | } |
| 754 | ||
| 680 | 755 | _Tp __denom = __c * __c + __d * __d; |
| 681 | _Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw); | |
| 682 | _Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw); | |
| 683 | if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y)) | |
| 756 | _Tp __x = std::__constexpr_scalbn((__a * __c + __b * __d) / __denom, -__ilogbw); | |
| 757 | _Tp __y = std::__constexpr_scalbn((__b * __c - __a * __d) / __denom, -__ilogbw); | |
| 758 | if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y)) | |
| 684 | 759 | { |
| 685 | if ((__denom == _Tp(0)) && (!__libcpp_isnan_or_builtin(__a) || !__libcpp_isnan_or_builtin(__b))) | |
| 760 | if ((__denom == _Tp(0)) && (!std::__constexpr_isnan(__a) || !std::__constexpr_isnan(__b))) | |
| 686 | 761 | { |
| 687 | __x = copysign(_Tp(INFINITY), __c) * __a; | |
| 688 | __y = copysign(_Tp(INFINITY), __c) * __b; | |
| 689 | } | |
| 690 | else if ((__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b)) && __libcpp_isfinite_or_builtin(__c) && __libcpp_isfinite_or_builtin(__d)) | |
| 691 | { | |
| 692 | __a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a); | |
| 693 | __b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b); | |
| 762 | __x = std::__constexpr_copysign(_Tp(INFINITY), __c) * __a; | |
| 763 | __y = std::__constexpr_copysign(_Tp(INFINITY), __c) * __b; | |
| 764 | } else if ((std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b)) && std::__constexpr_isfinite(__c) && | |
| 765 | std::__constexpr_isfinite(__d)) { | |
| 766 | __a = std::__constexpr_copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a); | |
| 767 | __b = std::__constexpr_copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b); | |
| 694 | 768 | __x = _Tp(INFINITY) * (__a * __c + __b * __d); |
| 695 | 769 | __y = _Tp(INFINITY) * (__b * __c - __a * __d); |
| 696 | } | |
| 697 | else if (__libcpp_isinf_or_builtin(__logbw) && __logbw > _Tp(0) && __libcpp_isfinite_or_builtin(__a) && __libcpp_isfinite_or_builtin(__b)) | |
| 698 | { | |
| 699 | __c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c); | |
| 700 | __d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d); | |
| 770 | } else if (std::__constexpr_isinf(__logbw) && __logbw > _Tp(0) && std::__constexpr_isfinite(__a) && | |
| 771 | std::__constexpr_isfinite(__b)) { | |
| 772 | __c = std::__constexpr_copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c); | |
| 773 | __d = std::__constexpr_copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d); | |
| 701 | 774 | __x = _Tp(0) * (__a * __c + __b * __d); |
| 702 | 775 | __y = _Tp(0) * (__b * __c - __a * __d); |
| 703 | 776 | } |
| ... | ... | @@ -706,7 +779,7 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>& __w) |
| 706 | 779 | } |
| 707 | 780 | |
| 708 | 781 | template<class _Tp> |
| 709 | inline _LIBCPP_INLINE_VISIBILITY | |
| 782 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 710 | 783 | complex<_Tp> |
| 711 | 784 | operator/(const complex<_Tp>& __x, const _Tp& __y) |
| 712 | 785 | { |
| ... | ... | @@ -714,7 +787,7 @@ operator/(const complex<_Tp>& __x, const _Tp& __y) |
| 714 | 787 | } |
| 715 | 788 | |
| 716 | 789 | template<class _Tp> |
| 717 | inline _LIBCPP_INLINE_VISIBILITY | |
| 790 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 718 | 791 | complex<_Tp> |
| 719 | 792 | operator/(const _Tp& __x, const complex<_Tp>& __y) |
| 720 | 793 | { |
| ... | ... | @@ -724,7 +797,7 @@ operator/(const _Tp& __x, const complex<_Tp>& __y) |
| 724 | 797 | } |
| 725 | 798 | |
| 726 | 799 | template<class _Tp> |
| 727 | inline _LIBCPP_INLINE_VISIBILITY | |
| 800 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 728 | 801 | complex<_Tp> |
| 729 | 802 | operator+(const complex<_Tp>& __x) |
| 730 | 803 | { |
| ... | ... | @@ -732,7 +805,7 @@ operator+(const complex<_Tp>& __x) |
| 732 | 805 | } |
| 733 | 806 | |
| 734 | 807 | template<class _Tp> |
| 735 | inline _LIBCPP_INLINE_VISIBILITY | |
| 808 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 736 | 809 | complex<_Tp> |
| 737 | 810 | operator-(const complex<_Tp>& __x) |
| 738 | 811 | { |
| ... | ... | @@ -740,7 +813,7 @@ operator-(const complex<_Tp>& __x) |
| 740 | 813 | } |
| 741 | 814 | |
| 742 | 815 | template<class _Tp> |
| 743 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 816 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 744 | 817 | bool |
| 745 | 818 | operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) |
| 746 | 819 | { |
| ... | ... | @@ -748,7 +821,7 @@ operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) |
| 748 | 821 | } |
| 749 | 822 | |
| 750 | 823 | template<class _Tp> |
| 751 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 824 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 752 | 825 | bool |
| 753 | 826 | operator==(const complex<_Tp>& __x, const _Tp& __y) |
| 754 | 827 | { |
| ... | ... | @@ -756,7 +829,7 @@ operator==(const complex<_Tp>& __x, const _Tp& __y) |
| 756 | 829 | } |
| 757 | 830 | |
| 758 | 831 | template<class _Tp> |
| 759 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 832 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 760 | 833 | bool |
| 761 | 834 | operator==(const _Tp& __x, const complex<_Tp>& __y) |
| 762 | 835 | { |
| ... | ... | @@ -764,7 +837,7 @@ operator==(const _Tp& __x, const complex<_Tp>& __y) |
| 764 | 837 | } |
| 765 | 838 | |
| 766 | 839 | template<class _Tp> |
| 767 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 840 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 768 | 841 | bool |
| 769 | 842 | operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) |
| 770 | 843 | { |
| ... | ... | @@ -772,7 +845,7 @@ operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) |
| 772 | 845 | } |
| 773 | 846 | |
| 774 | 847 | template<class _Tp> |
| 775 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 848 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 776 | 849 | bool |
| 777 | 850 | operator!=(const complex<_Tp>& __x, const _Tp& __y) |
| 778 | 851 | { |
| ... | ... | @@ -780,7 +853,7 @@ operator!=(const complex<_Tp>& __x, const _Tp& __y) |
| 780 | 853 | } |
| 781 | 854 | |
| 782 | 855 | template<class _Tp> |
| 783 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 856 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 784 | 857 | bool |
| 785 | 858 | operator!=(const _Tp& __x, const complex<_Tp>& __y) |
| 786 | 859 | { |
| ... | ... | @@ -813,7 +886,7 @@ struct __libcpp_complex_overload_traits<_Tp, false, true> |
| 813 | 886 | // real |
| 814 | 887 | |
| 815 | 888 | template<class _Tp> |
| 816 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 889 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 817 | 890 | _Tp |
| 818 | 891 | real(const complex<_Tp>& __c) |
| 819 | 892 | { |
| ... | ... | @@ -821,7 +894,7 @@ real(const complex<_Tp>& __c) |
| 821 | 894 | } |
| 822 | 895 | |
| 823 | 896 | template <class _Tp> |
| 824 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 897 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 825 | 898 | typename __libcpp_complex_overload_traits<_Tp>::_ValueType |
| 826 | 899 | real(_Tp __re) |
| 827 | 900 | { |
| ... | ... | @@ -831,7 +904,7 @@ real(_Tp __re) |
| 831 | 904 | // imag |
| 832 | 905 | |
| 833 | 906 | template<class _Tp> |
| 834 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 907 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 835 | 908 | _Tp |
| 836 | 909 | imag(const complex<_Tp>& __c) |
| 837 | 910 | { |
| ... | ... | @@ -839,7 +912,7 @@ imag(const complex<_Tp>& __c) |
| 839 | 912 | } |
| 840 | 913 | |
| 841 | 914 | template <class _Tp> |
| 842 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 915 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 843 | 916 | typename __libcpp_complex_overload_traits<_Tp>::_ValueType |
| 844 | 917 | imag(_Tp) |
| 845 | 918 | { |
| ... | ... | @@ -853,7 +926,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 853 | 926 | _Tp |
| 854 | 927 | abs(const complex<_Tp>& __c) |
| 855 | 928 | { |
| 856 | return hypot(__c.real(), __c.imag()); | |
| 929 | return std::hypot(__c.real(), __c.imag()); | |
| 857 | 930 | } |
| 858 | 931 | |
| 859 | 932 | // arg |
| ... | ... | @@ -863,7 +936,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 863 | 936 | _Tp |
| 864 | 937 | arg(const complex<_Tp>& __c) |
| 865 | 938 | { |
| 866 | return atan2(__c.imag(), __c.real()); | |
| 939 | return std::atan2(__c.imag(), __c.real()); | |
| 867 | 940 | } |
| 868 | 941 | |
| 869 | 942 | template <class _Tp> |
| ... | ... | @@ -874,7 +947,7 @@ typename enable_if< |
| 874 | 947 | >::type |
| 875 | 948 | arg(_Tp __re) |
| 876 | 949 | { |
| 877 | return atan2l(0.L, __re); | |
| 950 | return std::atan2l(0.L, __re); | |
| 878 | 951 | } |
| 879 | 952 | |
| 880 | 953 | template<class _Tp> |
| ... | ... | @@ -886,7 +959,7 @@ typename enable_if |
| 886 | 959 | >::type |
| 887 | 960 | arg(_Tp __re) |
| 888 | 961 | { |
| 889 | return atan2(0., __re); | |
| 962 | return std::atan2(0., __re); | |
| 890 | 963 | } |
| 891 | 964 | |
| 892 | 965 | template <class _Tp> |
| ... | ... | @@ -897,25 +970,25 @@ typename enable_if< |
| 897 | 970 | >::type |
| 898 | 971 | arg(_Tp __re) |
| 899 | 972 | { |
| 900 | return atan2f(0.F, __re); | |
| 973 | return std::atan2f(0.F, __re); | |
| 901 | 974 | } |
| 902 | 975 | |
| 903 | 976 | // norm |
| 904 | 977 | |
| 905 | 978 | template<class _Tp> |
| 906 | inline _LIBCPP_INLINE_VISIBILITY | |
| 979 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 907 | 980 | _Tp |
| 908 | 981 | norm(const complex<_Tp>& __c) |
| 909 | 982 | { |
| 910 | if (__libcpp_isinf_or_builtin(__c.real())) | |
| 911 | return abs(__c.real()); | |
| 912 | if (__libcpp_isinf_or_builtin(__c.imag())) | |
| 913 | return abs(__c.imag()); | |
| 983 | if (std::__constexpr_isinf(__c.real())) | |
| 984 | return std::abs(__c.real()); | |
| 985 | if (std::__constexpr_isinf(__c.imag())) | |
| 986 | return std::abs(__c.imag()); | |
| 914 | 987 | return __c.real() * __c.real() + __c.imag() * __c.imag(); |
| 915 | 988 | } |
| 916 | 989 | |
| 917 | 990 | template <class _Tp> |
| 918 | inline _LIBCPP_INLINE_VISIBILITY | |
| 991 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 919 | 992 | typename __libcpp_complex_overload_traits<_Tp>::_ValueType |
| 920 | 993 | norm(_Tp __re) |
| 921 | 994 | { |
| ... | ... | @@ -926,7 +999,7 @@ norm(_Tp __re) |
| 926 | 999 | // conj |
| 927 | 1000 | |
| 928 | 1001 | template<class _Tp> |
| 929 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1002 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 930 | 1003 | complex<_Tp> |
| 931 | 1004 | conj(const complex<_Tp>& __c) |
| 932 | 1005 | { |
| ... | ... | @@ -934,7 +1007,7 @@ conj(const complex<_Tp>& __c) |
| 934 | 1007 | } |
| 935 | 1008 | |
| 936 | 1009 | template <class _Tp> |
| 937 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1010 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 938 | 1011 | typename __libcpp_complex_overload_traits<_Tp>::_ComplexType |
| 939 | 1012 | conj(_Tp __re) |
| 940 | 1013 | { |
| ... | ... | @@ -952,8 +1025,8 @@ complex<_Tp> |
| 952 | 1025 | proj(const complex<_Tp>& __c) |
| 953 | 1026 | { |
| 954 | 1027 | complex<_Tp> __r = __c; |
| 955 | if (__libcpp_isinf_or_builtin(__c.real()) || __libcpp_isinf_or_builtin(__c.imag())) | |
| 956 | __r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag())); | |
| 1028 | if (std::__constexpr_isinf(__c.real()) || std::__constexpr_isinf(__c.imag())) | |
| 1029 | __r = complex<_Tp>(INFINITY, std::copysign(_Tp(0), __c.imag())); | |
| 957 | 1030 | return __r; |
| 958 | 1031 | } |
| 959 | 1032 | |
| ... | ... | @@ -966,8 +1039,8 @@ typename enable_if |
| 966 | 1039 | >::type |
| 967 | 1040 | proj(_Tp __re) |
| 968 | 1041 | { |
| 969 | if (__libcpp_isinf_or_builtin(__re)) | |
| 970 | __re = abs(__re); | |
| 1042 | if (std::__constexpr_isinf(__re)) | |
| 1043 | __re = std::abs(__re); | |
| 971 | 1044 | return complex<_Tp>(__re); |
| 972 | 1045 | } |
| 973 | 1046 | |
| ... | ... | @@ -987,28 +1060,28 @@ proj(_Tp __re) |
| 987 | 1060 | // polar |
| 988 | 1061 | |
| 989 | 1062 | template<class _Tp> |
| 990 | complex<_Tp> | |
| 1063 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 991 | 1064 | polar(const _Tp& __rho, const _Tp& __theta = _Tp()) |
| 992 | 1065 | { |
| 993 | if (__libcpp_isnan_or_builtin(__rho) || signbit(__rho)) | |
| 1066 | if (std::__constexpr_isnan(__rho) || std::signbit(__rho)) | |
| 994 | 1067 | return complex<_Tp>(_Tp(NAN), _Tp(NAN)); |
| 995 | if (__libcpp_isnan_or_builtin(__theta)) | |
| 1068 | if (std::__constexpr_isnan(__theta)) | |
| 996 | 1069 | { |
| 997 | if (__libcpp_isinf_or_builtin(__rho)) | |
| 1070 | if (std::__constexpr_isinf(__rho)) | |
| 998 | 1071 | return complex<_Tp>(__rho, __theta); |
| 999 | 1072 | return complex<_Tp>(__theta, __theta); |
| 1000 | 1073 | } |
| 1001 | if (__libcpp_isinf_or_builtin(__theta)) | |
| 1074 | if (std::__constexpr_isinf(__theta)) | |
| 1002 | 1075 | { |
| 1003 | if (__libcpp_isinf_or_builtin(__rho)) | |
| 1076 | if (std::__constexpr_isinf(__rho)) | |
| 1004 | 1077 | return complex<_Tp>(__rho, _Tp(NAN)); |
| 1005 | 1078 | return complex<_Tp>(_Tp(NAN), _Tp(NAN)); |
| 1006 | 1079 | } |
| 1007 | _Tp __x = __rho * cos(__theta); | |
| 1008 | if (__libcpp_isnan_or_builtin(__x)) | |
| 1080 | _Tp __x = __rho * std::cos(__theta); | |
| 1081 | if (std::__constexpr_isnan(__x)) | |
| 1009 | 1082 | __x = 0; |
| 1010 | _Tp __y = __rho * sin(__theta); | |
| 1011 | if (__libcpp_isnan_or_builtin(__y)) | |
| 1083 | _Tp __y = __rho * std::sin(__theta); | |
| 1084 | if (std::__constexpr_isnan(__y)) | |
| 1012 | 1085 | __y = 0; |
| 1013 | 1086 | return complex<_Tp>(__x, __y); |
| 1014 | 1087 | } |
| ... | ... | @@ -1020,7 +1093,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1020 | 1093 | complex<_Tp> |
| 1021 | 1094 | log(const complex<_Tp>& __x) |
| 1022 | 1095 | { |
| 1023 | return complex<_Tp>(log(abs(__x)), arg(__x)); | |
| 1096 | return complex<_Tp>(std::log(std::abs(__x)), std::arg(__x)); | |
| 1024 | 1097 | } |
| 1025 | 1098 | |
| 1026 | 1099 | // log10 |
| ... | ... | @@ -1030,52 +1103,52 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1030 | 1103 | complex<_Tp> |
| 1031 | 1104 | log10(const complex<_Tp>& __x) |
| 1032 | 1105 | { |
| 1033 | return log(__x) / log(_Tp(10)); | |
| 1106 | return std::log(__x) / std::log(_Tp(10)); | |
| 1034 | 1107 | } |
| 1035 | 1108 | |
| 1036 | 1109 | // sqrt |
| 1037 | 1110 | |
| 1038 | 1111 | template<class _Tp> |
| 1039 | complex<_Tp> | |
| 1112 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1040 | 1113 | sqrt(const complex<_Tp>& __x) |
| 1041 | 1114 | { |
| 1042 | if (__libcpp_isinf_or_builtin(__x.imag())) | |
| 1115 | if (std::__constexpr_isinf(__x.imag())) | |
| 1043 | 1116 | return complex<_Tp>(_Tp(INFINITY), __x.imag()); |
| 1044 | if (__libcpp_isinf_or_builtin(__x.real())) | |
| 1117 | if (std::__constexpr_isinf(__x.real())) | |
| 1045 | 1118 | { |
| 1046 | 1119 | if (__x.real() > _Tp(0)) |
| 1047 | return complex<_Tp>(__x.real(), __libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag())); | |
| 1048 | return complex<_Tp>(__libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag())); | |
| 1120 | return complex<_Tp>(__x.real(), std::__constexpr_isnan(__x.imag()) ? __x.imag() : std::copysign(_Tp(0), __x.imag())); | |
| 1121 | return complex<_Tp>(std::__constexpr_isnan(__x.imag()) ? __x.imag() : _Tp(0), std::copysign(__x.real(), __x.imag())); | |
| 1049 | 1122 | } |
| 1050 | return polar(sqrt(abs(__x)), arg(__x) / _Tp(2)); | |
| 1123 | return std::polar(std::sqrt(std::abs(__x)), std::arg(__x) / _Tp(2)); | |
| 1051 | 1124 | } |
| 1052 | 1125 | |
| 1053 | 1126 | // exp |
| 1054 | 1127 | |
| 1055 | 1128 | template<class _Tp> |
| 1056 | complex<_Tp> | |
| 1129 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1057 | 1130 | exp(const complex<_Tp>& __x) |
| 1058 | 1131 | { |
| 1059 | 1132 | _Tp __i = __x.imag(); |
| 1060 | 1133 | if (__i == 0) { |
| 1061 | return complex<_Tp>(exp(__x.real()), copysign(_Tp(0), __x.imag())); | |
| 1134 | return complex<_Tp>(std::exp(__x.real()), std::copysign(_Tp(0), __x.imag())); | |
| 1062 | 1135 | } |
| 1063 | if (__libcpp_isinf_or_builtin(__x.real())) | |
| 1136 | if (std::__constexpr_isinf(__x.real())) | |
| 1064 | 1137 | { |
| 1065 | 1138 | if (__x.real() < _Tp(0)) |
| 1066 | 1139 | { |
| 1067 | if (!__libcpp_isfinite_or_builtin(__i)) | |
| 1140 | if (!std::__constexpr_isfinite(__i)) | |
| 1068 | 1141 | __i = _Tp(1); |
| 1069 | 1142 | } |
| 1070 | else if (__i == 0 || !__libcpp_isfinite_or_builtin(__i)) | |
| 1143 | else if (__i == 0 || !std::__constexpr_isfinite(__i)) | |
| 1071 | 1144 | { |
| 1072 | if (__libcpp_isinf_or_builtin(__i)) | |
| 1145 | if (std::__constexpr_isinf(__i)) | |
| 1073 | 1146 | __i = _Tp(NAN); |
| 1074 | 1147 | return complex<_Tp>(__x.real(), __i); |
| 1075 | 1148 | } |
| 1076 | 1149 | } |
| 1077 | _Tp __e = exp(__x.real()); | |
| 1078 | return complex<_Tp>(__e * cos(__i), __e * sin(__i)); | |
| 1150 | _Tp __e = std::exp(__x.real()); | |
| 1151 | return complex<_Tp>(__e * std::cos(__i), __e * std::sin(__i)); | |
| 1079 | 1152 | } |
| 1080 | 1153 | |
| 1081 | 1154 | // pow |
| ... | ... | @@ -1085,7 +1158,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1085 | 1158 | complex<_Tp> |
| 1086 | 1159 | pow(const complex<_Tp>& __x, const complex<_Tp>& __y) |
| 1087 | 1160 | { |
| 1088 | return exp(__y * log(__x)); | |
| 1161 | return std::exp(__y * std::log(__x)); | |
| 1089 | 1162 | } |
| 1090 | 1163 | |
| 1091 | 1164 | template<class _Tp, class _Up> |
| ... | ... | @@ -1137,219 +1210,219 @@ __sqr(const complex<_Tp>& __x) |
| 1137 | 1210 | // asinh |
| 1138 | 1211 | |
| 1139 | 1212 | template<class _Tp> |
| 1140 | complex<_Tp> | |
| 1213 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1141 | 1214 | asinh(const complex<_Tp>& __x) |
| 1142 | 1215 | { |
| 1143 | 1216 | const _Tp __pi(atan2(+0., -0.)); |
| 1144 | if (__libcpp_isinf_or_builtin(__x.real())) | |
| 1217 | if (std::__constexpr_isinf(__x.real())) | |
| 1145 | 1218 | { |
| 1146 | if (__libcpp_isnan_or_builtin(__x.imag())) | |
| 1219 | if (std::__constexpr_isnan(__x.imag())) | |
| 1147 | 1220 | return __x; |
| 1148 | if (__libcpp_isinf_or_builtin(__x.imag())) | |
| 1149 | return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); | |
| 1150 | return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag())); | |
| 1221 | if (std::__constexpr_isinf(__x.imag())) | |
| 1222 | return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag())); | |
| 1223 | return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag())); | |
| 1151 | 1224 | } |
| 1152 | if (__libcpp_isnan_or_builtin(__x.real())) | |
| 1225 | if (std::__constexpr_isnan(__x.real())) | |
| 1153 | 1226 | { |
| 1154 | if (__libcpp_isinf_or_builtin(__x.imag())) | |
| 1227 | if (std::__constexpr_isinf(__x.imag())) | |
| 1155 | 1228 | return complex<_Tp>(__x.imag(), __x.real()); |
| 1156 | 1229 | if (__x.imag() == 0) |
| 1157 | 1230 | return __x; |
| 1158 | 1231 | return complex<_Tp>(__x.real(), __x.real()); |
| 1159 | 1232 | } |
| 1160 | if (__libcpp_isinf_or_builtin(__x.imag())) | |
| 1161 | return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag())); | |
| 1162 | complex<_Tp> __z = log(__x + sqrt(__sqr(__x) + _Tp(1))); | |
| 1163 | return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag())); | |
| 1233 | if (std::__constexpr_isinf(__x.imag())) | |
| 1234 | return complex<_Tp>(std::copysign(__x.imag(), __x.real()), std::copysign(__pi/_Tp(2), __x.imag())); | |
| 1235 | complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) + _Tp(1))); | |
| 1236 | return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag())); | |
| 1164 | 1237 | } |
| 1165 | 1238 | |
| 1166 | 1239 | // acosh |
| 1167 | 1240 | |
| 1168 | 1241 | template<class _Tp> |
| 1169 | complex<_Tp> | |
| 1242 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1170 | 1243 | acosh(const complex<_Tp>& __x) |
| 1171 | 1244 | { |
| 1172 | 1245 | const _Tp __pi(atan2(+0., -0.)); |
| 1173 | if (__libcpp_isinf_or_builtin(__x.real())) | |
| 1246 | if (std::__constexpr_isinf(__x.real())) | |
| 1174 | 1247 | { |
| 1175 | if (__libcpp_isnan_or_builtin(__x.imag())) | |
| 1176 | return complex<_Tp>(abs(__x.real()), __x.imag()); | |
| 1177 | if (__libcpp_isinf_or_builtin(__x.imag())) | |
| 1248 | if (std::__constexpr_isnan(__x.imag())) | |
| 1249 | return complex<_Tp>(std::abs(__x.real()), __x.imag()); | |
| 1250 | if (std::__constexpr_isinf(__x.imag())) | |
| 1178 | 1251 | { |
| 1179 | 1252 | if (__x.real() > 0) |
| 1180 | return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); | |
| 1253 | return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag())); | |
| 1181 | 1254 | else |
| 1182 | return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag())); | |
| 1255 | return complex<_Tp>(-__x.real(), std::copysign(__pi * _Tp(0.75), __x.imag())); | |
| 1183 | 1256 | } |
| 1184 | 1257 | if (__x.real() < 0) |
| 1185 | return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag())); | |
| 1186 | return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag())); | |
| 1258 | return complex<_Tp>(-__x.real(), std::copysign(__pi, __x.imag())); | |
| 1259 | return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag())); | |
| 1187 | 1260 | } |
| 1188 | if (__libcpp_isnan_or_builtin(__x.real())) | |
| 1261 | if (std::__constexpr_isnan(__x.real())) | |
| 1189 | 1262 | { |
| 1190 | if (__libcpp_isinf_or_builtin(__x.imag())) | |
| 1191 | return complex<_Tp>(abs(__x.imag()), __x.real()); | |
| 1263 | if (std::__constexpr_isinf(__x.imag())) | |
| 1264 | return complex<_Tp>(std::abs(__x.imag()), __x.real()); | |
| 1192 | 1265 | return complex<_Tp>(__x.real(), __x.real()); |
| 1193 | 1266 | } |
| 1194 | if (__libcpp_isinf_or_builtin(__x.imag())) | |
| 1195 | return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag())); | |
| 1196 | complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1))); | |
| 1197 | return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag())); | |
| 1267 | if (std::__constexpr_isinf(__x.imag())) | |
| 1268 | return complex<_Tp>(std::abs(__x.imag()), std::copysign(__pi/_Tp(2), __x.imag())); | |
| 1269 | complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1))); | |
| 1270 | return complex<_Tp>(std::copysign(__z.real(), _Tp(0)), std::copysign(__z.imag(), __x.imag())); | |
| 1198 | 1271 | } |
| 1199 | 1272 | |
| 1200 | 1273 | // atanh |
| 1201 | 1274 | |
| 1202 | 1275 | template<class _Tp> |
| 1203 | complex<_Tp> | |
| 1276 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1204 | 1277 | atanh(const complex<_Tp>& __x) |
| 1205 | 1278 | { |
| 1206 | 1279 | const _Tp __pi(atan2(+0., -0.)); |
| 1207 | if (__libcpp_isinf_or_builtin(__x.imag())) | |
| 1280 | if (std::__constexpr_isinf(__x.imag())) | |
| 1208 | 1281 | { |
| 1209 | return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag())); | |
| 1282 | return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi/_Tp(2), __x.imag())); | |
| 1210 | 1283 | } |
| 1211 | if (__libcpp_isnan_or_builtin(__x.imag())) | |
| 1284 | if (std::__constexpr_isnan(__x.imag())) | |
| 1212 | 1285 | { |
| 1213 | if (__libcpp_isinf_or_builtin(__x.real()) || __x.real() == 0) | |
| 1214 | return complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag()); | |
| 1286 | if (std::__constexpr_isinf(__x.real()) || __x.real() == 0) | |
| 1287 | return complex<_Tp>(std::copysign(_Tp(0), __x.real()), __x.imag()); | |
| 1215 | 1288 | return complex<_Tp>(__x.imag(), __x.imag()); |
| 1216 | 1289 | } |
| 1217 | if (__libcpp_isnan_or_builtin(__x.real())) | |
| 1290 | if (std::__constexpr_isnan(__x.real())) | |
| 1218 | 1291 | { |
| 1219 | 1292 | return complex<_Tp>(__x.real(), __x.real()); |
| 1220 | 1293 | } |
| 1221 | if (__libcpp_isinf_or_builtin(__x.real())) | |
| 1294 | if (std::__constexpr_isinf(__x.real())) | |
| 1222 | 1295 | { |
| 1223 | return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag())); | |
| 1296 | return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi/_Tp(2), __x.imag())); | |
| 1224 | 1297 | } |
| 1225 | if (abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) | |
| 1298 | if (std::abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) | |
| 1226 | 1299 | { |
| 1227 | return complex<_Tp>(copysign(_Tp(INFINITY), __x.real()), copysign(_Tp(0), __x.imag())); | |
| 1300 | return complex<_Tp>(std::copysign(_Tp(INFINITY), __x.real()), std::copysign(_Tp(0), __x.imag())); | |
| 1228 | 1301 | } |
| 1229 | complex<_Tp> __z = log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2); | |
| 1230 | return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag())); | |
| 1302 | complex<_Tp> __z = std::log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2); | |
| 1303 | return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag())); | |
| 1231 | 1304 | } |
| 1232 | 1305 | |
| 1233 | 1306 | // sinh |
| 1234 | 1307 | |
| 1235 | 1308 | template<class _Tp> |
| 1236 | complex<_Tp> | |
| 1309 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1237 | 1310 | sinh(const complex<_Tp>& __x) |
| 1238 | 1311 | { |
| 1239 | if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag())) | |
| 1312 | if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag())) | |
| 1240 | 1313 | return complex<_Tp>(__x.real(), _Tp(NAN)); |
| 1241 | if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag())) | |
| 1314 | if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag())) | |
| 1242 | 1315 | return complex<_Tp>(__x.real(), _Tp(NAN)); |
| 1243 | if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real())) | |
| 1316 | if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real())) | |
| 1244 | 1317 | return __x; |
| 1245 | return complex<_Tp>(sinh(__x.real()) * cos(__x.imag()), cosh(__x.real()) * sin(__x.imag())); | |
| 1318 | return complex<_Tp>(std::sinh(__x.real()) * std::cos(__x.imag()), std::cosh(__x.real()) * std::sin(__x.imag())); | |
| 1246 | 1319 | } |
| 1247 | 1320 | |
| 1248 | 1321 | // cosh |
| 1249 | 1322 | |
| 1250 | 1323 | template<class _Tp> |
| 1251 | complex<_Tp> | |
| 1324 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1252 | 1325 | cosh(const complex<_Tp>& __x) |
| 1253 | 1326 | { |
| 1254 | if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag())) | |
| 1255 | return complex<_Tp>(abs(__x.real()), _Tp(NAN)); | |
| 1256 | if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag())) | |
| 1327 | if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag())) | |
| 1328 | return complex<_Tp>(std::abs(__x.real()), _Tp(NAN)); | |
| 1329 | if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag())) | |
| 1257 | 1330 | return complex<_Tp>(_Tp(NAN), __x.real()); |
| 1258 | 1331 | if (__x.real() == 0 && __x.imag() == 0) |
| 1259 | 1332 | return complex<_Tp>(_Tp(1), __x.imag()); |
| 1260 | if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real())) | |
| 1261 | return complex<_Tp>(abs(__x.real()), __x.imag()); | |
| 1262 | return complex<_Tp>(cosh(__x.real()) * cos(__x.imag()), sinh(__x.real()) * sin(__x.imag())); | |
| 1333 | if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real())) | |
| 1334 | return complex<_Tp>(std::abs(__x.real()), __x.imag()); | |
| 1335 | return complex<_Tp>(std::cosh(__x.real()) * std::cos(__x.imag()), std::sinh(__x.real()) * std::sin(__x.imag())); | |
| 1263 | 1336 | } |
| 1264 | 1337 | |
| 1265 | 1338 | // tanh |
| 1266 | 1339 | |
| 1267 | 1340 | template<class _Tp> |
| 1268 | complex<_Tp> | |
| 1341 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1269 | 1342 | tanh(const complex<_Tp>& __x) |
| 1270 | 1343 | { |
| 1271 | if (__libcpp_isinf_or_builtin(__x.real())) | |
| 1344 | if (std::__constexpr_isinf(__x.real())) | |
| 1272 | 1345 | { |
| 1273 | if (!__libcpp_isfinite_or_builtin(__x.imag())) | |
| 1274 | return complex<_Tp>(copysign(_Tp(1), __x.real()), _Tp(0)); | |
| 1275 | return complex<_Tp>(copysign(_Tp(1), __x.real()), copysign(_Tp(0), sin(_Tp(2) * __x.imag()))); | |
| 1346 | if (!std::__constexpr_isfinite(__x.imag())) | |
| 1347 | return complex<_Tp>(std::copysign(_Tp(1), __x.real()), _Tp(0)); | |
| 1348 | return complex<_Tp>(std::copysign(_Tp(1), __x.real()), std::copysign(_Tp(0), std::sin(_Tp(2) * __x.imag()))); | |
| 1276 | 1349 | } |
| 1277 | if (__libcpp_isnan_or_builtin(__x.real()) && __x.imag() == 0) | |
| 1350 | if (std::__constexpr_isnan(__x.real()) && __x.imag() == 0) | |
| 1278 | 1351 | return __x; |
| 1279 | 1352 | _Tp __2r(_Tp(2) * __x.real()); |
| 1280 | 1353 | _Tp __2i(_Tp(2) * __x.imag()); |
| 1281 | _Tp __d(cosh(__2r) + cos(__2i)); | |
| 1282 | _Tp __2rsh(sinh(__2r)); | |
| 1283 | if (__libcpp_isinf_or_builtin(__2rsh) && __libcpp_isinf_or_builtin(__d)) | |
| 1354 | _Tp __d(std::cosh(__2r) + std::cos(__2i)); | |
| 1355 | _Tp __2rsh(std::sinh(__2r)); | |
| 1356 | if (std::__constexpr_isinf(__2rsh) && std::__constexpr_isinf(__d)) | |
| 1284 | 1357 | return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1), |
| 1285 | 1358 | __2i > _Tp(0) ? _Tp(0) : _Tp(-0.)); |
| 1286 | return complex<_Tp>(__2rsh/__d, sin(__2i)/__d); | |
| 1359 | return complex<_Tp>(__2rsh/__d, std::sin(__2i)/__d); | |
| 1287 | 1360 | } |
| 1288 | 1361 | |
| 1289 | 1362 | // asin |
| 1290 | 1363 | |
| 1291 | 1364 | template<class _Tp> |
| 1292 | complex<_Tp> | |
| 1365 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1293 | 1366 | asin(const complex<_Tp>& __x) |
| 1294 | 1367 | { |
| 1295 | complex<_Tp> __z = asinh(complex<_Tp>(-__x.imag(), __x.real())); | |
| 1368 | complex<_Tp> __z = std::asinh(complex<_Tp>(-__x.imag(), __x.real())); | |
| 1296 | 1369 | return complex<_Tp>(__z.imag(), -__z.real()); |
| 1297 | 1370 | } |
| 1298 | 1371 | |
| 1299 | 1372 | // acos |
| 1300 | 1373 | |
| 1301 | 1374 | template<class _Tp> |
| 1302 | complex<_Tp> | |
| 1375 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1303 | 1376 | acos(const complex<_Tp>& __x) |
| 1304 | 1377 | { |
| 1305 | 1378 | const _Tp __pi(atan2(+0., -0.)); |
| 1306 | if (__libcpp_isinf_or_builtin(__x.real())) | |
| 1379 | if (std::__constexpr_isinf(__x.real())) | |
| 1307 | 1380 | { |
| 1308 | if (__libcpp_isnan_or_builtin(__x.imag())) | |
| 1381 | if (std::__constexpr_isnan(__x.imag())) | |
| 1309 | 1382 | return complex<_Tp>(__x.imag(), __x.real()); |
| 1310 | if (__libcpp_isinf_or_builtin(__x.imag())) | |
| 1383 | if (std::__constexpr_isinf(__x.imag())) | |
| 1311 | 1384 | { |
| 1312 | 1385 | if (__x.real() < _Tp(0)) |
| 1313 | 1386 | return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag()); |
| 1314 | 1387 | return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag()); |
| 1315 | 1388 | } |
| 1316 | 1389 | if (__x.real() < _Tp(0)) |
| 1317 | return complex<_Tp>(__pi, signbit(__x.imag()) ? -__x.real() : __x.real()); | |
| 1318 | return complex<_Tp>(_Tp(0), signbit(__x.imag()) ? __x.real() : -__x.real()); | |
| 1390 | return complex<_Tp>(__pi, std::signbit(__x.imag()) ? -__x.real() : __x.real()); | |
| 1391 | return complex<_Tp>(_Tp(0), std::signbit(__x.imag()) ? __x.real() : -__x.real()); | |
| 1319 | 1392 | } |
| 1320 | if (__libcpp_isnan_or_builtin(__x.real())) | |
| 1393 | if (std::__constexpr_isnan(__x.real())) | |
| 1321 | 1394 | { |
| 1322 | if (__libcpp_isinf_or_builtin(__x.imag())) | |
| 1395 | if (std::__constexpr_isinf(__x.imag())) | |
| 1323 | 1396 | return complex<_Tp>(__x.real(), -__x.imag()); |
| 1324 | 1397 | return complex<_Tp>(__x.real(), __x.real()); |
| 1325 | 1398 | } |
| 1326 | if (__libcpp_isinf_or_builtin(__x.imag())) | |
| 1399 | if (std::__constexpr_isinf(__x.imag())) | |
| 1327 | 1400 | return complex<_Tp>(__pi/_Tp(2), -__x.imag()); |
| 1328 | if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag()))) | |
| 1401 | if (__x.real() == 0 && (__x.imag() == 0 || std::isnan(__x.imag()))) | |
| 1329 | 1402 | return complex<_Tp>(__pi/_Tp(2), -__x.imag()); |
| 1330 | complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1))); | |
| 1331 | if (signbit(__x.imag())) | |
| 1332 | return complex<_Tp>(abs(__z.imag()), abs(__z.real())); | |
| 1333 | return complex<_Tp>(abs(__z.imag()), -abs(__z.real())); | |
| 1403 | complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1))); | |
| 1404 | if (std::signbit(__x.imag())) | |
| 1405 | return complex<_Tp>(std::abs(__z.imag()), std::abs(__z.real())); | |
| 1406 | return complex<_Tp>(std::abs(__z.imag()), -std::abs(__z.real())); | |
| 1334 | 1407 | } |
| 1335 | 1408 | |
| 1336 | 1409 | // atan |
| 1337 | 1410 | |
| 1338 | 1411 | template<class _Tp> |
| 1339 | complex<_Tp> | |
| 1412 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1340 | 1413 | atan(const complex<_Tp>& __x) |
| 1341 | 1414 | { |
| 1342 | complex<_Tp> __z = atanh(complex<_Tp>(-__x.imag(), __x.real())); | |
| 1415 | complex<_Tp> __z = std::atanh(complex<_Tp>(-__x.imag(), __x.real())); | |
| 1343 | 1416 | return complex<_Tp>(__z.imag(), -__z.real()); |
| 1344 | 1417 | } |
| 1345 | 1418 | |
| 1346 | 1419 | // sin |
| 1347 | 1420 | |
| 1348 | 1421 | template<class _Tp> |
| 1349 | complex<_Tp> | |
| 1422 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1350 | 1423 | sin(const complex<_Tp>& __x) |
| 1351 | 1424 | { |
| 1352 | complex<_Tp> __z = sinh(complex<_Tp>(-__x.imag(), __x.real())); | |
| 1425 | complex<_Tp> __z = std::sinh(complex<_Tp>(-__x.imag(), __x.real())); | |
| 1353 | 1426 | return complex<_Tp>(__z.imag(), -__z.real()); |
| 1354 | 1427 | } |
| 1355 | 1428 | |
| ... | ... | @@ -1360,26 +1433,27 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1360 | 1433 | complex<_Tp> |
| 1361 | 1434 | cos(const complex<_Tp>& __x) |
| 1362 | 1435 | { |
| 1363 | return cosh(complex<_Tp>(-__x.imag(), __x.real())); | |
| 1436 | return std::cosh(complex<_Tp>(-__x.imag(), __x.real())); | |
| 1364 | 1437 | } |
| 1365 | 1438 | |
| 1366 | 1439 | // tan |
| 1367 | 1440 | |
| 1368 | 1441 | template<class _Tp> |
| 1369 | complex<_Tp> | |
| 1442 | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | |
| 1370 | 1443 | tan(const complex<_Tp>& __x) |
| 1371 | 1444 | { |
| 1372 | complex<_Tp> __z = tanh(complex<_Tp>(-__x.imag(), __x.real())); | |
| 1445 | complex<_Tp> __z = std::tanh(complex<_Tp>(-__x.imag(), __x.real())); | |
| 1373 | 1446 | return complex<_Tp>(__z.imag(), -__z.real()); |
| 1374 | 1447 | } |
| 1375 | 1448 | |
| 1449 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 1376 | 1450 | template<class _Tp, class _CharT, class _Traits> |
| 1377 | basic_istream<_CharT, _Traits>& | |
| 1451 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 1378 | 1452 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) |
| 1379 | 1453 | { |
| 1380 | 1454 | if (__is.good()) |
| 1381 | 1455 | { |
| 1382 | ws(__is); | |
| 1456 | std::ws(__is); | |
| 1383 | 1457 | if (__is.peek() == _CharT('(')) |
| 1384 | 1458 | { |
| 1385 | 1459 | __is.get(); |
| ... | ... | @@ -1387,7 +1461,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) |
| 1387 | 1461 | __is >> __r; |
| 1388 | 1462 | if (!__is.fail()) |
| 1389 | 1463 | { |
| 1390 | ws(__is); | |
| 1464 | std::ws(__is); | |
| 1391 | 1465 | _CharT __c = __is.peek(); |
| 1392 | 1466 | if (__c == _CharT(',')) |
| 1393 | 1467 | { |
| ... | ... | @@ -1396,7 +1470,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) |
| 1396 | 1470 | __is >> __i; |
| 1397 | 1471 | if (!__is.fail()) |
| 1398 | 1472 | { |
| 1399 | ws(__is); | |
| 1473 | std::ws(__is); | |
| 1400 | 1474 | __c = __is.peek(); |
| 1401 | 1475 | if (__c == _CharT(')')) |
| 1402 | 1476 | { |
| ... | ... | @@ -1435,9 +1509,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) |
| 1435 | 1509 | return __is; |
| 1436 | 1510 | } |
| 1437 | 1511 | |
| 1438 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 1439 | 1512 | template<class _Tp, class _CharT, class _Traits> |
| 1440 | basic_ostream<_CharT, _Traits>& | |
| 1513 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 1441 | 1514 | operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) |
| 1442 | 1515 | { |
| 1443 | 1516 | basic_ostringstream<_CharT, _Traits> __s; |
| ... | ... | @@ -1455,34 +1528,34 @@ inline namespace literals |
| 1455 | 1528 | { |
| 1456 | 1529 | inline namespace complex_literals |
| 1457 | 1530 | { |
| 1458 | constexpr complex<long double> operator""il(long double __im) | |
| 1531 | _LIBCPP_HIDE_FROM_ABI constexpr complex<long double> operator""il(long double __im) | |
| 1459 | 1532 | { |
| 1460 | 1533 | return { 0.0l, __im }; |
| 1461 | 1534 | } |
| 1462 | 1535 | |
| 1463 | constexpr complex<long double> operator""il(unsigned long long __im) | |
| 1536 | _LIBCPP_HIDE_FROM_ABI constexpr complex<long double> operator""il(unsigned long long __im) | |
| 1464 | 1537 | { |
| 1465 | 1538 | return { 0.0l, static_cast<long double>(__im) }; |
| 1466 | 1539 | } |
| 1467 | 1540 | |
| 1468 | 1541 | |
| 1469 | constexpr complex<double> operator""i(long double __im) | |
| 1542 | _LIBCPP_HIDE_FROM_ABI constexpr complex<double> operator""i(long double __im) | |
| 1470 | 1543 | { |
| 1471 | 1544 | return { 0.0, static_cast<double>(__im) }; |
| 1472 | 1545 | } |
| 1473 | 1546 | |
| 1474 | constexpr complex<double> operator""i(unsigned long long __im) | |
| 1547 | _LIBCPP_HIDE_FROM_ABI constexpr complex<double> operator""i(unsigned long long __im) | |
| 1475 | 1548 | { |
| 1476 | 1549 | return { 0.0, static_cast<double>(__im) }; |
| 1477 | 1550 | } |
| 1478 | 1551 | |
| 1479 | 1552 | |
| 1480 | constexpr complex<float> operator""if(long double __im) | |
| 1553 | _LIBCPP_HIDE_FROM_ABI constexpr complex<float> operator""if(long double __im) | |
| 1481 | 1554 | { |
| 1482 | 1555 | return { 0.0f, static_cast<float>(__im) }; |
| 1483 | 1556 | } |
| 1484 | 1557 | |
| 1485 | constexpr complex<float> operator""if(unsigned long long __im) | |
| 1558 | _LIBCPP_HIDE_FROM_ABI constexpr complex<float> operator""if(unsigned long long __im) | |
| 1486 | 1559 | { |
| 1487 | 1560 | return { 0.0f, static_cast<float>(__im) }; |
| 1488 | 1561 | } |
lib/libcxx/include/complex.h+4-8| ... | ... | @@ -24,13 +24,9 @@ |
| 24 | 24 | #endif |
| 25 | 25 | |
| 26 | 26 | #ifdef __cplusplus |
| 27 | ||
| 28 | #include <ccomplex> | |
| 29 | ||
| 30 | #else // __cplusplus | |
| 31 | ||
| 32 | #include_next <complex.h> | |
| 33 | ||
| 34 | #endif // __cplusplus | |
| 27 | # include <ccomplex> | |
| 28 | #elif __has_include_next(<complex.h>) | |
| 29 | # include_next <complex.h> | |
| 30 | #endif | |
| 35 | 31 | |
| 36 | 32 | #endif // _LIBCPP_COMPLEX_H |
lib/libcxx/include/concepts+4| ... | ... | @@ -155,6 +155,10 @@ namespace std { |
| 155 | 155 | #include <__config> |
| 156 | 156 | #include <version> |
| 157 | 157 | |
| 158 | #if _LIBCPP_STD_VER <= 20 && !defined(_LIPCPP_REMOVE_TRANSITIVE_INCLUDES) | |
| 159 | # include <type_traits> | |
| 160 | #endif | |
| 161 | ||
| 158 | 162 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 159 | 163 | # pragma GCC system_header |
| 160 | 164 | #endif |
lib/libcxx/include/condition_variable+7-1| ... | ... | @@ -108,8 +108,9 @@ public: |
| 108 | 108 | |
| 109 | 109 | #include <__assert> // all public C++ headers provide the assertion handler |
| 110 | 110 | #include <__config> |
| 111 | #include <__memory/shared_ptr.h> | |
| 112 | #include <__memory/unique_ptr.h> | |
| 111 | 113 | #include <__mutex_base> |
| 112 | #include <memory> | |
| 113 | 114 | #include <version> |
| 114 | 115 | |
| 115 | 116 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -267,4 +268,9 @@ _LIBCPP_END_NAMESPACE_STD |
| 267 | 268 | |
| 268 | 269 | #endif // !_LIBCPP_HAS_NO_THREADS |
| 269 | 270 | |
| 271 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 272 | # include <concepts> | |
| 273 | # include <type_traits> | |
| 274 | #endif | |
| 275 | ||
| 270 | 276 | #endif // _LIBCPP_CONDITION_VARIABLE |
lib/libcxx/include/coroutine+7-4| ... | ... | @@ -46,15 +46,18 @@ struct suspend_always; |
| 46 | 46 | #include <__coroutine/trivial_awaitables.h> |
| 47 | 47 | #include <version> |
| 48 | 48 | |
| 49 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 50 | # include <iosfwd> | |
| 51 | #endif | |
| 52 | ||
| 53 | 49 | // standard-mandated includes |
| 50 | ||
| 51 | // [coroutine.syn] | |
| 54 | 52 | #include <compare> |
| 55 | 53 | |
| 56 | 54 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
| 57 | 55 | # pragma GCC system_header |
| 58 | 56 | #endif |
| 59 | 57 | |
| 58 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 59 | # include <iosfwd> | |
| 60 | # include <type_traits> | |
| 61 | #endif | |
| 62 | ||
| 60 | 63 | #endif // _LIBCPP_COROUTINE |
lib/libcxx/include/csetjmp+9| ... | ... | @@ -32,8 +32,17 @@ void longjmp(jmp_buf env, int val); |
| 32 | 32 | |
| 33 | 33 | #include <__assert> // all public C++ headers provide the assertion handler |
| 34 | 34 | #include <__config> |
| 35 | ||
| 35 | 36 | #include <setjmp.h> |
| 36 | 37 | |
| 38 | #ifndef _LIBCPP_SETJMP_H | |
| 39 | # error <csetjmp> tried including <setjmp.h> but didn't find libc++'s <setjmp.h> header. \ | |
| 40 | This usually means that your header search paths are not configured properly. \ | |
| 41 | The header search paths should contain the C++ Standard Library headers before \ | |
| 42 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 43 | not be the case. | |
| 44 | #endif | |
| 45 | ||
| 37 | 46 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 38 | 47 | # pragma GCC system_header |
| 39 | 48 | #endif |
lib/libcxx/include/csignal+5-1| ... | ... | @@ -42,8 +42,12 @@ int raise(int sig); |
| 42 | 42 | #include <__assert> // all public C++ headers provide the assertion handler |
| 43 | 43 | #include <__config> |
| 44 | 44 | |
| 45 | // <signal.h> is not provided by libc++ | |
| 45 | 46 | #if __has_include(<signal.h>) |
| 46 | # include <signal.h> | |
| 47 | # include <signal.h> | |
| 48 | # ifdef _LIBCPP_SIGNAL_H | |
| 49 | # error "If libc++ starts defining <signal.h>, the __has_include check should move to libc++'s <signal.h>" | |
| 50 | # endif | |
| 47 | 51 | #endif |
| 48 | 52 | |
| 49 | 53 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
lib/libcxx/include/cstdarg+8-1| ... | ... | @@ -33,7 +33,14 @@ Types: |
| 33 | 33 | |
| 34 | 34 | #include <__assert> // all public C++ headers provide the assertion handler |
| 35 | 35 | #include <__config> |
| 36 | #include <stdarg.h> | |
| 36 | ||
| 37 | // <stdarg.h> is not provided by libc++ | |
| 38 | #if __has_include(<stdarg.h>) | |
| 39 | # include <stdarg.h> | |
| 40 | # ifdef _LIBCPP_STDARG_H | |
| 41 | # error "If libc++ starts defining <stdarg.h>, the __has_include check should move to libc++'s <stdarg.h>" | |
| 42 | # endif | |
| 43 | #endif | |
| 37 | 44 | |
| 38 | 45 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 39 | 46 | # pragma GCC system_header |
lib/libcxx/include/cstddef+22-13| ... | ... | @@ -38,9 +38,18 @@ Types: |
| 38 | 38 | #include <__type_traits/enable_if.h> |
| 39 | 39 | #include <__type_traits/integral_constant.h> |
| 40 | 40 | #include <__type_traits/is_integral.h> |
| 41 | #include <stddef.h> | |
| 42 | 41 | #include <version> |
| 43 | 42 | |
| 43 | #include <stddef.h> | |
| 44 | ||
| 45 | #ifndef _LIBCPP_STDDEF_H | |
| 46 | # error <cstddef> tried including <stddef.h> but didn't find libc++'s <stddef.h> header. \ | |
| 47 | This usually means that your header search paths are not configured properly. \ | |
| 48 | The header search paths should contain the C++ Standard Library headers before \ | |
| 49 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 50 | not be the case. | |
| 51 | #endif | |
| 52 | ||
| 44 | 53 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 45 | 54 | # pragma GCC system_header |
| 46 | 55 | #endif |
| ... | ... | @@ -62,7 +71,7 @@ namespace std // purposefully not versioned |
| 62 | 71 | { |
| 63 | 72 | enum class byte : unsigned char {}; |
| 64 | 73 | |
| 65 | constexpr byte operator| (byte __lhs, byte __rhs) noexcept | |
| 74 | _LIBCPP_HIDE_FROM_ABI constexpr byte operator| (byte __lhs, byte __rhs) noexcept | |
| 66 | 75 | { |
| 67 | 76 | return static_cast<byte>( |
| 68 | 77 | static_cast<unsigned char>( |
| ... | ... | @@ -70,10 +79,10 @@ constexpr byte operator| (byte __lhs, byte __rhs) noexcept |
| 70 | 79 | )); |
| 71 | 80 | } |
| 72 | 81 | |
| 73 | constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept | |
| 82 | _LIBCPP_HIDE_FROM_ABI constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept | |
| 74 | 83 | { return __lhs = __lhs | __rhs; } |
| 75 | 84 | |
| 76 | constexpr byte operator& (byte __lhs, byte __rhs) noexcept | |
| 85 | _LIBCPP_HIDE_FROM_ABI constexpr byte operator& (byte __lhs, byte __rhs) noexcept | |
| 77 | 86 | { |
| 78 | 87 | return static_cast<byte>( |
| 79 | 88 | static_cast<unsigned char>( |
| ... | ... | @@ -81,10 +90,10 @@ constexpr byte operator& (byte __lhs, byte __rhs) noexcept |
| 81 | 90 | )); |
| 82 | 91 | } |
| 83 | 92 | |
| 84 | constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept | |
| 93 | _LIBCPP_HIDE_FROM_ABI constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept | |
| 85 | 94 | { return __lhs = __lhs & __rhs; } |
| 86 | 95 | |
| 87 | constexpr byte operator^ (byte __lhs, byte __rhs) noexcept | |
| 96 | _LIBCPP_HIDE_FROM_ABI constexpr byte operator^ (byte __lhs, byte __rhs) noexcept | |
| 88 | 97 | { |
| 89 | 98 | return static_cast<byte>( |
| 90 | 99 | static_cast<unsigned char>( |
| ... | ... | @@ -92,10 +101,10 @@ constexpr byte operator^ (byte __lhs, byte __rhs) noexcept |
| 92 | 101 | )); |
| 93 | 102 | } |
| 94 | 103 | |
| 95 | constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept | |
| 104 | _LIBCPP_HIDE_FROM_ABI constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept | |
| 96 | 105 | { return __lhs = __lhs ^ __rhs; } |
| 97 | 106 | |
| 98 | constexpr byte operator~ (byte __b) noexcept | |
| 107 | _LIBCPP_HIDE_FROM_ABI constexpr byte operator~ (byte __b) noexcept | |
| 99 | 108 | { |
| 100 | 109 | return static_cast<byte>( |
| 101 | 110 | static_cast<unsigned char>( |
| ... | ... | @@ -107,27 +116,27 @@ template <class _Tp> |
| 107 | 116 | using _EnableByteOverload = __enable_if_t<is_integral<_Tp>::value, byte>; |
| 108 | 117 | |
| 109 | 118 | template <class _Integer> |
| 110 | constexpr _EnableByteOverload<_Integer> & | |
| 119 | _LIBCPP_HIDE_FROM_ABI constexpr _EnableByteOverload<_Integer> & | |
| 111 | 120 | operator<<=(byte& __lhs, _Integer __shift) noexcept |
| 112 | 121 | { return __lhs = __lhs << __shift; } |
| 113 | 122 | |
| 114 | 123 | template <class _Integer> |
| 115 | constexpr _EnableByteOverload<_Integer> | |
| 124 | _LIBCPP_HIDE_FROM_ABI constexpr _EnableByteOverload<_Integer> | |
| 116 | 125 | operator<< (byte __lhs, _Integer __shift) noexcept |
| 117 | 126 | { return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) << __shift)); } |
| 118 | 127 | |
| 119 | 128 | template <class _Integer> |
| 120 | constexpr _EnableByteOverload<_Integer> & | |
| 129 | _LIBCPP_HIDE_FROM_ABI constexpr _EnableByteOverload<_Integer> & | |
| 121 | 130 | operator>>=(byte& __lhs, _Integer __shift) noexcept |
| 122 | 131 | { return __lhs = __lhs >> __shift; } |
| 123 | 132 | |
| 124 | 133 | template <class _Integer> |
| 125 | constexpr _EnableByteOverload<_Integer> | |
| 134 | _LIBCPP_HIDE_FROM_ABI constexpr _EnableByteOverload<_Integer> | |
| 126 | 135 | operator>> (byte __lhs, _Integer __shift) noexcept |
| 127 | 136 | { return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) >> __shift)); } |
| 128 | 137 | |
| 129 | 138 | template <class _Integer, class = _EnableByteOverload<_Integer> > |
| 130 | _LIBCPP_NODISCARD_EXT constexpr _Integer | |
| 139 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Integer | |
| 131 | 140 | to_integer(byte __b) noexcept { return static_cast<_Integer>(__b); } |
| 132 | 141 | |
| 133 | 142 | } // namespace std |
lib/libcxx/include/cstdint+9| ... | ... | @@ -142,8 +142,17 @@ Types: |
| 142 | 142 | |
| 143 | 143 | #include <__assert> // all public C++ headers provide the assertion handler |
| 144 | 144 | #include <__config> |
| 145 | ||
| 145 | 146 | #include <stdint.h> |
| 146 | 147 | |
| 148 | #ifndef _LIBCPP_STDINT_H | |
| 149 | # error <cstdint> tried including <stdint.h> but didn't find libc++'s <stdint.h> header. \ | |
| 150 | This usually means that your header search paths are not configured properly. \ | |
| 151 | The header search paths should contain the C++ Standard Library headers before \ | |
| 152 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 153 | not be the case. | |
| 154 | #endif | |
| 155 | ||
| 147 | 156 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 148 | 157 | # pragma GCC system_header |
| 149 | 158 | #endif |
lib/libcxx/include/cstdio+9| ... | ... | @@ -97,8 +97,17 @@ void perror(const char* s); |
| 97 | 97 | |
| 98 | 98 | #include <__assert> // all public C++ headers provide the assertion handler |
| 99 | 99 | #include <__config> |
| 100 | ||
| 100 | 101 | #include <stdio.h> |
| 101 | 102 | |
| 103 | #ifndef _LIBCPP_STDIO_H | |
| 104 | # error <cstdio> tried including <stdio.h> but didn't find libc++'s <stdio.h> header. \ | |
| 105 | This usually means that your header search paths are not configured properly. \ | |
| 106 | The header search paths should contain the C++ Standard Library headers before \ | |
| 107 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 108 | not be the case. | |
| 109 | #endif | |
| 110 | ||
| 102 | 111 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 103 | 112 | # pragma GCC system_header |
| 104 | 113 | #endif |
lib/libcxx/include/cstdlib+9| ... | ... | @@ -83,8 +83,17 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 |
| 83 | 83 | |
| 84 | 84 | #include <__assert> // all public C++ headers provide the assertion handler |
| 85 | 85 | #include <__config> |
| 86 | ||
| 86 | 87 | #include <stdlib.h> |
| 87 | 88 | |
| 89 | #ifndef _LIBCPP_STDLIB_H | |
| 90 | # error <cstdlib> tried including <stdlib.h> but didn't find libc++'s <stdlib.h> header. \ | |
| 91 | This usually means that your header search paths are not configured properly. \ | |
| 92 | The header search paths should contain the C++ Standard Library headers before \ | |
| 93 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 94 | not be the case. | |
| 95 | #endif | |
| 96 | ||
| 88 | 97 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 89 | 98 | # pragma GCC system_header |
| 90 | 99 | #endif |
lib/libcxx/include/cstring+57| ... | ... | @@ -58,8 +58,18 @@ size_t strlen(const char* s); |
| 58 | 58 | |
| 59 | 59 | #include <__assert> // all public C++ headers provide the assertion handler |
| 60 | 60 | #include <__config> |
| 61 | #include <__type_traits/is_constant_evaluated.h> | |
| 62 | ||
| 61 | 63 | #include <string.h> |
| 62 | 64 | |
| 65 | #ifndef _LIBCPP_STRING_H | |
| 66 | # error <cstring> tried including <string.h> but didn't find libc++'s <string.h> header. \ | |
| 67 | This usually means that your header search paths are not configured properly. \ | |
| 68 | The header search paths should contain the C++ Standard Library headers before \ | |
| 69 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 70 | not be the case. | |
| 71 | #endif | |
| 72 | ||
| 63 | 73 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 64 | 74 | # pragma GCC system_header |
| 65 | 75 | #endif |
| ... | ... | @@ -90,6 +100,53 @@ using ::memset _LIBCPP_USING_IF_EXISTS; |
| 90 | 100 | using ::strerror _LIBCPP_USING_IF_EXISTS; |
| 91 | 101 | using ::strlen _LIBCPP_USING_IF_EXISTS; |
| 92 | 102 | |
| 103 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t __constexpr_strlen(const char* __str) { | |
| 104 | // GCC currently doesn't support __builtin_strlen for heap-allocated memory during constant evaluation. | |
| 105 | // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70816 | |
| 106 | #ifdef _LIBCPP_COMPILER_GCC | |
| 107 | if (__libcpp_is_constant_evaluated()) { | |
| 108 | size_t __i = 0; | |
| 109 | for (; __str[__i] != '\0'; ++__i) | |
| 110 | ; | |
| 111 | return __i; | |
| 112 | } | |
| 113 | #endif | |
| 114 | return __builtin_strlen(__str); | |
| 115 | } | |
| 116 | ||
| 117 | template <class _Tp> | |
| 118 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int | |
| 119 | __constexpr_memcmp(const _Tp* __lhs, const _Tp* __rhs, size_t __count) { | |
| 120 | #ifdef _LIBCPP_COMPILER_GCC | |
| 121 | if (__libcpp_is_constant_evaluated()) { | |
| 122 | for (; __count; --__count, ++__lhs, ++__rhs) { | |
| 123 | if (*__lhs < *__rhs) | |
| 124 | return -1; | |
| 125 | if (*__rhs < *__lhs) | |
| 126 | return 1; | |
| 127 | } | |
| 128 | return 0; | |
| 129 | } | |
| 130 | #endif | |
| 131 | return __builtin_memcmp(__lhs, __rhs, __count); | |
| 132 | } | |
| 133 | ||
| 134 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const char* | |
| 135 | __constexpr_char_memchr(const char* __str, int __char, size_t __count) { | |
| 136 | #if __has_builtin(__builtin_char_memchr) | |
| 137 | return __builtin_char_memchr(__str, __char, __count); | |
| 138 | #else | |
| 139 | if (!__libcpp_is_constant_evaluated()) | |
| 140 | return static_cast<const char*>(std::memchr(__str, __char, __count)); | |
| 141 | for (; __count; --__count) { | |
| 142 | if (*__str == __char) | |
| 143 | return __str; | |
| 144 | ++__str; | |
| 145 | } | |
| 146 | return nullptr; | |
| 147 | #endif | |
| 148 | } | |
| 149 | ||
| 93 | 150 | _LIBCPP_END_NAMESPACE_STD |
| 94 | 151 | |
| 95 | 152 | #endif // _LIBCPP_CSTRING |
lib/libcxx/include/ctime+8-1| ... | ... | @@ -47,7 +47,14 @@ int timespec_get( struct timespec *ts, int base); // C++17 |
| 47 | 47 | |
| 48 | 48 | #include <__assert> // all public C++ headers provide the assertion handler |
| 49 | 49 | #include <__config> |
| 50 | #include <time.h> | |
| 50 | ||
| 51 | // <time.h> is not provided by libc++ | |
| 52 | #if __has_include(<time.h>) | |
| 53 | # include <time.h> | |
| 54 | # ifdef _LIBCPP_TIME_H | |
| 55 | # error "If libc++ starts defining <time.h>, the __has_include check should move to libc++'s <time.h>" | |
| 56 | # endif | |
| 57 | #endif | |
| 51 | 58 | |
| 52 | 59 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 53 | 60 | # pragma GCC system_header |
lib/libcxx/include/ctype.h+3-1| ... | ... | @@ -35,7 +35,9 @@ int toupper(int c); |
| 35 | 35 | # pragma GCC system_header |
| 36 | 36 | #endif |
| 37 | 37 | |
| 38 | #include_next <ctype.h> | |
| 38 | #if __has_include_next(<ctype.h>) | |
| 39 | # include_next <ctype.h> | |
| 40 | #endif | |
| 39 | 41 | |
| 40 | 42 | #ifdef __cplusplus |
| 41 | 43 |
lib/libcxx/include/cuchar+15| ... | ... | @@ -25,6 +25,8 @@ Types: |
| 25 | 25 | mbstate_t |
| 26 | 26 | size_t |
| 27 | 27 | |
| 28 | size_t mbrtoc8(char8_t* pc8, const char* s, size_t n, mbstate_t* ps); // since C++20 | |
| 29 | size_t c8rtomb(char* s, char8_t c8, mbstate_t* ps); // since C++20 | |
| 28 | 30 | size_t mbrtoc16(char16_t* pc16, const char* s, size_t n, mbstate_t* ps); |
| 29 | 31 | size_t c16rtomb(char* s, char16_t c16, mbstate_t* ps); |
| 30 | 32 | size_t mbrtoc32(char32_t* pc32, const char* s, size_t n, mbstate_t* ps); |
| ... | ... | @@ -36,8 +38,17 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps); |
| 36 | 38 | |
| 37 | 39 | #include <__assert> // all public C++ headers provide the assertion handler |
| 38 | 40 | #include <__config> |
| 41 | ||
| 39 | 42 | #include <uchar.h> |
| 40 | 43 | |
| 44 | #ifndef _LIBCPP_UCHAR_H | |
| 45 | # error <cuchar> tried including <uchar.h> but didn't find libc++'s <uchar.h> header. \ | |
| 46 | This usually means that your header search paths are not configured properly. \ | |
| 47 | The header search paths should contain the C++ Standard Library headers before \ | |
| 48 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 49 | not be the case. | |
| 50 | #endif | |
| 51 | ||
| 41 | 52 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 42 | 53 | # pragma GCC system_header |
| 43 | 54 | #endif |
| ... | ... | @@ -49,6 +60,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 49 | 60 | using ::mbstate_t _LIBCPP_USING_IF_EXISTS; |
| 50 | 61 | using ::size_t _LIBCPP_USING_IF_EXISTS; |
| 51 | 62 | |
| 63 | # if !defined(_LIBCPP_HAS_NO_C8RTOMB_MBRTOC8) | |
| 64 | using ::mbrtoc8 _LIBCPP_USING_IF_EXISTS; | |
| 65 | using ::c8rtomb _LIBCPP_USING_IF_EXISTS; | |
| 66 | # endif | |
| 52 | 67 | using ::mbrtoc16 _LIBCPP_USING_IF_EXISTS; |
| 53 | 68 | using ::c16rtomb _LIBCPP_USING_IF_EXISTS; |
| 54 | 69 | using ::mbrtoc32 _LIBCPP_USING_IF_EXISTS; |
lib/libcxx/include/cwchar+59| ... | ... | @@ -104,9 +104,19 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, |
| 104 | 104 | |
| 105 | 105 | #include <__assert> // all public C++ headers provide the assertion handler |
| 106 | 106 | #include <__config> |
| 107 | #include <__type_traits/is_constant_evaluated.h> | |
| 107 | 108 | #include <cwctype> |
| 109 | ||
| 108 | 110 | #include <wchar.h> |
| 109 | 111 | |
| 112 | #ifndef _LIBCPP_WCHAR_H | |
| 113 | # error <cwchar> tried including <wchar.h> but didn't find libc++'s <wchar.h> header. \ | |
| 114 | This usually means that your header search paths are not configured properly. \ | |
| 115 | The header search paths should contain the C++ Standard Library headers before \ | |
| 116 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 117 | not be the case. | |
| 118 | #endif | |
| 119 | ||
| 110 | 120 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 111 | 121 | # pragma GCC system_header |
| 112 | 122 | #endif |
| ... | ... | @@ -180,6 +190,55 @@ using ::putwchar _LIBCPP_USING_IF_EXISTS; |
| 180 | 190 | using ::vwprintf _LIBCPP_USING_IF_EXISTS; |
| 181 | 191 | using ::wprintf _LIBCPP_USING_IF_EXISTS; |
| 182 | 192 | |
| 193 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t __constexpr_wcslen(const wchar_t* __str) { | |
| 194 | #if __has_builtin(__builtin_wcslen) | |
| 195 | return __builtin_wcslen(__str); | |
| 196 | #else | |
| 197 | if (!__libcpp_is_constant_evaluated()) | |
| 198 | return std::wcslen(__str); | |
| 199 | ||
| 200 | size_t __len = 0; | |
| 201 | for (; *__str != L'\0'; ++__str) | |
| 202 | ++__len; | |
| 203 | return __len; | |
| 204 | #endif | |
| 205 | } | |
| 206 | ||
| 207 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int | |
| 208 | __constexpr_wmemcmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __count) { | |
| 209 | #if __has_builtin(__builtin_wmemcmp) | |
| 210 | return __builtin_wmemcmp(__lhs, __rhs, __count); | |
| 211 | #else | |
| 212 | if (!__libcpp_is_constant_evaluated()) | |
| 213 | return std::wmemcmp(__lhs, __rhs, __count); | |
| 214 | ||
| 215 | for (; __count; --__count, ++__lhs, ++__rhs) { | |
| 216 | if (*__lhs < *__rhs) | |
| 217 | return -1; | |
| 218 | if (*__rhs < *__lhs) | |
| 219 | return 1; | |
| 220 | } | |
| 221 | return 0; | |
| 222 | #endif | |
| 223 | } | |
| 224 | ||
| 225 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const wchar_t* | |
| 226 | __constexpr_wmemchr(const wchar_t* __str, wchar_t __char, size_t __count) { | |
| 227 | #if __has_feature(cxx_constexpr_string_builtins) | |
| 228 | return __builtin_wmemchr(__str, __char, __count); | |
| 229 | #else | |
| 230 | if (!__libcpp_is_constant_evaluated()) | |
| 231 | return std::wmemchr(__str, __char, __count); | |
| 232 | ||
| 233 | for (; __count; --__count) { | |
| 234 | if (*__str == __char) | |
| 235 | return __str; | |
| 236 | ++__str; | |
| 237 | } | |
| 238 | return nullptr; | |
| 239 | #endif | |
| 240 | } | |
| 241 | ||
| 183 | 242 | _LIBCPP_END_NAMESPACE_STD |
| 184 | 243 | |
| 185 | 244 | #endif // _LIBCPP_CWCHAR |
lib/libcxx/include/cwctype+9| ... | ... | @@ -52,8 +52,17 @@ wctrans_t wctrans(const char* property); |
| 52 | 52 | #include <__assert> // all public C++ headers provide the assertion handler |
| 53 | 53 | #include <__config> |
| 54 | 54 | #include <cctype> |
| 55 | ||
| 55 | 56 | #include <wctype.h> |
| 56 | 57 | |
| 58 | #ifndef _LIBCPP_WCTYPE_H | |
| 59 | # error <cwctype> tried including <wctype.h> but didn't find libc++'s <wctype.h> header. \ | |
| 60 | This usually means that your header search paths are not configured properly. \ | |
| 61 | The header search paths should contain the C++ Standard Library headers before \ | |
| 62 | any C Standard Library, and you are probably using compiler flags that make that \ | |
| 63 | not be the case. | |
| 64 | #endif | |
| 65 | ||
| 57 | 66 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 58 | 67 | # pragma GCC system_header |
| 59 | 68 | #endif |
lib/libcxx/include/deque+757-1374| ... | ... | @@ -176,7 +176,14 @@ template <class T, class Allocator, class Predicate> |
| 176 | 176 | #include <__iterator/next.h> |
| 177 | 177 | #include <__iterator/prev.h> |
| 178 | 178 | #include <__iterator/reverse_iterator.h> |
| 179 | #include <__iterator/segmented_iterator.h> | |
| 180 | #include <__memory/allocator_destructor.h> | |
| 181 | #include <__memory/pointer_traits.h> | |
| 182 | #include <__memory/temp_value.h> | |
| 183 | #include <__memory/unique_ptr.h> | |
| 184 | #include <__memory_resource/polymorphic_allocator.h> | |
| 179 | 185 | #include <__split_buffer> |
| 186 | #include <__type_traits/is_allocator.h> | |
| 180 | 187 | #include <__utility/forward.h> |
| 181 | 188 | #include <__utility/move.h> |
| 182 | 189 | #include <__utility/swap.h> |
| ... | ... | @@ -185,12 +192,6 @@ template <class T, class Allocator, class Predicate> |
| 185 | 192 | #include <type_traits> |
| 186 | 193 | #include <version> |
| 187 | 194 | |
| 188 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 189 | # include <algorithm> | |
| 190 | # include <functional> | |
| 191 | # include <iterator> | |
| 192 | #endif | |
| 193 | ||
| 194 | 195 | // standard-mandated includes |
| 195 | 196 | |
| 196 | 197 | // [iterator.range] |
| ... | ... | @@ -214,101 +215,8 @@ _LIBCPP_PUSH_MACROS |
| 214 | 215 | |
| 215 | 216 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 216 | 217 | |
| 217 | template <class _Tp, class _Allocator> class __deque_base; | |
| 218 | 218 | template <class _Tp, class _Allocator = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS deque; |
| 219 | 219 | |
| 220 | template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, | |
| 221 | class _DiffType, _DiffType _BlockSize> | |
| 222 | class _LIBCPP_TEMPLATE_VIS __deque_iterator; | |
| 223 | ||
| 224 | template <class _RAIter, | |
| 225 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 226 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 227 | copy(_RAIter __f, | |
| 228 | _RAIter __l, | |
| 229 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 230 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 231 | ||
| 232 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 233 | class _OutputIterator> | |
| 234 | _OutputIterator | |
| 235 | copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 236 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 237 | _OutputIterator __r); | |
| 238 | ||
| 239 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 240 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 241 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 242 | copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 243 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 244 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); | |
| 245 | ||
| 246 | template <class _RAIter, | |
| 247 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 248 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 249 | copy_backward(_RAIter __f, | |
| 250 | _RAIter __l, | |
| 251 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 252 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 253 | ||
| 254 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 255 | class _OutputIterator> | |
| 256 | _OutputIterator | |
| 257 | copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 258 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 259 | _OutputIterator __r); | |
| 260 | ||
| 261 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 262 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 263 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 264 | copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 265 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 266 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); | |
| 267 | ||
| 268 | template <class _RAIter, | |
| 269 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 270 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 271 | move(_RAIter __f, | |
| 272 | _RAIter __l, | |
| 273 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 274 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 275 | ||
| 276 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 277 | class _OutputIterator> | |
| 278 | _OutputIterator | |
| 279 | move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 280 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 281 | _OutputIterator __r); | |
| 282 | ||
| 283 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 284 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 285 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 286 | move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 287 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 288 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); | |
| 289 | ||
| 290 | template <class _RAIter, | |
| 291 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 292 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 293 | move_backward(_RAIter __f, | |
| 294 | _RAIter __l, | |
| 295 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 296 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 297 | ||
| 298 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 299 | class _OutputIterator> | |
| 300 | _OutputIterator | |
| 301 | move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 302 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 303 | _OutputIterator __r); | |
| 304 | ||
| 305 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 306 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 307 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 308 | move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 309 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 310 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); | |
| 311 | ||
| 312 | 220 | template <class _ValueType, class _DiffType> |
| 313 | 221 | struct __deque_block_size { |
| 314 | 222 | static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16; |
| ... | ... | @@ -340,22 +248,22 @@ public: |
| 340 | 248 | typedef random_access_iterator_tag iterator_category; |
| 341 | 249 | typedef _Reference reference; |
| 342 | 250 | |
| 343 | _LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT | |
| 251 | _LIBCPP_HIDE_FROM_ABI __deque_iterator() _NOEXCEPT | |
| 344 | 252 | #if _LIBCPP_STD_VER > 11 |
| 345 | 253 | : __m_iter_(nullptr), __ptr_(nullptr) |
| 346 | 254 | #endif |
| 347 | 255 | {} |
| 348 | 256 | |
| 349 | 257 | template <class _Pp, class _Rp, class _MP> |
| 350 | _LIBCPP_INLINE_VISIBILITY | |
| 258 | _LIBCPP_HIDE_FROM_ABI | |
| 351 | 259 | __deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it, |
| 352 | 260 | typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT |
| 353 | 261 | : __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {} |
| 354 | 262 | |
| 355 | _LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;} | |
| 356 | _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return __ptr_;} | |
| 263 | _LIBCPP_HIDE_FROM_ABI reference operator*() const {return *__ptr_;} | |
| 264 | _LIBCPP_HIDE_FROM_ABI pointer operator->() const {return __ptr_;} | |
| 357 | 265 | |
| 358 | _LIBCPP_INLINE_VISIBILITY __deque_iterator& operator++() | |
| 266 | _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator++() | |
| 359 | 267 | { |
| 360 | 268 | if (++__ptr_ - *__m_iter_ == __block_size) |
| 361 | 269 | { |
| ... | ... | @@ -365,14 +273,14 @@ public: |
| 365 | 273 | return *this; |
| 366 | 274 | } |
| 367 | 275 | |
| 368 | _LIBCPP_INLINE_VISIBILITY __deque_iterator operator++(int) | |
| 276 | _LIBCPP_HIDE_FROM_ABI __deque_iterator operator++(int) | |
| 369 | 277 | { |
| 370 | 278 | __deque_iterator __tmp = *this; |
| 371 | 279 | ++(*this); |
| 372 | 280 | return __tmp; |
| 373 | 281 | } |
| 374 | 282 | |
| 375 | _LIBCPP_INLINE_VISIBILITY __deque_iterator& operator--() | |
| 283 | _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator--() | |
| 376 | 284 | { |
| 377 | 285 | if (__ptr_ == *__m_iter_) |
| 378 | 286 | { |
| ... | ... | @@ -383,14 +291,14 @@ public: |
| 383 | 291 | return *this; |
| 384 | 292 | } |
| 385 | 293 | |
| 386 | _LIBCPP_INLINE_VISIBILITY __deque_iterator operator--(int) | |
| 294 | _LIBCPP_HIDE_FROM_ABI __deque_iterator operator--(int) | |
| 387 | 295 | { |
| 388 | 296 | __deque_iterator __tmp = *this; |
| 389 | 297 | --(*this); |
| 390 | 298 | return __tmp; |
| 391 | 299 | } |
| 392 | 300 | |
| 393 | _LIBCPP_INLINE_VISIBILITY __deque_iterator& operator+=(difference_type __n) | |
| 301 | _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator+=(difference_type __n) | |
| 394 | 302 | { |
| 395 | 303 | if (__n != 0) |
| 396 | 304 | { |
| ... | ... | @@ -410,30 +318,30 @@ public: |
| 410 | 318 | return *this; |
| 411 | 319 | } |
| 412 | 320 | |
| 413 | _LIBCPP_INLINE_VISIBILITY __deque_iterator& operator-=(difference_type __n) | |
| 321 | _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator-=(difference_type __n) | |
| 414 | 322 | { |
| 415 | 323 | return *this += -__n; |
| 416 | 324 | } |
| 417 | 325 | |
| 418 | _LIBCPP_INLINE_VISIBILITY __deque_iterator operator+(difference_type __n) const | |
| 326 | _LIBCPP_HIDE_FROM_ABI __deque_iterator operator+(difference_type __n) const | |
| 419 | 327 | { |
| 420 | 328 | __deque_iterator __t(*this); |
| 421 | 329 | __t += __n; |
| 422 | 330 | return __t; |
| 423 | 331 | } |
| 424 | 332 | |
| 425 | _LIBCPP_INLINE_VISIBILITY __deque_iterator operator-(difference_type __n) const | |
| 333 | _LIBCPP_HIDE_FROM_ABI __deque_iterator operator-(difference_type __n) const | |
| 426 | 334 | { |
| 427 | 335 | __deque_iterator __t(*this); |
| 428 | 336 | __t -= __n; |
| 429 | 337 | return __t; |
| 430 | 338 | } |
| 431 | 339 | |
| 432 | _LIBCPP_INLINE_VISIBILITY | |
| 340 | _LIBCPP_HIDE_FROM_ABI | |
| 433 | 341 | friend __deque_iterator operator+(difference_type __n, const __deque_iterator& __it) |
| 434 | 342 | {return __it + __n;} |
| 435 | 343 | |
| 436 | _LIBCPP_INLINE_VISIBILITY | |
| 344 | _LIBCPP_HIDE_FROM_ABI | |
| 437 | 345 | friend difference_type operator-(const __deque_iterator& __x, const __deque_iterator& __y) |
| 438 | 346 | { |
| 439 | 347 | if (__x != __y) |
| ... | ... | @@ -443,142 +351,72 @@ public: |
| 443 | 351 | return 0; |
| 444 | 352 | } |
| 445 | 353 | |
| 446 | _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const | |
| 354 | _LIBCPP_HIDE_FROM_ABI reference operator[](difference_type __n) const | |
| 447 | 355 | {return *(*this + __n);} |
| 448 | 356 | |
| 449 | _LIBCPP_INLINE_VISIBILITY friend | |
| 357 | _LIBCPP_HIDE_FROM_ABI friend | |
| 450 | 358 | bool operator==(const __deque_iterator& __x, const __deque_iterator& __y) |
| 451 | 359 | {return __x.__ptr_ == __y.__ptr_;} |
| 452 | 360 | |
| 453 | _LIBCPP_INLINE_VISIBILITY friend | |
| 361 | _LIBCPP_HIDE_FROM_ABI friend | |
| 454 | 362 | bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y) |
| 455 | 363 | {return !(__x == __y);} |
| 456 | 364 | |
| 457 | _LIBCPP_INLINE_VISIBILITY friend | |
| 365 | _LIBCPP_HIDE_FROM_ABI friend | |
| 458 | 366 | bool operator<(const __deque_iterator& __x, const __deque_iterator& __y) |
| 459 | 367 | {return __x.__m_iter_ < __y.__m_iter_ || |
| 460 | 368 | (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_);} |
| 461 | 369 | |
| 462 | _LIBCPP_INLINE_VISIBILITY friend | |
| 370 | _LIBCPP_HIDE_FROM_ABI friend | |
| 463 | 371 | bool operator>(const __deque_iterator& __x, const __deque_iterator& __y) |
| 464 | 372 | {return __y < __x;} |
| 465 | 373 | |
| 466 | _LIBCPP_INLINE_VISIBILITY friend | |
| 374 | _LIBCPP_HIDE_FROM_ABI friend | |
| 467 | 375 | bool operator<=(const __deque_iterator& __x, const __deque_iterator& __y) |
| 468 | 376 | {return !(__y < __x);} |
| 469 | 377 | |
| 470 | _LIBCPP_INLINE_VISIBILITY friend | |
| 378 | _LIBCPP_HIDE_FROM_ABI friend | |
| 471 | 379 | bool operator>=(const __deque_iterator& __x, const __deque_iterator& __y) |
| 472 | 380 | {return !(__x < __y);} |
| 473 | 381 | |
| 474 | 382 | private: |
| 475 | _LIBCPP_INLINE_VISIBILITY explicit __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT | |
| 383 | _LIBCPP_HIDE_FROM_ABI explicit __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT | |
| 476 | 384 | : __m_iter_(__m), __ptr_(__p) {} |
| 477 | 385 | |
| 478 | template <class _Tp, class _Ap> friend class __deque_base; | |
| 479 | 386 | template <class _Tp, class _Ap> friend class _LIBCPP_TEMPLATE_VIS deque; |
| 480 | 387 | template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp> |
| 481 | 388 | friend class _LIBCPP_TEMPLATE_VIS __deque_iterator; |
| 482 | 389 | |
| 483 | template <class _RAIter, | |
| 484 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 485 | friend | |
| 486 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 487 | copy(_RAIter __f, | |
| 488 | _RAIter __l, | |
| 489 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 490 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); | |
| 491 | ||
| 492 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 493 | class _OutputIterator> | |
| 494 | friend | |
| 495 | _OutputIterator | |
| 496 | copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 497 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 498 | _OutputIterator __r); | |
| 499 | ||
| 500 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 501 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 502 | friend | |
| 503 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 504 | copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 505 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 506 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); | |
| 507 | ||
| 508 | template <class _RAIter, | |
| 509 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 510 | friend | |
| 511 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 512 | copy_backward(_RAIter __f, | |
| 513 | _RAIter __l, | |
| 514 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 515 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); | |
| 516 | ||
| 517 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 518 | class _OutputIterator> | |
| 519 | friend | |
| 520 | _OutputIterator | |
| 521 | copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 522 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 523 | _OutputIterator __r); | |
| 524 | ||
| 525 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 526 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 527 | friend | |
| 528 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 529 | copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 530 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 531 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); | |
| 532 | ||
| 533 | template <class _RAIter, | |
| 534 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 535 | friend | |
| 536 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 537 | move(_RAIter __f, | |
| 538 | _RAIter __l, | |
| 539 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 540 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); | |
| 541 | ||
| 542 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 543 | class _OutputIterator> | |
| 544 | friend | |
| 545 | _OutputIterator | |
| 546 | move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 547 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 548 | _OutputIterator __r); | |
| 549 | ||
| 550 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 551 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 552 | friend | |
| 553 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 554 | move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 555 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 556 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); | |
| 557 | ||
| 558 | template <class _RAIter, | |
| 559 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 560 | friend | |
| 561 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 562 | move_backward(_RAIter __f, | |
| 563 | _RAIter __l, | |
| 564 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 565 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); | |
| 566 | ||
| 567 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 568 | class _OutputIterator> | |
| 569 | friend | |
| 570 | _OutputIterator | |
| 571 | move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 572 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 573 | _OutputIterator __r); | |
| 574 | ||
| 575 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 576 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 577 | friend | |
| 578 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 579 | move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 580 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 581 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); | |
| 390 | template <class> | |
| 391 | friend struct __segmented_iterator_traits; | |
| 392 | }; | |
| 393 | ||
| 394 | template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, class _DiffType, _DiffType _BlockSize> | |
| 395 | struct __segmented_iterator_traits< | |
| 396 | __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, _DiffType, _BlockSize> > { | |
| 397 | private: | |
| 398 | using _Iterator = __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, _DiffType, _BlockSize>; | |
| 399 | ||
| 400 | public: | |
| 401 | using __is_segmented_iterator = true_type; | |
| 402 | using __segment_iterator = _MapPointer; | |
| 403 | using __local_iterator = _Pointer; | |
| 404 | ||
| 405 | static _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_Iterator __iter) { return __iter.__m_iter_; } | |
| 406 | static _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_Iterator __iter) { return __iter.__ptr_; } | |
| 407 | static _LIBCPP_HIDE_FROM_ABI __local_iterator __begin(__segment_iterator __iter) { return *__iter; } | |
| 408 | ||
| 409 | static _LIBCPP_HIDE_FROM_ABI __local_iterator __end(__segment_iterator __iter) { | |
| 410 | return *__iter + _Iterator::__block_size; | |
| 411 | } | |
| 412 | ||
| 413 | static _LIBCPP_HIDE_FROM_ABI _Iterator __compose(__segment_iterator __segment, __local_iterator __local) { | |
| 414 | if (__local == __end(__segment)) { | |
| 415 | ++__segment; | |
| 416 | return _Iterator(__segment, *__segment); | |
| 417 | } | |
| 418 | return _Iterator(__segment, __local); | |
| 419 | } | |
| 582 | 420 | }; |
| 583 | 421 | |
| 584 | 422 | template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, |
| ... | ... | @@ -587,897 +425,329 @@ const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, |
| 587 | 425 | _DiffType, _BlockSize>::__block_size = |
| 588 | 426 | __deque_block_size<_ValueType, _DiffType>::value; |
| 589 | 427 | |
| 590 | // copy | |
| 591 | ||
| 592 | template <class _RAIter, | |
| 593 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 594 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 595 | copy(_RAIter __f, | |
| 596 | _RAIter __l, | |
| 597 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 598 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) | |
| 428 | template <class _Tp, class _Allocator /*= allocator<_Tp>*/> | |
| 429 | class _LIBCPP_TEMPLATE_VIS deque | |
| 599 | 430 | { |
| 600 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; | |
| 601 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; | |
| 602 | const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size; | |
| 603 | while (__f != __l) | |
| 604 | { | |
| 605 | pointer __rb = __r.__ptr_; | |
| 606 | pointer __re = *__r.__m_iter_ + __block_size; | |
| 607 | difference_type __bs = __re - __rb; | |
| 608 | difference_type __n = __l - __f; | |
| 609 | _RAIter __m = __l; | |
| 610 | if (__n > __bs) | |
| 611 | { | |
| 612 | __n = __bs; | |
| 613 | __m = __f + __n; | |
| 614 | } | |
| 615 | _VSTD::copy(__f, __m, __rb); | |
| 616 | __f = __m; | |
| 617 | __r += __n; | |
| 618 | } | |
| 619 | return __r; | |
| 620 | } | |
| 431 | public: | |
| 432 | // types: | |
| 621 | 433 | |
| 622 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 623 | class _OutputIterator> | |
| 624 | _OutputIterator | |
| 625 | copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 626 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 627 | _OutputIterator __r) | |
| 628 | { | |
| 629 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; | |
| 630 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; | |
| 631 | const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size; | |
| 632 | difference_type __n = __l - __f; | |
| 633 | while (__n > 0) | |
| 634 | { | |
| 635 | pointer __fb = __f.__ptr_; | |
| 636 | pointer __fe = *__f.__m_iter_ + __block_size; | |
| 637 | difference_type __bs = __fe - __fb; | |
| 638 | if (__bs > __n) | |
| 639 | { | |
| 640 | __bs = __n; | |
| 641 | __fe = __fb + __bs; | |
| 642 | } | |
| 643 | __r = _VSTD::copy(__fb, __fe, __r); | |
| 644 | __n -= __bs; | |
| 645 | __f += __bs; | |
| 646 | } | |
| 647 | return __r; | |
| 648 | } | |
| 434 | using value_type = _Tp; | |
| 649 | 435 | |
| 650 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 651 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 652 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 653 | copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 654 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 655 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r) | |
| 656 | { | |
| 657 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; | |
| 658 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; | |
| 659 | const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size; | |
| 660 | difference_type __n = __l - __f; | |
| 661 | while (__n > 0) | |
| 662 | { | |
| 663 | pointer __fb = __f.__ptr_; | |
| 664 | pointer __fe = *__f.__m_iter_ + __block_size; | |
| 665 | difference_type __bs = __fe - __fb; | |
| 666 | if (__bs > __n) | |
| 667 | { | |
| 668 | __bs = __n; | |
| 669 | __fe = __fb + __bs; | |
| 670 | } | |
| 671 | __r = _VSTD::copy(__fb, __fe, __r); | |
| 672 | __n -= __bs; | |
| 673 | __f += __bs; | |
| 674 | } | |
| 675 | return __r; | |
| 676 | } | |
| 436 | static_assert((is_same<typename _Allocator::value_type, value_type>::value), | |
| 437 | "Allocator::value_type must be same type as value_type"); | |
| 677 | 438 | |
| 678 | // copy_backward | |
| 439 | using allocator_type = _Allocator; | |
| 440 | using __alloc_traits = allocator_traits<allocator_type>; | |
| 679 | 441 | |
| 680 | template <class _RAIter, | |
| 681 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 682 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 683 | copy_backward(_RAIter __f, | |
| 684 | _RAIter __l, | |
| 685 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 686 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) | |
| 687 | { | |
| 688 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; | |
| 689 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; | |
| 690 | while (__f != __l) | |
| 691 | { | |
| 692 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _VSTD::prev(__r); | |
| 693 | pointer __rb = *__rp.__m_iter_; | |
| 694 | pointer __re = __rp.__ptr_ + 1; | |
| 695 | difference_type __bs = __re - __rb; | |
| 696 | difference_type __n = __l - __f; | |
| 697 | _RAIter __m = __f; | |
| 698 | if (__n > __bs) | |
| 699 | { | |
| 700 | __n = __bs; | |
| 701 | __m = __l - __n; | |
| 702 | } | |
| 703 | _VSTD::copy_backward(__m, __l, __re); | |
| 704 | __l = __m; | |
| 705 | __r -= __n; | |
| 706 | } | |
| 707 | return __r; | |
| 708 | } | |
| 442 | using size_type = typename __alloc_traits::size_type; | |
| 443 | using difference_type = typename __alloc_traits::difference_type; | |
| 709 | 444 | |
| 710 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 711 | class _OutputIterator> | |
| 712 | _OutputIterator | |
| 713 | copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 714 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 715 | _OutputIterator __r) | |
| 716 | { | |
| 717 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; | |
| 718 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; | |
| 719 | difference_type __n = __l - __f; | |
| 720 | while (__n > 0) | |
| 721 | { | |
| 722 | --__l; | |
| 723 | pointer __lb = *__l.__m_iter_; | |
| 724 | pointer __le = __l.__ptr_ + 1; | |
| 725 | difference_type __bs = __le - __lb; | |
| 726 | if (__bs > __n) | |
| 727 | { | |
| 728 | __bs = __n; | |
| 729 | __lb = __le - __bs; | |
| 730 | } | |
| 731 | __r = _VSTD::copy_backward(__lb, __le, __r); | |
| 732 | __n -= __bs; | |
| 733 | __l -= __bs - 1; | |
| 734 | } | |
| 735 | return __r; | |
| 736 | } | |
| 445 | using pointer = typename __alloc_traits::pointer; | |
| 446 | using const_pointer = typename __alloc_traits::const_pointer; | |
| 737 | 447 | |
| 738 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 739 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 740 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 741 | copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 742 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 743 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r) | |
| 744 | { | |
| 745 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; | |
| 746 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; | |
| 747 | difference_type __n = __l - __f; | |
| 748 | while (__n > 0) | |
| 749 | { | |
| 750 | --__l; | |
| 751 | pointer __lb = *__l.__m_iter_; | |
| 752 | pointer __le = __l.__ptr_ + 1; | |
| 753 | difference_type __bs = __le - __lb; | |
| 754 | if (__bs > __n) | |
| 755 | { | |
| 756 | __bs = __n; | |
| 757 | __lb = __le - __bs; | |
| 758 | } | |
| 759 | __r = _VSTD::copy_backward(__lb, __le, __r); | |
| 760 | __n -= __bs; | |
| 761 | __l -= __bs - 1; | |
| 762 | } | |
| 763 | return __r; | |
| 764 | } | |
| 448 | using __pointer_allocator = __rebind_alloc<__alloc_traits, pointer>; | |
| 449 | using __const_pointer_allocator = __rebind_alloc<__alloc_traits, const_pointer>; | |
| 450 | using __map = __split_buffer<pointer, __pointer_allocator>; | |
| 451 | using __map_alloc_traits = allocator_traits<__pointer_allocator>; | |
| 452 | using __map_pointer = typename __map_alloc_traits::pointer; | |
| 453 | using __map_const_pointer = typename allocator_traits<__const_pointer_allocator>::const_pointer; | |
| 765 | 454 | |
| 766 | // move | |
| 455 | using reference = value_type&; | |
| 456 | using const_reference = const value_type&; | |
| 767 | 457 | |
| 768 | template <class _RAIter, | |
| 769 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 770 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 771 | move(_RAIter __f, | |
| 772 | _RAIter __l, | |
| 773 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 774 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) | |
| 775 | { | |
| 776 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; | |
| 777 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; | |
| 778 | const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size; | |
| 779 | while (__f != __l) | |
| 780 | { | |
| 781 | pointer __rb = __r.__ptr_; | |
| 782 | pointer __re = *__r.__m_iter_ + __block_size; | |
| 783 | difference_type __bs = __re - __rb; | |
| 784 | difference_type __n = __l - __f; | |
| 785 | _RAIter __m = __l; | |
| 786 | if (__n > __bs) | |
| 787 | { | |
| 788 | __n = __bs; | |
| 789 | __m = __f + __n; | |
| 790 | } | |
| 791 | _VSTD::move(__f, __m, __rb); | |
| 792 | __f = __m; | |
| 793 | __r += __n; | |
| 794 | } | |
| 795 | return __r; | |
| 796 | } | |
| 458 | using iterator = __deque_iterator<value_type, pointer, reference, __map_pointer, difference_type>; | |
| 459 | using const_iterator = | |
| 460 | __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer, difference_type>; | |
| 461 | using reverse_iterator = std::reverse_iterator<iterator>; | |
| 462 | using const_reverse_iterator = std::reverse_iterator<const_iterator>; | |
| 797 | 463 | |
| 798 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 799 | class _OutputIterator> | |
| 800 | _OutputIterator | |
| 801 | move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 802 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 803 | _OutputIterator __r) | |
| 804 | { | |
| 805 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; | |
| 806 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; | |
| 807 | const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size; | |
| 808 | difference_type __n = __l - __f; | |
| 809 | while (__n > 0) | |
| 810 | { | |
| 811 | pointer __fb = __f.__ptr_; | |
| 812 | pointer __fe = *__f.__m_iter_ + __block_size; | |
| 813 | difference_type __bs = __fe - __fb; | |
| 814 | if (__bs > __n) | |
| 815 | { | |
| 816 | __bs = __n; | |
| 817 | __fe = __fb + __bs; | |
| 818 | } | |
| 819 | __r = _VSTD::move(__fb, __fe, __r); | |
| 820 | __n -= __bs; | |
| 821 | __f += __bs; | |
| 822 | } | |
| 823 | return __r; | |
| 824 | } | |
| 464 | static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, | |
| 465 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 466 | "original allocator"); | |
| 467 | static_assert(is_nothrow_default_constructible<allocator_type>::value == | |
| 468 | is_nothrow_default_constructible<__pointer_allocator>::value, | |
| 469 | "rebinding an allocator should not change excpetion guarantees"); | |
| 470 | static_assert(is_nothrow_move_constructible<allocator_type>::value == | |
| 471 | is_nothrow_move_constructible<typename __map::allocator_type>::value, | |
| 472 | "rebinding an allocator should not change excpetion guarantees"); | |
| 825 | 473 | |
| 826 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 827 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 828 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 829 | move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 830 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 831 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r) | |
| 832 | { | |
| 833 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; | |
| 834 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; | |
| 835 | const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size; | |
| 836 | difference_type __n = __l - __f; | |
| 837 | while (__n > 0) | |
| 838 | { | |
| 839 | pointer __fb = __f.__ptr_; | |
| 840 | pointer __fe = *__f.__m_iter_ + __block_size; | |
| 841 | difference_type __bs = __fe - __fb; | |
| 842 | if (__bs > __n) | |
| 843 | { | |
| 844 | __bs = __n; | |
| 845 | __fe = __fb + __bs; | |
| 846 | } | |
| 847 | __r = _VSTD::move(__fb, __fe, __r); | |
| 848 | __n -= __bs; | |
| 849 | __f += __bs; | |
| 850 | } | |
| 851 | return __r; | |
| 852 | } | |
| 474 | private: | |
| 475 | struct __deque_block_range { | |
| 476 | explicit _LIBCPP_HIDE_FROM_ABI | |
| 477 | __deque_block_range(pointer __b, pointer __e) _NOEXCEPT : __begin_(__b), __end_(__e) {} | |
| 478 | const pointer __begin_; | |
| 479 | const pointer __end_; | |
| 480 | }; | |
| 853 | 481 | |
| 854 | // move_backward | |
| 482 | struct __deque_range { | |
| 483 | iterator __pos_; | |
| 484 | const iterator __end_; | |
| 855 | 485 | |
| 856 | template <class _RAIter, | |
| 857 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 858 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 859 | move_backward(_RAIter __f, | |
| 860 | _RAIter __l, | |
| 861 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, | |
| 862 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) | |
| 863 | { | |
| 864 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; | |
| 865 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; | |
| 866 | while (__f != __l) | |
| 867 | { | |
| 868 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _VSTD::prev(__r); | |
| 869 | pointer __rb = *__rp.__m_iter_; | |
| 870 | pointer __re = __rp.__ptr_ + 1; | |
| 871 | difference_type __bs = __re - __rb; | |
| 872 | difference_type __n = __l - __f; | |
| 873 | _RAIter __m = __f; | |
| 874 | if (__n > __bs) | |
| 875 | { | |
| 876 | __n = __bs; | |
| 877 | __m = __l - __n; | |
| 878 | } | |
| 879 | _VSTD::move_backward(__m, __l, __re); | |
| 880 | __l = __m; | |
| 881 | __r -= __n; | |
| 882 | } | |
| 883 | return __r; | |
| 884 | } | |
| 486 | _LIBCPP_HIDE_FROM_ABI __deque_range(iterator __pos, iterator __e) _NOEXCEPT | |
| 487 | : __pos_(__pos), __end_(__e) {} | |
| 885 | 488 | |
| 886 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 887 | class _OutputIterator> | |
| 888 | _OutputIterator | |
| 889 | move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 890 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 891 | _OutputIterator __r) | |
| 892 | { | |
| 893 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; | |
| 894 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; | |
| 895 | difference_type __n = __l - __f; | |
| 896 | while (__n > 0) | |
| 897 | { | |
| 898 | --__l; | |
| 899 | pointer __lb = *__l.__m_iter_; | |
| 900 | pointer __le = __l.__ptr_ + 1; | |
| 901 | difference_type __bs = __le - __lb; | |
| 902 | if (__bs > __n) | |
| 903 | { | |
| 904 | __bs = __n; | |
| 905 | __lb = __le - __bs; | |
| 906 | } | |
| 907 | __r = _VSTD::move_backward(__lb, __le, __r); | |
| 908 | __n -= __bs; | |
| 909 | __l -= __bs - 1; | |
| 489 | explicit _LIBCPP_HIDE_FROM_ABI operator bool() const _NOEXCEPT { | |
| 490 | return __pos_ != __end_; | |
| 910 | 491 | } |
| 911 | return __r; | |
| 912 | } | |
| 913 | 492 | |
| 914 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, | |
| 915 | class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> | |
| 916 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> | |
| 917 | move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, | |
| 918 | __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, | |
| 919 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r) | |
| 920 | { | |
| 921 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; | |
| 922 | typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; | |
| 923 | difference_type __n = __l - __f; | |
| 924 | while (__n > 0) | |
| 925 | { | |
| 926 | --__l; | |
| 927 | pointer __lb = *__l.__m_iter_; | |
| 928 | pointer __le = __l.__ptr_ + 1; | |
| 929 | difference_type __bs = __le - __lb; | |
| 930 | if (__bs > __n) | |
| 931 | { | |
| 932 | __bs = __n; | |
| 933 | __lb = __le - __bs; | |
| 934 | } | |
| 935 | __r = _VSTD::move_backward(__lb, __le, __r); | |
| 936 | __n -= __bs; | |
| 937 | __l -= __bs - 1; | |
| 493 | _LIBCPP_HIDE_FROM_ABI __deque_range begin() const { | |
| 494 | return *this; | |
| 938 | 495 | } |
| 939 | return __r; | |
| 940 | } | |
| 941 | ||
| 942 | template <class _Tp, class _Allocator> | |
| 943 | class __deque_base | |
| 944 | { | |
| 945 | __deque_base(const __deque_base& __c); | |
| 946 | __deque_base& operator=(const __deque_base& __c); | |
| 947 | public: | |
| 948 | typedef _Allocator allocator_type; | |
| 949 | typedef allocator_traits<allocator_type> __alloc_traits; | |
| 950 | typedef typename __alloc_traits::size_type size_type; | |
| 951 | 496 | |
| 952 | typedef _Tp value_type; | |
| 953 | typedef value_type& reference; | |
| 954 | typedef const value_type& const_reference; | |
| 955 | typedef typename __alloc_traits::difference_type difference_type; | |
| 956 | typedef typename __alloc_traits::pointer pointer; | |
| 957 | typedef typename __alloc_traits::const_pointer const_pointer; | |
| 958 | ||
| 959 | static const difference_type __block_size; | |
| 960 | ||
| 961 | typedef typename __rebind_alloc_helper<__alloc_traits, pointer>::type __pointer_allocator; | |
| 962 | typedef allocator_traits<__pointer_allocator> __map_traits; | |
| 963 | typedef typename __map_traits::pointer __map_pointer; | |
| 964 | typedef typename __rebind_alloc_helper<__alloc_traits, const_pointer>::type __const_pointer_allocator; | |
| 965 | typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer; | |
| 966 | typedef __split_buffer<pointer, __pointer_allocator> __map; | |
| 967 | ||
| 968 | typedef __deque_iterator<value_type, pointer, reference, __map_pointer, | |
| 969 | difference_type> iterator; | |
| 970 | typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer, | |
| 971 | difference_type> const_iterator; | |
| 972 | ||
| 973 | struct __deque_block_range { | |
| 974 | explicit __deque_block_range(pointer __b, pointer __e) _NOEXCEPT : __begin_(__b), __end_(__e) {} | |
| 975 | const pointer __begin_; | |
| 976 | const pointer __end_; | |
| 977 | }; | |
| 978 | ||
| 979 | struct __deque_range { | |
| 980 | iterator __pos_; | |
| 981 | const iterator __end_; | |
| 982 | ||
| 983 | __deque_range(iterator __pos, iterator __e) _NOEXCEPT | |
| 984 | : __pos_(__pos), __end_(__e) {} | |
| 985 | ||
| 986 | explicit operator bool() const _NOEXCEPT { | |
| 987 | return __pos_ != __end_; | |
| 988 | } | |
| 989 | ||
| 990 | __deque_range begin() const { | |
| 991 | return *this; | |
| 992 | } | |
| 993 | ||
| 994 | __deque_range end() const { | |
| 995 | return __deque_range(__end_, __end_); | |
| 996 | } | |
| 997 | __deque_block_range operator*() const _NOEXCEPT { | |
| 998 | if (__pos_.__m_iter_ == __end_.__m_iter_) { | |
| 999 | return __deque_block_range(__pos_.__ptr_, __end_.__ptr_); | |
| 1000 | } | |
| 1001 | return __deque_block_range(__pos_.__ptr_, *__pos_.__m_iter_ + __block_size); | |
| 1002 | } | |
| 1003 | ||
| 1004 | __deque_range& operator++() _NOEXCEPT { | |
| 497 | _LIBCPP_HIDE_FROM_ABI __deque_range end() const { | |
| 498 | return __deque_range(__end_, __end_); | |
| 499 | } | |
| 500 | _LIBCPP_HIDE_FROM_ABI __deque_block_range operator*() const _NOEXCEPT { | |
| 1005 | 501 | if (__pos_.__m_iter_ == __end_.__m_iter_) { |
| 1006 | __pos_ = __end_; | |
| 1007 | } else { | |
| 1008 | ++__pos_.__m_iter_; | |
| 1009 | __pos_.__ptr_ = *__pos_.__m_iter_; | |
| 1010 | } | |
| 1011 | return *this; | |
| 1012 | } | |
| 1013 | ||
| 1014 | ||
| 1015 | friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) { | |
| 1016 | return __lhs.__pos_ == __rhs.__pos_; | |
| 502 | return __deque_block_range(__pos_.__ptr_, __end_.__ptr_); | |
| 1017 | 503 | } |
| 1018 | friend bool operator!=(__deque_range const& __lhs, __deque_range const& __rhs) { | |
| 1019 | return !(__lhs == __rhs); | |
| 1020 | } | |
| 1021 | }; | |
| 1022 | ||
| 1023 | ||
| 1024 | ||
| 1025 | struct _ConstructTransaction { | |
| 1026 | _ConstructTransaction(__deque_base* __db, __deque_block_range& __r) | |
| 1027 | : __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {} | |
| 1028 | ||
| 504 | return __deque_block_range(__pos_.__ptr_, *__pos_.__m_iter_ + __block_size); | |
| 505 | } | |
| 1029 | 506 | |
| 1030 | ~_ConstructTransaction() { | |
| 1031 | __base_->size() += (__pos_ - __begin_); | |
| 507 | _LIBCPP_HIDE_FROM_ABI __deque_range& operator++() _NOEXCEPT { | |
| 508 | if (__pos_.__m_iter_ == __end_.__m_iter_) { | |
| 509 | __pos_ = __end_; | |
| 510 | } else { | |
| 511 | ++__pos_.__m_iter_; | |
| 512 | __pos_.__ptr_ = *__pos_.__m_iter_; | |
| 1032 | 513 | } |
| 1033 | ||
| 1034 | pointer __pos_; | |
| 1035 | const pointer __end_; | |
| 1036 | private: | |
| 1037 | const pointer __begin_; | |
| 1038 | __deque_base * const __base_; | |
| 1039 | }; | |
| 1040 | ||
| 1041 | protected: | |
| 1042 | __map __map_; | |
| 1043 | size_type __start_; | |
| 1044 | __compressed_pair<size_type, allocator_type> __size_; | |
| 1045 | ||
| 1046 | iterator begin() _NOEXCEPT; | |
| 1047 | const_iterator begin() const _NOEXCEPT; | |
| 1048 | iterator end() _NOEXCEPT; | |
| 1049 | const_iterator end() const _NOEXCEPT; | |
| 1050 | ||
| 1051 | _LIBCPP_INLINE_VISIBILITY size_type& size() {return __size_.first();} | |
| 1052 | _LIBCPP_INLINE_VISIBILITY | |
| 1053 | const size_type& size() const _NOEXCEPT {return __size_.first();} | |
| 1054 | _LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() {return __size_.second();} | |
| 1055 | _LIBCPP_INLINE_VISIBILITY | |
| 1056 | const allocator_type& __alloc() const _NOEXCEPT {return __size_.second();} | |
| 1057 | ||
| 1058 | _LIBCPP_INLINE_VISIBILITY | |
| 1059 | __deque_base() | |
| 1060 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value); | |
| 1061 | _LIBCPP_INLINE_VISIBILITY | |
| 1062 | explicit __deque_base(const allocator_type& __a); | |
| 1063 | public: | |
| 1064 | ~__deque_base(); | |
| 1065 | ||
| 1066 | #ifndef _LIBCPP_CXX03_LANG | |
| 1067 | __deque_base(__deque_base&& __c) | |
| 1068 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); | |
| 1069 | __deque_base(__deque_base&& __c, const allocator_type& __a); | |
| 1070 | #endif // _LIBCPP_CXX03_LANG | |
| 1071 | ||
| 1072 | void swap(__deque_base& __c) | |
| 1073 | #if _LIBCPP_STD_VER >= 14 | |
| 1074 | _NOEXCEPT; | |
| 1075 | #else | |
| 1076 | _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || | |
| 1077 | __is_nothrow_swappable<allocator_type>::value); | |
| 1078 | #endif | |
| 1079 | protected: | |
| 1080 | void clear() _NOEXCEPT; | |
| 1081 | ||
| 1082 | bool __invariants() const; | |
| 1083 | ||
| 1084 | _LIBCPP_INLINE_VISIBILITY | |
| 1085 | void __move_assign(__deque_base& __c) | |
| 1086 | _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value && | |
| 1087 | is_nothrow_move_assignable<allocator_type>::value) | |
| 1088 | { | |
| 1089 | __map_ = _VSTD::move(__c.__map_); | |
| 1090 | __start_ = __c.__start_; | |
| 1091 | size() = __c.size(); | |
| 1092 | __move_assign_alloc(__c); | |
| 1093 | __c.__start_ = __c.size() = 0; | |
| 514 | return *this; | |
| 1094 | 515 | } |
| 1095 | 516 | |
| 1096 | _LIBCPP_INLINE_VISIBILITY | |
| 1097 | void __move_assign_alloc(__deque_base& __c) | |
| 1098 | _NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value || | |
| 1099 | is_nothrow_move_assignable<allocator_type>::value) | |
| 1100 | {__move_assign_alloc(__c, integral_constant<bool, | |
| 1101 | __alloc_traits::propagate_on_container_move_assignment::value>());} | |
| 1102 | 517 | |
| 1103 | private: | |
| 1104 | _LIBCPP_INLINE_VISIBILITY | |
| 1105 | void __move_assign_alloc(__deque_base& __c, true_type) | |
| 1106 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) | |
| 1107 | { | |
| 1108 | __alloc() = _VSTD::move(__c.__alloc()); | |
| 1109 | } | |
| 1110 | ||
| 1111 | _LIBCPP_INLINE_VISIBILITY | |
| 1112 | void __move_assign_alloc(__deque_base&, false_type) _NOEXCEPT | |
| 1113 | {} | |
| 1114 | }; | |
| 1115 | ||
| 1116 | template <class _Tp, class _Allocator> | |
| 1117 | const typename __deque_base<_Tp, _Allocator>::difference_type | |
| 1118 | __deque_base<_Tp, _Allocator>::__block_size = | |
| 1119 | __deque_block_size<value_type, difference_type>::value; | |
| 1120 | ||
| 1121 | template <class _Tp, class _Allocator> | |
| 1122 | bool | |
| 1123 | __deque_base<_Tp, _Allocator>::__invariants() const | |
| 1124 | { | |
| 1125 | if (!__map_.__invariants()) | |
| 1126 | return false; | |
| 1127 | if (__map_.size() >= size_type(-1) / __block_size) | |
| 1128 | return false; | |
| 1129 | for (typename __map::const_iterator __i = __map_.begin(), __e = __map_.end(); | |
| 1130 | __i != __e; ++__i) | |
| 1131 | if (*__i == nullptr) | |
| 1132 | return false; | |
| 1133 | if (__map_.size() != 0) | |
| 1134 | { | |
| 1135 | if (size() >= __map_.size() * __block_size) | |
| 1136 | return false; | |
| 1137 | if (__start_ >= __map_.size() * __block_size - size()) | |
| 1138 | return false; | |
| 518 | _LIBCPP_HIDE_FROM_ABI friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) { | |
| 519 | return __lhs.__pos_ == __rhs.__pos_; | |
| 1139 | 520 | } |
| 1140 | else | |
| 1141 | { | |
| 1142 | if (size() != 0) | |
| 1143 | return false; | |
| 1144 | if (__start_ != 0) | |
| 1145 | return false; | |
| 521 | _LIBCPP_HIDE_FROM_ABI friend bool operator!=(__deque_range const& __lhs, __deque_range const& __rhs) { | |
| 522 | return !(__lhs == __rhs); | |
| 1146 | 523 | } |
| 1147 | return true; | |
| 1148 | } | |
| 1149 | ||
| 1150 | template <class _Tp, class _Allocator> | |
| 1151 | typename __deque_base<_Tp, _Allocator>::iterator | |
| 1152 | __deque_base<_Tp, _Allocator>::begin() _NOEXCEPT | |
| 1153 | { | |
| 1154 | __map_pointer __mp = __map_.begin() + __start_ / __block_size; | |
| 1155 | return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); | |
| 1156 | } | |
| 1157 | ||
| 1158 | template <class _Tp, class _Allocator> | |
| 1159 | typename __deque_base<_Tp, _Allocator>::const_iterator | |
| 1160 | __deque_base<_Tp, _Allocator>::begin() const _NOEXCEPT | |
| 1161 | { | |
| 1162 | __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size); | |
| 1163 | return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); | |
| 1164 | } | |
| 1165 | ||
| 1166 | template <class _Tp, class _Allocator> | |
| 1167 | typename __deque_base<_Tp, _Allocator>::iterator | |
| 1168 | __deque_base<_Tp, _Allocator>::end() _NOEXCEPT | |
| 1169 | { | |
| 1170 | size_type __p = size() + __start_; | |
| 1171 | __map_pointer __mp = __map_.begin() + __p / __block_size; | |
| 1172 | return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); | |
| 1173 | } | |
| 1174 | ||
| 1175 | template <class _Tp, class _Allocator> | |
| 1176 | typename __deque_base<_Tp, _Allocator>::const_iterator | |
| 1177 | __deque_base<_Tp, _Allocator>::end() const _NOEXCEPT | |
| 1178 | { | |
| 1179 | size_type __p = size() + __start_; | |
| 1180 | __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size); | |
| 1181 | return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); | |
| 1182 | } | |
| 1183 | ||
| 1184 | template <class _Tp, class _Allocator> | |
| 1185 | inline | |
| 1186 | __deque_base<_Tp, _Allocator>::__deque_base() | |
| 1187 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) | |
| 1188 | : __start_(0), __size_(0, __default_init_tag()) {} | |
| 1189 | ||
| 1190 | template <class _Tp, class _Allocator> | |
| 1191 | inline | |
| 1192 | __deque_base<_Tp, _Allocator>::__deque_base(const allocator_type& __a) | |
| 1193 | : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {} | |
| 524 | }; | |
| 1194 | 525 | |
| 1195 | template <class _Tp, class _Allocator> | |
| 1196 | __deque_base<_Tp, _Allocator>::~__deque_base() | |
| 1197 | { | |
| 1198 | clear(); | |
| 1199 | typename __map::iterator __i = __map_.begin(); | |
| 1200 | typename __map::iterator __e = __map_.end(); | |
| 1201 | for (; __i != __e; ++__i) | |
| 1202 | __alloc_traits::deallocate(__alloc(), *__i, __block_size); | |
| 1203 | } | |
| 526 | struct _ConstructTransaction { | |
| 527 | _LIBCPP_HIDE_FROM_ABI _ConstructTransaction(deque* __db, __deque_block_range& __r) | |
| 528 | : __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {} | |
| 1204 | 529 | |
| 1205 | #ifndef _LIBCPP_CXX03_LANG | |
| 1206 | 530 | |
| 1207 | template <class _Tp, class _Allocator> | |
| 1208 | __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c) | |
| 1209 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) | |
| 1210 | : __map_(_VSTD::move(__c.__map_)), | |
| 1211 | __start_(_VSTD::move(__c.__start_)), | |
| 1212 | __size_(_VSTD::move(__c.__size_)) | |
| 1213 | { | |
| 1214 | __c.__start_ = 0; | |
| 1215 | __c.size() = 0; | |
| 1216 | } | |
| 1217 | ||
| 1218 | template <class _Tp, class _Allocator> | |
| 1219 | __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_type& __a) | |
| 1220 | : __map_(_VSTD::move(__c.__map_), __pointer_allocator(__a)), | |
| 1221 | __start_(_VSTD::move(__c.__start_)), | |
| 1222 | __size_(_VSTD::move(__c.size()), __a) | |
| 1223 | { | |
| 1224 | if (__a == __c.__alloc()) | |
| 1225 | { | |
| 1226 | __c.__start_ = 0; | |
| 1227 | __c.size() = 0; | |
| 531 | _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { | |
| 532 | __base_->__size() += (__pos_ - __begin_); | |
| 1228 | 533 | } |
| 1229 | else | |
| 1230 | { | |
| 1231 | __map_.clear(); | |
| 1232 | __start_ = 0; | |
| 1233 | size() = 0; | |
| 1234 | } | |
| 1235 | } | |
| 1236 | 534 | |
| 1237 | #endif // _LIBCPP_CXX03_LANG | |
| 535 | pointer __pos_; | |
| 536 | const pointer __end_; | |
| 537 | private: | |
| 538 | const pointer __begin_; | |
| 539 | deque* const __base_; | |
| 540 | }; | |
| 1238 | 541 | |
| 1239 | template <class _Tp, class _Allocator> | |
| 1240 | void | |
| 1241 | __deque_base<_Tp, _Allocator>::swap(__deque_base& __c) | |
| 1242 | #if _LIBCPP_STD_VER >= 14 | |
| 1243 | _NOEXCEPT | |
| 1244 | #else | |
| 1245 | _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || | |
| 1246 | __is_nothrow_swappable<allocator_type>::value) | |
| 1247 | #endif | |
| 1248 | { | |
| 1249 | __map_.swap(__c.__map_); | |
| 1250 | _VSTD::swap(__start_, __c.__start_); | |
| 1251 | _VSTD::swap(size(), __c.size()); | |
| 1252 | _VSTD::__swap_allocator(__alloc(), __c.__alloc()); | |
| 1253 | } | |
| 542 | static const difference_type __block_size; | |
| 1254 | 543 | |
| 1255 | template <class _Tp, class _Allocator> | |
| 1256 | void | |
| 1257 | __deque_base<_Tp, _Allocator>::clear() _NOEXCEPT | |
| 1258 | { | |
| 1259 | allocator_type& __a = __alloc(); | |
| 1260 | for (iterator __i = begin(), __e = end(); __i != __e; ++__i) | |
| 1261 | __alloc_traits::destroy(__a, _VSTD::addressof(*__i)); | |
| 1262 | size() = 0; | |
| 1263 | while (__map_.size() > 2) | |
| 1264 | { | |
| 1265 | __alloc_traits::deallocate(__a, __map_.front(), __block_size); | |
| 1266 | __map_.pop_front(); | |
| 1267 | } | |
| 1268 | switch (__map_.size()) | |
| 1269 | { | |
| 1270 | case 1: | |
| 1271 | __start_ = __block_size / 2; | |
| 1272 | break; | |
| 1273 | case 2: | |
| 1274 | __start_ = __block_size; | |
| 1275 | break; | |
| 1276 | } | |
| 1277 | } | |
| 544 | __map __map_; | |
| 545 | size_type __start_; | |
| 546 | __compressed_pair<size_type, allocator_type> __size_; | |
| 1278 | 547 | |
| 1279 | template <class _Tp, class _Allocator /*= allocator<_Tp>*/> | |
| 1280 | class _LIBCPP_TEMPLATE_VIS deque | |
| 1281 | : private __deque_base<_Tp, _Allocator> | |
| 1282 | { | |
| 1283 | 548 | public: |
| 1284 | // types: | |
| 1285 | ||
| 1286 | typedef _Tp value_type; | |
| 1287 | typedef _Allocator allocator_type; | |
| 1288 | 549 | |
| 1289 | static_assert((is_same<typename allocator_type::value_type, value_type>::value), | |
| 1290 | "Allocator::value_type must be same type as value_type"); | |
| 1291 | ||
| 1292 | typedef __deque_base<value_type, allocator_type> __base; | |
| 1293 | ||
| 1294 | typedef typename __base::__alloc_traits __alloc_traits; | |
| 1295 | typedef typename __base::reference reference; | |
| 1296 | typedef typename __base::const_reference const_reference; | |
| 1297 | typedef typename __base::iterator iterator; | |
| 1298 | typedef typename __base::const_iterator const_iterator; | |
| 1299 | typedef typename __base::size_type size_type; | |
| 1300 | typedef typename __base::difference_type difference_type; | |
| 550 | // construct/copy/destroy: | |
| 551 | _LIBCPP_HIDE_FROM_ABI | |
| 552 | deque() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) | |
| 553 | : __start_(0), __size_(0, __default_init_tag()) {} | |
| 1301 | 554 | |
| 1302 | typedef typename __base::pointer pointer; | |
| 1303 | typedef typename __base::const_pointer const_pointer; | |
| 1304 | typedef _VSTD::reverse_iterator<iterator> reverse_iterator; | |
| 1305 | typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; | |
| 555 | _LIBCPP_HIDE_FROM_ABI ~deque() { | |
| 556 | clear(); | |
| 557 | typename __map::iterator __i = __map_.begin(); | |
| 558 | typename __map::iterator __e = __map_.end(); | |
| 559 | for (; __i != __e; ++__i) | |
| 560 | __alloc_traits::deallocate(__alloc(), *__i, __block_size); | |
| 561 | } | |
| 1306 | 562 | |
| 1307 | using typename __base::__deque_range; | |
| 1308 | using typename __base::__deque_block_range; | |
| 1309 | using typename __base::_ConstructTransaction; | |
| 563 | _LIBCPP_HIDE_FROM_ABI explicit deque(const allocator_type& __a) | |
| 564 | : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {} | |
| 1310 | 565 | |
| 1311 | // construct/copy/destroy: | |
| 1312 | _LIBCPP_INLINE_VISIBILITY | |
| 1313 | deque() | |
| 1314 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) | |
| 1315 | {} | |
| 1316 | _LIBCPP_INLINE_VISIBILITY explicit deque(const allocator_type& __a) : __base(__a) {} | |
| 1317 | explicit deque(size_type __n); | |
| 566 | explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n); | |
| 1318 | 567 | #if _LIBCPP_STD_VER > 11 |
| 1319 | explicit deque(size_type __n, const _Allocator& __a); | |
| 568 | explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const _Allocator& __a); | |
| 1320 | 569 | #endif |
| 1321 | deque(size_type __n, const value_type& __v); | |
| 570 | _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v); | |
| 1322 | 571 | |
| 1323 | 572 | template <class = __enable_if_t<__is_allocator<_Allocator>::value> > |
| 1324 | deque(size_type __n, const value_type& __v, const allocator_type& __a) : __base(__a) | |
| 573 | _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v, const allocator_type& __a) | |
| 574 | : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) | |
| 1325 | 575 | { |
| 1326 | 576 | if (__n > 0) |
| 1327 | 577 | __append(__n, __v); |
| 1328 | 578 | } |
| 1329 | 579 | |
| 1330 | 580 | template <class _InputIter> |
| 1331 | deque(_InputIter __f, _InputIter __l, | |
| 581 | _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l, | |
| 1332 | 582 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type* = 0); |
| 1333 | 583 | template <class _InputIter> |
| 1334 | deque(_InputIter __f, _InputIter __l, const allocator_type& __a, | |
| 584 | _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l, const allocator_type& __a, | |
| 1335 | 585 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type* = 0); |
| 1336 | deque(const deque& __c); | |
| 1337 | deque(const deque& __c, const __type_identity_t<allocator_type>& __a); | |
| 586 | _LIBCPP_HIDE_FROM_ABI deque(const deque& __c); | |
| 587 | _LIBCPP_HIDE_FROM_ABI deque(const deque& __c, const __type_identity_t<allocator_type>& __a); | |
| 1338 | 588 | |
| 1339 | deque& operator=(const deque& __c); | |
| 589 | _LIBCPP_HIDE_FROM_ABI deque& operator=(const deque& __c); | |
| 1340 | 590 | |
| 1341 | 591 | #ifndef _LIBCPP_CXX03_LANG |
| 1342 | deque(initializer_list<value_type> __il); | |
| 1343 | deque(initializer_list<value_type> __il, const allocator_type& __a); | |
| 592 | _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il); | |
| 593 | _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il, const allocator_type& __a); | |
| 1344 | 594 | |
| 1345 | _LIBCPP_INLINE_VISIBILITY | |
| 595 | _LIBCPP_HIDE_FROM_ABI | |
| 1346 | 596 | deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;} |
| 1347 | 597 | |
| 1348 | _LIBCPP_INLINE_VISIBILITY | |
| 1349 | deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value); | |
| 1350 | _LIBCPP_INLINE_VISIBILITY | |
| 598 | _LIBCPP_HIDE_FROM_ABI | |
| 599 | deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); | |
| 600 | _LIBCPP_HIDE_FROM_ABI | |
| 1351 | 601 | deque(deque&& __c, const __type_identity_t<allocator_type>& __a); |
| 1352 | _LIBCPP_INLINE_VISIBILITY | |
| 602 | _LIBCPP_HIDE_FROM_ABI | |
| 1353 | 603 | deque& operator=(deque&& __c) |
| 1354 | 604 | _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value && |
| 1355 | 605 | is_nothrow_move_assignable<allocator_type>::value); |
| 1356 | 606 | |
| 1357 | _LIBCPP_INLINE_VISIBILITY | |
| 607 | _LIBCPP_HIDE_FROM_ABI | |
| 1358 | 608 | void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());} |
| 1359 | 609 | #endif // _LIBCPP_CXX03_LANG |
| 1360 | 610 | |
| 1361 | 611 | template <class _InputIter> |
| 1362 | void assign(_InputIter __f, _InputIter __l, | |
| 612 | _LIBCPP_HIDE_FROM_ABI void assign(_InputIter __f, _InputIter __l, | |
| 1363 | 613 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value && |
| 1364 | 614 | !__is_cpp17_random_access_iterator<_InputIter>::value>::type* = 0); |
| 1365 | 615 | template <class _RAIter> |
| 1366 | void assign(_RAIter __f, _RAIter __l, | |
| 616 | _LIBCPP_HIDE_FROM_ABI void assign(_RAIter __f, _RAIter __l, | |
| 1367 | 617 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); |
| 1368 | void assign(size_type __n, const value_type& __v); | |
| 618 | _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v); | |
| 1369 | 619 | |
| 1370 | _LIBCPP_INLINE_VISIBILITY | |
| 620 | _LIBCPP_HIDE_FROM_ABI | |
| 1371 | 621 | allocator_type get_allocator() const _NOEXCEPT; |
| 1372 | ||
| 1373 | // iterators: | |
| 1374 | ||
| 1375 | _LIBCPP_INLINE_VISIBILITY | |
| 1376 | iterator begin() _NOEXCEPT {return __base::begin();} | |
| 1377 | _LIBCPP_INLINE_VISIBILITY | |
| 1378 | const_iterator begin() const _NOEXCEPT {return __base::begin();} | |
| 1379 | _LIBCPP_INLINE_VISIBILITY | |
| 1380 | iterator end() _NOEXCEPT {return __base::end();} | |
| 1381 | _LIBCPP_INLINE_VISIBILITY | |
| 1382 | const_iterator end() const _NOEXCEPT {return __base::end();} | |
| 1383 | ||
| 1384 | _LIBCPP_INLINE_VISIBILITY | |
| 622 | _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __size_.second(); } | |
| 623 | _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __size_.second(); } | |
| 624 | ||
| 625 | // iterators: | |
| 626 | ||
| 627 | _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { | |
| 628 | __map_pointer __mp = __map_.begin() + __start_ / __block_size; | |
| 629 | return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); | |
| 630 | } | |
| 631 | ||
| 632 | _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { | |
| 633 | __map_const_pointer __mp = | |
| 634 | static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size); | |
| 635 | return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); | |
| 636 | } | |
| 637 | ||
| 638 | _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { | |
| 639 | size_type __p = size() + __start_; | |
| 640 | __map_pointer __mp = __map_.begin() + __p / __block_size; | |
| 641 | return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); | |
| 642 | } | |
| 643 | ||
| 644 | _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { | |
| 645 | size_type __p = size() + __start_; | |
| 646 | __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size); | |
| 647 | return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); | |
| 648 | } | |
| 649 | ||
| 650 | _LIBCPP_HIDE_FROM_ABI | |
| 1385 | 651 | reverse_iterator rbegin() _NOEXCEPT |
| 1386 | {return reverse_iterator(__base::end());} | |
| 1387 | _LIBCPP_INLINE_VISIBILITY | |
| 652 | {return reverse_iterator(end());} | |
| 653 | _LIBCPP_HIDE_FROM_ABI | |
| 1388 | 654 | const_reverse_iterator rbegin() const _NOEXCEPT |
| 1389 | {return const_reverse_iterator(__base::end());} | |
| 1390 | _LIBCPP_INLINE_VISIBILITY | |
| 655 | {return const_reverse_iterator(end());} | |
| 656 | _LIBCPP_HIDE_FROM_ABI | |
| 1391 | 657 | reverse_iterator rend() _NOEXCEPT |
| 1392 | {return reverse_iterator(__base::begin());} | |
| 1393 | _LIBCPP_INLINE_VISIBILITY | |
| 658 | {return reverse_iterator(begin());} | |
| 659 | _LIBCPP_HIDE_FROM_ABI | |
| 1394 | 660 | const_reverse_iterator rend() const _NOEXCEPT |
| 1395 | {return const_reverse_iterator(__base::begin());} | |
| 661 | {return const_reverse_iterator(begin());} | |
| 1396 | 662 | |
| 1397 | _LIBCPP_INLINE_VISIBILITY | |
| 663 | _LIBCPP_HIDE_FROM_ABI | |
| 1398 | 664 | const_iterator cbegin() const _NOEXCEPT |
| 1399 | {return __base::begin();} | |
| 1400 | _LIBCPP_INLINE_VISIBILITY | |
| 665 | {return begin();} | |
| 666 | _LIBCPP_HIDE_FROM_ABI | |
| 1401 | 667 | const_iterator cend() const _NOEXCEPT |
| 1402 | {return __base::end();} | |
| 1403 | _LIBCPP_INLINE_VISIBILITY | |
| 668 | {return end();} | |
| 669 | _LIBCPP_HIDE_FROM_ABI | |
| 1404 | 670 | const_reverse_iterator crbegin() const _NOEXCEPT |
| 1405 | {return const_reverse_iterator(__base::end());} | |
| 1406 | _LIBCPP_INLINE_VISIBILITY | |
| 671 | {return const_reverse_iterator(end());} | |
| 672 | _LIBCPP_HIDE_FROM_ABI | |
| 1407 | 673 | const_reverse_iterator crend() const _NOEXCEPT |
| 1408 | {return const_reverse_iterator(__base::begin());} | |
| 674 | {return const_reverse_iterator(begin());} | |
| 1409 | 675 | |
| 1410 | 676 | // capacity: |
| 1411 | _LIBCPP_INLINE_VISIBILITY | |
| 1412 | size_type size() const _NOEXCEPT {return __base::size();} | |
| 1413 | _LIBCPP_INLINE_VISIBILITY | |
| 677 | _LIBCPP_HIDE_FROM_ABI | |
| 678 | size_type size() const _NOEXCEPT {return __size();} | |
| 679 | ||
| 680 | _LIBCPP_HIDE_FROM_ABI size_type& __size() _NOEXCEPT { return __size_.first(); } | |
| 681 | _LIBCPP_HIDE_FROM_ABI const size_type& __size() const _NOEXCEPT { return __size_.first(); } | |
| 682 | ||
| 683 | _LIBCPP_HIDE_FROM_ABI | |
| 1414 | 684 | size_type max_size() const _NOEXCEPT |
| 1415 | 685 | {return _VSTD::min<size_type>( |
| 1416 | __alloc_traits::max_size(__base::__alloc()), | |
| 686 | __alloc_traits::max_size(__alloc()), | |
| 1417 | 687 | numeric_limits<difference_type>::max());} |
| 1418 | void resize(size_type __n); | |
| 1419 | void resize(size_type __n, const value_type& __v); | |
| 1420 | void shrink_to_fit() _NOEXCEPT; | |
| 1421 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 1422 | bool empty() const _NOEXCEPT {return __base::size() == 0;} | |
| 688 | _LIBCPP_HIDE_FROM_ABI void resize(size_type __n); | |
| 689 | _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v); | |
| 690 | _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT; | |
| 691 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 692 | bool empty() const _NOEXCEPT {return size() == 0;} | |
| 1423 | 693 | |
| 1424 | 694 | // element access: |
| 1425 | _LIBCPP_INLINE_VISIBILITY | |
| 695 | _LIBCPP_HIDE_FROM_ABI | |
| 1426 | 696 | reference operator[](size_type __i) _NOEXCEPT; |
| 1427 | _LIBCPP_INLINE_VISIBILITY | |
| 697 | _LIBCPP_HIDE_FROM_ABI | |
| 1428 | 698 | const_reference operator[](size_type __i) const _NOEXCEPT; |
| 1429 | _LIBCPP_INLINE_VISIBILITY | |
| 699 | _LIBCPP_HIDE_FROM_ABI | |
| 1430 | 700 | reference at(size_type __i); |
| 1431 | _LIBCPP_INLINE_VISIBILITY | |
| 701 | _LIBCPP_HIDE_FROM_ABI | |
| 1432 | 702 | const_reference at(size_type __i) const; |
| 1433 | _LIBCPP_INLINE_VISIBILITY | |
| 703 | _LIBCPP_HIDE_FROM_ABI | |
| 1434 | 704 | reference front() _NOEXCEPT; |
| 1435 | _LIBCPP_INLINE_VISIBILITY | |
| 705 | _LIBCPP_HIDE_FROM_ABI | |
| 1436 | 706 | const_reference front() const _NOEXCEPT; |
| 1437 | _LIBCPP_INLINE_VISIBILITY | |
| 707 | _LIBCPP_HIDE_FROM_ABI | |
| 1438 | 708 | reference back() _NOEXCEPT; |
| 1439 | _LIBCPP_INLINE_VISIBILITY | |
| 709 | _LIBCPP_HIDE_FROM_ABI | |
| 1440 | 710 | const_reference back() const _NOEXCEPT; |
| 1441 | 711 | |
| 1442 | 712 | // 23.2.2.3 modifiers: |
| 1443 | void push_front(const value_type& __v); | |
| 1444 | void push_back(const value_type& __v); | |
| 713 | _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v); | |
| 714 | _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __v); | |
| 1445 | 715 | #ifndef _LIBCPP_CXX03_LANG |
| 1446 | 716 | #if _LIBCPP_STD_VER > 14 |
| 1447 | template <class... _Args> reference emplace_front(_Args&&... __args); | |
| 1448 | template <class... _Args> reference emplace_back (_Args&&... __args); | |
| 717 | template <class... _Args> _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args); | |
| 718 | template <class... _Args> _LIBCPP_HIDE_FROM_ABI reference emplace_back (_Args&&... __args); | |
| 1449 | 719 | #else |
| 1450 | template <class... _Args> void emplace_front(_Args&&... __args); | |
| 1451 | template <class... _Args> void emplace_back (_Args&&... __args); | |
| 720 | template <class... _Args> _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args); | |
| 721 | template <class... _Args> _LIBCPP_HIDE_FROM_ABI void emplace_back (_Args&&... __args); | |
| 1452 | 722 | #endif |
| 1453 | template <class... _Args> iterator emplace(const_iterator __p, _Args&&... __args); | |
| 723 | template <class... _Args> _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args); | |
| 1454 | 724 | |
| 1455 | void push_front(value_type&& __v); | |
| 1456 | void push_back(value_type&& __v); | |
| 1457 | iterator insert(const_iterator __p, value_type&& __v); | |
| 725 | _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v); | |
| 726 | _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __v); | |
| 727 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v); | |
| 1458 | 728 | |
| 1459 | _LIBCPP_INLINE_VISIBILITY | |
| 729 | _LIBCPP_HIDE_FROM_ABI | |
| 1460 | 730 | iterator insert(const_iterator __p, initializer_list<value_type> __il) |
| 1461 | 731 | {return insert(__p, __il.begin(), __il.end());} |
| 1462 | 732 | #endif // _LIBCPP_CXX03_LANG |
| 1463 | iterator insert(const_iterator __p, const value_type& __v); | |
| 1464 | iterator insert(const_iterator __p, size_type __n, const value_type& __v); | |
| 733 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v); | |
| 734 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __v); | |
| 1465 | 735 | template <class _InputIter> |
| 1466 | iterator insert(const_iterator __p, _InputIter __f, _InputIter __l, | |
| 736 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _InputIter __f, _InputIter __l, | |
| 1467 | 737 | typename enable_if<__is_exactly_cpp17_input_iterator<_InputIter>::value>::type* = 0); |
| 1468 | 738 | template <class _ForwardIterator> |
| 1469 | iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l, | |
| 739 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l, | |
| 1470 | 740 | typename enable_if<__is_exactly_cpp17_forward_iterator<_ForwardIterator>::value>::type* = 0); |
| 1471 | 741 | template <class _BiIter> |
| 1472 | iterator insert(const_iterator __p, _BiIter __f, _BiIter __l, | |
| 742 | _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _BiIter __f, _BiIter __l, | |
| 1473 | 743 | typename enable_if<__is_cpp17_bidirectional_iterator<_BiIter>::value>::type* = 0); |
| 1474 | 744 | |
| 1475 | void pop_front(); | |
| 1476 | void pop_back(); | |
| 1477 | iterator erase(const_iterator __p); | |
| 1478 | iterator erase(const_iterator __f, const_iterator __l); | |
| 745 | _LIBCPP_HIDE_FROM_ABI void pop_front(); | |
| 746 | _LIBCPP_HIDE_FROM_ABI void pop_back(); | |
| 747 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p); | |
| 748 | _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l); | |
| 1479 | 749 | |
| 1480 | _LIBCPP_INLINE_VISIBILITY | |
| 750 | _LIBCPP_HIDE_FROM_ABI | |
| 1481 | 751 | void swap(deque& __c) |
| 1482 | 752 | #if _LIBCPP_STD_VER >= 14 |
| 1483 | 753 | _NOEXCEPT; |
| ... | ... | @@ -1485,121 +755,177 @@ public: |
| 1485 | 755 | _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || |
| 1486 | 756 | __is_nothrow_swappable<allocator_type>::value); |
| 1487 | 757 | #endif |
| 1488 | _LIBCPP_INLINE_VISIBILITY | |
| 758 | _LIBCPP_HIDE_FROM_ABI | |
| 1489 | 759 | void clear() _NOEXCEPT; |
| 1490 | 760 | |
| 1491 | _LIBCPP_INLINE_VISIBILITY | |
| 1492 | bool __invariants() const {return __base::__invariants();} | |
| 761 | _LIBCPP_HIDE_FROM_ABI | |
| 762 | bool __invariants() const { | |
| 763 | if (!__map_.__invariants()) | |
| 764 | return false; | |
| 765 | if (__map_.size() >= size_type(-1) / __block_size) | |
| 766 | return false; | |
| 767 | for (typename __map::const_iterator __i = __map_.begin(), __e = __map_.end(); | |
| 768 | __i != __e; ++__i) | |
| 769 | if (*__i == nullptr) | |
| 770 | return false; | |
| 771 | if (__map_.size() != 0) | |
| 772 | { | |
| 773 | if (size() >= __map_.size() * __block_size) | |
| 774 | return false; | |
| 775 | if (__start_ >= __map_.size() * __block_size - size()) | |
| 776 | return false; | |
| 777 | } | |
| 778 | else | |
| 779 | { | |
| 780 | if (size() != 0) | |
| 781 | return false; | |
| 782 | if (__start_ != 0) | |
| 783 | return false; | |
| 784 | } | |
| 785 | return true; | |
| 786 | } | |
| 1493 | 787 | |
| 1494 | typedef typename __base::__map_const_pointer __map_const_pointer; | |
| 788 | _LIBCPP_HIDE_FROM_ABI | |
| 789 | void __move_assign_alloc(deque& __c) | |
| 790 | _NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value || | |
| 791 | is_nothrow_move_assignable<allocator_type>::value) | |
| 792 | {__move_assign_alloc(__c, integral_constant<bool, | |
| 793 | __alloc_traits::propagate_on_container_move_assignment::value>());} | |
| 794 | ||
| 795 | _LIBCPP_HIDE_FROM_ABI | |
| 796 | void __move_assign_alloc(deque& __c, true_type) | |
| 797 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) | |
| 798 | { | |
| 799 | __alloc() = _VSTD::move(__c.__alloc()); | |
| 800 | } | |
| 801 | ||
| 802 | _LIBCPP_HIDE_FROM_ABI | |
| 803 | void __move_assign_alloc(deque&, false_type) _NOEXCEPT | |
| 804 | {} | |
| 805 | ||
| 806 | _LIBCPP_HIDE_FROM_ABI | |
| 807 | void __move_assign(deque& __c) | |
| 808 | _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value && | |
| 809 | is_nothrow_move_assignable<allocator_type>::value) | |
| 810 | { | |
| 811 | __map_ = _VSTD::move(__c.__map_); | |
| 812 | __start_ = __c.__start_; | |
| 813 | __size() = __c.size(); | |
| 814 | __move_assign_alloc(__c); | |
| 815 | __c.__start_ = __c.__size() = 0; | |
| 816 | } | |
| 1495 | 817 | |
| 1496 | _LIBCPP_INLINE_VISIBILITY | |
| 818 | _LIBCPP_HIDE_FROM_ABI | |
| 1497 | 819 | static size_type __recommend_blocks(size_type __n) |
| 1498 | 820 | { |
| 1499 | return __n / __base::__block_size + (__n % __base::__block_size != 0); | |
| 821 | return __n / __block_size + (__n % __block_size != 0); | |
| 1500 | 822 | } |
| 1501 | _LIBCPP_INLINE_VISIBILITY | |
| 823 | _LIBCPP_HIDE_FROM_ABI | |
| 1502 | 824 | size_type __capacity() const |
| 1503 | 825 | { |
| 1504 | return __base::__map_.size() == 0 ? 0 : __base::__map_.size() * __base::__block_size - 1; | |
| 826 | return __map_.size() == 0 ? 0 : __map_.size() * __block_size - 1; | |
| 1505 | 827 | } |
| 1506 | _LIBCPP_INLINE_VISIBILITY | |
| 828 | _LIBCPP_HIDE_FROM_ABI | |
| 1507 | 829 | size_type __block_count() const |
| 1508 | 830 | { |
| 1509 | return __base::__map_.size(); | |
| 831 | return __map_.size(); | |
| 1510 | 832 | } |
| 1511 | 833 | |
| 1512 | _LIBCPP_INLINE_VISIBILITY | |
| 834 | _LIBCPP_HIDE_FROM_ABI | |
| 1513 | 835 | size_type __front_spare() const |
| 1514 | 836 | { |
| 1515 | return __base::__start_; | |
| 837 | return __start_; | |
| 1516 | 838 | } |
| 1517 | _LIBCPP_INLINE_VISIBILITY | |
| 839 | _LIBCPP_HIDE_FROM_ABI | |
| 1518 | 840 | size_type __front_spare_blocks() const { |
| 1519 | return __front_spare() / __base::__block_size; | |
| 841 | return __front_spare() / __block_size; | |
| 1520 | 842 | } |
| 1521 | _LIBCPP_INLINE_VISIBILITY | |
| 843 | _LIBCPP_HIDE_FROM_ABI | |
| 1522 | 844 | size_type __back_spare() const |
| 1523 | 845 | { |
| 1524 | return __capacity() - (__base::__start_ + __base::size()); | |
| 846 | return __capacity() - (__start_ + size()); | |
| 1525 | 847 | } |
| 1526 | _LIBCPP_INLINE_VISIBILITY | |
| 848 | _LIBCPP_HIDE_FROM_ABI | |
| 1527 | 849 | size_type __back_spare_blocks() const { |
| 1528 | return __back_spare() / __base::__block_size; | |
| 850 | return __back_spare() / __block_size; | |
| 1529 | 851 | } |
| 1530 | 852 | |
| 1531 | 853 | private: |
| 1532 | _LIBCPP_INLINE_VISIBILITY | |
| 854 | _LIBCPP_HIDE_FROM_ABI | |
| 1533 | 855 | bool __maybe_remove_front_spare(bool __keep_one = true) { |
| 1534 | 856 | if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) { |
| 1535 | __alloc_traits::deallocate(__base::__alloc(), __base::__map_.front(), | |
| 1536 | __base::__block_size); | |
| 1537 | __base::__map_.pop_front(); | |
| 1538 | __base::__start_ -= __base::__block_size; | |
| 857 | __alloc_traits::deallocate(__alloc(), __map_.front(), | |
| 858 | __block_size); | |
| 859 | __map_.pop_front(); | |
| 860 | __start_ -= __block_size; | |
| 1539 | 861 | return true; |
| 1540 | 862 | } |
| 1541 | 863 | return false; |
| 1542 | 864 | } |
| 1543 | 865 | |
| 1544 | _LIBCPP_INLINE_VISIBILITY | |
| 866 | _LIBCPP_HIDE_FROM_ABI | |
| 1545 | 867 | bool __maybe_remove_back_spare(bool __keep_one = true) { |
| 1546 | 868 | if (__back_spare_blocks() >= 2 || (!__keep_one && __back_spare_blocks())) { |
| 1547 | __alloc_traits::deallocate(__base::__alloc(), __base::__map_.back(), | |
| 1548 | __base::__block_size); | |
| 1549 | __base::__map_.pop_back(); | |
| 869 | __alloc_traits::deallocate(__alloc(), __map_.back(), | |
| 870 | __block_size); | |
| 871 | __map_.pop_back(); | |
| 1550 | 872 | return true; |
| 1551 | 873 | } |
| 1552 | 874 | return false; |
| 1553 | 875 | } |
| 1554 | 876 | |
| 1555 | 877 | template <class _InpIter> |
| 1556 | void __append(_InpIter __f, _InpIter __l, | |
| 878 | _LIBCPP_HIDE_FROM_ABI void __append(_InpIter __f, _InpIter __l, | |
| 1557 | 879 | typename enable_if<__is_exactly_cpp17_input_iterator<_InpIter>::value>::type* = 0); |
| 1558 | 880 | template <class _ForIter> |
| 1559 | void __append(_ForIter __f, _ForIter __l, | |
| 881 | _LIBCPP_HIDE_FROM_ABI void __append(_ForIter __f, _ForIter __l, | |
| 1560 | 882 | typename enable_if<__is_cpp17_forward_iterator<_ForIter>::value>::type* = 0); |
| 1561 | void __append(size_type __n); | |
| 1562 | void __append(size_type __n, const value_type& __v); | |
| 1563 | void __erase_to_end(const_iterator __f); | |
| 1564 | void __add_front_capacity(); | |
| 1565 | void __add_front_capacity(size_type __n); | |
| 1566 | void __add_back_capacity(); | |
| 1567 | void __add_back_capacity(size_type __n); | |
| 1568 | iterator __move_and_check(iterator __f, iterator __l, iterator __r, | |
| 883 | _LIBCPP_HIDE_FROM_ABI void __append(size_type __n); | |
| 884 | _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const value_type& __v); | |
| 885 | _LIBCPP_HIDE_FROM_ABI void __erase_to_end(const_iterator __f); | |
| 886 | _LIBCPP_HIDE_FROM_ABI void __add_front_capacity(); | |
| 887 | _LIBCPP_HIDE_FROM_ABI void __add_front_capacity(size_type __n); | |
| 888 | _LIBCPP_HIDE_FROM_ABI void __add_back_capacity(); | |
| 889 | _LIBCPP_HIDE_FROM_ABI void __add_back_capacity(size_type __n); | |
| 890 | _LIBCPP_HIDE_FROM_ABI iterator __move_and_check(iterator __f, iterator __l, iterator __r, | |
| 1569 | 891 | const_pointer& __vt); |
| 1570 | iterator __move_backward_and_check(iterator __f, iterator __l, iterator __r, | |
| 892 | _LIBCPP_HIDE_FROM_ABI iterator __move_backward_and_check(iterator __f, iterator __l, iterator __r, | |
| 1571 | 893 | const_pointer& __vt); |
| 1572 | void __move_construct_and_check(iterator __f, iterator __l, | |
| 894 | _LIBCPP_HIDE_FROM_ABI void __move_construct_and_check(iterator __f, iterator __l, | |
| 1573 | 895 | iterator __r, const_pointer& __vt); |
| 1574 | void __move_construct_backward_and_check(iterator __f, iterator __l, | |
| 896 | _LIBCPP_HIDE_FROM_ABI void __move_construct_backward_and_check(iterator __f, iterator __l, | |
| 1575 | 897 | iterator __r, const_pointer& __vt); |
| 1576 | 898 | |
| 1577 | _LIBCPP_INLINE_VISIBILITY | |
| 899 | _LIBCPP_HIDE_FROM_ABI | |
| 1578 | 900 | void __copy_assign_alloc(const deque& __c) |
| 1579 | 901 | {__copy_assign_alloc(__c, integral_constant<bool, |
| 1580 | 902 | __alloc_traits::propagate_on_container_copy_assignment::value>());} |
| 1581 | 903 | |
| 1582 | _LIBCPP_INLINE_VISIBILITY | |
| 904 | _LIBCPP_HIDE_FROM_ABI | |
| 1583 | 905 | void __copy_assign_alloc(const deque& __c, true_type) |
| 1584 | 906 | { |
| 1585 | if (__base::__alloc() != __c.__alloc()) | |
| 907 | if (__alloc() != __c.__alloc()) | |
| 1586 | 908 | { |
| 1587 | 909 | clear(); |
| 1588 | 910 | shrink_to_fit(); |
| 1589 | 911 | } |
| 1590 | __base::__alloc() = __c.__alloc(); | |
| 1591 | __base::__map_.__alloc() = __c.__map_.__alloc(); | |
| 912 | __alloc() = __c.__alloc(); | |
| 913 | __map_.__alloc() = __c.__map_.__alloc(); | |
| 1592 | 914 | } |
| 1593 | 915 | |
| 1594 | _LIBCPP_INLINE_VISIBILITY | |
| 916 | _LIBCPP_HIDE_FROM_ABI | |
| 1595 | 917 | void __copy_assign_alloc(const deque&, false_type) |
| 1596 | 918 | {} |
| 1597 | 919 | |
| 1598 | void __move_assign(deque& __c, true_type) | |
| 920 | _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, true_type) | |
| 1599 | 921 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value); |
| 1600 | void __move_assign(deque& __c, false_type); | |
| 922 | _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, false_type); | |
| 1601 | 923 | }; |
| 1602 | 924 | |
| 925 | template <class _Tp, class _Alloc> | |
| 926 | _LIBCPP_CONSTEXPR const typename allocator_traits<_Alloc>::difference_type deque<_Tp, _Alloc>::__block_size = | |
| 927 | __deque_block_size<value_type, difference_type>::value; | |
| 928 | ||
| 1603 | 929 | #if _LIBCPP_STD_VER >= 17 |
| 1604 | 930 | template<class _InputIterator, |
| 1605 | 931 | class _Alloc = allocator<__iter_value_type<_InputIterator>>, |
| ... | ... | @@ -1620,6 +946,7 @@ deque(_InputIterator, _InputIterator, _Alloc) |
| 1620 | 946 | |
| 1621 | 947 | template <class _Tp, class _Allocator> |
| 1622 | 948 | deque<_Tp, _Allocator>::deque(size_type __n) |
| 949 | : __start_(0), __size_(0, __default_init_tag()) | |
| 1623 | 950 | { |
| 1624 | 951 | if (__n > 0) |
| 1625 | 952 | __append(__n); |
| ... | ... | @@ -1628,7 +955,7 @@ deque<_Tp, _Allocator>::deque(size_type __n) |
| 1628 | 955 | #if _LIBCPP_STD_VER > 11 |
| 1629 | 956 | template <class _Tp, class _Allocator> |
| 1630 | 957 | deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a) |
| 1631 | : __base(__a) | |
| 958 | : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) | |
| 1632 | 959 | { |
| 1633 | 960 | if (__n > 0) |
| 1634 | 961 | __append(__n); |
| ... | ... | @@ -1637,6 +964,7 @@ deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a) |
| 1637 | 964 | |
| 1638 | 965 | template <class _Tp, class _Allocator> |
| 1639 | 966 | deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) |
| 967 | : __start_(0), __size_(0, __default_init_tag()) | |
| 1640 | 968 | { |
| 1641 | 969 | if (__n > 0) |
| 1642 | 970 | __append(__n, __v); |
| ... | ... | @@ -1646,6 +974,7 @@ template <class _Tp, class _Allocator> |
| 1646 | 974 | template <class _InputIter> |
| 1647 | 975 | deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, |
| 1648 | 976 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type*) |
| 977 | : __start_(0), __size_(0, __default_init_tag()) | |
| 1649 | 978 | { |
| 1650 | 979 | __append(__f, __l); |
| 1651 | 980 | } |
| ... | ... | @@ -1654,21 +983,23 @@ template <class _Tp, class _Allocator> |
| 1654 | 983 | template <class _InputIter> |
| 1655 | 984 | deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a, |
| 1656 | 985 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type*) |
| 1657 | : __base(__a) | |
| 986 | : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) | |
| 1658 | 987 | { |
| 1659 | 988 | __append(__f, __l); |
| 1660 | 989 | } |
| 1661 | 990 | |
| 1662 | 991 | template <class _Tp, class _Allocator> |
| 1663 | 992 | deque<_Tp, _Allocator>::deque(const deque& __c) |
| 1664 | : __base(__alloc_traits::select_on_container_copy_construction(__c.__alloc())) | |
| 993 | : __map_(__pointer_allocator(__alloc_traits::select_on_container_copy_construction(__c.__alloc()))), | |
| 994 | __start_(0), | |
| 995 | __size_(0, __map_.__alloc()) | |
| 1665 | 996 | { |
| 1666 | 997 | __append(__c.begin(), __c.end()); |
| 1667 | 998 | } |
| 1668 | 999 | |
| 1669 | 1000 | template <class _Tp, class _Allocator> |
| 1670 | 1001 | deque<_Tp, _Allocator>::deque(const deque& __c, const __type_identity_t<allocator_type>& __a) |
| 1671 | : __base(__a) | |
| 1002 | : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) | |
| 1672 | 1003 | { |
| 1673 | 1004 | __append(__c.begin(), __c.end()); |
| 1674 | 1005 | } |
| ... | ... | @@ -1689,13 +1020,14 @@ deque<_Tp, _Allocator>::operator=(const deque& __c) |
| 1689 | 1020 | |
| 1690 | 1021 | template <class _Tp, class _Allocator> |
| 1691 | 1022 | deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il) |
| 1023 | : __start_(0), __size_(0, __default_init_tag()) | |
| 1692 | 1024 | { |
| 1693 | 1025 | __append(__il.begin(), __il.end()); |
| 1694 | 1026 | } |
| 1695 | 1027 | |
| 1696 | 1028 | template <class _Tp, class _Allocator> |
| 1697 | 1029 | deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator_type& __a) |
| 1698 | : __base(__a) | |
| 1030 | : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) | |
| 1699 | 1031 | { |
| 1700 | 1032 | __append(__il.begin(), __il.end()); |
| 1701 | 1033 | } |
| ... | ... | @@ -1703,18 +1035,30 @@ deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator |
| 1703 | 1035 | template <class _Tp, class _Allocator> |
| 1704 | 1036 | inline |
| 1705 | 1037 | deque<_Tp, _Allocator>::deque(deque&& __c) |
| 1706 | _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) | |
| 1707 | : __base(_VSTD::move(__c)) | |
| 1038 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) | |
| 1039 | : __map_(std::move(__c.__map_)), __start_(std::move(__c.__start_)), __size_(std::move(__c.__size_)) | |
| 1708 | 1040 | { |
| 1041 | __c.__start_ = 0; | |
| 1042 | __c.__size() = 0; | |
| 1709 | 1043 | } |
| 1710 | 1044 | |
| 1711 | 1045 | template <class _Tp, class _Allocator> |
| 1712 | 1046 | inline |
| 1713 | 1047 | deque<_Tp, _Allocator>::deque(deque&& __c, const __type_identity_t<allocator_type>& __a) |
| 1714 | : __base(_VSTD::move(__c), __a) | |
| 1048 | : __map_(std::move(__c.__map_), __pointer_allocator(__a)), | |
| 1049 | __start_(std::move(__c.__start_)), | |
| 1050 | __size_(std::move(__c.__size()), __a) | |
| 1715 | 1051 | { |
| 1716 | if (__a != __c.__alloc()) | |
| 1052 | if (__a == __c.__alloc()) | |
| 1717 | 1053 | { |
| 1054 | __c.__start_ = 0; | |
| 1055 | __c.__size() = 0; | |
| 1056 | } | |
| 1057 | else | |
| 1058 | { | |
| 1059 | __map_.clear(); | |
| 1060 | __start_ = 0; | |
| 1061 | __size() = 0; | |
| 1718 | 1062 | typedef move_iterator<iterator> _Ip; |
| 1719 | 1063 | assign(_Ip(__c.begin()), _Ip(__c.end())); |
| 1720 | 1064 | } |
| ... | ... | @@ -1736,7 +1080,7 @@ template <class _Tp, class _Allocator> |
| 1736 | 1080 | void |
| 1737 | 1081 | deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type) |
| 1738 | 1082 | { |
| 1739 | if (__base::__alloc() != __c.__alloc()) | |
| 1083 | if (__alloc() != __c.__alloc()) | |
| 1740 | 1084 | { |
| 1741 | 1085 | typedef move_iterator<iterator> _Ip; |
| 1742 | 1086 | assign(_Ip(__c.begin()), _Ip(__c.end())); |
| ... | ... | @@ -1752,7 +1096,7 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type) |
| 1752 | 1096 | { |
| 1753 | 1097 | clear(); |
| 1754 | 1098 | shrink_to_fit(); |
| 1755 | __base::__move_assign(__c); | |
| 1099 | __move_assign(__c); | |
| 1756 | 1100 | } |
| 1757 | 1101 | |
| 1758 | 1102 | #endif // _LIBCPP_CXX03_LANG |
| ... | ... | @@ -1764,8 +1108,8 @@ deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l, |
| 1764 | 1108 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value && |
| 1765 | 1109 | !__is_cpp17_random_access_iterator<_InputIter>::value>::type*) |
| 1766 | 1110 | { |
| 1767 | iterator __i = __base::begin(); | |
| 1768 | iterator __e = __base::end(); | |
| 1111 | iterator __i = begin(); | |
| 1112 | iterator __e = end(); | |
| 1769 | 1113 | for (; __f != __l && __i != __e; ++__f, (void) ++__i) |
| 1770 | 1114 | *__i = *__f; |
| 1771 | 1115 | if (__f != __l) |
| ... | ... | @@ -1780,28 +1124,28 @@ void |
| 1780 | 1124 | deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l, |
| 1781 | 1125 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) |
| 1782 | 1126 | { |
| 1783 | if (static_cast<size_type>(__l - __f) > __base::size()) | |
| 1127 | if (static_cast<size_type>(__l - __f) > size()) | |
| 1784 | 1128 | { |
| 1785 | _RAIter __m = __f + __base::size(); | |
| 1786 | _VSTD::copy(__f, __m, __base::begin()); | |
| 1129 | _RAIter __m = __f + size(); | |
| 1130 | _VSTD::copy(__f, __m, begin()); | |
| 1787 | 1131 | __append(__m, __l); |
| 1788 | 1132 | } |
| 1789 | 1133 | else |
| 1790 | __erase_to_end(_VSTD::copy(__f, __l, __base::begin())); | |
| 1134 | __erase_to_end(_VSTD::copy(__f, __l, begin())); | |
| 1791 | 1135 | } |
| 1792 | 1136 | |
| 1793 | 1137 | template <class _Tp, class _Allocator> |
| 1794 | 1138 | void |
| 1795 | 1139 | deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v) |
| 1796 | 1140 | { |
| 1797 | if (__n > __base::size()) | |
| 1141 | if (__n > size()) | |
| 1798 | 1142 | { |
| 1799 | _VSTD::fill_n(__base::begin(), __base::size(), __v); | |
| 1800 | __n -= __base::size(); | |
| 1143 | _VSTD::fill_n(begin(), size(), __v); | |
| 1144 | __n -= size(); | |
| 1801 | 1145 | __append(__n, __v); |
| 1802 | 1146 | } |
| 1803 | 1147 | else |
| 1804 | __erase_to_end(_VSTD::fill_n(__base::begin(), __n, __v)); | |
| 1148 | __erase_to_end(_VSTD::fill_n(begin(), __n, __v)); | |
| 1805 | 1149 | } |
| 1806 | 1150 | |
| 1807 | 1151 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -1809,49 +1153,49 @@ inline |
| 1809 | 1153 | _Allocator |
| 1810 | 1154 | deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT |
| 1811 | 1155 | { |
| 1812 | return __base::__alloc(); | |
| 1156 | return __alloc(); | |
| 1813 | 1157 | } |
| 1814 | 1158 | |
| 1815 | 1159 | template <class _Tp, class _Allocator> |
| 1816 | 1160 | void |
| 1817 | 1161 | deque<_Tp, _Allocator>::resize(size_type __n) |
| 1818 | 1162 | { |
| 1819 | if (__n > __base::size()) | |
| 1820 | __append(__n - __base::size()); | |
| 1821 | else if (__n < __base::size()) | |
| 1822 | __erase_to_end(__base::begin() + __n); | |
| 1163 | if (__n > size()) | |
| 1164 | __append(__n - size()); | |
| 1165 | else if (__n < size()) | |
| 1166 | __erase_to_end(begin() + __n); | |
| 1823 | 1167 | } |
| 1824 | 1168 | |
| 1825 | 1169 | template <class _Tp, class _Allocator> |
| 1826 | 1170 | void |
| 1827 | 1171 | deque<_Tp, _Allocator>::resize(size_type __n, const value_type& __v) |
| 1828 | 1172 | { |
| 1829 | if (__n > __base::size()) | |
| 1830 | __append(__n - __base::size(), __v); | |
| 1831 | else if (__n < __base::size()) | |
| 1832 | __erase_to_end(__base::begin() + __n); | |
| 1173 | if (__n > size()) | |
| 1174 | __append(__n - size(), __v); | |
| 1175 | else if (__n < size()) | |
| 1176 | __erase_to_end(begin() + __n); | |
| 1833 | 1177 | } |
| 1834 | 1178 | |
| 1835 | 1179 | template <class _Tp, class _Allocator> |
| 1836 | 1180 | void |
| 1837 | 1181 | deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT |
| 1838 | 1182 | { |
| 1839 | allocator_type& __a = __base::__alloc(); | |
| 1183 | allocator_type& __a = __alloc(); | |
| 1840 | 1184 | if (empty()) |
| 1841 | 1185 | { |
| 1842 | while (__base::__map_.size() > 0) | |
| 1186 | while (__map_.size() > 0) | |
| 1843 | 1187 | { |
| 1844 | __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size); | |
| 1845 | __base::__map_.pop_back(); | |
| 1188 | __alloc_traits::deallocate(__a, __map_.back(), __block_size); | |
| 1189 | __map_.pop_back(); | |
| 1846 | 1190 | } |
| 1847 | __base::__start_ = 0; | |
| 1191 | __start_ = 0; | |
| 1848 | 1192 | } |
| 1849 | 1193 | else |
| 1850 | 1194 | { |
| 1851 | 1195 | __maybe_remove_front_spare(/*__keep_one=*/false); |
| 1852 | 1196 | __maybe_remove_back_spare(/*__keep_one=*/false); |
| 1853 | 1197 | } |
| 1854 | __base::__map_.shrink_to_fit(); | |
| 1198 | __map_.shrink_to_fit(); | |
| 1855 | 1199 | } |
| 1856 | 1200 | |
| 1857 | 1201 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -1859,8 +1203,8 @@ inline |
| 1859 | 1203 | typename deque<_Tp, _Allocator>::reference |
| 1860 | 1204 | deque<_Tp, _Allocator>::operator[](size_type __i) _NOEXCEPT |
| 1861 | 1205 | { |
| 1862 | size_type __p = __base::__start_ + __i; | |
| 1863 | return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); | |
| 1206 | size_type __p = __start_ + __i; | |
| 1207 | return *(*(__map_.begin() + __p / __block_size) + __p % __block_size); | |
| 1864 | 1208 | } |
| 1865 | 1209 | |
| 1866 | 1210 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -1868,8 +1212,8 @@ inline |
| 1868 | 1212 | typename deque<_Tp, _Allocator>::const_reference |
| 1869 | 1213 | deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT |
| 1870 | 1214 | { |
| 1871 | size_type __p = __base::__start_ + __i; | |
| 1872 | return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); | |
| 1215 | size_type __p = __start_ + __i; | |
| 1216 | return *(*(__map_.begin() + __p / __block_size) + __p % __block_size); | |
| 1873 | 1217 | } |
| 1874 | 1218 | |
| 1875 | 1219 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -1877,10 +1221,10 @@ inline |
| 1877 | 1221 | typename deque<_Tp, _Allocator>::reference |
| 1878 | 1222 | deque<_Tp, _Allocator>::at(size_type __i) |
| 1879 | 1223 | { |
| 1880 | if (__i >= __base::size()) | |
| 1224 | if (__i >= size()) | |
| 1881 | 1225 | _VSTD::__throw_out_of_range("deque"); |
| 1882 | size_type __p = __base::__start_ + __i; | |
| 1883 | return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); | |
| 1226 | size_type __p = __start_ + __i; | |
| 1227 | return *(*(__map_.begin() + __p / __block_size) + __p % __block_size); | |
| 1884 | 1228 | } |
| 1885 | 1229 | |
| 1886 | 1230 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -1888,10 +1232,10 @@ inline |
| 1888 | 1232 | typename deque<_Tp, _Allocator>::const_reference |
| 1889 | 1233 | deque<_Tp, _Allocator>::at(size_type __i) const |
| 1890 | 1234 | { |
| 1891 | if (__i >= __base::size()) | |
| 1235 | if (__i >= size()) | |
| 1892 | 1236 | _VSTD::__throw_out_of_range("deque"); |
| 1893 | size_type __p = __base::__start_ + __i; | |
| 1894 | return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); | |
| 1237 | size_type __p = __start_ + __i; | |
| 1238 | return *(*(__map_.begin() + __p / __block_size) + __p % __block_size); | |
| 1895 | 1239 | } |
| 1896 | 1240 | |
| 1897 | 1241 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -1899,8 +1243,8 @@ inline |
| 1899 | 1243 | typename deque<_Tp, _Allocator>::reference |
| 1900 | 1244 | deque<_Tp, _Allocator>::front() _NOEXCEPT |
| 1901 | 1245 | { |
| 1902 | return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size) | |
| 1903 | + __base::__start_ % __base::__block_size); | |
| 1246 | return *(*(__map_.begin() + __start_ / __block_size) | |
| 1247 | + __start_ % __block_size); | |
| 1904 | 1248 | } |
| 1905 | 1249 | |
| 1906 | 1250 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -1908,8 +1252,8 @@ inline |
| 1908 | 1252 | typename deque<_Tp, _Allocator>::const_reference |
| 1909 | 1253 | deque<_Tp, _Allocator>::front() const _NOEXCEPT |
| 1910 | 1254 | { |
| 1911 | return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size) | |
| 1912 | + __base::__start_ % __base::__block_size); | |
| 1255 | return *(*(__map_.begin() + __start_ / __block_size) | |
| 1256 | + __start_ % __block_size); | |
| 1913 | 1257 | } |
| 1914 | 1258 | |
| 1915 | 1259 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -1917,8 +1261,8 @@ inline |
| 1917 | 1261 | typename deque<_Tp, _Allocator>::reference |
| 1918 | 1262 | deque<_Tp, _Allocator>::back() _NOEXCEPT |
| 1919 | 1263 | { |
| 1920 | size_type __p = __base::size() + __base::__start_ - 1; | |
| 1921 | return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); | |
| 1264 | size_type __p = size() + __start_ - 1; | |
| 1265 | return *(*(__map_.begin() + __p / __block_size) + __p % __block_size); | |
| 1922 | 1266 | } |
| 1923 | 1267 | |
| 1924 | 1268 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -1926,33 +1270,33 @@ inline |
| 1926 | 1270 | typename deque<_Tp, _Allocator>::const_reference |
| 1927 | 1271 | deque<_Tp, _Allocator>::back() const _NOEXCEPT |
| 1928 | 1272 | { |
| 1929 | size_type __p = __base::size() + __base::__start_ - 1; | |
| 1930 | return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); | |
| 1273 | size_type __p = size() + __start_ - 1; | |
| 1274 | return *(*(__map_.begin() + __p / __block_size) + __p % __block_size); | |
| 1931 | 1275 | } |
| 1932 | 1276 | |
| 1933 | 1277 | template <class _Tp, class _Allocator> |
| 1934 | 1278 | void |
| 1935 | 1279 | deque<_Tp, _Allocator>::push_back(const value_type& __v) |
| 1936 | 1280 | { |
| 1937 | allocator_type& __a = __base::__alloc(); | |
| 1281 | allocator_type& __a = __alloc(); | |
| 1938 | 1282 | if (__back_spare() == 0) |
| 1939 | 1283 | __add_back_capacity(); |
| 1940 | 1284 | // __back_spare() >= 1 |
| 1941 | __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), __v); | |
| 1942 | ++__base::size(); | |
| 1285 | __alloc_traits::construct(__a, _VSTD::addressof(*end()), __v); | |
| 1286 | ++__size(); | |
| 1943 | 1287 | } |
| 1944 | 1288 | |
| 1945 | 1289 | template <class _Tp, class _Allocator> |
| 1946 | 1290 | void |
| 1947 | 1291 | deque<_Tp, _Allocator>::push_front(const value_type& __v) |
| 1948 | 1292 | { |
| 1949 | allocator_type& __a = __base::__alloc(); | |
| 1293 | allocator_type& __a = __alloc(); | |
| 1950 | 1294 | if (__front_spare() == 0) |
| 1951 | 1295 | __add_front_capacity(); |
| 1952 | 1296 | // __front_spare() >= 1 |
| 1953 | __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v); | |
| 1954 | --__base::__start_; | |
| 1955 | ++__base::size(); | |
| 1297 | __alloc_traits::construct(__a, _VSTD::addressof(*--begin()), __v); | |
| 1298 | --__start_; | |
| 1299 | ++__size(); | |
| 1956 | 1300 | } |
| 1957 | 1301 | |
| 1958 | 1302 | #ifndef _LIBCPP_CXX03_LANG |
| ... | ... | @@ -1960,12 +1304,12 @@ template <class _Tp, class _Allocator> |
| 1960 | 1304 | void |
| 1961 | 1305 | deque<_Tp, _Allocator>::push_back(value_type&& __v) |
| 1962 | 1306 | { |
| 1963 | allocator_type& __a = __base::__alloc(); | |
| 1307 | allocator_type& __a = __alloc(); | |
| 1964 | 1308 | if (__back_spare() == 0) |
| 1965 | 1309 | __add_back_capacity(); |
| 1966 | 1310 | // __back_spare() >= 1 |
| 1967 | __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v)); | |
| 1968 | ++__base::size(); | |
| 1311 | __alloc_traits::construct(__a, _VSTD::addressof(*end()), _VSTD::move(__v)); | |
| 1312 | ++__size(); | |
| 1969 | 1313 | } |
| 1970 | 1314 | |
| 1971 | 1315 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -1977,15 +1321,15 @@ void |
| 1977 | 1321 | #endif |
| 1978 | 1322 | deque<_Tp, _Allocator>::emplace_back(_Args&&... __args) |
| 1979 | 1323 | { |
| 1980 | allocator_type& __a = __base::__alloc(); | |
| 1324 | allocator_type& __a = __alloc(); | |
| 1981 | 1325 | if (__back_spare() == 0) |
| 1982 | 1326 | __add_back_capacity(); |
| 1983 | 1327 | // __back_spare() >= 1 |
| 1984 | __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), | |
| 1328 | __alloc_traits::construct(__a, _VSTD::addressof(*end()), | |
| 1985 | 1329 | _VSTD::forward<_Args>(__args)...); |
| 1986 | ++__base::size(); | |
| 1330 | ++__size(); | |
| 1987 | 1331 | #if _LIBCPP_STD_VER > 14 |
| 1988 | return *--__base::end(); | |
| 1332 | return *--end(); | |
| 1989 | 1333 | #endif |
| 1990 | 1334 | } |
| 1991 | 1335 | |
| ... | ... | @@ -1993,13 +1337,13 @@ template <class _Tp, class _Allocator> |
| 1993 | 1337 | void |
| 1994 | 1338 | deque<_Tp, _Allocator>::push_front(value_type&& __v) |
| 1995 | 1339 | { |
| 1996 | allocator_type& __a = __base::__alloc(); | |
| 1340 | allocator_type& __a = __alloc(); | |
| 1997 | 1341 | if (__front_spare() == 0) |
| 1998 | 1342 | __add_front_capacity(); |
| 1999 | 1343 | // __front_spare() >= 1 |
| 2000 | __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v)); | |
| 2001 | --__base::__start_; | |
| 2002 | ++__base::size(); | |
| 1344 | __alloc_traits::construct(__a, _VSTD::addressof(*--begin()), _VSTD::move(__v)); | |
| 1345 | --__start_; | |
| 1346 | ++__size(); | |
| 2003 | 1347 | } |
| 2004 | 1348 | |
| 2005 | 1349 | |
| ... | ... | @@ -2012,15 +1356,15 @@ void |
| 2012 | 1356 | #endif |
| 2013 | 1357 | deque<_Tp, _Allocator>::emplace_front(_Args&&... __args) |
| 2014 | 1358 | { |
| 2015 | allocator_type& __a = __base::__alloc(); | |
| 1359 | allocator_type& __a = __alloc(); | |
| 2016 | 1360 | if (__front_spare() == 0) |
| 2017 | 1361 | __add_front_capacity(); |
| 2018 | 1362 | // __front_spare() >= 1 |
| 2019 | __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...); | |
| 2020 | --__base::__start_; | |
| 2021 | ++__base::size(); | |
| 1363 | __alloc_traits::construct(__a, _VSTD::addressof(*--begin()), _VSTD::forward<_Args>(__args)...); | |
| 1364 | --__start_; | |
| 1365 | ++__size(); | |
| 2022 | 1366 | #if _LIBCPP_STD_VER > 14 |
| 2023 | return *__base::begin(); | |
| 1367 | return *begin(); | |
| 2024 | 1368 | #endif |
| 2025 | 1369 | } |
| 2026 | 1370 | |
| ... | ... | @@ -2028,9 +1372,9 @@ template <class _Tp, class _Allocator> |
| 2028 | 1372 | typename deque<_Tp, _Allocator>::iterator |
| 2029 | 1373 | deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) |
| 2030 | 1374 | { |
| 2031 | size_type __pos = __p - __base::begin(); | |
| 2032 | size_type __to_end = __base::size() - __pos; | |
| 2033 | allocator_type& __a = __base::__alloc(); | |
| 1375 | size_type __pos = __p - begin(); | |
| 1376 | size_type __to_end = size() - __pos; | |
| 1377 | allocator_type& __a = __alloc(); | |
| 2034 | 1378 | if (__pos < __to_end) |
| 2035 | 1379 | { // insert by shifting things backward |
| 2036 | 1380 | if (__front_spare() == 0) |
| ... | ... | @@ -2038,17 +1382,17 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) |
| 2038 | 1382 | // __front_spare() >= 1 |
| 2039 | 1383 | if (__pos == 0) |
| 2040 | 1384 | { |
| 2041 | __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v)); | |
| 2042 | --__base::__start_; | |
| 2043 | ++__base::size(); | |
| 1385 | __alloc_traits::construct(__a, _VSTD::addressof(*--begin()), _VSTD::move(__v)); | |
| 1386 | --__start_; | |
| 1387 | ++__size(); | |
| 2044 | 1388 | } |
| 2045 | 1389 | else |
| 2046 | 1390 | { |
| 2047 | iterator __b = __base::begin(); | |
| 1391 | iterator __b = begin(); | |
| 2048 | 1392 | iterator __bm1 = _VSTD::prev(__b); |
| 2049 | 1393 | __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); |
| 2050 | --__base::__start_; | |
| 2051 | ++__base::size(); | |
| 1394 | --__start_; | |
| 1395 | ++__size(); | |
| 2052 | 1396 | if (__pos > 1) |
| 2053 | 1397 | __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); |
| 2054 | 1398 | *__b = _VSTD::move(__v); |
| ... | ... | @@ -2059,24 +1403,24 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) |
| 2059 | 1403 | if (__back_spare() == 0) |
| 2060 | 1404 | __add_back_capacity(); |
| 2061 | 1405 | // __back_capacity >= 1 |
| 2062 | size_type __de = __base::size() - __pos; | |
| 1406 | size_type __de = size() - __pos; | |
| 2063 | 1407 | if (__de == 0) |
| 2064 | 1408 | { |
| 2065 | __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v)); | |
| 2066 | ++__base::size(); | |
| 1409 | __alloc_traits::construct(__a, _VSTD::addressof(*end()), _VSTD::move(__v)); | |
| 1410 | ++__size(); | |
| 2067 | 1411 | } |
| 2068 | 1412 | else |
| 2069 | 1413 | { |
| 2070 | iterator __e = __base::end(); | |
| 1414 | iterator __e = end(); | |
| 2071 | 1415 | iterator __em1 = _VSTD::prev(__e); |
| 2072 | 1416 | __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); |
| 2073 | ++__base::size(); | |
| 1417 | ++__size(); | |
| 2074 | 1418 | if (__de > 1) |
| 2075 | 1419 | __e = _VSTD::move_backward(__e - __de, __em1, __e); |
| 2076 | 1420 | *--__e = _VSTD::move(__v); |
| 2077 | 1421 | } |
| 2078 | 1422 | } |
| 2079 | return __base::begin() + __pos; | |
| 1423 | return begin() + __pos; | |
| 2080 | 1424 | } |
| 2081 | 1425 | |
| 2082 | 1426 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -2084,9 +1428,9 @@ template <class... _Args> |
| 2084 | 1428 | typename deque<_Tp, _Allocator>::iterator |
| 2085 | 1429 | deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) |
| 2086 | 1430 | { |
| 2087 | size_type __pos = __p - __base::begin(); | |
| 2088 | size_type __to_end = __base::size() - __pos; | |
| 2089 | allocator_type& __a = __base::__alloc(); | |
| 1431 | size_type __pos = __p - begin(); | |
| 1432 | size_type __to_end = size() - __pos; | |
| 1433 | allocator_type& __a = __alloc(); | |
| 2090 | 1434 | if (__pos < __to_end) |
| 2091 | 1435 | { // insert by shifting things backward |
| 2092 | 1436 | if (__front_spare() == 0) |
| ... | ... | @@ -2094,18 +1438,18 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) |
| 2094 | 1438 | // __front_spare() >= 1 |
| 2095 | 1439 | if (__pos == 0) |
| 2096 | 1440 | { |
| 2097 | __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...); | |
| 2098 | --__base::__start_; | |
| 2099 | ++__base::size(); | |
| 1441 | __alloc_traits::construct(__a, _VSTD::addressof(*--begin()), _VSTD::forward<_Args>(__args)...); | |
| 1442 | --__start_; | |
| 1443 | ++__size(); | |
| 2100 | 1444 | } |
| 2101 | 1445 | else |
| 2102 | 1446 | { |
| 2103 | __temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); | |
| 2104 | iterator __b = __base::begin(); | |
| 1447 | __temp_value<value_type, _Allocator> __tmp(__alloc(), _VSTD::forward<_Args>(__args)...); | |
| 1448 | iterator __b = begin(); | |
| 2105 | 1449 | iterator __bm1 = _VSTD::prev(__b); |
| 2106 | 1450 | __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); |
| 2107 | --__base::__start_; | |
| 2108 | ++__base::size(); | |
| 1451 | --__start_; | |
| 1452 | ++__size(); | |
| 2109 | 1453 | if (__pos > 1) |
| 2110 | 1454 | __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); |
| 2111 | 1455 | *__b = _VSTD::move(__tmp.get()); |
| ... | ... | @@ -2116,25 +1460,25 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) |
| 2116 | 1460 | if (__back_spare() == 0) |
| 2117 | 1461 | __add_back_capacity(); |
| 2118 | 1462 | // __back_capacity >= 1 |
| 2119 | size_type __de = __base::size() - __pos; | |
| 1463 | size_type __de = size() - __pos; | |
| 2120 | 1464 | if (__de == 0) |
| 2121 | 1465 | { |
| 2122 | __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...); | |
| 2123 | ++__base::size(); | |
| 1466 | __alloc_traits::construct(__a, _VSTD::addressof(*end()), _VSTD::forward<_Args>(__args)...); | |
| 1467 | ++__size(); | |
| 2124 | 1468 | } |
| 2125 | 1469 | else |
| 2126 | 1470 | { |
| 2127 | __temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); | |
| 2128 | iterator __e = __base::end(); | |
| 1471 | __temp_value<value_type, _Allocator> __tmp(__alloc(), _VSTD::forward<_Args>(__args)...); | |
| 1472 | iterator __e = end(); | |
| 2129 | 1473 | iterator __em1 = _VSTD::prev(__e); |
| 2130 | 1474 | __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); |
| 2131 | ++__base::size(); | |
| 1475 | ++__size(); | |
| 2132 | 1476 | if (__de > 1) |
| 2133 | 1477 | __e = _VSTD::move_backward(__e - __de, __em1, __e); |
| 2134 | 1478 | *--__e = _VSTD::move(__tmp.get()); |
| 2135 | 1479 | } |
| 2136 | 1480 | } |
| 2137 | return __base::begin() + __pos; | |
| 1481 | return begin() + __pos; | |
| 2138 | 1482 | } |
| 2139 | 1483 | |
| 2140 | 1484 | #endif // _LIBCPP_CXX03_LANG |
| ... | ... | @@ -2144,9 +1488,9 @@ template <class _Tp, class _Allocator> |
| 2144 | 1488 | typename deque<_Tp, _Allocator>::iterator |
| 2145 | 1489 | deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) |
| 2146 | 1490 | { |
| 2147 | size_type __pos = __p - __base::begin(); | |
| 2148 | size_type __to_end = __base::size() - __pos; | |
| 2149 | allocator_type& __a = __base::__alloc(); | |
| 1491 | size_type __pos = __p - begin(); | |
| 1492 | size_type __to_end = size() - __pos; | |
| 1493 | allocator_type& __a = __alloc(); | |
| 2150 | 1494 | if (__pos < __to_end) |
| 2151 | 1495 | { // insert by shifting things backward |
| 2152 | 1496 | if (__front_spare() == 0) |
| ... | ... | @@ -2154,20 +1498,20 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) |
| 2154 | 1498 | // __front_spare() >= 1 |
| 2155 | 1499 | if (__pos == 0) |
| 2156 | 1500 | { |
| 2157 | __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v); | |
| 2158 | --__base::__start_; | |
| 2159 | ++__base::size(); | |
| 1501 | __alloc_traits::construct(__a, _VSTD::addressof(*--begin()), __v); | |
| 1502 | --__start_; | |
| 1503 | ++__size(); | |
| 2160 | 1504 | } |
| 2161 | 1505 | else |
| 2162 | 1506 | { |
| 2163 | 1507 | const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v); |
| 2164 | iterator __b = __base::begin(); | |
| 1508 | iterator __b = begin(); | |
| 2165 | 1509 | iterator __bm1 = _VSTD::prev(__b); |
| 2166 | 1510 | if (__vt == pointer_traits<const_pointer>::pointer_to(*__b)) |
| 2167 | 1511 | __vt = pointer_traits<const_pointer>::pointer_to(*__bm1); |
| 2168 | 1512 | __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); |
| 2169 | --__base::__start_; | |
| 2170 | ++__base::size(); | |
| 1513 | --__start_; | |
| 1514 | ++__size(); | |
| 2171 | 1515 | if (__pos > 1) |
| 2172 | 1516 | __b = __move_and_check(_VSTD::next(__b), __b + __pos, __b, __vt); |
| 2173 | 1517 | *__b = *__vt; |
| ... | ... | @@ -2178,46 +1522,46 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) |
| 2178 | 1522 | if (__back_spare() == 0) |
| 2179 | 1523 | __add_back_capacity(); |
| 2180 | 1524 | // __back_capacity >= 1 |
| 2181 | size_type __de = __base::size() - __pos; | |
| 1525 | size_type __de = size() - __pos; | |
| 2182 | 1526 | if (__de == 0) |
| 2183 | 1527 | { |
| 2184 | __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), __v); | |
| 2185 | ++__base::size(); | |
| 1528 | __alloc_traits::construct(__a, _VSTD::addressof(*end()), __v); | |
| 1529 | ++__size(); | |
| 2186 | 1530 | } |
| 2187 | 1531 | else |
| 2188 | 1532 | { |
| 2189 | 1533 | const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v); |
| 2190 | iterator __e = __base::end(); | |
| 1534 | iterator __e = end(); | |
| 2191 | 1535 | iterator __em1 = _VSTD::prev(__e); |
| 2192 | 1536 | if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1)) |
| 2193 | 1537 | __vt = pointer_traits<const_pointer>::pointer_to(*__e); |
| 2194 | 1538 | __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); |
| 2195 | ++__base::size(); | |
| 1539 | ++__size(); | |
| 2196 | 1540 | if (__de > 1) |
| 2197 | 1541 | __e = __move_backward_and_check(__e - __de, __em1, __e, __vt); |
| 2198 | 1542 | *--__e = *__vt; |
| 2199 | 1543 | } |
| 2200 | 1544 | } |
| 2201 | return __base::begin() + __pos; | |
| 1545 | return begin() + __pos; | |
| 2202 | 1546 | } |
| 2203 | 1547 | |
| 2204 | 1548 | template <class _Tp, class _Allocator> |
| 2205 | 1549 | typename deque<_Tp, _Allocator>::iterator |
| 2206 | 1550 | deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v) |
| 2207 | 1551 | { |
| 2208 | size_type __pos = __p - __base::begin(); | |
| 2209 | size_type __to_end = __base::size() - __pos; | |
| 2210 | allocator_type& __a = __base::__alloc(); | |
| 1552 | size_type __pos = __p - begin(); | |
| 1553 | size_type __to_end = __size() - __pos; | |
| 1554 | allocator_type& __a = __alloc(); | |
| 2211 | 1555 | if (__pos < __to_end) |
| 2212 | 1556 | { // insert by shifting things backward |
| 2213 | 1557 | if (__n > __front_spare()) |
| 2214 | 1558 | __add_front_capacity(__n - __front_spare()); |
| 2215 | 1559 | // __n <= __front_spare() |
| 2216 | iterator __old_begin = __base::begin(); | |
| 1560 | iterator __old_begin = begin(); | |
| 2217 | 1561 | iterator __i = __old_begin; |
| 2218 | 1562 | if (__n > __pos) |
| 2219 | 1563 | { |
| 2220 | for (size_type __m = __n - __pos; __m; --__m, --__base::__start_, ++__base::size()) | |
| 1564 | for (size_type __m = __n - __pos; __m; --__m, --__start_, ++__size()) | |
| 2221 | 1565 | __alloc_traits::construct(__a, _VSTD::addressof(*--__i), __v); |
| 2222 | 1566 | __n = __pos; |
| 2223 | 1567 | } |
| ... | ... | @@ -2237,12 +1581,12 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty |
| 2237 | 1581 | if (__n > __back_capacity) |
| 2238 | 1582 | __add_back_capacity(__n - __back_capacity); |
| 2239 | 1583 | // __n <= __back_capacity |
| 2240 | iterator __old_end = __base::end(); | |
| 1584 | iterator __old_end = end(); | |
| 2241 | 1585 | iterator __i = __old_end; |
| 2242 | size_type __de = __base::size() - __pos; | |
| 1586 | size_type __de = size() - __pos; | |
| 2243 | 1587 | if (__n > __de) |
| 2244 | 1588 | { |
| 2245 | for (size_type __m = __n - __de; __m; --__m, (void) ++__i, ++__base::size()) | |
| 1589 | for (size_type __m = __n - __de; __m; --__m, (void) ++__i, ++__size()) | |
| 2246 | 1590 | __alloc_traits::construct(__a, _VSTD::addressof(*__i), __v); |
| 2247 | 1591 | __n = __de; |
| 2248 | 1592 | } |
| ... | ... | @@ -2256,7 +1600,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty |
| 2256 | 1600 | _VSTD::fill_n(__old_end - __n, __n, *__vt); |
| 2257 | 1601 | } |
| 2258 | 1602 | } |
| 2259 | return __base::begin() + __pos; | |
| 1603 | return begin() + __pos; | |
| 2260 | 1604 | } |
| 2261 | 1605 | |
| 2262 | 1606 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -2265,7 +1609,7 @@ typename deque<_Tp, _Allocator>::iterator |
| 2265 | 1609 | deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l, |
| 2266 | 1610 | typename enable_if<__is_exactly_cpp17_input_iterator<_InputIter>::value>::type*) |
| 2267 | 1611 | { |
| 2268 | __split_buffer<value_type, allocator_type&> __buf(__base::__alloc()); | |
| 1612 | __split_buffer<value_type, allocator_type&> __buf(__alloc()); | |
| 2269 | 1613 | __buf.__construct_at_end(__f, __l); |
| 2270 | 1614 | typedef typename __split_buffer<value_type, allocator_type&>::iterator __bi; |
| 2271 | 1615 | return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end())); |
| ... | ... | @@ -2278,7 +1622,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _Forwar |
| 2278 | 1622 | typename enable_if<__is_exactly_cpp17_forward_iterator<_ForwardIterator>::value>::type*) |
| 2279 | 1623 | { |
| 2280 | 1624 | size_type __n = _VSTD::distance(__f, __l); |
| 2281 | __split_buffer<value_type, allocator_type&> __buf(__n, 0, __base::__alloc()); | |
| 1625 | __split_buffer<value_type, allocator_type&> __buf(__n, 0, __alloc()); | |
| 2282 | 1626 | __buf.__construct_at_end(__f, __l); |
| 2283 | 1627 | typedef typename __split_buffer<value_type, allocator_type&>::iterator __fwd; |
| 2284 | 1628 | return insert(__p, move_iterator<__fwd>(__buf.begin()), move_iterator<__fwd>(__buf.end())); |
| ... | ... | @@ -2291,21 +1635,21 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l, |
| 2291 | 1635 | typename enable_if<__is_cpp17_bidirectional_iterator<_BiIter>::value>::type*) |
| 2292 | 1636 | { |
| 2293 | 1637 | size_type __n = _VSTD::distance(__f, __l); |
| 2294 | size_type __pos = __p - __base::begin(); | |
| 2295 | size_type __to_end = __base::size() - __pos; | |
| 2296 | allocator_type& __a = __base::__alloc(); | |
| 1638 | size_type __pos = __p - begin(); | |
| 1639 | size_type __to_end = size() - __pos; | |
| 1640 | allocator_type& __a = __alloc(); | |
| 2297 | 1641 | if (__pos < __to_end) |
| 2298 | 1642 | { // insert by shifting things backward |
| 2299 | 1643 | if (__n > __front_spare()) |
| 2300 | 1644 | __add_front_capacity(__n - __front_spare()); |
| 2301 | 1645 | // __n <= __front_spare() |
| 2302 | iterator __old_begin = __base::begin(); | |
| 1646 | iterator __old_begin = begin(); | |
| 2303 | 1647 | iterator __i = __old_begin; |
| 2304 | 1648 | _BiIter __m = __f; |
| 2305 | 1649 | if (__n > __pos) |
| 2306 | 1650 | { |
| 2307 | 1651 | __m = __pos < __n / 2 ? _VSTD::prev(__l, __pos) : _VSTD::next(__f, __n - __pos); |
| 2308 | for (_BiIter __j = __m; __j != __f; --__base::__start_, ++__base::size()) | |
| 1652 | for (_BiIter __j = __m; __j != __f; --__start_, ++__size()) | |
| 2309 | 1653 | __alloc_traits::construct(__a, _VSTD::addressof(*--__i), *--__j); |
| 2310 | 1654 | __n = __pos; |
| 2311 | 1655 | } |
| ... | ... | @@ -2315,8 +1659,8 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l, |
| 2315 | 1659 | for (iterator __j = __obn; __j != __old_begin;) |
| 2316 | 1660 | { |
| 2317 | 1661 | __alloc_traits::construct(__a, _VSTD::addressof(*--__i), _VSTD::move(*--__j)); |
| 2318 | --__base::__start_; | |
| 2319 | ++__base::size(); | |
| 1662 | --__start_; | |
| 1663 | ++__size(); | |
| 2320 | 1664 | } |
| 2321 | 1665 | if (__n < __pos) |
| 2322 | 1666 | __old_begin = _VSTD::move(__obn, __old_begin + __pos, __old_begin); |
| ... | ... | @@ -2329,28 +1673,28 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l, |
| 2329 | 1673 | if (__n > __back_capacity) |
| 2330 | 1674 | __add_back_capacity(__n - __back_capacity); |
| 2331 | 1675 | // __n <= __back_capacity |
| 2332 | iterator __old_end = __base::end(); | |
| 1676 | iterator __old_end = end(); | |
| 2333 | 1677 | iterator __i = __old_end; |
| 2334 | 1678 | _BiIter __m = __l; |
| 2335 | size_type __de = __base::size() - __pos; | |
| 1679 | size_type __de = size() - __pos; | |
| 2336 | 1680 | if (__n > __de) |
| 2337 | 1681 | { |
| 2338 | 1682 | __m = __de < __n / 2 ? _VSTD::next(__f, __de) : _VSTD::prev(__l, __n - __de); |
| 2339 | for (_BiIter __j = __m; __j != __l; ++__i, (void) ++__j, ++__base::size()) | |
| 1683 | for (_BiIter __j = __m; __j != __l; ++__i, (void) ++__j, ++__size()) | |
| 2340 | 1684 | __alloc_traits::construct(__a, _VSTD::addressof(*__i), *__j); |
| 2341 | 1685 | __n = __de; |
| 2342 | 1686 | } |
| 2343 | 1687 | if (__n > 0) |
| 2344 | 1688 | { |
| 2345 | 1689 | iterator __oen = __old_end - __n; |
| 2346 | for (iterator __j = __oen; __j != __old_end; ++__i, (void) ++__j, ++__base::size()) | |
| 1690 | for (iterator __j = __oen; __j != __old_end; ++__i, (void) ++__j, ++__size()) | |
| 2347 | 1691 | __alloc_traits::construct(__a, _VSTD::addressof(*__i), _VSTD::move(*__j)); |
| 2348 | 1692 | if (__n < __de) |
| 2349 | 1693 | __old_end = _VSTD::move_backward(__old_end - __de, __oen, __old_end); |
| 2350 | 1694 | _VSTD::copy_backward(__f, __m, __old_end); |
| 2351 | 1695 | } |
| 2352 | 1696 | } |
| 2353 | return __base::begin() + __pos; | |
| 1697 | return begin() + __pos; | |
| 2354 | 1698 | } |
| 2355 | 1699 | |
| 2356 | 1700 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -2374,12 +1718,12 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l, |
| 2374 | 1718 | typename enable_if<__is_cpp17_forward_iterator<_ForIter>::value>::type*) |
| 2375 | 1719 | { |
| 2376 | 1720 | size_type __n = _VSTD::distance(__f, __l); |
| 2377 | allocator_type& __a = __base::__alloc(); | |
| 1721 | allocator_type& __a = __alloc(); | |
| 2378 | 1722 | size_type __back_capacity = __back_spare(); |
| 2379 | 1723 | if (__n > __back_capacity) |
| 2380 | 1724 | __add_back_capacity(__n - __back_capacity); |
| 2381 | 1725 | // __n <= __back_capacity |
| 2382 | for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { | |
| 1726 | for (__deque_block_range __br : __deque_range(end(), end() + __n)) { | |
| 2383 | 1727 | _ConstructTransaction __tx(this, __br); |
| 2384 | 1728 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) { |
| 2385 | 1729 | __alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_), *__f); |
| ... | ... | @@ -2391,12 +1735,12 @@ template <class _Tp, class _Allocator> |
| 2391 | 1735 | void |
| 2392 | 1736 | deque<_Tp, _Allocator>::__append(size_type __n) |
| 2393 | 1737 | { |
| 2394 | allocator_type& __a = __base::__alloc(); | |
| 1738 | allocator_type& __a = __alloc(); | |
| 2395 | 1739 | size_type __back_capacity = __back_spare(); |
| 2396 | 1740 | if (__n > __back_capacity) |
| 2397 | 1741 | __add_back_capacity(__n - __back_capacity); |
| 2398 | 1742 | // __n <= __back_capacity |
| 2399 | for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { | |
| 1743 | for (__deque_block_range __br : __deque_range(end(), end() + __n)) { | |
| 2400 | 1744 | _ConstructTransaction __tx(this, __br); |
| 2401 | 1745 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { |
| 2402 | 1746 | __alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_)); |
| ... | ... | @@ -2408,12 +1752,12 @@ template <class _Tp, class _Allocator> |
| 2408 | 1752 | void |
| 2409 | 1753 | deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v) |
| 2410 | 1754 | { |
| 2411 | allocator_type& __a = __base::__alloc(); | |
| 1755 | allocator_type& __a = __alloc(); | |
| 2412 | 1756 | size_type __back_capacity = __back_spare(); |
| 2413 | 1757 | if (__n > __back_capacity) |
| 2414 | 1758 | __add_back_capacity(__n - __back_capacity); |
| 2415 | 1759 | // __n <= __back_capacity |
| 2416 | for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { | |
| 1760 | for (__deque_block_range __br : __deque_range(end(), end() + __n)) { | |
| 2417 | 1761 | _ConstructTransaction __tx(this, __br); |
| 2418 | 1762 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { |
| 2419 | 1763 | __alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_), __v); |
| ... | ... | @@ -2428,57 +1772,57 @@ template <class _Tp, class _Allocator> |
| 2428 | 1772 | void |
| 2429 | 1773 | deque<_Tp, _Allocator>::__add_front_capacity() |
| 2430 | 1774 | { |
| 2431 | allocator_type& __a = __base::__alloc(); | |
| 2432 | if (__back_spare() >= __base::__block_size) | |
| 1775 | allocator_type& __a = __alloc(); | |
| 1776 | if (__back_spare() >= __block_size) | |
| 2433 | 1777 | { |
| 2434 | __base::__start_ += __base::__block_size; | |
| 2435 | pointer __pt = __base::__map_.back(); | |
| 2436 | __base::__map_.pop_back(); | |
| 2437 | __base::__map_.push_front(__pt); | |
| 1778 | __start_ += __block_size; | |
| 1779 | pointer __pt = __map_.back(); | |
| 1780 | __map_.pop_back(); | |
| 1781 | __map_.push_front(__pt); | |
| 2438 | 1782 | } |
| 2439 | // Else if __base::__map_.size() < __base::__map_.capacity() then we need to allocate 1 buffer | |
| 2440 | else if (__base::__map_.size() < __base::__map_.capacity()) | |
| 1783 | // Else if __map_.size() < __map_.capacity() then we need to allocate 1 buffer | |
| 1784 | else if (__map_.size() < __map_.capacity()) | |
| 2441 | 1785 | { // we can put the new buffer into the map, but don't shift things around |
| 2442 | 1786 | // until all buffers are allocated. If we throw, we don't need to fix |
| 2443 | 1787 | // anything up (any added buffers are undetectible) |
| 2444 | if (__base::__map_.__front_spare() > 0) | |
| 2445 | __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); | |
| 1788 | if (__map_.__front_spare() > 0) | |
| 1789 | __map_.push_front(__alloc_traits::allocate(__a, __block_size)); | |
| 2446 | 1790 | else |
| 2447 | 1791 | { |
| 2448 | __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); | |
| 1792 | __map_.push_back(__alloc_traits::allocate(__a, __block_size)); | |
| 2449 | 1793 | // Done allocating, reorder capacity |
| 2450 | pointer __pt = __base::__map_.back(); | |
| 2451 | __base::__map_.pop_back(); | |
| 2452 | __base::__map_.push_front(__pt); | |
| 1794 | pointer __pt = __map_.back(); | |
| 1795 | __map_.pop_back(); | |
| 1796 | __map_.push_front(__pt); | |
| 2453 | 1797 | } |
| 2454 | __base::__start_ = __base::__map_.size() == 1 ? | |
| 2455 | __base::__block_size / 2 : | |
| 2456 | __base::__start_ + __base::__block_size; | |
| 1798 | __start_ = __map_.size() == 1 ? | |
| 1799 | __block_size / 2 : | |
| 1800 | __start_ + __block_size; | |
| 2457 | 1801 | } |
| 2458 | 1802 | // Else need to allocate 1 buffer, *and* we need to reallocate __map_. |
| 2459 | 1803 | else |
| 2460 | 1804 | { |
| 2461 | __split_buffer<pointer, typename __base::__pointer_allocator&> | |
| 2462 | __buf(max<size_type>(2 * __base::__map_.capacity(), 1), | |
| 2463 | 0, __base::__map_.__alloc()); | |
| 1805 | __split_buffer<pointer, __pointer_allocator&> | |
| 1806 | __buf(std::max<size_type>(2 * __map_.capacity(), 1), | |
| 1807 | 0, __map_.__alloc()); | |
| 2464 | 1808 | |
| 2465 | 1809 | typedef __allocator_destructor<_Allocator> _Dp; |
| 2466 | 1810 | unique_ptr<pointer, _Dp> __hold( |
| 2467 | __alloc_traits::allocate(__a, __base::__block_size), | |
| 2468 | _Dp(__a, __base::__block_size)); | |
| 1811 | __alloc_traits::allocate(__a, __block_size), | |
| 1812 | _Dp(__a, __block_size)); | |
| 2469 | 1813 | __buf.push_back(__hold.get()); |
| 2470 | 1814 | __hold.release(); |
| 2471 | 1815 | |
| 2472 | for (typename __base::__map_pointer __i = __base::__map_.begin(); | |
| 2473 | __i != __base::__map_.end(); ++__i) | |
| 1816 | for (__map_pointer __i = __map_.begin(); | |
| 1817 | __i != __map_.end(); ++__i) | |
| 2474 | 1818 | __buf.push_back(*__i); |
| 2475 | _VSTD::swap(__base::__map_.__first_, __buf.__first_); | |
| 2476 | _VSTD::swap(__base::__map_.__begin_, __buf.__begin_); | |
| 2477 | _VSTD::swap(__base::__map_.__end_, __buf.__end_); | |
| 2478 | _VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap()); | |
| 2479 | __base::__start_ = __base::__map_.size() == 1 ? | |
| 2480 | __base::__block_size / 2 : | |
| 2481 | __base::__start_ + __base::__block_size; | |
| 1819 | _VSTD::swap(__map_.__first_, __buf.__first_); | |
| 1820 | _VSTD::swap(__map_.__begin_, __buf.__begin_); | |
| 1821 | _VSTD::swap(__map_.__end_, __buf.__end_); | |
| 1822 | _VSTD::swap(__map_.__end_cap(), __buf.__end_cap()); | |
| 1823 | __start_ = __map_.size() == 1 ? | |
| 1824 | __block_size / 2 : | |
| 1825 | __start_ + __block_size; | |
| 2482 | 1826 | } |
| 2483 | 1827 | } |
| 2484 | 1828 | |
| ... | ... | @@ -2488,82 +1832,82 @@ template <class _Tp, class _Allocator> |
| 2488 | 1832 | void |
| 2489 | 1833 | deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) |
| 2490 | 1834 | { |
| 2491 | allocator_type& __a = __base::__alloc(); | |
| 2492 | size_type __nb = __recommend_blocks(__n + __base::__map_.empty()); | |
| 1835 | allocator_type& __a = __alloc(); | |
| 1836 | size_type __nb = __recommend_blocks(__n + __map_.empty()); | |
| 2493 | 1837 | // Number of unused blocks at back: |
| 2494 | size_type __back_capacity = __back_spare() / __base::__block_size; | |
| 1838 | size_type __back_capacity = __back_spare() / __block_size; | |
| 2495 | 1839 | __back_capacity = _VSTD::min(__back_capacity, __nb); // don't take more than you need |
| 2496 | 1840 | __nb -= __back_capacity; // number of blocks need to allocate |
| 2497 | 1841 | // If __nb == 0, then we have sufficient capacity. |
| 2498 | 1842 | if (__nb == 0) |
| 2499 | 1843 | { |
| 2500 | __base::__start_ += __base::__block_size * __back_capacity; | |
| 1844 | __start_ += __block_size * __back_capacity; | |
| 2501 | 1845 | for (; __back_capacity > 0; --__back_capacity) |
| 2502 | 1846 | { |
| 2503 | pointer __pt = __base::__map_.back(); | |
| 2504 | __base::__map_.pop_back(); | |
| 2505 | __base::__map_.push_front(__pt); | |
| 1847 | pointer __pt = __map_.back(); | |
| 1848 | __map_.pop_back(); | |
| 1849 | __map_.push_front(__pt); | |
| 2506 | 1850 | } |
| 2507 | 1851 | } |
| 2508 | 1852 | // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers |
| 2509 | else if (__nb <= __base::__map_.capacity() - __base::__map_.size()) | |
| 1853 | else if (__nb <= __map_.capacity() - __map_.size()) | |
| 2510 | 1854 | { // we can put the new buffers into the map, but don't shift things around |
| 2511 | 1855 | // until all buffers are allocated. If we throw, we don't need to fix |
| 2512 | 1856 | // anything up (any added buffers are undetectible) |
| 2513 | for (; __nb > 0; --__nb, __base::__start_ += __base::__block_size - (__base::__map_.size() == 1)) | |
| 1857 | for (; __nb > 0; --__nb, __start_ += __block_size - (__map_.size() == 1)) | |
| 2514 | 1858 | { |
| 2515 | if (__base::__map_.__front_spare() == 0) | |
| 1859 | if (__map_.__front_spare() == 0) | |
| 2516 | 1860 | break; |
| 2517 | __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); | |
| 1861 | __map_.push_front(__alloc_traits::allocate(__a, __block_size)); | |
| 2518 | 1862 | } |
| 2519 | 1863 | for (; __nb > 0; --__nb, ++__back_capacity) |
| 2520 | __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); | |
| 1864 | __map_.push_back(__alloc_traits::allocate(__a, __block_size)); | |
| 2521 | 1865 | // Done allocating, reorder capacity |
| 2522 | __base::__start_ += __back_capacity * __base::__block_size; | |
| 1866 | __start_ += __back_capacity * __block_size; | |
| 2523 | 1867 | for (; __back_capacity > 0; --__back_capacity) |
| 2524 | 1868 | { |
| 2525 | pointer __pt = __base::__map_.back(); | |
| 2526 | __base::__map_.pop_back(); | |
| 2527 | __base::__map_.push_front(__pt); | |
| 1869 | pointer __pt = __map_.back(); | |
| 1870 | __map_.pop_back(); | |
| 1871 | __map_.push_front(__pt); | |
| 2528 | 1872 | } |
| 2529 | 1873 | } |
| 2530 | 1874 | // Else need to allocate __nb buffers, *and* we need to reallocate __map_. |
| 2531 | 1875 | else |
| 2532 | 1876 | { |
| 2533 | size_type __ds = (__nb + __back_capacity) * __base::__block_size - __base::__map_.empty(); | |
| 2534 | __split_buffer<pointer, typename __base::__pointer_allocator&> | |
| 2535 | __buf(max<size_type>(2* __base::__map_.capacity(), | |
| 2536 | __nb + __base::__map_.size()), | |
| 2537 | 0, __base::__map_.__alloc()); | |
| 1877 | size_type __ds = (__nb + __back_capacity) * __block_size - __map_.empty(); | |
| 1878 | __split_buffer<pointer, __pointer_allocator&> | |
| 1879 | __buf(std::max<size_type>(2* __map_.capacity(), | |
| 1880 | __nb + __map_.size()), | |
| 1881 | 0, __map_.__alloc()); | |
| 2538 | 1882 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2539 | 1883 | try |
| 2540 | 1884 | { |
| 2541 | 1885 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 2542 | 1886 | for (; __nb > 0; --__nb) |
| 2543 | __buf.push_back(__alloc_traits::allocate(__a, __base::__block_size)); | |
| 1887 | __buf.push_back(__alloc_traits::allocate(__a, __block_size)); | |
| 2544 | 1888 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2545 | 1889 | } |
| 2546 | 1890 | catch (...) |
| 2547 | 1891 | { |
| 2548 | for (typename __base::__map_pointer __i = __buf.begin(); | |
| 1892 | for (__map_pointer __i = __buf.begin(); | |
| 2549 | 1893 | __i != __buf.end(); ++__i) |
| 2550 | __alloc_traits::deallocate(__a, *__i, __base::__block_size); | |
| 1894 | __alloc_traits::deallocate(__a, *__i, __block_size); | |
| 2551 | 1895 | throw; |
| 2552 | 1896 | } |
| 2553 | 1897 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 2554 | 1898 | for (; __back_capacity > 0; --__back_capacity) |
| 2555 | 1899 | { |
| 2556 | __buf.push_back(__base::__map_.back()); | |
| 2557 | __base::__map_.pop_back(); | |
| 1900 | __buf.push_back(__map_.back()); | |
| 1901 | __map_.pop_back(); | |
| 2558 | 1902 | } |
| 2559 | for (typename __base::__map_pointer __i = __base::__map_.begin(); | |
| 2560 | __i != __base::__map_.end(); ++__i) | |
| 1903 | for (__map_pointer __i = __map_.begin(); | |
| 1904 | __i != __map_.end(); ++__i) | |
| 2561 | 1905 | __buf.push_back(*__i); |
| 2562 | _VSTD::swap(__base::__map_.__first_, __buf.__first_); | |
| 2563 | _VSTD::swap(__base::__map_.__begin_, __buf.__begin_); | |
| 2564 | _VSTD::swap(__base::__map_.__end_, __buf.__end_); | |
| 2565 | _VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap()); | |
| 2566 | __base::__start_ += __ds; | |
| 1906 | _VSTD::swap(__map_.__first_, __buf.__first_); | |
| 1907 | _VSTD::swap(__map_.__begin_, __buf.__begin_); | |
| 1908 | _VSTD::swap(__map_.__end_, __buf.__end_); | |
| 1909 | _VSTD::swap(__map_.__end_cap(), __buf.__end_cap()); | |
| 1910 | __start_ += __ds; | |
| 2567 | 1911 | } |
| 2568 | 1912 | } |
| 2569 | 1913 | |
| ... | ... | @@ -2573,52 +1917,52 @@ template <class _Tp, class _Allocator> |
| 2573 | 1917 | void |
| 2574 | 1918 | deque<_Tp, _Allocator>::__add_back_capacity() |
| 2575 | 1919 | { |
| 2576 | allocator_type& __a = __base::__alloc(); | |
| 2577 | if (__front_spare() >= __base::__block_size) | |
| 1920 | allocator_type& __a = __alloc(); | |
| 1921 | if (__front_spare() >= __block_size) | |
| 2578 | 1922 | { |
| 2579 | __base::__start_ -= __base::__block_size; | |
| 2580 | pointer __pt = __base::__map_.front(); | |
| 2581 | __base::__map_.pop_front(); | |
| 2582 | __base::__map_.push_back(__pt); | |
| 1923 | __start_ -= __block_size; | |
| 1924 | pointer __pt = __map_.front(); | |
| 1925 | __map_.pop_front(); | |
| 1926 | __map_.push_back(__pt); | |
| 2583 | 1927 | } |
| 2584 | 1928 | // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers |
| 2585 | else if (__base::__map_.size() < __base::__map_.capacity()) | |
| 1929 | else if (__map_.size() < __map_.capacity()) | |
| 2586 | 1930 | { // we can put the new buffer into the map, but don't shift things around |
| 2587 | 1931 | // until it is allocated. If we throw, we don't need to fix |
| 2588 | 1932 | // anything up (any added buffers are undetectible) |
| 2589 | if (__base::__map_.__back_spare() != 0) | |
| 2590 | __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); | |
| 1933 | if (__map_.__back_spare() != 0) | |
| 1934 | __map_.push_back(__alloc_traits::allocate(__a, __block_size)); | |
| 2591 | 1935 | else |
| 2592 | 1936 | { |
| 2593 | __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); | |
| 1937 | __map_.push_front(__alloc_traits::allocate(__a, __block_size)); | |
| 2594 | 1938 | // Done allocating, reorder capacity |
| 2595 | pointer __pt = __base::__map_.front(); | |
| 2596 | __base::__map_.pop_front(); | |
| 2597 | __base::__map_.push_back(__pt); | |
| 1939 | pointer __pt = __map_.front(); | |
| 1940 | __map_.pop_front(); | |
| 1941 | __map_.push_back(__pt); | |
| 2598 | 1942 | } |
| 2599 | 1943 | } |
| 2600 | 1944 | // Else need to allocate 1 buffer, *and* we need to reallocate __map_. |
| 2601 | 1945 | else |
| 2602 | 1946 | { |
| 2603 | __split_buffer<pointer, typename __base::__pointer_allocator&> | |
| 2604 | __buf(max<size_type>(2* __base::__map_.capacity(), 1), | |
| 2605 | __base::__map_.size(), | |
| 2606 | __base::__map_.__alloc()); | |
| 1947 | __split_buffer<pointer, __pointer_allocator&> | |
| 1948 | __buf(std::max<size_type>(2* __map_.capacity(), 1), | |
| 1949 | __map_.size(), | |
| 1950 | __map_.__alloc()); | |
| 2607 | 1951 | |
| 2608 | 1952 | typedef __allocator_destructor<_Allocator> _Dp; |
| 2609 | 1953 | unique_ptr<pointer, _Dp> __hold( |
| 2610 | __alloc_traits::allocate(__a, __base::__block_size), | |
| 2611 | _Dp(__a, __base::__block_size)); | |
| 1954 | __alloc_traits::allocate(__a, __block_size), | |
| 1955 | _Dp(__a, __block_size)); | |
| 2612 | 1956 | __buf.push_back(__hold.get()); |
| 2613 | 1957 | __hold.release(); |
| 2614 | 1958 | |
| 2615 | for (typename __base::__map_pointer __i = __base::__map_.end(); | |
| 2616 | __i != __base::__map_.begin();) | |
| 1959 | for (__map_pointer __i = __map_.end(); | |
| 1960 | __i != __map_.begin();) | |
| 2617 | 1961 | __buf.push_front(*--__i); |
| 2618 | _VSTD::swap(__base::__map_.__first_, __buf.__first_); | |
| 2619 | _VSTD::swap(__base::__map_.__begin_, __buf.__begin_); | |
| 2620 | _VSTD::swap(__base::__map_.__end_, __buf.__end_); | |
| 2621 | _VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap()); | |
| 1962 | _VSTD::swap(__map_.__first_, __buf.__first_); | |
| 1963 | _VSTD::swap(__map_.__begin_, __buf.__begin_); | |
| 1964 | _VSTD::swap(__map_.__end_, __buf.__end_); | |
| 1965 | _VSTD::swap(__map_.__end_cap(), __buf.__end_cap()); | |
| 2622 | 1966 | } |
| 2623 | 1967 | } |
| 2624 | 1968 | |
| ... | ... | @@ -2628,84 +1972,84 @@ template <class _Tp, class _Allocator> |
| 2628 | 1972 | void |
| 2629 | 1973 | deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) |
| 2630 | 1974 | { |
| 2631 | allocator_type& __a = __base::__alloc(); | |
| 2632 | size_type __nb = __recommend_blocks(__n + __base::__map_.empty()); | |
| 1975 | allocator_type& __a = __alloc(); | |
| 1976 | size_type __nb = __recommend_blocks(__n + __map_.empty()); | |
| 2633 | 1977 | // Number of unused blocks at front: |
| 2634 | size_type __front_capacity = __front_spare() / __base::__block_size; | |
| 1978 | size_type __front_capacity = __front_spare() / __block_size; | |
| 2635 | 1979 | __front_capacity = _VSTD::min(__front_capacity, __nb); // don't take more than you need |
| 2636 | 1980 | __nb -= __front_capacity; // number of blocks need to allocate |
| 2637 | 1981 | // If __nb == 0, then we have sufficient capacity. |
| 2638 | 1982 | if (__nb == 0) |
| 2639 | 1983 | { |
| 2640 | __base::__start_ -= __base::__block_size * __front_capacity; | |
| 1984 | __start_ -= __block_size * __front_capacity; | |
| 2641 | 1985 | for (; __front_capacity > 0; --__front_capacity) |
| 2642 | 1986 | { |
| 2643 | pointer __pt = __base::__map_.front(); | |
| 2644 | __base::__map_.pop_front(); | |
| 2645 | __base::__map_.push_back(__pt); | |
| 1987 | pointer __pt = __map_.front(); | |
| 1988 | __map_.pop_front(); | |
| 1989 | __map_.push_back(__pt); | |
| 2646 | 1990 | } |
| 2647 | 1991 | } |
| 2648 | 1992 | // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers |
| 2649 | else if (__nb <= __base::__map_.capacity() - __base::__map_.size()) | |
| 1993 | else if (__nb <= __map_.capacity() - __map_.size()) | |
| 2650 | 1994 | { // we can put the new buffers into the map, but don't shift things around |
| 2651 | 1995 | // until all buffers are allocated. If we throw, we don't need to fix |
| 2652 | 1996 | // anything up (any added buffers are undetectible) |
| 2653 | 1997 | for (; __nb > 0; --__nb) |
| 2654 | 1998 | { |
| 2655 | if (__base::__map_.__back_spare() == 0) | |
| 1999 | if (__map_.__back_spare() == 0) | |
| 2656 | 2000 | break; |
| 2657 | __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); | |
| 2001 | __map_.push_back(__alloc_traits::allocate(__a, __block_size)); | |
| 2658 | 2002 | } |
| 2659 | for (; __nb > 0; --__nb, ++__front_capacity, __base::__start_ += | |
| 2660 | __base::__block_size - (__base::__map_.size() == 1)) | |
| 2661 | __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); | |
| 2003 | for (; __nb > 0; --__nb, ++__front_capacity, __start_ += | |
| 2004 | __block_size - (__map_.size() == 1)) | |
| 2005 | __map_.push_front(__alloc_traits::allocate(__a, __block_size)); | |
| 2662 | 2006 | // Done allocating, reorder capacity |
| 2663 | __base::__start_ -= __base::__block_size * __front_capacity; | |
| 2007 | __start_ -= __block_size * __front_capacity; | |
| 2664 | 2008 | for (; __front_capacity > 0; --__front_capacity) |
| 2665 | 2009 | { |
| 2666 | pointer __pt = __base::__map_.front(); | |
| 2667 | __base::__map_.pop_front(); | |
| 2668 | __base::__map_.push_back(__pt); | |
| 2010 | pointer __pt = __map_.front(); | |
| 2011 | __map_.pop_front(); | |
| 2012 | __map_.push_back(__pt); | |
| 2669 | 2013 | } |
| 2670 | 2014 | } |
| 2671 | 2015 | // Else need to allocate __nb buffers, *and* we need to reallocate __map_. |
| 2672 | 2016 | else |
| 2673 | 2017 | { |
| 2674 | size_type __ds = __front_capacity * __base::__block_size; | |
| 2675 | __split_buffer<pointer, typename __base::__pointer_allocator&> | |
| 2676 | __buf(max<size_type>(2* __base::__map_.capacity(), | |
| 2677 | __nb + __base::__map_.size()), | |
| 2678 | __base::__map_.size() - __front_capacity, | |
| 2679 | __base::__map_.__alloc()); | |
| 2018 | size_type __ds = __front_capacity * __block_size; | |
| 2019 | __split_buffer<pointer, __pointer_allocator&> | |
| 2020 | __buf(std::max<size_type>(2* __map_.capacity(), | |
| 2021 | __nb + __map_.size()), | |
| 2022 | __map_.size() - __front_capacity, | |
| 2023 | __map_.__alloc()); | |
| 2680 | 2024 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2681 | 2025 | try |
| 2682 | 2026 | { |
| 2683 | 2027 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 2684 | 2028 | for (; __nb > 0; --__nb) |
| 2685 | __buf.push_back(__alloc_traits::allocate(__a, __base::__block_size)); | |
| 2029 | __buf.push_back(__alloc_traits::allocate(__a, __block_size)); | |
| 2686 | 2030 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2687 | 2031 | } |
| 2688 | 2032 | catch (...) |
| 2689 | 2033 | { |
| 2690 | for (typename __base::__map_pointer __i = __buf.begin(); | |
| 2034 | for (__map_pointer __i = __buf.begin(); | |
| 2691 | 2035 | __i != __buf.end(); ++__i) |
| 2692 | __alloc_traits::deallocate(__a, *__i, __base::__block_size); | |
| 2036 | __alloc_traits::deallocate(__a, *__i, __block_size); | |
| 2693 | 2037 | throw; |
| 2694 | 2038 | } |
| 2695 | 2039 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 2696 | 2040 | for (; __front_capacity > 0; --__front_capacity) |
| 2697 | 2041 | { |
| 2698 | __buf.push_back(__base::__map_.front()); | |
| 2699 | __base::__map_.pop_front(); | |
| 2042 | __buf.push_back(__map_.front()); | |
| 2043 | __map_.pop_front(); | |
| 2700 | 2044 | } |
| 2701 | for (typename __base::__map_pointer __i = __base::__map_.end(); | |
| 2702 | __i != __base::__map_.begin();) | |
| 2045 | for (__map_pointer __i = __map_.end(); | |
| 2046 | __i != __map_.begin();) | |
| 2703 | 2047 | __buf.push_front(*--__i); |
| 2704 | _VSTD::swap(__base::__map_.__first_, __buf.__first_); | |
| 2705 | _VSTD::swap(__base::__map_.__begin_, __buf.__begin_); | |
| 2706 | _VSTD::swap(__base::__map_.__end_, __buf.__end_); | |
| 2707 | _VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap()); | |
| 2708 | __base::__start_ -= __ds; | |
| 2048 | _VSTD::swap(__map_.__first_, __buf.__first_); | |
| 2049 | _VSTD::swap(__map_.__begin_, __buf.__begin_); | |
| 2050 | _VSTD::swap(__map_.__end_, __buf.__end_); | |
| 2051 | _VSTD::swap(__map_.__end_cap(), __buf.__end_cap()); | |
| 2052 | __start_ -= __ds; | |
| 2709 | 2053 | } |
| 2710 | 2054 | } |
| 2711 | 2055 | |
| ... | ... | @@ -2713,12 +2057,12 @@ template <class _Tp, class _Allocator> |
| 2713 | 2057 | void |
| 2714 | 2058 | deque<_Tp, _Allocator>::pop_front() |
| 2715 | 2059 | { |
| 2716 | allocator_type& __a = __base::__alloc(); | |
| 2717 | __alloc_traits::destroy(__a, _VSTD::__to_address(*(__base::__map_.begin() + | |
| 2718 | __base::__start_ / __base::__block_size) + | |
| 2719 | __base::__start_ % __base::__block_size)); | |
| 2720 | --__base::size(); | |
| 2721 | ++__base::__start_; | |
| 2060 | allocator_type& __a = __alloc(); | |
| 2061 | __alloc_traits::destroy(__a, _VSTD::__to_address(*(__map_.begin() + | |
| 2062 | __start_ / __block_size) + | |
| 2063 | __start_ % __block_size)); | |
| 2064 | --__size(); | |
| 2065 | ++__start_; | |
| 2722 | 2066 | __maybe_remove_front_spare(); |
| 2723 | 2067 | } |
| 2724 | 2068 | |
| ... | ... | @@ -2727,12 +2071,12 @@ void |
| 2727 | 2071 | deque<_Tp, _Allocator>::pop_back() |
| 2728 | 2072 | { |
| 2729 | 2073 | _LIBCPP_ASSERT(!empty(), "deque::pop_back called on an empty deque"); |
| 2730 | allocator_type& __a = __base::__alloc(); | |
| 2731 | size_type __p = __base::size() + __base::__start_ - 1; | |
| 2732 | __alloc_traits::destroy(__a, _VSTD::__to_address(*(__base::__map_.begin() + | |
| 2733 | __p / __base::__block_size) + | |
| 2734 | __p % __base::__block_size)); | |
| 2735 | --__base::size(); | |
| 2074 | allocator_type& __a = __alloc(); | |
| 2075 | size_type __p = size() + __start_ - 1; | |
| 2076 | __alloc_traits::destroy(__a, _VSTD::__to_address(*(__map_.begin() + | |
| 2077 | __p / __block_size) + | |
| 2078 | __p % __block_size)); | |
| 2079 | --__size(); | |
| 2736 | 2080 | __maybe_remove_back_spare(); |
| 2737 | 2081 | } |
| 2738 | 2082 | |
| ... | ... | @@ -2750,7 +2094,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __ |
| 2750 | 2094 | while (__n > 0) |
| 2751 | 2095 | { |
| 2752 | 2096 | pointer __fb = __f.__ptr_; |
| 2753 | pointer __fe = *__f.__m_iter_ + __base::__block_size; | |
| 2097 | pointer __fe = *__f.__m_iter_ + __block_size; | |
| 2754 | 2098 | difference_type __bs = __fe - __fb; |
| 2755 | 2099 | if (__bs > __n) |
| 2756 | 2100 | { |
| ... | ... | @@ -2804,15 +2148,15 @@ void |
| 2804 | 2148 | deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l, |
| 2805 | 2149 | iterator __r, const_pointer& __vt) |
| 2806 | 2150 | { |
| 2807 | allocator_type& __a = __base::__alloc(); | |
| 2151 | allocator_type& __a = __alloc(); | |
| 2808 | 2152 | // as if |
| 2809 | // for (; __f != __l; ++__r, ++__f, ++__base::size()) | |
| 2153 | // for (; __f != __l; ++__r, ++__f, ++__size()) | |
| 2810 | 2154 | // __alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__f)); |
| 2811 | 2155 | difference_type __n = __l - __f; |
| 2812 | 2156 | while (__n > 0) |
| 2813 | 2157 | { |
| 2814 | 2158 | pointer __fb = __f.__ptr_; |
| 2815 | pointer __fe = *__f.__m_iter_ + __base::__block_size; | |
| 2159 | pointer __fe = *__f.__m_iter_ + __block_size; | |
| 2816 | 2160 | difference_type __bs = __fe - __fb; |
| 2817 | 2161 | if (__bs > __n) |
| 2818 | 2162 | { |
| ... | ... | @@ -2821,7 +2165,7 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l, |
| 2821 | 2165 | } |
| 2822 | 2166 | if (__fb <= __vt && __vt < __fe) |
| 2823 | 2167 | __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_; |
| 2824 | for (; __fb != __fe; ++__fb, ++__r, ++__base::size()) | |
| 2168 | for (; __fb != __fe; ++__fb, ++__r, ++__size()) | |
| 2825 | 2169 | __alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__fb)); |
| 2826 | 2170 | __n -= __bs; |
| 2827 | 2171 | __f += __bs; |
| ... | ... | @@ -2835,13 +2179,13 @@ void |
| 2835 | 2179 | deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterator __l, |
| 2836 | 2180 | iterator __r, const_pointer& __vt) |
| 2837 | 2181 | { |
| 2838 | allocator_type& __a = __base::__alloc(); | |
| 2182 | allocator_type& __a = __alloc(); | |
| 2839 | 2183 | // as if |
| 2840 | 2184 | // for (iterator __j = __l; __j != __f;) |
| 2841 | 2185 | // { |
| 2842 | 2186 | // __alloc_traitsconstruct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__j)); |
| 2843 | // --__base::__start_; | |
| 2844 | // ++__base::size(); | |
| 2187 | // --__start_; | |
| 2188 | // ++__size(); | |
| 2845 | 2189 | // } |
| 2846 | 2190 | difference_type __n = __l - __f; |
| 2847 | 2191 | while (__n > 0) |
| ... | ... | @@ -2860,8 +2204,8 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat |
| 2860 | 2204 | while (__le != __lb) |
| 2861 | 2205 | { |
| 2862 | 2206 | __alloc_traits::construct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__le)); |
| 2863 | --__base::__start_; | |
| 2864 | ++__base::size(); | |
| 2207 | --__start_; | |
| 2208 | ++__size(); | |
| 2865 | 2209 | } |
| 2866 | 2210 | __n -= __bs; |
| 2867 | 2211 | __l -= __bs - 1; |
| ... | ... | @@ -2872,26 +2216,26 @@ template <class _Tp, class _Allocator> |
| 2872 | 2216 | typename deque<_Tp, _Allocator>::iterator |
| 2873 | 2217 | deque<_Tp, _Allocator>::erase(const_iterator __f) |
| 2874 | 2218 | { |
| 2875 | iterator __b = __base::begin(); | |
| 2219 | iterator __b = begin(); | |
| 2876 | 2220 | difference_type __pos = __f - __b; |
| 2877 | 2221 | iterator __p = __b + __pos; |
| 2878 | allocator_type& __a = __base::__alloc(); | |
| 2879 | if (static_cast<size_t>(__pos) <= (__base::size() - 1) / 2) | |
| 2222 | allocator_type& __a = __alloc(); | |
| 2223 | if (static_cast<size_t>(__pos) <= (size() - 1) / 2) | |
| 2880 | 2224 | { // erase from front |
| 2881 | 2225 | _VSTD::move_backward(__b, __p, _VSTD::next(__p)); |
| 2882 | 2226 | __alloc_traits::destroy(__a, _VSTD::addressof(*__b)); |
| 2883 | --__base::size(); | |
| 2884 | ++__base::__start_; | |
| 2227 | --__size(); | |
| 2228 | ++__start_; | |
| 2885 | 2229 | __maybe_remove_front_spare(); |
| 2886 | 2230 | } |
| 2887 | 2231 | else |
| 2888 | 2232 | { // erase from back |
| 2889 | iterator __i = _VSTD::move(_VSTD::next(__p), __base::end(), __p); | |
| 2233 | iterator __i = _VSTD::move(_VSTD::next(__p), end(), __p); | |
| 2890 | 2234 | __alloc_traits::destroy(__a, _VSTD::addressof(*__i)); |
| 2891 | --__base::size(); | |
| 2235 | --__size(); | |
| 2892 | 2236 | __maybe_remove_back_spare(); |
| 2893 | 2237 | } |
| 2894 | return __base::begin() + __pos; | |
| 2238 | return begin() + __pos; | |
| 2895 | 2239 | } |
| 2896 | 2240 | |
| 2897 | 2241 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -2899,49 +2243,49 @@ typename deque<_Tp, _Allocator>::iterator |
| 2899 | 2243 | deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l) |
| 2900 | 2244 | { |
| 2901 | 2245 | difference_type __n = __l - __f; |
| 2902 | iterator __b = __base::begin(); | |
| 2246 | iterator __b = begin(); | |
| 2903 | 2247 | difference_type __pos = __f - __b; |
| 2904 | 2248 | iterator __p = __b + __pos; |
| 2905 | 2249 | if (__n > 0) |
| 2906 | 2250 | { |
| 2907 | allocator_type& __a = __base::__alloc(); | |
| 2908 | if (static_cast<size_t>(__pos) <= (__base::size() - __n) / 2) | |
| 2251 | allocator_type& __a = __alloc(); | |
| 2252 | if (static_cast<size_t>(__pos) <= (size() - __n) / 2) | |
| 2909 | 2253 | { // erase from front |
| 2910 | 2254 | iterator __i = _VSTD::move_backward(__b, __p, __p + __n); |
| 2911 | 2255 | for (; __b != __i; ++__b) |
| 2912 | 2256 | __alloc_traits::destroy(__a, _VSTD::addressof(*__b)); |
| 2913 | __base::size() -= __n; | |
| 2914 | __base::__start_ += __n; | |
| 2257 | __size() -= __n; | |
| 2258 | __start_ += __n; | |
| 2915 | 2259 | while (__maybe_remove_front_spare()) { |
| 2916 | 2260 | } |
| 2917 | 2261 | } |
| 2918 | 2262 | else |
| 2919 | 2263 | { // erase from back |
| 2920 | iterator __i = _VSTD::move(__p + __n, __base::end(), __p); | |
| 2921 | for (iterator __e = __base::end(); __i != __e; ++__i) | |
| 2264 | iterator __i = _VSTD::move(__p + __n, end(), __p); | |
| 2265 | for (iterator __e = end(); __i != __e; ++__i) | |
| 2922 | 2266 | __alloc_traits::destroy(__a, _VSTD::addressof(*__i)); |
| 2923 | __base::size() -= __n; | |
| 2267 | __size() -= __n; | |
| 2924 | 2268 | while (__maybe_remove_back_spare()) { |
| 2925 | 2269 | } |
| 2926 | 2270 | } |
| 2927 | 2271 | } |
| 2928 | return __base::begin() + __pos; | |
| 2272 | return begin() + __pos; | |
| 2929 | 2273 | } |
| 2930 | 2274 | |
| 2931 | 2275 | template <class _Tp, class _Allocator> |
| 2932 | 2276 | void |
| 2933 | 2277 | deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f) |
| 2934 | 2278 | { |
| 2935 | iterator __e = __base::end(); | |
| 2279 | iterator __e = end(); | |
| 2936 | 2280 | difference_type __n = __e - __f; |
| 2937 | 2281 | if (__n > 0) |
| 2938 | 2282 | { |
| 2939 | allocator_type& __a = __base::__alloc(); | |
| 2940 | iterator __b = __base::begin(); | |
| 2283 | allocator_type& __a = __alloc(); | |
| 2284 | iterator __b = begin(); | |
| 2941 | 2285 | difference_type __pos = __f - __b; |
| 2942 | 2286 | for (iterator __p = __b + __pos; __p != __e; ++__p) |
| 2943 | 2287 | __alloc_traits::destroy(__a, _VSTD::addressof(*__p)); |
| 2944 | __base::size() -= __n; | |
| 2288 | __size() -= __n; | |
| 2945 | 2289 | while (__maybe_remove_back_spare()) { |
| 2946 | 2290 | } |
| 2947 | 2291 | } |
| ... | ... | @@ -2958,7 +2302,10 @@ deque<_Tp, _Allocator>::swap(deque& __c) |
| 2958 | 2302 | __is_nothrow_swappable<allocator_type>::value) |
| 2959 | 2303 | #endif |
| 2960 | 2304 | { |
| 2961 | __base::swap(__c); | |
| 2305 | __map_.swap(__c.__map_); | |
| 2306 | _VSTD::swap(__start_, __c.__start_); | |
| 2307 | _VSTD::swap(__size(), __c.__size()); | |
| 2308 | _VSTD::__swap_allocator(__alloc(), __c.__alloc()); | |
| 2962 | 2309 | } |
| 2963 | 2310 | |
| 2964 | 2311 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -2966,11 +2313,28 @@ inline |
| 2966 | 2313 | void |
| 2967 | 2314 | deque<_Tp, _Allocator>::clear() _NOEXCEPT |
| 2968 | 2315 | { |
| 2969 | __base::clear(); | |
| 2316 | allocator_type& __a = __alloc(); | |
| 2317 | for (iterator __i = begin(), __e = end(); __i != __e; ++__i) | |
| 2318 | __alloc_traits::destroy(__a, _VSTD::addressof(*__i)); | |
| 2319 | __size() = 0; | |
| 2320 | while (__map_.size() > 2) | |
| 2321 | { | |
| 2322 | __alloc_traits::deallocate(__a, __map_.front(), __block_size); | |
| 2323 | __map_.pop_front(); | |
| 2324 | } | |
| 2325 | switch (__map_.size()) | |
| 2326 | { | |
| 2327 | case 1: | |
| 2328 | __start_ = __block_size / 2; | |
| 2329 | break; | |
| 2330 | case 2: | |
| 2331 | __start_ = __block_size; | |
| 2332 | break; | |
| 2333 | } | |
| 2970 | 2334 | } |
| 2971 | 2335 | |
| 2972 | 2336 | template <class _Tp, class _Allocator> |
| 2973 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2337 | inline _LIBCPP_HIDE_FROM_ABI | |
| 2974 | 2338 | bool |
| 2975 | 2339 | operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 2976 | 2340 | { |
| ... | ... | @@ -2979,7 +2343,7 @@ operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 2979 | 2343 | } |
| 2980 | 2344 | |
| 2981 | 2345 | template <class _Tp, class _Allocator> |
| 2982 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2346 | inline _LIBCPP_HIDE_FROM_ABI | |
| 2983 | 2347 | bool |
| 2984 | 2348 | operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 2985 | 2349 | { |
| ... | ... | @@ -2987,7 +2351,7 @@ operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 2987 | 2351 | } |
| 2988 | 2352 | |
| 2989 | 2353 | template <class _Tp, class _Allocator> |
| 2990 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2354 | inline _LIBCPP_HIDE_FROM_ABI | |
| 2991 | 2355 | bool |
| 2992 | 2356 | operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 2993 | 2357 | { |
| ... | ... | @@ -2995,7 +2359,7 @@ operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 2995 | 2359 | } |
| 2996 | 2360 | |
| 2997 | 2361 | template <class _Tp, class _Allocator> |
| 2998 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2362 | inline _LIBCPP_HIDE_FROM_ABI | |
| 2999 | 2363 | bool |
| 3000 | 2364 | operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 3001 | 2365 | { |
| ... | ... | @@ -3003,7 +2367,7 @@ operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 3003 | 2367 | } |
| 3004 | 2368 | |
| 3005 | 2369 | template <class _Tp, class _Allocator> |
| 3006 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2370 | inline _LIBCPP_HIDE_FROM_ABI | |
| 3007 | 2371 | bool |
| 3008 | 2372 | operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 3009 | 2373 | { |
| ... | ... | @@ -3011,7 +2375,7 @@ operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 3011 | 2375 | } |
| 3012 | 2376 | |
| 3013 | 2377 | template <class _Tp, class _Allocator> |
| 3014 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2378 | inline _LIBCPP_HIDE_FROM_ABI | |
| 3015 | 2379 | bool |
| 3016 | 2380 | operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 3017 | 2381 | { |
| ... | ... | @@ -3019,7 +2383,7 @@ operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) |
| 3019 | 2383 | } |
| 3020 | 2384 | |
| 3021 | 2385 | template <class _Tp, class _Allocator> |
| 3022 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2386 | inline _LIBCPP_HIDE_FROM_ABI | |
| 3023 | 2387 | void |
| 3024 | 2388 | swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) |
| 3025 | 2389 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) |
| ... | ... | @@ -3029,7 +2393,7 @@ swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) |
| 3029 | 2393 | |
| 3030 | 2394 | #if _LIBCPP_STD_VER > 17 |
| 3031 | 2395 | template <class _Tp, class _Allocator, class _Up> |
| 3032 | inline _LIBCPP_INLINE_VISIBILITY typename deque<_Tp, _Allocator>::size_type | |
| 2396 | inline _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::size_type | |
| 3033 | 2397 | erase(deque<_Tp, _Allocator>& __c, const _Up& __v) { |
| 3034 | 2398 | auto __old_size = __c.size(); |
| 3035 | 2399 | __c.erase(_VSTD::remove(__c.begin(), __c.end(), __v), __c.end()); |
| ... | ... | @@ -3037,7 +2401,7 @@ erase(deque<_Tp, _Allocator>& __c, const _Up& __v) { |
| 3037 | 2401 | } |
| 3038 | 2402 | |
| 3039 | 2403 | template <class _Tp, class _Allocator, class _Predicate> |
| 3040 | inline _LIBCPP_INLINE_VISIBILITY typename deque<_Tp, _Allocator>::size_type | |
| 2404 | inline _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::size_type | |
| 3041 | 2405 | erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred) { |
| 3042 | 2406 | auto __old_size = __c.size(); |
| 3043 | 2407 | __c.erase(_VSTD::remove_if(__c.begin(), __c.end(), __pred), __c.end()); |
| ... | ... | @@ -3055,6 +2419,25 @@ inline constexpr bool __format::__enable_insertable<std::deque<wchar_t>> = true; |
| 3055 | 2419 | |
| 3056 | 2420 | _LIBCPP_END_NAMESPACE_STD |
| 3057 | 2421 | |
| 2422 | #if _LIBCPP_STD_VER > 14 | |
| 2423 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 2424 | namespace pmr { | |
| 2425 | template <class _ValueT> | |
| 2426 | using deque = std::deque<_ValueT, polymorphic_allocator<_ValueT>>; | |
| 2427 | } // namespace pmr | |
| 2428 | _LIBCPP_END_NAMESPACE_STD | |
| 2429 | #endif | |
| 2430 | ||
| 3058 | 2431 | _LIBCPP_POP_MACROS |
| 3059 | 2432 | |
| 2433 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 2434 | # include <algorithm> | |
| 2435 | # include <atomic> | |
| 2436 | # include <concepts> | |
| 2437 | # include <functional> | |
| 2438 | # include <iosfwd> | |
| 2439 | # include <iterator> | |
| 2440 | # include <typeinfo> | |
| 2441 | #endif | |
| 2442 | ||
| 3060 | 2443 | #endif // _LIBCPP_DEQUE |
lib/libcxx/include/errno.h+3-1| ... | ... | @@ -28,7 +28,9 @@ Macros: |
| 28 | 28 | # pragma GCC system_header |
| 29 | 29 | #endif |
| 30 | 30 | |
| 31 | #include_next <errno.h> | |
| 31 | #if __has_include_next(<errno.h>) | |
| 32 | # include_next <errno.h> | |
| 33 | #endif | |
| 32 | 34 | |
| 33 | 35 | #ifdef __cplusplus |
| 34 | 36 |
lib/libcxx/include/exception+70-16| ... | ... | @@ -80,13 +80,21 @@ template <class E> void rethrow_if_nested(const E& e); |
| 80 | 80 | #include <__availability> |
| 81 | 81 | #include <__config> |
| 82 | 82 | #include <__memory/addressof.h> |
| 83 | #include <__type_traits/decay.h> | |
| 84 | #include <__type_traits/is_base_of.h> | |
| 85 | #include <__type_traits/is_class.h> | |
| 86 | #include <__type_traits/is_convertible.h> | |
| 87 | #include <__type_traits/is_copy_constructible.h> | |
| 88 | #include <__type_traits/is_final.h> | |
| 89 | #include <__type_traits/is_polymorphic.h> | |
| 83 | 90 | #include <cstddef> |
| 84 | 91 | #include <cstdlib> |
| 85 | #include <type_traits> | |
| 86 | 92 | #include <version> |
| 87 | 93 | |
| 94 | // <vcruntime_exception.h> defines its own std::exception and std::bad_exception types, | |
| 95 | // which we use in order to be ABI-compatible with other STLs on Windows. | |
| 88 | 96 | #if defined(_LIBCPP_ABI_VCRUNTIME) |
| 89 | #include <vcruntime_exception.h> | |
| 97 | # include <vcruntime_exception.h> | |
| 90 | 98 | #endif |
| 91 | 99 | |
| 92 | 100 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -96,24 +104,66 @@ template <class E> void rethrow_if_nested(const E& e); |
| 96 | 104 | namespace std // purposefully not using versioning namespace |
| 97 | 105 | { |
| 98 | 106 | |
| 99 | #if !defined(_LIBCPP_ABI_VCRUNTIME) | |
| 100 | class _LIBCPP_EXCEPTION_ABI exception | |
| 101 | { | |
| 107 | #if defined(_LIBCPP_ABI_VCRUNTIME) && (!defined(_HAS_EXCEPTIONS) || _HAS_EXCEPTIONS != 0) | |
| 108 | // The std::exception class was already included above, but we're explicit about this condition here for clarity. | |
| 109 | ||
| 110 | #elif defined(_LIBCPP_ABI_VCRUNTIME) && _HAS_EXCEPTIONS == 0 | |
| 111 | // However, <vcruntime_exception.h> does not define std::exception and std::bad_exception | |
| 112 | // when _HAS_EXCEPTIONS == 0. | |
| 113 | // | |
| 114 | // Since libc++ still wants to provide the std::exception hierarchy even when _HAS_EXCEPTIONS == 0 | |
| 115 | // (after all those are simply types like any other), we define an ABI-compatible version | |
| 116 | // of the VCRuntime std::exception and std::bad_exception types in that mode. | |
| 117 | ||
| 118 | struct __std_exception_data { | |
| 119 | char const* _What; | |
| 120 | bool _DoFree; | |
| 121 | }; | |
| 122 | ||
| 123 | class exception { // base of all library exceptions | |
| 102 | 124 | public: |
| 103 | _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {} | |
| 104 | _LIBCPP_INLINE_VISIBILITY exception(const exception&) _NOEXCEPT = default; | |
| 125 | exception() _NOEXCEPT : __data_() {} | |
| 105 | 126 | |
| 106 | virtual ~exception() _NOEXCEPT; | |
| 107 | virtual const char* what() const _NOEXCEPT; | |
| 127 | explicit exception(char const* __message) _NOEXCEPT : __data_() { | |
| 128 | __data_._What = __message; | |
| 129 | __data_._DoFree = true; | |
| 130 | } | |
| 131 | ||
| 132 | exception(exception const&) _NOEXCEPT {} | |
| 133 | ||
| 134 | exception& operator=(exception const&) _NOEXCEPT { return *this; } | |
| 135 | ||
| 136 | virtual ~exception() _NOEXCEPT {} | |
| 137 | ||
| 138 | virtual char const* what() const _NOEXCEPT { return __data_._What ? __data_._What : "Unknown exception"; } | |
| 139 | ||
| 140 | private: | |
| 141 | __std_exception_data __data_; | |
| 108 | 142 | }; |
| 109 | 143 | |
| 110 | class _LIBCPP_EXCEPTION_ABI bad_exception | |
| 111 | : public exception | |
| 112 | { | |
| 144 | class bad_exception : public exception { | |
| 145 | public: | |
| 146 | bad_exception() _NOEXCEPT : exception("bad exception") {} | |
| 147 | }; | |
| 148 | ||
| 149 | #else // !defined(_LIBCPP_ABI_VCRUNTIME) | |
| 150 | // On all other platforms, we define our own std::exception and std::bad_exception types | |
| 151 | // regardless of whether exceptions are turned on as a language feature. | |
| 152 | ||
| 153 | class _LIBCPP_EXCEPTION_ABI exception { | |
| 113 | 154 | public: |
| 114 | _LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {} | |
| 115 | virtual ~bad_exception() _NOEXCEPT; | |
| 116 | virtual const char* what() const _NOEXCEPT; | |
| 155 | _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {} | |
| 156 | _LIBCPP_INLINE_VISIBILITY exception(const exception&) _NOEXCEPT = default; | |
| 157 | ||
| 158 | virtual ~exception() _NOEXCEPT; | |
| 159 | virtual const char* what() const _NOEXCEPT; | |
| 160 | }; | |
| 161 | ||
| 162 | class _LIBCPP_EXCEPTION_ABI bad_exception : public exception { | |
| 163 | public: | |
| 164 | _LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {} | |
| 165 | ~bad_exception() _NOEXCEPT override; | |
| 166 | const char* what() const _NOEXCEPT override; | |
| 117 | 167 | }; |
| 118 | 168 | #endif // !_LIBCPP_ABI_VCRUNTIME |
| 119 | 169 | |
| ... | ... | @@ -282,7 +332,7 @@ struct __throw_with_nested<_Tp, _Up, false> { |
| 282 | 332 | #endif |
| 283 | 333 | |
| 284 | 334 | template <class _Tp> |
| 285 | _LIBCPP_NORETURN | |
| 335 | _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI | |
| 286 | 336 | void |
| 287 | 337 | throw_with_nested(_Tp&& __t) |
| 288 | 338 | { |
| ... | ... | @@ -327,4 +377,8 @@ rethrow_if_nested(const _Ep&, |
| 327 | 377 | |
| 328 | 378 | } // namespace std |
| 329 | 379 | |
| 380 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 381 | # include <type_traits> | |
| 382 | #endif | |
| 383 | ||
| 330 | 384 | #endif // _LIBCPP_EXCEPTION |
lib/libcxx/include/expected created+54| ... | ... | @@ -0,0 +1,54 @@ |
| 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_EXPECTED | |
| 11 | #define _LIBCPP_EXPECTED | |
| 12 | ||
| 13 | /* | |
| 14 | Header <expected> synopsis | |
| 15 | ||
| 16 | namespace std { | |
| 17 | // [expected.unexpected], class template unexpected | |
| 18 | template<class E> class unexpected; | |
| 19 | ||
| 20 | // [expected.bad], class template bad_expected_access | |
| 21 | template<class E> class bad_expected_access; | |
| 22 | ||
| 23 | // [expected.bad.void], specialization for void | |
| 24 | template<> class bad_expected_access<void>; | |
| 25 | ||
| 26 | // in-place construction of unexpected values | |
| 27 | struct unexpect_t { | |
| 28 | explicit unexpect_t() = default; | |
| 29 | }; | |
| 30 | inline constexpr unexpect_t unexpect{}; | |
| 31 | ||
| 32 | // [expected.expected], class template expected | |
| 33 | template<class T, class E> class expected; | |
| 34 | ||
| 35 | // [expected.void], partial specialization of expected for void types | |
| 36 | template<class T, class E> requires is_void_v<T> class expected<T, E>; | |
| 37 | } | |
| 38 | ||
| 39 | */ | |
| 40 | ||
| 41 | #include <__assert> // all public C++ headers provide the assertion handler | |
| 42 | #include <__config> | |
| 43 | #include <__expected/bad_expected_access.h> | |
| 44 | #include <__expected/expected.h> | |
| 45 | #include <__expected/unexpect.h> | |
| 46 | #include <__expected/unexpected.h> | |
| 47 | #include <version> | |
| 48 | ||
| 49 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 50 | # pragma GCC system_header | |
| 51 | #endif | |
| 52 | ||
| 53 | #endif // _LIBCPP_EXPECTED | |
| 54 |
lib/libcxx/include/experimental/__memory+2-2| ... | ... | @@ -56,11 +56,11 @@ struct __lfts_uses_alloc_ctor_imp<true, _Tp, _Alloc, _Args...> |
| 56 | 56 | = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; |
| 57 | 57 | |
| 58 | 58 | static const bool __ic_second = |
| 59 | conditional< | |
| 59 | __conditional_t< | |
| 60 | 60 | __ic_first, |
| 61 | 61 | false_type, |
| 62 | 62 | is_constructible<_Tp, _Args..., _Alloc> |
| 63 | >::type::value; | |
| 63 | >::value; | |
| 64 | 64 | |
| 65 | 65 | static_assert(__ic_first || __ic_second, |
| 66 | 66 | "Request for uses allocator construction is ill-formed"); |
lib/libcxx/include/experimental/coroutine+24-7| ... | ... | @@ -50,10 +50,28 @@ template <class P> struct hash<coroutine_handle<P>>; |
| 50 | 50 | #include <__functional/operations.h> |
| 51 | 51 | #include <cstddef> |
| 52 | 52 | #include <experimental/__config> |
| 53 | #include <memory> // for hash<T*> | |
| 54 | 53 | #include <new> |
| 55 | 54 | #include <type_traits> |
| 56 | 55 | |
| 56 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 57 | # include <atomic> | |
| 58 | # include <climits> | |
| 59 | # include <cmath> | |
| 60 | # include <compare> | |
| 61 | # include <concepts> | |
| 62 | # include <ctime> | |
| 63 | # include <initializer_list> | |
| 64 | # include <iosfwd> | |
| 65 | # include <iterator> | |
| 66 | # include <memory> | |
| 67 | # include <ratio> | |
| 68 | # include <stdexcept> | |
| 69 | # include <tuple> | |
| 70 | # include <typeinfo> | |
| 71 | # include <utility> | |
| 72 | # include <variant> | |
| 73 | #endif | |
| 74 | ||
| 57 | 75 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 58 | 76 | # pragma GCC system_header |
| 59 | 77 | #endif |
| ... | ... | @@ -66,8 +84,7 @@ template <class _Tp, class = void> |
| 66 | 84 | struct __coroutine_traits_sfinae {}; |
| 67 | 85 | |
| 68 | 86 | template <class _Tp> |
| 69 | struct __coroutine_traits_sfinae< | |
| 70 | _Tp, typename __void_t<typename _Tp::promise_type>::type> | |
| 87 | struct __coroutine_traits_sfinae<_Tp, __void_t<typename _Tp::promise_type> > | |
| 71 | 88 | { |
| 72 | 89 | using promise_type = typename _Tp::promise_type; |
| 73 | 90 | }; |
| ... | ... | @@ -241,7 +258,7 @@ public: |
| 241 | 258 | |
| 242 | 259 | _LIBCPP_INLINE_VISIBILITY |
| 243 | 260 | static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT { |
| 244 | typedef typename remove_cv<_Promise>::type _RawPromise; | |
| 261 | typedef __remove_cv_t<_Promise> _RawPromise; | |
| 245 | 262 | coroutine_handle __tmp; |
| 246 | 263 | __tmp.__handle_ = __builtin_coro_promise( |
| 247 | 264 | _VSTD::addressof(const_cast<_RawPromise&>(__promise)), |
| ... | ... | @@ -269,9 +286,9 @@ public: |
| 269 | 286 | _LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return true; } |
| 270 | 287 | _LIBCPP_CONSTEXPR bool done() const _NOEXCEPT { return false; } |
| 271 | 288 | |
| 272 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void operator()() const _NOEXCEPT {} | |
| 273 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void resume() const _NOEXCEPT {} | |
| 274 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void destroy() const _NOEXCEPT {} | |
| 289 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void operator()() const _NOEXCEPT {} | |
| 290 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void resume() const _NOEXCEPT {} | |
| 291 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy() const _NOEXCEPT {} | |
| 275 | 292 | |
| 276 | 293 | private: |
| 277 | 294 | _LIBCPP_INLINE_VISIBILITY |
lib/libcxx/include/experimental/deque+4| ... | ... | @@ -40,9 +40,13 @@ namespace pmr { |
| 40 | 40 | |
| 41 | 41 | _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR |
| 42 | 42 | |
| 43 | #ifndef _LIBCPP_CXX03_LANG | |
| 44 | ||
| 43 | 45 | template <class _ValueT> |
| 44 | 46 | using deque = _VSTD::deque<_ValueT, polymorphic_allocator<_ValueT>>; |
| 45 | 47 | |
| 48 | #endif // _LIBCPP_CXX03_LANG | |
| 49 | ||
| 46 | 50 | _LIBCPP_END_NAMESPACE_LFTS_PMR |
| 47 | 51 | |
| 48 | 52 | #endif /* _LIBCPP_EXPERIMENTAL_DEQUE */ |
lib/libcxx/include/experimental/forward_list+4| ... | ... | @@ -40,9 +40,13 @@ namespace pmr { |
| 40 | 40 | |
| 41 | 41 | _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR |
| 42 | 42 | |
| 43 | #ifndef _LIBCPP_CXX03_LANG | |
| 44 | ||
| 43 | 45 | template <class _ValueT> |
| 44 | 46 | using forward_list = _VSTD::forward_list<_ValueT, polymorphic_allocator<_ValueT>>; |
| 45 | 47 | |
| 48 | #endif // _LIBCPP_CXX03_LANG | |
| 49 | ||
| 46 | 50 | _LIBCPP_END_NAMESPACE_LFTS_PMR |
| 47 | 51 | |
| 48 | 52 | #endif /* _LIBCPP_EXPERIMENTAL_FORWARD_LIST */ |
lib/libcxx/include/experimental/functional+25-25| ... | ... | @@ -85,9 +85,9 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS |
| 85 | 85 | # define _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER |
| 86 | 86 | # define _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER |
| 87 | 87 | #else |
| 88 | # define _LIBCPP_DEPRECATED_DEFAULT_SEARCHER _LIBCPP_DEPRECATED_("std::exprerimental::default_searcher will be removed in LLVM 17. Use std::default_searcher instead") | |
| 89 | # define _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER _LIBCPP_DEPRECATED_("std::exprerimental::boyer_moore_searcher will be removed in LLVM 17. Use std::boyer_moore_searcher instead") | |
| 90 | # define _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER _LIBCPP_DEPRECATED_("std::exprerimental::boyer_moore_horspool_searcher will be removed in LLVM 17. Use std::boyer_moore_horspool_searcher instead") | |
| 88 | # define _LIBCPP_DEPRECATED_DEFAULT_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::default_searcher will be removed in LLVM 17. Use std::default_searcher instead") | |
| 89 | # define _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::boyer_moore_searcher will be removed in LLVM 17. Use std::boyer_moore_searcher instead") | |
| 90 | # define _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::boyer_moore_horspool_searcher will be removed in LLVM 17. Use std::boyer_moore_horspool_searcher instead") | |
| 91 | 91 | #endif |
| 92 | 92 | |
| 93 | 93 | #if _LIBCPP_STD_VER > 11 |
| ... | ... | @@ -132,24 +132,24 @@ class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> { |
| 132 | 132 | typedef _Key key_type; |
| 133 | 133 | |
| 134 | 134 | const _Value __default_value_; |
| 135 | std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table; | |
| 135 | std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table_; | |
| 136 | 136 | |
| 137 | 137 | public: |
| 138 | 138 | _LIBCPP_INLINE_VISIBILITY |
| 139 | 139 | _BMSkipTable(size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred) |
| 140 | : __default_value_(__default), __table(__sz, __hf, __pred) {} | |
| 140 | : __default_value_(__default), __table_(__sz, __hf, __pred) {} | |
| 141 | 141 | |
| 142 | 142 | _LIBCPP_INLINE_VISIBILITY |
| 143 | 143 | void insert(const key_type &__key, value_type __val) |
| 144 | 144 | { |
| 145 | __table [__key] = __val; // Would skip_.insert (val) be better here? | |
| 145 | __table_ [__key] = __val; // Would skip_.insert (val) be better here? | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | _LIBCPP_INLINE_VISIBILITY |
| 149 | 149 | value_type operator [](const key_type & __key) const |
| 150 | 150 | { |
| 151 | auto __it = __table.find (__key); | |
| 152 | return __it == __table.end() ? __default_value_ : __it->second; | |
| 151 | auto __it = __table_.find (__key); | |
| 152 | return __it == __table_.end() ? __default_value_ : __it->second; | |
| 153 | 153 | } |
| 154 | 154 | }; |
| 155 | 155 | |
| ... | ... | @@ -161,27 +161,27 @@ private: |
| 161 | 161 | typedef _Value value_type; |
| 162 | 162 | typedef _Key key_type; |
| 163 | 163 | |
| 164 | typedef typename make_unsigned<key_type>::type unsigned_key_type; | |
| 164 | typedef __make_unsigned_t<key_type> unsigned_key_type; | |
| 165 | 165 | typedef std::array<value_type, 256> skip_map; |
| 166 | skip_map __table; | |
| 166 | skip_map __table_; | |
| 167 | 167 | |
| 168 | 168 | public: |
| 169 | 169 | _LIBCPP_INLINE_VISIBILITY |
| 170 | 170 | _BMSkipTable(size_t /*__sz*/, _Value __default, _Hash /*__hf*/, _BinaryPredicate /*__pred*/) |
| 171 | 171 | { |
| 172 | std::fill_n(__table.begin(), __table.size(), __default); | |
| 172 | std::fill_n(__table_.begin(), __table_.size(), __default); | |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | _LIBCPP_INLINE_VISIBILITY |
| 176 | 176 | void insert(key_type __key, value_type __val) |
| 177 | 177 | { |
| 178 | __table[static_cast<unsigned_key_type>(__key)] = __val; | |
| 178 | __table_[static_cast<unsigned_key_type>(__key)] = __val; | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | _LIBCPP_INLINE_VISIBILITY |
| 182 | 182 | value_type operator [](key_type __key) const |
| 183 | 183 | { |
| 184 | return __table[static_cast<unsigned_key_type>(__key)]; | |
| 184 | return __table_[static_cast<unsigned_key_type>(__key)]; | |
| 185 | 185 | } |
| 186 | 186 | }; |
| 187 | 187 | |
| ... | ... | @@ -205,8 +205,8 @@ public: |
| 205 | 205 | _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate()) |
| 206 | 206 | : __first_(__f), __last_(__l), __pred_(__pred), |
| 207 | 207 | __pattern_length_(_VSTD::distance(__first_, __last_)), |
| 208 | __skip_{make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)}, | |
| 209 | __suffix_{make_shared<vector<difference_type>>(__pattern_length_ + 1)} | |
| 208 | __skip_{std::make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)}, | |
| 209 | __suffix_{std::make_shared<vector<difference_type>>(__pattern_length_ + 1)} | |
| 210 | 210 | { |
| 211 | 211 | // build the skip table |
| 212 | 212 | for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i ) |
| ... | ... | @@ -223,12 +223,12 @@ public: |
| 223 | 223 | typename iterator_traits<_RandomAccessIterator2>::value_type>::value, |
| 224 | 224 | "Corpus and Pattern iterators must point to the same type"); |
| 225 | 225 | |
| 226 | if (__f == __l ) return make_pair(__l, __l); // empty corpus | |
| 227 | if (__first_ == __last_) return make_pair(__f, __f); // empty pattern | |
| 226 | if (__f == __l ) return std::make_pair(__l, __l); // empty corpus | |
| 227 | if (__first_ == __last_) return std::make_pair(__f, __f); // empty pattern | |
| 228 | 228 | |
| 229 | 229 | // If the pattern is larger than the corpus, we can't find it! |
| 230 | 230 | if ( __pattern_length_ > _VSTD::distance(__f, __l)) |
| 231 | return make_pair(__l, __l); | |
| 231 | return std::make_pair(__l, __l); | |
| 232 | 232 | |
| 233 | 233 | // Do the search |
| 234 | 234 | return this->__search(__f, __l); |
| ... | ... | @@ -260,7 +260,7 @@ private: |
| 260 | 260 | __j--; |
| 261 | 261 | // We matched - we're done! |
| 262 | 262 | if ( __j == 0 ) |
| 263 | return make_pair(__cur, __cur + __pattern_length_); | |
| 263 | return std::make_pair(__cur, __cur + __pattern_length_); | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | // Since we didn't match, figure out how far to skip forward |
| ... | ... | @@ -272,7 +272,7 @@ private: |
| 272 | 272 | __cur += __suffix[ __j ]; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | return make_pair(__l, __l); // We didn't find anything | |
| 275 | return std::make_pair(__l, __l); // We didn't find anything | |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | |
| ... | ... | @@ -373,12 +373,12 @@ public: |
| 373 | 373 | typename std::iterator_traits<_RandomAccessIterator2>::value_type>::value, |
| 374 | 374 | "Corpus and Pattern iterators must point to the same type"); |
| 375 | 375 | |
| 376 | if (__f == __l ) return make_pair(__l, __l); // empty corpus | |
| 377 | if (__first_ == __last_) return make_pair(__f, __f); // empty pattern | |
| 376 | if (__f == __l ) return std::make_pair(__l, __l); // empty corpus | |
| 377 | if (__first_ == __last_) return std::make_pair(__f, __f); // empty pattern | |
| 378 | 378 | |
| 379 | 379 | // If the pattern is larger than the corpus, we can't find it! |
| 380 | 380 | if ( __pattern_length_ > _VSTD::distance(__f, __l)) |
| 381 | return make_pair(__l, __l); | |
| 381 | return std::make_pair(__l, __l); | |
| 382 | 382 | |
| 383 | 383 | // Do the search |
| 384 | 384 | return this->__search(__f, __l); |
| ... | ... | @@ -407,12 +407,12 @@ private: |
| 407 | 407 | __j--; |
| 408 | 408 | // We matched - we're done! |
| 409 | 409 | if ( __j == 0 ) |
| 410 | return make_pair(__cur, __cur + __pattern_length_); | |
| 410 | return std::make_pair(__cur, __cur + __pattern_length_); | |
| 411 | 411 | } |
| 412 | 412 | __cur += __skip[__cur[__pattern_length_-1]]; |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | return make_pair(__l, __l); | |
| 415 | return std::make_pair(__l, __l); | |
| 416 | 416 | } |
| 417 | 417 | }; |
| 418 | 418 |
lib/libcxx/include/experimental/iterator+15-10| ... | ... | @@ -54,6 +54,7 @@ namespace std { |
| 54 | 54 | |
| 55 | 55 | #include <__assert> // all public C++ headers provide the assertion handler |
| 56 | 56 | #include <__memory/addressof.h> |
| 57 | #include <__type_traits/decay.h> | |
| 57 | 58 | #include <__utility/forward.h> |
| 58 | 59 | #include <__utility/move.h> |
| 59 | 60 | #include <experimental/__config> |
| ... | ... | @@ -82,19 +83,19 @@ public: |
| 82 | 83 | typedef void reference; |
| 83 | 84 | |
| 84 | 85 | ostream_joiner(ostream_type& __os, _Delim&& __d) |
| 85 | : __output_iter(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {} | |
| 86 | : __output_iter_(_VSTD::addressof(__os)), __delim_(_VSTD::move(__d)), __first_(true) {} | |
| 86 | 87 | |
| 87 | 88 | ostream_joiner(ostream_type& __os, const _Delim& __d) |
| 88 | : __output_iter(_VSTD::addressof(__os)), __delim(__d), __first(true) {} | |
| 89 | : __output_iter_(_VSTD::addressof(__os)), __delim_(__d), __first_(true) {} | |
| 89 | 90 | |
| 90 | 91 | |
| 91 | 92 | template<typename _Tp> |
| 92 | 93 | ostream_joiner& operator=(const _Tp& __v) |
| 93 | 94 | { |
| 94 | if (!__first) | |
| 95 | *__output_iter << __delim; | |
| 96 | __first = false; | |
| 97 | *__output_iter << __v; | |
| 95 | if (!__first_) | |
| 96 | *__output_iter_ << __delim_; | |
| 97 | __first_ = false; | |
| 98 | *__output_iter_ << __v; | |
| 98 | 99 | return *this; |
| 99 | 100 | } |
| 100 | 101 | |
| ... | ... | @@ -103,14 +104,14 @@ public: |
| 103 | 104 | ostream_joiner& operator++(int) _NOEXCEPT { return *this; } |
| 104 | 105 | |
| 105 | 106 | private: |
| 106 | ostream_type* __output_iter; | |
| 107 | _Delim __delim; | |
| 108 | bool __first; | |
| 107 | ostream_type* __output_iter_; | |
| 108 | _Delim __delim_; | |
| 109 | bool __first_; | |
| 109 | 110 | }; |
| 110 | 111 | |
| 111 | 112 | |
| 112 | 113 | template <class _CharT, class _Traits, class _Delim> |
| 113 | ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits> | |
| 114 | _LIBCPP_HIDE_FROM_ABI ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits> | |
| 114 | 115 | make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim && __d) |
| 115 | 116 | { return ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits>(__os, _VSTD::forward<_Delim>(__d)); } |
| 116 | 117 | |
| ... | ... | @@ -118,4 +119,8 @@ _LIBCPP_END_NAMESPACE_LFTS |
| 118 | 119 | |
| 119 | 120 | #endif // _LIBCPP_STD_VER > 11 |
| 120 | 121 | |
| 122 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 123 | # include <type_traits> | |
| 124 | #endif | |
| 125 | ||
| 121 | 126 | #endif // _LIBCPP_EXPERIMENTAL_ITERATOR |
lib/libcxx/include/experimental/list+4| ... | ... | @@ -40,9 +40,13 @@ namespace pmr { |
| 40 | 40 | |
| 41 | 41 | _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR |
| 42 | 42 | |
| 43 | #ifndef _LIBCPP_CXX03_LANG | |
| 44 | ||
| 43 | 45 | template <class _ValueT> |
| 44 | 46 | using list = _VSTD::list<_ValueT, polymorphic_allocator<_ValueT>>; |
| 45 | 47 | |
| 48 | #endif // _LIBCPP_CXX03_LANG | |
| 49 | ||
| 46 | 50 | _LIBCPP_END_NAMESPACE_LFTS_PMR |
| 47 | 51 | |
| 48 | 52 | #endif /* _LIBCPP_EXPERIMENTAL_LIST */ |
lib/libcxx/include/experimental/map+4| ... | ... | @@ -45,6 +45,8 @@ namespace pmr { |
| 45 | 45 | |
| 46 | 46 | _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR |
| 47 | 47 | |
| 48 | #ifndef _LIBCPP_CXX03_LANG | |
| 49 | ||
| 48 | 50 | template <class _Key, class _Value, class _Compare = less<_Key>> |
| 49 | 51 | using map = _VSTD::map<_Key, _Value, _Compare, |
| 50 | 52 | polymorphic_allocator<pair<const _Key, _Value>>>; |
| ... | ... | @@ -53,6 +55,8 @@ template <class _Key, class _Value, class _Compare = less<_Key>> |
| 53 | 55 | using multimap = _VSTD::multimap<_Key, _Value, _Compare, |
| 54 | 56 | polymorphic_allocator<pair<const _Key, _Value>>>; |
| 55 | 57 | |
| 58 | #endif // _LIBCPP_CXX03_LANG | |
| 59 | ||
| 56 | 60 | _LIBCPP_END_NAMESPACE_LFTS_PMR |
| 57 | 61 | |
| 58 | 62 | #endif /* _LIBCPP_EXPERIMENTAL_MAP */ |
lib/libcxx/include/experimental/memory_resource+37-13| ... | ... | @@ -65,16 +65,16 @@ namespace pmr { |
| 65 | 65 | */ |
| 66 | 66 | |
| 67 | 67 | #include <__assert> // all public C++ headers provide the assertion handler |
| 68 | #include <__tuple> | |
| 68 | #include <__memory/allocator_traits.h> | |
| 69 | 69 | #include <__utility/move.h> |
| 70 | 70 | #include <cstddef> |
| 71 | 71 | #include <cstdlib> |
| 72 | 72 | #include <experimental/__config> |
| 73 | 73 | #include <experimental/__memory> |
| 74 | 74 | #include <limits> |
| 75 | #include <memory> | |
| 76 | 75 | #include <new> |
| 77 | 76 | #include <stdexcept> |
| 77 | #include <tuple> | |
| 78 | 78 | #include <type_traits> |
| 79 | 79 | |
| 80 | 80 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -86,6 +86,12 @@ _LIBCPP_PUSH_MACROS |
| 86 | 86 | |
| 87 | 87 | _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR |
| 88 | 88 | |
| 89 | #define _LIBCPP_DEPCREATED_MEMORY_RESOURCE(name) \ | |
| 90 | _LIBCPP_DEPRECATED_("'std::experimental::pmr::" name \ | |
| 91 | "' is deprecated and will be removed in LLVM 18. Use 'std::pmr::" name "' instead.") | |
| 92 | ||
| 93 | #ifndef _LIBCPP_CXX03_LANG | |
| 94 | ||
| 89 | 95 | // Round __s up to next multiple of __a. |
| 90 | 96 | inline _LIBCPP_INLINE_VISIBILITY |
| 91 | 97 | size_t __aligned_allocation_size(size_t __s, size_t __a) _NOEXCEPT |
| ... | ... | @@ -95,7 +101,7 @@ size_t __aligned_allocation_size(size_t __s, size_t __a) _NOEXCEPT |
| 95 | 101 | } |
| 96 | 102 | |
| 97 | 103 | // 8.5, memory.resource |
| 98 | class _LIBCPP_TYPE_VIS memory_resource | |
| 104 | class _LIBCPP_DEPCREATED_MEMORY_RESOURCE("memory_resource") _LIBCPP_TYPE_VIS memory_resource | |
| 99 | 105 | { |
| 100 | 106 | static const size_t __max_align = _LIBCPP_ALIGNOF(max_align_t); |
| 101 | 107 | |
| ... | ... | @@ -123,37 +129,37 @@ private: |
| 123 | 129 | }; |
| 124 | 130 | |
| 125 | 131 | // 8.5.4, memory.resource.eq |
| 126 | inline _LIBCPP_INLINE_VISIBILITY | |
| 132 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator==(memory_resource, memory_resource)") inline _LIBCPP_INLINE_VISIBILITY | |
| 127 | 133 | bool operator==(memory_resource const & __lhs, |
| 128 | 134 | memory_resource const & __rhs) _NOEXCEPT |
| 129 | 135 | { |
| 130 | 136 | return &__lhs == &__rhs || __lhs.is_equal(__rhs); |
| 131 | 137 | } |
| 132 | 138 | |
| 133 | inline _LIBCPP_INLINE_VISIBILITY | |
| 139 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator!=(memory_resource, memory_resource)") inline _LIBCPP_INLINE_VISIBILITY | |
| 134 | 140 | bool operator!=(memory_resource const & __lhs, |
| 135 | 141 | memory_resource const & __rhs) _NOEXCEPT |
| 136 | 142 | { |
| 137 | 143 | return !(__lhs == __rhs); |
| 138 | 144 | } |
| 139 | 145 | |
| 140 | _LIBCPP_FUNC_VIS | |
| 146 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("new_delete_resource()") _LIBCPP_FUNC_VIS | |
| 141 | 147 | memory_resource * new_delete_resource() _NOEXCEPT; |
| 142 | 148 | |
| 143 | _LIBCPP_FUNC_VIS | |
| 149 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("null_memory_resource()") _LIBCPP_FUNC_VIS | |
| 144 | 150 | memory_resource * null_memory_resource() _NOEXCEPT; |
| 145 | 151 | |
| 146 | _LIBCPP_FUNC_VIS | |
| 152 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("get_default_resource()") _LIBCPP_FUNC_VIS | |
| 147 | 153 | memory_resource * get_default_resource() _NOEXCEPT; |
| 148 | 154 | |
| 149 | _LIBCPP_FUNC_VIS | |
| 155 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("set_default_resource()") _LIBCPP_FUNC_VIS | |
| 150 | 156 | memory_resource * set_default_resource(memory_resource * __new_res) _NOEXCEPT; |
| 151 | 157 | |
| 152 | 158 | // 8.6, memory.polymorphic.allocator.class |
| 153 | 159 | |
| 154 | 160 | // 8.6.1, memory.polymorphic.allocator.overview |
| 155 | 161 | template <class _ValueType> |
| 156 | class _LIBCPP_TEMPLATE_VIS polymorphic_allocator | |
| 162 | class _LIBCPP_DEPCREATED_MEMORY_RESOURCE("polymorphic_allocator") _LIBCPP_TEMPLATE_VIS polymorphic_allocator | |
| 157 | 163 | { |
| 158 | 164 | public: |
| 159 | 165 | typedef _ValueType value_type; |
| ... | ... | @@ -314,6 +320,7 @@ private: |
| 314 | 320 | // 8.6.4, memory.polymorphic.allocator.eq |
| 315 | 321 | |
| 316 | 322 | template <class _Tp, class _Up> |
| 323 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator==(const polymorphic_allocator&, const polymorphic_allocator&)") | |
| 317 | 324 | inline _LIBCPP_INLINE_VISIBILITY |
| 318 | 325 | bool operator==(polymorphic_allocator<_Tp> const & __lhs, |
| 319 | 326 | polymorphic_allocator<_Up> const & __rhs) _NOEXCEPT |
| ... | ... | @@ -322,6 +329,7 @@ bool operator==(polymorphic_allocator<_Tp> const & __lhs, |
| 322 | 329 | } |
| 323 | 330 | |
| 324 | 331 | template <class _Tp, class _Up> |
| 332 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator!=(const polymorphic_allocator&, const polymorphic_allocator&)") | |
| 325 | 333 | inline _LIBCPP_INLINE_VISIBILITY |
| 326 | 334 | bool operator!=(polymorphic_allocator<_Tp> const & __lhs, |
| 327 | 335 | polymorphic_allocator<_Up> const & __rhs) _NOEXCEPT |
| ... | ... | @@ -331,6 +339,7 @@ bool operator!=(polymorphic_allocator<_Tp> const & __lhs, |
| 331 | 339 | |
| 332 | 340 | // 8.7, memory.resource.adaptor |
| 333 | 341 | |
| 342 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 334 | 343 | // 8.7.1, memory.resource.adaptor.overview |
| 335 | 344 | template <class _CharAlloc> |
| 336 | 345 | class _LIBCPP_TEMPLATE_VIS __resource_adaptor_imp |
| ... | ... | @@ -379,7 +388,7 @@ public: |
| 379 | 388 | |
| 380 | 389 | // 8.7.3, memory.resource.adaptor.mem |
| 381 | 390 | private: |
| 382 | virtual void * do_allocate(size_t __bytes, size_t) | |
| 391 | void * do_allocate(size_t __bytes, size_t) override | |
| 383 | 392 | { |
| 384 | 393 | if (__bytes > __max_size()) |
| 385 | 394 | __throw_bad_array_new_length(); |
| ... | ... | @@ -387,7 +396,7 @@ private: |
| 387 | 396 | return __alloc_.allocate(__s); |
| 388 | 397 | } |
| 389 | 398 | |
| 390 | virtual void do_deallocate(void * __p, size_t __bytes, size_t) | |
| 399 | void do_deallocate(void * __p, size_t __bytes, size_t) override | |
| 391 | 400 | { |
| 392 | 401 | _LIBCPP_ASSERT(__bytes <= __max_size(), |
| 393 | 402 | "do_deallocate called for size which exceeds the maximum allocation size"); |
| ... | ... | @@ -395,7 +404,7 @@ private: |
| 395 | 404 | __alloc_.deallocate((_ValueType*)__p, __s); |
| 396 | 405 | } |
| 397 | 406 | |
| 398 | virtual bool do_is_equal(memory_resource const & __other) const _NOEXCEPT { | |
| 407 | bool do_is_equal(memory_resource const & __other) const _NOEXCEPT override { | |
| 399 | 408 | __resource_adaptor_imp const * __p |
| 400 | 409 | = dynamic_cast<__resource_adaptor_imp const *>(&__other); |
| 401 | 410 | return __p ? __alloc_ == __p->__alloc_ : false; |
| ... | ... | @@ -411,9 +420,24 @@ template <class _Alloc> |
| 411 | 420 | using resource_adaptor = __resource_adaptor_imp< |
| 412 | 421 | typename allocator_traits<_Alloc>::template rebind_alloc<char> |
| 413 | 422 | >; |
| 423 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 424 | ||
| 425 | #endif // _LIBCPP_CXX03_LANG | |
| 414 | 426 | |
| 415 | 427 | _LIBCPP_END_NAMESPACE_LFTS_PMR |
| 416 | 428 | |
| 417 | 429 | _LIBCPP_POP_MACROS |
| 418 | 430 | |
| 431 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 432 | # include <atomic> | |
| 433 | # include <climits> | |
| 434 | # include <concepts> | |
| 435 | # include <cstring> | |
| 436 | # include <ctime> | |
| 437 | # include <iterator> | |
| 438 | # include <memory> | |
| 439 | # include <ratio> | |
| 440 | # include <variant> | |
| 441 | #endif | |
| 442 | ||
| 419 | 443 | #endif /* _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE */ |
lib/libcxx/include/experimental/propagate_const+4-3| ... | ... | @@ -109,6 +109,7 @@ |
| 109 | 109 | |
| 110 | 110 | #include <__assert> // all public C++ headers provide the assertion handler |
| 111 | 111 | #include <__functional/operations.h> |
| 112 | #include <__fwd/hash.h> | |
| 112 | 113 | #include <__utility/forward.h> |
| 113 | 114 | #include <__utility/move.h> |
| 114 | 115 | #include <__utility/swap.h> |
| ... | ... | @@ -138,15 +139,15 @@ template <class _Tp> |
| 138 | 139 | class propagate_const |
| 139 | 140 | { |
| 140 | 141 | public: |
| 141 | typedef remove_reference_t<decltype(*declval<_Tp&>())> element_type; | |
| 142 | typedef remove_reference_t<decltype(*std::declval<_Tp&>())> element_type; | |
| 142 | 143 | |
| 143 | 144 | static_assert(!is_array<_Tp>::value, |
| 144 | 145 | "Instantiation of propagate_const with an array type is ill-formed."); |
| 145 | 146 | static_assert(!is_reference<_Tp>::value, |
| 146 | 147 | "Instantiation of propagate_const with a reference type is ill-formed."); |
| 147 | static_assert(!(is_pointer<_Tp>::value && is_function<typename remove_pointer<_Tp>::type>::value), | |
| 148 | static_assert(!(is_pointer<_Tp>::value && is_function<__remove_pointer_t<_Tp> >::value), | |
| 148 | 149 | "Instantiation of propagate_const with a function-pointer type is ill-formed."); |
| 149 | static_assert(!(is_pointer<_Tp>::value && is_same<typename remove_cv<typename remove_pointer<_Tp>::type>::type, void>::value), | |
| 150 | static_assert(!(is_pointer<_Tp>::value && is_same<__remove_cv_t<__remove_pointer_t<_Tp> >, void>::value), | |
| 150 | 151 | "Instantiation of propagate_const with a pointer to (possibly cv-qualified) void is ill-formed."); |
| 151 | 152 | |
| 152 | 153 | private: |
lib/libcxx/include/experimental/regex+8-4| ... | ... | @@ -48,18 +48,22 @@ namespace pmr { |
| 48 | 48 | |
| 49 | 49 | _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR |
| 50 | 50 | |
| 51 | #ifndef _LIBCPP_CXX03_LANG | |
| 52 | ||
| 51 | 53 | template <class _BiDirIter> |
| 52 | 54 | using match_results = |
| 53 | 55 | _VSTD::match_results<_BiDirIter, |
| 54 | 56 | polymorphic_allocator<_VSTD::sub_match<_BiDirIter>>>; |
| 55 | 57 | |
| 56 | typedef match_results<const char*> cmatch; | |
| 57 | typedef match_results<_VSTD_LFTS_PMR::string::const_iterator> smatch; | |
| 58 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("cmatch") typedef match_results<const char*> cmatch; | |
| 59 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("smatch") typedef match_results<_VSTD_LFTS_PMR::string::const_iterator> smatch; | |
| 58 | 60 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 59 | typedef match_results<const wchar_t*> wcmatch; | |
| 60 | typedef match_results<_VSTD_LFTS_PMR::wstring::const_iterator> wsmatch; | |
| 61 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("wcmatch") typedef match_results<const wchar_t*> wcmatch; | |
| 62 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("wsmatch") typedef match_results<_VSTD_LFTS_PMR::wstring::const_iterator> wsmatch; | |
| 61 | 63 | #endif |
| 62 | 64 | |
| 65 | #endif // _LIBCPP_CXX03_LANG | |
| 66 | ||
| 63 | 67 | _LIBCPP_END_NAMESPACE_LFTS_PMR |
| 64 | 68 | |
| 65 | 69 | #endif /* _LIBCPP_EXPERIMENTAL_REGEX */ |
lib/libcxx/include/experimental/set+4| ... | ... | @@ -45,6 +45,8 @@ namespace pmr { |
| 45 | 45 | |
| 46 | 46 | _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR |
| 47 | 47 | |
| 48 | #ifndef _LIBCPP_CXX03_LANG | |
| 49 | ||
| 48 | 50 | template <class _Value, class _Compare = less<_Value>> |
| 49 | 51 | using set = _VSTD::set<_Value, _Compare, |
| 50 | 52 | polymorphic_allocator<_Value>>; |
| ... | ... | @@ -53,6 +55,8 @@ template <class _Value, class _Compare = less<_Value>> |
| 53 | 55 | using multiset = _VSTD::multiset<_Value, _Compare, |
| 54 | 56 | polymorphic_allocator<_Value>>; |
| 55 | 57 | |
| 58 | #endif // _LIBCPP_CXX03_LANG | |
| 59 | ||
| 56 | 60 | _LIBCPP_END_NAMESPACE_LFTS_PMR |
| 57 | 61 | |
| 58 | 62 | #endif /* _LIBCPP_EXPERIMENTAL_SET */ |
lib/libcxx/include/experimental/simd+26-23| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP_EXPERIMENTAL_SIMD |
| 10 | 11 | #define _LIBCPP_EXPERIMENTAL_SIMD |
| 11 | 12 | |
| ... | ... | @@ -656,11 +657,6 @@ public: |
| 656 | 657 | #include <experimental/__config> |
| 657 | 658 | #include <tuple> |
| 658 | 659 | |
| 659 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 660 | # include <algorithm> | |
| 661 | # include <functional> | |
| 662 | #endif | |
| 663 | ||
| 664 | 660 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 665 | 661 | # pragma GCC system_header |
| 666 | 662 | #endif |
| ... | ... | @@ -720,12 +716,12 @@ public: |
| 720 | 716 | |
| 721 | 717 | #ifndef _LIBCPP_HAS_NO_VECTOR_EXTENSION |
| 722 | 718 | |
| 723 | constexpr size_t __floor_pow_of_2(size_t __val) { | |
| 719 | _LIBCPP_HIDE_FROM_ABI constexpr size_t __floor_pow_of_2(size_t __val) { | |
| 724 | 720 | return ((__val - 1) & __val) == 0 ? __val |
| 725 | 721 | : __floor_pow_of_2((__val - 1) & __val); |
| 726 | 722 | } |
| 727 | 723 | |
| 728 | constexpr size_t __ceil_pow_of_2(size_t __val) { | |
| 724 | _LIBCPP_HIDE_FROM_ABI constexpr size_t __ceil_pow_of_2(size_t __val) { | |
| 729 | 725 | return __val == 1 ? 1 : __floor_pow_of_2(__val - 1) << 1; |
| 730 | 726 | } |
| 731 | 727 | |
| ... | ... | @@ -913,25 +909,27 @@ public: |
| 913 | 909 | }; |
| 914 | 910 | |
| 915 | 911 | template <class _To, class _From> |
| 916 | constexpr decltype(_To{std::declval<_From>()}, true) | |
| 912 | _LIBCPP_HIDE_FROM_ABI constexpr decltype(_To{std::declval<_From>()}, true) | |
| 917 | 913 | __is_non_narrowing_convertible_impl(_From) { |
| 918 | 914 | return true; |
| 919 | 915 | } |
| 920 | 916 | |
| 921 | 917 | template <class _To> |
| 922 | constexpr bool __is_non_narrowing_convertible_impl(...) { | |
| 918 | _LIBCPP_HIDE_FROM_ABI constexpr bool __is_non_narrowing_convertible_impl(...) { | |
| 923 | 919 | return false; |
| 924 | 920 | } |
| 925 | 921 | |
| 926 | 922 | template <class _From, class _To> |
| 923 | _LIBCPP_HIDE_FROM_ABI | |
| 927 | 924 | constexpr typename std::enable_if<std::is_arithmetic<_To>::value && |
| 928 | 925 | std::is_arithmetic<_From>::value, |
| 929 | 926 | bool>::type |
| 930 | 927 | __is_non_narrowing_arithmetic_convertible() { |
| 931 | return __is_non_narrowing_convertible_impl<_To>(_From{}); | |
| 928 | return experimental::__is_non_narrowing_convertible_impl<_To>(_From{}); | |
| 932 | 929 | } |
| 933 | 930 | |
| 934 | 931 | template <class _From, class _To> |
| 932 | _LIBCPP_HIDE_FROM_ABI | |
| 935 | 933 | constexpr typename std::enable_if<!(std::is_arithmetic<_To>::value && |
| 936 | 934 | std::is_arithmetic<_From>::value), |
| 937 | 935 | bool>::type |
| ... | ... | @@ -940,13 +938,13 @@ __is_non_narrowing_arithmetic_convertible() { |
| 940 | 938 | } |
| 941 | 939 | |
| 942 | 940 | template <class _Tp> |
| 943 | constexpr _Tp __variadic_sum() { | |
| 941 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __variadic_sum() { | |
| 944 | 942 | return _Tp{}; |
| 945 | 943 | } |
| 946 | 944 | |
| 947 | 945 | template <class _Tp, class _Up, class... _Args> |
| 948 | constexpr _Tp __variadic_sum(_Up __first, _Args... __rest) { | |
| 949 | return static_cast<_Tp>(__first) + __variadic_sum<_Tp>(__rest...); | |
| 946 | _LIBCPP_HIDE_FROM_ABI constexpr _Tp __variadic_sum(_Up __first, _Args... __rest) { | |
| 947 | return static_cast<_Tp>(__first) + experimental::__variadic_sum<_Tp>(__rest...); | |
| 950 | 948 | } |
| 951 | 949 | |
| 952 | 950 | template <class _Tp> |
| ... | ... | @@ -955,7 +953,7 @@ struct __nodeduce { |
| 955 | 953 | }; |
| 956 | 954 | |
| 957 | 955 | template <class _Tp> |
| 958 | constexpr bool __vectorizable() { | |
| 956 | _LIBCPP_HIDE_FROM_ABI constexpr bool __vectorizable() { | |
| 959 | 957 | return std::is_arithmetic<_Tp>::value && !std::is_const<_Tp>::value && |
| 960 | 958 | !std::is_volatile<_Tp>::value && !std::is_same<_Tp, bool>::value; |
| 961 | 959 | } |
| ... | ... | @@ -1060,7 +1058,7 @@ struct simd_size<_Tp, __simd_abi<__kind, _Np>> |
| 1060 | 1058 | : std::integral_constant<size_t, _Np> { |
| 1061 | 1059 | static_assert( |
| 1062 | 1060 | std::is_arithmetic<_Tp>::value && |
| 1063 | !std::is_same<typename std::remove_const<_Tp>::type, bool>::value, | |
| 1061 | !std::is_same<__remove_const_t<_Tp>, bool>::value, | |
| 1064 | 1062 | "Element type should be vectorizable"); |
| 1065 | 1063 | }; |
| 1066 | 1064 | |
| ... | ... | @@ -1123,13 +1121,13 @@ struct __simd_cast_traits<simd<_Tp, _NewAbi>> { |
| 1123 | 1121 | }; |
| 1124 | 1122 | |
| 1125 | 1123 | template <class _Tp, class _Up, class _Abi> |
| 1126 | auto simd_cast(const simd<_Up, _Abi>& __v) | |
| 1124 | _LIBCPP_HIDE_FROM_ABI auto simd_cast(const simd<_Up, _Abi>& __v) | |
| 1127 | 1125 | -> decltype(__simd_cast_traits<_Tp>::__apply(__v)) { |
| 1128 | 1126 | return __simd_cast_traits<_Tp>::__apply(__v); |
| 1129 | 1127 | } |
| 1130 | 1128 | |
| 1131 | 1129 | template <class _Tp, class _Up, class _Abi> |
| 1132 | auto static_simd_cast(const simd<_Up, _Abi>& __v) | |
| 1130 | _LIBCPP_HIDE_FROM_ABI auto static_simd_cast(const simd<_Up, _Abi>& __v) | |
| 1133 | 1131 | -> decltype(__static_simd_cast_traits<_Tp>::__apply(__v)) { |
| 1134 | 1132 | return __static_simd_cast_traits<_Tp>::__apply(__v); |
| 1135 | 1133 | } |
| ... | ... | @@ -1172,12 +1170,12 @@ array<_SimdType, simd_size<typename _SimdType::value_type, _Abi>::value / |
| 1172 | 1170 | split(const simd_mask<typename _SimdType::value_type, _Abi>&); |
| 1173 | 1171 | |
| 1174 | 1172 | template <class _Tp, class... _Abis> |
| 1175 | simd<_Tp, abi_for_size_t<_Tp, __variadic_sum(simd_size<_Tp, _Abis>::value...)>> | |
| 1173 | simd<_Tp, abi_for_size_t<_Tp, experimental::__variadic_sum(simd_size<_Tp, _Abis>::value...)>> | |
| 1176 | 1174 | concat(const simd<_Tp, _Abis>&...); |
| 1177 | 1175 | |
| 1178 | 1176 | template <class _Tp, class... _Abis> |
| 1179 | 1177 | simd_mask<_Tp, |
| 1180 | abi_for_size_t<_Tp, __variadic_sum(simd_size<_Tp, _Abis>::value...)>> | |
| 1178 | abi_for_size_t<_Tp, experimental::__variadic_sum(simd_size<_Tp, _Abis>::value...)>> | |
| 1181 | 1179 | concat(const simd_mask<_Tp, _Abis>&...); |
| 1182 | 1180 | |
| 1183 | 1181 | // reductions [simd.mask.reductions] |
| ... | ... | @@ -1302,7 +1300,7 @@ class const_where_expression { |
| 1302 | 1300 | public: |
| 1303 | 1301 | const_where_expression(const const_where_expression&) = delete; |
| 1304 | 1302 | const_where_expression& operator=(const const_where_expression&) = delete; |
| 1305 | typename remove_const<_Tp>::type operator-() const&&; | |
| 1303 | __remove_const_t<_Tp> operator-() const&&; | |
| 1306 | 1304 | template <class _Up, class _Flags> |
| 1307 | 1305 | void copy_to(_Up*, _Flags) const&&; |
| 1308 | 1306 | }; |
| ... | ... | @@ -1369,8 +1367,8 @@ private: |
| 1369 | 1367 | __is_non_narrowing_arithmetic_convertible<_Up, _Tp>()) || |
| 1370 | 1368 | (!std::is_arithmetic<_Up>::value && |
| 1371 | 1369 | std::is_convertible<_Up, _Tp>::value) || |
| 1372 | std::is_same<typename std::remove_const<_Up>::type, int>::value || | |
| 1373 | (std::is_same<typename std::remove_const<_Up>::type, | |
| 1370 | std::is_same<__remove_const_t<_Up>, int>::value || | |
| 1371 | (std::is_same<__remove_const_t<_Up>, | |
| 1374 | 1372 | unsigned int>::value && |
| 1375 | 1373 | std::is_unsigned<_Tp>::value); |
| 1376 | 1374 | } |
| ... | ... | @@ -1381,7 +1379,7 @@ private: |
| 1381 | 1379 | std::integral_constant<size_t, __indicies>())...), |
| 1382 | 1380 | bool()) |
| 1383 | 1381 | __can_generate(std::index_sequence<__indicies...>) { |
| 1384 | return !__variadic_sum<bool>( | |
| 1382 | return !experimental::__variadic_sum<bool>( | |
| 1385 | 1383 | !__can_broadcast<decltype(std::declval<_Generator>()( |
| 1386 | 1384 | std::integral_constant<size_t, __indicies>()))>()...); |
| 1387 | 1385 | } |
| ... | ... | @@ -1579,4 +1577,9 @@ _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD |
| 1579 | 1577 | |
| 1580 | 1578 | _LIBCPP_POP_MACROS |
| 1581 | 1579 | |
| 1580 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1581 | # include <algorithm> | |
| 1582 | # include <functional> | |
| 1583 | #endif | |
| 1584 | ||
| 1582 | 1585 | #endif /* _LIBCPP_EXPERIMENTAL_SIMD */ |
lib/libcxx/include/experimental/string+12-4| ... | ... | @@ -49,17 +49,25 @@ namespace pmr { |
| 49 | 49 | |
| 50 | 50 | _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR |
| 51 | 51 | |
| 52 | #ifndef _LIBCPP_CXX03_LANG | |
| 53 | ||
| 54 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 55 | ||
| 52 | 56 | template <class _CharT, class _Traits = char_traits<_CharT>> |
| 53 | 57 | using basic_string = |
| 54 | 58 | _VSTD::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>; |
| 55 | 59 | |
| 56 | typedef basic_string<char> string; | |
| 57 | typedef basic_string<char16_t> u16string; | |
| 58 | typedef basic_string<char32_t> u32string; | |
| 60 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("string") typedef basic_string<char> string; | |
| 61 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("u16string") typedef basic_string<char16_t> u16string; | |
| 62 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("u32string") typedef basic_string<char32_t> u32string; | |
| 59 | 63 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 60 | typedef basic_string<wchar_t> wstring; | |
| 64 | _LIBCPP_DEPCREATED_MEMORY_RESOURCE("wstring") typedef basic_string<wchar_t> wstring; | |
| 61 | 65 | #endif |
| 62 | 66 | |
| 67 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 68 | ||
| 69 | #endif // _LIBCPP_CXX03_LANG | |
| 70 | ||
| 63 | 71 | _LIBCPP_END_NAMESPACE_LFTS_PMR |
| 64 | 72 | |
| 65 | 73 | #endif /* _LIBCPP_EXPERIMENTAL_STRING */ |
lib/libcxx/include/experimental/unordered_map+12-8| ... | ... | @@ -45,20 +45,14 @@ namespace pmr { |
| 45 | 45 | #include <experimental/memory_resource> |
| 46 | 46 | #include <unordered_map> |
| 47 | 47 | |
| 48 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 49 | # include <algorithm> | |
| 50 | # include <array> | |
| 51 | # include <bit> | |
| 52 | # include <functional> | |
| 53 | # include <vector> | |
| 54 | #endif | |
| 55 | ||
| 56 | 48 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 57 | 49 | # pragma GCC system_header |
| 58 | 50 | #endif |
| 59 | 51 | |
| 60 | 52 | _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR |
| 61 | 53 | |
| 54 | #ifndef _LIBCPP_CXX03_LANG | |
| 55 | ||
| 62 | 56 | template <class _Key, class _Value, |
| 63 | 57 | class _Hash = hash<_Key>, class _Pred = equal_to<_Key>> |
| 64 | 58 | using unordered_map = _VSTD::unordered_map<_Key, _Value, _Hash, _Pred, |
| ... | ... | @@ -69,6 +63,16 @@ template <class _Key, class _Value, |
| 69 | 63 | using unordered_multimap = _VSTD::unordered_multimap<_Key, _Value, _Hash, _Pred, |
| 70 | 64 | polymorphic_allocator<pair<const _Key, _Value>>>; |
| 71 | 65 | |
| 66 | #endif // _LIBCPP_CXX03_LANG | |
| 67 | ||
| 72 | 68 | _LIBCPP_END_NAMESPACE_LFTS_PMR |
| 73 | 69 | |
| 70 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 71 | # include <algorithm> | |
| 72 | # include <array> | |
| 73 | # include <bit> | |
| 74 | # include <functional> | |
| 75 | # include <vector> | |
| 76 | #endif | |
| 77 | ||
| 74 | 78 | #endif /* _LIBCPP_EXPERIMENTAL_UNORDERED_MAP */ |
lib/libcxx/include/experimental/unordered_set+4| ... | ... | @@ -45,6 +45,8 @@ namespace pmr { |
| 45 | 45 | |
| 46 | 46 | _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR |
| 47 | 47 | |
| 48 | #ifndef _LIBCPP_CXX03_LANG | |
| 49 | ||
| 48 | 50 | template <class _Value, |
| 49 | 51 | class _Hash = hash<_Value>, class _Pred = equal_to<_Value>> |
| 50 | 52 | using unordered_set = _VSTD::unordered_set<_Value, _Hash, _Pred, |
| ... | ... | @@ -55,6 +57,8 @@ template <class _Value, |
| 55 | 57 | using unordered_multiset = _VSTD::unordered_multiset<_Value, _Hash, _Pred, |
| 56 | 58 | polymorphic_allocator<_Value>>; |
| 57 | 59 | |
| 60 | #endif // _LIBCPP_CXX03_LANG | |
| 61 | ||
| 58 | 62 | _LIBCPP_END_NAMESPACE_LFTS_PMR |
| 59 | 63 | |
| 60 | 64 | #endif /* _LIBCPP_EXPERIMENTAL_UNORDERED_SET */ |
lib/libcxx/include/experimental/vector+4| ... | ... | @@ -40,9 +40,13 @@ namespace pmr { |
| 40 | 40 | |
| 41 | 41 | _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR |
| 42 | 42 | |
| 43 | #ifndef _LIBCPP_CXX03_LANG | |
| 44 | ||
| 43 | 45 | template <class _ValueT> |
| 44 | 46 | using vector = _VSTD::vector<_ValueT, polymorphic_allocator<_ValueT>>; |
| 45 | 47 | |
| 48 | #endif // _LIBCPP_CXX03_LANG | |
| 49 | ||
| 46 | 50 | _LIBCPP_END_NAMESPACE_LFTS_PMR |
| 47 | 51 | |
| 48 | 52 | #endif /* _LIBCPP_EXPERIMENTAL_VECTOR */ |
lib/libcxx/include/ext/__hash+1| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | |
| 15 | 15 | #include <__config> |
| 16 | 16 | #include <cstring> |
| 17 | #include <stddef.h> | |
| 17 | 18 | #include <string> |
| 18 | 19 | |
| 19 | 20 | namespace __gnu_cxx { |
lib/libcxx/include/ext/hash_map+11-11| ... | ... | @@ -210,10 +210,6 @@ template <class Key, class T, class Hash, class Pred, class Alloc> |
| 210 | 210 | #include <stdexcept> |
| 211 | 211 | #include <type_traits> |
| 212 | 212 | |
| 213 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 214 | # include <iterator> | |
| 215 | #endif | |
| 216 | ||
| 217 | 213 | #if defined(__DEPRECATED) && __DEPRECATED |
| 218 | 214 | #if defined(_LIBCPP_WARNING) |
| 219 | 215 | _LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>") |
| ... | ... | @@ -382,7 +378,7 @@ public: |
| 382 | 378 | typedef std::pair<key_type, mapped_type> value_type; |
| 383 | 379 | typedef typename _HashIterator::difference_type difference_type; |
| 384 | 380 | typedef value_type& reference; |
| 385 | typedef typename std::__rebind_pointer<typename _HashIterator::pointer, value_type>::type | |
| 381 | typedef std::__rebind_pointer_t<typename _HashIterator::pointer, value_type> | |
| 386 | 382 | pointer; |
| 387 | 383 | |
| 388 | 384 | _LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {} |
| ... | ... | @@ -427,7 +423,7 @@ public: |
| 427 | 423 | typedef std::pair<key_type, mapped_type> value_type; |
| 428 | 424 | typedef typename _HashIterator::difference_type difference_type; |
| 429 | 425 | typedef const value_type& reference; |
| 430 | typedef typename std::__rebind_pointer<typename _HashIterator::pointer, const value_type>::type | |
| 426 | typedef std::__rebind_pointer_t<typename _HashIterator::pointer, const value_type> | |
| 431 | 427 | pointer; |
| 432 | 428 | |
| 433 | 429 | _LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {} |
| ... | ... | @@ -487,8 +483,7 @@ private: |
| 487 | 483 | typedef std::pair<key_type, mapped_type> __value_type; |
| 488 | 484 | typedef __hash_map_hasher<__value_type, hasher> __hasher; |
| 489 | 485 | typedef __hash_map_equal<__value_type, key_equal> __key_equal; |
| 490 | typedef typename std::__rebind_alloc_helper< | |
| 491 | std::allocator_traits<allocator_type>, __value_type>::type __allocator_type; | |
| 486 | typedef std::__rebind_alloc<std::allocator_traits<allocator_type>, __value_type> __allocator_type; | |
| 492 | 487 | |
| 493 | 488 | typedef std::__hash_table<__value_type, __hasher, |
| 494 | 489 | __key_equal, __allocator_type> __table; |
| ... | ... | @@ -714,7 +709,7 @@ swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 714 | 709 | } |
| 715 | 710 | |
| 716 | 711 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 717 | bool | |
| 712 | _LIBCPP_HIDE_FROM_ABI bool | |
| 718 | 713 | operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 719 | 714 | const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) |
| 720 | 715 | { |
| ... | ... | @@ -761,7 +756,7 @@ private: |
| 761 | 756 | typedef std::pair<key_type, mapped_type> __value_type; |
| 762 | 757 | typedef __hash_map_hasher<__value_type, hasher> __hasher; |
| 763 | 758 | typedef __hash_map_equal<__value_type, key_equal> __key_equal; |
| 764 | typedef typename std::__rebind_alloc_helper<std::allocator_traits<allocator_type>, __value_type>::type __allocator_type; | |
| 759 | typedef std::__rebind_alloc<std::allocator_traits<allocator_type>, __value_type> __allocator_type; | |
| 765 | 760 | |
| 766 | 761 | typedef std::__hash_table<__value_type, __hasher, |
| 767 | 762 | __key_equal, __allocator_type> __table; |
| ... | ... | @@ -954,7 +949,7 @@ swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 954 | 949 | } |
| 955 | 950 | |
| 956 | 951 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 957 | bool | |
| 952 | _LIBCPP_HIDE_FROM_ABI bool | |
| 958 | 953 | operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 959 | 954 | const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) |
| 960 | 955 | { |
| ... | ... | @@ -987,4 +982,9 @@ operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 987 | 982 | |
| 988 | 983 | } // namespace __gnu_cxx |
| 989 | 984 | |
| 985 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 986 | # include <concepts> | |
| 987 | # include <iterator> | |
| 988 | #endif | |
| 989 | ||
| 990 | 990 | #endif // _LIBCPP_HASH_MAP |
lib/libcxx/include/ext/hash_set+7-6| ... | ... | @@ -199,10 +199,6 @@ template <class Value, class Hash, class Pred, class Alloc> |
| 199 | 199 | #include <ext/__hash> |
| 200 | 200 | #include <functional> |
| 201 | 201 | |
| 202 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 203 | # include <iterator> | |
| 204 | #endif | |
| 205 | ||
| 206 | 202 | #if defined(__DEPRECATED) && __DEPRECATED |
| 207 | 203 | #if defined(_LIBCPP_WARNING) |
| 208 | 204 | _LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>") |
| ... | ... | @@ -412,7 +408,7 @@ swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x, |
| 412 | 408 | } |
| 413 | 409 | |
| 414 | 410 | template <class _Value, class _Hash, class _Pred, class _Alloc> |
| 415 | bool | |
| 411 | _LIBCPP_HIDE_FROM_ABI bool | |
| 416 | 412 | operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x, |
| 417 | 413 | const hash_set<_Value, _Hash, _Pred, _Alloc>& __y) |
| 418 | 414 | { |
| ... | ... | @@ -633,7 +629,7 @@ swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x, |
| 633 | 629 | } |
| 634 | 630 | |
| 635 | 631 | template <class _Value, class _Hash, class _Pred, class _Alloc> |
| 636 | bool | |
| 632 | _LIBCPP_HIDE_FROM_ABI bool | |
| 637 | 633 | operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x, |
| 638 | 634 | const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y) |
| 639 | 635 | { |
| ... | ... | @@ -666,4 +662,9 @@ operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x, |
| 666 | 662 | |
| 667 | 663 | } // namespace __gnu_cxx |
| 668 | 664 | |
| 665 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 666 | # include <concepts> | |
| 667 | # include <iterator> | |
| 668 | #endif | |
| 669 | ||
| 669 | 670 | #endif // _LIBCPP_HASH_SET |
lib/libcxx/include/fenv.h+3-1| ... | ... | @@ -56,7 +56,9 @@ int feupdateenv(const fenv_t* envp); |
| 56 | 56 | # pragma GCC system_header |
| 57 | 57 | #endif |
| 58 | 58 | |
| 59 | #include_next <fenv.h> | |
| 59 | #if __has_include_next(<fenv.h>) | |
| 60 | # include_next <fenv.h> | |
| 61 | #endif | |
| 60 | 62 | |
| 61 | 63 | #ifdef __cplusplus |
| 62 | 64 |
lib/libcxx/include/filesystem+216-20| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP_FILESYSTEM |
| 10 | 11 | #define _LIBCPP_FILESYSTEM |
| 11 | 12 | |
| ... | ... | @@ -14,36 +15,223 @@ |
| 14 | 15 | |
| 15 | 16 | namespace std::filesystem { |
| 16 | 17 | |
| 17 | class path; | |
| 18 | // `class path` from http://eel.is/c++draft/fs.class.path.general#6 | |
| 19 | class path { | |
| 20 | public: | |
| 21 | using value_type = see below; | |
| 22 | using string_type = basic_string<value_type>; | |
| 23 | static constexpr value_type preferred_separator = see below; | |
| 24 | ||
| 25 | enum format; | |
| 26 | ||
| 27 | path() noexcept; | |
| 28 | path(const path& p); | |
| 29 | path(path&& p) noexcept; | |
| 30 | path(string_type&& source, format fmt = auto_format); | |
| 31 | template<class Source> | |
| 32 | path(const Source& source, format fmt = auto_format); | |
| 33 | template<class InputIterator> | |
| 34 | path(InputIterator first, InputIterator last, format fmt = auto_format); | |
| 35 | template<class Source> | |
| 36 | path(const Source& source, const locale& loc, format fmt = auto_format); | |
| 37 | template<class InputIterator> | |
| 38 | path(InputIterator first, InputIterator last, const locale& loc, format fmt = auto_format); | |
| 39 | ~path(); | |
| 40 | ||
| 41 | path& operator=(const path& p); | |
| 42 | path& operator=(path&& p) noexcept; | |
| 43 | path& operator=(string_type&& source); | |
| 44 | path& assign(string_type&& source); | |
| 45 | template<class Source> | |
| 46 | path& operator=(const Source& source); | |
| 47 | template<class Source> | |
| 48 | path& assign(const Source& source); | |
| 49 | template<class InputIterator> | |
| 50 | path& assign(InputIterator first, InputIterator last); | |
| 51 | ||
| 52 | path& operator/=(const path& p); | |
| 53 | template<class Source> | |
| 54 | path& operator/=(const Source& source); | |
| 55 | template<class Source> | |
| 56 | path& append(const Source& source); | |
| 57 | template<class InputIterator> | |
| 58 | path& append(InputIterator first, InputIterator last); | |
| 59 | ||
| 60 | path& operator+=(const path& x); | |
| 61 | path& operator+=(const string_type& x); | |
| 62 | path& operator+=(basic_string_view<value_type> x); | |
| 63 | path& operator+=(const value_type* x); | |
| 64 | path& operator+=(value_type x); | |
| 65 | template<class Source> | |
| 66 | path& operator+=(const Source& x); | |
| 67 | template<class EcharT> | |
| 68 | path& operator+=(EcharT x); | |
| 69 | template<class Source> | |
| 70 | path& concat(const Source& x); | |
| 71 | template<class InputIterator> | |
| 72 | path& concat(InputIterator first, InputIterator last); | |
| 73 | ||
| 74 | void clear() noexcept; | |
| 75 | path& make_preferred(); | |
| 76 | path& remove_filename(); | |
| 77 | path& replace_filename(const path& replacement); | |
| 78 | path& replace_extension(const path& replacement = path()); | |
| 79 | void swap(path& rhs) noexcept; | |
| 80 | ||
| 81 | friend bool operator==(const path& lhs, const path& rhs) noexcept; | |
| 82 | friend bool operator!=(const path& lhs, const path& rhs) noexcept; // removed in C++20 | |
| 83 | friend bool operator< (const path& lhs, const path& rhs) noexcept; // removed in C++20 | |
| 84 | friend bool operator<=(const path& lhs, const path& rhs) noexcept; // removed in C++20 | |
| 85 | friend bool operator> (const path& lhs, const path& rhs) noexcept; // removed in C++20 | |
| 86 | friend bool operator>=(const path& lhs, const path& rhs) noexcept; // removed in C++20 | |
| 87 | friend strong_ordering operator<=>(const path& lhs, const path& rhs) noexcept; // C++20 | |
| 88 | ||
| 89 | friend path operator/(const path& lhs, const path& rhs); | |
| 90 | ||
| 91 | const string_type& native() const noexcept; | |
| 92 | const value_type* c_str() const noexcept; | |
| 93 | operator string_type() const; | |
| 94 | ||
| 95 | template<class EcharT, class traits = char_traits<EcharT>, | |
| 96 | class Allocator = allocator<EcharT>> | |
| 97 | basic_string<EcharT, traits, Allocator> | |
| 98 | string(const Allocator& a = Allocator()) const; | |
| 99 | std::string string() const; | |
| 100 | std::wstring wstring() const; | |
| 101 | std::u8string u8string() const; | |
| 102 | std::u16string u16string() const; | |
| 103 | std::u32string u32string() const; | |
| 104 | ||
| 105 | template<class EcharT, class traits = char_traits<EcharT>, | |
| 106 | class Allocator = allocator<EcharT>> | |
| 107 | basic_string<EcharT, traits, Allocator> | |
| 108 | generic_string(const Allocator& a = Allocator()) const; | |
| 109 | std::string generic_string() const; | |
| 110 | std::wstring generic_wstring() const; | |
| 111 | std::u8string generic_u8string() const; | |
| 112 | std::u16string generic_u16string() const; | |
| 113 | std::u32string generic_u32string() const; | |
| 114 | ||
| 115 | int compare(const path& p) const noexcept; | |
| 116 | int compare(const string_type& s) const; | |
| 117 | int compare(basic_string_view<value_type> s) const; | |
| 118 | int compare(const value_type* s) const; | |
| 119 | ||
| 120 | path root_name() const; | |
| 121 | path root_directory() const; | |
| 122 | path root_path() const; | |
| 123 | path relative_path() const; | |
| 124 | path parent_path() const; | |
| 125 | path filename() const; | |
| 126 | path stem() const; | |
| 127 | path extension() const; | |
| 128 | ||
| 129 | [[nodiscard]] bool empty() const noexcept; | |
| 130 | bool has_root_name() const; | |
| 131 | bool has_root_directory() const; | |
| 132 | bool has_root_path() const; | |
| 133 | bool has_relative_path() const; | |
| 134 | bool has_parent_path() const; | |
| 135 | bool has_filename() const; | |
| 136 | bool has_stem() const; | |
| 137 | bool has_extension() const; | |
| 138 | bool is_absolute() const; | |
| 139 | bool is_relative() const; | |
| 140 | ||
| 141 | path lexically_normal() const; | |
| 142 | path lexically_relative(const path& base) const; | |
| 143 | path lexically_proximate(const path& base) const; | |
| 144 | ||
| 145 | class iterator; | |
| 146 | using const_iterator = iterator; | |
| 147 | ||
| 148 | iterator begin() const; | |
| 149 | iterator end() const; | |
| 150 | ||
| 151 | template<class charT, class traits> | |
| 152 | friend basic_ostream<charT, traits>& | |
| 153 | operator<<(basic_ostream<charT, traits>& os, const path& p); | |
| 154 | template<class charT, class traits> | |
| 155 | friend basic_istream<charT, traits>& | |
| 156 | operator>>(basic_istream<charT, traits>& is, path& p); | |
| 157 | }; | |
| 18 | 158 | |
| 19 | 159 | void swap(path& lhs, path& rhs) noexcept; |
| 20 | 160 | size_t hash_value(const path& p) noexcept; |
| 21 | 161 | |
| 22 | bool operator==(const path& lhs, const path& rhs) noexcept; | |
| 23 | bool operator!=(const path& lhs, const path& rhs) noexcept; | |
| 24 | bool operator< (const path& lhs, const path& rhs) noexcept; | |
| 25 | bool operator<=(const path& lhs, const path& rhs) noexcept; | |
| 26 | bool operator> (const path& lhs, const path& rhs) noexcept; | |
| 27 | bool operator>=(const path& lhs, const path& rhs) noexcept; | |
| 28 | ||
| 29 | path operator/ (const path& lhs, const path& rhs); | |
| 30 | ||
| 31 | // fs.path.io operators are friends of path. | |
| 32 | template <class charT, class traits> | |
| 33 | friend basic_ostream<charT, traits>& | |
| 34 | operator<<(basic_ostream<charT, traits>& os, const path& p); | |
| 35 | ||
| 36 | template <class charT, class traits> | |
| 37 | friend basic_istream<charT, traits>& | |
| 38 | operator>>(basic_istream<charT, traits>& is, path& p); | |
| 39 | ||
| 40 | 162 | template <class Source> |
| 41 | 163 | path u8path(const Source& source); |
| 42 | 164 | template <class InputIterator> |
| 43 | 165 | path u8path(InputIterator first, InputIterator last); |
| 44 | 166 | |
| 45 | 167 | class filesystem_error; |
| 46 | class directory_entry; | |
| 168 | ||
| 169 | class directory_entry { | |
| 170 | public: | |
| 171 | directory_entry() noexcept = default; | |
| 172 | directory_entry(const directory_entry&) = default; | |
| 173 | directory_entry(directory_entry&&) noexcept = default; | |
| 174 | explicit directory_entry(const filesystem::path& p); | |
| 175 | directory_entry(const filesystem::path& p, error_code& ec); | |
| 176 | ~directory_entry(); | |
| 177 | ||
| 178 | directory_entry& operator=(const directory_entry&) = default; | |
| 179 | directory_entry& operator=(directory_entry&&) noexcept = default; | |
| 180 | ||
| 181 | void assign(const filesystem::path& p); | |
| 182 | void assign(const filesystem::path& p, error_code& ec); | |
| 183 | void replace_filename(const filesystem::path& p); | |
| 184 | void replace_filename(const filesystem::path& p, error_code& ec); | |
| 185 | void refresh(); | |
| 186 | void refresh(error_code& ec) noexcept; | |
| 187 | ||
| 188 | const filesystem::path& path() const noexcept; | |
| 189 | operator const filesystem::path&() const noexcept; | |
| 190 | bool exists() const; | |
| 191 | bool exists(error_code& ec) const noexcept; | |
| 192 | bool is_block_file() const; | |
| 193 | bool is_block_file(error_code& ec) const noexcept; | |
| 194 | bool is_character_file() const; | |
| 195 | bool is_character_file(error_code& ec) const noexcept; | |
| 196 | bool is_directory() const; | |
| 197 | bool is_directory(error_code& ec) const noexcept; | |
| 198 | bool is_fifo() const; | |
| 199 | bool is_fifo(error_code& ec) const noexcept; | |
| 200 | bool is_other() const; | |
| 201 | bool is_other(error_code& ec) const noexcept; | |
| 202 | bool is_regular_file() const; | |
| 203 | bool is_regular_file(error_code& ec) const noexcept; | |
| 204 | bool is_socket() const; | |
| 205 | bool is_socket(error_code& ec) const noexcept; | |
| 206 | bool is_symlink() const; | |
| 207 | bool is_symlink(error_code& ec) const noexcept; | |
| 208 | uintmax_t file_size() const; | |
| 209 | uintmax_t file_size(error_code& ec) const noexcept; | |
| 210 | uintmax_t hard_link_count() const; | |
| 211 | uintmax_t hard_link_count(error_code& ec) const noexcept; | |
| 212 | file_time_type last_write_time() const; | |
| 213 | file_time_type last_write_time(error_code& ec) const noexcept; | |
| 214 | file_status status() const; | |
| 215 | file_status status(error_code& ec) const noexcept; | |
| 216 | file_status symlink_status() const; | |
| 217 | file_status symlink_status(error_code& ec) const noexcept; | |
| 218 | ||
| 219 | bool operator==(const directory_entry& rhs) const noexcept; | |
| 220 | bool operator!=(const directory_entry& rhs) const noexcept; // removed in C++20 | |
| 221 | bool operator< (const directory_entry& rhs) const noexcept; // removed in C++20 | |
| 222 | bool operator<=(const directory_entry& rhs) const noexcept; // removed in C++20 | |
| 223 | bool operator> (const directory_entry& rhs) const noexcept; // removed in C++20 | |
| 224 | bool operator>=(const directory_entry& rhs) const noexcept; // removed in C++20 | |
| 225 | strong_ordering operator<=>(const directory_entry& rhs) const noexcept; // since C++20 | |
| 226 | ||
| 227 | template<class charT, class traits> | |
| 228 | friend basic_ostream<charT, traits>& | |
| 229 | operator<<(basic_ostream<charT, traits>& os, const directory_entry& d); | |
| 230 | ||
| 231 | private: | |
| 232 | filesystem::path pathobject; // exposition only | |
| 233 | friend class directory_iterator; // exposition only | |
| 234 | }; | |
| 47 | 235 | |
| 48 | 236 | class directory_iterator; |
| 49 | 237 | |
| ... | ... | @@ -64,6 +252,8 @@ |
| 64 | 252 | uintmax_t capacity; |
| 65 | 253 | uintmax_t free; |
| 66 | 254 | uintmax_t available; |
| 255 | ||
| 256 | friend bool operator==(const space_info&, const space_info&) = default; // C++20 | |
| 67 | 257 | }; |
| 68 | 258 | |
| 69 | 259 | enum class file_type; |
| ... | ... | @@ -260,6 +450,8 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct |
| 260 | 450 | #include <version> |
| 261 | 451 | |
| 262 | 452 | // standard-mandated includes |
| 453 | ||
| 454 | // [fs.filesystem.syn] | |
| 263 | 455 | #include <compare> |
| 264 | 456 | |
| 265 | 457 | #if defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) |
| ... | ... | @@ -270,4 +462,8 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct |
| 270 | 462 | # pragma GCC system_header |
| 271 | 463 | #endif |
| 272 | 464 | |
| 465 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 466 | # include <concepts> | |
| 467 | #endif | |
| 468 | ||
| 273 | 469 | #endif // _LIBCPP_FILESYSTEM |
lib/libcxx/include/float.h+3-1| ... | ... | @@ -76,7 +76,9 @@ Macros: |
| 76 | 76 | # pragma GCC system_header |
| 77 | 77 | #endif |
| 78 | 78 | |
| 79 | #include_next <float.h> | |
| 79 | #if __has_include_next(<float.h>) | |
| 80 | # include_next <float.h> | |
| 81 | #endif | |
| 80 | 82 | |
| 81 | 83 | #ifdef __cplusplus |
| 82 | 84 |
lib/libcxx/include/format+39-636| ... | ... | @@ -112,6 +112,40 @@ namespace std { |
| 112 | 112 | using format_parse_context = basic_format_parse_context<char>; |
| 113 | 113 | using wformat_parse_context = basic_format_parse_context<wchar_t>; |
| 114 | 114 | |
| 115 | // [format.range], formatting of ranges | |
| 116 | // [format.range.fmtkind], variable template format_kind | |
| 117 | enum class range_format { // since C++23 | |
| 118 | disabled, | |
| 119 | map, | |
| 120 | set, | |
| 121 | sequence, | |
| 122 | string, | |
| 123 | debug_string | |
| 124 | }; | |
| 125 | ||
| 126 | template<class R> | |
| 127 | constexpr unspecified format_kind = unspecified; // since C++23 | |
| 128 | ||
| 129 | template<ranges::input_range R> | |
| 130 | requires same_as<R, remove_cvref_t<R>> | |
| 131 | constexpr range_format format_kind<R> = see below; // since C++23 | |
| 132 | ||
| 133 | // [format.range.formatter], class template range_formatter | |
| 134 | template<class T, class charT = char> | |
| 135 | requires same_as<remove_cvref_t<T>, T> && formattable<T, charT> | |
| 136 | class range_formatter; // since C++23 | |
| 137 | ||
| 138 | // [format.range.fmtdef], class template range-default-formatter | |
| 139 | template<range_format K, ranges::input_range R, class charT> | |
| 140 | struct range-default-formatter; // exposition only, since C++23 | |
| 141 | ||
| 142 | // [format.range.fmtmap], [format.range.fmtset], [format.range.fmtstr], | |
| 143 | // specializations for maps, sets, and strings | |
| 144 | template<ranges::input_range R, class charT> | |
| 145 | requires (format_kind<R> != range_format::disabled) && | |
| 146 | formattable<ranges::range_reference_t<R>, charT> | |
| 147 | struct formatter<R, charT> : range-default-formatter<format_kind<R>, R, charT> { }; // since C++23 | |
| 148 | ||
| 115 | 149 | // [format.arguments], arguments |
| 116 | 150 | // [format.arg], class template basic_format_arg |
| 117 | 151 | template<class Context> class basic_format_arg; |
| ... | ... | @@ -141,17 +175,17 @@ namespace std { |
| 141 | 175 | // Enable the contents of the header only when libc++ was built with experimental features enabled. |
| 142 | 176 | #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) |
| 143 | 177 | |
| 144 | #include <__algorithm/clamp.h> | |
| 145 | 178 | #include <__config> |
| 146 | #include <__debug> | |
| 147 | 179 | #include <__format/buffer.h> |
| 148 | 180 | #include <__format/concepts.h> |
| 181 | #include <__format/container_adaptor.h> | |
| 149 | 182 | #include <__format/enable_insertable.h> |
| 150 | 183 | #include <__format/format_arg.h> |
| 151 | 184 | #include <__format/format_arg_store.h> |
| 152 | 185 | #include <__format/format_args.h> |
| 153 | 186 | #include <__format/format_context.h> |
| 154 | 187 | #include <__format/format_error.h> |
| 188 | #include <__format/format_functions.h> | |
| 155 | 189 | #include <__format/format_fwd.h> |
| 156 | 190 | #include <__format/format_parse_context.h> |
| 157 | 191 | #include <__format/format_string.h> |
| ... | ... | @@ -163,647 +197,16 @@ namespace std { |
| 163 | 197 | #include <__format/formatter_integer.h> |
| 164 | 198 | #include <__format/formatter_pointer.h> |
| 165 | 199 | #include <__format/formatter_string.h> |
| 200 | #include <__format/formatter_tuple.h> | |
| 166 | 201 | #include <__format/parser_std_format_spec.h> |
| 202 | #include <__format/range_default_formatter.h> | |
| 203 | #include <__format/range_formatter.h> | |
| 167 | 204 | #include <__format/unicode.h> |
| 168 | #include <__iterator/back_insert_iterator.h> | |
| 169 | #include <__iterator/incrementable_traits.h> | |
| 170 | #include <__variant/monostate.h> | |
| 171 | #include <array> | |
| 172 | #include <concepts> | |
| 173 | #include <string> | |
| 174 | #include <string_view> | |
| 175 | #include <type_traits> | |
| 176 | ||
| 177 | #ifndef _LIBCPP_HAS_NO_LOCALIZATION | |
| 178 | #include <locale> | |
| 179 | #endif | |
| 180 | 205 | |
| 181 | 206 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 182 | 207 | # pragma GCC system_header |
| 183 | 208 | #endif |
| 184 | 209 | |
| 185 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 186 | ||
| 187 | #if _LIBCPP_STD_VER > 17 | |
| 188 | ||
| 189 | // TODO FMT Move the implementation in this file to its own granular headers. | |
| 190 | ||
| 191 | // TODO FMT Evaluate which templates should be external templates. This | |
| 192 | // improves the efficiency of the header. However since the header is still | |
| 193 | // under heavy development and not all classes are stable it makes no sense | |
| 194 | // to do this optimization now. | |
| 195 | ||
| 196 | using format_args = basic_format_args<format_context>; | |
| 197 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 198 | using wformat_args = basic_format_args<wformat_context>; | |
| 199 | #endif | |
| 200 | ||
| 201 | template <class _Context = format_context, class... _Args> | |
| 202 | _LIBCPP_HIDE_FROM_ABI __format_arg_store<_Context, _Args...> make_format_args(_Args&&... __args) { | |
| 203 | return _VSTD::__format_arg_store<_Context, _Args...>(__args...); | |
| 204 | } | |
| 205 | ||
| 206 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 207 | template <class... _Args> | |
| 208 | _LIBCPP_HIDE_FROM_ABI __format_arg_store<wformat_context, _Args...> make_wformat_args(_Args&&... __args) { | |
| 209 | return _VSTD::__format_arg_store<wformat_context, _Args...>(__args...); | |
| 210 | } | |
| 211 | #endif | |
| 212 | ||
| 213 | namespace __format { | |
| 214 | ||
| 215 | /// Helper class parse and handle argument. | |
| 216 | /// | |
| 217 | /// When parsing a handle which is not enabled the code is ill-formed. | |
| 218 | /// This helper uses the parser of the appropriate formatter for the stored type. | |
| 219 | template <class _CharT> | |
| 220 | class _LIBCPP_TEMPLATE_VIS __compile_time_handle { | |
| 221 | public: | |
| 222 | _LIBCPP_HIDE_FROM_ABI | |
| 223 | constexpr void __parse(basic_format_parse_context<_CharT>& __parse_ctx) const { __parse_(__parse_ctx); } | |
| 224 | ||
| 225 | template <class _Tp> | |
| 226 | _LIBCPP_HIDE_FROM_ABI constexpr void __enable() { | |
| 227 | __parse_ = [](basic_format_parse_context<_CharT>& __parse_ctx) { | |
| 228 | formatter<_Tp, _CharT> __f; | |
| 229 | __parse_ctx.advance_to(__f.parse(__parse_ctx)); | |
| 230 | }; | |
| 231 | } | |
| 232 | ||
| 233 | // Before calling __parse the proper handler needs to be set with __enable. | |
| 234 | // The default handler isn't a core constant expression. | |
| 235 | _LIBCPP_HIDE_FROM_ABI constexpr __compile_time_handle() | |
| 236 | : __parse_([](basic_format_parse_context<_CharT>&) { __throw_format_error("Not a handle"); }) {} | |
| 237 | ||
| 238 | private: | |
| 239 | void (*__parse_)(basic_format_parse_context<_CharT>&); | |
| 240 | }; | |
| 241 | ||
| 242 | // Dummy format_context only providing the parts used during constant | |
| 243 | // validation of the basic_format_string. | |
| 244 | template <class _CharT> | |
| 245 | struct _LIBCPP_TEMPLATE_VIS __compile_time_basic_format_context { | |
| 246 | public: | |
| 247 | using char_type = _CharT; | |
| 248 | ||
| 249 | _LIBCPP_HIDE_FROM_ABI constexpr explicit __compile_time_basic_format_context( | |
| 250 | const __arg_t* __args, const __compile_time_handle<_CharT>* __handles, size_t __size) | |
| 251 | : __args_(__args), __handles_(__handles), __size_(__size) {} | |
| 252 | ||
| 253 | // During the compile-time validation nothing needs to be written. | |
| 254 | // Therefore all operations of this iterator are a NOP. | |
| 255 | struct iterator { | |
| 256 | _LIBCPP_HIDE_FROM_ABI constexpr iterator& operator=(_CharT) { return *this; } | |
| 257 | _LIBCPP_HIDE_FROM_ABI constexpr iterator& operator*() { return *this; } | |
| 258 | _LIBCPP_HIDE_FROM_ABI constexpr iterator operator++(int) { return *this; } | |
| 259 | }; | |
| 260 | ||
| 261 | _LIBCPP_HIDE_FROM_ABI constexpr __arg_t arg(size_t __id) const { | |
| 262 | if (__id >= __size_) | |
| 263 | __throw_format_error("Argument index out of bounds"); | |
| 264 | return __args_[__id]; | |
| 265 | } | |
| 266 | ||
| 267 | _LIBCPP_HIDE_FROM_ABI constexpr const __compile_time_handle<_CharT>& __handle(size_t __id) const { | |
| 268 | if (__id >= __size_) | |
| 269 | __throw_format_error("Argument index out of bounds"); | |
| 270 | return __handles_[__id]; | |
| 271 | } | |
| 272 | ||
| 273 | _LIBCPP_HIDE_FROM_ABI constexpr iterator out() { return {}; } | |
| 274 | _LIBCPP_HIDE_FROM_ABI constexpr void advance_to(iterator) {} | |
| 275 | ||
| 276 | private: | |
| 277 | const __arg_t* __args_; | |
| 278 | const __compile_time_handle<_CharT>* __handles_; | |
| 279 | size_t __size_; | |
| 280 | }; | |
| 281 | ||
| 282 | _LIBCPP_HIDE_FROM_ABI | |
| 283 | constexpr void __compile_time_validate_integral(__arg_t __type) { | |
| 284 | switch (__type) { | |
| 285 | case __arg_t::__int: | |
| 286 | case __arg_t::__long_long: | |
| 287 | case __arg_t::__i128: | |
| 288 | case __arg_t::__unsigned: | |
| 289 | case __arg_t::__unsigned_long_long: | |
| 290 | case __arg_t::__u128: | |
| 291 | return; | |
| 292 | ||
| 293 | default: | |
| 294 | __throw_format_error("Argument isn't an integral type"); | |
| 295 | } | |
| 296 | } | |
| 297 | ||
| 298 | // _HasPrecision does the formatter have a precision? | |
| 299 | template <class _CharT, class _Tp, bool _HasPrecision = false> | |
| 300 | _LIBCPP_HIDE_FROM_ABI constexpr void | |
| 301 | __compile_time_validate_argument(basic_format_parse_context<_CharT>& __parse_ctx, | |
| 302 | __compile_time_basic_format_context<_CharT>& __ctx) { | |
| 303 | formatter<_Tp, _CharT> __formatter; | |
| 304 | __parse_ctx.advance_to(__formatter.parse(__parse_ctx)); | |
| 305 | // [format.string.std]/7 | |
| 306 | // ... If the corresponding formatting argument is not of integral type, or | |
| 307 | // its value is negative for precision or non-positive for width, an | |
| 308 | // exception of type format_error is thrown. | |
| 309 | // | |
| 310 | // Validate whether the arguments are integrals. | |
| 311 | if constexpr (requires(formatter<_Tp, _CharT> __f) { __f.__width_needs_substitution(); }) { | |
| 312 | // TODO FMT Remove this when parser v1 has been phased out. | |
| 313 | if (__formatter.__width_needs_substitution()) | |
| 314 | __format::__compile_time_validate_integral(__ctx.arg(__formatter.__width)); | |
| 315 | ||
| 316 | if constexpr (_HasPrecision) | |
| 317 | if (__formatter.__precision_needs_substitution()) | |
| 318 | __format::__compile_time_validate_integral(__ctx.arg(__formatter.__precision)); | |
| 319 | } else { | |
| 320 | if (__formatter.__parser_.__width_as_arg_) | |
| 321 | __format::__compile_time_validate_integral(__ctx.arg(__formatter.__parser_.__width_)); | |
| 322 | ||
| 323 | if constexpr (_HasPrecision) | |
| 324 | if (__formatter.__parser_.__precision_as_arg_) | |
| 325 | __format::__compile_time_validate_integral(__ctx.arg(__formatter.__parser_.__precision_)); | |
| 326 | } | |
| 327 | } | |
| 328 | ||
| 329 | template <class _CharT> | |
| 330 | _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_format_parse_context<_CharT>& __parse_ctx, | |
| 331 | __compile_time_basic_format_context<_CharT>& __ctx, | |
| 332 | __arg_t __type) { | |
| 333 | switch (__type) { | |
| 334 | case __arg_t::__none: | |
| 335 | __throw_format_error("Invalid argument"); | |
| 336 | case __arg_t::__boolean: | |
| 337 | return __format::__compile_time_validate_argument<_CharT, bool>(__parse_ctx, __ctx); | |
| 338 | case __arg_t::__char_type: | |
| 339 | return __format::__compile_time_validate_argument<_CharT, _CharT>(__parse_ctx, __ctx); | |
| 340 | case __arg_t::__int: | |
| 341 | return __format::__compile_time_validate_argument<_CharT, int>(__parse_ctx, __ctx); | |
| 342 | case __arg_t::__long_long: | |
| 343 | return __format::__compile_time_validate_argument<_CharT, long long>(__parse_ctx, __ctx); | |
| 344 | case __arg_t::__i128: | |
| 345 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 346 | return __format::__compile_time_validate_argument<_CharT, __int128_t>(__parse_ctx, __ctx); | |
| 347 | # else | |
| 348 | __throw_format_error("Invalid argument"); | |
| 349 | # endif | |
| 350 | return; | |
| 351 | case __arg_t::__unsigned: | |
| 352 | return __format::__compile_time_validate_argument<_CharT, unsigned>(__parse_ctx, __ctx); | |
| 353 | case __arg_t::__unsigned_long_long: | |
| 354 | return __format::__compile_time_validate_argument<_CharT, unsigned long long>(__parse_ctx, __ctx); | |
| 355 | case __arg_t::__u128: | |
| 356 | # ifndef _LIBCPP_HAS_NO_INT128 | |
| 357 | return __format::__compile_time_validate_argument<_CharT, __uint128_t>(__parse_ctx, __ctx); | |
| 358 | # else | |
| 359 | __throw_format_error("Invalid argument"); | |
| 360 | # endif | |
| 361 | return; | |
| 362 | case __arg_t::__float: | |
| 363 | return __format::__compile_time_validate_argument<_CharT, float, true>(__parse_ctx, __ctx); | |
| 364 | case __arg_t::__double: | |
| 365 | return __format::__compile_time_validate_argument<_CharT, double, true>(__parse_ctx, __ctx); | |
| 366 | case __arg_t::__long_double: | |
| 367 | return __format::__compile_time_validate_argument<_CharT, long double, true>(__parse_ctx, __ctx); | |
| 368 | case __arg_t::__const_char_type_ptr: | |
| 369 | return __format::__compile_time_validate_argument<_CharT, const _CharT*, true>(__parse_ctx, __ctx); | |
| 370 | case __arg_t::__string_view: | |
| 371 | return __format::__compile_time_validate_argument<_CharT, basic_string_view<_CharT>, true>(__parse_ctx, __ctx); | |
| 372 | case __arg_t::__ptr: | |
| 373 | return __format::__compile_time_validate_argument<_CharT, const void*>(__parse_ctx, __ctx); | |
| 374 | case __arg_t::__handle: | |
| 375 | __throw_format_error("Handle should use __compile_time_validate_handle_argument"); | |
| 376 | } | |
| 377 | __throw_format_error("Invalid argument"); | |
| 378 | } | |
| 379 | ||
| 380 | template <class _CharT, class _ParseCtx, class _Ctx> | |
| 381 | _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* | |
| 382 | __handle_replacement_field(const _CharT* __begin, const _CharT* __end, | |
| 383 | _ParseCtx& __parse_ctx, _Ctx& __ctx) { | |
| 384 | __format::__parse_number_result __r = | |
| 385 | __format::__parse_arg_id(__begin, __end, __parse_ctx); | |
| 386 | ||
| 387 | bool __parse = *__r.__ptr == _CharT(':'); | |
| 388 | switch (*__r.__ptr) { | |
| 389 | case _CharT(':'): | |
| 390 | // The arg-id has a format-specifier, advance the input to the format-spec. | |
| 391 | __parse_ctx.advance_to(__r.__ptr + 1); | |
| 392 | break; | |
| 393 | case _CharT('}'): | |
| 394 | // The arg-id has no format-specifier. | |
| 395 | __parse_ctx.advance_to(__r.__ptr); | |
| 396 | break; | |
| 397 | default: | |
| 398 | __throw_format_error( | |
| 399 | "The replacement field arg-id should terminate at a ':' or '}'"); | |
| 400 | } | |
| 401 | ||
| 402 | if constexpr (same_as<_Ctx, __compile_time_basic_format_context<_CharT>>) { | |
| 403 | __arg_t __type = __ctx.arg(__r.__value); | |
| 404 | if (__type == __arg_t::__handle) | |
| 405 | __ctx.__handle(__r.__value).__parse(__parse_ctx); | |
| 406 | else | |
| 407 | __format::__compile_time_visit_format_arg(__parse_ctx, __ctx, __type); | |
| 408 | } else | |
| 409 | _VSTD::visit_format_arg( | |
| 410 | [&](auto __arg) { | |
| 411 | if constexpr (same_as<decltype(__arg), monostate>) | |
| 412 | __throw_format_error("Argument index out of bounds"); | |
| 413 | else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Ctx>::handle>) | |
| 414 | __arg.format(__parse_ctx, __ctx); | |
| 415 | else { | |
| 416 | formatter<decltype(__arg), _CharT> __formatter; | |
| 417 | if (__parse) | |
| 418 | __parse_ctx.advance_to(__formatter.parse(__parse_ctx)); | |
| 419 | __ctx.advance_to(__formatter.format(__arg, __ctx)); | |
| 420 | } | |
| 421 | }, | |
| 422 | __ctx.arg(__r.__value)); | |
| 423 | ||
| 424 | __begin = __parse_ctx.begin(); | |
| 425 | if (__begin == __end || *__begin != _CharT('}')) | |
| 426 | __throw_format_error("The replacement field misses a terminating '}'"); | |
| 427 | ||
| 428 | return ++__begin; | |
| 429 | } | |
| 430 | ||
| 431 | template <class _ParseCtx, class _Ctx> | |
| 432 | _LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator | |
| 433 | __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) { | |
| 434 | using _CharT = typename _ParseCtx::char_type; | |
| 435 | static_assert(same_as<typename _Ctx::char_type, _CharT>); | |
| 436 | ||
| 437 | const _CharT* __begin = __parse_ctx.begin(); | |
| 438 | const _CharT* __end = __parse_ctx.end(); | |
| 439 | typename _Ctx::iterator __out_it = __ctx.out(); | |
| 440 | while (__begin != __end) { | |
| 441 | switch (*__begin) { | |
| 442 | case _CharT('{'): | |
| 443 | ++__begin; | |
| 444 | if (__begin == __end) | |
| 445 | __throw_format_error("The format string terminates at a '{'"); | |
| 446 | ||
| 447 | if (*__begin != _CharT('{')) [[likely]] { | |
| 448 | __ctx.advance_to(_VSTD::move(__out_it)); | |
| 449 | __begin = | |
| 450 | __handle_replacement_field(__begin, __end, __parse_ctx, __ctx); | |
| 451 | __out_it = __ctx.out(); | |
| 452 | ||
| 453 | // The output is written and __begin points to the next character. So | |
| 454 | // start the next iteration. | |
| 455 | continue; | |
| 456 | } | |
| 457 | // The string is an escape character. | |
| 458 | break; | |
| 459 | ||
| 460 | case _CharT('}'): | |
| 461 | ++__begin; | |
| 462 | if (__begin == __end || *__begin != _CharT('}')) | |
| 463 | __throw_format_error( | |
| 464 | "The format string contains an invalid escape sequence"); | |
| 465 | ||
| 466 | break; | |
| 467 | } | |
| 468 | ||
| 469 | // Copy the character to the output verbatim. | |
| 470 | *__out_it++ = *__begin++; | |
| 471 | } | |
| 472 | return __out_it; | |
| 473 | } | |
| 474 | ||
| 475 | } // namespace __format | |
| 476 | ||
| 477 | template <class _CharT, class... _Args> | |
| 478 | struct _LIBCPP_TEMPLATE_VIS basic_format_string { | |
| 479 | template <class _Tp> | |
| 480 | requires convertible_to<const _Tp&, basic_string_view<_CharT>> | |
| 481 | consteval basic_format_string(const _Tp& __str) : __str_{__str} { | |
| 482 | __format::__vformat_to(basic_format_parse_context<_CharT>{__str_, sizeof...(_Args)}, | |
| 483 | _Context{__types_.data(), __handles_.data(), sizeof...(_Args)}); | |
| 484 | } | |
| 485 | ||
| 486 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT constexpr basic_string_view<_CharT> get() const noexcept { | |
| 487 | return __str_; | |
| 488 | } | |
| 489 | ||
| 490 | private: | |
| 491 | basic_string_view<_CharT> __str_; | |
| 492 | ||
| 493 | using _Context = __format::__compile_time_basic_format_context<_CharT>; | |
| 494 | ||
| 495 | static constexpr array<__format::__arg_t, sizeof...(_Args)> __types_{ | |
| 496 | __format::__determine_arg_t<_Context, remove_cvref_t<_Args>>()...}; | |
| 497 | ||
| 498 | // TODO FMT remove this work-around when the AIX ICE has been resolved. | |
| 499 | # if defined(_AIX) && defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1400 | |
| 500 | template <class _Tp> | |
| 501 | static constexpr __format::__compile_time_handle<_CharT> __get_handle() { | |
| 502 | __format::__compile_time_handle<_CharT> __handle; | |
| 503 | if (__format::__determine_arg_t<_Context, _Tp>() == __format::__arg_t::__handle) | |
| 504 | __handle.template __enable<_Tp>(); | |
| 505 | ||
| 506 | return __handle; | |
| 507 | } | |
| 508 | ||
| 509 | static constexpr array<__format::__compile_time_handle<_CharT>, sizeof...(_Args)> __handles_{ | |
| 510 | __get_handle<_Args>()...}; | |
| 511 | # else | |
| 512 | static constexpr array<__format::__compile_time_handle<_CharT>, sizeof...(_Args)> __handles_{[] { | |
| 513 | using _Tp = remove_cvref_t<_Args>; | |
| 514 | __format::__compile_time_handle<_CharT> __handle; | |
| 515 | if (__format::__determine_arg_t<_Context, _Tp>() == __format::__arg_t::__handle) | |
| 516 | __handle.template __enable<_Tp>(); | |
| 517 | ||
| 518 | return __handle; | |
| 519 | }()...}; | |
| 520 | # endif | |
| 521 | }; | |
| 522 | ||
| 523 | template <class... _Args> | |
| 524 | using format_string = basic_format_string<char, type_identity_t<_Args>...>; | |
| 525 | ||
| 526 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 527 | template <class... _Args> | |
| 528 | using wformat_string = basic_format_string<wchar_t, type_identity_t<_Args>...>; | |
| 529 | #endif | |
| 530 | ||
| 531 | template <class _OutIt, class _CharT, class _FormatOutIt> | |
| 532 | requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt | |
| 533 | __vformat_to( | |
| 534 | _OutIt __out_it, basic_string_view<_CharT> __fmt, | |
| 535 | basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) { | |
| 536 | if constexpr (same_as<_OutIt, _FormatOutIt>) | |
| 537 | return _VSTD::__format::__vformat_to( | |
| 538 | basic_format_parse_context{__fmt, __args.__size()}, | |
| 539 | _VSTD::__format_context_create(_VSTD::move(__out_it), __args)); | |
| 540 | else { | |
| 541 | __format::__format_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it)}; | |
| 542 | _VSTD::__format::__vformat_to( | |
| 543 | basic_format_parse_context{__fmt, __args.__size()}, | |
| 544 | _VSTD::__format_context_create(__buffer.make_output_iterator(), | |
| 545 | __args)); | |
| 546 | return _VSTD::move(__buffer).out(); | |
| 547 | } | |
| 548 | } | |
| 549 | ||
| 550 | // The function is _LIBCPP_ALWAYS_INLINE since the compiler is bad at inlining | |
| 551 | // https://reviews.llvm.org/D110499#inline-1180704 | |
| 552 | // TODO FMT Evaluate whether we want to file a Clang bug report regarding this. | |
| 553 | template <output_iterator<const char&> _OutIt> | |
| 554 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 555 | vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) { | |
| 556 | return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args); | |
| 557 | } | |
| 558 | ||
| 559 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 560 | template <output_iterator<const wchar_t&> _OutIt> | |
| 561 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 562 | vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) { | |
| 563 | return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args); | |
| 564 | } | |
| 565 | #endif | |
| 566 | ||
| 567 | template <output_iterator<const char&> _OutIt, class... _Args> | |
| 568 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 569 | format_to(_OutIt __out_it, format_string<_Args...> __fmt, _Args&&... __args) { | |
| 570 | return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt.get(), | |
| 571 | _VSTD::make_format_args(__args...)); | |
| 572 | } | |
| 573 | ||
| 574 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 575 | template <output_iterator<const wchar_t&> _OutIt, class... _Args> | |
| 576 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 577 | format_to(_OutIt __out_it, wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 578 | return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt.get(), | |
| 579 | _VSTD::make_wformat_args(__args...)); | |
| 580 | } | |
| 581 | #endif | |
| 582 | ||
| 583 | _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string | |
| 584 | vformat(string_view __fmt, format_args __args) { | |
| 585 | string __res; | |
| 586 | _VSTD::vformat_to(_VSTD::back_inserter(__res), __fmt, __args); | |
| 587 | return __res; | |
| 588 | } | |
| 589 | ||
| 590 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 591 | _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring | |
| 592 | vformat(wstring_view __fmt, wformat_args __args) { | |
| 593 | wstring __res; | |
| 594 | _VSTD::vformat_to(_VSTD::back_inserter(__res), __fmt, __args); | |
| 595 | return __res; | |
| 596 | } | |
| 597 | #endif | |
| 598 | ||
| 599 | template <class... _Args> | |
| 600 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string format(format_string<_Args...> __fmt, | |
| 601 | _Args&&... __args) { | |
| 602 | return _VSTD::vformat(__fmt.get(), _VSTD::make_format_args(__args...)); | |
| 603 | } | |
| 604 | ||
| 605 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 606 | template <class... _Args> | |
| 607 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring | |
| 608 | format(wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 609 | return _VSTD::vformat(__fmt.get(), _VSTD::make_wformat_args(__args...)); | |
| 610 | } | |
| 611 | #endif | |
| 612 | ||
| 613 | template <class _Context, class _OutIt, class _CharT> | |
| 614 | _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, | |
| 615 | basic_string_view<_CharT> __fmt, | |
| 616 | basic_format_args<_Context> __args) { | |
| 617 | __format::__format_to_n_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it), __n}; | |
| 618 | _VSTD::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()}, | |
| 619 | _VSTD::__format_context_create(__buffer.make_output_iterator(), __args)); | |
| 620 | return _VSTD::move(__buffer).result(); | |
| 621 | } | |
| 622 | ||
| 623 | template <output_iterator<const char&> _OutIt, class... _Args> | |
| 624 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> | |
| 625 | format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, format_string<_Args...> __fmt, _Args&&... __args) { | |
| 626 | return _VSTD::__vformat_to_n<format_context>(_VSTD::move(__out_it), __n, __fmt.get(), _VSTD::make_format_args(__args...)); | |
| 627 | } | |
| 628 | ||
| 629 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 630 | template <output_iterator<const wchar_t&> _OutIt, class... _Args> | |
| 631 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> | |
| 632 | format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wformat_string<_Args...> __fmt, | |
| 633 | _Args&&... __args) { | |
| 634 | return _VSTD::__vformat_to_n<wformat_context>(_VSTD::move(__out_it), __n, __fmt.get(), _VSTD::make_wformat_args(__args...)); | |
| 635 | } | |
| 636 | #endif | |
| 637 | ||
| 638 | template <class _CharT> | |
| 639 | _LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(basic_string_view<_CharT> __fmt, auto __args) { | |
| 640 | __format::__formatted_size_buffer<_CharT> __buffer; | |
| 641 | _VSTD::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()}, | |
| 642 | _VSTD::__format_context_create(__buffer.make_output_iterator(), __args)); | |
| 643 | return _VSTD::move(__buffer).result(); | |
| 644 | } | |
| 645 | ||
| 646 | template <class... _Args> | |
| 647 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t | |
| 648 | formatted_size(format_string<_Args...> __fmt, _Args&&... __args) { | |
| 649 | return _VSTD::__vformatted_size(__fmt.get(), basic_format_args{_VSTD::make_format_args(__args...)}); | |
| 650 | } | |
| 651 | ||
| 652 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 653 | template <class... _Args> | |
| 654 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t | |
| 655 | formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 656 | return _VSTD::__vformatted_size(__fmt.get(), basic_format_args{_VSTD::make_wformat_args(__args...)}); | |
| 657 | } | |
| 658 | #endif | |
| 659 | ||
| 660 | #ifndef _LIBCPP_HAS_NO_LOCALIZATION | |
| 661 | ||
| 662 | template <class _OutIt, class _CharT, class _FormatOutIt> | |
| 663 | requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt | |
| 664 | __vformat_to( | |
| 665 | _OutIt __out_it, locale __loc, basic_string_view<_CharT> __fmt, | |
| 666 | basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) { | |
| 667 | if constexpr (same_as<_OutIt, _FormatOutIt>) | |
| 668 | return _VSTD::__format::__vformat_to( | |
| 669 | basic_format_parse_context{__fmt, __args.__size()}, | |
| 670 | _VSTD::__format_context_create(_VSTD::move(__out_it), __args, | |
| 671 | _VSTD::move(__loc))); | |
| 672 | else { | |
| 673 | __format::__format_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it)}; | |
| 674 | _VSTD::__format::__vformat_to( | |
| 675 | basic_format_parse_context{__fmt, __args.__size()}, | |
| 676 | _VSTD::__format_context_create(__buffer.make_output_iterator(), | |
| 677 | __args, _VSTD::move(__loc))); | |
| 678 | return _VSTD::move(__buffer).out(); | |
| 679 | } | |
| 680 | } | |
| 681 | ||
| 682 | template <output_iterator<const char&> _OutIt> | |
| 683 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt vformat_to( | |
| 684 | _OutIt __out_it, locale __loc, string_view __fmt, format_args __args) { | |
| 685 | return _VSTD::__vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, | |
| 686 | __args); | |
| 687 | } | |
| 688 | ||
| 689 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 690 | template <output_iterator<const wchar_t&> _OutIt> | |
| 691 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt vformat_to( | |
| 692 | _OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) { | |
| 693 | return _VSTD::__vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, | |
| 694 | __args); | |
| 695 | } | |
| 696 | #endif | |
| 697 | ||
| 698 | template <output_iterator<const char&> _OutIt, class... _Args> | |
| 699 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 700 | format_to(_OutIt __out_it, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) { | |
| 701 | return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt.get(), | |
| 702 | _VSTD::make_format_args(__args...)); | |
| 703 | } | |
| 704 | ||
| 705 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 706 | template <output_iterator<const wchar_t&> _OutIt, class... _Args> | |
| 707 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt | |
| 708 | format_to(_OutIt __out_it, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 709 | return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt.get(), | |
| 710 | _VSTD::make_wformat_args(__args...)); | |
| 711 | } | |
| 712 | #endif | |
| 713 | ||
| 714 | _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string | |
| 715 | vformat(locale __loc, string_view __fmt, format_args __args) { | |
| 716 | string __res; | |
| 717 | _VSTD::vformat_to(_VSTD::back_inserter(__res), _VSTD::move(__loc), __fmt, | |
| 718 | __args); | |
| 719 | return __res; | |
| 720 | } | |
| 721 | ||
| 722 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 723 | _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring | |
| 724 | vformat(locale __loc, wstring_view __fmt, wformat_args __args) { | |
| 725 | wstring __res; | |
| 726 | _VSTD::vformat_to(_VSTD::back_inserter(__res), _VSTD::move(__loc), __fmt, | |
| 727 | __args); | |
| 728 | return __res; | |
| 729 | } | |
| 730 | #endif | |
| 731 | ||
| 732 | template <class... _Args> | |
| 733 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string format(locale __loc, | |
| 734 | format_string<_Args...> __fmt, | |
| 735 | _Args&&... __args) { | |
| 736 | return _VSTD::vformat(_VSTD::move(__loc), __fmt.get(), | |
| 737 | _VSTD::make_format_args(__args...)); | |
| 738 | } | |
| 739 | ||
| 740 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 741 | template <class... _Args> | |
| 742 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring | |
| 743 | format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 744 | return _VSTD::vformat(_VSTD::move(__loc), __fmt.get(), | |
| 745 | _VSTD::make_wformat_args(__args...)); | |
| 746 | } | |
| 747 | #endif | |
| 748 | ||
| 749 | template <class _Context, class _OutIt, class _CharT> | |
| 750 | _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, | |
| 751 | locale __loc, basic_string_view<_CharT> __fmt, | |
| 752 | basic_format_args<_Context> __args) { | |
| 753 | __format::__format_to_n_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it), __n}; | |
| 754 | _VSTD::__format::__vformat_to( | |
| 755 | basic_format_parse_context{__fmt, __args.__size()}, | |
| 756 | _VSTD::__format_context_create(__buffer.make_output_iterator(), __args, _VSTD::move(__loc))); | |
| 757 | return _VSTD::move(__buffer).result(); | |
| 758 | } | |
| 759 | ||
| 760 | template <output_iterator<const char&> _OutIt, class... _Args> | |
| 761 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> | |
| 762 | format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, format_string<_Args...> __fmt, | |
| 763 | _Args&&... __args) { | |
| 764 | return _VSTD::__vformat_to_n<format_context>(_VSTD::move(__out_it), __n, _VSTD::move(__loc), __fmt.get(), | |
| 765 | _VSTD::make_format_args(__args...)); | |
| 766 | } | |
| 767 | ||
| 768 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 769 | template <output_iterator<const wchar_t&> _OutIt, class... _Args> | |
| 770 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> | |
| 771 | format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, wformat_string<_Args...> __fmt, | |
| 772 | _Args&&... __args) { | |
| 773 | return _VSTD::__vformat_to_n<wformat_context>(_VSTD::move(__out_it), __n, _VSTD::move(__loc), __fmt.get(), | |
| 774 | _VSTD::make_wformat_args(__args...)); | |
| 775 | } | |
| 776 | #endif | |
| 777 | ||
| 778 | template <class _CharT> | |
| 779 | _LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(locale __loc, basic_string_view<_CharT> __fmt, auto __args) { | |
| 780 | __format::__formatted_size_buffer<_CharT> __buffer; | |
| 781 | _VSTD::__format::__vformat_to( | |
| 782 | basic_format_parse_context{__fmt, __args.__size()}, | |
| 783 | _VSTD::__format_context_create(__buffer.make_output_iterator(), __args, _VSTD::move(__loc))); | |
| 784 | return _VSTD::move(__buffer).result(); | |
| 785 | } | |
| 786 | ||
| 787 | template <class... _Args> | |
| 788 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t | |
| 789 | formatted_size(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) { | |
| 790 | return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt.get(), basic_format_args{_VSTD::make_format_args(__args...)}); | |
| 791 | } | |
| 792 | ||
| 793 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 794 | template <class... _Args> | |
| 795 | _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t | |
| 796 | formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { | |
| 797 | return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt.get(), basic_format_args{_VSTD::make_wformat_args(__args...)}); | |
| 798 | } | |
| 799 | #endif | |
| 800 | ||
| 801 | #endif // _LIBCPP_HAS_NO_LOCALIZATION | |
| 802 | ||
| 803 | #endif //_LIBCPP_STD_VER > 17 | |
| 804 | ||
| 805 | _LIBCPP_END_NAMESPACE_STD | |
| 806 | ||
| 807 | 210 | #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) |
| 808 | 211 | |
| 809 | 212 | #endif // _LIBCPP_FORMAT |
lib/libcxx/include/forward_list+51-38| ... | ... | @@ -188,19 +188,22 @@ template <class T, class Allocator, class Predicate> |
| 188 | 188 | #include <__iterator/iterator_traits.h> |
| 189 | 189 | #include <__iterator/move_iterator.h> |
| 190 | 190 | #include <__iterator/next.h> |
| 191 | #include <__memory/addressof.h> | |
| 192 | #include <__memory/allocator.h> | |
| 193 | #include <__memory/allocator_destructor.h> | |
| 194 | #include <__memory/allocator_traits.h> | |
| 195 | #include <__memory/compressed_pair.h> | |
| 196 | #include <__memory/pointer_traits.h> | |
| 191 | 197 | #include <__memory/swap_allocator.h> |
| 198 | #include <__memory/unique_ptr.h> | |
| 199 | #include <__memory_resource/polymorphic_allocator.h> | |
| 200 | #include <__type_traits/is_allocator.h> | |
| 192 | 201 | #include <__utility/forward.h> |
| 202 | #include <__utility/move.h> | |
| 193 | 203 | #include <limits> |
| 194 | #include <memory> | |
| 195 | 204 | #include <type_traits> |
| 196 | 205 | #include <version> |
| 197 | 206 | |
| 198 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 199 | # include <algorithm> | |
| 200 | # include <functional> | |
| 201 | # include <iterator> | |
| 202 | #endif | |
| 203 | ||
| 204 | 207 | // standard-mandated includes |
| 205 | 208 | |
| 206 | 209 | // [iterator.range] |
| ... | ... | @@ -239,30 +242,23 @@ struct __forward_list_node_value_type<__forward_list_node<_Tp, _VoidPtr> > { |
| 239 | 242 | template <class _NodePtr> |
| 240 | 243 | struct __forward_node_traits { |
| 241 | 244 | |
| 242 | typedef typename remove_cv< | |
| 243 | typename pointer_traits<_NodePtr>::element_type>::type __node; | |
| 245 | typedef __remove_cv_t< | |
| 246 | typename pointer_traits<_NodePtr>::element_type> __node; | |
| 244 | 247 | typedef typename __forward_list_node_value_type<__node>::type __node_value_type; |
| 245 | 248 | typedef _NodePtr __node_pointer; |
| 246 | 249 | typedef __forward_begin_node<_NodePtr> __begin_node; |
| 247 | typedef typename __rebind_pointer<_NodePtr, __begin_node>::type | |
| 248 | __begin_node_pointer; | |
| 249 | typedef typename __rebind_pointer<_NodePtr, void>::type __void_pointer; | |
| 250 | typedef __rebind_pointer_t<_NodePtr, __begin_node> __begin_node_pointer; | |
| 251 | typedef __rebind_pointer_t<_NodePtr, void> __void_pointer; | |
| 250 | 252 | |
| 251 | 253 | #if defined(_LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB) |
| 252 | 254 | typedef __begin_node_pointer __iter_node_pointer; |
| 253 | 255 | #else |
| 254 | typedef typename conditional< | |
| 255 | is_pointer<__void_pointer>::value, | |
| 256 | __begin_node_pointer, | |
| 257 | __node_pointer | |
| 258 | >::type __iter_node_pointer; | |
| 256 | typedef __conditional_t<is_pointer<__void_pointer>::value, __begin_node_pointer, __node_pointer> | |
| 257 | __iter_node_pointer; | |
| 259 | 258 | #endif |
| 260 | 259 | |
| 261 | typedef typename conditional< | |
| 262 | is_same<__iter_node_pointer, __node_pointer>::value, | |
| 263 | __begin_node_pointer, | |
| 264 | __node_pointer | |
| 265 | >::type __non_iter_node_pointer; | |
| 260 | typedef __conditional_t<is_same<__iter_node_pointer, __node_pointer>::value, __begin_node_pointer, __node_pointer> | |
| 261 | __non_iter_node_pointer; | |
| 266 | 262 | |
| 267 | 263 | _LIBCPP_INLINE_VISIBILITY |
| 268 | 264 | static __iter_node_pointer __as_iter_node(__iter_node_pointer __p) { |
| ... | ... | @@ -278,7 +274,7 @@ template <class _NodePtr> |
| 278 | 274 | struct __forward_begin_node |
| 279 | 275 | { |
| 280 | 276 | typedef _NodePtr pointer; |
| 281 | typedef typename __rebind_pointer<_NodePtr, __forward_begin_node>::type __begin_node_pointer; | |
| 277 | typedef __rebind_pointer_t<_NodePtr, __forward_begin_node> __begin_node_pointer; | |
| 282 | 278 | |
| 283 | 279 | pointer __next_; |
| 284 | 280 | |
| ... | ... | @@ -291,16 +287,11 @@ struct __forward_begin_node |
| 291 | 287 | }; |
| 292 | 288 | |
| 293 | 289 | template <class _Tp, class _VoidPtr> |
| 294 | struct _LIBCPP_HIDDEN __begin_node_of | |
| 295 | { | |
| 296 | typedef __forward_begin_node< | |
| 297 | typename __rebind_pointer<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> >::type | |
| 298 | > type; | |
| 299 | }; | |
| 290 | using __begin_node_of = __forward_begin_node<__rebind_pointer_t<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> > >; | |
| 300 | 291 | |
| 301 | 292 | template <class _Tp, class _VoidPtr> |
| 302 | 293 | struct _LIBCPP_STANDALONE_DEBUG __forward_list_node |
| 303 | : public __begin_node_of<_Tp, _VoidPtr>::type | |
| 294 | : public __begin_node_of<_Tp, _VoidPtr> | |
| 304 | 295 | { |
| 305 | 296 | typedef _Tp value_type; |
| 306 | 297 | |
| ... | ... | @@ -353,7 +344,7 @@ public: |
| 353 | 344 | typedef value_type& reference; |
| 354 | 345 | typedef typename pointer_traits<__node_pointer>::difference_type |
| 355 | 346 | difference_type; |
| 356 | typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer; | |
| 347 | typedef __rebind_pointer_t<__node_pointer, value_type> pointer; | |
| 357 | 348 | |
| 358 | 349 | _LIBCPP_INLINE_VISIBILITY |
| 359 | 350 | __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {} |
| ... | ... | @@ -434,7 +425,7 @@ public: |
| 434 | 425 | typedef const value_type& reference; |
| 435 | 426 | typedef typename pointer_traits<__node_pointer>::difference_type |
| 436 | 427 | difference_type; |
| 437 | typedef typename __rebind_pointer<__node_pointer, const value_type>::type | |
| 428 | typedef __rebind_pointer_t<__node_pointer, const value_type> | |
| 438 | 429 | pointer; |
| 439 | 430 | |
| 440 | 431 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -482,14 +473,12 @@ protected: |
| 482 | 473 | |
| 483 | 474 | typedef typename allocator_traits<allocator_type>::void_pointer void_pointer; |
| 484 | 475 | typedef __forward_list_node<value_type, void_pointer> __node; |
| 485 | typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node; | |
| 486 | typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __node>::type __node_allocator; | |
| 476 | typedef __begin_node_of<value_type, void_pointer> __begin_node; | |
| 477 | typedef __rebind_alloc<allocator_traits<allocator_type>, __node> __node_allocator; | |
| 487 | 478 | typedef allocator_traits<__node_allocator> __node_traits; |
| 488 | 479 | typedef typename __node_traits::pointer __node_pointer; |
| 489 | 480 | |
| 490 | typedef typename __rebind_alloc_helper< | |
| 491 | allocator_traits<allocator_type>, __begin_node | |
| 492 | >::type __begin_node_allocator; | |
| 481 | typedef __rebind_alloc<allocator_traits<allocator_type>, __begin_node> __begin_node_allocator; | |
| 493 | 482 | typedef typename allocator_traits<__begin_node_allocator>::pointer |
| 494 | 483 | __begin_node_pointer; |
| 495 | 484 | |
| ... | ... | @@ -497,6 +486,10 @@ protected: |
| 497 | 486 | "internal allocator type must differ from user-specified " |
| 498 | 487 | "type; otherwise overload resolution breaks"); |
| 499 | 488 | |
| 489 | static_assert(is_same<allocator_type, __rebind_alloc<__node_traits, value_type> >::value, | |
| 490 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 491 | "original allocator"); | |
| 492 | ||
| 500 | 493 | __compressed_pair<__begin_node, __node_allocator> __before_begin_; |
| 501 | 494 | |
| 502 | 495 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -852,7 +845,7 @@ public: |
| 852 | 845 | __remove_return_type remove(const value_type& __v); |
| 853 | 846 | template <class _Predicate> __remove_return_type remove_if(_Predicate __pred); |
| 854 | 847 | _LIBCPP_INLINE_VISIBILITY |
| 855 | __remove_return_type unique() {return unique(__equal_to<value_type>());} | |
| 848 | __remove_return_type unique() { return unique(__equal_to()); } | |
| 856 | 849 | template <class _BinaryPredicate> __remove_return_type unique(_BinaryPredicate __binary_pred); |
| 857 | 850 | #ifndef _LIBCPP_CXX03_LANG |
| 858 | 851 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1702,6 +1695,7 @@ forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT |
| 1702 | 1695 | } |
| 1703 | 1696 | |
| 1704 | 1697 | template <class _Tp, class _Alloc> |
| 1698 | _LIBCPP_HIDE_FROM_ABI | |
| 1705 | 1699 | bool operator==(const forward_list<_Tp, _Alloc>& __x, |
| 1706 | 1700 | const forward_list<_Tp, _Alloc>& __y) |
| 1707 | 1701 | { |
| ... | ... | @@ -1785,6 +1779,25 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1785 | 1779 | |
| 1786 | 1780 | _LIBCPP_END_NAMESPACE_STD |
| 1787 | 1781 | |
| 1782 | #if _LIBCPP_STD_VER > 14 | |
| 1783 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 1784 | namespace pmr { | |
| 1785 | template <class _ValueT> | |
| 1786 | using forward_list = std::forward_list<_ValueT, polymorphic_allocator<_ValueT>>; | |
| 1787 | } // namespace pmr | |
| 1788 | _LIBCPP_END_NAMESPACE_STD | |
| 1789 | #endif | |
| 1790 | ||
| 1788 | 1791 | _LIBCPP_POP_MACROS |
| 1789 | 1792 | |
| 1793 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1794 | # include <algorithm> | |
| 1795 | # include <atomic> | |
| 1796 | # include <concepts> | |
| 1797 | # include <functional> | |
| 1798 | # include <iosfwd> | |
| 1799 | # include <iterator> | |
| 1800 | # include <typeinfo> | |
| 1801 | #endif | |
| 1802 | ||
| 1790 | 1803 | #endif // _LIBCPP_FORWARD_LIST |
lib/libcxx/include/fstream+40-23| ... | ... | @@ -192,6 +192,7 @@ typedef basic_fstream<wchar_t> wfstream; |
| 192 | 192 | #include <cstring> |
| 193 | 193 | #include <istream> |
| 194 | 194 | #include <ostream> |
| 195 | #include <typeinfo> | |
| 195 | 196 | #include <version> |
| 196 | 197 | |
| 197 | 198 | #if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) |
| ... | ... | @@ -209,6 +210,8 @@ _LIBCPP_PUSH_MACROS |
| 209 | 210 | # define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS |
| 210 | 211 | #endif |
| 211 | 212 | |
| 213 | #if !defined(_LIBCPP_HAS_NO_FSTREAM) | |
| 214 | ||
| 212 | 215 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 213 | 216 | |
| 214 | 217 | template <class _CharT, class _Traits> |
| ... | ... | @@ -226,7 +229,7 @@ public: |
| 226 | 229 | // 27.9.1.2 Constructors/destructor: |
| 227 | 230 | basic_filebuf(); |
| 228 | 231 | basic_filebuf(basic_filebuf&& __rhs); |
| 229 | virtual ~basic_filebuf(); | |
| 232 | ~basic_filebuf() override; | |
| 230 | 233 | |
| 231 | 234 | // 27.9.1.3 Assign/swap: |
| 232 | 235 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -259,16 +262,16 @@ public: |
| 259 | 262 | |
| 260 | 263 | protected: |
| 261 | 264 | // 27.9.1.5 Overridden virtual functions: |
| 262 | virtual int_type underflow(); | |
| 263 | virtual int_type pbackfail(int_type __c = traits_type::eof()); | |
| 264 | virtual int_type overflow (int_type __c = traits_type::eof()); | |
| 265 | virtual basic_streambuf<char_type, traits_type>* setbuf(char_type* __s, streamsize __n); | |
| 266 | virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, | |
| 267 | ios_base::openmode __wch = ios_base::in | ios_base::out); | |
| 268 | virtual pos_type seekpos(pos_type __sp, | |
| 269 | ios_base::openmode __wch = ios_base::in | ios_base::out); | |
| 270 | virtual int sync(); | |
| 271 | virtual void imbue(const locale& __loc); | |
| 265 | int_type underflow() override; | |
| 266 | int_type pbackfail(int_type __c = traits_type::eof()) override; | |
| 267 | int_type overflow (int_type __c = traits_type::eof()) override; | |
| 268 | basic_streambuf<char_type, traits_type>* setbuf(char_type* __s, streamsize __n) override; | |
| 269 | pos_type seekoff(off_type __off, ios_base::seekdir __way, | |
| 270 | ios_base::openmode __wch = ios_base::in | ios_base::out) override; | |
| 271 | pos_type seekpos(pos_type __sp, | |
| 272 | ios_base::openmode __wch = ios_base::in | ios_base::out) override; | |
| 273 | int sync() override; | |
| 274 | void imbue(const locale& __loc) override; | |
| 272 | 275 | |
| 273 | 276 | private: |
| 274 | 277 | char* __extbuf_; |
| ... | ... | @@ -310,9 +313,9 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf() |
| 310 | 313 | __owns_ib_(false), |
| 311 | 314 | __always_noconv_(false) |
| 312 | 315 | { |
| 313 | if (has_facet<codecvt<char_type, char, state_type> >(this->getloc())) | |
| 316 | if (std::has_facet<codecvt<char_type, char, state_type> >(this->getloc())) | |
| 314 | 317 | { |
| 315 | __cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc()); | |
| 318 | __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(this->getloc()); | |
| 316 | 319 | __always_noconv_ = __cv_->always_noconv(); |
| 317 | 320 | } |
| 318 | 321 | setbuf(nullptr, 4096); |
| ... | ... | @@ -731,7 +734,7 @@ basic_filebuf<_CharT, _Traits>::underflow() |
| 731 | 734 | char_type __1buf; |
| 732 | 735 | if (this->gptr() == nullptr) |
| 733 | 736 | this->setg(&__1buf, &__1buf+1, &__1buf+1); |
| 734 | const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4); | |
| 737 | const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4); | |
| 735 | 738 | int_type __c = traits_type::eof(); |
| 736 | 739 | if (this->gptr() == this->egptr()) |
| 737 | 740 | { |
| ... | ... | @@ -739,7 +742,7 @@ basic_filebuf<_CharT, _Traits>::underflow() |
| 739 | 742 | if (__always_noconv_) |
| 740 | 743 | { |
| 741 | 744 | size_t __nmemb = static_cast<size_t>(this->egptr() - this->eback() - __unget_sz); |
| 742 | __nmemb = fread(this->eback() + __unget_sz, 1, __nmemb, __file_); | |
| 745 | __nmemb = ::fread(this->eback() + __unget_sz, 1, __nmemb, __file_); | |
| 743 | 746 | if (__nmemb != 0) |
| 744 | 747 | { |
| 745 | 748 | this->setg(this->eback(), |
| ... | ... | @@ -750,9 +753,11 @@ basic_filebuf<_CharT, _Traits>::underflow() |
| 750 | 753 | } |
| 751 | 754 | else |
| 752 | 755 | { |
| 753 | _LIBCPP_ASSERT ( !(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" ); | |
| 754 | if (__extbufend_ != __extbufnext_) | |
| 756 | if (__extbufend_ != __extbufnext_) { | |
| 757 | _LIBCPP_ASSERT(__extbufnext_ != nullptr, "underflow moving from nullptr"); | |
| 758 | _LIBCPP_ASSERT(__extbuf_ != nullptr, "underflow moving into nullptr"); | |
| 755 | 759 | _VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); |
| 760 | } | |
| 756 | 761 | __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); |
| 757 | 762 | __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); |
| 758 | 763 | size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz), |
| ... | ... | @@ -835,7 +840,7 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c) |
| 835 | 840 | if (__always_noconv_) |
| 836 | 841 | { |
| 837 | 842 | size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase()); |
| 838 | if (fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb) | |
| 843 | if (std::fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb) | |
| 839 | 844 | return traits_type::eof(); |
| 840 | 845 | } |
| 841 | 846 | else |
| ... | ... | @@ -855,7 +860,7 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c) |
| 855 | 860 | if (__r == codecvt_base::noconv) |
| 856 | 861 | { |
| 857 | 862 | size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase()); |
| 858 | if (fwrite(this->pbase(), 1, __nmemb, __file_) != __nmemb) | |
| 863 | if (std::fwrite(this->pbase(), 1, __nmemb, __file_) != __nmemb) | |
| 859 | 864 | return traits_type::eof(); |
| 860 | 865 | } |
| 861 | 866 | else if (__r == codecvt_base::ok || __r == codecvt_base::partial) |
| ... | ... | @@ -963,7 +968,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, |
| 963 | 968 | return pos_type(off_type(-1)); |
| 964 | 969 | pos_type __r = ftell(__file_); |
| 965 | 970 | #else |
| 966 | if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence)) | |
| 971 | if (::fseeko(__file_, __width > 0 ? __width * __off : 0, __whence)) | |
| 967 | 972 | return pos_type(off_type(-1)); |
| 968 | 973 | pos_type __r = ftello(__file_); |
| 969 | 974 | #endif |
| ... | ... | @@ -981,7 +986,7 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) |
| 981 | 986 | if (fseek(__file_, __sp, SEEK_SET)) |
| 982 | 987 | return pos_type(off_type(-1)); |
| 983 | 988 | #else |
| 984 | if (fseeko(__file_, __sp, SEEK_SET)) | |
| 989 | if (::fseeko(__file_, __sp, SEEK_SET)) | |
| 985 | 990 | return pos_type(off_type(-1)); |
| 986 | 991 | #endif |
| 987 | 992 | __st_ = __sp.state(); |
| ... | ... | @@ -1045,7 +1050,7 @@ basic_filebuf<_CharT, _Traits>::sync() |
| 1045 | 1050 | if (fseek(__file_, -__c, SEEK_CUR)) |
| 1046 | 1051 | return -1; |
| 1047 | 1052 | #else |
| 1048 | if (fseeko(__file_, -__c, SEEK_CUR)) | |
| 1053 | if (::fseeko(__file_, -__c, SEEK_CUR)) | |
| 1049 | 1054 | return -1; |
| 1050 | 1055 | #endif |
| 1051 | 1056 | if (__update_st) |
| ... | ... | @@ -1062,7 +1067,7 @@ void |
| 1062 | 1067 | basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) |
| 1063 | 1068 | { |
| 1064 | 1069 | sync(); |
| 1065 | __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc); | |
| 1070 | __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(__loc); | |
| 1066 | 1071 | bool __old_anc = __always_noconv_; |
| 1067 | 1072 | __always_noconv_ = __cv_->always_noconv(); |
| 1068 | 1073 | if (__old_anc != __always_noconv_) |
| ... | ... | @@ -1741,6 +1746,18 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>; |
| 1741 | 1746 | |
| 1742 | 1747 | _LIBCPP_END_NAMESPACE_STD |
| 1743 | 1748 | |
| 1749 | #endif // _LIBCPP_HAS_NO_FSTREAM | |
| 1750 | ||
| 1744 | 1751 | _LIBCPP_POP_MACROS |
| 1745 | 1752 | |
| 1753 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1754 | # include <atomic> | |
| 1755 | # include <concepts> | |
| 1756 | # include <iosfwd> | |
| 1757 | # include <limits> | |
| 1758 | # include <new> | |
| 1759 | # include <stdexcept> | |
| 1760 | # include <type_traits> | |
| 1761 | #endif | |
| 1762 | ||
| 1746 | 1763 | #endif // _LIBCPP_FSTREAM |
lib/libcxx/include/functional+7-7| ... | ... | @@ -531,20 +531,20 @@ POLICY: For non-variadic implementations, the number of arguments is limited |
| 531 | 531 | #include <__functional/unary_negate.h> |
| 532 | 532 | #include <__functional/unwrap_ref.h> |
| 533 | 533 | #include <__utility/forward.h> |
| 534 | #include <concepts> | |
| 535 | 534 | #include <exception> |
| 536 | #include <memory> | |
| 537 | #include <tuple> | |
| 535 | #include <memory> // TODO: find out why removing this breaks the modules build | |
| 538 | 536 | #include <type_traits> |
| 539 | 537 | #include <typeinfo> |
| 540 | 538 | #include <version> |
| 541 | 539 | |
| 542 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 543 | # include <utility> | |
| 544 | #endif | |
| 545 | ||
| 546 | 540 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 547 | 541 | # pragma GCC system_header |
| 548 | 542 | #endif |
| 549 | 543 | |
| 544 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 545 | # include <concepts> | |
| 546 | # include <tuple> | |
| 547 | # include <utility> | |
| 548 | #endif | |
| 549 | ||
| 550 | 550 | #endif // _LIBCPP_FUNCTIONAL |
lib/libcxx/include/future+44-26| ... | ... | @@ -367,21 +367,19 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; |
| 367 | 367 | #include <__chrono/time_point.h> |
| 368 | 368 | #include <__config> |
| 369 | 369 | #include <__memory/allocator_arg_t.h> |
| 370 | #include <__memory/allocator_destructor.h> | |
| 370 | 371 | #include <__memory/uses_allocator.h> |
| 372 | #include <__type_traits/strip_signature.h> | |
| 371 | 373 | #include <__utility/auto_cast.h> |
| 372 | 374 | #include <__utility/forward.h> |
| 373 | 375 | #include <__utility/move.h> |
| 374 | 376 | #include <exception> |
| 375 | #include <memory> | |
| 376 | 377 | #include <mutex> |
| 378 | #include <new> | |
| 377 | 379 | #include <system_error> |
| 378 | 380 | #include <thread> |
| 379 | 381 | #include <version> |
| 380 | 382 | |
| 381 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 382 | # include <chrono> | |
| 383 | #endif | |
| 384 | ||
| 385 | 383 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 386 | 384 | # pragma GCC system_header |
| 387 | 385 | #endif |
| ... | ... | @@ -518,7 +516,7 @@ public: |
| 518 | 516 | const error_code& code() const _NOEXCEPT {return __ec_;} |
| 519 | 517 | |
| 520 | 518 | future_error(const future_error&) _NOEXCEPT = default; |
| 521 | virtual ~future_error() _NOEXCEPT; | |
| 519 | ~future_error() _NOEXCEPT override; | |
| 522 | 520 | }; |
| 523 | 521 | |
| 524 | 522 | _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -544,7 +542,7 @@ protected: |
| 544 | 542 | mutable condition_variable __cv_; |
| 545 | 543 | unsigned __state_; |
| 546 | 544 | |
| 547 | virtual void __on_zero_shared() _NOEXCEPT; | |
| 545 | void __on_zero_shared() _NOEXCEPT override; | |
| 548 | 546 | void __sub_wait(unique_lock<mutex>& __lk); |
| 549 | 547 | public: |
| 550 | 548 | enum |
| ... | ... | @@ -627,11 +625,13 @@ class _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_HIDDEN __assoc_state |
| 627 | 625 | : public __assoc_sub_state |
| 628 | 626 | { |
| 629 | 627 | typedef __assoc_sub_state base; |
| 628 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 630 | 629 | typedef typename aligned_storage<sizeof(_Rp), alignment_of<_Rp>::value>::type _Up; |
| 630 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 631 | 631 | protected: |
| 632 | 632 | _Up __value_; |
| 633 | 633 | |
| 634 | virtual void __on_zero_shared() _NOEXCEPT; | |
| 634 | void __on_zero_shared() _NOEXCEPT override; | |
| 635 | 635 | public: |
| 636 | 636 | |
| 637 | 637 | template <class _Arg> |
| ... | ... | @@ -641,7 +641,7 @@ public: |
| 641 | 641 | void set_value_at_thread_exit(_Arg&& __arg); |
| 642 | 642 | |
| 643 | 643 | _Rp move(); |
| 644 | typename add_lvalue_reference<_Rp>::type copy(); | |
| 644 | __add_lvalue_reference_t<_Rp> copy(); | |
| 645 | 645 | }; |
| 646 | 646 | |
| 647 | 647 | template <class _Rp> |
| ... | ... | @@ -687,18 +687,18 @@ __assoc_state<_Rp>::move() |
| 687 | 687 | unique_lock<mutex> __lk(this->__mut_); |
| 688 | 688 | this->__sub_wait(__lk); |
| 689 | 689 | if (this->__exception_ != nullptr) |
| 690 | rethrow_exception(this->__exception_); | |
| 690 | std::rethrow_exception(this->__exception_); | |
| 691 | 691 | return _VSTD::move(*reinterpret_cast<_Rp*>(&__value_)); |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | template <class _Rp> |
| 695 | typename add_lvalue_reference<_Rp>::type | |
| 695 | __add_lvalue_reference_t<_Rp> | |
| 696 | 696 | __assoc_state<_Rp>::copy() |
| 697 | 697 | { |
| 698 | 698 | unique_lock<mutex> __lk(this->__mut_); |
| 699 | 699 | this->__sub_wait(__lk); |
| 700 | 700 | if (this->__exception_ != nullptr) |
| 701 | rethrow_exception(this->__exception_); | |
| 701 | std::rethrow_exception(this->__exception_); | |
| 702 | 702 | return *reinterpret_cast<_Rp*>(&__value_); |
| 703 | 703 | } |
| 704 | 704 | |
| ... | ... | @@ -711,7 +711,7 @@ class _LIBCPP_AVAILABILITY_FUTURE __assoc_state<_Rp&> |
| 711 | 711 | protected: |
| 712 | 712 | _Up __value_; |
| 713 | 713 | |
| 714 | virtual void __on_zero_shared() _NOEXCEPT; | |
| 714 | void __on_zero_shared() _NOEXCEPT override; | |
| 715 | 715 | public: |
| 716 | 716 | |
| 717 | 717 | void set_value(_Rp& __arg); |
| ... | ... | @@ -758,7 +758,7 @@ __assoc_state<_Rp&>::copy() |
| 758 | 758 | unique_lock<mutex> __lk(this->__mut_); |
| 759 | 759 | this->__sub_wait(__lk); |
| 760 | 760 | if (this->__exception_ != nullptr) |
| 761 | rethrow_exception(this->__exception_); | |
| 761 | std::rethrow_exception(this->__exception_); | |
| 762 | 762 | return *__value_; |
| 763 | 763 | } |
| 764 | 764 | |
| ... | ... | @@ -823,7 +823,7 @@ class _LIBCPP_AVAILABILITY_FUTURE __assoc_sub_state_alloc |
| 823 | 823 | typedef __assoc_sub_state base; |
| 824 | 824 | _Alloc __alloc_; |
| 825 | 825 | |
| 826 | virtual void __on_zero_shared() _NOEXCEPT; | |
| 826 | void __on_zero_shared() _NOEXCEPT override; | |
| 827 | 827 | public: |
| 828 | 828 | _LIBCPP_INLINE_VISIBILITY |
| 829 | 829 | explicit __assoc_sub_state_alloc(const _Alloc& __a) |
| ... | ... | @@ -895,7 +895,7 @@ public: |
| 895 | 895 | _LIBCPP_INLINE_VISIBILITY |
| 896 | 896 | explicit __deferred_assoc_state(_Fp&& __f); |
| 897 | 897 | |
| 898 | virtual void __execute(); | |
| 898 | void __execute() override; | |
| 899 | 899 | }; |
| 900 | 900 | |
| 901 | 901 | template <class _Fp> |
| ... | ... | @@ -982,12 +982,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state<void, _Fp> |
| 982 | 982 | |
| 983 | 983 | _Fp __func_; |
| 984 | 984 | |
| 985 | virtual void __on_zero_shared() _NOEXCEPT; | |
| 985 | void __on_zero_shared() _NOEXCEPT override; | |
| 986 | 986 | public: |
| 987 | 987 | _LIBCPP_INLINE_VISIBILITY |
| 988 | 988 | explicit __async_assoc_state(_Fp&& __f); |
| 989 | 989 | |
| 990 | virtual void __execute(); | |
| 990 | void __execute() override; | |
| 991 | 991 | }; |
| 992 | 992 | |
| 993 | 993 | template <class _Fp> |
| ... | ... | @@ -1628,7 +1628,7 @@ class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_base<_Rp(_ArgTypes...)> |
| 1628 | 1628 | public: |
| 1629 | 1629 | _LIBCPP_INLINE_VISIBILITY |
| 1630 | 1630 | __packaged_task_base() {} |
| 1631 | _LIBCPP_INLINE_VISIBILITY | |
| 1631 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL | |
| 1632 | 1632 | virtual ~__packaged_task_base() {} |
| 1633 | 1633 | virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0; |
| 1634 | 1634 | virtual void destroy() = 0; |
| ... | ... | @@ -1704,7 +1704,9 @@ class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_function<_Rp(_ArgTypes...)> |
| 1704 | 1704 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_NO_CFI |
| 1705 | 1705 | __base* __get_buf() { return (__base*)&__buf_; } |
| 1706 | 1706 | |
| 1707 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1707 | 1708 | typename aligned_storage<3*sizeof(void*)>::type __buf_; |
| 1709 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1708 | 1710 | __base* __f_; |
| 1709 | 1711 | |
| 1710 | 1712 | public: |
| ... | ... | @@ -1754,7 +1756,7 @@ template <class _Fp> |
| 1754 | 1756 | __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f) |
| 1755 | 1757 | : __f_(nullptr) |
| 1756 | 1758 | { |
| 1757 | typedef typename remove_reference<typename decay<_Fp>::type>::type _FR; | |
| 1759 | typedef __libcpp_remove_reference_t<typename decay<_Fp>::type> _FR; | |
| 1758 | 1760 | typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF; |
| 1759 | 1761 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 1760 | 1762 | { |
| ... | ... | @@ -1778,7 +1780,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function( |
| 1778 | 1780 | allocator_arg_t, const _Alloc& __a0, _Fp&& __f) |
| 1779 | 1781 | : __f_(nullptr) |
| 1780 | 1782 | { |
| 1781 | typedef typename remove_reference<typename decay<_Fp>::type>::type _FR; | |
| 1783 | typedef __libcpp_remove_reference_t<typename decay<_Fp>::type> _FR; | |
| 1782 | 1784 | typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF; |
| 1783 | 1785 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 1784 | 1786 | { |
| ... | ... | @@ -1837,7 +1839,9 @@ __packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) |
| 1837 | 1839 | { |
| 1838 | 1840 | if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) |
| 1839 | 1841 | { |
| 1842 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1840 | 1843 | typename aligned_storage<sizeof(__buf_)>::type __tempbuf; |
| 1844 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1841 | 1845 | __base* __t = (__base*)&__tempbuf; |
| 1842 | 1846 | __f_->__move_to(__t); |
| 1843 | 1847 | __f_->destroy(); |
| ... | ... | @@ -1891,11 +1895,11 @@ public: |
| 1891 | 1895 | _LIBCPP_INLINE_VISIBILITY |
| 1892 | 1896 | packaged_task() _NOEXCEPT : __p_(nullptr) {} |
| 1893 | 1897 | template <class _Fp, |
| 1894 | class = __enable_if_t<!is_same<__uncvref_t<_Fp>, packaged_task>::value> > | |
| 1898 | class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> > | |
| 1895 | 1899 | _LIBCPP_INLINE_VISIBILITY |
| 1896 | 1900 | explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {} |
| 1897 | 1901 | template <class _Fp, class _Allocator, |
| 1898 | class = __enable_if_t<!is_same<__uncvref_t<_Fp>, packaged_task>::value> > | |
| 1902 | class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> > | |
| 1899 | 1903 | _LIBCPP_INLINE_VISIBILITY |
| 1900 | 1904 | packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) |
| 1901 | 1905 | : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)), |
| ... | ... | @@ -2006,11 +2010,11 @@ public: |
| 2006 | 2010 | _LIBCPP_INLINE_VISIBILITY |
| 2007 | 2011 | packaged_task() _NOEXCEPT : __p_(nullptr) {} |
| 2008 | 2012 | template <class _Fp, |
| 2009 | class = __enable_if_t<!is_same<__uncvref_t<_Fp>, packaged_task>::value> > | |
| 2013 | class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> > | |
| 2010 | 2014 | _LIBCPP_INLINE_VISIBILITY |
| 2011 | 2015 | explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {} |
| 2012 | 2016 | template <class _Fp, class _Allocator, |
| 2013 | class = __enable_if_t<!is_same<__uncvref_t<_Fp>, packaged_task>::value> > | |
| 2017 | class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> > | |
| 2014 | 2018 | _LIBCPP_INLINE_VISIBILITY |
| 2015 | 2019 | packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) |
| 2016 | 2020 | : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)), |
| ... | ... | @@ -2053,6 +2057,16 @@ public: |
| 2053 | 2057 | void reset(); |
| 2054 | 2058 | }; |
| 2055 | 2059 | |
| 2060 | #if _LIBCPP_STD_VER >= 17 | |
| 2061 | ||
| 2062 | template <class _Rp, class... _Args> | |
| 2063 | packaged_task(_Rp(*)(_Args...)) -> packaged_task<_Rp(_Args...)>; | |
| 2064 | ||
| 2065 | template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type> | |
| 2066 | packaged_task(_Fp) -> packaged_task<_Stripped>; | |
| 2067 | ||
| 2068 | #endif | |
| 2069 | ||
| 2056 | 2070 | template<class ..._ArgTypes> |
| 2057 | 2071 | void |
| 2058 | 2072 | packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args) |
| ... | ... | @@ -2174,7 +2188,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool __does_policy_contain(launch __policy, lau |
| 2174 | 2188 | { return (int(__policy) & int(__value)) != 0; } |
| 2175 | 2189 | |
| 2176 | 2190 | template <class _Fp, class... _Args> |
| 2177 | _LIBCPP_NODISCARD_AFTER_CXX17 | |
| 2191 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 2178 | 2192 | future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type> |
| 2179 | 2193 | async(launch __policy, _Fp&& __f, _Args&&... __args) |
| 2180 | 2194 | { |
| ... | ... | @@ -2436,4 +2450,8 @@ future<void>::share() _NOEXCEPT |
| 2436 | 2450 | |
| 2437 | 2451 | _LIBCPP_END_NAMESPACE_STD |
| 2438 | 2452 | |
| 2453 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 | |
| 2454 | # include <chrono> | |
| 2455 | #endif | |
| 2456 | ||
| 2439 | 2457 | #endif // _LIBCPP_FUTURE |
lib/libcxx/include/initializer_list+7-7| ... | ... | @@ -62,7 +62,7 @@ class _LIBCPP_TEMPLATE_VIS initializer_list |
| 62 | 62 | size_t __size_; |
| 63 | 63 | |
| 64 | 64 | _LIBCPP_INLINE_VISIBILITY |
| 65 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 65 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 66 | 66 | initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT |
| 67 | 67 | : __begin_(__b), |
| 68 | 68 | __size_(__s) |
| ... | ... | @@ -77,25 +77,25 @@ public: |
| 77 | 77 | typedef const _Ep* const_iterator; |
| 78 | 78 | |
| 79 | 79 | _LIBCPP_INLINE_VISIBILITY |
| 80 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 80 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 81 | 81 | initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {} |
| 82 | 82 | |
| 83 | 83 | _LIBCPP_INLINE_VISIBILITY |
| 84 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 84 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 85 | 85 | size_t size() const _NOEXCEPT {return __size_;} |
| 86 | 86 | |
| 87 | 87 | _LIBCPP_INLINE_VISIBILITY |
| 88 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 88 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 89 | 89 | const _Ep* begin() const _NOEXCEPT {return __begin_;} |
| 90 | 90 | |
| 91 | 91 | _LIBCPP_INLINE_VISIBILITY |
| 92 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 92 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 93 | 93 | const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;} |
| 94 | 94 | }; |
| 95 | 95 | |
| 96 | 96 | template<class _Ep> |
| 97 | 97 | inline _LIBCPP_INLINE_VISIBILITY |
| 98 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 98 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 99 | 99 | const _Ep* |
| 100 | 100 | begin(initializer_list<_Ep> __il) _NOEXCEPT |
| 101 | 101 | { |
| ... | ... | @@ -104,7 +104,7 @@ begin(initializer_list<_Ep> __il) _NOEXCEPT |
| 104 | 104 | |
| 105 | 105 | template<class _Ep> |
| 106 | 106 | inline _LIBCPP_INLINE_VISIBILITY |
| 107 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 107 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 108 | 108 | const _Ep* |
| 109 | 109 | end(initializer_list<_Ep> __il) _NOEXCEPT |
| 110 | 110 | { |
lib/libcxx/include/inttypes.h+3-1| ... | ... | @@ -248,7 +248,9 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int |
| 248 | 248 | # define __STDC_FORMAT_MACROS |
| 249 | 249 | #endif |
| 250 | 250 | |
| 251 | #include_next <inttypes.h> | |
| 251 | #if __has_include_next(<inttypes.h>) | |
| 252 | # include_next <inttypes.h> | |
| 253 | #endif | |
| 252 | 254 | |
| 253 | 255 | #ifdef __cplusplus |
| 254 | 256 |
lib/libcxx/include/iomanip+12-12| ... | ... | @@ -278,7 +278,7 @@ setw(int __n) |
| 278 | 278 | template <class _MoneyT> class __iom_t7; |
| 279 | 279 | |
| 280 | 280 | template <class _CharT, class _Traits, class _MoneyT> |
| 281 | basic_istream<_CharT, _Traits>& | |
| 281 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 282 | 282 | operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x); |
| 283 | 283 | |
| 284 | 284 | template <class _MoneyT> |
| ... | ... | @@ -298,7 +298,7 @@ public: |
| 298 | 298 | }; |
| 299 | 299 | |
| 300 | 300 | template <class _CharT, class _Traits, class _MoneyT> |
| 301 | basic_istream<_CharT, _Traits>& | |
| 301 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 302 | 302 | operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) |
| 303 | 303 | { |
| 304 | 304 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| ... | ... | @@ -311,7 +311,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) |
| 311 | 311 | typedef istreambuf_iterator<_CharT, _Traits> _Ip; |
| 312 | 312 | typedef money_get<_CharT, _Ip> _Fp; |
| 313 | 313 | ios_base::iostate __err = ios_base::goodbit; |
| 314 | const _Fp& __mf = use_facet<_Fp>(__is.getloc()); | |
| 314 | const _Fp& __mf = std::use_facet<_Fp>(__is.getloc()); | |
| 315 | 315 | __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_); |
| 316 | 316 | __is.setstate(__err); |
| 317 | 317 | } |
| ... | ... | @@ -338,7 +338,7 @@ get_money(_MoneyT& __mon, bool __intl = false) |
| 338 | 338 | template <class _MoneyT> class __iom_t8; |
| 339 | 339 | |
| 340 | 340 | template <class _CharT, class _Traits, class _MoneyT> |
| 341 | basic_ostream<_CharT, _Traits>& | |
| 341 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 342 | 342 | operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x); |
| 343 | 343 | |
| 344 | 344 | template <class _MoneyT> |
| ... | ... | @@ -358,7 +358,7 @@ public: |
| 358 | 358 | }; |
| 359 | 359 | |
| 360 | 360 | template <class _CharT, class _Traits, class _MoneyT> |
| 361 | basic_ostream<_CharT, _Traits>& | |
| 361 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 362 | 362 | operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) |
| 363 | 363 | { |
| 364 | 364 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| ... | ... | @@ -370,7 +370,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) |
| 370 | 370 | { |
| 371 | 371 | typedef ostreambuf_iterator<_CharT, _Traits> _Op; |
| 372 | 372 | typedef money_put<_CharT, _Op> _Fp; |
| 373 | const _Fp& __mf = use_facet<_Fp>(__os.getloc()); | |
| 373 | const _Fp& __mf = std::use_facet<_Fp>(__os.getloc()); | |
| 374 | 374 | if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed()) |
| 375 | 375 | __os.setstate(ios_base::badbit); |
| 376 | 376 | } |
| ... | ... | @@ -397,7 +397,7 @@ put_money(const _MoneyT& __mon, bool __intl = false) |
| 397 | 397 | template <class _CharT> class __iom_t9; |
| 398 | 398 | |
| 399 | 399 | template <class _CharT, class _Traits> |
| 400 | basic_istream<_CharT, _Traits>& | |
| 400 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 401 | 401 | operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x); |
| 402 | 402 | |
| 403 | 403 | template <class _CharT> |
| ... | ... | @@ -417,7 +417,7 @@ public: |
| 417 | 417 | }; |
| 418 | 418 | |
| 419 | 419 | template <class _CharT, class _Traits> |
| 420 | basic_istream<_CharT, _Traits>& | |
| 420 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 421 | 421 | operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) |
| 422 | 422 | { |
| 423 | 423 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| ... | ... | @@ -430,7 +430,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) |
| 430 | 430 | typedef istreambuf_iterator<_CharT, _Traits> _Ip; |
| 431 | 431 | typedef time_get<_CharT, _Ip> _Fp; |
| 432 | 432 | ios_base::iostate __err = ios_base::goodbit; |
| 433 | const _Fp& __tf = use_facet<_Fp>(__is.getloc()); | |
| 433 | const _Fp& __tf = std::use_facet<_Fp>(__is.getloc()); | |
| 434 | 434 | __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_, |
| 435 | 435 | __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)); |
| 436 | 436 | __is.setstate(__err); |
| ... | ... | @@ -458,7 +458,7 @@ get_time(tm* __tm, const _CharT* __fmt) |
| 458 | 458 | template <class _CharT> class __iom_t10; |
| 459 | 459 | |
| 460 | 460 | template <class _CharT, class _Traits> |
| 461 | basic_ostream<_CharT, _Traits>& | |
| 461 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 462 | 462 | operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x); |
| 463 | 463 | |
| 464 | 464 | template <class _CharT> |
| ... | ... | @@ -478,7 +478,7 @@ public: |
| 478 | 478 | }; |
| 479 | 479 | |
| 480 | 480 | template <class _CharT, class _Traits> |
| 481 | basic_ostream<_CharT, _Traits>& | |
| 481 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 482 | 482 | operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) |
| 483 | 483 | { |
| 484 | 484 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| ... | ... | @@ -490,7 +490,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) |
| 490 | 490 | { |
| 491 | 491 | typedef ostreambuf_iterator<_CharT, _Traits> _Op; |
| 492 | 492 | typedef time_put<_CharT, _Op> _Fp; |
| 493 | const _Fp& __tf = use_facet<_Fp>(__os.getloc()); | |
| 493 | const _Fp& __tf = std::use_facet<_Fp>(__os.getloc()); | |
| 494 | 494 | if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_, |
| 495 | 495 | __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed()) |
| 496 | 496 | __os.setstate(ios_base::badbit); |
lib/libcxx/include/ios+43-28| ... | ... | @@ -224,6 +224,8 @@ storage-class-specifier const error_category& iostream_category() noexcept; |
| 224 | 224 | #include <version> |
| 225 | 225 | |
| 226 | 226 | // standard-mandated includes |
| 227 | ||
| 228 | // [ios.syn] | |
| 227 | 229 | #include <iosfwd> |
| 228 | 230 | |
| 229 | 231 | #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) |
| ... | ... | @@ -441,7 +443,7 @@ public: |
| 441 | 443 | explicit failure(const string& __msg, const error_code& __ec = io_errc::stream); |
| 442 | 444 | explicit failure(const char* __msg, const error_code& __ec = io_errc::stream); |
| 443 | 445 | failure(const failure&) _NOEXCEPT = default; |
| 444 | virtual ~failure() _NOEXCEPT; | |
| 446 | ~failure() _NOEXCEPT override; | |
| 445 | 447 | }; |
| 446 | 448 | |
| 447 | 449 | _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -641,7 +643,7 @@ public: |
| 641 | 643 | // 27.5.4.1 Constructor/destructor: |
| 642 | 644 | _LIBCPP_INLINE_VISIBILITY |
| 643 | 645 | explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb); |
| 644 | virtual ~basic_ios(); | |
| 646 | ~basic_ios() override; | |
| 645 | 647 | |
| 646 | 648 | // 27.5.4.2 Members: |
| 647 | 649 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -764,7 +766,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 764 | 766 | char |
| 765 | 767 | basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const |
| 766 | 768 | { |
| 767 | return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault); | |
| 769 | return std::use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault); | |
| 768 | 770 | } |
| 769 | 771 | |
| 770 | 772 | template <class _CharT, class _Traits> |
| ... | ... | @@ -772,7 +774,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 772 | 774 | _CharT |
| 773 | 775 | basic_ios<_CharT, _Traits>::widen(char __c) const |
| 774 | 776 | { |
| 775 | return use_facet<ctype<char_type> >(getloc()).widen(__c); | |
| 777 | return std::use_facet<ctype<char_type> >(getloc()).widen(__c); | |
| 776 | 778 | } |
| 777 | 779 | |
| 778 | 780 | template <class _CharT, class _Traits> |
| ... | ... | @@ -842,7 +844,7 @@ basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* _ |
| 842 | 844 | ios_base::set_rdbuf(__sb); |
| 843 | 845 | } |
| 844 | 846 | |
| 845 | inline | |
| 847 | _LIBCPP_HIDE_FROM_ABI inline | |
| 846 | 848 | ios_base& |
| 847 | 849 | boolalpha(ios_base& __str) |
| 848 | 850 | { |
| ... | ... | @@ -850,7 +852,7 @@ boolalpha(ios_base& __str) |
| 850 | 852 | return __str; |
| 851 | 853 | } |
| 852 | 854 | |
| 853 | inline | |
| 855 | _LIBCPP_HIDE_FROM_ABI inline | |
| 854 | 856 | ios_base& |
| 855 | 857 | noboolalpha(ios_base& __str) |
| 856 | 858 | { |
| ... | ... | @@ -858,7 +860,7 @@ noboolalpha(ios_base& __str) |
| 858 | 860 | return __str; |
| 859 | 861 | } |
| 860 | 862 | |
| 861 | inline | |
| 863 | _LIBCPP_HIDE_FROM_ABI inline | |
| 862 | 864 | ios_base& |
| 863 | 865 | showbase(ios_base& __str) |
| 864 | 866 | { |
| ... | ... | @@ -866,7 +868,7 @@ showbase(ios_base& __str) |
| 866 | 868 | return __str; |
| 867 | 869 | } |
| 868 | 870 | |
| 869 | inline | |
| 871 | _LIBCPP_HIDE_FROM_ABI inline | |
| 870 | 872 | ios_base& |
| 871 | 873 | noshowbase(ios_base& __str) |
| 872 | 874 | { |
| ... | ... | @@ -874,7 +876,7 @@ noshowbase(ios_base& __str) |
| 874 | 876 | return __str; |
| 875 | 877 | } |
| 876 | 878 | |
| 877 | inline | |
| 879 | _LIBCPP_HIDE_FROM_ABI inline | |
| 878 | 880 | ios_base& |
| 879 | 881 | showpoint(ios_base& __str) |
| 880 | 882 | { |
| ... | ... | @@ -882,7 +884,7 @@ showpoint(ios_base& __str) |
| 882 | 884 | return __str; |
| 883 | 885 | } |
| 884 | 886 | |
| 885 | inline | |
| 887 | _LIBCPP_HIDE_FROM_ABI inline | |
| 886 | 888 | ios_base& |
| 887 | 889 | noshowpoint(ios_base& __str) |
| 888 | 890 | { |
| ... | ... | @@ -890,7 +892,7 @@ noshowpoint(ios_base& __str) |
| 890 | 892 | return __str; |
| 891 | 893 | } |
| 892 | 894 | |
| 893 | inline | |
| 895 | _LIBCPP_HIDE_FROM_ABI inline | |
| 894 | 896 | ios_base& |
| 895 | 897 | showpos(ios_base& __str) |
| 896 | 898 | { |
| ... | ... | @@ -898,7 +900,7 @@ showpos(ios_base& __str) |
| 898 | 900 | return __str; |
| 899 | 901 | } |
| 900 | 902 | |
| 901 | inline | |
| 903 | _LIBCPP_HIDE_FROM_ABI inline | |
| 902 | 904 | ios_base& |
| 903 | 905 | noshowpos(ios_base& __str) |
| 904 | 906 | { |
| ... | ... | @@ -906,7 +908,7 @@ noshowpos(ios_base& __str) |
| 906 | 908 | return __str; |
| 907 | 909 | } |
| 908 | 910 | |
| 909 | inline | |
| 911 | _LIBCPP_HIDE_FROM_ABI inline | |
| 910 | 912 | ios_base& |
| 911 | 913 | skipws(ios_base& __str) |
| 912 | 914 | { |
| ... | ... | @@ -914,7 +916,7 @@ skipws(ios_base& __str) |
| 914 | 916 | return __str; |
| 915 | 917 | } |
| 916 | 918 | |
| 917 | inline | |
| 919 | _LIBCPP_HIDE_FROM_ABI inline | |
| 918 | 920 | ios_base& |
| 919 | 921 | noskipws(ios_base& __str) |
| 920 | 922 | { |
| ... | ... | @@ -922,7 +924,7 @@ noskipws(ios_base& __str) |
| 922 | 924 | return __str; |
| 923 | 925 | } |
| 924 | 926 | |
| 925 | inline | |
| 927 | _LIBCPP_HIDE_FROM_ABI inline | |
| 926 | 928 | ios_base& |
| 927 | 929 | uppercase(ios_base& __str) |
| 928 | 930 | { |
| ... | ... | @@ -930,7 +932,7 @@ uppercase(ios_base& __str) |
| 930 | 932 | return __str; |
| 931 | 933 | } |
| 932 | 934 | |
| 933 | inline | |
| 935 | _LIBCPP_HIDE_FROM_ABI inline | |
| 934 | 936 | ios_base& |
| 935 | 937 | nouppercase(ios_base& __str) |
| 936 | 938 | { |
| ... | ... | @@ -938,7 +940,7 @@ nouppercase(ios_base& __str) |
| 938 | 940 | return __str; |
| 939 | 941 | } |
| 940 | 942 | |
| 941 | inline | |
| 943 | _LIBCPP_HIDE_FROM_ABI inline | |
| 942 | 944 | ios_base& |
| 943 | 945 | unitbuf(ios_base& __str) |
| 944 | 946 | { |
| ... | ... | @@ -946,7 +948,7 @@ unitbuf(ios_base& __str) |
| 946 | 948 | return __str; |
| 947 | 949 | } |
| 948 | 950 | |
| 949 | inline | |
| 951 | _LIBCPP_HIDE_FROM_ABI inline | |
| 950 | 952 | ios_base& |
| 951 | 953 | nounitbuf(ios_base& __str) |
| 952 | 954 | { |
| ... | ... | @@ -954,7 +956,7 @@ nounitbuf(ios_base& __str) |
| 954 | 956 | return __str; |
| 955 | 957 | } |
| 956 | 958 | |
| 957 | inline | |
| 959 | _LIBCPP_HIDE_FROM_ABI inline | |
| 958 | 960 | ios_base& |
| 959 | 961 | internal(ios_base& __str) |
| 960 | 962 | { |
| ... | ... | @@ -962,7 +964,7 @@ internal(ios_base& __str) |
| 962 | 964 | return __str; |
| 963 | 965 | } |
| 964 | 966 | |
| 965 | inline | |
| 967 | _LIBCPP_HIDE_FROM_ABI inline | |
| 966 | 968 | ios_base& |
| 967 | 969 | left(ios_base& __str) |
| 968 | 970 | { |
| ... | ... | @@ -970,7 +972,7 @@ left(ios_base& __str) |
| 970 | 972 | return __str; |
| 971 | 973 | } |
| 972 | 974 | |
| 973 | inline | |
| 975 | _LIBCPP_HIDE_FROM_ABI inline | |
| 974 | 976 | ios_base& |
| 975 | 977 | right(ios_base& __str) |
| 976 | 978 | { |
| ... | ... | @@ -978,7 +980,7 @@ right(ios_base& __str) |
| 978 | 980 | return __str; |
| 979 | 981 | } |
| 980 | 982 | |
| 981 | inline | |
| 983 | _LIBCPP_HIDE_FROM_ABI inline | |
| 982 | 984 | ios_base& |
| 983 | 985 | dec(ios_base& __str) |
| 984 | 986 | { |
| ... | ... | @@ -986,7 +988,7 @@ dec(ios_base& __str) |
| 986 | 988 | return __str; |
| 987 | 989 | } |
| 988 | 990 | |
| 989 | inline | |
| 991 | _LIBCPP_HIDE_FROM_ABI inline | |
| 990 | 992 | ios_base& |
| 991 | 993 | hex(ios_base& __str) |
| 992 | 994 | { |
| ... | ... | @@ -994,7 +996,7 @@ hex(ios_base& __str) |
| 994 | 996 | return __str; |
| 995 | 997 | } |
| 996 | 998 | |
| 997 | inline | |
| 999 | _LIBCPP_HIDE_FROM_ABI inline | |
| 998 | 1000 | ios_base& |
| 999 | 1001 | oct(ios_base& __str) |
| 1000 | 1002 | { |
| ... | ... | @@ -1002,7 +1004,7 @@ oct(ios_base& __str) |
| 1002 | 1004 | return __str; |
| 1003 | 1005 | } |
| 1004 | 1006 | |
| 1005 | inline | |
| 1007 | _LIBCPP_HIDE_FROM_ABI inline | |
| 1006 | 1008 | ios_base& |
| 1007 | 1009 | fixed(ios_base& __str) |
| 1008 | 1010 | { |
| ... | ... | @@ -1010,7 +1012,7 @@ fixed(ios_base& __str) |
| 1010 | 1012 | return __str; |
| 1011 | 1013 | } |
| 1012 | 1014 | |
| 1013 | inline | |
| 1015 | _LIBCPP_HIDE_FROM_ABI inline | |
| 1014 | 1016 | ios_base& |
| 1015 | 1017 | scientific(ios_base& __str) |
| 1016 | 1018 | { |
| ... | ... | @@ -1018,7 +1020,7 @@ scientific(ios_base& __str) |
| 1018 | 1020 | return __str; |
| 1019 | 1021 | } |
| 1020 | 1022 | |
| 1021 | inline | |
| 1023 | _LIBCPP_HIDE_FROM_ABI inline | |
| 1022 | 1024 | ios_base& |
| 1023 | 1025 | hexfloat(ios_base& __str) |
| 1024 | 1026 | { |
| ... | ... | @@ -1026,7 +1028,7 @@ hexfloat(ios_base& __str) |
| 1026 | 1028 | return __str; |
| 1027 | 1029 | } |
| 1028 | 1030 | |
| 1029 | inline | |
| 1031 | _LIBCPP_HIDE_FROM_ABI inline | |
| 1030 | 1032 | ios_base& |
| 1031 | 1033 | defaultfloat(ios_base& __str) |
| 1032 | 1034 | { |
| ... | ... | @@ -1036,4 +1038,17 @@ defaultfloat(ios_base& __str) |
| 1036 | 1038 | |
| 1037 | 1039 | _LIBCPP_END_NAMESPACE_STD |
| 1038 | 1040 | |
| 1041 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1042 | # include <concepts> | |
| 1043 | # include <cstddef> | |
| 1044 | # include <cstdlib> | |
| 1045 | # include <cstring> | |
| 1046 | # include <initializer_list> | |
| 1047 | # include <limits> | |
| 1048 | # include <new> | |
| 1049 | # include <stdexcept> | |
| 1050 | # include <type_traits> | |
| 1051 | # include <typeinfo> | |
| 1052 | #endif | |
| 1053 | ||
| 1039 | 1054 | #endif // _LIBCPP_IOS |
lib/libcxx/include/iosfwd+1-25| ... | ... | @@ -96,6 +96,7 @@ using u32streampos = fpos<char_traits<char32_t>::state_type>; |
| 96 | 96 | |
| 97 | 97 | #include <__assert> // all public C++ headers provide the assertion handler |
| 98 | 98 | #include <__config> |
| 99 | #include <__fwd/string.h> | |
| 99 | 100 | #include <__mbstate_t.h> |
| 100 | 101 | #include <version> |
| 101 | 102 | |
| ... | ... | @@ -107,19 +108,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 107 | 108 | |
| 108 | 109 | class _LIBCPP_TYPE_VIS ios_base; |
| 109 | 110 | |
| 110 | template<class _CharT> struct _LIBCPP_TEMPLATE_VIS char_traits; | |
| 111 | template<> struct char_traits<char>; | |
| 112 | #ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 113 | template<> struct char_traits<char8_t>; | |
| 114 | #endif | |
| 115 | template<> struct char_traits<char16_t>; | |
| 116 | template<> struct char_traits<char32_t>; | |
| 117 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 118 | template<> struct char_traits<wchar_t>; | |
| 119 | #endif | |
| 120 | ||
| 121 | template<class _Tp> class _LIBCPP_TEMPLATE_VIS allocator; | |
| 122 | ||
| 123 | 111 | template <class _CharT, class _Traits = char_traits<_CharT> > |
| 124 | 112 | class _LIBCPP_TEMPLATE_VIS basic_ios; |
| 125 | 113 | |
| ... | ... | @@ -242,18 +230,6 @@ typedef long int streamoff; // for char_traits in <string> |
| 242 | 230 | typedef long long streamoff; // for char_traits in <string> |
| 243 | 231 | #endif |
| 244 | 232 | |
| 245 | template <class _CharT, // for <stdexcept> | |
| 246 | class _Traits = char_traits<_CharT>, | |
| 247 | class _Allocator = allocator<_CharT> > | |
| 248 | class _LIBCPP_TEMPLATE_VIS basic_string; | |
| 249 | typedef basic_string<char, char_traits<char>, allocator<char> > string; | |
| 250 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 251 | typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring; | |
| 252 | #endif | |
| 253 | ||
| 254 | template <class _CharT, class _Traits, class _Allocator> | |
| 255 | class _LIBCPP_PREFERRED_NAME(string) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstring)) basic_string; | |
| 256 | ||
| 257 | 233 | // Include other forward declarations here |
| 258 | 234 | template <class _Tp, class _Alloc = allocator<_Tp> > |
| 259 | 235 | class _LIBCPP_TEMPLATE_VIS vector; |
lib/libcxx/include/iostream+2| ... | ... | @@ -38,6 +38,8 @@ extern wostream wclog; |
| 38 | 38 | #include <version> |
| 39 | 39 | |
| 40 | 40 | // standard-mandated includes |
| 41 | ||
| 42 | // [iostream.syn] | |
| 41 | 43 | #include <ios> |
| 42 | 44 | #include <istream> |
| 43 | 45 | #include <ostream> |
lib/libcxx/include/istream+23-18| ... | ... | @@ -192,7 +192,7 @@ public: |
| 192 | 192 | inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 |
| 193 | 193 | explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb) : __gc_(0) |
| 194 | 194 | { this->init(__sb); } |
| 195 | virtual ~basic_istream(); | |
| 195 | ~basic_istream() override; | |
| 196 | 196 | protected: |
| 197 | 197 | inline _LIBCPP_INLINE_VISIBILITY |
| 198 | 198 | basic_istream(basic_istream&& __rhs); |
| ... | ... | @@ -316,7 +316,7 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _ |
| 316 | 316 | if (!__noskipws && (__is.flags() & ios_base::skipws)) |
| 317 | 317 | { |
| 318 | 318 | typedef istreambuf_iterator<_CharT, _Traits> _Ip; |
| 319 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); | |
| 319 | const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc()); | |
| 320 | 320 | _Ip __i(__is); |
| 321 | 321 | _Ip __eof; |
| 322 | 322 | for (; __i != __eof; ++__i) |
| ... | ... | @@ -366,7 +366,7 @@ __input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) { |
| 366 | 366 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 367 | 367 | typedef istreambuf_iterator<_CharT, _Traits> _Ip; |
| 368 | 368 | typedef num_get<_CharT, _Ip> _Fp; |
| 369 | use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n); | |
| 369 | std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n); | |
| 370 | 370 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 371 | 371 | } |
| 372 | 372 | catch (...) |
| ... | ... | @@ -476,7 +476,7 @@ __input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp |
| 476 | 476 | typedef istreambuf_iterator<_CharT, _Traits> _Ip; |
| 477 | 477 | typedef num_get<_CharT, _Ip> _Fp; |
| 478 | 478 | long __temp; |
| 479 | use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp); | |
| 479 | std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp); | |
| 480 | 480 | if (__temp < numeric_limits<_Tp>::min()) |
| 481 | 481 | { |
| 482 | 482 | __state |= ios_base::failbit; |
| ... | ... | @@ -536,7 +536,7 @@ __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n) |
| 536 | 536 | { |
| 537 | 537 | #endif |
| 538 | 538 | _CharT* __s = __p; |
| 539 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); | |
| 539 | const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc()); | |
| 540 | 540 | while (__s != __p + (__n-1)) |
| 541 | 541 | { |
| 542 | 542 | typename _Traits::int_type __i = __is.rdbuf()->sgetc(); |
| ... | ... | @@ -633,7 +633,7 @@ operator>>(basic_istream<char, _Traits>& __is, signed char* __s) |
| 633 | 633 | #endif // _LIBCPP_STD_VER > 17 |
| 634 | 634 | |
| 635 | 635 | template<class _CharT, class _Traits> |
| 636 | basic_istream<_CharT, _Traits>& | |
| 636 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 637 | 637 | operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c) |
| 638 | 638 | { |
| 639 | 639 | ios_base::iostate __state = ios_base::goodbit; |
| ... | ... | @@ -1329,7 +1329,7 @@ basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) |
| 1329 | 1329 | } |
| 1330 | 1330 | |
| 1331 | 1331 | template <class _CharT, class _Traits> |
| 1332 | basic_istream<_CharT, _Traits>& | |
| 1332 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 1333 | 1333 | ws(basic_istream<_CharT, _Traits>& __is) |
| 1334 | 1334 | { |
| 1335 | 1335 | ios_base::iostate __state = ios_base::goodbit; |
| ... | ... | @@ -1340,7 +1340,7 @@ ws(basic_istream<_CharT, _Traits>& __is) |
| 1340 | 1340 | try |
| 1341 | 1341 | { |
| 1342 | 1342 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 1343 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); | |
| 1343 | const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc()); | |
| 1344 | 1344 | while (true) |
| 1345 | 1345 | { |
| 1346 | 1346 | typename _Traits::int_type __i = __is.rdbuf()->sgetc(); |
| ... | ... | @@ -1375,7 +1375,7 @@ struct __is_istreamable : false_type { }; |
| 1375 | 1375 | |
| 1376 | 1376 | template <class _Stream, class _Tp> |
| 1377 | 1377 | struct __is_istreamable<_Stream, _Tp, decltype( |
| 1378 | declval<_Stream>() >> declval<_Tp>(), void() | |
| 1378 | std::declval<_Stream>() >> std::declval<_Tp>(), void() | |
| 1379 | 1379 | )> : true_type { }; |
| 1380 | 1380 | |
| 1381 | 1381 | template <class _Stream, class _Tp, class = typename enable_if< |
| ... | ... | @@ -1408,7 +1408,7 @@ public: |
| 1408 | 1408 | : basic_istream<_CharT, _Traits>(__sb) |
| 1409 | 1409 | {} |
| 1410 | 1410 | |
| 1411 | virtual ~basic_iostream(); | |
| 1411 | ~basic_iostream() override; | |
| 1412 | 1412 | protected: |
| 1413 | 1413 | inline _LIBCPP_INLINE_VISIBILITY |
| 1414 | 1414 | basic_iostream(basic_iostream&& __rhs); |
| ... | ... | @@ -1442,7 +1442,7 @@ basic_iostream<_CharT, _Traits>::~basic_iostream() |
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | 1444 | template<class _CharT, class _Traits, class _Allocator> |
| 1445 | basic_istream<_CharT, _Traits>& | |
| 1445 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 1446 | 1446 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 1447 | 1447 | basic_string<_CharT, _Traits, _Allocator>& __str) |
| 1448 | 1448 | { |
| ... | ... | @@ -1461,7 +1461,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 1461 | 1461 | if (__n <= 0) |
| 1462 | 1462 | __n = numeric_limits<streamsize>::max(); |
| 1463 | 1463 | streamsize __c = 0; |
| 1464 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); | |
| 1464 | const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc()); | |
| 1465 | 1465 | while (__c < __n) |
| 1466 | 1466 | { |
| 1467 | 1467 | typename _Traits::int_type __i = __is.rdbuf()->sgetc(); |
| ... | ... | @@ -1498,7 +1498,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 1498 | 1498 | } |
| 1499 | 1499 | |
| 1500 | 1500 | template<class _CharT, class _Traits, class _Allocator> |
| 1501 | basic_istream<_CharT, _Traits>& | |
| 1501 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 1502 | 1502 | getline(basic_istream<_CharT, _Traits>& __is, |
| 1503 | 1503 | basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) |
| 1504 | 1504 | { |
| ... | ... | @@ -1556,7 +1556,7 @@ basic_istream<_CharT, _Traits>& |
| 1556 | 1556 | getline(basic_istream<_CharT, _Traits>& __is, |
| 1557 | 1557 | basic_string<_CharT, _Traits, _Allocator>& __str) |
| 1558 | 1558 | { |
| 1559 | return getline(__is, __str, __is.widen('\n')); | |
| 1559 | return std::getline(__is, __str, __is.widen('\n')); | |
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | 1562 | template<class _CharT, class _Traits, class _Allocator> |
| ... | ... | @@ -1565,7 +1565,7 @@ basic_istream<_CharT, _Traits>& |
| 1565 | 1565 | getline(basic_istream<_CharT, _Traits>&& __is, |
| 1566 | 1566 | basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) |
| 1567 | 1567 | { |
| 1568 | return getline(__is, __str, __dlm); | |
| 1568 | return std::getline(__is, __str, __dlm); | |
| 1569 | 1569 | } |
| 1570 | 1570 | |
| 1571 | 1571 | template<class _CharT, class _Traits, class _Allocator> |
| ... | ... | @@ -1574,11 +1574,11 @@ basic_istream<_CharT, _Traits>& |
| 1574 | 1574 | getline(basic_istream<_CharT, _Traits>&& __is, |
| 1575 | 1575 | basic_string<_CharT, _Traits, _Allocator>& __str) |
| 1576 | 1576 | { |
| 1577 | return getline(__is, __str, __is.widen('\n')); | |
| 1577 | return std::getline(__is, __str, __is.widen('\n')); | |
| 1578 | 1578 | } |
| 1579 | 1579 | |
| 1580 | 1580 | template <class _CharT, class _Traits, size_t _Size> |
| 1581 | basic_istream<_CharT, _Traits>& | |
| 1581 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 1582 | 1582 | operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) |
| 1583 | 1583 | { |
| 1584 | 1584 | ios_base::iostate __state = ios_base::goodbit; |
| ... | ... | @@ -1590,7 +1590,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) |
| 1590 | 1590 | { |
| 1591 | 1591 | #endif |
| 1592 | 1592 | basic_string<_CharT, _Traits> __str; |
| 1593 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); | |
| 1593 | const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc()); | |
| 1594 | 1594 | size_t __c = 0; |
| 1595 | 1595 | _CharT __zero = __ct.widen('0'); |
| 1596 | 1596 | _CharT __one = __ct.widen('1'); |
| ... | ... | @@ -1637,6 +1637,11 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>; |
| 1637 | 1637 | |
| 1638 | 1638 | _LIBCPP_END_NAMESPACE_STD |
| 1639 | 1639 | |
| 1640 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1641 | # include <concepts> | |
| 1642 | # include <type_traits> | |
| 1643 | #endif | |
| 1644 | ||
| 1640 | 1645 | _LIBCPP_POP_MACROS |
| 1641 | 1646 | |
| 1642 | 1647 | #endif // _LIBCPP_ISTREAM |
lib/libcxx/include/iterator+12-8| ... | ... | @@ -717,22 +717,26 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept; |
| 717 | 717 | #include <__iterator/wrap_iter.h> |
| 718 | 718 | #include <__memory/addressof.h> |
| 719 | 719 | #include <__memory/pointer_traits.h> |
| 720 | #include <compare> | |
| 721 | #include <concepts> // Mandated by the Standard. | |
| 722 | 720 | #include <cstddef> |
| 723 | 721 | #include <initializer_list> |
| 724 | #include <type_traits> | |
| 725 | 722 | #include <version> |
| 726 | 723 | |
| 727 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 724 | // standard-mandated includes | |
| 725 | ||
| 726 | // [iterator.synopsis] | |
| 727 | #include <compare> | |
| 728 | #include <concepts> | |
| 729 | ||
| 730 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 731 | # pragma GCC system_header | |
| 732 | #endif | |
| 733 | ||
| 734 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 728 | 735 | # include <exception> |
| 729 | 736 | # include <new> |
| 737 | # include <type_traits> | |
| 730 | 738 | # include <typeinfo> |
| 731 | 739 | # include <utility> |
| 732 | 740 | #endif |
| 733 | 741 | |
| 734 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 735 | # pragma GCC system_header | |
| 736 | #endif | |
| 737 | ||
| 738 | 742 | #endif // _LIBCPP_ITERATOR |
lib/libcxx/include/latch+6-6| ... | ... | @@ -64,7 +64,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 64 | 64 | |
| 65 | 65 | class latch |
| 66 | 66 | { |
| 67 | __atomic_base<ptrdiff_t> __a; | |
| 67 | __atomic_base<ptrdiff_t> __a_; | |
| 68 | 68 | |
| 69 | 69 | public: |
| 70 | 70 | static constexpr ptrdiff_t max() noexcept { |
| ... | ... | @@ -72,7 +72,7 @@ public: |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | inline _LIBCPP_INLINE_VISIBILITY |
| 75 | constexpr explicit latch(ptrdiff_t __expected) : __a(__expected) { } | |
| 75 | constexpr explicit latch(ptrdiff_t __expected) : __a_(__expected) { } | |
| 76 | 76 | |
| 77 | 77 | ~latch() = default; |
| 78 | 78 | latch(const latch&) = delete; |
| ... | ... | @@ -81,19 +81,19 @@ public: |
| 81 | 81 | inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 82 | 82 | void count_down(ptrdiff_t __update = 1) |
| 83 | 83 | { |
| 84 | auto const __old = __a.fetch_sub(__update, memory_order_release); | |
| 84 | auto const __old = __a_.fetch_sub(__update, memory_order_release); | |
| 85 | 85 | if(__old == __update) |
| 86 | __a.notify_all(); | |
| 86 | __a_.notify_all(); | |
| 87 | 87 | } |
| 88 | 88 | inline _LIBCPP_INLINE_VISIBILITY |
| 89 | 89 | bool try_wait() const noexcept |
| 90 | 90 | { |
| 91 | return 0 == __a.load(memory_order_acquire); | |
| 91 | return 0 == __a_.load(memory_order_acquire); | |
| 92 | 92 | } |
| 93 | 93 | inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 94 | 94 | void wait() const |
| 95 | 95 | { |
| 96 | __cxx_atomic_wait(&__a.__a_, [&]() -> bool { | |
| 96 | __cxx_atomic_wait(&__a_.__a_, [&]() -> bool { | |
| 97 | 97 | return try_wait(); |
| 98 | 98 | }); |
| 99 | 99 | } |
lib/libcxx/include/limits+10-8| ... | ... | @@ -104,11 +104,9 @@ template<> class numeric_limits<cv long double>; |
| 104 | 104 | |
| 105 | 105 | #include <__assert> // all public C++ headers provide the assertion handler |
| 106 | 106 | #include <__config> |
| 107 | #include <type_traits> | |
| 108 | ||
| 109 | #if defined(_LIBCPP_COMPILER_MSVC) | |
| 110 | #include "__support/win32/limits_msvc_win32.h" | |
| 111 | #endif // _LIBCPP_MSVCRT | |
| 107 | #include <__type_traits/is_arithmetic.h> | |
| 108 | #include <__type_traits/is_signed.h> | |
| 109 | #include <__type_traits/remove_cv.h> | |
| 112 | 110 | |
| 113 | 111 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 114 | 112 | # pragma GCC system_header |
| ... | ... | @@ -432,7 +430,7 @@ protected: |
| 432 | 430 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");} |
| 433 | 431 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;} |
| 434 | 432 | |
| 435 | #if (defined(__ppc__) || defined(__ppc64__)) | |
| 433 | #if defined(__powerpc__) && defined(__LONG_DOUBLE_IBM128__) | |
| 436 | 434 | static _LIBCPP_CONSTEXPR const bool is_iec559 = false; |
| 437 | 435 | #else |
| 438 | 436 | static _LIBCPP_CONSTEXPR const bool is_iec559 = true; |
| ... | ... | @@ -451,9 +449,9 @@ protected: |
| 451 | 449 | |
| 452 | 450 | template <class _Tp> |
| 453 | 451 | class _LIBCPP_TEMPLATE_VIS numeric_limits |
| 454 | : private __libcpp_numeric_limits<typename remove_cv<_Tp>::type> | |
| 452 | : private __libcpp_numeric_limits<__remove_cv_t<_Tp> > | |
| 455 | 453 | { |
| 456 | typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base; | |
| 454 | typedef __libcpp_numeric_limits<__remove_cv_t<_Tp> > __base; | |
| 457 | 455 | typedef typename __base::type type; |
| 458 | 456 | public: |
| 459 | 457 | static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; |
| ... | ... | @@ -825,4 +823,8 @@ _LIBCPP_END_NAMESPACE_STD |
| 825 | 823 | |
| 826 | 824 | _LIBCPP_POP_MACROS |
| 827 | 825 | |
| 826 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 827 | # include <type_traits> | |
| 828 | #endif | |
| 829 | ||
| 828 | 830 | #endif // _LIBCPP_LIMITS |
lib/libcxx/include/limits.h+13-6| ... | ... | @@ -43,13 +43,13 @@ Macros: |
| 43 | 43 | # pragma GCC system_header |
| 44 | 44 | #endif |
| 45 | 45 | |
| 46 | #ifndef __GNUC__ | |
| 47 | #include_next <limits.h> | |
| 48 | #else | |
| 46 | #ifdef _LIBCPP_COMPILER_GCC | |
| 47 | ||
| 49 | 48 | // GCC header limits.h recursively includes itself through another header called |
| 50 | 49 | // syslimits.h for some reason. This setup breaks down if we directly |
| 51 | // #include_next GCC's limits.h (reasons not entirely clear to me). Therefore, | |
| 52 | // we manually re-create the necessary include sequence below: | |
| 50 | // #include_next GCC's limits.h (reasons not entirely clear to me). | |
| 51 | // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107795 for more details. | |
| 52 | // Therefore, we manually re-create the necessary include sequence below: | |
| 53 | 53 | |
| 54 | 54 | // Get the system limits.h defines (force recurse into the next level) |
| 55 | 55 | #define _GCC_LIMITS_H_ |
| ... | ... | @@ -59,6 +59,13 @@ Macros: |
| 59 | 59 | // Get the ISO C defines |
| 60 | 60 | #undef _GCC_LIMITS_H_ |
| 61 | 61 | #include_next <limits.h> |
| 62 | #endif // __GNUC__ | |
| 62 | ||
| 63 | #else | |
| 64 | ||
| 65 | # if __has_include_next(<limits.h>) | |
| 66 | # include_next <limits.h> | |
| 67 | # endif | |
| 68 | ||
| 69 | #endif // _LIBCPP_COMPILER_GCC | |
| 63 | 70 | |
| 64 | 71 | #endif // _LIBCPP_LIMITS_H |
lib/libcxx/include/list+43-24| ... | ... | @@ -194,21 +194,24 @@ template <class T, class Allocator, class Predicate> |
| 194 | 194 | #include <__iterator/next.h> |
| 195 | 195 | #include <__iterator/prev.h> |
| 196 | 196 | #include <__iterator/reverse_iterator.h> |
| 197 | #include <__memory/addressof.h> | |
| 198 | #include <__memory/allocator.h> | |
| 199 | #include <__memory/allocator_destructor.h> | |
| 200 | #include <__memory/allocator_traits.h> | |
| 201 | #include <__memory/compressed_pair.h> | |
| 202 | #include <__memory/pointer_traits.h> | |
| 197 | 203 | #include <__memory/swap_allocator.h> |
| 204 | #include <__memory/unique_ptr.h> | |
| 205 | #include <__memory_resource/polymorphic_allocator.h> | |
| 206 | #include <__type_traits/is_allocator.h> | |
| 198 | 207 | #include <__utility/forward.h> |
| 199 | 208 | #include <__utility/move.h> |
| 200 | 209 | #include <__utility/swap.h> |
| 210 | #include <cstring> | |
| 201 | 211 | #include <limits> |
| 202 | #include <memory> | |
| 203 | 212 | #include <type_traits> |
| 204 | 213 | #include <version> |
| 205 | 214 | |
| 206 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 207 | # include <algorithm> | |
| 208 | # include <functional> | |
| 209 | # include <iterator> | |
| 210 | #endif | |
| 211 | ||
| 212 | 215 | // standard-mandated includes |
| 213 | 216 | |
| 214 | 217 | // [iterator.range] |
| ... | ... | @@ -237,26 +240,19 @@ template <class _Tp, class _VoidPtr> struct __list_node_base; |
| 237 | 240 | |
| 238 | 241 | template <class _Tp, class _VoidPtr> |
| 239 | 242 | struct __list_node_pointer_traits { |
| 240 | typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type | |
| 243 | typedef __rebind_pointer_t<_VoidPtr, __list_node<_Tp, _VoidPtr> > | |
| 241 | 244 | __node_pointer; |
| 242 | typedef typename __rebind_pointer<_VoidPtr, __list_node_base<_Tp, _VoidPtr> >::type | |
| 245 | typedef __rebind_pointer_t<_VoidPtr, __list_node_base<_Tp, _VoidPtr> > | |
| 243 | 246 | __base_pointer; |
| 244 | 247 | |
| 245 | 248 | #if defined(_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB) |
| 246 | 249 | typedef __base_pointer __link_pointer; |
| 247 | 250 | #else |
| 248 | typedef typename conditional< | |
| 249 | is_pointer<_VoidPtr>::value, | |
| 250 | __base_pointer, | |
| 251 | __node_pointer | |
| 252 | >::type __link_pointer; | |
| 251 | typedef __conditional_t<is_pointer<_VoidPtr>::value, __base_pointer, __node_pointer> __link_pointer; | |
| 253 | 252 | #endif |
| 254 | 253 | |
| 255 | typedef typename conditional< | |
| 256 | is_same<__link_pointer, __node_pointer>::value, | |
| 257 | __base_pointer, | |
| 258 | __node_pointer | |
| 259 | >::type __non_link_pointer; | |
| 254 | typedef __conditional_t<is_same<__link_pointer, __node_pointer>::value, __base_pointer, __node_pointer> | |
| 255 | __non_link_pointer; | |
| 260 | 256 | |
| 261 | 257 | static _LIBCPP_INLINE_VISIBILITY |
| 262 | 258 | __link_pointer __unsafe_link_pointer_cast(__link_pointer __p) { |
| ... | ... | @@ -340,7 +336,7 @@ public: |
| 340 | 336 | typedef bidirectional_iterator_tag iterator_category; |
| 341 | 337 | typedef _Tp value_type; |
| 342 | 338 | typedef value_type& reference; |
| 343 | typedef typename __rebind_pointer<_VoidPtr, value_type>::type pointer; | |
| 339 | typedef __rebind_pointer_t<_VoidPtr, value_type> pointer; | |
| 344 | 340 | typedef typename pointer_traits<pointer>::difference_type difference_type; |
| 345 | 341 | |
| 346 | 342 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -448,7 +444,7 @@ public: |
| 448 | 444 | typedef bidirectional_iterator_tag iterator_category; |
| 449 | 445 | typedef _Tp value_type; |
| 450 | 446 | typedef const value_type& reference; |
| 451 | typedef typename __rebind_pointer<_VoidPtr, const value_type>::type pointer; | |
| 447 | typedef __rebind_pointer_t<_VoidPtr, const value_type> pointer; | |
| 452 | 448 | typedef typename pointer_traits<pointer>::difference_type difference_type; |
| 453 | 449 | |
| 454 | 450 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -555,7 +551,7 @@ protected: |
| 555 | 551 | typedef __list_const_iterator<value_type, __void_pointer> const_iterator; |
| 556 | 552 | typedef __list_node_base<value_type, __void_pointer> __node_base; |
| 557 | 553 | typedef __list_node<value_type, __void_pointer> __node; |
| 558 | typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; | |
| 554 | typedef __rebind_alloc<__alloc_traits, __node> __node_allocator; | |
| 559 | 555 | typedef allocator_traits<__node_allocator> __node_alloc_traits; |
| 560 | 556 | typedef typename __node_alloc_traits::pointer __node_pointer; |
| 561 | 557 | typedef typename __node_alloc_traits::pointer __node_const_pointer; |
| ... | ... | @@ -566,7 +562,7 @@ protected: |
| 566 | 562 | typedef typename __alloc_traits::const_pointer const_pointer; |
| 567 | 563 | typedef typename __alloc_traits::difference_type difference_type; |
| 568 | 564 | |
| 569 | typedef typename __rebind_alloc_helper<__alloc_traits, __node_base>::type __node_base_allocator; | |
| 565 | typedef __rebind_alloc<__alloc_traits, __node_base> __node_base_allocator; | |
| 570 | 566 | typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer; |
| 571 | 567 | static_assert((!is_same<allocator_type, __node_allocator>::value), |
| 572 | 568 | "internal allocator type must differ from user-specified " |
| ... | ... | @@ -845,6 +841,10 @@ public: |
| 845 | 841 | typedef void __remove_return_type; |
| 846 | 842 | #endif |
| 847 | 843 | |
| 844 | static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value, | |
| 845 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 846 | "original allocator"); | |
| 847 | ||
| 848 | 848 | _LIBCPP_INLINE_VISIBILITY |
| 849 | 849 | list() |
| 850 | 850 | _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) |
| ... | ... | @@ -1063,7 +1063,7 @@ public: |
| 1063 | 1063 | __remove_return_type remove(const value_type& __x); |
| 1064 | 1064 | template <class _Pred> __remove_return_type remove_if(_Pred __pred); |
| 1065 | 1065 | _LIBCPP_INLINE_VISIBILITY |
| 1066 | __remove_return_type unique() { return unique(__equal_to<value_type>()); } | |
| 1066 | __remove_return_type unique() { return unique(__equal_to()); } | |
| 1067 | 1067 | template <class _BinaryPred> |
| 1068 | 1068 | __remove_return_type unique(_BinaryPred __binary_pred); |
| 1069 | 1069 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -2362,6 +2362,25 @@ inline constexpr bool __format::__enable_insertable<std::list<wchar_t>> = true; |
| 2362 | 2362 | |
| 2363 | 2363 | _LIBCPP_END_NAMESPACE_STD |
| 2364 | 2364 | |
| 2365 | #if _LIBCPP_STD_VER > 14 | |
| 2366 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 2367 | namespace pmr { | |
| 2368 | template <class _ValueT> | |
| 2369 | using list = std::list<_ValueT, polymorphic_allocator<_ValueT>>; | |
| 2370 | } // namespace pmr | |
| 2371 | _LIBCPP_END_NAMESPACE_STD | |
| 2372 | #endif | |
| 2373 | ||
| 2365 | 2374 | _LIBCPP_POP_MACROS |
| 2366 | 2375 | |
| 2376 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 2377 | # include <algorithm> | |
| 2378 | # include <atomic> | |
| 2379 | # include <concepts> | |
| 2380 | # include <functional> | |
| 2381 | # include <iosfwd> | |
| 2382 | # include <iterator> | |
| 2383 | # include <typeinfo> | |
| 2384 | #endif | |
| 2385 | ||
| 2367 | 2386 | #endif // _LIBCPP_LIST |
lib/libcxx/include/locale+136-140| ... | ... | @@ -201,19 +201,18 @@ template <class charT> class messages_byname; |
| 201 | 201 | #include <__iterator/istreambuf_iterator.h> |
| 202 | 202 | #include <__iterator/ostreambuf_iterator.h> |
| 203 | 203 | #include <__locale> |
| 204 | #include <cstdarg> // TODO: Remove this include | |
| 204 | #include <__memory/unique_ptr.h> | |
| 205 | 205 | #include <cstdio> |
| 206 | 206 | #include <cstdlib> |
| 207 | 207 | #include <ctime> |
| 208 | 208 | #include <ios> |
| 209 | 209 | #include <limits> |
| 210 | #include <memory> | |
| 210 | #include <new> | |
| 211 | 211 | #include <streambuf> |
| 212 | 212 | #include <version> |
| 213 | 213 | |
| 214 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 215 | # include <iterator> | |
| 216 | #endif | |
| 214 | // TODO: Fix __bsd_locale_defaults.h | |
| 215 | // NOLINTBEGIN(libcpp-robust-against-adl) | |
| 217 | 216 | |
| 218 | 217 | #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) |
| 219 | 218 | // Most unix variants have catopen. These are the specific ones that don't. |
| ... | ... | @@ -239,7 +238,7 @@ _LIBCPP_PUSH_MACROS |
| 239 | 238 | |
| 240 | 239 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 241 | 240 | |
| 242 | #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) | |
| 241 | #if defined(__APPLE__) || defined(__FreeBSD__) | |
| 243 | 242 | # define _LIBCPP_GET_C_LOCALE 0 |
| 244 | 243 | #elif defined(__NetBSD__) |
| 245 | 244 | # define _LIBCPP_GET_C_LOCALE LC_C_LOCALE |
| ... | ... | @@ -269,7 +268,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 269 | 268 | // If the input is "a", the first keyword matches and eofbit is set. |
| 270 | 269 | // If the input is "abc", no match is found and "ab" are consumed. |
| 271 | 270 | template <class _InputIterator, class _ForwardIterator, class _Ctype> |
| 272 | _LIBCPP_HIDDEN | |
| 271 | _LIBCPP_HIDE_FROM_ABI | |
| 273 | 272 | _ForwardIterator |
| 274 | 273 | __scan_keyword(_InputIterator& __b, _InputIterator __e, |
| 275 | 274 | _ForwardIterator __kb, _ForwardIterator __ke, |
| ... | ... | @@ -450,8 +449,8 @@ string |
| 450 | 449 | __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep) |
| 451 | 450 | { |
| 452 | 451 | locale __loc = __iob.getloc(); |
| 453 | use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 26, __atoms); | |
| 454 | const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc); | |
| 452 | std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 26, __atoms); | |
| 453 | const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc); | |
| 455 | 454 | __thousands_sep = __np.thousands_sep(); |
| 456 | 455 | return __np.grouping(); |
| 457 | 456 | } |
| ... | ... | @@ -463,8 +462,8 @@ __num_get<_CharT>::__stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& |
| 463 | 462 | _CharT& __thousands_sep) |
| 464 | 463 | { |
| 465 | 464 | locale __loc = __iob.getloc(); |
| 466 | use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms); | |
| 467 | const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc); | |
| 465 | std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms); | |
| 466 | const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc); | |
| 468 | 467 | __decimal_point = __np.decimal_point(); |
| 469 | 468 | __thousands_sep = __np.thousands_sep(); |
| 470 | 469 | return __np.grouping(); |
| ... | ... | @@ -498,7 +497,7 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& |
| 498 | 497 | } |
| 499 | 498 | return 0; |
| 500 | 499 | } |
| 501 | ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms; | |
| 500 | ptrdiff_t __f = std::find(__atoms, __atoms + 26, __ct) - __atoms; | |
| 502 | 501 | if (__f >= 24) |
| 503 | 502 | return -1; |
| 504 | 503 | switch (__base) |
| ... | ... | @@ -551,13 +550,13 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex |
| 551 | 550 | } |
| 552 | 551 | return 0; |
| 553 | 552 | } |
| 554 | ptrdiff_t __f = find(__atoms, __atoms + 32, __ct) - __atoms; | |
| 553 | ptrdiff_t __f = std::find(__atoms, __atoms + 32, __ct) - __atoms; | |
| 555 | 554 | if (__f >= 32) |
| 556 | 555 | return -1; |
| 557 | 556 | char __x = __src[__f]; |
| 558 | 557 | if (__x == '-' || __x == '+') |
| 559 | 558 | { |
| 560 | if (__a_end == __a || (__a_end[-1] & 0x5F) == (__exp & 0x7F)) | |
| 559 | if (__a_end == __a || (std::toupper(__a_end[-1]) == std::toupper(__exp))) | |
| 561 | 560 | { |
| 562 | 561 | *__a_end++ = __x; |
| 563 | 562 | return 0; |
| ... | ... | @@ -566,9 +565,9 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex |
| 566 | 565 | } |
| 567 | 566 | if (__x == 'x' || __x == 'X') |
| 568 | 567 | __exp = 'P'; |
| 569 | else if ((__x & 0x5F) == __exp) | |
| 568 | else if (std::toupper(__x) == __exp) | |
| 570 | 569 | { |
| 571 | __exp |= (char) 0x80; | |
| 570 | __exp = std::tolower(__exp); | |
| 572 | 571 | if (__in_units) |
| 573 | 572 | { |
| 574 | 573 | __in_units = false; |
| ... | ... | @@ -681,8 +680,7 @@ public: |
| 681 | 680 | static locale::id id; |
| 682 | 681 | |
| 683 | 682 | protected: |
| 684 | _LIBCPP_INLINE_VISIBILITY | |
| 685 | ~num_get() {} | |
| 683 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_get() override {} | |
| 686 | 684 | |
| 687 | 685 | template <class _Fp> |
| 688 | 686 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS |
| ... | ... | @@ -751,17 +749,17 @@ locale::id |
| 751 | 749 | num_get<_CharT, _InputIterator>::id; |
| 752 | 750 | |
| 753 | 751 | template <class _Tp> |
| 754 | _LIBCPP_HIDDEN _Tp | |
| 752 | _LIBCPP_HIDE_FROM_ABI _Tp | |
| 755 | 753 | __num_get_signed_integral(const char* __a, const char* __a_end, |
| 756 | 754 | ios_base::iostate& __err, int __base) |
| 757 | 755 | { |
| 758 | 756 | if (__a != __a_end) |
| 759 | 757 | { |
| 760 | typename remove_reference<decltype(errno)>::type __save_errno = errno; | |
| 758 | __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno; | |
| 761 | 759 | errno = 0; |
| 762 | 760 | char *__p2; |
| 763 | 761 | long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); |
| 764 | typename remove_reference<decltype(errno)>::type __current_errno = errno; | |
| 762 | __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno; | |
| 765 | 763 | if (__current_errno == 0) |
| 766 | 764 | errno = __save_errno; |
| 767 | 765 | if (__p2 != __a_end) |
| ... | ... | @@ -786,7 +784,7 @@ __num_get_signed_integral(const char* __a, const char* __a_end, |
| 786 | 784 | } |
| 787 | 785 | |
| 788 | 786 | template <class _Tp> |
| 789 | _LIBCPP_HIDDEN _Tp | |
| 787 | _LIBCPP_HIDE_FROM_ABI _Tp | |
| 790 | 788 | __num_get_unsigned_integral(const char* __a, const char* __a_end, |
| 791 | 789 | ios_base::iostate& __err, int __base) |
| 792 | 790 | { |
| ... | ... | @@ -797,11 +795,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end, |
| 797 | 795 | __err = ios_base::failbit; |
| 798 | 796 | return 0; |
| 799 | 797 | } |
| 800 | typename remove_reference<decltype(errno)>::type __save_errno = errno; | |
| 798 | __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno; | |
| 801 | 799 | errno = 0; |
| 802 | 800 | char *__p2; |
| 803 | 801 | unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); |
| 804 | typename remove_reference<decltype(errno)>::type __current_errno = errno; | |
| 802 | __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno; | |
| 805 | 803 | if (__current_errno == 0) |
| 806 | 804 | errno = __save_errno; |
| 807 | 805 | if (__p2 != __a_end) |
| ... | ... | @@ -845,17 +843,17 @@ long double __do_strtod<long double>(const char* __a, char** __p2) { |
| 845 | 843 | } |
| 846 | 844 | |
| 847 | 845 | template <class _Tp> |
| 848 | _LIBCPP_HIDDEN | |
| 846 | _LIBCPP_HIDE_FROM_ABI | |
| 849 | 847 | _Tp |
| 850 | 848 | __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err) |
| 851 | 849 | { |
| 852 | 850 | if (__a != __a_end) |
| 853 | 851 | { |
| 854 | typename remove_reference<decltype(errno)>::type __save_errno = errno; | |
| 852 | __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno; | |
| 855 | 853 | errno = 0; |
| 856 | 854 | char *__p2; |
| 857 | _Tp __ld = __do_strtod<_Tp>(__a, &__p2); | |
| 858 | typename remove_reference<decltype(errno)>::type __current_errno = errno; | |
| 855 | _Tp __ld = std::__do_strtod<_Tp>(__a, &__p2); | |
| 856 | __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno; | |
| 859 | 857 | if (__current_errno == 0) |
| 860 | 858 | errno = __save_errno; |
| 861 | 859 | if (__p2 != __a_end) |
| ... | ... | @@ -897,8 +895,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, |
| 897 | 895 | } |
| 898 | 896 | return __b; |
| 899 | 897 | } |
| 900 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__iob.getloc()); | |
| 901 | const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__iob.getloc()); | |
| 898 | const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__iob.getloc()); | |
| 899 | const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__iob.getloc()); | |
| 902 | 900 | typedef typename numpunct<_CharT>::string_type string_type; |
| 903 | 901 | const string_type __names[2] = {__np.truename(), __np.falsename()}; |
| 904 | 902 | const string_type* __i = _VSTD::__scan_keyword(__b, __e, __names, __names+2, |
| ... | ... | @@ -955,7 +953,7 @@ num_get<_CharT, _InputIterator>::__do_get_signed(iter_type __b, iter_type __e, |
| 955 | 953 | if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz) |
| 956 | 954 | *__g_end++ = __dc; |
| 957 | 955 | // Stage 3 |
| 958 | __v = __num_get_signed_integral<_Signed>(__a, __a_end, __err, __base); | |
| 956 | __v = std::__num_get_signed_integral<_Signed>(__a, __a_end, __err, __base); | |
| 959 | 957 | // Digit grouping checked |
| 960 | 958 | __check_grouping(__grouping, __g, __g_end, __err); |
| 961 | 959 | // EOF checked |
| ... | ... | @@ -1012,7 +1010,7 @@ num_get<_CharT, _InputIterator>::__do_get_unsigned(iter_type __b, iter_type __e, |
| 1012 | 1010 | if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz) |
| 1013 | 1011 | *__g_end++ = __dc; |
| 1014 | 1012 | // Stage 3 |
| 1015 | __v = __num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base); | |
| 1013 | __v = std::__num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base); | |
| 1016 | 1014 | // Digit grouping checked |
| 1017 | 1015 | __check_grouping(__grouping, __g, __g_end, __err); |
| 1018 | 1016 | // EOF checked |
| ... | ... | @@ -1067,7 +1065,7 @@ num_get<_CharT, _InputIterator>::__do_get_floating_point(iter_type __b, iter_typ |
| 1067 | 1065 | if (__grouping.size() != 0 && __in_units && __g_end-__g < __num_get_base::__num_get_buf_sz) |
| 1068 | 1066 | *__g_end++ = __dc; |
| 1069 | 1067 | // Stage 3 |
| 1070 | __v = __num_get_float<_Fp>(__a, __a_end, __err); | |
| 1068 | __v = std::__num_get_float<_Fp>(__a, __a_end, __err); | |
| 1071 | 1069 | // Digit grouping checked |
| 1072 | 1070 | __check_grouping(__grouping, __g, __g_end, __err); |
| 1073 | 1071 | // EOF checked |
| ... | ... | @@ -1089,8 +1087,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, |
| 1089 | 1087 | char_type __atoms[26]; |
| 1090 | 1088 | char_type __thousands_sep = 0; |
| 1091 | 1089 | string __grouping; |
| 1092 | use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src, | |
| 1093 | __num_get_base::__src + 26, __atoms); | |
| 1090 | std::use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src, | |
| 1091 | __num_get_base::__src + 26, __atoms); | |
| 1094 | 1092 | string __buf; |
| 1095 | 1093 | __buf.resize(__buf.capacity()); |
| 1096 | 1094 | char* __a = &__buf[0]; |
| ... | ... | @@ -1157,8 +1155,8 @@ __num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne, |
| 1157 | 1155 | _CharT* __ob, _CharT*& __op, _CharT*& __oe, |
| 1158 | 1156 | const locale& __loc) |
| 1159 | 1157 | { |
| 1160 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> > (__loc); | |
| 1161 | const numpunct<_CharT>& __npt = use_facet<numpunct<_CharT> >(__loc); | |
| 1158 | const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> > (__loc); | |
| 1159 | const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc); | |
| 1162 | 1160 | string __grouping = __npt.grouping(); |
| 1163 | 1161 | if (__grouping.empty()) |
| 1164 | 1162 | { |
| ... | ... | @@ -1177,7 +1175,7 @@ __num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne, |
| 1177 | 1175 | *__oe++ = __ct.widen(*__nf++); |
| 1178 | 1176 | *__oe++ = __ct.widen(*__nf++); |
| 1179 | 1177 | } |
| 1180 | reverse(__nf, __ne); | |
| 1178 | std::reverse(__nf, __ne); | |
| 1181 | 1179 | _CharT __thousands_sep = __npt.thousands_sep(); |
| 1182 | 1180 | unsigned __dc = 0; |
| 1183 | 1181 | unsigned __dg = 0; |
| ... | ... | @@ -1194,7 +1192,7 @@ __num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne, |
| 1194 | 1192 | *__oe++ = __ct.widen(*__p); |
| 1195 | 1193 | ++__dc; |
| 1196 | 1194 | } |
| 1197 | reverse(__ob + (__nf - __nb), __oe); | |
| 1195 | std::reverse(__ob + (__nf - __nb), __oe); | |
| 1198 | 1196 | } |
| 1199 | 1197 | if (__np == __ne) |
| 1200 | 1198 | __op = __oe; |
| ... | ... | @@ -1208,8 +1206,8 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, |
| 1208 | 1206 | _CharT* __ob, _CharT*& __op, _CharT*& __oe, |
| 1209 | 1207 | const locale& __loc) |
| 1210 | 1208 | { |
| 1211 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> > (__loc); | |
| 1212 | const numpunct<_CharT>& __npt = use_facet<numpunct<_CharT> >(__loc); | |
| 1209 | const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> > (__loc); | |
| 1210 | const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc); | |
| 1213 | 1211 | string __grouping = __npt.grouping(); |
| 1214 | 1212 | __oe = __ob; |
| 1215 | 1213 | char* __nf = __nb; |
| ... | ... | @@ -1238,7 +1236,7 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, |
| 1238 | 1236 | } |
| 1239 | 1237 | else |
| 1240 | 1238 | { |
| 1241 | reverse(__nf, __ns); | |
| 1239 | std::reverse(__nf, __ns); | |
| 1242 | 1240 | _CharT __thousands_sep = __npt.thousands_sep(); |
| 1243 | 1241 | unsigned __dc = 0; |
| 1244 | 1242 | unsigned __dg = 0; |
| ... | ... | @@ -1254,7 +1252,7 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, |
| 1254 | 1252 | *__oe++ = __ct.widen(*__p); |
| 1255 | 1253 | ++__dc; |
| 1256 | 1254 | } |
| 1257 | reverse(__ob + (__nf - __nb), __oe); | |
| 1255 | std::reverse(__ob + (__nf - __nb), __oe); | |
| 1258 | 1256 | } |
| 1259 | 1257 | for (__nf = __ns; __nf < __ne; ++__nf) |
| 1260 | 1258 | { |
| ... | ... | @@ -1352,8 +1350,7 @@ public: |
| 1352 | 1350 | static locale::id id; |
| 1353 | 1351 | |
| 1354 | 1352 | protected: |
| 1355 | _LIBCPP_INLINE_VISIBILITY | |
| 1356 | ~num_put() {} | |
| 1353 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_put() override {} | |
| 1357 | 1354 | |
| 1358 | 1355 | virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, |
| 1359 | 1356 | bool __v) const; |
| ... | ... | @@ -1390,7 +1387,7 @@ locale::id |
| 1390 | 1387 | num_put<_CharT, _OutputIterator>::id; |
| 1391 | 1388 | |
| 1392 | 1389 | template <class _CharT, class _OutputIterator> |
| 1393 | _LIBCPP_HIDDEN | |
| 1390 | _LIBCPP_HIDE_FROM_ABI | |
| 1394 | 1391 | _OutputIterator |
| 1395 | 1392 | __pad_and_output(_OutputIterator __s, |
| 1396 | 1393 | const _CharT* __ob, const _CharT* __op, const _CharT* __oe, |
| ... | ... | @@ -1413,7 +1410,7 @@ __pad_and_output(_OutputIterator __s, |
| 1413 | 1410 | } |
| 1414 | 1411 | |
| 1415 | 1412 | template <class _CharT, class _Traits> |
| 1416 | _LIBCPP_HIDDEN | |
| 1413 | _LIBCPP_HIDE_FROM_ABI | |
| 1417 | 1414 | ostreambuf_iterator<_CharT, _Traits> |
| 1418 | 1415 | __pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s, |
| 1419 | 1416 | const _CharT* __ob, const _CharT* __op, const _CharT* __oe, |
| ... | ... | @@ -1465,7 +1462,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, |
| 1465 | 1462 | { |
| 1466 | 1463 | if ((__iob.flags() & ios_base::boolalpha) == 0) |
| 1467 | 1464 | return do_put(__s, __iob, __fl, (unsigned long)__v); |
| 1468 | const numpunct<char_type>& __np = use_facet<numpunct<char_type> >(__iob.getloc()); | |
| 1465 | const numpunct<char_type>& __np = std::use_facet<numpunct<char_type> >(__iob.getloc()); | |
| 1469 | 1466 | typedef typename numpunct<char_type>::string_type string_type; |
| 1470 | 1467 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 1471 | 1468 | string_type __tmp(__v ? __np.truename() : __np.falsename()); |
| ... | ... | @@ -1511,7 +1508,7 @@ num_put<_CharT, _OutputIterator>::__do_put_integral(iter_type __s, ios_base& __i |
| 1511 | 1508 | this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); |
| 1512 | 1509 | // [__o, __oe) contains thousands_sep'd wide number |
| 1513 | 1510 | // Stage 3 & 4 |
| 1514 | return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); | |
| 1511 | return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl); | |
| 1515 | 1512 | } |
| 1516 | 1513 | |
| 1517 | 1514 | template <class _CharT, class _OutputIterator> |
| ... | ... | @@ -1599,7 +1596,7 @@ num_put<_CharT, _OutputIterator>::__do_put_floating_point(iter_type __s, ios_bas |
| 1599 | 1596 | this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc()); |
| 1600 | 1597 | // [__o, __oe) contains thousands_sep'd wide number |
| 1601 | 1598 | // Stage 3 & 4 |
| 1602 | __s = __pad_and_output(__s, __ob, __op, __oe, __iob, __fl); | |
| 1599 | __s = std::__pad_and_output(__s, __ob, __op, __oe, __iob, __fl); | |
| 1603 | 1600 | return __s; |
| 1604 | 1601 | } |
| 1605 | 1602 | |
| ... | ... | @@ -1634,7 +1631,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, |
| 1634 | 1631 | char_type __o[2*(__nbuf-1) - 1]; |
| 1635 | 1632 | char_type* __op; // pad here |
| 1636 | 1633 | char_type* __oe; // end of output |
| 1637 | const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); | |
| 1634 | const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); | |
| 1638 | 1635 | __ct.widen(__nar, __ne, __o); |
| 1639 | 1636 | __oe = __o + (__ne - __nar); |
| 1640 | 1637 | if (__np == __ne) |
| ... | ... | @@ -1643,7 +1640,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, |
| 1643 | 1640 | __op = __o + (__np - __nar); |
| 1644 | 1641 | // [__o, __oe) contains wide number |
| 1645 | 1642 | // Stage 3 & 4 |
| 1646 | return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); | |
| 1643 | return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl); | |
| 1647 | 1644 | } |
| 1648 | 1645 | |
| 1649 | 1646 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>; |
| ... | ... | @@ -1652,7 +1649,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>; |
| 1652 | 1649 | #endif |
| 1653 | 1650 | |
| 1654 | 1651 | template <class _CharT, class _InputIterator> |
| 1655 | _LIBCPP_HIDDEN | |
| 1652 | _LIBCPP_HIDE_FROM_ABI | |
| 1656 | 1653 | int |
| 1657 | 1654 | __get_up_to_n_digits(_InputIterator& __b, _InputIterator __e, |
| 1658 | 1655 | ios_base::iostate& __err, const ctype<_CharT>& __ct, int __n) |
| ... | ... | @@ -1798,8 +1795,7 @@ public: |
| 1798 | 1795 | static locale::id id; |
| 1799 | 1796 | |
| 1800 | 1797 | protected: |
| 1801 | _LIBCPP_INLINE_VISIBILITY | |
| 1802 | ~time_get() {} | |
| 1798 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get() override {} | |
| 1803 | 1799 | |
| 1804 | 1800 | virtual dateorder do_date_order() const; |
| 1805 | 1801 | virtual iter_type do_get_time(iter_type __b, iter_type __e, ios_base& __iob, |
| ... | ... | @@ -1930,7 +1926,7 @@ time_get<_CharT, _InputIterator>::__get_month(int& __m, |
| 1930 | 1926 | ios_base::iostate& __err, |
| 1931 | 1927 | const ctype<char_type>& __ct) const |
| 1932 | 1928 | { |
| 1933 | int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1; | |
| 1929 | int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1; | |
| 1934 | 1930 | if (!(__err & ios_base::failbit) && 0 <= __t && __t <= 11) |
| 1935 | 1931 | __m = __t; |
| 1936 | 1932 | else |
| ... | ... | @@ -1944,7 +1940,7 @@ time_get<_CharT, _InputIterator>::__get_year(int& __y, |
| 1944 | 1940 | ios_base::iostate& __err, |
| 1945 | 1941 | const ctype<char_type>& __ct) const |
| 1946 | 1942 | { |
| 1947 | int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4); | |
| 1943 | int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4); | |
| 1948 | 1944 | if (!(__err & ios_base::failbit)) |
| 1949 | 1945 | { |
| 1950 | 1946 | if (__t < 69) |
| ... | ... | @@ -1962,7 +1958,7 @@ time_get<_CharT, _InputIterator>::__get_year4(int& __y, |
| 1962 | 1958 | ios_base::iostate& __err, |
| 1963 | 1959 | const ctype<char_type>& __ct) const |
| 1964 | 1960 | { |
| 1965 | int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4); | |
| 1961 | int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4); | |
| 1966 | 1962 | if (!(__err & ios_base::failbit)) |
| 1967 | 1963 | __y = __t - 1900; |
| 1968 | 1964 | } |
| ... | ... | @@ -1974,7 +1970,7 @@ time_get<_CharT, _InputIterator>::__get_hour(int& __h, |
| 1974 | 1970 | ios_base::iostate& __err, |
| 1975 | 1971 | const ctype<char_type>& __ct) const |
| 1976 | 1972 | { |
| 1977 | int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); | |
| 1973 | int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2); | |
| 1978 | 1974 | if (!(__err & ios_base::failbit) && __t <= 23) |
| 1979 | 1975 | __h = __t; |
| 1980 | 1976 | else |
| ... | ... | @@ -1988,7 +1984,7 @@ time_get<_CharT, _InputIterator>::__get_12_hour(int& __h, |
| 1988 | 1984 | ios_base::iostate& __err, |
| 1989 | 1985 | const ctype<char_type>& __ct) const |
| 1990 | 1986 | { |
| 1991 | int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); | |
| 1987 | int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2); | |
| 1992 | 1988 | if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 12) |
| 1993 | 1989 | __h = __t; |
| 1994 | 1990 | else |
| ... | ... | @@ -2002,7 +1998,7 @@ time_get<_CharT, _InputIterator>::__get_minute(int& __m, |
| 2002 | 1998 | ios_base::iostate& __err, |
| 2003 | 1999 | const ctype<char_type>& __ct) const |
| 2004 | 2000 | { |
| 2005 | int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); | |
| 2001 | int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2); | |
| 2006 | 2002 | if (!(__err & ios_base::failbit) && __t <= 59) |
| 2007 | 2003 | __m = __t; |
| 2008 | 2004 | else |
| ... | ... | @@ -2016,7 +2012,7 @@ time_get<_CharT, _InputIterator>::__get_second(int& __s, |
| 2016 | 2012 | ios_base::iostate& __err, |
| 2017 | 2013 | const ctype<char_type>& __ct) const |
| 2018 | 2014 | { |
| 2019 | int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); | |
| 2015 | int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2); | |
| 2020 | 2016 | if (!(__err & ios_base::failbit) && __t <= 60) |
| 2021 | 2017 | __s = __t; |
| 2022 | 2018 | else |
| ... | ... | @@ -2030,7 +2026,7 @@ time_get<_CharT, _InputIterator>::__get_weekday(int& __w, |
| 2030 | 2026 | ios_base::iostate& __err, |
| 2031 | 2027 | const ctype<char_type>& __ct) const |
| 2032 | 2028 | { |
| 2033 | int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 1); | |
| 2029 | int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 1); | |
| 2034 | 2030 | if (!(__err & ios_base::failbit) && __t <= 6) |
| 2035 | 2031 | __w = __t; |
| 2036 | 2032 | else |
| ... | ... | @@ -2044,7 +2040,7 @@ time_get<_CharT, _InputIterator>::__get_day_year_num(int& __d, |
| 2044 | 2040 | ios_base::iostate& __err, |
| 2045 | 2041 | const ctype<char_type>& __ct) const |
| 2046 | 2042 | { |
| 2047 | int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 3); | |
| 2043 | int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 3); | |
| 2048 | 2044 | if (!(__err & ios_base::failbit) && __t <= 365) |
| 2049 | 2045 | __d = __t; |
| 2050 | 2046 | else |
| ... | ... | @@ -2109,7 +2105,7 @@ time_get<_CharT, _InputIterator>::get(iter_type __b, iter_type __e, |
| 2109 | 2105 | ios_base::iostate& __err, tm* __tm, |
| 2110 | 2106 | const char_type* __fmtb, const char_type* __fmte) const |
| 2111 | 2107 | { |
| 2112 | const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2108 | const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2113 | 2109 | __err = ios_base::goodbit; |
| 2114 | 2110 | while (__fmtb != __fmte && __err == ios_base::goodbit) |
| 2115 | 2111 | { |
| ... | ... | @@ -2196,7 +2192,7 @@ time_get<_CharT, _InputIterator>::do_get_weekday(iter_type __b, iter_type __e, |
| 2196 | 2192 | ios_base::iostate& __err, |
| 2197 | 2193 | tm* __tm) const |
| 2198 | 2194 | { |
| 2199 | const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2195 | const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2200 | 2196 | __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct); |
| 2201 | 2197 | return __b; |
| 2202 | 2198 | } |
| ... | ... | @@ -2208,7 +2204,7 @@ time_get<_CharT, _InputIterator>::do_get_monthname(iter_type __b, iter_type __e, |
| 2208 | 2204 | ios_base::iostate& __err, |
| 2209 | 2205 | tm* __tm) const |
| 2210 | 2206 | { |
| 2211 | const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2207 | const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2212 | 2208 | __get_monthname(__tm->tm_mon, __b, __e, __err, __ct); |
| 2213 | 2209 | return __b; |
| 2214 | 2210 | } |
| ... | ... | @@ -2220,7 +2216,7 @@ time_get<_CharT, _InputIterator>::do_get_year(iter_type __b, iter_type __e, |
| 2220 | 2216 | ios_base::iostate& __err, |
| 2221 | 2217 | tm* __tm) const |
| 2222 | 2218 | { |
| 2223 | const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2219 | const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2224 | 2220 | __get_year(__tm->tm_year, __b, __e, __err, __ct); |
| 2225 | 2221 | return __b; |
| 2226 | 2222 | } |
| ... | ... | @@ -2233,7 +2229,7 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, |
| 2233 | 2229 | char __fmt, char) const |
| 2234 | 2230 | { |
| 2235 | 2231 | __err = ios_base::goodbit; |
| 2236 | const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2232 | const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2237 | 2233 | switch (__fmt) |
| 2238 | 2234 | { |
| 2239 | 2235 | case 'a': |
| ... | ... | @@ -2392,7 +2388,9 @@ extern template _LIBCPP_FUNC_VIS __time_get_storage<_CharT>::string_type __time_ |
| 2392 | 2388 | /**/ |
| 2393 | 2389 | |
| 2394 | 2390 | _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(char) |
| 2391 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 2395 | 2392 | _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(wchar_t) |
| 2393 | #endif | |
| 2396 | 2394 | #undef _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION |
| 2397 | 2395 | |
| 2398 | 2396 | template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > |
| ... | ... | @@ -2416,26 +2414,17 @@ public: |
| 2416 | 2414 | __time_get_storage<_CharT>(__nm) {} |
| 2417 | 2415 | |
| 2418 | 2416 | protected: |
| 2419 | _LIBCPP_INLINE_VISIBILITY | |
| 2420 | ~time_get_byname() {} | |
| 2417 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get_byname() override {} | |
| 2421 | 2418 | |
| 2422 | _LIBCPP_INLINE_VISIBILITY | |
| 2423 | virtual dateorder do_date_order() const {return this->__do_date_order();} | |
| 2419 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL dateorder do_date_order() const override {return this->__do_date_order();} | |
| 2424 | 2420 | private: |
| 2425 | _LIBCPP_INLINE_VISIBILITY | |
| 2426 | virtual const string_type* __weeks() const {return this->__weeks_;} | |
| 2427 | _LIBCPP_INLINE_VISIBILITY | |
| 2428 | virtual const string_type* __months() const {return this->__months_;} | |
| 2429 | _LIBCPP_INLINE_VISIBILITY | |
| 2430 | virtual const string_type* __am_pm() const {return this->__am_pm_;} | |
| 2431 | _LIBCPP_INLINE_VISIBILITY | |
| 2432 | virtual const string_type& __c() const {return this->__c_;} | |
| 2433 | _LIBCPP_INLINE_VISIBILITY | |
| 2434 | virtual const string_type& __r() const {return this->__r_;} | |
| 2435 | _LIBCPP_INLINE_VISIBILITY | |
| 2436 | virtual const string_type& __x() const {return this->__x_;} | |
| 2437 | _LIBCPP_INLINE_VISIBILITY | |
| 2438 | virtual const string_type& __X() const {return this->__X_;} | |
| 2421 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __weeks() const override {return this->__weeks_;} | |
| 2422 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __months() const override {return this->__months_;} | |
| 2423 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __am_pm() const override {return this->__am_pm_;} | |
| 2424 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __c() const override {return this->__c_;} | |
| 2425 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __r() const override {return this->__r_;} | |
| 2426 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __x() const override {return this->__x_;} | |
| 2427 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __X() const override {return this->__X_;} | |
| 2439 | 2428 | }; |
| 2440 | 2429 | |
| 2441 | 2430 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>; |
| ... | ... | @@ -2453,8 +2442,10 @@ protected: |
| 2453 | 2442 | ~__time_put(); |
| 2454 | 2443 | void __do_put(char* __nb, char*& __ne, const tm* __tm, |
| 2455 | 2444 | char __fmt, char __mod) const; |
| 2445 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 2456 | 2446 | void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, |
| 2457 | 2447 | char __fmt, char __mod) const; |
| 2448 | #endif | |
| 2458 | 2449 | }; |
| 2459 | 2450 | |
| 2460 | 2451 | template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > |
| ... | ... | @@ -2483,8 +2474,7 @@ public: |
| 2483 | 2474 | static locale::id id; |
| 2484 | 2475 | |
| 2485 | 2476 | protected: |
| 2486 | _LIBCPP_INLINE_VISIBILITY | |
| 2487 | ~time_put() {} | |
| 2477 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put() override {} | |
| 2488 | 2478 | virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm, |
| 2489 | 2479 | char __fmt, char __mod) const; |
| 2490 | 2480 | |
| ... | ... | @@ -2509,7 +2499,7 @@ time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob, |
| 2509 | 2499 | const char_type* __pb, |
| 2510 | 2500 | const char_type* __pe) const |
| 2511 | 2501 | { |
| 2512 | const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2502 | const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); | |
| 2513 | 2503 | for (; __pb != __pe; ++__pb) |
| 2514 | 2504 | { |
| 2515 | 2505 | if (__ct.narrow(*__pb, 0) == '%') |
| ... | ... | @@ -2572,8 +2562,7 @@ public: |
| 2572 | 2562 | : time_put<_CharT, _OutputIterator>(__nm, __refs) {} |
| 2573 | 2563 | |
| 2574 | 2564 | protected: |
| 2575 | _LIBCPP_INLINE_VISIBILITY | |
| 2576 | ~time_put_byname() {} | |
| 2565 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put_byname() override {} | |
| 2577 | 2566 | }; |
| 2578 | 2567 | |
| 2579 | 2568 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>; |
| ... | ... | @@ -2621,8 +2610,7 @@ public: |
| 2621 | 2610 | static const bool intl = _International; |
| 2622 | 2611 | |
| 2623 | 2612 | protected: |
| 2624 | _LIBCPP_INLINE_VISIBILITY | |
| 2625 | ~moneypunct() {} | |
| 2613 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct() override {} | |
| 2626 | 2614 | |
| 2627 | 2615 | virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();} |
| 2628 | 2616 | virtual char_type do_thousands_sep() const {return numeric_limits<char_type>::max();} |
| ... | ... | @@ -2672,18 +2660,17 @@ public: |
| 2672 | 2660 | : moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());} |
| 2673 | 2661 | |
| 2674 | 2662 | protected: |
| 2675 | _LIBCPP_INLINE_VISIBILITY | |
| 2676 | ~moneypunct_byname() {} | |
| 2677 | ||
| 2678 | virtual char_type do_decimal_point() const {return __decimal_point_;} | |
| 2679 | virtual char_type do_thousands_sep() const {return __thousands_sep_;} | |
| 2680 | virtual string do_grouping() const {return __grouping_;} | |
| 2681 | virtual string_type do_curr_symbol() const {return __curr_symbol_;} | |
| 2682 | virtual string_type do_positive_sign() const {return __positive_sign_;} | |
| 2683 | virtual string_type do_negative_sign() const {return __negative_sign_;} | |
| 2684 | virtual int do_frac_digits() const {return __frac_digits_;} | |
| 2685 | virtual pattern do_pos_format() const {return __pos_format_;} | |
| 2686 | virtual pattern do_neg_format() const {return __neg_format_;} | |
| 2663 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct_byname() override {} | |
| 2664 | ||
| 2665 | char_type do_decimal_point() const override {return __decimal_point_;} | |
| 2666 | char_type do_thousands_sep() const override {return __thousands_sep_;} | |
| 2667 | string do_grouping() const override {return __grouping_;} | |
| 2668 | string_type do_curr_symbol() const override {return __curr_symbol_;} | |
| 2669 | string_type do_positive_sign() const override {return __positive_sign_;} | |
| 2670 | string_type do_negative_sign() const override {return __negative_sign_;} | |
| 2671 | int do_frac_digits() const override {return __frac_digits_;} | |
| 2672 | pattern do_pos_format() const override {return __pos_format_;} | |
| 2673 | pattern do_neg_format() const override {return __neg_format_;} | |
| 2687 | 2674 | |
| 2688 | 2675 | private: |
| 2689 | 2676 | char_type __decimal_point_; |
| ... | ... | @@ -2740,7 +2727,7 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc, |
| 2740 | 2727 | if (__intl) |
| 2741 | 2728 | { |
| 2742 | 2729 | const moneypunct<char_type, true>& __mp = |
| 2743 | use_facet<moneypunct<char_type, true> >(__loc); | |
| 2730 | std::use_facet<moneypunct<char_type, true> >(__loc); | |
| 2744 | 2731 | __pat = __mp.neg_format(); |
| 2745 | 2732 | __nsn = __mp.negative_sign(); |
| 2746 | 2733 | __psn = __mp.positive_sign(); |
| ... | ... | @@ -2753,7 +2740,7 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc, |
| 2753 | 2740 | else |
| 2754 | 2741 | { |
| 2755 | 2742 | const moneypunct<char_type, false>& __mp = |
| 2756 | use_facet<moneypunct<char_type, false> >(__loc); | |
| 2743 | std::use_facet<moneypunct<char_type, false> >(__loc); | |
| 2757 | 2744 | __pat = __mp.neg_format(); |
| 2758 | 2745 | __nsn = __mp.negative_sign(); |
| 2759 | 2746 | __psn = __mp.positive_sign(); |
| ... | ... | @@ -2801,9 +2788,7 @@ public: |
| 2801 | 2788 | static locale::id id; |
| 2802 | 2789 | |
| 2803 | 2790 | protected: |
| 2804 | ||
| 2805 | _LIBCPP_INLINE_VISIBILITY | |
| 2806 | ~money_get() {} | |
| 2791 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_get() override {} | |
| 2807 | 2792 | |
| 2808 | 2793 | virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl, |
| 2809 | 2794 | ios_base& __iob, ios_base::iostate& __err, |
| ... | ... | @@ -2828,7 +2813,7 @@ money_get<_CharT, _InputIterator>::id; |
| 2828 | 2813 | _LIBCPP_FUNC_VIS void __do_nothing(void*); |
| 2829 | 2814 | |
| 2830 | 2815 | template <class _Tp> |
| 2831 | _LIBCPP_HIDDEN | |
| 2816 | _LIBCPP_HIDE_FROM_ABI | |
| 2832 | 2817 | void |
| 2833 | 2818 | __double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e) |
| 2834 | 2819 | { |
| ... | ... | @@ -2839,7 +2824,7 @@ __double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e) |
| 2839 | 2824 | if (__new_cap == 0) |
| 2840 | 2825 | __new_cap = sizeof(_Tp); |
| 2841 | 2826 | size_t __n_off = static_cast<size_t>(__n - __b.get()); |
| 2842 | _Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap); | |
| 2827 | _Tp* __t = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap); | |
| 2843 | 2828 | if (__t == 0) |
| 2844 | 2829 | __throw_bad_alloc(); |
| 2845 | 2830 | if (__owns) |
| ... | ... | @@ -2954,7 +2939,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, |
| 2954 | 2939 | ++__sym_space_end; |
| 2955 | 2940 | const size_t __num_spaces = __sym_space_end - __sym.begin(); |
| 2956 | 2941 | if (__num_spaces > __spaces.size() || |
| 2957 | !equal(__spaces.end() - __num_spaces, __spaces.end(), | |
| 2942 | !std::equal(__spaces.end() - __num_spaces, __spaces.end(), | |
| 2958 | 2943 | __sym.begin())) { |
| 2959 | 2944 | // No match. Put __sym_space_end back at the |
| 2960 | 2945 | // beginning of __sym, which will prevent a |
| ... | ... | @@ -2985,14 +2970,14 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, |
| 2985 | 2970 | if (__ct.is(ctype_base::digit, __c)) |
| 2986 | 2971 | { |
| 2987 | 2972 | if (__wn == __we) |
| 2988 | __double_or_nothing(__wb, __wn, __we); | |
| 2973 | std::__double_or_nothing(__wb, __wn, __we); | |
| 2989 | 2974 | *__wn++ = __c; |
| 2990 | 2975 | ++__ng; |
| 2991 | 2976 | } |
| 2992 | 2977 | else if (__grp.size() > 0 && __ng > 0 && __c == __ts) |
| 2993 | 2978 | { |
| 2994 | 2979 | if (__gn == __ge) |
| 2995 | __double_or_nothing(__gb, __gn, __ge); | |
| 2980 | std::__double_or_nothing(__gb, __gn, __ge); | |
| 2996 | 2981 | *__gn++ = __ng; |
| 2997 | 2982 | __ng = 0; |
| 2998 | 2983 | } |
| ... | ... | @@ -3002,7 +2987,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, |
| 3002 | 2987 | if (__gb.get() != __gn && __ng > 0) |
| 3003 | 2988 | { |
| 3004 | 2989 | if (__gn == __ge) |
| 3005 | __double_or_nothing(__gb, __gn, __ge); | |
| 2990 | std::__double_or_nothing(__gb, __gn, __ge); | |
| 3006 | 2991 | *__gn++ = __ng; |
| 3007 | 2992 | } |
| 3008 | 2993 | if (__fd > 0) |
| ... | ... | @@ -3020,7 +3005,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, |
| 3020 | 3005 | return false; |
| 3021 | 3006 | } |
| 3022 | 3007 | if (__wn == __we) |
| 3023 | __double_or_nothing(__wb, __wn, __we); | |
| 3008 | std::__double_or_nothing(__wb, __wn, __we); | |
| 3024 | 3009 | *__wn++ = *__b; |
| 3025 | 3010 | } |
| 3026 | 3011 | } |
| ... | ... | @@ -3070,7 +3055,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, |
| 3070 | 3055 | char_type* __wn; |
| 3071 | 3056 | char_type* __we = __wbuf + __bz; |
| 3072 | 3057 | locale __loc = __iob.getloc(); |
| 3073 | const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); | |
| 3058 | const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc); | |
| 3074 | 3059 | bool __neg = false; |
| 3075 | 3060 | if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, |
| 3076 | 3061 | __wb, __wn, __we)) |
| ... | ... | @@ -3091,7 +3076,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, |
| 3091 | 3076 | if (__neg) |
| 3092 | 3077 | *__nc++ = '-'; |
| 3093 | 3078 | for (const char_type* __w = __wb.get(); __w < __wn; ++__w, ++__nc) |
| 3094 | *__nc = __src[find(__atoms, _VSTD::end(__atoms), *__w) - __atoms]; | |
| 3079 | *__nc = __src[std::find(__atoms, _VSTD::end(__atoms), *__w) - __atoms]; | |
| 3095 | 3080 | *__nc = char(); |
| 3096 | 3081 | if (sscanf(__nbuf, "%Lf", &__v) != 1) |
| 3097 | 3082 | __throw_runtime_error("money_get error"); |
| ... | ... | @@ -3114,7 +3099,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, |
| 3114 | 3099 | char_type* __wn; |
| 3115 | 3100 | char_type* __we = __wbuf + __bz; |
| 3116 | 3101 | locale __loc = __iob.getloc(); |
| 3117 | const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); | |
| 3102 | const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc); | |
| 3118 | 3103 | bool __neg = false; |
| 3119 | 3104 | if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, |
| 3120 | 3105 | __wb, __wn, __we)) |
| ... | ... | @@ -3176,7 +3161,7 @@ __money_put<_CharT>::__gather_info(bool __intl, bool __neg, const locale& __loc, |
| 3176 | 3161 | if (__intl) |
| 3177 | 3162 | { |
| 3178 | 3163 | const moneypunct<char_type, true>& __mp = |
| 3179 | use_facet<moneypunct<char_type, true> >(__loc); | |
| 3164 | std::use_facet<moneypunct<char_type, true> >(__loc); | |
| 3180 | 3165 | if (__neg) |
| 3181 | 3166 | { |
| 3182 | 3167 | __pat = __mp.neg_format(); |
| ... | ... | @@ -3196,7 +3181,7 @@ __money_put<_CharT>::__gather_info(bool __intl, bool __neg, const locale& __loc, |
| 3196 | 3181 | else |
| 3197 | 3182 | { |
| 3198 | 3183 | const moneypunct<char_type, false>& __mp = |
| 3199 | use_facet<moneypunct<char_type, false> >(__loc); | |
| 3184 | std::use_facet<moneypunct<char_type, false> >(__loc); | |
| 3200 | 3185 | if (__neg) |
| 3201 | 3186 | { |
| 3202 | 3187 | __pat = __mp.neg_format(); |
| ... | ... | @@ -3296,7 +3281,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m |
| 3296 | 3281 | } |
| 3297 | 3282 | } |
| 3298 | 3283 | // reverse it |
| 3299 | reverse(__t, __me); | |
| 3284 | std::reverse(__t, __me); | |
| 3300 | 3285 | } |
| 3301 | 3286 | break; |
| 3302 | 3287 | } |
| ... | ... | @@ -3347,8 +3332,7 @@ public: |
| 3347 | 3332 | static locale::id id; |
| 3348 | 3333 | |
| 3349 | 3334 | protected: |
| 3350 | _LIBCPP_INLINE_VISIBILITY | |
| 3351 | ~money_put() {} | |
| 3335 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_put() override {} | |
| 3352 | 3336 | |
| 3353 | 3337 | virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob, |
| 3354 | 3338 | char_type __fl, long double __units) const; |
| ... | ... | @@ -3389,7 +3373,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, |
| 3389 | 3373 | } |
| 3390 | 3374 | // gather info |
| 3391 | 3375 | locale __loc = __iob.getloc(); |
| 3392 | const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); | |
| 3376 | const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc); | |
| 3393 | 3377 | __ct.widen(__bb, __bb + __n, __db); |
| 3394 | 3378 | bool __neg = __n > 0 && __bb[0] == '-'; |
| 3395 | 3379 | money_base::pattern __pat; |
| ... | ... | @@ -3421,7 +3405,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, |
| 3421 | 3405 | this->__format(__mb, __mi, __me, __iob.flags(), |
| 3422 | 3406 | __db, __db + __n, __ct, |
| 3423 | 3407 | __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd); |
| 3424 | return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl); | |
| 3408 | return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl); | |
| 3425 | 3409 | } |
| 3426 | 3410 | |
| 3427 | 3411 | template <class _CharT, class _OutputIterator> |
| ... | ... | @@ -3432,7 +3416,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, |
| 3432 | 3416 | { |
| 3433 | 3417 | // gather info |
| 3434 | 3418 | locale __loc = __iob.getloc(); |
| 3435 | const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); | |
| 3419 | const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc); | |
| 3436 | 3420 | bool __neg = __digits.size() > 0 && __digits[0] == __ct.widen('-'); |
| 3437 | 3421 | money_base::pattern __pat; |
| 3438 | 3422 | char_type __dp; |
| ... | ... | @@ -3463,7 +3447,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, |
| 3463 | 3447 | this->__format(__mb, __mi, __me, __iob.flags(), |
| 3464 | 3448 | __digits.data(), __digits.data() + __digits.size(), __ct, |
| 3465 | 3449 | __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd); |
| 3466 | return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl); | |
| 3450 | return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl); | |
| 3467 | 3451 | } |
| 3468 | 3452 | |
| 3469 | 3453 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>; |
| ... | ... | @@ -3516,8 +3500,7 @@ public: |
| 3516 | 3500 | static locale::id id; |
| 3517 | 3501 | |
| 3518 | 3502 | protected: |
| 3519 | _LIBCPP_INLINE_VISIBILITY | |
| 3520 | ~messages() {} | |
| 3503 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages() override {} | |
| 3521 | 3504 | |
| 3522 | 3505 | virtual catalog do_open(const basic_string<char>&, const locale&) const; |
| 3523 | 3506 | virtual string_type do_get(catalog, int __set, int __msgid, |
| ... | ... | @@ -3551,7 +3534,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid, |
| 3551 | 3534 | { |
| 3552 | 3535 | #ifdef _LIBCPP_HAS_CATOPEN |
| 3553 | 3536 | string __ndflt; |
| 3554 | __narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt), | |
| 3537 | __narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(std::back_inserter(__ndflt), | |
| 3555 | 3538 | __dflt.c_str(), |
| 3556 | 3539 | __dflt.c_str() + __dflt.size()); |
| 3557 | 3540 | if (__c != -1) |
| ... | ... | @@ -3559,7 +3542,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid, |
| 3559 | 3542 | nl_catd __cat = (nl_catd)__c; |
| 3560 | 3543 | char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str()); |
| 3561 | 3544 | string_type __w; |
| 3562 | __widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w), | |
| 3545 | __widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(std::back_inserter(__w), | |
| 3563 | 3546 | __n, __n + _VSTD::strlen(__n)); |
| 3564 | 3547 | return __w; |
| 3565 | 3548 | #else // !_LIBCPP_HAS_CATOPEN |
| ... | ... | @@ -3606,8 +3589,7 @@ public: |
| 3606 | 3589 | : messages<_CharT>(__refs) {} |
| 3607 | 3590 | |
| 3608 | 3591 | protected: |
| 3609 | _LIBCPP_INLINE_VISIBILITY | |
| 3610 | ~messages_byname() {} | |
| 3592 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages_byname() override {} | |
| 3611 | 3593 | }; |
| 3612 | 3594 | |
| 3613 | 3595 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>; |
| ... | ... | @@ -4007,7 +3989,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 4007 | 3989 | char_type __1buf; |
| 4008 | 3990 | if (this->gptr() == 0) |
| 4009 | 3991 | this->setg(&__1buf, &__1buf+1, &__1buf+1); |
| 4010 | const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4); | |
| 3992 | const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4); | |
| 4011 | 3993 | int_type __c = traits_type::eof(); |
| 4012 | 3994 | if (this->gptr() == this->egptr()) |
| 4013 | 3995 | { |
| ... | ... | @@ -4026,9 +4008,11 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 4026 | 4008 | } |
| 4027 | 4009 | else |
| 4028 | 4010 | { |
| 4029 | _LIBCPP_ASSERT(!(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" ); | |
| 4030 | if (__extbufend_ != __extbufnext_) | |
| 4011 | if (__extbufend_ != __extbufnext_) { | |
| 4012 | _LIBCPP_ASSERT(__extbufnext_ != nullptr, "underflow moving from nullptr"); | |
| 4013 | _LIBCPP_ASSERT(__extbuf_ != nullptr, "underflow moving into nullptr"); | |
| 4031 | 4014 | _VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); |
| 4015 | } | |
| 4032 | 4016 | __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); |
| 4033 | 4017 | __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); |
| 4034 | 4018 | streamsize __nmemb = _VSTD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz), |
| ... | ... | @@ -4276,7 +4260,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 4276 | 4260 | { |
| 4277 | 4261 | if (this->gptr() != this->egptr()) |
| 4278 | 4262 | { |
| 4279 | reverse(this->gptr(), this->egptr()); | |
| 4263 | std::reverse(this->gptr(), this->egptr()); | |
| 4280 | 4264 | codecvt_base::result __r; |
| 4281 | 4265 | const char_type* __e = this->gptr(); |
| 4282 | 4266 | char* __extbe; |
| ... | ... | @@ -4369,4 +4353,16 @@ _LIBCPP_END_NAMESPACE_STD |
| 4369 | 4353 | |
| 4370 | 4354 | _LIBCPP_POP_MACROS |
| 4371 | 4355 | |
| 4356 | // NOLINTEND(libcpp-robust-against-adl) | |
| 4357 | ||
| 4358 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 4359 | # include <atomic> | |
| 4360 | # include <concepts> | |
| 4361 | # include <cstdarg> | |
| 4362 | # include <iterator> | |
| 4363 | # include <stdexcept> | |
| 4364 | # include <type_traits> | |
| 4365 | # include <typeinfo> | |
| 4366 | #endif | |
| 4367 | ||
| 4372 | 4368 | #endif // _LIBCPP_LOCALE |
lib/libcxx/include/locale.h+3-1| ... | ... | @@ -43,6 +43,8 @@ Functions: |
| 43 | 43 | # pragma GCC system_header |
| 44 | 44 | #endif |
| 45 | 45 | |
| 46 | #include_next <locale.h> | |
| 46 | #if __has_include_next(<locale.h>) | |
| 47 | # include_next <locale.h> | |
| 48 | #endif | |
| 47 | 49 | |
| 48 | 50 | #endif // _LIBCPP_LOCALE_H |
lib/libcxx/include/map+52-29| ... | ... | @@ -538,20 +538,18 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20 |
| 538 | 538 | #include <__iterator/erase_if_container.h> |
| 539 | 539 | #include <__iterator/iterator_traits.h> |
| 540 | 540 | #include <__iterator/reverse_iterator.h> |
| 541 | #include <__memory/allocator.h> | |
| 542 | #include <__memory_resource/polymorphic_allocator.h> | |
| 541 | 543 | #include <__node_handle> |
| 542 | 544 | #include <__tree> |
| 545 | #include <__type_traits/is_allocator.h> | |
| 543 | 546 | #include <__utility/forward.h> |
| 547 | #include <__utility/piecewise_construct.h> | |
| 544 | 548 | #include <__utility/swap.h> |
| 545 | #include <memory> | |
| 549 | #include <tuple> | |
| 546 | 550 | #include <type_traits> |
| 547 | 551 | #include <version> |
| 548 | 552 | |
| 549 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 550 | # include <functional> | |
| 551 | # include <iterator> | |
| 552 | # include <utility> | |
| 553 | #endif | |
| 554 | ||
| 555 | 553 | // standard-mandated includes |
| 556 | 554 | |
| 557 | 555 | // [iterator.range] |
| ... | ... | @@ -619,46 +617,46 @@ public: |
| 619 | 617 | template <class _Key, class _CP, class _Compare> |
| 620 | 618 | class __map_value_compare<_Key, _CP, _Compare, false> |
| 621 | 619 | { |
| 622 | _Compare comp; | |
| 620 | _Compare __comp_; | |
| 623 | 621 | |
| 624 | 622 | public: |
| 625 | 623 | _LIBCPP_INLINE_VISIBILITY |
| 626 | 624 | __map_value_compare() |
| 627 | 625 | _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value) |
| 628 | : comp() {} | |
| 626 | : __comp_() {} | |
| 629 | 627 | _LIBCPP_INLINE_VISIBILITY |
| 630 | 628 | __map_value_compare(_Compare __c) |
| 631 | 629 | _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value) |
| 632 | : comp(__c) {} | |
| 630 | : __comp_(__c) {} | |
| 633 | 631 | _LIBCPP_INLINE_VISIBILITY |
| 634 | const _Compare& key_comp() const _NOEXCEPT {return comp;} | |
| 632 | const _Compare& key_comp() const _NOEXCEPT {return __comp_;} | |
| 635 | 633 | |
| 636 | 634 | _LIBCPP_INLINE_VISIBILITY |
| 637 | 635 | bool operator()(const _CP& __x, const _CP& __y) const |
| 638 | {return comp(__x.__get_value().first, __y.__get_value().first);} | |
| 636 | {return __comp_(__x.__get_value().first, __y.__get_value().first);} | |
| 639 | 637 | _LIBCPP_INLINE_VISIBILITY |
| 640 | 638 | bool operator()(const _CP& __x, const _Key& __y) const |
| 641 | {return comp(__x.__get_value().first, __y);} | |
| 639 | {return __comp_(__x.__get_value().first, __y);} | |
| 642 | 640 | _LIBCPP_INLINE_VISIBILITY |
| 643 | 641 | bool operator()(const _Key& __x, const _CP& __y) const |
| 644 | {return comp(__x, __y.__get_value().first);} | |
| 642 | {return __comp_(__x, __y.__get_value().first);} | |
| 645 | 643 | void swap(__map_value_compare& __y) |
| 646 | 644 | _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value) |
| 647 | 645 | { |
| 648 | 646 | using _VSTD::swap; |
| 649 | swap(comp, __y.comp); | |
| 647 | swap(__comp_, __y.__comp_); | |
| 650 | 648 | } |
| 651 | 649 | |
| 652 | 650 | #if _LIBCPP_STD_VER > 11 |
| 653 | 651 | template <typename _K2> |
| 654 | 652 | _LIBCPP_INLINE_VISIBILITY |
| 655 | 653 | bool operator()(const _K2& __x, const _CP& __y) const |
| 656 | {return comp(__x, __y.__get_value().first);} | |
| 654 | {return __comp_(__x, __y.__get_value().first);} | |
| 657 | 655 | |
| 658 | 656 | template <typename _K2> |
| 659 | 657 | _LIBCPP_INLINE_VISIBILITY |
| 660 | 658 | bool operator()(const _CP& __x, const _K2& __y) const |
| 661 | {return comp(__x.__get_value().first, __y);} | |
| 659 | {return __comp_(__x.__get_value().first, __y);} | |
| 662 | 660 | #endif |
| 663 | 661 | }; |
| 664 | 662 | |
| ... | ... | @@ -738,16 +736,16 @@ struct _LIBCPP_STANDALONE_DEBUG __value_type |
| 738 | 736 | typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type; |
| 739 | 737 | |
| 740 | 738 | private: |
| 741 | value_type __cc; | |
| 739 | value_type __cc_; | |
| 742 | 740 | |
| 743 | 741 | public: |
| 744 | 742 | _LIBCPP_INLINE_VISIBILITY |
| 745 | 743 | value_type& __get_value() |
| 746 | 744 | { |
| 747 | 745 | #if _LIBCPP_STD_VER > 14 |
| 748 | return *_VSTD::launder(_VSTD::addressof(__cc)); | |
| 746 | return *_VSTD::launder(_VSTD::addressof(__cc_)); | |
| 749 | 747 | #else |
| 750 | return __cc; | |
| 748 | return __cc_; | |
| 751 | 749 | #endif |
| 752 | 750 | } |
| 753 | 751 | |
| ... | ... | @@ -755,9 +753,9 @@ public: |
| 755 | 753 | const value_type& __get_value() const |
| 756 | 754 | { |
| 757 | 755 | #if _LIBCPP_STD_VER > 14 |
| 758 | return *_VSTD::launder(_VSTD::addressof(__cc)); | |
| 756 | return *_VSTD::launder(_VSTD::addressof(__cc_)); | |
| 759 | 757 | #else |
| 760 | return __cc; | |
| 758 | return __cc_; | |
| 761 | 759 | #endif |
| 762 | 760 | } |
| 763 | 761 | |
| ... | ... | @@ -818,13 +816,13 @@ struct __value_type |
| 818 | 816 | typedef pair<const key_type, mapped_type> value_type; |
| 819 | 817 | |
| 820 | 818 | private: |
| 821 | value_type __cc; | |
| 819 | value_type __cc_; | |
| 822 | 820 | |
| 823 | 821 | public: |
| 824 | 822 | _LIBCPP_INLINE_VISIBILITY |
| 825 | value_type& __get_value() { return __cc; } | |
| 823 | value_type& __get_value() { return __cc_; } | |
| 826 | 824 | _LIBCPP_INLINE_VISIBILITY |
| 827 | const value_type& __get_value() const { return __cc; } | |
| 825 | const value_type& __get_value() const { return __cc_; } | |
| 828 | 826 | |
| 829 | 827 | private: |
| 830 | 828 | __value_type(); |
| ... | ... | @@ -1001,12 +999,15 @@ private: |
| 1001 | 999 | |
| 1002 | 1000 | typedef _VSTD::__value_type<key_type, mapped_type> __value_type; |
| 1003 | 1001 | typedef __map_value_compare<key_type, __value_type, key_compare> __vc; |
| 1004 | typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, | |
| 1005 | __value_type>::type __allocator_type; | |
| 1002 | typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type; | |
| 1006 | 1003 | typedef __tree<__value_type, __vc, __allocator_type> __base; |
| 1007 | 1004 | typedef typename __base::__node_traits __node_traits; |
| 1008 | 1005 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 1009 | 1006 | |
| 1007 | static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, | |
| 1008 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 1009 | "original allocator"); | |
| 1010 | ||
| 1010 | 1011 | __base __tree_; |
| 1011 | 1012 | |
| 1012 | 1013 | public: |
| ... | ... | @@ -1778,12 +1779,15 @@ private: |
| 1778 | 1779 | |
| 1779 | 1780 | typedef _VSTD::__value_type<key_type, mapped_type> __value_type; |
| 1780 | 1781 | typedef __map_value_compare<key_type, __value_type, key_compare> __vc; |
| 1781 | typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, | |
| 1782 | __value_type>::type __allocator_type; | |
| 1782 | typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type; | |
| 1783 | 1783 | typedef __tree<__value_type, __vc, __allocator_type> __base; |
| 1784 | 1784 | typedef typename __base::__node_traits __node_traits; |
| 1785 | 1785 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 1786 | 1786 | |
| 1787 | static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, | |
| 1788 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 1789 | "original allocator"); | |
| 1790 | ||
| 1787 | 1791 | __base __tree_; |
| 1788 | 1792 | |
| 1789 | 1793 | public: |
| ... | ... | @@ -2335,4 +2339,23 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 2335 | 2339 | |
| 2336 | 2340 | _LIBCPP_END_NAMESPACE_STD |
| 2337 | 2341 | |
| 2342 | #if _LIBCPP_STD_VER > 14 | |
| 2343 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 2344 | namespace pmr { | |
| 2345 | template <class _KeyT, class _ValueT, class _CompareT = std::less<_KeyT>> | |
| 2346 | using map = std::map<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>; | |
| 2347 | ||
| 2348 | template <class _KeyT, class _ValueT, class _CompareT = std::less<_KeyT>> | |
| 2349 | using multimap = std::multimap<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>; | |
| 2350 | } // namespace pmr | |
| 2351 | _LIBCPP_END_NAMESPACE_STD | |
| 2352 | #endif | |
| 2353 | ||
| 2354 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 2355 | # include <concepts> | |
| 2356 | # include <functional> | |
| 2357 | # include <iterator> | |
| 2358 | # include <utility> | |
| 2359 | #endif | |
| 2360 | ||
| 2338 | 2361 | #endif // _LIBCPP_MAP |
lib/libcxx/include/math.h+747-801| ... | ... | @@ -297,7 +297,9 @@ long double truncl(long double x); |
| 297 | 297 | # pragma GCC system_header |
| 298 | 298 | #endif |
| 299 | 299 | |
| 300 | #include_next <math.h> | |
| 300 | # if __has_include_next(<math.h>) | |
| 301 | # include_next <math.h> | |
| 302 | # endif | |
| 301 | 303 | |
| 302 | 304 | #ifdef __cplusplus |
| 303 | 305 | |
| ... | ... | @@ -305,479 +307,237 @@ long double truncl(long double x); |
| 305 | 307 | // back to C++ linkage before including these C++ headers. |
| 306 | 308 | extern "C++" { |
| 307 | 309 | |
| 310 | #include <__type_traits/enable_if.h> | |
| 311 | #include <__type_traits/is_floating_point.h> | |
| 312 | #include <__type_traits/is_integral.h> | |
| 313 | #include <__type_traits/is_same.h> | |
| 308 | 314 | #include <__type_traits/promote.h> |
| 309 | 315 | #include <limits> |
| 310 | 316 | #include <stdlib.h> |
| 311 | #include <type_traits> | |
| 312 | 317 | |
| 313 | // signbit | |
| 314 | 318 | |
| 315 | #ifdef signbit | |
| 319 | # ifdef fpclassify | |
| 320 | # undef fpclassify | |
| 321 | # endif | |
| 316 | 322 | |
| 317 | template <class _A1> | |
| 318 | _LIBCPP_INLINE_VISIBILITY | |
| 319 | bool | |
| 320 | __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT | |
| 321 | { | |
| 322 | #if __has_builtin(__builtin_signbit) | |
| 323 | return __builtin_signbit(__lcpp_x); | |
| 324 | #else | |
| 325 | return signbit(__lcpp_x); | |
| 326 | #endif | |
| 327 | } | |
| 323 | # ifdef signbit | |
| 324 | # undef signbit | |
| 325 | # endif | |
| 328 | 326 | |
| 329 | #undef signbit | |
| 327 | # ifdef isfinite | |
| 328 | # undef isfinite | |
| 329 | # endif | |
| 330 | 330 | |
| 331 | template <class _A1> | |
| 332 | inline _LIBCPP_INLINE_VISIBILITY | |
| 333 | typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type | |
| 334 | signbit(_A1 __lcpp_x) _NOEXCEPT | |
| 335 | { | |
| 336 | return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); | |
| 337 | } | |
| 331 | # ifdef isinf | |
| 332 | # undef isinf | |
| 333 | # endif | |
| 338 | 334 | |
| 339 | template <class _A1> | |
| 340 | inline _LIBCPP_INLINE_VISIBILITY | |
| 341 | typename std::enable_if< | |
| 342 | std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type | |
| 343 | signbit(_A1 __lcpp_x) _NOEXCEPT | |
| 344 | { return __lcpp_x < 0; } | |
| 335 | # ifdef isnan | |
| 336 | # undef isnan | |
| 337 | # endif | |
| 345 | 338 | |
| 346 | template <class _A1> | |
| 347 | inline _LIBCPP_INLINE_VISIBILITY | |
| 348 | typename std::enable_if< | |
| 349 | std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type | |
| 350 | signbit(_A1) _NOEXCEPT | |
| 351 | { return false; } | |
| 352 | ||
| 353 | #elif defined(_LIBCPP_MSVCRT) | |
| 354 | ||
| 355 | template <typename _A1> | |
| 356 | inline _LIBCPP_INLINE_VISIBILITY | |
| 357 | typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type | |
| 358 | signbit(_A1 __lcpp_x) _NOEXCEPT | |
| 359 | { | |
| 360 | return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x)); | |
| 361 | } | |
| 339 | # ifdef isnormal | |
| 340 | # undef isnormal | |
| 341 | # endif | |
| 362 | 342 | |
| 363 | template <class _A1> | |
| 364 | inline _LIBCPP_INLINE_VISIBILITY | |
| 365 | typename std::enable_if< | |
| 366 | std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type | |
| 367 | signbit(_A1 __lcpp_x) _NOEXCEPT | |
| 368 | { return __lcpp_x < 0; } | |
| 343 | # ifdef isgreater | |
| 344 | # undef isgreater | |
| 345 | # endif | |
| 369 | 346 | |
| 370 | template <class _A1> | |
| 371 | inline _LIBCPP_INLINE_VISIBILITY | |
| 372 | typename std::enable_if< | |
| 373 | std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type | |
| 374 | signbit(_A1) _NOEXCEPT | |
| 375 | { return false; } | |
| 347 | # ifdef isgreaterequal | |
| 348 | # undef isgreaterequal | |
| 349 | # endif | |
| 350 | ||
| 351 | # ifdef isless | |
| 352 | # undef isless | |
| 353 | # endif | |
| 376 | 354 | |
| 377 | #endif // signbit | |
| 355 | # ifdef islessequal | |
| 356 | # undef islessequal | |
| 357 | # endif | |
| 378 | 358 | |
| 379 | // fpclassify | |
| 359 | # ifdef islessgreater | |
| 360 | # undef islessgreater | |
| 361 | # endif | |
| 380 | 362 | |
| 381 | #ifdef fpclassify | |
| 363 | # ifdef isunordered | |
| 364 | # undef isunordered | |
| 365 | # endif | |
| 382 | 366 | |
| 383 | template <class _A1> | |
| 384 | _LIBCPP_INLINE_VISIBILITY | |
| 385 | int | |
| 386 | __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT | |
| 387 | { | |
| 388 | #if __has_builtin(__builtin_fpclassify) | |
| 389 | return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, | |
| 390 | FP_ZERO, __lcpp_x); | |
| 391 | #else | |
| 392 | return fpclassify(__lcpp_x); | |
| 393 | #endif | |
| 394 | } | |
| 367 | // signbit | |
| 395 | 368 | |
| 396 | #undef fpclassify | |
| 369 | template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> | |
| 370 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { | |
| 371 | return __builtin_signbit(__x); | |
| 372 | } | |
| 397 | 373 | |
| 398 | template <class _A1> | |
| 399 | inline _LIBCPP_INLINE_VISIBILITY | |
| 400 | typename std::enable_if<std::is_floating_point<_A1>::value, int>::type | |
| 401 | fpclassify(_A1 __lcpp_x) _NOEXCEPT | |
| 402 | { | |
| 403 | return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); | |
| 374 | template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value && std::is_signed<_A1>::value, int> = 0> | |
| 375 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { | |
| 376 | return __x < 0; | |
| 404 | 377 | } |
| 405 | 378 | |
| 406 | template <class _A1> | |
| 407 | inline _LIBCPP_INLINE_VISIBILITY | |
| 408 | typename std::enable_if<std::is_integral<_A1>::value, int>::type | |
| 409 | fpclassify(_A1 __lcpp_x) _NOEXCEPT | |
| 410 | { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } | |
| 379 | template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value && !std::is_signed<_A1>::value, int> = 0> | |
| 380 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1) _NOEXCEPT { | |
| 381 | return false; | |
| 382 | } | |
| 411 | 383 | |
| 412 | #elif defined(_LIBCPP_MSVCRT) | |
| 384 | // fpclassify | |
| 413 | 385 | |
| 414 | template <typename _A1> | |
| 415 | inline _LIBCPP_INLINE_VISIBILITY | |
| 416 | typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type | |
| 417 | fpclassify(_A1 __lcpp_x) _NOEXCEPT | |
| 418 | { | |
| 419 | return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x)); | |
| 386 | template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> | |
| 387 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { | |
| 388 | return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x); | |
| 420 | 389 | } |
| 421 | 390 | |
| 422 | template <class _A1> | |
| 423 | inline _LIBCPP_INLINE_VISIBILITY | |
| 424 | typename std::enable_if<std::is_integral<_A1>::value, int>::type | |
| 425 | fpclassify(_A1 __lcpp_x) _NOEXCEPT | |
| 426 | { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } | |
| 391 | template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0> | |
| 392 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { | |
| 393 | return __x == 0 ? FP_ZERO : FP_NORMAL; | |
| 394 | } | |
| 427 | 395 | |
| 428 | #endif // fpclassify | |
| 396 | // The MSVC runtime already provides these functions as templates | |
| 397 | #ifndef _LIBCPP_MSVCRT | |
| 429 | 398 | |
| 430 | 399 | // isfinite |
| 431 | 400 | |
| 432 | #ifdef isfinite | |
| 433 | ||
| 434 | template <class _A1> | |
| 435 | _LIBCPP_INLINE_VISIBILITY | |
| 436 | bool | |
| 437 | __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT | |
| 438 | { | |
| 439 | #if __has_builtin(__builtin_isfinite) | |
| 440 | return __builtin_isfinite(__lcpp_x); | |
| 441 | #else | |
| 442 | return isfinite(__lcpp_x); | |
| 443 | #endif | |
| 401 | template <class _A1, | |
| 402 | std::__enable_if_t<std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, int> = 0> | |
| 403 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1 __x) _NOEXCEPT { | |
| 404 | return __builtin_isfinite((typename std::__promote<_A1>::type)__x); | |
| 444 | 405 | } |
| 445 | 406 | |
| 446 | #undef isfinite | |
| 447 | ||
| 448 | template <class _A1> | |
| 449 | inline _LIBCPP_INLINE_VISIBILITY | |
| 450 | typename std::enable_if< | |
| 451 | std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, | |
| 452 | bool>::type | |
| 453 | isfinite(_A1 __lcpp_x) _NOEXCEPT | |
| 454 | { | |
| 455 | return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); | |
| 407 | template <class _A1, | |
| 408 | std::__enable_if_t<std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, int> = 0> | |
| 409 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1) _NOEXCEPT { | |
| 410 | return true; | |
| 456 | 411 | } |
| 457 | 412 | |
| 458 | template <class _A1> | |
| 459 | inline _LIBCPP_INLINE_VISIBILITY | |
| 460 | typename std::enable_if< | |
| 461 | std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, | |
| 462 | bool>::type | |
| 463 | isfinite(_A1) _NOEXCEPT | |
| 464 | { return true; } | |
| 465 | ||
| 466 | #endif // isfinite | |
| 467 | ||
| 468 | 413 | // isinf |
| 469 | 414 | |
| 470 | #ifdef isinf | |
| 415 | template <class _A1, | |
| 416 | std::__enable_if_t<std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, int> = 0> | |
| 417 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(_A1 __x) _NOEXCEPT { | |
| 418 | return __builtin_isinf((typename std::__promote<_A1>::type)__x); | |
| 419 | } | |
| 471 | 420 | |
| 472 | 421 | template <class _A1> |
| 473 | _LIBCPP_INLINE_VISIBILITY | |
| 474 | bool | |
| 475 | __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT | |
| 476 | { | |
| 477 | #if __has_builtin(__builtin_isinf) | |
| 478 | return __builtin_isinf(__lcpp_x); | |
| 479 | #else | |
| 480 | return isinf(__lcpp_x); | |
| 481 | #endif | |
| 422 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI | |
| 423 | typename std::enable_if< std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, bool>::type | |
| 424 | isinf(_A1) _NOEXCEPT { | |
| 425 | return false; | |
| 482 | 426 | } |
| 483 | 427 | |
| 484 | #undef isinf | |
| 485 | ||
| 486 | template <class _A1> | |
| 487 | inline _LIBCPP_INLINE_VISIBILITY | |
| 488 | typename std::enable_if< | |
| 489 | std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, | |
| 490 | bool>::type | |
| 491 | isinf(_A1 __lcpp_x) _NOEXCEPT | |
| 492 | { | |
| 493 | return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); | |
| 428 | # ifdef _LIBCPP_PREFERRED_OVERLOAD | |
| 429 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(float __x) _NOEXCEPT { | |
| 430 | return __builtin_isinf(__x); | |
| 494 | 431 | } |
| 495 | 432 | |
| 496 | template <class _A1> | |
| 497 | inline _LIBCPP_INLINE_VISIBILITY | |
| 498 | typename std::enable_if< | |
| 499 | std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, | |
| 500 | bool>::type | |
| 501 | isinf(_A1) _NOEXCEPT | |
| 502 | { return false; } | |
| 503 | ||
| 504 | #ifdef _LIBCPP_PREFERRED_OVERLOAD | |
| 505 | inline _LIBCPP_INLINE_VISIBILITY | |
| 506 | bool | |
| 507 | isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } | |
| 508 | ||
| 509 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 510 | bool | |
| 511 | isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } | |
| 512 | ||
| 513 | inline _LIBCPP_INLINE_VISIBILITY | |
| 514 | bool | |
| 515 | isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } | |
| 516 | #endif | |
| 433 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isinf(double __x) _NOEXCEPT { | |
| 434 | return __builtin_isinf(__x); | |
| 435 | } | |
| 517 | 436 | |
| 518 | #endif // isinf | |
| 437 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(long double __x) _NOEXCEPT { | |
| 438 | return __builtin_isinf(__x); | |
| 439 | } | |
| 440 | # endif | |
| 519 | 441 | |
| 520 | 442 | // isnan |
| 521 | 443 | |
| 522 | #ifdef isnan | |
| 523 | ||
| 524 | template <class _A1> | |
| 525 | _LIBCPP_INLINE_VISIBILITY | |
| 526 | bool | |
| 527 | __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT | |
| 528 | { | |
| 529 | #if __has_builtin(__builtin_isnan) | |
| 530 | return __builtin_isnan(__lcpp_x); | |
| 531 | #else | |
| 532 | return isnan(__lcpp_x); | |
| 533 | #endif | |
| 444 | template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> | |
| 445 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1 __x) _NOEXCEPT { | |
| 446 | return __builtin_isnan(__x); | |
| 534 | 447 | } |
| 535 | 448 | |
| 536 | #undef isnan | |
| 449 | template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0> | |
| 450 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1) _NOEXCEPT { | |
| 451 | return false; | |
| 452 | } | |
| 537 | 453 | |
| 538 | template <class _A1> | |
| 539 | inline _LIBCPP_INLINE_VISIBILITY | |
| 540 | typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type | |
| 541 | isnan(_A1 __lcpp_x) _NOEXCEPT | |
| 542 | { | |
| 543 | return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); | |
| 454 | # ifdef _LIBCPP_PREFERRED_OVERLOAD | |
| 455 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(float __x) _NOEXCEPT { | |
| 456 | return __builtin_isnan(__x); | |
| 544 | 457 | } |
| 545 | 458 | |
| 546 | template <class _A1> | |
| 547 | inline _LIBCPP_INLINE_VISIBILITY | |
| 548 | typename std::enable_if<std::is_integral<_A1>::value, bool>::type | |
| 549 | isnan(_A1) _NOEXCEPT | |
| 550 | { return false; } | |
| 551 | ||
| 552 | #ifdef _LIBCPP_PREFERRED_OVERLOAD | |
| 553 | inline _LIBCPP_INLINE_VISIBILITY | |
| 554 | bool | |
| 555 | isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } | |
| 556 | ||
| 557 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 558 | bool | |
| 559 | isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } | |
| 560 | ||
| 561 | inline _LIBCPP_INLINE_VISIBILITY | |
| 562 | bool | |
| 563 | isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } | |
| 564 | #endif | |
| 459 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isnan(double __x) _NOEXCEPT { | |
| 460 | return __builtin_isnan(__x); | |
| 461 | } | |
| 565 | 462 | |
| 566 | #endif // isnan | |
| 463 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(long double __x) _NOEXCEPT { | |
| 464 | return __builtin_isnan(__x); | |
| 465 | } | |
| 466 | # endif | |
| 567 | 467 | |
| 568 | 468 | // isnormal |
| 569 | 469 | |
| 570 | #ifdef isnormal | |
| 571 | ||
| 572 | template <class _A1> | |
| 573 | _LIBCPP_INLINE_VISIBILITY | |
| 574 | bool | |
| 575 | __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT | |
| 576 | { | |
| 577 | #if __has_builtin(__builtin_isnormal) | |
| 578 | return __builtin_isnormal(__lcpp_x); | |
| 579 | #else | |
| 580 | return isnormal(__lcpp_x); | |
| 581 | #endif | |
| 470 | template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> | |
| 471 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { | |
| 472 | return __builtin_isnormal(__x); | |
| 582 | 473 | } |
| 583 | 474 | |
| 584 | #undef isnormal | |
| 585 | ||
| 586 | template <class _A1> | |
| 587 | inline _LIBCPP_INLINE_VISIBILITY | |
| 588 | typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type | |
| 589 | isnormal(_A1 __lcpp_x) _NOEXCEPT | |
| 590 | { | |
| 591 | return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); | |
| 475 | template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0> | |
| 476 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { | |
| 477 | return __x != 0; | |
| 592 | 478 | } |
| 593 | 479 | |
| 594 | template <class _A1> | |
| 595 | inline _LIBCPP_INLINE_VISIBILITY | |
| 596 | typename std::enable_if<std::is_integral<_A1>::value, bool>::type | |
| 597 | isnormal(_A1 __lcpp_x) _NOEXCEPT | |
| 598 | { return __lcpp_x != 0; } | |
| 599 | ||
| 600 | #endif // isnormal | |
| 601 | ||
| 602 | 480 | // isgreater |
| 603 | 481 | |
| 604 | #ifdef isgreater | |
| 605 | ||
| 606 | template <class _A1, class _A2> | |
| 607 | _LIBCPP_INLINE_VISIBILITY | |
| 608 | bool | |
| 609 | __libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 610 | { | |
| 611 | return isgreater(__lcpp_x, __lcpp_y); | |
| 482 | template <class _A1, | |
| 483 | class _A2, | |
| 484 | std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> | |
| 485 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 __y) _NOEXCEPT { | |
| 486 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 487 | return __builtin_isgreater((type)__x, (type)__y); | |
| 612 | 488 | } |
| 613 | 489 | |
| 614 | #undef isgreater | |
| 615 | ||
| 616 | template <class _A1, class _A2> | |
| 617 | inline _LIBCPP_INLINE_VISIBILITY | |
| 618 | typename std::enable_if | |
| 619 | < | |
| 620 | std::is_arithmetic<_A1>::value && | |
| 621 | std::is_arithmetic<_A2>::value, | |
| 622 | bool | |
| 623 | >::type | |
| 624 | isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 625 | { | |
| 626 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 627 | return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y); | |
| 628 | } | |
| 629 | ||
| 630 | #endif // isgreater | |
| 631 | ||
| 632 | 490 | // isgreaterequal |
| 633 | 491 | |
| 634 | #ifdef isgreaterequal | |
| 635 | ||
| 636 | template <class _A1, class _A2> | |
| 637 | _LIBCPP_INLINE_VISIBILITY | |
| 638 | bool | |
| 639 | __libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 640 | { | |
| 641 | return isgreaterequal(__lcpp_x, __lcpp_y); | |
| 642 | } | |
| 643 | ||
| 644 | #undef isgreaterequal | |
| 645 | ||
| 646 | template <class _A1, class _A2> | |
| 647 | inline _LIBCPP_INLINE_VISIBILITY | |
| 648 | typename std::enable_if | |
| 649 | < | |
| 650 | std::is_arithmetic<_A1>::value && | |
| 651 | std::is_arithmetic<_A2>::value, | |
| 652 | bool | |
| 653 | >::type | |
| 654 | isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 655 | { | |
| 656 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 657 | return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y); | |
| 492 | template <class _A1, | |
| 493 | class _A2, | |
| 494 | std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> | |
| 495 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT { | |
| 496 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 497 | return __builtin_isgreaterequal((type)__x, (type)__y); | |
| 658 | 498 | } |
| 659 | 499 | |
| 660 | #endif // isgreaterequal | |
| 661 | ||
| 662 | 500 | // isless |
| 663 | 501 | |
| 664 | #ifdef isless | |
| 665 | ||
| 666 | template <class _A1, class _A2> | |
| 667 | _LIBCPP_INLINE_VISIBILITY | |
| 668 | bool | |
| 669 | __libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 670 | { | |
| 671 | return isless(__lcpp_x, __lcpp_y); | |
| 502 | template <class _A1, | |
| 503 | class _A2, | |
| 504 | std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> | |
| 505 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y) _NOEXCEPT { | |
| 506 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 507 | return __builtin_isless((type)__x, (type)__y); | |
| 672 | 508 | } |
| 673 | 509 | |
| 674 | #undef isless | |
| 675 | ||
| 676 | template <class _A1, class _A2> | |
| 677 | inline _LIBCPP_INLINE_VISIBILITY | |
| 678 | typename std::enable_if | |
| 679 | < | |
| 680 | std::is_arithmetic<_A1>::value && | |
| 681 | std::is_arithmetic<_A2>::value, | |
| 682 | bool | |
| 683 | >::type | |
| 684 | isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 685 | { | |
| 686 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 687 | return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y); | |
| 688 | } | |
| 689 | ||
| 690 | #endif // isless | |
| 691 | ||
| 692 | 510 | // islessequal |
| 693 | 511 | |
| 694 | #ifdef islessequal | |
| 695 | ||
| 696 | template <class _A1, class _A2> | |
| 697 | _LIBCPP_INLINE_VISIBILITY | |
| 698 | bool | |
| 699 | __libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 700 | { | |
| 701 | return islessequal(__lcpp_x, __lcpp_y); | |
| 512 | template <class _A1, | |
| 513 | class _A2, | |
| 514 | std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> | |
| 515 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2 __y) _NOEXCEPT { | |
| 516 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 517 | return __builtin_islessequal((type)__x, (type)__y); | |
| 702 | 518 | } |
| 703 | 519 | |
| 704 | #undef islessequal | |
| 705 | ||
| 706 | template <class _A1, class _A2> | |
| 707 | inline _LIBCPP_INLINE_VISIBILITY | |
| 708 | typename std::enable_if | |
| 709 | < | |
| 710 | std::is_arithmetic<_A1>::value && | |
| 711 | std::is_arithmetic<_A2>::value, | |
| 712 | bool | |
| 713 | >::type | |
| 714 | islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 715 | { | |
| 716 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 717 | return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y); | |
| 718 | } | |
| 719 | ||
| 720 | #endif // islessequal | |
| 721 | ||
| 722 | 520 | // islessgreater |
| 723 | 521 | |
| 724 | #ifdef islessgreater | |
| 725 | ||
| 726 | template <class _A1, class _A2> | |
| 727 | _LIBCPP_INLINE_VISIBILITY | |
| 728 | bool | |
| 729 | __libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 730 | { | |
| 731 | return islessgreater(__lcpp_x, __lcpp_y); | |
| 732 | } | |
| 733 | ||
| 734 | #undef islessgreater | |
| 735 | ||
| 736 | template <class _A1, class _A2> | |
| 737 | inline _LIBCPP_INLINE_VISIBILITY | |
| 738 | typename std::enable_if | |
| 739 | < | |
| 740 | std::is_arithmetic<_A1>::value && | |
| 741 | std::is_arithmetic<_A2>::value, | |
| 742 | bool | |
| 743 | >::type | |
| 744 | islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 745 | { | |
| 746 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 747 | return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y); | |
| 522 | template <class _A1, | |
| 523 | class _A2, | |
| 524 | std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> | |
| 525 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _A2 __y) _NOEXCEPT { | |
| 526 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 527 | return __builtin_islessgreater((type)__x, (type)__y); | |
| 748 | 528 | } |
| 749 | 529 | |
| 750 | #endif // islessgreater | |
| 751 | ||
| 752 | 530 | // isunordered |
| 753 | 531 | |
| 754 | #ifdef isunordered | |
| 755 | ||
| 756 | template <class _A1, class _A2> | |
| 757 | _LIBCPP_INLINE_VISIBILITY | |
| 758 | bool | |
| 759 | __libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 760 | { | |
| 761 | return isunordered(__lcpp_x, __lcpp_y); | |
| 762 | } | |
| 763 | ||
| 764 | #undef isunordered | |
| 765 | ||
| 766 | template <class _A1, class _A2> | |
| 767 | inline _LIBCPP_INLINE_VISIBILITY | |
| 768 | typename std::enable_if | |
| 769 | < | |
| 770 | std::is_arithmetic<_A1>::value && | |
| 771 | std::is_arithmetic<_A2>::value, | |
| 772 | bool | |
| 773 | >::type | |
| 774 | isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 775 | { | |
| 776 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 777 | return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y); | |
| 532 | template <class _A1, | |
| 533 | class _A2, | |
| 534 | std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> | |
| 535 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isunordered(_A1 __x, _A2 __y) _NOEXCEPT { | |
| 536 | typedef typename std::__promote<_A1, _A2>::type type; | |
| 537 | return __builtin_isunordered((type)__x, (type)__y); | |
| 778 | 538 | } |
| 779 | 539 | |
| 780 | #endif // isunordered | |
| 540 | #endif // _LIBCPP_MSVCRT | |
| 781 | 541 | |
| 782 | 542 | // abs |
| 783 | 543 | // |
| ... | ... | @@ -787,497 +547,633 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
| 787 | 547 | // |
| 788 | 548 | // handled in stdlib.h |
| 789 | 549 | |
| 550 | // We have to provide double overloads for <math.h> to work on platforms that don't provide the full set of math | |
| 551 | // functions. To make the overload set work with multiple functions that take the same arguments, we make our overloads | |
| 552 | // templates. Functions are preferred over function templates during overload resolution, which means that our overload | |
| 553 | // will only be selected when the C library doesn't provide one. | |
| 554 | ||
| 790 | 555 | // acos |
| 791 | 556 | |
| 792 | 557 | # if !defined(__sun__) |
| 793 | inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);} | |
| 794 | inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);} | |
| 558 | inline _LIBCPP_HIDE_FROM_ABI float acos(float __x) _NOEXCEPT {return __builtin_acosf(__x);} | |
| 559 | ||
| 560 | template <class = int> | |
| 561 | _LIBCPP_HIDE_FROM_ABI double acos(double __x) _NOEXCEPT { | |
| 562 | return __builtin_acos(__x); | |
| 563 | } | |
| 564 | ||
| 565 | inline _LIBCPP_HIDE_FROM_ABI long double acos(long double __x) _NOEXCEPT {return __builtin_acosl(__x);} | |
| 795 | 566 | # endif |
| 796 | 567 | |
| 797 | 568 | template <class _A1> |
| 798 | inline _LIBCPP_INLINE_VISIBILITY | |
| 569 | inline _LIBCPP_HIDE_FROM_ABI | |
| 799 | 570 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 800 | acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);} | |
| 571 | acos(_A1 __x) _NOEXCEPT {return __builtin_acos((double)__x);} | |
| 801 | 572 | |
| 802 | 573 | // asin |
| 803 | 574 | |
| 804 | 575 | # if !defined(__sun__) |
| 805 | inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);} | |
| 806 | inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);} | |
| 576 | inline _LIBCPP_HIDE_FROM_ABI float asin(float __x) _NOEXCEPT {return __builtin_asinf(__x);} | |
| 577 | ||
| 578 | template <class = int> | |
| 579 | _LIBCPP_HIDE_FROM_ABI double asin(double __x) _NOEXCEPT { | |
| 580 | return __builtin_asin(__x); | |
| 581 | } | |
| 582 | ||
| 583 | inline _LIBCPP_HIDE_FROM_ABI long double asin(long double __x) _NOEXCEPT {return __builtin_asinl(__x);} | |
| 807 | 584 | # endif |
| 808 | 585 | |
| 809 | 586 | template <class _A1> |
| 810 | inline _LIBCPP_INLINE_VISIBILITY | |
| 587 | inline _LIBCPP_HIDE_FROM_ABI | |
| 811 | 588 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 812 | asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);} | |
| 589 | asin(_A1 __x) _NOEXCEPT {return __builtin_asin((double)__x);} | |
| 813 | 590 | |
| 814 | 591 | // atan |
| 815 | 592 | |
| 816 | 593 | # if !defined(__sun__) |
| 817 | inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);} | |
| 818 | inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);} | |
| 594 | inline _LIBCPP_HIDE_FROM_ABI float atan(float __x) _NOEXCEPT {return __builtin_atanf(__x);} | |
| 595 | ||
| 596 | template <class = int> | |
| 597 | _LIBCPP_HIDE_FROM_ABI double atan(double __x) _NOEXCEPT { | |
| 598 | return __builtin_atan(__x); | |
| 599 | } | |
| 600 | ||
| 601 | inline _LIBCPP_HIDE_FROM_ABI long double atan(long double __x) _NOEXCEPT {return __builtin_atanl(__x);} | |
| 819 | 602 | # endif |
| 820 | 603 | |
| 821 | 604 | template <class _A1> |
| 822 | inline _LIBCPP_INLINE_VISIBILITY | |
| 605 | inline _LIBCPP_HIDE_FROM_ABI | |
| 823 | 606 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 824 | atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);} | |
| 607 | atan(_A1 __x) _NOEXCEPT {return __builtin_atan((double)__x);} | |
| 825 | 608 | |
| 826 | 609 | // atan2 |
| 827 | 610 | |
| 828 | 611 | # if !defined(__sun__) |
| 829 | inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);} | |
| 830 | inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);} | |
| 612 | inline _LIBCPP_HIDE_FROM_ABI float atan2(float __y, float __x) _NOEXCEPT {return __builtin_atan2f(__y, __x);} | |
| 613 | ||
| 614 | template <class = int> | |
| 615 | _LIBCPP_HIDE_FROM_ABI double atan2(double __x, double __y) _NOEXCEPT { | |
| 616 | return __builtin_atan2(__x, __y); | |
| 617 | } | |
| 618 | ||
| 619 | inline _LIBCPP_HIDE_FROM_ABI long double atan2(long double __y, long double __x) _NOEXCEPT {return __builtin_atan2l(__y, __x);} | |
| 831 | 620 | # endif |
| 832 | 621 | |
| 833 | 622 | template <class _A1, class _A2> |
| 834 | inline _LIBCPP_INLINE_VISIBILITY | |
| 623 | inline _LIBCPP_HIDE_FROM_ABI | |
| 835 | 624 | typename std::__enable_if_t |
| 836 | 625 | < |
| 837 | 626 | std::is_arithmetic<_A1>::value && |
| 838 | 627 | std::is_arithmetic<_A2>::value, |
| 839 | 628 | std::__promote<_A1, _A2> |
| 840 | 629 | >::type |
| 841 | atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT | |
| 630 | atan2(_A1 __y, _A2 __x) _NOEXCEPT | |
| 842 | 631 | { |
| 843 | 632 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
| 844 | 633 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
| 845 | 634 | std::_IsSame<_A2, __result_type>::value)), ""); |
| 846 | return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x); | |
| 635 | return ::atan2((__result_type)__y, (__result_type)__x); | |
| 847 | 636 | } |
| 848 | 637 | |
| 849 | 638 | // ceil |
| 850 | 639 | |
| 851 | 640 | # if !defined(__sun__) |
| 852 | inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);} | |
| 853 | inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);} | |
| 641 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float ceil(float __x) _NOEXCEPT {return __builtin_ceilf(__x);} | |
| 642 | ||
| 643 | template <class = int> | |
| 644 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double ceil(double __x) _NOEXCEPT { | |
| 645 | return __builtin_ceil(__x); | |
| 646 | } | |
| 647 | ||
| 648 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double ceil(long double __x) _NOEXCEPT {return __builtin_ceill(__x);} | |
| 854 | 649 | # endif |
| 855 | 650 | |
| 856 | 651 | template <class _A1> |
| 857 | inline _LIBCPP_INLINE_VISIBILITY | |
| 652 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI | |
| 858 | 653 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 859 | ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);} | |
| 654 | ceil(_A1 __x) _NOEXCEPT {return __builtin_ceil((double)__x);} | |
| 860 | 655 | |
| 861 | 656 | // cos |
| 862 | 657 | |
| 863 | 658 | # if !defined(__sun__) |
| 864 | inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);} | |
| 865 | inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);} | |
| 659 | inline _LIBCPP_HIDE_FROM_ABI float cos(float __x) _NOEXCEPT {return __builtin_cosf(__x);} | |
| 660 | ||
| 661 | template <class = int> | |
| 662 | _LIBCPP_HIDE_FROM_ABI double cos(double __x) _NOEXCEPT { | |
| 663 | return __builtin_cos(__x); | |
| 664 | } | |
| 665 | ||
| 666 | inline _LIBCPP_HIDE_FROM_ABI long double cos(long double __x) _NOEXCEPT {return __builtin_cosl(__x);} | |
| 866 | 667 | # endif |
| 867 | 668 | |
| 868 | 669 | template <class _A1> |
| 869 | inline _LIBCPP_INLINE_VISIBILITY | |
| 670 | inline _LIBCPP_HIDE_FROM_ABI | |
| 870 | 671 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 871 | cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);} | |
| 672 | cos(_A1 __x) _NOEXCEPT {return __builtin_cos((double)__x);} | |
| 872 | 673 | |
| 873 | 674 | // cosh |
| 874 | 675 | |
| 875 | 676 | # if !defined(__sun__) |
| 876 | inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);} | |
| 877 | inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);} | |
| 677 | inline _LIBCPP_HIDE_FROM_ABI float cosh(float __x) _NOEXCEPT {return __builtin_coshf(__x);} | |
| 678 | ||
| 679 | template <class = int> | |
| 680 | _LIBCPP_HIDE_FROM_ABI double cosh(double __x) _NOEXCEPT { | |
| 681 | return __builtin_cosh(__x); | |
| 682 | } | |
| 683 | ||
| 684 | inline _LIBCPP_HIDE_FROM_ABI long double cosh(long double __x) _NOEXCEPT {return __builtin_coshl(__x);} | |
| 878 | 685 | # endif |
| 879 | 686 | |
| 880 | 687 | template <class _A1> |
| 881 | inline _LIBCPP_INLINE_VISIBILITY | |
| 688 | inline _LIBCPP_HIDE_FROM_ABI | |
| 882 | 689 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 883 | cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);} | |
| 690 | cosh(_A1 __x) _NOEXCEPT {return __builtin_cosh((double)__x);} | |
| 884 | 691 | |
| 885 | 692 | // exp |
| 886 | 693 | |
| 887 | 694 | # if !defined(__sun__) |
| 888 | inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);} | |
| 889 | inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);} | |
| 695 | inline _LIBCPP_HIDE_FROM_ABI float exp(float __x) _NOEXCEPT {return __builtin_expf(__x);} | |
| 696 | ||
| 697 | template <class = int> | |
| 698 | _LIBCPP_HIDE_FROM_ABI double exp(double __x) _NOEXCEPT { | |
| 699 | return __builtin_exp(__x); | |
| 700 | } | |
| 701 | ||
| 702 | inline _LIBCPP_HIDE_FROM_ABI long double exp(long double __x) _NOEXCEPT {return __builtin_expl(__x);} | |
| 890 | 703 | # endif |
| 891 | 704 | |
| 892 | 705 | template <class _A1> |
| 893 | inline _LIBCPP_INLINE_VISIBILITY | |
| 706 | inline _LIBCPP_HIDE_FROM_ABI | |
| 894 | 707 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 895 | exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);} | |
| 708 | exp(_A1 __x) _NOEXCEPT {return __builtin_exp((double)__x);} | |
| 896 | 709 | |
| 897 | 710 | // fabs |
| 898 | 711 | |
| 899 | 712 | # if !defined(__sun__) |
| 900 | inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);} | |
| 901 | inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);} | |
| 713 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float fabs(float __x) _NOEXCEPT {return __builtin_fabsf(__x);} | |
| 714 | ||
| 715 | template <class = int> | |
| 716 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double fabs(double __x) _NOEXCEPT { | |
| 717 | return __builtin_fabs(__x); | |
| 718 | } | |
| 719 | ||
| 720 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fabs(long double __x) _NOEXCEPT {return __builtin_fabsl(__x);} | |
| 902 | 721 | # endif |
| 903 | 722 | |
| 904 | 723 | template <class _A1> |
| 905 | inline _LIBCPP_INLINE_VISIBILITY | |
| 724 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI | |
| 906 | 725 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 907 | fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);} | |
| 726 | fabs(_A1 __x) _NOEXCEPT {return __builtin_fabs((double)__x);} | |
| 908 | 727 | |
| 909 | 728 | // floor |
| 910 | 729 | |
| 911 | 730 | # if !defined(__sun__) |
| 912 | inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);} | |
| 913 | inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);} | |
| 731 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float floor(float __x) _NOEXCEPT {return __builtin_floorf(__x);} | |
| 732 | ||
| 733 | template <class = int> | |
| 734 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double floor(double __x) _NOEXCEPT { | |
| 735 | return __builtin_floor(__x); | |
| 736 | } | |
| 737 | ||
| 738 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double floor(long double __x) _NOEXCEPT {return __builtin_floorl(__x);} | |
| 914 | 739 | # endif |
| 915 | 740 | |
| 916 | 741 | template <class _A1> |
| 917 | inline _LIBCPP_INLINE_VISIBILITY | |
| 742 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI | |
| 918 | 743 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 919 | floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);} | |
| 744 | floor(_A1 __x) _NOEXCEPT {return __builtin_floor((double)__x);} | |
| 920 | 745 | |
| 921 | 746 | // fmod |
| 922 | 747 | |
| 923 | 748 | # if !defined(__sun__) |
| 924 | inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);} | |
| 925 | inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);} | |
| 749 | inline _LIBCPP_HIDE_FROM_ABI float fmod(float __x, float __y) _NOEXCEPT {return __builtin_fmodf(__x, __y);} | |
| 750 | ||
| 751 | template <class = int> | |
| 752 | _LIBCPP_HIDE_FROM_ABI double fmod(double __x, double __y) _NOEXCEPT { | |
| 753 | return __builtin_fmod(__x, __y); | |
| 754 | } | |
| 755 | ||
| 756 | inline _LIBCPP_HIDE_FROM_ABI long double fmod(long double __x, long double __y) _NOEXCEPT {return __builtin_fmodl(__x, __y);} | |
| 926 | 757 | # endif |
| 927 | 758 | |
| 928 | 759 | template <class _A1, class _A2> |
| 929 | inline _LIBCPP_INLINE_VISIBILITY | |
| 760 | inline _LIBCPP_HIDE_FROM_ABI | |
| 930 | 761 | typename std::__enable_if_t |
| 931 | 762 | < |
| 932 | 763 | std::is_arithmetic<_A1>::value && |
| 933 | 764 | std::is_arithmetic<_A2>::value, |
| 934 | 765 | std::__promote<_A1, _A2> |
| 935 | 766 | >::type |
| 936 | fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 767 | fmod(_A1 __x, _A2 __y) _NOEXCEPT | |
| 937 | 768 | { |
| 938 | 769 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
| 939 | 770 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
| 940 | 771 | std::_IsSame<_A2, __result_type>::value)), ""); |
| 941 | return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y); | |
| 772 | return ::fmod((__result_type)__x, (__result_type)__y); | |
| 942 | 773 | } |
| 943 | 774 | |
| 944 | 775 | // frexp |
| 945 | 776 | |
| 946 | 777 | # if !defined(__sun__) |
| 947 | inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);} | |
| 948 | inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);} | |
| 778 | inline _LIBCPP_HIDE_FROM_ABI float frexp(float __x, int* __e) _NOEXCEPT {return __builtin_frexpf(__x, __e);} | |
| 779 | ||
| 780 | template <class = int> | |
| 781 | _LIBCPP_HIDE_FROM_ABI double frexp(double __x, int* __e) _NOEXCEPT { | |
| 782 | return __builtin_frexp(__x, __e); | |
| 783 | } | |
| 784 | ||
| 785 | inline _LIBCPP_HIDE_FROM_ABI long double frexp(long double __x, int* __e) _NOEXCEPT {return __builtin_frexpl(__x, __e);} | |
| 949 | 786 | # endif |
| 950 | 787 | |
| 951 | 788 | template <class _A1> |
| 952 | inline _LIBCPP_INLINE_VISIBILITY | |
| 789 | inline _LIBCPP_HIDE_FROM_ABI | |
| 953 | 790 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 954 | frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);} | |
| 791 | frexp(_A1 __x, int* __e) _NOEXCEPT {return __builtin_frexp((double)__x, __e);} | |
| 955 | 792 | |
| 956 | 793 | // ldexp |
| 957 | 794 | |
| 958 | 795 | # if !defined(__sun__) |
| 959 | inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);} | |
| 960 | inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);} | |
| 796 | inline _LIBCPP_HIDE_FROM_ABI float ldexp(float __x, int __e) _NOEXCEPT {return __builtin_ldexpf(__x, __e);} | |
| 797 | ||
| 798 | template <class = int> | |
| 799 | _LIBCPP_HIDE_FROM_ABI double ldexp(double __x, int __e) _NOEXCEPT { | |
| 800 | return __builtin_ldexp(__x, __e); | |
| 801 | } | |
| 802 | ||
| 803 | inline _LIBCPP_HIDE_FROM_ABI long double ldexp(long double __x, int __e) _NOEXCEPT {return __builtin_ldexpl(__x, __e);} | |
| 961 | 804 | # endif |
| 962 | 805 | |
| 963 | 806 | template <class _A1> |
| 964 | inline _LIBCPP_INLINE_VISIBILITY | |
| 807 | inline _LIBCPP_HIDE_FROM_ABI | |
| 965 | 808 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 966 | ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);} | |
| 809 | ldexp(_A1 __x, int __e) _NOEXCEPT {return __builtin_ldexp((double)__x, __e);} | |
| 967 | 810 | |
| 968 | 811 | // log |
| 969 | 812 | |
| 970 | 813 | # if !defined(__sun__) |
| 971 | inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);} | |
| 972 | inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);} | |
| 814 | inline _LIBCPP_HIDE_FROM_ABI float log(float __x) _NOEXCEPT {return __builtin_logf(__x);} | |
| 815 | ||
| 816 | template <class = int> | |
| 817 | _LIBCPP_HIDE_FROM_ABI double log(double __x) _NOEXCEPT { | |
| 818 | return __builtin_log(__x); | |
| 819 | } | |
| 820 | ||
| 821 | inline _LIBCPP_HIDE_FROM_ABI long double log(long double __x) _NOEXCEPT {return __builtin_logl(__x);} | |
| 973 | 822 | # endif |
| 974 | 823 | |
| 975 | 824 | template <class _A1> |
| 976 | inline _LIBCPP_INLINE_VISIBILITY | |
| 825 | inline _LIBCPP_HIDE_FROM_ABI | |
| 977 | 826 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 978 | log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);} | |
| 827 | log(_A1 __x) _NOEXCEPT {return __builtin_log((double)__x);} | |
| 979 | 828 | |
| 980 | 829 | // log10 |
| 981 | 830 | |
| 982 | 831 | # if !defined(__sun__) |
| 983 | inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);} | |
| 984 | inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);} | |
| 832 | inline _LIBCPP_HIDE_FROM_ABI float log10(float __x) _NOEXCEPT {return __builtin_log10f(__x);} | |
| 833 | ||
| 834 | ||
| 835 | template <class = int> | |
| 836 | _LIBCPP_HIDE_FROM_ABI double log10(double __x) _NOEXCEPT { | |
| 837 | return __builtin_log10(__x); | |
| 838 | } | |
| 839 | ||
| 840 | inline _LIBCPP_HIDE_FROM_ABI long double log10(long double __x) _NOEXCEPT {return __builtin_log10l(__x);} | |
| 985 | 841 | # endif |
| 986 | 842 | |
| 987 | 843 | template <class _A1> |
| 988 | inline _LIBCPP_INLINE_VISIBILITY | |
| 844 | inline _LIBCPP_HIDE_FROM_ABI | |
| 989 | 845 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 990 | log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);} | |
| 846 | log10(_A1 __x) _NOEXCEPT {return __builtin_log10((double)__x);} | |
| 991 | 847 | |
| 992 | 848 | // modf |
| 993 | 849 | |
| 994 | 850 | # if !defined(__sun__) |
| 995 | inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);} | |
| 996 | inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);} | |
| 851 | inline _LIBCPP_HIDE_FROM_ABI float modf(float __x, float* __y) _NOEXCEPT {return __builtin_modff(__x, __y);} | |
| 852 | ||
| 853 | template <class = int> | |
| 854 | _LIBCPP_HIDE_FROM_ABI double modf(double __x, double* __y) _NOEXCEPT { | |
| 855 | return __builtin_modf(__x, __y); | |
| 856 | } | |
| 857 | ||
| 858 | inline _LIBCPP_HIDE_FROM_ABI long double modf(long double __x, long double* __y) _NOEXCEPT {return __builtin_modfl(__x, __y);} | |
| 997 | 859 | # endif |
| 998 | 860 | |
| 999 | 861 | // pow |
| 1000 | 862 | |
| 1001 | 863 | # if !defined(__sun__) |
| 1002 | inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);} | |
| 1003 | inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);} | |
| 864 | inline _LIBCPP_HIDE_FROM_ABI float pow(float __x, float __y) _NOEXCEPT {return __builtin_powf(__x, __y);} | |
| 865 | ||
| 866 | template <class = int> | |
| 867 | _LIBCPP_HIDE_FROM_ABI double pow(double __x, double __y) _NOEXCEPT { | |
| 868 | return __builtin_pow(__x, __y); | |
| 869 | } | |
| 870 | ||
| 871 | inline _LIBCPP_HIDE_FROM_ABI long double pow(long double __x, long double __y) _NOEXCEPT {return __builtin_powl(__x, __y);} | |
| 1004 | 872 | # endif |
| 1005 | 873 | |
| 1006 | 874 | template <class _A1, class _A2> |
| 1007 | inline _LIBCPP_INLINE_VISIBILITY | |
| 875 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1008 | 876 | typename std::__enable_if_t |
| 1009 | 877 | < |
| 1010 | 878 | std::is_arithmetic<_A1>::value && |
| 1011 | 879 | std::is_arithmetic<_A2>::value, |
| 1012 | 880 | std::__promote<_A1, _A2> |
| 1013 | 881 | >::type |
| 1014 | pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 882 | pow(_A1 __x, _A2 __y) _NOEXCEPT | |
| 1015 | 883 | { |
| 1016 | 884 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
| 1017 | 885 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
| 1018 | 886 | std::_IsSame<_A2, __result_type>::value)), ""); |
| 1019 | return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y); | |
| 887 | return ::pow((__result_type)__x, (__result_type)__y); | |
| 1020 | 888 | } |
| 1021 | 889 | |
| 1022 | 890 | // sin |
| 1023 | 891 | |
| 1024 | 892 | # if !defined(__sun__) |
| 1025 | inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);} | |
| 1026 | inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);} | |
| 893 | inline _LIBCPP_HIDE_FROM_ABI float sin(float __x) _NOEXCEPT {return __builtin_sinf(__x);} | |
| 894 | ||
| 895 | template <class = int> | |
| 896 | _LIBCPP_HIDE_FROM_ABI double sin(double __x) _NOEXCEPT { | |
| 897 | return __builtin_sin(__x); | |
| 898 | } | |
| 899 | ||
| 900 | inline _LIBCPP_HIDE_FROM_ABI long double sin(long double __x) _NOEXCEPT {return __builtin_sinl(__x);} | |
| 1027 | 901 | #endif |
| 1028 | 902 | |
| 1029 | 903 | template <class _A1> |
| 1030 | inline _LIBCPP_INLINE_VISIBILITY | |
| 904 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1031 | 905 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1032 | sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);} | |
| 906 | sin(_A1 __x) _NOEXCEPT {return __builtin_sin((double)__x);} | |
| 1033 | 907 | |
| 1034 | 908 | // sinh |
| 1035 | 909 | |
| 1036 | 910 | # if !defined(__sun__) |
| 1037 | inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);} | |
| 1038 | inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);} | |
| 911 | inline _LIBCPP_HIDE_FROM_ABI float sinh(float __x) _NOEXCEPT {return __builtin_sinhf(__x);} | |
| 912 | ||
| 913 | template <class = int> | |
| 914 | _LIBCPP_HIDE_FROM_ABI double sinh(double __x) _NOEXCEPT { | |
| 915 | return __builtin_sinh(__x); | |
| 916 | } | |
| 917 | ||
| 918 | inline _LIBCPP_HIDE_FROM_ABI long double sinh(long double __x) _NOEXCEPT {return __builtin_sinhl(__x);} | |
| 1039 | 919 | # endif |
| 1040 | 920 | |
| 1041 | 921 | template <class _A1> |
| 1042 | inline _LIBCPP_INLINE_VISIBILITY | |
| 922 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1043 | 923 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1044 | sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);} | |
| 924 | sinh(_A1 __x) _NOEXCEPT {return __builtin_sinh((double)__x);} | |
| 1045 | 925 | |
| 1046 | 926 | // sqrt |
| 1047 | 927 | |
| 1048 | 928 | # if !defined(__sun__) |
| 1049 | inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);} | |
| 1050 | inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);} | |
| 929 | inline _LIBCPP_HIDE_FROM_ABI float sqrt(float __x) _NOEXCEPT {return __builtin_sqrtf(__x);} | |
| 930 | ||
| 931 | template <class = int> | |
| 932 | _LIBCPP_HIDE_FROM_ABI double sqrt(double __x) _NOEXCEPT { | |
| 933 | return __builtin_sqrt(__x); | |
| 934 | } | |
| 935 | ||
| 936 | inline _LIBCPP_HIDE_FROM_ABI long double sqrt(long double __x) _NOEXCEPT {return __builtin_sqrtl(__x);} | |
| 1051 | 937 | # endif |
| 1052 | 938 | |
| 1053 | 939 | template <class _A1> |
| 1054 | inline _LIBCPP_INLINE_VISIBILITY | |
| 940 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1055 | 941 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1056 | sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);} | |
| 942 | sqrt(_A1 __x) _NOEXCEPT {return __builtin_sqrt((double)__x);} | |
| 1057 | 943 | |
| 1058 | 944 | // tan |
| 1059 | 945 | |
| 1060 | 946 | # if !defined(__sun__) |
| 1061 | inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);} | |
| 1062 | inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);} | |
| 947 | inline _LIBCPP_HIDE_FROM_ABI float tan(float __x) _NOEXCEPT {return __builtin_tanf(__x);} | |
| 948 | ||
| 949 | template <class = int> | |
| 950 | _LIBCPP_HIDE_FROM_ABI double tan(double __x) _NOEXCEPT { | |
| 951 | return __builtin_tan(__x); | |
| 952 | } | |
| 953 | ||
| 954 | inline _LIBCPP_HIDE_FROM_ABI long double tan(long double __x) _NOEXCEPT {return __builtin_tanl(__x);} | |
| 1063 | 955 | # endif |
| 1064 | 956 | |
| 1065 | 957 | template <class _A1> |
| 1066 | inline _LIBCPP_INLINE_VISIBILITY | |
| 958 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1067 | 959 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1068 | tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);} | |
| 960 | tan(_A1 __x) _NOEXCEPT {return __builtin_tan((double)__x);} | |
| 1069 | 961 | |
| 1070 | 962 | // tanh |
| 1071 | 963 | |
| 1072 | 964 | # if !defined(__sun__) |
| 1073 | inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);} | |
| 1074 | inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);} | |
| 965 | inline _LIBCPP_HIDE_FROM_ABI float tanh(float __x) _NOEXCEPT {return __builtin_tanhf(__x);} | |
| 966 | ||
| 967 | template <class = int> | |
| 968 | _LIBCPP_HIDE_FROM_ABI double tanh(double __x) _NOEXCEPT { | |
| 969 | return __builtin_tanh(__x); | |
| 970 | } | |
| 971 | ||
| 972 | inline _LIBCPP_HIDE_FROM_ABI long double tanh(long double __x) _NOEXCEPT {return __builtin_tanhl(__x);} | |
| 1075 | 973 | # endif |
| 1076 | 974 | |
| 1077 | 975 | template <class _A1> |
| 1078 | inline _LIBCPP_INLINE_VISIBILITY | |
| 976 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1079 | 977 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1080 | tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);} | |
| 978 | tanh(_A1 __x) _NOEXCEPT {return __builtin_tanh((double)__x);} | |
| 1081 | 979 | |
| 1082 | 980 | // acosh |
| 1083 | 981 | |
| 1084 | inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);} | |
| 1085 | inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);} | |
| 982 | inline _LIBCPP_HIDE_FROM_ABI float acosh(float __x) _NOEXCEPT {return __builtin_acoshf(__x);} | |
| 983 | ||
| 984 | template <class = int> | |
| 985 | _LIBCPP_HIDE_FROM_ABI double acosh(double __x) _NOEXCEPT { | |
| 986 | return __builtin_acosh(__x); | |
| 987 | } | |
| 988 | ||
| 989 | inline _LIBCPP_HIDE_FROM_ABI long double acosh(long double __x) _NOEXCEPT {return __builtin_acoshl(__x);} | |
| 1086 | 990 | |
| 1087 | 991 | template <class _A1> |
| 1088 | inline _LIBCPP_INLINE_VISIBILITY | |
| 992 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1089 | 993 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1090 | acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);} | |
| 994 | acosh(_A1 __x) _NOEXCEPT {return __builtin_acosh((double)__x);} | |
| 1091 | 995 | |
| 1092 | 996 | // asinh |
| 1093 | 997 | |
| 1094 | inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);} | |
| 1095 | inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);} | |
| 998 | inline _LIBCPP_HIDE_FROM_ABI float asinh(float __x) _NOEXCEPT {return __builtin_asinhf(__x);} | |
| 999 | ||
| 1000 | template <class = int> | |
| 1001 | _LIBCPP_HIDE_FROM_ABI double asinh(double __x) _NOEXCEPT { | |
| 1002 | return __builtin_asinh(__x); | |
| 1003 | } | |
| 1004 | ||
| 1005 | inline _LIBCPP_HIDE_FROM_ABI long double asinh(long double __x) _NOEXCEPT {return __builtin_asinhl(__x);} | |
| 1096 | 1006 | |
| 1097 | 1007 | template <class _A1> |
| 1098 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1008 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1099 | 1009 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1100 | asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);} | |
| 1010 | asinh(_A1 __x) _NOEXCEPT {return __builtin_asinh((double)__x);} | |
| 1101 | 1011 | |
| 1102 | 1012 | // atanh |
| 1103 | 1013 | |
| 1104 | inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);} | |
| 1105 | inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);} | |
| 1014 | inline _LIBCPP_HIDE_FROM_ABI float atanh(float __x) _NOEXCEPT {return __builtin_atanhf(__x);} | |
| 1015 | ||
| 1016 | template <class = int> | |
| 1017 | _LIBCPP_HIDE_FROM_ABI double atanh(double __x) _NOEXCEPT { | |
| 1018 | return __builtin_atanh(__x); | |
| 1019 | } | |
| 1020 | ||
| 1021 | inline _LIBCPP_HIDE_FROM_ABI long double atanh(long double __x) _NOEXCEPT {return __builtin_atanhl(__x);} | |
| 1106 | 1022 | |
| 1107 | 1023 | template <class _A1> |
| 1108 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1024 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1109 | 1025 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1110 | atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);} | |
| 1026 | atanh(_A1 __x) _NOEXCEPT {return __builtin_atanh((double)__x);} | |
| 1111 | 1027 | |
| 1112 | 1028 | // cbrt |
| 1113 | 1029 | |
| 1114 | inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);} | |
| 1115 | inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);} | |
| 1030 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float cbrt(float __x) _NOEXCEPT {return __builtin_cbrtf(__x);} | |
| 1031 | ||
| 1032 | template <class = int> | |
| 1033 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double cbrt(double __x) _NOEXCEPT { | |
| 1034 | return __builtin_cbrt(__x); | |
| 1035 | } | |
| 1036 | ||
| 1037 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double cbrt(long double __x) _NOEXCEPT {return __builtin_cbrtl(__x);} | |
| 1116 | 1038 | |
| 1117 | 1039 | template <class _A1> |
| 1118 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1040 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI | |
| 1119 | 1041 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1120 | cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);} | |
| 1042 | cbrt(_A1 __x) _NOEXCEPT {return __builtin_cbrt((double)__x);} | |
| 1121 | 1043 | |
| 1122 | 1044 | // copysign |
| 1123 | 1045 | |
| 1124 | #if __has_builtin(__builtin_copysignf) | |
| 1125 | _LIBCPP_CONSTEXPR | |
| 1126 | #endif | |
| 1127 | inline _LIBCPP_INLINE_VISIBILITY float __libcpp_copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT { | |
| 1128 | #if __has_builtin(__builtin_copysignf) | |
| 1129 | return __builtin_copysignf(__lcpp_x, __lcpp_y); | |
| 1130 | #else | |
| 1131 | return ::copysignf(__lcpp_x, __lcpp_y); | |
| 1132 | #endif | |
| 1133 | } | |
| 1134 | ||
| 1135 | #if __has_builtin(__builtin_copysign) | |
| 1136 | _LIBCPP_CONSTEXPR | |
| 1137 | #endif | |
| 1138 | inline _LIBCPP_INLINE_VISIBILITY double __libcpp_copysign(double __lcpp_x, double __lcpp_y) _NOEXCEPT { | |
| 1139 | #if __has_builtin(__builtin_copysign) | |
| 1140 | return __builtin_copysign(__lcpp_x, __lcpp_y); | |
| 1141 | #else | |
| 1142 | return ::copysign(__lcpp_x, __lcpp_y); | |
| 1143 | #endif | |
| 1046 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float copysign(float __x, float __y) _NOEXCEPT { | |
| 1047 | return ::__builtin_copysignf(__x, __y); | |
| 1144 | 1048 | } |
| 1145 | 1049 | |
| 1146 | #if __has_builtin(__builtin_copysignl) | |
| 1147 | _LIBCPP_CONSTEXPR | |
| 1148 | #endif | |
| 1149 | inline _LIBCPP_INLINE_VISIBILITY long double __libcpp_copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { | |
| 1150 | #if __has_builtin(__builtin_copysignl) | |
| 1151 | return __builtin_copysignl(__lcpp_x, __lcpp_y); | |
| 1152 | #else | |
| 1153 | return ::copysignl(__lcpp_x, __lcpp_y); | |
| 1154 | #endif | |
| 1050 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double copysign(long double __x, long double __y) _NOEXCEPT { | |
| 1051 | return ::__builtin_copysignl(__x, __y); | |
| 1155 | 1052 | } |
| 1156 | 1053 | |
| 1157 | 1054 | template <class _A1, class _A2> |
| 1158 | #if __has_builtin(__builtin_copysign) | |
| 1159 | _LIBCPP_CONSTEXPR | |
| 1160 | #endif | |
| 1161 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1055 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI | |
| 1162 | 1056 | typename std::__enable_if_t |
| 1163 | 1057 | < |
| 1164 | 1058 | std::is_arithmetic<_A1>::value && |
| 1165 | 1059 | std::is_arithmetic<_A2>::value, |
| 1166 | 1060 | std::__promote<_A1, _A2> |
| 1167 | 1061 | >::type |
| 1168 | __libcpp_copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { | |
| 1169 | typedef typename std::__promote<_A1, _A2>::type __result_type; | |
| 1170 | static_assert((!(std::_IsSame<_A1, __result_type>::value && | |
| 1171 | std::_IsSame<_A2, __result_type>::value)), ""); | |
| 1172 | #if __has_builtin(__builtin_copysign) | |
| 1173 | return __builtin_copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); | |
| 1174 | #else | |
| 1175 | return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); | |
| 1176 | #endif | |
| 1062 | copysign(_A1 __x, _A2 __y) _NOEXCEPT { | |
| 1063 | return ::__builtin_copysign(__x, __y); | |
| 1177 | 1064 | } |
| 1178 | 1065 | |
| 1179 | inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT { | |
| 1180 | return ::__libcpp_copysign(__lcpp_x, __lcpp_y); | |
| 1181 | } | |
| 1066 | // erf | |
| 1182 | 1067 | |
| 1183 | inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { | |
| 1184 | return ::__libcpp_copysign(__lcpp_x, __lcpp_y); | |
| 1185 | } | |
| 1068 | inline _LIBCPP_HIDE_FROM_ABI float erf(float __x) _NOEXCEPT {return __builtin_erff(__x);} | |
| 1186 | 1069 | |
| 1187 | template <class _A1, class _A2> | |
| 1188 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1189 | typename std::__enable_if_t | |
| 1190 | < | |
| 1191 | std::is_arithmetic<_A1>::value && | |
| 1192 | std::is_arithmetic<_A2>::value, | |
| 1193 | std::__promote<_A1, _A2> | |
| 1194 | >::type | |
| 1195 | copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { | |
| 1196 | return ::__libcpp_copysign(__lcpp_x, __lcpp_y); | |
| 1070 | template <class = int> | |
| 1071 | _LIBCPP_HIDE_FROM_ABI double erf(double __x) _NOEXCEPT { | |
| 1072 | return __builtin_erf(__x); | |
| 1197 | 1073 | } |
| 1198 | 1074 | |
| 1199 | // erf | |
| 1200 | ||
| 1201 | inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);} | |
| 1202 | inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);} | |
| 1075 | inline _LIBCPP_HIDE_FROM_ABI long double erf(long double __x) _NOEXCEPT {return __builtin_erfl(__x);} | |
| 1203 | 1076 | |
| 1204 | 1077 | template <class _A1> |
| 1205 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1078 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1206 | 1079 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1207 | erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);} | |
| 1080 | erf(_A1 __x) _NOEXCEPT {return __builtin_erf((double)__x);} | |
| 1208 | 1081 | |
| 1209 | 1082 | // erfc |
| 1210 | 1083 | |
| 1211 | inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);} | |
| 1212 | inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);} | |
| 1084 | inline _LIBCPP_HIDE_FROM_ABI float erfc(float __x) _NOEXCEPT {return __builtin_erfcf(__x);} | |
| 1085 | ||
| 1086 | template <class = int> | |
| 1087 | _LIBCPP_HIDE_FROM_ABI double erfc(double __x) _NOEXCEPT { | |
| 1088 | return __builtin_erfc(__x); | |
| 1089 | } | |
| 1090 | ||
| 1091 | inline _LIBCPP_HIDE_FROM_ABI long double erfc(long double __x) _NOEXCEPT {return __builtin_erfcl(__x);} | |
| 1213 | 1092 | |
| 1214 | 1093 | template <class _A1> |
| 1215 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1094 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1216 | 1095 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1217 | erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);} | |
| 1096 | erfc(_A1 __x) _NOEXCEPT {return __builtin_erfc((double)__x);} | |
| 1218 | 1097 | |
| 1219 | 1098 | // exp2 |
| 1220 | 1099 | |
| 1221 | inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);} | |
| 1222 | inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);} | |
| 1100 | inline _LIBCPP_HIDE_FROM_ABI float exp2(float __x) _NOEXCEPT {return __builtin_exp2f(__x);} | |
| 1101 | ||
| 1102 | template <class = int> | |
| 1103 | _LIBCPP_HIDE_FROM_ABI double exp2(double __x) _NOEXCEPT { | |
| 1104 | return __builtin_exp2(__x); | |
| 1105 | } | |
| 1106 | ||
| 1107 | inline _LIBCPP_HIDE_FROM_ABI long double exp2(long double __x) _NOEXCEPT {return __builtin_exp2l(__x);} | |
| 1223 | 1108 | |
| 1224 | 1109 | template <class _A1> |
| 1225 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1110 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1226 | 1111 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1227 | exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);} | |
| 1112 | exp2(_A1 __x) _NOEXCEPT {return __builtin_exp2((double)__x);} | |
| 1228 | 1113 | |
| 1229 | 1114 | // expm1 |
| 1230 | 1115 | |
| 1231 | inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);} | |
| 1232 | inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);} | |
| 1116 | inline _LIBCPP_HIDE_FROM_ABI float expm1(float __x) _NOEXCEPT {return __builtin_expm1f(__x);} | |
| 1117 | ||
| 1118 | template <class = int> | |
| 1119 | _LIBCPP_HIDE_FROM_ABI double expm1(double __x) _NOEXCEPT { | |
| 1120 | return __builtin_expm1(__x); | |
| 1121 | } | |
| 1122 | ||
| 1123 | inline _LIBCPP_HIDE_FROM_ABI long double expm1(long double __x) _NOEXCEPT {return __builtin_expm1l(__x);} | |
| 1233 | 1124 | |
| 1234 | 1125 | template <class _A1> |
| 1235 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1126 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1236 | 1127 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1237 | expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);} | |
| 1128 | expm1(_A1 __x) _NOEXCEPT {return __builtin_expm1((double)__x);} | |
| 1238 | 1129 | |
| 1239 | 1130 | // fdim |
| 1240 | 1131 | |
| 1241 | inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);} | |
| 1242 | inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);} | |
| 1132 | inline _LIBCPP_HIDE_FROM_ABI float fdim(float __x, float __y) _NOEXCEPT {return __builtin_fdimf(__x, __y);} | |
| 1133 | ||
| 1134 | template <class = int> | |
| 1135 | _LIBCPP_HIDE_FROM_ABI double fdim(double __x, double __y) _NOEXCEPT { | |
| 1136 | return __builtin_fdim(__x, __y); | |
| 1137 | } | |
| 1138 | ||
| 1139 | inline _LIBCPP_HIDE_FROM_ABI long double fdim(long double __x, long double __y) _NOEXCEPT {return __builtin_fdiml(__x, __y);} | |
| 1243 | 1140 | |
| 1244 | 1141 | template <class _A1, class _A2> |
| 1245 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1142 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1246 | 1143 | typename std::__enable_if_t |
| 1247 | 1144 | < |
| 1248 | 1145 | std::is_arithmetic<_A1>::value && |
| 1249 | 1146 | std::is_arithmetic<_A2>::value, |
| 1250 | 1147 | std::__promote<_A1, _A2> |
| 1251 | 1148 | >::type |
| 1252 | fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 1149 | fdim(_A1 __x, _A2 __y) _NOEXCEPT | |
| 1253 | 1150 | { |
| 1254 | 1151 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
| 1255 | 1152 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
| 1256 | 1153 | std::_IsSame<_A2, __result_type>::value)), ""); |
| 1257 | return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y); | |
| 1154 | return ::fdim((__result_type)__x, (__result_type)__y); | |
| 1258 | 1155 | } |
| 1259 | 1156 | |
| 1260 | 1157 | // fma |
| 1261 | 1158 | |
| 1262 | inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT | |
| 1159 | inline _LIBCPP_HIDE_FROM_ABI float fma(float __x, float __y, float __z) _NOEXCEPT | |
| 1263 | 1160 | { |
| 1264 | #if __has_builtin(__builtin_fmaf) | |
| 1265 | return __builtin_fmaf(__lcpp_x, __lcpp_y, __lcpp_z); | |
| 1266 | #else | |
| 1267 | return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z); | |
| 1268 | #endif | |
| 1161 | return __builtin_fmaf(__x, __y, __z); | |
| 1162 | } | |
| 1163 | ||
| 1164 | ||
| 1165 | template <class = int> | |
| 1166 | _LIBCPP_HIDE_FROM_ABI double fma(double __x, double __y, double __z) _NOEXCEPT { | |
| 1167 | return __builtin_fma(__x, __y, __z); | |
| 1269 | 1168 | } |
| 1270 | inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT | |
| 1169 | ||
| 1170 | inline _LIBCPP_HIDE_FROM_ABI long double fma(long double __x, long double __y, long double __z) _NOEXCEPT | |
| 1271 | 1171 | { |
| 1272 | #if __has_builtin(__builtin_fmal) | |
| 1273 | return __builtin_fmal(__lcpp_x, __lcpp_y, __lcpp_z); | |
| 1274 | #else | |
| 1275 | return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z); | |
| 1276 | #endif | |
| 1172 | return __builtin_fmal(__x, __y, __z); | |
| 1277 | 1173 | } |
| 1278 | 1174 | |
| 1279 | 1175 | template <class _A1, class _A2, class _A3> |
| 1280 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1176 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1281 | 1177 | typename std::__enable_if_t |
| 1282 | 1178 | < |
| 1283 | 1179 | std::is_arithmetic<_A1>::value && |
| ... | ... | @@ -1285,462 +1181,512 @@ typename std::__enable_if_t |
| 1285 | 1181 | std::is_arithmetic<_A3>::value, |
| 1286 | 1182 | std::__promote<_A1, _A2, _A3> |
| 1287 | 1183 | >::type |
| 1288 | fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT | |
| 1184 | fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT | |
| 1289 | 1185 | { |
| 1290 | 1186 | typedef typename std::__promote<_A1, _A2, _A3>::type __result_type; |
| 1291 | 1187 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
| 1292 | 1188 | std::_IsSame<_A2, __result_type>::value && |
| 1293 | 1189 | std::_IsSame<_A3, __result_type>::value)), ""); |
| 1294 | #if __has_builtin(__builtin_fma) | |
| 1295 | return __builtin_fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); | |
| 1296 | #else | |
| 1297 | return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); | |
| 1298 | #endif | |
| 1190 | return __builtin_fma((__result_type)__x, (__result_type)__y, (__result_type)__z); | |
| 1299 | 1191 | } |
| 1300 | 1192 | |
| 1301 | 1193 | // fmax |
| 1302 | 1194 | |
| 1303 | inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);} | |
| 1304 | inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);} | |
| 1195 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float fmax(float __x, float __y) _NOEXCEPT {return __builtin_fmaxf(__x, __y);} | |
| 1196 | ||
| 1197 | template <class = int> | |
| 1198 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double fmax(double __x, double __y) _NOEXCEPT { | |
| 1199 | return __builtin_fmax(__x, __y); | |
| 1200 | } | |
| 1201 | ||
| 1202 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fmax(long double __x, long double __y) _NOEXCEPT {return __builtin_fmaxl(__x, __y);} | |
| 1305 | 1203 | |
| 1306 | 1204 | template <class _A1, class _A2> |
| 1307 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1205 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI | |
| 1308 | 1206 | typename std::__enable_if_t |
| 1309 | 1207 | < |
| 1310 | 1208 | std::is_arithmetic<_A1>::value && |
| 1311 | 1209 | std::is_arithmetic<_A2>::value, |
| 1312 | 1210 | std::__promote<_A1, _A2> |
| 1313 | 1211 | >::type |
| 1314 | fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 1212 | fmax(_A1 __x, _A2 __y) _NOEXCEPT | |
| 1315 | 1213 | { |
| 1316 | 1214 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
| 1317 | 1215 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
| 1318 | 1216 | std::_IsSame<_A2, __result_type>::value)), ""); |
| 1319 | return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y); | |
| 1217 | return ::fmax((__result_type)__x, (__result_type)__y); | |
| 1320 | 1218 | } |
| 1321 | 1219 | |
| 1322 | 1220 | // fmin |
| 1323 | 1221 | |
| 1324 | inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);} | |
| 1325 | inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);} | |
| 1222 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float fmin(float __x, float __y) _NOEXCEPT {return __builtin_fminf(__x, __y);} | |
| 1223 | ||
| 1224 | template <class = int> | |
| 1225 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double fmin(double __x, double __y) _NOEXCEPT { | |
| 1226 | return __builtin_fmin(__x, __y); | |
| 1227 | } | |
| 1228 | ||
| 1229 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fmin(long double __x, long double __y) _NOEXCEPT {return __builtin_fminl(__x, __y);} | |
| 1326 | 1230 | |
| 1327 | 1231 | template <class _A1, class _A2> |
| 1328 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1232 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI | |
| 1329 | 1233 | typename std::__enable_if_t |
| 1330 | 1234 | < |
| 1331 | 1235 | std::is_arithmetic<_A1>::value && |
| 1332 | 1236 | std::is_arithmetic<_A2>::value, |
| 1333 | 1237 | std::__promote<_A1, _A2> |
| 1334 | 1238 | >::type |
| 1335 | fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 1239 | fmin(_A1 __x, _A2 __y) _NOEXCEPT | |
| 1336 | 1240 | { |
| 1337 | 1241 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
| 1338 | 1242 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
| 1339 | 1243 | std::_IsSame<_A2, __result_type>::value)), ""); |
| 1340 | return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y); | |
| 1244 | return ::fmin((__result_type)__x, (__result_type)__y); | |
| 1341 | 1245 | } |
| 1342 | 1246 | |
| 1343 | 1247 | // hypot |
| 1344 | 1248 | |
| 1345 | inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);} | |
| 1346 | inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);} | |
| 1249 | inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y) _NOEXCEPT {return __builtin_hypotf(__x, __y);} | |
| 1250 | ||
| 1251 | template <class = int> | |
| 1252 | _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y) _NOEXCEPT { | |
| 1253 | return __builtin_hypot(__x, __y); | |
| 1254 | } | |
| 1255 | ||
| 1256 | inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y) _NOEXCEPT {return __builtin_hypotl(__x, __y);} | |
| 1347 | 1257 | |
| 1348 | 1258 | template <class _A1, class _A2> |
| 1349 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1259 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1350 | 1260 | typename std::__enable_if_t |
| 1351 | 1261 | < |
| 1352 | 1262 | std::is_arithmetic<_A1>::value && |
| 1353 | 1263 | std::is_arithmetic<_A2>::value, |
| 1354 | 1264 | std::__promote<_A1, _A2> |
| 1355 | 1265 | >::type |
| 1356 | hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 1266 | hypot(_A1 __x, _A2 __y) _NOEXCEPT | |
| 1357 | 1267 | { |
| 1358 | 1268 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
| 1359 | 1269 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
| 1360 | 1270 | std::_IsSame<_A2, __result_type>::value)), ""); |
| 1361 | return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y); | |
| 1271 | return ::hypot((__result_type)__x, (__result_type)__y); | |
| 1362 | 1272 | } |
| 1363 | 1273 | |
| 1364 | 1274 | // ilogb |
| 1365 | 1275 | |
| 1366 | inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);} | |
| 1367 | inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);} | |
| 1276 | inline _LIBCPP_HIDE_FROM_ABI int ilogb(float __x) _NOEXCEPT {return __builtin_ilogbf(__x);} | |
| 1277 | ||
| 1278 | template <class = int> | |
| 1279 | _LIBCPP_HIDE_FROM_ABI double ilogb(double __x) _NOEXCEPT { | |
| 1280 | return __builtin_ilogb(__x); | |
| 1281 | } | |
| 1282 | ||
| 1283 | inline _LIBCPP_HIDE_FROM_ABI int ilogb(long double __x) _NOEXCEPT {return __builtin_ilogbl(__x);} | |
| 1368 | 1284 | |
| 1369 | 1285 | template <class _A1> |
| 1370 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1286 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1371 | 1287 | typename std::enable_if<std::is_integral<_A1>::value, int>::type |
| 1372 | ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);} | |
| 1288 | ilogb(_A1 __x) _NOEXCEPT {return __builtin_ilogb((double)__x);} | |
| 1373 | 1289 | |
| 1374 | 1290 | // lgamma |
| 1375 | 1291 | |
| 1376 | inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);} | |
| 1377 | inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);} | |
| 1292 | inline _LIBCPP_HIDE_FROM_ABI float lgamma(float __x) _NOEXCEPT {return __builtin_lgammaf(__x);} | |
| 1293 | ||
| 1294 | template <class = int> | |
| 1295 | _LIBCPP_HIDE_FROM_ABI double lgamma(double __x) _NOEXCEPT { | |
| 1296 | return __builtin_lgamma(__x); | |
| 1297 | } | |
| 1298 | ||
| 1299 | inline _LIBCPP_HIDE_FROM_ABI long double lgamma(long double __x) _NOEXCEPT {return __builtin_lgammal(__x);} | |
| 1378 | 1300 | |
| 1379 | 1301 | template <class _A1> |
| 1380 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1302 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1381 | 1303 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1382 | lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);} | |
| 1304 | lgamma(_A1 __x) _NOEXCEPT {return __builtin_lgamma((double)__x);} | |
| 1383 | 1305 | |
| 1384 | 1306 | // llrint |
| 1385 | 1307 | |
| 1386 | inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT | |
| 1308 | inline _LIBCPP_HIDE_FROM_ABI long long llrint(float __x) _NOEXCEPT | |
| 1387 | 1309 | { |
| 1388 | #if __has_builtin(__builtin_llrintf) | |
| 1389 | return __builtin_llrintf(__lcpp_x); | |
| 1390 | #else | |
| 1391 | return ::llrintf(__lcpp_x); | |
| 1392 | #endif | |
| 1310 | return __builtin_llrintf(__x); | |
| 1311 | } | |
| 1312 | ||
| 1313 | template <class = int> | |
| 1314 | _LIBCPP_HIDE_FROM_ABI long long llrint(double __x) _NOEXCEPT { | |
| 1315 | return __builtin_llrint(__x); | |
| 1393 | 1316 | } |
| 1394 | inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT | |
| 1317 | ||
| 1318 | inline _LIBCPP_HIDE_FROM_ABI long long llrint(long double __x) _NOEXCEPT | |
| 1395 | 1319 | { |
| 1396 | #if __has_builtin(__builtin_llrintl) | |
| 1397 | return __builtin_llrintl(__lcpp_x); | |
| 1398 | #else | |
| 1399 | return ::llrintl(__lcpp_x); | |
| 1400 | #endif | |
| 1320 | return __builtin_llrintl(__x); | |
| 1401 | 1321 | } |
| 1402 | 1322 | |
| 1403 | 1323 | template <class _A1> |
| 1404 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1324 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1405 | 1325 | typename std::enable_if<std::is_integral<_A1>::value, long long>::type |
| 1406 | llrint(_A1 __lcpp_x) _NOEXCEPT | |
| 1326 | llrint(_A1 __x) _NOEXCEPT | |
| 1407 | 1327 | { |
| 1408 | #if __has_builtin(__builtin_llrint) | |
| 1409 | return __builtin_llrint((double)__lcpp_x); | |
| 1410 | #else | |
| 1411 | return ::llrint((double)__lcpp_x); | |
| 1412 | #endif | |
| 1328 | return __builtin_llrint((double)__x); | |
| 1413 | 1329 | } |
| 1414 | 1330 | |
| 1415 | 1331 | // llround |
| 1416 | 1332 | |
| 1417 | inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT | |
| 1333 | inline _LIBCPP_HIDE_FROM_ABI long long llround(float __x) _NOEXCEPT | |
| 1418 | 1334 | { |
| 1419 | #if __has_builtin(__builtin_llroundf) | |
| 1420 | return __builtin_llroundf(__lcpp_x); | |
| 1421 | #else | |
| 1422 | return ::llroundf(__lcpp_x); | |
| 1423 | #endif | |
| 1335 | return __builtin_llroundf(__x); | |
| 1336 | } | |
| 1337 | ||
| 1338 | template <class = int> | |
| 1339 | _LIBCPP_HIDE_FROM_ABI long long llround(double __x) _NOEXCEPT { | |
| 1340 | return __builtin_llround(__x); | |
| 1424 | 1341 | } |
| 1425 | inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT | |
| 1342 | ||
| 1343 | inline _LIBCPP_HIDE_FROM_ABI long long llround(long double __x) _NOEXCEPT | |
| 1426 | 1344 | { |
| 1427 | #if __has_builtin(__builtin_llroundl) | |
| 1428 | return __builtin_llroundl(__lcpp_x); | |
| 1429 | #else | |
| 1430 | return ::llroundl(__lcpp_x); | |
| 1431 | #endif | |
| 1345 | return __builtin_llroundl(__x); | |
| 1432 | 1346 | } |
| 1433 | 1347 | |
| 1434 | 1348 | template <class _A1> |
| 1435 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1349 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1436 | 1350 | typename std::enable_if<std::is_integral<_A1>::value, long long>::type |
| 1437 | llround(_A1 __lcpp_x) _NOEXCEPT | |
| 1351 | llround(_A1 __x) _NOEXCEPT | |
| 1438 | 1352 | { |
| 1439 | #if __has_builtin(__builtin_llround) | |
| 1440 | return __builtin_llround((double)__lcpp_x); | |
| 1441 | #else | |
| 1442 | return ::llround((double)__lcpp_x); | |
| 1443 | #endif | |
| 1353 | return __builtin_llround((double)__x); | |
| 1444 | 1354 | } |
| 1445 | 1355 | |
| 1446 | 1356 | // log1p |
| 1447 | 1357 | |
| 1448 | inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);} | |
| 1449 | inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);} | |
| 1358 | inline _LIBCPP_HIDE_FROM_ABI float log1p(float __x) _NOEXCEPT {return __builtin_log1pf(__x);} | |
| 1359 | ||
| 1360 | template <class = int> | |
| 1361 | _LIBCPP_HIDE_FROM_ABI double log1p(double __x) _NOEXCEPT { | |
| 1362 | return __builtin_log1p(__x); | |
| 1363 | } | |
| 1364 | ||
| 1365 | inline _LIBCPP_HIDE_FROM_ABI long double log1p(long double __x) _NOEXCEPT {return __builtin_log1pl(__x);} | |
| 1450 | 1366 | |
| 1451 | 1367 | template <class _A1> |
| 1452 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1368 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1453 | 1369 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1454 | log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);} | |
| 1370 | log1p(_A1 __x) _NOEXCEPT {return __builtin_log1p((double)__x);} | |
| 1455 | 1371 | |
| 1456 | 1372 | // log2 |
| 1457 | 1373 | |
| 1458 | inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);} | |
| 1459 | inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);} | |
| 1374 | inline _LIBCPP_HIDE_FROM_ABI float log2(float __x) _NOEXCEPT {return __builtin_log2f(__x);} | |
| 1375 | ||
| 1376 | template <class = int> | |
| 1377 | _LIBCPP_HIDE_FROM_ABI double log2(double __x) _NOEXCEPT { | |
| 1378 | return __builtin_log2(__x); | |
| 1379 | } | |
| 1380 | ||
| 1381 | inline _LIBCPP_HIDE_FROM_ABI long double log2(long double __x) _NOEXCEPT {return __builtin_log2l(__x);} | |
| 1460 | 1382 | |
| 1461 | 1383 | template <class _A1> |
| 1462 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1384 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1463 | 1385 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1464 | log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);} | |
| 1386 | log2(_A1 __x) _NOEXCEPT {return __builtin_log2((double)__x);} | |
| 1465 | 1387 | |
| 1466 | 1388 | // logb |
| 1467 | 1389 | |
| 1468 | inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);} | |
| 1469 | inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);} | |
| 1390 | inline _LIBCPP_HIDE_FROM_ABI float logb(float __x) _NOEXCEPT {return __builtin_logbf(__x);} | |
| 1391 | ||
| 1392 | template <class = int> | |
| 1393 | _LIBCPP_HIDE_FROM_ABI double logb(double __x) _NOEXCEPT { | |
| 1394 | return __builtin_logb(__x); | |
| 1395 | } | |
| 1396 | ||
| 1397 | inline _LIBCPP_HIDE_FROM_ABI long double logb(long double __x) _NOEXCEPT {return __builtin_logbl(__x);} | |
| 1470 | 1398 | |
| 1471 | 1399 | template <class _A1> |
| 1472 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1400 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1473 | 1401 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1474 | logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);} | |
| 1402 | logb(_A1 __x) _NOEXCEPT {return __builtin_logb((double)__x);} | |
| 1475 | 1403 | |
| 1476 | 1404 | // lrint |
| 1477 | 1405 | |
| 1478 | inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT | |
| 1406 | inline _LIBCPP_HIDE_FROM_ABI long lrint(float __x) _NOEXCEPT | |
| 1479 | 1407 | { |
| 1480 | #if __has_builtin(__builtin_lrintf) | |
| 1481 | return __builtin_lrintf(__lcpp_x); | |
| 1482 | #else | |
| 1483 | return ::lrintf(__lcpp_x); | |
| 1484 | #endif | |
| 1408 | return __builtin_lrintf(__x); | |
| 1485 | 1409 | } |
| 1486 | inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT | |
| 1410 | ||
| 1411 | template <class = int> | |
| 1412 | _LIBCPP_HIDE_FROM_ABI long lrint(double __x) _NOEXCEPT { | |
| 1413 | return __builtin_lrint(__x); | |
| 1414 | } | |
| 1415 | ||
| 1416 | inline _LIBCPP_HIDE_FROM_ABI long lrint(long double __x) _NOEXCEPT | |
| 1487 | 1417 | { |
| 1488 | #if __has_builtin(__builtin_lrintl) | |
| 1489 | return __builtin_lrintl(__lcpp_x); | |
| 1490 | #else | |
| 1491 | return ::lrintl(__lcpp_x); | |
| 1492 | #endif | |
| 1418 | return __builtin_lrintl(__x); | |
| 1493 | 1419 | } |
| 1494 | 1420 | |
| 1495 | 1421 | template <class _A1> |
| 1496 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1422 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1497 | 1423 | typename std::enable_if<std::is_integral<_A1>::value, long>::type |
| 1498 | lrint(_A1 __lcpp_x) _NOEXCEPT | |
| 1424 | lrint(_A1 __x) _NOEXCEPT | |
| 1499 | 1425 | { |
| 1500 | #if __has_builtin(__builtin_lrint) | |
| 1501 | return __builtin_lrint((double)__lcpp_x); | |
| 1502 | #else | |
| 1503 | return ::lrint((double)__lcpp_x); | |
| 1504 | #endif | |
| 1426 | return __builtin_lrint((double)__x); | |
| 1505 | 1427 | } |
| 1506 | 1428 | |
| 1507 | 1429 | // lround |
| 1508 | 1430 | |
| 1509 | inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT | |
| 1431 | inline _LIBCPP_HIDE_FROM_ABI long lround(float __x) _NOEXCEPT | |
| 1510 | 1432 | { |
| 1511 | #if __has_builtin(__builtin_lroundf) | |
| 1512 | return __builtin_lroundf(__lcpp_x); | |
| 1513 | #else | |
| 1514 | return ::lroundf(__lcpp_x); | |
| 1515 | #endif | |
| 1433 | return __builtin_lroundf(__x); | |
| 1516 | 1434 | } |
| 1517 | inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT | |
| 1435 | ||
| 1436 | template <class = int> | |
| 1437 | _LIBCPP_HIDE_FROM_ABI long lround(double __x) _NOEXCEPT { | |
| 1438 | return __builtin_lround(__x); | |
| 1439 | } | |
| 1440 | ||
| 1441 | inline _LIBCPP_HIDE_FROM_ABI long lround(long double __x) _NOEXCEPT | |
| 1518 | 1442 | { |
| 1519 | #if __has_builtin(__builtin_lroundl) | |
| 1520 | return __builtin_lroundl(__lcpp_x); | |
| 1521 | #else | |
| 1522 | return ::lroundl(__lcpp_x); | |
| 1523 | #endif | |
| 1443 | return __builtin_lroundl(__x); | |
| 1524 | 1444 | } |
| 1525 | 1445 | |
| 1526 | 1446 | template <class _A1> |
| 1527 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1447 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1528 | 1448 | typename std::enable_if<std::is_integral<_A1>::value, long>::type |
| 1529 | lround(_A1 __lcpp_x) _NOEXCEPT | |
| 1449 | lround(_A1 __x) _NOEXCEPT | |
| 1530 | 1450 | { |
| 1531 | #if __has_builtin(__builtin_lround) | |
| 1532 | return __builtin_lround((double)__lcpp_x); | |
| 1533 | #else | |
| 1534 | return ::lround((double)__lcpp_x); | |
| 1535 | #endif | |
| 1451 | return __builtin_lround((double)__x); | |
| 1536 | 1452 | } |
| 1537 | 1453 | |
| 1538 | 1454 | // nan |
| 1539 | 1455 | |
| 1540 | 1456 | // nearbyint |
| 1541 | 1457 | |
| 1542 | inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);} | |
| 1543 | inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);} | |
| 1458 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float nearbyint(float __x) _NOEXCEPT {return __builtin_nearbyintf(__x);} | |
| 1459 | ||
| 1460 | template <class = int> | |
| 1461 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double nearbyint(double __x) _NOEXCEPT { | |
| 1462 | return __builtin_nearbyint(__x); | |
| 1463 | } | |
| 1464 | ||
| 1465 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double nearbyint(long double __x) _NOEXCEPT {return __builtin_nearbyintl(__x);} | |
| 1544 | 1466 | |
| 1545 | 1467 | template <class _A1> |
| 1546 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1468 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI | |
| 1547 | 1469 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1548 | nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);} | |
| 1470 | nearbyint(_A1 __x) _NOEXCEPT {return __builtin_nearbyint((double)__x);} | |
| 1549 | 1471 | |
| 1550 | 1472 | // nextafter |
| 1551 | 1473 | |
| 1552 | inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);} | |
| 1553 | inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);} | |
| 1474 | inline _LIBCPP_HIDE_FROM_ABI float nextafter(float __x, float __y) _NOEXCEPT {return __builtin_nextafterf(__x, __y);} | |
| 1475 | ||
| 1476 | template <class = int> | |
| 1477 | _LIBCPP_HIDE_FROM_ABI double nextafter(double __x, double __y) _NOEXCEPT { | |
| 1478 | return __builtin_nextafter(__x, __y); | |
| 1479 | } | |
| 1480 | ||
| 1481 | inline _LIBCPP_HIDE_FROM_ABI long double nextafter(long double __x, long double __y) _NOEXCEPT {return __builtin_nextafterl(__x, __y);} | |
| 1554 | 1482 | |
| 1555 | 1483 | template <class _A1, class _A2> |
| 1556 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1484 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1557 | 1485 | typename std::__enable_if_t |
| 1558 | 1486 | < |
| 1559 | 1487 | std::is_arithmetic<_A1>::value && |
| 1560 | 1488 | std::is_arithmetic<_A2>::value, |
| 1561 | 1489 | std::__promote<_A1, _A2> |
| 1562 | 1490 | >::type |
| 1563 | nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 1491 | nextafter(_A1 __x, _A2 __y) _NOEXCEPT | |
| 1564 | 1492 | { |
| 1565 | 1493 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
| 1566 | 1494 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
| 1567 | 1495 | std::_IsSame<_A2, __result_type>::value)), ""); |
| 1568 | return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y); | |
| 1496 | return ::nextafter((__result_type)__x, (__result_type)__y); | |
| 1569 | 1497 | } |
| 1570 | 1498 | |
| 1571 | 1499 | // nexttoward |
| 1572 | 1500 | |
| 1573 | inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);} | |
| 1574 | inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);} | |
| 1501 | inline _LIBCPP_HIDE_FROM_ABI float nexttoward(float __x, long double __y) _NOEXCEPT {return __builtin_nexttowardf(__x, __y);} | |
| 1502 | ||
| 1503 | template <class = int> | |
| 1504 | _LIBCPP_HIDE_FROM_ABI double nexttoward(double __x, long double __y) _NOEXCEPT { | |
| 1505 | return __builtin_nexttoward(__x, __y); | |
| 1506 | } | |
| 1507 | ||
| 1508 | inline _LIBCPP_HIDE_FROM_ABI long double nexttoward(long double __x, long double __y) _NOEXCEPT {return __builtin_nexttowardl(__x, __y);} | |
| 1575 | 1509 | |
| 1576 | 1510 | template <class _A1> |
| 1577 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1511 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1578 | 1512 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1579 | nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);} | |
| 1513 | nexttoward(_A1 __x, long double __y) _NOEXCEPT {return __builtin_nexttoward((double)__x, __y);} | |
| 1580 | 1514 | |
| 1581 | 1515 | // remainder |
| 1582 | 1516 | |
| 1583 | inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);} | |
| 1584 | inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);} | |
| 1517 | inline _LIBCPP_HIDE_FROM_ABI float remainder(float __x, float __y) _NOEXCEPT {return __builtin_remainderf(__x, __y);} | |
| 1518 | ||
| 1519 | template <class = int> | |
| 1520 | _LIBCPP_HIDE_FROM_ABI double remainder(double __x, double __y) _NOEXCEPT { | |
| 1521 | return __builtin_remainder(__x, __y); | |
| 1522 | } | |
| 1523 | ||
| 1524 | inline _LIBCPP_HIDE_FROM_ABI long double remainder(long double __x, long double __y) _NOEXCEPT {return __builtin_remainderl(__x, __y);} | |
| 1585 | 1525 | |
| 1586 | 1526 | template <class _A1, class _A2> |
| 1587 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1527 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1588 | 1528 | typename std::__enable_if_t |
| 1589 | 1529 | < |
| 1590 | 1530 | std::is_arithmetic<_A1>::value && |
| 1591 | 1531 | std::is_arithmetic<_A2>::value, |
| 1592 | 1532 | std::__promote<_A1, _A2> |
| 1593 | 1533 | >::type |
| 1594 | remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT | |
| 1534 | remainder(_A1 __x, _A2 __y) _NOEXCEPT | |
| 1595 | 1535 | { |
| 1596 | 1536 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
| 1597 | 1537 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
| 1598 | 1538 | std::_IsSame<_A2, __result_type>::value)), ""); |
| 1599 | return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y); | |
| 1539 | return ::remainder((__result_type)__x, (__result_type)__y); | |
| 1600 | 1540 | } |
| 1601 | 1541 | |
| 1602 | 1542 | // remquo |
| 1603 | 1543 | |
| 1604 | inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);} | |
| 1605 | inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z);} | |
| 1544 | inline _LIBCPP_HIDE_FROM_ABI float remquo(float __x, float __y, int* __z) _NOEXCEPT {return __builtin_remquof(__x, __y, __z);} | |
| 1545 | ||
| 1546 | template <class = int> | |
| 1547 | _LIBCPP_HIDE_FROM_ABI double remquo(double __x, double __y, int* __z) _NOEXCEPT { | |
| 1548 | return __builtin_remquo(__x, __y, __z); | |
| 1549 | } | |
| 1550 | ||
| 1551 | inline _LIBCPP_HIDE_FROM_ABI long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return __builtin_remquol(__x, __y, __z);} | |
| 1606 | 1552 | |
| 1607 | 1553 | template <class _A1, class _A2> |
| 1608 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1554 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1609 | 1555 | typename std::__enable_if_t |
| 1610 | 1556 | < |
| 1611 | 1557 | std::is_arithmetic<_A1>::value && |
| 1612 | 1558 | std::is_arithmetic<_A2>::value, |
| 1613 | 1559 | std::__promote<_A1, _A2> |
| 1614 | 1560 | >::type |
| 1615 | remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT | |
| 1561 | remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT | |
| 1616 | 1562 | { |
| 1617 | 1563 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
| 1618 | 1564 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
| 1619 | 1565 | std::_IsSame<_A2, __result_type>::value)), ""); |
| 1620 | return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z); | |
| 1566 | return ::remquo((__result_type)__x, (__result_type)__y, __z); | |
| 1621 | 1567 | } |
| 1622 | 1568 | |
| 1623 | 1569 | // rint |
| 1624 | 1570 | |
| 1625 | inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT | |
| 1571 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float rint(float __x) _NOEXCEPT | |
| 1626 | 1572 | { |
| 1627 | #if __has_builtin(__builtin_rintf) | |
| 1628 | return __builtin_rintf(__lcpp_x); | |
| 1629 | #else | |
| 1630 | return ::rintf(__lcpp_x); | |
| 1631 | #endif | |
| 1573 | return __builtin_rintf(__x); | |
| 1632 | 1574 | } |
| 1633 | inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT | |
| 1575 | ||
| 1576 | template <class = int> | |
| 1577 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double rint(double __x) _NOEXCEPT { | |
| 1578 | return __builtin_rint(__x); | |
| 1579 | } | |
| 1580 | ||
| 1581 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double rint(long double __x) _NOEXCEPT | |
| 1634 | 1582 | { |
| 1635 | #if __has_builtin(__builtin_rintl) | |
| 1636 | return __builtin_rintl(__lcpp_x); | |
| 1637 | #else | |
| 1638 | return ::rintl(__lcpp_x); | |
| 1639 | #endif | |
| 1583 | return __builtin_rintl(__x); | |
| 1640 | 1584 | } |
| 1641 | 1585 | |
| 1642 | 1586 | template <class _A1> |
| 1643 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1587 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI | |
| 1644 | 1588 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1645 | rint(_A1 __lcpp_x) _NOEXCEPT | |
| 1589 | rint(_A1 __x) _NOEXCEPT | |
| 1646 | 1590 | { |
| 1647 | #if __has_builtin(__builtin_rint) | |
| 1648 | return __builtin_rint((double)__lcpp_x); | |
| 1649 | #else | |
| 1650 | return ::rint((double)__lcpp_x); | |
| 1651 | #endif | |
| 1591 | return __builtin_rint((double)__x); | |
| 1652 | 1592 | } |
| 1653 | 1593 | |
| 1654 | 1594 | // round |
| 1655 | 1595 | |
| 1656 | inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT | |
| 1596 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT | |
| 1657 | 1597 | { |
| 1658 | #if __has_builtin(__builtin_round) | |
| 1659 | return __builtin_round(__lcpp_x); | |
| 1660 | #else | |
| 1661 | return ::round(__lcpp_x); | |
| 1662 | #endif | |
| 1598 | return __builtin_round(__x); | |
| 1663 | 1599 | } |
| 1664 | inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT | |
| 1600 | ||
| 1601 | template <class = int> | |
| 1602 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double round(double __x) _NOEXCEPT { | |
| 1603 | return __builtin_round(__x); | |
| 1604 | } | |
| 1605 | ||
| 1606 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double round(long double __x) _NOEXCEPT | |
| 1665 | 1607 | { |
| 1666 | #if __has_builtin(__builtin_roundl) | |
| 1667 | return __builtin_roundl(__lcpp_x); | |
| 1668 | #else | |
| 1669 | return ::roundl(__lcpp_x); | |
| 1670 | #endif | |
| 1608 | return __builtin_roundl(__x); | |
| 1671 | 1609 | } |
| 1672 | 1610 | |
| 1673 | 1611 | template <class _A1> |
| 1674 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1612 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI | |
| 1675 | 1613 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1676 | round(_A1 __lcpp_x) _NOEXCEPT | |
| 1614 | round(_A1 __x) _NOEXCEPT | |
| 1677 | 1615 | { |
| 1678 | #if __has_builtin(__builtin_round) | |
| 1679 | return __builtin_round((double)__lcpp_x); | |
| 1680 | #else | |
| 1681 | return ::round((double)__lcpp_x); | |
| 1682 | #endif | |
| 1616 | return __builtin_round((double)__x); | |
| 1683 | 1617 | } |
| 1684 | 1618 | |
| 1685 | 1619 | // scalbln |
| 1686 | 1620 | |
| 1687 | inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);} | |
| 1688 | inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);} | |
| 1621 | inline _LIBCPP_HIDE_FROM_ABI float scalbln(float __x, long __y) _NOEXCEPT {return __builtin_scalblnf(__x, __y);} | |
| 1622 | ||
| 1623 | template <class = int> | |
| 1624 | _LIBCPP_HIDE_FROM_ABI double scalbln(double __x, long __y) _NOEXCEPT { | |
| 1625 | return __builtin_scalbln(__x, __y); | |
| 1626 | } | |
| 1627 | ||
| 1628 | inline _LIBCPP_HIDE_FROM_ABI long double scalbln(long double __x, long __y) _NOEXCEPT {return __builtin_scalblnl(__x, __y);} | |
| 1689 | 1629 | |
| 1690 | 1630 | template <class _A1> |
| 1691 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1631 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1692 | 1632 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1693 | scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);} | |
| 1633 | scalbln(_A1 __x, long __y) _NOEXCEPT {return __builtin_scalbln((double)__x, __y);} | |
| 1694 | 1634 | |
| 1695 | 1635 | // scalbn |
| 1696 | 1636 | |
| 1697 | inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);} | |
| 1698 | inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);} | |
| 1637 | inline _LIBCPP_HIDE_FROM_ABI float scalbn(float __x, int __y) _NOEXCEPT {return __builtin_scalbnf(__x, __y);} | |
| 1638 | ||
| 1639 | template <class = int> | |
| 1640 | _LIBCPP_HIDE_FROM_ABI double scalbn(double __x, int __y) _NOEXCEPT { | |
| 1641 | return __builtin_scalbn(__x, __y); | |
| 1642 | } | |
| 1643 | ||
| 1644 | inline _LIBCPP_HIDE_FROM_ABI long double scalbn(long double __x, int __y) _NOEXCEPT {return __builtin_scalbnl(__x, __y);} | |
| 1699 | 1645 | |
| 1700 | 1646 | template <class _A1> |
| 1701 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1647 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1702 | 1648 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1703 | scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);} | |
| 1649 | scalbn(_A1 __x, int __y) _NOEXCEPT {return __builtin_scalbn((double)__x, __y);} | |
| 1704 | 1650 | |
| 1705 | 1651 | // tgamma |
| 1706 | 1652 | |
| 1707 | inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);} | |
| 1708 | inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);} | |
| 1653 | inline _LIBCPP_HIDE_FROM_ABI float tgamma(float __x) _NOEXCEPT {return __builtin_tgammaf(__x);} | |
| 1654 | ||
| 1655 | template <class = int> | |
| 1656 | _LIBCPP_HIDE_FROM_ABI double tgamma(double __x) _NOEXCEPT { | |
| 1657 | return __builtin_tgamma(__x); | |
| 1658 | } | |
| 1659 | ||
| 1660 | inline _LIBCPP_HIDE_FROM_ABI long double tgamma(long double __x) _NOEXCEPT {return __builtin_tgammal(__x);} | |
| 1709 | 1661 | |
| 1710 | 1662 | template <class _A1> |
| 1711 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1663 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1712 | 1664 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1713 | tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);} | |
| 1665 | tgamma(_A1 __x) _NOEXCEPT {return __builtin_tgamma((double)__x);} | |
| 1714 | 1666 | |
| 1715 | 1667 | // trunc |
| 1716 | 1668 | |
| 1717 | inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT | |
| 1669 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float trunc(float __x) _NOEXCEPT | |
| 1718 | 1670 | { |
| 1719 | #if __has_builtin(__builtin_trunc) | |
| 1720 | return __builtin_trunc(__lcpp_x); | |
| 1721 | #else | |
| 1722 | return ::trunc(__lcpp_x); | |
| 1723 | #endif | |
| 1671 | return __builtin_trunc(__x); | |
| 1724 | 1672 | } |
| 1725 | inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT | |
| 1673 | ||
| 1674 | template <class = int> | |
| 1675 | _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double trunc(double __x) _NOEXCEPT { | |
| 1676 | return __builtin_trunc(__x); | |
| 1677 | } | |
| 1678 | ||
| 1679 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double trunc(long double __x) _NOEXCEPT | |
| 1726 | 1680 | { |
| 1727 | #if __has_builtin(__builtin_truncl) | |
| 1728 | return __builtin_truncl(__lcpp_x); | |
| 1729 | #else | |
| 1730 | return ::truncl(__lcpp_x); | |
| 1731 | #endif | |
| 1681 | return __builtin_truncl(__x); | |
| 1732 | 1682 | } |
| 1733 | 1683 | |
| 1734 | 1684 | template <class _A1> |
| 1735 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1685 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI | |
| 1736 | 1686 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
| 1737 | trunc(_A1 __lcpp_x) _NOEXCEPT | |
| 1687 | trunc(_A1 __x) _NOEXCEPT | |
| 1738 | 1688 | { |
| 1739 | #if __has_builtin(__builtin_trunc) | |
| 1740 | return __builtin_trunc((double)__lcpp_x); | |
| 1741 | #else | |
| 1742 | return ::trunc((double)__lcpp_x); | |
| 1743 | #endif | |
| 1689 | return __builtin_trunc((double)__x); | |
| 1744 | 1690 | } |
| 1745 | 1691 | |
| 1746 | 1692 | } // extern "C++" |
lib/libcxx/include/memory+131-230| ... | ... | @@ -406,16 +406,17 @@ template <class T> |
| 406 | 406 | struct default_delete |
| 407 | 407 | { |
| 408 | 408 | constexpr default_delete() noexcept = default; |
| 409 | template <class U> default_delete(const default_delete<U>&) noexcept; | |
| 409 | template <class U> constexpr default_delete(const default_delete<U>&) noexcept; // constexpr since C++23 | |
| 410 | 410 | |
| 411 | void operator()(T*) const noexcept; | |
| 411 | constexpr void operator()(T*) const noexcept; // constexpr since C++23 | |
| 412 | 412 | }; |
| 413 | 413 | |
| 414 | 414 | template <class T> |
| 415 | 415 | struct default_delete<T[]> |
| 416 | 416 | { |
| 417 | 417 | constexpr default_delete() noexcept = default; |
| 418 | void operator()(T*) const noexcept; | |
| 418 | template <class U> constexpr default_delete(const default_delete <U[]>&) noexcept; // constexpr since C++23 | |
| 419 | constexpr void operator()(T*) const noexcept; // constexpr since C++23 | |
| 419 | 420 | template <class U> void operator()(U*) const = delete; |
| 420 | 421 | }; |
| 421 | 422 | |
| ... | ... | @@ -429,36 +430,37 @@ public: |
| 429 | 430 | |
| 430 | 431 | // constructors |
| 431 | 432 | constexpr unique_ptr() noexcept; |
| 432 | explicit unique_ptr(pointer p) noexcept; | |
| 433 | unique_ptr(pointer p, see below d1) noexcept; | |
| 434 | unique_ptr(pointer p, see below d2) noexcept; | |
| 435 | unique_ptr(unique_ptr&& u) noexcept; | |
| 436 | unique_ptr(nullptr_t) noexcept : unique_ptr() { } | |
| 433 | constexpr explicit unique_ptr(pointer p) noexcept; // constexpr since C++23 | |
| 434 | constexpr unique_ptr(pointer p, see below d1) noexcept; // constexpr since C++23 | |
| 435 | constexpr unique_ptr(pointer p, see below d2) noexcept; // constexpr since C++23 | |
| 436 | constexpr unique_ptr(unique_ptr&& u) noexcept; // constexpr since C++23 | |
| 437 | constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { } | |
| 437 | 438 | template <class U, class E> |
| 438 | unique_ptr(unique_ptr<U, E>&& u) noexcept; | |
| 439 | constexpr unique_ptr(unique_ptr<U, E>&& u) noexcept; // constexpr since C++23 | |
| 439 | 440 | template <class U> |
| 440 | unique_ptr(auto_ptr<U>&& u) noexcept; // removed in C++17 | |
| 441 | unique_ptr(auto_ptr<U>&& u) noexcept; // removed in C++17 | |
| 441 | 442 | |
| 442 | 443 | // destructor |
| 443 | ~unique_ptr(); | |
| 444 | constexpr ~unique_ptr(); // constexpr since C++23 | |
| 444 | 445 | |
| 445 | 446 | // assignment |
| 446 | unique_ptr& operator=(unique_ptr&& u) noexcept; | |
| 447 | template <class U, class E> unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept; | |
| 448 | unique_ptr& operator=(nullptr_t) noexcept; | |
| 447 | constexpr unique_ptr& operator=(unique_ptr&& u) noexcept; // constexpr since C++23 | |
| 448 | template <class U, class E> | |
| 449 | constexpr unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept; // constexpr since C++23 | |
| 450 | constexpr unique_ptr& operator=(nullptr_t) noexcept; // constexpr since C++23 | |
| 449 | 451 | |
| 450 | 452 | // observers |
| 451 | typename add_lvalue_reference<T>::type operator*() const; | |
| 452 | pointer operator->() const noexcept; | |
| 453 | pointer get() const noexcept; | |
| 454 | deleter_type& get_deleter() noexcept; | |
| 455 | const deleter_type& get_deleter() const noexcept; | |
| 456 | explicit operator bool() const noexcept; | |
| 453 | typename constexpr add_lvalue_reference<T>::type operator*() const; // constexpr since C++23 | |
| 454 | constexpr pointer operator->() const noexcept; // constexpr since C++23 | |
| 455 | constexpr pointer get() const noexcept; // constexpr since C++23 | |
| 456 | constexpr deleter_type& get_deleter() noexcept; // constexpr since C++23 | |
| 457 | constexpr const deleter_type& get_deleter() const noexcept; // constexpr since C++23 | |
| 458 | constexpr explicit operator bool() const noexcept; // constexpr since C++23 | |
| 457 | 459 | |
| 458 | 460 | // modifiers |
| 459 | pointer release() noexcept; | |
| 460 | void reset(pointer p = pointer()) noexcept; | |
| 461 | void swap(unique_ptr& u) noexcept; | |
| 461 | constexpr pointer release() noexcept; // constexpr since C++23 | |
| 462 | constexpr void reset(pointer p = pointer()) noexcept; // constexpr since C++23 | |
| 463 | constexpr void swap(unique_ptr& u) noexcept; // constexpr since C++23 | |
| 462 | 464 | }; |
| 463 | 465 | |
| 464 | 466 | template <class T, class D> |
| ... | ... | @@ -471,41 +473,45 @@ public: |
| 471 | 473 | |
| 472 | 474 | // constructors |
| 473 | 475 | constexpr unique_ptr() noexcept; |
| 474 | explicit unique_ptr(pointer p) noexcept; | |
| 475 | unique_ptr(pointer p, see below d) noexcept; | |
| 476 | unique_ptr(pointer p, see below d) noexcept; | |
| 477 | unique_ptr(unique_ptr&& u) noexcept; | |
| 478 | unique_ptr(nullptr_t) noexcept : unique_ptr() { } | |
| 476 | constexpr explicit unique_ptr(pointer p) noexcept; // constexpr since C++23 | |
| 477 | constexpr unique_ptr(pointer p, see below d) noexcept; // constexpr since C++23 | |
| 478 | constexpr unique_ptr(pointer p, see below d) noexcept; // constexpr since C++23 | |
| 479 | constexpr unique_ptr(unique_ptr&& u) noexcept; // constexpr since C++23 | |
| 480 | template <class U, class E> | |
| 481 | constexpr unique_ptr(unique_ptr <U, E>&& u) noexcept; // constexpr since C++23 | |
| 482 | constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { } | |
| 479 | 483 | |
| 480 | 484 | // destructor |
| 481 | ~unique_ptr(); | |
| 485 | constexpr ~unique_ptr(); // constexpr since C++23 | |
| 482 | 486 | |
| 483 | 487 | // assignment |
| 484 | unique_ptr& operator=(unique_ptr&& u) noexcept; | |
| 485 | unique_ptr& operator=(nullptr_t) noexcept; | |
| 488 | constexpr unique_ptr& operator=(unique_ptr&& u) noexcept; // constexpr since C++23 | |
| 489 | template <class U, class E> | |
| 490 | constexpr unique_ptr& operator=(unique_ptr <U, E>&& u) noexcept; // constexpr since C++23 | |
| 491 | constexpr unique_ptr& operator=(nullptr_t) noexcept; // constexpr since C++23 | |
| 486 | 492 | |
| 487 | 493 | // observers |
| 488 | T& operator[](size_t i) const; | |
| 489 | pointer get() const noexcept; | |
| 490 | deleter_type& get_deleter() noexcept; | |
| 491 | const deleter_type& get_deleter() const noexcept; | |
| 492 | explicit operator bool() const noexcept; | |
| 494 | constexpr T& operator[](size_t i) const; // constexpr since C++23 | |
| 495 | constexpr pointer get() const noexcept; // constexpr since C++23 | |
| 496 | constexpr deleter_type& get_deleter() noexcept; // constexpr since C++23 | |
| 497 | constexpr const deleter_type& get_deleter() const noexcept; // constexpr since C++23 | |
| 498 | constexpr explicit operator bool() const noexcept; // constexpr since C++23 | |
| 493 | 499 | |
| 494 | 500 | // modifiers |
| 495 | pointer release() noexcept; | |
| 496 | void reset(pointer p = pointer()) noexcept; | |
| 497 | void reset(nullptr_t) noexcept; | |
| 501 | constexpr pointer release() noexcept; // constexpr since C++23 | |
| 502 | constexpr void reset(pointer p = pointer()) noexcept; // constexpr since C++23 | |
| 503 | constexpr void reset(nullptr_t) noexcept; // constexpr since C++23 | |
| 498 | 504 | template <class U> void reset(U) = delete; |
| 499 | void swap(unique_ptr& u) noexcept; | |
| 505 | constexpr void swap(unique_ptr& u) noexcept; // constexpr since C++23 | |
| 500 | 506 | }; |
| 501 | 507 | |
| 502 | 508 | template <class T, class D> |
| 503 | void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept; | |
| 509 | constexpr void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept; // constexpr since C++23 | |
| 504 | 510 | |
| 505 | 511 | template <class T1, class D1, class T2, class D2> |
| 506 | bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); | |
| 512 | constexpr bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); // constexpr since C++23 | |
| 507 | 513 | template <class T1, class D1, class T2, class D2> |
| 508 | bool operator!=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); | |
| 514 | bool operator!=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); // removed in C++20 | |
| 509 | 515 | template <class T1, class D1, class T2, class D2> |
| 510 | 516 | bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); |
| 511 | 517 | template <class T1, class D1, class T2, class D2> |
| ... | ... | @@ -514,32 +520,42 @@ template <class T1, class D1, class T2, class D2> |
| 514 | 520 | bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); |
| 515 | 521 | template <class T1, class D1, class T2, class D2> |
| 516 | 522 | bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); |
| 523 | template<class T1, class D1, class T2, class D2> | |
| 524 | requires three_way_comparable_with<typename unique_ptr<T1, D1>::pointer, | |
| 525 | typename unique_ptr<T2, D2>::pointer> | |
| 526 | compare_three_way_result_t<typename unique_ptr<T1, D1>::pointer, | |
| 527 | typename unique_ptr<T2, D2>::pointer> | |
| 528 | operator<=>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); // C++20 | |
| 517 | 529 | |
| 518 | 530 | template <class T, class D> |
| 519 | bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept; | |
| 531 | constexpr bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept; // constexpr since C++23 | |
| 520 | 532 | template <class T, class D> |
| 521 | bool operator==(nullptr_t, const unique_ptr<T, D>& y) noexcept; | |
| 533 | bool operator==(nullptr_t, const unique_ptr<T, D>& y) noexcept; // removed in C++20 | |
| 522 | 534 | template <class T, class D> |
| 523 | bool operator!=(const unique_ptr<T, D>& x, nullptr_t) noexcept; | |
| 535 | bool operator!=(const unique_ptr<T, D>& x, nullptr_t) noexcept; // removed in C++20 | |
| 524 | 536 | template <class T, class D> |
| 525 | bool operator!=(nullptr_t, const unique_ptr<T, D>& y) noexcept; | |
| 537 | bool operator!=(nullptr_t, const unique_ptr<T, D>& y) noexcept; // removed in C++20 | |
| 526 | 538 | |
| 527 | 539 | template <class T, class D> |
| 528 | bool operator<(const unique_ptr<T, D>& x, nullptr_t); | |
| 540 | constexpr bool operator<(const unique_ptr<T, D>& x, nullptr_t); // constexpr since C++23 | |
| 529 | 541 | template <class T, class D> |
| 530 | bool operator<(nullptr_t, const unique_ptr<T, D>& y); | |
| 542 | constexpr bool operator<(nullptr_t, const unique_ptr<T, D>& y); // constexpr since C++23 | |
| 531 | 543 | template <class T, class D> |
| 532 | bool operator<=(const unique_ptr<T, D>& x, nullptr_t); | |
| 544 | constexpr bool operator<=(const unique_ptr<T, D>& x, nullptr_t); // constexpr since C++23 | |
| 533 | 545 | template <class T, class D> |
| 534 | bool operator<=(nullptr_t, const unique_ptr<T, D>& y); | |
| 546 | constexpr bool operator<=(nullptr_t, const unique_ptr<T, D>& y); // constexpr since C++23 | |
| 535 | 547 | template <class T, class D> |
| 536 | bool operator>(const unique_ptr<T, D>& x, nullptr_t); | |
| 548 | constexpr bool operator>(const unique_ptr<T, D>& x, nullptr_t); // constexpr since C++23 | |
| 537 | 549 | template <class T, class D> |
| 538 | bool operator>(nullptr_t, const unique_ptr<T, D>& y); | |
| 550 | constexpr bool operator>(nullptr_t, const unique_ptr<T, D>& y); // constexpr since C++23 | |
| 539 | 551 | template <class T, class D> |
| 540 | bool operator>=(const unique_ptr<T, D>& x, nullptr_t); | |
| 552 | constexpr bool operator>=(const unique_ptr<T, D>& x, nullptr_t); // constexpr since C++23 | |
| 541 | 553 | template <class T, class D> |
| 542 | bool operator>=(nullptr_t, const unique_ptr<T, D>& y); | |
| 554 | constexpr bool operator>=(nullptr_t, const unique_ptr<T, D>& y); // constexpr since C++23 | |
| 555 | template<class T, class D> | |
| 556 | requires three_way_comparable<typename unique_ptr<T, D>::pointer> | |
| 557 | compare_three_way_result_t<typename unique_ptr<T, D>::pointer> | |
| 558 | constexpr operator<=>(const unique_ptr<T, D>& x, nullptr_t); // C++20, constexpr since C++23 | |
| 543 | 559 | |
| 544 | 560 | class bad_weak_ptr |
| 545 | 561 | : public std::exception |
| ... | ... | @@ -547,10 +563,19 @@ class bad_weak_ptr |
| 547 | 563 | bad_weak_ptr() noexcept; |
| 548 | 564 | }; |
| 549 | 565 | |
| 550 | template<class T, class... Args> unique_ptr<T> make_unique(Args&&... args); // C++14 | |
| 551 | template<class T> unique_ptr<T> make_unique(size_t n); // C++14 | |
| 566 | template<class T, class... Args> | |
| 567 | constexpr unique_ptr<T> make_unique(Args&&... args); // C++14, constexpr since C++23 | |
| 568 | template<class T> | |
| 569 | constexpr unique_ptr<T> make_unique(size_t n); // C++14, constexpr since C++23 | |
| 552 | 570 | template<class T, class... Args> unspecified make_unique(Args&&...) = delete; // C++14, T == U[N] |
| 553 | 571 | |
| 572 | template<class T> | |
| 573 | constexpr unique_ptr<T> make_unique_for_overwrite(); // T is not array, C++20, constexpr since C++23 | |
| 574 | template<class T> | |
| 575 | constexpr unique_ptr<T> make_unique_for_overwrite(size_t n); // T is U[], C++20, constexpr since C++23 | |
| 576 | template<class T, class... Args> | |
| 577 | unspecified make_unique_for_overwrite(Args&&...) = delete; // T is U[N], C++20 | |
| 578 | ||
| 554 | 579 | template<class E, class T, class Y, class D> |
| 555 | 580 | basic_ostream<E, T>& operator<< (basic_ostream<E, T>& os, unique_ptr<Y, D> const& p); |
| 556 | 581 | |
| ... | ... | @@ -617,40 +642,44 @@ shared_ptr(unique_ptr<T, D>) -> shared_ptr<T>; |
| 617 | 642 | template<class T, class U> |
| 618 | 643 | bool operator==(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; |
| 619 | 644 | template<class T, class U> |
| 620 | bool operator!=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; | |
| 645 | bool operator!=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; // removed in C++20 | |
| 646 | template<class T, class U> | |
| 647 | bool operator<(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; // removed in C++20 | |
| 621 | 648 | template<class T, class U> |
| 622 | bool operator<(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; | |
| 649 | bool operator>(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; // removed in C++20 | |
| 623 | 650 | template<class T, class U> |
| 624 | bool operator>(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; | |
| 651 | bool operator<=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; // removed in C++20 | |
| 625 | 652 | template<class T, class U> |
| 626 | bool operator<=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; | |
| 653 | bool operator>=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; // removed in C++20 | |
| 627 | 654 | template<class T, class U> |
| 628 | bool operator>=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; | |
| 655 | strong_ordering operator<=>(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept; // C++20 | |
| 629 | 656 | |
| 630 | 657 | template <class T> |
| 631 | 658 | bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept; |
| 632 | 659 | template <class T> |
| 633 | bool operator==(nullptr_t, const shared_ptr<T>& y) noexcept; | |
| 660 | bool operator==(nullptr_t, const shared_ptr<T>& y) noexcept; // removed in C++20 | |
| 634 | 661 | template <class T> |
| 635 | bool operator!=(const shared_ptr<T>& x, nullptr_t) noexcept; | |
| 662 | bool operator!=(const shared_ptr<T>& x, nullptr_t) noexcept; // removed in C++20 | |
| 636 | 663 | template <class T> |
| 637 | bool operator!=(nullptr_t, const shared_ptr<T>& y) noexcept; | |
| 664 | bool operator!=(nullptr_t, const shared_ptr<T>& y) noexcept; // removed in C++20 | |
| 638 | 665 | template <class T> |
| 639 | bool operator<(const shared_ptr<T>& x, nullptr_t) noexcept; | |
| 666 | bool operator<(const shared_ptr<T>& x, nullptr_t) noexcept; // removed in C++20 | |
| 640 | 667 | template <class T> |
| 641 | bool operator<(nullptr_t, const shared_ptr<T>& y) noexcept; | |
| 668 | bool operator<(nullptr_t, const shared_ptr<T>& y) noexcept; // removed in C++20 | |
| 642 | 669 | template <class T> |
| 643 | bool operator<=(const shared_ptr<T>& x, nullptr_t) noexcept; | |
| 670 | bool operator<=(const shared_ptr<T>& x, nullptr_t) noexcept; // removed in C++20 | |
| 644 | 671 | template <class T> |
| 645 | bool operator<=(nullptr_t, const shared_ptr<T>& y) noexcept; | |
| 672 | bool operator<=(nullptr_t, const shared_ptr<T>& y) noexcept; // removed in C++20 | |
| 646 | 673 | template <class T> |
| 647 | bool operator>(const shared_ptr<T>& x, nullptr_t) noexcept; | |
| 674 | bool operator>(const shared_ptr<T>& x, nullptr_t) noexcept; // removed in C++20 | |
| 648 | 675 | template <class T> |
| 649 | bool operator>(nullptr_t, const shared_ptr<T>& y) noexcept; | |
| 676 | bool operator>(nullptr_t, const shared_ptr<T>& y) noexcept; // removed in C++20 | |
| 650 | 677 | template <class T> |
| 651 | bool operator>=(const shared_ptr<T>& x, nullptr_t) noexcept; | |
| 678 | bool operator>=(const shared_ptr<T>& x, nullptr_t) noexcept; // removed in C++20 | |
| 652 | 679 | template <class T> |
| 653 | bool operator>=(nullptr_t, const shared_ptr<T>& y) noexcept; | |
| 680 | bool operator>=(nullptr_t, const shared_ptr<T>& y) noexcept; // removed in C++20 | |
| 681 | template<class T> | |
| 682 | strong_ordering operator<=>(shared_ptr<T> const& x, nullptr_t) noexcept; // C++20 | |
| 654 | 683 | |
| 655 | 684 | // shared_ptr specialized algorithms: |
| 656 | 685 | template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept; |
| ... | ... | @@ -695,6 +724,16 @@ template<class T> shared_ptr<T> |
| 695 | 724 | template<class T, class A> |
| 696 | 725 | shared_ptr<T> allocate_shared(const A& a, const remove_extent_t<T>& u); // T is U[N] (since C++20) |
| 697 | 726 | |
| 727 | template<class T> | |
| 728 | shared_ptr<T> make_shared_for_overwrite(); // T is not U[], C++20 | |
| 729 | template<class T, class A> | |
| 730 | shared_ptr<T> allocate_shared_for_overwrite(const A& a); // T is not U[], C++20 | |
| 731 | ||
| 732 | template<class T> | |
| 733 | shared_ptr<T> make_shared_for_overwrite(size_t N); // T is U[], C++20 | |
| 734 | template<class T, class A> | |
| 735 | shared_ptr<T> allocate_shared_for_overwrite(const A& a, size_t N); // T is U[], C++20 | |
| 736 | ||
| 698 | 737 | template<class T> |
| 699 | 738 | class weak_ptr |
| 700 | 739 | { |
| ... | ... | @@ -838,11 +877,10 @@ template<size_t N, class T> |
| 838 | 877 | |
| 839 | 878 | */ |
| 840 | 879 | |
| 841 | #include <__algorithm/copy.h> | |
| 842 | #include <__algorithm/move.h> | |
| 843 | 880 | #include <__assert> // all public C++ headers provide the assertion handler |
| 844 | 881 | #include <__config> |
| 845 | 882 | #include <__memory/addressof.h> |
| 883 | #include <__memory/align.h> | |
| 846 | 884 | #include <__memory/allocate_at_least.h> |
| 847 | 885 | #include <__memory/allocation_guard.h> |
| 848 | 886 | #include <__memory/allocator.h> |
| ... | ... | @@ -862,172 +900,35 @@ template<size_t N, class T> |
| 862 | 900 | #include <__memory/uninitialized_algorithms.h> |
| 863 | 901 | #include <__memory/unique_ptr.h> |
| 864 | 902 | #include <__memory/uses_allocator.h> |
| 865 | #include <cstddef> | |
| 866 | #include <cstdint> | |
| 867 | #include <cstring> | |
| 868 | #include <iosfwd> | |
| 869 | #include <new> | |
| 870 | #include <stdexcept> | |
| 871 | #include <tuple> | |
| 872 | #include <type_traits> | |
| 873 | #include <typeinfo> | |
| 903 | #include <__memory/uses_allocator_construction.h> | |
| 874 | 904 | #include <version> |
| 875 | 905 | |
| 876 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 877 | # include <iterator> | |
| 878 | # include <utility> | |
| 879 | #endif | |
| 880 | ||
| 881 | 906 | // standard-mandated includes |
| 907 | ||
| 908 | // [memory.syn] | |
| 882 | 909 | #include <compare> |
| 883 | 910 | |
| 884 | 911 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 885 | 912 | # pragma GCC system_header |
| 886 | 913 | #endif |
| 887 | 914 | |
| 888 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 889 | ||
| 890 | struct __destruct_n | |
| 891 | { | |
| 892 | private: | |
| 893 | size_t __size_; | |
| 894 | ||
| 895 | template <class _Tp> | |
| 896 | _LIBCPP_INLINE_VISIBILITY void __process(_Tp* __p, false_type) _NOEXCEPT | |
| 897 | {for (size_t __i = 0; __i < __size_; ++__i, ++__p) __p->~_Tp();} | |
| 898 | ||
| 899 | template <class _Tp> | |
| 900 | _LIBCPP_INLINE_VISIBILITY void __process(_Tp*, true_type) _NOEXCEPT | |
| 901 | {} | |
| 902 | ||
| 903 | _LIBCPP_INLINE_VISIBILITY void __incr(false_type) _NOEXCEPT | |
| 904 | {++__size_;} | |
| 905 | _LIBCPP_INLINE_VISIBILITY void __incr(true_type) _NOEXCEPT | |
| 906 | {} | |
| 907 | ||
| 908 | _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, false_type) _NOEXCEPT | |
| 909 | {__size_ = __s;} | |
| 910 | _LIBCPP_INLINE_VISIBILITY void __set(size_t, true_type) _NOEXCEPT | |
| 911 | {} | |
| 912 | public: | |
| 913 | _LIBCPP_INLINE_VISIBILITY explicit __destruct_n(size_t __s) _NOEXCEPT | |
| 914 | : __size_(__s) {} | |
| 915 | ||
| 916 | template <class _Tp> | |
| 917 | _LIBCPP_INLINE_VISIBILITY void __incr() _NOEXCEPT | |
| 918 | {__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());} | |
| 919 | ||
| 920 | template <class _Tp> | |
| 921 | _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, _Tp*) _NOEXCEPT | |
| 922 | {__set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());} | |
| 923 | ||
| 924 | template <class _Tp> | |
| 925 | _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __p) _NOEXCEPT | |
| 926 | {__process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());} | |
| 927 | }; | |
| 928 | ||
| 929 | _LIBCPP_FUNC_VIS void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space); | |
| 930 | ||
| 931 | template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> > | |
| 932 | struct __noexcept_move_assign_container : public integral_constant<bool, | |
| 933 | _Traits::propagate_on_container_move_assignment::value | |
| 934 | #if _LIBCPP_STD_VER > 14 | |
| 935 | || _Traits::is_always_equal::value | |
| 936 | #else | |
| 937 | && is_nothrow_move_assignable<_Alloc>::value | |
| 938 | #endif | |
| 939 | > {}; | |
| 940 | ||
| 941 | ||
| 942 | template <class _Tp, class _Alloc> | |
| 943 | struct __temp_value { | |
| 944 | typedef allocator_traits<_Alloc> _Traits; | |
| 945 | ||
| 946 | #ifdef _LIBCPP_CXX03_LANG | |
| 947 | typename aligned_storage<sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)>::type __v; | |
| 948 | #else | |
| 949 | union { _Tp __v; }; | |
| 950 | #endif | |
| 951 | _Alloc &__a; | |
| 952 | ||
| 953 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp *__addr() { | |
| 954 | #ifdef _LIBCPP_CXX03_LANG | |
| 955 | return reinterpret_cast<_Tp*>(std::addressof(__v)); | |
| 956 | #else | |
| 957 | return std::addressof(__v); | |
| 958 | #endif | |
| 959 | } | |
| 960 | ||
| 961 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp & get() { return *__addr(); } | |
| 962 | ||
| 963 | template<class... _Args> | |
| 964 | _LIBCPP_NO_CFI | |
| 965 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc) { | |
| 966 | _Traits::construct(__a, __addr(), std::forward<_Args>(__args)...); | |
| 967 | } | |
| 968 | ||
| 969 | _LIBCPP_CONSTEXPR_AFTER_CXX17 ~__temp_value() { _Traits::destroy(__a, __addr()); } | |
| 970 | }; | |
| 971 | ||
| 972 | template<typename _Alloc, typename = void, typename = void> | |
| 973 | struct __is_allocator : false_type {}; | |
| 974 | ||
| 975 | template<typename _Alloc> | |
| 976 | struct __is_allocator<_Alloc, | |
| 977 | typename __void_t<typename _Alloc::value_type>::type, | |
| 978 | typename __void_t<decltype(declval<_Alloc&>().allocate(size_t(0)))>::type | |
| 979 | > | |
| 980 | : true_type {}; | |
| 981 | ||
| 982 | // __builtin_new_allocator -- A non-templated helper for allocating and | |
| 983 | // deallocating memory using __builtin_operator_new and | |
| 984 | // __builtin_operator_delete. It should be used in preference to | |
| 985 | // `std::allocator<T>` to avoid additional instantiations. | |
| 986 | struct __builtin_new_allocator { | |
| 987 | struct __builtin_new_deleter { | |
| 988 | typedef void* pointer_type; | |
| 989 | ||
| 990 | _LIBCPP_CONSTEXPR explicit __builtin_new_deleter(size_t __size, size_t __align) | |
| 991 | : __size_(__size), __align_(__align) {} | |
| 992 | ||
| 993 | void operator()(void* __p) const _NOEXCEPT { | |
| 994 | _VSTD::__libcpp_deallocate(__p, __size_, __align_); | |
| 995 | } | |
| 996 | ||
| 997 | private: | |
| 998 | size_t __size_; | |
| 999 | size_t __align_; | |
| 1000 | }; | |
| 1001 | ||
| 1002 | typedef unique_ptr<void, __builtin_new_deleter> __holder_t; | |
| 1003 | ||
| 1004 | static __holder_t __allocate_bytes(size_t __s, size_t __align) { | |
| 1005 | return __holder_t(_VSTD::__libcpp_allocate(__s, __align), | |
| 1006 | __builtin_new_deleter(__s, __align)); | |
| 1007 | } | |
| 1008 | ||
| 1009 | static void __deallocate_bytes(void* __p, size_t __s, | |
| 1010 | size_t __align) _NOEXCEPT { | |
| 1011 | _VSTD::__libcpp_deallocate(__p, __s, __align); | |
| 1012 | } | |
| 1013 | ||
| 1014 | template <class _Tp> | |
| 1015 | _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE | |
| 1016 | static __holder_t __allocate_type(size_t __n) { | |
| 1017 | return __allocate_bytes(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); | |
| 1018 | } | |
| 1019 | ||
| 1020 | template <class _Tp> | |
| 1021 | _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE | |
| 1022 | static void __deallocate_type(void* __p, size_t __n) _NOEXCEPT { | |
| 1023 | __deallocate_bytes(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); | |
| 1024 | } | |
| 1025 | }; | |
| 1026 | ||
| 1027 | _LIBCPP_END_NAMESPACE_STD | |
| 1028 | ||
| 1029 | 915 | #if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 |
| 1030 | 916 | # include <__pstl_memory> |
| 1031 | 917 | #endif |
| 1032 | 918 | |
| 919 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 920 | # include <concepts> | |
| 921 | # include <cstddef> | |
| 922 | # include <cstdint> | |
| 923 | # include <cstring> | |
| 924 | # include <iosfwd> | |
| 925 | # include <iterator> | |
| 926 | # include <new> | |
| 927 | # include <stdexcept> | |
| 928 | # include <tuple> | |
| 929 | # include <type_traits> | |
| 930 | # include <typeinfo> | |
| 931 | # include <utility> | |
| 932 | #endif | |
| 933 | ||
| 1033 | 934 | #endif // _LIBCPP_MEMORY |
lib/libcxx/include/memory_resource created+65| ... | ... | @@ -0,0 +1,65 @@ |
| 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_MEMORY_RESOURCE | |
| 11 | #define _LIBCPP_MEMORY_RESOURCE | |
| 12 | ||
| 13 | /** | |
| 14 | memory_resource synopsis | |
| 15 | ||
| 16 | // C++17 | |
| 17 | ||
| 18 | namespace std::pmr { | |
| 19 | ||
| 20 | class memory_resource; | |
| 21 | ||
| 22 | bool operator==(const memory_resource& a, | |
| 23 | const memory_resource& b) noexcept; | |
| 24 | bool operator!=(const memory_resource& a, | |
| 25 | const memory_resource& b) noexcept; | |
| 26 | ||
| 27 | template <class Tp> class polymorphic_allocator; | |
| 28 | ||
| 29 | template <class T1, class T2> | |
| 30 | bool operator==(const polymorphic_allocator<T1>& a, | |
| 31 | const polymorphic_allocator<T2>& b) noexcept; | |
| 32 | template <class T1, class T2> | |
| 33 | bool operator!=(const polymorphic_allocator<T1>& a, | |
| 34 | const polymorphic_allocator<T2>& b) noexcept; | |
| 35 | ||
| 36 | // Global memory resources | |
| 37 | memory_resource* set_default_resource(memory_resource* r) noexcept; | |
| 38 | memory_resource* get_default_resource() noexcept; | |
| 39 | memory_resource* new_delete_resource() noexcept; | |
| 40 | memory_resource* null_memory_resource() noexcept; | |
| 41 | ||
| 42 | // Pool resource classes | |
| 43 | struct pool_options; | |
| 44 | class synchronized_pool_resource; | |
| 45 | class unsynchronized_pool_resource; | |
| 46 | class monotonic_buffer_resource; | |
| 47 | ||
| 48 | } // namespace std::pmr | |
| 49 | ||
| 50 | */ | |
| 51 | ||
| 52 | #include <__config> | |
| 53 | #include <__memory_resource/memory_resource.h> | |
| 54 | #include <__memory_resource/monotonic_buffer_resource.h> | |
| 55 | #include <__memory_resource/polymorphic_allocator.h> | |
| 56 | #include <__memory_resource/pool_options.h> | |
| 57 | #include <__memory_resource/synchronized_pool_resource.h> | |
| 58 | #include <__memory_resource/unsynchronized_pool_resource.h> | |
| 59 | #include <version> | |
| 60 | ||
| 61 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 62 | # pragma GCC system_header | |
| 63 | #endif | |
| 64 | ||
| 65 | #endif /* _LIBCPP_MEMORY_RESOURCE */ |
lib/libcxx/include/mutex+19-16| ... | ... | @@ -188,20 +188,16 @@ template<class Callable, class ...Args> |
| 188 | 188 | |
| 189 | 189 | #include <__assert> // all public C++ headers provide the assertion handler |
| 190 | 190 | #include <__config> |
| 191 | #include <__memory/shared_ptr.h> | |
| 191 | 192 | #include <__mutex_base> |
| 192 | 193 | #include <__threading_support> |
| 193 | 194 | #include <__utility/forward.h> |
| 194 | 195 | #include <cstdint> |
| 195 | #include <memory> | |
| 196 | 196 | #ifndef _LIBCPP_CXX03_LANG |
| 197 | 197 | # include <tuple> |
| 198 | 198 | #endif |
| 199 | 199 | #include <version> |
| 200 | 200 | |
| 201 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 202 | # include <functional> | |
| 203 | #endif | |
| 204 | ||
| 205 | 201 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 206 | 202 | # pragma GCC system_header |
| 207 | 203 | #endif |
| ... | ... | @@ -329,7 +325,7 @@ recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration |
| 329 | 325 | } |
| 330 | 326 | |
| 331 | 327 | template <class _L0, class _L1> |
| 332 | int | |
| 328 | _LIBCPP_HIDE_FROM_ABI int | |
| 333 | 329 | try_lock(_L0& __l0, _L1& __l1) |
| 334 | 330 | { |
| 335 | 331 | unique_lock<_L0> __u0(__l0, try_to_lock); |
| ... | ... | @@ -349,14 +345,14 @@ try_lock(_L0& __l0, _L1& __l1) |
| 349 | 345 | #ifndef _LIBCPP_CXX03_LANG |
| 350 | 346 | |
| 351 | 347 | template <class _L0, class _L1, class _L2, class... _L3> |
| 352 | int | |
| 348 | _LIBCPP_HIDE_FROM_ABI int | |
| 353 | 349 | try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) |
| 354 | 350 | { |
| 355 | 351 | int __r = 0; |
| 356 | 352 | unique_lock<_L0> __u0(__l0, try_to_lock); |
| 357 | 353 | if (__u0.owns_lock()) |
| 358 | 354 | { |
| 359 | __r = try_lock(__l1, __l2, __l3...); | |
| 355 | __r = std::try_lock(__l1, __l2, __l3...); | |
| 360 | 356 | if (__r == -1) |
| 361 | 357 | __u0.release(); |
| 362 | 358 | else |
| ... | ... | @@ -368,7 +364,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) |
| 368 | 364 | #endif // _LIBCPP_CXX03_LANG |
| 369 | 365 | |
| 370 | 366 | template <class _L0, class _L1> |
| 371 | void | |
| 367 | _LIBCPP_HIDE_FROM_ABI void | |
| 372 | 368 | lock(_L0& __l0, _L1& __l1) |
| 373 | 369 | { |
| 374 | 370 | while (true) |
| ... | ... | @@ -407,7 +403,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3) |
| 407 | 403 | case 0: |
| 408 | 404 | { |
| 409 | 405 | unique_lock<_L0> __u0(__l0); |
| 410 | __i = try_lock(__l1, __l2, __l3...); | |
| 406 | __i = std::try_lock(__l1, __l2, __l3...); | |
| 411 | 407 | if (__i == -1) |
| 412 | 408 | { |
| 413 | 409 | __u0.release(); |
| ... | ... | @@ -420,7 +416,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3) |
| 420 | 416 | case 1: |
| 421 | 417 | { |
| 422 | 418 | unique_lock<_L1> __u1(__l1); |
| 423 | __i = try_lock(__l2, __l3..., __l0); | |
| 419 | __i = std::try_lock(__l2, __l3..., __l0); | |
| 424 | 420 | if (__i == -1) |
| 425 | 421 | { |
| 426 | 422 | __u1.release(); |
| ... | ... | @@ -434,7 +430,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3) |
| 434 | 430 | __libcpp_thread_yield(); |
| 435 | 431 | break; |
| 436 | 432 | default: |
| 437 | __lock_first(__i - 2, __l2, __l3..., __l0, __l1); | |
| 433 | std::__lock_first(__i - 2, __l2, __l3..., __l0, __l1); | |
| 438 | 434 | return; |
| 439 | 435 | } |
| 440 | 436 | } |
| ... | ... | @@ -445,7 +441,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 445 | 441 | void |
| 446 | 442 | lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3) |
| 447 | 443 | { |
| 448 | __lock_first(0, __l0, __l1, __l2, __l3...); | |
| 444 | std::__lock_first(0, __l0, __l1, __l2, __l3...); | |
| 449 | 445 | } |
| 450 | 446 | |
| 451 | 447 | template <class _L0> |
| ... | ... | @@ -546,6 +542,7 @@ private: |
| 546 | 542 | |
| 547 | 543 | _MutexTuple __t_; |
| 548 | 544 | }; |
| 545 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(scoped_lock); | |
| 549 | 546 | |
| 550 | 547 | #endif // _LIBCPP_STD_VER > 14 |
| 551 | 548 | #endif // !_LIBCPP_HAS_NO_THREADS |
| ... | ... | @@ -670,7 +667,7 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) |
| 670 | 667 | typedef tuple<_Callable&&, _Args&&...> _Gp; |
| 671 | 668 | _Gp __f(_VSTD::forward<_Callable>(__func), _VSTD::forward<_Args>(__args)...); |
| 672 | 669 | __call_once_param<_Gp> __p(__f); |
| 673 | __call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>); | |
| 670 | std::__call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>); | |
| 674 | 671 | } |
| 675 | 672 | } |
| 676 | 673 | |
| ... | ... | @@ -684,7 +681,7 @@ call_once(once_flag& __flag, _Callable& __func) |
| 684 | 681 | if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0)) |
| 685 | 682 | { |
| 686 | 683 | __call_once_param<_Callable> __p(__func); |
| 687 | __call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>); | |
| 684 | std::__call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>); | |
| 688 | 685 | } |
| 689 | 686 | } |
| 690 | 687 | |
| ... | ... | @@ -696,7 +693,7 @@ call_once(once_flag& __flag, const _Callable& __func) |
| 696 | 693 | if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0)) |
| 697 | 694 | { |
| 698 | 695 | __call_once_param<const _Callable> __p(__func); |
| 699 | __call_once(__flag.__state_, &__p, &__call_once_proxy<const _Callable>); | |
| 696 | std::__call_once(__flag.__state_, &__p, &__call_once_proxy<const _Callable>); | |
| 700 | 697 | } |
| 701 | 698 | } |
| 702 | 699 | |
| ... | ... | @@ -706,4 +703,10 @@ _LIBCPP_END_NAMESPACE_STD |
| 706 | 703 | |
| 707 | 704 | _LIBCPP_POP_MACROS |
| 708 | 705 | |
| 706 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 707 | # include <concepts> | |
| 708 | # include <functional> | |
| 709 | # include <type_traits> | |
| 710 | #endif | |
| 711 | ||
| 709 | 712 | #endif // _LIBCPP_MUTEX |
lib/libcxx/include/new+53-19| ... | ... | @@ -89,10 +89,12 @@ void operator delete[](void* ptr, void*) noexcept; |
| 89 | 89 | #include <__assert> // all public C++ headers provide the assertion handler |
| 90 | 90 | #include <__availability> |
| 91 | 91 | #include <__config> |
| 92 | #include <__type_traits/is_function.h> | |
| 93 | #include <__type_traits/is_same.h> | |
| 94 | #include <__type_traits/remove_cv.h> | |
| 92 | 95 | #include <cstddef> |
| 93 | 96 | #include <cstdlib> |
| 94 | 97 | #include <exception> |
| 95 | #include <type_traits> | |
| 96 | 98 | #include <version> |
| 97 | 99 | |
| 98 | 100 | #if defined(_LIBCPP_ABI_VCRUNTIME) |
| ... | ... | @@ -129,8 +131,8 @@ class _LIBCPP_EXCEPTION_ABI bad_alloc |
| 129 | 131 | { |
| 130 | 132 | public: |
| 131 | 133 | bad_alloc() _NOEXCEPT; |
| 132 | virtual ~bad_alloc() _NOEXCEPT; | |
| 133 | virtual const char* what() const _NOEXCEPT; | |
| 134 | ~bad_alloc() _NOEXCEPT override; | |
| 135 | const char* what() const _NOEXCEPT override; | |
| 134 | 136 | }; |
| 135 | 137 | |
| 136 | 138 | class _LIBCPP_EXCEPTION_ABI bad_array_new_length |
| ... | ... | @@ -138,15 +140,33 @@ class _LIBCPP_EXCEPTION_ABI bad_array_new_length |
| 138 | 140 | { |
| 139 | 141 | public: |
| 140 | 142 | bad_array_new_length() _NOEXCEPT; |
| 141 | virtual ~bad_array_new_length() _NOEXCEPT; | |
| 142 | virtual const char* what() const _NOEXCEPT; | |
| 143 | ~bad_array_new_length() _NOEXCEPT override; | |
| 144 | const char* what() const _NOEXCEPT override; | |
| 143 | 145 | }; |
| 144 | 146 | |
| 145 | 147 | typedef void (*new_handler)(); |
| 146 | 148 | _LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT; |
| 147 | 149 | _LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT; |
| 148 | 150 | |
| 149 | #endif // !_LIBCPP_ABI_VCRUNTIME | |
| 151 | #elif defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0 // !_LIBCPP_ABI_VCRUNTIME | |
| 152 | ||
| 153 | // When _HAS_EXCEPTIONS == 0, these complete definitions are needed, | |
| 154 | // since they would normally be provided in vcruntime_exception.h | |
| 155 | class bad_alloc : public exception { | |
| 156 | public: | |
| 157 | bad_alloc() noexcept : exception("bad allocation") {} | |
| 158 | ||
| 159 | private: | |
| 160 | friend class bad_array_new_length; | |
| 161 | ||
| 162 | bad_alloc(char const* const __message) noexcept : exception(__message) {} | |
| 163 | }; | |
| 164 | ||
| 165 | class bad_array_new_length : public bad_alloc { | |
| 166 | public: | |
| 167 | bad_array_new_length() noexcept : bad_alloc("bad array new length") {} | |
| 168 | }; | |
| 169 | #endif // defined(_LIBCPP_ABI_VCRUNTIME) && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0 | |
| 150 | 170 | |
| 151 | 171 | _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec |
| 152 | 172 | |
| ... | ... | @@ -277,9 +297,9 @@ _LIBCPP_INLINE_VISIBILITY |
| 277 | 297 | void __do_deallocate_handle_size(void *__ptr, size_t __size, _Args ...__args) { |
| 278 | 298 | #ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION |
| 279 | 299 | (void)__size; |
| 280 | return __libcpp_operator_delete(__ptr, __args...); | |
| 300 | return std::__libcpp_operator_delete(__ptr, __args...); | |
| 281 | 301 | #else |
| 282 | return __libcpp_operator_delete(__ptr, __size, __args...); | |
| 302 | return std::__libcpp_operator_delete(__ptr, __size, __args...); | |
| 283 | 303 | #endif |
| 284 | 304 | } |
| 285 | 305 | |
| ... | ... | @@ -319,16 +339,26 @@ inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate_unsized(void* __ptr, s |
| 319 | 339 | // chances are that you want to use `__libcpp_allocate` instead. |
| 320 | 340 | // |
| 321 | 341 | // Returns the allocated memory, or `nullptr` on failure. |
| 322 | inline _LIBCPP_INLINE_VISIBILITY | |
| 323 | void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) { | |
| 324 | #if defined(_LIBCPP_MSVCRT_LIKE) | |
| 325 | return ::_aligned_malloc(__size, __alignment); | |
| 326 | #else | |
| 327 | void* __result = nullptr; | |
| 328 | (void)::posix_memalign(&__result, __alignment, __size); | |
| 329 | // If posix_memalign fails, __result is unmodified so we still return `nullptr`. | |
| 330 | return __result; | |
| 331 | #endif | |
| 342 | inline _LIBCPP_INLINE_VISIBILITY void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) { | |
| 343 | # if defined(_LIBCPP_MSVCRT_LIKE) | |
| 344 | return ::_aligned_malloc(__size, __alignment); | |
| 345 | # elif _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC) | |
| 346 | // aligned_alloc() requires that __size is a multiple of __alignment, | |
| 347 | // but for C++ [new.delete.general], only states "if the value of an | |
| 348 | // alignment argument passed to any of these functions is not a valid | |
| 349 | // alignment value, the behavior is undefined". | |
| 350 | // To handle calls such as ::operator new(1, std::align_val_t(128)), we | |
| 351 | // round __size up to the next multiple of __alignment. | |
| 352 | size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1); | |
| 353 | // Rounding up could have wrapped around to zero, so we have to add another | |
| 354 | // max() ternary to the actual call site to avoid succeeded in that case. | |
| 355 | return ::aligned_alloc(__alignment, __size > __rounded_size ? __size : __rounded_size); | |
| 356 | # else | |
| 357 | void* __result = nullptr; | |
| 358 | (void)::posix_memalign(&__result, __alignment, __size); | |
| 359 | // If posix_memalign fails, __result is unmodified so we still return `nullptr`. | |
| 360 | return __result; | |
| 361 | # endif | |
| 332 | 362 | } |
| 333 | 363 | |
| 334 | 364 | inline _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -347,7 +377,7 @@ _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI |
| 347 | 377 | _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT |
| 348 | 378 | { |
| 349 | 379 | static_assert (!(is_function<_Tp>::value), "can't launder functions" ); |
| 350 | static_assert (!(is_same<void, typename remove_cv<_Tp>::type>::value), "can't launder cv-void" ); | |
| 380 | static_assert (!(is_same<void, __remove_cv_t<_Tp> >::value), "can't launder cv-void" ); | |
| 351 | 381 | return __builtin_launder(__p); |
| 352 | 382 | } |
| 353 | 383 | |
| ... | ... | @@ -373,4 +403,8 @@ inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUC |
| 373 | 403 | |
| 374 | 404 | _LIBCPP_END_NAMESPACE_STD |
| 375 | 405 | |
| 406 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 407 | # include <type_traits> | |
| 408 | #endif | |
| 409 | ||
| 376 | 410 | #endif // _LIBCPP_NEW |
lib/libcxx/include/numbers+6-2| ... | ... | @@ -59,9 +59,8 @@ namespace std::numbers { |
| 59 | 59 | */ |
| 60 | 60 | |
| 61 | 61 | #include <__assert> // all public C++ headers provide the assertion handler |
| 62 | #include <__concepts/arithmetic.h> | |
| 62 | 63 | #include <__config> |
| 63 | #include <concepts> | |
| 64 | #include <type_traits> | |
| 65 | 64 | #include <version> |
| 66 | 65 | |
| 67 | 66 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -131,4 +130,9 @@ _LIBCPP_END_NAMESPACE_STD |
| 131 | 130 | |
| 132 | 131 | #endif // _LIBCPP_STD_VER > 17 |
| 133 | 132 | |
| 133 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 134 | # include <concepts> | |
| 135 | # include <type_traits> | |
| 136 | #endif | |
| 137 | ||
| 134 | 138 | #endif // _LIBCPP_NUMBERS |
lib/libcxx/include/numeric+7-5| ... | ... | @@ -163,11 +163,6 @@ template<class T> |
| 163 | 163 | #include <__numeric/transform_inclusive_scan.h> |
| 164 | 164 | #include <__numeric/transform_reduce.h> |
| 165 | 165 | |
| 166 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 167 | # include <functional> | |
| 168 | # include <iterator> | |
| 169 | #endif | |
| 170 | ||
| 171 | 166 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 172 | 167 | # pragma GCC system_header |
| 173 | 168 | #endif |
| ... | ... | @@ -176,4 +171,11 @@ template<class T> |
| 176 | 171 | # include <__pstl_numeric> |
| 177 | 172 | #endif |
| 178 | 173 | |
| 174 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 175 | # include <concepts> | |
| 176 | # include <functional> | |
| 177 | # include <iterator> | |
| 178 | # include <type_traits> | |
| 179 | #endif | |
| 180 | ||
| 179 | 181 | #endif // _LIBCPP_NUMERIC |
lib/libcxx/include/optional+96-95| ... | ... | @@ -87,8 +87,8 @@ namespace std { |
| 87 | 87 | // 23.6.3.1, constructors |
| 88 | 88 | constexpr optional() noexcept; |
| 89 | 89 | constexpr optional(nullopt_t) noexcept; |
| 90 | optional(const optional &); | |
| 91 | optional(optional &&) noexcept(see below); | |
| 90 | constexpr optional(const optional &); | |
| 91 | constexpr optional(optional &&) noexcept(see below); | |
| 92 | 92 | template <class... Args> constexpr explicit optional(in_place_t, Args &&...); |
| 93 | 93 | template <class U, class... Args> |
| 94 | 94 | constexpr explicit optional(in_place_t, initializer_list<U>, Args &&...); |
| ... | ... | @@ -104,8 +104,8 @@ namespace std { |
| 104 | 104 | |
| 105 | 105 | // 23.6.3.3, assignment |
| 106 | 106 | optional &operator=(nullopt_t) noexcept; // constexpr in C++20 |
| 107 | optional &operator=(const optional &); // constexpr in C++20 | |
| 108 | optional &operator=(optional &&) noexcept(see below); // constexpr in C++20 | |
| 107 | constexpr optional &operator=(const optional &); | |
| 108 | constexpr optional &operator=(optional &&) noexcept(see below); | |
| 109 | 109 | template <class U = T> optional &operator=(U &&); // constexpr in C++20 |
| 110 | 110 | template <class U> optional &operator=(const optional<U> &); // constexpr in C++20 |
| 111 | 111 | template <class U> optional &operator=(optional<U> &&); // constexpr in C++20 |
| ... | ... | @@ -166,7 +166,7 @@ template<class T> |
| 166 | 166 | #include <__functional/invoke.h> |
| 167 | 167 | #include <__functional/unary_function.h> |
| 168 | 168 | #include <__memory/construct_at.h> |
| 169 | #include <__tuple> | |
| 169 | #include <__tuple_dir/sfinae_helpers.h> | |
| 170 | 170 | #include <__utility/forward.h> |
| 171 | 171 | #include <__utility/in_place.h> |
| 172 | 172 | #include <__utility/move.h> |
| ... | ... | @@ -177,22 +177,9 @@ template<class T> |
| 177 | 177 | #include <type_traits> |
| 178 | 178 | #include <version> |
| 179 | 179 | |
| 180 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 181 | # include <atomic> | |
| 182 | # include <chrono> | |
| 183 | # include <climits> | |
| 184 | # include <concepts> | |
| 185 | # include <ctime> | |
| 186 | # include <iterator> | |
| 187 | # include <memory> | |
| 188 | # include <ratio> | |
| 189 | # include <tuple> | |
| 190 | # include <typeinfo> | |
| 191 | # include <utility> | |
| 192 | # include <variant> | |
| 193 | #endif | |
| 194 | ||
| 195 | 180 | // standard-mandated includes |
| 181 | ||
| 182 | // [optional.syn] | |
| 196 | 183 | #include <compare> |
| 197 | 184 | |
| 198 | 185 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -207,8 +194,8 @@ class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optiona |
| 207 | 194 | { |
| 208 | 195 | public: |
| 209 | 196 | // Get the key function ~bad_optional_access() into the dylib |
| 210 | virtual ~bad_optional_access() _NOEXCEPT; | |
| 211 | virtual const char* what() const _NOEXCEPT; | |
| 197 | ~bad_optional_access() _NOEXCEPT override; | |
| 198 | const char* what() const _NOEXCEPT override; | |
| 212 | 199 | }; |
| 213 | 200 | |
| 214 | 201 | } // namespace std |
| ... | ... | @@ -255,7 +242,7 @@ struct __optional_destruct_base<_Tp, false> |
| 255 | 242 | bool __engaged_; |
| 256 | 243 | |
| 257 | 244 | _LIBCPP_INLINE_VISIBILITY |
| 258 | _LIBCPP_CONSTEXPR_AFTER_CXX17 ~__optional_destruct_base() | |
| 245 | _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__optional_destruct_base() | |
| 259 | 246 | { |
| 260 | 247 | if (__engaged_) |
| 261 | 248 | __val_.~value_type(); |
| ... | ... | @@ -280,7 +267,7 @@ struct __optional_destruct_base<_Tp, false> |
| 280 | 267 | #endif |
| 281 | 268 | |
| 282 | 269 | _LIBCPP_INLINE_VISIBILITY |
| 283 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void reset() noexcept | |
| 270 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept | |
| 284 | 271 | { |
| 285 | 272 | if (__engaged_) |
| 286 | 273 | { |
| ... | ... | @@ -322,7 +309,7 @@ struct __optional_destruct_base<_Tp, true> |
| 322 | 309 | #endif |
| 323 | 310 | |
| 324 | 311 | _LIBCPP_INLINE_VISIBILITY |
| 325 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void reset() noexcept | |
| 312 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept | |
| 326 | 313 | { |
| 327 | 314 | if (__engaged_) |
| 328 | 315 | { |
| ... | ... | @@ -367,7 +354,7 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> |
| 367 | 354 | |
| 368 | 355 | template <class... _Args> |
| 369 | 356 | _LIBCPP_INLINE_VISIBILITY |
| 370 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct(_Args&&... __args) | |
| 357 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_Args&&... __args) | |
| 371 | 358 | { |
| 372 | 359 | _LIBCPP_ASSERT(!has_value(), "__construct called for engaged __optional_storage"); |
| 373 | 360 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -380,7 +367,7 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> |
| 380 | 367 | |
| 381 | 368 | template <class _That> |
| 382 | 369 | _LIBCPP_INLINE_VISIBILITY |
| 383 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct_from(_That&& __opt) | |
| 370 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt) | |
| 384 | 371 | { |
| 385 | 372 | if (__opt.has_value()) |
| 386 | 373 | __construct(_VSTD::forward<_That>(__opt).__get()); |
| ... | ... | @@ -388,7 +375,7 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> |
| 388 | 375 | |
| 389 | 376 | template <class _That> |
| 390 | 377 | _LIBCPP_INLINE_VISIBILITY |
| 391 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __assign_from(_That&& __opt) | |
| 378 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt) | |
| 392 | 379 | { |
| 393 | 380 | if (this->__engaged_ == __opt.has_value()) |
| 394 | 381 | { |
| ... | ... | @@ -417,14 +404,14 @@ struct __optional_storage_base<_Tp, true> |
| 417 | 404 | |
| 418 | 405 | template <class _Up> |
| 419 | 406 | static constexpr bool __can_bind_reference() { |
| 420 | using _RawUp = typename remove_reference<_Up>::type; | |
| 407 | using _RawUp = __libcpp_remove_reference_t<_Up>; | |
| 421 | 408 | using _UpPtr = _RawUp*; |
| 422 | using _RawTp = typename remove_reference<_Tp>::type; | |
| 409 | using _RawTp = __libcpp_remove_reference_t<_Tp>; | |
| 423 | 410 | using _TpPtr = _RawTp*; |
| 424 | 411 | using _CheckLValueArg = integral_constant<bool, |
| 425 | 412 | (is_lvalue_reference<_Up>::value && is_convertible<_UpPtr, _TpPtr>::value) |
| 426 | 413 | || is_same<_RawUp, reference_wrapper<_RawTp>>::value |
| 427 | || is_same<_RawUp, reference_wrapper<typename remove_const<_RawTp>::type>>::value | |
| 414 | || is_same<_RawUp, reference_wrapper<__remove_const_t<_RawTp>>>::value | |
| 428 | 415 | >; |
| 429 | 416 | return (is_lvalue_reference<_Tp>::value && _CheckLValueArg::value) |
| 430 | 417 | || (is_rvalue_reference<_Tp>::value && !is_lvalue_reference<_Up>::value && |
| ... | ... | @@ -446,7 +433,7 @@ struct __optional_storage_base<_Tp, true> |
| 446 | 433 | } |
| 447 | 434 | |
| 448 | 435 | _LIBCPP_INLINE_VISIBILITY |
| 449 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void reset() noexcept { __value_ = nullptr; } | |
| 436 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; } | |
| 450 | 437 | |
| 451 | 438 | _LIBCPP_INLINE_VISIBILITY |
| 452 | 439 | constexpr bool has_value() const noexcept |
| ... | ... | @@ -462,7 +449,7 @@ struct __optional_storage_base<_Tp, true> |
| 462 | 449 | |
| 463 | 450 | template <class _UArg> |
| 464 | 451 | _LIBCPP_INLINE_VISIBILITY |
| 465 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct(_UArg&& __val) | |
| 452 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val) | |
| 466 | 453 | { |
| 467 | 454 | _LIBCPP_ASSERT(!has_value(), "__construct called for engaged __optional_storage"); |
| 468 | 455 | static_assert(__can_bind_reference<_UArg>(), |
| ... | ... | @@ -473,7 +460,7 @@ struct __optional_storage_base<_Tp, true> |
| 473 | 460 | |
| 474 | 461 | template <class _That> |
| 475 | 462 | _LIBCPP_INLINE_VISIBILITY |
| 476 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct_from(_That&& __opt) | |
| 463 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt) | |
| 477 | 464 | { |
| 478 | 465 | if (__opt.has_value()) |
| 479 | 466 | __construct(_VSTD::forward<_That>(__opt).__get()); |
| ... | ... | @@ -481,7 +468,7 @@ struct __optional_storage_base<_Tp, true> |
| 481 | 468 | |
| 482 | 469 | template <class _That> |
| 483 | 470 | _LIBCPP_INLINE_VISIBILITY |
| 484 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __assign_from(_That&& __opt) | |
| 471 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt) | |
| 485 | 472 | { |
| 486 | 473 | if (has_value() == __opt.has_value()) |
| 487 | 474 | { |
| ... | ... | @@ -513,7 +500,7 @@ struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> |
| 513 | 500 | __optional_copy_base() = default; |
| 514 | 501 | |
| 515 | 502 | _LIBCPP_INLINE_VISIBILITY |
| 516 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __optional_copy_base(const __optional_copy_base& __opt) | |
| 503 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_base(const __optional_copy_base& __opt) | |
| 517 | 504 | { |
| 518 | 505 | this->__construct_from(__opt); |
| 519 | 506 | } |
| ... | ... | @@ -544,7 +531,7 @@ struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp> |
| 544 | 531 | __optional_move_base(const __optional_move_base&) = default; |
| 545 | 532 | |
| 546 | 533 | _LIBCPP_INLINE_VISIBILITY |
| 547 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __optional_move_base(__optional_move_base&& __opt) | |
| 534 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_move_base(__optional_move_base&& __opt) | |
| 548 | 535 | noexcept(is_nothrow_move_constructible_v<value_type>) |
| 549 | 536 | { |
| 550 | 537 | this->__construct_from(_VSTD::move(__opt)); |
| ... | ... | @@ -578,7 +565,7 @@ struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp> |
| 578 | 565 | __optional_copy_assign_base(__optional_copy_assign_base&&) = default; |
| 579 | 566 | |
| 580 | 567 | _LIBCPP_INLINE_VISIBILITY |
| 581 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __optional_copy_assign_base& operator=(const __optional_copy_assign_base& __opt) | |
| 568 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_assign_base& operator=(const __optional_copy_assign_base& __opt) | |
| 582 | 569 | { |
| 583 | 570 | this->__assign_from(__opt); |
| 584 | 571 | return *this; |
| ... | ... | @@ -613,7 +600,7 @@ struct __optional_move_assign_base<_Tp, false> : __optional_copy_assign_base<_Tp |
| 613 | 600 | __optional_move_assign_base& operator=(const __optional_move_assign_base&) = default; |
| 614 | 601 | |
| 615 | 602 | _LIBCPP_INLINE_VISIBILITY |
| 616 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __optional_move_assign_base& operator=(__optional_move_assign_base&& __opt) | |
| 603 | _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_move_assign_base& operator=(__optional_move_assign_base&& __opt) | |
| 617 | 604 | noexcept(is_nothrow_move_assignable_v<value_type> && |
| 618 | 605 | is_nothrow_move_constructible_v<value_type>) |
| 619 | 606 | { |
| ... | ... | @@ -652,9 +639,9 @@ public: |
| 652 | 639 | |
| 653 | 640 | private: |
| 654 | 641 | // Disable the reference extension using this static assert. |
| 655 | static_assert(!is_same_v<__uncvref_t<value_type>, in_place_t>, | |
| 642 | static_assert(!is_same_v<__remove_cvref_t<value_type>, in_place_t>, | |
| 656 | 643 | "instantiation of optional with in_place_t is ill-formed"); |
| 657 | static_assert(!is_same_v<__uncvref_t<value_type>, nullopt_t>, | |
| 644 | static_assert(!is_same_v<__remove_cvref_t<value_type>, nullopt_t>, | |
| 658 | 645 | "instantiation of optional with nullopt_t is ill-formed"); |
| 659 | 646 | static_assert(!is_reference_v<value_type>, |
| 660 | 647 | "instantiation of optional with a reference type is ill-formed"); |
| ... | ... | @@ -679,8 +666,8 @@ private: |
| 679 | 666 | }; |
| 680 | 667 | template <class _Up> |
| 681 | 668 | using _CheckOptionalArgsCtor = _If< |
| 682 | _IsNotSame<__uncvref_t<_Up>, in_place_t>::value && | |
| 683 | _IsNotSame<__uncvref_t<_Up>, optional>::value, | |
| 669 | _IsNotSame<__remove_cvref_t<_Up>, in_place_t>::value && | |
| 670 | _IsNotSame<__remove_cvref_t<_Up>, optional>::value, | |
| 684 | 671 | _CheckOptionalArgsConstructor, |
| 685 | 672 | __check_tuple_constructor_fail |
| 686 | 673 | >; |
| ... | ... | @@ -787,7 +774,7 @@ public: |
| 787 | 774 | _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>() |
| 788 | 775 | , int> = 0> |
| 789 | 776 | _LIBCPP_INLINE_VISIBILITY |
| 790 | _LIBCPP_CONSTEXPR_AFTER_CXX17 optional(const optional<_Up>& __v) | |
| 777 | _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v) | |
| 791 | 778 | { |
| 792 | 779 | this->__construct_from(__v); |
| 793 | 780 | } |
| ... | ... | @@ -795,7 +782,7 @@ public: |
| 795 | 782 | _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>() |
| 796 | 783 | , int> = 0> |
| 797 | 784 | _LIBCPP_INLINE_VISIBILITY |
| 798 | _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit optional(const optional<_Up>& __v) | |
| 785 | _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v) | |
| 799 | 786 | { |
| 800 | 787 | this->__construct_from(__v); |
| 801 | 788 | } |
| ... | ... | @@ -805,7 +792,7 @@ public: |
| 805 | 792 | _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_implicit<_Up>() |
| 806 | 793 | , int> = 0> |
| 807 | 794 | _LIBCPP_INLINE_VISIBILITY |
| 808 | _LIBCPP_CONSTEXPR_AFTER_CXX17 optional(optional<_Up>&& __v) | |
| 795 | _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v) | |
| 809 | 796 | { |
| 810 | 797 | this->__construct_from(_VSTD::move(__v)); |
| 811 | 798 | } |
| ... | ... | @@ -813,7 +800,7 @@ public: |
| 813 | 800 | _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_explicit<_Up>() |
| 814 | 801 | , int> = 0> |
| 815 | 802 | _LIBCPP_INLINE_VISIBILITY |
| 816 | _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit optional(optional<_Up>&& __v) | |
| 803 | _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v) | |
| 817 | 804 | { |
| 818 | 805 | this->__construct_from(_VSTD::move(__v)); |
| 819 | 806 | } |
| ... | ... | @@ -827,22 +814,22 @@ public: |
| 827 | 814 | #endif |
| 828 | 815 | |
| 829 | 816 | _LIBCPP_INLINE_VISIBILITY |
| 830 | _LIBCPP_CONSTEXPR_AFTER_CXX17 optional& operator=(nullopt_t) noexcept | |
| 817 | _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(nullopt_t) noexcept | |
| 831 | 818 | { |
| 832 | 819 | reset(); |
| 833 | 820 | return *this; |
| 834 | 821 | } |
| 835 | 822 | |
| 836 | _LIBCPP_INLINE_VISIBILITY optional& operator=(const optional&) = default; | |
| 837 | _LIBCPP_INLINE_VISIBILITY optional& operator=(optional&&) = default; | |
| 823 | constexpr optional& operator=(const optional&) = default; | |
| 824 | constexpr optional& operator=(optional&&) = default; | |
| 838 | 825 | |
| 839 | 826 | // LWG2756 |
| 840 | 827 | template <class _Up = value_type, |
| 841 | 828 | class = enable_if_t< |
| 842 | 829 | _And< |
| 843 | _IsNotSame<__uncvref_t<_Up>, optional>, | |
| 830 | _IsNotSame<__remove_cvref_t<_Up>, optional>, | |
| 844 | 831 | _Or< |
| 845 | _IsNotSame<__uncvref_t<_Up>, value_type>, | |
| 832 | _IsNotSame<__remove_cvref_t<_Up>, value_type>, | |
| 846 | 833 | _Not<is_scalar<value_type>> |
| 847 | 834 | >, |
| 848 | 835 | is_constructible<value_type, _Up>, |
| ... | ... | @@ -850,7 +837,7 @@ public: |
| 850 | 837 | >::value> |
| 851 | 838 | > |
| 852 | 839 | _LIBCPP_INLINE_VISIBILITY |
| 853 | _LIBCPP_CONSTEXPR_AFTER_CXX17 optional& | |
| 840 | _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& | |
| 854 | 841 | operator=(_Up&& __v) |
| 855 | 842 | { |
| 856 | 843 | if (this->has_value()) |
| ... | ... | @@ -865,7 +852,7 @@ public: |
| 865 | 852 | _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>() |
| 866 | 853 | , int> = 0> |
| 867 | 854 | _LIBCPP_INLINE_VISIBILITY |
| 868 | _LIBCPP_CONSTEXPR_AFTER_CXX17 optional& | |
| 855 | _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& | |
| 869 | 856 | operator=(const optional<_Up>& __v) |
| 870 | 857 | { |
| 871 | 858 | this->__assign_from(__v); |
| ... | ... | @@ -877,7 +864,7 @@ public: |
| 877 | 864 | _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_assign<_Up>() |
| 878 | 865 | , int> = 0> |
| 879 | 866 | _LIBCPP_INLINE_VISIBILITY |
| 880 | _LIBCPP_CONSTEXPR_AFTER_CXX17 optional& | |
| 867 | _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& | |
| 881 | 868 | operator=(optional<_Up>&& __v) |
| 882 | 869 | { |
| 883 | 870 | this->__assign_from(_VSTD::move(__v)); |
| ... | ... | @@ -891,7 +878,7 @@ public: |
| 891 | 878 | > |
| 892 | 879 | > |
| 893 | 880 | _LIBCPP_INLINE_VISIBILITY |
| 894 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp & | |
| 881 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp & | |
| 895 | 882 | emplace(_Args&&... __args) |
| 896 | 883 | { |
| 897 | 884 | reset(); |
| ... | ... | @@ -906,7 +893,7 @@ public: |
| 906 | 893 | > |
| 907 | 894 | > |
| 908 | 895 | _LIBCPP_INLINE_VISIBILITY |
| 909 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp & | |
| 896 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp & | |
| 910 | 897 | emplace(initializer_list<_Up> __il, _Args&&... __args) |
| 911 | 898 | { |
| 912 | 899 | reset(); |
| ... | ... | @@ -915,7 +902,7 @@ public: |
| 915 | 902 | } |
| 916 | 903 | |
| 917 | 904 | _LIBCPP_INLINE_VISIBILITY |
| 918 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(optional& __opt) | |
| 905 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional& __opt) | |
| 919 | 906 | noexcept(is_nothrow_move_constructible_v<value_type> && |
| 920 | 907 | is_nothrow_swappable_v<value_type>) |
| 921 | 908 | { |
| ... | ... | @@ -1198,8 +1185,8 @@ template<class _Tp> |
| 1198 | 1185 | template <class _Tp, class _Up> |
| 1199 | 1186 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1200 | 1187 | enable_if_t< |
| 1201 | is_convertible_v<decltype(declval<const _Tp&>() == | |
| 1202 | declval<const _Up&>()), bool>, | |
| 1188 | is_convertible_v<decltype(std::declval<const _Tp&>() == | |
| 1189 | std::declval<const _Up&>()), bool>, | |
| 1203 | 1190 | bool |
| 1204 | 1191 | > |
| 1205 | 1192 | operator==(const optional<_Tp>& __x, const optional<_Up>& __y) |
| ... | ... | @@ -1214,8 +1201,8 @@ operator==(const optional<_Tp>& __x, const optional<_Up>& __y) |
| 1214 | 1201 | template <class _Tp, class _Up> |
| 1215 | 1202 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1216 | 1203 | enable_if_t< |
| 1217 | is_convertible_v<decltype(declval<const _Tp&>() != | |
| 1218 | declval<const _Up&>()), bool>, | |
| 1204 | is_convertible_v<decltype(std::declval<const _Tp&>() != | |
| 1205 | std::declval<const _Up&>()), bool>, | |
| 1219 | 1206 | bool |
| 1220 | 1207 | > |
| 1221 | 1208 | operator!=(const optional<_Tp>& __x, const optional<_Up>& __y) |
| ... | ... | @@ -1230,8 +1217,8 @@ operator!=(const optional<_Tp>& __x, const optional<_Up>& __y) |
| 1230 | 1217 | template <class _Tp, class _Up> |
| 1231 | 1218 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1232 | 1219 | enable_if_t< |
| 1233 | is_convertible_v<decltype(declval<const _Tp&>() < | |
| 1234 | declval<const _Up&>()), bool>, | |
| 1220 | is_convertible_v<decltype(std::declval<const _Tp&>() < | |
| 1221 | std::declval<const _Up&>()), bool>, | |
| 1235 | 1222 | bool |
| 1236 | 1223 | > |
| 1237 | 1224 | operator<(const optional<_Tp>& __x, const optional<_Up>& __y) |
| ... | ... | @@ -1246,8 +1233,8 @@ operator<(const optional<_Tp>& __x, const optional<_Up>& __y) |
| 1246 | 1233 | template <class _Tp, class _Up> |
| 1247 | 1234 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1248 | 1235 | enable_if_t< |
| 1249 | is_convertible_v<decltype(declval<const _Tp&>() > | |
| 1250 | declval<const _Up&>()), bool>, | |
| 1236 | is_convertible_v<decltype(std::declval<const _Tp&>() > | |
| 1237 | std::declval<const _Up&>()), bool>, | |
| 1251 | 1238 | bool |
| 1252 | 1239 | > |
| 1253 | 1240 | operator>(const optional<_Tp>& __x, const optional<_Up>& __y) |
| ... | ... | @@ -1262,8 +1249,8 @@ operator>(const optional<_Tp>& __x, const optional<_Up>& __y) |
| 1262 | 1249 | template <class _Tp, class _Up> |
| 1263 | 1250 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1264 | 1251 | enable_if_t< |
| 1265 | is_convertible_v<decltype(declval<const _Tp&>() <= | |
| 1266 | declval<const _Up&>()), bool>, | |
| 1252 | is_convertible_v<decltype(std::declval<const _Tp&>() <= | |
| 1253 | std::declval<const _Up&>()), bool>, | |
| 1267 | 1254 | bool |
| 1268 | 1255 | > |
| 1269 | 1256 | operator<=(const optional<_Tp>& __x, const optional<_Up>& __y) |
| ... | ... | @@ -1278,8 +1265,8 @@ operator<=(const optional<_Tp>& __x, const optional<_Up>& __y) |
| 1278 | 1265 | template <class _Tp, class _Up> |
| 1279 | 1266 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1280 | 1267 | enable_if_t< |
| 1281 | is_convertible_v<decltype(declval<const _Tp&>() >= | |
| 1282 | declval<const _Up&>()), bool>, | |
| 1268 | is_convertible_v<decltype(std::declval<const _Tp&>() >= | |
| 1269 | std::declval<const _Up&>()), bool>, | |
| 1283 | 1270 | bool |
| 1284 | 1271 | > |
| 1285 | 1272 | operator>=(const optional<_Tp>& __x, const optional<_Up>& __y) |
| ... | ... | @@ -1392,8 +1379,8 @@ operator>=(nullopt_t, const optional<_Tp>& __x) noexcept |
| 1392 | 1379 | template <class _Tp, class _Up> |
| 1393 | 1380 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1394 | 1381 | enable_if_t< |
| 1395 | is_convertible_v<decltype(declval<const _Tp&>() == | |
| 1396 | declval<const _Up&>()), bool>, | |
| 1382 | is_convertible_v<decltype(std::declval<const _Tp&>() == | |
| 1383 | std::declval<const _Up&>()), bool>, | |
| 1397 | 1384 | bool |
| 1398 | 1385 | > |
| 1399 | 1386 | operator==(const optional<_Tp>& __x, const _Up& __v) |
| ... | ... | @@ -1404,8 +1391,8 @@ operator==(const optional<_Tp>& __x, const _Up& __v) |
| 1404 | 1391 | template <class _Tp, class _Up> |
| 1405 | 1392 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1406 | 1393 | enable_if_t< |
| 1407 | is_convertible_v<decltype(declval<const _Tp&>() == | |
| 1408 | declval<const _Up&>()), bool>, | |
| 1394 | is_convertible_v<decltype(std::declval<const _Tp&>() == | |
| 1395 | std::declval<const _Up&>()), bool>, | |
| 1409 | 1396 | bool |
| 1410 | 1397 | > |
| 1411 | 1398 | operator==(const _Tp& __v, const optional<_Up>& __x) |
| ... | ... | @@ -1416,8 +1403,8 @@ operator==(const _Tp& __v, const optional<_Up>& __x) |
| 1416 | 1403 | template <class _Tp, class _Up> |
| 1417 | 1404 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1418 | 1405 | enable_if_t< |
| 1419 | is_convertible_v<decltype(declval<const _Tp&>() != | |
| 1420 | declval<const _Up&>()), bool>, | |
| 1406 | is_convertible_v<decltype(std::declval<const _Tp&>() != | |
| 1407 | std::declval<const _Up&>()), bool>, | |
| 1421 | 1408 | bool |
| 1422 | 1409 | > |
| 1423 | 1410 | operator!=(const optional<_Tp>& __x, const _Up& __v) |
| ... | ... | @@ -1428,8 +1415,8 @@ operator!=(const optional<_Tp>& __x, const _Up& __v) |
| 1428 | 1415 | template <class _Tp, class _Up> |
| 1429 | 1416 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1430 | 1417 | enable_if_t< |
| 1431 | is_convertible_v<decltype(declval<const _Tp&>() != | |
| 1432 | declval<const _Up&>()), bool>, | |
| 1418 | is_convertible_v<decltype(std::declval<const _Tp&>() != | |
| 1419 | std::declval<const _Up&>()), bool>, | |
| 1433 | 1420 | bool |
| 1434 | 1421 | > |
| 1435 | 1422 | operator!=(const _Tp& __v, const optional<_Up>& __x) |
| ... | ... | @@ -1440,8 +1427,8 @@ operator!=(const _Tp& __v, const optional<_Up>& __x) |
| 1440 | 1427 | template <class _Tp, class _Up> |
| 1441 | 1428 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1442 | 1429 | enable_if_t< |
| 1443 | is_convertible_v<decltype(declval<const _Tp&>() < | |
| 1444 | declval<const _Up&>()), bool>, | |
| 1430 | is_convertible_v<decltype(std::declval<const _Tp&>() < | |
| 1431 | std::declval<const _Up&>()), bool>, | |
| 1445 | 1432 | bool |
| 1446 | 1433 | > |
| 1447 | 1434 | operator<(const optional<_Tp>& __x, const _Up& __v) |
| ... | ... | @@ -1452,8 +1439,8 @@ operator<(const optional<_Tp>& __x, const _Up& __v) |
| 1452 | 1439 | template <class _Tp, class _Up> |
| 1453 | 1440 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1454 | 1441 | enable_if_t< |
| 1455 | is_convertible_v<decltype(declval<const _Tp&>() < | |
| 1456 | declval<const _Up&>()), bool>, | |
| 1442 | is_convertible_v<decltype(std::declval<const _Tp&>() < | |
| 1443 | std::declval<const _Up&>()), bool>, | |
| 1457 | 1444 | bool |
| 1458 | 1445 | > |
| 1459 | 1446 | operator<(const _Tp& __v, const optional<_Up>& __x) |
| ... | ... | @@ -1464,8 +1451,8 @@ operator<(const _Tp& __v, const optional<_Up>& __x) |
| 1464 | 1451 | template <class _Tp, class _Up> |
| 1465 | 1452 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1466 | 1453 | enable_if_t< |
| 1467 | is_convertible_v<decltype(declval<const _Tp&>() <= | |
| 1468 | declval<const _Up&>()), bool>, | |
| 1454 | is_convertible_v<decltype(std::declval<const _Tp&>() <= | |
| 1455 | std::declval<const _Up&>()), bool>, | |
| 1469 | 1456 | bool |
| 1470 | 1457 | > |
| 1471 | 1458 | operator<=(const optional<_Tp>& __x, const _Up& __v) |
| ... | ... | @@ -1476,8 +1463,8 @@ operator<=(const optional<_Tp>& __x, const _Up& __v) |
| 1476 | 1463 | template <class _Tp, class _Up> |
| 1477 | 1464 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1478 | 1465 | enable_if_t< |
| 1479 | is_convertible_v<decltype(declval<const _Tp&>() <= | |
| 1480 | declval<const _Up&>()), bool>, | |
| 1466 | is_convertible_v<decltype(std::declval<const _Tp&>() <= | |
| 1467 | std::declval<const _Up&>()), bool>, | |
| 1481 | 1468 | bool |
| 1482 | 1469 | > |
| 1483 | 1470 | operator<=(const _Tp& __v, const optional<_Up>& __x) |
| ... | ... | @@ -1488,8 +1475,8 @@ operator<=(const _Tp& __v, const optional<_Up>& __x) |
| 1488 | 1475 | template <class _Tp, class _Up> |
| 1489 | 1476 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1490 | 1477 | enable_if_t< |
| 1491 | is_convertible_v<decltype(declval<const _Tp&>() > | |
| 1492 | declval<const _Up&>()), bool>, | |
| 1478 | is_convertible_v<decltype(std::declval<const _Tp&>() > | |
| 1479 | std::declval<const _Up&>()), bool>, | |
| 1493 | 1480 | bool |
| 1494 | 1481 | > |
| 1495 | 1482 | operator>(const optional<_Tp>& __x, const _Up& __v) |
| ... | ... | @@ -1500,8 +1487,8 @@ operator>(const optional<_Tp>& __x, const _Up& __v) |
| 1500 | 1487 | template <class _Tp, class _Up> |
| 1501 | 1488 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1502 | 1489 | enable_if_t< |
| 1503 | is_convertible_v<decltype(declval<const _Tp&>() > | |
| 1504 | declval<const _Up&>()), bool>, | |
| 1490 | is_convertible_v<decltype(std::declval<const _Tp&>() > | |
| 1491 | std::declval<const _Up&>()), bool>, | |
| 1505 | 1492 | bool |
| 1506 | 1493 | > |
| 1507 | 1494 | operator>(const _Tp& __v, const optional<_Up>& __x) |
| ... | ... | @@ -1512,8 +1499,8 @@ operator>(const _Tp& __v, const optional<_Up>& __x) |
| 1512 | 1499 | template <class _Tp, class _Up> |
| 1513 | 1500 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1514 | 1501 | enable_if_t< |
| 1515 | is_convertible_v<decltype(declval<const _Tp&>() >= | |
| 1516 | declval<const _Up&>()), bool>, | |
| 1502 | is_convertible_v<decltype(std::declval<const _Tp&>() >= | |
| 1503 | std::declval<const _Up&>()), bool>, | |
| 1517 | 1504 | bool |
| 1518 | 1505 | > |
| 1519 | 1506 | operator>=(const optional<_Tp>& __x, const _Up& __v) |
| ... | ... | @@ -1524,8 +1511,8 @@ operator>=(const optional<_Tp>& __x, const _Up& __v) |
| 1524 | 1511 | template <class _Tp, class _Up> |
| 1525 | 1512 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1526 | 1513 | enable_if_t< |
| 1527 | is_convertible_v<decltype(declval<const _Tp&>() >= | |
| 1528 | declval<const _Up&>()), bool>, | |
| 1514 | is_convertible_v<decltype(std::declval<const _Tp&>() >= | |
| 1515 | std::declval<const _Up&>()), bool>, | |
| 1529 | 1516 | bool |
| 1530 | 1517 | > |
| 1531 | 1518 | operator>=(const _Tp& __v, const optional<_Up>& __x) |
| ... | ... | @@ -1535,7 +1522,7 @@ operator>=(const _Tp& __v, const optional<_Up>& __x) |
| 1535 | 1522 | |
| 1536 | 1523 | |
| 1537 | 1524 | template <class _Tp> |
| 1538 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1525 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1539 | 1526 | enable_if_t< |
| 1540 | 1527 | is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, |
| 1541 | 1528 | void |
| ... | ... | @@ -1587,4 +1574,18 @@ _LIBCPP_END_NAMESPACE_STD |
| 1587 | 1574 | |
| 1588 | 1575 | #endif // _LIBCPP_STD_VER > 14 |
| 1589 | 1576 | |
| 1577 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1578 | # include <atomic> | |
| 1579 | # include <climits> | |
| 1580 | # include <concepts> | |
| 1581 | # include <ctime> | |
| 1582 | # include <iterator> | |
| 1583 | # include <memory> | |
| 1584 | # include <ratio> | |
| 1585 | # include <tuple> | |
| 1586 | # include <typeinfo> | |
| 1587 | # include <utility> | |
| 1588 | # include <variant> | |
| 1589 | #endif | |
| 1590 | ||
| 1590 | 1591 | #endif // _LIBCPP_OPTIONAL |
lib/libcxx/include/ostream+67-62| ... | ... | @@ -165,16 +165,15 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons |
| 165 | 165 | |
| 166 | 166 | #include <__assert> // all public C++ headers provide the assertion handler |
| 167 | 167 | #include <__config> |
| 168 | #include <__memory/shared_ptr.h> | |
| 169 | #include <__memory/unique_ptr.h> | |
| 168 | 170 | #include <bitset> |
| 169 | 171 | #include <ios> |
| 170 | 172 | #include <locale> |
| 173 | #include <new> | |
| 171 | 174 | #include <streambuf> |
| 172 | 175 | #include <version> |
| 173 | 176 | |
| 174 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 175 | # include <iterator> | |
| 176 | #endif | |
| 177 | ||
| 178 | 177 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 179 | 178 | # pragma GCC system_header |
| 180 | 179 | #endif |
| ... | ... | @@ -197,7 +196,7 @@ public: |
| 197 | 196 | inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 |
| 198 | 197 | explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb) |
| 199 | 198 | { this->init(__sb); } |
| 200 | virtual ~basic_ostream(); | |
| 199 | ~basic_ostream() override; | |
| 201 | 200 | protected: |
| 202 | 201 | inline _LIBCPP_INLINE_VISIBILITY |
| 203 | 202 | basic_ostream(basic_ostream&& __rhs); |
| ... | ... | @@ -413,7 +412,7 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n) |
| 413 | 412 | if (__s) |
| 414 | 413 | { |
| 415 | 414 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 416 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 415 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 417 | 416 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
| 418 | 417 | this->setstate(ios_base::badbit | ios_base::failbit); |
| 419 | 418 | } |
| ... | ... | @@ -440,7 +439,7 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n) |
| 440 | 439 | { |
| 441 | 440 | ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; |
| 442 | 441 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 443 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 442 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 444 | 443 | if (__f.put(*this, *this, this->fill(), |
| 445 | 444 | __flags == ios_base::oct || __flags == ios_base::hex ? |
| 446 | 445 | static_cast<long>(static_cast<unsigned short>(__n)) : |
| ... | ... | @@ -469,7 +468,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n) |
| 469 | 468 | if (__s) |
| 470 | 469 | { |
| 471 | 470 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 472 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 471 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 473 | 472 | if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) |
| 474 | 473 | this->setstate(ios_base::badbit | ios_base::failbit); |
| 475 | 474 | } |
| ... | ... | @@ -496,7 +495,7 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n) |
| 496 | 495 | { |
| 497 | 496 | ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; |
| 498 | 497 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 499 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 498 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 500 | 499 | if (__f.put(*this, *this, this->fill(), |
| 501 | 500 | __flags == ios_base::oct || __flags == ios_base::hex ? |
| 502 | 501 | static_cast<long>(static_cast<unsigned int>(__n)) : |
| ... | ... | @@ -525,7 +524,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n) |
| 525 | 524 | if (__s) |
| 526 | 525 | { |
| 527 | 526 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 528 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 527 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 529 | 528 | if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) |
| 530 | 529 | this->setstate(ios_base::badbit | ios_base::failbit); |
| 531 | 530 | } |
| ... | ... | @@ -551,7 +550,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n) |
| 551 | 550 | if (__s) |
| 552 | 551 | { |
| 553 | 552 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 554 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 553 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 555 | 554 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
| 556 | 555 | this->setstate(ios_base::badbit | ios_base::failbit); |
| 557 | 556 | } |
| ... | ... | @@ -577,7 +576,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n) |
| 577 | 576 | if (__s) |
| 578 | 577 | { |
| 579 | 578 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 580 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 579 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 581 | 580 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
| 582 | 581 | this->setstate(ios_base::badbit | ios_base::failbit); |
| 583 | 582 | } |
| ... | ... | @@ -603,7 +602,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n) |
| 603 | 602 | if (__s) |
| 604 | 603 | { |
| 605 | 604 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 606 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 605 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 607 | 606 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
| 608 | 607 | this->setstate(ios_base::badbit | ios_base::failbit); |
| 609 | 608 | } |
| ... | ... | @@ -629,7 +628,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n) |
| 629 | 628 | if (__s) |
| 630 | 629 | { |
| 631 | 630 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 632 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 631 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 633 | 632 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
| 634 | 633 | this->setstate(ios_base::badbit | ios_base::failbit); |
| 635 | 634 | } |
| ... | ... | @@ -655,7 +654,7 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n) |
| 655 | 654 | if (__s) |
| 656 | 655 | { |
| 657 | 656 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 658 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 657 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 659 | 658 | if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed()) |
| 660 | 659 | this->setstate(ios_base::badbit | ios_base::failbit); |
| 661 | 660 | } |
| ... | ... | @@ -681,7 +680,7 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n) |
| 681 | 680 | if (__s) |
| 682 | 681 | { |
| 683 | 682 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 684 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 683 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 685 | 684 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
| 686 | 685 | this->setstate(ios_base::badbit | ios_base::failbit); |
| 687 | 686 | } |
| ... | ... | @@ -707,7 +706,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n) |
| 707 | 706 | if (__s) |
| 708 | 707 | { |
| 709 | 708 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 710 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 709 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 711 | 710 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
| 712 | 711 | this->setstate(ios_base::badbit | ios_base::failbit); |
| 713 | 712 | } |
| ... | ... | @@ -733,7 +732,7 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n) |
| 733 | 732 | if (__s) |
| 734 | 733 | { |
| 735 | 734 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
| 736 | const _Fp& __f = use_facet<_Fp>(this->getloc()); | |
| 735 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | |
| 737 | 736 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
| 738 | 737 | this->setstate(ios_base::badbit | ios_base::failbit); |
| 739 | 738 | } |
| ... | ... | @@ -748,7 +747,7 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n) |
| 748 | 747 | } |
| 749 | 748 | |
| 750 | 749 | template<class _CharT, class _Traits> |
| 751 | basic_ostream<_CharT, _Traits>& | |
| 750 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 752 | 751 | __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, |
| 753 | 752 | const _CharT* __str, size_t __len) |
| 754 | 753 | { |
| ... | ... | @@ -760,14 +759,14 @@ __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, |
| 760 | 759 | if (__s) |
| 761 | 760 | { |
| 762 | 761 | typedef ostreambuf_iterator<_CharT, _Traits> _Ip; |
| 763 | if (__pad_and_output(_Ip(__os), | |
| 764 | __str, | |
| 765 | (__os.flags() & ios_base::adjustfield) == ios_base::left ? | |
| 766 | __str + __len : | |
| 767 | __str, | |
| 768 | __str + __len, | |
| 769 | __os, | |
| 770 | __os.fill()).failed()) | |
| 762 | if (std::__pad_and_output(_Ip(__os), | |
| 763 | __str, | |
| 764 | (__os.flags() & ios_base::adjustfield) == ios_base::left ? | |
| 765 | __str + __len : | |
| 766 | __str, | |
| 767 | __str + __len, | |
| 768 | __os, | |
| 769 | __os.fill()).failed()) | |
| 771 | 770 | __os.setstate(ios_base::badbit | ios_base::failbit); |
| 772 | 771 | } |
| 773 | 772 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| ... | ... | @@ -782,14 +781,14 @@ __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, |
| 782 | 781 | |
| 783 | 782 | |
| 784 | 783 | template<class _CharT, class _Traits> |
| 785 | basic_ostream<_CharT, _Traits>& | |
| 784 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 786 | 785 | operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c) |
| 787 | 786 | { |
| 788 | 787 | return _VSTD::__put_character_sequence(__os, &__c, 1); |
| 789 | 788 | } |
| 790 | 789 | |
| 791 | 790 | template<class _CharT, class _Traits> |
| 792 | basic_ostream<_CharT, _Traits>& | |
| 791 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 793 | 792 | operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) |
| 794 | 793 | { |
| 795 | 794 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| ... | ... | @@ -801,14 +800,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) |
| 801 | 800 | { |
| 802 | 801 | _CharT __c = __os.widen(__cn); |
| 803 | 802 | typedef ostreambuf_iterator<_CharT, _Traits> _Ip; |
| 804 | if (__pad_and_output(_Ip(__os), | |
| 805 | &__c, | |
| 806 | (__os.flags() & ios_base::adjustfield) == ios_base::left ? | |
| 807 | &__c + 1 : | |
| 808 | &__c, | |
| 809 | &__c + 1, | |
| 810 | __os, | |
| 811 | __os.fill()).failed()) | |
| 803 | if (std::__pad_and_output(_Ip(__os), | |
| 804 | &__c, | |
| 805 | (__os.flags() & ios_base::adjustfield) == ios_base::left ? | |
| 806 | &__c + 1 : | |
| 807 | &__c, | |
| 808 | &__c + 1, | |
| 809 | __os, | |
| 810 | __os.fill()).failed()) | |
| 812 | 811 | __os.setstate(ios_base::badbit | ios_base::failbit); |
| 813 | 812 | } |
| 814 | 813 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| ... | ... | @@ -822,35 +821,35 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) |
| 822 | 821 | } |
| 823 | 822 | |
| 824 | 823 | template<class _Traits> |
| 825 | basic_ostream<char, _Traits>& | |
| 824 | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& | |
| 826 | 825 | operator<<(basic_ostream<char, _Traits>& __os, char __c) |
| 827 | 826 | { |
| 828 | 827 | return _VSTD::__put_character_sequence(__os, &__c, 1); |
| 829 | 828 | } |
| 830 | 829 | |
| 831 | 830 | template<class _Traits> |
| 832 | basic_ostream<char, _Traits>& | |
| 831 | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& | |
| 833 | 832 | operator<<(basic_ostream<char, _Traits>& __os, signed char __c) |
| 834 | 833 | { |
| 835 | 834 | return _VSTD::__put_character_sequence(__os, (char *) &__c, 1); |
| 836 | 835 | } |
| 837 | 836 | |
| 838 | 837 | template<class _Traits> |
| 839 | basic_ostream<char, _Traits>& | |
| 838 | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& | |
| 840 | 839 | operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) |
| 841 | 840 | { |
| 842 | 841 | return _VSTD::__put_character_sequence(__os, (char *) &__c, 1); |
| 843 | 842 | } |
| 844 | 843 | |
| 845 | 844 | template<class _CharT, class _Traits> |
| 846 | basic_ostream<_CharT, _Traits>& | |
| 845 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 847 | 846 | operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str) |
| 848 | 847 | { |
| 849 | 848 | return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str)); |
| 850 | 849 | } |
| 851 | 850 | |
| 852 | 851 | template<class _CharT, class _Traits> |
| 853 | basic_ostream<_CharT, _Traits>& | |
| 852 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 854 | 853 | operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) |
| 855 | 854 | { |
| 856 | 855 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| ... | ... | @@ -875,14 +874,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) |
| 875 | 874 | } |
| 876 | 875 | for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p) |
| 877 | 876 | *__p = __os.widen(*__strn); |
| 878 | if (__pad_and_output(_Ip(__os), | |
| 879 | __wb, | |
| 880 | (__os.flags() & ios_base::adjustfield) == ios_base::left ? | |
| 881 | __wb + __len : | |
| 882 | __wb, | |
| 883 | __wb + __len, | |
| 884 | __os, | |
| 885 | __os.fill()).failed()) | |
| 877 | if (std::__pad_and_output(_Ip(__os), | |
| 878 | __wb, | |
| 879 | (__os.flags() & ios_base::adjustfield) == ios_base::left ? | |
| 880 | __wb + __len : | |
| 881 | __wb, | |
| 882 | __wb + __len, | |
| 883 | __os, | |
| 884 | __os.fill()).failed()) | |
| 886 | 885 | __os.setstate(ios_base::badbit | ios_base::failbit); |
| 887 | 886 | } |
| 888 | 887 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| ... | ... | @@ -896,14 +895,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) |
| 896 | 895 | } |
| 897 | 896 | |
| 898 | 897 | template<class _Traits> |
| 899 | basic_ostream<char, _Traits>& | |
| 898 | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& | |
| 900 | 899 | operator<<(basic_ostream<char, _Traits>& __os, const char* __str) |
| 901 | 900 | { |
| 902 | 901 | return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str)); |
| 903 | 902 | } |
| 904 | 903 | |
| 905 | 904 | template<class _Traits> |
| 906 | basic_ostream<char, _Traits>& | |
| 905 | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& | |
| 907 | 906 | operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str) |
| 908 | 907 | { |
| 909 | 908 | const char *__s = (const char *) __str; |
| ... | ... | @@ -911,7 +910,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str) |
| 911 | 910 | } |
| 912 | 911 | |
| 913 | 912 | template<class _Traits> |
| 914 | basic_ostream<char, _Traits>& | |
| 913 | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& | |
| 915 | 914 | operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str) |
| 916 | 915 | { |
| 917 | 916 | const char *__s = (const char *) __str; |
| ... | ... | @@ -1032,7 +1031,7 @@ basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir) |
| 1032 | 1031 | } |
| 1033 | 1032 | |
| 1034 | 1033 | template <class _CharT, class _Traits> |
| 1035 | inline | |
| 1034 | _LIBCPP_HIDE_FROM_ABI inline | |
| 1036 | 1035 | basic_ostream<_CharT, _Traits>& |
| 1037 | 1036 | endl(basic_ostream<_CharT, _Traits>& __os) |
| 1038 | 1037 | { |
| ... | ... | @@ -1042,7 +1041,7 @@ endl(basic_ostream<_CharT, _Traits>& __os) |
| 1042 | 1041 | } |
| 1043 | 1042 | |
| 1044 | 1043 | template <class _CharT, class _Traits> |
| 1045 | inline | |
| 1044 | _LIBCPP_HIDE_FROM_ABI inline | |
| 1046 | 1045 | basic_ostream<_CharT, _Traits>& |
| 1047 | 1046 | ends(basic_ostream<_CharT, _Traits>& __os) |
| 1048 | 1047 | { |
| ... | ... | @@ -1051,7 +1050,7 @@ ends(basic_ostream<_CharT, _Traits>& __os) |
| 1051 | 1050 | } |
| 1052 | 1051 | |
| 1053 | 1052 | template <class _CharT, class _Traits> |
| 1054 | inline | |
| 1053 | _LIBCPP_HIDE_FROM_ABI inline | |
| 1055 | 1054 | basic_ostream<_CharT, _Traits>& |
| 1056 | 1055 | flush(basic_ostream<_CharT, _Traits>& __os) |
| 1057 | 1056 | { |
| ... | ... | @@ -1064,7 +1063,7 @@ struct __is_ostreamable : false_type { }; |
| 1064 | 1063 | |
| 1065 | 1064 | template <class _Stream, class _Tp> |
| 1066 | 1065 | struct __is_ostreamable<_Stream, _Tp, decltype( |
| 1067 | declval<_Stream>() << declval<_Tp>(), void() | |
| 1066 | std::declval<_Stream>() << std::declval<_Tp>(), void() | |
| 1068 | 1067 | )> : true_type { }; |
| 1069 | 1068 | |
| 1070 | 1069 | template <class _Stream, class _Tp, class = typename enable_if< |
| ... | ... | @@ -1087,7 +1086,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 1087 | 1086 | } |
| 1088 | 1087 | |
| 1089 | 1088 | template<class _CharT, class _Traits> |
| 1090 | basic_ostream<_CharT, _Traits>& | |
| 1089 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 1091 | 1090 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 1092 | 1091 | basic_string_view<_CharT, _Traits> __sv) |
| 1093 | 1092 | { |
| ... | ... | @@ -1114,7 +1113,7 @@ template<class _CharT, class _Traits, class _Yp, class _Dp> |
| 1114 | 1113 | inline _LIBCPP_INLINE_VISIBILITY |
| 1115 | 1114 | typename enable_if |
| 1116 | 1115 | < |
| 1117 | is_same<void, typename __void_t<decltype((declval<basic_ostream<_CharT, _Traits>&>() << declval<typename unique_ptr<_Yp, _Dp>::pointer>()))>::type>::value, | |
| 1116 | is_same<void, __void_t<decltype((std::declval<basic_ostream<_CharT, _Traits>&>() << std::declval<typename unique_ptr<_Yp, _Dp>::pointer>()))> >::value, | |
| 1118 | 1117 | basic_ostream<_CharT, _Traits>& |
| 1119 | 1118 | >::type |
| 1120 | 1119 | operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p) |
| ... | ... | @@ -1123,12 +1122,12 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p |
| 1123 | 1122 | } |
| 1124 | 1123 | |
| 1125 | 1124 | template <class _CharT, class _Traits, size_t _Size> |
| 1126 | basic_ostream<_CharT, _Traits>& | |
| 1125 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 1127 | 1126 | operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) |
| 1128 | 1127 | { |
| 1129 | 1128 | return __os << __x.template to_string<_CharT, _Traits> |
| 1130 | (use_facet<ctype<_CharT> >(__os.getloc()).widen('0'), | |
| 1131 | use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); | |
| 1129 | (std::use_facet<ctype<_CharT> >(__os.getloc()).widen('0'), | |
| 1130 | std::use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); | |
| 1132 | 1131 | } |
| 1133 | 1132 | |
| 1134 | 1133 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -1189,4 +1188,10 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>; |
| 1189 | 1188 | |
| 1190 | 1189 | _LIBCPP_END_NAMESPACE_STD |
| 1191 | 1190 | |
| 1191 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1192 | # include <concepts> | |
| 1193 | # include <iterator> | |
| 1194 | # include <type_traits> | |
| 1195 | #endif | |
| 1196 | ||
| 1192 | 1197 | #endif // _LIBCPP_OSTREAM |
lib/libcxx/include/queue+11-4| ... | ... | @@ -231,11 +231,9 @@ template <class T, class Container, class Compare> |
| 231 | 231 | #include <vector> |
| 232 | 232 | #include <version> |
| 233 | 233 | |
| 234 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 235 | # include <functional> | |
| 236 | #endif | |
| 237 | ||
| 238 | 234 | // standard-mandated includes |
| 235 | ||
| 236 | // [queue.syn] | |
| 239 | 237 | #include <compare> |
| 240 | 238 | #include <initializer_list> |
| 241 | 239 | |
| ... | ... | @@ -384,6 +382,8 @@ public: |
| 384 | 382 | swap(c, __q.c); |
| 385 | 383 | } |
| 386 | 384 | |
| 385 | _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; } | |
| 386 | ||
| 387 | 387 | template <class _T1, class _C1> |
| 388 | 388 | friend |
| 389 | 389 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -635,6 +635,8 @@ public: |
| 635 | 635 | void swap(priority_queue& __q) |
| 636 | 636 | _NOEXCEPT_(__is_nothrow_swappable<container_type>::value && |
| 637 | 637 | __is_nothrow_swappable<value_compare>::value); |
| 638 | ||
| 639 | _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; } | |
| 638 | 640 | }; |
| 639 | 641 | |
| 640 | 642 | #if _LIBCPP_STD_VER >= 17 |
| ... | ... | @@ -960,4 +962,9 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<priority_queue<_Tp, _Container, _Comp |
| 960 | 962 | |
| 961 | 963 | _LIBCPP_END_NAMESPACE_STD |
| 962 | 964 | |
| 965 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 966 | # include <concepts> | |
| 967 | # include <functional> | |
| 968 | #endif | |
| 969 | ||
| 963 | 970 | #endif // _LIBCPP_QUEUE |
lib/libcxx/include/random+17-14| ... | ... | @@ -1718,25 +1718,28 @@ class piecewise_linear_distribution |
| 1718 | 1718 | #include <__random/weibull_distribution.h> |
| 1719 | 1719 | #include <version> |
| 1720 | 1720 | |
| 1721 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 1722 | # include <algorithm> | |
| 1723 | #endif | |
| 1724 | ||
| 1725 | 1721 | // standard-mandated includes |
| 1726 | #include <initializer_list> | |
| 1727 | 1722 | |
| 1728 | #include <cmath> // for backward compatibility; TODO remove it | |
| 1729 | #include <cstddef> // for backward compatibility; TODO remove it | |
| 1730 | #include <cstdint> // for backward compatibility; TODO remove it | |
| 1731 | #include <iosfwd> // for backward compatibility; TODO remove it | |
| 1732 | #include <limits> // for backward compatibility; TODO remove it | |
| 1733 | #include <numeric> // for backward compatibility; TODO remove it | |
| 1734 | #include <string> // for backward compatibility; TODO remove it | |
| 1735 | #include <type_traits> // for backward compatibility; TODO remove it | |
| 1736 | #include <vector> // for backward compatibility; TODO remove it | |
| 1723 | // [rand.synopsis] | |
| 1724 | #include <initializer_list> | |
| 1737 | 1725 | |
| 1738 | 1726 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 1739 | 1727 | # pragma GCC system_header |
| 1740 | 1728 | #endif |
| 1741 | 1729 | |
| 1730 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1731 | # include <algorithm> | |
| 1732 | # include <climits> | |
| 1733 | # include <cmath> | |
| 1734 | # include <concepts> | |
| 1735 | # include <cstddef> | |
| 1736 | # include <cstdint> | |
| 1737 | # include <iosfwd> | |
| 1738 | # include <limits> | |
| 1739 | # include <numeric> | |
| 1740 | # include <string> | |
| 1741 | # include <type_traits> | |
| 1742 | # include <vector> | |
| 1743 | #endif | |
| 1744 | ||
| 1742 | 1745 | #endif // _LIBCPP_RANDOM |
lib/libcxx/include/ranges+88-4| ... | ... | @@ -115,6 +115,27 @@ namespace std::ranges { |
| 115 | 115 | template<range R> |
| 116 | 116 | using borrowed_subrange_t = see below; |
| 117 | 117 | |
| 118 | // [range.elements], elements view | |
| 119 | template<input_range V, size_t N> | |
| 120 | requires see below | |
| 121 | class elements_view; | |
| 122 | ||
| 123 | template<class T, size_t N> | |
| 124 | inline constexpr bool enable_borrowed_range<elements_view<T, N>> = | |
| 125 | enable_borrowed_range<T>; | |
| 126 | ||
| 127 | template<class R> | |
| 128 | using keys_view = elements_view<R, 0>; | |
| 129 | template<class R> | |
| 130 | using values_view = elements_view<R, 1>; | |
| 131 | ||
| 132 | namespace views { | |
| 133 | template<size_t N> | |
| 134 | inline constexpr unspecified elements = unspecified; | |
| 135 | inline constexpr auto keys = elements<0>; | |
| 136 | inline constexpr auto values = elements<1>; | |
| 137 | } | |
| 138 | ||
| 118 | 139 | // [range.empty], empty view |
| 119 | 140 | template<class T> |
| 120 | 141 | requires is_object_v<T> |
| ... | ... | @@ -166,6 +187,18 @@ namespace std::ranges { |
| 166 | 187 | template<class T> |
| 167 | 188 | inline constexpr bool enable_borrowed_range<drop_view<T>> = enable_borrowed_range<T>; |
| 168 | 189 | |
| 190 | // [range.drop.while], drop while view | |
| 191 | template<view V, class Pred> | |
| 192 | requires input_range<V> && is_object_v<Pred> && | |
| 193 | indirect_unary_predicate<const Pred, iterator_t<V>> | |
| 194 | class drop_while_view; | |
| 195 | ||
| 196 | template<class T, class Pred> | |
| 197 | inline constexpr bool enable_borrowed_range<drop_while_view<T, Pred>> = | |
| 198 | enable_borrowed_range<T>; | |
| 199 | ||
| 200 | namespace views { inline constexpr unspecified drop_while = unspecified; } | |
| 201 | ||
| 169 | 202 | // [range.transform], transform view |
| 170 | 203 | template<input_range V, copy_constructible F> |
| 171 | 204 | requires view<V> && is_object_v<F> && |
| ... | ... | @@ -198,6 +231,14 @@ namespace std::ranges { |
| 198 | 231 | template<class T> |
| 199 | 232 | inline constexpr bool enable_borrowed_range<take_view<T>> = enable_borrowed_range<T>; |
| 200 | 233 | |
| 234 | // [range.take.while], take while view | |
| 235 | template<view V, class Pred> | |
| 236 | requires input_range<V> && is_object_v<Pred> && | |
| 237 | indirect_unary_predicate<const Pred, iterator_t<V>> | |
| 238 | class take_while_view; | |
| 239 | ||
| 240 | namespace views { inline constexpr unspecified take_while = unspecified; } | |
| 241 | ||
| 201 | 242 | template<copy_constructible T> |
| 202 | 243 | requires is_object_v<T> |
| 203 | 244 | class single_view; |
| ... | ... | @@ -224,10 +265,30 @@ namespace std::ranges { |
| 224 | 265 | (forward_range<V> || tiny-range<Pattern>) |
| 225 | 266 | class lazy_split_view; |
| 226 | 267 | |
| 268 | // [range.split], split view | |
| 269 | template<forward_range V, forward_range Pattern> | |
| 270 | requires view<V> && view<Pattern> && | |
| 271 | indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to> | |
| 272 | class split_view; | |
| 273 | ||
| 227 | 274 | namespace views { |
| 228 | 275 | inline constexpr unspecified lazy_split = unspecified; |
| 276 | inline constexpr unspecified split = unspecified; | |
| 229 | 277 | } |
| 230 | 278 | |
| 279 | // [range.istream], istream view | |
| 280 | template<movable Val, class CharT, class Traits = char_traits<CharT>> | |
| 281 | requires see below | |
| 282 | class basic_istream_view; | |
| 283 | ||
| 284 | template<class Val> | |
| 285 | using istream_view = basic_istream_view<Val, char>; | |
| 286 | ||
| 287 | template<class Val> | |
| 288 | using wistream_view = basic_istream_view<Val, wchar_t>; | |
| 289 | ||
| 290 | namespace views { template<class T> inline constexpr unspecified istream = unspecified; } | |
| 291 | ||
| 231 | 292 | // [range.zip], zip view |
| 232 | 293 | template<input_range... Views> |
| 233 | 294 | requires (view<Views> && ...) && (sizeof...(Views) > 0) |
| ... | ... | @@ -238,6 +299,13 @@ namespace std::ranges { |
| 238 | 299 | (enable_borrowed_range<Views> && ...); |
| 239 | 300 | |
| 240 | 301 | namespace views { inline constexpr unspecified zip = unspecified; } // C++2b |
| 302 | ||
| 303 | // [range.as.rvalue] | |
| 304 | template <view V> | |
| 305 | requires input_range<V> | |
| 306 | class as_rvalue_view; // since C++23 | |
| 307 | ||
| 308 | namespace views { inline constexpr unspecified as_rvalue ) unspecified; } // since C++23 | |
| 241 | 309 | } |
| 242 | 310 | |
| 243 | 311 | namespace std { |
| ... | ... | @@ -276,12 +344,15 @@ namespace std { |
| 276 | 344 | #include <__config> |
| 277 | 345 | #include <__ranges/access.h> |
| 278 | 346 | #include <__ranges/all.h> |
| 347 | #include <__ranges/as_rvalue_view.h> | |
| 279 | 348 | #include <__ranges/common_view.h> |
| 280 | 349 | #include <__ranges/concepts.h> |
| 281 | 350 | #include <__ranges/counted.h> |
| 282 | 351 | #include <__ranges/dangling.h> |
| 283 | 352 | #include <__ranges/data.h> |
| 284 | 353 | #include <__ranges/drop_view.h> |
| 354 | #include <__ranges/drop_while_view.h> | |
| 355 | #include <__ranges/elements_view.h> | |
| 285 | 356 | #include <__ranges/empty.h> |
| 286 | 357 | #include <__ranges/empty_view.h> |
| 287 | 358 | #include <__ranges/enable_borrowed_range.h> |
| ... | ... | @@ -296,19 +367,32 @@ namespace std { |
| 296 | 367 | #include <__ranges/reverse_view.h> |
| 297 | 368 | #include <__ranges/single_view.h> |
| 298 | 369 | #include <__ranges/size.h> |
| 370 | #include <__ranges/split_view.h> | |
| 299 | 371 | #include <__ranges/subrange.h> |
| 300 | 372 | #include <__ranges/take_view.h> |
| 373 | #include <__ranges/take_while_view.h> | |
| 301 | 374 | #include <__ranges/transform_view.h> |
| 302 | 375 | #include <__ranges/view_interface.h> |
| 303 | 376 | #include <__ranges/views.h> |
| 304 | 377 | #include <__ranges/zip_view.h> |
| 305 | #include <__tuple> // TODO: <ranges> has to export std::tuple_size. Replace this, once <tuple> is granularized. | |
| 306 | #include <compare> // Required by the standard. | |
| 307 | #include <initializer_list> // Required by the standard. | |
| 308 | #include <iterator> // Required by the standard. | |
| 309 | 378 | #include <type_traits> |
| 310 | 379 | #include <version> |
| 311 | 380 | |
| 381 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 382 | #include <__ranges/istream_view.h> | |
| 383 | #endif | |
| 384 | ||
| 385 | // standard-mandated includes | |
| 386 | ||
| 387 | // [ranges.syn] | |
| 388 | #include <compare> | |
| 389 | #include <initializer_list> | |
| 390 | #include <iterator> | |
| 391 | ||
| 392 | // [tuple.helper] | |
| 393 | #include <__tuple_dir/tuple_element.h> | |
| 394 | #include <__tuple_dir/tuple_size.h> | |
| 395 | ||
| 312 | 396 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 313 | 397 | # pragma GCC system_header |
| 314 | 398 | #endif |
lib/libcxx/include/ratio+5-1| ... | ... | @@ -79,9 +79,9 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported |
| 79 | 79 | |
| 80 | 80 | #include <__assert> // all public C++ headers provide the assertion handler |
| 81 | 81 | #include <__config> |
| 82 | #include <__type_traits/integral_constant.h> | |
| 82 | 83 | #include <climits> |
| 83 | 84 | #include <cstdint> |
| 84 | #include <type_traits> | |
| 85 | 85 | #include <version> |
| 86 | 86 | |
| 87 | 87 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -525,4 +525,8 @@ _LIBCPP_END_NAMESPACE_STD |
| 525 | 525 | |
| 526 | 526 | _LIBCPP_POP_MACROS |
| 527 | 527 | |
| 528 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 529 | # include <type_traits> | |
| 530 | #endif | |
| 531 | ||
| 528 | 532 | #endif // _LIBCPP_RATIO |
lib/libcxx/include/regex+66-37| ... | ... | @@ -769,20 +769,17 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; |
| 769 | 769 | #include <__iterator/back_insert_iterator.h> |
| 770 | 770 | #include <__iterator/wrap_iter.h> |
| 771 | 771 | #include <__locale> |
| 772 | #include <__memory_resource/polymorphic_allocator.h> | |
| 772 | 773 | #include <__utility/move.h> |
| 774 | #include <__utility/pair.h> | |
| 773 | 775 | #include <__utility/swap.h> |
| 776 | #include <cstring> | |
| 774 | 777 | #include <deque> |
| 775 | #include <memory> | |
| 776 | 778 | #include <stdexcept> |
| 777 | 779 | #include <string> |
| 778 | 780 | #include <vector> |
| 779 | 781 | #include <version> |
| 780 | 782 | |
| 781 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 782 | # include <iterator> | |
| 783 | # include <utility> | |
| 784 | #endif | |
| 785 | ||
| 786 | 783 | // standard-mandated includes |
| 787 | 784 | |
| 788 | 785 | // [iterator.range] |
| ... | ... | @@ -833,7 +830,7 @@ enum syntax_option_type |
| 833 | 830 | multiline = 1 << 10 |
| 834 | 831 | }; |
| 835 | 832 | |
| 836 | inline _LIBCPP_CONSTEXPR | |
| 833 | _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR | |
| 837 | 834 | syntax_option_type __get_grammar(syntax_option_type __g) |
| 838 | 835 | { |
| 839 | 836 | #ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO |
| ... | ... | @@ -1006,8 +1003,8 @@ class _LIBCPP_EXCEPTION_ABI regex_error |
| 1006 | 1003 | public: |
| 1007 | 1004 | explicit regex_error(regex_constants::error_type __ecode); |
| 1008 | 1005 | regex_error(const regex_error&) _NOEXCEPT = default; |
| 1009 | virtual ~regex_error() _NOEXCEPT; | |
| 1010 | _LIBCPP_INLINE_VISIBILITY | |
| 1006 | ~regex_error() _NOEXCEPT override; | |
| 1007 | _LIBCPP_INLINE_VISIBILITY | |
| 1011 | 1008 | regex_constants::error_type code() const {return __code_;} |
| 1012 | 1009 | }; |
| 1013 | 1010 | |
| ... | ... | @@ -1029,7 +1026,7 @@ public: |
| 1029 | 1026 | typedef _CharT char_type; |
| 1030 | 1027 | typedef basic_string<char_type> string_type; |
| 1031 | 1028 | typedef locale locale_type; |
| 1032 | #ifdef __BIONIC__ | |
| 1029 | #if defined(__BIONIC__) || defined(_NEWLIB_VERSION) | |
| 1033 | 1030 | // Originally bionic's ctype_base used its own ctype masks because the |
| 1034 | 1031 | // builtin ctype implementation wasn't in libc++ yet. Bionic's ctype mask |
| 1035 | 1032 | // was only 8 bits wide and already saturated, so it used a wider type here |
| ... | ... | @@ -1038,6 +1035,11 @@ public: |
| 1038 | 1035 | // implementation, but this was not updated to match. Since then Android has |
| 1039 | 1036 | // needed to maintain a stable libc++ ABI, and this can't be changed without |
| 1040 | 1037 | // an ABI break. |
| 1038 | // We also need this workaround for newlib since _NEWLIB_VERSION is not | |
| 1039 | // defined yet inside __config, so we can't set the | |
| 1040 | // _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE macro. Additionally, newlib is | |
| 1041 | // often used for space constrained environments, so it makes sense not to | |
| 1042 | // duplicate the ctype table. | |
| 1041 | 1043 | typedef uint16_t char_class_type; |
| 1042 | 1044 | #else |
| 1043 | 1045 | typedef ctype_base::mask char_class_type; |
| ... | ... | @@ -1155,8 +1157,8 @@ template <class _CharT> |
| 1155 | 1157 | void |
| 1156 | 1158 | regex_traits<_CharT>::__init() |
| 1157 | 1159 | { |
| 1158 | __ct_ = &use_facet<ctype<char_type> >(__loc_); | |
| 1159 | __col_ = &use_facet<collate<char_type> >(__loc_); | |
| 1160 | __ct_ = &std::use_facet<ctype<char_type> >(__loc_); | |
| 1161 | __col_ = &std::use_facet<collate<char_type> >(__loc_); | |
| 1160 | 1162 | } |
| 1161 | 1163 | |
| 1162 | 1164 | template <class _CharT> |
| ... | ... | @@ -1231,7 +1233,7 @@ regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f, |
| 1231 | 1233 | string_type __r; |
| 1232 | 1234 | if (!__s.empty()) |
| 1233 | 1235 | { |
| 1234 | __r = __get_collation_name(__s.c_str()); | |
| 1236 | __r = std::__get_collation_name(__s.c_str()); | |
| 1235 | 1237 | if (__r.empty() && __s.size() <= 2) |
| 1236 | 1238 | { |
| 1237 | 1239 | __r = __col_->transform(__s.data(), __s.data() + __s.size()); |
| ... | ... | @@ -1294,7 +1296,7 @@ regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f, |
| 1294 | 1296 | { |
| 1295 | 1297 | string_type __s(__f, __l); |
| 1296 | 1298 | __ct_->tolower(&__s[0], &__s[0] + __s.size()); |
| 1297 | return __get_classname(__s.c_str(), __icase); | |
| 1299 | return std::__get_classname(__s.c_str(), __icase); | |
| 1298 | 1300 | } |
| 1299 | 1301 | |
| 1300 | 1302 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| ... | ... | @@ -1444,12 +1446,12 @@ public: |
| 1444 | 1446 | |
| 1445 | 1447 | _LIBCPP_INLINE_VISIBILITY |
| 1446 | 1448 | __node() {} |
| 1447 | _LIBCPP_INLINE_VISIBILITY | |
| 1449 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL | |
| 1448 | 1450 | virtual ~__node() {} |
| 1449 | 1451 | |
| 1450 | _LIBCPP_INLINE_VISIBILITY | |
| 1452 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL | |
| 1451 | 1453 | virtual void __exec(__state&) const {} |
| 1452 | _LIBCPP_INLINE_VISIBILITY | |
| 1454 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL | |
| 1453 | 1455 | virtual void __exec_split(bool, __state&) const {} |
| 1454 | 1456 | }; |
| 1455 | 1457 | |
| ... | ... | @@ -1507,7 +1509,7 @@ public: |
| 1507 | 1509 | explicit __owns_one_state(__node<_CharT>* __s) |
| 1508 | 1510 | : base(__s) {} |
| 1509 | 1511 | |
| 1510 | virtual ~__owns_one_state(); | |
| 1512 | ~__owns_one_state() override; | |
| 1511 | 1513 | }; |
| 1512 | 1514 | |
| 1513 | 1515 | template <class _CharT> |
| ... | ... | @@ -2092,7 +2094,7 @@ __l_anchor_multiline<_CharT>::__exec(__state& __s) const |
| 2092 | 2094 | } |
| 2093 | 2095 | else if (__multiline_ && |
| 2094 | 2096 | !__s.__at_first_ && |
| 2095 | __is_eol(*_VSTD::prev(__s.__current_))) | |
| 2097 | std::__is_eol(*_VSTD::prev(__s.__current_))) | |
| 2096 | 2098 | { |
| 2097 | 2099 | __s.__do_ = __state::__accept_but_not_consume; |
| 2098 | 2100 | __s.__node_ = this->first(); |
| ... | ... | @@ -2134,7 +2136,7 @@ __r_anchor_multiline<_CharT>::__exec(__state& __s) const |
| 2134 | 2136 | __s.__do_ = __state::__accept_but_not_consume; |
| 2135 | 2137 | __s.__node_ = this->first(); |
| 2136 | 2138 | } |
| 2137 | else if (__multiline_ && __is_eol(*__s.__current_)) | |
| 2139 | else if (__multiline_ && std::__is_eol(*__s.__current_)) | |
| 2138 | 2140 | { |
| 2139 | 2141 | __s.__do_ = __state::__accept_but_not_consume; |
| 2140 | 2142 | __s.__node_ = this->first(); |
| ... | ... | @@ -2196,7 +2198,7 @@ public: |
| 2196 | 2198 | __match_any_but_newline(__node<_CharT>* __s) |
| 2197 | 2199 | : base(__s) {} |
| 2198 | 2200 | |
| 2199 | virtual void __exec(__state&) const; | |
| 2201 | void __exec(__state&) const override; | |
| 2200 | 2202 | }; |
| 2201 | 2203 | |
| 2202 | 2204 | template <> _LIBCPP_FUNC_VIS void __match_any_but_newline<char>::__exec(__state&) const; |
| ... | ... | @@ -2403,7 +2405,7 @@ public: |
| 2403 | 2405 | for (size_t __i = 0; __i < __e.size(); ++__i) |
| 2404 | 2406 | __e[__i] = __traits_.translate(__e[__i]); |
| 2405 | 2407 | } |
| 2406 | __ranges_.push_back(make_pair( | |
| 2408 | __ranges_.push_back(std::make_pair( | |
| 2407 | 2409 | __traits_.transform(__b.begin(), __b.end()), |
| 2408 | 2410 | __traits_.transform(__e.begin(), __e.end()))); |
| 2409 | 2411 | } |
| ... | ... | @@ -2416,20 +2418,20 @@ public: |
| 2416 | 2418 | __b[0] = __traits_.translate_nocase(__b[0]); |
| 2417 | 2419 | __e[0] = __traits_.translate_nocase(__e[0]); |
| 2418 | 2420 | } |
| 2419 | __ranges_.push_back(make_pair(_VSTD::move(__b), _VSTD::move(__e))); | |
| 2421 | __ranges_.push_back(std::make_pair(_VSTD::move(__b), _VSTD::move(__e))); | |
| 2420 | 2422 | } |
| 2421 | 2423 | } |
| 2422 | 2424 | _LIBCPP_INLINE_VISIBILITY |
| 2423 | 2425 | void __add_digraph(_CharT __c1, _CharT __c2) |
| 2424 | 2426 | { |
| 2425 | 2427 | if (__icase_) |
| 2426 | __digraphs_.push_back(make_pair(__traits_.translate_nocase(__c1), | |
| 2427 | __traits_.translate_nocase(__c2))); | |
| 2428 | __digraphs_.push_back(std::make_pair(__traits_.translate_nocase(__c1), | |
| 2429 | __traits_.translate_nocase(__c2))); | |
| 2428 | 2430 | else if (__collate_) |
| 2429 | __digraphs_.push_back(make_pair(__traits_.translate(__c1), | |
| 2430 | __traits_.translate(__c2))); | |
| 2431 | __digraphs_.push_back(std::make_pair(__traits_.translate(__c1), | |
| 2432 | __traits_.translate(__c2))); | |
| 2431 | 2433 | else |
| 2432 | __digraphs_.push_back(make_pair(__c1, __c2)); | |
| 2434 | __digraphs_.push_back(std::make_pair(__c1, __c2)); | |
| 2433 | 2435 | } |
| 2434 | 2436 | _LIBCPP_INLINE_VISIBILITY |
| 2435 | 2437 | void __add_equivalence(const string_type& __s) |
| ... | ... | @@ -5521,7 +5523,7 @@ public: |
| 5521 | 5523 | regex_constants::match_flag_type __flags = regex_constants::format_default) const |
| 5522 | 5524 | { |
| 5523 | 5525 | basic_string<char_type, _ST, _SA> __r; |
| 5524 | format(back_inserter(__r), __fmt.data(), __fmt.data() + __fmt.size(), | |
| 5526 | format(std::back_inserter(__r), __fmt.data(), __fmt.data() + __fmt.size(), | |
| 5525 | 5527 | __flags); |
| 5526 | 5528 | return __r; |
| 5527 | 5529 | } |
| ... | ... | @@ -5531,7 +5533,7 @@ public: |
| 5531 | 5533 | regex_constants::match_flag_type __flags = regex_constants::format_default) const |
| 5532 | 5534 | { |
| 5533 | 5535 | string_type __r; |
| 5534 | format(back_inserter(__r), __fmt, | |
| 5536 | format(std::back_inserter(__r), __fmt, | |
| 5535 | 5537 | __fmt + char_traits<char_type>::length(__fmt), __flags); |
| 5536 | 5538 | return __r; |
| 5537 | 5539 | } |
| ... | ... | @@ -5732,7 +5734,7 @@ match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m) |
| 5732 | 5734 | } |
| 5733 | 5735 | |
| 5734 | 5736 | template <class _BidirectionalIterator, class _Allocator> |
| 5735 | bool | |
| 5737 | _LIBCPP_HIDE_FROM_ABI bool | |
| 5736 | 5738 | operator==(const match_results<_BidirectionalIterator, _Allocator>& __x, |
| 5737 | 5739 | const match_results<_BidirectionalIterator, _Allocator>& __y) |
| 5738 | 5740 | { |
| ... | ... | @@ -6224,7 +6226,7 @@ regex_search(const basic_string<_Cp, _ST, _SA>&& __s, |
| 6224 | 6226 | // regex_match |
| 6225 | 6227 | |
| 6226 | 6228 | template <class _BidirectionalIterator, class _Allocator, class _CharT, class _Traits> |
| 6227 | bool | |
| 6229 | _LIBCPP_HIDE_FROM_ABI bool | |
| 6228 | 6230 | regex_match(_BidirectionalIterator __first, _BidirectionalIterator __last, |
| 6229 | 6231 | match_results<_BidirectionalIterator, _Allocator>& __m, |
| 6230 | 6232 | const basic_regex<_CharT, _Traits>& __e, |
| ... | ... | @@ -6737,7 +6739,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++() |
| 6737 | 6739 | |
| 6738 | 6740 | template <class _OutputIterator, class _BidirectionalIterator, |
| 6739 | 6741 | class _Traits, class _CharT> |
| 6740 | _OutputIterator | |
| 6742 | _LIBCPP_HIDE_FROM_ABI _OutputIterator | |
| 6741 | 6743 | regex_replace(_OutputIterator __output_iter, |
| 6742 | 6744 | _BidirectionalIterator __first, _BidirectionalIterator __last, |
| 6743 | 6745 | const basic_regex<_CharT, _Traits>& __e, const _CharT* __fmt, |
| ... | ... | @@ -6792,7 +6794,7 @@ regex_replace(const basic_string<_CharT, _ST, _SA>& __s, |
| 6792 | 6794 | regex_constants::match_flag_type __flags = regex_constants::match_default) |
| 6793 | 6795 | { |
| 6794 | 6796 | basic_string<_CharT, _ST, _SA> __r; |
| 6795 | _VSTD::regex_replace(back_inserter(__r), __s.begin(), __s.end(), __e, | |
| 6797 | _VSTD::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e, | |
| 6796 | 6798 | __fmt.c_str(), __flags); |
| 6797 | 6799 | return __r; |
| 6798 | 6800 | } |
| ... | ... | @@ -6805,7 +6807,7 @@ regex_replace(const basic_string<_CharT, _ST, _SA>& __s, |
| 6805 | 6807 | regex_constants::match_flag_type __flags = regex_constants::match_default) |
| 6806 | 6808 | { |
| 6807 | 6809 | basic_string<_CharT, _ST, _SA> __r; |
| 6808 | _VSTD::regex_replace(back_inserter(__r), __s.begin(), __s.end(), __e, | |
| 6810 | _VSTD::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e, | |
| 6809 | 6811 | __fmt, __flags); |
| 6810 | 6812 | return __r; |
| 6811 | 6813 | } |
| ... | ... | @@ -6819,7 +6821,7 @@ regex_replace(const _CharT* __s, |
| 6819 | 6821 | regex_constants::match_flag_type __flags = regex_constants::match_default) |
| 6820 | 6822 | { |
| 6821 | 6823 | basic_string<_CharT> __r; |
| 6822 | _VSTD::regex_replace(back_inserter(__r), __s, | |
| 6824 | _VSTD::regex_replace(std::back_inserter(__r), __s, | |
| 6823 | 6825 | __s + char_traits<_CharT>::length(__s), __e, |
| 6824 | 6826 | __fmt.c_str(), __flags); |
| 6825 | 6827 | return __r; |
| ... | ... | @@ -6834,7 +6836,7 @@ regex_replace(const _CharT* __s, |
| 6834 | 6836 | regex_constants::match_flag_type __flags = regex_constants::match_default) |
| 6835 | 6837 | { |
| 6836 | 6838 | basic_string<_CharT> __r; |
| 6837 | _VSTD::regex_replace(back_inserter(__r), __s, | |
| 6839 | _VSTD::regex_replace(std::back_inserter(__r), __s, | |
| 6838 | 6840 | __s + char_traits<_CharT>::length(__s), __e, |
| 6839 | 6841 | __fmt, __flags); |
| 6840 | 6842 | return __r; |
| ... | ... | @@ -6842,6 +6844,33 @@ regex_replace(const _CharT* __s, |
| 6842 | 6844 | |
| 6843 | 6845 | _LIBCPP_END_NAMESPACE_STD |
| 6844 | 6846 | |
| 6847 | #if _LIBCPP_STD_VER > 14 | |
| 6848 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 6849 | namespace pmr { | |
| 6850 | template <class _BidirT> | |
| 6851 | using match_results = std::match_results<_BidirT, polymorphic_allocator<std::sub_match<_BidirT>>>; | |
| 6852 | ||
| 6853 | using cmatch = match_results<const char*>; | |
| 6854 | using smatch = match_results<std::pmr::string::const_iterator>; | |
| 6855 | ||
| 6856 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 6857 | using wcmatch = match_results<const wchar_t*>; | |
| 6858 | using wsmatch = match_results<std::pmr::wstring::const_iterator>; | |
| 6859 | #endif | |
| 6860 | } // namespace pmr | |
| 6861 | _LIBCPP_END_NAMESPACE_STD | |
| 6862 | #endif | |
| 6863 | ||
| 6845 | 6864 | _LIBCPP_POP_MACROS |
| 6846 | 6865 | |
| 6866 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 6867 | # include <atomic> | |
| 6868 | # include <concepts> | |
| 6869 | # include <iosfwd> | |
| 6870 | # include <iterator> | |
| 6871 | # include <new> | |
| 6872 | # include <typeinfo> | |
| 6873 | # include <utility> | |
| 6874 | #endif | |
| 6875 | ||
| 6847 | 6876 | #endif // _LIBCPP_REGEX |
lib/libcxx/include/scoped_allocator+44-6| ... | ... | @@ -111,8 +111,19 @@ template <class OuterA1, class OuterA2, class... InnerAllocs> |
| 111 | 111 | |
| 112 | 112 | #include <__assert> // all public C++ headers provide the assertion handler |
| 113 | 113 | #include <__config> |
| 114 | #include <__memory/allocator_traits.h> | |
| 115 | #include <__memory/uses_allocator_construction.h> | |
| 116 | #include <__type_traits/common_type.h> | |
| 117 | #include <__type_traits/enable_if.h> | |
| 118 | #include <__type_traits/integral_constant.h> | |
| 119 | #include <__type_traits/is_constructible.h> | |
| 120 | #include <__type_traits/remove_reference.h> | |
| 121 | #include <__utility/declval.h> | |
| 114 | 122 | #include <__utility/forward.h> |
| 115 | #include <memory> | |
| 123 | #include <__utility/move.h> | |
| 124 | #include <__utility/pair.h> | |
| 125 | #include <__utility/piecewise_construct.h> | |
| 126 | #include <tuple> | |
| 116 | 127 | #include <version> |
| 117 | 128 | |
| 118 | 129 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -352,7 +363,7 @@ protected: |
| 352 | 363 | // __outermost |
| 353 | 364 | |
| 354 | 365 | template <class _Alloc> |
| 355 | decltype(declval<_Alloc>().outer_allocator(), true_type()) | |
| 366 | decltype(std::declval<_Alloc>().outer_allocator(), true_type()) | |
| 356 | 367 | __has_outer_allocator_test(_Alloc&& __a); |
| 357 | 368 | |
| 358 | 369 | template <class _Alloc> |
| ... | ... | @@ -363,7 +374,7 @@ template <class _Alloc> |
| 363 | 374 | struct __has_outer_allocator |
| 364 | 375 | : public common_type |
| 365 | 376 | < |
| 366 | decltype(__has_outer_allocator_test(declval<_Alloc&>())) | |
| 377 | decltype(std::__has_outer_allocator_test(std::declval<_Alloc&>())) | |
| 367 | 378 | >::type |
| 368 | 379 | { |
| 369 | 380 | }; |
| ... | ... | @@ -379,10 +390,10 @@ struct __outermost |
| 379 | 390 | template <class _Alloc> |
| 380 | 391 | struct __outermost<_Alloc, true> |
| 381 | 392 | { |
| 382 | typedef typename remove_reference | |
| 393 | typedef __libcpp_remove_reference_t | |
| 383 | 394 | < |
| 384 | decltype(declval<_Alloc>().outer_allocator()) | |
| 385 | >::type _OuterAlloc; | |
| 395 | decltype(std::declval<_Alloc>().outer_allocator()) | |
| 396 | > _OuterAlloc; | |
| 386 | 397 | typedef typename __outermost<_OuterAlloc>::type type; |
| 387 | 398 | _LIBCPP_INLINE_VISIBILITY |
| 388 | 399 | type& operator()(_Alloc& __a) const _NOEXCEPT |
| ... | ... | @@ -501,6 +512,18 @@ public: |
| 501 | 512 | size_type max_size() const |
| 502 | 513 | {return allocator_traits<outer_allocator_type>::max_size(outer_allocator());} |
| 503 | 514 | |
| 515 | #if _LIBCPP_STD_VER >= 20 | |
| 516 | template <class _Type, class... _Args> | |
| 517 | _LIBCPP_HIDE_FROM_ABI void construct(_Type* __ptr, _Args&&... __args) { | |
| 518 | using _OM = __outermost<outer_allocator_type>; | |
| 519 | std::apply( | |
| 520 | [__ptr, this](auto&&... __newargs) { | |
| 521 | allocator_traits<typename _OM::type>::construct( | |
| 522 | _OM()(outer_allocator()), __ptr, std::forward<decltype(__newargs)>(__newargs)...); | |
| 523 | }, | |
| 524 | std::uses_allocator_construction_args<_Type>(inner_allocator(), std::forward<_Args>(__args)...)); | |
| 525 | } | |
| 526 | #else | |
| 504 | 527 | template <class _Tp, class... _Args> |
| 505 | 528 | _LIBCPP_INLINE_VISIBILITY |
| 506 | 529 | void construct(_Tp* __p, _Args&& ...__args) |
| ... | ... | @@ -555,6 +578,7 @@ public: |
| 555 | 578 | _VSTD::forward_as_tuple(_VSTD::forward<_Up>(__x.first)), |
| 556 | 579 | _VSTD::forward_as_tuple(_VSTD::forward<_Vp>(__x.second))); |
| 557 | 580 | } |
| 581 | #endif | |
| 558 | 582 | |
| 559 | 583 | template <class _Tp> |
| 560 | 584 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -692,4 +716,18 @@ operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a, |
| 692 | 716 | |
| 693 | 717 | _LIBCPP_END_NAMESPACE_STD |
| 694 | 718 | |
| 719 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 720 | # include <atomic> | |
| 721 | # include <climits> | |
| 722 | # include <concepts> | |
| 723 | # include <cstring> | |
| 724 | # include <ctime> | |
| 725 | # include <iterator> | |
| 726 | # include <memory> | |
| 727 | # include <ratio> | |
| 728 | # include <stdexcept> | |
| 729 | # include <type_traits> | |
| 730 | # include <variant> | |
| 731 | #endif | |
| 732 | ||
| 695 | 733 | #endif // _LIBCPP_SCOPED_ALLOCATOR |
lib/libcxx/include/semaphore+17-17| ... | ... | @@ -80,31 +80,31 @@ functions. It avoids contention against users' own use of those facilities. |
| 80 | 80 | |
| 81 | 81 | class __atomic_semaphore_base |
| 82 | 82 | { |
| 83 | __atomic_base<ptrdiff_t> __a; | |
| 83 | __atomic_base<ptrdiff_t> __a_; | |
| 84 | 84 | |
| 85 | 85 | public: |
| 86 | 86 | _LIBCPP_INLINE_VISIBILITY |
| 87 | constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a(__count) | |
| 87 | constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a_(__count) | |
| 88 | 88 | { |
| 89 | 89 | } |
| 90 | 90 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 91 | 91 | void release(ptrdiff_t __update = 1) |
| 92 | 92 | { |
| 93 | if(0 < __a.fetch_add(__update, memory_order_release)) | |
| 93 | if(0 < __a_.fetch_add(__update, memory_order_release)) | |
| 94 | 94 | ; |
| 95 | 95 | else if(__update > 1) |
| 96 | __a.notify_all(); | |
| 96 | __a_.notify_all(); | |
| 97 | 97 | else |
| 98 | __a.notify_one(); | |
| 98 | __a_.notify_one(); | |
| 99 | 99 | } |
| 100 | 100 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 101 | 101 | void acquire() |
| 102 | 102 | { |
| 103 | 103 | auto const __test_fn = [this]() -> bool { |
| 104 | auto __old = __a.load(memory_order_relaxed); | |
| 105 | return (__old != 0) && __a.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed); | |
| 104 | auto __old = __a_.load(memory_order_relaxed); | |
| 105 | return (__old != 0) && __a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed); | |
| 106 | 106 | }; |
| 107 | __cxx_atomic_wait(&__a.__a_, __test_fn); | |
| 107 | __cxx_atomic_wait(&__a_.__a_, __test_fn); | |
| 108 | 108 | } |
| 109 | 109 | template <class Rep, class Period> |
| 110 | 110 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -113,16 +113,16 @@ public: |
| 113 | 113 | if (__rel_time == chrono::duration<Rep, Period>::zero()) |
| 114 | 114 | return try_acquire(); |
| 115 | 115 | auto const __test_fn = [this]() { return try_acquire(); }; |
| 116 | return __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy(), __rel_time); | |
| 116 | return std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy(), __rel_time); | |
| 117 | 117 | } |
| 118 | 118 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 119 | 119 | bool try_acquire() |
| 120 | 120 | { |
| 121 | auto __old = __a.load(memory_order_acquire); | |
| 121 | auto __old = __a_.load(memory_order_acquire); | |
| 122 | 122 | while (true) { |
| 123 | 123 | if (__old == 0) |
| 124 | 124 | return false; |
| 125 | if (__a.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed)) | |
| 125 | if (__a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed)) | |
| 126 | 126 | return true; |
| 127 | 127 | } |
| 128 | 128 | } |
| ... | ... | @@ -133,7 +133,7 @@ public: |
| 133 | 133 | template<ptrdiff_t __least_max_value = _LIBCPP_SEMAPHORE_MAX> |
| 134 | 134 | class counting_semaphore |
| 135 | 135 | { |
| 136 | __atomic_semaphore_base __semaphore; | |
| 136 | __atomic_semaphore_base __semaphore_; | |
| 137 | 137 | |
| 138 | 138 | public: |
| 139 | 139 | static constexpr ptrdiff_t max() noexcept { |
| ... | ... | @@ -141,7 +141,7 @@ public: |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | _LIBCPP_INLINE_VISIBILITY |
| 144 | constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore(__count) { } | |
| 144 | constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore_(__count) { } | |
| 145 | 145 | ~counting_semaphore() = default; |
| 146 | 146 | |
| 147 | 147 | counting_semaphore(const counting_semaphore&) = delete; |
| ... | ... | @@ -150,23 +150,23 @@ public: |
| 150 | 150 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 151 | 151 | void release(ptrdiff_t __update = 1) |
| 152 | 152 | { |
| 153 | __semaphore.release(__update); | |
| 153 | __semaphore_.release(__update); | |
| 154 | 154 | } |
| 155 | 155 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 156 | 156 | void acquire() |
| 157 | 157 | { |
| 158 | __semaphore.acquire(); | |
| 158 | __semaphore_.acquire(); | |
| 159 | 159 | } |
| 160 | 160 | template<class Rep, class Period> |
| 161 | 161 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 162 | 162 | bool try_acquire_for(chrono::duration<Rep, Period> const& __rel_time) |
| 163 | 163 | { |
| 164 | return __semaphore.try_acquire_for(chrono::duration_cast<chrono::nanoseconds>(__rel_time)); | |
| 164 | return __semaphore_.try_acquire_for(chrono::duration_cast<chrono::nanoseconds>(__rel_time)); | |
| 165 | 165 | } |
| 166 | 166 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 167 | 167 | bool try_acquire() |
| 168 | 168 | { |
| 169 | return __semaphore.try_acquire(); | |
| 169 | return __semaphore_.try_acquire(); | |
| 170 | 170 | } |
| 171 | 171 | template <class Clock, class Duration> |
| 172 | 172 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
lib/libcxx/include/set+29-5| ... | ... | @@ -480,16 +480,14 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 |
| 480 | 480 | #include <__iterator/erase_if_container.h> |
| 481 | 481 | #include <__iterator/iterator_traits.h> |
| 482 | 482 | #include <__iterator/reverse_iterator.h> |
| 483 | #include <__memory/allocator.h> | |
| 484 | #include <__memory_resource/polymorphic_allocator.h> | |
| 483 | 485 | #include <__node_handle> |
| 484 | 486 | #include <__tree> |
| 487 | #include <__type_traits/is_allocator.h> | |
| 485 | 488 | #include <__utility/forward.h> |
| 486 | 489 | #include <version> |
| 487 | 490 | |
| 488 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 489 | # include <functional> | |
| 490 | # include <iterator> | |
| 491 | #endif | |
| 492 | ||
| 493 | 491 | // standard-mandated includes |
| 494 | 492 | |
| 495 | 493 | // [iterator.range] |
| ... | ... | @@ -533,6 +531,10 @@ private: |
| 533 | 531 | typedef __tree<value_type, value_compare, allocator_type> __base; |
| 534 | 532 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 535 | 533 | |
| 534 | static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, | |
| 535 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 536 | "original allocator"); | |
| 537 | ||
| 536 | 538 | __base __tree_; |
| 537 | 539 | |
| 538 | 540 | public: |
| ... | ... | @@ -1066,6 +1068,10 @@ private: |
| 1066 | 1068 | typedef __tree<value_type, value_compare, allocator_type> __base; |
| 1067 | 1069 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 1068 | 1070 | |
| 1071 | static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, | |
| 1072 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 1073 | "original allocator"); | |
| 1074 | ||
| 1069 | 1075 | __base __tree_; |
| 1070 | 1076 | |
| 1071 | 1077 | public: |
| ... | ... | @@ -1578,4 +1584,22 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1578 | 1584 | |
| 1579 | 1585 | _LIBCPP_END_NAMESPACE_STD |
| 1580 | 1586 | |
| 1587 | #if _LIBCPP_STD_VER > 14 | |
| 1588 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 1589 | namespace pmr { | |
| 1590 | template <class _KeyT, class _CompareT = std::less<_KeyT>> | |
| 1591 | using set = std::set<_KeyT, _CompareT, polymorphic_allocator<_KeyT>>; | |
| 1592 | ||
| 1593 | template <class _KeyT, class _CompareT = std::less<_KeyT>> | |
| 1594 | using multiset = std::multiset<_KeyT, _CompareT, polymorphic_allocator<_KeyT>>; | |
| 1595 | } // namespace pmr | |
| 1596 | _LIBCPP_END_NAMESPACE_STD | |
| 1597 | #endif | |
| 1598 | ||
| 1599 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1600 | # include <concepts> | |
| 1601 | # include <functional> | |
| 1602 | # include <iterator> | |
| 1603 | #endif | |
| 1604 | ||
| 1581 | 1605 | #endif // _LIBCPP_SET |
lib/libcxx/include/setjmp.h+3-1| ... | ... | @@ -31,7 +31,9 @@ void longjmp(jmp_buf env, int val); |
| 31 | 31 | # pragma GCC system_header |
| 32 | 32 | #endif |
| 33 | 33 | |
| 34 | #include_next <setjmp.h> | |
| 34 | #if __has_include_next(<setjmp.h>) | |
| 35 | # include_next <setjmp.h> | |
| 36 | #endif | |
| 35 | 37 | |
| 36 | 38 | #ifdef __cplusplus |
| 37 | 39 |
lib/libcxx/include/shared_mutex+28-27| ... | ... | @@ -180,23 +180,23 @@ __shared_mutex_base |
| 180 | 180 | #if _LIBCPP_STD_VER > 14 |
| 181 | 181 | class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX shared_mutex |
| 182 | 182 | { |
| 183 | __shared_mutex_base __base; | |
| 183 | __shared_mutex_base __base_; | |
| 184 | 184 | public: |
| 185 | _LIBCPP_INLINE_VISIBILITY shared_mutex() : __base() {} | |
| 185 | _LIBCPP_INLINE_VISIBILITY shared_mutex() : __base_() {} | |
| 186 | 186 | _LIBCPP_INLINE_VISIBILITY ~shared_mutex() = default; |
| 187 | 187 | |
| 188 | 188 | shared_mutex(const shared_mutex&) = delete; |
| 189 | 189 | shared_mutex& operator=(const shared_mutex&) = delete; |
| 190 | 190 | |
| 191 | 191 | // Exclusive ownership |
| 192 | _LIBCPP_INLINE_VISIBILITY void lock() { return __base.lock(); } | |
| 193 | _LIBCPP_INLINE_VISIBILITY bool try_lock() { return __base.try_lock(); } | |
| 194 | _LIBCPP_INLINE_VISIBILITY void unlock() { return __base.unlock(); } | |
| 192 | _LIBCPP_INLINE_VISIBILITY void lock() { return __base_.lock(); } | |
| 193 | _LIBCPP_INLINE_VISIBILITY bool try_lock() { return __base_.try_lock(); } | |
| 194 | _LIBCPP_INLINE_VISIBILITY void unlock() { return __base_.unlock(); } | |
| 195 | 195 | |
| 196 | 196 | // Shared ownership |
| 197 | _LIBCPP_INLINE_VISIBILITY void lock_shared() { return __base.lock_shared(); } | |
| 198 | _LIBCPP_INLINE_VISIBILITY bool try_lock_shared() { return __base.try_lock_shared(); } | |
| 199 | _LIBCPP_INLINE_VISIBILITY void unlock_shared() { return __base.unlock_shared(); } | |
| 197 | _LIBCPP_INLINE_VISIBILITY void lock_shared() { return __base_.lock_shared(); } | |
| 198 | _LIBCPP_INLINE_VISIBILITY bool try_lock_shared() { return __base_.try_lock_shared(); } | |
| 199 | _LIBCPP_INLINE_VISIBILITY void unlock_shared() { return __base_.unlock_shared(); } | |
| 200 | 200 | |
| 201 | 201 | // typedef __shared_mutex_base::native_handle_type native_handle_type; |
| 202 | 202 | // _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() { return __base::unlock_shared(); } |
| ... | ... | @@ -206,7 +206,7 @@ public: |
| 206 | 206 | |
| 207 | 207 | class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX shared_timed_mutex |
| 208 | 208 | { |
| 209 | __shared_mutex_base __base; | |
| 209 | __shared_mutex_base __base_; | |
| 210 | 210 | public: |
| 211 | 211 | shared_timed_mutex(); |
| 212 | 212 | _LIBCPP_INLINE_VISIBILITY ~shared_timed_mutex() = default; |
| ... | ... | @@ -252,30 +252,30 @@ bool |
| 252 | 252 | shared_timed_mutex::try_lock_until( |
| 253 | 253 | const chrono::time_point<_Clock, _Duration>& __abs_time) |
| 254 | 254 | { |
| 255 | unique_lock<mutex> __lk(__base.__mut_); | |
| 256 | if (__base.__state_ & __base.__write_entered_) | |
| 255 | unique_lock<mutex> __lk(__base_.__mut_); | |
| 256 | if (__base_.__state_ & __base_.__write_entered_) | |
| 257 | 257 | { |
| 258 | 258 | while (true) |
| 259 | 259 | { |
| 260 | cv_status __status = __base.__gate1_.wait_until(__lk, __abs_time); | |
| 261 | if ((__base.__state_ & __base.__write_entered_) == 0) | |
| 260 | cv_status __status = __base_.__gate1_.wait_until(__lk, __abs_time); | |
| 261 | if ((__base_.__state_ & __base_.__write_entered_) == 0) | |
| 262 | 262 | break; |
| 263 | 263 | if (__status == cv_status::timeout) |
| 264 | 264 | return false; |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | __base.__state_ |= __base.__write_entered_; | |
| 268 | if (__base.__state_ & __base.__n_readers_) | |
| 267 | __base_.__state_ |= __base_.__write_entered_; | |
| 268 | if (__base_.__state_ & __base_.__n_readers_) | |
| 269 | 269 | { |
| 270 | 270 | while (true) |
| 271 | 271 | { |
| 272 | cv_status __status = __base.__gate2_.wait_until(__lk, __abs_time); | |
| 273 | if ((__base.__state_ & __base.__n_readers_) == 0) | |
| 272 | cv_status __status = __base_.__gate2_.wait_until(__lk, __abs_time); | |
| 273 | if ((__base_.__state_ & __base_.__n_readers_) == 0) | |
| 274 | 274 | break; |
| 275 | 275 | if (__status == cv_status::timeout) |
| 276 | 276 | { |
| 277 | __base.__state_ &= ~__base.__write_entered_; | |
| 278 | __base.__gate1_.notify_all(); | |
| 277 | __base_.__state_ &= ~__base_.__write_entered_; | |
| 278 | __base_.__gate1_.notify_all(); | |
| 279 | 279 | return false; |
| 280 | 280 | } |
| 281 | 281 | } |
| ... | ... | @@ -288,22 +288,22 @@ bool |
| 288 | 288 | shared_timed_mutex::try_lock_shared_until( |
| 289 | 289 | const chrono::time_point<_Clock, _Duration>& __abs_time) |
| 290 | 290 | { |
| 291 | unique_lock<mutex> __lk(__base.__mut_); | |
| 292 | if ((__base.__state_ & __base.__write_entered_) || (__base.__state_ & __base.__n_readers_) == __base.__n_readers_) | |
| 291 | unique_lock<mutex> __lk(__base_.__mut_); | |
| 292 | if ((__base_.__state_ & __base_.__write_entered_) || (__base_.__state_ & __base_.__n_readers_) == __base_.__n_readers_) | |
| 293 | 293 | { |
| 294 | 294 | while (true) |
| 295 | 295 | { |
| 296 | cv_status status = __base.__gate1_.wait_until(__lk, __abs_time); | |
| 297 | if ((__base.__state_ & __base.__write_entered_) == 0 && | |
| 298 | (__base.__state_ & __base.__n_readers_) < __base.__n_readers_) | |
| 296 | cv_status status = __base_.__gate1_.wait_until(__lk, __abs_time); | |
| 297 | if ((__base_.__state_ & __base_.__write_entered_) == 0 && | |
| 298 | (__base_.__state_ & __base_.__n_readers_) < __base_.__n_readers_) | |
| 299 | 299 | break; |
| 300 | 300 | if (status == cv_status::timeout) |
| 301 | 301 | return false; |
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | unsigned __num_readers = (__base.__state_ & __base.__n_readers_) + 1; | |
| 305 | __base.__state_ &= ~__base.__n_readers_; | |
| 306 | __base.__state_ |= __num_readers; | |
| 304 | unsigned __num_readers = (__base_.__state_ & __base_.__n_readers_) + 1; | |
| 305 | __base_.__state_ &= ~__base_.__n_readers_; | |
| 306 | __base_.__state_ |= __num_readers; | |
| 307 | 307 | return true; |
| 308 | 308 | } |
| 309 | 309 | |
| ... | ... | @@ -432,6 +432,7 @@ public: |
| 432 | 432 | _LIBCPP_INLINE_VISIBILITY |
| 433 | 433 | mutex_type* mutex() const _NOEXCEPT {return __m_;} |
| 434 | 434 | }; |
| 435 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(shared_lock); | |
| 435 | 436 | |
| 436 | 437 | template <class _Mutex> |
| 437 | 438 | void |
lib/libcxx/include/source_location created+85| ... | ... | @@ -0,0 +1,85 @@ |
| 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_SOURCE_LOCATION | |
| 11 | #define _LIBCPP_SOURCE_LOCATION | |
| 12 | ||
| 13 | /* source_location synopsis | |
| 14 | ||
| 15 | namespace std { | |
| 16 | struct source_location { | |
| 17 | static consteval source_location current() noexcept; | |
| 18 | constexpr source_location() noexcept; | |
| 19 | ||
| 20 | constexpr uint_least32_t line() const noexcept; | |
| 21 | constexpr uint_least32_t column() const noexcept; | |
| 22 | constexpr const char* file_name() const noexcept; | |
| 23 | constexpr const char* function_name() const noexcept; | |
| 24 | }; | |
| 25 | } | |
| 26 | */ | |
| 27 | ||
| 28 | #include <__config> | |
| 29 | #include <cstdint> | |
| 30 | #include <version> | |
| 31 | ||
| 32 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 33 | # pragma GCC system_header | |
| 34 | #endif | |
| 35 | ||
| 36 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 37 | ||
| 38 | #if _LIBCPP_STD_VER >= 20 && __has_builtin(__builtin_source_location) | |
| 39 | ||
| 40 | class source_location { | |
| 41 | // The names source_location::__impl, _M_file_name, _M_function_name, _M_line, and _M_column | |
| 42 | // are hard-coded in the compiler and must not be changed here. | |
| 43 | struct __impl { | |
| 44 | const char* _M_file_name; | |
| 45 | const char* _M_function_name; | |
| 46 | unsigned _M_line; | |
| 47 | unsigned _M_column; | |
| 48 | }; | |
| 49 | const __impl* __ptr_ = nullptr; | |
| 50 | // GCC returns the type 'const void*' from the builtin, while clang returns | |
| 51 | // `const __impl*`. Per C++ [expr.const], casts from void* are not permitted | |
| 52 | // in constant evaluation, so we don't want to use `void*` as the argument | |
| 53 | // type unless the builtin returned that, anyhow, and the invalid cast is | |
| 54 | // unavoidable. | |
| 55 | using __bsl_ty = decltype(__builtin_source_location()); | |
| 56 | ||
| 57 | public: | |
| 58 | // The defaulted __ptr argument is necessary so that the builtin is evaluated | |
| 59 | // in the context of the caller. An explicit value should never be provided. | |
| 60 | static consteval source_location current(__bsl_ty __ptr = __builtin_source_location()) noexcept { | |
| 61 | source_location __sl; | |
| 62 | __sl.__ptr_ = static_cast<const __impl*>(__ptr); | |
| 63 | return __sl; | |
| 64 | } | |
| 65 | _LIBCPP_HIDE_FROM_ABI constexpr source_location() noexcept = default; | |
| 66 | ||
| 67 | _LIBCPP_HIDE_FROM_ABI constexpr uint_least32_t line() const noexcept { | |
| 68 | return __ptr_ != nullptr ? __ptr_->_M_line : 0; | |
| 69 | } | |
| 70 | _LIBCPP_HIDE_FROM_ABI constexpr uint_least32_t column() const noexcept { | |
| 71 | return __ptr_ != nullptr ? __ptr_->_M_column : 0; | |
| 72 | } | |
| 73 | _LIBCPP_HIDE_FROM_ABI constexpr const char* file_name() const noexcept { | |
| 74 | return __ptr_ != nullptr ? __ptr_->_M_file_name : ""; | |
| 75 | } | |
| 76 | _LIBCPP_HIDE_FROM_ABI constexpr const char* function_name() const noexcept { | |
| 77 | return __ptr_ != nullptr ? __ptr_->_M_function_name : ""; | |
| 78 | } | |
| 79 | }; | |
| 80 | ||
| 81 | #endif // _LIBCPP_STD_VER >= 20 && __has_builtin(__builtin_source_location) | |
| 82 | ||
| 83 | _LIBCPP_END_NAMESPACE_STD | |
| 84 | ||
| 85 | #endif // _LIBCPP_SOURCE_LOCATION |
lib/libcxx/include/span+43-94| ... | ... | @@ -148,11 +148,6 @@ template<class R> |
| 148 | 148 | #include <type_traits> // for remove_cv, etc |
| 149 | 149 | #include <version> |
| 150 | 150 | |
| 151 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 152 | # include <functional> | |
| 153 | # include <iterator> | |
| 154 | #endif | |
| 155 | ||
| 156 | 151 | // standard-mandated includes |
| 157 | 152 | |
| 158 | 153 | // [iterator.range] |
| ... | ... | @@ -185,23 +180,6 @@ struct __is_std_span : false_type {}; |
| 185 | 180 | template <class _Tp, size_t _Sz> |
| 186 | 181 | struct __is_std_span<span<_Tp, _Sz>> : true_type {}; |
| 187 | 182 | |
| 188 | #if defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 189 | // This is a temporary workaround until we ship <ranges> -- we've unfortunately been | |
| 190 | // shipping <span> before its API was finalized, and we used to provide a constructor | |
| 191 | // from container types that had the requirements below. To avoid breaking code that | |
| 192 | // has started relying on the range-based constructor until we ship all of <ranges>, | |
| 193 | // we emulate the constructor requirements like this. | |
| 194 | template <class _Range, class _ElementType> | |
| 195 | concept __span_compatible_range = | |
| 196 | !__is_std_span<remove_cvref_t<_Range>>::value && | |
| 197 | !__is_std_array<remove_cvref_t<_Range>>::value && | |
| 198 | !is_array_v<remove_cvref_t<_Range>> && | |
| 199 | requires (_Range&& __r) { | |
| 200 | data(std::forward<_Range>(__r)); | |
| 201 | size(std::forward<_Range>(__r)); | |
| 202 | } && | |
| 203 | is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>; | |
| 204 | #else | |
| 205 | 183 | template <class _Range, class _ElementType> |
| 206 | 184 | concept __span_compatible_range = |
| 207 | 185 | ranges::contiguous_range<_Range> && |
| ... | ... | @@ -211,7 +189,6 @@ concept __span_compatible_range = |
| 211 | 189 | !__is_std_array<remove_cvref_t<_Range>>::value && |
| 212 | 190 | !is_array_v<remove_cvref_t<_Range>> && |
| 213 | 191 | is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>; |
| 214 | #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 215 | 192 | |
| 216 | 193 | template <class _From, class _To> |
| 217 | 194 | concept __span_array_convertible = is_convertible_v<_From(*)[], _To(*)[]>; |
| ... | ... | @@ -234,7 +211,7 @@ public: |
| 234 | 211 | using const_pointer = const _Tp *; |
| 235 | 212 | using reference = _Tp &; |
| 236 | 213 | using const_reference = const _Tp &; |
| 237 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE | |
| 214 | #ifdef _LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING | |
| 238 | 215 | using iterator = __bounded_iter<pointer>; |
| 239 | 216 | #else |
| 240 | 217 | using iterator = __wrap_iter<pointer>; |
| ... | ... | @@ -245,7 +222,7 @@ public: |
| 245 | 222 | |
| 246 | 223 | // [span.cons], span constructors, copy, assignment, and destructor |
| 247 | 224 | template <size_t _Sz = _Extent> requires(_Sz == 0) |
| 248 | _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} {} | |
| 225 | _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data_{nullptr} {} | |
| 249 | 226 | |
| 250 | 227 | constexpr span (const span&) noexcept = default; |
| 251 | 228 | constexpr span& operator=(const span&) noexcept = default; |
| ... | ... | @@ -253,61 +230,46 @@ public: |
| 253 | 230 | template <__span_compatible_iterator<element_type> _It> |
| 254 | 231 | _LIBCPP_INLINE_VISIBILITY |
| 255 | 232 | constexpr explicit span(_It __first, size_type __count) |
| 256 | : __data{_VSTD::to_address(__first)} { | |
| 233 | : __data_{_VSTD::to_address(__first)} { | |
| 257 | 234 | (void)__count; |
| 258 | 235 | _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (iterator, len)"); |
| 259 | 236 | } |
| 260 | 237 | |
| 261 | 238 | template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End> |
| 262 | 239 | _LIBCPP_INLINE_VISIBILITY |
| 263 | constexpr explicit span(_It __first, _End __last) : __data{_VSTD::to_address(__first)} { | |
| 240 | constexpr explicit span(_It __first, _End __last) : __data_{_VSTD::to_address(__first)} { | |
| 264 | 241 | (void)__last; |
| 265 | 242 | _LIBCPP_ASSERT((__last - __first >= 0), "invalid range in span's constructor (iterator, sentinel)"); |
| 266 | 243 | _LIBCPP_ASSERT(__last - __first == _Extent, |
| 267 | 244 | "invalid range in span's constructor (iterator, sentinel): last - first != extent"); |
| 268 | 245 | } |
| 269 | 246 | |
| 270 | _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data{__arr} {} | |
| 247 | _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data_{__arr} {} | |
| 271 | 248 | |
| 272 | 249 | template <__span_array_convertible<element_type> _OtherElementType> |
| 273 | 250 | _LIBCPP_INLINE_VISIBILITY |
| 274 | constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {} | |
| 251 | constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {} | |
| 275 | 252 | |
| 276 | 253 | template <class _OtherElementType> |
| 277 | 254 | requires __span_array_convertible<const _OtherElementType, element_type> |
| 278 | 255 | _LIBCPP_INLINE_VISIBILITY |
| 279 | constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {} | |
| 256 | constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {} | |
| 280 | 257 | |
| 281 | #if defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 282 | template <class _Container> | |
| 283 | requires __span_compatible_range<_Container, element_type> | |
| 284 | _LIBCPP_INLINE_VISIBILITY | |
| 285 | constexpr explicit span(_Container& __c) : __data{std::data(__c)} { | |
| 286 | _LIBCPP_ASSERT(std::size(__c) == _Extent, "size mismatch in span's constructor (range)"); | |
| 287 | } | |
| 288 | template <class _Container> | |
| 289 | requires __span_compatible_range<const _Container, element_type> | |
| 290 | _LIBCPP_INLINE_VISIBILITY | |
| 291 | constexpr explicit span(const _Container& __c) : __data{std::data(__c)} { | |
| 292 | _LIBCPP_ASSERT(std::size(__c) == _Extent, "size mismatch in span's constructor (range)"); | |
| 293 | } | |
| 294 | #else | |
| 295 | 258 | template <__span_compatible_range<element_type> _Range> |
| 296 | 259 | _LIBCPP_INLINE_VISIBILITY |
| 297 | constexpr explicit span(_Range&& __r) : __data{ranges::data(__r)} { | |
| 260 | constexpr explicit span(_Range&& __r) : __data_{ranges::data(__r)} { | |
| 298 | 261 | _LIBCPP_ASSERT(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)"); |
| 299 | 262 | } |
| 300 | #endif | |
| 301 | 263 | |
| 302 | 264 | template <__span_array_convertible<element_type> _OtherElementType> |
| 303 | 265 | _LIBCPP_INLINE_VISIBILITY |
| 304 | 266 | constexpr span(const span<_OtherElementType, _Extent>& __other) |
| 305 | : __data{__other.data()} {} | |
| 267 | : __data_{__other.data()} {} | |
| 306 | 268 | |
| 307 | 269 | template <__span_array_convertible<element_type> _OtherElementType> |
| 308 | 270 | _LIBCPP_INLINE_VISIBILITY |
| 309 | 271 | constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other) noexcept |
| 310 | : __data{__other.data()} { _LIBCPP_ASSERT(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); } | |
| 272 | : __data_{__other.data()} { _LIBCPP_ASSERT(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); } | |
| 311 | 273 | |
| 312 | 274 | |
| 313 | 275 | // ~span() noexcept = default; |
| ... | ... | @@ -374,33 +336,33 @@ public: |
| 374 | 336 | _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept |
| 375 | 337 | { |
| 376 | 338 | _LIBCPP_ASSERT(__idx < size(), "span<T, N>::operator[](index): index out of range"); |
| 377 | return __data[__idx]; | |
| 339 | return __data_[__idx]; | |
| 378 | 340 | } |
| 379 | 341 | |
| 380 | 342 | _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept |
| 381 | 343 | { |
| 382 | 344 | _LIBCPP_ASSERT(!empty(), "span<T, N>::front() on empty span"); |
| 383 | return __data[0]; | |
| 345 | return __data_[0]; | |
| 384 | 346 | } |
| 385 | 347 | |
| 386 | 348 | _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept |
| 387 | 349 | { |
| 388 | 350 | _LIBCPP_ASSERT(!empty(), "span<T, N>::back() on empty span"); |
| 389 | return __data[size()-1]; | |
| 351 | return __data_[size()-1]; | |
| 390 | 352 | } |
| 391 | 353 | |
| 392 | _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } | |
| 354 | _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data_; } | |
| 393 | 355 | |
| 394 | 356 | // [span.iter], span iterator support |
| 395 | 357 | _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { |
| 396 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE | |
| 358 | #ifdef _LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING | |
| 397 | 359 | return std::__make_bounded_iter(data(), data(), data() + size()); |
| 398 | 360 | #else |
| 399 | 361 | return iterator(this, data()); |
| 400 | 362 | #endif |
| 401 | 363 | } |
| 402 | 364 | _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { |
| 403 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE | |
| 365 | #ifdef _LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING | |
| 404 | 366 | return std::__make_bounded_iter(data() + size(), data(), data() + size()); |
| 405 | 367 | #else |
| 406 | 368 | return iterator(this, data() + size()); |
| ... | ... | @@ -416,7 +378,7 @@ public: |
| 416 | 378 | { return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte *>(data()), size_bytes()}; } |
| 417 | 379 | |
| 418 | 380 | private: |
| 419 | pointer __data; | |
| 381 | pointer __data_; | |
| 420 | 382 | }; |
| 421 | 383 | |
| 422 | 384 | |
| ... | ... | @@ -432,7 +394,7 @@ public: |
| 432 | 394 | using const_pointer = const _Tp *; |
| 433 | 395 | using reference = _Tp &; |
| 434 | 396 | using const_reference = const _Tp &; |
| 435 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE | |
| 397 | #ifdef _LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING | |
| 436 | 398 | using iterator = __bounded_iter<pointer>; |
| 437 | 399 | #else |
| 438 | 400 | using iterator = __wrap_iter<pointer>; |
| ... | ... | @@ -442,7 +404,7 @@ public: |
| 442 | 404 | static constexpr size_type extent = dynamic_extent; |
| 443 | 405 | |
| 444 | 406 | // [span.cons], span constructors, copy, assignment, and destructor |
| 445 | _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}, __size{0} {} | |
| 407 | _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data_{nullptr}, __size_{0} {} | |
| 446 | 408 | |
| 447 | 409 | constexpr span (const span&) noexcept = default; |
| 448 | 410 | constexpr span& operator=(const span&) noexcept = default; |
| ... | ... | @@ -450,46 +412,35 @@ public: |
| 450 | 412 | template <__span_compatible_iterator<element_type> _It> |
| 451 | 413 | _LIBCPP_INLINE_VISIBILITY |
| 452 | 414 | constexpr span(_It __first, size_type __count) |
| 453 | : __data{_VSTD::to_address(__first)}, __size{__count} {} | |
| 415 | : __data_{_VSTD::to_address(__first)}, __size_{__count} {} | |
| 454 | 416 | |
| 455 | 417 | template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End> |
| 456 | 418 | _LIBCPP_INLINE_VISIBILITY constexpr span(_It __first, _End __last) |
| 457 | : __data(_VSTD::to_address(__first)), __size(__last - __first) { | |
| 419 | : __data_(_VSTD::to_address(__first)), __size_(__last - __first) { | |
| 458 | 420 | _LIBCPP_ASSERT(__last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)"); |
| 459 | 421 | } |
| 460 | 422 | |
| 461 | 423 | template <size_t _Sz> |
| 462 | 424 | _LIBCPP_INLINE_VISIBILITY |
| 463 | constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {} | |
| 425 | constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept : __data_{__arr}, __size_{_Sz} {} | |
| 464 | 426 | |
| 465 | 427 | template <__span_array_convertible<element_type> _OtherElementType, size_t _Sz> |
| 466 | 428 | _LIBCPP_INLINE_VISIBILITY |
| 467 | constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {} | |
| 429 | constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept : __data_{__arr.data()}, __size_{_Sz} {} | |
| 468 | 430 | |
| 469 | 431 | template <class _OtherElementType, size_t _Sz> |
| 470 | 432 | requires __span_array_convertible<const _OtherElementType, element_type> |
| 471 | 433 | _LIBCPP_INLINE_VISIBILITY |
| 472 | constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {} | |
| 434 | constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept : __data_{__arr.data()}, __size_{_Sz} {} | |
| 473 | 435 | |
| 474 | #if defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 475 | template <class _Container> | |
| 476 | requires __span_compatible_range<_Container, element_type> | |
| 477 | _LIBCPP_INLINE_VISIBILITY | |
| 478 | constexpr span(_Container& __c) : __data(std::data(__c)), __size{std::size(__c)} {} | |
| 479 | template <class _Container> | |
| 480 | requires __span_compatible_range<const _Container, element_type> | |
| 481 | _LIBCPP_INLINE_VISIBILITY | |
| 482 | constexpr span(const _Container& __c) : __data(std::data(__c)), __size{std::size(__c)} {} | |
| 483 | #else | |
| 484 | 436 | template <__span_compatible_range<element_type> _Range> |
| 485 | 437 | _LIBCPP_INLINE_VISIBILITY |
| 486 | constexpr span(_Range&& __r) : __data(ranges::data(__r)), __size{ranges::size(__r)} {} | |
| 487 | #endif | |
| 438 | constexpr span(_Range&& __r) : __data_(ranges::data(__r)), __size_{ranges::size(__r)} {} | |
| 488 | 439 | |
| 489 | 440 | template <__span_array_convertible<element_type> _OtherElementType, size_t _OtherExtent> |
| 490 | 441 | _LIBCPP_INLINE_VISIBILITY |
| 491 | 442 | constexpr span(const span<_OtherElementType, _OtherExtent>& __other) noexcept |
| 492 | : __data{__other.data()}, __size{__other.size()} {} | |
| 443 | : __data_{__other.data()}, __size_{__other.size()} {} | |
| 493 | 444 | |
| 494 | 445 | // ~span() noexcept = default; |
| 495 | 446 | |
| ... | ... | @@ -544,41 +495,41 @@ public: |
| 544 | 495 | return {data() + __offset, __count}; |
| 545 | 496 | } |
| 546 | 497 | |
| 547 | _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return __size; } | |
| 548 | _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return __size * sizeof(element_type); } | |
| 549 | [[nodiscard]] _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; } | |
| 498 | _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return __size_; } | |
| 499 | _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return __size_ * sizeof(element_type); } | |
| 500 | [[nodiscard]] _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size_ == 0; } | |
| 550 | 501 | |
| 551 | 502 | _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept |
| 552 | 503 | { |
| 553 | 504 | _LIBCPP_ASSERT(__idx < size(), "span<T>::operator[](index): index out of range"); |
| 554 | return __data[__idx]; | |
| 505 | return __data_[__idx]; | |
| 555 | 506 | } |
| 556 | 507 | |
| 557 | 508 | _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept |
| 558 | 509 | { |
| 559 | 510 | _LIBCPP_ASSERT(!empty(), "span<T>::front() on empty span"); |
| 560 | return __data[0]; | |
| 511 | return __data_[0]; | |
| 561 | 512 | } |
| 562 | 513 | |
| 563 | 514 | _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept |
| 564 | 515 | { |
| 565 | 516 | _LIBCPP_ASSERT(!empty(), "span<T>::back() on empty span"); |
| 566 | return __data[size()-1]; | |
| 517 | return __data_[size()-1]; | |
| 567 | 518 | } |
| 568 | 519 | |
| 569 | 520 | |
| 570 | _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } | |
| 521 | _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data_; } | |
| 571 | 522 | |
| 572 | 523 | // [span.iter], span iterator support |
| 573 | 524 | _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { |
| 574 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE | |
| 525 | #ifdef _LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING | |
| 575 | 526 | return std::__make_bounded_iter(data(), data(), data() + size()); |
| 576 | 527 | #else |
| 577 | 528 | return iterator(this, data()); |
| 578 | 529 | #endif |
| 579 | 530 | } |
| 580 | 531 | _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { |
| 581 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE | |
| 532 | #ifdef _LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING | |
| 582 | 533 | return std::__make_bounded_iter(data() + size(), data(), data() + size()); |
| 583 | 534 | #else |
| 584 | 535 | return iterator(this, data() + size()); |
| ... | ... | @@ -594,8 +545,8 @@ public: |
| 594 | 545 | { return {reinterpret_cast<byte *>(data()), size_bytes()}; } |
| 595 | 546 | |
| 596 | 547 | private: |
| 597 | pointer __data; | |
| 598 | size_type __size; | |
| 548 | pointer __data_; | |
| 549 | size_type __size_; | |
| 599 | 550 | }; |
| 600 | 551 | |
| 601 | 552 | template <class _Tp, size_t _Extent> |
| ... | ... | @@ -629,16 +580,8 @@ template<class _Tp, size_t _Sz> |
| 629 | 580 | template<class _Tp, size_t _Sz> |
| 630 | 581 | span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>; |
| 631 | 582 | |
| 632 | #if defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 633 | template<class _Container> | |
| 634 | span(_Container&) -> span<typename _Container::value_type>; | |
| 635 | ||
| 636 | template<class _Container> | |
| 637 | span(const _Container&) -> span<const typename _Container::value_type>; | |
| 638 | #else | |
| 639 | 583 | template<ranges::contiguous_range _Range> |
| 640 | 584 | span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>; |
| 641 | #endif | |
| 642 | 585 | |
| 643 | 586 | #endif // _LIBCPP_STD_VER > 17 |
| 644 | 587 | |
| ... | ... | @@ -646,4 +589,10 @@ _LIBCPP_END_NAMESPACE_STD |
| 646 | 589 | |
| 647 | 590 | _LIBCPP_POP_MACROS |
| 648 | 591 | |
| 592 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 593 | # include <concepts> | |
| 594 | # include <functional> | |
| 595 | # include <iterator> | |
| 596 | #endif | |
| 597 | ||
| 649 | 598 | #endif // _LIBCPP_SPAN |
lib/libcxx/include/sstream+48-39| ... | ... | @@ -11,8 +11,9 @@ |
| 11 | 11 | #define _LIBCPP_SSTREAM |
| 12 | 12 | |
| 13 | 13 | /* |
| 14 | sstream synopsis | |
| 14 | sstream synopsis [sstream.syn] | |
| 15 | 15 | |
| 16 | // Class template basic_stringbuf [stringbuf] | |
| 16 | 17 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 17 | 18 | class basic_stringbuf |
| 18 | 19 | : public basic_streambuf<charT, traits> |
| ... | ... | @@ -25,7 +26,7 @@ public: |
| 25 | 26 | typedef typename traits_type::off_type off_type; |
| 26 | 27 | typedef Allocator allocator_type; |
| 27 | 28 | |
| 28 | // 27.8.1.1 [stringbuf.cons], constructors: | |
| 29 | // [stringbuf.cons] constructors: | |
| 29 | 30 | explicit basic_stringbuf(ios_base::openmode which = ios_base::in | ios_base::out); // before C++20 |
| 30 | 31 | basic_stringbuf() : basic_stringbuf(ios_base::in | ios_base::out) {} // C++20 |
| 31 | 32 | explicit basic_stringbuf(ios_base::openmode which); // C++20 |
| ... | ... | @@ -33,16 +34,16 @@ public: |
| 33 | 34 | ios_base::openmode which = ios_base::in | ios_base::out); |
| 34 | 35 | basic_stringbuf(basic_stringbuf&& rhs); |
| 35 | 36 | |
| 36 | // 27.8.1.2 Assign and swap: | |
| 37 | // [stringbuf.assign] Assign and swap: | |
| 37 | 38 | basic_stringbuf& operator=(basic_stringbuf&& rhs); |
| 38 | 39 | void swap(basic_stringbuf& rhs); |
| 39 | 40 | |
| 40 | // 27.8.1.3 Get and set: | |
| 41 | // [stringbuf.members] Member functions: | |
| 41 | 42 | basic_string<char_type, traits_type, allocator_type> str() const; |
| 42 | 43 | void str(const basic_string<char_type, traits_type, allocator_type>& s); |
| 43 | 44 | |
| 44 | 45 | protected: |
| 45 | // 27.8.1.4 Overridden virtual functions: | |
| 46 | // [stringbuf.virtuals] Overridden virtual functions: | |
| 46 | 47 | virtual int_type underflow(); |
| 47 | 48 | virtual int_type pbackfail(int_type c = traits_type::eof()); |
| 48 | 49 | virtual int_type overflow (int_type c = traits_type::eof()); |
| ... | ... | @@ -53,6 +54,7 @@ protected: |
| 53 | 54 | ios_base::openmode which = ios_base::in | ios_base::out); |
| 54 | 55 | }; |
| 55 | 56 | |
| 57 | // [stringbuf.assign] non member swap | |
| 56 | 58 | template <class charT, class traits, class Allocator> |
| 57 | 59 | void swap(basic_stringbuf<charT, traits, Allocator>& x, |
| 58 | 60 | basic_stringbuf<charT, traits, Allocator>& y); |
| ... | ... | @@ -60,6 +62,7 @@ template <class charT, class traits, class Allocator> |
| 60 | 62 | typedef basic_stringbuf<char> stringbuf; |
| 61 | 63 | typedef basic_stringbuf<wchar_t> wstringbuf; |
| 62 | 64 | |
| 65 | // Class template basic_istringstream [istringstream] | |
| 63 | 66 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 64 | 67 | class basic_istringstream |
| 65 | 68 | : public basic_istream<charT, traits> |
| ... | ... | @@ -72,7 +75,7 @@ public: |
| 72 | 75 | typedef typename traits_type::off_type off_type; |
| 73 | 76 | typedef Allocator allocator_type; |
| 74 | 77 | |
| 75 | // 27.8.2.1 Constructors: | |
| 78 | // [istringstream.cons] Constructors: | |
| 76 | 79 | explicit basic_istringstream(ios_base::openmode which = ios_base::in); // before C++20 |
| 77 | 80 | basic_istringstream() : basic_istringstream(ios_base::in) {} // C++20 |
| 78 | 81 | explicit basic_istringstream(ios_base::openmode which); // C++20 |
| ... | ... | @@ -81,11 +84,11 @@ public: |
| 81 | 84 | ios_base::openmode which = ios_base::in); |
| 82 | 85 | basic_istringstream(basic_istringstream&& rhs); |
| 83 | 86 | |
| 84 | // 27.8.2.2 Assign and swap: | |
| 87 | // [istringstream.assign] Assign and swap: | |
| 85 | 88 | basic_istringstream& operator=(basic_istringstream&& rhs); |
| 86 | 89 | void swap(basic_istringstream& rhs); |
| 87 | 90 | |
| 88 | // 27.8.2.3 Members: | |
| 91 | // [istringstream.members] Member functions: | |
| 89 | 92 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; |
| 90 | 93 | basic_string<char_type, traits_type, allocator_type> str() const; |
| 91 | 94 | void str(const basic_string<char_type, traits_type, allocator_type>& s); |
| ... | ... | @@ -98,6 +101,7 @@ template <class charT, class traits, class Allocator> |
| 98 | 101 | typedef basic_istringstream<char> istringstream; |
| 99 | 102 | typedef basic_istringstream<wchar_t> wistringstream; |
| 100 | 103 | |
| 104 | // Class template basic_ostringstream [ostringstream] | |
| 101 | 105 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 102 | 106 | class basic_ostringstream |
| 103 | 107 | : public basic_ostream<charT, traits> |
| ... | ... | @@ -111,7 +115,7 @@ public: |
| 111 | 115 | typedef typename traits_type::off_type off_type; |
| 112 | 116 | typedef Allocator allocator_type; |
| 113 | 117 | |
| 114 | // 27.8.3.1 Constructors/destructor: | |
| 118 | // [ostringstream.cons] Constructors: | |
| 115 | 119 | explicit basic_ostringstream(ios_base::openmode which = ios_base::out); // before C++20 |
| 116 | 120 | basic_ostringstream() : basic_ostringstream(ios_base::out) {} // C++20 |
| 117 | 121 | explicit basic_ostringstream(ios_base::openmode which); // C++20 |
| ... | ... | @@ -120,11 +124,11 @@ public: |
| 120 | 124 | ios_base::openmode which = ios_base::out); |
| 121 | 125 | basic_ostringstream(basic_ostringstream&& rhs); |
| 122 | 126 | |
| 123 | // 27.8.3.2 Assign/swap: | |
| 127 | // [ostringstream.assign] Assign and swap: | |
| 124 | 128 | basic_ostringstream& operator=(basic_ostringstream&& rhs); |
| 125 | 129 | void swap(basic_ostringstream& rhs); |
| 126 | 130 | |
| 127 | // 27.8.3.3 Members: | |
| 131 | // [ostringstream.members] Member functions: | |
| 128 | 132 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; |
| 129 | 133 | basic_string<char_type, traits_type, allocator_type> str() const; |
| 130 | 134 | void str(const basic_string<char_type, traits_type, allocator_type>& s); |
| ... | ... | @@ -137,6 +141,7 @@ template <class charT, class traits, class Allocator> |
| 137 | 141 | typedef basic_ostringstream<char> ostringstream; |
| 138 | 142 | typedef basic_ostringstream<wchar_t> wostringstream; |
| 139 | 143 | |
| 144 | // Class template basic_stringstream [stringstream] | |
| 140 | 145 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 141 | 146 | class basic_stringstream |
| 142 | 147 | : public basic_iostream<charT, traits> |
| ... | ... | @@ -150,7 +155,7 @@ public: |
| 150 | 155 | typedef typename traits_type::off_type off_type; |
| 151 | 156 | typedef Allocator allocator_type; |
| 152 | 157 | |
| 153 | // constructors/destructor | |
| 158 | // [stringstream.cons] constructors | |
| 154 | 159 | explicit basic_stringstream(ios_base::openmode which = ios_base::out | ios_base::in); // before C++20 |
| 155 | 160 | basic_stringstream() : basic_stringstream(ios_base::out | ios_base::in) {} // C++20 |
| 156 | 161 | explicit basic_stringstream(ios_base::openmode which); // C++20 |
| ... | ... | @@ -159,11 +164,11 @@ public: |
| 159 | 164 | ios_base::openmode which = ios_base::out|ios_base::in); |
| 160 | 165 | basic_stringstream(basic_stringstream&& rhs); |
| 161 | 166 | |
| 162 | // 27.8.5.1 Assign/swap: | |
| 167 | // [stringstream.assign] Assign and swap: | |
| 163 | 168 | basic_stringstream& operator=(basic_stringstream&& rhs); |
| 164 | 169 | void swap(basic_stringstream& rhs); |
| 165 | 170 | |
| 166 | // Members: | |
| 171 | // [stringstream.members] Member functions: | |
| 167 | 172 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; |
| 168 | 173 | basic_string<char_type, traits_type, allocator_type> str() const; |
| 169 | 174 | void str(const basic_string<char_type, traits_type, allocator_type>& str); |
| ... | ... | @@ -198,7 +203,7 @@ _LIBCPP_PUSH_MACROS |
| 198 | 203 | |
| 199 | 204 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 200 | 205 | |
| 201 | // basic_stringbuf | |
| 206 | // Class template basic_stringbuf [stringbuf] | |
| 202 | 207 | |
| 203 | 208 | template <class _CharT, class _Traits, class _Allocator> |
| 204 | 209 | class _LIBCPP_TEMPLATE_VIS basic_stringbuf |
| ... | ... | @@ -221,7 +226,7 @@ private: |
| 221 | 226 | ios_base::openmode __mode_; |
| 222 | 227 | |
| 223 | 228 | public: |
| 224 | // 30.8.2.1 [stringbuf.cons], constructors | |
| 229 | // [stringbuf.cons] constructors: | |
| 225 | 230 | _LIBCPP_INLINE_VISIBILITY |
| 226 | 231 | basic_stringbuf() |
| 227 | 232 | : __hm_(nullptr), __mode_(ios_base::in | ios_base::out) {} |
| ... | ... | @@ -240,24 +245,24 @@ public: |
| 240 | 245 | |
| 241 | 246 | basic_stringbuf(basic_stringbuf&& __rhs); |
| 242 | 247 | |
| 243 | // 27.8.1.2 Assign and swap: | |
| 248 | // [stringbuf.assign] Assign and swap: | |
| 244 | 249 | basic_stringbuf& operator=(basic_stringbuf&& __rhs); |
| 245 | 250 | void swap(basic_stringbuf& __rhs); |
| 246 | 251 | |
| 247 | // 27.8.1.3 Get and set: | |
| 252 | // [stringbuf.members] Member functions: | |
| 248 | 253 | string_type str() const; |
| 249 | 254 | void str(const string_type& __s); |
| 250 | 255 | |
| 251 | 256 | protected: |
| 252 | // 27.8.1.4 Overridden virtual functions: | |
| 253 | virtual int_type underflow(); | |
| 254 | virtual int_type pbackfail(int_type __c = traits_type::eof()); | |
| 255 | virtual int_type overflow (int_type __c = traits_type::eof()); | |
| 256 | virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, | |
| 257 | ios_base::openmode __wch = ios_base::in | ios_base::out); | |
| 258 | _LIBCPP_INLINE_VISIBILITY | |
| 259 | virtual pos_type seekpos(pos_type __sp, | |
| 260 | ios_base::openmode __wch = ios_base::in | ios_base::out) { | |
| 257 | // [stringbuf.virtuals] Overridden virtual functions: | |
| 258 | int_type underflow() override; | |
| 259 | int_type pbackfail(int_type __c = traits_type::eof()) override; | |
| 260 | int_type overflow (int_type __c = traits_type::eof()) override; | |
| 261 | pos_type seekoff(off_type __off, ios_base::seekdir __way, | |
| 262 | ios_base::openmode __wch = ios_base::in | ios_base::out) override; | |
| 263 | _LIBCPP_HIDE_FROM_ABI_VIRTUAL | |
| 264 | pos_type seekpos(pos_type __sp, | |
| 265 | ios_base::openmode __wch = ios_base::in | ios_base::out) override { | |
| 261 | 266 | return seekoff(__sp, ios_base::beg, __wch); |
| 262 | 267 | } |
| 263 | 268 | }; |
| ... | ... | @@ -619,7 +624,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off, |
| 619 | 624 | return pos_type(__noff); |
| 620 | 625 | } |
| 621 | 626 | |
| 622 | // basic_istringstream | |
| 627 | // Class template basic_istringstream [istringstream] | |
| 623 | 628 | |
| 624 | 629 | template <class _CharT, class _Traits, class _Allocator> |
| 625 | 630 | class _LIBCPP_TEMPLATE_VIS basic_istringstream |
| ... | ... | @@ -639,7 +644,7 @@ private: |
| 639 | 644 | basic_stringbuf<char_type, traits_type, allocator_type> __sb_; |
| 640 | 645 | |
| 641 | 646 | public: |
| 642 | // 30.8.3.1 [istringstream.cons], constructors | |
| 647 | // [istringstream.cons] Constructors: | |
| 643 | 648 | _LIBCPP_INLINE_VISIBILITY |
| 644 | 649 | basic_istringstream() |
| 645 | 650 | : basic_istream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in) {} |
| ... | ... | @@ -663,7 +668,7 @@ public: |
| 663 | 668 | basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); |
| 664 | 669 | } |
| 665 | 670 | |
| 666 | // 27.8.2.2 Assign and swap: | |
| 671 | // [istringstream.assign] Assign and swap: | |
| 667 | 672 | basic_istringstream& operator=(basic_istringstream&& __rhs) { |
| 668 | 673 | basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); |
| 669 | 674 | __sb_ = _VSTD::move(__rhs.__sb_); |
| ... | ... | @@ -675,7 +680,7 @@ public: |
| 675 | 680 | __sb_.swap(__rhs.__sb_); |
| 676 | 681 | } |
| 677 | 682 | |
| 678 | // 27.8.2.3 Members: | |
| 683 | // [istringstream.members] Member functions: | |
| 679 | 684 | _LIBCPP_INLINE_VISIBILITY |
| 680 | 685 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const { |
| 681 | 686 | return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); |
| ... | ... | @@ -699,7 +704,7 @@ swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, |
| 699 | 704 | __x.swap(__y); |
| 700 | 705 | } |
| 701 | 706 | |
| 702 | // basic_ostringstream | |
| 707 | // Class template basic_ostringstream [ostringstream] | |
| 703 | 708 | |
| 704 | 709 | template <class _CharT, class _Traits, class _Allocator> |
| 705 | 710 | class _LIBCPP_TEMPLATE_VIS basic_ostringstream |
| ... | ... | @@ -719,7 +724,7 @@ private: |
| 719 | 724 | basic_stringbuf<char_type, traits_type, allocator_type> __sb_; |
| 720 | 725 | |
| 721 | 726 | public: |
| 722 | // 30.8.4.1 [ostringstream.cons], constructors | |
| 727 | // [ostringstream.cons] Constructors: | |
| 723 | 728 | _LIBCPP_INLINE_VISIBILITY |
| 724 | 729 | basic_ostringstream() |
| 725 | 730 | : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::out) {} |
| ... | ... | @@ -743,7 +748,7 @@ public: |
| 743 | 748 | basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_); |
| 744 | 749 | } |
| 745 | 750 | |
| 746 | // 27.8.2.2 Assign and swap: | |
| 751 | // [ostringstream.assign] Assign and swap: | |
| 747 | 752 | basic_ostringstream& operator=(basic_ostringstream&& __rhs) { |
| 748 | 753 | basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); |
| 749 | 754 | __sb_ = _VSTD::move(__rhs.__sb_); |
| ... | ... | @@ -756,7 +761,7 @@ public: |
| 756 | 761 | __sb_.swap(__rhs.__sb_); |
| 757 | 762 | } |
| 758 | 763 | |
| 759 | // 27.8.2.3 Members: | |
| 764 | // [ostringstream.members] Member functions: | |
| 760 | 765 | _LIBCPP_INLINE_VISIBILITY |
| 761 | 766 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const { |
| 762 | 767 | return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); |
| ... | ... | @@ -780,7 +785,7 @@ swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, |
| 780 | 785 | __x.swap(__y); |
| 781 | 786 | } |
| 782 | 787 | |
| 783 | // basic_stringstream | |
| 788 | // Class template basic_stringstream [stringstream] | |
| 784 | 789 | |
| 785 | 790 | template <class _CharT, class _Traits, class _Allocator> |
| 786 | 791 | class _LIBCPP_TEMPLATE_VIS basic_stringstream |
| ... | ... | @@ -800,7 +805,7 @@ private: |
| 800 | 805 | basic_stringbuf<char_type, traits_type, allocator_type> __sb_; |
| 801 | 806 | |
| 802 | 807 | public: |
| 803 | // 30.8.5.1 [stringstream.cons], constructors | |
| 808 | // [stringstream.cons] constructors | |
| 804 | 809 | _LIBCPP_INLINE_VISIBILITY |
| 805 | 810 | basic_stringstream() |
| 806 | 811 | : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in | ios_base::out) {} |
| ... | ... | @@ -824,7 +829,7 @@ public: |
| 824 | 829 | basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); |
| 825 | 830 | } |
| 826 | 831 | |
| 827 | // 27.8.2.2 Assign and swap: | |
| 832 | // [stringstream.assign] Assign and swap: | |
| 828 | 833 | basic_stringstream& operator=(basic_stringstream&& __rhs) { |
| 829 | 834 | basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); |
| 830 | 835 | __sb_ = _VSTD::move(__rhs.__sb_); |
| ... | ... | @@ -836,7 +841,7 @@ public: |
| 836 | 841 | __sb_.swap(__rhs.__sb_); |
| 837 | 842 | } |
| 838 | 843 | |
| 839 | // 27.8.2.3 Members: | |
| 844 | // [stringstream.members] Member functions: | |
| 840 | 845 | _LIBCPP_INLINE_VISIBILITY |
| 841 | 846 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const { |
| 842 | 847 | return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); |
| ... | ... | @@ -871,4 +876,8 @@ _LIBCPP_END_NAMESPACE_STD |
| 871 | 876 | |
| 872 | 877 | _LIBCPP_POP_MACROS |
| 873 | 878 | |
| 879 | #if _LIBCPP_STD_VER <= 20 && !defined(_LIPCPP_REMOVE_TRANSITIVE_INCLUDES) | |
| 880 | # include <type_traits> | |
| 881 | #endif | |
| 882 | ||
| 874 | 883 | #endif // _LIBCPP_SSTREAM |
lib/libcxx/include/stack+9-4| ... | ... | @@ -107,11 +107,9 @@ template <class T, class Container> |
| 107 | 107 | #include <type_traits> |
| 108 | 108 | #include <version> |
| 109 | 109 | |
| 110 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 111 | # include <functional> | |
| 112 | #endif | |
| 113 | ||
| 114 | 110 | // standard-mandated includes |
| 111 | ||
| 112 | // [stack.syn] | |
| 115 | 113 | #include <compare> |
| 116 | 114 | #include <initializer_list> |
| 117 | 115 | |
| ... | ... | @@ -257,6 +255,8 @@ public: |
| 257 | 255 | swap(c, __s.c); |
| 258 | 256 | } |
| 259 | 257 | |
| 258 | _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; } | |
| 259 | ||
| 260 | 260 | template <class T1, class _C1> |
| 261 | 261 | friend |
| 262 | 262 | bool |
| ... | ... | @@ -363,4 +363,9 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc> |
| 363 | 363 | |
| 364 | 364 | _LIBCPP_END_NAMESPACE_STD |
| 365 | 365 | |
| 366 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 367 | # include <concepts> | |
| 368 | # include <functional> | |
| 369 | #endif | |
| 370 | ||
| 366 | 371 | #endif // _LIBCPP_STACK |
lib/libcxx/include/stdbool.h+4-1| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | 7 | // |
| 8 | 8 | //===----------------------------------------------------------------------===// |
| 9 | ||
| 9 | 10 | #ifndef _LIBCPP_STDBOOL_H |
| 10 | 11 | #define _LIBCPP_STDBOOL_H |
| 11 | 12 | |
| ... | ... | @@ -24,7 +25,9 @@ Macros: |
| 24 | 25 | # pragma GCC system_header |
| 25 | 26 | #endif |
| 26 | 27 | |
| 27 | #include_next <stdbool.h> | |
| 28 | #if __has_include_next(<stdbool.h>) | |
| 29 | # include_next <stdbool.h> | |
| 30 | #endif | |
| 28 | 31 | |
| 29 | 32 | #ifdef __cplusplus |
| 30 | 33 | #undef bool |
lib/libcxx/include/stddef.h+3-1| ... | ... | @@ -42,7 +42,9 @@ Types: |
| 42 | 42 | # pragma GCC system_header |
| 43 | 43 | #endif |
| 44 | 44 | |
| 45 | #include_next <stddef.h> | |
| 45 | # if __has_include_next(<stddef.h>) | |
| 46 | # include_next <stddef.h> | |
| 47 | # endif | |
| 46 | 48 | |
| 47 | 49 | #ifdef __cplusplus |
| 48 | 50 | typedef decltype(nullptr) nullptr_t; |
lib/libcxx/include/stdexcept+11-11| ... | ... | @@ -87,9 +87,9 @@ public: |
| 87 | 87 | logic_error(const logic_error&) _NOEXCEPT; |
| 88 | 88 | logic_error& operator=(const logic_error&) _NOEXCEPT; |
| 89 | 89 | |
| 90 | virtual ~logic_error() _NOEXCEPT; | |
| 90 | ~logic_error() _NOEXCEPT override; | |
| 91 | 91 | |
| 92 | virtual const char* what() const _NOEXCEPT; | |
| 92 | const char* what() const _NOEXCEPT override; | |
| 93 | 93 | #else |
| 94 | 94 | public: |
| 95 | 95 | explicit logic_error(const _VSTD::string&); // Symbol uses versioned std::string |
| ... | ... | @@ -110,9 +110,9 @@ public: |
| 110 | 110 | runtime_error(const runtime_error&) _NOEXCEPT; |
| 111 | 111 | runtime_error& operator=(const runtime_error&) _NOEXCEPT; |
| 112 | 112 | |
| 113 | virtual ~runtime_error() _NOEXCEPT; | |
| 113 | ~runtime_error() _NOEXCEPT override; | |
| 114 | 114 | |
| 115 | virtual const char* what() const _NOEXCEPT; | |
| 115 | const char* what() const _NOEXCEPT override; | |
| 116 | 116 | #else |
| 117 | 117 | public: |
| 118 | 118 | explicit runtime_error(const _VSTD::string&); // Symbol uses versioned std::string |
| ... | ... | @@ -129,7 +129,7 @@ public: |
| 129 | 129 | |
| 130 | 130 | #ifndef _LIBCPP_ABI_VCRUNTIME |
| 131 | 131 | domain_error(const domain_error&) _NOEXCEPT = default; |
| 132 | virtual ~domain_error() _NOEXCEPT; | |
| 132 | ~domain_error() _NOEXCEPT override; | |
| 133 | 133 | #endif |
| 134 | 134 | }; |
| 135 | 135 | |
| ... | ... | @@ -142,7 +142,7 @@ public: |
| 142 | 142 | |
| 143 | 143 | #ifndef _LIBCPP_ABI_VCRUNTIME |
| 144 | 144 | invalid_argument(const invalid_argument&) _NOEXCEPT = default; |
| 145 | virtual ~invalid_argument() _NOEXCEPT; | |
| 145 | ~invalid_argument() _NOEXCEPT override; | |
| 146 | 146 | #endif |
| 147 | 147 | }; |
| 148 | 148 | |
| ... | ... | @@ -154,7 +154,7 @@ public: |
| 154 | 154 | _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {} |
| 155 | 155 | #ifndef _LIBCPP_ABI_VCRUNTIME |
| 156 | 156 | length_error(const length_error&) _NOEXCEPT = default; |
| 157 | virtual ~length_error() _NOEXCEPT; | |
| 157 | ~length_error() _NOEXCEPT override; | |
| 158 | 158 | #endif |
| 159 | 159 | }; |
| 160 | 160 | |
| ... | ... | @@ -167,7 +167,7 @@ public: |
| 167 | 167 | |
| 168 | 168 | #ifndef _LIBCPP_ABI_VCRUNTIME |
| 169 | 169 | out_of_range(const out_of_range&) _NOEXCEPT = default; |
| 170 | virtual ~out_of_range() _NOEXCEPT; | |
| 170 | ~out_of_range() _NOEXCEPT override; | |
| 171 | 171 | #endif |
| 172 | 172 | }; |
| 173 | 173 | |
| ... | ... | @@ -180,7 +180,7 @@ public: |
| 180 | 180 | |
| 181 | 181 | #ifndef _LIBCPP_ABI_VCRUNTIME |
| 182 | 182 | range_error(const range_error&) _NOEXCEPT = default; |
| 183 | virtual ~range_error() _NOEXCEPT; | |
| 183 | ~range_error() _NOEXCEPT override; | |
| 184 | 184 | #endif |
| 185 | 185 | }; |
| 186 | 186 | |
| ... | ... | @@ -193,7 +193,7 @@ public: |
| 193 | 193 | |
| 194 | 194 | #ifndef _LIBCPP_ABI_VCRUNTIME |
| 195 | 195 | overflow_error(const overflow_error&) _NOEXCEPT = default; |
| 196 | virtual ~overflow_error() _NOEXCEPT; | |
| 196 | ~overflow_error() _NOEXCEPT override; | |
| 197 | 197 | #endif |
| 198 | 198 | }; |
| 199 | 199 | |
| ... | ... | @@ -206,7 +206,7 @@ public: |
| 206 | 206 | |
| 207 | 207 | #ifndef _LIBCPP_ABI_VCRUNTIME |
| 208 | 208 | underflow_error(const underflow_error&) _NOEXCEPT = default; |
| 209 | virtual ~underflow_error() _NOEXCEPT; | |
| 209 | ~underflow_error() _NOEXCEPT override; | |
| 210 | 210 | #endif |
| 211 | 211 | }; |
| 212 | 212 |
lib/libcxx/include/stdint.h+3-1| ... | ... | @@ -120,6 +120,8 @@ Macros: |
| 120 | 120 | # define __STDC_CONSTANT_MACROS |
| 121 | 121 | #endif |
| 122 | 122 | |
| 123 | #include_next <stdint.h> | |
| 123 | #if __has_include_next(<stdint.h>) | |
| 124 | # include_next <stdint.h> | |
| 125 | #endif | |
| 124 | 126 | |
| 125 | 127 | #endif // _LIBCPP_STDINT_H |
lib/libcxx/include/stdio.h+3-1| ... | ... | @@ -104,7 +104,9 @@ void perror(const char* s); |
| 104 | 104 | # pragma GCC system_header |
| 105 | 105 | #endif |
| 106 | 106 | |
| 107 | #include_next <stdio.h> | |
| 107 | # if __has_include_next(<stdio.h>) | |
| 108 | # include_next <stdio.h> | |
| 109 | # endif | |
| 108 | 110 | |
| 109 | 111 | #ifdef __cplusplus |
| 110 | 112 |
lib/libcxx/include/stdlib.h+8-6| ... | ... | @@ -90,7 +90,9 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 |
| 90 | 90 | # pragma GCC system_header |
| 91 | 91 | #endif |
| 92 | 92 | |
| 93 | #include_next <stdlib.h> | |
| 93 | # if __has_include_next(<stdlib.h>) | |
| 94 | # include_next <stdlib.h> | |
| 95 | # endif | |
| 94 | 96 | |
| 95 | 97 | #ifdef __cplusplus |
| 96 | 98 | extern "C++" { |
| ... | ... | @@ -108,24 +110,24 @@ extern "C++" { |
| 108 | 110 | |
| 109 | 111 | // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined |
| 110 | 112 | #if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) |
| 111 | inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT { | |
| 113 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT { | |
| 112 | 114 | return __builtin_labs(__x); |
| 113 | 115 | } |
| 114 | inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT { | |
| 116 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT { | |
| 115 | 117 | return __builtin_llabs(__x); |
| 116 | 118 | } |
| 117 | 119 | #endif // !defined(_LIBCPP_MSVCRT) && !defined(__sun__) |
| 118 | 120 | |
| 119 | 121 | #if !defined(__sun__) |
| 120 | inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT { | |
| 122 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT { | |
| 121 | 123 | return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h |
| 122 | 124 | } |
| 123 | 125 | |
| 124 | inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT { | |
| 126 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT { | |
| 125 | 127 | return __builtin_fabs(__lcpp_x); |
| 126 | 128 | } |
| 127 | 129 | |
| 128 | inline _LIBCPP_INLINE_VISIBILITY long double | |
| 130 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long double | |
| 129 | 131 | abs(long double __lcpp_x) _NOEXCEPT { |
| 130 | 132 | return __builtin_fabsl(__lcpp_x); |
| 131 | 133 | } |
lib/libcxx/include/streambuf+4-2| ... | ... | @@ -489,10 +489,12 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type) |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>; |
| 492 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>; | |
| 493 | ||
| 494 | 492 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>; |
| 493 | ||
| 494 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 495 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>; | |
| 495 | 496 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>; |
| 497 | #endif | |
| 496 | 498 | |
| 497 | 499 | _LIBCPP_END_NAMESPACE_STD |
| 498 | 500 |
lib/libcxx/include/string+777-860| ... | ... | @@ -13,6 +13,9 @@ |
| 13 | 13 | /* |
| 14 | 14 | string synopsis |
| 15 | 15 | |
| 16 | #include <compare> | |
| 17 | #include <initializer_list> | |
| 18 | ||
| 16 | 19 | namespace std |
| 17 | 20 | { |
| 18 | 21 | |
| ... | ... | @@ -43,11 +46,13 @@ template <class stateT> bool operator!=(const fpos<stateT>& x, const fpos<stateT |
| 43 | 46 | template <class charT> |
| 44 | 47 | struct char_traits |
| 45 | 48 | { |
| 46 | typedef charT char_type; | |
| 47 | typedef ... int_type; | |
| 48 | typedef streamoff off_type; | |
| 49 | typedef streampos pos_type; | |
| 50 | typedef mbstate_t state_type; | |
| 49 | using char_type = charT; | |
| 50 | using int_type = ...; | |
| 51 | using off_type = streamoff; | |
| 52 | using pos_type = streampos; | |
| 53 | using state_type = mbstate_t; | |
| 54 | using comparison_category = strong_ordering; // Since C++20 only for the specializations | |
| 55 | // char, wchar_t, char8_t, char16_t, and char32_t. | |
| 51 | 56 | |
| 52 | 57 | static void assign(char_type& c1, const char_type& c2) noexcept; |
| 53 | 58 | static constexpr bool eq(char_type c1, char_type c2) noexcept; |
| ... | ... | @@ -104,6 +109,10 @@ public: |
| 104 | 109 | const allocator_type& a = allocator_type()); // constexpr since C++20 |
| 105 | 110 | basic_string(const basic_string& str, size_type pos, size_type n, |
| 106 | 111 | const Allocator& a = Allocator()); // constexpr since C++20 |
| 112 | constexpr basic_string( | |
| 113 | basic_string&& str, size_type pos, const Allocator& a = Allocator()); // since C++23 | |
| 114 | constexpr basic_string( | |
| 115 | basic_string&& str, size_type pos, size_type n, const Allocator& a = Allocator()); // since C++23 | |
| 107 | 116 | template<class T> |
| 108 | 117 | basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); // C++17, constexpr since C++20 |
| 109 | 118 | template <class T> |
| ... | ... | @@ -256,8 +265,9 @@ public: |
| 256 | 265 | basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>); // constexpr since C++20 |
| 257 | 266 | |
| 258 | 267 | size_type copy(value_type* s, size_type n, size_type pos = 0) const; // constexpr since C++20 |
| 259 | basic_string substr(size_type pos = 0, size_type n = npos) const; // constexpr since C++20 | |
| 260 | ||
| 268 | basic_string substr(size_type pos = 0, size_type n = npos) const; // constexpr in C++20, removed in C++23 | |
| 269 | basic_string substr(size_type pos = 0, size_type n = npos) const&; // since C++23 | |
| 270 | constexpr basic_string substr(size_type pos = 0, size_type n = npos) &&; // since C++23 | |
| 261 | 271 | void swap(basic_string& str) |
| 262 | 272 | noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value || |
| 263 | 273 | allocator_traits<allocator_type>::is_always_equal::value); // C++17, constexpr since C++20 |
| ... | ... | @@ -370,60 +380,68 @@ bool operator==(const basic_string<charT, traits, Allocator>& lhs, |
| 370 | 380 | const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 |
| 371 | 381 | |
| 372 | 382 | template<class charT, class traits, class Allocator> |
| 373 | bool operator==(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 | |
| 383 | bool operator==(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // removed in C++20 | |
| 374 | 384 | |
| 375 | 385 | template<class charT, class traits, class Allocator> |
| 376 | 386 | bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20 |
| 377 | 387 | |
| 378 | 388 | template<class charT, class traits, class Allocator> |
| 379 | 389 | bool operator!=(const basic_string<charT,traits,Allocator>& lhs, |
| 380 | const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 | |
| 390 | const basic_string<charT, traits, Allocator>& rhs) noexcept; // removed in C++20 | |
| 381 | 391 | |
| 382 | 392 | template<class charT, class traits, class Allocator> |
| 383 | bool operator!=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 | |
| 393 | bool operator!=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // removed in C++20 | |
| 384 | 394 | |
| 385 | 395 | template<class charT, class traits, class Allocator> |
| 386 | bool operator!=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20 | |
| 396 | bool operator!=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // removed in C++20 | |
| 387 | 397 | |
| 388 | 398 | template<class charT, class traits, class Allocator> |
| 389 | 399 | bool operator< (const basic_string<charT, traits, Allocator>& lhs, |
| 390 | const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 | |
| 400 | const basic_string<charT, traits, Allocator>& rhs) noexcept; // removed in C++20 | |
| 391 | 401 | |
| 392 | 402 | template<class charT, class traits, class Allocator> |
| 393 | bool operator< (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20 | |
| 403 | bool operator< (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // removed in C++20 | |
| 394 | 404 | |
| 395 | 405 | template<class charT, class traits, class Allocator> |
| 396 | bool operator< (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 | |
| 406 | bool operator< (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // removed in C++20 | |
| 397 | 407 | |
| 398 | 408 | template<class charT, class traits, class Allocator> |
| 399 | 409 | bool operator> (const basic_string<charT, traits, Allocator>& lhs, |
| 400 | const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 | |
| 410 | const basic_string<charT, traits, Allocator>& rhs) noexcept; // removed in C++20 | |
| 401 | 411 | |
| 402 | 412 | template<class charT, class traits, class Allocator> |
| 403 | bool operator> (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20 | |
| 413 | bool operator> (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // removed in C++20 | |
| 404 | 414 | |
| 405 | 415 | template<class charT, class traits, class Allocator> |
| 406 | bool operator> (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 | |
| 416 | bool operator> (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // removed in C++20 | |
| 407 | 417 | |
| 408 | 418 | template<class charT, class traits, class Allocator> |
| 409 | 419 | bool operator<=(const basic_string<charT, traits, Allocator>& lhs, |
| 410 | const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 | |
| 420 | const basic_string<charT, traits, Allocator>& rhs) noexcept; // removed in C++20 | |
| 411 | 421 | |
| 412 | 422 | template<class charT, class traits, class Allocator> |
| 413 | bool operator<=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20 | |
| 423 | bool operator<=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // removed in C++20 | |
| 414 | 424 | |
| 415 | 425 | template<class charT, class traits, class Allocator> |
| 416 | bool operator<=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 | |
| 426 | bool operator<=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // removed in C++20 | |
| 417 | 427 | |
| 418 | 428 | template<class charT, class traits, class Allocator> |
| 419 | 429 | bool operator>=(const basic_string<charT, traits, Allocator>& lhs, |
| 420 | const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 | |
| 430 | const basic_string<charT, traits, Allocator>& rhs) noexcept; // removed in C++20 | |
| 421 | 431 | |
| 422 | 432 | template<class charT, class traits, class Allocator> |
| 423 | bool operator>=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20 | |
| 433 | bool operator>=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // removed in C++20 | |
| 424 | 434 | |
| 425 | 435 | template<class charT, class traits, class Allocator> |
| 426 | bool operator>=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 | |
| 436 | bool operator>=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // removed in C++20 | |
| 437 | ||
| 438 | template<class charT, class traits, class Allocator> // since C++20 | |
| 439 | constexpr see below operator<=>(const basic_string<charT, traits, Allocator>& lhs, | |
| 440 | const basic_string<charT, traits, Allocator>& rhs) noexcept; | |
| 441 | ||
| 442 | template<class charT, class traits, class Allocator> // since C++20 | |
| 443 | constexpr see below operator<=>(const basic_string<charT, traits, Allocator>& lhs, | |
| 444 | const charT* rhs) noexcept; | |
| 427 | 445 | |
| 428 | 446 | template<class charT, class traits, class Allocator> |
| 429 | 447 | void swap(basic_string<charT, traits, Allocator>& lhs, |
| ... | ... | @@ -526,15 +544,24 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); |
| 526 | 544 | #include <__format/enable_insertable.h> |
| 527 | 545 | #include <__functional/hash.h> |
| 528 | 546 | #include <__functional/unary_function.h> |
| 547 | #include <__fwd/string.h> | |
| 529 | 548 | #include <__ios/fpos.h> |
| 530 | 549 | #include <__iterator/distance.h> |
| 531 | 550 | #include <__iterator/iterator_traits.h> |
| 532 | 551 | #include <__iterator/reverse_iterator.h> |
| 533 | 552 | #include <__iterator/wrap_iter.h> |
| 534 | 553 | #include <__memory/allocate_at_least.h> |
| 554 | #include <__memory/allocator.h> | |
| 555 | #include <__memory/allocator_traits.h> | |
| 556 | #include <__memory/compressed_pair.h> | |
| 557 | #include <__memory/construct_at.h> | |
| 558 | #include <__memory/pointer_traits.h> | |
| 535 | 559 | #include <__memory/swap_allocator.h> |
| 560 | #include <__memory_resource/polymorphic_allocator.h> | |
| 536 | 561 | #include <__string/char_traits.h> |
| 537 | 562 | #include <__string/extern_template_lists.h> |
| 563 | #include <__type_traits/is_allocator.h> | |
| 564 | #include <__type_traits/noexcept_move_assign_container.h> | |
| 538 | 565 | #include <__utility/auto_cast.h> |
| 539 | 566 | #include <__utility/move.h> |
| 540 | 567 | #include <__utility/swap.h> |
| ... | ... | @@ -544,9 +571,7 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); |
| 544 | 571 | #include <cstdio> // EOF |
| 545 | 572 | #include <cstdlib> |
| 546 | 573 | #include <cstring> |
| 547 | #include <iosfwd> | |
| 548 | 574 | #include <limits> |
| 549 | #include <memory> | |
| 550 | 575 | #include <stdexcept> |
| 551 | 576 | #include <string_view> |
| 552 | 577 | #include <type_traits> |
| ... | ... | @@ -556,16 +581,6 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); |
| 556 | 581 | # include <cwchar> |
| 557 | 582 | #endif |
| 558 | 583 | |
| 559 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 560 | # include <algorithm> | |
| 561 | # include <functional> | |
| 562 | # include <iterator> | |
| 563 | # include <new> | |
| 564 | # include <typeinfo> | |
| 565 | # include <utility> | |
| 566 | # include <vector> | |
| 567 | #endif | |
| 568 | ||
| 569 | 584 | // standard-mandated includes |
| 570 | 585 | |
| 571 | 586 | // [iterator.range] |
| ... | ... | @@ -593,27 +608,27 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 593 | 608 | |
| 594 | 609 | template<class _CharT, class _Traits, class _Allocator> |
| 595 | 610 | basic_string<_CharT, _Traits, _Allocator> |
| 596 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 611 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 597 | 612 | operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, |
| 598 | 613 | const basic_string<_CharT, _Traits, _Allocator>& __y); |
| 599 | 614 | |
| 600 | 615 | template<class _CharT, class _Traits, class _Allocator> |
| 601 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 616 | _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 602 | 617 | basic_string<_CharT, _Traits, _Allocator> |
| 603 | 618 | operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y); |
| 604 | 619 | |
| 605 | 620 | template<class _CharT, class _Traits, class _Allocator> |
| 606 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 621 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 607 | 622 | basic_string<_CharT, _Traits, _Allocator> |
| 608 | 623 | operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y); |
| 609 | 624 | |
| 610 | 625 | template<class _CharT, class _Traits, class _Allocator> |
| 611 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 626 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 612 | 627 | basic_string<_CharT, _Traits, _Allocator> |
| 613 | 628 | operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const _CharT* __y); |
| 614 | 629 | |
| 615 | 630 | template<class _CharT, class _Traits, class _Allocator> |
| 616 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 631 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 617 | 632 | basic_string<_CharT, _Traits, _Allocator> |
| 618 | 633 | operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y); |
| 619 | 634 | |
| ... | ... | @@ -636,23 +651,10 @@ struct __can_be_converted_to_string_view : public _BoolConstant< |
| 636 | 651 | !is_convertible<const _Tp&, const _CharT*>::value |
| 637 | 652 | > {}; |
| 638 | 653 | |
| 639 | #ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 640 | typedef basic_string<char8_t> u8string; | |
| 641 | #endif | |
| 642 | typedef basic_string<char16_t> u16string; | |
| 643 | typedef basic_string<char32_t> u32string; | |
| 644 | ||
| 645 | 654 | struct __uninitialized_size_tag {}; |
| 646 | 655 | |
| 647 | 656 | template<class _CharT, class _Traits, class _Allocator> |
| 648 | class | |
| 649 | _LIBCPP_TEMPLATE_VIS | |
| 650 | #ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 651 | _LIBCPP_PREFERRED_NAME(u8string) | |
| 652 | #endif | |
| 653 | _LIBCPP_PREFERRED_NAME(u16string) | |
| 654 | _LIBCPP_PREFERRED_NAME(u32string) | |
| 655 | basic_string | |
| 657 | class basic_string | |
| 656 | 658 | { |
| 657 | 659 | public: |
| 658 | 660 | typedef basic_string __self; |
| ... | ... | @@ -676,6 +678,11 @@ public: |
| 676 | 678 | static_assert(( is_same<typename allocator_type::value_type, value_type>::value), |
| 677 | 679 | "Allocator::value_type must be same type as value_type"); |
| 678 | 680 | |
| 681 | static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, | |
| 682 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 683 | "original allocator"); | |
| 684 | ||
| 685 | // TODO: Implement iterator bounds checking without requiring the global database. | |
| 679 | 686 | typedef __wrap_iter<pointer> iterator; |
| 680 | 687 | typedef __wrap_iter<const_pointer> const_iterator; |
| 681 | 688 | typedef std::reverse_iterator<iterator> reverse_iterator; |
| ... | ... | @@ -787,13 +794,13 @@ private: |
| 787 | 794 | // Construct a string with the given allocator and enough storage to hold `__size` characters, but |
| 788 | 795 | // don't initialize the characters. The contents of the string, including the null terminator, must be |
| 789 | 796 | // initialized separately. |
| 790 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 797 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 791 | 798 | explicit basic_string(__uninitialized_size_tag, size_type __size, const allocator_type& __a) |
| 792 | 799 | : __r_(__default_init_tag(), __a) { |
| 793 | 800 | if (__size > max_size()) |
| 794 | 801 | __throw_length_error(); |
| 795 | 802 | if (__fits_in_sso(__size)) { |
| 796 | __zero(); | |
| 803 | __r_.first() = __rep(); | |
| 797 | 804 | __set_short_size(__size); |
| 798 | 805 | } else { |
| 799 | 806 | auto __capacity = __recommend(__size) + 1; |
| ... | ... | @@ -806,176 +813,289 @@ private: |
| 806 | 813 | std::__debug_db_insert_c(this); |
| 807 | 814 | } |
| 808 | 815 | |
| 816 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iterator(pointer __p) { | |
| 817 | return iterator(this, __p); | |
| 818 | } | |
| 819 | ||
| 820 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_const_iterator(const_pointer __p) const { | |
| 821 | return const_iterator(this, __p); | |
| 822 | } | |
| 823 | ||
| 809 | 824 | public: |
| 810 | _LIBCPP_TEMPLATE_DATA_VIS | |
| 811 | static const size_type npos = -1; | |
| 825 | _LIBCPP_TEMPLATE_DATA_VIS static const size_type npos = -1; | |
| 812 | 826 | |
| 813 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string() | |
| 814 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value); | |
| 827 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string() | |
| 828 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) | |
| 829 | : __r_(__default_init_tag(), __default_init_tag()) { | |
| 830 | std::__debug_db_insert_c(this); | |
| 831 | __default_init(); | |
| 832 | } | |
| 815 | 833 | |
| 816 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit basic_string(const allocator_type& __a) | |
| 834 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const allocator_type& __a) | |
| 817 | 835 | #if _LIBCPP_STD_VER <= 14 |
| 818 | _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value); | |
| 836 | _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value) | |
| 819 | 837 | #else |
| 820 | _NOEXCEPT; | |
| 838 | _NOEXCEPT | |
| 821 | 839 | #endif |
| 840 | : __r_(__default_init_tag(), __a) { | |
| 841 | std::__debug_db_insert_c(this); | |
| 842 | __default_init(); | |
| 843 | } | |
| 822 | 844 | |
| 823 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(const basic_string& __str); | |
| 824 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(const basic_string& __str, const allocator_type& __a); | |
| 845 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str); | |
| 846 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str, const allocator_type& __a); | |
| 825 | 847 | |
| 826 | 848 | #ifndef _LIBCPP_CXX03_LANG |
| 827 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 828 | basic_string(basic_string&& __str) | |
| 829 | #if _LIBCPP_STD_VER <= 14 | |
| 830 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); | |
| 831 | #else | |
| 832 | _NOEXCEPT; | |
| 833 | #endif | |
| 849 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(basic_string&& __str) | |
| 850 | # if _LIBCPP_STD_VER <= 14 | |
| 851 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) | |
| 852 | # else | |
| 853 | _NOEXCEPT | |
| 854 | # endif | |
| 855 | : __r_(std::move(__str.__r_)) { | |
| 856 | __str.__default_init(); | |
| 857 | std::__debug_db_insert_c(this); | |
| 858 | if (__is_long()) | |
| 859 | std::__debug_db_swap(this, &__str); | |
| 860 | } | |
| 834 | 861 | |
| 835 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 836 | basic_string(basic_string&& __str, const allocator_type& __a); | |
| 862 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(basic_string&& __str, const allocator_type& __a) | |
| 863 | : __r_(__default_init_tag(), __a) { | |
| 864 | if (__str.__is_long() && __a != __str.__alloc()) // copy, not move | |
| 865 | __init(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); | |
| 866 | else { | |
| 867 | if (__libcpp_is_constant_evaluated()) | |
| 868 | __r_.first() = __rep(); | |
| 869 | __r_.first() = __str.__r_.first(); | |
| 870 | __str.__default_init(); | |
| 871 | } | |
| 872 | std::__debug_db_insert_c(this); | |
| 873 | if (__is_long()) | |
| 874 | std::__debug_db_swap(this, &__str); | |
| 875 | } | |
| 837 | 876 | #endif // _LIBCPP_CXX03_LANG |
| 838 | 877 | |
| 839 | template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > | |
| 840 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 841 | basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) { | |
| 842 | _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); | |
| 843 | __init(__s, traits_type::length(__s)); | |
| 844 | std::__debug_db_insert_c(this); | |
| 845 | } | |
| 878 | template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > | |
| 879 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s) | |
| 880 | : __r_(__default_init_tag(), __default_init_tag()) { | |
| 881 | _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); | |
| 882 | __init(__s, traits_type::length(__s)); | |
| 883 | std::__debug_db_insert_c(this); | |
| 884 | } | |
| 846 | 885 | |
| 847 | template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > | |
| 848 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 849 | basic_string(const _CharT* __s, const _Allocator& __a); | |
| 886 | template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > | |
| 887 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, const _Allocator& __a); | |
| 850 | 888 | |
| 851 | 889 | #if _LIBCPP_STD_VER > 20 |
| 852 | basic_string(nullptr_t) = delete; | |
| 890 | basic_string(nullptr_t) = delete; | |
| 853 | 891 | #endif |
| 854 | 892 | |
| 855 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 856 | basic_string(const _CharT* __s, size_type __n); | |
| 857 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 858 | basic_string(const _CharT* __s, size_type __n, const _Allocator& __a); | |
| 859 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 860 | basic_string(size_type __n, _CharT __c); | |
| 861 | ||
| 862 | template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > | |
| 863 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 864 | basic_string(size_type __n, _CharT __c, const _Allocator& __a); | |
| 865 | ||
| 866 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 867 | basic_string(const basic_string& __str, size_type __pos, size_type __n, | |
| 868 | const _Allocator& __a = _Allocator()); | |
| 869 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 870 | basic_string(const basic_string& __str, size_type __pos, | |
| 871 | const _Allocator& __a = _Allocator()); | |
| 872 | ||
| 873 | template<class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> > | |
| 874 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 875 | basic_string(const _Tp& __t, size_type __pos, size_type __n, | |
| 876 | const allocator_type& __a = allocator_type()); | |
| 877 | ||
| 878 | template<class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && | |
| 879 | !__is_same_uncvref<_Tp, basic_string>::value> > | |
| 880 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 881 | explicit basic_string(const _Tp& __t); | |
| 882 | ||
| 883 | template<class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> > | |
| 884 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 885 | explicit basic_string(const _Tp& __t, const allocator_type& __a); | |
| 886 | ||
| 887 | template<class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> > | |
| 888 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 889 | basic_string(_InputIterator __first, _InputIterator __last); | |
| 890 | template<class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> > | |
| 891 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 892 | basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a); | |
| 893 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n) | |
| 894 | : __r_(__default_init_tag(), __default_init_tag()) { | |
| 895 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); | |
| 896 | __init(__s, __n); | |
| 897 | std::__debug_db_insert_c(this); | |
| 898 | } | |
| 899 | ||
| 900 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 901 | basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) | |
| 902 | : __r_(__default_init_tag(), __a) { | |
| 903 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); | |
| 904 | __init(__s, __n); | |
| 905 | std::__debug_db_insert_c(this); | |
| 906 | } | |
| 907 | ||
| 908 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c) | |
| 909 | : __r_(__default_init_tag(), __default_init_tag()) { | |
| 910 | __init(__n, __c); | |
| 911 | std::__debug_db_insert_c(this); | |
| 912 | } | |
| 913 | ||
| 914 | #if _LIBCPP_STD_VER > 20 | |
| 915 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 916 | basic_string(basic_string&& __str, size_type __pos, const _Allocator& __alloc = _Allocator()) | |
| 917 | : basic_string(std::move(__str), __pos, npos, __alloc) {} | |
| 918 | ||
| 919 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 920 | basic_string(basic_string&& __str, size_type __pos, size_type __n, const _Allocator& __alloc = _Allocator()) | |
| 921 | : __r_(__default_init_tag(), __alloc) { | |
| 922 | if (__pos > __str.size()) | |
| 923 | __throw_out_of_range(); | |
| 924 | ||
| 925 | auto __len = std::min<size_type>(__n, __str.size() - __pos); | |
| 926 | if (__alloc_traits::is_always_equal::value || __alloc == __str.__alloc()) { | |
| 927 | __r_.first() = __str.__r_.first(); | |
| 928 | __str.__default_init(); | |
| 929 | ||
| 930 | _Traits::move(data(), data() + __pos, __len); | |
| 931 | __set_size(__len); | |
| 932 | _Traits::assign(data()[__len], value_type()); | |
| 933 | } else { | |
| 934 | // Perform a copy because the allocators are not compatible. | |
| 935 | __init(__str.data() + __pos, __len); | |
| 936 | } | |
| 937 | ||
| 938 | std::__debug_db_insert_c(this); | |
| 939 | if (__is_long()) | |
| 940 | std::__debug_db_swap(this, &__str); | |
| 941 | } | |
| 942 | #endif | |
| 943 | ||
| 944 | template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > | |
| 945 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a); | |
| 946 | ||
| 947 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 948 | basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Allocator& __a = _Allocator()); | |
| 949 | ||
| 950 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 951 | basic_string(const basic_string& __str, size_type __pos, const _Allocator& __a = _Allocator()) | |
| 952 | : __r_(__default_init_tag(), __a) { | |
| 953 | size_type __str_sz = __str.size(); | |
| 954 | if (__pos > __str_sz) | |
| 955 | __throw_out_of_range(); | |
| 956 | __init(__str.data() + __pos, __str_sz - __pos); | |
| 957 | std::__debug_db_insert_c(this); | |
| 958 | } | |
| 959 | ||
| 960 | template <class _Tp, | |
| 961 | class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && | |
| 962 | !__is_same_uncvref<_Tp, basic_string>::value> > | |
| 963 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 964 | basic_string(const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a = allocator_type()); | |
| 965 | ||
| 966 | template <class _Tp, | |
| 967 | class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && | |
| 968 | !__is_same_uncvref<_Tp, basic_string>::value> > | |
| 969 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string( | |
| 970 | const _Tp& __t); | |
| 971 | ||
| 972 | template <class _Tp, | |
| 973 | class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && | |
| 974 | !__is_same_uncvref<_Tp, basic_string>::value> > | |
| 975 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string( | |
| 976 | const _Tp& __t, const allocator_type& __a); | |
| 977 | ||
| 978 | template <class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> > | |
| 979 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(_InputIterator __first, _InputIterator __last) | |
| 980 | : __r_(__default_init_tag(), __default_init_tag()) { | |
| 981 | __init(__first, __last); | |
| 982 | std::__debug_db_insert_c(this); | |
| 983 | } | |
| 984 | ||
| 985 | template <class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> > | |
| 986 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 987 | basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a) | |
| 988 | : __r_(__default_init_tag(), __a) { | |
| 989 | __init(__first, __last); | |
| 990 | std::__debug_db_insert_c(this); | |
| 991 | } | |
| 992 | ||
| 893 | 993 | #ifndef _LIBCPP_CXX03_LANG |
| 894 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 895 | basic_string(initializer_list<_CharT> __il); | |
| 896 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 897 | basic_string(initializer_list<_CharT> __il, const _Allocator& __a); | |
| 994 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il) | |
| 995 | : __r_(__default_init_tag(), __default_init_tag()) { | |
| 996 | __init(__il.begin(), __il.end()); | |
| 997 | std::__debug_db_insert_c(this); | |
| 998 | } | |
| 999 | ||
| 1000 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il, const _Allocator& __a) | |
| 1001 | : __r_(__default_init_tag(), __a) { | |
| 1002 | __init(__il.begin(), __il.end()); | |
| 1003 | std::__debug_db_insert_c(this); | |
| 1004 | } | |
| 898 | 1005 | #endif // _LIBCPP_CXX03_LANG |
| 899 | 1006 | |
| 900 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 ~basic_string(); | |
| 1007 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string(); | |
| 901 | 1008 | |
| 902 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1009 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 903 | 1010 | operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } |
| 904 | 1011 | |
| 905 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(const basic_string& __str); | |
| 1012 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const basic_string& __str); | |
| 906 | 1013 | |
| 907 | 1014 | template <class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && |
| 908 | 1015 | !__is_same_uncvref<_Tp, basic_string>::value> > |
| 909 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(const _Tp& __t) { | |
| 1016 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const _Tp& __t) { | |
| 910 | 1017 | __self_view __sv = __t; |
| 911 | 1018 | return assign(__sv); |
| 912 | 1019 | } |
| 913 | 1020 | |
| 914 | 1021 | #ifndef _LIBCPP_CXX03_LANG |
| 915 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 916 | basic_string& operator=(basic_string&& __str) | |
| 917 | _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); | |
| 918 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1022 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(basic_string&& __str) | |
| 1023 | _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) { | |
| 1024 | __move_assign(__str, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); | |
| 1025 | return *this; | |
| 1026 | } | |
| 1027 | ||
| 1028 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 919 | 1029 | basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());} |
| 920 | 1030 | #endif |
| 921 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1031 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 922 | 1032 | basic_string& operator=(const value_type* __s) {return assign(__s);} |
| 923 | 1033 | #if _LIBCPP_STD_VER > 20 |
| 924 | 1034 | basic_string& operator=(nullptr_t) = delete; |
| 925 | 1035 | #endif |
| 926 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(value_type __c); | |
| 1036 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c); | |
| 927 | 1037 | |
| 928 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1038 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 929 | 1039 | iterator begin() _NOEXCEPT |
| 930 | {return iterator(this, __get_pointer());} | |
| 931 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1040 | {return __make_iterator(__get_pointer());} | |
| 1041 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 932 | 1042 | const_iterator begin() const _NOEXCEPT |
| 933 | {return const_iterator(this, __get_pointer());} | |
| 934 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1043 | {return __make_const_iterator(__get_pointer());} | |
| 1044 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 935 | 1045 | iterator end() _NOEXCEPT |
| 936 | {return iterator(this, __get_pointer() + size());} | |
| 937 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1046 | {return __make_iterator(__get_pointer() + size());} | |
| 1047 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 938 | 1048 | const_iterator end() const _NOEXCEPT |
| 939 | {return const_iterator(this, __get_pointer() + size());} | |
| 1049 | {return __make_const_iterator(__get_pointer() + size());} | |
| 940 | 1050 | |
| 941 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1051 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 942 | 1052 | reverse_iterator rbegin() _NOEXCEPT |
| 943 | 1053 | {return reverse_iterator(end());} |
| 944 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1054 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 945 | 1055 | const_reverse_iterator rbegin() const _NOEXCEPT |
| 946 | 1056 | {return const_reverse_iterator(end());} |
| 947 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1057 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 948 | 1058 | reverse_iterator rend() _NOEXCEPT |
| 949 | 1059 | {return reverse_iterator(begin());} |
| 950 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1060 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 951 | 1061 | const_reverse_iterator rend() const _NOEXCEPT |
| 952 | 1062 | {return const_reverse_iterator(begin());} |
| 953 | 1063 | |
| 954 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1064 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 955 | 1065 | const_iterator cbegin() const _NOEXCEPT |
| 956 | 1066 | {return begin();} |
| 957 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1067 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 958 | 1068 | const_iterator cend() const _NOEXCEPT |
| 959 | 1069 | {return end();} |
| 960 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1070 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 961 | 1071 | const_reverse_iterator crbegin() const _NOEXCEPT |
| 962 | 1072 | {return rbegin();} |
| 963 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1073 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 964 | 1074 | const_reverse_iterator crend() const _NOEXCEPT |
| 965 | 1075 | {return rend();} |
| 966 | 1076 | |
| 967 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type size() const _NOEXCEPT | |
| 1077 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT | |
| 968 | 1078 | {return __is_long() ? __get_long_size() : __get_short_size();} |
| 969 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type length() const _NOEXCEPT {return size();} | |
| 970 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type max_size() const _NOEXCEPT; | |
| 971 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type capacity() const _NOEXCEPT { | |
| 1079 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type length() const _NOEXCEPT {return size();} | |
| 1080 | ||
| 1081 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT { | |
| 1082 | size_type __m = __alloc_traits::max_size(__alloc()); | |
| 1083 | if (__m <= std::numeric_limits<size_type>::max() / 2) { | |
| 1084 | return __m - __alignment; | |
| 1085 | } else { | |
| 1086 | bool __uses_lsb = __endian_factor == 2; | |
| 1087 | return __uses_lsb ? __m - __alignment : (__m / 2) - __alignment; | |
| 1088 | } | |
| 1089 | } | |
| 1090 | ||
| 1091 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT { | |
| 972 | 1092 | return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1; |
| 973 | 1093 | } |
| 974 | 1094 | |
| 975 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void resize(size_type __n, value_type __c); | |
| 976 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void resize(size_type __n) { resize(__n, value_type()); } | |
| 1095 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n, value_type __c); | |
| 1096 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n) { resize(__n, value_type()); } | |
| 977 | 1097 | |
| 978 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void reserve(size_type __requested_capacity); | |
| 1098 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __requested_capacity); | |
| 979 | 1099 | |
| 980 | 1100 | #if _LIBCPP_STD_VER > 20 |
| 981 | 1101 | template <class _Op> |
| ... | ... | @@ -986,28 +1106,34 @@ public: |
| 986 | 1106 | } |
| 987 | 1107 | #endif |
| 988 | 1108 | |
| 989 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __resize_default_init(size_type __n); | |
| 1109 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __resize_default_init(size_type __n); | |
| 990 | 1110 | |
| 991 | 1111 | _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve() _NOEXCEPT { shrink_to_fit(); } |
| 992 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void shrink_to_fit() _NOEXCEPT; | |
| 993 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void clear() _NOEXCEPT; | |
| 1112 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT; | |
| 1113 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void clear() _NOEXCEPT; | |
| 994 | 1114 | |
| 995 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1115 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 996 | 1116 | bool empty() const _NOEXCEPT {return size() == 0;} |
| 997 | 1117 | |
| 998 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 999 | const_reference operator[](size_type __pos) const _NOEXCEPT; | |
| 1000 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 reference operator[](size_type __pos) _NOEXCEPT; | |
| 1118 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __pos) const _NOEXCEPT { | |
| 1119 | _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds"); | |
| 1120 | return *(data() + __pos); | |
| 1121 | } | |
| 1122 | ||
| 1123 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](size_type __pos) _NOEXCEPT { | |
| 1124 | _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds"); | |
| 1125 | return *(__get_pointer() + __pos); | |
| 1126 | } | |
| 1001 | 1127 | |
| 1002 | _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference at(size_type __n) const; | |
| 1003 | _LIBCPP_CONSTEXPR_AFTER_CXX17 reference at(size_type __n); | |
| 1128 | _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const; | |
| 1129 | _LIBCPP_CONSTEXPR_SINCE_CXX20 reference at(size_type __n); | |
| 1004 | 1130 | |
| 1005 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator+=(const basic_string& __str) { | |
| 1131 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const basic_string& __str) { | |
| 1006 | 1132 | return append(__str); |
| 1007 | 1133 | } |
| 1008 | 1134 | |
| 1009 | 1135 | template <class _Tp> |
| 1010 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1136 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1011 | 1137 | __enable_if_t |
| 1012 | 1138 | < |
| 1013 | 1139 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value |
| ... | ... | @@ -1018,35 +1144,36 @@ public: |
| 1018 | 1144 | __self_view __sv = __t; return append(__sv); |
| 1019 | 1145 | } |
| 1020 | 1146 | |
| 1021 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator+=(const value_type* __s) { | |
| 1147 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const value_type* __s) { | |
| 1022 | 1148 | return append(__s); |
| 1023 | 1149 | } |
| 1024 | 1150 | |
| 1025 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator+=(value_type __c) { | |
| 1151 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(value_type __c) { | |
| 1026 | 1152 | push_back(__c); |
| 1027 | 1153 | return *this; |
| 1028 | 1154 | } |
| 1029 | 1155 | |
| 1030 | 1156 | #ifndef _LIBCPP_CXX03_LANG |
| 1031 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1157 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1032 | 1158 | basic_string& operator+=(initializer_list<value_type> __il) { return append(__il); } |
| 1033 | 1159 | #endif // _LIBCPP_CXX03_LANG |
| 1034 | 1160 | |
| 1035 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1036 | basic_string& append(const basic_string& __str); | |
| 1161 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str) { | |
| 1162 | return append(__str.data(), __str.size()); | |
| 1163 | } | |
| 1037 | 1164 | |
| 1038 | 1165 | template <class _Tp> |
| 1039 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1166 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1040 | 1167 | __enable_if_t< |
| 1041 | 1168 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value |
| 1042 | 1169 | && !__is_same_uncvref<_Tp, basic_string>::value, |
| 1043 | 1170 | basic_string& |
| 1044 | 1171 | > |
| 1045 | 1172 | append(const _Tp& __t) { __self_view __sv = __t; return append(__sv.data(), __sv.size()); } |
| 1046 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos); | |
| 1173 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos); | |
| 1047 | 1174 | |
| 1048 | 1175 | template <class _Tp> |
| 1049 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1176 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1050 | 1177 | __enable_if_t |
| 1051 | 1178 | < |
| 1052 | 1179 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value |
| ... | ... | @@ -1054,11 +1181,11 @@ public: |
| 1054 | 1181 | basic_string& |
| 1055 | 1182 | > |
| 1056 | 1183 | append(const _Tp& __t, size_type __pos, size_type __n=npos); |
| 1057 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(const value_type* __s, size_type __n); | |
| 1058 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(const value_type* __s); | |
| 1059 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(size_type __n, value_type __c); | |
| 1184 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n); | |
| 1185 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s); | |
| 1186 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c); | |
| 1060 | 1187 | |
| 1061 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1188 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1062 | 1189 | void __append_default_init(size_type __n); |
| 1063 | 1190 | |
| 1064 | 1191 | template<class _InputIterator> |
| ... | ... | @@ -1068,7 +1195,7 @@ public: |
| 1068 | 1195 | __is_exactly_cpp17_input_iterator<_InputIterator>::value, |
| 1069 | 1196 | basic_string& |
| 1070 | 1197 | > |
| 1071 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1198 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1072 | 1199 | append(_InputIterator __first, _InputIterator __last) { |
| 1073 | 1200 | const basic_string __temp(__first, __last, __alloc()); |
| 1074 | 1201 | append(__temp.data(), __temp.size()); |
| ... | ... | @@ -1081,40 +1208,56 @@ public: |
| 1081 | 1208 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| 1082 | 1209 | basic_string& |
| 1083 | 1210 | > |
| 1084 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1211 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1085 | 1212 | append(_ForwardIterator __first, _ForwardIterator __last); |
| 1086 | 1213 | |
| 1087 | 1214 | #ifndef _LIBCPP_CXX03_LANG |
| 1088 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1215 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1089 | 1216 | basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());} |
| 1090 | 1217 | #endif // _LIBCPP_CXX03_LANG |
| 1091 | 1218 | |
| 1092 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void push_back(value_type __c); | |
| 1093 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void pop_back(); | |
| 1094 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 reference front() _NOEXCEPT; | |
| 1095 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference front() const _NOEXCEPT; | |
| 1096 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 reference back() _NOEXCEPT; | |
| 1097 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference back() const _NOEXCEPT; | |
| 1219 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(value_type __c); | |
| 1220 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back(); | |
| 1221 | ||
| 1222 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() _NOEXCEPT { | |
| 1223 | _LIBCPP_ASSERT(!empty(), "string::front(): string is empty"); | |
| 1224 | return *__get_pointer(); | |
| 1225 | } | |
| 1226 | ||
| 1227 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const _NOEXCEPT { | |
| 1228 | _LIBCPP_ASSERT(!empty(), "string::front(): string is empty"); | |
| 1229 | return *data(); | |
| 1230 | } | |
| 1231 | ||
| 1232 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() _NOEXCEPT { | |
| 1233 | _LIBCPP_ASSERT(!empty(), "string::back(): string is empty"); | |
| 1234 | return *(__get_pointer() + size() - 1); | |
| 1235 | } | |
| 1236 | ||
| 1237 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const _NOEXCEPT { | |
| 1238 | _LIBCPP_ASSERT(!empty(), "string::back(): string is empty"); | |
| 1239 | return *(data() + size() - 1); | |
| 1240 | } | |
| 1098 | 1241 | |
| 1099 | 1242 | template <class _Tp> |
| 1100 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1243 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1101 | 1244 | __enable_if_t |
| 1102 | 1245 | < |
| 1103 | 1246 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| 1104 | 1247 | basic_string& |
| 1105 | 1248 | > |
| 1106 | 1249 | assign(const _Tp & __t) { __self_view __sv = __t; return assign(__sv.data(), __sv.size()); } |
| 1107 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1250 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1108 | 1251 | basic_string& assign(const basic_string& __str) { return *this = __str; } |
| 1109 | 1252 | #ifndef _LIBCPP_CXX03_LANG |
| 1110 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1253 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1111 | 1254 | basic_string& assign(basic_string&& __str) |
| 1112 | 1255 | _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) |
| 1113 | 1256 | {*this = std::move(__str); return *this;} |
| 1114 | 1257 | #endif |
| 1115 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos); | |
| 1258 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos); | |
| 1116 | 1259 | template <class _Tp> |
| 1117 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1260 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1118 | 1261 | __enable_if_t |
| 1119 | 1262 | < |
| 1120 | 1263 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value |
| ... | ... | @@ -1122,11 +1265,11 @@ public: |
| 1122 | 1265 | basic_string& |
| 1123 | 1266 | > |
| 1124 | 1267 | assign(const _Tp & __t, size_type __pos, size_type __n=npos); |
| 1125 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(const value_type* __s, size_type __n); | |
| 1126 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(const value_type* __s); | |
| 1127 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(size_type __n, value_type __c); | |
| 1268 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n); | |
| 1269 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s); | |
| 1270 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c); | |
| 1128 | 1271 | template<class _InputIterator> |
| 1129 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1272 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1130 | 1273 | __enable_if_t |
| 1131 | 1274 | < |
| 1132 | 1275 | __is_exactly_cpp17_input_iterator<_InputIterator>::value, |
| ... | ... | @@ -1134,7 +1277,7 @@ public: |
| 1134 | 1277 | > |
| 1135 | 1278 | assign(_InputIterator __first, _InputIterator __last); |
| 1136 | 1279 | template<class _ForwardIterator> |
| 1137 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1280 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1138 | 1281 | __enable_if_t |
| 1139 | 1282 | < |
| 1140 | 1283 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| ... | ... | @@ -1142,15 +1285,17 @@ public: |
| 1142 | 1285 | > |
| 1143 | 1286 | assign(_ForwardIterator __first, _ForwardIterator __last); |
| 1144 | 1287 | #ifndef _LIBCPP_CXX03_LANG |
| 1145 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1288 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1146 | 1289 | basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());} |
| 1147 | 1290 | #endif // _LIBCPP_CXX03_LANG |
| 1148 | 1291 | |
| 1149 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1150 | basic_string& insert(size_type __pos1, const basic_string& __str); | |
| 1292 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& | |
| 1293 | insert(size_type __pos1, const basic_string& __str) { | |
| 1294 | return insert(__pos1, __str.data(), __str.size()); | |
| 1295 | } | |
| 1151 | 1296 | |
| 1152 | 1297 | template <class _Tp> |
| 1153 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1298 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1154 | 1299 | __enable_if_t |
| 1155 | 1300 | < |
| 1156 | 1301 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -1160,23 +1305,31 @@ public: |
| 1160 | 1305 | { __self_view __sv = __t; return insert(__pos1, __sv.data(), __sv.size()); } |
| 1161 | 1306 | |
| 1162 | 1307 | template <class _Tp> |
| 1163 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1308 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1164 | 1309 | __enable_if_t |
| 1165 | 1310 | < |
| 1166 | 1311 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value, |
| 1167 | 1312 | basic_string& |
| 1168 | 1313 | > |
| 1169 | 1314 | insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n=npos); |
| 1170 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1315 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1171 | 1316 | basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n=npos); |
| 1172 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& insert(size_type __pos, const value_type* __s, size_type __n); | |
| 1173 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& insert(size_type __pos, const value_type* __s); | |
| 1174 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& insert(size_type __pos, size_type __n, value_type __c); | |
| 1175 | _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator insert(const_iterator __pos, value_type __c); | |
| 1176 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1177 | iterator insert(const_iterator __pos, size_type __n, value_type __c); | |
| 1317 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s, size_type __n); | |
| 1318 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s); | |
| 1319 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, size_type __n, value_type __c); | |
| 1320 | _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __pos, value_type __c); | |
| 1321 | ||
| 1322 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator | |
| 1323 | insert(const_iterator __pos, size_type __n, value_type __c) { | |
| 1324 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this, | |
| 1325 | "string::insert(iterator, n, value) called with an iterator not referring to this string"); | |
| 1326 | difference_type __p = __pos - begin(); | |
| 1327 | insert(static_cast<size_type>(__p), __n, __c); | |
| 1328 | return begin() + __p; | |
| 1329 | } | |
| 1330 | ||
| 1178 | 1331 | template<class _InputIterator> |
| 1179 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1332 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1180 | 1333 | __enable_if_t |
| 1181 | 1334 | < |
| 1182 | 1335 | __is_exactly_cpp17_input_iterator<_InputIterator>::value, |
| ... | ... | @@ -1184,7 +1337,7 @@ public: |
| 1184 | 1337 | > |
| 1185 | 1338 | insert(const_iterator __pos, _InputIterator __first, _InputIterator __last); |
| 1186 | 1339 | template<class _ForwardIterator> |
| 1187 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1340 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1188 | 1341 | __enable_if_t |
| 1189 | 1342 | < |
| 1190 | 1343 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| ... | ... | @@ -1192,47 +1345,53 @@ public: |
| 1192 | 1345 | > |
| 1193 | 1346 | insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last); |
| 1194 | 1347 | #ifndef _LIBCPP_CXX03_LANG |
| 1195 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1348 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1196 | 1349 | iterator insert(const_iterator __pos, initializer_list<value_type> __il) |
| 1197 | 1350 | {return insert(__pos, __il.begin(), __il.end());} |
| 1198 | 1351 | #endif // _LIBCPP_CXX03_LANG |
| 1199 | 1352 | |
| 1200 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& erase(size_type __pos = 0, size_type __n = npos); | |
| 1201 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1353 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& erase(size_type __pos = 0, size_type __n = npos); | |
| 1354 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1202 | 1355 | iterator erase(const_iterator __pos); |
| 1203 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1356 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1204 | 1357 | iterator erase(const_iterator __first, const_iterator __last); |
| 1205 | 1358 | |
| 1206 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1207 | basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str); | |
| 1359 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& | |
| 1360 | replace(size_type __pos1, size_type __n1, const basic_string& __str) { | |
| 1361 | return replace(__pos1, __n1, __str.data(), __str.size()); | |
| 1362 | } | |
| 1208 | 1363 | |
| 1209 | 1364 | template <class _Tp> |
| 1210 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1365 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1211 | 1366 | __enable_if_t |
| 1212 | 1367 | < |
| 1213 | 1368 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| 1214 | 1369 | basic_string& |
| 1215 | 1370 | > |
| 1216 | 1371 | replace(size_type __pos1, size_type __n1, const _Tp& __t) { __self_view __sv = __t; return replace(__pos1, __n1, __sv.data(), __sv.size()); } |
| 1217 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1372 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1218 | 1373 | basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos); |
| 1219 | 1374 | template <class _Tp> |
| 1220 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1375 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1221 | 1376 | __enable_if_t |
| 1222 | 1377 | < |
| 1223 | 1378 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value, |
| 1224 | 1379 | basic_string& |
| 1225 | 1380 | > |
| 1226 | 1381 | replace(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos); |
| 1227 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1382 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1228 | 1383 | basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2); |
| 1229 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& replace(size_type __pos, size_type __n1, const value_type* __s); | |
| 1230 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c); | |
| 1231 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1232 | basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str); | |
| 1384 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(size_type __pos, size_type __n1, const value_type* __s); | |
| 1385 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c); | |
| 1386 | ||
| 1387 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& | |
| 1388 | replace(const_iterator __i1, const_iterator __i2, const basic_string& __str) { | |
| 1389 | return replace( | |
| 1390 | static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __str.data(), __str.size()); | |
| 1391 | } | |
| 1233 | 1392 | |
| 1234 | 1393 | template <class _Tp> |
| 1235 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1394 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1236 | 1395 | __enable_if_t |
| 1237 | 1396 | < |
| 1238 | 1397 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -1240,14 +1399,23 @@ public: |
| 1240 | 1399 | > |
| 1241 | 1400 | replace(const_iterator __i1, const_iterator __i2, const _Tp& __t) { __self_view __sv = __t; return replace(__i1 - begin(), __i2 - __i1, __sv); } |
| 1242 | 1401 | |
| 1243 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1244 | basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n); | |
| 1245 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1246 | basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s); | |
| 1247 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1248 | basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c); | |
| 1402 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& | |
| 1403 | replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n) { | |
| 1404 | return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n); | |
| 1405 | } | |
| 1406 | ||
| 1407 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& | |
| 1408 | replace(const_iterator __i1, const_iterator __i2, const value_type* __s) { | |
| 1409 | return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s); | |
| 1410 | } | |
| 1411 | ||
| 1412 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& | |
| 1413 | replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c) { | |
| 1414 | return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c); | |
| 1415 | } | |
| 1416 | ||
| 1249 | 1417 | template<class _InputIterator> |
| 1250 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1418 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1251 | 1419 | __enable_if_t |
| 1252 | 1420 | < |
| 1253 | 1421 | __is_cpp17_input_iterator<_InputIterator>::value, |
| ... | ... | @@ -1255,16 +1423,31 @@ public: |
| 1255 | 1423 | > |
| 1256 | 1424 | replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2); |
| 1257 | 1425 | #ifndef _LIBCPP_CXX03_LANG |
| 1258 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1426 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1259 | 1427 | basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il) |
| 1260 | 1428 | {return replace(__i1, __i2, __il.begin(), __il.end());} |
| 1261 | 1429 | #endif // _LIBCPP_CXX03_LANG |
| 1262 | 1430 | |
| 1263 | _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const; | |
| 1264 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1265 | basic_string substr(size_type __pos = 0, size_type __n = npos) const; | |
| 1431 | _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const; | |
| 1266 | 1432 | |
| 1267 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1433 | #if _LIBCPP_STD_VER <= 20 | |
| 1434 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1435 | basic_string substr(size_type __pos = 0, size_type __n = npos) const { | |
| 1436 | return basic_string(*this, __pos, __n); | |
| 1437 | } | |
| 1438 | #else | |
| 1439 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 1440 | basic_string substr(size_type __pos = 0, size_type __n = npos) const& { | |
| 1441 | return basic_string(*this, __pos, __n); | |
| 1442 | } | |
| 1443 | ||
| 1444 | _LIBCPP_HIDE_FROM_ABI constexpr | |
| 1445 | basic_string substr(size_type __pos = 0, size_type __n = npos) && { | |
| 1446 | return basic_string(std::move(*this), __pos, __n); | |
| 1447 | } | |
| 1448 | #endif | |
| 1449 | ||
| 1450 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1268 | 1451 | void swap(basic_string& __str) |
| 1269 | 1452 | #if _LIBCPP_STD_VER >= 14 |
| 1270 | 1453 | _NOEXCEPT; |
| ... | ... | @@ -1273,129 +1456,129 @@ public: |
| 1273 | 1456 | __is_nothrow_swappable<allocator_type>::value); |
| 1274 | 1457 | #endif |
| 1275 | 1458 | |
| 1276 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1459 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1277 | 1460 | const value_type* c_str() const _NOEXCEPT {return data();} |
| 1278 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1461 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1279 | 1462 | const value_type* data() const _NOEXCEPT {return std::__to_address(__get_pointer());} |
| 1280 | 1463 | #if _LIBCPP_STD_VER > 14 || defined(_LIBCPP_BUILDING_LIBRARY) |
| 1281 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1464 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1282 | 1465 | value_type* data() _NOEXCEPT {return std::__to_address(__get_pointer());} |
| 1283 | 1466 | #endif |
| 1284 | 1467 | |
| 1285 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1468 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1286 | 1469 | allocator_type get_allocator() const _NOEXCEPT {return __alloc();} |
| 1287 | 1470 | |
| 1288 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1471 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1289 | 1472 | size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT; |
| 1290 | 1473 | |
| 1291 | 1474 | template <class _Tp> |
| 1292 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1475 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1293 | 1476 | __enable_if_t |
| 1294 | 1477 | < |
| 1295 | 1478 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| 1296 | 1479 | size_type |
| 1297 | 1480 | > |
| 1298 | 1481 | find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT; |
| 1299 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1482 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1300 | 1483 | size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; |
| 1301 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1484 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1302 | 1485 | size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT; |
| 1303 | _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT; | |
| 1486 | _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT; | |
| 1304 | 1487 | |
| 1305 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1488 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1306 | 1489 | size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; |
| 1307 | 1490 | |
| 1308 | 1491 | template <class _Tp> |
| 1309 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1492 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1310 | 1493 | __enable_if_t |
| 1311 | 1494 | < |
| 1312 | 1495 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| 1313 | 1496 | size_type |
| 1314 | 1497 | > |
| 1315 | 1498 | rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; |
| 1316 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1499 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1317 | 1500 | size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; |
| 1318 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1501 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1319 | 1502 | size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; |
| 1320 | _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT; | |
| 1503 | _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT; | |
| 1321 | 1504 | |
| 1322 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1505 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1323 | 1506 | size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT; |
| 1324 | 1507 | |
| 1325 | 1508 | template <class _Tp> |
| 1326 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1509 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1327 | 1510 | __enable_if_t |
| 1328 | 1511 | < |
| 1329 | 1512 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| 1330 | 1513 | size_type |
| 1331 | 1514 | > |
| 1332 | 1515 | find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT; |
| 1333 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1516 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1334 | 1517 | size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; |
| 1335 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1518 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1336 | 1519 | size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT; |
| 1337 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1520 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1338 | 1521 | size_type find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT; |
| 1339 | 1522 | |
| 1340 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1523 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1341 | 1524 | size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; |
| 1342 | 1525 | |
| 1343 | 1526 | template <class _Tp> |
| 1344 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1527 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1345 | 1528 | __enable_if_t |
| 1346 | 1529 | < |
| 1347 | 1530 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| 1348 | 1531 | size_type |
| 1349 | 1532 | > |
| 1350 | 1533 | find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; |
| 1351 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1534 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1352 | 1535 | size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; |
| 1353 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1536 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1354 | 1537 | size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; |
| 1355 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1538 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1356 | 1539 | size_type find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT; |
| 1357 | 1540 | |
| 1358 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1541 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1359 | 1542 | size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT; |
| 1360 | 1543 | |
| 1361 | 1544 | template <class _Tp> |
| 1362 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1545 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1363 | 1546 | __enable_if_t |
| 1364 | 1547 | < |
| 1365 | 1548 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| 1366 | 1549 | size_type |
| 1367 | 1550 | > |
| 1368 | 1551 | find_first_not_of(const _Tp &__t, size_type __pos = 0) const _NOEXCEPT; |
| 1369 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1552 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1370 | 1553 | size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; |
| 1371 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1554 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1372 | 1555 | size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT; |
| 1373 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1556 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1374 | 1557 | size_type find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT; |
| 1375 | 1558 | |
| 1376 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1559 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1377 | 1560 | size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; |
| 1378 | 1561 | |
| 1379 | 1562 | template <class _Tp> |
| 1380 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1563 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1381 | 1564 | __enable_if_t |
| 1382 | 1565 | < |
| 1383 | 1566 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| 1384 | 1567 | size_type |
| 1385 | 1568 | > |
| 1386 | 1569 | find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; |
| 1387 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1570 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1388 | 1571 | size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; |
| 1389 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1572 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1390 | 1573 | size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; |
| 1391 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1574 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1392 | 1575 | size_type find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT; |
| 1393 | 1576 | |
| 1394 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1577 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1395 | 1578 | int compare(const basic_string& __str) const _NOEXCEPT; |
| 1396 | 1579 | |
| 1397 | 1580 | template <class _Tp> |
| 1398 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1581 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1399 | 1582 | __enable_if_t |
| 1400 | 1583 | < |
| 1401 | 1584 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -1404,7 +1587,7 @@ public: |
| 1404 | 1587 | compare(const _Tp &__t) const _NOEXCEPT; |
| 1405 | 1588 | |
| 1406 | 1589 | template <class _Tp> |
| 1407 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1590 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1408 | 1591 | __enable_if_t |
| 1409 | 1592 | < |
| 1410 | 1593 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -1412,23 +1595,23 @@ public: |
| 1412 | 1595 | > |
| 1413 | 1596 | compare(size_type __pos1, size_type __n1, const _Tp& __t) const; |
| 1414 | 1597 | |
| 1415 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1598 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1416 | 1599 | int compare(size_type __pos1, size_type __n1, const basic_string& __str) const; |
| 1417 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1600 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1418 | 1601 | int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, |
| 1419 | 1602 | size_type __n2 = npos) const; |
| 1420 | 1603 | |
| 1421 | 1604 | template <class _Tp> |
| 1422 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1605 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1423 | 1606 | __enable_if_t |
| 1424 | 1607 | < |
| 1425 | 1608 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value, |
| 1426 | 1609 | int |
| 1427 | 1610 | > |
| 1428 | 1611 | compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos) const; |
| 1429 | _LIBCPP_CONSTEXPR_AFTER_CXX17 int compare(const value_type* __s) const _NOEXCEPT; | |
| 1430 | _LIBCPP_CONSTEXPR_AFTER_CXX17 int compare(size_type __pos1, size_type __n1, const value_type* __s) const; | |
| 1431 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1612 | _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const value_type* __s) const _NOEXCEPT; | |
| 1613 | _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(size_type __pos1, size_type __n1, const value_type* __s) const; | |
| 1614 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1432 | 1615 | int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const; |
| 1433 | 1616 | |
| 1434 | 1617 | #if _LIBCPP_STD_VER > 17 |
| ... | ... | @@ -1471,9 +1654,9 @@ public: |
| 1471 | 1654 | { return __self_view(data(), size()).contains(__s); } |
| 1472 | 1655 | #endif |
| 1473 | 1656 | |
| 1474 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __invariants() const; | |
| 1657 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const; | |
| 1475 | 1658 | |
| 1476 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __clear_and_shrink() _NOEXCEPT; | |
| 1659 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __clear_and_shrink() _NOEXCEPT; | |
| 1477 | 1660 | |
| 1478 | 1661 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 1479 | 1662 | |
| ... | ... | @@ -1486,20 +1669,20 @@ public: |
| 1486 | 1669 | |
| 1487 | 1670 | private: |
| 1488 | 1671 | template<class _Alloc> |
| 1489 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1672 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1490 | 1673 | bool friend operator==(const basic_string<char, char_traits<char>, _Alloc>& __lhs, |
| 1491 | 1674 | const basic_string<char, char_traits<char>, _Alloc>& __rhs) _NOEXCEPT; |
| 1492 | 1675 | |
| 1493 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __shrink_or_extend(size_type __target_capacity); | |
| 1676 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __shrink_or_extend(size_type __target_capacity); | |
| 1494 | 1677 | |
| 1495 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1678 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1496 | 1679 | bool __is_long() const _NOEXCEPT { |
| 1497 | 1680 | if (__libcpp_is_constant_evaluated()) |
| 1498 | 1681 | return true; |
| 1499 | 1682 | return __r_.first().__s.__is_long_; |
| 1500 | 1683 | } |
| 1501 | 1684 | |
| 1502 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __begin_lifetime(pointer __begin, size_type __n) { | |
| 1685 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __begin_lifetime(pointer __begin, size_type __n) { | |
| 1503 | 1686 | #if _LIBCPP_STD_VER > 17 |
| 1504 | 1687 | if (__libcpp_is_constant_evaluated()) { |
| 1505 | 1688 | for (size_type __i = 0; __i != __n; ++__i) |
| ... | ... | @@ -1511,8 +1694,8 @@ private: |
| 1511 | 1694 | #endif // _LIBCPP_STD_VER > 17 |
| 1512 | 1695 | } |
| 1513 | 1696 | |
| 1514 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __default_init() { | |
| 1515 | __zero(); | |
| 1697 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __default_init() { | |
| 1698 | __r_.first() = __rep(); | |
| 1516 | 1699 | if (__libcpp_is_constant_evaluated()) { |
| 1517 | 1700 | size_type __sz = __recommend(0) + 1; |
| 1518 | 1701 | pointer __ptr = __alloc_traits::allocate(__alloc(), __sz); |
| ... | ... | @@ -1523,7 +1706,7 @@ private: |
| 1523 | 1706 | } |
| 1524 | 1707 | } |
| 1525 | 1708 | |
| 1526 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __deallocate_constexpr() { | |
| 1709 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __deallocate_constexpr() { | |
| 1527 | 1710 | if (__libcpp_is_constant_evaluated() && __get_pointer() != nullptr) |
| 1528 | 1711 | __alloc_traits::deallocate(__alloc(), __get_pointer(), __get_long_cap()); |
| 1529 | 1712 | } |
| ... | ... | @@ -1534,7 +1717,7 @@ private: |
| 1534 | 1717 | } |
| 1535 | 1718 | |
| 1536 | 1719 | template <class _ForwardIterator> |
| 1537 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1720 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1538 | 1721 | iterator __insert_from_safe_copy(size_type __n, size_type __ip, _ForwardIterator __first, _ForwardIterator __last) { |
| 1539 | 1722 | size_type __sz = size(); |
| 1540 | 1723 | size_type __cap = capacity(); |
| ... | ... | @@ -1560,76 +1743,71 @@ private: |
| 1560 | 1743 | return begin() + __ip; |
| 1561 | 1744 | } |
| 1562 | 1745 | |
| 1563 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 allocator_type& __alloc() _NOEXCEPT { return __r_.second(); } | |
| 1746 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 allocator_type& __alloc() _NOEXCEPT { return __r_.second(); } | |
| 1564 | 1747 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const allocator_type& __alloc() const _NOEXCEPT { return __r_.second(); } |
| 1565 | 1748 | |
| 1566 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1749 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1567 | 1750 | void __set_short_size(size_type __s) _NOEXCEPT { |
| 1568 | 1751 | _LIBCPP_ASSERT(__s < __min_cap, "__s should never be greater than or equal to the short string capacity"); |
| 1569 | 1752 | __r_.first().__s.__size_ = __s; |
| 1570 | 1753 | __r_.first().__s.__is_long_ = false; |
| 1571 | 1754 | } |
| 1572 | 1755 | |
| 1573 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1756 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1574 | 1757 | size_type __get_short_size() const _NOEXCEPT { |
| 1575 | 1758 | _LIBCPP_ASSERT(!__r_.first().__s.__is_long_, "String has to be short when trying to get the short size"); |
| 1576 | 1759 | return __r_.first().__s.__size_; |
| 1577 | 1760 | } |
| 1578 | 1761 | |
| 1579 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1762 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1580 | 1763 | void __set_long_size(size_type __s) _NOEXCEPT |
| 1581 | 1764 | {__r_.first().__l.__size_ = __s;} |
| 1582 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1765 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1583 | 1766 | size_type __get_long_size() const _NOEXCEPT |
| 1584 | 1767 | {return __r_.first().__l.__size_;} |
| 1585 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1768 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1586 | 1769 | void __set_size(size_type __s) _NOEXCEPT |
| 1587 | 1770 | {if (__is_long()) __set_long_size(__s); else __set_short_size(__s);} |
| 1588 | 1771 | |
| 1589 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1772 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1590 | 1773 | void __set_long_cap(size_type __s) _NOEXCEPT { |
| 1591 | 1774 | __r_.first().__l.__cap_ = __s / __endian_factor; |
| 1592 | 1775 | __r_.first().__l.__is_long_ = true; |
| 1593 | 1776 | } |
| 1594 | 1777 | |
| 1595 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1778 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1596 | 1779 | size_type __get_long_cap() const _NOEXCEPT { |
| 1597 | 1780 | return __r_.first().__l.__cap_ * __endian_factor; |
| 1598 | 1781 | } |
| 1599 | 1782 | |
| 1600 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1783 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1601 | 1784 | void __set_long_pointer(pointer __p) _NOEXCEPT |
| 1602 | 1785 | {__r_.first().__l.__data_ = __p;} |
| 1603 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1786 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1604 | 1787 | pointer __get_long_pointer() _NOEXCEPT |
| 1605 | 1788 | {return __r_.first().__l.__data_;} |
| 1606 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1789 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1607 | 1790 | const_pointer __get_long_pointer() const _NOEXCEPT |
| 1608 | 1791 | {return __r_.first().__l.__data_;} |
| 1609 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1792 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1610 | 1793 | pointer __get_short_pointer() _NOEXCEPT |
| 1611 | 1794 | {return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);} |
| 1612 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1795 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1613 | 1796 | const_pointer __get_short_pointer() const _NOEXCEPT |
| 1614 | 1797 | {return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);} |
| 1615 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1798 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1616 | 1799 | pointer __get_pointer() _NOEXCEPT |
| 1617 | 1800 | {return __is_long() ? __get_long_pointer() : __get_short_pointer();} |
| 1618 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1801 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1619 | 1802 | const_pointer __get_pointer() const _NOEXCEPT |
| 1620 | 1803 | {return __is_long() ? __get_long_pointer() : __get_short_pointer();} |
| 1621 | 1804 | |
| 1622 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1623 | void __zero() _NOEXCEPT { | |
| 1624 | __r_.first() = __rep(); | |
| 1625 | } | |
| 1626 | ||
| 1627 | 1805 | template <size_type __a> static |
| 1628 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1806 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1629 | 1807 | size_type __align_it(size_type __s) _NOEXCEPT |
| 1630 | 1808 | {return (__s + (__a-1)) & ~(__a-1);} |
| 1631 | 1809 | enum {__alignment = 16}; |
| 1632 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1810 | static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1633 | 1811 | size_type __recommend(size_type __s) _NOEXCEPT |
| 1634 | 1812 | { |
| 1635 | 1813 | if (__s < __min_cap) { |
| ... | ... | @@ -1644,11 +1822,11 @@ private: |
| 1644 | 1822 | return __guess; |
| 1645 | 1823 | } |
| 1646 | 1824 | |
| 1647 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1825 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1648 | 1826 | void __init(const value_type* __s, size_type __sz, size_type __reserve); |
| 1649 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1827 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1650 | 1828 | void __init(const value_type* __s, size_type __sz); |
| 1651 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1829 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1652 | 1830 | void __init(size_type __n, value_type __c); |
| 1653 | 1831 | |
| 1654 | 1832 | // Slow path for the (inlined) copy constructor for 'long' strings. |
| ... | ... | @@ -1659,10 +1837,10 @@ private: |
| 1659 | 1837 | // to call the __init() functions as those are marked as inline which may |
| 1660 | 1838 | // result in over-aggressive inlining by the compiler, where our aim is |
| 1661 | 1839 | // to only inline the fast path code directly in the ctor. |
| 1662 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __init_copy_ctor_external(const value_type* __s, size_type __sz); | |
| 1840 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init_copy_ctor_external(const value_type* __s, size_type __sz); | |
| 1663 | 1841 | |
| 1664 | 1842 | template <class _InputIterator> |
| 1665 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1843 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1666 | 1844 | __enable_if_t |
| 1667 | 1845 | < |
| 1668 | 1846 | __is_exactly_cpp17_input_iterator<_InputIterator>::value |
| ... | ... | @@ -1670,17 +1848,17 @@ private: |
| 1670 | 1848 | __init(_InputIterator __first, _InputIterator __last); |
| 1671 | 1849 | |
| 1672 | 1850 | template <class _ForwardIterator> |
| 1673 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1851 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1674 | 1852 | __enable_if_t |
| 1675 | 1853 | < |
| 1676 | 1854 | __is_cpp17_forward_iterator<_ForwardIterator>::value |
| 1677 | 1855 | > |
| 1678 | 1856 | __init(_ForwardIterator __first, _ForwardIterator __last); |
| 1679 | 1857 | |
| 1680 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1858 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1681 | 1859 | void __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz, |
| 1682 | 1860 | size_type __n_copy, size_type __n_del, size_type __n_add = 0); |
| 1683 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1861 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1684 | 1862 | void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz, |
| 1685 | 1863 | size_type __n_copy, size_type __n_del, |
| 1686 | 1864 | size_type __n_add, const value_type* __p_new_stuff); |
| ... | ... | @@ -1689,21 +1867,22 @@ private: |
| 1689 | 1867 | // have proof that the input does not alias the current instance. |
| 1690 | 1868 | // For example, operator=(basic_string) performs a 'self' check. |
| 1691 | 1869 | template <bool __is_short> |
| 1692 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& __assign_no_alias(const value_type* __s, size_type __n); | |
| 1870 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& __assign_no_alias(const value_type* __s, size_type __n); | |
| 1693 | 1871 | |
| 1694 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1695 | void __erase_to_end(size_type __pos); | |
| 1872 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __erase_to_end(size_type __pos) { | |
| 1873 | __null_terminate_at(std::__to_address(__get_pointer()), __pos); | |
| 1874 | } | |
| 1696 | 1875 | |
| 1697 | 1876 | // __erase_external_with_move is invoked for erase() invocations where |
| 1698 | 1877 | // `n ~= npos`, likely requiring memory moves on the string data. |
| 1699 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __erase_external_with_move(size_type __pos, size_type __n); | |
| 1878 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void __erase_external_with_move(size_type __pos, size_type __n); | |
| 1700 | 1879 | |
| 1701 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1880 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1702 | 1881 | void __copy_assign_alloc(const basic_string& __str) |
| 1703 | 1882 | {__copy_assign_alloc(__str, integral_constant<bool, |
| 1704 | 1883 | __alloc_traits::propagate_on_container_copy_assignment::value>());} |
| 1705 | 1884 | |
| 1706 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1885 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1707 | 1886 | void __copy_assign_alloc(const basic_string& __str, true_type) |
| 1708 | 1887 | { |
| 1709 | 1888 | if (__alloc() == __str.__alloc()) |
| ... | ... | @@ -1720,7 +1899,7 @@ private: |
| 1720 | 1899 | allocator_type __a = __str.__alloc(); |
| 1721 | 1900 | auto __allocation = std::__allocate_at_least(__a, __str.__get_long_cap()); |
| 1722 | 1901 | __begin_lifetime(__allocation.ptr, __allocation.count); |
| 1723 | __clear_and_shrink(); | |
| 1902 | __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap()); | |
| 1724 | 1903 | __alloc() = std::move(__a); |
| 1725 | 1904 | __set_long_pointer(__allocation.ptr); |
| 1726 | 1905 | __set_long_cap(__allocation.count); |
| ... | ... | @@ -1729,15 +1908,15 @@ private: |
| 1729 | 1908 | } |
| 1730 | 1909 | } |
| 1731 | 1910 | |
| 1732 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1911 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1733 | 1912 | void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT |
| 1734 | 1913 | {} |
| 1735 | 1914 | |
| 1736 | 1915 | #ifndef _LIBCPP_CXX03_LANG |
| 1737 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1916 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1738 | 1917 | void __move_assign(basic_string& __str, false_type) |
| 1739 | 1918 | _NOEXCEPT_(__alloc_traits::is_always_equal::value); |
| 1740 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1919 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1741 | 1920 | void __move_assign(basic_string& __str, true_type) |
| 1742 | 1921 | #if _LIBCPP_STD_VER > 14 |
| 1743 | 1922 | _NOEXCEPT; |
| ... | ... | @@ -1746,7 +1925,7 @@ private: |
| 1746 | 1925 | #endif |
| 1747 | 1926 | #endif |
| 1748 | 1927 | |
| 1749 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1928 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1750 | 1929 | void |
| 1751 | 1930 | __move_assign_alloc(basic_string& __str) |
| 1752 | 1931 | _NOEXCEPT_( |
| ... | ... | @@ -1755,20 +1934,20 @@ private: |
| 1755 | 1934 | {__move_assign_alloc(__str, integral_constant<bool, |
| 1756 | 1935 | __alloc_traits::propagate_on_container_move_assignment::value>());} |
| 1757 | 1936 | |
| 1758 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1937 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1759 | 1938 | void __move_assign_alloc(basic_string& __c, true_type) |
| 1760 | 1939 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) |
| 1761 | 1940 | { |
| 1762 | 1941 | __alloc() = std::move(__c.__alloc()); |
| 1763 | 1942 | } |
| 1764 | 1943 | |
| 1765 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1944 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1766 | 1945 | void __move_assign_alloc(basic_string&, false_type) |
| 1767 | 1946 | _NOEXCEPT |
| 1768 | 1947 | {} |
| 1769 | 1948 | |
| 1770 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& __assign_external(const value_type* __s); | |
| 1771 | _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& __assign_external(const value_type* __s, size_type __n); | |
| 1949 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& __assign_external(const value_type* __s); | |
| 1950 | _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& __assign_external(const value_type* __s, size_type __n); | |
| 1772 | 1951 | |
| 1773 | 1952 | // Assigns the value in __s, guaranteed to be __n < __min_cap in length. |
| 1774 | 1953 | inline basic_string& __assign_short(const value_type* __s, size_type __n) { |
| ... | ... | @@ -1780,7 +1959,7 @@ private: |
| 1780 | 1959 | return *this; |
| 1781 | 1960 | } |
| 1782 | 1961 | |
| 1783 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1962 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1784 | 1963 | basic_string& __null_terminate_at(value_type* __p, size_type __newsz) { |
| 1785 | 1964 | __set_size(__newsz); |
| 1786 | 1965 | __invalidate_iterators_past(__newsz); |
| ... | ... | @@ -1788,10 +1967,10 @@ private: |
| 1788 | 1967 | return *this; |
| 1789 | 1968 | } |
| 1790 | 1969 | |
| 1791 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __invalidate_iterators_past(size_type); | |
| 1970 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __invalidate_iterators_past(size_type); | |
| 1792 | 1971 | |
| 1793 | 1972 | template<class _Tp> |
| 1794 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1973 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1795 | 1974 | bool __addr_in_range(_Tp&& __t) const { |
| 1796 | 1975 | // assume that the ranges overlap, because we can't check during constant evaluation |
| 1797 | 1976 | if (__libcpp_is_constant_evaluated()) |
| ... | ... | @@ -1810,11 +1989,11 @@ private: |
| 1810 | 1989 | std::__throw_out_of_range("basic_string"); |
| 1811 | 1990 | } |
| 1812 | 1991 | |
| 1813 | friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const basic_string&, const basic_string&); | |
| 1814 | friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const value_type*, const basic_string&); | |
| 1815 | friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(value_type, const basic_string&); | |
| 1816 | friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const basic_string&, const value_type*); | |
| 1817 | friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const basic_string&, value_type); | |
| 1992 | friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, const basic_string&); | |
| 1993 | friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const value_type*, const basic_string&); | |
| 1994 | friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(value_type, const basic_string&); | |
| 1995 | friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, const value_type*); | |
| 1996 | friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, value_type); | |
| 1818 | 1997 | }; |
| 1819 | 1998 | |
| 1820 | 1999 | // These declarations must appear before any functions are implicitly used |
| ... | ... | @@ -1863,7 +2042,7 @@ basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _ |
| 1863 | 2042 | #endif |
| 1864 | 2043 | |
| 1865 | 2044 | template <class _CharT, class _Traits, class _Allocator> |
| 1866 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2045 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1867 | 2046 | void |
| 1868 | 2047 | basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos) |
| 1869 | 2048 | { |
| ... | ... | @@ -1893,37 +2072,13 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type |
| 1893 | 2072 | } |
| 1894 | 2073 | |
| 1895 | 2074 | template <class _CharT, class _Traits, class _Allocator> |
| 1896 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1897 | basic_string<_CharT, _Traits, _Allocator>::basic_string() | |
| 1898 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) | |
| 1899 | : __r_(__default_init_tag(), __default_init_tag()) | |
| 1900 | { | |
| 1901 | std::__debug_db_insert_c(this); | |
| 1902 | __default_init(); | |
| 1903 | } | |
| 1904 | ||
| 1905 | template <class _CharT, class _Traits, class _Allocator> | |
| 1906 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1907 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a) | |
| 1908 | #if _LIBCPP_STD_VER <= 14 | |
| 1909 | _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value) | |
| 1910 | #else | |
| 1911 | _NOEXCEPT | |
| 1912 | #endif | |
| 1913 | : __r_(__default_init_tag(), __a) | |
| 1914 | { | |
| 1915 | std::__debug_db_insert_c(this); | |
| 1916 | __default_init(); | |
| 1917 | } | |
| 1918 | ||
| 1919 | template <class _CharT, class _Traits, class _Allocator> | |
| 1920 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2075 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1921 | 2076 | void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, |
| 1922 | 2077 | size_type __sz, |
| 1923 | 2078 | size_type __reserve) |
| 1924 | 2079 | { |
| 1925 | 2080 | if (__libcpp_is_constant_evaluated()) |
| 1926 | __zero(); | |
| 2081 | __r_.first() = __rep(); | |
| 1927 | 2082 | if (__reserve > max_size()) |
| 1928 | 2083 | __throw_length_error(); |
| 1929 | 2084 | pointer __p; |
| ... | ... | @@ -1946,12 +2101,12 @@ void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, |
| 1946 | 2101 | } |
| 1947 | 2102 | |
| 1948 | 2103 | template <class _CharT, class _Traits, class _Allocator> |
| 1949 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2104 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1950 | 2105 | void |
| 1951 | 2106 | basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz) |
| 1952 | 2107 | { |
| 1953 | 2108 | if (__libcpp_is_constant_evaluated()) |
| 1954 | __zero(); | |
| 2109 | __r_.first() = __rep(); | |
| 1955 | 2110 | if (__sz > max_size()) |
| 1956 | 2111 | __throw_length_error(); |
| 1957 | 2112 | pointer __p; |
| ... | ... | @@ -1975,7 +2130,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty |
| 1975 | 2130 | |
| 1976 | 2131 | template <class _CharT, class _Traits, class _Allocator> |
| 1977 | 2132 | template <class> |
| 1978 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2133 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1979 | 2134 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a) |
| 1980 | 2135 | : __r_(__default_init_tag(), __a) |
| 1981 | 2136 | { |
| ... | ... | @@ -1985,32 +2140,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const |
| 1985 | 2140 | } |
| 1986 | 2141 | |
| 1987 | 2142 | template <class _CharT, class _Traits, class _Allocator> |
| 1988 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1989 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n) | |
| 1990 | : __r_(__default_init_tag(), __default_init_tag()) | |
| 1991 | { | |
| 1992 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); | |
| 1993 | __init(__s, __n); | |
| 1994 | std::__debug_db_insert_c(this); | |
| 1995 | } | |
| 1996 | ||
| 1997 | template <class _CharT, class _Traits, class _Allocator> | |
| 1998 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1999 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) | |
| 2000 | : __r_(__default_init_tag(), __a) | |
| 2001 | { | |
| 2002 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); | |
| 2003 | __init(__s, __n); | |
| 2004 | std::__debug_db_insert_c(this); | |
| 2005 | } | |
| 2006 | ||
| 2007 | template <class _CharT, class _Traits, class _Allocator> | |
| 2008 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2143 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2009 | 2144 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str) |
| 2010 | 2145 | : __r_(__default_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc())) |
| 2011 | 2146 | { |
| 2012 | 2147 | if (!__str.__is_long()) |
| 2013 | __r_.first().__r = __str.__r_.first().__r; | |
| 2148 | __r_.first() = __str.__r_.first(); | |
| 2014 | 2149 | else |
| 2015 | 2150 | __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), |
| 2016 | 2151 | __str.__get_long_size()); |
| ... | ... | @@ -2018,13 +2153,13 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st |
| 2018 | 2153 | } |
| 2019 | 2154 | |
| 2020 | 2155 | template <class _CharT, class _Traits, class _Allocator> |
| 2021 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2156 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2022 | 2157 | basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 2023 | 2158 | const basic_string& __str, const allocator_type& __a) |
| 2024 | 2159 | : __r_(__default_init_tag(), __a) |
| 2025 | 2160 | { |
| 2026 | 2161 | if (!__str.__is_long()) |
| 2027 | __r_.first().__r = __str.__r_.first().__r; | |
| 2162 | __r_.first() = __str.__r_.first(); | |
| 2028 | 2163 | else |
| 2029 | 2164 | __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), |
| 2030 | 2165 | __str.__get_long_size()); |
| ... | ... | @@ -2032,11 +2167,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 2032 | 2167 | } |
| 2033 | 2168 | |
| 2034 | 2169 | template <class _CharT, class _Traits, class _Allocator> |
| 2035 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2170 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2036 | 2171 | void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external( |
| 2037 | 2172 | const value_type* __s, size_type __sz) { |
| 2038 | 2173 | if (__libcpp_is_constant_evaluated()) |
| 2039 | __zero(); | |
| 2174 | __r_.first() = __rep(); | |
| 2175 | ||
| 2040 | 2176 | pointer __p; |
| 2041 | 2177 | if (__fits_in_sso(__sz)) { |
| 2042 | 2178 | __p = __get_short_pointer(); |
| ... | ... | @@ -2054,55 +2190,14 @@ void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external( |
| 2054 | 2190 | traits_type::copy(std::__to_address(__p), __s, __sz + 1); |
| 2055 | 2191 | } |
| 2056 | 2192 | |
| 2057 | #ifndef _LIBCPP_CXX03_LANG | |
| 2058 | ||
| 2059 | template <class _CharT, class _Traits, class _Allocator> | |
| 2060 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2061 | basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str) | |
| 2062 | #if _LIBCPP_STD_VER <= 14 | |
| 2063 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) | |
| 2064 | #else | |
| 2065 | _NOEXCEPT | |
| 2066 | #endif | |
| 2067 | : __r_(std::move(__str.__r_)) | |
| 2068 | { | |
| 2069 | __str.__default_init(); | |
| 2070 | std::__debug_db_insert_c(this); | |
| 2071 | if (__is_long()) | |
| 2072 | std::__debug_db_swap(this, &__str); | |
| 2073 | } | |
| 2074 | ||
| 2075 | 2193 | template <class _CharT, class _Traits, class _Allocator> |
| 2076 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2077 | basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a) | |
| 2078 | : __r_(__default_init_tag(), __a) | |
| 2079 | { | |
| 2080 | if (__str.__is_long() && __a != __str.__alloc()) // copy, not move | |
| 2081 | __init(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); | |
| 2082 | else | |
| 2083 | { | |
| 2084 | if (__libcpp_is_constant_evaluated()) { | |
| 2085 | __zero(); | |
| 2086 | __r_.first().__l = __str.__r_.first().__l; | |
| 2087 | } else { | |
| 2088 | __r_.first().__r = __str.__r_.first().__r; | |
| 2089 | } | |
| 2090 | __str.__default_init(); | |
| 2091 | } | |
| 2092 | std::__debug_db_insert_c(this); | |
| 2093 | if (__is_long()) | |
| 2094 | std::__debug_db_swap(this, &__str); | |
| 2095 | } | |
| 2096 | ||
| 2097 | #endif // _LIBCPP_CXX03_LANG | |
| 2098 | ||
| 2099 | template <class _CharT, class _Traits, class _Allocator> | |
| 2100 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2194 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2101 | 2195 | void |
| 2102 | 2196 | basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) |
| 2103 | 2197 | { |
| 2104 | 2198 | if (__libcpp_is_constant_evaluated()) |
| 2105 | __zero(); | |
| 2199 | __r_.first() = __rep(); | |
| 2200 | ||
| 2106 | 2201 | if (__n > max_size()) |
| 2107 | 2202 | __throw_length_error(); |
| 2108 | 2203 | pointer __p; |
| ... | ... | @@ -2124,18 +2219,9 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) |
| 2124 | 2219 | traits_type::assign(__p[__n], value_type()); |
| 2125 | 2220 | } |
| 2126 | 2221 | |
| 2127 | template <class _CharT, class _Traits, class _Allocator> | |
| 2128 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2129 | basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c) | |
| 2130 | : __r_(__default_init_tag(), __default_init_tag()) | |
| 2131 | { | |
| 2132 | __init(__n, __c); | |
| 2133 | std::__debug_db_insert_c(this); | |
| 2134 | } | |
| 2135 | ||
| 2136 | 2222 | template <class _CharT, class _Traits, class _Allocator> |
| 2137 | 2223 | template <class> |
| 2138 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2224 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2139 | 2225 | basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a) |
| 2140 | 2226 | : __r_(__default_init_tag(), __a) |
| 2141 | 2227 | { |
| ... | ... | @@ -2144,7 +2230,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __ |
| 2144 | 2230 | } |
| 2145 | 2231 | |
| 2146 | 2232 | template <class _CharT, class _Traits, class _Allocator> |
| 2147 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2233 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2148 | 2234 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, |
| 2149 | 2235 | size_type __pos, size_type __n, |
| 2150 | 2236 | const _Allocator& __a) |
| ... | ... | @@ -2157,22 +2243,9 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st |
| 2157 | 2243 | std::__debug_db_insert_c(this); |
| 2158 | 2244 | } |
| 2159 | 2245 | |
| 2160 | template <class _CharT, class _Traits, class _Allocator> | |
| 2161 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2162 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, | |
| 2163 | const _Allocator& __a) | |
| 2164 | : __r_(__default_init_tag(), __a) | |
| 2165 | { | |
| 2166 | size_type __str_sz = __str.size(); | |
| 2167 | if (__pos > __str_sz) | |
| 2168 | __throw_out_of_range(); | |
| 2169 | __init(__str.data() + __pos, __str_sz - __pos); | |
| 2170 | std::__debug_db_insert_c(this); | |
| 2171 | } | |
| 2172 | ||
| 2173 | 2246 | template <class _CharT, class _Traits, class _Allocator> |
| 2174 | 2247 | template <class _Tp, class> |
| 2175 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2248 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2176 | 2249 | basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 2177 | 2250 | const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a) |
| 2178 | 2251 | : __r_(__default_init_tag(), __a) |
| ... | ... | @@ -2185,7 +2258,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 2185 | 2258 | |
| 2186 | 2259 | template <class _CharT, class _Traits, class _Allocator> |
| 2187 | 2260 | template <class _Tp, class> |
| 2188 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2261 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2189 | 2262 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t) |
| 2190 | 2263 | : __r_(__default_init_tag(), __default_init_tag()) |
| 2191 | 2264 | { |
| ... | ... | @@ -2196,7 +2269,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t) |
| 2196 | 2269 | |
| 2197 | 2270 | template <class _CharT, class _Traits, class _Allocator> |
| 2198 | 2271 | template <class _Tp, class> |
| 2199 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2272 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2200 | 2273 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a) |
| 2201 | 2274 | : __r_(__default_init_tag(), __a) |
| 2202 | 2275 | { |
| ... | ... | @@ -2207,7 +2280,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _ |
| 2207 | 2280 | |
| 2208 | 2281 | template <class _CharT, class _Traits, class _Allocator> |
| 2209 | 2282 | template <class _InputIterator> |
| 2210 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2283 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2211 | 2284 | __enable_if_t |
| 2212 | 2285 | < |
| 2213 | 2286 | __is_exactly_cpp17_input_iterator<_InputIterator>::value |
| ... | ... | @@ -2234,7 +2307,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _Input |
| 2234 | 2307 | |
| 2235 | 2308 | template <class _CharT, class _Traits, class _Allocator> |
| 2236 | 2309 | template <class _ForwardIterator> |
| 2237 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2310 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2238 | 2311 | __enable_if_t |
| 2239 | 2312 | < |
| 2240 | 2313 | __is_cpp17_forward_iterator<_ForwardIterator>::value |
| ... | ... | @@ -2242,7 +2315,7 @@ __enable_if_t |
| 2242 | 2315 | basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last) |
| 2243 | 2316 | { |
| 2244 | 2317 | if (__libcpp_is_constant_evaluated()) |
| 2245 | __zero(); | |
| 2318 | __r_.first() = __rep(); | |
| 2246 | 2319 | size_type __sz = static_cast<size_type>(std::distance(__first, __last)); |
| 2247 | 2320 | if (__sz > max_size()) |
| 2248 | 2321 | __throw_length_error(); |
| ... | ... | @@ -2281,52 +2354,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For |
| 2281 | 2354 | } |
| 2282 | 2355 | |
| 2283 | 2356 | template <class _CharT, class _Traits, class _Allocator> |
| 2284 | template<class _InputIterator, class> | |
| 2285 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2286 | basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last) | |
| 2287 | : __r_(__default_init_tag(), __default_init_tag()) | |
| 2288 | { | |
| 2289 | __init(__first, __last); | |
| 2290 | std::__debug_db_insert_c(this); | |
| 2291 | } | |
| 2292 | ||
| 2293 | template <class _CharT, class _Traits, class _Allocator> | |
| 2294 | template<class _InputIterator, class> | |
| 2295 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2296 | basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last, | |
| 2297 | const allocator_type& __a) | |
| 2298 | : __r_(__default_init_tag(), __a) | |
| 2299 | { | |
| 2300 | __init(__first, __last); | |
| 2301 | std::__debug_db_insert_c(this); | |
| 2302 | } | |
| 2303 | ||
| 2304 | #ifndef _LIBCPP_CXX03_LANG | |
| 2305 | ||
| 2306 | template <class _CharT, class _Traits, class _Allocator> | |
| 2307 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2308 | basic_string<_CharT, _Traits, _Allocator>::basic_string( | |
| 2309 | initializer_list<_CharT> __il) | |
| 2310 | : __r_(__default_init_tag(), __default_init_tag()) | |
| 2311 | { | |
| 2312 | __init(__il.begin(), __il.end()); | |
| 2313 | std::__debug_db_insert_c(this); | |
| 2314 | } | |
| 2315 | ||
| 2316 | template <class _CharT, class _Traits, class _Allocator> | |
| 2317 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2318 | basic_string<_CharT, _Traits, _Allocator>::basic_string( | |
| 2319 | initializer_list<_CharT> __il, const _Allocator& __a) | |
| 2320 | : __r_(__default_init_tag(), __a) | |
| 2321 | { | |
| 2322 | __init(__il.begin(), __il.end()); | |
| 2323 | std::__debug_db_insert_c(this); | |
| 2324 | } | |
| 2325 | ||
| 2326 | #endif // _LIBCPP_CXX03_LANG | |
| 2327 | ||
| 2328 | template <class _CharT, class _Traits, class _Allocator> | |
| 2329 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2357 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2330 | 2358 | basic_string<_CharT, _Traits, _Allocator>::~basic_string() |
| 2331 | 2359 | { |
| 2332 | 2360 | std::__debug_db_erase_c(this); |
| ... | ... | @@ -2335,7 +2363,7 @@ basic_string<_CharT, _Traits, _Allocator>::~basic_string() |
| 2335 | 2363 | } |
| 2336 | 2364 | |
| 2337 | 2365 | template <class _CharT, class _Traits, class _Allocator> |
| 2338 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2366 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2339 | 2367 | void |
| 2340 | 2368 | basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace |
| 2341 | 2369 | (size_type __old_cap, size_type __delta_cap, size_type __old_sz, |
| ... | ... | @@ -2372,7 +2400,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace |
| 2372 | 2400 | |
| 2373 | 2401 | template <class _CharT, class _Traits, class _Allocator> |
| 2374 | 2402 | void |
| 2375 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2403 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2376 | 2404 | basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz, |
| 2377 | 2405 | size_type __n_copy, size_type __n_del, size_type __n_add) |
| 2378 | 2406 | { |
| ... | ... | @@ -2405,7 +2433,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t |
| 2405 | 2433 | |
| 2406 | 2434 | template <class _CharT, class _Traits, class _Allocator> |
| 2407 | 2435 | template <bool __is_short> |
| 2408 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2436 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2409 | 2437 | basic_string<_CharT, _Traits, _Allocator>& |
| 2410 | 2438 | basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias( |
| 2411 | 2439 | const value_type* __s, size_type __n) { |
| ... | ... | @@ -2424,7 +2452,7 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias( |
| 2424 | 2452 | } |
| 2425 | 2453 | |
| 2426 | 2454 | template <class _CharT, class _Traits, class _Allocator> |
| 2427 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2455 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2428 | 2456 | basic_string<_CharT, _Traits, _Allocator>& |
| 2429 | 2457 | basic_string<_CharT, _Traits, _Allocator>::__assign_external( |
| 2430 | 2458 | const value_type* __s, size_type __n) { |
| ... | ... | @@ -2441,7 +2469,7 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_external( |
| 2441 | 2469 | } |
| 2442 | 2470 | |
| 2443 | 2471 | template <class _CharT, class _Traits, class _Allocator> |
| 2444 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2472 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2445 | 2473 | basic_string<_CharT, _Traits, _Allocator>& |
| 2446 | 2474 | basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) |
| 2447 | 2475 | { |
| ... | ... | @@ -2452,7 +2480,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_ty |
| 2452 | 2480 | } |
| 2453 | 2481 | |
| 2454 | 2482 | template <class _CharT, class _Traits, class _Allocator> |
| 2455 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2483 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2456 | 2484 | basic_string<_CharT, _Traits, _Allocator>& |
| 2457 | 2485 | basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) |
| 2458 | 2486 | { |
| ... | ... | @@ -2468,7 +2496,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) |
| 2468 | 2496 | } |
| 2469 | 2497 | |
| 2470 | 2498 | template <class _CharT, class _Traits, class _Allocator> |
| 2471 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2499 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2472 | 2500 | basic_string<_CharT, _Traits, _Allocator>& |
| 2473 | 2501 | basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c) |
| 2474 | 2502 | { |
| ... | ... | @@ -2490,7 +2518,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c) |
| 2490 | 2518 | } |
| 2491 | 2519 | |
| 2492 | 2520 | template <class _CharT, class _Traits, class _Allocator> |
| 2493 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2521 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2494 | 2522 | basic_string<_CharT, _Traits, _Allocator>& |
| 2495 | 2523 | basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) |
| 2496 | 2524 | { |
| ... | ... | @@ -2498,7 +2526,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) |
| 2498 | 2526 | __copy_assign_alloc(__str); |
| 2499 | 2527 | if (!__is_long()) { |
| 2500 | 2528 | if (!__str.__is_long()) { |
| 2501 | __r_.first().__r = __str.__r_.first().__r; | |
| 2529 | __r_.first() = __str.__r_.first(); | |
| 2502 | 2530 | } else { |
| 2503 | 2531 | return __assign_no_alias<true>(__str.data(), __str.size()); |
| 2504 | 2532 | } |
| ... | ... | @@ -2512,7 +2540,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) |
| 2512 | 2540 | #ifndef _LIBCPP_CXX03_LANG |
| 2513 | 2541 | |
| 2514 | 2542 | template <class _CharT, class _Traits, class _Allocator> |
| 2515 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2543 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2516 | 2544 | void |
| 2517 | 2545 | basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type) |
| 2518 | 2546 | _NOEXCEPT_(__alloc_traits::is_always_equal::value) |
| ... | ... | @@ -2524,7 +2552,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, fa |
| 2524 | 2552 | } |
| 2525 | 2553 | |
| 2526 | 2554 | template <class _CharT, class _Traits, class _Allocator> |
| 2527 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2555 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2528 | 2556 | void |
| 2529 | 2557 | basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type) |
| 2530 | 2558 | #if _LIBCPP_STD_VER > 14 |
| ... | ... | @@ -2553,22 +2581,11 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr |
| 2553 | 2581 | } |
| 2554 | 2582 | } |
| 2555 | 2583 | |
| 2556 | template <class _CharT, class _Traits, class _Allocator> | |
| 2557 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2558 | basic_string<_CharT, _Traits, _Allocator>& | |
| 2559 | basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str) | |
| 2560 | _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) | |
| 2561 | { | |
| 2562 | __move_assign(__str, integral_constant<bool, | |
| 2563 | __alloc_traits::propagate_on_container_move_assignment::value>()); | |
| 2564 | return *this; | |
| 2565 | } | |
| 2566 | ||
| 2567 | 2584 | #endif |
| 2568 | 2585 | |
| 2569 | 2586 | template <class _CharT, class _Traits, class _Allocator> |
| 2570 | 2587 | template<class _InputIterator> |
| 2571 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2588 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2572 | 2589 | __enable_if_t |
| 2573 | 2590 | < |
| 2574 | 2591 | __is_exactly_cpp17_input_iterator<_InputIterator>::value, |
| ... | ... | @@ -2583,7 +2600,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _Input |
| 2583 | 2600 | |
| 2584 | 2601 | template <class _CharT, class _Traits, class _Allocator> |
| 2585 | 2602 | template<class _ForwardIterator> |
| 2586 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2603 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2587 | 2604 | __enable_if_t |
| 2588 | 2605 | < |
| 2589 | 2606 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| ... | ... | @@ -2619,7 +2636,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _For |
| 2619 | 2636 | } |
| 2620 | 2637 | |
| 2621 | 2638 | template <class _CharT, class _Traits, class _Allocator> |
| 2622 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2639 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2623 | 2640 | basic_string<_CharT, _Traits, _Allocator>& |
| 2624 | 2641 | basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n) |
| 2625 | 2642 | { |
| ... | ... | @@ -2631,7 +2648,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, siz |
| 2631 | 2648 | |
| 2632 | 2649 | template <class _CharT, class _Traits, class _Allocator> |
| 2633 | 2650 | template <class _Tp> |
| 2634 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2651 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2635 | 2652 | __enable_if_t |
| 2636 | 2653 | < |
| 2637 | 2654 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value |
| ... | ... | @@ -2649,14 +2666,14 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp & __t, size_type __p |
| 2649 | 2666 | |
| 2650 | 2667 | |
| 2651 | 2668 | template <class _CharT, class _Traits, class _Allocator> |
| 2652 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2669 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2653 | 2670 | basic_string<_CharT, _Traits, _Allocator>& |
| 2654 | 2671 | basic_string<_CharT, _Traits, _Allocator>::__assign_external(const value_type* __s) { |
| 2655 | 2672 | return __assign_external(__s, traits_type::length(__s)); |
| 2656 | 2673 | } |
| 2657 | 2674 | |
| 2658 | 2675 | template <class _CharT, class _Traits, class _Allocator> |
| 2659 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2676 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2660 | 2677 | basic_string<_CharT, _Traits, _Allocator>& |
| 2661 | 2678 | basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) |
| 2662 | 2679 | { |
| ... | ... | @@ -2670,7 +2687,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) |
| 2670 | 2687 | // append |
| 2671 | 2688 | |
| 2672 | 2689 | template <class _CharT, class _Traits, class _Allocator> |
| 2673 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2690 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2674 | 2691 | basic_string<_CharT, _Traits, _Allocator>& |
| 2675 | 2692 | basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n) |
| 2676 | 2693 | { |
| ... | ... | @@ -2694,7 +2711,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty |
| 2694 | 2711 | } |
| 2695 | 2712 | |
| 2696 | 2713 | template <class _CharT, class _Traits, class _Allocator> |
| 2697 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2714 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2698 | 2715 | basic_string<_CharT, _Traits, _Allocator>& |
| 2699 | 2716 | basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) |
| 2700 | 2717 | { |
| ... | ... | @@ -2714,7 +2731,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) |
| 2714 | 2731 | } |
| 2715 | 2732 | |
| 2716 | 2733 | template <class _CharT, class _Traits, class _Allocator> |
| 2717 | _LIBCPP_CONSTEXPR_AFTER_CXX17 inline void | |
| 2734 | _LIBCPP_CONSTEXPR_SINCE_CXX20 inline void | |
| 2718 | 2735 | basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n) |
| 2719 | 2736 | { |
| 2720 | 2737 | if (__n) |
| ... | ... | @@ -2731,7 +2748,7 @@ basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n) |
| 2731 | 2748 | } |
| 2732 | 2749 | |
| 2733 | 2750 | template <class _CharT, class _Traits, class _Allocator> |
| 2734 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2751 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2735 | 2752 | void |
| 2736 | 2753 | basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c) |
| 2737 | 2754 | { |
| ... | ... | @@ -2770,7 +2787,7 @@ basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c) |
| 2770 | 2787 | |
| 2771 | 2788 | template <class _CharT, class _Traits, class _Allocator> |
| 2772 | 2789 | template<class _ForwardIterator> |
| 2773 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2790 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2774 | 2791 | __enable_if_t |
| 2775 | 2792 | < |
| 2776 | 2793 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| ... | ... | @@ -2805,15 +2822,7 @@ basic_string<_CharT, _Traits, _Allocator>::append( |
| 2805 | 2822 | } |
| 2806 | 2823 | |
| 2807 | 2824 | template <class _CharT, class _Traits, class _Allocator> |
| 2808 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2809 | basic_string<_CharT, _Traits, _Allocator>& | |
| 2810 | basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str) | |
| 2811 | { | |
| 2812 | return append(__str.data(), __str.size()); | |
| 2813 | } | |
| 2814 | ||
| 2815 | template <class _CharT, class _Traits, class _Allocator> | |
| 2816 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2825 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2817 | 2826 | basic_string<_CharT, _Traits, _Allocator>& |
| 2818 | 2827 | basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n) |
| 2819 | 2828 | { |
| ... | ... | @@ -2825,7 +2834,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, siz |
| 2825 | 2834 | |
| 2826 | 2835 | template <class _CharT, class _Traits, class _Allocator> |
| 2827 | 2836 | template <class _Tp> |
| 2828 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2837 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2829 | 2838 | __enable_if_t |
| 2830 | 2839 | < |
| 2831 | 2840 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, |
| ... | ... | @@ -2841,7 +2850,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const _Tp & __t, size_type __p |
| 2841 | 2850 | } |
| 2842 | 2851 | |
| 2843 | 2852 | template <class _CharT, class _Traits, class _Allocator> |
| 2844 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2853 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2845 | 2854 | basic_string<_CharT, _Traits, _Allocator>& |
| 2846 | 2855 | basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) |
| 2847 | 2856 | { |
| ... | ... | @@ -2852,7 +2861,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) |
| 2852 | 2861 | // insert |
| 2853 | 2862 | |
| 2854 | 2863 | template <class _CharT, class _Traits, class _Allocator> |
| 2855 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2864 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2856 | 2865 | basic_string<_CharT, _Traits, _Allocator>& |
| 2857 | 2866 | basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n) |
| 2858 | 2867 | { |
| ... | ... | @@ -2892,7 +2901,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t |
| 2892 | 2901 | } |
| 2893 | 2902 | |
| 2894 | 2903 | template <class _CharT, class _Traits, class _Allocator> |
| 2895 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2904 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2896 | 2905 | basic_string<_CharT, _Traits, _Allocator>& |
| 2897 | 2906 | basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c) |
| 2898 | 2907 | { |
| ... | ... | @@ -2925,7 +2934,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n |
| 2925 | 2934 | |
| 2926 | 2935 | template <class _CharT, class _Traits, class _Allocator> |
| 2927 | 2936 | template<class _InputIterator> |
| 2928 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2937 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2929 | 2938 | __enable_if_t |
| 2930 | 2939 | < |
| 2931 | 2940 | __is_exactly_cpp17_input_iterator<_InputIterator>::value, |
| ... | ... | @@ -2942,7 +2951,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIt |
| 2942 | 2951 | |
| 2943 | 2952 | template <class _CharT, class _Traits, class _Allocator> |
| 2944 | 2953 | template<class _ForwardIterator> |
| 2945 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2954 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2946 | 2955 | __enable_if_t |
| 2947 | 2956 | < |
| 2948 | 2957 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| ... | ... | @@ -2970,15 +2979,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward |
| 2970 | 2979 | } |
| 2971 | 2980 | |
| 2972 | 2981 | template <class _CharT, class _Traits, class _Allocator> |
| 2973 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2974 | basic_string<_CharT, _Traits, _Allocator>& | |
| 2975 | basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str) | |
| 2976 | { | |
| 2977 | return insert(__pos1, __str.data(), __str.size()); | |
| 2978 | } | |
| 2979 | ||
| 2980 | template <class _CharT, class _Traits, class _Allocator> | |
| 2981 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2982 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2982 | 2983 | basic_string<_CharT, _Traits, _Allocator>& |
| 2983 | 2984 | basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str, |
| 2984 | 2985 | size_type __pos2, size_type __n) |
| ... | ... | @@ -2991,7 +2992,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_ |
| 2991 | 2992 | |
| 2992 | 2993 | template <class _CharT, class _Traits, class _Allocator> |
| 2993 | 2994 | template <class _Tp> |
| 2994 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2995 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2995 | 2996 | __enable_if_t |
| 2996 | 2997 | < |
| 2997 | 2998 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, |
| ... | ... | @@ -3008,7 +3009,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& _ |
| 3008 | 3009 | } |
| 3009 | 3010 | |
| 3010 | 3011 | template <class _CharT, class _Traits, class _Allocator> |
| 3011 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3012 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3012 | 3013 | basic_string<_CharT, _Traits, _Allocator>& |
| 3013 | 3014 | basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s) |
| 3014 | 3015 | { |
| ... | ... | @@ -3017,7 +3018,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t |
| 3017 | 3018 | } |
| 3018 | 3019 | |
| 3019 | 3020 | template <class _CharT, class _Traits, class _Allocator> |
| 3020 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3021 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3021 | 3022 | typename basic_string<_CharT, _Traits, _Allocator>::iterator |
| 3022 | 3023 | basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c) |
| 3023 | 3024 | { |
| ... | ... | @@ -3047,23 +3048,10 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty |
| 3047 | 3048 | return begin() + static_cast<difference_type>(__ip); |
| 3048 | 3049 | } |
| 3049 | 3050 | |
| 3050 | template <class _CharT, class _Traits, class _Allocator> | |
| 3051 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3052 | typename basic_string<_CharT, _Traits, _Allocator>::iterator | |
| 3053 | basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_type __n, value_type __c) | |
| 3054 | { | |
| 3055 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this, | |
| 3056 | "string::insert(iterator, n, value) called with an iterator not" | |
| 3057 | " referring to this string"); | |
| 3058 | difference_type __p = __pos - begin(); | |
| 3059 | insert(static_cast<size_type>(__p), __n, __c); | |
| 3060 | return begin() + __p; | |
| 3061 | } | |
| 3062 | ||
| 3063 | 3051 | // replace |
| 3064 | 3052 | |
| 3065 | 3053 | template <class _CharT, class _Traits, class _Allocator> |
| 3066 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3054 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3067 | 3055 | basic_string<_CharT, _Traits, _Allocator>& |
| 3068 | 3056 | basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2) |
| 3069 | 3057 | _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| ... | ... | @@ -3117,7 +3105,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __ |
| 3117 | 3105 | } |
| 3118 | 3106 | |
| 3119 | 3107 | template <class _CharT, class _Traits, class _Allocator> |
| 3120 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3108 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3121 | 3109 | basic_string<_CharT, _Traits, _Allocator>& |
| 3122 | 3110 | basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c) |
| 3123 | 3111 | { |
| ... | ... | @@ -3148,7 +3136,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __ |
| 3148 | 3136 | |
| 3149 | 3137 | template <class _CharT, class _Traits, class _Allocator> |
| 3150 | 3138 | template<class _InputIterator> |
| 3151 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3139 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3152 | 3140 | __enable_if_t |
| 3153 | 3141 | < |
| 3154 | 3142 | __is_cpp17_input_iterator<_InputIterator>::value, |
| ... | ... | @@ -3162,15 +3150,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it |
| 3162 | 3150 | } |
| 3163 | 3151 | |
| 3164 | 3152 | template <class _CharT, class _Traits, class _Allocator> |
| 3165 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3166 | basic_string<_CharT, _Traits, _Allocator>& | |
| 3167 | basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str) | |
| 3168 | { | |
| 3169 | return replace(__pos1, __n1, __str.data(), __str.size()); | |
| 3170 | } | |
| 3171 | ||
| 3172 | template <class _CharT, class _Traits, class _Allocator> | |
| 3173 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3153 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3174 | 3154 | basic_string<_CharT, _Traits, _Allocator>& |
| 3175 | 3155 | basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str, |
| 3176 | 3156 | size_type __pos2, size_type __n2) |
| ... | ... | @@ -3183,7 +3163,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _ |
| 3183 | 3163 | |
| 3184 | 3164 | template <class _CharT, class _Traits, class _Allocator> |
| 3185 | 3165 | template <class _Tp> |
| 3186 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3166 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3187 | 3167 | __enable_if_t |
| 3188 | 3168 | < |
| 3189 | 3169 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, |
| ... | ... | @@ -3200,7 +3180,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _ |
| 3200 | 3180 | } |
| 3201 | 3181 | |
| 3202 | 3182 | template <class _CharT, class _Traits, class _Allocator> |
| 3203 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3183 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3204 | 3184 | basic_string<_CharT, _Traits, _Allocator>& |
| 3205 | 3185 | basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s) |
| 3206 | 3186 | { |
| ... | ... | @@ -3208,45 +3188,12 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __ |
| 3208 | 3188 | return replace(__pos, __n1, __s, traits_type::length(__s)); |
| 3209 | 3189 | } |
| 3210 | 3190 | |
| 3211 | template <class _CharT, class _Traits, class _Allocator> | |
| 3212 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3213 | basic_string<_CharT, _Traits, _Allocator>& | |
| 3214 | basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const basic_string& __str) | |
| 3215 | { | |
| 3216 | return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), | |
| 3217 | __str.data(), __str.size()); | |
| 3218 | } | |
| 3219 | ||
| 3220 | template <class _CharT, class _Traits, class _Allocator> | |
| 3221 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3222 | basic_string<_CharT, _Traits, _Allocator>& | |
| 3223 | basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n) | |
| 3224 | { | |
| 3225 | return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n); | |
| 3226 | } | |
| 3227 | ||
| 3228 | template <class _CharT, class _Traits, class _Allocator> | |
| 3229 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3230 | basic_string<_CharT, _Traits, _Allocator>& | |
| 3231 | basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s) | |
| 3232 | { | |
| 3233 | return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s); | |
| 3234 | } | |
| 3235 | ||
| 3236 | template <class _CharT, class _Traits, class _Allocator> | |
| 3237 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3238 | basic_string<_CharT, _Traits, _Allocator>& | |
| 3239 | basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c) | |
| 3240 | { | |
| 3241 | return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c); | |
| 3242 | } | |
| 3243 | ||
| 3244 | 3191 | // erase |
| 3245 | 3192 | |
| 3246 | 3193 | // 'externally instantiated' erase() implementation, called when __n != npos. |
| 3247 | 3194 | // Does not check __pos against size() |
| 3248 | 3195 | template <class _CharT, class _Traits, class _Allocator> |
| 3249 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3196 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3250 | 3197 | void |
| 3251 | 3198 | basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move( |
| 3252 | 3199 | size_type __pos, size_type __n) |
| ... | ... | @@ -3264,7 +3211,7 @@ basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move( |
| 3264 | 3211 | } |
| 3265 | 3212 | |
| 3266 | 3213 | template <class _CharT, class _Traits, class _Allocator> |
| 3267 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3214 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3268 | 3215 | basic_string<_CharT, _Traits, _Allocator>& |
| 3269 | 3216 | basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, |
| 3270 | 3217 | size_type __n) { |
| ... | ... | @@ -3279,7 +3226,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, |
| 3279 | 3226 | } |
| 3280 | 3227 | |
| 3281 | 3228 | template <class _CharT, class _Traits, class _Allocator> |
| 3282 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3229 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3283 | 3230 | typename basic_string<_CharT, _Traits, _Allocator>::iterator |
| 3284 | 3231 | basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos) |
| 3285 | 3232 | { |
| ... | ... | @@ -3295,7 +3242,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos) |
| 3295 | 3242 | } |
| 3296 | 3243 | |
| 3297 | 3244 | template <class _CharT, class _Traits, class _Allocator> |
| 3298 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3245 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3299 | 3246 | typename basic_string<_CharT, _Traits, _Allocator>::iterator |
| 3300 | 3247 | basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last) |
| 3301 | 3248 | { |
| ... | ... | @@ -3311,7 +3258,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_i |
| 3311 | 3258 | } |
| 3312 | 3259 | |
| 3313 | 3260 | template <class _CharT, class _Traits, class _Allocator> |
| 3314 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3261 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3315 | 3262 | void |
| 3316 | 3263 | basic_string<_CharT, _Traits, _Allocator>::pop_back() |
| 3317 | 3264 | { |
| ... | ... | @@ -3320,7 +3267,7 @@ basic_string<_CharT, _Traits, _Allocator>::pop_back() |
| 3320 | 3267 | } |
| 3321 | 3268 | |
| 3322 | 3269 | template <class _CharT, class _Traits, class _Allocator> |
| 3323 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3270 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3324 | 3271 | void |
| 3325 | 3272 | basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT |
| 3326 | 3273 | { |
| ... | ... | @@ -3338,15 +3285,7 @@ basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT |
| 3338 | 3285 | } |
| 3339 | 3286 | |
| 3340 | 3287 | template <class _CharT, class _Traits, class _Allocator> |
| 3341 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3342 | void | |
| 3343 | basic_string<_CharT, _Traits, _Allocator>::__erase_to_end(size_type __pos) | |
| 3344 | { | |
| 3345 | __null_terminate_at(std::__to_address(__get_pointer()), __pos); | |
| 3346 | } | |
| 3347 | ||
| 3348 | template <class _CharT, class _Traits, class _Allocator> | |
| 3349 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3288 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3350 | 3289 | void |
| 3351 | 3290 | basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c) |
| 3352 | 3291 | { |
| ... | ... | @@ -3358,7 +3297,7 @@ basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c) |
| 3358 | 3297 | } |
| 3359 | 3298 | |
| 3360 | 3299 | template <class _CharT, class _Traits, class _Allocator> |
| 3361 | _LIBCPP_CONSTEXPR_AFTER_CXX17 inline void | |
| 3300 | _LIBCPP_CONSTEXPR_SINCE_CXX20 inline void | |
| 3362 | 3301 | basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n) |
| 3363 | 3302 | { |
| 3364 | 3303 | size_type __sz = size(); |
| ... | ... | @@ -3369,21 +3308,7 @@ basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n) |
| 3369 | 3308 | } |
| 3370 | 3309 | |
| 3371 | 3310 | template <class _CharT, class _Traits, class _Allocator> |
| 3372 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3373 | typename basic_string<_CharT, _Traits, _Allocator>::size_type | |
| 3374 | basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT | |
| 3375 | { | |
| 3376 | size_type __m = __alloc_traits::max_size(__alloc()); | |
| 3377 | if (__m <= std::numeric_limits<size_type>::max() / 2) { | |
| 3378 | return __m - __alignment; | |
| 3379 | } else { | |
| 3380 | bool __uses_lsb = __endian_factor == 2; | |
| 3381 | return __uses_lsb ? __m - __alignment : (__m / 2) - __alignment; | |
| 3382 | } | |
| 3383 | } | |
| 3384 | ||
| 3385 | template <class _CharT, class _Traits, class _Allocator> | |
| 3386 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3311 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3387 | 3312 | void |
| 3388 | 3313 | basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity) |
| 3389 | 3314 | { |
| ... | ... | @@ -3404,7 +3329,7 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacit |
| 3404 | 3329 | } |
| 3405 | 3330 | |
| 3406 | 3331 | template <class _CharT, class _Traits, class _Allocator> |
| 3407 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3332 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3408 | 3333 | void |
| 3409 | 3334 | basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT |
| 3410 | 3335 | { |
| ... | ... | @@ -3415,7 +3340,7 @@ basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT |
| 3415 | 3340 | } |
| 3416 | 3341 | |
| 3417 | 3342 | template <class _CharT, class _Traits, class _Allocator> |
| 3418 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3343 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3419 | 3344 | void |
| 3420 | 3345 | basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity) |
| 3421 | 3346 | { |
| ... | ... | @@ -3479,25 +3404,7 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target |
| 3479 | 3404 | } |
| 3480 | 3405 | |
| 3481 | 3406 | template <class _CharT, class _Traits, class _Allocator> |
| 3482 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3483 | typename basic_string<_CharT, _Traits, _Allocator>::const_reference | |
| 3484 | basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) const _NOEXCEPT | |
| 3485 | { | |
| 3486 | _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds"); | |
| 3487 | return *(data() + __pos); | |
| 3488 | } | |
| 3489 | ||
| 3490 | template <class _CharT, class _Traits, class _Allocator> | |
| 3491 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3492 | typename basic_string<_CharT, _Traits, _Allocator>::reference | |
| 3493 | basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) _NOEXCEPT | |
| 3494 | { | |
| 3495 | _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds"); | |
| 3496 | return *(__get_pointer() + __pos); | |
| 3497 | } | |
| 3498 | ||
| 3499 | template <class _CharT, class _Traits, class _Allocator> | |
| 3500 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3407 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3501 | 3408 | typename basic_string<_CharT, _Traits, _Allocator>::const_reference |
| 3502 | 3409 | basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const |
| 3503 | 3410 | { |
| ... | ... | @@ -3507,7 +3414,7 @@ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const |
| 3507 | 3414 | } |
| 3508 | 3415 | |
| 3509 | 3416 | template <class _CharT, class _Traits, class _Allocator> |
| 3510 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3417 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3511 | 3418 | typename basic_string<_CharT, _Traits, _Allocator>::reference |
| 3512 | 3419 | basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) |
| 3513 | 3420 | { |
| ... | ... | @@ -3517,43 +3424,7 @@ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) |
| 3517 | 3424 | } |
| 3518 | 3425 | |
| 3519 | 3426 | template <class _CharT, class _Traits, class _Allocator> |
| 3520 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3521 | typename basic_string<_CharT, _Traits, _Allocator>::reference | |
| 3522 | basic_string<_CharT, _Traits, _Allocator>::front() _NOEXCEPT | |
| 3523 | { | |
| 3524 | _LIBCPP_ASSERT(!empty(), "string::front(): string is empty"); | |
| 3525 | return *__get_pointer(); | |
| 3526 | } | |
| 3527 | ||
| 3528 | template <class _CharT, class _Traits, class _Allocator> | |
| 3529 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3530 | typename basic_string<_CharT, _Traits, _Allocator>::const_reference | |
| 3531 | basic_string<_CharT, _Traits, _Allocator>::front() const _NOEXCEPT | |
| 3532 | { | |
| 3533 | _LIBCPP_ASSERT(!empty(), "string::front(): string is empty"); | |
| 3534 | return *data(); | |
| 3535 | } | |
| 3536 | ||
| 3537 | template <class _CharT, class _Traits, class _Allocator> | |
| 3538 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3539 | typename basic_string<_CharT, _Traits, _Allocator>::reference | |
| 3540 | basic_string<_CharT, _Traits, _Allocator>::back() _NOEXCEPT | |
| 3541 | { | |
| 3542 | _LIBCPP_ASSERT(!empty(), "string::back(): string is empty"); | |
| 3543 | return *(__get_pointer() + size() - 1); | |
| 3544 | } | |
| 3545 | ||
| 3546 | template <class _CharT, class _Traits, class _Allocator> | |
| 3547 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3548 | typename basic_string<_CharT, _Traits, _Allocator>::const_reference | |
| 3549 | basic_string<_CharT, _Traits, _Allocator>::back() const _NOEXCEPT | |
| 3550 | { | |
| 3551 | _LIBCPP_ASSERT(!empty(), "string::back(): string is empty"); | |
| 3552 | return *(data() + size() - 1); | |
| 3553 | } | |
| 3554 | ||
| 3555 | template <class _CharT, class _Traits, class _Allocator> | |
| 3556 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3427 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3557 | 3428 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3558 | 3429 | basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const |
| 3559 | 3430 | { |
| ... | ... | @@ -3566,15 +3437,7 @@ basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, |
| 3566 | 3437 | } |
| 3567 | 3438 | |
| 3568 | 3439 | template <class _CharT, class _Traits, class _Allocator> |
| 3569 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3570 | basic_string<_CharT, _Traits, _Allocator> | |
| 3571 | basic_string<_CharT, _Traits, _Allocator>::substr(size_type __pos, size_type __n) const | |
| 3572 | { | |
| 3573 | return basic_string(*this, __pos, __n, __alloc()); | |
| 3574 | } | |
| 3575 | ||
| 3576 | template <class _CharT, class _Traits, class _Allocator> | |
| 3577 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3440 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3578 | 3441 | void |
| 3579 | 3442 | basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str) |
| 3580 | 3443 | #if _LIBCPP_STD_VER >= 14 |
| ... | ... | @@ -3610,30 +3473,30 @@ struct _LIBCPP_HIDDEN __traits_eq |
| 3610 | 3473 | }; |
| 3611 | 3474 | |
| 3612 | 3475 | template<class _CharT, class _Traits, class _Allocator> |
| 3613 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3476 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3614 | 3477 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3615 | 3478 | basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, |
| 3616 | 3479 | size_type __pos, |
| 3617 | 3480 | size_type __n) const _NOEXCEPT |
| 3618 | 3481 | { |
| 3619 | 3482 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr"); |
| 3620 | return __str_find<value_type, size_type, traits_type, npos> | |
| 3483 | return std::__str_find<value_type, size_type, traits_type, npos> | |
| 3621 | 3484 | (data(), size(), __s, __pos, __n); |
| 3622 | 3485 | } |
| 3623 | 3486 | |
| 3624 | 3487 | template<class _CharT, class _Traits, class _Allocator> |
| 3625 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3488 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3626 | 3489 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3627 | 3490 | basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str, |
| 3628 | 3491 | size_type __pos) const _NOEXCEPT |
| 3629 | 3492 | { |
| 3630 | return __str_find<value_type, size_type, traits_type, npos> | |
| 3493 | return std::__str_find<value_type, size_type, traits_type, npos> | |
| 3631 | 3494 | (data(), size(), __str.data(), __pos, __str.size()); |
| 3632 | 3495 | } |
| 3633 | 3496 | |
| 3634 | 3497 | template<class _CharT, class _Traits, class _Allocator> |
| 3635 | 3498 | template <class _Tp> |
| 3636 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3499 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3637 | 3500 | __enable_if_t |
| 3638 | 3501 | < |
| 3639 | 3502 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -3643,58 +3506,58 @@ basic_string<_CharT, _Traits, _Allocator>::find(const _Tp &__t, |
| 3643 | 3506 | size_type __pos) const _NOEXCEPT |
| 3644 | 3507 | { |
| 3645 | 3508 | __self_view __sv = __t; |
| 3646 | return __str_find<value_type, size_type, traits_type, npos> | |
| 3509 | return std::__str_find<value_type, size_type, traits_type, npos> | |
| 3647 | 3510 | (data(), size(), __sv.data(), __pos, __sv.size()); |
| 3648 | 3511 | } |
| 3649 | 3512 | |
| 3650 | 3513 | template<class _CharT, class _Traits, class _Allocator> |
| 3651 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3514 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3652 | 3515 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3653 | 3516 | basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, |
| 3654 | 3517 | size_type __pos) const _NOEXCEPT |
| 3655 | 3518 | { |
| 3656 | 3519 | _LIBCPP_ASSERT(__s != nullptr, "string::find(): received nullptr"); |
| 3657 | return __str_find<value_type, size_type, traits_type, npos> | |
| 3520 | return std::__str_find<value_type, size_type, traits_type, npos> | |
| 3658 | 3521 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 3659 | 3522 | } |
| 3660 | 3523 | |
| 3661 | 3524 | template<class _CharT, class _Traits, class _Allocator> |
| 3662 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3525 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3663 | 3526 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3664 | 3527 | basic_string<_CharT, _Traits, _Allocator>::find(value_type __c, |
| 3665 | 3528 | size_type __pos) const _NOEXCEPT |
| 3666 | 3529 | { |
| 3667 | return __str_find<value_type, size_type, traits_type, npos> | |
| 3530 | return std::__str_find<value_type, size_type, traits_type, npos> | |
| 3668 | 3531 | (data(), size(), __c, __pos); |
| 3669 | 3532 | } |
| 3670 | 3533 | |
| 3671 | 3534 | // rfind |
| 3672 | 3535 | |
| 3673 | 3536 | template<class _CharT, class _Traits, class _Allocator> |
| 3674 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3537 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3675 | 3538 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3676 | 3539 | basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, |
| 3677 | 3540 | size_type __pos, |
| 3678 | 3541 | size_type __n) const _NOEXCEPT |
| 3679 | 3542 | { |
| 3680 | 3543 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr"); |
| 3681 | return __str_rfind<value_type, size_type, traits_type, npos> | |
| 3544 | return std::__str_rfind<value_type, size_type, traits_type, npos> | |
| 3682 | 3545 | (data(), size(), __s, __pos, __n); |
| 3683 | 3546 | } |
| 3684 | 3547 | |
| 3685 | 3548 | template<class _CharT, class _Traits, class _Allocator> |
| 3686 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3549 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3687 | 3550 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3688 | 3551 | basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str, |
| 3689 | 3552 | size_type __pos) const _NOEXCEPT |
| 3690 | 3553 | { |
| 3691 | return __str_rfind<value_type, size_type, traits_type, npos> | |
| 3554 | return std::__str_rfind<value_type, size_type, traits_type, npos> | |
| 3692 | 3555 | (data(), size(), __str.data(), __pos, __str.size()); |
| 3693 | 3556 | } |
| 3694 | 3557 | |
| 3695 | 3558 | template<class _CharT, class _Traits, class _Allocator> |
| 3696 | 3559 | template <class _Tp> |
| 3697 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3560 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3698 | 3561 | __enable_if_t |
| 3699 | 3562 | < |
| 3700 | 3563 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -3704,58 +3567,58 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t, |
| 3704 | 3567 | size_type __pos) const _NOEXCEPT |
| 3705 | 3568 | { |
| 3706 | 3569 | __self_view __sv = __t; |
| 3707 | return __str_rfind<value_type, size_type, traits_type, npos> | |
| 3570 | return std::__str_rfind<value_type, size_type, traits_type, npos> | |
| 3708 | 3571 | (data(), size(), __sv.data(), __pos, __sv.size()); |
| 3709 | 3572 | } |
| 3710 | 3573 | |
| 3711 | 3574 | template<class _CharT, class _Traits, class _Allocator> |
| 3712 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3575 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3713 | 3576 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3714 | 3577 | basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, |
| 3715 | 3578 | size_type __pos) const _NOEXCEPT |
| 3716 | 3579 | { |
| 3717 | 3580 | _LIBCPP_ASSERT(__s != nullptr, "string::rfind(): received nullptr"); |
| 3718 | return __str_rfind<value_type, size_type, traits_type, npos> | |
| 3581 | return std::__str_rfind<value_type, size_type, traits_type, npos> | |
| 3719 | 3582 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 3720 | 3583 | } |
| 3721 | 3584 | |
| 3722 | 3585 | template<class _CharT, class _Traits, class _Allocator> |
| 3723 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3586 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3724 | 3587 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3725 | 3588 | basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c, |
| 3726 | 3589 | size_type __pos) const _NOEXCEPT |
| 3727 | 3590 | { |
| 3728 | return __str_rfind<value_type, size_type, traits_type, npos> | |
| 3591 | return std::__str_rfind<value_type, size_type, traits_type, npos> | |
| 3729 | 3592 | (data(), size(), __c, __pos); |
| 3730 | 3593 | } |
| 3731 | 3594 | |
| 3732 | 3595 | // find_first_of |
| 3733 | 3596 | |
| 3734 | 3597 | template<class _CharT, class _Traits, class _Allocator> |
| 3735 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3598 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3736 | 3599 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3737 | 3600 | basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, |
| 3738 | 3601 | size_type __pos, |
| 3739 | 3602 | size_type __n) const _NOEXCEPT |
| 3740 | 3603 | { |
| 3741 | 3604 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr"); |
| 3742 | return __str_find_first_of<value_type, size_type, traits_type, npos> | |
| 3605 | return std::__str_find_first_of<value_type, size_type, traits_type, npos> | |
| 3743 | 3606 | (data(), size(), __s, __pos, __n); |
| 3744 | 3607 | } |
| 3745 | 3608 | |
| 3746 | 3609 | template<class _CharT, class _Traits, class _Allocator> |
| 3747 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3610 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3748 | 3611 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3749 | 3612 | basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str, |
| 3750 | 3613 | size_type __pos) const _NOEXCEPT |
| 3751 | 3614 | { |
| 3752 | return __str_find_first_of<value_type, size_type, traits_type, npos> | |
| 3615 | return std::__str_find_first_of<value_type, size_type, traits_type, npos> | |
| 3753 | 3616 | (data(), size(), __str.data(), __pos, __str.size()); |
| 3754 | 3617 | } |
| 3755 | 3618 | |
| 3756 | 3619 | template<class _CharT, class _Traits, class _Allocator> |
| 3757 | 3620 | template <class _Tp> |
| 3758 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3621 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3759 | 3622 | __enable_if_t |
| 3760 | 3623 | < |
| 3761 | 3624 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -3765,23 +3628,23 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t, |
| 3765 | 3628 | size_type __pos) const _NOEXCEPT |
| 3766 | 3629 | { |
| 3767 | 3630 | __self_view __sv = __t; |
| 3768 | return __str_find_first_of<value_type, size_type, traits_type, npos> | |
| 3631 | return std::__str_find_first_of<value_type, size_type, traits_type, npos> | |
| 3769 | 3632 | (data(), size(), __sv.data(), __pos, __sv.size()); |
| 3770 | 3633 | } |
| 3771 | 3634 | |
| 3772 | 3635 | template<class _CharT, class _Traits, class _Allocator> |
| 3773 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3636 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3774 | 3637 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3775 | 3638 | basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, |
| 3776 | 3639 | size_type __pos) const _NOEXCEPT |
| 3777 | 3640 | { |
| 3778 | 3641 | _LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): received nullptr"); |
| 3779 | return __str_find_first_of<value_type, size_type, traits_type, npos> | |
| 3642 | return std::__str_find_first_of<value_type, size_type, traits_type, npos> | |
| 3780 | 3643 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 3781 | 3644 | } |
| 3782 | 3645 | |
| 3783 | 3646 | template<class _CharT, class _Traits, class _Allocator> |
| 3784 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3647 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3785 | 3648 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3786 | 3649 | basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c, |
| 3787 | 3650 | size_type __pos) const _NOEXCEPT |
| ... | ... | @@ -3792,30 +3655,30 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c, |
| 3792 | 3655 | // find_last_of |
| 3793 | 3656 | |
| 3794 | 3657 | template<class _CharT, class _Traits, class _Allocator> |
| 3795 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3658 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3796 | 3659 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3797 | 3660 | basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, |
| 3798 | 3661 | size_type __pos, |
| 3799 | 3662 | size_type __n) const _NOEXCEPT |
| 3800 | 3663 | { |
| 3801 | 3664 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr"); |
| 3802 | return __str_find_last_of<value_type, size_type, traits_type, npos> | |
| 3665 | return std::__str_find_last_of<value_type, size_type, traits_type, npos> | |
| 3803 | 3666 | (data(), size(), __s, __pos, __n); |
| 3804 | 3667 | } |
| 3805 | 3668 | |
| 3806 | 3669 | template<class _CharT, class _Traits, class _Allocator> |
| 3807 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3670 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3808 | 3671 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3809 | 3672 | basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str, |
| 3810 | 3673 | size_type __pos) const _NOEXCEPT |
| 3811 | 3674 | { |
| 3812 | return __str_find_last_of<value_type, size_type, traits_type, npos> | |
| 3675 | return std::__str_find_last_of<value_type, size_type, traits_type, npos> | |
| 3813 | 3676 | (data(), size(), __str.data(), __pos, __str.size()); |
| 3814 | 3677 | } |
| 3815 | 3678 | |
| 3816 | 3679 | template<class _CharT, class _Traits, class _Allocator> |
| 3817 | 3680 | template <class _Tp> |
| 3818 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3681 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3819 | 3682 | __enable_if_t |
| 3820 | 3683 | < |
| 3821 | 3684 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -3825,23 +3688,23 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t, |
| 3825 | 3688 | size_type __pos) const _NOEXCEPT |
| 3826 | 3689 | { |
| 3827 | 3690 | __self_view __sv = __t; |
| 3828 | return __str_find_last_of<value_type, size_type, traits_type, npos> | |
| 3691 | return std::__str_find_last_of<value_type, size_type, traits_type, npos> | |
| 3829 | 3692 | (data(), size(), __sv.data(), __pos, __sv.size()); |
| 3830 | 3693 | } |
| 3831 | 3694 | |
| 3832 | 3695 | template<class _CharT, class _Traits, class _Allocator> |
| 3833 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3696 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3834 | 3697 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3835 | 3698 | basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, |
| 3836 | 3699 | size_type __pos) const _NOEXCEPT |
| 3837 | 3700 | { |
| 3838 | 3701 | _LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): received nullptr"); |
| 3839 | return __str_find_last_of<value_type, size_type, traits_type, npos> | |
| 3702 | return std::__str_find_last_of<value_type, size_type, traits_type, npos> | |
| 3840 | 3703 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 3841 | 3704 | } |
| 3842 | 3705 | |
| 3843 | 3706 | template<class _CharT, class _Traits, class _Allocator> |
| 3844 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3707 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3845 | 3708 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3846 | 3709 | basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c, |
| 3847 | 3710 | size_type __pos) const _NOEXCEPT |
| ... | ... | @@ -3852,30 +3715,30 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c, |
| 3852 | 3715 | // find_first_not_of |
| 3853 | 3716 | |
| 3854 | 3717 | template<class _CharT, class _Traits, class _Allocator> |
| 3855 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3718 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3856 | 3719 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3857 | 3720 | basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s, |
| 3858 | 3721 | size_type __pos, |
| 3859 | 3722 | size_type __n) const _NOEXCEPT |
| 3860 | 3723 | { |
| 3861 | 3724 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr"); |
| 3862 | return __str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 3725 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 3863 | 3726 | (data(), size(), __s, __pos, __n); |
| 3864 | 3727 | } |
| 3865 | 3728 | |
| 3866 | 3729 | template<class _CharT, class _Traits, class _Allocator> |
| 3867 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3730 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3868 | 3731 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3869 | 3732 | basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str, |
| 3870 | 3733 | size_type __pos) const _NOEXCEPT |
| 3871 | 3734 | { |
| 3872 | return __str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 3735 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 3873 | 3736 | (data(), size(), __str.data(), __pos, __str.size()); |
| 3874 | 3737 | } |
| 3875 | 3738 | |
| 3876 | 3739 | template<class _CharT, class _Traits, class _Allocator> |
| 3877 | 3740 | template <class _Tp> |
| 3878 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3741 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3879 | 3742 | __enable_if_t |
| 3880 | 3743 | < |
| 3881 | 3744 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -3885,58 +3748,58 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t, |
| 3885 | 3748 | size_type __pos) const _NOEXCEPT |
| 3886 | 3749 | { |
| 3887 | 3750 | __self_view __sv = __t; |
| 3888 | return __str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 3751 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 3889 | 3752 | (data(), size(), __sv.data(), __pos, __sv.size()); |
| 3890 | 3753 | } |
| 3891 | 3754 | |
| 3892 | 3755 | template<class _CharT, class _Traits, class _Allocator> |
| 3893 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3756 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3894 | 3757 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3895 | 3758 | basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s, |
| 3896 | 3759 | size_type __pos) const _NOEXCEPT |
| 3897 | 3760 | { |
| 3898 | 3761 | _LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): received nullptr"); |
| 3899 | return __str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 3762 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 3900 | 3763 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 3901 | 3764 | } |
| 3902 | 3765 | |
| 3903 | 3766 | template<class _CharT, class _Traits, class _Allocator> |
| 3904 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3767 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3905 | 3768 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3906 | 3769 | basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c, |
| 3907 | 3770 | size_type __pos) const _NOEXCEPT |
| 3908 | 3771 | { |
| 3909 | return __str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 3772 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 3910 | 3773 | (data(), size(), __c, __pos); |
| 3911 | 3774 | } |
| 3912 | 3775 | |
| 3913 | 3776 | // find_last_not_of |
| 3914 | 3777 | |
| 3915 | 3778 | template<class _CharT, class _Traits, class _Allocator> |
| 3916 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3779 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3917 | 3780 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3918 | 3781 | basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s, |
| 3919 | 3782 | size_type __pos, |
| 3920 | 3783 | size_type __n) const _NOEXCEPT |
| 3921 | 3784 | { |
| 3922 | 3785 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr"); |
| 3923 | return __str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 3786 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 3924 | 3787 | (data(), size(), __s, __pos, __n); |
| 3925 | 3788 | } |
| 3926 | 3789 | |
| 3927 | 3790 | template<class _CharT, class _Traits, class _Allocator> |
| 3928 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3791 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3929 | 3792 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3930 | 3793 | basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str, |
| 3931 | 3794 | size_type __pos) const _NOEXCEPT |
| 3932 | 3795 | { |
| 3933 | return __str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 3796 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 3934 | 3797 | (data(), size(), __str.data(), __pos, __str.size()); |
| 3935 | 3798 | } |
| 3936 | 3799 | |
| 3937 | 3800 | template<class _CharT, class _Traits, class _Allocator> |
| 3938 | 3801 | template <class _Tp> |
| 3939 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3802 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3940 | 3803 | __enable_if_t |
| 3941 | 3804 | < |
| 3942 | 3805 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -3946,28 +3809,28 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t, |
| 3946 | 3809 | size_type __pos) const _NOEXCEPT |
| 3947 | 3810 | { |
| 3948 | 3811 | __self_view __sv = __t; |
| 3949 | return __str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 3812 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 3950 | 3813 | (data(), size(), __sv.data(), __pos, __sv.size()); |
| 3951 | 3814 | } |
| 3952 | 3815 | |
| 3953 | 3816 | template<class _CharT, class _Traits, class _Allocator> |
| 3954 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3817 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3955 | 3818 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3956 | 3819 | basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s, |
| 3957 | 3820 | size_type __pos) const _NOEXCEPT |
| 3958 | 3821 | { |
| 3959 | 3822 | _LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): received nullptr"); |
| 3960 | return __str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 3823 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 3961 | 3824 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 3962 | 3825 | } |
| 3963 | 3826 | |
| 3964 | 3827 | template<class _CharT, class _Traits, class _Allocator> |
| 3965 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3828 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3966 | 3829 | typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 3967 | 3830 | basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c, |
| 3968 | 3831 | size_type __pos) const _NOEXCEPT |
| 3969 | 3832 | { |
| 3970 | return __str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 3833 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 3971 | 3834 | (data(), size(), __c, __pos); |
| 3972 | 3835 | } |
| 3973 | 3836 | |
| ... | ... | @@ -3975,7 +3838,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c, |
| 3975 | 3838 | |
| 3976 | 3839 | template <class _CharT, class _Traits, class _Allocator> |
| 3977 | 3840 | template <class _Tp> |
| 3978 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3841 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3979 | 3842 | __enable_if_t |
| 3980 | 3843 | < |
| 3981 | 3844 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -3998,7 +3861,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const _NOEXCE |
| 3998 | 3861 | } |
| 3999 | 3862 | |
| 4000 | 3863 | template <class _CharT, class _Traits, class _Allocator> |
| 4001 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3864 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4002 | 3865 | int |
| 4003 | 3866 | basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT |
| 4004 | 3867 | { |
| ... | ... | @@ -4006,7 +3869,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) co |
| 4006 | 3869 | } |
| 4007 | 3870 | |
| 4008 | 3871 | template <class _CharT, class _Traits, class _Allocator> |
| 4009 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3872 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4010 | 3873 | int |
| 4011 | 3874 | basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, |
| 4012 | 3875 | size_type __n1, |
| ... | ... | @@ -4031,7 +3894,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, |
| 4031 | 3894 | |
| 4032 | 3895 | template <class _CharT, class _Traits, class _Allocator> |
| 4033 | 3896 | template <class _Tp> |
| 4034 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3897 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4035 | 3898 | __enable_if_t |
| 4036 | 3899 | < |
| 4037 | 3900 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, |
| ... | ... | @@ -4046,7 +3909,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, |
| 4046 | 3909 | } |
| 4047 | 3910 | |
| 4048 | 3911 | template <class _CharT, class _Traits, class _Allocator> |
| 4049 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3912 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4050 | 3913 | int |
| 4051 | 3914 | basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, |
| 4052 | 3915 | size_type __n1, |
| ... | ... | @@ -4057,7 +3920,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, |
| 4057 | 3920 | |
| 4058 | 3921 | template <class _CharT, class _Traits, class _Allocator> |
| 4059 | 3922 | template <class _Tp> |
| 4060 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3923 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4061 | 3924 | __enable_if_t |
| 4062 | 3925 | < |
| 4063 | 3926 | __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value |
| ... | ... | @@ -4075,7 +3938,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, |
| 4075 | 3938 | } |
| 4076 | 3939 | |
| 4077 | 3940 | template <class _CharT, class _Traits, class _Allocator> |
| 4078 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3941 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4079 | 3942 | int |
| 4080 | 3943 | basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, |
| 4081 | 3944 | size_type __n1, |
| ... | ... | @@ -4087,7 +3950,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, |
| 4087 | 3950 | } |
| 4088 | 3951 | |
| 4089 | 3952 | template <class _CharT, class _Traits, class _Allocator> |
| 4090 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3953 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4091 | 3954 | int |
| 4092 | 3955 | basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT |
| 4093 | 3956 | { |
| ... | ... | @@ -4096,7 +3959,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const |
| 4096 | 3959 | } |
| 4097 | 3960 | |
| 4098 | 3961 | template <class _CharT, class _Traits, class _Allocator> |
| 4099 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3962 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4100 | 3963 | int |
| 4101 | 3964 | basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, |
| 4102 | 3965 | size_type __n1, |
| ... | ... | @@ -4109,7 +3972,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, |
| 4109 | 3972 | // __invariants |
| 4110 | 3973 | |
| 4111 | 3974 | template<class _CharT, class _Traits, class _Allocator> |
| 4112 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3975 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4113 | 3976 | bool |
| 4114 | 3977 | basic_string<_CharT, _Traits, _Allocator>::__invariants() const |
| 4115 | 3978 | { |
| ... | ... | @@ -4127,7 +3990,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const |
| 4127 | 3990 | // __clear_and_shrink |
| 4128 | 3991 | |
| 4129 | 3992 | template<class _CharT, class _Traits, class _Allocator> |
| 4130 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3993 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4131 | 3994 | void |
| 4132 | 3995 | basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT |
| 4133 | 3996 | { |
| ... | ... | @@ -4135,28 +3998,30 @@ basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT |
| 4135 | 3998 | if(__is_long()) |
| 4136 | 3999 | { |
| 4137 | 4000 | __alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1); |
| 4138 | __set_long_cap(0); | |
| 4139 | __set_short_size(0); | |
| 4140 | traits_type::assign(*__get_short_pointer(), value_type()); | |
| 4001 | __default_init(); | |
| 4141 | 4002 | } |
| 4142 | 4003 | } |
| 4143 | 4004 | |
| 4144 | 4005 | // operator== |
| 4145 | 4006 | |
| 4146 | 4007 | template<class _CharT, class _Traits, class _Allocator> |
| 4147 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4008 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 4148 | 4009 | bool |
| 4149 | 4010 | operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4150 | 4011 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| 4151 | 4012 | { |
| 4013 | #if _LIBCPP_STD_VER > 17 | |
| 4014 | return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs); | |
| 4015 | #else | |
| 4152 | 4016 | size_t __lhs_sz = __lhs.size(); |
| 4153 | 4017 | return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(), |
| 4154 | 4018 | __rhs.data(), |
| 4155 | 4019 | __lhs_sz) == 0; |
| 4020 | #endif | |
| 4156 | 4021 | } |
| 4157 | 4022 | |
| 4158 | 4023 | template<class _Allocator> |
| 4159 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4024 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 4160 | 4025 | bool |
| 4161 | 4026 | operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs, |
| 4162 | 4027 | const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT |
| ... | ... | @@ -4174,8 +4039,9 @@ operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs, |
| 4174 | 4039 | return true; |
| 4175 | 4040 | } |
| 4176 | 4041 | |
| 4042 | #if _LIBCPP_STD_VER <= 17 | |
| 4177 | 4043 | template<class _CharT, class _Traits, class _Allocator> |
| 4178 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4044 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4179 | 4045 | bool |
| 4180 | 4046 | operator==(const _CharT* __lhs, |
| 4181 | 4047 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| ... | ... | @@ -4186,22 +4052,44 @@ operator==(const _CharT* __lhs, |
| 4186 | 4052 | if (__lhs_len != __rhs.size()) return false; |
| 4187 | 4053 | return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0; |
| 4188 | 4054 | } |
| 4055 | #endif // _LIBCPP_STD_VER <= 17 | |
| 4189 | 4056 | |
| 4190 | 4057 | template<class _CharT, class _Traits, class _Allocator> |
| 4191 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4058 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 4192 | 4059 | bool |
| 4193 | 4060 | operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, |
| 4194 | 4061 | const _CharT* __rhs) _NOEXCEPT |
| 4195 | 4062 | { |
| 4063 | #if _LIBCPP_STD_VER > 17 | |
| 4064 | return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs); | |
| 4065 | #else | |
| 4196 | 4066 | typedef basic_string<_CharT, _Traits, _Allocator> _String; |
| 4197 | 4067 | _LIBCPP_ASSERT(__rhs != nullptr, "operator==(basic_string, char*): received nullptr"); |
| 4198 | 4068 | size_t __rhs_len = _Traits::length(__rhs); |
| 4199 | 4069 | if (__rhs_len != __lhs.size()) return false; |
| 4200 | 4070 | return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0; |
| 4071 | #endif | |
| 4201 | 4072 | } |
| 4202 | 4073 | |
| 4074 | #if _LIBCPP_STD_VER > 17 | |
| 4075 | ||
| 4076 | template <class _CharT, class _Traits, class _Allocator> | |
| 4077 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>( | |
| 4078 | const basic_string<_CharT, _Traits, _Allocator>& __lhs, | |
| 4079 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { | |
| 4080 | return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs); | |
| 4081 | } | |
| 4082 | ||
| 4083 | template <class _CharT, class _Traits, class _Allocator> | |
| 4084 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 4085 | operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) { | |
| 4086 | return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs); | |
| 4087 | } | |
| 4088 | ||
| 4089 | #else // _LIBCPP_STD_VER > 17 | |
| 4090 | ||
| 4203 | 4091 | template<class _CharT, class _Traits, class _Allocator> |
| 4204 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4092 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4205 | 4093 | bool |
| 4206 | 4094 | operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, |
| 4207 | 4095 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| ... | ... | @@ -4210,7 +4098,7 @@ operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, |
| 4210 | 4098 | } |
| 4211 | 4099 | |
| 4212 | 4100 | template<class _CharT, class _Traits, class _Allocator> |
| 4213 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4101 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4214 | 4102 | bool |
| 4215 | 4103 | operator!=(const _CharT* __lhs, |
| 4216 | 4104 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| ... | ... | @@ -4219,7 +4107,7 @@ operator!=(const _CharT* __lhs, |
| 4219 | 4107 | } |
| 4220 | 4108 | |
| 4221 | 4109 | template<class _CharT, class _Traits, class _Allocator> |
| 4222 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4110 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4223 | 4111 | bool |
| 4224 | 4112 | operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4225 | 4113 | const _CharT* __rhs) _NOEXCEPT |
| ... | ... | @@ -4230,7 +4118,7 @@ operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4230 | 4118 | // operator< |
| 4231 | 4119 | |
| 4232 | 4120 | template<class _CharT, class _Traits, class _Allocator> |
| 4233 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4121 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4234 | 4122 | bool |
| 4235 | 4123 | operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4236 | 4124 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| ... | ... | @@ -4239,7 +4127,7 @@ operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4239 | 4127 | } |
| 4240 | 4128 | |
| 4241 | 4129 | template<class _CharT, class _Traits, class _Allocator> |
| 4242 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4130 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4243 | 4131 | bool |
| 4244 | 4132 | operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4245 | 4133 | const _CharT* __rhs) _NOEXCEPT |
| ... | ... | @@ -4248,7 +4136,7 @@ operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4248 | 4136 | } |
| 4249 | 4137 | |
| 4250 | 4138 | template<class _CharT, class _Traits, class _Allocator> |
| 4251 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4139 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4252 | 4140 | bool |
| 4253 | 4141 | operator< (const _CharT* __lhs, |
| 4254 | 4142 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| ... | ... | @@ -4259,7 +4147,7 @@ operator< (const _CharT* __lhs, |
| 4259 | 4147 | // operator> |
| 4260 | 4148 | |
| 4261 | 4149 | template<class _CharT, class _Traits, class _Allocator> |
| 4262 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4150 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4263 | 4151 | bool |
| 4264 | 4152 | operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4265 | 4153 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| ... | ... | @@ -4268,7 +4156,7 @@ operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4268 | 4156 | } |
| 4269 | 4157 | |
| 4270 | 4158 | template<class _CharT, class _Traits, class _Allocator> |
| 4271 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4159 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4272 | 4160 | bool |
| 4273 | 4161 | operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4274 | 4162 | const _CharT* __rhs) _NOEXCEPT |
| ... | ... | @@ -4277,7 +4165,7 @@ operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4277 | 4165 | } |
| 4278 | 4166 | |
| 4279 | 4167 | template<class _CharT, class _Traits, class _Allocator> |
| 4280 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4168 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4281 | 4169 | bool |
| 4282 | 4170 | operator> (const _CharT* __lhs, |
| 4283 | 4171 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| ... | ... | @@ -4288,7 +4176,7 @@ operator> (const _CharT* __lhs, |
| 4288 | 4176 | // operator<= |
| 4289 | 4177 | |
| 4290 | 4178 | template<class _CharT, class _Traits, class _Allocator> |
| 4291 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4179 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4292 | 4180 | bool |
| 4293 | 4181 | operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4294 | 4182 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| ... | ... | @@ -4297,7 +4185,7 @@ operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4297 | 4185 | } |
| 4298 | 4186 | |
| 4299 | 4187 | template<class _CharT, class _Traits, class _Allocator> |
| 4300 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4188 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4301 | 4189 | bool |
| 4302 | 4190 | operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4303 | 4191 | const _CharT* __rhs) _NOEXCEPT |
| ... | ... | @@ -4306,7 +4194,7 @@ operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4306 | 4194 | } |
| 4307 | 4195 | |
| 4308 | 4196 | template<class _CharT, class _Traits, class _Allocator> |
| 4309 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4197 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4310 | 4198 | bool |
| 4311 | 4199 | operator<=(const _CharT* __lhs, |
| 4312 | 4200 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| ... | ... | @@ -4317,7 +4205,7 @@ operator<=(const _CharT* __lhs, |
| 4317 | 4205 | // operator>= |
| 4318 | 4206 | |
| 4319 | 4207 | template<class _CharT, class _Traits, class _Allocator> |
| 4320 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4208 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4321 | 4209 | bool |
| 4322 | 4210 | operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4323 | 4211 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| ... | ... | @@ -4326,7 +4214,7 @@ operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4326 | 4214 | } |
| 4327 | 4215 | |
| 4328 | 4216 | template<class _CharT, class _Traits, class _Allocator> |
| 4329 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4217 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4330 | 4218 | bool |
| 4331 | 4219 | operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4332 | 4220 | const _CharT* __rhs) _NOEXCEPT |
| ... | ... | @@ -4335,18 +4223,19 @@ operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4335 | 4223 | } |
| 4336 | 4224 | |
| 4337 | 4225 | template<class _CharT, class _Traits, class _Allocator> |
| 4338 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI | |
| 4226 | inline _LIBCPP_HIDE_FROM_ABI | |
| 4339 | 4227 | bool |
| 4340 | 4228 | operator>=(const _CharT* __lhs, |
| 4341 | 4229 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT |
| 4342 | 4230 | { |
| 4343 | 4231 | return !(__lhs < __rhs); |
| 4344 | 4232 | } |
| 4233 | #endif // _LIBCPP_STD_VER > 17 | |
| 4345 | 4234 | |
| 4346 | 4235 | // operator + |
| 4347 | 4236 | |
| 4348 | 4237 | template<class _CharT, class _Traits, class _Allocator> |
| 4349 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4238 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4350 | 4239 | basic_string<_CharT, _Traits, _Allocator> |
| 4351 | 4240 | operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4352 | 4241 | const basic_string<_CharT, _Traits, _Allocator>& __rhs) |
| ... | ... | @@ -4365,7 +4254,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4365 | 4254 | } |
| 4366 | 4255 | |
| 4367 | 4256 | template<class _CharT, class _Traits, class _Allocator> |
| 4368 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4257 | _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4369 | 4258 | basic_string<_CharT, _Traits, _Allocator> |
| 4370 | 4259 | operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs) |
| 4371 | 4260 | { |
| ... | ... | @@ -4383,7 +4272,7 @@ operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& _ |
| 4383 | 4272 | } |
| 4384 | 4273 | |
| 4385 | 4274 | template<class _CharT, class _Traits, class _Allocator> |
| 4386 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4275 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4387 | 4276 | basic_string<_CharT, _Traits, _Allocator> |
| 4388 | 4277 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) |
| 4389 | 4278 | { |
| ... | ... | @@ -4400,7 +4289,7 @@ operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) |
| 4400 | 4289 | } |
| 4401 | 4290 | |
| 4402 | 4291 | template<class _CharT, class _Traits, class _Allocator> |
| 4403 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4292 | inline _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4404 | 4293 | basic_string<_CharT, _Traits, _Allocator> |
| 4405 | 4294 | operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) |
| 4406 | 4295 | { |
| ... | ... | @@ -4418,7 +4307,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* |
| 4418 | 4307 | } |
| 4419 | 4308 | |
| 4420 | 4309 | template<class _CharT, class _Traits, class _Allocator> |
| 4421 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4310 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4422 | 4311 | basic_string<_CharT, _Traits, _Allocator> |
| 4423 | 4312 | operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs) |
| 4424 | 4313 | { |
| ... | ... | @@ -4437,7 +4326,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs) |
| 4437 | 4326 | #ifndef _LIBCPP_CXX03_LANG |
| 4438 | 4327 | |
| 4439 | 4328 | template<class _CharT, class _Traits, class _Allocator> |
| 4440 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4329 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4441 | 4330 | basic_string<_CharT, _Traits, _Allocator> |
| 4442 | 4331 | operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) |
| 4443 | 4332 | { |
| ... | ... | @@ -4445,7 +4334,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string< |
| 4445 | 4334 | } |
| 4446 | 4335 | |
| 4447 | 4336 | template<class _CharT, class _Traits, class _Allocator> |
| 4448 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4337 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4449 | 4338 | basic_string<_CharT, _Traits, _Allocator> |
| 4450 | 4339 | operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) |
| 4451 | 4340 | { |
| ... | ... | @@ -4453,7 +4342,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_ |
| 4453 | 4342 | } |
| 4454 | 4343 | |
| 4455 | 4344 | template<class _CharT, class _Traits, class _Allocator> |
| 4456 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4345 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4457 | 4346 | basic_string<_CharT, _Traits, _Allocator> |
| 4458 | 4347 | operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) |
| 4459 | 4348 | { |
| ... | ... | @@ -4461,7 +4350,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT |
| 4461 | 4350 | } |
| 4462 | 4351 | |
| 4463 | 4352 | template<class _CharT, class _Traits, class _Allocator> |
| 4464 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4353 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4465 | 4354 | basic_string<_CharT, _Traits, _Allocator> |
| 4466 | 4355 | operator+(const _CharT* __lhs , basic_string<_CharT,_Traits,_Allocator>&& __rhs) |
| 4467 | 4356 | { |
| ... | ... | @@ -4469,7 +4358,7 @@ operator+(const _CharT* __lhs , basic_string<_CharT,_Traits,_Allocator>&& __rhs) |
| 4469 | 4358 | } |
| 4470 | 4359 | |
| 4471 | 4360 | template<class _CharT, class _Traits, class _Allocator> |
| 4472 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4361 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4473 | 4362 | basic_string<_CharT, _Traits, _Allocator> |
| 4474 | 4363 | operator+(_CharT __lhs, basic_string<_CharT,_Traits,_Allocator>&& __rhs) |
| 4475 | 4364 | { |
| ... | ... | @@ -4478,7 +4367,7 @@ operator+(_CharT __lhs, basic_string<_CharT,_Traits,_Allocator>&& __rhs) |
| 4478 | 4367 | } |
| 4479 | 4368 | |
| 4480 | 4369 | template<class _CharT, class _Traits, class _Allocator> |
| 4481 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4370 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4482 | 4371 | basic_string<_CharT, _Traits, _Allocator> |
| 4483 | 4372 | operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs) |
| 4484 | 4373 | { |
| ... | ... | @@ -4486,7 +4375,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs |
| 4486 | 4375 | } |
| 4487 | 4376 | |
| 4488 | 4377 | template<class _CharT, class _Traits, class _Allocator> |
| 4489 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4378 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4490 | 4379 | basic_string<_CharT, _Traits, _Allocator> |
| 4491 | 4380 | operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs) |
| 4492 | 4381 | { |
| ... | ... | @@ -4499,7 +4388,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs) |
| 4499 | 4388 | // swap |
| 4500 | 4389 | |
| 4501 | 4390 | template<class _CharT, class _Traits, class _Allocator> |
| 4502 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4391 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4503 | 4392 | void |
| 4504 | 4393 | swap(basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4505 | 4394 | basic_string<_CharT, _Traits, _Allocator>& __rhs) |
| ... | ... | @@ -4556,27 +4445,44 @@ const typename basic_string<_CharT, _Traits, _Allocator>::size_type |
| 4556 | 4445 | basic_string<_CharT, _Traits, _Allocator>::npos; |
| 4557 | 4446 | |
| 4558 | 4447 | template <class _CharT, class _Allocator> |
| 4559 | struct _LIBCPP_TEMPLATE_VIS | |
| 4560 | hash<basic_string<_CharT, char_traits<_CharT>, _Allocator> > | |
| 4561 | : public __unary_function<basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> | |
| 4448 | struct __string_hash : public __unary_function<basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> | |
| 4562 | 4449 | { |
| 4563 | 4450 | size_t |
| 4564 | 4451 | operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT |
| 4565 | { return __do_string_hash(__val.data(), __val.data() + __val.size()); } | |
| 4452 | { return std::__do_string_hash(__val.data(), __val.data() + __val.size()); } | |
| 4566 | 4453 | }; |
| 4567 | 4454 | |
| 4455 | template <class _Allocator> | |
| 4456 | struct hash<basic_string<char, char_traits<char>, _Allocator> > : __string_hash<char, _Allocator> {}; | |
| 4457 | ||
| 4458 | #ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 4459 | template <class _Allocator> | |
| 4460 | struct hash<basic_string<char8_t, char_traits<char8_t>, _Allocator> > : __string_hash<char8_t, _Allocator> {}; | |
| 4461 | #endif | |
| 4462 | ||
| 4463 | template <class _Allocator> | |
| 4464 | struct hash<basic_string<char16_t, char_traits<char16_t>, _Allocator> > : __string_hash<char16_t, _Allocator> {}; | |
| 4465 | ||
| 4466 | template <class _Allocator> | |
| 4467 | struct hash<basic_string<char32_t, char_traits<char32_t>, _Allocator> > : __string_hash<char32_t, _Allocator> {}; | |
| 4468 | ||
| 4469 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 4470 | template <class _Allocator> | |
| 4471 | struct hash<basic_string<wchar_t, char_traits<wchar_t>, _Allocator> > : __string_hash<wchar_t, _Allocator> {}; | |
| 4472 | #endif | |
| 4473 | ||
| 4568 | 4474 | template<class _CharT, class _Traits, class _Allocator> |
| 4569 | basic_ostream<_CharT, _Traits>& | |
| 4475 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 4570 | 4476 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 4571 | 4477 | const basic_string<_CharT, _Traits, _Allocator>& __str); |
| 4572 | 4478 | |
| 4573 | 4479 | template<class _CharT, class _Traits, class _Allocator> |
| 4574 | basic_istream<_CharT, _Traits>& | |
| 4480 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 4575 | 4481 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 4576 | 4482 | basic_string<_CharT, _Traits, _Allocator>& __str); |
| 4577 | 4483 | |
| 4578 | 4484 | template<class _CharT, class _Traits, class _Allocator> |
| 4579 | basic_istream<_CharT, _Traits>& | |
| 4485 | _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& | |
| 4580 | 4486 | getline(basic_istream<_CharT, _Traits>& __is, |
| 4581 | 4487 | basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm); |
| 4582 | 4488 | |
| ... | ... | @@ -4662,14 +4568,14 @@ inline namespace literals |
| 4662 | 4568 | { |
| 4663 | 4569 | inline namespace string_literals |
| 4664 | 4570 | { |
| 4665 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4571 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4666 | 4572 | basic_string<char> operator "" s( const char *__str, size_t __len ) |
| 4667 | 4573 | { |
| 4668 | 4574 | return basic_string<char> (__str, __len); |
| 4669 | 4575 | } |
| 4670 | 4576 | |
| 4671 | 4577 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 4672 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4578 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4673 | 4579 | basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len ) |
| 4674 | 4580 | { |
| 4675 | 4581 | return basic_string<wchar_t> (__str, __len); |
| ... | ... | @@ -4678,19 +4584,19 @@ inline namespace literals |
| 4678 | 4584 | |
| 4679 | 4585 | #ifndef _LIBCPP_HAS_NO_CHAR8_T |
| 4680 | 4586 | inline _LIBCPP_HIDE_FROM_ABI constexpr |
| 4681 | basic_string<char8_t> operator "" s(const char8_t *__str, size_t __len) _NOEXCEPT | |
| 4587 | basic_string<char8_t> operator "" s(const char8_t *__str, size_t __len) | |
| 4682 | 4588 | { |
| 4683 | 4589 | return basic_string<char8_t> (__str, __len); |
| 4684 | 4590 | } |
| 4685 | 4591 | #endif |
| 4686 | 4592 | |
| 4687 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4593 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4688 | 4594 | basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len ) |
| 4689 | 4595 | { |
| 4690 | 4596 | return basic_string<char16_t> (__str, __len); |
| 4691 | 4597 | } |
| 4692 | 4598 | |
| 4693 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4599 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 4694 | 4600 | basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len ) |
| 4695 | 4601 | { |
| 4696 | 4602 | return basic_string<char32_t> (__str, __len); |
| ... | ... | @@ -4713,4 +4619,15 @@ _LIBCPP_END_NAMESPACE_STD |
| 4713 | 4619 | |
| 4714 | 4620 | _LIBCPP_POP_MACROS |
| 4715 | 4621 | |
| 4622 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 4623 | # include <algorithm> | |
| 4624 | # include <concepts> | |
| 4625 | # include <functional> | |
| 4626 | # include <iterator> | |
| 4627 | # include <new> | |
| 4628 | # include <typeinfo> | |
| 4629 | # include <utility> | |
| 4630 | # include <vector> | |
| 4631 | #endif | |
| 4632 | ||
| 4716 | 4633 | #endif // _LIBCPP_STRING |
lib/libcxx/include/string.h+37-35| ... | ... | @@ -57,7 +57,9 @@ size_t strlen(const char* s); |
| 57 | 57 | # pragma GCC system_header |
| 58 | 58 | #endif |
| 59 | 59 | |
| 60 | #include_next <string.h> | |
| 60 | #if __has_include_next(<string.h>) | |
| 61 | # include_next <string.h> | |
| 62 | #endif | |
| 61 | 63 | |
| 62 | 64 | // MSVCRT, GNU libc and its derivates may already have the correct prototype in |
| 63 | 65 | // <string.h>. This macro can be defined by users if their C library provides |
| ... | ... | @@ -69,41 +71,41 @@ size_t strlen(const char* s); |
| 69 | 71 | |
| 70 | 72 | #if defined(__cplusplus) && !defined(_LIBCPP_STRING_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD) |
| 71 | 73 | extern "C++" { |
| 72 | inline _LIBCPP_INLINE_VISIBILITY | |
| 73 | char* __libcpp_strchr(const char* __s, int __c) {return (char*)strchr(__s, __c);} | |
| 74 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 75 | const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);} | |
| 76 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 77 | char* strchr( char* __s, int __c) {return __libcpp_strchr(__s, __c);} | |
| 78 | ||
| 79 | inline _LIBCPP_INLINE_VISIBILITY | |
| 80 | char* __libcpp_strpbrk(const char* __s1, const char* __s2) {return (char*)strpbrk(__s1, __s2);} | |
| 81 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 82 | const char* strpbrk(const char* __s1, const char* __s2) {return __libcpp_strpbrk(__s1, __s2);} | |
| 83 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 84 | char* strpbrk( char* __s1, const char* __s2) {return __libcpp_strpbrk(__s1, __s2);} | |
| 85 | ||
| 86 | inline _LIBCPP_INLINE_VISIBILITY | |
| 87 | char* __libcpp_strrchr(const char* __s, int __c) {return (char*)strrchr(__s, __c);} | |
| 88 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 89 | const char* strrchr(const char* __s, int __c) {return __libcpp_strrchr(__s, __c);} | |
| 90 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 91 | char* strrchr( char* __s, int __c) {return __libcpp_strrchr(__s, __c);} | |
| 92 | ||
| 93 | inline _LIBCPP_INLINE_VISIBILITY | |
| 94 | void* __libcpp_memchr(const void* __s, int __c, size_t __n) {return (void*)memchr(__s, __c, __n);} | |
| 95 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 96 | const void* memchr(const void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);} | |
| 97 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 98 | void* memchr( void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);} | |
| 99 | ||
| 100 | inline _LIBCPP_INLINE_VISIBILITY | |
| 101 | char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);} | |
| 102 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 103 | const char* strstr(const char* __s1, const char* __s2) {return __libcpp_strstr(__s1, __s2);} | |
| 104 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD | |
| 105 | char* strstr( char* __s1, const char* __s2) {return __libcpp_strstr(__s1, __s2);} | |
| 74 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strchr(const char* __s, int __c) { | |
| 75 | return __builtin_strchr(__s, __c); | |
| 76 | } | |
| 77 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strchr(char* __s, int __c) { | |
| 78 | return __builtin_strchr(__s, __c); | |
| 79 | } | |
| 80 | ||
| 81 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strpbrk(const char* __s1, const char* __s2) { | |
| 82 | return __builtin_strpbrk(__s1, __s2); | |
| 83 | } | |
| 84 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strpbrk(char* __s1, const char* __s2) { | |
| 85 | return __builtin_strpbrk(__s1, __s2); | |
| 86 | } | |
| 87 | ||
| 88 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strrchr(const char* __s, int __c) { | |
| 89 | return __builtin_strrchr(__s, __c); | |
| 90 | } | |
| 91 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strrchr(char* __s, int __c) { | |
| 92 | return __builtin_strrchr(__s, __c); | |
| 93 | } | |
| 94 | ||
| 95 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const void* memchr(const void* __s, int __c, size_t __n) { | |
| 96 | return __builtin_memchr(__s, __c, __n); | |
| 97 | } | |
| 98 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD void* memchr(void* __s, int __c, size_t __n) { | |
| 99 | return __builtin_memchr(__s, __c, __n); | |
| 100 | } | |
| 101 | ||
| 102 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strstr(const char* __s1, const char* __s2) { | |
| 103 | return __builtin_strstr(__s1, __s2); | |
| 104 | } | |
| 105 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strstr(char* __s1, const char* __s2) { | |
| 106 | return __builtin_strstr(__s1, __s2); | |
| 106 | 107 | } |
| 108 | } // extern "C++" | |
| 107 | 109 | #endif |
| 108 | 110 | |
| 109 | 111 | #endif // _LIBCPP_STRING_H |
lib/libcxx/include/string_view+227-172| ... | ... | @@ -14,6 +14,8 @@ |
| 14 | 14 | |
| 15 | 15 | string_view synopsis |
| 16 | 16 | |
| 17 | #include <compare> | |
| 18 | ||
| 17 | 19 | namespace std { |
| 18 | 20 | |
| 19 | 21 | // 7.2, Class template basic_string_view |
| ... | ... | @@ -30,21 +32,25 @@ namespace std { |
| 30 | 32 | template<class charT, class traits> |
| 31 | 33 | constexpr bool operator==(basic_string_view<charT, traits> x, |
| 32 | 34 | basic_string_view<charT, traits> y) noexcept; |
| 33 | template<class charT, class traits> | |
| 35 | template<class charT, class traits> // Removed in C++20 | |
| 34 | 36 | constexpr bool operator!=(basic_string_view<charT, traits> x, |
| 35 | 37 | basic_string_view<charT, traits> y) noexcept; |
| 36 | template<class charT, class traits> | |
| 38 | template<class charT, class traits> // Removed in C++20 | |
| 37 | 39 | constexpr bool operator< (basic_string_view<charT, traits> x, |
| 38 | 40 | basic_string_view<charT, traits> y) noexcept; |
| 39 | template<class charT, class traits> | |
| 41 | template<class charT, class traits> // Removed in C++20 | |
| 40 | 42 | constexpr bool operator> (basic_string_view<charT, traits> x, |
| 41 | 43 | basic_string_view<charT, traits> y) noexcept; |
| 42 | template<class charT, class traits> | |
| 44 | template<class charT, class traits> // Removed in C++20 | |
| 43 | 45 | constexpr bool operator<=(basic_string_view<charT, traits> x, |
| 44 | 46 | basic_string_view<charT, traits> y) noexcept; |
| 45 | template<class charT, class traits> | |
| 47 | template<class charT, class traits> // Removed in C++20 | |
| 46 | 48 | constexpr bool operator>=(basic_string_view<charT, traits> x, |
| 47 | 49 | basic_string_view<charT, traits> y) noexcept; |
| 50 | template<class charT, class traits> // Since C++20 | |
| 51 | constexpr see below operator<=>(basic_string_view<charT, traits> x, | |
| 52 | basic_string_view<charT, traits> y) noexcept; | |
| 53 | ||
| 48 | 54 | // see below, sufficient additional overloads of comparison functions |
| 49 | 55 | |
| 50 | 56 | // 7.10, Inserters and extractors |
| ... | ... | @@ -185,11 +191,11 @@ namespace std { |
| 185 | 191 | template <> struct hash<u32string_view>; |
| 186 | 192 | template <> struct hash<wstring_view>; |
| 187 | 193 | |
| 188 | constexpr basic_string_view<char> operator "" sv( const char *str, size_t len ) noexcept; | |
| 189 | constexpr basic_string_view<wchar_t> operator "" sv( const wchar_t *str, size_t len ) noexcept; | |
| 190 | constexpr basic_string_view<char8_t> operator "" sv( const char8_t *str, size_t len ) noexcept; // C++20 | |
| 191 | constexpr basic_string_view<char16_t> operator "" sv( const char16_t *str, size_t len ) noexcept; | |
| 192 | constexpr basic_string_view<char32_t> operator "" sv( const char32_t *str, size_t len ) noexcept; | |
| 194 | constexpr basic_string_view<char> operator "" sv(const char *str, size_t len) noexcept; | |
| 195 | constexpr basic_string_view<wchar_t> operator "" sv(const wchar_t *str, size_t len) noexcept; | |
| 196 | constexpr basic_string_view<char8_t> operator "" sv(const char8_t *str, size_t len) noexcept; // C++20 | |
| 197 | constexpr basic_string_view<char16_t> operator "" sv(const char16_t *str, size_t len) noexcept; | |
| 198 | constexpr basic_string_view<char32_t> operator "" sv(const char32_t *str, size_t len) noexcept; | |
| 193 | 199 | |
| 194 | 200 | } // namespace std |
| 195 | 201 | |
| ... | ... | @@ -218,12 +224,6 @@ namespace std { |
| 218 | 224 | #include <type_traits> |
| 219 | 225 | #include <version> |
| 220 | 226 | |
| 221 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 222 | # include <algorithm> | |
| 223 | # include <functional> | |
| 224 | # include <iterator> | |
| 225 | #endif | |
| 226 | ||
| 227 | 227 | // standard-mandated includes |
| 228 | 228 | |
| 229 | 229 | // [iterator.range] |
| ... | ... | @@ -256,29 +256,21 @@ inline size_t __char_traits_length_checked(const typename _Traits::char_type* __ |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | template<class _CharT, class _Traits> |
| 259 | class | |
| 260 | _LIBCPP_PREFERRED_NAME(string_view) | |
| 261 | #ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 262 | _LIBCPP_PREFERRED_NAME(u8string_view) | |
| 263 | #endif | |
| 264 | _LIBCPP_PREFERRED_NAME(u16string_view) | |
| 265 | _LIBCPP_PREFERRED_NAME(u32string_view) | |
| 266 | _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstring_view)) | |
| 267 | basic_string_view { | |
| 259 | class basic_string_view { | |
| 268 | 260 | public: |
| 269 | 261 | // types |
| 270 | typedef _Traits traits_type; | |
| 271 | typedef _CharT value_type; | |
| 272 | typedef _CharT* pointer; | |
| 273 | typedef const _CharT* const_pointer; | |
| 274 | typedef _CharT& reference; | |
| 275 | typedef const _CharT& const_reference; | |
| 276 | typedef const_pointer const_iterator; // See [string.view.iterators] | |
| 277 | typedef const_iterator iterator; | |
| 278 | typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; | |
| 279 | typedef const_reverse_iterator reverse_iterator; | |
| 280 | typedef size_t size_type; | |
| 281 | typedef ptrdiff_t difference_type; | |
| 262 | using traits_type = _Traits; | |
| 263 | using value_type = _CharT; | |
| 264 | using pointer = _CharT*; | |
| 265 | using const_pointer = const _CharT*; | |
| 266 | using reference = _CharT&; | |
| 267 | using const_reference = const _CharT&; | |
| 268 | using const_iterator = const_pointer; // See [string.view.iterators] | |
| 269 | using iterator = const_iterator; | |
| 270 | using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>; | |
| 271 | using reverse_iterator = const_reverse_iterator; | |
| 272 | using size_type = size_t; | |
| 273 | using difference_type = ptrdiff_t; | |
| 282 | 274 | static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1); |
| 283 | 275 | |
| 284 | 276 | static_assert((!is_array<value_type>::value), "Character type of basic_string_view must not be an array"); |
| ... | ... | @@ -289,7 +281,7 @@ public: |
| 289 | 281 | |
| 290 | 282 | // [string.view.cons], construct/copy |
| 291 | 283 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 292 | basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {} | |
| 284 | basic_string_view() _NOEXCEPT : __data_(nullptr), __size_(0) {} | |
| 293 | 285 | |
| 294 | 286 | _LIBCPP_INLINE_VISIBILITY |
| 295 | 287 | basic_string_view(const basic_string_view&) _NOEXCEPT = default; |
| ... | ... | @@ -299,7 +291,7 @@ public: |
| 299 | 291 | |
| 300 | 292 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 301 | 293 | basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT |
| 302 | : __data(__s), __size(__len) | |
| 294 | : __data_(__s), __size_(__len) | |
| 303 | 295 | { |
| 304 | 296 | #if _LIBCPP_STD_VER > 11 |
| 305 | 297 | _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr"); |
| ... | ... | @@ -310,13 +302,13 @@ public: |
| 310 | 302 | template <contiguous_iterator _It, sized_sentinel_for<_It> _End> |
| 311 | 303 | requires (is_same_v<iter_value_t<_It>, _CharT> && !is_convertible_v<_End, size_type>) |
| 312 | 304 | constexpr _LIBCPP_HIDE_FROM_ABI basic_string_view(_It __begin, _End __end) |
| 313 | : __data(_VSTD::to_address(__begin)), __size(__end - __begin) | |
| 305 | : __data_(_VSTD::to_address(__begin)), __size_(__end - __begin) | |
| 314 | 306 | { |
| 315 | 307 | _LIBCPP_ASSERT((__end - __begin) >= 0, "std::string_view::string_view(iterator, sentinel) received invalid range"); |
| 316 | 308 | } |
| 317 | 309 | #endif // _LIBCPP_STD_VER > 17 |
| 318 | 310 | |
| 319 | #if _LIBCPP_STD_VER > 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 311 | #if _LIBCPP_STD_VER > 20 | |
| 320 | 312 | template <class _Range> |
| 321 | 313 | requires ( |
| 322 | 314 | !is_same_v<remove_cvref_t<_Range>, basic_string_view> && |
| ... | ... | @@ -331,13 +323,13 @@ public: |
| 331 | 323 | typename remove_reference_t<_Range>::traits_type; |
| 332 | 324 | } || is_same_v<typename remove_reference_t<_Range>::traits_type, _Traits>) |
| 333 | 325 | ) |
| 334 | constexpr _LIBCPP_HIDE_FROM_ABI | |
| 335 | basic_string_view(_Range&& __r) : __data(ranges::data(__r)), __size(ranges::size(__r)) {} | |
| 336 | #endif // _LIBCPP_STD_VER > 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 326 | constexpr explicit _LIBCPP_HIDE_FROM_ABI | |
| 327 | basic_string_view(_Range&& __r) : __data_(ranges::data(__r)), __size_(ranges::size(__r)) {} | |
| 328 | #endif // _LIBCPP_STD_VER > 20 | |
| 337 | 329 | |
| 338 | 330 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 339 | 331 | basic_string_view(const _CharT* __s) |
| 340 | : __data(__s), __size(_VSTD::__char_traits_length_checked<_Traits>(__s)) {} | |
| 332 | : __data_(__s), __size_(_VSTD::__char_traits_length_checked<_Traits>(__s)) {} | |
| 341 | 333 | |
| 342 | 334 | #if _LIBCPP_STD_VER > 20 |
| 343 | 335 | basic_string_view(nullptr_t) = delete; |
| ... | ... | @@ -351,94 +343,94 @@ public: |
| 351 | 343 | const_iterator end() const _NOEXCEPT { return cend(); } |
| 352 | 344 | |
| 353 | 345 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 354 | const_iterator cbegin() const _NOEXCEPT { return __data; } | |
| 346 | const_iterator cbegin() const _NOEXCEPT { return __data_; } | |
| 355 | 347 | |
| 356 | 348 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 357 | const_iterator cend() const _NOEXCEPT { return __data + __size; } | |
| 349 | const_iterator cend() const _NOEXCEPT { return __data_ + __size_; } | |
| 358 | 350 | |
| 359 | _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 351 | _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 360 | 352 | const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); } |
| 361 | 353 | |
| 362 | _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 354 | _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 363 | 355 | const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); } |
| 364 | 356 | |
| 365 | _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 357 | _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 366 | 358 | const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); } |
| 367 | 359 | |
| 368 | _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 360 | _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 369 | 361 | const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); } |
| 370 | 362 | |
| 371 | 363 | // [string.view.capacity], capacity |
| 372 | 364 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 373 | size_type size() const _NOEXCEPT { return __size; } | |
| 365 | size_type size() const _NOEXCEPT { return __size_; } | |
| 374 | 366 | |
| 375 | 367 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 376 | size_type length() const _NOEXCEPT { return __size; } | |
| 368 | size_type length() const _NOEXCEPT { return __size_; } | |
| 377 | 369 | |
| 378 | 370 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 379 | 371 | size_type max_size() const _NOEXCEPT { return numeric_limits<size_type>::max() / sizeof(value_type); } |
| 380 | 372 | |
| 381 | 373 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 382 | bool empty() const _NOEXCEPT { return __size == 0; } | |
| 374 | bool empty() const _NOEXCEPT { return __size_ == 0; } | |
| 383 | 375 | |
| 384 | 376 | // [string.view.access], element access |
| 385 | 377 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 386 | 378 | const_reference operator[](size_type __pos) const _NOEXCEPT { |
| 387 | return _LIBCPP_ASSERT(__pos < size(), "string_view[] index out of bounds"), __data[__pos]; | |
| 379 | return _LIBCPP_ASSERT(__pos < size(), "string_view[] index out of bounds"), __data_[__pos]; | |
| 388 | 380 | } |
| 389 | 381 | |
| 390 | 382 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 391 | 383 | const_reference at(size_type __pos) const |
| 392 | 384 | { |
| 393 | 385 | return __pos >= size() |
| 394 | ? (__throw_out_of_range("string_view::at"), __data[0]) | |
| 395 | : __data[__pos]; | |
| 386 | ? (__throw_out_of_range("string_view::at"), __data_[0]) | |
| 387 | : __data_[__pos]; | |
| 396 | 388 | } |
| 397 | 389 | |
| 398 | 390 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 399 | 391 | const_reference front() const _NOEXCEPT |
| 400 | 392 | { |
| 401 | return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0]; | |
| 393 | return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data_[0]; | |
| 402 | 394 | } |
| 403 | 395 | |
| 404 | 396 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 405 | 397 | const_reference back() const _NOEXCEPT |
| 406 | 398 | { |
| 407 | return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1]; | |
| 399 | return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data_[__size_-1]; | |
| 408 | 400 | } |
| 409 | 401 | |
| 410 | 402 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 411 | const_pointer data() const _NOEXCEPT { return __data; } | |
| 403 | const_pointer data() const _NOEXCEPT { return __data_; } | |
| 412 | 404 | |
| 413 | 405 | // [string.view.modifiers], modifiers: |
| 414 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 406 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 415 | 407 | void remove_prefix(size_type __n) _NOEXCEPT |
| 416 | 408 | { |
| 417 | 409 | _LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()"); |
| 418 | __data += __n; | |
| 419 | __size -= __n; | |
| 410 | __data_ += __n; | |
| 411 | __size_ -= __n; | |
| 420 | 412 | } |
| 421 | 413 | |
| 422 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 414 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 423 | 415 | void remove_suffix(size_type __n) _NOEXCEPT |
| 424 | 416 | { |
| 425 | 417 | _LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()"); |
| 426 | __size -= __n; | |
| 418 | __size_ -= __n; | |
| 427 | 419 | } |
| 428 | 420 | |
| 429 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 421 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 430 | 422 | void swap(basic_string_view& __other) _NOEXCEPT |
| 431 | 423 | { |
| 432 | const value_type *__p = __data; | |
| 433 | __data = __other.__data; | |
| 434 | __other.__data = __p; | |
| 424 | const value_type *__p = __data_; | |
| 425 | __data_ = __other.__data_; | |
| 426 | __other.__data_ = __p; | |
| 435 | 427 | |
| 436 | size_type __sz = __size; | |
| 437 | __size = __other.__size; | |
| 438 | __other.__size = __sz; | |
| 428 | size_type __sz = __size_; | |
| 429 | __size_ = __other.__size_; | |
| 430 | __other.__size_ = __sz; | |
| 439 | 431 | } |
| 440 | 432 | |
| 441 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 433 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 442 | 434 | size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const |
| 443 | 435 | { |
| 444 | 436 | if (__pos > size()) |
| ... | ... | @@ -456,229 +448,229 @@ public: |
| 456 | 448 | : basic_string_view(data() + __pos, _VSTD::min(__n, size() - __pos)); |
| 457 | 449 | } |
| 458 | 450 | |
| 459 | _LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT | |
| 451 | _LIBCPP_CONSTEXPR_SINCE_CXX14 int compare(basic_string_view __sv) const _NOEXCEPT | |
| 460 | 452 | { |
| 461 | size_type __rlen = _VSTD::min( size(), __sv.size()); | |
| 453 | size_type __rlen = _VSTD::min(size(), __sv.size()); | |
| 462 | 454 | int __retval = _Traits::compare(data(), __sv.data(), __rlen); |
| 463 | if ( __retval == 0 ) // first __rlen chars matched | |
| 464 | __retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 ); | |
| 455 | if (__retval == 0) // first __rlen chars matched | |
| 456 | __retval = size() == __sv.size() ? 0 : (size() < __sv.size() ? -1 : 1); | |
| 465 | 457 | return __retval; |
| 466 | 458 | } |
| 467 | 459 | |
| 468 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 460 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 469 | 461 | int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const |
| 470 | 462 | { |
| 471 | 463 | return substr(__pos1, __n1).compare(__sv); |
| 472 | 464 | } |
| 473 | 465 | |
| 474 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 466 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 475 | 467 | int compare( size_type __pos1, size_type __n1, |
| 476 | 468 | basic_string_view __sv, size_type __pos2, size_type __n2) const |
| 477 | 469 | { |
| 478 | 470 | return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2)); |
| 479 | 471 | } |
| 480 | 472 | |
| 481 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 473 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 482 | 474 | int compare(const _CharT* __s) const _NOEXCEPT |
| 483 | 475 | { |
| 484 | 476 | return compare(basic_string_view(__s)); |
| 485 | 477 | } |
| 486 | 478 | |
| 487 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 479 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 488 | 480 | int compare(size_type __pos1, size_type __n1, const _CharT* __s) const |
| 489 | 481 | { |
| 490 | 482 | return substr(__pos1, __n1).compare(basic_string_view(__s)); |
| 491 | 483 | } |
| 492 | 484 | |
| 493 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 485 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 494 | 486 | int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const |
| 495 | 487 | { |
| 496 | 488 | return substr(__pos1, __n1).compare(basic_string_view(__s, __n2)); |
| 497 | 489 | } |
| 498 | 490 | |
| 499 | 491 | // find |
| 500 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 492 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 501 | 493 | size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT |
| 502 | 494 | { |
| 503 | 495 | _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr"); |
| 504 | return __str_find<value_type, size_type, traits_type, npos> | |
| 496 | return std::__str_find<value_type, size_type, traits_type, npos> | |
| 505 | 497 | (data(), size(), __s.data(), __pos, __s.size()); |
| 506 | 498 | } |
| 507 | 499 | |
| 508 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 500 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 509 | 501 | size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT |
| 510 | 502 | { |
| 511 | return __str_find<value_type, size_type, traits_type, npos> | |
| 503 | return std::__str_find<value_type, size_type, traits_type, npos> | |
| 512 | 504 | (data(), size(), __c, __pos); |
| 513 | 505 | } |
| 514 | 506 | |
| 515 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 507 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 516 | 508 | size_type find(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT |
| 517 | 509 | { |
| 518 | 510 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): received nullptr"); |
| 519 | return __str_find<value_type, size_type, traits_type, npos> | |
| 511 | return std::__str_find<value_type, size_type, traits_type, npos> | |
| 520 | 512 | (data(), size(), __s, __pos, __n); |
| 521 | 513 | } |
| 522 | 514 | |
| 523 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 515 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 524 | 516 | size_type find(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT |
| 525 | 517 | { |
| 526 | 518 | _LIBCPP_ASSERT(__s != nullptr, "string_view::find(): received nullptr"); |
| 527 | return __str_find<value_type, size_type, traits_type, npos> | |
| 519 | return std::__str_find<value_type, size_type, traits_type, npos> | |
| 528 | 520 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 529 | 521 | } |
| 530 | 522 | |
| 531 | 523 | // rfind |
| 532 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 524 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 533 | 525 | size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT |
| 534 | 526 | { |
| 535 | 527 | _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr"); |
| 536 | return __str_rfind<value_type, size_type, traits_type, npos> | |
| 528 | return std::__str_rfind<value_type, size_type, traits_type, npos> | |
| 537 | 529 | (data(), size(), __s.data(), __pos, __s.size()); |
| 538 | 530 | } |
| 539 | 531 | |
| 540 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 532 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 541 | 533 | size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT |
| 542 | 534 | { |
| 543 | return __str_rfind<value_type, size_type, traits_type, npos> | |
| 535 | return std::__str_rfind<value_type, size_type, traits_type, npos> | |
| 544 | 536 | (data(), size(), __c, __pos); |
| 545 | 537 | } |
| 546 | 538 | |
| 547 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 539 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 548 | 540 | size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT |
| 549 | 541 | { |
| 550 | 542 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr"); |
| 551 | return __str_rfind<value_type, size_type, traits_type, npos> | |
| 543 | return std::__str_rfind<value_type, size_type, traits_type, npos> | |
| 552 | 544 | (data(), size(), __s, __pos, __n); |
| 553 | 545 | } |
| 554 | 546 | |
| 555 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 547 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 556 | 548 | size_type rfind(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT |
| 557 | 549 | { |
| 558 | 550 | _LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): received nullptr"); |
| 559 | return __str_rfind<value_type, size_type, traits_type, npos> | |
| 551 | return std::__str_rfind<value_type, size_type, traits_type, npos> | |
| 560 | 552 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 561 | 553 | } |
| 562 | 554 | |
| 563 | 555 | // find_first_of |
| 564 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 556 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 565 | 557 | size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT |
| 566 | 558 | { |
| 567 | 559 | _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): received nullptr"); |
| 568 | return __str_find_first_of<value_type, size_type, traits_type, npos> | |
| 560 | return std::__str_find_first_of<value_type, size_type, traits_type, npos> | |
| 569 | 561 | (data(), size(), __s.data(), __pos, __s.size()); |
| 570 | 562 | } |
| 571 | 563 | |
| 572 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 564 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 573 | 565 | size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT |
| 574 | 566 | { return find(__c, __pos); } |
| 575 | 567 | |
| 576 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 568 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 577 | 569 | size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT |
| 578 | 570 | { |
| 579 | 571 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr"); |
| 580 | return __str_find_first_of<value_type, size_type, traits_type, npos> | |
| 572 | return std::__str_find_first_of<value_type, size_type, traits_type, npos> | |
| 581 | 573 | (data(), size(), __s, __pos, __n); |
| 582 | 574 | } |
| 583 | 575 | |
| 584 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 576 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 585 | 577 | size_type find_first_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT |
| 586 | 578 | { |
| 587 | 579 | _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): received nullptr"); |
| 588 | return __str_find_first_of<value_type, size_type, traits_type, npos> | |
| 580 | return std::__str_find_first_of<value_type, size_type, traits_type, npos> | |
| 589 | 581 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 590 | 582 | } |
| 591 | 583 | |
| 592 | 584 | // find_last_of |
| 593 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 585 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 594 | 586 | size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT |
| 595 | 587 | { |
| 596 | 588 | _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): received nullptr"); |
| 597 | return __str_find_last_of<value_type, size_type, traits_type, npos> | |
| 589 | return std::__str_find_last_of<value_type, size_type, traits_type, npos> | |
| 598 | 590 | (data(), size(), __s.data(), __pos, __s.size()); |
| 599 | 591 | } |
| 600 | 592 | |
| 601 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 593 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 602 | 594 | size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT |
| 603 | 595 | { return rfind(__c, __pos); } |
| 604 | 596 | |
| 605 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 597 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 606 | 598 | size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT |
| 607 | 599 | { |
| 608 | 600 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr"); |
| 609 | return __str_find_last_of<value_type, size_type, traits_type, npos> | |
| 601 | return std::__str_find_last_of<value_type, size_type, traits_type, npos> | |
| 610 | 602 | (data(), size(), __s, __pos, __n); |
| 611 | 603 | } |
| 612 | 604 | |
| 613 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 605 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 614 | 606 | size_type find_last_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT |
| 615 | 607 | { |
| 616 | 608 | _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): received nullptr"); |
| 617 | return __str_find_last_of<value_type, size_type, traits_type, npos> | |
| 609 | return std::__str_find_last_of<value_type, size_type, traits_type, npos> | |
| 618 | 610 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 619 | 611 | } |
| 620 | 612 | |
| 621 | 613 | // find_first_not_of |
| 622 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 614 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 623 | 615 | size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT |
| 624 | 616 | { |
| 625 | 617 | _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): received nullptr"); |
| 626 | return __str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 618 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 627 | 619 | (data(), size(), __s.data(), __pos, __s.size()); |
| 628 | 620 | } |
| 629 | 621 | |
| 630 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 622 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 631 | 623 | size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT |
| 632 | 624 | { |
| 633 | return __str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 625 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 634 | 626 | (data(), size(), __c, __pos); |
| 635 | 627 | } |
| 636 | 628 | |
| 637 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 629 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 638 | 630 | size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT |
| 639 | 631 | { |
| 640 | 632 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr"); |
| 641 | return __str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 633 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 642 | 634 | (data(), size(), __s, __pos, __n); |
| 643 | 635 | } |
| 644 | 636 | |
| 645 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 637 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 646 | 638 | size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT |
| 647 | 639 | { |
| 648 | 640 | _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): received nullptr"); |
| 649 | return __str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 641 | return std::__str_find_first_not_of<value_type, size_type, traits_type, npos> | |
| 650 | 642 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 651 | 643 | } |
| 652 | 644 | |
| 653 | 645 | // find_last_not_of |
| 654 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 646 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 655 | 647 | size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT |
| 656 | 648 | { |
| 657 | 649 | _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): received nullptr"); |
| 658 | return __str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 650 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 659 | 651 | (data(), size(), __s.data(), __pos, __s.size()); |
| 660 | 652 | } |
| 661 | 653 | |
| 662 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 654 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 663 | 655 | size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT |
| 664 | 656 | { |
| 665 | return __str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 657 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 666 | 658 | (data(), size(), __c, __pos); |
| 667 | 659 | } |
| 668 | 660 | |
| 669 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 661 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 670 | 662 | size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT |
| 671 | 663 | { |
| 672 | 664 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr"); |
| 673 | return __str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 665 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 674 | 666 | (data(), size(), __s, __pos, __n); |
| 675 | 667 | } |
| 676 | 668 | |
| 677 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 669 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 678 | 670 | size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT |
| 679 | 671 | { |
| 680 | 672 | _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): received nullptr"); |
| 681 | return __str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 673 | return std::__str_find_last_not_of<value_type, size_type, traits_type, npos> | |
| 682 | 674 | (data(), size(), __s, __pos, traits_type::length(__s)); |
| 683 | 675 | } |
| 684 | 676 | |
| ... | ... | @@ -723,9 +715,10 @@ public: |
| 723 | 715 | #endif |
| 724 | 716 | |
| 725 | 717 | private: |
| 726 | const value_type* __data; | |
| 727 | size_type __size; | |
| 718 | const value_type* __data_; | |
| 719 | size_type __size_; | |
| 728 | 720 | }; |
| 721 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_string_view); | |
| 729 | 722 | |
| 730 | 723 | #if _LIBCPP_STD_VER > 17 |
| 731 | 724 | template <class _CharT, class _Traits> |
| ... | ... | @@ -743,69 +736,105 @@ template <contiguous_iterator _It, sized_sentinel_for<_It> _End> |
| 743 | 736 | #endif // _LIBCPP_STD_VER > 17 |
| 744 | 737 | |
| 745 | 738 | |
| 746 | #if _LIBCPP_STD_VER > 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 739 | #if _LIBCPP_STD_VER > 20 | |
| 747 | 740 | template <ranges::contiguous_range _Range> |
| 748 | 741 | basic_string_view(_Range) -> basic_string_view<ranges::range_value_t<_Range>>; |
| 749 | #endif // _LIBCPP_STD_VER > 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 742 | #endif | |
| 750 | 743 | |
| 751 | 744 | // [string.view.comparison] |
| 752 | 745 | // operator == |
| 753 | 746 | template<class _CharT, class _Traits> |
| 754 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 747 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 755 | 748 | bool operator==(basic_string_view<_CharT, _Traits> __lhs, |
| 756 | 749 | basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 757 | 750 | { |
| 758 | if ( __lhs.size() != __rhs.size()) return false; | |
| 751 | if (__lhs.size() != __rhs.size()) return false; | |
| 759 | 752 | return __lhs.compare(__rhs) == 0; |
| 760 | 753 | } |
| 761 | 754 | |
| 762 | 755 | // The dummy default template parameters are used to work around a MSVC issue with mangling, see VSO-409326 for details. |
| 763 | 756 | // This applies to the other sufficient overloads below for the other comparison operators. |
| 764 | 757 | template<class _CharT, class _Traits, int = 1> |
| 765 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 758 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 766 | 759 | bool operator==(basic_string_view<_CharT, _Traits> __lhs, |
| 767 | typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT | |
| 760 | __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT | |
| 768 | 761 | { |
| 769 | if ( __lhs.size() != __rhs.size()) return false; | |
| 762 | if (__lhs.size() != __rhs.size()) return false; | |
| 770 | 763 | return __lhs.compare(__rhs) == 0; |
| 771 | 764 | } |
| 772 | 765 | |
| 766 | #if _LIBCPP_STD_VER < 20 | |
| 767 | // This overload is automatically generated in C++20. | |
| 773 | 768 | template<class _CharT, class _Traits, int = 2> |
| 774 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 775 | bool operator==(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, | |
| 769 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 770 | bool operator==(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs, | |
| 776 | 771 | basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 777 | 772 | { |
| 778 | if ( __lhs.size() != __rhs.size()) return false; | |
| 773 | if (__lhs.size() != __rhs.size()) return false; | |
| 779 | 774 | return __lhs.compare(__rhs) == 0; |
| 780 | 775 | } |
| 776 | #endif // _LIBCPP_STD_VER > 17 | |
| 781 | 777 | |
| 778 | // operator <=> | |
| 779 | ||
| 780 | #if _LIBCPP_STD_VER > 17 | |
| 781 | ||
| 782 | template <class _CharT, class _Traits> | |
| 783 | _LIBCPP_HIDE_FROM_ABI constexpr auto | |
| 784 | operator<=>(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { | |
| 785 | if constexpr (requires { typename _Traits::comparison_category; }) { | |
| 786 | // [string.view]/4 | |
| 787 | static_assert( | |
| 788 | __comparison_category<typename _Traits::comparison_category>, | |
| 789 | "return type is not a comparison category type"); | |
| 790 | return static_cast<typename _Traits::comparison_category>(__lhs.compare(__rhs) <=> 0); | |
| 791 | } else { | |
| 792 | return static_cast<weak_ordering>(__lhs.compare(__rhs) <=> 0); | |
| 793 | } | |
| 794 | } | |
| 795 | ||
| 796 | template <class _CharT, class _Traits, int = 1> | |
| 797 | _LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>( | |
| 798 | basic_string_view<_CharT, _Traits> __lhs, type_identity_t<basic_string_view<_CharT, _Traits>> __rhs) noexcept { | |
| 799 | if constexpr (requires { typename _Traits::comparison_category; }) { | |
| 800 | // [string.view]/4 | |
| 801 | static_assert( | |
| 802 | __comparison_category<typename _Traits::comparison_category>, | |
| 803 | "return type is not a comparison category type"); | |
| 804 | return static_cast<typename _Traits::comparison_category>(__lhs.compare(__rhs) <=> 0); | |
| 805 | } else { | |
| 806 | return static_cast<weak_ordering>(__lhs.compare(__rhs) <=> 0); | |
| 807 | } | |
| 808 | } | |
| 809 | ||
| 810 | #else // _LIBCPP_STD_VER > 17 | |
| 782 | 811 | |
| 783 | 812 | // operator != |
| 784 | 813 | template<class _CharT, class _Traits> |
| 785 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 814 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 786 | 815 | bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 787 | 816 | { |
| 788 | if ( __lhs.size() != __rhs.size()) | |
| 817 | if (__lhs.size() != __rhs.size()) | |
| 789 | 818 | return true; |
| 790 | 819 | return __lhs.compare(__rhs) != 0; |
| 791 | 820 | } |
| 792 | 821 | |
| 793 | 822 | template<class _CharT, class _Traits, int = 1> |
| 794 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 823 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 795 | 824 | bool operator!=(basic_string_view<_CharT, _Traits> __lhs, |
| 796 | typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT | |
| 825 | __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT | |
| 797 | 826 | { |
| 798 | if ( __lhs.size() != __rhs.size()) | |
| 827 | if (__lhs.size() != __rhs.size()) | |
| 799 | 828 | return true; |
| 800 | 829 | return __lhs.compare(__rhs) != 0; |
| 801 | 830 | } |
| 802 | 831 | |
| 803 | 832 | template<class _CharT, class _Traits, int = 2> |
| 804 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 805 | bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, | |
| 833 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 834 | bool operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs, | |
| 806 | 835 | basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 807 | 836 | { |
| 808 | if ( __lhs.size() != __rhs.size()) | |
| 837 | if (__lhs.size() != __rhs.size()) | |
| 809 | 838 | return true; |
| 810 | 839 | return __lhs.compare(__rhs) != 0; |
| 811 | 840 | } |
| ... | ... | @@ -813,23 +842,23 @@ bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type |
| 813 | 842 | |
| 814 | 843 | // operator < |
| 815 | 844 | template<class _CharT, class _Traits> |
| 816 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 845 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 817 | 846 | bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 818 | 847 | { |
| 819 | 848 | return __lhs.compare(__rhs) < 0; |
| 820 | 849 | } |
| 821 | 850 | |
| 822 | 851 | template<class _CharT, class _Traits, int = 1> |
| 823 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 852 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 824 | 853 | bool operator<(basic_string_view<_CharT, _Traits> __lhs, |
| 825 | typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT | |
| 854 | __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT | |
| 826 | 855 | { |
| 827 | 856 | return __lhs.compare(__rhs) < 0; |
| 828 | 857 | } |
| 829 | 858 | |
| 830 | 859 | template<class _CharT, class _Traits, int = 2> |
| 831 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 832 | bool operator<(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, | |
| 860 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 861 | bool operator<(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs, | |
| 833 | 862 | basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 834 | 863 | { |
| 835 | 864 | return __lhs.compare(__rhs) < 0; |
| ... | ... | @@ -838,23 +867,23 @@ bool operator<(typename common_type<basic_string_view<_CharT, _Traits> >::type _ |
| 838 | 867 | |
| 839 | 868 | // operator > |
| 840 | 869 | template<class _CharT, class _Traits> |
| 841 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 870 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 842 | 871 | bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 843 | 872 | { |
| 844 | 873 | return __lhs.compare(__rhs) > 0; |
| 845 | 874 | } |
| 846 | 875 | |
| 847 | 876 | template<class _CharT, class _Traits, int = 1> |
| 848 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 877 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 849 | 878 | bool operator>(basic_string_view<_CharT, _Traits> __lhs, |
| 850 | typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT | |
| 879 | __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT | |
| 851 | 880 | { |
| 852 | 881 | return __lhs.compare(__rhs) > 0; |
| 853 | 882 | } |
| 854 | 883 | |
| 855 | 884 | template<class _CharT, class _Traits, int = 2> |
| 856 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 857 | bool operator>(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, | |
| 885 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 886 | bool operator>(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs, | |
| 858 | 887 | basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 859 | 888 | { |
| 860 | 889 | return __lhs.compare(__rhs) > 0; |
| ... | ... | @@ -863,23 +892,23 @@ bool operator>(typename common_type<basic_string_view<_CharT, _Traits> >::type _ |
| 863 | 892 | |
| 864 | 893 | // operator <= |
| 865 | 894 | template<class _CharT, class _Traits> |
| 866 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 895 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 867 | 896 | bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 868 | 897 | { |
| 869 | 898 | return __lhs.compare(__rhs) <= 0; |
| 870 | 899 | } |
| 871 | 900 | |
| 872 | 901 | template<class _CharT, class _Traits, int = 1> |
| 873 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 902 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 874 | 903 | bool operator<=(basic_string_view<_CharT, _Traits> __lhs, |
| 875 | typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT | |
| 904 | __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT | |
| 876 | 905 | { |
| 877 | 906 | return __lhs.compare(__rhs) <= 0; |
| 878 | 907 | } |
| 879 | 908 | |
| 880 | 909 | template<class _CharT, class _Traits, int = 2> |
| 881 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 882 | bool operator<=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, | |
| 910 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 911 | bool operator<=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs, | |
| 883 | 912 | basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 884 | 913 | { |
| 885 | 914 | return __lhs.compare(__rhs) <= 0; |
| ... | ... | @@ -888,7 +917,7 @@ bool operator<=(typename common_type<basic_string_view<_CharT, _Traits> >::type |
| 888 | 917 | |
| 889 | 918 | // operator >= |
| 890 | 919 | template<class _CharT, class _Traits> |
| 891 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 920 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 892 | 921 | bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 893 | 922 | { |
| 894 | 923 | return __lhs.compare(__rhs) >= 0; |
| ... | ... | @@ -896,38 +925,57 @@ bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_Cha |
| 896 | 925 | |
| 897 | 926 | |
| 898 | 927 | template<class _CharT, class _Traits, int = 1> |
| 899 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 928 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 900 | 929 | bool operator>=(basic_string_view<_CharT, _Traits> __lhs, |
| 901 | typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT | |
| 930 | __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT | |
| 902 | 931 | { |
| 903 | 932 | return __lhs.compare(__rhs) >= 0; |
| 904 | 933 | } |
| 905 | 934 | |
| 906 | 935 | template<class _CharT, class _Traits, int = 2> |
| 907 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | |
| 908 | bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, | |
| 936 | _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY | |
| 937 | bool operator>=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs, | |
| 909 | 938 | basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT |
| 910 | 939 | { |
| 911 | 940 | return __lhs.compare(__rhs) >= 0; |
| 912 | 941 | } |
| 913 | 942 | |
| 943 | #endif // _LIBCPP_STD_VER > 17 | |
| 914 | 944 | |
| 915 | 945 | template<class _CharT, class _Traits> |
| 916 | basic_ostream<_CharT, _Traits>& | |
| 946 | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& | |
| 917 | 947 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 918 | 948 | basic_string_view<_CharT, _Traits> __str); |
| 919 | 949 | |
| 920 | 950 | // [string.view.hash] |
| 921 | 951 | template<class _CharT> |
| 922 | struct _LIBCPP_TEMPLATE_VIS hash<basic_string_view<_CharT, char_traits<_CharT> > > | |
| 923 | : public __unary_function<basic_string_view<_CharT, char_traits<_CharT> >, size_t> | |
| 952 | struct __string_view_hash : public __unary_function<basic_string_view<_CharT, char_traits<_CharT> >, size_t> | |
| 924 | 953 | { |
| 925 | 954 | _LIBCPP_INLINE_VISIBILITY |
| 926 | 955 | size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT { |
| 927 | return __do_string_hash(__val.data(), __val.data() + __val.size()); | |
| 956 | return std::__do_string_hash(__val.data(), __val.data() + __val.size()); | |
| 928 | 957 | } |
| 929 | 958 | }; |
| 930 | 959 | |
| 960 | template <> | |
| 961 | struct hash<basic_string_view<char, char_traits<char> > > : __string_view_hash<char> {}; | |
| 962 | ||
| 963 | #ifndef _LIBCPP_HAS_NO_CHAR8_T | |
| 964 | template <> | |
| 965 | struct hash<basic_string_view<char8_t, char_traits<char8_t> > > : __string_view_hash<char8_t> {}; | |
| 966 | #endif | |
| 967 | ||
| 968 | template <> | |
| 969 | struct hash<basic_string_view<char16_t, char_traits<char16_t> > > : __string_view_hash<char16_t> {}; | |
| 970 | ||
| 971 | template <> | |
| 972 | struct hash<basic_string_view<char32_t, char_traits<char32_t> > > : __string_view_hash<char32_t> {}; | |
| 973 | ||
| 974 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS | |
| 975 | template <> | |
| 976 | struct hash<basic_string_view<wchar_t, char_traits<wchar_t> > > : __string_view_hash<wchar_t> {}; | |
| 977 | #endif | |
| 978 | ||
| 931 | 979 | #if _LIBCPP_STD_VER > 11 |
| 932 | 980 | inline namespace literals |
| 933 | 981 | { |
| ... | ... | @@ -973,4 +1021,11 @@ _LIBCPP_END_NAMESPACE_STD |
| 973 | 1021 | |
| 974 | 1022 | _LIBCPP_POP_MACROS |
| 975 | 1023 | |
| 1024 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1025 | # include <algorithm> | |
| 1026 | # include <concepts> | |
| 1027 | # include <functional> | |
| 1028 | # include <iterator> | |
| 1029 | #endif | |
| 1030 | ||
| 976 | 1031 | #endif // _LIBCPP_STRING_VIEW |
lib/libcxx/include/strstream+11-11| ... | ... | @@ -167,7 +167,7 @@ public: |
| 167 | 167 | strstreambuf& operator=(strstreambuf&& __rhs); |
| 168 | 168 | #endif // _LIBCPP_CXX03_LANG |
| 169 | 169 | |
| 170 | virtual ~strstreambuf(); | |
| 170 | ~strstreambuf() override; | |
| 171 | 171 | |
| 172 | 172 | void swap(strstreambuf& __rhs); |
| 173 | 173 | |
| ... | ... | @@ -176,13 +176,13 @@ public: |
| 176 | 176 | int pcount() const; |
| 177 | 177 | |
| 178 | 178 | protected: |
| 179 | virtual int_type overflow (int_type __c = EOF); | |
| 180 | virtual int_type pbackfail(int_type __c = EOF); | |
| 181 | virtual int_type underflow(); | |
| 182 | virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, | |
| 183 | ios_base::openmode __which = ios_base::in | ios_base::out); | |
| 184 | virtual pos_type seekpos(pos_type __sp, | |
| 185 | ios_base::openmode __which = ios_base::in | ios_base::out); | |
| 179 | int_type overflow (int_type __c = EOF) override; | |
| 180 | int_type pbackfail(int_type __c = EOF) override; | |
| 181 | int_type underflow() override; | |
| 182 | pos_type seekoff(off_type __off, ios_base::seekdir __way, | |
| 183 | ios_base::openmode __which = ios_base::in | ios_base::out) override; | |
| 184 | pos_type seekpos(pos_type __sp, | |
| 185 | ios_base::openmode __which = ios_base::in | ios_base::out) override; | |
| 186 | 186 | |
| 187 | 187 | private: |
| 188 | 188 | typedef unsigned __mode_type; |
| ... | ... | @@ -272,7 +272,7 @@ public: |
| 272 | 272 | } |
| 273 | 273 | #endif // _LIBCPP_CXX03_LANG |
| 274 | 274 | |
| 275 | virtual ~istrstream(); | |
| 275 | ~istrstream() override; | |
| 276 | 276 | |
| 277 | 277 | _LIBCPP_INLINE_VISIBILITY |
| 278 | 278 | void swap(istrstream& __rhs) |
| ... | ... | @@ -321,7 +321,7 @@ public: |
| 321 | 321 | } |
| 322 | 322 | #endif // _LIBCPP_CXX03_LANG |
| 323 | 323 | |
| 324 | virtual ~ostrstream(); | |
| 324 | ~ostrstream() override; | |
| 325 | 325 | |
| 326 | 326 | _LIBCPP_INLINE_VISIBILITY |
| 327 | 327 | void swap(ostrstream& __rhs) |
| ... | ... | @@ -381,7 +381,7 @@ public: |
| 381 | 381 | } |
| 382 | 382 | #endif // _LIBCPP_CXX03_LANG |
| 383 | 383 | |
| 384 | virtual ~strstream(); | |
| 384 | ~strstream() override; | |
| 385 | 385 | |
| 386 | 386 | _LIBCPP_INLINE_VISIBILITY |
| 387 | 387 | void swap(strstream& __rhs) |
lib/libcxx/include/system_error+92-33| ... | ... | @@ -32,8 +32,9 @@ public: |
| 32 | 32 | virtual string message(int ev) const = 0; |
| 33 | 33 | |
| 34 | 34 | bool operator==(const error_category& rhs) const noexcept; |
| 35 | bool operator!=(const error_category& rhs) const noexcept; | |
| 36 | bool operator<(const error_category& rhs) const noexcept; | |
| 35 | bool operator!=(const error_category& rhs) const noexcept; // removed in C++20 | |
| 36 | bool operator<(const error_category& rhs) const noexcept; // removed in C++20 | |
| 37 | strong_ordering operator<=>(const error_category& rhs) const noexcept; // C++20 | |
| 37 | 38 | }; |
| 38 | 39 | |
| 39 | 40 | const error_category& generic_category() noexcept; |
| ... | ... | @@ -75,7 +76,6 @@ public: |
| 75 | 76 | }; |
| 76 | 77 | |
| 77 | 78 | // non-member functions: |
| 78 | bool operator<(const error_code& lhs, const error_code& rhs) noexcept; | |
| 79 | 79 | template <class charT, class traits> |
| 80 | 80 | basic_ostream<charT,traits>& |
| 81 | 81 | operator<<(basic_ostream<charT,traits>& os, const error_code& ec); |
| ... | ... | @@ -102,8 +102,6 @@ public: |
| 102 | 102 | explicit operator bool() const noexcept; |
| 103 | 103 | }; |
| 104 | 104 | |
| 105 | bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept; | |
| 106 | ||
| 107 | 105 | class system_error |
| 108 | 106 | : public runtime_error |
| 109 | 107 | { |
| ... | ... | @@ -128,12 +126,16 @@ error_condition make_error_condition(errc e) noexcept; |
| 128 | 126 | // Comparison operators: |
| 129 | 127 | bool operator==(const error_code& lhs, const error_code& rhs) noexcept; |
| 130 | 128 | bool operator==(const error_code& lhs, const error_condition& rhs) noexcept; |
| 131 | bool operator==(const error_condition& lhs, const error_code& rhs) noexcept; | |
| 129 | bool operator==(const error_condition& lhs, const error_code& rhs) noexcept; // removed in C++20 | |
| 132 | 130 | bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept; |
| 133 | bool operator!=(const error_code& lhs, const error_code& rhs) noexcept; | |
| 134 | bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept; | |
| 135 | bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept; | |
| 136 | bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept; | |
| 131 | bool operator!=(const error_code& lhs, const error_code& rhs) noexcept; // removed in C++20 | |
| 132 | bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept; // removed in C++20 | |
| 133 | bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept; // removed in C++20 | |
| 134 | bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept; // removed in C++20 | |
| 135 | bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept; // removed in C++20 | |
| 136 | bool operator<(const error_code& lhs, const error_code& rhs) noexcept; // removed in C++20 | |
| 137 | strong_ordering operator<=>(const error_code& lhs, const error_code& rhs) noexcept; // C++20 | |
| 138 | strong_ordering operator<=>(const error_condition& lhs, const error_condition& rhs) noexcept; // C++20 | |
| 137 | 139 | |
| 138 | 140 | template <> struct hash<std::error_code>; |
| 139 | 141 | template <> struct hash<std::error_condition>; |
| ... | ... | @@ -147,12 +149,15 @@ template <> struct hash<std::error_condition>; |
| 147 | 149 | #include <__errc> |
| 148 | 150 | #include <__functional/hash.h> |
| 149 | 151 | #include <__functional/unary_function.h> |
| 152 | #include <__memory/addressof.h> | |
| 150 | 153 | #include <stdexcept> |
| 151 | 154 | #include <string> |
| 152 | 155 | #include <type_traits> |
| 153 | 156 | #include <version> |
| 154 | 157 | |
| 155 | 158 | // standard-mandated includes |
| 159 | ||
| 160 | // [system.error.syn] | |
| 156 | 161 | #include <compare> |
| 157 | 162 | |
| 158 | 163 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -209,7 +214,7 @@ public: |
| 209 | 214 | error_category() noexcept; |
| 210 | 215 | #else |
| 211 | 216 | _LIBCPP_INLINE_VISIBILITY |
| 212 | _LIBCPP_CONSTEXPR_AFTER_CXX11 error_category() _NOEXCEPT = default; | |
| 217 | _LIBCPP_CONSTEXPR_SINCE_CXX14 error_category() _NOEXCEPT = default; | |
| 213 | 218 | #endif |
| 214 | 219 | error_category(const error_category&) = delete; |
| 215 | 220 | error_category& operator=(const error_category&) = delete; |
| ... | ... | @@ -223,12 +228,21 @@ public: |
| 223 | 228 | _LIBCPP_INLINE_VISIBILITY |
| 224 | 229 | bool operator==(const error_category& __rhs) const _NOEXCEPT {return this == &__rhs;} |
| 225 | 230 | |
| 231 | #if _LIBCPP_STD_VER > 17 | |
| 232 | ||
| 233 | _LIBCPP_HIDE_FROM_ABI | |
| 234 | strong_ordering operator<=>(const error_category& __rhs) const noexcept {return compare_three_way()(this, std::addressof(__rhs));} | |
| 235 | ||
| 236 | #else // _LIBCPP_STD_VER > 17 | |
| 237 | ||
| 226 | 238 | _LIBCPP_INLINE_VISIBILITY |
| 227 | 239 | bool operator!=(const error_category& __rhs) const _NOEXCEPT {return !(*this == __rhs);} |
| 228 | 240 | |
| 229 | 241 | _LIBCPP_INLINE_VISIBILITY |
| 230 | 242 | bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;} |
| 231 | 243 | |
| 244 | #endif // _LIBCPP_STD_VER > 17 | |
| 245 | ||
| 232 | 246 | friend class _LIBCPP_HIDDEN __do_message; |
| 233 | 247 | }; |
| 234 | 248 | |
| ... | ... | @@ -236,12 +250,19 @@ class _LIBCPP_HIDDEN __do_message |
| 236 | 250 | : public error_category |
| 237 | 251 | { |
| 238 | 252 | public: |
| 239 | virtual string message(int __ev) const; | |
| 253 | string message(int __ev) const override; | |
| 240 | 254 | }; |
| 241 | 255 | |
| 242 | 256 | _LIBCPP_FUNC_VIS const error_category& generic_category() _NOEXCEPT; |
| 243 | 257 | _LIBCPP_FUNC_VIS const error_category& system_category() _NOEXCEPT; |
| 244 | 258 | |
| 259 | namespace __adl_only { | |
| 260 | // Those cause ADL to trigger but they are not viable candidates, | |
| 261 | // so they are never actually selected. | |
| 262 | void make_error_condition() = delete; | |
| 263 | void make_error_code() = delete; | |
| 264 | } // namespace __adl_only | |
| 265 | ||
| 245 | 266 | class _LIBCPP_TYPE_VIS error_condition |
| 246 | 267 | { |
| 247 | 268 | int __val_; |
| ... | ... | @@ -259,7 +280,10 @@ public: |
| 259 | 280 | error_condition(_Ep __e, |
| 260 | 281 | typename enable_if<is_error_condition_enum<_Ep>::value>::type* = nullptr |
| 261 | 282 | ) _NOEXCEPT |
| 262 | {*this = make_error_condition(__e);} | |
| 283 | { | |
| 284 | using __adl_only::make_error_condition; | |
| 285 | *this = make_error_condition(__e); | |
| 286 | } | |
| 263 | 287 | |
| 264 | 288 | _LIBCPP_INLINE_VISIBILITY |
| 265 | 289 | void assign(int __val, const error_category& __cat) _NOEXCEPT |
| ... | ... | @@ -276,7 +300,11 @@ public: |
| 276 | 300 | error_condition& |
| 277 | 301 | >::type |
| 278 | 302 | operator=(_Ep __e) _NOEXCEPT |
| 279 | {*this = make_error_condition(__e); return *this;} | |
| 303 | { | |
| 304 | using __adl_only::make_error_condition; | |
| 305 | *this = make_error_condition(__e); | |
| 306 | return *this; | |
| 307 | } | |
| 280 | 308 | |
| 281 | 309 | _LIBCPP_INLINE_VISIBILITY |
| 282 | 310 | void clear() _NOEXCEPT |
| ... | ... | @@ -303,14 +331,6 @@ make_error_condition(errc __e) _NOEXCEPT |
| 303 | 331 | return error_condition(static_cast<int>(__e), generic_category()); |
| 304 | 332 | } |
| 305 | 333 | |
| 306 | inline _LIBCPP_INLINE_VISIBILITY | |
| 307 | bool | |
| 308 | operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT | |
| 309 | { | |
| 310 | return __x.category() < __y.category() | |
| 311 | || (__x.category() == __y.category() && __x.value() < __y.value()); | |
| 312 | } | |
| 313 | ||
| 314 | 334 | // error_code |
| 315 | 335 | |
| 316 | 336 | class _LIBCPP_TYPE_VIS error_code |
| ... | ... | @@ -330,7 +350,10 @@ public: |
| 330 | 350 | error_code(_Ep __e, |
| 331 | 351 | typename enable_if<is_error_code_enum<_Ep>::value>::type* = nullptr |
| 332 | 352 | ) _NOEXCEPT |
| 333 | {*this = make_error_code(__e);} | |
| 353 | { | |
| 354 | using __adl_only::make_error_code; | |
| 355 | *this = make_error_code(__e); | |
| 356 | } | |
| 334 | 357 | |
| 335 | 358 | _LIBCPP_INLINE_VISIBILITY |
| 336 | 359 | void assign(int __val, const error_category& __cat) _NOEXCEPT |
| ... | ... | @@ -347,7 +370,11 @@ public: |
| 347 | 370 | error_code& |
| 348 | 371 | >::type |
| 349 | 372 | operator=(_Ep __e) _NOEXCEPT |
| 350 | {*this = make_error_code(__e); return *this;} | |
| 373 | { | |
| 374 | using __adl_only::make_error_code; | |
| 375 | *this = make_error_code(__e); | |
| 376 | return *this; | |
| 377 | } | |
| 351 | 378 | |
| 352 | 379 | _LIBCPP_INLINE_VISIBILITY |
| 353 | 380 | void clear() _NOEXCEPT |
| ... | ... | @@ -379,14 +406,6 @@ make_error_code(errc __e) _NOEXCEPT |
| 379 | 406 | return error_code(static_cast<int>(__e), generic_category()); |
| 380 | 407 | } |
| 381 | 408 | |
| 382 | inline _LIBCPP_INLINE_VISIBILITY | |
| 383 | bool | |
| 384 | operator<(const error_code& __x, const error_code& __y) _NOEXCEPT | |
| 385 | { | |
| 386 | return __x.category() < __y.category() | |
| 387 | || (__x.category() == __y.category() && __x.value() < __y.value()); | |
| 388 | } | |
| 389 | ||
| 390 | 409 | inline _LIBCPP_INLINE_VISIBILITY |
| 391 | 410 | bool |
| 392 | 411 | operator==(const error_code& __x, const error_code& __y) _NOEXCEPT |
| ... | ... | @@ -402,12 +421,14 @@ operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT |
| 402 | 421 | || __y.category().equivalent(__x, __y.value()); |
| 403 | 422 | } |
| 404 | 423 | |
| 424 | #if _LIBCPP_STD_VER <= 17 | |
| 405 | 425 | inline _LIBCPP_INLINE_VISIBILITY |
| 406 | 426 | bool |
| 407 | 427 | operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT |
| 408 | 428 | { |
| 409 | 429 | return __y == __x; |
| 410 | 430 | } |
| 431 | #endif | |
| 411 | 432 | |
| 412 | 433 | inline _LIBCPP_INLINE_VISIBILITY |
| 413 | 434 | bool |
| ... | ... | @@ -416,6 +437,8 @@ operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT |
| 416 | 437 | return __x.category() == __y.category() && __x.value() == __y.value(); |
| 417 | 438 | } |
| 418 | 439 | |
| 440 | #if _LIBCPP_STD_VER <= 17 | |
| 441 | ||
| 419 | 442 | inline _LIBCPP_INLINE_VISIBILITY |
| 420 | 443 | bool |
| 421 | 444 | operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT |
| ... | ... | @@ -436,6 +459,42 @@ bool |
| 436 | 459 | operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT |
| 437 | 460 | {return !(__x == __y);} |
| 438 | 461 | |
| 462 | inline _LIBCPP_INLINE_VISIBILITY | |
| 463 | bool | |
| 464 | operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT | |
| 465 | { | |
| 466 | return __x.category() < __y.category() | |
| 467 | || (__x.category() == __y.category() && __x.value() < __y.value()); | |
| 468 | } | |
| 469 | ||
| 470 | inline _LIBCPP_INLINE_VISIBILITY | |
| 471 | bool | |
| 472 | operator<(const error_code& __x, const error_code& __y) _NOEXCEPT | |
| 473 | { | |
| 474 | return __x.category() < __y.category() | |
| 475 | || (__x.category() == __y.category() && __x.value() < __y.value()); | |
| 476 | } | |
| 477 | ||
| 478 | #else // _LIBCPP_STD_VER <= 17 | |
| 479 | ||
| 480 | inline _LIBCPP_HIDE_FROM_ABI strong_ordering | |
| 481 | operator<=>(const error_code& __x, const error_code& __y) noexcept | |
| 482 | { | |
| 483 | if (auto __c = __x.category() <=> __y.category(); __c != 0) | |
| 484 | return __c; | |
| 485 | return __x.value() <=> __y.value(); | |
| 486 | } | |
| 487 | ||
| 488 | inline _LIBCPP_HIDE_FROM_ABI strong_ordering | |
| 489 | operator<=>(const error_condition& __x, const error_condition& __y) noexcept | |
| 490 | { | |
| 491 | if (auto __c = __x.category() <=> __y.category(); __c != 0) | |
| 492 | return __c; | |
| 493 | return __x.value() <=> __y.value(); | |
| 494 | } | |
| 495 | ||
| 496 | #endif // _LIBCPP_STD_VER <= 17 | |
| 497 | ||
| 439 | 498 | template <> |
| 440 | 499 | struct _LIBCPP_TEMPLATE_VIS hash<error_code> |
| 441 | 500 | : public __unary_function<error_code, size_t> |
| ... | ... | @@ -472,7 +531,7 @@ public: |
| 472 | 531 | system_error(int __ev, const error_category& __ecat, const char* __what_arg); |
| 473 | 532 | system_error(int __ev, const error_category& __ecat); |
| 474 | 533 | system_error(const system_error&) _NOEXCEPT = default; |
| 475 | ~system_error() _NOEXCEPT; | |
| 534 | ~system_error() _NOEXCEPT override; | |
| 476 | 535 | |
| 477 | 536 | _LIBCPP_INLINE_VISIBILITY |
| 478 | 537 | const error_code& code() const _NOEXCEPT {return __ec_;} |
lib/libcxx/include/tgmath.h+6-8| ... | ... | @@ -24,13 +24,11 @@ |
| 24 | 24 | #endif |
| 25 | 25 | |
| 26 | 26 | #ifdef __cplusplus |
| 27 | ||
| 28 | #include <ctgmath> | |
| 29 | ||
| 30 | #else // __cplusplus | |
| 31 | ||
| 32 | #include_next <tgmath.h> | |
| 33 | ||
| 34 | #endif // __cplusplus | |
| 27 | # include <ctgmath> | |
| 28 | #else | |
| 29 | # if __has_include_next(<tgmath.h>) | |
| 30 | # include_next <tgmath.h> | |
| 31 | # endif | |
| 32 | #endif | |
| 35 | 33 | |
| 36 | 34 | #endif // _LIBCPP_TGMATH_H |
lib/libcxx/include/thread+22-16| ... | ... | @@ -53,11 +53,12 @@ public: |
| 53 | 53 | }; |
| 54 | 54 | |
| 55 | 55 | bool operator==(thread::id x, thread::id y) noexcept; |
| 56 | bool operator!=(thread::id x, thread::id y) noexcept; | |
| 57 | bool operator< (thread::id x, thread::id y) noexcept; | |
| 58 | bool operator<=(thread::id x, thread::id y) noexcept; | |
| 59 | bool operator> (thread::id x, thread::id y) noexcept; | |
| 60 | bool operator>=(thread::id x, thread::id y) noexcept; | |
| 56 | bool operator!=(thread::id x, thread::id y) noexcept; // removed in C++20 | |
| 57 | bool operator< (thread::id x, thread::id y) noexcept; // removed in C++20 | |
| 58 | bool operator<=(thread::id x, thread::id y) noexcept; // removed in C++20 | |
| 59 | bool operator> (thread::id x, thread::id y) noexcept; // removed in C++20 | |
| 60 | bool operator>=(thread::id x, thread::id y) noexcept; // removed in C++20 | |
| 61 | strong_ordering operator<=>(thread::id x, thread::id y) noexcept; // C++20 | |
| 61 | 62 | |
| 62 | 63 | template<class charT, class traits> |
| 63 | 64 | basic_ostream<charT, traits>& |
| ... | ... | @@ -85,6 +86,7 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); |
| 85 | 86 | #include <__assert> // all public C++ headers provide the assertion handler |
| 86 | 87 | #include <__config> |
| 87 | 88 | #include <__functional/hash.h> |
| 89 | #include <__memory/unique_ptr.h> | |
| 88 | 90 | #include <__mutex_base> |
| 89 | 91 | #include <__thread/poll_with_backoff.h> |
| 90 | 92 | #include <__thread/timed_backoff_policy.h> |
| ... | ... | @@ -92,18 +94,14 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); |
| 92 | 94 | #include <__utility/forward.h> |
| 93 | 95 | #include <cstddef> |
| 94 | 96 | #include <iosfwd> |
| 95 | #include <memory> | |
| 96 | 97 | #include <system_error> |
| 97 | 98 | #include <tuple> |
| 98 | 99 | #include <type_traits> |
| 99 | 100 | #include <version> |
| 100 | 101 | |
| 101 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 102 | # include <chrono> | |
| 103 | # include <functional> | |
| 104 | #endif | |
| 105 | ||
| 106 | 102 | // standard-mandated includes |
| 103 | ||
| 104 | // [thread.syn] | |
| 107 | 105 | #include <compare> |
| 108 | 106 | |
| 109 | 107 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -201,7 +199,7 @@ __thread_specific_ptr<_Tp>::set_pointer(pointer __p) |
| 201 | 199 | { |
| 202 | 200 | _LIBCPP_ASSERT(get() == nullptr, |
| 203 | 201 | "Attempting to overwrite thread local data"); |
| 204 | __libcpp_tls_set(__key_, __p); | |
| 202 | std::__libcpp_tls_set(__key_, __p); | |
| 205 | 203 | } |
| 206 | 204 | |
| 207 | 205 | template<> |
| ... | ... | @@ -235,7 +233,7 @@ public: |
| 235 | 233 | thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {} |
| 236 | 234 | #ifndef _LIBCPP_CXX03_LANG |
| 237 | 235 | template <class _Fp, class ..._Args, |
| 238 | class = __enable_if_t<!is_same<__uncvref_t<_Fp>, thread>::value> > | |
| 236 | class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value> > | |
| 239 | 237 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS |
| 240 | 238 | explicit thread(_Fp&& __f, _Args&&... __args); |
| 241 | 239 | #else // _LIBCPP_CXX03_LANG |
| ... | ... | @@ -328,7 +326,7 @@ struct __thread_invoke_pair { |
| 328 | 326 | }; |
| 329 | 327 | |
| 330 | 328 | template <class _Fp> |
| 331 | void* __thread_proxy_cxx03(void* __vp) | |
| 329 | _LIBCPP_HIDE_FROM_ABI void* __thread_proxy_cxx03(void* __vp) | |
| 332 | 330 | { |
| 333 | 331 | unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp)); |
| 334 | 332 | __thread_local_data().set_pointer(__p->__tsp_.release()); |
| ... | ... | @@ -361,7 +359,7 @@ namespace this_thread |
| 361 | 359 | _LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& __ns); |
| 362 | 360 | |
| 363 | 361 | template <class _Rep, class _Period> |
| 364 | void | |
| 362 | _LIBCPP_HIDE_FROM_ABI void | |
| 365 | 363 | sleep_for(const chrono::duration<_Rep, _Period>& __d) |
| 366 | 364 | { |
| 367 | 365 | if (__d > chrono::duration<_Rep, _Period>::zero()) |
| ... | ... | @@ -385,7 +383,7 @@ sleep_for(const chrono::duration<_Rep, _Period>& __d) |
| 385 | 383 | } |
| 386 | 384 | |
| 387 | 385 | template <class _Clock, class _Duration> |
| 388 | void | |
| 386 | _LIBCPP_HIDE_FROM_ABI void | |
| 389 | 387 | sleep_until(const chrono::time_point<_Clock, _Duration>& __t) |
| 390 | 388 | { |
| 391 | 389 | mutex __mut; |
| ... | ... | @@ -412,4 +410,12 @@ _LIBCPP_END_NAMESPACE_STD |
| 412 | 410 | |
| 413 | 411 | _LIBCPP_POP_MACROS |
| 414 | 412 | |
| 413 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 | |
| 414 | # include <chrono> | |
| 415 | #endif | |
| 416 | ||
| 417 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 418 | # include <functional> | |
| 419 | #endif | |
| 420 | ||
| 415 | 421 | #endif // _LIBCPP_THREAD |
lib/libcxx/include/tuple+162-126| ... | ... | @@ -205,10 +205,45 @@ template <class... Types> |
| 205 | 205 | #include <__compare/common_comparison_category.h> |
| 206 | 206 | #include <__compare/synth_three_way.h> |
| 207 | 207 | #include <__config> |
| 208 | #include <__functional/invoke.h> | |
| 208 | 209 | #include <__functional/unwrap_ref.h> |
| 210 | #include <__fwd/array.h> | |
| 209 | 211 | #include <__memory/allocator_arg_t.h> |
| 210 | 212 | #include <__memory/uses_allocator.h> |
| 211 | #include <__tuple> | |
| 213 | #include <__type_traits/apply_cv.h> | |
| 214 | #include <__type_traits/common_reference.h> | |
| 215 | #include <__type_traits/common_type.h> | |
| 216 | #include <__type_traits/conditional.h> | |
| 217 | #include <__type_traits/conjunction.h> | |
| 218 | #include <__type_traits/copy_cvref.h> | |
| 219 | #include <__type_traits/disjunction.h> | |
| 220 | #include <__type_traits/is_arithmetic.h> | |
| 221 | #include <__type_traits/is_assignable.h> | |
| 222 | #include <__type_traits/is_constructible.h> | |
| 223 | #include <__type_traits/is_convertible.h> | |
| 224 | #include <__type_traits/is_copy_assignable.h> | |
| 225 | #include <__type_traits/is_copy_constructible.h> | |
| 226 | #include <__type_traits/is_default_constructible.h> | |
| 227 | #include <__type_traits/is_empty.h> | |
| 228 | #include <__type_traits/is_final.h> | |
| 229 | #include <__type_traits/is_implicitly_default_constructible.h> | |
| 230 | #include <__type_traits/is_move_assignable.h> | |
| 231 | #include <__type_traits/is_move_constructible.h> | |
| 232 | #include <__type_traits/is_nothrow_assignable.h> | |
| 233 | #include <__type_traits/is_nothrow_constructible.h> | |
| 234 | #include <__type_traits/is_nothrow_copy_assignable.h> | |
| 235 | #include <__type_traits/is_nothrow_copy_constructible.h> | |
| 236 | #include <__type_traits/is_nothrow_default_constructible.h> | |
| 237 | #include <__type_traits/is_nothrow_move_assignable.h> | |
| 238 | #include <__type_traits/is_reference.h> | |
| 239 | #include <__type_traits/is_same.h> | |
| 240 | #include <__type_traits/is_swappable.h> | |
| 241 | #include <__type_traits/lazy.h> | |
| 242 | #include <__type_traits/maybe_const.h> | |
| 243 | #include <__type_traits/nat.h> | |
| 244 | #include <__type_traits/negation.h> | |
| 245 | #include <__type_traits/remove_cvref.h> | |
| 246 | #include <__type_traits/remove_reference.h> | |
| 212 | 247 | #include <__utility/forward.h> |
| 213 | 248 | #include <__utility/integer_sequence.h> |
| 214 | 249 | #include <__utility/move.h> |
| ... | ... | @@ -216,18 +251,11 @@ template <class... Types> |
| 216 | 251 | #include <__utility/piecewise_construct.h> |
| 217 | 252 | #include <__utility/swap.h> |
| 218 | 253 | #include <cstddef> |
| 219 | #include <type_traits> | |
| 220 | 254 | #include <version> |
| 221 | 255 | |
| 222 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 223 | # include <exception> | |
| 224 | # include <iosfwd> | |
| 225 | # include <new> | |
| 226 | # include <typeinfo> | |
| 227 | # include <utility> | |
| 228 | #endif | |
| 229 | ||
| 230 | 256 | // standard-mandated includes |
| 257 | ||
| 258 | // [tuple.syn] | |
| 231 | 259 | #include <compare> |
| 232 | 260 | |
| 233 | 261 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -247,7 +275,7 @@ template <size_t _Ip, class _Hp, |
| 247 | 275 | class __tuple_leaf; |
| 248 | 276 | |
| 249 | 277 | template <size_t _Ip, class _Hp, bool _Ep> |
| 250 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 278 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 251 | 279 | void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) |
| 252 | 280 | _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value) |
| 253 | 281 | { |
| ... | ... | @@ -255,7 +283,7 @@ void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) |
| 255 | 283 | } |
| 256 | 284 | |
| 257 | 285 | template <size_t _Ip, class _Hp, bool _Ep> |
| 258 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 286 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 259 | 287 | void swap(const __tuple_leaf<_Ip, _Hp, _Ep>& __x, const __tuple_leaf<_Ip, _Hp, _Ep>& __y) |
| 260 | 288 | _NOEXCEPT_(__is_nothrow_swappable<const _Hp>::value) { |
| 261 | 289 | swap(__x.get(), __y.get()); |
| ... | ... | @@ -275,7 +303,7 @@ class __tuple_leaf |
| 275 | 303 | #endif |
| 276 | 304 | } |
| 277 | 305 | |
| 278 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 306 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 279 | 307 | __tuple_leaf& operator=(const __tuple_leaf&); |
| 280 | 308 | public: |
| 281 | 309 | _LIBCPP_INLINE_VISIBILITY constexpr __tuple_leaf() |
| ... | ... | @@ -307,33 +335,33 @@ public: |
| 307 | 335 | template <class _Tp, |
| 308 | 336 | class = __enable_if_t< |
| 309 | 337 | _And< |
| 310 | _IsNotSame<__uncvref_t<_Tp>, __tuple_leaf>, | |
| 338 | _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, | |
| 311 | 339 | is_constructible<_Hp, _Tp> |
| 312 | 340 | >::value |
| 313 | 341 | > |
| 314 | 342 | > |
| 315 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 343 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 316 | 344 | explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) |
| 317 | 345 | : __value_(_VSTD::forward<_Tp>(__t)) |
| 318 | 346 | {static_assert(__can_bind_reference<_Tp&&>(), |
| 319 | 347 | "Attempted construction of reference element binds to a temporary whose lifetime has ended");} |
| 320 | 348 | |
| 321 | 349 | template <class _Tp, class _Alloc> |
| 322 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 350 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 323 | 351 | explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t) |
| 324 | 352 | : __value_(_VSTD::forward<_Tp>(__t)) |
| 325 | 353 | {static_assert(__can_bind_reference<_Tp&&>(), |
| 326 | 354 | "Attempted construction of reference element binds to a temporary whose lifetime has ended");} |
| 327 | 355 | |
| 328 | 356 | template <class _Tp, class _Alloc> |
| 329 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 357 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 330 | 358 | explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t) |
| 331 | 359 | : __value_(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) |
| 332 | 360 | {static_assert(!is_reference<_Hp>::value, |
| 333 | 361 | "Attempted to uses-allocator construct a reference element in a tuple");} |
| 334 | 362 | |
| 335 | 363 | template <class _Tp, class _Alloc> |
| 336 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 364 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 337 | 365 | explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t) |
| 338 | 366 | : __value_(_VSTD::forward<_Tp>(__t), __a) |
| 339 | 367 | {static_assert(!is_reference<_Hp>::value, |
| ... | ... | @@ -342,28 +370,28 @@ public: |
| 342 | 370 | __tuple_leaf(const __tuple_leaf& __t) = default; |
| 343 | 371 | __tuple_leaf(__tuple_leaf&& __t) = default; |
| 344 | 372 | |
| 345 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 373 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 346 | 374 | int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) |
| 347 | 375 | { |
| 348 | 376 | _VSTD::swap(*this, __t); |
| 349 | 377 | return 0; |
| 350 | 378 | } |
| 351 | 379 | |
| 352 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 380 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 353 | 381 | int swap(const __tuple_leaf& __t) const _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) { |
| 354 | 382 | _VSTD::swap(*this, __t); |
| 355 | 383 | return 0; |
| 356 | 384 | } |
| 357 | 385 | |
| 358 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return __value_;} | |
| 359 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return __value_;} | |
| 386 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT {return __value_;} | |
| 387 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT {return __value_;} | |
| 360 | 388 | }; |
| 361 | 389 | |
| 362 | 390 | template <size_t _Ip, class _Hp> |
| 363 | 391 | class __tuple_leaf<_Ip, _Hp, true> |
| 364 | 392 | : private _Hp |
| 365 | 393 | { |
| 366 | _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 394 | _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 367 | 395 | __tuple_leaf& operator=(const __tuple_leaf&); |
| 368 | 396 | public: |
| 369 | 397 | _LIBCPP_INLINE_VISIBILITY constexpr __tuple_leaf() |
| ... | ... | @@ -386,12 +414,12 @@ public: |
| 386 | 414 | template <class _Tp, |
| 387 | 415 | class = __enable_if_t< |
| 388 | 416 | _And< |
| 389 | _IsNotSame<__uncvref_t<_Tp>, __tuple_leaf>, | |
| 417 | _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, | |
| 390 | 418 | is_constructible<_Hp, _Tp> |
| 391 | 419 | >::value |
| 392 | 420 | > |
| 393 | 421 | > |
| 394 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 422 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 395 | 423 | explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) |
| 396 | 424 | : _Hp(_VSTD::forward<_Tp>(__t)) {} |
| 397 | 425 | |
| ... | ... | @@ -413,7 +441,7 @@ public: |
| 413 | 441 | __tuple_leaf(__tuple_leaf const &) = default; |
| 414 | 442 | __tuple_leaf(__tuple_leaf &&) = default; |
| 415 | 443 | |
| 416 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 444 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 417 | 445 | int |
| 418 | 446 | swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) |
| 419 | 447 | { |
| ... | ... | @@ -421,18 +449,18 @@ public: |
| 421 | 449 | return 0; |
| 422 | 450 | } |
| 423 | 451 | |
| 424 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 452 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 425 | 453 | int swap(const __tuple_leaf& __rhs) const _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) { |
| 426 | 454 | _VSTD::swap(*this, __rhs); |
| 427 | 455 | return 0; |
| 428 | 456 | } |
| 429 | 457 | |
| 430 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);} | |
| 431 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);} | |
| 458 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);} | |
| 459 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);} | |
| 432 | 460 | }; |
| 433 | 461 | |
| 434 | 462 | template <class ..._Tp> |
| 435 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 463 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 436 | 464 | void __swallow(_Tp&&...) _NOEXCEPT {} |
| 437 | 465 | |
| 438 | 466 | template <class _Tp> |
| ... | ... | @@ -457,7 +485,7 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. |
| 457 | 485 | |
| 458 | 486 | template <size_t ..._Uf, class ..._Tf, |
| 459 | 487 | size_t ..._Ul, class ..._Tl, class ..._Up> |
| 460 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 488 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 461 | 489 | explicit |
| 462 | 490 | __tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>, |
| 463 | 491 | __tuple_indices<_Ul...>, __tuple_types<_Tl...>, |
| ... | ... | @@ -470,7 +498,7 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. |
| 470 | 498 | |
| 471 | 499 | template <class _Alloc, size_t ..._Uf, class ..._Tf, |
| 472 | 500 | size_t ..._Ul, class ..._Tl, class ..._Up> |
| 473 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 501 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 474 | 502 | explicit |
| 475 | 503 | __tuple_impl(allocator_arg_t, const _Alloc& __a, |
| 476 | 504 | __tuple_indices<_Uf...>, __tuple_types<_Tf...>, |
| ... | ... | @@ -484,7 +512,7 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. |
| 484 | 512 | template <class _Tuple, |
| 485 | 513 | class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value> |
| 486 | 514 | > |
| 487 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 515 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 488 | 516 | __tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx, |
| 489 | 517 | typename __make_tuple_types<_Tuple>::type>::type>::value...>::value)) |
| 490 | 518 | : __tuple_leaf<_Indx, _Tp>(_VSTD::forward<typename tuple_element<_Indx, |
| ... | ... | @@ -494,7 +522,7 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. |
| 494 | 522 | template <class _Alloc, class _Tuple, |
| 495 | 523 | class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value> |
| 496 | 524 | > |
| 497 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 525 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 498 | 526 | __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) |
| 499 | 527 | : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx, |
| 500 | 528 | typename __make_tuple_types<_Tuple>::type>::type>(), __a, |
| ... | ... | @@ -505,14 +533,14 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. |
| 505 | 533 | __tuple_impl(const __tuple_impl&) = default; |
| 506 | 534 | __tuple_impl(__tuple_impl&&) = default; |
| 507 | 535 | |
| 508 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 536 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 509 | 537 | void swap(__tuple_impl& __t) |
| 510 | 538 | _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) |
| 511 | 539 | { |
| 512 | 540 | _VSTD::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...); |
| 513 | 541 | } |
| 514 | 542 | |
| 515 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 543 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 516 | 544 | void swap(const __tuple_impl& __t) const |
| 517 | 545 | _NOEXCEPT_(__all<__is_nothrow_swappable<const _Tp>::value...>::value) |
| 518 | 546 | { |
| ... | ... | @@ -521,13 +549,13 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. |
| 521 | 549 | }; |
| 522 | 550 | |
| 523 | 551 | template<class _Dest, class _Source, size_t ..._Np> |
| 524 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 552 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 525 | 553 | void __memberwise_copy_assign(_Dest& __dest, _Source const& __source, __tuple_indices<_Np...>) { |
| 526 | 554 | _VSTD::__swallow(((_VSTD::get<_Np>(__dest) = _VSTD::get<_Np>(__source)), void(), 0)...); |
| 527 | 555 | } |
| 528 | 556 | |
| 529 | 557 | template<class _Dest, class _Source, class ..._Up, size_t ..._Np> |
| 530 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 558 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 531 | 559 | void __memberwise_forward_assign(_Dest& __dest, _Source&& __source, __tuple_types<_Up...>, __tuple_indices<_Np...>) { |
| 532 | 560 | _VSTD::__swallow((( |
| 533 | 561 | _VSTD::get<_Np>(__dest) = _VSTD::forward<_Up>(_VSTD::get<_Np>(__source)) |
| ... | ... | @@ -541,13 +569,13 @@ class _LIBCPP_TEMPLATE_VIS tuple |
| 541 | 569 | |
| 542 | 570 | _BaseT __base_; |
| 543 | 571 | |
| 544 | template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 572 | template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 545 | 573 | typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT; |
| 546 | template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 574 | template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 547 | 575 | const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT; |
| 548 | template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 576 | template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 549 | 577 | typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT; |
| 550 | template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 578 | template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 551 | 579 | const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT; |
| 552 | 580 | public: |
| 553 | 581 | // [tuple.cnstr] |
| ... | ... | @@ -580,7 +608,7 @@ public: |
| 580 | 608 | _IsImpDefault<_Tp>... // explicit check |
| 581 | 609 | >::value |
| 582 | 610 | , int> = 0> |
| 583 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 611 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 584 | 612 | tuple(allocator_arg_t, _Alloc const& __a) |
| 585 | 613 | : __base_(allocator_arg_t(), __a, |
| 586 | 614 | __tuple_indices<>(), __tuple_types<>(), |
| ... | ... | @@ -595,7 +623,7 @@ public: |
| 595 | 623 | _Not<_Lazy<_And, _IsImpDefault<_Tp>...> > // explicit check |
| 596 | 624 | >::value |
| 597 | 625 | , int> = 0> |
| 598 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 626 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 599 | 627 | explicit tuple(allocator_arg_t, _Alloc const& __a) |
| 600 | 628 | : __base_(allocator_arg_t(), __a, |
| 601 | 629 | __tuple_indices<>(), __tuple_types<>(), |
| ... | ... | @@ -610,7 +638,7 @@ public: |
| 610 | 638 | is_convertible<const _Tp&, _Tp>... // explicit check |
| 611 | 639 | >::value |
| 612 | 640 | , int> = 0> |
| 613 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 641 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 614 | 642 | tuple(const _Tp& ... __t) |
| 615 | 643 | _NOEXCEPT_(_And<is_nothrow_copy_constructible<_Tp>...>::value) |
| 616 | 644 | : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(), |
| ... | ... | @@ -627,7 +655,7 @@ public: |
| 627 | 655 | _Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> > // explicit check |
| 628 | 656 | >::value |
| 629 | 657 | , int> = 0> |
| 630 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 658 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 631 | 659 | explicit tuple(const _Tp& ... __t) |
| 632 | 660 | _NOEXCEPT_(_And<is_nothrow_copy_constructible<_Tp>...>::value) |
| 633 | 661 | : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(), |
| ... | ... | @@ -644,7 +672,7 @@ public: |
| 644 | 672 | is_convertible<const _Tp&, _Tp>... // explicit check |
| 645 | 673 | >::value |
| 646 | 674 | , int> = 0> |
| 647 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 675 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 648 | 676 | tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) |
| 649 | 677 | : __base_(allocator_arg_t(), __a, |
| 650 | 678 | typename __make_tuple_indices<sizeof...(_Tp)>::type(), |
| ... | ... | @@ -661,7 +689,7 @@ public: |
| 661 | 689 | _Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> > // explicit check |
| 662 | 690 | >::value |
| 663 | 691 | , int> = 0> |
| 664 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 692 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 665 | 693 | explicit tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) |
| 666 | 694 | : __base_(allocator_arg_t(), __a, |
| 667 | 695 | typename __make_tuple_indices<sizeof...(_Tp)>::type(), |
| ... | ... | @@ -673,7 +701,7 @@ public: |
| 673 | 701 | |
| 674 | 702 | // tuple(U&& ...) constructors (including allocator_arg_t variants) |
| 675 | 703 | template <class ..._Up> struct _IsThisTuple : false_type { }; |
| 676 | template <class _Up> struct _IsThisTuple<_Up> : is_same<__uncvref_t<_Up>, tuple> { }; | |
| 704 | template <class _Up> struct _IsThisTuple<_Up> : is_same<__remove_cvref_t<_Up>, tuple> { }; | |
| 677 | 705 | |
| 678 | 706 | template <class ..._Up> |
| 679 | 707 | struct _EnableUTypesCtor : _And< |
| ... | ... | @@ -689,7 +717,7 @@ public: |
| 689 | 717 | is_convertible<_Up, _Tp>... // explicit check |
| 690 | 718 | >::value |
| 691 | 719 | , int> = 0> |
| 692 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 720 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 693 | 721 | tuple(_Up&&... __u) |
| 694 | 722 | _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value)) |
| 695 | 723 | : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), |
| ... | ... | @@ -705,7 +733,7 @@ public: |
| 705 | 733 | _Not<_Lazy<_And, is_convertible<_Up, _Tp>...> > // explicit check |
| 706 | 734 | >::value |
| 707 | 735 | , int> = 0> |
| 708 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 736 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 709 | 737 | explicit tuple(_Up&&... __u) |
| 710 | 738 | _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value)) |
| 711 | 739 | : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), |
| ... | ... | @@ -721,7 +749,7 @@ public: |
| 721 | 749 | is_convertible<_Up, _Tp>... // explicit check |
| 722 | 750 | >::value |
| 723 | 751 | , int> = 0> |
| 724 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 752 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 725 | 753 | tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) |
| 726 | 754 | : __base_(allocator_arg_t(), __a, |
| 727 | 755 | typename __make_tuple_indices<sizeof...(_Up)>::type(), |
| ... | ... | @@ -737,7 +765,7 @@ public: |
| 737 | 765 | _Not<_Lazy<_And, is_convertible<_Up, _Tp>...> > // explicit check |
| 738 | 766 | >::value |
| 739 | 767 | , int> = 0> |
| 740 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 768 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 741 | 769 | explicit tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) |
| 742 | 770 | : __base_(allocator_arg_t(), __a, |
| 743 | 771 | typename __make_tuple_indices<sizeof...(_Up)>::type(), |
| ... | ... | @@ -753,7 +781,7 @@ public: |
| 753 | 781 | template <class _Alloc, template<class...> class _And = _And, __enable_if_t< |
| 754 | 782 | _And<is_copy_constructible<_Tp>...>::value |
| 755 | 783 | , int> = 0> |
| 756 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 784 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 757 | 785 | tuple(allocator_arg_t, const _Alloc& __alloc, const tuple& __t) |
| 758 | 786 | : __base_(allocator_arg_t(), __alloc, __t) |
| 759 | 787 | { } |
| ... | ... | @@ -761,14 +789,14 @@ public: |
| 761 | 789 | template <class _Alloc, template<class...> class _And = _And, __enable_if_t< |
| 762 | 790 | _And<is_move_constructible<_Tp>...>::value |
| 763 | 791 | , int> = 0> |
| 764 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 792 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 765 | 793 | tuple(allocator_arg_t, const _Alloc& __alloc, tuple&& __t) |
| 766 | 794 | : __base_(allocator_arg_t(), __alloc, _VSTD::move(__t)) |
| 767 | 795 | { } |
| 768 | 796 | |
| 769 | 797 | // tuple(const tuple<U...>&) constructors (including allocator_arg_t variants) |
| 770 | 798 | |
| 771 | template <class _OtherTuple, class _DecayedOtherTuple = __uncvref_t<_OtherTuple>, class = void> | |
| 799 | template <class _OtherTuple, class _DecayedOtherTuple = __remove_cvref_t<_OtherTuple>, class = void> | |
| 772 | 800 | struct _EnableCtorFromUTypesTuple : false_type {}; |
| 773 | 801 | |
| 774 | 802 | template <class _OtherTuple, class... _Up> |
| ... | ... | @@ -797,7 +825,7 @@ public: |
| 797 | 825 | is_convertible<const _Up&, _Tp>... // explicit check |
| 798 | 826 | >::value |
| 799 | 827 | , int> = 0> |
| 800 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 828 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 801 | 829 | tuple(const tuple<_Up...>& __t) |
| 802 | 830 | _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, const _Up&>...>::value)) |
| 803 | 831 | : __base_(__t) |
| ... | ... | @@ -809,7 +837,7 @@ public: |
| 809 | 837 | _Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> > // explicit check |
| 810 | 838 | >::value |
| 811 | 839 | , int> = 0> |
| 812 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 840 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 813 | 841 | explicit tuple(const tuple<_Up...>& __t) |
| 814 | 842 | _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, const _Up&>...>::value)) |
| 815 | 843 | : __base_(__t) |
| ... | ... | @@ -821,7 +849,7 @@ public: |
| 821 | 849 | is_convertible<const _Up&, _Tp>... // explicit check |
| 822 | 850 | >::value |
| 823 | 851 | , int> = 0> |
| 824 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 852 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 825 | 853 | tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t) |
| 826 | 854 | : __base_(allocator_arg_t(), __a, __t) |
| 827 | 855 | { } |
| ... | ... | @@ -832,7 +860,7 @@ public: |
| 832 | 860 | _Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> > // explicit check |
| 833 | 861 | >::value |
| 834 | 862 | , int> = 0> |
| 835 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 863 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 836 | 864 | explicit tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t) |
| 837 | 865 | : __base_(allocator_arg_t(), __a, __t) |
| 838 | 866 | { } |
| ... | ... | @@ -861,7 +889,7 @@ public: |
| 861 | 889 | is_convertible<_Up, _Tp>... // explicit check |
| 862 | 890 | >::value |
| 863 | 891 | , int> = 0> |
| 864 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 892 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 865 | 893 | tuple(tuple<_Up...>&& __t) |
| 866 | 894 | _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value)) |
| 867 | 895 | : __base_(_VSTD::move(__t)) |
| ... | ... | @@ -873,7 +901,7 @@ public: |
| 873 | 901 | _Not<_Lazy<_And, is_convertible<_Up, _Tp>...> > // explicit check |
| 874 | 902 | >::value |
| 875 | 903 | , int> = 0> |
| 876 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 904 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 877 | 905 | explicit tuple(tuple<_Up...>&& __t) |
| 878 | 906 | _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value)) |
| 879 | 907 | : __base_(_VSTD::move(__t)) |
| ... | ... | @@ -885,7 +913,7 @@ public: |
| 885 | 913 | is_convertible<_Up, _Tp>... // explicit check |
| 886 | 914 | >::value |
| 887 | 915 | , int> = 0> |
| 888 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 916 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 889 | 917 | tuple(allocator_arg_t, const _Alloc& __a, tuple<_Up...>&& __t) |
| 890 | 918 | : __base_(allocator_arg_t(), __a, _VSTD::move(__t)) |
| 891 | 919 | { } |
| ... | ... | @@ -896,7 +924,7 @@ public: |
| 896 | 924 | _Not<_Lazy<_And, is_convertible<_Up, _Tp>...> > // explicit check |
| 897 | 925 | >::value |
| 898 | 926 | , int> = 0> |
| 899 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 927 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 900 | 928 | explicit tuple(allocator_arg_t, const _Alloc& __a, tuple<_Up...>&& __t) |
| 901 | 929 | : __base_(allocator_arg_t(), __a, _VSTD::move(__t)) |
| 902 | 930 | { } |
| ... | ... | @@ -920,7 +948,7 @@ public: |
| 920 | 948 | |
| 921 | 949 | // tuple(const pair<U1, U2>&) constructors (including allocator_arg_t variants) |
| 922 | 950 | |
| 923 | template <template <class...> class Pred, class _Pair, class _DecayedPair = __uncvref_t<_Pair>, class _Tuple = tuple> | |
| 951 | template <template <class...> class Pred, class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple> | |
| 924 | 952 | struct _CtorPredicateFromPair : false_type{}; |
| 925 | 953 | |
| 926 | 954 | template <template <class...> class Pred, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2> |
| ... | ... | @@ -935,7 +963,7 @@ public: |
| 935 | 963 | template <class _Pair> |
| 936 | 964 | struct _NothrowConstructibleFromPair : _CtorPredicateFromPair<is_nothrow_constructible, _Pair>{}; |
| 937 | 965 | |
| 938 | template <class _Pair, class _DecayedPair = __uncvref_t<_Pair>, class _Tuple = tuple> | |
| 966 | template <class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple> | |
| 939 | 967 | struct _BothImplicitlyConvertible : false_type{}; |
| 940 | 968 | |
| 941 | 969 | template <class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2> |
| ... | ... | @@ -950,7 +978,7 @@ public: |
| 950 | 978 | _BothImplicitlyConvertible<const pair<_Up1, _Up2>&> // explicit check |
| 951 | 979 | >::value |
| 952 | 980 | , int> = 0> |
| 953 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 981 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 954 | 982 | tuple(const pair<_Up1, _Up2>& __p) |
| 955 | 983 | _NOEXCEPT_((_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value)) |
| 956 | 984 | : __base_(__p) |
| ... | ... | @@ -962,7 +990,7 @@ public: |
| 962 | 990 | _Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> > // explicit check |
| 963 | 991 | >::value |
| 964 | 992 | , int> = 0> |
| 965 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 993 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 966 | 994 | explicit tuple(const pair<_Up1, _Up2>& __p) |
| 967 | 995 | _NOEXCEPT_((_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value)) |
| 968 | 996 | : __base_(__p) |
| ... | ... | @@ -974,7 +1002,7 @@ public: |
| 974 | 1002 | _BothImplicitlyConvertible<const pair<_Up1, _Up2>&> // explicit check |
| 975 | 1003 | >::value |
| 976 | 1004 | , int> = 0> |
| 977 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1005 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 978 | 1006 | tuple(allocator_arg_t, const _Alloc& __a, const pair<_Up1, _Up2>& __p) |
| 979 | 1007 | : __base_(allocator_arg_t(), __a, __p) |
| 980 | 1008 | { } |
| ... | ... | @@ -985,7 +1013,7 @@ public: |
| 985 | 1013 | _Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> > // explicit check |
| 986 | 1014 | >::value |
| 987 | 1015 | , int> = 0> |
| 988 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1016 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 989 | 1017 | explicit tuple(allocator_arg_t, const _Alloc& __a, const pair<_Up1, _Up2>& __p) |
| 990 | 1018 | : __base_(allocator_arg_t(), __a, __p) |
| 991 | 1019 | { } |
| ... | ... | @@ -1014,7 +1042,7 @@ public: |
| 1014 | 1042 | _BothImplicitlyConvertible<pair<_Up1, _Up2>&&> // explicit check |
| 1015 | 1043 | >::value |
| 1016 | 1044 | , int> = 0> |
| 1017 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1045 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1018 | 1046 | tuple(pair<_Up1, _Up2>&& __p) |
| 1019 | 1047 | _NOEXCEPT_((_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value)) |
| 1020 | 1048 | : __base_(_VSTD::move(__p)) |
| ... | ... | @@ -1026,7 +1054,7 @@ public: |
| 1026 | 1054 | _Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> > // explicit check |
| 1027 | 1055 | >::value |
| 1028 | 1056 | , int> = 0> |
| 1029 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1057 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1030 | 1058 | explicit tuple(pair<_Up1, _Up2>&& __p) |
| 1031 | 1059 | _NOEXCEPT_((_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value)) |
| 1032 | 1060 | : __base_(_VSTD::move(__p)) |
| ... | ... | @@ -1038,7 +1066,7 @@ public: |
| 1038 | 1066 | _BothImplicitlyConvertible<pair<_Up1, _Up2>&&> // explicit check |
| 1039 | 1067 | >::value |
| 1040 | 1068 | , int> = 0> |
| 1041 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1069 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1042 | 1070 | tuple(allocator_arg_t, const _Alloc& __a, pair<_Up1, _Up2>&& __p) |
| 1043 | 1071 | : __base_(allocator_arg_t(), __a, _VSTD::move(__p)) |
| 1044 | 1072 | { } |
| ... | ... | @@ -1049,7 +1077,7 @@ public: |
| 1049 | 1077 | _Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> > // explicit check |
| 1050 | 1078 | >::value |
| 1051 | 1079 | , int> = 0> |
| 1052 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1080 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1053 | 1081 | explicit tuple(allocator_arg_t, const _Alloc& __a, pair<_Up1, _Up2>&& __p) |
| 1054 | 1082 | : __base_(allocator_arg_t(), __a, _VSTD::move(__p)) |
| 1055 | 1083 | { } |
| ... | ... | @@ -1072,7 +1100,7 @@ public: |
| 1072 | 1100 | #endif // _LIBCPP_STD_VER > 20 |
| 1073 | 1101 | |
| 1074 | 1102 | // [tuple.assign] |
| 1075 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1103 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1076 | 1104 | tuple& operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple) |
| 1077 | 1105 | _NOEXCEPT_((_And<is_nothrow_copy_assignable<_Tp>...>::value)) |
| 1078 | 1106 | { |
| ... | ... | @@ -1100,7 +1128,7 @@ public: |
| 1100 | 1128 | } |
| 1101 | 1129 | #endif // _LIBCPP_STD_VER > 20 |
| 1102 | 1130 | |
| 1103 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1131 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1104 | 1132 | tuple& operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple) |
| 1105 | 1133 | _NOEXCEPT_((_And<is_nothrow_move_assignable<_Tp>...>::value)) |
| 1106 | 1134 | { |
| ... | ... | @@ -1116,7 +1144,7 @@ public: |
| 1116 | 1144 | is_assignable<_Tp&, _Up const&>... |
| 1117 | 1145 | >::value |
| 1118 | 1146 | ,int> = 0> |
| 1119 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1147 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1120 | 1148 | tuple& operator=(tuple<_Up...> const& __tuple) |
| 1121 | 1149 | _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value)) |
| 1122 | 1150 | { |
| ... | ... | @@ -1131,7 +1159,7 @@ public: |
| 1131 | 1159 | is_assignable<_Tp&, _Up>... |
| 1132 | 1160 | >::value |
| 1133 | 1161 | ,int> = 0> |
| 1134 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1162 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1135 | 1163 | tuple& operator=(tuple<_Up...>&& __tuple) |
| 1136 | 1164 | _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value)) |
| 1137 | 1165 | { |
| ... | ... | @@ -1168,7 +1196,7 @@ public: |
| 1168 | 1196 | #endif // _LIBCPP_STD_VER > 20 |
| 1169 | 1197 | |
| 1170 | 1198 | template <template<class...> class Pred, bool _Const, |
| 1171 | class _Pair, class _DecayedPair = __uncvref_t<_Pair>, class _Tuple = tuple> | |
| 1199 | class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple> | |
| 1172 | 1200 | struct _AssignPredicateFromPair : false_type {}; |
| 1173 | 1201 | |
| 1174 | 1202 | template <template<class...> class Pred, bool _Const, |
| ... | ... | @@ -1209,7 +1237,7 @@ public: |
| 1209 | 1237 | template<class _Up1, class _Up2, __enable_if_t< |
| 1210 | 1238 | _EnableAssignFromPair<false, pair<_Up1, _Up2> const&>::value |
| 1211 | 1239 | ,int> = 0> |
| 1212 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1240 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1213 | 1241 | tuple& operator=(pair<_Up1, _Up2> const& __pair) |
| 1214 | 1242 | _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value)) |
| 1215 | 1243 | { |
| ... | ... | @@ -1221,7 +1249,7 @@ public: |
| 1221 | 1249 | template<class _Up1, class _Up2, __enable_if_t< |
| 1222 | 1250 | _EnableAssignFromPair<false, pair<_Up1, _Up2>&&>::value |
| 1223 | 1251 | ,int> = 0> |
| 1224 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1252 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1225 | 1253 | tuple& operator=(pair<_Up1, _Up2>&& __pair) |
| 1226 | 1254 | _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value)) |
| 1227 | 1255 | { |
| ... | ... | @@ -1237,7 +1265,7 @@ public: |
| 1237 | 1265 | is_assignable<_Tp&, _Up const&>... |
| 1238 | 1266 | >::value |
| 1239 | 1267 | > > |
| 1240 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1268 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1241 | 1269 | tuple& operator=(array<_Up, _Np> const& __array) |
| 1242 | 1270 | _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value)) |
| 1243 | 1271 | { |
| ... | ... | @@ -1253,7 +1281,7 @@ public: |
| 1253 | 1281 | is_assignable<_Tp&, _Up>... |
| 1254 | 1282 | >::value |
| 1255 | 1283 | > > |
| 1256 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1284 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1257 | 1285 | tuple& operator=(array<_Up, _Np>&& __array) |
| 1258 | 1286 | _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value)) |
| 1259 | 1287 | { |
| ... | ... | @@ -1264,7 +1292,7 @@ public: |
| 1264 | 1292 | } |
| 1265 | 1293 | |
| 1266 | 1294 | // [tuple.swap] |
| 1267 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1295 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1268 | 1296 | void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) |
| 1269 | 1297 | {__base_.swap(__t.__base_);} |
| 1270 | 1298 | |
| ... | ... | @@ -1283,18 +1311,18 @@ public: |
| 1283 | 1311 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 1284 | 1312 | tuple() _NOEXCEPT = default; |
| 1285 | 1313 | template <class _Alloc> |
| 1286 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1314 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1287 | 1315 | tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {} |
| 1288 | 1316 | template <class _Alloc> |
| 1289 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1317 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1290 | 1318 | tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {} |
| 1291 | 1319 | template <class _Up> |
| 1292 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1320 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1293 | 1321 | tuple(array<_Up, 0>) _NOEXCEPT {} |
| 1294 | 1322 | template <class _Alloc, class _Up> |
| 1295 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1323 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1296 | 1324 | tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {} |
| 1297 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1325 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1298 | 1326 | void swap(tuple&) _NOEXCEPT {} |
| 1299 | 1327 | #if _LIBCPP_STD_VER > 20 |
| 1300 | 1328 | _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple&) const noexcept {} |
| ... | ... | @@ -1329,7 +1357,7 @@ tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>; |
| 1329 | 1357 | #endif |
| 1330 | 1358 | |
| 1331 | 1359 | template <class ..._Tp> |
| 1332 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1360 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1333 | 1361 | __enable_if_t<__all<__is_swappable<_Tp>::value...>::value, void> |
| 1334 | 1362 | swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) |
| 1335 | 1363 | _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) |
| ... | ... | @@ -1348,7 +1376,7 @@ swap(const tuple<_Tp...>& __lhs, const tuple<_Tp...>& __rhs) |
| 1348 | 1376 | // get |
| 1349 | 1377 | |
| 1350 | 1378 | template <size_t _Ip, class ..._Tp> |
| 1351 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1379 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1352 | 1380 | typename tuple_element<_Ip, tuple<_Tp...> >::type& |
| 1353 | 1381 | get(tuple<_Tp...>& __t) _NOEXCEPT |
| 1354 | 1382 | { |
| ... | ... | @@ -1357,7 +1385,7 @@ get(tuple<_Tp...>& __t) _NOEXCEPT |
| 1357 | 1385 | } |
| 1358 | 1386 | |
| 1359 | 1387 | template <size_t _Ip, class ..._Tp> |
| 1360 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1388 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1361 | 1389 | const typename tuple_element<_Ip, tuple<_Tp...> >::type& |
| 1362 | 1390 | get(const tuple<_Tp...>& __t) _NOEXCEPT |
| 1363 | 1391 | { |
| ... | ... | @@ -1366,7 +1394,7 @@ get(const tuple<_Tp...>& __t) _NOEXCEPT |
| 1366 | 1394 | } |
| 1367 | 1395 | |
| 1368 | 1396 | template <size_t _Ip, class ..._Tp> |
| 1369 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1397 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1370 | 1398 | typename tuple_element<_Ip, tuple<_Tp...> >::type&& |
| 1371 | 1399 | get(tuple<_Tp...>&& __t) _NOEXCEPT |
| 1372 | 1400 | { |
| ... | ... | @@ -1376,7 +1404,7 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT |
| 1376 | 1404 | } |
| 1377 | 1405 | |
| 1378 | 1406 | template <size_t _Ip, class ..._Tp> |
| 1379 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1407 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1380 | 1408 | const typename tuple_element<_Ip, tuple<_Tp...> >::type&& |
| 1381 | 1409 | get(const tuple<_Tp...>&& __t) _NOEXCEPT |
| 1382 | 1410 | { |
| ... | ... | @@ -1402,7 +1430,7 @@ template <size_t _Nx> |
| 1402 | 1430 | inline _LIBCPP_INLINE_VISIBILITY |
| 1403 | 1431 | constexpr size_t __find_idx(size_t __i, const bool (&__matches)[_Nx]) { |
| 1404 | 1432 | return __i == _Nx ? __not_found : |
| 1405 | __find_idx_return(__i, __find_idx(__i + 1, __matches), __matches[__i]); | |
| 1433 | __find_detail::__find_idx_return(__i, __find_detail::__find_idx(__i + 1, __matches), __matches[__i]); | |
| 1406 | 1434 | } |
| 1407 | 1435 | |
| 1408 | 1436 | template <class _T1, class ..._Args> |
| ... | ... | @@ -1458,7 +1486,7 @@ constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept |
| 1458 | 1486 | // tie |
| 1459 | 1487 | |
| 1460 | 1488 | template <class ..._Tp> |
| 1461 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1489 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1462 | 1490 | tuple<_Tp&...> |
| 1463 | 1491 | tie(_Tp&... __t) _NOEXCEPT |
| 1464 | 1492 | { |
| ... | ... | @@ -1469,7 +1497,7 @@ template <class _Up> |
| 1469 | 1497 | struct __ignore_t |
| 1470 | 1498 | { |
| 1471 | 1499 | template <class _Tp> |
| 1472 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1500 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1473 | 1501 | const __ignore_t& operator=(_Tp&&) const {return *this;} |
| 1474 | 1502 | }; |
| 1475 | 1503 | |
| ... | ... | @@ -1478,7 +1506,7 @@ namespace { |
| 1478 | 1506 | } // namespace |
| 1479 | 1507 | |
| 1480 | 1508 | template <class... _Tp> |
| 1481 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1509 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1482 | 1510 | tuple<typename __unwrap_ref_decay<_Tp>::type...> |
| 1483 | 1511 | make_tuple(_Tp&&... __t) |
| 1484 | 1512 | { |
| ... | ... | @@ -1486,7 +1514,7 @@ make_tuple(_Tp&&... __t) |
| 1486 | 1514 | } |
| 1487 | 1515 | |
| 1488 | 1516 | template <class... _Tp> |
| 1489 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1517 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1490 | 1518 | tuple<_Tp&&...> |
| 1491 | 1519 | forward_as_tuple(_Tp&&... __t) _NOEXCEPT |
| 1492 | 1520 | { |
| ... | ... | @@ -1497,7 +1525,7 @@ template <size_t _Ip> |
| 1497 | 1525 | struct __tuple_equal |
| 1498 | 1526 | { |
| 1499 | 1527 | template <class _Tp, class _Up> |
| 1500 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1528 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1501 | 1529 | bool operator()(const _Tp& __x, const _Up& __y) |
| 1502 | 1530 | { |
| 1503 | 1531 | return __tuple_equal<_Ip - 1>()(__x, __y) && _VSTD::get<_Ip-1>(__x) == _VSTD::get<_Ip-1>(__y); |
| ... | ... | @@ -1508,7 +1536,7 @@ template <> |
| 1508 | 1536 | struct __tuple_equal<0> |
| 1509 | 1537 | { |
| 1510 | 1538 | template <class _Tp, class _Up> |
| 1511 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1539 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1512 | 1540 | bool operator()(const _Tp&, const _Up&) |
| 1513 | 1541 | { |
| 1514 | 1542 | return true; |
| ... | ... | @@ -1516,7 +1544,7 @@ struct __tuple_equal<0> |
| 1516 | 1544 | }; |
| 1517 | 1545 | |
| 1518 | 1546 | template <class ..._Tp, class ..._Up> |
| 1519 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1547 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1520 | 1548 | bool |
| 1521 | 1549 | operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) |
| 1522 | 1550 | { |
| ... | ... | @@ -1549,7 +1577,7 @@ operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) |
| 1549 | 1577 | #else // _LIBCPP_STD_VER > 17 |
| 1550 | 1578 | |
| 1551 | 1579 | template <class ..._Tp, class ..._Up> |
| 1552 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1580 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1553 | 1581 | bool |
| 1554 | 1582 | operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) |
| 1555 | 1583 | { |
| ... | ... | @@ -1560,7 +1588,7 @@ template <size_t _Ip> |
| 1560 | 1588 | struct __tuple_less |
| 1561 | 1589 | { |
| 1562 | 1590 | template <class _Tp, class _Up> |
| 1563 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1591 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1564 | 1592 | bool operator()(const _Tp& __x, const _Up& __y) |
| 1565 | 1593 | { |
| 1566 | 1594 | const size_t __idx = tuple_size<_Tp>::value - _Ip; |
| ... | ... | @@ -1576,7 +1604,7 @@ template <> |
| 1576 | 1604 | struct __tuple_less<0> |
| 1577 | 1605 | { |
| 1578 | 1606 | template <class _Tp, class _Up> |
| 1579 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1607 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1580 | 1608 | bool operator()(const _Tp&, const _Up&) |
| 1581 | 1609 | { |
| 1582 | 1610 | return false; |
| ... | ... | @@ -1584,7 +1612,7 @@ struct __tuple_less<0> |
| 1584 | 1612 | }; |
| 1585 | 1613 | |
| 1586 | 1614 | template <class ..._Tp, class ..._Up> |
| 1587 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1615 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1588 | 1616 | bool |
| 1589 | 1617 | operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) |
| 1590 | 1618 | { |
| ... | ... | @@ -1593,7 +1621,7 @@ operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) |
| 1593 | 1621 | } |
| 1594 | 1622 | |
| 1595 | 1623 | template <class ..._Tp, class ..._Up> |
| 1596 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1624 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1597 | 1625 | bool |
| 1598 | 1626 | operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) |
| 1599 | 1627 | { |
| ... | ... | @@ -1601,7 +1629,7 @@ operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) |
| 1601 | 1629 | } |
| 1602 | 1630 | |
| 1603 | 1631 | template <class ..._Tp, class ..._Up> |
| 1604 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1632 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1605 | 1633 | bool |
| 1606 | 1634 | operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) |
| 1607 | 1635 | { |
| ... | ... | @@ -1609,7 +1637,7 @@ operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) |
| 1609 | 1637 | } |
| 1610 | 1638 | |
| 1611 | 1639 | template <class ..._Tp, class ..._Up> |
| 1612 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1640 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1613 | 1641 | bool |
| 1614 | 1642 | operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) |
| 1615 | 1643 | { |
| ... | ... | @@ -1638,7 +1666,7 @@ struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0> |
| 1638 | 1666 | { |
| 1639 | 1667 | using type _LIBCPP_NODEBUG = typename __tuple_cat_type< |
| 1640 | 1668 | tuple<_Types...>, |
| 1641 | typename __make_tuple_types<__uncvref_t<_Tuple0> >::type | |
| 1669 | typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type | |
| 1642 | 1670 | >::type; |
| 1643 | 1671 | }; |
| 1644 | 1672 | |
| ... | ... | @@ -1647,9 +1675,9 @@ struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples... |
| 1647 | 1675 | : public __tuple_cat_return_1< |
| 1648 | 1676 | typename __tuple_cat_type< |
| 1649 | 1677 | tuple<_Types...>, |
| 1650 | typename __make_tuple_types<__uncvref_t<_Tuple0> >::type | |
| 1678 | typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type | |
| 1651 | 1679 | >::type, |
| 1652 | __tuple_like<typename remove_reference<_Tuple1>::type>::value, | |
| 1680 | __tuple_like_ext<__libcpp_remove_reference_t<_Tuple1> >::value, | |
| 1653 | 1681 | _Tuple1, _Tuples...> |
| 1654 | 1682 | { |
| 1655 | 1683 | }; |
| ... | ... | @@ -1659,7 +1687,7 @@ template <class ..._Tuples> struct __tuple_cat_return; |
| 1659 | 1687 | template <class _Tuple0, class ..._Tuples> |
| 1660 | 1688 | struct __tuple_cat_return<_Tuple0, _Tuples...> |
| 1661 | 1689 | : public __tuple_cat_return_1<tuple<>, |
| 1662 | __tuple_like<typename remove_reference<_Tuple0>::type>::value, _Tuple0, | |
| 1690 | __tuple_like_ext<__libcpp_remove_reference_t<_Tuple0> >::value, _Tuple0, | |
| 1663 | 1691 | _Tuples...> |
| 1664 | 1692 | { |
| 1665 | 1693 | }; |
| ... | ... | @@ -1670,7 +1698,7 @@ struct __tuple_cat_return<> |
| 1670 | 1698 | typedef _LIBCPP_NODEBUG tuple<> type; |
| 1671 | 1699 | }; |
| 1672 | 1700 | |
| 1673 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1701 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1674 | 1702 | tuple<> |
| 1675 | 1703 | tuple_cat() |
| 1676 | 1704 | { |
| ... | ... | @@ -1683,7 +1711,7 @@ struct __tuple_cat_return_ref_imp; |
| 1683 | 1711 | template <class ..._Types, size_t ..._I0, class _Tuple0> |
| 1684 | 1712 | struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0> |
| 1685 | 1713 | { |
| 1686 | typedef _LIBCPP_NODEBUG typename remove_reference<_Tuple0>::type _T0; | |
| 1714 | typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0; | |
| 1687 | 1715 | typedef tuple<_Types..., typename __apply_cv<_Tuple0, |
| 1688 | 1716 | typename tuple_element<_I0, _T0>::type>::type&&...> type; |
| 1689 | 1717 | }; |
| ... | ... | @@ -1694,9 +1722,8 @@ struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, |
| 1694 | 1722 | : public __tuple_cat_return_ref_imp< |
| 1695 | 1723 | tuple<_Types..., typename __apply_cv<_Tuple0, |
| 1696 | 1724 | typename tuple_element<_I0, |
| 1697 | typename remove_reference<_Tuple0>::type>::type>::type&&...>, | |
| 1698 | typename __make_tuple_indices<tuple_size<typename | |
| 1699 | remove_reference<_Tuple1>::type>::value>::type, | |
| 1725 | __libcpp_remove_reference_t<_Tuple0> >::type>::type&&...>, | |
| 1726 | typename __make_tuple_indices<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>::type, | |
| 1700 | 1727 | _Tuple1, _Tuples...> |
| 1701 | 1728 | { |
| 1702 | 1729 | }; |
| ... | ... | @@ -1705,7 +1732,7 @@ template <class _Tuple0, class ..._Tuples> |
| 1705 | 1732 | struct __tuple_cat_return_ref |
| 1706 | 1733 | : public __tuple_cat_return_ref_imp<tuple<>, |
| 1707 | 1734 | typename __make_tuple_indices< |
| 1708 | tuple_size<typename remove_reference<_Tuple0>::type>::value | |
| 1735 | tuple_size<__libcpp_remove_reference_t<_Tuple0> >::value | |
| 1709 | 1736 | >::type, _Tuple0, _Tuples...> |
| 1710 | 1737 | { |
| 1711 | 1738 | }; |
| ... | ... | @@ -1717,7 +1744,7 @@ template <class ..._Types, size_t ..._I0, size_t ..._J0> |
| 1717 | 1744 | struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> > |
| 1718 | 1745 | { |
| 1719 | 1746 | template <class _Tuple0> |
| 1720 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1747 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1721 | 1748 | typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type |
| 1722 | 1749 | operator()(tuple<_Types...> __t, _Tuple0&& __t0) |
| 1723 | 1750 | { |
| ... | ... | @@ -1728,13 +1755,13 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J |
| 1728 | 1755 | } |
| 1729 | 1756 | |
| 1730 | 1757 | template <class _Tuple0, class _Tuple1, class ..._Tuples> |
| 1731 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1758 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1732 | 1759 | typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type |
| 1733 | 1760 | operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls) |
| 1734 | 1761 | { |
| 1735 | 1762 | (void)__t; // avoid unused parameter warning on GCC when _I0 is empty |
| 1736 | typedef _LIBCPP_NODEBUG typename remove_reference<_Tuple0>::type _T0; | |
| 1737 | typedef _LIBCPP_NODEBUG typename remove_reference<_Tuple1>::type _T1; | |
| 1763 | typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0; | |
| 1764 | typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple1> _T1; | |
| 1738 | 1765 | return __tuple_cat< |
| 1739 | 1766 | tuple<_Types..., |
| 1740 | 1767 | typename __apply_cv<_Tuple0, typename tuple_element< |
| ... | ... | @@ -1750,11 +1777,11 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J |
| 1750 | 1777 | }; |
| 1751 | 1778 | |
| 1752 | 1779 | template <class _Tuple0, class... _Tuples> |
| 1753 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | |
| 1780 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 | |
| 1754 | 1781 | typename __tuple_cat_return<_Tuple0, _Tuples...>::type |
| 1755 | 1782 | tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) |
| 1756 | 1783 | { |
| 1757 | typedef _LIBCPP_NODEBUG typename remove_reference<_Tuple0>::type _T0; | |
| 1784 | typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0; | |
| 1758 | 1785 | return __tuple_cat<tuple<>, __tuple_indices<>, |
| 1759 | 1786 | typename __make_tuple_indices<tuple_size<_T0>::value>::type>() |
| 1760 | 1787 | (tuple<>(), _VSTD::forward<_Tuple0>(__t0), |
| ... | ... | @@ -1767,7 +1794,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc> |
| 1767 | 1794 | |
| 1768 | 1795 | template <class _T1, class _T2> |
| 1769 | 1796 | template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2> |
| 1770 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1797 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1771 | 1798 | pair<_T1, _T2>::pair(piecewise_construct_t, |
| 1772 | 1799 | tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, |
| 1773 | 1800 | __tuple_indices<_I1...>, __tuple_indices<_I2...>) |
| ... | ... | @@ -1824,4 +1851,13 @@ _LIBCPP_NOEXCEPT_RETURN( |
| 1824 | 1851 | |
| 1825 | 1852 | _LIBCPP_END_NAMESPACE_STD |
| 1826 | 1853 | |
| 1854 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1855 | # include <exception> | |
| 1856 | # include <iosfwd> | |
| 1857 | # include <new> | |
| 1858 | # include <type_traits> | |
| 1859 | # include <typeinfo> | |
| 1860 | # include <utility> | |
| 1861 | #endif | |
| 1862 | ||
| 1827 | 1863 | #endif // _LIBCPP_TUPLE |
lib/libcxx/include/type_traits+13-278| ... | ... | @@ -158,8 +158,8 @@ namespace std |
| 158 | 158 | // Alignment properties and transformations: |
| 159 | 159 | template <class T> struct alignment_of; |
| 160 | 160 | template <size_t Len, size_t Align = most_stringent_alignment_requirement> |
| 161 | struct aligned_storage; | |
| 162 | template <size_t Len, class... Types> struct aligned_union; | |
| 161 | struct aligned_storage; // deprecated in C++23 | |
| 162 | template <size_t Len, class... Types> struct aligned_union; // deprecated in C++23 | |
| 163 | 163 | template <class T> struct remove_cvref; // C++20 |
| 164 | 164 | |
| 165 | 165 | template <class T> struct decay; |
| ... | ... | @@ -419,6 +419,7 @@ namespace std |
| 419 | 419 | #include <__assert> // all public C++ headers provide the assertion handler |
| 420 | 420 | #include <__config> |
| 421 | 421 | #include <__functional/invoke.h> |
| 422 | #include <__fwd/hash.h> // This is https://llvm.org/PR56938 | |
| 422 | 423 | #include <__type_traits/add_const.h> |
| 423 | 424 | #include <__type_traits/add_cv.h> |
| 424 | 425 | #include <__type_traits/add_lvalue_reference.h> |
| ... | ... | @@ -429,11 +430,13 @@ namespace std |
| 429 | 430 | #include <__type_traits/aligned_union.h> |
| 430 | 431 | #include <__type_traits/alignment_of.h> |
| 431 | 432 | #include <__type_traits/apply_cv.h> |
| 433 | #include <__type_traits/can_extract_key.h> | |
| 432 | 434 | #include <__type_traits/common_reference.h> |
| 433 | 435 | #include <__type_traits/common_type.h> |
| 434 | 436 | #include <__type_traits/conditional.h> |
| 435 | 437 | #include <__type_traits/conjunction.h> |
| 436 | 438 | #include <__type_traits/decay.h> |
| 439 | #include <__type_traits/dependent_type.h> | |
| 437 | 440 | #include <__type_traits/disjunction.h> |
| 438 | 441 | #include <__type_traits/enable_if.h> |
| 439 | 442 | #include <__type_traits/extent.h> |
| ... | ... | @@ -448,6 +451,7 @@ namespace std |
| 448 | 451 | #include <__type_traits/is_base_of.h> |
| 449 | 452 | #include <__type_traits/is_bounded_array.h> |
| 450 | 453 | #include <__type_traits/is_callable.h> |
| 454 | #include <__type_traits/is_char_like_type.h> | |
| 451 | 455 | #include <__type_traits/is_class.h> |
| 452 | 456 | #include <__type_traits/is_compound.h> |
| 453 | 457 | #include <__type_traits/is_const.h> |
| ... | ... | @@ -464,6 +468,7 @@ namespace std |
| 464 | 468 | #include <__type_traits/is_floating_point.h> |
| 465 | 469 | #include <__type_traits/is_function.h> |
| 466 | 470 | #include <__type_traits/is_fundamental.h> |
| 471 | #include <__type_traits/is_implicitly_default_constructible.h> | |
| 467 | 472 | #include <__type_traits/is_integral.h> |
| 468 | 473 | #include <__type_traits/is_literal_type.h> |
| 469 | 474 | #include <__type_traits/is_member_function_pointer.h> |
| ... | ... | @@ -492,7 +497,9 @@ namespace std |
| 492 | 497 | #include <__type_traits/is_scalar.h> |
| 493 | 498 | #include <__type_traits/is_scoped_enum.h> |
| 494 | 499 | #include <__type_traits/is_signed.h> |
| 500 | #include <__type_traits/is_specialization.h> | |
| 495 | 501 | #include <__type_traits/is_standard_layout.h> |
| 502 | #include <__type_traits/is_swappable.h> | |
| 496 | 503 | #include <__type_traits/is_trivial.h> |
| 497 | 504 | #include <__type_traits/is_trivially_assignable.h> |
| 498 | 505 | #include <__type_traits/is_trivially_constructible.h> |
| ... | ... | @@ -508,17 +515,21 @@ namespace std |
| 508 | 515 | #include <__type_traits/is_unsigned.h> |
| 509 | 516 | #include <__type_traits/is_void.h> |
| 510 | 517 | #include <__type_traits/is_volatile.h> |
| 518 | #include <__type_traits/make_const_lvalue_ref.h> | |
| 511 | 519 | #include <__type_traits/make_signed.h> |
| 512 | 520 | #include <__type_traits/make_unsigned.h> |
| 521 | #include <__type_traits/maybe_const.h> | |
| 513 | 522 | #include <__type_traits/negation.h> |
| 514 | 523 | #include <__type_traits/rank.h> |
| 515 | 524 | #include <__type_traits/remove_all_extents.h> |
| 516 | 525 | #include <__type_traits/remove_const.h> |
| 526 | #include <__type_traits/remove_const_ref.h> | |
| 517 | 527 | #include <__type_traits/remove_cv.h> |
| 518 | 528 | #include <__type_traits/remove_extent.h> |
| 519 | 529 | #include <__type_traits/remove_pointer.h> |
| 520 | 530 | #include <__type_traits/remove_reference.h> |
| 521 | 531 | #include <__type_traits/remove_volatile.h> |
| 532 | #include <__type_traits/result_of.h> | |
| 522 | 533 | #include <__type_traits/type_identity.h> |
| 523 | 534 | #include <__type_traits/underlying_type.h> |
| 524 | 535 | #include <__type_traits/void_t.h> |
| ... | ... | @@ -531,280 +542,4 @@ namespace std |
| 531 | 542 | # pragma GCC system_header |
| 532 | 543 | #endif |
| 533 | 544 | |
| 534 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 535 | ||
| 536 | template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair; | |
| 537 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash; | |
| 538 | ||
| 539 | // Member detector base | |
| 540 | ||
| 541 | template <class _Tp, bool> | |
| 542 | struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {}; | |
| 543 | ||
| 544 | // is_integral | |
| 545 | ||
| 546 | template <class _Tp> | |
| 547 | struct __unconstref { | |
| 548 | typedef _LIBCPP_NODEBUG typename remove_const<typename remove_reference<_Tp>::type>::type type; | |
| 549 | }; | |
| 550 | ||
| 551 | #ifndef _LIBCPP_CXX03_LANG | |
| 552 | // First of all, we can't implement this check in C++03 mode because the {} | |
| 553 | // default initialization syntax isn't valid. | |
| 554 | // Second, we implement the trait in a funny manner with two defaulted template | |
| 555 | // arguments to workaround Clang's PR43454. | |
| 556 | template <class _Tp> | |
| 557 | void __test_implicit_default_constructible(_Tp); | |
| 558 | ||
| 559 | template <class _Tp, class = void, class = typename is_default_constructible<_Tp>::type> | |
| 560 | struct __is_implicitly_default_constructible | |
| 561 | : false_type | |
| 562 | { }; | |
| 563 | ||
| 564 | template <class _Tp> | |
| 565 | struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), true_type> | |
| 566 | : true_type | |
| 567 | { }; | |
| 568 | ||
| 569 | template <class _Tp> | |
| 570 | struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), false_type> | |
| 571 | : false_type | |
| 572 | { }; | |
| 573 | #endif // !C++03 | |
| 574 | ||
| 575 | // result_of | |
| 576 | ||
| 577 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | |
| 578 | template <class _Callable> class _LIBCPP_DEPRECATED_IN_CXX17 result_of; | |
| 579 | ||
| 580 | template <class _Fp, class ..._Args> | |
| 581 | class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)> | |
| 582 | : public __invoke_of<_Fp, _Args...> | |
| 583 | { | |
| 584 | }; | |
| 585 | ||
| 586 | #if _LIBCPP_STD_VER > 11 | |
| 587 | template <class _Tp> using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type; | |
| 588 | #endif // _LIBCPP_STD_VER > 11 | |
| 589 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) | |
| 590 | ||
| 591 | // __swappable | |
| 592 | ||
| 593 | template <class _Tp> struct __is_swappable; | |
| 594 | template <class _Tp> struct __is_nothrow_swappable; | |
| 595 | ||
| 596 | ||
| 597 | #ifndef _LIBCPP_CXX03_LANG | |
| 598 | template <class _Tp> | |
| 599 | using __swap_result_t = typename enable_if<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>::type; | |
| 600 | #else | |
| 601 | template <class> | |
| 602 | using __swap_result_t = void; | |
| 603 | #endif | |
| 604 | ||
| 605 | template <class _Tp> | |
| 606 | inline _LIBCPP_INLINE_VISIBILITY | |
| 607 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __swap_result_t<_Tp> | |
| 608 | swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && | |
| 609 | is_nothrow_move_assignable<_Tp>::value); | |
| 610 | ||
| 611 | template<class _Tp, size_t _Np> | |
| 612 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 613 | typename enable_if< | |
| 614 | __is_swappable<_Tp>::value | |
| 615 | >::type | |
| 616 | swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value); | |
| 617 | ||
| 618 | namespace __detail | |
| 619 | { | |
| 620 | // ALL generic swap overloads MUST already have a declaration available at this point. | |
| 621 | ||
| 622 | template <class _Tp, class _Up = _Tp, | |
| 623 | bool _NotVoid = !is_void<_Tp>::value && !is_void<_Up>::value> | |
| 624 | struct __swappable_with | |
| 625 | { | |
| 626 | template <class _LHS, class _RHS> | |
| 627 | static decltype(swap(declval<_LHS>(), declval<_RHS>())) | |
| 628 | __test_swap(int); | |
| 629 | template <class, class> | |
| 630 | static __nat __test_swap(long); | |
| 631 | ||
| 632 | // Extra parens are needed for the C++03 definition of decltype. | |
| 633 | typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1; | |
| 634 | typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2; | |
| 635 | ||
| 636 | static const bool value = _IsNotSame<__swap1, __nat>::value | |
| 637 | && _IsNotSame<__swap2, __nat>::value; | |
| 638 | }; | |
| 639 | ||
| 640 | template <class _Tp, class _Up> | |
| 641 | struct __swappable_with<_Tp, _Up, false> : false_type {}; | |
| 642 | ||
| 643 | template <class _Tp, class _Up = _Tp, bool _Swappable = __swappable_with<_Tp, _Up>::value> | |
| 644 | struct __nothrow_swappable_with { | |
| 645 | static const bool value = | |
| 646 | #ifndef _LIBCPP_HAS_NO_NOEXCEPT | |
| 647 | noexcept(swap(declval<_Tp>(), declval<_Up>())) | |
| 648 | && noexcept(swap(declval<_Up>(), declval<_Tp>())); | |
| 649 | #else | |
| 650 | false; | |
| 651 | #endif | |
| 652 | }; | |
| 653 | ||
| 654 | template <class _Tp, class _Up> | |
| 655 | struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {}; | |
| 656 | ||
| 657 | } // namespace __detail | |
| 658 | ||
| 659 | template <class _Tp> | |
| 660 | struct __is_swappable | |
| 661 | : public integral_constant<bool, __detail::__swappable_with<_Tp&>::value> | |
| 662 | { | |
| 663 | }; | |
| 664 | ||
| 665 | template <class _Tp> | |
| 666 | struct __is_nothrow_swappable | |
| 667 | : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp&>::value> | |
| 668 | { | |
| 669 | }; | |
| 670 | ||
| 671 | #if _LIBCPP_STD_VER > 14 | |
| 672 | ||
| 673 | template <class _Tp, class _Up> | |
| 674 | struct _LIBCPP_TEMPLATE_VIS is_swappable_with | |
| 675 | : public integral_constant<bool, __detail::__swappable_with<_Tp, _Up>::value> | |
| 676 | { | |
| 677 | }; | |
| 678 | ||
| 679 | template <class _Tp> | |
| 680 | struct _LIBCPP_TEMPLATE_VIS is_swappable | |
| 681 | : public conditional< | |
| 682 | __is_referenceable<_Tp>::value, | |
| 683 | is_swappable_with< | |
| 684 | typename add_lvalue_reference<_Tp>::type, | |
| 685 | typename add_lvalue_reference<_Tp>::type>, | |
| 686 | false_type | |
| 687 | >::type | |
| 688 | { | |
| 689 | }; | |
| 690 | ||
| 691 | template <class _Tp, class _Up> | |
| 692 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with | |
| 693 | : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp, _Up>::value> | |
| 694 | { | |
| 695 | }; | |
| 696 | ||
| 697 | template <class _Tp> | |
| 698 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable | |
| 699 | : public conditional< | |
| 700 | __is_referenceable<_Tp>::value, | |
| 701 | is_nothrow_swappable_with< | |
| 702 | typename add_lvalue_reference<_Tp>::type, | |
| 703 | typename add_lvalue_reference<_Tp>::type>, | |
| 704 | false_type | |
| 705 | >::type | |
| 706 | { | |
| 707 | }; | |
| 708 | ||
| 709 | template <class _Tp, class _Up> | |
| 710 | inline constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value; | |
| 711 | ||
| 712 | template <class _Tp> | |
| 713 | inline constexpr bool is_swappable_v = is_swappable<_Tp>::value; | |
| 714 | ||
| 715 | template <class _Tp, class _Up> | |
| 716 | inline constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<_Tp, _Up>::value; | |
| 717 | ||
| 718 | template <class _Tp> | |
| 719 | inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value; | |
| 720 | ||
| 721 | #endif // _LIBCPP_STD_VER > 14 | |
| 722 | ||
| 723 | template <class _Tp, bool = is_enum<_Tp>::value> | |
| 724 | struct __sfinae_underlying_type | |
| 725 | { | |
| 726 | typedef typename underlying_type<_Tp>::type type; | |
| 727 | typedef decltype(((type)1) + 0) __promoted_type; | |
| 728 | }; | |
| 729 | ||
| 730 | template <class _Tp> | |
| 731 | struct __sfinae_underlying_type<_Tp, false> {}; | |
| 732 | ||
| 733 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 734 | int __convert_to_integral(int __val) { return __val; } | |
| 735 | ||
| 736 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 737 | unsigned __convert_to_integral(unsigned __val) { return __val; } | |
| 738 | ||
| 739 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 740 | long __convert_to_integral(long __val) { return __val; } | |
| 741 | ||
| 742 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 743 | unsigned long __convert_to_integral(unsigned long __val) { return __val; } | |
| 744 | ||
| 745 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 746 | long long __convert_to_integral(long long __val) { return __val; } | |
| 747 | ||
| 748 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 749 | unsigned long long __convert_to_integral(unsigned long long __val) {return __val; } | |
| 750 | ||
| 751 | template<typename _Fp> | |
| 752 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 753 | typename enable_if<is_floating_point<_Fp>::value, long long>::type | |
| 754 | __convert_to_integral(_Fp __val) { return __val; } | |
| 755 | ||
| 756 | #ifndef _LIBCPP_HAS_NO_INT128 | |
| 757 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 758 | __int128_t __convert_to_integral(__int128_t __val) { return __val; } | |
| 759 | ||
| 760 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 761 | __uint128_t __convert_to_integral(__uint128_t __val) { return __val; } | |
| 762 | #endif | |
| 763 | ||
| 764 | template <class _Tp> | |
| 765 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 766 | typename __sfinae_underlying_type<_Tp>::__promoted_type | |
| 767 | __convert_to_integral(_Tp __val) { return __val; } | |
| 768 | ||
| 769 | // These traits are used in __tree and __hash_table | |
| 770 | struct __extract_key_fail_tag {}; | |
| 771 | struct __extract_key_self_tag {}; | |
| 772 | struct __extract_key_first_tag {}; | |
| 773 | ||
| 774 | template <class _ValTy, class _Key, | |
| 775 | class _RawValTy = typename __unconstref<_ValTy>::type> | |
| 776 | struct __can_extract_key | |
| 777 | : conditional<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag, | |
| 778 | __extract_key_fail_tag>::type {}; | |
| 779 | ||
| 780 | template <class _Pair, class _Key, class _First, class _Second> | |
| 781 | struct __can_extract_key<_Pair, _Key, pair<_First, _Second> > | |
| 782 | : conditional<_IsSame<typename remove_const<_First>::type, _Key>::value, | |
| 783 | __extract_key_first_tag, __extract_key_fail_tag>::type {}; | |
| 784 | ||
| 785 | // __can_extract_map_key uses true_type/false_type instead of the tags. | |
| 786 | // It returns true if _Key != _ContainerValueTy (the container is a map not a set) | |
| 787 | // and _ValTy == _Key. | |
| 788 | template <class _ValTy, class _Key, class _ContainerValueTy, | |
| 789 | class _RawValTy = typename __unconstref<_ValTy>::type> | |
| 790 | struct __can_extract_map_key | |
| 791 | : integral_constant<bool, _IsSame<_RawValTy, _Key>::value> {}; | |
| 792 | ||
| 793 | // This specialization returns __extract_key_fail_tag for non-map containers | |
| 794 | // because _Key == _ContainerValueTy | |
| 795 | template <class _ValTy, class _Key, class _RawValTy> | |
| 796 | struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> | |
| 797 | : false_type {}; | |
| 798 | ||
| 799 | template <class _CharT> | |
| 800 | using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >; | |
| 801 | ||
| 802 | template<class _Tp> | |
| 803 | using __make_const_lvalue_ref = const typename remove_reference<_Tp>::type&; | |
| 804 | ||
| 805 | template<bool _Const, class _Tp> | |
| 806 | using __maybe_const = typename conditional<_Const, const _Tp, _Tp>::type; | |
| 807 | ||
| 808 | _LIBCPP_END_NAMESPACE_STD | |
| 809 | ||
| 810 | 545 | #endif // _LIBCPP_TYPE_TRAITS |
lib/libcxx/include/typeindex+20-7| ... | ... | @@ -23,11 +23,12 @@ public: |
| 23 | 23 | type_index(const type_info& rhs) noexcept; |
| 24 | 24 | |
| 25 | 25 | bool operator==(const type_index& rhs) const noexcept; |
| 26 | bool operator!=(const type_index& rhs) const noexcept; | |
| 26 | bool operator!=(const type_index& rhs) const noexcept; // removed in C++20 | |
| 27 | 27 | bool operator< (const type_index& rhs) const noexcept; |
| 28 | 28 | bool operator<=(const type_index& rhs) const noexcept; |
| 29 | 29 | bool operator> (const type_index& rhs) const noexcept; |
| 30 | 30 | bool operator>=(const type_index& rhs) const noexcept; |
| 31 | strong_ordering operator<=>(const type_index& rhs) const noexcept; // C++20 | |
| 31 | 32 | |
| 32 | 33 | size_t hash_code() const noexcept; |
| 33 | 34 | const char* name() const noexcept; |
| ... | ... | @@ -50,12 +51,6 @@ struct hash<type_index> |
| 50 | 51 | #include <typeinfo> |
| 51 | 52 | #include <version> |
| 52 | 53 | |
| 53 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 54 | # include <iosfwd> | |
| 55 | # include <new> | |
| 56 | # include <utility> | |
| 57 | #endif | |
| 58 | ||
| 59 | 54 | // standard-mandated includes |
| 60 | 55 | #include <compare> |
| 61 | 56 | |
| ... | ... | @@ -76,8 +71,10 @@ public: |
| 76 | 71 | bool operator==(const type_index& __y) const _NOEXCEPT |
| 77 | 72 | {return *__t_ == *__y.__t_;} |
| 78 | 73 | _LIBCPP_INLINE_VISIBILITY |
| 74 | #if _LIBCPP_STD_VER <= 17 | |
| 79 | 75 | bool operator!=(const type_index& __y) const _NOEXCEPT |
| 80 | 76 | {return *__t_ != *__y.__t_;} |
| 77 | #endif | |
| 81 | 78 | _LIBCPP_INLINE_VISIBILITY |
| 82 | 79 | bool operator< (const type_index& __y) const _NOEXCEPT |
| 83 | 80 | {return __t_->before(*__y.__t_);} |
| ... | ... | @@ -90,6 +87,16 @@ public: |
| 90 | 87 | _LIBCPP_INLINE_VISIBILITY |
| 91 | 88 | bool operator>=(const type_index& __y) const _NOEXCEPT |
| 92 | 89 | {return !__t_->before(*__y.__t_);} |
| 90 | #if _LIBCPP_STD_VER > 17 | |
| 91 | _LIBCPP_HIDE_FROM_ABI | |
| 92 | strong_ordering operator<=>(const type_index& __y) const noexcept { | |
| 93 | if (*__t_ == *__y.__t_) | |
| 94 | return strong_ordering::equal; | |
| 95 | if (__t_->before(*__y.__t_)) | |
| 96 | return strong_ordering::less; | |
| 97 | return strong_ordering::greater; | |
| 98 | } | |
| 99 | #endif | |
| 93 | 100 | |
| 94 | 101 | _LIBCPP_INLINE_VISIBILITY |
| 95 | 102 | size_t hash_code() const _NOEXCEPT {return __t_->hash_code();} |
| ... | ... | @@ -110,4 +117,10 @@ struct _LIBCPP_TEMPLATE_VIS hash<type_index> |
| 110 | 117 | |
| 111 | 118 | _LIBCPP_END_NAMESPACE_STD |
| 112 | 119 | |
| 120 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 121 | # include <iosfwd> | |
| 122 | # include <new> | |
| 123 | # include <utility> | |
| 124 | #endif | |
| 125 | ||
| 113 | 126 | #endif // _LIBCPP_TYPEINDEX |
lib/libcxx/include/typeinfo+36-11| ... | ... | @@ -22,7 +22,7 @@ public: |
| 22 | 22 | virtual ~type_info(); |
| 23 | 23 | |
| 24 | 24 | bool operator==(const type_info& rhs) const noexcept; |
| 25 | bool operator!=(const type_info& rhs) const noexcept; | |
| 25 | bool operator!=(const type_info& rhs) const noexcept; // removed in C++20 | |
| 26 | 26 | |
| 27 | 27 | bool before(const type_info& rhs) const noexcept; |
| 28 | 28 | size_t hash_code() const noexcept; |
| ... | ... | @@ -61,13 +61,10 @@ public: |
| 61 | 61 | #include <__config> |
| 62 | 62 | #include <cstddef> |
| 63 | 63 | #include <cstdint> |
| 64 | #include <cstdlib> | |
| 64 | 65 | #include <exception> |
| 65 | 66 | #include <type_traits> |
| 66 | 67 | |
| 67 | #ifdef _LIBCPP_NO_EXCEPTIONS | |
| 68 | #include <cstdlib> | |
| 69 | #endif | |
| 70 | ||
| 71 | 68 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 72 | 69 | # pragma GCC system_header |
| 73 | 70 | #endif |
| ... | ... | @@ -112,9 +109,11 @@ public: |
| 112 | 109 | return __compare(__arg) == 0; |
| 113 | 110 | } |
| 114 | 111 | |
| 112 | #if _LIBCPP_STD_VER <= 17 | |
| 115 | 113 | _LIBCPP_INLINE_VISIBILITY |
| 116 | 114 | bool operator!=(const type_info& __arg) const _NOEXCEPT |
| 117 | 115 | { return !operator==(__arg); } |
| 116 | #endif | |
| 118 | 117 | }; |
| 119 | 118 | |
| 120 | 119 | #else // !defined(_LIBCPP_ABI_MICROSOFT) |
| ... | ... | @@ -174,8 +173,8 @@ public: |
| 174 | 173 | // we pick a default implementation based on the platform here. |
| 175 | 174 | #ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION |
| 176 | 175 | |
| 177 | // Windows binaries can't merge typeinfos, so use the NonUnique implementation. | |
| 178 | # ifdef _LIBCPP_OBJECT_FORMAT_COFF | |
| 176 | // Windows and AIX binaries can't merge typeinfos, so use the NonUnique implementation. | |
| 177 | # if defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF) | |
| 179 | 178 | # define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 2 |
| 180 | 179 | |
| 181 | 180 | // On arm64 on Apple platforms, use the special NonUniqueARMRTTIBit implementation. |
| ... | ... | @@ -337,9 +336,11 @@ public: |
| 337 | 336 | return __impl::__eq(__type_name, __arg.__type_name); |
| 338 | 337 | } |
| 339 | 338 | |
| 339 | #if _LIBCPP_STD_VER <= 17 | |
| 340 | 340 | _LIBCPP_INLINE_VISIBILITY |
| 341 | 341 | bool operator!=(const type_info& __arg) const _NOEXCEPT |
| 342 | 342 | { return !operator==(__arg); } |
| 343 | #endif | |
| 343 | 344 | }; |
| 344 | 345 | #endif // defined(_LIBCPP_ABI_MICROSOFT) |
| 345 | 346 | |
| ... | ... | @@ -349,8 +350,8 @@ class _LIBCPP_EXCEPTION_ABI bad_cast |
| 349 | 350 | public: |
| 350 | 351 | bad_cast() _NOEXCEPT; |
| 351 | 352 | bad_cast(const bad_cast&) _NOEXCEPT = default; |
| 352 | virtual ~bad_cast() _NOEXCEPT; | |
| 353 | virtual const char* what() const _NOEXCEPT; | |
| 353 | ~bad_cast() _NOEXCEPT override; | |
| 354 | const char* what() const _NOEXCEPT override; | |
| 354 | 355 | }; |
| 355 | 356 | |
| 356 | 357 | class _LIBCPP_EXCEPTION_ABI bad_typeid |
| ... | ... | @@ -358,14 +359,38 @@ class _LIBCPP_EXCEPTION_ABI bad_typeid |
| 358 | 359 | { |
| 359 | 360 | public: |
| 360 | 361 | bad_typeid() _NOEXCEPT; |
| 361 | virtual ~bad_typeid() _NOEXCEPT; | |
| 362 | virtual const char* what() const _NOEXCEPT; | |
| 362 | ~bad_typeid() _NOEXCEPT override; | |
| 363 | const char* what() const _NOEXCEPT override; | |
| 363 | 364 | }; |
| 364 | 365 | |
| 365 | 366 | } // namespace std |
| 366 | 367 | |
| 367 | 368 | #endif // defined(_LIBCPP_ABI_VCRUNTIME) |
| 368 | 369 | |
| 370 | #if defined(_LIBCPP_ABI_VCRUNTIME) && _HAS_EXCEPTIONS == 0 | |
| 371 | ||
| 372 | namespace std { | |
| 373 | ||
| 374 | class bad_cast : public exception { | |
| 375 | public: | |
| 376 | bad_cast() _NOEXCEPT : exception("bad cast") {} | |
| 377 | ||
| 378 | private: | |
| 379 | bad_cast(const char* const __message) _NOEXCEPT : exception(__message) {} | |
| 380 | }; | |
| 381 | ||
| 382 | class bad_typeid : public exception { | |
| 383 | public: | |
| 384 | bad_typeid() _NOEXCEPT : exception("bad typeid") {} | |
| 385 | ||
| 386 | private: | |
| 387 | bad_typeid(const char* const __message) _NOEXCEPT : exception(__message) {} | |
| 388 | }; | |
| 389 | ||
| 390 | } // namespace std | |
| 391 | ||
| 392 | #endif // defined(_LIBCPP_ABI_VCRUNTIME) && _HAS_EXCEPTIONS == 0 | |
| 393 | ||
| 369 | 394 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 370 | 395 | _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY |
| 371 | 396 | void __throw_bad_cast() |
lib/libcxx/include/uchar.h+2| ... | ... | @@ -23,6 +23,8 @@ Types: |
| 23 | 23 | mbstate_t |
| 24 | 24 | size_t |
| 25 | 25 | |
| 26 | size_t mbrtoc8(char8_t* pc8, const char* s, size_t n, mbstate_t* ps); // since C++20 | |
| 27 | size_t c8rtomb(char* s, char8_t c8, mbstate_t* ps); // since C++20 | |
| 26 | 28 | size_t mbrtoc16(char16_t* pc16, const char* s, size_t n, mbstate_t* ps); |
| 27 | 29 | size_t c16rtomb(char* s, char16_t c16, mbstate_t* ps); |
| 28 | 30 | size_t mbrtoc32(char32_t* pc32, const char* s, size_t n, mbstate_t* ps); |
lib/libcxx/include/unordered_map+48-23| ... | ... | @@ -525,18 +525,15 @@ template <class Key, class T, class Hash, class Pred, class Alloc> |
| 525 | 525 | #include <__iterator/erase_if_container.h> |
| 526 | 526 | #include <__iterator/iterator_traits.h> |
| 527 | 527 | #include <__memory/addressof.h> |
| 528 | #include <__memory/allocator.h> | |
| 529 | #include <__memory_resource/polymorphic_allocator.h> | |
| 528 | 530 | #include <__node_handle> |
| 531 | #include <__type_traits/is_allocator.h> | |
| 529 | 532 | #include <__utility/forward.h> |
| 530 | 533 | #include <stdexcept> |
| 531 | 534 | #include <tuple> |
| 532 | 535 | #include <version> |
| 533 | 536 | |
| 534 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 535 | # include <algorithm> | |
| 536 | # include <bit> | |
| 537 | # include <iterator> | |
| 538 | #endif | |
| 539 | ||
| 540 | 537 | // standard-mandated includes |
| 541 | 538 | |
| 542 | 539 | // [iterator.range] |
| ... | ... | @@ -822,16 +819,16 @@ struct _LIBCPP_STANDALONE_DEBUG __hash_value_type |
| 822 | 819 | typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type; |
| 823 | 820 | |
| 824 | 821 | private: |
| 825 | value_type __cc; | |
| 822 | value_type __cc_; | |
| 826 | 823 | |
| 827 | 824 | public: |
| 828 | 825 | _LIBCPP_INLINE_VISIBILITY |
| 829 | 826 | value_type& __get_value() |
| 830 | 827 | { |
| 831 | 828 | #if _LIBCPP_STD_VER > 14 |
| 832 | return *_VSTD::launder(_VSTD::addressof(__cc)); | |
| 829 | return *_VSTD::launder(_VSTD::addressof(__cc_)); | |
| 833 | 830 | #else |
| 834 | return __cc; | |
| 831 | return __cc_; | |
| 835 | 832 | #endif |
| 836 | 833 | } |
| 837 | 834 | |
| ... | ... | @@ -839,9 +836,9 @@ public: |
| 839 | 836 | const value_type& __get_value() const |
| 840 | 837 | { |
| 841 | 838 | #if _LIBCPP_STD_VER > 14 |
| 842 | return *_VSTD::launder(_VSTD::addressof(__cc)); | |
| 839 | return *_VSTD::launder(_VSTD::addressof(__cc_)); | |
| 843 | 840 | #else |
| 844 | return __cc; | |
| 841 | return __cc_; | |
| 845 | 842 | #endif |
| 846 | 843 | } |
| 847 | 844 | |
| ... | ... | @@ -904,13 +901,13 @@ struct __hash_value_type |
| 904 | 901 | typedef pair<const key_type, mapped_type> value_type; |
| 905 | 902 | |
| 906 | 903 | private: |
| 907 | value_type __cc; | |
| 904 | value_type __cc_; | |
| 908 | 905 | |
| 909 | 906 | public: |
| 910 | 907 | _LIBCPP_INLINE_VISIBILITY |
| 911 | value_type& __get_value() { return __cc; } | |
| 908 | value_type& __get_value() { return __cc_; } | |
| 912 | 909 | _LIBCPP_INLINE_VISIBILITY |
| 913 | const value_type& __get_value() const { return __cc; } | |
| 910 | const value_type& __get_value() const { return __cc_; } | |
| 914 | 911 | |
| 915 | 912 | private: |
| 916 | 913 | ~__hash_value_type(); |
| ... | ... | @@ -1044,8 +1041,7 @@ private: |
| 1044 | 1041 | typedef __hash_value_type<key_type, mapped_type> __value_type; |
| 1045 | 1042 | typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher; |
| 1046 | 1043 | typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal; |
| 1047 | typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, | |
| 1048 | __value_type>::type __allocator_type; | |
| 1044 | typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type; | |
| 1049 | 1045 | |
| 1050 | 1046 | typedef __hash_table<__value_type, __hasher, |
| 1051 | 1047 | __key_equal, __allocator_type> __table; |
| ... | ... | @@ -1062,6 +1058,10 @@ private: |
| 1062 | 1058 | typedef unique_ptr<__node, _Dp> __node_holder; |
| 1063 | 1059 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 1064 | 1060 | |
| 1061 | static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, | |
| 1062 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 1063 | "original allocator"); | |
| 1064 | ||
| 1065 | 1065 | static_assert((is_same<typename __table::__container_value_type, value_type>::value), ""); |
| 1066 | 1066 | static_assert((is_same<typename __table::__node_value_type, __value_type>::value), ""); |
| 1067 | 1067 | public: |
| ... | ... | @@ -1149,7 +1149,7 @@ public: |
| 1149 | 1149 | #endif |
| 1150 | 1150 | _LIBCPP_INLINE_VISIBILITY |
| 1151 | 1151 | ~unordered_map() { |
| 1152 | static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), ""); | |
| 1152 | static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), ""); | |
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1886,7 +1886,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1886 | 1886 | #endif |
| 1887 | 1887 | |
| 1888 | 1888 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 1889 | bool | |
| 1889 | _LIBCPP_HIDE_FROM_ABI bool | |
| 1890 | 1890 | operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 1891 | 1891 | const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) |
| 1892 | 1892 | { |
| ... | ... | @@ -1934,8 +1934,7 @@ private: |
| 1934 | 1934 | typedef __hash_value_type<key_type, mapped_type> __value_type; |
| 1935 | 1935 | typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher; |
| 1936 | 1936 | typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal; |
| 1937 | typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, | |
| 1938 | __value_type>::type __allocator_type; | |
| 1937 | typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type; | |
| 1939 | 1938 | |
| 1940 | 1939 | typedef __hash_table<__value_type, __hasher, |
| 1941 | 1940 | __key_equal, __allocator_type> __table; |
| ... | ... | @@ -1952,7 +1951,12 @@ private: |
| 1952 | 1951 | static_assert((is_same<typename __node_traits::size_type, |
| 1953 | 1952 | typename __alloc_traits::size_type>::value), |
| 1954 | 1953 | "Allocator uses different size_type for different types"); |
| 1955 | public: | |
| 1954 | ||
| 1955 | static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, | |
| 1956 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 1957 | "original allocator"); | |
| 1958 | ||
| 1959 | public: | |
| 1956 | 1960 | typedef typename __alloc_traits::pointer pointer; |
| 1957 | 1961 | typedef typename __alloc_traits::const_pointer const_pointer; |
| 1958 | 1962 | typedef typename __table::size_type size_type; |
| ... | ... | @@ -2037,7 +2041,7 @@ public: |
| 2037 | 2041 | #endif |
| 2038 | 2042 | _LIBCPP_INLINE_VISIBILITY |
| 2039 | 2043 | ~unordered_multimap() { |
| 2040 | static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), ""); | |
| 2044 | static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), ""); | |
| 2041 | 2045 | } |
| 2042 | 2046 | |
| 2043 | 2047 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -2592,7 +2596,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 2592 | 2596 | #endif |
| 2593 | 2597 | |
| 2594 | 2598 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 2595 | bool | |
| 2599 | _LIBCPP_HIDE_FROM_ABI bool | |
| 2596 | 2600 | operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 2597 | 2601 | const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) |
| 2598 | 2602 | { |
| ... | ... | @@ -2625,4 +2629,25 @@ operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 2625 | 2629 | |
| 2626 | 2630 | _LIBCPP_END_NAMESPACE_STD |
| 2627 | 2631 | |
| 2632 | #if _LIBCPP_STD_VER > 14 | |
| 2633 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 2634 | namespace pmr { | |
| 2635 | template <class _KeyT, class _ValueT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> | |
| 2636 | using unordered_map = | |
| 2637 | std::unordered_map<_KeyT, _ValueT, _HashT, _PredT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>; | |
| 2638 | ||
| 2639 | template <class _KeyT, class _ValueT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> | |
| 2640 | using unordered_multimap = | |
| 2641 | std::unordered_multimap<_KeyT, _ValueT, _HashT, _PredT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>; | |
| 2642 | } // namespace pmr | |
| 2643 | _LIBCPP_END_NAMESPACE_STD | |
| 2644 | #endif | |
| 2645 | ||
| 2646 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 2647 | # include <algorithm> | |
| 2648 | # include <bit> | |
| 2649 | # include <concepts> | |
| 2650 | # include <iterator> | |
| 2651 | #endif | |
| 2652 | ||
| 2628 | 2653 | #endif // _LIBCPP_UNORDERED_MAP |
lib/libcxx/include/unordered_set+30-10| ... | ... | @@ -470,15 +470,13 @@ template <class Value, class Hash, class Pred, class Alloc> |
| 470 | 470 | #include <__iterator/erase_if_container.h> |
| 471 | 471 | #include <__iterator/iterator_traits.h> |
| 472 | 472 | #include <__memory/addressof.h> |
| 473 | #include <__memory/allocator.h> | |
| 474 | #include <__memory_resource/polymorphic_allocator.h> | |
| 473 | 475 | #include <__node_handle> |
| 476 | #include <__type_traits/is_allocator.h> | |
| 474 | 477 | #include <__utility/forward.h> |
| 475 | 478 | #include <version> |
| 476 | 479 | |
| 477 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 478 | # include <functional> | |
| 479 | # include <iterator> | |
| 480 | #endif | |
| 481 | ||
| 482 | 480 | // standard-mandated includes |
| 483 | 481 | |
| 484 | 482 | // [iterator.range] |
| ... | ... | @@ -517,7 +515,11 @@ public: |
| 517 | 515 | static_assert((is_same<value_type, typename allocator_type::value_type>::value), |
| 518 | 516 | "Invalid allocator::value_type"); |
| 519 | 517 | |
| 520 | private: | |
| 518 | static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value, | |
| 519 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 520 | "original allocator"); | |
| 521 | ||
| 522 | private: | |
| 521 | 523 | typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; |
| 522 | 524 | |
| 523 | 525 | __table __table_; |
| ... | ... | @@ -611,7 +613,7 @@ public: |
| 611 | 613 | #endif // _LIBCPP_CXX03_LANG |
| 612 | 614 | _LIBCPP_INLINE_VISIBILITY |
| 613 | 615 | ~unordered_set() { |
| 614 | static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); | |
| 616 | static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); | |
| 615 | 617 | } |
| 616 | 618 | |
| 617 | 619 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1130,7 +1132,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1130 | 1132 | #endif |
| 1131 | 1133 | |
| 1132 | 1134 | template <class _Value, class _Hash, class _Pred, class _Alloc> |
| 1133 | bool | |
| 1135 | _LIBCPP_HIDE_FROM_ABI bool | |
| 1134 | 1136 | operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, |
| 1135 | 1137 | const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) |
| 1136 | 1138 | { |
| ... | ... | @@ -1265,7 +1267,7 @@ public: |
| 1265 | 1267 | #endif // _LIBCPP_CXX03_LANG |
| 1266 | 1268 | _LIBCPP_INLINE_VISIBILITY |
| 1267 | 1269 | ~unordered_multiset() { |
| 1268 | static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); | |
| 1270 | static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); | |
| 1269 | 1271 | } |
| 1270 | 1272 | |
| 1271 | 1273 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1768,7 +1770,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1768 | 1770 | #endif |
| 1769 | 1771 | |
| 1770 | 1772 | template <class _Value, class _Hash, class _Pred, class _Alloc> |
| 1771 | bool | |
| 1773 | _LIBCPP_HIDE_FROM_ABI bool | |
| 1772 | 1774 | operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, |
| 1773 | 1775 | const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) |
| 1774 | 1776 | { |
| ... | ... | @@ -1801,4 +1803,22 @@ operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, |
| 1801 | 1803 | |
| 1802 | 1804 | _LIBCPP_END_NAMESPACE_STD |
| 1803 | 1805 | |
| 1806 | #if _LIBCPP_STD_VER > 14 | |
| 1807 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 1808 | namespace pmr { | |
| 1809 | template <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> | |
| 1810 | using unordered_set = std::unordered_set<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>; | |
| 1811 | ||
| 1812 | template <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> | |
| 1813 | using unordered_multiset = std::unordered_multiset<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>; | |
| 1814 | } // namespace pmr | |
| 1815 | _LIBCPP_END_NAMESPACE_STD | |
| 1816 | #endif | |
| 1817 | ||
| 1818 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1819 | # include <concepts> | |
| 1820 | # include <functional> | |
| 1821 | # include <iterator> | |
| 1822 | #endif | |
| 1823 | ||
| 1804 | 1824 | #endif // _LIBCPP_UNORDERED_SET |
lib/libcxx/include/utility+31-7| ... | ... | @@ -42,6 +42,10 @@ swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b))); |
| 42 | 42 | template <class T> T&& forward(typename remove_reference<T>::type& t) noexcept; // constexpr in C++14 |
| 43 | 43 | template <class T> T&& forward(typename remove_reference<T>::type&& t) noexcept; // constexpr in C++14 |
| 44 | 44 | |
| 45 | template <typename T> | |
| 46 | [[nodiscard]] constexpr | |
| 47 | auto forward_like(auto&& x) noexcept -> see below; // since C++23 | |
| 48 | ||
| 45 | 49 | template <class T> typename remove_reference<T>::type&& move(T&&) noexcept; // constexpr in C++14 |
| 46 | 50 | |
| 47 | 51 | template <class T> |
| ... | ... | @@ -80,19 +84,29 @@ struct pair |
| 80 | 84 | explicit(see-below) constexpr pair(); |
| 81 | 85 | explicit(see-below) pair(const T1& x, const T2& y); // constexpr in C++14 |
| 82 | 86 | template <class U = T1, class V = T2> explicit(see-below) pair(U&&, V&&); // constexpr in C++14 |
| 87 | template <class U, class V> constexpr explicit(see below) pair(pair<U, V>&); // since C++23 | |
| 83 | 88 | template <class U, class V> explicit(see-below) pair(const pair<U, V>& p); // constexpr in C++14 |
| 84 | 89 | template <class U, class V> explicit(see-below) pair(pair<U, V>&& p); // constexpr in C++14 |
| 90 | template <class U, class V> | |
| 91 | constexpr explicit(see below) pair(const pair<U, V>&&); // since C++23 | |
| 85 | 92 | template <class... Args1, class... Args2> |
| 86 | 93 | pair(piecewise_construct_t, tuple<Args1...> first_args, |
| 87 | 94 | tuple<Args2...> second_args); // constexpr in C++20 |
| 88 | 95 | |
| 96 | constexpr const pair& operator=(const pair& p) const; // since C++23 | |
| 89 | 97 | template <class U, class V> pair& operator=(const pair<U, V>& p); // constexpr in C++20 |
| 98 | template <class U, class V> | |
| 99 | constexpr const pair& operator=(const pair<U, V>& p) const; // since C++23 | |
| 90 | 100 | pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable<T1>::value && |
| 91 | 101 | is_nothrow_move_assignable<T2>::value); // constexpr in C++20 |
| 102 | constexpr const pair& operator=(pair&& p) const; // since C++23 | |
| 92 | 103 | template <class U, class V> pair& operator=(pair<U, V>&& p); // constexpr in C++20 |
| 104 | template <class U, class V> | |
| 105 | constexpr const pair& operator=(pair<U, V>&& p) const; // since C++23 | |
| 93 | 106 | |
| 94 | 107 | void swap(pair& p) noexcept(is_nothrow_swappable_v<T1> && |
| 95 | 108 | is_nothrow_swappable_v<T2>); // constexpr in C++20 |
| 109 | constexpr void swap(const pair& p) const noexcept(see below); // since C++23 | |
| 96 | 110 | }; |
| 97 | 111 | |
| 98 | 112 | template<class T1, class T2, class U1, class U2, template<class> class TQual, template<class> class UQual> |
| ... | ... | @@ -119,6 +133,9 @@ template <class T1, class T2> |
| 119 | 133 | void |
| 120 | 134 | swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y))); // constexpr in C++20 |
| 121 | 135 | |
| 136 | template<class T1, class T2> | |
| 137 | constexpr void swap(const pair<T1, T2>& x, const pair<T1, T2>& y) noexcept(noexcept(x.swap(y))); // since C++23 | |
| 138 | ||
| 122 | 139 | struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; |
| 123 | 140 | inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); |
| 124 | 141 | |
| ... | ... | @@ -222,13 +239,14 @@ template <class T> |
| 222 | 239 | |
| 223 | 240 | #include <__assert> // all public C++ headers provide the assertion handler |
| 224 | 241 | #include <__config> |
| 225 | #include <__tuple> | |
| 226 | 242 | #include <__utility/as_const.h> |
| 227 | 243 | #include <__utility/auto_cast.h> |
| 228 | 244 | #include <__utility/cmp.h> |
| 229 | 245 | #include <__utility/declval.h> |
| 246 | #include <__utility/exception_guard.h> | |
| 230 | 247 | #include <__utility/exchange.h> |
| 231 | 248 | #include <__utility/forward.h> |
| 249 | #include <__utility/forward_like.h> | |
| 232 | 250 | #include <__utility/in_place.h> |
| 233 | 251 | #include <__utility/integer_sequence.h> |
| 234 | 252 | #include <__utility/move.h> |
| ... | ... | @@ -238,21 +256,27 @@ template <class T> |
| 238 | 256 | #include <__utility/rel_ops.h> |
| 239 | 257 | #include <__utility/swap.h> |
| 240 | 258 | #include <__utility/to_underlying.h> |
| 241 | #include <__utility/transaction.h> | |
| 242 | 259 | #include <__utility/unreachable.h> |
| 243 | #include <type_traits> | |
| 244 | 260 | #include <version> |
| 245 | 261 | |
| 246 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 247 | # include <iosfwd> | |
| 248 | #endif | |
| 249 | ||
| 250 | 262 | // standard-mandated includes |
| 263 | ||
| 264 | // [utility.syn] | |
| 251 | 265 | #include <compare> |
| 252 | 266 | #include <initializer_list> |
| 253 | 267 | |
| 268 | // [tuple.helper] | |
| 269 | #include <__tuple_dir/tuple_element.h> | |
| 270 | #include <__tuple_dir/tuple_size.h> | |
| 271 | ||
| 254 | 272 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 255 | 273 | # pragma GCC system_header |
| 256 | 274 | #endif |
| 257 | 275 | |
| 276 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 277 | # include <cstdlib> | |
| 278 | # include <iosfwd> | |
| 279 | # include <type_traits> | |
| 280 | #endif | |
| 281 | ||
| 258 | 282 | #endif // _LIBCPP_UTILITY |
lib/libcxx/include/valarray+32-27| ... | ... | @@ -353,6 +353,7 @@ template <class T> unspecified2 end(const valarray<T>& v); |
| 353 | 353 | #include <__functional/operations.h> |
| 354 | 354 | #include <__memory/allocator.h> |
| 355 | 355 | #include <__memory/uninitialized_algorithms.h> |
| 356 | #include <__type_traits/remove_reference.h> | |
| 356 | 357 | #include <__utility/move.h> |
| 357 | 358 | #include <__utility/swap.h> |
| 358 | 359 | #include <cmath> |
| ... | ... | @@ -360,12 +361,9 @@ template <class T> unspecified2 end(const valarray<T>& v); |
| 360 | 361 | #include <new> |
| 361 | 362 | #include <version> |
| 362 | 363 | |
| 363 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 364 | # include <algorithm> | |
| 365 | # include <functional> | |
| 366 | #endif | |
| 367 | ||
| 368 | 364 | // standard-mandated includes |
| 365 | ||
| 366 | // [valarray.syn] | |
| 369 | 367 | #include <initializer_list> |
| 370 | 368 | |
| 371 | 369 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -548,7 +546,7 @@ struct __abs_expr |
| 548 | 546 | typedef _Tp __result_type; |
| 549 | 547 | _LIBCPP_INLINE_VISIBILITY |
| 550 | 548 | _Tp operator()(const _Tp& __x) const |
| 551 | {return abs(__x);} | |
| 549 | {return std::abs(__x);} | |
| 552 | 550 | }; |
| 553 | 551 | |
| 554 | 552 | template <class _Tp> |
| ... | ... | @@ -557,7 +555,7 @@ struct __acos_expr |
| 557 | 555 | typedef _Tp __result_type; |
| 558 | 556 | _LIBCPP_INLINE_VISIBILITY |
| 559 | 557 | _Tp operator()(const _Tp& __x) const |
| 560 | {return acos(__x);} | |
| 558 | {return std::acos(__x);} | |
| 561 | 559 | }; |
| 562 | 560 | |
| 563 | 561 | template <class _Tp> |
| ... | ... | @@ -566,7 +564,7 @@ struct __asin_expr |
| 566 | 564 | typedef _Tp __result_type; |
| 567 | 565 | _LIBCPP_INLINE_VISIBILITY |
| 568 | 566 | _Tp operator()(const _Tp& __x) const |
| 569 | {return asin(__x);} | |
| 567 | {return std::asin(__x);} | |
| 570 | 568 | }; |
| 571 | 569 | |
| 572 | 570 | template <class _Tp> |
| ... | ... | @@ -575,7 +573,7 @@ struct __atan_expr |
| 575 | 573 | typedef _Tp __result_type; |
| 576 | 574 | _LIBCPP_INLINE_VISIBILITY |
| 577 | 575 | _Tp operator()(const _Tp& __x) const |
| 578 | {return atan(__x);} | |
| 576 | {return std::atan(__x);} | |
| 579 | 577 | }; |
| 580 | 578 | |
| 581 | 579 | template <class _Tp> |
| ... | ... | @@ -584,7 +582,7 @@ struct __atan2_expr |
| 584 | 582 | typedef _Tp __result_type; |
| 585 | 583 | _LIBCPP_INLINE_VISIBILITY |
| 586 | 584 | _Tp operator()(const _Tp& __x, const _Tp& __y) const |
| 587 | {return atan2(__x, __y);} | |
| 585 | {return std::atan2(__x, __y);} | |
| 588 | 586 | }; |
| 589 | 587 | |
| 590 | 588 | template <class _Tp> |
| ... | ... | @@ -593,7 +591,7 @@ struct __cos_expr |
| 593 | 591 | typedef _Tp __result_type; |
| 594 | 592 | _LIBCPP_INLINE_VISIBILITY |
| 595 | 593 | _Tp operator()(const _Tp& __x) const |
| 596 | {return cos(__x);} | |
| 594 | {return std::cos(__x);} | |
| 597 | 595 | }; |
| 598 | 596 | |
| 599 | 597 | template <class _Tp> |
| ... | ... | @@ -602,7 +600,7 @@ struct __cosh_expr |
| 602 | 600 | typedef _Tp __result_type; |
| 603 | 601 | _LIBCPP_INLINE_VISIBILITY |
| 604 | 602 | _Tp operator()(const _Tp& __x) const |
| 605 | {return cosh(__x);} | |
| 603 | {return std::cosh(__x);} | |
| 606 | 604 | }; |
| 607 | 605 | |
| 608 | 606 | template <class _Tp> |
| ... | ... | @@ -611,7 +609,7 @@ struct __exp_expr |
| 611 | 609 | typedef _Tp __result_type; |
| 612 | 610 | _LIBCPP_INLINE_VISIBILITY |
| 613 | 611 | _Tp operator()(const _Tp& __x) const |
| 614 | {return exp(__x);} | |
| 612 | {return std::exp(__x);} | |
| 615 | 613 | }; |
| 616 | 614 | |
| 617 | 615 | template <class _Tp> |
| ... | ... | @@ -620,7 +618,7 @@ struct __log_expr |
| 620 | 618 | typedef _Tp __result_type; |
| 621 | 619 | _LIBCPP_INLINE_VISIBILITY |
| 622 | 620 | _Tp operator()(const _Tp& __x) const |
| 623 | {return log(__x);} | |
| 621 | {return std::log(__x);} | |
| 624 | 622 | }; |
| 625 | 623 | |
| 626 | 624 | template <class _Tp> |
| ... | ... | @@ -629,7 +627,7 @@ struct __log10_expr |
| 629 | 627 | typedef _Tp __result_type; |
| 630 | 628 | _LIBCPP_INLINE_VISIBILITY |
| 631 | 629 | _Tp operator()(const _Tp& __x) const |
| 632 | {return log10(__x);} | |
| 630 | {return std::log10(__x);} | |
| 633 | 631 | }; |
| 634 | 632 | |
| 635 | 633 | template <class _Tp> |
| ... | ... | @@ -638,7 +636,7 @@ struct __pow_expr |
| 638 | 636 | typedef _Tp __result_type; |
| 639 | 637 | _LIBCPP_INLINE_VISIBILITY |
| 640 | 638 | _Tp operator()(const _Tp& __x, const _Tp& __y) const |
| 641 | {return pow(__x, __y);} | |
| 639 | {return std::pow(__x, __y);} | |
| 642 | 640 | }; |
| 643 | 641 | |
| 644 | 642 | template <class _Tp> |
| ... | ... | @@ -647,7 +645,7 @@ struct __sin_expr |
| 647 | 645 | typedef _Tp __result_type; |
| 648 | 646 | _LIBCPP_INLINE_VISIBILITY |
| 649 | 647 | _Tp operator()(const _Tp& __x) const |
| 650 | {return sin(__x);} | |
| 648 | {return std::sin(__x);} | |
| 651 | 649 | }; |
| 652 | 650 | |
| 653 | 651 | template <class _Tp> |
| ... | ... | @@ -656,7 +654,7 @@ struct __sinh_expr |
| 656 | 654 | typedef _Tp __result_type; |
| 657 | 655 | _LIBCPP_INLINE_VISIBILITY |
| 658 | 656 | _Tp operator()(const _Tp& __x) const |
| 659 | {return sinh(__x);} | |
| 657 | {return std::sinh(__x);} | |
| 660 | 658 | }; |
| 661 | 659 | |
| 662 | 660 | template <class _Tp> |
| ... | ... | @@ -665,7 +663,7 @@ struct __sqrt_expr |
| 665 | 663 | typedef _Tp __result_type; |
| 666 | 664 | _LIBCPP_INLINE_VISIBILITY |
| 667 | 665 | _Tp operator()(const _Tp& __x) const |
| 668 | {return sqrt(__x);} | |
| 666 | {return std::sqrt(__x);} | |
| 669 | 667 | }; |
| 670 | 668 | |
| 671 | 669 | template <class _Tp> |
| ... | ... | @@ -674,7 +672,7 @@ struct __tan_expr |
| 674 | 672 | typedef _Tp __result_type; |
| 675 | 673 | _LIBCPP_INLINE_VISIBILITY |
| 676 | 674 | _Tp operator()(const _Tp& __x) const |
| 677 | {return tan(__x);} | |
| 675 | {return std::tan(__x);} | |
| 678 | 676 | }; |
| 679 | 677 | |
| 680 | 678 | template <class _Tp> |
| ... | ... | @@ -683,13 +681,13 @@ struct __tanh_expr |
| 683 | 681 | typedef _Tp __result_type; |
| 684 | 682 | _LIBCPP_INLINE_VISIBILITY |
| 685 | 683 | _Tp operator()(const _Tp& __x) const |
| 686 | {return tanh(__x);} | |
| 684 | {return std::tanh(__x);} | |
| 687 | 685 | }; |
| 688 | 686 | |
| 689 | 687 | template <class _ValExpr> |
| 690 | 688 | class __slice_expr |
| 691 | 689 | { |
| 692 | typedef typename remove_reference<_ValExpr>::type _RmExpr; | |
| 690 | typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr; | |
| 693 | 691 | public: |
| 694 | 692 | typedef typename _RmExpr::value_type value_type; |
| 695 | 693 | typedef value_type __result_type; |
| ... | ... | @@ -729,7 +727,7 @@ class __indirect_expr; |
| 729 | 727 | template <class _ValExpr> |
| 730 | 728 | class __shift_expr |
| 731 | 729 | { |
| 732 | typedef typename remove_reference<_ValExpr>::type _RmExpr; | |
| 730 | typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr; | |
| 733 | 731 | public: |
| 734 | 732 | typedef typename _RmExpr::value_type value_type; |
| 735 | 733 | typedef value_type __result_type; |
| ... | ... | @@ -772,7 +770,7 @@ public: |
| 772 | 770 | template <class _ValExpr> |
| 773 | 771 | class __cshift_expr |
| 774 | 772 | { |
| 775 | typedef typename remove_reference<_ValExpr>::type _RmExpr; | |
| 773 | typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr; | |
| 776 | 774 | public: |
| 777 | 775 | typedef typename _RmExpr::value_type value_type; |
| 778 | 776 | typedef value_type __result_type; |
| ... | ... | @@ -2247,7 +2245,7 @@ mask_array<_Tp>::operator=(const value_type& __x) const |
| 2247 | 2245 | template <class _ValExpr> |
| 2248 | 2246 | class __mask_expr |
| 2249 | 2247 | { |
| 2250 | typedef typename remove_reference<_ValExpr>::type _RmExpr; | |
| 2248 | typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr; | |
| 2251 | 2249 | public: |
| 2252 | 2250 | typedef typename _RmExpr::value_type value_type; |
| 2253 | 2251 | typedef value_type __result_type; |
| ... | ... | @@ -2610,7 +2608,7 @@ indirect_array<_Tp>::operator=(const value_type& __x) const |
| 2610 | 2608 | template <class _ValExpr> |
| 2611 | 2609 | class __indirect_expr |
| 2612 | 2610 | { |
| 2613 | typedef typename remove_reference<_ValExpr>::type _RmExpr; | |
| 2611 | typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr; | |
| 2614 | 2612 | public: |
| 2615 | 2613 | typedef typename _RmExpr::value_type value_type; |
| 2616 | 2614 | typedef value_type __result_type; |
| ... | ... | @@ -2650,7 +2648,7 @@ public: |
| 2650 | 2648 | template<class _ValExpr> |
| 2651 | 2649 | class __val_expr |
| 2652 | 2650 | { |
| 2653 | typedef typename remove_reference<_ValExpr>::type _RmExpr; | |
| 2651 | typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr; | |
| 2654 | 2652 | |
| 2655 | 2653 | _ValExpr __expr_; |
| 2656 | 2654 | public: |
| ... | ... | @@ -4932,4 +4930,11 @@ _LIBCPP_END_NAMESPACE_STD |
| 4932 | 4930 | |
| 4933 | 4931 | _LIBCPP_POP_MACROS |
| 4934 | 4932 | |
| 4933 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 4934 | # include <algorithm> | |
| 4935 | # include <concepts> | |
| 4936 | # include <cstring> | |
| 4937 | # include <functional> | |
| 4938 | #endif | |
| 4939 | ||
| 4935 | 4940 | #endif // _LIBCPP_VALARRAY |
lib/libcxx/include/variant+227-178| ... | ... | @@ -22,8 +22,8 @@ namespace std { |
| 22 | 22 | |
| 23 | 23 | // 20.7.2.1, constructors |
| 24 | 24 | constexpr variant() noexcept(see below); |
| 25 | variant(const variant&); // constexpr in C++20 | |
| 26 | variant(variant&&) noexcept(see below); // constexpr in C++20 | |
| 25 | constexpr variant(const variant&); | |
| 26 | constexpr variant(variant&&) noexcept(see below); | |
| 27 | 27 | |
| 28 | 28 | template <class T> constexpr variant(T&&) noexcept(see below); |
| 29 | 29 | |
| ... | ... | @@ -45,8 +45,8 @@ namespace std { |
| 45 | 45 | ~variant(); |
| 46 | 46 | |
| 47 | 47 | // 20.7.2.3, assignment |
| 48 | variant& operator=(const variant&); // constexpr in C++20 | |
| 49 | variant& operator=(variant&&) noexcept(see below); // constexpr in C++20 | |
| 48 | constexpr variant& operator=(const variant&); | |
| 49 | constexpr variant& operator=(variant&&) noexcept(see below); | |
| 50 | 50 | |
| 51 | 51 | template <class T> variant& operator=(T&&) noexcept(see below); |
| 52 | 52 | |
| ... | ... | @@ -165,6 +165,10 @@ namespace std { |
| 165 | 165 | template <class... Types> |
| 166 | 166 | constexpr bool operator>=(const variant<Types...>&, const variant<Types...>&); |
| 167 | 167 | |
| 168 | template <class... Types> requires (three_way_comparable<Types> && ...) | |
| 169 | constexpr common_comparison_category_t<compare_three_way_result_t<Types>...> | |
| 170 | operator<=>(const variant<Types...>&, const variant<Types...>&); // since C++20 | |
| 171 | ||
| 168 | 172 | // 20.7.6, visitation |
| 169 | 173 | template <class Visitor, class... Variants> |
| 170 | 174 | constexpr see below visit(Visitor&&, Variants&&...); |
| ... | ... | @@ -176,12 +180,13 @@ namespace std { |
| 176 | 180 | struct monostate; |
| 177 | 181 | |
| 178 | 182 | // 20.7.8, monostate relational operators |
| 179 | constexpr bool operator<(monostate, monostate) noexcept; | |
| 180 | constexpr bool operator>(monostate, monostate) noexcept; | |
| 181 | constexpr bool operator<=(monostate, monostate) noexcept; | |
| 182 | constexpr bool operator>=(monostate, monostate) noexcept; | |
| 183 | 183 | constexpr bool operator==(monostate, monostate) noexcept; |
| 184 | constexpr bool operator!=(monostate, monostate) noexcept; | |
| 184 | constexpr bool operator!=(monostate, monostate) noexcept; // until C++20 | |
| 185 | constexpr bool operator<(monostate, monostate) noexcept; // until C++20 | |
| 186 | constexpr bool operator>(monostate, monostate) noexcept; // until C++20 | |
| 187 | constexpr bool operator<=(monostate, monostate) noexcept; // until C++20 | |
| 188 | constexpr bool operator>=(monostate, monostate) noexcept; // until C++20 | |
| 189 | constexpr strong_ordering operator<=>(monostate, monostate) noexcept; // since C++20 | |
| 185 | 190 | |
| 186 | 191 | // 20.7.9, specialized algorithms |
| 187 | 192 | template <class... Types> |
| ... | ... | @@ -201,11 +206,31 @@ namespace std { |
| 201 | 206 | |
| 202 | 207 | #include <__assert> // all public C++ headers provide the assertion handler |
| 203 | 208 | #include <__availability> |
| 209 | #include <__compare/common_comparison_category.h> | |
| 210 | #include <__compare/compare_three_way_result.h> | |
| 211 | #include <__compare/three_way_comparable.h> | |
| 204 | 212 | #include <__config> |
| 205 | 213 | #include <__functional/hash.h> |
| 214 | #include <__functional/invoke.h> | |
| 206 | 215 | #include <__functional/operations.h> |
| 207 | 216 | #include <__functional/unary_function.h> |
| 208 | #include <__tuple> | |
| 217 | #include <__type_traits/add_const.h> | |
| 218 | #include <__type_traits/add_cv.h> | |
| 219 | #include <__type_traits/add_pointer.h> | |
| 220 | #include <__type_traits/add_volatile.h> | |
| 221 | #include <__type_traits/dependent_type.h> | |
| 222 | #include <__type_traits/is_array.h> | |
| 223 | #include <__type_traits/is_destructible.h> | |
| 224 | #include <__type_traits/is_nothrow_move_constructible.h> | |
| 225 | #include <__type_traits/is_trivially_copy_assignable.h> | |
| 226 | #include <__type_traits/is_trivially_copy_constructible.h> | |
| 227 | #include <__type_traits/is_trivially_destructible.h> | |
| 228 | #include <__type_traits/is_trivially_move_assignable.h> | |
| 229 | #include <__type_traits/is_trivially_move_constructible.h> | |
| 230 | #include <__type_traits/is_void.h> | |
| 231 | #include <__type_traits/remove_const.h> | |
| 232 | #include <__type_traits/type_identity.h> | |
| 233 | #include <__type_traits/void_t.h> | |
| 209 | 234 | #include <__utility/forward.h> |
| 210 | 235 | #include <__utility/in_place.h> |
| 211 | 236 | #include <__utility/move.h> |
| ... | ... | @@ -216,15 +241,11 @@ namespace std { |
| 216 | 241 | #include <limits> |
| 217 | 242 | #include <new> |
| 218 | 243 | #include <tuple> |
| 219 | #include <type_traits> | |
| 220 | 244 | #include <version> |
| 221 | 245 | |
| 222 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 223 | # include <typeinfo> | |
| 224 | # include <utility> | |
| 225 | #endif | |
| 226 | ||
| 227 | 246 | // standard-mandated includes |
| 247 | ||
| 248 | // [variant.syn] | |
| 228 | 249 | #include <compare> |
| 229 | 250 | |
| 230 | 251 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -238,7 +259,7 @@ namespace std { // explicitly not using versioning namespace |
| 238 | 259 | |
| 239 | 260 | class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS bad_variant_access : public exception { |
| 240 | 261 | public: |
| 241 | virtual const char* what() const _NOEXCEPT; | |
| 262 | const char* what() const _NOEXCEPT override; | |
| 242 | 263 | }; |
| 243 | 264 | |
| 244 | 265 | } // namespace std |
| ... | ... | @@ -261,7 +282,7 @@ struct __farray { |
| 261 | 282 | }; |
| 262 | 283 | |
| 263 | 284 | _LIBCPP_NORETURN |
| 264 | inline _LIBCPP_INLINE_VISIBILITY | |
| 285 | inline _LIBCPP_HIDE_FROM_ABI | |
| 265 | 286 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS |
| 266 | 287 | void __throw_bad_variant_access() { |
| 267 | 288 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| ... | ... | @@ -320,7 +341,7 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> { |
| 320 | 341 | |
| 321 | 342 | inline constexpr size_t variant_npos = static_cast<size_t>(-1); |
| 322 | 343 | |
| 323 | constexpr int __choose_index_type(unsigned int __num_elem) { | |
| 344 | _LIBCPP_HIDE_FROM_ABI constexpr int __choose_index_type(unsigned int __num_elem) { | |
| 324 | 345 | if (__num_elem < numeric_limits<unsigned char>::max()) |
| 325 | 346 | return 0; |
| 326 | 347 | if (__num_elem < numeric_limits<unsigned short>::max()) |
| ... | ... | @@ -372,7 +393,7 @@ __as_variant(const variant<_Types...>&& __vs) noexcept { |
| 372 | 393 | namespace __find_detail { |
| 373 | 394 | |
| 374 | 395 | template <class _Tp, class... _Types> |
| 375 | inline _LIBCPP_INLINE_VISIBILITY | |
| 396 | _LIBCPP_HIDE_FROM_ABI | |
| 376 | 397 | constexpr size_t __find_index() { |
| 377 | 398 | constexpr bool __matches[] = {is_same_v<_Tp, _Types>...}; |
| 378 | 399 | size_t __result = __not_found; |
| ... | ... | @@ -417,7 +438,7 @@ constexpr _Trait __trait = |
| 417 | 438 | ? _Trait::_TriviallyAvailable |
| 418 | 439 | : _IsAvailable<_Tp>::value ? _Trait::_Available : _Trait::_Unavailable; |
| 419 | 440 | |
| 420 | inline _LIBCPP_INLINE_VISIBILITY | |
| 441 | _LIBCPP_HIDE_FROM_ABI | |
| 421 | 442 | constexpr _Trait __common_trait(initializer_list<_Trait> __traits) { |
| 422 | 443 | _Trait __result = _Trait::_TriviallyAvailable; |
| 423 | 444 | for (_Trait __t : __traits) { |
| ... | ... | @@ -431,24 +452,24 @@ constexpr _Trait __common_trait(initializer_list<_Trait> __traits) { |
| 431 | 452 | template <typename... _Types> |
| 432 | 453 | struct __traits { |
| 433 | 454 | static constexpr _Trait __copy_constructible_trait = |
| 434 | __common_trait({__trait<_Types, | |
| 455 | __variant_detail::__common_trait({__trait<_Types, | |
| 435 | 456 | is_trivially_copy_constructible, |
| 436 | 457 | is_copy_constructible>...}); |
| 437 | 458 | |
| 438 | 459 | static constexpr _Trait __move_constructible_trait = |
| 439 | __common_trait({__trait<_Types, | |
| 460 | __variant_detail::__common_trait({__trait<_Types, | |
| 440 | 461 | is_trivially_move_constructible, |
| 441 | 462 | is_move_constructible>...}); |
| 442 | 463 | |
| 443 | static constexpr _Trait __copy_assignable_trait = __common_trait( | |
| 464 | static constexpr _Trait __copy_assignable_trait = __variant_detail::__common_trait( | |
| 444 | 465 | {__copy_constructible_trait, |
| 445 | 466 | __trait<_Types, is_trivially_copy_assignable, is_copy_assignable>...}); |
| 446 | 467 | |
| 447 | static constexpr _Trait __move_assignable_trait = __common_trait( | |
| 468 | static constexpr _Trait __move_assignable_trait = __variant_detail::__common_trait( | |
| 448 | 469 | {__move_constructible_trait, |
| 449 | 470 | __trait<_Types, is_trivially_move_assignable, is_move_assignable>...}); |
| 450 | 471 | |
| 451 | static constexpr _Trait __destructible_trait = __common_trait( | |
| 472 | static constexpr _Trait __destructible_trait = __variant_detail::__common_trait( | |
| 452 | 473 | {__trait<_Types, is_trivially_destructible, is_destructible>...}); |
| 453 | 474 | }; |
| 454 | 475 | |
| ... | ... | @@ -456,13 +477,13 @@ namespace __access { |
| 456 | 477 | |
| 457 | 478 | struct __union { |
| 458 | 479 | template <class _Vp> |
| 459 | inline _LIBCPP_INLINE_VISIBILITY | |
| 480 | _LIBCPP_HIDE_FROM_ABI | |
| 460 | 481 | static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<0>) { |
| 461 | 482 | return _VSTD::forward<_Vp>(__v).__head; |
| 462 | 483 | } |
| 463 | 484 | |
| 464 | 485 | template <class _Vp, size_t _Ip> |
| 465 | inline _LIBCPP_INLINE_VISIBILITY | |
| 486 | _LIBCPP_HIDE_FROM_ABI | |
| 466 | 487 | static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<_Ip>) { |
| 467 | 488 | return __get_alt(_VSTD::forward<_Vp>(__v).__tail, in_place_index<_Ip - 1>); |
| 468 | 489 | } |
| ... | ... | @@ -470,7 +491,7 @@ struct __union { |
| 470 | 491 | |
| 471 | 492 | struct __base { |
| 472 | 493 | template <size_t _Ip, class _Vp> |
| 473 | inline _LIBCPP_INLINE_VISIBILITY | |
| 494 | _LIBCPP_HIDE_FROM_ABI | |
| 474 | 495 | static constexpr auto&& __get_alt(_Vp&& __v) { |
| 475 | 496 | return __union::__get_alt(_VSTD::forward<_Vp>(__v).__data, |
| 476 | 497 | in_place_index<_Ip>); |
| ... | ... | @@ -479,9 +500,9 @@ struct __base { |
| 479 | 500 | |
| 480 | 501 | struct __variant { |
| 481 | 502 | template <size_t _Ip, class _Vp> |
| 482 | inline _LIBCPP_INLINE_VISIBILITY | |
| 503 | _LIBCPP_HIDE_FROM_ABI | |
| 483 | 504 | static constexpr auto&& __get_alt(_Vp&& __v) { |
| 484 | return __base::__get_alt<_Ip>(_VSTD::forward<_Vp>(__v).__impl); | |
| 505 | return __base::__get_alt<_Ip>(_VSTD::forward<_Vp>(__v).__impl_); | |
| 485 | 506 | } |
| 486 | 507 | }; |
| 487 | 508 | |
| ... | ... | @@ -491,7 +512,7 @@ namespace __visitation { |
| 491 | 512 | |
| 492 | 513 | struct __base { |
| 493 | 514 | template <class _Visitor, class... _Vs> |
| 494 | inline _LIBCPP_INLINE_VISIBILITY | |
| 515 | _LIBCPP_HIDE_FROM_ABI | |
| 495 | 516 | static constexpr decltype(auto) |
| 496 | 517 | __visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) { |
| 497 | 518 | constexpr auto __fdiagonal = |
| ... | ... | @@ -502,7 +523,7 @@ struct __base { |
| 502 | 523 | } |
| 503 | 524 | |
| 504 | 525 | template <class _Visitor, class... _Vs> |
| 505 | inline _LIBCPP_INLINE_VISIBILITY | |
| 526 | _LIBCPP_HIDE_FROM_ABI | |
| 506 | 527 | static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor, |
| 507 | 528 | _Vs&&... __vs) { |
| 508 | 529 | constexpr auto __fmatrix = |
| ... | ... | @@ -515,11 +536,11 @@ struct __base { |
| 515 | 536 | |
| 516 | 537 | private: |
| 517 | 538 | template <class _Tp> |
| 518 | inline _LIBCPP_INLINE_VISIBILITY | |
| 539 | _LIBCPP_HIDE_FROM_ABI | |
| 519 | 540 | static constexpr const _Tp& __at(const _Tp& __elem) { return __elem; } |
| 520 | 541 | |
| 521 | 542 | template <class _Tp, size_t _Np, typename... _Indices> |
| 522 | inline _LIBCPP_INLINE_VISIBILITY | |
| 543 | _LIBCPP_HIDE_FROM_ABI | |
| 523 | 544 | static constexpr auto&& __at(const __farray<_Tp, _Np>& __elems, |
| 524 | 545 | size_t __index, _Indices... __indices) { |
| 525 | 546 | return __at(__elems[__index], __indices...); |
| ... | ... | @@ -533,17 +554,17 @@ private: |
| 533 | 554 | } |
| 534 | 555 | |
| 535 | 556 | template <class... _Fs> |
| 536 | inline _LIBCPP_INLINE_VISIBILITY | |
| 557 | _LIBCPP_HIDE_FROM_ABI | |
| 537 | 558 | static constexpr auto __make_farray(_Fs&&... __fs) { |
| 538 | __std_visit_visitor_return_type_check<__uncvref_t<_Fs>...>(); | |
| 539 | using __result = __farray<common_type_t<__uncvref_t<_Fs>...>, sizeof...(_Fs)>; | |
| 559 | __std_visit_visitor_return_type_check<__remove_cvref_t<_Fs>...>(); | |
| 560 | using __result = __farray<common_type_t<__remove_cvref_t<_Fs>...>, sizeof...(_Fs)>; | |
| 540 | 561 | return __result{{_VSTD::forward<_Fs>(__fs)...}}; |
| 541 | 562 | } |
| 542 | 563 | |
| 543 | 564 | template <size_t... _Is> |
| 544 | 565 | struct __dispatcher { |
| 545 | 566 | template <class _Fp, class... _Vs> |
| 546 | inline _LIBCPP_INLINE_VISIBILITY | |
| 567 | _LIBCPP_HIDE_FROM_ABI | |
| 547 | 568 | static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) { |
| 548 | 569 | return _VSTD::__invoke( |
| 549 | 570 | static_cast<_Fp>(__f), |
| ... | ... | @@ -552,40 +573,40 @@ private: |
| 552 | 573 | }; |
| 553 | 574 | |
| 554 | 575 | template <class _Fp, class... _Vs, size_t... _Is> |
| 555 | inline _LIBCPP_INLINE_VISIBILITY | |
| 576 | _LIBCPP_HIDE_FROM_ABI | |
| 556 | 577 | static constexpr auto __make_dispatch(index_sequence<_Is...>) { |
| 557 | 578 | return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>; |
| 558 | 579 | } |
| 559 | 580 | |
| 560 | 581 | template <size_t _Ip, class _Fp, class... _Vs> |
| 561 | inline _LIBCPP_INLINE_VISIBILITY | |
| 582 | _LIBCPP_HIDE_FROM_ABI | |
| 562 | 583 | static constexpr auto __make_fdiagonal_impl() { |
| 563 | 584 | return __make_dispatch<_Fp, _Vs...>( |
| 564 | 585 | index_sequence<((void)__type_identity<_Vs>{}, _Ip)...>{}); |
| 565 | 586 | } |
| 566 | 587 | |
| 567 | 588 | template <class _Fp, class... _Vs, size_t... _Is> |
| 568 | inline _LIBCPP_INLINE_VISIBILITY | |
| 589 | _LIBCPP_HIDE_FROM_ABI | |
| 569 | 590 | static constexpr auto __make_fdiagonal_impl(index_sequence<_Is...>) { |
| 570 | 591 | return __base::__make_farray(__make_fdiagonal_impl<_Is, _Fp, _Vs...>()...); |
| 571 | 592 | } |
| 572 | 593 | |
| 573 | 594 | template <class _Fp, class _Vp, class... _Vs> |
| 574 | inline _LIBCPP_INLINE_VISIBILITY | |
| 595 | _LIBCPP_HIDE_FROM_ABI | |
| 575 | 596 | static constexpr auto __make_fdiagonal() { |
| 576 | constexpr size_t _Np = __uncvref_t<_Vp>::__size(); | |
| 577 | static_assert(__all<(_Np == __uncvref_t<_Vs>::__size())...>::value); | |
| 597 | constexpr size_t _Np = __remove_cvref_t<_Vp>::__size(); | |
| 598 | static_assert(__all<(_Np == __remove_cvref_t<_Vs>::__size())...>::value); | |
| 578 | 599 | return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<_Np>{}); |
| 579 | 600 | } |
| 580 | 601 | |
| 581 | 602 | template <class _Fp, class... _Vs, size_t... _Is> |
| 582 | inline _LIBCPP_INLINE_VISIBILITY | |
| 603 | _LIBCPP_HIDE_FROM_ABI | |
| 583 | 604 | static constexpr auto __make_fmatrix_impl(index_sequence<_Is...> __is) { |
| 584 | 605 | return __make_dispatch<_Fp, _Vs...>(__is); |
| 585 | 606 | } |
| 586 | 607 | |
| 587 | 608 | template <class _Fp, class... _Vs, size_t... _Is, size_t... _Js, class... _Ls> |
| 588 | inline _LIBCPP_INLINE_VISIBILITY | |
| 609 | _LIBCPP_HIDE_FROM_ABI | |
| 589 | 610 | static constexpr auto __make_fmatrix_impl(index_sequence<_Is...>, |
| 590 | 611 | index_sequence<_Js...>, |
| 591 | 612 | _Ls... __ls) { |
| ... | ... | @@ -594,34 +615,34 @@ private: |
| 594 | 615 | } |
| 595 | 616 | |
| 596 | 617 | template <class _Fp, class... _Vs> |
| 597 | inline _LIBCPP_INLINE_VISIBILITY | |
| 618 | _LIBCPP_HIDE_FROM_ABI | |
| 598 | 619 | static constexpr auto __make_fmatrix() { |
| 599 | 620 | return __make_fmatrix_impl<_Fp, _Vs...>( |
| 600 | index_sequence<>{}, make_index_sequence<__uncvref_t<_Vs>::__size()>{}...); | |
| 621 | index_sequence<>{}, make_index_sequence<__remove_cvref_t<_Vs>::__size()>{}...); | |
| 601 | 622 | } |
| 602 | 623 | }; |
| 603 | 624 | |
| 604 | 625 | struct __variant { |
| 605 | 626 | template <class _Visitor, class... _Vs> |
| 606 | inline _LIBCPP_INLINE_VISIBILITY | |
| 627 | _LIBCPP_HIDE_FROM_ABI | |
| 607 | 628 | static constexpr decltype(auto) |
| 608 | 629 | __visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) { |
| 609 | 630 | return __base::__visit_alt_at(__index, |
| 610 | 631 | _VSTD::forward<_Visitor>(__visitor), |
| 611 | _VSTD::forward<_Vs>(__vs).__impl...); | |
| 632 | _VSTD::forward<_Vs>(__vs).__impl_...); | |
| 612 | 633 | } |
| 613 | 634 | |
| 614 | 635 | template <class _Visitor, class... _Vs> |
| 615 | inline _LIBCPP_INLINE_VISIBILITY | |
| 636 | _LIBCPP_HIDE_FROM_ABI | |
| 616 | 637 | static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor, |
| 617 | 638 | _Vs&&... __vs) { |
| 618 | 639 | return __base::__visit_alt( |
| 619 | 640 | _VSTD::forward<_Visitor>(__visitor), |
| 620 | _VSTD::__as_variant(_VSTD::forward<_Vs>(__vs)).__impl...); | |
| 641 | _VSTD::__as_variant(_VSTD::forward<_Vs>(__vs)).__impl_...); | |
| 621 | 642 | } |
| 622 | 643 | |
| 623 | 644 | template <class _Visitor, class... _Vs> |
| 624 | inline _LIBCPP_INLINE_VISIBILITY | |
| 645 | _LIBCPP_HIDE_FROM_ABI | |
| 625 | 646 | static constexpr decltype(auto) |
| 626 | 647 | __visit_value_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) { |
| 627 | 648 | return __visit_alt_at( |
| ... | ... | @@ -631,7 +652,7 @@ struct __variant { |
| 631 | 652 | } |
| 632 | 653 | |
| 633 | 654 | template <class _Visitor, class... _Vs> |
| 634 | inline _LIBCPP_INLINE_VISIBILITY | |
| 655 | _LIBCPP_HIDE_FROM_ABI | |
| 635 | 656 | static constexpr decltype(auto) __visit_value(_Visitor&& __visitor, |
| 636 | 657 | _Vs&&... __vs) { |
| 637 | 658 | return __visit_alt( |
| ... | ... | @@ -641,7 +662,7 @@ struct __variant { |
| 641 | 662 | |
| 642 | 663 | #if _LIBCPP_STD_VER > 17 |
| 643 | 664 | template <class _Rp, class _Visitor, class... _Vs> |
| 644 | inline _LIBCPP_INLINE_VISIBILITY | |
| 665 | _LIBCPP_HIDE_FROM_ABI | |
| 645 | 666 | static constexpr _Rp __visit_value(_Visitor&& __visitor, |
| 646 | 667 | _Vs&&... __vs) { |
| 647 | 668 | return __visit_alt( |
| ... | ... | @@ -660,7 +681,7 @@ private: |
| 660 | 681 | template <class _Visitor> |
| 661 | 682 | struct __value_visitor { |
| 662 | 683 | template <class... _Alts> |
| 663 | inline _LIBCPP_INLINE_VISIBILITY | |
| 684 | _LIBCPP_HIDE_FROM_ABI | |
| 664 | 685 | constexpr decltype(auto) operator()(_Alts&&... __alts) const { |
| 665 | 686 | __std_visit_exhaustive_visitor_check< |
| 666 | 687 | _Visitor, |
| ... | ... | @@ -675,7 +696,7 @@ private: |
| 675 | 696 | template <class _Rp, class _Visitor> |
| 676 | 697 | struct __value_visitor_return_type { |
| 677 | 698 | template <class... _Alts> |
| 678 | inline _LIBCPP_INLINE_VISIBILITY | |
| 699 | _LIBCPP_HIDE_FROM_ABI | |
| 679 | 700 | constexpr _Rp operator()(_Alts&&... __alts) const { |
| 680 | 701 | __std_visit_exhaustive_visitor_check< |
| 681 | 702 | _Visitor, |
| ... | ... | @@ -695,14 +716,14 @@ private: |
| 695 | 716 | #endif |
| 696 | 717 | |
| 697 | 718 | template <class _Visitor> |
| 698 | inline _LIBCPP_INLINE_VISIBILITY | |
| 719 | _LIBCPP_HIDE_FROM_ABI | |
| 699 | 720 | static constexpr auto __make_value_visitor(_Visitor&& __visitor) { |
| 700 | 721 | return __value_visitor<_Visitor>{_VSTD::forward<_Visitor>(__visitor)}; |
| 701 | 722 | } |
| 702 | 723 | |
| 703 | 724 | #if _LIBCPP_STD_VER > 17 |
| 704 | 725 | template <class _Rp, class _Visitor> |
| 705 | inline _LIBCPP_INLINE_VISIBILITY | |
| 726 | _LIBCPP_HIDE_FROM_ABI | |
| 706 | 727 | static constexpr auto __make_value_visitor(_Visitor&& __visitor) { |
| 707 | 728 | return __value_visitor_return_type<_Rp, _Visitor>{_VSTD::forward<_Visitor>(__visitor)}; |
| 708 | 729 | } |
| ... | ... | @@ -716,7 +737,7 @@ struct _LIBCPP_TEMPLATE_VIS __alt { |
| 716 | 737 | using __value_type = _Tp; |
| 717 | 738 | |
| 718 | 739 | template <class... _Args> |
| 719 | inline _LIBCPP_INLINE_VISIBILITY | |
| 740 | _LIBCPP_HIDE_FROM_ABI | |
| 720 | 741 | explicit constexpr __alt(in_place_t, _Args&&... __args) |
| 721 | 742 | : __value(_VSTD::forward<_Args>(__args)...) {} |
| 722 | 743 | |
| ... | ... | @@ -731,21 +752,21 @@ union _LIBCPP_TEMPLATE_VIS __union<_DestructibleTrait, _Index> {}; |
| 731 | 752 | |
| 732 | 753 | #define _LIBCPP_VARIANT_UNION(destructible_trait, destructor) \ |
| 733 | 754 | template <size_t _Index, class _Tp, class... _Types> \ |
| 734 | union _LIBCPP_TEMPLATE_VIS __union<destructible_trait, \ | |
| 755 | union _LIBCPP_TEMPLATE_VIS __union<destructible_trait, \ | |
| 735 | 756 | _Index, \ |
| 736 | 757 | _Tp, \ |
| 737 | 758 | _Types...> { \ |
| 738 | 759 | public: \ |
| 739 | inline _LIBCPP_INLINE_VISIBILITY \ | |
| 760 | _LIBCPP_HIDE_FROM_ABI \ | |
| 740 | 761 | explicit constexpr __union(__valueless_t) noexcept : __dummy{} {} \ |
| 741 | 762 | \ |
| 742 | 763 | template <class... _Args> \ |
| 743 | inline _LIBCPP_INLINE_VISIBILITY \ | |
| 764 | _LIBCPP_HIDE_FROM_ABI \ | |
| 744 | 765 | explicit constexpr __union(in_place_index_t<0>, _Args&&... __args) \ |
| 745 | 766 | : __head(in_place, _VSTD::forward<_Args>(__args)...) {} \ |
| 746 | 767 | \ |
| 747 | 768 | template <size_t _Ip, class... _Args> \ |
| 748 | inline _LIBCPP_INLINE_VISIBILITY \ | |
| 769 | _LIBCPP_HIDE_FROM_ABI \ | |
| 749 | 770 | explicit constexpr __union(in_place_index_t<_Ip>, _Args&&... __args) \ |
| 750 | 771 | : __tail(in_place_index<_Ip - 1>, _VSTD::forward<_Args>(__args)...) {} \ |
| 751 | 772 | \ |
| ... | ... | @@ -776,41 +797,41 @@ class _LIBCPP_TEMPLATE_VIS __base { |
| 776 | 797 | public: |
| 777 | 798 | using __index_t = __variant_index_t<sizeof...(_Types)>; |
| 778 | 799 | |
| 779 | inline _LIBCPP_INLINE_VISIBILITY | |
| 800 | _LIBCPP_HIDE_FROM_ABI | |
| 780 | 801 | explicit constexpr __base(__valueless_t __tag) noexcept |
| 781 | 802 | : __data(__tag), __index(__variant_npos<__index_t>) {} |
| 782 | 803 | |
| 783 | 804 | template <size_t _Ip, class... _Args> |
| 784 | inline _LIBCPP_INLINE_VISIBILITY | |
| 805 | _LIBCPP_HIDE_FROM_ABI | |
| 785 | 806 | explicit constexpr __base(in_place_index_t<_Ip>, _Args&&... __args) |
| 786 | 807 | : |
| 787 | 808 | __data(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...), |
| 788 | 809 | __index(_Ip) {} |
| 789 | 810 | |
| 790 | inline _LIBCPP_INLINE_VISIBILITY | |
| 811 | _LIBCPP_HIDE_FROM_ABI | |
| 791 | 812 | constexpr bool valueless_by_exception() const noexcept { |
| 792 | 813 | return index() == variant_npos; |
| 793 | 814 | } |
| 794 | 815 | |
| 795 | inline _LIBCPP_INLINE_VISIBILITY | |
| 816 | _LIBCPP_HIDE_FROM_ABI | |
| 796 | 817 | constexpr size_t index() const noexcept { |
| 797 | 818 | return __index == __variant_npos<__index_t> ? variant_npos : __index; |
| 798 | 819 | } |
| 799 | 820 | |
| 800 | 821 | protected: |
| 801 | inline _LIBCPP_INLINE_VISIBILITY | |
| 822 | _LIBCPP_HIDE_FROM_ABI | |
| 802 | 823 | constexpr auto&& __as_base() & { return *this; } |
| 803 | 824 | |
| 804 | inline _LIBCPP_INLINE_VISIBILITY | |
| 825 | _LIBCPP_HIDE_FROM_ABI | |
| 805 | 826 | constexpr auto&& __as_base() && { return _VSTD::move(*this); } |
| 806 | 827 | |
| 807 | inline _LIBCPP_INLINE_VISIBILITY | |
| 828 | _LIBCPP_HIDE_FROM_ABI | |
| 808 | 829 | constexpr auto&& __as_base() const & { return *this; } |
| 809 | 830 | |
| 810 | inline _LIBCPP_INLINE_VISIBILITY | |
| 831 | _LIBCPP_HIDE_FROM_ABI | |
| 811 | 832 | constexpr auto&& __as_base() const && { return _VSTD::move(*this); } |
| 812 | 833 | |
| 813 | inline _LIBCPP_INLINE_VISIBILITY | |
| 834 | _LIBCPP_HIDE_FROM_ABI | |
| 814 | 835 | static constexpr size_t __size() { return sizeof...(_Types); } |
| 815 | 836 | |
| 816 | 837 | __union<_DestructibleTrait, 0, _Types...> __data; |
| ... | ... | @@ -842,7 +863,7 @@ class _LIBCPP_TEMPLATE_VIS __dtor; |
| 842 | 863 | __dtor& operator=(__dtor&&) = default; \ |
| 843 | 864 | \ |
| 844 | 865 | protected: \ |
| 845 | inline _LIBCPP_INLINE_VISIBILITY \ | |
| 866 | inline _LIBCPP_HIDE_FROM_ABI \ | |
| 846 | 867 | destroy \ |
| 847 | 868 | } |
| 848 | 869 | |
| ... | ... | @@ -858,7 +879,7 @@ _LIBCPP_VARIANT_DESTRUCTOR( |
| 858 | 879 | if (!this->valueless_by_exception()) { |
| 859 | 880 | __visitation::__base::__visit_alt( |
| 860 | 881 | [](auto& __alt) noexcept { |
| 861 | using __alt_type = __uncvref_t<decltype(__alt)>; | |
| 882 | using __alt_type = __remove_cvref_t<decltype(__alt)>; | |
| 862 | 883 | __alt.~__alt_type(); |
| 863 | 884 | }, |
| 864 | 885 | *this); |
| ... | ... | @@ -883,7 +904,7 @@ public: |
| 883 | 904 | |
| 884 | 905 | protected: |
| 885 | 906 | template <size_t _Ip, class _Tp, class... _Args> |
| 886 | inline _LIBCPP_INLINE_VISIBILITY | |
| 907 | _LIBCPP_HIDE_FROM_ABI | |
| 887 | 908 | static _Tp& __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) { |
| 888 | 909 | ::new ((void*)_VSTD::addressof(__a)) |
| 889 | 910 | __alt<_Ip, _Tp>(in_place, _VSTD::forward<_Args>(__args)...); |
| ... | ... | @@ -891,7 +912,7 @@ protected: |
| 891 | 912 | } |
| 892 | 913 | |
| 893 | 914 | template <class _Rhs> |
| 894 | inline _LIBCPP_INLINE_VISIBILITY | |
| 915 | _LIBCPP_HIDE_FROM_ABI | |
| 895 | 916 | static void __generic_construct(__ctor& __lhs, _Rhs&& __rhs) { |
| 896 | 917 | __lhs.__destroy(); |
| 897 | 918 | if (!__rhs.valueless_by_exception()) { |
| ... | ... | @@ -954,7 +975,7 @@ class _LIBCPP_TEMPLATE_VIS __copy_constructor; |
| 954 | 975 | #define _LIBCPP_VARIANT_COPY_CONSTRUCTOR(copy_constructible_trait, \ |
| 955 | 976 | copy_constructor) \ |
| 956 | 977 | template <class... _Types> \ |
| 957 | class _LIBCPP_TEMPLATE_VIS __copy_constructor<__traits<_Types...>, \ | |
| 978 | class _LIBCPP_TEMPLATE_VIS __copy_constructor<__traits<_Types...>, \ | |
| 958 | 979 | copy_constructible_trait> \ |
| 959 | 980 | : public __move_constructor<__traits<_Types...>> { \ |
| 960 | 981 | using __base_type = __move_constructor<__traits<_Types...>>; \ |
| ... | ... | @@ -996,7 +1017,7 @@ public: |
| 996 | 1017 | using __base_type::operator=; |
| 997 | 1018 | |
| 998 | 1019 | template <size_t _Ip, class... _Args> |
| 999 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1020 | _LIBCPP_HIDE_FROM_ABI | |
| 1000 | 1021 | auto& __emplace(_Args&&... __args) { |
| 1001 | 1022 | this->__destroy(); |
| 1002 | 1023 | auto& __res = this->__construct_alt(__access::__base::__get_alt<_Ip>(*this), |
| ... | ... | @@ -1007,7 +1028,7 @@ public: |
| 1007 | 1028 | |
| 1008 | 1029 | protected: |
| 1009 | 1030 | template <size_t _Ip, class _Tp, class _Arg> |
| 1010 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1031 | _LIBCPP_HIDE_FROM_ABI | |
| 1011 | 1032 | void __assign_alt(__alt<_Ip, _Tp>& __a, _Arg&& __arg) { |
| 1012 | 1033 | if (this->index() == _Ip) { |
| 1013 | 1034 | __a.__value = _VSTD::forward<_Arg>(__arg); |
| ... | ... | @@ -1028,7 +1049,7 @@ protected: |
| 1028 | 1049 | } |
| 1029 | 1050 | |
| 1030 | 1051 | template <class _That> |
| 1031 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1052 | _LIBCPP_HIDE_FROM_ABI | |
| 1032 | 1053 | void __generic_assign(_That&& __that) { |
| 1033 | 1054 | if (this->valueless_by_exception() && __that.valueless_by_exception()) { |
| 1034 | 1055 | // do nothing. |
| ... | ... | @@ -1053,7 +1074,7 @@ class _LIBCPP_TEMPLATE_VIS __move_assignment; |
| 1053 | 1074 | #define _LIBCPP_VARIANT_MOVE_ASSIGNMENT(move_assignable_trait, \ |
| 1054 | 1075 | move_assignment) \ |
| 1055 | 1076 | template <class... _Types> \ |
| 1056 | class _LIBCPP_TEMPLATE_VIS __move_assignment<__traits<_Types...>, \ | |
| 1077 | class _LIBCPP_TEMPLATE_VIS __move_assignment<__traits<_Types...>, \ | |
| 1057 | 1078 | move_assignable_trait> \ |
| 1058 | 1079 | : public __assignment<__traits<_Types...>> { \ |
| 1059 | 1080 | using __base_type = __assignment<__traits<_Types...>>; \ |
| ... | ... | @@ -1094,7 +1115,7 @@ class _LIBCPP_TEMPLATE_VIS __copy_assignment; |
| 1094 | 1115 | #define _LIBCPP_VARIANT_COPY_ASSIGNMENT(copy_assignable_trait, \ |
| 1095 | 1116 | copy_assignment) \ |
| 1096 | 1117 | template <class... _Types> \ |
| 1097 | class _LIBCPP_TEMPLATE_VIS __copy_assignment<__traits<_Types...>, \ | |
| 1118 | class _LIBCPP_TEMPLATE_VIS __copy_assignment<__traits<_Types...>, \ | |
| 1098 | 1119 | copy_assignable_trait> \ |
| 1099 | 1120 | : public __move_assignment<__traits<_Types...>> { \ |
| 1100 | 1121 | using __base_type = __move_assignment<__traits<_Types...>>; \ |
| ... | ... | @@ -1140,13 +1161,13 @@ public: |
| 1140 | 1161 | __impl& operator=(__impl&&) = default; |
| 1141 | 1162 | |
| 1142 | 1163 | template <size_t _Ip, class _Arg> |
| 1143 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1164 | _LIBCPP_HIDE_FROM_ABI | |
| 1144 | 1165 | void __assign(_Arg&& __arg) { |
| 1145 | 1166 | this->__assign_alt(__access::__base::__get_alt<_Ip>(*this), |
| 1146 | 1167 | _VSTD::forward<_Arg>(__arg)); |
| 1147 | 1168 | } |
| 1148 | 1169 | |
| 1149 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1170 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1150 | 1171 | void __swap(__impl& __that) { |
| 1151 | 1172 | if (this->valueless_by_exception() && __that.valueless_by_exception()) { |
| 1152 | 1173 | // do nothing. |
| ... | ... | @@ -1192,7 +1213,7 @@ public: |
| 1192 | 1213 | } |
| 1193 | 1214 | |
| 1194 | 1215 | private: |
| 1195 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1216 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1196 | 1217 | bool __move_nothrow() const { |
| 1197 | 1218 | constexpr bool __results[] = {is_nothrow_move_constructible_v<_Types>...}; |
| 1198 | 1219 | return this->valueless_by_exception() || __results[this->index()]; |
| ... | ... | @@ -1208,7 +1229,7 @@ struct __narrowing_check { |
| 1208 | 1229 | template <class _Dest> |
| 1209 | 1230 | static auto __test_impl(_Dest (&&)[1]) -> __type_identity<_Dest>; |
| 1210 | 1231 | template <class _Dest, class _Source> |
| 1211 | using _Apply _LIBCPP_NODEBUG = decltype(__test_impl<_Dest>({declval<_Source>()})); | |
| 1232 | using _Apply _LIBCPP_NODEBUG = decltype(__test_impl<_Dest>({std::declval<_Source>()})); | |
| 1212 | 1233 | }; |
| 1213 | 1234 | |
| 1214 | 1235 | template <class _Dest, class _Source> |
| ... | ... | @@ -1230,7 +1251,7 @@ struct __overload { |
| 1230 | 1251 | |
| 1231 | 1252 | template <class _Tp, size_t> |
| 1232 | 1253 | struct __overload_bool { |
| 1233 | template <class _Up, class _Ap = __uncvref_t<_Up>> | |
| 1254 | template <class _Up, class _Ap = __remove_cvref_t<_Up>> | |
| 1234 | 1255 | auto operator()(bool, _Up&&) const |
| 1235 | 1256 | -> enable_if_t<is_same_v<_Ap, bool>, __type_identity<_Tp>>; |
| 1236 | 1257 | }; |
| ... | ... | @@ -1298,36 +1319,36 @@ public: |
| 1298 | 1319 | enable_if_t<__dependent_type<is_default_constructible<__first_type>, |
| 1299 | 1320 | _Dummy>::value, |
| 1300 | 1321 | int> = 0> |
| 1301 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1322 | _LIBCPP_HIDE_FROM_ABI | |
| 1302 | 1323 | constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>) |
| 1303 | : __impl(in_place_index<0>) {} | |
| 1324 | : __impl_(in_place_index<0>) {} | |
| 1304 | 1325 | |
| 1305 | variant(const variant&) = default; | |
| 1306 | variant(variant&&) = default; | |
| 1326 | constexpr variant(const variant&) = default; | |
| 1327 | constexpr variant(variant&&) = default; | |
| 1307 | 1328 | |
| 1308 | 1329 | template < |
| 1309 | 1330 | class _Arg, |
| 1310 | enable_if_t<!is_same_v<__uncvref_t<_Arg>, variant>, int> = 0, | |
| 1311 | enable_if_t<!__is_inplace_type<__uncvref_t<_Arg>>::value, int> = 0, | |
| 1312 | enable_if_t<!__is_inplace_index<__uncvref_t<_Arg>>::value, int> = 0, | |
| 1331 | enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0, | |
| 1332 | enable_if_t<!__is_inplace_type<__remove_cvref_t<_Arg>>::value, int> = 0, | |
| 1333 | enable_if_t<!__is_inplace_index<__remove_cvref_t<_Arg>>::value, int> = 0, | |
| 1313 | 1334 | class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>, |
| 1314 | 1335 | size_t _Ip = |
| 1315 | 1336 | __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, |
| 1316 | 1337 | enable_if_t<is_constructible_v<_Tp, _Arg>, int> = 0> |
| 1317 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1338 | _LIBCPP_HIDE_FROM_ABI | |
| 1318 | 1339 | constexpr variant(_Arg&& __arg) noexcept( |
| 1319 | 1340 | is_nothrow_constructible_v<_Tp, _Arg>) |
| 1320 | : __impl(in_place_index<_Ip>, _VSTD::forward<_Arg>(__arg)) {} | |
| 1341 | : __impl_(in_place_index<_Ip>, _VSTD::forward<_Arg>(__arg)) {} | |
| 1321 | 1342 | |
| 1322 | 1343 | template <size_t _Ip, class... _Args, |
| 1323 | 1344 | class = enable_if_t<(_Ip < sizeof...(_Types)), int>, |
| 1324 | 1345 | class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, |
| 1325 | 1346 | enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0> |
| 1326 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1347 | _LIBCPP_HIDE_FROM_ABI | |
| 1327 | 1348 | explicit constexpr variant( |
| 1328 | 1349 | in_place_index_t<_Ip>, |
| 1329 | 1350 | _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) |
| 1330 | : __impl(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} | |
| 1351 | : __impl_(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} | |
| 1331 | 1352 | |
| 1332 | 1353 | template < |
| 1333 | 1354 | size_t _Ip, |
| ... | ... | @@ -1337,13 +1358,13 @@ public: |
| 1337 | 1358 | class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, |
| 1338 | 1359 | enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, |
| 1339 | 1360 | int> = 0> |
| 1340 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1361 | _LIBCPP_HIDE_FROM_ABI | |
| 1341 | 1362 | explicit constexpr variant( |
| 1342 | 1363 | in_place_index_t<_Ip>, |
| 1343 | 1364 | initializer_list<_Up> __il, |
| 1344 | 1365 | _Args&&... __args) noexcept( |
| 1345 | 1366 | is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) |
| 1346 | : __impl(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} | |
| 1367 | : __impl_(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} | |
| 1347 | 1368 | |
| 1348 | 1369 | template < |
| 1349 | 1370 | class _Tp, |
| ... | ... | @@ -1351,10 +1372,10 @@ public: |
| 1351 | 1372 | size_t _Ip = |
| 1352 | 1373 | __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, |
| 1353 | 1374 | enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0> |
| 1354 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1375 | _LIBCPP_HIDE_FROM_ABI | |
| 1355 | 1376 | explicit constexpr variant(in_place_type_t<_Tp>, _Args&&... __args) noexcept( |
| 1356 | 1377 | is_nothrow_constructible_v<_Tp, _Args...>) |
| 1357 | : __impl(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} | |
| 1378 | : __impl_(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} | |
| 1358 | 1379 | |
| 1359 | 1380 | template < |
| 1360 | 1381 | class _Tp, |
| ... | ... | @@ -1364,32 +1385,32 @@ public: |
| 1364 | 1385 | __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, |
| 1365 | 1386 | enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, |
| 1366 | 1387 | int> = 0> |
| 1367 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1388 | _LIBCPP_HIDE_FROM_ABI | |
| 1368 | 1389 | explicit constexpr variant( |
| 1369 | 1390 | in_place_type_t<_Tp>, |
| 1370 | 1391 | initializer_list<_Up> __il, |
| 1371 | 1392 | _Args&&... __args) noexcept( |
| 1372 | 1393 | is_nothrow_constructible_v<_Tp, initializer_list< _Up>&, _Args...>) |
| 1373 | : __impl(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} | |
| 1394 | : __impl_(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} | |
| 1374 | 1395 | |
| 1375 | 1396 | ~variant() = default; |
| 1376 | 1397 | |
| 1377 | variant& operator=(const variant&) = default; | |
| 1378 | variant& operator=(variant&&) = default; | |
| 1398 | constexpr variant& operator=(const variant&) = default; | |
| 1399 | constexpr variant& operator=(variant&&) = default; | |
| 1379 | 1400 | |
| 1380 | 1401 | template < |
| 1381 | 1402 | class _Arg, |
| 1382 | enable_if_t<!is_same_v<__uncvref_t<_Arg>, variant>, int> = 0, | |
| 1403 | enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0, | |
| 1383 | 1404 | class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>, |
| 1384 | 1405 | size_t _Ip = |
| 1385 | 1406 | __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, |
| 1386 | 1407 | enable_if_t<is_assignable_v<_Tp&, _Arg> && is_constructible_v<_Tp, _Arg>, |
| 1387 | 1408 | int> = 0> |
| 1388 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1409 | _LIBCPP_HIDE_FROM_ABI | |
| 1389 | 1410 | variant& operator=(_Arg&& __arg) noexcept( |
| 1390 | 1411 | is_nothrow_assignable_v<_Tp&, _Arg> && |
| 1391 | 1412 | is_nothrow_constructible_v<_Tp, _Arg>) { |
| 1392 | __impl.template __assign<_Ip>(_VSTD::forward<_Arg>(__arg)); | |
| 1413 | __impl_.template __assign<_Ip>(_VSTD::forward<_Arg>(__arg)); | |
| 1393 | 1414 | return *this; |
| 1394 | 1415 | } |
| 1395 | 1416 | |
| ... | ... | @@ -1399,9 +1420,9 @@ public: |
| 1399 | 1420 | enable_if_t<(_Ip < sizeof...(_Types)), int> = 0, |
| 1400 | 1421 | class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, |
| 1401 | 1422 | enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0> |
| 1402 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1423 | _LIBCPP_HIDE_FROM_ABI | |
| 1403 | 1424 | _Tp& emplace(_Args&&... __args) { |
| 1404 | return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); | |
| 1425 | return __impl_.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); | |
| 1405 | 1426 | } |
| 1406 | 1427 | |
| 1407 | 1428 | template < |
| ... | ... | @@ -1412,9 +1433,9 @@ public: |
| 1412 | 1433 | class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, |
| 1413 | 1434 | enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, |
| 1414 | 1435 | int> = 0> |
| 1415 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1436 | _LIBCPP_HIDE_FROM_ABI | |
| 1416 | 1437 | _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { |
| 1417 | return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); | |
| 1438 | return __impl_.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); | |
| 1418 | 1439 | } |
| 1419 | 1440 | |
| 1420 | 1441 | template < |
| ... | ... | @@ -1423,9 +1444,9 @@ public: |
| 1423 | 1444 | size_t _Ip = |
| 1424 | 1445 | __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, |
| 1425 | 1446 | enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0> |
| 1426 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1447 | _LIBCPP_HIDE_FROM_ABI | |
| 1427 | 1448 | _Tp& emplace(_Args&&... __args) { |
| 1428 | return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); | |
| 1449 | return __impl_.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); | |
| 1429 | 1450 | } |
| 1430 | 1451 | |
| 1431 | 1452 | template < |
| ... | ... | @@ -1436,18 +1457,18 @@ public: |
| 1436 | 1457 | __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, |
| 1437 | 1458 | enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, |
| 1438 | 1459 | int> = 0> |
| 1439 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1460 | _LIBCPP_HIDE_FROM_ABI | |
| 1440 | 1461 | _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { |
| 1441 | return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); | |
| 1462 | return __impl_.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); | |
| 1442 | 1463 | } |
| 1443 | 1464 | |
| 1444 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1465 | _LIBCPP_HIDE_FROM_ABI | |
| 1445 | 1466 | constexpr bool valueless_by_exception() const noexcept { |
| 1446 | return __impl.valueless_by_exception(); | |
| 1467 | return __impl_.valueless_by_exception(); | |
| 1447 | 1468 | } |
| 1448 | 1469 | |
| 1449 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1450 | constexpr size_t index() const noexcept { return __impl.index(); } | |
| 1470 | _LIBCPP_HIDE_FROM_ABI | |
| 1471 | constexpr size_t index() const noexcept { return __impl_.index(); } | |
| 1451 | 1472 | |
| 1452 | 1473 | template < |
| 1453 | 1474 | bool _Dummy = true, |
| ... | ... | @@ -1456,85 +1477,85 @@ public: |
| 1456 | 1477 | __dependent_type<is_move_constructible<_Types>, _Dummy>::value && |
| 1457 | 1478 | __dependent_type<is_swappable<_Types>, _Dummy>::value)...>::value, |
| 1458 | 1479 | int> = 0> |
| 1459 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1480 | _LIBCPP_HIDE_FROM_ABI | |
| 1460 | 1481 | void swap(variant& __that) noexcept( |
| 1461 | 1482 | __all<(is_nothrow_move_constructible_v<_Types> && |
| 1462 | 1483 | is_nothrow_swappable_v<_Types>)...>::value) { |
| 1463 | __impl.__swap(__that.__impl); | |
| 1484 | __impl_.__swap(__that.__impl_); | |
| 1464 | 1485 | } |
| 1465 | 1486 | |
| 1466 | 1487 | private: |
| 1467 | __variant_detail::__impl<_Types...> __impl; | |
| 1488 | __variant_detail::__impl<_Types...> __impl_; | |
| 1468 | 1489 | |
| 1469 | 1490 | friend struct __variant_detail::__access::__variant; |
| 1470 | 1491 | friend struct __variant_detail::__visitation::__variant; |
| 1471 | 1492 | }; |
| 1472 | 1493 | |
| 1473 | 1494 | template <size_t _Ip, class... _Types> |
| 1474 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1495 | _LIBCPP_HIDE_FROM_ABI | |
| 1475 | 1496 | constexpr bool __holds_alternative(const variant<_Types...>& __v) noexcept { |
| 1476 | 1497 | return __v.index() == _Ip; |
| 1477 | 1498 | } |
| 1478 | 1499 | |
| 1479 | 1500 | template <class _Tp, class... _Types> |
| 1480 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1501 | _LIBCPP_HIDE_FROM_ABI | |
| 1481 | 1502 | constexpr bool holds_alternative(const variant<_Types...>& __v) noexcept { |
| 1482 | return __holds_alternative<__find_exactly_one_t<_Tp, _Types...>::value>(__v); | |
| 1503 | return std::__holds_alternative<__find_exactly_one_t<_Tp, _Types...>::value>(__v); | |
| 1483 | 1504 | } |
| 1484 | 1505 | |
| 1485 | 1506 | template <size_t _Ip, class _Vp> |
| 1486 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1507 | _LIBCPP_HIDE_FROM_ABI | |
| 1487 | 1508 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS |
| 1488 | 1509 | constexpr auto&& __generic_get(_Vp&& __v) { |
| 1489 | 1510 | using __variant_detail::__access::__variant; |
| 1490 | if (!__holds_alternative<_Ip>(__v)) { | |
| 1511 | if (!std::__holds_alternative<_Ip>(__v)) { | |
| 1491 | 1512 | __throw_bad_variant_access(); |
| 1492 | 1513 | } |
| 1493 | 1514 | return __variant::__get_alt<_Ip>(_VSTD::forward<_Vp>(__v)).__value; |
| 1494 | 1515 | } |
| 1495 | 1516 | |
| 1496 | 1517 | template <size_t _Ip, class... _Types> |
| 1497 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1518 | _LIBCPP_HIDE_FROM_ABI | |
| 1498 | 1519 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS |
| 1499 | 1520 | constexpr variant_alternative_t<_Ip, variant<_Types...>>& get( |
| 1500 | 1521 | variant<_Types...>& __v) { |
| 1501 | 1522 | static_assert(_Ip < sizeof...(_Types)); |
| 1502 | 1523 | static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>); |
| 1503 | return __generic_get<_Ip>(__v); | |
| 1524 | return std::__generic_get<_Ip>(__v); | |
| 1504 | 1525 | } |
| 1505 | 1526 | |
| 1506 | 1527 | template <size_t _Ip, class... _Types> |
| 1507 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1528 | _LIBCPP_HIDE_FROM_ABI | |
| 1508 | 1529 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS |
| 1509 | 1530 | constexpr variant_alternative_t<_Ip, variant<_Types...>>&& get( |
| 1510 | 1531 | variant<_Types...>&& __v) { |
| 1511 | 1532 | static_assert(_Ip < sizeof...(_Types)); |
| 1512 | 1533 | static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>); |
| 1513 | return __generic_get<_Ip>(_VSTD::move(__v)); | |
| 1534 | return std::__generic_get<_Ip>(_VSTD::move(__v)); | |
| 1514 | 1535 | } |
| 1515 | 1536 | |
| 1516 | 1537 | template <size_t _Ip, class... _Types> |
| 1517 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1538 | _LIBCPP_HIDE_FROM_ABI | |
| 1518 | 1539 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS |
| 1519 | 1540 | constexpr const variant_alternative_t<_Ip, variant<_Types...>>& get( |
| 1520 | 1541 | const variant<_Types...>& __v) { |
| 1521 | 1542 | static_assert(_Ip < sizeof...(_Types)); |
| 1522 | 1543 | static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>); |
| 1523 | return __generic_get<_Ip>(__v); | |
| 1544 | return std::__generic_get<_Ip>(__v); | |
| 1524 | 1545 | } |
| 1525 | 1546 | |
| 1526 | 1547 | template <size_t _Ip, class... _Types> |
| 1527 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1548 | _LIBCPP_HIDE_FROM_ABI | |
| 1528 | 1549 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS |
| 1529 | 1550 | constexpr const variant_alternative_t<_Ip, variant<_Types...>>&& get( |
| 1530 | 1551 | const variant<_Types...>&& __v) { |
| 1531 | 1552 | static_assert(_Ip < sizeof...(_Types)); |
| 1532 | 1553 | static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>); |
| 1533 | return __generic_get<_Ip>(_VSTD::move(__v)); | |
| 1554 | return std::__generic_get<_Ip>(_VSTD::move(__v)); | |
| 1534 | 1555 | } |
| 1535 | 1556 | |
| 1536 | 1557 | template <class _Tp, class... _Types> |
| 1537 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1558 | _LIBCPP_HIDE_FROM_ABI | |
| 1538 | 1559 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS |
| 1539 | 1560 | constexpr _Tp& get(variant<_Types...>& __v) { |
| 1540 | 1561 | static_assert(!is_void_v<_Tp>); |
| ... | ... | @@ -1542,7 +1563,7 @@ constexpr _Tp& get(variant<_Types...>& __v) { |
| 1542 | 1563 | } |
| 1543 | 1564 | |
| 1544 | 1565 | template <class _Tp, class... _Types> |
| 1545 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1566 | _LIBCPP_HIDE_FROM_ABI | |
| 1546 | 1567 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS |
| 1547 | 1568 | constexpr _Tp&& get(variant<_Types...>&& __v) { |
| 1548 | 1569 | static_assert(!is_void_v<_Tp>); |
| ... | ... | @@ -1551,7 +1572,7 @@ constexpr _Tp&& get(variant<_Types...>&& __v) { |
| 1551 | 1572 | } |
| 1552 | 1573 | |
| 1553 | 1574 | template <class _Tp, class... _Types> |
| 1554 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1575 | _LIBCPP_HIDE_FROM_ABI | |
| 1555 | 1576 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS |
| 1556 | 1577 | constexpr const _Tp& get(const variant<_Types...>& __v) { |
| 1557 | 1578 | static_assert(!is_void_v<_Tp>); |
| ... | ... | @@ -1559,7 +1580,7 @@ constexpr const _Tp& get(const variant<_Types...>& __v) { |
| 1559 | 1580 | } |
| 1560 | 1581 | |
| 1561 | 1582 | template <class _Tp, class... _Types> |
| 1562 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1583 | _LIBCPP_HIDE_FROM_ABI | |
| 1563 | 1584 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS |
| 1564 | 1585 | constexpr const _Tp&& get(const variant<_Types...>&& __v) { |
| 1565 | 1586 | static_assert(!is_void_v<_Tp>); |
| ... | ... | @@ -1568,34 +1589,34 @@ constexpr const _Tp&& get(const variant<_Types...>&& __v) { |
| 1568 | 1589 | } |
| 1569 | 1590 | |
| 1570 | 1591 | template <size_t _Ip, class _Vp> |
| 1571 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1592 | _LIBCPP_HIDE_FROM_ABI | |
| 1572 | 1593 | constexpr auto* __generic_get_if(_Vp* __v) noexcept { |
| 1573 | 1594 | using __variant_detail::__access::__variant; |
| 1574 | return __v && __holds_alternative<_Ip>(*__v) | |
| 1595 | return __v && std::__holds_alternative<_Ip>(*__v) | |
| 1575 | 1596 | ? _VSTD::addressof(__variant::__get_alt<_Ip>(*__v).__value) |
| 1576 | 1597 | : nullptr; |
| 1577 | 1598 | } |
| 1578 | 1599 | |
| 1579 | 1600 | template <size_t _Ip, class... _Types> |
| 1580 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1601 | _LIBCPP_HIDE_FROM_ABI | |
| 1581 | 1602 | constexpr add_pointer_t<variant_alternative_t<_Ip, variant<_Types...>>> |
| 1582 | 1603 | get_if(variant<_Types...>* __v) noexcept { |
| 1583 | 1604 | static_assert(_Ip < sizeof...(_Types)); |
| 1584 | 1605 | static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>); |
| 1585 | return __generic_get_if<_Ip>(__v); | |
| 1606 | return std::__generic_get_if<_Ip>(__v); | |
| 1586 | 1607 | } |
| 1587 | 1608 | |
| 1588 | 1609 | template <size_t _Ip, class... _Types> |
| 1589 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1610 | _LIBCPP_HIDE_FROM_ABI | |
| 1590 | 1611 | constexpr add_pointer_t<const variant_alternative_t<_Ip, variant<_Types...>>> |
| 1591 | 1612 | get_if(const variant<_Types...>* __v) noexcept { |
| 1592 | 1613 | static_assert(_Ip < sizeof...(_Types)); |
| 1593 | 1614 | static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>); |
| 1594 | return __generic_get_if<_Ip>(__v); | |
| 1615 | return std::__generic_get_if<_Ip>(__v); | |
| 1595 | 1616 | } |
| 1596 | 1617 | |
| 1597 | 1618 | template <class _Tp, class... _Types> |
| 1598 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1619 | _LIBCPP_HIDE_FROM_ABI | |
| 1599 | 1620 | constexpr add_pointer_t<_Tp> |
| 1600 | 1621 | get_if(variant<_Types...>* __v) noexcept { |
| 1601 | 1622 | static_assert(!is_void_v<_Tp>); |
| ... | ... | @@ -1603,7 +1624,7 @@ get_if(variant<_Types...>* __v) noexcept { |
| 1603 | 1624 | } |
| 1604 | 1625 | |
| 1605 | 1626 | template <class _Tp, class... _Types> |
| 1606 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1627 | _LIBCPP_HIDE_FROM_ABI | |
| 1607 | 1628 | constexpr add_pointer_t<const _Tp> |
| 1608 | 1629 | get_if(const variant<_Types...>* __v) noexcept { |
| 1609 | 1630 | static_assert(!is_void_v<_Tp>); |
| ... | ... | @@ -1613,7 +1634,8 @@ get_if(const variant<_Types...>* __v) noexcept { |
| 1613 | 1634 | template <class _Operator> |
| 1614 | 1635 | struct __convert_to_bool { |
| 1615 | 1636 | template <class _T1, class _T2> |
| 1616 | _LIBCPP_INLINE_VISIBILITY constexpr bool operator()(_T1 && __t1, _T2&& __t2) const { | |
| 1637 | _LIBCPP_HIDE_FROM_ABI | |
| 1638 | constexpr bool operator()(_T1 && __t1, _T2&& __t2) const { | |
| 1617 | 1639 | static_assert(is_convertible<decltype(_Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2))), bool>::value, |
| 1618 | 1640 | "the relational operator does not return a type which is implicitly convertible to bool"); |
| 1619 | 1641 | return _Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2)); |
| ... | ... | @@ -1621,7 +1643,7 @@ struct __convert_to_bool { |
| 1621 | 1643 | }; |
| 1622 | 1644 | |
| 1623 | 1645 | template <class... _Types> |
| 1624 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1646 | _LIBCPP_HIDE_FROM_ABI | |
| 1625 | 1647 | constexpr bool operator==(const variant<_Types...>& __lhs, |
| 1626 | 1648 | const variant<_Types...>& __rhs) { |
| 1627 | 1649 | using __variant_detail::__visitation::__variant; |
| ... | ... | @@ -1630,8 +1652,29 @@ constexpr bool operator==(const variant<_Types...>& __lhs, |
| 1630 | 1652 | return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<equal_to<>>{}, __lhs, __rhs); |
| 1631 | 1653 | } |
| 1632 | 1654 | |
| 1655 | # if _LIBCPP_STD_VER > 17 | |
| 1656 | ||
| 1657 | template <class... _Types> requires (three_way_comparable<_Types> && ...) | |
| 1658 | _LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t<compare_three_way_result_t<_Types>...> | |
| 1659 | operator<=>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) { | |
| 1660 | using __variant_detail::__visitation::__variant; | |
| 1661 | using __result_t = common_comparison_category_t<compare_three_way_result_t<_Types>...>; | |
| 1662 | if (__lhs.valueless_by_exception() && __rhs.valueless_by_exception()) | |
| 1663 | return strong_ordering::equal; | |
| 1664 | if (__lhs.valueless_by_exception()) | |
| 1665 | return strong_ordering::less; | |
| 1666 | if (__rhs.valueless_by_exception()) | |
| 1667 | return strong_ordering::greater; | |
| 1668 | if (auto __c = __lhs.index() <=> __rhs.index(); __c != 0) | |
| 1669 | return __c; | |
| 1670 | auto __three_way = []<class _Type>(const _Type& __v, const _Type& __w) -> __result_t { return __v <=> __w; }; | |
| 1671 | return __variant::__visit_value_at(__lhs.index(), __three_way, __lhs, __rhs); | |
| 1672 | } | |
| 1673 | ||
| 1674 | # endif // _LIBCPP_STD_VER > 17 | |
| 1675 | ||
| 1633 | 1676 | template <class... _Types> |
| 1634 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1677 | _LIBCPP_HIDE_FROM_ABI | |
| 1635 | 1678 | constexpr bool operator!=(const variant<_Types...>& __lhs, |
| 1636 | 1679 | const variant<_Types...>& __rhs) { |
| 1637 | 1680 | using __variant_detail::__visitation::__variant; |
| ... | ... | @@ -1642,7 +1685,7 @@ constexpr bool operator!=(const variant<_Types...>& __lhs, |
| 1642 | 1685 | } |
| 1643 | 1686 | |
| 1644 | 1687 | template <class... _Types> |
| 1645 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1688 | _LIBCPP_HIDE_FROM_ABI | |
| 1646 | 1689 | constexpr bool operator<(const variant<_Types...>& __lhs, |
| 1647 | 1690 | const variant<_Types...>& __rhs) { |
| 1648 | 1691 | using __variant_detail::__visitation::__variant; |
| ... | ... | @@ -1654,7 +1697,7 @@ constexpr bool operator<(const variant<_Types...>& __lhs, |
| 1654 | 1697 | } |
| 1655 | 1698 | |
| 1656 | 1699 | template <class... _Types> |
| 1657 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1700 | _LIBCPP_HIDE_FROM_ABI | |
| 1658 | 1701 | constexpr bool operator>(const variant<_Types...>& __lhs, |
| 1659 | 1702 | const variant<_Types...>& __rhs) { |
| 1660 | 1703 | using __variant_detail::__visitation::__variant; |
| ... | ... | @@ -1666,7 +1709,7 @@ constexpr bool operator>(const variant<_Types...>& __lhs, |
| 1666 | 1709 | } |
| 1667 | 1710 | |
| 1668 | 1711 | template <class... _Types> |
| 1669 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1712 | _LIBCPP_HIDE_FROM_ABI | |
| 1670 | 1713 | constexpr bool operator<=(const variant<_Types...>& __lhs, |
| 1671 | 1714 | const variant<_Types...>& __rhs) { |
| 1672 | 1715 | using __variant_detail::__visitation::__variant; |
| ... | ... | @@ -1679,7 +1722,7 @@ constexpr bool operator<=(const variant<_Types...>& __lhs, |
| 1679 | 1722 | } |
| 1680 | 1723 | |
| 1681 | 1724 | template <class... _Types> |
| 1682 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1725 | _LIBCPP_HIDE_FROM_ABI | |
| 1683 | 1726 | constexpr bool operator>=(const variant<_Types...>& __lhs, |
| 1684 | 1727 | const variant<_Types...>& __rhs) { |
| 1685 | 1728 | using __variant_detail::__visitation::__variant; |
| ... | ... | @@ -1692,9 +1735,9 @@ constexpr bool operator>=(const variant<_Types...>& __lhs, |
| 1692 | 1735 | } |
| 1693 | 1736 | |
| 1694 | 1737 | template <class... _Vs> |
| 1695 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1696 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr void | |
| 1697 | __throw_if_valueless(_Vs&&... __vs) { | |
| 1738 | _LIBCPP_HIDE_FROM_ABI | |
| 1739 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS | |
| 1740 | constexpr void __throw_if_valueless(_Vs&&... __vs) { | |
| 1698 | 1741 | const bool __valueless = |
| 1699 | 1742 | (... || _VSTD::__as_variant(__vs).valueless_by_exception()); |
| 1700 | 1743 | if (__valueless) { |
| ... | ... | @@ -1704,10 +1747,10 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1704 | 1747 | |
| 1705 | 1748 | template < |
| 1706 | 1749 | class _Visitor, class... _Vs, |
| 1707 | typename = void_t<decltype(_VSTD::__as_variant(declval<_Vs>()))...> > | |
| 1708 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1709 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr | |
| 1710 | decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) { | |
| 1750 | typename = void_t<decltype(_VSTD::__as_variant(std::declval<_Vs>()))...> > | |
| 1751 | _LIBCPP_HIDE_FROM_ABI | |
| 1752 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS | |
| 1753 | constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) { | |
| 1711 | 1754 | using __variant_detail::__visitation::__variant; |
| 1712 | 1755 | _VSTD::__throw_if_valueless(_VSTD::forward<_Vs>(__vs)...); |
| 1713 | 1756 | return __variant::__visit_value(_VSTD::forward<_Visitor>(__visitor), |
| ... | ... | @@ -1717,10 +1760,10 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1717 | 1760 | #if _LIBCPP_STD_VER > 17 |
| 1718 | 1761 | template < |
| 1719 | 1762 | class _Rp, class _Visitor, class... _Vs, |
| 1720 | typename = void_t<decltype(_VSTD::__as_variant(declval<_Vs>()))...> > | |
| 1721 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1722 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Rp | |
| 1723 | visit(_Visitor&& __visitor, _Vs&&... __vs) { | |
| 1763 | typename = void_t<decltype(_VSTD::__as_variant(std::declval<_Vs>()))...> > | |
| 1764 | _LIBCPP_HIDE_FROM_ABI | |
| 1765 | _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS | |
| 1766 | constexpr _Rp visit(_Visitor&& __visitor, _Vs&&... __vs) { | |
| 1724 | 1767 | using __variant_detail::__visitation::__variant; |
| 1725 | 1768 | _VSTD::__throw_if_valueless(_VSTD::forward<_Vs>(__vs)...); |
| 1726 | 1769 | return __variant::__visit_value<_Rp>(_VSTD::forward<_Visitor>(__visitor), |
| ... | ... | @@ -1729,7 +1772,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1729 | 1772 | #endif |
| 1730 | 1773 | |
| 1731 | 1774 | template <class... _Types> |
| 1732 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1775 | _LIBCPP_HIDE_FROM_ABI | |
| 1733 | 1776 | auto swap(variant<_Types...>& __lhs, variant<_Types...>& __rhs) |
| 1734 | 1777 | noexcept(noexcept(__lhs.swap(__rhs))) |
| 1735 | 1778 | -> decltype( __lhs.swap(__rhs)) |
| ... | ... | @@ -1741,7 +1784,7 @@ struct _LIBCPP_TEMPLATE_VIS hash< |
| 1741 | 1784 | using argument_type = variant<_Types...>; |
| 1742 | 1785 | using result_type = size_t; |
| 1743 | 1786 | |
| 1744 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1787 | _LIBCPP_HIDE_FROM_ABI | |
| 1745 | 1788 | result_type operator()(const argument_type& __v) const { |
| 1746 | 1789 | using __variant_detail::__visitation::__variant; |
| 1747 | 1790 | size_t __res = |
| ... | ... | @@ -1749,13 +1792,13 @@ struct _LIBCPP_TEMPLATE_VIS hash< |
| 1749 | 1792 | ? 299792458 // Random value chosen by the universe upon creation |
| 1750 | 1793 | : __variant::__visit_alt( |
| 1751 | 1794 | [](const auto& __alt) { |
| 1752 | using __alt_type = __uncvref_t<decltype(__alt)>; | |
| 1795 | using __alt_type = __remove_cvref_t<decltype(__alt)>; | |
| 1753 | 1796 | using __value_type = remove_const_t< |
| 1754 | 1797 | typename __alt_type::__value_type>; |
| 1755 | 1798 | return hash<__value_type>{}(__alt.__value); |
| 1756 | 1799 | }, |
| 1757 | 1800 | __v); |
| 1758 | return __hash_combine(__res, hash<size_t>{}(__v.index())); | |
| 1801 | return std::__hash_combine(__res, hash<size_t>{}(__v.index())); | |
| 1759 | 1802 | } |
| 1760 | 1803 | }; |
| 1761 | 1804 | |
| ... | ... | @@ -1763,22 +1806,22 @@ struct _LIBCPP_TEMPLATE_VIS hash< |
| 1763 | 1806 | // type whereas std::get will throw or returning nullptr. This makes it faster than |
| 1764 | 1807 | // std::get. |
| 1765 | 1808 | template <size_t _Ip, class _Vp> |
| 1766 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1809 | _LIBCPP_HIDE_FROM_ABI | |
| 1767 | 1810 | constexpr auto&& __unchecked_get(_Vp&& __v) noexcept { |
| 1768 | 1811 | using __variant_detail::__access::__variant; |
| 1769 | 1812 | return __variant::__get_alt<_Ip>(_VSTD::forward<_Vp>(__v)).__value; |
| 1770 | 1813 | } |
| 1771 | 1814 | |
| 1772 | 1815 | template <class _Tp, class... _Types> |
| 1773 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1816 | _LIBCPP_HIDE_FROM_ABI | |
| 1774 | 1817 | constexpr auto&& __unchecked_get(const variant<_Types...>& __v) noexcept { |
| 1775 | return __unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); | |
| 1818 | return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); | |
| 1776 | 1819 | } |
| 1777 | 1820 | |
| 1778 | 1821 | template <class _Tp, class... _Types> |
| 1779 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1822 | _LIBCPP_HIDE_FROM_ABI | |
| 1780 | 1823 | constexpr auto&& __unchecked_get(variant<_Types...>& __v) noexcept { |
| 1781 | return __unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); | |
| 1824 | return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); | |
| 1782 | 1825 | } |
| 1783 | 1826 | |
| 1784 | 1827 | #endif // _LIBCPP_STD_VER > 14 |
| ... | ... | @@ -1787,4 +1830,10 @@ _LIBCPP_END_NAMESPACE_STD |
| 1787 | 1830 | |
| 1788 | 1831 | _LIBCPP_POP_MACROS |
| 1789 | 1832 | |
| 1833 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 1834 | # include <type_traits> | |
| 1835 | # include <typeinfo> | |
| 1836 | # include <utility> | |
| 1837 | #endif | |
| 1838 | ||
| 1790 | 1839 | #endif // _LIBCPP_VARIANT |
lib/libcxx/include/vector+691-648| ... | ... | @@ -267,6 +267,13 @@ template <class T, class Allocator, class Predicate> |
| 267 | 267 | typename vector<T, Allocator>::size_type |
| 268 | 268 | erase_if(vector<T, Allocator>& c, Predicate pred); // C++20 |
| 269 | 269 | |
| 270 | ||
| 271 | template<class T> | |
| 272 | inline constexpr bool is-vector-bool-reference = see below; // exposition only, since C++23 | |
| 273 | ||
| 274 | template<class T, class charT> requires is-vector-bool-reference<T> // Since C++23 | |
| 275 | struct formatter<T, charT>; | |
| 276 | ||
| 270 | 277 | } // std |
| 271 | 278 | |
| 272 | 279 | */ |
| ... | ... | @@ -281,9 +288,11 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20 |
| 281 | 288 | #include <__algorithm/unwrap_iter.h> |
| 282 | 289 | #include <__assert> // all public C++ headers provide the assertion handler |
| 283 | 290 | #include <__bit_reference> |
| 291 | #include <__concepts/same_as.h> | |
| 284 | 292 | #include <__config> |
| 285 | 293 | #include <__debug> |
| 286 | 294 | #include <__format/enable_insertable.h> |
| 295 | #include <__format/formatter.h> | |
| 287 | 296 | #include <__functional/hash.h> |
| 288 | 297 | #include <__functional/unary_function.h> |
| 289 | 298 | #include <__iterator/advance.h> |
| ... | ... | @@ -293,7 +302,13 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20 |
| 293 | 302 | #include <__memory/allocate_at_least.h> |
| 294 | 303 | #include <__memory/pointer_traits.h> |
| 295 | 304 | #include <__memory/swap_allocator.h> |
| 305 | #include <__memory/temp_value.h> | |
| 306 | #include <__memory/uninitialized_algorithms.h> | |
| 307 | #include <__memory_resource/polymorphic_allocator.h> | |
| 296 | 308 | #include <__split_buffer> |
| 309 | #include <__type_traits/is_allocator.h> | |
| 310 | #include <__type_traits/noexcept_move_assign_container.h> | |
| 311 | #include <__utility/exception_guard.h> | |
| 297 | 312 | #include <__utility/forward.h> |
| 298 | 313 | #include <__utility/move.h> |
| 299 | 314 | #include <__utility/swap.h> |
| ... | ... | @@ -302,17 +317,10 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20 |
| 302 | 317 | #include <cstring> |
| 303 | 318 | #include <iosfwd> // for forward declaration of vector |
| 304 | 319 | #include <limits> |
| 305 | #include <memory> | |
| 306 | 320 | #include <stdexcept> |
| 307 | 321 | #include <type_traits> |
| 308 | 322 | #include <version> |
| 309 | 323 | |
| 310 | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES | |
| 311 | # include <algorithm> | |
| 312 | # include <typeinfo> | |
| 313 | # include <utility> | |
| 314 | #endif | |
| 315 | ||
| 316 | 324 | // standard-mandated includes |
| 317 | 325 | |
| 318 | 326 | // [iterator.range] |
| ... | ... | @@ -352,20 +360,25 @@ public: |
| 352 | 360 | typedef typename __alloc_traits::difference_type difference_type; |
| 353 | 361 | typedef typename __alloc_traits::pointer pointer; |
| 354 | 362 | typedef typename __alloc_traits::const_pointer const_pointer; |
| 363 | // TODO: Implement iterator bounds checking without requiring the global database. | |
| 355 | 364 | typedef __wrap_iter<pointer> iterator; |
| 356 | 365 | typedef __wrap_iter<const_pointer> const_iterator; |
| 357 | typedef _VSTD::reverse_iterator<iterator> reverse_iterator; | |
| 358 | typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; | |
| 366 | typedef std::reverse_iterator<iterator> reverse_iterator; | |
| 367 | typedef std::reverse_iterator<const_iterator> const_reverse_iterator; | |
| 359 | 368 | |
| 360 | 369 | static_assert((is_same<typename allocator_type::value_type, value_type>::value), |
| 361 | 370 | "Allocator::value_type must be same type as value_type"); |
| 362 | 371 | |
| 363 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 372 | static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, | |
| 373 | "[allocator.requirements] states that rebinding an allocator to the same type should result in the " | |
| 374 | "original allocator"); | |
| 375 | ||
| 376 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 364 | 377 | vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| 365 | 378 | { |
| 366 | _VSTD::__debug_db_insert_c(this); | |
| 379 | std::__debug_db_insert_c(this); | |
| 367 | 380 | } |
| 368 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a) | |
| 381 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(const allocator_type& __a) | |
| 369 | 382 | #if _LIBCPP_STD_VER <= 14 |
| 370 | 383 | _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value) |
| 371 | 384 | #else |
| ... | ... | @@ -373,20 +386,20 @@ public: |
| 373 | 386 | #endif |
| 374 | 387 | : __end_cap_(nullptr, __a) |
| 375 | 388 | { |
| 376 | _VSTD::__debug_db_insert_c(this); | |
| 389 | std::__debug_db_insert_c(this); | |
| 377 | 390 | } |
| 378 | _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit vector(size_type __n); | |
| 391 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n); | |
| 379 | 392 | #if _LIBCPP_STD_VER > 11 |
| 380 | _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit vector(size_type __n, const allocator_type& __a); | |
| 393 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a); | |
| 381 | 394 | #endif |
| 382 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(size_type __n, const value_type& __x); | |
| 395 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x); | |
| 383 | 396 | |
| 384 | 397 | template <class = __enable_if_t<__is_allocator<_Allocator>::value> > |
| 385 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 398 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 386 | 399 | vector(size_type __n, const value_type& __x, const allocator_type& __a) |
| 387 | 400 | : __end_cap_(nullptr, __a) |
| 388 | 401 | { |
| 389 | _VSTD::__debug_db_insert_c(this); | |
| 402 | std::__debug_db_insert_c(this); | |
| 390 | 403 | if (__n > 0) |
| 391 | 404 | { |
| 392 | 405 | __vallocate(__n); |
| ... | ... | @@ -394,68 +407,72 @@ public: |
| 394 | 407 | } |
| 395 | 408 | } |
| 396 | 409 | |
| 397 | template <class _InputIterator> | |
| 398 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 399 | vector(_InputIterator __first, | |
| 400 | typename enable_if<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 401 | is_constructible< | |
| 402 | value_type, | |
| 403 | typename iterator_traits<_InputIterator>::reference>::value, | |
| 404 | _InputIterator>::type __last); | |
| 405 | template <class _InputIterator> | |
| 406 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 407 | vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, | |
| 408 | typename enable_if<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 409 | is_constructible< | |
| 410 | value_type, | |
| 411 | typename iterator_traits<_InputIterator>::reference>::value>::type* = 0); | |
| 412 | template <class _ForwardIterator> | |
| 413 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 414 | vector(_ForwardIterator __first, | |
| 415 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 416 | is_constructible< | |
| 417 | value_type, | |
| 418 | typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 419 | _ForwardIterator>::type __last); | |
| 420 | template <class _ForwardIterator> | |
| 421 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 422 | vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, | |
| 423 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 424 | is_constructible< | |
| 425 | value_type, | |
| 426 | typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0); | |
| 410 | template <class _InputIterator, | |
| 411 | __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 412 | is_constructible<value_type, typename iterator_traits<_InputIterator>::reference>::value, | |
| 413 | int> = 0> | |
| 414 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(_InputIterator __first, _InputIterator __last); | |
| 415 | template <class _InputIterator, | |
| 416 | __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 417 | is_constructible<value_type, typename iterator_traits<_InputIterator>::reference>::value, | |
| 418 | int> = 0> | |
| 419 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 420 | vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a); | |
| 421 | ||
| 422 | template < | |
| 423 | class _ForwardIterator, | |
| 424 | __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 425 | is_constructible<value_type, typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 426 | int> = 0> | |
| 427 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(_ForwardIterator __first, _ForwardIterator __last); | |
| 428 | ||
| 429 | template <class _ForwardIterator, | |
| 430 | __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 431 | is_constructible<value_type, typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 432 | int> = 0> | |
| 433 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 434 | vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a); | |
| 427 | 435 | |
| 428 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 429 | ~vector() | |
| 430 | { | |
| 431 | __annotate_delete(); | |
| 432 | std::__debug_db_erase_c(this); | |
| 436 | private: | |
| 437 | class __destroy_vector { | |
| 438 | public: | |
| 439 | _LIBCPP_CONSTEXPR __destroy_vector(vector& __vec) : __vec_(__vec) {} | |
| 433 | 440 | |
| 434 | if (this->__begin_ != nullptr) | |
| 435 | { | |
| 436 | __clear(); | |
| 437 | __alloc_traits::deallocate(__alloc(), this->__begin_, capacity()); | |
| 441 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() { | |
| 442 | __vec_.__annotate_delete(); | |
| 443 | std::__debug_db_erase_c(std::addressof(__vec_)); | |
| 444 | ||
| 445 | if (__vec_.__begin_ != nullptr) { | |
| 446 | __vec_.__clear(); | |
| 447 | __alloc_traits::deallocate(__vec_.__alloc(), __vec_.__begin_, __vec_.capacity()); | |
| 448 | } | |
| 438 | 449 | } |
| 439 | } | |
| 440 | 450 | |
| 441 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(const vector& __x); | |
| 442 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(const vector& __x, const __type_identity_t<allocator_type>& __a); | |
| 443 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 451 | private: | |
| 452 | vector& __vec_; | |
| 453 | }; | |
| 454 | ||
| 455 | public: | |
| 456 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~vector() { __destroy_vector(*this)(); } | |
| 457 | ||
| 458 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(const vector& __x); | |
| 459 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(const vector& __x, const __type_identity_t<allocator_type>& __a); | |
| 460 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 444 | 461 | vector& operator=(const vector& __x); |
| 445 | 462 | |
| 446 | 463 | #ifndef _LIBCPP_CXX03_LANG |
| 447 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 464 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 448 | 465 | vector(initializer_list<value_type> __il); |
| 449 | 466 | |
| 450 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 467 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 451 | 468 | vector(initializer_list<value_type> __il, const allocator_type& __a); |
| 452 | 469 | |
| 453 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 470 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 454 | 471 | vector& operator=(initializer_list<value_type> __il) |
| 455 | 472 | {assign(__il.begin(), __il.end()); return *this;} |
| 456 | 473 | #endif // !_LIBCPP_CXX03_LANG |
| 457 | 474 | |
| 458 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 475 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 459 | 476 | vector(vector&& __x) |
| 460 | 477 | #if _LIBCPP_STD_VER > 14 |
| 461 | 478 | noexcept; |
| ... | ... | @@ -463,174 +480,163 @@ public: |
| 463 | 480 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); |
| 464 | 481 | #endif |
| 465 | 482 | |
| 466 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 483 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 467 | 484 | vector(vector&& __x, const __type_identity_t<allocator_type>& __a); |
| 468 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 485 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 469 | 486 | vector& operator=(vector&& __x) |
| 470 | 487 | _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); |
| 471 | 488 | |
| 472 | template <class _InputIterator> | |
| 473 | _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if <__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 474 | is_constructible< | |
| 475 | value_type, | |
| 476 | typename iterator_traits<_InputIterator>::reference>::value, | |
| 477 | void | |
| 478 | >::type | |
| 479 | assign(_InputIterator __first, _InputIterator __last); | |
| 480 | template <class _ForwardIterator> | |
| 481 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 482 | typename enable_if | |
| 483 | < | |
| 484 | __is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 485 | is_constructible< | |
| 486 | value_type, | |
| 487 | typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 488 | void | |
| 489 | >::type | |
| 490 | assign(_ForwardIterator __first, _ForwardIterator __last); | |
| 489 | template <class _InputIterator, | |
| 490 | __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 491 | is_constructible<value_type, typename iterator_traits<_InputIterator>::reference>::value, | |
| 492 | int> = 0> | |
| 493 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(_InputIterator __first, _InputIterator __last); | |
| 494 | template < | |
| 495 | class _ForwardIterator, | |
| 496 | __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 497 | is_constructible<value_type, typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 498 | int> = 0> | |
| 499 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(_ForwardIterator __first, _ForwardIterator __last); | |
| 491 | 500 | |
| 492 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void assign(size_type __n, const_reference __u); | |
| 501 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const_reference __u); | |
| 493 | 502 | |
| 494 | 503 | #ifndef _LIBCPP_CXX03_LANG |
| 495 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 504 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 496 | 505 | void assign(initializer_list<value_type> __il) |
| 497 | 506 | {assign(__il.begin(), __il.end());} |
| 498 | 507 | #endif |
| 499 | 508 | |
| 500 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 509 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 501 | 510 | allocator_type get_allocator() const _NOEXCEPT |
| 502 | 511 | {return this->__alloc();} |
| 503 | 512 | |
| 504 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT; | |
| 505 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT; | |
| 506 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT; | |
| 507 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT; | |
| 513 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT; | |
| 514 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT; | |
| 515 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT; | |
| 516 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT; | |
| 508 | 517 | |
| 509 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 518 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 510 | 519 | reverse_iterator rbegin() _NOEXCEPT |
| 511 | 520 | {return reverse_iterator(end());} |
| 512 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 521 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 513 | 522 | const_reverse_iterator rbegin() const _NOEXCEPT |
| 514 | 523 | {return const_reverse_iterator(end());} |
| 515 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 524 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 516 | 525 | reverse_iterator rend() _NOEXCEPT |
| 517 | 526 | {return reverse_iterator(begin());} |
| 518 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 527 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 519 | 528 | const_reverse_iterator rend() const _NOEXCEPT |
| 520 | 529 | {return const_reverse_iterator(begin());} |
| 521 | 530 | |
| 522 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 531 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 523 | 532 | const_iterator cbegin() const _NOEXCEPT |
| 524 | 533 | {return begin();} |
| 525 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 534 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 526 | 535 | const_iterator cend() const _NOEXCEPT |
| 527 | 536 | {return end();} |
| 528 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 537 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 529 | 538 | const_reverse_iterator crbegin() const _NOEXCEPT |
| 530 | 539 | {return rbegin();} |
| 531 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 540 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 532 | 541 | const_reverse_iterator crend() const _NOEXCEPT |
| 533 | 542 | {return rend();} |
| 534 | 543 | |
| 535 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 544 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 536 | 545 | size_type size() const _NOEXCEPT |
| 537 | 546 | {return static_cast<size_type>(this->__end_ - this->__begin_);} |
| 538 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 547 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 539 | 548 | size_type capacity() const _NOEXCEPT |
| 540 | 549 | {return static_cast<size_type>(__end_cap() - this->__begin_);} |
| 541 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 550 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 542 | 551 | bool empty() const _NOEXCEPT |
| 543 | 552 | {return this->__begin_ == this->__end_;} |
| 544 | _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type max_size() const _NOEXCEPT; | |
| 545 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void reserve(size_type __n); | |
| 546 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void shrink_to_fit() _NOEXCEPT; | |
| 553 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT; | |
| 554 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n); | |
| 555 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT; | |
| 547 | 556 | |
| 548 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) _NOEXCEPT; | |
| 549 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const _NOEXCEPT; | |
| 550 | _LIBCPP_CONSTEXPR_AFTER_CXX17 reference at(size_type __n); | |
| 551 | _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference at(size_type __n) const; | |
| 557 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __n) _NOEXCEPT; | |
| 558 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __n) const _NOEXCEPT; | |
| 559 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at(size_type __n); | |
| 560 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const; | |
| 552 | 561 | |
| 553 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reference front() _NOEXCEPT | |
| 562 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT | |
| 554 | 563 | { |
| 555 | 564 | _LIBCPP_ASSERT(!empty(), "front() called on an empty vector"); |
| 556 | 565 | return *this->__begin_; |
| 557 | 566 | } |
| 558 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT | |
| 567 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT | |
| 559 | 568 | { |
| 560 | 569 | _LIBCPP_ASSERT(!empty(), "front() called on an empty vector"); |
| 561 | 570 | return *this->__begin_; |
| 562 | 571 | } |
| 563 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reference back() _NOEXCEPT | |
| 572 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT | |
| 564 | 573 | { |
| 565 | 574 | _LIBCPP_ASSERT(!empty(), "back() called on an empty vector"); |
| 566 | 575 | return *(this->__end_ - 1); |
| 567 | 576 | } |
| 568 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reference back() const _NOEXCEPT | |
| 577 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT | |
| 569 | 578 | { |
| 570 | 579 | _LIBCPP_ASSERT(!empty(), "back() called on an empty vector"); |
| 571 | 580 | return *(this->__end_ - 1); |
| 572 | 581 | } |
| 573 | 582 | |
| 574 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 583 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 575 | 584 | value_type* data() _NOEXCEPT |
| 576 | {return _VSTD::__to_address(this->__begin_);} | |
| 585 | {return std::__to_address(this->__begin_);} | |
| 577 | 586 | |
| 578 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 587 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 579 | 588 | const value_type* data() const _NOEXCEPT |
| 580 | {return _VSTD::__to_address(this->__begin_);} | |
| 589 | {return std::__to_address(this->__begin_);} | |
| 581 | 590 | |
| 582 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); | |
| 591 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(const_reference __x); | |
| 583 | 592 | |
| 584 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x); | |
| 593 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x); | |
| 585 | 594 | |
| 586 | 595 | template <class... _Args> |
| 587 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 596 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 588 | 597 | #if _LIBCPP_STD_VER > 14 |
| 589 | 598 | reference emplace_back(_Args&&... __args); |
| 590 | 599 | #else |
| 591 | 600 | void emplace_back(_Args&&... __args); |
| 592 | 601 | #endif |
| 593 | 602 | |
| 594 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 603 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 595 | 604 | void pop_back(); |
| 596 | 605 | |
| 597 | _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator insert(const_iterator __position, const_reference __x); | |
| 606 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, const_reference __x); | |
| 598 | 607 | |
| 599 | _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator insert(const_iterator __position, value_type&& __x); | |
| 608 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, value_type&& __x); | |
| 600 | 609 | template <class... _Args> |
| 601 | _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator emplace(const_iterator __position, _Args&&... __args); | |
| 602 | ||
| 603 | _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator insert(const_iterator __position, size_type __n, const_reference __x); | |
| 604 | template <class _InputIterator> | |
| 605 | _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if <__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 606 | is_constructible< | |
| 607 | value_type, | |
| 608 | typename iterator_traits<_InputIterator>::reference>::value, | |
| 609 | iterator | |
| 610 | >::type | |
| 611 | insert(const_iterator __position, _InputIterator __first, _InputIterator __last); | |
| 612 | template <class _ForwardIterator> | |
| 613 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 614 | typename enable_if | |
| 615 | < | |
| 616 | __is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 617 | is_constructible< | |
| 618 | value_type, | |
| 619 | typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 620 | iterator | |
| 621 | >::type | |
| 622 | insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); | |
| 610 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __position, _Args&&... __args); | |
| 611 | ||
| 612 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 613 | iterator insert(const_iterator __position, size_type __n, const_reference __x); | |
| 614 | ||
| 615 | template <class _InputIterator, | |
| 616 | __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 617 | is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value, | |
| 618 | int> = 0> | |
| 619 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator | |
| 620 | insert(const_iterator __position, _InputIterator __first, _InputIterator __last); | |
| 621 | ||
| 622 | template < | |
| 623 | class _ForwardIterator, | |
| 624 | __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 625 | is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 626 | int> = 0> | |
| 627 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator | |
| 628 | insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); | |
| 623 | 629 | |
| 624 | 630 | #ifndef _LIBCPP_CXX03_LANG |
| 625 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 631 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 626 | 632 | iterator insert(const_iterator __position, initializer_list<value_type> __il) |
| 627 | 633 | {return insert(__position, __il.begin(), __il.end());} |
| 628 | 634 | #endif |
| 629 | 635 | |
| 630 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); | |
| 631 | _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator erase(const_iterator __first, const_iterator __last); | |
| 636 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __position); | |
| 637 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last); | |
| 632 | 638 | |
| 633 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 639 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 634 | 640 | void clear() _NOEXCEPT |
| 635 | 641 | { |
| 636 | 642 | size_type __old_size = size(); |
| ... | ... | @@ -639,10 +645,10 @@ public: |
| 639 | 645 | std::__debug_db_invalidate_all(this); |
| 640 | 646 | } |
| 641 | 647 | |
| 642 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void resize(size_type __sz); | |
| 643 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void resize(size_type __sz, const_reference __x); | |
| 648 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz); | |
| 649 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz, const_reference __x); | |
| 644 | 650 | |
| 645 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(vector&) | |
| 651 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(vector&) | |
| 646 | 652 | #if _LIBCPP_STD_VER >= 14 |
| 647 | 653 | _NOEXCEPT; |
| 648 | 654 | #else |
| ... | ... | @@ -650,7 +656,7 @@ public: |
| 650 | 656 | __is_nothrow_swappable<allocator_type>::value); |
| 651 | 657 | #endif |
| 652 | 658 | |
| 653 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __invariants() const; | |
| 659 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const; | |
| 654 | 660 | |
| 655 | 661 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| 656 | 662 | |
| ... | ... | @@ -667,7 +673,7 @@ private: |
| 667 | 673 | __compressed_pair<pointer, allocator_type> __end_cap_ = |
| 668 | 674 | __compressed_pair<pointer, allocator_type>(nullptr, __default_init_tag()); |
| 669 | 675 | |
| 670 | _LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(pointer __new_last); | |
| 676 | _LIBCPP_HIDE_FROM_ABI void __invalidate_iterators_past(pointer __new_last); | |
| 671 | 677 | |
| 672 | 678 | // Allocate space for __n objects |
| 673 | 679 | // throws length_error if __n > max_size() |
| ... | ... | @@ -676,7 +682,7 @@ private: |
| 676 | 682 | // Precondition: __n > 0 |
| 677 | 683 | // Postcondition: capacity() >= __n |
| 678 | 684 | // Postcondition: size() == 0 |
| 679 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) { | |
| 685 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) { | |
| 680 | 686 | if (__n > max_size()) |
| 681 | 687 | __throw_length_error(); |
| 682 | 688 | auto __allocation = std::__allocate_at_least(__alloc(), __n); |
| ... | ... | @@ -686,33 +692,30 @@ private: |
| 686 | 692 | __annotate_new(0); |
| 687 | 693 | } |
| 688 | 694 | |
| 689 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __vdeallocate() _NOEXCEPT; | |
| 690 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const; | |
| 691 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct_at_end(size_type __n); | |
| 692 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 695 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vdeallocate() _NOEXCEPT; | |
| 696 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __recommend(size_type __new_size) const; | |
| 697 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n); | |
| 698 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 693 | 699 | void __construct_at_end(size_type __n, const_reference __x); |
| 694 | template <class _ForwardIterator> | |
| 695 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 696 | typename enable_if | |
| 697 | < | |
| 698 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 699 | void | |
| 700 | >::type | |
| 701 | __construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n); | |
| 702 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __append(size_type __n); | |
| 703 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __append(size_type __n, const_reference __x); | |
| 704 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 705 | iterator __make_iter(pointer __p) _NOEXCEPT; | |
| 706 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 707 | const_iterator __make_iter(const_pointer __p) const _NOEXCEPT; | |
| 708 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v); | |
| 709 | _LIBCPP_CONSTEXPR_AFTER_CXX17 pointer __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p); | |
| 710 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __move_range(pointer __from_s, pointer __from_e, pointer __to); | |
| 711 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __move_assign(vector& __c, true_type) | |
| 700 | ||
| 701 | template <class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value, int> = 0> | |
| 702 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void | |
| 703 | __construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n); | |
| 704 | ||
| 705 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n); | |
| 706 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x); | |
| 707 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 708 | iterator __make_iter(pointer __p) _NOEXCEPT { return iterator(this, __p); } | |
| 709 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 710 | const_iterator __make_iter(const_pointer __p) const _NOEXCEPT { return const_iterator(this, __p); } | |
| 711 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v); | |
| 712 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p); | |
| 713 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_range(pointer __from_s, pointer __from_e, pointer __to); | |
| 714 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, true_type) | |
| 712 | 715 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value); |
| 713 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __move_assign(vector& __c, false_type) | |
| 716 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, false_type) | |
| 714 | 717 | _NOEXCEPT_(__alloc_traits::is_always_equal::value); |
| 715 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 718 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 716 | 719 | void __destruct_at_end(pointer __new_last) _NOEXCEPT |
| 717 | 720 | { |
| 718 | 721 | if (!__libcpp_is_constant_evaluated()) |
| ... | ... | @@ -723,11 +726,11 @@ private: |
| 723 | 726 | } |
| 724 | 727 | |
| 725 | 728 | template <class _Up> |
| 726 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 729 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 727 | 730 | inline void __push_back_slow_path(_Up&& __x); |
| 728 | 731 | |
| 729 | 732 | template <class... _Args> |
| 730 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 733 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 731 | 734 | inline void __emplace_back_slow_path(_Args&&... __args); |
| 732 | 735 | |
| 733 | 736 | // The following functions are no-ops outside of AddressSanitizer mode. |
| ... | ... | @@ -735,7 +738,7 @@ private: |
| 735 | 738 | // may not meet the AddressSanitizer alignment constraints. |
| 736 | 739 | // See the documentation for __sanitizer_annotate_contiguous_container for more details. |
| 737 | 740 | #ifndef _LIBCPP_HAS_NO_ASAN |
| 738 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 741 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 739 | 742 | void __annotate_contiguous_container(const void *__beg, const void *__end, |
| 740 | 743 | const void *__old_mid, |
| 741 | 744 | const void *__new_mid) const |
| ... | ... | @@ -745,30 +748,30 @@ private: |
| 745 | 748 | __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid); |
| 746 | 749 | } |
| 747 | 750 | #else |
| 748 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 751 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 749 | 752 | void __annotate_contiguous_container(const void*, const void*, const void*, |
| 750 | 753 | const void*) const _NOEXCEPT {} |
| 751 | 754 | #endif |
| 752 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 755 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 753 | 756 | void __annotate_new(size_type __current_size) const _NOEXCEPT { |
| 754 | 757 | __annotate_contiguous_container(data(), data() + capacity(), |
| 755 | 758 | data() + capacity(), data() + __current_size); |
| 756 | 759 | } |
| 757 | 760 | |
| 758 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 761 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 759 | 762 | void __annotate_delete() const _NOEXCEPT { |
| 760 | 763 | __annotate_contiguous_container(data(), data() + capacity(), |
| 761 | 764 | data() + size(), data() + capacity()); |
| 762 | 765 | } |
| 763 | 766 | |
| 764 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 767 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 765 | 768 | void __annotate_increase(size_type __n) const _NOEXCEPT |
| 766 | 769 | { |
| 767 | 770 | __annotate_contiguous_container(data(), data() + capacity(), |
| 768 | 771 | data() + size(), data() + size() + __n); |
| 769 | 772 | } |
| 770 | 773 | |
| 771 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 774 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 772 | 775 | void __annotate_shrink(size_type __old_size) const _NOEXCEPT |
| 773 | 776 | { |
| 774 | 777 | __annotate_contiguous_container(data(), data() + capacity(), |
| ... | ... | @@ -776,14 +779,14 @@ private: |
| 776 | 779 | } |
| 777 | 780 | |
| 778 | 781 | struct _ConstructTransaction { |
| 779 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 782 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 780 | 783 | explicit _ConstructTransaction(vector &__v, size_type __n) |
| 781 | 784 | : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) { |
| 782 | 785 | #ifndef _LIBCPP_HAS_NO_ASAN |
| 783 | 786 | __v_.__annotate_increase(__n); |
| 784 | 787 | #endif |
| 785 | 788 | } |
| 786 | _LIBCPP_CONSTEXPR_AFTER_CXX17 ~_ConstructTransaction() { | |
| 789 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { | |
| 787 | 790 | __v_.__end_ = __pos_; |
| 788 | 791 | #ifndef _LIBCPP_HAS_NO_ASAN |
| 789 | 792 | if (__pos_ != __new_end_) { |
| ... | ... | @@ -802,44 +805,44 @@ private: |
| 802 | 805 | }; |
| 803 | 806 | |
| 804 | 807 | template <class ..._Args> |
| 805 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 808 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 806 | 809 | void __construct_one_at_end(_Args&& ...__args) { |
| 807 | 810 | _ConstructTransaction __tx(*this, 1); |
| 808 | __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_), | |
| 809 | _VSTD::forward<_Args>(__args)...); | |
| 811 | __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_), | |
| 812 | std::forward<_Args>(__args)...); | |
| 810 | 813 | ++__tx.__pos_; |
| 811 | 814 | } |
| 812 | 815 | |
| 813 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 816 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 814 | 817 | allocator_type& __alloc() _NOEXCEPT |
| 815 | 818 | {return this->__end_cap_.second();} |
| 816 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 819 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 817 | 820 | const allocator_type& __alloc() const _NOEXCEPT |
| 818 | 821 | {return this->__end_cap_.second();} |
| 819 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 822 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 820 | 823 | pointer& __end_cap() _NOEXCEPT |
| 821 | 824 | {return this->__end_cap_.first();} |
| 822 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 825 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 823 | 826 | const pointer& __end_cap() const _NOEXCEPT |
| 824 | 827 | {return this->__end_cap_.first();} |
| 825 | 828 | |
| 826 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 829 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 827 | 830 | void __clear() _NOEXCEPT {__base_destruct_at_end(this->__begin_);} |
| 828 | 831 | |
| 829 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 832 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 830 | 833 | void __base_destruct_at_end(pointer __new_last) _NOEXCEPT { |
| 831 | 834 | pointer __soon_to_be_end = this->__end_; |
| 832 | 835 | while (__new_last != __soon_to_be_end) |
| 833 | __alloc_traits::destroy(__alloc(), _VSTD::__to_address(--__soon_to_be_end)); | |
| 836 | __alloc_traits::destroy(__alloc(), std::__to_address(--__soon_to_be_end)); | |
| 834 | 837 | this->__end_ = __new_last; |
| 835 | 838 | } |
| 836 | 839 | |
| 837 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 840 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 838 | 841 | void __copy_assign_alloc(const vector& __c) |
| 839 | 842 | {__copy_assign_alloc(__c, integral_constant<bool, |
| 840 | 843 | __alloc_traits::propagate_on_container_copy_assignment::value>());} |
| 841 | 844 | |
| 842 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 845 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 843 | 846 | void __move_assign_alloc(vector& __c) |
| 844 | 847 | _NOEXCEPT_( |
| 845 | 848 | !__alloc_traits::propagate_on_container_move_assignment::value || |
| ... | ... | @@ -849,15 +852,15 @@ private: |
| 849 | 852 | |
| 850 | 853 | _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI |
| 851 | 854 | void __throw_length_error() const { |
| 852 | _VSTD::__throw_length_error("vector"); | |
| 855 | std::__throw_length_error("vector"); | |
| 853 | 856 | } |
| 854 | 857 | |
| 855 | 858 | _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI |
| 856 | 859 | void __throw_out_of_range() const { |
| 857 | _VSTD::__throw_out_of_range("vector"); | |
| 860 | std::__throw_out_of_range("vector"); | |
| 858 | 861 | } |
| 859 | 862 | |
| 860 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 863 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 861 | 864 | void __copy_assign_alloc(const vector& __c, true_type) |
| 862 | 865 | { |
| 863 | 866 | if (__alloc() != __c.__alloc()) |
| ... | ... | @@ -869,18 +872,18 @@ private: |
| 869 | 872 | __alloc() = __c.__alloc(); |
| 870 | 873 | } |
| 871 | 874 | |
| 872 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 875 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 873 | 876 | void __copy_assign_alloc(const vector&, false_type) |
| 874 | 877 | {} |
| 875 | 878 | |
| 876 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 879 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 877 | 880 | void __move_assign_alloc(vector& __c, true_type) |
| 878 | 881 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) |
| 879 | 882 | { |
| 880 | __alloc() = _VSTD::move(__c.__alloc()); | |
| 883 | __alloc() = std::move(__c.__alloc()); | |
| 881 | 884 | } |
| 882 | 885 | |
| 883 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 886 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI | |
| 884 | 887 | void __move_assign_alloc(vector&, false_type) |
| 885 | 888 | _NOEXCEPT |
| 886 | 889 | {} |
| ... | ... | @@ -905,7 +908,7 @@ vector(_InputIterator, _InputIterator, _Alloc) |
| 905 | 908 | #endif |
| 906 | 909 | |
| 907 | 910 | template <class _Tp, class _Allocator> |
| 908 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 911 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 909 | 912 | void |
| 910 | 913 | vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v) |
| 911 | 914 | { |
| ... | ... | @@ -914,16 +917,16 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a |
| 914 | 917 | __v.__begin_ = std::__uninitialized_allocator_move_if_noexcept( |
| 915 | 918 | __alloc(), _RevIter(__end_), _RevIter(__begin_), _RevIter(__v.__begin_)) |
| 916 | 919 | .base(); |
| 917 | _VSTD::swap(this->__begin_, __v.__begin_); | |
| 918 | _VSTD::swap(this->__end_, __v.__end_); | |
| 919 | _VSTD::swap(this->__end_cap(), __v.__end_cap()); | |
| 920 | std::swap(this->__begin_, __v.__begin_); | |
| 921 | std::swap(this->__end_, __v.__end_); | |
| 922 | std::swap(this->__end_cap(), __v.__end_cap()); | |
| 920 | 923 | __v.__first_ = __v.__begin_; |
| 921 | 924 | __annotate_new(size()); |
| 922 | 925 | std::__debug_db_invalidate_all(this); |
| 923 | 926 | } |
| 924 | 927 | |
| 925 | 928 | template <class _Tp, class _Allocator> |
| 926 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 929 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 927 | 930 | typename vector<_Tp, _Allocator>::pointer |
| 928 | 931 | vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p) |
| 929 | 932 | { |
| ... | ... | @@ -934,9 +937,9 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a |
| 934 | 937 | __alloc(), _RevIter(__p), _RevIter(__begin_), _RevIter(__v.__begin_)) |
| 935 | 938 | .base(); |
| 936 | 939 | __v.__end_ = std::__uninitialized_allocator_move_if_noexcept(__alloc(), __p, __end_, __v.__end_); |
| 937 | _VSTD::swap(this->__begin_, __v.__begin_); | |
| 938 | _VSTD::swap(this->__end_, __v.__end_); | |
| 939 | _VSTD::swap(this->__end_cap(), __v.__end_cap()); | |
| 940 | std::swap(this->__begin_, __v.__begin_); | |
| 941 | std::swap(this->__end_, __v.__end_); | |
| 942 | std::swap(this->__end_cap(), __v.__end_cap()); | |
| 940 | 943 | __v.__first_ = __v.__begin_; |
| 941 | 944 | __annotate_new(size()); |
| 942 | 945 | std::__debug_db_invalidate_all(this); |
| ... | ... | @@ -944,7 +947,7 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a |
| 944 | 947 | } |
| 945 | 948 | |
| 946 | 949 | template <class _Tp, class _Allocator> |
| 947 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 950 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 948 | 951 | void |
| 949 | 952 | vector<_Tp, _Allocator>::__vdeallocate() _NOEXCEPT |
| 950 | 953 | { |
| ... | ... | @@ -957,18 +960,18 @@ vector<_Tp, _Allocator>::__vdeallocate() _NOEXCEPT |
| 957 | 960 | } |
| 958 | 961 | |
| 959 | 962 | template <class _Tp, class _Allocator> |
| 960 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 963 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 961 | 964 | typename vector<_Tp, _Allocator>::size_type |
| 962 | 965 | vector<_Tp, _Allocator>::max_size() const _NOEXCEPT |
| 963 | 966 | { |
| 964 | return _VSTD::min<size_type>(__alloc_traits::max_size(this->__alloc()), | |
| 967 | return std::min<size_type>(__alloc_traits::max_size(this->__alloc()), | |
| 965 | 968 | numeric_limits<difference_type>::max()); |
| 966 | 969 | } |
| 967 | 970 | |
| 968 | 971 | // Precondition: __new_size > capacity() |
| 969 | 972 | template <class _Tp, class _Allocator> |
| 970 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 971 | inline _LIBCPP_INLINE_VISIBILITY | |
| 973 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 974 | inline _LIBCPP_HIDE_FROM_ABI | |
| 972 | 975 | typename vector<_Tp, _Allocator>::size_type |
| 973 | 976 | vector<_Tp, _Allocator>::__recommend(size_type __new_size) const |
| 974 | 977 | { |
| ... | ... | @@ -978,7 +981,7 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const |
| 978 | 981 | const size_type __cap = capacity(); |
| 979 | 982 | if (__cap >= __ms / 2) |
| 980 | 983 | return __ms; |
| 981 | return _VSTD::max<size_type>(2 * __cap, __new_size); | |
| 984 | return std::max<size_type>(2 * __cap, __new_size); | |
| 982 | 985 | } |
| 983 | 986 | |
| 984 | 987 | // Default constructs __n objects starting at __end_ |
| ... | ... | @@ -987,14 +990,14 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const |
| 987 | 990 | // Precondition: size() + __n <= capacity() |
| 988 | 991 | // Postcondition: size() == size() + __n |
| 989 | 992 | template <class _Tp, class _Allocator> |
| 990 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 993 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 991 | 994 | void |
| 992 | 995 | vector<_Tp, _Allocator>::__construct_at_end(size_type __n) |
| 993 | 996 | { |
| 994 | 997 | _ConstructTransaction __tx(*this, __n); |
| 995 | 998 | const_pointer __new_end = __tx.__new_end_; |
| 996 | 999 | for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) { |
| 997 | __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__pos)); | |
| 1000 | __alloc_traits::construct(this->__alloc(), std::__to_address(__pos)); | |
| 998 | 1001 | } |
| 999 | 1002 | } |
| 1000 | 1003 | |
| ... | ... | @@ -1005,7 +1008,7 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n) |
| 1005 | 1008 | // Postcondition: size() == old size() + __n |
| 1006 | 1009 | // Postcondition: [i] == __x for all i in [size() - __n, __n) |
| 1007 | 1010 | template <class _Tp, class _Allocator> |
| 1008 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1011 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1009 | 1012 | inline |
| 1010 | 1013 | void |
| 1011 | 1014 | vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) |
| ... | ... | @@ -1013,18 +1016,13 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) |
| 1013 | 1016 | _ConstructTransaction __tx(*this, __n); |
| 1014 | 1017 | const_pointer __new_end = __tx.__new_end_; |
| 1015 | 1018 | for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) { |
| 1016 | __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__pos), __x); | |
| 1019 | __alloc_traits::construct(this->__alloc(), std::__to_address(__pos), __x); | |
| 1017 | 1020 | } |
| 1018 | 1021 | } |
| 1019 | 1022 | |
| 1020 | 1023 | template <class _Tp, class _Allocator> |
| 1021 | template <class _ForwardIterator> | |
| 1022 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1023 | typename enable_if | |
| 1024 | < | |
| 1025 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 1026 | void | |
| 1027 | >::type | |
| 1024 | template <class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value, int> > | |
| 1025 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 1028 | 1026 | vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n) |
| 1029 | 1027 | { |
| 1030 | 1028 | _ConstructTransaction __tx(*this, __n); |
| ... | ... | @@ -1036,7 +1034,7 @@ vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIt |
| 1036 | 1034 | // Postcondition: size() == size() + __n |
| 1037 | 1035 | // Exception safety: strong. |
| 1038 | 1036 | template <class _Tp, class _Allocator> |
| 1039 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1037 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1040 | 1038 | void |
| 1041 | 1039 | vector<_Tp, _Allocator>::__append(size_type __n) |
| 1042 | 1040 | { |
| ... | ... | @@ -1056,7 +1054,7 @@ vector<_Tp, _Allocator>::__append(size_type __n) |
| 1056 | 1054 | // Postcondition: size() == size() + __n |
| 1057 | 1055 | // Exception safety: strong. |
| 1058 | 1056 | template <class _Tp, class _Allocator> |
| 1059 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1057 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1060 | 1058 | void |
| 1061 | 1059 | vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x) |
| 1062 | 1060 | { |
| ... | ... | @@ -1072,152 +1070,160 @@ vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x) |
| 1072 | 1070 | } |
| 1073 | 1071 | |
| 1074 | 1072 | template <class _Tp, class _Allocator> |
| 1075 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1073 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1076 | 1074 | vector<_Tp, _Allocator>::vector(size_type __n) |
| 1077 | 1075 | { |
| 1078 | _VSTD::__debug_db_insert_c(this); | |
| 1076 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1077 | std::__debug_db_insert_c(this); | |
| 1079 | 1078 | if (__n > 0) |
| 1080 | 1079 | { |
| 1081 | 1080 | __vallocate(__n); |
| 1082 | 1081 | __construct_at_end(__n); |
| 1083 | 1082 | } |
| 1083 | __guard.__complete(); | |
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | #if _LIBCPP_STD_VER > 11 |
| 1087 | 1087 | template <class _Tp, class _Allocator> |
| 1088 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1088 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1089 | 1089 | vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a) |
| 1090 | 1090 | : __end_cap_(nullptr, __a) |
| 1091 | 1091 | { |
| 1092 | _VSTD::__debug_db_insert_c(this); | |
| 1092 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1093 | std::__debug_db_insert_c(this); | |
| 1093 | 1094 | if (__n > 0) |
| 1094 | 1095 | { |
| 1095 | 1096 | __vallocate(__n); |
| 1096 | 1097 | __construct_at_end(__n); |
| 1097 | 1098 | } |
| 1099 | __guard.__complete(); | |
| 1098 | 1100 | } |
| 1099 | 1101 | #endif |
| 1100 | 1102 | |
| 1101 | 1103 | template <class _Tp, class _Allocator> |
| 1102 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1104 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1103 | 1105 | vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x) |
| 1104 | 1106 | { |
| 1105 | _VSTD::__debug_db_insert_c(this); | |
| 1107 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1108 | std::__debug_db_insert_c(this); | |
| 1106 | 1109 | if (__n > 0) |
| 1107 | 1110 | { |
| 1108 | 1111 | __vallocate(__n); |
| 1109 | 1112 | __construct_at_end(__n, __x); |
| 1110 | 1113 | } |
| 1114 | __guard.__complete(); | |
| 1111 | 1115 | } |
| 1112 | 1116 | |
| 1113 | 1117 | template <class _Tp, class _Allocator> |
| 1114 | template <class _InputIterator> | |
| 1115 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1116 | vector<_Tp, _Allocator>::vector(_InputIterator __first, | |
| 1117 | typename enable_if<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 1118 | is_constructible< | |
| 1119 | value_type, | |
| 1120 | typename iterator_traits<_InputIterator>::reference>::value, | |
| 1121 | _InputIterator>::type __last) | |
| 1122 | { | |
| 1123 | _VSTD::__debug_db_insert_c(this); | |
| 1118 | template <class _InputIterator, __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 1119 | is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value, | |
| 1120 | int> > | |
| 1121 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1122 | vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last) | |
| 1123 | { | |
| 1124 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1125 | std::__debug_db_insert_c(this); | |
| 1124 | 1126 | for (; __first != __last; ++__first) |
| 1125 | 1127 | emplace_back(*__first); |
| 1128 | __guard.__complete(); | |
| 1126 | 1129 | } |
| 1127 | 1130 | |
| 1128 | 1131 | template <class _Tp, class _Allocator> |
| 1129 | template <class _InputIterator> | |
| 1130 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1131 | vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, | |
| 1132 | typename enable_if<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 1133 | is_constructible< | |
| 1134 | value_type, | |
| 1135 | typename iterator_traits<_InputIterator>::reference>::value>::type*) | |
| 1132 | template <class _InputIterator, __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 1133 | is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value, | |
| 1134 | int> > | |
| 1135 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1136 | vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a) | |
| 1136 | 1137 | : __end_cap_(nullptr, __a) |
| 1137 | 1138 | { |
| 1138 | _VSTD::__debug_db_insert_c(this); | |
| 1139 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1140 | std::__debug_db_insert_c(this); | |
| 1139 | 1141 | for (; __first != __last; ++__first) |
| 1140 | 1142 | emplace_back(*__first); |
| 1143 | __guard.__complete(); | |
| 1141 | 1144 | } |
| 1142 | 1145 | |
| 1143 | 1146 | template <class _Tp, class _Allocator> |
| 1144 | template <class _ForwardIterator> | |
| 1145 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1146 | vector<_Tp, _Allocator>::vector(_ForwardIterator __first, | |
| 1147 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1148 | is_constructible< | |
| 1149 | value_type, | |
| 1150 | typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 1151 | _ForwardIterator>::type __last) | |
| 1152 | { | |
| 1153 | _VSTD::__debug_db_insert_c(this); | |
| 1154 | size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); | |
| 1147 | template <class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1148 | is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 1149 | int> > | |
| 1150 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1151 | vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last) | |
| 1152 | { | |
| 1153 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1154 | std::__debug_db_insert_c(this); | |
| 1155 | size_type __n = static_cast<size_type>(std::distance(__first, __last)); | |
| 1155 | 1156 | if (__n > 0) |
| 1156 | 1157 | { |
| 1157 | 1158 | __vallocate(__n); |
| 1158 | 1159 | __construct_at_end(__first, __last, __n); |
| 1159 | 1160 | } |
| 1161 | __guard.__complete(); | |
| 1160 | 1162 | } |
| 1161 | 1163 | |
| 1162 | 1164 | template <class _Tp, class _Allocator> |
| 1163 | template <class _ForwardIterator> | |
| 1164 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1165 | vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, | |
| 1166 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1167 | is_constructible< | |
| 1168 | value_type, | |
| 1169 | typename iterator_traits<_ForwardIterator>::reference>::value>::type*) | |
| 1165 | template <class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1166 | is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 1167 | int> > | |
| 1168 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1169 | vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a) | |
| 1170 | 1170 | : __end_cap_(nullptr, __a) |
| 1171 | 1171 | { |
| 1172 | _VSTD::__debug_db_insert_c(this); | |
| 1173 | size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); | |
| 1172 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1173 | std::__debug_db_insert_c(this); | |
| 1174 | size_type __n = static_cast<size_type>(std::distance(__first, __last)); | |
| 1174 | 1175 | if (__n > 0) |
| 1175 | 1176 | { |
| 1176 | 1177 | __vallocate(__n); |
| 1177 | 1178 | __construct_at_end(__first, __last, __n); |
| 1178 | 1179 | } |
| 1180 | __guard.__complete(); | |
| 1179 | 1181 | } |
| 1180 | 1182 | |
| 1181 | 1183 | template <class _Tp, class _Allocator> |
| 1182 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1184 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1183 | 1185 | vector<_Tp, _Allocator>::vector(const vector& __x) |
| 1184 | 1186 | : __end_cap_(nullptr, __alloc_traits::select_on_container_copy_construction(__x.__alloc())) |
| 1185 | 1187 | { |
| 1186 | _VSTD::__debug_db_insert_c(this); | |
| 1188 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1189 | std::__debug_db_insert_c(this); | |
| 1187 | 1190 | size_type __n = __x.size(); |
| 1188 | 1191 | if (__n > 0) |
| 1189 | 1192 | { |
| 1190 | 1193 | __vallocate(__n); |
| 1191 | 1194 | __construct_at_end(__x.__begin_, __x.__end_, __n); |
| 1192 | 1195 | } |
| 1196 | __guard.__complete(); | |
| 1193 | 1197 | } |
| 1194 | 1198 | |
| 1195 | 1199 | template <class _Tp, class _Allocator> |
| 1196 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1200 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1197 | 1201 | vector<_Tp, _Allocator>::vector(const vector& __x, const __type_identity_t<allocator_type>& __a) |
| 1198 | 1202 | : __end_cap_(nullptr, __a) |
| 1199 | 1203 | { |
| 1200 | _VSTD::__debug_db_insert_c(this); | |
| 1204 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1205 | std::__debug_db_insert_c(this); | |
| 1201 | 1206 | size_type __n = __x.size(); |
| 1202 | 1207 | if (__n > 0) |
| 1203 | 1208 | { |
| 1204 | 1209 | __vallocate(__n); |
| 1205 | 1210 | __construct_at_end(__x.__begin_, __x.__end_, __n); |
| 1206 | 1211 | } |
| 1212 | __guard.__complete(); | |
| 1207 | 1213 | } |
| 1208 | 1214 | |
| 1209 | 1215 | template <class _Tp, class _Allocator> |
| 1210 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1211 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1216 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1217 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1212 | 1218 | vector<_Tp, _Allocator>::vector(vector&& __x) |
| 1213 | 1219 | #if _LIBCPP_STD_VER > 14 |
| 1214 | 1220 | noexcept |
| 1215 | 1221 | #else |
| 1216 | 1222 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) |
| 1217 | 1223 | #endif |
| 1218 | : __end_cap_(nullptr, _VSTD::move(__x.__alloc())) | |
| 1224 | : __end_cap_(nullptr, std::move(__x.__alloc())) | |
| 1219 | 1225 | { |
| 1220 | _VSTD::__debug_db_insert_c(this); | |
| 1226 | std::__debug_db_insert_c(this); | |
| 1221 | 1227 | std::__debug_db_swap(this, std::addressof(__x)); |
| 1222 | 1228 | this->__begin_ = __x.__begin_; |
| 1223 | 1229 | this->__end_ = __x.__end_; |
| ... | ... | @@ -1226,12 +1232,12 @@ vector<_Tp, _Allocator>::vector(vector&& __x) |
| 1226 | 1232 | } |
| 1227 | 1233 | |
| 1228 | 1234 | template <class _Tp, class _Allocator> |
| 1229 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1230 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1235 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1236 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1231 | 1237 | vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_type>& __a) |
| 1232 | 1238 | : __end_cap_(nullptr, __a) |
| 1233 | 1239 | { |
| 1234 | _VSTD::__debug_db_insert_c(this); | |
| 1240 | std::__debug_db_insert_c(this); | |
| 1235 | 1241 | if (__a == __x.__alloc()) |
| 1236 | 1242 | { |
| 1237 | 1243 | this->__begin_ = __x.__begin_; |
| ... | ... | @@ -1243,44 +1249,50 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_ |
| 1243 | 1249 | else |
| 1244 | 1250 | { |
| 1245 | 1251 | typedef move_iterator<iterator> _Ip; |
| 1252 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1246 | 1253 | assign(_Ip(__x.begin()), _Ip(__x.end())); |
| 1254 | __guard.__complete(); | |
| 1247 | 1255 | } |
| 1248 | 1256 | } |
| 1249 | 1257 | |
| 1250 | 1258 | #ifndef _LIBCPP_CXX03_LANG |
| 1251 | 1259 | |
| 1252 | 1260 | template <class _Tp, class _Allocator> |
| 1253 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1254 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1261 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1262 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1255 | 1263 | vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il) |
| 1256 | 1264 | { |
| 1257 | _VSTD::__debug_db_insert_c(this); | |
| 1265 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1266 | std::__debug_db_insert_c(this); | |
| 1258 | 1267 | if (__il.size() > 0) |
| 1259 | 1268 | { |
| 1260 | 1269 | __vallocate(__il.size()); |
| 1261 | 1270 | __construct_at_end(__il.begin(), __il.end(), __il.size()); |
| 1262 | 1271 | } |
| 1272 | __guard.__complete(); | |
| 1263 | 1273 | } |
| 1264 | 1274 | |
| 1265 | 1275 | template <class _Tp, class _Allocator> |
| 1266 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1267 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1276 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1277 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1268 | 1278 | vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a) |
| 1269 | 1279 | : __end_cap_(nullptr, __a) |
| 1270 | 1280 | { |
| 1271 | _VSTD::__debug_db_insert_c(this); | |
| 1281 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 1282 | std::__debug_db_insert_c(this); | |
| 1272 | 1283 | if (__il.size() > 0) |
| 1273 | 1284 | { |
| 1274 | 1285 | __vallocate(__il.size()); |
| 1275 | 1286 | __construct_at_end(__il.begin(), __il.end(), __il.size()); |
| 1276 | 1287 | } |
| 1288 | __guard.__complete(); | |
| 1277 | 1289 | } |
| 1278 | 1290 | |
| 1279 | 1291 | #endif // _LIBCPP_CXX03_LANG |
| 1280 | 1292 | |
| 1281 | 1293 | template <class _Tp, class _Allocator> |
| 1282 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1283 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1294 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1295 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1284 | 1296 | vector<_Tp, _Allocator>& |
| 1285 | 1297 | vector<_Tp, _Allocator>::operator=(vector&& __x) |
| 1286 | 1298 | _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) |
| ... | ... | @@ -1291,7 +1303,7 @@ vector<_Tp, _Allocator>::operator=(vector&& __x) |
| 1291 | 1303 | } |
| 1292 | 1304 | |
| 1293 | 1305 | template <class _Tp, class _Allocator> |
| 1294 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1306 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1295 | 1307 | void |
| 1296 | 1308 | vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type) |
| 1297 | 1309 | _NOEXCEPT_(__alloc_traits::is_always_equal::value) |
| ... | ... | @@ -1306,7 +1318,7 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type) |
| 1306 | 1318 | } |
| 1307 | 1319 | |
| 1308 | 1320 | template <class _Tp, class _Allocator> |
| 1309 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1321 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1310 | 1322 | void |
| 1311 | 1323 | vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type) |
| 1312 | 1324 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) |
| ... | ... | @@ -1321,12 +1333,12 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type) |
| 1321 | 1333 | } |
| 1322 | 1334 | |
| 1323 | 1335 | template <class _Tp, class _Allocator> |
| 1324 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1325 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1336 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1337 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1326 | 1338 | vector<_Tp, _Allocator>& |
| 1327 | 1339 | vector<_Tp, _Allocator>::operator=(const vector& __x) |
| 1328 | 1340 | { |
| 1329 | if (this != _VSTD::addressof(__x)) | |
| 1341 | if (this != std::addressof(__x)) | |
| 1330 | 1342 | { |
| 1331 | 1343 | __copy_assign_alloc(__x); |
| 1332 | 1344 | assign(__x.__begin_, __x.__end_); |
| ... | ... | @@ -1335,13 +1347,10 @@ vector<_Tp, _Allocator>::operator=(const vector& __x) |
| 1335 | 1347 | } |
| 1336 | 1348 | |
| 1337 | 1349 | template <class _Tp, class _Allocator> |
| 1338 | template <class _InputIterator> | |
| 1339 | _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if <__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 1340 | is_constructible< | |
| 1341 | _Tp, | |
| 1342 | typename iterator_traits<_InputIterator>::reference>::value, | |
| 1343 | void | |
| 1344 | >::type | |
| 1350 | template <class _InputIterator, __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 1351 | is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value, | |
| 1352 | int> > | |
| 1353 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 1345 | 1354 | vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last) |
| 1346 | 1355 | { |
| 1347 | 1356 | clear(); |
| ... | ... | @@ -1350,19 +1359,13 @@ vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last) |
| 1350 | 1359 | } |
| 1351 | 1360 | |
| 1352 | 1361 | template <class _Tp, class _Allocator> |
| 1353 | template <class _ForwardIterator> | |
| 1354 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1355 | typename enable_if | |
| 1356 | < | |
| 1357 | __is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1358 | is_constructible< | |
| 1359 | _Tp, | |
| 1360 | typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 1361 | void | |
| 1362 | >::type | |
| 1362 | template <class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1363 | is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 1364 | int> > | |
| 1365 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 1363 | 1366 | vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) |
| 1364 | 1367 | { |
| 1365 | size_type __new_size = static_cast<size_type>(_VSTD::distance(__first, __last)); | |
| 1368 | size_type __new_size = static_cast<size_type>(std::distance(__first, __last)); | |
| 1366 | 1369 | if (__new_size <= capacity()) |
| 1367 | 1370 | { |
| 1368 | 1371 | _ForwardIterator __mid = __last; |
| ... | ... | @@ -1371,9 +1374,9 @@ vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __las |
| 1371 | 1374 | { |
| 1372 | 1375 | __growing = true; |
| 1373 | 1376 | __mid = __first; |
| 1374 | _VSTD::advance(__mid, size()); | |
| 1377 | std::advance(__mid, size()); | |
| 1375 | 1378 | } |
| 1376 | pointer __m = _VSTD::copy(__first, __mid, this->__begin_); | |
| 1379 | pointer __m = std::copy(__first, __mid, this->__begin_); | |
| 1377 | 1380 | if (__growing) |
| 1378 | 1381 | __construct_at_end(__mid, __last, __new_size - size()); |
| 1379 | 1382 | else |
| ... | ... | @@ -1389,14 +1392,14 @@ vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __las |
| 1389 | 1392 | } |
| 1390 | 1393 | |
| 1391 | 1394 | template <class _Tp, class _Allocator> |
| 1392 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1395 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1393 | 1396 | void |
| 1394 | 1397 | vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) |
| 1395 | 1398 | { |
| 1396 | 1399 | if (__n <= capacity()) |
| 1397 | 1400 | { |
| 1398 | 1401 | size_type __s = size(); |
| 1399 | _VSTD::fill_n(this->__begin_, _VSTD::min(__n, __s), __u); | |
| 1402 | std::fill_n(this->__begin_, std::min(__n, __s), __u); | |
| 1400 | 1403 | if (__n > __s) |
| 1401 | 1404 | __construct_at_end(__n - __s, __u); |
| 1402 | 1405 | else |
| ... | ... | @@ -1412,44 +1415,44 @@ vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) |
| 1412 | 1415 | } |
| 1413 | 1416 | |
| 1414 | 1417 | template <class _Tp, class _Allocator> |
| 1415 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1416 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1418 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1419 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1417 | 1420 | typename vector<_Tp, _Allocator>::iterator |
| 1418 | 1421 | vector<_Tp, _Allocator>::begin() _NOEXCEPT |
| 1419 | 1422 | { |
| 1420 | return iterator(this, this->__begin_); | |
| 1423 | return __make_iter(this->__begin_); | |
| 1421 | 1424 | } |
| 1422 | 1425 | |
| 1423 | 1426 | template <class _Tp, class _Allocator> |
| 1424 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1425 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1427 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1428 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1426 | 1429 | typename vector<_Tp, _Allocator>::const_iterator |
| 1427 | 1430 | vector<_Tp, _Allocator>::begin() const _NOEXCEPT |
| 1428 | 1431 | { |
| 1429 | return const_iterator(this, this->__begin_); | |
| 1432 | return __make_iter(this->__begin_); | |
| 1430 | 1433 | } |
| 1431 | 1434 | |
| 1432 | 1435 | template <class _Tp, class _Allocator> |
| 1433 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1434 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1436 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1437 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1435 | 1438 | typename vector<_Tp, _Allocator>::iterator |
| 1436 | 1439 | vector<_Tp, _Allocator>::end() _NOEXCEPT |
| 1437 | 1440 | { |
| 1438 | return iterator(this, this->__end_); | |
| 1441 | return __make_iter(this->__end_); | |
| 1439 | 1442 | } |
| 1440 | 1443 | |
| 1441 | 1444 | template <class _Tp, class _Allocator> |
| 1442 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1443 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1445 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1446 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1444 | 1447 | typename vector<_Tp, _Allocator>::const_iterator |
| 1445 | 1448 | vector<_Tp, _Allocator>::end() const _NOEXCEPT |
| 1446 | 1449 | { |
| 1447 | return const_iterator(this, this->__end_); | |
| 1450 | return __make_iter(this->__end_); | |
| 1448 | 1451 | } |
| 1449 | 1452 | |
| 1450 | 1453 | template <class _Tp, class _Allocator> |
| 1451 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1452 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1454 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1455 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1453 | 1456 | typename vector<_Tp, _Allocator>::reference |
| 1454 | 1457 | vector<_Tp, _Allocator>::operator[](size_type __n) _NOEXCEPT |
| 1455 | 1458 | { |
| ... | ... | @@ -1458,8 +1461,8 @@ vector<_Tp, _Allocator>::operator[](size_type __n) _NOEXCEPT |
| 1458 | 1461 | } |
| 1459 | 1462 | |
| 1460 | 1463 | template <class _Tp, class _Allocator> |
| 1461 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1462 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1464 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1465 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1463 | 1466 | typename vector<_Tp, _Allocator>::const_reference |
| 1464 | 1467 | vector<_Tp, _Allocator>::operator[](size_type __n) const _NOEXCEPT |
| 1465 | 1468 | { |
| ... | ... | @@ -1468,7 +1471,7 @@ vector<_Tp, _Allocator>::operator[](size_type __n) const _NOEXCEPT |
| 1468 | 1471 | } |
| 1469 | 1472 | |
| 1470 | 1473 | template <class _Tp, class _Allocator> |
| 1471 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1474 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1472 | 1475 | typename vector<_Tp, _Allocator>::reference |
| 1473 | 1476 | vector<_Tp, _Allocator>::at(size_type __n) |
| 1474 | 1477 | { |
| ... | ... | @@ -1478,7 +1481,7 @@ vector<_Tp, _Allocator>::at(size_type __n) |
| 1478 | 1481 | } |
| 1479 | 1482 | |
| 1480 | 1483 | template <class _Tp, class _Allocator> |
| 1481 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1484 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1482 | 1485 | typename vector<_Tp, _Allocator>::const_reference |
| 1483 | 1486 | vector<_Tp, _Allocator>::at(size_type __n) const |
| 1484 | 1487 | { |
| ... | ... | @@ -1488,7 +1491,7 @@ vector<_Tp, _Allocator>::at(size_type __n) const |
| 1488 | 1491 | } |
| 1489 | 1492 | |
| 1490 | 1493 | template <class _Tp, class _Allocator> |
| 1491 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1494 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1492 | 1495 | void |
| 1493 | 1496 | vector<_Tp, _Allocator>::reserve(size_type __n) |
| 1494 | 1497 | { |
| ... | ... | @@ -1503,7 +1506,7 @@ vector<_Tp, _Allocator>::reserve(size_type __n) |
| 1503 | 1506 | } |
| 1504 | 1507 | |
| 1505 | 1508 | template <class _Tp, class _Allocator> |
| 1506 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1509 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1507 | 1510 | void |
| 1508 | 1511 | vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT |
| 1509 | 1512 | { |
| ... | ... | @@ -1527,21 +1530,21 @@ vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT |
| 1527 | 1530 | |
| 1528 | 1531 | template <class _Tp, class _Allocator> |
| 1529 | 1532 | template <class _Up> |
| 1530 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1533 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1531 | 1534 | void |
| 1532 | 1535 | vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x) |
| 1533 | 1536 | { |
| 1534 | 1537 | allocator_type& __a = this->__alloc(); |
| 1535 | 1538 | __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a); |
| 1536 | // __v.push_back(_VSTD::forward<_Up>(__x)); | |
| 1537 | __alloc_traits::construct(__a, _VSTD::__to_address(__v.__end_), _VSTD::forward<_Up>(__x)); | |
| 1539 | // __v.push_back(std::forward<_Up>(__x)); | |
| 1540 | __alloc_traits::construct(__a, std::__to_address(__v.__end_), std::forward<_Up>(__x)); | |
| 1538 | 1541 | __v.__end_++; |
| 1539 | 1542 | __swap_out_circular_buffer(__v); |
| 1540 | 1543 | } |
| 1541 | 1544 | |
| 1542 | 1545 | template <class _Tp, class _Allocator> |
| 1543 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1544 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1546 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1547 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1545 | 1548 | void |
| 1546 | 1549 | vector<_Tp, _Allocator>::push_back(const_reference __x) |
| 1547 | 1550 | { |
| ... | ... | @@ -1554,36 +1557,36 @@ vector<_Tp, _Allocator>::push_back(const_reference __x) |
| 1554 | 1557 | } |
| 1555 | 1558 | |
| 1556 | 1559 | template <class _Tp, class _Allocator> |
| 1557 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1558 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1560 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1561 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1559 | 1562 | void |
| 1560 | 1563 | vector<_Tp, _Allocator>::push_back(value_type&& __x) |
| 1561 | 1564 | { |
| 1562 | 1565 | if (this->__end_ < this->__end_cap()) |
| 1563 | 1566 | { |
| 1564 | __construct_one_at_end(_VSTD::move(__x)); | |
| 1567 | __construct_one_at_end(std::move(__x)); | |
| 1565 | 1568 | } |
| 1566 | 1569 | else |
| 1567 | __push_back_slow_path(_VSTD::move(__x)); | |
| 1570 | __push_back_slow_path(std::move(__x)); | |
| 1568 | 1571 | } |
| 1569 | 1572 | |
| 1570 | 1573 | template <class _Tp, class _Allocator> |
| 1571 | 1574 | template <class... _Args> |
| 1572 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1575 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1573 | 1576 | void |
| 1574 | 1577 | vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) |
| 1575 | 1578 | { |
| 1576 | 1579 | allocator_type& __a = this->__alloc(); |
| 1577 | 1580 | __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a); |
| 1578 | // __v.emplace_back(_VSTD::forward<_Args>(__args)...); | |
| 1579 | __alloc_traits::construct(__a, _VSTD::__to_address(__v.__end_), _VSTD::forward<_Args>(__args)...); | |
| 1581 | // __v.emplace_back(std::forward<_Args>(__args)...); | |
| 1582 | __alloc_traits::construct(__a, std::__to_address(__v.__end_), std::forward<_Args>(__args)...); | |
| 1580 | 1583 | __v.__end_++; |
| 1581 | 1584 | __swap_out_circular_buffer(__v); |
| 1582 | 1585 | } |
| 1583 | 1586 | |
| 1584 | 1587 | template <class _Tp, class _Allocator> |
| 1585 | 1588 | template <class... _Args> |
| 1586 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1589 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1587 | 1590 | inline |
| 1588 | 1591 | #if _LIBCPP_STD_VER > 14 |
| 1589 | 1592 | typename vector<_Tp, _Allocator>::reference |
| ... | ... | @@ -1594,17 +1597,17 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) |
| 1594 | 1597 | { |
| 1595 | 1598 | if (this->__end_ < this->__end_cap()) |
| 1596 | 1599 | { |
| 1597 | __construct_one_at_end(_VSTD::forward<_Args>(__args)...); | |
| 1600 | __construct_one_at_end(std::forward<_Args>(__args)...); | |
| 1598 | 1601 | } |
| 1599 | 1602 | else |
| 1600 | __emplace_back_slow_path(_VSTD::forward<_Args>(__args)...); | |
| 1603 | __emplace_back_slow_path(std::forward<_Args>(__args)...); | |
| 1601 | 1604 | #if _LIBCPP_STD_VER > 14 |
| 1602 | 1605 | return this->back(); |
| 1603 | 1606 | #endif |
| 1604 | 1607 | } |
| 1605 | 1608 | |
| 1606 | 1609 | template <class _Tp, class _Allocator> |
| 1607 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1610 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1608 | 1611 | inline |
| 1609 | 1612 | void |
| 1610 | 1613 | vector<_Tp, _Allocator>::pop_back() |
| ... | ... | @@ -1614,47 +1617,45 @@ vector<_Tp, _Allocator>::pop_back() |
| 1614 | 1617 | } |
| 1615 | 1618 | |
| 1616 | 1619 | template <class _Tp, class _Allocator> |
| 1617 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1618 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1620 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1621 | inline _LIBCPP_HIDE_FROM_ABI | |
| 1619 | 1622 | typename vector<_Tp, _Allocator>::iterator |
| 1620 | 1623 | vector<_Tp, _Allocator>::erase(const_iterator __position) |
| 1621 | 1624 | { |
| 1622 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__position)) == this, | |
| 1625 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this, | |
| 1623 | 1626 | "vector::erase(iterator) called with an iterator not referring to this vector"); |
| 1624 | 1627 | _LIBCPP_ASSERT(__position != end(), |
| 1625 | 1628 | "vector::erase(iterator) called with a non-dereferenceable iterator"); |
| 1626 | 1629 | difference_type __ps = __position - cbegin(); |
| 1627 | 1630 | pointer __p = this->__begin_ + __ps; |
| 1628 | this->__destruct_at_end(_VSTD::move(__p + 1, this->__end_, __p)); | |
| 1631 | this->__destruct_at_end(std::move(__p + 1, this->__end_, __p)); | |
| 1629 | 1632 | if (!__libcpp_is_constant_evaluated()) |
| 1630 | 1633 | this->__invalidate_iterators_past(__p - 1); |
| 1631 | iterator __r = iterator(this, __p); | |
| 1632 | return __r; | |
| 1634 | return __make_iter(__p); | |
| 1633 | 1635 | } |
| 1634 | 1636 | |
| 1635 | 1637 | template <class _Tp, class _Allocator> |
| 1636 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1638 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1637 | 1639 | typename vector<_Tp, _Allocator>::iterator |
| 1638 | 1640 | vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) |
| 1639 | 1641 | { |
| 1640 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__first)) == this, | |
| 1642 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__first)) == this, | |
| 1641 | 1643 | "vector::erase(iterator, iterator) called with an iterator not referring to this vector"); |
| 1642 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__last)) == this, | |
| 1644 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__last)) == this, | |
| 1643 | 1645 | "vector::erase(iterator, iterator) called with an iterator not referring to this vector"); |
| 1644 | 1646 | |
| 1645 | 1647 | _LIBCPP_ASSERT(__first <= __last, "vector::erase(first, last) called with invalid range"); |
| 1646 | 1648 | pointer __p = this->__begin_ + (__first - begin()); |
| 1647 | 1649 | if (__first != __last) { |
| 1648 | this->__destruct_at_end(_VSTD::move(__p + (__last - __first), this->__end_, __p)); | |
| 1650 | this->__destruct_at_end(std::move(__p + (__last - __first), this->__end_, __p)); | |
| 1649 | 1651 | if (!__libcpp_is_constant_evaluated()) |
| 1650 | 1652 | this->__invalidate_iterators_past(__p - 1); |
| 1651 | 1653 | } |
| 1652 | iterator __r = iterator(this, __p); | |
| 1653 | return __r; | |
| 1654 | return __make_iter(__p); | |
| 1654 | 1655 | } |
| 1655 | 1656 | |
| 1656 | 1657 | template <class _Tp, class _Allocator> |
| 1657 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1658 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1658 | 1659 | void |
| 1659 | 1660 | vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to) |
| 1660 | 1661 | { |
| ... | ... | @@ -1666,19 +1667,19 @@ vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointe |
| 1666 | 1667 | for (pointer __pos = __tx.__pos_; __i < __from_e; |
| 1667 | 1668 | ++__i, (void) ++__pos, __tx.__pos_ = __pos) { |
| 1668 | 1669 | __alloc_traits::construct(this->__alloc(), |
| 1669 | _VSTD::__to_address(__pos), | |
| 1670 | _VSTD::move(*__i)); | |
| 1670 | std::__to_address(__pos), | |
| 1671 | std::move(*__i)); | |
| 1671 | 1672 | } |
| 1672 | 1673 | } |
| 1673 | _VSTD::move_backward(__from_s, __from_s + __n, __old_last); | |
| 1674 | std::move_backward(__from_s, __from_s + __n, __old_last); | |
| 1674 | 1675 | } |
| 1675 | 1676 | |
| 1676 | 1677 | template <class _Tp, class _Allocator> |
| 1677 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1678 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1678 | 1679 | typename vector<_Tp, _Allocator>::iterator |
| 1679 | 1680 | vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) |
| 1680 | 1681 | { |
| 1681 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__position)) == this, | |
| 1682 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this, | |
| 1682 | 1683 | "vector::insert(iterator, x) called with an iterator not referring to this vector"); |
| 1683 | 1684 | pointer __p = this->__begin_ + (__position - begin()); |
| 1684 | 1685 | // We can't compare unrelated pointers inside constant expressions |
| ... | ... | @@ -1704,77 +1705,77 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) |
| 1704 | 1705 | __v.push_back(__x); |
| 1705 | 1706 | __p = __swap_out_circular_buffer(__v, __p); |
| 1706 | 1707 | } |
| 1707 | return iterator(this, __p); | |
| 1708 | return __make_iter(__p); | |
| 1708 | 1709 | } |
| 1709 | 1710 | |
| 1710 | 1711 | template <class _Tp, class _Allocator> |
| 1711 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1712 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1712 | 1713 | typename vector<_Tp, _Allocator>::iterator |
| 1713 | 1714 | vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) |
| 1714 | 1715 | { |
| 1715 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__position)) == this, | |
| 1716 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this, | |
| 1716 | 1717 | "vector::insert(iterator, x) called with an iterator not referring to this vector"); |
| 1717 | 1718 | pointer __p = this->__begin_ + (__position - begin()); |
| 1718 | 1719 | if (this->__end_ < this->__end_cap()) |
| 1719 | 1720 | { |
| 1720 | 1721 | if (__p == this->__end_) |
| 1721 | 1722 | { |
| 1722 | __construct_one_at_end(_VSTD::move(__x)); | |
| 1723 | __construct_one_at_end(std::move(__x)); | |
| 1723 | 1724 | } |
| 1724 | 1725 | else |
| 1725 | 1726 | { |
| 1726 | 1727 | __move_range(__p, this->__end_, __p + 1); |
| 1727 | *__p = _VSTD::move(__x); | |
| 1728 | *__p = std::move(__x); | |
| 1728 | 1729 | } |
| 1729 | 1730 | } |
| 1730 | 1731 | else |
| 1731 | 1732 | { |
| 1732 | 1733 | allocator_type& __a = this->__alloc(); |
| 1733 | 1734 | __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a); |
| 1734 | __v.push_back(_VSTD::move(__x)); | |
| 1735 | __v.push_back(std::move(__x)); | |
| 1735 | 1736 | __p = __swap_out_circular_buffer(__v, __p); |
| 1736 | 1737 | } |
| 1737 | return iterator(this, __p); | |
| 1738 | return __make_iter(__p); | |
| 1738 | 1739 | } |
| 1739 | 1740 | |
| 1740 | 1741 | template <class _Tp, class _Allocator> |
| 1741 | 1742 | template <class... _Args> |
| 1742 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1743 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1743 | 1744 | typename vector<_Tp, _Allocator>::iterator |
| 1744 | 1745 | vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) |
| 1745 | 1746 | { |
| 1746 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__position)) == this, | |
| 1747 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this, | |
| 1747 | 1748 | "vector::emplace(iterator, x) called with an iterator not referring to this vector"); |
| 1748 | 1749 | pointer __p = this->__begin_ + (__position - begin()); |
| 1749 | 1750 | if (this->__end_ < this->__end_cap()) |
| 1750 | 1751 | { |
| 1751 | 1752 | if (__p == this->__end_) |
| 1752 | 1753 | { |
| 1753 | __construct_one_at_end(_VSTD::forward<_Args>(__args)...); | |
| 1754 | __construct_one_at_end(std::forward<_Args>(__args)...); | |
| 1754 | 1755 | } |
| 1755 | 1756 | else |
| 1756 | 1757 | { |
| 1757 | __temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); | |
| 1758 | __temp_value<value_type, _Allocator> __tmp(this->__alloc(), std::forward<_Args>(__args)...); | |
| 1758 | 1759 | __move_range(__p, this->__end_, __p + 1); |
| 1759 | *__p = _VSTD::move(__tmp.get()); | |
| 1760 | *__p = std::move(__tmp.get()); | |
| 1760 | 1761 | } |
| 1761 | 1762 | } |
| 1762 | 1763 | else |
| 1763 | 1764 | { |
| 1764 | 1765 | allocator_type& __a = this->__alloc(); |
| 1765 | 1766 | __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a); |
| 1766 | __v.emplace_back(_VSTD::forward<_Args>(__args)...); | |
| 1767 | __v.emplace_back(std::forward<_Args>(__args)...); | |
| 1767 | 1768 | __p = __swap_out_circular_buffer(__v, __p); |
| 1768 | 1769 | } |
| 1769 | return iterator(this, __p); | |
| 1770 | return __make_iter(__p); | |
| 1770 | 1771 | } |
| 1771 | 1772 | |
| 1772 | 1773 | template <class _Tp, class _Allocator> |
| 1773 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1774 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1774 | 1775 | typename vector<_Tp, _Allocator>::iterator |
| 1775 | 1776 | vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x) |
| 1776 | 1777 | { |
| 1777 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__position)) == this, | |
| 1778 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this, | |
| 1778 | 1779 | "vector::insert(iterator, n, x) called with an iterator not referring to this vector"); |
| 1779 | 1780 | pointer __p = this->__begin_ + (__position - begin()); |
| 1780 | 1781 | if (__n > 0) |
| ... | ... | @@ -1796,7 +1797,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_ |
| 1796 | 1797 | const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); |
| 1797 | 1798 | if (__p <= __xr && __xr < this->__end_) |
| 1798 | 1799 | __xr += __old_n; |
| 1799 | _VSTD::fill_n(__p, __n, *__xr); | |
| 1800 | std::fill_n(__p, __n, *__xr); | |
| 1800 | 1801 | } |
| 1801 | 1802 | } |
| 1802 | 1803 | else |
| ... | ... | @@ -1807,20 +1808,17 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_ |
| 1807 | 1808 | __p = __swap_out_circular_buffer(__v, __p); |
| 1808 | 1809 | } |
| 1809 | 1810 | } |
| 1810 | return iterator(this, __p); | |
| 1811 | return __make_iter(__p); | |
| 1811 | 1812 | } |
| 1812 | 1813 | |
| 1813 | 1814 | template <class _Tp, class _Allocator> |
| 1814 | template <class _InputIterator> | |
| 1815 | _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if <__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 1816 | is_constructible< | |
| 1817 | _Tp, | |
| 1818 | typename iterator_traits<_InputIterator>::reference>::value, | |
| 1819 | typename vector<_Tp, _Allocator>::iterator | |
| 1820 | >::type | |
| 1815 | template <class _InputIterator, __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value && | |
| 1816 | is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value, | |
| 1817 | int> > | |
| 1818 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator | |
| 1821 | 1819 | vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last) |
| 1822 | 1820 | { |
| 1823 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__position)) == this, | |
| 1821 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this, | |
| 1824 | 1822 | "vector::insert(iterator, range) called with an iterator not referring to this vector"); |
| 1825 | 1823 | difference_type __off = __position - begin(); |
| 1826 | 1824 | pointer __p = this->__begin_ + __off; |
| ... | ... | @@ -1847,34 +1845,28 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __firs |
| 1847 | 1845 | } |
| 1848 | 1846 | catch (...) |
| 1849 | 1847 | { |
| 1850 | erase(iterator(this, __old_last), end()); | |
| 1848 | erase(__make_iter(__old_last), end()); | |
| 1851 | 1849 | throw; |
| 1852 | 1850 | } |
| 1853 | 1851 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 1854 | 1852 | } |
| 1855 | __p = _VSTD::rotate(__p, __old_last, this->__end_); | |
| 1856 | insert(iterator(this, __p), _VSTD::make_move_iterator(__v.begin()), | |
| 1857 | _VSTD::make_move_iterator(__v.end())); | |
| 1853 | __p = std::rotate(__p, __old_last, this->__end_); | |
| 1854 | insert(__make_iter(__p), std::make_move_iterator(__v.begin()), | |
| 1855 | std::make_move_iterator(__v.end())); | |
| 1858 | 1856 | return begin() + __off; |
| 1859 | 1857 | } |
| 1860 | 1858 | |
| 1861 | 1859 | template <class _Tp, class _Allocator> |
| 1862 | template <class _ForwardIterator> | |
| 1863 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1864 | typename enable_if | |
| 1865 | < | |
| 1866 | __is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1867 | is_constructible< | |
| 1868 | _Tp, | |
| 1869 | typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 1870 | typename vector<_Tp, _Allocator>::iterator | |
| 1871 | >::type | |
| 1860 | template <class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1861 | is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value, | |
| 1862 | int> > | |
| 1863 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator | |
| 1872 | 1864 | vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last) |
| 1873 | 1865 | { |
| 1874 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__position)) == this, | |
| 1866 | _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this, | |
| 1875 | 1867 | "vector::insert(iterator, range) called with an iterator not referring to this vector"); |
| 1876 | 1868 | pointer __p = this->__begin_ + (__position - begin()); |
| 1877 | difference_type __n = _VSTD::distance(__first, __last); | |
| 1869 | difference_type __n = std::distance(__first, __last); | |
| 1878 | 1870 | if (__n > 0) |
| 1879 | 1871 | { |
| 1880 | 1872 | if (__n <= this->__end_cap() - this->__end_) |
| ... | ... | @@ -1887,14 +1879,14 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi |
| 1887 | 1879 | { |
| 1888 | 1880 | __m = __first; |
| 1889 | 1881 | difference_type __diff = this->__end_ - __p; |
| 1890 | _VSTD::advance(__m, __diff); | |
| 1882 | std::advance(__m, __diff); | |
| 1891 | 1883 | __construct_at_end(__m, __last, __n - __diff); |
| 1892 | 1884 | __n = __dx; |
| 1893 | 1885 | } |
| 1894 | 1886 | if (__n > 0) |
| 1895 | 1887 | { |
| 1896 | 1888 | __move_range(__p, __old_last, __p + __old_n); |
| 1897 | _VSTD::copy(__first, __m, __p); | |
| 1889 | std::copy(__first, __m, __p); | |
| 1898 | 1890 | } |
| 1899 | 1891 | } |
| 1900 | 1892 | else |
| ... | ... | @@ -1905,11 +1897,11 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi |
| 1905 | 1897 | __p = __swap_out_circular_buffer(__v, __p); |
| 1906 | 1898 | } |
| 1907 | 1899 | } |
| 1908 | return iterator(this, __p); | |
| 1900 | return __make_iter(__p); | |
| 1909 | 1901 | } |
| 1910 | 1902 | |
| 1911 | 1903 | template <class _Tp, class _Allocator> |
| 1912 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1904 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1913 | 1905 | void |
| 1914 | 1906 | vector<_Tp, _Allocator>::resize(size_type __sz) |
| 1915 | 1907 | { |
| ... | ... | @@ -1921,7 +1913,7 @@ vector<_Tp, _Allocator>::resize(size_type __sz) |
| 1921 | 1913 | } |
| 1922 | 1914 | |
| 1923 | 1915 | template <class _Tp, class _Allocator> |
| 1924 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1916 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1925 | 1917 | void |
| 1926 | 1918 | vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x) |
| 1927 | 1919 | { |
| ... | ... | @@ -1933,7 +1925,7 @@ vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x) |
| 1933 | 1925 | } |
| 1934 | 1926 | |
| 1935 | 1927 | template <class _Tp, class _Allocator> |
| 1936 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1928 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1937 | 1929 | void |
| 1938 | 1930 | vector<_Tp, _Allocator>::swap(vector& __x) |
| 1939 | 1931 | #if _LIBCPP_STD_VER >= 14 |
| ... | ... | @@ -1947,16 +1939,16 @@ vector<_Tp, _Allocator>::swap(vector& __x) |
| 1947 | 1939 | this->__alloc() == __x.__alloc(), |
| 1948 | 1940 | "vector::swap: Either propagate_on_container_swap must be true" |
| 1949 | 1941 | " or the allocators must compare equal"); |
| 1950 | _VSTD::swap(this->__begin_, __x.__begin_); | |
| 1951 | _VSTD::swap(this->__end_, __x.__end_); | |
| 1952 | _VSTD::swap(this->__end_cap(), __x.__end_cap()); | |
| 1953 | _VSTD::__swap_allocator(this->__alloc(), __x.__alloc(), | |
| 1942 | std::swap(this->__begin_, __x.__begin_); | |
| 1943 | std::swap(this->__end_, __x.__end_); | |
| 1944 | std::swap(this->__end_cap(), __x.__end_cap()); | |
| 1945 | std::__swap_allocator(this->__alloc(), __x.__alloc(), | |
| 1954 | 1946 | integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>()); |
| 1955 | 1947 | std::__debug_db_swap(this, std::addressof(__x)); |
| 1956 | 1948 | } |
| 1957 | 1949 | |
| 1958 | 1950 | template <class _Tp, class _Allocator> |
| 1959 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1951 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 1960 | 1952 | bool |
| 1961 | 1953 | vector<_Tp, _Allocator>::__invariants() const |
| 1962 | 1954 | { |
| ... | ... | @@ -2012,7 +2004,7 @@ vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __ |
| 2012 | 2004 | #endif // _LIBCPP_ENABLE_DEBUG_MODE |
| 2013 | 2005 | |
| 2014 | 2006 | template <class _Tp, class _Allocator> |
| 2015 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2007 | inline _LIBCPP_HIDE_FROM_ABI | |
| 2016 | 2008 | void |
| 2017 | 2009 | vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) { |
| 2018 | 2010 | #ifdef _LIBCPP_ENABLE_DEBUG_MODE |
| ... | ... | @@ -2023,7 +2015,7 @@ vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) { |
| 2023 | 2015 | if (__i->base() > __new_last) { |
| 2024 | 2016 | (*__p)->__c_ = nullptr; |
| 2025 | 2017 | if (--__c->end_ != __p) |
| 2026 | _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 2018 | std::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 2027 | 2019 | } |
| 2028 | 2020 | } |
| 2029 | 2021 | __get_db()->unlock(); |
| ... | ... | @@ -2059,11 +2051,11 @@ public: |
| 2059 | 2051 | typedef __bit_iterator<vector, true> const_pointer; |
| 2060 | 2052 | typedef pointer iterator; |
| 2061 | 2053 | typedef const_pointer const_iterator; |
| 2062 | typedef _VSTD::reverse_iterator<iterator> reverse_iterator; | |
| 2063 | typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; | |
| 2054 | typedef std::reverse_iterator<iterator> reverse_iterator; | |
| 2055 | typedef std::reverse_iterator<const_iterator> const_reverse_iterator; | |
| 2064 | 2056 | |
| 2065 | 2057 | private: |
| 2066 | typedef typename __rebind_alloc_helper<__alloc_traits, __storage_type>::type __storage_allocator; | |
| 2058 | typedef __rebind_alloc<__alloc_traits, __storage_type> __storage_allocator; | |
| 2067 | 2059 | typedef allocator_traits<__storage_allocator> __storage_traits; |
| 2068 | 2060 | typedef typename __storage_traits::pointer __storage_pointer; |
| 2069 | 2061 | typedef typename __storage_traits::const_pointer __const_storage_pointer; |
| ... | ... | @@ -2079,81 +2071,99 @@ public: |
| 2079 | 2071 | typedef __bit_const_reference<vector> const_reference; |
| 2080 | 2072 | #endif |
| 2081 | 2073 | private: |
| 2082 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2074 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2083 | 2075 | size_type& __cap() _NOEXCEPT |
| 2084 | 2076 | {return __cap_alloc_.first();} |
| 2085 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2077 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2086 | 2078 | const size_type& __cap() const _NOEXCEPT |
| 2087 | 2079 | {return __cap_alloc_.first();} |
| 2088 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2080 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2089 | 2081 | __storage_allocator& __alloc() _NOEXCEPT |
| 2090 | 2082 | {return __cap_alloc_.second();} |
| 2091 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2083 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2092 | 2084 | const __storage_allocator& __alloc() const _NOEXCEPT |
| 2093 | 2085 | {return __cap_alloc_.second();} |
| 2094 | 2086 | |
| 2095 | 2087 | static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); |
| 2096 | 2088 | |
| 2097 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2089 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2098 | 2090 | static size_type __internal_cap_to_external(size_type __n) _NOEXCEPT |
| 2099 | 2091 | {return __n * __bits_per_word;} |
| 2100 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2092 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2101 | 2093 | static size_type __external_cap_to_internal(size_type __n) _NOEXCEPT |
| 2102 | 2094 | {return (__n - 1) / __bits_per_word + 1;} |
| 2103 | 2095 | |
| 2104 | 2096 | public: |
| 2105 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2097 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2106 | 2098 | vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value); |
| 2107 | 2099 | |
| 2108 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit vector(const allocator_type& __a) | |
| 2100 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(const allocator_type& __a) | |
| 2109 | 2101 | #if _LIBCPP_STD_VER <= 14 |
| 2110 | 2102 | _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value); |
| 2111 | 2103 | #else |
| 2112 | 2104 | _NOEXCEPT; |
| 2113 | 2105 | #endif |
| 2114 | _LIBCPP_CONSTEXPR_AFTER_CXX17 ~vector(); | |
| 2115 | _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit vector(size_type __n); | |
| 2106 | ||
| 2107 | private: | |
| 2108 | class __destroy_vector { | |
| 2109 | public: | |
| 2110 | _LIBCPP_CONSTEXPR __destroy_vector(vector& __vec) : __vec_(__vec) {} | |
| 2111 | ||
| 2112 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() { | |
| 2113 | if (__vec_.__begin_ != nullptr) | |
| 2114 | __storage_traits::deallocate(__vec_.__alloc(), __vec_.__begin_, __vec_.__cap()); | |
| 2115 | std::__debug_db_invalidate_all(this); | |
| 2116 | } | |
| 2117 | ||
| 2118 | private: | |
| 2119 | vector& __vec_; | |
| 2120 | }; | |
| 2121 | ||
| 2122 | public: | |
| 2123 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~vector() { __destroy_vector(*this)(); } | |
| 2124 | ||
| 2125 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n); | |
| 2116 | 2126 | #if _LIBCPP_STD_VER > 11 |
| 2117 | _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit vector(size_type __n, const allocator_type& __a); | |
| 2127 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n, const allocator_type& __a); | |
| 2118 | 2128 | #endif |
| 2119 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(size_type __n, const value_type& __v); | |
| 2120 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(size_type __n, const value_type& __v, const allocator_type& __a); | |
| 2129 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v); | |
| 2130 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v, const allocator_type& __a); | |
| 2121 | 2131 | template <class _InputIterator> |
| 2122 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(_InputIterator __first, _InputIterator __last, | |
| 2132 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_InputIterator __first, _InputIterator __last, | |
| 2123 | 2133 | typename enable_if<__is_exactly_cpp17_input_iterator<_InputIterator>::value>::type* = 0); |
| 2124 | 2134 | template <class _InputIterator> |
| 2125 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, | |
| 2135 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, | |
| 2126 | 2136 | typename enable_if<__is_exactly_cpp17_input_iterator<_InputIterator>::value>::type* = 0); |
| 2127 | 2137 | template <class _ForwardIterator> |
| 2128 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(_ForwardIterator __first, _ForwardIterator __last, | |
| 2138 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_ForwardIterator __first, _ForwardIterator __last, | |
| 2129 | 2139 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type* = 0); |
| 2130 | 2140 | template <class _ForwardIterator> |
| 2131 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, | |
| 2141 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, | |
| 2132 | 2142 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type* = 0); |
| 2133 | 2143 | |
| 2134 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(const vector& __v); | |
| 2135 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(const vector& __v, const allocator_type& __a); | |
| 2136 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector& operator=(const vector& __v); | |
| 2144 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(const vector& __v); | |
| 2145 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(const vector& __v, const allocator_type& __a); | |
| 2146 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector& operator=(const vector& __v); | |
| 2137 | 2147 | |
| 2138 | 2148 | #ifndef _LIBCPP_CXX03_LANG |
| 2139 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(initializer_list<value_type> __il); | |
| 2140 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(initializer_list<value_type> __il, const allocator_type& __a); | |
| 2149 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(initializer_list<value_type> __il); | |
| 2150 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(initializer_list<value_type> __il, const allocator_type& __a); | |
| 2141 | 2151 | |
| 2142 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2152 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2143 | 2153 | vector& operator=(initializer_list<value_type> __il) |
| 2144 | 2154 | {assign(__il.begin(), __il.end()); return *this;} |
| 2145 | 2155 | |
| 2146 | 2156 | #endif // !_LIBCPP_CXX03_LANG |
| 2147 | 2157 | |
| 2148 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2158 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2149 | 2159 | vector(vector&& __v) |
| 2150 | 2160 | #if _LIBCPP_STD_VER > 14 |
| 2151 | 2161 | noexcept; |
| 2152 | 2162 | #else |
| 2153 | 2163 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); |
| 2154 | 2164 | #endif |
| 2155 | _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(vector&& __v, const __type_identity_t<allocator_type>& __a); | |
| 2156 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2165 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(vector&& __v, const __type_identity_t<allocator_type>& __a); | |
| 2166 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2157 | 2167 | vector& operator=(vector&& __v) |
| 2158 | 2168 | _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); |
| 2159 | 2169 | |
| ... | ... | @@ -2161,162 +2171,162 @@ public: |
| 2161 | 2171 | typename enable_if <__is_exactly_cpp17_input_iterator<_InputIterator>::value, |
| 2162 | 2172 | void |
| 2163 | 2173 | >::type |
| 2164 | _LIBCPP_CONSTEXPR_AFTER_CXX17 assign(_InputIterator __first, _InputIterator __last); | |
| 2174 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 assign(_InputIterator __first, _InputIterator __last); | |
| 2165 | 2175 | template <class _ForwardIterator> |
| 2166 | 2176 | typename enable_if |
| 2167 | 2177 | < |
| 2168 | 2178 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| 2169 | 2179 | void |
| 2170 | 2180 | >::type |
| 2171 | _LIBCPP_CONSTEXPR_AFTER_CXX17 assign(_ForwardIterator __first, _ForwardIterator __last); | |
| 2181 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 assign(_ForwardIterator __first, _ForwardIterator __last); | |
| 2172 | 2182 | |
| 2173 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void assign(size_type __n, const value_type& __x); | |
| 2183 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void assign(size_type __n, const value_type& __x); | |
| 2174 | 2184 | |
| 2175 | 2185 | #ifndef _LIBCPP_CXX03_LANG |
| 2176 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2186 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2177 | 2187 | void assign(initializer_list<value_type> __il) |
| 2178 | 2188 | {assign(__il.begin(), __il.end());} |
| 2179 | 2189 | #endif |
| 2180 | 2190 | |
| 2181 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 allocator_type get_allocator() const _NOEXCEPT | |
| 2191 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT | |
| 2182 | 2192 | {return allocator_type(this->__alloc());} |
| 2183 | 2193 | |
| 2184 | _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type max_size() const _NOEXCEPT; | |
| 2185 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2194 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT; | |
| 2195 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2186 | 2196 | size_type capacity() const _NOEXCEPT |
| 2187 | 2197 | {return __internal_cap_to_external(__cap());} |
| 2188 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2198 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2189 | 2199 | size_type size() const _NOEXCEPT |
| 2190 | 2200 | {return __size_;} |
| 2191 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2201 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2192 | 2202 | bool empty() const _NOEXCEPT |
| 2193 | 2203 | {return __size_ == 0;} |
| 2194 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void reserve(size_type __n); | |
| 2195 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void shrink_to_fit() _NOEXCEPT; | |
| 2204 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __n); | |
| 2205 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT; | |
| 2196 | 2206 | |
| 2197 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2207 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2198 | 2208 | iterator begin() _NOEXCEPT |
| 2199 | 2209 | {return __make_iter(0);} |
| 2200 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2210 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2201 | 2211 | const_iterator begin() const _NOEXCEPT |
| 2202 | 2212 | {return __make_iter(0);} |
| 2203 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2213 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2204 | 2214 | iterator end() _NOEXCEPT |
| 2205 | 2215 | {return __make_iter(__size_);} |
| 2206 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2216 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2207 | 2217 | const_iterator end() const _NOEXCEPT |
| 2208 | 2218 | {return __make_iter(__size_);} |
| 2209 | 2219 | |
| 2210 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2220 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2211 | 2221 | reverse_iterator rbegin() _NOEXCEPT |
| 2212 | 2222 | {return reverse_iterator(end());} |
| 2213 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2223 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2214 | 2224 | const_reverse_iterator rbegin() const _NOEXCEPT |
| 2215 | 2225 | {return const_reverse_iterator(end());} |
| 2216 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2226 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2217 | 2227 | reverse_iterator rend() _NOEXCEPT |
| 2218 | 2228 | {return reverse_iterator(begin());} |
| 2219 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2229 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2220 | 2230 | const_reverse_iterator rend() const _NOEXCEPT |
| 2221 | 2231 | {return const_reverse_iterator(begin());} |
| 2222 | 2232 | |
| 2223 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2233 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2224 | 2234 | const_iterator cbegin() const _NOEXCEPT |
| 2225 | 2235 | {return __make_iter(0);} |
| 2226 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2236 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2227 | 2237 | const_iterator cend() const _NOEXCEPT |
| 2228 | 2238 | {return __make_iter(__size_);} |
| 2229 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2239 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2230 | 2240 | const_reverse_iterator crbegin() const _NOEXCEPT |
| 2231 | 2241 | {return rbegin();} |
| 2232 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2242 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2233 | 2243 | const_reverse_iterator crend() const _NOEXCEPT |
| 2234 | 2244 | {return rend();} |
| 2235 | 2245 | |
| 2236 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 reference operator[](size_type __n) {return __make_ref(__n);} | |
| 2237 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference operator[](size_type __n) const {return __make_ref(__n);} | |
| 2238 | reference at(size_type __n); | |
| 2239 | const_reference at(size_type __n) const; | |
| 2246 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](size_type __n) {return __make_ref(__n);} | |
| 2247 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __n) const {return __make_ref(__n);} | |
| 2248 | _LIBCPP_HIDE_FROM_ABI reference at(size_type __n); | |
| 2249 | _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const; | |
| 2240 | 2250 | |
| 2241 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 reference front() {return __make_ref(0);} | |
| 2242 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference front() const {return __make_ref(0);} | |
| 2243 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 reference back() {return __make_ref(__size_ - 1);} | |
| 2244 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference back() const {return __make_ref(__size_ - 1);} | |
| 2251 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() {return __make_ref(0);} | |
| 2252 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const {return __make_ref(0);} | |
| 2253 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() {return __make_ref(__size_ - 1);} | |
| 2254 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const {return __make_ref(__size_ - 1);} | |
| 2245 | 2255 | |
| 2246 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void push_back(const value_type& __x); | |
| 2256 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(const value_type& __x); | |
| 2247 | 2257 | #if _LIBCPP_STD_VER > 11 |
| 2248 | 2258 | template <class... _Args> |
| 2249 | 2259 | #if _LIBCPP_STD_VER > 14 |
| 2250 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 reference emplace_back(_Args&&... __args) | |
| 2260 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference emplace_back(_Args&&... __args) | |
| 2251 | 2261 | #else |
| 2252 | _LIBCPP_INLINE_VISIBILITY void emplace_back(_Args&&... __args) | |
| 2262 | _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args) | |
| 2253 | 2263 | #endif |
| 2254 | 2264 | { |
| 2255 | push_back ( value_type ( _VSTD::forward<_Args>(__args)... )); | |
| 2265 | push_back ( value_type ( std::forward<_Args>(__args)... )); | |
| 2256 | 2266 | #if _LIBCPP_STD_VER > 14 |
| 2257 | 2267 | return this->back(); |
| 2258 | 2268 | #endif |
| 2259 | 2269 | } |
| 2260 | 2270 | #endif |
| 2261 | 2271 | |
| 2262 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void pop_back() {--__size_;} | |
| 2272 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back() {--__size_;} | |
| 2263 | 2273 | |
| 2264 | 2274 | #if _LIBCPP_STD_VER > 11 |
| 2265 | 2275 | template <class... _Args> |
| 2266 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator emplace(const_iterator __position, _Args&&... __args) | |
| 2267 | { return insert ( __position, value_type ( _VSTD::forward<_Args>(__args)... )); } | |
| 2276 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator emplace(const_iterator __position, _Args&&... __args) | |
| 2277 | { return insert ( __position, value_type ( std::forward<_Args>(__args)... )); } | |
| 2268 | 2278 | #endif |
| 2269 | 2279 | |
| 2270 | _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator insert(const_iterator __position, const value_type& __x); | |
| 2271 | _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator insert(const_iterator __position, size_type __n, const value_type& __x); | |
| 2280 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __position, const value_type& __x); | |
| 2281 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __position, size_type __n, const value_type& __x); | |
| 2272 | 2282 | template <class _InputIterator> |
| 2273 | 2283 | typename enable_if <__is_exactly_cpp17_input_iterator<_InputIterator>::value, |
| 2274 | 2284 | iterator |
| 2275 | 2285 | >::type |
| 2276 | _LIBCPP_CONSTEXPR_AFTER_CXX17 insert(const_iterator __position, _InputIterator __first, _InputIterator __last); | |
| 2286 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert(const_iterator __position, _InputIterator __first, _InputIterator __last); | |
| 2277 | 2287 | template <class _ForwardIterator> |
| 2278 | 2288 | typename enable_if |
| 2279 | 2289 | < |
| 2280 | 2290 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| 2281 | 2291 | iterator |
| 2282 | 2292 | >::type |
| 2283 | _LIBCPP_CONSTEXPR_AFTER_CXX17 insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); | |
| 2293 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); | |
| 2284 | 2294 | |
| 2285 | 2295 | #ifndef _LIBCPP_CXX03_LANG |
| 2286 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2296 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2287 | 2297 | iterator insert(const_iterator __position, initializer_list<value_type> __il) |
| 2288 | 2298 | {return insert(__position, __il.begin(), __il.end());} |
| 2289 | 2299 | #endif |
| 2290 | 2300 | |
| 2291 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator erase(const_iterator __position); | |
| 2292 | _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator erase(const_iterator __first, const_iterator __last); | |
| 2301 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __position); | |
| 2302 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __first, const_iterator __last); | |
| 2293 | 2303 | |
| 2294 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2304 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2295 | 2305 | void clear() _NOEXCEPT {__size_ = 0;} |
| 2296 | 2306 | |
| 2297 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(vector&) | |
| 2307 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(vector&) | |
| 2298 | 2308 | #if _LIBCPP_STD_VER >= 14 |
| 2299 | 2309 | _NOEXCEPT; |
| 2300 | 2310 | #else |
| 2301 | 2311 | _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || |
| 2302 | 2312 | __is_nothrow_swappable<allocator_type>::value); |
| 2303 | 2313 | #endif |
| 2304 | _LIBCPP_CONSTEXPR_AFTER_CXX17 static void swap(reference __x, reference __y) _NOEXCEPT { _VSTD::swap(__x, __y); } | |
| 2314 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void swap(reference __x, reference __y) _NOEXCEPT { std::swap(__x, __y); } | |
| 2305 | 2315 | |
| 2306 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void resize(size_type __sz, value_type __x = false); | |
| 2307 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void flip() _NOEXCEPT; | |
| 2316 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __sz, value_type __x = false); | |
| 2317 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void flip() _NOEXCEPT; | |
| 2308 | 2318 | |
| 2309 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __invariants() const; | |
| 2319 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const; | |
| 2310 | 2320 | |
| 2311 | 2321 | private: |
| 2312 | 2322 | _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI |
| 2313 | 2323 | void __throw_length_error() const { |
| 2314 | _VSTD::__throw_length_error("vector"); | |
| 2324 | std::__throw_length_error("vector"); | |
| 2315 | 2325 | } |
| 2316 | 2326 | |
| 2317 | 2327 | _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI |
| 2318 | 2328 | void __throw_out_of_range() const { |
| 2319 | _VSTD::__throw_out_of_range("vector"); | |
| 2329 | std::__throw_out_of_range("vector"); | |
| 2320 | 2330 | } |
| 2321 | 2331 | |
| 2322 | 2332 | // Allocate space for __n objects |
| ... | ... | @@ -2326,7 +2336,7 @@ private: |
| 2326 | 2336 | // Precondition: __n > 0 |
| 2327 | 2337 | // Postcondition: capacity() >= __n |
| 2328 | 2338 | // Postcondition: size() == 0 |
| 2329 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __vallocate(size_type __n) { | |
| 2339 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vallocate(size_type __n) { | |
| 2330 | 2340 | if (__n > max_size()) |
| 2331 | 2341 | __throw_length_error(); |
| 2332 | 2342 | auto __allocation = std::__allocate_at_least(__alloc(), __external_cap_to_internal(__n)); |
| ... | ... | @@ -2339,43 +2349,43 @@ private: |
| 2339 | 2349 | } |
| 2340 | 2350 | } |
| 2341 | 2351 | |
| 2342 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __vdeallocate() _NOEXCEPT; | |
| 2343 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2352 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vdeallocate() _NOEXCEPT; | |
| 2353 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2344 | 2354 | static size_type __align_it(size_type __new_size) _NOEXCEPT |
| 2345 | 2355 | {return (__new_size + (__bits_per_word-1)) & ~((size_type)__bits_per_word-1);} |
| 2346 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type __recommend(size_type __new_size) const; | |
| 2347 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct_at_end(size_type __n, bool __x); | |
| 2356 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __new_size) const; | |
| 2357 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_at_end(size_type __n, bool __x); | |
| 2348 | 2358 | template <class _ForwardIterator> |
| 2349 | 2359 | typename enable_if |
| 2350 | 2360 | < |
| 2351 | 2361 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| 2352 | 2362 | void |
| 2353 | 2363 | >::type |
| 2354 | _LIBCPP_CONSTEXPR_AFTER_CXX17 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); | |
| 2355 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __append(size_type __n, const_reference __x); | |
| 2356 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2364 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); | |
| 2365 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __append(size_type __n, const_reference __x); | |
| 2366 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2357 | 2367 | reference __make_ref(size_type __pos) _NOEXCEPT |
| 2358 | 2368 | {return reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} |
| 2359 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2369 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2360 | 2370 | const_reference __make_ref(size_type __pos) const _NOEXCEPT { |
| 2361 | 2371 | return __bit_const_reference<vector>(__begin_ + __pos / __bits_per_word, |
| 2362 | 2372 | __storage_type(1) << __pos % __bits_per_word); |
| 2363 | 2373 | } |
| 2364 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2374 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2365 | 2375 | iterator __make_iter(size_type __pos) _NOEXCEPT |
| 2366 | 2376 | {return iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));} |
| 2367 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2377 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2368 | 2378 | const_iterator __make_iter(size_type __pos) const _NOEXCEPT |
| 2369 | 2379 | {return const_iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));} |
| 2370 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2380 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2371 | 2381 | iterator __const_iterator_cast(const_iterator __p) _NOEXCEPT |
| 2372 | 2382 | {return begin() + (__p - cbegin());} |
| 2373 | 2383 | |
| 2374 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2384 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2375 | 2385 | void __copy_assign_alloc(const vector& __v) |
| 2376 | 2386 | {__copy_assign_alloc(__v, integral_constant<bool, |
| 2377 | 2387 | __storage_traits::propagate_on_container_copy_assignment::value>());} |
| 2378 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2388 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2379 | 2389 | void __copy_assign_alloc(const vector& __c, true_type) |
| 2380 | 2390 | { |
| 2381 | 2391 | if (__alloc() != __c.__alloc()) |
| ... | ... | @@ -2383,33 +2393,33 @@ private: |
| 2383 | 2393 | __alloc() = __c.__alloc(); |
| 2384 | 2394 | } |
| 2385 | 2395 | |
| 2386 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2396 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2387 | 2397 | void __copy_assign_alloc(const vector&, false_type) |
| 2388 | 2398 | {} |
| 2389 | 2399 | |
| 2390 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __move_assign(vector& __c, false_type); | |
| 2391 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void __move_assign(vector& __c, true_type) | |
| 2400 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(vector& __c, false_type); | |
| 2401 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(vector& __c, true_type) | |
| 2392 | 2402 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value); |
| 2393 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2403 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2394 | 2404 | void __move_assign_alloc(vector& __c) |
| 2395 | 2405 | _NOEXCEPT_( |
| 2396 | 2406 | !__storage_traits::propagate_on_container_move_assignment::value || |
| 2397 | 2407 | is_nothrow_move_assignable<allocator_type>::value) |
| 2398 | 2408 | {__move_assign_alloc(__c, integral_constant<bool, |
| 2399 | 2409 | __storage_traits::propagate_on_container_move_assignment::value>());} |
| 2400 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2410 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2401 | 2411 | void __move_assign_alloc(vector& __c, true_type) |
| 2402 | 2412 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) |
| 2403 | 2413 | { |
| 2404 | __alloc() = _VSTD::move(__c.__alloc()); | |
| 2414 | __alloc() = std::move(__c.__alloc()); | |
| 2405 | 2415 | } |
| 2406 | 2416 | |
| 2407 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2417 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2408 | 2418 | void __move_assign_alloc(vector&, false_type) |
| 2409 | 2419 | _NOEXCEPT |
| 2410 | 2420 | {} |
| 2411 | 2421 | |
| 2412 | _LIBCPP_CONSTEXPR_AFTER_CXX17 size_t __hash_code() const _NOEXCEPT; | |
| 2422 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_t __hash_code() const _NOEXCEPT; | |
| 2413 | 2423 | |
| 2414 | 2424 | friend class __bit_reference<vector>; |
| 2415 | 2425 | friend class __bit_const_reference<vector>; |
| ... | ... | @@ -2420,7 +2430,7 @@ private: |
| 2420 | 2430 | }; |
| 2421 | 2431 | |
| 2422 | 2432 | template <class _Allocator> |
| 2423 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 2433 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 2424 | 2434 | vector<bool, _Allocator>::__vdeallocate() _NOEXCEPT |
| 2425 | 2435 | { |
| 2426 | 2436 | if (this->__begin_ != nullptr) |
| ... | ... | @@ -2433,7 +2443,7 @@ vector<bool, _Allocator>::__vdeallocate() _NOEXCEPT |
| 2433 | 2443 | } |
| 2434 | 2444 | |
| 2435 | 2445 | template <class _Allocator> |
| 2436 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2446 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2437 | 2447 | typename vector<bool, _Allocator>::size_type |
| 2438 | 2448 | vector<bool, _Allocator>::max_size() const _NOEXCEPT |
| 2439 | 2449 | { |
| ... | ... | @@ -2446,7 +2456,7 @@ vector<bool, _Allocator>::max_size() const _NOEXCEPT |
| 2446 | 2456 | |
| 2447 | 2457 | // Precondition: __new_size > capacity() |
| 2448 | 2458 | template <class _Allocator> |
| 2449 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2459 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2450 | 2460 | typename vector<bool, _Allocator>::size_type |
| 2451 | 2461 | vector<bool, _Allocator>::__recommend(size_type __new_size) const |
| 2452 | 2462 | { |
| ... | ... | @@ -2456,7 +2466,7 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const |
| 2456 | 2466 | const size_type __cap = capacity(); |
| 2457 | 2467 | if (__cap >= __ms / 2) |
| 2458 | 2468 | return __ms; |
| 2459 | return _VSTD::max(2 * __cap, __align_it(__new_size)); | |
| 2469 | return std::max(2 * __cap, __align_it(__new_size)); | |
| 2460 | 2470 | } |
| 2461 | 2471 | |
| 2462 | 2472 | // Default constructs __n objects starting at __end_ |
| ... | ... | @@ -2464,7 +2474,7 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const |
| 2464 | 2474 | // Precondition: size() + __n <= capacity() |
| 2465 | 2475 | // Postcondition: size() == size() + __n |
| 2466 | 2476 | template <class _Allocator> |
| 2467 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2477 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2468 | 2478 | void |
| 2469 | 2479 | vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x) |
| 2470 | 2480 | { |
| ... | ... | @@ -2477,12 +2487,12 @@ vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x) |
| 2477 | 2487 | else |
| 2478 | 2488 | this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0); |
| 2479 | 2489 | } |
| 2480 | _VSTD::fill_n(__make_iter(__old_size), __n, __x); | |
| 2490 | std::fill_n(__make_iter(__old_size), __n, __x); | |
| 2481 | 2491 | } |
| 2482 | 2492 | |
| 2483 | 2493 | template <class _Allocator> |
| 2484 | 2494 | template <class _ForwardIterator> |
| 2485 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2495 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2486 | 2496 | typename enable_if |
| 2487 | 2497 | < |
| 2488 | 2498 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| ... | ... | @@ -2491,7 +2501,7 @@ typename enable_if |
| 2491 | 2501 | vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) |
| 2492 | 2502 | { |
| 2493 | 2503 | size_type __old_size = this->__size_; |
| 2494 | this->__size_ += _VSTD::distance(__first, __last); | |
| 2504 | this->__size_ += std::distance(__first, __last); | |
| 2495 | 2505 | if (__old_size == 0 || ((__old_size - 1) / __bits_per_word) != ((this->__size_ - 1) / __bits_per_word)) |
| 2496 | 2506 | { |
| 2497 | 2507 | if (this->__size_ <= __bits_per_word) |
| ... | ... | @@ -2499,11 +2509,11 @@ vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardI |
| 2499 | 2509 | else |
| 2500 | 2510 | this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0); |
| 2501 | 2511 | } |
| 2502 | _VSTD::copy(__first, __last, __make_iter(__old_size)); | |
| 2512 | std::copy(__first, __last, __make_iter(__old_size)); | |
| 2503 | 2513 | } |
| 2504 | 2514 | |
| 2505 | 2515 | template <class _Allocator> |
| 2506 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2516 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2507 | 2517 | vector<bool, _Allocator>::vector() |
| 2508 | 2518 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| 2509 | 2519 | : __begin_(nullptr), |
| ... | ... | @@ -2513,7 +2523,7 @@ vector<bool, _Allocator>::vector() |
| 2513 | 2523 | } |
| 2514 | 2524 | |
| 2515 | 2525 | template <class _Allocator> |
| 2516 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2526 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2517 | 2527 | vector<bool, _Allocator>::vector(const allocator_type& __a) |
| 2518 | 2528 | #if _LIBCPP_STD_VER <= 14 |
| 2519 | 2529 | _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value) |
| ... | ... | @@ -2527,7 +2537,7 @@ vector<bool, _Allocator>::vector(const allocator_type& __a) |
| 2527 | 2537 | } |
| 2528 | 2538 | |
| 2529 | 2539 | template <class _Allocator> |
| 2530 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2540 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2531 | 2541 | vector<bool, _Allocator>::vector(size_type __n) |
| 2532 | 2542 | : __begin_(nullptr), |
| 2533 | 2543 | __size_(0), |
| ... | ... | @@ -2542,7 +2552,7 @@ vector<bool, _Allocator>::vector(size_type __n) |
| 2542 | 2552 | |
| 2543 | 2553 | #if _LIBCPP_STD_VER > 11 |
| 2544 | 2554 | template <class _Allocator> |
| 2545 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2555 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2546 | 2556 | vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a) |
| 2547 | 2557 | : __begin_(nullptr), |
| 2548 | 2558 | __size_(0), |
| ... | ... | @@ -2557,7 +2567,7 @@ vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a) |
| 2557 | 2567 | #endif |
| 2558 | 2568 | |
| 2559 | 2569 | template <class _Allocator> |
| 2560 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2570 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2561 | 2571 | vector<bool, _Allocator>::vector(size_type __n, const value_type& __x) |
| 2562 | 2572 | : __begin_(nullptr), |
| 2563 | 2573 | __size_(0), |
| ... | ... | @@ -2571,7 +2581,7 @@ vector<bool, _Allocator>::vector(size_type __n, const value_type& __x) |
| 2571 | 2581 | } |
| 2572 | 2582 | |
| 2573 | 2583 | template <class _Allocator> |
| 2574 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2584 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2575 | 2585 | vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a) |
| 2576 | 2586 | : __begin_(nullptr), |
| 2577 | 2587 | __size_(0), |
| ... | ... | @@ -2586,7 +2596,7 @@ vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const all |
| 2586 | 2596 | |
| 2587 | 2597 | template <class _Allocator> |
| 2588 | 2598 | template <class _InputIterator> |
| 2589 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2599 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2590 | 2600 | vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, |
| 2591 | 2601 | typename enable_if<__is_exactly_cpp17_input_iterator<_InputIterator>::value>::type*) |
| 2592 | 2602 | : __begin_(nullptr), |
| ... | ... | @@ -2613,7 +2623,7 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, |
| 2613 | 2623 | |
| 2614 | 2624 | template <class _Allocator> |
| 2615 | 2625 | template <class _InputIterator> |
| 2616 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2626 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2617 | 2627 | vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, |
| 2618 | 2628 | typename enable_if<__is_exactly_cpp17_input_iterator<_InputIterator>::value>::type*) |
| 2619 | 2629 | : __begin_(nullptr), |
| ... | ... | @@ -2640,42 +2650,46 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, |
| 2640 | 2650 | |
| 2641 | 2651 | template <class _Allocator> |
| 2642 | 2652 | template <class _ForwardIterator> |
| 2643 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2653 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2644 | 2654 | vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, |
| 2645 | 2655 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type*) |
| 2646 | 2656 | : __begin_(nullptr), |
| 2647 | 2657 | __size_(0), |
| 2648 | 2658 | __cap_alloc_(0, __default_init_tag()) |
| 2649 | 2659 | { |
| 2650 | size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); | |
| 2660 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 2661 | size_type __n = static_cast<size_type>(std::distance(__first, __last)); | |
| 2651 | 2662 | if (__n > 0) |
| 2652 | 2663 | { |
| 2653 | 2664 | __vallocate(__n); |
| 2654 | 2665 | __construct_at_end(__first, __last); |
| 2655 | 2666 | } |
| 2667 | __guard.__complete(); | |
| 2656 | 2668 | } |
| 2657 | 2669 | |
| 2658 | 2670 | template <class _Allocator> |
| 2659 | 2671 | template <class _ForwardIterator> |
| 2660 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2672 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2661 | 2673 | vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, |
| 2662 | 2674 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type*) |
| 2663 | 2675 | : __begin_(nullptr), |
| 2664 | 2676 | __size_(0), |
| 2665 | 2677 | __cap_alloc_(0, static_cast<__storage_allocator>(__a)) |
| 2666 | 2678 | { |
| 2667 | size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); | |
| 2679 | auto __guard = std::__make_exception_guard(__destroy_vector(*this)); | |
| 2680 | size_type __n = static_cast<size_type>(std::distance(__first, __last)); | |
| 2668 | 2681 | if (__n > 0) |
| 2669 | 2682 | { |
| 2670 | 2683 | __vallocate(__n); |
| 2671 | 2684 | __construct_at_end(__first, __last); |
| 2672 | 2685 | } |
| 2686 | __guard.__complete(); | |
| 2673 | 2687 | } |
| 2674 | 2688 | |
| 2675 | 2689 | #ifndef _LIBCPP_CXX03_LANG |
| 2676 | 2690 | |
| 2677 | 2691 | template <class _Allocator> |
| 2678 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2692 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2679 | 2693 | vector<bool, _Allocator>::vector(initializer_list<value_type> __il) |
| 2680 | 2694 | : __begin_(nullptr), |
| 2681 | 2695 | __size_(0), |
| ... | ... | @@ -2690,7 +2704,7 @@ vector<bool, _Allocator>::vector(initializer_list<value_type> __il) |
| 2690 | 2704 | } |
| 2691 | 2705 | |
| 2692 | 2706 | template <class _Allocator> |
| 2693 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2707 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2694 | 2708 | vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a) |
| 2695 | 2709 | : __begin_(nullptr), |
| 2696 | 2710 | __size_(0), |
| ... | ... | @@ -2707,16 +2721,7 @@ vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const alloca |
| 2707 | 2721 | #endif // _LIBCPP_CXX03_LANG |
| 2708 | 2722 | |
| 2709 | 2723 | template <class _Allocator> |
| 2710 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2711 | vector<bool, _Allocator>::~vector() | |
| 2712 | { | |
| 2713 | if (__begin_ != nullptr) | |
| 2714 | __storage_traits::deallocate(__alloc(), __begin_, __cap()); | |
| 2715 | std::__debug_db_invalidate_all(this); | |
| 2716 | } | |
| 2717 | ||
| 2718 | template <class _Allocator> | |
| 2719 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2724 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2720 | 2725 | vector<bool, _Allocator>::vector(const vector& __v) |
| 2721 | 2726 | : __begin_(nullptr), |
| 2722 | 2727 | __size_(0), |
| ... | ... | @@ -2730,7 +2735,7 @@ vector<bool, _Allocator>::vector(const vector& __v) |
| 2730 | 2735 | } |
| 2731 | 2736 | |
| 2732 | 2737 | template <class _Allocator> |
| 2733 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2738 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2734 | 2739 | vector<bool, _Allocator>::vector(const vector& __v, const allocator_type& __a) |
| 2735 | 2740 | : __begin_(nullptr), |
| 2736 | 2741 | __size_(0), |
| ... | ... | @@ -2744,11 +2749,11 @@ vector<bool, _Allocator>::vector(const vector& __v, const allocator_type& __a) |
| 2744 | 2749 | } |
| 2745 | 2750 | |
| 2746 | 2751 | template <class _Allocator> |
| 2747 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2752 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2748 | 2753 | vector<bool, _Allocator>& |
| 2749 | 2754 | vector<bool, _Allocator>::operator=(const vector& __v) |
| 2750 | 2755 | { |
| 2751 | if (this != _VSTD::addressof(__v)) | |
| 2756 | if (this != std::addressof(__v)) | |
| 2752 | 2757 | { |
| 2753 | 2758 | __copy_assign_alloc(__v); |
| 2754 | 2759 | if (__v.__size_) |
| ... | ... | @@ -2758,7 +2763,7 @@ vector<bool, _Allocator>::operator=(const vector& __v) |
| 2758 | 2763 | __vdeallocate(); |
| 2759 | 2764 | __vallocate(__v.__size_); |
| 2760 | 2765 | } |
| 2761 | _VSTD::copy(__v.__begin_, __v.__begin_ + __external_cap_to_internal(__v.__size_), __begin_); | |
| 2766 | std::copy(__v.__begin_, __v.__begin_ + __external_cap_to_internal(__v.__size_), __begin_); | |
| 2762 | 2767 | } |
| 2763 | 2768 | __size_ = __v.__size_; |
| 2764 | 2769 | } |
| ... | ... | @@ -2766,7 +2771,7 @@ vector<bool, _Allocator>::operator=(const vector& __v) |
| 2766 | 2771 | } |
| 2767 | 2772 | |
| 2768 | 2773 | template <class _Allocator> |
| 2769 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 vector<bool, _Allocator>::vector(vector&& __v) | |
| 2774 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(vector&& __v) | |
| 2770 | 2775 | #if _LIBCPP_STD_VER > 14 |
| 2771 | 2776 | _NOEXCEPT |
| 2772 | 2777 | #else |
| ... | ... | @@ -2774,14 +2779,14 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 vector<bool, _All |
| 2774 | 2779 | #endif |
| 2775 | 2780 | : __begin_(__v.__begin_), |
| 2776 | 2781 | __size_(__v.__size_), |
| 2777 | __cap_alloc_(_VSTD::move(__v.__cap_alloc_)) { | |
| 2782 | __cap_alloc_(std::move(__v.__cap_alloc_)) { | |
| 2778 | 2783 | __v.__begin_ = nullptr; |
| 2779 | 2784 | __v.__size_ = 0; |
| 2780 | 2785 | __v.__cap() = 0; |
| 2781 | 2786 | } |
| 2782 | 2787 | |
| 2783 | 2788 | template <class _Allocator> |
| 2784 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2789 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2785 | 2790 | vector<bool, _Allocator>::vector(vector&& __v, const __type_identity_t<allocator_type>& __a) |
| 2786 | 2791 | : __begin_(nullptr), |
| 2787 | 2792 | __size_(0), |
| ... | ... | @@ -2803,7 +2808,7 @@ vector<bool, _Allocator>::vector(vector&& __v, const __type_identity_t<allocator |
| 2803 | 2808 | } |
| 2804 | 2809 | |
| 2805 | 2810 | template <class _Allocator> |
| 2806 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2811 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2807 | 2812 | vector<bool, _Allocator>& |
| 2808 | 2813 | vector<bool, _Allocator>::operator=(vector&& __v) |
| 2809 | 2814 | _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) |
| ... | ... | @@ -2814,7 +2819,7 @@ vector<bool, _Allocator>::operator=(vector&& __v) |
| 2814 | 2819 | } |
| 2815 | 2820 | |
| 2816 | 2821 | template <class _Allocator> |
| 2817 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 2822 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 2818 | 2823 | vector<bool, _Allocator>::__move_assign(vector& __c, false_type) |
| 2819 | 2824 | { |
| 2820 | 2825 | if (__alloc() != __c.__alloc()) |
| ... | ... | @@ -2824,7 +2829,7 @@ vector<bool, _Allocator>::__move_assign(vector& __c, false_type) |
| 2824 | 2829 | } |
| 2825 | 2830 | |
| 2826 | 2831 | template <class _Allocator> |
| 2827 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 2832 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 2828 | 2833 | vector<bool, _Allocator>::__move_assign(vector& __c, true_type) |
| 2829 | 2834 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) |
| 2830 | 2835 | { |
| ... | ... | @@ -2838,7 +2843,7 @@ vector<bool, _Allocator>::__move_assign(vector& __c, true_type) |
| 2838 | 2843 | } |
| 2839 | 2844 | |
| 2840 | 2845 | template <class _Allocator> |
| 2841 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 2846 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 2842 | 2847 | vector<bool, _Allocator>::assign(size_type __n, const value_type& __x) |
| 2843 | 2848 | { |
| 2844 | 2849 | __size_ = 0; |
| ... | ... | @@ -2854,14 +2859,14 @@ vector<bool, _Allocator>::assign(size_type __n, const value_type& __x) |
| 2854 | 2859 | __v.__size_ = __n; |
| 2855 | 2860 | swap(__v); |
| 2856 | 2861 | } |
| 2857 | _VSTD::fill_n(begin(), __n, __x); | |
| 2862 | std::fill_n(begin(), __n, __x); | |
| 2858 | 2863 | } |
| 2859 | 2864 | std::__debug_db_invalidate_all(this); |
| 2860 | 2865 | } |
| 2861 | 2866 | |
| 2862 | 2867 | template <class _Allocator> |
| 2863 | 2868 | template <class _InputIterator> |
| 2864 | _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if <__is_exactly_cpp17_input_iterator<_InputIterator>::value, | |
| 2869 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename enable_if <__is_exactly_cpp17_input_iterator<_InputIterator>::value, | |
| 2865 | 2870 | void |
| 2866 | 2871 | >::type |
| 2867 | 2872 | vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last) |
| ... | ... | @@ -2873,7 +2878,7 @@ vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last) |
| 2873 | 2878 | |
| 2874 | 2879 | template <class _Allocator> |
| 2875 | 2880 | template <class _ForwardIterator> |
| 2876 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2881 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 2877 | 2882 | typename enable_if |
| 2878 | 2883 | < |
| 2879 | 2884 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| ... | ... | @@ -2882,7 +2887,7 @@ typename enable_if |
| 2882 | 2887 | vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) |
| 2883 | 2888 | { |
| 2884 | 2889 | clear(); |
| 2885 | difference_type __ns = _VSTD::distance(__first, __last); | |
| 2890 | difference_type __ns = std::distance(__first, __last); | |
| 2886 | 2891 | _LIBCPP_ASSERT(__ns >= 0, "invalid range specified"); |
| 2887 | 2892 | const size_t __n = static_cast<size_type>(__ns); |
| 2888 | 2893 | if (__n) |
| ... | ... | @@ -2897,7 +2902,7 @@ vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __la |
| 2897 | 2902 | } |
| 2898 | 2903 | |
| 2899 | 2904 | template <class _Allocator> |
| 2900 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 2905 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 2901 | 2906 | vector<bool, _Allocator>::reserve(size_type __n) |
| 2902 | 2907 | { |
| 2903 | 2908 | if (__n > capacity()) |
| ... | ... | @@ -2913,7 +2918,7 @@ vector<bool, _Allocator>::reserve(size_type __n) |
| 2913 | 2918 | } |
| 2914 | 2919 | |
| 2915 | 2920 | template <class _Allocator> |
| 2916 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 2921 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 2917 | 2922 | vector<bool, _Allocator>::shrink_to_fit() _NOEXCEPT |
| 2918 | 2923 | { |
| 2919 | 2924 | if (__external_cap_to_internal(size()) > __cap()) |
| ... | ... | @@ -2951,7 +2956,7 @@ vector<bool, _Allocator>::at(size_type __n) const |
| 2951 | 2956 | } |
| 2952 | 2957 | |
| 2953 | 2958 | template <class _Allocator> |
| 2954 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 2959 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 2955 | 2960 | vector<bool, _Allocator>::push_back(const value_type& __x) |
| 2956 | 2961 | { |
| 2957 | 2962 | if (this->__size_ == this->capacity()) |
| ... | ... | @@ -2961,7 +2966,7 @@ vector<bool, _Allocator>::push_back(const value_type& __x) |
| 2961 | 2966 | } |
| 2962 | 2967 | |
| 2963 | 2968 | template <class _Allocator> |
| 2964 | _LIBCPP_CONSTEXPR_AFTER_CXX17 typename vector<bool, _Allocator>::iterator | |
| 2969 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator | |
| 2965 | 2970 | vector<bool, _Allocator>::insert(const_iterator __position, const value_type& __x) |
| 2966 | 2971 | { |
| 2967 | 2972 | iterator __r; |
| ... | ... | @@ -2969,7 +2974,7 @@ vector<bool, _Allocator>::insert(const_iterator __position, const value_type& __ |
| 2969 | 2974 | { |
| 2970 | 2975 | const_iterator __old_end = end(); |
| 2971 | 2976 | ++__size_; |
| 2972 | _VSTD::copy_backward(__position, __old_end, end()); | |
| 2977 | std::copy_backward(__position, __old_end, end()); | |
| 2973 | 2978 | __r = __const_iterator_cast(__position); |
| 2974 | 2979 | } |
| 2975 | 2980 | else |
| ... | ... | @@ -2977,8 +2982,8 @@ vector<bool, _Allocator>::insert(const_iterator __position, const value_type& __ |
| 2977 | 2982 | vector __v(get_allocator()); |
| 2978 | 2983 | __v.reserve(__recommend(__size_ + 1)); |
| 2979 | 2984 | __v.__size_ = __size_ + 1; |
| 2980 | __r = _VSTD::copy(cbegin(), __position, __v.begin()); | |
| 2981 | _VSTD::copy_backward(__position, cend(), __v.end()); | |
| 2985 | __r = std::copy(cbegin(), __position, __v.begin()); | |
| 2986 | std::copy_backward(__position, cend(), __v.end()); | |
| 2982 | 2987 | swap(__v); |
| 2983 | 2988 | } |
| 2984 | 2989 | *__r = __x; |
| ... | ... | @@ -2986,7 +2991,7 @@ vector<bool, _Allocator>::insert(const_iterator __position, const value_type& __ |
| 2986 | 2991 | } |
| 2987 | 2992 | |
| 2988 | 2993 | template <class _Allocator> |
| 2989 | _LIBCPP_CONSTEXPR_AFTER_CXX17 typename vector<bool, _Allocator>::iterator | |
| 2994 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator | |
| 2990 | 2995 | vector<bool, _Allocator>::insert(const_iterator __position, size_type __n, const value_type& __x) |
| 2991 | 2996 | { |
| 2992 | 2997 | iterator __r; |
| ... | ... | @@ -2995,7 +3000,7 @@ vector<bool, _Allocator>::insert(const_iterator __position, size_type __n, const |
| 2995 | 3000 | { |
| 2996 | 3001 | const_iterator __old_end = end(); |
| 2997 | 3002 | __size_ += __n; |
| 2998 | _VSTD::copy_backward(__position, __old_end, end()); | |
| 3003 | std::copy_backward(__position, __old_end, end()); | |
| 2999 | 3004 | __r = __const_iterator_cast(__position); |
| 3000 | 3005 | } |
| 3001 | 3006 | else |
| ... | ... | @@ -3003,17 +3008,17 @@ vector<bool, _Allocator>::insert(const_iterator __position, size_type __n, const |
| 3003 | 3008 | vector __v(get_allocator()); |
| 3004 | 3009 | __v.reserve(__recommend(__size_ + __n)); |
| 3005 | 3010 | __v.__size_ = __size_ + __n; |
| 3006 | __r = _VSTD::copy(cbegin(), __position, __v.begin()); | |
| 3007 | _VSTD::copy_backward(__position, cend(), __v.end()); | |
| 3011 | __r = std::copy(cbegin(), __position, __v.begin()); | |
| 3012 | std::copy_backward(__position, cend(), __v.end()); | |
| 3008 | 3013 | swap(__v); |
| 3009 | 3014 | } |
| 3010 | _VSTD::fill_n(__r, __n, __x); | |
| 3015 | std::fill_n(__r, __n, __x); | |
| 3011 | 3016 | return __r; |
| 3012 | 3017 | } |
| 3013 | 3018 | |
| 3014 | 3019 | template <class _Allocator> |
| 3015 | 3020 | template <class _InputIterator> |
| 3016 | _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if <__is_exactly_cpp17_input_iterator<_InputIterator>::value, | |
| 3021 | _LIBCPP_CONSTEXPR_SINCE_CXX20 typename enable_if <__is_exactly_cpp17_input_iterator<_InputIterator>::value, | |
| 3017 | 3022 | typename vector<bool, _Allocator>::iterator |
| 3018 | 3023 | >::type |
| 3019 | 3024 | vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last) |
| ... | ... | @@ -3048,14 +3053,14 @@ vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __fir |
| 3048 | 3053 | } |
| 3049 | 3054 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 3050 | 3055 | } |
| 3051 | __p = _VSTD::rotate(__p, __old_end, end()); | |
| 3056 | __p = std::rotate(__p, __old_end, end()); | |
| 3052 | 3057 | insert(__p, __v.begin(), __v.end()); |
| 3053 | 3058 | return begin() + __off; |
| 3054 | 3059 | } |
| 3055 | 3060 | |
| 3056 | 3061 | template <class _Allocator> |
| 3057 | 3062 | template <class _ForwardIterator> |
| 3058 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3063 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3059 | 3064 | typename enable_if |
| 3060 | 3065 | < |
| 3061 | 3066 | __is_cpp17_forward_iterator<_ForwardIterator>::value, |
| ... | ... | @@ -3063,7 +3068,7 @@ typename enable_if |
| 3063 | 3068 | >::type |
| 3064 | 3069 | vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last) |
| 3065 | 3070 | { |
| 3066 | const difference_type __n_signed = _VSTD::distance(__first, __last); | |
| 3071 | const difference_type __n_signed = std::distance(__first, __last); | |
| 3067 | 3072 | _LIBCPP_ASSERT(__n_signed >= 0, "invalid range specified"); |
| 3068 | 3073 | const size_type __n = static_cast<size_type>(__n_signed); |
| 3069 | 3074 | iterator __r; |
| ... | ... | @@ -3072,7 +3077,7 @@ vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __f |
| 3072 | 3077 | { |
| 3073 | 3078 | const_iterator __old_end = end(); |
| 3074 | 3079 | __size_ += __n; |
| 3075 | _VSTD::copy_backward(__position, __old_end, end()); | |
| 3080 | std::copy_backward(__position, __old_end, end()); | |
| 3076 | 3081 | __r = __const_iterator_cast(__position); |
| 3077 | 3082 | } |
| 3078 | 3083 | else |
| ... | ... | @@ -3080,39 +3085,39 @@ vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __f |
| 3080 | 3085 | vector __v(get_allocator()); |
| 3081 | 3086 | __v.reserve(__recommend(__size_ + __n)); |
| 3082 | 3087 | __v.__size_ = __size_ + __n; |
| 3083 | __r = _VSTD::copy(cbegin(), __position, __v.begin()); | |
| 3084 | _VSTD::copy_backward(__position, cend(), __v.end()); | |
| 3088 | __r = std::copy(cbegin(), __position, __v.begin()); | |
| 3089 | std::copy_backward(__position, cend(), __v.end()); | |
| 3085 | 3090 | swap(__v); |
| 3086 | 3091 | } |
| 3087 | _VSTD::copy(__first, __last, __r); | |
| 3092 | std::copy(__first, __last, __r); | |
| 3088 | 3093 | return __r; |
| 3089 | 3094 | } |
| 3090 | 3095 | |
| 3091 | 3096 | template <class _Allocator> |
| 3092 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3097 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3093 | 3098 | typename vector<bool, _Allocator>::iterator |
| 3094 | 3099 | vector<bool, _Allocator>::erase(const_iterator __position) |
| 3095 | 3100 | { |
| 3096 | 3101 | iterator __r = __const_iterator_cast(__position); |
| 3097 | _VSTD::copy(__position + 1, this->cend(), __r); | |
| 3102 | std::copy(__position + 1, this->cend(), __r); | |
| 3098 | 3103 | --__size_; |
| 3099 | 3104 | return __r; |
| 3100 | 3105 | } |
| 3101 | 3106 | |
| 3102 | 3107 | template <class _Allocator> |
| 3103 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3108 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3104 | 3109 | typename vector<bool, _Allocator>::iterator |
| 3105 | 3110 | vector<bool, _Allocator>::erase(const_iterator __first, const_iterator __last) |
| 3106 | 3111 | { |
| 3107 | 3112 | iterator __r = __const_iterator_cast(__first); |
| 3108 | 3113 | difference_type __d = __last - __first; |
| 3109 | _VSTD::copy(__last, this->cend(), __r); | |
| 3114 | std::copy(__last, this->cend(), __r); | |
| 3110 | 3115 | __size_ -= __d; |
| 3111 | 3116 | return __r; |
| 3112 | 3117 | } |
| 3113 | 3118 | |
| 3114 | 3119 | template <class _Allocator> |
| 3115 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 3120 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 3116 | 3121 | vector<bool, _Allocator>::swap(vector& __x) |
| 3117 | 3122 | #if _LIBCPP_STD_VER >= 14 |
| 3118 | 3123 | _NOEXCEPT |
| ... | ... | @@ -3121,15 +3126,15 @@ vector<bool, _Allocator>::swap(vector& __x) |
| 3121 | 3126 | __is_nothrow_swappable<allocator_type>::value) |
| 3122 | 3127 | #endif |
| 3123 | 3128 | { |
| 3124 | _VSTD::swap(this->__begin_, __x.__begin_); | |
| 3125 | _VSTD::swap(this->__size_, __x.__size_); | |
| 3126 | _VSTD::swap(this->__cap(), __x.__cap()); | |
| 3127 | _VSTD::__swap_allocator(this->__alloc(), __x.__alloc(), | |
| 3129 | std::swap(this->__begin_, __x.__begin_); | |
| 3130 | std::swap(this->__size_, __x.__size_); | |
| 3131 | std::swap(this->__cap(), __x.__cap()); | |
| 3132 | std::__swap_allocator(this->__alloc(), __x.__alloc(), | |
| 3128 | 3133 | integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>()); |
| 3129 | 3134 | } |
| 3130 | 3135 | |
| 3131 | 3136 | template <class _Allocator> |
| 3132 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 3137 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 3133 | 3138 | vector<bool, _Allocator>::resize(size_type __sz, value_type __x) |
| 3134 | 3139 | { |
| 3135 | 3140 | size_type __cs = size(); |
| ... | ... | @@ -3148,17 +3153,17 @@ vector<bool, _Allocator>::resize(size_type __sz, value_type __x) |
| 3148 | 3153 | vector __v(get_allocator()); |
| 3149 | 3154 | __v.reserve(__recommend(__size_ + __n)); |
| 3150 | 3155 | __v.__size_ = __size_ + __n; |
| 3151 | __r = _VSTD::copy(cbegin(), cend(), __v.begin()); | |
| 3156 | __r = std::copy(cbegin(), cend(), __v.begin()); | |
| 3152 | 3157 | swap(__v); |
| 3153 | 3158 | } |
| 3154 | _VSTD::fill_n(__r, __n, __x); | |
| 3159 | std::fill_n(__r, __n, __x); | |
| 3155 | 3160 | } |
| 3156 | 3161 | else |
| 3157 | 3162 | __size_ = __sz; |
| 3158 | 3163 | } |
| 3159 | 3164 | |
| 3160 | 3165 | template <class _Allocator> |
| 3161 | _LIBCPP_CONSTEXPR_AFTER_CXX17 void | |
| 3166 | _LIBCPP_CONSTEXPR_SINCE_CXX20 void | |
| 3162 | 3167 | vector<bool, _Allocator>::flip() _NOEXCEPT |
| 3163 | 3168 | { |
| 3164 | 3169 | // do middle whole words |
| ... | ... | @@ -3177,7 +3182,7 @@ vector<bool, _Allocator>::flip() _NOEXCEPT |
| 3177 | 3182 | } |
| 3178 | 3183 | |
| 3179 | 3184 | template <class _Allocator> |
| 3180 | _LIBCPP_CONSTEXPR_AFTER_CXX17 bool | |
| 3185 | _LIBCPP_CONSTEXPR_SINCE_CXX20 bool | |
| 3181 | 3186 | vector<bool, _Allocator>::__invariants() const |
| 3182 | 3187 | { |
| 3183 | 3188 | if (this->__begin_ == nullptr) |
| ... | ... | @@ -3196,7 +3201,7 @@ vector<bool, _Allocator>::__invariants() const |
| 3196 | 3201 | } |
| 3197 | 3202 | |
| 3198 | 3203 | template <class _Allocator> |
| 3199 | _LIBCPP_CONSTEXPR_AFTER_CXX17 size_t | |
| 3204 | _LIBCPP_CONSTEXPR_SINCE_CXX20 size_t | |
| 3200 | 3205 | vector<bool, _Allocator>::__hash_code() const _NOEXCEPT |
| 3201 | 3206 | { |
| 3202 | 3207 | size_t __h = 0; |
| ... | ... | @@ -3218,24 +3223,24 @@ template <class _Allocator> |
| 3218 | 3223 | struct _LIBCPP_TEMPLATE_VIS hash<vector<bool, _Allocator> > |
| 3219 | 3224 | : public __unary_function<vector<bool, _Allocator>, size_t> |
| 3220 | 3225 | { |
| 3221 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3226 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3222 | 3227 | size_t operator()(const vector<bool, _Allocator>& __vec) const _NOEXCEPT |
| 3223 | 3228 | {return __vec.__hash_code();} |
| 3224 | 3229 | }; |
| 3225 | 3230 | |
| 3226 | 3231 | template <class _Tp, class _Allocator> |
| 3227 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3228 | inline _LIBCPP_INLINE_VISIBILITY | |
| 3232 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3233 | inline _LIBCPP_HIDE_FROM_ABI | |
| 3229 | 3234 | bool |
| 3230 | 3235 | operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) |
| 3231 | 3236 | { |
| 3232 | 3237 | const typename vector<_Tp, _Allocator>::size_type __sz = __x.size(); |
| 3233 | return __sz == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); | |
| 3238 | return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); | |
| 3234 | 3239 | } |
| 3235 | 3240 | |
| 3236 | 3241 | template <class _Tp, class _Allocator> |
| 3237 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3238 | inline _LIBCPP_INLINE_VISIBILITY | |
| 3242 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3243 | inline _LIBCPP_HIDE_FROM_ABI | |
| 3239 | 3244 | bool |
| 3240 | 3245 | operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) |
| 3241 | 3246 | { |
| ... | ... | @@ -3243,17 +3248,17 @@ operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __ |
| 3243 | 3248 | } |
| 3244 | 3249 | |
| 3245 | 3250 | template <class _Tp, class _Allocator> |
| 3246 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3247 | inline _LIBCPP_INLINE_VISIBILITY | |
| 3251 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3252 | inline _LIBCPP_HIDE_FROM_ABI | |
| 3248 | 3253 | bool |
| 3249 | 3254 | operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) |
| 3250 | 3255 | { |
| 3251 | return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); | |
| 3256 | return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); | |
| 3252 | 3257 | } |
| 3253 | 3258 | |
| 3254 | 3259 | template <class _Tp, class _Allocator> |
| 3255 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3256 | inline _LIBCPP_INLINE_VISIBILITY | |
| 3260 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3261 | inline _LIBCPP_HIDE_FROM_ABI | |
| 3257 | 3262 | bool |
| 3258 | 3263 | operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) |
| 3259 | 3264 | { |
| ... | ... | @@ -3261,8 +3266,8 @@ operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __ |
| 3261 | 3266 | } |
| 3262 | 3267 | |
| 3263 | 3268 | template <class _Tp, class _Allocator> |
| 3264 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3265 | inline _LIBCPP_INLINE_VISIBILITY | |
| 3269 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3270 | inline _LIBCPP_HIDE_FROM_ABI | |
| 3266 | 3271 | bool |
| 3267 | 3272 | operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) |
| 3268 | 3273 | { |
| ... | ... | @@ -3270,8 +3275,8 @@ operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __ |
| 3270 | 3275 | } |
| 3271 | 3276 | |
| 3272 | 3277 | template <class _Tp, class _Allocator> |
| 3273 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3274 | inline _LIBCPP_INLINE_VISIBILITY | |
| 3278 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3279 | inline _LIBCPP_HIDE_FROM_ABI | |
| 3275 | 3280 | bool |
| 3276 | 3281 | operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) |
| 3277 | 3282 | { |
| ... | ... | @@ -3279,8 +3284,8 @@ operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __ |
| 3279 | 3284 | } |
| 3280 | 3285 | |
| 3281 | 3286 | template <class _Tp, class _Allocator> |
| 3282 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3283 | inline _LIBCPP_INLINE_VISIBILITY | |
| 3287 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3288 | inline _LIBCPP_HIDE_FROM_ABI | |
| 3284 | 3289 | void |
| 3285 | 3290 | swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) |
| 3286 | 3291 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) |
| ... | ... | @@ -3290,34 +3295,72 @@ swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) |
| 3290 | 3295 | |
| 3291 | 3296 | #if _LIBCPP_STD_VER > 17 |
| 3292 | 3297 | template <class _Tp, class _Allocator, class _Up> |
| 3293 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3294 | inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::size_type | |
| 3298 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3299 | inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type | |
| 3295 | 3300 | erase(vector<_Tp, _Allocator>& __c, const _Up& __v) { |
| 3296 | 3301 | auto __old_size = __c.size(); |
| 3297 | __c.erase(_VSTD::remove(__c.begin(), __c.end(), __v), __c.end()); | |
| 3302 | __c.erase(std::remove(__c.begin(), __c.end(), __v), __c.end()); | |
| 3298 | 3303 | return __old_size - __c.size(); |
| 3299 | 3304 | } |
| 3300 | 3305 | |
| 3301 | 3306 | template <class _Tp, class _Allocator, class _Predicate> |
| 3302 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3303 | inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::size_type | |
| 3307 | _LIBCPP_CONSTEXPR_SINCE_CXX20 | |
| 3308 | inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type | |
| 3304 | 3309 | erase_if(vector<_Tp, _Allocator>& __c, _Predicate __pred) { |
| 3305 | 3310 | auto __old_size = __c.size(); |
| 3306 | __c.erase(_VSTD::remove_if(__c.begin(), __c.end(), __pred), __c.end()); | |
| 3311 | __c.erase(std::remove_if(__c.begin(), __c.end(), __pred), __c.end()); | |
| 3307 | 3312 | return __old_size - __c.size(); |
| 3308 | 3313 | } |
| 3309 | 3314 | |
| 3310 | 3315 | template <> |
| 3311 | inline constexpr bool __format::__enable_insertable<std::vector<char>> = true; | |
| 3316 | inline constexpr bool __format::__enable_insertable<vector<char>> = true; | |
| 3312 | 3317 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 3313 | 3318 | template <> |
| 3314 | inline constexpr bool __format::__enable_insertable<std::vector<wchar_t>> = true; | |
| 3319 | inline constexpr bool __format::__enable_insertable<vector<wchar_t>> = true; | |
| 3315 | 3320 | #endif |
| 3316 | 3321 | |
| 3317 | 3322 | #endif // _LIBCPP_STD_VER > 17 |
| 3318 | 3323 | |
| 3324 | #if _LIBCPP_STD_VER > 20 | |
| 3325 | template <class _Tp, class CharT> | |
| 3326 | // Since is-vector-bool-reference is only used once it's inlined here. | |
| 3327 | requires same_as<typename _Tp::__container, vector<bool, typename _Tp::__container::allocator_type>> | |
| 3328 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<_Tp, CharT> { | |
| 3329 | private: | |
| 3330 | formatter<bool, CharT> __underlying_; | |
| 3331 | ||
| 3332 | public: | |
| 3333 | template <class _ParseContext> | |
| 3334 | _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { | |
| 3335 | return __underlying_.parse(__ctx); | |
| 3336 | } | |
| 3337 | ||
| 3338 | template <class _FormatContext> | |
| 3339 | _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _Tp& __ref, _FormatContext& __ctx) const { | |
| 3340 | return __underlying_.format(__ref, __ctx); | |
| 3341 | } | |
| 3342 | }; | |
| 3343 | #endif // _LIBCPP_STD_VER > 20 | |
| 3344 | ||
| 3319 | 3345 | _LIBCPP_END_NAMESPACE_STD |
| 3320 | 3346 | |
| 3347 | #if _LIBCPP_STD_VER > 14 | |
| 3348 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 3349 | namespace pmr { | |
| 3350 | template <class _ValueT> | |
| 3351 | using vector = std::vector<_ValueT, polymorphic_allocator<_ValueT>>; | |
| 3352 | } // namespace pmr | |
| 3353 | _LIBCPP_END_NAMESPACE_STD | |
| 3354 | #endif | |
| 3355 | ||
| 3321 | 3356 | _LIBCPP_POP_MACROS |
| 3322 | 3357 | |
| 3358 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | |
| 3359 | # include <algorithm> | |
| 3360 | # include <atomic> | |
| 3361 | # include <concepts> | |
| 3362 | # include <typeinfo> | |
| 3363 | # include <utility> | |
| 3364 | #endif | |
| 3365 | ||
| 3323 | 3366 | #endif // _LIBCPP_VECTOR |
lib/libcxx/include/version+22-11| ... | ... | @@ -55,13 +55,16 @@ __cpp_lib_chrono_udls 201304L <chrono> |
| 55 | 55 | __cpp_lib_clamp 201603L <algorithm> |
| 56 | 56 | __cpp_lib_complex_udls 201309L <complex> |
| 57 | 57 | __cpp_lib_concepts 202002L <concepts> |
| 58 | __cpp_lib_constexpr_algorithms 201806L <algorithm> | |
| 58 | __cpp_lib_constexpr_algorithms 201806L <algorithm> <utility> | |
| 59 | __cpp_lib_constexpr_bitset 202207L <bitset> | |
| 60 | __cpp_lib_constexpr_charconv 202207L <charconv> | |
| 59 | 61 | __cpp_lib_constexpr_cmath 202202L <cmath> <cstdlib> |
| 60 | 62 | __cpp_lib_constexpr_complex 201711L <complex> |
| 61 | 63 | __cpp_lib_constexpr_dynamic_alloc 201907L <memory> |
| 62 | 64 | __cpp_lib_constexpr_functional 201907L <functional> |
| 63 | 65 | __cpp_lib_constexpr_iterator 201811L <iterator> |
| 64 | __cpp_lib_constexpr_memory 201811L <memory> | |
| 66 | __cpp_lib_constexpr_memory 202202L <memory> | |
| 67 | 201811L // C++20 | |
| 65 | 68 | __cpp_lib_constexpr_numeric 201911L <numeric> |
| 66 | 69 | __cpp_lib_constexpr_string 201907L <string> |
| 67 | 70 | __cpp_lib_constexpr_string_view 201811L <string_view> |
| ... | ... | @@ -79,8 +82,10 @@ __cpp_lib_erase_if 202002L <deque> <forward |
| 79 | 82 | __cpp_lib_exchange_function 201304L <utility> |
| 80 | 83 | __cpp_lib_execution 201902L <execution> |
| 81 | 84 | 201603L // C++17 |
| 85 | __cpp_lib_expected 202202L <expected> | |
| 82 | 86 | __cpp_lib_filesystem 201703L <filesystem> |
| 83 | 87 | __cpp_lib_format 202106L <format> |
| 88 | __cpp_lib_forward_like 202207L <utility> | |
| 84 | 89 | __cpp_lib_gcd_lcm 201606L <numeric> |
| 85 | 90 | __cpp_lib_generic_associative_lookup 201304L <map> <set> |
| 86 | 91 | __cpp_lib_generic_unordered_lookup 201811L <unordered_map> <unordered_set> |
| ... | ... | @@ -132,7 +137,7 @@ __cpp_lib_out_ptr 202106L <memory> |
| 132 | 137 | __cpp_lib_parallel_algorithm 201603L <algorithm> <numeric> |
| 133 | 138 | __cpp_lib_polymorphic_allocator 201902L <memory_resource> |
| 134 | 139 | __cpp_lib_quoted_string_io 201304L <iomanip> |
| 135 | __cpp_lib_ranges 201811L <algorithm> <functional> <iterator> | |
| 140 | __cpp_lib_ranges 202106L <algorithm> <functional> <iterator> | |
| 136 | 141 | <memory> <ranges> |
| 137 | 142 | __cpp_lib_ranges_chunk 202202L <ranges> |
| 138 | 143 | __cpp_lib_ranges_chunk_by 202202L <ranges> |
| ... | ... | @@ -262,7 +267,7 @@ __cpp_lib_void_t 201411L <type_traits> |
| 262 | 267 | # define __cpp_lib_make_from_tuple 201606L |
| 263 | 268 | # define __cpp_lib_map_try_emplace 201411L |
| 264 | 269 | // # define __cpp_lib_math_special_functions 201603L |
| 265 | // # define __cpp_lib_memory_resource 201603L | |
| 270 | # define __cpp_lib_memory_resource 201603L | |
| 266 | 271 | # define __cpp_lib_node_extract 201606L |
| 267 | 272 | # define __cpp_lib_nonmember_container_access 201411L |
| 268 | 273 | # define __cpp_lib_not_fn 201603L |
| ... | ... | @@ -312,7 +317,7 @@ __cpp_lib_void_t 201411L <type_traits> |
| 312 | 317 | # endif |
| 313 | 318 | # define __cpp_lib_concepts 202002L |
| 314 | 319 | # define __cpp_lib_constexpr_algorithms 201806L |
| 315 | // # define __cpp_lib_constexpr_complex 201711L | |
| 320 | # define __cpp_lib_constexpr_complex 201711L | |
| 316 | 321 | # define __cpp_lib_constexpr_dynamic_alloc 201907L |
| 317 | 322 | # define __cpp_lib_constexpr_functional 201907L |
| 318 | 323 | # define __cpp_lib_constexpr_iterator 201811L |
| ... | ... | @@ -322,7 +327,7 @@ __cpp_lib_void_t 201411L <type_traits> |
| 322 | 327 | # define __cpp_lib_constexpr_string_view 201811L |
| 323 | 328 | # define __cpp_lib_constexpr_tuple 201811L |
| 324 | 329 | # define __cpp_lib_constexpr_utility 201811L |
| 325 | // # define __cpp_lib_constexpr_vector 201907L | |
| 330 | # define __cpp_lib_constexpr_vector 201907L | |
| 326 | 331 | # define __cpp_lib_coroutine 201902L |
| 327 | 332 | # if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L |
| 328 | 333 | # define __cpp_lib_destroying_delete 201806L |
| ... | ... | @@ -350,10 +355,8 @@ __cpp_lib_void_t 201411L <type_traits> |
| 350 | 355 | # endif |
| 351 | 356 | # define __cpp_lib_list_remove_return_type 201806L |
| 352 | 357 | # define __cpp_lib_math_constants 201907L |
| 353 | // # define __cpp_lib_polymorphic_allocator 201902L | |
| 354 | # if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) | |
| 355 | # define __cpp_lib_ranges 201811L | |
| 356 | # endif | |
| 358 | # define __cpp_lib_polymorphic_allocator 201902L | |
| 359 | # define __cpp_lib_ranges 202106L | |
| 357 | 360 | # define __cpp_lib_remove_cvref 201711L |
| 358 | 361 | # if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) |
| 359 | 362 | # define __cpp_lib_semaphore 201907L |
| ... | ... | @@ -362,7 +365,9 @@ __cpp_lib_void_t 201411L <type_traits> |
| 362 | 365 | # define __cpp_lib_shared_ptr_arrays 201707L |
| 363 | 366 | # define __cpp_lib_shift 201806L |
| 364 | 367 | // # define __cpp_lib_smart_ptr_for_overwrite 202002L |
| 365 | // # define __cpp_lib_source_location 201907L | |
| 368 | # if __has_builtin(__builtin_source_location) | |
| 369 | # define __cpp_lib_source_location 201907L | |
| 370 | # endif | |
| 366 | 371 | # define __cpp_lib_span 202002L |
| 367 | 372 | # define __cpp_lib_ssize 201902L |
| 368 | 373 | # define __cpp_lib_starts_ends_with 201711L |
| ... | ... | @@ -382,8 +387,14 @@ __cpp_lib_void_t 201411L <type_traits> |
| 382 | 387 | // # define __cpp_lib_associative_heterogeneous_erasure 202110L |
| 383 | 388 | // # define __cpp_lib_bind_back 202202L |
| 384 | 389 | # define __cpp_lib_byteswap 202110L |
| 390 | # define __cpp_lib_constexpr_bitset 202207L | |
| 391 | # define __cpp_lib_constexpr_charconv 202207L | |
| 385 | 392 | // # define __cpp_lib_constexpr_cmath 202202L |
| 393 | # undef __cpp_lib_constexpr_memory | |
| 394 | # define __cpp_lib_constexpr_memory 202202L | |
| 386 | 395 | // # define __cpp_lib_constexpr_typeinfo 202106L |
| 396 | # define __cpp_lib_expected 202202L | |
| 397 | # define __cpp_lib_forward_like 202207L | |
| 387 | 398 | // # define __cpp_lib_invoke_r 202106L |
| 388 | 399 | # define __cpp_lib_is_scoped_enum 202011L |
| 389 | 400 | // # define __cpp_lib_move_only_function 202110L |
lib/libcxx/include/wchar.h+3-1| ... | ... | @@ -120,7 +120,9 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, |
| 120 | 120 | #define __CORRECT_ISO_CPP_WCHAR_H_PROTO |
| 121 | 121 | #endif |
| 122 | 122 | |
| 123 | #include_next <wchar.h> | |
| 123 | # if __has_include_next(<wchar.h>) | |
| 124 | # include_next <wchar.h> | |
| 125 | # endif | |
| 124 | 126 | |
| 125 | 127 | // Determine whether we have const-correct overloads for wcschr and friends. |
| 126 | 128 | #if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_) |
lib/libcxx/src/atomic.cpp+24-3| ... | ... | @@ -26,6 +26,11 @@ |
| 26 | 26 | # define SYS_futex SYS_futex_time64 |
| 27 | 27 | #endif |
| 28 | 28 | |
| 29 | #elif defined(__FreeBSD__) | |
| 30 | ||
| 31 | #include <sys/types.h> | |
| 32 | #include <sys/umtx.h> | |
| 33 | ||
| 29 | 34 | #else // <- Add other operating systems here |
| 30 | 35 | |
| 31 | 36 | // Baseline needs no new headers |
| ... | ... | @@ -52,11 +57,11 @@ static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const vo |
| 52 | 57 | #elif defined(__APPLE__) && defined(_LIBCPP_USE_ULOCK) |
| 53 | 58 | |
| 54 | 59 | extern "C" int __ulock_wait(uint32_t operation, void *addr, uint64_t value, |
| 55 | 		uint32_t timeout); /* timeout is specified in microseconds */ | |
| 60 | uint32_t timeout); /* timeout is specified in microseconds */ | |
| 56 | 61 | extern "C" int __ulock_wake(uint32_t operation, void *addr, uint64_t wake_value); |
| 57 | 62 | |
| 58 | #define UL_COMPARE_AND_WAIT				1 | |
| 59 | #define ULF_WAKE_ALL					0x00000100 | |
| 63 | #define UL_COMPARE_AND_WAIT 1 | |
| 64 | #define ULF_WAKE_ALL 0x00000100 | |
| 60 | 65 | |
| 61 | 66 | static void __libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr, |
| 62 | 67 | __cxx_contention_t __val) |
| ... | ... | @@ -72,6 +77,22 @@ static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const vo |
| 72 | 77 | const_cast<__cxx_atomic_contention_t*>(__ptr), 0); |
| 73 | 78 | } |
| 74 | 79 | |
| 80 | #elif defined(__FreeBSD__) | |
| 81 | ||
| 82 | static void __libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr, | |
| 83 | __cxx_contention_t __val) | |
| 84 | { | |
| 85 | _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr), | |
| 86 | UMTX_OP_WAIT_UINT_PRIVATE, __val, NULL, NULL); | |
| 87 | } | |
| 88 | ||
| 89 | static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr, | |
| 90 | bool __notify_one) | |
| 91 | { | |
| 92 | _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr), | |
| 93 | UMTX_OP_WAKE_PRIVATE, __notify_one ? 1 : INT_MAX, NULL, NULL); | |
| 94 | } | |
| 95 | ||
| 75 | 96 | #else // <- Add other operating systems here |
| 76 | 97 | |
| 77 | 98 | // Baseline is just a timed backoff |
lib/libcxx/src/charconv.cpp+2-2| ... | ... | @@ -21,13 +21,13 @@ namespace __itoa |
| 21 | 21 | _LIBCPP_FUNC_VIS char* |
| 22 | 22 | __u32toa(uint32_t value, char* buffer) noexcept |
| 23 | 23 | { |
| 24 | 	return __base_10_u32(buffer, value); | |
| 24 | return __base_10_u32(buffer, value); | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | _LIBCPP_FUNC_VIS char* |
| 28 | 28 | __u64toa(uint64_t value, char* buffer) noexcept |
| 29 | 29 | { |
| 30 | 	return __base_10_u64(buffer, value); | |
| 30 | return __base_10_u64(buffer, value); | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | } // namespace __itoa |
lib/libcxx/src/experimental/memory_resource.cpp+3-1| ... | ... | @@ -8,6 +8,8 @@ |
| 8 | 8 | |
| 9 | 9 | #include <experimental/memory_resource> |
| 10 | 10 | |
| 11 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 12 | ||
| 11 | 13 | #ifndef _LIBCPP_HAS_NO_ATOMIC_HEADER |
| 12 | 14 | # include <atomic> |
| 13 | 15 | #elif !defined(_LIBCPP_HAS_NO_THREADS) |
| ... | ... | @@ -72,7 +74,7 @@ union ResourceInitHelper { |
| 72 | 74 | __null_memory_resource_imp null_res; |
| 73 | 75 | } resources; |
| 74 | 76 | char dummy; |
| 75 | _LIBCPP_CONSTEXPR_AFTER_CXX11 ResourceInitHelper() : resources() {} | |
| 77 | _LIBCPP_CONSTEXPR_SINCE_CXX14 ResourceInitHelper() : resources() {} | |
| 76 | 78 | ~ResourceInitHelper() {} |
| 77 | 79 | }; |
| 78 | 80 |
lib/libcxx/src/filesystem/filesystem_common.h+10-10| ... | ... | @@ -124,7 +124,7 @@ error_code make_windows_error(int err) { |
| 124 | 124 | template <class T> |
| 125 | 125 | T error_value(); |
| 126 | 126 | template <> |
| 127 | _LIBCPP_CONSTEXPR_AFTER_CXX11 void error_value<void>() {} | |
| 127 | _LIBCPP_CONSTEXPR_SINCE_CXX14 void error_value<void>() {} | |
| 128 | 128 | template <> |
| 129 | 129 | bool error_value<bool>() { |
| 130 | 130 | return false; |
| ... | ... | @@ -140,7 +140,7 @@ uintmax_t error_value<uintmax_t>() { |
| 140 | 140 | return uintmax_t(-1); |
| 141 | 141 | } |
| 142 | 142 | template <> |
| 143 | _LIBCPP_CONSTEXPR_AFTER_CXX11 file_time_type error_value<file_time_type>() { | |
| 143 | _LIBCPP_CONSTEXPR_SINCE_CXX14 file_time_type error_value<file_time_type>() { | |
| 144 | 144 | return file_time_type::min(); |
| 145 | 145 | } |
| 146 | 146 | template <> |
| ... | ... | @@ -309,7 +309,7 @@ struct time_util_base { |
| 309 | 309 | .count(); |
| 310 | 310 | |
| 311 | 311 | private: |
| 312 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 fs_duration get_min_nsecs() { | |
| 312 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 fs_duration get_min_nsecs() { | |
| 313 | 313 | return duration_cast<fs_duration>( |
| 314 | 314 | fs_nanoseconds(min_nsec_timespec) - |
| 315 | 315 | duration_cast<fs_nanoseconds>(fs_seconds(1))); |
| ... | ... | @@ -319,7 +319,7 @@ private: |
| 319 | 319 | FileTimeT::duration::min(), |
| 320 | 320 | "value doesn't roundtrip"); |
| 321 | 321 | |
| 322 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 bool check_range() { | |
| 322 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool check_range() { | |
| 323 | 323 | // This kinda sucks, but it's what happens when we don't have __int128_t. |
| 324 | 324 | if (sizeof(TimeT) == sizeof(rep)) { |
| 325 | 325 | typedef duration<long long, ratio<3600 * 24 * 365> > Years; |
| ... | ... | @@ -385,7 +385,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> { |
| 385 | 385 | |
| 386 | 386 | public: |
| 387 | 387 | template <class CType, class ChronoType> |
| 388 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 bool checked_set(CType* out, | |
| 388 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool checked_set(CType* out, | |
| 389 | 389 | ChronoType time) { |
| 390 | 390 | using Lim = numeric_limits<CType>; |
| 391 | 391 | if (time > Lim::max() || time < Lim::min()) |
| ... | ... | @@ -394,7 +394,7 @@ public: |
| 394 | 394 | return true; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 bool is_representable(TimeSpecT tm) { | |
| 397 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool is_representable(TimeSpecT tm) { | |
| 398 | 398 | if (tm.tv_sec >= 0) { |
| 399 | 399 | return tm.tv_sec < max_seconds || |
| 400 | 400 | (tm.tv_sec == max_seconds && tm.tv_nsec <= max_nsec); |
| ... | ... | @@ -405,7 +405,7 @@ public: |
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 bool is_representable(FileTimeT tm) { | |
| 408 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool is_representable(FileTimeT tm) { | |
| 409 | 409 | auto secs = duration_cast<fs_seconds>(tm.time_since_epoch()); |
| 410 | 410 | auto nsecs = duration_cast<fs_nanoseconds>(tm.time_since_epoch() - secs); |
| 411 | 411 | if (nsecs.count() < 0) { |
| ... | ... | @@ -418,7 +418,7 @@ public: |
| 418 | 418 | return secs.count() >= TLim::min(); |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 FileTimeT | |
| 421 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 FileTimeT | |
| 422 | 422 | convert_from_timespec(TimeSpecT tm) { |
| 423 | 423 | if (tm.tv_sec >= 0 || tm.tv_nsec == 0) { |
| 424 | 424 | return FileTimeT(fs_seconds(tm.tv_sec) + |
| ... | ... | @@ -432,7 +432,7 @@ public: |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | template <class SubSecT> |
| 435 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 bool | |
| 435 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool | |
| 436 | 436 | set_times_checked(TimeT* sec_out, SubSecT* subsec_out, FileTimeT tp) { |
| 437 | 437 | auto dur = tp.time_since_epoch(); |
| 438 | 438 | auto sec_dur = duration_cast<fs_seconds>(dur); |
| ... | ... | @@ -449,7 +449,7 @@ public: |
| 449 | 449 | return checked_set(sec_out, sec_dur.count()) && |
| 450 | 450 | checked_set(subsec_out, subsec_dur.count()); |
| 451 | 451 | } |
| 452 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 bool convert_to_timespec(TimeSpecT& dest, | |
| 452 | static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool convert_to_timespec(TimeSpecT& dest, | |
| 453 | 453 | FileTimeT tp) { |
| 454 | 454 | if (!is_representable(tp)) |
| 455 | 455 | return false; |
lib/libcxx/src/filesystem/operations.cpp+2-1| ... | ... | @@ -1348,7 +1348,7 @@ bool __remove(const path& p, error_code* ec) { |
| 1348 | 1348 | // |
| 1349 | 1349 | // The second implementation is used on platforms where `openat()` & friends are available, |
| 1350 | 1350 | // and it threads file descriptors through recursive calls to avoid such race conditions. |
| 1351 | #if defined(_LIBCPP_WIN32API) | |
| 1351 | #if defined(_LIBCPP_WIN32API) || defined (__MVS__) | |
| 1352 | 1352 | # define REMOVE_ALL_USE_DIRECTORY_ITERATOR |
| 1353 | 1353 | #endif |
| 1354 | 1354 | |
| ... | ... | @@ -1408,6 +1408,7 @@ struct scope_exit { |
| 1408 | 1408 | private: |
| 1409 | 1409 | Cleanup cleanup_; |
| 1410 | 1410 | }; |
| 1411 | _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(scope_exit); | |
| 1411 | 1412 | |
| 1412 | 1413 | uintmax_t remove_all_impl(int parent_directory, const path& p, error_code& ec) { |
| 1413 | 1414 | // First, try to open the path as a directory. |
lib/libcxx/src/format.cpp+2| ... | ... | @@ -10,6 +10,8 @@ |
| 10 | 10 | |
| 11 | 11 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 12 | 12 | |
| 13 | #ifndef _LIBCPP_INLINE_FORMAT_ERROR_DTOR | |
| 13 | 14 | format_error::~format_error() noexcept = default; |
| 15 | #endif | |
| 14 | 16 | |
| 15 | 17 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/include/apple_availability.h+1| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | 6 | // |
| 7 | 7 | //===----------------------------------------------------------------------===// |
| 8 | ||
| 8 | 9 | #ifndef _LIBCPP_SRC_INCLUDE_APPLE_AVAILABILITY_H |
| 9 | 10 | #define _LIBCPP_SRC_INCLUDE_APPLE_AVAILABILITY_H |
| 10 | 11 |
lib/libcxx/src/include/ryu/digit_table.h+1-1| ... | ... | @@ -50,7 +50,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 50 | 50 | // In order to minimize the diff in the Ryu code between MSVC STL and libc++ |
| 51 | 51 | // the code uses the name __DIGIT_TABLE. In order to avoid code duplication it |
| 52 | 52 | // reuses the table already available in libc++. |
| 53 | inline constexpr auto& __DIGIT_TABLE = __itoa::__table<>::__digits_base_10; | |
| 53 | inline constexpr auto& __DIGIT_TABLE = __itoa::__digits_base_10; | |
| 54 | 54 | |
| 55 | 55 | _LIBCPP_END_NAMESPACE_STD |
| 56 | 56 |
lib/libcxx/src/ios.cpp+5-5| ... | ... | @@ -145,11 +145,11 @@ int ios_base::__xindex_ = 0; |
| 145 | 145 | template <typename _Tp> |
| 146 | 146 | static size_t __ios_new_cap(size_t __req_size, size_t __current_cap) |
| 147 | 147 | { // Precondition: __req_size > __current_cap |
| 148 | 	const size_t mx = std::numeric_limits<size_t>::max() / sizeof(_Tp); | |
| 149 | 	if (__req_size < mx/2) | |
| 150 | 		return _VSTD::max(2 * __current_cap, __req_size); | |
| 151 | 	else | |
| 152 | 		return mx; | |
| 148 | const size_t mx = std::numeric_limits<size_t>::max() / sizeof(_Tp); | |
| 149 | if (__req_size < mx/2) | |
| 150 | return _VSTD::max(2 * __current_cap, __req_size); | |
| 151 | else | |
| 152 | return mx; | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | int |
lib/libcxx/src/ios.instantiations.cpp+3| ... | ... | @@ -36,9 +36,12 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringbuf<char>; |
| 36 | 36 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringstream<char>; |
| 37 | 37 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostringstream<char>; |
| 38 | 38 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istringstream<char>; |
| 39 | ||
| 40 | #ifndef _LIBCPP_HAS_NO_FSTREAM | |
| 39 | 41 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ifstream<char>; |
| 40 | 42 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ofstream<char>; |
| 41 | 43 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_filebuf<char>; |
| 44 | #endif | |
| 42 | 45 | |
| 43 | 46 | // Add more here if needed... |
| 44 | 47 |
lib/libcxx/src/iostream.cpp+2-2| ... | ... | @@ -109,8 +109,8 @@ static void force_locale_initialization() { |
| 109 | 109 | |
| 110 | 110 | class DoIOSInit { |
| 111 | 111 | public: |
| 112 | 	DoIOSInit(); | |
| 113 | 	~DoIOSInit(); | |
| 112 | DoIOSInit(); | |
| 113 | ~DoIOSInit(); | |
| 114 | 114 | }; |
| 115 | 115 | |
| 116 | 116 | DoIOSInit::DoIOSInit() |
lib/libcxx/src/locale.cpp+160-167| ... | ... | @@ -141,14 +141,7 @@ class _LIBCPP_HIDDEN locale::__imp |
| 141 | 141 | : public facet |
| 142 | 142 | { |
| 143 | 143 | enum {N = 30}; |
| 144 | #if defined(_LIBCPP_COMPILER_MSVC) | |
| 145 | // FIXME: MSVC doesn't support aligned parameters by value. | |
| 146 | // I can't get the __sso_allocator to work here | |
| 147 | // for MSVC I think for this reason. | |
| 148 | vector<facet*> facets_; | |
| 149 | #else | |
| 150 | 144 | vector<facet*, __sso_allocator<facet*, N> > facets_; |
| 151 | #endif | |
| 152 | 145 | string name_; |
| 153 | 146 | public: |
| 154 | 147 | explicit __imp(size_t refs = 0); |
| ... | ... | @@ -739,25 +732,25 @@ locale::id::__init() |
| 739 | 732 | |
| 740 | 733 | collate_byname<char>::collate_byname(const char* n, size_t refs) |
| 741 | 734 | : collate<char>(refs), |
| 742 | __l(newlocale(LC_ALL_MASK, n, 0)) | |
| 735 | __l_(newlocale(LC_ALL_MASK, n, 0)) | |
| 743 | 736 | { |
| 744 | if (__l == 0) | |
| 737 | if (__l_ == 0) | |
| 745 | 738 | __throw_runtime_error("collate_byname<char>::collate_byname" |
| 746 | 739 | " failed to construct for " + string(n)); |
| 747 | 740 | } |
| 748 | 741 | |
| 749 | 742 | collate_byname<char>::collate_byname(const string& name, size_t refs) |
| 750 | 743 | : collate<char>(refs), |
| 751 | __l(newlocale(LC_ALL_MASK, name.c_str(), 0)) | |
| 744 | __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) | |
| 752 | 745 | { |
| 753 | if (__l == 0) | |
| 746 | if (__l_ == 0) | |
| 754 | 747 | __throw_runtime_error("collate_byname<char>::collate_byname" |
| 755 | 748 | " failed to construct for " + name); |
| 756 | 749 | } |
| 757 | 750 | |
| 758 | 751 | collate_byname<char>::~collate_byname() |
| 759 | 752 | { |
| 760 | freelocale(__l); | |
| 753 | freelocale(__l_); | |
| 761 | 754 | } |
| 762 | 755 | |
| 763 | 756 | int |
| ... | ... | @@ -766,7 +759,7 @@ collate_byname<char>::do_compare(const char_type* __lo1, const char_type* __hi1, |
| 766 | 759 | { |
| 767 | 760 | string_type lhs(__lo1, __hi1); |
| 768 | 761 | string_type rhs(__lo2, __hi2); |
| 769 | int r = strcoll_l(lhs.c_str(), rhs.c_str(), __l); | |
| 762 | int r = strcoll_l(lhs.c_str(), rhs.c_str(), __l_); | |
| 770 | 763 | if (r < 0) |
| 771 | 764 | return -1; |
| 772 | 765 | if (r > 0) |
| ... | ... | @@ -778,8 +771,8 @@ collate_byname<char>::string_type |
| 778 | 771 | collate_byname<char>::do_transform(const char_type* lo, const char_type* hi) const |
| 779 | 772 | { |
| 780 | 773 | const string_type in(lo, hi); |
| 781 | string_type out(strxfrm_l(0, in.c_str(), 0, __l), char()); | |
| 782 | strxfrm_l(const_cast<char*>(out.c_str()), in.c_str(), out.size()+1, __l); | |
| 774 | string_type out(strxfrm_l(0, in.c_str(), 0, __l_), char()); | |
| 775 | strxfrm_l(const_cast<char*>(out.c_str()), in.c_str(), out.size()+1, __l_); | |
| 783 | 776 | return out; |
| 784 | 777 | } |
| 785 | 778 | |
| ... | ... | @@ -788,25 +781,25 @@ collate_byname<char>::do_transform(const char_type* lo, const char_type* hi) con |
| 788 | 781 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 789 | 782 | collate_byname<wchar_t>::collate_byname(const char* n, size_t refs) |
| 790 | 783 | : collate<wchar_t>(refs), |
| 791 | __l(newlocale(LC_ALL_MASK, n, 0)) | |
| 784 | __l_(newlocale(LC_ALL_MASK, n, 0)) | |
| 792 | 785 | { |
| 793 | if (__l == 0) | |
| 786 | if (__l_ == 0) | |
| 794 | 787 | __throw_runtime_error("collate_byname<wchar_t>::collate_byname(size_t refs)" |
| 795 | 788 | " failed to construct for " + string(n)); |
| 796 | 789 | } |
| 797 | 790 | |
| 798 | 791 | collate_byname<wchar_t>::collate_byname(const string& name, size_t refs) |
| 799 | 792 | : collate<wchar_t>(refs), |
| 800 | __l(newlocale(LC_ALL_MASK, name.c_str(), 0)) | |
| 793 | __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) | |
| 801 | 794 | { |
| 802 | if (__l == 0) | |
| 795 | if (__l_ == 0) | |
| 803 | 796 | __throw_runtime_error("collate_byname<wchar_t>::collate_byname(size_t refs)" |
| 804 | 797 | " failed to construct for " + name); |
| 805 | 798 | } |
| 806 | 799 | |
| 807 | 800 | collate_byname<wchar_t>::~collate_byname() |
| 808 | 801 | { |
| 809 | freelocale(__l); | |
| 802 | freelocale(__l_); | |
| 810 | 803 | } |
| 811 | 804 | |
| 812 | 805 | int |
| ... | ... | @@ -815,7 +808,7 @@ collate_byname<wchar_t>::do_compare(const char_type* __lo1, const char_type* __h |
| 815 | 808 | { |
| 816 | 809 | string_type lhs(__lo1, __hi1); |
| 817 | 810 | string_type rhs(__lo2, __hi2); |
| 818 | int r = wcscoll_l(lhs.c_str(), rhs.c_str(), __l); | |
| 811 | int r = wcscoll_l(lhs.c_str(), rhs.c_str(), __l_); | |
| 819 | 812 | if (r < 0) |
| 820 | 813 | return -1; |
| 821 | 814 | if (r > 0) |
| ... | ... | @@ -827,8 +820,8 @@ collate_byname<wchar_t>::string_type |
| 827 | 820 | collate_byname<wchar_t>::do_transform(const char_type* lo, const char_type* hi) const |
| 828 | 821 | { |
| 829 | 822 | const string_type in(lo, hi); |
| 830 | string_type out(wcsxfrm_l(0, in.c_str(), 0, __l), wchar_t()); | |
| 831 | wcsxfrm_l(const_cast<wchar_t*>(out.c_str()), in.c_str(), out.size()+1, __l); | |
| 823 | string_type out(wcsxfrm_l(0, in.c_str(), 0, __l_), wchar_t()); | |
| 824 | wcsxfrm_l(const_cast<wchar_t*>(out.c_str()), in.c_str(), out.size()+1, __l_); | |
| 832 | 825 | return out; |
| 833 | 826 | } |
| 834 | 827 | #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| ... | ... | @@ -1190,7 +1183,7 @@ ctype<char>::classic_table() noexcept |
| 1190 | 1183 | const ctype<char>::mask* |
| 1191 | 1184 | ctype<char>::classic_table() noexcept |
| 1192 | 1185 | { |
| 1193 | #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) | |
| 1186 | #if defined(__APPLE__) || defined(__FreeBSD__) | |
| 1194 | 1187 | return _DefaultRuneLocale.__runetype; |
| 1195 | 1188 | #elif defined(__NetBSD__) |
| 1196 | 1189 | return _C_ctype_tab_ + 1; |
| ... | ... | @@ -1286,52 +1279,52 @@ ctype<char>::__classic_upper_table() _NOEXCEPT |
| 1286 | 1279 | |
| 1287 | 1280 | ctype_byname<char>::ctype_byname(const char* name, size_t refs) |
| 1288 | 1281 | : ctype<char>(0, false, refs), |
| 1289 | __l(newlocale(LC_ALL_MASK, name, 0)) | |
| 1282 | __l_(newlocale(LC_ALL_MASK, name, 0)) | |
| 1290 | 1283 | { |
| 1291 | if (__l == 0) | |
| 1284 | if (__l_ == 0) | |
| 1292 | 1285 | __throw_runtime_error("ctype_byname<char>::ctype_byname" |
| 1293 | 1286 | " failed to construct for " + string(name)); |
| 1294 | 1287 | } |
| 1295 | 1288 | |
| 1296 | 1289 | ctype_byname<char>::ctype_byname(const string& name, size_t refs) |
| 1297 | 1290 | : ctype<char>(0, false, refs), |
| 1298 | __l(newlocale(LC_ALL_MASK, name.c_str(), 0)) | |
| 1291 | __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) | |
| 1299 | 1292 | { |
| 1300 | if (__l == 0) | |
| 1293 | if (__l_ == 0) | |
| 1301 | 1294 | __throw_runtime_error("ctype_byname<char>::ctype_byname" |
| 1302 | 1295 | " failed to construct for " + name); |
| 1303 | 1296 | } |
| 1304 | 1297 | |
| 1305 | 1298 | ctype_byname<char>::~ctype_byname() |
| 1306 | 1299 | { |
| 1307 | freelocale(__l); | |
| 1300 | freelocale(__l_); | |
| 1308 | 1301 | } |
| 1309 | 1302 | |
| 1310 | 1303 | char |
| 1311 | 1304 | ctype_byname<char>::do_toupper(char_type c) const |
| 1312 | 1305 | { |
| 1313 | return static_cast<char>(toupper_l(static_cast<unsigned char>(c), __l)); | |
| 1306 | return static_cast<char>(toupper_l(static_cast<unsigned char>(c), __l_)); | |
| 1314 | 1307 | } |
| 1315 | 1308 | |
| 1316 | 1309 | const char* |
| 1317 | 1310 | ctype_byname<char>::do_toupper(char_type* low, const char_type* high) const |
| 1318 | 1311 | { |
| 1319 | 1312 | for (; low != high; ++low) |
| 1320 | *low = static_cast<char>(toupper_l(static_cast<unsigned char>(*low), __l)); | |
| 1313 | *low = static_cast<char>(toupper_l(static_cast<unsigned char>(*low), __l_)); | |
| 1321 | 1314 | return low; |
| 1322 | 1315 | } |
| 1323 | 1316 | |
| 1324 | 1317 | char |
| 1325 | 1318 | ctype_byname<char>::do_tolower(char_type c) const |
| 1326 | 1319 | { |
| 1327 | return static_cast<char>(tolower_l(static_cast<unsigned char>(c), __l)); | |
| 1320 | return static_cast<char>(tolower_l(static_cast<unsigned char>(c), __l_)); | |
| 1328 | 1321 | } |
| 1329 | 1322 | |
| 1330 | 1323 | const char* |
| 1331 | 1324 | ctype_byname<char>::do_tolower(char_type* low, const char_type* high) const |
| 1332 | 1325 | { |
| 1333 | 1326 | for (; low != high; ++low) |
| 1334 | *low = static_cast<char>(tolower_l(static_cast<unsigned char>(*low), __l)); | |
| 1327 | *low = static_cast<char>(tolower_l(static_cast<unsigned char>(*low), __l_)); | |
| 1335 | 1328 | return low; |
| 1336 | 1329 | } |
| 1337 | 1330 | |
| ... | ... | @@ -1340,45 +1333,45 @@ ctype_byname<char>::do_tolower(char_type* low, const char_type* high) const |
| 1340 | 1333 | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 1341 | 1334 | ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs) |
| 1342 | 1335 | : ctype<wchar_t>(refs), |
| 1343 | __l(newlocale(LC_ALL_MASK, name, 0)) | |
| 1336 | __l_(newlocale(LC_ALL_MASK, name, 0)) | |
| 1344 | 1337 | { |
| 1345 | if (__l == 0) | |
| 1338 | if (__l_ == 0) | |
| 1346 | 1339 | __throw_runtime_error("ctype_byname<wchar_t>::ctype_byname" |
| 1347 | 1340 | " failed to construct for " + string(name)); |
| 1348 | 1341 | } |
| 1349 | 1342 | |
| 1350 | 1343 | ctype_byname<wchar_t>::ctype_byname(const string& name, size_t refs) |
| 1351 | 1344 | : ctype<wchar_t>(refs), |
| 1352 | __l(newlocale(LC_ALL_MASK, name.c_str(), 0)) | |
| 1345 | __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) | |
| 1353 | 1346 | { |
| 1354 | if (__l == 0) | |
| 1347 | if (__l_ == 0) | |
| 1355 | 1348 | __throw_runtime_error("ctype_byname<wchar_t>::ctype_byname" |
| 1356 | 1349 | " failed to construct for " + name); |
| 1357 | 1350 | } |
| 1358 | 1351 | |
| 1359 | 1352 | ctype_byname<wchar_t>::~ctype_byname() |
| 1360 | 1353 | { |
| 1361 | freelocale(__l); | |
| 1354 | freelocale(__l_); | |
| 1362 | 1355 | } |
| 1363 | 1356 | |
| 1364 | 1357 | bool |
| 1365 | 1358 | ctype_byname<wchar_t>::do_is(mask m, char_type c) const |
| 1366 | 1359 | { |
| 1367 | 1360 | #ifdef _LIBCPP_WCTYPE_IS_MASK |
| 1368 | return static_cast<bool>(iswctype_l(c, m, __l)); | |
| 1361 | return static_cast<bool>(iswctype_l(c, m, __l_)); | |
| 1369 | 1362 | #else |
| 1370 | 1363 | bool result = false; |
| 1371 | 1364 | wint_t ch = static_cast<wint_t>(c); |
| 1372 | if ((m & space) == space) result |= (iswspace_l(ch, __l) != 0); | |
| 1373 | if ((m & print) == print) result |= (iswprint_l(ch, __l) != 0); | |
| 1374 | if ((m & cntrl) == cntrl) result |= (iswcntrl_l(ch, __l) != 0); | |
| 1375 | if ((m & upper) == upper) result |= (iswupper_l(ch, __l) != 0); | |
| 1376 | if ((m & lower) == lower) result |= (iswlower_l(ch, __l) != 0); | |
| 1377 | if ((m & alpha) == alpha) result |= (iswalpha_l(ch, __l) != 0); | |
| 1378 | if ((m & digit) == digit) result |= (iswdigit_l(ch, __l) != 0); | |
| 1379 | if ((m & punct) == punct) result |= (iswpunct_l(ch, __l) != 0); | |
| 1380 | if ((m & xdigit) == xdigit) result |= (iswxdigit_l(ch, __l) != 0); | |
| 1381 | if ((m & blank) == blank) result |= (iswblank_l(ch, __l) != 0); | |
| 1365 | if ((m & space) == space) result |= (iswspace_l(ch, __l_) != 0); | |
| 1366 | if ((m & print) == print) result |= (iswprint_l(ch, __l_) != 0); | |
| 1367 | if ((m & cntrl) == cntrl) result |= (iswcntrl_l(ch, __l_) != 0); | |
| 1368 | if ((m & upper) == upper) result |= (iswupper_l(ch, __l_) != 0); | |
| 1369 | if ((m & lower) == lower) result |= (iswlower_l(ch, __l_) != 0); | |
| 1370 | if ((m & alpha) == alpha) result |= (iswalpha_l(ch, __l_) != 0); | |
| 1371 | if ((m & digit) == digit) result |= (iswdigit_l(ch, __l_) != 0); | |
| 1372 | if ((m & punct) == punct) result |= (iswpunct_l(ch, __l_) != 0); | |
| 1373 | if ((m & xdigit) == xdigit) result |= (iswxdigit_l(ch, __l_) != 0); | |
| 1374 | if ((m & blank) == blank) result |= (iswblank_l(ch, __l_) != 0); | |
| 1382 | 1375 | return result; |
| 1383 | 1376 | #endif |
| 1384 | 1377 | } |
| ... | ... | @@ -1394,32 +1387,32 @@ ctype_byname<wchar_t>::do_is(const char_type* low, const char_type* high, mask* |
| 1394 | 1387 | { |
| 1395 | 1388 | *vec = 0; |
| 1396 | 1389 | wint_t ch = static_cast<wint_t>(*low); |
| 1397 | if (iswspace_l(ch, __l)) | |
| 1390 | if (iswspace_l(ch, __l_)) | |
| 1398 | 1391 | *vec |= space; |
| 1399 | 1392 | #ifndef _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT |
| 1400 | if (iswprint_l(ch, __l)) | |
| 1393 | if (iswprint_l(ch, __l_)) | |
| 1401 | 1394 | *vec |= print; |
| 1402 | 1395 | #endif |
| 1403 | if (iswcntrl_l(ch, __l)) | |
| 1396 | if (iswcntrl_l(ch, __l_)) | |
| 1404 | 1397 | *vec |= cntrl; |
| 1405 | if (iswupper_l(ch, __l)) | |
| 1398 | if (iswupper_l(ch, __l_)) | |
| 1406 | 1399 | *vec |= upper; |
| 1407 | if (iswlower_l(ch, __l)) | |
| 1400 | if (iswlower_l(ch, __l_)) | |
| 1408 | 1401 | *vec |= lower; |
| 1409 | 1402 | #ifndef _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA |
| 1410 | if (iswalpha_l(ch, __l)) | |
| 1403 | if (iswalpha_l(ch, __l_)) | |
| 1411 | 1404 | *vec |= alpha; |
| 1412 | 1405 | #endif |
| 1413 | if (iswdigit_l(ch, __l)) | |
| 1406 | if (iswdigit_l(ch, __l_)) | |
| 1414 | 1407 | *vec |= digit; |
| 1415 | if (iswpunct_l(ch, __l)) | |
| 1408 | if (iswpunct_l(ch, __l_)) | |
| 1416 | 1409 | *vec |= punct; |
| 1417 | 1410 | #ifndef _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT |
| 1418 | if (iswxdigit_l(ch, __l)) | |
| 1411 | if (iswxdigit_l(ch, __l_)) | |
| 1419 | 1412 | *vec |= xdigit; |
| 1420 | 1413 | #endif |
| 1421 | 1414 | #if !defined(__sun__) |
| 1422 | if (iswblank_l(ch, __l)) | |
| 1415 | if (iswblank_l(ch, __l_)) | |
| 1423 | 1416 | *vec |= blank; |
| 1424 | 1417 | #endif |
| 1425 | 1418 | } |
| ... | ... | @@ -1433,20 +1426,20 @@ ctype_byname<wchar_t>::do_scan_is(mask m, const char_type* low, const char_type* |
| 1433 | 1426 | for (; low != high; ++low) |
| 1434 | 1427 | { |
| 1435 | 1428 | #ifdef _LIBCPP_WCTYPE_IS_MASK |
| 1436 | if (iswctype_l(*low, m, __l)) | |
| 1429 | if (iswctype_l(*low, m, __l_)) | |
| 1437 | 1430 | break; |
| 1438 | 1431 | #else |
| 1439 | 1432 | wint_t ch = static_cast<wint_t>(*low); |
| 1440 | if ((m & space) == space && iswspace_l(ch, __l)) break; | |
| 1441 | if ((m & print) == print && iswprint_l(ch, __l)) break; | |
| 1442 | if ((m & cntrl) == cntrl && iswcntrl_l(ch, __l)) break; | |
| 1443 | if ((m & upper) == upper && iswupper_l(ch, __l)) break; | |
| 1444 | if ((m & lower) == lower && iswlower_l(ch, __l)) break; | |
| 1445 | if ((m & alpha) == alpha && iswalpha_l(ch, __l)) break; | |
| 1446 | if ((m & digit) == digit && iswdigit_l(ch, __l)) break; | |
| 1447 | if ((m & punct) == punct && iswpunct_l(ch, __l)) break; | |
| 1448 | if ((m & xdigit) == xdigit && iswxdigit_l(ch, __l)) break; | |
| 1449 | if ((m & blank) == blank && iswblank_l(ch, __l)) break; | |
| 1433 | if ((m & space) == space && iswspace_l(ch, __l_)) break; | |
| 1434 | if ((m & print) == print && iswprint_l(ch, __l_)) break; | |
| 1435 | if ((m & cntrl) == cntrl && iswcntrl_l(ch, __l_)) break; | |
| 1436 | if ((m & upper) == upper && iswupper_l(ch, __l_)) break; | |
| 1437 | if ((m & lower) == lower && iswlower_l(ch, __l_)) break; | |
| 1438 | if ((m & alpha) == alpha && iswalpha_l(ch, __l_)) break; | |
| 1439 | if ((m & digit) == digit && iswdigit_l(ch, __l_)) break; | |
| 1440 | if ((m & punct) == punct && iswpunct_l(ch, __l_)) break; | |
| 1441 | if ((m & xdigit) == xdigit && iswxdigit_l(ch, __l_)) break; | |
| 1442 | if ((m & blank) == blank && iswblank_l(ch, __l_)) break; | |
| 1450 | 1443 | #endif |
| 1451 | 1444 | } |
| 1452 | 1445 | return low; |
| ... | ... | @@ -1458,20 +1451,20 @@ ctype_byname<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type |
| 1458 | 1451 | for (; low != high; ++low) |
| 1459 | 1452 | { |
| 1460 | 1453 | #ifdef _LIBCPP_WCTYPE_IS_MASK |
| 1461 | if (!iswctype_l(*low, m, __l)) | |
| 1454 | if (!iswctype_l(*low, m, __l_)) | |
| 1462 | 1455 | break; |
| 1463 | 1456 | #else |
| 1464 | 1457 | wint_t ch = static_cast<wint_t>(*low); |
| 1465 | if ((m & space) == space && iswspace_l(ch, __l)) continue; | |
| 1466 | if ((m & print) == print && iswprint_l(ch, __l)) continue; | |
| 1467 | if ((m & cntrl) == cntrl && iswcntrl_l(ch, __l)) continue; | |
| 1468 | if ((m & upper) == upper && iswupper_l(ch, __l)) continue; | |
| 1469 | if ((m & lower) == lower && iswlower_l(ch, __l)) continue; | |
| 1470 | if ((m & alpha) == alpha && iswalpha_l(ch, __l)) continue; | |
| 1471 | if ((m & digit) == digit && iswdigit_l(ch, __l)) continue; | |
| 1472 | if ((m & punct) == punct && iswpunct_l(ch, __l)) continue; | |
| 1473 | if ((m & xdigit) == xdigit && iswxdigit_l(ch, __l)) continue; | |
| 1474 | if ((m & blank) == blank && iswblank_l(ch, __l)) continue; | |
| 1458 | if ((m & space) == space && iswspace_l(ch, __l_)) continue; | |
| 1459 | if ((m & print) == print && iswprint_l(ch, __l_)) continue; | |
| 1460 | if ((m & cntrl) == cntrl && iswcntrl_l(ch, __l_)) continue; | |
| 1461 | if ((m & upper) == upper && iswupper_l(ch, __l_)) continue; | |
| 1462 | if ((m & lower) == lower && iswlower_l(ch, __l_)) continue; | |
| 1463 | if ((m & alpha) == alpha && iswalpha_l(ch, __l_)) continue; | |
| 1464 | if ((m & digit) == digit && iswdigit_l(ch, __l_)) continue; | |
| 1465 | if ((m & punct) == punct && iswpunct_l(ch, __l_)) continue; | |
| 1466 | if ((m & xdigit) == xdigit && iswxdigit_l(ch, __l_)) continue; | |
| 1467 | if ((m & blank) == blank && iswblank_l(ch, __l_)) continue; | |
| 1475 | 1468 | break; |
| 1476 | 1469 | #endif |
| 1477 | 1470 | } |
| ... | ... | @@ -1481,49 +1474,49 @@ ctype_byname<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type |
| 1481 | 1474 | wchar_t |
| 1482 | 1475 | ctype_byname<wchar_t>::do_toupper(char_type c) const |
| 1483 | 1476 | { |
| 1484 | return towupper_l(c, __l); | |
| 1477 | return towupper_l(c, __l_); | |
| 1485 | 1478 | } |
| 1486 | 1479 | |
| 1487 | 1480 | const wchar_t* |
| 1488 | 1481 | ctype_byname<wchar_t>::do_toupper(char_type* low, const char_type* high) const |
| 1489 | 1482 | { |
| 1490 | 1483 | for (; low != high; ++low) |
| 1491 | *low = towupper_l(*low, __l); | |
| 1484 | *low = towupper_l(*low, __l_); | |
| 1492 | 1485 | return low; |
| 1493 | 1486 | } |
| 1494 | 1487 | |
| 1495 | 1488 | wchar_t |
| 1496 | 1489 | ctype_byname<wchar_t>::do_tolower(char_type c) const |
| 1497 | 1490 | { |
| 1498 | return towlower_l(c, __l); | |
| 1491 | return towlower_l(c, __l_); | |
| 1499 | 1492 | } |
| 1500 | 1493 | |
| 1501 | 1494 | const wchar_t* |
| 1502 | 1495 | ctype_byname<wchar_t>::do_tolower(char_type* low, const char_type* high) const |
| 1503 | 1496 | { |
| 1504 | 1497 | for (; low != high; ++low) |
| 1505 | *low = towlower_l(*low, __l); | |
| 1498 | *low = towlower_l(*low, __l_); | |
| 1506 | 1499 | return low; |
| 1507 | 1500 | } |
| 1508 | 1501 | |
| 1509 | 1502 | wchar_t |
| 1510 | 1503 | ctype_byname<wchar_t>::do_widen(char c) const |
| 1511 | 1504 | { |
| 1512 | return __libcpp_btowc_l(c, __l); | |
| 1505 | return __libcpp_btowc_l(c, __l_); | |
| 1513 | 1506 | } |
| 1514 | 1507 | |
| 1515 | 1508 | const char* |
| 1516 | 1509 | ctype_byname<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const |
| 1517 | 1510 | { |
| 1518 | 1511 | for (; low != high; ++low, ++dest) |
| 1519 | *dest = __libcpp_btowc_l(*low, __l); | |
| 1512 | *dest = __libcpp_btowc_l(*low, __l_); | |
| 1520 | 1513 | return low; |
| 1521 | 1514 | } |
| 1522 | 1515 | |
| 1523 | 1516 | char |
| 1524 | 1517 | ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const |
| 1525 | 1518 | { |
| 1526 | int r = __libcpp_wctob_l(c, __l); | |
| 1519 | int r = __libcpp_wctob_l(c, __l_); | |
| 1527 | 1520 | return (r != EOF) ? static_cast<char>(r) : dfault; |
| 1528 | 1521 | } |
| 1529 | 1522 | |
| ... | ... | @@ -1532,7 +1525,7 @@ ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, ch |
| 1532 | 1525 | { |
| 1533 | 1526 | for (; low != high; ++low, ++dest) |
| 1534 | 1527 | { |
| 1535 | int r = __libcpp_wctob_l(*low, __l); | |
| 1528 | int r = __libcpp_wctob_l(*low, __l_); | |
| 1536 | 1529 | *dest = (r != EOF) ? static_cast<char>(r) : dfault; |
| 1537 | 1530 | } |
| 1538 | 1531 | return low; |
| ... | ... | @@ -1607,23 +1600,23 @@ locale::id codecvt<wchar_t, char, mbstate_t>::id; |
| 1607 | 1600 | |
| 1608 | 1601 | codecvt<wchar_t, char, mbstate_t>::codecvt(size_t refs) |
| 1609 | 1602 | : locale::facet(refs), |
| 1610 | __l(_LIBCPP_GET_C_LOCALE) | |
| 1603 | __l_(_LIBCPP_GET_C_LOCALE) | |
| 1611 | 1604 | { |
| 1612 | 1605 | } |
| 1613 | 1606 | |
| 1614 | 1607 | codecvt<wchar_t, char, mbstate_t>::codecvt(const char* nm, size_t refs) |
| 1615 | 1608 | : locale::facet(refs), |
| 1616 | __l(newlocale(LC_ALL_MASK, nm, 0)) | |
| 1609 | __l_(newlocale(LC_ALL_MASK, nm, 0)) | |
| 1617 | 1610 | { |
| 1618 | if (__l == 0) | |
| 1611 | if (__l_ == 0) | |
| 1619 | 1612 | __throw_runtime_error("codecvt_byname<wchar_t, char, mbstate_t>::codecvt_byname" |
| 1620 | 1613 | " failed to construct for " + string(nm)); |
| 1621 | 1614 | } |
| 1622 | 1615 | |
| 1623 | 1616 | codecvt<wchar_t, char, mbstate_t>::~codecvt() |
| 1624 | 1617 | { |
| 1625 | if (__l != _LIBCPP_GET_C_LOCALE) | |
| 1626 | freelocale(__l); | |
| 1618 | if (__l_ != _LIBCPP_GET_C_LOCALE) | |
| 1619 | freelocale(__l_); | |
| 1627 | 1620 | } |
| 1628 | 1621 | |
| 1629 | 1622 | codecvt<wchar_t, char, mbstate_t>::result |
| ... | ... | @@ -1643,13 +1636,13 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st, |
| 1643 | 1636 | // save state in case it is needed to recover to_nxt on error |
| 1644 | 1637 | mbstate_t save_state = st; |
| 1645 | 1638 | size_t n = __libcpp_wcsnrtombs_l(to, &frm_nxt, static_cast<size_t>(fend-frm), |
| 1646 | static_cast<size_t>(to_end-to), &st, __l); | |
| 1639 | static_cast<size_t>(to_end-to), &st, __l_); | |
| 1647 | 1640 | if (n == size_t(-1)) |
| 1648 | 1641 | { |
| 1649 | 1642 | // need to recover to_nxt |
| 1650 | 1643 | for (to_nxt = to; frm != frm_nxt; ++frm) |
| 1651 | 1644 | { |
| 1652 | n = __libcpp_wcrtomb_l(to_nxt, *frm, &save_state, __l); | |
| 1645 | n = __libcpp_wcrtomb_l(to_nxt, *frm, &save_state, __l_); | |
| 1653 | 1646 | if (n == size_t(-1)) |
| 1654 | 1647 | break; |
| 1655 | 1648 | to_nxt += n; |
| ... | ... | @@ -1666,7 +1659,7 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st, |
| 1666 | 1659 | { |
| 1667 | 1660 | // Try to write the terminating null |
| 1668 | 1661 | extern_type tmp[MB_LEN_MAX]; |
| 1669 | n = __libcpp_wcrtomb_l(tmp, intern_type(), &st, __l); | |
| 1662 | n = __libcpp_wcrtomb_l(tmp, intern_type(), &st, __l_); | |
| 1670 | 1663 | if (n == size_t(-1)) // on error |
| 1671 | 1664 | return error; |
| 1672 | 1665 | if (n > static_cast<size_t>(to_end-to_nxt)) // is there room? |
| ... | ... | @@ -1700,14 +1693,14 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st, |
| 1700 | 1693 | // save state in case it is needed to recover to_nxt on error |
| 1701 | 1694 | mbstate_t save_state = st; |
| 1702 | 1695 | size_t n = __libcpp_mbsnrtowcs_l(to, &frm_nxt, static_cast<size_t>(fend-frm), |
| 1703 | static_cast<size_t>(to_end-to), &st, __l); | |
| 1696 | static_cast<size_t>(to_end-to), &st, __l_); | |
| 1704 | 1697 | if (n == size_t(-1)) |
| 1705 | 1698 | { |
| 1706 | 1699 | // need to recover to_nxt |
| 1707 | 1700 | for (to_nxt = to; frm != frm_nxt; ++to_nxt) |
| 1708 | 1701 | { |
| 1709 | 1702 | n = __libcpp_mbrtowc_l(to_nxt, frm, static_cast<size_t>(fend-frm), |
| 1710 | &save_state, __l); | |
| 1703 | &save_state, __l_); | |
| 1711 | 1704 | switch (n) |
| 1712 | 1705 | { |
| 1713 | 1706 | case 0: |
| ... | ... | @@ -1735,7 +1728,7 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st, |
| 1735 | 1728 | if (fend != frm_end) // set up next null terminated sequence |
| 1736 | 1729 | { |
| 1737 | 1730 | // Try to write the terminating null |
| 1738 | n = __libcpp_mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l); | |
| 1731 | n = __libcpp_mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l_); | |
| 1739 | 1732 | if (n != 0) // on error |
| 1740 | 1733 | return error; |
| 1741 | 1734 | ++to_nxt; |
| ... | ... | @@ -1755,7 +1748,7 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st, |
| 1755 | 1748 | { |
| 1756 | 1749 | to_nxt = to; |
| 1757 | 1750 | extern_type tmp[MB_LEN_MAX]; |
| 1758 | size_t n = __libcpp_wcrtomb_l(tmp, intern_type(), &st, __l); | |
| 1751 | size_t n = __libcpp_wcrtomb_l(tmp, intern_type(), &st, __l_); | |
| 1759 | 1752 | if (n == size_t(-1) || n == 0) // on error |
| 1760 | 1753 | return error; |
| 1761 | 1754 | --n; |
| ... | ... | @@ -1769,11 +1762,11 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st, |
| 1769 | 1762 | int |
| 1770 | 1763 | codecvt<wchar_t, char, mbstate_t>::do_encoding() const noexcept |
| 1771 | 1764 | { |
| 1772 | if (__libcpp_mbtowc_l(nullptr, nullptr, MB_LEN_MAX, __l) != 0) | |
| 1765 | if (__libcpp_mbtowc_l(nullptr, nullptr, MB_LEN_MAX, __l_) != 0) | |
| 1773 | 1766 | return -1; |
| 1774 | 1767 | |
| 1775 | 1768 | // stateless encoding |
| 1776 | if (__l == 0 || __libcpp_mb_cur_max_l(__l) == 1) // there are no known constant length encodings | |
| 1769 | if (__l_ == 0 || __libcpp_mb_cur_max_l(__l_) == 1) // there are no known constant length encodings | |
| 1777 | 1770 | return 1; // which take more than 1 char to form a wchar_t |
| 1778 | 1771 | return 0; |
| 1779 | 1772 | } |
| ... | ... | @@ -1791,7 +1784,7 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st, |
| 1791 | 1784 | int nbytes = 0; |
| 1792 | 1785 | for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t) |
| 1793 | 1786 | { |
| 1794 | size_t n = __libcpp_mbrlen_l(frm, static_cast<size_t>(frm_end-frm), &st, __l); | |
| 1787 | size_t n = __libcpp_mbrlen_l(frm, static_cast<size_t>(frm_end-frm), &st, __l_); | |
| 1795 | 1788 | switch (n) |
| 1796 | 1789 | { |
| 1797 | 1790 | case 0: |
| ... | ... | @@ -1813,7 +1806,7 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st, |
| 1813 | 1806 | int |
| 1814 | 1807 | codecvt<wchar_t, char, mbstate_t>::do_max_length() const noexcept |
| 1815 | 1808 | { |
| 1816 | return __l == 0 ? 1 : static_cast<int>(__libcpp_mb_cur_max_l(__l)); | |
| 1809 | return __l_ == 0 ? 1 : static_cast<int>(__libcpp_mb_cur_max_l(__l_)); | |
| 1817 | 1810 | } |
| 1818 | 1811 | #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 1819 | 1812 | |
| ... | ... | @@ -3545,10 +3538,10 @@ __codecvt_utf8<wchar_t>::do_out(state_type&, |
| 3545 | 3538 | uint8_t* _to_nxt = _to; |
| 3546 | 3539 | #if defined(_LIBCPP_SHORT_WCHAR) |
| 3547 | 3540 | result r = ucs2_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3548 | _Maxcode_, _Mode_); | |
| 3541 | __maxcode_, __mode_); | |
| 3549 | 3542 | #else |
| 3550 | 3543 | result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3551 | _Maxcode_, _Mode_); | |
| 3544 | __maxcode_, __mode_); | |
| 3552 | 3545 | #endif |
| 3553 | 3546 | frm_nxt = frm + (_frm_nxt - _frm); |
| 3554 | 3547 | to_nxt = to + (_to_nxt - _to); |
| ... | ... | @@ -3568,13 +3561,13 @@ __codecvt_utf8<wchar_t>::do_in(state_type&, |
| 3568 | 3561 | uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end); |
| 3569 | 3562 | uint16_t* _to_nxt = _to; |
| 3570 | 3563 | result r = utf8_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3571 | _Maxcode_, _Mode_); | |
| 3564 | __maxcode_, __mode_); | |
| 3572 | 3565 | #else |
| 3573 | 3566 | uint32_t* _to = reinterpret_cast<uint32_t*>(to); |
| 3574 | 3567 | uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end); |
| 3575 | 3568 | uint32_t* _to_nxt = _to; |
| 3576 | 3569 | result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3577 | _Maxcode_, _Mode_); | |
| 3570 | __maxcode_, __mode_); | |
| 3578 | 3571 | #endif |
| 3579 | 3572 | frm_nxt = frm + (_frm_nxt - _frm); |
| 3580 | 3573 | to_nxt = to + (_to_nxt - _to); |
| ... | ... | @@ -3608,9 +3601,9 @@ __codecvt_utf8<wchar_t>::do_length(state_type&, |
| 3608 | 3601 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 3609 | 3602 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 3610 | 3603 | #if defined(_LIBCPP_SHORT_WCHAR) |
| 3611 | return utf8_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 3604 | return utf8_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 3612 | 3605 | #else |
| 3613 | return utf8_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 3606 | return utf8_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 3614 | 3607 | #endif |
| 3615 | 3608 | } |
| 3616 | 3609 | |
| ... | ... | @@ -3619,11 +3612,11 @@ int |
| 3619 | 3612 | __codecvt_utf8<wchar_t>::do_max_length() const noexcept |
| 3620 | 3613 | { |
| 3621 | 3614 | #if defined(_LIBCPP_SHORT_WCHAR) |
| 3622 | if (_Mode_ & consume_header) | |
| 3615 | if (__mode_ & consume_header) | |
| 3623 | 3616 | return 6; |
| 3624 | 3617 | return 3; |
| 3625 | 3618 | #else |
| 3626 | if (_Mode_ & consume_header) | |
| 3619 | if (__mode_ & consume_header) | |
| 3627 | 3620 | return 7; |
| 3628 | 3621 | return 4; |
| 3629 | 3622 | #endif |
| ... | ... | @@ -3644,7 +3637,7 @@ __codecvt_utf8<char16_t>::do_out(state_type&, |
| 3644 | 3637 | uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); |
| 3645 | 3638 | uint8_t* _to_nxt = _to; |
| 3646 | 3639 | result r = ucs2_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3647 | _Maxcode_, _Mode_); | |
| 3640 | __maxcode_, __mode_); | |
| 3648 | 3641 | frm_nxt = frm + (_frm_nxt - _frm); |
| 3649 | 3642 | to_nxt = to + (_to_nxt - _to); |
| 3650 | 3643 | return r; |
| ... | ... | @@ -3662,7 +3655,7 @@ __codecvt_utf8<char16_t>::do_in(state_type&, |
| 3662 | 3655 | uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end); |
| 3663 | 3656 | uint16_t* _to_nxt = _to; |
| 3664 | 3657 | result r = utf8_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3665 | _Maxcode_, _Mode_); | |
| 3658 | __maxcode_, __mode_); | |
| 3666 | 3659 | frm_nxt = frm + (_frm_nxt - _frm); |
| 3667 | 3660 | to_nxt = to + (_to_nxt - _to); |
| 3668 | 3661 | return r; |
| ... | ... | @@ -3694,14 +3687,14 @@ __codecvt_utf8<char16_t>::do_length(state_type&, |
| 3694 | 3687 | { |
| 3695 | 3688 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 3696 | 3689 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 3697 | return utf8_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 3690 | return utf8_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 3698 | 3691 | } |
| 3699 | 3692 | |
| 3700 | 3693 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 3701 | 3694 | int |
| 3702 | 3695 | __codecvt_utf8<char16_t>::do_max_length() const noexcept |
| 3703 | 3696 | { |
| 3704 | if (_Mode_ & consume_header) | |
| 3697 | if (__mode_ & consume_header) | |
| 3705 | 3698 | return 6; |
| 3706 | 3699 | return 3; |
| 3707 | 3700 | } |
| ... | ... | @@ -3721,7 +3714,7 @@ __codecvt_utf8<char32_t>::do_out(state_type&, |
| 3721 | 3714 | uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); |
| 3722 | 3715 | uint8_t* _to_nxt = _to; |
| 3723 | 3716 | result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3724 | _Maxcode_, _Mode_); | |
| 3717 | __maxcode_, __mode_); | |
| 3725 | 3718 | frm_nxt = frm + (_frm_nxt - _frm); |
| 3726 | 3719 | to_nxt = to + (_to_nxt - _to); |
| 3727 | 3720 | return r; |
| ... | ... | @@ -3739,7 +3732,7 @@ __codecvt_utf8<char32_t>::do_in(state_type&, |
| 3739 | 3732 | uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end); |
| 3740 | 3733 | uint32_t* _to_nxt = _to; |
| 3741 | 3734 | result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3742 | _Maxcode_, _Mode_); | |
| 3735 | __maxcode_, __mode_); | |
| 3743 | 3736 | frm_nxt = frm + (_frm_nxt - _frm); |
| 3744 | 3737 | to_nxt = to + (_to_nxt - _to); |
| 3745 | 3738 | return r; |
| ... | ... | @@ -3771,14 +3764,14 @@ __codecvt_utf8<char32_t>::do_length(state_type&, |
| 3771 | 3764 | { |
| 3772 | 3765 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 3773 | 3766 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 3774 | return utf8_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 3767 | return utf8_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 3775 | 3768 | } |
| 3776 | 3769 | |
| 3777 | 3770 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 3778 | 3771 | int |
| 3779 | 3772 | __codecvt_utf8<char32_t>::do_max_length() const noexcept |
| 3780 | 3773 | { |
| 3781 | if (_Mode_ & consume_header) | |
| 3774 | if (__mode_ & consume_header) | |
| 3782 | 3775 | return 7; |
| 3783 | 3776 | return 4; |
| 3784 | 3777 | } |
| ... | ... | @@ -3806,10 +3799,10 @@ __codecvt_utf16<wchar_t, false>::do_out(state_type&, |
| 3806 | 3799 | uint8_t* _to_nxt = _to; |
| 3807 | 3800 | #if defined(_LIBCPP_SHORT_WCHAR) |
| 3808 | 3801 | result r = ucs2_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3809 | _Maxcode_, _Mode_); | |
| 3802 | __maxcode_, __mode_); | |
| 3810 | 3803 | #else |
| 3811 | 3804 | result r = ucs4_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3812 | _Maxcode_, _Mode_); | |
| 3805 | __maxcode_, __mode_); | |
| 3813 | 3806 | #endif |
| 3814 | 3807 | frm_nxt = frm + (_frm_nxt - _frm); |
| 3815 | 3808 | to_nxt = to + (_to_nxt - _to); |
| ... | ... | @@ -3829,13 +3822,13 @@ __codecvt_utf16<wchar_t, false>::do_in(state_type&, |
| 3829 | 3822 | uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end); |
| 3830 | 3823 | uint16_t* _to_nxt = _to; |
| 3831 | 3824 | result r = utf16be_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3832 | _Maxcode_, _Mode_); | |
| 3825 | __maxcode_, __mode_); | |
| 3833 | 3826 | #else |
| 3834 | 3827 | uint32_t* _to = reinterpret_cast<uint32_t*>(to); |
| 3835 | 3828 | uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end); |
| 3836 | 3829 | uint32_t* _to_nxt = _to; |
| 3837 | 3830 | result r = utf16be_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3838 | _Maxcode_, _Mode_); | |
| 3831 | __maxcode_, __mode_); | |
| 3839 | 3832 | #endif |
| 3840 | 3833 | frm_nxt = frm + (_frm_nxt - _frm); |
| 3841 | 3834 | to_nxt = to + (_to_nxt - _to); |
| ... | ... | @@ -3869,9 +3862,9 @@ __codecvt_utf16<wchar_t, false>::do_length(state_type&, |
| 3869 | 3862 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 3870 | 3863 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 3871 | 3864 | #if defined(_LIBCPP_SHORT_WCHAR) |
| 3872 | return utf16be_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 3865 | return utf16be_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 3873 | 3866 | #else |
| 3874 | return utf16be_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 3867 | return utf16be_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 3875 | 3868 | #endif |
| 3876 | 3869 | } |
| 3877 | 3870 | |
| ... | ... | @@ -3879,11 +3872,11 @@ int |
| 3879 | 3872 | __codecvt_utf16<wchar_t, false>::do_max_length() const noexcept |
| 3880 | 3873 | { |
| 3881 | 3874 | #if defined(_LIBCPP_SHORT_WCHAR) |
| 3882 | if (_Mode_ & consume_header) | |
| 3875 | if (__mode_ & consume_header) | |
| 3883 | 3876 | return 4; |
| 3884 | 3877 | return 2; |
| 3885 | 3878 | #else |
| 3886 | if (_Mode_ & consume_header) | |
| 3879 | if (__mode_ & consume_header) | |
| 3887 | 3880 | return 6; |
| 3888 | 3881 | return 4; |
| 3889 | 3882 | #endif |
| ... | ... | @@ -3910,10 +3903,10 @@ __codecvt_utf16<wchar_t, true>::do_out(state_type&, |
| 3910 | 3903 | uint8_t* _to_nxt = _to; |
| 3911 | 3904 | #if defined(_LIBCPP_SHORT_WCHAR) |
| 3912 | 3905 | result r = ucs2_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3913 | _Maxcode_, _Mode_); | |
| 3906 | __maxcode_, __mode_); | |
| 3914 | 3907 | #else |
| 3915 | 3908 | result r = ucs4_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3916 | _Maxcode_, _Mode_); | |
| 3909 | __maxcode_, __mode_); | |
| 3917 | 3910 | #endif |
| 3918 | 3911 | frm_nxt = frm + (_frm_nxt - _frm); |
| 3919 | 3912 | to_nxt = to + (_to_nxt - _to); |
| ... | ... | @@ -3933,13 +3926,13 @@ __codecvt_utf16<wchar_t, true>::do_in(state_type&, |
| 3933 | 3926 | uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end); |
| 3934 | 3927 | uint16_t* _to_nxt = _to; |
| 3935 | 3928 | result r = utf16le_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3936 | _Maxcode_, _Mode_); | |
| 3929 | __maxcode_, __mode_); | |
| 3937 | 3930 | #else |
| 3938 | 3931 | uint32_t* _to = reinterpret_cast<uint32_t*>(to); |
| 3939 | 3932 | uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end); |
| 3940 | 3933 | uint32_t* _to_nxt = _to; |
| 3941 | 3934 | result r = utf16le_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 3942 | _Maxcode_, _Mode_); | |
| 3935 | __maxcode_, __mode_); | |
| 3943 | 3936 | #endif |
| 3944 | 3937 | frm_nxt = frm + (_frm_nxt - _frm); |
| 3945 | 3938 | to_nxt = to + (_to_nxt - _to); |
| ... | ... | @@ -3973,9 +3966,9 @@ __codecvt_utf16<wchar_t, true>::do_length(state_type&, |
| 3973 | 3966 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 3974 | 3967 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 3975 | 3968 | #if defined(_LIBCPP_SHORT_WCHAR) |
| 3976 | return utf16le_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 3969 | return utf16le_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 3977 | 3970 | #else |
| 3978 | return utf16le_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 3971 | return utf16le_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 3979 | 3972 | #endif |
| 3980 | 3973 | } |
| 3981 | 3974 | |
| ... | ... | @@ -3983,11 +3976,11 @@ int |
| 3983 | 3976 | __codecvt_utf16<wchar_t, true>::do_max_length() const noexcept |
| 3984 | 3977 | { |
| 3985 | 3978 | #if defined(_LIBCPP_SHORT_WCHAR) |
| 3986 | if (_Mode_ & consume_header) | |
| 3979 | if (__mode_ & consume_header) | |
| 3987 | 3980 | return 4; |
| 3988 | 3981 | return 2; |
| 3989 | 3982 | #else |
| 3990 | if (_Mode_ & consume_header) | |
| 3983 | if (__mode_ & consume_header) | |
| 3991 | 3984 | return 6; |
| 3992 | 3985 | return 4; |
| 3993 | 3986 | #endif |
| ... | ... | @@ -4008,7 +4001,7 @@ __codecvt_utf16<char16_t, false>::do_out(state_type&, |
| 4008 | 4001 | uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); |
| 4009 | 4002 | uint8_t* _to_nxt = _to; |
| 4010 | 4003 | result r = ucs2_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4011 | _Maxcode_, _Mode_); | |
| 4004 | __maxcode_, __mode_); | |
| 4012 | 4005 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4013 | 4006 | to_nxt = to + (_to_nxt - _to); |
| 4014 | 4007 | return r; |
| ... | ... | @@ -4026,7 +4019,7 @@ __codecvt_utf16<char16_t, false>::do_in(state_type&, |
| 4026 | 4019 | uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end); |
| 4027 | 4020 | uint16_t* _to_nxt = _to; |
| 4028 | 4021 | result r = utf16be_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4029 | _Maxcode_, _Mode_); | |
| 4022 | __maxcode_, __mode_); | |
| 4030 | 4023 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4031 | 4024 | to_nxt = to + (_to_nxt - _to); |
| 4032 | 4025 | return r; |
| ... | ... | @@ -4058,14 +4051,14 @@ __codecvt_utf16<char16_t, false>::do_length(state_type&, |
| 4058 | 4051 | { |
| 4059 | 4052 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 4060 | 4053 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 4061 | return utf16be_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 4054 | return utf16be_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 4062 | 4055 | } |
| 4063 | 4056 | |
| 4064 | 4057 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 4065 | 4058 | int |
| 4066 | 4059 | __codecvt_utf16<char16_t, false>::do_max_length() const noexcept |
| 4067 | 4060 | { |
| 4068 | if (_Mode_ & consume_header) | |
| 4061 | if (__mode_ & consume_header) | |
| 4069 | 4062 | return 4; |
| 4070 | 4063 | return 2; |
| 4071 | 4064 | } |
| ... | ... | @@ -4085,7 +4078,7 @@ __codecvt_utf16<char16_t, true>::do_out(state_type&, |
| 4085 | 4078 | uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); |
| 4086 | 4079 | uint8_t* _to_nxt = _to; |
| 4087 | 4080 | result r = ucs2_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4088 | _Maxcode_, _Mode_); | |
| 4081 | __maxcode_, __mode_); | |
| 4089 | 4082 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4090 | 4083 | to_nxt = to + (_to_nxt - _to); |
| 4091 | 4084 | return r; |
| ... | ... | @@ -4103,7 +4096,7 @@ __codecvt_utf16<char16_t, true>::do_in(state_type&, |
| 4103 | 4096 | uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end); |
| 4104 | 4097 | uint16_t* _to_nxt = _to; |
| 4105 | 4098 | result r = utf16le_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4106 | _Maxcode_, _Mode_); | |
| 4099 | __maxcode_, __mode_); | |
| 4107 | 4100 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4108 | 4101 | to_nxt = to + (_to_nxt - _to); |
| 4109 | 4102 | return r; |
| ... | ... | @@ -4135,14 +4128,14 @@ __codecvt_utf16<char16_t, true>::do_length(state_type&, |
| 4135 | 4128 | { |
| 4136 | 4129 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 4137 | 4130 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 4138 | return utf16le_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 4131 | return utf16le_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 4139 | 4132 | } |
| 4140 | 4133 | |
| 4141 | 4134 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 4142 | 4135 | int |
| 4143 | 4136 | __codecvt_utf16<char16_t, true>::do_max_length() const noexcept |
| 4144 | 4137 | { |
| 4145 | if (_Mode_ & consume_header) | |
| 4138 | if (__mode_ & consume_header) | |
| 4146 | 4139 | return 4; |
| 4147 | 4140 | return 2; |
| 4148 | 4141 | } |
| ... | ... | @@ -4162,7 +4155,7 @@ __codecvt_utf16<char32_t, false>::do_out(state_type&, |
| 4162 | 4155 | uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); |
| 4163 | 4156 | uint8_t* _to_nxt = _to; |
| 4164 | 4157 | result r = ucs4_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4165 | _Maxcode_, _Mode_); | |
| 4158 | __maxcode_, __mode_); | |
| 4166 | 4159 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4167 | 4160 | to_nxt = to + (_to_nxt - _to); |
| 4168 | 4161 | return r; |
| ... | ... | @@ -4180,7 +4173,7 @@ __codecvt_utf16<char32_t, false>::do_in(state_type&, |
| 4180 | 4173 | uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end); |
| 4181 | 4174 | uint32_t* _to_nxt = _to; |
| 4182 | 4175 | result r = utf16be_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4183 | _Maxcode_, _Mode_); | |
| 4176 | __maxcode_, __mode_); | |
| 4184 | 4177 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4185 | 4178 | to_nxt = to + (_to_nxt - _to); |
| 4186 | 4179 | return r; |
| ... | ... | @@ -4212,14 +4205,14 @@ __codecvt_utf16<char32_t, false>::do_length(state_type&, |
| 4212 | 4205 | { |
| 4213 | 4206 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 4214 | 4207 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 4215 | return utf16be_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 4208 | return utf16be_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 4216 | 4209 | } |
| 4217 | 4210 | |
| 4218 | 4211 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 4219 | 4212 | int |
| 4220 | 4213 | __codecvt_utf16<char32_t, false>::do_max_length() const noexcept |
| 4221 | 4214 | { |
| 4222 | if (_Mode_ & consume_header) | |
| 4215 | if (__mode_ & consume_header) | |
| 4223 | 4216 | return 6; |
| 4224 | 4217 | return 4; |
| 4225 | 4218 | } |
| ... | ... | @@ -4239,7 +4232,7 @@ __codecvt_utf16<char32_t, true>::do_out(state_type&, |
| 4239 | 4232 | uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); |
| 4240 | 4233 | uint8_t* _to_nxt = _to; |
| 4241 | 4234 | result r = ucs4_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4242 | _Maxcode_, _Mode_); | |
| 4235 | __maxcode_, __mode_); | |
| 4243 | 4236 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4244 | 4237 | to_nxt = to + (_to_nxt - _to); |
| 4245 | 4238 | return r; |
| ... | ... | @@ -4257,7 +4250,7 @@ __codecvt_utf16<char32_t, true>::do_in(state_type&, |
| 4257 | 4250 | uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end); |
| 4258 | 4251 | uint32_t* _to_nxt = _to; |
| 4259 | 4252 | result r = utf16le_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4260 | _Maxcode_, _Mode_); | |
| 4253 | __maxcode_, __mode_); | |
| 4261 | 4254 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4262 | 4255 | to_nxt = to + (_to_nxt - _to); |
| 4263 | 4256 | return r; |
| ... | ... | @@ -4289,14 +4282,14 @@ __codecvt_utf16<char32_t, true>::do_length(state_type&, |
| 4289 | 4282 | { |
| 4290 | 4283 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 4291 | 4284 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 4292 | return utf16le_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 4285 | return utf16le_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 4293 | 4286 | } |
| 4294 | 4287 | |
| 4295 | 4288 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 4296 | 4289 | int |
| 4297 | 4290 | __codecvt_utf16<char32_t, true>::do_max_length() const noexcept |
| 4298 | 4291 | { |
| 4299 | if (_Mode_ & consume_header) | |
| 4292 | if (__mode_ & consume_header) | |
| 4300 | 4293 | return 6; |
| 4301 | 4294 | return 4; |
| 4302 | 4295 | } |
| ... | ... | @@ -4323,7 +4316,7 @@ __codecvt_utf8_utf16<wchar_t>::do_out(state_type&, |
| 4323 | 4316 | uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); |
| 4324 | 4317 | uint8_t* _to_nxt = _to; |
| 4325 | 4318 | result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4326 | _Maxcode_, _Mode_); | |
| 4319 | __maxcode_, __mode_); | |
| 4327 | 4320 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4328 | 4321 | to_nxt = to + (_to_nxt - _to); |
| 4329 | 4322 | return r; |
| ... | ... | @@ -4347,7 +4340,7 @@ __codecvt_utf8_utf16<wchar_t>::do_in(state_type&, |
| 4347 | 4340 | uint32_t* _to_nxt = _to; |
| 4348 | 4341 | #endif |
| 4349 | 4342 | result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4350 | _Maxcode_, _Mode_); | |
| 4343 | __maxcode_, __mode_); | |
| 4351 | 4344 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4352 | 4345 | to_nxt = to + (_to_nxt - _to); |
| 4353 | 4346 | return r; |
| ... | ... | @@ -4379,13 +4372,13 @@ __codecvt_utf8_utf16<wchar_t>::do_length(state_type&, |
| 4379 | 4372 | { |
| 4380 | 4373 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 4381 | 4374 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 4382 | return utf8_to_utf16_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 4375 | return utf8_to_utf16_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 4383 | 4376 | } |
| 4384 | 4377 | |
| 4385 | 4378 | int |
| 4386 | 4379 | __codecvt_utf8_utf16<wchar_t>::do_max_length() const noexcept |
| 4387 | 4380 | { |
| 4388 | if (_Mode_ & consume_header) | |
| 4381 | if (__mode_ & consume_header) | |
| 4389 | 4382 | return 7; |
| 4390 | 4383 | return 4; |
| 4391 | 4384 | } |
| ... | ... | @@ -4405,7 +4398,7 @@ __codecvt_utf8_utf16<char16_t>::do_out(state_type&, |
| 4405 | 4398 | uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); |
| 4406 | 4399 | uint8_t* _to_nxt = _to; |
| 4407 | 4400 | result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4408 | _Maxcode_, _Mode_); | |
| 4401 | __maxcode_, __mode_); | |
| 4409 | 4402 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4410 | 4403 | to_nxt = to + (_to_nxt - _to); |
| 4411 | 4404 | return r; |
| ... | ... | @@ -4423,7 +4416,7 @@ __codecvt_utf8_utf16<char16_t>::do_in(state_type&, |
| 4423 | 4416 | uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end); |
| 4424 | 4417 | uint16_t* _to_nxt = _to; |
| 4425 | 4418 | result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4426 | _Maxcode_, _Mode_); | |
| 4419 | __maxcode_, __mode_); | |
| 4427 | 4420 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4428 | 4421 | to_nxt = to + (_to_nxt - _to); |
| 4429 | 4422 | return r; |
| ... | ... | @@ -4455,14 +4448,14 @@ __codecvt_utf8_utf16<char16_t>::do_length(state_type&, |
| 4455 | 4448 | { |
| 4456 | 4449 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 4457 | 4450 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 4458 | return utf8_to_utf16_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 4451 | return utf8_to_utf16_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 4459 | 4452 | } |
| 4460 | 4453 | |
| 4461 | 4454 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 4462 | 4455 | int |
| 4463 | 4456 | __codecvt_utf8_utf16<char16_t>::do_max_length() const noexcept |
| 4464 | 4457 | { |
| 4465 | if (_Mode_ & consume_header) | |
| 4458 | if (__mode_ & consume_header) | |
| 4466 | 4459 | return 7; |
| 4467 | 4460 | return 4; |
| 4468 | 4461 | } |
| ... | ... | @@ -4482,7 +4475,7 @@ __codecvt_utf8_utf16<char32_t>::do_out(state_type&, |
| 4482 | 4475 | uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); |
| 4483 | 4476 | uint8_t* _to_nxt = _to; |
| 4484 | 4477 | result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4485 | _Maxcode_, _Mode_); | |
| 4478 | __maxcode_, __mode_); | |
| 4486 | 4479 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4487 | 4480 | to_nxt = to + (_to_nxt - _to); |
| 4488 | 4481 | return r; |
| ... | ... | @@ -4500,7 +4493,7 @@ __codecvt_utf8_utf16<char32_t>::do_in(state_type&, |
| 4500 | 4493 | uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end); |
| 4501 | 4494 | uint32_t* _to_nxt = _to; |
| 4502 | 4495 | result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, |
| 4503 | _Maxcode_, _Mode_); | |
| 4496 | __maxcode_, __mode_); | |
| 4504 | 4497 | frm_nxt = frm + (_frm_nxt - _frm); |
| 4505 | 4498 | to_nxt = to + (_to_nxt - _to); |
| 4506 | 4499 | return r; |
| ... | ... | @@ -4532,14 +4525,14 @@ __codecvt_utf8_utf16<char32_t>::do_length(state_type&, |
| 4532 | 4525 | { |
| 4533 | 4526 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); |
| 4534 | 4527 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); |
| 4535 | return utf8_to_utf16_length(_frm, _frm_end, mx, _Maxcode_, _Mode_); | |
| 4528 | return utf8_to_utf16_length(_frm, _frm_end, mx, __maxcode_, __mode_); | |
| 4536 | 4529 | } |
| 4537 | 4530 | |
| 4538 | 4531 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 4539 | 4532 | int |
| 4540 | 4533 | __codecvt_utf8_utf16<char32_t>::do_max_length() const noexcept |
| 4541 | 4534 | { |
| 4542 | if (_Mode_ & consume_header) | |
| 4535 | if (__mode_ & consume_header) | |
| 4543 | 4536 | return 7; |
| 4544 | 4537 | return 4; |
| 4545 | 4538 | } |
| ... | ... | @@ -4805,7 +4798,7 @@ __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, |
| 4805 | 4798 | { |
| 4806 | 4799 | // if the grouping pattern is empty _or_ there are no grouping bits, then do nothing |
| 4807 | 4800 | // we always have at least a single entry in [__g, __g_end); the end of the input sequence |
| 4808 | 	if (__grouping.size() != 0 && __g_end - __g > 1) | |
| 4801 | if (__grouping.size() != 0 && __g_end - __g > 1) | |
| 4809 | 4802 | { |
| 4810 | 4803 | reverse(__g, __g_end); |
| 4811 | 4804 | const char* __ig = __grouping.data(); |
| ... | ... | @@ -4838,7 +4831,7 @@ __num_put_base::__format_int(char* __fmtp, const char* __len, bool __signd, |
| 4838 | 4831 | if ((__flags & ios_base::showpos) && |
| 4839 | 4832 | (__flags & ios_base::basefield) != ios_base::oct && |
| 4840 | 4833 | (__flags & ios_base::basefield) != ios_base::hex && |
| 4841 | 	__signd) | |
| 4834 | __signd) | |
| 4842 | 4835 | *__fmtp++ = '+'; |
| 4843 | 4836 | if (__flags & ios_base::showbase) |
| 4844 | 4837 | *__fmtp++ = '#'; |
lib/libcxx/src/memory.cpp+4-4| ... | ... | @@ -152,21 +152,21 @@ static constinit __libcpp_mutex_t mut_back[__sp_mut_count] = |
| 152 | 152 | }; |
| 153 | 153 | |
| 154 | 154 | _LIBCPP_CONSTEXPR __sp_mut::__sp_mut(void* p) noexcept |
| 155 | : __lx(p) | |
| 155 | : __lx_(p) | |
| 156 | 156 | { |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | void |
| 160 | 160 | __sp_mut::lock() noexcept |
| 161 | 161 | { |
| 162 | auto m = static_cast<__libcpp_mutex_t*>(__lx); | |
| 162 | auto m = static_cast<__libcpp_mutex_t*>(__lx_); | |
| 163 | 163 | __libcpp_mutex_lock(m); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | void |
| 167 | 167 | __sp_mut::unlock() noexcept |
| 168 | 168 | { |
| 169 | __libcpp_mutex_unlock(static_cast<__libcpp_mutex_t*>(__lx)); | |
| 169 | __libcpp_mutex_unlock(static_cast<__libcpp_mutex_t*>(__lx_)); | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | __sp_mut& |
| ... | ... | @@ -194,7 +194,7 @@ align(size_t alignment, size_t size, void*& ptr, size_t& space) |
| 194 | 194 | if (size <= space) |
| 195 | 195 | { |
| 196 | 196 | char* p1 = static_cast<char*>(ptr); |
| 197 | char* p2 = reinterpret_cast<char*>(reinterpret_cast<size_t>(p1 + (alignment - 1)) & -alignment); | |
| 197 | char* p2 = reinterpret_cast<char*>(reinterpret_cast<uintptr_t>(p1 + (alignment - 1)) & -alignment); | |
| 198 | 198 | size_t d = static_cast<size_t>(p2 - p1); |
| 199 | 199 | if (d <= space - size) |
| 200 | 200 | { |
lib/libcxx/src/memory_resource.cpp created+496| ... | ... | @@ -0,0 +1,496 @@ |
| 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 <memory> | |
| 10 | #include <memory_resource> | |
| 11 | ||
| 12 | #ifndef _LIBCPP_HAS_NO_ATOMIC_HEADER | |
| 13 | # include <atomic> | |
| 14 | #elif !defined(_LIBCPP_HAS_NO_THREADS) | |
| 15 | # include <mutex> | |
| 16 | # if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB) | |
| 17 | # pragma comment(lib, "pthread") | |
| 18 | # endif | |
| 19 | #endif | |
| 20 | ||
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 22 | ||
| 23 | namespace pmr { | |
| 24 | ||
| 25 | // memory_resource | |
| 26 | ||
| 27 | memory_resource::~memory_resource() = default; | |
| 28 | ||
| 29 | // new_delete_resource() | |
| 30 | ||
| 31 | #ifdef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION | |
| 32 | static bool is_aligned_to(void* ptr, size_t align) { | |
| 33 | void* p2 = ptr; | |
| 34 | size_t space = 1; | |
| 35 | void* result = std::align(align, 1, p2, space); | |
| 36 | return (result == ptr); | |
| 37 | } | |
| 38 | #endif | |
| 39 | ||
| 40 | class _LIBCPP_TYPE_VIS __new_delete_memory_resource_imp : public memory_resource { | |
| 41 | void* do_allocate(size_t bytes, size_t align) override { | |
| 42 | #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION | |
| 43 | return std::__libcpp_allocate(bytes, align); | |
| 44 | #else | |
| 45 | if (bytes == 0) | |
| 46 | bytes = 1; | |
| 47 | void* result = std::__libcpp_allocate(bytes, align); | |
| 48 | if (!is_aligned_to(result, align)) { | |
| 49 | std::__libcpp_deallocate(result, bytes, align); | |
| 50 | __throw_bad_alloc(); | |
| 51 | } | |
| 52 | return result; | |
| 53 | #endif | |
| 54 | } | |
| 55 | ||
| 56 | void do_deallocate(void* p, size_t bytes, size_t align) override { std::__libcpp_deallocate(p, bytes, align); } | |
| 57 | ||
| 58 | bool do_is_equal(const memory_resource& other) const noexcept override { return &other == this; } | |
| 59 | }; | |
| 60 | ||
| 61 | // null_memory_resource() | |
| 62 | ||
| 63 | class _LIBCPP_TYPE_VIS __null_memory_resource_imp : public memory_resource { | |
| 64 | void* do_allocate(size_t, size_t) override { __throw_bad_alloc(); } | |
| 65 | void do_deallocate(void*, size_t, size_t) override {} | |
| 66 | bool do_is_equal(const memory_resource& other) const noexcept override { return &other == this; } | |
| 67 | }; | |
| 68 | ||
| 69 | namespace { | |
| 70 | ||
| 71 | union ResourceInitHelper { | |
| 72 | struct { | |
| 73 | __new_delete_memory_resource_imp new_delete_res; | |
| 74 | __null_memory_resource_imp null_res; | |
| 75 | } resources; | |
| 76 | char dummy; | |
| 77 | _LIBCPP_CONSTEXPR_SINCE_CXX14 ResourceInitHelper() : resources() {} | |
| 78 | ~ResourceInitHelper() {} | |
| 79 | }; | |
| 80 | ||
| 81 | // Pretend we're inside a system header so the compiler doesn't flag the use of the init_priority | |
| 82 | // attribute with a value that's reserved for the implementation (we're the implementation). | |
| 83 | #include "memory_resource_init_helper.h" | |
| 84 | ||
| 85 | } // end namespace | |
| 86 | ||
| 87 | memory_resource* new_delete_resource() noexcept { return &res_init.resources.new_delete_res; } | |
| 88 | ||
| 89 | memory_resource* null_memory_resource() noexcept { return &res_init.resources.null_res; } | |
| 90 | ||
| 91 | // default_memory_resource() | |
| 92 | ||
| 93 | static memory_resource* __default_memory_resource(bool set = false, memory_resource* new_res = nullptr) noexcept { | |
| 94 | #ifndef _LIBCPP_HAS_NO_ATOMIC_HEADER | |
| 95 | static constinit atomic<memory_resource*> __res{&res_init.resources.new_delete_res}; | |
| 96 | if (set) { | |
| 97 | new_res = new_res ? new_res : new_delete_resource(); | |
| 98 | // TODO: Can a weaker ordering be used? | |
| 99 | return std::atomic_exchange_explicit(&__res, new_res, memory_order_acq_rel); | |
| 100 | } else { | |
| 101 | return std::atomic_load_explicit(&__res, memory_order_acquire); | |
| 102 | } | |
| 103 | #elif !defined(_LIBCPP_HAS_NO_THREADS) | |
| 104 | static constinit memory_resource* res = &res_init.resources.new_delete_res; | |
| 105 | static mutex res_lock; | |
| 106 | if (set) { | |
| 107 | new_res = new_res ? new_res : new_delete_resource(); | |
| 108 | lock_guard<mutex> guard(res_lock); | |
| 109 | memory_resource* old_res = res; | |
| 110 | res = new_res; | |
| 111 | return old_res; | |
| 112 | } else { | |
| 113 | lock_guard<mutex> guard(res_lock); | |
| 114 | return res; | |
| 115 | } | |
| 116 | #else | |
| 117 | static constinit memory_resource* res = &res_init.resources.new_delete_res; | |
| 118 | if (set) { | |
| 119 | new_res = new_res ? new_res : new_delete_resource(); | |
| 120 | memory_resource* old_res = res; | |
| 121 | res = new_res; | |
| 122 | return old_res; | |
| 123 | } else { | |
| 124 | return res; | |
| 125 | } | |
| 126 | #endif | |
| 127 | } | |
| 128 | ||
| 129 | memory_resource* get_default_resource() noexcept { return __default_memory_resource(); } | |
| 130 | ||
| 131 | memory_resource* set_default_resource(memory_resource* __new_res) noexcept { | |
| 132 | return __default_memory_resource(true, __new_res); | |
| 133 | } | |
| 134 | ||
| 135 | // 23.12.5, mem.res.pool | |
| 136 | ||
| 137 | static size_t roundup(size_t count, size_t alignment) { | |
| 138 | size_t mask = alignment - 1; | |
| 139 | return (count + mask) & ~mask; | |
| 140 | } | |
| 141 | ||
| 142 | struct unsynchronized_pool_resource::__adhoc_pool::__chunk_footer { | |
| 143 | __chunk_footer* __next_; | |
| 144 | char* __start_; | |
| 145 | size_t __align_; | |
| 146 | size_t __allocation_size() { return (reinterpret_cast<char*>(this) - __start_) + sizeof(*this); } | |
| 147 | }; | |
| 148 | ||
| 149 | void unsynchronized_pool_resource::__adhoc_pool::__release_ptr(memory_resource* upstream) { | |
| 150 | while (__first_ != nullptr) { | |
| 151 | __chunk_footer* next = __first_->__next_; | |
| 152 | upstream->deallocate(__first_->__start_, __first_->__allocation_size(), __first_->__align_); | |
| 153 | __first_ = next; | |
| 154 | } | |
| 155 | } | |
| 156 | ||
| 157 | void* unsynchronized_pool_resource::__adhoc_pool::__do_allocate(memory_resource* upstream, size_t bytes, size_t align) { | |
| 158 | const size_t footer_size = sizeof(__chunk_footer); | |
| 159 | const size_t footer_align = alignof(__chunk_footer); | |
| 160 | ||
| 161 | if (align < footer_align) | |
| 162 | align = footer_align; | |
| 163 | ||
| 164 | size_t aligned_capacity = roundup(bytes, footer_align) + footer_size; | |
| 165 | ||
| 166 | void* result = upstream->allocate(aligned_capacity, align); | |
| 167 | ||
| 168 | __chunk_footer* h = (__chunk_footer*)((char*)result + aligned_capacity - footer_size); | |
| 169 | h->__next_ = __first_; | |
| 170 | h->__start_ = (char*)result; | |
| 171 | h->__align_ = align; | |
| 172 | __first_ = h; | |
| 173 | return result; | |
| 174 | } | |
| 175 | ||
| 176 | void unsynchronized_pool_resource::__adhoc_pool::__do_deallocate( | |
| 177 | memory_resource* upstream, void* p, size_t bytes, size_t align) { | |
| 178 | _LIBCPP_ASSERT(__first_ != nullptr, "deallocating a block that was not allocated with this allocator"); | |
| 179 | if (__first_->__start_ == p) { | |
| 180 | __chunk_footer* next = __first_->__next_; | |
| 181 | upstream->deallocate(p, __first_->__allocation_size(), __first_->__align_); | |
| 182 | __first_ = next; | |
| 183 | } else { | |
| 184 | for (__chunk_footer* h = __first_; h->__next_ != nullptr; h = h->__next_) { | |
| 185 | if (h->__next_->__start_ == p) { | |
| 186 | __chunk_footer* next = h->__next_->__next_; | |
| 187 | upstream->deallocate(p, h->__next_->__allocation_size(), h->__next_->__align_); | |
| 188 | h->__next_ = next; | |
| 189 | return; | |
| 190 | } | |
| 191 | } | |
| 192 | _LIBCPP_ASSERT(false, "deallocating a block that was not allocated with this allocator"); | |
| 193 | } | |
| 194 | } | |
| 195 | ||
| 196 | class unsynchronized_pool_resource::__fixed_pool { | |
| 197 | struct __chunk_footer { | |
| 198 | __chunk_footer* __next_; | |
| 199 | char* __start_; | |
| 200 | size_t __align_; | |
| 201 | size_t __allocation_size() { return (reinterpret_cast<char*>(this) - __start_) + sizeof(*this); } | |
| 202 | }; | |
| 203 | ||
| 204 | struct __vacancy_header { | |
| 205 | __vacancy_header* __next_vacancy_; | |
| 206 | }; | |
| 207 | ||
| 208 | __chunk_footer* __first_chunk_ = nullptr; | |
| 209 | __vacancy_header* __first_vacancy_ = nullptr; | |
| 210 | ||
| 211 | public: | |
| 212 | explicit __fixed_pool() = default; | |
| 213 | ||
| 214 | void __release_ptr(memory_resource* upstream) { | |
| 215 | __first_vacancy_ = nullptr; | |
| 216 | while (__first_chunk_ != nullptr) { | |
| 217 | __chunk_footer* next = __first_chunk_->__next_; | |
| 218 | upstream->deallocate(__first_chunk_->__start_, __first_chunk_->__allocation_size(), __first_chunk_->__align_); | |
| 219 | __first_chunk_ = next; | |
| 220 | } | |
| 221 | } | |
| 222 | ||
| 223 | void* __try_allocate_from_vacancies() { | |
| 224 | if (__first_vacancy_ != nullptr) { | |
| 225 | void* result = __first_vacancy_; | |
| 226 | __first_vacancy_ = __first_vacancy_->__next_vacancy_; | |
| 227 | return result; | |
| 228 | } | |
| 229 | return nullptr; | |
| 230 | } | |
| 231 | ||
| 232 | void* __allocate_in_new_chunk(memory_resource* upstream, size_t block_size, size_t chunk_size) { | |
| 233 | _LIBCPP_ASSERT(chunk_size % block_size == 0, ""); | |
| 234 | static_assert(__default_alignment >= alignof(std::max_align_t), ""); | |
| 235 | static_assert(__default_alignment >= alignof(__chunk_footer), ""); | |
| 236 | static_assert(__default_alignment >= alignof(__vacancy_header), ""); | |
| 237 | ||
| 238 | const size_t footer_size = sizeof(__chunk_footer); | |
| 239 | const size_t footer_align = alignof(__chunk_footer); | |
| 240 | ||
| 241 | size_t aligned_capacity = roundup(chunk_size, footer_align) + footer_size; | |
| 242 | ||
| 243 | void* result = upstream->allocate(aligned_capacity, __default_alignment); | |
| 244 | ||
| 245 | __chunk_footer* h = (__chunk_footer*)((char*)result + aligned_capacity - footer_size); | |
| 246 | h->__next_ = __first_chunk_; | |
| 247 | h->__start_ = (char*)result; | |
| 248 | h->__align_ = __default_alignment; | |
| 249 | __first_chunk_ = h; | |
| 250 | ||
| 251 | if (chunk_size > block_size) { | |
| 252 | __vacancy_header* last_vh = this->__first_vacancy_; | |
| 253 | for (size_t i = block_size; i != chunk_size; i += block_size) { | |
| 254 | __vacancy_header* vh = (__vacancy_header*)((char*)result + i); | |
| 255 | vh->__next_vacancy_ = last_vh; | |
| 256 | last_vh = vh; | |
| 257 | } | |
| 258 | this->__first_vacancy_ = last_vh; | |
| 259 | } | |
| 260 | return result; | |
| 261 | } | |
| 262 | ||
| 263 | void __evacuate(void* p) { | |
| 264 | __vacancy_header* vh = (__vacancy_header*)(p); | |
| 265 | vh->__next_vacancy_ = __first_vacancy_; | |
| 266 | __first_vacancy_ = vh; | |
| 267 | } | |
| 268 | ||
| 269 | size_t __previous_chunk_size_in_bytes() const { return __first_chunk_ ? __first_chunk_->__allocation_size() : 0; } | |
| 270 | ||
| 271 | static const size_t __default_alignment = alignof(max_align_t); | |
| 272 | }; | |
| 273 | ||
| 274 | size_t unsynchronized_pool_resource::__pool_block_size(int i) const { return size_t(1) << __log2_pool_block_size(i); } | |
| 275 | ||
| 276 | int unsynchronized_pool_resource::__log2_pool_block_size(int i) const { return (i + __log2_smallest_block_size); } | |
| 277 | ||
| 278 | int unsynchronized_pool_resource::__pool_index(size_t bytes, size_t align) const { | |
| 279 | if (align > alignof(std::max_align_t) || bytes > (size_t(1) << __num_fixed_pools_)) | |
| 280 | return __num_fixed_pools_; | |
| 281 | else { | |
| 282 | int i = 0; | |
| 283 | bytes = (bytes > align) ? bytes : align; | |
| 284 | bytes -= 1; | |
| 285 | bytes >>= __log2_smallest_block_size; | |
| 286 | while (bytes != 0) { | |
| 287 | bytes >>= 1; | |
| 288 | i += 1; | |
| 289 | } | |
| 290 | return i; | |
| 291 | } | |
| 292 | } | |
| 293 | ||
| 294 | unsynchronized_pool_resource::unsynchronized_pool_resource(const pool_options& opts, memory_resource* upstream) | |
| 295 | : __res_(upstream), __fixed_pools_(nullptr) { | |
| 296 | size_t largest_block_size; | |
| 297 | if (opts.largest_required_pool_block == 0) | |
| 298 | largest_block_size = __default_largest_block_size; | |
| 299 | else if (opts.largest_required_pool_block < __smallest_block_size) | |
| 300 | largest_block_size = __smallest_block_size; | |
| 301 | else if (opts.largest_required_pool_block > __max_largest_block_size) | |
| 302 | largest_block_size = __max_largest_block_size; | |
| 303 | else | |
| 304 | largest_block_size = opts.largest_required_pool_block; | |
| 305 | ||
| 306 | if (opts.max_blocks_per_chunk == 0) | |
| 307 | __options_max_blocks_per_chunk_ = __max_blocks_per_chunk; | |
| 308 | else if (opts.max_blocks_per_chunk < __min_blocks_per_chunk) | |
| 309 | __options_max_blocks_per_chunk_ = __min_blocks_per_chunk; | |
| 310 | else if (opts.max_blocks_per_chunk > __max_blocks_per_chunk) | |
| 311 | __options_max_blocks_per_chunk_ = __max_blocks_per_chunk; | |
| 312 | else | |
| 313 | __options_max_blocks_per_chunk_ = opts.max_blocks_per_chunk; | |
| 314 | ||
| 315 | __num_fixed_pools_ = 1; | |
| 316 | size_t capacity = __smallest_block_size; | |
| 317 | while (capacity < largest_block_size) { | |
| 318 | capacity <<= 1; | |
| 319 | __num_fixed_pools_ += 1; | |
| 320 | } | |
| 321 | } | |
| 322 | ||
| 323 | pool_options unsynchronized_pool_resource::options() const { | |
| 324 | pool_options p; | |
| 325 | p.max_blocks_per_chunk = __options_max_blocks_per_chunk_; | |
| 326 | p.largest_required_pool_block = __pool_block_size(__num_fixed_pools_ - 1); | |
| 327 | return p; | |
| 328 | } | |
| 329 | ||
| 330 | void unsynchronized_pool_resource::release() { | |
| 331 | __adhoc_pool_.__release_ptr(__res_); | |
| 332 | if (__fixed_pools_ != nullptr) { | |
| 333 | const int n = __num_fixed_pools_; | |
| 334 | for (int i = 0; i < n; ++i) | |
| 335 | __fixed_pools_[i].__release_ptr(__res_); | |
| 336 | __res_->deallocate(__fixed_pools_, __num_fixed_pools_ * sizeof(__fixed_pool), alignof(__fixed_pool)); | |
| 337 | __fixed_pools_ = nullptr; | |
| 338 | } | |
| 339 | } | |
| 340 | ||
| 341 | void* unsynchronized_pool_resource::do_allocate(size_t bytes, size_t align) { | |
| 342 | // A pointer to allocated storage (6.6.4.4.1) with a size of at least bytes. | |
| 343 | // The size and alignment of the allocated memory shall meet the requirements for | |
| 344 | // a class derived from memory_resource (23.12). | |
| 345 | // If the pool selected for a block of size bytes is unable to satisfy the memory request | |
| 346 | // from its own internal data structures, it will call upstream_resource()->allocate() | |
| 347 | // to obtain more memory. If bytes is larger than that which the largest pool can handle, | |
| 348 | // then memory will be allocated using upstream_resource()->allocate(). | |
| 349 | ||
| 350 | int i = __pool_index(bytes, align); | |
| 351 | if (i == __num_fixed_pools_) | |
| 352 | return __adhoc_pool_.__do_allocate(__res_, bytes, align); | |
| 353 | else { | |
| 354 | if (__fixed_pools_ == nullptr) { | |
| 355 | __fixed_pools_ = | |
| 356 | (__fixed_pool*)__res_->allocate(__num_fixed_pools_ * sizeof(__fixed_pool), alignof(__fixed_pool)); | |
| 357 | __fixed_pool* first = __fixed_pools_; | |
| 358 | __fixed_pool* last = __fixed_pools_ + __num_fixed_pools_; | |
| 359 | for (__fixed_pool* pool = first; pool != last; ++pool) | |
| 360 | ::new ((void*)pool) __fixed_pool; | |
| 361 | } | |
| 362 | void* result = __fixed_pools_[i].__try_allocate_from_vacancies(); | |
| 363 | if (result == nullptr) { | |
| 364 | auto min = [](size_t a, size_t b) { return a < b ? a : b; }; | |
| 365 | auto max = [](size_t a, size_t b) { return a < b ? b : a; }; | |
| 366 | ||
| 367 | size_t prev_chunk_size_in_bytes = __fixed_pools_[i].__previous_chunk_size_in_bytes(); | |
| 368 | size_t prev_chunk_size_in_blocks = prev_chunk_size_in_bytes >> __log2_pool_block_size(i); | |
| 369 | ||
| 370 | size_t chunk_size_in_blocks; | |
| 371 | ||
| 372 | if (prev_chunk_size_in_blocks == 0) { | |
| 373 | size_t min_blocks_per_chunk = max(__min_bytes_per_chunk >> __log2_pool_block_size(i), __min_blocks_per_chunk); | |
| 374 | chunk_size_in_blocks = min_blocks_per_chunk; | |
| 375 | } else { | |
| 376 | static_assert(__max_bytes_per_chunk <= SIZE_MAX - (__max_bytes_per_chunk / 4), "unsigned overflow is possible"); | |
| 377 | chunk_size_in_blocks = prev_chunk_size_in_blocks + (prev_chunk_size_in_blocks / 4); | |
| 378 | } | |
| 379 | ||
| 380 | size_t max_blocks_per_chunk = | |
| 381 | min((__max_bytes_per_chunk >> __log2_pool_block_size(i)), | |
| 382 | min(__max_blocks_per_chunk, __options_max_blocks_per_chunk_)); | |
| 383 | if (chunk_size_in_blocks > max_blocks_per_chunk) | |
| 384 | chunk_size_in_blocks = max_blocks_per_chunk; | |
| 385 | ||
| 386 | size_t block_size = __pool_block_size(i); | |
| 387 | ||
| 388 | size_t chunk_size_in_bytes = (chunk_size_in_blocks << __log2_pool_block_size(i)); | |
| 389 | result = __fixed_pools_[i].__allocate_in_new_chunk(__res_, block_size, chunk_size_in_bytes); | |
| 390 | } | |
| 391 | return result; | |
| 392 | } | |
| 393 | } | |
| 394 | ||
| 395 | void unsynchronized_pool_resource::do_deallocate(void* p, size_t bytes, size_t align) { | |
| 396 | // Returns the memory at p to the pool. It is unspecified if, | |
| 397 | // or under what circumstances, this operation will result in | |
| 398 | // a call to upstream_resource()->deallocate(). | |
| 399 | ||
| 400 | int i = __pool_index(bytes, align); | |
| 401 | if (i == __num_fixed_pools_) | |
| 402 | return __adhoc_pool_.__do_deallocate(__res_, p, bytes, align); | |
| 403 | else { | |
| 404 | _LIBCPP_ASSERT(__fixed_pools_ != nullptr, "deallocating a block that was not allocated with this allocator"); | |
| 405 | __fixed_pools_[i].__evacuate(p); | |
| 406 | } | |
| 407 | } | |
| 408 | ||
| 409 | bool synchronized_pool_resource::do_is_equal(const memory_resource& other) const noexcept { return &other == this; } | |
| 410 | ||
| 411 | // 23.12.6, mem.res.monotonic.buffer | |
| 412 | ||
| 413 | static void* align_down(size_t align, size_t size, void*& ptr, size_t& space) { | |
| 414 | if (size > space) | |
| 415 | return nullptr; | |
| 416 | ||
| 417 | char* p1 = static_cast<char*>(ptr); | |
| 418 | char* new_ptr = reinterpret_cast<char*>(reinterpret_cast<uintptr_t>(p1 - size) & ~(align - 1)); | |
| 419 | ||
| 420 | if (new_ptr < (p1 - space)) | |
| 421 | return nullptr; | |
| 422 | ||
| 423 | ptr = new_ptr; | |
| 424 | space -= p1 - new_ptr; | |
| 425 | ||
| 426 | return ptr; | |
| 427 | } | |
| 428 | ||
| 429 | void* monotonic_buffer_resource::__initial_descriptor::__try_allocate_from_chunk(size_t bytes, size_t align) { | |
| 430 | if (!__cur_) | |
| 431 | return nullptr; | |
| 432 | void* new_ptr = static_cast<void*>(__cur_); | |
| 433 | size_t new_capacity = (__cur_ - __start_); | |
| 434 | void* aligned_ptr = align_down(align, bytes, new_ptr, new_capacity); | |
| 435 | if (aligned_ptr != nullptr) | |
| 436 | __cur_ = static_cast<char*>(new_ptr); | |
| 437 | return aligned_ptr; | |
| 438 | } | |
| 439 | ||
| 440 | void* monotonic_buffer_resource::__chunk_footer::__try_allocate_from_chunk(size_t bytes, size_t align) { | |
| 441 | void* new_ptr = static_cast<void*>(__cur_); | |
| 442 | size_t new_capacity = (__cur_ - __start_); | |
| 443 | void* aligned_ptr = align_down(align, bytes, new_ptr, new_capacity); | |
| 444 | if (aligned_ptr != nullptr) | |
| 445 | __cur_ = static_cast<char*>(new_ptr); | |
| 446 | return aligned_ptr; | |
| 447 | } | |
| 448 | ||
| 449 | void* monotonic_buffer_resource::do_allocate(size_t bytes, size_t align) { | |
| 450 | const size_t footer_size = sizeof(__chunk_footer); | |
| 451 | const size_t footer_align = alignof(__chunk_footer); | |
| 452 | ||
| 453 | auto previous_allocation_size = [&]() { | |
| 454 | if (__chunks_ != nullptr) | |
| 455 | return __chunks_->__allocation_size(); | |
| 456 | ||
| 457 | size_t newsize = (__initial_.__start_ != nullptr) ? (__initial_.__end_ - __initial_.__start_) : __initial_.__size_; | |
| 458 | ||
| 459 | return roundup(newsize, footer_align) + footer_size; | |
| 460 | }; | |
| 461 | ||
| 462 | if (void* result = __initial_.__try_allocate_from_chunk(bytes, align)) | |
| 463 | return result; | |
| 464 | if (__chunks_ != nullptr) { | |
| 465 | if (void* result = __chunks_->__try_allocate_from_chunk(bytes, align)) | |
| 466 | return result; | |
| 467 | } | |
| 468 | ||
| 469 | // Allocate a brand-new chunk. | |
| 470 | ||
| 471 | if (align < footer_align) | |
| 472 | align = footer_align; | |
| 473 | ||
| 474 | size_t aligned_capacity = roundup(bytes, footer_align) + footer_size; | |
| 475 | size_t previous_capacity = previous_allocation_size(); | |
| 476 | ||
| 477 | if (aligned_capacity <= previous_capacity) { | |
| 478 | size_t newsize = 2 * (previous_capacity - footer_size); | |
| 479 | aligned_capacity = roundup(newsize, footer_align) + footer_size; | |
| 480 | } | |
| 481 | ||
| 482 | char* start = (char*)__res_->allocate(aligned_capacity, align); | |
| 483 | auto end = start + aligned_capacity - footer_size; | |
| 484 | __chunk_footer* footer = (__chunk_footer*)(end); | |
| 485 | footer->__next_ = __chunks_; | |
| 486 | footer->__start_ = start; | |
| 487 | footer->__cur_ = end; | |
| 488 | footer->__align_ = align; | |
| 489 | __chunks_ = footer; | |
| 490 | ||
| 491 | return __chunks_->__try_allocate_from_chunk(bytes, align); | |
| 492 | } | |
| 493 | ||
| 494 | } // namespace pmr | |
| 495 | ||
| 496 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/memory_resource_init_helper.h created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | #pragma GCC system_header | |
| 2 | static constinit ResourceInitHelper res_init _LIBCPP_INIT_PRIORITY_MAX; |
lib/libcxx/src/optional.cpp+5-5| ... | ... | @@ -16,7 +16,7 @@ bad_optional_access::~bad_optional_access() noexcept = default; |
| 16 | 16 | |
| 17 | 17 | const char* bad_optional_access::what() const noexcept { |
| 18 | 18 | return "bad_optional_access"; |
| 19 | } | |
| 19 | } | |
| 20 | 20 | |
| 21 | 21 | } // std |
| 22 | 22 | |
| ... | ... | @@ -28,13 +28,13 @@ const char* bad_optional_access::what() const noexcept { |
| 28 | 28 | _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL |
| 29 | 29 | |
| 30 | 30 | class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access |
| 31 | : public std::logic_error | |
| 31 | : public std::logic_error | |
| 32 | 32 | { |
| 33 | 33 | public: |
| 34 | 	bad_optional_access() : std::logic_error("Bad optional Access") {} | |
| 34 | bad_optional_access() : std::logic_error("Bad optional Access") {} | |
| 35 | 35 | |
| 36 | //	Get the key function ~bad_optional_access() into the dylib | |
| 37 | virtual ~bad_optional_access() noexcept; | |
| 36 | // Get the key function ~bad_optional_access() into the dylib | |
| 37 | virtual ~bad_optional_access() noexcept; | |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | 40 | bad_optional_access::~bad_optional_access() noexcept = default; |
lib/libcxx/src/shared_mutex.cpp+7-7| ... | ... | @@ -106,13 +106,13 @@ __shared_mutex_base::unlock_shared() |
| 106 | 106 | |
| 107 | 107 | // Shared Timed Mutex |
| 108 | 108 | // These routines are here for ABI stability |
| 109 | shared_timed_mutex::shared_timed_mutex() : __base() {} | |
| 110 | void shared_timed_mutex::lock() { return __base.lock(); } | |
| 111 | bool shared_timed_mutex::try_lock() { return __base.try_lock(); } | |
| 112 | void shared_timed_mutex::unlock() { return __base.unlock(); } | |
| 113 | void shared_timed_mutex::lock_shared() { return __base.lock_shared(); } | |
| 114 | bool shared_timed_mutex::try_lock_shared() { return __base.try_lock_shared(); } | |
| 115 | void shared_timed_mutex::unlock_shared() { return __base.unlock_shared(); } | |
| 109 | shared_timed_mutex::shared_timed_mutex() : __base_() {} | |
| 110 | void shared_timed_mutex::lock() { return __base_.lock(); } | |
| 111 | bool shared_timed_mutex::try_lock() { return __base_.try_lock(); } | |
| 112 | void shared_timed_mutex::unlock() { return __base_.unlock(); } | |
| 113 | void shared_timed_mutex::lock_shared() { return __base_.lock_shared(); } | |
| 114 | bool shared_timed_mutex::try_lock_shared() { return __base_.try_lock_shared(); } | |
| 115 | void shared_timed_mutex::unlock_shared() { return __base_.unlock_shared(); } | |
| 116 | 116 | |
| 117 | 117 | _LIBCPP_END_NAMESPACE_STD |
| 118 | 118 |
lib/libcxx/src/string.cpp+2-2| ... | ... | @@ -85,7 +85,7 @@ template<typename V, typename S, typename F> |
| 85 | 85 | inline V as_integer_helper(const string& func, const S& str, size_t* idx, int base, F f) { |
| 86 | 86 | typename S::value_type* ptr = nullptr; |
| 87 | 87 | const typename S::value_type* const p = str.c_str(); |
| 88 | typename remove_reference<decltype(errno)>::type errno_save = errno; | |
| 88 | __libcpp_remove_reference_t<decltype(errno)> errno_save = errno; | |
| 89 | 89 | errno = 0; |
| 90 | 90 | V r = f(p, &ptr, base); |
| 91 | 91 | swap(errno, errno_save); |
| ... | ... | @@ -172,7 +172,7 @@ template<typename V, typename S, typename F> |
| 172 | 172 | inline V as_float_helper(const string& func, const S& str, size_t* idx, F f) { |
| 173 | 173 | typename S::value_type* ptr = nullptr; |
| 174 | 174 | const typename S::value_type* const p = str.c_str(); |
| 175 | typename remove_reference<decltype(errno)>::type errno_save = errno; | |
| 175 | __libcpp_remove_reference_t<decltype(errno)> errno_save = errno; | |
| 176 | 176 | errno = 0; |
| 177 | 177 | V r = f(p, &ptr); |
| 178 | 178 | swap(errno, errno_save); |
lib/libcxx/src/support/ibm/wcsnrtombs.cpp+1-1| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | // Converts `max_source_chars` from the wide character buffer pointer to by *`src`, |
| 15 | 15 | // into the multi byte character sequence buffer stored at `dst`, which must be |
| 16 | 16 | // `dst_size_bytes` bytes in size. Returns the number of bytes in the sequence |
| 17 | // converted from *src, excluding the null terminator. | |
| 17 | // converted from *src, excluding the null terminator. | |
| 18 | 18 | // Returns (size_t) -1 if an error occurs and sets errno. |
| 19 | 19 | // If `dst` is NULL, `dst_size_bytes` is ignored and no bytes are copied to `dst`. |
| 20 | 20 | _LIBCPP_FUNC_VIS |
lib/libcxx/src/support/runtime/stdexcept_vcruntime.ipp+1-1| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | //===----------------------------------------------------------------------===// |
| 8 | 8 | |
| 9 | 9 | #ifndef _LIBCPP_ABI_VCRUNTIME |
| 10 | #error This file may only be used when defering to vcruntime | |
| 10 | #error This file may only be used when deferring to vcruntime | |
| 11 | 11 | #endif |
| 12 | 12 | |
| 13 | 13 | namespace std { |
lib/libcxx/src/thread.cpp+1-1| ... | ... | @@ -164,8 +164,8 @@ __thread_struct_imp::~__thread_struct_imp() |
| 164 | 164 | for (_Notify::iterator i = notify_.begin(), e = notify_.end(); |
| 165 | 165 | i != e; ++i) |
| 166 | 166 | { |
| 167 | i->second->unlock(); | |
| 168 | 167 | i->first->notify_all(); |
| 168 | i->second->unlock(); | |
| 169 | 169 | } |
| 170 | 170 | for (_AsyncStates::iterator i = async_states_.begin(), e = async_states_.end(); |
| 171 | 171 | i != e; ++i) |