
Hi Phil, Phil Endecott <spam_from_boost_dev <at> chezphil.org> writes:
Hi Mike,
Mike Spertus wrote:
basic_string and other containers take an allocator template argument, while basic_regex does not.
If basic_regex had an allocator it would reap all the same benefits that other string and container types do. In particular, it would be possible to use boost::interprocess to place them in shared memory.
IIUC, 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. Is this level of functionality useful to you?
Custom allocators do let multiple processes use the same containers in shared memory, even if they are mapped to different addresses because allocators define a pointer type for the container to use internally. For example, Boost::Interprocess provides an interprocess allocator that uses relative pointers to handle the exact issue you describe. See http://www.boost.org/doc/libs/1_41_0/doc/html/interprocess/allocators_contai... for details. So shared memory STL containers are actually very useful, and we use them extensively in our project to share fully STL-compatible data structures between many processes. The failure to have an allocator in regexes is a big problem for us because configurations (which is what we like to share) often include regular expressions. Mike
Phil.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost