[flat.map.cons.alloc]

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

## 23.6 Container adaptors [[container.adaptors]](container.adaptors#flat.map.cons.alloc)

### 23.6.8 Class template flat_map [[flat.map]](flat.map#cons.alloc)

#### 23.6.8.4 Constructors with allocators [flat.map.cons.alloc]

[1](#1)

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

The constructors in this subclause shall not participate in overload resolution
unless uses_allocator_v<key_container_type, Alloc> is true and uses_allocator_v<mapped_container_type, Alloc> is true[.](#1.sentence-1)

[ð](#lib:flat_map,constructor)

`template<class Alloc>
  constexpr flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont,
                     const Alloc& a);
template<class Alloc>
  constexpr flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont,
                     const key_compare& comp, const Alloc& a);
`

[2](#2)

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

*Effects*: Equivalent to flat_map(key_cont, mapped_cont) andflat_map(key_cont, mapped_cont, comp), respectively,
except that *c*.keys and *c*.values are constructed with
uses-allocator construction ([[allocator.uses.construction]](allocator.uses.construction "20.2.8.2 Uses-allocator construction"))[.](#2.sentence-1)

[3](#3)

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

*Complexity*: Same as flat_map(key_cont, mapped_cont) andflat_map(key_cont, mapped_cont, comp), respectively[.](#3.sentence-1)

[ð](#lib:flat_map,constructor_)

`template<class Alloc>
  constexpr flat_map(sorted_unique_t, const key_container_type& key_cont,
                     const mapped_container_type& mapped_cont, const Alloc& a);
template<class Alloc>
  constexpr flat_map(sorted_unique_t, const key_container_type& key_cont,
                     const mapped_container_type& mapped_cont, const key_compare& comp,
                     const Alloc& a);
`

[4](#4)

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

*Effects*: Equivalent to flat_map(sorted_unique, key_cont, mapped_cont) andflat_map(sorted_unique, key_cont, mapped_cont, comp), respectively,
except that *c*.keys and *c*.values are constructed
with uses-allocator construction ([[allocator.uses.construction]](allocator.uses.construction "20.2.8.2 Uses-allocator construction"))[.](#4.sentence-1)

[5](#5)

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

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

[ð](#lib:flat_map,constructor__)

`template<class Alloc>
  constexpr explicit flat_map(const Alloc& a);
template<class Alloc>
  constexpr flat_map(const key_compare& comp, const Alloc& a);
template<class Alloc>
  constexpr flat_map(const flat_map&, const Alloc& a);
template<class Alloc>
  constexpr flat_map(flat_map&&, const Alloc& a);
template<class InputIterator, class Alloc>
  constexpr flat_map(InputIterator first, InputIterator last, const Alloc& a);
template<class InputIterator, class Alloc>
  constexpr flat_map(InputIterator first, InputIterator last, const key_compare& comp,
                     const Alloc& a);
template<class InputIterator, class Alloc>
  constexpr flat_map(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a);
template<class InputIterator, class Alloc>
  constexpr flat_map(sorted_unique_t, InputIterator first, InputIterator last,
                     const key_compare& comp, const Alloc& a);
template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1 Introduction [container.intro.reqmts]")<value_type> R, class Alloc>
  constexpr flat_map(from_range_t, R&& rg, const Alloc& a);
template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1 Introduction [container.intro.reqmts]")<value_type> R, class Alloc>
  constexpr flat_map(from_range_t, R&& rg, const key_compare& comp, const Alloc& a);
template<class Alloc>
  constexpr flat_map(initializer_list<value_type> il, const Alloc& a);
template<class Alloc>
  constexpr flat_map(initializer_list<value_type> il, const key_compare& comp, const Alloc& a);
template<class Alloc>
  constexpr flat_map(sorted_unique_t, initializer_list<value_type> il, const Alloc& a);
template<class Alloc>
  constexpr flat_map(sorted_unique_t, initializer_list<value_type> il,
                     const key_compare& comp, const Alloc& a);
`

[6](#6)

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

*Effects*: Equivalent to the corresponding non-allocator constructors
except that *c*.keys and *c*.values are constructed
with uses-allocator construction ([[allocator.uses.construction]](allocator.uses.construction "20.2.8.2 Uses-allocator construction"))[.](#6.sentence-1)
