The C++ standard defines the following functions deleted;
template <class T>
void ref(const T&&) = delete;
template <class T>
void cref(const T&&) = delete;
This is to aid in ensuring that the functions are not misused by disallowing them from binding to temporary values (rvalues).
- Does
const &&
bind to all rvalues, specifically prvalues? - Would
const &&
bind to all "moved objects" (xvalues; basically something returned fromstd::move
or similar)?
I can reason that it should, but I don't have any "proof" for this.
- Or conversely, are there cases where an rvalue (prvalue or xvalue) will not bind to
const &&
?- If so, how so?
Note: some clarity from the comments, this question is heavily swayed to classic rvalues, the prvalue value category.