3 ms·
> I'm not sure I would say that "valid" and "useful" are the same. In standardese, they are: an object in a "valid but unspecified state" requires "that the ob
by nemetroid 2y ago
> I'm not sure I would say that "valid" and "useful" are the same.
In standardese, they are: an object in a "valid but unspecified state" requires "that the object’s invariants are met and operations on the object behave as specified for its type"[1]. In other words, any operation without preconditions may be performed.
> Things that must be safe after moving: destructing, assigning. No other operation need make sense.
That's not accurate for standard library types: moved-from objects must be in a "valid but unspecified state"[2].
1: C++23 working draft, 3.66 valid but unspecified state [defns.valid]
2: C++23 working draft, 16.4.6.15 Moved-from state of library types [lib.types.movedfrom]