Encabezado de la biblioteca estándar <flat_map> (C++23)
Este encabezado es parte de la biblioteca de contenedores.
Inclusiones | |
(C++20) |
Apoyo para el operador de comparación de tres vías. [editar] |
(C++11) |
Plantilla de clase std::initializer_list. [editar] |
Clases | |
(C++23) |
Adapta dos contenedores para proporcionar una colección de pares clave-valor, ordenados por claves únicas. (plantilla de clase) [editar] |
(C++23) |
Adapta dos contenedores para proporcionar una colección de pares clave-valor, ordenados por claves. (plantilla de clase) [editar] |
| Especializa el rasgo de tipo std::uses_allocator. (plantilla de función) [editar] | |
| Especializa el rasgo de tipo std::uses_allocator. (plantilla de función) [editar] | |
Funciones | |
(C++20) |
Borra todos los elementos que satisfacen un criterio específico. (plantilla de función) [editar] |
(C++20) |
Borra todos los elementos que satisfacen un criterio específico. (plantilla de función) [editar] |
Etiquetas | |
(C++23) |
Indica que los elementos de un rango están ordenados y son únicos. (tag)[editar] |
| Indica que los elementos de un rango están ordenados (no se requiere unicidad). (tag)[editar] | |
Sinopsis
#include <compare> #include <initializer_list> namespace std { // plantilla de clase flat_map template<class Key, class T, class Compare = less<Key>, class KeyContainer = vector<Key>, class MappedContainer = vector<T>> class flat_map; struct sorted_unique_t { explicit sorted_unique_t() = default; }; inline constexpr sorted_unique_t sorted_unique{}; template<class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Allocator> struct uses_allocator<flat_map<Key, T, Compare, KeyContainer, MappedContainer>, Allocator>; // borrado para flat_map template<class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Predicate> constexpr typename flat_map<Key, T, Compare, KeyContainer, MappedContainer>::size_type erase_if(flat_map<Key, T, Compare, KeyContainer, MappedContainer>& c, Predicate pred); // plantilla de clase flat_multimap template<class Key, class T, class Compare = less<Key>, class KeyContainer = vector<Key>, class MappedContainer = vector<T>> class flat_multimap; struct sorted_equivalent_t { explicit sorted_equivalent_t() = default; }; inline constexpr sorted_equivalent_t sorted_equivalent{}; template<class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Allocator> struct uses_allocator<flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>, Allocator>; // borrado para flat_multimap template<class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Predicate> constexpr typename flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>::size_type erase_if(flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>& c, Predicate pred); }
Plantilla de clase std::flat_map
namespace std { template<class Key, class T, class Compare = less<Key>, class KeyContainer = vector<Key>, class MappedContainer = vector<T>> class flat_map { public: // tipos using key_type = Key; using mapped_type = T; using value_type = pair<key_type, mapped_type>; using key_compare = Compare; using reference = pair<const key_type&, mapped_type&>; using const_reference = pair<const key_type&, const mapped_type&>; using size_type = size_t; using difference_type = ptrdiff_t; using iterator = /* definido por la implementación */; using const_iterator = /* definido por la implementación */; using reverse_iterator = std::reverse_iterator<iterator>; using const_reverse_iterator = std::reverse_iterator<const_iterator>; using key_container_type = KeyContainer; using mapped_container_type = MappedContainer; class value_compare { private: key_compare /*comp*/; // solo para exposición constexpr value_compare(key_compare c) : /*comp*/(c) { } // solo para exposición public: constexpr bool operator()(const_reference x, const_reference y) const { return /*comp*/(x.first, y.first); } }; struct containers { key_container_type keys; mapped_container_type values; }; // constructores constexpr flat_map() : flat_map(key_compare()) { } constexpr flat_map(const flat_map&); constexpr flat_map(flat_map&&); constexpr flat_map& operator=(const flat_map&); constexpr flat_map& operator=(flat_map&&); constexpr explicit flat_map(const key_compare& comp) : /*c*/() , /*comparar*/(comp) { } constexpr flat_map(key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); constexpr flat_map(sorted_unique_t, key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); template<class InputIter> constexpr flat_map(InputIter first, InputIter last, const key_compare& comp = key_compare()) : /*c*/() , /*comparar*/(comp) { insert(first, last); } template<class InputIter> constexpr flat_map(sorted_unique_t, InputIter first, InputIter last, const key_compare& comp = key_compare()) : /*c*/() , /*comparar*/(comp) { insert(sorted_unique, first, last); } template<container-compatible-range<value_type> R> constexpr flat_map(from_range_t, R&& rg) : flat_map(from_range, std::forward<R>(rg), key_compare()) { } template<container-compatible-range<value_type> R> constexpr flat_map(from_range_t, R&& rg, const key_compare& comp) : flat_map(comp) { insert_range(std::forward<R>(rg)); } constexpr flat_map(initializer_list<value_type> il, const key_compare& comp = key_compare()) : flat_map(il.begin(), il.end(), comp) { } constexpr flat_map(sorted_unique_t, initializer_list<value_type> il, const key_compare& comp = key_compare()) : flat_map(sorted_unique, il.begin(), il.end(), comp) { } // constructores con asignadores de memoria 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 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); 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); 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 InputIter, class Alloc> constexpr flat_map(InputIter first, InputIter last, const Alloc& a); template<class InputIter, class Alloc> constexpr flat_map(InputIter first, InputIter last, const key_compare& comp, const Alloc& a); template<class InputIter, class Alloc> constexpr flat_map(sorted_unique_t, InputIter first, InputIter last, const Alloc& a); template<class InputIter, class Alloc> constexpr flat_map(sorted_unique_t, InputIter first, InputIter last, const key_compare& comp, const Alloc& a); template<container-compatible-range<value_type> R, class Alloc> constexpr flat_map(from_range_t, R&& rg, const Alloc& a); template<container-compatible-range<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); constexpr flat_map& operator=(initializer_list<value_type>); // iteradores constexpr iterator begin() noexcept; constexpr const_iterator begin() const noexcept; constexpr iterator end() noexcept; constexpr const_iterator end() const noexcept; constexpr reverse_iterator rbegin() noexcept; constexpr const_reverse_iterator rbegin() const noexcept; constexpr reverse_iterator rend() noexcept; constexpr const_reverse_iterator rend() const noexcept; constexpr const_iterator cbegin() const noexcept; constexpr const_iterator cend() const noexcept; constexpr const_reverse_iterator crbegin() const noexcept; constexpr const_reverse_iterator crend() const noexcept; // capacidad constexpr bool empty() const noexcept; constexpr size_type size() const noexcept; constexpr size_type max_size() const noexcept; // acceso a elementos constexpr mapped_type& operator[](const key_type& x); constexpr mapped_type& operator[](key_type&& x); template<class K> constexpr mapped_type& operator[](K&& x); constexpr mapped_type& at(const key_type& x); constexpr const mapped_type& at(const key_type& x) const; template<class K> constexpr mapped_type& at(const K& x); template<class K> constexpr const mapped_type& at(const K& x) const; // modificadores template<class... Args> constexpr pair<iterator, bool> emplace(Args&&... args); template<class... Args> constexpr iterator emplace_hint(const_iterator position, Args&&... args); constexpr pair<iterator, bool> insert(const value_type& x) { return emplace(x); } constexpr pair<iterator, bool> insert(value_type&& x) { return emplace(std::move(x)); } constexpr iterator insert(const_iterator position, const value_type& x) { return emplace_hint(position, x); } constexpr iterator insert(const_iterator position, value_type&& x) { return emplace_hint(position, std::move(x)); } template<class P> constexpr pair<iterator, bool> insert(P&& x); template<class P> constexpr iterator insert(const_iterator position, P&&); template<class InputIter> constexpr void insert(InputIter first, InputIter last); template<class InputIter> constexpr void insert(sorted_unique_t, InputIter first, InputIter last); template<container-compatible-range<value_type> R> constexpr void insert_range(R&& rg); template<container-compatible-range<value_type> R> constexpr void insert_range(sorted_unique_t, R&& rg); constexpr void insert(initializer_list<value_type> il) { insert(il.begin(), il.end()); } constexpr void insert(sorted_unique_t, initializer_list<value_type> il) { insert(sorted_unique, il.begin(), il.end()); } constexpr containers extract() &&; constexpr void replace(key_container_type&& key_cont, mapped_container_type&& mapped_cont); template<class... Args> constexpr pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); template<class... Args> constexpr pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); template<class K, class... Args> constexpr pair<iterator, bool> try_emplace(K&& k, Args&&... args); template<class... Args> constexpr iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); template<class... Args> constexpr iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); template<class K, class... Args> constexpr iterator try_emplace(const_iterator hint, K&& k, Args&&... args); template<class M> constexpr pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); template<class M> constexpr pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); template<class K, class M> constexpr pair<iterator, bool> insert_or_assign(K&& k, M&& obj); template<class M> constexpr iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); template<class M> constexpr iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); template<class K, class M> constexpr iterator insert_or_assign(const_iterator hint, K&& k, M&& obj); constexpr iterator erase(iterator position); constexpr iterator erase(const_iterator position); constexpr size_type erase(const key_type& x); template<class K> constexpr size_type erase(K&& x); constexpr iterator erase(const_iterator first, const_iterator last); constexpr void swap(flat_map& y) noexcept(/* see description */); constexpr void clear() noexcept; // observadores constexpr key_compare key_comp() const; constexpr value_compare value_comp() const; constexpr const key_container_type& keys() const noexcept { return /*c*/.keys; } constexpr const mapped_container_type& values() const noexcept { return /*c*/.values; } // operaciones de mapa constexpr iterator find(const key_type& x); constexpr const_iterator find(const key_type& x) const; template<class K> constexpr iterator find(const K& x); template<class K> constexpr const_iterator find(const K& x) const; constexpr size_type count(const key_type& x) const; template<class K> constexpr size_type count(const K& x) const; constexpr bool contains(const key_type& x) const; template<class K> constexpr bool contains(const K& x) const; constexpr iterator lower_bound(const key_type& x); constexpr const_iterator lower_bound(const key_type& x) const; template<class K> constexpr iterator lower_bound(const K& x); template<class K> constexpr const_iterator lower_bound(const K& x) const; constexpr iterator upper_bound(const key_type& x); constexpr const_iterator upper_bound(const key_type& x) const; template<class K> constexpr iterator upper_bound(const K& x); template<class K> constexpr const_iterator upper_bound(const K& x) const; constexpr pair<iterator, iterator> equal_range(const key_type& x); constexpr pair<const_iterator, const_iterator> equal_range(const key_type& x) const; template<class K> constexpr pair<iterator, iterator> equal_range(const K& x); template<class K> constexpr pair<const_iterator, const_iterator> equal_range(const K& x) const; friend constexpr bool operator==(const flat_map& x, const flat_map& y); friend constexpr /*result-sint-de-tres-vías*/<value_type> operator<=>( const flat_map& x, const flat_map& y); friend constexpr void swap(flat_map& x, flat_map& y) noexcept(noexcept(x.swap(y))) { x.swap(y); } private: containers /*c*/; // solo para exposición key_compare /*comparar*/; // solo para exposición struct /*equiv-de-clave*/ { // solo para exposición constexpr /*equiv-de-clave*/(key_compare c) : comp(c) { } constexpr bool operator()(const_reference x, const_reference y) const { return !comp(x.first, y.first) && !comp(y.first, x.first); } key_compare comp; }; }; template<class KeyContainer, class MappedContainer, class Compare = less<typename KeyContainer::value_type>> flat_map(KeyContainer, MappedContainer, Compare = Compare()) -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Allocator> flat_map(KeyContainer, MappedContainer, Allocator) -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type, less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Compare, class Allocator> flat_map(KeyContainer, MappedContainer, Compare, Allocator) -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Compare = less<typename KeyContainer::value_type>> flat_map(sorted_unique_t, KeyContainer, MappedContainer, Compare = Compare()) -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Allocator> flat_map(sorted_unique_t, KeyContainer, MappedContainer, Allocator) -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type, less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Compare, class Allocator> flat_map(sorted_unique_t, KeyContainer, MappedContainer, Compare, Allocator) -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class InputIter, class Compare = less</*tipo-de-clave-del-iter*/<InputIter>>> flat_map(InputIter, InputIter, Compare = Compare()) -> flat_map</*tipo-de-clave-del-iter*/<InputIter>, /*tipo-mapeado-por-iter*/<InputIter>, Compare>; template<class InputIter, class Compare = less</*tipo-de-clave-del-iter*/<InputIter>>> flat_map(sorted_unique_t, InputIter, InputIter, Compare = Compare()) -> flat_map</*tipo-de-clave-del-iter*/<InputIter>, /*tipo-mapeado-por-iter*/<InputIter>, Compare>; template<ranges::input_range R, class Compare = less</*tipo-de-clave-del-rango*/<R>>, class Allocator = allocator<byte>> flat_map(from_range_t, R&&, Compare = Compare(), Allocator = Allocator()) -> flat_map< /*tipo-de-clave-del-rango*/<R>, /*tipo-mapeado-del-rango*/<R>, Compare, vector</*tipo-de-clave-del-rango*/<R>, /*revinculación-del-asignador*/<Allocator, /*tipo-de-clave-del-rango*/<R>>>, vector</*tipo-mapeado-del-rango*/<R>, /*revinculación-del-asignador*/<Allocator, /*tipo-mapeado-del-rango*/<R>>>>; template<ranges::input_range R, class Allocator> flat_map(from_range_t, R&&, Allocator) -> flat_map< /*tipo-de-clave-del-rango*/<R>, /*tipo-mapeado-del-rango*/<R>, less</*tipo-de-clave-del-rango*/<R>>, vector</*tipo-de-clave-del-rango*/<R>, /*revinculación-del-asignador*/<Allocator, /*tipo-de-clave-del-rango*/<R>>>, vector</*tipo-mapeado-del-rango*/<R>, /*revinculación-del-asignador*/<Allocator, /*tipo-mapeado-del-rango*/<R>>>>; template<class Key, class T, class Compare = less<Key>> flat_map(initializer_list<pair<Key, T>>, Compare = Compare()) -> flat_map<Key, T, Compare>; template<class Key, class T, class Compare = less<Key>> flat_map(sorted_unique_t, initializer_list<pair<Key, T>>, Compare = Compare()) -> flat_map<Key, T, Compare>; template<class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Allocator> struct uses_allocator<flat_map<Key, T, Compare, KeyContainer, MappedContainer>, Allocator> : bool_constant<uses_allocator_v<KeyContainer, Allocator> && uses_allocator_v<MappedContainer, Allocator>> {}; }
Plantilla de clase std::flat_multimap
namespace std { template<class Key, class T, class Compare = less<Key>, class KeyContainer = vector<Key>, class MappedContainer = vector<T>> class flat_multimap { public: // tipos using key_type = Key; using mapped_type = T; using value_type = pair<key_type, mapped_type>; using key_compare = Compare; using reference = pair<const key_type&, mapped_type&>; using const_reference = pair<const key_type&, const mapped_type&>; using size_type = size_t; using difference_type = ptrdiff_t; using iterator = /* definido por la implementación */; using const_iterator = /* definido por la implementación */; using reverse_iterator = std::reverse_iterator<iterator>; using const_reverse_iterator = std::reverse_iterator<const_iterator>; using key_container_type = KeyContainer; using mapped_container_type = MappedContainer; class value_compare { private: key_compare /*comp*/; // solo para exposición constexpr value_compare(key_compare c) : /*comp*/(c) { } // solo para exposición public: constexpr bool operator()(const_reference x, const_reference y) const { return /*comp*/(x.first, y.first); } }; struct containers { key_container_type keys; mapped_container_type values; }; // constructores constexpr flat_multimap() : flat_multimap(key_compare()) { } constexpr flat_multimap(const flat_multimap&); constexpr flat_multimap(flat_multimap&&); constexpr flat_multimap& operator=(const flat_multimap&); constexpr flat_multimap& operator=(flat_multimap&&); constexpr explicit flat_multimap(const key_compare& comp) : /*c*/() , /*comparar*/(comp) { } constexpr flat_multimap(key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); constexpr flat_multimap(sorted_equivalent_t, key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); template<class InputIter> constexpr flat_multimap(InputIter first, InputIter last, const key_compare& comp = key_compare()) : /*c*/() , /*comparar*/(comp) { insert(first, last); } template<class InputIter> constexpr flat_multimap(sorted_equivalent_t, InputIter first, InputIter last, const key_compare& comp = key_compare()) : /*c*/() , /*comparar*/(comp) { insert(sorted_equivalent, first, last); } template<container-compatible-range<value_type> R> constexpr flat_multimap(from_range_t, R&& rg) : flat_multimap(from_range, std::forward<R>(rg), key_compare()) { } template<container-compatible-range<value_type> R> constexpr flat_multimap(from_range_t, R&& rg, const key_compare& comp) : flat_multimap(comp) { insert_range(std::forward<R>(rg)); } constexpr flat_multimap(initializer_list<value_type> il, const key_compare& comp = key_compare()) : flat_multimap(il.begin(), il.end(), comp) { } constexpr flat_multimap(sorted_equivalent_t, initializer_list<value_type> il, const key_compare& comp = key_compare()) : flat_multimap(sorted_equivalent, il.begin(), il.end(), comp) { } // constructores con asignadores de memoria template<class Alloc> constexpr explicit flat_multimap(const Alloc& a); template<class Alloc> constexpr flat_multimap(const key_compare& comp, const Alloc& a); template<class Alloc> constexpr flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, const Alloc& a); template<class Alloc> constexpr flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, const key_compare& comp, const Alloc& a); template<class Alloc> constexpr flat_multimap(sorted_equivalent_t, const key_container_type& key_cont, const mapped_container_type& mapped_cont, const Alloc& a); template<class Alloc> constexpr flat_multimap(sorted_equivalent_t, const key_container_type& key_cont, const mapped_container_type& mapped_cont, const key_compare& comp, const Alloc& a); template<class Alloc> constexpr flat_multimap(const flat_multimap&, const Alloc& a); template<class Alloc> constexpr flat_multimap(flat_multimap&&, const Alloc& a); template<class InputIter, class Alloc> constexpr flat_multimap(InputIter first, InputIter last, const Alloc& a); template<class InputIter, class Alloc> constexpr flat_multimap(InputIter first, InputIter last, const key_compare& comp, const Alloc& a); template<class InputIter, class Alloc> constexpr flat_multimap(sorted_equivalent_t, InputIter first, InputIter last, const Alloc& a); template<class InputIter, class Alloc> constexpr flat_multimap(sorted_equivalent_t, InputIter first, InputIter last, const key_compare& comp, const Alloc& a); template<container-compatible-range<value_type> R, class Alloc> constexpr flat_multimap(from_range_t, R&& rg, const Alloc& a); template<container-compatible-range<value_type> R, class Alloc> constexpr flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); template<class Alloc> constexpr flat_multimap(initializer_list<value_type> il, const Alloc& a); template<class Alloc> constexpr flat_multimap(initializer_list<value_type> il, const key_compare& comp, const Alloc& a); template<class Alloc> constexpr flat_multimap(sorted_equivalent_t, initializer_list<value_type> il, const Alloc& a); template<class Alloc> constexpr flat_multimap(sorted_equivalent_t, initializer_list<value_type> il, const key_compare& comp, const Alloc& a); flat_multimap& operator=(initializer_list<value_type>); // iteradores constexpr iterator begin() noexcept; constexpr const_iterator begin() const noexcept; constexpr iterator end() noexcept; constexpr const_iterator end() const noexcept; constexpr reverse_iterator rbegin() noexcept; constexpr const_reverse_iterator rbegin() const noexcept; constexpr reverse_iterator rend() noexcept; constexpr const_reverse_iterator rend() const noexcept; constexpr const_iterator cbegin() const noexcept; constexpr const_iterator cend() const noexcept; constexpr const_reverse_iterator crbegin() const noexcept; constexpr const_reverse_iterator crend() const noexcept; // capacidad constexpr bool empty() const noexcept; constexpr size_type size() const noexcept; constexpr size_type max_size() const noexcept; // modificadores template<class... Args> constexpr iterator emplace(Args&&... args); template<class... Args> constexpr iterator emplace_hint(const_iterator position, Args&&... args); constexpr iterator insert(const value_type& x) { return emplace(x); } constexpr iterator insert(value_type&& x) { return emplace(std::move(x)); } constexpr iterator insert(const_iterator position, const value_type& x) { return emplace_hint(position, x); } constexpr iterator insert(const_iterator position, value_type&& x) { return emplace_hint(position, std::move(x)); } template<class P> constexpr iterator insert(P&& x); template<class P> constexpr iterator insert(const_iterator position, P&&); template<class InputIter> constexpr void insert(InputIter first, InputIter last); template<class InputIter> constexpr void insert(sorted_equivalent_t, InputIter first, InputIter last); template<container-compatible-range<value_type> R> constexpr void insert_range(R&& rg); template<container-compatible-range<value_type> R> constexpr void insert_range(sorted_equivalent_t, R&& rg); constexpr void insert(initializer_list<value_type> il) { insert(il.begin(), il.end()); } constexpr void insert(sorted_equivalent_t, initializer_list<value_type> il) { insert(sorted_equivalent, il.begin(), il.end()); } constexpr containers extract() &&; constexpr void replace(key_container_type&& key_cont, mapped_container_type&& mapped_cont); constexpr iterator erase(iterator position); constexpr iterator erase(const_iterator position); constexpr size_type erase(const key_type& x); template<class K> constexpr size_type erase(K&& x); constexpr iterator erase(const_iterator first, const_iterator last); constexpr void swap(flat_multimap&) noexcept( is_nothrow_swappable_v<key_container_type>&& is_nothrow_swappable_v< mapped_container_type>&& is_nothrow_swappable_v<key_compare>); constexpr void clear() noexcept; // observadores constexpr key_compare key_comp() const; constexpr value_compare value_comp() const; constexpr const key_container_type& keys() const noexcept { return /*c*/.keys; } constexpr const mapped_container_type& values() const noexcept { return /*c*/.values; } // operaciones de mapa constexpr iterator find(const key_type& x); constexpr const_iterator find(const key_type& x) const; template<class K> constexpr iterator find(const K& x); template<class K> constexpr const_iterator find(const K& x) const; constexpr size_type count(const key_type& x) const; template<class K> constexpr size_type count(const K& x) const; constexpr bool contains(const key_type& x) const; template<class K> constexpr bool contains(const K& x) const; constexpr iterator lower_bound(const key_type& x); constexpr const_iterator lower_bound(const key_type& x) const; template<class K> constexpr iterator lower_bound(const K& x); template<class K> constexpr const_iterator lower_bound(const K& x) const; constexpr iterator upper_bound(const key_type& x); constexpr const_iterator upper_bound(const key_type& x) const; template<class K> constexpr iterator upper_bound(const K& x); template<class K> constexpr const_iterator upper_bound(const K& x) const; constexpr pair<iterator, iterator> equal_range(const key_type& x); constexpr pair<const_iterator, const_iterator> equal_range(const key_type& x) const; template<class K> constexpr pair<iterator, iterator> equal_range(const K& x); template<class K> constexpr pair<const_iterator, const_iterator> equal_range(const K& x) const; friend constexpr bool operator==(const flat_multimap& x, const flat_multimap& y); friend constexpr /*result-sint-de-tres-vías*/<value_type> operator<=>( const flat_multimap& x, const flat_multimap& y); friend constexpr void swap(flat_multimap& x, flat_multimap& y) noexcept(noexcept(x.swap(y))) { x.swap(y); } private: containers /*c*/; // solo para exposición key_compare /*comparar*/; // solo para exposición }; template<class KeyContainer, class MappedContainer, class Compare = less<typename KeyContainer::value_type>> flat_multimap(KeyContainer, MappedContainer, Compare = Compare()) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Allocator> flat_multimap(KeyContainer, MappedContainer, Allocator) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Compare, class Allocator> flat_multimap(KeyContainer, MappedContainer, Compare, Allocator) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Compare = less<typename KeyContainer::value_type>> flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Compare = Compare()) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Allocator> flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Allocator) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Compare, class Allocator> flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Compare, Allocator) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class InputIter, class Compare = less</*tipo-de-clave-del-iter*/<InputIter>>> flat_multimap(InputIter, InputIter, Compare = Compare()) -> flat_multimap</*tipo-de-clave-del-iter*/<InputIter>, /*tipo-mapeado-por-iter*/<InputIter>, Compare>; template<class InputIter, class Compare = less</*tipo-de-clave-del-iter*/<InputIter>>> flat_multimap(sorted_equivalent_t, InputIter, InputIter, Compare = Compare()) -> flat_multimap</*tipo-de-clave-del-iter*/<InputIter>, /*tipo-mapeado-por-iter*/<InputIter>, Compare>; template<ranges::input_range R, class Compare = less</*tipo-de-clave-del-rango*/<R>>, class Allocator = allocator<byte>> flat_multimap(from_range_t, R&&, Compare = Compare(), Allocator = Allocator()) -> flat_multimap< /*tipo-de-clave-del-rango*/<R>, /*tipo-mapeado-del-rango*/<R>, Compare, vector</*tipo-de-clave-del-rango*/<R>, /*revinculación-del-asignador*/<Allocator, /*tipo-de-clave-del-rango*/<R>>>, vector</*tipo-mapeado-del-rango*/<R>, /*revinculación-del-asignador*/<Allocator, /*tipo-mapeado-del-rango*/<R>>>>; template<ranges::input_range R, class Allocator> flat_multimap(from_range_t, R&&, Allocator) -> flat_multimap< /*tipo-de-clave-del-rango*/<R>, /*tipo-mapeado-del-rango*/<R>, less</*tipo-de-clave-del-rango*/<R>>, vector</*tipo-de-clave-del-rango*/<R>, /*revinculación-del-asignador*/<Allocator, /*tipo-de-clave-del-rango*/<R>>>, vector</*tipo-mapeado-del-rango*/<R>, /*revinculación-del-asignador*/<Allocator, /*tipo-mapeado-del-rango*/<R>>>>; template<class Key, class T, class Compare = less<Key>> flat_multimap(initializer_list<pair<Key, T>>, Compare = Compare()) -> flat_multimap<Key, T, Compare>; template<class Key, class T, class Compare = less<Key>> flat_multimap(sorted_equivalent_t, initializer_list<pair<Key, T>>, Compare = Compare()) -> flat_multimap<Key, T, Compare>; template<class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Allocator> struct uses_allocator<flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>, Allocator> : bool_constant<uses_allocator_v<KeyContainer, Allocator> && uses_allocator_v<MappedContainer, Allocator>> {}; }
Referencias
- El estándar C++23 (ISO/IEC 14882:2023):
- 24.6.4 Sinopsis del encabezado
<flat_map>[flat.map.syn]
- 24.6.4 Sinopsis del encabezado
- 24.6.9.2 Definición [flat.map.defn]
- 24.6.10.2 Definición [flat.multimap.defn]