# Table of Contents - [VC Redist Lockdown](#vc-redist-lockdown) - [Expected in VS 18.0 Preview 1](#expected-in-vs-180-preview-1) - [Expected in VS 2022 17.14 Preview 3](#expected-in-vs-2022-1714-preview-3) - [VS 2022 17.14 Preview 2](#vs-2022-1714-preview-2) - latest preview version with STL changes, see the [VS 2022 Preview Release Notes][] - [VS 2022 17.14 Preview 1](#vs-2022-1714-preview-1) - [VS 2022 17.13](#vs-2022-1713) - latest production version, see the [VS 2022 Release Notes][] - [VS 2022 17.12](#vs-2022-1712) - [VS 2022 17.11](#vs-2022-1711) - [VS 2022 17.10](#vs-2022-1710) - [VS 2022 Changelog][] - [VS 2019 Changelog][] C++23 features generally require the [`/std:c++23preview` or `/std:c++latest`][std_options] compiler options. [VS 2022 Preview Release Notes]: https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-preview [VS 2022 Release Notes]: https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes [VS 2022 Changelog]: https://github.com/microsoft/STL/wiki/VS-2022-Changelog [VS 2019 Changelog]: https://github.com/microsoft/STL/wiki/VS-2019-Changelog [std_options]: https://learn.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=msvc-170 ## VC Redist Lockdown To reduce the frequency of required reboots when updating VS (and VS Previews), we "lock down" the Visual C++ Redistributable containing the STL's `msvcp140.dll`. (Most of the STL is header-only, so most changes are unaffected.) Approximately twice a year, specific VS Previews will be "unlocked", so the VC Redist will contain updated DLLs. VS 18.0 Preview 1 will be unlocked. <!-- For when we create a GitHub release: VS 18.0 is <COMMIT>. --> # VS 18.0 ## Expected in VS 18.0 Preview 1 - Merged C++26 features: * [P0472R3](https://wg21.link/P0472R3) [#5382](https://github.com/microsoft/STL/pull/5382) Put `monostate` In `<utility>` - Fixed bugs: * Fixed `regex`'s behavior: + For the `basic` and `grep` grammars to properly handle `^` caret characters. [#5165](https://github.com/microsoft/STL/pull/5165) + For the `basic` and `grep` grammars to properly handle `$` dollar characters. [#5362](https://github.com/microsoft/STL/pull/5362) + For the `basic` and `grep` grammars to make backreferences to unmatched capture groups fail to match anything, instead of matching the empty string `""`. [#5376](https://github.com/microsoft/STL/pull/5376) + For POSIX grammars to allow a `]` right square bracket at the beginning of a character range. [#5364](https://github.com/microsoft/STL/pull/5364) + For POSIX grammars to avoid resetting matched capture groups. [#5377](https://github.com/microsoft/STL/pull/5377) + For the `ECMAScript` grammar's `(?!pattern)` negative lookahead assertions to make capture groups within them always match nothing after the assertions succeed. [#5366](https://github.com/microsoft/STL/pull/5366) + For the `ECMAScript` grammar's `\b` word boundary assertion to not match the empty string `""` (and inversely for the `\B` negative word boundary assertion). [#5375](https://github.com/microsoft/STL/pull/5375) + For the `ECMAScript`, `basic`, `grep`, and `awk` grammars to properly handle escape sequences. [#5380](https://github.com/microsoft/STL/pull/5380) + For capture groups to follow ECMAScript's depth-first and POSIX's leftmost-longest matching rules. [#5218](https://github.com/microsoft/STL/pull/5218) + For character ranges with `regex_constants::collate` to follow the locale's collation order. [#5238](https://github.com/microsoft/STL/pull/5238) * Fixed `ranges::enable_view` to correctly report `false` for `ranges::view_interface` itself. [#5369](https://github.com/microsoft/STL/pull/5369) * Fixed `<filesystem>` status functions to avoid failing for invalid paths when the current directory is a network path. [#5381](https://github.com/microsoft/STL/pull/5381) * Fixed compiler errors in `repeat_view`'s piecewise constructor for certain scenarios. [#5388](https://github.com/microsoft/STL/pull/5388) - Improved performance: * Started using `[[msvc::no_unique_address]]` as a space optimization in several C++23 components. [#4960](https://github.com/microsoft/STL/pull/4960) * Added vectorized implementations of: + `basic_string::find_first_not_of()` and `basic_string::find_last_not_of()` for one character. [#5102](https://github.com/microsoft/STL/pull/5102) + `basic_string::find_first_not_of()` and `basic_string::find_last_not_of()` for multiple characters. [#5206](https://github.com/microsoft/STL/pull/5206) + `adjacent_find()` and `ranges::adjacent_find`. [#5331](https://github.com/microsoft/STL/pull/5331) + `unique()` and `ranges::unique`. [#5092](https://github.com/microsoft/STL/pull/5092) [#5363](https://github.com/microsoft/STL/pull/5363) * Optimized `search_n()` and `ranges::search_n` for n=1 to internally call `find()` and `ranges::find`. [#5346](https://github.com/microsoft/STL/pull/5346) + Improved codegen for `has_single_bit()`. [#5367](https://github.com/microsoft/STL/pull/5367) - Enhanced behavior: * Used a new Clang compiler intrinsic to implement `is_scoped_enum`. [#5358](https://github.com/microsoft/STL/pull/5358) - Improved debugger visualization: * Fixed an off-by-one mistake in the displayed year for `system_clock::time_point`. [#5389](https://github.com/microsoft/STL/pull/5389) * Updated the visualizer for `system_clock::time_point` to recognize the synonymous but slightly different type name emitted by Clang. [#5390](https://github.com/microsoft/STL/pull/5390) - Improved test coverage: * Updated our LLVM submodule, including new tests. [#5349](https://github.com/microsoft/STL/pull/5349) * Updated an `iter_rvalue_reference_t` test in response to a compiler change. [#5378](https://github.com/microsoft/STL/pull/5378) * Changed the benchmark build from `/O2 /Ob1` to [`/O2 /Ob2`](https://learn.microsoft.com/en-us/cpp/build/reference/ob-inline-function-expansion?view=msvc-170), producing more realistic and useful results. [#5370](https://github.com/microsoft/STL/pull/5370) * Fixed sporadic test failures by avoiding excessive compiler memory consumption. [#5383](https://github.com/microsoft/STL/pull/5383) - Code cleanups: * Simplified the control flow in `ranges::search_n`. [#5343](https://github.com/microsoft/STL/pull/5343) * Simplified the implementation of `regex` quantifiers. [#5253](https://github.com/microsoft/STL/pull/5253) * Removed comments that were citing proposed resolutions for LWG issues, now that those issues have been officially resolved by the November 2024 meeting. [#5360](https://github.com/microsoft/STL/pull/5360) - Infrastructure improvements: * Updated dependencies. [#5370](https://github.com/microsoft/STL/pull/5370) + Updated Google Benchmark to 1.9.2. - Updated `_MSVC_STL_UPDATE`. [#5385](https://github.com/microsoft/STL/pull/5385) <!-- For when we create a GitHub release: VS 2022 17.14 is 1f6e5b16ec02216665624c1e762f3732605cf2b4. --> # VS 2022 17.14 ## Expected in VS 2022 17.14 Preview 3 - Merged *partial* C++26 features: * [P3471R4](https://wg21.link/P3471R4) [#5274](https://github.com/microsoft/STL/pull/5274) Standard Library Hardening + Currently disabled by default. + This can be enabled (for any Standard mode) by defining `_MSVC_STL_HARDENING` to `1` project-wide. + As [C++26 Contracts](https://github.com/microsoft/STL/issues/5286) are not yet implemented, this defaults to calling [`__fastfail()`](https://learn.microsoft.com/en-us/cpp/intrinsics/fastfail?view=msvc-170) for hardened precondition violations. - Merged LWG issue resolutions: * [LWG-3899](https://cplusplus.github.io/LWG/issue3899) [#5303](https://github.com/microsoft/STL/pull/5303) `co_yield`ing elements of an lvalue `generator` is unnecessarily inefficient * [LWG-3956](https://cplusplus.github.io/LWG/issue3956) [#5334](https://github.com/microsoft/STL/pull/5334) `chrono::parse` uses `from_stream` as a customization point * [LWG-4172](https://cplusplus.github.io/LWG/issue4172) [#5337](https://github.com/microsoft/STL/pull/5337) `unique_lock` self-move-assignment is broken - Fixed bugs: * Fixed how `<format>` handles field width for alternate form general floating-point. [#5261](https://github.com/microsoft/STL/pull/5261) * Fixed compiler errors when constructing a `basic_ispanstream` from a modifiable `basic_string`. [#5309](https://github.com/microsoft/STL/pull/5309) + This fixed a regression that was introduced by [#4938](https://github.com/microsoft/STL/pull/4938) in VS 2022 17.13. * Fixed compiler errors when using `<format>` in a CUDA project, by adding a compiler bug workaround. [#5335](https://github.com/microsoft/STL/pull/5335) * Fixed compiler errors when converting between different specializations of `basic_const_iterator`. [#5325](https://github.com/microsoft/STL/pull/5325) - Improved performance: * The STL now takes advantage of compiler support for C++23 [P1169R4](https://wg21.link/P1169R4) `static operator()` in earlier Standard modes, slightly improving codegen. [#5284](https://github.com/microsoft/STL/pull/5284) [#5312](https://github.com/microsoft/STL/pull/5312) * Optimized the `minstd_rand` and `minstd_rand0` random number engines by avoiding constant divisions. [#5256](https://github.com/microsoft/STL/pull/5256) * Slightly improved `move_only_function`'s constructors to do less work when setting the object to be empty. [#5328](https://github.com/microsoft/STL/pull/5328) - Enhanced behavior: * Improved the STL's debug checks with better messages and fewer branches. [#5270](https://github.com/microsoft/STL/pull/5270) * Implemented "destructor tombstones" to mitigate use-after-free mistakes. [#5318](https://github.com/microsoft/STL/pull/5318) + Currently disabled by default. + This can be enabled by defining `_MSVC_STL_DESTRUCTOR_TOMBSTONES` to `1` project-wide. - Improved test coverage: * Added test coverage for the ASan annotations in `basic_string::reserve()` and `vector::reserve()`. [#5241](https://github.com/microsoft/STL/pull/5241) * Skipped `libcxx` tests in response to a new compiler warning C5321, which warns when the resolution to [CWG-1656](https://cplusplus.github.io/CWG/issues/1656.html) affects a `u8` string literal. [#5283](https://github.com/microsoft/STL/pull/5283) - Code cleanups: * Removed compiler bug workarounds. [#5284](https://github.com/microsoft/STL/pull/5284) [#5335](https://github.com/microsoft/STL/pull/5335) * Various cleanups (described in detail in the PRs, not repeated here). [#5336](https://github.com/microsoft/STL/pull/5336) - Infrastructure improvements: * Updated dependencies. [#5284](https://github.com/microsoft/STL/pull/5284) [#5335](https://github.com/microsoft/STL/pull/5335) + Updated build compiler to VS 2022 17.14 Preview 2 (now required). + Updated Clang to 19.1.5. + Updated Google Benchmark to 1.9.1. + Updated Python to 3.13.2. - Updated `_MSVC_STL_UPDATE`. [#5264](https://github.com/microsoft/STL/pull/5264) [#5323](https://github.com/microsoft/STL/pull/5323) ## VS 2022 17.14 Preview 2 - Fixed bugs: * Fixed integer overflow in `this_thread::sleep_for()` with extremely small units (e.g. picoseconds). [#5237](https://github.com/microsoft/STL/pull/5237) * Fixed `basic_string::reserve()`'s ASan annotations to detect writes to its unused capacity. [#5252](https://github.com/microsoft/STL/pull/5252) - Code cleanups: * Removed compiler bug workarounds. [#5247](https://github.com/microsoft/STL/pull/5247) [#5257](https://github.com/microsoft/STL/pull/5257) * Removed usage of `[[likely]]` and `[[unlikely]]`, which are discouraged by the compiler team. [#5255](https://github.com/microsoft/STL/pull/5255) - Infrastructure improvements: * Updated dependencies. [#5247](https://github.com/microsoft/STL/pull/5247) [#5257](https://github.com/microsoft/STL/pull/5257) + Updated build compiler to VS 2022 17.13 Preview 4. + Updated Clang to 19.1.1 (now required). ## VS 2022 17.14 Preview 1 - Merged C++26 features: * [P3323R1](https://wg21.link/P3323R1) [#5213](https://github.com/microsoft/STL/pull/5213) Forbid `atomic<cv T>`, Specify `atomic_ref<cv T>` - Merged LWG issue resolutions: * [LWG-3133](https://cplusplus.github.io/LWG/issue3133) [#5157](https://github.com/microsoft/STL/pull/5157) Modernizing numeric type requirements * [LWG-3886](https://cplusplus.github.io/LWG/issue3886) [#5232](https://github.com/microsoft/STL/pull/5232) Monad mo' problems (in `optional` and `expected`) * [LWG-3900](https://cplusplus.github.io/LWG/issue3900) [#5150](https://github.com/microsoft/STL/pull/5150) The `allocator_arg_t` overloads of `generator::promise_type::operator new` should not be constrained * [LWG-3918](https://cplusplus.github.io/LWG/issue3918) [#5135](https://github.com/microsoft/STL/pull/5135) [#5170](https://github.com/microsoft/STL/pull/5170) `std::uninitialized_move/_n` and guaranteed copy elision * [LWG-4014](https://cplusplus.github.io/LWG/issue4014) [#5132](https://github.com/microsoft/STL/pull/5132) [LWG-3809](https://cplusplus.github.io/LWG/issue3809) changes behavior of some existing `std::subtract_with_carry_engine` code * [LWG-4027](https://cplusplus.github.io/LWG/issue4027) [#5221](https://github.com/microsoft/STL/pull/5221) *`possibly-const-range`* should prefer returning `const R&` * [LWG-4084](https://cplusplus.github.io/LWG/issue4084) [#5151](https://github.com/microsoft/STL/pull/5151) `std::fixed` ignores `std::uppercase` * [LWG-4112](https://cplusplus.github.io/LWG/issue4112) [#5152](https://github.com/microsoft/STL/pull/5152) *`has-arrow`* should require `operator->()` to be `const`-qualified * [LWG-4119](https://cplusplus.github.io/LWG/issue4119) [#5220](https://github.com/microsoft/STL/pull/5220) `generator::promise_type::yield_value(ranges::elements_of<R, Alloc>)`'s nested `generator` may be ill-formed * [LWG-4124](https://cplusplus.github.io/LWG/issue4124) [#5155](https://github.com/microsoft/STL/pull/5155) Cannot format `zoned_time` with resolution coarser than seconds * [LWG-4135](https://cplusplus.github.io/LWG/issue4135) [#5131](https://github.com/microsoft/STL/pull/5131) The helper lambda of `std::erase` for `list` should specify return type as `bool` * [LWG-4140](https://cplusplus.github.io/LWG/issue4140) [#5129](https://github.com/microsoft/STL/pull/5129) Useless default constructors for bit reference types * [LWG-4144](https://cplusplus.github.io/LWG/issue4144) [#5201](https://github.com/microsoft/STL/pull/5201) Disallow `unique_ptr<T&, D>` * [LWG-4169](https://cplusplus.github.io/LWG/issue4169) [#5128](https://github.com/microsoft/STL/pull/5128) `std::atomic<T>`'s default constructor should be constrained - Merged *proposed* resolutions for LWG issues (not yet accepted for the C++ Working Draft, but we've chosen to implement this speculatively): * [LWG-3424](https://cplusplus.github.io/LWG/issue3424) [#5232](https://github.com/microsoft/STL/pull/5232) `optional::value_or` should never return a *cv*-qualified type - Fixed bugs: * Fixed `system_category().message()` to prefer US English, followed by the system locale, with an ultimate fallback of [`FormatMessageA`](https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-formatmessagea#parameters)'s behavior for `dwLanguageId == 0`. [#5104](https://github.com/microsoft/STL/pull/5104) + This is consistent with `generic_category().message()` (which always returns US English in our implementation) and has the best chance of returning something intelligible instead of `"unknown error"` or `"???"`. + This fixed a regression that was introduced by [#2669](https://github.com/microsoft/STL/pull/2669) in VS 2022 17.3. * Fixed `filesystem::equivalent()` to return correct results when shared folders are involved. [#5130](https://github.com/microsoft/STL/pull/5130) * Fixed `chrono::weekday`'s constructor to avoid integer overflow for extreme inputs. [#5156](https://github.com/microsoft/STL/pull/5156) * Fixed `regex` to reject bogus character class ranges like `R"([\d-e])"`. [#5158](https://github.com/microsoft/STL/pull/5158) * Fixed `wregex` to correctly handle negated character class escapes (`\D` for non-digits, `\S` for non-whitespace, `\W` for non-words) when matching against Unicode characters. [#5160](https://github.com/microsoft/STL/pull/5160) + This fix is limited to negated character class escapes outside of square-bracket character classes. * Partially fixed `wregex`'s behavior for negated character class escapes inside square-bracket character classes. [#5214](https://github.com/microsoft/STL/pull/5214) * Fixed multiple `regex` bugs involving character ranges in case-insensitive mode. [#5164](https://github.com/microsoft/STL/pull/5164) * Fixed `regex`'s `basic` grammar to parse a single digit for backreferences. [#5167](https://github.com/microsoft/STL/pull/5167) * Fixed `regex`'s internal buffers to grow geometrically. [#5175](https://github.com/microsoft/STL/pull/5175) * Fixed `regex`'s behavior for the special character `.` (dot). [#5192](https://github.com/microsoft/STL/pull/5192) * Fixed `regex`'s constructor to accept (null, zero) arguments. [#5211](https://github.com/microsoft/STL/pull/5211) * Fixed `push_range()` for `stack`, `queue`, and `priority_queue` to forward the range to `c.append_range()` when possible, exactly as depicted in the Standard. [#5168](https://github.com/microsoft/STL/pull/5168) * Fixed code to call `ranges::begin` and `ranges::end` exactly as depicted in the Standard: + `ranges::to`. [#5173](https://github.com/microsoft/STL/pull/5173) + `range_formatter`. [#5178](https://github.com/microsoft/STL/pull/5178) * Fixed compiler errors in `range_formatter` involving highly unusual contiguous ranges. [#5187](https://github.com/microsoft/STL/pull/5187) * Fixed heterogeneous lookup for unordered containers to follow the Standard, allowing braced initializer lists to be used as arguments. [#5208](https://github.com/microsoft/STL/pull/5208) * Fixed compiler errors in `views::counted` involving highly unusual types. [#5223](https://github.com/microsoft/STL/pull/5223) - Improved performance: * Added vectorized implementations of: + `basic_string::find()` for a character. [#5101](https://github.com/microsoft/STL/pull/5101) * Improved the vectorized implementations of: + `basic_string::find_first_of()` and `basic_string::find_last_of()`. [#5029](https://github.com/microsoft/STL/pull/5029) * `regex_traits::translate()` is now an identity function, as required by the Standard, instead of an expensive locale operation. [#5209](https://github.com/microsoft/STL/pull/5209) - Enhanced behavior: * `std::expected`, `std::unexpected`, and all STL exception types are now marked `[[nodiscard]]`. [#5174](https://github.com/microsoft/STL/pull/5174) + This affects all user-defined functions returning these types by value. It also affects any directly constructed temporaries that are immediately discarded. * Deprecated the non-Standard `locale::empty()` static member function. [#5197](https://github.com/microsoft/STL/pull/5197) * Changed the STL to avoid using `is_trivial`, which is being deprecated in C++26. [#5202](https://github.com/microsoft/STL/pull/5202) - Improved debugger visualization: * Improved the visualizers for `basic_string_view` and its iterators by suppressing irrelevant pointer values. [#5176](https://github.com/microsoft/STL/pull/5176) * Dramatically simplified how the visualizers for `basic_string` and its iterators are implemented. [#5177](https://github.com/microsoft/STL/pull/5177) - Improved test coverage: * Simplified the test harness by dropping `ctest`. Now we always directly invoke `stl-lit.py`. [#5169](https://github.com/microsoft/STL/pull/5169) * Improved the test harness to warn only once when a compiler is missing. [#5199](https://github.com/microsoft/STL/pull/5199) * Categorized libcxx test failures. [#5231](https://github.com/microsoft/STL/pull/5231) * Updated our LLVM submodule, including new tests. [#5235](https://github.com/microsoft/STL/pull/5235) - Code cleanups: * Removed compiler bug workarounds. [#5186](https://github.com/microsoft/STL/pull/5186) - Infrastructure improvements: * Updated dependencies. [#5186](https://github.com/microsoft/STL/pull/5186) + Updated build compiler to VS 2022 17.13 Preview 2. + Updated Python to 3.13.1. + Updated VMs to compute-optimized [F32as_v6](https://learn.microsoft.com/en-us/azure/virtual-machines/sizes/compute-optimized/fasv6-series). - Updated `_MSVC_STL_UPDATE`. [#5162](https://github.com/microsoft/STL/pull/5162) [#5217](https://github.com/microsoft/STL/pull/5217) # VS 2022 17.13 - Merged C++23 features: * [P2502R2](https://wg21.link/P2502R2) [#4953](https://github.com/microsoft/STL/pull/4953) `<generator>`: Synchronous Coroutine Generator For Ranges + [P2787R1](https://wg21.link/P2787R1) `pmr::generator` - Merged C++23 Defect Reports: * [P3107R5](https://wg21.link/P3107R5) [#4821](https://github.com/microsoft/STL/pull/4821) Permit An Efficient Implementation Of `<print>` + [P3235R3](https://wg21.link/P3235R3) `std::print` More Types Faster With Less Memory - Fixed bugs: * Fixed an infinite loop in `deque::shrink_to_fit()`. [#4955](https://github.com/microsoft/STL/pull/4955) + This fixed a regression that was introduced by [#4091](https://github.com/microsoft/STL/pull/4091) in VS 2022 17.10. * Fixed compiler errors when constructing highly unusual `unique_ptr`s (storing fancy pointers) from unspeakably evil relics of the forgotten past. [#4922](https://github.com/microsoft/STL/pull/4922) * Fixed compiler errors when calling `ranges::inplace_merge` with certain combinations of elements, projections, and comparisons. [#4927](https://github.com/microsoft/STL/pull/4927) * Fixed compiler errors in `basic_ispanstream`'s constructor and `basic_ispanstream::span()` taking `ReadOnlyRange&&` with highly unusual types. [#4938](https://github.com/microsoft/STL/pull/4938) * Fixed compiler errors in the highly unusual scenario of calling `basic_string` and `basic_string_view`'s `find_first_of()` family of member functions for program-defined "unicorn" character types. [#4951](https://github.com/microsoft/STL/pull/4951) * Fixed compiler errors when constructing `optional` from highly unusual types. [#4961](https://github.com/microsoft/STL/pull/4961) * Fixed sequence container emplacement functions (e.g. `vector::emplace_back()`) to avoid emitting "warning C5046: Symbol involving type with internal linkage not defined" for highly unusual types. [#4963](https://github.com/microsoft/STL/pull/4963) [#4980](https://github.com/microsoft/STL/pull/4980) + This also fixed ODR violations when mixing C++14 with C++17-and-later translation units calling sequence container emplacement functions for any types. * Fixed ODR violations when mixing C++17 with C++20-and-later translation units calling `list/forward_list::remove/remove_if/unique()`. [#4975](https://github.com/microsoft/STL/pull/4975) * Fixed compiler errors in `variant`'s converting constructor and converting assignment operator for certain types. [#4966](https://github.com/microsoft/STL/pull/4966) * Fixed `bitset`'s streaming operator `operator>>(basic_istream<CharT, Traits>&, bitset<N>&)` to use the stream's `Traits` to compare characters. [#4970](https://github.com/microsoft/STL/pull/4970) * Fixed `basic_string` and `list`'s internal constructors to avoid disrupting highly unusual scenarios. [#4976](https://github.com/microsoft/STL/pull/4976) * Fixed compiler errors when constructing a `packaged_task` from a move-only function object. [#4946](https://github.com/microsoft/STL/pull/4946) * For Clang `/fp:fast`, fixed `<cmath>` and `<limits>` to avoid emitting `-Wnan-infinity-disabled` warnings, except when `numeric_limits::infinity()`/`quiet_NaN()`/`signaling_NaN()` are specifically called. [#4990](https://github.com/microsoft/STL/pull/4990) * Fixed `ranges::copy_n` to properly handle negative values of n (as a no-op) when activating our `memmove()` optimization. [#5046](https://github.com/microsoft/STL/pull/5046) + Also fixed our `memmove()` optimization (used by `copy_n()`, `ranges::copy_n`, and more) to avoid emitting compiler warnings with certain iterators. * Fixed `filesystem::directory_entry::refresh()` to avoid sporadically failing for nonexistent network paths on Windows 11 24H2. [#5077](https://github.com/microsoft/STL/pull/5077) * Fixed `basic_istream::get()` and `basic_istream::getline()` to never write a null terminator into zero-sized buffers, and to always write a null terminator otherwise. [#5073](https://github.com/microsoft/STL/pull/5073) * Fixed `assign_range()` for sequence containers to `static_assert` that the container elements are assignable from the range's reference type. [#5086](https://github.com/microsoft/STL/pull/5086) * Fixed compiler errors in various ranges algorithms when used with `views::iota` in certain scenarios. [#5091](https://github.com/microsoft/STL/pull/5091) - Improved performance: * Added vectorized implementations of: + `basic_string::find_first_of()`. [#4744](https://github.com/microsoft/STL/pull/4744) + `basic_string::find_last_of()`. [#4934](https://github.com/microsoft/STL/pull/4934) + `basic_string::find()` for a substring. [#5048](https://github.com/microsoft/STL/pull/5048) + `basic_string::rfind()` for a substring. [#5057](https://github.com/microsoft/STL/pull/5057) + `basic_string::rfind()` for a single character. [#5087](https://github.com/microsoft/STL/pull/5087) + `search()`, `ranges::search`, and `default_searcher`, for 1-byte and 2-byte elements. [#4745](https://github.com/microsoft/STL/pull/4745) + `find_end()` and `ranges::find_end`, for 1-byte and 2-byte elements. [#4943](https://github.com/microsoft/STL/pull/4943) [#5041](https://github.com/microsoft/STL/pull/5041) [#5042](https://github.com/microsoft/STL/pull/5042) + `bitset`'s constructors from strings. [#4839](https://github.com/microsoft/STL/pull/4839) + `remove()` and `ranges::remove`. [#4987](https://github.com/microsoft/STL/pull/4987) * Improved the vectorized implementations of: + `ranges::minmax`, now activated for 1-byte and 2-byte elements. [#4913](https://github.com/microsoft/STL/pull/4913) + The `minmax_element()` and `minmax()` algorithm families. [#4917](https://github.com/microsoft/STL/pull/4917) [#5016](https://github.com/microsoft/STL/pull/5016) * Helped the compiler auto-vectorize: + `swap()` and `ranges::swap` for arrays. [#4991](https://github.com/microsoft/STL/pull/4991) + `adjacent_difference()`. [#4958](https://github.com/microsoft/STL/pull/4958) [#5061](https://github.com/microsoft/STL/pull/5061) [#5079](https://github.com/microsoft/STL/pull/5079) [#5097](https://github.com/microsoft/STL/pull/5097) * `ranges` algorithms now unwrap output iterators, avoiding unnecessary checking. [#5015](https://github.com/microsoft/STL/pull/5015) [#5027](https://github.com/microsoft/STL/pull/5027) * Optimized `bitset`'s streaming operators. [#5008](https://github.com/microsoft/STL/pull/5008) * Optimized the newline-printing overloads `println(FILE*)`, `println(ostream&)`, and nullary `println()`. [#4672](https://github.com/microsoft/STL/pull/4672) * Updated `array` and `vector`'s spaceship comparison operators to take advantage of the vectorized implementation of `lexicographical_compare_three_way()`. [#5078](https://github.com/microsoft/STL/pull/5078) * Extended the "key extraction" optimization in the unique associative containers (both ordered and unordered) to handle more types. [#5050](https://github.com/microsoft/STL/pull/5050) * Optimized `filesystem::symlink_status()` by avoiding unnecessary Windows API calls. [#5071](https://github.com/microsoft/STL/pull/5071) - Improved throughput: * Improved C++23 throughput by not including all of `<ostream>` (which drags in `<format>`) unless the Standard requires it. [#4936](https://github.com/microsoft/STL/pull/4936) * Improved C++23 throughput of `<queue>`, `<stack>`, `<stacktrace>`, and `<thread>` by not including all of `<format>`. [#5003](https://github.com/microsoft/STL/pull/5003) * Moved `system_clock`, `high_resolution_clock`, and `chrono_literals` from a commonly-included internal header to `<chrono>`. [#5105](https://github.com/microsoft/STL/pull/5105) + This has source-breaking impact. If you see compiler errors complaining that it doesn't recognize `chrono` types like `system_clock` or UDLs like `1729ms`, you need to include `<chrono>` specifically, instead of assuming that headers like `<thread>` will drag it in. - Enhanced behavior: * Changed an internal `pair` constructor to be `private`. [#4979](https://github.com/microsoft/STL/pull/4979) * Fixed a CodeQL warning by replacing a squirrelly `memcpy()` call in the `filesystem` implementation (that was intentionally performing a read overrun) with two cromulent `memcpy()` calls. [#4933](https://github.com/microsoft/STL/pull/4933) * Silenced CodeQL warnings. [#4942](https://github.com/microsoft/STL/pull/4942) [#4985](https://github.com/microsoft/STL/pull/4985) [#5072](https://github.com/microsoft/STL/pull/5072) * Added a visualizer for `system_clock::time_point`. [#5005](https://github.com/microsoft/STL/pull/5005) * Changed some `vector` machinery to use scope guards instead of `throw;`, making debugging easier when exceptions are thrown. [#4977](https://github.com/microsoft/STL/pull/4977) * Improved `regex_error::what()`'s message for `regex_constants::error_badbrace`. [#5025](https://github.com/microsoft/STL/pull/5025) * Improved `optional<T>::swap()`'s `static_assert` messages when `T` isn't both move constructible and swappable. [#5065](https://github.com/microsoft/STL/pull/5065) * Removed `locale::id`'s non-Standard constructor from `size_t` and implicit conversion operator to `size_t`. [#5067](https://github.com/microsoft/STL/pull/5067) + For user-visible headers, at least. They remain dllexported for binary compatibility. * Improved `mutex` assertions to distinguish "unlock of unowned mutex" from "unlock of mutex not owned by the current thread". [#5099](https://github.com/microsoft/STL/pull/5099) - Improved test coverage: * Updated tests to work with Clang 18. [#4932](https://github.com/microsoft/STL/pull/4932) [#4937](https://github.com/microsoft/STL/pull/4937) * Fixed sporadic failures in a `timed_mutex` test. [#4973](https://github.com/microsoft/STL/pull/4973) * Extended CUDA test coverage beyond C++14, adding C++17 and C++20. [#4974](https://github.com/microsoft/STL/pull/4974) * When Python `psutil` is installed, the test harness now supports a `priority` parameter, defaulting to `idle`. [#5032](https://github.com/microsoft/STL/pull/5032) * Increased the consistency of the `swap_ranges()` benchmark by adding allocators to control alignment. [#5043](https://github.com/microsoft/STL/pull/5043) * Updated our LLVM submodule, including new tests. [#5038](https://github.com/microsoft/STL/pull/5038) * Divided the increasingly large test for vectorized algorithms into smaller parts, extracting `mismatch()`, `lexicographical_compare()`, and `lexicographical_compare_three_way()` into a separate test. [#5063](https://github.com/microsoft/STL/pull/5063) - Code cleanups: * Removed compiler bug workarounds. [#4939](https://github.com/microsoft/STL/pull/4939) [#4944](https://github.com/microsoft/STL/pull/4944) [#4947](https://github.com/microsoft/STL/pull/4947) [#5017](https://github.com/microsoft/STL/pull/5017) [#5103](https://github.com/microsoft/STL/pull/5103) * Explicitly marked `packaged_task`'s defaulted move constructor and move assignment operator as `noexcept`. [#4940](https://github.com/microsoft/STL/pull/4940) * Various cleanups (described in detail in the PRs, not repeated here). [#4945](https://github.com/microsoft/STL/pull/4945) [#5014](https://github.com/microsoft/STL/pull/5014) [#5058](https://github.com/microsoft/STL/pull/5058) * Refactored internal usage of the *`tuple-like`* and *`pair-like`* concepts. [#4983](https://github.com/microsoft/STL/pull/4983) * Used `if constexpr` to simplify ~~eldritch horrors from beyond spacetime~~ locale facets. [#5001](https://github.com/microsoft/STL/pull/5001) * Simplified control flow in `basic_string::find_first_not_of()`/`find_last_not_of()`. [#5006](https://github.com/microsoft/STL/pull/5006) * Refactored the vectorized implementation of `bitset::to_string()`. [#5013](https://github.com/microsoft/STL/pull/5013) * Replaced SFINAE with concepts in C++20-and-later code. [#5044](https://github.com/microsoft/STL/pull/5044) - Improved documentation: * Removed an inaccurate comment in `list`'s move assignment operator. [#5024](https://github.com/microsoft/STL/pull/5024) - Infrastructure improvements: * Updated dependencies. [#4947](https://github.com/microsoft/STL/pull/4947) [#5017](https://github.com/microsoft/STL/pull/5017) [#5082](https://github.com/microsoft/STL/pull/5082) + Updated build compiler to VS 2022 17.13 Preview 1 (and 17.12 is now required). + Updated Clang to 18.1.8 (now required). + Updated CMake to 3.30 (now required). + Updated Python to 3.13.0 (now required). + Updated the PR/CI system to Windows Server 2025. - Build system improvements: * Removed a workaround in the benchmark build. [#4928](https://github.com/microsoft/STL/pull/4928) - Updated `_MSVC_STL_UPDATE`. [#4926](https://github.com/microsoft/STL/pull/4926) [#4994](https://github.com/microsoft/STL/pull/4994) [#5064](https://github.com/microsoft/STL/pull/5064) # VS 2022 17.12 - Merged C++26 features: * [P0952R2](https://wg21.link/P0952R2) [#4740](https://github.com/microsoft/STL/pull/4740) [#4850](https://github.com/microsoft/STL/pull/4850) A New Specification For `generate_canonical()` * [P2407R5](https://wg21.link/P2407R5) [#4743](https://github.com/microsoft/STL/pull/4743) Freestanding Library: Partial Classes * [P2833R2](https://wg21.link/P2833R2) [#4743](https://github.com/microsoft/STL/pull/4743) Freestanding Library: `inout` `expected` `span` * [P2968R2](https://wg21.link/P2968R2) [#4777](https://github.com/microsoft/STL/pull/4777) Make `std::ignore` A First-Class Object * [P2997R1](https://wg21.link/P2997R1) [#4816](https://github.com/microsoft/STL/pull/4816) Removing The Common Reference Requirement From The Indirectly Invocable Concepts - Merged C++23 features: * [P2286R8](https://wg21.link/P2286R8) Formatting Ranges, completed by: + Implemented *`range-default-formatter`*. [#4716](https://github.com/microsoft/STL/pull/4716) + Implemented `formatter` for the container adaptors `stack`, `queue`, and `priority_queue`. [#4825](https://github.com/microsoft/STL/pull/4825) - Merged LWG issue resolutions: * [LWG-3944](https://cplusplus.github.io/LWG/issue3944) [#4784](https://github.com/microsoft/STL/pull/4784) Formatters converting sequences of `char` to sequences of `wchar_t` * [LWG-4061](https://cplusplus.github.io/LWG/issue4061) [#4758](https://github.com/microsoft/STL/pull/4758) Should `std::basic_format_context` be default-constructible/copyable/movable? * [LWG-4074](https://cplusplus.github.io/LWG/issue4074) [#4814](https://github.com/microsoft/STL/pull/4814) *`compatible-joinable-ranges`* is underconstrained * [LWG-4083](https://cplusplus.github.io/LWG/issue4083) [#4786](https://github.com/microsoft/STL/pull/4786) `views::as_rvalue` should reject non-input ranges * [LWG-4096](https://cplusplus.github.io/LWG/issue4096) [#4785](https://github.com/microsoft/STL/pull/4785) `views::iota(views::iota(0))` should be rejected * [LWG-4098](https://cplusplus.github.io/LWG/issue4098) [#4815](https://github.com/microsoft/STL/pull/4815) `views::adjacent<0>` should reject non-forward ranges * [LWG-4106](https://cplusplus.github.io/LWG/issue4106) [#4757](https://github.com/microsoft/STL/pull/4757) `basic_format_args` should not be default-constructible - Merged *proposed* resolutions for LWG issues (not yet accepted for the C++ Working Draft, but we've chosen to implement this speculatively): * [LWG-4139](https://cplusplus.github.io/LWG/issue4139) [#4902](https://github.com/microsoft/STL/pull/4902) \[time.zone.leap\] recursive constraint in `<=>` - Fixed bugs: * Fixed static analysis warning [C26818](https://learn.microsoft.com/en-us/cpp/code-quality/c26818?view=msvc-170) "Switch statement does not cover all cases. Consider adding a 'default' label (es.79)." [#4715](https://github.com/microsoft/STL/pull/4715) + *Note:* The STL has always attempted to be `/W4 /analyze` clean, but does not yet attempt to be clean with respect to all additional static analysis rulesets. * Fixed `atomic_ref::is_lock_free()` on x64 to return `true` for 1, 2, 4, 8, and 16 bytes only. [#4729](https://github.com/microsoft/STL/pull/4729) * Fixed `uniform_real_distribution<RealType>{min, max}` to stay within the inclusive-exclusive range `[min, max)` and never generate the `max` value exactly. [#4740](https://github.com/microsoft/STL/pull/4740) * Fixed `filesystem::weakly_canonical()` to avoid failing on Windows 11 24H2 in certain scenarios. [#4844](https://github.com/microsoft/STL/pull/4844) * Fixed `condition_variable_any::wait_for()` to consistently use `steady_clock`. [#4755](https://github.com/microsoft/STL/pull/4755) * Removed a broken and useless visualizer for `ranges::view_interface`. [#4835](https://github.com/microsoft/STL/pull/4835) * Fixed the visualizer for `move_iterator` to use the updated name of its internal data member. [#4836](https://github.com/microsoft/STL/pull/4836) + This fixed a regression that was introduced by [#1080](https://github.com/microsoft/STL/pull/1080) in VS 2019 16.8. * Fixed `expected` to conditionally delete its copy constructor and copy assignment operator as depicted in the Standard, which affects overload resolution in unusual scenarios. [#4837](https://github.com/microsoft/STL/pull/4837) * Fixed `time_put`/`put_time()` to avoid crashing for: + Unknown conversion specifiers. (Now they're copied unchanged.) [#4840](https://github.com/microsoft/STL/pull/4840) + Out-of-range `tm` fields. (Now they're replaced with a `?` character.) [#4883](https://github.com/microsoft/STL/pull/4883) * Fixed compiler errors in `ranges::inplace_merge` and `ranges::minmax` in unusual scenarios. [#4841](https://github.com/microsoft/STL/pull/4841) * Fixed truncation warnings when: + Using `conjunction` and `disjunction` with non-`bool_constant` arguments. [#4846](https://github.com/microsoft/STL/pull/4846) + Calling algorithms with contiguous iterators whose difference types are narrower than `ptrdiff_t`. [#4898](https://github.com/microsoft/STL/pull/4898) * Improved `array::size()` and `<mdspan>` static analysis annotations, fixing warnings in some scenarios. [#4856](https://github.com/microsoft/STL/pull/4856) * Fixed `lexicographical_compare_three_way()` to enforce the Standard's mandate that the comparison returns a comparison category type. [#4878](https://github.com/microsoft/STL/pull/4878) * Fixed compiler errors in the parallel scan algorithms `inclusive_scan()`, `exclusive_scan()`, `transform_inclusive_scan()`, and `transform_exclusive_scan()` when the intermediate and output types are different. [#4701](https://github.com/microsoft/STL/pull/4701) * Fixed the vectorized implementation of floating-point `ranges::min`, `ranges::max`, and `ranges::minmax` to return correct results for negative zeros. [#4734](https://github.com/microsoft/STL/pull/4734) * Fixed Clang compiler errors for certain `constexpr` `variant` scenarios by adding a compiler bug workaround. [#4903](https://github.com/microsoft/STL/pull/4903) * Fixed compiler errors when using `<random>` machinery (e.g. `generate_canonical()`, `uniform_real_distribution`) via Standard Library Modules or Standard Library Header Units by adding compiler bug workarounds. [#4906](https://github.com/microsoft/STL/pull/4906) * Fixed compiler errors when using `<format>` machinery in user-defined modules by adding compiler bug workarounds. [#4919](https://github.com/microsoft/STL/pull/4919) * Fixed `<format>` to avoid crashing when formatting floating-point values with large precisions combined with the `#` (alternate form) or `L` (locale-specific form) options. [#4907](https://github.com/microsoft/STL/pull/4907) - Improved performance: * Overhauled `condition_variable` and `condition_variable_any`, improving their performance and simplifying their implementation. [#4720](https://github.com/microsoft/STL/pull/4720) + As a result, `condition_variable`, `timed_mutex`, and `recursive_timed_mutex` are now trivially destructible. * Improved the performance of `search()`, `find_end()`, and their `ranges` forms by removing calls to `memcmp()` that were surprisingly harmful. [#4654](https://github.com/microsoft/STL/pull/4654) [#4753](https://github.com/microsoft/STL/pull/4753) * Improved the ARM64 performance of `popcount()` by using new compiler intrinsics. [#4695](https://github.com/microsoft/STL/pull/4695) [#4733](https://github.com/microsoft/STL/pull/4733) * Further improved the vectorized implementations of: + The `minmax_element()` and `minmax()` algorithm families. [#4659](https://github.com/microsoft/STL/pull/4659) [#4739](https://github.com/microsoft/STL/pull/4739) * Slightly improved the performance of `ranges::min`, `ranges::max`, and `ranges::minmax` for certain iterator types. [#4775](https://github.com/microsoft/STL/pull/4775) * On x86, the STL is now built with `/arch:SSE2` (which is the default) instead of `/arch:IA32`. [#4741](https://github.com/microsoft/STL/pull/4741) + See [`/arch` (x86)](https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86?view=msvc-170) on Microsoft Learn. * Used Clang builtins to improve the performance of `<cmath>`'s floating-point comparison functions for mixed types. [#4648](https://github.com/microsoft/STL/pull/4648) * On x64, `atomic_ref<16 bytes>` now always uses the cmpxchg16b instruction. [#4751](https://github.com/microsoft/STL/pull/4751) * Streaming a small `bitset` to a `basic_ostream` now avoids dynamically allocating memory. [#4818](https://github.com/microsoft/STL/pull/4818) * Slightly improved performance for Clang ARM64 `<atomic>`. [#4870](https://github.com/microsoft/STL/pull/4870) * Updated `char_traits<wchar_t/char16_t>::compare/find/length`, `find`, and `ranges::find` to call `wmemcmp/wmemchr/wcslen` when possible, which will improve performance after a future UCRT header update. [#4873](https://github.com/microsoft/STL/pull/4873) [#4894](https://github.com/microsoft/STL/pull/4894) * Optimized equality comparisons for empty `string`s and `string_view`s. [#4904](https://github.com/microsoft/STL/pull/4904) - Improved throughput: * Improved `<queue>` and `<stack>` throughput by dragging in fewer headers. [#4707](https://github.com/microsoft/STL/pull/4707) - Enhanced behavior: * [P0608R3](https://wg21.link/P0608R3) Improving `variant`'s Converting Constructor/Assignment is now unconditionally active (i.e. in C++17 mode and above), instead of being restricted to C++20 mode and above. [#4713](https://github.com/microsoft/STL/pull/4713) + This C++20 behavioral change was originally implemented by [#1629](https://github.com/microsoft/STL/pull/1629) in VS 2019 16.10. While it can have source-breaking impact, it generally has highly desirable effects. * Changed the machinery for copying `map`/`set` nodes to use scope guards instead of `throw;`, making debugging easier when exceptions are thrown. [#4749](https://github.com/microsoft/STL/pull/4749) * Added debug checks to `gcd()` and `lcm()` for precondition violations. [#4776](https://github.com/microsoft/STL/pull/4776) * Added "lifetimebound" attributes to `min`, `max`, `clamp`, `ranges::min`, `ranges::max`, and `ranges::clamp`, allowing MSVC code analysis and Clang `-Wdangling` to detect dangling references in improper usage. [#4838](https://github.com/microsoft/STL/pull/4838) * Updated the precondition check in `vector::pop_back()` to be guarded by `_CONTAINER_DEBUG_LEVEL`. [#4849](https://github.com/microsoft/STL/pull/4849) * Renamed the parameters of `views::iota` and `views::repeat` to provide better IDE guidance. [#4908](https://github.com/microsoft/STL/pull/4908) * Simplified internal locale facet machinery to use class-specific `operator new` and `operator delete` overloads in both release and debug mode. [#4916](https://github.com/microsoft/STL/pull/4916) - Improved debugger visualization: * Inserted the debug visualizer changes from [#3848](https://github.com/microsoft/STL/pull/3848), [#4274](https://github.com/microsoft/STL/pull/4274), [#4835](https://github.com/microsoft/STL/pull/4835), and [#4836](https://github.com/microsoft/STL/pull/4836) in the VS repo so they'll finally ship. - Improved test coverage: * Updated LLVM-derived test coverage for `<any>`, `<optional>`, and `<variant>`. [#4713](https://github.com/microsoft/STL/pull/4713) * Properly tested the resolution of [LWG-4053](https://cplusplus.github.io/LWG/issue4053) "Unary call to `std::views::repeat` does not decay the argument". [#4748](https://github.com/microsoft/STL/pull/4748) * Improved the benchmarks for `bitset::to_string()`. [#4817](https://github.com/microsoft/STL/pull/4817) * Updated our LLVM submodule, including new tests. [#4862](https://github.com/microsoft/STL/pull/4862) [#4910](https://github.com/microsoft/STL/pull/4910) * Re-enabled tests that were previously skipped in the `libcxx` test suite. [#4721](https://github.com/microsoft/STL/pull/4721) [#4732](https://github.com/microsoft/STL/pull/4732) [#4911](https://github.com/microsoft/STL/pull/4911) * Skipped tests that were sporadically failing due to incorrect timing assumptions. [#4885](https://github.com/microsoft/STL/pull/4885) * Added compiler bug workarounds. [#4895](https://github.com/microsoft/STL/pull/4895) * Tested the resolution of [LWG-4105](https://cplusplus.github.io/LWG/issue4105) "`ranges::ends_with`'s *Returns* misses difference casting". [#4897](https://github.com/microsoft/STL/pull/4897) * Updated tests to work with Clang 19. [#4912](https://github.com/microsoft/STL/pull/4912) * Avoided unnecessary usage of `rand()`, which is considered harmful. [#4921](https://github.com/microsoft/STL/pull/4921) - Code cleanups: * Removed compiler bug workarounds. [#4725](https://github.com/microsoft/STL/pull/4725) [#4782](https://github.com/microsoft/STL/pull/4782) [#4889](https://github.com/microsoft/STL/pull/4889) * Various cleanups (described in detail in the PRs, not repeated here). [#4724](https://github.com/microsoft/STL/pull/4724) [#4900](https://github.com/microsoft/STL/pull/4900) [#4920](https://github.com/microsoft/STL/pull/4920) * Replaced SFINAE with concepts in C++20-and-later code. [#4718](https://github.com/microsoft/STL/pull/4718) [#4819](https://github.com/microsoft/STL/pull/4819) * Removed a significant amount of unused code calling `GetCurrentPackageId`. [#4742](https://github.com/microsoft/STL/pull/4742) * Simplified how `ranges::equal` compares sizes. [#4864](https://github.com/microsoft/STL/pull/4864) - Reverted change: * Removed then temporarily restored support for targeting Windows 7 and Server 2008 R2. This will be permanently removed in 18.0 Preview 1. [#4742](https://github.com/microsoft/STL/pull/4742) [#4857](https://github.com/microsoft/STL/pull/4857) - Infrastructure improvements: * The STL now clearly rejects attempts to: - Build a preset whose architecture doesn't match the compiler command prompt. [#4709](https://github.com/microsoft/STL/pull/4709) - Test a build whose architecture doesn't match the compiler command prompt. [#4717](https://github.com/microsoft/STL/pull/4717) * Updated dependencies. [#4725](https://github.com/microsoft/STL/pull/4725) [#4824](https://github.com/microsoft/STL/pull/4824) [#4889](https://github.com/microsoft/STL/pull/4889) + Updated build compiler to VS 2022 17.12 Preview 1 (and 17.11 is now required). + Updated CMake to 3.29 (now required). + Updated Ninja to 1.12.1. + Updated Python to 3.12.5. + Updated Google Benchmark to 1.8.5. [#4851](https://github.com/microsoft/STL/pull/4851) - Build system improvements: * Added [`/Zc:preprocessor`](https://learn.microsoft.com/en-us/cpp/build/reference/zc-preprocessor?view=msvc-170) to build the STL with the conformant preprocessor. [#4886](https://github.com/microsoft/STL/pull/4886) * Improved how CMake searches for the clang-format executable. [#4888](https://github.com/microsoft/STL/pull/4888) - Updated `_MSVC_STL_UPDATE`. [#4706](https://github.com/microsoft/STL/pull/4706) [#4708](https://github.com/microsoft/STL/pull/4708) [#4754](https://github.com/microsoft/STL/pull/4754) [#4872](https://github.com/microsoft/STL/pull/4872) # VS 2022 17.11 - Merged C++26 features: * [P2875R4](https://wg21.link/P2875R4) [#4532](https://github.com/microsoft/STL/pull/4532) Undeprecate `polymorphic_allocator::destroy` * [P3142R0](https://wg21.link/P3142R0) [#4611](https://github.com/microsoft/STL/pull/4611) Printing Blank Lines With `println()` - Merged *partial* C++23 features: * [P2286R8](https://wg21.link/P2286R8) Formatting Ranges: + Implemented `formatter` for `pair` and `tuple`. [#4438](https://github.com/microsoft/STL/pull/4438) [#4631](https://github.com/microsoft/STL/pull/4631) [#4681](https://github.com/microsoft/STL/pull/4681) + Implemented `range_formatter`. [#4642](https://github.com/microsoft/STL/pull/4642) - Merged LWG issue resolutions: * [LWG-3767](https://cplusplus.github.io/LWG/issue3767) [#4542](https://github.com/microsoft/STL/pull/4542) `codecvt<charN_t, char8_t, mbstate_t>` incorrectly added to locale * [LWG-3919](https://cplusplus.github.io/LWG/issue3919) [#4526](https://github.com/microsoft/STL/pull/4526) `enumerate_view` may invoke UB for sized common non-forward underlying ranges * [LWG-3950](https://cplusplus.github.io/LWG/issue3950) [#4510](https://github.com/microsoft/STL/pull/4510) `std::basic_string_view` comparison operators are overspecified * [LWG-3984](https://cplusplus.github.io/LWG/issue3984) [#4543](https://github.com/microsoft/STL/pull/4543) `ranges::to`'s recursion branch may be ill-formed * [LWG-4012](https://cplusplus.github.io/LWG/issue4012) [#4529](https://github.com/microsoft/STL/pull/4529) `common_view::begin`/`end` are missing the *`simple-view`* check * [LWG-4013](https://cplusplus.github.io/LWG/issue4013) [#4530](https://github.com/microsoft/STL/pull/4530) `lazy_split_view::`*`outer-iterator`*`::value_type` should not provide default constructor * [LWG-4016](https://cplusplus.github.io/LWG/issue4016) [#4539](https://github.com/microsoft/STL/pull/4539) *`container-insertable`* checks do not match what *`container-inserter`* does * [LWG-4035](https://cplusplus.github.io/LWG/issue4035) [#4525](https://github.com/microsoft/STL/pull/4525) `single_view` should provide `empty` * [LWG-4053](https://cplusplus.github.io/LWG/issue4053) [#4685](https://github.com/microsoft/STL/pull/4685) Unary call to `std::views::repeat` does not decay the argument * [LWG-4054](https://cplusplus.github.io/LWG/issue4054) [#4540](https://github.com/microsoft/STL/pull/4540) Repeating a `repeat_view` should repeat the view - Fixed bugs: * Fixed `condition_variable::wait_until()` and `condition_variable_any::wait_until()` to consistently use the given `time_point`'s clock type, instead of also depending on the system clock. This also fixed `condition_variable::wait_for()` to consistently use `steady_clock`. [#4457](https://github.com/microsoft/STL/pull/4457) * Fixed `<format>` to always perform compile-time format string checking for `wchar_t`, even when the narrow execution character set doesn't support it. [#4459](https://github.com/microsoft/STL/pull/4459) * Fixed compiler errors when `constexpr basic_string` interacted with the undocumented compiler option `/d1initall`. [#4474](https://github.com/microsoft/STL/pull/4474) * Fixed `atomic_ref` for 16-byte objects to correctly report `is_lock_free()` and `is_always_lock_free` on x64 (when the optional mode `_STD_ATOMIC_ALWAYS_USE_CMPXCHG16B` is defined to be `1`) and ARM64 (always). [#4478](https://github.com/microsoft/STL/pull/4478) * Removed the vectorized implementation of `ranges::find` with `unreachable_sentinel` as it was fundamentally incompatible with ASan (Address Sanitizer). [#4486](https://github.com/microsoft/STL/pull/4486) + This was introduced by [#2434](https://github.com/microsoft/STL/pull/2434) in VS 2022 17.3. * Fixed incorrect results from the vectorized implementation of `ranges::find_last` for certain combinations of value and element types. [#4561](https://github.com/microsoft/STL/pull/4561) + This fixed a regression that was introduced by [#3925](https://github.com/microsoft/STL/pull/3925) in VS 2022 17.9. * Fixed the STL to avoid emitting the off-by-default warning C4365 (signed/unsigned mismatch) when the [`/ZI` compiler option](https://learn.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format?view=msvc-170) (debug info for Edit and Continue) is used. [#4487](https://github.com/microsoft/STL/pull/4487) + These warnings were most noticeable when building the Standard Library Modules, but they were also emitted by classic includes. * Fixed the STL to avoid emitting the off-by-default warning C5246 (brace elision). [#4527](https://github.com/microsoft/STL/pull/4527) * Fixed compiler errors involving incomplete types in: + `pair` and `tuple` machinery. [#4488](https://github.com/microsoft/STL/pull/4488) * Fixed `make_from_tuple()` to properly implement [LWG-3528](https://wg21.link/lwg3528) with a constraint instead of a `static_assert`. [#4528](https://github.com/microsoft/STL/pull/4528) * Added integral overloads for `<cmath>`'s classification functions `fpclassify()`, `isfinite()`, `isinf()`, `isnan()`, `isnormal()`, and `signbit()`. [#4537](https://github.com/microsoft/STL/pull/4537) * Fixed `is_trivial` to correctly handle unusual types. [#4576](https://github.com/microsoft/STL/pull/4576) * Avoided mentioning `__vectorcall` for ARM64EC, where it is not yet supported. [#4600](https://github.com/microsoft/STL/pull/4600) * Fixed `std.ixx` to include `<intrin.h>` in the Global Module Fragment, fixing compiler errors with `import std;` in certain scenarios. [#4626](https://github.com/microsoft/STL/pull/4626) * Fixed compiler errors when a user-defined `formatter` calls `basic_format_parse_context::next_arg_id()` with an empty format-spec. [#4640](https://github.com/microsoft/STL/pull/4640) * Fixed compiler errors when using `<expected>` in `/permissive` mode. [#4658](https://github.com/microsoft/STL/pull/4658) + *Note:* While `/permissive` mode is discouraged, it's currently supported for most STL components. * Fixed compiler errors when inheriting `expected`'s constructors in certain scenarios. [#4664](https://github.com/microsoft/STL/pull/4664) * Fixed `pair`'s self-`swap()` behavior to follow the Standard by self-swapping its elements. [#4674](https://github.com/microsoft/STL/pull/4674) * Fixed `atomic<void*>` and `atomic_ref<void*>` to provide `difference_type`. [#4689](https://github.com/microsoft/STL/pull/4689) - Improved performance: * Helped the compiler auto-vectorize: + `replace_copy()`, `replace_copy_if()`, `ranges::replace_copy`, and `ranges::replace_copy_if`. [#4431](https://github.com/microsoft/STL/pull/4431) + `iota()`. [#4627](https://github.com/microsoft/STL/pull/4627) + `ranges::iota`. [#4647](https://github.com/microsoft/STL/pull/4647) * Added vectorized implementations of: + `find_first_of()` and `ranges::find_first_of`. [#4466](https://github.com/microsoft/STL/pull/4466) [#4557](https://github.com/microsoft/STL/pull/4557) [#4563](https://github.com/microsoft/STL/pull/4563) [#4587](https://github.com/microsoft/STL/pull/4587) [#4623](https://github.com/microsoft/STL/pull/4623) + `mismatch()` and `ranges::mismatch`. [#4495](https://github.com/microsoft/STL/pull/4495) [#4538](https://github.com/microsoft/STL/pull/4538) [#4584](https://github.com/microsoft/STL/pull/4584) + `replace()` and `ranges::replace` for 32-bit and 64-bit elements. [#4554](https://github.com/microsoft/STL/pull/4554) [#4584](https://github.com/microsoft/STL/pull/4584) + `lexicographical_compare()`, `ranges::lexicographical_compare`, and `lexicographical_compare_three_way()`. [#4552](https://github.com/microsoft/STL/pull/4552) * Further improved the vectorized implementations of: + `count()`, `find()`, `ranges::count`, `ranges::find`, and `ranges::find_last`. [#4570](https://github.com/microsoft/STL/pull/4570) [#4614](https://github.com/microsoft/STL/pull/4614) * Used Clang builtins to improve the performance of `<cmath>`'s floating-point classification and comparison functions: [#4612](https://github.com/microsoft/STL/pull/4612) + Classification: `isfinite()`, `isinf()`, `isnan()`, `isnormal()` + Comparison: `isgreater()`, `isgreaterequal()`, `isless()`, `islessequal()`, `islessgreater()`, `isunordered()` * Improved `normal_distribution::operator()(engine, param)` by avoiding unnecessarily recomputing coefficients. [#4618](https://github.com/microsoft/STL/pull/4618) - Improved throughput: * Slightly improved `<mdspan>` throughput by using short-circuiting `conjunction_v` instead of fold expressions. [#4559](https://github.com/microsoft/STL/pull/4559) * Refactored floating-point machinery, improving throughput by reducing inclusion of various headers. [#4615](https://github.com/microsoft/STL/pull/4615) * Improved `<string_view>` throughput by no longer dragging in most of `<string>`'s contents. [#4633](https://github.com/microsoft/STL/pull/4633) - Improved diagnostics: * Improved compiler error messages when `formatter<UDT>::format()` isn't `const`. [#4461](https://github.com/microsoft/STL/pull/4461) * Massively improved the compiler error messages for `get<T>(tuple<Types...>)` when `T` doesn't occur exactly once in `Types`. [#4578](https://github.com/microsoft/STL/pull/4578) * Significantly improved compiler error messages when `ranges::to` is unable to construct the requested result. [#4608](https://github.com/microsoft/STL/pull/4608) - Enhanced behavior: * To reduce risk, the STL no longer attempts to activate vectorized implementations of algorithms for ancient processors that support SSE2 but not SSE4.2. [#4550](https://github.com/microsoft/STL/pull/4550) + This consolidated the STL's levels of vectorization to none, SSE4.2, and AVX2. + This also slightly improved performance (for non-ancient processors) by taking advantage of newer instructions in codepaths that previously restricted themselves to SSE2. * Added precondition checking in debug mode to: + `views::take`. [#4551](https://github.com/microsoft/STL/pull/4551) + The `iota_view(first, last)` constructor. [#4616](https://github.com/microsoft/STL/pull/4616) * Improved the wording of `[[nodiscard("reason")]]` messages for `empty()`. [#4572](https://github.com/microsoft/STL/pull/4572) * Extended C++20's `static_assert(is_clock_v<Clock>)` enforcement for various codepaths to C++14/17 (with internal machinery; `is_clock_v` itself remains guarded by C++20 mode). [#4585](https://github.com/microsoft/STL/pull/4585) * Changed the internal constructors of `basic_format_arg::handle` and `basic_format_context` to be `private`. [#4489](https://github.com/microsoft/STL/pull/4489) * Deprecation warnings for several non-Standard extensions are now emitted in all Standard modes, not just C++17 and later. These extensions will be removed in the future; you have been warned: [#4605](https://github.com/microsoft/STL/pull/4605) + `stdext::checked_array_iterator`, `stdext::make_checked_array_iterator()`, `stdext::unchecked_array_iterator`, and `stdext::make_unchecked_array_iterator()`. + `basic_istream`'s `ipfx()`/`isfx()` and `basic_ostream`'s `opfx()`/`osfx()` member functions. + `discard_block`, `linear_congruential`, `mersenne_twister`, `subtract_with_carry`, `uniform_int`, and `uniform_real`. - Removed non-Standard code: * Deleted the `<cvt/meow>` subdirectory of headers, shrinking VS installations by 4.8 MB across 78 files. [#4458](https://github.com/microsoft/STL/pull/4458) * Deleted the `<experimental/meow>` headers that provided `std::experimental::erase()/erase_if()`. [#4470](https://github.com/microsoft/STL/pull/4470) * Removed the non-Standard `_FPOSOFF` macro and the non-Standard `std::fpos::seekpos()` member function. [#4606](https://github.com/microsoft/STL/pull/4606) * Removed the non-Standard `lower_bound()`/`upper_bound()` member functions from the unordered associative containers. [#4607](https://github.com/microsoft/STL/pull/4607) - Improved test coverage: * Added benchmarks for vectorized `swap_ranges()`. [#4589](https://github.com/microsoft/STL/pull/4589) * Added a workaround for an ASan failure in an ancient STL test. [#4652](https://github.com/microsoft/STL/pull/4652) * Reduced the execution time of the vectorized algorithms test by using the result of `mismatch()` when testing `lexicographical_compare()` and `lexicographical_compare_three_way()`. [#4656](https://github.com/microsoft/STL/pull/4656) * Improved the `<filesystem>` test, including its coverage of `rename()` and how it generates names for temporary files and directories. [#4665](https://github.com/microsoft/STL/pull/4665) * Re-enabled tests that were previously skipped in the `libcxx` test suite. [#4698](https://github.com/microsoft/STL/pull/4698) * Updated our LLVM submodule, including new tests. [#4702](https://github.com/microsoft/STL/pull/4702) - Code cleanups: * Removed compiler bug workarounds. [#4475](https://github.com/microsoft/STL/pull/4475) [#4576](https://github.com/microsoft/STL/pull/4576) * Various cleanups (described in detail in the PRs, not repeated here). [#4465](https://github.com/microsoft/STL/pull/4465) [#4490](https://github.com/microsoft/STL/pull/4490) [#4493](https://github.com/microsoft/STL/pull/4493) * Improved the script for downloading Unicode data files when updating `<format>`. [#4469](https://github.com/microsoft/STL/pull/4469) * Consistently centralized how algorithms invoke their vectorized implementations. [#4544](https://github.com/microsoft/STL/pull/4544) * Simplified how `condition_variable` is implemented as a wrapper around the Windows API `CONDITION_VARIABLE`. [#4545](https://github.com/microsoft/STL/pull/4545) * Removed `inline` from `constexpr` variable templates. [#4546](https://github.com/microsoft/STL/pull/4546) + This became possible after all of our supported compilers implemented [CWG-2387](https://wg21.link/cwg2387). Note that for `constexpr` variables, only primary templates and partial specializations no longer need to be marked as `inline`; explicit specializations and ordinary non-templates still need to be marked as `inline`. * Changed machinery for updating `chrono::tzdb::version` to activate the Named Return Value Optimization. [#4577](https://github.com/microsoft/STL/pull/4577) * Updated tests to use C++17 terse `static_assert`. [#4588](https://github.com/microsoft/STL/pull/4588) * Simplified function templates to use `static_assert(false)` as permitted by [CWG-2518](https://wg21.link/cwg2518). [#4591](https://github.com/microsoft/STL/pull/4591) * Simplified debug checks for comparison function objects by using `if constexpr`. [#4610](https://github.com/microsoft/STL/pull/4610) * Simplified `char_traits::assign()` by removing unnecessary codepaths for constant evaluation. [#4613](https://github.com/microsoft/STL/pull/4613) * Changed checks for damaged logic in the STL itself to use internal `static_assert` macros, which expand to nothing outside of the STL's test suites. [#4624](https://github.com/microsoft/STL/pull/4624) * Simplified `ranges::stable_sort` to use `iter_value_t` instead of an internal helper. [#4628](https://github.com/microsoft/STL/pull/4628) * Changed the STL to use `in_range<T>()` more and `numeric_limits<T>::min()`/`max()` less. [#4634](https://github.com/microsoft/STL/pull/4634) * Replaced SFINAE with concepts in C++20-and-later code. [#4637](https://github.com/microsoft/STL/pull/4637) * Simplified the vectorized implementation of the `minmax()` family for 64-bit elements. [#4661](https://github.com/microsoft/STL/pull/4661) * Modernized our usage of Google Benchmark. [#4662](https://github.com/microsoft/STL/pull/4662) - Infrastructure improvements: * Overhauled our Azure Pipelines machinery: [#4594](https://github.com/microsoft/STL/pull/4594) [#4687](https://github.com/microsoft/STL/pull/4687) + Introduced "Early Build" stages to quickly find compiler errors when building the STL. + Improved the reliability of the submodule checkout task. + Improved how clang-format diffs are uploaded and logged. * Updated dependencies. [#4475](https://github.com/microsoft/STL/pull/4475) [#4492](https://github.com/microsoft/STL/pull/4492) [#4576](https://github.com/microsoft/STL/pull/4576) [#4568](https://github.com/microsoft/STL/pull/4568) [#4594](https://github.com/microsoft/STL/pull/4594) [#4687](https://github.com/microsoft/STL/pull/4687) + Updated build compiler to VS 2022 17.11 Preview 1. + Updated to Windows 11 SDK 22621. This is now required for building and testing the STL, but not for using it. + Updated CUDA to 12.4.0 (now required). + Updated Python to 3.12.3. + Updated Boost.Math to 1.85.0. [#4599](https://github.com/microsoft/STL/pull/4599) + Updated Google Benchmark to 1.8.4. [#4694](https://github.com/microsoft/STL/pull/4694) - Updated `_MSVC_STL_UPDATE`. [#4467](https://github.com/microsoft/STL/pull/4467) [#4556](https://github.com/microsoft/STL/pull/4556) [#4655](https://github.com/microsoft/STL/pull/4655) # VS 2022 17.10 - Merged C++26 features: * [P2510R3](https://wg21.link/P2510R3) [#4198](https://github.com/microsoft/STL/pull/4198) Formatting Pointers * [P2937R0](https://wg21.link/P2937R0) [#4203](https://github.com/microsoft/STL/pull/4203) Freestanding Library: Remove `strtok` - Merged C++23 Defect Reports: * [P2836R1](https://wg21.link/P2836R1) [#4188](https://github.com/microsoft/STL/pull/4188) `basic_const_iterator` Should Follow Its Underlying Type's Convertibility - Merged *partial* C++23 features: * [P2286R8](https://wg21.link/P2286R8) Formatting Ranges: + Implemented `formatter<vector<bool>::reference>`. [#4133](https://github.com/microsoft/STL/pull/4133) - Merged C++20 Defect Reports: * [P2905R2](https://wg21.link/P2905R2) [#4196](https://github.com/microsoft/STL/pull/4196) Runtime Format Strings * [P2909R4](https://wg21.link/P2909R4) [#4189](https://github.com/microsoft/STL/pull/4189) Fix Formatting Of Code Units As Integers - Merged LWG issue resolutions: * [LWG-3749](https://wg21.link/lwg3749) [#4190](https://github.com/microsoft/STL/pull/4190) `common_iterator` should handle integer-class difference types * [LWG-3809](https://wg21.link/lwg3809) [#4194](https://github.com/microsoft/STL/pull/4194) Is `subtract_with_carry_engine<uint16_t>` supposed to work? * [LWG-3897](https://wg21.link/lwg3897) [#4186](https://github.com/microsoft/STL/pull/4186) `inout_ptr` will not update raw pointer to null * [LWG-3946](https://wg21.link/lwg3946) [#4187](https://github.com/microsoft/STL/pull/4187) The definition of `const_iterator_t` should be reworked * [LWG-3947](https://wg21.link/lwg3947) [#4195](https://github.com/microsoft/STL/pull/4195) Unexpected constraints on `adjacent_transform_view::base()` * [LWG-3949](https://wg21.link/lwg3949) [#4204](https://github.com/microsoft/STL/pull/4204) `atomic<bool>`'s trivial destructor dropped in C++17 spec wording * [LWG-3953](https://wg21.link/lwg3953) [#4167](https://github.com/microsoft/STL/pull/4167) `iter_move` for `common_iterator` and `counted_iterator` should return `decltype(auto)` * [LWG-3974](https://wg21.link/lwg3974) [#4214](https://github.com/microsoft/STL/pull/4214) `mdspan::operator[]` should not copy `OtherIndexTypes` * [LWG-4001](https://wg21.link/lwg4001) [#4193](https://github.com/microsoft/STL/pull/4193) `iota_view` should provide `empty` - Fixed bugs: * Fixed `mutex`'s constructor to be `constexpr`. [#3824](https://github.com/microsoft/STL/pull/3824) [#4000](https://github.com/microsoft/STL/pull/4000) [#4339](https://github.com/microsoft/STL/pull/4339) + *Note:* Programs that aren't following the documented [restrictions on binary compatibility](https://learn.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=msvc-170) may encounter null dereferences in `mutex` machinery. You **must** follow this rule: > When you mix binaries built by different supported versions of the toolset, the Redistributable version must be at least as new as the latest toolset used by any app component. + You can define `_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR` as an escape hatch. * Fixed `<format>`'s compile-time format string checking: + To detect when user-defined `formatter` specializations reject omitted format specifications like `"{}"`. [#4078](https://github.com/microsoft/STL/pull/4078) + To require that dynamic width and precision arguments have integral types. [#4155](https://github.com/microsoft/STL/pull/4155) * Fixed how `format()` handles empty strings like `format("{:a<10}", "")`. [#4243](https://github.com/microsoft/STL/pull/4243) * Fixed `<format>` to properly handle floating-point values in a specific situation. When a *format-specifier* appears without any *precision* or *type*, shortest round-trip formatting should be used instead of `chars_format::general`. [#4327](https://github.com/microsoft/STL/pull/4327) + Example format strings: `"{:}"` and `"{0:}"` were affected, as they have an optional *arg-id* (`0`) followed by a *format-specifier* (`:`) with an empty *format-spec* (nothing after the `:`). + More common format strings like `"{}"` and `"{0}"` were unaffected, as they entirely lack a *format-specifier*. + Example value: For `12345678.0`, the shortest round-trip rules produce `"12345678"`, while the `chars_format::general` rules produce `"1.2345678e+07"`. * Fixed `<format>` to properly handle locale-specific floating-point formatting with a minimum field width, taking digit separators into account. [#4421](https://github.com/microsoft/STL/pull/4421) * Fixed `format()` to accept `%X` and `%EX` for `chrono::duration` and `chrono::hh_mm_ss`. [#4250](https://github.com/microsoft/STL/pull/4250) * Fixed `chrono::duration` formatting to respect dynamically provided widths. [#4283](https://github.com/microsoft/STL/pull/4283) * Fixed crashes and incorrect results in the vectorized implementation of `ranges::find` with `unreachable_sentinel`. [#4450](https://github.com/microsoft/STL/pull/4450) + This fixed regressions that were introduced by [#2434](https://github.com/microsoft/STL/pull/2434) in VS 2022 17.3. * Fixed `ranges::to` to properly reject certain invalid uses with compiler errors, instead of trapping compilers in infinite loops of doom. [#4142](https://github.com/microsoft/STL/pull/4142) * Fixed `ranges::to` to accept certain container constructors taking a range followed by more than one argument. [#4218](https://github.com/microsoft/STL/pull/4218) * Fixed compiler errors involving range adaptor closure objects in unusual scenarios. [#4211](https://github.com/microsoft/STL/pull/4211) * Fixed `ranges::ssize` to be conditionally `noexcept` as required by the Standard. [#4231](https://github.com/microsoft/STL/pull/4231) * Fixed `join_view` and `join_with_view`'s iterators to be default constructible. [#4264](https://github.com/microsoft/STL/pull/4264) * Fixed truncation warnings when using `views::repeat`. [#4255](https://github.com/microsoft/STL/pull/4255) * Fixed compiler errors when using `views::zip_transform` with ranges that must be non-`const` to be iterated through, such as `views::filter`. [#4416](https://github.com/microsoft/STL/pull/4416) * Fixed compiler errors when using `views::pairwise_transform` and `views::adjacent_transform` via Standard Library Modules. [#4420](https://github.com/microsoft/STL/pull/4420) * Fixed incorrect output from iostreams (like `"i.nf"`) when printing infinity and NaN values with `setprecision(0) << showpoint << fixed`. [#4212](https://github.com/microsoft/STL/pull/4212) * Fixed problems involving unusual allocators with size types other than `size_t`: + Compiler errors in `basic_stringbuf::overflow()`. [#4219](https://github.com/microsoft/STL/pull/4219) + Truncation warnings in `basic_stringbuf`'s constructor, `string`/`vector` iterator subtraction, `ranges::is_permutation`, and `allocate_shared()`. [#4228](https://github.com/microsoft/STL/pull/4228) [#4237](https://github.com/microsoft/STL/pull/4237) [#4252](https://github.com/microsoft/STL/pull/4252) * Fixed `<atomic>` correctness issues for ARM64 CHPE (`_M_HYBRID_X86_ARM64`). [#4222](https://github.com/microsoft/STL/pull/4222) * Fixed `atomic` by adding `atomic& operator=(const atomic&) volatile = delete;` as required by the Standard. [#4287](https://github.com/microsoft/STL/pull/4287) * Fixed `atomic<shared_ptr>::wait()` and `atomic<weak_ptr>::wait()` to properly detect equivalent smart pointers. [#3655](https://github.com/microsoft/STL/pull/3655) * Fixed sign-compare warnings in `<mdspan>` when using `extents` with different index types. [#4227](https://github.com/microsoft/STL/pull/4227) * Fixed compiler errors in `<mdspan>` when constructing unusual mappings. [#4236](https://github.com/microsoft/STL/pull/4236) * Fixed bugs specific to extremely unusual fancy pointers: + Fixed how such `vector`s interact with ranges algorithms. [#4244](https://github.com/microsoft/STL/pull/4244) + Fixed how such `vector`s and `basic_string`s interact with classic algorithms and iterator spaceship comparisons. [#4275](https://github.com/microsoft/STL/pull/4275) * Fixed compiler errors when constructing `locale{nullptr}`. [#4245](https://github.com/microsoft/STL/pull/4245) + Rejoice, for now you can get a guaranteed `runtime_error`! * Fixed compiler errors when overloading `next()`, `prev()`, `shift_left()`, and `shift_right()` with concept-constrained functions that should be preferred during overload resolution. [#4249](https://github.com/microsoft/STL/pull/4249) * Fixed compiler errors when comparing a `sub_match` with the spaceship operator `<=>` to a `basic_string` with a custom traits and/or allocator type. [#4253](https://github.com/microsoft/STL/pull/4253) * Fixed sequence container constructors to avoid interfering with CTAD (class template argument deduction) for `(Iter, Iter, BadAlloc)`; now this will SFINAE away instead of emitting a hard compiler error. [#4254](https://github.com/microsoft/STL/pull/4254) * Fixed compiler errors in parallel `transform_reduce()` when performing narrowing conversions. [#4260](https://github.com/microsoft/STL/pull/4260) + As usual, asking the STL to perform conversions on your behalf may emit sign/truncation compiler warnings; this is by design. * Fixed compiler errors during `constexpr` evaluation of `vector<bool>` caused by improper casting in iterator debugging machinery. [#4276](https://github.com/microsoft/STL/pull/4276) * Fixed compiler errors (by adding a compiler bug workaround) when using `constexpr` `invoke()` to call pointers to data members with `reference_wrapper` arguments. [#4277](https://github.com/microsoft/STL/pull/4277) * Added macroization defenses for the STL's non-Standard extensions (e.g. `type_info`'s `raw_name` member function). [#4285](https://github.com/microsoft/STL/pull/4285) * Fixed floating-point `to_chars()` on ARM64 to return correct results. [#4304](https://github.com/microsoft/STL/pull/4304) * Fixed compiler errors when defining variadic alias templates for `is_nothrow_convertible`. [#4318](https://github.com/microsoft/STL/pull/4318) * Fixed `filesystem::is_empty()` and `filesystem::directory_iterator` to handle empty volumes (before they've been assigned a drive letter). [#4311](https://github.com/microsoft/STL/pull/4311) * Fixed compiler errors in algorithms involving highly unusual types. [#4233](https://github.com/microsoft/STL/pull/4233) [#4419](https://github.com/microsoft/STL/pull/4419) * Fixed `basic_stringbuf` to avoid implementing moving with swapping, which is a correctness issue for unusual custom allocators. [#4239](https://github.com/microsoft/STL/pull/4239) * Fixed `deque::shrink_to_fit()` to follow the Standard instead of unconditionally moving elements. [#4091](https://github.com/microsoft/STL/pull/4091) * Fixed `allocate_shared_for_overwrite()` to directly destroy objects, instead of using `Alloc::destroy()`. [#4274](https://github.com/microsoft/STL/pull/4274) * Removed `ios_base::hexfloat`, a non-Standard bitmask element. [#4345](https://github.com/microsoft/STL/pull/4345) + The Standard ways to request hexadecimal floating-point output are to use the `ios_base::fixed | ios_base::scientific` bitmask elements together or to use the `std::hexfloat` manipulator. * Fixed `std.ixx` to export VCRuntime machinery with Standard-conforming techniques. [#4375](https://github.com/microsoft/STL/pull/4375) + This affects things like `std::exception`, `std::type_info`, and `::operator new`. The MSVC compiler currently doesn't enforce the rule in question here, but stricter tools might notice this. * Fixed `basic_ostream::operator<<(basic_streambuf*)` to rethrow caught exceptions only when `failbit` is set in `exceptions()`. [#4372](https://github.com/microsoft/STL/pull/4372) * Fixed `unordered_map` and `unordered_set`'s equality operators to test elements for equality (via their `operator==`), not just equivalence (via the container's predicate for keys). [#4406](https://github.com/microsoft/STL/pull/4406) + `unordered_multimap` and `unordered_multiset` already behaved correctly. * Silenced "warning C4324: structure was padded due to alignment specifier" in all STL headers. [#4426](https://github.com/microsoft/STL/pull/4426) + This was spuriously emitted by certain combinations of code, e.g. `views::cartesian_product` with `views::filter`. * Fixed `time_get::date_order()` to correctly return `time_base::mdy` for the "C" locale, instead of picking up the date order for the current user locale. [#4437](https://github.com/microsoft/STL/pull/4437) * Fixed `seed_seq::generate(RanIt, RanIt)` to `static_assert` that the iterator's value type is at least a 32-bit unsigned integer type. [#4447](https://github.com/microsoft/STL/pull/4447) * Fixed compiler errors involving incomplete types in: + Non-modifying algorithms. [#4138](https://github.com/microsoft/STL/pull/4138) + `erase()`, `erase_if()`, `remove()`, `remove_if()`. [#4217](https://github.com/microsoft/STL/pull/4217) + \[alg.min.max\], \[alg.clamp\], \[alg.lex.comparison\], \[alg.three.way\] algorithms. [#4216](https://github.com/microsoft/STL/pull/4216) + `atomic` and `atomic_ref`. [#4221](https://github.com/microsoft/STL/pull/4221) + Modifying algorithms. [#4256](https://github.com/microsoft/STL/pull/4256) + Container operations taking iterator pairs. [#4258](https://github.com/microsoft/STL/pull/4258) + `is_nothrow_convertible`. [#4318](https://github.com/microsoft/STL/pull/4318) + Comparison operators. [#4334](https://github.com/microsoft/STL/pull/4334) + Merge algorithms, set operations, heap operations, and permutation generators. [#4347](https://github.com/microsoft/STL/pull/4347) + Sorting and related algorithms. [#4367](https://github.com/microsoft/STL/pull/4367) + `vector`'s destructor and other member functions. [#4373](https://github.com/microsoft/STL/pull/4373) + Uninitialized memory algorithms. [#4374](https://github.com/microsoft/STL/pull/4374) + `default_searcher`. [#4379](https://github.com/microsoft/STL/pull/4379) + `<ranges>` views. [#4389](https://github.com/microsoft/STL/pull/4389) + Numeric algorithms. [#4391](https://github.com/microsoft/STL/pull/4391) + `ranges::advance`, `ranges::distance`, `span` constructors, and `condition_variable::wait_for`. [#4402](https://github.com/microsoft/STL/pull/4402) + `shared_ptr` creation functions and `atomic` smart pointers. [#4403](https://github.com/microsoft/STL/pull/4403) + `function`, `move_only_function`, `packaged_task`, `promise`, and `optional`. [#4430](https://github.com/microsoft/STL/pull/4430) - Improved performance: * Improved `<atomic>` performance: [#4222](https://github.com/microsoft/STL/pull/4222) + For ARM64, significantly improved the performance of `atomic<T>::load()` (taking no arguments, requesting sequential consistency), matching how [#3399](https://github.com/microsoft/STL/pull/3399) in VS 2022 17.6 improved `atomic<T>::load(memory_order_seq_cst)`. + For ARM64 CHPE (`_M_HYBRID_X86_ARM64`), `atomic<T>`'s `exchange`/`compare_exchange_MEOW`/`fetch_MEOW` now respect `memory_order` arguments instead of always providing sequential consistency. Also, ARM64 CHPE now benefits from all of [#3399](https://github.com/microsoft/STL/pull/3399)'s major improvements. * Improved `atomic::wait` family performance by internally using `memory_order_acq_rel` instead of `memory_order_seq_cst` when initializing OS support functions. [#4288](https://github.com/microsoft/STL/pull/4288) * Slightly improved the codegen for `uniform_int_distribution`. [#4234](https://github.com/microsoft/STL/pull/4234) * Optimized `filesystem::path`'s `operator/` to perform a single memory allocation for common cases. [#4136](https://github.com/microsoft/STL/pull/4136) * Slightly improved performance by taking advantage of [P1169R4](https://wg21.link/P1169R4) `static operator()` in the STL's stateless function objects and lambdas. [#4358](https://github.com/microsoft/STL/pull/4358) + This is conditional on compiler feature availability (currently implemented by Clang), but not on Standard mode. Like C++17 `if constexpr` and C++20 `explicit(bool)`, compilers will support C++23 `static operator()` in earlier Standard modes (emitting warnings that Future Technology is being used, which the STL internally suppresses). * Added a vectorized implementation of `bitset::to_string()`. [#3960](https://github.com/microsoft/STL/pull/3960) [#4382](https://github.com/microsoft/STL/pull/4382) [#4422](https://github.com/microsoft/STL/pull/4422) * Improved the vectorized implementations of `min_element()`, `max_element()`, `minmax_element()`, and related algorithms: + Extended them to handle floating-point types. [#3928](https://github.com/microsoft/STL/pull/3928) + Further improved performance by restructuring control flow. [#4401](https://github.com/microsoft/STL/pull/4401) * Improved the vectorized implementations of `ranges::min`, `ranges::max`, `ranges::minmax`, and the `min()`, `max()`, and `minmax()` overloads for `initializer_list`. [#4384](https://github.com/microsoft/STL/pull/4384) + These algorithms only need to track values, not locations. * Changed the destructors of `mutex` and `recursive_mutex` to be trivial. [#4390](https://github.com/microsoft/STL/pull/4390) + This especially benefits variables with static storage duration, as they no longer need "dynamic `atexit` destructors". * Slightly improved performance by replacing `CRITICAL_SECTION` with `SRWLOCK` in: + `get_new_handler()` and `set_new_handler()`. [#4407](https://github.com/microsoft/STL/pull/4407) + At-thread-exit machinery. [#4408](https://github.com/microsoft/STL/pull/4408) - Enhanced behavior: * Wrapped the STL in `extern "C++"` as a temporary workaround to allow `#include <meow>` to coexist with `import std;` in the same translation unit, *in that order*. [#4154](https://github.com/microsoft/STL/pull/4154) + The other order, `import std;` before `#include <meow>`, will still cause compiler errors. We're working on a long-term solution. * The C++17 Standard added `invoke()` and the C++20 Standard made it `constexpr`. Previously, MSVC made non-`constexpr` `invoke()` unconditionally available, and `constexpr` `invoke()` available in C++17 mode, as minor extensions. Now, `constexpr` `invoke()` is unconditionally available. [#4080](https://github.com/microsoft/STL/issues/4080) * Improved `shared_ptr` constructor constraints to avoid forming invalid types. [#4290](https://github.com/microsoft/STL/pull/4290) * Updated `<charconv>` to use the `__umulh` intrinsic for ARM64 CHPE (`_M_HYBRID_X86_ARM64`). [#4330](https://github.com/microsoft/STL/pull/4330) * Improved `expected`'s copy/move assignment operators to be trivial when possible, like how `optional` and `variant` already behave. [#4271](https://github.com/microsoft/STL/pull/4271) * Improved `<random>`'s TR1 legacy code: [#4284](https://github.com/microsoft/STL/pull/4284) + Deprecated the non-Standard engines (`discard_block`, `linear_congruential`, `mersenne_twister`, `subtract_with_carry`) and distributions (`uniform_int`, `uniform_real`) that are still provided in the `std` namespace. + Removed non-Standard machinery from Standard engines and distributions. (For example, certain `static constexpr` data members in `mersenne_twister_engine` and an extra function call operator overload in `uniform_int_distribution`.) * Changed `basic_regex`'s constructor to throw an exception instead of stack overflowing when the pattern contains an excessive number of capture groups. [#4451](https://github.com/microsoft/STL/pull/4451) + Currently, this arbitrarily limits the number of capture groups to 1000. - Improved test coverage: * Updated the STL-ASan-CI pipeline. [#4240](https://github.com/microsoft/STL/pull/4240) [#4295](https://github.com/microsoft/STL/pull/4295) * Added support for building the STL's separately compiled code with ASan instrumentation and enabled this in the STL-ASan-CI pipeline. [#4313](https://github.com/microsoft/STL/pull/4313) * Updated our LLVM submodule, including new tests. [#4263](https://github.com/microsoft/STL/pull/4263) [#4267](https://github.com/microsoft/STL/pull/4267) [#4270](https://github.com/microsoft/STL/pull/4270) [#4272](https://github.com/microsoft/STL/pull/4272) [#4328](https://github.com/microsoft/STL/pull/4328) [#4336](https://github.com/microsoft/STL/pull/4336) [#4348](https://github.com/microsoft/STL/pull/4348) [#4355](https://github.com/microsoft/STL/pull/4355) * Minor test improvements, including printing exit codes in both decimal and hex. [#4309](https://github.com/microsoft/STL/pull/4309) * Improved output for "unresolved" test failures. [#4323](https://github.com/microsoft/STL/pull/4323) * Fixed sporadic "unresolved" test failures. [#4366](https://github.com/microsoft/STL/pull/4366) * Updated CTest to avoid running 2N tests in parallel, where N is the number of cores available. [#4335](https://github.com/microsoft/STL/pull/4335) * Enabled `__cpp_lib_concepts` for our command-line test coverage of the EDG compiler front-end. [#4296](https://github.com/microsoft/STL/pull/4296) [#4297](https://github.com/microsoft/STL/pull/4297) [#4440](https://github.com/microsoft/STL/pull/4440) + `__cpp_lib_concepts` was already enabled for EDG-powered IntelliSense in the VS IDE, so this change isn't directly observable by users, it'll just help the STL work better with IntelliSense in the future. * Enabled compiler warnings when building the STL's benchmarks. [#4356](https://github.com/microsoft/STL/pull/4356) * Added benchmarks for vectorized `ranges::find` and `ranges::count`. [#4387](https://github.com/microsoft/STL/pull/4387) + This also covers classic `find()` and `count()`, which share the same vectorized implementation. * Fixed the test harness to handle paths case-insensitively. [#4395](https://github.com/microsoft/STL/pull/4395) * Updated tests to work with Clang 18. [#4452](https://github.com/microsoft/STL/pull/4452) * Enabled more test coverage for the off-by-default warning C4668 "`'MEOW'` is not defined as a preprocessor macro, replacing with `'0'` for `'#if/#elif'`". [#4441](https://github.com/microsoft/STL/pull/4441) - Code cleanups: * Various cleanups (described in detail in the PRs, not repeated here). [#4143](https://github.com/microsoft/STL/pull/4143) [#4145](https://github.com/microsoft/STL/pull/4145) [#4146](https://github.com/microsoft/STL/pull/4146) [#4147](https://github.com/microsoft/STL/pull/4147) [#4149](https://github.com/microsoft/STL/pull/4149) [#4151](https://github.com/microsoft/STL/pull/4151) [#4192](https://github.com/microsoft/STL/pull/4192) [#4229](https://github.com/microsoft/STL/pull/4229) [#4230](https://github.com/microsoft/STL/pull/4230) [#4362](https://github.com/microsoft/STL/pull/4362) [#4439](https://github.com/microsoft/STL/pull/4439) [#4442](https://github.com/microsoft/STL/pull/4442) [#4443](https://github.com/microsoft/STL/pull/4443) [#4444](https://github.com/microsoft/STL/pull/4444) [#4445](https://github.com/microsoft/STL/pull/4445) * Removed unnecessary `typename` keywords in C++20 mode and later. [#4191](https://github.com/microsoft/STL/pull/4191) * Removed compiler bug workarounds. [#4197](https://github.com/microsoft/STL/pull/4197) [#4259](https://github.com/microsoft/STL/pull/4259) [#4340](https://github.com/microsoft/STL/pull/4340) [#4392](https://github.com/microsoft/STL/pull/4392) * Removed an enormous amount of code that was dealing with `__cpp_lib_concepts` missing in C++20 mode. [#4298](https://github.com/microsoft/STL/pull/4298) [#4364](https://github.com/microsoft/STL/pull/4364) + Now, the STL's product and test code assumes that concepts are always available in C++20 mode, with targeted workarounds for reported compiler bugs. * Unified our internal stringizing macros. [#4405](https://github.com/microsoft/STL/pull/4405) * Added top-level `const` to function parameters in the vectorized implementations of algorithms. [#4410](https://github.com/microsoft/STL/pull/4410) * Added a script to download Unicode data files when updating `<format>`. [#4435](https://github.com/microsoft/STL/pull/4435) * Simplified how we handle Unicode field widths when updating `<format>`. Now we use a single script to process all Unicode data files, emitting tables into a single generated header. [#4446](https://github.com/microsoft/STL/pull/4446) * Used `if constexpr` to simplify helper functions for allocating and deallocating memory. [#4432](https://github.com/microsoft/STL/pull/4432) - Infrastructure improvements: * Updated dependencies. [#4197](https://github.com/microsoft/STL/pull/4197) [#4206](https://github.com/microsoft/STL/pull/4206) [#4259](https://github.com/microsoft/STL/pull/4259) [#4303](https://github.com/microsoft/STL/pull/4303) [#4392](https://github.com/microsoft/STL/pull/4392) + Updated build compiler to VS 2022 17.10 Preview 1 (now required). + Updated CMake to 3.28 (now required). + Updated Clang to 17.0.3 (now required). + Updated Python to 3.12.2. + Updated Boost.Math to 1.84.0. [#4280](https://github.com/microsoft/STL/pull/4280) - Updated `_MSVC_STL_UPDATE`. [#4213](https://github.com/microsoft/STL/pull/4213) [#4226](https://github.com/microsoft/STL/pull/4226) [#4293](https://github.com/microsoft/STL/pull/4293) [#4361](https://github.com/microsoft/STL/pull/4361) <!-- Avoid breaking links. --> <a name="vs-2022-179"></a> <a name="vs-2022-178"></a> <a name="vs-2022-177"></a> <a name="vs-2022-176"></a> <a name="vs-2022-175"></a> <a name="vs-2022-174"></a> <a name="vs-2022-173"></a> <a name="vs-2022-172"></a> <a name="vs-2022-171"></a> <a name="vs-2022-170"></a> <a name="vs-2019-1611"></a> <a name="vs-2019-1610"></a> <a name="vs-2019-169"></a> <a name="vs-2019-168"></a> <a name="vs-2019-167"></a> <a name="vs-2019-166"></a> <a name="vs-2019-165"></a> # Older Versions - [VS 2022 Changelog][] - [VS 2019 Changelog][]