Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-01-28 14:49:30


On Monday 28 January 2002 12:46 pm, you wrote:
> David Abrahams wrote:
> > As an optimization, it should be possible to detect free and
> > member function arguments to the constructor of function<>
> > and treat them as though they were passed with ref(),
> > eliminating the need for dynamic allocations in many
> > cases.
>
> I had that same idea for a while as well. FWIW, if 'boost::function<>'
> didn't perform dynamic allocation on something as simple as 'f =
> boost::bind(&my::foo, this)' (and provided a non-throw guarantee for such
> operations), we would have switched to it long time ago :).

I'd love to here more opinions on whether this is a worthwhile optimization.
The speed demon on my right shoulder says it'd be great to cover a relatively
common case without allocating memory, but the devil on my left shoulder is
poking me in the neck to remind me of the 33% increase in the size of
boost::function objects.

        Doug


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