Top "Rvalue-reference" questions

An rvalue reference is a new language feature in C++11 representing a reference to an rvalue.

What does T&& (double ampersand) mean in C++11?

I've been looking into some of the new features of C++11 and one I've noticed is the double ampersand in …

c++ c++11 rvalue-reference c++-faq perfect-forwarding
C++11 rvalues and move semantics confusion (return statement)

I'm trying to understand rvalue references and move semantics of C++11. What is the difference between these examples, and which …

c++ c++11 move-semantics rvalue-reference c++-faq
Move capture in lambda

How do I capture by move (also known as rvalue reference) in a C++11 lambda? I am trying to write …

c++ lambda c++11 rvalue-reference
What are the main purposes of using std::forward and which problems it solves?

In perfect forwarding, std::forward is used to convert the named rvalue references t1 and t2 to unnamed rvalue references. …

c++ c++11 rvalue-reference c++-faq perfect-forwarding
Rule-of-Three becomes Rule-of-Five with C++11?

So, after watching this wonderful lecture on rvalue references, I thought that every class would benefit of such a "move …

c++ constructor c++11 rvalue-reference rule-of-three
Is returning by rvalue reference more efficient?

for example: Beta_ab&& Beta::toAB() const { return move(Beta_ab(1, 1)); }

c++ c++11 rvalue-reference
Correct usage of rvalue references as parameters

Let's take the following method as an example: void Asset::Load( const std::string& path ) { // complicated method.... } General use …

c++ c++11 rvalue-reference
How would one call std::forward on all arguments in a variadic function?

I was just writing a generic object factory and using the boost preprocessor meta-library to make a variadic template (using 2010 …

c++ c++11 variadic-templates rvalue-reference perfect-forwarding
C++11 make_pair with specified template parameters doesn't compile

I was just playing around with g++ 4.7 (one of the later snapshots) with -std=c++11 enabled. I tried to compile …

c++ templates g++ c++11 rvalue-reference
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