mirror of
https://github.com/boostorg/smart_ptr.git
synced 2026-04-20 00:28:45 +02:00
Smart pointer and utility changes related to adding checked_delere and checked_array_delete
[SVN r10189]
This commit is contained in:
@@ -59,19 +59,27 @@ template<typename T> class scoped_array : <a href="../utility/utility.htm#
|
||||
<pre>explicit scoped_array( T* p=0 ); // never throws</pre>
|
||||
<p>Constructs a <tt>scoped_array</tt>, storing a copy of <tt>p</tt>, which must
|
||||
have been allocated via a C++ <tt>new</tt>[] expression or be 0.</p>
|
||||
<p><b>T</b> is not required be a complete type at point of instantiation.
|
||||
See <a href="smart_ptr.htm#Common requirements">Common Requirements</a>.</p>
|
||||
<h3><a name="scoped_array_~scoped_array">scoped_array destructor</a></h3>
|
||||
<pre>~scoped_array();</pre>
|
||||
<p><b>T</b> is required be a complete type at point of instantiation. See <a href="smart_ptr.htm#Common requirements">Common
|
||||
Requirements</a>.</p>
|
||||
<p>Deletes the array pointed to by the stored pointer. Note that in C++ <tt>delete</tt>[]
|
||||
on a pointer with a value of 0 is harmless.</p>
|
||||
<p>Does not throw exceptions.</p>
|
||||
<h3>scoped_array <a name="scoped_array_reset">reset</a></h3>
|
||||
<pre>void reset( T* p=0 )();</pre>
|
||||
<p><b>T</b> is required be a complete type at point of instantiation. See <a href="smart_ptr.htm#Common requirements">Common
|
||||
Requirements</a>.</p>
|
||||
<p>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++ <tt>new[]</tt> expression or be 0.</p>
|
||||
<p>Does not throw exceptions.</p>
|
||||
<h3>scoped_array <a name="scoped_array_operator[]">operator[]</a></h3>
|
||||
<p><tt>T& operator[](std::size_t i) const; // never throws</tt></p>
|
||||
<p><b>T</b> is required be a complete type at point of instantiation. See <a href="smart_ptr.htm#Common requirements">Common
|
||||
Requirements</a>.</p>
|
||||
<p>Returns a reference to element <tt>i</tt> of the array pointed to by the
|
||||
stored pointer.</p>
|
||||
<p>Behavior is undefined (and almost certainly undesirable) if <tt>get()==0</tt>,
|
||||
@@ -79,6 +87,8 @@ or if <tt>i</tt> is less than 0 or is greater or equal to the number of elements
|
||||
in the array.</p>
|
||||
<h3>scoped_array <a name="scoped_array_get">get</a></h3>
|
||||
<pre>T* get() const; // never throws</pre>
|
||||
<p><b>T</b> is not required be a complete type at point of instantiation.
|
||||
See <a href="smart_ptr.htm#Common requirements">Common Requirements</a>.</p>
|
||||
<p>Returns the stored pointer.</p>
|
||||
<h2>Class <a name="shared_array_example">scoped_array example</a></h2>
|
||||
<p>[To be supplied. In the meantime, see <a href="smart_ptr_test.cpp">smart_ptr_test.cpp</a>.]</p>
|
||||
|
||||
Reference in New Issue
Block a user