This rule is deprecated, and will eventually be removed.
Why is this an issue?
Rvalue references were introduced as part of C++11. They are thus a new feature of the language, and are not yet widely understood. Using them is
complicated, and code using rvalue references may be difficult to understand.
Noncompliant code example
std::vector<int> return_vector(void)
{
std::vector<int> tmp {1,2,3,4,5};
return tmp;
}
std::vector<int> &&rval_ref = return_vector(); // Noncompliant
Compliant solution
std::vector<int> return_vector(void)
{
std::vector<int> tmp {1,2,3,4,5};
return tmp;
}
const std::vector<int>& rval_ref = return_vector();