From e32b2adfdad2cecd088a29fa6f5c5eff036618ca Mon Sep 17 00:00:00 2001
From: Peter Dimov
The class template is parameterized on T, the type of the object pointed - to. T must meet the smart pointer + to. T must meet the smart pointer common requirements.
namespace boost { @@ -40,7 +40,7 @@ typedef T element_type; explicit scoped_array(T * p = 0); // never throws - ~scoped_array(); // never throws + ~scoped_array(); // never throws void reset(T * p = 0); // never throws @@ -62,23 +62,23 @@explicit scoped_array(T * p = 0); // never throwsConstructs a scoped_array, storing a copy of p, which must have been allocated via a C++ new[] expression or be 0. T is not - required be a complete type. See the smart pointer + required be a complete type. See the smart pointer common requirements.
-destructor
+destructor
~scoped_array(); // never throwsDeletes the array pointed to by the stored pointer. Note that delete[] on a pointer with a value of 0 is harmless. The guarantee that this does not throw exceptions depends on the requirement that the deleted array's objects' - destructors do not throw exceptions. See the smart pointer + destructors do not throw exceptions. See the smart pointer common requirements.
reset
void reset(T * p = 0); // never throws-If p is not equal to the stored pointer, deletes the array pointed to by the - stored pointer and then stores a copy of p, which must have been allocated via - a C++ new[] expression or be 0. The guarantee that this does not throw - exceptions depends on the requirement that the deleted array's objects' - destructors do not throw exceptions. See the smart pointer - common requirements.
++ Deletes the array pointed to by the stored pointer and then stores a copy of p, + which must have been allocated via a C++ new[] expression or be 0. The + guarantee that this does not throw exceptions depends on the requirement that + the deleted array's objects' destructors do not throw exceptions. See the smart + pointer common requirements.
subscripting
T & operator[](std::ptrdiff_t i) const; // never throwsReturns a reference to element i of the array pointed to by the stored @@ -88,11 +88,11 @@
get
T * get() const; // never throwsReturns the stored pointer. T need not be a complete type. See the smart - pointer common requirements.
+ pointer common requirements.swap
void swap(scoped_array & b); // never throwsExchanges the contents of the two smart pointers. T need not be a - complete type. See the smart pointer common + complete type. See the smart pointer common requirements.
Free Functions
swap
diff --git a/scoped_ptr.htm b/scoped_ptr.htm index 53815c7..148cd42 100644 --- a/scoped_ptr.htm +++ b/scoped_ptr.htm @@ -29,7 +29,7 @@ allocated array. See scoped_array for that usage.The class template is parameterized on T, the type of the object pointed - to. T must meet the smart pointer + to. T must meet the smart pointer common requirements.
Synopsis
namespace boost { @@ -62,7 +62,7 @@explicit scoped_ptr(T * p = 0); // never throwsConstructs a scoped_ptr, storing a copy of p, which must have been allocated via a C++ new expression or be 0. T is not required be - a complete type. See the smart pointer common + a complete type. See the smart pointer common requirements.
destructor
~scoped_ptr(); // never throws@@ -71,15 +71,15 @@The guarantee that this does not throw exceptions depends on the requirement that the deleted object's destructor does not throw exceptions. See the smart - pointer common requirements.
+ pointer common requirements.reset
void reset(T * p = 0); // never throws-If p is not equal to the stored pointer, deletes the object pointed to by the - stored pointer and then stores a copy of p, which must have been allocated via - a C++ new expression or be 0. The guarantee that this does not throw - exceptions depends on the requirement that the deleted object's destructor does - not throw exceptions. See the smart pointer - common requirements.
++ Deletes the object pointed to by the stored pointer and then stores a copy of + p, which must have been allocated via a C++ new expression or be 0. The + guarantee that this does not throw exceptions depends on the requirement that + the deleted object's destructor does not throw exceptions. See the smart + pointer common requirements.
indirection
T & operator*() const; // never throwsReturns a reference to the object pointed to by the stored pointer. Behavior is @@ -89,11 +89,11 @@
get
T * get() const; // never throwsReturns the stored pointer. T need not be a complete type. See the smart - pointer common requirements.
+ pointer common requirements.swap
void swap(scoped_ptr & b); // never throwsExchanges the contents of the two smart pointers. T need not be a - complete type. See the smart pointer common + complete type. See the smart pointer common requirements.
Free Functions
swap
diff --git a/smart_ptr.htm b/smart_ptr.htm index 9e5357a..ac8a96f 100644 --- a/smart_ptr.htm +++ b/smart_ptr.htm @@ -56,7 +56,7 @@ versions of the smart pointer implementation.A page on smart pointer timings will be of interest to those curious about performance issues.
-Common Requirements
+Common Requirements
These smart pointer class templates have a template parameter, T, which specifies the type of the object pointed to by the smart pointer. The behavior of the smart pointer templates is undefined if the destructor or operator delete @@ -87,7 +87,7 @@ which resulted in the exception being thrown. This amounts to a guarantee that there are no detectable side effects. Other functions never throw exceptions. The only exception ever thrown by functions which do throw (assuming T meets - the common requirements) is std::bad_alloc, + the common requirements) is std::bad_alloc, and that is thrown only by functions which are explicitly documented as possibly throwing std::bad_alloc.
Exception-specifications
@@ -99,7 +99,7 @@ // never throws.Functions which destroy objects of the pointed to type are prohibited from - throwing exceptions by the common requirements.
+ throwing exceptions by the common requirements.History and Acknowledgements
January 2002. Peter Dimov reworked all four classes, adding features, fixing bugs, and splitting them into four separate headers, and added weak_ptr. @@ -156,7 +156,7 @@ users", and in the end we choose to supply only the direct implementation.
Revised +--> 4 February 2002
Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler.