Glen Knowles
From: Victor A. Wagner, Jr. [mailto:vawjr@rudbek.com]
At Monday 2003-08-18 14:43, you wrote:
What's the rational for the requirement that ~pointee() be no throw? Instead of nothrow could it have been specified that shared_ptr functions throw only if ~pointee() throws?
This is also something that could go in the docs (assuming I didn't simply miss it).
the ramifications of having any destructor throw are too horrible to contemplate. Well, maybe not "too horrible" but several articles have been written on the ensuing problems.
This may be true, and I have read a few articles on the subject, but "too horrible to comtemplate" isn't exactly a rational.
The shared_ptr docs are the wrong place for that, because similar requirements that user-supplied types have non-throwing destructors exist in most template code anywhere. Indeed, it's an implicit assumption of nearly all of the Boost libraries, which should probably be spelled out explicitly in one place. It isn't the smart pointer library's job, nor even Boost's job to explain this general principle though.
A simple statement in the common requirements that it is deemed too error prone would be helpful.
But it wouldn't be accurate. Having a throwing destructor is not just prone to errors; it *is* an error (except in a very few special cases which could probably be handled better in another way). -- Dave Abrahams Boost Consulting www.boost-consulting.com