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),
                          end;
  for(; cur != end; ++cur)
   ;
}
=====

...the assertion:

=====
suprise:
/usr/local/include/boost-1_35/boost/xpressive/detail/utility/tracking_ptr.hpp:196:
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.
Aborted
=====

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),
                          end;
=====

...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]

Thanks!

_Jesse Williamson ;-};


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net