$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Olaf Peter (ope-devel_at_[hidden])
Date: 2008-04-08 13:40:35
Hi,
why does the following code not compile?
---8<---
#include <iostream>
#include <boost/array.hpp>
#include <boost/lambda/lambda.hpp>
#include <algorithm>
#include <cmath>
int main()
{
     using namespace ::boost::lambda;
     const boost::array<double, 10> factor = {
         1e12,
         1e9,
         1e6,
         1e3,
         1,
         1e-3,
         1e-6,
         1e-9,
         1e-12,
         1e-15
     };
     boost::array<double, 10> values;
     std::transform( factor.begin(), factor.end(),
                     values.begin(),
                     std::abs( ret<double>( 1e3 / _1 ) ) );
}
--->8---
si_short.cpp: In function 'int main()':
si_short.cpp:28: error: no matching function for call to 'abs(const 
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::explicit_return_type_action<double>, 
boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::divide_action>, 
boost::tuples::tuple<const double, 
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, 
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, 
boost::tuples::null_type> > >)'
/usr/include/stdlib.h:691: note: candidates are: int abs(int)
/usr/include/c++/4.2/cstdlib:143: note:                 long int 
std::abs(long int)
/usr/include/c++/4.2/cstdlib:174: note:                 long long int 
__gnu_cxx::abs(long long int)
/usr/include/c++/4.2/cmath:89: note:                 double std::abs(double)
/usr/include/c++/4.2/cmath:93: note:                 float std::abs(float)
/usr/include/c++/4.2/cmath:97: note:                 long double 
std::abs(long double)
Thanks,
Olaf