From: Darin Adler (darin_at_[hidden])
Date: 1999-12-29 12:20:32
> To avoid this problem, I've placed "no-throwing" restrictions on
> FunctionObject construction/destruction/assignment. So I assume assign
> can't throw, and you assume swap won't throw. So either we say FO can't
> throw on assign or FO can't throw on swap.
After your explanation, it's clear to me that your auto objects must be
constructed without throwing any exception. The reason for this is that auto
objects implement only the release of a resource, and the acquisition of the
resource typically has taken place before constructing the auto object.
This means that it's reasonable to require non-throwing constructors and
assignment operators. That should be made explicit and highlighted in both
the header and the documentation since a throwing constructor in the
function object is an easy way to accidentally misuse the class.
But in your message, you equate non-throwing assignment with non-throwing
swap. I want to emphasize that a non-throwing assignment is a much stronger
requirement than a non-throwing swap. The standard library swap is always
non-throwing if copy construction, destruction, and assignment are
non-throwing. But a non-throwing swap can be provided for classes where a
non-throwing constructor or assignment operator would be impossible.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk