C++20
From cppreference.com
The next major revision of the C++ standard
Following features are about to be merged into C++20:
- From TS's: Coroutines, Modules, Constraints and concepts, abbreviated function templates,
- From TS's: Ranges, uniform container erasure (std::erase/std::erase_if)
Contents |
New language features
- feature test
- 3-way comparison operator <=> and operator==() = default
- designated initializers
- init-statements and initializers in range-for
- char8_t
-
[[no_unique_address]]
-
[[likely]]
-
[[unlikely]]
- pack-expansions in lambda captures
- removed the requirement to use
typename
to disambiguate types in many contexts - consteval, constinit
- further relaxed constexpr
- signed integers are 2's complement
- aggregate initialization using parentheses
- array new can deduce array size
- Coroutines
- Modules
- Concepts
- abbreviated function templates
New library features
New headers
- <concepts>
- <coroutine>
- <compare>
- <version>
- <source_location>
- <format>
- <span>
- <ranges>
- <bit>
- <numbers>
- <syncstream>
Library features
- Formatting library
- Calendar and Time Zone library
- std::source_location
- std::span
- std::endian
- array support for make_shared
- std::remove_cvref
- std::to_address
- floating point and shared_ptr atomics
- std::barrier, std::latch, and semaphores
- std::jthread and thread cancellation classes
-
<version>
- std::osyncstream
- std::u8string and other char8_t uses
- constexpr for <algorithm>, <utility>, <complex>
- std::string(_view)::starts_with and ends_with
- assume_aligned
- bind_front
- c8rtomb/mbrtoc8
- make_obj_using_allocator etc
- make_shared_default_init/make_unique_default_init
- heterogeneous lookup in unordered_map etc
- fully-specialized std::polymoprhic_allocator<>
- std::execution::unseq
- std::midpoint and std::lerp
- std::ssize. std::is_bounded_array
- Ranges, uniform container erasure (std::erase/std::erase_if)
- Mathematical constants