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.

Lvalue to rvalue reference binding

The compiler keeps complaining I'm trying to bind an lvalue to an rvalue reference, but I cannot see how. I'm …

c++ c++11 move-semantics rvalue-reference
Move semantics when sending object as function's parameter

I'm playing with move constructors and move assignments and i've stumbled on this problem. First code: #include <iostream> #…

c++ c++11 move-semantics move-constructor
Proper way (move semantics) to return a std::vector from function calling in C++11

I want to fill std::vector (or some other STL container): class Foo { public: Foo(int _n, const Bar &_…

c++ stl c++11 move-semantics return-value-optimization
Move or Named Return Value Optimization (NRVO)?

Lets say we have the following code: std::vector<int> f() { std::vector<int> y; ... return …

c++ optimization c++11 move-semantics return-value-optimization
initializer_list and move semantics

Am I allowed to move elements out of a std::initializer_list<T>? #include <initializer_list> #…

c++ templates c++11 move-semantics initializer-list
How to enforce move semantics when a vector grows?

I have a std::vector of objects of a certain class A. The class is non-trivial and has copy constructors …

c++ vector c++11 resize move-semantics
Is the pass-by-value-and-then-move construct a bad idiom?

Since we have move semantics in C++, nowadays it is usual to do void set_a(A a) { _a = std::…

c++ c++11 move-semantics pass-by-value rvalue-reference
Why does moving a pointer variable not set it to null?

When implementing move constructors and move assignment operators, one often writes code like this: p = other.p; other.p = 0; The …

c++ pointers null c++11 move-semantics
Is specializing std::swap deprecated now that we have move semantics?

Possible Duplicate: Move semantics == custom swap function obsolete? This is how std::swap looks like in C++11: template<typename …

c++ templates c++11 swap move-semantics
Move constructor on derived object

When you have a derived object with a move constructor, and the base object also has move semantics, what is …

c++ c++11 move-semantics