Leanpub Header

Skip to main content

C++20 - The Complete Guide

All new language and library features of C++20 (for those who know previous C++ versions).

The book presents all new language and library features of C++20. 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.

Other books:

C++23

C++17

C++ Move Semantics

Minimum price

$39.90

$54.90

You pay

$54.90

Author earns

$43.92
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
2,836
Readers
0
Pages
169,496Words
About

About

About the Book

C++20 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++20 is a big step, maybe even larger than C++11.

It contains a couple of new key features (modules, concepts, ranges, corountines) plus several small but valuable language and library features, which will change the way we program in C++. 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++20. 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++20 in practice.

Testimonials:

"C++20 scared me for a few years, and I am a C++ educator. After reading Nico's fantastic new book, I may still be afraid of C++20, but at least now I have a much deeper understanding of what it actually is I am afraid of. Leor Zolman

"I use this book as reference almost everyday." Selvakumar Jawahar

Buy early, pay less, free updates

Note that this book is published step-by-step. The first public version was published in June 2021. Since then, the contents grows with new chapters, examples, and caveats about the features of C++20 and I integrate all feedback I get for the pages already published.

The book is feature complete now.

Just minore details and copy editing is missing.

See cppstd20.com for a detailed list of all the topics covered.

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

#cpp20tcg

Share this book

Categories

Author

About the Author

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.

Leanpub Podcast

Episode 89

An Interview with Nicolai M. Josuttis

Contents

Table of Contents

Preface

  1. An Experiment
  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. Initializations
  6. Error Terminology
  7. Code Simplifications
  8. The C++ Standards
  9. Example Code and Additional Information
  10. Feedback

1.Comparisons and Operator <=>

  1. 1.1Motivation for Operator<=>
  2. 1.1.1Defining Comparison Operators Before C++20
  3. 1.1.2Defining Comparison Operators Since C++20
  4. 1.2Defining and Using Comparisons
  5. 1.2.1Using Operator<=>
  6. 1.2.2Comparison Category Types
  7. 1.2.3Using Comparison Categories with operator<=>
  8. 1.2.4Calling Operator <=> Directly
  9. 1.2.5Dealing with Multiple Ordering Criteria
  10. 1.3Defining operator<=> and operator==
  11. 1.3.1Defaulted operator== and operator<=>
  12. 1.3.2Defaulted operator<=> Implies Defaulted operator==
  13. 1.3.3Implementation of the Defaulted operator<=>
  14. 1.4Overload Resolution with Rewritten Expressions
  15. 1.5Using Operator <=> in Generic Code
  16. 1.5.1compare_three_way
  17. 1.5.2Algorithm lexicographical_compare_three_way()
  18. 1.6Compatibility Issues with the Comparison Operators
  19. 1.6.1Delegating Free-Standing Comparison Operators
  20. 1.6.2Inheritance with Protected Members
  21. 1.7Afternotes

2.Placeholder Types for Function Parameters

  1. 2.1auto for Parameters of Ordinary Functions
  2. 2.1.1auto for Parameters of Member Functions
  3. 2.2Using auto for Parameters in Practice
  4. 2.2.1Deferred Type Checks with auto
  5. 2.2.2auto Functions versus Lambdas
  6. 2.3auto for Parameters in Detail
  7. 2.3.1Basic Constraints for auto Parameters
  8. 2.3.2Combining Template and auto Parameters
  9. 2.4Afternotes

3.Concepts, Requirements, and Constraints

  1. 3.1Motivating Example of Concepts and Requirements
  2. 3.1.1Improving the Template Step by Step
  3. 3.1.2A Complete Example with Concepts
  4. 3.2Where Constraints and Concepts Can Be Used
  5. 3.2.1Constraining Alias Templates
  6. 3.2.2Constraining Variable Templates
  7. 3.2.3Constraining Member Functions
  8. 3.2.4Constraining Non-Type Template Parameters
  9. 3.3Typical Applications of Concepts and Constraints in Practice
  10. 3.3.1Using Concepts to Understand Code and Error Messages
  11. 3.3.2Using Concepts to Disable Generic Code
  12. 3.3.3Using Requirements to Call Different Functions
  13. 3.3.4The Example as a Whole
  14. 3.3.5Former Workarounds
  15. 3.4Semantic Constraints
  16. 3.4.1Examples of Semantic Constraints
  17. 3.5Design Guidelines for Concepts
  18. 3.5.1Concepts Should Group Requirements
  19. 3.5.2Define Concepts with Care
  20. 3.5.3Concepts versus Type Traits and Boolean Expressions
  21. 3.6Afternotes

