i dont really understand r-value reference
Not many people do. Imagine calling a function with a value created like that:
int smt = calcSmt(MyClass(arg));
This way compiler knows that MyClass is a temporary and you don't care what happens with it after the call. So it can call a move constructor with it instead of copy constructor.
With std::move you can tell the compiler "I don't need this variable anymore, you can move it`, then the compiler will treat your variable as a temporary. The tricky part is what will happen to this variable after the call.
- it can keep the same value as earlier (e.g. if you call move on an int, it will be replaced with copy assignment)
- it can be cleared and ready to reuse (it's the case of STL containers)
- it can be in some invalid state, working with which will send your program to UB
The only thing that is guaranteed that this moved object can be correctly destructed