I have a class Bar
which implements a move constructor.
For an instance Bar b
, if I call void fooRvalRef(Bar&&)
using fooRvalRef(std::move(b))
then the move constructor of Bar is not called.
On the other hand for the function void foo(Bar)
, calling it using foo(std::move(b))
calls the move constructor of Bar.
Why is that?