4.Concepts, Requirements, and Constraints in Detail

  1. 4.1Constraints
  2. 4.2requires Clauses
  3. 4.2.1Using && and || in requires Clauses
  4. 4.3Ad-hoc Boolean Expressions
  5. 4.4requires Expressions
  6. 4.4.1Simple Requirements
  7. 4.4.2Type Requirements
  8. 4.4.3Compound Requirements
  9. 4.4.4Nested Requirements
  10. 4.5Concepts in Detail
  11. 4.5.1Defining Concepts
  12. 4.5.2Special Abilities of Concepts
  13. 4.5.3Concepts for Non-Type Template Parameters
  14. 4.6Using Concepts as Type Constraints
  15. 4.7Subsuming Constraints with Concepts
  16. 4.7.1Indirect Subsumptions
  17. 4.7.2Defining Commutative Concepts

5.Standard Concepts in Detail

  1. 5.1Overview of All Standard Concepts
  2. 5.1.1Header Files and Namespaces
  3. 5.1.2Standard Concepts Subsume
  4. 5.2Language-Related Concepts
  5. 5.2.1Arithmetic Concepts
  6. 5.2.2Object Concepts
  7. 5.2.3Concepts for Relationships between Types
  8. 5.2.4Comparison Concepts
  9. 5.3Concepts for Iterators and Ranges
  10. 5.3.1Concepts for Ranges and Views
  11. 5.3.2Concepts for Pointer-Like Objects
  12. 5.3.3Concepts for Iterators
  13. 5.3.4Iterator Concepts for Algorithms
  14. 5.4Concepts for Callables
  15. 5.4.1Basic Concepts for Callables
  16. 5.4.2Concepts for Callables Used by Iterators
  17. 5.5Auxiliary Concepts
  18. 5.5.1Concepts for Specific Type Attributes
  19. 5.5.2Concepts for Incrementable Types

6.Ranges and Views

  1. 6.1A Tour of Ranges and Views Using Examples
  2. 6.1.1Passing Containers to Algorithms as Ranges
  3. 6.1.2Constraints and Utilities for Ranges
  4. 6.1.3Views
  5. 6.1.4Sentinels
  6. 6.1.5Range Definitions with Sentinels and Counts
  7. 6.1.6Projections
  8. 6.1.7Utilities for Implementing Code for Ranges
  9. 6.1.8Limitations and Drawbacks of Ranges
  10. 6.2Borrowed Iterators and Ranges
  11. 6.2.1Borrowed Iterators
  12. 6.2.2Borrowed Ranges
  13. 6.3Using Views
  14. 6.3.1Views on Ranges
  15. 6.3.2Lazy Evaluation
  16. 6.3.3Caching in Views
  17. 6.3.4Performance Issues with Filters
  18. 6.4Views on Ranges That Are Destroyed or Modified
  19. 6.4.1Lifetime Dependencies Between Views and Their Ranges
  20. 6.4.2Views with Write Access
  21. 6.4.3Views on Ranges That Change
  22. 6.4.4Copying Views Might Change Behavior
  23. 6.5Views and const
  24. 6.5.1Generic Code for Both Containers and Views
  25. 6.5.2Views May Remove the Propagation of const
  26. 6.5.3Bringing Back Deep Constness to Views
  27. 6.6Summary of All Container Idioms Broken By Views
  28. 6.7Afternotes

7.Utilities for Ranges and Views

  1. 7.1Key Utilities for Using Ranges as Views
  2. 7.1.1std::views::all()
  3. 7.1.2std::views::counted()
  4. 7.1.3std::views::common()
  5. 7.2New Iterator Categories
  6. 7.3New Iterator and Sentinel Types
  7. 7.3.1std::counted_iterator
  8. 7.3.2std::common_iterator
  9. 7.3.3std::default_sentinel
  10. 7.3.4std::unreachable_sentinel
  11. 7.3.5std::move_sentinel
  12. 7.4New Functions for Dealing with Ranges
  13. 7.4.1Functions for Dealing with the Elements of Ranges (and Arrays)
  14. 7.4.2Functions for Dealing with Iterators
  15. 7.4.3Functions for Swapping and Moving Elements/Values
  16. 7.4.4Functions for Comparisons of Values
  17. 7.5New Type Functions/Utilities for Dealing with Ranges
  18. 7.5.1Generic Types of Ranges
  19. 7.5.2Generic Types of Iterators
  20. 7.5.3New Functional Types
  21. 7.5.4Other New Types for Dealing with Iterators
  22. 7.6Range Algorithms
  23. 7.6.1Benefits and Restrictions for Range Algorithms
  24. 7.6.2Algorithm Overview

