I have read that we should make sure that there are no users of moved-from object before moving it. I want to know why is that so ? Is the moved-from object destroyed after std::move() is called ? if not, What happens to the moved-from object after std::move() is called ?
Asked
Active
Viewed 1,245 times
2
-
Also duplicate of http://stackoverflow.com/q/7930105/1870232 – P0W Nov 04 '14 at 15:07
3 Answers
2
It depends on how the result of std::move()
is used. move
itself does not do anything to the object.

kraskevich
- 18,368
- 4
- 33
- 45
-
Fair point. The statement `std::move(std::string("Hello"));` is legal, but does not move anything. – MSalters Nov 04 '14 at 15:07
0
The object is not destroyed, but it's in a state where the only thing still possible is to destroy it.

MSalters
- 173,980
- 10
- 155
- 350
0
It has to be in a state that is safe to destruct, but, AFAIK, it does not have to be usable for anything else.

ravi
- 10,994
- 1
- 18
- 36