Chapter Overview

Get an idea of what we'll cover in this chapter.

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 our 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