|
Boost Users : |
From: Anders Sundman (d00-asu_at_[hidden])
Date: 2004-03-21 08:55:03
Hi all!
I'm using the lambda library to compute the sum of squared
differences, but I have encountered a puzzling problem. I would
really appreciate if someone could explain it to me.
This doesn't compile:
std::inner_product(i1, i1+x, i2, 0.0,
(_1 + _2), (_1*_1)(_1 - _2));
however, this does:
std::inner_product(i1, i1+x, i2, 0.0,
std::plus<double>(), (_1*_1)(_1 - _2));
The compiler message is very voluminous and hard to read. But I think
this part might be of importance, the (double&, double) looks
strange:
/usr/include/c++/3.3/bits/stl_numeric.h:119: error: no match for call
to `(
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambd
a::arithmetic_action<boost::lambda::plus_action>,
boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder
<1>
>, boost::lambda::lambda_functor<boost::lambda::placeholder<2> >,
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> > >) (double&,
double)'
/usr/include/boost/lambda/detail/lambda_functors.hpp:142: error:
candidates
are: typename T::sig<boost::tuples::null_type>::type
boost::lambda::lambda_functor<Base>::operator()() const [with T =
boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::la
mbda::plus_action>,
Many thanks in advance
Anders Sundman
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