El 15/09/2011 9:53, Daniel James escribió:
On 14 September 2011 22:35, Lenny Maiorani
wrote: Hi Boost-ers,
I am trying to create a boost::unordered_map in a boost::interprocess::managed_shared_memory segment. This works fine until I try to change from using boost::interprocess::allocator to boost::interprocess::cached_node_allocator.
It seems that the hash_bucket structure is deferring the key size calculation, but the cached_node_allocator needs the size at compilation time. Any ideas on how to make this work?
Below is a sample attempt which displays my problem along with the GCC output.
The problem is that the unordered containers do something similar to:
template
struct node { typedef typename Allocator::template rebind ::other alloc; typedef typename alloc::pointer; T value; pointer next; };
Maybe using pointer_to_other (with new allocator_traits class in C++11 the work is derived to pointer_traits, which does not require instantiating the allocator, I guess)? Best, Ion