Boost logo

Boost Users :

From: ka (filip.konvicka_at_[hidden])
Date: 2007-03-14 12:31:22


Hi Yu,

I happen to have finished reading lambda docs just a while ago... :-)

std::cout << (_1 + _2)(boost::lambda::make_const(10),
boost::lambda::make_const(10));
std::cout << std::endl;

does the job. You have to be careful about passing constants as
arguments, see docs for details. As for std::endl, the problem is that
the resulting value (result of std::cout << _lambda_expression_) has
some special type. There are some workarounds, try googling on that if
this worries you.

Cheers,
Filip

> Hi,
>
> It seems that the lambda manual lacks of a simple working example.
>
> I'm made up the following example. But it's not working. Could you
> please show me how to make it work?
>
> Thanks,
> Peng
>
> #include <boost/lambda/lambda.hpp>
> #include <boost/lambda/core.hpp>
> #include <iostream>
>
> using namespace boost::lambda;
>
> int main() {
> std::cout << (_1 + _2)(10, 10) << std::endl;
> }
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
Filip Konvic(ka
LOGIS, s.r.o.
tel. +420 556 841 100
mob. +420 736 758 714

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