Boost logo

Boost Users :

From: John Grabner (grabnerj_at_[hidden])
Date: 2006-07-29 06:40:31


I used to be able to write this :

void LineTracker::Analyse(const std::string &Buffer)
{
    std::string::const_iterator start, end;
    start = Buffer.begin();
    end = Buffer.end();
             
boost::regex_grep(std::bind1st(std::mem_fun(&LineTracker::grep_callback),
                                                        this),
                      start,
                      end,
                      expression);
}

to get the regex to call back into my class. With the change to the new
style using iterator I can do this.

void LineTracker::Analyse(const std::string &Buffer)
{
    boost::sregex_iterator m1(Buffer.begin(), Buffer.end(), expression);
    boost::sregex_iterator m2;
    std::for_each(m1, m2, *this);
}

However for_each makes a copy of my class, so at the end it does not
update the current instance with the results.

What do I need to do to have the the current instance receive the call
back from regex?

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