This qualifier participates in overload resolution and applies to the implicit object parameter like const and volatile but unlike those two, it does not change the properties of this.
This equivalence is a reflection of the typical implementation, which effectively compiles references into pointers which are implicitly dereferenced at each use.
Also, because the operations on references are so limited, they are much easier to understand than pointers and are more resistant to errors.
While pointers can be made invalid through a variety of mechanisms, ranging from carrying a null value to out-of-bounds arithmetic to illegal casts to producing them from arbitrary integers, a previously valid reference only becomes invalid in two cases: The first is easy to detect automatically if the reference has static scoping, but is still a problem if the reference is a member of a dynamically allocated object; the second is more difficult to detect.
Then, the following call would place 9 in y: However, the following call would give a compiler error, since lvalue reference parameters not qualified with const can only be bound to addressable values: If FFast actually requires its own copy of x that it can modify, it must create a copy explicitly.
While the same technique could be applied using pointers, this would involve modifying every call site of the function to add cumbersome address-of (&) operators to the argument, and would be equally difficult to undo, if the object became smaller later on.
Continuing the relationship between references and pointers (in C++ context), the former exhibit polymorphic capabilities, as one might expect: The source above is valid C++ and generates the following output: