associative container?

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?

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
> 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.