|
Boost Users : |
Subject: Re: [Boost-users] [lambda] Understanding placeholders
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-15 12:22:28
AMDG
Robert Jones wrote:
> Why is this wrong?
>
> #include "boost/lambda/lambda.hpp"
> #include "boost/lambda/bind.hpp"
> #include <iostream>
>
> int main( )
> {
> using namespace boost :: lambda;
> int i = 2, j = 3;
> bind( bind( protect( _1 = _2 ), _2, _1 ), _1, _2 )( i, j );
> std :: cout << "i = " << i << ", j = " << j << "\n";
> }
Evaluation:
bind( bind( protect( _1 = _2 ), _2, _1 ), _1, _2 )( i, j );
bind( _1 = _2, j, i )(i, j);
(i = j)(j, i );
In Christ,
Steven Watanabe
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