Chapter Overview
Get an idea of what we'll cover in this chapter.
We'll cover the following...
We'll cover the following...
This chapter concentrates on some of the more compelling features that C++20 adds to the STL. We can use some of these right away. Others may need to wait for implementation in your favorite compiler. There are a lot of new additions to the C++20 standard, far more than we could cover here. We'll cover the additions that are most likely to have long-term impact.
In this chapter, we will cover the following recipes:
- Format text with the new
format
library - Use compile-time vectors and strings with
constexpr
- Safely compare integers of different types
- Use the spaceship operator
<=>
for three-way comparisons - Easily find feature test macros with the
<version>
header - Create safer templates with concepts and constraints
- Avoid re-compiling template libraries with modules
- Create views into containers with ranges