From: "Mark Snelling"
Hello, I need some help using the boost::bind library. I have a map of objects with a string as the key eg map
, 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
blocks; for_each(blocks.begin(), blocks.end(), *****); } what should I replace the ***** with to call update() on each block?
std::for_each(blocks.begin(), blocks.end(),
boost::bind(&Block::update,
boost::bind(&std::map