Boost logo

Boost Users :

From: News Group (nwsgrp1_at_[hidden])
Date: 2007-03-23 20:15:24


All,

I am trying to copy from a boost::cmatch variable to a std::set. It
compiles fine but when I run it I get a:

Debug Assertion Failure
xtree 245
map/set iterator not dereferencable

I think it's the "match.begin()" and "match.end()" in std::copy that is
 failing. This is a short version of what I have:

#include <boost/regex.hpp>
#include <algorithm>
#include <string>
#include <set>

bool Parse( const std::string &page, std::set< std::string > &links )
{
    const boost::regex expression( "123" );
    boost::cmatch match;

    if( boost::regex_search( page.c_str(), match, expression ) )
    {
        std::copy( match.begin(), match.end(), links.begin() );
        return true;
    }

    return false;
}

int main()
{
    std::string test_data = "www.abc123.com/index.php";
    std::set< std::string > links;

    Parse( test_data, links );
    return EXIT_SUCCESS;
}

Thanks in advance.
Carl.



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