Torbjörn Gyllebring <[EMAIL PROTECTED]> wrote:

> struct B
> {
> int f(int i){ cout << i << "\t";}
> int g(int i) const { cout << i << "\n";}
> };
>
> int main(int argc, char *argv[])
> {
>   vector<int> ivec;
>  for(int i = 0; i < 10; ++i)
>   ivec.push_back( i);
>  B b;
>  for_each( ivec.begin(), ivec.end(), obj_fun( &b, &B::f));
>  cout << endl;
>  for_each( ivec.begin(), ivec.end(), obj_fun( &b, &B::g));
>  system("PAUSE");
>  return 0;
> }
>
> if something like this is already in boost (a friend who uses it claims
it's
> not) then im
> really sorry for wasting your time, else maybe this would be a candidate
for
> inclusion?

It is:

for_each(ivec.begin(), ivec.end(), boost::bind(&B::f, &b, _1));

Giovanni Bajo

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to