Lambda::bind, throw() and VC71

The following simple example fails to compile with VC71, (OK with Intel 8.1). Is there a workaround for this? Regards, Richard. ---------------------- #include <boost/lambda/bind.hpp> struct S{ void mfn1(){}; void mfn2() throw() {}; }; int main() { using namespace boost::lambda; S s; bind(&S::mfn1,_1)(s); // OK bind(&S::mfn2,_1)(s); // Error with VC71 } ---------------------- cl /c /Od /Gm /EHsc /RTC1 /MLd /Zc:wchar_t /Zc:forScope /GR /ZI /W3 /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fo"Debug/" /Fd"Debug/vc70.pdb" /Gd /TP .\TestBind.cpp TestBind.cpp c:\boost\boost\lambda\detail\bind_functions.hpp(220) : error C2664: 'boost::lambda::lambda_functor<T>::lambda_functor(const boost::lambda::lambda_functor<T> &)' : cannot convert parameter 1 from 'boost::lambda::lambda_functor_base<Act,Args>' to 'const boost::lambda::lambda_functor<T> &' with [ T=boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda:: function_action<2>>,boost::tuples::tuple<const boost::lambda::detail::bind_traits<void (__thiscall S::* const )(void)>::type,const boost::lambda::detail::bind_traits<const boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null _type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost ::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda: :detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail:: bind_traits<boost::tuples::null_type>::type>> ] and [ Act=boost::lambda::action<2,boost::lambda::function_action<2>>, Args=boost::tuples::tuple<const boost::lambda::detail::bind_traits<void (__thiscall S::* const )(void) throw()>::type,const boost::lambda::detail::bind_traits<const boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null _type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost ::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda: :detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail:: bind_traits<boost::tuples::null_type>::type> ] and [ T=boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda:: function_action<2>>,boost::tuples::tuple<const boost::lambda::detail::bind_traits<void (__thiscall S::* const )(void)>::type,const boost::lambda::detail::bind_traits<const boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null _type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost ::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda: :detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail:: bind_traits<boost::tuples::null_type>::type>> ] Reason: cannot convert from 'boost::lambda::lambda_functor_base<Act,Args>' to 'const boost::lambda::lambda_functor<T>' with [ Act=boost::lambda::action<2,boost::lambda::function_action<2>>, Args=boost::tuples::tuple<const boost::lambda::detail::bind_traits<void (__thiscall S::* const )(void) throw()>::type,const boost::lambda::detail::bind_traits<const boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null _type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost ::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda: :detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail:: bind_traits<boost::tuples::null_type>::type> ] and [ T=boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda:: function_action<2>>,boost::tuples::tuple<const boost::lambda::detail::bind_traits<void (__thiscall S::* const )(void)>::type,const boost::lambda::detail::bind_traits<const boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null _type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost ::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda: :detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail:: bind_traits<boost::tuples::null_type>::type>> ] No constructor could take the source type, or constructor overload resolution was ambiguous c:\Source\TestBind\TestBind.cpp(13) : see reference to function template instantiation 'const boost::lambda::lambda_functor<T> boost::lambda::bind<void(__thiscall S::* )(void),boost::lambda::placeholder1_type>(const Arg1 & ,const Arg2 &)' being compiled with [ T=boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda:: function_action<2>>,boost::tuples::tuple<const boost::lambda::detail::bind_traits<void (__thiscall S::* const )(void)>::type,const boost::lambda::detail::bind_traits<const boost::lambda::placeholder1_type>::type,boost::lambda::detail::bind_traits<b oost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tup les::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null _type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::t ype,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost ::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda: :detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail:: bind_traits<boost::tuples::null_type>::type>>, Arg1=void (__thiscall S::* )(void), Arg2=boost::lambda::placeholder1_type ]

#include <boost/lambda/bind.hpp>
#include <boost/mem_fn.hpp>
struct S{ void mfn1(){}; void mfn2() throw() {}; };
// remove those ; at the end of the function definitions
int main() { using namespace boost::lambda;
using namespace boost;
S s; bind(&S::mfn1,_1)(s); // OK
// bind(&S::mfn2,_1)(s); // Error with VC71 bind(mem_fn(&S::mfn2),_1)(s); // This worked with me
}
using VC7.1 it worked for me. I dont know, but lambda doesnt need mem_fn for member functions(at least for the ones without exception specification)? -- Felipe Magno de Almeida Developer from synergy and Computer Science student from State University of Campinas(UNICAMP). Unicamp: http://www.ic.unicamp.br Synergy: http://www.synergy.com.br "There is no dark side of the moon really. Matter of fact it's all dark."
participants (2)
-
Felipe Magno de Almeida
-
Richard Crossley