8.View Types in Detail

  1. 8.1Overview of All Views
  2. 8.1.1Overview of Wrapping and Generating Views
  3. 8.1.2Overview of Adapting Views
  4. 8.2Base Class and Namespace of Views
  5. 8.2.1Base Class for Views
  6. 8.2.2Why Range Adaptors/Factories Have Their Own Namespace
  7. 8.3Source Views to External Elements
  8. 8.3.1Subrange
  9. 8.3.2Ref View
  10. 8.3.3Owning View
  11. 8.3.4Common View
  12. 8.4Generating Views
  13. 8.4.1Iota View
  14. 8.4.2Single View
  15. 8.4.3Empty View
  16. 8.4.4IStream View
  17. 8.4.5String View
  18. 8.4.6Span
  19. 8.5Filtering Views
  20. 8.5.1Take View
  21. 8.5.2Take-While View
  22. 8.5.3Drop View
  23. 8.5.4Drop-While View
  24. 8.5.5Filter View
  25. 8.6Transforming Views
  26. 8.6.1Transform View
  27. 8.6.2Elements View
  28. 8.6.3Keys and Values View
  29. 8.7Mutating Views
  30. 8.7.1Reverse View
  31. 8.8Views for Multiple Ranges
  32. 8.8.1Split and Lazy-Split View
  33. 8.8.2Join View

9.Spans

  1. 9.1Using Spans
  2. 9.1.1Fixed and Dynamic Extent
  3. 9.1.2Example Using a Span with a Dynamic Extent
  4. 9.1.3Example Using a Span with Non-const Elements
  5. 9.1.4Example Using a Span with Fixed Extent
  6. 9.1.5Fixed vs. Dynamic Extent
  7. 9.2Spans Considered Harmful
  8. 9.3Design Aspects of Spans
  9. 9.3.1Lifetime Dependencies of Spans
  10. 9.3.2Performance of Spans
  11. 9.3.3const Correctness of Spans
  12. 9.3.4Using Spans as Parameters in Generic Code
  13. 9.4Span Operations
  14. 9.4.1Span Operations and Member Types Overview
  15. 9.4.2Constructors
  16. 9.4.3Operations for Sub-Spans
  17. 9.5Afternotes

10.Formatted Output

  1. 10.1Formatted Output by Example
  2. 10.1.1Using std::format()
  3. 10.1.2Using std::format_to_n()
  4. 10.1.3Using std::format_to()
  5. 10.1.4Using std::formatted_size()
  6. 10.2Performance of the Formatting Library
  7. 10.2.1Using std::vformat() and vformat_to()
  8. 10.3Formatted Output in Detail
  9. 10.3.1General Format of Format Strings
  10. 10.3.2Standard Format Specifiers
  11. 10.3.3Width, Precision, and Fill Characters
  12. 10.3.4Format/Type Specifiers
  13. 10.4Internationalization
  14. 10.5Error Handling
  15. 10.6User-Defined Formatted Output
  16. 10.6.1Basic Formatter API
  17. 10.6.2Improved Parsing
  18. 10.6.3Using Standard Formatters for User-Defined Formatters
  19. 10.6.4Using Standard Formatters for Strings
  20. 10.7Afternotes

