#include
...
int updateVal;
...
for_each(blocks.begin(), blocks.end(), boost::bind(&Block::update, _1,
updateVal));
Jeff
-----Original Message-----
From: Mark Snelling [mailto:mark@bakedbeans.com]
Sent: Wednesday, September 04, 2002 10:17 AM
To: Boost-Users@yahoogroups.com
Subject: [Boost-Users] Newbie boost::mem_fn problem
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 blocks;
for_each(blocks.begin(), blocks.end(), *****); // Call update on each
item in list
}
what should I replace the ***** with?
Any help appreciated!
Mark.
Info: http://www.boost.org
Wiki: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl
Unsubscribe: mailto:boost-users-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/