Files
2025-10-25 03:02:53 +03:00

71 lines
2.3 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[map.cons]
# 23 Containers library [[containers]](./#containers)
## 23.4 Associative containers [[associative]](associative#map.cons)
### 23.4.3 Class template map [[map]](map#cons)
#### 23.4.3.2 Constructors, copy, and assignment [map.cons]
[🔗](#lib:map,constructor)
`constexpr explicit map(const Compare& comp, const Allocator& = Allocator());
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11751)
*Effects*: Constructs an emptymap using the specified comparison object and allocator[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11757)
*Complexity*: Constant[.](#2.sentence-1)
[🔗](#lib:map,constructor_)
`template<class InputIterator>
constexpr map(InputIterator first, InputIterator last,
const Compare& comp = Compare(), const Allocator& = Allocator());
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11770)
*Effects*: Constructs an emptymap using the specified comparison object and allocator,
and inserts elements from the range
[first, last)[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11778)
*Complexity*: Linear in N if the range
[first, last)
is already sorted with respect to comp and otherwise NlogN, where N is last - first[.](#4.sentence-1)
[🔗](#lib:map,constructor__)
`template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<value_type> R>
constexpr map(from_range_t, R&& rg, const Compare& comp = Compare(),
const Allocator& = Allocator());
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11795)
*Effects*: Constructs an empty map using the specified comparison object and allocator,
and inserts elements from the range rg[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11801)
*Complexity*: Linear in N if rg is already sorted with respect to comp and
otherwise NlogN, where N is ranges::distance(rg)[.](#6.sentence-1)