Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f8282fb
Google Benchmark 1.9.4 (#5530)
StephanTLavavej May 22, 2025
87a97d2
`<regex>`: Avoid allocating during matching when regex defines no cap…
muellerj2 May 22, 2025
6e8a91f
`<regex>`: Properly parse backslashes in character classes of basic r…
muellerj2 May 22, 2025
a98a750
`<regex>`: Restrict control letters in escapes to alphabetic ASCII ch…
muellerj2 May 22, 2025
aa02cd9
Build benchmarks for ARM64EC pipeline (#5517)
cpplearner May 22, 2025
23475b1
Build tests for ARM64EC pipeline (#5521)
cpplearner May 22, 2025
38c0237
Improve `search` and `find_end` vectorization (#5519)
AlexGuteniev May 22, 2025
d38c194
Vectorize `rotate` even better (#5525)
AlexGuteniev May 22, 2025
3da7d27
Vectorize equality-comparing algorithms for more types (#5527)
AlexGuteniev May 22, 2025
41ec195
`<algorithm>`: Fix conditions for vectorization on trivial assignabil…
frederick-vs-ja May 22, 2025
0bde434
Clean up `vector_algorithms.cpp` again: unsigned bit manipulation, sc…
AlexGuteniev May 28, 2025
21f7abf
`vector_algorithms.cpp`: Fix zeroupper guard for `is_sorted_until` ve…
AlexGuteniev May 28, 2025
1cd875a
`<algorithm>`: avoid `continue` in `ranges::includes` (#5541)
AlexGuteniev May 28, 2025
1b1f5b0
`<regex>`: Avoid generating unnecessary single-branch `_N_if` nodes (…
muellerj2 May 28, 2025
97a3b13
`<regex>`: Remove `error_syntax` (#5542)
muellerj2 May 28, 2025
9ef878d
`<bit>`: Use popcount for `has_single_bit()` if it's always available…
pps83 May 28, 2025
fa1448d
Use `lower_bound` instead of `find_if` to lookup `time_zone`s. (#5548)
YexuanXiao May 28, 2025
c83fbfd
`<vector>`: Avoid a compiler warning with Defect Report P2280R4 (#5550)
StephanTLavavej May 28, 2025
7841cf8
Update `source_location` tests for upcoming EDG changes (#5551)
StephanTLavavej May 28, 2025
8c7747d
Toolset update: VS 2022 17.14.5 Preview 1, WinSDK 26100 (#5580)
StephanTLavavej Jun 14, 2025
7381f2f
Make benchmarks compiling in clang-cl (#5533)
AlexGuteniev Jun 14, 2025
ccffc0c
`<regex>`: Add multiline option and make non-multiline mode the defau…
muellerj2 Jun 14, 2025
b1dbdfe
`<regex>`: Correct character translation in `icase` and `collate` mod…
muellerj2 Jun 14, 2025
a4c5e3f
`<regex>`: Speed up searches for regexes that start with assertions (…
muellerj2 Jun 14, 2025
343e96e
Optimize `std::includes` by using `ranges::includes` approach (#5543)
AlexGuteniev Jun 14, 2025
029ce56
`tzdb.cpp`: Fall back to numeric offset when the current code page ca…
cpplearner Jun 14, 2025
4f5c7c8
`validate.cpp`: report error lines (#5559)
AlexGuteniev Jun 14, 2025
e2115ba
Use `_STL_REPORT_ERROR` in headers (#5560)
AlexGuteniev Jun 14, 2025
487e081
`filesystem.cpp`: Avoid loading `GetTempPath2W` for OneCore (#5565)
StephanTLavavej Jun 14, 2025
ac52118
`<vector>`: Avoid another compiler warning with Defect Report P2280R4…
StephanTLavavej Jun 14, 2025
d07e2cc
Update _MSVC_STL_UPDATE macro to 202506L (#5568)
RutvikMendpara Jun 14, 2025
313964b
`<semaphore>`: use `steady_clock` (#5575)
AlexGuteniev Jun 14, 2025
20b11b5
Merge branch 'main' into merge-flat_map
StephanTLavavej Jun 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ cmake_minimum_required(VERSION 3.31.0)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
project(msvc_standard_libraries LANGUAGES CXX)

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.44.35207.1")
message(FATAL_ERROR "The STL must be built with VS 2022 17.14 Preview 7 or later.")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.44.35209")
message(FATAL_ERROR "The STL must be built with VS 2022 17.14.5 Preview 1 or later.")
endif()

include(CheckCXXSourceCompiles)
check_cxx_source_compiles([=[
#include <sdkddkver.h>
static_assert(WDK_NTDDI_VERSION >= NTDDI_WIN10_NI, "Inspecting WDK_NTDDI_VERSION, the Windows SDK version.");
static_assert(WDK_NTDDI_VERSION >= NTDDI_WIN11_GE, "Inspecting WDK_NTDDI_VERSION, the Windows SDK version.");
int main() {}
]=] WINDOWS_SDK_VERSION_CHECK)

if(NOT WINDOWS_SDK_VERSION_CHECK)
message(FATAL_ERROR "The STL must be built with the Windows 11 SDK (10.0.22621.0) or later. Make sure it's available by selecting it in the Individual Components tab of the VS Installer.")
message(FATAL_ERROR "The STL must be built with the Windows 11 SDK (10.0.26100.3916) or later. Make sure it's available by selecting it in the Individual Components tab of the VS Installer.")
endif()

if(NOT DEFINED VCLIBS_TARGET_ARCHITECTURE)
Expand Down Expand Up @@ -96,21 +96,22 @@ set(TOOLSET_LIB "${TOOLSET_ROOT_DIR}/lib/${VCLIBS_X86_OR_X64}")
set(STL_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out/lib/${VCLIBS_I386_OR_AMD64}")
set(STL_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out/lib/${VCLIBS_I386_OR_AMD64}")
set(STL_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out/bin/${VCLIBS_I386_OR_AMD64}")

# TRANSITION, update internal crt-common.settings.targets, atlmfc.settings.targets, and fe-components.settings.targets
# from NTDDI_WIN10_NI to NTDDI_WIN11_GE when the internal WinSDK is updated.
add_compile_definitions(
_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH WIN32_LEAN_AND_MEAN STRICT _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS
_WIN32_WINNT=0x0A00 NTDDI_VERSION=NTDDI_WIN10_NI)
_WIN32_WINNT=0x0A00 NTDDI_VERSION=NTDDI_WIN11_GE)

if(STL_USE_ANALYZE)
# TRANSITION OS-40109504: Windows SDK: incorrect SAL annotations on functions the STL uses
# warning C6553: The annotation for function 'LCMapStringEx' on _Param_(9)
# does not apply to a value type.
# There's a bug in the declaration for LCMapStringEx - it applies _In_opt_ to an LPARAM.
# LPARAM is a LONG_PTR (intptr_t), and it's invalid to apply _In_opt_ to a non-pointer.
# As of the Windows 11 SDK (10.0.22621.0), there are 5 total occurrences of warning C6553 affecting the STL's build.
# TRANSITION, Windows SDK 10.0.26100.3916 emits
# "warning C6553: The annotation for function 'LCMapStringEx' on _Param_(9) does not apply to a value type."
# Reported as OS-40109504 "Windows SDK: incorrect SAL annotations on functions the STL uses".
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/analyze:autolog-;/wd6553>")

if(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64ec")
# TRANSITION, the Windows SDK emits "warning C28301: No annotations for first declaration of 'meow'"
# TRANSITION, Windows SDK 10.0.26100.3916 emits
# "warning C28301: No annotations for first declaration of 'meow'"
# for various intrinsics when building for ARM64EC.
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/wd28301>")
endif()
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With The Visual Studio IDE

1. Install Visual Studio 2022 17.14 Preview 7 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
1. Install Visual Studio 2022 17.14.5 Preview 1 or later.
* Select "Windows 11 SDK (10.0.26100.3916)" in the VS Installer.
* Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer
if you would like to build the ARM64/ARM64EC target.
* Select "MSVC v143 - VS 2022 C++ ARM build tools (Latest)" in the VS Installer
Expand All @@ -160,8 +160,8 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With A Native Tools Command Prompt

1. Install Visual Studio 2022 17.14 Preview 7 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
1. Install Visual Studio 2022 17.14.5 Preview 1 or later.
* Select "Windows 11 SDK (10.0.26100.3916)" in the VS Installer.
* Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer
if you would like to build the ARM64/ARM64EC target.
* Select "MSVC v143 - VS 2022 C++ ARM build tools (Latest)" in the VS Installer
Expand Down
15 changes: 14 additions & 1 deletion azure-devops/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,21 @@ jobs:
targetPlatform: ${{ parameters.targetPlatform }}
analyzeBuild: ${{ parameters.analyzeBuild }}
asanBuild: ${{ parameters.asanBuild }}
buildBenchmarks: ${{ parameters.buildBenchmarks }}
testsBuildOnly: ${{ parameters.testsBuildOnly }}
- template: build-benchmarks.yml
parameters:
hostArch: ${{ parameters.hostArch }}
targetArch: ${{ parameters.targetArch }}
targetPlatform: ${{ parameters.targetPlatform }}
buildBenchmarks: ${{ parameters.buildBenchmarks }}
compiler: cl
- template: build-benchmarks.yml
parameters:
hostArch: ${{ parameters.hostArch }}
targetArch: ${{ parameters.targetArch }}
targetPlatform: ${{ parameters.targetPlatform }}
buildBenchmarks: ${{ parameters.buildBenchmarks }}
compiler: clang-cl
- template: run-tests.yml
parameters:
hostArch: ${{ parameters.hostArch }}
Expand Down
46 changes: 46 additions & 0 deletions azure-devops/build-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

parameters:
- name: hostArch
type: string
- name: targetArch
type: string
- name: targetPlatform
type: string
- name: buildBenchmarks
type: boolean
- name: compiler
type: string

steps:
- script: |
if exist "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}" (
rmdir /S /Q "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}"
)
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo
cmake -G Ninja ^
-DCMAKE_CXX_COMPILER=${{ parameters.compiler }} ^
-DCMAKE_BUILD_TYPE=Release ^
-DSTL_BINARY_DIR="$(buildOutputLocation)" ^
-DVCLIBS_TARGET_ARCHITECTURE=${{ parameters.targetPlatform }} ^
-S $(Build.SourcesDirectory)/benchmarks -B "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}"
displayName: 'Configure the benchmarks for ${{ parameters.compiler }}'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
# TRANSITION, we currently don't build the benchmarks with Clang for ARM64 or ARM64EC
condition: >
and(succeeded(), ${{ parameters.buildBenchmarks }},
not(and(eq('${{ parameters.compiler }}', 'clang-cl'), startsWith('${{ parameters.targetPlatform }}', 'arm64'))))
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo
cmake --build "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}"
displayName: 'Build the benchmarks for ${{ parameters.compiler }}'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
# TRANSITION, we currently don't build the benchmarks with Clang for ARM64 or ARM64EC
condition: >
and(succeeded(), ${{ parameters.buildBenchmarks }},
not(and(eq('${{ parameters.compiler }}', 'clang-cl'), startsWith('${{ parameters.targetPlatform }}', 'arm64'))))
26 changes: 0 additions & 26 deletions azure-devops/cmake-configure-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ parameters:
type: boolean
- name: asanBuild
type: boolean
- name: buildBenchmarks
type: boolean
- name: testsBuildOnly
type: boolean
- name: litFlags
Expand Down Expand Up @@ -50,27 +48,3 @@ steps:
displayName: 'Build the STL'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
if exist "$(benchmarkBuildOutputLocation)" (
rmdir /S /Q "$(benchmarkBuildOutputLocation)"
)
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo
cmake -G Ninja ^
-DCMAKE_CXX_COMPILER=cl ^
-DCMAKE_BUILD_TYPE=Release ^
-DSTL_BINARY_DIR="$(buildOutputLocation)" ^
-DVCLIBS_TARGET_ARCHITECTURE=${{ parameters.targetPlatform }} ^
-S $(Build.SourcesDirectory)/benchmarks -B "$(benchmarkBuildOutputLocation)"
displayName: 'Configure the benchmarks'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
condition: and(succeeded(), ${{ parameters.buildBenchmarks }})
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo
cmake --build "$(benchmarkBuildOutputLocation)"
displayName: 'Build the benchmarks'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
condition: and(succeeded(), ${{ parameters.buildBenchmarks }})
2 changes: 1 addition & 1 deletion azure-devops/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

variables:
- name: poolName
value: 'StlBuild-2025-05-16T0735-Pool'
value: 'StlBuild-2025-06-10T1243-Pool'
readonly: true
- name: poolDemands
value: 'EnableSpotVM -equals false'
Expand Down
4 changes: 2 additions & 2 deletions azure-devops/provision-image.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $VisualStudioWorkloads = @(
'Microsoft.VisualStudio.Component.VC.Tools.ARM64',
'Microsoft.VisualStudio.Component.VC.Tools.ARM64EC',
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
'Microsoft.VisualStudio.Component.Windows11SDK.22621'
'Microsoft.VisualStudio.Component.Windows11SDK.26100'
)

$VisualStudioUrl = 'https://aka.ms/vs/17/pre/vs_enterprise.exe'
Expand All @@ -43,7 +43,7 @@ foreach ($workload in $VisualStudioWorkloads) {
$PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.5.1/PowerShell-7.5.1-win-x64.msi'
$PowerShellArgs = @('/quiet', '/norestart')

$PythonUrl = 'https://www.python.org/ftp/python/3.13.3/python-3.13.3-amd64.exe'
$PythonUrl = 'https://www.python.org/ftp/python/3.13.4/python-3.13.4-amd64.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'
Expand Down
61 changes: 38 additions & 23 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ stages:
numShards: 1
skipTesting: true

- stage: Early_Build_ARM
dependsOn: []
displayName: 'Early Build ARM'
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
jobs:
- template: azure-devops/build-and-test.yml
parameters:
hostArch: x64
targetArch: arm
targetPlatform: arm
analyzeBuild: true
numShards: 1
skipTesting: true
# - stage: Early_Build_ARM
# dependsOn: []
# displayName: 'Early Build ARM'
# pool:
# name: ${{ variables.poolName }}
# demands: ${{ variables.poolDemands }}
# jobs:
# - template: azure-devops/build-and-test.yml
# parameters:
# hostArch: x64
# targetArch: arm
# targetPlatform: arm
# analyzeBuild: true
# numShards: 1
# skipTesting: true

- stage: Early_Build_ARM64
dependsOn: []
Expand Down Expand Up @@ -98,6 +98,7 @@ stages:
targetArch: arm64
targetPlatform: arm64ec
analyzeBuild: true
buildBenchmarks: true
numShards: 1
skipTesting: true

Expand All @@ -106,7 +107,7 @@ stages:
- Code_Format
- Early_Build_x64
- Early_Build_x86
- Early_Build_ARM
# - Early_Build_ARM
- Early_Build_ARM64
- Early_Build_ARM64EC
displayName: 'Build and Test x64'
Expand All @@ -133,23 +134,37 @@ stages:
targetArch: x86
targetPlatform: x86

- stage: Build_And_Test_ARM
# - stage: Build_And_Test_ARM
# dependsOn: Build_And_Test_x64
# displayName: 'Build and Test ARM'
# pool:
# name: ${{ variables.poolName }}
# demands: ${{ variables.poolDemands }}
# jobs:
# - template: azure-devops/build-and-test.yml
# parameters:
# hostArch: x64
# targetArch: arm
# targetPlatform: arm
# testsBuildOnly: true

- stage: Build_And_Test_ARM64
dependsOn: Build_And_Test_x64
displayName: 'Build and Test ARM'
displayName: 'Build and Test ARM64'
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
jobs:
- template: azure-devops/build-and-test.yml
parameters:
hostArch: x64
targetArch: arm
targetPlatform: arm
targetArch: arm64
targetPlatform: arm64
testsBuildOnly: true

- stage: Build_And_Test_ARM64
- stage: Build_And_Test_ARM64EC
dependsOn: Build_And_Test_x64
displayName: 'Build and Test ARM64'
displayName: 'Build and Test ARM64EC'
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
Expand All @@ -158,5 +173,5 @@ stages:
parameters:
hostArch: x64
targetArch: arm64
targetPlatform: arm64
targetPlatform: arm64ec
testsBuildOnly: true
10 changes: 9 additions & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ if(DEFINED STL_BINARY_DIR)
set(VCLIBS_I386_OR_AMD64 "arm")
elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64")
set(VCLIBS_I386_OR_AMD64 "arm64")
elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64ec")
set(VCLIBS_I386_OR_AMD64 "arm64ec")
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/arm64EC>)
add_link_options("/machine:arm64ec")
set(CMAKE_STATIC_LINKER_FLAGS "/machine:arm64ec")
else()
message(FATAL_ERROR "Could not determine target architecture: VCLIBS_TARGET_ARCHITECTURE: ${VCLIBS_TARGET_ARCHITECTURE}")
endif()
Expand All @@ -52,7 +57,8 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "${STL_BENCHMARK_MSVC_RUNTIME_LIBRARY}")
set(CMAKE_BUILD_TYPE Release)

# /utf-8 affects <format>.
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/Zi;/nologo;/diagnostics:caret;/W4;/WX;/w14265;/w15038;/w15262;/utf-8;/Zc:preprocessor>")
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/Zi;/nologo;/diagnostics:caret;/W4;/WX;/w14265;/w15038;/w15262;/utf-8>")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/Zc:preprocessor>") # TRANSITION, LLVM-48220 clang-cl: ignore /Zc:preprocessor

add_link_options("/DEBUG")

Expand Down Expand Up @@ -106,9 +112,11 @@ add_benchmark(fill src/fill.cpp)
add_benchmark(find_and_count src/find_and_count.cpp)
add_benchmark(find_first_of src/find_first_of.cpp)
add_benchmark(has_single_bit src/has_single_bit.cpp)
add_benchmark(includes src/includes.cpp)
add_benchmark(iota src/iota.cpp)
add_benchmark(is_sorted_until src/is_sorted_until.cpp)
add_benchmark(locale_classic src/locale_classic.cpp)
add_benchmark(locate_zone src/locate_zone.cpp)
add_benchmark(minmax_element src/minmax_element.cpp)
add_benchmark(mismatch src/mismatch.cpp)
add_benchmark(move_only_function src/move_only_function.cpp)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/src/bitset_from_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const auto random_digits = random_digits_init<N, charT, 2048>();

template <length_type Length, size_t N, class charT>
void bitset_from_string(benchmark::State& state) {
const auto& digit_array = random_digits<N, charT>;
auto digit_array = random_digits<N, charT>;
for (auto _ : state) {
benchmark::DoNotOptimize(digit_array);
const auto arr_data = digit_array.data();
Expand Down
9 changes: 5 additions & 4 deletions benchmarks/src/bitset_to_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ void BM_bitset_to_string(benchmark::State& state) {
static_assert(N <= 64);

for (auto _ : state) {
for (const auto& bits : random_bits<>) {
// make a copy, so that it can be potentially modified by DoNotOptimize
for (auto bits : random_bits<>) {
benchmark::DoNotOptimize(bits);
bitset<N> bs{bits};
benchmark::DoNotOptimize(bs.to_string<charT>());
benchmark::DoNotOptimize(bs.template to_string<charT>());
}
}
}
Expand All @@ -43,10 +44,10 @@ void BM_bitset_to_string_large_single(benchmark::State& state) {
static_assert(N % 64 == 0 && N >= 64);
const auto& bitset_data = random_bits<N / 64>;

const auto large_bitset = bit_cast<bitset<N>>(bitset_data);
auto large_bitset = bit_cast<bitset<N>>(bitset_data);
for (auto _ : state) {
benchmark::DoNotOptimize(large_bitset);
benchmark::DoNotOptimize(large_bitset.to_string<charT>());
benchmark::DoNotOptimize(large_bitset.template to_string<charT>());
}
}

Expand Down
Loading