Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::unordered_map using boost::interprocess::cached_node_allocator compilation failure
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2011-09-15 12:37:59


El 15/09/2011 9:53, Daniel James escribió:
> On 14 September 2011 22:35, Lenny Maiorani<lenny_at_[hidden]> 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<typename T, typename Allocator>
> struct node
> {
> typedef typename
> Allocator::template rebind<node<T> >::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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net