diff --git a/CMakeLists.txt b/CMakeLists.txt index 5de1c9e7ce2..97adae96212 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.16) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) project(msvc_standard_libraries LANGUAGES CXX) diff --git a/README.md b/README.md index b3e0b9be2a7..baaca174e16 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem The STL uses boost-math headers to provide P0226R1 Mathematical Special Functions. We recommend using [vcpkg][] to acquire this dependency. -1. Install Visual Studio 2019 16.6 Preview 1 or later. +1. Install Visual Studio 2019 16.6 Preview 2 or later. 2. Invoke `git clone https://github.com/microsoft/vcpkg` 3. Invoke `cd vcpkg` 4. Invoke `.\bootstrap-vcpkg.bat` @@ -159,7 +159,7 @@ acquire this dependency. These instructions assume you're targeting `x64-windows`; you can change this constant below to target other architectures. -1. Install [CMake][] 3.16.5 or later, [Ninja][] 1.10.0 or later, and Visual Studio 2019 16.6 Preview 1 or later. +1. Install [CMake][] 3.16.5 or later, [Ninja][] 1.10.0 or later, and Visual Studio 2019 16.6 Preview 2 or later. 2. Invoke `git clone https://github.com/microsoft/vcpkg` 3. Invoke `cd vcpkg` 4. Invoke `.\bootstrap-vcpkg.bat` diff --git a/azure-devops/create-new-agent-image.ps1 b/azure-devops/create-new-agent-image.ps1 index 3031771d3e2..ec54b329b72 100644 --- a/azure-devops/create-new-agent-image.ps1 +++ b/azure-devops/create-new-agent-image.ps1 @@ -8,7 +8,7 @@ $Location = 'westus2' $Prefix = 'StlBuild-' + (Get-Date -Format 'yyyy-MM-dd') -$VMSize = 'Standard_D16s_v3' +$VMSize = 'Standard_F16s_v2' $ProtoVMName = 'PROTOTYPE' $LiveVMPrefix = 'BUILD' $WindowsServerSku = '2019-Datacenter' @@ -249,7 +249,7 @@ $VmssIpConfig = New-AzVmssIpConfig -SubnetId $Nic.IpConfigurations[0].Subnet.Id $VmssName = $ResourceGroupName + 'Vmss' $Vmss = New-AzVmssConfig ` -Location $Location ` - -SkuCapacity 2 ` + -SkuCapacity 0 ` -SkuName $VMSize ` -SkuTier 'Standard' ` -Overprovision $false ` diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index 767298414a8..9526f6a944f 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -40,7 +40,7 @@ $ReleaseInPath = 'Preview' $Sku = 'Enterprise' $VisualStudioBootstrapperUrl = 'https://aka.ms/vs/16/pre/vs_buildtools.exe' $CMakeUrl = 'https://github.com/Kitware/CMake/releases/download/v3.16.5/cmake-3.16.5-win64-x64.msi' -$LlvmUrl = 'https://releases.llvm.org/9.0.0/LLVM-9.0.0-win64.exe' +$LlvmUrl = 'https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe' $NinjaUrl = 'https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip' $PythonUrl = 'https://www.python.org/ftp/python/3.8.2/python-3.8.2-amd64.exe' @@ -190,4 +190,13 @@ $environmentKey = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' ` -Name Path ` -Value "$($environmentKey.Path);C:\Program Files\CMake\bin;C:\Program Files\LLVM\bin" + +Add-MPPreference -ExclusionPath C:\agent +Add-MPPreference -ExclusionPath D:\ +Add-MPPreference -ExclusionProcess ninja.exe +Add-MPPreference -ExclusionProcess clang-cl.exe +Add-MPPreference -ExclusionProcess cl.exe +Add-MPPreference -ExclusionProcess link.exe +Add-MPPreference -ExclusionProcess python.exe + C:\Windows\system32\sysprep\sysprep.exe /oobe /generalize /shutdown diff --git a/azure-devops/run-build.yml b/azure-devops/run-build.yml index 127d917550a..813dc929bd8 100644 --- a/azure-devops/run-build.yml +++ b/azure-devops/run-build.yml @@ -5,7 +5,7 @@ jobs: - job: ${{ parameters.targetPlatform }} timeoutInMinutes: 360 pool: - name: StlBuild-2020-03-24 + name: StlBuild-2020-03-28 variables: vcpkgLocation: '$(Build.SourcesDirectory)/vcpkg' diff --git a/stl/inc/algorithm b/stl/inc/algorithm index 64aea9ef27c..fc67058e8c8 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -1249,8 +1249,8 @@ _FwdIt2 copy_if(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _Pr _Pred #if _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_DestTy* copy_if( - _ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize], _Pr _Pred) noexcept /* terminates */ { +_DestTy* copy_if(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize], _Pr _Pred) noexcept +/* terminates */ { // copy each satisfying _Pred, array dest // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); @@ -1397,8 +1397,8 @@ pair<_FwdIt2, _DestFalseTy*> partition_copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _La template = 0> pair<_DestTrueTy*, _DestFalseTy*> partition_copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, - _DestTrueTy (&_Dest_true)[_DestTrueSize], _DestFalseTy (&_Dest_false)[_DestFalseSize], - _Pr _Pred) noexcept /* terminates */ { + _DestTrueTy (&_Dest_true)[_DestTrueSize], _DestFalseTy (&_Dest_false)[_DestFalseSize], _Pr _Pred) noexcept +/* terminates */ { // copy true partition to _Dest_true, false to _Dest_false, array dest // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); @@ -2005,8 +2005,8 @@ _NODISCARD _FwdIt1 find_end( _ExPo&& _Exec, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, _Pr _Pred) noexcept; // terminates template = 0> -_NODISCARD _FwdIt1 find_end(_ExPo&& _Exec, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, - _FwdIt2 _Last2) noexcept /* terminates */ { // find last [_First2, _Last2) match +_NODISCARD _FwdIt1 find_end(_ExPo&& _Exec, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2) noexcept +/* terminates */ { // find last [_First2, _Last2) match return _STD find_end(_STD forward<_ExPo>(_Exec), _First1, _Last1, _First2, _Last2, equal_to<>()); } #endif // _HAS_CXX17 @@ -2123,8 +2123,8 @@ _FwdIt2 transform( #if _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_DestTy* transform( - _ExPo&& _Exec, _FwdIt1 _First, _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize], _Fn _Func) noexcept /* terminates */ { +_DestTy* transform(_ExPo&& _Exec, _FwdIt1 _First, _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize], _Fn _Func) noexcept +/* terminates */ { // transform [_First, _Last) with _Func, array dest return _STD transform( _STD forward<_ExPo>(_Exec), _First, _Last, _Array_iterator<_DestTy, _DestSize>(_Dest), _Pass_fn(_Func)) @@ -2338,8 +2338,8 @@ _CONSTEXPR20 _DestTy* replace_copy_if( #if _HAS_CXX17 template = 0> -_FwdIt2 replace_copy_if( - _ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _Pr _Pred, const _Ty& _Val) noexcept /* terminates */ { +_FwdIt2 replace_copy_if(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _Pr _Pred, const _Ty& _Val) noexcept +/* terminates */ { // copy replacing each satisfying _Pred with _Val // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); @@ -2474,8 +2474,8 @@ _FwdIt2 remove_copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, const #if _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_DestTy* remove_copy( - _ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize], const _Ty& _Val) noexcept /* terminates */ { +_DestTy* remove_copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize], const _Ty& _Val) noexcept +/* terminates */ { // copy omitting each matching _Val, array dest // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); @@ -2524,8 +2524,8 @@ _FwdIt2 remove_copy_if(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _P #if _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_DestTy* remove_copy_if( - _ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize], _Pr _Pred) noexcept /* terminates */ { +_DestTy* remove_copy_if(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize], _Pr _Pred) noexcept +/* terminates */ { // copy omitting each element satisfying _Pred, array dest // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); @@ -2772,8 +2772,8 @@ _FwdIt2 unique_copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _Pr _ #if _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_DestTy* unique_copy( - _ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize], _Pr _Pred) noexcept /* terminates */ { +_DestTy* unique_copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize], _Pr _Pred) noexcept +/* terminates */ { // copy compressing pairs that match, array dest // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); @@ -3866,8 +3866,8 @@ _DestTy* merge(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt #endif // _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_FwdIt3 merge(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, - _FwdIt3 _Dest) noexcept /* terminates */ { +_FwdIt3 merge(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, _FwdIt3 _Dest) noexcept +/* terminates */ { // copy merging ranges, both using operator< // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); @@ -4614,8 +4614,8 @@ _CONSTEXPR20 _RanIt partial_sort_copy(_InIt _First1, _InIt _Last1, _RanIt _First #if _HAS_CXX17 template = 0> -_RanIt partial_sort_copy( - _ExPo&&, _FwdIt _First1, _FwdIt _Last1, _RanIt _First2, _RanIt _Last2, _Pr _Pred) noexcept /* terminates */ { +_RanIt partial_sort_copy(_ExPo&&, _FwdIt _First1, _FwdIt _Last1, _RanIt _First2, _RanIt _Last2, _Pr _Pred) noexcept +/* terminates */ { // copy [_First1, _Last1) into [_First2, _Last2) using _Pred // parallelism suspected to be infeasible _REQUIRE_PARALLEL_ITERATOR(_FwdIt); @@ -4623,8 +4623,8 @@ _RanIt partial_sort_copy( } template = 0> -_RanIt partial_sort_copy( - _ExPo&&, _FwdIt _First1, _FwdIt _Last1, _RanIt _First2, _RanIt _Last2) noexcept /* terminates */ { +_RanIt partial_sort_copy(_ExPo&&, _FwdIt _First1, _FwdIt _Last1, _RanIt _First2, _RanIt _Last2) noexcept +/* terminates */ { // copy [_First1, _Last1) into [_First2, _Last2), using operator< // parallelism suspected to be infeasible _REQUIRE_PARALLEL_ITERATOR(_FwdIt); @@ -4715,8 +4715,8 @@ _NODISCARD _CONSTEXPR20 bool includes(_InIt1 _First1, _InIt1 _Last1, _InIt2 _Fir #if _HAS_CXX17 // FUNCTION TEMPLATE includes template = 0> -_NODISCARD bool includes( - _ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, _Pr _Pred) noexcept /* terminates */ { +_NODISCARD bool includes(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, _Pr _Pred) noexcept +/* terminates */ { // test if every element in sorted [_First2, _Last2) is in sorted [_First1, _Last1), using _Pred // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); @@ -4725,8 +4725,8 @@ _NODISCARD bool includes( } template = 0> -_NODISCARD bool includes( - _ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2) noexcept /* terminates */ { +_NODISCARD bool includes(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2) noexcept +/* terminates */ { // test if every element in sorted [_First2, _Last2) is in sorted [_First1, _Last1), using operator< // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); @@ -4818,8 +4818,8 @@ _DestTy* set_union(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _F #endif // _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_FwdIt3 set_union(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, - _FwdIt3 _Dest) noexcept /* terminates */ { +_FwdIt3 set_union(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, _FwdIt3 _Dest) noexcept +/* terminates */ { // OR sets [_First1, _Last1) and [_First2, _Last2), using operator< // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); @@ -5281,8 +5281,8 @@ _NODISCARD constexpr pair<_FwdIt, _FwdIt> minmax_element(_FwdIt _First, _FwdIt _ #if _HAS_CXX17 template = 0> -_NODISCARD pair<_FwdIt, _FwdIt> minmax_element( - _ExPo&&, _FwdIt _First, _FwdIt _Last, _Pr _Pred) noexcept /* terminates */ { +_NODISCARD pair<_FwdIt, _FwdIt> minmax_element(_ExPo&&, _FwdIt _First, _FwdIt _Last, _Pr _Pred) noexcept +/* terminates */ { // find smallest and largest elements, using _Pred // not parallelized at present, parallelism expected to be feasible in a future release return _STD minmax_element(_First, _Last, _Pass_fn(_Pred)); diff --git a/stl/inc/array b/stl/inc/array index f6ab07d9cdb..b5231133ebf 100644 --- a/stl/inc/array +++ b/stl/inc/array @@ -150,8 +150,8 @@ public: return _Elems[_Pos]; } - _NODISCARD constexpr const_reference operator[](_In_range_(0, _Size - 1) size_type _Pos) const - noexcept /* strengthened */ { + _NODISCARD constexpr const_reference operator[](_In_range_(0, _Size - 1) size_type _Pos) const noexcept + /* strengthened */ { #if _CONTAINER_DEBUG_LEVEL > 0 _STL_VERIFY(_Pos < _Size, "array subscript out of range"); #endif // _CONTAINER_DEBUG_LEVEL > 0 @@ -200,7 +200,7 @@ struct _Enforce_same { }; template -array(_First, _Rest...)->array::type, 1 + sizeof...(_Rest)>; +array(_First, _Rest...) -> array::type, 1 + sizeof...(_Rest)>; #endif // _HAS_CXX17 template diff --git a/stl/inc/atomic b/stl/inc/atomic index 4d041c5d091..1ce5172cabd 100644 --- a/stl/inc/atomic +++ b/stl/inc/atomic @@ -1637,7 +1637,7 @@ public: #if _HAS_CXX17 template -atomic(_Ty)->atomic<_Ty>; +atomic(_Ty) -> atomic<_Ty>; #endif // _HAS_CXX17 // NONMEMBER OPERATIONS ON ATOMIC TYPES diff --git a/stl/inc/bitset b/stl/inc/bitset index d7868783fbc..9a79cca3339 100644 --- a/stl/inc/bitset +++ b/stl/inc/bitset @@ -286,23 +286,18 @@ public: constexpr bool _Bits_zero = _Bits == 0; constexpr bool _Bits_small = _Bits <= 32; constexpr bool _Bits_large = _Bits > 64; - if - _CONSTEXPR_IF(_Bits_zero) { - return 0; - } - else if - _CONSTEXPR_IF(_Bits_small) { - return static_cast(_Array[0]); - } - else { - if - _CONSTEXPR_IF(_Bits_large) { - for (size_t _Idx = 1; _Idx <= _Words; ++_Idx) { - if (_Array[_Idx] != 0) { - _Xoflo(); // fail if any high-order words are nonzero - } + if _CONSTEXPR_IF (_Bits_zero) { + return 0; + } else if _CONSTEXPR_IF (_Bits_small) { + return static_cast(_Array[0]); + } else { + if _CONSTEXPR_IF (_Bits_large) { + for (size_t _Idx = 1; _Idx <= _Words; ++_Idx) { + if (_Array[_Idx] != 0) { + _Xoflo(); // fail if any high-order words are nonzero } } + } if (_Array[0] > ULONG_MAX) { _Xoflo(); @@ -315,19 +310,16 @@ public: _NODISCARD unsigned long long to_ullong() const { constexpr bool _Bits_zero = _Bits == 0; constexpr bool _Bits_large = _Bits > 64; - if - _CONSTEXPR_IF(_Bits_zero) { - return 0; - } - else { - if - _CONSTEXPR_IF(_Bits_large) { - for (size_t _Idx = 1; _Idx <= _Words; ++_Idx) { - if (_Array[_Idx] != 0) { - _Xoflo(); // fail if any high-order words are nonzero - } + if _CONSTEXPR_IF (_Bits_zero) { + return 0; + } else { + if _CONSTEXPR_IF (_Bits_large) { + for (size_t _Idx = 1; _Idx <= _Words; ++_Idx) { + if (_Array[_Idx] != 0) { + _Xoflo(); // fail if any high-order words are nonzero } } + } return _Array[0]; } @@ -431,10 +423,9 @@ private: void _Trim() noexcept { // clear any trailing bits in last word constexpr bool _Work_to_do = _Bits == 0 || _Bits % _Bitsperword != 0; - if - _CONSTEXPR_IF(_Work_to_do) { - _Array[_Words] &= (_Ty{1} << _Bits % _Bitsperword) - 1; - } + if _CONSTEXPR_IF (_Work_to_do) { + _Array[_Words] &= (_Ty{1} << _Bits % _Bitsperword) - 1; + } } bitset& _Set_unchecked(size_t _Pos, bool _Val) noexcept { // set bit at _Pos to _Val, no checking @@ -534,12 +525,11 @@ basic_istream<_Elem, _Tr>& operator>>(basic_istream<_Elem, _Tr>& _Istr, bitset<_ constexpr bool _Has_bits = _Bits > 0; - if - _CONSTEXPR_IF(_Has_bits) { - if (!_Changed) { - _State |= _Istr_t::failbit; - } + if _CONSTEXPR_IF (_Has_bits) { + if (!_Changed) { + _State |= _Istr_t::failbit; } + } _Istr.setstate(_State); _Right = bitset<_Bits>(_Str); // convert string and store diff --git a/stl/inc/charconv b/stl/inc/charconv index 1f2b0077a9d..66fd8c9f837 100644 --- a/stl/inc/charconv +++ b/stl/inc/charconv @@ -145,8 +145,8 @@ _NODISCARD to_chars_result _Integer_to_chars( return {_First + _Digits_written, errc{}}; } -inline to_chars_result to_chars( - char* const _First, char* const _Last, const char _Value, const int _Base = 10) noexcept /* strengthened */ { +inline to_chars_result to_chars(char* const _First, char* const _Last, const char _Value, const int _Base = 10) noexcept +/* strengthened */ { return _Integer_to_chars(_First, _Last, _Value, _Base); } inline to_chars_result to_chars( @@ -165,16 +165,16 @@ inline to_chars_result to_chars(char* const _First, char* const _Last, const uns const int _Base = 10) noexcept /* strengthened */ { return _Integer_to_chars(_First, _Last, _Value, _Base); } -inline to_chars_result to_chars( - char* const _First, char* const _Last, const int _Value, const int _Base = 10) noexcept /* strengthened */ { +inline to_chars_result to_chars(char* const _First, char* const _Last, const int _Value, const int _Base = 10) noexcept +/* strengthened */ { return _Integer_to_chars(_First, _Last, _Value, _Base); } inline to_chars_result to_chars(char* const _First, char* const _Last, const unsigned int _Value, const int _Base = 10) noexcept /* strengthened */ { return _Integer_to_chars(_First, _Last, _Value, _Base); } -inline to_chars_result to_chars( - char* const _First, char* const _Last, const long _Value, const int _Base = 10) noexcept /* strengthened */ { +inline to_chars_result to_chars(char* const _First, char* const _Last, const long _Value, const int _Base = 10) noexcept +/* strengthened */ { return _Integer_to_chars(_First, _Last, _Value, _Base); } inline to_chars_result to_chars(char* const _First, char* const _Last, const unsigned long _Value, @@ -3059,12 +3059,12 @@ _NODISCARD to_chars_result _Floating_to_chars( inline to_chars_result to_chars(char* const _First, char* const _Last, const float _Value) noexcept /* strengthened */ { return _Floating_to_chars<_Floating_to_chars_overload::_Plain>(_First, _Last, _Value, chars_format{}, 0); } -inline to_chars_result to_chars( - char* const _First, char* const _Last, const double _Value) noexcept /* strengthened */ { +inline to_chars_result to_chars(char* const _First, char* const _Last, const double _Value) noexcept +/* strengthened */ { return _Floating_to_chars<_Floating_to_chars_overload::_Plain>(_First, _Last, _Value, chars_format{}, 0); } -inline to_chars_result to_chars( - char* const _First, char* const _Last, const long double _Value) noexcept /* strengthened */ { +inline to_chars_result to_chars(char* const _First, char* const _Last, const long double _Value) noexcept +/* strengthened */ { return _Floating_to_chars<_Floating_to_chars_overload::_Plain>( _First, _Last, static_cast(_Value), chars_format{}, 0); } diff --git a/stl/inc/chrono b/stl/inc/chrono index 5941ccf9c63..4704c6c9241 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -653,8 +653,8 @@ inline namespace literals { return chrono::hours(_Val); } - _NODISCARD constexpr chrono::duration> operator"" h( - long double _Val) noexcept /* strengthened */ { + _NODISCARD constexpr chrono::duration> operator"" h(long double _Val) noexcept + /* strengthened */ { return chrono::duration>(_Val); } @@ -662,8 +662,8 @@ inline namespace literals { return chrono::minutes(_Val); } - _NODISCARD constexpr chrono::duration>(operator"" min)( - long double _Val) noexcept /* strengthened */ { + _NODISCARD constexpr chrono::duration>(operator"" min)(long double _Val) noexcept + /* strengthened */ { return chrono::duration>(_Val); } @@ -679,8 +679,8 @@ inline namespace literals { return chrono::milliseconds(_Val); } - _NODISCARD constexpr chrono::duration operator"" ms( - long double _Val) noexcept /* strengthened */ { + _NODISCARD constexpr chrono::duration operator"" ms(long double _Val) noexcept + /* strengthened */ { return chrono::duration(_Val); } @@ -688,8 +688,8 @@ inline namespace literals { return chrono::microseconds(_Val); } - _NODISCARD constexpr chrono::duration operator"" us( - long double _Val) noexcept /* strengthened */ { + _NODISCARD constexpr chrono::duration operator"" us(long double _Val) noexcept + /* strengthened */ { return chrono::duration(_Val); } @@ -697,8 +697,8 @@ inline namespace literals { return chrono::nanoseconds(_Val); } - _NODISCARD constexpr chrono::duration operator"" ns( - long double _Val) noexcept /* strengthened */ { + _NODISCARD constexpr chrono::duration operator"" ns(long double _Val) noexcept + /* strengthened */ { return chrono::duration(_Val); } } // namespace chrono_literals diff --git a/stl/inc/cmath b/stl/inc/cmath index b147fbd2904..86f61c581ca 100644 --- a/stl/inc/cmath +++ b/stl/inc/cmath @@ -283,8 +283,8 @@ _NODISCARD _Check_return_ inline long double atanh(_In_ long double _Xx) noexcep return _CSTD atanhl(_Xx); } -_NODISCARD _Check_return_ inline long double atan2( - _In_ long double _Yx, _In_ long double _Xx) noexcept /* strengthened */ { +_NODISCARD _Check_return_ inline long double atan2(_In_ long double _Yx, _In_ long double _Xx) noexcept +/* strengthened */ { return _CSTD atan2l(_Yx, _Xx); } @@ -296,8 +296,8 @@ _NODISCARD _Check_return_ inline long double ceil(_In_ long double _Xx) noexcept return _CSTD ceill(_Xx); } -_NODISCARD _Check_return_ inline long double copysign( - _In_ long double _Number, _In_ long double _Sign) noexcept /* strengthened */ { +_NODISCARD _Check_return_ inline long double copysign(_In_ long double _Number, _In_ long double _Sign) noexcept +/* strengthened */ { return _CSTD copysignl(_Number, _Sign); } @@ -333,8 +333,8 @@ _NODISCARD _Check_return_ inline long double fabs(_In_ long double _Xx) noexcept return _CSTD fabsl(_Xx); } -_NODISCARD _Check_return_ inline long double fdim( - _In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ { +_NODISCARD _Check_return_ inline long double fdim(_In_ long double _Xx, _In_ long double _Yx) noexcept +/* strengthened */ { return _CSTD fdiml(_Xx, _Yx); } @@ -347,18 +347,18 @@ _NODISCARD _Check_return_ inline long double fma( return _CSTD fmal(_Xx, _Yx, _Zx); } -_NODISCARD _Check_return_ inline long double fmax( - _In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ { +_NODISCARD _Check_return_ inline long double fmax(_In_ long double _Xx, _In_ long double _Yx) noexcept +/* strengthened */ { return _CSTD fmaxl(_Xx, _Yx); } -_NODISCARD _Check_return_ inline long double fmin( - _In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ { +_NODISCARD _Check_return_ inline long double fmin(_In_ long double _Xx, _In_ long double _Yx) noexcept +/* strengthened */ { return _CSTD fminl(_Xx, _Yx); } -_NODISCARD _Check_return_ inline long double fmod( - _In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ { +_NODISCARD _Check_return_ inline long double fmod(_In_ long double _Xx, _In_ long double _Yx) noexcept +/* strengthened */ { return _CSTD fmodl(_Xx, _Yx); } @@ -366,8 +366,8 @@ inline long double frexp(_In_ long double _Xx, _Out_ int* _Yx) noexcept /* stren return _CSTD frexpl(_Xx, _Yx); } -_NODISCARD _Check_return_ inline long double hypot( - _In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ { +_NODISCARD _Check_return_ inline long double hypot(_In_ long double _Xx, _In_ long double _Yx) noexcept +/* strengthened */ { return _CSTD hypotl(_Xx, _Yx); } @@ -427,18 +427,18 @@ _NODISCARD _Check_return_ inline long double nearbyint(_In_ long double _Xx) noe return _CSTD nearbyintl(_Xx); } -_NODISCARD _Check_return_ inline long double nextafter( - _In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ { +_NODISCARD _Check_return_ inline long double nextafter(_In_ long double _Xx, _In_ long double _Yx) noexcept +/* strengthened */ { return _CSTD nextafterl(_Xx, _Yx); } -_NODISCARD _Check_return_ inline long double nexttoward( - _In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ { +_NODISCARD _Check_return_ inline long double nexttoward(_In_ long double _Xx, _In_ long double _Yx) noexcept +/* strengthened */ { return _CSTD nexttowardl(_Xx, _Yx); } -_NODISCARD _Check_return_ inline long double pow( - _In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ { +_NODISCARD _Check_return_ inline long double pow(_In_ long double _Xx, _In_ long double _Yx) noexcept +/* strengthened */ { return _CSTD powl(_Xx, _Yx); } @@ -450,8 +450,8 @@ _NODISCARD _Check_return_ inline long double pow(_In_ long double _Xx, _In_ int return _CSTD powl(_Xx, static_cast(_Yx)); } -_NODISCARD _Check_return_ inline long double remainder( - _In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ { +_NODISCARD _Check_return_ inline long double remainder(_In_ long double _Xx, _In_ long double _Yx) noexcept +/* strengthened */ { return _CSTD remainderl(_Xx, _Yx); } @@ -1384,13 +1384,13 @@ _NODISCARD /* constexpr */ _Ty _Common_lerp(const _Ty _ArgA, const _Ty _ArgB, co // As of 2019-06-17 it is unclear whether the "sufficient additional overloads" clause is intended to target lerp; // LWG-3223 is pending. -_NODISCARD /* constexpr */ inline float lerp( - const float _ArgA, const float _ArgB, const float _ArgT) noexcept /* strengthened */ { +_NODISCARD /* constexpr */ inline float lerp(const float _ArgA, const float _ArgB, const float _ArgT) noexcept +/* strengthened */ { return _Common_lerp(_ArgA, _ArgB, _ArgT); } -_NODISCARD /* constexpr */ inline double lerp( - const double _ArgA, const double _ArgB, const double _ArgT) noexcept /* strengthened */ { +_NODISCARD /* constexpr */ inline double lerp(const double _ArgA, const double _ArgB, const double _ArgT) noexcept +/* strengthened */ { return _Common_lerp(_ArgA, _ArgB, _ArgT); } diff --git a/stl/inc/codecvt b/stl/inc/codecvt index 01b07efb80c..421aec7e4c1 100644 --- a/stl/inc/codecvt +++ b/stl/inc/codecvt @@ -96,19 +96,18 @@ protected: *_Pstate = 1; constexpr bool _Consuming = (_Mymode & consume_header) != 0; - if - _CONSTEXPR_IF(_Consuming) { - if (_Ch == 0xfeff) { // drop header and retry - const result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); + if _CONSTEXPR_IF (_Consuming) { + if (_Ch == 0xfeff) { // drop header and retry + const result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); - if (_Ans == _Mybase::partial) { // roll back header determination - *_Pstate = 0; - _Mid1 = _First1; - } - - return _Ans; + if (_Ans == _Mybase::partial) { // roll back header determination + *_Pstate = 0; + _Mid1 = _First1; } + + return _Ans; } + } } if (_Mymax < _Ch) { @@ -160,17 +159,16 @@ protected: if (*_Pstate == 0) { // first time, maybe generate header *_Pstate = 1; constexpr bool _Generating = (_Mymode & generate_header) != 0; - if - _CONSTEXPR_IF(_Generating) { - if (_Last2 - _Mid2 < 3 + 1 + _Nextra) { - return _Mybase::partial; // not enough room for both - } - - // prepend header - *_Mid2++ = '\xef'; - *_Mid2++ = '\xbb'; - *_Mid2++ = '\xbf'; + if _CONSTEXPR_IF (_Generating) { + if (_Last2 - _Mid2 < 3 + 1 + _Nextra) { + return _Mybase::partial; // not enough room for both } + + // prepend header + *_Mid2++ = '\xef'; + *_Mid2++ = '\xbb'; + *_Mid2++ = '\xbf'; + } } if (_Last2 - _Mid2 < 1 + _Nextra) { @@ -256,34 +254,31 @@ protected: constexpr bool _Prefer_LE = (_Mymode & little_endian) != 0; constexpr char _Default_endian = _Prefer_LE ? _Little_first : _Big_first; - if - _CONSTEXPR_IF(_Prefer_LE) { - _Ch0 = static_cast(_Ptr[1] << 8 | _Ptr[0]); - } - else { + if _CONSTEXPR_IF (_Prefer_LE) { + _Ch0 = static_cast(_Ptr[1] << 8 | _Ptr[0]); + } else { _Ch0 = static_cast(_Ptr[0] << 8 | _Ptr[1]); } *_Pstate = _Default_endian; constexpr bool _Consuming = (_Mymode & consume_header) != 0; - if - _CONSTEXPR_IF(_Consuming) { - if (_Ch0 == 0xfffeu) { - *_Pstate = 3 - _Default_endian; - } - - if (_Ch0 == 0xfffeu || _Ch0 == 0xfeffu) { // consume header, fixate on endianness, and retry - _Mid1 += _Bytes_per_word; - result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); + if _CONSTEXPR_IF (_Consuming) { + if (_Ch0 == 0xfffeu) { + *_Pstate = 3 - _Default_endian; + } - if (_Ans == _Mybase::partial) { // not enough bytes, roll back header - *_Pstate = 0; - _Mid1 = _First1; - } + if (_Ch0 == 0xfffeu || _Ch0 == 0xfeffu) { // consume header, fixate on endianness, and retry + _Mid1 += _Bytes_per_word; + result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); - return _Ans; + if (_Ans == _Mybase::partial) { // not enough bytes, roll back header + *_Pstate = 0; + _Mid1 = _First1; } + + return _Ans; } + } } if (_Ch0 < 0xd800u || 0xdc00u <= _Ch0) { // one word, consume bytes @@ -326,20 +321,19 @@ protected: if (*_Pstate == 0) { // determine endianness once, maybe generate header *_Pstate = (_Mymode & little_endian) != 0 ? _Little_first : _Big_first; constexpr bool _Generating = (_Mymode & generate_header) != 0; - if - _CONSTEXPR_IF(_Generating) { - if (_Last2 - _Mid2 < 3 * _Bytes_per_word) { - return _Mybase::partial; // not enough room for all - } + if _CONSTEXPR_IF (_Generating) { + if (_Last2 - _Mid2 < 3 * _Bytes_per_word) { + return _Mybase::partial; // not enough room for all + } - if (*_Pstate == _Little_first) { // put header LS byte first - *_Mid2++ = '\xff'; - *_Mid2++ = '\xfe'; - } else { // put header MS byte first - *_Mid2++ = '\xfe'; - *_Mid2++ = '\xff'; - } + if (*_Pstate == _Little_first) { // put header LS byte first + *_Mid2++ = '\xff'; + *_Mid2++ = '\xfe'; + } else { // put header MS byte first + *_Mid2++ = '\xfe'; + *_Mid2++ = '\xff'; } + } } while (_Mid1 != _Last1 && _Bytes_per_word <= _Last2 - _Mid2) { // convert and put a wide char @@ -542,19 +536,18 @@ protected: *_Pstate = 1; constexpr bool _Consuming = (_Mymode & consume_header) != 0; - if - _CONSTEXPR_IF(_Consuming) { - if (_Ch == 0xfeffu) { // drop header and retry - result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); - - if (_Ans == _Mybase::partial) { // roll back header determination - *_Pstate = 0; - _Mid1 = _First1; - } + if _CONSTEXPR_IF (_Consuming) { + if (_Ch == 0xfeffu) { // drop header and retry + result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); - return _Ans; + if (_Ans == _Mybase::partial) { // roll back header determination + *_Pstate = 0; + _Mid1 = _First1; } + + return _Ans; } + } } *_Mid2++ = static_cast<_Elem>(_Ch); diff --git a/stl/inc/cvt/ebcdic b/stl/inc/cvt/ebcdic index 400d78c9c99..d10d5d63403 100644 --- a/stl/inc/cvt/ebcdic +++ b/stl/inc/cvt/ebcdic @@ -87,8 +87,8 @@ namespace stdext { return _Mybase::ok; } - virtual int do_length(_Statype&, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const - noexcept override { + virtual int do_length( + _Statype&, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override { // return min(_Count, converted length of bytes [_First1, _Last1)) const auto _Wchars = static_cast(_Last1 - _First1); diff --git a/stl/inc/cvt/euc_0208 b/stl/inc/cvt/euc_0208 index 0c2bd126bf8..1745f5b9188 100644 --- a/stl/inc/cvt/euc_0208 +++ b/stl/inc/cvt/euc_0208 @@ -146,8 +146,8 @@ namespace stdext { return _Mybase::ok; } - virtual int do_length(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const - noexcept override { + virtual int do_length( + _Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override { // return min(_Count, converted length of bytes [_First1, _Last1)) size_t _Wchars = 0; _Statype _Mystate = _State; diff --git a/stl/inc/cvt/jis_0208 b/stl/inc/cvt/jis_0208 index fcc6e10ef77..03e87cbb8dd 100644 --- a/stl/inc/cvt/jis_0208 +++ b/stl/inc/cvt/jis_0208 @@ -202,8 +202,8 @@ namespace stdext { return _Mybase::partial; } - virtual int do_length(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const - noexcept override { + virtual int do_length( + _Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override { // return min(_Count, converted length of bytes [_First1, _Last1)) size_t _Wchars = 0; _Statype _Mystate = _State; diff --git a/stl/inc/cvt/one_one b/stl/inc/cvt/one_one index 16d18575dd0..52d7e72c0c6 100644 --- a/stl/inc/cvt/one_one +++ b/stl/inc/cvt/one_one @@ -74,23 +74,19 @@ namespace stdext { constexpr unsigned char _Default_endian = static_cast( (_Mode & _STD little_endian) != 0 ? _STD _Little_first : _STD _Big_first); - if - _CONSTEXPR_IF((_Mode & _STD little_endian) != 0) { - for (_Count = _Bytes_per_word; 0 < _Count;) { - _Ch = _Ch << 8 | _Ptr[--_Count]; - } + if _CONSTEXPR_IF ((_Mode & _STD little_endian) != 0) { + for (_Count = _Bytes_per_word; 0 < _Count;) { + _Ch = _Ch << 8 | _Ptr[--_Count]; } - else { + } else { for (_Count = 0; _Count < _Bytes_per_word; ++_Count) { _Ch = _Ch << 8 | _Ptr[_Count]; } } - if - _CONSTEXPR_IF((_Mode & _STD consume_header) == 0) { - *_Pstate = _Default_endian; - } - else if (_Ch != 0xfeff && _Ch != (0xfffe0000 >> 8 * (4 - _Bytes_per_word))) { + if _CONSTEXPR_IF ((_Mode & _STD consume_header) == 0) { + *_Pstate = _Default_endian; + } else if (_Ch != 0xfeff && _Ch != (0xfffe0000 >> 8 * (4 - _Bytes_per_word))) { *_Pstate = _Default_endian; } else { // consume header, fixate on endianness, and retry _Mid1 += _Bytes_per_word; @@ -127,19 +123,15 @@ namespace stdext { if (*_Pstate == 0) { // determine endianness once, maybe generate header unsigned long _Header = 0xfeff; - if - _CONSTEXPR_IF((_Mode & _STD little_endian) != 0) { - *_Pstate = _STD _Little_first; - } - else { + if _CONSTEXPR_IF ((_Mode & _STD little_endian) != 0) { + *_Pstate = _STD _Little_first; + } else { *_Pstate = _STD _Big_first; } - if - _CONSTEXPR_IF((_Mode & _STD generate_header) == 0) { - (void) _Header; // unused - } - else if (_Last2 - _Mid2 < 2 * _Bytes_per_word) { + if _CONSTEXPR_IF ((_Mode & _STD generate_header) == 0) { + (void) _Header; // unused + } else if (_Last2 - _Mid2 < 2 * _Bytes_per_word) { return _Mybase::partial; // not enough room for both } else if (*_Pstate == _STD _Little_first) { for (_Count = 0; _Count < _Bytes_per_word; ++_Count) { // put LS byte first @@ -185,8 +177,8 @@ namespace stdext { return _Mybase::ok; } - virtual int do_length(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const - noexcept override { + virtual int do_length( + _Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override { // return min(_Count, converted length of bytes [_First1, _Last1)) size_t _Wchars = 0; _Statype _Mystate = _State; @@ -222,21 +214,17 @@ namespace stdext { } virtual int do_max_length() const noexcept override { // return maximum length required for a conversion - if - _CONSTEXPR_IF((_Mode & (_STD consume_header | _STD generate_header)) != 0) { - return 2 * _Bytes_per_word; - } - else { + if _CONSTEXPR_IF ((_Mode & (_STD consume_header | _STD generate_header)) != 0) { + return 2 * _Bytes_per_word; + } else { return _Bytes_per_word; } } virtual int do_encoding() const noexcept override { // return length of code sequence (from codecvt) - if - _CONSTEXPR_IF((_Mode & (_STD consume_header | _STD generate_header)) != 0) { - return -1; // -1 => state dependent - } - else { + if _CONSTEXPR_IF ((_Mode & (_STD consume_header | _STD generate_header)) != 0) { + return -1; // -1 => state dependent + } else { return static_cast(_Bytes_per_word); } } diff --git a/stl/inc/cvt/sjis_0208 b/stl/inc/cvt/sjis_0208 index 27ee4923706..df52f0ab242 100644 --- a/stl/inc/cvt/sjis_0208 +++ b/stl/inc/cvt/sjis_0208 @@ -132,8 +132,8 @@ namespace stdext { return _Mybase::ok; } - virtual int do_length(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const - noexcept override { + virtual int do_length( + _Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override { // return min(_Count, converted length of bytes [_First1, _Last1)) size_t _Wchars = 0; _Statype _Mystate = _State; diff --git a/stl/inc/cvt/utf16 b/stl/inc/cvt/utf16 index 7112e50eec1..cf95471e5a8 100644 --- a/stl/inc/cvt/utf16 +++ b/stl/inc/cvt/utf16 @@ -71,19 +71,15 @@ namespace stdext { constexpr unsigned char _Default_endian = static_cast( (_Mode & _STD little_endian) != 0 ? _STD _Little_first : _STD _Big_first); - if - _CONSTEXPR_IF((_Mode & _STD little_endian) != 0) { - _Ch0 = static_cast(_Ptr[1] << 8 | _Ptr[0]); - } - else { + if _CONSTEXPR_IF ((_Mode & _STD little_endian) != 0) { + _Ch0 = static_cast(_Ptr[1] << 8 | _Ptr[0]); + } else { _Ch0 = static_cast(_Ptr[0] << 8 | _Ptr[1]); } - if - _CONSTEXPR_IF((_Mode & _STD consume_header) == 0) { - *_Pstate = _Default_endian; - } - else if (_Ch0 != 0xfeff && _Ch0 != 0xfffe) { + if _CONSTEXPR_IF ((_Mode & _STD consume_header) == 0) { + *_Pstate = _Default_endian; + } else if (_Ch0 != 0xfeff && _Ch0 != 0xfffe) { *_Pstate = _Default_endian; } else { // consume header, fixate on endianness, and retry _Mid1 += _Bytes_per_word; @@ -136,28 +132,25 @@ namespace stdext { _Mid2 = _First2; if (*_Pstate == 0) { // determine endianness once, maybe generate header - if - _CONSTEXPR_IF((_Mode & _STD little_endian) != 0) { - *_Pstate = _STD _Little_first; - } - else { + if _CONSTEXPR_IF ((_Mode & _STD little_endian) != 0) { + *_Pstate = _STD _Little_first; + } else { *_Pstate = _STD _Big_first; } - if - _CONSTEXPR_IF((_Mode & _STD generate_header) != 0) { - if (_Last2 - _Mid2 < 3 * _Bytes_per_word) { - return _Mybase::partial; // not enough room for both - } + if _CONSTEXPR_IF ((_Mode & _STD generate_header) != 0) { + if (_Last2 - _Mid2 < 3 * _Bytes_per_word) { + return _Mybase::partial; // not enough room for both + } - if (*_Pstate == _STD _Little_first) { // put header LS byte first - *_Mid2++ = '\xff'; - *_Mid2++ = '\xfe'; - } else { // put header MS byte first - *_Mid2++ = '\xfe'; - *_Mid2++ = '\xff'; - } + if (*_Pstate == _STD _Little_first) { // put header LS byte first + *_Mid2++ = '\xff'; + *_Mid2++ = '\xfe'; + } else { // put header MS byte first + *_Mid2++ = '\xfe'; + *_Mid2++ = '\xff'; } + } } while (_Mid1 != _Last1 && _Bytes_per_word <= _Last2 - _Mid2) { // convert and put a wide char @@ -217,8 +210,8 @@ namespace stdext { return _Mybase::ok; } - virtual int do_length(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const - noexcept override { + virtual int do_length( + _Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override { // return min(_Count, converted length of bytes [_First1, _Last1)) size_t _Wchars = 0; _Statype _Mystate = _State; @@ -254,21 +247,17 @@ namespace stdext { } virtual int do_max_length() const noexcept override { // return maximum length required for a conversion - if - _CONSTEXPR_IF((_Mode & (_STD consume_header | _STD generate_header)) != 0) { - return 3 * _Bytes_per_word; - } - else { + if _CONSTEXPR_IF ((_Mode & (_STD consume_header | _STD generate_header)) != 0) { + return 3 * _Bytes_per_word; + } else { return 6 * _Bytes_per_word; } } virtual int do_encoding() const noexcept override { // return length of code sequence (from codecvt) - if - _CONSTEXPR_IF((_Mode & (_STD consume_header | _STD generate_header)) != 0) { - return -1; // -1 => state dependent - } - else { + if _CONSTEXPR_IF ((_Mode & (_STD consume_header | _STD generate_header)) != 0) { + return -1; // -1 => state dependent + } else { return 0; // 0 => varying length } } diff --git a/stl/inc/cvt/utf8 b/stl/inc/cvt/utf8 index faca87ca88a..15c49c204d3 100644 --- a/stl/inc/cvt/utf8 +++ b/stl/inc/cvt/utf8 @@ -96,18 +96,17 @@ namespace stdext { if (*_Pstate == 0) { // first time, maybe look for and consume header *_Pstate = 1; - if - _CONSTEXPR_IF((_Mode & _STD consume_header) != 0) { - if (_Ch == 0xfeff) { // drop header and retry - result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); - - if (_Ans == _Mybase::partial) { // roll back header determination - *_Pstate = 0; - _Mid1 = _First1; - } - return _Ans; + if _CONSTEXPR_IF ((_Mode & _STD consume_header) != 0) { + if (_Ch == 0xfeff) { // drop header and retry + result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); + + if (_Ans == _Mybase::partial) { // roll back header determination + *_Pstate = 0; + _Mid1 = _First1; } + return _Ans; } + } } if (_Maxcode < _Ch) { @@ -158,17 +157,16 @@ namespace stdext { if (*_Pstate == 0) { // first time, maybe generate header *_Pstate = 1; - if - _CONSTEXPR_IF((_Mode & _STD generate_header) != 0) { - if (_Last2 - _Mid2 < 3 + 1 + _Nextra) { - return _Mybase::partial; // not enough room for both - } - - // prepend header - *_Mid2++ = '\xef'; - *_Mid2++ = '\xbb'; - *_Mid2++ = '\xbf'; + if _CONSTEXPR_IF ((_Mode & _STD generate_header) != 0) { + if (_Last2 - _Mid2 < 3 + 1 + _Nextra) { + return _Mybase::partial; // not enough room for both } + + // prepend header + *_Mid2++ = '\xef'; + *_Mid2++ = '\xbb'; + *_Mid2++ = '\xbf'; + } } if (_Last2 - _Mid2 < 1 + _Nextra) { @@ -189,8 +187,8 @@ namespace stdext { return _Mybase::ok; } - virtual int do_length(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const - noexcept override { + virtual int do_length( + _Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override { // return min(_Count, converted length of bytes [_First1, _Last1)) size_t _Wchars = 0; _Statype _Mystate = _State; @@ -226,21 +224,17 @@ namespace stdext { } virtual int do_max_length() const noexcept override { // return maximum length required for a conversion - if - _CONSTEXPR_IF((_Mode & (_STD consume_header | _STD generate_header)) != 0) { - return 9; - } - else { + if _CONSTEXPR_IF ((_Mode & (_STD consume_header | _STD generate_header)) != 0) { + return 9; + } else { return 6; } } virtual int do_encoding() const noexcept override { // return length of code sequence (from codecvt) - if - _CONSTEXPR_IF((_Mode & (_STD consume_header | _STD generate_header)) != 0) { - return -1; // -1 => state dependent - } - else { + if _CONSTEXPR_IF ((_Mode & (_STD consume_header | _STD generate_header)) != 0) { + return -1; // -1 => state dependent + } else { return 0; // 0 => varying length } } diff --git a/stl/inc/cvt/utf8_utf16 b/stl/inc/cvt/utf8_utf16 index 8e79540da5e..5fff60259d7 100644 --- a/stl/inc/cvt/utf8_utf16 +++ b/stl/inc/cvt/utf8_utf16 @@ -143,18 +143,17 @@ namespace stdext { if (*_Pstate == 0) { // first time, maybe look for and consume header *_Pstate = 1; - if - _CONSTEXPR_IF((_Mode & _STD consume_header) != 0) { - if (_Ch == 0xfeff) { // drop header and retry - result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); - - if (_Ans == _Mybase::partial) { // roll back header determination - *_Pstate = 0; - _Mid1 = _First1; - } - return _Ans; + if _CONSTEXPR_IF ((_Mode & _STD consume_header) != 0) { + if (_Ch == 0xfeff) { // drop header and retry + result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); + + if (_Ans == _Mybase::partial) { // roll back header determination + *_Pstate = 0; + _Mid1 = _First1; } + return _Ans; } + } } *_Mid2++ = static_cast<_Elem>(_Ch); @@ -210,19 +209,18 @@ namespace stdext { break; // not enough room, even without header } - if - _CONSTEXPR_IF((_Mode & _STD generate_header) != 0) { // maybe header to put - if (*_Pstate == 0) { // header to put - if (_Last2 - _Mid2 < 3 + _Nput) { - break; // not enough room for both - } - - // prepend header - *_Mid2++ = '\xef'; - *_Mid2++ = '\xbb'; - *_Mid2++ = '\xbf'; + if _CONSTEXPR_IF ((_Mode & _STD generate_header) != 0) { // maybe header to put + if (*_Pstate == 0) { // header to put + if (_Last2 - _Mid2 < 3 + _Nput) { + break; // not enough room for both } + + // prepend header + *_Mid2++ = '\xef'; + *_Mid2++ = '\xbb'; + *_Mid2++ = '\xbf'; } + } ++_Mid1; if (_Save || _Nextra < 3) { // put first byte of sequence, if not already put @@ -248,8 +246,8 @@ namespace stdext { return 1 < *_Pstate ? _Mybase::error : _Mybase::ok; // fail if trailing first word } - virtual int do_length(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const - noexcept override { + virtual int do_length( + _Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override { // return min(_Count, converted length of bytes [_First1, _Last1)) size_t _Wchars = 0; _Statype _Mystate = _State; @@ -285,15 +283,11 @@ namespace stdext { } virtual int do_max_length() const noexcept override { // return maximum length required for a conversion - if - _CONSTEXPR_IF((_Mode & _STD consume_header) != 0) { - return 9; // header + max input - } - else if - _CONSTEXPR_IF((_Mode & _STD generate_header) != 0) { - return 7; // header + max output - } - else { + if _CONSTEXPR_IF ((_Mode & _STD consume_header) != 0) { + return 9; // header + max input + } else if _CONSTEXPR_IF ((_Mode & _STD generate_header) != 0) { + return 7; // header + max output + } else { return 6; // 6-byte max input sequence, no 3-byte header } } diff --git a/stl/inc/cvt/xjis b/stl/inc/cvt/xjis index cec05b4828d..e679097035c 100644 --- a/stl/inc/cvt/xjis +++ b/stl/inc/cvt/xjis @@ -264,8 +264,8 @@ namespace stdext { return _Mybase::partial; } - virtual int do_length(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const - noexcept override { + virtual int do_length( + _Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override { // return min(_Count, converted length of bytes [_First1, _Last1)) size_t _Wchars = 0; _Statype _Mystate = _State; diff --git a/stl/inc/cvt/xone_byte b/stl/inc/cvt/xone_byte index 6ac6173c0d6..6afc18d39d2 100644 --- a/stl/inc/cvt/xone_byte +++ b/stl/inc/cvt/xone_byte @@ -108,8 +108,8 @@ namespace stdext { return _Mybase::ok; } - virtual int do_length(_Statype&, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const - noexcept override { + virtual int do_length( + _Statype&, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override { // return min(_Count, converted length of bytes [_First1, _Last1)) const auto _Wchars = static_cast(_Last1 - _First1); diff --git a/stl/inc/cvt/xtwo_byte b/stl/inc/cvt/xtwo_byte index 32e1f1c62b9..17b21b27ed9 100644 --- a/stl/inc/cvt/xtwo_byte +++ b/stl/inc/cvt/xtwo_byte @@ -57,11 +57,9 @@ namespace stdext { if (_Bytecode < _Table::_Nlow) { _Widecode = _Bytecode; // map byte to same wide value } else if ((_Widecode = _Table::_Btw[_Bytecode - _Table::_Nlow]) == 0) { - if - _CONSTEXPR_IF(_Table::_Nbytes < 2) { - return _Mybase::error; // no single-byte mapping - } - else { + if _CONSTEXPR_IF (_Table::_Nbytes < 2) { + return _Mybase::error; // no single-byte mapping + } else { if (_Mid1 + 1 == _Last1) { break; // need another input byte } @@ -158,8 +156,8 @@ namespace stdext { return _Mybase::ok; } - virtual int do_length(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const - noexcept override { + virtual int do_length( + _Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override { // return min(_Count, converted length of bytes [_First1, _Last1)) size_t _Wchars = 0; _Statype _Mystate = _State; diff --git a/stl/inc/deque b/stl/inc/deque index 396263016c7..862f15b78b9 100644 --- a/stl/inc/deque +++ b/stl/inc/deque @@ -710,16 +710,15 @@ public: deque(deque&& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Alproxy_ty _Alproxy(_Getal()); - if - _CONSTEXPR_IF(!_Alty_traits::is_always_equal::value) { - if (_Getal() != _Right._Getal()) { - _Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Alproxy, _Get_data()); - _Construct(_STD make_move_iterator(_Right._Unchecked_begin()), - _STD make_move_iterator(_Right._Unchecked_end())); - _Proxy._Release(); - return; - } + if _CONSTEXPR_IF (!_Alty_traits::is_always_equal::value) { + if (_Getal() != _Right._Getal()) { + _Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Alproxy, _Get_data()); + _Construct(_STD make_move_iterator(_Right._Unchecked_begin()), + _STD make_move_iterator(_Right._Unchecked_end())); + _Proxy._Release(); + return; } + } _Get_data()._Alloc_proxy(_Alproxy); _Take_contents(_Right); @@ -1568,7 +1567,7 @@ private: #if _HAS_CXX17 template >, enable_if_t, _Is_allocator<_Alloc>>, int> = 0> -deque(_Iter, _Iter, _Alloc = _Alloc())->deque<_Iter_value_t<_Iter>, _Alloc>; +deque(_Iter, _Iter, _Alloc = _Alloc()) -> deque<_Iter_value_t<_Iter>, _Alloc>; #endif // _HAS_CXX17 template diff --git a/stl/inc/execution b/stl/inc/execution index 62f0a517503..2f93947390e 100644 --- a/stl/inc/execution +++ b/stl/inc/execution @@ -1279,8 +1279,8 @@ _FwdIt for_each_n(_ExPo&&, _FwdIt _First, const _Diff _Count_raw, _Fn _Func) noe #if _ITERATOR_DEBUG_ARRAY_OVERLOADS template /* = 0 */> -_SourceTy* for_each_n( - _ExPo&& _Exec, _SourceTy (&_First)[_SourceSize], const _Diff _Count_raw, _Fn _Func) noexcept /* terminates */ { +_SourceTy* for_each_n(_ExPo&& _Exec, _SourceTy (&_First)[_SourceSize], const _Diff _Count_raw, _Fn _Func) noexcept +/* terminates */ { // perform function for each element [_First, _First + _Count) _Algorithm_int_t<_Diff> _Count = _Count_raw; _STL_VERIFY_ARRAY_SIZE(_First, _Count); @@ -1718,8 +1718,8 @@ struct _Static_partitioned_count_if2 { }; template /* = 0 */> -_NODISCARD _Iter_diff_t<_FwdIt> count_if( - _ExPo&&, const _FwdIt _First, const _FwdIt _Last, _Pr _Pred) noexcept /* terminates */ { +_NODISCARD _Iter_diff_t<_FwdIt> count_if(_ExPo&&, const _FwdIt _First, const _FwdIt _Last, _Pr _Pred) noexcept +/* terminates */ { // count elements satisfying _Pred _REQUIRE_PARALLEL_ITERATOR(_FwdIt); _Adl_verify_range(_First, _Last); @@ -1753,8 +1753,8 @@ _NODISCARD _Iter_diff_t<_FwdIt> count_if( } template /* = 0 */> -_NODISCARD _Iter_diff_t<_FwdIt> count( - _ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, const _Ty& _Val) noexcept /* terminates */ { +_NODISCARD _Iter_diff_t<_FwdIt> count(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, const _Ty& _Val) noexcept +/* terminates */ { // count elements that match _Val _REQUIRE_PARALLEL_ITERATOR(_FwdIt); _Adl_verify_range(_First, _Last); @@ -1999,8 +1999,8 @@ struct _Static_partitioned_equal2 { }; template /* = 0 */> -_NODISCARD bool equal( - _ExPo&&, const _FwdIt1 _First1, const _FwdIt1 _Last1, const _FwdIt2 _First2, _Pr _Pred) noexcept /* terminates */ { +_NODISCARD bool equal(_ExPo&&, const _FwdIt1 _First1, const _FwdIt1 _Last1, const _FwdIt2 _First2, _Pr _Pred) noexcept +/* terminates */ { // compare [_First1, _Last1) to [_First2, ...) using _Pred _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); @@ -2333,8 +2333,8 @@ struct _Static_partitioned_unary_transform2 { }; template /* = 0 */> -_FwdIt2 transform( - _ExPo&&, const _FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _Fn _Func) noexcept /* terminates */ { +_FwdIt2 transform(_ExPo&&, const _FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _Fn _Func) noexcept +/* terminates */ { // transform [_First, _Last) with _Func _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); @@ -2469,8 +2469,8 @@ _FwdIt3 transform(_ExPo&&, const _FwdIt1 _First1, const _FwdIt1 _Last1, const _F // PARALLEL FUNCTION TEMPLATE replace template /* = 0 */> -void replace(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, const _Ty& _Oldval, - const _Ty& _Newval) noexcept /* terminates */ { +void replace(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, const _Ty& _Oldval, const _Ty& _Newval) noexcept +/* terminates */ { // replace each matching _Oldval with _Newval _REQUIRE_PARALLEL_ITERATOR(_FwdIt); _STD for_each(_STD forward<_ExPo>(_Exec), _First, _Last, [&](auto&& _Value) { @@ -2482,8 +2482,8 @@ void replace(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, const _Ty& // PARALLEL FUNCTION TEMPLATE replace_if template /* = 0 */> -void replace_if( - _ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, _Pr _Pred, const _Ty& _Val) noexcept /* terminates */ { +void replace_if(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, _Pr _Pred, const _Ty& _Val) noexcept +/* terminates */ { // replace each satisfying _Pred with _Val _REQUIRE_PARALLEL_ITERATOR(_FwdIt); _STD for_each( @@ -2634,8 +2634,8 @@ _NODISCARD _FwdIt remove_if(_ExPo&&, _FwdIt _First, const _FwdIt _Last, _Pr _Pre } template /* = 0 */> -_NODISCARD _FwdIt remove( - _ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, const _Ty& _Val) noexcept /* terminates */ { +_NODISCARD _FwdIt remove(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, const _Ty& _Val) noexcept +/* terminates */ { // remove each matching _Val return _STD remove_if(_STD forward<_ExPo>(_Exec), _First, _Last, [&_Val](auto&& _Lhs) { return _STD forward(_Lhs) == _Val; }); @@ -4111,8 +4111,8 @@ struct _Static_partitioned_reduce2 { }; template /* = 0 */> -_NODISCARD _Ty reduce( - _ExPo&&, const _FwdIt _First, const _FwdIt _Last, _Ty _Val, _BinOp _Reduce_op) noexcept /* terminates */ { +_NODISCARD _Ty reduce(_ExPo&&, const _FwdIt _First, const _FwdIt _Last, _Ty _Val, _BinOp _Reduce_op) noexcept +/* terminates */ { // return commutative and associative reduction of _Val and [_First, _Last), using _Reduce_op _REQUIRE_PARALLEL_ITERATOR(_FwdIt); _Adl_verify_range(_First, _Last); @@ -4604,8 +4604,8 @@ struct _Static_partitioned_inclusive_scan2 { template /* = 0 */> -_FwdIt2 inclusive_scan( - _ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op, _Ty _Val) noexcept /* terminates */ { +_FwdIt2 inclusive_scan(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op, _Ty _Val) noexcept +/* terminates */ { // compute partial noncommutative and associative reductions including _Val into _Dest, using _Reduce_op _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); @@ -4647,8 +4647,8 @@ _FwdIt2 inclusive_scan( } template /* = 0 */> -_FwdIt2 inclusive_scan( - _ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op) noexcept /* terminates */ { +_FwdIt2 inclusive_scan(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op) noexcept +/* terminates */ { // compute partial noncommutative and associative reductions into _Dest, using _Reduce_op _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); @@ -5087,8 +5087,8 @@ _FwdIt2 _Adjacent_difference_seq(_FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _D } template /* = 0 */> -_FwdIt2 adjacent_difference( - _ExPo&&, const _FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Diff_op) noexcept /* terminates */ { +_FwdIt2 adjacent_difference(_ExPo&&, const _FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Diff_op) noexcept +/* terminates */ { // compute adjacent differences into _Dest _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); diff --git a/stl/inc/experimental/filesystem b/stl/inc/experimental/filesystem index 960024b20dd..472d8e8e197 100644 --- a/stl/inc/experimental/filesystem +++ b/stl/inc/experimental/filesystem @@ -1415,7 +1415,7 @@ public: _Mysymstat = _Symstatarg; } - operator const _FSPFX path&() const noexcept { + operator const _FSPFX path &() const noexcept { return _Mypval; } diff --git a/stl/inc/experimental/resumable b/stl/inc/experimental/resumable index 454c4e99a7c..b056843428c 100644 --- a/stl/inc/experimental/resumable +++ b/stl/inc/experimental/resumable @@ -80,8 +80,8 @@ namespace experimental { return _Ptr; } - __declspec(deprecated("is deprecated. Use coroutine_handle::address() instead")) void* to_address() const - noexcept { + __declspec( + deprecated("is deprecated. Use coroutine_handle::address() instead")) void* to_address() const noexcept { return _Ptr; } diff --git a/stl/inc/filesystem b/stl/inc/filesystem index c485c68f087..8dddbc99595 100644 --- a/stl/inc/filesystem +++ b/stl/inc/filesystem @@ -2161,7 +2161,7 @@ namespace filesystem { return _Path; } - operator const filesystem::path&() const noexcept { + operator const filesystem::path &() const noexcept { return _Path; } @@ -3284,8 +3284,8 @@ namespace filesystem { } // FUNCTION copy_file - inline bool copy_file( - const path& _From, const path& _To, const copy_options _Options, error_code& _Ec) noexcept /* strengthened */ { + inline bool copy_file(const path& _From, const path& _To, const copy_options _Options, error_code& _Ec) noexcept + /* strengthened */ { // copy a file _From -> _To according to _Options const auto _Result = __std_fs_copy_file(_From.c_str(), _To.c_str(), static_cast<__std_fs_copy_options>(_Options)); diff --git a/stl/inc/forward_list b/stl/inc/forward_list index d83068b86db..13d76fb69e9 100644 --- a/stl/inc/forward_list +++ b/stl/inc/forward_list @@ -617,17 +617,16 @@ public: forward_list(forward_list&& _Right, const _Alloc& _Al) noexcept( _Alnode_traits::is_always_equal::value) // strengthened : _Mypair(_One_then_variadic_args_t{}, _Al) { - if - _CONSTEXPR_IF(!_Alty_traits::is_always_equal::value) { - if (_Getal() != _Right._Getal()) { - _Flist_insert_after_op2<_Alnode> _Insert_op(_Getal()); - _Insert_op._Append_range_unchecked( - _STD make_move_iterator(_Right._Unchecked_begin()), _Default_sentinel{}); - _Alloc_proxy(); - _Insert_op._Attach_after(_Mypair._Myval2._Before_head()); - return; - } + if _CONSTEXPR_IF (!_Alty_traits::is_always_equal::value) { + if (_Getal() != _Right._Getal()) { + _Flist_insert_after_op2<_Alnode> _Insert_op(_Getal()); + _Insert_op._Append_range_unchecked( + _STD make_move_iterator(_Right._Unchecked_begin()), _Default_sentinel{}); + _Alloc_proxy(); + _Insert_op._Attach_after(_Mypair._Myval2._Before_head()); + return; } + } _Alloc_proxy(); _Take_head(_Right); @@ -1096,8 +1095,8 @@ public: splice_after(_Where, _Right, _First); } - void splice_after(const_iterator _Where, forward_list& _Right, const_iterator _First, - const_iterator _Last) noexcept /* strengthened */ { + void splice_after(const_iterator _Where, forward_list& _Right, const_iterator _First, const_iterator _Last) noexcept + /* strengthened */ { // splice _Right (_First, _Last) after _Where #if _ITERATOR_DEBUG_LEVEL == 2 _STL_VERIFY( @@ -1251,10 +1250,9 @@ private: auto& _Right_data = _Right._Mypair._Myval2; #if _ITERATOR_DEBUG_LEVEL != 0 _DEBUG_ORDER_UNWRAPPED(_Right._Unchecked_begin(), _Default_sentinel{}, _Pred); - if - _CONSTEXPR_IF(!_Alnode_traits::is_always_equal::value) { - _STL_VERIFY(_Getal() == _Right._Getal(), "list allocators incompatible for merge"); - } + if _CONSTEXPR_IF (!_Alnode_traits::is_always_equal::value) { + _STL_VERIFY(_Getal() == _Right._Getal(), "list allocators incompatible for merge"); + } #endif // _ITERATOR_DEBUG_LEVEL != 0 if (!_My_data._Myhead) { @@ -1273,13 +1271,12 @@ private: #if _ITERATOR_DEBUG_LEVEL == 2 constexpr bool _Noexcept = noexcept(_DEBUG_LT_PRED(_Pred, _My_data._Myhead->_Myval, _Right_data._Myhead->_Myval)); - if - _CONSTEXPR_IF(_Noexcept) { - // if the comparison is noexcept, we can take all the iterators in one go and avoid quadratic updates of - // the iterator chain - _Lockit _Lock(_LOCK_DEBUG); - _Transfer_non_before_begin_ownership(_Right); - } // unlock + if _CONSTEXPR_IF (_Noexcept) { + // if the comparison is noexcept, we can take all the iterators in one go and avoid quadratic updates of + // the iterator chain + _Lockit _Lock(_LOCK_DEBUG); + _Transfer_non_before_begin_ownership(_Right); + } // unlock #endif // _ITERATOR_DEBUG_LEVEL == 2 if (!_Right_data._Myhead) { @@ -1326,13 +1323,12 @@ private: } #if _ITERATOR_DEBUG_LEVEL == 2 - if - _CONSTEXPR_IF(!_Noexcept) { - _Lockit _Lock(_LOCK_DEBUG); - for (auto _Next = _First2; _Next != _Run_end; _Next = _Next->_Next) { - _Transfer_ownership(_Right, _Next); - } - } // unlock + if _CONSTEXPR_IF (!_Noexcept) { + _Lockit _Lock(_LOCK_DEBUG); + for (auto _Next = _First2; _Next != _Run_end; _Next = _Next->_Next) { + _Transfer_ownership(_Right, _Next); + } + } // unlock #endif // _ITERATOR_DEBUG_LEVEL == 2 _Right_data._Myhead = _Run_end; // snip out the run from its old position @@ -1425,10 +1421,9 @@ private: #if _ITERATOR_DEBUG_LEVEL == 0 (void) _Right; #else // ^^^ _ITERATOR_DEBUG_LEVEL == 0 // _ITERATOR_DEBUG_LEVEL != 0 vvv - if - _CONSTEXPR_IF(!_Alnode_traits::is_always_equal::value) { - _STL_VERIFY(_Getal() == _Right._Getal(), "forward_list containers incompatible for splice_after"); - } + if _CONSTEXPR_IF (!_Alnode_traits::is_always_equal::value) { + _STL_VERIFY(_Getal() == _Right._Getal(), "forward_list containers incompatible for splice_after"); + } #endif // _ITERATOR_DEBUG_LEVEL == 0 #if _ITERATOR_DEBUG_LEVEL == 2 @@ -1455,10 +1450,9 @@ private: #if _ITERATOR_DEBUG_LEVEL == 0 (void) _Right; #else // ^^^ _ITERATOR_DEBUG_LEVEL == 0 // _ITERATOR_DEBUG_LEVEL != 0 vvv - if - _CONSTEXPR_IF(!_Alnode_traits::is_always_equal::value) { - _STL_VERIFY(_Getal() == _Right._Getal(), "forward_list containers incompatible for splice_after"); - } + if _CONSTEXPR_IF (!_Alnode_traits::is_always_equal::value) { + _STL_VERIFY(_Getal() == _Right._Getal(), "forward_list containers incompatible for splice_after"); + } #endif // _ITERATOR_DEBUG_LEVEL == 0 if (_First == _Last) { @@ -1516,7 +1510,7 @@ private: #if _HAS_CXX17 template >, enable_if_t, _Is_allocator<_Alloc>>, int> = 0> -forward_list(_Iter, _Iter, _Alloc = _Alloc())->forward_list<_Iter_value_t<_Iter>, _Alloc>; +forward_list(_Iter, _Iter, _Alloc = _Alloc()) -> forward_list<_Iter_value_t<_Iter>, _Alloc>; #endif // _HAS_CXX17 template diff --git a/stl/inc/fstream b/stl/inc/fstream index fd055b38bc6..887a30dd8b4 100644 --- a/stl/inc/fstream +++ b/stl/inc/fstream @@ -547,82 +547,78 @@ protected: #pragma warning(disable : 4127) // conditional expression is constant virtual streamsize __CLR_OR_THIS_CALL xsgetn(_Elem* _Ptr, streamsize _Count) override { // get _Count characters from stream - if - _CONSTEXPR_IF(sizeof(_Elem) == 1) { - if (_Count <= 0) { - return 0; - } - - if (_Pcvt) { // if we need a nontrivial codecvt transform, do the default expensive thing - return _Mysb::xsgetn(_Ptr, _Count); - } + if _CONSTEXPR_IF (sizeof(_Elem) == 1) { + if (_Count <= 0) { + return 0; + } - // assuming this is OK because _Ptr + _Count must be valid - auto _Count_s = static_cast(_Count); - const auto _Start_count = _Count; - const auto _Available = static_cast(_Mysb::_Gnavail()); - if (0 < _Available) { // copy from get area - const auto _Read_size = (_STD min)(_Count_s, _Available); - _Traits::copy(_Ptr, _Mysb::gptr(), _Read_size); - _Ptr += _Read_size; - _Count_s -= _Read_size; - _Mysb::gbump(static_cast(_Read_size)); - } + if (_Pcvt) { // if we need a nontrivial codecvt transform, do the default expensive thing + return _Mysb::xsgetn(_Ptr, _Count); + } - if (_Myfile) { // open C stream, attempt read - _Reset_back(); // revert from _Mychar buffer - // process in 4k - 1 chunks to avoid tripping over fread's clobber-the-end behavior when - // doing \r\n -> \n translation - constexpr size_t _Read_size = 4095; // _INTERNAL_BUFSIZ - 1 - while (_Read_size < _Count_s) { - const auto _Actual_read = _CSTD fread(_Ptr, sizeof(_Elem), _Read_size, _Myfile); - _Ptr += _Actual_read; - _Count_s -= _Actual_read; - if (_Actual_read != _Read_size) { - return static_cast(_Start_count - _Count_s); - } - } + // assuming this is OK because _Ptr + _Count must be valid + auto _Count_s = static_cast(_Count); + const auto _Start_count = _Count; + const auto _Available = static_cast(_Mysb::_Gnavail()); + if (0 < _Available) { // copy from get area + const auto _Read_size = (_STD min)(_Count_s, _Available); + _Traits::copy(_Ptr, _Mysb::gptr(), _Read_size); + _Ptr += _Read_size; + _Count_s -= _Read_size; + _Mysb::gbump(static_cast(_Read_size)); + } - if (0 < _Count_s) { - _Count_s -= _CSTD fread(_Ptr, sizeof(_Elem), _Count_s, _Myfile); + if (_Myfile) { // open C stream, attempt read + _Reset_back(); // revert from _Mychar buffer + // process in 4k - 1 chunks to avoid tripping over fread's clobber-the-end behavior when + // doing \r\n -> \n translation + constexpr size_t _Read_size = 4095; // _INTERNAL_BUFSIZ - 1 + while (_Read_size < _Count_s) { + const auto _Actual_read = _CSTD fread(_Ptr, sizeof(_Elem), _Read_size, _Myfile); + _Ptr += _Actual_read; + _Count_s -= _Actual_read; + if (_Actual_read != _Read_size) { + return static_cast(_Start_count - _Count_s); } } - return static_cast(_Start_count - _Count_s); + if (0 < _Count_s) { + _Count_s -= _CSTD fread(_Ptr, sizeof(_Elem), _Count_s, _Myfile); + } } - else { // non-chars always get element-by-element processing + + return static_cast(_Start_count - _Count_s); + } else { // non-chars always get element-by-element processing return _Mysb::xsgetn(_Ptr, _Count); } } virtual streamsize __CLR_OR_THIS_CALL xsputn(const _Elem* _Ptr, streamsize _Count) override { // put _Count characters to stream - if - _CONSTEXPR_IF(sizeof(_Elem) == 1) { - if (_Pcvt) { // if we need a nontrivial codecvt transform, do the default expensive thing - return _Mysb::xsputn(_Ptr, _Count); - } - - const streamsize _Start_count = _Count; - streamsize _Size = _Mysb::_Pnavail(); - if (0 < _Count && 0 < _Size) { // copy to write buffer - if (_Count < _Size) { - _Size = _Count; - } + if _CONSTEXPR_IF (sizeof(_Elem) == 1) { + if (_Pcvt) { // if we need a nontrivial codecvt transform, do the default expensive thing + return _Mysb::xsputn(_Ptr, _Count); + } - _Traits::copy(_Mysb::pptr(), _Ptr, static_cast(_Size)); - _Ptr += _Size; - _Count -= _Size; - _Mysb::pbump(static_cast(_Size)); + const streamsize _Start_count = _Count; + streamsize _Size = _Mysb::_Pnavail(); + if (0 < _Count && 0 < _Size) { // copy to write buffer + if (_Count < _Size) { + _Size = _Count; } - if (0 < _Count && _Myfile) { // open C stream, attempt write - _Count -= _CSTD fwrite(_Ptr, sizeof(_Elem), static_cast(_Count), _Myfile); - } + _Traits::copy(_Mysb::pptr(), _Ptr, static_cast(_Size)); + _Ptr += _Size; + _Count -= _Size; + _Mysb::pbump(static_cast(_Size)); + } - return _Start_count - _Count; + if (0 < _Count && _Myfile) { // open C stream, attempt write + _Count -= _CSTD fwrite(_Ptr, sizeof(_Elem), static_cast(_Count), _Myfile); } - else { // non-chars always get element-by-element processing + + return _Start_count - _Count; + } else { // non-chars always get element-by-element processing return _Mysb::xsputn(_Ptr, _Count); } } diff --git a/stl/inc/functional b/stl/inc/functional index 3b1820dc378..36f7e4f1ef8 100644 --- a/stl/inc/functional +++ b/stl/inc/functional @@ -679,9 +679,9 @@ public: _Not_fn(_Not_fn&&) = default; template - auto operator()(_Types&&... _Args) - & noexcept(noexcept(!_STD invoke(this->_Get_val(), _STD forward<_Types>(_Args)...))) // strengthened - -> decltype(!_STD declval>()) { + auto operator()(_Types&&... _Args) & noexcept( + noexcept(!_STD invoke(this->_Get_val(), _STD forward<_Types>(_Args)...))) // strengthened + -> decltype(!_STD declval>()) { return !_STD invoke(this->_Get_val(), _STD forward<_Types>(_Args)...); } @@ -693,10 +693,9 @@ public: } template - auto operator()(_Types&&... _Args) - && noexcept(noexcept(!_STD invoke(_STD move(this->_Get_val()), - _STD forward<_Types>(_Args)...))) // strengthened - -> decltype(!_STD declval>()) { + auto operator()(_Types&&... _Args) && noexcept(noexcept(!_STD invoke(_STD move(this->_Get_val()), + _STD forward<_Types>(_Args)...))) // strengthened + -> decltype(!_STD declval>()) { return !_STD invoke(_STD move(this->_Get_val()), _STD forward<_Types>(_Args)...); } @@ -818,16 +817,14 @@ public: private: virtual _Mybase* _Copy(void* _Where) const override { auto& _Myax = _Mypair._Get_first(); - if - _CONSTEXPR_IF(_Is_large<_Func_impl>) { - (void) _Where; - _Myalty _Rebound(_Myax); - _Alloc_construct_ptr<_Myalty> _Constructor{_Rebound}; - _Constructor._Allocate(); - _Construct_in_place(*_Constructor._Ptr, _Mypair._Myval2, _Myax); - return _Constructor._Release(); - } - else { + if _CONSTEXPR_IF (_Is_large<_Func_impl>) { + (void) _Where; + _Myalty _Rebound(_Myax); + _Alloc_construct_ptr<_Myalty> _Constructor{_Rebound}; + _Constructor._Allocate(); + _Construct_in_place(*_Constructor._Ptr, _Mypair._Myval2, _Myax); + return _Constructor._Release(); + } else { const auto _Ptr = static_cast<_Func_impl*>(_Where); _Construct_in_place(*_Ptr, _Mypair._Myval2, _Myax); return _Ptr; @@ -835,12 +832,10 @@ private: } virtual _Mybase* _Move(void* _Where) noexcept override { - if - _CONSTEXPR_IF(_Is_large<_Func_impl>) { - (void) _Where; - return nullptr; - } - else { + if _CONSTEXPR_IF (_Is_large<_Func_impl>) { + (void) _Where; + return nullptr; + } else { const auto _Ptr = static_cast<_Func_impl*>(_Where); _Construct_in_place(*_Ptr, _STD move(_Mypair._Myval2), _STD move(_Mypair._Get_first())); return _Ptr; @@ -890,23 +885,19 @@ public: private: virtual _Mybase* _Copy(void* _Where) const override { - if - _CONSTEXPR_IF(_Is_large<_Func_impl_no_alloc>) { - (void) _Where; - return _Global_new<_Func_impl_no_alloc>(_Callee); - } - else { + if _CONSTEXPR_IF (_Is_large<_Func_impl_no_alloc>) { + (void) _Where; + return _Global_new<_Func_impl_no_alloc>(_Callee); + } else { return ::new (_Where) _Func_impl_no_alloc(_Callee); } } virtual _Mybase* _Move(void* _Where) noexcept override { - if - _CONSTEXPR_IF(_Is_large<_Func_impl_no_alloc>) { - (void) _Where; - return nullptr; - } - else { + if _CONSTEXPR_IF (_Is_large<_Func_impl_no_alloc>) { + (void) _Where; + return nullptr; + } else { return ::new (_Where) _Func_impl_no_alloc(_STD move(_Callee)); } } @@ -1002,12 +993,10 @@ protected: } using _Impl = _Func_impl_no_alloc, _Ret, _Types...>; - if - _CONSTEXPR_IF(_Is_large<_Impl>) { - // dynamically allocate _Val - _Set(_Global_new<_Impl>(_STD forward<_Fx>(_Val))); - } - else { + if _CONSTEXPR_IF (_Is_large<_Impl>) { + // dynamically allocate _Val + _Set(_Global_new<_Impl>(_STD forward<_Fx>(_Val))); + } else { // store _Val in-situ _Set(::new (static_cast(&_Mystorage)) _Impl(_STD forward<_Fx>(_Val))); } @@ -1021,17 +1010,15 @@ protected: } using _Myimpl = _Func_impl, _Alloc, _Ret, _Types...>; - if - _CONSTEXPR_IF(_Is_large<_Myimpl>) { - // dynamically allocate _Val - using _Alimpl = _Rebind_alloc_t<_Alloc, _Myimpl>; - _Alimpl _Al(_Ax); - _Alloc_construct_ptr<_Alimpl> _Constructor{_Al}; - _Constructor._Allocate(); - _Construct_in_place(*_Constructor._Ptr, _STD forward<_Fx>(_Val), _Ax); - _Set(_Unfancy(_Constructor._Release())); - } - else { + if _CONSTEXPR_IF (_Is_large<_Myimpl>) { + // dynamically allocate _Val + using _Alimpl = _Rebind_alloc_t<_Alloc, _Myimpl>; + _Alimpl _Al(_Ax); + _Alloc_construct_ptr<_Alimpl> _Constructor{_Al}; + _Constructor._Allocate(); + _Construct_in_place(*_Constructor._Ptr, _STD forward<_Fx>(_Val), _Ax); + _Set(_Unfancy(_Constructor._Release())); + } else { // store _Val in-situ const auto _Ptr = reinterpret_cast<_Myimpl*>(&_Mystorage); _Construct_in_place(*_Ptr, _STD forward<_Fx>(_Val), _Ax); @@ -1253,7 +1240,7 @@ public: #if _HAS_CXX17 #define _FUNCTION_POINTER_DEDUCTION_GUIDE(CALL_OPT, X1, X2, X3) \ template \ - function(_Ret(CALL_OPT*)(_Types...))->function<_Ret(_Types...)>; // intentionally discards CALL_OPT + function(_Ret(CALL_OPT*)(_Types...)) -> function<_Ret(_Types...)>; // intentionally discards CALL_OPT _NON_MEMBER_CALL(_FUNCTION_POINTER_DEDUCTION_GUIDE, X1, X2, X3) #undef _FUNCTION_POINTER_DEDUCTION_GUIDE @@ -1267,7 +1254,7 @@ struct _Deduce_signature<_Fx, void_t> : _Is_memfunptr::_Guide_type {}; // N4842 [func.wrap.func.con]/12 template -function(_Fx)->function::type>; +function(_Fx) -> function::type>; #endif // _HAS_CXX17 template @@ -1500,14 +1487,11 @@ namespace placeholders { #if _HAS_CXX20 // FUNCTION TEMPLATE _Call_front_binder template -constexpr auto _Call_front_binder( - index_sequence<_Ix...>, _Cv_FD&& _Obj, _Cv_tuple_TiD&& _Tpl, _Unbound&&... _Unbargs) // - noexcept(noexcept( // - _STD invoke(_STD forward<_Cv_FD>(_Obj), _STD get<_Ix>(_STD forward<_Cv_tuple_TiD>(_Tpl))..., - _STD forward<_Unbound>(_Unbargs)...))) // - -> decltype( // - _STD invoke(_STD forward<_Cv_FD>(_Obj), _STD get<_Ix>(_STD forward<_Cv_tuple_TiD>(_Tpl))..., - _STD forward<_Unbound>(_Unbargs)...)) { // +constexpr auto _Call_front_binder(index_sequence<_Ix...>, _Cv_FD&& _Obj, _Cv_tuple_TiD&& _Tpl, + _Unbound&&... _Unbargs) noexcept(noexcept(_STD invoke(_STD forward<_Cv_FD>(_Obj), + _STD get<_Ix>(_STD forward<_Cv_tuple_TiD>(_Tpl))..., _STD forward<_Unbound>(_Unbargs)...))) + -> decltype(_STD invoke(_STD forward<_Cv_FD>(_Obj), _STD get<_Ix>(_STD forward<_Cv_tuple_TiD>(_Tpl))..., + _STD forward<_Unbound>(_Unbargs)...)) { return _STD invoke(_STD forward<_Cv_FD>(_Obj), _STD get<_Ix>(_STD forward<_Cv_tuple_TiD>(_Tpl))..., _STD forward<_Unbound>(_Unbargs)...); } @@ -1536,44 +1520,35 @@ public: : _Mypair(_One_then_variadic_args_t{}, _STD forward<_Fx>(_Func), _STD forward<_Types>(_Args)...) {} template - constexpr auto operator()(_Unbound&&... _Unbargs) // - & noexcept(noexcept( // - _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...))) // - -> decltype( // - _Call_front_binder( - _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...)) { // + constexpr auto operator()(_Unbound&&... _Unbargs) & noexcept(noexcept( + _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...))) + -> decltype( + _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...)) { return _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...); } template - constexpr auto operator()(_Unbound&&... _Unbargs) // - const& noexcept(noexcept( // - _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...))) // - -> decltype( // - _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...)) { // + constexpr auto operator()(_Unbound&&... _Unbargs) const& noexcept(noexcept( + _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...))) + -> decltype( + _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...)) { return _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...); } template - constexpr auto operator()(_Unbound&&... _Unbargs) // - && noexcept(noexcept( // - _Call_front_binder(_Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), - _STD forward<_Unbound>(_Unbargs)...))) // - -> decltype( // - _Call_front_binder(_Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), - _STD forward<_Unbound>(_Unbargs)...)) { // + constexpr auto operator()(_Unbound&&... _Unbargs) && noexcept(noexcept(_Call_front_binder( + _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...))) + -> decltype(_Call_front_binder( + _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...)) { return _Call_front_binder( _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...); } template - constexpr auto operator()(_Unbound&&... _Unbargs) // - const&& noexcept(noexcept( // - _Call_front_binder(_Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), - _STD forward<_Unbound>(_Unbargs)...))) // - -> decltype( // - _Call_front_binder(_Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), - _STD forward<_Unbound>(_Unbargs)...)) { // + constexpr auto operator()(_Unbound&&... _Unbargs) const&& noexcept(noexcept(_Call_front_binder( + _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...))) + -> decltype(_Call_front_binder( + _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...)) { return _Call_front_binder( _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...); } diff --git a/stl/inc/future b/stl/inc/future index fd7cb12c0d7..d50eb653751 100644 --- a/stl/inc/future +++ b/stl/inc/future @@ -1563,7 +1563,7 @@ namespace experimental { void await_suspend(experimental::coroutine_handle<> _ResumeCb) { // TRANSITION, change to .then if and when future gets .then - thread _WaitingThread([& _Fut = _Fut, _ResumeCb]() mutable { + thread _WaitingThread([&_Fut = _Fut, _ResumeCb]() mutable { _Fut.wait(); _ResumeCb(); }); diff --git a/stl/inc/list b/stl/inc/list index cfe4ff5b337..16174f987e0 100644 --- a/stl/inc/list +++ b/stl/inc/list @@ -895,14 +895,13 @@ public: } list(list&& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { - if - _CONSTEXPR_IF(!_Alnode_traits::is_always_equal::value) { - if (_Getal() != _Right._Getal()) { - _Construct_range_unchecked(_STD make_move_iterator(_Right._Unchecked_begin()), - _STD make_move_iterator(_Right._Unchecked_end())); - return; - } + if _CONSTEXPR_IF (!_Alnode_traits::is_always_equal::value) { + if (_Getal() != _Right._Getal()) { + _Construct_range_unchecked(_STD make_move_iterator(_Right._Unchecked_begin()), + _STD make_move_iterator(_Right._Unchecked_end())); + return; } + } _Alloc_sentinel_and_proxy(); _Swap_val(_Right); @@ -1683,10 +1682,9 @@ private: #if _ITERATOR_DEBUG_LEVEL != 0 _DEBUG_ORDER_UNWRAPPED(_Right._Unchecked_begin(), _Right._Unchecked_end(), _Pred); - if - _CONSTEXPR_IF(!_Alnode_traits::is_always_equal::value) { - _STL_VERIFY(_Getal() == _Right._Getal(), "list allocators incompatible for merge"); - } + if _CONSTEXPR_IF (!_Alnode_traits::is_always_equal::value) { + _STL_VERIFY(_Getal() == _Right._Getal(), "list allocators incompatible for merge"); + } #endif // _ITERATOR_DEBUG_LEVEL != 0 const auto _Right_size = _Right._Mypair._Myval2._Mysize; @@ -1741,10 +1739,9 @@ private: // splice _Right [_First, _Last) before _Where; returns _Last if (this != _STD addressof(_Right)) { // splicing from another list, adjust counts #if _ITERATOR_DEBUG_LEVEL != 0 - if - _CONSTEXPR_IF(!_Alnode_traits::is_always_equal::value) { - _STL_VERIFY(_Getal() == _Right._Getal(), "list allocators incompatible for splice"); - } + if _CONSTEXPR_IF (!_Alnode_traits::is_always_equal::value) { + _STL_VERIFY(_Getal() == _Right._Getal(), "list allocators incompatible for splice"); + } #endif // _ITERATOR_DEBUG_LEVEL != 0 auto& _My_data = _Mypair._Myval2; @@ -1800,7 +1797,7 @@ private: #if _HAS_CXX17 template >, enable_if_t, _Is_allocator<_Alloc>>, int> = 0> -list(_Iter, _Iter, _Alloc = _Alloc())->list<_Iter_value_t<_Iter>, _Alloc>; +list(_Iter, _Iter, _Alloc = _Alloc()) -> list<_Iter_value_t<_Iter>, _Alloc>; #endif // _HAS_CXX17 template diff --git a/stl/inc/map b/stl/inc/map index 769e08ea609..60a14db3308 100644 --- a/stl/inc/map +++ b/stl/inc/map @@ -350,17 +350,17 @@ public: #if _HAS_CXX17 template >, class _Alloc = allocator<_Guide_pair_t<_Iter>>, enable_if_t, negation<_Is_allocator<_Pr>>, _Is_allocator<_Alloc>>, int> = 0> -map(_Iter, _Iter, _Pr = _Pr(), _Alloc = _Alloc())->map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Pr, _Alloc>; +map(_Iter, _Iter, _Pr = _Pr(), _Alloc = _Alloc()) -> map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Pr, _Alloc>; template , class _Alloc = allocator>, enable_if_t>, _Is_allocator<_Alloc>>, int> = 0> -map(initializer_list>, _Pr = _Pr(), _Alloc = _Alloc())->map<_Kty, _Ty, _Pr, _Alloc>; +map(initializer_list>, _Pr = _Pr(), _Alloc = _Alloc()) -> map<_Kty, _Ty, _Pr, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> -map(_Iter, _Iter, _Alloc)->map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, less<_Guide_key_t<_Iter>>, _Alloc>; +map(_Iter, _Iter, _Alloc) -> map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, less<_Guide_key_t<_Iter>>, _Alloc>; template ::value, int> = 0> -map(initializer_list>, _Alloc)->map<_Kty, _Ty, less<_Kty>, _Alloc>; +map(initializer_list>, _Alloc) -> map<_Kty, _Ty, less<_Kty>, _Alloc>; #endif // _HAS_CXX17 template @@ -504,17 +504,18 @@ public: #if _HAS_CXX17 template >, class _Alloc = allocator<_Guide_pair_t<_Iter>>, enable_if_t, negation<_Is_allocator<_Pr>>, _Is_allocator<_Alloc>>, int> = 0> -multimap(_Iter, _Iter, _Pr = _Pr(), _Alloc = _Alloc())->multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Pr, _Alloc>; +multimap(_Iter, _Iter, _Pr = _Pr(), _Alloc = _Alloc()) + -> multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Pr, _Alloc>; template , class _Alloc = allocator>, enable_if_t>, _Is_allocator<_Alloc>>, int> = 0> -multimap(initializer_list>, _Pr = _Pr(), _Alloc = _Alloc())->multimap<_Kty, _Ty, _Pr, _Alloc>; +multimap(initializer_list>, _Pr = _Pr(), _Alloc = _Alloc()) -> multimap<_Kty, _Ty, _Pr, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> -multimap(_Iter, _Iter, _Alloc)->multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, less<_Guide_key_t<_Iter>>, _Alloc>; +multimap(_Iter, _Iter, _Alloc) -> multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, less<_Guide_key_t<_Iter>>, _Alloc>; template ::value, int> = 0> -multimap(initializer_list>, _Alloc)->multimap<_Kty, _Ty, less<_Kty>, _Alloc>; +multimap(initializer_list>, _Alloc) -> multimap<_Kty, _Ty, less<_Kty>, _Alloc>; #endif // _HAS_CXX17 template diff --git a/stl/inc/memory b/stl/inc/memory index b1bc584fcd5..a651cb96c83 100644 --- a/stl/inc/memory +++ b/stl/inc/memory @@ -1300,10 +1300,10 @@ private: #if _HAS_CXX17 template -shared_ptr(weak_ptr<_Ty>)->shared_ptr<_Ty>; +shared_ptr(weak_ptr<_Ty>) -> shared_ptr<_Ty>; template -shared_ptr(unique_ptr<_Ty, _Dx>)->shared_ptr<_Ty>; +shared_ptr(unique_ptr<_Ty, _Dx>) -> shared_ptr<_Ty>; #endif // _HAS_CXX17 template @@ -1705,7 +1705,7 @@ public: #if _HAS_CXX17 template -weak_ptr(shared_ptr<_Ty>)->weak_ptr<_Ty>; +weak_ptr(shared_ptr<_Ty>) -> weak_ptr<_Ty>; #endif // _HAS_CXX17 template diff --git a/stl/inc/mutex b/stl/inc/mutex index 632ee65afff..4ad583fc954 100644 --- a/stl/inc/mutex +++ b/stl/inc/mutex @@ -297,8 +297,8 @@ bool _Try_lock_from_locks( // FUNCTION TEMPLATE _Unlock_locks template -void _Unlock_locks( - const int _First, const int _Last, index_sequence<_Indices...>, _LockN&... _LkN) noexcept /* terminates */ { +void _Unlock_locks(const int _First, const int _Last, index_sequence<_Indices...>, _LockN&... _LkN) noexcept +/* terminates */ { // unlock locks in _LkN[_First, _Last) int _Ignored[] = { ((_First <= static_cast(_Indices) && static_cast(_Indices) < _Last ? (void) _LkN.unlock() : void()), diff --git a/stl/inc/numeric b/stl/inc/numeric index 27b032b1f63..09c0e6c8d1d 100644 --- a/stl/inc/numeric +++ b/stl/inc/numeric @@ -116,8 +116,8 @@ _NODISCARD _Ty reduce(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, _T } template = 0> -_NODISCARD _Iter_value_t<_FwdIt> reduce( - _ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last) noexcept /* terminates */ { +_NODISCARD _Iter_value_t<_FwdIt> reduce(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last) noexcept +/* terminates */ { // return commutative and associative reduction of // iterator_traits<_FwdIt>::value_type{} and [_First, _Last) _REQUIRE_PARALLEL_ITERATOR(_FwdIt); @@ -283,8 +283,8 @@ _NODISCARD _Ty transform_reduce(_ExPo&& _Exec, const _FwdIt1 _First1, const _Fwd #endif // _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_NODISCARD _Ty transform_reduce( - _ExPo&& _Exec, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _Ty _Val) noexcept /* terminates */ { +_NODISCARD _Ty transform_reduce(_ExPo&& _Exec, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _Ty _Val) noexcept +/* terminates */ { // return commutative and associative transform-reduction of sequences _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_PARALLEL_ITERATOR(_FwdIt2); @@ -431,8 +431,8 @@ _DestTy* exclusive_scan(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last #endif // _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_FwdIt2 exclusive_scan( - _ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, const _FwdIt2 _Dest, _Ty _Val) noexcept /* terminates */ { +_FwdIt2 exclusive_scan(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, const _FwdIt2 _Dest, _Ty _Val) noexcept +/* terminates */ { // set each value in [_Dest, _Dest + (_Last - _First)) to the associative reduction of predecessors and _Val return _STD exclusive_scan(_STD forward<_ExPo>(_Exec), _First, _Last, _Dest, _STD move(_Val), plus<>{}); } @@ -561,16 +561,16 @@ _DestTy* inclusive_scan(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last #endif // _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_FwdIt2 inclusive_scan( - _ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, const _FwdIt2 _Dest) noexcept /* terminates */ { +_FwdIt2 inclusive_scan(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, const _FwdIt2 _Dest) noexcept +/* terminates */ { // compute partial noncommutative and associative reductions into _Dest return _STD inclusive_scan(_STD forward<_ExPo>(_Exec), _First, _Last, _Dest, plus<>()); } #if _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_DestTy* inclusive_scan( - _ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize]) noexcept /* terminates */ { +_DestTy* inclusive_scan(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, _DestTy (&_Dest)[_DestSize]) noexcept +/* terminates */ { // compute partial noncommutative and associative reductions into _Dest return _STD inclusive_scan(_STD forward<_ExPo>(_Exec), _First, _Last, _Dest, plus<>()); } @@ -803,8 +803,8 @@ _DestTy* adjacent_difference(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 #endif // _ITERATOR_DEBUG_ARRAY_OVERLOADS template = 0> -_FwdIt2 adjacent_difference( - _ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, const _FwdIt2 _Dest) noexcept /* terminates */ { +_FwdIt2 adjacent_difference(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, const _FwdIt2 _Dest) noexcept +/* terminates */ { // compute adjacent differences into _Dest return _STD adjacent_difference(_STD forward<_ExPo>(_Exec), _First, _Last, _Dest, minus<>()); } diff --git a/stl/inc/optional b/stl/inc/optional index bf4132e6557..08fd296f0ce 100644 --- a/stl/inc/optional +++ b/stl/inc/optional @@ -427,7 +427,7 @@ public: }; template -optional(_Ty)->optional<_Ty>; +optional(_Ty) -> optional<_Ty>; // RELATIONAL OPERATORS [optional.relops] template diff --git a/stl/inc/queue b/stl/inc/queue index af61b562e79..8954046397d 100644 --- a/stl/inc/queue +++ b/stl/inc/queue @@ -156,13 +156,13 @@ protected: #if _HAS_CXX17 template ::value, int> = 0> -queue(_Container)->queue; +queue(_Container) -> queue; template >, _Is_allocator<_Alloc>, uses_allocator<_Container, _Alloc>>, int> = 0> -queue(_Container, _Alloc)->queue; +queue(_Container, _Alloc) -> queue; #endif // _HAS_CXX17 template ::value, int> = 0> @@ -298,19 +298,19 @@ protected: #if _HAS_CXX17 template >, negation<_Is_allocator<_Container>>>, int> = 0> -priority_queue(_Pr, _Container)->priority_queue; +priority_queue(_Pr, _Container) -> priority_queue; template >, class _Container = vector<_Iter_value_t<_Iter>>, enable_if_t, negation<_Is_allocator<_Pr>>, negation<_Is_allocator<_Container>>>, int> = 0> priority_queue(_Iter, _Iter, _Pr = _Pr(), _Container = _Container()) - ->priority_queue<_Iter_value_t<_Iter>, _Container, _Pr>; + -> priority_queue<_Iter_value_t<_Iter>, _Container, _Pr>; template >, negation<_Is_allocator<_Container>>, _Is_allocator<_Alloc>, uses_allocator<_Container, _Alloc>>, int> = 0> -priority_queue(_Pr, _Container, _Alloc)->priority_queue; +priority_queue(_Pr, _Container, _Alloc) -> priority_queue; #endif // _HAS_CXX17 template ::max() // && (_Mx - 1) <= (numeric_limits::max() - _Cx) / _Ax - if - _CONSTEXPR_IF(_Ax == 0) { // degenerate case; avoid divide by 0 - (void) _Prev; - return static_cast<_Uint>(_Cx); // relies on _Mx == 0 || _Cx <= _Mx, N4741 [rand.eng.lcong]/3 - } - else if - _CONSTEXPR_IF( - _Mx == 0) { // N4762 [rand.eng.lcong]/2: "If the template parameter m is 0, the modulus m used throughout - // this subclause [rand.eng.lcong] is numeric_limits::max() plus 1." - // That is: Just do the multiply and let normal unsigned modulo take care of it - return static_cast<_Uint>(static_cast<_Uint>(_Ax * _Prev) + _Cx); - } - else if - _CONSTEXPR_IF( - _Cx <= UINT_MAX - && static_cast<_Uint>(_Mx - 1) - <= (UINT_MAX - _Cx) / _Ax) { // unsigned int is sufficient to store intermediate calculation - const auto _Mul = - static_cast(_Prev) * static_cast(_Ax) + static_cast(_Cx); - return static_cast<_Uint>(_Mul % _Mx); - } - else if - _CONSTEXPR_IF( - _Cx <= ULLONG_MAX - && static_cast<_Uint>(_Mx - 1) - <= (ULLONG_MAX - _Cx) / _Ax) { // unsigned long long is sufficient to store intermediate calculation - const auto _Mul = static_cast(_Prev) * _Ax + _Cx; - return static_cast<_Uint>(_Mul % _Mx); - } - else { // no intermediate integral type fits; fall back to multiprecision + if _CONSTEXPR_IF (_Ax == 0) { // degenerate case; avoid divide by 0 + (void) _Prev; + return static_cast<_Uint>(_Cx); // relies on _Mx == 0 || _Cx <= _Mx, N4741 [rand.eng.lcong]/3 + } else if _CONSTEXPR_IF (_Mx == 0) { + // N4762 [rand.eng.lcong]/2: "If the template parameter m is 0, the modulus m + // used throughout this subclause [rand.eng.lcong] is + // numeric_limits::max() plus 1." That is: Just do the multiply + // and let normal unsigned modulo take care of it + return static_cast<_Uint>(static_cast<_Uint>(_Ax * _Prev) + _Cx); + } else if _CONSTEXPR_IF (_Cx <= UINT_MAX && static_cast<_Uint>(_Mx - 1) <= (UINT_MAX - _Cx) / _Ax) { + // unsigned int is sufficient to store intermediate calculation + const auto _Mul = + static_cast(_Prev) * static_cast(_Ax) + static_cast(_Cx); + return static_cast<_Uint>(_Mul % _Mx); + } else if _CONSTEXPR_IF (_Cx <= ULLONG_MAX && static_cast<_Uint>(_Mx - 1) <= (ULLONG_MAX - _Cx) / _Ax) { + // unsigned long long is sufficient to store intermediate calculation + const auto _Mul = static_cast(_Prev) * _Ax + _Cx; + return static_cast<_Uint>(_Mul % _Mx); + } else { // no intermediate integral type fits; fall back to multiprecision _MP_arr _Wx; _MP_Mul(_Wx, _Prev, _Ax); _MP_Add(_Wx, _Cx); @@ -377,17 +366,15 @@ _NODISCARD constexpr unsigned long long _Seed_seq_to_ull(_Seed_seq& _Seq) { template _NODISCARD constexpr _Uint _Get_linear_congruential_seed(_Uint _Sx) noexcept { // N4741 [rand.eng.lcong]/5 - if - _CONSTEXPR_IF(_Mx != 0) { - _Sx %= _Mx; - } + if _CONSTEXPR_IF (_Mx != 0) { + _Sx %= _Mx; + } - if - _CONSTEXPR_IF(_Cx == 0) { - if (_Sx == 0) { - _Sx = _Uint{1}; - } + if _CONSTEXPR_IF (_Cx == 0) { + if (_Sx == 0) { + _Sx = _Uint{1}; } + } return _Sx; } @@ -395,21 +382,15 @@ _NODISCARD constexpr _Uint _Get_linear_congruential_seed(_Uint _Sx) noexcept { / template _NODISCARD _Uint _Get_linear_congruential_seed_from_seq(_Seed_seq& _Seq) { // N4741 [rand.eng.lcong]/6 _Uint _Sx; - if - _CONSTEXPR_IF(_Mx == 0) { - if - _CONSTEXPR_IF(sizeof(_Uint) <= sizeof(unsigned int)) { - _Sx = static_cast<_Uint>(_Seed_seq_to_uint(_Seq)); - } - else { - _Sx = static_cast<_Uint>(_Seed_seq_to_ull(_Seq)); - } - } - else if - _CONSTEXPR_IF(_Mx <= UINT_MAX) { - _Sx = static_cast<_Uint>(_Seed_seq_to_uint(_Seq) % _Mx); + if _CONSTEXPR_IF (_Mx == 0) { + if _CONSTEXPR_IF (sizeof(_Uint) <= sizeof(unsigned int)) { + _Sx = static_cast<_Uint>(_Seed_seq_to_uint(_Seq)); + } else { + _Sx = static_cast<_Uint>(_Seed_seq_to_ull(_Seq)); } - else { + } else if _CONSTEXPR_IF (_Mx <= UINT_MAX) { + _Sx = static_cast<_Uint>(_Seed_seq_to_uint(_Seq) % _Mx); + } else { _Sx = static_cast<_Uint>(_Seed_seq_to_ull(_Seq) % _Mx); } @@ -485,16 +466,16 @@ public: #ifndef __CUDACC__ // TRANSITION, VSO-568006 _NODISCARD #endif // TRANSITION, VSO-568006 - friend bool operator==( - const linear_congruential_engine& _Lhs, const linear_congruential_engine& _Rhs) noexcept /* strengthened */ { + friend bool operator==(const linear_congruential_engine& _Lhs, const linear_congruential_engine& _Rhs) noexcept + /* strengthened */ { return _Lhs._Prev == _Rhs._Prev; } #ifndef __CUDACC__ // TRANSITION, VSO-568006 _NODISCARD #endif // TRANSITION, VSO-568006 - friend bool operator!=( - const linear_congruential_engine& _Lhs, const linear_congruential_engine& _Rhs) noexcept /* strengthened */ { + friend bool operator!=(const linear_congruential_engine& _Lhs, const linear_congruential_engine& _Rhs) noexcept + /* strengthened */ { return _Lhs._Prev != _Rhs._Prev; } @@ -579,16 +560,16 @@ public: #ifndef __CUDACC__ // TRANSITION, VSO-568006 _NODISCARD #endif // TRANSITION, VSO-568006 - friend bool operator==( - const linear_congruential& _Lhs, const linear_congruential& _Rhs) noexcept /* strengthened */ { + friend bool operator==(const linear_congruential& _Lhs, const linear_congruential& _Rhs) noexcept + /* strengthened */ { return _Lhs._Prev == _Rhs._Prev; } #ifndef __CUDACC__ // TRANSITION, VSO-568006 _NODISCARD #endif // TRANSITION, VSO-568006 - friend bool operator!=( - const linear_congruential& _Lhs, const linear_congruential& _Rhs) noexcept /* strengthened */ { + friend bool operator!=(const linear_congruential& _Lhs, const linear_congruential& _Rhs) noexcept + /* strengthened */ { return _Lhs._Prev != _Rhs._Prev; } @@ -828,11 +809,9 @@ struct _Swc_traits { // traits for subtract_with_carry generator static int _Get_wc() { // compute number of 32-bit words per element int _Kx; - if - _CONSTEXPR_IF(_Mx == 0) { - _Kx = (8 * sizeof(_Ty) + 31) / 32; - } - else { // compute number of 32-bit words required + if _CONSTEXPR_IF (_Mx == 0) { + _Kx = (8 * sizeof(_Ty) + 31) / 32; + } else { // compute number of 32-bit words required unsigned long long _Val = 1ULL << 32; for (_Kx = 1; 0 < _Val && _Val < _Mx; ++_Kx) { _Val = _Val << 32; @@ -866,12 +845,11 @@ struct _Swc_traits { // traits for subtract_with_carry generator #pragma warning(push) #pragma warning(disable : 4724) // potential mod by 0 static _Cy_t _Reduce(_Ty* _Ax) { // reduce values to allowed range - if - _CONSTEXPR_IF(_Mx != 0) { - for (int _Ix = 0; _Ix < _Nw; ++_Ix) { - _Ax[_Ix] = _Ax[_Ix] % _Mx; - } + if _CONSTEXPR_IF (_Mx != 0) { + for (int _Ix = 0; _Ix < _Nw; ++_Ix) { + _Ax[_Ix] = _Ax[_Ix] % _Mx; } + } return _Ax[_Nw - 1] == 0; } @@ -961,10 +939,9 @@ public: } constexpr bool _Mod_non_zero = _Traits::_Mod != 0; - if - _CONSTEXPR_IF(_Mod_non_zero) { - this->_Ax[_Ix] %= _Traits::_Mod; - } + if _CONSTEXPR_IF (_Mod_non_zero) { + this->_Ax[_Ix] %= _Traits::_Mod; + } } this->_Carry = _Traits::_Reduce(this->_Ax); diff --git a/stl/inc/regex b/stl/inc/regex index a751e058599..b591168bd88 100644 --- a/stl/inc/regex +++ b/stl/inc/regex @@ -2043,7 +2043,7 @@ private: #if _HAS_CXX17 template basic_regex(_FwdIt, _FwdIt, regex_constants::syntax_option_type = regex_constants::ECMAScript) - ->basic_regex::value_type>; + -> basic_regex::value_type>; #endif // _HAS_CXX17 template diff --git a/stl/inc/scoped_allocator b/stl/inc/scoped_allocator index 8d3b8e323ba..f4c667c26ed 100644 --- a/stl/inc/scoped_allocator +++ b/stl/inc/scoped_allocator @@ -250,7 +250,7 @@ public: #if _HAS_CXX17 template -scoped_allocator_adaptor(_Outer, _Inner...)->scoped_allocator_adaptor<_Outer, _Inner...>; +scoped_allocator_adaptor(_Outer, _Inner...) -> scoped_allocator_adaptor<_Outer, _Inner...>; #endif // _HAS_CXX17 template diff --git a/stl/inc/set b/stl/inc/set index 8f440acad1a..1817da70218 100644 --- a/stl/inc/set +++ b/stl/inc/set @@ -161,17 +161,17 @@ public: #if _HAS_CXX17 template >, class _Alloc = allocator<_Iter_value_t<_Iter>>, enable_if_t, negation<_Is_allocator<_Pr>>, _Is_allocator<_Alloc>>, int> = 0> -set(_Iter, _Iter, _Pr = _Pr(), _Alloc = _Alloc())->set<_Iter_value_t<_Iter>, _Pr, _Alloc>; +set(_Iter, _Iter, _Pr = _Pr(), _Alloc = _Alloc()) -> set<_Iter_value_t<_Iter>, _Pr, _Alloc>; template , class _Alloc = allocator<_Kty>, enable_if_t>, _Is_allocator<_Alloc>>, int> = 0> -set(initializer_list<_Kty>, _Pr = _Pr(), _Alloc = _Alloc())->set<_Kty, _Pr, _Alloc>; +set(initializer_list<_Kty>, _Pr = _Pr(), _Alloc = _Alloc()) -> set<_Kty, _Pr, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> -set(_Iter, _Iter, _Alloc)->set<_Iter_value_t<_Iter>, less<_Iter_value_t<_Iter>>, _Alloc>; +set(_Iter, _Iter, _Alloc) -> set<_Iter_value_t<_Iter>, less<_Iter_value_t<_Iter>>, _Alloc>; template ::value, int> = 0> -set(initializer_list<_Kty>, _Alloc)->set<_Kty, less<_Kty>, _Alloc>; +set(initializer_list<_Kty>, _Alloc) -> set<_Kty, less<_Kty>, _Alloc>; #endif // _HAS_CXX17 template @@ -301,17 +301,17 @@ public: #if _HAS_CXX17 template >, class _Alloc = allocator<_Iter_value_t<_Iter>>, enable_if_t, negation<_Is_allocator<_Pr>>, _Is_allocator<_Alloc>>, int> = 0> -multiset(_Iter, _Iter, _Pr = _Pr(), _Alloc = _Alloc())->multiset<_Iter_value_t<_Iter>, _Pr, _Alloc>; +multiset(_Iter, _Iter, _Pr = _Pr(), _Alloc = _Alloc()) -> multiset<_Iter_value_t<_Iter>, _Pr, _Alloc>; template , class _Alloc = allocator<_Kty>, enable_if_t>, _Is_allocator<_Alloc>>, int> = 0> -multiset(initializer_list<_Kty>, _Pr = _Pr(), _Alloc = _Alloc())->multiset<_Kty, _Pr, _Alloc>; +multiset(initializer_list<_Kty>, _Pr = _Pr(), _Alloc = _Alloc()) -> multiset<_Kty, _Pr, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> -multiset(_Iter, _Iter, _Alloc)->multiset<_Iter_value_t<_Iter>, less<_Iter_value_t<_Iter>>, _Alloc>; +multiset(_Iter, _Iter, _Alloc) -> multiset<_Iter_value_t<_Iter>, less<_Iter_value_t<_Iter>>, _Alloc>; template ::value, int> = 0> -multiset(initializer_list<_Kty>, _Alloc)->multiset<_Kty, less<_Kty>, _Alloc>; +multiset(initializer_list<_Kty>, _Alloc) -> multiset<_Kty, less<_Kty>, _Alloc>; #endif // _HAS_CXX17 template diff --git a/stl/inc/span b/stl/inc/span index f5310e15d96..ae61ffef161 100644 --- a/stl/inc/span +++ b/stl/inc/span @@ -575,8 +575,8 @@ public: return _ReturnType{_Mydata + _Offset, _Count == dynamic_extent ? this->size() - _Offset : _Count}; } - _NODISCARD constexpr auto subspan(const size_type _Offset, const size_type _Count = dynamic_extent) const - noexcept /* strengthened */ { + _NODISCARD constexpr auto subspan(const size_type _Offset, const size_type _Count = dynamic_extent) const noexcept + /* strengthened */ { #if _CONTAINER_DEBUG_LEVEL > 0 _STL_VERIFY(_Offset <= this->size(), "Offset out of range in span::subspan(offset, count)"); _STL_VERIFY(_Count == dynamic_extent || _Count <= this->size() - _Offset, @@ -667,29 +667,29 @@ private: // DEDUCTION GUIDES template -span(_Ty (&)[_Extent])->span<_Ty, _Extent>; +span(_Ty (&)[_Extent]) -> span<_Ty, _Extent>; template -span(array<_Ty, _Size>&)->span<_Ty, _Size>; +span(array<_Ty, _Size>&) -> span<_Ty, _Size>; template -span(const array<_Ty, _Size>&)->span; +span(const array<_Ty, _Size>&) -> span; #ifdef __cpp_lib_concepts template -span(_It, _End)->span>>; +span(_It, _End) -> span>>; template <_RANGES contiguous_range _Rng> -span(_Rng &&)->span>>; +span(_Rng &&) -> span>>; #else // ^^^ __cpp_lib_concepts / !__cpp_lib_concepts vvv template -span(_Rng&)->span; +span(_Rng&) -> span; template -span(const _Rng&)->span; +span(const _Rng&) -> span; #endif // !__cpp_lib_concepts diff --git a/stl/inc/stack b/stl/inc/stack index 3cbc26f2c26..55889064e87 100644 --- a/stl/inc/stack +++ b/stl/inc/stack @@ -146,13 +146,13 @@ protected: #if _HAS_CXX17 template ::value, int> = 0> -stack(_Container)->stack; +stack(_Container) -> stack; template >, _Is_allocator<_Alloc>, uses_allocator<_Container, _Alloc>>, int> = 0> -stack(_Container, _Alloc)->stack; +stack(_Container, _Alloc) -> stack; #endif // _HAS_CXX17 template ::value, int> = 0> diff --git a/stl/inc/string b/stl/inc/string index d842a6940cb..6fb8a2a6731 100644 --- a/stl/inc/string +++ b/stl/inc/string @@ -459,18 +459,17 @@ _Elem* _UIntegral_to_buff(_Elem* _RNext, _UTy _UVal) { // format _UVal into buff #else // ^^^ _WIN64 ^^^ // vvv !_WIN64 vvv constexpr bool _Big_uty = sizeof(_UTy) > 4; - if - _CONSTEXPR_IF(_Big_uty) { // For 64-bit numbers, work in chunks to avoid 64-bit divisions. - while (_UVal > 0xFFFFFFFFU) { - auto _UVal_chunk = static_cast(_UVal % 1000000000); - _UVal /= 1000000000; - - for (int _Idx = 0; _Idx != 9; ++_Idx) { - *--_RNext = static_cast<_Elem>('0' + _UVal_chunk % 10); - _UVal_chunk /= 10; - } + if _CONSTEXPR_IF (_Big_uty) { // For 64-bit numbers, work in chunks to avoid 64-bit divisions. + while (_UVal > 0xFFFFFFFFU) { + auto _UVal_chunk = static_cast(_UVal % 1000000000); + _UVal /= 1000000000; + + for (int _Idx = 0; _Idx != 9; ++_Idx) { + *--_RNext = static_cast<_Elem>('0' + _UVal_chunk % 10); + _UVal_chunk /= 10; } } + } auto _UVal_trunc = static_cast(_UVal); #endif // _WIN64 diff --git a/stl/inc/system_error b/stl/inc/system_error index 3f5b4cc48f4..a3bcc78a6f1 100644 --- a/stl/inc/system_error +++ b/stl/inc/system_error @@ -325,8 +325,8 @@ _NODISCARD inline bool operator<(const error_condition& _Left, const error_condi #endif // _STL_OPTIMIZE_SYSTEM_ERROR_OPERATORS // VIRTUALS FOR error_category -_NODISCARD inline error_condition error_category::default_error_condition(int _Errval) const - noexcept { // make error_condition for error code +_NODISCARD inline error_condition error_category::default_error_condition(int _Errval) const noexcept { + // make error_condition for error code return error_condition(_Errval, *this); } @@ -339,8 +339,8 @@ _NODISCARD inline bool error_category::equivalent(const error_code& _Code, int _ } // MEMBER FUNCTIONS for error_code -_NODISCARD inline error_condition error_code::default_error_condition() const - noexcept { // make error_condition for error code +_NODISCARD inline error_condition error_code::default_error_condition() const noexcept { + // make error_condition for error code return category().default_error_condition(value()); } diff --git a/stl/inc/tuple b/stl/inc/tuple index 52f4c1223f6..e907f02ffd3 100644 --- a/stl/inc/tuple +++ b/stl/inc/tuple @@ -695,19 +695,19 @@ public: #if _HAS_CXX17 template -tuple(_Types...)->tuple<_Types...>; +tuple(_Types...) -> tuple<_Types...>; template -tuple(pair<_Ty1, _Ty2>)->tuple<_Ty1, _Ty2>; +tuple(pair<_Ty1, _Ty2>) -> tuple<_Ty1, _Ty2>; template -tuple(allocator_arg_t, _Alloc, _Types...)->tuple<_Types...>; +tuple(allocator_arg_t, _Alloc, _Types...) -> tuple<_Types...>; template -tuple(allocator_arg_t, _Alloc, pair<_Ty1, _Ty2>)->tuple<_Ty1, _Ty2>; +tuple(allocator_arg_t, _Alloc, pair<_Ty1, _Ty2>) -> tuple<_Ty1, _Ty2>; template -tuple(allocator_arg_t, _Alloc, tuple<_Types...>)->tuple<_Types...>; +tuple(allocator_arg_t, _Alloc, tuple<_Types...>) -> tuple<_Types...>; #endif // _HAS_CXX17 // OPERATORS FOR tuple diff --git a/stl/inc/type_traits b/stl/inc/type_traits index 252671ccaed..89c69fb0526 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -1936,7 +1936,7 @@ public: #if _HAS_CXX17 template -reference_wrapper(_Ty&)->reference_wrapper<_Ty>; +reference_wrapper(_Ty&) -> reference_wrapper<_Ty>; #endif // _HAS_CXX17 // FUNCTION TEMPLATES ref AND cref @@ -2030,8 +2030,8 @@ struct _Is_swappable : _Is_swappable_with, add_lvalu // STRUCT TEMPLATE _Swap_cannot_throw template -struct _Swap_cannot_throw : bool_constant(), _STD declval<_Ty2>())) - && noexcept(swap(_STD declval<_Ty2>(), _STD declval<_Ty1>()))> { +struct _Swap_cannot_throw : bool_constant(), _STD declval<_Ty2>())) // + && noexcept(swap(_STD declval<_Ty2>(), _STD declval<_Ty1>()))> { // Determine if expressions with type and value category _Ty1 and _Ty2 // (presumed to satisfy is_swappable_with) can be swapped without emitting exceptions }; diff --git a/stl/inc/unordered_map b/stl/inc/unordered_map index 335a5d376f2..90be90802e1 100644 --- a/stl/inc/unordered_map +++ b/stl/inc/unordered_map @@ -413,41 +413,39 @@ template >, class _Keyeq = conjunction_v<_Is_iterator<_Iter>, _Is_hasher<_Hasher>, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> unordered_map(_Iter, _Iter, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), _Alloc = _Alloc()) - ->unordered_map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, _Keyeq, _Alloc>; + -> unordered_map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, _Keyeq, _Alloc>; template , class _Keyeq = equal_to<_Kty>, class _Alloc = allocator>, enable_if_t, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> unordered_map(initializer_list>, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), - _Alloc = _Alloc()) - ->unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>; + _Alloc = _Alloc()) -> unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> -unordered_map(_Iter, _Iter, _Alloc) - ->unordered_map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, hash<_Guide_key_t<_Iter>>, equal_to<_Guide_key_t<_Iter>>, - _Alloc>; +unordered_map(_Iter, _Iter, _Alloc) -> unordered_map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, + hash<_Guide_key_t<_Iter>>, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> -unordered_map(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Alloc) - ->unordered_map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, hash<_Guide_key_t<_Iter>>, equal_to<_Guide_key_t<_Iter>>, - _Alloc>; +unordered_map(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Alloc) -> unordered_map<_Guide_key_t<_Iter>, + _Guide_val_t<_Iter>, hash<_Guide_key_t<_Iter>>, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template , _Is_hasher<_Hasher>, _Is_allocator<_Alloc>>, int> = 0> unordered_map(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) - ->unordered_map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, equal_to<_Guide_key_t<_Iter>>, _Alloc>; + -> unordered_map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template ::value, int> = 0> -unordered_map(initializer_list>, _Alloc)->unordered_map<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; +unordered_map(initializer_list>, _Alloc) + -> unordered_map<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; template ::value, int> = 0> unordered_map(initializer_list>, _Guide_size_type_t<_Alloc>, _Alloc) - ->unordered_map<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; + -> unordered_map<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> unordered_map(initializer_list>, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) - ->unordered_map<_Kty, _Ty, _Hasher, equal_to<_Kty>, _Alloc>; + -> unordered_map<_Kty, _Ty, _Hasher, equal_to<_Kty>, _Alloc>; #endif // _HAS_CXX17 template @@ -706,44 +704,40 @@ template >, class _Keyeq = enable_if_t< conjunction_v<_Is_iterator<_Iter>, _Is_hasher<_Hasher>, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> -unordered_multimap( - _Iter, _Iter, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), _Alloc = _Alloc()) - ->unordered_multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, _Keyeq, _Alloc>; +unordered_multimap(_Iter, _Iter, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), + _Alloc = _Alloc()) -> unordered_multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, _Keyeq, _Alloc>; template , class _Keyeq = equal_to<_Kty>, class _Alloc = allocator>, enable_if_t, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> unordered_multimap(initializer_list>, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), - _Keyeq = _Keyeq(), _Alloc = _Alloc()) - ->unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>; + _Keyeq = _Keyeq(), _Alloc = _Alloc()) -> unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> -unordered_multimap(_Iter, _Iter, _Alloc) - ->unordered_multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, hash<_Guide_key_t<_Iter>>, - equal_to<_Guide_key_t<_Iter>>, _Alloc>; +unordered_multimap(_Iter, _Iter, _Alloc) -> unordered_multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, + hash<_Guide_key_t<_Iter>>, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> -unordered_multimap(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Alloc) - ->unordered_multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, hash<_Guide_key_t<_Iter>>, - equal_to<_Guide_key_t<_Iter>>, _Alloc>; +unordered_multimap(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Alloc) -> unordered_multimap<_Guide_key_t<_Iter>, + _Guide_val_t<_Iter>, hash<_Guide_key_t<_Iter>>, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template , _Is_hasher<_Hasher>, _Is_allocator<_Alloc>>, int> = 0> unordered_multimap(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) - ->unordered_multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, equal_to<_Guide_key_t<_Iter>>, _Alloc>; + -> unordered_multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template ::value, int> = 0> unordered_multimap(initializer_list>, _Alloc) - ->unordered_multimap<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; + -> unordered_multimap<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; template ::value, int> = 0> unordered_multimap(initializer_list>, _Guide_size_type_t<_Alloc>, _Alloc) - ->unordered_multimap<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; + -> unordered_multimap<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> unordered_multimap(initializer_list>, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) - ->unordered_multimap<_Kty, _Ty, _Hasher, equal_to<_Kty>, _Alloc>; + -> unordered_multimap<_Kty, _Ty, _Hasher, equal_to<_Kty>, _Alloc>; #endif // _HAS_CXX17 template diff --git a/stl/inc/unordered_set b/stl/inc/unordered_set index 5bcf6ce04f3..1f32080e230 100644 --- a/stl/inc/unordered_set +++ b/stl/inc/unordered_set @@ -276,31 +276,30 @@ template >, class _Keyeq conjunction_v<_Is_iterator<_Iter>, _Is_hasher<_Hasher>, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> unordered_set(_Iter, _Iter, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), _Alloc = _Alloc()) - ->unordered_set<_Iter_value_t<_Iter>, _Hasher, _Keyeq, _Alloc>; + -> unordered_set<_Iter_value_t<_Iter>, _Hasher, _Keyeq, _Alloc>; template , class _Keyeq = equal_to<_Kty>, class _Alloc = allocator<_Kty>, enable_if_t, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> -unordered_set( - initializer_list<_Kty>, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), _Alloc = _Alloc()) - ->unordered_set<_Kty, _Hasher, _Keyeq, _Alloc>; +unordered_set(initializer_list<_Kty>, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), + _Alloc = _Alloc()) -> unordered_set<_Kty, _Hasher, _Keyeq, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> unordered_set(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Alloc) - ->unordered_set<_Iter_value_t<_Iter>, hash<_Iter_value_t<_Iter>>, equal_to<_Iter_value_t<_Iter>>, _Alloc>; + -> unordered_set<_Iter_value_t<_Iter>, hash<_Iter_value_t<_Iter>>, equal_to<_Iter_value_t<_Iter>>, _Alloc>; template , _Is_hasher<_Hasher>, _Is_allocator<_Alloc>>, int> = 0> unordered_set(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) - ->unordered_set<_Iter_value_t<_Iter>, _Hasher, equal_to<_Iter_value_t<_Iter>>, _Alloc>; + -> unordered_set<_Iter_value_t<_Iter>, _Hasher, equal_to<_Iter_value_t<_Iter>>, _Alloc>; template ::value, int> = 0> unordered_set(initializer_list<_Kty>, _Guide_size_type_t<_Alloc>, _Alloc) - ->unordered_set<_Kty, hash<_Kty>, equal_to<_Kty>, _Alloc>; + -> unordered_set<_Kty, hash<_Kty>, equal_to<_Kty>, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> unordered_set(initializer_list<_Kty>, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) - ->unordered_set<_Kty, _Hasher, equal_to<_Kty>, _Alloc>; + -> unordered_set<_Kty, _Hasher, equal_to<_Kty>, _Alloc>; #endif // _HAS_CXX17 template @@ -538,33 +537,31 @@ template >, class _Keyeq enable_if_t< conjunction_v<_Is_iterator<_Iter>, _Is_hasher<_Hasher>, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> -unordered_multiset( - _Iter, _Iter, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), _Alloc = _Alloc()) - ->unordered_multiset<_Iter_value_t<_Iter>, _Hasher, _Keyeq, _Alloc>; +unordered_multiset(_Iter, _Iter, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), + _Alloc = _Alloc()) -> unordered_multiset<_Iter_value_t<_Iter>, _Hasher, _Keyeq, _Alloc>; template , class _Keyeq = equal_to<_Kty>, class _Alloc = allocator<_Kty>, enable_if_t, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> -unordered_multiset( - initializer_list<_Kty>, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), _Alloc = _Alloc()) - ->unordered_multiset<_Kty, _Hasher, _Keyeq, _Alloc>; +unordered_multiset(initializer_list<_Kty>, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), + _Alloc = _Alloc()) -> unordered_multiset<_Kty, _Hasher, _Keyeq, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> unordered_multiset(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Alloc) - ->unordered_multiset<_Iter_value_t<_Iter>, hash<_Iter_value_t<_Iter>>, equal_to<_Iter_value_t<_Iter>>, _Alloc>; + -> unordered_multiset<_Iter_value_t<_Iter>, hash<_Iter_value_t<_Iter>>, equal_to<_Iter_value_t<_Iter>>, _Alloc>; template , _Is_hasher<_Hasher>, _Is_allocator<_Alloc>>, int> = 0> unordered_multiset(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) - ->unordered_multiset<_Iter_value_t<_Iter>, _Hasher, equal_to<_Iter_value_t<_Iter>>, _Alloc>; + -> unordered_multiset<_Iter_value_t<_Iter>, _Hasher, equal_to<_Iter_value_t<_Iter>>, _Alloc>; template ::value, int> = 0> unordered_multiset(initializer_list<_Kty>, _Guide_size_type_t<_Alloc>, _Alloc) - ->unordered_multiset<_Kty, hash<_Kty>, equal_to<_Kty>, _Alloc>; + -> unordered_multiset<_Kty, hash<_Kty>, equal_to<_Kty>, _Alloc>; template , _Is_allocator<_Alloc>>, int> = 0> unordered_multiset(initializer_list<_Kty>, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) - ->unordered_multiset<_Kty, _Hasher, equal_to<_Kty>, _Alloc>; + -> unordered_multiset<_Kty, _Hasher, equal_to<_Kty>, _Alloc>; #endif // _HAS_CXX17 template diff --git a/stl/inc/utility b/stl/inc/utility index 392eff7bfc1..69db55c5f6b 100644 --- a/stl/inc/utility +++ b/stl/inc/utility @@ -333,7 +333,7 @@ struct pair { // store a pair of values #if _HAS_CXX17 template -pair(_Ty1, _Ty2)->pair<_Ty1, _Ty2>; +pair(_Ty1, _Ty2) -> pair<_Ty1, _Ty2>; #endif // _HAS_CXX17 template ::value && _Is_swappable<_Ty2>::value, int> = 0> diff --git a/stl/inc/valarray b/stl/inc/valarray index 91deaa5f672..5a7b5b1f5b0 100644 --- a/stl/inc/valarray +++ b/stl/inc/valarray @@ -45,11 +45,9 @@ _Ty* _Allocate_for_op_delete(size_t _Count) { const size_t _Bytes = _Get_size_of_n(_Count); #ifdef __cpp_aligned_new constexpr bool _Extended_alignment = alignof(_Ty) > __STDCPP_DEFAULT_NEW_ALIGNMENT__; - if - _CONSTEXPR_IF(_Extended_alignment) { - return static_cast<_Ty*>(::operator new (_Bytes, align_val_t{alignof(_Ty)})); - } - else + if _CONSTEXPR_IF (_Extended_alignment) { + return static_cast<_Ty*>(::operator new (_Bytes, align_val_t{alignof(_Ty)})); + } else #endif // __cpp_aligned_new { return static_cast<_Ty*>(::operator new(_Bytes)); @@ -448,7 +446,7 @@ private: #if _HAS_CXX17 template -valarray(const _Ty (&)[_Nx], size_t)->valarray<_Ty>; +valarray(const _Ty (&)[_Nx], size_t) -> valarray<_Ty>; #endif // _HAS_CXX17 template diff --git a/stl/inc/variant b/stl/inc/variant index 2c051677a0e..a11c1f3a604 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -876,18 +876,20 @@ public: _NODISCARD constexpr bool valueless_by_exception() const noexcept { // does this variant NOT hold a value? return _Which < 0; } - _NODISCARD constexpr size_t index() const - noexcept { // index of the contained alternative or variant_npos if valueless_by_exception + _NODISCARD constexpr size_t index() const noexcept { + // index of the contained alternative or variant_npos if valueless_by_exception return static_cast(_Which); } - void _Set_index(const size_t _Idx) noexcept { // record _Idx as the active alternative - // pre: the active alternative of *this is _Idx + void _Set_index(const size_t _Idx) noexcept { + // record _Idx as the active alternative + // pre: the active alternative of *this is _Idx _Which = static_cast<_Index_t>(_Idx); } template - void _Destroy() noexcept { // destroy the contained value - // pre: _Idx == index() + void _Destroy() noexcept { + // destroy the contained value + // pre: _Idx == index() if constexpr (_Idx != variant_npos && !is_trivially_destructible_v<_Meta_at_c, _Idx>>) { _Destroy_in_place(_Variant_raw_get<_Idx>(_Storage())); } @@ -910,8 +912,9 @@ public: } template - void _Reset() noexcept { // transition to the valueless_by_exception state - // pre: _Idx == index() + void _Reset() noexcept { + // transition to the valueless_by_exception state + // pre: _Idx == index() if constexpr (_Idx != variant_npos) { _Destroy<_Idx>(); _Set_index(variant_npos); @@ -985,8 +988,9 @@ struct _Variant_init_helper { // failure case (has no member "type") template struct _Variant_init_helper{}(_STD declval<_Ty>()))>, _Ty, - _Types...> { // perform overload resolution to determine the unique alternative that should be initialized in - // variant<_Types...> from an argument expression with type and value category _Ty + _Types...> { + // perform overload resolution to determine the unique alternative that should be initialized in + // variant<_Types...> from an argument expression with type and value category _Ty using type = decltype(_Variant_init_overload_set<_Types...>{}(_STD declval<_Ty>())); }; diff --git a/stl/inc/vector b/stl/inc/vector index 29891a15351..8b6f54bca9a 100644 --- a/stl/inc/vector +++ b/stl/inc/vector @@ -558,22 +558,21 @@ private: } void _Move_construct(vector& _Right, false_type) { // move from _Right, possibly moving its contents - if - _CONSTEXPR_IF(!_Alty_traits::is_always_equal::value) { - if (_Getal() != _Right._Getal()) { - const auto& _Right_data = _Right._Mypair._Myval2; - const pointer _Rightfirst = _Right_data._Myfirst; - const pointer _Rightlast = _Right_data._Mylast; - if (_Rightfirst != _Rightlast) { - _Buy_raw(static_cast(_Rightlast - _Rightfirst)); - _Tidy_guard _Guard{this}; - auto& _My_data = _Mypair._Myval2; - _My_data._Mylast = _Umove(_Rightfirst, _Rightlast, _My_data._Myfirst); - _Guard._Target = nullptr; - } - return; + if _CONSTEXPR_IF (!_Alty_traits::is_always_equal::value) { + if (_Getal() != _Right._Getal()) { + const auto& _Right_data = _Right._Mypair._Myval2; + const pointer _Rightfirst = _Right_data._Myfirst; + const pointer _Rightlast = _Right_data._Mylast; + if (_Rightfirst != _Rightlast) { + _Buy_raw(static_cast(_Rightlast - _Rightfirst)); + _Tidy_guard _Guard{this}; + auto& _My_data = _Mypair._Myval2; + _My_data._Mylast = _Umove(_Rightfirst, _Rightlast, _My_data._Myfirst); + _Guard._Target = nullptr; } + return; } + } _Move_construct(_Right, true_type{}); } @@ -1753,7 +1752,7 @@ private: #if _HAS_CXX17 template >, enable_if_t, _Is_allocator<_Alloc>>, int> = 0> -vector(_Iter, _Iter, _Alloc = _Alloc())->vector<_Iter_value_t<_Iter>, _Alloc>; +vector(_Iter, _Iter, _Alloc = _Alloc()) -> vector<_Iter_value_t<_Iter>, _Alloc>; #endif // _HAS_CXX17 template @@ -2313,12 +2312,11 @@ public: vector(vector&& _Right, const _Alloc& _Al) noexcept(is_nothrow_constructible_v<_Mybase, _Mybase, const _Alloc&>) : _Mybase(_STD move(_Right), _Al) { - if - _CONSTEXPR_IF(!_Alvbase_traits::is_always_equal::value) { - if (this->_Getal() != _Right._Getal()) { - return; - } + if _CONSTEXPR_IF (!_Alvbase_traits::is_always_equal::value) { + if (this->_Getal() != _Right._Getal()) { + return; } + } this->_Swap_proxy_and_iterators(_Right); } diff --git a/stl/inc/xhash b/stl/inc/xhash index 9a6ae4208b2..dc5618d6f67 100644 --- a/stl/inc/xhash +++ b/stl/inc/xhash @@ -436,11 +436,9 @@ private: public: _Hash(_Hash&& _Right, const allocator_type& _Al) : _Traitsobj(_Right._Traitsobj), _List(_Al), _Vec(_Al) { // construct hash table by moving _Right, allocator - if - _CONSTEXPR_IF(_Alnode_traits::is_always_equal::value) { - _Move_construct_equal_alloc(_Right); - } - else if (_List._Getal() == _Right._List._Getal()) { + if _CONSTEXPR_IF (_Alnode_traits::is_always_equal::value) { + _Move_construct_equal_alloc(_Right); + } else if (_List._Getal() == _Right._List._Getal()) { _Move_construct_equal_alloc(_Right); } else { _Maxidx = _Min_buckets; @@ -1234,13 +1232,11 @@ public: _Nothrow_hash<_Traits, key_type> // && (!_Multi || _Nothrow_compare<_Traits, key_type, key_type>) ) /* strengthened */ { const size_t _Hashval = _Traitsobj(_Keyval); - if - _CONSTEXPR_IF(_Multi) { - const auto _Where = _Equal_range(_Keyval, _Hashval); - _Unchecked_erase(_Where._First._Ptr, _Where._Last._Ptr); - return _Where._Distance; - } - else { + if _CONSTEXPR_IF (_Multi) { + const auto _Where = _Equal_range(_Keyval, _Hashval); + _Unchecked_erase(_Where._First._Ptr, _Where._Last._Ptr); + return _Where._Distance; + } else { const auto _Target = _Find_last(_Keyval, _Hashval)._Duplicate; if (_Target) { _Erase_bucket(_Target, _Hashval & _Mask); @@ -1265,17 +1261,16 @@ public: return; } - if - _CONSTEXPR_IF(_Nothrow_hash<_Traits, key_type>) { - // In testing, hash{}(size_t{}) takes about 14 times as much time as assigning a pointer, or - // ~7-8 times as much as clearing a bucket. Therefore, if we would need to assign over more than 8 times - // as many buckets as elements, remove element-by-element. - if (bucket_count() / 8 > _Oldsize) { - const auto _Head = _List._Mypair._Myval2._Myhead; - _Unchecked_erase(_Head->_Next, _Head); - return; - } + if _CONSTEXPR_IF (_Nothrow_hash<_Traits, key_type>) { + // In testing, hash{}(size_t{}) takes about 14 times as much time as assigning a pointer, or + // ~7-8 times as much as clearing a bucket. Therefore, if we would need to assign over more than 8 times + // as many buckets as elements, remove element-by-element. + if (bucket_count() / 8 > _Oldsize) { + const auto _Head = _List._Mypair._Myval2._Myhead; + _Unchecked_erase(_Head->_Next, _Head); + return; } + } // Bulk destroy items and reset buckets _List.clear(); @@ -1296,12 +1291,11 @@ private: const _Nodeptr _Bucket_hi = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]._Ptr; for (;;) { if (!_Traitsobj(_Traits::_Kfn(_Where->_Myval), _Keyval)) { - if - _CONSTEXPR_IF(!_Traits::_Standard) { - if (_Traitsobj(_Keyval, _Traits::_Kfn(_Where->_Myval))) { - return _End; - } + if _CONSTEXPR_IF (!_Traits::_Standard) { + if (_Traitsobj(_Keyval, _Traits::_Kfn(_Where->_Myval))) { + return _End; } + } return _Where; } @@ -1316,11 +1310,9 @@ private: template _Nodeptr _Find(const _Keyty& _Keyval, const size_t _Hashval) const { - if - _CONSTEXPR_IF(_Traits::_Multi) { - return _Find_first(_Keyval, _Hashval); - } - else { + if _CONSTEXPR_IF (_Traits::_Multi) { + return _Find_first(_Keyval, _Hashval); + } else { // use _Find_last for unique containers to avoid increase in code size of instantiating _Find_first auto _Target = _Find_last(_Keyval, _Hashval)._Duplicate; if (_Target) { @@ -1352,11 +1344,9 @@ public: template _NODISCARD size_type count(typename _Traits::template _Deduce_key<_Keyty> _Keyval) const { const size_t _Hashval = _Traitsobj(_Keyval); - if - _CONSTEXPR_IF(_Multi) { - return _Equal_range(_Keyval, _Hashval)._Distance; - } - else { + if _CONSTEXPR_IF (_Multi) { + return _Equal_range(_Keyval, _Hashval)._Distance; + } else { return static_cast(_Find_last(_Keyval, _Hashval)._Duplicate); } } @@ -1415,34 +1405,31 @@ private: } } - if - _CONSTEXPR_IF(!_Traits::_Standard) { - if (_Traitsobj(_Keyval, _Traits::_Kfn(*_Where))) { - return {_End, _End, 0}; - } + if _CONSTEXPR_IF (!_Traits::_Standard) { + if (_Traitsobj(_Keyval, _Traits::_Kfn(*_Where))) { + return {_End, _End, 0}; } + } const _Unchecked_const_iterator _First = _Where; - if - _CONSTEXPR_IF(_Multi) { - size_type _Distance = 0; - for (;;) { - ++_Distance; - - const bool _At_bucket_end = _Where == _Bucket_hi; - ++_Where; - if (_At_bucket_end) { - break; - } + if _CONSTEXPR_IF (_Multi) { + size_type _Distance = 0; + for (;;) { + ++_Distance; - if (_Traitsobj(_Keyval, _Traits::_Kfn(*_Where))) { - break; - } + const bool _At_bucket_end = _Where == _Bucket_hi; + ++_Where; + if (_At_bucket_end) { + break; } - return {_First, _Where, _Distance}; + if (_Traitsobj(_Keyval, _Traits::_Kfn(*_Where))) { + break; + } } - else { + + return {_First, _Where, _Distance}; + } else { ++_Where; // found the unique element return {_First, _Where, 1}; } @@ -1675,12 +1662,11 @@ protected: for (;;) { // Search backwards to maintain sorted [_Bucket_lo, _Bucket_hi] when !_Standard if (!_Traitsobj(_Keyval, _Traits::_Kfn(_Where->_Myval))) { - if - _CONSTEXPR_IF(!_Traits::_Standard) { - if (_Traitsobj(_Traits::_Kfn(_Where->_Myval), _Keyval)) { - return {_Where->_Next, _Nodeptr{}}; - } + if _CONSTEXPR_IF (!_Traits::_Standard) { + if (_Traitsobj(_Traits::_Kfn(_Where->_Myval), _Keyval)) { + return {_Where->_Next, _Nodeptr{}}; } + } return {_Where->_Next, _Where}; } @@ -1699,12 +1685,11 @@ protected: // if _Hint points to an element equivalent to _Keyval, returns _Hint; otherwise, // returns _Find_last(_Keyval, _Hashval) if (_Hint != _List._Mypair._Myval2._Myhead && !_Traitsobj(_Traits::_Kfn(_Hint->_Myval), _Keyval)) { - if - _CONSTEXPR_IF(!_Traits::_Standard) { - if (_Traitsobj(_Keyval, _Traits::_Kfn(_Hint->_Myval))) { - return _Find_last(_Keyval, _Hashval); - } + if _CONSTEXPR_IF (!_Traits::_Standard) { + if (_Traitsobj(_Keyval, _Traits::_Kfn(_Hint->_Myval))) { + return _Find_last(_Keyval, _Hashval); } + } return {_Hint->_Next, _Hint}; } @@ -1943,11 +1928,9 @@ protected: } _Unchecked_const_iterator _Left_stop_at; - if - _CONSTEXPR_IF(_Traits::_Standard) { - _Left_stop_at = _Unchecked_end(); - } - else { + if _CONSTEXPR_IF (_Traits::_Standard) { + _Left_stop_at = _Unchecked_end(); + } else { // check the first elements for equivalence when !_Standard if (_Right._Traitsobj(_Keyval, _Traits::_Kfn(*_First2))) { return {}; @@ -2053,30 +2036,26 @@ public: const _Unchecked_const_iterator _Bucket_hi = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]; if (_Where != _End) { // check that the bucket is sorted for legacy hash_meow: - if - _CONSTEXPR_IF(!_Traits::_Standard) { - if (_Where != _Bucket_hi) { - auto _SFirst = _Where; - auto _SNext = _Where; - for (;;) { - ++_SNext; - if - _CONSTEXPR_IF(_Traits::_Multi) { - _STL_INTERNAL_CHECK( - !_Traitsobj(_Traits::_Kfn(*_SNext), _Traits::_Kfn(*_SFirst))); - } - else { - _STL_INTERNAL_CHECK(_Traitsobj(_Traits::_Kfn(*_SFirst), _Traits::_Kfn(*_SNext))); - } - - if (_SNext == _Bucket_hi) { - break; - } - - _SFirst = _SNext; + if _CONSTEXPR_IF (!_Traits::_Standard) { + if (_Where != _Bucket_hi) { + auto _SFirst = _Where; + auto _SNext = _Where; + for (;;) { + ++_SNext; + if _CONSTEXPR_IF (_Traits::_Multi) { + _STL_INTERNAL_CHECK(!_Traitsobj(_Traits::_Kfn(*_SNext), _Traits::_Kfn(*_SFirst))); + } else { + _STL_INTERNAL_CHECK(_Traitsobj(_Traits::_Kfn(*_SFirst), _Traits::_Kfn(*_SNext))); + } + + if (_SNext == _Bucket_hi) { + break; } + + _SFirst = _SNext; } } + } // check that all the elements in the bucket belong in the bucket: for (;;) { ++_Elements; diff --git a/stl/inc/xlocale b/stl/inc/xlocale index 9bfecaf1e3b..cfb469b14ae 100644 --- a/stl/inc/xlocale +++ b/stl/inc/xlocale @@ -776,13 +776,11 @@ protected: _Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const { // convert bytes [_First1, _Last1) to [_First2, _Last2) _Mid1 = _First1; _Mid2 = _First2; - if - _CONSTEXPR_IF(is_same_v<_Byte, _Elem>) { - (void) _Last1; - (void) _Last2; - return noconv; // convert nothing - } - else { + if _CONSTEXPR_IF (is_same_v<_Byte, _Elem>) { + (void) _Last1; + (void) _Last2; + return noconv; // convert nothing + } else { // types differ, copy one for one for (; _Mid1 != _Last1; ++_Mid1, ++_Mid2) { if (_Mid2 == _Last2) { @@ -799,13 +797,11 @@ protected: _Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const { // convert [_First1, _Last1) to bytes [_First2, _Last2) _Mid1 = _First1; _Mid2 = _First2; - if - _CONSTEXPR_IF(is_same_v<_Byte, _Elem>) { - (void) _Last1; - (void) _Last2; - return noconv; // convert nothing - } - else { + if _CONSTEXPR_IF (is_same_v<_Byte, _Elem>) { + (void) _Last1; + (void) _Last2; + return noconv; // convert nothing + } else { // types differ, copy one for one for (; _Mid1 != _Last1; ++_Mid1, ++_Mid2) { if (_Mid2 == _Last2) { diff --git a/stl/inc/xmemory b/stl/inc/xmemory index e5ce15fca74..2d8268f8fc7 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -55,13 +55,12 @@ template _NODISCARD constexpr size_t _Get_size_of_n(const size_t _Count) { constexpr bool _Overflow_is_possible = _Ty_size > 1; - if - _CONSTEXPR_IF(_Overflow_is_possible) { - constexpr size_t _Max_possible = static_cast(-1) / _Ty_size; - if (_Count > _Max_possible) { - _Throw_bad_array_new_length(); // multiply overflow - } + if _CONSTEXPR_IF (_Overflow_is_possible) { + constexpr size_t _Max_possible = static_cast(-1) / _Ty_size; + if (_Count > _Max_possible) { + _Throw_bad_array_new_length(); // multiply overflow } + } return _Count * _Ty_size; } @@ -967,13 +966,11 @@ template void _Destroy_range(_Alloc_ptr_t<_Alloc> _First, const _Alloc_ptr_t<_Alloc> _Last, _Alloc& _Al) noexcept { // note that this is an optimization for debug mode codegen; in release mode the BE removes all of this using _Ty = typename _Alloc::value_type; - if - _CONSTEXPR_IF(conjunction_v, _Uses_default_destroy<_Alloc, _Ty*>>) { - (void) _First; - (void) _Last; - (void) _Al; - } - else { + if _CONSTEXPR_IF (conjunction_v, _Uses_default_destroy<_Alloc, _Ty*>>) { + (void) _First; + (void) _Last; + (void) _Al; + } else { for (; _First != _Last; ++_First) { allocator_traits<_Alloc>::destroy(_Al, _Unfancy(_First)); } @@ -985,12 +982,10 @@ void _Destroy_range(_Alloc_ptr_t<_Alloc> _First, const _Alloc_ptr_t<_Alloc> _Las template void _Destroy_range(_NoThrowFwdIt _First, const _NoThrowFwdIt _Last) noexcept { // note that this is an optimization for debug mode codegen; in release mode the BE removes all of this - if - _CONSTEXPR_IF(is_trivially_destructible_v<_Iter_value_t<_NoThrowFwdIt>>) { - (void) _First; - (void) _Last; - } - else { + if _CONSTEXPR_IF (is_trivially_destructible_v<_Iter_value_t<_NoThrowFwdIt>>) { + (void) _First; + (void) _Last; + } else { for (; _First != _Last; ++_First) { _Destroy_in_place(*_First); } @@ -2032,13 +2027,11 @@ struct _Alloc_temporary { template _NODISCARD constexpr bool _Allocators_equal(const _Alloc& _Lhs, const _Alloc& _Rhs) noexcept { - if - _CONSTEXPR_IF(allocator_traits<_Alloc>::is_always_equal::value) { - (void) _Lhs; - (void) _Rhs; - return true; - } - else { + if _CONSTEXPR_IF (allocator_traits<_Alloc>::is_always_equal::value) { + (void) _Lhs; + (void) _Rhs; + return true; + } else { return _Lhs == _Rhs; } } diff --git a/stl/inc/xstring b/stl/inc/xstring index 9d4f8a1c002..bd76b965865 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -88,8 +88,8 @@ struct _Char_traits { // properties of a string or stream element return static_cast<_Elem*>(_CSTD memmove(_First1, _First2, _Count * sizeof(_Elem))); } - static _Elem* assign( - _Out_writes_all_(_Count) _Elem* const _First, size_t _Count, const _Elem _Ch) noexcept /* strengthened */ { + static _Elem* assign(_Out_writes_all_(_Count) _Elem* const _First, size_t _Count, const _Elem _Ch) noexcept + /* strengthened */ { // assign _Count * _Ch to [_First, ...) _Elem* _Next = _First; for (; 0 < _Count; --_Count, ++_Next) { @@ -205,8 +205,8 @@ struct _WChar_traits { // char_traits for the char16_t-likes: char16_t, wchar_t, _CSTD wmemmove(reinterpret_cast(_First1), reinterpret_cast(_First2), _Count)); } - static _Elem* assign( - _Out_writes_all_(_Count) _Elem* const _First, size_t _Count, _Elem _Ch) noexcept /* strengthened */ { + static _Elem* assign(_Out_writes_all_(_Count) _Elem* const _First, size_t _Count, _Elem _Ch) noexcept + /* strengthened */ { // assign _Count * _Ch to [_First, ...) return reinterpret_cast<_Elem*>(_CSTD wmemset(reinterpret_cast(_First), _Ch, _Count)); } @@ -367,8 +367,8 @@ struct _Narrow_char_traits { // Implement char_traits for narrow character types return static_cast<_Elem*>(_CSTD memmove(_First1, _First2, _Count)); } - static _Elem* assign(_Out_writes_all_(_Count) _Elem* const _First, const size_t _Count, - const _Elem _Ch) noexcept /* strengthened */ { + static _Elem* assign(_Out_writes_all_(_Count) _Elem* const _First, const size_t _Count, const _Elem _Ch) noexcept + /* strengthened */ { // assign _Count * _Ch to [_First, ...) return static_cast<_Elem*>(_CSTD memset(_First, _Ch, _Count)); } @@ -1414,8 +1414,8 @@ public: return _Traits_find<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Count); } - _NODISCARD constexpr size_type find(_In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const - noexcept /* strengthened */ { + _NODISCARD constexpr size_type find(_In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const noexcept + /* strengthened */ { // look for [_Ptr, ) beginning at or after _Off return _Traits_find<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr)); } @@ -1436,8 +1436,8 @@ public: return _Traits_rfind<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Count); } - _NODISCARD constexpr size_type rfind(_In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const - noexcept /* strengthened */ { + _NODISCARD constexpr size_type rfind(_In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const noexcept + /* strengthened */ { // look for [_Ptr, ) beginning before _Off return _Traits_rfind<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr)); } @@ -1460,15 +1460,15 @@ public: _Mydata, _Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{}); } - _NODISCARD constexpr size_type find_first_of(_In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const - noexcept /* strengthened */ { + _NODISCARD constexpr size_type find_first_of( + _In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const noexcept /* strengthened */ { // look for one of [_Ptr, ) at or after _Off return _Traits_find_first_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{}); } - _NODISCARD constexpr size_type find_last_of(const basic_string_view _Right, const size_type _Off = npos) const - noexcept { // look for one of _Right before _Off + _NODISCARD constexpr size_type find_last_of(const basic_string_view _Right, + const size_type _Off = npos) const noexcept { // look for one of _Right before _Off return _Traits_find_last_of<_Traits>( _Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize, _Is_specialization<_Traits, char_traits>{}); } @@ -1485,8 +1485,8 @@ public: _Mydata, _Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{}); } - _NODISCARD constexpr size_type find_last_of(_In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const - noexcept /* strengthened */ { + _NODISCARD constexpr size_type find_last_of( + _In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const noexcept /* strengthened */ { // look for one of [_Ptr, ) before _Off return _Traits_find_last_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{}); @@ -1510,8 +1510,8 @@ public: _Mydata, _Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{}); } - _NODISCARD constexpr size_type find_first_not_of(_In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const - noexcept /* strengthened */ { + _NODISCARD constexpr size_type find_first_not_of( + _In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const noexcept /* strengthened */ { // look for none of [_Ptr, ) at or after _Off return _Traits_find_first_not_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{}); @@ -1535,8 +1535,8 @@ public: _Mydata, _Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{}); } - _NODISCARD constexpr size_type find_last_not_of(_In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const - noexcept /* strengthened */ { + _NODISCARD constexpr size_type find_last_not_of( + _In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const noexcept /* strengthened */ { // look for none of [_Ptr, ) before _Off return _Traits_find_last_not_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{}); @@ -2430,14 +2430,13 @@ public: : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); - if - _CONSTEXPR_IF(!_Alty_traits::is_always_equal::value) { - if (_Getal() != _Right._Getal()) { - _Construct_lv_contents(_Right); - _Proxy._Release(); - return; - } + if _CONSTEXPR_IF (!_Alty_traits::is_always_equal::value) { + if (_Getal() != _Right._Getal()) { + _Construct_lv_contents(_Right); + _Proxy._Release(); + return; } + } _Take_contents(_Right, bool_constant<_Can_memcpy_val>{}); _Proxy._Release(); @@ -2741,11 +2740,9 @@ private: void _Copy_assign_val_from_small(const basic_string& _Right) { // TRANSITION, VSO-761321; inline into only caller when that's fixed _Tidy_deallocate(); - if - _CONSTEXPR_IF(_Can_memcpy_val) { - _Memcpy_val_from(_Right); - } - else { + if _CONSTEXPR_IF (_Can_memcpy_val) { + _Memcpy_val_from(_Right); + } else { _Traits::copy( _Mypair._Myval2._Bx._Buf, _Right._Mypair._Myval2._Bx._Buf, _Right._Mypair._Myval2._Mysize + 1); _Mypair._Myval2._Mysize = _Right._Mypair._Myval2._Mysize; @@ -3883,8 +3880,8 @@ public: _Traits_find<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count)); } - _NODISCARD size_type find(_In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const - noexcept /* strengthened */ { + _NODISCARD size_type find(_In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const noexcept + /* strengthened */ { // look for [_Ptr, ) beginning at or after _Off return static_cast(_Traits_find<_Traits>( _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr))); @@ -3919,8 +3916,8 @@ public: _Traits_rfind<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count)); } - _NODISCARD size_type rfind(_In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const - noexcept /* strengthened */ { + _NODISCARD size_type rfind(_In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const noexcept + /* strengthened */ { // look for [_Ptr, ) beginning before _Off return static_cast(_Traits_rfind<_Traits>( _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr))); @@ -3956,8 +3953,8 @@ public: _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{})); } - _NODISCARD size_type find_first_of(_In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const - noexcept /* strengthened */ { + _NODISCARD size_type find_first_of(_In_z_ const _Elem* const _Ptr, const size_type _Off = 0) const noexcept + /* strengthened */ { // look for one of [_Ptr, ) at or after _Off return static_cast(_Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{})); @@ -3993,8 +3990,8 @@ public: _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{})); } - _NODISCARD size_type find_last_of(_In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const - noexcept /* strengthened */ { + _NODISCARD size_type find_last_of(_In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const noexcept + /* strengthened */ { // look for one of [_Ptr, ) before _Off return static_cast(_Traits_find_last_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{})); @@ -4031,15 +4028,15 @@ public: _Mypair._Myval2._Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{})); } - _NODISCARD size_type find_first_not_of(_In_z_ const _Elem* const _Ptr, size_type _Off = 0) const - noexcept /* strengthened */ { + _NODISCARD size_type find_first_not_of(_In_z_ const _Elem* const _Ptr, size_type _Off = 0) const noexcept + /* strengthened */ { // look for one of [_Ptr, ) at or after _Off return static_cast(_Traits_find_first_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{})); } - _NODISCARD size_type find_first_not_of(const _Elem _Ch, const size_type _Off = 0) const - noexcept /* strengthened */ { + _NODISCARD size_type find_first_not_of(const _Elem _Ch, const size_type _Off = 0) const noexcept + /* strengthened */ { // look for non _Ch at or after _Off return static_cast( _Traits_find_not_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); @@ -4070,15 +4067,15 @@ public: _Mypair._Myval2._Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{})); } - _NODISCARD size_type find_last_not_of(_In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const - noexcept /* strengthened */ { + _NODISCARD size_type find_last_not_of(_In_z_ const _Elem* const _Ptr, const size_type _Off = npos) const noexcept + /* strengthened */ { // look for none of [_Ptr, ) before _Off return static_cast(_Traits_find_last_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{})); } - _NODISCARD size_type find_last_not_of(const _Elem _Ch, const size_type _Off = npos) const - noexcept /* strengthened */ { + _NODISCARD size_type find_last_not_of(const _Elem _Ch, const size_type _Off = npos) const noexcept + /* strengthened */ { // look for non _Ch before _Off return static_cast( _Traits_rfind_not_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); @@ -4346,23 +4343,22 @@ private: template >, enable_if_t, _Is_allocator<_Alloc>>, int> = 0> basic_string(_Iter, _Iter, _Alloc = _Alloc()) - ->basic_string<_Iter_value_t<_Iter>, char_traits<_Iter_value_t<_Iter>>, _Alloc>; + -> basic_string<_Iter_value_t<_Iter>, char_traits<_Iter_value_t<_Iter>>, _Alloc>; template , enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> explicit basic_string(basic_string_view<_Elem, _Traits>, const _Alloc& = _Alloc()) - ->basic_string<_Elem, _Traits, _Alloc>; + -> basic_string<_Elem, _Traits, _Alloc>; template , enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> -basic_string( - basic_string_view<_Elem, _Traits>, _Guide_size_type_t<_Alloc>, _Guide_size_type_t<_Alloc>, const _Alloc& = _Alloc()) - ->basic_string<_Elem, _Traits, _Alloc>; +basic_string(basic_string_view<_Elem, _Traits>, _Guide_size_type_t<_Alloc>, _Guide_size_type_t<_Alloc>, + const _Alloc& = _Alloc()) -> basic_string<_Elem, _Traits, _Alloc>; #endif // _HAS_CXX17 template -void swap(basic_string<_Elem, _Traits, _Alloc>& _Left, - basic_string<_Elem, _Traits, _Alloc>& _Right) noexcept /* strengthened */ { +void swap(basic_string<_Elem, _Traits, _Alloc>& _Left, basic_string<_Elem, _Traits, _Alloc>& _Right) noexcept +/* strengthened */ { _Left.swap(_Right); } diff --git a/stl/inc/xtree b/stl/inc/xtree index d108c574df9..1cb78db9a75 100644 --- a/stl/inc/xtree +++ b/stl/inc/xtree @@ -926,13 +926,12 @@ private: public: _Tree(_Tree&& _Right, const allocator_type& _Al) : _Mypair(_One_then_variadic_args_t{}, _Right.key_comp(), _One_then_variadic_args_t{}, _Al) { - if - _CONSTEXPR_IF(!_Alnode_traits::is_always_equal::value) { - if (_Getal() != _Right._Getal()) { - _Different_allocator_move_construct(_STD move(_Right)); - return; - } + if _CONSTEXPR_IF (!_Alnode_traits::is_always_equal::value) { + if (_Getal() != _Right._Getal()) { + _Different_allocator_move_construct(_STD move(_Right)); + return; } + } _Alloc_sentinel_and_proxy(); _Swap_val(_Right); @@ -1063,11 +1062,9 @@ protected: { _Tree_temp_node<_Alnode> _Newnode(_Getal(), _Scary->_Myhead, _STD forward<_Valtys>(_Vals)...); const auto& _Keyval = _Traits::_Kfn(_Newnode._Ptr->_Myval); - if - _CONSTEXPR_IF(_Multi) { // duplicate check if unique - _Loc = _Find_upper_bound(_Keyval); - } - else { + if _CONSTEXPR_IF (_Multi) { // duplicate check if unique + _Loc = _Find_upper_bound(_Keyval); + } else { _Loc = _Find_lower_bound(_Keyval); if (_Lower_bound_duplicate(_Loc._Bound, _Keyval)) { return {_Loc._Bound, false}; @@ -1497,13 +1494,11 @@ public: #endif // _HAS_CXX20 _NODISCARD size_type count(const key_type& _Keyval) const { - if - _CONSTEXPR_IF(_Multi) { - const auto _Ans = _Eqrange(_Keyval); - return static_cast(_STD distance( - _Unchecked_const_iterator(_Ans.first, nullptr), _Unchecked_const_iterator(_Ans.second, nullptr))); - } - else { + if _CONSTEXPR_IF (_Multi) { + const auto _Ans = _Eqrange(_Keyval); + return static_cast(_STD distance( + _Unchecked_const_iterator(_Ans.first, nullptr), _Unchecked_const_iterator(_Ans.second, nullptr))); + } else { return _Lower_bound_duplicate(_Find_lower_bound(_Keyval)._Bound, _Keyval); } } @@ -1589,49 +1584,46 @@ protected: _Tree_find_hint_result<_Nodeptr> _Find_hint(const _Nodeptr _Hint, const _Keyty& _Keyval) const { const auto& _Comp = _Getcomp(); const auto _Head = _Get_scary()->_Myhead; - if - _CONSTEXPR_IF(_Multi) { // insert even if duplicate - if (_Hint->_Isnil) { - // insert at end if greater than or equal to last element - if (_Head->_Parent->_Isnil - || !_DEBUG_LT_PRED(_Comp, _Keyval, _Traits::_Kfn(_Head->_Right->_Myval))) { - return {{_Head->_Right, _Tree_child::_Right}, false}; - } - - // _Hint is end(); it must be closer to the end of equivalents - return {_Find_upper_bound(_Keyval)._Location, false}; + if _CONSTEXPR_IF (_Multi) { // insert even if duplicate + if (_Hint->_Isnil) { + // insert at end if greater than or equal to last element + if (_Head->_Parent->_Isnil || !_DEBUG_LT_PRED(_Comp, _Keyval, _Traits::_Kfn(_Head->_Right->_Myval))) { + return {{_Head->_Right, _Tree_child::_Right}, false}; } - if (_Hint == _Head->_Left) { - // insert at beginning if less than or equal to first element - if (!_DEBUG_LT_PRED(_Comp, _Traits::_Kfn(_Hint->_Myval), _Keyval)) { - return {{_Hint, _Tree_child::_Left}, false}; - } + // _Hint is end(); it must be closer to the end of equivalents + return {_Find_upper_bound(_Keyval)._Location, false}; + } - // _Hint is begin(); it must be closer to the beginning of equivalents - return {_Find_lower_bound(_Keyval)._Location, false}; + if (_Hint == _Head->_Left) { + // insert at beginning if less than or equal to first element + if (!_DEBUG_LT_PRED(_Comp, _Traits::_Kfn(_Hint->_Myval), _Keyval)) { + return {{_Hint, _Tree_child::_Left}, false}; } - if (!_DEBUG_LT_PRED(_Comp, _Traits::_Kfn(_Hint->_Myval), _Keyval)) { - // _Val <= *_Hint - const auto _Prev = (--(_Unchecked_const_iterator(_Hint, nullptr)))._Ptr; - if (!_DEBUG_LT_PRED(_Comp, _Keyval, _Traits::_Kfn(_Prev->_Myval))) { - // _Val <= *_Hint and _Val >= *prev(_Hint); insert here - if (_Prev->_Right->_Isnil) { - return {{_Prev, _Tree_child::_Right}, false}; - } else { - return {{_Hint, _Tree_child::_Left}, false}; - } - } + // _Hint is begin(); it must be closer to the beginning of equivalents + return {_Find_lower_bound(_Keyval)._Location, false}; + } - // _Val goes before *_Hint; _Hint must be closer to the end of equivalents - return {_Find_upper_bound(_Keyval)._Location, false}; + if (!_DEBUG_LT_PRED(_Comp, _Traits::_Kfn(_Hint->_Myval), _Keyval)) { + // _Val <= *_Hint + const auto _Prev = (--(_Unchecked_const_iterator(_Hint, nullptr)))._Ptr; + if (!_DEBUG_LT_PRED(_Comp, _Keyval, _Traits::_Kfn(_Prev->_Myval))) { + // _Val <= *_Hint and _Val >= *prev(_Hint); insert here + if (_Prev->_Right->_Isnil) { + return {{_Prev, _Tree_child::_Right}, false}; + } else { + return {{_Hint, _Tree_child::_Left}, false}; + } } - // _Val goes after *_Hint; _Hint must be closer to the beginning of equivalents - return {_Find_lower_bound(_Keyval)._Location, false}; + // _Val goes before *_Hint; _Hint must be closer to the end of equivalents + return {_Find_upper_bound(_Keyval)._Location, false}; } - else { // insert only if unique + + // _Val goes after *_Hint; _Hint must be closer to the beginning of equivalents + return {_Find_lower_bound(_Keyval)._Location, false}; + } else { // insert only if unique if (_Hint->_Isnil) { // insert at end if after last element // insert at end if greater than last element if (_Head->_Parent->_Isnil || _DEBUG_LT_PRED(_Comp, _Traits::_Kfn(_Head->_Right->_Myval), _Keyval)) { diff --git a/stl/inc/xutility b/stl/inc/xutility index a9721877ceb..12f55fbda12 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -4005,8 +4005,8 @@ _DestTy* copy_n(_ExPo&&, _FwdIt1 _First, _Diff _Count_raw, _DestTy (&_Dest)[_Des template = 0> -_DestTy* copy_n(_ExPo&&, _SourceTy (&_First)[_SourceSize], _Diff _Count_raw, - _DestTy (&_Dest)[_DestSize]) noexcept /* terminates */ { +_DestTy* copy_n(_ExPo&&, _SourceTy (&_First)[_SourceSize], _Diff _Count_raw, _DestTy (&_Dest)[_DestSize]) noexcept +/* terminates */ { // copy [_First, _First + _Count) to [_Dest, ...), array source/dest // not parallelized as benchmarks show it isn't worth it return _STD copy_n(_First, _Count_raw, _Dest); @@ -4570,8 +4570,8 @@ _NODISCARD _CONSTEXPR20 bool equal(const _InIt1 _First1, const _InIt1 _Last1, _R #if _HAS_CXX17 template = 0> -_NODISCARD bool equal( - _ExPo&& _Exec, const _FwdIt1 _First1, const _FwdIt1 _Last1, const _FwdIt2 _First2) noexcept /* terminates */ { +_NODISCARD bool equal(_ExPo&& _Exec, const _FwdIt1 _First1, const _FwdIt1 _Last1, const _FwdIt2 _First2) noexcept +/* terminates */ { // compare [_First1, _Last1) to [_First2, ...) return _STD equal(_STD forward<_ExPo>(_Exec), _First1, _Last1, _First2, equal_to<>()); } diff --git a/tests/std/expected_results.txt b/tests/std/expected_results.txt index c46d6aec0cd..2ac2a854cb0 100644 --- a/tests/std/expected_results.txt +++ b/tests/std/expected_results.txt @@ -1,46 +1,2 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -# *** INSUFFICIENTLY NEW PUBLIC TOOLSET *** -# TRANSITION, VS 2019 16.6p2 -tests/P0768R1_spaceship_operator:00 FAIL -tests/P0768R1_spaceship_operator:01 FAIL -tests/P0768R1_spaceship_operator:02 FAIL -tests/P0768R1_spaceship_operator:03 FAIL -tests/P0768R1_spaceship_operator:04 FAIL -tests/P0768R1_spaceship_operator:05 FAIL -tests/P0768R1_spaceship_operator:06 FAIL -tests/P0768R1_spaceship_operator:07 FAIL -tests/P0768R1_spaceship_operator:08 FAIL -tests/P0768R1_spaceship_operator:09 FAIL -tests/P0768R1_spaceship_operator:10 FAIL -tests/P0768R1_spaceship_operator:11 FAIL -tests/P0768R1_spaceship_operator:12 FAIL -tests/P0768R1_spaceship_operator:13 FAIL -tests/P0768R1_spaceship_operator:14 FAIL - -# TRANSITION, VS 2019 16.6p2 -tests/VSO_0157762_feature_test_macros:03 FAIL -tests/VSO_0157762_feature_test_macros:04 FAIL -tests/VSO_0157762_feature_test_macros:05 FAIL -tests/VSO_0157762_feature_test_macros:06 FAIL -tests/VSO_0157762_feature_test_macros:10 FAIL -tests/VSO_0157762_feature_test_macros:11 FAIL -tests/VSO_0157762_feature_test_macros:12 FAIL -tests/VSO_0157762_feature_test_macros:13 FAIL -tests/VSO_0157762_feature_test_macros:14 FAIL -tests/VSO_0157762_feature_test_macros:15 FAIL -tests/VSO_0157762_feature_test_macros:16 FAIL -tests/VSO_0157762_feature_test_macros:17 FAIL -tests/VSO_0157762_feature_test_macros:18 FAIL -tests/VSO_0157762_feature_test_macros:23 FAIL -tests/VSO_0157762_feature_test_macros:24 FAIL -tests/VSO_0157762_feature_test_macros:25 FAIL -tests/VSO_0157762_feature_test_macros:29 FAIL -tests/VSO_0157762_feature_test_macros:30 FAIL -tests/VSO_0157762_feature_test_macros:31 FAIL -tests/VSO_0157762_feature_test_macros:32 FAIL -tests/VSO_0157762_feature_test_macros:33 FAIL -tests/VSO_0157762_feature_test_macros:34 FAIL -tests/VSO_0157762_feature_test_macros:35 FAIL -tests/VSO_0157762_feature_test_macros:36 FAIL diff --git a/tests/std/include/range_algorithm_support.hpp b/tests/std/include/range_algorithm_support.hpp index 32ba5f4750c..aeb4db15fee 100644 --- a/tests/std/include/range_algorithm_support.hpp +++ b/tests/std/include/range_algorithm_support.hpp @@ -90,7 +90,7 @@ class move_only_range : public ranges::view_base { }; template -move_only_range(R&)->move_only_range>>; +move_only_range(R&) -> move_only_range>>; template class move_only_range::iterator { diff --git a/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp b/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp index a94bac9f7e9..fbd973ba583 100644 --- a/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp +++ b/tests/std/tests/P0513R0_poisoning_the_hash/test.cpp @@ -55,7 +55,7 @@ constexpr bool standard_hash_enabled() { && is_trivial_v> // as a consequence of the above && is_same_v::argument_type, T> // && is_same_v::result_type, size_t> // - && noexcept(hash{}(declval())) == NoExcept // + && (noexcept(hash{}(declval())) == NoExcept) // && hash_disabled() // && hash_disabled() // && hash_disabled(); diff --git a/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp b/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp index 36280bbc06f..9d762512f91 100644 --- a/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp +++ b/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp @@ -710,7 +710,7 @@ void test_VSO_684710() { struct S2 { P p; - operator P &&() { + operator P&&() { return move(p); } }; diff --git a/tests/std/tests/VSO_0157762_feature_test_macros/test.cpp b/tests/std/tests/VSO_0157762_feature_test_macros/test.cpp index bac9b28991e..21471a8abb1 100644 --- a/tests/std/tests/VSO_0157762_feature_test_macros/test.cpp +++ b/tests/std/tests/VSO_0157762_feature_test_macros/test.cpp @@ -51,7 +51,7 @@ int main() {} // COMPILE-ONLY #endif #endif -#if defined(__clang__) || defined(__EDG__) // Clang and EDG don't yet implement P1771R1 +#if defined(__EDG__) || (defined(__clang__) && __clang_major__ < 10) // Clang 9 and EDG don't yet implement P1771R1 #if __has_cpp_attribute(nodiscard) != 201603L #error __has_cpp_attribute(nodiscard) is not 201603L #endif @@ -160,6 +160,12 @@ STATIC_ASSERT(__cpp_conditional_explicit == 201806L); #ifndef __cpp_constexpr #error __cpp_constexpr is not defined +#elif _HAS_CXX20 && defined(__clang__) && __clang_major__ >= 10 // TRANSITION, VSO-951133 and VSO-951142 +#if __cpp_constexpr != 201907L +#error __cpp_constexpr is not 201907L +#else +STATIC_ASSERT(__cpp_constexpr == 201907L); +#endif #elif _HAS_CXX17 #if __cpp_constexpr != 201603L #error __cpp_constexpr is not 201603L @@ -257,6 +263,12 @@ STATIC_ASSERT(__cpp_fold_expressions == 201603L); #ifndef __cpp_generic_lambdas #error __cpp_generic_lambdas is not defined +#elif _HAS_CXX20 && defined(__clang__) && __clang_major__ >= 10 // TRANSITION, VSO-951133 and EDG +#if __cpp_generic_lambdas != 201707L +#error __cpp_generic_lambdas is not 201707L +#else +STATIC_ASSERT(__cpp_generic_lambdas == 201707L); +#endif #elif __cpp_generic_lambdas != 201304L #error __cpp_generic_lambdas is not 201304L #else @@ -305,8 +317,7 @@ STATIC_ASSERT(__cpp_if_constexpr == 201606L); #endif #endif -#if _HAS_CXX20 && !defined(__clang__) -// Clang only has partial support for <=> but that does not include the feature test macro. +#if _HAS_CXX20 && (!defined(__clang__) || __clang_major__ >= 10) #ifndef __cpp_impl_three_way_comparison #error __cpp_impl_three_way_comparison is not defined #elif defined(__EDG__) // EDG does not yet implement P1630R1 or P1186R3 so they still report the old value. @@ -347,6 +358,12 @@ STATIC_ASSERT(__cpp_inheriting_constructors == 200802L); #ifndef __cpp_init_captures #error __cpp_init_captures is not defined +#elif _HAS_CXX20 && defined(__clang__) && __clang_major__ >= 10 // TRANSITION, VSO-951133 and EDG +#if __cpp_init_captures != 201803L +#error __cpp_init_captures is not 201803L +#else +STATIC_ASSERT(__cpp_init_captures == 201803L); +#endif #elif __cpp_init_captures != 201304L #error __cpp_init_captures is not 201304L #else diff --git a/tools/parallelize/parallelize.cpp b/tools/parallelize/parallelize.cpp index 48d1f8c2c0e..59a8173d62e 100644 --- a/tools/parallelize/parallelize.cpp +++ b/tools/parallelize/parallelize.cpp @@ -80,8 +80,8 @@ class parallelizer { cv.wait(lck, [this] { return runningConcurrency.load(std::memory_order_relaxed) == 0; }); } - [[nodiscard]] const std::vector>>& results() const - noexcept { + [[nodiscard]] const std::vector>>& + results() const noexcept { assert(runningConcurrency.load(std::memory_order_relaxed) == 0); return commands; }