Boost logo

Boost :

Subject: Re: [boost] New libraries implementing C++11 features in C++03
From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2011-11-25 06:21:52

On Fri, Nov 25, 2011 at 10:11 PM, Lorenzo Caminiti
<lorcaminiti_at_[hidden]> wrote:
> On Fri, Nov 25, 2011 at 5:44 AM, Dean Michael Berris
> <mikhailberis_at_[hidden]> wrote:
>> On Fri, Nov 25, 2011 at 9:20 PM, Lorenzo Caminiti <lorcaminiti_at_[hidden]> wrote:
>>> b) Other libraries like the recently reviewed Boost.Algorithm and
>>> Boost.Atomic implement C++11 features for C++03. I would expect the
>>> ability of Boost.Local to implement C++11 named lambdas (i.e., local
>>> functions) for C++03 to be just as valuable. Why wouldn't it?
>> There's a difference between a back-port like in the case of
>> Boost.Algorithm, Boost.Atomic, and Boost.Unique_ptr, drop-in
>> (forwardable) approximations like Boost.Move, and a very narrow and
>> marginally useful approximation like what Boost.Local provides. Does
>> that make it clearer?
> No, it is not clear to me why you think that there a difference. Can
> you please list your arguments?

I hope you're not just being facetious here.

> For example, why is there a difference
> with respect to Boost.Algorithm so to be specific.

Anyway, I shall indulge you.

> My understanding is that you'd answer:
> 1) Because Boost.Algorithm all_of is useful but Boost.Local local
> functions are not.

Good guess, but no cigar.

Boost.Algorithm collects the C++11 algorithms and makes them available
to C++03 *as is*. Boost.Local attempts to implement something that
C++11 lambda's are perfectly capable of doing and there are already
existing libraries that approximate C++11 lambdas in Boost (and do
even more). Boost.Local even has an overlap with Boost.Scoped_exit.

In general terms:

* back-port is exactly what it means, bringing code that's written for
a future version of software (usually libraries and/or software
packages) to a previous version as an enhancement.
* drop-in approximations are solutions that approximate functionality
in a future version to a previous version (like Boost.Move for
example, in C++03 it performs some tricks that are otherwise
unnecessary in C++11, but in C++11 mode can just forward to std::move
without losing semantics).

Boost.Local is *neither* of these.

> 2) Because Boost.Algorithm all_of uses exactly the same API as C++11
> while Boost.Local uses macros.


See above.

> Is my understanding correct?


> Is there more?

Yes, but I rather not elaborate as I really want to crawl under a rock now.


Dean Michael Berris

Boost list run by bdawes at, gregod at, cpdaniel at, john at