Standard library types
From the standard N4296,§17.6.3.1, let's rv
be an rvalue of type T
,
in Table 20, MoveConstructible requirement and Table 22 MoveAssignable requirement.
After operations:
T(rv);
T u =rv;
u = rv;
rv’s state is unspecified [ Note:rv must still meet the requirements of the library component that is using it. The operations listed in those requirements must work as specified
whether rv has been moved from or not. — end note ]
It means that at least your moved object is still in a valid state and can be used as any object of its type. But nothing more is required as a library wide requirement. You have to read specific documentation.
For shared_ptr specificaly :
shared_ptr(shared_ptr&& r) noexcept;
template<class Y> shared_ptr(shared_ptr<Y>&& r) noexcept;
Remark: The second constructor shall not participate in overload resolution unless Y* is convertible
to T*.
Effects: Move-constructs a shared_ptr instance from r.
Postconditions: *this shall contain the old value of r. r shall be empty. r.get() == nullptr.
Fundamental types and trivially copyables
The moved object should be unchanged. I am looking for the confirmation in the standard...
Other types
At least the programmer of a class shall ensures that an object of this class is destructible after it has been moved!