Boost logo

Boost :

Subject: Re: [boost] Interprocess regexes
From: John Maddock (john_at_[hidden])
Date: 2009-12-06 04:55:38


>> while the custom allocators let you put std::containers in shared memory
>> they are still not very useful since they can only be used by the process
>> that put them there - other processes will (potentially) see the shared
>> memory at a different address and all the pointers will be wrong
>
> Isn't this *exactly* what the allocator's nested ::pointer type is for?

Maybe, but it's use would be pretty limited. The std lib is entitled to
assume that:

"The typedef members pointer, const_pointer, size_type, and difference_type
are
required to be T*,T const*, size_t, and ptrdiff_t, respectively"

So I wouldn't be able to use any std lib containers within regex if we were
to allow the ::pointer type to be useful :-(

And boost::shared_ptr, while allocating it's memory via an allocator is
completely agnostic about it's type, so I couldn't use any smart pointer
classes either :-(

So... all I would need to do is reimplement the std lib, and shared_ptr
etc... or maybe not!

Which is not to say that having an allocator for other purposes isn't
worthwhile,

Cheers, John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk