Boost logo

Boost :

From: Barry Revzin (barry.revzin_at_[hidden])
Date: 2021-03-28 20:47:31


On Sun, Mar 28, 2021 at 2:26 PM Emil Dotchevski via Boost <
boost_at_[hidden]> wrote:

> On Sun, Mar 28, 2021 at 10:50 AM Barry Revzin via Boost <
> boost_at_[hidden]> wrote:
> > Second, this library has name lookup issues. Here's a reduced example (
> > https://godbolt.org/z/z8oEqnTnG):
> >
> > #include <
> >
>
> https://raw.githubusercontent.com/pdimov/lambda2/develop/include/boost/lambda2/lambda2.hpp
> > >
> >
> > namespace N {
> > struct Irrelevant { };
> > void operator+(Irrelevant, Irrelevant);
> >
> > int plus_one(int i) {
> > using namespace boost::lambda2;
> > return (_1 + 1)(i);
> > }
> > }
>
> To successfully compile, this has to be:
>
> int plus_one(int i) {
> using namespace std::placeholders;
> using boost::lambda2::operator+;
> return (_1 + 1)(i);
> }
>
> Note that it will not work if you say "using namespace boost::lambda2", you
> have to bring in each individual operator you need.
>

Yes, I understand all of that. But the point of this library is to provide
terse syntax for simple lambda expressions, and having to write
using-declarations for each operator in each scope that they are intended
to be used defeats the purpose.

Barry


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