I came across Scott Myers article on universal links, link .
From what I understood the universal link, that is, some type T&&may mean the type rvalue or lvalue in different contexts.
For example:
template<typename T>
void f(T&& param);
In the above example, depending on the template parameter, it T&&can be either lvalue or rvalue, i.e. it depends on what we callf
int x = 10;
f(x);
f(10);
However, according to Scott, if we apply constto the above example, the type is T&&always rvalue:
template<typename T>
void f(const T&& param);
Quote from the article:
Even a simple addition to the const specifier is enough to disable the interpretation of & & as a universal reference:
:
const "" rvalue?
, , :
template<typename T>
void f(const T&& param);
int x = 10;
f(x);
f(10);