rvalue References Wrap Up
The last weeks I have been writing a lot about move semantics, move operations, rvalue references and forwarding references. While it might take a bit of getting used to all this, there’s good news.
The last weeks I have been writing a lot about move semantics, move operations, rvalue references and forwarding references. While it might take a bit of getting used to all this, there’s good news.
Combining rvalue references with templated function parameters or `auto` behaves quite differently than “normal” rvalue references. Together with the utility function template `std::forward` they allow something called “perfect forwarding” and are therefore also called forwarding references.
Managing the lifetime of dynamically allocated memory and the objects residing in it is one of the challenges that can be hard to do right. It is usually handled by assigning […]
After introducing the concept of move semantics and describing how move constructors and move assignment operators work, I’ll wrap up my discussion of the topic with my answer to one question: […]
In my last post I gave a little introduction to move semantics and a very brief description of rvalue references. This time I will cover two special functions that are based on those language features and are key to integrating them into each and every C++ program: The move constructor and move assignment operator.
One of the biggest changes in C++11 were the introduction of rvalue references to allow the implementation of move semantics. I will give an overview of the basic idea of move semantics, its related features and how to use them.
A few posts ago I have written about `auto` for variables. This time will be about the same keyword for a different use: `auto` as return type for functions.
Have you ever seen a codebase crawling with `DWORD_PTR`, `HANDLE` and similar types? I bet it was a Windows application which never has been (and probably never will be) ported to another operating System, because it had fallen victim to a leaky or nonexistent encapsulation of WinAPI.
In my last post I have written about braced-or-equal-initializers for class members, a feature that enables simpler constructors through default values for members. Today’s post is about two related features that can simplify the writing of constructors even further.
One of the less discussed but nevertheless useful features in C++11 is the possibility to provide initializers for class members right in the class definition.