Hi people,
That's the first time I'm using lambda and I'm stuck with something that can
be resumed to:
struct A
{
int Test() { return 0; }
};
int x;
A a;
(var(x)=bind(&A::Test,_1))(a);
In other words, I want to make a functor that calls a member function and
stores its return value in some variable. I'm compiling with VC7.1 and it
returns
error C2440: '=' : cannot convert from 'const
boost::tuples::cons::stored_head_type' to 'int'
Is there something I can do to get rid of this error and compile
successfully?
I'm appending the whole compiler output in the end of the post.
Thanks,
rod
//--------- Whole compiler output
c:\RodSoft\lib\boost\boost\lambda\detail\operator_lambda_func_base.hpp(242)
: error C2440: '=' : cannot convert from 'const
boost::tuples::cons::stored_head_type' to 'int'
with
[
HT=const boost::lambda::detail::parameter_traits_,boost::_bi::list1>::B1>>,const boost::lambda::detail::IF,boost::_bi::list1>::B1>> &,const
boost::_bi::bind_t,boost::_bi::list1>::B1>>>::RET>::type,
TT=boost::tuples::detail::map_tuple_to_cons::type
]
No user-defined-conversion operator available that can perform this
conversion, or the operator cannot be called
c:\RodSoft\lib\boost\boost\lambda\detail\lambda_functors.hpp(153) : see
reference to function template instantiation 'RET
boost::lambda::lambda_functor_base::call::sig<SigArgs>::type,A,const
boost::tuples::null_type,const boost::tuples::null_type,const
boost::tuples::null_type>(A &,B &,C &,Env &) const' being compiled
with
[
RET=boost::lambda::lambda_functor_base,boost::tuples::tuple>,const
boost::lambda::detail::parameter_traits_,boost::_bi::list1>::B1>>,const boost::lambda::detail::IF,boost::_bi::list1>::B1>> &,const
boost::_bi::bind_t,boost::_bi::list1>::B1>>>::RET>::type,boost::tuples::null_type,boost:
:tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::
tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::t
uples::null_type>>::sig>
::type,
Act=boost::lambda::other_actionboost::lambda::assignment_action,
Args=boost::tuples::tuple>,const boost::lambda::detail::parameter_traits_,boost::_bi::list1>::B1>>,const boost::lambda::detail::IF,boost::_bi::list1>::B1>> &,const
boost::_bi::bind_t,boost::_bi::list1>::B1>>>::RET>
::type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null
_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_
type,boost::tuples::null_type,boost::tuples::null_type>,
SigArgs=boost::tuples::tuple,
A=A,
B=const boost::tuples::null_type,
C=const boost::tuples::null_type,
Env=const boost::tuples::null_type
]
c:\RodSoft\pessoal\TstConsole\TstConsole.cpp(49) : see reference to function
template instantiation
'boost::lambda::lambda_functor_base::sig<SigArgs>::type
boost::lambda::lambda_functor<T>::operator ()<A>(A &) const' being compiled
with
[
Act=boost::lambda::other_action,
Args=boost::tuples::tuple>,const boost::lambda::detail::parameter_traits_,boost::_bi::list1>::B1>>,const boost::lambda::detail::IF,boost::_bi::list1>::B1>> &,const
boost::_bi::bind_t,boost::_bi::list1>::B1>>>::RET>::type,boost::tuples::null_type,boost:
:tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::
tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::t
uples::null_type>,
SigArgs=boost::tuples::tuple,
T=boost::lambda::lambda_functor_base,boost::tuples::tuple>,const
boost::lambda::detail::parameter_traits_,boost::_bi::list1>::B1>>,const boost::lambda::detail::IF,boost::_bi::list1>::B1>> &,const
boost::_bi::bind_t,boost::_bi::list1>::B1>>>::RET>::type,boost::tuples::null_type,boost:
:tuples::null
_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_
type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_t
ype>>,
A=A
]
Build log was saved at
"file://c:\RodSoft\pessoal\TstConsole\Debug\BuildLog.htm"
TstConsole - 1 error(s), 0 warning(s)