This is the move constructor of class X
:
X::X(X&& rhs)
: base1(std::move(rhs))
, base2(std::move(rhs))
, mbr1(std::move(rhs.
No, that would be an example of possible undefined behavior. It might work a lot of the time, but it's not guaranteed to. C++ allows it, but you are the one who has to make sure you don't try to use rhs
again in that way. You are trying to use rhs
three times after its guts had been ripped out its rvalue
reference was passed to a function that might potentially move from it (leaving it in an undefined state).