From b89a78038285c852b52633e65d304a4f2cceea2d Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Wed, 31 Jan 2024 04:48:52 +0800 Subject: [PATCH] ADL-proof implementation of [alg.merge], [alg.set.operations], [alg.heap.operations], and [alg.permutation.generators] (#4347) Co-authored-by: Stephan T. Lavavej --- stl/inc/algorithm | 546 +++++++++--------- stl/inc/execution | 68 +-- stl/inc/xmemory | 22 +- stl/inc/xutility | 20 +- .../test.compile.pass.cpp | 78 +++ .../test.compile.pass.cpp | 78 +++ 6 files changed, 491 insertions(+), 321 deletions(-) diff --git a/stl/inc/algorithm b/stl/inc/algorithm index e793f01a4..47f957d9e 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -150,7 +150,7 @@ struct _Optimistic_temporary_buffer { // temporary storage with _alloca-like att } // less heap space than stack space, give up and use stack instead - _Return_temporary_buffer(_Raw.first); + _STD _Return_temporary_buffer(_Raw.first); _Data = reinterpret_cast<_Ty*>(&_Stack_space[0]); _Capacity = _Optimistic_count; } @@ -160,7 +160,7 @@ struct _Optimistic_temporary_buffer { // temporary storage with _alloca-like att ~_Optimistic_temporary_buffer() noexcept { if (static_cast(_Capacity) > _Optimistic_count) { - _Return_temporary_buffer(_Data); + _STD _Return_temporary_buffer(_Data); } } @@ -5956,7 +5956,7 @@ _BidIt _Buffered_rotate_unchecked(const _BidIt _First, const _BidIt _Mid, const if (_Count2 <= _Capacity) { // buffer right range, then copy parts _Uninitialized_backout<_Iter_value_t<_BidIt>*> _Backout{ _Temp_ptr, _STD _Uninitialized_move_unchecked(_Mid, _Last, _Temp_ptr)}; - _Move_backward_unchecked(_First, _Mid, _Last); + _STD _Move_backward_unchecked(_First, _Mid, _Last); return _STD _Move_unchecked(_Backout._First, _Backout._Last, _First); // ditto _Backout destroys elements } @@ -6316,14 +6316,14 @@ _CONSTEXPR20 void _Push_heap_by_index( _EXPORT_STD template _CONSTEXPR20 void push_heap(_RanIt _First, _RanIt _Last, _Pr _Pred) { // push *(_Last - 1) onto heap at [_First, _Last - 1) - _Adl_verify_range(_First, _Last); - const auto _UFirst = _Get_unwrapped(_First); - auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Last); + const auto _UFirst = _STD _Get_unwrapped(_First); + auto _ULast = _STD _Get_unwrapped(_Last); using _Diff = _Iter_diff_t<_RanIt>; _Diff _Count = _ULast - _UFirst; if (2 <= _Count) { _Iter_value_t<_RanIt> _Val(_STD move(*--_ULast)); - _STD _Push_heap_by_index(_UFirst, --_Count, _Diff(0), _STD move(_Val), _Pass_fn(_Pred)); + _STD _Push_heap_by_index(_UFirst, --_Count, _Diff(0), _STD move(_Val), _STD _Pass_fn(_Pred)); } } @@ -6360,11 +6360,11 @@ namespace ranges { template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); - _Seek_wrapped(_First, _ULast); - _Push_heap_unchecked(_STD move(_UFirst), _STD move(_ULast), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); + _STD _Seek_wrapped(_First, _ULast); + _Push_heap_unchecked(_STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _First; } @@ -6372,12 +6372,12 @@ namespace ranges { requires sortable, _Pr, _Pj> constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { if constexpr (common_range<_Rng>) { - _Push_heap_unchecked(_Ubegin(_Range), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _Push_heap_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _RANGES end(_Range); } else { - auto _ULast = _Get_final_iterator_unwrapped(_Range); - _Push_heap_unchecked(_Ubegin(_Range), _ULast, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_iterator(_Range, _STD move(_ULast)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); + _Push_heap_unchecked(_Ubegin(_Range), _ULast, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_iterator(_Range, _STD move(_ULast)); } } @@ -6457,8 +6457,8 @@ _CONSTEXPR20 void _Pop_heap_unchecked(_RanIt _First, _RanIt _Last, _Pr _Pred) { _EXPORT_STD template _CONSTEXPR20 void pop_heap(_RanIt _First, _RanIt _Last, _Pr _Pred) { // pop *_First to *(_Last - 1) and reheap - _Adl_verify_range(_First, _Last); - _STD _Pop_heap_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Pass_fn(_Pred)); + _STD _Adl_verify_range(_First, _Last); + _STD _Pop_heap_unchecked(_STD _Get_unwrapped(_First), _STD _Get_unwrapped(_Last), _STD _Pass_fn(_Pred)); } _EXPORT_STD template @@ -6537,11 +6537,12 @@ namespace ranges { template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); - _Seek_wrapped(_First, _ULast); - _RANGES _Pop_heap_unchecked(_STD move(_UFirst), _STD move(_ULast), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); + _STD _Seek_wrapped(_First, _ULast); + _RANGES _Pop_heap_unchecked( + _STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _First; } @@ -6549,11 +6550,11 @@ namespace ranges { requires sortable, _Pr, _Pj> constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { if constexpr (common_range<_Rng>) { - _RANGES _Pop_heap_unchecked(_Ubegin(_Range), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _RANGES _Pop_heap_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _RANGES end(_Range); } else { auto _ULast = _Get_final_iterator_unwrapped(_Range); - _RANGES _Pop_heap_unchecked(_Ubegin(_Range), _ULast, _Pass_fn(_Pred), _Pass_fn(_Proj)); + _RANGES _Pop_heap_unchecked(_Ubegin(_Range), _ULast, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _Rewrap_iterator(_Range, _STD move(_ULast)); } } @@ -6578,8 +6579,8 @@ _CONSTEXPR20 void _Make_heap_unchecked(_RanIt _First, _RanIt _Last, _Pr _Pred) { _EXPORT_STD template _CONSTEXPR20 void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred) { // make [_First, _Last) into a heap - _Adl_verify_range(_First, _Last); - _Make_heap_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Pass_fn(_Pred)); + _STD _Adl_verify_range(_First, _Last); + _STD _Make_heap_unchecked(_STD _Get_unwrapped(_First), _STD _Get_unwrapped(_Last), _STD _Pass_fn(_Pred)); } _EXPORT_STD template @@ -6609,11 +6610,12 @@ namespace ranges { template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); - _Seek_wrapped(_First, _ULast); - _Make_heap_common(_STD move(_UFirst), _STD move(_ULast), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); + _STD _Seek_wrapped(_First, _ULast); + _RANGES _Make_heap_common( + _STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _First; } @@ -6621,12 +6623,12 @@ namespace ranges { requires sortable, _Pr, _Pj> constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { if constexpr (common_range<_Rng>) { - _Make_heap_common(_Ubegin(_Range), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _RANGES _Make_heap_common(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _RANGES end(_Range); } else { - auto _ULast = _Get_final_iterator_unwrapped(_Range); - _Make_heap_common(_Ubegin(_Range), _ULast, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_iterator(_Range, _STD move(_ULast)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); + _RANGES _Make_heap_common(_Ubegin(_Range), _ULast, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_iterator(_Range, _STD move(_ULast)); } } }; @@ -6652,19 +6654,19 @@ _CONSTEXPR20 _RanIt _Is_heap_until_unchecked(_RanIt _First, _RanIt _Last, _Pr _P _EXPORT_STD template _NODISCARD _CONSTEXPR20 _RanIt is_heap_until(_RanIt _First, _RanIt _Last, _Pr _Pred) { // find extent of range that is a heap - _Adl_verify_range(_First, _Last); - _Seek_wrapped( - _First, _STD _Is_heap_until_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Pass_fn(_Pred))); + _STD _Adl_verify_range(_First, _Last); + _STD _Seek_wrapped(_First, + _STD _Is_heap_until_unchecked(_STD _Get_unwrapped(_First), _STD _Get_unwrapped(_Last), _STD _Pass_fn(_Pred))); return _First; } _EXPORT_STD template _NODISCARD _CONSTEXPR20 bool is_heap(_RanIt _First, _RanIt _Last, _Pr _Pred) { // test if range is a heap - _Adl_verify_range(_First, _Last); - const auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); - return _STD _Is_heap_until_unchecked(_UFirst, _ULast, _Pass_fn(_Pred)) == _ULast; + _STD _Adl_verify_range(_First, _Last); + const auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); + return _STD _Is_heap_until_unchecked(_UFirst, _ULast, _STD _Pass_fn(_Pred)) == _ULast; } _EXPORT_STD template @@ -6685,7 +6687,7 @@ _NODISCARD _RanIt is_heap_until(_ExPo&& _Exec, _RanIt _First, _RanIt _Last, _Pr _EXPORT_STD template = 0> _NODISCARD bool is_heap(_ExPo&& _Exec, _RanIt _First, _RanIt _Last, _Pr _Pred) noexcept /* terminates */ { // test if range is a heap - return _STD is_heap_until(_STD forward<_ExPo>(_Exec), _First, _Last, _Pass_fn(_Pred)) == _Last; + return _STD is_heap_until(_STD forward<_ExPo>(_Exec), _First, _Last, _STD _Pass_fn(_Pred)) == _Last; } _EXPORT_STD template = 0> @@ -6731,12 +6733,12 @@ namespace ranges { template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> _NODISCARD constexpr bool operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - const auto _ULast = _Unwrap_sent<_It>(_STD move(_Last)); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + const auto _ULast = _RANGES _Unwrap_sent<_It>(_STD move(_Last)); const auto _Size = _RANGES distance(_UFirst, _ULast); const auto _UResult = - _RANGES _Is_heap_until_unchecked(_STD move(_UFirst), _Size, _Pass_fn(_Pred), _Pass_fn(_Proj)); + _RANGES _Is_heap_until_unchecked(_STD move(_UFirst), _Size, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _UResult == _ULast; } @@ -6745,7 +6747,7 @@ namespace ranges { _NODISCARD constexpr bool operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { const auto _Size = _RANGES distance(_Range); const auto _UResult = - _RANGES _Is_heap_until_unchecked(_Ubegin(_Range), _Size, _Pass_fn(_Pred), _Pass_fn(_Proj)); + _RANGES _Is_heap_until_unchecked(_Ubegin(_Range), _Size, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _UResult == _Uend(_Range); } }; @@ -6757,12 +6759,12 @@ namespace ranges { template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> _NODISCARD constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - const auto _Size = _RANGES distance(_UFirst, _Unwrap_sent<_It>(_STD move(_Last))); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + const auto _Size = _RANGES distance(_UFirst, _RANGES _Unwrap_sent<_It>(_STD move(_Last))); auto _UResult = - _RANGES _Is_heap_until_unchecked(_STD move(_UFirst), _Size, _Pass_fn(_Pred), _Pass_fn(_Proj)); - _Seek_wrapped(_First, _STD move(_UResult)); + _RANGES _Is_heap_until_unchecked(_STD move(_UFirst), _Size, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + _STD _Seek_wrapped(_First, _STD move(_UResult)); return _First; } @@ -6770,8 +6772,9 @@ namespace ranges { indirect_strict_weak_order, _Pj>> _Pr = ranges::less> _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { const auto _Size = _RANGES distance(_Range); - auto _UResult = _RANGES _Is_heap_until_unchecked(_Ubegin(_Range), _Size, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_iterator(_Range, _STD move(_UResult)); + auto _UResult = + _RANGES _Is_heap_until_unchecked(_Ubegin(_Range), _Size, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_iterator(_Range, _STD move(_UResult)); } }; @@ -6790,16 +6793,16 @@ _CONSTEXPR20 void _Sort_heap_unchecked(_RanIt _First, _RanIt _Last, _Pr _Pred) { _EXPORT_STD template _CONSTEXPR20 void sort_heap(_RanIt _First, _RanIt _Last, _Pr _Pred) { // order heap by repeatedly popping - _Adl_verify_range(_First, _Last); - const auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Last); + const auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); #if _ITERATOR_DEBUG_LEVEL == 2 - const auto _Counterexample = _STD _Is_heap_until_unchecked(_UFirst, _ULast, _Pass_fn(_Pred)); + const auto _Counterexample = _STD _Is_heap_until_unchecked(_UFirst, _ULast, _STD _Pass_fn(_Pred)); if (_Counterexample != _ULast) { _STL_REPORT_ERROR("invalid heap in sort_heap()"); } #endif // _ITERATOR_DEBUG_LEVEL == 2 - _Sort_heap_unchecked(_UFirst, _ULast, _Pass_fn(_Pred)); + _STD _Sort_heap_unchecked(_UFirst, _ULast, _STD _Pass_fn(_Pred)); } _EXPORT_STD template @@ -6823,11 +6826,12 @@ namespace ranges { template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); - _Seek_wrapped(_First, _ULast); - _Sort_heap_common(_STD move(_UFirst), _STD move(_ULast), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); + _STD _Seek_wrapped(_First, _ULast); + _RANGES _Sort_heap_common( + _STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _First; } @@ -6835,12 +6839,12 @@ namespace ranges { requires sortable, _Pr, _Pj> constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { if constexpr (common_range<_Rng>) { - _Sort_heap_common(_Ubegin(_Range), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _RANGES _Sort_heap_common(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _RANGES end(_Range); } else { - auto _ULast = _Get_final_iterator_unwrapped(_Range); - _Sort_heap_common(_Ubegin(_Range), _ULast, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_iterator(_Range, _STD move(_ULast)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); + _RANGES _Sort_heap_common(_Ubegin(_Range), _ULast, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_iterator(_Range, _STD move(_ULast)); } } }; @@ -7124,17 +7128,17 @@ _NODISCARD constexpr auto _Idl_dist_add(_Diff1 _Lhs, _Diff2 _Rhs) { _EXPORT_STD template _CONSTEXPR20 _OutIt merge(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2, _OutIt _Dest, _Pr _Pred) { // copy merging ranges - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UFirst1 = _Get_unwrapped(_First1); - const auto _ULast1 = _Get_unwrapped(_Last1); - auto _UFirst2 = _Get_unwrapped(_First2); - const auto _ULast2 = _Get_unwrapped(_Last2); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UFirst1 = _STD _Get_unwrapped(_First1); + const auto _ULast1 = _STD _Get_unwrapped(_Last1); + auto _UFirst2 = _STD _Get_unwrapped(_First2); + const auto _ULast2 = _STD _Get_unwrapped(_Last2); _DEBUG_ORDER_SET_UNWRAPPED(_InIt2, _UFirst1, _ULast1, _Pred); _DEBUG_ORDER_SET_UNWRAPPED(_InIt1, _UFirst2, _ULast2, _Pred); - const auto _Count1 = _Idl_distance<_InIt1>(_UFirst1, _ULast1); - const auto _Count2 = _Idl_distance<_InIt2>(_UFirst2, _ULast2); - auto _UDest = _Get_unwrapped_n(_Dest, _Idl_dist_add(_Count1, _Count2)); + const auto _Count1 = _STD _Idl_distance<_InIt1>(_UFirst1, _ULast1); + const auto _Count2 = _STD _Idl_distance<_InIt2>(_UFirst2, _ULast2); + auto _UDest = _STD _Get_unwrapped_n(_Dest, _Idl_dist_add(_Count1, _Count2)); if (_UFirst1 != _ULast1 && _UFirst2 != _ULast2) { for (;;) { if (_DEBUG_LT_PRED(_Pred, *_UFirst2, *_UFirst1)) { @@ -7158,7 +7162,7 @@ _CONSTEXPR20 _OutIt merge(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 } _UDest = _STD _Copy_unchecked(_UFirst1, _ULast1, _UDest); // copy any tail - _Seek_wrapped(_Dest, _STD _Copy_unchecked(_UFirst2, _ULast2, _UDest)); + _STD _Seek_wrapped(_Dest, _STD _Copy_unchecked(_UFirst2, _ULast2, _UDest)); return _Dest; } @@ -7178,7 +7182,7 @@ _FwdIt3 merge(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); _REQUIRE_CPP17_MUTABLE_ITERATOR(_FwdIt3); - return _STD merge(_First1, _Last1, _First2, _Last2, _Dest, _Pass_fn(_Pred)); + return _STD merge(_First1, _Last1, _First2, _Last2, _Dest, _STD _Pass_fn(_Pred)); } _EXPORT_STD template constexpr merge_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UResult = - _Merge_unchecked(_Unwrap_iter<_Se1>(_STD move(_First1)), _Unwrap_sent<_It1>(_STD move(_Last1)), - _Unwrap_iter<_Se2>(_STD move(_First2)), _Unwrap_sent<_It2>(_STD move(_Last2)), _STD move(_Result), - _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); - _Seek_wrapped(_First1, _STD move(_UResult.in1)); - _Seek_wrapped(_First2, _STD move(_UResult.in2)); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UResult = _Merge_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), + _RANGES _Unwrap_sent<_It1>(_STD move(_Last1)), _RANGES _Unwrap_iter<_Se2>(_STD move(_First2)), + _RANGES _Unwrap_sent<_It2>(_STD move(_Last2)), _STD move(_Result), _STD _Pass_fn(_Pred), + _STD _Pass_fn(_Proj1), _STD _Pass_fn(_Proj2)); + _STD _Seek_wrapped(_First1, _STD move(_UResult.in1)); + _STD _Seek_wrapped(_First2, _STD move(_UResult.in2)); return {_STD move(_First1), _STD move(_First2), _STD move(_UResult.out)}; } @@ -7223,11 +7227,11 @@ namespace ranges { _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { auto _First1 = _RANGES begin(_Range1); auto _First2 = _RANGES begin(_Range2); - auto _UResult = _Merge_unchecked(_Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), - _Unwrap_range_iter<_Rng2>(_STD move(_First2)), _Uend(_Range2), _STD move(_Result), _Pass_fn(_Pred), - _Pass_fn(_Proj1), _Pass_fn(_Proj2)); - _Seek_wrapped(_First1, _STD move(_UResult.in1)); - _Seek_wrapped(_First2, _STD move(_UResult.in2)); + auto _UResult = _Merge_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), + _RANGES _Unwrap_range_iter<_Rng2>(_STD move(_First2)), _Uend(_Range2), _STD move(_Result), + _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), _STD _Pass_fn(_Proj2)); + _STD _Seek_wrapped(_First1, _STD move(_UResult.in1)); + _STD _Seek_wrapped(_First2, _STD move(_UResult.in2)); return {_STD move(_First1), _STD move(_First2), _STD move(_UResult.out)}; } @@ -7284,7 +7288,7 @@ void _Rotate_one_right(_BidIt _First, _BidIt _Mid, _BidIt _Last) { // exchanges the range [_First, _Mid) with [_Mid, _Last) // pre: distance(_Mid, _Last) is 1 _Iter_value_t<_BidIt> _Temp(_STD move(*_Mid)); - _Move_backward_unchecked(_First, _Mid, _Last); + _STD _Move_backward_unchecked(_First, _Mid, _Last); *_First = _STD move(_Temp); } @@ -7346,7 +7350,7 @@ void _Inplace_merge_buffer_right( *--_Last = _STD move(*_Mid); if (_First == _Mid) { *--_Last = _STD move(*_Right_last); // to make [_Right_first, _Right_last) a half-open range - _Move_backward_unchecked(_Right_first, _Right_last, _Last); // move any head (and lowest element) + _STD _Move_backward_unchecked(_Right_first, _Right_last, _Last); // move any head (and lowest element) return; } @@ -7356,7 +7360,7 @@ void _Inplace_merge_buffer_right( --_Right_last; if (_Right_first == _Right_last) { // we can't compare with *_Right_first, but we know it is lowest *--_Last = _STD move(*_Mid); // restore half-open range [_First, _Mid) - _Move_backward_unchecked(_First, _Mid, _Last); + _STD _Move_backward_unchecked(_First, _Mid, _Last); *_First = _STD move(*_Right_first); return; } @@ -7374,11 +7378,11 @@ void _Buffered_inplace_merge_divide_and_conquer2(_BidIt _First, _BidIt _Mid, _Bi _BidIt _Firstn, _BidIt _Lastn, _Iter_diff_t<_BidIt> _Count1n, _Iter_diff_t<_BidIt> _Count2n) { // common block of _Buffered_inplace_merge_divide_and_conquer, below using _Diff = _Iter_diff_t<_BidIt>; - _BidIt _Midn = _Buffered_rotate_unchecked(_Firstn, _Mid, _Lastn, static_cast<_Diff>(_Count1 - _Count1n), _Count2n, - _Temp_ptr, _Capacity); // rearrange middle - _Buffered_inplace_merge_unchecked( + _BidIt _Midn = _STD _Buffered_rotate_unchecked(_Firstn, _Mid, _Lastn, static_cast<_Diff>(_Count1 - _Count1n), + _Count2n, _Temp_ptr, _Capacity); // rearrange middle + _STD _Buffered_inplace_merge_unchecked( _First, _Firstn, _Midn, _Count1n, _Count2n, _Temp_ptr, _Capacity, _Pred); // merge each new part - _Buffered_inplace_merge_unchecked(_Midn, _Lastn, _Last, static_cast<_Diff>(_Count1 - _Count1n), + _STD _Buffered_inplace_merge_unchecked(_Midn, _Lastn, _Last, static_cast<_Diff>(_Count1 - _Count1n), static_cast<_Diff>(_Count2 - _Count2n), _Temp_ptr, _Capacity, _Pred); } @@ -7441,7 +7445,7 @@ void _Buffered_inplace_merge_unchecked(_BidIt _First, _BidIt _Mid, _BidIt _Last, --_Count1; } - const auto _Highest = _Prev_iter(_Mid); + const auto _Highest = _STD _Prev_iter(_Mid); do { --_Last; --_Count2; @@ -7459,17 +7463,17 @@ void _Buffered_inplace_merge_unchecked(_BidIt _First, _BidIt _Mid, _BidIt _Last, return; } - _Buffered_inplace_merge_unchecked_impl(_First, _Mid, _Last, _Count1, _Count2, _Temp_ptr, _Capacity, _Pred); + _STD _Buffered_inplace_merge_unchecked_impl(_First, _Mid, _Last, _Count1, _Count2, _Temp_ptr, _Capacity, _Pred); } _EXPORT_STD template void inplace_merge(_BidIt _First, _BidIt _Mid, _BidIt _Last, _Pr _Pred) { // merge [_First, _Mid) with [_Mid, _Last) - _Adl_verify_range(_First, _Mid); - _Adl_verify_range(_Mid, _Last); - auto _UFirst = _Get_unwrapped(_First); - auto _UMid = _Get_unwrapped(_Mid); - auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Mid); + _STD _Adl_verify_range(_Mid, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + auto _UMid = _STD _Get_unwrapped(_Mid); + auto _ULast = _STD _Get_unwrapped(_Last); _DEBUG_ORDER_UNWRAPPED(_UFirst, _UMid, _Pred); // establish the usual invariants: @@ -7489,7 +7493,7 @@ void inplace_merge(_BidIt _First, _BidIt _Mid, _BidIt _Last, _Pr _Pred) { ++_UFirst; } - const auto _Highest = _Prev_iter(_UMid); + const auto _Highest = _STD _Prev_iter(_UMid); do { --_ULast; if (_UMid == _ULast) { // rotate only element remaining in right partition to the beginning, without allocating @@ -7509,8 +7513,8 @@ void inplace_merge(_BidIt _First, _BidIt _Mid, _BidIt _Last, _Pr _Pred) { const _Diff _Count2 = _STD distance(_UMid, _ULast); _Optimistic_temporary_buffer<_Iter_value_t<_BidIt>> _Temp_buf{(_STD min)(_Count1, _Count2)}; - _Buffered_inplace_merge_unchecked_impl( - _UFirst, _UMid, _ULast, _Count1, _Count2, _Temp_buf._Data, _Temp_buf._Capacity, _Pass_fn(_Pred)); + _STD _Buffered_inplace_merge_unchecked_impl( + _UFirst, _UMid, _ULast, _Count1, _Count2, _Temp_buf._Data, _Temp_buf._Capacity, _STD _Pass_fn(_Pred)); } _EXPORT_STD template @@ -7525,7 +7529,7 @@ void inplace_merge(_ExPo&&, _BidIt _First, _BidIt _Mid, _BidIt _Last, _Pr _Pred) // merge [_First, _Mid) with [_Mid, _Last) // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_CPP17_MUTABLE_BIDIRECTIONAL_ITERATOR(_BidIt); - _STD inplace_merge(_First, _Mid, _Last, _Pass_fn(_Pred)); + _STD inplace_merge(_First, _Mid, _Last, _STD _Pass_fn(_Pred)); } _EXPORT_STD template = 0> @@ -7760,15 +7764,15 @@ namespace ranges { template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> _It operator()(_It _First, _It _Mid, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Mid); - _Adl_verify_range(_Mid, _Last); + _STD _Adl_verify_range(_First, _Mid); + _STD _Adl_verify_range(_Mid, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); - _Seek_wrapped(_First, _ULast); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); + _STD _Seek_wrapped(_First, _ULast); - _Inplace_merge_common(_STD move(_UFirst), _Unwrap_iter<_Se>(_STD move(_Mid)), _STD move(_ULast), - _Pass_fn(_Pred), _Pass_fn(_Proj)); + _Inplace_merge_common(_STD move(_UFirst), _RANGES _Unwrap_iter<_Se>(_STD move(_Mid)), _STD move(_ULast), + _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _First; } @@ -7779,15 +7783,15 @@ namespace ranges { auto _First = _RANGES begin(_Range); auto _Last = _RANGES end(_Range); - _Adl_verify_range(_First, _Mid); - _Adl_verify_range(_Mid, _Last); + _STD _Adl_verify_range(_First, _Mid); + _STD _Adl_verify_range(_Mid, _Last); - auto _UFirst = _Unwrap_range_iter<_Rng>(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped>(_UFirst, _STD move(_Last)); - _Seek_wrapped(_First, _ULast); + auto _UFirst = _RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped>(_UFirst, _STD move(_Last)); + _STD _Seek_wrapped(_First, _ULast); - _Inplace_merge_common(_STD move(_UFirst), _Unwrap_range_iter<_Rng>(_STD move(_Mid)), _STD move(_ULast), - _Pass_fn(_Pred), _Pass_fn(_Proj)); + _Inplace_merge_common(_STD move(_UFirst), _RANGES _Unwrap_range_iter<_Rng>(_STD move(_Mid)), + _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _First; } @@ -9088,12 +9092,12 @@ namespace ranges { _EXPORT_STD template _NODISCARD _CONSTEXPR20 bool includes(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2, _Pr _Pred) { // test if every element in sorted [_First2, _Last2) is in sorted [_First1, _Last1) - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UFirst1 = _Get_unwrapped(_First1); - const auto _ULast1 = _Get_unwrapped(_Last1); - auto _UFirst2 = _Get_unwrapped(_First2); - const auto _ULast2 = _Get_unwrapped(_Last2); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UFirst1 = _STD _Get_unwrapped(_First1); + const auto _ULast1 = _STD _Get_unwrapped(_Last1); + auto _UFirst2 = _STD _Get_unwrapped(_First2); + const auto _ULast2 = _STD _Get_unwrapped(_Last2); _DEBUG_ORDER_SET_UNWRAPPED(_InIt2, _UFirst1, _ULast1, _Pred); _DEBUG_ORDER_SET_UNWRAPPED(_InIt1, _UFirst2, _ULast2, _Pred); for (; _UFirst1 != _ULast1 && _UFirst2 != _ULast2; ++_UFirst1) { @@ -9123,7 +9127,7 @@ _NODISCARD bool includes(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _Firs // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); - return _STD includes(_First1, _Last1, _First2, _Last2, _Pass_fn(_Pred)); + return _STD includes(_First1, _Last1, _First2, _Last2, _STD _Pass_fn(_Pred)); } _EXPORT_STD template = 0> @@ -9145,11 +9149,12 @@ namespace ranges { indirect_strict_weak_order, projected<_It2, _Pj2>> _Pr = ranges::less> _NODISCARD constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - return _Includes_unchecked(_Unwrap_iter<_Se1>(_STD move(_First1)), _Unwrap_sent<_It1>(_STD move(_Last1)), - _Unwrap_iter<_Se2>(_STD move(_First2)), _Unwrap_sent<_It2>(_STD move(_Last2)), _Pass_fn(_Pred), - _Pass_fn(_Proj1), _Pass_fn(_Proj2)); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + return _Includes_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), + _RANGES _Unwrap_sent<_It1>(_STD move(_Last1)), _RANGES _Unwrap_iter<_Se2>(_STD move(_First2)), + _RANGES _Unwrap_sent<_It2>(_STD move(_Last2)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), + _STD _Pass_fn(_Proj2)); } template _CONSTEXPR20 _OutIt set_union(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2, _OutIt _Dest, _Pr _Pred) { // OR sets [_First1, _Last1) and [_First2, _Last2) - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UFirst1 = _Get_unwrapped(_First1); - const auto _ULast1 = _Get_unwrapped(_Last1); - auto _UFirst2 = _Get_unwrapped(_First2); - const auto _ULast2 = _Get_unwrapped(_Last2); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UFirst1 = _STD _Get_unwrapped(_First1); + const auto _ULast1 = _STD _Get_unwrapped(_Last1); + auto _UFirst2 = _STD _Get_unwrapped(_First2); + const auto _ULast2 = _STD _Get_unwrapped(_Last2); _DEBUG_ORDER_SET_UNWRAPPED(_InIt2, _UFirst1, _ULast1, _Pred); _DEBUG_ORDER_SET_UNWRAPPED(_InIt1, _UFirst2, _ULast2, _Pred); - auto _UDest = _Get_unwrapped_unverified(_Dest); + auto _UDest = _STD _Get_unwrapped_unverified(_Dest); for (; _UFirst1 != _ULast1 && _UFirst2 != _ULast2; ++_UDest) { if (_DEBUG_LT_PRED(_Pred, *_UFirst1, *_UFirst2)) { // copy first *_UDest = *_UFirst1; @@ -9234,7 +9239,7 @@ _CONSTEXPR20 _OutIt set_union(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _In } _UDest = _STD _Copy_unchecked(_UFirst1, _ULast1, _UDest); - _Seek_wrapped(_Dest, _STD _Copy_unchecked(_UFirst2, _ULast2, _UDest)); + _STD _Seek_wrapped(_Dest, _STD _Copy_unchecked(_UFirst2, _ULast2, _UDest)); return _Dest; } @@ -9254,7 +9259,7 @@ _FwdIt3 set_union(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _Fw _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); _REQUIRE_CPP17_MUTABLE_ITERATOR(_FwdIt3); - return _STD set_union(_First1, _Last1, _First2, _Last2, _Dest, _Pass_fn(_Pred)); + return _STD set_union(_First1, _Last1, _First2, _Last2, _Dest, _STD _Pass_fn(_Pred)); } _EXPORT_STD template constexpr set_union_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UResult = - _Set_union_unchecked(_Unwrap_iter<_Se1>(_STD move(_First1)), _Unwrap_sent<_It1>(_STD move(_Last1)), - _Unwrap_iter<_Se2>(_STD move(_First2)), _Unwrap_sent<_It2>(_STD move(_Last2)), - _Get_unwrapped_unverified(_STD move(_Result)), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); - _Seek_wrapped(_First1, _STD move(_UResult.in1)); - _Seek_wrapped(_First2, _STD move(_UResult.in2)); - _Seek_wrapped(_Result, _STD move(_UResult.out)); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UResult = _Set_union_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), + _RANGES _Unwrap_sent<_It1>(_STD move(_Last1)), _RANGES _Unwrap_iter<_Se2>(_STD move(_First2)), + _RANGES _Unwrap_sent<_It2>(_STD move(_Last2)), _STD _Get_unwrapped_unverified(_STD move(_Result)), + _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), _STD _Pass_fn(_Proj2)); + _STD _Seek_wrapped(_First1, _STD move(_UResult.in1)); + _STD _Seek_wrapped(_First2, _STD move(_UResult.in2)); + _STD _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_First2), _STD move(_Result)}; } @@ -9300,12 +9305,13 @@ namespace ranges { _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { auto _First1 = _RANGES begin(_Range1); auto _First2 = _RANGES begin(_Range2); - auto _UResult = _Set_union_unchecked(_Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), - _Unwrap_range_iter<_Rng2>(_STD move(_First2)), _Uend(_Range2), - _Get_unwrapped_unverified(_STD move(_Result)), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); - _Seek_wrapped(_First1, _STD move(_UResult.in1)); - _Seek_wrapped(_First2, _STD move(_UResult.in2)); - _Seek_wrapped(_Result, _STD move(_UResult.out)); + auto _UResult = _Set_union_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), + _RANGES _Unwrap_range_iter<_Rng2>(_STD move(_First2)), _Uend(_Range2), + _STD _Get_unwrapped_unverified(_STD move(_Result)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), + _STD _Pass_fn(_Proj2)); + _STD _Seek_wrapped(_First1, _STD move(_UResult.in1)); + _STD _Seek_wrapped(_First2, _STD move(_UResult.in2)); + _STD _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_First2), _STD move(_Result)}; } @@ -9348,15 +9354,15 @@ _EXPORT_STD template _CONSTEXPR20 _OutIt set_intersection( _InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2, _OutIt _Dest, _Pr _Pred) { // AND sets [_First1, _Last1) and [_First2, _Last2) - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UFirst1 = _Get_unwrapped(_First1); - const auto _ULast1 = _Get_unwrapped(_Last1); - auto _UFirst2 = _Get_unwrapped(_First2); - const auto _ULast2 = _Get_unwrapped(_Last2); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UFirst1 = _STD _Get_unwrapped(_First1); + const auto _ULast1 = _STD _Get_unwrapped(_Last1); + auto _UFirst2 = _STD _Get_unwrapped(_First2); + const auto _ULast2 = _STD _Get_unwrapped(_Last2); _DEBUG_ORDER_SET_UNWRAPPED(_InIt2, _UFirst1, _ULast1, _Pred); _DEBUG_ORDER_SET_UNWRAPPED(_InIt1, _UFirst2, _ULast2, _Pred); - auto _UDest = _Get_unwrapped_unverified(_Dest); + auto _UDest = _STD _Get_unwrapped_unverified(_Dest); while (_UFirst1 != _ULast1 && _UFirst2 != _ULast2) { if (_DEBUG_LT_PRED(_Pred, *_UFirst1, *_UFirst2)) { ++_UFirst1; @@ -9370,7 +9376,7 @@ _CONSTEXPR20 _OutIt set_intersection( } } - _Seek_wrapped(_Dest, _UDest); + _STD _Seek_wrapped(_Dest, _UDest); return _Dest; } @@ -9406,15 +9412,15 @@ namespace ranges { requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> constexpr set_intersection_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UResult = _Set_intersection_unchecked(_Unwrap_iter<_Se1>(_STD move(_First1)), - _Unwrap_sent<_It1>(_STD move(_Last1)), _Unwrap_iter<_Se2>(_STD move(_First2)), - _Unwrap_sent<_It2>(_STD move(_Last2)), _Get_unwrapped_unverified(_STD move(_Result)), _Pass_fn(_Pred), - _Pass_fn(_Proj1), _Pass_fn(_Proj2)); - _Seek_wrapped(_First1, _STD move(_UResult.in1)); - _Seek_wrapped(_First2, _STD move(_UResult.in2)); - _Seek_wrapped(_Result, _STD move(_UResult.out)); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UResult = _Set_intersection_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), + _RANGES _Unwrap_sent<_It1>(_STD move(_Last1)), _RANGES _Unwrap_iter<_Se2>(_STD move(_First2)), + _RANGES _Unwrap_sent<_It2>(_STD move(_Last2)), _STD _Get_unwrapped_unverified(_STD move(_Result)), + _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), _STD _Pass_fn(_Proj2)); + _STD _Seek_wrapped(_First1, _STD move(_UResult.in1)); + _STD _Seek_wrapped(_First2, _STD move(_UResult.in2)); + _STD _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_First2), _STD move(_Result)}; } @@ -9425,12 +9431,13 @@ namespace ranges { _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { auto _First1 = _RANGES begin(_Range1); auto _First2 = _RANGES begin(_Range2); - auto _UResult = _Set_intersection_unchecked(_Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), - _Unwrap_range_iter<_Rng2>(_STD move(_First2)), _Uend(_Range2), - _Get_unwrapped_unverified(_STD move(_Result)), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); - _Seek_wrapped(_First1, _STD move(_UResult.in1)); - _Seek_wrapped(_First2, _STD move(_UResult.in2)); - _Seek_wrapped(_Result, _STD move(_UResult.out)); + auto _UResult = _Set_intersection_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), + _Uend(_Range1), _RANGES _Unwrap_range_iter<_Rng2>(_STD move(_First2)), _Uend(_Range2), + _STD _Get_unwrapped_unverified(_STD move(_Result)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), + _STD _Pass_fn(_Proj2)); + _STD _Seek_wrapped(_First1, _STD move(_UResult.in1)); + _STD _Seek_wrapped(_First2, _STD move(_UResult.in2)); + _STD _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_First2), _STD move(_Result)}; } @@ -9479,15 +9486,15 @@ _EXPORT_STD template _CONSTEXPR20 _OutIt set_difference( _InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2, _OutIt _Dest, _Pr _Pred) { // take set [_First2, _Last2) from [_First1, _Last1) - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UFirst1 = _Get_unwrapped(_First1); - const auto _ULast1 = _Get_unwrapped(_Last1); - auto _UFirst2 = _Get_unwrapped(_First2); - const auto _ULast2 = _Get_unwrapped(_Last2); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UFirst1 = _STD _Get_unwrapped(_First1); + const auto _ULast1 = _STD _Get_unwrapped(_Last1); + auto _UFirst2 = _STD _Get_unwrapped(_First2); + const auto _ULast2 = _STD _Get_unwrapped(_Last2); _DEBUG_ORDER_SET_UNWRAPPED(_InIt2, _UFirst1, _ULast1, _Pred); _DEBUG_ORDER_SET_UNWRAPPED(_InIt1, _UFirst2, _ULast2, _Pred); - auto _UDest = _Get_unwrapped_unverified(_Dest); + auto _UDest = _STD _Get_unwrapped_unverified(_Dest); while (_UFirst1 != _ULast1 && _UFirst2 != _ULast2) { if (_DEBUG_LT_PRED(_Pred, *_UFirst1, *_UFirst2)) { // copy first *_UDest = *_UFirst1; @@ -9502,7 +9509,7 @@ _CONSTEXPR20 _OutIt set_difference( } } - _Seek_wrapped(_Dest, _STD _Copy_unchecked(_UFirst1, _ULast1, _UDest)); + _STD _Seek_wrapped(_Dest, _STD _Copy_unchecked(_UFirst1, _ULast1, _UDest)); return _Dest; } @@ -9538,14 +9545,14 @@ namespace ranges { requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> constexpr set_difference_result<_It1, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UResult = - _Set_difference_unchecked(_Unwrap_iter<_Se1>(_STD move(_First1)), _Unwrap_sent<_It1>(_STD move(_Last1)), - _Unwrap_iter<_Se2>(_STD move(_First2)), _Unwrap_sent<_It2>(_STD move(_Last2)), - _Get_unwrapped_unverified(_STD move(_Result)), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); - _Seek_wrapped(_First1, _STD move(_UResult.in)); - _Seek_wrapped(_Result, _STD move(_UResult.out)); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UResult = _Set_difference_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), + _RANGES _Unwrap_sent<_It1>(_STD move(_Last1)), _RANGES _Unwrap_iter<_Se2>(_STD move(_First2)), + _RANGES _Unwrap_sent<_It2>(_STD move(_Last2)), _STD _Get_unwrapped_unverified(_STD move(_Result)), + _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), _STD _Pass_fn(_Proj2)); + _STD _Seek_wrapped(_First1, _STD move(_UResult.in)); + _STD _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_Result)}; } @@ -9555,11 +9562,11 @@ namespace ranges { constexpr set_difference_result, _Out> operator()( _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { auto _First1 = _RANGES begin(_Range1); - auto _UResult = _Set_difference_unchecked(_Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), - _Ubegin(_Range2), _Uend(_Range2), _Get_unwrapped_unverified(_STD move(_Result)), _Pass_fn(_Pred), - _Pass_fn(_Proj1), _Pass_fn(_Proj2)); - _Seek_wrapped(_First1, _STD move(_UResult.in)); - _Seek_wrapped(_Result, _STD move(_UResult.out)); + auto _UResult = _Set_difference_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), + _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2), _STD _Get_unwrapped_unverified(_STD move(_Result)), + _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), _STD _Pass_fn(_Proj2)); + _STD _Seek_wrapped(_First1, _STD move(_UResult.in)); + _STD _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_Result)}; } @@ -9607,15 +9614,15 @@ _EXPORT_STD template _CONSTEXPR20 _OutIt set_symmetric_difference( _InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2, _OutIt _Dest, _Pr _Pred) { // XOR sets [_First1, _Last1) and [_First2, _Last2) - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UFirst1 = _Get_unwrapped(_First1); - const auto _ULast1 = _Get_unwrapped(_Last1); - auto _UFirst2 = _Get_unwrapped(_First2); - const auto _ULast2 = _Get_unwrapped(_Last2); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UFirst1 = _STD _Get_unwrapped(_First1); + const auto _ULast1 = _STD _Get_unwrapped(_Last1); + auto _UFirst2 = _STD _Get_unwrapped(_First2); + const auto _ULast2 = _STD _Get_unwrapped(_Last2); _DEBUG_ORDER_SET_UNWRAPPED(_InIt2, _UFirst1, _ULast1, _Pred); _DEBUG_ORDER_SET_UNWRAPPED(_InIt1, _UFirst2, _ULast2, _Pred); - auto _UDest = _Get_unwrapped_unverified(_Dest); + auto _UDest = _STD _Get_unwrapped_unverified(_Dest); while (_UFirst1 != _ULast1 && _UFirst2 != _ULast2) { if (_DEBUG_LT_PRED(_Pred, *_UFirst1, *_UFirst2)) { // copy first *_UDest = *_UFirst1; @@ -9632,7 +9639,7 @@ _CONSTEXPR20 _OutIt set_symmetric_difference( } _UDest = _STD _Copy_unchecked(_UFirst1, _ULast1, _UDest); - _Seek_wrapped(_Dest, _STD _Copy_unchecked(_UFirst2, _ULast2, _UDest)); + _STD _Seek_wrapped(_Dest, _STD _Copy_unchecked(_UFirst2, _ULast2, _UDest)); return _Dest; } @@ -9653,7 +9660,7 @@ _FwdIt3 set_symmetric_difference(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdI _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); _REQUIRE_CPP17_MUTABLE_ITERATOR(_FwdIt3); - return _STD set_symmetric_difference(_First1, _Last1, _First2, _Last2, _Dest, _Pass_fn(_Pred)); + return _STD set_symmetric_difference(_First1, _Last1, _First2, _Last2, _Dest, _STD _Pass_fn(_Pred)); } _EXPORT_STD template constexpr set_symmetric_difference_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UResult = _Set_symmetric_difference_unchecked(_Unwrap_iter<_Se1>(_STD move(_First1)), - _Unwrap_sent<_It1>(_STD move(_Last1)), _Unwrap_iter<_Se2>(_STD move(_First2)), - _Unwrap_sent<_It2>(_STD move(_Last2)), _Get_unwrapped_unverified(_STD move(_Result)), _Pass_fn(_Pred), - _Pass_fn(_Proj1), _Pass_fn(_Proj2)); - _Seek_wrapped(_First1, _STD move(_UResult.in1)); - _Seek_wrapped(_First2, _STD move(_UResult.in2)); - _Seek_wrapped(_Result, _STD move(_UResult.out)); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UResult = _Set_symmetric_difference_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), + _RANGES _Unwrap_sent<_It1>(_STD move(_Last1)), _RANGES _Unwrap_iter<_Se2>(_STD move(_First2)), + _RANGES _Unwrap_sent<_It2>(_STD move(_Last2)), _STD _Get_unwrapped_unverified(_STD move(_Result)), + _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), _STD _Pass_fn(_Proj2)); + _STD _Seek_wrapped(_First1, _STD move(_UResult.in1)); + _STD _Seek_wrapped(_First2, _STD move(_UResult.in2)); + _STD _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_First2), _STD move(_Result)}; } @@ -9700,12 +9707,13 @@ namespace ranges { _Pj2 _Proj2 = {}) const { auto _First1 = _RANGES begin(_Range1); auto _First2 = _RANGES begin(_Range2); - auto _UResult = _Set_symmetric_difference_unchecked(_Unwrap_range_iter<_Rng1>(_STD move(_First1)), - _Uend(_Range1), _Unwrap_range_iter<_Rng2>(_STD move(_First2)), _Uend(_Range2), - _Get_unwrapped_unverified(_STD move(_Result)), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); - _Seek_wrapped(_First1, _STD move(_UResult.in1)); - _Seek_wrapped(_First2, _STD move(_UResult.in2)); - _Seek_wrapped(_Result, _STD move(_UResult.out)); + auto _UResult = _Set_symmetric_difference_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), + _Uend(_Range1), _RANGES _Unwrap_range_iter<_Rng2>(_STD move(_First2)), _Uend(_Range2), + _STD _Get_unwrapped_unverified(_STD move(_Result)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), + _STD _Pass_fn(_Proj2)); + _STD _Seek_wrapped(_First1, _STD move(_UResult.in1)); + _STD _Seek_wrapped(_First2, _STD move(_UResult.in2)); + _STD _Seek_wrapped(_Result, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_First2), _STD move(_Result)}; } @@ -10147,9 +10155,9 @@ namespace ranges { _EXPORT_STD template _CONSTEXPR20 bool next_permutation(_BidIt _First, _BidIt _Last, _Pr _Pred) { // permute and test for pure ascending - _Adl_verify_range(_First, _Last); - auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); auto _UNext = _ULast; if (_UFirst == _ULast || _UFirst == --_UNext) { return false; @@ -10191,12 +10199,12 @@ namespace ranges { template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr next_permutation_result<_It> operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); - _Seek_wrapped(_First, _ULast); - const bool _Found = - _Next_permutation_common(_STD move(_UFirst), _STD move(_ULast), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); + _STD _Seek_wrapped(_First, _ULast); + const bool _Found = _Next_permutation_common( + _STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return {_STD move(_First), _Found}; } @@ -10204,9 +10212,10 @@ namespace ranges { requires sortable, _Pr, _Pj> constexpr next_permutation_result> operator()( _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { - auto _ULast = _Get_final_iterator_unwrapped(_Range); - const bool _Found = _Next_permutation_common(_Ubegin(_Range), _ULast, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return {_Rewrap_iterator(_Range, _STD move(_ULast)), _Found}; + auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); + const bool _Found = + _Next_permutation_common(_Ubegin(_Range), _ULast, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return {_RANGES _Rewrap_iterator(_Range, _STD move(_ULast)), _Found}; } private: @@ -10230,12 +10239,12 @@ namespace ranges { } while (!_STD invoke(_Pred, _STD invoke(_Proj, *_Next), _STD invoke(_Proj, *_Mid))); _RANGES iter_swap(_Next, _Mid); - _Reverse_common(_STD move(_Next1), _STD move(_Last)); + _RANGES _Reverse_common(_STD move(_Next1), _STD move(_Last)); return true; } if (_Next == _First) { // pure descending, flip all - _Reverse_common(_STD move(_First), _STD move(_Last)); + _RANGES _Reverse_common(_STD move(_First), _STD move(_Last)); return false; } } @@ -10249,9 +10258,9 @@ namespace ranges { _EXPORT_STD template _CONSTEXPR20 bool prev_permutation(_BidIt _First, _BidIt _Last, _Pr _Pred) { // reverse permute and test for pure descending - _Adl_verify_range(_First, _Last); - auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); auto _UNext = _ULast; if (_UFirst == _ULast || _UFirst == --_UNext) { return false; @@ -10293,12 +10302,12 @@ namespace ranges { template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> constexpr prev_permutation_result<_It> operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); - _Seek_wrapped(_First, _ULast); - const bool _Found = - _Prev_permutation_common(_STD move(_UFirst), _STD move(_ULast), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); + _STD _Seek_wrapped(_First, _ULast); + const bool _Found = _Prev_permutation_common( + _STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return {_STD move(_First), _Found}; } @@ -10306,9 +10315,10 @@ namespace ranges { requires sortable, _Pr, _Pj> constexpr prev_permutation_result> operator()( _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { - auto _ULast = _Get_final_iterator_unwrapped(_Range); - const bool _Found = _Prev_permutation_common(_Ubegin(_Range), _ULast, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return {_Rewrap_iterator(_Range, _STD move(_ULast)), _Found}; + auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); + const bool _Found = + _Prev_permutation_common(_Ubegin(_Range), _ULast, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return {_RANGES _Rewrap_iterator(_Range, _STD move(_ULast)), _Found}; } private: @@ -10332,12 +10342,12 @@ namespace ranges { } while (!_STD invoke(_Pred, _STD invoke(_Proj, *_Mid), _STD invoke(_Proj, *_Next))); _RANGES iter_swap(_Next, _Mid); - _Reverse_common(_STD move(_Next1), _STD move(_Last)); + _RANGES _Reverse_common(_STD move(_Next1), _STD move(_Last)); return true; } if (_Next == _First) { // pure ascending, flip all - _Reverse_common(_STD move(_First), _STD move(_Last)); + _RANGES _Reverse_common(_STD move(_First), _STD move(_Last)); return false; } } @@ -10351,9 +10361,9 @@ namespace ranges { _EXPORT_STD template _NODISCARD _CONSTEXPR20 _FwdIt is_sorted_until(const _FwdIt _First, _FwdIt _Last, _Pr _Pred) { // find extent of range that is ordered by predicate - _Adl_verify_range(_First, _Last); - auto _UFirst = _Get_unwrapped(_First); - auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + auto _ULast = _STD _Get_unwrapped(_Last); if (_UFirst != _ULast) { for (auto _UNext = _UFirst; ++_UNext != _ULast; ++_UFirst) { if (_DEBUG_LT_PRED(_Pred, *_UNext, *_UFirst)) { @@ -10363,17 +10373,17 @@ _NODISCARD _CONSTEXPR20 _FwdIt is_sorted_until(const _FwdIt _First, _FwdIt _Last } } - _Seek_wrapped(_Last, _ULast); + _STD _Seek_wrapped(_Last, _ULast); return _Last; } _EXPORT_STD template _NODISCARD _CONSTEXPR20 bool is_sorted(_FwdIt _First, _FwdIt _Last, _Pr _Pred) { // test if range is ordered by predicate - _Adl_verify_range(_First, _Last); - const auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); - return _STD is_sorted_until(_UFirst, _ULast, _Pass_fn(_Pred)) == _ULast; + _STD _Adl_verify_range(_First, _Last); + const auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); + return _STD is_sorted_until(_UFirst, _ULast, _STD _Pass_fn(_Pred)) == _ULast; } _EXPORT_STD template @@ -10394,7 +10404,7 @@ _NODISCARD _FwdIt is_sorted_until(_ExPo&&, _FwdIt _First, _FwdIt _Last, _Pr _Pre _EXPORT_STD template = 0> _NODISCARD bool is_sorted(_ExPo&& _Exec, _FwdIt _First, _FwdIt _Last, _Pr _Pred) noexcept /* terminates */ { // test if range is ordered by predicate - return _STD is_sorted_until(_STD forward<_ExPo>(_Exec), _First, _Last, _Pass_fn(_Pred)) == _Last; + return _STD is_sorted_until(_STD forward<_ExPo>(_Exec), _First, _Last, _STD _Pass_fn(_Pred)) == _Last; } _EXPORT_STD template = 0> diff --git a/stl/inc/execution b/stl/inc/execution index c40636af7..6daa8a156 100644 --- a/stl/inc/execution +++ b/stl/inc/execution @@ -3286,7 +3286,7 @@ struct _Static_partitioned_is_heap_until2 { static void __stdcall _Threadpool_callback( __std_PTP_CALLBACK_INSTANCE, void* const _Context, __std_PTP_WORK) noexcept /* terminates */ { - _Run_available_chunked_work(*static_cast<_Static_partitioned_is_heap_until2*>(_Context)); + _STD _Run_available_chunked_work(*static_cast<_Static_partitioned_is_heap_until2*>(_Context)); } }; @@ -3294,18 +3294,19 @@ _EXPORT_STD template ::_Parallelize) { const size_t _Hw_threads = __std_parallel_algorithms_hw_threads(); if (_Hw_threads > 1) { // parallelize on multiprocessor machines const auto _Count = _ULast - _UFirst; if (_Count >= 3) { // ... with at least 3 elements _TRY_BEGIN - _Static_partitioned_is_heap_until2 _Operation{_UFirst, _ULast, _Hw_threads, _Count, _Pass_fn(_Pred)}; - _Run_chunked_parallel_work(_Hw_threads, _Operation); - _Seek_wrapped(_First, _Operation._Results._Get_result()); + _Static_partitioned_is_heap_until2 _Operation{ + _UFirst, _ULast, _Hw_threads, _Count, _STD _Pass_fn(_Pred)}; + _STD _Run_chunked_parallel_work(_Hw_threads, _Operation); + _STD _Seek_wrapped(_First, _Operation._Results._Get_result()); return _First; _CATCH(const _Parallelism_resources_exhausted&) // fall through to serial case below @@ -3314,7 +3315,7 @@ _NODISCARD _RanIt is_heap_until(_ExPo&&, _RanIt _First, _RanIt _Last, _Pr _Pred) } } - _Seek_wrapped(_First, _STD is_heap_until(_UFirst, _ULast, _Pass_fn(_Pred))); + _STD _Seek_wrapped(_First, _STD is_heap_until(_UFirst, _ULast, _STD _Pass_fn(_Pred))); return _First; } @@ -3765,7 +3766,7 @@ struct _Static_partitioned_set_subtraction { // Get chunk in _Range2 that corresponds to our current chunk from _Range1 auto _Range2_chunk_first = _STD lower_bound(_Range2._First, _Range2._Last, *_Range1_chunk_first, _Pred); auto _Range2_chunk_last = - _STD upper_bound(_Range2_chunk_first, _Range2._Last, *_Prev_iter(_Range1_chunk_last), _Pred); + _STD upper_bound(_Range2_chunk_first, _Range2._Last, *_STD _Prev_iter(_Range1_chunk_last), _Pred); // Publish results to rest of chunks. if (_Chunk_number == 0) { @@ -3816,14 +3817,14 @@ struct _Static_partitioned_set_subtraction { // Place elements from _Range1 in _Dest according to the offsets previously calculated. auto _Chunk_specific_dest = _Dest + static_cast<_Iter_diff_t<_RanIt3>>(_Prev_chunk_sum); - _Place_elements_from_indices( + _STD _Place_elements_from_indices( _Range1_chunk_first, _Chunk_specific_dest, _Index_chunk_first, static_cast(_Num_results)); return _Cancellation_status::_Running; } static void __stdcall _Threadpool_callback( __std_PTP_CALLBACK_INSTANCE, void* const _Context, __std_PTP_WORK) noexcept /* terminates */ { - _Run_available_chunked_work(*static_cast<_Static_partitioned_set_subtraction*>(_Context)); + _STD _Run_available_chunked_work(*static_cast<_Static_partitioned_set_subtraction*>(_Context)); } }; @@ -3877,13 +3878,13 @@ _FwdIt3 set_intersection(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _Firs _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); _REQUIRE_CPP17_MUTABLE_ITERATOR(_FwdIt3); - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UFirst1 = _Get_unwrapped(_First1); - const auto _ULast1 = _Get_unwrapped(_Last1); - auto _UFirst2 = _Get_unwrapped(_First2); - const auto _ULast2 = _Get_unwrapped(_Last2); - auto _UDest = _Get_unwrapped_unverified(_Dest); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UFirst1 = _STD _Get_unwrapped(_First1); + const auto _ULast1 = _STD _Get_unwrapped(_Last1); + auto _UFirst2 = _STD _Get_unwrapped(_First2); + const auto _ULast2 = _STD _Get_unwrapped(_Last2); + auto _UDest = _STD _Get_unwrapped_unverified(_Dest); using _Diff = _Common_diff_t<_FwdIt1, _FwdIt2, _FwdIt3>; if constexpr (remove_reference_t<_ExPo>::_Parallelize && _Is_ranges_random_iter_v<_FwdIt1> && _Is_ranges_random_iter_v<_FwdIt2> && _Is_cpp17_random_iter_v<_FwdIt3>) { @@ -3895,10 +3896,10 @@ _FwdIt3 set_intersection(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _Firs if (_Count1 >= 2 && _Count2 >= 2) { // ... with each range containing at least 2 elements _TRY_BEGIN _Static_partitioned_set_subtraction _Operation(_Hw_threads, _Count1, _UFirst1, _UFirst2, _ULast2, - _UDest, _Pass_fn(_Pred), _Set_intersection_per_chunk()); - _Run_chunked_parallel_work(_Hw_threads, _Operation); + _UDest, _STD _Pass_fn(_Pred), _Set_intersection_per_chunk()); + _STD _Run_chunked_parallel_work(_Hw_threads, _Operation); _UDest += static_cast<_Iter_diff_t<_FwdIt3>>(_Operation._Lookback.back()._Sum._Ref()); - _Seek_wrapped(_Dest, _UDest); + _STD _Seek_wrapped(_Dest, _UDest); return _Dest; _CATCH(const _Parallelism_resources_exhausted&) // fall through to serial case below @@ -3907,7 +3908,8 @@ _FwdIt3 set_intersection(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _Firs } } - _Seek_wrapped(_Dest, _STD set_intersection(_UFirst1, _ULast1, _UFirst2, _ULast2, _UDest, _Pass_fn(_Pred))); + _STD _Seek_wrapped( + _Dest, _STD set_intersection(_UFirst1, _ULast1, _UFirst2, _ULast2, _UDest, _STD _Pass_fn(_Pred))); return _Dest; } @@ -3967,13 +3969,13 @@ _FwdIt3 set_difference(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2 _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); _REQUIRE_CPP17_MUTABLE_ITERATOR(_FwdIt3); - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UFirst1 = _Get_unwrapped(_First1); - const auto _ULast1 = _Get_unwrapped(_Last1); - auto _UFirst2 = _Get_unwrapped(_First2); - const auto _ULast2 = _Get_unwrapped(_Last2); - auto _UDest = _Get_unwrapped_unverified(_Dest); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UFirst1 = _STD _Get_unwrapped(_First1); + const auto _ULast1 = _STD _Get_unwrapped(_Last1); + auto _UFirst2 = _STD _Get_unwrapped(_First2); + const auto _ULast2 = _STD _Get_unwrapped(_Last2); + auto _UDest = _STD _Get_unwrapped_unverified(_Dest); using _Diff = _Common_diff_t<_FwdIt1, _FwdIt2, _FwdIt3>; if constexpr (remove_reference_t<_ExPo>::_Parallelize && _Is_ranges_random_iter_v<_FwdIt1> && _Is_ranges_random_iter_v<_FwdIt2> && _Is_cpp17_random_iter_v<_FwdIt3>) { @@ -3984,10 +3986,10 @@ _FwdIt3 set_difference(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2 if (_Count >= 2) { // ... with at least 2 elements in [_First1, _Last1) _TRY_BEGIN _Static_partitioned_set_subtraction _Operation(_Hw_threads, _Count, _UFirst1, _UFirst2, _ULast2, _UDest, - _Pass_fn(_Pred), _Set_difference_per_chunk()); - _Run_chunked_parallel_work(_Hw_threads, _Operation); + _STD _Pass_fn(_Pred), _Set_difference_per_chunk()); + _STD _Run_chunked_parallel_work(_Hw_threads, _Operation); _UDest += static_cast<_Iter_diff_t<_FwdIt3>>(_Operation._Lookback.back()._Sum._Ref()); - _Seek_wrapped(_Dest, _UDest); + _STD _Seek_wrapped(_Dest, _UDest); return _Dest; _CATCH(const _Parallelism_resources_exhausted&) // fall through to serial case below @@ -3996,7 +3998,7 @@ _FwdIt3 set_difference(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2 } } - _Seek_wrapped(_Dest, _STD set_difference(_UFirst1, _ULast1, _UFirst2, _ULast2, _UDest, _Pass_fn(_Pred))); + _STD _Seek_wrapped(_Dest, _STD set_difference(_UFirst1, _ULast1, _UFirst2, _ULast2, _UDest, _STD _Pass_fn(_Pred))); return _Dest; } diff --git a/stl/inc/xmemory b/stl/inc/xmemory index 7d709382e..283984370 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -1636,13 +1636,13 @@ struct _NODISCARD _Uninitialized_backout { _Uninitialized_backout& operator=(const _Uninitialized_backout&) = delete; _CONSTEXPR20 ~_Uninitialized_backout() { - _Destroy_range(_First, _Last); + _STD _Destroy_range(_First, _Last); } template _CONSTEXPR20 void _Emplace_back(_Types&&... _Vals) { // construct a new element at *_Last and increment - _Construct_in_place(*_Last, _STD forward<_Types>(_Vals)...); + _STD _Construct_in_place(*_Last, _STD forward<_Types>(_Vals)...); ++_Last; } @@ -1660,7 +1660,7 @@ _CONSTEXPR20 _NoThrowFwdIt _Uninitialized_move_unchecked(_InIt _First, const _In if (!_STD is_constant_evaluated()) #endif // _HAS_CXX20 { - return _Copy_memmove(_First, _Last, _Dest); + return _STD _Copy_memmove(_First, _Last, _Dest); } } _Uninitialized_backout<_NoThrowFwdIt> _Backout{_Dest}; @@ -1746,10 +1746,10 @@ namespace ranges { template in_out_result<_InIt, _OutIt> _Copy_memcpy_common( _InIt _IFirst, _InIt _ILast, _OutIt _OFirst, _OutIt _OLast) noexcept { - const auto _IFirstPtr = _To_address(_IFirst); - const auto _ILastPtr = _To_address(_ILast); - const auto _OFirstPtr = _To_address(_OFirst); - const auto _OLastPtr = _To_address(_OLast); + const auto _IFirstPtr = _STD _To_address(_IFirst); + const auto _ILastPtr = _STD _To_address(_ILast); + const auto _OFirstPtr = _STD _To_address(_OFirst); + const auto _OLastPtr = _STD _To_address(_OLast); const auto _IFirst_ch = const_cast(reinterpret_cast(_IFirstPtr)); const auto _ILast_ch = const_cast(reinterpret_cast(_ILastPtr)); const auto _OFirst_ch = const_cast(reinterpret_cast(_OFirstPtr)); @@ -1783,12 +1783,14 @@ namespace ranges { if constexpr (_Iter_move_cat<_It, _Out>::_Bitcopy_constructible && _Sized_or_unreachable_sentinel_for<_Se, _It> && _Sized_or_unreachable_sentinel_for<_OSe, _Out>) { if constexpr (_Is_sized1 && _Is_sized2) { - return _Copy_memcpy_common(_IFirst, _RANGES next(_IFirst, _STD move(_ILast)), _OFirst, + return _RANGES _Copy_memcpy_common(_IFirst, _RANGES next(_IFirst, _STD move(_ILast)), _OFirst, _RANGES next(_OFirst, _STD move(_OLast))); } else if constexpr (_Is_sized1) { - return _Copy_memcpy_distance(_IFirst, _OFirst, _IFirst, _RANGES next(_IFirst, _STD move(_ILast))); + return _RANGES _Copy_memcpy_distance( + _IFirst, _OFirst, _IFirst, _RANGES next(_IFirst, _STD move(_ILast))); } else if constexpr (_Is_sized2) { - return _Copy_memcpy_distance(_IFirst, _OFirst, _OFirst, _RANGES next(_OFirst, _STD move(_OLast))); + return _RANGES _Copy_memcpy_distance( + _IFirst, _OFirst, _OFirst, _RANGES next(_OFirst, _STD move(_OLast))); } else { _STL_ASSERT(false, "Tried to uninitialized_move two ranges with unreachable sentinels"); } diff --git a/stl/inc/xutility b/stl/inc/xutility index 20cdaefd7..b8a1b6995 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -6978,22 +6978,22 @@ namespace ranges { _EXPORT_STD template _NODISCARD _CONSTEXPR20 _FwdIt lower_bound(_FwdIt _First, const _FwdIt _Last, const _Ty& _Val, _Pr _Pred) { // find first element not before _Val - _Adl_verify_range(_First, _Last); - auto _UFirst = _Get_unwrapped(_First); - _Iter_diff_t<_FwdIt> _Count = _STD distance(_UFirst, _Get_unwrapped(_Last)); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + _Iter_diff_t<_FwdIt> _Count = _STD distance(_UFirst, _STD _Get_unwrapped(_Last)); while (0 < _Count) { // divide and conquer, find half that contains answer const _Iter_diff_t<_FwdIt> _Count2 = _Count / 2; const auto _UMid = _STD next(_UFirst, _Count2); if (_Pred(*_UMid, _Val)) { // try top half - _UFirst = _Next_iter(_UMid); + _UFirst = _STD _Next_iter(_UMid); _Count -= _Count2 + 1; } else { _Count = _Count2; } } - _Seek_wrapped(_First, _UFirst); + _STD _Seek_wrapped(_First, _UFirst); return _First; } @@ -7006,9 +7006,9 @@ _NODISCARD _CONSTEXPR20 _FwdIt lower_bound(_FwdIt _First, _FwdIt _Last, const _T _EXPORT_STD template _NODISCARD _CONSTEXPR20 _FwdIt upper_bound(_FwdIt _First, _FwdIt _Last, const _Ty& _Val, _Pr _Pred) { // find first element that _Val is before - _Adl_verify_range(_First, _Last); - auto _UFirst = _Get_unwrapped(_First); - _Iter_diff_t<_FwdIt> _Count = _STD distance(_UFirst, _Get_unwrapped(_Last)); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + _Iter_diff_t<_FwdIt> _Count = _STD distance(_UFirst, _STD _Get_unwrapped(_Last)); while (0 < _Count) { // divide and conquer, find half that contains answer _Iter_diff_t<_FwdIt> _Count2 = _Count / 2; @@ -7016,12 +7016,12 @@ _NODISCARD _CONSTEXPR20 _FwdIt upper_bound(_FwdIt _First, _FwdIt _Last, const _T if (_Pred(_Val, *_UMid)) { _Count = _Count2; } else { // try top half - _UFirst = _Next_iter(_UMid); + _UFirst = _STD _Next_iter(_UMid); _Count -= _Count2 + 1; } } - _Seek_wrapped(_First, _UFirst); + _STD _Seek_wrapped(_First, _UFirst); return _First; } diff --git a/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp b/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp index 248f64732..12a478f41 100644 --- a/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp +++ b/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp @@ -263,6 +263,48 @@ void test_algorithms() { // (void) std::shift_right(varr, varr, 0); // requires Cpp17ValueSwappable #endif // _HAS_CXX20 + int iarr3[1]{}; + validator varr3[1]{}; + + (void) std::merge(varr, varr, varr2, varr2, varr3); + (void) std::merge(iarr, iarr, iarr2, iarr2, iarr3, validating_less{}); + + // std::inplace_merge(varr, varr, varr); // requires Cpp17ValueSwappable + std::inplace_merge(iarr, iarr, iarr, validating_less{}); + + (void) std::includes(varr, varr, varr, varr); + (void) std::includes(iarr, iarr, iarr, iarr, validating_less{}); + + (void) std::set_union(varr, varr, varr, varr, varr3); + (void) std::set_union(iarr, iarr, iarr, iarr, iarr3, validating_less{}); + + (void) std::set_intersection(varr, varr, varr, varr, varr3); + (void) std::set_intersection(iarr, iarr, iarr, iarr, iarr3, validating_less{}); + + (void) std::set_difference(varr, varr, varr, varr, varr3); + (void) std::set_difference(iarr, iarr, iarr, iarr, iarr3, validating_less{}); + + (void) std::set_symmetric_difference(varr, varr, varr, varr, varr3); + (void) std::set_symmetric_difference(iarr, iarr, iarr, iarr, iarr3, validating_less{}); + + std::push_heap(varr3, varr3 + 1); // requires Cpp17ValueSwappable + std::push_heap(iarr3, iarr3 + 1, validating_less{}); + + std::pop_heap(varr3, varr3 + 1); // requires Cpp17ValueSwappable + std::pop_heap(iarr3, iarr3 + 1, validating_less{}); + + std::make_heap(varr3, varr3 + 1); // requires Cpp17ValueSwappable + std::make_heap(iarr3, iarr3 + 1, validating_less{}); + + std::sort_heap(varr3, varr3 + 1); // requires Cpp17ValueSwappable + std::sort_heap(iarr3, iarr3 + 1, validating_less{}); + + (void) std::is_heap(varr3, varr3 + 1); + (void) std::is_heap(iarr3, iarr3 + 1, validating_less{}); + + (void) std::is_heap_until(varr3, varr3 + 1); + (void) std::is_heap_until(iarr3, iarr3 + 1, validating_less{}); + (void) std::min(+varr, +varr); (void) std::min(+iarr, +iarr, validating_less{}); (void) std::min({+varr, +varr}); @@ -299,6 +341,12 @@ void test_algorithms() { (void) std::lexicographical_compare_three_way(varr, varr, varr, varr); (void) std::lexicographical_compare_three_way(iarr, iarr, iarr, iarr, validating_compare_three_way{}); #endif // _HAS_CXX20 && defined(__cpp_lib_concepts) + + // (void) std::next_permutation(varr, varr); // requires Cpp17ValueSwappable + (void) std::next_permutation(iarr, iarr, validating_less{}); + + // (void) std::prev_permutation(varr, varr); // requires Cpp17ValueSwappable + (void) std::prev_permutation(iarr, iarr, validating_less{}); } #if _HAS_CXX17 @@ -431,6 +479,36 @@ void test_per_execution_policy() { // (void) std::shift_right(ExecutionPolicy, varr, varr, 0); // requires Cpp17ValueSwappable #endif // _HAS_CXX20 + int iarr3[2]{}; + validator varr3[2]{}; + + (void) std::merge(ExecutionPolicy, varr, varr, varr2, varr2, varr3); + (void) std::merge(ExecutionPolicy, iarr, iarr, iarr2, iarr2, iarr3, validating_less{}); + + // std::inplace_merge(ExecutionPolicy, varr, varr, varr); // requires Cpp17ValueSwappable + std::inplace_merge(ExecutionPolicy, iarr, iarr, iarr, validating_less{}); + + (void) std::includes(ExecutionPolicy, varr, varr, varr, varr); + (void) std::includes(ExecutionPolicy, iarr, iarr, iarr, iarr, validating_less{}); + + (void) std::set_union(ExecutionPolicy, varr, varr, varr, varr, varr3); + (void) std::set_union(ExecutionPolicy, iarr, iarr, iarr, iarr, iarr3, validating_less{}); + + (void) std::set_intersection(ExecutionPolicy, varr, varr, varr, varr, varr3); + (void) std::set_intersection(ExecutionPolicy, iarr, iarr, iarr, iarr, iarr3, validating_less{}); + + (void) std::set_difference(ExecutionPolicy, varr, varr, varr, varr, varr3); + (void) std::set_difference(ExecutionPolicy, iarr, iarr, iarr, iarr, iarr3, validating_less{}); + + (void) std::set_symmetric_difference(ExecutionPolicy, varr, varr, varr, varr, varr3); + (void) std::set_symmetric_difference(ExecutionPolicy, iarr, iarr, iarr, iarr, iarr3, validating_less{}); + + (void) std::is_heap(ExecutionPolicy, varr3, varr3 + 1); + (void) std::is_heap(ExecutionPolicy, iarr3, iarr3 + 1, validating_less{}); + + (void) std::is_heap_until(ExecutionPolicy, varr3, varr3 + 1); + (void) std::is_heap_until(ExecutionPolicy, iarr3, iarr3 + 1, validating_less{}); + (void) std::min_element(ExecutionPolicy, varr, varr + 1); (void) std::min_element(ExecutionPolicy, iarr, iarr + 1, validating_less{}); diff --git a/tests/std/tests/P2538R1_adl_proof_std_projected/test.compile.pass.cpp b/tests/std/tests/P2538R1_adl_proof_std_projected/test.compile.pass.cpp index ccd04fec1..c9ec1c4ae 100644 --- a/tests/std/tests/P2538R1_adl_proof_std_projected/test.compile.pass.cpp +++ b/tests/std/tests/P2538R1_adl_proof_std_projected/test.compile.pass.cpp @@ -279,6 +279,74 @@ void test_ranges_algorithms() { (void) unique_copy(iarr, iarr, iarr2, {}, validating_identity{}); (void) unique_copy(iarr, iarr2, {}, validating_identity{}); + int iarr3[2]{}; + validator varr3[2]{}; + + (void) merge(varr, varr, varr2, varr2, varr3); + (void) merge(varr, varr2, varr3); + (void) merge(iarr, iarr, iarr2, iarr2, iarr3, validating_less{}); + (void) merge(iarr, iarr2, iarr3, validating_less{}); + + (void) inplace_merge(varr, varr, varr); + (void) inplace_merge(varr, varr); + (void) inplace_merge(iarr, iarr, iarr, validating_less{}); + (void) inplace_merge(iarr, iarr, {}, validating_identity{}); + + (void) includes(varr, varr, varr, varr); + (void) includes(varr, varr); + (void) includes(iarr, iarr, iarr, iarr, validating_less{}); + (void) includes(iarr, iarr, validating_less{}); + + (void) set_union(varr, varr, varr, varr, varr3); + (void) set_union(varr, varr, varr3); + (void) set_union(iarr, iarr, iarr, iarr, iarr3, validating_less{}); + (void) set_union(iarr, iarr, iarr3, validating_less{}); + + (void) set_intersection(varr, varr, varr, varr, varr3); + (void) set_intersection(varr, varr, varr3); + (void) set_intersection(iarr, iarr, iarr, iarr, iarr3, validating_less{}); + (void) set_intersection(iarr, iarr, iarr3, validating_less{}); + + (void) set_difference(varr, varr, varr, varr, varr3); + (void) set_difference(varr, varr, varr3); + (void) set_difference(iarr, iarr, iarr, iarr, iarr3, validating_less{}); + (void) set_difference(iarr, iarr, iarr3, validating_less{}); + + (void) set_symmetric_difference(varr, varr, varr, varr, varr3); + (void) set_symmetric_difference(varr, varr, varr3); + (void) set_symmetric_difference(iarr, iarr, iarr, iarr, iarr3, validating_less{}); + (void) set_symmetric_difference(iarr, iarr, iarr3, validating_less{}); + + (void) push_heap(varr3, varr3 + 1); + (void) push_heap(varr3); + (void) push_heap(iarr3, iarr3 + 1, validating_less{}); + (void) push_heap(iarr3, {}, validating_identity{}); + + (void) pop_heap(varr3, varr3 + 1); + (void) pop_heap(varr3); + (void) pop_heap(iarr3, iarr3 + 1, validating_less{}); + (void) pop_heap(iarr3, {}, validating_identity{}); + + (void) make_heap(varr3, varr3 + 1); + (void) make_heap(varr3); + (void) make_heap(iarr3, iarr3 + 1, validating_less{}); + (void) make_heap(iarr3, {}, validating_identity{}); + + (void) sort_heap(varr3, varr3 + 1); + (void) sort_heap(varr3); + (void) sort_heap(iarr3, iarr3 + 1, validating_less{}); + (void) sort_heap(iarr3, {}, validating_identity{}); + + (void) is_heap(varr3, varr3 + 1); + (void) is_heap(varr3); + (void) is_heap(iarr3, iarr3 + 1, validating_less{}); + (void) is_heap(iarr3, {}, validating_identity{}); + + (void) is_heap_until(varr3, varr3 + 1); + (void) is_heap_until(varr3); + (void) is_heap_until(iarr3, iarr3 + 1, validating_less{}); + (void) is_heap_until(iarr3, {}, validating_identity{}); + (void) min(+varr, +varr); (void) min({+varr, +varr}); (void) min(varr); @@ -322,6 +390,16 @@ void test_ranges_algorithms() { (void) lexicographical_compare(varr, varr); (void) lexicographical_compare(iarr, iarr, iarr, iarr, validating_less{}); (void) lexicographical_compare(iarr, iarr, validating_less{}); + + (void) next_permutation(varr, varr); + (void) next_permutation(varr); + (void) next_permutation(iarr, iarr, validating_less{}); + (void) next_permutation(iarr, {}, validating_identity{}); + + (void) prev_permutation(varr, varr); + (void) prev_permutation(varr); + (void) prev_permutation(iarr, iarr, validating_less{}); + (void) prev_permutation(iarr, {}, validating_identity{}); } // Separated test for ranges::count and equality