Boost logo

Boost Users :

From: Nat Goodspeed (ngoodspeed_at_[hidden])
Date: 2007-02-01 10:09:20


________________________________________
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of hongleij_at_[hidden]
Sent: Thursday, February 01, 2007 9:00 AM
To: boost-users_at_lists.bo...
Subject: [Boost-users] [bind] how to get the type after bind

 //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
          
    bind ( &func<???>, bind(&print) ) ; //don't know how to write it
}
 
[Nat] This doesn't directly answer your question; the type produced by bind() is obscure. But would the following suit your need? 
 
    bind ( &func< boost::function<void ()> >, bind(&print) ) ;


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