After reading the previous recipe, some of the readers may start using fast pool allocators everywhere; especially, for
std::map. Well, I'm not going to stop you from doing that, but let's at least take a look at an alternative: flat associative containers. These containers are implemented on top of the traditional vector container and store the values ordered.
Basic knowledge of STL associative containers is required.
The flat containers are part of the
Boost.Container library. We already saw how to use some of its containers in the previous recipes. In this recipe we'll be using a
flat_set associative container:
#include <boost/container/flat_set.hpp> ...