From 89435a6287ac8d157dc08ef38b33865073e1b355 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 27 Jul 2002 16:02:26 +0000 Subject: [PATCH] get_pointer added. [SVN r14628] --- shared_ptr.htm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/shared_ptr.htm b/shared_ptr.htm index dc0c2cb..1333f73 100644 --- a/shared_ptr.htm +++ b/shared_ptr.htm @@ -135,6 +135,8 @@ void bad() template<typename T> void swap(shared_ptr<T> & a, shared_ptr<T> & b); // never throws + template<typename T> T * get_pointer(shared_ptr<T> const & p); // never throws + template<typename T, typename U> shared_ptr<T> shared_static_cast(shared_ptr<U> const & r); // never throws template<typename T, typename U> @@ -424,7 +426,7 @@ q = p;

The rest of the comparison operators are omitted by design.]

swap

template<typename T>
-  void swap(shared_ptr<T> & a, shared_ptr<T> & b) // never throws
+ void swap(shared_ptr<T> & a, shared_ptr<T> & b); // never throws

Effects: Equivalent to a.swap(b).

Throws: nothing.

@@ -434,6 +436,15 @@ q = p;

[swap is defined in the same namespace as shared_ptr as this is currently the only legal way to supply a swap function that has a chance to be used by the standard library.]

+

get_pointer

+
template<typename T>
+  T * get_pointer(shared_ptr<T> const & p); // never throws
+
+

Returns: p.get().

+

Throws: nothing.

+

Notes: Provided as an aid to generic programming. Used by + mem_fn.

+

shared_static_cast

template<typename T, typename U>
   shared_ptr<T> shared_static_cast(shared_ptr<U> const & r); // never throws
@@ -634,7 +645,7 @@ int * p = a.release(); implementation or a linked list implementation, or some other specific implementation. This is not the intent.


-

Revised +

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