Expressions (EXP) - EXP63-CPP. Do not rely on the value of a moved-from object
SEI CERT C++ CODING STANDARD (2016 EDITION) | V01 148
Software Engineering Institute | Carnegie Mellon University
[DISTRIBUTION STATEMENT A] Approved for public release and unlimited distribution.
Type Functionality Moved-from State
std::weak_ptr
Move construction, Move assignment,
"Converting" move construction, "Con-
verting" move assignment
The moved-from object shall be "empty,"
per [util.smartptr.weak.const], paragraph
8, and [util.smartptr.weak.assign] , para-
std::basic_ios move()
The moved-from object is still left in an un-
specified state, except that rdbuf() shall
return the same value as it returned be-
fore the move, and tie() shall return 0,
per [basic.ios.members], paragraph 20.
std::basic_filebuf
Move constructor, Move assignment
The moved-from object is guaranteed to
reference no file; other internal state is
also affected, per [filebuf.cons], para-
graphs 3 and 4, and [filebuf.assign], para-
std::thread
Move constructor, Move assignment
The result from calling get_id() on the
moved-from object is guaranteed to re-
main unchanged; otherwise the object is
in an unspecified state, per
[thread.thread.constr], paragraph 11 and
[thread.thread.assign], paragraph 2.
std::unique_lock
Move constructor, Move assignment
The moved-from object is guaranteed to
be in its default state, per
[thread.lock.unique.cons], paragraphs 21
std::shared_lock
Move constructor, Move assignment
The moved-from object is guaranteed to
be in its default state, per
[thread.lock.shared.cons], paragraphs 21
std::promise
Move constructor, Move assignment
The moved-from object is guaranteed not
to have any shared state, per [fu-
tures.promise], paragraphs 6 and 8.
std::future
Move constructor, Move assignment
Calling valid() on the moved-from ob-
ject is guaranteed to return false, per
[futures.unique_future], paragraphs 8 and
std::shared_future
Move constructor, Move assignment,
"Converting" move constructor, "Con-
verting" move assignment
Calling valid() on the moved-from ob-
ject is guaranteed to return false, per
[futures.shared_future], paragraphs 8 and
std::packaged_task
Move constructor, Move assignment
The moved-from object is guaranteed not
to have any shared state, per [fu-
ture.task.members], paragraphs 7 and 8.