|
Boost : |
Subject: Re: [boost] [function] function wrapping and exception safety recap
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-10-11 13:06:20
On Mon, Oct 11, 2010 at 7:49 AM, Domagoj Saric
<domagoj.saric_at_[hidden]> wrote:
>
> "Emil Dotchevski" <emil_at_[hidden]> wrote in message
> news:AANLkTin=9rdwNqHQZRAPj9=9YngdTD0mX7zQ8S1LmhQm_at_mail.gmail.com...
>>
>> On Sat, Oct 9, 2010 at 12:38 PM, Daniel Walker
>> <daniel.j.walker_at_[hidden]> wrote:
>>>
>>> Finally, there have been suggestions to alter boost::function's
>>> exception safety guarantee directly through either policies or
>>> constructor options.
>>
>> We used to have an Allocator parameter to the boost::function template
>> and it was removed (just in time for this change to also be reflected
>> in C++0x) to reduce coupling. Adding any policies to boost::function
>> would undo all of the benefits of that change.
>
> What (de)coupling (and the related benefits) are you referring to? The ABI
> compatibility/stability and safe cross .DLL/.so passing arguments also used
> for the justification of the hardcoded dynamic deleter in shared_ptr or
> something else?
Yes, that ability is a result of the reduced coupling. One of the main
objectives of boost::function is type erasure: being able to hold on
to functions without knowing their exact type, and the allocator
policy directly interfered with that.
Also, with the removal of the default Allocator parameter of the main
boost::function template, it is possible to define APIs in terms of
boost::function without including boost/function.hpp; just a
declaration in the API header suffices:
namespace boost { template <class> function; }
void foo( boost::function<void()> const & );
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