Boost logo

Boost Users :

From: gfsdjkgf_at_[hidden]
Date: 2008-05-14 14:32:43


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 <boost/bind.hpp>
using boost::bind;

//#include <boost/lambda/bind.hpp>
//using boost::lambda;

template<class Handler_t>void Test2(Handler_t Handler)
{
}

template<class Handler_t>void Test1(Handler_t Handler)
{
        bind(&Test2<Handler_t>, 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<R,F,L>'
1> with
1> [
1> Handler_t=boost::_bi::bind_t<void,void (__cdecl *)(int),boost::_bi::list1<boost::_bi::value<int>>>
1> ]
1> and
1> [
1> R=void,
1> F=void (__cdecl *)(int),
1> L=boost::_bi::list1<boost::_bi::value<int>>
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 ()<void(__cdecl *)(Handler_t),boost::_bi::list0>(boost::_bi::type<T>,F &,A &,int)' being compiled
1> with
1> [
1> A1=boost::_bi::bind_t<void,void (__cdecl *)(int),boost::_bi::list1<boost::_bi::value<int>>>,
1> Handler_t=boost::_bi::bind_t<void,void (__cdecl *)(int),boost::_bi::list1<boost::_bi::value<int>>>,
1> T=void,
1> F=void (__cdecl *)(boost::_bi::bind_t<void,void (__cdecl *)(int),boost::_bi::list1<boost::_bi::value<int>>>),
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<R,F,L>::operator ()(void)'
1> with
1> [
1> R=void,
1> F=void (__cdecl *)(boost::_bi::bind_t<void,void (__cdecl *)(int),boost::_bi::list1<boost::_bi::value<int>>>),
1> L=boost::_bi::list1<boost::_bi::bind_t<void,void (__cdecl *)(int),boost::_bi::list1<boost::_bi::value<int>>>>
1> ]
1> d:\projekte\test2\main.cpp(13) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled
1> with
1> [
1> R=void,
1> F=void (__cdecl *)(boost::_bi::bind_t<void,void (__cdecl *)(int),boost::_bi::list1<boost::_bi::value<int>>>),
1> L=boost::_bi::list1<boost::_bi::bind_t<void,void (__cdecl *)(int),boost::_bi::list1<boost::_bi::value<int>>>>
1> ]
1> d:\projekte\test2\main.cpp(22) : see reference to function template instantiation 'void Test1<boost::_bi::bind_t<R,F,L>>(Handler_t)' being compiled
1> with
1> [
1> R=void,
1> F=void (__cdecl *)(int),
1> L=boost::_bi::list1<boost::_bi::value<int>>,
1> Handler_t=boost::_bi::bind_t<void,void (__cdecl *)(int),boost::_bi::list1<boost::_bi::value<int>>>
1> ]


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