Boost logo

Boost :

Subject: Re: [boost] boost::bind result type
From: Daniel Walker (daniel.j.walker_at_[hidden])
Date: 2010-07-22 22:06:43


On Tue, Jul 20, 2010 at 8:46 PM, David Abrahams <dave_at_[hidden]> wrote:
>
> On Jul 20, 2010, at 7:43 PM, Daniel Walker wrote:
>
>> The patch is far from complete and only works for two argument binds,
>> but you get the idea. I basically just adapted David's return type
>> solution and made it a member type of boost::function. Thanks David!
>
> Once you have that, why bother with function<>?

I suppose there's some stylistic appeal to having a single, common
tool for storing functions. Less to learn and remember, maybe, easier
maintenance: e.g. once you see "function<>" in someone else's code,
you know what it's doing without having to look in a manuel, a single
grep for "function" can retrieve all the stored function objects in a
project, etc.

Of course, another question is, once you have auto, why bother with
function<>? But function<> could still be useful for a long time
during the transition to the next standard and for maintaining legacy
code. In that respect, extending function<> to handle more of the use
cases of auto could also be helpful.

Daniel Walker


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