Ticket #1897: make_shared_doc.patch
File make_shared_doc.patch, 4.3 KB (added by , 14 years ago) |
---|
-
libs/smart_ptr/shared_ptr.htm
90 90 shared_ptr </STRONG>constructor if <STRONG>g</STRONG> throws an exception. 91 91 See <A href="http://www.gotw.ca/gotw/056.htm">Herb Sutter's treatment</A> (also <A href="http://www.cuj.com/reference/articles/2002/0212/0212_sutter.htm"> 92 92 here</A>) of the issue for more information.</P> 93 <P>The exception safety problem described above may also be eliminated by using 94 the <a href="make_shared.html"><code>make_shared</code></a> 95 or <a href="make_shared.html"><code>allocate_shared</code></a> 96 factory functions defined in boost/make_shared.hpp. These factory functions also provide 97 an efficiency benefit by consolidating allocations.<P> 93 98 <h2><a name="Synopsis">Synopsis</a></h2> 94 99 <pre>namespace boost { 95 100 -
libs/smart_ptr/smart_ptr.htm
22 22 keep track of dynamically allocated objects shared by multiple owners.</p> 23 23 <p>Conceptually, smart pointers are seen as owning the object pointed to, and thus 24 24 responsible for deletion of the object when it is no longer needed.</p> 25 <p>The smart pointer library provides five smart pointer class templates:</p> 25 <p>The smart pointer library provides six smart pointer class templates, plus 26 efficient factory functions for <code>shared_ptr</code>:</p> 26 27 <div align="left"> 27 28 <table border="1" cellpadding="4" cellspacing="0"> 28 29 <tr> … … 38 39 <tr> 39 40 <td><a href="shared_ptr.htm"><b>shared_ptr</b></a></td> 40 41 <td><a href="../../boost/shared_ptr.hpp"><boost/shared_ptr.hpp></a></td> 41 <td>Object ownership shared among multiple pointers </td>42 <td>Object ownership shared among multiple pointers.</td> 42 43 </tr> 43 44 <tr> 44 45 <td><a href="shared_array.htm"><b>shared_array</b></a></td> … … 61 62 <p>They are examples of the "resource acquisition is initialization" idiom 62 63 described in Bjarne Stroustrup's "The C++ Programming Language", 3rd edition, 63 64 Section 14.4, Resource Management.</p> 65 <p>Additionally, the smart pointer library provides efficient factory functions 66 for creating <code>shared_ptr</code> objects:</p> 67 <div align="left"> 68 <table border="1" cellpadding="4" cellspacing="0"> 69 <tr> 70 <td><a href="make_shared.html"><b>make_shared and allocate_shared</b></a></td> 71 <td><a href="../../boost/make_shared.hpp"><boost/make_shared.hpp></a></td> 72 <td>Efficient creation of <code>shared_ptr</code> objects.</td> 73 </tr> 74 </table> 75 </div> 64 76 <p>A test program, <a href="test/smart_ptr_test.cpp">smart_ptr_test.cpp</a>, is 65 77 provided to verify correct operation.</p> 66 78 <p>A page on <a href="compatibility.htm">compatibility</a> with older versions of … … 130 142 number of suggestions resulting in numerous improvements.</p> 131 143 <p>October 1998. Beman Dawes proposed reviving the original semantics under the 132 144 names <b>safe_ptr</b> and <b>counted_ptr</b>, meeting of Per Andersson, Matt 133 Austern, Greg Colvin, Sean Corfield, Pete Becker, Nico Josuttis, Dietmar K ühl,145 Austern, Greg Colvin, Sean Corfield, Pete Becker, Nico Josuttis, Dietmar Kühl, 134 146 Nathan Myers, Chichiang Wan and Judy Ward. During the discussion, the four new 135 147 class names were finalized, it was decided that there was no need to exactly 136 148 follow the <b>std::auto_ptr</b> interface, and various function signatures and … … 156 168 as to run various timings of the direct and indirect approaches, and found that 157 169 at least on Intel Pentium chips there was very little measurable difference. 158 170 Kevlin Henney provided a paper he wrote on "Counted Body Techniques." Dietmar 159 K ühl suggested an elegant partial template specialization technique to allow171 Kühl suggested an elegant partial template specialization technique to allow 160 172 users to choose which implementation they preferred, and that was also 161 173 experimented with.</p> 162 174 <p>But Greg Colvin and Jerry Schwarz argued that "parameterization will discourage