Boost logo

Boost :

Subject: Re: [boost] [function] function wrapping with no exceptionsafetyguarantee
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-10-30 13:55:17


On Sat, Oct 30, 2010 at 9:43 AM, Daniel Walker
<daniel.j.walker_at_[hidden]> wrote:
> Yes, if you look at the code in the benchmark, you will see that it is
> measuring the cost of a call to a non-empty boost::function. In
> optimized object code, the call is 4% faster without the check, but
> removing the check means that it is necessary to store a special,
> internal static object per instantiation to hold an "empty" function
> that must be available if boost::function becomes empty.

Do you really need a placeholder for each different boost::function signature?

Since all it does is throw an exception, it should be safe to use the
same placeholder for all signatures: http://codepad.org/3GxiTHZA.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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