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 10:50:05


On Fri, Nov 25, 2011 at 2:33 AM, Thomas Klimpel
<Thomas.Klimpel_at_[hidden]> wrote:
> Dean Michael Berris wrote:
>> What are you talking about?
>>
>> There's *exactly* the same number of lines in a local function as
>> there is with a class/namespace function. What am I missing?
>
> I'm actually also asking myself what I'm missing. Everybody seems to claim that a namespace function provides the same functionality as a local function.
>
> I know that I can use a "namespace functor" (i.e. a class that implements an "operator()" member function) instead of a local function. I guess I could also use Boost.Phoenix (or a similar library) to adapt a "namespace function" to provide the same functionality as a local function.
>
> Should I understand the claim that a "namespace function" provides the same functionality as Boost.Local in this way, or is there something simpler that I'm missing?
>

namespace foo {
  void function_bar(int a, int b) {
    // do something with a & b
  }
  void function_baz() {
    function_bar(1, 2);
  }
}

as opposed to:

namespace foo {
  void function_baz() {
    BOOST_LOCAL_FUNCTION(function_bar, (int a), (int b)) {
      // do something with a & b
    } BOOST_LOCAL_FUNCTION_END
    function_bar(1, 2);
  }
}

It's not that complicated.

The first approach is the way we've been doing it with normal C++. It
works. It's not broken.

I don't see why we'd ever need Boost.Local at all.

Cheers

-- 
Dean Michael Berris
http://goo.gl/CKCJX

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