Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2007-11-27 16:28:56


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?



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