Subject: [boost] Interprocess regexes
From: Mike Spertus (mike_spertus_at_[hidden])
Date: 2009-12-04 11:00:08


I would like to store regexes in shared memory, but it seems like Boost
regex falls just barely short of supporting this.

In the basic_regex documentation, it says "The definition of
basic_regex... is based very closely on class basic_string and fulfils
the requirements for a constant-container of charT." This may be
technically correct, however 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. Since the
allocator would be defaulted to allocator<charT>, I think it would IMO
be compatible with the vast majority of existing code (not quite all
because template<class charT, class traits> void f(basic_regex<charT,
traits>) wouldn't work).

Does this make sense? Do others agree that it would make regexes more
like other strings and containers as advertised?

Thanks,

Mike