11.Dates and Timezones for <chrono>

  1. 11.1Overview by Example
  2. 11.1.1Scheduling a Meeting on the 5th of Every Month
  3. 11.1.2Scheduling a Meeting on the Last Day of Every Month
  4. 11.1.3Scheduling a Meeting Every First Monday
  5. 11.1.4Using Different Timezones
  6. 11.2Basic Chrono Concepts and Terminology
  7. 11.3Basic Chrono Extensions with C++20
  8. 11.3.1Duration Types
  9. 11.3.2Clocks
  10. 11.3.3Timepoint Types
  11. 11.3.4Calendrical Types
  12. 11.3.5Time Type hh_mm_ss
  13. 11.3.6Hours Utilities
  14. 11.4I/O with Chrono Types
  15. 11.4.1Default Output Formats
  16. 11.4.2Formatted Output
  17. 11.4.3Locale-Dependent Output
  18. 11.4.4Formatted Input
  19. 11.5Using the Chrono Extensions in Practice
  20. 11.5.1Invalid Dates
  21. 11.5.2Dealing with months and years
  22. 11.5.3Parsing Timepoints and Durations
  23. 11.6Timezones
  24. 11.6.1Characteristics of Timezones
  25. 11.6.2The IANA Timezone Database
  26. 11.6.3Using Timezones
  27. 11.6.4Dealing with Timezone Abbreviations
  28. 11.6.5Custom Timezones
  29. 11.7Clocks in Detail
  30. 11.7.1Clocks with a Specified Epoch
  31. 11.7.2The Pseudo Clock local_t
  32. 11.7.3Dealing with Leap Seconds
  33. 11.7.4Conversions between Clocks
  34. 11.7.5Dealing with the File Clock
  35. 11.8Other New Chrono Features
  36. 11.9Afternotes

12.std::jthread and Stop Tokens

  1. 12.1Motivation for std::jthread
  2. 12.1.1The Problem of std::thread
  3. 12.1.2Using std::jthread
  4. 12.1.3Stop Tokens and Stop Callbacks
  5. 12.1.4Stop Tokens and Condition Variables
  6. 12.2Stop Sources and Stop Tokens
  7. 12.2.1Stop Sources and Stop Tokens in Detail
  8. 12.2.2Using Stop Callbacks
  9. 12.2.3Constraints and Guarantees of Stop Tokens
  10. 12.3std::jthread in Detail
  11. 12.3.1Using Stop Tokens with std::jthread
  12. 12.4Afternotes

13.Concurrency Features

  1. 13.1Thread Synchronization with Latches and Barriers
  2. 13.1.1Latches
  3. 13.1.2Barriers
  4. 13.2Semaphores
  5. 13.2.1Example of Using Counting Semaphores
  6. 13.2.2Example of Using Binary Semaphores
  7. 13.3Extensions for Atomic Types
  8. 13.3.1Atomic References with std::atomic_ref<>
  9. 13.3.2Atomic Shared Pointers
  10. 13.3.3Atomic Floating-Point Types
  11. 13.3.4Thread Synchronization with Atomic Types
  12. 13.3.5Extensions for std::atomic_flag
  13. 13.4Synchronized Output Streams
  14. 13.4.1Motivation for Synchronized Output Streams
  15. 13.4.2Using Synchronized Output Streams
  16. 13.4.3Using Synchronized Output Streams for Files
  17. 13.4.4Using Synchronized Output Streams as Output Streams
  18. 13.4.5Synchronized Output Streams in Practice
  19. 13.5Afternotes

14.Coroutines

  1. 14.1What Are Coroutines?
  2. 14.2A First Coroutine Example
  3. 14.2.1Defining the Coroutine
  4. 14.2.2Using the Coroutine
  5. 14.2.3Lifetime Issues with Call-by-Reference
  6. 14.2.4Coroutines Calling Coroutines
  7. 14.2.5Implementing the Coroutine Interface
  8. 14.2.6Bootstrapping Interface, Handle, and Promise
  9. 14.2.7Memory Management
  10. 14.3Coroutines That Yield or Return Values
  11. 14.3.1Using co_yield
  12. 14.3.2Using co_return
  13. 14.4Coroutine Awaitables and Awaiters
  14. 14.4.1Awaiters
  15. 14.4.2Standard Awaiters
  16. 14.4.3Resuming Sub-Coroutines
  17. 14.4.4Passing Values From Suspension Back to the Coroutine
  18. 14.5Afternotes

