When an ampersand (&) is used in a declaration, just like
Input, it means you're declaring a
reference. References are types that behave like synonyms for existing variables/objects. The variable/object that it's bound to is known as a
referent, and cannot be redirected once bound.
This reference declaration:
...is known as a
R-Value reference, which basically means it's a reference to a variable/object who's state cannot change. However,
R-Value reference has become ambiguous since the release of C++11's
R-Value reference:
|
int &&r_(12); // R-Value reference.
|
This reference declaration:
1 2
|
int a_(0);
int &r_(a_);
|
...is known as a
L-Value reference, which means it's a reference to a variable/object who's state can change.
For more information, see here: http://en.wikipedia.org/wiki/Reference_(C%2B%2B)
Wazzak