diff --git a/CMakeLists.txt b/CMakeLists.txt index 89bda7c09a5..144bcc03dd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,13 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.31.0) +cmake_minimum_required(VERSION 4.1.1) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) project(msvc_standard_libraries LANGUAGES CXX) -if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.50.35503") - message(FATAL_ERROR "The STL must be built with MSVC Compiler 19.50 Preview 1 or later.") +if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.50.35702") + message(FATAL_ERROR "The STL must be built with MSVC Compiler 19.50.35702 or later.") endif() include(CheckCXXSourceCompiles) @@ -112,13 +112,7 @@ endif() set(VCLIBS_DEBUG_OPTIONS "$<$:/Od>") -# TRANSITION: Potentially remove `/Os` if it results in speed improvements. -# This requires benchmarking! -# Note that in MSVC version 19.32.31328, -# `/Os` results in a binary size difference of 102K -# in the release DLL (a gain of 18.4%). -# So, make certain that that tradeoff is considered when or if `/Os` is removed. -# See GH-2108 for more info. +# TRANSITION, GH-2108: Investigate building the STL with only /O2, not /Os. set(VCLIBS_RELEASE_OPTIONS "$<$:/O2;/Os>") if(BUILD_TESTING) diff --git a/CMakePresets.json b/CMakePresets.json index 916429de659..1dbd259ce91 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -22,7 +22,7 @@ }, "condition": { "type": "inList", - "string": "$env{Platform}", + "string": "$env{VSCMD_ARG_TGT_ARCH}", "list": [ "x64", "" @@ -39,7 +39,7 @@ }, "condition": { "type": "inList", - "string": "$env{Platform}", + "string": "$env{VSCMD_ARG_TGT_ARCH}", "list": [ "x86", "" @@ -56,7 +56,7 @@ }, "condition": { "type": "inList", - "string": "$env{Platform}", + "string": "$env{VSCMD_ARG_TGT_ARCH}", "list": [ "arm64", "" @@ -76,7 +76,7 @@ }, "condition": { "type": "inList", - "string": "$env{Platform}", + "string": "$env{VSCMD_ARG_TGT_ARCH}", "list": [ "arm64", "" diff --git a/README.md b/README.md index 306bbe6f05d..1735e0ccd93 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem - "Windows 11 SDK (10.0.26100)" or later - "C++ Clang tools for Windows (20.1.8 - x64/x86)" - *Optional, see Note 2 below:* "MSVC v145 - C++ ARM64/ARM64EC build tools (Latest)" -* Install [Python][] 3.13 or later. +* Install [Python][] 3.14.0 or later. + Select "Add python.exe to PATH" if you want to follow the instructions below that invoke `python`. Otherwise, you should be familiar with alternative methods. @@ -469,6 +469,32 @@ If you want to see all the other flags you can pass, run: out\bench\benchmark- --help ``` +## Other Useful Incantations + +To compile the benchmarks with additional compiler options, use the [`CXXFLAGS` environment variable][CXXFLAGS]. +Set it after configuring and building the STL, but before configuring and building the benchmarks. +For example, to examine how the `/arch:AVX2` option affects auto-vectorization and bit algorithm intrinsics: + +``` +set CXXFLAGS=/arch:AVX2 +cmake -B out\bench -S benchmarks -G Ninja -DSTL_BINARY_DIR=out\x64 +cmake --build out\bench +``` + +To compile the benchmarks with Clang, use `-DCMAKE_CXX_COMPILER=clang-cl`: + +``` +cmake -B out\bench -S benchmarks -G Ninja -DSTL_BINARY_DIR=out\x64 -DCMAKE_CXX_COMPILER=clang-cl +cmake --build out\bench +``` + +To run a benchmark on specific cores (e.g. P-cores vs. E-cores) and with higher priority +(to avoid interference), use the [`start` command][start-command]: + +``` +start /b /wait /high /affinity 0F out\bench\benchmark-std_copy +``` + # Editing And Testing The Debugger Visualizer ### Modify The Visualizer @@ -581,3 +607,5 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception [ASan]: https://learn.microsoft.com/en-us/cpp/sanitizers/asan [Import Library]: /docs/import_library.md [VS 2026 Insiders]: https://visualstudio.microsoft.com/insiders/ +[CXXFLAGS]: https://cmake.org/cmake/help/latest/envvar/CXXFLAGS.html +[start-command]: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/start diff --git a/azure-devops/config.yml b/azure-devops/config.yml index 934502132fc..6f4bd74b19f 100644 --- a/azure-devops/config.yml +++ b/azure-devops/config.yml @@ -5,7 +5,7 @@ variables: - name: poolName - value: 'StlBuild-2025-09-09T1526-Pool' + value: 'Stl-2025-10-14T1635-x64-Pool' readonly: true - name: poolDemands value: 'EnableSpotVM -equals false' diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index 7dce5e9bca5..e72d7705f98 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -12,15 +12,18 @@ See https://github.com/microsoft/STL/wiki/Checklist-for-Toolset-Updates for more $ErrorActionPreference = 'Stop' $CurrentDate = Get-Date +$Timestamp = $CurrentDate.ToString('yyyy-MM-ddTHHmm') +$Arch = 'x64' $Location = 'eastus2' $VMSize = 'Standard_F32as_v6' +$PoolSize = 64 $ProtoVMName = 'PROTOTYPE' $ImagePublisher = 'MicrosoftWindowsServer' $ImageOffer = 'WindowsServer' $ImageSku = '2025-datacenter-azure-edition' -$LogFile = '1es-hosted-pool.log' +$LogFile = "1es-hosted-pool-$Timestamp-$Arch.log" $ProgressActivity = 'Preparing STL CI pool' $TotalProgress = 38 $CurrentProgress = 1 @@ -82,15 +85,16 @@ Update-AzConfig ` -Scope 'Process' >> $LogFile #################################################################################################### -Display-ProgressBar -Status 'Setting the subscription context' +Display-ProgressBar -Status 'Getting the subscription context' -Set-AzContext ` - -SubscriptionName 'CPP_STL_GitHub' >> $LogFile +if ((Get-AzContext).Subscription.Name -cne 'CPP_STL_GitHub') { + Write-Error 'Please sign in with `Connect-AzAccount -Subscription ''CPP_STL_GitHub''` before running this script.' +} #################################################################################################### Display-ProgressBar -Status 'Creating resource group' -$ResourceGroupName = 'StlBuild-' + $CurrentDate.ToString('yyyy-MM-ddTHHmm') +$ResourceGroupName = "Stl-$Timestamp-$Arch" New-AzResourceGroup ` -Name $ResourceGroupName ` @@ -105,7 +109,7 @@ $Credential = New-Object System.Management.Automation.PSCredential ('AdminUser', #################################################################################################### Display-ProgressBar -Status 'Creating public IP address' -$PublicIpAddressName = $ResourceGroupName + '-PublicIpAddress' +$PublicIpAddressName = "$ResourceGroupName-PublicIpAddress" $PublicIpAddress = New-AzPublicIpAddress ` -Name $PublicIpAddressName ` -ResourceGroupName $ResourceGroupName ` @@ -116,7 +120,7 @@ $PublicIpAddress = New-AzPublicIpAddress ` #################################################################################################### Display-ProgressBar -Status 'Creating NAT gateway' -$NatGatewayName = $ResourceGroupName + '-NatGateway' +$NatGatewayName = "$ResourceGroupName-NatGateway" $NatGateway = New-AzNatGateway ` -Name $NatGatewayName ` -ResourceGroupName $ResourceGroupName ` @@ -128,7 +132,7 @@ $NatGateway = New-AzNatGateway ` #################################################################################################### Display-ProgressBar -Status 'Creating network security group' -$NetworkSecurityGroupName = $ResourceGroupName + '-NetworkSecurity' +$NetworkSecurityGroupName = "$ResourceGroupName-NetworkSecurity" $NetworkSecurityGroup = New-AzNetworkSecurityGroup ` -Name $NetworkSecurityGroupName ` -ResourceGroupName $ResourceGroupName ` @@ -137,10 +141,12 @@ $NetworkSecurityGroup = New-AzNetworkSecurityGroup ` #################################################################################################### Display-ProgressBar -Status 'Creating virtual network subnet config' -# TRANSITION, 2025-09-30: "On September 30, 2025, default outbound access for new deployments will be retired." +# TRANSITION, 2026-03-31: "After March 31, 2026, new virtual networks will default to using private subnets, +# meaning that an explicit outbound method must be enabled in order to reach public endpoints on the Internet +# and within Microsoft." # https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/default-outbound-access # We're using `-DefaultOutboundAccess $false` to opt-in early. -$SubnetName = $ResourceGroupName + '-Subnet' +$SubnetName = "$ResourceGroupName-Subnet" $Subnet = New-AzVirtualNetworkSubnetConfig ` -Name $SubnetName ` -AddressPrefix '10.0.0.0/16' ` @@ -151,7 +157,7 @@ $Subnet = New-AzVirtualNetworkSubnetConfig ` #################################################################################################### Display-ProgressBar -Status 'Creating virtual network' -$VirtualNetworkName = $ResourceGroupName + '-Network' +$VirtualNetworkName = "$ResourceGroupName-Network" $VirtualNetwork = New-AzVirtualNetwork ` -Name $VirtualNetworkName ` -ResourceGroupName $ResourceGroupName ` @@ -162,7 +168,7 @@ $VirtualNetwork = New-AzVirtualNetwork ` #################################################################################################### Display-ProgressBar -Status 'Creating network interface' -$NicName = $ResourceGroupName + '-NIC' +$NicName = "$ResourceGroupName-NIC" $Nic = New-AzNetworkInterface ` -Name $NicName ` -ResourceGroupName $ResourceGroupName ` @@ -295,7 +301,7 @@ Set-AzVM ` #################################################################################################### Display-ProgressBar -Status 'Creating gallery' -$GalleryName = 'StlBuild_' + $CurrentDate.ToString('yyyy_MM_ddTHHmm') + '_Gallery' +$GalleryName = "$ResourceGroupName-Gallery" -replace '-', '_' $Gallery = New-AzGallery ` -Location $Location ` -ResourceGroupName $ResourceGroupName ` @@ -314,7 +320,7 @@ New-AzRoleAssignment ` #################################################################################################### Display-ProgressBar -Status 'Creating image definition' -$ImageDefinitionName = $ResourceGroupName + '-ImageDefinition' +$ImageDefinitionName = "$ResourceGroupName-ImageDefinition" $FeatureTrustedLaunch = @{ Name = 'SecurityType'; Value = 'TrustedLaunch'; } $FeatureNVMe = @{ Name = 'DiskControllerTypes'; Value = 'SCSI, NVMe'; } $ImageDefinitionFeatures = @($FeatureTrustedLaunch, $FeatureNVMe) @@ -352,7 +358,7 @@ Register-AzResourceProvider ` #################################################################################################### Display-ProgressBar -Status 'Creating 1ES image' -$ImageName = $ResourceGroupName + '-Image' +$ImageName = "$ResourceGroupName-Image" New-AzResource ` -Location $Location ` -ResourceGroupName $ResourceGroupName ` @@ -364,14 +370,14 @@ New-AzResource ` #################################################################################################### Display-ProgressBar -Status 'Creating 1ES Hosted Pool' -$PoolName = $ResourceGroupName + '-Pool' +$PoolName = "$ResourceGroupName-Pool" $PoolProperties = @{ 'organization' = 'https://dev.azure.com/vclibs' 'projects' = @('STL') 'sku' = @{ 'name' = $VMSize; 'tier' = 'StandardSSD'; 'enableSpot' = $false; } 'images' = @(@{ 'imageName' = $ImageName; 'poolBufferPercentage' = '100'; }) - 'maxPoolSize' = 64 + 'maxPoolSize' = $PoolSize 'agentProfile' = @{ 'type' = 'Stateless'; } } diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index d27cf236c4a..62f28d19a93 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -19,6 +19,16 @@ if ($Env:COMPUTERNAME -cne 'PROTOTYPE') { Write-Error 'You should not run provision-image.ps1 on your local machine.' } +if ($Env:PROCESSOR_ARCHITECTURE -ceq 'AMD64') { + Write-Host 'Provisioning x64.' + $Provisioning_x64 = $true +} elseif ($Env:PROCESSOR_ARCHITECTURE -ceq 'ARM64') { + Write-Host 'Provisioning ARM64.' + $Provisioning_x64 = $false +} else { + Write-Error "Unrecognized PROCESSOR_ARCHITECTURE: '$Env:PROCESSOR_ARCHITECTURE'" +} + $VisualStudioWorkloads = @( 'Microsoft.VisualStudio.Component.VC.ASAN', 'Microsoft.VisualStudio.Component.VC.CLI.Support', @@ -31,6 +41,10 @@ $VisualStudioWorkloads = @( 'Microsoft.VisualStudio.Component.Windows11SDK.26100' ) +# https://learn.microsoft.com/en-us/visualstudio/install/visual-studio-on-arm-devices +# "There's a single installer for both Visual Studio x64 and Visual Studio Arm64 architectures. +# The Visual Studio Installer detects whether the system architecture is Arm64. +# If it is, the installer downloads and installs the Arm64 version of Visual Studio." $VisualStudioUrl = 'https://aka.ms/vs/18/insiders/vs_Community.exe' $VisualStudioArgs = @('--quiet', '--norestart', '--wait', '--nocache') foreach ($workload in $VisualStudioWorkloads) { @@ -39,13 +53,27 @@ foreach ($workload in $VisualStudioWorkloads) { } # https://github.com/PowerShell/PowerShell/releases/latest -$PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.5.2/PowerShell-7.5.2-win-x64.msi' +if ($Provisioning_x64) { + $PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.5.3/PowerShell-7.5.3-win-x64.msi' +} else { + $PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.5.3/PowerShell-7.5.3-win-arm64.msi' +} $PowerShellArgs = @('/quiet', '/norestart') -$PythonUrl = 'https://www.python.org/ftp/python/3.13.7/python-3.13.7-amd64.exe' +# https://www.python.org +if ($Provisioning_x64) { + $PythonUrl = 'https://www.python.org/ftp/python/3.14.0/python-3.14.0-amd64.exe' +} else { + $PythonUrl = 'https://www.python.org/ftp/python/3.14.0/python-3.14.0-arm64.exe' +} $PythonArgs = @('/quiet', 'InstallAllUsers=1', 'PrependPath=1', 'CompileAll=1', 'Include_doc=0') -$CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_551.61_windows.exe' +# https://developer.nvidia.com/cuda-toolkit +if ($Provisioning_x64) { + $CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_551.61_windows.exe' +} else { + $CudaUrl = 'CUDA is not installed for ARM64' +} $CudaArgs = @('-s', '-n') <# @@ -91,10 +119,16 @@ Function DownloadAndInstall { } else { Write-Error "Installation failed! Exited with $exitCode." } + } catch { + Write-Error "Installation failed! Exception: $($_.Exception.Message)" + } + try { + # Briefly sleep before removing the installer, attempting to avoid "Access to the path '$installerPath' is denied." + Start-Sleep -Seconds 5 Remove-Item -Path $installerPath } catch { - Write-Error "Installation failed! Exception: $($_.Exception.Message)" + Write-Error "Remove-Item failed! Exception: $($_.Exception.Message)" } } @@ -104,16 +138,24 @@ Write-Host "Old PowerShell version: $($PSVersionTable.PSVersion)" # Skip a blank line to improve the output. (cmd /c ver)[1] -DownloadAndInstall -Name 'PowerShell' -Url $PowerShellUrl -Args $PowerShellArgs -DownloadAndInstall -Name 'Python' -Url $PythonUrl -Args $PythonArgs -DownloadAndInstall -Name 'Visual Studio' -Url $VisualStudioUrl -Args $VisualStudioArgs -DownloadAndInstall -Name 'CUDA' -Url $CudaUrl -Args $CudaArgs +DownloadAndInstall -Name 'PowerShell' -Url $PowerShellUrl -Args $PowerShellArgs +DownloadAndInstall -Name 'Python' -Url $PythonUrl -Args $PythonArgs +DownloadAndInstall -Name 'Visual Studio' -Url $VisualStudioUrl -Args $VisualStudioArgs +if ($Provisioning_x64) { + DownloadAndInstall -Name 'CUDA' -Url $CudaUrl -Args $CudaArgs +} Write-Host 'Setting environment variables...' # The STL's PR/CI builds are totally unrepresentative of customer usage. [Environment]::SetEnvironmentVariable('VSCMD_SKIP_SENDTELEMETRY', '1', 'Machine') +Write-Host 'Enabling long paths...' + +# https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell +New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' ` + -Value 1 -PropertyType DWORD -Force | Out-Null + # Tell create-1es-hosted-pool.ps1 that we succeeded. Write-Host 'PROVISION_IMAGE_SUCCEEDED' diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 893042036f1..35c33ddc063 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.31.0) +cmake_minimum_required(VERSION 4.1.1) project(msvc_standard_libraries_benchmarks LANGUAGES CXX) if(DEFINED STL_BINARY_DIR) @@ -102,8 +102,10 @@ endfunction() add_benchmark(adjacent_difference src/adjacent_difference.cpp) add_benchmark(adjacent_find src/adjacent_find.cpp) +add_benchmark(any_swap src/any_swap.cpp) add_benchmark(bitset_from_string src/bitset_from_string.cpp) add_benchmark(bitset_to_string src/bitset_to_string.cpp) +add_benchmark(charconv_floats src/charconv_floats.cpp) add_benchmark(efficient_nonlocking_print src/efficient_nonlocking_print.cpp) add_benchmark(filesystem src/filesystem.cpp) add_benchmark(fill src/fill.cpp) @@ -128,8 +130,10 @@ add_benchmark(remove src/remove.cpp) add_benchmark(replace src/replace.cpp) add_benchmark(reverse src/reverse.cpp) add_benchmark(rotate src/rotate.cpp) +add_benchmark(sample src/sample.cpp) add_benchmark(search src/search.cpp) add_benchmark(search_n src/search_n.cpp) +add_benchmark(shuffle src/shuffle.cpp) add_benchmark(std_copy src/std_copy.cpp) add_benchmark(sv_equal src/sv_equal.cpp) add_benchmark(swap_ranges src/swap_ranges.cpp) diff --git a/benchmarks/inc/utility.hpp b/benchmarks/inc/utility.hpp index 032e8f9a9b9..a8f9eda29a5 100644 --- a/benchmarks/inc/utility.hpp +++ b/benchmarks/inc/utility.hpp @@ -7,22 +7,26 @@ #include #include #include +#include #include template class Alloc = std::allocator> std::vector> random_vector(size_t n) { - std::mt19937_64 prng; - std::vector> res(n); + std::mt19937_64 prng; + if constexpr (std::is_same_v) { + std::generate(res.begin(), res.end(), [&prng] { return static_cast(prng() & 1); }); + } else { // Here, the type Contained can be char, int, aggregate, or non_trivial where Data is char or int. // (aggregate and non_trivial are defined in udt.hpp.) // static_cast silences truncation warnings when Contained is directly char or int, // but is insufficient for aggregate or non_trivial. #pragma warning(push) #pragma warning(disable : 4244) // warning C4244: conversion from 'uint64_t' to 'Data', possible loss of data - std::generate(res.begin(), res.end(), [&prng] { return static_cast(prng()); }); + std::generate(res.begin(), res.end(), [&prng] { return static_cast(prng()); }); #pragma warning(pop) + } return res; } diff --git a/benchmarks/src/any_swap.cpp b/benchmarks/src/any_swap.cpp new file mode 100644 index 00000000000..4d2ec21744d --- /dev/null +++ b/benchmarks/src/any_swap.cpp @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#include +#include +#include + +using trivial = std::array; +static_assert(std::is_trivially_copyable_v); + +struct small { + std::array c{}; + small() = default; + small(const small&) = default; + small& operator=(const small&) = default; + small(small&&) noexcept = default; + small& operator=(small&&) noexcept = default; + ~small() {} +}; +static_assert(!std::is_trivially_copyable_v); +static_assert(std::is_nothrow_move_constructible_v); + +using large = std::array; + +template +void bm(benchmark::State& state) { + std::any a = T{}; + std::any b = T{}; + + for (auto _ : state) { + a.swap(b); + benchmark::DoNotOptimize(a); + benchmark::DoNotOptimize(b); + } +} + +BENCHMARK(bm); +BENCHMARK(bm); +BENCHMARK(bm); + +BENCHMARK_MAIN(); diff --git a/benchmarks/src/charconv_floats.cpp b/benchmarks/src/charconv_floats.cpp new file mode 100644 index 00000000000..7da1eb87fd0 --- /dev/null +++ b/benchmarks/src/charconv_floats.cpp @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +void verify(const bool b) { + if (!b) { + puts("FAIL"); + exit(EXIT_FAILURE); + } +} + +enum class RoundTrip { Sci, Fix, Gen, Hex, Lossy }; + +consteval chars_format chars_format_from_RoundTrip(const RoundTrip rt) { + switch (rt) { + case RoundTrip::Sci: + return chars_format::scientific; + case RoundTrip::Fix: + return chars_format::fixed; + case RoundTrip::Gen: + return chars_format::general; + case RoundTrip::Hex: + return chars_format::hex; + case RoundTrip::Lossy: + default: + exit(EXIT_FAILURE); + } +} + +template +void test_to_chars(benchmark::State& state) { + constexpr size_t n = 2'000'000; // how many floating-point values to test + vector vec; + vec.reserve(n); + + { + mt19937_64 mt64; + while (vec.size() < n) { + using Integral = conditional_t; + const Integral val = static_cast(mt64()); + constexpr Integral inf_nan = sizeof(Floating) == 4 ? 0x7F800000U : 0x7FF0000000000000ULL; + if ((val & inf_nan) == inf_nan) { + continue; // skip INF/NAN + } + vec.push_back(bit_cast(val)); + } + } + + char buf[2'000]; // more than enough + + { + auto it = vec.begin(); + for (auto _ : state) { + auto result = to_chars(buf, end(buf), *it, Args...); + + benchmark::DoNotOptimize(result.ptr); + benchmark::DoNotOptimize(buf); + + ++it; + if (it == vec.end()) { + it = vec.begin(); + } + } + } + + for (const auto& elem : vec) { + const auto result = to_chars(buf, end(buf), elem, Args...); + verify(result.ec == errc{}); + + if constexpr (Rt == RoundTrip::Lossy) { + // skip lossy conversions + } else { + Floating round_trip; + const auto from_result = from_chars(buf, result.ptr, round_trip, chars_format_from_RoundTrip(Rt)); + verify(from_result.ec == errc{}); + verify(from_result.ptr == result.ptr); + verify(round_trip == elem); + } + } +} + +BENCHMARK(test_to_chars)->Name("STL_float_plain_shortest"); +BENCHMARK(test_to_chars)->Name("STL_double_plain_shortest"); +BENCHMARK(test_to_chars)->Name("STL_float_scientific_shortest"); +BENCHMARK(test_to_chars)->Name("STL_double_scientific_shortest"); +BENCHMARK(test_to_chars)->Name("STL_float_fixed_shortest"); +BENCHMARK(test_to_chars)->Name("STL_double_fixed_shortest"); +BENCHMARK(test_to_chars)->Name("STL_float_general_shortest"); +BENCHMARK(test_to_chars)->Name("STL_double_general_shortest"); +BENCHMARK(test_to_chars)->Name("STL_float_hex_shortest"); +BENCHMARK(test_to_chars)->Name("STL_double_hex_shortest"); +BENCHMARK(test_to_chars)->Name("STL_float_scientific_8"); +BENCHMARK(test_to_chars)->Name("STL_double_scientific_16"); +BENCHMARK(test_to_chars)->Name("STL_float_fixed_6_lossy"); +BENCHMARK(test_to_chars)->Name("STL_double_fixed_6_lossy"); +BENCHMARK(test_to_chars)->Name("STL_float_general_9"); +BENCHMARK(test_to_chars)->Name("STL_double_general_17"); +BENCHMARK(test_to_chars)->Name("STL_float_hex_6"); +BENCHMARK(test_to_chars)->Name("STL_double_hex_13"); + +BENCHMARK_MAIN(); diff --git a/benchmarks/src/mismatch.cpp b/benchmarks/src/mismatch.cpp index f604ceff4fb..9d4c79f5c7b 100644 --- a/benchmarks/src/mismatch.cpp +++ b/benchmarks/src/mismatch.cpp @@ -19,13 +19,24 @@ enum class op { lexi, }; -template +struct color { + uint16_t h; + uint16_t s; + uint16_t l; + + bool operator==(const color&) const = default; +}; + +constexpr color c1{30000, 40000, 20000}; +constexpr color c2{30000, 40000, 30000}; + +template void bm(benchmark::State& state) { - vector> a(static_cast(state.range(0)), T{'.'}); - vector> b(static_cast(state.range(0)), T{'.'}); + vector> a(static_cast(state.range(0)), MatchVal); + vector> b(static_cast(state.range(0)), MatchVal); if (state.range(1) != no_pos) { - b.at(static_cast(state.range(1))) = 'x'; + b.at(static_cast(state.range(1))) = MismatchVal; } for (auto _ : state) { @@ -45,6 +56,7 @@ BENCHMARK(bm)->Apply(common_args); BENCHMARK(bm)->Apply(common_args); BENCHMARK(bm)->Apply(common_args); BENCHMARK(bm)->Apply(common_args); +BENCHMARK(bm)->Apply(common_args); BENCHMARK(bm)->Apply(common_args); // still optimized without vector algorithms using memcmp BENCHMARK(bm)->Apply(common_args); // optimized with vector algorithms only diff --git a/benchmarks/src/random_integer_generation.cpp b/benchmarks/src/random_integer_generation.cpp index 7a65f2b1f2e..dcc441fa7a4 100644 --- a/benchmarks/src/random_integer_generation.cpp +++ b/benchmarks/src/random_integer_generation.cpp @@ -46,7 +46,7 @@ BENCHMARK(BM_discard)->Range(0, 1 << 18); BENCHMARK(BM_discard)->Range(0, 1 << 18); BENCHMARK(BM_discard)->Range(0, 1 << 18); -/// Support machinery for testing _Rng_from_urng and _Rng_from_urng_v2 +/// Support machinery for testing _Rng_from_urng_v2 std::uint32_t GetMax() { std::mt19937 gen; @@ -58,15 +58,6 @@ const std::uint32_t maximum = GetMax(); // random divisor to prevent strength re /// Test mt19937 -void BM_raw_mt19937_old(benchmark::State& state) { - std::mt19937 gen; - std::_Rng_from_urng rng(gen); - for (auto _ : state) { - benchmark::DoNotOptimize(rng(maximum)); - } -} -BENCHMARK(BM_raw_mt19937_old); - void BM_raw_mt19937_new(benchmark::State& state) { std::mt19937 gen; std::_Rng_from_urng_v2 rng(gen); @@ -78,15 +69,6 @@ BENCHMARK(BM_raw_mt19937_new); /// Test mt19937_64 -void BM_raw_mt19937_64_old(benchmark::State& state) { - std::mt19937_64 gen; - std::_Rng_from_urng rng(gen); - for (auto _ : state) { - benchmark::DoNotOptimize(rng(maximum)); - } -} -BENCHMARK(BM_raw_mt19937_64_old); - void BM_raw_mt19937_64_new(benchmark::State& state) { std::mt19937_64 gen; std::_Rng_from_urng_v2 rng(gen); @@ -98,15 +80,6 @@ BENCHMARK(BM_raw_mt19937_64_new); /// Test minstd_rand -void BM_raw_lcg_old(benchmark::State& state) { - std::minstd_rand gen; - std::_Rng_from_urng rng(gen); - for (auto _ : state) { - benchmark::DoNotOptimize(rng(maximum)); - } -} -BENCHMARK(BM_raw_lcg_old); - void BM_raw_lcg_new(benchmark::State& state) { std::minstd_rand gen; std::_Rng_from_urng_v2 rng(gen); diff --git a/benchmarks/src/sample.cpp b/benchmarks/src/sample.cpp new file mode 100644 index 00000000000..e27776f2420 --- /dev/null +++ b/benchmarks/src/sample.cpp @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std; + +enum class alg_type { std_fn, rng }; + +template +void bm_sample(benchmark::State& state) { + static_assert(is_unsigned_v, "T must be unsigned so iota() doesn't have to worry about overflow."); + + const auto population_size = static_cast(state.range(0)); + const auto sampled_size = static_cast(state.range(1)); + + vector population(population_size); + vector sampled(sampled_size); + iota(population.begin(), population.end(), T{0}); + mt19937_64 urbg; + + for (auto _ : state) { + benchmark::DoNotOptimize(population); + if constexpr (Alg == alg_type::rng) { + ranges::sample(population, sampled.begin(), sampled_size, urbg); + } else { + sample(population.begin(), population.end(), sampled.begin(), sampled_size, urbg); + } + benchmark::DoNotOptimize(sampled); + } +} + +void common_args(auto bm) { + bm->Args({1 << 20, 1 << 15}); +} + +BENCHMARK(bm_sample)->Apply(common_args); +BENCHMARK(bm_sample)->Apply(common_args); +BENCHMARK(bm_sample)->Apply(common_args); +BENCHMARK(bm_sample)->Apply(common_args); + +BENCHMARK(bm_sample)->Apply(common_args); +BENCHMARK(bm_sample)->Apply(common_args); +BENCHMARK(bm_sample)->Apply(common_args); +BENCHMARK(bm_sample)->Apply(common_args); + +BENCHMARK_MAIN(); diff --git a/benchmarks/src/shuffle.cpp b/benchmarks/src/shuffle.cpp new file mode 100644 index 00000000000..b87f7f9ee89 --- /dev/null +++ b/benchmarks/src/shuffle.cpp @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std; + +enum class alg_type { std_fn, rng }; + +template +void bm_shuffle(benchmark::State& state) { + static_assert(is_unsigned_v, "T must be unsigned so iota() doesn't have to worry about overflow."); + + const auto n = static_cast(state.range(0)); + vector v(n); + iota(v.begin(), v.end(), T{0}); + mt19937_64 urbg; + + for (auto _ : state) { + benchmark::DoNotOptimize(v); + if constexpr (Alg == alg_type::rng) { + ranges::shuffle(v, urbg); + } else { + shuffle(v.begin(), v.end(), urbg); + } + } +} + +void common_args(auto bm) { + bm->Arg(1 << 20); +} + +BENCHMARK(bm_shuffle)->Apply(common_args); +BENCHMARK(bm_shuffle)->Apply(common_args); +BENCHMARK(bm_shuffle)->Apply(common_args); +BENCHMARK(bm_shuffle)->Apply(common_args); + +BENCHMARK(bm_shuffle)->Apply(common_args); +BENCHMARK(bm_shuffle)->Apply(common_args); +BENCHMARK(bm_shuffle)->Apply(common_args); +BENCHMARK(bm_shuffle)->Apply(common_args); + +BENCHMARK_MAIN(); diff --git a/benchmarks/src/vector_bool_copy.cpp b/benchmarks/src/vector_bool_copy.cpp index 6cfc2b4f95f..9c7bb5827d1 100644 --- a/benchmarks/src/vector_bool_copy.cpp +++ b/benchmarks/src/vector_bool_copy.cpp @@ -8,84 +8,93 @@ #include #include -using namespace std; +#include "utility.hpp" -vector createRandomVector(const size_t size) { - static mt19937 gen; - vector result(size); - generate_n(result.begin(), size, [] { return bernoulli_distribution{0.5}(gen); }); - return result; -} +using namespace std; void copy_block_aligned(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); copy(source.cbegin(), source.cend(), dest.begin()); + benchmark::DoNotOptimize(dest); } } void copy_source_misaligned(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); copy(source.cbegin() + 1, source.cend(), dest.begin()); + benchmark::DoNotOptimize(dest); } } void copy_dest_misaligned(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); copy(source.cbegin(), source.cend() - 1, dest.begin() + 1); + benchmark::DoNotOptimize(dest); } } // Special benchmark for matching char alignment void copy_matching_alignment(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); copy(source.cbegin() + 5, source.cend(), dest.begin() + 5); + benchmark::DoNotOptimize(dest); } } // Special benchmarks for single block corner case void copy_both_single_blocks(benchmark::State& state) { - const vector source = createRandomVector(50); + vector source = random_vector(50); vector dest(50, false); const size_t length = 20; for (auto _ : state) { + benchmark::DoNotOptimize(source); copy(source.cbegin() + 5, source.cbegin() + 5 + length, dest.begin() + 5); + benchmark::DoNotOptimize(dest); } } void copy_source_single_block(benchmark::State& state) { - const vector source = createRandomVector(50); + vector source = random_vector(50); vector dest(50, false); const size_t length = 20; for (auto _ : state) { + benchmark::DoNotOptimize(source); copy(source.cbegin() + 5, source.cbegin() + 5 + length, dest.begin() + 25); + benchmark::DoNotOptimize(dest); } } void copy_dest_single_block(benchmark::State& state) { - const vector source = createRandomVector(50); + vector source = random_vector(50); vector dest(50, false); const size_t length = 20; for (auto _ : state) { + benchmark::DoNotOptimize(source); copy(source.cbegin() + 25, source.cbegin() + 25 + length, dest.begin() + 5); + benchmark::DoNotOptimize(dest); } } diff --git a/benchmarks/src/vector_bool_copy_n.cpp b/benchmarks/src/vector_bool_copy_n.cpp index 9952c261091..2ade38c90f4 100644 --- a/benchmarks/src/vector_bool_copy_n.cpp +++ b/benchmarks/src/vector_bool_copy_n.cpp @@ -8,84 +8,93 @@ #include #include -using namespace std; +#include "utility.hpp" -vector createRandomVector(const size_t size) { - static mt19937 gen; - vector result(size); - generate_n(result.begin(), size, [] { return bernoulli_distribution{0.5}(gen); }); - return result; -} +using namespace std; void copy_n_block_aligned(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); copy_n(source.cbegin(), size, dest.begin()); + benchmark::DoNotOptimize(dest); } } void copy_n_source_misaligned(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); copy_n(source.cbegin() + 1, size - 1, dest.begin()); + benchmark::DoNotOptimize(dest); } } void copy_n_dest_misaligned(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); copy_n(source.cbegin(), size - 1, dest.begin() + 1); + benchmark::DoNotOptimize(dest); } } // Special benchmark for matching char alignment void copy_n_matching_alignment(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); copy_n(source.cbegin() + 5, size - 5, dest.begin() + 5); + benchmark::DoNotOptimize(dest); } } // Special benchmarks for single block corner case void copy_n_both_single_blocks(benchmark::State& state) { - const vector source = createRandomVector(50); + vector source = random_vector(50); vector dest(50, false); const size_t length = 20; for (auto _ : state) { + benchmark::DoNotOptimize(source); copy_n(source.cbegin() + 5, length, dest.begin() + 5); + benchmark::DoNotOptimize(dest); } } void copy_n_source_single_block(benchmark::State& state) { - const vector source = createRandomVector(50); + vector source = random_vector(50); vector dest(50, false); const size_t length = 20; for (auto _ : state) { + benchmark::DoNotOptimize(source); copy_n(source.cbegin() + 5, length, dest.begin() + 25); + benchmark::DoNotOptimize(dest); } } void copy_n_dest_single_block(benchmark::State& state) { - const vector source = createRandomVector(50); + vector source = random_vector(50); vector dest(50, false); const size_t length = 20; for (auto _ : state) { + benchmark::DoNotOptimize(source); copy_n(source.cbegin() + 25, length, dest.begin() + 5); + benchmark::DoNotOptimize(dest); } } diff --git a/benchmarks/src/vector_bool_count.cpp b/benchmarks/src/vector_bool_count.cpp index 1d8f174a37e..65ad7fb9b91 100644 --- a/benchmarks/src/vector_bool_count.cpp +++ b/benchmarks/src/vector_bool_count.cpp @@ -8,19 +8,13 @@ #include #include -using namespace std; +#include "utility.hpp" -vector createRandomVector(const size_t size) { - mt19937 gen; - bernoulli_distribution dist{0.5}; - vector result(size); - generate(result.begin(), result.end(), [&] { return dist(gen); }); - return result; -} +using namespace std; void count_aligned(benchmark::State& state) { const auto size = static_cast(state.range(0)); - vector v = createRandomVector(size); + vector v = random_vector(size); bool b = false; @@ -33,7 +27,6 @@ void count_aligned(benchmark::State& state) { } } - BENCHMARK(count_aligned)->RangeMultiplier(64)->Range(64, 64 << 10); BENCHMARK_MAIN(); diff --git a/benchmarks/src/vector_bool_move.cpp b/benchmarks/src/vector_bool_move.cpp index 56485c53b8c..a8c3e693616 100644 --- a/benchmarks/src/vector_bool_move.cpp +++ b/benchmarks/src/vector_bool_move.cpp @@ -8,84 +8,93 @@ #include #include -using namespace std; +#include "utility.hpp" -vector createRandomVector(const size_t size) { - static mt19937 gen; - vector result(size); - generate_n(result.begin(), size, [] { return bernoulli_distribution{0.5}(gen); }); - return result; -} +using namespace std; void move_block_aligned(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); move(source.cbegin(), source.cend(), dest.begin()); + benchmark::DoNotOptimize(dest); } } void move_source_misaligned(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); move(source.cbegin() + 1, source.cend(), dest.begin()); + benchmark::DoNotOptimize(dest); } } void move_dest_misaligned(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); move(source.cbegin(), source.cend() - 1, dest.begin() + 1); + benchmark::DoNotOptimize(dest); } } // Special benchmark for matching char alignment void move_matching_alignment(benchmark::State& state) { - const auto size = static_cast(state.range(0)); - const vector source = createRandomVector(size); + const auto size = static_cast(state.range(0)); + vector source = random_vector(size); vector dest(size, false); for (auto _ : state) { + benchmark::DoNotOptimize(source); move(source.cbegin() + 5, source.cend(), dest.begin() + 5); + benchmark::DoNotOptimize(dest); } } // Special benchmarks for single block corner case void move_both_single_blocks(benchmark::State& state) { - const vector source = createRandomVector(50); + vector source = random_vector(50); vector dest(50, false); const size_t length = 20; for (auto _ : state) { + benchmark::DoNotOptimize(source); move(source.cbegin() + 5, source.cbegin() + 5 + length, dest.begin() + 5); + benchmark::DoNotOptimize(dest); } } void move_source_single_block(benchmark::State& state) { - const vector source = createRandomVector(50); + vector source = random_vector(50); vector dest(50, false); const size_t length = 20; for (auto _ : state) { + benchmark::DoNotOptimize(source); move(source.cbegin() + 5, source.cbegin() + 5 + length, dest.begin() + 25); + benchmark::DoNotOptimize(dest); } } void move_dest_single_block(benchmark::State& state) { - const vector source = createRandomVector(50); + vector source = random_vector(50); vector dest(50, false); const size_t length = 20; for (auto _ : state) { + benchmark::DoNotOptimize(source); move(source.cbegin() + 25, source.cbegin() + 25 + length, dest.begin() + 5); + benchmark::DoNotOptimize(dest); } } diff --git a/boost-math b/boost-math index 4d0885ae44f..5e088ffe2ed 160000 --- a/boost-math +++ b/boost-math @@ -1 +1 @@ -Subproject commit 4d0885ae44f7d4ce94568339b2ae5501eb234e8f +Subproject commit 5e088ffe2ed0e237b9069e3a7352865283d8f196 diff --git a/stl/CMakeLists.txt b/stl/CMakeLists.txt index 00603335dff..6805b344ee4 100644 --- a/stl/CMakeLists.txt +++ b/stl/CMakeLists.txt @@ -73,7 +73,6 @@ set(HEADERS ${CMAKE_CURRENT_LIST_DIR}/inc/execution ${CMAKE_CURRENT_LIST_DIR}/inc/expected ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/coroutine - ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/filesystem ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/generator ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/resumable ${CMAKE_CURRENT_LIST_DIR}/inc/filesystem @@ -85,8 +84,6 @@ set(HEADERS ${CMAKE_CURRENT_LIST_DIR}/inc/functional ${CMAKE_CURRENT_LIST_DIR}/inc/future ${CMAKE_CURRENT_LIST_DIR}/inc/generator - ${CMAKE_CURRENT_LIST_DIR}/inc/hash_map - ${CMAKE_CURRENT_LIST_DIR}/inc/hash_set ${CMAKE_CURRENT_LIST_DIR}/inc/header-units.json ${CMAKE_CURRENT_LIST_DIR}/inc/initializer_list ${CMAKE_CURRENT_LIST_DIR}/inc/iomanip @@ -405,6 +402,7 @@ set(SATELLITE_DLL_SOURCES set(CMAKE_CXX_FLAGS "") set(CMAKE_CXX_FLAGS_DEBUG "") set(CMAKE_CXX_FLAGS_RELEASE "") +set(CMAKE_MSVC_RUNTIME_CHECKS "") set(CMAKE_CXX_STANDARD_LIBRARIES "kernel32.lib") set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "kernel32.lib") set(CMAKE_MSVC_RUNTIME_LIBRARY "") diff --git a/stl/inc/__msvc_all_public_headers.hpp b/stl/inc/__msvc_all_public_headers.hpp index cbf7a27d92d..da0e1103797 100644 --- a/stl/inc/__msvc_all_public_headers.hpp +++ b/stl/inc/__msvc_all_public_headers.hpp @@ -29,8 +29,6 @@ #endif // !defined(_SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING) #define _SILENCE_CXX20_CISO646_REMOVED_WARNING -#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING -#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS // Core STL Headers #include @@ -92,8 +90,6 @@ #include #include #include -#include -#include #include #include #include @@ -160,9 +156,6 @@ #include #include -// Non-Core Experimental Headers -#include - #endif // !defined(_CORE_HEADERS_ONLY) #ifndef _MSVC_TESTING_NVCC diff --git a/stl/inc/__msvc_chrono.hpp b/stl/inc/__msvc_chrono.hpp index 3e854d8e27a..3f92cd0de52 100644 --- a/stl/inc/__msvc_chrono.hpp +++ b/stl/inc/__msvc_chrono.hpp @@ -25,13 +25,20 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +// TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") +#undef msvc +#undef no_specializations + _STD_BEGIN namespace chrono { _EXPORT_STD template struct treat_as_floating_point : is_floating_point<_Rep> {}; // tests for floating-point type _EXPORT_STD template - constexpr bool treat_as_floating_point_v = treat_as_floating_point<_Rep>::value; + _NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool treat_as_floating_point_v = + treat_as_floating_point<_Rep>::value; _EXPORT_STD template struct duration_values { // gets arithmetic properties of a type @@ -53,7 +60,7 @@ namespace chrono { #if _HAS_CXX20 _EXPORT_STD template - constexpr bool is_clock_v = requires { + _NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool is_clock_v = requires { typename _Clock::rep; typename _Clock::period; typename _Clock::duration; @@ -62,7 +69,7 @@ namespace chrono { _Clock::now(); }; _EXPORT_STD template - struct is_clock : bool_constant> {}; + struct _NO_SPECIALIZATIONS_CITING("N5014 [time.traits.is.clock]/2") is_clock : bool_constant> {}; template constexpr bool _Is_clock_v = is_clock_v<_Clock>; @@ -688,6 +695,10 @@ namespace chrono { } // namespace chrono _STD_END +// TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") +#pragma pop_macro("msvc") + #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/__msvc_filebuf.hpp b/stl/inc/__msvc_filebuf.hpp index 7b2846b020c..009265e0a19 100644 --- a/stl/inc/__msvc_filebuf.hpp +++ b/stl/inc/__msvc_filebuf.hpp @@ -18,7 +18,7 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new -// TRANSITION, ABI: The _Path_ish functions accepting filesystem::path or experimental::filesystem::path are templates +// TRANSITION, ABI: The _Path_ish functions accepting filesystem::path are templates // which always use the same types as a workaround for user code deriving from iostreams types and // __declspec(dllexport)ing the derived types. Adding member functions to iostreams broke the ABI of such DLLs. // Deriving and __declspec(dllexport)ing standard library types is not supported, but in this particular case @@ -31,36 +31,6 @@ namespace filesystem { } #endif // _HAS_CXX17 -#ifndef _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM -#ifdef _M_CEE -#define _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM 0 -#else // ^^^ defined(_M_CEE) / !defined(_M_CEE) vvv -#define _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM 1 -#endif // ^^^ !defined(_M_CEE) ^^^ -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM -namespace experimental { - namespace filesystem { - inline namespace v1 { - class path; - } - } // namespace filesystem -} // namespace experimental -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - -template -constexpr bool _Is_any_path = _Is_any_of_v<_Ty -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - , - experimental::filesystem::path -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM -#if _HAS_CXX17 - , - filesystem::path -#endif // _HAS_CXX17 - >; - extern "C++" _CRTIMP2_PURE FILE* __CLRCALL_PURE_OR_CDECL _Fiopen(const char*, ios_base::openmode, int); extern "C++" _CRTIMP2_PURE FILE* __CLRCALL_PURE_OR_CDECL _Fiopen(const wchar_t*, ios_base::openmode, int); @@ -325,15 +295,6 @@ class basic_filebuf : public basic_streambuf<_Elem, _Traits> { // stream buffer return open(_Str.c_str(), _Mode, _Prot); } -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - template - basic_filebuf* open( - const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode, int _Prot = ios_base::_Default_open_prot) { - // _Prot is an extension - return open(_Path.c_str(), _Mode, _Prot); - } -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - #if _HAS_CXX17 template basic_filebuf* open( diff --git a/stl/inc/__msvc_format_ucd_tables.hpp b/stl/inc/__msvc_format_ucd_tables.hpp index 15699df88f1..c72dcf25439 100644 --- a/stl/inc/__msvc_format_ucd_tables.hpp +++ b/stl/inc/__msvc_format_ucd_tables.hpp @@ -103,6 +103,8 @@ struct _Unicode_property_data { // The following static data tables are generated from the Unicode character database. // _Grapheme_Break_property_data comes from ucd/auxiliary/GraphemeBreakProperty.txt. // +// _Indic_Conjunct_Break_property_data comes from ucd/DerivedCoreProperties.txt. +// // _Extended_Pictographic_property_data comes from ucd/emoji/emoji-data.txt. // // __printable_property_data comes from ucd/extracted/DerivedGeneralCategory.txt. @@ -131,8 +133,8 @@ struct _Unicode_property_data { // Codepoint ranges may not overlap, and, within one property, a codepoint may only appear once. Furthermore the // codepoint lower bounds appear in sorted (ascending) order. -// GraphemeBreakProperty-15.0.0.txt -// Date: 2022-04-27, 17:07:38 GMT +// GraphemeBreakProperty-16.0.0.txt +// Date: 2024-05-31, 18:09:38 GMT enum class _Grapheme_Break_property_values : uint8_t { _CR_value, _Control_value, @@ -150,133 +152,133 @@ enum class _Grapheme_Break_property_values : uint8_t { _No_value = 255 }; -// GraphemeBreakProperty-15.0.0.txt -// Date: 2022-04-27, 17:07:38 GMT -inline constexpr _Unicode_property_data<_Grapheme_Break_property_values, 1371, false> _Grapheme_Break_property_data{ +// GraphemeBreakProperty-16.0.0.txt +// Date: 2024-05-31, 18:09:38 GMT +inline constexpr _Unicode_property_data<_Grapheme_Break_property_values, 1376, false> _Grapheme_Break_property_data{ {0x0, 0xa, 0xb, 0xd, 0xe, 0x7f, 0xad, 0x300, 0x483, 0x591, 0x5bf, 0x5c1, 0x5c4, 0x5c7, 0x600, 0x610, 0x61c, 0x64b, 0x670, 0x6d6, 0x6dd, 0x6df, 0x6e7, 0x6ea, 0x70f, 0x711, 0x730, 0x7a6, 0x7eb, 0x7fd, 0x816, 0x81b, 0x825, 0x829, - 0x859, 0x890, 0x898, 0x8ca, 0x8e2, 0x8e3, 0x903, 0x93a, 0x93b, 0x93c, 0x93e, 0x941, 0x949, 0x94d, 0x94e, 0x951, + 0x859, 0x890, 0x897, 0x8ca, 0x8e2, 0x8e3, 0x903, 0x93a, 0x93b, 0x93c, 0x93e, 0x941, 0x949, 0x94d, 0x94e, 0x951, 0x962, 0x981, 0x982, 0x9bc, 0x9be, 0x9bf, 0x9c1, 0x9c7, 0x9cb, 0x9cd, 0x9d7, 0x9e2, 0x9fe, 0xa01, 0xa03, 0xa3c, 0xa3e, 0xa41, 0xa47, 0xa4b, 0xa51, 0xa70, 0xa75, 0xa81, 0xa83, 0xabc, 0xabe, 0xac1, 0xac7, 0xac9, 0xacb, 0xacd, 0xae2, 0xafa, 0xb01, 0xb02, 0xb3c, 0xb3e, 0xb40, 0xb41, 0xb47, 0xb4b, 0xb4d, 0xb55, 0xb62, 0xb82, 0xbbe, 0xbbf, 0xbc0, 0xbc1, 0xbc6, 0xbca, 0xbcd, 0xbd7, 0xc00, 0xc01, 0xc04, 0xc3c, 0xc3e, 0xc41, 0xc46, 0xc4a, 0xc55, 0xc62, - 0xc81, 0xc82, 0xcbc, 0xcbe, 0xcbf, 0xcc0, 0xcc2, 0xcc3, 0xcc6, 0xcc7, 0xcca, 0xccc, 0xcd5, 0xce2, 0xcf3, 0xd00, - 0xd02, 0xd3b, 0xd3e, 0xd3f, 0xd41, 0xd46, 0xd4a, 0xd4d, 0xd4e, 0xd57, 0xd62, 0xd81, 0xd82, 0xdca, 0xdcf, 0xdd0, - 0xdd2, 0xdd6, 0xdd8, 0xddf, 0xdf2, 0xe31, 0xe33, 0xe34, 0xe47, 0xeb1, 0xeb3, 0xeb4, 0xec8, 0xf18, 0xf35, 0xf37, - 0xf39, 0xf3e, 0xf71, 0xf7f, 0xf80, 0xf86, 0xf8d, 0xf99, 0xfc6, 0x102d, 0x1031, 0x1032, 0x1039, 0x103b, 0x103d, - 0x1056, 0x1058, 0x105e, 0x1071, 0x1082, 0x1084, 0x1085, 0x108d, 0x109d, 0x1100, 0x1160, 0x11a8, 0x135d, 0x1712, - 0x1715, 0x1732, 0x1734, 0x1752, 0x1772, 0x17b4, 0x17b6, 0x17b7, 0x17be, 0x17c6, 0x17c7, 0x17c9, 0x17dd, 0x180b, - 0x180e, 0x180f, 0x1885, 0x18a9, 0x1920, 0x1923, 0x1927, 0x1929, 0x1930, 0x1932, 0x1933, 0x1939, 0x1a17, 0x1a19, - 0x1a1b, 0x1a55, 0x1a56, 0x1a57, 0x1a58, 0x1a60, 0x1a62, 0x1a65, 0x1a6d, 0x1a73, 0x1a7f, 0x1ab0, 0x1b00, 0x1b04, - 0x1b34, 0x1b3b, 0x1b3c, 0x1b3d, 0x1b42, 0x1b43, 0x1b6b, 0x1b80, 0x1b82, 0x1ba1, 0x1ba2, 0x1ba6, 0x1ba8, 0x1baa, - 0x1bab, 0x1be6, 0x1be7, 0x1be8, 0x1bea, 0x1bed, 0x1bee, 0x1bef, 0x1bf2, 0x1c24, 0x1c2c, 0x1c34, 0x1c36, 0x1cd0, - 0x1cd4, 0x1ce1, 0x1ce2, 0x1ced, 0x1cf4, 0x1cf7, 0x1cf8, 0x1dc0, 0x200b, 0x200c, 0x200d, 0x200e, 0x2028, 0x2060, - 0x20d0, 0x2cef, 0x2d7f, 0x2de0, 0x302a, 0x3099, 0xa66f, 0xa674, 0xa69e, 0xa6f0, 0xa802, 0xa806, 0xa80b, 0xa823, - 0xa825, 0xa827, 0xa82c, 0xa880, 0xa8b4, 0xa8c4, 0xa8e0, 0xa8ff, 0xa926, 0xa947, 0xa952, 0xa960, 0xa980, 0xa983, - 0xa9b3, 0xa9b4, 0xa9b6, 0xa9ba, 0xa9bc, 0xa9be, 0xa9e5, 0xaa29, 0xaa2f, 0xaa31, 0xaa33, 0xaa35, 0xaa43, 0xaa4c, - 0xaa4d, 0xaa7c, 0xaab0, 0xaab2, 0xaab7, 0xaabe, 0xaac1, 0xaaeb, 0xaaec, 0xaaee, 0xaaf5, 0xaaf6, 0xabe3, 0xabe5, - 0xabe6, 0xabe8, 0xabe9, 0xabec, 0xabed, 0xac00, 0xac01, 0xac1c, 0xac1d, 0xac38, 0xac39, 0xac54, 0xac55, 0xac70, - 0xac71, 0xac8c, 0xac8d, 0xaca8, 0xaca9, 0xacc4, 0xacc5, 0xace0, 0xace1, 0xacfc, 0xacfd, 0xad18, 0xad19, 0xad34, - 0xad35, 0xad50, 0xad51, 0xad6c, 0xad6d, 0xad88, 0xad89, 0xada4, 0xada5, 0xadc0, 0xadc1, 0xaddc, 0xaddd, 0xadf8, - 0xadf9, 0xae14, 0xae15, 0xae30, 0xae31, 0xae4c, 0xae4d, 0xae68, 0xae69, 0xae84, 0xae85, 0xaea0, 0xaea1, 0xaebc, - 0xaebd, 0xaed8, 0xaed9, 0xaef4, 0xaef5, 0xaf10, 0xaf11, 0xaf2c, 0xaf2d, 0xaf48, 0xaf49, 0xaf64, 0xaf65, 0xaf80, - 0xaf81, 0xaf9c, 0xaf9d, 0xafb8, 0xafb9, 0xafd4, 0xafd5, 0xaff0, 0xaff1, 0xb00c, 0xb00d, 0xb028, 0xb029, 0xb044, - 0xb045, 0xb060, 0xb061, 0xb07c, 0xb07d, 0xb098, 0xb099, 0xb0b4, 0xb0b5, 0xb0d0, 0xb0d1, 0xb0ec, 0xb0ed, 0xb108, - 0xb109, 0xb124, 0xb125, 0xb140, 0xb141, 0xb15c, 0xb15d, 0xb178, 0xb179, 0xb194, 0xb195, 0xb1b0, 0xb1b1, 0xb1cc, - 0xb1cd, 0xb1e8, 0xb1e9, 0xb204, 0xb205, 0xb220, 0xb221, 0xb23c, 0xb23d, 0xb258, 0xb259, 0xb274, 0xb275, 0xb290, - 0xb291, 0xb2ac, 0xb2ad, 0xb2c8, 0xb2c9, 0xb2e4, 0xb2e5, 0xb300, 0xb301, 0xb31c, 0xb31d, 0xb338, 0xb339, 0xb354, - 0xb355, 0xb370, 0xb371, 0xb38c, 0xb38d, 0xb3a8, 0xb3a9, 0xb3c4, 0xb3c5, 0xb3e0, 0xb3e1, 0xb3fc, 0xb3fd, 0xb418, - 0xb419, 0xb434, 0xb435, 0xb450, 0xb451, 0xb46c, 0xb46d, 0xb488, 0xb489, 0xb4a4, 0xb4a5, 0xb4c0, 0xb4c1, 0xb4dc, - 0xb4dd, 0xb4f8, 0xb4f9, 0xb514, 0xb515, 0xb530, 0xb531, 0xb54c, 0xb54d, 0xb568, 0xb569, 0xb584, 0xb585, 0xb5a0, - 0xb5a1, 0xb5bc, 0xb5bd, 0xb5d8, 0xb5d9, 0xb5f4, 0xb5f5, 0xb610, 0xb611, 0xb62c, 0xb62d, 0xb648, 0xb649, 0xb664, - 0xb665, 0xb680, 0xb681, 0xb69c, 0xb69d, 0xb6b8, 0xb6b9, 0xb6d4, 0xb6d5, 0xb6f0, 0xb6f1, 0xb70c, 0xb70d, 0xb728, - 0xb729, 0xb744, 0xb745, 0xb760, 0xb761, 0xb77c, 0xb77d, 0xb798, 0xb799, 0xb7b4, 0xb7b5, 0xb7d0, 0xb7d1, 0xb7ec, - 0xb7ed, 0xb808, 0xb809, 0xb824, 0xb825, 0xb840, 0xb841, 0xb85c, 0xb85d, 0xb878, 0xb879, 0xb894, 0xb895, 0xb8b0, - 0xb8b1, 0xb8cc, 0xb8cd, 0xb8e8, 0xb8e9, 0xb904, 0xb905, 0xb920, 0xb921, 0xb93c, 0xb93d, 0xb958, 0xb959, 0xb974, - 0xb975, 0xb990, 0xb991, 0xb9ac, 0xb9ad, 0xb9c8, 0xb9c9, 0xb9e4, 0xb9e5, 0xba00, 0xba01, 0xba1c, 0xba1d, 0xba38, - 0xba39, 0xba54, 0xba55, 0xba70, 0xba71, 0xba8c, 0xba8d, 0xbaa8, 0xbaa9, 0xbac4, 0xbac5, 0xbae0, 0xbae1, 0xbafc, - 0xbafd, 0xbb18, 0xbb19, 0xbb34, 0xbb35, 0xbb50, 0xbb51, 0xbb6c, 0xbb6d, 0xbb88, 0xbb89, 0xbba4, 0xbba5, 0xbbc0, - 0xbbc1, 0xbbdc, 0xbbdd, 0xbbf8, 0xbbf9, 0xbc14, 0xbc15, 0xbc30, 0xbc31, 0xbc4c, 0xbc4d, 0xbc68, 0xbc69, 0xbc84, - 0xbc85, 0xbca0, 0xbca1, 0xbcbc, 0xbcbd, 0xbcd8, 0xbcd9, 0xbcf4, 0xbcf5, 0xbd10, 0xbd11, 0xbd2c, 0xbd2d, 0xbd48, - 0xbd49, 0xbd64, 0xbd65, 0xbd80, 0xbd81, 0xbd9c, 0xbd9d, 0xbdb8, 0xbdb9, 0xbdd4, 0xbdd5, 0xbdf0, 0xbdf1, 0xbe0c, - 0xbe0d, 0xbe28, 0xbe29, 0xbe44, 0xbe45, 0xbe60, 0xbe61, 0xbe7c, 0xbe7d, 0xbe98, 0xbe99, 0xbeb4, 0xbeb5, 0xbed0, - 0xbed1, 0xbeec, 0xbeed, 0xbf08, 0xbf09, 0xbf24, 0xbf25, 0xbf40, 0xbf41, 0xbf5c, 0xbf5d, 0xbf78, 0xbf79, 0xbf94, - 0xbf95, 0xbfb0, 0xbfb1, 0xbfcc, 0xbfcd, 0xbfe8, 0xbfe9, 0xc004, 0xc005, 0xc020, 0xc021, 0xc03c, 0xc03d, 0xc058, - 0xc059, 0xc074, 0xc075, 0xc090, 0xc091, 0xc0ac, 0xc0ad, 0xc0c8, 0xc0c9, 0xc0e4, 0xc0e5, 0xc100, 0xc101, 0xc11c, - 0xc11d, 0xc138, 0xc139, 0xc154, 0xc155, 0xc170, 0xc171, 0xc18c, 0xc18d, 0xc1a8, 0xc1a9, 0xc1c4, 0xc1c5, 0xc1e0, - 0xc1e1, 0xc1fc, 0xc1fd, 0xc218, 0xc219, 0xc234, 0xc235, 0xc250, 0xc251, 0xc26c, 0xc26d, 0xc288, 0xc289, 0xc2a4, - 0xc2a5, 0xc2c0, 0xc2c1, 0xc2dc, 0xc2dd, 0xc2f8, 0xc2f9, 0xc314, 0xc315, 0xc330, 0xc331, 0xc34c, 0xc34d, 0xc368, - 0xc369, 0xc384, 0xc385, 0xc3a0, 0xc3a1, 0xc3bc, 0xc3bd, 0xc3d8, 0xc3d9, 0xc3f4, 0xc3f5, 0xc410, 0xc411, 0xc42c, - 0xc42d, 0xc448, 0xc449, 0xc464, 0xc465, 0xc480, 0xc481, 0xc49c, 0xc49d, 0xc4b8, 0xc4b9, 0xc4d4, 0xc4d5, 0xc4f0, - 0xc4f1, 0xc50c, 0xc50d, 0xc528, 0xc529, 0xc544, 0xc545, 0xc560, 0xc561, 0xc57c, 0xc57d, 0xc598, 0xc599, 0xc5b4, - 0xc5b5, 0xc5d0, 0xc5d1, 0xc5ec, 0xc5ed, 0xc608, 0xc609, 0xc624, 0xc625, 0xc640, 0xc641, 0xc65c, 0xc65d, 0xc678, - 0xc679, 0xc694, 0xc695, 0xc6b0, 0xc6b1, 0xc6cc, 0xc6cd, 0xc6e8, 0xc6e9, 0xc704, 0xc705, 0xc720, 0xc721, 0xc73c, - 0xc73d, 0xc758, 0xc759, 0xc774, 0xc775, 0xc790, 0xc791, 0xc7ac, 0xc7ad, 0xc7c8, 0xc7c9, 0xc7e4, 0xc7e5, 0xc800, - 0xc801, 0xc81c, 0xc81d, 0xc838, 0xc839, 0xc854, 0xc855, 0xc870, 0xc871, 0xc88c, 0xc88d, 0xc8a8, 0xc8a9, 0xc8c4, - 0xc8c5, 0xc8e0, 0xc8e1, 0xc8fc, 0xc8fd, 0xc918, 0xc919, 0xc934, 0xc935, 0xc950, 0xc951, 0xc96c, 0xc96d, 0xc988, - 0xc989, 0xc9a4, 0xc9a5, 0xc9c0, 0xc9c1, 0xc9dc, 0xc9dd, 0xc9f8, 0xc9f9, 0xca14, 0xca15, 0xca30, 0xca31, 0xca4c, - 0xca4d, 0xca68, 0xca69, 0xca84, 0xca85, 0xcaa0, 0xcaa1, 0xcabc, 0xcabd, 0xcad8, 0xcad9, 0xcaf4, 0xcaf5, 0xcb10, - 0xcb11, 0xcb2c, 0xcb2d, 0xcb48, 0xcb49, 0xcb64, 0xcb65, 0xcb80, 0xcb81, 0xcb9c, 0xcb9d, 0xcbb8, 0xcbb9, 0xcbd4, - 0xcbd5, 0xcbf0, 0xcbf1, 0xcc0c, 0xcc0d, 0xcc28, 0xcc29, 0xcc44, 0xcc45, 0xcc60, 0xcc61, 0xcc7c, 0xcc7d, 0xcc98, - 0xcc99, 0xccb4, 0xccb5, 0xccd0, 0xccd1, 0xccec, 0xcced, 0xcd08, 0xcd09, 0xcd24, 0xcd25, 0xcd40, 0xcd41, 0xcd5c, - 0xcd5d, 0xcd78, 0xcd79, 0xcd94, 0xcd95, 0xcdb0, 0xcdb1, 0xcdcc, 0xcdcd, 0xcde8, 0xcde9, 0xce04, 0xce05, 0xce20, - 0xce21, 0xce3c, 0xce3d, 0xce58, 0xce59, 0xce74, 0xce75, 0xce90, 0xce91, 0xceac, 0xcead, 0xcec8, 0xcec9, 0xcee4, - 0xcee5, 0xcf00, 0xcf01, 0xcf1c, 0xcf1d, 0xcf38, 0xcf39, 0xcf54, 0xcf55, 0xcf70, 0xcf71, 0xcf8c, 0xcf8d, 0xcfa8, - 0xcfa9, 0xcfc4, 0xcfc5, 0xcfe0, 0xcfe1, 0xcffc, 0xcffd, 0xd018, 0xd019, 0xd034, 0xd035, 0xd050, 0xd051, 0xd06c, - 0xd06d, 0xd088, 0xd089, 0xd0a4, 0xd0a5, 0xd0c0, 0xd0c1, 0xd0dc, 0xd0dd, 0xd0f8, 0xd0f9, 0xd114, 0xd115, 0xd130, - 0xd131, 0xd14c, 0xd14d, 0xd168, 0xd169, 0xd184, 0xd185, 0xd1a0, 0xd1a1, 0xd1bc, 0xd1bd, 0xd1d8, 0xd1d9, 0xd1f4, - 0xd1f5, 0xd210, 0xd211, 0xd22c, 0xd22d, 0xd248, 0xd249, 0xd264, 0xd265, 0xd280, 0xd281, 0xd29c, 0xd29d, 0xd2b8, - 0xd2b9, 0xd2d4, 0xd2d5, 0xd2f0, 0xd2f1, 0xd30c, 0xd30d, 0xd328, 0xd329, 0xd344, 0xd345, 0xd360, 0xd361, 0xd37c, - 0xd37d, 0xd398, 0xd399, 0xd3b4, 0xd3b5, 0xd3d0, 0xd3d1, 0xd3ec, 0xd3ed, 0xd408, 0xd409, 0xd424, 0xd425, 0xd440, - 0xd441, 0xd45c, 0xd45d, 0xd478, 0xd479, 0xd494, 0xd495, 0xd4b0, 0xd4b1, 0xd4cc, 0xd4cd, 0xd4e8, 0xd4e9, 0xd504, - 0xd505, 0xd520, 0xd521, 0xd53c, 0xd53d, 0xd558, 0xd559, 0xd574, 0xd575, 0xd590, 0xd591, 0xd5ac, 0xd5ad, 0xd5c8, - 0xd5c9, 0xd5e4, 0xd5e5, 0xd600, 0xd601, 0xd61c, 0xd61d, 0xd638, 0xd639, 0xd654, 0xd655, 0xd670, 0xd671, 0xd68c, - 0xd68d, 0xd6a8, 0xd6a9, 0xd6c4, 0xd6c5, 0xd6e0, 0xd6e1, 0xd6fc, 0xd6fd, 0xd718, 0xd719, 0xd734, 0xd735, 0xd750, - 0xd751, 0xd76c, 0xd76d, 0xd788, 0xd789, 0xd7b0, 0xd7cb, 0xfb1e, 0xfe00, 0xfe20, 0xfeff, 0xff9e, 0xfff0, 0x101fd, - 0x102e0, 0x10376, 0x10a01, 0x10a05, 0x10a0c, 0x10a38, 0x10a3f, 0x10ae5, 0x10d24, 0x10eab, 0x10efd, 0x10f46, - 0x10f82, 0x11000, 0x11001, 0x11002, 0x11038, 0x11070, 0x11073, 0x1107f, 0x11082, 0x110b0, 0x110b3, 0x110b7, - 0x110b9, 0x110bd, 0x110c2, 0x110cd, 0x11100, 0x11127, 0x1112c, 0x1112d, 0x11145, 0x11173, 0x11180, 0x11182, - 0x111b3, 0x111b6, 0x111bf, 0x111c2, 0x111c9, 0x111ce, 0x111cf, 0x1122c, 0x1122f, 0x11232, 0x11234, 0x11235, - 0x11236, 0x1123e, 0x11241, 0x112df, 0x112e0, 0x112e3, 0x11300, 0x11302, 0x1133b, 0x1133e, 0x1133f, 0x11340, - 0x11341, 0x11347, 0x1134b, 0x11357, 0x11362, 0x11366, 0x11370, 0x11435, 0x11438, 0x11440, 0x11442, 0x11445, - 0x11446, 0x1145e, 0x114b0, 0x114b1, 0x114b3, 0x114b9, 0x114ba, 0x114bb, 0x114bd, 0x114be, 0x114bf, 0x114c1, - 0x114c2, 0x115af, 0x115b0, 0x115b2, 0x115b8, 0x115bc, 0x115be, 0x115bf, 0x115dc, 0x11630, 0x11633, 0x1163b, - 0x1163d, 0x1163e, 0x1163f, 0x116ab, 0x116ac, 0x116ad, 0x116ae, 0x116b0, 0x116b6, 0x116b7, 0x1171d, 0x11722, - 0x11726, 0x11727, 0x1182c, 0x1182f, 0x11838, 0x11839, 0x11930, 0x11931, 0x11937, 0x1193b, 0x1193d, 0x1193e, - 0x1193f, 0x11940, 0x11941, 0x11942, 0x11943, 0x119d1, 0x119d4, 0x119da, 0x119dc, 0x119e0, 0x119e4, 0x11a01, - 0x11a33, 0x11a39, 0x11a3a, 0x11a3b, 0x11a47, 0x11a51, 0x11a57, 0x11a59, 0x11a84, 0x11a8a, 0x11a97, 0x11a98, - 0x11c2f, 0x11c30, 0x11c38, 0x11c3e, 0x11c3f, 0x11c92, 0x11ca9, 0x11caa, 0x11cb1, 0x11cb2, 0x11cb4, 0x11cb5, - 0x11d31, 0x11d3a, 0x11d3c, 0x11d3f, 0x11d46, 0x11d47, 0x11d8a, 0x11d90, 0x11d93, 0x11d95, 0x11d96, 0x11d97, - 0x11ef3, 0x11ef5, 0x11f00, 0x11f02, 0x11f03, 0x11f34, 0x11f36, 0x11f3e, 0x11f40, 0x11f41, 0x11f42, 0x13430, - 0x13440, 0x13447, 0x16af0, 0x16b30, 0x16f4f, 0x16f51, 0x16f8f, 0x16fe4, 0x16ff0, 0x1bc9d, 0x1bca0, 0x1cf00, - 0x1cf30, 0x1d165, 0x1d166, 0x1d167, 0x1d16d, 0x1d16e, 0x1d173, 0x1d17b, 0x1d185, 0x1d1aa, 0x1d242, 0x1da00, - 0x1da3b, 0x1da75, 0x1da84, 0x1da9b, 0x1daa1, 0x1e000, 0x1e008, 0x1e01b, 0x1e023, 0x1e026, 0x1e08f, 0x1e130, - 0x1e2ae, 0x1e2ec, 0x1e4ec, 0x1e8d0, 0x1e944, 0x1f1e6, 0x1f3fb, 0xe0000, 0xe0020, 0xe0080, 0xe0100, 0xe01f0}, + 0xc81, 0xc82, 0xcbc, 0xcbe, 0xcbf, 0xcc1, 0xcc2, 0xcc3, 0xcc6, 0xcca, 0xcd5, 0xce2, 0xcf3, 0xd00, 0xd02, 0xd3b, + 0xd3e, 0xd3f, 0xd41, 0xd46, 0xd4a, 0xd4d, 0xd4e, 0xd57, 0xd62, 0xd81, 0xd82, 0xdca, 0xdcf, 0xdd0, 0xdd2, 0xdd6, + 0xdd8, 0xddf, 0xdf2, 0xe31, 0xe33, 0xe34, 0xe47, 0xeb1, 0xeb3, 0xeb4, 0xec8, 0xf18, 0xf35, 0xf37, 0xf39, 0xf3e, + 0xf71, 0xf7f, 0xf80, 0xf86, 0xf8d, 0xf99, 0xfc6, 0x102d, 0x1031, 0x1032, 0x1039, 0x103b, 0x103d, 0x1056, 0x1058, + 0x105e, 0x1071, 0x1082, 0x1084, 0x1085, 0x108d, 0x109d, 0x1100, 0x1160, 0x11a8, 0x135d, 0x1712, 0x1732, 0x1752, + 0x1772, 0x17b4, 0x17b6, 0x17b7, 0x17be, 0x17c6, 0x17c7, 0x17c9, 0x17dd, 0x180b, 0x180e, 0x180f, 0x1885, 0x18a9, + 0x1920, 0x1923, 0x1927, 0x1929, 0x1930, 0x1932, 0x1933, 0x1939, 0x1a17, 0x1a19, 0x1a1b, 0x1a55, 0x1a56, 0x1a57, + 0x1a58, 0x1a60, 0x1a62, 0x1a65, 0x1a6d, 0x1a73, 0x1a7f, 0x1ab0, 0x1b00, 0x1b04, 0x1b34, 0x1b3e, 0x1b42, 0x1b6b, + 0x1b80, 0x1b82, 0x1ba1, 0x1ba2, 0x1ba6, 0x1ba8, 0x1be6, 0x1be7, 0x1be8, 0x1bea, 0x1bed, 0x1bee, 0x1bef, 0x1c24, + 0x1c2c, 0x1c34, 0x1c36, 0x1cd0, 0x1cd4, 0x1ce1, 0x1ce2, 0x1ced, 0x1cf4, 0x1cf7, 0x1cf8, 0x1dc0, 0x200b, 0x200c, + 0x200d, 0x200e, 0x2028, 0x2060, 0x20d0, 0x2cef, 0x2d7f, 0x2de0, 0x302a, 0x3099, 0xa66f, 0xa674, 0xa69e, 0xa6f0, + 0xa802, 0xa806, 0xa80b, 0xa823, 0xa825, 0xa827, 0xa82c, 0xa880, 0xa8b4, 0xa8c4, 0xa8e0, 0xa8ff, 0xa926, 0xa947, + 0xa952, 0xa953, 0xa960, 0xa980, 0xa983, 0xa9b3, 0xa9b4, 0xa9b6, 0xa9ba, 0xa9bc, 0xa9be, 0xa9c0, 0xa9e5, 0xaa29, + 0xaa2f, 0xaa31, 0xaa33, 0xaa35, 0xaa43, 0xaa4c, 0xaa4d, 0xaa7c, 0xaab0, 0xaab2, 0xaab7, 0xaabe, 0xaac1, 0xaaeb, + 0xaaec, 0xaaee, 0xaaf5, 0xaaf6, 0xabe3, 0xabe5, 0xabe6, 0xabe8, 0xabe9, 0xabec, 0xabed, 0xac00, 0xac01, 0xac1c, + 0xac1d, 0xac38, 0xac39, 0xac54, 0xac55, 0xac70, 0xac71, 0xac8c, 0xac8d, 0xaca8, 0xaca9, 0xacc4, 0xacc5, 0xace0, + 0xace1, 0xacfc, 0xacfd, 0xad18, 0xad19, 0xad34, 0xad35, 0xad50, 0xad51, 0xad6c, 0xad6d, 0xad88, 0xad89, 0xada4, + 0xada5, 0xadc0, 0xadc1, 0xaddc, 0xaddd, 0xadf8, 0xadf9, 0xae14, 0xae15, 0xae30, 0xae31, 0xae4c, 0xae4d, 0xae68, + 0xae69, 0xae84, 0xae85, 0xaea0, 0xaea1, 0xaebc, 0xaebd, 0xaed8, 0xaed9, 0xaef4, 0xaef5, 0xaf10, 0xaf11, 0xaf2c, + 0xaf2d, 0xaf48, 0xaf49, 0xaf64, 0xaf65, 0xaf80, 0xaf81, 0xaf9c, 0xaf9d, 0xafb8, 0xafb9, 0xafd4, 0xafd5, 0xaff0, + 0xaff1, 0xb00c, 0xb00d, 0xb028, 0xb029, 0xb044, 0xb045, 0xb060, 0xb061, 0xb07c, 0xb07d, 0xb098, 0xb099, 0xb0b4, + 0xb0b5, 0xb0d0, 0xb0d1, 0xb0ec, 0xb0ed, 0xb108, 0xb109, 0xb124, 0xb125, 0xb140, 0xb141, 0xb15c, 0xb15d, 0xb178, + 0xb179, 0xb194, 0xb195, 0xb1b0, 0xb1b1, 0xb1cc, 0xb1cd, 0xb1e8, 0xb1e9, 0xb204, 0xb205, 0xb220, 0xb221, 0xb23c, + 0xb23d, 0xb258, 0xb259, 0xb274, 0xb275, 0xb290, 0xb291, 0xb2ac, 0xb2ad, 0xb2c8, 0xb2c9, 0xb2e4, 0xb2e5, 0xb300, + 0xb301, 0xb31c, 0xb31d, 0xb338, 0xb339, 0xb354, 0xb355, 0xb370, 0xb371, 0xb38c, 0xb38d, 0xb3a8, 0xb3a9, 0xb3c4, + 0xb3c5, 0xb3e0, 0xb3e1, 0xb3fc, 0xb3fd, 0xb418, 0xb419, 0xb434, 0xb435, 0xb450, 0xb451, 0xb46c, 0xb46d, 0xb488, + 0xb489, 0xb4a4, 0xb4a5, 0xb4c0, 0xb4c1, 0xb4dc, 0xb4dd, 0xb4f8, 0xb4f9, 0xb514, 0xb515, 0xb530, 0xb531, 0xb54c, + 0xb54d, 0xb568, 0xb569, 0xb584, 0xb585, 0xb5a0, 0xb5a1, 0xb5bc, 0xb5bd, 0xb5d8, 0xb5d9, 0xb5f4, 0xb5f5, 0xb610, + 0xb611, 0xb62c, 0xb62d, 0xb648, 0xb649, 0xb664, 0xb665, 0xb680, 0xb681, 0xb69c, 0xb69d, 0xb6b8, 0xb6b9, 0xb6d4, + 0xb6d5, 0xb6f0, 0xb6f1, 0xb70c, 0xb70d, 0xb728, 0xb729, 0xb744, 0xb745, 0xb760, 0xb761, 0xb77c, 0xb77d, 0xb798, + 0xb799, 0xb7b4, 0xb7b5, 0xb7d0, 0xb7d1, 0xb7ec, 0xb7ed, 0xb808, 0xb809, 0xb824, 0xb825, 0xb840, 0xb841, 0xb85c, + 0xb85d, 0xb878, 0xb879, 0xb894, 0xb895, 0xb8b0, 0xb8b1, 0xb8cc, 0xb8cd, 0xb8e8, 0xb8e9, 0xb904, 0xb905, 0xb920, + 0xb921, 0xb93c, 0xb93d, 0xb958, 0xb959, 0xb974, 0xb975, 0xb990, 0xb991, 0xb9ac, 0xb9ad, 0xb9c8, 0xb9c9, 0xb9e4, + 0xb9e5, 0xba00, 0xba01, 0xba1c, 0xba1d, 0xba38, 0xba39, 0xba54, 0xba55, 0xba70, 0xba71, 0xba8c, 0xba8d, 0xbaa8, + 0xbaa9, 0xbac4, 0xbac5, 0xbae0, 0xbae1, 0xbafc, 0xbafd, 0xbb18, 0xbb19, 0xbb34, 0xbb35, 0xbb50, 0xbb51, 0xbb6c, + 0xbb6d, 0xbb88, 0xbb89, 0xbba4, 0xbba5, 0xbbc0, 0xbbc1, 0xbbdc, 0xbbdd, 0xbbf8, 0xbbf9, 0xbc14, 0xbc15, 0xbc30, + 0xbc31, 0xbc4c, 0xbc4d, 0xbc68, 0xbc69, 0xbc84, 0xbc85, 0xbca0, 0xbca1, 0xbcbc, 0xbcbd, 0xbcd8, 0xbcd9, 0xbcf4, + 0xbcf5, 0xbd10, 0xbd11, 0xbd2c, 0xbd2d, 0xbd48, 0xbd49, 0xbd64, 0xbd65, 0xbd80, 0xbd81, 0xbd9c, 0xbd9d, 0xbdb8, + 0xbdb9, 0xbdd4, 0xbdd5, 0xbdf0, 0xbdf1, 0xbe0c, 0xbe0d, 0xbe28, 0xbe29, 0xbe44, 0xbe45, 0xbe60, 0xbe61, 0xbe7c, + 0xbe7d, 0xbe98, 0xbe99, 0xbeb4, 0xbeb5, 0xbed0, 0xbed1, 0xbeec, 0xbeed, 0xbf08, 0xbf09, 0xbf24, 0xbf25, 0xbf40, + 0xbf41, 0xbf5c, 0xbf5d, 0xbf78, 0xbf79, 0xbf94, 0xbf95, 0xbfb0, 0xbfb1, 0xbfcc, 0xbfcd, 0xbfe8, 0xbfe9, 0xc004, + 0xc005, 0xc020, 0xc021, 0xc03c, 0xc03d, 0xc058, 0xc059, 0xc074, 0xc075, 0xc090, 0xc091, 0xc0ac, 0xc0ad, 0xc0c8, + 0xc0c9, 0xc0e4, 0xc0e5, 0xc100, 0xc101, 0xc11c, 0xc11d, 0xc138, 0xc139, 0xc154, 0xc155, 0xc170, 0xc171, 0xc18c, + 0xc18d, 0xc1a8, 0xc1a9, 0xc1c4, 0xc1c5, 0xc1e0, 0xc1e1, 0xc1fc, 0xc1fd, 0xc218, 0xc219, 0xc234, 0xc235, 0xc250, + 0xc251, 0xc26c, 0xc26d, 0xc288, 0xc289, 0xc2a4, 0xc2a5, 0xc2c0, 0xc2c1, 0xc2dc, 0xc2dd, 0xc2f8, 0xc2f9, 0xc314, + 0xc315, 0xc330, 0xc331, 0xc34c, 0xc34d, 0xc368, 0xc369, 0xc384, 0xc385, 0xc3a0, 0xc3a1, 0xc3bc, 0xc3bd, 0xc3d8, + 0xc3d9, 0xc3f4, 0xc3f5, 0xc410, 0xc411, 0xc42c, 0xc42d, 0xc448, 0xc449, 0xc464, 0xc465, 0xc480, 0xc481, 0xc49c, + 0xc49d, 0xc4b8, 0xc4b9, 0xc4d4, 0xc4d5, 0xc4f0, 0xc4f1, 0xc50c, 0xc50d, 0xc528, 0xc529, 0xc544, 0xc545, 0xc560, + 0xc561, 0xc57c, 0xc57d, 0xc598, 0xc599, 0xc5b4, 0xc5b5, 0xc5d0, 0xc5d1, 0xc5ec, 0xc5ed, 0xc608, 0xc609, 0xc624, + 0xc625, 0xc640, 0xc641, 0xc65c, 0xc65d, 0xc678, 0xc679, 0xc694, 0xc695, 0xc6b0, 0xc6b1, 0xc6cc, 0xc6cd, 0xc6e8, + 0xc6e9, 0xc704, 0xc705, 0xc720, 0xc721, 0xc73c, 0xc73d, 0xc758, 0xc759, 0xc774, 0xc775, 0xc790, 0xc791, 0xc7ac, + 0xc7ad, 0xc7c8, 0xc7c9, 0xc7e4, 0xc7e5, 0xc800, 0xc801, 0xc81c, 0xc81d, 0xc838, 0xc839, 0xc854, 0xc855, 0xc870, + 0xc871, 0xc88c, 0xc88d, 0xc8a8, 0xc8a9, 0xc8c4, 0xc8c5, 0xc8e0, 0xc8e1, 0xc8fc, 0xc8fd, 0xc918, 0xc919, 0xc934, + 0xc935, 0xc950, 0xc951, 0xc96c, 0xc96d, 0xc988, 0xc989, 0xc9a4, 0xc9a5, 0xc9c0, 0xc9c1, 0xc9dc, 0xc9dd, 0xc9f8, + 0xc9f9, 0xca14, 0xca15, 0xca30, 0xca31, 0xca4c, 0xca4d, 0xca68, 0xca69, 0xca84, 0xca85, 0xcaa0, 0xcaa1, 0xcabc, + 0xcabd, 0xcad8, 0xcad9, 0xcaf4, 0xcaf5, 0xcb10, 0xcb11, 0xcb2c, 0xcb2d, 0xcb48, 0xcb49, 0xcb64, 0xcb65, 0xcb80, + 0xcb81, 0xcb9c, 0xcb9d, 0xcbb8, 0xcbb9, 0xcbd4, 0xcbd5, 0xcbf0, 0xcbf1, 0xcc0c, 0xcc0d, 0xcc28, 0xcc29, 0xcc44, + 0xcc45, 0xcc60, 0xcc61, 0xcc7c, 0xcc7d, 0xcc98, 0xcc99, 0xccb4, 0xccb5, 0xccd0, 0xccd1, 0xccec, 0xcced, 0xcd08, + 0xcd09, 0xcd24, 0xcd25, 0xcd40, 0xcd41, 0xcd5c, 0xcd5d, 0xcd78, 0xcd79, 0xcd94, 0xcd95, 0xcdb0, 0xcdb1, 0xcdcc, + 0xcdcd, 0xcde8, 0xcde9, 0xce04, 0xce05, 0xce20, 0xce21, 0xce3c, 0xce3d, 0xce58, 0xce59, 0xce74, 0xce75, 0xce90, + 0xce91, 0xceac, 0xcead, 0xcec8, 0xcec9, 0xcee4, 0xcee5, 0xcf00, 0xcf01, 0xcf1c, 0xcf1d, 0xcf38, 0xcf39, 0xcf54, + 0xcf55, 0xcf70, 0xcf71, 0xcf8c, 0xcf8d, 0xcfa8, 0xcfa9, 0xcfc4, 0xcfc5, 0xcfe0, 0xcfe1, 0xcffc, 0xcffd, 0xd018, + 0xd019, 0xd034, 0xd035, 0xd050, 0xd051, 0xd06c, 0xd06d, 0xd088, 0xd089, 0xd0a4, 0xd0a5, 0xd0c0, 0xd0c1, 0xd0dc, + 0xd0dd, 0xd0f8, 0xd0f9, 0xd114, 0xd115, 0xd130, 0xd131, 0xd14c, 0xd14d, 0xd168, 0xd169, 0xd184, 0xd185, 0xd1a0, + 0xd1a1, 0xd1bc, 0xd1bd, 0xd1d8, 0xd1d9, 0xd1f4, 0xd1f5, 0xd210, 0xd211, 0xd22c, 0xd22d, 0xd248, 0xd249, 0xd264, + 0xd265, 0xd280, 0xd281, 0xd29c, 0xd29d, 0xd2b8, 0xd2b9, 0xd2d4, 0xd2d5, 0xd2f0, 0xd2f1, 0xd30c, 0xd30d, 0xd328, + 0xd329, 0xd344, 0xd345, 0xd360, 0xd361, 0xd37c, 0xd37d, 0xd398, 0xd399, 0xd3b4, 0xd3b5, 0xd3d0, 0xd3d1, 0xd3ec, + 0xd3ed, 0xd408, 0xd409, 0xd424, 0xd425, 0xd440, 0xd441, 0xd45c, 0xd45d, 0xd478, 0xd479, 0xd494, 0xd495, 0xd4b0, + 0xd4b1, 0xd4cc, 0xd4cd, 0xd4e8, 0xd4e9, 0xd504, 0xd505, 0xd520, 0xd521, 0xd53c, 0xd53d, 0xd558, 0xd559, 0xd574, + 0xd575, 0xd590, 0xd591, 0xd5ac, 0xd5ad, 0xd5c8, 0xd5c9, 0xd5e4, 0xd5e5, 0xd600, 0xd601, 0xd61c, 0xd61d, 0xd638, + 0xd639, 0xd654, 0xd655, 0xd670, 0xd671, 0xd68c, 0xd68d, 0xd6a8, 0xd6a9, 0xd6c4, 0xd6c5, 0xd6e0, 0xd6e1, 0xd6fc, + 0xd6fd, 0xd718, 0xd719, 0xd734, 0xd735, 0xd750, 0xd751, 0xd76c, 0xd76d, 0xd788, 0xd789, 0xd7b0, 0xd7cb, 0xfb1e, + 0xfe00, 0xfe20, 0xfeff, 0xff9e, 0xfff0, 0x101fd, 0x102e0, 0x10376, 0x10a01, 0x10a05, 0x10a0c, 0x10a38, 0x10a3f, + 0x10ae5, 0x10d24, 0x10d69, 0x10eab, 0x10efc, 0x10f46, 0x10f82, 0x11000, 0x11001, 0x11002, 0x11038, 0x11070, + 0x11073, 0x1107f, 0x11082, 0x110b0, 0x110b3, 0x110b7, 0x110b9, 0x110bd, 0x110c2, 0x110cd, 0x11100, 0x11127, + 0x1112c, 0x1112d, 0x11145, 0x11173, 0x11180, 0x11182, 0x111b3, 0x111b6, 0x111bf, 0x111c0, 0x111c2, 0x111c9, + 0x111ce, 0x111cf, 0x1122c, 0x1122f, 0x11232, 0x11234, 0x1123e, 0x11241, 0x112df, 0x112e0, 0x112e3, 0x11300, + 0x11302, 0x1133b, 0x1133e, 0x1133f, 0x11340, 0x11341, 0x11347, 0x1134b, 0x1134d, 0x11357, 0x11362, 0x11366, + 0x11370, 0x113b8, 0x113b9, 0x113bb, 0x113c2, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113ce, 0x113d1, 0x113d2, + 0x113e1, 0x11435, 0x11438, 0x11440, 0x11442, 0x11445, 0x11446, 0x1145e, 0x114b0, 0x114b1, 0x114b3, 0x114b9, + 0x114ba, 0x114bb, 0x114bd, 0x114be, 0x114bf, 0x114c1, 0x114c2, 0x115af, 0x115b0, 0x115b2, 0x115b8, 0x115bc, + 0x115be, 0x115bf, 0x115dc, 0x11630, 0x11633, 0x1163b, 0x1163d, 0x1163e, 0x1163f, 0x116ab, 0x116ac, 0x116ad, + 0x116ae, 0x116b0, 0x1171d, 0x1171e, 0x1171f, 0x11722, 0x11726, 0x11727, 0x1182c, 0x1182f, 0x11838, 0x11839, + 0x11930, 0x11931, 0x11937, 0x1193b, 0x1193f, 0x11940, 0x11941, 0x11942, 0x11943, 0x119d1, 0x119d4, 0x119da, + 0x119dc, 0x119e0, 0x119e4, 0x11a01, 0x11a33, 0x11a39, 0x11a3a, 0x11a3b, 0x11a47, 0x11a51, 0x11a57, 0x11a59, + 0x11a84, 0x11a8a, 0x11a97, 0x11a98, 0x11c2f, 0x11c30, 0x11c38, 0x11c3e, 0x11c3f, 0x11c92, 0x11ca9, 0x11caa, + 0x11cb1, 0x11cb2, 0x11cb4, 0x11cb5, 0x11d31, 0x11d3a, 0x11d3c, 0x11d3f, 0x11d46, 0x11d47, 0x11d8a, 0x11d90, + 0x11d93, 0x11d95, 0x11d96, 0x11d97, 0x11ef3, 0x11ef5, 0x11f00, 0x11f02, 0x11f03, 0x11f34, 0x11f36, 0x11f3e, + 0x11f40, 0x11f5a, 0x13430, 0x13440, 0x13447, 0x1611e, 0x1612a, 0x1612d, 0x16af0, 0x16b30, 0x16d63, 0x16d67, + 0x16f4f, 0x16f51, 0x16f8f, 0x16fe4, 0x16ff0, 0x1bc9d, 0x1bca0, 0x1cf00, 0x1cf30, 0x1d165, 0x1d16d, 0x1d173, + 0x1d17b, 0x1d185, 0x1d1aa, 0x1d242, 0x1da00, 0x1da3b, 0x1da75, 0x1da84, 0x1da9b, 0x1daa1, 0x1e000, 0x1e008, + 0x1e01b, 0x1e023, 0x1e026, 0x1e08f, 0x1e130, 0x1e2ae, 0x1e2ec, 0x1e4ec, 0x1e5ee, 0x1e8d0, 0x1e944, 0x1f1e6, + 0x1f3fb, 0xe0000, 0xe0020, 0xe0080, 0xe0100, 0xe01f0}, {0x100a, 0x4001, 0x1002, 0x1, 0x1012, 0x1021, 0x1001, 0x2070, 0x2007, 0x202d, 0x2001, 0x2002, 0x2002, 0x2001, 0x7006, 0x200b, 0x1001, 0x2015, 0x2001, 0x2007, 0x7001, 0x2006, 0x2002, 0x2004, 0x7001, 0x2001, 0x201b, 0x200b, - 0x2009, 0x2001, 0x2004, 0x2009, 0x2003, 0x2005, 0x2003, 0x7002, 0x2008, 0x2018, 0x7001, 0x2020, 0x9001, 0x2001, + 0x2009, 0x2001, 0x2004, 0x2009, 0x2003, 0x2005, 0x2003, 0x7002, 0x2009, 0x2018, 0x7001, 0x2020, 0x9001, 0x2001, 0x9001, 0x2001, 0x9003, 0x2008, 0x9004, 0x2001, 0x9002, 0x2007, 0x2002, 0x2001, 0x9002, 0x2001, 0x2001, 0x9002, 0x2004, 0x9002, 0x9002, 0x2001, 0x2001, 0x2002, 0x2001, 0x2002, 0x9001, 0x2001, 0x9003, 0x2002, 0x2002, 0x2003, 0x2001, 0x2002, 0x2001, 0x2002, 0x9001, 0x2001, 0x9003, 0x2005, 0x2002, 0x9001, 0x9002, 0x2001, 0x2002, 0x2006, 0x2001, 0x9002, 0x2001, 0x2002, 0x9001, 0x2004, 0x9002, 0x9002, 0x2001, 0x2003, 0x2002, 0x2001, 0x2001, 0x9001, 0x2001, 0x9002, 0x9003, 0x9003, 0x2001, 0x2001, 0x2001, 0x9003, 0x2001, 0x2001, 0x2003, 0x9004, 0x2003, 0x2004, - 0x2002, 0x2002, 0x2001, 0x9002, 0x2001, 0x9001, 0x2001, 0x9002, 0x2001, 0x9002, 0x2001, 0x9002, 0x9002, 0x2002, - 0x2002, 0x2002, 0x9001, 0x2002, 0x9002, 0x2002, 0x2001, 0x9002, 0x2004, 0x9003, 0x9003, 0x2001, 0x7001, 0x2001, - 0x2002, 0x2001, 0x9002, 0x2001, 0x2001, 0x9002, 0x2003, 0x2001, 0x9007, 0x2001, 0x9002, 0x2001, 0x9001, 0x2007, - 0x2008, 0x2001, 0x9001, 0x2009, 0x2007, 0x2002, 0x2001, 0x2001, 0x2001, 0x9002, 0x200e, 0x9001, 0x2005, 0x2002, - 0x200b, 0x2024, 0x2001, 0x2004, 0x9001, 0x2006, 0x2002, 0x9002, 0x2002, 0x9002, 0x2002, 0x2003, 0x2004, 0x2001, - 0x9001, 0x2002, 0x2001, 0x2001, 0x3060, 0xb048, 0xa058, 0x2003, 0x2003, 0x9001, 0x2002, 0x9001, 0x2002, 0x2002, - 0x2002, 0x9001, 0x2007, 0x9008, 0x2001, 0x9002, 0x200b, 0x2001, 0x2003, 0x1001, 0x2001, 0x2002, 0x2001, 0x2003, - 0x9004, 0x2002, 0x9003, 0x9002, 0x2001, 0x9006, 0x2003, 0x2002, 0x9002, 0x2001, 0x9001, 0x2001, 0x9001, 0x2007, - 0x2001, 0x2001, 0x2008, 0x9006, 0x200a, 0x2001, 0x201f, 0x2004, 0x9001, 0x2007, 0x9001, 0x2001, 0x9005, 0x2001, - 0x9002, 0x2009, 0x2002, 0x9001, 0x9001, 0x2004, 0x9002, 0x2002, 0x9001, 0x2003, 0x2001, 0x9001, 0x2002, 0x9003, - 0x2001, 0x9001, 0x2003, 0x9002, 0x9008, 0x2008, 0x9002, 0x2002, 0x2003, 0x200d, 0x9001, 0x2007, 0x2001, 0x2001, - 0x9001, 0x2002, 0x2040, 0x1001, 0x2001, 0xc001, 0x1002, 0x1007, 0x1010, 0x2021, 0x2003, 0x2001, 0x2020, 0x2006, - 0x2002, 0x2004, 0x200a, 0x2002, 0x2002, 0x2001, 0x2001, 0x2001, 0x9002, 0x2002, 0x9001, 0x2001, 0x9002, 0x9010, - 0x2002, 0x2012, 0x2001, 0x2008, 0x200b, 0x9002, 0x301d, 0x2003, 0x9001, 0x2001, 0x9002, 0x2004, 0x9002, 0x2002, - 0x9003, 0x2001, 0x2006, 0x9002, 0x2002, 0x9002, 0x2002, 0x2001, 0x2001, 0x9001, 0x2001, 0x2001, 0x2003, 0x2002, - 0x2002, 0x2001, 0x9001, 0x2002, 0x9002, 0x9001, 0x2001, 0x9002, 0x2001, 0x9002, 0x2001, 0x9002, 0x9001, 0x2001, - 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, + 0x2002, 0x2002, 0x2001, 0x9002, 0x2001, 0x9001, 0x2002, 0x9001, 0x2001, 0x9002, 0x2003, 0x2004, 0x2002, 0x2002, + 0x9001, 0x2002, 0x9002, 0x2002, 0x2001, 0x9002, 0x2004, 0x9003, 0x9003, 0x2001, 0x7001, 0x2001, 0x2002, 0x2001, + 0x9002, 0x2001, 0x2001, 0x9002, 0x2003, 0x2001, 0x9007, 0x2001, 0x9002, 0x2001, 0x9001, 0x2007, 0x2008, 0x2001, + 0x9001, 0x2009, 0x2007, 0x2002, 0x2001, 0x2001, 0x2001, 0x9002, 0x200e, 0x9001, 0x2005, 0x2002, 0x200b, 0x2024, + 0x2001, 0x2004, 0x9001, 0x2006, 0x2002, 0x9002, 0x2002, 0x9002, 0x2002, 0x2003, 0x2004, 0x2001, 0x9001, 0x2002, + 0x2001, 0x2001, 0x3060, 0xb048, 0xa058, 0x2003, 0x2004, 0x2003, 0x2002, 0x2002, 0x2002, 0x9001, 0x2007, 0x9008, + 0x2001, 0x9002, 0x200b, 0x2001, 0x2003, 0x1001, 0x2001, 0x2002, 0x2001, 0x2003, 0x9004, 0x2002, 0x9003, 0x9002, + 0x2001, 0x9006, 0x2003, 0x2002, 0x9002, 0x2001, 0x9001, 0x2001, 0x9001, 0x2007, 0x2001, 0x2001, 0x2008, 0x9006, + 0x200a, 0x2001, 0x201f, 0x2004, 0x9001, 0x200a, 0x9004, 0x2003, 0x2009, 0x2002, 0x9001, 0x9001, 0x2004, 0x9002, + 0x2006, 0x2001, 0x9001, 0x2002, 0x9003, 0x2001, 0x9001, 0x2005, 0x9008, 0x2008, 0x9002, 0x2002, 0x2003, 0x200d, + 0x9001, 0x2007, 0x2001, 0x2001, 0x9001, 0x2002, 0x2040, 0x1001, 0x2001, 0xc001, 0x1002, 0x1007, 0x1010, 0x2021, + 0x2003, 0x2001, 0x2020, 0x2006, 0x2002, 0x2004, 0x200a, 0x2002, 0x2002, 0x2001, 0x2001, 0x2001, 0x9002, 0x2002, + 0x9001, 0x2001, 0x9002, 0x9010, 0x2002, 0x2012, 0x2001, 0x2008, 0x200b, 0x9001, 0x2001, 0x301d, 0x2003, 0x9001, + 0x2001, 0x9002, 0x2004, 0x9002, 0x2002, 0x9002, 0x2001, 0x2001, 0x2006, 0x9002, 0x2002, 0x9002, 0x2002, 0x2001, + 0x2001, 0x9001, 0x2001, 0x2001, 0x2003, 0x2002, 0x2002, 0x2001, 0x9001, 0x2002, 0x9002, 0x9001, 0x2001, 0x9002, + 0x2001, 0x9002, 0x2001, 0x9002, 0x9001, 0x2001, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, @@ -333,30 +335,108 @@ inline constexpr _Unicode_property_data<_Grapheme_Break_property_values, 1371, f 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, - 0xb017, 0xa031, 0x2001, 0x2010, 0x2010, 0x1001, 0x2002, 0x100c, 0x2001, 0x2001, 0x2005, 0x2003, 0x2002, 0x2004, - 0x2003, 0x2001, 0x2002, 0x2004, 0x2002, 0x2003, 0x200b, 0x2004, 0x9001, 0x2001, 0x9001, 0x200f, 0x2001, 0x2002, - 0x2003, 0x9001, 0x9003, 0x2004, 0x9002, 0x2002, 0x7001, 0x2001, 0x7001, 0x2003, 0x2005, 0x9001, 0x2008, 0x9002, - 0x2001, 0x2002, 0x9001, 0x9003, 0x2009, 0x9002, 0x7002, 0x2004, 0x9001, 0x2001, 0x9003, 0x2003, 0x9002, 0x2001, - 0x9001, 0x2002, 0x2001, 0x2001, 0x2001, 0x9003, 0x2008, 0x2002, 0x9002, 0x2002, 0x2001, 0x9001, 0x2001, 0x9004, - 0x9002, 0x9003, 0x2001, 0x9002, 0x2007, 0x2005, 0x9003, 0x2008, 0x9002, 0x2003, 0x9001, 0x2001, 0x2001, 0x2001, - 0x9002, 0x2006, 0x9001, 0x2001, 0x9002, 0x2001, 0x9001, 0x2002, 0x9001, 0x2002, 0x2001, 0x9002, 0x2004, 0x9004, - 0x2002, 0x9001, 0x2002, 0x2002, 0x9003, 0x2008, 0x9002, 0x2001, 0x9001, 0x2002, 0x2001, 0x9001, 0x2001, 0x9002, - 0x2006, 0x9001, 0x2001, 0x2003, 0x2004, 0x9001, 0x2005, 0x9003, 0x2009, 0x9001, 0x2002, 0x2001, 0x9005, 0x9002, - 0x2002, 0x9001, 0x2001, 0x7001, 0x9001, 0x7001, 0x9001, 0x2001, 0x9003, 0x2004, 0x2002, 0x9004, 0x2001, 0x9001, - 0x200a, 0x2006, 0x9001, 0x7001, 0x2004, 0x2001, 0x2006, 0x9002, 0x2003, 0x7006, 0x200d, 0x9001, 0x2002, 0x9001, - 0x2007, 0x2006, 0x9001, 0x2001, 0x2016, 0x9001, 0x2007, 0x9001, 0x2002, 0x9001, 0x2002, 0x2006, 0x2001, 0x2002, - 0x2007, 0x7001, 0x2001, 0x9005, 0x2002, 0x9002, 0x2001, 0x9001, 0x2001, 0x2002, 0x9002, 0x2002, 0x7001, 0x9001, - 0x9002, 0x2005, 0x9002, 0x2001, 0x9001, 0x2001, 0x1010, 0x2001, 0x200f, 0x2005, 0x2007, 0x2001, 0x9037, 0x2004, - 0x2001, 0x9002, 0x2002, 0x1004, 0x202e, 0x2017, 0x2001, 0x9001, 0x2003, 0x9001, 0x2005, 0x1008, 0x2008, 0x2007, - 0x2004, 0x2003, 0x2037, 0x2032, 0x2001, 0x2001, 0x2005, 0x200f, 0x2007, 0x2011, 0x2007, 0x2002, 0x2005, 0x2001, - 0x2007, 0x2001, 0x2004, 0x2004, 0x2007, 0x2007, 0x801a, 0x2005, 0x1020, 0x2060, 0x1080, 0x20f0, 0x1e10}}; + 0x5001, 0x601b, 0x5001, 0x601b, 0x5001, 0x601b, 0xb017, 0xa031, 0x2001, 0x2010, 0x2010, 0x1001, 0x2002, 0x100c, + 0x2001, 0x2001, 0x2005, 0x2003, 0x2002, 0x2004, 0x2003, 0x2001, 0x2002, 0x2004, 0x2005, 0x2002, 0x2004, 0x200b, + 0x2004, 0x9001, 0x2001, 0x9001, 0x200f, 0x2001, 0x2002, 0x2003, 0x9001, 0x9003, 0x2004, 0x9002, 0x2002, 0x7001, + 0x2001, 0x7001, 0x2003, 0x2005, 0x9001, 0x2008, 0x9002, 0x2001, 0x2002, 0x9001, 0x9003, 0x2009, 0x9001, 0x2001, + 0x7002, 0x2004, 0x9001, 0x2001, 0x9003, 0x2003, 0x9002, 0x2004, 0x2001, 0x2001, 0x2001, 0x9003, 0x2008, 0x2002, + 0x9002, 0x2002, 0x2001, 0x9001, 0x2001, 0x9004, 0x9002, 0x9002, 0x2001, 0x2001, 0x9002, 0x2007, 0x2005, 0x2001, + 0x9002, 0x2006, 0x2001, 0x2001, 0x2003, 0x9001, 0x9002, 0x2003, 0x7001, 0x2001, 0x2002, 0x9003, 0x2008, 0x9002, + 0x2003, 0x9001, 0x2001, 0x2001, 0x2001, 0x9002, 0x2006, 0x9001, 0x2001, 0x9002, 0x2001, 0x9001, 0x2002, 0x9001, + 0x2002, 0x2001, 0x9002, 0x2004, 0x9004, 0x2002, 0x9001, 0x2002, 0x2002, 0x9003, 0x2008, 0x9002, 0x2001, 0x9001, + 0x2002, 0x2001, 0x9001, 0x2001, 0x9002, 0x2008, 0x2001, 0x9001, 0x2001, 0x2004, 0x9001, 0x2005, 0x9003, 0x2009, + 0x9001, 0x2002, 0x2001, 0x9005, 0x9002, 0x2004, 0x7001, 0x9001, 0x7001, 0x9001, 0x2001, 0x9003, 0x2004, 0x2002, + 0x9004, 0x2001, 0x9001, 0x200a, 0x2006, 0x9001, 0x7001, 0x2004, 0x2001, 0x2006, 0x9002, 0x2003, 0x7006, 0x200d, + 0x9001, 0x2002, 0x9001, 0x2007, 0x2006, 0x9001, 0x2001, 0x2016, 0x9001, 0x2007, 0x9001, 0x2002, 0x9001, 0x2002, + 0x2006, 0x2001, 0x2002, 0x2007, 0x7001, 0x2001, 0x9005, 0x2002, 0x9002, 0x2001, 0x9001, 0x2001, 0x2002, 0x9002, + 0x2002, 0x7001, 0x9001, 0x9002, 0x2005, 0x9002, 0x2003, 0x2001, 0x1010, 0x2001, 0x200f, 0x200c, 0x9003, 0x2003, + 0x2005, 0x2007, 0xb001, 0xb004, 0x2001, 0x9037, 0x2004, 0x2001, 0x2002, 0x2002, 0x1004, 0x202e, 0x2017, 0x2005, + 0x2006, 0x1008, 0x2008, 0x2007, 0x2004, 0x2003, 0x2037, 0x2032, 0x2001, 0x2001, 0x2005, 0x200f, 0x2007, 0x2011, + 0x2007, 0x2002, 0x2005, 0x2001, 0x2007, 0x2001, 0x2004, 0x2004, 0x2002, 0x2007, 0x2007, 0x801a, 0x2005, 0x1020, + 0x2060, 0x1080, 0x20f0, 0x1e10}}; + +// DerivedCoreProperties-16.0.0.txt +// Date: 2024-05-31, 18:09:32 GMT +enum class _Indic_Conjunct_Break_property_values : uint8_t { + _Consonant_value, + _Extend_value, + _Linker_value, + _No_value = 255 +}; + +// DerivedCoreProperties-16.0.0.txt +// Date: 2024-05-31, 18:09:32 GMT +inline constexpr _Unicode_property_data<_Indic_Conjunct_Break_property_values, 403, false> + _Indic_Conjunct_Break_property_data{ + {0x300, 0x483, 0x591, 0x5bf, 0x5c1, 0x5c4, 0x5c7, 0x610, 0x64b, 0x670, 0x6d6, 0x6df, 0x6e7, 0x6ea, 0x711, 0x730, + 0x7a6, 0x7eb, 0x7fd, 0x816, 0x81b, 0x825, 0x829, 0x859, 0x897, 0x8ca, 0x8e3, 0x915, 0x93a, 0x93c, 0x941, + 0x94d, 0x951, 0x958, 0x962, 0x978, 0x981, 0x995, 0x9aa, 0x9b2, 0x9b6, 0x9bc, 0x9be, 0x9c1, 0x9cd, 0x9d7, + 0x9dc, 0x9df, 0x9e2, 0x9f0, 0x9fe, 0xa01, 0xa3c, 0xa41, 0xa47, 0xa4b, 0xa51, 0xa70, 0xa75, 0xa81, 0xa95, + 0xaaa, 0xab2, 0xab5, 0xabc, 0xac1, 0xac7, 0xacd, 0xae2, 0xaf9, 0xafa, 0xb01, 0xb15, 0xb2a, 0xb32, 0xb35, + 0xb3c, 0xb3e, 0xb41, 0xb4d, 0xb55, 0xb5c, 0xb5f, 0xb62, 0xb71, 0xb82, 0xbbe, 0xbc0, 0xbcd, 0xbd7, 0xc00, + 0xc04, 0xc15, 0xc2a, 0xc3c, 0xc3e, 0xc46, 0xc4a, 0xc4d, 0xc55, 0xc58, 0xc62, 0xc81, 0xcbc, 0xcbf, 0xcc2, + 0xcc6, 0xcca, 0xcd5, 0xce2, 0xd00, 0xd15, 0xd3b, 0xd3e, 0xd41, 0xd4d, 0xd57, 0xd62, 0xd81, 0xdca, 0xdcf, + 0xdd2, 0xdd6, 0xddf, 0xe31, 0xe34, 0xe47, 0xeb1, 0xeb4, 0xec8, 0xf18, 0xf35, 0xf37, 0xf39, 0xf71, 0xf80, + 0xf86, 0xf8d, 0xf99, 0xfc6, 0x102d, 0x1032, 0x1039, 0x103d, 0x1058, 0x105e, 0x1071, 0x1082, 0x1085, 0x108d, + 0x109d, 0x135d, 0x1712, 0x1732, 0x1752, 0x1772, 0x17b4, 0x17b7, 0x17c6, 0x17c9, 0x17dd, 0x180b, 0x180f, + 0x1885, 0x18a9, 0x1920, 0x1927, 0x1932, 0x1939, 0x1a17, 0x1a1b, 0x1a56, 0x1a58, 0x1a60, 0x1a62, 0x1a65, + 0x1a73, 0x1a7f, 0x1ab0, 0x1b00, 0x1b34, 0x1b42, 0x1b6b, 0x1b80, 0x1ba2, 0x1ba8, 0x1be6, 0x1be8, 0x1bed, + 0x1bef, 0x1c2c, 0x1c36, 0x1cd0, 0x1cd4, 0x1ce2, 0x1ced, 0x1cf4, 0x1cf8, 0x1dc0, 0x200d, 0x20d0, 0x2cef, + 0x2d7f, 0x2de0, 0x302a, 0x3099, 0xa66f, 0xa674, 0xa69e, 0xa6f0, 0xa802, 0xa806, 0xa80b, 0xa825, 0xa82c, + 0xa8c4, 0xa8e0, 0xa8ff, 0xa926, 0xa947, 0xa953, 0xa980, 0xa9b3, 0xa9b6, 0xa9bc, 0xa9c0, 0xa9e5, 0xaa29, + 0xaa31, 0xaa35, 0xaa43, 0xaa4c, 0xaa7c, 0xaab0, 0xaab2, 0xaab7, 0xaabe, 0xaac1, 0xaaec, 0xaaf6, 0xabe5, + 0xabe8, 0xabed, 0xfb1e, 0xfe00, 0xfe20, 0xff9e, 0x101fd, 0x102e0, 0x10376, 0x10a01, 0x10a05, 0x10a0c, + 0x10a38, 0x10a3f, 0x10ae5, 0x10d24, 0x10d69, 0x10eab, 0x10efc, 0x10f46, 0x10f82, 0x11001, 0x11038, 0x11070, + 0x11073, 0x1107f, 0x110b3, 0x110b9, 0x110c2, 0x11100, 0x11127, 0x1112d, 0x11173, 0x11180, 0x111b6, 0x111c0, + 0x111c9, 0x111cf, 0x1122f, 0x11234, 0x1123e, 0x11241, 0x112df, 0x112e3, 0x11300, 0x1133b, 0x1133e, 0x11340, + 0x1134d, 0x11357, 0x11366, 0x11370, 0x113b8, 0x113bb, 0x113c2, 0x113c5, 0x113c7, 0x113ce, 0x113d2, 0x113e1, + 0x11438, 0x11442, 0x11446, 0x1145e, 0x114b0, 0x114b3, 0x114ba, 0x114bd, 0x114bf, 0x114c2, 0x115af, 0x115b2, + 0x115bc, 0x115bf, 0x115dc, 0x11633, 0x1163d, 0x1163f, 0x116ab, 0x116ad, 0x116b0, 0x1171d, 0x1171f, 0x11722, + 0x11727, 0x1182f, 0x11839, 0x11930, 0x1193b, 0x11943, 0x119d4, 0x119da, 0x119e0, 0x11a01, 0x11a33, 0x11a3b, + 0x11a47, 0x11a51, 0x11a59, 0x11a8a, 0x11a98, 0x11c30, 0x11c38, 0x11c3f, 0x11c92, 0x11caa, 0x11cb2, 0x11cb5, + 0x11d31, 0x11d3a, 0x11d3c, 0x11d3f, 0x11d47, 0x11d90, 0x11d95, 0x11d97, 0x11ef3, 0x11f00, 0x11f36, 0x11f40, + 0x11f5a, 0x13440, 0x13447, 0x1611e, 0x1612d, 0x16af0, 0x16b30, 0x16f4f, 0x16f8f, 0x16fe4, 0x16ff0, 0x1bc9d, + 0x1cf00, 0x1cf30, 0x1d165, 0x1d16d, 0x1d17b, 0x1d185, 0x1d1aa, 0x1d242, 0x1da00, 0x1da3b, 0x1da75, 0x1da84, + 0x1da9b, 0x1daa1, 0x1e000, 0x1e008, 0x1e01b, 0x1e023, 0x1e026, 0x1e08f, 0x1e130, 0x1e2ae, 0x1e2ec, 0x1e4ec, + 0x1e5ee, 0x1e8d0, 0x1e944, 0x1f3fb, 0xe0020, 0xe0100}, + {0x1070, 0x1007, 0x102d, 0x1001, 0x1002, 0x1002, 0x1001, 0x100b, 0x1015, 0x1001, 0x1007, 0x1006, 0x1002, 0x1004, + 0x1001, 0x101b, 0x100b, 0x1009, 0x1001, 0x1004, 0x1009, 0x1003, 0x1005, 0x1003, 0x1009, 0x1018, 0x1020, + 0x25, 0x1001, 0x1001, 0x1008, 0x2001, 0x1007, 0x8, 0x1002, 0x8, 0x1001, 0x14, 0x7, 0x1, 0x4, 0x1001, 0x1001, + 0x1004, 0x2001, 0x1001, 0x2, 0x1, 0x1002, 0x2, 0x1001, 0x1002, 0x1001, 0x1002, 0x1002, 0x1003, 0x1001, + 0x1002, 0x1001, 0x1002, 0x14, 0x7, 0x2, 0x5, 0x1001, 0x1005, 0x1002, 0x2001, 0x1002, 0x1, 0x1006, 0x1001, + 0x14, 0x7, 0x2, 0x5, 0x1001, 0x1002, 0x1004, 0x2001, 0x1003, 0x2, 0x1, 0x1002, 0x1, 0x1001, 0x1001, 0x1001, + 0x1001, 0x1001, 0x1001, 0x1001, 0x14, 0x10, 0x1001, 0x1003, 0x1003, 0x1003, 0x2001, 0x1002, 0x3, 0x1002, + 0x1001, 0x1001, 0x1002, 0x1001, 0x1003, 0x1004, 0x1002, 0x1002, 0x1002, 0x26, 0x1002, 0x1001, 0x1004, + 0x2001, 0x1001, 0x1002, 0x1001, 0x1001, 0x1001, 0x1003, 0x1001, 0x1001, 0x1001, 0x1007, 0x1008, 0x1001, + 0x1009, 0x1007, 0x1002, 0x1001, 0x1001, 0x1001, 0x100e, 0x1005, 0x1002, 0x100b, 0x1024, 0x1001, 0x1004, + 0x1006, 0x1002, 0x1002, 0x1002, 0x1003, 0x1004, 0x1001, 0x1002, 0x1001, 0x1001, 0x1003, 0x1004, 0x1003, + 0x1002, 0x1002, 0x1002, 0x1007, 0x1001, 0x100b, 0x1001, 0x1003, 0x1001, 0x1002, 0x1001, 0x1003, 0x1002, + 0x1001, 0x1003, 0x1002, 0x1001, 0x1001, 0x1007, 0x1001, 0x1001, 0x1008, 0x100a, 0x1001, 0x101f, 0x1004, + 0x100a, 0x1003, 0x1009, 0x1002, 0x1004, 0x1006, 0x1001, 0x1002, 0x1001, 0x1005, 0x1008, 0x1002, 0x1003, + 0x100d, 0x1007, 0x1001, 0x1001, 0x1002, 0x1040, 0x1001, 0x1021, 0x1003, 0x1001, 0x1020, 0x1006, 0x1002, + 0x1004, 0x100a, 0x1002, 0x1002, 0x1001, 0x1001, 0x1001, 0x1002, 0x1001, 0x1002, 0x1012, 0x1001, 0x1008, + 0x100b, 0x1001, 0x1003, 0x1001, 0x1004, 0x1002, 0x1001, 0x1001, 0x1006, 0x1002, 0x1002, 0x1001, 0x1001, + 0x1001, 0x1001, 0x1003, 0x1002, 0x1002, 0x1001, 0x1002, 0x1001, 0x1001, 0x1001, 0x1001, 0x1001, 0x1010, + 0x1010, 0x1002, 0x1001, 0x1001, 0x1005, 0x1003, 0x1002, 0x1004, 0x1003, 0x1001, 0x1002, 0x1004, 0x1005, + 0x1002, 0x1004, 0x100b, 0x1004, 0x1001, 0x100f, 0x1001, 0x1002, 0x1003, 0x1004, 0x1002, 0x1001, 0x1003, + 0x1005, 0x1008, 0x1001, 0x1002, 0x1009, 0x1001, 0x1004, 0x1001, 0x1003, 0x1004, 0x1001, 0x1001, 0x1001, + 0x1008, 0x1002, 0x1002, 0x1001, 0x1001, 0x1001, 0x1001, 0x1007, 0x1005, 0x1001, 0x1006, 0x1001, 0x1001, + 0x1003, 0x1003, 0x1001, 0x1002, 0x1008, 0x1003, 0x1001, 0x1001, 0x1001, 0x1006, 0x1001, 0x1001, 0x1002, + 0x1002, 0x1001, 0x1004, 0x1002, 0x1002, 0x1002, 0x1008, 0x1001, 0x1002, 0x1001, 0x1001, 0x1008, 0x1001, + 0x1001, 0x1004, 0x1005, 0x1009, 0x1002, 0x1001, 0x1004, 0x1001, 0x1004, 0x1002, 0x1001, 0x100a, 0x1006, + 0x1004, 0x1001, 0x1006, 0x1003, 0x100d, 0x1002, 0x1007, 0x1006, 0x1001, 0x1016, 0x1007, 0x1002, 0x1002, + 0x1006, 0x1001, 0x1002, 0x1007, 0x1001, 0x1002, 0x1001, 0x1001, 0x1002, 0x1002, 0x1005, 0x1003, 0x1001, + 0x1001, 0x100f, 0x100c, 0x1003, 0x1005, 0x1007, 0x1001, 0x1004, 0x1001, 0x1002, 0x1002, 0x102e, 0x1017, + 0x1005, 0x1006, 0x1008, 0x1007, 0x1004, 0x1003, 0x1037, 0x1032, 0x1001, 0x1001, 0x1005, 0x100f, 0x1007, + 0x1011, 0x1007, 0x1002, 0x1005, 0x1001, 0x1007, 0x1001, 0x1004, 0x1004, 0x1002, 0x1007, 0x1007, 0x1005, + 0x1060, 0x10f0}}; // emoji-data.txt -// Date: 2022-08-02, 00:26:10 GMT +// Date: 2024-05-01, 21:25:24 GMT enum class _Extended_Pictographic_property_values : uint8_t { _Extended_Pictographic_value, _No_value = 255 }; // emoji-data.txt -// Date: 2022-08-02, 00:26:10 GMT +// Date: 2024-05-01, 21:25:24 GMT inline constexpr _Unicode_property_data<_Extended_Pictographic_property_values, 78, true> _Extended_Pictographic_property_data{ {0xa9, 0xae, 0x203c, 0x2049, 0x2122, 0x2139, 0x2194, 0x21a9, 0x231a, 0x2328, 0x2388, 0x23cf, 0x23e9, 0x23f8, @@ -371,15 +451,15 @@ inline constexpr _Unicode_property_data<_Extended_Pictographic_property_values, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x100, 0x3, 0x1, 0x6, 0x2, 0x1, 0xa, 0x39, 0xf, 0x1, 0x1, 0x9, 0x4, 0x1b2, 0x13e, 0x10a, 0x80, 0xc, 0x2b, 0x4, 0x8, 0x6, 0x8, 0x52, 0x2f, 0xa, 0x1b9, 0x3fe}}; -// DerivedGeneralCategory-15.0.0.txt -// Date: 2022-04-26, 23:14:35 GMT +// DerivedGeneralCategory-16.0.0.txt +// Date: 2024-04-30, 21:48:17 GMT enum class __printable_property_values : uint8_t { _Yes_value, _No_value = 255 }; -// DerivedGeneralCategory-15.0.0.txt -// Date: 2022-04-26, 23:14:35 GMT -inline constexpr _Unicode_property_data<__printable_property_values, 711, true> __printable_property_data{ +// DerivedGeneralCategory-16.0.0.txt +// Date: 2024-04-30, 21:48:17 GMT +inline constexpr _Unicode_property_data<__printable_property_values, 736, true> __printable_property_data{ {0x20, 0xa1, 0xae, 0x37a, 0x384, 0x38c, 0x38e, 0x3a3, 0x531, 0x559, 0x58d, 0x591, 0x5d0, 0x5ef, 0x606, 0x61d, 0x6de, - 0x710, 0x74d, 0x7c0, 0x7fd, 0x830, 0x840, 0x85e, 0x860, 0x870, 0x898, 0x8e3, 0x985, 0x98f, 0x993, 0x9aa, 0x9b2, + 0x710, 0x74d, 0x7c0, 0x7fd, 0x830, 0x840, 0x85e, 0x860, 0x870, 0x897, 0x8e3, 0x985, 0x98f, 0x993, 0x9aa, 0x9b2, 0x9b6, 0x9bc, 0x9c7, 0x9cb, 0x9d7, 0x9dc, 0x9df, 0x9e6, 0xa01, 0xa05, 0xa0f, 0xa13, 0xa2a, 0xa32, 0xa35, 0xa38, 0xa3c, 0xa3e, 0xa47, 0xa4b, 0xa51, 0xa59, 0xa5e, 0xa66, 0xa81, 0xa85, 0xa8f, 0xa93, 0xaaa, 0xab2, 0xab5, 0xabc, 0xac7, 0xacb, 0xad0, 0xae0, 0xae6, 0xaf9, 0xb01, 0xb05, 0xb0f, 0xb13, 0xb2a, 0xb32, 0xb35, 0xb3c, 0xb47, 0xb4b, @@ -392,48 +472,50 @@ inline constexpr _Unicode_property_data<__printable_property_values, 711, true> 0x12b2, 0x12b8, 0x12c0, 0x12c2, 0x12c8, 0x12d8, 0x1312, 0x1318, 0x135d, 0x1380, 0x13a0, 0x13f8, 0x1400, 0x1681, 0x16a0, 0x1700, 0x171f, 0x1740, 0x1760, 0x176e, 0x1772, 0x1780, 0x17e0, 0x17f0, 0x1800, 0x180f, 0x1820, 0x1880, 0x18b0, 0x1900, 0x1920, 0x1930, 0x1940, 0x1944, 0x1970, 0x1980, 0x19b0, 0x19d0, 0x19de, 0x1a1e, 0x1a60, 0x1a7f, - 0x1a90, 0x1aa0, 0x1ab0, 0x1b00, 0x1b50, 0x1b80, 0x1bfc, 0x1c3b, 0x1c4d, 0x1c90, 0x1cbd, 0x1cd0, 0x1d00, 0x1f18, - 0x1f20, 0x1f48, 0x1f50, 0x1f59, 0x1f5b, 0x1f5d, 0x1f5f, 0x1f80, 0x1fb6, 0x1fc6, 0x1fd6, 0x1fdd, 0x1ff2, 0x1ff6, - 0x2010, 0x2030, 0x2070, 0x2074, 0x2090, 0x20a0, 0x20d0, 0x2100, 0x2190, 0x2440, 0x2460, 0x2b76, 0x2b97, 0x2cf9, - 0x2d27, 0x2d2d, 0x2d30, 0x2d6f, 0x2d7f, 0x2da0, 0x2da8, 0x2db0, 0x2db8, 0x2dc0, 0x2dc8, 0x2dd0, 0x2dd8, 0x2de0, - 0x2e80, 0x2e9b, 0x2f00, 0x2ff0, 0x3001, 0x3041, 0x3099, 0x3105, 0x3131, 0x3190, 0x31f0, 0x3220, 0xa490, 0xa4d0, - 0xa640, 0xa700, 0xa7d0, 0xa7d3, 0xa7d5, 0xa7f2, 0xa830, 0xa840, 0xa880, 0xa8ce, 0xa8e0, 0xa95f, 0xa980, 0xa9cf, - 0xa9de, 0xaa00, 0xaa40, 0xaa50, 0xaa5c, 0xaadb, 0xab01, 0xab09, 0xab11, 0xab20, 0xab28, 0xab30, 0xab70, 0xabf0, - 0xac00, 0xd7b0, 0xd7cb, 0xf900, 0xfa70, 0xfb00, 0xfb13, 0xfb1d, 0xfb38, 0xfb3e, 0xfb40, 0xfb43, 0xfb46, 0xfbd3, - 0xfd92, 0xfdcf, 0xfdf0, 0xfe20, 0xfe54, 0xfe68, 0xfe70, 0xfe76, 0xff01, 0xffc2, 0xffca, 0xffd2, 0xffda, 0xffe0, - 0xffe8, 0xfffc, 0x10000, 0x1000d, 0x10028, 0x1003c, 0x1003f, 0x10050, 0x10080, 0x10100, 0x10107, 0x10137, - 0x10190, 0x101a0, 0x101d0, 0x10280, 0x102a0, 0x102e0, 0x10300, 0x1032d, 0x10350, 0x10380, 0x1039f, 0x103c8, - 0x10400, 0x104a0, 0x104b0, 0x104d8, 0x10500, 0x10530, 0x1056f, 0x1057c, 0x1058c, 0x10594, 0x10597, 0x105a3, - 0x105b3, 0x105bb, 0x10600, 0x10740, 0x10760, 0x10780, 0x10787, 0x107b2, 0x10800, 0x10808, 0x1080a, 0x10837, + 0x1a90, 0x1aa0, 0x1ab0, 0x1b00, 0x1b4e, 0x1bfc, 0x1c3b, 0x1c4d, 0x1c90, 0x1cbd, 0x1cd0, 0x1d00, 0x1f18, 0x1f20, + 0x1f48, 0x1f50, 0x1f59, 0x1f5b, 0x1f5d, 0x1f5f, 0x1f80, 0x1fb6, 0x1fc6, 0x1fd6, 0x1fdd, 0x1ff2, 0x1ff6, 0x2010, + 0x2030, 0x2070, 0x2074, 0x2090, 0x20a0, 0x20d0, 0x2100, 0x2190, 0x2440, 0x2460, 0x2b76, 0x2b97, 0x2cf9, 0x2d27, + 0x2d2d, 0x2d30, 0x2d6f, 0x2d7f, 0x2da0, 0x2da8, 0x2db0, 0x2db8, 0x2dc0, 0x2dc8, 0x2dd0, 0x2dd8, 0x2de0, 0x2e80, + 0x2e9b, 0x2f00, 0x2ff0, 0x3001, 0x3041, 0x3099, 0x3105, 0x3131, 0x3190, 0x31ef, 0x3220, 0xa490, 0xa4d0, 0xa640, + 0xa700, 0xa7d0, 0xa7d3, 0xa7d5, 0xa7f2, 0xa830, 0xa840, 0xa880, 0xa8ce, 0xa8e0, 0xa95f, 0xa980, 0xa9cf, 0xa9de, + 0xaa00, 0xaa40, 0xaa50, 0xaa5c, 0xaadb, 0xab01, 0xab09, 0xab11, 0xab20, 0xab28, 0xab30, 0xab70, 0xabf0, 0xac00, + 0xd7b0, 0xd7cb, 0xf900, 0xfa70, 0xfb00, 0xfb13, 0xfb1d, 0xfb38, 0xfb3e, 0xfb40, 0xfb43, 0xfb46, 0xfbd3, 0xfd92, + 0xfdcf, 0xfdf0, 0xfe20, 0xfe54, 0xfe68, 0xfe70, 0xfe76, 0xff01, 0xffc2, 0xffca, 0xffd2, 0xffda, 0xffe0, 0xffe8, + 0xfffc, 0x10000, 0x1000d, 0x10028, 0x1003c, 0x1003f, 0x10050, 0x10080, 0x10100, 0x10107, 0x10137, 0x10190, + 0x101a0, 0x101d0, 0x10280, 0x102a0, 0x102e0, 0x10300, 0x1032d, 0x10350, 0x10380, 0x1039f, 0x103c8, 0x10400, + 0x104a0, 0x104b0, 0x104d8, 0x10500, 0x10530, 0x1056f, 0x1057c, 0x1058c, 0x10594, 0x10597, 0x105a3, 0x105b3, + 0x105bb, 0x105c0, 0x10600, 0x10740, 0x10760, 0x10780, 0x10787, 0x107b2, 0x10800, 0x10808, 0x1080a, 0x10837, 0x1083c, 0x1083f, 0x10857, 0x108a7, 0x108e0, 0x108f4, 0x108fb, 0x1091f, 0x1093f, 0x10980, 0x109bc, 0x109d2, 0x10a05, 0x10a0c, 0x10a15, 0x10a19, 0x10a38, 0x10a3f, 0x10a50, 0x10a60, 0x10ac0, 0x10aeb, 0x10b00, 0x10b39, - 0x10b58, 0x10b78, 0x10b99, 0x10ba9, 0x10c00, 0x10c80, 0x10cc0, 0x10cfa, 0x10d30, 0x10e60, 0x10e80, 0x10eab, - 0x10eb0, 0x10efd, 0x10f30, 0x10f70, 0x10fb0, 0x10fe0, 0x11000, 0x11052, 0x1107f, 0x110be, 0x110d0, 0x110f0, - 0x11100, 0x11136, 0x11150, 0x11180, 0x111e1, 0x11200, 0x11213, 0x11280, 0x11288, 0x1128a, 0x1128f, 0x1129f, - 0x112b0, 0x112f0, 0x11300, 0x11305, 0x1130f, 0x11313, 0x1132a, 0x11332, 0x11335, 0x1133b, 0x11347, 0x1134b, - 0x11350, 0x11357, 0x1135d, 0x11366, 0x11370, 0x11400, 0x1145d, 0x11480, 0x114d0, 0x11580, 0x115b8, 0x11600, - 0x11650, 0x11660, 0x11680, 0x116c0, 0x11700, 0x1171d, 0x11730, 0x11800, 0x118a0, 0x118ff, 0x11909, 0x1190c, - 0x11915, 0x11918, 0x11937, 0x1193b, 0x11950, 0x119a0, 0x119aa, 0x119da, 0x11a00, 0x11a50, 0x11ab0, 0x11b00, - 0x11c00, 0x11c0a, 0x11c38, 0x11c50, 0x11c70, 0x11c92, 0x11ca9, 0x11d00, 0x11d08, 0x11d0b, 0x11d3a, 0x11d3c, - 0x11d3f, 0x11d50, 0x11d60, 0x11d67, 0x11d6a, 0x11d90, 0x11d93, 0x11da0, 0x11ee0, 0x11f00, 0x11f12, 0x11f3e, - 0x11fb0, 0x11fc0, 0x11fff, 0x12400, 0x12470, 0x12480, 0x12f90, 0x13000, 0x13440, 0x14400, 0x16800, 0x16a40, - 0x16a60, 0x16a6e, 0x16ac0, 0x16ad0, 0x16af0, 0x16b00, 0x16b50, 0x16b5b, 0x16b63, 0x16b7d, 0x16e40, 0x16f00, - 0x16f4f, 0x16f8f, 0x16fe0, 0x16ff0, 0x17000, 0x18800, 0x18d00, 0x1aff0, 0x1aff5, 0x1affd, 0x1b000, 0x1b132, - 0x1b150, 0x1b155, 0x1b164, 0x1b170, 0x1bc00, 0x1bc70, 0x1bc80, 0x1bc90, 0x1bc9c, 0x1cf00, 0x1cf30, 0x1cf50, - 0x1d000, 0x1d100, 0x1d129, 0x1d17b, 0x1d200, 0x1d2c0, 0x1d2e0, 0x1d300, 0x1d360, 0x1d400, 0x1d456, 0x1d49e, - 0x1d4a2, 0x1d4a5, 0x1d4a9, 0x1d4ae, 0x1d4bb, 0x1d4bd, 0x1d4c5, 0x1d507, 0x1d50d, 0x1d516, 0x1d51e, 0x1d53b, - 0x1d540, 0x1d546, 0x1d54a, 0x1d552, 0x1d6a8, 0x1d7ce, 0x1da9b, 0x1daa1, 0x1df00, 0x1df25, 0x1e000, 0x1e008, - 0x1e01b, 0x1e023, 0x1e026, 0x1e030, 0x1e08f, 0x1e100, 0x1e130, 0x1e140, 0x1e14e, 0x1e290, 0x1e2c0, 0x1e2ff, - 0x1e4d0, 0x1e7e0, 0x1e7e8, 0x1e7ed, 0x1e7f0, 0x1e800, 0x1e8c7, 0x1e900, 0x1e950, 0x1e95e, 0x1ec71, 0x1ed01, - 0x1ee00, 0x1ee05, 0x1ee21, 0x1ee24, 0x1ee27, 0x1ee29, 0x1ee34, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, - 0x1ee4b, 0x1ee4d, 0x1ee51, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee64, 0x1ee67, - 0x1ee6c, 0x1ee74, 0x1ee79, 0x1ee7e, 0x1ee80, 0x1ee8b, 0x1eea1, 0x1eea5, 0x1eeab, 0x1eef0, 0x1f000, 0x1f030, - 0x1f0a0, 0x1f0b1, 0x1f0c1, 0x1f0d1, 0x1f100, 0x1f1e6, 0x1f210, 0x1f240, 0x1f250, 0x1f260, 0x1f300, 0x1f6dc, - 0x1f6f0, 0x1f700, 0x1f77b, 0x1f7e0, 0x1f7f0, 0x1f800, 0x1f810, 0x1f850, 0x1f860, 0x1f890, 0x1f8b0, 0x1f900, - 0x1fa60, 0x1fa70, 0x1fa80, 0x1fa90, 0x1fabf, 0x1face, 0x1fae0, 0x1faf0, 0x1fb00, 0x1fb94, 0x1fbf0, 0x20000, - 0x2a700, 0x2b740, 0x2b820, 0x2ceb0, 0x2f800, 0x30000, 0x31350, 0xe0100}, + 0x10b58, 0x10b78, 0x10b99, 0x10ba9, 0x10c00, 0x10c80, 0x10cc0, 0x10cfa, 0x10d30, 0x10d40, 0x10d69, 0x10d8e, + 0x10e60, 0x10e80, 0x10eab, 0x10eb0, 0x10ec2, 0x10efc, 0x10f30, 0x10f70, 0x10fb0, 0x10fe0, 0x11000, 0x11052, + 0x1107f, 0x110be, 0x110d0, 0x110f0, 0x11100, 0x11136, 0x11150, 0x11180, 0x111e1, 0x11200, 0x11213, 0x11280, + 0x11288, 0x1128a, 0x1128f, 0x1129f, 0x112b0, 0x112f0, 0x11300, 0x11305, 0x1130f, 0x11313, 0x1132a, 0x11332, + 0x11335, 0x1133b, 0x11347, 0x1134b, 0x11350, 0x11357, 0x1135d, 0x11366, 0x11370, 0x11380, 0x1138b, 0x1138e, + 0x11390, 0x113b7, 0x113c2, 0x113c5, 0x113c7, 0x113cc, 0x113d7, 0x113e1, 0x11400, 0x1145d, 0x11480, 0x114d0, + 0x11580, 0x115b8, 0x11600, 0x11650, 0x11660, 0x11680, 0x116c0, 0x116d0, 0x11700, 0x1171d, 0x11730, 0x11800, + 0x118a0, 0x118ff, 0x11909, 0x1190c, 0x11915, 0x11918, 0x11937, 0x1193b, 0x11950, 0x119a0, 0x119aa, 0x119da, + 0x11a00, 0x11a50, 0x11ab0, 0x11b00, 0x11bc0, 0x11bf0, 0x11c00, 0x11c0a, 0x11c38, 0x11c50, 0x11c70, 0x11c92, + 0x11ca9, 0x11d00, 0x11d08, 0x11d0b, 0x11d3a, 0x11d3c, 0x11d3f, 0x11d50, 0x11d60, 0x11d67, 0x11d6a, 0x11d90, + 0x11d93, 0x11da0, 0x11ee0, 0x11f00, 0x11f12, 0x11f3e, 0x11fb0, 0x11fc0, 0x11fff, 0x12400, 0x12470, 0x12480, + 0x12f90, 0x13000, 0x13440, 0x13460, 0x14400, 0x16100, 0x16800, 0x16a40, 0x16a60, 0x16a6e, 0x16ac0, 0x16ad0, + 0x16af0, 0x16b00, 0x16b50, 0x16b5b, 0x16b63, 0x16b7d, 0x16d40, 0x16e40, 0x16f00, 0x16f4f, 0x16f8f, 0x16fe0, + 0x16ff0, 0x17000, 0x18800, 0x18cff, 0x1aff0, 0x1aff5, 0x1affd, 0x1b000, 0x1b132, 0x1b150, 0x1b155, 0x1b164, + 0x1b170, 0x1bc00, 0x1bc70, 0x1bc80, 0x1bc90, 0x1bc9c, 0x1cc00, 0x1cd00, 0x1cf00, 0x1cf30, 0x1cf50, 0x1d000, + 0x1d100, 0x1d129, 0x1d17b, 0x1d200, 0x1d2c0, 0x1d2e0, 0x1d300, 0x1d360, 0x1d400, 0x1d456, 0x1d49e, 0x1d4a2, + 0x1d4a5, 0x1d4a9, 0x1d4ae, 0x1d4bb, 0x1d4bd, 0x1d4c5, 0x1d507, 0x1d50d, 0x1d516, 0x1d51e, 0x1d53b, 0x1d540, + 0x1d546, 0x1d54a, 0x1d552, 0x1d6a8, 0x1d7ce, 0x1da9b, 0x1daa1, 0x1df00, 0x1df25, 0x1e000, 0x1e008, 0x1e01b, + 0x1e023, 0x1e026, 0x1e030, 0x1e08f, 0x1e100, 0x1e130, 0x1e140, 0x1e14e, 0x1e290, 0x1e2c0, 0x1e2ff, 0x1e4d0, + 0x1e5d0, 0x1e5ff, 0x1e7e0, 0x1e7e8, 0x1e7ed, 0x1e7f0, 0x1e800, 0x1e8c7, 0x1e900, 0x1e950, 0x1e95e, 0x1ec71, + 0x1ed01, 0x1ee00, 0x1ee05, 0x1ee21, 0x1ee24, 0x1ee27, 0x1ee29, 0x1ee34, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, + 0x1ee49, 0x1ee4b, 0x1ee4d, 0x1ee51, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee64, + 0x1ee67, 0x1ee6c, 0x1ee74, 0x1ee79, 0x1ee7e, 0x1ee80, 0x1ee8b, 0x1eea1, 0x1eea5, 0x1eeab, 0x1eef0, 0x1f000, + 0x1f030, 0x1f0a0, 0x1f0b1, 0x1f0c1, 0x1f0d1, 0x1f100, 0x1f1e6, 0x1f210, 0x1f240, 0x1f250, 0x1f260, 0x1f300, + 0x1f6dc, 0x1f6f0, 0x1f700, 0x1f77b, 0x1f7e0, 0x1f7f0, 0x1f800, 0x1f810, 0x1f850, 0x1f860, 0x1f890, 0x1f8b0, + 0x1f8c0, 0x1f900, 0x1fa60, 0x1fa70, 0x1fa80, 0x1fa8f, 0x1face, 0x1fadf, 0x1faf0, 0x1fb00, 0x1fb94, 0x20000, + 0x2a700, 0x2b740, 0x2b820, 0x2ceb0, 0x2ebf0, 0x2f800, 0x30000, 0x31350, 0xe0100}, {0x5f, 0xc, 0x2ca, 0x6, 0x7, 0x1, 0x14, 0x18d, 0x26, 0x32, 0x3, 0x37, 0x1b, 0x6, 0x16, 0xc0, 0x30, 0x3b, 0x65, 0x3b, - 0x31, 0xf, 0x1c, 0x1, 0xb, 0x1f, 0x4a, 0xa1, 0x8, 0x2, 0x16, 0x7, 0x1, 0x4, 0x9, 0x2, 0x4, 0x1, 0x2, 0x5, 0x19, + 0x31, 0xf, 0x1c, 0x1, 0xb, 0x1f, 0x4b, 0xa1, 0x8, 0x2, 0x16, 0x7, 0x1, 0x4, 0x9, 0x2, 0x4, 0x1, 0x2, 0x5, 0x19, 0x3, 0x6, 0x2, 0x16, 0x7, 0x2, 0x2, 0x2, 0x1, 0x5, 0x2, 0x3, 0x1, 0x4, 0x1, 0x11, 0x3, 0x9, 0x3, 0x16, 0x7, 0x2, 0x5, 0xa, 0x3, 0x3, 0x1, 0x4, 0xc, 0x7, 0x3, 0x8, 0x2, 0x16, 0x7, 0x2, 0x5, 0x9, 0x2, 0x3, 0x3, 0x2, 0x5, 0x12, 0x2, 0x6, 0x3, 0x4, 0x2, 0x1, 0x2, 0x2, 0x3, 0xc, 0x5, 0x3, 0x4, 0x1, 0x1, 0x15, 0xd, 0x3, 0x17, 0x10, 0x9, 0x3, @@ -442,103 +524,106 @@ inline constexpr _Unicode_property_data<__printable_property_values, 711, true> 0x18, 0x1, 0x17, 0x5, 0x1, 0x7, 0xa, 0x4, 0x48, 0x24, 0x27, 0x24, 0xf, 0xd, 0xc6, 0x1, 0x1, 0x179, 0x4, 0x7, 0x1, 0x4, 0x29, 0x4, 0x21, 0x4, 0x7, 0x1, 0x4, 0xf, 0x39, 0x4, 0x43, 0x20, 0x1a, 0x56, 0x6, 0x280, 0x1c, 0x59, 0x16, 0x18, 0x14, 0xd, 0x3, 0x2, 0x5e, 0xa, 0xa, 0xe, 0xb, 0x59, 0x2b, 0x46, 0x1f, 0xc, 0xc, 0x1, 0x2a, 0x5, - 0x2c, 0x1a, 0xb, 0x3e, 0x41, 0x1d, 0xb, 0xa, 0xe, 0x1f, 0x4d, 0x2f, 0x74, 0x3c, 0xf, 0x3c, 0x2b, 0xb, 0x2b, - 0x216, 0x6, 0x26, 0x6, 0x8, 0x1, 0x1, 0x1, 0x1f, 0x35, 0xf, 0xe, 0x6, 0x13, 0x3, 0x9, 0x18, 0x2f, 0x2, 0x1b, - 0xd, 0x21, 0x21, 0x8c, 0x297, 0xb, 0x714, 0x20, 0x15d, 0x2d, 0x1, 0x1, 0x38, 0x2, 0x18, 0x7, 0x7, 0x7, 0x7, 0x7, - 0x7, 0x7, 0x7, 0x7e, 0x1a, 0x59, 0xd6, 0xc, 0x3f, 0x56, 0x67, 0x2b, 0x5e, 0x54, 0x2f, 0x726d, 0x37, 0x15c, 0xb8, - 0xcb, 0x2, 0x1, 0x5, 0x3b, 0xa, 0x38, 0x46, 0xc, 0x74, 0x1e, 0x4e, 0xb, 0x21, 0x37, 0xe, 0xa, 0x67, 0x1c, 0x6, - 0x6, 0x6, 0x7, 0x7, 0x3c, 0x7e, 0xa, 0x2ba4, 0x17, 0x31, 0x16e, 0x6a, 0x7, 0x5, 0x1a, 0x5, 0x1, 0x2, 0x2, 0x7d, + 0x2c, 0x1a, 0xb, 0x3e, 0x41, 0x1d, 0xb, 0xa, 0xe, 0x1f, 0x4d, 0xa6, 0x3c, 0xf, 0x3e, 0x2b, 0xb, 0x2b, 0x216, + 0x6, 0x26, 0x6, 0x8, 0x1, 0x1, 0x1, 0x1f, 0x35, 0xf, 0xe, 0x6, 0x13, 0x3, 0x9, 0x18, 0x2f, 0x2, 0x1b, 0xd, 0x21, + 0x21, 0x8c, 0x29a, 0xb, 0x714, 0x20, 0x15d, 0x2d, 0x1, 0x1, 0x38, 0x2, 0x18, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, + 0x7, 0x7e, 0x1a, 0x59, 0xd6, 0x10, 0x3f, 0x56, 0x67, 0x2b, 0x5e, 0x56, 0x30, 0x726d, 0x37, 0x15c, 0xb8, 0xce, + 0x2, 0x1, 0x8, 0x3b, 0xa, 0x38, 0x46, 0xc, 0x74, 0x1e, 0x4e, 0xb, 0x21, 0x37, 0xe, 0xa, 0x67, 0x1c, 0x6, 0x6, + 0x6, 0x7, 0x7, 0x3c, 0x7e, 0xa, 0x2ba4, 0x17, 0x31, 0x16e, 0x6a, 0x7, 0x5, 0x1a, 0x5, 0x1, 0x2, 0x2, 0x7d, 0x1bd, 0x36, 0x1, 0x2a, 0x33, 0x13, 0x4, 0x5, 0x87, 0xbe, 0x6, 0x6, 0x6, 0x3, 0x7, 0x7, 0x2, 0xc, 0x1a, 0x13, 0x2, 0xf, 0xe, 0x7b, 0x3, 0x2d, 0x58, 0xd, 0x1, 0x2e, 0x1d, 0x31, 0x1c, 0x24, 0x1e, 0x2b, 0x1e, 0x25, 0xe, 0x9e, - 0xa, 0x24, 0x24, 0x28, 0x34, 0xc, 0xf, 0x7, 0x2, 0xb, 0xf, 0x7, 0x2, 0x137, 0x16, 0x8, 0x6, 0x2a, 0x9, 0x6, 0x1, - 0x2c, 0x2, 0x1, 0x17, 0x48, 0x9, 0x13, 0x2, 0x21, 0x1b, 0x1, 0x38, 0x14, 0x32, 0x2, 0x8, 0x3, 0x1d, 0x3, 0xa, - 0x9, 0x40, 0x27, 0xc, 0x36, 0x1d, 0x1b, 0x1a, 0x4, 0x7, 0x49, 0x33, 0x33, 0x2e, 0xa, 0x1f, 0x2a, 0x3, 0x2, 0x2b, - 0x2a, 0x1a, 0x1c, 0x17, 0x4e, 0x24, 0x3e, 0x5, 0x19, 0xa, 0x35, 0x12, 0x27, 0x60, 0x14, 0x12, 0x2f, 0x7, 0x1, - 0x4, 0xf, 0xb, 0x3b, 0xa, 0x4, 0x8, 0x2, 0x16, 0x7, 0x2, 0x5, 0xa, 0x2, 0x3, 0x1, 0x1, 0x7, 0x7, 0x5, 0x5c, 0x5, - 0x48, 0xa, 0x36, 0x26, 0x45, 0xa, 0xd, 0x3a, 0xa, 0x1b, 0xf, 0x17, 0x3c, 0x53, 0x8, 0x1, 0x8, 0x2, 0x1e, 0x2, - 0xc, 0xa, 0x8, 0x2e, 0xb, 0x48, 0x53, 0x49, 0xa, 0x9, 0x2d, 0xe, 0x1d, 0x20, 0x16, 0xe, 0x7, 0x2, 0x2c, 0x1, - 0x2, 0x9, 0xa, 0x6, 0x2, 0x25, 0x2, 0x6, 0xa, 0x19, 0x11, 0x29, 0x1c, 0x1, 0x32, 0x39b, 0x6f, 0x5, 0xc4, 0x63, - 0x430, 0x16, 0x247, 0x239, 0x1f, 0xa, 0x51, 0xa, 0x1e, 0x6, 0x46, 0xa, 0x7, 0x15, 0x13, 0x5b, 0x4b, 0x39, 0x11, - 0x5, 0x2, 0x17f8, 0x4d6, 0x9, 0x4, 0x7, 0x2, 0x123, 0x1, 0x3, 0x1, 0x4, 0x18c, 0x6b, 0xd, 0x9, 0xa, 0x4, 0x2e, - 0x17, 0x74, 0xf6, 0x27, 0x4a, 0x70, 0x46, 0x14, 0x14, 0x57, 0x19, 0x55, 0x47, 0x2, 0x1, 0x2, 0x4, 0xc, 0x1, 0x7, - 0x41, 0x4, 0x8, 0x7, 0x1c, 0x4, 0x5, 0x1, 0x7, 0x154, 0x124, 0x2be, 0x5, 0xf, 0x1f, 0x6, 0x7, 0x11, 0x7, 0x2, - 0x5, 0x3e, 0x1, 0x2d, 0xe, 0xa, 0x2, 0x1f, 0x3a, 0x1, 0x2a, 0x7, 0x4, 0x2, 0xf, 0xc5, 0x10, 0x4c, 0xa, 0x2, - 0x44, 0x3d, 0x4, 0x1b, 0x2, 0x1, 0x1, 0xa, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, - 0x1, 0x2, 0x1, 0x4, 0x7, 0x4, 0x4, 0x1, 0xa, 0x11, 0x3, 0x5, 0x11, 0x2, 0x2c, 0x64, 0xf, 0xf, 0xf, 0x25, 0xae, - 0x1d, 0x2c, 0x9, 0x2, 0x6, 0x3d8, 0x11, 0xd, 0x77, 0x5f, 0xc, 0x1, 0xc, 0x38, 0xa, 0x28, 0x1e, 0x2, 0x154, 0xe, - 0xd, 0x9, 0x2e, 0x7, 0xe, 0x9, 0x9, 0x93, 0x37, 0xa, 0xa6e0, 0x103a, 0xde, 0x1682, 0x1d31, 0x21e, 0x134b, - 0x1060, 0xf0}}; + 0xa, 0x24, 0x24, 0x28, 0x34, 0xc, 0xf, 0x7, 0x2, 0xb, 0xf, 0x7, 0x2, 0x34, 0x137, 0x16, 0x8, 0x6, 0x2a, 0x9, + 0x6, 0x1, 0x2c, 0x2, 0x1, 0x17, 0x48, 0x9, 0x13, 0x2, 0x21, 0x1b, 0x1, 0x38, 0x14, 0x32, 0x2, 0x8, 0x3, 0x1d, + 0x3, 0xa, 0x9, 0x40, 0x27, 0xc, 0x36, 0x1d, 0x1b, 0x1a, 0x4, 0x7, 0x49, 0x33, 0x33, 0x2e, 0xa, 0x26, 0x1d, 0x2, + 0x1f, 0x2a, 0x3, 0x2, 0x3, 0x2c, 0x2a, 0x1a, 0x1c, 0x17, 0x4e, 0x24, 0x3e, 0x5, 0x19, 0xa, 0x35, 0x12, 0x27, + 0x60, 0x14, 0x12, 0x2f, 0x7, 0x1, 0x4, 0xf, 0xb, 0x3b, 0xa, 0x4, 0x8, 0x2, 0x16, 0x7, 0x2, 0x5, 0xa, 0x2, 0x3, + 0x1, 0x1, 0x7, 0x7, 0x5, 0xa, 0x1, 0x1, 0x26, 0xa, 0x1, 0x1, 0x4, 0xa, 0x2, 0x2, 0x5c, 0x5, 0x48, 0xa, 0x36, + 0x26, 0x45, 0xa, 0xd, 0x3a, 0xa, 0x14, 0x1b, 0xf, 0x17, 0x3c, 0x53, 0x8, 0x1, 0x8, 0x2, 0x1e, 0x2, 0xc, 0xa, + 0x8, 0x2e, 0xb, 0x48, 0x53, 0x49, 0xa, 0x22, 0xa, 0x9, 0x2d, 0xe, 0x1d, 0x20, 0x16, 0xe, 0x7, 0x2, 0x2c, 0x1, + 0x2, 0x9, 0xa, 0x6, 0x2, 0x25, 0x2, 0x6, 0xa, 0x19, 0x11, 0x29, 0x1d, 0x1, 0x32, 0x39b, 0x6f, 0x5, 0xc4, 0x63, + 0x430, 0x16, 0xf9b, 0x247, 0x3a, 0x239, 0x1f, 0xa, 0x51, 0xa, 0x1e, 0x6, 0x46, 0xa, 0x7, 0x15, 0x13, 0x3a, 0x5b, + 0x4b, 0x39, 0x11, 0x5, 0x2, 0x17f8, 0x4d6, 0xa, 0x4, 0x7, 0x2, 0x123, 0x1, 0x3, 0x1, 0x4, 0x18c, 0x6b, 0xd, 0x9, + 0xa, 0x4, 0xfa, 0x1b4, 0x2e, 0x17, 0x74, 0xf6, 0x27, 0x4a, 0x70, 0x46, 0x14, 0x14, 0x57, 0x19, 0x55, 0x47, 0x2, + 0x1, 0x2, 0x4, 0xc, 0x1, 0x7, 0x41, 0x4, 0x8, 0x7, 0x1c, 0x4, 0x5, 0x1, 0x7, 0x154, 0x124, 0x2be, 0x5, 0xf, + 0x1f, 0x6, 0x7, 0x11, 0x7, 0x2, 0x5, 0x3e, 0x1, 0x2d, 0xe, 0xa, 0x2, 0x1f, 0x3a, 0x1, 0x2a, 0x2b, 0x1, 0x7, 0x4, + 0x2, 0xf, 0xc5, 0x10, 0x4c, 0xa, 0x2, 0x44, 0x3d, 0x4, 0x1b, 0x2, 0x1, 0x1, 0xa, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, + 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x4, 0x7, 0x4, 0x4, 0x1, 0xa, 0x11, 0x3, 0x5, 0x11, 0x2, + 0x2c, 0x64, 0xf, 0xf, 0xf, 0x25, 0xae, 0x1d, 0x2c, 0x9, 0x2, 0x6, 0x3d8, 0x11, 0xd, 0x77, 0x5f, 0xc, 0x1, 0xc, + 0x38, 0xa, 0x28, 0x1e, 0xc, 0x2, 0x154, 0xe, 0xd, 0xa, 0x38, 0xf, 0xb, 0x9, 0x93, 0x66, 0xa6e0, 0x103a, 0xde, + 0x1682, 0x1d31, 0x26e, 0x21e, 0x134b, 0x1060, 0xf0}}; -// DerivedCoreProperties-15.0.0.txt -// Date: 2022-08-05, 22:17:05 GMT +// DerivedCoreProperties-16.0.0.txt +// Date: 2024-05-31, 18:09:32 GMT enum class _Grapheme_Extend_property_values : uint8_t { _Grapheme_Extend_value, _No_value = 255 }; -// DerivedCoreProperties-15.0.0.txt -// Date: 2022-08-05, 22:17:05 GMT -inline constexpr _Unicode_property_data<_Grapheme_Extend_property_values, 363, true> _Grapheme_Extend_property_data{ +// DerivedCoreProperties-16.0.0.txt +// Date: 2024-05-31, 18:09:32 GMT +inline constexpr _Unicode_property_data<_Grapheme_Extend_property_values, 375, true> _Grapheme_Extend_property_data{ {0x300, 0x483, 0x591, 0x5bf, 0x5c1, 0x5c4, 0x5c7, 0x610, 0x64b, 0x670, 0x6d6, 0x6df, 0x6e7, 0x6ea, 0x711, 0x730, - 0x7a6, 0x7eb, 0x7fd, 0x816, 0x81b, 0x825, 0x829, 0x859, 0x898, 0x8ca, 0x8e3, 0x93a, 0x93c, 0x941, 0x94d, 0x951, + 0x7a6, 0x7eb, 0x7fd, 0x816, 0x81b, 0x825, 0x829, 0x859, 0x897, 0x8ca, 0x8e3, 0x93a, 0x93c, 0x941, 0x94d, 0x951, 0x962, 0x981, 0x9bc, 0x9be, 0x9c1, 0x9cd, 0x9d7, 0x9e2, 0x9fe, 0xa01, 0xa3c, 0xa41, 0xa47, 0xa4b, 0xa51, 0xa70, 0xa75, 0xa81, 0xabc, 0xac1, 0xac7, 0xacd, 0xae2, 0xafa, 0xb01, 0xb3c, 0xb3e, 0xb41, 0xb4d, 0xb55, 0xb62, 0xb82, 0xbbe, 0xbc0, 0xbcd, 0xbd7, 0xc00, 0xc04, 0xc3c, 0xc3e, 0xc46, 0xc4a, 0xc55, 0xc62, 0xc81, 0xcbc, 0xcbf, 0xcc2, - 0xcc6, 0xccc, 0xcd5, 0xce2, 0xd00, 0xd3b, 0xd3e, 0xd41, 0xd4d, 0xd57, 0xd62, 0xd81, 0xdca, 0xdcf, 0xdd2, 0xdd6, + 0xcc6, 0xcca, 0xcd5, 0xce2, 0xd00, 0xd3b, 0xd3e, 0xd41, 0xd4d, 0xd57, 0xd62, 0xd81, 0xdca, 0xdcf, 0xdd2, 0xdd6, 0xddf, 0xe31, 0xe34, 0xe47, 0xeb1, 0xeb4, 0xec8, 0xf18, 0xf35, 0xf37, 0xf39, 0xf71, 0xf80, 0xf86, 0xf8d, 0xf99, 0xfc6, 0x102d, 0x1032, 0x1039, 0x103d, 0x1058, 0x105e, 0x1071, 0x1082, 0x1085, 0x108d, 0x109d, 0x135d, 0x1712, 0x1732, 0x1752, 0x1772, 0x17b4, 0x17b7, 0x17c6, 0x17c9, 0x17dd, 0x180b, 0x180f, 0x1885, 0x18a9, 0x1920, 0x1927, 0x1932, 0x1939, 0x1a17, 0x1a1b, 0x1a56, 0x1a58, 0x1a60, 0x1a62, 0x1a65, 0x1a73, 0x1a7f, 0x1ab0, 0x1b00, 0x1b34, - 0x1b3c, 0x1b42, 0x1b6b, 0x1b80, 0x1ba2, 0x1ba8, 0x1bab, 0x1be6, 0x1be8, 0x1bed, 0x1bef, 0x1c2c, 0x1c36, 0x1cd0, - 0x1cd4, 0x1ce2, 0x1ced, 0x1cf4, 0x1cf8, 0x1dc0, 0x200c, 0x20d0, 0x2cef, 0x2d7f, 0x2de0, 0x302a, 0x3099, 0xa66f, - 0xa674, 0xa69e, 0xa6f0, 0xa802, 0xa806, 0xa80b, 0xa825, 0xa82c, 0xa8c4, 0xa8e0, 0xa8ff, 0xa926, 0xa947, 0xa980, - 0xa9b3, 0xa9b6, 0xa9bc, 0xa9e5, 0xaa29, 0xaa31, 0xaa35, 0xaa43, 0xaa4c, 0xaa7c, 0xaab0, 0xaab2, 0xaab7, 0xaabe, + 0x1b42, 0x1b6b, 0x1b80, 0x1ba2, 0x1ba8, 0x1be6, 0x1be8, 0x1bed, 0x1bef, 0x1c2c, 0x1c36, 0x1cd0, 0x1cd4, 0x1ce2, + 0x1ced, 0x1cf4, 0x1cf8, 0x1dc0, 0x200c, 0x20d0, 0x2cef, 0x2d7f, 0x2de0, 0x302a, 0x3099, 0xa66f, 0xa674, 0xa69e, + 0xa6f0, 0xa802, 0xa806, 0xa80b, 0xa825, 0xa82c, 0xa8c4, 0xa8e0, 0xa8ff, 0xa926, 0xa947, 0xa953, 0xa980, 0xa9b3, + 0xa9b6, 0xa9bc, 0xa9c0, 0xa9e5, 0xaa29, 0xaa31, 0xaa35, 0xaa43, 0xaa4c, 0xaa7c, 0xaab0, 0xaab2, 0xaab7, 0xaabe, 0xaac1, 0xaaec, 0xaaf6, 0xabe5, 0xabe8, 0xabed, 0xfb1e, 0xfe00, 0xfe20, 0xff9e, 0x101fd, 0x102e0, 0x10376, - 0x10a01, 0x10a05, 0x10a0c, 0x10a38, 0x10a3f, 0x10ae5, 0x10d24, 0x10eab, 0x10efd, 0x10f46, 0x10f82, 0x11001, - 0x11038, 0x11070, 0x11073, 0x1107f, 0x110b3, 0x110b9, 0x110c2, 0x11100, 0x11127, 0x1112d, 0x11173, 0x11180, - 0x111b6, 0x111c9, 0x111cf, 0x1122f, 0x11234, 0x11236, 0x1123e, 0x11241, 0x112df, 0x112e3, 0x11300, 0x1133b, - 0x1133e, 0x11340, 0x11357, 0x11366, 0x11370, 0x11438, 0x11442, 0x11446, 0x1145e, 0x114b0, 0x114b3, 0x114ba, - 0x114bd, 0x114bf, 0x114c2, 0x115af, 0x115b2, 0x115bc, 0x115bf, 0x115dc, 0x11633, 0x1163d, 0x1163f, 0x116ab, - 0x116ad, 0x116b0, 0x116b7, 0x1171d, 0x11722, 0x11727, 0x1182f, 0x11839, 0x11930, 0x1193b, 0x1193e, 0x11943, - 0x119d4, 0x119da, 0x119e0, 0x11a01, 0x11a33, 0x11a3b, 0x11a47, 0x11a51, 0x11a59, 0x11a8a, 0x11a98, 0x11c30, - 0x11c38, 0x11c3f, 0x11c92, 0x11caa, 0x11cb2, 0x11cb5, 0x11d31, 0x11d3a, 0x11d3c, 0x11d3f, 0x11d47, 0x11d90, - 0x11d95, 0x11d97, 0x11ef3, 0x11f00, 0x11f36, 0x11f40, 0x11f42, 0x13440, 0x13447, 0x16af0, 0x16b30, 0x16f4f, - 0x16f8f, 0x16fe4, 0x1bc9d, 0x1cf00, 0x1cf30, 0x1d165, 0x1d167, 0x1d16e, 0x1d17b, 0x1d185, 0x1d1aa, 0x1d242, - 0x1da00, 0x1da3b, 0x1da75, 0x1da84, 0x1da9b, 0x1daa1, 0x1e000, 0x1e008, 0x1e01b, 0x1e023, 0x1e026, 0x1e08f, - 0x1e130, 0x1e2ae, 0x1e2ec, 0x1e4ec, 0x1e8d0, 0x1e944, 0xe0020, 0xe0100}, + 0x10a01, 0x10a05, 0x10a0c, 0x10a38, 0x10a3f, 0x10ae5, 0x10d24, 0x10d69, 0x10eab, 0x10efc, 0x10f46, 0x10f82, + 0x11001, 0x11038, 0x11070, 0x11073, 0x1107f, 0x110b3, 0x110b9, 0x110c2, 0x11100, 0x11127, 0x1112d, 0x11173, + 0x11180, 0x111b6, 0x111c0, 0x111c9, 0x111cf, 0x1122f, 0x11234, 0x1123e, 0x11241, 0x112df, 0x112e3, 0x11300, + 0x1133b, 0x1133e, 0x11340, 0x1134d, 0x11357, 0x11366, 0x11370, 0x113b8, 0x113bb, 0x113c2, 0x113c5, 0x113c7, + 0x113ce, 0x113d2, 0x113e1, 0x11438, 0x11442, 0x11446, 0x1145e, 0x114b0, 0x114b3, 0x114ba, 0x114bd, 0x114bf, + 0x114c2, 0x115af, 0x115b2, 0x115bc, 0x115bf, 0x115dc, 0x11633, 0x1163d, 0x1163f, 0x116ab, 0x116ad, 0x116b0, + 0x1171d, 0x1171f, 0x11722, 0x11727, 0x1182f, 0x11839, 0x11930, 0x1193b, 0x11943, 0x119d4, 0x119da, 0x119e0, + 0x11a01, 0x11a33, 0x11a3b, 0x11a47, 0x11a51, 0x11a59, 0x11a8a, 0x11a98, 0x11c30, 0x11c38, 0x11c3f, 0x11c92, + 0x11caa, 0x11cb2, 0x11cb5, 0x11d31, 0x11d3a, 0x11d3c, 0x11d3f, 0x11d47, 0x11d90, 0x11d95, 0x11d97, 0x11ef3, + 0x11f00, 0x11f36, 0x11f40, 0x11f5a, 0x13440, 0x13447, 0x1611e, 0x1612d, 0x16af0, 0x16b30, 0x16f4f, 0x16f8f, + 0x16fe4, 0x16ff0, 0x1bc9d, 0x1cf00, 0x1cf30, 0x1d165, 0x1d16d, 0x1d17b, 0x1d185, 0x1d1aa, 0x1d242, 0x1da00, + 0x1da3b, 0x1da75, 0x1da84, 0x1da9b, 0x1daa1, 0x1e000, 0x1e008, 0x1e01b, 0x1e023, 0x1e026, 0x1e08f, 0x1e130, + 0x1e2ae, 0x1e2ec, 0x1e4ec, 0x1e5ee, 0x1e8d0, 0x1e944, 0xe0020, 0xe0100}, {0x70, 0x7, 0x2d, 0x1, 0x2, 0x2, 0x1, 0xb, 0x15, 0x1, 0x7, 0x6, 0x2, 0x4, 0x1, 0x1b, 0xb, 0x9, 0x1, 0x4, 0x9, 0x3, - 0x5, 0x3, 0x8, 0x18, 0x20, 0x1, 0x1, 0x8, 0x1, 0x7, 0x2, 0x1, 0x1, 0x1, 0x4, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, + 0x5, 0x3, 0x9, 0x18, 0x20, 0x1, 0x1, 0x8, 0x1, 0x7, 0x2, 0x1, 0x1, 0x1, 0x4, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x2, 0x3, 0x1, 0x2, 0x1, 0x2, 0x1, 0x5, 0x2, 0x1, 0x2, 0x6, 0x1, 0x1, 0x2, 0x4, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, - 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x3, 0x4, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x2, 0x2, 0x2, 0x1, 0x4, + 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x3, 0x4, 0x2, 0x2, 0x1, 0x1, 0x2, 0x1, 0x3, 0x4, 0x2, 0x2, 0x2, 0x2, 0x1, 0x4, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x7, 0x8, 0x1, 0x9, 0x7, 0x2, 0x1, 0x1, 0x1, 0xe, 0x5, 0x2, - 0xb, 0x24, 0x1, 0x4, 0x6, 0x2, 0x2, 0x2, 0x3, 0x4, 0x1, 0x2, 0x1, 0x1, 0x3, 0x3, 0x2, 0x2, 0x2, 0x2, 0x7, 0x1, - 0xb, 0x1, 0x3, 0x1, 0x2, 0x1, 0x3, 0x2, 0x1, 0x3, 0x2, 0x1, 0x1, 0x7, 0x1, 0x1, 0x8, 0xa, 0x1, 0x1f, 0x4, 0x7, - 0x1, 0x1, 0x9, 0x2, 0x4, 0x2, 0x3, 0x1, 0x2, 0x1, 0x3, 0x8, 0x2, 0x3, 0xd, 0x7, 0x1, 0x1, 0x2, 0x40, 0x1, 0x21, - 0x3, 0x1, 0x20, 0x6, 0x2, 0x4, 0xa, 0x2, 0x2, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x12, 0x1, 0x8, 0xb, 0x3, 0x1, 0x4, - 0x2, 0x1, 0x6, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, 0x3, 0x2, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x10, 0x10, 0x2, - 0x1, 0x1, 0x5, 0x3, 0x2, 0x4, 0x3, 0x1, 0x2, 0x4, 0x2, 0x3, 0xb, 0x4, 0x1, 0xf, 0x1, 0x2, 0x3, 0x4, 0x2, 0x1, - 0x3, 0x5, 0x8, 0x1, 0x2, 0x9, 0x4, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x1, 0x8, 0x2, 0x2, 0x1, 0x1, 0x1, 0x7, 0x5, - 0x8, 0x3, 0x1, 0x1, 0x1, 0x6, 0x1, 0x1, 0x2, 0x2, 0x1, 0x4, 0x2, 0x2, 0x2, 0x8, 0x1, 0x2, 0x1, 0x1, 0x6, 0x1, - 0x3, 0x4, 0x5, 0x9, 0x2, 0x1, 0x2, 0x1, 0x1, 0x4, 0x2, 0x1, 0xa, 0x6, 0x4, 0x1, 0x6, 0x3, 0xd, 0x2, 0x7, 0x6, - 0x1, 0x16, 0x7, 0x2, 0x2, 0x6, 0x1, 0x2, 0x7, 0x1, 0x2, 0x1, 0x1, 0x2, 0x2, 0x5, 0x1, 0x1, 0x1, 0xf, 0x5, 0x7, - 0x1, 0x4, 0x1, 0x2, 0x2e, 0x17, 0x1, 0x3, 0x5, 0x8, 0x7, 0x4, 0x3, 0x37, 0x32, 0x1, 0x1, 0x5, 0xf, 0x7, 0x11, - 0x7, 0x2, 0x5, 0x1, 0x7, 0x1, 0x4, 0x4, 0x7, 0x7, 0x60, 0xf0}}; + 0xb, 0x24, 0x1, 0x4, 0x6, 0x2, 0x2, 0x2, 0x3, 0x4, 0x1, 0x2, 0x1, 0x1, 0x3, 0x4, 0x3, 0x2, 0x2, 0x2, 0x7, 0x1, + 0xb, 0x1, 0x3, 0x1, 0x2, 0x1, 0x3, 0x2, 0x1, 0x3, 0x2, 0x1, 0x1, 0x7, 0x1, 0x1, 0x8, 0xa, 0x1, 0x1f, 0x4, 0xa, + 0x3, 0x9, 0x2, 0x4, 0x6, 0x1, 0x2, 0x1, 0x5, 0x8, 0x2, 0x3, 0xd, 0x7, 0x1, 0x1, 0x2, 0x40, 0x1, 0x21, 0x3, 0x1, + 0x20, 0x6, 0x2, 0x4, 0xa, 0x2, 0x2, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x12, 0x1, 0x8, 0xb, 0x1, 0x3, 0x1, 0x4, 0x2, + 0x1, 0x1, 0x6, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, 0x3, 0x2, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x10, 0x10, 0x2, + 0x1, 0x1, 0x5, 0x3, 0x2, 0x4, 0x3, 0x1, 0x2, 0x4, 0x5, 0x2, 0x4, 0xb, 0x4, 0x1, 0xf, 0x1, 0x2, 0x3, 0x4, 0x2, + 0x1, 0x3, 0x5, 0x8, 0x1, 0x2, 0x9, 0x1, 0x4, 0x1, 0x3, 0x4, 0x1, 0x1, 0x1, 0x8, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, + 0x7, 0x5, 0x1, 0x6, 0x1, 0x1, 0x3, 0x3, 0x1, 0x2, 0x8, 0x3, 0x1, 0x1, 0x1, 0x6, 0x1, 0x1, 0x2, 0x2, 0x1, 0x4, + 0x2, 0x2, 0x2, 0x8, 0x1, 0x2, 0x1, 0x1, 0x8, 0x1, 0x1, 0x4, 0x5, 0x9, 0x2, 0x1, 0x4, 0x1, 0x4, 0x2, 0x1, 0xa, + 0x6, 0x4, 0x1, 0x6, 0x3, 0xd, 0x2, 0x7, 0x6, 0x1, 0x16, 0x7, 0x2, 0x2, 0x6, 0x1, 0x2, 0x7, 0x1, 0x2, 0x1, 0x1, + 0x2, 0x2, 0x5, 0x3, 0x1, 0x1, 0xf, 0xc, 0x3, 0x5, 0x7, 0x1, 0x4, 0x1, 0x2, 0x2, 0x2e, 0x17, 0x5, 0x6, 0x8, 0x7, + 0x4, 0x3, 0x37, 0x32, 0x1, 0x1, 0x5, 0xf, 0x7, 0x11, 0x7, 0x2, 0x5, 0x1, 0x7, 0x1, 0x4, 0x4, 0x2, 0x7, 0x7, + 0x60, 0xf0}}; -// EastAsianWidth-15.0.0.txt -// Date: 2022-05-24, 17:40:20 GMT [KW, LI] +// EastAsianWidth-16.0.0.txt +// Date: 2024-04-30, 21:48:20 GMT inline constexpr char32_t _Width_estimate_intervals_v2[] = {0x1100, 0x1160, 0x231a, 0x231c, 0x2329, 0x232b, 0x23e9, - 0x23ed, 0x23f0, 0x23f1, 0x23f3, 0x23f4, 0x25fd, 0x25ff, 0x2614, 0x2616, 0x2648, 0x2654, 0x267f, 0x2680, 0x2693, - 0x2694, 0x26a1, 0x26a2, 0x26aa, 0x26ac, 0x26bd, 0x26bf, 0x26c4, 0x26c6, 0x26ce, 0x26cf, 0x26d4, 0x26d5, 0x26ea, - 0x26eb, 0x26f2, 0x26f4, 0x26f5, 0x26f6, 0x26fa, 0x26fb, 0x26fd, 0x26fe, 0x2705, 0x2706, 0x270a, 0x270c, 0x2728, - 0x2729, 0x274c, 0x274d, 0x274e, 0x274f, 0x2753, 0x2756, 0x2757, 0x2758, 0x2795, 0x2798, 0x27b0, 0x27b1, 0x27bf, - 0x27c0, 0x2b1b, 0x2b1d, 0x2b50, 0x2b51, 0x2b55, 0x2b56, 0x2e80, 0x2e9a, 0x2e9b, 0x2ef4, 0x2f00, 0x2fd6, 0x2ff0, - 0x2ffc, 0x3000, 0x303f, 0x3041, 0x3097, 0x3099, 0x3100, 0x3105, 0x3130, 0x3131, 0x318f, 0x3190, 0x31e4, 0x31f0, - 0x321f, 0x3220, 0x3248, 0x3250, 0xa48d, 0xa490, 0xa4c7, 0xa960, 0xa97d, 0xac00, 0xd7a4, 0xf900, 0xfb00, 0xfe10, - 0xfe1a, 0xfe30, 0xfe53, 0xfe54, 0xfe67, 0xfe68, 0xfe6c, 0xff01, 0xff61, 0xffe0, 0xffe7, 0x16fe0, 0x16fe5, 0x16ff0, - 0x16ff2, 0x17000, 0x187f8, 0x18800, 0x18cd6, 0x18d00, 0x18d09, 0x1aff0, 0x1aff4, 0x1aff5, 0x1affc, 0x1affd, 0x1afff, - 0x1b000, 0x1b123, 0x1b132, 0x1b133, 0x1b150, 0x1b153, 0x1b155, 0x1b156, 0x1b164, 0x1b168, 0x1b170, 0x1b2fc, 0x1f004, - 0x1f005, 0x1f0cf, 0x1f0d0, 0x1f18e, 0x1f18f, 0x1f191, 0x1f19b, 0x1f200, 0x1f203, 0x1f210, 0x1f23c, 0x1f240, 0x1f249, - 0x1f250, 0x1f252, 0x1f260, 0x1f266, 0x1f300, 0x1f650, 0x1f680, 0x1f6c6, 0x1f6cc, 0x1f6cd, 0x1f6d0, 0x1f6d3, 0x1f6d5, - 0x1f6d8, 0x1f6dc, 0x1f6e0, 0x1f6eb, 0x1f6ed, 0x1f6f4, 0x1f6fd, 0x1f7e0, 0x1f7ec, 0x1f7f0, 0x1f7f1, 0x1f900, 0x1fa00, - 0x1fa70, 0x1fa7d, 0x1fa80, 0x1fa89, 0x1fa90, 0x1fabe, 0x1fabf, 0x1fac6, 0x1face, 0x1fadc, 0x1fae0, 0x1fae9, 0x1faf0, - 0x1faf9, 0x20000, 0x2fffe, 0x30000, 0x3fffe}; + 0x23ed, 0x23f0, 0x23f1, 0x23f3, 0x23f4, 0x25fd, 0x25ff, 0x2614, 0x2616, 0x2630, 0x2638, 0x2648, 0x2654, 0x267f, + 0x2680, 0x268a, 0x2690, 0x2693, 0x2694, 0x26a1, 0x26a2, 0x26aa, 0x26ac, 0x26bd, 0x26bf, 0x26c4, 0x26c6, 0x26ce, + 0x26cf, 0x26d4, 0x26d5, 0x26ea, 0x26eb, 0x26f2, 0x26f4, 0x26f5, 0x26f6, 0x26fa, 0x26fb, 0x26fd, 0x26fe, 0x2705, + 0x2706, 0x270a, 0x270c, 0x2728, 0x2729, 0x274c, 0x274d, 0x274e, 0x274f, 0x2753, 0x2756, 0x2757, 0x2758, 0x2795, + 0x2798, 0x27b0, 0x27b1, 0x27bf, 0x27c0, 0x2b1b, 0x2b1d, 0x2b50, 0x2b51, 0x2b55, 0x2b56, 0x2e80, 0x2e9a, 0x2e9b, + 0x2ef4, 0x2f00, 0x2fd6, 0x2ff0, 0x303f, 0x3041, 0x3097, 0x3099, 0x3100, 0x3105, 0x3130, 0x3131, 0x318f, 0x3190, + 0x31e6, 0x31ef, 0x321f, 0x3220, 0x3248, 0x3250, 0xa48d, 0xa490, 0xa4c7, 0xa960, 0xa97d, 0xac00, 0xd7a4, 0xf900, + 0xfb00, 0xfe10, 0xfe1a, 0xfe30, 0xfe53, 0xfe54, 0xfe67, 0xfe68, 0xfe6c, 0xff01, 0xff61, 0xffe0, 0xffe7, 0x16fe0, + 0x16fe5, 0x16ff0, 0x16ff2, 0x17000, 0x187f8, 0x18800, 0x18cd6, 0x18cff, 0x18d09, 0x1aff0, 0x1aff4, 0x1aff5, 0x1affc, + 0x1affd, 0x1afff, 0x1b000, 0x1b123, 0x1b132, 0x1b133, 0x1b150, 0x1b153, 0x1b155, 0x1b156, 0x1b164, 0x1b168, 0x1b170, + 0x1b2fc, 0x1d300, 0x1d357, 0x1d360, 0x1d377, 0x1f004, 0x1f005, 0x1f0cf, 0x1f0d0, 0x1f18e, 0x1f18f, 0x1f191, 0x1f19b, + 0x1f200, 0x1f203, 0x1f210, 0x1f23c, 0x1f240, 0x1f249, 0x1f250, 0x1f252, 0x1f260, 0x1f266, 0x1f300, 0x1f650, 0x1f680, + 0x1f6c6, 0x1f6cc, 0x1f6cd, 0x1f6d0, 0x1f6d3, 0x1f6d5, 0x1f6d8, 0x1f6dc, 0x1f6e0, 0x1f6eb, 0x1f6ed, 0x1f6f4, 0x1f6fd, + 0x1f7e0, 0x1f7ec, 0x1f7f0, 0x1f7f1, 0x1f900, 0x1fa00, 0x1fa70, 0x1fa7d, 0x1fa80, 0x1fa8a, 0x1fa8f, 0x1fac7, 0x1face, + 0x1fadd, 0x1fadf, 0x1faea, 0x1faf0, 0x1faf9, 0x20000, 0x2fffe, 0x30000, 0x3fffe}; _STD_END diff --git a/stl/inc/__msvc_formatter.hpp b/stl/inc/__msvc_formatter.hpp index dfa145a3d4d..d1355eb20fc 100644 --- a/stl/inc/__msvc_formatter.hpp +++ b/stl/inc/__msvc_formatter.hpp @@ -58,6 +58,12 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +// TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") +#undef msvc +#undef no_specializations + _STD_BEGIN #if _HAS_CXX23 #define _FMT_P2286_BEGIN inline namespace __p2286 { @@ -90,7 +96,7 @@ enum class _Basic_format_arg_type : uint8_t { static_assert(static_cast(_Basic_format_arg_type::_Custom_type) < 16, "must fit in 4-bit bitfield"); #if _HAS_CXX23 -_EXPORT_STD template +_EXPORT_STD template // specializations allowed by N5014 [format.formatter.locking]/1 constexpr bool enable_nonlocking_formatter_optimization = false; _NODISCARD consteval bool _Is_debug_enabled_fmt_type(_Basic_format_arg_type _Ty) { @@ -126,7 +132,7 @@ struct _Dynamic_format_specs : _Basic_format_specs<_CharT> { [[noreturn]] inline void _Throw_format_error(const char* _Message); _EXPORT_STD template -class basic_format_parse_context; +class _NO_SPECIALIZATIONS_CITING("N5014 [format.parse.ctx]/2") basic_format_parse_context; template concept _Format_supported_charT = _Is_any_of_v<_CharT, char, wchar_t>; @@ -328,7 +334,7 @@ struct _Invalid_format_kind { }; _EXPORT_STD template -constexpr _Invalid_format_kind<_Ty> format_kind; +constexpr _Invalid_format_kind<_Ty> format_kind; // specializations allowed by N5014 [format.range.fmtkind]/3 template constexpr bool _Is_two_tuple = false; @@ -442,6 +448,10 @@ struct _Fill_align_and_width_formatter { #endif // _HAS_CXX23 _STD_END +// TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") +#pragma pop_macro("msvc") + #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/__msvc_iter_core.hpp b/stl/inc/__msvc_iter_core.hpp index 2d12dac1144..812c00cfc2d 100644 --- a/stl/inc/__msvc_iter_core.hpp +++ b/stl/inc/__msvc_iter_core.hpp @@ -16,6 +16,12 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +// TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") +#undef msvc +#undef no_specializations + _STD_BEGIN template struct _Has_allocator_type : false_type {}; // tests for suitable _Ty::allocator_type @@ -34,7 +40,7 @@ _EXPORT_STD template struct uses_allocator : _Has_allocator_type<_Ty, _Alloc>::type {}; _EXPORT_STD template -constexpr bool uses_allocator_v = uses_allocator<_Ty, _Alloc>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool uses_allocator_v = uses_allocator<_Ty, _Alloc>::value; // from _EXPORT_STD struct input_iterator_tag {}; @@ -406,7 +412,7 @@ concept input_or_output_iterator = requires(_It __i) { _EXPORT_STD template concept sentinel_for = semiregular<_Se> && input_or_output_iterator<_It> && _Weakly_equality_comparable_with<_Se, _It>; -_EXPORT_STD template +_EXPORT_STD template // specializations allowed by N5014 [iterator.concept.sizedsentinel]/3 constexpr bool disable_sized_sentinel_for = false; _EXPORT_STD template @@ -542,6 +548,10 @@ struct _Meta_find_unique_index_<_List<_First, _Rest...>, _Ty> { }; _STD_END +// TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") +#pragma pop_macro("msvc") + #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/__msvc_ranges_tuple_formatter.hpp b/stl/inc/__msvc_ranges_tuple_formatter.hpp index 45d36201b1b..e47a92f8704 100644 --- a/stl/inc/__msvc_ranges_tuple_formatter.hpp +++ b/stl/inc/__msvc_ranges_tuple_formatter.hpp @@ -61,6 +61,12 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +// TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") +#undef msvc +#undef no_specializations + _STD_BEGIN _EXPORT_STD template class vector; @@ -93,7 +99,7 @@ template class _Compile_time_parse_context; _EXPORT_STD template -class basic_format_parse_context { +class _NO_SPECIALIZATIONS_CITING("N5014 [format.parse.ctx]/2") basic_format_parse_context { public: using char_type = _CharT; using const_iterator = basic_string_view<_CharT>::const_iterator; @@ -229,7 +235,7 @@ struct _Format_handler; _FMT_P2286_END _EXPORT_STD template -class basic_format_arg { +class _NO_SPECIALIZATIONS_CITING("N5014 [format.arg]/2") basic_format_arg { public: using _CharType = _Context::char_type; @@ -674,7 +680,7 @@ class _Lazy_locale { _EXPORT_STD template requires output_iterator<_Out, const _CharT&> -class basic_format_context { +class _NO_SPECIALIZATIONS_CITING("N5014 [format.context]/2") basic_format_context { private: _Out _OutputIt; basic_format_args _Args; @@ -1256,6 +1262,10 @@ struct formatter, _CharT> : _Tuple_formatter_base { _NODISCARD static _CONSTEXPR17 int compare(_In_reads_(_Count) const _Elem* const _First1, _In_reads_(_Count) const _Elem* const _First2, const size_t _Count) noexcept /* strengthened */ { // compare [_First1, _First1 + _Count) with [_First2, ...) -#if _HAS_CXX17 - if (_STD _Is_constant_evaluated()) { - if constexpr (is_same_v<_Elem, wchar_t>) { - return __builtin_wmemcmp(_First1, _First2, _Count); +#if _USE_STD_VECTOR_ALGORITHMS + if (!_STD _Is_constant_evaluated()) { + // TRANSITION, GH-2289: Use vectorized algorithms for better performance than __builtin_wmemcmp. + const size_t _Pos = _Mismatch_vectorized(_First1, _First2, _Count); + if (_Pos == _Count) { + return 0; } else { - return _Primary_char_traits::compare(_First1, _First2, _Count); + return _First1[_Pos] < _First2[_Pos] ? -1 : +1; } } -#endif // _HAS_CXX17 +#endif // ^^^ _USE_STD_VECTOR_ALGORITHMS ^^^ - return _CSTD wmemcmp( - reinterpret_cast(_First1), reinterpret_cast(_First2), _Count); + if constexpr (is_same_v<_Elem, wchar_t>) { + return __builtin_wmemcmp(_First1, _First2, _Count); + } else { + return _Primary_char_traits::compare(_First1, _First2, _Count); + } } _NODISCARD static _CONSTEXPR17 size_t length(_In_z_ const _Elem* _First) noexcept /* strengthened */ { diff --git a/stl/inc/algorithm b/stl/inc/algorithm index 4bec12e2e96..06251be1014 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -8,6 +8,7 @@ #include #if _STL_COMPILER_PREPROCESSOR #include <__msvc_heap_algorithms.hpp> +#include <__msvc_int128.hpp> #include <__msvc_minmax.hpp> #include @@ -884,7 +885,7 @@ _NODISCARD _CONSTEXPR20 pair<_InIt1, _InIt2> mismatch(_InIt1 _First1, const _InI const auto _ULast1 = _STD _Get_unwrapped(_Last1); auto _UFirst2 = _STD _Get_unwrapped_n(_First2, _STD _Idl_distance<_InIt1>(_UFirst1, _ULast1)); #if _USE_STD_VECTOR_ALGORITHMS - if constexpr (_Vector_alg_in_search_is_safe) { + if constexpr (_Equal_memcmp_is_safe) { if (!_STD _Is_constant_evaluated()) { constexpr size_t _Elem_size = sizeof(_Iter_value_t<_InIt1>); @@ -948,7 +949,7 @@ _NODISCARD _CONSTEXPR20 pair<_InIt1, _InIt2> mismatch( const auto _Count = static_cast<_Iter_diff_t<_InIt1>>((_STD min) (_Count1, _Count2)); _ULast1 = _UFirst1 + _Count; #if _USE_STD_VECTOR_ALGORITHMS - if constexpr (_Vector_alg_in_search_is_safe) { + if constexpr (_Equal_memcmp_is_safe) { if (!_STD _Is_constant_evaluated()) { constexpr size_t _Elem_size = sizeof(_Iter_value_t<_InIt1>); @@ -5953,60 +5954,87 @@ namespace ranges { #endif // _HAS_CXX17 template -class _Rng_from_urng { // wrap a URNG as an RNG +class _Rng_from_urng_v2 { // wrap a URNG as an RNG public: using _Ty0 = make_unsigned_t<_Diff>; using _Ty1 = _Invoke_result_t<_Urng&>; - using _Udiff = conditional_t; + using _Udiff = conditional_t; + static constexpr unsigned int _Udiff_bits = sizeof(_Udiff) * CHAR_BIT; + using _Uprod = conditional_t<_Udiff_bits <= 16, uint32_t, conditional_t<_Udiff_bits <= 32, uint64_t, _Unsigned128>>; - explicit _Rng_from_urng(_Urng& _Func) - : _Ref(_Func), _Bits(CHAR_BIT * sizeof(_Udiff)), _Bmask(static_cast<_Udiff>(-1)) { - for (; static_cast<_Udiff>((_Urng::max) () - (_Urng::min) ()) < _Bmask; _Bmask >>= 1) { - --_Bits; - } - } + explicit _Rng_from_urng_v2(_Urng& _Func) noexcept : _Ref(_Func) {} _Diff operator()(_Diff _Index) { // adapt _Urng closed range to [0, _Index) - for (;;) { // try a sample random value - _Udiff _Ret = 0; // random bits - _Udiff _Mask = 0; // 2^N - 1, _Ret is within [0, _Mask] - - while (_Mask < static_cast<_Udiff>(_Index - 1)) { // need more random bits - _Ret <<= _Bits - 1; // avoid full shift - _Ret <<= 1; - _Ret |= _Get_bits(); - _Mask <<= _Bits - 1; // avoid full shift - _Mask <<= 1; + // From Daniel Lemire, "Fast Random Integer Generation in an Interval", + // ACM Trans. Model. Comput. Simul. 29 (1), 2019. + // + // Algorithm 5 <-> This Code: + // m <-> _Product + // l <-> _Rem + // s <-> _Index + // t <-> _Threshold + // L <-> _Generated_bits + // 2^L - 1 <-> _Mask + + _Udiff _Mask = _Bmask; + unsigned int _Niter = 1; + + if constexpr (_Bits < _Udiff_bits) { + while (_Mask < static_cast<_Udiff>(_Index - 1)) { + _Mask <<= _Bits; _Mask |= _Bmask; + ++_Niter; } + } + + // x <- random integer in [0, 2^L) + // m <- x * s + auto _Product = _Get_random_product(_Index, _Niter); + // l <- m mod 2^L + auto _Rem = static_cast<_Udiff>(_Product) & _Mask; - // _Ret is [0, _Mask], _Index - 1 <= _Mask, return if unbiased - if (_Ret / _Index < _Mask / _Index || _Mask % _Index == static_cast<_Udiff>(_Index - 1)) { - return static_cast<_Diff>(_Ret % _Index); + if (_Rem < static_cast<_Udiff>(_Index)) { + // t <- (2^L - s) mod s + const auto _Threshold = (_Mask - _Index + 1) % _Index; + while (_Rem < _Threshold) { + _Product = _Get_random_product(_Index, _Niter); + _Rem = static_cast<_Udiff>(_Product) & _Mask; } } + + unsigned int _Generated_bits; + if constexpr (_Bits < _Udiff_bits) { + _Generated_bits = static_cast(_Popcount(_Mask)); + } else { + _Generated_bits = _Udiff_bits; + } + + // m / 2^L + return static_cast<_Diff>(_Product >> _Generated_bits); } _Udiff _Get_all_bits() { - _Udiff _Ret = 0; + _Udiff _Ret = _Get_bits(); - for (size_t _Num = 0; _Num < CHAR_BIT * sizeof(_Udiff); _Num += _Bits) { // don't mask away any bits - _Ret <<= _Bits - 1; // avoid full shift - _Ret <<= 1; - _Ret |= _Get_bits(); + if constexpr (_Bits < _Udiff_bits) { + for (unsigned int _Num = _Bits; _Num < _Udiff_bits; _Num += _Bits) { // don't mask away any bits + _Ret <<= _Bits; + _Ret |= _Get_bits(); + } } return _Ret; } - _Rng_from_urng(const _Rng_from_urng&) = delete; - _Rng_from_urng& operator=(const _Rng_from_urng&) = delete; + _Rng_from_urng_v2(const _Rng_from_urng_v2&) = delete; + _Rng_from_urng_v2& operator=(const _Rng_from_urng_v2&) = delete; private: _Udiff _Get_bits() { // return a random value within [0, _Bmask] + constexpr auto _Urng_min = (_Urng::min) (); for (;;) { // repeat until random value is in range - const _Udiff _Val = static_cast<_Udiff>(_Ref() - (_Urng::min) ()); + const _Udiff _Val = static_cast<_Udiff>(_Ref() - _Urng_min); if (_Val <= _Bmask) { return _Val; @@ -6014,9 +6042,37 @@ private: } } + static constexpr size_t _Calc_bits() { + auto _Bits_local = _Udiff_bits; + auto _Bmask_local = static_cast<_Udiff>(-1); + for (; static_cast<_Udiff>((_Urng::max) () - (_Urng::min) ()) < _Bmask_local; _Bmask_local >>= 1) { + --_Bits_local; + } + + return _Bits_local; + } + + _Uprod _Get_random_product(const _Diff _Index, unsigned int _Niter) { + _Udiff _Ret = _Get_bits(); + if constexpr (_Bits < _Udiff_bits) { + while (--_Niter > 0) { + _Ret <<= _Bits; + _Ret |= _Get_bits(); + } + } + + if constexpr (is_same_v<_Udiff, uint64_t>) { + uint64_t _High; + const auto _Low = _Base128::_UMul128(_Ret, static_cast<_Udiff>(_Index), _High); + return _Uprod{_Low, _High}; + } else { + return _Uprod{_Ret} * static_cast<_Uprod>(_Index); + } + } + _Urng& _Ref; // reference to URNG - size_t _Bits; // number of random bits generated by _Get_bits() - _Udiff _Bmask; // 2^_Bits - 1 + static constexpr size_t _Bits = _Calc_bits(); // number of random bits generated by _Get_bits() + static constexpr _Udiff _Bmask = static_cast<_Udiff>(-1) >> (_Udiff_bits - _Bits); // 2^_Bits - 1 }; #if _HAS_CXX17 @@ -6076,7 +6132,7 @@ _SampleIt sample(_PopIt _First, _PopIt _Last, _SampleIt _Dest, _Diff _Count, _Ur auto _UFirst = _STD _Get_unwrapped(_First); auto _ULast = _STD _Get_unwrapped(_Last); using _PopDiff = _Iter_diff_t<_PopIt>; - _Rng_from_urng<_PopDiff, remove_reference_t<_Urng>> _RngFunc(_Func); + _Rng_from_urng_v2<_PopDiff, remove_reference_t<_Urng>> _RngFunc(_Func); if constexpr (_Is_ranges_fwd_iter_v<_PopIt>) { // source is forward: use selection sampling (stable) using _CT = common_type_t<_Diff, _PopDiff>; @@ -6119,7 +6175,7 @@ namespace ranges { return _Output; } - _Rng_from_urng, remove_reference_t<_Urng>> _RngFunc(_Func); + _Rng_from_urng_v2, remove_reference_t<_Urng>> _RngFunc(_Func); if constexpr (forward_iterator<_It>) { auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); auto _Pop_size = _RANGES distance(_UFirst, _RANGES _Unwrap_sent<_It>(_STD move(_Last))); @@ -6140,7 +6196,7 @@ namespace ranges { return _Output; } - _Rng_from_urng, remove_reference_t<_Urng>> _RngFunc(_Func); + _Rng_from_urng_v2, remove_reference_t<_Urng>> _RngFunc(_Func); if constexpr (forward_range<_Rng>) { auto _UFirst = _Ubegin(_Range); auto _Pop_size = _RANGES distance(_UFirst, _Uend(_Range)); @@ -6243,7 +6299,7 @@ void _Random_shuffle1(_RanIt _First, _RanIt _Last, _RngFn& _RngFunc) { _EXPORT_STD template void shuffle(_RanIt _First, _RanIt _Last, _Urng&& _Func) { // shuffle [_First, _Last) using URNG _Func using _Urng0 = remove_reference_t<_Urng>; - _Rng_from_urng<_Iter_diff_t<_RanIt>, _Urng0> _RngFunc(_Func); + _Rng_from_urng_v2<_Iter_diff_t<_RanIt>, _Urng0> _RngFunc(_Func); _STD _Random_shuffle1(_First, _Last, _RngFunc); } @@ -6256,7 +6312,7 @@ namespace ranges { _STATIC_CALL_OPERATOR _It operator()(_It _First, _Se _Last, _Urng&& _Func) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); - _Rng_from_urng, remove_reference_t<_Urng>> _RngFunc(_Func); + _Rng_from_urng_v2, remove_reference_t<_Urng>> _RngFunc(_Func); auto _UResult = _Shuffle_unchecked( _RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _RngFunc); @@ -6267,7 +6323,7 @@ namespace ranges { template requires permutable> && uniform_random_bit_generator> _STATIC_CALL_OPERATOR borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Urng&& _Func) _CONST_CALL_OPERATOR { - _Rng_from_urng, remove_reference_t<_Urng>> _RngFunc(_Func); + _Rng_from_urng_v2, remove_reference_t<_Urng>> _RngFunc(_Func); return _RANGES _Rewrap_iterator(_Range, _Shuffle_unchecked(_Ubegin(_Range), _Uend(_Range), _RngFunc)); } @@ -6313,11 +6369,11 @@ void random_shuffle(_RanIt _First, _RanIt _Last, _RngFn&& _RngFunc) { struct _Rand_urng_from_func { // wrap rand() as a URNG using result_type = unsigned int; - static result_type(min)() { // return minimum possible generated value + static constexpr result_type(min)() { // return minimum possible generated value return 0; } - static result_type(max)() { // return maximum possible generated value + static constexpr result_type(max)() { // return maximum possible generated value return RAND_MAX; } diff --git a/stl/inc/any b/stl/inc/any index 2f33cb0545d..c9d30736a57 100644 --- a/stl/inc/any +++ b/stl/inc/any @@ -176,12 +176,14 @@ public: // Assignment [any.assign] any& operator=(const any& _That) { - _Assign(_That); + any _Tmp = _That; + _Reset_and_move_from(_Tmp); return *this; } any& operator=(any&& _That) noexcept { - _Assign(_STD move(_That)); + any _Tmp = _STD move(_That); + _Reset_and_move_from(_Tmp); return *this; } @@ -190,7 +192,8 @@ public: int> = 0> any& operator=(_ValueType&& _Value) { // replace contained value with an object of type decay_t<_ValueType> initialized from _Value - _Assign(_STD forward<_ValueType>(_Value)); + any _Tmp = _STD forward<_ValueType>(_Value); + _Reset_and_move_from(_Tmp); return *this; } @@ -230,7 +233,9 @@ public: } void swap(any& _That) noexcept { - _That = _STD exchange(*this, _STD move(_That)); + any _Tmp = _STD move(*this); + _Reset_and_move_from(_That); + _That._Reset_and_move_from(_Tmp); } // Observers [any.observers] @@ -284,6 +289,7 @@ private: } void _Move_from(any& _That) noexcept { + _STL_INTERNAL_CHECK(_Storage._TypeData == 0); // !has_value() _Storage._TypeData = _That._Storage._TypeData; switch (_Rep()) { case _Any_representation::_Small: @@ -302,13 +308,14 @@ private: } } - void _Assign(any _That) noexcept { // intentionally pass by value + void _Reset_and_move_from(any& _That) noexcept { reset(); _Move_from(_That); } template _Decayed& _Emplace(_Types&&... _Args) { // emplace construct _Decayed + _STL_INTERNAL_CHECK(_Storage._TypeData == 0); // !has_value() if constexpr (_Any_is_trivial<_Decayed>) { // using the _Trivial representation auto& _Obj = reinterpret_cast<_Decayed&>(_Storage._TrivialData); diff --git a/stl/inc/array b/stl/inc/array index 09bf8820073..da5e5afa751 100644 --- a/stl/inc/array +++ b/stl/inc/array @@ -420,12 +420,6 @@ public: using _Library_defined = array; -#if _HAS_TR1_NAMESPACE - _DEPRECATE_TR1_NAMESPACE void assign(const _Ty& _Value) { - _STD fill_n(_Elems, _Size, _Value); - } -#endif // _HAS_TR1_NAMESPACE - _CONSTEXPR20 void fill(const _Ty& _Value) { _STD fill_n(_Elems, _Size, _Value); } @@ -610,10 +604,6 @@ public: using _Library_defined = array; -#if _HAS_TR1_NAMESPACE - _DEPRECATE_TR1_NAMESPACE void assign(const _Ty&) {} -#endif // _HAS_TR1_NAMESPACE - _CONSTEXPR20 void fill(const _Ty&) {} _CONSTEXPR20 void swap(array&) noexcept {} @@ -896,13 +886,6 @@ _NODISCARD constexpr const _Ty&& get(const array<_Ty, _Size>&& _Arr) noexcept { return _STD move(_Arr[_Idx]); } } - -#if _HAS_TR1_NAMESPACE -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _STD array; - using _STD get; -} // namespace _DEPRECATE_TR1_NAMESPACE tr1 -#endif // _HAS_TR1_NAMESPACE _STD_END #pragma pop_macro("new") diff --git a/stl/inc/cmath b/stl/inc/cmath index 3028e21ba84..011068fd0f2 100644 --- a/stl/inc/cmath +++ b/stl/inc/cmath @@ -567,6 +567,17 @@ double frexp(_Ty _Value, _Out_ int* const _Exp) noexcept /* strengthened */ { return _CSTD frexp(static_cast(_Value), _Exp); } +template && _STD is_arithmetic_v<_Ty2>, int> = 0> +_NODISCARD _STD _Common_float_type_t<_Ty1, _Ty2> pow(_Ty1 _Left, _Ty2 _Right) noexcept /* strengthened */ { + if constexpr (_STD _Is_nonbool_integral<_Ty2>) { + if (_Right == 2) { + return static_cast(_Left) * static_cast(_Left); // TRANSITION, see GH-5768 + } + } + + return _CSTD pow(static_cast(_Left), static_cast(_Right)); +} + template && _STD is_arithmetic_v<_Ty2> && _STD is_arithmetic_v<_Ty3>, int> = 0> _NODISCARD _STD _Common_float_type_t<_Ty1, _STD _Common_float_type_t<_Ty2, _Ty3>> fma( @@ -861,7 +872,7 @@ _GENERIC_MATH1(cbrt) _GENERIC_MATH1(fabs) _GENERIC_MATH2(hypot) // 3-arg hypot() is hand-crafted -_GENERIC_MATH2(pow) +// pow() is hand-crafted _GENERIC_MATH1(sqrt) _GENERIC_MATH1(erf) _GENERIC_MATH1(erfc) diff --git a/stl/inc/compare b/stl/inc/compare index 37f9f7f40a2..09554ea1511 100644 --- a/stl/inc/compare +++ b/stl/inc/compare @@ -20,6 +20,12 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +// TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") +#undef msvc +#undef no_specializations + _STD_BEGIN void _Literal_zero_is_expected(); @@ -321,7 +327,7 @@ using compare_three_way_result_t = decltype(_STD declval&>() <=> _STD declval&>()); _EXPORT_STD template -struct compare_three_way_result {}; +struct _NO_SPECIALIZATIONS_CITING("N5014 [cmp.result]/1") compare_three_way_result {}; template requires requires { typename compare_three_way_result_t<_Ty1, _Ty2>; } @@ -841,6 +847,10 @@ inline namespace _Cpos { } _STD_END +// TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") +#pragma pop_macro("msvc") + #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/complex b/stl/inc/complex index 359afc36daf..efdf25d1bd7 100644 --- a/stl/inc/complex +++ b/stl/inc/complex @@ -21,8 +21,6 @@ // https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#base-requirements // Both floating-point and NEON support are presumed to be present in hardware. #define _FMP_USING_STD_FMA -#elif defined(__clang__) // ^^^ defined(_M_ARM64) || defined(_M_ARM64EC) ^^^ -// TRANSITION, not using x86/x64 FMA intrinsics for Clang yet #elif defined(_M_IX86) || defined(_M_X64) #define _FMP_USING_X86_X64_INTRINSICS #include <__msvc_bit_utils.hpp> @@ -167,7 +165,11 @@ namespace _Float_multi_prec { } #ifdef _FMP_USING_X86_X64_INTRINSICS - _NODISCARD inline double _Sqr_error_x86_x64_fma(const double _Xval, const double _Prod0) noexcept { +#ifdef __clang__ + [[__gnu__::__target__("fma")]] +#endif // defined(__clang__) + _NODISCARD inline double + _Sqr_error_x86_x64_fma(const double _Xval, const double _Prod0) noexcept { const __m128d _Mx = _mm_set_sd(_Xval); const __m128d _Mprod0 = _mm_set_sd(_Prod0); const __m128d _Mresult = _mm_fmsub_sd(_Mx, _Mx, _Mprod0); diff --git a/stl/inc/coroutine b/stl/inc/coroutine index 94933610fbe..268f816a014 100644 --- a/stl/inc/coroutine +++ b/stl/inc/coroutine @@ -32,6 +32,12 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +// TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") +#undef msvc +#undef no_specializations + _STD_BEGIN template @@ -46,7 +52,7 @@ _EXPORT_STD template struct coroutine_traits : _Coroutine_traits<_Ret> {}; _EXPORT_STD template -struct coroutine_handle; +struct _NO_SPECIALIZATIONS_CITING("N5014 [coroutine.handle.general]/2") coroutine_handle; template <> struct coroutine_handle { @@ -93,7 +99,7 @@ private: }; _EXPORT_STD template -struct coroutine_handle { +struct _NO_SPECIALIZATIONS_CITING("N5014 [coroutine.handle.general]/2") coroutine_handle { constexpr coroutine_handle() noexcept = default; constexpr coroutine_handle(nullptr_t) noexcept {} @@ -255,6 +261,10 @@ _EXPORT_STD struct suspend_always { _STD_END +// TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") +#pragma pop_macro("msvc") + #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/cstdint b/stl/inc/cstdint index d7810fe28c1..0ec169a4526 100644 --- a/stl/inc/cstdint +++ b/stl/inc/cstdint @@ -49,42 +49,6 @@ _EXPORT_STD using _CSTD intmax_t; _EXPORT_STD using _CSTD intptr_t; _EXPORT_STD using _CSTD uintmax_t; _EXPORT_STD using _CSTD uintptr_t; - -#if _HAS_TR1_NAMESPACE -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _CSTD int8_t; - using _CSTD int16_t; - using _CSTD int32_t; - using _CSTD int64_t; - using _CSTD uint8_t; - using _CSTD uint16_t; - using _CSTD uint32_t; - using _CSTD uint64_t; - - using _CSTD int_least8_t; - using _CSTD int_least16_t; - using _CSTD int_least32_t; - using _CSTD int_least64_t; - using _CSTD uint_least8_t; - using _CSTD uint_least16_t; - using _CSTD uint_least32_t; - using _CSTD uint_least64_t; - - using _CSTD int_fast8_t; - using _CSTD int_fast16_t; - using _CSTD int_fast32_t; - using _CSTD int_fast64_t; - using _CSTD uint_fast8_t; - using _CSTD uint_fast16_t; - using _CSTD uint_fast32_t; - using _CSTD uint_fast64_t; - - using _CSTD intmax_t; - using _CSTD intptr_t; - using _CSTD uintmax_t; - using _CSTD uintptr_t; -} // namespace _DEPRECATE_TR1_NAMESPACE tr1 -#endif // _HAS_TR1_NAMESPACE _STD_END #pragma pop_macro("new") diff --git a/stl/inc/format b/stl/inc/format index 7823e4fdcb9..6859271d780 100644 --- a/stl/inc/format +++ b/stl/inc/format @@ -345,6 +345,69 @@ public: } }; +// Implements a DFA matching the regex of the rule GB9c. The DFA is: +// +// Consonant +// +-------------------+ +// | | +// +---+ Consonant +-v-+ Linker +-+-+ +// | 1 +---------------> 2 +---------------> 3 | +// +---+ ++-^+ ++-^+ +// | | | | +// +-+ +-+ +// Extend Linker or Extend +// +// State '3' is the accepting state. +class _GB9c_regex { +private: + enum _State_t : uint8_t { _Consonant, _Linker, _Rest }; + + _State_t _State = _Consonant; + +public: + _NODISCARD constexpr bool operator==(const _GB9c_regex&) const noexcept = default; + + _NODISCARD constexpr bool _Match(const _Indic_Conjunct_Break_property_values _Left_InCB) noexcept { + switch (_State) { + case _Consonant: + if (_Left_InCB == _Indic_Conjunct_Break_property_values::_Consonant_value) { + _State = _Linker; + } + return false; + + case _Linker: + if (_Left_InCB == _Indic_Conjunct_Break_property_values::_Extend_value) { + return false; + } + + if (_Left_InCB == _Indic_Conjunct_Break_property_values::_Linker_value) { + _State = _Rest; + return true; + } + break; + + case _Rest: + if (_Left_InCB == _Indic_Conjunct_Break_property_values::_Consonant_value) { + _State = _Linker; + return false; + } + + if (_Left_InCB == _Indic_Conjunct_Break_property_values::_Extend_value + || _Left_InCB == _Indic_Conjunct_Break_property_values::_Linker_value) { + return true; + } + break; + + default: + _STL_INTERNAL_CHECK(false); + break; + } + + _State = _Consonant; + return false; + } +}; + // Implements a DFA matching the regex on the left side of rule GB11. The DFA is: // // +---+ ExtPic +---+ ZWJ +---+ @@ -390,11 +453,12 @@ public: }; template -class _Grapheme_break_property_iterator { +class _Grapheme_break_property_iterator2 { private: using _Wrapped_iter_type = _Unicode_codepoint_iterator<_CharT>; _Wrapped_iter_type _WrappedIter; + _GB9c_regex _GB9c_rx; _GB11_LeftHand_regex _GB11_rx; public: @@ -405,28 +469,32 @@ public: return _WrappedIter == default_sentinel; } - _NODISCARD constexpr bool operator==(const _Grapheme_break_property_iterator&) const noexcept = default; + _NODISCARD constexpr bool operator==(const _Grapheme_break_property_iterator2&) const noexcept = default; - constexpr _Grapheme_break_property_iterator(const _CharT* _First, const _CharT* _Last) + constexpr _Grapheme_break_property_iterator2(const _CharT* _First, const _CharT* _Last) : _WrappedIter(_First, _Last) {} - constexpr _Grapheme_break_property_iterator() = default; + constexpr _Grapheme_break_property_iterator2() = default; - constexpr _Grapheme_break_property_iterator& operator++() noexcept { + constexpr _Grapheme_break_property_iterator2& operator++() noexcept { auto _Left_gbp = _Grapheme_Break_property_data._Get_property_for_codepoint(*_WrappedIter); + auto _Left_InCB = _Indic_Conjunct_Break_property_data._Get_property_for_codepoint(*_WrappedIter); auto _Left_ExtPic = _Extended_Pictographic_property_data._Get_property_for_codepoint(*_WrappedIter); auto _Right_gbp = _Grapheme_Break_property_values::_No_value; auto _Right_ExtPic = _Extended_Pictographic_property_values::_No_value; size_t _Num_RIs = 0; - for (;; _Left_gbp = _Right_gbp, _Left_ExtPic = _Right_ExtPic) { + for (;; _Left_gbp = _Right_gbp, + _Left_InCB = _Indic_Conjunct_Break_property_data._Get_property_for_codepoint(*_WrappedIter), + _Left_ExtPic = _Right_ExtPic) { ++_WrappedIter; if (_WrappedIter == default_sentinel) { return *this; // GB2 Any % eot } _Right_gbp = _Grapheme_Break_property_data._Get_property_for_codepoint(*_WrappedIter); _Right_ExtPic = _Extended_Pictographic_property_data._Get_property_for_codepoint(*_WrappedIter); - // match GB11 now, so that we're sure to update it for every character, not just ones where - // the GB11 rule is considered + // match GB9c and GB11 now, so that we're sure to update them for every character, + // not just ones where the rules are considered + const bool _GB9c_Match = _GB9c_rx._Match(_Left_InCB); const bool _GB11_Match = _GB11_rx._Match(_Left_gbp, _Left_ExtPic); // Also update the number of sequential RIs immediately if (_Left_gbp == _Grapheme_Break_property_values::_Regional_Indicator_value) { @@ -486,6 +554,13 @@ public: continue; // GB9b Prepend x } + if (_GB9c_Match) { + // GB9c (since Unicode 15.1) + // \p{InCB=Consonant}[ \p{InCB=Extend} \p{InCB=Linker} ]* \p{InCB=Linker} [ \p{InCB=Extend} + // \p{InCB=Linker} ]* x \p{InCB=Consonant} + continue; + } + if (_GB11_Match && _Right_ExtPic == _Extended_Pictographic_property_values::_Extended_Pictographic_value) { continue; // GB11 \p{ExtendedPictographic} Extend* ZWJ x \p{ExtendedPictographic} } @@ -498,7 +573,7 @@ public: return *this; } } - constexpr _Grapheme_break_property_iterator operator++(int) noexcept { + constexpr _Grapheme_break_property_iterator2 operator++(int) noexcept { auto _Old = *this; ++*this; return _Old; @@ -2385,35 +2460,35 @@ _NODISCARD _OutputIt _Fmt_write( // width iterator for UTF-8 and UTF-16 template -class _Measure_string_prefix_iterator_utf { +class _Measure_string_prefix_iterator_utf2 { private: - _Grapheme_break_property_iterator<_CharT> _WrappedIter; + _Grapheme_break_property_iterator2<_CharT> _WrappedIter; public: using value_type = int; using difference_type = ptrdiff_t; - _NODISCARD constexpr bool operator==(const _Measure_string_prefix_iterator_utf&) const noexcept = default; + _NODISCARD constexpr bool operator==(const _Measure_string_prefix_iterator_utf2&) const noexcept = default; _NODISCARD constexpr bool operator==(default_sentinel_t) const noexcept { return _WrappedIter == default_sentinel; } - constexpr _Measure_string_prefix_iterator_utf(const _CharT* _First, const _CharT* _Last) + constexpr _Measure_string_prefix_iterator_utf2(const _CharT* _First, const _CharT* _Last) : _WrappedIter(_First, _Last) {} - constexpr _Measure_string_prefix_iterator_utf() = default; + constexpr _Measure_string_prefix_iterator_utf2() = default; _NODISCARD constexpr value_type operator*() const { return _Unicode_width_estimate(*_WrappedIter); } - constexpr _Measure_string_prefix_iterator_utf& operator++() noexcept { + constexpr _Measure_string_prefix_iterator_utf2& operator++() noexcept { ++_WrappedIter; return *this; } - constexpr _Measure_string_prefix_iterator_utf operator++(int) noexcept { + constexpr _Measure_string_prefix_iterator_utf2 operator++(int) noexcept { auto _Old = *this; ++*this; return _Old; @@ -2479,7 +2554,7 @@ public: template using _Measure_string_prefix_iterator = conditional_t && !_Is_execution_charset_self_synchronizing(), - _Measure_string_prefix_iterator_legacy, _Measure_string_prefix_iterator_utf<_CharT>>; + _Measure_string_prefix_iterator_legacy, _Measure_string_prefix_iterator_utf2<_CharT>>; template _NODISCARD const _CharT* _Measure_string_prefix(const basic_string_view<_CharT> _Value, int& _Width) { diff --git a/stl/inc/fstream b/stl/inc/fstream index bb6060f0cfd..cbae7586dbc 100644 --- a/stl/inc/fstream +++ b/stl/inc/fstream @@ -54,10 +54,12 @@ public: const wstring& _Str, ios_base::openmode _Mode = ios_base::in, int _Prot = ios_base::_Default_open_prot) : basic_ifstream(_Str.c_str(), _Mode, _Prot) {} // extension - template , int> = 0> +#if _HAS_CXX17 + template , int> = 0> explicit basic_ifstream( const _Ty& _Path, ios_base::openmode _Mode = ios_base::in, int _Prot = ios_base::_Default_open_prot) : basic_ifstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension +#endif // _HAS_CXX17 explicit basic_ifstream(FILE* _File) : _Mybase(_STD addressof(_Filebuffer)), _Filebuffer(_File) {} // extension @@ -102,15 +104,6 @@ public: open(_Str.c_str(), _Mode, _Prot); } -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - template - void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in, - int _Prot = ios_base::_Default_open_prot) { - // _Prot is an extension - open(_Path.c_str(), _Mode, _Prot); - } -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - #if _HAS_CXX17 template void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in, @@ -207,10 +200,12 @@ public: const wstring& _Str, ios_base::openmode _Mode = ios_base::out, int _Prot = ios_base::_Default_open_prot) : basic_ofstream(_Str.c_str(), _Mode, _Prot) {} // extension - template , int> = 0> +#if _HAS_CXX17 + template , int> = 0> explicit basic_ofstream( const _Ty& _Path, ios_base::openmode _Mode = ios_base::out, int _Prot = ios_base::_Default_open_prot) : basic_ofstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension +#endif // _HAS_CXX17 explicit basic_ofstream(FILE* _File) : _Mybase(_STD addressof(_Filebuffer)), _Filebuffer(_File) {} // extension @@ -255,15 +250,6 @@ public: open(_Str.c_str(), _Mode, _Prot); } -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - template - void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::out, - int _Prot = ios_base::_Default_open_prot) { - // _Prot is an extension - open(_Path.c_str(), _Mode, _Prot); - } -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - #if _HAS_CXX17 template void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::out, @@ -365,10 +351,12 @@ public: int _Prot = ios_base::_Default_open_prot) : basic_fstream(_Str.c_str(), _Mode, _Prot) {} // extension - template , int> = 0> +#if _HAS_CXX17 + template , int> = 0> explicit basic_fstream(const _Ty& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out, int _Prot = ios_base::_Default_open_prot) : basic_fstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension +#endif // _HAS_CXX17 explicit basic_fstream(FILE* _File) : _Mybase(_STD addressof(_Filebuffer)), _Filebuffer(_File) {} // extension @@ -414,15 +402,6 @@ public: open(_Str.c_str(), _Mode, _Prot); } -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - template - void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out, - int _Prot = ios_base::_Default_open_prot) { - // extension - open(_Path.c_str(), _Mode, _Prot); - } -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - #if _HAS_CXX17 template void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out, @@ -487,8 +466,6 @@ void swap(basic_fstream<_Elem, _Traits>& _Left, basic_fstream<_Elem, _Traits>& _ } _STD_END -#undef _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/functional b/stl/inc/functional index d51e506a2f8..04fa643e51f 100644 --- a/stl/inc/functional +++ b/stl/inc/functional @@ -28,6 +28,12 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +// TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") +#undef msvc +#undef no_specializations + _STD_BEGIN // plus, minus, and multiplies are defined in @@ -301,13 +307,13 @@ _STL_RESTORE_DEPRECATED_WARNING #if _HAS_AUTO_PTR_ETC _EXPORT_STD template -struct unary_function { // base class for unary functions +struct _NO_SPECIALIZATIONS_CITING("N4140 [depr.base]/1") unary_function { // base class for unary functions using argument_type = _Arg; using result_type = _Result; }; _EXPORT_STD template -struct binary_function { // base class for binary functions +struct _NO_SPECIALIZATIONS_CITING("N4140 [depr.base]/1") binary_function { // base class for binary functions using first_argument_type = _Arg1; using second_argument_type = _Arg2; using result_type = _Result; @@ -2008,7 +2014,7 @@ template struct is_placeholder : is_placeholder<_Tx>::type {}; // ignore cv-qualifiers _EXPORT_STD template -constexpr int is_placeholder_v = is_placeholder<_Ty>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr int is_placeholder_v = is_placeholder<_Ty>::value; template class _Binder; @@ -2029,7 +2035,7 @@ template struct is_bind_expression : is_bind_expression<_Tx>::type {}; // ignore cv-qualifiers _EXPORT_STD template -constexpr bool is_bind_expression_v = is_bind_expression<_Ty>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool is_bind_expression_v = is_bind_expression<_Ty>::value; template , reference_wrapper>, bool = is_bind_expression_v<_Cv_TiD>, int = is_placeholder_v<_Cv_TiD>> @@ -3142,24 +3148,12 @@ namespace ranges { }; } // namespace ranges #endif // _HAS_CXX20 - -#if _HAS_TR1_NAMESPACE -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _STD bad_function_call; - using _STD bind; - using _STD function; - using _STD is_bind_expression; - using _STD is_placeholder; - using _STD mem_fn; - using _STD swap; - namespace placeholders { - using namespace _STD placeholders; - } -} // namespace _DEPRECATE_TR1_NAMESPACE tr1 -#endif // _HAS_TR1_NAMESPACE - _STD_END +// TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") +#pragma pop_macro("msvc") + #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/generator b/stl/inc/generator index 0bc7ab7a6a8..2b870f3952c 100644 --- a/stl/inc/generator +++ b/stl/inc/generator @@ -27,7 +27,11 @@ _STL_DISABLE_CLANG_WARNINGS #undef new // TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") #pragma push_macro("empty_bases") +#undef msvc +#undef no_specializations #undef empty_bases _STD_BEGIN @@ -40,7 +44,7 @@ template constexpr bool _Stateless_allocator = default_initializable<_Alloc> && allocator_traits<_Alloc>::is_always_equal::value; _EXPORT_STD template -class generator; +class _NO_SPECIALIZATIONS_CITING("N5014 [coro.generator.class]/4") generator; namespace _Gen_detail { template @@ -518,7 +522,8 @@ namespace _Gen_detail { } // namespace _Gen_detail _EXPORT_STD template -class generator : public _RANGES view_interface> { +class _NO_SPECIALIZATIONS_CITING("N5014 [coro.generator.class]/4") generator + : public _RANGES view_interface> { private: static_assert(_Gen_detail::_Valid_allocator<_Alloc>, "generator allocators must use raw pointers (N4988 [coro.generator.class]/1.1)"); @@ -603,6 +608,8 @@ _STD_END // TRANSITION, non-_Ugly attribute tokens #pragma pop_macro("empty_bases") +#pragma pop_macro("no_specializations") +#pragma pop_macro("msvc") #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS diff --git a/stl/inc/hash_map b/stl/inc/hash_map deleted file mode 100644 index e43b4099a76..00000000000 --- a/stl/inc/hash_map +++ /dev/null @@ -1,465 +0,0 @@ -// hash_map extension header - -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef _HASH_MAP_ -#define _HASH_MAP_ -#include -#if _STL_COMPILER_PREPROCESSOR -#include - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -#ifndef _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -#error is deprecated and will be REMOVED. Please use . You can define \ -_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to suppress this error. -#endif // _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS - -namespace stdext { - using _STD allocator; - using _STD enable_if_t; - using _STD is_constructible_v; - using _STD pair; - using _STD swap; - using _STD _Hash; - using _STD _Is_nothrow_swappable; - using _STD _Xout_of_range; - - template // true if multiple equivalent keys are permitted - class _Hmap_traits : public _Tr { // traits required to make _Hash behave like a map - public: - using key_type = _Kty; - using value_type = pair; - using _Mutable_value_type = pair<_Kty, _Ty>; - using key_compare = _Tr; - using allocator_type = _Alloc; -#if _HAS_CXX17 - using node_type = - _STD _Node_handle<_STD _List_node::void_pointer>, _Alloc, - _STD _Node_handle_map_base, _Kty, _Ty>; -#endif // _HAS_CXX17 - - static constexpr bool _Multi = _Mfl; - static constexpr bool _Standard = false; - - template - using _In_place_key_extractor = _STD _In_place_key_extract_map<_Kty, _Args...>; - - using key_equal = _Tr; - - static constexpr bool _Has_transparent_overloads = false; - - _Hmap_traits() = default; - - _Hmap_traits(const _Tr& _Traits) noexcept(_STD is_nothrow_copy_constructible_v<_Tr>) : _Tr(_Traits) {} - - class value_compare { - public: - using first_argument_type = value_type; - using second_argument_type = value_type; - using result_type = bool; - - _NODISCARD bool operator()(const value_type& _Left, const value_type& _Right) const - noexcept(noexcept(_Keycompobj(_Left.first, _Right.first))) { - // test if _Left precedes _Right by comparing just keys - return _Keycompobj(_Left.first, _Right.first); - } - - value_compare(const key_compare& _Keycomparg) noexcept(_STD is_nothrow_copy_constructible_v) - : _Keycompobj(_Keycomparg) {} - - key_compare _Keycompobj; - }; - - template - _NODISCARD static const _Kty& _Kfn(const pair<_Ty1, _Ty2>& _Val) noexcept { // extract key from element value - return _Val.first; - } - - _NODISCARD float& _Get_max_bucket_size() noexcept { - return _Max_buckets; - } - - _NODISCARD const float& _Get_max_bucket_size() const noexcept { - return _Max_buckets; - } - - void swap(_Hmap_traits& _Rhs) noexcept(_Is_nothrow_swappable<_Tr>::value) { - using _STD swap; - swap(static_cast<_Tr&>(*this), static_cast<_Tr&>(_Rhs)); // intentional ADL - _STD swap(_Max_buckets, _Rhs._Max_buckets); - } - - float _Max_buckets = 0.0F; // current maximum bucket size - }; - - template >, - class _Alloc = allocator>> - class hash_map : public _Hash<_Hmap_traits<_Kty, _Ty, _Tr, _Alloc, false>> { - // hash table of {key, mapped} values, unique keys - public: - using _Mybase = _Hash<_Hmap_traits<_Kty, _Ty, _Tr, _Alloc, false>>; - using key_type = _Kty; - using mapped_type = _Ty; - using referent_type = _Ty; - using key_compare = _Tr; - using value_compare = typename _Mybase::_Value_compare; - using value_type = pair; - using allocator_type = typename _Mybase::allocator_type; - using size_type = typename _Mybase::size_type; - using difference_type = typename _Mybase::difference_type; - using pointer = typename _Mybase::pointer; - using const_pointer = typename _Mybase::const_pointer; - using reference = value_type&; - using const_reference = const value_type&; - using iterator = typename _Mybase::iterator; - using const_iterator = typename _Mybase::const_iterator; - using _Alnode = typename _Mybase::_Alnode; - using _Alnode_traits = typename _Mybase::_Alnode_traits; -#if _HAS_CXX17 - using insert_return_type = _STD _Insert_return_type; -#endif // _HAS_CXX17 - - hash_map() : _Mybase(key_compare(), allocator_type()) {} - - explicit hash_map(const allocator_type& _Al) : _Mybase(key_compare(), _Al) {} - - hash_map(const hash_map& _Right) - : _Mybase(_Right, _Alnode_traits::select_on_container_copy_construction(_Right._Getal())) {} - - hash_map(const hash_map& _Right, const allocator_type& _Al) : _Mybase(_Right, _Al) {} - - explicit hash_map(const key_compare& _Traits) : _Mybase(_Traits, allocator_type()) {} - - hash_map(const key_compare& _Traits, const allocator_type& _Al) : _Mybase(_Traits, _Al) {} - - template - hash_map(_Iter _First, _Iter _Last) : _Mybase(key_compare(), allocator_type()) { - insert(_First, _Last); - } - - template - hash_map(_Iter _First, _Iter _Last, const key_compare& _Traits) : _Mybase(_Traits, allocator_type()) { - insert(_First, _Last); - } - - template - hash_map(_Iter _First, _Iter _Last, const key_compare& _Traits, const allocator_type& _Al) - : _Mybase(_Traits, _Al) { - insert(_First, _Last); - } - - hash_map& operator=(const hash_map& _Right) { - _Mybase::operator=(_Right); - return *this; - } - - hash_map(hash_map&& _Right) : _Mybase(_STD move(_Right)) {} - - hash_map(hash_map&& _Right, const allocator_type& _Al) : _Mybase(_STD move(_Right), _Al) {} - - hash_map& operator=(hash_map&& _Right) noexcept(noexcept(_Mybase::operator=(_STD move(_Right)))) { - _Mybase::operator=(_STD move(_Right)); - return *this; - } - - mapped_type& operator[](key_type&& _Keyval) { - return this->_Try_emplace(_STD move(_Keyval)).first->_Myval.second; - } - - void swap(hash_map& _Right) noexcept(noexcept(_Mybase::swap(_Right))) { - _Mybase::swap(_Right); - } - - using _Mybase::insert; - - template , int> = 0> - pair insert(_Valty&& _Val) { - return this->emplace(_STD forward<_Valty>(_Val)); - } - - template , int> = 0> - iterator insert(const_iterator _Where, _Valty&& _Val) { - return this->emplace_hint(_Where, _STD forward<_Valty>(_Val)); - } - - hash_map(_STD initializer_list _Ilist) : _Mybase(key_compare(), allocator_type()) { - insert(_Ilist); - } - - hash_map(_STD initializer_list _Ilist, const key_compare& _Pred) - : _Mybase(_Pred, allocator_type()) { - insert(_Ilist); - } - - hash_map(_STD initializer_list _Ilist, const key_compare& _Pred, const allocator_type& _Al) - : _Mybase(_Pred, _Al) { - insert(_Ilist); - } - - hash_map& operator=(_STD initializer_list _Ilist) { - this->clear(); - insert(_Ilist); - return *this; - } - - mapped_type& operator[](const key_type& _Keyval) { - return this->_Try_emplace(_Keyval).first->_Myval.second; - } - - _NODISCARD mapped_type& at(const key_type& _Keyval) { - const auto _Target = this->_Find_last(_Keyval, this->_Traitsobj(_Keyval)); - if (_Target._Duplicate) { - return _Target._Duplicate->_Myval.second; - } - - _Xout_of_range("invalid hash_map key"); - } - - _NODISCARD const mapped_type& at(const key_type& _Keyval) const { - const auto _Target = this->_Find_last(_Keyval, this->_Traitsobj(_Keyval)); - if (_Target._Duplicate) { - return _Target._Duplicate->_Myval.second; - } - - _Xout_of_range("invalid hash_map key"); - } - - using reverse_iterator = _STD reverse_iterator; - using const_reverse_iterator = _STD reverse_iterator; - - _NODISCARD reverse_iterator rbegin() noexcept { - return reverse_iterator(this->end()); - } - - _NODISCARD const_reverse_iterator rbegin() const noexcept { - return const_reverse_iterator(this->end()); - } - - _NODISCARD reverse_iterator rend() noexcept { - return reverse_iterator(this->begin()); - } - - _NODISCARD const_reverse_iterator rend() const noexcept { - return const_reverse_iterator(this->begin()); - } - - _NODISCARD const_reverse_iterator crbegin() const noexcept { - return rbegin(); - } - - _NODISCARD const_reverse_iterator crend() const noexcept { - return rend(); - } - - _NODISCARD key_compare key_comp() const { - return this->_Traitsobj; - } - - _NODISCARD value_compare value_comp() const { - return value_compare(key_comp()); - } - - using _Mybase::_Unchecked_begin; - using _Mybase::_Unchecked_end; - }; - - template - void swap(hash_map<_Kty, _Ty, _Tr, _Alloc>& _Left, hash_map<_Kty, _Ty, _Tr, _Alloc>& _Right) - noexcept(noexcept(_Left.swap(_Right))) { - _Left.swap(_Right); - } - - template - _NODISCARD bool operator==( - const hash_map<_Kty, _Ty, _Tr, _Alloc>& _Left, const hash_map<_Kty, _Ty, _Tr, _Alloc>& _Right) { - return _STD _Hash_equal(_Left, _Right); - } - - template - _NODISCARD bool operator!=( - const hash_map<_Kty, _Ty, _Tr, _Alloc>& _Left, const hash_map<_Kty, _Ty, _Tr, _Alloc>& _Right) { - return !(_Left == _Right); - } - - template >, - class _Alloc = allocator>> - class hash_multimap : public _Hash<_Hmap_traits<_Kty, _Ty, _Tr, _Alloc, true>> { - // hash table of {key, mapped} values, non-unique keys - public: - using _Mybase = _Hash<_Hmap_traits<_Kty, _Ty, _Tr, _Alloc, true>>; - using key_type = _Kty; - using mapped_type = _Ty; - using referent_type = _Ty; // old name, magically gone - using key_compare = _Tr; - using value_compare = typename _Mybase::_Value_compare; - using value_type = pair; - using allocator_type = typename _Mybase::allocator_type; - using size_type = typename _Mybase::size_type; - using difference_type = typename _Mybase::difference_type; - using pointer = typename _Mybase::pointer; - using const_pointer = typename _Mybase::const_pointer; - using reference = value_type&; - using const_reference = const value_type&; - using iterator = typename _Mybase::iterator; - using const_iterator = typename _Mybase::const_iterator; - using _Alnode = typename _Mybase::_Alnode; - using _Alnode_traits = typename _Mybase::_Alnode_traits; - - hash_multimap() : _Mybase(key_compare(), allocator_type()) {} - - explicit hash_multimap(const allocator_type& _Al) : _Mybase(key_compare(), _Al) {} - - hash_multimap(const hash_multimap& _Right) - : _Mybase(_Right, _Alnode_traits::select_on_container_copy_construction(_Right._Getal())) {} - - hash_multimap(const hash_multimap& _Right, const allocator_type& _Al) : _Mybase(_Right, _Al) {} - - explicit hash_multimap(const key_compare& _Traits) : _Mybase(_Traits, allocator_type()) {} - - hash_multimap(const key_compare& _Traits, const allocator_type& _Al) : _Mybase(_Traits, _Al) {} - - template - hash_multimap(_Iter _First, _Iter _Last) : _Mybase(key_compare(), allocator_type()) { - insert(_First, _Last); - } - - template - hash_multimap(_Iter _First, _Iter _Last, const key_compare& _Traits) : _Mybase(_Traits, allocator_type()) { - insert(_First, _Last); - } - - template - hash_multimap(_Iter _First, _Iter _Last, const key_compare& _Traits, const allocator_type& _Al) - : _Mybase(_Traits, _Al) { - insert(_First, _Last); - } - - hash_multimap& operator=(const hash_multimap& _Right) { - _Mybase::operator=(_Right); - return *this; - } - - hash_multimap(hash_multimap&& _Right) : _Mybase(_STD move(_Right)) {} - - hash_multimap(hash_multimap&& _Right, const allocator_type& _Al) : _Mybase(_STD move(_Right), _Al) {} - - hash_multimap& operator=(hash_multimap&& _Right) noexcept(noexcept(_Mybase::operator=(_STD move(_Right)))) { - _Mybase::operator=(_STD move(_Right)); - return *this; - } - - void swap(hash_multimap& _Right) noexcept(noexcept(_Mybase::swap(_Right))) { - _Mybase::swap(_Right); - } - - using _Mybase::insert; - - template , int> = 0> - iterator insert(_Valty&& _Val) { - return this->emplace(_STD forward<_Valty>(_Val)); - } - - template , int> = 0> - iterator insert(const_iterator _Where, _Valty&& _Val) { - return this->emplace_hint(_Where, _STD forward<_Valty>(_Val)); - } - - hash_multimap(_STD initializer_list _Ilist) : _Mybase(key_compare(), allocator_type()) { - insert(_Ilist); - } - - hash_multimap(_STD initializer_list _Ilist, const key_compare& _Pred) - : _Mybase(_Pred, allocator_type()) { - insert(_Ilist); - } - - hash_multimap(_STD initializer_list _Ilist, const key_compare& _Pred, const allocator_type& _Al) - : _Mybase(_Pred, _Al) { - insert(_Ilist); - } - - hash_multimap& operator=(_STD initializer_list _Ilist) { - this->clear(); - insert(_Ilist); - return *this; - } - - using reverse_iterator = _STD reverse_iterator; - using const_reverse_iterator = _STD reverse_iterator; - - _NODISCARD reverse_iterator rbegin() noexcept { - return reverse_iterator(this->end()); - } - - _NODISCARD const_reverse_iterator rbegin() const noexcept { - return const_reverse_iterator(this->end()); - } - - _NODISCARD reverse_iterator rend() noexcept { - return reverse_iterator(this->begin()); - } - - _NODISCARD const_reverse_iterator rend() const noexcept { - return const_reverse_iterator(this->begin()); - } - - _NODISCARD const_reverse_iterator crbegin() const noexcept { - return rbegin(); - } - - _NODISCARD const_reverse_iterator crend() const noexcept { - return rend(); - } - - _NODISCARD key_compare key_comp() const { - return this->_Traitsobj; - } - - _NODISCARD value_compare value_comp() const { - return value_compare(key_comp()); - } - - using _Mybase::_Unchecked_begin; - using _Mybase::_Unchecked_end; - }; - - template - void swap(hash_multimap<_Kty, _Ty, _Tr, _Alloc>& _Left, hash_multimap<_Kty, _Ty, _Tr, _Alloc>& _Right) - noexcept(noexcept(_Left.swap(_Right))) { - _Left.swap(_Right); - } - - template - _NODISCARD bool operator==( - const hash_multimap<_Kty, _Ty, _Tr, _Alloc>& _Left, const hash_multimap<_Kty, _Ty, _Tr, _Alloc>& _Right) { - return _STD _Hash_equal(_Left, _Right); - } - - template - _NODISCARD bool operator!=( - const hash_multimap<_Kty, _Ty, _Tr, _Alloc>& _Left, const hash_multimap<_Kty, _Ty, _Tr, _Alloc>& _Right) { - return !(_Left == _Right); - } -} // namespace stdext -_STD_BEGIN -using _STDEXT hash_map; -using _STDEXT hash_multimap; -_STD_END - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) -#endif // _STL_COMPILER_PREPROCESSOR -#endif // _HASH_MAP_ diff --git a/stl/inc/hash_set b/stl/inc/hash_set deleted file mode 100644 index 676680998ed..00000000000 --- a/stl/inc/hash_set +++ /dev/null @@ -1,385 +0,0 @@ -// hash_set extension header - -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef _HASH_SET_ -#define _HASH_SET_ -#include -#if _STL_COMPILER_PREPROCESSOR -#include - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -#ifndef _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -#error is deprecated and will be REMOVED. Please use . You can define \ -_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to suppress this error. -#endif // _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS - -namespace stdext { - using _STD allocator; - using _STD swap; - using _STD _Hash; - using _STD _Is_nothrow_swappable; - - template // true if multiple equivalent keys are permitted - class _Hset_traits : public _Tr { // traits required to make _Hash behave like a set - public: - using key_type = _Kty; - using value_type = _Kty; - using _Mutable_value_type = _Kty; - using key_compare = _Tr; - using allocator_type = _Alloc; -#if _HAS_CXX17 - using node_type = - _STD _Node_handle<_STD _List_node::void_pointer>, _Alloc, - _STD _Node_handle_set_base, _Kty>; -#endif // _HAS_CXX17 - - static constexpr bool _Multi = _Mfl; - static constexpr bool _Standard = false; - - template - using _In_place_key_extractor = _STD _In_place_key_extract_set<_Kty, _Args...>; - - using key_equal = _Tr; - - static constexpr bool _Has_transparent_overloads = false; - - _Hset_traits() = default; - - _Hset_traits(const _Tr& _Traits) noexcept(_STD is_nothrow_copy_constructible_v<_Tr>) : _Tr(_Traits) {} - - using value_compare = key_compare; - - _NODISCARD static const _Kty& _Kfn(const value_type& _Val) noexcept { - return _Val; - } - - _NODISCARD float& _Get_max_bucket_size() noexcept { - return _Max_buckets; - } - - _NODISCARD const float& _Get_max_bucket_size() const noexcept { - return _Max_buckets; - } - - void swap(_Hset_traits& _Rhs) noexcept(_Is_nothrow_swappable<_Tr>::value) { - using _STD swap; - swap(static_cast<_Tr&>(*this), static_cast<_Tr&>(_Rhs)); // intentional ADL - _STD swap(_Max_buckets, _Rhs._Max_buckets); - } - - float _Max_buckets = 0.0F; // current maximum bucket size - }; - - template >, class _Alloc = allocator<_Kty>> - class hash_set : public _Hash<_Hset_traits<_Kty, _Tr, _Alloc, false>> { // hash table of key values, unique keys - public: - using _Mybase = _Hash<_Hset_traits<_Kty, _Tr, _Alloc, false>>; - using key_type = _Kty; - using key_compare = _Tr; - using value_compare = typename _Mybase::_Value_compare; - using value_type = typename _Mybase::value_type; - using allocator_type = typename _Mybase::allocator_type; - using size_type = typename _Mybase::size_type; - using difference_type = typename _Mybase::difference_type; - using pointer = typename _Mybase::pointer; - using const_pointer = typename _Mybase::const_pointer; - using reference = value_type&; - using const_reference = const value_type&; - using iterator = typename _Mybase::iterator; - using const_iterator = typename _Mybase::const_iterator; - using _Alnode = typename _Mybase::_Alnode; - using _Alnode_traits = typename _Mybase::_Alnode_traits; -#if _HAS_CXX17 - using insert_return_type = _STD _Insert_return_type; -#endif // _HAS_CXX17 - - hash_set() : _Mybase(key_compare(), allocator_type()) {} - - explicit hash_set(const allocator_type& _Al) : _Mybase(key_compare(), _Al) {} - - hash_set(const hash_set& _Right) - : _Mybase(_Right, _Alnode_traits::select_on_container_copy_construction(_Right._Getal())) {} - - hash_set(const hash_set& _Right, const allocator_type& _Al) : _Mybase(_Right, _Al) {} - - explicit hash_set(const key_compare& _Traits) : _Mybase(_Traits, allocator_type()) {} - - hash_set(const key_compare& _Traits, const allocator_type& _Al) : _Mybase(_Traits, _Al) {} - - template - hash_set(_Iter _First, _Iter _Last) : _Mybase(key_compare(), allocator_type()) { - this->insert(_First, _Last); - } - - template - hash_set(_Iter _First, _Iter _Last, const key_compare& _Traits) : _Mybase(_Traits, allocator_type()) { - this->insert(_First, _Last); - } - - template - hash_set(_Iter _First, _Iter _Last, const key_compare& _Traits, const allocator_type& _Al) - : _Mybase(_Traits, _Al) { - this->insert(_First, _Last); - } - - hash_set& operator=(const hash_set& _Right) { - _Mybase::operator=(_Right); - return *this; - } - - hash_set(hash_set&& _Right) : _Mybase(_STD move(_Right)) {} - - hash_set(hash_set&& _Right, const allocator_type& _Al) : _Mybase(_STD move(_Right), _Al) {} - - hash_set& operator=(hash_set&& _Right) noexcept(noexcept(_Mybase::operator=(_STD move(_Right)))) { - _Mybase::operator=(_STD move(_Right)); - return *this; - } - - void swap(hash_set& _Right) noexcept(noexcept(_Mybase::swap(_Right))) { - _Mybase::swap(_Right); - } - - hash_set(_STD initializer_list _Ilist) : _Mybase(key_compare(), allocator_type()) { - this->insert(_Ilist); - } - - hash_set(_STD initializer_list _Ilist, const key_compare& _Pred) - : _Mybase(_Pred, allocator_type()) { - this->insert(_Ilist); - } - - hash_set(_STD initializer_list _Ilist, const key_compare& _Pred, const allocator_type& _Al) - : _Mybase(_Pred, _Al) { - this->insert(_Ilist); - } - - hash_set& operator=(_STD initializer_list _Ilist) { - this->clear(); - this->insert(_Ilist); - return *this; - } - - using reverse_iterator = _STD reverse_iterator; - using const_reverse_iterator = _STD reverse_iterator; - - _NODISCARD reverse_iterator rbegin() noexcept { - return reverse_iterator(this->end()); - } - - _NODISCARD const_reverse_iterator rbegin() const noexcept { - return const_reverse_iterator(this->end()); - } - - _NODISCARD reverse_iterator rend() noexcept { - return reverse_iterator(this->begin()); - } - - _NODISCARD const_reverse_iterator rend() const noexcept { - return const_reverse_iterator(this->begin()); - } - - _NODISCARD const_reverse_iterator crbegin() const noexcept { - return rbegin(); - } - - _NODISCARD const_reverse_iterator crend() const noexcept { - return rend(); - } - - _NODISCARD key_compare key_comp() const { - return this->_Traitsobj; - } - - _NODISCARD value_compare value_comp() const { - return value_compare(key_comp()); - } - - using _Mybase::_Unchecked_begin; - using _Mybase::_Unchecked_end; - }; - - template - void swap(hash_set<_Kty, _Tr, _Alloc>& _Left, hash_set<_Kty, _Tr, _Alloc>& _Right) - noexcept(noexcept(_Left.swap(_Right))) { - _Left.swap(_Right); - } - - template - _NODISCARD bool operator==(const hash_set<_Kty, _Tr, _Alloc>& _Left, const hash_set<_Kty, _Tr, _Alloc>& _Right) { - return _STD _Hash_equal(_Left, _Right); - } - - template - _NODISCARD bool operator!=(const hash_set<_Kty, _Tr, _Alloc>& _Left, const hash_set<_Kty, _Tr, _Alloc>& _Right) { - return !(_Left == _Right); - } - - template >, class _Alloc = allocator<_Kty>> - class hash_multiset - : public _Hash<_Hset_traits<_Kty, _Tr, _Alloc, true>> { // hash table of key values, non-unique keys - public: - using _Mybase = _Hash<_Hset_traits<_Kty, _Tr, _Alloc, true>>; - using key_type = _Kty; - using key_compare = _Tr; - using value_compare = typename _Mybase::_Value_compare; - using value_type = typename _Mybase::value_type; - using allocator_type = typename _Mybase::allocator_type; - using size_type = typename _Mybase::size_type; - using difference_type = typename _Mybase::difference_type; - using pointer = typename _Mybase::pointer; - using const_pointer = typename _Mybase::const_pointer; - using reference = value_type&; - using const_reference = const value_type&; - using iterator = typename _Mybase::iterator; - using const_iterator = typename _Mybase::const_iterator; - using _Alnode = typename _Mybase::_Alnode; - using _Alnode_traits = typename _Mybase::_Alnode_traits; - - hash_multiset() : _Mybase(key_compare(), allocator_type()) {} - - explicit hash_multiset(const allocator_type& _Al) : _Mybase(key_compare(), _Al) {} - - hash_multiset(const hash_multiset& _Right) - : _Mybase(_Right, _Alnode_traits::select_on_container_copy_construction(_Right._Getal())) {} - - hash_multiset(const hash_multiset& _Right, const allocator_type& _Al) : _Mybase(_Right, _Al) {} - - explicit hash_multiset(const key_compare& _Traits) : _Mybase(_Traits, allocator_type()) {} - - hash_multiset(const key_compare& _Traits, const allocator_type& _Al) : _Mybase(_Traits, _Al) {} - - template - hash_multiset(_Iter _First, _Iter _Last) : _Mybase(key_compare(), allocator_type()) { - this->insert(_First, _Last); - } - - template - hash_multiset(_Iter _First, _Iter _Last, const key_compare& _Traits) : _Mybase(_Traits, allocator_type()) { - this->insert(_First, _Last); - } - - template - hash_multiset(_Iter _First, _Iter _Last, const key_compare& _Traits, const allocator_type& _Al) - : _Mybase(_Traits, _Al) { - this->insert(_First, _Last); - } - - hash_multiset& operator=(const hash_multiset& _Right) { - _Mybase::operator=(_Right); - return *this; - } - - hash_multiset(hash_multiset&& _Right) : _Mybase(_STD move(_Right)) {} - - hash_multiset(hash_multiset&& _Right, const allocator_type& _Al) : _Mybase(_STD move(_Right), _Al) {} - - hash_multiset& operator=(hash_multiset&& _Right) noexcept(noexcept(_Mybase::operator=(_STD move(_Right)))) { - _Mybase::operator=(_STD move(_Right)); - return *this; - } - - void swap(hash_multiset& _Right) noexcept(noexcept(_Mybase::swap(_Right))) { - _Mybase::swap(_Right); - } - - hash_multiset(_STD initializer_list _Ilist) : _Mybase(key_compare(), allocator_type()) { - this->insert(_Ilist); - } - - hash_multiset(_STD initializer_list _Ilist, const key_compare& _Pred) - : _Mybase(_Pred, allocator_type()) { - this->insert(_Ilist); - } - - hash_multiset(_STD initializer_list _Ilist, const key_compare& _Pred, const allocator_type& _Al) - : _Mybase(_Pred, _Al) { - this->insert(_Ilist); - } - - hash_multiset& operator=(_STD initializer_list _Ilist) { - this->clear(); - this->insert(_Ilist); - return *this; - } - - using reverse_iterator = _STD reverse_iterator; - using const_reverse_iterator = _STD reverse_iterator; - - _NODISCARD reverse_iterator rbegin() noexcept { - return reverse_iterator(this->end()); - } - - _NODISCARD const_reverse_iterator rbegin() const noexcept { - return const_reverse_iterator(this->end()); - } - - _NODISCARD reverse_iterator rend() noexcept { - return reverse_iterator(this->begin()); - } - - _NODISCARD const_reverse_iterator rend() const noexcept { - return const_reverse_iterator(this->begin()); - } - - _NODISCARD const_reverse_iterator crbegin() const noexcept { - return rbegin(); - } - - _NODISCARD const_reverse_iterator crend() const noexcept { - return rend(); - } - - _NODISCARD key_compare key_comp() const { - return this->_Traitsobj; - } - - _NODISCARD value_compare value_comp() const { - return value_compare(key_comp()); - } - - using _Mybase::_Unchecked_begin; - using _Mybase::_Unchecked_end; - }; - - template - void swap(hash_multiset<_Kty, _Tr, _Alloc>& _Left, hash_multiset<_Kty, _Tr, _Alloc>& _Right) - noexcept(noexcept(_Left.swap(_Right))) { - _Left.swap(_Right); - } - - template - _NODISCARD bool operator==( - const hash_multiset<_Kty, _Tr, _Alloc>& _Left, const hash_multiset<_Kty, _Tr, _Alloc>& _Right) { - return _STD _Hash_equal(_Left, _Right); - } - - template - _NODISCARD bool operator!=( - const hash_multiset<_Kty, _Tr, _Alloc>& _Left, const hash_multiset<_Kty, _Tr, _Alloc>& _Right) { - return !(_Left == _Right); - } -} // namespace stdext - -_STD_BEGIN -using _STDEXT hash_multiset; -using _STDEXT hash_set; -_STD_END - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) -#endif // _STL_COMPILER_PREPROCESSOR -#endif // _HASH_SET_ diff --git a/stl/inc/header-units.json b/stl/inc/header-units.json index 3eccb480854..536c2fb4990 100644 --- a/stl/inc/header-units.json +++ b/stl/inc/header-units.json @@ -79,8 +79,6 @@ "functional", "future", "generator", - // "hash_map", // non-Standard, will be removed soon - // "hash_set", // non-Standard, will be removed soon "initializer_list", "iomanip", "ios", diff --git a/stl/inc/initializer_list b/stl/inc/initializer_list index 8ef3c5e90cf..b5d6ae7370e 100644 --- a/stl/inc/initializer_list +++ b/stl/inc/initializer_list @@ -16,9 +16,15 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +// TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") +#undef msvc +#undef no_specializations + _STD_BEGIN _EXPORT_STD template -class initializer_list { +class _NO_SPECIALIZATIONS_CITING("N5014 [initializer.list.syn]/2") initializer_list { public: using value_type = _Elem; using reference = const _Elem&; @@ -60,6 +66,11 @@ _NODISCARD constexpr const _Elem* end(initializer_list<_Elem> _Ilist) noexcept { return _Ilist.end(); } _STD_END + +// TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") +#pragma pop_macro("msvc") + #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/ios b/stl/inc/ios index 24353546712..4b7aca1a802 100644 --- a/stl/inc/ios +++ b/stl/inc/ios @@ -300,13 +300,6 @@ _EXPORT_STD inline ios_base& __CLRCALL_OR_CDECL uppercase(ios_base& _Iosbase) { _Iosbase.setf(ios_base::uppercase); return _Iosbase; } - -#if _HAS_TR1_NAMESPACE -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _STD hexfloat; -} -#endif // _HAS_TR1_NAMESPACE - _STD_END #pragma pop_macro("new") diff --git a/stl/inc/mdspan b/stl/inc/mdspan index ea05bb61d5c..f2f1f05375a 100644 --- a/stl/inc/mdspan +++ b/stl/inc/mdspan @@ -25,7 +25,9 @@ _STL_DISABLE_CLANG_WARNINGS // TRANSITION, non-_Ugly attribute tokens #pragma push_macro("msvc") +#pragma push_macro("no_specializations") #undef msvc +#undef no_specializations _STD_BEGIN template @@ -434,17 +436,17 @@ constexpr bool _Is_mapping_of = _EXPORT_STD struct layout_left { template - class mapping; + class _NO_SPECIALIZATIONS_OF_MEMBER_CLASS_TEMPLATES mapping; }; _EXPORT_STD struct layout_right { template - class mapping; + class _NO_SPECIALIZATIONS_OF_MEMBER_CLASS_TEMPLATES mapping; }; _EXPORT_STD struct layout_stride { template - class mapping; + class _NO_SPECIALIZATIONS_OF_MEMBER_CLASS_TEMPLATES mapping; }; template @@ -477,7 +479,8 @@ struct _Maybe_fully_static_extents<_Extents> { }; template -class layout_left::mapping : private _Maybe_fully_static_extents<_Extents> { +class _NO_SPECIALIZATIONS_OF_MEMBER_CLASS_TEMPLATES layout_left::mapping + : private _Maybe_fully_static_extents<_Extents> { public: using extents_type = _Extents; using index_type = extents_type::index_type; @@ -631,7 +634,8 @@ private: }; template -class layout_right::mapping : private _Maybe_fully_static_extents<_Extents> { +class _NO_SPECIALIZATIONS_OF_MEMBER_CLASS_TEMPLATES layout_right::mapping + : private _Maybe_fully_static_extents<_Extents> { public: using extents_type = _Extents; using index_type = extents_type::index_type; @@ -816,8 +820,9 @@ _NODISCARD constexpr pair _Count_dynamic_extents_equal_to_zero_o } template -class layout_stride::mapping : private _Maybe_fully_static_extents<_Extents>, - private _Maybe_empty_array { +class _NO_SPECIALIZATIONS_OF_MEMBER_CLASS_TEMPLATES layout_stride::mapping + : private _Maybe_fully_static_extents<_Extents>, + private _Maybe_empty_array { public: using extents_type = _Extents; using index_type = extents_type::index_type; @@ -1595,6 +1600,7 @@ mdspan(const typename _AccessorType::data_handle_type&, const _MappingType&, con _STD_END // TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") #pragma pop_macro("msvc") #pragma pop_macro("new") diff --git a/stl/inc/memory b/stl/inc/memory index 0a5e8e3833f..d527ead02b3 100644 --- a/stl/inc/memory +++ b/stl/inc/memory @@ -3475,6 +3475,11 @@ public: } _NODISCARD _CONSTEXPR23 add_lvalue_reference_t<_Ty> operator*() const noexcept(noexcept(*_STD declval())) { +#ifdef __cpp_lib_reference_from_temporary + static_assert( + !reference_converts_from_temporary_v, decltype(*_STD declval())>, + "Can't return a temporary object from unique_ptr::operator*(). (N5014 [unique.ptr.single.observers]/1)"); +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ return *_Mypair._Myval2; } @@ -4523,23 +4528,6 @@ _NODISCARD auto inout_ptr(_SmartPtr& _Smart_ptr, _ArgsT&&... _Args) { } } #endif // _HAS_CXX23 - -#if _HAS_TR1_NAMESPACE -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _STD allocate_shared; - using _STD bad_weak_ptr; - using _STD const_pointer_cast; - using _STD dynamic_pointer_cast; - using _STD enable_shared_from_this; - using _STD get_deleter; - using _STD make_shared; - using _STD shared_ptr; - using _STD static_pointer_cast; - using _STD swap; - using _STD weak_ptr; -} // namespace _DEPRECATE_TR1_NAMESPACE tr1 -#endif // _HAS_TR1_NAMESPACE - _STD_END // TRANSITION, non-_Ugly attribute tokens diff --git a/stl/inc/numbers b/stl/inc/numbers index e82ab5f8a70..d1410126ee1 100644 --- a/stl/inc/numbers +++ b/stl/inc/numbers @@ -27,6 +27,7 @@ namespace numbers { "variable template is ill-formed. (N4950 [math.constants]/3)"); }; + // specializations allowed by N5014 [math.constants]/2 for all of these variable templates: _EXPORT_STD template constexpr _Ty e_v = _Invalid<_Ty>{}; _EXPORT_STD template diff --git a/stl/inc/random b/stl/inc/random index 7a033d12e4c..7f0a0e1ca5d 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -24,22 +24,6 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new -#if _HAS_TR1_NAMESPACE -// TRANSITION, GH-183 -#pragma push_macro("discard_block") -#pragma push_macro("linear_congruential") -#pragma push_macro("mersenne_twister") -#pragma push_macro("subtract_with_carry") -#pragma push_macro("uniform_int") -#pragma push_macro("uniform_real") -#undef discard_block -#undef linear_congruential -#undef mersenne_twister -#undef subtract_with_carry -#undef uniform_int -#undef uniform_real -#endif // _HAS_TR1_NAMESPACE - #ifdef _ALLOW_RANDOM_DISTRIBUTION_CONST_OPERATOR #define _DISTRIBUTION_CONST const #else @@ -359,109 +343,13 @@ _NODISCARD _Real generate_canonical(_Gen& _Gx) { // build a floating-point value } } -template -bool _Nrand_for_tr1( - const uint64_t _Rd, const uint64_t _Rx, _Gen& _Gx, _Real& _Val, uint64_t& _Sx_init, uint64_t& _Factor_init) { - // Minimally-constexpr generate_canonical algorithm. Will save work and exit if _Factor would overflow. - _Uint_type _Sx = _Sx_init; - _Uint_type _Factor = _Factor_init; - const auto _Gxmin = (_Gx.min)(); - const auto _Overflow_limit = UINT64_MAX / _Rx; - - _Uint_type _Xx = 0; - _Uint_type _Limit = 0; - bool _Init = false; - for (;;) { - while (_Factor < _Rd) { - if constexpr (is_same_v<_Uint_type, uint64_t>) { - if (_Factor > _Overflow_limit) { - _Sx_init = _Sx; - _Factor_init = _Factor; - return true; - } - } - - _Sx += (_Gx() - _Gxmin) * _Factor; - _Factor *= _Rx; - } - - if (!_Init) { - _Init = true; - _Xx = _Factor / _Rd; - _Limit = _Xx * _Rd; - } - - if (_Sx < _Limit) { - break; - } else { - _Sx = 0; - _Factor = 1; - } - } - - _Val = static_cast<_Real>(static_cast(_Sx / _Xx)); - return false; -} - -template -constexpr bool _Has_static_min_max = false; - -// This checks a requirement of N4981 [rand.req.urng] `concept uniform_random_bit_generator` but doesn't attempt -// to implement the whole concept - we just need to distinguish Standard machinery from tr1 machinery. -template -constexpr bool _Has_static_min_max<_Gen, void_t::value)>> = - true; - template _NODISCARD _Real _Nrand_impl(_Gen& _Gx) { // build a floating-point value from random sequence _RNG_REQUIRE_REALTYPE(_Nrand_impl, _Real); constexpr auto _Digits = static_cast(numeric_limits<_Real>::digits); - if constexpr (_Has_static_min_max<_Gen>) { - return _STD generate_canonical<_Real, _Digits>(_Gx); - } else if constexpr (is_integral_v) { - // TRANSITION, for integral tr1 machinery only; Standard machinery can call generate_canonical directly - const auto _Gxmax = (_Gx.max)(); - const auto _Gxmin = (_Gx.min)(); - _Real _Val{0}; - - if (_Gxmax == UINT64_MAX && _Gxmin == 0) { - // special case when uint64_t can't hold the full URBG range - _Val = static_cast<_Real>(static_cast(_Gx()) >> (64 - _Digits)); - } else { - constexpr auto _Rd = 1ULL << _Digits; - const auto _Rx = static_cast(_Gxmax - _Gxmin) + 1; - uint64_t _Sx = 0; - uint64_t _Factor = 1; - - // Try with 64 bits first, upgrade to 128 if necessary. - const bool _Would_overflow = _Nrand_for_tr1(_Rd, _Rx, _Gx, _Val, _Sx, _Factor); - if (_Would_overflow) { - _Nrand_for_tr1<_Unsigned128>(_Rd, _Rx, _Gx, _Val, _Sx, _Factor); - } - } - - return _STD ldexp(_Val, -static_cast(_Digits)); - } else { - // TRANSITION, the pre-P0952R2 algorithm, for non-integral tr1 machinery only (e.g. subtract_with_carry_01) - const _Real _Gxmin = static_cast<_Real>((_Gx.min)()); - const _Real _Gxmax = static_cast<_Real>((_Gx.max)()); - const _Real _Rx = (_Gxmax - _Gxmin) + _Real{1}; - - const int _Ceil = static_cast(_STD ceil(static_cast<_Real>(_Digits) / _STD log2(_Rx))); - const int _Kx = _Ceil < 1 ? 1 : _Ceil; - - _Real _Ans{0}; - _Real _Factor{1}; - - for (int _Idx = 0; _Idx < _Kx; ++_Idx) { // add in another set of bits - _Ans += (static_cast<_Real>(_Gx()) - _Gxmin) * _Factor; - _Factor *= _Rx; - } - - return _Ans / _Factor; - } + return _STD generate_canonical<_Real, _Digits>(_Gx); } template @@ -673,96 +561,6 @@ private: result_type _Prev; }; -#if _HAS_TR1_NAMESPACE -template -class _DEPRECATE_TR1_RANDOM linear_congruential { // linear congruential random engine -public: - _RNG_REQUIRE_UINTTYPE(linear_congruential, _Uint); - - static_assert(0 == _Mx || (_Ax < _Mx && _Cx < _Mx), "invalid template argument for linear_congruential"); - - using result_type = _Uint; - - static constexpr _Uint multiplier = _Ax; - static constexpr _Uint increment = _Cx; - static constexpr _Uint modulus = _Mx; - - linear_congruential() noexcept // strengthened - : _Prev(_Get_linear_congruential_seed<_Uint, _Cx, _Mx>(1u)) {} - - explicit linear_congruential(_Uint _Xx0) noexcept // strengthened - : _Prev(_Get_linear_congruential_seed<_Uint, _Cx, _Mx>(_Xx0)) {} - - template = 0> - linear_congruential(_Gen& _Seq) : _Prev(_Get_linear_congruential_seed<_Uint, _Cx, _Mx>(_Seq())) {} - - void seed(_Uint _Xx0 = 1u) noexcept /* strengthened */ { - // reset sequence from numeric value - _Prev = _Get_linear_congruential_seed<_Uint, _Cx, _Mx>(_Xx0); - } - - template = 0> - void seed(_Gen& _Seq) { // reset sequence from generator - _Prev = _Get_linear_congruential_seed<_Uint, _Cx, _Mx>(_Seq()); - } - - _NODISCARD _Uint(min)() const noexcept /* strengthened */ { - // return minimum possible generated value - return _Cx == 0; - } - -#pragma warning(push) -#pragma warning(disable : 4309) // truncation of constant value - _NODISCARD _Uint(max)() const noexcept /* strengthened */ { - // return maximum possible generated value - return static_cast<_Uint>(_Mx - 1u); // note 0 wraps around to max - } -#pragma warning(pop) - - _NODISCARD _Uint operator()() noexcept /* strengthened */ { - // return next value - _Prev = _Next_linear_congruential_value<_Uint, _Ax, _Cx, _Mx>(_Prev); - return _Prev; - } - - void discard(unsigned long long _Nskip) noexcept /* strengthened */ { - // discard _Nskip elements - auto _Temp = _Prev; - for (; 0 < _Nskip; --_Nskip) { - _Temp = _Next_linear_congruential_value<_Uint, _Ax, _Cx, _Mx>(_Temp); - } - - _Prev = _Temp; - } - - _NODISCARD friend bool operator==(const linear_congruential& _Lhs, const linear_congruential& _Rhs) noexcept - /* strengthened */ { - return _Lhs._Prev == _Rhs._Prev; - } - -#if !_HAS_CXX20 - _NODISCARD friend bool operator!=(const linear_congruential& _Lhs, const linear_congruential& _Rhs) noexcept - /* strengthened */ { - return _Lhs._Prev != _Rhs._Prev; - } -#endif // !_HAS_CXX20 - - template - friend basic_istream<_Elem, _Traits>& operator>>(basic_istream<_Elem, _Traits>& _Istr, linear_congruential& _Eng) { - return _Istr >> _Eng._Prev; - } - - template - friend basic_ostream<_Elem, _Traits>& operator<<( - basic_ostream<_Elem, _Traits>& _Ostr, const linear_congruential& _Eng) { - return _Ostr << _Eng._Prev; - } - -private: - _Uint _Prev; -}; -#endif // _HAS_TR1_NAMESPACE - template struct _Circ_buf { // holds historical values for generators _Ty _At(size_t _Ix) const noexcept { @@ -825,49 +623,99 @@ struct _Circ_buf { // holds historical values for generators _Ty _Ax[2 * _Nw]; }; -template -class _Swc_base : public _Circ_buf<_Ty, _Rx> { // common bits of subtract_with_carry/_01 +_EXPORT_STD template +class subtract_with_carry_engine : private _Circ_buf<_Ty, _Rx> { +private: + static constexpr _Ty _Mx = static_cast<_Ty>((_Ty{1} << (_Wx - 1)) << 1); + + using _Cy_t = int; + using _UCy_t = unsigned int; + public: + _RNG_REQUIRE_UINTTYPE(subtract_with_carry_engine, _Ty); + + static_assert(0U < _Sx && _Sx < _Rx && 0 < _Wx && _Wx <= numeric_limits<_Ty>::digits, + "invalid template argument for subtract_with_carry_engine"); + + static constexpr size_t word_size = _Wx; + static constexpr size_t short_lag = _Sx; + static constexpr size_t long_lag = _Rx; + using result_type = _Ty; - using _Traits = _Swc_Traits; - using _Mybase = _Circ_buf<_Ty, _Rx>; - using _Seed_t = typename _Swc_Traits::_Seed_t; - static constexpr size_t short_lag = _Sx; - static constexpr size_t long_lag = _Rx; static constexpr uint_least32_t default_seed = 19780503u; - _Swc_base() { - seed(); + subtract_with_carry_engine() { + seed(0u); } - _Swc_base(_Seed_t _Xx0) { + explicit subtract_with_carry_engine(_Ty _Xx0) { seed(_Xx0); } - template = 0> - _Swc_base(_Gen& _Gx) { - seed(_Gx); + template = 0> + explicit subtract_with_carry_engine(_Seed_seq& _Seq) { + seed(_Seq); } - void seed(_Seed_t _Value = 0u, bool _Readcy = false) { // set initial values from specified seed value + void seed(_Ty _Value = 0u) { // set initial values from specified seed value linear_congruential_engine _Lc{ _Value == 0U ? default_seed : static_cast(_Value % 2147483563U)}; - _Reset(_Lc, _Readcy); + + constexpr int _Kx = _Get_wc(); + + for (size_t _Ix = 0; _Ix < _Rx; ++_Ix) { // pack _Kx words + this->_Ax[_Ix] = _Lc(); + for (int _Jx = 1; _Jx < _Kx; ++_Jx) { + this->_Ax[_Ix] |= static_cast<_Ty>(_Lc()) << (32 * _Jx); + } + } + + _Carry = _Reduce(); + this->_Idx = _Rx; } - template , int> = 0> - void seed(_Gen& _Gx, bool _Readcy = false) { // set initial values from range - _Reset(_Gx, _Readcy); + template = 0> + void seed(_Seed_seq& _Seq) { // reset sequence from seed sequence + constexpr int _Kx = (8 * sizeof(_Ty) + 31) / 32; + unsigned long _Arr[_Kx * _Rx]; + _Seq.generate(_STD begin(_Arr), _STD end(_Arr)); + + size_t _Idx0 = 0; + for (size_t _Ix = 0; _Ix < _Rx; ++_Ix, _Idx0 += _Kx) { // pack _Kx words + this->_Ax[_Ix] = _Arr[_Idx0]; + for (int _Jx = 1; _Jx < _Kx; ++_Jx) { + this->_Ax[_Ix] |= static_cast<_Ty>(_Arr[_Idx0 + _Jx]) << (32 * _Jx); + } + + if constexpr (_Mx != 0) { + this->_Ax[_Ix] %= _Mx; + } + } + + _Carry = _Reduce(); + this->_Idx = _Rx; } - _NODISCARD result_type(min)() const noexcept /* strengthened */ { + _NODISCARD static constexpr _Ty(min)() noexcept /* strengthened */ { return 0; } - _NODISCARD result_type(max)() const noexcept /* strengthened */ { - return _Swc_Traits::_Max; + _NODISCARD static constexpr _Ty(max)() noexcept /* strengthened */ { + return _Mx - 1; + } + + _NODISCARD friend bool operator==( + const subtract_with_carry_engine& _Left, const subtract_with_carry_engine& _Right) noexcept /* strengthened */ { + return _Left._Equals(_Right) && _Left._Carry == _Right._Carry; + } + +#if !_HAS_CXX20 + _NODISCARD friend bool operator!=( + const subtract_with_carry_engine& _Left, const subtract_with_carry_engine& _Right) noexcept /* strengthened */ { + return !(_Left == _Right); } +#endif // !_HAS_CXX20 _NODISCARD result_type operator()() noexcept /* strengthened */ { const auto _Ix = 2 * _Rx <= this->_Idx ? 0 : this->_Idx; @@ -883,50 +731,57 @@ public: return this->_Ax[_Ix]; } - void discard(unsigned long long _Nskip) { // discard _Nskip elements + void discard(unsigned long long _Nskip) { for (; 0 < _Nskip; --_Nskip) { (void) (*this)(); } } - _NODISCARD friend bool operator==(const _Swc_base& _Left, const _Swc_base& _Right) noexcept /* strengthened */ { - return static_cast(_Left)._Equals(_Right) && _Left._Carry == _Right._Carry; - } + template + friend basic_ostream<_Elem, _Traits>& operator<<( + basic_ostream<_Elem, _Traits>& _Ostr, const subtract_with_carry_engine& _Eng) { + const auto _Save_flags = _Ostr.flags(ios_base::dec | ios_base::left); + const auto _Save_fill = _Ostr.fill(' '); -#if !_HAS_CXX20 - _NODISCARD friend bool operator!=(const _Swc_base& _Left, const _Swc_base& _Right) noexcept /* strengthened */ { - return !(_Left == _Right); - } -#endif // !_HAS_CXX20 + for (size_t _Ix = 0; _Ix < _Rx; ++_Ix) { + _Ostr << _Eng._At(_Ix) << ' '; + } - template - friend basic_istream<_Elem, _Traits>& operator>>( - basic_istream<_Elem, _Traits>& _Istr, _Swc_base& _Eng) { // read state from _Istr - _Wrap_istream<_Elem, _Traits, typename _Swc_Traits::_Seed_t> _Gen(_Istr); - _Eng.seed(_Gen, true); - return _Istr; - } + _Ostr << _Eng._Carry; - template - friend basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, - const _Swc_base& _Eng) { // write state to _Ostr - _Swc_base::_Traits::_Write(_Ostr, _Eng, _Eng._Carry); + _Ostr.flags(_Save_flags); + _Ostr.fill(_Save_fill); return _Ostr; } template - basic_ostream<_Elem, _Traits>& _Write_full(basic_ostream<_Elem, _Traits>& _Ostr) const { // write state to _Ostr - _Swc_Traits::_Write_full(_Ostr, *this, _Carry); - return _Ostr; - } + friend basic_istream<_Elem, _Traits>& operator>>( + basic_istream<_Elem, _Traits>& _Istr, subtract_with_carry_engine& _Eng) { + constexpr auto _Nx = long_lag; + result_type _Buffer[_Nx]; + _Cy_t _Carry_buf; + const auto _Save_flags = _Istr.flags(ios_base::dec | ios_base::skipws); + for (auto& _Val : _Buffer) { + _Istr >> _Val; + } -protected: - template - void _Reset(_Gen& _Gx, bool _Readcy) { // reset sequence - _Carry = _Swc_Traits::_Reset(_Gx, this->_Ax, _Readcy); - this->_Idx = _Rx; + _Istr >> _Carry_buf; + if (_Istr) { + for (size_t _Ix = 0; _Ix < _Nx; ++_Ix) { + _Eng._Ax[_Ix] = _Buffer[_Ix]; + } + + _Eng._Carry = _Carry_buf; + _Eng._Idx = _Nx; + } else { + _Istr.setstate(ios_base::failbit); + } + + _Istr.flags(_Save_flags); + return _Istr; } +private: void _Setx(size_t _Ix, _Ty _Xis, _Ty _Xir) noexcept { // update _Ax[_Ix] and _Carry bool _Underflowed = false; _Ty _Newx = _Xis; @@ -935,14 +790,14 @@ protected: } _Newx -= _Xir; - if (_Newx < static_cast(_Carry)) { + if (_Newx < static_cast<_UCy_t>(_Carry)) { _Underflowed = true; } _Newx -= _Carry; - if (_Underflowed) { // underflowed, so add _Mod - _Newx += _Swc_Traits::_Mod; - _Carry = _Swc_Traits::_Cy; + if (_Underflowed) { // underflowed, so add _Mx + _Newx += _Mx; + _Carry = 1; } else { _Carry = 0; } @@ -950,21 +805,6 @@ protected: this->_Ax[_Ix] = _Newx; } - typename _Swc_Traits::_Cy_t _Carry; -}; - -template -struct _Swc_traits { // traits for subtract_with_carry generator - using _Cy_t = int; - using _UCy_t = unsigned int; - using _Mod_t = _Ty; - using _Seed_t = _Ty; - - static constexpr _Cy_t _Cy = 1; - static constexpr _Mod_t _Mod = _Mx; - static constexpr _Ty _Max = static_cast<_Ty>(_Mx - 1); - -private: static constexpr int _Get_wc() noexcept { // compute number of 32-bit words per element if constexpr (_Mx == 0) { return (8 * sizeof(_Ty) + 31) / 32; @@ -975,509 +815,61 @@ private: } } -public: - template - static _Cy_t _Reset(_Gen& _Gx, _Ty* _Ax, bool _Readcy) { // set initial values of _Ax from generator _Gx - // return value of _Cy from range if _Readcy is true, - // otherwise compute from last value - constexpr int _Kx = _Get_wc(); - - for (size_t _Ix = 0; _Ix < _Nw; ++_Ix) { // pack _Kx words - _Ax[_Ix] = _Gx(); - for (int _Jx = 1; _Jx < _Kx; ++_Jx) { - _Ax[_Ix] |= static_cast<_Ty>(_Gx()) << (32 * _Jx); - } - } - - _Cy_t _Ans = _Reduce(_Ax); - if (!_Readcy) { - return _Ans; - } else { - return static_cast<_Cy_t>(_Gx()); // TRANSITION, investigate this conversion - } - } - #pragma warning(push) #pragma warning(disable : 4724) // potential mod by 0 - static _Cy_t _Reduce(_Ty* _Ax) noexcept { // reduce values to allowed range + _Cy_t _Reduce() noexcept { // reduce values to allowed range if constexpr (_Mx != 0) { - for (size_t _Ix = 0; _Ix < _Nw; ++_Ix) { - _Ax[_Ix] = _Ax[_Ix] % _Mx; + for (size_t _Ix = 0; _Ix < _Rx; ++_Ix) { + this->_Ax[_Ix] %= _Mx; } } - return _Ax[_Nw - 1] == 0; + return this->_Ax[_Rx - 1] == 0; } #pragma warning(pop) - template - static void _Write( - basic_ostream<_Elem, _Traits>& _Ostr, const _Circ_buf<_Ty, _Nw>& _Buf, _Cy_t _Cy) { // write state to _Ostr - constexpr int _Kx = _Get_wc(); - - for (size_t _Ix = 0; _Ix < _Nw; ++_Ix) { - for (int _Jx = 0; _Jx < _Kx; ++_Jx) { // unpack into _Kx words - const unsigned int _Word = static_cast(_Buf._At(_Ix) >> (_Jx * 32)); - _Ostr << _Word << ' '; - } - } - - _Ostr << _Cy; - } - - template - static void _Write_full( - basic_ostream<_Elem, _Traits>& _Ostr, const _Circ_buf<_Ty, _Nw>& _Buf, _Cy_t _Cy) { // write state to _Ostr - for (size_t _Ix = 0; _Ix < _Nw; ++_Ix) { - _Ostr << _Buf._At(_Ix) << ' '; - } - - _Ostr << _Cy; - } + _Cy_t _Carry; }; -#if _HAS_TR1_NAMESPACE -template -class _DEPRECATE_TR1_RANDOM subtract_with_carry - : public _Swc_base<_Ty, _Sx, _Rx, _Swc_traits<_Ty, _Mx, _Rx>> { // subtract_with_carry generator -public: - using _Mybase = _Swc_base<_Ty, _Sx, _Rx, _Swc_traits<_Ty, _Mx, _Rx>>; +_EXPORT_STD template +class mersenne_twister_engine : private _Circ_buf<_Ty, _Nx> { +private: + static constexpr unsigned long long _Max = (((1ULL << (_Wx - 1)) - 1) << 1) + 1; - static constexpr _Ty modulus = _Mx; +public: + _RNG_REQUIRE_UINTTYPE(mersenne_twister_engine, _Ty); - using _Mybase::default_seed; + static_assert(0 < _Mx && _Mx <= _Nx && 2U < _Wx && _Rx <= _Wx && _Ux <= _Wx && _Sx <= _Wx && _Tx <= _Wx + && _Lx <= _Wx && _Wx <= numeric_limits<_Ty>::digits && _Px <= _Max && _Bx <= _Max && _Cx <= _Max + && _Dx <= _Max && _Fx <= _Max, + "invalid template argument for mersenne_twister_engine"); - subtract_with_carry() : _Mybase(0u) {} + using result_type = _Ty; - explicit subtract_with_carry(_Ty _Xx0) : _Mybase(_Xx0) {} + static constexpr size_t word_size = _Wx; + static constexpr size_t state_size = _Nx; + static constexpr size_t shift_size = _Mx; + static constexpr size_t mask_bits = _Rx; + static constexpr _Ty xor_mask = _Px; + static constexpr size_t tempering_u = _Ux; + static constexpr _Ty tempering_d = _Dx; + static constexpr size_t tempering_s = _Sx; + static constexpr _Ty tempering_b = _Bx; + static constexpr size_t tempering_t = _Tx; + static constexpr _Ty tempering_c = _Cx; + static constexpr size_t tempering_l = _Lx; + static constexpr _Ty initialization_multiplier = _Fx; - template = 0> - subtract_with_carry(_Gen& _Gx) : _Mybase(_Gx) {} -}; -#endif // _HAS_TR1_NAMESPACE + static constexpr result_type default_seed = 5489U; -_EXPORT_STD template -class subtract_with_carry_engine - : private _Swc_base<_Ty, _Sx, _Rx, _Swc_traits<_Ty, static_cast<_Ty>((_Ty{1} << (_Wx - 1)) << 1), _Rx>> { -private: - static constexpr _Ty _Mx = static_cast<_Ty>((_Ty{1} << (_Wx - 1)) << 1); + mersenne_twister_engine() { + seed(default_seed); + } - using _Traits = _Swc_traits<_Ty, _Mx, _Rx>; - using _Mybase = _Swc_base<_Ty, _Sx, _Rx, _Traits>; - -public: - _RNG_REQUIRE_UINTTYPE(subtract_with_carry_engine, _Ty); - - static_assert(0U < _Sx && _Sx < _Rx && 0 < _Wx && _Wx <= numeric_limits<_Ty>::digits, - "invalid template argument for subtract_with_carry_engine"); - - static constexpr size_t word_size = _Wx; - static constexpr size_t short_lag = _Sx; - static constexpr size_t long_lag = _Rx; - - using result_type = _Ty; - - using _Mybase::default_seed; - - subtract_with_carry_engine() : _Mybase(0u) {} - - explicit subtract_with_carry_engine(_Ty _Xx0) : _Mybase(_Xx0) {} - - template = 0> - explicit subtract_with_carry_engine(_Seed_seq& _Seq) : _Mybase(0u) { - seed(_Seq); - } - - void seed(_Ty _Value = 0u) { // set initial values from specified seed value - _Mybase::seed(_Value); - } - - template = 0> - void seed(_Seed_seq& _Seq) { // reset sequence from seed sequence - constexpr int _Kx = (8 * sizeof(_Ty) + 31) / 32; - unsigned long _Arr[_Kx * _Rx]; - _Seq.generate(_STD begin(_Arr), _STD end(_Arr)); - - size_t _Idx0 = 0; - for (size_t _Ix = 0; _Ix < _Rx; ++_Ix, _Idx0 += _Kx) { // pack _Kx words - this->_Ax[_Ix] = _Arr[_Idx0]; - for (int _Jx = 1; _Jx < _Kx; ++_Jx) { - this->_Ax[_Ix] |= static_cast<_Ty>(_Arr[_Idx0 + _Jx]) << (32 * _Jx); - } - - if constexpr (_Traits::_Mod != 0) { - this->_Ax[_Ix] %= _Traits::_Mod; - } - } - - this->_Carry = _Traits::_Reduce(this->_Ax); - this->_Idx = _Rx; - } - - _NODISCARD static constexpr _Ty(min)() noexcept /* strengthened */ { - return 0; - } - - _NODISCARD static constexpr _Ty(max)() noexcept /* strengthened */ { - return _Mx - 1; - } - - _NODISCARD friend bool operator==( - const subtract_with_carry_engine& _Left, const subtract_with_carry_engine& _Right) noexcept /* strengthened */ { - return static_cast(_Left) == static_cast(_Right); - } - -#if !_HAS_CXX20 - _NODISCARD friend bool operator!=( - const subtract_with_carry_engine& _Left, const subtract_with_carry_engine& _Right) noexcept /* strengthened */ { - return !(_Left == _Right); - } -#endif // !_HAS_CXX20 - - _NODISCARD result_type operator()() { - return _Mybase::operator()(); - } - - void discard(unsigned long long _Nskip) { - _Mybase::discard(_Nskip); - } - - template - friend basic_ostream<_Elem, _Traits>& operator<<( - basic_ostream<_Elem, _Traits>& _Ostr, const subtract_with_carry_engine& _Eng) { - const auto _Save_flags = _Ostr.flags(ios_base::dec | ios_base::left); - const auto _Save_fill = _Ostr.fill(' '); - _Eng._Write_full(_Ostr); - _Ostr.flags(_Save_flags); - _Ostr.fill(_Save_fill); - return _Ostr; - } - - template - friend basic_istream<_Elem, _Traits>& operator>>( - basic_istream<_Elem, _Traits>& _Istr, subtract_with_carry_engine& _Eng) { - constexpr auto _Nx = long_lag; - result_type _Buffer[_Nx]; - typename _Mybase::_Traits::_Cy_t _Carry_buf; - const auto _Save_flags = _Istr.flags(ios_base::dec | ios_base::skipws); - for (auto& _Val : _Buffer) { - _Istr >> _Val; - } - - _Istr >> _Carry_buf; - if (_Istr) { - for (size_t _Ix = 0; _Ix < _Nx; ++_Ix) { - _Eng._Ax[_Ix] = _Buffer[_Ix]; - } - - _Eng._Carry = _Carry_buf; - _Eng._Idx = _Nx; - } else { - _Istr.setstate(ios_base::failbit); - } - - _Istr.flags(_Save_flags); - return _Istr; - } -}; - -#if _HAS_TR1_NAMESPACE -constexpr double _Cx_exp2(const int _Exp) noexcept { - double _Ret = 1.0; - for (int _Count = _Exp; _Count > 0; --_Count) { - _Ret *= 2.0; - } - for (int _Count = _Exp; _Count < 0; ++_Count) { - _Ret *= 0.5; - } - - return _Ret; -} - -template -struct _Swc_01_traits { // traits for subtract_with_carry_01 generator - using _Cy_t = _Ty; - using _UCy_t = _Ty; - using _Mod_t = _Ty; - using _Seed_t = unsigned int; - - static constexpr _Cy_t _Cy = static_cast<_Cy_t>(_Cx_exp2(static_cast(-static_cast(_Wx)))); - static constexpr _Mod_t _Mod = 1; - static constexpr _Ty _Max = 1; - static constexpr int _Nwords = (_Wx + 31) / 32; - - template - static _Cy_t _Reset(_Gen& _Gx, _Ty* _Ax, bool _Readcy) { // set initial values of _Ax from generator _Gx - // return value of _Cy from range if _Readcy is true, - // otherwise from last value - for (size_t _Ix = 0; _Ix < _Rx; ++_Ix) { // read values - _Ty _Factor = 1; - _Ty _Val = 0; - for (int _Jx = 0; _Jx < _Nwords - 1; ++_Jx) { // read components of value - _Factor /= static_cast<_Ty>(_Two32); - _Val += _Gx() * _Factor; - } - _Ty _Temp = (static_cast(_Gx()) & _Mask) / _Scale1; - _Val += (_Temp - static_cast(_Temp)) * _Factor; - _Ax[_Ix] = _Val; - } - if (!_Readcy) { - return _Ax[_Rx - 1] != 0 ? 0 : _Cy; - } else { - return _Gx() == 0 ? 0 : _Cy; - } - } - - template - static void _Write( - basic_ostream<_Elem, _Traits>& _Ostr, const _Circ_buf<_Ty, _Rx>& _Buf, _Cy_t _Cy) { // write state to _Ostr - for (size_t _Ix = 0; _Ix < _Rx; ++_Ix) { // write values - _Ty _Val = _Buf._At(_Ix); - unsigned long _Temp; - for (int _Jx = 0; _Jx < _Nwords - 1; ++_Jx) { // write components of value - _Val *= static_cast<_Ty>(_Two32); - _Temp = static_cast(_Val); - _Val -= _Temp; - _Ostr << _Temp << ' '; - } - _Temp = static_cast(_Val * _Scale1); - _Ostr << _Temp << ' '; - } - _Ostr << (_Cy ? 1 : 0); - } - -private: - static constexpr _Ty _Scale1 = static_cast<_Ty>(_Cx_exp2(_Wx % 32)); - static constexpr unsigned long _Mask = ~((~0UL) << (_Wx % 32)); -}; - -template -class _DEPRECATE_TR1_NAMESPACE subtract_with_carry_01 - : public _Swc_base<_Ty, _Sx, _Rx, _Swc_01_traits<_Ty, _Wx, _Rx>> { // subtract_with_carry_01 generator -public: - static constexpr size_t word_size = _Wx; - - using _Mybase = _Swc_base<_Ty, _Sx, _Rx, _Swc_01_traits<_Ty, _Wx, _Rx>>; - - subtract_with_carry_01() : _Mybase() {} - - explicit subtract_with_carry_01(typename _Mybase::_Seed_t _Value) : _Mybase(_Value) {} - - template = 0> - subtract_with_carry_01(_Gen& _Gx) : _Mybase(_Gx) {} -}; - -template -class _DEPRECATE_TR1_RANDOM mersenne_twister : public _Circ_buf<_Ty, _Nx> { // mersenne twister generator -public: - using result_type = _Ty; - - static constexpr int word_size = _Wx; - static constexpr int state_size = _Nx; - static constexpr int shift_size = _Mx; - static constexpr int mask_bits = _Rx; - static constexpr _Ty parameter_a = _Px; - static constexpr int output_u = _Ux; - static constexpr int output_s = _Sx; - static constexpr _Ty output_b = _Bx; - static constexpr int output_t = _Tx; - static constexpr _Ty output_c = _Cx; - static constexpr int output_l = _Lx; - - static constexpr _Ty default_seed = 5489U; - - mersenne_twister() : _Dxval(_WMSK) { - seed(default_seed, static_cast<_Ty>(1812433253)); - } - - explicit mersenne_twister(_Ty _Xx0, _Ty _Dxarg = _WMSK, _Ty _Fxarg = static_cast<_Ty>(1812433253)) - : _Dxval(_Dxarg) { - seed(_Xx0, _Fxarg); - } - - template = 0> - explicit mersenne_twister(_Gen& _Gx) : _Dxval(_WMSK) { - seed(_Gx); - } - - void seed(_Ty _Xx0 = default_seed, _Ty _Fx = static_cast<_Ty>(1812433253)) { - // set initial values from specified value - _Ty _Prev = this->_Ax[0] = _Xx0 & _WMSK; - for (size_t _Ix = 1; _Ix < _Nx; ++_Ix) { - _Prev = this->_Ax[_Ix] = (_Ix + _Fx * (_Prev ^ (_Prev >> (_Wx - 2)))) & _WMSK; - } - - this->_Idx = _Nx; - } - - template = 0> - void seed(_Gen& _Gx, bool = false) { // set initial values from range - for (size_t _Ix = 0; _Ix < _Nx; ++_Ix) { - this->_Ax[_Ix] = _Gx() & _WMSK; - } - - this->_Idx = _Nx; - } - - _NODISCARD friend bool operator==(const mersenne_twister& _Left, const mersenne_twister& _Right) noexcept - /* strengthened */ { - return _Left._Equals(_Right); - } - -#if !_HAS_CXX20 - _NODISCARD friend bool operator!=(const mersenne_twister& _Left, const mersenne_twister& _Right) noexcept - /* strengthened */ { - return !_Left._Equals(_Right); - } -#endif // !_HAS_CXX20 - - template - friend basic_istream<_Elem, _S_Traits>& operator>>(basic_istream<_Elem, _S_Traits>& _Istr, - mersenne_twister& _Eng) { // read state from _Istr - _Wrap_istream<_Elem, _S_Traits, _Ty> _Gen(_Istr); - _Eng.seed(_Gen); - return _Istr; - } - - template - friend basic_ostream<_Elem, _S_Traits>& operator<<(basic_ostream<_Elem, _S_Traits>& _Ostr, - const mersenne_twister& _Eng) { // write state to _Ostr - _Ostr << _Eng._At(0); - - for (size_t _Ix = 1; _Ix < mersenne_twister::state_size; ++_Ix) { - _Ostr << ' ' << _Eng._At(_Ix); - } - - return _Ostr; - } - - _NODISCARD result_type(min)() const noexcept { - return 0; - } - - _NODISCARD result_type(max)() const noexcept { - return _WMSK; - } - - _NODISCARD result_type operator()() { - if (this->_Idx == _Nx) { - _Refill_upper(); - } else if (2 * _Nx <= this->_Idx) { - _Refill_lower(); - } - - _Ty _Res = this->_Ax[this->_Idx++] & _WMSK; - _Res ^= (_Res >> _Ux) & _Dxval; - _Res ^= (_Res << _Sx) & _Bx; - _Res ^= (_Res << _Tx) & _Cx; - _Res ^= (_Res & _WMSK) >> _Lx; - return _Res; - } - - void discard(unsigned long long _Nskip) { // discard _Nskip elements - for (; 0 < _Nskip; --_Nskip) { - (void) (*this)(); - } - } - -protected: - _Post_satisfies_(this->_Idx == 0) void _Refill_lower() { - // compute values for the lower half of the history array - constexpr size_t _Wrap_bound_one = _Nx - _One_mod_n; - constexpr size_t _Wrap_bound_m = _Nx - _M_mod_n; - - if constexpr (_M_mod_n == 0) { - for (size_t _Ix = 0; _Ix < _Wrap_bound_one; ++_Ix) { // fill in values - const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix + _Nx + _One_mod_n] & _LMSK); - this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix + _Nx + _M_mod_n]; - } - - if constexpr (_One_mod_n == 1) { // fill in _Ax[_Nx - 1] - constexpr size_t _Ix = _Wrap_bound_one; - - const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix - _Nx + _One_mod_n] & _LMSK); - this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix + _Nx + _M_mod_n]; - } - } else { - for (size_t _Ix = 0; _Ix < _Wrap_bound_m; ++_Ix) { // fill in lower region - const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix + _Nx + _One_mod_n] & _LMSK); - this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix + _Nx + _M_mod_n]; - } - - for (size_t _Ix = _Wrap_bound_m; _Ix < _Wrap_bound_one; ++_Ix) { - // fill in upper region (avoids modulus operation) - const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix + _Nx + _One_mod_n] & _LMSK); - this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix - _Nx + _M_mod_n]; - } - - if constexpr (_One_mod_n == 1) { // fill in _Ax[_Nx - 1] - constexpr size_t _Ix = _Wrap_bound_one; - - const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix - _Nx + _One_mod_n] & _LMSK); - this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix - _Nx + _M_mod_n]; - } - } - - this->_Idx = 0; - } - - void _Refill_upper() { // compute values for the upper half of the history array - for (size_t _Ix = _Nx; _Ix < 2 * _Nx; ++_Ix) { // fill in values - const _Ty _Tmp = (this->_Ax[_Ix - _Nx] & _HMSK) | (this->_Ax[_Ix - _Nx + _One_mod_n] & _LMSK); - this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix - _Nx + _M_mod_n]; - } - } - - _Ty _Dxval; - - static constexpr _Ty _WMSK = ~((~_Ty{0} << (_Wx - 1)) << 1); - static constexpr _Ty _HMSK = (_WMSK << _Rx) & _WMSK; - static constexpr _Ty _LMSK = ~_HMSK & _WMSK; - - static constexpr int _One_mod_n = 1 % _Nx; // either 0 or 1 - static constexpr int _M_mod_n = _Mx % _Nx; -}; -#endif // _HAS_TR1_NAMESPACE - -_EXPORT_STD template -class mersenne_twister_engine : private _Circ_buf<_Ty, _Nx> { -private: - static constexpr unsigned long long _Max = (((1ULL << (_Wx - 1)) - 1) << 1) + 1; - -public: - _RNG_REQUIRE_UINTTYPE(mersenne_twister_engine, _Ty); - - static_assert(0 < _Mx && _Mx <= _Nx && 2U < _Wx && _Rx <= _Wx && _Ux <= _Wx && _Sx <= _Wx && _Tx <= _Wx - && _Lx <= _Wx && _Wx <= numeric_limits<_Ty>::digits && _Px <= _Max && _Bx <= _Max && _Cx <= _Max - && _Dx <= _Max && _Fx <= _Max, - "invalid template argument for mersenne_twister_engine"); - - using result_type = _Ty; - - static constexpr size_t word_size = _Wx; - static constexpr size_t state_size = _Nx; - static constexpr size_t shift_size = _Mx; - static constexpr size_t mask_bits = _Rx; - static constexpr _Ty xor_mask = _Px; - static constexpr size_t tempering_u = _Ux; - static constexpr _Ty tempering_d = _Dx; - static constexpr size_t tempering_s = _Sx; - static constexpr _Ty tempering_b = _Bx; - static constexpr size_t tempering_t = _Tx; - static constexpr _Ty tempering_c = _Cx; - static constexpr size_t tempering_l = _Lx; - static constexpr _Ty initialization_multiplier = _Fx; - - static constexpr result_type default_seed = 5489U; - - mersenne_twister_engine() { - seed(default_seed); - } - - explicit mersenne_twister_engine(result_type _Xx0) { - seed(_Xx0); - } + explicit mersenne_twister_engine(result_type _Xx0) { + seed(_Xx0); + } template = 0> explicit mersenne_twister_engine(_Seed_seq& _Seq) { @@ -1607,144 +999,46 @@ private: const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix - _Nx + _One_mod_n] & _LMSK); this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix + _Nx + _M_mod_n]; - } - } else { - for (size_t _Ix = 0; _Ix < _Wrap_bound_m; ++_Ix) { // fill in lower region - const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix + _Nx + _One_mod_n] & _LMSK); - this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix + _Nx + _M_mod_n]; - } - - for (size_t _Ix = _Wrap_bound_m; _Ix < _Wrap_bound_one; ++_Ix) { - // fill in upper region (avoids modulus operation) - const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix + _Nx + _One_mod_n] & _LMSK); - this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix - _Nx + _M_mod_n]; - } - - if constexpr (_One_mod_n == 1) { // fill in _Ax[_Nx - 1] - constexpr size_t _Ix = _Wrap_bound_one; - - const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix - _Nx + _One_mod_n] & _LMSK); - this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix - _Nx + _M_mod_n]; - } - } - - this->_Idx = 0; - } - - void _Refill_upper() { // compute values for the upper half of the history array - for (size_t _Ix = _Nx; _Ix < 2 * _Nx; ++_Ix) { // fill in values - const _Ty _Tmp = (this->_Ax[_Ix - _Nx] & _HMSK) | (this->_Ax[_Ix - _Nx + _One_mod_n] & _LMSK); - this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix - _Nx + _M_mod_n]; - } - } - - _Ty _Dxval{_Dx}; // TRANSITION, ABI: _Dxval must be initialized to _Dx but is unused by the current implementation - - static constexpr _Ty _WMSK = ~((~_Ty{0} << (_Wx - 1)) << 1); - static constexpr _Ty _HMSK = (_WMSK << _Rx) & _WMSK; - static constexpr _Ty _LMSK = ~_HMSK & _WMSK; - - static constexpr int _One_mod_n = 1 % _Nx; // either 0 or 1 - static constexpr int _M_mod_n = _Mx % _Nx; -}; - -#if _HAS_TR1_NAMESPACE -template -class _DEPRECATE_TR1_RANDOM discard_block { // discard_block compound engine -public: -#if _HAS_TR1_NAMESPACE - using base_type _DEPRECATE_TR1_NAMESPACE = _Engine; // TR1-only typedef -#endif // _HAS_TR1_NAMESPACE - - using result_type = typename _Engine::result_type; - - static constexpr int block_size = _Px; - static constexpr int used_block = _Rx; - - discard_block() : _Eng(), _Nx(0) {} - - explicit discard_block(const _Engine& _Ex) : _Eng(_Ex), _Nx(0) {} - - explicit discard_block(_Engine&& _Ex) : _Eng(_STD move(_Ex)), _Nx(0) {} - - explicit discard_block(result_type _Seed) : _Eng(_Seed), _Nx(0) {} - - template = 0> - explicit discard_block(_Seed_seq& _Seq) : _Eng(_Seq), _Nx(0) {} - - void seed() { // seed engine from default value - _Eng.seed(); - _Nx = 0; - } - - void seed(result_type _Xx0) { // seed engine from specified value - _Eng.seed(_Xx0); - _Nx = 0; - } - - template = 0> - void seed(_Seed_seq& _Seq) { // seed engine from seed sequence - _Eng.seed(_Seq); - _Nx = 0; - } - - _NODISCARD const _Engine& base() const noexcept { - return _Eng; - } - - _NODISCARD result_type(min)() const { - return (_Eng.min)(); - } - - _NODISCARD result_type(max)() const { - return (_Eng.max)(); - } + } + } else { + for (size_t _Ix = 0; _Ix < _Wrap_bound_m; ++_Ix) { // fill in lower region + const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix + _Nx + _One_mod_n] & _LMSK); + this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix + _Nx + _M_mod_n]; + } - _NODISCARD result_type operator()() { - if (_Rx <= _Nx) { // discard values - while (_Nx++ < _Px) { - (void) _Eng(); + for (size_t _Ix = _Wrap_bound_m; _Ix < _Wrap_bound_one; ++_Ix) { + // fill in upper region (avoids modulus operation) + const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix + _Nx + _One_mod_n] & _LMSK); + this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix - _Nx + _M_mod_n]; } - _Nx = 0; - } - ++_Nx; - return _Eng(); - } + if constexpr (_One_mod_n == 1) { // fill in _Ax[_Nx - 1] + constexpr size_t _Ix = _Wrap_bound_one; - void discard(unsigned long long _Nskip) { // discard _Nskip elements - for (; 0 < _Nskip; --_Nskip) { - (void) (*this)(); + const _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[_Ix - _Nx + _One_mod_n] & _LMSK); + this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix - _Nx + _M_mod_n]; + } } - } - _NODISCARD friend bool operator==(const discard_block& _Left, const discard_block& _Right) { - return _Left._Eng == _Right._Eng && _Left._Nx == _Right._Nx; + this->_Idx = 0; } -#if !_HAS_CXX20 - _NODISCARD friend bool operator!=(const discard_block& _Left, const discard_block& _Right) { - return !(_Left == _Right); + void _Refill_upper() { // compute values for the upper half of the history array + for (size_t _Ix = _Nx; _Ix < 2 * _Nx; ++_Ix) { // fill in values + const _Ty _Tmp = (this->_Ax[_Ix - _Nx] & _HMSK) | (this->_Ax[_Ix - _Nx + _One_mod_n] & _LMSK); + this->_Ax[_Ix] = (_Tmp >> 1) ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix - _Nx + _M_mod_n]; + } } -#endif // !_HAS_CXX20 - template - friend basic_istream<_Elem, _Traits>& operator>>( - basic_istream<_Elem, _Traits>& _Istr, discard_block& _Eng) { // read state from _Istr - return _Istr >> _Eng._Eng >> _Eng._Nx; - } + _Ty _Dxval{_Dx}; // TRANSITION, ABI: _Dxval must be initialized to _Dx but is unused by the current implementation - template - friend basic_ostream<_Elem, _Traits>& operator<<( - basic_ostream<_Elem, _Traits>& _Ostr, const discard_block& _Eng) { // write state to _Ostr - return _Ostr << _Eng._Eng << ' ' << _Eng._Nx; - } + static constexpr _Ty _WMSK = ~((~_Ty{0} << (_Wx - 1)) << 1); + static constexpr _Ty _HMSK = (_WMSK << _Rx) & _WMSK; + static constexpr _Ty _LMSK = ~_HMSK & _WMSK; -private: - _Engine _Eng; - int _Nx; + static constexpr int _One_mod_n = 1 % _Nx; // either 0 or 1 + static constexpr int _M_mod_n = _Mx % _Nx; }; -#endif // _HAS_TR1_NAMESPACE _EXPORT_STD template class discard_block_engine { @@ -1900,29 +1194,27 @@ public: } _NODISCARD result_type operator()() { - size_t _Idx = 0; - result_type _Res = 0; result_type _Mask = ((result_type{1} << (_Wx0 - 1)) << 1) - 1; _Eres _Val; + do { // get a small enough value + _Val = _Eng() - (_Engine::min) (); + } while (_Val > _Yx0); + result_type _Res = static_cast(_Val) & _Mask; + + size_t _Idx = 1; for (; _Idx < _Nx0; ++_Idx) { // pack _Wx0-bit values - for (;;) { // get a small enough value + do { _Val = _Eng() - (_Engine::min) (); - if (_Val <= _Yx0) { - break; - } - } + } while (_Val > _Yx0); _Res = _Res << _Wx0 | (static_cast(_Val) & _Mask); } _Mask = _Mask << 1 | 1; for (; _Idx < _Nx; ++_Idx) { // pack _Wx0+1-bit values - for (;;) { // get a small enough value + do { _Val = _Eng() - (_Engine::min) (); - if (_Val <= _Yx1) { - break; - } - } + } while (_Val > _Yx1); _Res = _Res << (_Wx0 + 1) | (static_cast(_Val) & _Mask); } return _Res; @@ -1974,8 +1266,14 @@ private: _Nx = (_Wx + _Mx - 1) / _Mx + _Nfix; // trial _Nx _Wx0 = _Wx / _Nx; _Nx0 = _Nx - _Wx % _Nx; - _Yx0 = (_Rx >> _Wx0) << _Wx0; - _Yx1 = (((_Rx >> _Wx0) >> 1) << _Wx0) << 1; + if (_Wx0 < sizeof(_Eres) * CHAR_BIT) { + _Yx0 = (_Rx >> _Wx0) << _Wx0; + _Yx1 = (((_Rx >> _Wx0) >> 1) << _Wx0) << 1; + } else { + _Yx0 = 0; + _Yx1 = 0; + } + if (_Nfix == 1 || _Rx - _Yx0 <= _Yx0 / _Nx) { break; // also works if _Rx == 0 (_Mx == all bits) } @@ -1992,395 +1290,128 @@ private: _Eres _Yx1; // max value for larger packing word }; -_EXPORT_STD template -class shuffle_order_engine { // shuffle_order_engine compound engine -public: - static_assert(0 < _Kx, "invalid template argument for shuffle_order_engine"); - - using result_type = typename _Engine::result_type; - - static constexpr size_t table_size = _Kx; - - shuffle_order_engine() { - _Init(); - } - - explicit shuffle_order_engine(const _Engine& _Ex) : _Eng(_Ex) { - _Init(); - } - - explicit shuffle_order_engine(_Engine&& _Ex) : _Eng(_STD move(_Ex)) { - _Init(); - } - - explicit shuffle_order_engine(result_type _Xx0) : _Eng(_Xx0) { - _Init(); - } - - template = 0> - explicit shuffle_order_engine(_Seed_seq& _Seq) : _Eng(_Seq) { - _Init(); - } - - void seed() { // seed engine from default value - _Eng.seed(); - _Init(); - } - - void seed(result_type _Xx0) { // seed engine from specified value - _Eng.seed(_Xx0); - _Init(); - } - - template = 0> - void seed(_Seed_seq& _Seq) { // seed engine from seed sequence - _Eng.seed(_Seq); - _Init(); - } - - _NODISCARD const _Engine& base() const noexcept { - return _Eng; - } - - _NODISCARD static constexpr result_type(min)() noexcept /* strengthened */ { - return (_Engine::min) (); - } - - _NODISCARD static constexpr result_type(max)() noexcept /* strengthened */ { - return (_Engine::max) (); - } - - _NODISCARD result_type operator()() { - size_t _Idx = static_cast(static_cast(_Yx - (_Eng.min)()) * _Scale); - - _Yx = _Arr[_Idx]; - _Arr[_Idx] = _Eng(); - return _Yx; - } - - void discard(unsigned long long _Nskip) { // discard _Nskip elements - for (; 0 < _Nskip; --_Nskip) { - (void) (*this)(); - } - } - - _NODISCARD friend bool operator==(const shuffle_order_engine& _Left, const shuffle_order_engine& _Right) { - return _Left.base() == _Right.base(); - } - -#if !_HAS_CXX20 - _NODISCARD friend bool operator!=(const shuffle_order_engine& _Left, const shuffle_order_engine& _Right) { - return !(_Left == _Right); - } -#endif // !_HAS_CXX20 - - template - friend basic_istream<_Elem, _Traits>& operator>>( - basic_istream<_Elem, _Traits>& _Istr, shuffle_order_engine& _Eng) { // read state from _Istr - _Istr >> _Eng._Eng; - - for (auto& _Val : _Eng._Arr) { - _Istr >> _Val; - } - - return _Istr >> _Eng._Yx; - } - - template - friend basic_ostream<_Elem, _Traits>& operator<<( - basic_ostream<_Elem, _Traits>& _Ostr, const shuffle_order_engine& _Eng) { // write state to _Ostr - _Ostr << _Eng._Eng; - - for (const auto& _Val : _Eng._Arr) { - _Ostr << ' ' << _Val; - } - - return _Ostr << ' ' << _Eng._Yx; - } - -private: - void _Init() { // compute values for operator() - for (auto& _Val : _Arr) { - _Val = _Eng(); - } - - _Yx = _Eng(); - _Scale = - static_cast(_Kx) / (static_cast((_Eng.max)()) - static_cast((_Eng.min)()) + 1.0); - } - - _Engine _Eng; // the stored engine - result_type _Arr[_Kx]; - result_type _Yx; - double _Scale; -}; - -template -class _Rng_from_urng_v2 { // wrap a URNG as an RNG -public: - using _Ty0 = make_unsigned_t<_Diff>; - using _Ty1 = _Invoke_result_t<_Urng&>; - - using _Udiff = conditional_t; - static constexpr unsigned int _Udiff_bits = sizeof(_Udiff) * CHAR_BIT; - using _Uprod = conditional_t<_Udiff_bits <= 16, uint32_t, conditional_t<_Udiff_bits <= 32, uint64_t, _Unsigned128>>; - - explicit _Rng_from_urng_v2(_Urng& _Func) noexcept : _Ref(_Func) {} - - _Diff operator()(_Diff _Index) { // adapt _Urng closed range to [0, _Index) - // From Daniel Lemire, "Fast Random Integer Generation in an Interval", - // ACM Trans. Model. Comput. Simul. 29 (1), 2019. - // - // Algorithm 5 <-> This Code: - // m <-> _Product - // l <-> _Rem - // s <-> _Index - // t <-> _Threshold - // L <-> _Generated_bits - // 2^L - 1 <-> _Mask - - _Udiff _Mask = _Bmask; - unsigned int _Niter = 1; - - if constexpr (_Bits < _Udiff_bits) { - while (_Mask < static_cast<_Udiff>(_Index - 1)) { - _Mask <<= _Bits; - _Mask |= _Bmask; - ++_Niter; - } - } - - // x <- random integer in [0, 2^L) - // m <- x * s - auto _Product = _Get_random_product(_Index, _Niter); - // l <- m mod 2^L - auto _Rem = static_cast<_Udiff>(_Product) & _Mask; - - if (_Rem < _Index) { - // t <- (2^L - s) mod s - const auto _Threshold = (_Mask - _Index + 1) % _Index; - while (_Rem < _Threshold) { - _Product = _Get_random_product(_Index, _Niter); - _Rem = static_cast<_Udiff>(_Product) & _Mask; - } - } - - unsigned int _Generated_bits; - if constexpr (_Bits < _Udiff_bits) { - _Generated_bits = static_cast(_Popcount(_Mask)); - } else { - _Generated_bits = _Udiff_bits; - } - - // m / 2^L - return static_cast<_Diff>(_Product >> _Generated_bits); - } - - _Udiff _Get_all_bits() { - _Udiff _Ret = _Get_bits(); - - if constexpr (_Bits < _Udiff_bits) { - for (unsigned int _Num = _Bits; _Num < _Udiff_bits; _Num += _Bits) { // don't mask away any bits - _Ret <<= _Bits; - _Ret |= _Get_bits(); - } - } - - return _Ret; - } - - _Rng_from_urng_v2(const _Rng_from_urng_v2&) = delete; - _Rng_from_urng_v2& operator=(const _Rng_from_urng_v2&) = delete; - -private: - _Udiff _Get_bits() { // return a random value within [0, _Bmask] - static constexpr auto _Urng_min = (_Urng::min) (); - for (;;) { // repeat until random value is in range - const _Udiff _Val = _Ref() - _Urng_min; - - if (_Val <= _Bmask) { - return _Val; - } - } - } - - static constexpr size_t _Calc_bits() { - auto _Bits_local = _Udiff_bits; - auto _Bmask_local = static_cast<_Udiff>(-1); - for (; (_Urng::max) () - (_Urng::min) () < _Bmask_local; _Bmask_local >>= 1) { - --_Bits_local; - } - - return _Bits_local; - } - - _Uprod _Get_random_product(const _Diff _Index, unsigned int _Niter) { - _Udiff _Ret = _Get_bits(); - if constexpr (_Bits < _Udiff_bits) { - while (--_Niter > 0) { - _Ret <<= _Bits; - _Ret |= _Get_bits(); - } - } - - if constexpr (is_same_v<_Udiff, uint64_t>) { - uint64_t _High; - const auto _Low = _Base128::_UMul128(_Ret, static_cast<_Udiff>(_Index), _High); - return _Uprod{_Low, _High}; - } else { - return _Uprod{_Ret} * _Uprod{_Index}; - } - } - - _Urng& _Ref; // reference to URNG - static constexpr size_t _Bits = _Calc_bits(); // number of random bits generated by _Get_bits() - static constexpr _Udiff _Bmask = static_cast<_Udiff>(-1) >> (_Udiff_bits - _Bits); // 2^_Bits - 1 -}; - -#if _HAS_TR1_NAMESPACE -template -class _DEPRECATE_TR1_RANDOM uniform_int { // uniform integer distribution -public: - using result_type = _Ty; - - struct param_type { // parameter package - using distribution_type = uniform_int; - - param_type() noexcept { - _Init(0, 9); - } - - explicit param_type(result_type _Min0, result_type _Max0 = 9) noexcept { - _Init(_Min0, _Max0); - } - - _NODISCARD friend bool operator==(const param_type& _Left, const param_type& _Right) noexcept - /* strengthened */ { - return _Left._Min == _Right._Min && _Left._Max == _Right._Max; - } - -#if !_HAS_CXX20 - _NODISCARD friend bool operator!=(const param_type& _Left, const param_type& _Right) noexcept - /* strengthened */ { - return !(_Left == _Right); - } -#endif // !_HAS_CXX20 - - _NODISCARD result_type a() const noexcept /* strengthened */ { - return _Min; - } - - _NODISCARD result_type b() const noexcept /* strengthened */ { - return _Max; - } +_EXPORT_STD template +class shuffle_order_engine { // shuffle_order_engine compound engine +public: + static_assert(0 < _Kx, "invalid template argument for shuffle_order_engine"); - void _Init(_Ty _Min0, _Ty _Max0) noexcept { // set internal state - _STL_ASSERT(_Min0 <= _Max0, "invalid min and max arguments for uniform_int"); - _Min = _Min0; - _Max = _Max0; - } + using result_type = typename _Engine::result_type; - result_type _Min; - result_type _Max; - }; + static constexpr size_t table_size = _Kx; - uniform_int() noexcept : _Par(0, 9) {} + shuffle_order_engine() { + _Init(); + } - explicit uniform_int(_Ty _Min0, _Ty _Max0 = 9) noexcept : _Par(_Min0, _Max0) {} + explicit shuffle_order_engine(const _Engine& _Ex) : _Eng(_Ex) { + _Init(); + } - explicit uniform_int(const param_type& _Par0) noexcept : _Par(_Par0) {} + explicit shuffle_order_engine(_Engine&& _Ex) : _Eng(_STD move(_Ex)) { + _Init(); + } - _NODISCARD result_type a() const noexcept /* strengthened */ { - return _Par.a(); + explicit shuffle_order_engine(result_type _Xx0) : _Eng(_Xx0) { + _Init(); } - _NODISCARD result_type b() const noexcept /* strengthened */ { - return _Par.b(); + template = 0> + explicit shuffle_order_engine(_Seed_seq& _Seq) : _Eng(_Seq) { + _Init(); } - _NODISCARD param_type param() const noexcept /* strengthened */ { - return _Par; + void seed() { // seed engine from default value + _Eng.seed(); + _Init(); } - void param(const param_type& _Par0) noexcept /* strengthened */ { // set parameter package - _Par = _Par0; + void seed(result_type _Xx0) { // seed engine from specified value + _Eng.seed(_Xx0); + _Init(); } - _NODISCARD result_type(min)() const noexcept /* strengthened */ { - return _Par._Min; + template = 0> + void seed(_Seed_seq& _Seq) { // seed engine from seed sequence + _Eng.seed(_Seq); + _Init(); } - _NODISCARD result_type(max)() const noexcept /* strengthened */ { - return _Par._Max; + _NODISCARD const _Engine& base() const noexcept { + return _Eng; } - void reset() noexcept /* strengthened */ {} // clear internal state + _NODISCARD static constexpr result_type(min)() noexcept /* strengthened */ { + return (_Engine::min) (); + } - template - _NODISCARD result_type operator()(_Engine& _Eng) _DISTRIBUTION_CONST { - return _Eval(_Eng, _Par._Min, _Par._Max); + _NODISCARD static constexpr result_type(max)() noexcept /* strengthened */ { + return (_Engine::max) (); } - template - _NODISCARD result_type operator()(_Engine& _Eng, const param_type& _Par0) _DISTRIBUTION_CONST { - return _Eval(_Eng, _Par0._Min, _Par0._Max); + _NODISCARD result_type operator()() { + size_t _Idx = static_cast(static_cast(_Yx - (_Eng.min)()) * _Scale); + + _Yx = _Arr[_Idx]; + _Arr[_Idx] = _Eng(); + return _Yx; } - template - _NODISCARD result_type operator()(_Engine& _Eng, result_type _Nx) _DISTRIBUTION_CONST { - return _Eval(_Eng, 0, _Nx - 1); + void discard(unsigned long long _Nskip) { // discard _Nskip elements + for (; 0 < _Nskip; --_Nskip) { + (void) (*this)(); + } } - template - friend basic_istream<_Elem, _Traits>& operator>>(basic_istream<_Elem, _Traits>& _Istr, - uniform_int& _Dist) { // read state from _Istr - uniform_int::result_type _Min0; - uniform_int::result_type _Max0; - _Istr >> _Min0 >> _Max0; - _Dist._Par._Init(_Min0, _Max0); - return _Istr; + _NODISCARD friend bool operator==(const shuffle_order_engine& _Left, const shuffle_order_engine& _Right) { + return _Left.base() == _Right.base(); } - template - friend basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, - const uniform_int& _Dist) { // write state to _Ostr - return _Ostr << _Dist._Par._Min << ' ' << _Dist._Par._Max; +#if !_HAS_CXX20 + _NODISCARD friend bool operator!=(const shuffle_order_engine& _Left, const shuffle_order_engine& _Right) { + return !(_Left == _Right); } +#endif // !_HAS_CXX20 -private: - using _Uty = make_unsigned_t<_Ty>; + template + friend basic_istream<_Elem, _Traits>& operator>>( + basic_istream<_Elem, _Traits>& _Istr, shuffle_order_engine& _Eng) { // read state from _Istr + _Istr >> _Eng._Eng; - template - result_type _Eval(_Engine& _Eng, _Ty _Min, _Ty _Max) const { // compute next value in range [_Min, _Max] - conditional_t<_Has_static_min_max<_Engine>, _Rng_from_urng_v2<_Uty, _Engine>, _Rng_from_urng<_Uty, _Engine>> - _Generator(_Eng); + for (auto& _Val : _Eng._Arr) { + _Istr >> _Val; + } - const _Uty _Umin = _Adjust(static_cast<_Uty>(_Min)); - const _Uty _Umax = _Adjust(static_cast<_Uty>(_Max)); + return _Istr >> _Eng._Yx; + } - _Uty _Uret; + template + friend basic_ostream<_Elem, _Traits>& operator<<( + basic_ostream<_Elem, _Traits>& _Ostr, const shuffle_order_engine& _Eng) { // write state to _Ostr + _Ostr << _Eng._Eng; - if (_Umax - _Umin == static_cast<_Uty>(-1)) { - _Uret = static_cast<_Uty>(_Generator._Get_all_bits()); - } else { - _Uret = static_cast<_Uty>(_Generator(static_cast<_Uty>(_Umax - _Umin + 1))); + for (const auto& _Val : _Eng._Arr) { + _Ostr << ' ' << _Val; } - return static_cast<_Ty>(_Adjust(static_cast<_Uty>(_Uret + _Umin))); + return _Ostr << ' ' << _Eng._Yx; } - static _Uty _Adjust(_Uty _Uval) noexcept { // convert signed ranges to unsigned ranges and vice versa - if constexpr (is_signed_v<_Ty>) { - constexpr _Uty _Adjuster = (static_cast<_Uty>(-1) >> 1) + 1; // 2^(N-1) - return static_cast<_Uty>(_Uval ^ _Adjuster); - } else { // _Ty is already unsigned, do nothing - return _Uval; +private: + void _Init() { // compute values for operator() + for (auto& _Val : _Arr) { + _Val = _Eng(); } + + _Yx = _Eng(); + _Scale = + static_cast(_Kx) / (static_cast((_Eng.max)()) - static_cast((_Eng.min)()) + 1.0); } - param_type _Par; + _Engine _Eng; // the stored engine + result_type _Arr[_Kx]; + result_type _Yx; + double _Scale; }; -#endif // _HAS_TR1_NAMESPACE _EXPORT_STD template class uniform_int_distribution { // uniform integer distribution @@ -3213,135 +2244,6 @@ private: param_type _Par; }; -#if _HAS_TR1_NAMESPACE -template -class _DEPRECATE_TR1_RANDOM uniform_real { // uniform real distribution -public: - using result_type = _Ty; - - struct param_type { // parameter package - using distribution_type = uniform_real; - - param_type() noexcept { - _Init(_Ty{0}, _Ty{1}); - } - - explicit param_type(_Ty _Min0, _Ty _Max0 = _Ty{1}) noexcept { - _Init(_Min0, _Max0); - } - - _NODISCARD friend bool operator==(const param_type& _Left, const param_type& _Right) noexcept - /* strengthened */ { - return _Left._Min == _Right._Min && _Left._Max == _Right._Max; - } - -#if !_HAS_CXX20 - _NODISCARD friend bool operator!=(const param_type& _Left, const param_type& _Right) noexcept - /* strengthened */ { - return !(_Left == _Right); - } -#endif // !_HAS_CXX20 - - _NODISCARD result_type a() const noexcept /* strengthened */ { - return _Min; - } - - _NODISCARD result_type b() const noexcept /* strengthened */ { - return _Max; - } - - void _Init(_Ty _Min0, _Ty _Max0) noexcept { // set internal state - _STL_ASSERT(_Min0 <= _Max0 && (0 <= _Min0 || _Max0 <= _Min0 + (numeric_limits<_Ty>::max)()), - "invalid min and max arguments for uniform_real"); - _Min = _Min0; - _Max = _Max0; - } - - result_type _Min; - result_type _Max; - }; - - uniform_real() noexcept : _Par(_Ty{0}, _Ty{1}) {} - - explicit uniform_real(_Ty _Min0, _Ty _Max0 = _Ty{1}) noexcept : _Par(_Min0, _Max0) {} - - explicit uniform_real(const param_type& _Par0) noexcept : _Par(_Par0) {} - - _NODISCARD result_type a() const noexcept /* strengthened */ { - return _Par.a(); - } - - _NODISCARD result_type b() const noexcept /* strengthened */ { - return _Par.b(); - } - - _NODISCARD param_type param() const noexcept /* strengthened */ { - return _Par; - } - - void param(const param_type& _Par0) noexcept /* strengthened */ { // set parameter package - _Par = _Par0; - } - - _NODISCARD result_type(min)() const noexcept /* strengthened */ { - return _Par._Min; - } - - _NODISCARD result_type(max)() const noexcept /* strengthened */ { - return _Par._Max; - } - - void reset() noexcept /* strengthened */ {} // clear internal state - - template - _NODISCARD result_type operator()(_Engine& _Eng) _DISTRIBUTION_CONST { - return _Eval(_Eng, _Par); - } - - template - _NODISCARD result_type operator()(_Engine& _Eng, const param_type& _Par0) _DISTRIBUTION_CONST { - return _Eval(_Eng, _Par0); - } - - template - friend basic_istream<_Elem, _Traits>& operator>>(basic_istream<_Elem, _Traits>& _Istr, - uniform_real& _Dist) { // read state from _Istr - return _Dist._Read(_Istr); - } - - template - friend basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, - const uniform_real& _Dist) { // write state to _Ostr - return _Dist._Write(_Ostr); - } - - template - basic_istream<_Elem, _Traits>& _Read(basic_istream<_Elem, _Traits>& _Istr) { // read state from _Istr - _Ty _Min0; - _Ty _Max0; - _In(_Istr, _Min0); - _In(_Istr, _Max0); - _Par._Init(_Min0, _Max0); - return _Istr; - } - - template - basic_ostream<_Elem, _Traits>& _Write(basic_ostream<_Elem, _Traits>& _Ostr) const { // write state to _Ostr - _Out(_Ostr, _Par._Min); - _Out(_Ostr, _Par._Max); - return _Ostr; - } - -private: - template - result_type _Eval(_Engine& _Eng, const param_type& _Par0) const { - return _Nrand_impl<_Ty>(_Eng) * (_Par0._Max - _Par0._Min) + _Par0._Min; - } - - param_type _Par; -}; -#endif // _HAS_TR1_NAMESPACE - _EXPORT_STD template class uniform_real_distribution { // uniform real distribution public: @@ -5753,19 +4655,6 @@ _EXPORT_STD using minstd_rand = linear_congruential_engine; -#if _HAS_TR1_NAMESPACE -_STL_DISABLE_DEPRECATED_WARNING -using _Ranbase = subtract_with_carry; -using ranlux3 _DEPRECATE_TR1_NAMESPACE = discard_block<_Ranbase, 223, 24>; -using ranlux4 _DEPRECATE_TR1_NAMESPACE = discard_block<_Ranbase, 389, 24>; - -using ranlux_base_01 _DEPRECATE_TR1_NAMESPACE = subtract_with_carry_01; -using ranlux64_base_01 _DEPRECATE_TR1_NAMESPACE = subtract_with_carry_01; -using ranlux3_01 _DEPRECATE_TR1_NAMESPACE = discard_block; -using ranlux4_01 _DEPRECATE_TR1_NAMESPACE = discard_block; -_STL_RESTORE_DEPRECATED_WARNING -#endif // _HAS_TR1_NAMESPACE - _EXPORT_STD using mt19937_64 = mersenne_twister_engine; @@ -5806,79 +4695,10 @@ public: random_device(const random_device&) = delete; random_device& operator=(const random_device&) = delete; }; - -#if _HAS_TR1_NAMESPACE -_STL_DISABLE_DEPRECATED_WARNING -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _STD bernoulli_distribution; - using _STD binomial_distribution; - using _STD discard_block; - using _STD exponential_distribution; - using _STD gamma_distribution; - using _STD geometric_distribution; - using _STD linear_congruential; - using _STD mersenne_twister; - using _STD minstd_rand; - using _STD minstd_rand0; - using _STD mt19937; - using _STD normal_distribution; - using _STD poisson_distribution; - using _STD random_device; - using _STD ranlux3; - using _STD ranlux3_01; - using _STD ranlux4; - using _STD ranlux4_01; - using _STD ranlux64_base_01; - using _STD ranlux_base_01; - using _STD subtract_with_carry; - using _STD subtract_with_carry_01; - using _STD uniform_int; - using _STD uniform_real; - using _STD cauchy_distribution; - using _STD chi_squared_distribution; - using _STD default_random_engine; - using _STD discard_block_engine; - using _STD discrete_distribution; - using _STD extreme_value_distribution; - using _STD fisher_f_distribution; - using _STD generate_canonical; - using _STD independent_bits_engine; - using _STD knuth_b; - using _STD linear_congruential_engine; - using _STD lognormal_distribution; - using _STD mersenne_twister_engine; - using _STD mt19937_64; - using _STD negative_binomial_distribution; - using _STD piecewise_constant_distribution; - using _STD piecewise_linear_distribution; - using _STD ranlux24; - using _STD ranlux24_base; - using _STD ranlux48; - using _STD ranlux48_base; - using _STD seed_seq; - using _STD shuffle_order_engine; - using _STD student_t_distribution; - using _STD subtract_with_carry_engine; - using _STD uniform_int_distribution; - using _STD uniform_real_distribution; - using _STD weibull_distribution; -} // namespace _DEPRECATE_TR1_NAMESPACE tr1 -_STL_RESTORE_DEPRECATED_WARNING -#endif // _HAS_TR1_NAMESPACE _STD_END #undef _DISTRIBUTION_CONST -#if _HAS_TR1_NAMESPACE -// TRANSITION, GH-183 -#pragma pop_macro("uniform_real") -#pragma pop_macro("uniform_int") -#pragma pop_macro("subtract_with_carry") -#pragma pop_macro("mersenne_twister") -#pragma pop_macro("linear_congruential") -#pragma pop_macro("discard_block") -#endif // _HAS_TR1_NAMESPACE - #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/ranges b/stl/inc/ranges index 4dd831145fc..897c4d19baf 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -33,7 +33,9 @@ _STL_DISABLE_CLANG_WARNINGS // TRANSITION, non-_Ugly attribute tokens #pragma push_macro("msvc") +#pragma push_macro("no_specializations") #undef msvc +#undef no_specializations _STD_BEGIN namespace ranges { @@ -546,7 +548,8 @@ namespace ranges { #if _HAS_CXX23 _EXPORT_STD template requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>> - class range_adaptor_closure : public _Pipe::_Base<_Derived> {}; + class _NO_SPECIALIZATIONS_CITING("N5014 [range.adaptor.object]/5") range_adaptor_closure + : public _Pipe::_Base<_Derived> {}; #endif // _HAS_CXX23 _EXPORT_STD template @@ -9275,6 +9278,7 @@ _EXPORT_STD namespace views = ranges::views; _STD_END // TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") #pragma pop_macro("msvc") #pragma pop_macro("new") diff --git a/stl/inc/ratio b/stl/inc/ratio index ea8ecdf7495..07117b684e5 100644 --- a/stl/inc/ratio +++ b/stl/inc/ratio @@ -17,6 +17,12 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +// TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") +#undef msvc +#undef no_specializations + _STD_BEGIN _NODISCARD constexpr intmax_t _Abs(const intmax_t _Val) noexcept { return _Val < 0 ? -_Val : _Val; @@ -167,7 +173,7 @@ struct ratio_equal : bool_constant<_Rx1::num == _Rx2::num && _Rx1::den == _Rx2:: }; _EXPORT_STD template -constexpr bool ratio_equal_v = ratio_equal<_Rx1, _Rx2>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool ratio_equal_v = ratio_equal<_Rx1, _Rx2>::value; _EXPORT_STD template struct ratio_not_equal : bool_constant> { // tests if ratio != ratio @@ -175,7 +181,7 @@ struct ratio_not_equal : bool_constant> { // tests if }; _EXPORT_STD template -constexpr bool ratio_not_equal_v = ratio_not_equal<_Rx1, _Rx2>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool ratio_not_equal_v = ratio_not_equal<_Rx1, _Rx2>::value; struct _Big_uint128 { uint64_t _Upper; @@ -231,7 +237,7 @@ struct ratio_less : bool_constant<_Ratio_less(_Rx1::num, _Rx1::den, _Rx2::num, _ }; _EXPORT_STD template -constexpr bool ratio_less_v = ratio_less<_Rx1, _Rx2>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool ratio_less_v = ratio_less<_Rx1, _Rx2>::value; _EXPORT_STD template struct ratio_less_equal : bool_constant> { // tests if ratio <= ratio @@ -240,7 +246,7 @@ struct ratio_less_equal : bool_constant> { // tests if }; _EXPORT_STD template -constexpr bool ratio_less_equal_v = ratio_less_equal<_Rx1, _Rx2>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool ratio_less_equal_v = ratio_less_equal<_Rx1, _Rx2>::value; _EXPORT_STD template struct ratio_greater : ratio_less<_Rx2, _Rx1>::type { // tests if ratio > ratio @@ -248,7 +254,7 @@ struct ratio_greater : ratio_less<_Rx2, _Rx1>::type { // tests if ratio > ratio }; _EXPORT_STD template -constexpr bool ratio_greater_v = ratio_greater<_Rx1, _Rx2>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool ratio_greater_v = ratio_greater<_Rx1, _Rx2>::value; _EXPORT_STD template struct ratio_greater_equal : bool_constant> { // tests if ratio >= ratio @@ -257,7 +263,7 @@ struct ratio_greater_equal : bool_constant> { // tests }; _EXPORT_STD template -constexpr bool ratio_greater_equal_v = ratio_greater_equal<_Rx1, _Rx2>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool ratio_greater_equal_v = ratio_greater_equal<_Rx1, _Rx2>::value; _EXPORT_STD using atto = ratio<1, 1000000000000000000LL>; _EXPORT_STD using femto = ratio<1, 1000000000000000LL>; @@ -276,6 +282,11 @@ _EXPORT_STD using tera = ratio<1000000000000LL, 1>; _EXPORT_STD using peta = ratio<1000000000000000LL, 1>; _EXPORT_STD using exa = ratio<1000000000000000000LL, 1>; _STD_END + +// TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") +#pragma pop_macro("msvc") + #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/regex b/stl/inc/regex index f44ae9290e9..d886365a2f3 100644 --- a/stl/inc/regex +++ b/stl/inc/regex @@ -1586,7 +1586,7 @@ public: _Loop_number(_Number) {} const int _Min; - const int _Max; + const int _Max; // non-negative if bounded, -1 if unbounded _Node_end_rep* _End_rep; unsigned int _Loop_number; int _Simple_loop = -1; // -1 undetermined, 0 contains if/do, 1 simple @@ -1674,6 +1674,23 @@ public: } }; +enum class _Rx_unwind_ops { + _After_assert = _N_end + 1, + _After_neg_assert, + _Disjunction_eval_alt_on_failure, + _Disjunction_eval_alt_always, + _Do_nothing, + _Loop_simple_nongreedy, +}; + +template +class _Rx_state_frame_t { +public: + _Rx_unwind_ops _Code; + _Node_base* _Node; + _Tgt_state_t<_BidIt> _Match_state; +}; + template class _Matcher3 { // provides ways to match a regular expression to a text sequence public: @@ -1740,7 +1757,7 @@ public: _Matched = false; - bool _Succeeded = _Match_pat(_Rep); + bool _Succeeded = _Match_pat(_Rep) || _Matched; _STL_INTERNAL_CHECK(_Frames_count == 0); if (!_Succeeded) { @@ -1788,18 +1805,19 @@ private: _Tgt_state_t<_It> _Tgt_state; _Tgt_state_t<_It> _Res; vector<_Loop_vals_v2_t> _Loop_vals; - vector<_Tgt_state_t<_It>> _Frames; + vector<_Rx_state_frame_t<_It>> _Frames; size_t _Frames_count; - size_t _Push_frame(); + size_t _Push_frame(_Rx_unwind_ops _Code = {}, _Node_base* _Node = nullptr); void _Pop_frame(size_t); - bool _Do_assert(_Node_assert*); - bool _Do_neg_assert(_Node_assert*); - bool _Do_if(_Node_if*); - bool _Do_rep0(_Node_rep*, bool); + void _Increase_stack_usage_count(); + void _Decrease_stack_usage_count(); + void _Increase_complexity_count(); + + bool _Do_rep0(_Node_rep*); bool _Do_rep(_Node_rep*, bool, int); - bool _Do_rep_first(_Node_rep*); + void _Prepare_rep(_Node_rep*); bool _Find_first_inner_capture_group(_Node_base*, _Loop_vals_v2_t*); _It _Do_class(_Node_base*, _It); bool _Match_pat(_Node_base*); @@ -3328,10 +3346,14 @@ void _Builder2<_FwdIt, _Elem, _RxTraits>::_Add_rep(int _Min, int _Max, bool _Gre return; } + if (_Root->_Loops == static_cast(-1)) { + _Xregex_error(regex_constants::error_space); + } + _Node_end_rep* _Node0 = new _Node_end_rep(); - _Node_rep* _Nx = new _Node_rep(_Greedy, _Min, _Max, _Node0, _Root->_Loops++); - _Node0->_Begin_rep = _Nx; _Link_node(_Node0); + _Node_rep* _Nx = new _Node_rep(_Greedy, _Min, _Max, _Node0, _Root->_Loops++); + _Node0->_Begin_rep = _Nx; _Insert_node(_Pos, _Nx); } @@ -3348,11 +3370,14 @@ void _Builder2<_FwdIt, _Elem, _RxTraits>::_Tidy() noexcept { // free memory } template -size_t _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Push_frame() { +size_t _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Push_frame(_Rx_unwind_ops _Code, _Node_base* _Node) { if (_Frames_count >= _Frames.size()) { - _Frames.push_back(_Tgt_state); + _Frames.push_back({_Code, _Node, _Tgt_state}); } else { - _Frames[_Frames_count] = _Tgt_state; + auto& _Frame = _Frames[_Frames_count]; + _Frame._Code = _Code; + _Frame._Node = _Node; + _Frame._Match_state = _Tgt_state; } return _Frames_count++; } @@ -3364,95 +3389,36 @@ void _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Pop_frame(size_t _Idx) { } template -bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_assert(_Node_assert* _Node) { // apply assert node - _It _Ch = _Tgt_state._Cur; - if (_Match_pat(_Node->_Child)) { - _Tgt_state._Cur = _Ch; - return true; - } else { - return false; +void _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Increase_stack_usage_count() { + if (0 < _Max_stack_count && --_Max_stack_count <= 0) { + _Xregex_error(regex_constants::error_stack); } -} -template -bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_neg_assert(_Node_assert* _Node) { - // apply negative assert node - const size_t _Frame_idx = _Push_frame(); - bool _Succeeded = !_Match_pat(_Node->_Child); - if (_Succeeded) { - const _Bt_state_t<_It>& _St = _Frames[_Frame_idx]; - _Tgt_state = _St; + if (0 < _Max_complexity_count && --_Max_complexity_count <= 0) { + _Xregex_error(regex_constants::error_complexity); } - _Pop_frame(_Frame_idx); - return _Succeeded; } template -bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_if(_Node_if* _Node) { // apply if node - const size_t _Frame_idx = _Push_frame(); - - // look for the first match - for (; _Node; _Node = _Node->_Child) { // process one branch of if - _Tgt_state = _Frames[_Frame_idx]; // rewind to where the alternation starts in input - if (_Match_pat(_Node->_Next)) { // try to match this branch - break; - } - } - - // if none of the if branches matched, fail to match - if (!_Node) { - _Pop_frame(_Frame_idx); - return false; - } - - // if we aren't looking for the longest match, that's it - if (!_Longest) { - _Pop_frame(_Frame_idx); - return true; +void _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Decrease_stack_usage_count() { + if (0 < _Max_stack_count) { + ++_Max_stack_count; } +} - // see if there is a longer match - for (;;) { // process one branch of if - _Node = _Node->_Child; - if (!_Node) { - break; - } - - _Tgt_state = _Frames[_Frame_idx]; - (void) _Match_pat(_Node->_Next); +template +void _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Increase_complexity_count() { + if (0 < _Max_complexity_count && --_Max_complexity_count <= 0) { + _Xregex_error(regex_constants::error_complexity); } - _Pop_frame(_Frame_idx); - return true; } template -bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep0(_Node_rep* _Node, bool _Greedy) { +bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep0(_Node_rep* _Node) { // apply repetition to loop with no nested if/do - int _Ix = 0; - const size_t _Frame_idx = _Push_frame(); - - if (0 < _Node->_Min) { - // GH-5365: We can avoid resetting capture groups for the first iteration - // because we know that a simple repetition of this loop was not encountered before. - if (!_Match_pat(_Node->_Next)) { // didn't match minimum number of reps, fail - _Pop_frame(_Frame_idx); - return false; - } else if (_Tgt_state._Cur == _Frames[_Frame_idx]._Cur) { // matches empty string - // loop is branchless, so it will only ever match empty strings - // -> skip all other matches as they don't change state and immediately try tail - _Pop_frame(_Frame_idx); - return _Match_pat(_Node->_End_rep->_Next); - } else { // loop never matches the empty string - for (_Ix = 1; _Ix < _Node->_Min; ++_Ix) { // do minimum number of reps - // GH-5365: We have to reset the capture groups from the second iteration on. - _Tgt_state._Grp_valid = _Frames[_Frame_idx]._Grp_valid; - if (!_Match_pat(_Node->_Next)) { // didn't match minimum number of reps, fail - _Pop_frame(_Frame_idx); - return false; - } - } - } - } + int _Ix = _Node->_Min; + const size_t _Frame_idx = _Loop_vals[_Node->_Loop_number]._Loop_frame_idx; + _Loop_vals[_Node->_Loop_number]._Loop_idx = _Ix + 2; _Tgt_state_t<_It> _Final; bool _Matched0 = false; @@ -3460,11 +3426,6 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep0(_Node_rep* _Node bool _Done = false; if (_Match_pat(_Node->_End_rep->_Next)) { - if (!_Greedy) { - _Pop_frame(_Frame_idx); - return true; // go with current match - } - // record an acceptable match and continue _Final = _Tgt_state; _Matched0 = true; @@ -3472,7 +3433,7 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep0(_Node_rep* _Node if (_Ix == 0 && _Node->_Max != 0) { _Tgt_state._Cur = _Saved_pos; - _Tgt_state._Grp_valid = _Frames[_Frame_idx]._Grp_valid; + _Tgt_state._Grp_valid = _Frames[_Frame_idx]._Match_state._Grp_valid; if (!_Match_pat(_Node->_Next)) { // rep match failed, we are done _Done = true; @@ -3480,17 +3441,11 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep0(_Node_rep* _Node _Done = true; // we only potentially accept/try tail for POSIX if ((_Sflags & regex_constants::_Any_posix) && _Match_pat(_Node->_End_rep->_Next)) { - _Pop_frame(_Frame_idx); return true; // go with current match } } else { _Saved_pos = _Tgt_state._Cur; if (_Match_pat(_Node->_End_rep->_Next)) { - if (!_Greedy) { - _Pop_frame(_Frame_idx); - return true; // go with current match - } - // record match and continue _Final = _Tgt_state; _Matched0 = true; @@ -3502,7 +3457,7 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep0(_Node_rep* _Node if (!_Done) { while (_Node->_Max == -1 || _Ix++ < _Node->_Max) { // try another rep/tail match _Tgt_state._Cur = _Saved_pos; - _Tgt_state._Grp_valid = _Frames[_Frame_idx]._Grp_valid; + _Tgt_state._Grp_valid = _Frames[_Frame_idx]._Match_state._Grp_valid; if (!_Match_pat(_Node->_Next) || _Tgt_state._Cur == _Saved_pos) { break; // rep match failed, quit loop } @@ -3510,11 +3465,6 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep0(_Node_rep* _Node // since loop is branchless, empty rep match is not possible at this point _Saved_pos = _Tgt_state._Cur; if (_Match_pat(_Node->_End_rep->_Next)) { - if (!_Greedy) { - _Pop_frame(_Frame_idx); - return true; // go with current match - } - // record match and continue _Final = _Tgt_state; _Matched0 = true; @@ -3526,7 +3476,6 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep0(_Node_rep* _Node _Tgt_state = _Final; } - _Pop_frame(_Frame_idx); return _Matched0; } @@ -3538,7 +3487,7 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep(_Node_rep* _Node, const int _Loop_idx_sav = _Psav->_Loop_idx; const size_t _Loop_frame_idx_sav = _Psav->_Loop_frame_idx; const size_t _Frame_idx = _Push_frame(); - const bool _Progress = _Init_idx == 0 || _Frames[_Loop_frame_idx_sav]._Cur != _Tgt_state._Cur; + const bool _Progress = _Init_idx == 0 || _Frames[_Loop_frame_idx_sav]._Match_state._Cur != _Tgt_state._Cur; if (_Init_idx < _Node->_Min) { // try another required match _Psav->_Loop_frame_idx = _Frame_idx; @@ -3555,7 +3504,7 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep(_Node_rep* _Node, _Matched0 = _Match_pat(_Node->_End_rep->_Next); // try to match with one more repetition - _Tgt_state = _Frames[_Frame_idx]; + _Tgt_state = _Frames[_Frame_idx]._Match_state; _Psav->_Loop_idx = _Init_idx + 1; _Psav->_Loop_frame_idx = _Frame_idx; if (_Match_pat(_Node->_Next)) { // always call _Match_pat, even when _Matched0 is already true @@ -3564,7 +3513,7 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep(_Node_rep* _Node, } else if (!_Greedy) { // not greedy, favor minimum number of reps _Matched0 = _Match_pat(_Node->_End_rep->_Next); if (!_Matched0) { // tail failed, try another rep - _Tgt_state = _Frames[_Frame_idx]; + _Tgt_state = _Frames[_Frame_idx]._Match_state; _Psav->_Loop_idx = _Init_idx + 1; _Psav->_Loop_frame_idx = _Frame_idx; _STD fill(_Tgt_state._Grp_valid.begin() + static_cast(_Psav->_Group_first), @@ -3582,7 +3531,7 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep(_Node_rep* _Node, if (!_Matched0) { // rep failed, try tail _Psav->_Loop_idx = _Loop_idx_sav; _Psav->_Loop_frame_idx = _Loop_frame_idx_sav; - _Tgt_state = _Frames[_Frame_idx]; + _Tgt_state = _Frames[_Frame_idx]._Match_state; _Matched0 = _Match_pat(_Node->_End_rep->_Next); } } @@ -3599,12 +3548,7 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep(_Node_rep* _Node, } template -bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep_first(_Node_rep* _Node) { - bool _Greedy = (_Node->_Flags & _Fl_greedy) != 0; - // apply repetition - if (_Node->_Simple_loop == 1) { - return _Do_rep0(_Node, _Greedy); - } +void _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Prepare_rep(_Node_rep* _Node) { _Loop_vals_v2_t* _Psav = &_Loop_vals[_Node->_Loop_number]; // Determine first capture group in repetition for later capture group reset, if not done so previously. @@ -3615,8 +3559,6 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_rep_first(_Node_rep* _Psav->_Group_first = static_cast(_Tgt_state._Grp_valid.size()); } } - - return _Do_rep(_Node, _Greedy, 0); } template @@ -4004,219 +3946,367 @@ bool _Is_ecmascript_line_terminator(_Elem _Ch) { template bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Match_pat(_Node_base* _Nx) { // check for match - if (0 < _Max_stack_count && --_Max_stack_count <= 0) { - _Xregex_error(regex_constants::error_stack); - } + _Increase_stack_usage_count(); - if (0 < _Max_complexity_count && --_Max_complexity_count <= 0) { - _Xregex_error(regex_constants::error_complexity); - } + bool _Failed = false; + const size_t _Initial_frames_count = _Frames_count; - bool _Failed = false; - while (_Nx) { // match current node - switch (_Nx->_Kind) { // handle current node's type - case _N_nop: - break; + while (_Nx) { + do { // match current node + _Node_base* _Next = _Nx->_Next; + switch (_Nx->_Kind) { // handle current node's type + case _N_nop: + break; - case _N_bol: - if ((_Mflags & regex_constants::match_prev_avail) - || _Tgt_state._Cur != _Begin) { // if --_Cur is valid, check for preceding newline - _Failed = !(_Sflags & regex_constants::multiline) - || !_STD _Is_ecmascript_line_terminator(*_STD _Prev_iter(_Tgt_state._Cur)); - } else { - _Failed = (_Mflags & regex_constants::match_not_bol) != 0; - } - break; + case _N_bol: + if ((_Mflags & regex_constants::match_prev_avail) + || _Tgt_state._Cur != _Begin) { // if --_Cur is valid, check for preceding newline + _Failed = !(_Sflags & regex_constants::multiline) + || !_STD _Is_ecmascript_line_terminator(*_STD _Prev_iter(_Tgt_state._Cur)); + } else { + _Failed = (_Mflags & regex_constants::match_not_bol) != 0; + } + break; - case _N_eol: - if (_Tgt_state._Cur == _End) { - _Failed = (_Mflags & regex_constants::match_not_eol) != 0; - } else { - _Failed = - !(_Sflags & regex_constants::multiline) || !_STD _Is_ecmascript_line_terminator(*_Tgt_state._Cur); - } + case _N_eol: + if (_Tgt_state._Cur == _End) { + _Failed = (_Mflags & regex_constants::match_not_eol) != 0; + } else { + _Failed = !(_Sflags & regex_constants::multiline) + || !_STD _Is_ecmascript_line_terminator(*_Tgt_state._Cur); + } - break; + break; - case _N_wbound: - _Failed = _Is_wbound() == ((_Nx->_Flags & _Fl_negate) != 0); - break; + case _N_wbound: + _Failed = _Is_wbound() == ((_Nx->_Flags & _Fl_negate) != 0); + break; - case _N_dot: - if (_Tgt_state._Cur == _End) { - _Failed = true; - } else { - const _Elem _Ch = *_Tgt_state._Cur; - if (_Sflags & regex_constants::_Any_posix) { - if (_Ch == _Elem()) { + case _N_dot: + if (_Tgt_state._Cur == _End) { + _Failed = true; + } else { + const _Elem _Ch = *_Tgt_state._Cur; + if (_Sflags & regex_constants::_Any_posix) { + if (_Ch == _Elem()) { + _Failed = true; + } + } else if (_STD _Is_ecmascript_line_terminator(_Ch)) { _Failed = true; } - } else if (_STD _Is_ecmascript_line_terminator(_Ch)) { - _Failed = true; - } - if (!_Failed) { - ++_Tgt_state._Cur; + if (!_Failed) { + ++_Tgt_state._Cur; + } } - } - break; + break; - case _N_str: - { // check for string match - _Node_str<_Elem>* _Node = static_cast<_Node_str<_Elem>*>(_Nx); - _It _Res0; - if ((_Res0 = _STD _Compare_translate_left(_Tgt_state._Cur, _End, _Node->_Data._Str(), - _Node->_Data._Str() + _Node->_Data._Size(), _Traits, _Sflags)) - != _Tgt_state._Cur) { - _Tgt_state._Cur = _Res0; - } else { - _Failed = true; + case _N_str: + { // check for string match + _Node_str<_Elem>* _Node = static_cast<_Node_str<_Elem>*>(_Nx); + _It _Res0; + if ((_Res0 = _STD _Compare_translate_left(_Tgt_state._Cur, _End, _Node->_Data._Str(), + _Node->_Data._Str() + _Node->_Data._Size(), _Traits, _Sflags)) + != _Tgt_state._Cur) { + _Tgt_state._Cur = _Res0; + } else { + _Failed = true; + } + + break; } + case _N_class: + { // check for bracket expression match + _It _Res; + if (_Tgt_state._Cur != _End && (_Res = _Do_class(_Nx, _Tgt_state._Cur)) != _Tgt_state._Cur) { + _Tgt_state._Cur = _Res; + } else { + _Failed = true; + } + break; + } + + case _N_group: break; - } - case _N_class: - { // check for bracket expression match - _It _Res; - if (_Tgt_state._Cur != _End && (_Res = _Do_class(_Nx, _Tgt_state._Cur)) != _Tgt_state._Cur) { - _Tgt_state._Cur = _Res; - } else { - _Failed = true; - } + case _N_end_group: break; - } - case _N_group: - break; + case _N_assert: + { // check assert + auto _Node = static_cast<_Node_assert*>(_Nx); + _Push_frame(_Rx_unwind_ops::_After_assert, _Node); + _Next = _Node->_Child; - case _N_end_group: - break; + _Increase_stack_usage_count(); + break; + } - case _N_assert: - { // check assert - _Failed = !_Do_assert(static_cast<_Node_assert*>(_Nx)); - break; - } + case _N_neg_assert: + { // check negative assert + auto _Node = static_cast<_Node_assert*>(_Nx); + _Push_frame(_Rx_unwind_ops::_After_neg_assert, _Node); + _Next = _Node->_Child; - case _N_neg_assert: - { // check negative assert - _Failed = !_Do_neg_assert(static_cast<_Node_assert*>(_Nx)); + _Increase_stack_usage_count(); + break; + } + + case _N_end_assert: + _Next = nullptr; break; - } - case _N_end_assert: - _Nx = nullptr; - break; + case _N_capture: + { // record current position + _Node_capture* _Node = static_cast<_Node_capture*>(_Nx); + if (_Node->_Idx != 0U) { + _Tgt_state._Grps[_Node->_Idx]._Begin = _Tgt_state._Cur; + } + break; + } - case _N_capture: - { // record current position - _Node_capture* _Node = static_cast<_Node_capture*>(_Nx); - if (_Node->_Idx != 0U) { - _Tgt_state._Grps[_Node->_Idx]._Begin = _Tgt_state._Cur; + case _N_end_capture: + { // record successful capture + _Node_end_group* _Node = static_cast<_Node_end_group*>(_Nx); + _Node_capture* _Node0 = static_cast<_Node_capture*>(_Node->_Back); + if (_Node0->_Idx != 0U) { // update capture data + _Tgt_state._Grp_valid[_Node0->_Idx] = true; + _Tgt_state._Grps[_Node0->_Idx]._End = _Tgt_state._Cur; + } + break; + } + + case _N_back: + { // check back reference + _STL_INTERNAL_CHECK( + (_Sflags & (regex_constants::extended | regex_constants::egrep | regex_constants::awk)) + == 0); // these grammars don't have backreferences + _Node_back* _Node = static_cast<_Node_back*>(_Nx); + if (_Tgt_state._Grp_valid[_Node->_Idx]) { // check for match + _It _Res0 = _Tgt_state._Cur; + _It _Bx = _Tgt_state._Grps[_Node->_Idx]._Begin; + _It _Ex = _Tgt_state._Grps[_Node->_Idx]._End; + if (_Bx != _Ex // _Bx == _Ex for zero-length match + && (_Res0 = _STD _Compare_translate_both(_Tgt_state._Cur, _End, _Bx, _Ex, _Traits, _Sflags)) + == _Tgt_state._Cur) { + _Failed = true; + } else { + _Tgt_state._Cur = _Res0; + } + } else if (_Sflags & (regex_constants::basic | regex_constants::grep)) { + _Failed = true; + } + break; } + + case _N_if: + { + auto _Node = static_cast<_Node_if*>(_Nx); + if (_Node->_Child) { + _Push_frame(_Longest ? _Rx_unwind_ops::_Disjunction_eval_alt_always + : _Rx_unwind_ops::_Disjunction_eval_alt_on_failure, + _Node->_Child); + _Increase_stack_usage_count(); + } + break; + } + + case _N_endif: break; - } - case _N_end_capture: - { // record successful capture - _Node_end_group* _Node = static_cast<_Node_end_group*>(_Nx); - _Node_capture* _Node0 = static_cast<_Node_capture*>(_Node->_Back); - if (_Node0->_Idx != 0U) { // update capture data - _Tgt_state._Grp_valid[_Node0->_Idx] = true; - _Tgt_state._Grps[_Node0->_Idx]._End = _Tgt_state._Cur; + case _N_rep: + { + auto _Node = static_cast<_Node_rep*>(_Nx); + _Prepare_rep(_Node); + bool _Greedy = (_Node->_Flags & _Fl_greedy) != 0; + + if (_Node->_Simple_loop == 1) { + auto& _Sav = _Loop_vals[_Node->_Loop_number]; + _Sav._Loop_frame_idx = _Push_frame(_Rx_unwind_ops::_Do_nothing); + if (_Node->_Min > 0) { // try to match a rep + _Increase_complexity_count(); + _Sav._Loop_idx = 1; + // _Next is already assigned correctly for matching a rep + } else if (!_Greedy || _Longest) { // non-greedy matching + _Increase_complexity_count(); + + // try tail first + _Sav._Loop_idx = 0; + _Next = _Node->_End_rep->_Next; + + // set up stack unwinding for non-greedy matching if at least one rep is allowed + if (_Node->_Max != 0) { + _Push_frame(_Rx_unwind_ops::_Loop_simple_nongreedy, _Node); + } + } else { + _Failed = !_Do_rep0(_Node); + _Next = nullptr; + } + } else { + _Failed = !_Do_rep(_Node, _Greedy, 0); + _Next = nullptr; + } } + break; - } - case _N_back: - { // check back reference - _STL_INTERNAL_CHECK( - (_Sflags & (regex_constants::extended | regex_constants::egrep | regex_constants::awk)) - == 0); // these grammars don't have backreferences - _Node_back* _Node = static_cast<_Node_back*>(_Nx); - if (_Tgt_state._Grp_valid[_Node->_Idx]) { // check for match - _It _Res0 = _Tgt_state._Cur; - _It _Bx = _Tgt_state._Grps[_Node->_Idx]._Begin; - _It _Ex = _Tgt_state._Grps[_Node->_Idx]._End; - if (_Bx != _Ex // _Bx == _Ex for zero-length match - && (_Res0 = _STD _Compare_translate_both(_Tgt_state._Cur, _End, _Bx, _Ex, _Traits, _Sflags)) - == _Tgt_state._Cur) { - _Failed = true; + case _N_end_rep: + { + _Node_rep* _Nr = static_cast<_Node_end_rep*>(_Nx)->_Begin_rep; + auto& _Sav = _Loop_vals[_Nr->_Loop_number]; + bool _Greedy = (_Nr->_Flags & _Fl_greedy) != 0; + if (_Nr->_Simple_loop != 0) { + if (_Sav._Loop_idx == 1 + && _Tgt_state._Cur + == _Frames[_Sav._Loop_frame_idx]._Match_state._Cur) { // initial match empty + // loop is branchless, so it will only ever match empty strings + // -> we only try tail for POSIX or if minimum number of reps is non-zero + if ((_Sflags & regex_constants::_Any_posix) || _Nr->_Min > 0) { + _Increase_complexity_count(); + // _Next is already assigned correctly for matching tail + } else { + _Failed = true; + } + } else if (_Sav._Loop_idx < _Nr->_Min) { // at least one more rep to reach minimum + _Increase_complexity_count(); + + _Next = _Nr->_Next; + // GH-5365: We have to reset the capture groups from the second iteration on. + _Tgt_state._Grp_valid = _Frames[_Sav._Loop_frame_idx]._Match_state._Grp_valid; + ++_Sav._Loop_idx; + } else if (_Longest || !_Greedy) { + _Increase_complexity_count(); + // set up stack unwinding for non-greedy matching if one more rep is allowed + if (_Sav._Loop_idx != _Nr->_Max) { + _Push_frame(_Rx_unwind_ops::_Loop_simple_nongreedy, _Nr); + } + // _Next is already assigned correctly for matching tail + } else if (_Sav._Loop_idx == _Nr->_Min) { // greedy and minimum number of reps reached + _Failed = !_Do_rep0(_Nr); + _Next = nullptr; + } else { // internal _Match_pat(_Node->_Next) call in _Do_rep0() + _Next = nullptr; + } } else { - _Tgt_state._Cur = _Res0; + _Failed = !_Do_rep(_Nr, _Greedy, _Sav._Loop_idx); + _Next = nullptr; } - } else if (_Sflags & (regex_constants::basic | regex_constants::grep)) { + break; + } + + case _N_begin: + break; + + case _N_end: + if (((_Mflags & (regex_constants::match_not_null | regex_constants::_Match_not_null)) + && _Begin == _Tgt_state._Cur) + || (_Full && _Tgt_state._Cur != _End)) { _Failed = true; + } else if (_Longest && (!_Matched || _Better_match())) { // record successful match + _Res = _Tgt_state; + _Matched = true; } + _Next = nullptr; break; - } - case _N_if: - if (!_Do_if(static_cast<_Node_if*>(_Nx))) { - _Failed = true; + case _N_none: + default: +#if _ITERATOR_DEBUG_LEVEL != 0 + _STL_REPORT_ERROR("internal data of regex node corrupted"); +#endif + return false; } - _Nx = nullptr; - break; - - case _N_endif: - break; - - case _N_rep: - if (!_Do_rep_first(static_cast<_Node_rep*>(_Nx))) { - _Failed = true; + if (_Failed) { + _Nx = nullptr; + } else { + _Nx = _Next; } + } while (_Nx); + + while (_Frames_count > _Initial_frames_count && !_Nx) { + auto& _Frame = _Frames[--_Frames_count]; + + switch (_Frame._Code) { + case _Rx_unwind_ops::_After_assert: + { // positive assert completed + _Decrease_stack_usage_count(); + if (!_Failed) { + _Tgt_state._Cur = _Frame._Match_state._Cur; + _Nx = _Frame._Node->_Next; + } + break; + } - _Nx = nullptr; - break; + case _Rx_unwind_ops::_After_neg_assert: + { // negative assert completed + _Decrease_stack_usage_count(); + if (_Failed) { + const _Bt_state_t<_It>& _St = _Frame._Match_state; + _Tgt_state = _St; + _Nx = _Frame._Node->_Next; + } + _Failed = !_Failed; + break; + } - case _N_end_rep: - { - _Node_rep* _Nr = static_cast<_Node_end_rep*>(_Nx)->_Begin_rep; - if (_Nr->_Simple_loop == 0 - && !_Do_rep(_Nr, (_Nr->_Flags & _Fl_greedy) != 0, _Loop_vals[_Nr->_Loop_number]._Loop_idx)) { - _Failed = true; // recurse only if loop contains if/do + case _Rx_unwind_ops::_Disjunction_eval_alt_on_failure: + // evaluate next alternative if matching prior alternatives failed + if (!_Failed) { + _Decrease_stack_usage_count(); + break; + } + _FALLTHROUGH; + + case _Rx_unwind_ops::_Disjunction_eval_alt_always: + // evaluate next alternative no matter if matching prior alternatives succeeded + { + auto _Node = static_cast<_Node_if*>(_Frame._Node); + _Nx = _Node->_Next; + _Tgt_state = _Frame._Match_state; + _Failed = false; + _Increase_complexity_count(); + if (_Node->_Child) { + _Frame._Node = _Node->_Child; + ++_Frames_count; + } else { + _Decrease_stack_usage_count(); + } + break; } - _Nx = nullptr; + case _Rx_unwind_ops::_Do_nothing: break; - } - - case _N_begin: - break; - case _N_end: - if (((_Mflags & (regex_constants::match_not_null | regex_constants::_Match_not_null)) - && _Begin == _Tgt_state._Cur) - || (_Full && _Tgt_state._Cur != _End)) { - _Failed = true; - } else if (_Longest && (!_Matched || _Better_match())) { // record successful match - _Res = _Tgt_state; - _Matched = true; - } - _Nx = nullptr; - break; + case _Rx_unwind_ops::_Loop_simple_nongreedy: + // try one more rep after matching tail if necessary + if (_Longest || _Failed) { + auto _Node = static_cast<_Node_rep*>(_Frame._Node); + auto& _Sav = _Loop_vals[_Node->_Loop_number]; + + _Increase_complexity_count(); + _Nx = _Node->_Next; + _Tgt_state._Cur = _Frame._Match_state._Cur; + _Tgt_state._Grp_valid = _Frames[_Sav._Loop_frame_idx]._Match_state._Grp_valid; + _Failed = false; + if (_Sav._Loop_idx < INT_MAX) { // avoid overflowing _Loop_idx + ++_Sav._Loop_idx; + } + } + break; - case _N_none: - default: + default: #if _ITERATOR_DEBUG_LEVEL != 0 - _STL_REPORT_ERROR("internal data of regex node corrupted"); + _STL_REPORT_ERROR("internal stack of regex matcher corrupted"); #endif - return false; - } - - if (_Failed) { - _Nx = nullptr; - } else if (_Nx) { - _Nx = _Nx->_Next; + return false; + } } } - if (0 < _Max_stack_count) { - ++_Max_stack_count; - } + _Decrease_stack_usage_count(); return !_Failed; } @@ -5343,43 +5433,6 @@ _Parser2<_FwdIt, _Elem, _RxTraits>::_Parser2( _Trans(); } -#if _HAS_TR1_NAMESPACE -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _STD basic_regex; - using _STD cmatch; - using _STD cregex_iterator; - using _STD cregex_token_iterator; - using _STD csub_match; - using _STD match_results; - using _STD regex; - using _STD regex_error; - using _STD regex_iterator; - using _STD regex_match; - using _STD regex_replace; - using _STD regex_search; - using _STD regex_token_iterator; - using _STD regex_traits; - using _STD smatch; - using _STD sregex_iterator; - using _STD sregex_token_iterator; - using _STD ssub_match; - using _STD sub_match; - using _STD swap; - using _STD wcmatch; - using _STD wcregex_iterator; - using _STD wcregex_token_iterator; - using _STD wcsub_match; - using _STD wregex; - using _STD wsmatch; - using _STD wsregex_iterator; - using _STD wsregex_token_iterator; - using _STD wssub_match; - namespace regex_constants { - using namespace _STD regex_constants; - } -} // namespace _DEPRECATE_TR1_NAMESPACE tr1 -#endif // _HAS_TR1_NAMESPACE - #if _HAS_CXX17 namespace pmr { _EXPORT_STD template diff --git a/stl/inc/scoped_allocator b/stl/inc/scoped_allocator index 0ad22596afa..69ce3efbcb2 100644 --- a/stl/inc/scoped_allocator +++ b/stl/inc/scoped_allocator @@ -16,6 +16,12 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +// TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") +#undef msvc +#undef no_specializations + _STD_BEGIN template struct _Scoped_outermost_helper { // gets the outermost allocator @@ -140,7 +146,7 @@ public: using difference_type = typename _Outer_traits::difference_type; template - struct rebind { // converts X to X<_Other> + struct _NO_SPECIALIZATIONS_OF_MEMBER_CLASS_TEMPLATES rebind { // converts X to X<_Other> using _Other_alloc = typename _Get_rebind_type<_Outer, _Other>::type; using other = scoped_allocator_adaptor<_Other_alloc, _Inner...>; }; @@ -276,6 +282,11 @@ _NODISCARD bool operator!=(const scoped_allocator_adaptor<_Outer1, _Inner...>& _ #endif // !_HAS_CXX20 _STD_END + +// TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") +#pragma pop_macro("msvc") + #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/system_error b/stl/inc/system_error index 4a263e93ee5..c5d2c63ca7d 100644 --- a/stl/inc/system_error +++ b/stl/inc/system_error @@ -31,8 +31,10 @@ _STL_DISABLE_CLANG_WARNINGS // TRANSITION, non-_Ugly attribute tokens #pragma push_macro("msvc") #pragma push_macro("noop_dtor") +#pragma push_macro("no_specializations") #undef msvc #undef noop_dtor +#undef no_specializations _STD_BEGIN _EXPORT_STD enum class io_errc { // error codes for ios_base::failure @@ -46,7 +48,7 @@ template <> struct is_error_code_enum : true_type {}; _EXPORT_STD template -constexpr bool is_error_code_enum_v = is_error_code_enum<_Ty>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool is_error_code_enum_v = is_error_code_enum<_Ty>::value; _EXPORT_STD template struct is_error_condition_enum : false_type {}; @@ -55,7 +57,8 @@ template <> struct is_error_condition_enum : true_type {}; _EXPORT_STD template -constexpr bool is_error_condition_enum_v = is_error_condition_enum<_Ty>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool is_error_condition_enum_v = + is_error_condition_enum<_Ty>::value; _EXPORT_STD class error_code; _EXPORT_STD class error_condition; @@ -733,6 +736,7 @@ _STD_END #endif // _HAS_CXX17 // TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") #pragma pop_macro("noop_dtor") #pragma pop_macro("msvc") diff --git a/stl/inc/tuple b/stl/inc/tuple index cbb51e5ce56..570cdc112a9 100644 --- a/stl/inc/tuple +++ b/stl/inc/tuple @@ -126,23 +126,26 @@ struct _Tuple_perfect_val, _Uty0, _Uty1, _Uty2> template struct _Tuple_val { // stores each value in a tuple + // Use of remove_cv_t corresponds to N5008 [allocator.uses.construction]/5. + using _Dty = remove_cv_t<_Ty>; + constexpr _Tuple_val() : _Val() {} template constexpr _Tuple_val(_Other&& _Arg) : _Val(_STD forward<_Other>(_Arg)) {} - template , int> = 0> + template , int> = 0> constexpr _Tuple_val(const _Alloc&, allocator_arg_t, _Other&&... _Arg) : _Val(_STD forward<_Other>(_Arg)...) {} template , + enable_if_t, _STD is_constructible<_Ty, _STD allocator_arg_t, const _Alloc&, _Other...>>, int> = 0> constexpr _Tuple_val(const _Alloc& _Al, allocator_arg_t, _Other&&... _Arg) : _Val(allocator_arg, _Al, _STD forward<_Other>(_Arg)...) {} template , + enable_if_t, _STD negation<_STD is_constructible<_Ty, _STD allocator_arg_t, const _Alloc&, _Other...>>>, int> = 0> constexpr _Tuple_val(const _Alloc& _Al, allocator_arg_t, _Other&&... _Arg) @@ -204,6 +207,22 @@ using _Three_way_comparison_result_with_tuple_like_t = template concept _Tuple_like_non_tuple = !_Is_specialization_v<_Ty, tuple> && _Tuple_like<_Ty>; + +#ifdef __cpp_lib_reference_from_temporary +template +constexpr bool _Tuple_reference_constructs_from_temporary = false; +template +constexpr bool _Tuple_reference_constructs_from_temporary, _Args...> = + (reference_constructs_from_temporary_v<_TupleTypes, _Args> || ...); + +template >> +constexpr bool _Tuple_reference_constructs_from_temporary_for_tuple_like = false; +template + requires (tuple_size_v<_Tuple> == tuple_size_v>) +constexpr bool + _Tuple_reference_constructs_from_temporary_for_tuple_like<_Tuple, _TupleLike, index_sequence<_Indices...>> = + _Tuple_reference_constructs_from_temporary<_Tuple, decltype(_STD get<_Indices>(_STD declval<_TupleLike>()))...>; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #endif // _HAS_CXX23 template <> @@ -347,6 +366,14 @@ public: tuple(_This2&& _This_arg, _Rest2&&... _Rest_arg) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Exact_args_t{}, _STD forward<_This2>(_This_arg), _STD forward<_Rest2>(_Rest_arg)...) {} +#ifdef __cpp_lib_reference_from_temporary + template , + _STD _Tuple_constructible_val>, + int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) tuple(_This2&&, _Rest2&&...) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ tuple(const tuple&) = default; tuple(tuple&&) = default; @@ -358,6 +385,13 @@ public: constexpr explicit(_Tuple_conditional_explicit_v) tuple(tuple<_Other...>& _Right) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _Right) {} +#ifdef __cpp_lib_reference_from_temporary + template , + _STD _Tuple_convert_val&, _Other...>>, + int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) tuple(tuple<_Other...>&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #endif // _HAS_CXX23 template , @@ -366,6 +400,13 @@ public: constexpr explicit(_Tuple_conditional_explicit_v) tuple(const tuple<_Other...>& _Right) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _Right) {} +#ifdef __cpp_lib_reference_from_temporary + template , + _STD _Tuple_convert_val&, _Other...>>, + int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) tuple(const tuple<_Other...>&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ template , _STD _Tuple_convert_val, _Other...>>, @@ -373,6 +414,13 @@ public: constexpr explicit(_Tuple_conditional_explicit_v) tuple(tuple<_Other...>&& _Right) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} +#ifdef __cpp_lib_reference_from_temporary + template , + _STD _Tuple_convert_val, _Other...>>, + int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) tuple(tuple<_Other...>&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #if _HAS_CXX23 template , @@ -381,11 +429,23 @@ public: constexpr explicit(_Tuple_conditional_explicit_v) tuple(const tuple<_Other...>&& _Right) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} +#ifdef __cpp_lib_reference_from_temporary + template , + _STD _Tuple_convert_val, _Other...>>, + int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) tuple(const tuple<_Other...>&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ template , int> = 0> constexpr explicit(_Tuple_conditional_explicit_v) tuple(pair<_First, _Second>& _Right) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _Right) {} +#ifdef __cpp_lib_reference_from_temporary + template , int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) tuple(pair<_First, _Second>&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #endif // _HAS_CXX23 template & _Right) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _Right) {} +#ifdef __cpp_lib_reference_from_temporary + template , int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) + tuple(const pair<_First, _Second>&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ template , int> = 0> constexpr explicit(_Tuple_conditional_explicit_v) tuple(pair<_First, _Second>&& _Right) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} +#ifdef __cpp_lib_reference_from_temporary + template , int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) tuple(pair<_First, _Second>&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #if _HAS_CXX23 template && _Right) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} +#ifdef __cpp_lib_reference_from_temporary + template , int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) + tuple(const pair<_First, _Second>&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ template > static constexpr bool _Is_tuple_like_constructor_explicit_v = false; @@ -427,6 +506,15 @@ public: constexpr explicit(_Is_tuple_like_constructor_explicit_v<_Other>) tuple(_Other&& _Right) : tuple(_Unpack_tuple_t{}, _STD forward<_Other>(_Right)) { } +#ifdef __cpp_lib_reference_from_temporary + template <_Different_from _Other> + requires _Tuple_like_non_subrange<_Other> && (1 + sizeof...(_Rest) == tuple_size_v>) + && _Can_construct_values_from_tuple_like_v + && (sizeof...(_Rest) != 0 + || (!is_convertible_v<_Other, _This> && !is_constructible_v<_This, _Other>) ) + && _Tuple_reference_constructs_from_temporary_for_tuple_like + explicit(_Is_tuple_like_constructor_explicit_v<_Other>) tuple(_Other&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #endif // _HAS_CXX23 template ) tuple(allocator_arg_t, const _Alloc& _Al, _This2&& _This_arg, _Rest2&&... _Rest_arg) : tuple(_Alloc_exact_args_t{}, _Al, _STD forward<_This2>(_This_arg), _STD forward<_Rest2>(_Rest_arg)...) {} +#ifdef __cpp_lib_reference_from_temporary + template , + _STD _Tuple_constructible_val>, + int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) + tuple(allocator_arg_t, const _Alloc&, _This2&&, _Rest2&&...) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ template , int> = 0> @@ -468,6 +565,15 @@ public: constexpr explicit(_Tuple_conditional_explicit_v) tuple(allocator_arg_t, const _Alloc& _Al, tuple<_Other...>& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} +#ifdef __cpp_lib_reference_from_temporary + template , + _STD _Tuple_convert_val&, _Other...>>, + int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) + tuple(allocator_arg_t, const _Alloc&, tuple<_Other...>&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #endif // _HAS_CXX23 template ) tuple(allocator_arg_t, const _Alloc& _Al, const tuple<_Other...>& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} +#ifdef __cpp_lib_reference_from_temporary + template , + _STD _Tuple_convert_val&, _Other...>>, + int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) + tuple(allocator_arg_t, const _Alloc&, const tuple<_Other...>&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ template , @@ -485,6 +600,15 @@ public: _CONSTEXPR20 explicit(_Tuple_conditional_explicit_v) tuple(allocator_arg_t, const _Alloc& _Al, tuple<_Other...>&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} +#ifdef __cpp_lib_reference_from_temporary + template , + _STD _Tuple_convert_val, _Other...>>, + int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) + tuple(allocator_arg_t, const _Alloc&, tuple<_Other...>&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #if _HAS_CXX23 template ) tuple(allocator_arg_t, const _Alloc& _Al, const tuple<_Other...>&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} +#ifdef __cpp_lib_reference_from_temporary + template , + _STD _Tuple_convert_val, _Other...>>, + int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) + tuple(allocator_arg_t, const _Alloc&, const tuple<_Other...>&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ template , int> = 0> constexpr explicit(_Tuple_conditional_explicit_v) tuple(allocator_arg_t, const _Alloc& _Al, pair<_First, _Second>& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} +#ifdef __cpp_lib_reference_from_temporary + template , int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) + tuple(allocator_arg_t, const _Alloc&, pair<_First, _Second>&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #endif // _HAS_CXX23 template ) tuple(allocator_arg_t, const _Alloc& _Al, const pair<_First, _Second>& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} +#ifdef __cpp_lib_reference_from_temporary + template , int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) + tuple(allocator_arg_t, const _Alloc&, const pair<_First, _Second>&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ template , int> = 0> _CONSTEXPR20 explicit(_Tuple_conditional_explicit_v) tuple(allocator_arg_t, const _Alloc& _Al, pair<_First, _Second>&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} +#ifdef __cpp_lib_reference_from_temporary + template , int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) + tuple(allocator_arg_t, const _Alloc&, pair<_First, _Second>&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #if _HAS_CXX23 template ) tuple(allocator_arg_t, const _Alloc& _Al, const pair<_First, _Second>&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} +#ifdef __cpp_lib_reference_from_temporary + template , int> = 0> + requires _Tuple_reference_constructs_from_temporary + explicit(_Tuple_conditional_explicit_v) + tuple(allocator_arg_t, const _Alloc&, const pair<_First, _Second>&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #ifdef __EDG__ // TRANSITION, VSO-1900279 template , int> = 0> @@ -533,6 +694,15 @@ public: tuple(allocator_arg_t, const _Alloc& _Al, _Other&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD forward<_Other>(_Right)) { } +#ifdef __cpp_lib_reference_from_temporary + template _Other> + requires _Tuple_like_non_subrange<_Other> && (1 + sizeof...(_Rest) == tuple_size_v>) + && _Can_construct_values_from_tuple_like_v + && (sizeof...(_Rest) != 0 + || (!is_convertible_v<_Other, _This> && !is_constructible_v<_This, _Other>) ) + && _Tuple_reference_constructs_from_temporary_for_tuple_like + explicit(_Is_tuple_like_constructor_explicit_v<_Other>) tuple(allocator_arg_t, const _Alloc&, _Other&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #endif // _HAS_CXX23 tuple& operator=(const volatile tuple&) = delete; @@ -1093,6 +1263,12 @@ template #endif // ^^^ !_HAS_CXX20 ^^^ _NODISCARD constexpr _Ty make_from_tuple(_Tuple&& _Tpl) noexcept(noexcept(_STD _Make_from_tuple_impl<_Ty>( _STD forward<_Tuple>(_Tpl), make_index_sequence>>{}))) /* strengthened */ { +#ifdef __cpp_lib_reference_from_temporary + if constexpr (tuple_size_v> == 1) { + static_assert(!reference_constructs_from_temporary_v<_Ty, decltype(_STD get<0>(_STD forward<_Tuple>(_Tpl)))>, + "Cannot bind a temporary to the returned reference which will always be dangling (N5014 [tuple.apply]/2)."); + } +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ // construct _Ty from the elements of _Tpl return _STD _Make_from_tuple_impl<_Ty>( _STD forward<_Tuple>(_Tpl), make_index_sequence>>{}); @@ -1147,18 +1323,6 @@ struct common_type<_TTuple, _UTuple> { using type = _Tuple_like_common_type<_TTuple, _UTuple>::type; }; #endif // _HAS_CXX23 - -#if _HAS_TR1_NAMESPACE -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _STD get; - using _STD ignore; - using _STD make_tuple; - using _STD ref; - using _STD tie; - using _STD tuple; -} // namespace _DEPRECATE_TR1_NAMESPACE tr1 -#endif // _HAS_TR1_NAMESPACE - _STD_END #pragma pop_macro("new") diff --git a/stl/inc/type_traits b/stl/inc/type_traits index 9c8e1d740dd..5664ce1aca4 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -22,9 +22,11 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("msvc") #pragma push_macro("intrinsic") #pragma push_macro("known_semantics") +#pragma push_macro("no_specializations") #undef msvc #undef intrinsic #undef known_semantics +#undef no_specializations _STD_BEGIN template @@ -41,7 +43,7 @@ struct _Conjunction { // the first trait is true, }; _EXPORT_STD template -struct conjunction : true_type {}; // If _Traits is empty, true_type +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS conjunction : true_type {}; // If _Traits is empty, true_type template struct conjunction<_First, _Rest...> : _Conjunction(_First::value), _First, _Rest...>::type { @@ -49,19 +51,21 @@ struct conjunction<_First, _Rest...> : _Conjunction(_First::va }; _EXPORT_STD template -constexpr bool conjunction_v = conjunction<_Traits...>::value; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool conjunction_v = conjunction<_Traits...>::value; _EXPORT_STD template -struct negation : bool_constant(_Trait::value)> {}; // The negated result of _Trait +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS negation : bool_constant(_Trait::value)> { + // The negated result of _Trait +}; _EXPORT_STD template -constexpr bool negation_v = negation<_Trait>::value; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool negation_v = negation<_Trait>::value; _EXPORT_STD template -constexpr bool is_void_v = is_same_v, void>; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_void_v = is_same_v, void>; _EXPORT_STD template -struct is_void : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_void : bool_constant> {}; _EXPORT_STD template using void_t = void; @@ -75,7 +79,7 @@ using _Identity_t _MSVC_KNOWN_SEMANTICS = typename _Identity<_Ty>::type; // Type modifiers _EXPORT_STD template -struct add_const { // add top-level const qualifier +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS add_const { // add top-level const qualifier using type = const _Ty; }; @@ -83,7 +87,7 @@ _EXPORT_STD template using add_const_t = typename add_const<_Ty>::type; _EXPORT_STD template -struct add_volatile { // add top-level volatile qualifier +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS add_volatile { // add top-level volatile qualifier using type = volatile _Ty; }; @@ -91,7 +95,7 @@ _EXPORT_STD template using add_volatile_t = typename add_volatile<_Ty>::type; _EXPORT_STD template -struct add_cv { // add top-level const and volatile qualifiers +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS add_cv { // add top-level const and volatile qualifiers using type = const volatile _Ty; }; @@ -111,7 +115,7 @@ struct _Add_reference<_Ty, void_t<_Ty&>> { // (referenceable type) }; _EXPORT_STD template -struct add_lvalue_reference { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS add_lvalue_reference { using type = typename _Add_reference<_Ty>::_Lvalue; }; @@ -119,7 +123,7 @@ _EXPORT_STD template using add_lvalue_reference_t = typename _Add_reference<_Ty>::_Lvalue; _EXPORT_STD template -struct add_rvalue_reference { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS add_rvalue_reference { using type = typename _Add_reference<_Ty>::_Rvalue; }; @@ -132,7 +136,7 @@ add_rvalue_reference_t<_Ty> declval() noexcept { } _EXPORT_STD template -struct remove_extent { // remove array extent +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS remove_extent { // remove array extent using type = _Ty; }; @@ -150,7 +154,7 @@ _EXPORT_STD template using remove_extent_t = typename remove_extent<_Ty>::type; _EXPORT_STD template -struct remove_all_extents { // remove all array extents +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS remove_all_extents { // remove all array extents using type = _Ty; }; @@ -168,7 +172,7 @@ _EXPORT_STD template using remove_all_extents_t = typename remove_all_extents<_Ty>::type; _EXPORT_STD template -struct remove_pointer { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS remove_pointer { using type = _Ty; }; @@ -206,7 +210,7 @@ struct _Add_pointer<_Ty, void_t*>> { // (pointer type ca }; _EXPORT_STD template -struct add_pointer { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS add_pointer { using type = typename _Add_pointer<_Ty>::type; }; @@ -214,7 +218,7 @@ _EXPORT_STD template using add_pointer_t = typename _Add_pointer<_Ty>::type; _EXPORT_STD template -constexpr bool is_array_v = false; // determine whether type argument is an array +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_array_v = false; // determine whether type argument is an array template constexpr bool is_array_v<_Ty[_Nx]> = true; @@ -223,48 +227,51 @@ template constexpr bool is_array_v<_Ty[]> = true; _EXPORT_STD template -struct is_array : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_array : bool_constant> {}; #if _HAS_CXX20 _EXPORT_STD template -constexpr bool is_bounded_array_v = false; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_bounded_array_v = false; template constexpr bool is_bounded_array_v<_Ty[_Nx]> = true; _EXPORT_STD template -struct is_bounded_array : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_bounded_array : bool_constant> {}; _EXPORT_STD template -constexpr bool is_unbounded_array_v = false; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_unbounded_array_v = false; template constexpr bool is_unbounded_array_v<_Ty[]> = true; _EXPORT_STD template -struct is_unbounded_array : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_unbounded_array : bool_constant> {}; #endif // _HAS_CXX20 _EXPORT_STD template -constexpr bool is_lvalue_reference_v = false; // determine whether type argument is an lvalue reference +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_lvalue_reference_v = + false; // determine whether type argument is an lvalue reference template constexpr bool is_lvalue_reference_v<_Ty&> = true; _EXPORT_STD template -struct is_lvalue_reference : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_lvalue_reference : bool_constant> {}; _EXPORT_STD template -constexpr bool is_rvalue_reference_v = false; // determine whether type argument is an rvalue reference +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_rvalue_reference_v = + false; // determine whether type argument is an rvalue reference template constexpr bool is_rvalue_reference_v<_Ty&&> = true; _EXPORT_STD template -struct is_rvalue_reference : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_rvalue_reference : bool_constant> {}; _EXPORT_STD template -constexpr bool is_reference_v = false; // determine whether type argument is a reference +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_reference_v = + false; // determine whether type argument is a reference template constexpr bool is_reference_v<_Ty&> = true; @@ -273,10 +280,10 @@ template constexpr bool is_reference_v<_Ty&&> = true; _EXPORT_STD template -struct is_reference : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_reference : bool_constant> {}; _EXPORT_STD template -constexpr bool is_pointer_v = false; // determine whether _Ty is a pointer +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_pointer_v = false; // determine whether _Ty is a pointer template constexpr bool is_pointer_v<_Ty*> = true; @@ -291,69 +298,78 @@ template constexpr bool is_pointer_v<_Ty* const volatile> = true; _EXPORT_STD template -struct is_pointer : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_pointer : bool_constant> {}; _EXPORT_STD template -constexpr bool is_null_pointer_v = +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_null_pointer_v = is_same_v, nullptr_t>; // determine whether _Ty is cv-qualified nullptr_t _EXPORT_STD template -struct is_null_pointer : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_null_pointer : bool_constant> {}; _EXPORT_STD template -struct is_union : bool_constant<__is_union(_Ty)> {}; // determine whether _Ty is a union +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_union : bool_constant<__is_union(_Ty)> { +}; // determine whether _Ty is a union _EXPORT_STD template -constexpr bool is_union_v = __is_union(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_union_v = __is_union(_Ty); _EXPORT_STD template -struct is_class : bool_constant<__is_class(_Ty)> {}; // determine whether _Ty is a class +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_class : bool_constant<__is_class(_Ty)> { +}; // determine whether _Ty is a class _EXPORT_STD template -constexpr bool is_class_v = __is_class(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_class_v = __is_class(_Ty); _EXPORT_STD template -constexpr bool is_fundamental_v = is_arithmetic_v<_Ty> || is_void_v<_Ty> || is_null_pointer_v<_Ty>; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_fundamental_v = + is_arithmetic_v<_Ty> || is_void_v<_Ty> || is_null_pointer_v<_Ty>; _EXPORT_STD template -struct is_fundamental : bool_constant> {}; // determine whether _Ty is a fundamental type +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_fundamental : bool_constant> { + // determine whether _Ty is a fundamental type +}; _EXPORT_STD template -struct is_convertible : bool_constant<__is_convertible_to(_From, _To)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_convertible : bool_constant<__is_convertible_to(_From, _To)> { // determine whether _From is convertible to _To }; _EXPORT_STD template -constexpr bool is_convertible_v = __is_convertible_to(_From, _To); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_convertible_v = __is_convertible_to(_From, _To); _EXPORT_STD template -struct is_enum : bool_constant<__is_enum(_Ty)> {}; // determine whether _Ty is an enumerated type +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_enum : bool_constant<__is_enum(_Ty)> { +}; // determine whether _Ty is an enumerated type _EXPORT_STD template -constexpr bool is_enum_v = __is_enum(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_enum_v = __is_enum(_Ty); #if _HAS_CXX23 #if defined(__clang__) && !defined(__EDG__) \ && __clang_major__ >= 16 // TRANSITION, DevCom-10870354 (MSVC, EDG), VSO-2397560 (RWC relying on ancient Clang) _EXPORT_STD template -constexpr bool is_scoped_enum_v = __is_scoped_enum(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_scoped_enum_v = __is_scoped_enum(_Ty); _EXPORT_STD template -struct is_scoped_enum : bool_constant<__is_scoped_enum(_Ty)> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_scoped_enum : bool_constant<__is_scoped_enum(_Ty)> {}; #else // ^^^ no workaround / workaround vvv _EXPORT_STD template -constexpr bool is_scoped_enum_v = conjunction_v, negation>>; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_scoped_enum_v = + conjunction_v, negation>>; _EXPORT_STD template -struct is_scoped_enum : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_scoped_enum : bool_constant> {}; #endif // ^^^ workaround ^^^ #endif // _HAS_CXX23 _EXPORT_STD template -struct is_compound : bool_constant> {}; // determine whether _Ty is a compound type +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_compound : bool_constant> { + // determine whether _Ty is a compound type +}; _EXPORT_STD template -constexpr bool is_compound_v = !is_fundamental_v<_Ty>; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_compound_v = !is_fundamental_v<_Ty>; #define _EMIT_CDECL(FUNC, OPT1, OPT2, OPT3) FUNC(__cdecl, OPT1, OPT2, OPT3) @@ -541,46 +557,52 @@ _NON_MEMBER_CALL(_IS_MEMFUNPTR_EXPLICIT_THIS_GUIDES, , , noexcept) #ifdef __clang__ _EXPORT_STD template -constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Ty); #else // ^^^ Clang / Other vvv _EXPORT_STD template -constexpr bool is_member_function_pointer_v = _Is_memfunptr>::_Bool_type::value; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_member_function_pointer_v = + _Is_memfunptr>::_Bool_type::value; #endif // ^^^ Other ^^^ _EXPORT_STD template -struct is_member_function_pointer : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_member_function_pointer + : bool_constant> {}; _EXPORT_STD template -constexpr bool is_const_v = false; // determine whether type argument is const qualified +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_const_v = + false; // determine whether type argument is const qualified template constexpr bool is_const_v = true; _EXPORT_STD template -struct is_const : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_const : bool_constant> {}; _EXPORT_STD template -constexpr bool is_volatile_v = false; // determine whether type argument is volatile qualified +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_volatile_v = + false; // determine whether type argument is volatile qualified template constexpr bool is_volatile_v = true; _EXPORT_STD template -struct is_volatile : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_volatile : bool_constant> {}; _EXPORT_STD template -constexpr bool is_function_v = // only function types and reference types can't be const qualified +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool + is_function_v = // only function types and reference types can't be const qualified !is_const_v && !is_reference_v<_Ty>; _EXPORT_STD template -struct is_function : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_function : bool_constant> {}; _EXPORT_STD template -constexpr bool is_object_v = // only function types and reference types can't be const qualified +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool + is_object_v = // only function types and reference types can't be const qualified is_const_v && !is_void_v<_Ty>; _EXPORT_STD template -struct is_object : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_object : bool_constant> {}; template struct _Is_member_object_pointer { @@ -595,151 +617,222 @@ struct _Is_member_object_pointer<_Ty1 _Ty2::*> { #ifdef __clang__ _EXPORT_STD template -constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Ty); #else // ^^^ Clang / Other vvv _EXPORT_STD template -constexpr bool is_member_object_pointer_v = _Is_member_object_pointer>::value; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_member_object_pointer_v = + _Is_member_object_pointer>::value; #endif // ^^^ Other ^^^ _EXPORT_STD template -struct is_member_object_pointer : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_member_object_pointer : bool_constant> {}; #ifdef __clang__ _EXPORT_STD template -constexpr bool is_member_pointer_v = __is_member_pointer(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_member_pointer_v = __is_member_pointer(_Ty); #else // ^^^ Clang / Other vvv _EXPORT_STD template -constexpr bool is_member_pointer_v = is_member_object_pointer_v<_Ty> || is_member_function_pointer_v<_Ty>; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_member_pointer_v = + is_member_object_pointer_v<_Ty> || is_member_function_pointer_v<_Ty>; #endif // ^^^ Other ^^^ _EXPORT_STD template -struct is_member_pointer : bool_constant> {}; // determine whether _Ty is a pointer to member +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_member_pointer : bool_constant> { + // determine whether _Ty is a pointer to member +}; _EXPORT_STD template -constexpr bool is_scalar_v = // determine whether _Ty is a scalar type +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_scalar_v = // determine whether _Ty is a scalar type is_arithmetic_v<_Ty> || is_enum_v<_Ty> || is_pointer_v<_Ty> || is_member_pointer_v<_Ty> || is_null_pointer_v<_Ty>; _EXPORT_STD template -struct is_scalar : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_scalar : bool_constant> {}; _EXPORT_STD template -struct _CXX20_DEPRECATE_IS_POD is_pod : bool_constant<__is_pod(_Ty)> {}; // determine whether _Ty is a POD type +struct _CXX20_DEPRECATE_IS_POD _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_pod : bool_constant<__is_pod(_Ty)> { + // determine whether _Ty is a POD type +}; _EXPORT_STD template -_CXX20_DEPRECATE_IS_POD constexpr bool is_pod_v = __is_pod(_Ty); +_CXX20_DEPRECATE_IS_POD _NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_pod_v = __is_pod(_Ty); _EXPORT_STD template -struct is_empty : bool_constant<__is_empty(_Ty)> {}; // determine whether _Ty is an empty class +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_empty : bool_constant<__is_empty(_Ty)> { +}; // determine whether _Ty is an empty class _EXPORT_STD template -constexpr bool is_empty_v = __is_empty(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_empty_v = __is_empty(_Ty); _EXPORT_STD template -struct is_polymorphic : bool_constant<__is_polymorphic(_Ty)> {}; // determine whether _Ty is a polymorphic type +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_polymorphic : bool_constant<__is_polymorphic(_Ty)> { + // determine whether _Ty is a polymorphic type +}; _EXPORT_STD template -constexpr bool is_polymorphic_v = __is_polymorphic(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_polymorphic_v = __is_polymorphic(_Ty); _EXPORT_STD template -struct is_abstract : bool_constant<__is_abstract(_Ty)> {}; // determine whether _Ty is an abstract class +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_abstract : bool_constant<__is_abstract(_Ty)> { + // determine whether _Ty is an abstract class +}; _EXPORT_STD template -constexpr bool is_abstract_v = __is_abstract(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_abstract_v = __is_abstract(_Ty); _EXPORT_STD template -struct is_final : bool_constant<__is_final(_Ty)> {}; // determine whether _Ty is a final class +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_final : bool_constant<__is_final(_Ty)> { +}; // determine whether _Ty is a final class _EXPORT_STD template -constexpr bool is_final_v = __is_final(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_final_v = __is_final(_Ty); _EXPORT_STD template -struct is_standard_layout : bool_constant<__is_standard_layout(_Ty)> {}; // determine whether _Ty is standard layout +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_standard_layout : bool_constant<__is_standard_layout(_Ty)> { + // determine whether _Ty is standard layout +}; _EXPORT_STD template -constexpr bool is_standard_layout_v = __is_standard_layout(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_standard_layout_v = __is_standard_layout(_Ty); #if _HAS_DEPRECATED_IS_LITERAL_TYPE _EXPORT_STD template -struct _CXX17_DEPRECATE_IS_LITERAL_TYPE is_literal_type : bool_constant<__is_literal_type(_Ty)> { +struct _CXX17_DEPRECATE_IS_LITERAL_TYPE _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_literal_type + : bool_constant<__is_literal_type(_Ty)> { // determine whether _Ty is a literal type }; _EXPORT_STD template -_CXX17_DEPRECATE_IS_LITERAL_TYPE constexpr bool is_literal_type_v = __is_literal_type(_Ty); +_CXX17_DEPRECATE_IS_LITERAL_TYPE _NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_literal_type_v = + __is_literal_type(_Ty); #endif // _HAS_DEPRECATED_IS_LITERAL_TYPE _EXPORT_STD template -struct is_trivial : bool_constant<__is_trivial(_Ty)> {}; // determine whether _Ty is a trivial type +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_trivial : bool_constant<__is_trivial(_Ty)> { +}; // determine whether _Ty is a trivial type _EXPORT_STD template -constexpr bool is_trivial_v = __is_trivial(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_trivial_v = __is_trivial(_Ty); _EXPORT_STD template -struct is_trivially_copyable : bool_constant<__is_trivially_copyable(_Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_trivially_copyable : bool_constant<__is_trivially_copyable(_Ty)> { // determine whether _Ty is a trivially copyable type }; _EXPORT_STD template -constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Ty); + +#if _HAS_CXX23 && defined(__clang__) // TRANSITION, GH-5738 tracking VSO-2581622 (MSVC) and VSO-2581623 (EDG) +_EXPORT_STD template +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_implicit_lifetime : bool_constant<__builtin_is_implicit_lifetime(_Ty)> {}; _EXPORT_STD template -struct has_virtual_destructor : bool_constant<__has_virtual_destructor(_Ty)> { +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_implicit_lifetime_v = __builtin_is_implicit_lifetime(_Ty); +#endif // ^^^ _HAS_CXX23 && defined(__clang__) ^^^ + +_EXPORT_STD template +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS has_virtual_destructor : bool_constant<__has_virtual_destructor(_Ty)> { // determine whether _Ty has a virtual destructor }; _EXPORT_STD template -constexpr bool has_virtual_destructor_v = __has_virtual_destructor(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool has_virtual_destructor_v = __has_virtual_destructor(_Ty); #if _HAS_CXX17 _EXPORT_STD template -struct has_unique_object_representations : bool_constant<__has_unique_object_representations(_Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS has_unique_object_representations + : bool_constant<__has_unique_object_representations(_Ty)> { // determine whether _Ty has unique object representations }; _EXPORT_STD template -constexpr bool has_unique_object_representations_v = __has_unique_object_representations(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool has_unique_object_representations_v = + __has_unique_object_representations(_Ty); + +#ifdef __cpp_lib_reference_from_temporary +#ifdef __clang__ // TRANSITION, LLVM-114344 +template +struct _Adjust_ref_binding_source { + using type = _Ty; +}; +template + requires is_scalar_v<_Ty> || is_void_v<_Ty> +struct _Adjust_ref_binding_source<_Ty> { + using type = remove_cv_t<_Ty>; +}; +template + requires is_function_v<_Ty> && requires { typename void_t<_Ty&>; } +struct _Adjust_ref_binding_source<_Ty> { + using type = _Ty&; +}; + +template +using _Adjust_ref_binding_source_t = _Adjust_ref_binding_source<_Ty>::type; +#else // ^^^ workaround / no workaround vvv +template +using _Adjust_ref_binding_source_t = _Ty; +#endif // ^^^ no workaround ^^^ + +_EXPORT_STD template +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS reference_constructs_from_temporary + : bool_constant<__reference_constructs_from_temporary(_Ty, _Adjust_ref_binding_source_t<_Uty>)> {}; + +_EXPORT_STD template +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool reference_constructs_from_temporary_v = + __reference_constructs_from_temporary(_Ty, _Adjust_ref_binding_source_t<_Uty>); + +_EXPORT_STD template +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS reference_converts_from_temporary + : bool_constant<__reference_converts_from_temporary(_Ty, _Adjust_ref_binding_source_t<_Uty>)> {}; + +_EXPORT_STD template +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool reference_converts_from_temporary_v = + __reference_converts_from_temporary(_Ty, _Adjust_ref_binding_source_t<_Uty>); +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #ifdef __EDG__ // TRANSITION, VSO-1690654 template struct _Is_aggregate_impl : bool_constant<__is_aggregate(_Ty)> {}; _EXPORT_STD template -constexpr bool is_aggregate_v = disjunction_v, _Is_aggregate_impl<_Ty>>; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_aggregate_v = + disjunction_v, _Is_aggregate_impl<_Ty>>; _EXPORT_STD template -struct is_aggregate : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_aggregate : bool_constant> {}; #else // ^^^ workaround / no workaround vvv _EXPORT_STD template -struct is_aggregate : bool_constant<__is_aggregate(_Ty)> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_aggregate : bool_constant<__is_aggregate(_Ty)> {}; _EXPORT_STD template -constexpr bool is_aggregate_v = __is_aggregate(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_aggregate_v = __is_aggregate(_Ty); #endif // ^^^ no workaround ^^^ #endif // _HAS_CXX17 _EXPORT_STD template -struct is_constructible : bool_constant<__is_constructible(_Ty, _Args...)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_constructible : bool_constant<__is_constructible(_Ty, _Args...)> { // determine whether _Ty can be direct-initialized with _Args... }; _EXPORT_STD template -constexpr bool is_constructible_v = __is_constructible(_Ty, _Args...); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_constructible_v = __is_constructible(_Ty, _Args...); _EXPORT_STD template -struct is_copy_constructible : bool_constant<__is_constructible(_Ty, add_lvalue_reference_t)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_copy_constructible + : bool_constant<__is_constructible(_Ty, add_lvalue_reference_t)> { // determine whether _Ty can be direct-initialized with an lvalue const _Ty }; _EXPORT_STD template -constexpr bool is_copy_constructible_v = __is_constructible(_Ty, add_lvalue_reference_t); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_copy_constructible_v = + __is_constructible(_Ty, add_lvalue_reference_t); _EXPORT_STD template -struct is_default_constructible : bool_constant<__is_constructible(_Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_default_constructible : bool_constant<__is_constructible(_Ty)> { // determine whether _Ty can be value-initialized }; _EXPORT_STD template -constexpr bool is_default_constructible_v = __is_constructible(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_default_constructible_v = __is_constructible(_Ty); template struct _Is_implicitly_default_constructible : false_type { @@ -754,18 +847,20 @@ struct _Is_implicitly_default_constructible<_Ty, void_t -struct is_move_constructible : bool_constant<__is_constructible(_Ty, _Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_move_constructible : bool_constant<__is_constructible(_Ty, _Ty)> { // determine whether _Ty can be direct-initialized from an rvalue _Ty }; _EXPORT_STD template -constexpr bool is_move_constructible_v = __is_constructible(_Ty, _Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_move_constructible_v = __is_constructible(_Ty, _Ty); _EXPORT_STD template -struct is_assignable : bool_constant<__is_assignable(_To, _From)> {}; // determine whether _From can be assigned to _To +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_assignable : bool_constant<__is_assignable(_To, _From)> { + // determine whether _From can be assigned to _To +}; _EXPORT_STD template -constexpr bool is_assignable_v = __is_assignable(_To, _From); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_assignable_v = __is_assignable(_To, _From); #if defined(_IS_ASSIGNABLE_NOCHECK_SUPPORTED) && !defined(__CUDACC__) template @@ -776,13 +871,14 @@ using _Is_assignable_no_precondition_check = is_assignable<_To, _From>; #endif // ^^^ intrinsic not supported ^^^ _EXPORT_STD template -struct is_copy_assignable +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_copy_assignable : bool_constant<__is_assignable(add_lvalue_reference_t<_Ty>, add_lvalue_reference_t)> { // determine whether an lvalue const _Ty can be assigned to an lvalue _Ty }; _EXPORT_STD template -constexpr bool is_copy_assignable_v = __is_assignable(add_lvalue_reference_t<_Ty>, add_lvalue_reference_t); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_copy_assignable_v = + __is_assignable(add_lvalue_reference_t<_Ty>, add_lvalue_reference_t); #if defined(_IS_ASSIGNABLE_NOCHECK_SUPPORTED) && !defined(__CUDACC__) template @@ -802,12 +898,14 @@ constexpr bool _Is_copy_assignable_unchecked_v = is_copy_assignable_v<_Ty>; #endif // ^^^ intrinsic not supported ^^^ _EXPORT_STD template -struct is_move_assignable : bool_constant<__is_assignable(add_lvalue_reference_t<_Ty>, _Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_move_assignable + : bool_constant<__is_assignable(add_lvalue_reference_t<_Ty>, _Ty)> { // determine whether an rvalue _Ty can be assigned to an lvalue _Ty }; _EXPORT_STD template -constexpr bool is_move_assignable_v = __is_assignable(add_lvalue_reference_t<_Ty>, _Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_move_assignable_v = + __is_assignable(add_lvalue_reference_t<_Ty>, _Ty); #if defined(_IS_ASSIGNABLE_NOCHECK_SUPPORTED) && !defined(__CUDACC__) template @@ -826,148 +924,166 @@ constexpr bool _Is_move_assignable_unchecked_v = is_move_assignable_v<_Ty>; #endif // ^^^ intrinsic not supported ^^^ _EXPORT_STD template -struct is_destructible : bool_constant<__is_destructible(_Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_destructible : bool_constant<__is_destructible(_Ty)> { // true iff remove_all_extents_t<_Ty> is a reference type, or can be explicitly destroyed }; _EXPORT_STD template -constexpr bool is_destructible_v = __is_destructible(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_destructible_v = __is_destructible(_Ty); _EXPORT_STD template -struct is_trivially_constructible : bool_constant<__is_trivially_constructible(_Ty, _Args...)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_trivially_constructible + : bool_constant<__is_trivially_constructible(_Ty, _Args...)> { // determine whether direct-initialization of _Ty with _Args... is trivial }; _EXPORT_STD template -constexpr bool is_trivially_constructible_v = __is_trivially_constructible(_Ty, _Args...); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_trivially_constructible_v = + __is_trivially_constructible(_Ty, _Args...); _EXPORT_STD template -struct is_trivially_copy_constructible +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_trivially_copy_constructible : bool_constant<__is_trivially_constructible(_Ty, add_lvalue_reference_t)> { // determine whether direct-initialization of _Ty with an lvalue const _Ty is trivial }; _EXPORT_STD template -constexpr bool is_trivially_copy_constructible_v = __is_trivially_constructible(_Ty, add_lvalue_reference_t); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_trivially_copy_constructible_v = + __is_trivially_constructible(_Ty, add_lvalue_reference_t); _EXPORT_STD template -struct is_trivially_default_constructible : bool_constant<__is_trivially_constructible(_Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_trivially_default_constructible + : bool_constant<__is_trivially_constructible(_Ty)> { // determine whether value-initialization of _Ty is trivial }; _EXPORT_STD template -constexpr bool is_trivially_default_constructible_v = __is_trivially_constructible(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_trivially_default_constructible_v = + __is_trivially_constructible(_Ty); _EXPORT_STD template -struct is_trivially_move_constructible : bool_constant<__is_trivially_constructible(_Ty, _Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_trivially_move_constructible + : bool_constant<__is_trivially_constructible(_Ty, _Ty)> { // determine whether direct-initialization of _Ty with an rvalue _Ty is trivial }; _EXPORT_STD template -constexpr bool is_trivially_move_constructible_v = __is_trivially_constructible(_Ty, _Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_trivially_move_constructible_v = + __is_trivially_constructible(_Ty, _Ty); _EXPORT_STD template -struct is_trivially_assignable : bool_constant<__is_trivially_assignable(_To, _From)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_trivially_assignable + : bool_constant<__is_trivially_assignable(_To, _From)> { // determine whether _From can be trivially assigned to _To }; _EXPORT_STD template -constexpr bool is_trivially_assignable_v = __is_trivially_assignable(_To, _From); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_trivially_assignable_v = __is_trivially_assignable(_To, _From); _EXPORT_STD template -struct is_trivially_copy_assignable +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_trivially_copy_assignable : bool_constant<__is_trivially_assignable(add_lvalue_reference_t<_Ty>, add_lvalue_reference_t)> { // determine whether an lvalue const _Ty can be trivially assigned to an lvalue _Ty }; _EXPORT_STD template -constexpr bool is_trivially_copy_assignable_v = +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_trivially_copy_assignable_v = __is_trivially_assignable(add_lvalue_reference_t<_Ty>, add_lvalue_reference_t); _EXPORT_STD template -struct is_trivially_move_assignable : bool_constant<__is_trivially_assignable(add_lvalue_reference_t<_Ty>, _Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_trivially_move_assignable + : bool_constant<__is_trivially_assignable(add_lvalue_reference_t<_Ty>, _Ty)> { // determine whether an rvalue _Ty can be trivially assigned to an lvalue _Ty }; _EXPORT_STD template -constexpr bool is_trivially_move_assignable_v = __is_trivially_assignable(add_lvalue_reference_t<_Ty>, _Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_trivially_move_assignable_v = + __is_trivially_assignable(add_lvalue_reference_t<_Ty>, _Ty); _EXPORT_STD template -struct is_trivially_destructible : bool_constant<__is_trivially_destructible(_Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_trivially_destructible : bool_constant<__is_trivially_destructible(_Ty)> { // determine whether remove_all_extents_t<_Ty> is a reference type or can trivially be explicitly destroyed }; _EXPORT_STD template -constexpr bool is_trivially_destructible_v = __is_trivially_destructible(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_trivially_destructible_v = __is_trivially_destructible(_Ty); _EXPORT_STD template -struct is_nothrow_constructible : bool_constant<__is_nothrow_constructible(_Ty, _Args...)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_constructible + : bool_constant<__is_nothrow_constructible(_Ty, _Args...)> { // determine whether direct-initialization of _Ty from _Args... is both valid and not potentially-throwing }; _EXPORT_STD template -constexpr bool is_nothrow_constructible_v = __is_nothrow_constructible(_Ty, _Args...); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_constructible_v = + __is_nothrow_constructible(_Ty, _Args...); _EXPORT_STD template -struct is_nothrow_copy_constructible +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_copy_constructible : bool_constant<__is_nothrow_constructible(_Ty, add_lvalue_reference_t)> { // determine whether direct-initialization of _Ty from an lvalue const _Ty is both valid // and not potentially-throwing }; _EXPORT_STD template -constexpr bool is_nothrow_copy_constructible_v = __is_nothrow_constructible(_Ty, add_lvalue_reference_t); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_copy_constructible_v = + __is_nothrow_constructible(_Ty, add_lvalue_reference_t); _EXPORT_STD template -struct is_nothrow_default_constructible : bool_constant<__is_nothrow_constructible(_Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_default_constructible + : bool_constant<__is_nothrow_constructible(_Ty)> { // determine whether value-initialization of _Ty is both valid and not potentially-throwing }; _EXPORT_STD template -constexpr bool is_nothrow_default_constructible_v = __is_nothrow_constructible(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_default_constructible_v = __is_nothrow_constructible(_Ty); _EXPORT_STD template -struct is_nothrow_move_constructible : bool_constant<__is_nothrow_constructible(_Ty, _Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_move_constructible + : bool_constant<__is_nothrow_constructible(_Ty, _Ty)> { // determine whether direct-initialization of _Ty from an rvalue _Ty is both valid and not potentially-throwing }; _EXPORT_STD template -constexpr bool is_nothrow_move_constructible_v = __is_nothrow_constructible(_Ty, _Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_move_constructible_v = + __is_nothrow_constructible(_Ty, _Ty); _EXPORT_STD template -struct is_nothrow_assignable : bool_constant<__is_nothrow_assignable(_To, _From)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_assignable : bool_constant<__is_nothrow_assignable(_To, _From)> { // determine whether assignment of _From to _To is both valid and not potentially-throwing }; _EXPORT_STD template -constexpr bool is_nothrow_assignable_v = __is_nothrow_assignable(_To, _From); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_assignable_v = __is_nothrow_assignable(_To, _From); _EXPORT_STD template -struct is_nothrow_copy_assignable +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_copy_assignable : bool_constant<__is_nothrow_assignable(add_lvalue_reference_t<_Ty>, add_lvalue_reference_t)> { // determine whether assignment of an lvalue const _Ty to an lvalue _Ty is both valid and not potentially-throwing }; _EXPORT_STD template -constexpr bool is_nothrow_copy_assignable_v = +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_copy_assignable_v = __is_nothrow_assignable(add_lvalue_reference_t<_Ty>, add_lvalue_reference_t); _EXPORT_STD template -struct is_nothrow_move_assignable : bool_constant<__is_nothrow_assignable(add_lvalue_reference_t<_Ty>, _Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_move_assignable + : bool_constant<__is_nothrow_assignable(add_lvalue_reference_t<_Ty>, _Ty)> { // determine whether assignment of an rvalue _Ty to an lvalue _Ty is both valid and not potentially-throwing }; _EXPORT_STD template -constexpr bool is_nothrow_move_assignable_v = __is_nothrow_assignable(add_lvalue_reference_t<_Ty>, _Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_move_assignable_v = + __is_nothrow_assignable(add_lvalue_reference_t<_Ty>, _Ty); _EXPORT_STD template -struct is_nothrow_destructible : bool_constant<__is_nothrow_destructible(_Ty)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_destructible : bool_constant<__is_nothrow_destructible(_Ty)> { // determine whether remove_all_extents_t<_Ty> is a reference type or has // non-potentially-throwing explicit destruction }; _EXPORT_STD template -constexpr bool is_nothrow_destructible_v = __is_nothrow_destructible(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_destructible_v = __is_nothrow_destructible(_Ty); template > struct _Sign_base { // determine whether integral type _Ty is signed or unsigned @@ -985,19 +1101,20 @@ struct _Sign_base<_Ty, false> { // floating-point _Ty is signed }; _EXPORT_STD template -struct is_signed : bool_constant<_Sign_base<_Ty>::_Signed> {}; // determine whether _Ty is a signed type +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_signed : bool_constant<_Sign_base<_Ty>::_Signed> { + // determine whether _Ty is a signed type +}; _EXPORT_STD template -constexpr bool is_signed_v = _Sign_base<_Ty>::_Signed; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_signed_v = _Sign_base<_Ty>::_Signed; _EXPORT_STD template -struct is_unsigned : bool_constant<_Sign_base<_Ty>::_Unsigned> {}; // determine whether _Ty is an unsigned type +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_unsigned : bool_constant<_Sign_base<_Ty>::_Unsigned> { + // determine whether _Ty is an unsigned type +}; _EXPORT_STD template -constexpr bool is_unsigned_v = _Sign_base<_Ty>::_Unsigned; - -template -constexpr bool _Is_nonbool_integral = is_integral_v<_Ty> && !is_same_v, bool>; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_unsigned_v = _Sign_base<_Ty>::_Unsigned; template struct _Select { // Select between aliases that extract either their first or second parameter @@ -1044,7 +1161,7 @@ using _Make_signed1 = // signed partner to cv-unqualified _Ty typename _Make_signed2::template _Apply<_Ty>; _EXPORT_STD template -struct make_signed { // signed partner to _Ty +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS make_signed { // signed partner to _Ty static_assert(_Is_nonbool_integral<_Ty> || is_enum_v<_Ty>, "make_signed requires that T shall be a (possibly cv-qualified) " "integral type or enumeration but not a bool type."); @@ -1089,7 +1206,7 @@ using _Make_unsigned1 = // unsigned partner to cv-unqualified _Ty typename _Make_unsigned2::template _Apply<_Ty>; _EXPORT_STD template -struct make_unsigned { // unsigned partner to _Ty +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS make_unsigned { // unsigned partner to _Ty static_assert(_Is_nonbool_integral<_Ty> || is_enum_v<_Ty>, "make_unsigned requires that T shall be a (possibly cv-qualified) " "integral type or enumeration but not a bool type."); @@ -1106,10 +1223,11 @@ constexpr make_unsigned_t<_Rep> _Unsigned_value(_Rep _Val) { // makes _Val unsig } _EXPORT_STD template -struct alignment_of : integral_constant {}; // determine alignment of _Ty +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS alignment_of : integral_constant { +}; // determine alignment of _Ty _EXPORT_STD template -constexpr size_t alignment_of_v = alignof(_Ty); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr size_t alignment_of_v = alignof(_Ty); template union _Align_type { // union with size _Len bytes and alignment of _Ty @@ -1180,7 +1298,8 @@ template using _Aligned_storage_t = typename _Aligned_storage<_Len, _Align>::type; _EXPORT_STD template -struct _CXX23_DEPRECATE_ALIGNED_STORAGE aligned_storage { // define type with size _Len and alignment _Align +struct _CXX23_DEPRECATE_ALIGNED_STORAGE _NO_SPECIALIZATIONS_OF_TYPE_TRAITS aligned_storage { + // define type with size _Len and alignment _Align using type = _Aligned_storage_t<_Len, _Align>; }; @@ -1202,7 +1321,7 @@ struct _Maximum<_First, _Second, _Rest...> : _Maximum<(_First < _Second ? _Secon }; _EXPORT_STD template -struct _CXX23_DEPRECATE_ALIGNED_UNION aligned_union { +struct _CXX23_DEPRECATE_ALIGNED_UNION _NO_SPECIALIZATIONS_OF_TYPE_TRAITS aligned_union { // define type with size at least _Len, for storing anything in _Types static constexpr size_t _Max_len = _Maximum<_Len, sizeof(_Types)...>::value; // NOT sizeof...(_Types) static constexpr size_t alignment_value = _Maximum::value; @@ -1224,13 +1343,14 @@ template struct _Underlying_type<_Ty, false> {}; _EXPORT_STD template -struct underlying_type : _Underlying_type<_Ty> {}; // determine underlying type for enum +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS underlying_type : _Underlying_type<_Ty> { +}; // determine underlying type for enum _EXPORT_STD template using underlying_type_t = typename _Underlying_type<_Ty>::type; _EXPORT_STD template -constexpr size_t rank_v = 0; // determine number of dimensions of array _Ty +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr size_t rank_v = 0; // determine number of dimensions of array _Ty template constexpr size_t rank_v<_Ty[_Nx]> = rank_v<_Ty> + 1; @@ -1239,10 +1359,10 @@ template constexpr size_t rank_v<_Ty[]> = rank_v<_Ty> + 1; _EXPORT_STD template -struct rank : integral_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS rank : integral_constant> {}; _EXPORT_STD template -constexpr size_t extent_v = 0; // determine extent of dimension _Ix of array _Ty +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr size_t extent_v = 0; // determine extent of dimension _Ix of array _Ty template constexpr size_t extent_v<_Ty[_Nx], 0> = _Nx; @@ -1254,18 +1374,18 @@ template constexpr size_t extent_v<_Ty[], _Ix> = extent_v<_Ty, _Ix - 1>; _EXPORT_STD template -struct extent : integral_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS extent : integral_constant> {}; _EXPORT_STD template -struct is_base_of : bool_constant<__is_base_of(_Base, _Derived)> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_base_of : bool_constant<__is_base_of(_Base, _Derived)> { // determine whether _Base is a base of or the same as _Derived }; _EXPORT_STD template -constexpr bool is_base_of_v = __is_base_of(_Base, _Derived); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_base_of_v = __is_base_of(_Base, _Derived); _EXPORT_STD template -struct decay { // determines decayed version of _Ty +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS decay { // determines decayed version of _Ty using _Ty1 = remove_reference_t<_Ty>; using _Ty2 = typename _Select>::template _Apply, remove_cv<_Ty1>>; using type = typename _Select>::template _Apply>, _Ty2>::type; @@ -1302,7 +1422,7 @@ struct _Decayed_cond_oper<_Ty1, _Ty2, void_t<_Conditional_type<_Ty1, _Ty2>>> { }; _EXPORT_STD template -struct common_type; +struct common_type; // specializations allowed by N5014 [meta.trans.other]/5 _EXPORT_STD template using common_type_t = typename common_type<_Ty...>::type; @@ -1337,7 +1457,7 @@ _Ty _Returns_exactly() noexcept; // not defined #if _HAS_CXX20 _EXPORT_STD template class, template class> -struct basic_common_reference {}; +struct basic_common_reference {}; // specializations allowed by N5014 [meta.trans.other]/7 template struct _Copy_cv_impl { @@ -1384,7 +1504,8 @@ using _Cond_res = // N4950 [meta.trans.other]/2.4 decltype(false ? _Returns_exactly<_Ty1>() : _Returns_exactly<_Ty2>()); _EXPORT_STD template -struct common_reference; +struct _NO_SPECIALIZATIONS_CITING("N5014 [meta.rqmts]/4; instead, you should specialize std::basic_common_reference " + "as allowed by N5014 [meta.trans.other]/7") common_reference; _EXPORT_STD template using common_reference_t = common_reference<_Types...>::type; @@ -1490,7 +1611,7 @@ struct common_reference<_Ty1, _Ty2, _Ty3, _Rest...> : common_reference -struct type_identity { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS type_identity { using type = _Ty; }; _EXPORT_STD template @@ -1730,18 +1851,27 @@ struct _Is_nothrow_convertible : bool_constant<_Is_nothrow_convertible_v<_From, #if _HAS_CXX20 _EXPORT_STD template -constexpr bool is_nothrow_convertible_v = _Is_nothrow_convertible_v<_From, _To>; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_convertible_v = _Is_nothrow_convertible_v<_From, _To>; _EXPORT_STD template -struct is_nothrow_convertible : bool_constant<_Is_nothrow_convertible_v<_From, _To>> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_convertible + : bool_constant<_Is_nothrow_convertible_v<_From, _To>> {}; #endif // _HAS_CXX20 template struct _Invoke_convertible : false_type {}; +#ifdef __cpp_lib_reference_from_temporary +template +using _Not_reference_converts_from_temporary = bool_constant>; +#else // ^^^ defined(__cpp_lib_reference_from_temporary) / !defined(__cpp_lib_reference_from_temporary) vvv +template +using _Not_reference_converts_from_temporary = true_type; +#endif // ^^^ !defined(__cpp_lib_reference_from_temporary) ^^^ + template struct _Invoke_convertible<_From, _To, void_t(_STD _Returns_exactly<_From>()))>> - : true_type {}; + : _Not_reference_converts_from_temporary<_To, _From> {}; template struct _Invoke_nothrow_convertible @@ -1805,7 +1935,7 @@ using _Select_invoke_traits = conditional_t -struct _CXX17_DEPRECATE_RESULT_OF result_of { // explain usage +struct _CXX17_DEPRECATE_RESULT_OF _NO_SPECIALIZATIONS_OF_TYPE_TRAITS result_of { // explain usage static_assert(_Always_false<_Fty>, "result_of is invalid; use " "result_of instead."); }; @@ -1838,7 +1968,7 @@ struct _Is_invocable_r : _Is_invocable_r_<_Rx, _Callable, _Args...> { #if _HAS_CXX17 _EXPORT_STD template -struct invoke_result : _Select_invoke_traits<_Callable, _Args...> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS invoke_result : _Select_invoke_traits<_Callable, _Args...> { // determine the result type of invoking _Callable with _Args }; @@ -1846,60 +1976,81 @@ _EXPORT_STD template using invoke_result_t = typename _Select_invoke_traits<_Callable, _Args...>::type; _EXPORT_STD template -struct is_invocable : _Select_invoke_traits<_Callable, _Args...>::_Is_invocable { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_invocable : _Select_invoke_traits<_Callable, _Args...>::_Is_invocable { // determines whether _Callable is callable with _Args }; _EXPORT_STD template -constexpr bool is_invocable_v = _Select_invoke_traits<_Callable, _Args...>::_Is_invocable::value; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_invocable_v = + _Select_invoke_traits<_Callable, _Args...>::_Is_invocable::value; _EXPORT_STD template -struct is_nothrow_invocable : _Select_invoke_traits<_Callable, _Args...>::_Is_nothrow_invocable { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_invocable + : _Select_invoke_traits<_Callable, _Args...>::_Is_nothrow_invocable { // determines whether _Callable is nothrow-callable with _Args }; _EXPORT_STD template -constexpr bool is_nothrow_invocable_v = _Select_invoke_traits<_Callable, _Args...>::_Is_nothrow_invocable::value; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_invocable_v = + _Select_invoke_traits<_Callable, _Args...>::_Is_nothrow_invocable::value; _EXPORT_STD template -struct is_invocable_r : _Is_invocable_r_<_Rx, _Callable, _Args...> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_invocable_r : _Is_invocable_r_<_Rx, _Callable, _Args...> { // determines whether _Callable is callable with _Args and return type _Rx }; _EXPORT_STD template -constexpr bool is_invocable_r_v = _Is_invocable_r_<_Rx, _Callable, _Args...>::value; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_invocable_r_v = _Is_invocable_r_<_Rx, _Callable, _Args...>::value; _EXPORT_STD template -struct is_nothrow_invocable_r : _Select_invoke_traits<_Callable, _Args...>::template _Is_nothrow_invocable_r<_Rx> { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_invocable_r + : _Select_invoke_traits<_Callable, _Args...>::template _Is_nothrow_invocable_r<_Rx> { // determines whether _Callable is nothrow-callable with _Args and return type _Rx }; _EXPORT_STD template -constexpr bool is_nothrow_invocable_r_v = +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_invocable_r_v = _Select_invoke_traits<_Callable, _Args...>::template _Is_nothrow_invocable_r<_Rx>::value; #endif // _HAS_CXX17 #if _HAS_CXX20 -#ifndef __clang__ // TRANSITION, LLVM-48860 +#if !defined(__clang__) || defined(__EDG__) \ + || __clang_major__ >= 19 // TRANSITION, VSO-2397560 (RWC relying on ancient Clang) _EXPORT_STD template -struct is_layout_compatible : bool_constant<__is_layout_compatible(_Ty1, _Ty2)> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_layout_compatible : bool_constant<__is_layout_compatible(_Ty1, _Ty2)> {}; _EXPORT_STD template -constexpr bool is_layout_compatible_v = __is_layout_compatible(_Ty1, _Ty2); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_layout_compatible_v = __is_layout_compatible(_Ty1, _Ty2); +#if !defined(__clang__) || defined(__EDG__) // TRANSITION, LLVM-135273 _EXPORT_STD template -struct is_pointer_interconvertible_base_of : bool_constant<__is_pointer_interconvertible_base_of(_Base, _Derived)> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_pointer_interconvertible_base_of + : bool_constant<__is_pointer_interconvertible_base_of(_Base, _Derived)> {}; _EXPORT_STD template -constexpr bool is_pointer_interconvertible_base_of_v = __is_pointer_interconvertible_base_of(_Base, _Derived); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_pointer_interconvertible_base_of_v = + __is_pointer_interconvertible_base_of(_Base, _Derived); +#else // ^^^ no workaround / workaround vvv +_EXPORT_STD template +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_pointer_interconvertible_base_of + : bool_constant<__is_pointer_interconvertible_base_of(remove_cv_t<_Base>, remove_cv_t<_Derived>)> {}; +_EXPORT_STD template +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_pointer_interconvertible_base_of_v = + __is_pointer_interconvertible_base_of(remove_cv_t<_Base>, remove_cv_t<_Derived>); +#endif // ^^^ workaround ^^^ +#endif // ^^^ no workaround ^^^ + +#ifndef __clang__ // TRANSITION, LLVM-48860 _EXPORT_STD template -_NODISCARD constexpr bool is_pointer_interconvertible_with_class(_MemberTy _ClassTy::* _Pm) noexcept { +_NODISCARD _NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_pointer_interconvertible_with_class( + _MemberTy _ClassTy::* _Pm) noexcept { return __is_pointer_interconvertible_with_class(_ClassTy, _Pm); } _EXPORT_STD template -_NODISCARD constexpr bool is_corresponding_member(_MemberTy1 _ClassTy1::* _Pm1, _MemberTy2 _ClassTy2::* _Pm2) noexcept { +_NODISCARD _NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_corresponding_member( + _MemberTy1 _ClassTy1::* _Pm1, _MemberTy2 _ClassTy2::* _Pm2) noexcept { return __is_corresponding_member(_ClassTy1, _ClassTy2, _Pm1, _Pm2); } #endif // ^^^ no workaround ^^^ @@ -2050,7 +2201,7 @@ _NODISCARD _CONSTEXPR20 reference_wrapper cref(reference_wrapper<_Ty> #if _HAS_CXX20 _EXPORT_STD template -struct unwrap_reference { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS unwrap_reference { using type = _Ty; }; template @@ -2063,7 +2214,7 @@ using unwrap_reference_t = unwrap_reference<_Ty>::type; _EXPORT_STD template using unwrap_ref_decay_t = unwrap_reference_t>; _EXPORT_STD template -struct unwrap_ref_decay { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS unwrap_ref_decay { using type = unwrap_ref_decay_t<_Ty>; }; #endif // _HAS_CXX20 @@ -2124,37 +2275,40 @@ struct _Is_nothrow_swappable #if _HAS_CXX17 _EXPORT_STD template -struct is_swappable_with : _Is_swappable_with<_Ty1, _Ty2>::type { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_swappable_with : _Is_swappable_with<_Ty1, _Ty2>::type { // Determine if expressions with type and value category _Ty1 and _Ty2 // can be swapped (and vice versa) }; _EXPORT_STD template -constexpr bool is_swappable_with_v = +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_swappable_with_v = conjunction_v<_Swappable_with_helper<_Ty1, _Ty2>, _Swappable_with_helper<_Ty2, _Ty1>>; _EXPORT_STD template -struct is_swappable : _Is_swappable<_Ty>::type {}; // Determine if _Ty lvalues satisfy is_swappable_with +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_swappable : _Is_swappable<_Ty>::type { + // Determine if _Ty lvalues satisfy is_swappable_with +}; _EXPORT_STD template -constexpr bool is_swappable_v = _Is_swappable<_Ty>::value; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_swappable_v = _Is_swappable<_Ty>::value; _EXPORT_STD template -struct is_nothrow_swappable_with : _Is_nothrow_swappable_with<_Ty1, _Ty2>::type { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_swappable_with : _Is_nothrow_swappable_with<_Ty1, _Ty2>::type { // Determine if expressions with type and value category _Ty1 and _Ty2 // satisfy is_swappable_with, and can be swapped without emitting exceptions }; _EXPORT_STD template -constexpr bool is_nothrow_swappable_with_v = _Is_nothrow_swappable_with<_Ty1, _Ty2>::value; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_swappable_with_v = + _Is_nothrow_swappable_with<_Ty1, _Ty2>::value; _EXPORT_STD template -struct is_nothrow_swappable : _Is_nothrow_swappable<_Ty>::type { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_nothrow_swappable : _Is_nothrow_swappable<_Ty>::type { // Determine if _Ty lvalues satisfy is_nothrow_swappable_with }; _EXPORT_STD template -constexpr bool is_nothrow_swappable_v = _Is_nothrow_swappable<_Ty>::value; +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_swappable_v = _Is_nothrow_swappable<_Ty>::value; #endif // _HAS_CXX17 namespace _Has_ADL_swap_detail { @@ -2539,77 +2693,10 @@ void _Swap_trivial_arrays(_Ty (&_Left)[_Size], _Ty (&_Right)[_Size]) noexcept { *reinterpret_cast<_Last_buffer_type*>(_Right_ptr) = _Last_buffer; } } - -#if _HAS_TR1_NAMESPACE -_STL_DISABLE_DEPRECATED_WARNING -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _STD add_const; - using _STD add_cv; - using _STD add_pointer; - using _STD add_volatile; - using _STD aligned_storage; - using _STD alignment_of; - using _STD conditional; - using _STD decay; - using _STD enable_if; - using _STD extent; - using _STD false_type; - using _STD has_virtual_destructor; - using _STD integral_constant; - using _STD is_abstract; - using _STD is_arithmetic; - using _STD is_array; - using _STD is_base_of; - using _STD is_class; - using _STD is_compound; - using _STD is_const; - using _STD is_convertible; - using _STD is_empty; - using _STD is_enum; - using _STD is_floating_point; - using _STD is_function; - using _STD is_fundamental; - using _STD is_integral; - using _STD is_member_function_pointer; - using _STD is_member_object_pointer; - using _STD is_member_pointer; - using _STD is_object; - using _STD is_pod; - using _STD is_pointer; - using _STD is_polymorphic; - using _STD is_reference; - using _STD is_same; - using _STD is_scalar; - using _STD is_signed; - using _STD is_union; - using _STD is_unsigned; - using _STD is_void; - using _STD is_volatile; - using _STD make_signed; - using _STD make_unsigned; - using _STD rank; - using _STD remove_all_extents; - using _STD remove_const; - using _STD remove_cv; - using _STD remove_extent; - using _STD remove_pointer; - using _STD remove_reference; - using _STD remove_volatile; - using _STD true_type; - using _STD cref; - using _STD ref; - using _STD reference_wrapper; -#if _HAS_DEPRECATED_RESULT_OF - using _STD result_of; -#endif // _HAS_DEPRECATED_RESULT_OF - using _STD hash; -} // namespace _DEPRECATE_TR1_NAMESPACE tr1 -_STL_RESTORE_DEPRECATED_WARNING -#endif // _HAS_TR1_NAMESPACE - _STD_END // TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") #pragma pop_macro("known_semantics") #pragma pop_macro("intrinsic") #pragma pop_macro("msvc") diff --git a/stl/inc/unordered_map b/stl/inc/unordered_map index b7f4891cf82..2292fb3dc64 100644 --- a/stl/inc/unordered_map +++ b/stl/inc/unordered_map @@ -38,8 +38,7 @@ public: _Node_handle_map_base, _Kty, _Ty>; #endif // _HAS_CXX17 - static constexpr bool _Multi = _Mfl; - static constexpr bool _Standard = true; + static constexpr bool _Multi = _Mfl; template using _In_place_key_extractor = _In_place_key_extract_map<_Kty, _Args...>; @@ -48,8 +47,6 @@ public: explicit _Umap_traits(const _Tr& _Traits) noexcept(is_nothrow_copy_constructible_v<_Tr>) : _Tr(_Traits) {} - using value_compare = void; // TRANSITION, remove when _Standard becomes unconditionally true - template static const _Kty& _Kfn(const pair<_Ty1, _Ty2>& _Val) noexcept { // extract key from element value return _Val.first; @@ -918,13 +915,6 @@ _NODISCARD bool operator!=(const unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, } #endif // !_HAS_CXX20 -#if _HAS_TR1_NAMESPACE -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _STD unordered_map; - using _STD unordered_multimap; -} // namespace _DEPRECATE_TR1_NAMESPACE tr1 -#endif // _HAS_TR1_NAMESPACE - #if _HAS_CXX17 namespace pmr { _EXPORT_STD template , class _Keyeq = equal_to<_Kty>> diff --git a/stl/inc/unordered_set b/stl/inc/unordered_set index 0f41d148e97..8b33a274f02 100644 --- a/stl/inc/unordered_set +++ b/stl/inc/unordered_set @@ -37,8 +37,7 @@ public: _Node_handle_set_base, _Kty>; #endif // _HAS_CXX17 - static constexpr bool _Multi = _Mfl; - static constexpr bool _Standard = true; + static constexpr bool _Multi = _Mfl; template using _In_place_key_extractor = _In_place_key_extract_set<_Kty, _Args...>; @@ -47,8 +46,6 @@ public: explicit _Uset_traits(const _Tr& _Traits) noexcept(is_nothrow_copy_constructible_v<_Tr>) : _Tr(_Traits) {} - using value_compare = void; // TRANSITION, remove when _Standard becomes unconditionally true - static const _Kty& _Kfn(const value_type& _Val) noexcept { return _Val; } @@ -746,13 +743,6 @@ _NODISCARD bool operator!=(const unordered_multiset<_Kty, _Hasher, _Keyeq, _Allo } #endif // !_HAS_CXX20 -#if _HAS_TR1_NAMESPACE -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _STD unordered_multiset; - using _STD unordered_set; -} // namespace _DEPRECATE_TR1_NAMESPACE tr1 -#endif // _HAS_TR1_NAMESPACE - #if _HAS_CXX17 namespace pmr { _EXPORT_STD template , class _Keyeq = equal_to<_Kty>> diff --git a/stl/inc/utility b/stl/inc/utility index dd4d327ea21..ceb98ae3ee1 100644 --- a/stl/inc/utility +++ b/stl/inc/utility @@ -31,10 +31,12 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("intrinsic") #pragma push_macro("known_semantics") #pragma push_macro("lifetimebound") +#pragma push_macro("no_specializations") #undef msvc #undef intrinsic #undef known_semantics #undef lifetimebound +#undef no_specializations _STD_BEGIN _EXPORT_STD template @@ -158,7 +160,7 @@ struct _Ignore { // struct that ignores assignments _EXPORT_STD _INLINE_VAR constexpr _Ignore ignore{}; _EXPORT_STD template -class tuple; +class _NO_SPECIALIZATIONS_CITING("N5014 [tuple.tuple.general]/1") tuple; _EXPORT_STD template struct pair; @@ -170,7 +172,7 @@ _EXPORT_STD template struct tuple_size; _EXPORT_STD template -constexpr size_t tuple_size_v = tuple_size<_Ty>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr size_t tuple_size_v = tuple_size<_Ty>::value; _EXPORT_STD template struct tuple_element; @@ -273,6 +275,14 @@ struct pair { // store a pair of values is_nothrow_constructible_v<_Ty1, _Other1> && is_nothrow_constructible_v<_Ty2, _Other2>) // strengthened : first(_STD forward<_Other1>(_Val1)), second(_STD forward<_Other2>(_Val2)) { } +#ifdef __cpp_lib_reference_from_temporary + template , is_constructible<_Ty2, _Other2>>, int> = 0> + requires reference_constructs_from_temporary_v<_Ty1, _Other1&&> + || reference_constructs_from_temporary_v<_Ty2, _Other2&&> + explicit(!conjunction_v, is_convertible<_Other2, _Ty2>>) + pair(_Other1&&, _Other2&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ pair(const pair&) = default; pair(pair&&) = default; @@ -284,6 +294,14 @@ struct pair { // store a pair of values pair(pair<_Other1, _Other2>& _Right) noexcept( is_nothrow_constructible_v<_Ty1, _Other1&> && is_nothrow_constructible_v<_Ty2, _Other2&>) // strengthened : first(_Right.first), second(_Right.second) {} +#ifdef __cpp_lib_reference_from_temporary + template + requires is_constructible_v<_Ty1, _Other1&> && is_constructible_v<_Ty2, _Other2&> + && (reference_constructs_from_temporary_v<_Ty1, _Other1&> + || reference_constructs_from_temporary_v<_Ty2, _Other2&>) + explicit(!conjunction_v, is_convertible<_Other2&, _Ty2>>) + pair(pair<_Other1, _Other2>&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #endif // _HAS_CXX23 template && is_nothrow_constructible_v<_Ty2, const _Other2&>) // strengthened : first(_Right.first), second(_Right.second) {} +#ifdef __cpp_lib_reference_from_temporary + template , is_constructible<_Ty2, const _Other2&>>, + int> = 0> + requires reference_constructs_from_temporary_v<_Ty1, const _Other1&> + || reference_constructs_from_temporary_v<_Ty2, const _Other2&> + explicit(!conjunction_v, is_convertible>) + pair(const pair<_Other1, _Other2>&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ template , is_constructible<_Ty2, _Other2>>, int> = 0> @@ -301,6 +328,14 @@ struct pair { // store a pair of values pair(pair<_Other1, _Other2>&& _Right) noexcept( is_nothrow_constructible_v<_Ty1, _Other1> && is_nothrow_constructible_v<_Ty2, _Other2>) // strengthened : first(_STD forward<_Other1>(_Right.first)), second(_STD forward<_Other2>(_Right.second)) {} +#ifdef __cpp_lib_reference_from_temporary + template , is_constructible<_Ty2, _Other2>>, int> = 0> + requires reference_constructs_from_temporary_v<_Ty1, _Other1&&> + || reference_constructs_from_temporary_v<_Ty2, _Other2&&> + explicit(!conjunction_v, is_convertible<_Other2, _Ty2>>) + pair(pair<_Other1, _Other2>&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #if _HAS_CXX23 template @@ -310,6 +345,14 @@ struct pair { // store a pair of values noexcept(is_nothrow_constructible_v<_Ty1, const _Other1> && is_nothrow_constructible_v<_Ty2, const _Other2>) // strengthened : first(_STD forward(_Right.first)), second(_STD forward(_Right.second)) {} +#ifdef __cpp_lib_reference_from_temporary + template + requires is_constructible_v<_Ty1, const _Other1> && is_constructible_v<_Ty2, const _Other2> + && (reference_constructs_from_temporary_v<_Ty1, const _Other1 &&> + || reference_constructs_from_temporary_v<_Ty2, const _Other2 &&>) + explicit(!conjunction_v, is_convertible>) + pair(const pair<_Other1, _Other2>&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #ifdef __EDG__ // TRANSITION, VSO-1900279 template , int> = 0> @@ -324,6 +367,15 @@ struct pair { // store a pair of values && is_nothrow_constructible_v<_Ty2, decltype(_STD get<1>(_STD declval<_Other>()))>) // strengthened : first(_STD get<0>(_STD forward<_Other>(_Right))), second(_STD get<1>(_STD forward<_Other>(_Right))) { } +#ifdef __cpp_lib_reference_from_temporary + template <_Pair_like_non_subrange _Other> + requires conjunction_v(_STD declval<_Other>()))>, + is_constructible<_Ty2, decltype(_STD get<1>(_STD declval<_Other>()))>> + && (reference_constructs_from_temporary_v<_Ty1, decltype(_STD get<0>(_STD declval<_Other>()))> + || reference_constructs_from_temporary_v<_Ty2, decltype(_STD get<1>(_STD declval<_Other>()))>) + explicit(!conjunction_v(_STD declval<_Other>())), _Ty1>, + is_convertible(_STD declval<_Other>())), _Ty2>>) pair(_Other&&) = delete; +#endif // ^^^ defined(__cpp_lib_reference_from_temporary) ^^^ #endif // _HAS_CXX23 template @@ -1009,18 +1061,10 @@ struct hash { } }; #endif // _HAS_CXX17 - -#if _HAS_TR1_NAMESPACE -namespace _DEPRECATE_TR1_NAMESPACE tr1 { - using _STD get; - using _STD tuple_element; - using _STD tuple_size; -} // namespace _DEPRECATE_TR1_NAMESPACE tr1 -#endif // _HAS_TR1_NAMESPACE - _STD_END // TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") #pragma pop_macro("lifetimebound") #pragma pop_macro("known_semantics") #pragma pop_macro("intrinsic") diff --git a/stl/inc/variant b/stl/inc/variant index c17d88fe17e..6cddd331a9c 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -28,6 +28,12 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +// TRANSITION, non-_Ugly attribute tokens +#pragma push_macro("msvc") +#pragma push_macro("no_specializations") +#undef msvc +#undef no_specializations + _STD_BEGIN template @@ -283,7 +289,7 @@ struct _Meta_cartesian_product_<_List1<_List2<_Items...>, _Lists...>> { #define _STL_STAMP(n, x) x(_STL_STAMP##n, n) _EXPORT_STD template -class variant; +class _NO_SPECIALIZATIONS_CITING("N5014 [variant.variant.general]/4") variant; _EXPORT_STD template struct variant_size; // undefined @@ -294,7 +300,7 @@ struct _CXX20_DEPRECATE_VOLATILE variant_size : variant_size<_Ty>: template struct _CXX20_DEPRECATE_VOLATILE variant_size : variant_size<_Ty>::type {}; _EXPORT_STD template -constexpr size_t variant_size_v = variant_size<_Ty>::value; +_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr size_t variant_size_v = variant_size<_Ty>::value; template struct variant_size> : integral_constant {}; @@ -928,7 +934,8 @@ template constexpr bool _Is_in_place_index_specialization> = true; _EXPORT_STD template -class variant : private _SMF_control<_Variant_destroy_layer<_Types...>, _Types...> { // discriminated union +class _NO_SPECIALIZATIONS_CITING("N5014 [variant.variant.general]/4") variant + : private _SMF_control<_Variant_destroy_layer<_Types...>, _Types...> { // discriminated union public: static_assert(conjunction_v..., negation>..., is_destructible<_Types>...>, "variant requires all of the Types to meet the Cpp17Destructible requirements " @@ -1684,6 +1691,10 @@ _STD_END #undef _STL_STAMP16 #undef _STL_STAMP4 +// TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") +#pragma pop_macro("msvc") + #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/vector b/stl/inc/vector index cba1b643057..e51c27ea84f 100644 --- a/stl/inc/vector +++ b/stl/inc/vector @@ -607,17 +607,17 @@ private: using _Scary_val = _Vector_val, _Simple_types<_Ty>, _Vec_iter_types<_Ty, size_type, difference_type, pointer, const_pointer>>>; - struct _NODISCARD _Reallocation_guard { - _Alloc& _Al; + struct _NODISCARD _Reallocation_guard2 { + _Alty& _Al; pointer _New_begin; size_type _New_capacity; pointer _Constructed_first; pointer _Constructed_last; - _Reallocation_guard& operator=(const _Reallocation_guard&) = delete; - _Reallocation_guard& operator=(_Reallocation_guard&&) = delete; + _Reallocation_guard2& operator=(const _Reallocation_guard2&) = delete; + _Reallocation_guard2& operator=(_Reallocation_guard2&&) = delete; - _CONSTEXPR20 ~_Reallocation_guard() noexcept { + _CONSTEXPR20 ~_Reallocation_guard2() noexcept { if (_New_begin != nullptr) { _STD _Destroy_range(_Constructed_first, _Constructed_last, _Al); _Al.deallocate(_New_begin, _New_capacity); @@ -625,15 +625,15 @@ private: } }; - struct _NODISCARD _Simple_reallocation_guard { - _Alloc& _Al; + struct _NODISCARD _Simple_reallocation_guard2 { + _Alty& _Al; pointer _New_begin; size_type _New_capacity; - _Simple_reallocation_guard& operator=(const _Simple_reallocation_guard&) = delete; - _Simple_reallocation_guard& operator=(_Simple_reallocation_guard&&) = delete; + _Simple_reallocation_guard2& operator=(const _Simple_reallocation_guard2&) = delete; + _Simple_reallocation_guard2& operator=(_Simple_reallocation_guard2&&) = delete; - _CONSTEXPR20 ~_Simple_reallocation_guard() noexcept { + _CONSTEXPR20 ~_Simple_reallocation_guard2() noexcept { if (_New_begin != nullptr) { _Al.deallocate(_New_begin, _New_capacity); } @@ -894,7 +894,7 @@ private: const pointer _Newvec = _STD _Allocate_at_least_helper(_Al, _Newcapacity); const pointer _Constructed_last = _Newvec + static_cast<_Iter_diff_t>(_Whereoff + 1); - _Reallocation_guard _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last}; + _Reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last}; auto& _Constructed_first = _Guard._Constructed_first; _Alty_traits::construct(_Al, _STD _Unfancy(_Newvec + _Whereoff), _STD forward<_Valty>(_Val)...); @@ -979,7 +979,7 @@ private: const pointer _Newvec = _Allocate_at_least_helper(_Al, _Newcapacity); const pointer _Constructed_last = _Newvec + _Oldsize + _Count; - _Reallocation_guard _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last}; + _Reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last}; auto& _Constructed_first = _Guard._Constructed_first; _Uninitialized_copy_n(_STD move(_First), _Count, _Newvec + _Oldsize, _Al); @@ -1097,7 +1097,7 @@ public: const pointer _Newvec = _Allocate_at_least_helper(_Al, _Newcapacity); const pointer _Constructed_last = _Newvec + _Whereoff + _Count; - _Reallocation_guard _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last}; + _Reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last}; auto& _Constructed_first = _Guard._Constructed_first; _Uninitialized_fill_n(_Newvec + _Whereoff, _Count, _Val, _Al); @@ -1190,7 +1190,7 @@ private: const auto _Whereoff = static_cast(_Whereptr - _Oldfirst); const pointer _Constructed_last = _Newvec + _Whereoff + _Count; - _Reallocation_guard _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last}; + _Reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last}; auto& _Constructed_first = _Guard._Constructed_first; _STD _Uninitialized_copy_n(_STD move(_First), _Count, _Newvec + _Whereoff, _Al); @@ -1566,7 +1566,7 @@ private: const pointer _Newvec = _Allocate_at_least_helper(_Al, _Newcapacity); const pointer _Appended_first = _Newvec + _Oldsize; - _Reallocation_guard _Guard{_Al, _Newvec, _Newcapacity, _Appended_first, _Appended_first}; + _Reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity, _Appended_first, _Appended_first}; auto& _Appended_last = _Guard._Constructed_last; if constexpr (is_same_v<_Ty2, _Ty>) { @@ -1657,7 +1657,7 @@ private: _Newvec = _Al.allocate(_Newcapacity); } - _Simple_reallocation_guard _Guard{_Al, _Newvec, _Newcapacity}; + _Simple_reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity}; if constexpr (is_nothrow_move_constructible_v<_Ty> || !is_copy_constructible_v<_Ty>) { _Uninitialized_move(_Myfirst, _Mylast, _Newvec, _Al); @@ -3739,7 +3739,11 @@ _NODISCARD _CONSTEXPR20 _VbIt _Find_vbool(_VbIt _First, const _VbIt _Last, const const auto _SourceMask = _FirstSourceMask & _LastSourceMask; const auto _SelectVal = (_Val ? *_VbFirst : ~*_VbFirst) & _SourceMask; const auto _Count = _Countr_zero(_SelectVal); - return _Count == _VBITS ? _Last : _First + static_cast<_Iter_diff_t<_VbIt>>(_Count - _First._Myoff); + if (_Count == _VBITS) { + return _Last; + } else { + return _First + static_cast<_Iter_diff_t<_VbIt>>(_Count - _First._Myoff); + } } const auto _FirstVal = (_Val ? *_VbFirst : ~*_VbFirst) & _FirstSourceMask; @@ -3860,7 +3864,7 @@ _CONSTEXPR20 _OutIt _Copy_vbool(_VbIt _First, _VbIt _Last, _OutIt _Dest) { const auto _DestMask = _FirstDestMask | (_DestEnd._Myoff == 0 ? 0 : _LastDestMask); if (_Last._Myoff != 0) { - const auto _LastShift = _DestEnd._Myoff - _Last._Myoff; + const auto _LastShift = _DestEnd._Myoff != 0 ? _DestEnd._Myoff - _Last._Myoff : _VBITS - _Last._Myoff; const auto _LastSourceVal = (*_VbLast & _LastSourceMask) << _LastShift; *_VbDest = (*_VbDest & _DestMask) | _SourceVal | _LastSourceVal; } else { diff --git a/stl/inc/xhash b/stl/inc/xhash index 4acd8622e13..65cbb0a92df 100644 --- a/stl/inc/xhash +++ b/stl/inc/xhash @@ -13,11 +13,11 @@ #include #include -#ifdef _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS +#ifdef _LEGACY_CODE_ASSUMES_XHASH_INCLUDES_XSTRING #include #include #include -#endif // _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS +#endif // _LEGACY_CODE_ASSUMES_XHASH_INCLUDES_XSTRING #if _HAS_CXX17 #include @@ -30,68 +30,6 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new -#ifdef _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -_STDEXT_BEGIN -template -_NODISCARD size_t hash_value(const _Kty& _Keyval) noexcept { - if constexpr (_STD is_pointer_v<_Kty> || _STD is_null_pointer_v<_Kty>) { - return reinterpret_cast(_Keyval) ^ 0xdeadbeefu; - } else { - return static_cast(_Keyval) ^ 0xdeadbeefu; - } -} - -template -_NODISCARD size_t hash_value(const _STD basic_string<_Elem, _Traits, _Alloc>& _Str) noexcept { - return _STD _Hash_array_representation(_Str.c_str(), _Str.size()); -} - -_NODISCARD inline size_t hash_value(_In_z_ const char* _Str) noexcept { - return _STD _Hash_array_representation(_Str, _CSTD strlen(_Str)); -} - -_NODISCARD inline size_t hash_value(_In_z_ const wchar_t* _Str) noexcept { - return _STD _Hash_array_representation(_Str, _CSTD wcslen(_Str)); -} - -template > -class hash_compare { // traits class for hash containers -public: - enum { // parameters for hash table - bucket_size = 1 // 0 < bucket_size - }; - - hash_compare() = default; - hash_compare(const _Pr& _Pred) noexcept(_STD is_nothrow_copy_constructible_v<_Pr>) : comp(_Pred) {} - - _NODISCARD size_t operator()(const _Kty& _Keyval) const noexcept(noexcept(hash_value(_Keyval))) { - long _Quot = static_cast(hash_value(_Keyval) & LONG_MAX); // TRANSITION, ADL? - ldiv_t _Qrem = _CSTD ldiv(_Quot, 127773); - - _Qrem.rem = 16807 * _Qrem.rem - 2836 * _Qrem.quot; - if (_Qrem.rem < 0) { - _Qrem.rem += LONG_MAX; - } - - return static_cast(_Qrem.rem); - } - - _NODISCARD bool operator()(const _Kty& _Keyval1, const _Kty& _Keyval2) const - noexcept(noexcept(comp(_Keyval1, _Keyval2))) { - // test if _Keyval1 ordered before _Keyval2 - return comp(_Keyval1, _Keyval2); - } - - _Pr comp{}; // the comparator object -}; -_STDEXT_END - -_STD_BEGIN -using stdext::hash_compare; // Non-Standard, for legacy source compatibility -_STD_END - -#endif // _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS - _STD_BEGIN template struct _Uhash_choose_transparency { @@ -332,9 +270,7 @@ protected: using _Node = typename _Mylist::_Node; using _Nodeptr = typename _Mylist::_Nodeptr; using _Mutable_value_type = typename _Traits::_Mutable_value_type; - - using _Key_compare = typename _Traits::key_compare; - using _Value_compare = typename _Traits::value_compare; + using _Key_compare = typename _Traits::key_compare; public: using key_type = typename _Traits::key_type; @@ -1194,12 +1130,6 @@ private: const _Nodeptr _Bucket_hi = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]._Ptr; for (;;) { if (!_Traitsobj(_Traits::_Kfn(_Where->_Myval), _Keyval)) { - if constexpr (!_Traits::_Standard) { - if (_Traitsobj(_Keyval, _Traits::_Kfn(_Where->_Myval))) { - return _End; - } - } - return _Where; } @@ -1307,12 +1237,6 @@ private: } } - if constexpr (!_Traits::_Standard) { - if (_Traitsobj(_Keyval, _Traits::_Kfn(*_Where))) { - return {_End, _End, 0}; - } - } - const _Unchecked_const_iterator _First = _Where; if constexpr (_Multi) { size_type _Distance = 0; @@ -1591,14 +1515,8 @@ protected: const _Nodeptr _Bucket_lo = _Vec._Mypair._Myval2._Myfirst[_Bucket << 1]._Ptr; for (;;) { - // Search backwards to maintain sorted [_Bucket_lo, _Bucket_hi] when !_Standard + // Search backwards for historical reasons if (!_Traitsobj(_Keyval, _Traits::_Kfn(_Where->_Myval))) { - if constexpr (!_Traits::_Standard) { - if (_Traitsobj(_Traits::_Kfn(_Where->_Myval), _Keyval)) { - return {_Where->_Next, _Nodeptr{}}; - } - } - return {_Where->_Next, _Where}; } @@ -1616,12 +1534,6 @@ 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 (!_Traits::_Standard) { - if (_Traitsobj(_Keyval, _Traits::_Kfn(_Hint->_Myval))) { - return _Find_last(_Keyval, _Hashval); - } - } - return {_Hint->_Next, _Hint}; } @@ -1759,7 +1671,7 @@ protected: const size_type _Bucket = bucket(_Inserted_key); // _Bucket_lo and _Bucket_hi are the *inclusive* range of elements in the bucket, or _Unchecked_end() if - // the bucket is empty; if !_Standard then [_Bucket_lo, _Bucket_hi] is a sorted range. + // the bucket is empty. _Unchecked_iterator& _Bucket_lo = _Vec._Mypair._Myval2._Myfirst[_Bucket << 1]; _Unchecked_iterator& _Bucket_hi = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]; @@ -1785,13 +1697,11 @@ protected: } // The insertion point isn't *_Bucket_hi, so search [_Bucket_lo, _Bucket_hi) for insertion point; we - // go backwards to maintain sortedness when !_Standard. + // go backwards for historical reasons. for (;;) { if (_Bucket_lo == _Insert_before) { // There are no equivalent keys in the bucket, so insert it at the beginning. - // Element can't be already in position here because: - // * (for !_Standard) _Inserted_key < *_Insert_before or - // * (for _Standard) _Inserted_key != *_Insert_before + // Element can't be already in position here because _Inserted_key != *_Insert_before _Mylist::_Scary_val::_Unchecked_splice(_Insert_before._Ptr, _Inserted._Ptr, _Next_inserted._Ptr); _Bucket_lo = _Inserted; break; @@ -1858,21 +1768,7 @@ protected: } } - _Unchecked_const_iterator _Left_stop_at; - if constexpr (_Traits::_Standard) { - _Left_stop_at = _Unchecked_end(); - } else { - // check the first elements for equivalence when !_Standard - if (_Right._Traitsobj(_Keyval, _Traits::_Kfn(*_First2))) { - return {}; - } - - const size_t _LHashval = _Traitsobj(_Keyval); - const size_type _LBucket = _LHashval & _Mask; - const auto _LBucket_hi = _Vec._Mypair._Myval2._Myfirst[(_LBucket << 1) + 1]; - _Left_stop_at = _LBucket_hi; - ++_Left_stop_at; - } + _Unchecked_const_iterator _Left_stop_at = _Unchecked_end(); // trim matching prefixes while (*_First1 == *_First2) { @@ -1967,27 +1863,6 @@ public: _Unchecked_const_iterator _Where = _Vec._Mypair._Myval2._Myfirst[_Bucket << 1]; 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 (!_Traits::_Standard) { - if (_Where != _Bucket_hi) { - auto _SFirst = _Where; - auto _SNext = _Where; - for (;;) { - ++_SNext; - if constexpr (_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/xmemory b/stl/inc/xmemory index e672b7f59a1..8ea8ec27d52 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -27,7 +27,9 @@ _STL_DISABLE_CLANG_WARNINGS // TRANSITION, non-_Ugly attribute tokens #pragma push_macro("msvc") +#pragma push_macro("no_specializations") #undef msvc +#undef no_specializations #if _USE_STD_VECTOR_ALGORITHMS extern "C" { @@ -555,7 +557,7 @@ struct allocation_result { #endif // _HAS_CXX23 _EXPORT_STD template -struct allocator_traits; +struct _NO_SPECIALIZATIONS_CITING("N5014 [allocator.traits.general]/1") allocator_traits; _STL_DISABLE_DEPRECATED_WARNING template @@ -756,8 +758,9 @@ struct _Default_allocator_traits { // traits for std::allocator }; _EXPORT_STD template -struct allocator_traits : conditional_t<_Is_default_allocator<_Alloc>::value, _Default_allocator_traits<_Alloc>, - _Normal_allocator_traits<_Alloc>> {}; +struct _NO_SPECIALIZATIONS_CITING("N5014 [allocator.traits.general]/1") allocator_traits + : conditional_t<_Is_default_allocator<_Alloc>::value, _Default_allocator_traits<_Alloc>, + _Normal_allocator_traits<_Alloc>> {}; // _Choose_pocca_v returns whether an attempt to propagate allocators is necessary in copy assignment operations. // Note that even when false_type, callers should call _Pocca as we want to assign allocators even when equal. @@ -962,7 +965,7 @@ public: #if _HAS_DEPRECATED_ALLOCATOR_MEMBERS template - struct _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS rebind { + struct _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NO_SPECIALIZATIONS_OF_MEMBER_CLASS_TEMPLATES rebind { using other = allocator<_Other>; }; @@ -1035,7 +1038,7 @@ public: using const_pointer _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = const void*; template - struct _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS rebind { + struct _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NO_SPECIALIZATIONS_OF_MEMBER_CLASS_TEMPLATES rebind { using other = allocator<_Other>; }; #endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS @@ -2395,7 +2398,7 @@ _CONSTEXPR20 typename _Container::size_type _Erase_remove(_Container& _Cont, con const auto _Old_size = _Cont.size(); _STD _Seek_wrapped(_First, _STD remove(_STD _Get_unwrapped(_First), _STD _Get_unwrapped(_Last), _Val)); _Cont.erase(_First, _Last); - return _Old_size - _Cont.size(); + return static_cast(_Old_size - _Cont.size()); } template @@ -2406,7 +2409,7 @@ _CONSTEXPR20 typename _Container::size_type _Erase_remove_if(_Container& _Cont, const auto _Old_size = _Cont.size(); _STD _Seek_wrapped(_First, _STD remove_if(_STD _Get_unwrapped(_First), _STD _Get_unwrapped(_Last), _Pred)); _Cont.erase(_First, _Last); - return _Old_size - _Cont.size(); + return static_cast(_Old_size - _Cont.size()); } template @@ -2815,6 +2818,7 @@ _STD_END #endif // ^^^ !_HAS_CXX20 ^^^ // TRANSITION, non-_Ugly attribute tokens +#pragma pop_macro("no_specializations") #pragma pop_macro("msvc") #pragma pop_macro("new") diff --git a/stl/inc/xstring b/stl/inc/xstring index 30d8786a22b..4013ff3dade 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -484,7 +484,7 @@ public: _NODISCARD _CONSTEXPR20 size_type _Clamp_suffix_size(const size_type _Off, const size_type _Size) const noexcept { // trims _Size to the longest it can be assuming a string at/after _Off - return (_STD min) (_Size, _Mysize - _Off); + return (_STD min) (_Size, static_cast(_Mysize - _Off)); } union _Bxty { // storage for small buffer or pointer to larger one @@ -899,7 +899,7 @@ private: static _CONSTEXPR20 void _Deallocate_for_capacity( _Alty& _Al, const pointer _Old_ptr, const size_type _Capacity) noexcept { _STL_INTERNAL_CHECK(_Capacity > _Small_string_capacity); - _Al.deallocate(_Old_ptr, _Capacity + 1); // +1 for null terminator + _Al.deallocate(_Old_ptr, static_cast(_Capacity + 1)); // +1 for null terminator } _CONSTEXPR20 void _Construct_empty() { @@ -941,14 +941,14 @@ private: _My_data._Myres = _Small_string_capacity; if constexpr (_Strat == _Construct_strategy::_From_char) { - _Traits::assign(_My_data._Bx._Buf, _Count, _Arg); + _Traits::assign(_My_data._Bx._Buf, static_cast(_Count), _Arg); _Traits::assign(_My_data._Bx._Buf[_Count], _Elem()); } else if constexpr (_Strat == _Construct_strategy::_From_ptr) { - _STD _Traits_copy_batch<_Traits>(_My_data._Bx._Buf, _Arg, _Count); + _STD _Traits_copy_batch<_Traits>(_My_data._Bx._Buf, _Arg, static_cast(_Count)); _Traits::assign(_My_data._Bx._Buf[_Count], _Elem()); } else { // _Strat == _Construct_strategy::_From_string #ifdef _INSERT_STRING_ANNOTATION - _Traits::copy(_My_data._Bx._Buf, _Arg, _Count + 1); + _Traits::copy(_My_data._Bx._Buf, _Arg, static_cast(_Count + 1)); #else // ^^^ _INSERT_STRING_ANNOTATION / !_INSERT_STRING_ANNOTATION vvv _Traits::copy(_My_data._Bx._Buf, _Arg, _BUF_SIZE); #endif // ^^^ !_INSERT_STRING_ANNOTATION ^^^ @@ -965,13 +965,13 @@ private: _My_data._Mysize = _Count; _My_data._Myres = _New_capacity; if constexpr (_Strat == _Construct_strategy::_From_char) { - _Traits::assign(_Unfancy(_New_ptr), _Count, _Arg); + _Traits::assign(_Unfancy(_New_ptr), static_cast(_Count), _Arg); _Traits::assign(_Unfancy(_New_ptr)[_Count], _Elem()); } else if constexpr (_Strat == _Construct_strategy::_From_ptr) { - _STD _Traits_copy_batch<_Traits>(_Unfancy(_New_ptr), _Arg, _Count); + _STD _Traits_copy_batch<_Traits>(_Unfancy(_New_ptr), _Arg, static_cast(_Count)); _Traits::assign(_Unfancy(_New_ptr)[_Count], _Elem()); } else { // _Strat == _Construct_strategy::_From_string - _Traits::copy(_Unfancy(_New_ptr), _Arg, _Count + 1); + _Traits::copy(_Unfancy(_New_ptr), _Arg, static_cast(_Count + 1)); } _ASAN_STRING_CREATE(*this); @@ -1119,8 +1119,8 @@ public: _My_data._Mysize = _New_size; _My_data._Myres = _New_capacity; - _Traits::copy(_Ptr, _Left_ptr, _Left_size); - _Traits::copy(_Ptr + static_cast(_Left_size), _Right_ptr, _Right_size); + _Traits::copy(_Ptr, _Left_ptr, static_cast(_Left_size)); + _Traits::copy(_Ptr + static_cast(_Left_size), _Right_ptr, static_cast(_Right_size)); _Traits::assign(_Ptr[_New_size], _Elem()); _ASAN_STRING_CREATE(*this); _Proxy._Release(); @@ -1147,7 +1147,7 @@ public: _Take_contents(_Left); const auto _Ptr = _My_data._Myptr(); _ASAN_STRING_MODIFY(*this, _Left_size, _New_size); - _Traits::copy(_Ptr + _Left_size, _Right_data._Myptr(), _Right_size + 1); + _Traits::copy(_Ptr + _Left_size, _Right_data._Myptr(), static_cast(_Right_size + 1)); _My_data._Mysize = _New_size; return; } @@ -1168,8 +1168,8 @@ public: _Take_contents(_Right); const auto _Ptr = _Unfancy(_My_data._Bx._Ptr); _ASAN_STRING_MODIFY(*this, _Right_size, _New_size); - _Traits::move(_Ptr + _Left_size, _Ptr, _Right_size + 1); - _Traits::copy(_Ptr, _Left_data._Myptr(), _Left_size); + _Traits::move(_Ptr + _Left_size, _Ptr, static_cast(_Right_size + 1)); + _Traits::copy(_Ptr, _Left_data._Myptr(), static_cast(_Left_size)); _My_data._Mysize = _New_size; return; } @@ -1189,8 +1189,8 @@ public: _My_data._Mysize = _New_size; _My_data._Myres = _New_capacity; const auto _Ptr = _Unfancy(_Fancyptr); - _Traits::copy(_Ptr, _Left_data._Myptr(), _Left_size); - _Traits::copy(_Ptr + _Left_size, _Right_data._Myptr(), _Right_size + 1); + _Traits::copy(_Ptr, _Left_data._Myptr(), static_cast(_Left_size)); + _Traits::copy(_Ptr + _Left_size, _Right_data._Myptr(), static_cast(_Right_size + 1)); _ASAN_STRING_CREATE(*this); _Proxy._Release(); } @@ -1208,7 +1208,7 @@ public: const _Ty& _Right, const size_type _Roff, const size_type _Count, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { // construct from _Right [_Roff, _Roff + _Count) using _Al const basic_string_view<_Elem, _Traits> _As_view = _Right; - const auto _As_sub_view = _As_view.substr(_Roff, _Count); + const auto _As_sub_view = _As_view.substr(static_cast(_Roff), static_cast(_Count)); _Construct<_Construct_strategy::_From_ptr>(_As_sub_view.data(), _Convert_size(_As_sub_view.size())); } #endif // _HAS_CXX17 @@ -1353,7 +1353,7 @@ private: _Right_data._Orphan_all(); _My_data._Activate_SSO_buffer(); - _Traits::copy(_My_data._Bx._Buf, _Right_data._Bx._Buf, _Right_data._Mysize + 1); + _Traits::copy(_My_data._Bx._Buf, _Right_data._Bx._Buf, static_cast(_Right_data._Mysize + 1)); } _My_data._Myres = _Right_data._Myres; @@ -1376,7 +1376,7 @@ private: _Mypair._Myval2._Alloc_proxy(_STD _Get_proxy_allocator(_Al)); if (_Roff != 0) { - _Traits::move(_Right_ptr, _Right_ptr + _Roff, _Result_size); + _Traits::move(_Right_ptr, _Right_ptr + _Roff, static_cast(_Result_size)); } _Right._Eos(_Result_size); _Take_contents(_Right); @@ -1552,7 +1552,7 @@ public: const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos) { // append _Right [_Roff, _Roff + _Count) basic_string_view<_Elem, _Traits> _As_view = _Right; - return append(_As_view.substr(_Roff, _Count)); + return append(_As_view.substr(static_cast(_Roff), static_cast(_Count))); } #endif // _HAS_CXX17 @@ -1570,10 +1570,11 @@ public: // append _Count * _Ch const size_type _Old_size = _Mypair._Myval2._Mysize; if (_Count <= _Mypair._Myval2._Myres - _Old_size) { - _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count); - _Mypair._Myval2._Mysize = _Old_size + _Count; + const auto _New_size = static_cast(_Old_size + _Count); + _ASAN_STRING_MODIFY(*this, _Old_size, _New_size); + _Mypair._Myval2._Mysize = _New_size; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); - _Traits::assign(_Old_ptr + _Old_size, _Count, _Ch); + _Traits::assign(_Old_ptr + _Old_size, static_cast(_Count), _Ch); _Traits::assign(_Old_ptr[_Old_size + _Count], _Elem()); return *this; } @@ -1582,8 +1583,8 @@ public: _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Count, const _Elem _Ch) _STATIC_LAMBDA { - _Traits::copy(_New_ptr, _Old_ptr, _Old_size); - _Traits::assign(_New_ptr + _Old_size, _Count, _Ch); + _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size)); + _Traits::assign(_New_ptr + _Old_size, static_cast(_Count), _Ch); _Traits::assign(_New_ptr[_Old_size + _Count], _Elem()); }, _Count, _Ch); @@ -1640,7 +1641,7 @@ public: const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos) { // assign _Right [_Roff, _Roff + _Count) basic_string_view<_Elem, _Traits> _As_view = _Right; - return assign(_As_view.substr(_Roff, _Count)); + return assign(_As_view.substr(static_cast(_Roff), static_cast(_Count))); } #endif // _HAS_CXX17 @@ -1738,7 +1739,7 @@ public: const size_type _Off, const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos) { // insert _Right [_Roff, _Roff + _Count) at _Off basic_string_view<_Elem, _Traits> _As_view = _Right; - return insert(_Off, _As_view.substr(_Roff, _Count)); + return insert(_Off, _As_view.substr(static_cast(_Roff), static_cast(_Count))); } #endif // _HAS_CXX17 @@ -1759,12 +1760,14 @@ public: _Mypair._Myval2._Check_offset(_Off); const size_type _Old_size = _Mypair._Myval2._Mysize; if (_Count <= _Mypair._Myval2._Myres - _Old_size) { - _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count); - _Mypair._Myval2._Mysize = _Old_size + _Count; + const auto _New_size = static_cast(_Old_size + _Count); + _ASAN_STRING_MODIFY(*this, _Old_size, _New_size); + _Mypair._Myval2._Mysize = _New_size; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Insert_at = _Old_ptr + _Off; - _Traits::move(_Insert_at + _Count, _Insert_at, _Old_size - _Off + 1); // move suffix + null down - _Traits::assign(_Insert_at, _Count, _Ch); // fill hole + _Traits::move( + _Insert_at + _Count, _Insert_at, static_cast(_Old_size - _Off + 1)); // move suffix + null down + _Traits::assign(_Insert_at, static_cast(_Count), _Ch); // fill hole return *this; } @@ -1772,9 +1775,9 @@ public: _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, const size_type _Count, const _Elem _Ch) _STATIC_LAMBDA { - _Traits::copy(_New_ptr, _Old_ptr, _Off); - _Traits::assign(_New_ptr + _Off, _Count, _Ch); - _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off, _Old_size - _Off + 1); + _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Off)); + _Traits::assign(_New_ptr + _Off, static_cast(_Count), _Ch); + _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off, static_cast(_Old_size - _Off + 1)); }, _Off, _Count, _Ch); } @@ -1851,8 +1854,9 @@ private: const size_type _Old_size = _Mypair._Myval2._Mysize; _Elem* const _My_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Erase_at = _My_ptr + _Off; - const size_type _New_size = _Old_size - _Count; - _Traits::move(_Erase_at, _Erase_at + _Count, _New_size - _Off + 1); // move suffix + null up + const auto _New_size = static_cast(_Old_size - _Count); + _Traits::move( + _Erase_at, _Erase_at + _Count, static_cast(_New_size - _Off + 1)); // move suffix + null up _ASAN_STRING_MODIFY(*this, _Old_size, _New_size); _Mypair._Myval2._Mysize = _New_size; return *this; @@ -1915,7 +1919,7 @@ public: const size_type _Roff, const size_type _Count = npos) { // replace [_Off, _Off + _Nx) with _Right [_Roff, _Roff + _Count) basic_string_view<_Elem, _Traits> _As_view = _Right; - return replace(_Off, _Nx, _As_view.substr(_Roff, _Count)); + return replace(_Off, _Nx, _As_view.substr(static_cast(_Roff), static_cast(_Count))); } #endif // _HAS_CXX17 @@ -1935,7 +1939,7 @@ public: _Mypair._Myval2._Check_offset(_Off); _Nx = _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx); if (_Count == _Nx) { - _Traits::assign(_Mypair._Myval2._Myptr() + _Off, _Count, _Ch); + _Traits::assign(_Mypair._Myval2._Myptr() + _Off, static_cast(_Count), _Ch); return *this; } @@ -1943,24 +1947,25 @@ public: if (_Count < _Nx || _Count - _Nx <= _Mypair._Myval2._Myres - _Old_size) { // either we are shrinking, or the growth fits // may temporarily overflow; OK because size_type must be unsigned - const auto _New_size = _Old_size + _Count - _Nx; + const auto _New_size = static_cast(_Old_size + _Count - _Nx); _ASAN_STRING_REMOVE(*this); _Mypair._Myval2._Mysize = _New_size; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Insert_at = _Old_ptr + _Off; - _Traits::move(_Insert_at + _Count, _Insert_at + _Nx, _Old_size - _Nx - _Off + 1); - _Traits::assign(_Insert_at, _Count, _Ch); + _Traits::move(_Insert_at + _Count, _Insert_at + _Nx, static_cast(_Old_size - _Nx - _Off + 1)); + _Traits::assign(_Insert_at, static_cast(_Count), _Ch); _ASAN_STRING_CREATE(*this); return *this; } return _Reallocate_grow_by( - _Count - _Nx, + static_cast(_Count - _Nx), [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, const size_type _Nx, const size_type _Count, const _Elem _Ch) _STATIC_LAMBDA { - _Traits::copy(_New_ptr, _Old_ptr, _Off); - _Traits::assign(_New_ptr + _Off, _Count, _Ch); - _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off + _Nx, _Old_size - _Nx - _Off + 1); + _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Off)); + _Traits::assign(_New_ptr + _Off, static_cast(_Count), _Ch); + _Traits::copy( + _New_ptr + _Off + _Count, _Old_ptr + _Off + _Nx, static_cast(_Old_size - _Nx - _Off + 1)); }, _Off, _Nx, _Count, _Ch); } @@ -2145,7 +2150,7 @@ public: return; } - size_type _Target_capacity = (_STD min) (_My_data._Mysize | _Alloc_mask, max_size()); + size_type _Target_capacity = (_STD min) (static_cast(_My_data._Mysize | _Alloc_mask), max_size()); if (_Target_capacity < _My_data._Myres) { // worth shrinking, do it auto& _Al = _Getal(); const pointer _New_ptr = @@ -2153,7 +2158,7 @@ public: _ASAN_STRING_REMOVE(*this); _My_data._Orphan_all(); - _Traits::copy(_Unfancy(_New_ptr), _Unfancy(_My_data._Bx._Ptr), _My_data._Mysize + 1); + _Traits::copy(_Unfancy(_New_ptr), _Unfancy(_My_data._Bx._Ptr), static_cast(_My_data._Mysize + 1)); _Deallocate_for_capacity(_Al, _My_data._Bx._Ptr, _My_data._Myres); _My_data._Bx._Ptr = _New_ptr; _My_data._Myres = _Target_capacity; @@ -2191,15 +2196,17 @@ public: #if _HAS_CXX17 /* implicit */ _CONSTEXPR20 operator basic_string_view<_Elem, _Traits>() const noexcept { // return a string_view around *this's character-type sequence - return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize}; + return basic_string_view<_Elem, _Traits>{ + _Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize)}; } #endif // _HAS_CXX17 _CONSTEXPR20 void push_back(const _Elem _Ch) { // insert element at end const size_type _Old_size = _Mypair._Myval2._Mysize; if (_Old_size < _Mypair._Myval2._Myres) { - _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + 1); - _Mypair._Myval2._Mysize = _Old_size + 1; + const auto _New_size = static_cast(_Old_size + 1); + _ASAN_STRING_MODIFY(*this, _Old_size, _New_size); + _Mypair._Myval2._Mysize = _New_size; _Elem* const _Ptr = _Mypair._Myval2._Myptr(); _Traits::assign(_Ptr[_Old_size], _Ch); _Traits::assign(_Ptr[_Old_size + 1], _Elem()); @@ -2210,7 +2217,7 @@ public: 1, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const _Elem _Ch) _STATIC_LAMBDA { - _Traits::copy(_New_ptr, _Old_ptr, _Old_size); + _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size)); _Traits::assign(_New_ptr[_Old_size], _Ch); _Traits::assign(_New_ptr[_Old_size + 1], _Elem()); }, @@ -2224,7 +2231,7 @@ public: _STL_VERIFY(_Old_size != 0, "pop_back() called on empty string"); #endif - _Eos(_Old_size - 1); + _Eos(static_cast(_Old_size - 1)); } _NODISCARD _CONSTEXPR20 reference front() noexcept /* strengthened */ { @@ -2286,7 +2293,7 @@ public: const size_type _Storage_max = // can always store small string (_STD max) (_Alloc_max, static_cast(_BUF_SIZE)); return (_STD min) (static_cast(_STD _Max_limit()), - _Storage_max - 1 // -1 is for null terminator and/or npos + static_cast(_Storage_max - 1) // -1 is for null terminator and/or npos ); } @@ -2296,7 +2303,7 @@ public: if (_New_size <= _Old_size) { _Eos(_New_size); } else { - append(_New_size - _Old_size, _Ch); + append(static_cast(_New_size - _Old_size), _Ch); } } @@ -2309,9 +2316,9 @@ public: #endif // ^^^ !_HAS_CXX23 ^^^ (_CRT_GUARDOVERFLOW const size_type _New_size, _Operation _Op) { if (_Mypair._Myval2._Myres < _New_size) { - _Reallocate_grow_by(_New_size - _Mypair._Myval2._Mysize, + _Reallocate_grow_by(static_cast(_New_size - _Mypair._Myval2._Mysize), [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) - _STATIC_LAMBDA { _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); }); + _STATIC_LAMBDA { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size + 1)); }); } else { _ASAN_STRING_MODIFY(*this, _Mypair._Myval2._Mysize, _New_size); _Mypair._Myval2._Mysize = _New_size; @@ -2351,9 +2358,9 @@ public: } const size_type _Old_size = _Mypair._Myval2._Mysize; - _Reallocate_grow_by(_Newcap - _Old_size, + _Reallocate_grow_by(static_cast(_Newcap - _Old_size), [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) - _STATIC_LAMBDA { _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); }); + _STATIC_LAMBDA { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size + 1)); }); // `_Reallocate_grow_by` calls `_ASAN_STRING_CREATE` assuming that the string // has size (initialized memory) equal to its new capacity (allocated memory). @@ -2379,9 +2386,9 @@ public: if (_Mypair._Myval2._Myres < _Newcap) { // reallocate to grow const size_type _Old_size = _Mypair._Myval2._Mysize; - _Reallocate_grow_by(_Newcap - _Old_size, + _Reallocate_grow_by(static_cast(_Newcap - _Old_size), [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) - _STATIC_LAMBDA { _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); }); + _STATIC_LAMBDA { _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size + 1)); }); // `_Reallocate_grow_by` calls `_ASAN_STRING_CREATE` assuming that the string // has size (initialized memory) equal to its new capacity (allocated memory). @@ -2410,7 +2417,7 @@ public: // copy [_Off, _Off + _Count) to [_Ptr, _Ptr + _Count) _Mypair._Myval2._Check_offset(_Off); _Count = _Mypair._Myval2._Clamp_suffix_size(_Off, _Count); - _Traits::copy(_Ptr, _Mypair._Myval2._Myptr() + _Off, _Count); + _Traits::copy(_Ptr, _Mypair._Myval2._Myptr() + _Off, static_cast(_Count)); return _Count; } @@ -2470,9 +2477,9 @@ public: _Swap_bx_large_with_small(_Right_data, _My_data); } else { _Elem _Temp_buf[_BUF_SIZE]; - _Traits::copy(_Temp_buf, _My_data._Bx._Buf, _My_data._Mysize + 1); - _Traits::copy(_My_data._Bx._Buf, _Right_data._Bx._Buf, _Right_data._Mysize + 1); - _Traits::copy(_Right_data._Bx._Buf, _Temp_buf, _My_data._Mysize + 1); + _Traits::copy(_Temp_buf, _My_data._Bx._Buf, static_cast(_My_data._Mysize + 1)); + _Traits::copy(_My_data._Bx._Buf, _Right_data._Bx._Buf, static_cast(_Right_data._Mysize + 1)); + _Traits::copy(_Right_data._Bx._Buf, _Temp_buf, static_cast(_My_data._Mysize + 1)); } _STD swap(_My_data._Mysize, _Right_data._Mysize); @@ -2508,35 +2515,37 @@ public: noexcept(_Is_nothrow_convertible_v>) { // look for _Right beginning at or after _Off basic_string_view<_Elem, _Traits> _As_view = _Right; - return static_cast(_Traits_find<_Traits>( - _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size())); + return static_cast(_Traits_find<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _As_view.data(), _As_view.size())); } #endif // _HAS_CXX17 _NODISCARD _CONSTEXPR20 size_type find(const basic_string& _Right, const size_type _Off = 0) const noexcept { // look for _Right beginning at or after _Off - return static_cast(_Traits_find<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, - _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize)); + return static_cast(_Traits_find<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Right._Mypair._Myval2._Myptr(), + static_cast(_Right._Mypair._Myval2._Mysize))); } _NODISCARD _CONSTEXPR20 size_type find(_In_reads_(_Count) const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept /* strengthened */ { // look for [_Ptr, _Ptr + _Count) beginning at or after _Off return static_cast( - _Traits_find<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count)); + _Traits_find<_Traits>(_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), + static_cast(_Off), _Ptr, static_cast(_Count))); } _NODISCARD _CONSTEXPR20 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))); + return static_cast(_Traits_find<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ptr, _Traits::length(_Ptr))); } _NODISCARD _CONSTEXPR20 size_type find(const _Elem _Ch, const size_type _Off = 0) const noexcept { // look for _Ch at or after _Off - return static_cast( - _Traits_find_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); + return static_cast(_Traits_find_ch<_Traits>( + _Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ch)); } #if _HAS_CXX17 @@ -2545,35 +2554,37 @@ public: noexcept(_Is_nothrow_convertible_v>) { // look for _Right beginning before _Off basic_string_view<_Elem, _Traits> _As_view = _Right; - return static_cast(_Traits_rfind<_Traits>( - _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size())); + return static_cast(_Traits_rfind<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _As_view.data(), _As_view.size())); } #endif // _HAS_CXX17 _NODISCARD _CONSTEXPR20 size_type rfind(const basic_string& _Right, const size_type _Off = npos) const noexcept { // look for _Right beginning before _Off - return static_cast(_Traits_rfind<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, - _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize)); + return static_cast(_Traits_rfind<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Right._Mypair._Myval2._Myptr(), + static_cast(_Right._Mypair._Myval2._Mysize))); } _NODISCARD _CONSTEXPR20 size_type rfind(_In_reads_(_Count) const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept /* strengthened */ { // look for [_Ptr, _Ptr + _Count) beginning before _Off return static_cast( - _Traits_rfind<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count)); + _Traits_rfind<_Traits>(_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), + static_cast(_Off), _Ptr, static_cast(_Count))); } _NODISCARD _CONSTEXPR20 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))); + return static_cast(_Traits_rfind<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ptr, _Traits::length(_Ptr))); } _NODISCARD _CONSTEXPR20 size_type rfind(const _Elem _Ch, const size_type _Off = npos) const noexcept { // look for _Ch before _Off - return static_cast( - _Traits_rfind_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); + return static_cast(_Traits_rfind_ch<_Traits>( + _Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ch)); } #if _HAS_CXX17 @@ -2582,37 +2593,39 @@ public: noexcept(_Is_nothrow_convertible_v>) { // look for one of _Right at or after _Off basic_string_view<_Elem, _Traits> _As_view = _Right; - return static_cast(_Traits_find_first_of<_Traits>( - _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size())); + return static_cast(_Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _As_view.data(), _As_view.size())); } #endif // _HAS_CXX17 _NODISCARD _CONSTEXPR20 size_type find_first_of( const basic_string& _Right, const size_type _Off = 0) const noexcept { // look for one of _Right at or after _Off - return static_cast(_Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, - _Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize)); + return static_cast(_Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Right._Mypair._Myval2._Myptr(), + static_cast(_Right._Mypair._Myval2._Mysize))); } _NODISCARD _CONSTEXPR20 size_type find_first_of(_In_reads_(_Count) const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept /* strengthened */ { // look for one of [_Ptr, _Ptr + _Count) at or after _Off return static_cast( - _Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count)); + _Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), + static_cast(_Off), _Ptr, static_cast(_Count))); } _NODISCARD _CONSTEXPR20 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))); + return static_cast(_Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ptr, _Traits::length(_Ptr))); } _NODISCARD _CONSTEXPR20 size_type find_first_of(const _Elem _Ch, const size_type _Off = 0) const noexcept { // look for _Ch at or after _Off - return static_cast( - _Traits_find_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); + return static_cast(_Traits_find_ch<_Traits>( + _Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ch)); } #if _HAS_CXX17 @@ -2621,35 +2634,37 @@ public: noexcept(_Is_nothrow_convertible_v>) { // look for one of _Right before _Off basic_string_view<_Elem, _Traits> _As_view = _Right; - return static_cast(_Traits_find_last_of<_Traits>( - _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size())); + return static_cast(_Traits_find_last_of<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _As_view.data(), _As_view.size())); } #endif // _HAS_CXX17 _NODISCARD _CONSTEXPR20 size_type find_last_of(const basic_string& _Right, size_type _Off = npos) const noexcept { // look for one of _Right before _Off - return static_cast(_Traits_find_last_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, - _Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize)); + return static_cast(_Traits_find_last_of<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Right._Mypair._Myval2._Myptr(), + static_cast(_Right._Mypair._Myval2._Mysize))); } _NODISCARD _CONSTEXPR20 size_type find_last_of(_In_reads_(_Count) const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept /* strengthened */ { // look for one of [_Ptr, _Ptr + _Count) before _Off return static_cast( - _Traits_find_last_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count)); + _Traits_find_last_of<_Traits>(_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), + static_cast(_Off), _Ptr, static_cast(_Count))); } _NODISCARD _CONSTEXPR20 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))); + return static_cast(_Traits_find_last_of<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ptr, _Traits::length(_Ptr))); } _NODISCARD _CONSTEXPR20 size_type find_last_of(const _Elem _Ch, const size_type _Off = npos) const noexcept { // look for _Ch before _Off - return static_cast( - _Traits_rfind_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); + return static_cast(_Traits_rfind_ch<_Traits>( + _Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ch)); } #if _HAS_CXX17 @@ -2658,8 +2673,8 @@ public: noexcept(_Is_nothrow_convertible_v>) { // look for none of _Right at or after _Off basic_string_view<_Elem, _Traits> _As_view = _Right; - return static_cast(_Traits_find_first_not_of<_Traits>( - _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size())); + return static_cast(_Traits_find_first_not_of<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _As_view.data(), _As_view.size())); } #endif // _HAS_CXX17 @@ -2667,28 +2682,30 @@ public: const basic_string& _Right, const size_type _Off = 0) const noexcept { // look for none of _Right at or after _Off return static_cast(_Traits_find_first_not_of<_Traits>(_Mypair._Myval2._Myptr(), - _Mypair._Myval2._Mysize, _Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize)); + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Right._Mypair._Myval2._Myptr(), + static_cast(_Right._Mypair._Myval2._Mysize))); } _NODISCARD _CONSTEXPR20 size_type find_first_not_of(_In_reads_(_Count) const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept /* strengthened */ { // look for none of [_Ptr, _Ptr + _Count) at or after _Off return static_cast( - _Traits_find_first_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count)); + _Traits_find_first_not_of<_Traits>(_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), + static_cast(_Off), _Ptr, static_cast(_Count))); } _NODISCARD _CONSTEXPR20 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))); + return static_cast(_Traits_find_first_not_of<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ptr, _Traits::length(_Ptr))); } _NODISCARD _CONSTEXPR20 size_type find_first_not_of(const _Elem _Ch, const size_type _Off = 0) const noexcept { // look for non-_Ch at or after _Off - return static_cast( - _Traits_find_not_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); + return static_cast(_Traits_find_not_ch<_Traits>( + _Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ch)); } #if _HAS_CXX17 @@ -2697,8 +2714,8 @@ public: noexcept(_Is_nothrow_convertible_v>) { // look for none of _Right before _Off basic_string_view<_Elem, _Traits> _As_view = _Right; - return static_cast(_Traits_find_last_not_of<_Traits>( - _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size())); + return static_cast(_Traits_find_last_not_of<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _As_view.data(), _As_view.size())); } #endif // _HAS_CXX17 @@ -2706,27 +2723,29 @@ public: const basic_string& _Right, const size_type _Off = npos) const noexcept { // look for none of _Right before _Off return static_cast(_Traits_find_last_not_of<_Traits>(_Mypair._Myval2._Myptr(), - _Mypair._Myval2._Mysize, _Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize)); + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Right._Mypair._Myval2._Myptr(), + static_cast(_Right._Mypair._Myval2._Mysize))); } _NODISCARD _CONSTEXPR20 size_type find_last_not_of(_In_reads_(_Count) const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept /* strengthened */ { // look for none of [_Ptr, _Ptr + _Count) before _Off return static_cast( - _Traits_find_last_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count)); + _Traits_find_last_not_of<_Traits>(_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), + static_cast(_Off), _Ptr, static_cast(_Count))); } _NODISCARD _CONSTEXPR20 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))); + return static_cast(_Traits_find_last_not_of<_Traits>(_Mypair._Myval2._Myptr(), + static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ptr, _Traits::length(_Ptr))); } _NODISCARD _CONSTEXPR20 size_type find_last_not_of(const _Elem _Ch, const size_type _Off = npos) const noexcept { // look for non-_Ch before _Off - return static_cast( - _Traits_rfind_not_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); + return static_cast(_Traits_rfind_not_ch<_Traits>( + _Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), static_cast(_Off), _Ch)); } #if _HAS_CXX17 @@ -2756,13 +2775,14 @@ public: _CONSTEXPR20 bool _Equal(const basic_string& _Right) const noexcept { // compare [0, size()) with _Right for equality - return _Traits_equal<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, - _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); + return _Traits_equal<_Traits>(_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), + _Right._Mypair._Myval2._Myptr(), static_cast(_Right._Mypair._Myval2._Mysize)); } _CONSTEXPR20 bool _Equal(_In_z_ const _Elem* const _Ptr) const noexcept { // compare [0, size()) with _Ptr for equality - return _Traits_equal<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Ptr, _Traits::length(_Ptr)); + return _Traits_equal<_Traits>( + _Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), _Ptr, _Traits::length(_Ptr)); } #if _HAS_CXX17 @@ -2772,7 +2792,7 @@ public: // compare [0, size()) with _Right basic_string_view<_Elem, _Traits> _As_view = _Right; return _Traits_compare<_Traits>( - _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _As_view.data(), _As_view.size()); + _Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), _As_view.data(), _As_view.size()); } template = 0> @@ -2780,8 +2800,8 @@ public: // compare [_Off, _Off + _Nx) with _Right basic_string_view<_Elem, _Traits> _As_view = _Right; _Mypair._Myval2._Check_offset(_Off); - return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), - _As_view.data(), _As_view.size()); + return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, + static_cast(_Mypair._Myval2._Clamp_suffix_size(_Off, _Nx)), _As_view.data(), _As_view.size()); } template = 0> @@ -2790,23 +2810,25 @@ public: // compare [_Off, _Off + _Nx) with _Right [_Roff, _Roff + _Count) basic_string_view<_Elem, _Traits> _As_view = _Right; _Mypair._Myval2._Check_offset(_Off); - const auto _With_substr = _As_view.substr(_Roff, _Count); - return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), - _With_substr.data(), _With_substr.size()); + const auto _With_substr = _As_view.substr(static_cast(_Roff), static_cast(_Count)); + return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, + static_cast(_Mypair._Myval2._Clamp_suffix_size(_Off, _Nx)), _With_substr.data(), + _With_substr.size()); } #endif // _HAS_CXX17 _NODISCARD _CONSTEXPR20 int compare(const basic_string& _Right) const noexcept { // compare [0, size()) with _Right - return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, - _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); + return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), + _Right._Mypair._Myval2._Myptr(), static_cast(_Right._Mypair._Myval2._Mysize)); } _NODISCARD _CONSTEXPR20 int compare(size_type _Off, size_type _Nx, const basic_string& _Right) const { // compare [_Off, _Off + _Nx) with _Right _Mypair._Myval2._Check_offset(_Off); - return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), - _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); + return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, + static_cast(_Mypair._Myval2._Clamp_suffix_size(_Off, _Nx)), _Right._Mypair._Myval2._Myptr(), + static_cast(_Right._Mypair._Myval2._Mysize)); } _NODISCARD _CONSTEXPR20 int compare(const size_type _Off, const size_type _Nx, const basic_string& _Right, @@ -2814,68 +2836,79 @@ public: // compare [_Off, _Off + _Nx) with _Right [_Roff, _Roff + _Count) _Mypair._Myval2._Check_offset(_Off); _Right._Mypair._Myval2._Check_offset(_Roff); - return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), - _Right._Mypair._Myval2._Myptr() + _Roff, _Right._Mypair._Myval2._Clamp_suffix_size(_Roff, _Count)); + return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, + static_cast(_Mypair._Myval2._Clamp_suffix_size(_Off, _Nx)), _Right._Mypair._Myval2._Myptr() + _Roff, + static_cast(_Right._Mypair._Myval2._Clamp_suffix_size(_Roff, _Count))); } _NODISCARD _CONSTEXPR20 int compare(_In_z_ const _Elem* const _Ptr) const noexcept /* strengthened */ { // compare [0, size()) with [_Ptr, ) - return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Ptr, _Traits::length(_Ptr)); + return _Traits_compare<_Traits>( + _Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize), _Ptr, _Traits::length(_Ptr)); } _NODISCARD _CONSTEXPR20 int compare( const size_type _Off, const size_type _Nx, _In_z_ const _Elem* const _Ptr) const { // compare [_Off, _Off + _Nx) with [_Ptr, ) _Mypair._Myval2._Check_offset(_Off); - return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), - _Ptr, _Traits::length(_Ptr)); + return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, + static_cast(_Mypair._Myval2._Clamp_suffix_size(_Off, _Nx)), _Ptr, _Traits::length(_Ptr)); } _NODISCARD _CONSTEXPR20 int compare(const size_type _Off, const size_type _Nx, _In_reads_(_Count) const _Elem* const _Ptr, const size_type _Count) const { // compare [_Off, _Off + _Nx) with [_Ptr, _Ptr + _Count) _Mypair._Myval2._Check_offset(_Off); - return _Traits_compare<_Traits>( - _Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), _Ptr, _Count); + return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, + static_cast(_Mypair._Myval2._Clamp_suffix_size(_Off, _Nx)), _Ptr, static_cast(_Count)); } #if _HAS_CXX20 _NODISCARD constexpr bool starts_with(const basic_string_view<_Elem, _Traits> _Right) const noexcept { - return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize}.starts_with(_Right); + return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize)} + .starts_with(_Right); } _NODISCARD constexpr bool starts_with(const _Elem _Right) const noexcept { - return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize}.starts_with(_Right); + return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize)} + .starts_with(_Right); } _NODISCARD constexpr bool starts_with(const _Elem* const _Right) const noexcept /* strengthened */ { - return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize}.starts_with(_Right); + return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize)} + .starts_with(_Right); } _NODISCARD constexpr bool ends_with(const basic_string_view<_Elem, _Traits> _Right) const noexcept { - return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize}.ends_with(_Right); + return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize)} + .ends_with(_Right); } _NODISCARD constexpr bool ends_with(const _Elem _Right) const noexcept { - return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize}.ends_with(_Right); + return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize)} + .ends_with(_Right); } _NODISCARD constexpr bool ends_with(const _Elem* const _Right) const noexcept /* strengthened */ { - return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize}.ends_with(_Right); + return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize)} + .ends_with(_Right); } #endif // _HAS_CXX20 #if _HAS_CXX23 _NODISCARD constexpr bool contains(const basic_string_view<_Elem, _Traits> _Right) const noexcept { - return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize}.contains(_Right); + return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize)} + .contains(_Right); } _NODISCARD constexpr bool contains(const _Elem _Right) const noexcept { - return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize}.contains(_Right); + return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize)} + .contains(_Right); } _NODISCARD constexpr bool contains(const _Elem* const _Right) const noexcept /* strengthened */ { - return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize}.contains(_Right); + return basic_string_view<_Elem, _Traits>{_Mypair._Myval2._Myptr(), static_cast(_Mypair._Myval2._Mysize)} + .contains(_Right); } #endif // _HAS_CXX23 @@ -2886,7 +2919,7 @@ public: private: _NODISCARD static _CONSTEXPR20 size_type _Calculate_growth( const size_type _Requested, const size_type _Old, const size_type _Max) noexcept { - const size_type _Masked = _Requested | _Alloc_mask; + const auto _Masked = static_cast(_Requested | _Alloc_mask); if (_Masked > _Max) { // the mask overflows, settle for max_size() return _Max; } @@ -2895,7 +2928,7 @@ private: return _Max; } - return (_STD max) (_Masked, _Old + _Old / 2); + return (_STD max) (_Masked, static_cast(_Old + _Old / 2)); } _NODISCARD _CONSTEXPR20 size_type _Calculate_growth(const size_type _Requested) const noexcept { @@ -2941,7 +2974,7 @@ private: _Xlen_string(); // result too long } - const size_type _New_size = _Old_size + _Size_increase; + const auto _New_size = static_cast(_Old_size + _Size_increase); const size_type _Old_capacity = _My_data._Myres; size_type _New_capacity = _Calculate_growth(_New_size); auto& _Al = _Getal(); @@ -2976,7 +3009,7 @@ private: _ASAN_STRING_REMOVE(*this); const pointer _Ptr = _My_data._Bx._Ptr; _My_data._Bx._Switch_to_buf(); - _Traits::copy(_My_data._Bx._Buf, _Unfancy(_Ptr), _My_data._Mysize + 1); + _Traits::copy(_My_data._Bx._Buf, _Unfancy(_Ptr), static_cast(_My_data._Mysize + 1)); auto& _Al = _Getal(); _Deallocate_for_capacity(_Al, _Ptr, _My_data._Myres); _My_data._Myres = _Small_string_capacity; @@ -2996,10 +3029,11 @@ private: const size_type _Old_size = _Mypair._Myval2._Mysize; if (_Count <= _Mypair._Myval2._Myres - _Old_size) { - _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count); - _Mypair._Myval2._Mysize = _Old_size + _Count; + const auto _New_size = static_cast(_Old_size + _Count); + _ASAN_STRING_MODIFY(*this, _Old_size, _New_size); + _Mypair._Myval2._Mysize = _New_size; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); - _STD _Traits_move_batch<_Traits>(_Old_ptr + _Old_size, _Ptr, _Count); + _STD _Traits_move_batch<_Traits>(_Old_ptr + _Old_size, _Ptr, static_cast(_Count)); _Traits::assign(_Old_ptr[_Old_size + _Count], _Elem()); return *this; } @@ -3008,8 +3042,8 @@ private: _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const _UElem* const _Ptr, const size_type _Count) _STATIC_LAMBDA { - _Traits::copy(_New_ptr, _Old_ptr, _Old_size); - _STD _Traits_copy_batch<_Traits>(_New_ptr + _Old_size, _Ptr, _Count); + _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Old_size)); + _STD _Traits_copy_batch<_Traits>(_New_ptr + _Old_size, _Ptr, static_cast(_Count)); _Traits::assign(_New_ptr[_Old_size + _Count], _Elem()); }, _Ptr, _Count); @@ -3025,7 +3059,7 @@ private: _ASAN_STRING_REMOVE(*this); _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Mypair._Myval2._Mysize = _Count; - _STD _Traits_move_batch<_Traits>(_Old_ptr, _Ptr, _Count); + _STD _Traits_move_batch<_Traits>(_Old_ptr, _Ptr, static_cast(_Count)); _Traits::assign(_Old_ptr[_Count], _Elem()); _ASAN_STRING_CREATE(*this); return *this; @@ -3034,7 +3068,7 @@ private: return _Reallocate_for( _Count, [](_Elem* const _New_ptr, const size_type _Count, const _UElem* const _Ptr) _STATIC_LAMBDA { - _STD _Traits_copy_batch<_Traits>(_New_ptr, _Ptr, _Count); + _STD _Traits_copy_batch<_Traits>(_New_ptr, _Ptr, static_cast(_Count)); _Traits::assign(_New_ptr[_Count], _Elem()); }, _Ptr); @@ -3058,8 +3092,9 @@ private: #endif // ^^^ !_HAS_CXX20 ^^^ if (_Check_overlap) { - _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count); - _Mypair._Myval2._Mysize = _Old_size + _Count; + const auto _New_size = static_cast(_Old_size + _Count); + _ASAN_STRING_MODIFY(*this, _Old_size, _New_size); + _Mypair._Myval2._Mysize = _New_size; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Insert_at = _Old_ptr + _Off; // the range [_Ptr, _Ptr + _Ptr_shifted_after) is left alone by moving the suffix out, @@ -3074,10 +3109,11 @@ private: _Ptr_shifted_after = static_cast(_Insert_at - _Ptr); } - _Traits::move(_Insert_at + _Count, _Insert_at, _Old_size - _Off + 1); // move suffix + null down - _STD _Traits_copy_batch<_Traits>(_Insert_at, _Ptr, _Ptr_shifted_after); - _STD _Traits_copy_batch<_Traits>( - _Insert_at + _Ptr_shifted_after, _Ptr + _Count + _Ptr_shifted_after, _Count - _Ptr_shifted_after); + _Traits::move( + _Insert_at + _Count, _Insert_at, static_cast(_Old_size - _Off + 1)); // move suffix + null down + _STD _Traits_copy_batch<_Traits>(_Insert_at, _Ptr, static_cast(_Ptr_shifted_after)); + _STD _Traits_copy_batch<_Traits>(_Insert_at + _Ptr_shifted_after, _Ptr + _Count + _Ptr_shifted_after, + static_cast(_Count - _Ptr_shifted_after)); return *this; } @@ -3085,9 +3121,9 @@ private: _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, const _UElem* const _Ptr, const size_type _Count) _STATIC_LAMBDA { - _Traits::copy(_New_ptr, _Old_ptr, _Off); - _STD _Traits_copy_batch<_Traits>(_New_ptr + _Off, _Ptr, _Count); - _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off, _Old_size - _Off + 1); + _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Off)); + _STD _Traits_copy_batch<_Traits>(_New_ptr + _Off, _Ptr, static_cast(_Count)); + _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off, static_cast(_Old_size - _Off + 1)); }, _Off, _Ptr, _Count); } @@ -3101,19 +3137,19 @@ private: _Mypair._Myval2._Check_offset(_Off); _Nx = _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx); if (_Nx == _Count) { // size doesn't change, so a single move does the trick - _STD _Traits_move_batch<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Ptr, _Count); + _STD _Traits_move_batch<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Ptr, static_cast(_Count)); return *this; } - const size_type _Old_size = _Mypair._Myval2._Mysize; - const size_type _Suffix_size = _Old_size - _Nx - _Off + 1; + const size_type _Old_size = _Mypair._Myval2._Mysize; + const auto _Suffix_size = static_cast(_Old_size - _Nx - _Off + 1); if (_Count < _Nx) { // suffix shifts backwards; we don't have to move anything out of the way _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Insert_at = _Old_ptr + _Off; - _STD _Traits_move_batch<_Traits>(_Insert_at, _Ptr, _Count); - _Traits::move(_Insert_at + _Count, _Insert_at + _Nx, _Suffix_size); + _STD _Traits_move_batch<_Traits>(_Insert_at, _Ptr, static_cast(_Count)); + _Traits::move(_Insert_at + _Count, _Insert_at + _Nx, static_cast(_Suffix_size)); - const auto _New_size = _Old_size - (_Nx - _Count); + const auto _New_size = static_cast(_Old_size - (_Nx - _Count)); _ASAN_STRING_MODIFY(*this, _Old_size, _New_size); _Mypair._Myval2._Mysize = _New_size; return *this; @@ -3128,8 +3164,9 @@ private: #endif // _HAS_CXX20 { if (_Growth <= _Mypair._Myval2._Myres - _Old_size) { // growth fits - _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Growth); - _Mypair._Myval2._Mysize = _Old_size + _Growth; + const auto _New_size = static_cast(_Old_size + _Growth); + _ASAN_STRING_MODIFY(*this, _Old_size, _New_size); + _Mypair._Myval2._Mysize = _New_size; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Insert_at = _Old_ptr + _Off; _Elem* const _Suffix_at = _Insert_at + _Nx; @@ -3143,15 +3180,15 @@ private: _Ptr_shifted_after = static_cast(_Suffix_at - _Ptr); } - _Traits::move(_Suffix_at + _Growth, _Suffix_at, _Suffix_size); + _Traits::move(_Suffix_at + _Growth, _Suffix_at, static_cast(_Suffix_size)); // next case must be move, in case _Ptr begins before _Insert_at and contains part of the hole; // this case doesn't occur in insert because the new content must come from outside the removed // content there (because in insert there is no removed content) - _STD _Traits_move_batch<_Traits>(_Insert_at, _Ptr, _Ptr_shifted_after); + _STD _Traits_move_batch<_Traits>(_Insert_at, _Ptr, static_cast(_Ptr_shifted_after)); // the next case can be copy, because it comes from the chunk moved out of the way in the // first move, and the hole we're filling can't alias the chunk we moved out of the way - _STD _Traits_copy_batch<_Traits>( - _Insert_at + _Ptr_shifted_after, _Ptr + _Growth + _Ptr_shifted_after, _Count - _Ptr_shifted_after); + _STD _Traits_copy_batch<_Traits>(_Insert_at + _Ptr_shifted_after, _Ptr + _Growth + _Ptr_shifted_after, + static_cast(_Count - _Ptr_shifted_after)); return *this; } } @@ -3160,9 +3197,10 @@ private: _Growth, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, const size_type _Nx, const _UElem* const _Ptr, const size_type _Count) _STATIC_LAMBDA { - _Traits::copy(_New_ptr, _Old_ptr, _Off); - _STD _Traits_copy_batch<_Traits>(_New_ptr + _Off, _Ptr, _Count); - _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off + _Nx, _Old_size - _Nx - _Off + 1); + _Traits::copy(_New_ptr, _Old_ptr, static_cast(_Off)); + _STD _Traits_copy_batch<_Traits>(_New_ptr + _Off, _Ptr, static_cast(_Count)); + _Traits::copy( + _New_ptr + _Off + _Count, _Old_ptr + _Off + _Nx, static_cast(_Old_size - _Nx - _Off + 1)); }, _Off, _Nx, _Ptr, _Count); } @@ -3479,7 +3517,7 @@ template struct hash, _Alloc>> : _Conditionally_enabled_hash, _Alloc>, _Is_EcharT<_Elem>> { _NODISCARD static size_t _Do_hash(const basic_string<_Elem, char_traits<_Elem>, _Alloc>& _Keyval) noexcept { - return _Hash_array_representation(_Keyval.c_str(), _Keyval.size()); + return _Hash_array_representation(_Keyval.c_str(), static_cast(_Keyval.size())); } }; diff --git a/stl/inc/xtr1common b/stl/inc/xtr1common index b1829b8b323..e90039f1eec 100644 --- a/stl/inc/xtr1common +++ b/stl/inc/xtr1common @@ -18,12 +18,14 @@ _STL_DISABLE_CLANG_WARNINGS // TRANSITION, non-_Ugly attribute tokens #pragma push_macro("msvc") #pragma push_macro("known_semantics") +#pragma push_macro("no_specializations") #undef msvc #undef known_semantics +#undef no_specializations _STD_BEGIN _EXPORT_STD template -struct integral_constant { +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS integral_constant { static constexpr _Ty value = _Val; using value_type = _Ty; @@ -45,7 +47,7 @@ _EXPORT_STD using true_type = bool_constant; _EXPORT_STD using false_type = bool_constant; _EXPORT_STD template -struct enable_if {}; // no member "type" when !_Test +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS enable_if {}; // no member "type" when !_Test template struct enable_if { // type is _Ty for _Test @@ -56,7 +58,7 @@ _EXPORT_STD template using enable_if_t = typename enable_if<_Test, _Ty>::type; _EXPORT_STD template -struct conditional { // Choose _Ty1 if _Test is true, and _Ty2 otherwise +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS conditional { // Choose _Ty1 if _Test is true, and _Ty2 otherwise using type = _Ty1; }; @@ -70,22 +72,22 @@ using conditional_t = typename conditional<_Test, _Ty1, _Ty2>::type; #ifdef __clang__ _EXPORT_STD template -constexpr bool is_same_v = __is_same(_Ty1, _Ty2); +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_same_v = __is_same(_Ty1, _Ty2); _EXPORT_STD template -struct is_same : bool_constant<__is_same(_Ty1, _Ty2)> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_same : bool_constant<__is_same(_Ty1, _Ty2)> {}; #else // ^^^ Clang / not Clang vvv _EXPORT_STD template -constexpr bool is_same_v = false; // determine whether arguments are the same type +_NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_same_v = false; // determine whether arguments are the same type template constexpr bool is_same_v<_Ty, _Ty> = true; _EXPORT_STD template -struct is_same : bool_constant> {}; +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_same : bool_constant> {}; #endif // ^^^ not Clang ^^^ _EXPORT_STD template -struct remove_const { // remove top-level const qualifier +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS remove_const { // remove top-level const qualifier using type = _Ty; }; @@ -98,7 +100,7 @@ _EXPORT_STD template using remove_const_t = typename remove_const<_Ty>::type; _EXPORT_STD template -struct remove_volatile { // remove top-level volatile qualifier +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS remove_volatile { // remove top-level volatile qualifier using type = _Ty; }; @@ -111,7 +113,7 @@ _EXPORT_STD template using remove_volatile_t = typename remove_volatile<_Ty>::type; _EXPORT_STD template -struct remove_cv { // remove top-level const and volatile qualifiers +struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS remove_cv { // remove top-level const and volatile qualifiers using type = _Ty; template