|
Boost Users : |
From: Stefano Peluchetti (pelux_at_[hidden])
Date: 2007-08-09 14:15:30
I'm a newbie to the boost library so I need some help with the
following problem:
Take the following code:
class EaSde // Abstract class.
{
...
public:
inline virtual double unitDiffusionInverseMap( double x ) const = 0;
inline virtual void unitDiffusionInverseMap( Path& path ) const;
....
};
void EaSde::unitDiffusionInverseMap( Path& path ) const
{
std::transform( path.values.begin(), path.values.end(), path.values.begin(),
boost::bind<double>( &sde::EaSde::unitDiffusionInverseMap, this, _1 ) );
}
This code works fine.
However if I use boost::bind::lambda instead of boost::bind I get:
1>Compiling...
1>sdefunctionalmc.cpp
1>c:\develop\nsde\nsde\abstracteasde.hpp(58) : error C2664: 'const
boost::lambda::lambda_functor<T> boost::lambda::bind<double,const
sde::EaSde*,const boost::lambda::placeholder1_type>(const Arg1 &,const
Arg2 &,const Arg3 &)' : cannot convert parameter 1 from
'overloaded-function' to 'const double &'
1> with
1> [
1> T=boost::lambda::lambda_functor_base<boost::lambda::action<3,boost::lambda::function_action<3>>,boost::tuples::tuple<const
double,const sde::EaSde *const ,const
boost::lambda::lambda_functor<boost::lambda::placeholder<1>>,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type>>,
1> Arg1=double,
1> Arg2=const sde::EaSde *,
1> Arg3=const boost::lambda::placeholder1_type
1> ]
1> Reason: cannot convert from 'overloaded-function' to 'const double'
1> Context does not allow for disambiguation of overloaded function
1>c:\develop\nsde\nsde\abstracteasde.hpp(58) : error C2780: '_OutIt
std::transform(_InIt1,_InIt1,_InIt2,_OutIt,_Fn2)' : expects 5
arguments - 4 provided
1> c:\programmi\microsoft visual studio
8\vc\include\algorithm(797) : see declaration of 'std::transform'
Why in this case is boost::bind working and boost::lambda::bind not working?
Where can I find more informations on the differences about the two?
On a side note I'm wondering if I can expect different performance of
the two implementations.... I'm actually moving everything to
boost::lambda::bind to
1) avoid the conflict of boost::lambda::_1 and _1
2) have binders that are "lambda ready" if needed
Thank you in advance for your reply.
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