
Автор: Andreas Fertig
Издательство: Leanpub
Год: 2022-09-12
Язык: английский
Формат: pdf (true)
Размер: 10.1 MB
The idea of the Notebook C++ series is to share some tips and tricks about various C++ elements. All books in this series are somewhat short and small books, one for each major topic. Such that the paperback version can be carried around easily. This part of the series is all about move semantics. I will introduce the feature to you in an maybe unconventional but easy-to-understand way. Move semantics are nothing special, afterall. We'll start looking at what move semantics is, how it works, and why we should most times stay away from std::move. We establish some rules about when to use std::move, when std::forward. You learn about why not to move return values or temporary objects. You want to get the best speed from your custom data type and the STL? No problem, you will learn what your class must look like to achieve this. In the end, you also learn about some feature that is not seen that often, ref-qualifiers, how they work, why they are there, and when to use them.