Boost Users :
From: Ion GaztaÃ±aga (igaztanaga_at_[hidden])
Date: 2008-06-24 01:06:31
Jason Sachs wrote:
> Thanks, that helps. I didn't know you could use void_allocators, I thought they
> had to be specific for each allocated type. One question: I noticed in the
> example you posted, that the lifetime of the allocator "alloc_inst"
> equals/exceeds the lifetime of the map and the values that are inserted into the
> map. Is this required, or can the allocator just be a temporary stack variable
> (as follows)?
> char_string key_object(void_allocator(segment.get_segment_manager()));
Just like standard allocators the container makes an internal copy of
the arguments (allocator or comparison function for associative
containers), so you can initialize it with a variable in the stack. The
goal is to create a container in shared memory and it will hold the
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