|
Boost Users : |
Subject: Re: [Boost-users] boost::bind can't bind bind_t type right?
From: Igor R (boost.lists_at_[hidden])
Date: 2011-03-15 10:17:25
#include <iostream>
#include <boost/bind.hpp>
#include <boost/bind/protect.hpp>
#include <boost/function.hpp>
class test1
{
public:
template<typename S>
double handle(S s)
{
s(1);
std::cout<<"test1\n";
return 1;
}
template<typename F>
void handle1(F f){
boost::bind(&test1::handle<boost::_bi::protected_bind_t<F>
>,this, protect(f))();
}
};
class test2
{
public:
double handle(int i)
{
std::cout<<"test2\n";
return i;
}
};
int main()
{
test2 t2;
test1 t1;
t1.handle1(boost::bind(&test2::handle,t2,_1));
return 0;
}
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