{"id":26200,"date":"2020-07-02T00:20:44","date_gmt":"2020-07-02T00:20:44","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=26200"},"modified":"2020-07-02T00:20:44","modified_gmt":"2020-07-02T00:20:44","slug":"c20-features-and-fixes-in-vs-2019-16-1-through-16-6","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/c20-features-and-fixes-in-vs-2019-16-1-through-16-6\/","title":{"rendered":"C++20 Features and Fixes in VS 2019 16.1 through 16.6"},"content":{"rendered":"<h3>What&#8217;s New<\/h3>\n<p>We&#8217;ve been busy implementing C++20 features in MSVC&#8217;s compiler and Standard Library, and migrating the latter to <a href=\"https:\/\/github.com\/microsoft\/STL\">microsoft\/STL on GitHub<\/a> &#8211; in fact, we&#8217;ve been so busy that we haven&#8217;t posted a C++ toolset changelog\u00a0since the <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/cpp17-20-features-and-fixes-in-vs-2019\/\">VS 2019 16.0 toolset changelog<\/a>. So, here are the compiler features and STL features\/fixes that have shipped for production use in the last year.<\/p>\n<p>As a reminder, the <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/build\/reference\/std-specify-language-standard-version?view=vs-2019\">\/std:c++17 and \/std:c++latest<\/a> compiler options are necessary to use C++17 and C++20 features.<\/p>\n<p>&nbsp;<\/p>\n<h3>VS 2019 16.1<\/h3>\n<p>New features (all thanks to our intern Paolo Torres):<\/p>\n<ul>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0318r1\">P0318R1 \u201cunwrap_reference, unwrap_ref_decay\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0457r2\">P0457R2 \u201cstarts_with()\/ends_with() For basic_string\/basic_string_view\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0458r2\">P0458R2 \u201ccontains() For Ordered And Unordered Associative Containers\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0646r1\">P0646R1 \u201clist\/forward_list remove()\/remove_if()\/unique() Return size_type\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0769r2\">P0769R2 \u201cshift_left(), shift_right()\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0887r1\">P0887R1 \u201ctype_identity\u201d<\/a>.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>New language features:<\/p>\n<ul>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2017\/p0329r4.pdf\">P0329R4 \u201cDesignated initialization\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2017\/p0846r0.html\">P0846R0 \u201cADL and Function Templates that are not Visible\u201d<\/a>.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Correctness fixes:<\/p>\n<ul>\n<li>Fixed a regression in VS 2019 16.0 where the bucket count for unordered associative containers might have become higher than intended when using the allocator-extended move constructor with unequal allocators.<\/li>\n<li>Removed a not-present-in-standard polar function in &lt;complex&gt; that prevented compiling polar&lt;float&gt;(1.0, 2.0).<\/li>\n<li>Implemented the resolution of <a href=\"https:\/\/wg21.link\/lwg3025\">LWG-3025<\/a>, which fixes the deduction guides of map, multimap, unordered_map, and unordered_multimap to enable deduction from e.g. {pair{1, 2}, {3, 4}}.<\/li>\n<li>Implemented the resolution of <a href=\"https:\/\/wg21.link\/lwg3012\">LWG-3012<\/a>, which requires the argument to std::atomic to be copy constructible, move constructible, copy assignable, and move assignable in addition to the previous trivially copyable requirement.<\/li>\n<li>Removed non-standard std::identity to clear the way for the new standard std::identity. (Thanks to our intern, Paolo Torres!)<\/li>\n<li>Rewrote &lt;atomic&gt; to improve throughput and codegen &#8211; especially for debug compiles &#8211; and fixed a bug in constexpr construction of atomic&lt;T*&gt; under Clang.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Performance and throughput fixes:<\/p>\n<ul>\n<li>Removed several internal &#8220;convenience&#8221; functions previously used to implement STL features that had poor debug codegen interaction with per-function-overhead options like \/RTC1 and \/JMC.<\/li>\n<li>Changed complex to call std::hypot instead of a slightly different library implementation, to engage compiler optimizations for hypot by Vivian An in the optimizer under \/fp:fast.<\/li>\n<li>Fixed vector&lt;bool&gt;::reference&#8217;s swap function to be a hidden friend, improving compiler diagnostics when swapping an unrelated unswappable type.<\/li>\n<li>Fixed several places where the associative containers were using iterator-debugging-enabled iterators internally.<\/li>\n<li>Optimized the unordered associative container rehash operation by removing self-recursion and try regions.<\/li>\n<li>Improved throughput of &lt;type_traits&gt; by defining class templates in terms of variable templates when possible and drastically simplifying make_signed_t and make_unsigned_t.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Other improvements:<\/p>\n<ul>\n<li>The Standard requires implementations to support a certain set of facet specializations. MSVC\u2019s STL permitted non-Standard facet specializations to be used, with often-undesirable consequences. In this release, we implemented an off-by-default mode to enforce that only Standard facet specializations are used, emitting a static_assert for non-Standard usage. Compiling with \/D_ENFORCE_FACET_SPECIALIZATIONS=1 will request this mode.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>VS 2019 16.2<\/h3>\n<p>New features:<\/p>\n<ul>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0020r6\">P0020R6 atomic&lt;float&gt;, atomic&lt;double&gt;, and atomic&lt;long double&gt;<\/a>. These are always lock-free on all of our supported platforms.<\/li>\n<li>Implemented relatively fast layout-preserving range checks under a new macro, _CONTAINER_DEBUG_LEVEL, which complements _ITERATOR_DEBUG_LEVEL. We expect this to replace any remaining use cases for _ITERATOR_DEBUG_LEVEL == 1.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0482r6\">P0428R6 \u201cLibrary Support For char8_t\u201d<\/a> for non-Clang (Clang didn\u2019t know how to mangle char8_t in the MS ABI until Clang 8.0.1).<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0754r2\">P0754R2 \u201c&lt;version&gt;\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0463r1\">P0463R1 \u201cendian\u201d<\/a>. (Thanks to our intern, Paolo Torres!)<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0600r1\">P0600R1 \u201c[[nodiscard]] For The STL\u201d<\/a>. (Paolo)<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0653r2\">P0653R2 \u201cto_address()\u201d<\/a>. (Paolo)<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0771r1\">P0771R1 \u201cnoexcept For std::function&#8217;s Move Constructor\u201d<\/a>. (Paolo)<\/li>\n<li>Implemented more floating-point &lt;charconv&gt; machinery. Fixed\/scientific precision to_chars() is now available, powered by the Ryu Printf algorithm invented and implemented by Ulf Adams.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>New language features:<\/p>\n<ul>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2017\/p0409r2.html\">P0409R2 \u201cAllow lambda capture [=, this]\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2017\/p0428r2.pdf\">P0428R2 \u201cFamiliar template syntax for generic lambdas\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p0482r6.html\">P0482R6 \u201cchar8_t: A type for UTF-8 characters and strings\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2017\/p0624r2.pdf\">P0624R2 \u201cDefault constructible and assignable stateless lambdas\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p0780r2.html\">P0780R2 \u201cAllow pack expansion in lambda init-capture\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p0806r2.html\">P0806R2 \u201cDeprecate implicit capture of this via [=]\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p1120r0.html\">P1120R0 \u201cConsistency improvements for &lt;=&gt; and other comparison operators\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1185r2.html\">P1185R2 \u201c&lt;=&gt; != ==\u201d<\/a>.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Correctness fixes:<\/p>\n<ul>\n<li>Fixed basic_string to provide the strong exception safety guarantee on copy assignment with unequal propagate_on_container_copy_assignment allocators.<\/li>\n<li>Fixed _ITERATOR_DEBUG_LEVEL == 1 to no longer do iterator ownership assertions for node-based containers forward_list, list, set, map, multiset, multimap, unordered_set, unordered_map, unordered_multiset, or unordered_multimap. Conditions were discovered where these assertions rejected valid programs in the presence of splices, merges, or usage of C++17 node_handle.<\/li>\n<li>Fixed list&#8217;s remove_if algorithm to tolerate container self-references as an extension permitted but not required by the standard.<\/li>\n<li>Fixed forward_list::erase_after&#8217;s handling of double-exclusive ranges to never cause the container to become corrupted. Edge cases in this handling were found by libcxx&#8217;s test suite.<\/li>\n<li>Fixed multiset and multimap to use the supplied hint to control relative element insertion order in the range of equivalent elements.<\/li>\n<li>Fixed &lt;filesystem&gt; to interpret the Win32 error code ERROR_INVALID_NAME as a &#8220;file not found&#8221; error rather than a fatal I\/O error for the purposes of status().<\/li>\n<li>Fixed istream::sentry to not set badbit upon encountering end-of-file when exceptions() has eofbit set.<\/li>\n<li>Fixed istream::sync() to tolerate streambufs with throwing pubsync().<\/li>\n<li>Defended against macroization of new C++20 keywords in &lt;xkeycheck.h&gt;.<\/li>\n<li>Fixed a conflict between mbctype.h and &lt;charconv&gt;. mbctype.h macroizes _M2, so &lt;charconv&gt; now avoids using that as an identifier.<\/li>\n<li>Fixed deque iterator orphaning, which was causing crashes in debug mode.<\/li>\n<li>Fixed from_chars() bugs affecting certain corner cases with subnormals.<\/li>\n<li>Changed from_chars() behavior for overflow\/underflow to align with strtod() behavior. (Note that this is tracked by <a href=\"https:\/\/wg21.link\/lwg3081\">LWG-3081<\/a> with a different proposed resolution.)<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Performance and throughput fixes:<\/p>\n<ul>\n<li>Applied if-constexpr to even more places, including &lt;memory&gt;, &lt;functional&gt;, and the allocator-range algorithms used to implement deque, string, and vector.<\/li>\n<li>Fixed tree-based associative containers set, map, multiset, and multimap to always use the hint parameter if supplied.<\/li>\n<li>Fixed tree-based associative containers set, map, multiset, and multimap to have reduced code size because the same binary search operation now powers both insertion operations like insert or emplace, as well as plain lookup functions like lower_bound or find. Previously this was duplicated in a manner impossible for the optimizer to merge.<\/li>\n<li>Removed more try regions from &lt;memory&gt;.<\/li>\n<li>Optimized associative containers map, set, unordered_map, and unordered_set emplacement to avoid allocating nodes when inserting duplicate keys if the container is passed an instance of the key directly.<\/li>\n<li>Fixed forward_list::resize to avoid a redundant traversal of the forward_list to calculate the size.<\/li>\n<li>Reduced forward_list::insert_after&#8217;s iterator debugging costs.<\/li>\n<li>In &lt;charconv&gt;, fixed shortest to_chars() is even faster, optimized by Ryu Printf.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Other improvements:<\/p>\n<ul>\n<li>Increased the STL\u2019s required version of Clang to 8.0.0.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>VS 2019 16.3<\/h3>\n<p>New features:<\/p>\n<ul>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p0898r3\">P0898R3 \u201cStandard Library Concepts\u201d<\/a>, which adds the &lt;concepts&gt; header.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/P0487R1\">P0487R1 \u201cFixing operator&gt;&gt;(basic_istream&amp;, CharT*)\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/P0616R0\">P0616R0 \u201cUsing move() In &lt;numeric&gt;\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/P0758R1\">P0758R1 \u201cis_nothrow_convertible\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/P0919R3\">P0919R3 \u201cHeterogeneous Lookup For Unordered Containers\u201d<\/a>.<\/li>\n<li>Added [[nodiscard]] attributes to functions with _Check_return_ SAL annotations, which we had skipped in earlier [[nodiscard]] work due to a perception of redundancy.<\/li>\n<li>Activated STL [[nodiscard]] attributes in C++14 mode when the compiler supports the attribute, which Clang and the IntelliSense compiler do. (MSVC supported [[nodiscard]] in C++14 mode in VS 2019 16.4.) (Did we mention how fond we are of [[nodiscard]]?)<\/li>\n<li>Added a new header &lt;__msvc_all_public_headers.hpp&gt; to make it easy for people developing tools to ensure they work with all the standard library headers, and need not edit hard-coded lists over time.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>New language features:<\/p>\n<ul>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2017\/p0734r0.pdf\">P0734R0 \u201cC++ extensions for Concepts\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2017\/p0857r0.html\">P0857R0 \u201cfunctionality gaps in constraints\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p1084r2.pdf\">P1084R2 \u201cToday\u2019s return-type-requirements are insufficient\u201d<\/a>.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Correctness fixes:<\/p>\n<ul>\n<li>Implemented the is_trivial\/is_trivial_v type trait in terms of is_constructible and is_trivially_copyable to work around bugs in MSVC and Clang\u2019s __is_trivial intrinsics.<\/li>\n<li>Detected more non-compiler tools (Qt\u2019s MOC and Windows\u2019 midl, in addition to pre-existing detection for Windows\u2019 resource compiler) that sometimes process C++ header files, and used the preprocessor to hide the contents of STL headers from them to avoid breakage when the STL uses newer language constructs that such tools don\u2019t understand. (This is a best-effort attempt; ideally folks would not point such tools at STL headers in the first place.)<\/li>\n<li>Implemented comparison operations for stack and queue in terms of the corresponding operations on the adapted container instead of implementing all in terms of == and &lt; on the adapted container.<\/li>\n<li>Fixed a bug in pmr::monotonic_resource::release that resulted in use of freed memory on subsequent allocations from the monotonic_resource.<\/li>\n<li>The STL now uses allocator::construct for container user-supplied types only, so allocators that default-initialize rather than value-initialize no longer break the containers.<\/li>\n<li>The STL now doesn\u2019t create temporary values on the stack without going through allocator construct for containers.<\/li>\n<li>Defended against more off-by-default warnings requested by customers, such as C4582, C4583, C4587, C4588, and C4800.<\/li>\n<li>current_exception() and current_exceptions() now return correct values in terminate handlers.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/lwg2996\">LWG-2996<\/a> &#8220;Missing rvalue overloads for shared_ptr operations&#8221;.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/lwg3038\">LWG-3038<\/a> &#8220;polymorphic_allocator::allocate should not allow integer overflow to create vulnerabilities&#8221;.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/lwg3074\">LWG-3074<\/a> &#8220;Non-member functions for valarray should only deduce from the valarray&#8221;.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/lwg3130\">LWG-3130<\/a> &#8220;[input.output] needs many addressof&#8221;.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/lwg3131\">LWG-3131<\/a> &#8220;addressof all the things&#8221;.<\/li>\n<li>Simplified is_void_v, is_integral_v, and is_floating_point_v. Previously, we were explicitly specializing non-inline variable templates in C++14 mode, which is technically forbidden by the Standard and was causing headaches for Clang.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Performance and throughput fixes:<\/p>\n<ul>\n<li>Use the __is_same intrinsic to implement the is_same\/is_same_v type trait on Clang.<\/li>\n<li>Node-based containers will reuse nodes more often when performing bulk operations rather than deallocating and reallocating everything. For example, given a list L containing C elements, L.assign(N, T) now deallocates only the unused C &#8211; N elements or allocates only the newly needed N &#8211; C elements, rather than freeing all C elements followed by allocating all N elements.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Other improvements:<\/p>\n<ul>\n<li>&lt;filesystem&gt; no longer includes &lt;experimental\/filesystem&gt;.<\/li>\n<li>&lt;experimental\/filesystem&gt; now emits a warning\/error: \u201cThe &lt;experimental\/filesystem&gt; header providing std::experimental::filesystem is deprecated by Microsoft and will be REMOVED. It is superseded by the C++17 &lt;filesystem&gt; header providing std::filesystem. You can define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING to acknowledge that you have received this warning.\u201d<\/li>\n<li>Deleted the non-Standard &lt;allocators&gt;, &lt;stdexcpt.h&gt;, and &lt;typeinfo.h&gt; headers.<\/li>\n<li>Removed unnecessary \u201cinline\u201d keywords in the STL.<\/li>\n<li>Improved the STL\u2019s \/Wall cleanliness. Note that this is a work in progress tracked by <a href=\"https:\/\/github.com\/microsoft\/STL\/issues\/186\">microsoft\/STL#186<\/a>.<\/li>\n<li>Eliminated all C casts in the STL\u2019s headers.<\/li>\n<li>Strengthened noexcept for various functions.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>VS 2019 16.4<\/h3>\n<p>New features:<\/p>\n<ul>\n<li>Increased the STL\u2019s required version of Clang to 8.0.1. This notably enables STL char8_t support with Clang, whose previous versions didn\u2019t know how to mangle char8_t in the MS ABI.<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/p1754r1\">P1754R1 \u201cRename Concepts To standard_case\u201d<\/a>.<\/li>\n<li>Implemented parts of <a href=\"https:\/\/wg21.link\/p0896r4\">P0896R4 \u201c&lt;ranges&gt;\u201d<\/a>:\n<ul>\n<li>Changes to iterator_traits<\/li>\n<li>Addition of the iterator and range concepts<\/li>\n<li>ranges::iter_move and ranges::iter_swap customization points<\/li>\n<li>Range access customization points (normal\/const\/reverse\/const-reverse variations of ranges::begin and ranges::end, ranges::size, ranges::empty, ranges::data, and ranges::cdata)<\/li>\n<li>The associated type aliases: ranges::iterator_t, ranges::sentinel_t, ranges::range_value_t, ranges::range_reference_t, ranges::range_difference_t, and ranges::range_rvalue_reference_t<\/li>\n<li>Modifications necessary for array, basic_string, basic_string_view, valarray, and vector to model the contiguous_range concept<\/li>\n<\/ul>\n<\/li>\n<li>Activated STL [[nodiscard]] attributes in C++14 mode for MSVC.<\/li>\n<li>Implemented general precision to_chars(), completing C++17 &lt;charconv&gt;.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>New language features:<\/p>\n<ul>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p0892r2.html\">P0892R2 \u201cexplicit(bool)\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1091r3.html\">P1091R3 \u201cExtending structured bindings to be more like variable declarations\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1099r5.html\">P1099R5 \u201cUsing Enum\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1186r3.html\">P1186R3 \u201cWhen do you actually use &lt;=&gt;?\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1630r1.html\">P1630R1 \u201cSpaceship needs a tune-up\u201d<\/a>.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Correctness fixes:<\/p>\n<ul>\n<li>Explicitly specified the underlying types of some enumeration types in &lt;regex&gt; that use bitwise operations to avoid storing an unrepresentable value (which is formally undefined behavior, as noted by Clang\u2019s UBSAN).<\/li>\n<li>Implemented <a href=\"https:\/\/wg21.link\/lwg3196\">LWG-3196 \u201cstd::optional&lt;T&gt; is ill-formed if T is an array\u201d<\/a> (it was already ill-formed, but now there is a friendly static_assert message). Slightly improved throughput by simplifying the metaprogramming for optional&lt;T&gt;\u2019s comparisons with T and by using \u201cif constexpr\u201d instead of tag dispatch in optional::swap.<\/li>\n<li>Applied <a href=\"https:\/\/developercommunity.visualstudio.com\/content\/problem\/675827\/code-pattern-in-common-reference-kills-intellisens.html\">a user-supplied work around<\/a> for an IntelliSense bug in common_reference.<\/li>\n<li>std::filesystem::directory_entry no longer claims nonexistent files are regular files.<\/li>\n<li>std::filesystem::directory_iterator(&#8220;&#8221;) no longer iterates over current_path().<\/li>\n<li>std::filesystem::recursive_directory_iterator no longer triggers infinite loops when passed paths containing embedded nulls.<\/li>\n<li>Fixed an edge case in iterator debugging support during list::splice where the container size could be updated incorrectly.<\/li>\n<li>Improved floating-point &lt;charconv&gt; handling of NaN.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Performance and throughput fixes:<\/p>\n<ul>\n<li>Reduced the amount of contents included by &lt;compare&gt;.<\/li>\n<li>Improved list and forward_list\u2019s member algorithms to not need distance\/advance calls which were inefficient given that they are non-random-access ranges.<\/li>\n<li>Partially implemented <a href=\"https:\/\/cplusplus.github.io\/LWG\/issue2550\">LWG-2550 \u201cunordered containers\u2019 clear() should be O(number of elements)\u201d<\/a> as far as our current ABI allows \u2013 this speeds up unordered containers with a large number of buckets but few elements. We can only do this if the hash function is noexcept because erasing an element when not walking each bucket requires evaluating the hash function.<\/li>\n<li>Strengthened noexcept on several container functions.<\/li>\n<li>atomic&lt;8 bytes&gt; is now implemented with an ordinary load on x86 rather than cmpxchg8b.<\/li>\n<li>Improved throughput by using conditional explicit in pair\/tuple\/optional for MSVC and the IntelliSense compiler.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Other improvements:<\/p>\n<ul>\n<li>Removed the _HAS_SPECIAL_MATH \u201cescape hatch\u201d macro which suppressed definition of the C++17 mathematical special functions in &lt;cmath&gt; when defined to 0.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>VS 2019 16.5<\/h3>\n<p>Please see <a href=\"https:\/\/github.com\/microsoft\/STL\/wiki\/Changelog\">https:\/\/github.com\/microsoft\/STL\/wiki\/Changelog<\/a> for release notes for the STL in all future Visual Studio releases.<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p>New language features:<\/p>\n<ul>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2017\/p0306r4.html\">P0306R4 \u201cComma omission and comma deletion\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p1042r1.html\">P1042R1 \u201c__VA_OPT_wording clarifications\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p0595r2.html\">P0595R2 \u201cstd::is_constant_evaluated()\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2017\/p0614r1.html\">P0614R1 \u201cRange-based for statements with initializer\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2017\/p0683r1.html\">P0683R1 \u201cDefault member initializers for bit-fields\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p1002r1.pdf\">P1002R1 \u201cTry-catch blocks in constexpr functions\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1161r3.html\">P1161R3 \u201cDeprecate uses of the comma operator in subscripting expressions\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1301r4.html\">P1301R4 \u201c[[nodiscard(\u201cshould have a reason\u201d)]]\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1946r0.html\">P1946R0 \u201cAllowing defaulting comparisons by value\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1703r1.html\">P1703R1 \u201cRecognizing Header Unit Imports Requires Full Preprocessing\u201d<\/a>.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>VS 2019 16.6<\/h3>\n<p>Please see <a href=\"https:\/\/github.com\/microsoft\/STL\/wiki\/Changelog\">https:\/\/github.com\/microsoft\/STL\/wiki\/Changelog<\/a> for release notes for the STL in all future Visual Studio releases.<\/p>\n<p>&nbsp;<\/p>\n<p>New language features and national body comment resolutions:<\/p>\n<ul>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2017\/p0692r1.html\">P0692R1 &#8220;Access Checking on Specializations&#8221;<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p0732r2.pdf\">P0732R2 \u201cClass Types in Non-Type Template Parameters\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1139r2.html\">P1139R2 \u201cAddress wording issues related to ISO 10646\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1907r1.html\">P1907R1 \u201cInconsistencies with non-type template parameters\u201d<\/a>.<\/li>\n<li>Implemented <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p0479r5.html\">P0479R5 \u201clikely and unlikely attributes\u201d<\/a>.<\/li>\n<li>Implemented US 053 \u201cMandate the return type for return_void and return_value to be void\u201d<\/li>\n<li>Implemented US 065 \u201cApply Coroutines issue 24 from P0664R8\u201d<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>More Information<\/h3>\n<p>For Visual Studio changes (beyond the C++ toolset) and download links, see the <a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/releases\/2019\/release-notes\">VS Release Notes<\/a> and <a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/releases\/2019\/release-notes-preview\">VS Preview Release Notes<\/a>. You can report bugs through <a href=\"https:\/\/developercommunity.visualstudio.com\/spaces\/62\/index.html\">Developer Community<\/a>, and you can also report STL bugs via <a href=\"https:\/\/github.com\/microsoft\/STL\/issues\">microsoft\/STL GitHub issues<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What&#8217;s New We&#8217;ve been busy implementing C++20 features in MSVC&#8217;s compiler and Standard Library, and migrating the latter to microsoft\/STL on GitHub &#8211; in fact, we&#8217;ve been so busy that we haven&#8217;t posted a C++ toolset changelog\u00a0since the VS 2019 16.0 toolset changelog. So, here are the compiler features and STL features\/fixes that have shipped [&hellip;]<\/p>\n","protected":false},"author":266,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-26200","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus"],"acf":[],"blog_post_summary":"<p>What&#8217;s New We&#8217;ve been busy implementing C++20 features in MSVC&#8217;s compiler and Standard Library, and migrating the latter to microsoft\/STL on GitHub &#8211; in fact, we&#8217;ve been so busy that we haven&#8217;t posted a C++ toolset changelog\u00a0since the VS 2019 16.0 toolset changelog. So, here are the compiler features and STL features\/fixes that have shipped [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/26200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/266"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=26200"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/26200\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=26200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=26200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=26200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}