c++20 · iso/iec 14882:2020

Второй по величине сдвиг после C++11The second-biggest shift since C++11

Concepts, ranges, coroutines, modules — четыре по-настоящему новые парадигмы в одном стандарте, плюс jthread/spaceship operator/std::format и ещё десяток изменений поменьше. 18 фич, каждая — отдельная страница.Concepts, ranges, coroutines, modules — four genuinely new paradigms in a single standard, plus jthread/the spaceship operator/std::format and a dozen smaller changes. 18 features, each its own page.

Concepts и rangesConcepts and ranges

переписывают, как выглядит generic-кодrewrite what generic code looks like

Concepts заменяют SFINAE-трюки читаемыми ограничениями на шаблоны; ranges строят вычисления над последовательностями как композицию, а не вложенные циклы.Concepts replace SFINAE tricks with readable constraints on templates; ranges build computations over sequences as composition instead of nested loops.

Coroutines и modulesCoroutines and modules

новые механизмы исполнения и сборкиnew execution and build mechanisms

МногопоточностьConcurrency

частично уже разобрано в cpp_concurrency.mdpartly already covered in cpp_concurrency.md

Ядро языкаCore language

синтаксис и compile-time семантикаsyntax and compile-time semantics
09

оператор трёхстороннего сравнения (<=>)three-way comparison operator (<=>)

Один оператор вместо шести — компилятор выводит <, <=, >, >= из одного определения.One operator instead of six — the compiler derives <, <=, >, >= from a single definition.

10

designated initializersdesignated initializers

Point{.x = 1, .y = 2} — инициализация структуры по именам полей, без слепого позиционного порядка.Point{.x = 1, .y = 2} — struct initialization by field name, no blind positional order.

11

consteval / constinit

consteval требует вычисления на этапе компиляции всегда; constinit гарантирует статическую инициализацию без static init order fiasco.consteval always requires compile-time evaluation; constinit guarantees static initialization, avoiding the static init order fiasco.

12

template lambdas

[]<class T>(T x){...} — явный шаблонный параметр лямбды вместо auto-параметров C++14.[]<class T>(T x){...} — an explicit lambda template parameter instead of C++14's auto parameters.

13

char8_t

Отдельный тип для UTF-8 code unit — разводит "байт памяти" и "unicode-текст" в системе типов.A dedicated type for a UTF-8 code unit — separates "memory byte" from "unicode text" in the type system.

14

[[likely]] / [[unlikely]]

Стандартизированная подсказка компилятору о вероятной ветке — вместо __builtin_expect.A standardized hint to the compiler about the likely branch — replacing __builtin_expect.

БиблиотекаLibrary

новое в <format>, <span>, <chrono>, <source_location>new in <format>, <span>, <chrono>, <source_location>

порядок чтенияreading order

concepts стоит читать первыми — они используются как строительный блок в определении ranges (constraint на итераторы и view) и в примерах template lambdas. ranges-basics — до ranges-algorithms, views вводят словарь, на котором объясняются алгоритмы.Read concepts first — they're used as a building block in the definition of ranges (constraints on iterators and views) and in the template-lambda examples. Read ranges-basics before ranges-algorithms — views introduce the vocabulary the algorithms are explained with.

jthread/stop_token и barrier/latch/semaphore пересекаются с существующим разбором в cpp_concurrency.md — сверяться при чтении. coroutines — самая тяжёлая по объёму фича этого стандарта, готовься читать её не за один присест.jthread/stop_token and barrier/latch/semaphore overlap with the existing coverage in cpp_concurrency.md — cross-check while reading. coroutines is the heaviest single feature in this standard by volume — expect to read it over more than one sitting.