Hello,
let's come straight to the code. I am not sure why it fails (both boost::bind and boost::lambda::bind fail). I use Visual Studio 9 (2008, x86) and boost 1.35 (retail).
What's wrong?
#include
using boost::bind;
//#include
//using boost::lambda;
template<class Handler_t>void Test2(Handler_t Handler)
{
}
template<class Handler_t>void Test1(Handler_t Handler)
{
bind(&Test2, Handler)();
}
void TestFunc(int i)
{
}
int main()
{
Test1(bind(TestFunc,0));
}
1>d:\projekte\libs\boost_1_35\build\x86\include\boost-1_35\boost\bind.hpp(232) : error C2664: 'void (Handler_t)' : cannot convert parameter 1 from 'void' to 'boost::_bi::bind_t'
1> with
1> [
1> Handler_t=boost::_bi::bind_t>
1> ]
1> and
1> [
1> R=void,
1> F=void (__cdecl *)(int),
1> L=boost::_bi::list1
1> ]
1> Expressions of type void cannot be converted to other types
1> d:\projekte\libs\boost_1_35\build\x86\include\boost-1_35\boost\bind\bind_template.hpp(20) : see reference to function template instantiation 'void boost::_bi::list1<A1>::operator ()(boost::_bi::type<T>,F &,A &,int)' being compiled
1> with
1> [
1> A1=boost::_bi::bind_t>,
1> Handler_t=boost::_bi::bind_t>,
1> T=void,
1> F=void (__cdecl *)(boost::_bi::bind_t>),
1> A=boost::_bi::list0
1> ]
1> d:\projekte\libs\boost_1_35\build\x86\include\boost-1_35\boost\bind\bind_template.hpp(18) : while compiling class template member function 'void boost::_bi::bind_t::operator ()(void)'
1> with
1> [
1> R=void,
1> F=void (__cdecl *)(boost::_bi::bind_t>),
1> L=boost::_bi::list1>>
1> ]
1> d:\projekte\test2\main.cpp(13) : see reference to class template instantiation 'boost::_bi::bind_t' being compiled
1> with
1> [
1> R=void,
1> F=void (__cdecl *)(boost::_bi::bind_t>),
1> L=boost::_bi::list1>>
1> ]
1> d:\projekte\test2\main.cpp(22) : see reference to function template instantiation 'void Test1>(Handler_t)' being compiled
1> with
1> [
1> R=void,
1> F=void (__cdecl *)(int),
1> L=boost::_bi::list1,
1> Handler_t=boost::_bi::bind_t>
1> ]