Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
082d80a
Update WinSDK comments (#5659)
StephanTLavavej Jul 29, 2025
52e35aa
Remove MSVC-specific workarounds for references-to-functions (#5661)
joemmett Aug 1, 2025
907f3e7
`<xstring>`: Suppress code analysis warning C6510 for `basic_string` …
muellerj2 Aug 8, 2025
72d8110
Speculatively implement LWG-4270 Diagnose misuse of `std::projected::…
frederick-vs-ja Aug 8, 2025
96f154a
Speculatively implement LWG-4273 Standard execution policy types shou…
frederick-vs-ja Aug 8, 2025
c1ce930
`<regex>`: Use `std::search()` in skip heuristic (#5586)
muellerj2 Aug 8, 2025
4525436
`<regex>`: Remove usage of non-standard `_Uelem` from parser (#5592)
muellerj2 Aug 8, 2025
5bc9e93
Implement LWG-4222 `expected` constructor from a single value missing…
frederick-vs-ja Aug 8, 2025
9ed9371
Implement LWG-4242 `ranges::distance` does not work with volatile ite…
frederick-vs-ja Aug 8, 2025
fae8c55
Implement P3223R2 Making `istream::ignore()` Less Surprising (#5604)
frederick-vs-ja Aug 8, 2025
c2097a1
`<chrono>`: qualify `_Ugly` function calls to avoid ADL (#5629)
localspook Aug 8, 2025
a0168f1
`<xlocale>`: Use `static_cast` to eliminate implicit conversions betw…
YexuanXiao Aug 8, 2025
eadd3be
`Dev11_0000000_null_forward_iterators`: Avoid Clang warnings, guard h…
YexuanXiao Aug 8, 2025
f9b486e
`VSO_0000000_initialize_everything`: Avoid compiler warnings (#5655)
YexuanXiao Aug 8, 2025
5255207
`VSO_0000000_instantiate_iterators_misc`: Suppress deprecated volatil…
YexuanXiao Aug 8, 2025
1d5f1aa
`VSO_0180466_algorithm_overhauls`: Suppress `-Wcharacter-conversion` …
YexuanXiao Aug 8, 2025
93dee9e
`<chrono>`: Use designated aggregate initialization when returning `t…
frederick-vs-ja Aug 8, 2025
5f8b525
Update _MSVC_STL_UPDATE macro to August 2025 (#5664)
Gabboxl Aug 8, 2025
f95868e
Toolset update: VS 2022 17.14.12 Preview 1 (#5674)
StephanTLavavej Aug 16, 2025
1449cee
`<regex>`: Remove non-standard `_Uelem` from matcher (#5671)
muellerj2 Aug 16, 2025
8aa8f97
`<regex>`: Speed up skip optimization for default `regex_traits` in `…
muellerj2 Aug 16, 2025
67ff5c3
P0811R3_midpoint_lerp: Suppress warning C4756 (#5676)
StephanTLavavej Aug 16, 2025
d7df896
`<algorithm>`: Avoid integer overflow in `stable_sort()` and `ranges:…
StephanTLavavej Aug 16, 2025
a2686a0
`<regex>`: Compare against `char` directly (#5675)
StephanTLavavej Aug 16, 2025
4537edf
Merge branch 'main' into merge-flat_map
StephanTLavavej Aug 16, 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
12 changes: 5 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ 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.35211")
message(FATAL_ERROR "The STL must be built with VS 2022 17.14.8 Preview 1 or later.")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.44.35214")
message(FATAL_ERROR "The STL must be built with VS 2022 17.14.12 Preview 1 or later.")
endif()

include(CheckCXXSourceCompiles)
Expand All @@ -18,7 +18,7 @@ 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.26100.3916) 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.4188) 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 @@ -92,20 +92,18 @@ set(STL_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out/lib/${VCLIBS_I386_OR
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_WIN11_GE)

if(STL_USE_ANALYZE)
# TRANSITION, Windows SDK 10.0.26100.3916 emits
# TRANSITION, Windows SDK 10.0.26100.4188 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, Windows SDK 10.0.26100.3916 emits
# TRANSITION, Windows SDK 10.0.26100.4188 emits
# "warning C28301: No annotations for first declaration of 'meow'"
# for various intrinsics when building for ARM64EC.
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/wd28301>")
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.8 Preview 1 or later.
* Select "Windows 11 SDK (10.0.26100.3916)" in the VS Installer.
1. Install Visual Studio 2022 17.14.12 Preview 1 or later.
* Select "Windows 11 SDK (10.0.26100.4188)" 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.
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
Expand All @@ -158,8 +158,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.8 Preview 1 or later.
* Select "Windows 11 SDK (10.0.26100.3916)" in the VS Installer.
1. Install Visual Studio 2022 17.14.12 Preview 1 or later.
* Select "Windows 11 SDK (10.0.26100.4188)" 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.
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
Expand Down
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-07-09T1240-Pool'
value: 'StlBuild-2025-08-12T1208-Pool'
readonly: true
- name: poolDemands
value: 'EnableSpotVM -equals false'
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/provision-image.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ foreach ($workload in $VisualStudioWorkloads) {
$PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.5.2/PowerShell-7.5.2-win-x64.msi'
$PowerShellArgs = @('/quiet', '/norestart')

$PythonUrl = 'https://www.python.org/ftp/python/3.13.5/python-3.13.5-amd64.exe'
$PythonUrl = 'https://www.python.org/ftp/python/3.13.6/python-3.13.6-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
6 changes: 4 additions & 2 deletions benchmarks/src/regex_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
#include "lorem.hpp"

using namespace std;
using namespace regex_constants;

void bm_lorem_search(benchmark::State& state, const char* pattern) {
void bm_lorem_search(benchmark::State& state, const char* pattern, syntax_option_type syntax = ECMAScript) {
string repeated_lorem{lorem_ipsum};
for (long long i = 0; i < state.range(); ++i) {
repeated_lorem += repeated_lorem;
}
regex re{pattern};
regex re{pattern, syntax};

for (auto _ : state) {
benchmark::DoNotOptimize(repeated_lorem);
Expand All @@ -33,6 +34,7 @@ void bm_lorem_search(benchmark::State& state, const char* pattern) {

BENCHMARK_CAPTURE(bm_lorem_search, "^bibe", "^bibe")->Arg(2)->Arg(3)->Arg(4);
BENCHMARK_CAPTURE(bm_lorem_search, "bibe", "bibe")->Arg(2)->Arg(3)->Arg(4);
BENCHMARK_CAPTURE(bm_lorem_search, "bibe".collate, "bibe", regex_constants::collate)->Arg(2)->Arg(3)->Arg(4);
BENCHMARK_CAPTURE(bm_lorem_search, "(bibe)", "(bibe)")->Arg(2)->Arg(3)->Arg(4);
BENCHMARK_CAPTURE(bm_lorem_search, "(bibe)+", "(bibe)+")->Arg(2)->Arg(3)->Arg(4);
BENCHMARK_CAPTURE(bm_lorem_search, "(?:bibe)+", "(?:bibe)+")->Arg(2)->Arg(3)->Arg(4);
Expand Down
39 changes: 31 additions & 8 deletions stl/inc/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ _STD_BEGIN
static_assert(_Is_ranges_bidi_iter_v<_Iter>, "This algorithm requires bidirectional iterators or stronger.")

_INLINE_VAR constexpr int _ISORT_MAX = 32; // maximum size for insertion sort
// If _ISORT_MAX is ever changed from 32 == 2^5, re-analyze the implementation of stable_sort for integer overflow.

template <class _It>
constexpr _Iter_diff_t<_It> _Isort_max{_ISORT_MAX};
Expand Down Expand Up @@ -2274,8 +2275,8 @@ namespace ranges {
_First = _STD move(_Mid);
++_First;

using _Uty = _Make_unsigned_like_t<iter_difference_t<_It>>;
if (static_cast<_Uty>(_Skip) <= (static_cast<_Uty>(-1) >> 1)) {
constexpr auto _Half_max = (numeric_limits<iter_difference_t<_It>>::max)() / 2;
if (_Skip <= _Half_max) {
_Skip <<= 1;
}
}
Expand Down Expand Up @@ -9219,13 +9220,24 @@ void _Buffered_merge_sort_unchecked(const _BidIt _First, const _BidIt _Last, con
auto _Chunk = _Isort_max<_BidIt>;
for (;;) {
// unconditionally merge elements back into the source buffer

// _Chunk starts at 2^5 and is doubled twice in this loop.
// The first doubling (to 2^6, 2^8, 2^10, ...) doesn't check for overflow as it doesn't pose a risk.
// The second doubling (to 2^7, 2^9, 2^11, ..., 2^15, ..., 2^31, ...) defends against overflow below.
_Chunk <<= 1;
_STD _Chunked_merge_unchecked(_Temp_ptr, _Temp_ptr + _Count, _First, static_cast<ptrdiff_t>(_Chunk),
static_cast<ptrdiff_t>(_Count), _Pred);
_Chunk <<= 1;
if (_Count <= _Chunk) { // if the input would be a single chunk, it's already sorted and we're done
return;

// This is equivalent to doubling _Chunk followed by returning when `_Count <= _Chunk`,
// except that it doesn't risk overflowing.
// Note that returning when `_Count / 2 <= _Chunk` before doubling _Chunk
// would behave differently for odd _Count due to truncating integer division.
// Returning when `(_Count - 1) / 2 < _Chunk` correctly handles both even and odd _Count.
// We have an early return for small _Count above, so `_Count - 1` is safe to form.
if ((_Count - 1) / 2 < _Chunk) {
return; // if the input would be a single chunk, it's already sorted and we're done
}
_Chunk <<= 1;

// more merges necessary; merge to temporary buffer
_STD _Chunked_merge_unchecked(_First, _Last, _Temp_ptr, _Chunk, _Count, _Pred);
Expand Down Expand Up @@ -9391,12 +9403,23 @@ namespace ranges {
ptrdiff_t _Chunk_size = _ISORT_MAX;
for (;;) {
// unconditionally merge elements back into the source buffer

// _Chunk_size starts at 2^5 and is doubled twice in this loop.
// The first doubling (to 2^6, 2^8, 2^10, ...) doesn't check for overflow as it doesn't pose a risk.
// The second doubling (to 2^7, 2^9, 2^11, ..., 2^15, ..., 2^31, ...) defends against overflow below.
_Chunk_size <<= 1;
_Chunked_merge_common(_Temp_ptr, _Temp_ptr + _Count, _First, _Chunk_size, _Count, _Pred, _Proj);
_Chunk_size <<= 1;
if (_Count <= _Chunk_size) { // if the input would be a single chunk, it's already sorted and we're done
return;

// This is equivalent to doubling _Chunk_size followed by returning when `_Count <= _Chunk_size`,
// except that it doesn't risk overflowing.
// Note that returning when `_Count / 2 <= _Chunk_size` before doubling _Chunk_size
// would behave differently for odd _Count due to truncating integer division.
// Returning when `(_Count - 1) / 2 < _Chunk_size` correctly handles both even and odd _Count.
// We have an early return for small _Count above, so `_Count - 1` is safe to form.
if ((_Count - 1) / 2 < _Chunk_size) {
return; // if the input would be a single chunk, it's already sorted and we're done
}
_Chunk_size <<= 1;

// more merges necessary; merge to temporary buffer
_Chunked_merge_common(_First, _Last, _Temp_ptr, _Chunk_size, _Count, _Pred, _Proj);
Expand Down
Loading