Leanpub Header

Skip to main content

C++23 - The Complete Guide

本书目前的完成进度为 88%上次更新时间:2026-07-12
All new language and library features of C++23 (for those who know C++20 already) . The book presents all new language and library features of C++23. Learn how this impacts day-to-day programming, to benefit in practice, to combine new features, and to avoid all new traps. Buy early, pay less, free updates. Current Content: www.cppstd23.com Other leanpub books by this author: C++20 C++17 C++ Move…

最低售价

$29.90

$42.90

支付金额

作者利润

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
关于

关于

关于本书

C++23 is the next evolution in modern C++ programming, which will be supported step-by-step by the latest version of gcc, clang, and Visual C++.

C++23 is the first release after introducing several new key fetaures with C++20, which can be seend as the beginning of a new release cycle.

It contains both significant extensions and improvement of various features introduced with C++20 and a couple of new language and library features.

As usual, not everything is self-explanatory, combining new features gives even more power, and there are hidden traps.

This book presents all the new language and library features of C++23. It covers the motivation and context of each new feature with examples and background information. The focus is on how these features impact day-to-day programming, what it means to combine them, and how to benefit from C++23 in practice.


Buy early, pay less, free updates

Note that this book is published step-by-step. The first public version will be published probably in 2024. After that, the content will grow with new chapters, examples, and caveats about the features of C++23 and I integrate all feedback I get for the pages already published.

As written, once you bought the ebook you will get all updates for free.

PDF versus Other Formats

I write the book in LaTeX and generate PDF from it (the way I wrote my other books). The other formats (epub, mobi, and online reading) come from the leanpub markdown interface, for which I generate the necessary input from LaTeX by script.

Thus, the PDF layout has a better quality than the other formats. For example, the syntax highlighting rules for the formats other than PDF have to get fixed as soon as possible and the index is missing yet. Leanpub and me are working on corresponding improvements.

I hope you enjoy and benefit.

Nico

#cpp23tcg

分享此书

分类

作者

关于作者们

Nicolai M. Josuttis

