| Home | Libraries | People | FAQ | More

###### object::object (6 of 11 overloads)

Move constructor.

###### Synopsis

    object(
        object&& other,
        storage_ptr sp);

###### Description

The object is constructed with the contents of `other` by move semantics, using the specified memory resource:

- If `*other.storage() == *sp`, ownership of the underlying memory is transferred in constant time, with no possibility of exceptions. After construction, the moved-from object behaves as if newly constructed with its current storage pointer.
- If `*other.storage() != *sp`, an element-wise copy is performed, which may throw. In this case, the moved-from object is not changed.

###### Complexity

Constant or linear in `other.size()`.

###### Exception Safety

Strong guarantee. Calls to `memory_resource::allocate` may throw.

###### Parameters

Name | Description
--- | ---
`other` | The object to move.
`sp` | A pointer to the `memory_resource` to use. The container will acquire shared ownership of the memory resource.