Boost::regex assign/operator= 'problem'
Should an empty boost::regex raise a 'bad expression' exception when
you assign it to another boost::regex object? It seems to me that an
empty expression can't be bad - it hasn't had the chance to be good OR
bad yet :-)
The rationale for this is that I have an object that contains a
boost::regex that is compiled on demand. The object is likely to be
copied (into a std::vector), before the regex has been compiled (if it
is ever compiled). I know I could use things like
boost::optionalboost::regex, or boost::scoped_ptrboost::regex (I
am working round it currently), but this seems like an interesting
corner case!
Here's a minimal sample:
#include <iostream>
#include
Should an empty boost::regex raise a 'bad expression' exception when you assign it to another boost::regex object? It seems to me that an empty expression can't be bad - it hasn't had the chance to be good OR bad yet :-)
It's basically a bug : and it's fixed in 1.33. Copying will also be a lot less expensive in 1.33 since it uses copy-on-write. John.
On 7/1/05, John Maddock
Should an empty boost::regex raise a 'bad expression' exception when you assign it to another boost::regex object? It seems to me that an empty expression can't be bad - it hasn't had the chance to be good OR bad yet :-)
It's basically a bug : and it's fixed in 1.33. Copying will also be a lot less expensive in 1.33 since it uses copy-on-write.
John.
Cool - thanks! Stuart
participants (2)
-
John Maddock
-
Stuart Dootson