C++23,新一代C++语言标准
wfirstzhang · · 个人记录
新语言功能
本节尚不完整。
- 新语言特性测试宏。
- 显式对象参数、显式对象成员函数(推导出这一点)。
- if consteval / if not consteval。
- 多维下标操作符(例如
v[1, 3, 7] = 42;)。 - 静态
operator()。 - 静态
operator[]。 auto(x):语言中的衰减复制。- Lambda 表达式的属性。
- 可选的扩展浮点类型:
std::float{16|32|64|128}_t和std::bfloat16_t。 #elifdef,#elifndef, 和#warning。- 为
(有符号) std::size_t字面后缀Z/z。 - 通过新属性
[[assume(expression)]]进行假设。 - 已命名的通用转义字符。
- 可移植的源文件编码为 UTF-8。
- 在行拼接前修剪空白。
New language features
This section is incomplete
- New language feature testing macros
- Explicit object parameters, explicit object member functions (deducing this)
- if consteval / if not consteval
- Multidimensional subscript operator (e.g.
v[1, 3, 7] = 42;) - static
operator() - static
operator[] auto(x): decay-copy in the language- Attributes on lambda-expressions
- Optional extended floating-point types:
std::float{16|32|64|128}_t, andstd::bfloat16_t. #elifdef,#elifndef, and#warning- Literal suffix
'Z'/'z'for(signed) std::size_tliterals - Assumptions via new attribute
[[assume(expression)]] - Named universal character escapes
- A portable source file encoding is UTF-8
- White-spaces trimming before line splicing.