cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
associative container?
associative container?
Feb 21, 2021 at 3:22am UTC
DonnaPin
(154)
What actually is an associative container, what makes it one? Is it just if there is a key value pair? Is it anything to do with how it is stored in memory? I can not find anywhere that just simply explains what it is?
Feb 21, 2021 at 3:53am UTC
deleted account xyzzy
(5768)
https://www.geeksforgeeks.org/sequence-vs-associative-containers-cpp/
https://stackoverflow.com/questions/20097551/what-is-an-associative-container
Feb 21, 2021 at 6:14am UTC
mbozzi
(3933)
In strictly C++ terms, any type which meets certain formal requirements is an associative container:
https://en.cppreference.com/w/cpp/named_req/AssociativeContainer
But intuitively it meets the requirements if there's a key-value pair involved.
Last edited on
Feb 21, 2021 at 6:16am UTC
Feb 21, 2021 at 10:25am UTC
JLBorges
(13770)
> Is it just if there is a key value pair?
Often, key value pairs, but could also it could also be just keys (as in sets).
Succinctly, associative containers provide "fast" retrieval of data based on "keys".
https://eel.is/c++draft/associative.reqmts
Topic archived. No new replies allowed.