Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71431 - sandbox/pack_ptr/libs/smart_ptr/doc
From: phil_at_[hidden]
Date: 2011-04-23 02:51:15


Author: pbouchard
Date: 2011-04-23 02:51:14 EDT (Sat, 23 Apr 2011)
New Revision: 71431
URL: http://svn.boost.org/trac/boost/changeset/71431

Log:
* Added tutorial
Added:
   sandbox/pack_ptr/libs/smart_ptr/doc/tutorial.html (contents, props changed)
Text files modified:
   sandbox/pack_ptr/libs/smart_ptr/doc/index.html | 2 ++
   1 files changed, 2 insertions(+), 0 deletions(-)

Modified: sandbox/pack_ptr/libs/smart_ptr/doc/index.html
==============================================================================
--- sandbox/pack_ptr/libs/smart_ptr/doc/index.html (original)
+++ sandbox/pack_ptr/libs/smart_ptr/doc/index.html 2011-04-23 02:51:14 EDT (Sat, 23 Apr 2011)
@@ -68,6 +68,8 @@
 
     <dt>Rationale</dt>
 
+ <dt>Tutorial</dt>
+
     <dt>Acknowledgments</dt>
   </dl>
   <hr>

Added: sandbox/pack_ptr/libs/smart_ptr/doc/tutorial.html
==============================================================================
--- (empty file)
+++ sandbox/pack_ptr/libs/smart_ptr/doc/tutorial.html 2011-04-23 02:51:14 EDT (Sat, 23 Apr 2011)
@@ -0,0 +1,117 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charpack=us-ascii">
+ <link rel="stylesheet" type="text/css" href="http://www.boost.org/doc/libs/1_46_1/boost.css">
+
+ <title>Pack Pointer - Tutorial - Boost 1.46.1</title>
+<link rel="icon" href="http://www.boost.org/favicon.ico" type="image/ico"><link rel="stylesheet" type="text/css" href="http://www.boost.org/style-v2/section-basic.css"></head>
+
+<body link="#0000FF" vlink="#800080"> <div id="boost-common-heading-doc">
+ <div class="heading-inner">
+ <div class="heading-placard"></div>
+
+ <h1 class="heading-title">
+ <a href="http://www.boost.org/">
+ <img src="http://www.boost.org/gfx/space.png" alt= "Boost C++ Libraries" class="heading-logo" />
+ <span class="heading-boost">Boost</span>
+ <span class="heading-cpplibraries">C++ Libraries</span>
+ </a></h1>
+
+ <p class="heading-quote">
+ <q>...one of the most highly
+ regarded and expertly designed C++ library projects in the
+ world.</q> <span class="heading-attribution">&mdash; <a href=
+ "http://www.gotw.ca/" class="external">Herb Sutter</a> and <a href=
+ "http://en.wikipedia.org/wiki/Andrei_Alexandrescu" class="external">Andrei
+ Alexandrescu</a>, <a href=
+ "http://safari.awprofessional.com/?XmlId=0321113586" class="external">C++
+ Coding Standards</a></span></p>
+
+ <div class="heading-sections">
+ <ul>
+ <li class="welcome-section-tab">Welcome</li>
+
+ <li class="boost-section-tab">Introduction</li>
+
+ <li class="community-section-tab">Community</li>
+
+ <li class="development-section-tab"><a href=
+ "/development/">Development</a></li>
+
+ <li class="support-section-tab">Support</li>
+
+ <li class="doc-section-tab">Documentation</li>
+
+ <li class="map-section-tab">Index</li>
+ </ul>
+ </div>
+</div>
+ </div>
+
+ <div id="boost-common-heading-doc-spacer"></div>
+
+
+ <h1 align="center">Pack Pointer</h1>
+
+ <h2 align="center">Tutorial</h2>
+ <dl class="index">
+ <dt>Basic</dt>
+
+ <dt>Advanced</dt>
+ </dl>
+
+ <h2><a name="basic" id="basic"></a>Basic</h2>
+
+ <p>Pack Pointer was designed to be easy to use and to be versatile in terms of object variants it can refer to. Its only requirement is limited to the usage
+ of a special type needed to instanciate objects referred to. For example:</p>
+
+ <pre>
+ pack_ptr&#60;int&#62; p = new pack&#60;int&#62;(11);
+ </pre>
+
+ <p>Will instanciate a special object <i>pack&#60;int&#62;</i> having an integer as one of its member. The pointer to the object is then passed to the
+ <i>pack_ptr&#60;int&#62;</i> that will manage its existence and later destroy and deallocate it when it is found to be no longer referenced.<p>
+
+ <p>Variants of the object type can also be used. In order to instanciate an array of integer for example, all that will be needed is to change the
+ type to the following:<p>
+
+ <pre>
+ pack_ptr&#60;int[10]&#62; p = new pack&#60;int[10]&#62;();
+ </pre>
+
+ See the following example for different cases of its usage.
+
+ <h2><a name="advanced" id="advanced"></a>Advanced</h2>
+
+ <p>When STL containers are made out of objects having members of type <i>pack_ptr&#60;T&#62;</i> then it will be desirable to have all of the allocated nodes
+ and its members part of the same <i>pack</i>. This way all of the newly allocated <i>pack_ptr&#60;T&#62;</i> will be referring to the same <i>pack</i> header.
+ In order to do so, we must tell the container in question a new allocator that will be used to instanciate the nodes. This allocator is called:
+ <i>pack_allocator&#60;T&#62;</i>. For example:</p>
+
+ <pre>
+ list&#60; pack_ptr&#60;int&#62;, pack_allocator&#60; pack_ptr&#60;int&#62; &#62; &#62; c;
+ c.push_back(new pack&#60;int&#62;(11));
+ </pre>
+
+ <hr>
+
+ <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
+ "http://www.boost.org/doc/libs/1_46_1/doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
+ height="31" width="88"></a></p>
+
+ <p>Revised
+ <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->22
+ April, 2011<!--webbot bot="Timestamp" endspan i-checksum="38514" --></p>
+
+ <p><i>Copyright &copy; 2011 <a href=
+ "mailto:philippeb8_at_[hidden]">Phil Bouchard</a></i></p>
+
+ <p><i>Distributed under the Boost Software License, Version 1.0. (See
+ accompanying file LICENSE_1_0.txt or
+ copy at <a href=
+ "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt>)</i></p>
+</body>
+</html>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk