Namespaces
Variants
Actions

std::multimap<Key,T,Compare,Allocator>::operator=

From cppreference.com
< cpp‎ | container‎ | multimap
 
 
 
 
multimap& operator=( const multimap& other );
(1) (constexpr since C++26)
(2)
multimap& operator=( multimap&& other );
(since C++11)
(until C++17)
multimap& operator=( multimap&& other )
    noexcept(/* see below */);
(since C++17)
(constexpr since C++26)
multimap& operator=( std::initializer_list<value_type> ilist );
(3) (since C++11)
(constexpr since C++26)

Replaces the contents of the container.

Let traits be std::allocator_traits<allocator_type>:

1) Copy assignment operator. Replaces the contents with a copy of the contents of other.

If traits::propagate_on_container_copy_assignment::value is true, the allocator of *this is replaced by a copy of other. If the allocator of *this after assignment would compare unequal to its old value, the old allocator is used to deallocate the memory, then the new allocator is used to allocate it before copying the elements. Otherwise, the memory owned by *this may be reused when possible. In any case, the elements originally belonging to *this may be either destroyed or replaced by element-wise copy-assignment.

(since C++11)
2) Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in other is moved from other into this container). other is in a valid but unspecified state afterwards.
If traits::propagate_on_container_move_assignment::value is true, the allocator of *this is replaced by a copy of that of other. If it is false and the allocators of *this and other do not compare equal, *this cannot take ownership of the memory owned by other and must move-assign each element individually, allocating additional memory using its own allocator as needed. In any case, all elements originally belonging to *this are either destroyed or replaced by element-wise move-assignment.
3) Replaces the contents with those identified by initializer list ilist.

Contents