The ordered and unordered map containers (std::map and std::unordered map) are included in the standard library.
The items in an ordered map are sorted by key, and insert and access are in O (log n).
For ordered maps, the standard library often use red black trees.
However, this is only an implementation detail.
Insert and access are in O in an unordered map (1).
It is simply another term for a hashtable.
An illustration using (ordered) std::map:
int main(int argc, char **argv)
std::map<std::string, int> m;
m["hello"] = 23;
// check if key is present
if (m.find("world") != m.end())
std::cout << "map contains key world!\n";
std::cout << m["hello"] << '\n';
std::map<std::string, int>::iterator i = m.find("hello");
assert(i != m.end());
std::cout << "Key: " << i->first << " Value: " << i->second << '\n';
Key: hello Value: 23
If you require ordering in your container and don't mind the O(log n) runtime, use std::map.