From 868062e81d851daddc799fba54e0072110708dcf Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Wed, 15 Jan 2003 16:35:48 +0000 Subject: [PATCH] Add TOC and References sections [SVN r16912] --- smart_ptr.htm | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/smart_ptr.htm b/smart_ptr.htm index ac8a96f..6873980 100644 --- a/smart_ptr.htm +++ b/smart_ptr.htm @@ -7,6 +7,13 @@

c++boost.gif (8819 bytes)Smart Pointers

+

Introduction
+ Common Requirements
+ Exception Safety
+ Exception-specifications
+ History and Acknowledgements
+ References

+

Introduction

Smart pointers are objects which store pointers to dynamically allocated (heap) objects. They behave much like built-in C++ pointers except that they automatically delete the object pointed to at the appropriate time. Smart @@ -79,7 +86,7 @@ these idioms.

Note that scoped_ptr requires that T be a complete type at destruction time, but shared_ptr does not.

-

Exception Safety

+

Exception Safety

Several functions in these smart pointer classes are specified as having "no effect" or "no effect except such-and-such" if an exception is thrown. This means that when an exception is thrown by an object of one of these classes, @@ -90,7 +97,7 @@ 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

+

Exception-specifications

Exception-specifications are not used; see exception-specification rationale.

All the smart pointer templates contain member functions which can never throw @@ -100,7 +107,7 @@

Functions which destroy objects of the pointed to type are prohibited from throwing exceptions by the common requirements.

-

History and Acknowledgements

+

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. See the compatibility page for a summary of the @@ -114,18 +121,11 @@

September 1999. Luis Coelho provided shared_ptr::swap and shared_array::swap

May 1999. In April and May, 1999, Valentin Bonnard and David Abrahams made a number of suggestions resulting in numerous improvements.

-

October 1998. In 1994 Greg Colvin proposed to the C++ Standards Committee - classes named auto_ptr and counted_ptr which were very similar to - what we now call scoped_ptr and shared_ptr. The committee - document was 94-168/N0555, Exception Safe Smart Pointers. In one of the very - few cases where the Library Working Group's recommendations were not followed - by the full committee, counted_ptr was rejected and surprising - transfer-of-ownership semantics were added to auto_ptr.

-

Beman Dawes proposed reviving the original semantics under the names safe_ptr - and counted_ptr at an October, 1998, meeting of Per Andersson, Matt +

October 1998. Beman Dawes proposed reviving the original semantics under the names safe_ptr + and counted_ptr, meeting of Per Andersson, Matt Austern, Greg Colvin, Sean Corfield, Pete Becker, Nico Josuttis, Dietmar Kühl, Nathan Myers, Chichiang Wan and Judy Ward. During the discussion, the four - class names were finalized, it was decided that there was no need to exactly + new class names were finalized, it was decided that there was no need to exactly follow the std::auto_ptr interface, and various function signatures and semantics were finalized.

Over the next three months, several implementations were considered for shared_ptr, @@ -154,10 +154,26 @@ experimented with.

But Greg Colvin and Jerry Schwarz argued that "parameterization will discourage users", and in the end we choose to supply only the direct implementation.

+

Summer, 1994. Greg Colvin proposed to the C++ Standards Committee + classes named auto_ptr and counted_ptr which were very similar to + what we now call scoped_ptr and shared_ptr. + [Col-94] In one of the very + few cases where the Library Working Group's recommendations were not followed + by the full committee, counted_ptr was rejected and surprising + transfer-of-ownership semantics were added to auto_ptr.

+

References

+

[Col-94] Gregory Colvin, + + Exception Safe Smart Pointers, C++ committee document 94-168/N0555, + July, 1994.

+

[E&D-94] John R. Ellis & David L. Detlefs, + + Safe, Efficient Garbage Collection for C++, Usenix Proceedings, + February, 1994. This paper includes an extensive discussion of weak + pointers and an extensive bibliography.


Revised - 4 February 200215 January 2003

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. Permission to copy, use, modify, sell and distribute this document is granted @@ -165,4 +181,4 @@ "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.

- + \ No newline at end of file