Boost logo

Boost :

Subject: Re: [boost] [function] function wrapping with noexceptionsafetyguarantee
From: Domagoj Saric (dsaritz_at_[hidden])
Date: 2010-10-30 13:24:54

"Daniel Walker" <daniel.j.walker_at_[hidden]> wrote in message

> So, I think the current boost::function implementation is certainly
> the right default, since many users would not appreciate doubling the
> static space overhead for a time savings of less than 10% per call.

I already explained to you that there is no 'double space overhead' with the
condition that the change is done right or the linker is able to merge
identical objects, neither of which is true in the case you posted.
The 'double' overhead you got is actually not 'double' but one unnecessary
vtable extra:
 - even in your implementation, if you assigned more (different typed)
targets to a boost::function you'd get an additional vtable for each of
those (different typed) the overhead, as said, is not double
but one extra...
 - the problem with your implementation is that you copied the original
assign() member function for your new "empty target" function copying with
it the local static do it right the vtable must not be a local
(template) function static...

Not to mention, as also already explained in more detail (and pointed to by
Nevin), this 'overhead' of a few static pointers is completely insignificant
compared to various related code bloat issues...

"What Huxley teaches is that in the age of advanced technology, spiritual
devastation is more likely to come from an enemy with a smiling face than
from one whose countenance exudes suspicion and hate."
Neil Postman 

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