In the presence of rvr, compiler must more carefully choose overloads based on type of argument and type of parameter.
- I think type-of-parameter is the declared type, as programmer wrote it.
No change in c++11. No surprise.
- “argument” means the object. Type-of-argument means…?
- Traditionally it means int vs float
- Traditionally it means const vs non-const
- (Traditionally, it means Acct vs TradingAcct but this is runtime type info, not available at compile time.)
- In c++11, it also means rval-obj vs regular object. You can convert regular object to a rval-object via … move(). But What if argument is a rval-variable, declared as “int&& param” ?
This is one of the trickiest confusions about rvr. The compiler “reasons” differently than a human reasons. [[effModernC++]] tried to explain it on P2 and P162 but I don’t get it.
Yes the ultimate runtime int object is an rval-obj (either naturally-occurring or moved), but when compiler sees the argument is an “int&& param”, compiler treats this argument as lvalue as it has a Location !
My blogpost calling std::move() inside mv-ctor includes my code experiments.