Название: Notebook C++ : About Move Semantics Автор: 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.
All in all, after having read this book, you have a solid understanding of move semantics.
Before diving in with various other tips, let’s get the fundamental understanding of move semantics in C++. In programming languages in general, we have two different types of move semantics:
- destructive move - non-destructive move
In C++, we have the latter, but let’s look into the first form first. A destructive move means that once we move an object, we will see later what that means and how to do it in C++, the source object gets destroyed afterward. The destructive move approach has a couple of advantages. One of the biggest questions about move semantics in C++ is about the so-called moved-from state, which you learn about in Note 9.
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
С этой публикацией часто скачивают:
C++ Move Semantics - The Complete Guide (2022) Название: C++ Move Semantics - The Complete Guide (2022) Автор: Nicolai M. Josuttis Издательство: Leanpub Год: 2022-04-19 Страниц: 262 Язык:...
Building Knowledge Graphs (Early Release) Название: Building Knowledge Graphs (Early Release) Автор: Jesus Barrasa, Maya Natarajan and Jim Webber Издательство: O’Reilly Media Год: 2022-09-30:...
Programming ArcGIS Pro with Python, 2nd Edition Название: Programming ArcGIS Pro with Python, 2nd Edition Автор: Eric Pimpler Издательство: GeoSpatial Год: 2021 Формат: ePUB, PDF Страниц: 266...
C++ Move Semantics - The Complete Guide Название: C++ Move Semantics - The Complete Guide Автор: Nicolai M. Josuttis Издательство: Leanpub Год: 2020-12-19 Страниц: 260 Язык: английский...
Science Comics: Cars: Engines That Move You Название: Science Comics: Cars: Engines That Move You Автор: Dan Zettwoch Издательство: First Second Год: 2019 Формат: EPUB Размер: 31 Мб Язык:...
Lewis Carroll. Photography on the Move Название: Lewis Carroll. Photography on the Move Автор: Lindsay Smith Издательство: Reaktion Books Год: 2015 Формат: epub Страниц: 230 Для сайта:...
Text Analytics with Python Название: Text Analytics with Python: A Practical Real-World Approach to Gaining Actionable Insights from your Data Автор: Dipanjan Sarkar...