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.

Cannot move out of borrowed content when trying to transfer ownership

I'm writing a linked list to wrap my head around Rust lifetimes, ownership and references. I have the following code: …

reference rust move-semantics borrow-checker
Default move constructor/assignment and deleted copy constructor/assignment

According to the standard, If the definition of a class X does not explicitly declare a move constructor, one will …

c++ move-semantics deleted-functions
Is std::array movable?

Is std::array movable? In Bjarne Native 2012 presentation slides (slide 41) it lists std::array as one of the only containers …

c++ arrays c++11 move-semantics
Using move semantics with std::pair or std::tuple

Suppose you want to take advantage of move semantics, but one of your movable classes needs to be part of …

c++ c++11 move-semantics std-pair move-constructor
Can modern C++ get you performance for free?

It is sometimes claimed that C++11/14 can get you a performance boost even when merely compiling C++98 code. The justification …

c++ performance c++11 move-semantics c++14
How can a unique_ptr be returned by value without std::move?

std::unique_ptr<int> ptr() { std::unique_ptr<int> p(new int(3)); return p; // Why doesn't …

c++ c++11 move-semantics copy-elision
Const reference VS move semantics

I was wondering in which situations I still need to use const references in parameters since C++11. I don't fully …

c++11 constants move-semantics
Is the default Move constructor defined as noexcept?

It seems that a vector will check if the move constructor is labeled as noexcept before deciding on whether to …

c++ c++11 constructor move-semantics
copy vs std::move for ints

What's difference between default copy and std::move in that example? After move the object is there any dependence between …

c++ c++11 move-semantics
Move Constructors and Static Arrays

I've been exploring the possibilities of Move Constructors in C++, and I was wondering what are some ways of taking …

c++ c++11 rvalue-reference move-semantics move-constructor