Essential C++ Techniques
In this chapter, we will take an in-depth look at some fundamental C++ techniques, such as move semantics, error handling, and lambda expressions, that will be used throughout this book. Some of these concepts still confuse even experienced C++ programmers and therefore we will look into both their use cases and how they work under the hood.
This chapter will cover the following topics:
- Automatic type deduction and how to use the
auto
keyword when declaring functions and variables. - Move semantics and the rule of five and rule of zero.
- Error handling and contracts. Although these topics don't present anything that can be considered modern C++, both exceptions and contracts are highly debated areas within C++ today.
- Creating function objects using lambda expressions, one of the most important features from C++11.
Let's begin by taking a look at automatic type deduction.