Chapter 2: General STL Features
This chapter is a general potpourri of STL features and techniques. These are mostly new features introduced over the past few years, which may not yet be widely used. These are useful techniques that will improve the simplicity and readability of your code.
In this chapter we will cover the following recipes:
- Use the new span class to make your C-arrays safer
- Use structured binding to return multiple values
- Initialize variables within if and switch statements
- Use template argument deduction for simplicity and clarity
- Use if constexpr to simplify compile-time decisions
Technical requirements
You can find the code for this chapter on GitHub at https://github.com/PacktPublishing/CPP-20-STL-Cookbook/tree/main/chap02 ...
Get C++20 STL Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.