C++ Move Semantics: The Complete Guide by Nicolai M. Josuttis
(www.cppmove.com) Nicolai M. Josuttis: C++ Move Semantics - The Complete Guide website
ROAM_REFS: https://www.cppmove.com/ https://www.cppmove.com/cppmove.html
* */C++ Move Semantics - The Complete Guide/
by Nicolai M. Josuttis
- Giving guidance on how to use Language and Library Features of Move Semantics
- For programmers, who want understand and benefit from one of the most important features of Modern C++
This book was written and published incrementally (step-by-step) at leanpub, so that readers could benefit from it without waiting until all is done. And I got early feedback from readers to improve the content. The first version was available in January, 2020.
Now, I am done. All features are covered.
Move semantics, introduced with C++11, has become a hallmark of modern C++ programming. However, it also complicates the language in many ways. After several years of support for move semantics, experienced programmers still struggle with all the details. Even for trivial classes, style guides give conflicting or inappropriate advice on how to benefit from move semantics.
Time to explain all aspects of C++ move semantics in detail.
This book teaches C++ move semantics. Starting from the basic principles, it motivates and explains all the corner cases of move semantics so that as a programmer, you can use move semantics correctly. The book is valuable for those who are just starting to learn about move semantics and is essential for those who are using it already.
You will learn:
- The motivation for and terminology of move semantics
- How and why you benefit implicitly from move semantics
- How to benefit explicitly from move semantics
- All the traps involved in move semantics and how to deal with them
- All the consequences of move semantics for your programming style
As usual for books by Nicolai Josuttis, the focus lies on the application of the features described in practice. Compelling examples and useful background information help you to understand and improve code, from trivial classes up to generic foundation libraries and frameworks.
Nicolai M. Josuttis is well known in the programming community for his authoritative books and talks. For more than 20 years he is a member of the C++ Standard Committee. He is the (co-)author of several worldwide best-sellers, including
- The C++ Standard Library, the book about the C++ Standard Library, first publication in 1999
- C++17 - The Complete Guide, all new features of C++17 (both language and library) in one book
- C++ Templates - The Complete Guide (with David Vandevoorde and Doug Gregor), the book about templates
The book is now available as printed book:
Nicolai M. Josuttis C++ Move Semantics- The Complete Guide
ISBN-13: 978-3-96730-900-3 ISBN-10: 3-96730-900-2
** Table of Content:
(all features covered):
Basic Features of Move Semantics:
- Motivation of move semantics
- Performance benefits
- Rvalue references
- std::move()
- std::move() for members and member functions
- Self-move
- Overload resolution with move semantics
- Value categories and xvalues
- decltype with expressions
- Enabling copy semantics only
- Rule of five or three
- How to initialize members with move semantics
- Overloading on reference qualifiers
- The return type of getters
- Move semantics in polymorphic class hierarchies
- const rvalue references (const&&)
- Using noexcept
- Dealing with moved-from states (invalid objects and broken invariants)
Move Semantics in Generic Code:
- Universal/forwarding references
- Perfect forwarding
- std::forward<>()
- Constructors with universal references
- Perfect passing
- auto&&
- Universal references as non-forwarding references
- Universal references of concrete types
- Generic raw rvalue references
- Perfect returning
- decltype(auto)
- Move semantics in lambdas
- Move semantics in range-based for loops
Move Semantics in the C++ Standard Library :
- Move-only types
- I/O streams
- Threads
- Unique Pointers
- When Scott Meyers and Herb Sutter contradict
- Moving algorithms
- Move semantics with removing algorithms
- Move iterators
- Move semantics for strings
- Move semantics for containers (especially std::vectors and std::arrays)
- Move semantics for std::sharedptr<>
- Move semantics for std::pair<>
- std::makepair() and std::decay<>
- Move semantics for std::optional<>
Note that you can also book inhouse trainings about all topics of Modern C++ and C++17 (both the language and its standard library).