Boost logo

Boost Users :

From: Mark Snelling (mark_at_[hidden])
Date: 2002-09-04 12:16:39


Hello,
My problem I think is very simple, I just can't seem to find the solution
I have an STL list of object pointers and I want to call a member function
on each of the pointers in the list usigng the STL for_each algorithm. This
would seem easy if the list contained the actual objects rather than
pointers to them, but because they are pointers I can't find a way of doing
this.

class Block
{
public:
    void update(int x);
};

void main()
{
    list<Block*> blocks;
    for_each(blocks.begin(), blocks.end(), *****); // Call update on each
item in list
}

what should I replace the ***** with?

Any help appreciated!

Mark.


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