As I know std::move
(same as static_cast<T&&>
) casts variable to rvalue and assigns to lvalue, and because of this I think in following code:
int a = 1;
int b = static_cast<int&&>(a);
b
and a
have the same address, but in VS, it prints different addresses.
int a = 1;
int b = static_cast<int&&>(a);
cout << hex << &a << endl;
cout << hex << &b << endl;
If after this a
still points to a different memory location, what is the benefit of using std::move
in this case?