On 2/1/07, hongleij@126.com <hongleij@126.com> wrote:
 //my question is how to write the type ??? below to make it run .

#include <boost/bind.hpp>
#include <iostream>
using boost::bind;
void print()
{
    std::cout <<" print" << std::endl;   
}


template <class T>
void func(T t)
{
    std::cout <<"func1(T t) : " ;
    t();       
}
int main()
{
    func(bind(&print));  //ok


You don't have to use bind here.

func( print ) ;

would work.

    bind ( &func<???>, bind(&print) ) ; //don't know how to write it
}

Note that this expression will not call anything, it will generate a functor and drop it. I guess what you are trying to do is this

bind( func<void()>, print) ();  // note the function call operator at the end.

or maybe this:

bind( func<void()>, _1) (print);

hth,


--
Server Levent Yilmaz
Mechanical Engineering @ PITT