diff --git a/shared_ptr.htm b/shared_ptr.htm index 6b5aa1c..d08ff7f 100644 --- a/shared_ptr.htm +++ b/shared_ptr.htm @@ -196,7 +196,29 @@ void bad()

[This constructor has been changed to a template in order to remember the actual pointer type passed. The destructor will call delete with the same pointer, complete with its original type, even when T does - not have a virtual destructor, or is void.]

+ not have a virtual destructor, or is void.

+

In the current implementation, if p is convertible to counted_base + *, shared_ptr will use the embedded reference + count supplied by counted_base. This is an (experimental) + attempt to provide a way for shared_ptr to be constructed from + a raw pointer such as this. A free function shared_from_this(q) + performs the conversion when q is convertible to counted_base + const *.

+

The optional intrusive counting employed by the current implementation allows + shared_ptr to interoperate with intrusive_ptr, an + experimental generic intrusive-counted smart pointer.

+

Another possible implementation is to use a global pointer-to-count map instead + of intrusive counting. shared_from_this would no longer be + O(1), which is a concern for some users, although I do not expect any + performance problems, since the operation is rare. Maintaining a global + map is difficult; it needs to be initialized before any shared_ptr + instances are constructed, and the initialization needs to be thread safe. + In addition, under the Windows dynamic library model, it is possible for + several maps to exist.

+

It is not yet clear which implementation should be used, or whether the + specification should allow both; nevertheless, the ability to make a shared_ptr + from this is considered essential by experienced smart + pointer users.]

template<typename Y, typename D> shared_ptr(Y * p, D d);

Requirements: p must be convertible to T *. The copy @@ -605,7 +627,8 @@ int * p = a.release(); implementation or a linked list implementation, or some other specific implementation. This is not the intent.


-

Revised 23 July 2002

+

Revised + 23 July 2002

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. Copyright 2002 Peter Dimov. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in