Jesse Williamson wrote:
Hi, folks!
This program suprises me by causing a runtime assertion:
===== #include <string> #include
using namespace boost::xpressive;
int main() { std::string x("a\tb\tc");
sregex_token_iterator cur(x.begin(), x.end(), as_xpr("\t"), -1), end; for(; cur != end; ++cur) ; } ===== <snip>
Interesting. Currently the regex iterators hold a (bare) pointer to the regex to be used. If you pass in a temporary regex, it'll obviously not live long enough. It wouldn't be hard to make the regex iterators hold a reference count to the regex impl, which would make your code work. The down-side would be that copying regex iterators (a common operation?) would be more expensive. Thanks for the report. While I ruminate about it, could you could file a bug on our bug tracker? (Click the "New Ticket" link at http://svn.boost.org/trac/boost/.) Thanks. -- Eric Niebler BoostPro Computing http://www.boostpro.com