Boost logo

Boost Users :

From: Jesse Williamson (jwilliamson_at_[hidden])
Date: 2008-06-04 17:24:18

Hi, folks!

This program suprises me by causing a runtime assertion:

#include <string>
#include <boost/xpressive/xpressive.hpp>

using namespace boost::xpressive;

int main()
  std::string x("a\tb\tc");

  sregex_token_iterator cur(x.begin(), x.end(), as_xpr("\t"), -1),
  for(; cur != end; ++cur)

...the assertion:

void boost::xpressive::detail::enable_reference_tracking<Derived>::release()
[with Derived =
boost::xpressive::detail::regex_impl<__gnu_cxx::__normal_iterator<const char*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >]:
Assertion `0 < this->cnt_' failed.

Changing the declarations like this causes it to work as I expect:

  sregex tab_delim(as_xpr("\t"));
  sregex_token_iterator cur(x.begin(), x.end(), tab_delim, -1),

...maybe there's some "temporary" magic happening, or that I was just plain
doing something I shouldn't have been doing (silly me!), or both? Could anyone
comment on what's happening?

[Note: Boost 1.35, OpenSuSE 10.3, g++ 4.1.2]


_Jesse Williamson ;-};

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at