Boost logo

Boost Users :

From: Rodolfo Lima (yg-boost-users_at_[hidden])
Date: 2003-09-02 09:50:00


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<HT,TT>::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<HT,TT>::stored_head_type' to 'int'

with

[

HT=const boost::lambda::detail::parameter_traits_<const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::B1>>,const boost::lambda::detail::IF<false,const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::B1>> &,const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::B1>>>::RET>::type,

TT=boost::tuples::detail::map_tuple_to_cons<boost::tuples::null_type,boost::
tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::t
uples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tu
ples::null_type,boost::tuples::null_type,boost::tuples::null_type>::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<Act,Args>::call<boost::lambda::lambda_fun
ctor_base<Act,Args>::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::lambda::other_action<boost::la
mbda::assignment_action>,boost::tuples::tuple<boost::lambda::lambda_functor<
boost::lambda::identity<int &>>,const
boost::lambda::detail::parameter_traits_<const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::B1>>,const boost::lambda::detail::IF<false,const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::B1>> &,const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::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<boost::tuples::tuple<A
&,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,boost::tuples::null_type>>
::type,

Act=boost::lambda::other_action<boost::lambda::assignment_action>,

Args=boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::ident
ity<int &>>,const boost::lambda::detail::parameter_traits_<const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::B1>>,const boost::lambda::detail::IF<false,const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::B1>> &,const
boost::_bi::bind_t<int,boost::_mfi::mf

0<int,A>,boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::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
&,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,boost::tuples::null_type>,

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<Act,Args>::sig<SigArgs>::type
boost::lambda::lambda_functor<T>::operator ()<A>(A &) const' being compiled

with

[

Act=boost::lambda::other_action<boost::lambda::assignment_action>,

Args=boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::ident
ity<int &>>,const boost::lambda::detail::parameter_traits_<const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::B1>>,const boost::lambda::detail::IF<false,const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::B1>> &,const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::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<A
&,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,boost::tuples::null_type>,

T=boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lamb
da::assignment_action>,boost::tuples::tuple<boost::lambda::lambda_functor<bo
ost::lambda::identity<int &>>,const
boost::lambda::detail::parameter_traits_<const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::B1>>,const boost::lambda::detail::IF<false,const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::B1>> &,const
boost::_bi::bind_t<int,boost::_mfi::mf0<int,A>,boost::_bi::list1<boost::_bi:
:list_av_1<boost::arg<1>>::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)


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