Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54638 - in sandbox/cloneable/libs/cloneable/doc/html: cloneable cloneable/containers cloneable/tutorial images
From: christian.schladetsch_at_[hidden]
Date: 2009-07-04 05:42:00


Author: cschladetsch
Date: 2009-07-04 05:41:59 EDT (Sat, 04 Jul 2009)
New Revision: 54638
URL: http://svn.boost.org/trac/boost/changeset/54638

Log:
added new pages

Added:
   sandbox/cloneable/libs/cloneable/doc/html/cloneable/containers/container_method_names.html (contents, props changed)
   sandbox/cloneable/libs/cloneable/doc/html/cloneable/containers/extended_object_hierarhcy.html (contents, props changed)
   sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers.html (contents, props changed)
   sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/cloneable_traits.html (contents, props changed)
   sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/controlling_construction.html (contents, props changed)
   sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/dealing_with_muliple_sub_objects.html (contents, props changed)
   sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/dealing_with_muliple_subobjects.html (contents, props changed)
Removed:
   sandbox/cloneable/libs/cloneable/doc/html/images/

Added: sandbox/cloneable/libs/cloneable/doc/html/cloneable/containers/container_method_names.html
==============================================================================
--- (empty file)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/containers/container_method_names.html 2009-07-04 05:41:59 EDT (Sat, 04 Jul 2009)
@@ -0,0 +1,108 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Container Method Names</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
+<link rel="home" href="../../index.html" title="Cloneable 0.1">
+<link rel="up" href="../containers.html" title="Containers">
+<link rel="prev" href="extended_object_hierarhcy.html" title="Extended Object Hierarhcy">
+<link rel="next" href="list.html" title="List">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="extended_object_hierarhcy.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../containers.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="list.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Container Method Names">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.containers.container_method_names"></a><a class="link" href="container_method_names.html" title="Container Method Names">Container
+ Method Names</a>
+</h3></div></div></div>
+<p>
+ To add an element of type <code class="computeroutput"><span class="identifier">Ty</span></code>
+ to any heterogenous container such as a <code class="computeroutput"><span class="identifier">list</span></code>,
+ <code class="computeroutput"><span class="identifier">vector</span></code> or <code class="computeroutput"><span class="identifier">set</span></code>
+ we use the following syntax:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="identifier">container</span><span class="special">.</span><span class="identifier">add_method_name</span><span class="special">&lt;</span><span class="identifier">Ty</span><span class="special">&gt;(</span><span class="identifier">a0</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">,...,</span> <span class="identifier">an</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ Specifically, we do not directly add an object to a heterogenous container.
+ Rather, we specify the type of thing to add, and provide any construction
+ arguments. This is true as well for specifying objects to search for in associative
+ containers:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="identifier">container</span><span class="special">.</span><span class="identifier">find</span><span class="special">&lt;</span><span class="identifier">Ty</span><span class="special">&gt;(</span><span class="identifier">a0</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">,...,</span> <span class="identifier">an</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ This creates a new object of type <code class="computeroutput"><span class="identifier">Ty</span></code>,
+ constructed with the provided arguments, and searches for it in the container.
+ But, I'm getting a little ahead of ourselves here - more on associative containers
+ later; let's look at that syntax again.
+ </p>
+<p>
+ The name for the method to add new objects to heterogenous sequence containers
+ has gone from being called <code class="computeroutput"><span class="identifier">push_back</span></code>
+ to <code class="computeroutput"><span class="identifier">emplace_back</span></code> to <code class="computeroutput"><span class="identifier">push_emplace_back</span></code> and back to <code class="computeroutput"><span class="identifier">push_back</span></code>. Similarly for associative containers
+ the names have varied from <code class="computeroutput"><span class="identifier">insert</span></code>
+ to <code class="computeroutput"><span class="identifier">emplace</span></code> to <code class="computeroutput"><span class="identifier">emplace_insert</span></code> and back to <code class="computeroutput"><span class="identifier">insert</span></code>.
+ </p>
+<p>
+ The C++0x containers have emplace methods that insert a new object after
+ a given iterator location, by passing construction arguments. These are called
+ <code class="computeroutput"><span class="identifier">emplace</span></code> methods.
+ </p>
+<p>
+ This is similar to the way that objects are added to heterogenous containers,
+ but not the same. For all heterogenous containers, the process is to specify
+ the type of thing and any creation arguments. There is no need to specify
+ an iterator, but there is a need to specify the type explicitly. This is
+ different to the C++0x containers, which do not require the type.
+ </p>
+<p>
+ For this reason the names have changed and are yet to be settled. All suggestions
+ for the names of the methods, or namespaces, are welcome. I am sure they'll
+ end up being called something like <code class="computeroutput"><span class="identifier">emplace_back</span></code>
+ rather than <code class="computeroutput"><span class="identifier">push_back</span></code>; but
+ the difference is that there is no <code class="computeroutput"><span class="identifier">push_back</span></code>
+ in a heterogenous container: everything is always <span class="emphasis"><em>emplaced</em></span>,
+ so this is one reason why I've been vasilating over the naming conventions
+ to use.
+ </p>
+<p>
+ With this in mind, let's visit the first container: the faithful list.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2009 Christian Schladetsch<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="extended_object_hierarhcy.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../containers.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="list.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/cloneable/libs/cloneable/doc/html/cloneable/containers/extended_object_hierarhcy.html
==============================================================================
--- (empty file)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/containers/extended_object_hierarhcy.html 2009-07-04 05:41:59 EDT (Sat, 04 Jul 2009)
@@ -0,0 +1,142 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Extended Object Hierarhcy</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
+<link rel="home" href="../../index.html" title="Cloneable 0.1">
+<link rel="up" href="../containers.html" title="Containers">
+<link rel="prev" href="../containers.html" title="Containers">
+<link rel="next" href="container_method_names.html" title="Container Method Names">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../containers.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../containers.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="container_method_names.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Extended Object Hierarhcy">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.containers.extended_object_hierarhcy"></a><a class="link" href="extended_object_hierarhcy.html" title="Extended Object Hierarhcy">Extended
+ Object Hierarhcy</a>
+</h3></div></div></div>
+<p>
+ This is the definitions we will use in the following examples. First, let's
+ look an a slightly extended base type for our Animal collection:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">Animal</span>
+<span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">age</span><span class="special">;</span>
+ <span class="identifier">string</span> <span class="identifier">name</span><span class="special">;</span>
+
+ <span class="identifier">Animal</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">years_old</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">age</span><span class="special">(</span><span class="identifier">years_old</span><span class="special">)</span> <span class="special">{</span> <span class="special">}</span>
+ <span class="identifier">Animal</span><span class="special">(</span><span class="identifier">string</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">years_old</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">age</span><span class="special">(</span><span class="identifier">years_old</span><span class="special">),</span> <span class="identifier">name</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">{</span> <span class="special">}</span>
+
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="keyword">const</span> <span class="identifier">Animal</span> <span class="special">&amp;</span><span class="identifier">left</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Animal</span> <span class="special">&amp;</span><span class="identifier">right</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">left</span><span class="special">.</span><span class="identifier">age</span> <span class="special">==</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">age</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;(</span><span class="keyword">const</span> <span class="identifier">Animal</span> <span class="special">&amp;</span><span class="identifier">left</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Animal</span> <span class="special">&amp;</span><span class="identifier">right</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">left</span><span class="special">.</span><span class="identifier">age</span> <span class="special">&lt;</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">age</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">struct</span> <span class="identifier">CompareNames</span>
+ <span class="special">{</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;(</span><span class="keyword">const</span> <span class="identifier">Animal</span> <span class="special">&amp;</span><span class="identifier">left</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Animal</span> <span class="special">&amp;</span><span class="identifier">right</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">left</span><span class="special">.</span><span class="identifier">name</span> <span class="special">&lt;</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">name</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">};</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ This is just a little more elaborate than the previous example hierarchy
+ we used earlier in the tutorial. We have added an <code class="computeroutput"><span class="identifier">age</span></code>
+ field for all animals, which is how old it is in years. Animals have relational
+ operators for testing equivalence and sorting. Another functor named <code class="computeroutput"><span class="identifier">CompareNames</span></code> is provided, which sorts by
+ the name field of animals rather than age.
+ </p>
+<p>
+ You are aware that getting your base class right is very important to the
+ strength and efficacy of the hierarchy as a whole. At a minimum, you must
+ of course use a virtual destructor. Getting the comparison operators right
+ is very important as well, but of course we can always add more sorting predicates
+ such as <code class="computeroutput"><span class="identifier">CompareNames</span></code> as needed.
+ </p>
+<p>
+ What we would like to avoid is having a so-called <span class="emphasis"><em>fat interface</em></span>
+ as the base class, which has a lot of extra information that is only relevant
+ to one or more derived types. Some of these issues can be addressed with
+ further use of interfaces and virtual methods to obtain sorting criteria.
+ </p>
+<p>
+ A full discussion on object-oriented design is beyond the scope of this brief
+ tutorial - and I'm sure you're very aware of the issues in any case. Suffice
+ to say that you should pay attention to how you design your base types. Always
+ use a virtual destructor, try to keep state to a minimum, and bear in mind
+ how you will want to compare objects.
+ </p>
+<p>
+ Moving on, we define our derived types:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">Cat</span> <span class="special">:</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">Cat</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="identifier">Cat</span><span class="special">(</span><span class="identifier">string</span> <span class="identifier">name</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">age</span> <span class="special">=</span> <span class="number">10</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">Animal</span><span class="special">(</span><span class="identifier">name</span><span class="special">,</span> <span class="identifier">age</span><span class="special">)</span> <span class="special">{</span> <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="keyword">struct</span> <span class="identifier">Dog</span> <span class="special">:</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">Dog</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="identifier">Dog</span><span class="special">(</span><span class="identifier">string</span> <span class="identifier">name</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">age</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">Animal</span><span class="special">(</span><span class="identifier">name</span><span class="special">,</span> <span class="identifier">age</span><span class="special">)</span> <span class="special">{</span> <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="keyword">struct</span> <span class="identifier">Labrador</span> <span class="special">:</span> <span class="identifier">Dog</span><span class="special">,</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">Labrador</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">is_guide_dog</span><span class="special">;</span>
+ <span class="identifier">Labrador</span><span class="special">(</span><span class="identifier">string</span> <span class="identifier">name</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">can_lead</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">age</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">Dog</span><span class="special">(</span><span class="identifier">name</span><span class="special">,</span> <span class="identifier">age</span><span class="special">),</span> <span class="identifier">is_guide_dog</span><span class="special">(</span><span class="identifier">can_lead</span><span class="special">)</span> <span class="special">{</span> <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ Labradors now have an extra field indicating that a given instance has been
+ trained as a guide dog, and each Animal type can be constructed by passing
+ its name and age. Note that there are no default constructors for any of
+ the Animal types.
+ </p>
+<p>
+ Feel free to return to this page to refresh your memory as we walk through
+ some examples that use these definitions.
+ </p>
+<p>
+ First, a preamble on names and semantics.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2009 Christian Schladetsch<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../containers.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../containers.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="container_method_names.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers.html
==============================================================================
--- (empty file)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers.html 2009-07-04 05:41:59 EDT (Sat, 04 Jul 2009)
@@ -0,0 +1,133 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Heterogenous Containers</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
+<link rel="home" href="../index.html" title="Cloneable 0.1">
+<link rel="up" href="../index.html" title="Cloneable 0.1">
+<link rel="prev" href="tutorial/cloneable_traits.html" title="Cloneable Traits">
+<link rel="next" href="heterogenous_containers/extended_object_hierarhcy.html" title="Extended Object Hierarhcy">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial/cloneable_traits.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="heterogenous_containers/extended_object_hierarhcy.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Heterogenous Containers">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="cloneable.heterogenous_containers"></a><a class="link" href="heterogenous_containers.html" title="Heterogenous Containers">Heterogenous Containers</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="heterogenous_containers/extended_object_hierarhcy.html">Extended
+ Object Hierarhcy</a></span></dt>
+<dt><span class="section"><a href="heterogenous_containers/container_method_names.html">Container
+ Method Names</a></span></dt>
+<dt><span class="section">List</span></dt>
+<dt><span class="section">Vector</span></dt>
+<dt><span class="section">Set</span></dt>
+<dt><span class="section">Map</span></dt>
+<dt><span class="section"><a href="heterogenous_containers/hashmap_and_hashset.html">HashMap
+ and HashSet</a></span></dt>
+</dl></div>
+<p>
+ This section of the tutorial presents the first glimpse of the so-called <span class="emphasis"><em>heterogenous
+ containers</em></span> provided by the Cloneable library. These are:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><code class="computeroutput"><span class="identifier">list</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span></code></li>
+<li class="listitem"><code class="computeroutput"><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span></code></li>
+<li class="listitem"><code class="computeroutput"><span class="identifier">deque</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span></code></li>
+<li class="listitem"><code class="computeroutput"><span class="identifier">chain</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">LinkLength</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span></code></li>
+<li class="listitem"><code class="computeroutput"><span class="identifier">map</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">Predicate</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span></code></li>
+<li class="listitem"><code class="computeroutput"><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">Predicate</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span></code></li>
+<li class="listitem"><code class="computeroutput"><span class="identifier">multimap</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span></code></li>
+<li class="listitem"><code class="computeroutput"><span class="identifier">multiset</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span></code></li>
+<li class="listitem"><code class="computeroutput"><span class="identifier">hash_map</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">Predicate</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span></code></li>
+<li class="listitem"><code class="computeroutput"><span class="identifier">hash_set</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">Predicate</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span></code></li>
+<li class="listitem">
+<code class="computeroutput"><span class="identifier">hash_multimap</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span></code>.
+ </li>
+<li class="listitem"><code class="computeroutput"><span class="identifier">hash_multiset</span><span class="special">&lt;</span><span class="identifier">Base</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span></code></li>
+</ul></div>
+<p>
+ All of these containers store pointers to objects. However, they each expose
+ their contained objects using value semantics. If this seems similar to <span class="bold"><strong>Boost.PtrContainer</strong></span>, that is not coincidental, as these
+ containers are based on a modified implementation of that library.
+ </p>
+<p>
+ You will have noted that each container is specialised over a <code class="computeroutput"><span class="identifier">Base</span></code> type, rather than a concrete derived
+ type. This is because they are intended to store base pointers.
+ </p>
+<p>
+ It may be surprising that <code class="computeroutput"><span class="identifier">map</span><span class="special">&lt;&gt;</span></code> takes only one type - the <code class="computeroutput"><span class="identifier">Base</span></code> type - of objects to store, rather than
+ the more familiar <span class="emphasis"><em>key</em></span> and <span class="emphasis"><em>mapped</em></span>
+ types. This is because a heterogenous map provides an association between objects
+ with the same base type.
+ </p>
+<p>
+ All heterogenous containers create objects to be added 'in place', in storage
+ created by the containers allocator. As such, to add a new object to a heterogenous
+ container, you provide the type and the construction arguments. Allocation
+ and construction is dealt with by the container, and, importantly, <span class="emphasis"><em>objects
+ are not copied into the container</em></span>:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="identifier">container</span><span class="special">.</span><span class="identifier">add_method</span><span class="special">&lt;</span><span class="identifier">Type</span><span class="special">&gt;(</span><span class="identifier">construction</span> <span class="identifier">args</span><span class="special">..);</span>
+</pre>
+<p>
+ </p>
+<p>
+ This means, for instance, that you can use non-default-constructable objects
+ in heterogenous vectors.
+ </p>
+<p>
+ It also means that you can use objects that do not or cannot have assignment
+ defined.
+ </p>
+<p>
+ Basically, as long as you can construct the object at all, you can use it in
+ a heterogenous container.
+ </p>
+<p>
+ Importantly, clones are guaranteed to be created using the same allocator as
+ that used to make the original objects.
+ </p>
+<p>
+ This is why it is important that you overload <code class="computeroutput"><span class="identifier">make_copy</span><span class="special">(</span><span class="identifier">abstract_allocator</span>
+ <span class="special">&amp;)</span> <span class="keyword">const</span></code>,
+ rather than the <code class="computeroutput"><span class="identifier">make_copy</span><span class="special">()</span>
+ <span class="keyword">const</span></code> method that does not take an allocator.
+ (<span class="emphasis"><em>Indeed, there is a good case to be made for removing this second
+ method from the library completely - CJS</em></span>).
+ </p>
+<p>
+ These containers will be presented in order, with some motivational examples
+ which combines them. First, we shall extend our little Animal hierarchy to
+ include an age member, and comparison operators.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2009 Christian Schladetsch<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial/cloneable_traits.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="heterogenous_containers/extended_object_hierarhcy.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/cloneable_traits.html
==============================================================================
--- (empty file)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/cloneable_traits.html 2009-07-04 05:41:59 EDT (Sat, 04 Jul 2009)
@@ -0,0 +1,73 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Cloneable Traits</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
+<link rel="home" href="../../index.html" title="Cloneable 0.1">
+<link rel="up" href="../tutorial.html" title="Tutorial">
+<link rel="prev" href="using_custom_allocators.html" title="Using Custom Allocators">
+<link rel="next" href="../heterogenous_containers.html" title="Heterogenous Containers">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="using_custom_allocators.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../heterogenous_containers.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Cloneable Traits">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.tutorial.cloneable_traits"></a><a class="link" href="cloneable_traits.html" title="Cloneable Traits">Cloneable Traits</a>
+</h3></div></div></div>
+<p>
+ This is mostly relevant to library maintainers and is not important otherwise.
+ </p>
+<p>
+ To assist with dealing with cloneable objects in other systems, the following
+ traits are provided:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">Base</span> <span class="special">{</span> <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">Base</span><span class="special">()</span> <span class="special">{</span> <span class="special">}</span> <span class="special">};</span>
+<span class="keyword">struct</span> <span class="identifier">T</span> <span class="special">:</span> <span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">};</span>
+<span class="keyword">struct</span> <span class="identifier">U</span> <span class="special">:</span> <span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">,</span> <span class="identifier">no_default_construction</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">};</span>
+<span class="keyword">struct</span> <span class="identifier">V</span> <span class="special">{</span> <span class="special">};</span>
+
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">(</span><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">is_cloneable</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">);</span>
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">(</span><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">is_cloneable</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">);</span>
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">(!</span><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">is_cloneable</span><span class="special">&lt;</span><span class="identifier">V</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">);</span>
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">(</span><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">has_base</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span><span class="identifier">Base</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">);</span>
+
+<span class="comment">//BOOST_STATIC_ASSERT(cloneable::is_default_constructable&lt;V&gt;::value); compile-time error: no traits
+</span><span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">(</span><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">is_default_constructable</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">);</span>
+<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">(!</span><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">is_default_constructable</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ More details are in the <code class="computeroutput"><span class="identifier">clonable</span><span class="special">::</span><span class="identifier">traits</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span></code>
+ structure.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2009 Christian Schladetsch<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="using_custom_allocators.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../heterogenous_containers.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/controlling_construction.html
==============================================================================
--- (empty file)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/controlling_construction.html 2009-07-04 05:41:59 EDT (Sat, 04 Jul 2009)
@@ -0,0 +1,106 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Controlling Construction</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
+<link rel="home" href="../../index.html" title="Cloneable 0.1">
+<link rel="up" href="../tutorial.html" title="Tutorial">
+<link rel="prev" href="simple_hierarchical_cloning.html" title="Simple Hierarchical Cloning">
+<link rel="next" href="using_external_types.html" title="Using External Types">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="simple_hierarchical_cloning.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="using_external_types.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Controlling Construction">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.tutorial.controlling_construction"></a><a class="link" href="controlling_construction.html" title="Controlling Construction">Controlling
+ Construction</a>
+</h3></div></div></div>
+<p>
+ We sometimes work with objects that cannot be default constructed. The Cloneable
+ system works with these types safely:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">Base</span> <span class="special">{</span> <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">Base</span><span class="special">()</span> <span class="special">{}</span> <span class="special">};</span>
+
+<span class="keyword">struct</span> <span class="identifier">T0</span> <span class="special">:</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">T0</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">,</span> <span class="identifier">no_default_construction_tag</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="identifier">string</span> <span class="special">&amp;</span><span class="identifier">str</span><span class="special">;</span>
+ <span class="identifier">T0</span><span class="special">(</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="identifier">s</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">str</span><span class="special">(</span><span class="identifier">s</span><span class="special">)</span> <span class="special">{</span> <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">T0</span></code> has a member that is a
+ reference and as such doesn't have a default constructor. To avoid compile-time
+ errors when using this type in the Cloneable libray, you must indicate that
+ it is not default-constructible by passing the <code class="computeroutput"><span class="identifier">no_default_construction_tag</span></code>
+ type as a parameter to cloneable::base&lt;&gt;. The order that you give the
+ base-type or tag-types to cloneable::base&lt;&gt; is not important and is
+ dealt with be the library.
+ </p>
+<p>
+ Putting this type to use:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">string</span> <span class="identifier">str</span> <span class="special">=</span> <span class="string">"foo"</span><span class="special">;</span>
+ <span class="identifier">T0</span> <span class="special">*</span><span class="identifier">p</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">T0</span><span class="special">(</span><span class="identifier">str</span><span class="special">);</span>
+ <span class="identifier">T0</span> <span class="special">*</span><span class="identifier">q</span> <span class="special">=</span> <span class="identifier">p</span><span class="special">-&gt;</span><span class="identifier">clone_as</span><span class="special">&lt;</span><span class="identifier">T0</span><span class="special">&gt;();</span>
+ <span class="identifier">assert</span><span class="special">(&amp;</span><span class="identifier">q</span><span class="special">-&gt;</span><span class="identifier">str</span> <span class="special">==</span> <span class="special">&amp;</span><span class="identifier">str</span><span class="special">);</span>
+
+ <span class="comment">// demonstrate that attempting to create
+</span> <span class="comment">// a new T0 instance without parameters
+</span> <span class="comment">// results in an exception of type no_default_construction
+</span> <span class="keyword">bool</span> <span class="identifier">caught</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">try</span>
+ <span class="special">{</span>
+ <span class="identifier">p</span><span class="special">-&gt;</span><span class="identifier">create_new</span><span class="special">();</span>
+ <span class="special">}</span>
+ <span class="keyword">catch</span> <span class="special">(</span><span class="identifier">no_default_construction</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">caught</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">caught</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ A <code class="computeroutput"><span class="identifier">no_default_construction</span></code>
+ exception is thrown if you attempt to default-construct a type that has no
+ default constructor.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2009 Christian Schladetsch<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="simple_hierarchical_cloning.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="using_external_types.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/dealing_with_muliple_sub_objects.html
==============================================================================
--- (empty file)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/dealing_with_muliple_sub_objects.html 2009-07-04 05:41:59 EDT (Sat, 04 Jul 2009)
@@ -0,0 +1,87 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Dealing with Muliple Sub-Objects</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
+<link rel="home" href="../../index.html" title="Cloneable 0.1">
+<link rel="up" href="../tutorial.html" title="Tutorial">
+<link rel="prev" href="using_external_types.html" title="Using External Types">
+<link rel="next" href="customising_the_cloning_process.html" title="Customising the Cloning Process">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="using_external_types.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="customising_the_cloning_process.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Dealing with Muliple Sub-Objects">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.tutorial.dealing_with_muliple_sub_objects"></a><a class="link" href="dealing_with_muliple_sub_objects.html" title="Dealing with Muliple Sub-Objects">Dealing
+ with Muliple Sub-Objects</a>
+</h3></div></div></div>
+<p>
+ When working with types that have multiple cloneable sub-objects, we must
+ use the <code class="computeroutput"><span class="identifier">clone_as</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span></code> and
+ <code class="computeroutput"><span class="identifier">create_as</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span></code> methods
+ to disambiguate which sub-type to clone or create.
+ </p>
+<p>
+ This is demonstrated below:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">Base</span> <span class="special">{</span> <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">Base</span><span class="special">()</span> <span class="special">{</span> <span class="special">}</span> <span class="special">};</span>
+<span class="keyword">struct</span> <span class="identifier">T0</span> <span class="special">:</span> <span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">T0</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">};</span>
+<span class="keyword">struct</span> <span class="identifier">T1</span> <span class="special">:</span> <span class="identifier">T0</span><span class="special">,</span> <span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">T1</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">};</span>
+<span class="keyword">struct</span> <span class="identifier">W</span> <span class="special">:</span> <span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">W</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">};</span>
+<span class="keyword">struct</span> <span class="identifier">T2</span> <span class="special">:</span> <span class="identifier">W</span><span class="special">,</span> <span class="identifier">T1</span><span class="special">,</span> <span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">T2</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">};</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">T2</span> <span class="special">*</span><span class="identifier">t2</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">T2</span><span class="special">();</span>
+
+ <span class="comment">// clone sub-objects
+</span> <span class="identifier">W</span> <span class="special">*</span><span class="identifier">t2_w</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">clone_as</span><span class="special">&lt;</span><span class="identifier">W</span><span class="special">&gt;();</span>
+ <span class="identifier">T1</span> <span class="special">*</span><span class="identifier">t2_t1</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">clone_as</span><span class="special">&lt;</span><span class="identifier">T1</span><span class="special">&gt;();</span>
+ <span class="identifier">T0</span> <span class="special">*</span><span class="identifier">t2_t0</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">clone_as</span><span class="special">&lt;</span><span class="identifier">T0</span><span class="special">&gt;();</span>
+
+ <span class="comment">// create sub-objects
+</span> <span class="identifier">W</span> <span class="special">*</span><span class="identifier">t2_w_new</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">create_as</span><span class="special">&lt;</span><span class="identifier">W</span><span class="special">&gt;();</span>
+ <span class="identifier">T1</span> <span class="special">*</span><span class="identifier">t2_t1_new</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">create_as</span><span class="special">&lt;</span><span class="identifier">T1</span><span class="special">&gt;();</span>
+ <span class="identifier">T0</span> <span class="special">*</span><span class="identifier">t2_t0_new</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">create_as</span><span class="special">&lt;</span><span class="identifier">T0</span><span class="special">&gt;();</span>
+
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ Note that if a sub-type S in type T is not default-constructabe, an exception
+ of type no_default_construction will be thrown if you attempt to default-create
+ a new S instance from a T instance.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2009 Christian Schladetsch<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="using_external_types.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="customising_the_cloning_process.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/dealing_with_muliple_subobjects.html
==============================================================================
--- (empty file)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/dealing_with_muliple_subobjects.html 2009-07-04 05:41:59 EDT (Sat, 04 Jul 2009)
@@ -0,0 +1,87 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Dealing with Muliple SubObjects</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
+<link rel="home" href="../../index.html" title="Cloneable 0.1">
+<link rel="up" href="../tutorial.html" title="Tutorial">
+<link rel="prev" href="using_external_types.html" title="Using External Types">
+<link rel="next" href="customising_the_cloning_process.html" title="Customising the Cloning Process">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="using_external_types.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="customising_the_cloning_process.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Dealing with Muliple SubObjects">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.tutorial.dealing_with_muliple_subobjects"></a><a class="link" href="dealing_with_muliple_subobjects.html" title="Dealing with Muliple SubObjects">Dealing
+ with Muliple SubObjects</a>
+</h3></div></div></div>
+<p>
+ When dealing with types that have multiple cloneable sub-objects, we must
+ use the <code class="computeroutput"><span class="identifier">clone_as</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span></code> and
+ <code class="computeroutput"><span class="identifier">create_as</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span></code> methods
+ to disambiguate which sub-type to clone or create.
+ </p>
+<p>
+ This is demonstrated below:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">Base</span> <span class="special">{</span> <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">Base</span><span class="special">()</span> <span class="special">{</span> <span class="special">}</span> <span class="special">};</span>
+<span class="keyword">struct</span> <span class="identifier">T0</span> <span class="special">:</span> <span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">T0</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">};</span>
+<span class="keyword">struct</span> <span class="identifier">T1</span> <span class="special">:</span> <span class="identifier">T0</span><span class="special">,</span> <span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">T1</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">};</span>
+<span class="keyword">struct</span> <span class="identifier">W</span> <span class="special">:</span> <span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">W</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">};</span>
+<span class="keyword">struct</span> <span class="identifier">T2</span> <span class="special">:</span> <span class="identifier">W</span><span class="special">,</span> <span class="identifier">T1</span><span class="special">,</span> <span class="identifier">base</span><span class="special">&lt;</span><span class="identifier">T2</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">};</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">T2</span> <span class="special">*</span><span class="identifier">t2</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">T2</span><span class="special">();</span>
+
+ <span class="comment">// clone sub-objects
+</span> <span class="identifier">W</span> <span class="special">*</span><span class="identifier">t2_w</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">clone_as</span><span class="special">&lt;</span><span class="identifier">W</span><span class="special">&gt;();</span>
+ <span class="identifier">T1</span> <span class="special">*</span><span class="identifier">t2_t1</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">clone_as</span><span class="special">&lt;</span><span class="identifier">T1</span><span class="special">&gt;();</span>
+ <span class="identifier">T0</span> <span class="special">*</span><span class="identifier">t2_t0</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">clone_as</span><span class="special">&lt;</span><span class="identifier">T0</span><span class="special">&gt;();</span>
+
+ <span class="comment">// create sub-objects
+</span> <span class="identifier">W</span> <span class="special">*</span><span class="identifier">t2_w_new</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">create_as</span><span class="special">&lt;</span><span class="identifier">W</span><span class="special">&gt;();</span>
+ <span class="identifier">T1</span> <span class="special">*</span><span class="identifier">t2_t1_new</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">create_as</span><span class="special">&lt;</span><span class="identifier">T1</span><span class="special">&gt;();</span>
+ <span class="identifier">T0</span> <span class="special">*</span><span class="identifier">t2_t0_new</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-&gt;</span><span class="identifier">create_as</span><span class="special">&lt;</span><span class="identifier">T0</span><span class="special">&gt;();</span>
+
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ Note that if a sub-type S in type T is not default-constructabe, an exception
+ of type no_default_construction will be thrown if you attempt to default-create
+ a new S instance from a T instance.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2009 Christian Schladetsch<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="using_external_types.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="customising_the_cloning_process.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</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