From: Niels Dekker - mail address until 2008-12-31 (nd_mail_address_valid_until_2008-12-31_at_[hidden])
Date: 2008-02-22 04:56:26
Arvid Norberg wrote:
> I was quite surprised to realize that boost::function<>::swap can
> throw in case a memory allocation fails.
> Is this intentional or a known issue?
> The TR1 function<>::swap is specified not to throw.
Pete Becker once explained at comp.std.c++:
> [requiring a non-throwing swap] precludes a small-object optimization
> for std::tr1::function. If its swap member function is allowed to
> exceptions then it can hold small function objects internally rather
> than putting them on the free store
Please check out the discussion at comp.std.c++, September 2006, Re: Is
a Swappable class allowed to throw an exception?
Still I would appreciate having a non-throwing swap for
boost::function... But at least the Standard and the Boost library
should be in sync! Are you going to make a ticket on this issue?
-- Niels Dekker http://www.xs4all.nl/~nd/dekkerware Scientific programmer at LKEB, Leiden University Medical Center
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk