Boost logo

Boost :

From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2021-03-31 21:10:42


śr., 31 mar 2021 o 20:01 Peter Dimov via Boost <boost_at_[hidden]>
napisał(a):

> Andrzej Krzemienski wrote:
> > Maybe Boost.Lambda2 could also provide its own thin wrapper for std::bind
> > which returns a type from namespace boost::lambda2
>
> I think (and hope) that this won't be necessary.
>
> By the way, one advantage of Lambda2 defining its own placeholders would
> be that they will now be usable as function objects. The need for just _1
> or
> _2 as a lambda is surprisingly common and it's an annoyance that they don't
> work.
>
> I was going to add a "wrong" unary plus allowing +_1 to be usable as
> identity
> instead of _1, but now this hack won't be needed.
>

So, you are saying the following:

std::transform(v1.begin(), v1.end(), v2.begin(), out.begin(), _2);

would mean select the second element? Yeah. This looks practical, and
uniform with the rest of the library.
Regards,
&rzej;

> > Anyway, at some point you may need to add something like
> > `boost::lambda::constant` to handle cases like `"TIME " + time + _1`.
>
> Yes, maybe. That's bind(identity(), x), and your point is probably that
> boost::lambda2 is not going to be an associated namespace of it.
>
> We'll see.
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk