From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2006-01-09 10:45:53


On Jan 9, 2006, at 10:13 AM, Peter Dimov wrote:

> Douglas Gregor wrote:
>> On Jan 9, 2006, at 7:18 AM, Peter Dimov wrote:
>>
>>> Even if I did, bind(&X::f, &x, _1, true) would still overflow the
>>> 12 byte buffer. ;-)
>>
>> Why? Does it need more than the 8-byte member pointer and 4-byte
>> pointer?
>
> The 'true' needs to be stored somewhere.

*Smacks forehead*
I didn't see the true, because I was assuming that you had written
bind(&X::f, &x, _1) :)

Anyway, we're going to have a cutoff somewhere, The curse of the SBO
is that at some point your objects don't fit into the small buffer
any more, so you have a jump in your performance curve. If we go to
16 bytes, then bind(&X::f, &x, _1, true) will fit but bind(&X::f, &x,
_1, true, true) won't. The member pointer + "this" pointer case seems
like the one that users would most expect to work well. It goes head-
to-head with delegates, closures, and other similar extensions, with
the added benefit of keeping boost::function down to 16 bytes. It
just feels like the right cutoff for the buffer size.

        Doug