Libc++ 22.0.0 (In-Progress) Release Notes¶
Written by the Libc++ Team
Warning
These are in-progress notes for the upcoming libc++ 22.0.0 release. Release notes for previous releases can be found on the Download Page.
Introduction¶
This document contains the release notes for the libc++ C++ Standard Library, part of the LLVM Compiler Infrastructure, release 22.0.0. Here we describe the status of libc++ in some detail, including major improvements from the previous release and new feature work. For the general LLVM release notes, see the LLVM documentation. All LLVM releases may be downloaded from the LLVM releases web site.
For more information about libc++, please see the Libc++ Web Site or the LLVM Web Site.
Note that if you are reading this file from a Git checkout or the main Libc++ web page, this document applies to the next release, not the current one. To see the release notes for a specific release, please see the releases page.
What’s New in Libc++ 22.0.0?¶
Implemented Papers¶
P2321R2:
zip(Github) (The paper is partially implemented.zip_transform_viewis implemented in this release)P3044R2: sub-
string_viewfromstring(Github)P3223R2: Making
std::istream::ignoreless surprising (Github)P3060R3: Add
std::views::indices(n)(Github)P2835R7: Expose
std::atomic_ref’s object address (Github)P2944R3: Comparisons for
reference_wrapper(Github)P3168R2: Give
std::optionalRange Support (Github)
Improvements and New Features¶
The performance of
map::map(const map&)has been improved up to 2.3xThe performance of
map::operator=(const map&)has been improved by up to 11xThe performance of
unordered_set::unordered_set(const unordered_set&)has been improved by up to 3.3x.The performance of
unordered_set::operator=(const unordered_set&)has been improved by up to 5x.The performance of
map::eraseandset::erasehas been improved by up to 2xThe performance of
find(key)inmap,set,multimapandmultisethas been improved by up to 2.3xSome reallocations are now avoided in std::filesystem::path::lexically_relative, resulting in a performance improvement of up to 1.7x.
The performance of the
(iterator, iterator)constructors ofmap,set,multimapandmultisethas been improved by up to 3xThe performance of
insert(iterator, iterator)ofmap,set,multimapandmultisethas been improved by up to 2.5xThe performance of
erase(iterator, iterator)in the unordered containers has been improved by up to 1.9xThe performance of
map::insert_or_assignhas been improved by up to 2xofstream::writehas been optimized to pass through large strings to system calls directly instead of copying them in chunks into a buffer.Multiple internal types have been refactored to use
[[no_unique_address]], resulting in faster compile times and reduced debug information.The performance of
std::findhas been improved by up to 2x for integral typesThe
std::distanceandstd::ranges::distancealgorithms have been optimized for segmented iterators (e.g.,std::join_viewiterators), reducing the complexity fromO(n)toO(n / segment_size). Benchmarks show performance improvements of over 1600x in favorable cases with large segment sizes (e.g., 1024).The
std::{fill, fill_n}andstd::ranges::{fill, fill_n}algorithms have been optimized for segmented iterators, resulting in a performance improvement of at least 10x forstd::deque<int>iterators andstd::join_view<std::vector<std::vector<int>>>iterators.The
std::{generate, generate_n}andstd::ranges::generate_nalgorithms have been optimized for segmented iterators, resulting in a performance improvement forstd::deque<short>andstd::join_view<vector<vector<short>>>iterators.
Deprecations and Removals¶
Potentially breaking changes¶
The algorithm for
multi{map,set}::findhas been modified such that it doesn’t necessarily return an iterator to the first equal element in the container. This was never guaranteed by the Standard, but libc++ previously happened to always return the first equal element, like other implementations do. Starting with this release, code relying on the first element being returned fromfindwill be broken, andlower_boundorequal_rangeshould be used instead.The ABI flag
_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBERhas been split off from_LIBCPP_ABI_NO_ITERATOR_BASES. If you are using this flag and care about ABI stability, you should set_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBERas well.
Announcements About Future Releases¶
ABI Affecting Changes¶
The ABI flag
_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBERhas been split off from_LIBCPP_ABI_NO_ITERATOR_BASES. If you are using this flag and care about ABI stability, you should set_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBERas well.The internal types
__map_value_compare,__unordered_map_hasher,__unordered_map_equal,__hash_map_hasherand__hash_map_equalhave been refactored to use_LIBCPP_COMPRESSED_ELEMENTinstead of potentially inheriting from the types they wrap. At this point in time we are not aware of any ABI changes caused by this.