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-24 21:58:16

On Fri, Nov 25, 2011 at 7:36 AM, Lorenzo Caminiti <lorcaminiti_at_[hidden]> wrote:
> On Thu, Nov 24, 2011 at 12:56 PM, Thomas Klimpel
> <Thomas.Klimpel_at_[hidden]> wrote:
>> Dean Michael Berris wrote:
>>> Or better yet, works now:
>>> namespace foo {
>>>   void non_local_function(int i, bool b, long l, std::string const & s)
>>> {
>>>     // do what I want here.
>>>   }
>>>   void f(std::vector<double> const &v) {
>>>     int i;
>>>     bool b;
>>>     long l;
>>>     for_each(begin(v), end(v), bind(&non_local_function, i, b, l, _1));
>>>   }
>>> }
>>> See, no voodoo required here.
>> To be honest, this one really looks nice and convincing. I find it even looks nicer than the C++11 Lambda. And as you wrote in response to Lorenzo:
>>> But I did show a solution that works in both C++03 and C++11 which is
>>> to use bind to do it and a non-local function. Phoenix already enables
> As you say this solution, which works on both C++03 and C++11, does
> not implement a local function. N2511 indicates one prospective
> arguing maintenance and readability benefits when the function can be
> declared locally, e.g., just above the for_each in this case. That is
> not possible in your example. That's what Boost.Local does instead.
> (Note that with your example above you also explicitly specified the
> bound types but I'm sure you can workaround that with templates so I'm
> not arguing this point as an issue.)

Am I missing something here, N2511 was sent in 2008 and lambda's
already are in C++11 which already encompass the capabilities defined
in N2511. Why do we keep coming back to N2511 when C++11 is already

The first assertion that I have an issue with is that "we need local
functions". C++03 and certainly C++11 are *fine* without local
functions. I have yet to see a convincing argument for that basic

> Now, it is really OK if you think that local functions are not needed.

Which I do think they're not needed.

> IMO, as a user you should be fully empowered to use or not a library
> based on your personal preferences and the needs of your problem
> domain.

Indeed. I don't discount this fact.

> As for the library under review, as I said, the reviewers have
> directly spoken to the question of whether local functions are or not
> useful:
>> - What is your evaluation of the potential usefulness of the library?

If you really want to know, I think there's absolutely 0 potential
usefulness of this library given what's already there in C++03 and
C++11 to be included in Boost.


Dean Michael Berris

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