xpressive: sregex_token_iterator assertion
Hi, folks!
This program suprises me by causing a runtime assertion:
=====
#include <string>
#include
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
On Wed, 4 Jun 2008, Eric Niebler wrote: Eric,
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.
That does make sense-- and, it's a good question. So far (and I'm new to using this library) for my own purposes, I would say that the convienence of inline notation would be nice. On the other hand, the most complicated parse so far in my current project benefits from being able to build up a grammar in small parts, and indeed involves a few copies. Hmm.
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.
Done, ticket 1990. By the way, I'm using xpressive in a current project and am having tremendous /fun/ working with it so far! You'll be pleased (if unsuprised :>) to know that it's processing hundreds of thousands of records from real-world data with nary a hitch, and I might add performing extremely well. Thanks! _Jesse Williamson ;-};
Jesse Williamson wrote:
Done, ticket 1990.
Fixed.
By the way, I'm using xpressive in a current project and am having tremendous /fun/ working with it so far! You'll be pleased (if unsuprised :>) to know that it's processing hundreds of thousands of records from real-world data with nary a hitch, and I might add performing extremely well.
Nice to hear, thanks! -- Eric Niebler BoostPro Computing http://www.boostpro.com
participants (2)
-
Eric Niebler
-
Jesse Williamson