Ticket #1897: make_shared_doc.2.patch
File make_shared_doc.2.patch, 4.2 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 fivesmart pointer class templates:</p>25 <p>The smart pointer library provides six smart pointer class templates:</p> 26 26 <div align="left"> 27 27 <table border="1" cellpadding="4" cellspacing="0"> 28 28 <tr> … … 38 38 <tr> 39 39 <td><a href="shared_ptr.htm"><b>shared_ptr</b></a></td> 40 40 <td><a href="../../boost/shared_ptr.hpp"><boost/shared_ptr.hpp></a></td> 41 <td>Object ownership shared among multiple pointers </td>41 <td>Object ownership shared among multiple pointers.</td> 42 42 </tr> 43 43 <tr> 44 44 <td><a href="shared_array.htm"><b>shared_array</b></a></td> … … 61 61 <p>They are examples of the "resource acquisition is initialization" idiom 62 62 described in Bjarne Stroustrup's "The C++ Programming Language", 3rd edition, 63 63 Section 14.4, Resource Management.</p> 64 <p>Additionally, the smart pointer library provides efficient factory functions 65 for creating <code>shared_ptr</code> objects:</p> 66 <div align="left"> 67 <table border="1" cellpadding="4" cellspacing="0"> 68 <tr> 69 <td><a href="make_shared.html"><b>make_shared and allocate_shared</b></a></td> 70 <td><a href="../../boost/make_shared.hpp"><boost/make_shared.hpp></a></td> 71 <td>Efficient creation of <code>shared_ptr</code> objects.</td> 72 </tr> 73 </table> 74 </div> 64 75 <p>A test program, <a href="test/smart_ptr_test.cpp">smart_ptr_test.cpp</a>, is 65 76 provided to verify correct operation.</p> 66 77 <p>A page on <a href="compatibility.htm">compatibility</a> with older versions of … … 130 141 number of suggestions resulting in numerous improvements.</p> 131 142 <p>October 1998. Beman Dawes proposed reviving the original semantics under the 132 143 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,144 Austern, Greg Colvin, Sean Corfield, Pete Becker, Nico Josuttis, Dietmar Kühl, 134 145 Nathan Myers, Chichiang Wan and Judy Ward. During the discussion, the four new 135 146 class names were finalized, it was decided that there was no need to exactly 136 147 follow the <b>std::auto_ptr</b> interface, and various function signatures and … … 156 167 as to run various timings of the direct and indirect approaches, and found that 157 168 at least on Intel Pentium chips there was very little measurable difference. 158 169 Kevlin Henney provided a paper he wrote on "Counted Body Techniques." Dietmar 159 K ühl suggested an elegant partial template specialization technique to allow170 Kühl suggested an elegant partial template specialization technique to allow 160 171 users to choose which implementation they preferred, and that was also 161 172 experimented with.</p> 162 173 <p>But Greg Colvin and Jerry Schwarz argued that "parameterization will discourage