When a transition assignment operator receives a call
When you assign an rvalue to an object, as in the first example.
and when does the move constructor operator get called?
When you initialize an object using rvalue, as in the second example. Although this is not an operator.
So it is, with what is implemented?
No, it determines whether it can be used, and not when it can be used. For example, if there is no move constructor, then the construct will use the copy constructor if it exists, and otherwise fail (with an error).
And if so, then what happens if both are implemented?
Assignment operator for assignment, constructor for initialization.
And why is it possible to create an overload of an assignment operator in general if it is identical anyway.
It is not identical. It is called on an object that already exists; the constructor is called to initialize an object that did not previously exist. They often have to do different things. For example, an assignment might need to remove something that would not exist during initialization.
source share