regex_token_iterator bug?

Dear all, I just played a little bit with the regex_token_iterator ( boost v 1.32) and modified the "html" example. I found this (strange?) behavior when i "tokenize" a string. while (i != j) { std::cout << i++->str().length() << std::endl; } crashes at runtime at the last sub-match of a match with: mtest: ../boost_1_32_0/boost/shared_ptr.hpp:253: T* boost::shared_ptr<T>::operator->() const [with T = boost::regex_token_iterator_implementation<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char, boost::regex_traits<char>, std::allocator<char> >]: Assertion `px != 0' failed. zsh: 24497 abort mtest test.html Whereas: while (i != j) { std::cout << i->str().length() << std::endl; i++; } works fine. Is this behavior a bug, or is it correct, that the first version does not work, if yes, why? Cheers, Joe. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

I just played a little bit with the regex_token_iterator ( boost v 1.32) and modified the "html" example. I found this (strange?) behavior when i "tokenize" a string.
while (i != j) { std::cout << i++->str().length() << std::endl; }
crashes at runtime at the last sub-match of a match with:
Is this behavior a bug, or is it correct, that the first version does not work, if yes, why?
I can't reproduce that, can you provide test case? The assertion will occur if you try to access an end of sequence iterator BTW, but obviously that should not occur with the code snippet you posted. Thanks, John Maddock.
participants (2)
-
John Maddock
-
samantha Quark