diff --git a/llvm-project b/llvm-project
index 57f42a8765c..2e2b6b53f5f 160000
--- a/llvm-project
+++ b/llvm-project
@@ -1 +1 @@
-Subproject commit 57f42a8765cd3d878be4fb59ad44c85f8a7ca223
+Subproject commit 2e2b6b53f5f63179b52168ee156df7c76b90bc71
diff --git a/stl/debugger/STL.natvis b/stl/debugger/STL.natvis
index a3047ef51d3..01e8dd606b6 100644
--- a/stl/debugger/STL.natvis
+++ b/stl/debugger/STL.natvis
@@ -362,6 +362,35 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+
+ make_shared<T[N]>
+
+ - _Storage._Value
+
+
+
+
+
+
+
+ make_shared<T[]>
+
+
+ size()
+ data()
+
+
+
+
+
+
+ make_shared<T[]>
+
+ - _Storage._Value
+
+
+
allocate_shared
@@ -386,6 +415,81 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+
+
+
+
+
+ allocate_shared<T[N]>
+
+ - _Storage._Value
+ - allocator()
+
+
+
+
+
+
+
+
+
+
+
+ allocate_shared<T[]>
+
+ - allocator()
+
+ size()
+ data()
+
+
+
+
+
+
+
+
+
+
+ allocate_shared_for_overwrite
+
+ - ($T1 *) &_Storage
+ - allocator()
+
+
+
+
+
+
+
+
+
+ allocate_shared_for_overwrite<T[N]>
+
+ - _Storage._Value
+ - allocator()
+
+
+
+
+
+
+
+
+
+
+
+ allocate_shared_for_overwrite<T[]>
+
+ - allocator()
+
+ size()
+ data()
+
+
+
+
custom deleter
diff --git a/stl/inc/algorithm b/stl/inc/algorithm
index c2d974151b3..47f957d9ed2 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);
}
}
@@ -4529,7 +4529,7 @@ _CONSTEXPR20 _OutIt unique_copy(_InIt _First, _InIt _Last, _OutIt _Dest, _Pr _Pr
++_UDest;
} else { // can't reread source or dest, construct a temporary
- _Iter_value_t<_InIt> _Val = *_UFirst;
+ _Iter_value_t<_InIt> _Val(*_UFirst);
*_UDest = _Val;
++_UDest;
@@ -4656,7 +4656,7 @@ namespace ranges {
}
} else {
// Neither _First nor _Result can be reread, construct temporary
- iter_value_t<_It> _Val = *_First;
+ iter_value_t<_It> _Val(*_First);
while (++_First != _Last) {
if (!_STD invoke(_Pred, _STD invoke(_Proj, _Val), _STD invoke(_Proj, *_First))) {
@@ -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));
+ _Iter_value_t<_RanIt> _Val(_STD move(*--_ULast));
+ _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));
}
}
@@ -6393,7 +6393,7 @@ namespace ranges {
}
--_Last;
- iter_value_t<_It> _Val = _RANGES iter_move(_Last);
+ iter_value_t<_It> _Val(_RANGES iter_move(_Last));
// NB: if _Proj is a _Ref_fn, this aliases the _Proj1 and _Proj2 parameters of _Push_heap_by_index
_RANGES _Push_heap_by_index(_STD move(_First), _Count - 1, 0, _STD move(_Val), _Pred, _Proj, _Proj);
}
@@ -6449,7 +6449,7 @@ _CONSTEXPR20 void _Pop_heap_unchecked(_RanIt _First, _RanIt _Last, _Pr _Pred) {
// pop *_First to *(_Last - 1) and reheap
if (2 <= _Last - _First) {
--_Last;
- _Iter_value_t<_RanIt> _Val = _STD move(*_Last);
+ _Iter_value_t<_RanIt> _Val(_STD move(*_Last));
_STD _Pop_heap_hole_unchecked(_First, _Last, _Last, _STD move(_Val), _Pred);
}
}
@@ -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
@@ -6527,7 +6527,7 @@ namespace ranges {
}
--_Last;
- iter_value_t<_It> _Val = _RANGES iter_move(_Last);
+ iter_value_t<_It> _Val(_RANGES iter_move(_Last));
// NB: if _Proj is a _Ref_fn, this aliases the _Proj1 and _Proj2 parameters of _Pop_heap_hole_unchecked
_RANGES _Pop_heap_hole_unchecked(_STD move(_First), _Last, _Last, _STD move(_Val), _Pred, _Proj, _Proj);
}
@@ -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));
}
}
@@ -6571,15 +6572,15 @@ _CONSTEXPR20 void _Make_heap_unchecked(_RanIt _First, _RanIt _Last, _Pr _Pred) {
for (_Diff _Hole = _Bottom >> 1; _Hole > 0;) { // shift for codegen
// reheap top half, bottom to top
--_Hole;
- _Iter_value_t<_RanIt> _Val = _STD move(*(_First + _Hole));
+ _Iter_value_t<_RanIt> _Val(_STD move(*(_First + _Hole)));
_STD _Pop_heap_hole_by_index(_First, _Hole, _Bottom, _STD move(_Val), _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
@@ -6598,7 +6599,7 @@ namespace ranges {
for (_Diff _Hole = _Bottom >> 1; _Hole > 0;) { // shift for codegen
// reheap top half, bottom to top
--_Hole;
- iter_value_t<_It> _Val = _RANGES iter_move(_First + _Hole);
+ iter_value_t<_It> _Val(_RANGES iter_move(_First + _Hole));
// NB: if _Proj is a _Ref_fn, this aliases the _Proj1 and _Proj2 parameters of _Pop_heap_hole_by_index
_RANGES _Pop_heap_hole_by_index(_First, _Hole, _Bottom, _STD move(_Val), _Pred, _Proj, _Proj);
}
@@ -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;
}
@@ -7862,8 +7866,8 @@ _CONSTEXPR20 _BidIt _Insertion_sort_unchecked(const _BidIt _First, const _BidIt
// insertion sort [_First, _Last)
if (_First != _Last) {
for (_BidIt _Mid = _First; ++_Mid != _Last;) { // order next element
- _BidIt _Hole = _Mid;
- _Iter_value_t<_BidIt> _Val = _STD move(*_Mid);
+ _BidIt _Hole = _Mid;
+ _Iter_value_t<_BidIt> _Val(_STD move(*_Mid));
if (_DEBUG_LT_PRED(_Pred, _Val, *_First)) { // found new earliest element, move to front
_Move_backward_unchecked(_First, _Mid, ++_Hole);
@@ -8051,8 +8055,8 @@ namespace ranges {
}
for (auto _Mid = _First; ++_Mid != _Last;) { // order next element
- iter_value_t<_It> _Val = _RANGES iter_move(_Mid);
- auto _Hole = _Mid;
+ iter_value_t<_It> _Val(_RANGES iter_move(_Mid));
+ auto _Hole = _Mid;
for (auto _Prev = _Hole;;) {
--_Prev;
@@ -8713,7 +8717,7 @@ _CONSTEXPR20 void partial_sort(_RanIt _First, _RanIt _Mid, _RanIt _Last, _Pr _Pr
_Make_heap_unchecked(_UFirst, _UMid, _Pass_fn(_Pred));
for (auto _UNext = _UMid; _UNext < _ULast; ++_UNext) {
if (_DEBUG_LT_PRED(_Pred, *_UNext, *_UFirst)) { // replace top with new largest
- _Iter_value_t<_RanIt> _Val = _STD move(*_UNext);
+ _Iter_value_t<_RanIt> _Val(_STD move(*_UNext));
_STD _Pop_heap_hole_unchecked(_UFirst, _UMid, _UNext, _STD move(_Val), _Pass_fn(_Pred));
}
}
@@ -8803,7 +8807,7 @@ namespace ranges {
for (auto _Next = _Mid; _Next != _Last; ++_Next) {
if (_STD invoke(_Pred, _STD invoke(_Proj, *_Next), _STD invoke(_Proj, *_First))) {
// replace top with new largest
- iter_value_t<_It> _Val = _RANGES iter_move(_Next);
+ iter_value_t<_It> _Val(_RANGES iter_move(_Next));
_RANGES _Pop_heap_hole_unchecked(_First, _Mid, _Next, _STD move(_Val), _Pred, _Proj, _Proj);
}
}
@@ -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/bitset b/stl/inc/bitset
index 826752bd49e..627bf330601 100644
--- a/stl/inc/bitset
+++ b/stl/inc/bitset
@@ -18,6 +18,15 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new
+#if _USE_STD_VECTOR_ALGORITHMS
+extern "C" {
+__declspec(noalias) void __stdcall __std_bitset_to_string_1(
+ char* _Dest, const void* _Src, size_t _Size_bits, char _Elem0, char _Elem1) noexcept;
+__declspec(noalias) void __stdcall __std_bitset_to_string_2(
+ wchar_t* _Dest, const void* _Src, size_t _Size_bits, wchar_t _Elem0, wchar_t _Elem1) noexcept;
+} // extern "C"
+#endif // _USE_STD_VECTOR_ALGORITHMS
+
_STD_BEGIN
_EXPORT_STD template
class bitset { // store fixed-length sequence of Boolean elements
@@ -348,6 +357,23 @@ public:
// convert bitset to string
basic_string<_Elem, _Tr, _Alloc> _Str;
_Str._Resize_and_overwrite(_Bits, [this, _Elem0, _Elem1](_Elem* _Buf, size_t _Len) {
+#if _USE_STD_VECTOR_ALGORITHMS
+ constexpr size_t _Bitset_vector_threshold = 32;
+ if constexpr (_Bits >= _Bitset_vector_threshold && is_integral_v<_Elem> && sizeof(_Elem) <= 2) {
+ if (!_Is_constant_evaluated()) {
+ if constexpr (sizeof(_Elem) == 1) {
+ __std_bitset_to_string_1(reinterpret_cast(_Buf), _Array, _Len, static_cast(_Elem0),
+ static_cast(_Elem1));
+ } else {
+ _STL_INTERNAL_STATIC_ASSERT(sizeof(_Elem) == 2);
+ __std_bitset_to_string_2(reinterpret_cast(_Buf), _Array, _Len,
+ static_cast(_Elem0), static_cast(_Elem1));
+ }
+ return _Len;
+ }
+ }
+#endif // _USE_STD_VECTOR_ALGORITHMS
+
for (size_t _Pos = 0; _Pos < _Len; ++_Pos) {
_Buf[_Pos] = _Subscript(_Len - 1 - _Pos) ? _Elem1 : _Elem0;
}
diff --git a/stl/inc/deque b/stl/inc/deque
index 3ce93fd2e3f..ba0794eb243 100644
--- a/stl/inc/deque
+++ b/stl/inc/deque
@@ -989,19 +989,74 @@ public:
}
void shrink_to_fit() {
- size_type _Oldcapacity = _Block_size * _Mapsize();
- size_type _Newcapacity = _Oldcapacity / 2;
+ if (empty()) {
+ if (_Map() != nullptr) {
+ _Reset_map();
+ }
+ return;
+ }
+
+ const auto _Mask = static_cast(_Mapsize() - 1);
+
+ const auto _First_used_block_idx = static_cast(_Myoff() / _Block_size);
+
+ // (_Myoff() + _Mysize() - 1) is for the last element, i.e. the back() of the deque.
+ // Divide by _Block_size to get the unmasked index of the last used block.
+ // Add 1 to get the unmasked index of the first unused block.
+ const auto _Unmasked_first_unused_block_idx =
+ static_cast(((_Myoff() + _Mysize() - 1) / _Block_size) + 1);
+
+ const auto _First_unused_block_idx = static_cast(_Unmasked_first_unused_block_idx & _Mask);
+
+ // deallocate unused blocks, traversing over the circular buffer until the first used block index
+ for (auto _Block_idx = _First_unused_block_idx; _Block_idx != _First_used_block_idx;
+ _Block_idx = static_cast((_Block_idx + 1) & _Mask)) {
+ auto& _Block_ptr = _Map()[static_cast<_Map_difference_type>(_Block_idx)];
+ if (_Block_ptr != nullptr) {
+ _Getal().deallocate(_Block_ptr, _Block_size);
+ _Block_ptr = nullptr;
+ }
+ }
+
+ const auto _Used_block_count = static_cast(_Unmasked_first_unused_block_idx - _First_used_block_idx);
+
+ size_type _New_block_count = _Minimum_map_size; // should be power of 2
+
+ while (_New_block_count < _Used_block_count) {
+ _New_block_count *= 2;
+ }
+
+ if (_New_block_count >= _Mapsize()) {
+ return;
+ }
+
+ // worth shrinking the internal map, do it
+
+ _Alpty _Almap(_Getal());
+ const auto _New_map = _Almap.allocate(_New_block_count);
- if (_Newcapacity < _Block_size * _Minimum_map_size) {
- _Newcapacity = _Block_size * _Minimum_map_size;
+ _Orphan_all(); // the map can be shrunk, invalidate all iterators
+
+ // transfer the ownership of blocks to pointers in the new map
+ for (size_type _Block = 0; _Block != _Used_block_count; ++_Block) {
+ const auto _New_block_idx = static_cast<_Map_difference_type>(_Block);
+ const auto _Old_block_idx = static_cast<_Map_difference_type>((_First_used_block_idx + _Block) & _Mask);
+ _STD _Construct_in_place(_New_map[_New_block_idx], _Map()[_Old_block_idx]);
}
- if ((empty() && _Mapsize() > 0)
- || (!empty() && size() <= _Newcapacity && _Newcapacity < _Oldcapacity)) { // worth shrinking, do it
- deque _Tmp(
- _STD make_move_iterator(_Unchecked_begin()), _STD make_move_iterator(_Unchecked_end()), _Getal());
- swap(_Tmp);
+ // null out the rest of the new map
+ _STD _Uninitialized_value_construct_n_unchecked1(
+ _New_map + static_cast<_Map_difference_type>(_Used_block_count), _New_block_count - _Used_block_count);
+
+ for (auto _Block = _Map_distance(); _Block > 0;) {
+ --_Block;
+ _STD _Destroy_in_place(_Map()[_Block]); // destroy pointer to block
}
+ _Almap.deallocate(_Map(), _Mapsize()); // free storage for map
+
+ _Map() = _New_map;
+ _Mapsize() = _New_block_count;
+ _Myoff() %= _Block_size; // the first element is within block index 0 of the new map
}
_NODISCARD const_reference operator[](size_type _Pos) const noexcept /* strengthened */ {
@@ -1591,27 +1646,37 @@ private:
_Mapsize() += _Count;
}
+ void _Reset_map() noexcept {
+ // pre: each block pointer is either null or pointing to a block without constructed elements
+
+ for (auto _Block = _Map_distance(); _Block > 0;) { // free storage for a block and destroy pointer
+ --_Block;
+ auto& _Block_ptr = _Map()[_Block];
+ if (_Block_ptr) { // free block
+ _Getal().deallocate(_Block_ptr, _Block_size);
+ }
+ _STD _Destroy_in_place(_Block_ptr); // destroy pointer to block
+ }
+
+ _Alpty _Almap(_Getal());
+ _Almap.deallocate(_Map(), _Mapsize()); // free storage for map
+
+ _Map() = nullptr;
+ _Mapsize() = 0;
+ }
+
void _Tidy() noexcept { // free all storage
_Orphan_all();
- _Alpty _Almap(_Getal());
while (!empty()) {
pop_back();
}
if (_Map() != nullptr) {
- for (auto _Block = _Map_distance(); _Block > 0;) { // free storage for a block and destroy pointer
- if (_Map()[--_Block]) { // free block
- _Getal().deallocate(_Map()[_Block], _Block_size);
- }
- _Destroy_in_place(_Map()[_Block]); // destroy pointer to block
- }
-
- _Almap.deallocate(_Map(), _Mapsize()); // free storage for map
+ _Reset_map();
}
- _Mapsize() = 0;
- _Map() = nullptr;
+ _STL_INTERNAL_CHECK(_Mapsize() == 0); // null map should always be paired with zero mapsize
}
#if _ITERATOR_DEBUG_LEVEL == 2
diff --git a/stl/inc/execution b/stl/inc/execution
index c40636af786..6daa8a156ad 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/expected b/stl/inc/expected
index 69bee016bb0..8a17025e66d 100644
--- a/stl/inc/expected
+++ b/stl/inc/expected
@@ -95,7 +95,7 @@ public:
// [expected.un.eq]
template
_NODISCARD_FRIEND constexpr bool operator==(const unexpected& _Left, const unexpected<_UErr>& _Right) noexcept(
- noexcept(_Fake_copy_init(_Left._Unexpected == _Right.error()))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(_Left._Unexpected == _Right.error()))) /* strengthened */ {
return _Left._Unexpected == _Right.error();
}
@@ -182,6 +182,28 @@ struct _Check_expected_argument : true_type {
"T must not be a (possibly cv-qualified) specialization of unexpected. (N4950 [expected.object.general]/2)");
};
+template
+concept _Expected_binary_copy_assignable =
+ is_copy_assignable_v<_Ty> && is_copy_constructible_v<_Ty> //
+ && is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err>
+ && (is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>);
+
+template
+concept _Expected_binary_move_assignable =
+ is_move_assignable_v<_Ty> && is_move_constructible_v<_Ty> //
+ && is_move_assignable_v<_Err> && is_move_constructible_v<_Err>
+ && (is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>);
+
+template // used with both _Ty and _Err
+concept _Trivially_copy_constructible_assignable_destructible =
+ is_trivially_copy_constructible_v<_Type> && is_trivially_copy_assignable_v<_Type>
+ && is_trivially_destructible_v<_Type>;
+
+template // used with both _Ty and _Err
+concept _Trivially_move_constructible_assignable_destructible =
+ is_trivially_move_constructible_v<_Type> && is_trivially_move_assignable_v<_Type>
+ && is_trivially_destructible_v<_Type>;
+
_EXPORT_STD template
class expected {
private:
@@ -390,9 +412,7 @@ public:
constexpr expected& operator=(const expected& _Other) noexcept(
is_nothrow_copy_constructible_v<_Ty> && is_nothrow_copy_constructible_v<_Err>
&& is_nothrow_copy_assignable_v<_Ty> && is_nothrow_copy_assignable_v<_Err>) // strengthened
- requires is_copy_assignable_v<_Ty> && is_copy_constructible_v<_Ty> //
- && is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err>
- && (is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>)
+ requires _Expected_binary_copy_assignable<_Ty, _Err>
{
if (_Has_value && _Other._Has_value) {
_Value = _Other._Value;
@@ -408,12 +428,16 @@ public:
return *this;
}
+ expected& operator=(const expected&)
+ requires _Expected_binary_copy_assignable<_Ty, _Err>
+ && _Trivially_copy_constructible_assignable_destructible<_Ty>
+ && _Trivially_copy_constructible_assignable_destructible<_Err>
+ = default;
+
constexpr expected& operator=(expected&& _Other) noexcept(
is_nothrow_move_constructible_v<_Ty> && is_nothrow_move_constructible_v<_Err>
&& is_nothrow_move_assignable_v<_Ty> && is_nothrow_move_assignable_v<_Err>)
- requires is_move_assignable_v<_Ty> && is_move_constructible_v<_Ty> //
- && is_move_assignable_v<_Err> && is_move_constructible_v<_Err>
- && (is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>)
+ requires _Expected_binary_move_assignable<_Ty, _Err>
{
if (_Has_value && _Other._Has_value) {
_Value = _STD move(_Other._Value);
@@ -429,6 +453,12 @@ public:
return *this;
}
+ expected& operator=(expected&&)
+ requires _Expected_binary_move_assignable<_Ty, _Err>
+ && _Trivially_move_constructible_assignable_destructible<_Ty>
+ && _Trivially_move_constructible_assignable_destructible<_Err>
+ = default;
+
template
requires (!is_same_v, expected> && !_Is_specialization_v, unexpected>
&& is_constructible_v<_Ty, _Uty> && is_assignable_v<_Ty&, _Uty>
@@ -1096,8 +1126,8 @@ public:
template
requires (!is_void_v<_Uty>)
_NODISCARD_FRIEND constexpr bool operator==(const expected& _Left, const expected<_Uty, _UErr>& _Right) noexcept(
- noexcept(_Fake_copy_init(_Left._Value == *_Right)) && noexcept(
- _Fake_copy_init(_Left._Unexpected == _Right.error()))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(_Left._Value == *_Right)) && noexcept(
+ _STD _Fake_copy_init(_Left._Unexpected == _Right.error()))) /* strengthened */ {
if (_Left._Has_value != _Right.has_value()) {
return false;
} else if (_Left._Has_value) {
@@ -1162,6 +1192,12 @@ private:
bool _Has_value;
};
+template
+concept _Expected_unary_copy_assignable = is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err>;
+
+template
+concept _Expected_unary_move_assignable = is_move_assignable_v<_Err> && is_move_constructible_v<_Err>;
+
template
requires is_void_v<_Ty>
class expected<_Ty, _Err> {
@@ -1278,7 +1314,7 @@ public:
// [expected.void.assign]
constexpr expected& operator=(const expected& _Other) noexcept(
is_nothrow_copy_constructible_v<_Err> && is_nothrow_copy_assignable_v<_Err>) // strengthened
- requires is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err>
+ requires _Expected_unary_copy_assignable<_Err>
{
if (_Has_value && _Other._Has_value) {
// nothing to do
@@ -1297,9 +1333,13 @@ public:
return *this;
}
+ expected& operator=(const expected&)
+ requires _Expected_unary_copy_assignable<_Err> && _Trivially_copy_constructible_assignable_destructible<_Err>
+ = default;
+
constexpr expected& operator=(expected&& _Other) noexcept(
is_nothrow_move_constructible_v<_Err> && is_nothrow_move_assignable_v<_Err>)
- requires is_move_assignable_v<_Err> && is_move_constructible_v<_Err>
+ requires _Expected_unary_move_assignable<_Err>
{
if (_Has_value && _Other._Has_value) {
// nothing to do
@@ -1318,6 +1358,10 @@ public:
return *this;
}
+ expected& operator=(expected&&)
+ requires _Expected_unary_move_assignable<_Err> && _Trivially_move_constructible_assignable_destructible<_Err>
+ = default;
+
template
requires is_constructible_v<_Err, const _UErr&> && is_assignable_v<_Err&, const _UErr&>
constexpr expected& operator=(const unexpected<_UErr>& _Other) noexcept(
diff --git a/stl/inc/filesystem b/stl/inc/filesystem
index 4b2ad4ce9b8..a08e435d4cc 100644
--- a/stl/inc/filesystem
+++ b/stl/inc/filesystem
@@ -1377,6 +1377,35 @@ namespace filesystem {
#endif // ^^^ !_HAS_CXX20 ^^^
_NODISCARD_FRIEND path operator/(const path& _Left, const path& _Right) { // append a pair of paths together
+ const auto _Right_size = _Right._Text.size();
+ const auto _Right_first = _Right._Text.data();
+ const auto _Right_last = _Right_first + _Right_size;
+
+ // Handle the most common case: !has_root_name(_Right) && !has_root_directory(_Right)
+ if (_Right_size != 0 && !_Has_drive_letter_prefix(_Right_first, _Right_last) && !_Is_slash(*_Right_first)) {
+ const auto _Left_size = _Left._Text.size();
+ const auto _Left_first = _Left._Text.data();
+ const auto _Left_last = _Left_first + _Left_size;
+
+ // Appending a slash to "X:" would make it an absolute path
+ const bool _Left_is_just_drive = _Left_size == 2 && _Is_drive_prefix(_Left_first);
+ const bool _Is_slash_needed = _Left_size != 0 && !_Left_is_just_drive && !_Is_slash(_Left_last[-1]);
+
+ const auto _Total_size = _Left_size + static_cast(_Is_slash_needed) + _Right_size;
+
+ path _Tmp;
+ _Tmp._Text._Resize_and_overwrite(_Total_size, [=](wchar_t* _Ptr, const size_t _Size) {
+ _CSTD memcpy(_Ptr, _Left_first, _Left_size * sizeof(wchar_t));
+ _Ptr += _Left_size;
+ if (_Is_slash_needed) {
+ *_Ptr++ = preferred_separator;
+ }
+ _CSTD memcpy(_Ptr, _Right_first, _Right_size * sizeof(wchar_t));
+ return _Size;
+ });
+ return _Tmp;
+ }
+
path _Tmp = _Left;
_Tmp /= _Right;
return _Tmp;
diff --git a/stl/inc/format b/stl/inc/format
index b0b97ca0575..d5e6de99b86 100644
--- a/stl/inc/format
+++ b/stl/inc/format
@@ -2967,6 +2967,7 @@ _NODISCARD _OutputIt _Fmt_write(
auto _Format = chars_format::general;
auto _Exponent = 'e';
auto _Precision = _Specs._Precision;
+ auto _None_type = false;
switch (_Specs._Type) {
case 'A':
@@ -3003,6 +3004,9 @@ _NODISCARD _OutputIt _Fmt_write(
}
_Format = chars_format::general;
break;
+ default:
+ _None_type = true;
+ break;
}
// Consider the powers of 2 in decimal:
@@ -3043,7 +3047,11 @@ _NODISCARD _OutputIt _Fmt_write(
_Result.ptr += 3;
} else {
if (_Precision == -1) {
- _Result = _STD to_chars(_Buffer, _STD end(_Buffer), _Value, _Format);
+ if (_None_type) {
+ _Result = _STD to_chars(_Buffer, _STD end(_Buffer), _Value);
+ } else {
+ _Result = _STD to_chars(_Buffer, _STD end(_Buffer), _Value, _Format);
+ }
} else {
_Result = _STD to_chars(_Buffer, _STD end(_Buffer), _Value, _Format, _Precision);
}
diff --git a/stl/inc/ios b/stl/inc/ios
index 881c292ba29..24353546712 100644
--- a/stl/inc/ios
+++ b/stl/inc/ios
@@ -206,8 +206,8 @@ _EXPORT_STD inline ios_base& __CLRCALL_OR_CDECL hex(ios_base& _Iosbase) { // set
return _Iosbase;
}
-_EXPORT_STD inline ios_base& __CLRCALL_OR_CDECL hexfloat(ios_base& _Iosbase) { // set floatfield to hexfloat
- _Iosbase.setf(ios_base::hexfloat, ios_base::floatfield);
+_EXPORT_STD inline ios_base& __CLRCALL_OR_CDECL hexfloat(ios_base& _Iosbase) { // set floatfield to (scientific | fixed)
+ _Iosbase.setf(ios_base::scientific | ios_base::fixed, ios_base::floatfield);
return _Iosbase;
}
diff --git a/stl/inc/memory b/stl/inc/memory
index 8b528752403..8ad20eb7cde 100644
--- a/stl/inc/memory
+++ b/stl/inc/memory
@@ -1821,7 +1821,7 @@ private:
template
friend shared_ptr<_Ty0> _Make_shared_unbounded_array(size_t _Count, const _ArgTypes&... _Args);
- template
+ template
friend shared_ptr<_Ty0> _Allocate_shared_unbounded_array(
const _Alloc& _Al, size_t _Count, const _ArgTypes&... _Args);
#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv
@@ -2461,16 +2461,14 @@ public:
template
explicit _Ref_count_obj_alloc3(const _Alloc& _Al_arg, _Types&&... _Args)
: _Ebco_base<_Rebound>(_Al_arg), _Ref_count_base() {
-#if _HAS_CXX20
- if constexpr (sizeof...(_Types) == 1 && (is_same_v<_For_overwrite_tag, remove_cvref_t<_Types>> && ...)) {
- _Default_construct_in_place(_Storage._Value);
- ((void) _Args, ...);
- } else
-#endif // _HAS_CXX20
- {
- allocator_traits<_Rebound>::construct(
- this->_Get_val(), _STD addressof(_Storage._Value), _STD forward<_Types>(_Args)...);
+#if _HAS_CXX20 && defined(_ENABLE_STL_INTERNAL_CHECK)
+ if constexpr (sizeof...(_Types) == 1) {
+ // allocate_shared_for_overwrite should use another type for the control block
+ _STL_INTERNAL_STATIC_ASSERT(!(is_same_v<_For_overwrite_tag, remove_cvref_t<_Types>> && ...));
}
+#endif // _HAS_CXX20 && defined(_ENABLE_STL_INTERNAL_CHECK)
+ allocator_traits<_Rebound>::construct(
+ this->_Get_val(), _STD addressof(_Storage._Value), _STD forward<_Types>(_Args)...);
}
union {
@@ -2496,6 +2494,44 @@ private:
};
#if _HAS_CXX20
+template
+class _Ref_count_obj_alloc_for_overwrite : public _Ebco_base<_Rebind_alloc_t<_Alloc, _Ty>>, public _Ref_count_base {
+ // handle reference counting for object in control block, allocator
+ // initialize and destroy objects by the default mechanism
+private:
+ static_assert(is_same_v<_Ty, remove_cv_t<_Ty>>, "allocate_shared_for_overwrite should remove_cv_t");
+
+ using _Rebound = _Rebind_alloc_t<_Alloc, _Ty>;
+
+public:
+ template
+ explicit _Ref_count_obj_alloc_for_overwrite(const _Alloc& _Al_arg)
+ : _Ebco_base<_Rebound>(_Al_arg), _Ref_count_base() {
+ _Default_construct_in_place(_Storage._Value);
+ }
+
+ union {
+ _Wrap<_Ty> _Storage;
+ };
+
+private:
+ ~_Ref_count_obj_alloc_for_overwrite() noexcept override { // TRANSITION, should be non-virtual
+ // nothing to do; _Storage._Value already destroyed by _Destroy()
+
+ // See N4964 [class.dtor]/7.
+ }
+
+ void _Destroy() noexcept override { // destroy managed resource
+ _Destroy_in_place(_Storage._Value); // use the default mechanism per LWG-4024
+ }
+
+ void _Delete_this() noexcept override { // destroy self
+ _Rebind_alloc_t<_Alloc, _Ref_count_obj_alloc_for_overwrite> _Al(this->_Get_val());
+ this->~_Ref_count_obj_alloc_for_overwrite();
+ _Deallocate_plain(_Al, this);
+ }
+};
+
template
class _NODISCARD _Uninitialized_rev_destroying_backout_al {
// class to undo partially constructed ranges in _Uninitialized_xxx_al algorithms
@@ -2647,11 +2683,10 @@ public:
template
explicit _Ref_count_unbounded_array_alloc(const _Alloc& _Al_arg, const size_t _Count, const _Arg& _Val)
: _Ebco_base<_Rebound>(_Al_arg), _Ref_count_base(), _Size(_Count) {
- if constexpr (is_same_v<_For_overwrite_tag, _Arg>) {
- _Uninitialized_default_construct_multidimensional_n(_Get_ptr(), _Size); // the allocator isn't needed
- } else {
- _Uninitialized_fill_multidimensional_n_al(_Get_ptr(), _Size, _Val, this->_Get_val());
- }
+ // allocate_shared_for_overwrite should use another type for the control block
+ _STL_INTERNAL_STATIC_ASSERT(!is_same_v<_For_overwrite_tag, _Arg>);
+
+ _Uninitialized_fill_multidimensional_n_al(_Get_ptr(), _Size, _Val, this->_Get_val());
}
_NODISCARD auto _Get_ptr() noexcept {
@@ -2694,6 +2729,65 @@ private:
}
};
+template
+class _Ref_count_unbounded_array_alloc_for_overwrite
+ : public _Ebco_base<_Rebind_alloc_t<_Alloc, remove_all_extents_t<_Ty>>>,
+ public _Ref_count_base {
+ // handle reference counting for unbounded array in control block, allocator
+ // initialize and destroy objects by the default mechanism
+private:
+ static_assert(is_unbounded_array_v<_Ty>);
+ static_assert(is_same_v<_Ty, remove_cv_t<_Ty>>, "allocate_shared_for_overwrite should remove_cv_t");
+
+ using _Item = remove_all_extents_t<_Ty>;
+ using _Rebound = _Rebind_alloc_t<_Alloc, _Item>;
+
+public:
+ using _Element_type = remove_extent_t<_Ty>;
+
+ explicit _Ref_count_unbounded_array_alloc_for_overwrite(const _Alloc& _Al_arg, const size_t _Count)
+ : _Ebco_base<_Rebound>(_Al_arg), _Ref_count_base(), _Size(_Count) {
+ _Uninitialized_default_construct_multidimensional_n(_Get_ptr(), _Size); // the allocator isn't needed
+ }
+
+ _NODISCARD auto _Get_ptr() noexcept {
+ return _STD addressof(_Storage._Value);
+ }
+
+private:
+ size_t _Size;
+
+ union {
+ _Wrap<_Element_type> _Storage; // flexible array must be last member
+ };
+
+ ~_Ref_count_unbounded_array_alloc_for_overwrite() noexcept override { // TRANSITION, should be non-virtual
+ // nothing to do; _Storage._Value already destroyed by _Destroy()
+
+ // See N4964 [class.dtor]/7.
+ }
+
+ void _Destroy() noexcept override { // destroy managed resource
+ _Reverse_destroy_multidimensional_n(_Get_ptr(), _Size); // use the default mechanism per LWG-4024
+ }
+
+ void _Delete_this() noexcept override { // destroy self
+ constexpr size_t _Align = alignof(_Ref_count_unbounded_array_alloc_for_overwrite);
+ using _Storage = _Alignas_storage_unit<_Align>;
+ using _Rebound_alloc = _Rebind_alloc_t<_Alloc, _Storage>;
+
+ _Rebound_alloc _Al(this->_Get_val());
+ const size_t _Bytes = _Calculate_bytes_for_flexible_array< //
+ _Ref_count_unbounded_array_alloc_for_overwrite, _Check_overflow::_Nope>(_Size);
+ const size_t _Storage_units = _Bytes / sizeof(_Storage);
+
+ this->~_Ref_count_unbounded_array_alloc_for_overwrite();
+
+ _Al.deallocate(_STD _Refancy<_Alloc_ptr_t<_Rebound_alloc>>(reinterpret_cast<_Storage*>(this)),
+ static_cast<_Alloc_size_t<_Rebound_alloc>>(_Storage_units));
+ }
+};
+
template
class _Ref_count_bounded_array_alloc : public _Ebco_base<_Rebind_alloc_t<_Alloc, remove_all_extents_t<_Ty>>>,
public _Ref_count_base {
@@ -2714,12 +2808,10 @@ public:
template
explicit _Ref_count_bounded_array_alloc(const _Alloc& _Al_arg, const _Arg& _Val)
: _Ebco_base<_Rebound>(_Al_arg), _Ref_count_base() { // don't value-initialize _Storage
- if constexpr (is_same_v<_For_overwrite_tag, _Arg>) {
- _Uninitialized_default_construct_multidimensional_n(
- _Storage._Value, extent_v<_Ty>); // the allocator isn't needed
- } else {
- _Uninitialized_fill_multidimensional_n_al(_Storage._Value, extent_v<_Ty>, _Val, this->_Get_val());
- }
+ // allocate_shared_for_overwrite should use another type for the control block
+ _STL_INTERNAL_STATIC_ASSERT(!is_same_v<_For_overwrite_tag, _Arg>);
+
+ _Uninitialized_fill_multidimensional_n_al(_Storage._Value, extent_v<_Ty>, _Val, this->_Get_val());
}
union {
@@ -2745,6 +2837,50 @@ private:
_Deallocate_plain(_Al, this);
}
};
+
+template
+class _Ref_count_bounded_array_alloc_for_overwrite
+ : public _Ebco_base<_Rebind_alloc_t<_Alloc, remove_all_extents_t<_Ty>>>,
+ public _Ref_count_base {
+ // handle reference counting for bounded array in control block, allocator
+ // initialize and destroy objects by the default mechanism
+private:
+ static_assert(is_bounded_array_v<_Ty>);
+ static_assert(is_same_v<_Ty, remove_cv_t<_Ty>>, "allocate_shared_for_overwrite should remove_cv_t");
+
+ using _Item = remove_all_extents_t<_Ty>;
+ using _Rebound = _Rebind_alloc_t<_Alloc, _Item>;
+
+public:
+ explicit _Ref_count_bounded_array_alloc_for_overwrite(const _Alloc& _Al_arg)
+ : _Ebco_base<_Rebound>(_Al_arg), _Ref_count_base() { // don't value-initialize _Storage
+ _Uninitialized_default_construct_multidimensional_n(
+ _Storage._Value, extent_v<_Ty>); // the allocator isn't needed
+ }
+
+ union {
+ _Wrap<_Ty> _Storage;
+ };
+
+private:
+ ~_Ref_count_bounded_array_alloc_for_overwrite() noexcept override { // TRANSITION, should be non-virtual
+ // nothing to do; _Storage._Value already destroyed by _Destroy()
+
+ // See N4964 [class.dtor]/7.
+ }
+
+ void _Destroy() noexcept override { // destroy managed resource
+ // not _Storage._Value as _Ty is an array type (not a class type or a scalar type),
+ // and thus cannot be used as a pseudo-destructor (N4964 [expr.prim.id.dtor]).
+ _Destroy_in_place(_Storage); // use the default mechanism per LWG-4024
+ }
+
+ void _Delete_this() noexcept override { // destroy self
+ _Rebind_alloc_t<_Alloc, _Ref_count_bounded_array_alloc_for_overwrite> _Al(this->_Get_val());
+ this->~_Ref_count_bounded_array_alloc_for_overwrite();
+ _Deallocate_plain(_Al, this);
+ }
+};
#endif // _HAS_CXX20
_EXPORT_STD template
@@ -2884,12 +3020,14 @@ struct _Allocate_n_ptr {
_Allocate_n_ptr& operator=(const _Allocate_n_ptr&) = delete;
};
-_EXPORT_STD /* TRANSITION, VSO-1538698 */ template
+_EXPORT_STD /* TRANSITION, VSO-1538698 */ template
_NODISCARD shared_ptr<_Ty> _Allocate_shared_unbounded_array(
const _Alloc& _Al, const size_t _Count, const _ArgTypes&... _Args) {
// make a shared_ptr to an unbounded array
static_assert(is_unbounded_array_v<_Ty>);
- using _Refc = _Ref_count_unbounded_array_alloc, _Alloc>;
+ using _Refc = conditional_t<_IsForOverwrite, //
+ _Ref_count_unbounded_array_alloc_for_overwrite, _Alloc>,
+ _Ref_count_unbounded_array_alloc, _Alloc>>;
constexpr size_t _Align = alignof(_Refc);
using _Storage = _Alignas_storage_unit<_Align>;
_Rebind_alloc_t<_Alloc, _Storage> _Rebound(_Al);
@@ -2907,13 +3045,13 @@ _NODISCARD shared_ptr<_Ty> _Allocate_shared_unbounded_array(
_EXPORT_STD template
_NODISCARD_SMART_PTR_ALLOC enable_if_t, shared_ptr<_Ty>> allocate_shared(
const _Alloc& _Al, const size_t _Count) {
- return _Allocate_shared_unbounded_array<_Ty>(_Al, _Count);
+ return _Allocate_shared_unbounded_array(_Al, _Count);
}
_EXPORT_STD template
_NODISCARD_SMART_PTR_ALLOC enable_if_t, shared_ptr<_Ty>> allocate_shared(
const _Alloc& _Al, const size_t _Count, const remove_extent_t<_Ty>& _Val) {
- return _Allocate_shared_unbounded_array<_Ty>(_Al, _Count, _Val);
+ return _Allocate_shared_unbounded_array(_Al, _Count, _Val);
}
_EXPORT_STD template
@@ -2953,22 +3091,22 @@ _NODISCARD_SMART_PTR_ALLOC enable_if_t, shared_ptr<_T
shared_ptr<_Ty> _Ret;
if constexpr (is_array_v<_Ty>) {
// make a shared_ptr to a bounded array
- using _Refc = _Ref_count_bounded_array_alloc, _Alloc>;
+ using _Refc = _Ref_count_bounded_array_alloc_for_overwrite, _Alloc>;
using _Alblock = _Rebind_alloc_t<_Alloc, _Refc>;
_Alblock _Rebound(_Al);
_Alloc_construct_ptr _Constructor{_Rebound};
_Constructor._Allocate();
- ::new (_STD _Voidify_unfancy(_Constructor._Ptr)) _Refc(_Al, _For_overwrite_tag{});
+ ::new (_STD _Voidify_unfancy(_Constructor._Ptr)) _Refc(_Al);
const auto _Ptr = static_cast*>(_Constructor._Ptr->_Storage._Value);
_Ret._Set_ptr_rep_and_enable_shared(_Ptr, _STD _Unfancy(_Constructor._Release()));
} else {
// make a shared_ptr to non-array object
- using _Refoa = _Ref_count_obj_alloc3, _Alloc>;
+ using _Refoa = _Ref_count_obj_alloc_for_overwrite, _Alloc>;
using _Alblock = _Rebind_alloc_t<_Alloc, _Refoa>;
_Alblock _Rebound(_Al);
_Alloc_construct_ptr<_Alblock> _Constructor{_Rebound};
_Constructor._Allocate();
- _STD _Construct_in_place(*_Constructor._Ptr, _Al, _For_overwrite_tag{});
+ _STD _Construct_in_place(*_Constructor._Ptr, _Al);
const auto _Ptr = reinterpret_cast<_Ty*>(_STD addressof(_Constructor._Ptr->_Storage._Value));
_Ret._Set_ptr_rep_and_enable_shared(_Ptr, _STD _Unfancy(_Constructor._Release()));
}
@@ -2979,7 +3117,7 @@ _NODISCARD_SMART_PTR_ALLOC enable_if_t, shared_ptr<_T
_EXPORT_STD template
_NODISCARD_SMART_PTR_ALLOC enable_if_t, shared_ptr<_Ty>> allocate_shared_for_overwrite(
const _Alloc& _Al, const size_t _Count) {
- return _Allocate_shared_unbounded_array<_Ty>(_Al, _Count, _For_overwrite_tag{});
+ return _Allocate_shared_unbounded_array(_Al, _Count);
}
#endif // _HAS_CXX20
diff --git a/stl/inc/mutex b/stl/inc/mutex
index ce4c809f6a1..415aa79286e 100644
--- a/stl/inc/mutex
+++ b/stl/inc/mutex
@@ -32,18 +32,18 @@ _EXPORT_STD class condition_variable_any;
class _Mutex_base { // base class for all mutex types
public:
-#ifdef _ENABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
+#ifdef _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
+ _Mutex_base(int _Flags = 0) noexcept {
+ _Mtx_init_in_situ(_Mymtx(), _Flags | _Mtx_try);
+ }
+#else // ^^^ defined(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) / !defined(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) vvv
constexpr _Mutex_base(int _Flags = 0) noexcept {
_Mtx_storage._Critical_section = {};
_Mtx_storage._Thread_id = -1;
_Mtx_storage._Type = _Flags | _Mtx_try;
_Mtx_storage._Count = 0;
}
-#else // ^^^ _ENABLE_CONSTEXPR_MUTEX_CONSTRUCTOR / !_ENABLE_CONSTEXPR_MUTEX_CONSTRUCTOR vvv
- _Mutex_base(int _Flags = 0) noexcept {
- _Mtx_init_in_situ(_Mymtx(), _Flags | _Mtx_try);
- }
-#endif // ^^^ !_ENABLE_CONSTEXPR_MUTEX_CONSTRUCTOR ^^^
+#endif // ^^^ !defined(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) ^^^
~_Mutex_base() noexcept {
_Mtx_destroy_in_situ(_Mymtx());
diff --git a/stl/inc/numeric b/stl/inc/numeric
index e3c2cdc7276..c9ffb26b598 100644
--- a/stl/inc/numeric
+++ b/stl/inc/numeric
@@ -343,7 +343,7 @@ _CONSTEXPR20 _OutIt inclusive_scan(const _InIt _First, const _InIt _Last, _OutIt
const auto _ULast = _Get_unwrapped(_Last);
auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast));
if (_UFirst != _ULast) {
- _Iter_value_t<_InIt> _Val = *_UFirst; // Requirement missing from N4950
+ _Iter_value_t<_InIt> _Val(*_UFirst); // Requirement missing from N4950
for (;;) {
*_UDest = _Val;
++_UDest;
@@ -476,10 +476,10 @@ _CONSTEXPR20 _OutIt adjacent_difference(const _InIt _First, const _InIt _Last, _
const auto _ULast = _Get_unwrapped(_Last);
auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast));
if (_UFirst != _ULast) {
- _Iter_value_t<_InIt> _Val = *_UFirst;
- *_UDest = _Val;
+ _Iter_value_t<_InIt> _Val(*_UFirst);
+ *_UDest = _Val;
while (++_UFirst != _ULast) { // compute another difference
- _Iter_value_t<_InIt> _Tmp = *_UFirst;
+ _Iter_value_t<_InIt> _Tmp(*_UFirst);
#if _HAS_CXX20
*++_UDest = _Func(_Tmp, _STD move(_Val));
#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv
diff --git a/stl/inc/optional b/stl/inc/optional
index b18ca175333..47fe2d98365 100644
--- a/stl/inc/optional
+++ b/stl/inc/optional
@@ -623,7 +623,7 @@ optional(_Ty) -> optional<_Ty>;
_EXPORT_STD template
_NODISCARD constexpr bool operator==(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left == *_Right))) /* strengthened */
+ noexcept(_STD _Fake_copy_init(*_Left == *_Right))) /* strengthened */
#ifdef __cpp_lib_concepts
requires requires {
{ *_Left == *_Right } -> _Implicitly_convertible_to;
@@ -640,7 +640,7 @@ _NODISCARD constexpr bool operator==(const optional<_Ty1>& _Left, const optional
_EXPORT_STD template
_NODISCARD constexpr bool operator!=(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left != *_Right))) /* strengthened */
+ noexcept(_STD _Fake_copy_init(*_Left != *_Right))) /* strengthened */
#ifdef __cpp_lib_concepts
requires requires {
{ *_Left != *_Right } -> _Implicitly_convertible_to;
@@ -657,7 +657,7 @@ _NODISCARD constexpr bool operator!=(const optional<_Ty1>& _Left, const optional
_EXPORT_STD template
_NODISCARD constexpr bool operator<(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left < *_Right))) /* strengthened */
+ noexcept(_STD _Fake_copy_init(*_Left < *_Right))) /* strengthened */
#ifdef __cpp_lib_concepts
requires requires {
{ *_Left < *_Right } -> _Implicitly_convertible_to;
@@ -674,7 +674,7 @@ _NODISCARD constexpr bool operator<(const optional<_Ty1>& _Left, const optional<
_EXPORT_STD template
_NODISCARD constexpr bool operator>(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left > *_Right))) /* strengthened */
+ noexcept(_STD _Fake_copy_init(*_Left > *_Right))) /* strengthened */
#ifdef __cpp_lib_concepts
requires requires {
{ *_Left > *_Right } -> _Implicitly_convertible_to;
@@ -691,7 +691,7 @@ _NODISCARD constexpr bool operator>(const optional<_Ty1>& _Left, const optional<
_EXPORT_STD template
_NODISCARD constexpr bool operator<=(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left <= *_Right))) /* strengthened */
+ noexcept(_STD _Fake_copy_init(*_Left <= *_Right))) /* strengthened */
#ifdef __cpp_lib_concepts
requires requires {
{ *_Left <= *_Right } -> _Implicitly_convertible_to;
@@ -708,7 +708,7 @@ _NODISCARD constexpr bool operator<=(const optional<_Ty1>& _Left, const optional
_EXPORT_STD template
_NODISCARD constexpr bool operator>=(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left >= *_Right))) /* strengthened */
+ noexcept(_STD _Fake_copy_init(*_Left >= *_Right))) /* strengthened */
#ifdef __cpp_lib_concepts
requires requires {
{ *_Left >= *_Right } -> _Implicitly_convertible_to;
@@ -828,7 +828,7 @@ using _Enable_if_comparable_with_greater_equal =
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator==(const optional<_Ty1>& _Left, const _Ty2& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left == _Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(*_Left == _Right))) /* strengthened */ {
if (_Left) {
return *_Left == _Right;
}
@@ -837,7 +837,7 @@ _NODISCARD constexpr bool operator==(const optional<_Ty1>& _Left, const _Ty2& _R
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator==(const _Ty1& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(_Left == *_Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(_Left == *_Right))) /* strengthened */ {
if (_Right) {
return _Left == *_Right;
}
@@ -846,7 +846,7 @@ _NODISCARD constexpr bool operator==(const _Ty1& _Left, const optional<_Ty2>& _R
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator!=(const optional<_Ty1>& _Left, const _Ty2& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left != _Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(*_Left != _Right))) /* strengthened */ {
if (_Left) {
return *_Left != _Right;
}
@@ -854,7 +854,7 @@ _NODISCARD constexpr bool operator!=(const optional<_Ty1>& _Left, const _Ty2& _R
}
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator!=(const _Ty1& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(_Left != *_Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(_Left != *_Right))) /* strengthened */ {
if (_Right) {
return _Left != *_Right;
}
@@ -863,7 +863,7 @@ _NODISCARD constexpr bool operator!=(const _Ty1& _Left, const optional<_Ty2>& _R
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator<(const optional<_Ty1>& _Left, const _Ty2& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left < _Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(*_Left < _Right))) /* strengthened */ {
if (_Left) {
return *_Left < _Right;
}
@@ -871,7 +871,7 @@ _NODISCARD constexpr bool operator<(const optional<_Ty1>& _Left, const _Ty2& _Ri
}
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator<(const _Ty1& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(_Left < *_Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(_Left < *_Right))) /* strengthened */ {
if (_Right) {
return _Left < *_Right;
}
@@ -880,7 +880,7 @@ _NODISCARD constexpr bool operator<(const _Ty1& _Left, const optional<_Ty2>& _Ri
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator>(const optional<_Ty1>& _Left, const _Ty2& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left > _Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(*_Left > _Right))) /* strengthened */ {
if (_Left) {
return *_Left > _Right;
}
@@ -888,7 +888,7 @@ _NODISCARD constexpr bool operator>(const optional<_Ty1>& _Left, const _Ty2& _Ri
}
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator>(const _Ty1& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(_Left > *_Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(_Left > *_Right))) /* strengthened */ {
if (_Right) {
return _Left > *_Right;
}
@@ -897,7 +897,7 @@ _NODISCARD constexpr bool operator>(const _Ty1& _Left, const optional<_Ty2>& _Ri
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator<=(const optional<_Ty1>& _Left, const _Ty2& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left <= _Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(*_Left <= _Right))) /* strengthened */ {
if (_Left) {
return *_Left <= _Right;
}
@@ -905,7 +905,7 @@ _NODISCARD constexpr bool operator<=(const optional<_Ty1>& _Left, const _Ty2& _R
}
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator<=(const _Ty1& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(_Left <= *_Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(_Left <= *_Right))) /* strengthened */ {
if (_Right) {
return _Left <= *_Right;
}
@@ -914,7 +914,7 @@ _NODISCARD constexpr bool operator<=(const _Ty1& _Left, const optional<_Ty2>& _R
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator>=(const optional<_Ty1>& _Left, const _Ty2& _Right) noexcept(
- noexcept(_Fake_copy_init(*_Left >= _Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(*_Left >= _Right))) /* strengthened */ {
if (_Left) {
return *_Left >= _Right;
}
@@ -922,7 +922,7 @@ _NODISCARD constexpr bool operator>=(const optional<_Ty1>& _Left, const _Ty2& _R
}
_EXPORT_STD template = 0>
_NODISCARD constexpr bool operator>=(const _Ty1& _Left, const optional<_Ty2>& _Right) noexcept(
- noexcept(_Fake_copy_init(_Left >= *_Right))) /* strengthened */ {
+ noexcept(_STD _Fake_copy_init(_Left >= *_Right))) /* strengthened */ {
if (_Right) {
return _Left >= *_Right;
}
diff --git a/stl/inc/random b/stl/inc/random
index 372f965c9da..646bcecd35c 100644
--- a/stl/inc/random
+++ b/stl/inc/random
@@ -191,7 +191,7 @@ public:
const size_t _Mx = _Nx <= _Sx ? _Sx + 1 : _Nx;
size_t _Kx;
- _Iter_value_t<_RanIt> _Mask = _Iter_value_t<_RanIt>(1) << 31;
+ _Iter_value_t<_RanIt> _Mask(_Iter_value_t<_RanIt>(1) << 31);
_Mask <<= 1; // build 32-bit mask safely
_Mask -= 1;
@@ -534,7 +534,7 @@ private:
};
template
-class linear_congruential { // linear congruential random engine
+class _DEPRECATE_TR1_RANDOM linear_congruential { // linear congruential random engine
public:
_RNG_REQUIRE_UINTTYPE(linear_congruential, _Uint);
@@ -898,7 +898,7 @@ struct _Swc_traits { // traits for subtract_with_carry generator
};
template
-class subtract_with_carry
+class _DEPRECATE_TR1_RANDOM subtract_with_carry
: public _Swc_base<_Ty, _Sx, _Rx, _Swc_traits<_Ty, _Mx, _Rx>> { // subtract_with_carry generator
public:
using _Mybase = _Swc_base<_Ty, _Sx, _Rx, _Swc_traits<_Ty, _Mx, _Rx>>;
@@ -915,9 +915,10 @@ public:
subtract_with_carry(_Gen& _Gx) : _Mybase(_Gx) {}
};
+_STL_DISABLE_DEPRECATED_WARNING
_EXPORT_STD template
class subtract_with_carry_engine
- : public subtract_with_carry<_Ty, static_cast<_Ty>((_Ty{1} << (_Wx - 1)) << 1), _Sx, _Rx> {
+ : private subtract_with_carry<_Ty, static_cast<_Ty>((_Ty{1} << (_Wx - 1)) << 1), _Sx, _Rx> {
// subtract_with_carry generator
public:
_RNG_REQUIRE_UINTTYPE(subtract_with_carry_engine, _Ty);
@@ -981,6 +982,26 @@ public:
return _Mx - 1;
}
+ _NODISCARD_FRIEND bool operator==(
+ const subtract_with_carry_engine& _Left, const subtract_with_carry_engine& _Right) noexcept /* strengthened */ {
+ return static_cast(_Left) == static_cast(_Right);
+ }
+
+#if !_HAS_CXX20
+ _NODISCARD_FRIEND bool operator!=(
+ const subtract_with_carry_engine& _Left, const subtract_with_carry_engine& _Right) noexcept /* strengthened */ {
+ return static_cast(_Left) != static_cast(_Right);
+ }
+#endif // !_HAS_CXX20
+
+ _NODISCARD result_type operator()() {
+ return _Mybase::operator()();
+ }
+
+ void discard(unsigned long long _Nskip) {
+ _Mybase::discard(_Nskip);
+ }
+
template
friend basic_ostream<_Elem, _Traits>& operator<<(
basic_ostream<_Elem, _Traits>& _Ostr, const subtract_with_carry_engine& _Eng) {
@@ -1019,6 +1040,7 @@ public:
return _Istr;
}
};
+_STL_RESTORE_DEPRECATED_WARNING
#if _HAS_TR1_NAMESPACE
constexpr double _Cx_exp2(const int _Exp) noexcept {
@@ -1108,7 +1130,7 @@ public:
#endif // _HAS_TR1_NAMESPACE
template
-class mersenne_twister : public _Circ_buf<_Ty, _Nx> { // mersenne twister generator
+class _DEPRECATE_TR1_RANDOM mersenne_twister : public _Circ_buf<_Ty, _Nx> { // mersenne twister generator
public:
using result_type = _Ty;
@@ -1278,9 +1300,10 @@ protected:
static constexpr int _M_mod_n = _Mx % _Nx;
};
+_STL_DISABLE_DEPRECATED_WARNING
_EXPORT_STD template
-class mersenne_twister_engine : public mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx, _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx> {
+class mersenne_twister_engine : private mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx, _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx> {
public:
static constexpr unsigned long long _Max = (((1ULL << (_Wx - 1)) - 1) << 1) + 1;
@@ -1360,10 +1383,43 @@ public:
_NODISCARD static constexpr result_type(max)() noexcept /* strengthened */ {
return _Mybase::_WMSK;
}
+
+ _NODISCARD_FRIEND bool operator==(
+ const mersenne_twister_engine& _Left, const mersenne_twister_engine& _Right) noexcept /* strengthened */ {
+ return static_cast(_Left) == static_cast(_Right);
+ }
+
+#if !_HAS_CXX20
+ _NODISCARD_FRIEND bool operator!=(
+ const mersenne_twister_engine& _Left, const mersenne_twister_engine& _Right) noexcept /* strengthened */ {
+ return static_cast(_Left) != static_cast(_Right);
+ }
+#endif // !_HAS_CXX20
+
+ template
+ friend basic_istream<_Elem, _S_Traits>& operator>>(
+ basic_istream<_Elem, _S_Traits>& _Istr, mersenne_twister_engine& _Eng) {
+ return _Istr >> static_cast<_Mybase&>(_Eng);
+ }
+
+ template
+ friend basic_ostream<_Elem, _S_Traits>& operator<<(
+ basic_ostream<_Elem, _S_Traits>& _Ostr, const mersenne_twister_engine& _Eng) {
+ return _Ostr << static_cast(_Eng);
+ }
+
+ _NODISCARD result_type operator()() {
+ return _Mybase::operator()();
+ }
+
+ void discard(unsigned long long _Nskip) {
+ _Mybase::discard(_Nskip);
+ }
};
+_STL_RESTORE_DEPRECATED_WARNING
template
-class discard_block { // discard_block compound engine
+class _DEPRECATE_TR1_RANDOM discard_block { // discard_block compound engine
public:
#if _HAS_TR1_NAMESPACE
using base_type _DEPRECATE_TR1_NAMESPACE = _Engine; // TR1-only typedef
@@ -1539,9 +1595,10 @@ private:
size_t _Nx;
};
+_STL_DISABLE_DEPRECATED_WARNING
_EXPORT_STD template
class discard_block_engine // discard_block_engine compound engine
- : public conditional_t<_Px <= INT_MAX, discard_block<_Engine, static_cast(_Px), static_cast(_Rx)>,
+ : private conditional_t<_Px <= INT_MAX, discard_block<_Engine, static_cast(_Px), static_cast(_Rx)>,
_Discard_block_base<_Engine, _Px, _Rx>> {
public:
static_assert(0 < _Rx && _Rx <= _Px, "invalid template argument for discard_block_engine");
@@ -1564,6 +1621,31 @@ public:
template = 0>
explicit discard_block_engine(_Seed_seq& _Seq) : _Mybase(_Seq) {}
+ void seed() {
+ _Mybase::seed();
+ }
+
+ void seed(result_type _Xx0) {
+ _Mybase::seed(_Xx0);
+ }
+
+ template = 0>
+ void seed(_Seed_seq& _Seq) {
+ _Mybase::seed(_Seq);
+ }
+
+ _NODISCARD const _Engine& base() const noexcept {
+ return _Mybase::base();
+ }
+
+ _NODISCARD result_type operator()() {
+ return _Mybase::operator()();
+ }
+
+ void discard(unsigned long long _Nskip) {
+ _Mybase::discard(_Nskip);
+ }
+
_NODISCARD static constexpr result_type(min)() noexcept /* strengthened */ {
return (_Engine::min)();
}
@@ -1571,7 +1653,29 @@ public:
_NODISCARD static constexpr result_type(max)() noexcept /* strengthened */ {
return (_Engine::max)();
}
+
+ _NODISCARD_FRIEND bool operator==(const discard_block_engine& _Left, const discard_block_engine& _Right) {
+ return static_cast(_Left) == static_cast(_Right);
+ }
+
+#if !_HAS_CXX20
+ _NODISCARD_FRIEND bool operator!=(const discard_block_engine& _Left, const discard_block_engine& _Right) {
+ return static_cast(_Left) != static_cast(_Right);
+ }
+#endif // !_HAS_CXX20
+
+ template
+ friend basic_istream<_Elem, _Traits>& operator>>(basic_istream<_Elem, _Traits>& _Istr, discard_block_engine& _Eng) {
+ return _Istr >> static_cast<_Mybase&>(_Eng);
+ }
+
+ template
+ friend basic_ostream<_Elem, _Traits>& operator<<(
+ basic_ostream<_Elem, _Traits>& _Ostr, const discard_block_engine& _Eng) {
+ return _Ostr << static_cast(_Eng);
+ }
};
+_STL_RESTORE_DEPRECATED_WARNING
_EXPORT_STD template
class independent_bits_engine { // independent_bits_engine compound engine
@@ -1969,7 +2073,7 @@ private:
};
template
-class uniform_int { // uniform integer distribution
+class _DEPRECATE_TR1_RANDOM uniform_int { // uniform integer distribution
public:
using result_type = _Ty;
@@ -2112,8 +2216,9 @@ private:
param_type _Par;
};
+_STL_DISABLE_DEPRECATED_WARNING
_EXPORT_STD template
-class uniform_int_distribution : public uniform_int<_Ty> { // uniform integer distribution
+class uniform_int_distribution : private uniform_int<_Ty> { // uniform integer distribution
public:
_RNG_REQUIRE_INTTYPE(uniform_int_distribution, _Ty);
@@ -2143,6 +2248,54 @@ public:
explicit uniform_int_distribution(const param_type& _Par0) noexcept // strengthened
: _Mybase(_Par0) {}
+ _NODISCARD result_type a() const noexcept /* strengthened */ {
+ return _Mybase::a();
+ }
+
+ _NODISCARD result_type b() const noexcept /* strengthened */ {
+ return _Mybase::b();
+ }
+
+ _NODISCARD param_type param() const noexcept /* strengthened */ {
+ return _Mybase::param();
+ }
+
+ void param(const param_type& _Par0) noexcept /* strengthened */ {
+ _Mybase::param(_Par0);
+ }
+
+ _NODISCARD result_type(min)() const noexcept /* strengthened */ {
+ return (_Mybase::min)();
+ }
+
+ _NODISCARD result_type(max)() const noexcept /* strengthened */ {
+ return (_Mybase::max)();
+ }
+
+ void reset() noexcept /* strengthened */ {}
+
+ template
+ _NODISCARD result_type operator()(_Engine& _Eng) _DISTRIBUTION_CONST {
+ return _Mybase::operator()(_Eng);
+ }
+
+ template
+ _NODISCARD result_type operator()(_Engine& _Eng, const param_type& _Par0) _DISTRIBUTION_CONST {
+ return _Mybase::operator()(_Eng, _Par0);
+ }
+
+ template
+ friend basic_istream<_Elem, _Traits>& operator>>(
+ basic_istream<_Elem, _Traits>& _Istr, uniform_int_distribution& _Dist) {
+ return _Istr >> static_cast<_Mybase&>(_Dist);
+ }
+
+ template
+ friend basic_ostream<_Elem, _Traits>& operator<<(
+ basic_ostream<_Elem, _Traits>& _Ostr, const uniform_int_distribution& _Dist) {
+ return _Ostr << static_cast(_Dist);
+ }
+
_NODISCARD_FRIEND bool operator==(
const uniform_int_distribution& _Left, const uniform_int_distribution& _Right) noexcept /* strengthened */ {
return _Left.param() == _Right.param();
@@ -2155,6 +2308,7 @@ public:
}
#endif // !_HAS_CXX20
};
+_STL_RESTORE_DEPRECATED_WARNING
_EXPORT_STD class bernoulli_distribution { // class for bernoulli distribution
public:
@@ -2828,7 +2982,7 @@ private:
};
template
-class uniform_real { // uniform real distribution
+class _DEPRECATE_TR1_RANDOM uniform_real { // uniform real distribution
public:
using result_type = _Ty;
@@ -2954,8 +3108,9 @@ private:
param_type _Par;
};
+_STL_DISABLE_DEPRECATED_WARNING
_EXPORT_STD template
-class uniform_real_distribution : public uniform_real<_Ty> { // uniform real distribution
+class uniform_real_distribution : private uniform_real<_Ty> { // uniform real distribution
public:
_RNG_REQUIRE_REALTYPE(uniform_real_distribution, _Ty);
@@ -2984,6 +3139,54 @@ public:
explicit uniform_real_distribution(const param_type& _Par0) noexcept // strengthened
: _Mybase(_Par0) {}
+ _NODISCARD result_type a() const noexcept /* strengthened */ {
+ return _Mybase::a();
+ }
+
+ _NODISCARD result_type b() const noexcept /* strengthened */ {
+ return _Mybase::b();
+ }
+
+ _NODISCARD param_type param() const noexcept /* strengthened */ {
+ return _Mybase::param();
+ }
+
+ void param(const param_type& _Par0) noexcept /* strengthened */ {
+ _Mybase::param(_Par0);
+ }
+
+ _NODISCARD result_type(min)() const noexcept /* strengthened */ {
+ return (_Mybase::min)();
+ }
+
+ _NODISCARD result_type(max)() const noexcept /* strengthened */ {
+ return (_Mybase::max)();
+ }
+
+ void reset() noexcept /* strengthened */ {}
+
+ template
+ _NODISCARD result_type operator()(_Engine& _Eng) _DISTRIBUTION_CONST {
+ return _Mybase::operator()(_Eng);
+ }
+
+ template
+ _NODISCARD result_type operator()(_Engine& _Eng, const param_type& _Par0) _DISTRIBUTION_CONST {
+ return _Mybase::operator()(_Eng, _Par0);
+ }
+
+ template
+ friend basic_istream<_Elem, _Traits>& operator>>(
+ basic_istream<_Elem, _Traits>& _Istr, uniform_real_distribution& _Dist) {
+ return _Istr >> static_cast<_Mybase&>(_Dist);
+ }
+
+ template
+ friend basic_ostream<_Elem, _Traits>& operator<<(
+ basic_ostream<_Elem, _Traits>& _Ostr, const uniform_real_distribution& _Dist) {
+ return _Ostr << static_cast(_Dist);
+ }
+
_NODISCARD_FRIEND bool operator==(
const uniform_real_distribution& _Left, const uniform_real_distribution& _Right) noexcept /* strengthened */ {
return _Left.param() == _Right.param();
@@ -2996,6 +3199,7 @@ public:
}
#endif // !_HAS_CXX20
};
+_STL_RESTORE_DEPRECATED_WARNING
_EXPORT_STD template
class exponential_distribution { // exponential distribution
@@ -4485,7 +4689,7 @@ private:
_Ty _Vx2;
_Ty _Rx0;
_Ty _Rs;
- uniform_real<_Ty> _Dist(-1, 1);
+ uniform_real_distribution<_Ty> _Dist(-1, 1);
for (;;) { // get a point inside unit circle
_Vx1 = _Dist(_Eng);
_Vx2 = _Dist(_Eng);
@@ -5020,7 +5224,7 @@ public:
template
result_type _Eval(_Engine& _Eng, const param_type& _Par0) _DISTRIBUTION_CONST {
size_t _Px = _Mybase::operator()(_Eng, _Par0);
- uniform_real<_Ty> _Dist(_Par0._Bvec[_Px], _Par0._Bvec[_Px + 1]);
+ uniform_real_distribution<_Ty> _Dist(_Par0._Bvec[_Px], _Par0._Bvec[_Px + 1]);
return _Dist(_Eng);
}
@@ -5247,7 +5451,7 @@ public:
size_t _Px = _Mybase::operator()(_Eng, _Par0);
double _Px0 = _Par0._Pvec[_Px];
double _Px1 = _Par0._Pvec[_Px + 1];
- uniform_real<_Ty> _Dist;
+ uniform_real_distribution<_Ty> _Dist;
result_type _Xx0 = _Dist(_Eng);
if (_Px0 != _Px1) {
diff --git a/stl/inc/sstream b/stl/inc/sstream
index 59f0e6b6c05..2a0ae5136d9 100644
--- a/stl/inc/sstream
+++ b/stl/inc/sstream
@@ -66,24 +66,87 @@ public:
const basic_string<_Elem, _Traits, _Alloc2>& _Str, ios_base::openmode _Mode = ios_base::in | ios_base::out)
: basic_stringbuf(_Str, _Mode, _Alloc{}) {}
- basic_stringbuf(basic_stringbuf&& _Right, const _Alloc& _Al_) : _Mystate(0), _Al(_Al_) {
- _Assign_rv(_STD move(_Right));
+ basic_stringbuf(basic_stringbuf&& _Right, const _Alloc& _Al_) : _Seekhigh(nullptr), _Mystate(0), _Al(_Al_) {
+ if constexpr (!allocator_traits<_Alloc>::is_always_equal::value) {
+ if (_Al != _Right._Al) {
+ _Copy_into_self_and_tidy(_STD move(_Right));
+ return;
+ }
+ }
+
+ _Take_contents(_STD move(_Right));
}
#endif // _HAS_CXX20
- basic_stringbuf(basic_stringbuf&& _Right) : _Mystate(0) {
- _Assign_rv(_STD move(_Right));
+ basic_stringbuf(basic_stringbuf&& _Right)
+ : _Seekhigh(_STD exchange(_Right._Seekhigh, nullptr)), _Mystate(_STD exchange(_Right._Mystate, 0)),
+ _Al(_Right._Al) {
+ _Mysb::swap(_Right);
}
- basic_stringbuf& operator=(basic_stringbuf&& _Right) noexcept /* strengthened */ {
- _Assign_rv(_STD move(_Right));
+ basic_stringbuf& operator=(basic_stringbuf&& _Right) noexcept(
+ _Choose_pocma_v<_Alloc> != _Pocma_values::_No_propagate_allocators) /* strengthened */ {
+ if (this != _STD addressof(_Right)) {
+ _Assign_rv_no_alias(_STD move(_Right));
+ }
return *this;
}
- void _Assign_rv(basic_stringbuf&& _Right) noexcept {
- if (this != _STD addressof(_Right)) {
- _Tidy();
- this->swap(_Right);
+ void _Take_contents(basic_stringbuf&& _Right) noexcept {
+ // pre: *this holds no dynamic buffer and _Al == _Right._Al
+ _Seekhigh = _STD exchange(_Right._Seekhigh, nullptr);
+ _Mystate = _STD exchange(_Right._Mystate, 0);
+ _Mysb::swap(_Right);
+ }
+
+ void _Copy_into_self_and_tidy(basic_stringbuf&& _Right) {
+ // pre: *this holds no dynamic buffer and _Al != _Right._Al
+ if ((_Right._Mystate & _Allocated) == 0) {
+ return;
+ }
+
+ const auto _Right_data = _Right._Mysb::eback();
+ const auto _Right_capacity = static_cast::size_type>(
+ (_Right._Mysb::pptr() ? _Right._Mysb::epptr() : _Right._Mysb::egptr()) - _Right_data);
+
+ auto _New_capacity = _Right_capacity;
+ const auto _New_data = _STD _Unfancy(_STD _Allocate_at_least_helper(_Al, _New_capacity));
+
+ _Mysb::setg(_New_data, _New_data + (_Right._Mysb::gptr() - _Right_data),
+ _New_data + (_Right._Mysb::egptr() - _Right_data));
+ if (_Right._Mysb::pbase() != nullptr) {
+ const auto _Pbase_diff = _Right._Mysb::pbase() - _Right_data;
+ const auto _Pptr_diff = _Right._Mysb::pptr() - _Right_data;
+ const auto _Epptr_diff = _Right._Mysb::epptr() - _Right_data;
+ _Mysb::setp(_New_data + _Pbase_diff, _New_data + _Pptr_diff, _New_data + _Epptr_diff);
+ } else {
+ _Mysb::setp(nullptr, nullptr, nullptr);
+ }
+
+ const auto _Right_view = _Right._Get_buffer_view();
+ if (_Right_view._Ptr != nullptr) {
+ _Traits::copy(_New_data + (_Right_view._Ptr - _Right_data), _Right_view._Ptr, _Right_view._Size);
+ }
+
+ _Seekhigh = _New_data + _New_capacity;
+ _Mystate = _Right._Mystate;
+
+ _Right._Tidy();
+ }
+
+ void _Assign_rv_no_alias(basic_stringbuf&& _Right) noexcept(
+ _Choose_pocma_v<_Alloc> != _Pocma_values::_No_propagate_allocators) {
+ // pre: this != std::addressof(_Right)
+ _Tidy();
+ if constexpr (_Choose_pocma_v<_Alloc> == _Pocma_values::_No_propagate_allocators) {
+ if (_Al == _Right._Al) {
+ _Take_contents(_STD move(_Right));
+ } else {
+ _Copy_into_self_and_tidy(_STD move(_Right));
+ }
+ } else {
+ _Pocma(_Al, _Right._Al);
+ _Take_contents(_STD move(_Right));
}
}
@@ -584,20 +647,17 @@ public:
: _Mybase(_STD addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode | ios_base::in) {}
#endif // _HAS_CXX20
- basic_istringstream(basic_istringstream&& _Right) : _Mybase(_STD addressof(_Stringbuffer)) {
- _Assign_rv(_STD move(_Right));
- }
+ basic_istringstream(basic_istringstream&& _Right)
+ : _Mybase(_STD addressof(_Stringbuffer)),
+ _Stringbuffer((_Mybase::swap(_Right), _STD move(_Right._Stringbuffer))) {}
- basic_istringstream& operator=(basic_istringstream&& _Right) noexcept /* strengthened */ {
- _Assign_rv(_STD move(_Right));
- return *this;
- }
-
- void _Assign_rv(basic_istringstream&& _Right) noexcept {
+ basic_istringstream& operator=(basic_istringstream&& _Right) noexcept(
+ _Choose_pocma_v<_Alloc> != _Pocma_values::_No_propagate_allocators) /* strengthened */ {
if (this != _STD addressof(_Right)) {
_Mybase::swap(_Right);
- _Stringbuffer._Assign_rv(_STD move(_Right._Stringbuffer));
+ _Stringbuffer._Assign_rv_no_alias(_STD move(_Right._Stringbuffer));
}
+ return *this;
}
void swap(basic_istringstream& _Right) noexcept /* strengthened */ {
@@ -704,20 +764,17 @@ public:
: _Mybase(_STD addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode | ios_base::out) {}
#endif // _HAS_CXX20
- basic_ostringstream(basic_ostringstream&& _Right) : _Mybase(_STD addressof(_Stringbuffer)) {
- _Assign_rv(_STD move(_Right));
- }
+ basic_ostringstream(basic_ostringstream&& _Right)
+ : _Mybase(_STD addressof(_Stringbuffer)),
+ _Stringbuffer((_Mybase::swap(_Right), _STD move(_Right._Stringbuffer))) {}
- basic_ostringstream& operator=(basic_ostringstream&& _Right) noexcept /* strengthened */ {
- _Assign_rv(_STD move(_Right));
- return *this;
- }
-
- void _Assign_rv(basic_ostringstream&& _Right) noexcept {
+ basic_ostringstream& operator=(basic_ostringstream&& _Right) noexcept(
+ _Choose_pocma_v<_Alloc> != _Pocma_values::_No_propagate_allocators) /* strengthened */ {
if (this != _STD addressof(_Right)) {
_Mybase::swap(_Right);
- _Stringbuffer._Assign_rv(_STD move(_Right._Stringbuffer));
+ _Stringbuffer._Assign_rv_no_alias(_STD move(_Right._Stringbuffer));
}
+ return *this;
}
void swap(basic_ostringstream& _Right) noexcept /* strengthened */ {
@@ -830,20 +887,17 @@ public:
: _Mybase(_STD addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode) {}
#endif // _HAS_CXX20
- basic_stringstream(basic_stringstream&& _Right) : _Mybase(_STD addressof(_Stringbuffer)) {
- _Assign_rv(_STD move(_Right));
- }
+ basic_stringstream(basic_stringstream&& _Right)
+ : _Mybase(_STD addressof(_Stringbuffer)),
+ _Stringbuffer((_Mybase::swap(_Right), _STD move(_Right._Stringbuffer))) {}
- basic_stringstream& operator=(basic_stringstream&& _Right) noexcept /* strengthened */ {
- _Assign_rv(_STD move(_Right));
- return *this;
- }
-
- void _Assign_rv(basic_stringstream&& _Right) noexcept {
+ basic_stringstream& operator=(basic_stringstream&& _Right) noexcept(
+ _Choose_pocma_v<_Alloc> != _Pocma_values::_No_propagate_allocators) /* strengthened */ {
if (this != _STD addressof(_Right)) {
_Mybase::swap(_Right);
- _Stringbuffer._Assign_rv(_STD move(_Right._Stringbuffer));
+ _Stringbuffer._Assign_rv_no_alias(_STD move(_Right._Stringbuffer));
}
+ return *this;
}
void swap(basic_stringstream& _Right) noexcept /* strengthened */ {
diff --git a/stl/inc/type_traits b/stl/inc/type_traits
index d1a88f9c28b..0d121913bf4 100644
--- a/stl/inc/type_traits
+++ b/stl/inc/type_traits
@@ -2441,7 +2441,7 @@ struct less {
using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool;
_NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const
- noexcept(noexcept(_Fake_copy_init(_Left < _Right))) /* strengthened */ {
+ noexcept(noexcept(_STD _Fake_copy_init(_Left < _Right))) /* strengthened */ {
return _Left < _Right;
}
};
diff --git a/stl/inc/xcharconv_ryu.h b/stl/inc/xcharconv_ryu.h
index d2f8db8dd62..4b944ff380c 100644
--- a/stl/inc/xcharconv_ryu.h
+++ b/stl/inc/xcharconv_ryu.h
@@ -211,6 +211,7 @@ _NODISCARD inline uint64_t __ryu_shiftright128(const uint64_t __lo, const uint64
#ifndef _WIN64
+#if !defined(_M_HYBRID_X86_ARM64)
// Returns the high 64 bits of the 128-bit product of __a and __b.
_NODISCARD inline uint64_t __umulh(const uint64_t __a, const uint64_t __b) {
// Reuse the __ryu_umul128 implementation.
@@ -220,6 +221,7 @@ _NODISCARD inline uint64_t __umulh(const uint64_t __a, const uint64_t __b) {
(void) __ryu_umul128(__a, __b, &__hi);
return __hi;
}
+#endif // ^^^ !defined(_M_HYBRID_X86_ARM64) ^^^
// On 32-bit platforms, compilers typically generate calls to library
// functions for 64-bit divisions, even if the divisor is a constant.
diff --git a/stl/inc/xiosbase b/stl/inc/xiosbase
index a1b5ff24ae3..af192b61692 100644
--- a/stl/inc/xiosbase
+++ b/stl/inc/xiosbase
@@ -42,8 +42,6 @@ public:
static constexpr int scientific = 0x1000;
static constexpr int fixed = 0x2000;
- static constexpr int hexfloat = 0x3000; // TRANSITION, ABI, GH-3296
-
static constexpr int boolalpha = 0x4000;
static constexpr int adjustfield = left | right | internal;
static constexpr int basefield = dec | oct | hex;
diff --git a/stl/inc/xlocnum b/stl/inc/xlocnum
index cb0ddec7575..619596ea9d1 100644
--- a/stl/inc/xlocnum
+++ b/stl/inc/xlocnum
@@ -1441,7 +1441,7 @@ private:
if (_Flags & ios_base::uppercase) {
if (_Ffl == ios_base::fixed) {
_Ch = 'f';
- } else if (_Ffl == ios_base::hexfloat) {
+ } else if (_Ffl == (ios_base::scientific | ios_base::fixed)) {
_Ch = 'A'; // added with TR1
} else if (_Ffl == ios_base::scientific) {
_Ch = 'E';
@@ -1451,7 +1451,7 @@ private:
} else {
if (_Ffl == ios_base::fixed) {
_Ch = 'f';
- } else if (_Ffl == ios_base::hexfloat) {
+ } else if (_Ffl == (ios_base::scientific | ios_base::fixed)) {
_Ch = 'a'; // added with TR1
} else if (_Ffl == ios_base::scientific) {
_Ch = 'e';
@@ -1475,7 +1475,7 @@ private:
bool _Is_finite_val) const { // put formatted floating-point to _Dest
auto _Prefix = static_cast(0 < _Count && (*_Buf == '+' || *_Buf == '-'));
const char* _Exps;
- if ((_Iosbase.flags() & ios_base::floatfield) != ios_base::hexfloat) {
+ if ((_Iosbase.flags() & ios_base::floatfield) != (ios_base::scientific | ios_base::fixed)) {
_Exps = "eE";
} else { // correct for hexadecimal floating-point
_Exps = "pP";
diff --git a/stl/inc/xmemory b/stl/inc/xmemory
index 7d709382ebd..2839843709c 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 7a65a8d66fd..b8a1b6995ef 100644
--- a/stl/inc/xutility
+++ b/stl/inc/xutility
@@ -391,7 +391,7 @@ struct equal_to {
using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool;
_NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const
- noexcept(noexcept(_Fake_copy_init(_Left == _Right))) /* strengthened */ {
+ noexcept(noexcept(_STD _Fake_copy_init(_Left == _Right))) /* strengthened */ {
return _Left == _Right;
}
};
@@ -403,7 +403,7 @@ struct not_equal_to {
using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool;
_NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const
- noexcept(noexcept(_Fake_copy_init(_Left != _Right))) /* strengthened */ {
+ noexcept(noexcept(_STD _Fake_copy_init(_Left != _Right))) /* strengthened */ {
return _Left != _Right;
}
};
@@ -415,7 +415,7 @@ struct greater {
using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool;
_NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const
- noexcept(noexcept(_Fake_copy_init(_Left > _Right))) /* strengthened */ {
+ noexcept(noexcept(_STD _Fake_copy_init(_Left > _Right))) /* strengthened */ {
return _Left > _Right;
}
};
@@ -427,7 +427,7 @@ struct greater_equal {
using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool;
_NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const
- noexcept(noexcept(_Fake_copy_init