Boost logo

Boost :

Subject: Re: [boost] Rave for proposed Boost.Local (functions)
From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2011-02-04 17:03:37


Thomas Heller wrote:
> Gregory Crosswhite wrote:
> > To my mind this example looks a lot clearer if you reformat it as follows:
> >
> > BOOST_LOCAL_FUNCTION(
> > (void) (add)(
> > (double)(num)
> > (const bind)((factor))
> > (bind)((&sum))
> > )
> > ) {
> > sum += factor * num;
> > std::clog<< "Summed: "<< sum<< std::endl;
> > } BOOST_LOCAL_FUNCTION_END(add)
> > add(100.0);
>
> As far is a am concerned, I still find this syntax overly verbose.
> I do realize though that this is just a toy example. For better comparison,
> Here is how the same thing would like in Boost.Phoenix:

Steven and I were playing with different syntaxes few years ago

We came up with something like this:

    void BOOST_LOCAL_FUNCTION
        ( BOOST_BIND((factor)(&sum)), double num )
    {
        sum += factor * num;
        std::clog<< "Summed: "<< sum<< std::endl;
    }
    BOOST_LOCAL_FUNCTION_DECL(add)

http://thread.gmane.org/gmane.comp.lib.boost.devel/168612/focus=168694

Alex


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