Nicolai Josuttis (http://www.josuttis.com) is well known in the programming community because he not only speaks and writes with authority, being the (co-)author of the world-wide best sellers

but is also an innovative presenter, having talked at various conferences and events.

He is an independent trainer and speaker being active in C++ standardization for more than 20 years.

The Leanpub Podcast

播客

Podcast Episode

目录

目录

Preface

  1. Incremental Writing
  2. Acknowledgments
  3. Versions of This Book

About This Book

  1. What You Should Know Before Reading This Book
  2. Overall Structure of the Book
  3. How to Read This Book
  4. The Way I Implement
  5. The C++ Standards
  6. Example Code and Additional Information
  7. Feedback

“Hello, World” with C++23

  1. The New “Hello World”

Modules std and std.compat

  1. A First Example Using the Standard Module std
  2. Standard Library Modules in Detail
  3. Using the Standard Modules in Practice
  4. Afternotes

Formatted Output with std::print() and std::println()

  1. Basics of Formatted Output Since C++20
  2. std::print() and std::println()
  3. Afternotes

Formatted Output Extensions

  1. Debugging Output Format for Strings and Characters
  2. Formatted Output of Tuples and Pairs
  3. Formatted Output of Containers and Ranges
  4. Concept std::formattable
  5. Afternotes

Fix of the Range-Based for Loop

  1. The Former Problem of the Range-Based for Loop
  2. Other Code Affected by a Broken Range-Based for Loop
  3. Possible Drawbacks of the Fix
  4. Afternotes

Operator Extensions

  1. Multi-Dimensional Operator []
  2. Afternotes

Deducing this as an Explicit Object Parameter

  1. Introduction to Deducing this
  2. How to Benefit From Deducing this
  3. Recursive Lambdas
  4. The Compile Time Object Type and the CRTP Pattern
  5. Details of Deducing this as an Explicit Object Parameter
  6. Afternotes

auto() and auto{}

  1. Introduction of auto() and auto{}
  2. Example of Using auto() or auto{}
  3. auto() and auto{} in Detail
  4. Afternotes

std::expected<>

  1. Using std::expected<>
  2. std::expected<> Types and Operations
  3. Special Cases
  4. Afternotes

Monadic Operations for std::optional<> and std::expected<>

  1. Basic Example of Monadic Operations
  2. Basic Example of Monadic Operations with std::expected<>
  3. Monadic Operations in Detail
  4. Afternotes

std::stacktrace

  1. Example of Using a std::stacktrace
  2. std::stacktrace in Detail
  3. Afternotes

Views

  1. Introduction to Views
  2. Overview of All Views
  3. Remarkable View Extensions with C++23
  4. Afternotes

Pitfalls and Traps Using Views

  1. Overview of Pitfalls and Traps When Using Views
  2. Consequences of Reference Semantics
  3. Caching Views
  4. const Correctness with Views
  5. The Filter View Fiasco
  6. How to Use Views in Practice
  7. Afternotes

Supplementary Views in Detail

  1. Overview of Views Introduced with C++23
  2. Generating Views
  3. Filtering Views
  4. Transforming Views
  5. Views That Split or Join Ranges
  6. Views That Combine Multiple Elements
  7. Afternotes

Extensions for Ranges and Views

  1. Initialize Containers with std::from_range
  2. Container Functions to Deal with Ranges as a Whole
  3. Creating Containers with std::ranges::to<>()
  4. Performance of std::ranges::to<>() and Using std::from_range
  5. Enable Views for Pipelines
  6. Afternotes

Coroutine Interface std::generator<>

  1. A First std::generator<> Example
  2. Unlimited std::generator<> Coroutines
  3. std::generator<> Coroutines with Parameters
  4. Parallel Use of std::generator<> Coroutines
  5. Ending a Coroutine with co_return
  6. Other Basic Aspects of std::generator<> Coroutines
  7. Afternotes

std::generator<> in Detail

  1. Exception Handling of std::generator<>
  2. Passing std::generator<> as Argument
  3. Memory Management of std::generator<> Coroutines
  4. Using Nested std::generator<> Coroutines
  5. Yielding References and Proxy Types
  6. Class Template std::generator<> in Detail
  7. Afternotes

Multi-Dimensional Spans std::mdspan

  1. Using std::mdspan
  2. Layouts of std::mdspan
  3. std::mdspan with No Elements or Zero Dimensions
  4. Using Accessors
  5. std::mdspan<> in Detail
  6. Afternotes

Flat Containers std::flat_set and std::flat_map

  1. Motivation for Flat Containers
  2. First Examples of Using Flat Containers
  3. Internal Layout of Flat Containers
  4. Differences between Flat and Associative Containers
  5. Flat Containers in Detail
  6. Flat Sets and Flat Multisets in Detail
  7. Flat Maps and Flat Multimaps in Detail
  8. Afternotes

Small Improvements of the C++23 Core Language

  1. Literal Suffix uz for std::size_t
  2. New Preprocessor Directives
  3. Attribute [[assume()]]
  4. Afternotes

Small Improvements of the C++ Standard Library

  1. Updates for String Types
  2. Afternotes

Glossary

  1. A
  2. C
  3. F
  4. G
  5. I
  6. L
  7. P
  8. R
  9. S
  10. U
  11. V
  12. X

Leanpub 无条件、零风险的100%满意保证

支付后的60天内,只需简单点击两下,您便可以退书并且取回先前支付的全部金额
查看完整条款

在10美元的购买中赚取8美元,在20美元的购买中赚取16美元

我们在7.99美元或以上的购买中支付80%的版税,在0.99美元到7.98美元之间的购买中支付80%的版税减去0.5美元固定费用在10美元的销售中您可赚取8美元,在20美元的销售中可赚取16美元。因此,如果我们以20美元的价格售出5000本未退款的图书,您将赚取80,000美元

(是的,一些作者在Leanpub上已经赚取了远超过这个数额的收入。)

事实上,作者们通过在Leanpub上写作、出版和销售已经赚取了超过1400万美元

了解更多关于在Leanpub上写作的信息

免费更新。无DRM。

如果你购买了Leanpub的书,只要作者更新这本书,你就可以免费获得更新!许多作者使用Leanpub在他们编写书籍的过程中发布他们的作品。所有读者都可以获得免费更新,无论他们何时购买的书或他们支付了多少钱(包括免费)。

大多数Leanpub书籍都提供PDF(适用于计算机)、EPUB(适用于手机和平板电脑)和MOBI(适用于Kindle)格式。书籍包含的格式会显示在此页面的右上角。

最后,Leanpub的书籍没有任何DRM版权保护的限制,所以你可以轻松地在任何支持的设备上阅读它们。

了解更多关于Leanpub的电子书格式以及在哪里阅读它们

在 Leanpub 上写作和出版

作者与出版社使用 Leanpub 来出版正在写作中和已完成的书籍,就像这本书一样。你也可以使用 Leanpub 来撰写、出版和销售你的作品!Leanpub 是功能强大的平台,非常适合认真的作者。它结合了简单、优雅的写作与出版流程,以及一个可销售正在写作中的电子书的线上商店。Leanpub 是作家的神奇之笔:只需编写纯文本,然后点击按钮即可出版你的电子书。真的就是这么简单。

学习更多关于在 Leanpub 上写作的信息