$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] De Bruijn Bind (alternate bind syntax) Interest?
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-09-03 07:33:37
Zitat von "Stewart, Robert" <Robert.Stewart_at_[hidden]>:
> _1_1 is more readable and succinct than arg<1,1>:
>
> auto const_ = lam<1>( lam<1>( arg<2,1>() ) );
>
> auto const_ = lam<1>( lam<1>( _2_1() ) );
>
> and:
>
> auto flip = lam<1>( lam<2>( app( arg<2,1>()
> , arg<1,2>()
> , arg<1,1>()
> )
> )
> );
>
> auto flip =
> lam<1>(lam<2>(app(_2_1(), _1_2(), _1_1())));
or:
auto flip=lam(lam(app(_2_1,_1,_2)));
david, why do you need to number the lambdas? doesn't the "nested
index" of the args refer to the level of nesting instead of the number
given to the lam<> template?
_1, _2 in the example above would refer to the placeholders e.g. of
Boost.Bind and be equivalent to _1_1 and _1_2.
thomas (author of phoenix v3) has mentioned an effort to unify all the
placeholders in boost (Bind, Phoenix, ...)