diff --git a/shared_ptr.htm b/shared_ptr.htm index 0cc77d2..71cb9c9 100644 --- a/shared_ptr.htm +++ b/shared_ptr.htm @@ -106,6 +106,7 @@ void bad() shared_ptr(); // never throws template<class Y> explicit shared_ptr(Y * p); template<class Y, class D> shared_ptr(Y * p, D d); + template<class Y, class D, class A> shared_ptr(Y * p, D d, A a); ~shared_ptr(); // never throws shared_ptr(shared_ptr const & r); // never throws @@ -120,6 +121,7 @@ void bad() void reset(); // never throws template<class Y> void reset(Y * p); template<class Y, class D> void reset(Y * p, D d); + template<class Y, class D, class A> void reset(Y * p, D d, A a); T & operator*() const; // never throws T * operator->() const; // never throws @@ -203,15 +205,20 @@ void bad() The current implementation uses a different mechanism, enable_shared_from_this, to solve the "shared_ptr from this" problem.]
-template<class Y, class D> shared_ptr(Y * p, D d);+ +
template<class Y, class D> shared_ptr(Y * p, D d); +template<class Y, class D, class A> shared_ptr(Y * p, D d, A a);
Requirements: p must be convertible to T *. D must be CopyConstructible. The copy constructor and destructor of D must not throw. The expression
d(p)
must be - well-formed, must not invoke undefined behavior, and must not throw exceptions. + well-formed, must not invoke undefined behavior, and must not throw exceptions. + A must be an Allocator, as described in section 20.1.5 (Allocator + requirements) of the C++ Standard.Effects: Constructs a shared_ptr that owns the pointer - p and the deleter d.
+ p and the deleter d. The second constructor allocates + memory using a copy of a.Postconditions:
use_count() == 1 && get() == p
.Throws: std::bad_alloc, or an implementation-defined exception when a resource other than memory could not be obtained.
@@ -317,6 +324,10 @@ q = p;+Effects: Equivalent to
shared_ptr(p, d).swap(*this)
.template<class Y, class D, class A> void reset(Y * p, D d, A a);++Effects: Equivalent to
+shared_ptr(p, d, a).swap(*this)
.indirection
T & operator*() const; // never throws