What does && mean with parameter type in C ++?

Possible duplicate:
What does T&& do in C ++ 0x?

I have never seen a double ampersand before reading this answer .

This piece of code looks like this:

template <typename T> T& as_lvalue(T&& x) { return x; } 

What does && do? What parameters can be passed to as_lvalue()

+8
c ++ reference c ++ 11 rvalue-reference
source share
2 answers

It is called an rvalue reference , and it is new in C ++ 11.

+3
source share

The most common uses are boolean and short circuit.

C ++ 11 uses it for rvalue references. Your example uses this.

+1
source share

All Articles