std::flat_map<Key,T,Compare,KeyContainer,MappedContainer>::flat_map

Constructs new container adaptor from a variety of data sources and optionally using user supplied comparison function object comp and/or allocator alloc.

# Declarations

flat_map()
: flat_map(key_compare()) { }

(since C++23)

template< class Allocator >
flat_map( const flat_map&, const Allocator& alloc );

(since C++23)

template< class Allocator >
flat_map( flat_map&&, const Allocator& alloc );

(since C++23)

flat_map( key_container_type key_cont, mapped_container_type mapped_cont,
const key_compare& comp = key_compare() );

(since C++23)

template< class Allocator >
flat_map( const key_container_type& key_cont,
const mapped_container_type& mapped_cont,
const Allocator& alloc );

(since C++23)

template< class Allocator >
flat_map( const key_container_type& key_cont,
const mapped_container_type& mapped_cont,
const key_compare& comp, const Allocator& alloc );

(since C++23)

flat_map( std::sorted_unique_t, key_container_type key_cont,
mapped_container_type mapped_cont,
const key_compare& comp = key_compare() );

(since C++23)

template< class Allocator >
flat_map( std::sorted_unique_t, const key_container_type& key_cont,
const mapped_container_type& mapped_cont, const Allocator& alloc );

(since C++23)

template< class Allocator >
flat_map( std::sorted_unique_t, const key_container_type& key_cont,
const mapped_container_type& mapped_cont,
const key_compare& comp, const Allocator& alloc );

(since C++23)

explicit flat_map( const key_compare& comp )
: c(), compare(comp) { }

(since C++23)

template< class Allocator >
flat_map( const key_compare& comp, const Allocator& alloc );

(since C++23)

template< class Allocator >
explicit flat_map( const Allocator& alloc );

(since C++23)

template< class InputIter >
flat_map( InputIter first, InputIter last,
const key_compare& comp = key_compare() )
: c(), compare(comp);

(since C++23)

template< class InputIter, class Allocator >
flat_map( InputIter first, InputIter last,
const key_compare& comp, const Allocator& alloc );

(since C++23)

template< class InputIter, class Allocator >
flat_map( InputIter first, InputIter last, const Allocator& alloc );

(since C++23)

template< container-compatible-range<value_type> R >
flat_map( std::from_range_t, R&& rg, const key_compare& comp )
: flat_map(comp);

(since C++23)

template< container-compatible-range<value_type> R >
flat_map( std::from_range_t fr, R&& rg )
: flat_map(fr, std::forward<R>(rg), key_compare()) { }

(since C++23)

template< container-compatible-range<value_type> R, class Allocator >
flat_map( std::from_range_t, R&& rg, const Allocator& alloc );

(since C++23)

template< container-compatible-range<value_type> R, class Allocator >
flat_map( std::from_range_t, R&& rg, const key_compare& comp,
const Allocator& alloc );

(since C++23)

template< class InputIter >
flat_map( std::sorted_unique_t s, InputIter first, InputIter last,
const key_compare& comp = key_compare() )
: c(), compare(comp);

(since C++23)

template< class InputIter, class Allocator >
flat_map( std::sorted_unique_t s, InputIter first, InputIter last,
const key_compare& comp, const Allocator& alloc );

(since C++23)

template< class InputIter, class Allocator >
flat_map( std::sorted_unique_t s, InputIter first, InputIter last,
const Allocator& alloc );

(since C++23)

flat_map( std::initializer_list<value_type> init,
const key_compare& comp = key_compare() )
: flat_map(init.begin(), init.end(), comp) { }

(since C++23)

template< class Allocator >
flat_map( std::initializer_list<value_type> init, const key_compare& comp,
const Allocator& alloc );

(since C++23)

template< class Allocator >
flat_map( std::initializer_list<value_type> init, const Allocator& alloc );

(since C++23)

flat_map( std::sorted_unique_t s, std::initializer_list<value_type> init,
const key_compare& comp = key_compare() )
: flat_map(s, init.begin(), init.end(), comp) { }

(since C++23)

template< class Allocator >
flat_map( std::sorted_unique_t s, std::initializer_list<value_type> init,
const key_compare& comp, const Allocator& alloc );

(since C++23)

template< class Allocator >
flat_map( std::sorted_unique_t s, std::initializer_list<value_type> init,
const Allocator& alloc );

(since C++23)

# Parameters

# Notes

After container move construction (overload (3)), references, pointers, and iterators (other than the end iterator) to other remain valid, but refer to elements that are now in *this. The current standard makes this guarantee via the blanket statement in [container.reqmts]/67, and a more direct guarantee is under consideration via LWG issue 2321.

# Example

This section is incompleteReason: no example

# See also