Contents

Preface

1 The Basics

1.1     Introduction

1.2     Programs

1.3     Functions

1.4     Types, Variables, and Arithmetic

1.5     Scope and Lifetime

1.6     Constants

1.7     Pointers, Arrays, and References

1.8     Tests

1.9     Mapping to Hardware

1.10   Advice

2 User-Defined Types

2.1     Introduction

2.2     Structures

2.3     Classes

2.4     Unions

2.5     Enumerations

2.6     Advice

3 Modularity

3.1     Introduction

3.2     Separate Compilation

3.3     Modules (C++20)

3.4     Namespaces

3.5     Error Handling

3.6     Function Arguments and Return Values

3.7     Advice

4 Classes

4.1     Introduction

4.2     Concrete Types

4.3     Abstract Types

4.4     Virtual Functions

4.5     Class Hierarchies

4.6     Advice

5 Essential Operations

5.1     Introduction

5.2     Copy and Move

5.3     Resource Management

5.4     Conventional Operations

5.5     Advice

6 Templates

6.1     Introduction

6.2     Parameterized Types

6.3     Parameterized Operations

6.4     Template Mechanisms

6.5     Advice

7 Concepts and Generic Programming

7.1     Introduction

7.2     Concepts

7.3     Generic Programming

7.4     Variadic Templates

7.5     Template Compilation Model

7.6     Advice

8 Library Overview

8.1     Introduction

8.2     Standard-Library Components

8.3     Standard-Library Headers and Namespace

8.4     Advice

9 Strings and Regular Expressions

9.1     Introduction

9.2     Strings

9.3     String Views

9.4     Regular Expressions

9.5     Advice

10 Input and Output

10.1   Introduction

10.2   Output

10.3   Input

10.4   I/O State

10.5   I/O of User-Defined Types

10.6   Formatting

10.7   File Streams

10.8   String Streams

10.9   C-style I/O

10.10 File System

10.11 Advice

11 Containers

11.1   Introduction

11.2   vector

11.3   list

11.4   map

11.5   unordered_map

11.6   Container Overview

11.7   Advice

12 Algorithms

12.1   Introduction

12.2   Use of Iterators

12.3   Iterator Types

12.4   Stream Iterators

12.5   Predicates

12.6   Algorithm Overview

12.7   Concepts (C++20)

12.8   Container Algorithms

12.9   Parallel Algorithms

12.10 Advice

13 Utilities

13.1   Introduction

13.2   Resource Management

13.3   Range Checking: span

13.4   Specialized Containers

13.5   Alternatives

13.6   Allocators

13.7   Time

13.8   Function Adaption

13.9   Type Functions

13.10 Advice

14 Numerics

14.1   Introduction

14.2   Mathematical Functions

14.3   Numerical Algorithms

14.4   Complex Numbers

14.5   Random Numbers

14.6   Vector Arithmetic

14.7   Numeric Limits

14.8   Advice

15 Concurrency

15.1   Introduction

15.2   Tasks and threads

15.3   Passing Arguments

15.4   Returning Results

15.5   Sharing Data

15.6   Waiting for Events

15.7   Communicating Tasks

15.8   Advice

16 History and Compatibility

16.1   History

16.2   C++ Feature Evolution

16.3   C/C++ Compatibility

16.4   Bibliography

16.5   Advice

Index