[flat.multiset.modifiers]

# 23 Containers library [[containers]](./#containers)

## 23.6 Container adaptors [[container.adaptors]](container.adaptors#flat.multiset.modifiers)

### 23.6.12 Class template flat_multiset [[flat.multiset]](flat.multiset#modifiers)

#### 23.6.12.5 Modifiers [flat.multiset.modifiers]

[ð](#lib:emplace,flat_multiset)

`template<class... Args> constexpr iterator emplace(Args&&... args);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L19954)

*Constraints*: is_constructible_v<value_type, Args...> is true[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L19958)

*Effects*: First, initializes an object t of type value_type with std​::​forward<Args>(args)...,
then inserts t as if by:auto it = ranges::upper_bound(*c*, t, *compare*);*c*.insert(it, std::move(t));

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L19968)

*Returns*: An iterator that points to the inserted element[.](#3.sentence-1)

[ð](#lib:insert,flat_multiset)

`template<class InputIterator>
  constexpr void insert(InputIterator first, InputIterator last);
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L19980)

*Effects*: Adds elements to *c* as if by:*c*.insert(*c*.end(), first, last);

Then, sorts the range of newly inserted elements with respect to *compare*,
and merges the resulting sorted range and
the sorted range of pre-existing elements into a single sorted range[.](#4.sentence-2)

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L19990)

*Complexity*: N + MlogM, where N is size() before the operation and M is distance(first, last)[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L19995)

*Remarks*: Since this operation performs an in-place merge, it may allocate memory[.](#6.sentence-1)

[ð](#lib:insert,flat_multiset_)

`template<class InputIterator>
  constexpr void insert(sorted_equivalent_t, InputIterator first, InputIterator last);
`

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20007)

*Effects*: Equivalent to insert(first, last)[.](#7.sentence-1)

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20011)

*Complexity*: Linear[.](#8.sentence-1)

[ð](#lib:swap,flat_multiset)

`constexpr void swap(flat_multiset& y) noexcept;
`

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20022)

*Effects*: Equivalent to:ranges::swap(*compare*, y.*compare*);
ranges::swap(*c*, y.*c*);

[ð](#lib:extract,flat_multiset)

`constexpr container_type extract() &&;
`

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20037)

*Postconditions*: *this is emptied, even if the function exits via an exception[.](#10.sentence-1)

[11](#11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20041)

*Returns*: std​::​move(*c*)[.](#11.sentence-1)

[ð](#lib:replace,flat_multiset)

`constexpr void replace(container_type&& cont);
`

[12](#12)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20052)

*Preconditions*: The elements of cont are sorted with respect to *compare*[.](#12.sentence-1)

[13](#13)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20056)

*Effects*: Equivalent to: *c* = std​::​move(cont);
