跳到正文

个人记录

C++23,新一代C++语言标准

wfirstzhang约 2 分钟
原文
文章信息与版本

文章信息

发布
2024年7月21日
收录
2025年12月12日
更新
2026年11月7日
篇幅
约 2 分钟

版本

  1. v1当前

新语言功能

本节尚不完整。

  • 新语言特性测试宏。
  • 显式对象参数、显式对象成员函数(推导出这一点)。
  • 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, and std::bfloat16_t.
  • #elifdef, #elifndef, and #warning
  • Literal suffix 'Z'/'z' for (signed) std::size_t literals
  • Assumptions via new attribute [[assume(expression)]]
  • Named universal character escapes
  • A portable source file encoding is UTF-8
  • White-spaces trimming before line splicing.
原文