Boost logo

Boost Users :

Subject: Re: [Boost-users] problem with xpressive sregex and stl::list::iterator
From: Eric Niebler (eric_at_[hidden])
Date: 2011-09-29 14:55:25

On 9/29/2011 3:02 AM, Richard wrote:
> hi,
> I am trying to use stl::list<boost::xpressive::sregex>, but the
> following code cannot be complied
> stl::list<boost::xpressive::sregex> rxs;
> sregex rex = boost::xpressive::sregex::compile("hello");
> rxs.push_back(rex);
> 50 std::list<boost::xpressive::sregex>::iterator it;
> 51
> 52 for (it= rxs.begin(); it != rxs.end(); it++)
> 53 {
> //do something
> }
> line 52, "it= rxs.begin()" cannot be complied, it said the no match
> operator =., what is wrong?

The following program compiles for me:

    #include <list>
    #include <boost/xpressive/xpressive_dynamic.hpp>

    int main()
        std::list<boost::xpressive::sregex> rxs;
        boost::xpressive::sregex rex =
        std::list<boost::xpressive::sregex>::iterator it;

        for (it= rxs.begin(); it != rxs.end(); it++)
                    //do something

So I don't know what the problem could be. What compiler/std-library are
you using, and what version of boost?

> by the way, I cannot use std::vector<boost::xpressive::sregex>, it
> compiled failed. I searched on web, it is said there is a bug with this
> issue. I do not want to change the version of boost library I used, so
> let's ignore this issue at the moment.

I don't remember that bug. Can you send a link to the ticket or to the
mailing list discussion?

Eric Niebler
BoostPro Computing

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