
Christopher Jefferson wrote:
I'd vote for keeping scoped_ptr as simple as possible, even removing that swap, and directing people who want more power to unique_ptr.
I'd like to keep swap(). If the coder wants to disable it, wouldn't 'const scoped_ptr' suffice? If I have a class that supports assignment, and my class uses scoped_ptr to manage some resource, Herb Sutter's exception-safe assignment operator still applies: 1. Construct a new stack scoped_ptr with the incoming resource. An exception here leaves *this unmolested. 2. Swap the member scoped_ptr with the new scoped_ptr. (swap() is guaranteed not to throw.) 3. Leaving the assignment-operator method body destroys the temp stack scoped_ptr, releasing the member scoped_ptr's previous data.