Top "Move-semantics" questions

Move semantics is a programming language feature that allows a copy operation to be replaced by a more efficient "move" when the source object is a temporary or an otherwise expiring object.

Transferring the ownership of object from one unique_ptr to another unique_ptr in C++11?

In C++11 we can transfer the ownership of an object to another unique_ptr using std::move(). After the ownership …

c++ c++11 std move-semantics
Why no default move-assignment/move-constructor?

I'm a simple programmer. My class members variables most often consists of POD-types and STL-containers. Because of this I seldom …

c++ c++11 pod move-semantics
Is a `=default` move constructor equivalent to a member-wise move constructor?

Is this struct Example { int a, b; Example(int mA, int mB) : a{mA}, b{mB} { } Example(const Example& …

c++ c++11 constructor default move-semantics
Using std::move with std::shared_ptr

I have a function defined as follows: void foo(std::shared_ptr<X> x) { ... }; If I declare a …

c++ c++11 shared-ptr move-semantics
Efficiency of C++11 push_back() with std::move versus emplace_back() for already constructed objects

In C++11 emplace_back() is generally preferred (in terms of efficiency) to push_back() as it allows in-place construction, but …

c++11 move-semantics push-back emplace
What is "rvalue reference for *this"?

Came across a proposal called "rvalue reference for *this" in clang's C++11 status page. I've read quite a bit about …

c++ c++11 move-semantics c++-faq qualifiers
Why do you use std::move when you have && in C++11?

Possible Duplicate: What is move semantics? I recently attended a C++11 seminar and the following tidbit of advice was given. …

c++ c++11 move-semantics
What is the advantage of using forwarding references in range-based for loops?

const auto& would suffice if I want to perform read-only operations. However, I have bumped into for (auto&&…

c++ performance for-loop c++11 move-semantics
Why do some people use swap for move assignments?

For example, stdlibc++ has the following: unique_lock& operator=(unique_lock&& __u) { if(_M_owns) unlock(); unique_…

c++ c++11 rvalue-reference move-semantics copy-and-swap
How does std::move() transfer values into RValues?

I just found myself not fully understanding the logic of std::move(). At first, I googled it but seems like …

c++ c++11 move-semantics