Tell the difference between lvalue and rvalue.
Posted on 2001-07-05
I'd like to overload a function (a constructor in particular), so that it does different things depending on whether you pass it an lvalue or an rvalue. In particular, if its an lvalue, I want the object to be a deep copy of the object which it's being passed, but if its an rvalue, then I just want the object to take on the value of the argument.
This probably wont work though because
A a(b); // will be ambiguous.
What's the correct thing to do in these circumstances?