Boost logo

Boost :

Subject: Re: [boost] New libraries implementing C++11 features in C++03
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-11-22 14:39:17


Le 22/11/11 18:27, Jeffrey Lee Hellrung, Jr. a écrit :
> Within the discussion for the review of the proposed Boost.Local library,
> Hartmut Kaiser raised a concern that I think should be addressed more
> broadly by the community, if possible. I quote Hartmut:
>
>> Ok. However this raises a more serious question. Should we as the
>> Boost community still encourage solutions and libraries solely for
>> portability with ancient compilers? I'd say no, but YMMV. Boost will
>> be still around 2, 5, or 10 years from now. What's the utility of
>> adding such a _solely_ backwards oriented library from this POV?
> Indeed, I ask the community, do such libraries belong in Boost? If so, is
> the bar for acceptance of such libraries automatically and necessarily
> higher than libraries that introduce genuinely new capabilities in C++11?
> If so, what additional criteria must such a library meet?
>
>
Hi,

I think that there is a difference between Boost.Local and Boost.Move.
Boost.Move provides an emulation of a C++11 feature on compilers that
don't provides this feature.

Boost.Local provides an emulation of a feature that has not been
accepted to c++11.
Note that I'm not saying that Boost.Local should not be accepted, but
I'm sure that things will be different if Boost.Local provided an
emulation for c++11 lambdas, that is, if in c++11 compilers the macros
could be able to generate C++11 lambdas.

The question I have for the Boosters that don't like the local function
approach is if they will accept as a good approximation of the following
use of a lambda expression

std::sort(x, x + N, [](float a, float b) {return std::abs(a) <
std::abs(b); });

the storage on a temporary as in

auto cmp = [](float a, float b) {return std::abs(a) < std::abs(b); };
std::sort(x, x + N, cmp);

If Lorenzo would be able to define a macro that could be used to replace
the named lambda as in

BOOST_AUTO_LAMBDA(cmp, float a, float b, bool, ({return std::abs(a) <
std::abs(b); }));
std::sort(x, x + N, cmp);

could you consider that this is promoting good usage of C++11 features
on compilers that don't provide them and be a good candidate for a Boost
library?

Best,
Vicente


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