Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2005-05-16 11:46:58


> I'm getting this runtime error in my program.
>
> c:\stlport-4.6.2\stlport\stl\debug\_iterator.h(179): STL assertion
> failure : __check_same_owner(__x, __y)
>
> The code that causes this is like this (Actual code slightly modified). It
> is
> the access of the match that triggers the error above.
>
> boost::smatch m;
> if (regex_match(s, m, reg))
> {
> (here)--> s_info.version = m[1];
> }
>
> I'm using stlport 4.6.2 with boost-1.32 on W2K and VC6 SP6. stlport is
> built
> with default options and boost is built like this:

I regularly test with that compiler/std lib combination so it shouldn't be
an issue.

> Any idea what can be wrong? Surely a simple access of the resulting match
> shouldn't cause this type of assertion to fire (or is there some subtle
> bug in
> my program that I'm missing!?)

I suspect that you are creating a std::string from the sub_match? If so then
STLport will validate the iterator range during the strings constructor, so
a failure there is theoretically possible, but of course should never really
happen.

I don't really know what to suggest, can you post a test case?

One thing to double check before you do: make sure that the iterators held
by the match_results structure haven't been invalidated by your code:
destroying the string to which they refer, or passing a temporary to
regex_match would cause it.

John.


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