You can transform these to
void f(A&);
void f(const A&);
void f(A&);
void f(const A&);
void f(A&&) &&;
void f(const A&&);
The first is special - it is a A&
, but still accepts rvalues, unlike other non-const lvalue references. In all other regards, it is the same as any other function with a A&
parameter.
There is no difference in overload resolution between the second (const
) and the fourth (const&)
, except if they respectively compete against a (&&
). I don't think that can happen for normal functions, but only for conversion functions, because the Standard forbids this case (in general, if there is any function in the current scope with a ref qualifier, all functions must)
void f();
void f() &&;
But with conversion functions, you can still have an overload resolution set with both operator int()
and operator long()&&
. In that case, even if the object on which they are invoked is R()
(an rvalue), if you need to convert to int
then the first conversion function would be used.