$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Mark Snelling (mark_at_[hidden])
Date: 2002-09-12 09:05:11
Hello,
I need some help using the boost::bind library. I have a map of objects
with a string as the key eg map<string, Block*>, what I want to do is
call a member function on each Block* in the map using the std::for_each
algorithm. The trivial solution would be to craft my own loop and
iterate through the list calling the member function on each one. But
I'm sure that the boost::bind library can help me out there.
class Block
{
public:
void update(int x);
};
void main()
{
map<string, Block*> blocks;
for_each(blocks.begin(), blocks.end(), *****);
}
what should I replace the ***** with to call update() on each block?
Any help appreciated!
Mark.