Can anyone recommend a C++ std::map replacement container?

c++, stdmap

Solution

See Loki::AssocVector and/or hash_map (most of STL implementations have this one).

Problem

Maps are great to get things done easily, but they are memory hogs and suffer from caching issues. And when you have a map in a critical loop that can be bad. So I was wondering if anyone can recommend another container that has the same API but uses lets say a vector or hash implementation instead of a tree implementation. My goal here is to swap the containers and not have to rewrite all the user code that relies on the map. Update: performance wise the best solution would be a tested map facade on a std::vector

Original source