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:01:24

On Fri, Nov 25, 2011 at 9:33 PM, Lorenzo Caminiti <lorcaminiti_at_[hidden]> wrote:
> On Thu, Nov 24, 2011 at 9:58 PM, Dean Michael Berris
> <mikhailberis_at_[hidden]> wrote:
>>>>> namespace foo {
>>>>>   void non_local_function(int i, bool b, long l, std::string const & s)
> Actually, I have tried to rework this example so I don't have to
> specify the type of i, b, l and I wasn't able too (without starting to
> re-implement the type deduction mechanisms that Local uses). Can you
> please show me how you will do that without the explicit bound types?
> (That will make maintenance easier given that you don't need to change
> the "local function" if you change the bound variable types which is
> true for any closure.)

Phoenix functions. Look it up. 'nuf said.

>> 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
>> out?
> For C++03 which does not support lambdas. Again there other Boost
> libraries that implement C++11 features for C++03, why would the
> situation be different for Local?

Precisely because there are already libraries in Boost that do exactly
what Local does, which is why it makes 0 sense to have yet another
one. Phoenix v3 can supersede Boost.Lambda now as it's a superset of
Boost.Lambda functionality.

Now if it was the case the Boost didn't have Phoenix, Bind, and
Lambda, and that C++11 doesn't have lambda's built into the language,
and if you couldn't absolutely program in C++ effectively without
local functions, then maybe Boost.Local would make sense as a very
narrow but still I would argue marginally useful library. But the
situation now is different which is why you're getting opposition at

>> 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
> It's not already there in C++03 because in C++03 you cannot 1) declare
> a function locally, 2) binding variables, and 3) using statement
> syntax for its body. However, I see you statement that yo don't care
> about 1-2-3. So the point it is not that it's that 1-2-3 are already
> in C++03, because they are not, it is instead that you (personally)
> don't need 1-2-3.

It's not that I personally don't need 1-2-3, it's that thousands and
thousands of C++ programmers have lived without local function
approximations -- and for those that do want in-lined function
generation Boost already has Phoenix. Heck even before Phoenix/Bind
people (including me) have been creating function objects to be used
as arguments for STL algorithms, and guess what: it works and it's

If the rejection of N2511 in favor of the current lambda is any
indication, even the committee finds that local functions an
unnecessary complication. What makes you think that bringing N2511
back into C++03 would even make sense especially since there are
already approximations to C++11 lambda's?

It's logic really:

  1) C++11 lambda > N2511
  2) Since Phoenix ~ (C++11 lambda + more) and Local ~ N2511
  3) Therefore, Phoenix > N2511
  4) QED



PS. I am in no way a contributor nor author of *anything* in Phoenix.

Dean Michael Berris

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