15.Coroutines in Detail

  1. 15.1Coroutine Constraints
  2. 15.1.1Coroutine Lambdas
  3. 15.2The Coroutine Frame and the Promises
  4. 15.2.1How Coroutine Interfaces, Promises, and Awaitables Interact
  5. 15.3Coroutine Promises in Detail
  6. 15.3.1Mandatory Promise Operations
  7. 15.3.2Promise Operations to Return or Yield Values
  8. 15.3.3Optional Promise Operations
  9. 15.4Coroutine Handles in Detail
  10. 15.4.1std::coroutine_handle<void>
  11. 15.5Exceptions in Coroutines
  12. 15.6Allocating Memory for the Coroutine Frame
  13. 15.6.1How Coroutines Allocate Memory
  14. 15.6.2Avoiding Heap Memory Allocation
  15. 15.6.3get_return_object_on_allocation_failure()
  16. 15.7co_await and Awaiters in Detail
  17. 15.7.1Details of the Awaiter Interface
  18. 15.7.2Letting co_await Update Running Coroutines
  19. 15.7.3Symmetric Transfer with Awaiters for Continuation
  20. 15.8Other Ways of Dealing with co_await
  21. 15.8.1await_transform()
  22. 15.8.2operator co_await()
  23. 15.9Concurrent Use of Coroutines
  24. 15.9.1co_await Coroutines
  25. 15.9.2A Thread Pool for Coroutine Tasks
  26. 15.9.3What C++ Libraries Will Provide After C++20
  27. 15.10Coroutine Traits

16.Modules

  1. 16.1Motivation for Modules Using a First Example
  2. 16.1.1Implementing and Exporting a Module
  3. 16.1.2Compiling Module Units
  4. 16.1.3Importing and Using a Module
  5. 16.1.4Reachable versus Visible
  6. 16.1.5Modules and Namespaces
  7. 16.2Modules with Multiple Files
  8. 16.2.1Module Units
  9. 16.2.2Using Implementation Units
  10. 16.2.3Internal Partitions
  11. 16.2.4Interface Partitions
  12. 16.2.5Summary of Splitting Modules into Different Files
  13. 16.3Dealing with Modules in Practice
  14. 16.3.1Dealing with Module Files with Different Compilers
  15. 16.3.2Dealing with Header Files
  16. 16.4Modules in Detail
  17. 16.4.1Private Module Fragments
  18. 16.4.2Module Declaration and Export in Detail
  19. 16.4.3Umbrella Modules
  20. 16.4.4Module Import in Detail
  21. 16.4.5Reachable versus Visible Symbols in Detail
  22. 16.5Afternotes

17.Lambda Extensions

  1. 17.1Generic Lambdas with Template Parameters
  2. 17.1.1Using Template Parameters for Generic Lambdas in Practice
  3. 17.1.2Explicit Specification of Lambda Template Parameters
  4. 17.2Calling the Default Constructor of Lambdas
  5. 17.3Lambdas as Non-Type Template Parameters
  6. 17.4consteval Lambdas
  7. 17.5Changes for Capturing
  8. 17.5.1Capturing this and *this
  9. 17.5.2Capturing Structured Bindings
  10. 17.5.3Capturing Parameter Packs of Variadic Templates
  11. 17.5.4Lambdas as Coroutines
  12. 17.6Afternotes

18.Compile-Time Computing

  1. 18.1Keyword constinit
  2. 18.1.1Using constinit in Practice
  3. 18.1.2How constinit Solves the Static Initialization Order Fiasco
  4. 18.2Keyword consteval
  5. 18.2.1A First consteval Example
  6. 18.2.2constexpr versus consteval
  7. 18.2.3Using consteval in Practice
  8. 18.2.4Compile-Time Value versus Compile-Time Context
  9. 18.3Relaxed Constraints for constexpr Functions
  10. 18.4std::is_constant_evaluated()
  11. 18.4.1std::is_constant_evaluated() in Detail
  12. 18.5Using Heap Memory, Vectors, and Strings at Compile Time
  13. 18.5.1Using Vectors at Compile Time
  14. 18.5.2Returning a Collection at Compile Time
  15. 18.5.3Using Strings at Compile Time
  16. 18.6Other constexpr Extensions
  17. 18.6.1constexpr Language Extensions
  18. 18.6.2constexpr Library Extensions
  19. 18.7Afternotes

19.Non-Type Template Parameter (NTTP) Extensions

  1. 19.1New Types for Non-Type Template Parameters
  2. 19.1.1Floating-Point Values as Non-Type Template Parameters
  3. 19.1.2Objects as Non-Type Template Parameters
  4. 19.1.3Lambdas as Non-Type Template Parameters
  5. 19.2Afternotes

