Hello, I've been trying to use Boost.Lambda in one of my simple
applications, but I can't seem to get the following code to compile:
for_each(vect.begin(), vect.end(), (var(str) +=
_1+constant(string(", ")) ));
Where vect is a std::vectorstd::string and str is a std::string. I
have included these headers: , <vector>,
<string>, <algorithm>.
Here is the complete error I'm getting (using MSVC2005):
c:\program
files\boost\boost_1_36_0\boost\lambda\detail\operator_lambda_func_base.hpp(225)
: error C2679: binary '+=' : no operator found which takes a right-hand
operand of type
'boost::lambda::detail::return_type_deduction_failure<<unnamed-symbol>>'
(or there is no acceptable conversion)
with
[
<unnamed-symbol>=boost::lambda::detail::return_type_2_arithmetic_phase_3,std::basic_string>
]
f:\microsoft visual studio 8\vc\include\xstring(890): could be
'std::basic_string<_Elem,_Traits,_Ax>
&std::basic_string<_Elem,_Traits,_Ax>::operator +=(const
std::basic_string<_Elem,_Traits,_Ax> &)'
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>
]
f:\microsoft visual studio 8\vc\include\xstring(895): or
'std::basic_string<_Elem,_Traits,_Ax>
&std::basic_string<_Elem,_Traits,_Ax>::operator +=(const _Elem *)'
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>
]
f:\microsoft visual studio 8\vc\include\xstring(900): or
'std::basic_string<_Elem,_Traits,_Ax>
&std::basic_string<_Elem,_Traits,_Ax>::operator +=(_Elem)'
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>
]
while trying to match the argument list '(std::string,
boost::lambda::detail::return_type_deduction_failure<<unnamed-symbol>>)'
with
[
<unnamed-symbol>=boost::lambda::detail::return_type_2_arithmetic_phase_3,std::basic_string>
]
c:\program
files\boost\boost_1_36_0\boost\lambda\detail\lambda_functors.hpp(148) :
see reference to function template instantiation 'RET
boost::lambda::lambda_functor_base::call&,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=std::basic_string &,
Act=boost::lambda::arithmetic_assignment_actionboost::lambda::plus_action,
Args=boost::tuples::tuple
&,boost::lambda::lambda_functorboost::lambda::plus_action,boost::tuples::tuple>,boost::lambda::lambda_functor>>,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,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>,
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>,
A=std::basic_string,
B=const boost::tuples::null_type,
C=const boost::tuples::null_type,
Env=const boost::tuples::null_type
]
f:\microsoft visual studio 8\vc\include\algorithm(29) : see
reference to function template instantiation
'std::basic_string<_Elem,_Traits,_Ax>
&boost::lambda::lambda_functor<T>::operator
()>(A &) const' being compiled
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>,
T=boost::lambda::lambda_functor_baseboost::lambda::plus_action,boost::tuples::tuple
&,boost::lambda::lambda_functorboost::lambda::plus_action,boost::tuples::tuple>,boost::lambda::lambda_functor>>,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,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=std::basic_string
]
c:\documents and settings\stefan\my documents\visual studio
2005\projects\simple\simple\simple.cpp(22) : see reference to function
template instantiation '_Fn1
std::for_each,boost::lambda::lambda_functor<T>>(_InIt,_InIt,_Fn1)'
being compiled
with
[
_Fn1=boost::lambda::lambda_functorboost::lambda::plus_action,boost::tuples::tuple
&,boost::lambda::lambda_functorboost::lambda::plus_action,boost::tuples::tuple>,boost::lambda::lambda_functor>>,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,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>>>,
_Ty=std::string,
_Alloc=std::allocatorstd::string,
T=boost::lambda::lambda_functor_baseboost::lambda::plus_action,boost::tuples::tuple
&,boost::lambda::lambda_functorboost::lambda::plus_action,boost::tuples::tuple>,boost::lambda::lambda_functor>>,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,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>>,
_InIt=std::_Vector_iteratorstd::string>
]
Yours sincerely,
Steven