Boost logo

Boost Users :

Subject: Re: [Boost-users] Can Regex callback function arguments be modified?
From: Kevin Kassil (k.kassil_at_[hidden])
Date: 2009-09-19 14:18:23


> So you say that the callback is really not required?

Hi Ramon,

The STL for_each [1] accepts a "unary function object" [2] which
offers more flexibility than a simple non-member function. For
example (off the top of my head) [3]:

Class myClass;
for_each( begin, end, boost::bind( & Class::function, &myClass _1 ));

I also point out that if you wanted to, you could replace for_each
with your own for loop. (Not that you need to.)

1. http://www.sgi.com/tech/stl/for_each.html

2. http://www.sgi.com/tech/stl/functors.html

3. http://www.boost.org/doc/libs/1_40_0/libs/bind/bind.html#with_algorithms

HTH,

Kevin


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