
27 Nov
2007
27 Nov
'07
9:28 p.m.
Hi, I can't figure out how to use std::mem_fun() and std::bind1st() with std::for_each() to call into a member function for each element in a boost::ptr_vector object. Some sample code below: class Object { public: void Tick( float number ) {} }; boost::ptr_vector<Object> m_objects; using namespace std; for_each( m_objects.begin(), m_objects.end(), bind1st( mem_fun( &Object::Tick ), 5 ) ); Of course, this doesn't compile at all. Can anyone tell me what I'm doing wrong?