Boost logo

Boost :

Subject: Re: [boost] New libraries implementing C++11 features in C++03
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-11-25 05:20:47

On Thu, Nov 24, 2011 at 9:53 PM, Dean Michael Berris
<mikhailberis_at_[hidden]> wrote:
> On Fri, Nov 25, 2011 at 7:15 AM, Lorenzo Caminiti <lorcaminiti_at_[hidden]> wrote:
>> Hi Michael and thank you for bring my attention back to your original
>> reply on this topic.
>> On Wed, Nov 23, 2011 at 1:04 AM, Dean Michael Berris
>> <mikhailberis_at_[hidden]> wrote:
>>> So applying my logic to the discussion on Boost.Local, I see it as
>>> doing a not-so-good job of doing #1
>> Let me understand better your point. Is this because Boost.Local
>> functions cannot be declared within expressions while C++11 lambdas
>> can?
> Yes and a lot more. It's because Boost.Local functions aren't real
> local functions and because it doesn't do anything that C++11 lambdas
> don't already do.
>>> while falling short in #2. If
>> Again, let me understand your point better. Is this because
>> Boost.Local functions use macros?
> Not just that. It's also because it's trying to approximate something
> limited as compared to what C++11 already has.

a) OK, I think I understand. My reply if that if Boost.Local does not
approximate well C++11 lambdas because it cannot be define within
expressions, it instead approximates well named lambdas which are
closures defined at declaration scope:

int a;
auto localf = [&a](int z) {
    ... // lots of instructions here

This C++11 construct is well approximated by the following in C++03:

int a;
void BOOST_LOCAL_FUNCTION(int z, bind& a) {
    ... // lots of instructions here

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?


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