@@ -1575,20 +1575,25 @@ namespace ranges {
15751575 template <input_iterator _It, sentinel_for<_It> _Se, _No_throw_forward_iterator _Out,
15761576 _No_throw_sentinel_for<_Out> _OSe>
15771577 requires constructible_from<iter_value_t<_Out>, iter_rvalue_reference_t<_It>>
1578- uninitialized_move_result<_It, _Out> _Uninitialized_move_unchecked(
1578+ _CONSTEXPR23_DYNALLOC uninitialized_move_result<_It, _Out> _Uninitialized_move_unchecked(
15791579 _It _IFirst, const _Se _ILast, _Out _OFirst, const _OSe _OLast) {
15801580 // clang-format on
15811581 if constexpr (is_same_v<_Se, _It> && is_same_v<_OSe, _Out> && _Ptr_move_cat<_It, _Out>::_Really_trivial) {
1582- return _Copy_memcpy_common(_IFirst, _ILast, _OFirst, _OLast);
1583- } else {
1584- _Uninitialized_backout _Backout{_STD move(_OFirst)};
1585-
1586- for (; _IFirst != _ILast && _Backout._Last != _OLast; ++_IFirst) {
1587- _Backout._Emplace_back(_RANGES iter_move(_IFirst));
1582+ #ifdef __cpp_lib_constexpr_dynamic_alloc
1583+ if (!_STD is_constant_evaluated())
1584+ #endif // __cpp_lib_constexpr_dynamic_alloc
1585+ {
1586+ return _Copy_memcpy_common(_IFirst, _ILast, _OFirst, _OLast);
15881587 }
1588+ }
1589+
1590+ _Uninitialized_backout _Backout{_STD move(_OFirst)};
15891591
1590- return {_STD move(_IFirst), _Backout._Release()};
1592+ for (; _IFirst != _ILast && _Backout._Last != _OLast; ++_IFirst) {
1593+ _Backout._Emplace_back(_RANGES iter_move(_IFirst));
15911594 }
1595+
1596+ return {_STD move(_IFirst), _Backout._Release()};
15921597 }
15931598} // namespace ranges
15941599#endif // __cpp_lib_concepts
@@ -1680,8 +1685,9 @@ _CONSTEXPR20_DYNALLOC _NoThrowFwdIt _Uninitialized_copy_unchecked(
16801685 return _Backout._Release();
16811686}
16821687
1688+
16831689template <class _InIt, class _NoThrowFwdIt>
1684- _NoThrowFwdIt uninitialized_copy(const _InIt _First, const _InIt _Last, _NoThrowFwdIt _Dest) {
1690+ _CONSTEXPR20_DYNALLOC _NoThrowFwdIt uninitialized_copy(const _InIt _First, const _InIt _Last, _NoThrowFwdIt _Dest) {
16851691 // copy [_First, _Last) to raw [_Dest, ...)
16861692 _Adl_verify_range(_First, _Last);
16871693 auto _UFirst = _Get_unwrapped(_First);
@@ -1755,28 +1761,39 @@ _CONSTEXPR20_DYNALLOC _Alloc_ptr_t<_Alloc> _Uninitialized_fill_n(
17551761
17561762// FUNCTION TEMPLATE uninitialized_fill
17571763template <class _NoThrowFwdIt, class _Tval>
1758- void uninitialized_fill(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last, const _Tval& _Val) {
1764+ _CONSTEXPR20_DYNALLOC void uninitialized_fill(
1765+ const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last, const _Tval& _Val) {
17591766 // copy _Val throughout raw [_First, _Last)
17601767 _Adl_verify_range(_First, _Last);
17611768 auto _UFirst = _Get_unwrapped(_First);
17621769 const auto _ULast = _Get_unwrapped(_Last);
17631770 if constexpr (_Fill_memset_is_safe<_Unwrapped_t<const _NoThrowFwdIt&>, _Tval>) {
1764- _Fill_memset(_UFirst, _Val, static_cast<size_t>(_ULast - _UFirst));
1765- } else {
1766- if constexpr (_Fill_zero_memset_is_safe<_Unwrapped_t<const _NoThrowFwdIt&>, _Tval>) {
1771+ #ifdef __cpp_lib_constexpr_dynamic_alloc
1772+ if (!_STD is_constant_evaluated())
1773+ #endif // __cpp_lib_constexpr_dynamic_alloc
1774+ {
1775+ _Fill_memset(_UFirst, _Val, static_cast<size_t>(_ULast - _UFirst));
1776+ return;
1777+ }
1778+ }
1779+ if constexpr (_Fill_zero_memset_is_safe<_Unwrapped_t<const _NoThrowFwdIt&>, _Tval>) {
1780+ #ifdef __cpp_lib_constexpr_dynamic_alloc
1781+ if (!_STD is_constant_evaluated())
1782+ #endif // __cpp_lib_constexpr_dynamic_alloc
1783+ {
17671784 if (_Is_all_bits_zero(_Val)) {
17681785 _Fill_zero_memset(_UFirst, static_cast<size_t>(_ULast - _UFirst));
17691786 return;
17701787 }
17711788 }
1789+ }
17721790
1773- _Uninitialized_backout<_Unwrapped_t<const _NoThrowFwdIt&>> _Backout{_UFirst};
1774- while (_Backout._Last != _ULast) {
1775- _Backout._Emplace_back(_Val);
1776- }
1777-
1778- _Backout._Release();
1791+ _Uninitialized_backout<_Unwrapped_t<const _NoThrowFwdIt&>> _Backout{_UFirst};
1792+ while (_Backout._Last != _ULast) {
1793+ _Backout._Emplace_back(_Val);
17791794 }
1795+
1796+ _Backout._Release();
17801797}
17811798
17821799// FUNCTION TEMPLATE _Uninitialized_value_construct_n WITH ALLOCATOR
@@ -1819,19 +1836,23 @@ _CONSTEXPR20_DYNALLOC _Alloc_ptr_t<_Alloc> _Uninitialized_value_construct_n(
18191836}
18201837
18211838template <class _NoThrowFwdIt, class _Diff>
1822- _NoThrowFwdIt _Uninitialized_value_construct_n_unchecked1(_NoThrowFwdIt _UFirst, _Diff _Count) {
1839+ _CONSTEXPR20_DYNALLOC _NoThrowFwdIt _Uninitialized_value_construct_n_unchecked1(_NoThrowFwdIt _UFirst, _Diff _Count) {
18231840 // value-initialize all elements in [_UFirst, _UFirst + _Count_raw)
18241841 _STL_INTERNAL_CHECK(_Count >= 0);
18251842 if constexpr (_Use_memset_value_construct_v<_NoThrowFwdIt>) {
1826- return _Zero_range(_UFirst, _UFirst + _Count);
1827- } else {
1828- _Uninitialized_backout<_NoThrowFwdIt> _Backout{_UFirst};
1829- for (; 0 < _Count; --_Count) {
1830- _Backout._Emplace_back( );
1843+ #ifdef __cpp_lib_constexpr_dynamic_alloc
1844+ if (!_STD is_constant_evaluated())
1845+ #endif // __cpp_lib_constexpr_dynamic_alloc
1846+ {
1847+ return _Zero_range(_UFirst, _UFirst + _Count );
18311848 }
1832-
1833- return _Backout._Release();
18341849 }
1850+ _Uninitialized_backout<_NoThrowFwdIt> _Backout{_UFirst};
1851+ for (; 0 < _Count; --_Count) {
1852+ _Backout._Emplace_back();
1853+ }
1854+
1855+ return _Backout._Release();
18351856}
18361857
18371858#if _HAS_DEPRECATED_TEMPORARY_BUFFER
0 commit comments