C++20最新进展:已完成设计 加入模块和协程

 C++ 委员会于上周在夏威夷科纳举办了一场官方 ISO 会议,以确定下一个国际标准 C++20 的功能集。根据会议报告,C++20 的功能设计现已完成。计划于 2019 年 7 月在科隆举行的会议上,完成 C++20 的规范并发送一份委员会草案以供审查。

上周会议确定添加至 C++20 草案的新特性:

Modules!

Coroutines!

static, thread_local, and lambda capture for structured bindings.

std::polymorphic_allocator<>.

std::midpoint and std::lerp.

std::execution::unseq execution policy.

std::ssize () free function that returns a sized size.

std::span usability enhancements.

Precalculated hash values in lookup.

而以下的特性已在本次会议或之前的会议上获得了 C++20 批准,但尚未添加到 C++20 中,因为目前仍在完成规范。它们有望在 2019 年 7 月的科隆会议上被加入,不过由于时间限制,可能无法完成所有工作。

Expansion statements.

The C++20 synchronization library.

std::format.

constexpr std::vector.

Allow constexpr allocation, but disallow allocations that are not deleted at compile time.

constexpr std::type_info::operator==.

New conceptification of iterators.

Monadic operations for std::optional.

std::source_location.

std::flatmap.

std::flatset.

std::ostream_joiner.

Stack trace library.

std::byteswap.

constinit.

Deprecating some uses of volatile.

Implicit creation of objects for low-level object manipulation.

using enum.

而下面的这些特性,早已在之前的会议上获得了 C++ 20 批准。

Concepts.

Contracts.

Ranges.

operator<=>.

A lot more constexpr features: consteval functions, std::is_constant_evaluated, constexpr union, constexpr try and catch, constexpr dynamic_cast and typeid.

Feature test macros.

std::span.

Synchronized output.

std::atomic_ref.

总之,C++20 应该会是一个像 C++11 那样的大版本。

据透露,工具研究小组 SG15 决定创建一个 C++ 生态系统技术报告,该报告将描述新模块化 C++ 世界中工具(构建系统等)的***实践和***技术。