Boost logo

Boost Users :

From: hongleij_at_[hidden]
Date: 2007-02-01 23:02:24


// how to get the functor of function caller below,which could be used in a boost::thread or other condition
#include <boost/bind.hpp>
#include <iostream>

class BufferMoniter
{
public:
   void maitain()
   {
      std::cout <<" BufferMoniter" << std::endl;
   }
};
class LocalPeer
{
public:
   template <class T>
   void caller(unsigned int interval,T t)
   {
       //do something
       t();
   }
  void fork()
  {
      BufferMoniter *pBuffer=new BufferMoniter( );
 
      caller(500,boost::bind(&BufferMoniter::maitain,pBuffer)); //I want a functor of it

      //boost::thread thrd( ); //insert here
      //thre.join();
  }

};
//best wishes



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