2
class User    
{    
public:

    User(){}    
    virtual ~User(){}
    void Test( int in )    
    {    
    }    
}    

User user;

vector< boost::function< void() > > functions;

functions.push_back( boost::bind( &User::Test, &user, 2 ) );

functions.push_back( boost::bind( &User::Test, &user, 4 ) );

for_each( functions.begin(), functions.end() , /* What goes here? */ );
pmr
  • 58,701
  • 10
  • 113
  • 156
metdoloca
  • 21
  • 2

1 Answers1

3

Try

for_each( functions.begin(), functions.end(), mem_fn( &function< void() >::operator() ) );

Where mem_fn is either std::tr1::mem_fn or boost::mem_fn.

Andrew Durward
  • 3,771
  • 1
  • 19
  • 30