I am working on improving the performance of a program which uses both the Boost Graph Library and boost::bimap
. Profiling revealed that most of the time was being spent in memory allocation and deallocation. Making the adjacency_list
class of the graph library use boost::fast_pool_allocator
improved performance significantly. A large chunk of the remaining memory allocations occur in boost::bimap
, so I wanted to experiment with using a custom allocator there as well. The documentation says you can specify the allocator as the last template parameter of the bimap, but it does not say what type the template argument to the allocator itself should be. For example, for types X
and Y
, in
boost::bimap<set_of<X>, set_of<Y>, boost::fast_pool_allocator<Z> >
what should be filled in for Z
?
I believe the answer is that for Z
, you should fill in std::pair<X,Y>
. This worked in my case, but I wanted to post here because