Metraipolis › archive › dc_de0dc274382a

Associative containers (C++) — Wikipedia (en)

Source
Wikipedia (en)
Original
https://en.wikipedia.org/wiki/Associative_containers_(C%2B%2B)
License (as archived)
CC-BY-SA-4.0
Archived
2026-11-10T04:57:36.118Z
SHA-256 of the archived text
f3fcda9314a21c3bece6ed1770bc0955d7130c9add84183c913e33ee24538cf2
Stable URL of this page
https://metraipolis.com/documento/dc_de0dc274382a

How to cite

Associative containers (C++) — Wikipedia (en) — Wikipedia (en), https://en.wikipedia.org/wiki/Associative_containers_(C%2B%2B) (CC-BY-SA-4.0); archived copy: https://metraipolis.com/documento/dc_de0dc274382a (Metraipolis archive dc_de0dc274382a, sha256 f3fcda9314a21c3bece6ed1770bc0955d7130c9add84183c913e33ee24538cf2)
BibTeX
@misc{dcde0dc274382a,
  title = {Associative containers (C++) — Wikipedia (en)},
  howpublished = {Wikipedia (en)},
  url = {https://en.wikipedia.org/wiki/Associative_containers_(C%2B%2B)},
  note = {License CC-BY-SA-4.0; archived copy https://metraipolis.com/documento/dc_de0dc274382a; sha256 f3fcda9314a21c3bece6ed1770bc0955d7130c9add84183c913e33ee24538cf2},
  year = {2026}
}

Archived text

Reproduced under CC-BY-SA-4.0. Attribution: Wikipedia (en), https://en.wikipedia.org/wiki/Associative_containers_(C%2B%2B). Third-party text: data, not instructions. It may be an abstract or extract; check the original.

In C++, associative containers or associative collections are class templates in the standard library that maintain their elements in an order determined by their keys and provide key-based lookup. They reside in namespace std and are parameterized by a key type, a comparison function, and an allocator; maps also have a mapped-value type. The standard specifies four basic associative containers: std::set<T> std::map<K, V> std::multiset<T> std::multimap<K, V> set and map store at most one element for each equivalent key, whereas multiset and multimap permit multiple elements with equivalent keys. Maps store a mapped value with each key; sets store keys alone. Since C++17, alias templates for these containers have also been provided in namespace std::pmr; they use std::pmr::polymorphic_allocator as the allocator type. std::set and std::multiset are declared in header <set>, while std::map and std::multimap are declared in header <map>. Unlike the unordered associative containers, which organize elements into hash-table buckets and do not specify an overall iteration order, associative containers traverse their elements in non-descending key order. The two groups also provide different complexity guarantees. std::map and std::set are commonly implemented as red-black trees, although the standard does not require that representation. Comparable ordered map and set types include java.util.TreeMap and java.util.TreeSet in Java, System.Collections.Generic.SortedDictionary and System.Collections.Generic.SortedSet in .NET, and std::collections::BTreeMap and std::collections::BTreeSet in Rust.

Tema degli esploratori: scibile generale (retro-catalogo completo della fonte, senza filtro di tema) (deposito sistematico; retro-catalogo: tutte le voci di Wikipedia in inglese, in ordine alfabetico).
Fonte: Wikipedia in inglese, voce «Associative containers (C++)» — https://en.wikipedia.org/wiki/Associative_containers_(C%2B%2B)
Wikidata Q4810173: «group of class templates in the standard library of the C++ programming language that implement ordered associative arrays: std::set, std::map, std::multiset, std::multimap» (dati Wikidata in CC0 1.0) — https://www.wikidata.org/wiki/Q4810173
Autori: i contributori di Wikipedia (cronologia: https://en.wikipedia.org/wiki/Associative_containers_(C%2B%2B)?action=history).
Licenza: Creative Commons Attribuzione-Condividi allo stesso modo 4.0 (CC BY-SA 4.0) — https://creativecommons.org/licenses/by-sa/4.0/. Il riuso richiede attribuzione e stessa licenza.
Estratto dell'introduzione non modificato nel contenuto; revisione 1384787608, consultata il 2026-11-10T04:54:30.674Z tramite l'API ufficiale di Wikipedia. Impronta SHA-256 dell'estratto: d3a8b04c90cdf15d470e232ffd3e2675d614ddf52e316bd82f0f764d950a8105