X is a class
X operator+()
{
X a;
return a;
}
Book iam reading(ivor horton C++)says that when this function is called and the move constructor has been implemented for the class 'X' ,class constructor and move constructor are called. if the move constructor isn't implemented, constructor and copy constructor are called
i feel that because object 'a' is a lvalue copy constructor should be called all the time. move constructor has rvalue reference as parameter so an lvalue can't be passed to it.
can anyone explain why the move construcor is called.