
19 Nov
2008
19 Nov
'08
9:47 p.m.
Michael Goldshteyn wrote:
What is the best way to test for an empty boost::xpressive::regex object?
That is, if I have code like:
boost::xpressive::sregex re;
...
// Test if re is empty and should not be used to perform a regex_search if (?????)
There is, although it's not obvious from the documentation that it's possible. You can see from the postcondition on the default constructor of basic_regex that this->regex_id() == 0 for default-constructed regex objects and != 0 for non-default constructed regex objects. So your test above can be: if( 0 != re.regex_id() ) HTH, -- Eric Niebler BoostPro Computing http://www.boostpro.com