Move safety - know what can be done in the moved-from state--Jonathan Müller

What state is an object after move?

Move safety - know what can be done in the moved-from state

by Jonathan Müller

From the article:

C++ programmers have this notion of exception safety. It is a very useful concept. With it one can easily describe the post-conditions of a function if it throws.

There is another situation where you need to easily describe some post-conditions: when talking about the state of an object after a move operation, i.e. after a move constructor or move assignment operator. I thus want to introduce vocabulary for those post-conditions of the right-hand argument similar to the exception safety of a function: The move safety, if you will.

The exception safety describes the post-conditions of a function if the function throws an exception. Similarly, the move safety describes the post-conditions of the object after a move operation. It thus gives information about what can be done safely with a moved-from object...

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.