In C++11, there are some new container classes in the STL. One that is pretty useful in competitive programming (at least IMO) is unordered_map, which is essentially a hashmap, in which queries and insertions can be made in O(1) time.

For builtin data types, the syntax works pretty much the same as the ordinary map. However, for custom classes and structs, a hash function needs to be defined instead of a custom comparator, as shown in the code below: