...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
References are functions. They hold a reference to a value stored somewhere. For example, given:
int i = 3; char const* s = "Hello World";
we create references
to
i
and s
this way:
ref(i) ref(s)
Like val
, the expressions
above evaluates to a nullary function; the first one returning an int&
,
and the second one returning a char
const*&
.
(See references.cpp)
Learn more about references here.