Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2021-03-31 12:37:17


Andrzej Krzemienski wrote:
> Could I propose an alternative design. Add placeholders _1, _2, ... into
> namespace `boost::lambda2::placeholders` specialize std::is_placeholder` for
> them, so that `std::bind` can recognize them. Add operators in the same
> namespace.

Barry also suggested this - in fact he actually implemented it while using
the library in his zip_view implementation, and I also considered it at the
time. I wanted to reuse the standard placeholders and not introduce my
own, but I'm not sure the lookup issue can be solved in any other way,
so that's probably the way to go.

Except, it will be just namespace boost::lambda2, because there's nothing
else there, so there's no need to introduce another namespace.

(The option of "illegally" defining the operators in namespace std::placeholders
unfortunately doesn't work reliably either, as the std::bind return value is
probably defined in std:: and not in std::placeholders, and in fact, even the
placeholders may be of a type defined in std:: and not std::placeholders.)

So yes, I think the only realistic way forward given the lookup issue is for
Lambda2 to define its own placeholders in the same namespace as the
operators.


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