Boost logo

Boost Users :

From: Mats Lidell (matsl_at_[hidden])
Date: 2005-05-17 04:09:25


John Maddock wrote:

> 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?

Yes. See the code below.

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

This test case fails in the described way. It seems to be because I use a smatch when an
cmatch should be used instead!? With no stlport this (kind of) code works fine.

-----------------------------------------------------------------
using namespace std;
using namespace boost;

void test_regex()
{
    char const * s_line = "String";

    boost::smatch m;
    if (regex_match(s_line, m, regex(".*")))
    {
        string s = m[1];
    }
}

int main()
{
    test_regex();
    return 0;
}
-----------------------------------------------------------------

Yours

-- 
%% Mats

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