Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2002-01-28 14:12:52

Peter Dimov wrote:
> > 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 :).
> The "small string" optimization?

Something like this :). That would be a generalization of the idea. Our
current implementation just detects the special case of member function
pointer being bounded to the corresponding object pointer (e.g. 'this'), and
stores these two pointers only, not the function object.

> But how would function<> ensure the proper
> alignment for the function object type?

That shouldn't be hard if we wanted it. After all, we have
'boost::alignment_of', Fernando Cacciola's "aligned_storage.hpp" (somewhere
in the vault, I believe), and Andrei's paper - - seems to provide a
solution as well.


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