What this book covers
Chaper 1, New C++20 Features, introduces the new STL features in C++20. It aims to familiarize you with the new language features so you may use them with the STL.
Chapter 2, General STL Features, discusses modern STL features added in recent C++ versions.
Chapter 3, STL Containers, covers the STL's comprehensive library of containers.
Chapter 4, Compatible Iterators, shows how to use and create STL-compatible iterators.
Chapter 5, Lambda Expressions, covers the use of lambdas with STL functions and algorithms.
Chapter 6, STL Algorithms, provides recipes for using and creating STL-compatible algorithms.
Chapter 7, Strings, Stream, and Formatting, describes the STL string and formatter classes.
Chapter 8, Utility Classes, covers STL utilities for date-and-time, smart pointers, optionals, and more.
Chapter 9, Concurrency and Parallelism, describes support for concurrency, including threads, async, atomic types, and more.
Chapter 10, Using the File System, covers the std::filesystem
classes and how to put them to use with the latest advancements that came out with C++20.
Chapter 11, A Few More Ideas, provides a few more solutions, including a trie class, string split, and more. This provides advanced examples on how to put the STL to use for real-world problems.
The recipes in this book use the GCC compiler
Unless otherwise noted, most of the recipes in this book have been developed and tested using the GCC compiler, version 11.2, the latest stable version as of this writing.
As I write this, C++20 is still new and is not fully implemented on any available compiler. Of the three major compilers, GCC (GNU), MSVC (Microsoft), and Clang (Apple), the MSVC compiler is furthest along in implementing the new standard. Occasionally, we may run into a feature that is implemented on MSVC or another compiler, but not on GCC, in which case I will note which compiler I used. If a feature is not yet implemented on any available compiler, I will explain that I was unable to test it.
I strongly recommend that you install GCC to follow along with the recipes in this book. GCC is freely available under the GNU General Public License (GPL). The easiest way to get the latest version of GCC is to install Debian Linux (also GPL) and use apt
with the testing
repository.
If you are using the digital version of this book, we suggest you type the code yourself or download the code from the GitHub repository (link in the next section). This will avoid errors due to copying and pasting formatted code from the e-book.
Download the example code files
You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/CPP-20-STL-Cookbook. In the event of updates and errata, code will be updated on the GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!