object::operator=

Assignment operators.

Synopsis

object&
operator=(
    object const& other); (1)

object&
operator=(
    object&& other); (2)

object&
operator=(
    std::initializer_list< std::pair< string_view, value_ref > > init); (3)

Description

Replaces the contents of this object.

  • (1) replaces with the copies of the elements of other.

  • (2) takes ownership of other's element storage if *storage() == *other.storage(); otherwise equivalent to (1).

  • (3) replaces with the elements of init.

Complexity

  • (1) linear in size() + other.size().

  • (2) constant if *storage() == *other.storage(); otherwise linear in size() + other.size().

  • (3) average case linear in size() + init.size(), worst case quadratic in init.size().

Exception Safety

  • (1), (3) strong guarantee.

  • (2) no-throw guarantee if *storage() == *other.storage(); otherwise strong guarantee.

Calls to memory_resource::allocate may throw.

Complexity

Parameters

Name Description

other

Another object.

init

The initializer list to copy.