20.New Type Traits

  1. 20.1New Type Traits for Type Classification
  2. 20.1.1is_bounded_array_v<> and is_unbounded_array_v
  3. 20.2New Type Traits for Type Inspection
  4. 20.2.1is_nothrow_convertible_v<>
  5. 20.3New Type Traits for Type Conversion
  6. 20.3.1remove_cvref_t<>
  7. 20.3.2unwrap_reference<> and unwrap_ref_decay_t
  8. 20.3.3common_reference<>_t
  9. 20.3.4type_identity_t<>
  10. 20.4New Type Traits for Iterators
  11. 20.4.1iter_difference_t<>
  12. 20.4.2iter_value_t<>
  13. 20.4.3iter_reference_t<> and iter_rvalue_reference_t<>
  14. 20.5Type Traits and Functions for Layout Compatibility
  15. 20.5.1is_layout_compatible_v<>
  16. 20.5.2is_pointer_interconvertible_base_of_v<>
  17. 20.5.3is_corresponding_member()
  18. 20.5.4is_pointer_interconvertible_with_class()
  19. 20.6Afternotes

21.Small Improvements for the Core Language

  1. 21.1Range-Based for Loop with Initialization
  2. 21.2using for Enumeration Values
  3. 21.3Delegating Enumeration Types to Different Scopes
  4. 21.4New Character Type char8_t
  5. 21.4.1Changes in the C++ Standard Library for char8_t
  6. 21.4.2Broken Backward Compatibility
  7. 21.5Improvements for Aggregates
  8. 21.5.1Designated Initializers
  9. 21.5.2Aggregate Initialization with Parentheses
  10. 21.5.3Definition of Aggregates
  11. 21.6New Attributes and Attribute Features
  12. 21.6.1Attributes [[likely]] and [[unlikely]]
  13. 21.6.2Attribute [[no_unique_address]]
  14. 21.6.3Attribute [[nodiscard]] with Parameter
  15. 21.7Feature Test Macros
  16. 21.8Afternotes

22.Small Improvements for Generic Programming

  1. 22.1Implicit typename for Type Members of Template Parameters
  2. 22.1.1Rules for Implicit typename in Detail
  3. 22.2Improvements for Aggregates in Generic Code
  4. 22.2.1Class Template Argument Deduction (CTAD) for Aggregates
  5. 22.3Conditional explicit
  6. 22.3.1Conditional explicit in the Standard Library
  7. 22.4Afternotes

23.Small Improvements for the C++ Standard Library

  1. 23.1Updates for String Types
  2. 23.1.1String Members starts_with() and ends_with()
  3. 23.1.2Restricted String Member reserve()
  4. 23.2std::source_location
  5. 23.3Safe Comparisons of Integral Values and Sizes
  6. 23.3.1Safe Comparisons of Integral Values
  7. 23.3.2ssize()
  8. 23.4Mathematical Constants
  9. 23.5Utilities for Dealing with Bits
  10. 23.5.1Bit Operations
  11. 23.5.2std::bit_cast<>()
  12. 23.5.3std::endian
  13. 23.6<version>
  14. 23.7Extensions for Algorithms
  15. 23.7.1Range Support
  16. 23.7.2New Algorithms
  17. 23.7.3unseq Execution Policy for Algorithms
  18. 23.8Afternotes

24.Deprecated and Removed Features

  1. 24.1Deprecated and Removed Core Language Features
  2. 24.2Deprecated and Removed Library Features
  3. 24.2.1Deprecated Library Features
  4. 24.2.2Removed Library Features
  5. 24.3Afternotes

Glossary

  1. A
  2. aggregate
  3. argument-dependent lookup (ADL)
  4. C
  5. class template argument deduction (CTAD)
  6. F
  7. forwarding reference
  8. full specialization
  9. function object (functor)
  10. G
  11. glvalue
  12. I
  13. incomplete type
  14. L
  15. lvalue
  16. P
  17. partial specialization
  18. predicate
  19. prvalue
  20. R
  21. resource acquisition is initialization (RAII)
  22. regular type
  23. rvalue
  24. S
  25. semiregular type
  26. substitution failure is not an error (SFINAE)
  27. small string optimization (SSO)
  28. stateless
  29. standard template library (STL)
  30. U
  31. universal reference
  32. V
  33. value category
  34. variable template
  35. variadic template
  36. X
  37. xvalue

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub