|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54808 - in sandbox/cloneable/libs/cloneable/doc/html: . cloneable
From: christian.schladetsch_at_[hidden]
Date: 2009-07-08 16:10:31
Author: cschladetsch
Date: 2009-07-08 16:10:31 EDT (Wed, 08 Jul 2009)
New Revision: 54808
URL: http://svn.boost.org/trac/boost/changeset/54808
Log:
updated
Text files modified:
sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers.html | 431 +++++++++++++++++++++++
sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial.html | 704 +++++++++++++++++++++++++++++++++++++++
sandbox/cloneable/libs/cloneable/doc/html/index.html | 76 ++-
sandbox/cloneable/libs/cloneable/doc/html/standalone_HTML.manifest | 17
4 files changed, 1149 insertions(+), 79 deletions(-)
Modified: sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers.html
==============================================================================
--- sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers.html (original)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers.html 2009-07-08 16:10:31 EDT (Wed, 08 Jul 2009)
@@ -6,38 +6,37 @@
<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">
+<link rel="prev" href="tutorial.html" title="Tutorial">
</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 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>
+<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>
+<a accesskey="p" href="tutorial.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>
</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
+<dt><span class="section"><a href="heterogenous_containers.html#cloneable.heterogenous_containers.extended_object_hierarhcy">Extended
Object Hierarhcy</a></span></dt>
-<dt><span class="section"><a href="heterogenous_containers/container_method_names.html">Container
+<dt><span class="section"><a href="heterogenous_containers.html#cloneable.heterogenous_containers.container_method_names">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/heterogenous_map.html">Heterogenous
+<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.html#cloneable.heterogenous_containers.heterogenous_map">Heterogenous
Map</a></span></dt>
-<dt><span class="section"><a href="heterogenous_containers/hashmap_and_hashset.html">HashMap
+<dt><span class="section"><a href="heterogenous_containers.html#cloneable.heterogenous_containers.hashmap_and_hashset">HashMap
and HashSet</a></span></dt>
</dl></div>
<p>
@@ -106,7 +105,7 @@
</p>
<div class="note" title="Note"><table border="0" summary="Note">
<tr>
-<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/html/images/note.png"></td>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/html/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
@@ -127,6 +126,404 @@
which combines them. First, we shall extend our little Animal hierarchy to
include an age member, and comparison operators.
</p>
+<div class="section" title="Extended Object Hierarhcy">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.heterogenous_containers.extended_object_hierarhcy"></a><a class="link" href="heterogenous_containers.html#cloneable.heterogenous_containers.extended_object_hierarhcy" 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 at a slightly extended base type for our Animal hierarchy:
+ </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">&</span><span class="identifier">left</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Animal</span> <span class="special">&</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"><(</span><span class="keyword">const</span> <span class="identifier">Animal</span> <span class="special">&</span><span class="identifier">left</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Animal</span> <span class="special">&</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">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"><(</span><span class="keyword">const</span> <span class="identifier">Animal</span> <span class="special">&</span><span class="identifier">left</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Animal</span> <span class="special">&</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"><</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, indicating 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"><</span><span class="identifier">Cat</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">></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"><</span><span class="identifier">Dog</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">></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"><</span><span class="identifier">Labrador</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">></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>
+<div class="section" title="Container Method Names">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.heterogenous_containers.container_method_names"></a><a class="link" href="heterogenous_containers.html#cloneable.heterogenous_containers.container_method_names" 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"><</span><span class="identifier">Ty</span><span class="special">>(</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"><</span><span class="identifier">Ty</span><span class="special">>(</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, searches for it in the container,
+ then destroys it. This means that you can store, and search for objects that
+ are not default constructable and/or do not have an assignment operator.
+ But, I'm getting a little ahead of ourselves here - more on associative containers
+ later.
+ </p>
+<div class="blockquote"><blockquote class="blockquote">
+<p>
+ </p>
+<p>
+ <span class="bold"><strong><span class="emphasis"><em><span class="quote">“<span class="quote">Aside: 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>. 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. 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. 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 emplaced, so this is
+ one reason why I've been vacillating over the naming conventions to use</span>”</span></em></span></strong></span>
+ </p>
+<p>
+ </p>
+<p>
+ -- CJS
+ </p>
+<p>
+ </p>
+</blockquote></div>
+<p>
+ With this in mind, let's visit the first container: the faithful list.
+ </p>
+</div>
+<div class="section" title="List">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.heterogenous_containers.list"></a><a class="link" href="heterogenous_containers.html#cloneable.heterogenous_containers.list" title="List">List</a>
+</h3></div></div></div>
+<p>
+ The first heterogenous container we'll look at is the <code class="computeroutput"><span class="identifier">list</span></code>.
+ It is very much like a standard <code class="computeroutput"><span class="identifier">list</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span></code>.
+ But it is also very different:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">heterogenous</span><span class="special">::</span><span class="identifier">list</span><span class="special"><</span><span class="identifier">Animal</span><span class="special">></span> <span class="identifier">List</span><span class="special">;</span>
+
+<span class="identifier">List</span> <span class="identifier">list</span><span class="special">;</span>
+<span class="identifier">list</span><span class="special">.</span><span class="identifier">push_back</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="string">"sam"</span><span class="special">,</span> <span class="number">12</span><span class="special">);</span>
+<span class="identifier">list</span><span class="special">.</span><span class="identifier">push_back</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="string">"spot"</span><span class="special">,</span> <span class="number">8</span><span class="special">);</span>
+<span class="identifier">list</span><span class="special">.</span><span class="identifier">push_back</span><span class="special"><</span><span class="identifier">Labrador</span><span class="special">>(</span><span class="string">"max"</span><span class="special">,</span> <span class="number">14</span><span class="special">);</span>
+
+<span class="identifier">List</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="identifier">list</span><span class="special">;</span>
+
+<span class="keyword">const</span> <span class="identifier">Labrador</span> <span class="special">&</span><span class="identifier">lab</span> <span class="special">=</span> <span class="identifier">list</span><span class="special">.</span><span class="identifier">back_as</span><span class="special"><</span><span class="identifier">Labrador</span><span class="special">>();</span>
+<span class="identifier">assert</span><span class="special">(</span><span class="identifier">lab</span><span class="special">.</span><span class="identifier">name</span> <span class="special">==</span> <span class="string">"max"</span> <span class="special">&&</span> <span class="identifier">lab</span><span class="special">.</span><span class="identifier">age</span> <span class="special">==</span> <span class="number">14</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ The first thing you may notice is the strange way we add new items to a list.
+ All heterogenous containers use <span class="emphasis"><em>emplace</em></span> semantics for
+ searching for existing objects or adding new objects.
+ </p>
+<p>
+ For now, it will be enough to absorb the <span class="emphasis"><em>emplacement syntax</em></span>
+ for adding new elements, and to note that the cloned list called <code class="computeroutput"><span class="identifier">copy</span></code> made a deep copy of the list; the
+ underlying base pointers were not just copied - they were cloned.
+ </p>
+</div>
+<div class="section" title="Vector">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.heterogenous_containers.vector"></a><a class="link" href="heterogenous_containers.html#cloneable.heterogenous_containers.vector" title="Vector">Vector</a>
+</h3></div></div></div>
+<p>
+ The vector gets the same treatment as lists, with the same syntax for adding
+ new elements, but also some extra methods for random access of specifically
+ typed contained objects:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">heterogenous</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">Animal</span><span class="special">></span> <span class="identifier">Vector</span><span class="special">;</span>
+<span class="identifier">Vector</span> <span class="identifier">vector</span><span class="special">;</span>
+<span class="identifier">vector</span><span class="special">.</span><span class="identifier">push_back</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="string">"sam"</span><span class="special">);</span>
+<span class="identifier">vector</span><span class="special">.</span><span class="identifier">push_back</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="string">"spot"</span><span class="special">);</span>
+<span class="identifier">vector</span><span class="special">.</span><span class="identifier">push_back</span><span class="special"><</span><span class="identifier">Labrador</span><span class="special">>(</span><span class="string">"max"</span><span class="special">,</span> <span class="number">14</span><span class="special">);</span>
+
+<span class="identifier">Vector</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="identifier">vector</span><span class="special">;</span>
+
+<span class="identifier">Labrador</span> <span class="special">&</span><span class="identifier">lab</span> <span class="special">=</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">as</span><span class="special"><</span><span class="identifier">Labrador</span><span class="special">>(</span><span class="number">2</span><span class="special">);</span>
+<span class="identifier">Dog</span> <span class="special">&</span><span class="identifier">labs_dog</span> <span class="special">=</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">as</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="number">2</span><span class="special">);</span>
+<span class="identifier">Dog</span> <span class="special">&</span><span class="identifier">spot</span> <span class="special">=</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">as</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="number">1</span><span class="special">);</span>
+
+<span class="keyword">const</span> <span class="identifier">Dog</span> <span class="special">*</span><span class="identifier">maybe_dog</span> <span class="special">=</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">cast</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="number">0</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ <span class="emphasis"><em><span class="inlinemediaobject"><img src="../images/alert.png" alt="alert"></span> the names here have undergone a number of changes and
+ remain in flux. Suggestions welcome!</em></span>
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">push_back</span></code> works just like
+ with <code class="computeroutput"><span class="identifier">list</span></code> and is not surprising.
+ But the <code class="computeroutput"><span class="identifier">as</span></code> and <code class="computeroutput"><span class="identifier">cast</span></code> methods are new.
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">vector</span><span class="special">::</span><span class="identifier">as</span></code> is the same as <code class="computeroutput"><span class="identifier">vector</span><span class="special">::</span><span class="identifier">at</span></code> except
+ that it requires a type to convert to. <code class="computeroutput"><span class="identifier">at</span></code>
+ will return a base reference. <code class="computeroutput"><span class="identifier">as</span></code>
+ returns a derived-type reference, or throws <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_cast</span></code>.
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">vector</span><span class="special">::</span><span class="identifier">cast</span></code> (<span class="emphasis"><em>another name in need of
+ a better name</em></span>) returns a pointer of the given type to the specified
+ element, or returns the null pointer if conversion was not possible or ambiguous.
+ </p>
+<p>
+ The other members in <code class="computeroutput"><span class="identifier">vector</span></code>
+ are largely what you would expect with no real surprises. See the reference
+ for complete details.
+ </p>
+</div>
+<div class="section" title="Set">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.heterogenous_containers.set"></a><a class="link" href="heterogenous_containers.html#cloneable.heterogenous_containers.set" title="Set">Set</a>
+</h3></div></div></div>
+<p>
+ So far we have been intoduced to the two basic heterogenous sequence containers,
+ <code class="computeroutput"><span class="identifier">list</span></code> and <code class="computeroutput"><span class="identifier">vector</span></code>.
+ The main difference over the standard containers is how you add new objects
+ to them, and that they are, well, heterogenous. You can store any type of
+ object in them that derives from the base type that you used to define the
+ list or vector.
+ </p>
+<p>
+ Things start to get interesting with the associative containers <code class="computeroutput"><span class="identifier">set</span></code> and <code class="computeroutput"><span class="identifier">map</span></code>.
+ Here we take a quick look at how we might use a heterogenous set to store
+ a collection of animals.
+ </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="keyword">typedef</span> <span class="identifier">heterogenous</span><span class="special">::</span><span class="identifier">set</span><span class="special"><</span><span class="identifier">Animal</span><span class="special">></span> <span class="identifier">Set</span><span class="special">;</span>
+ <span class="identifier">Set</span> <span class="identifier">set</span><span class="special">;</span>
+
+ <span class="keyword">const</span> <span class="identifier">Cat</span> <span class="special">&</span><span class="identifier">sam</span> <span class="special">=</span> <span class="identifier">set</span><span class="special">.</span><span class="identifier">emplace</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="string">"sam"</span><span class="special">,</span> <span class="number">1.5</span><span class="special">).</span><span class="identifier">deref</span><span class="special">();</span>
+ <span class="keyword">const</span> <span class="identifier">Dog</span> <span class="special">&</span><span class="identifier">spot</span> <span class="special">=</span> <span class="identifier">set</span><span class="special">.</span><span class="identifier">emplace</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="string">"spot"</span><span class="special">,</span> <span class="number">3</span><span class="special">).</span><span class="identifier">deref</span><span class="special">();</span>
+ <span class="keyword">const</span> <span class="identifier">Labrador</span> <span class="special">&</span><span class="identifier">max</span> <span class="special">=</span> <span class="identifier">set</span><span class="special">.</span><span class="identifier">emplace</span><span class="special"><</span><span class="identifier">Labrador</span><span class="special">>(</span><span class="string">"max"</span><span class="special">,</span> <span class="number">14</span><span class="special">).</span><span class="identifier">deref</span><span class="special">();</span>
+
+ <span class="identifier">Set</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="identifier">set</span><span class="special">;</span>
+
+ <span class="identifier">Set</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">dog</span> <span class="special">=</span> <span class="identifier">copy</span><span class="special">.</span><span class="identifier">find</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="number">14</span><span class="special">);</span> <span class="comment">// find a dog aged 14
+</span> <span class="identifier">Set</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">any</span> <span class="special">=</span> <span class="identifier">copy</span><span class="special">.</span><span class="identifier">find</span><span class="special"><</span><span class="identifier">Animal</span><span class="special">>(</span><span class="number">1.5</span><span class="special">);</span> <span class="comment">// find any animal aged 1.5
+</span> <span class="identifier">Set</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">cat</span> <span class="special">=</span> <span class="identifier">copy</span><span class="special">.</span><span class="identifier">find</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="number">3</span><span class="special">);</span> <span class="comment">// find a cat aged 3
+</span>
+ <span class="identifier">assert</span><span class="special">(&*</span><span class="identifier">dog</span> <span class="special">==</span> <span class="special">&</span><span class="identifier">max</span><span class="special">);</span>
+ <span class="identifier">assert</span><span class="special">(&*</span><span class="identifier">any</span> <span class="special">==</span> <span class="special">&</span><span class="identifier">sam</span><span class="special">);</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">cat</span> <span class="special">==</span> <span class="identifier">set</span><span class="special">.</span><span class="identifier">end</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>
+ TODO
+ </p>
+</div>
+<div class="section" title="Map">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.heterogenous_containers.map"></a><a class="link" href="heterogenous_containers.html#cloneable.heterogenous_containers.map" title="Map">Map</a>
+</h3></div></div></div>
+<p>
+ TODO
+ </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="keyword">typedef</span> <span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">></span> <span class="identifier">Map</span><span class="special">;</span>
+ <span class="identifier">Map</span> <span class="identifier">map</span><span class="special">;</span>
+ <span class="identifier">map</span><span class="special">.</span><span class="identifier">insert</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="number">1</span><span class="special">,</span> <span class="string">"sam"</span><span class="special">,</span> <span class="number">6</span><span class="special">);</span>
+ <span class="identifier">map</span><span class="special">.</span><span class="identifier">insert</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="number">2</span><span class="special">,</span> <span class="string">"spot"</span><span class="special">,</span> <span class="number">6</span><span class="special">);</span>
+ <span class="identifier">map</span><span class="special">.</span><span class="identifier">insert</span><span class="special"><</span><span class="identifier">Lab</span><span class="special">>(</span><span class="number">3</span><span class="special">,</span> <span class="string">"max"</span><span class="special">,</span> <span class="number">6</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ TODO
+ </p>
+</div>
+<div class="section" title="Heterogenous Map">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.heterogenous_containers.heterogenous_map"></a><a class="link" href="heterogenous_containers.html#cloneable.heterogenous_containers.heterogenous_map" title="Heterogenous Map">Heterogenous
+ Map</a>
+</h3></div></div></div>
+<p>
+ And also a map of Cloneable to Cloneable:
+ </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="keyword">typedef</span> <span class="identifier">heterogenous_map</span><span class="special"><</span><span class="identifier">Animal</span><span class="special">></span> <span class="identifier">Map</span><span class="special">;</span>
+ <span class="identifier">Map</span> <span class="identifier">map</span><span class="special">;</span>
+ <span class="identifier">map</span><span class="special">.</span><span class="identifier">key</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="string">"spot"</span><span class="special">,</span> <span class="number">12</span><span class="special">).</span><span class="identifier">value</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="string">"rover"</span><span class="special">,</span> <span class="number">8</span><span class="special">);</span>
+ <span class="identifier">map</span><span class="special">.</span><span class="identifier">key</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="string">"sam"</span><span class="special">,</span> <span class="number">6</span><span class="special">).</span><span class="identifier">value</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="string">"sooty"</span><span class="special">,</span> <span class="number">10</span><span class="special">);</span>
+ <span class="identifier">map</span><span class="special">.</span><span class="identifier">key</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="string">"fluffy"</span><span class="special">,</span> <span class="number">10</span><span class="special">).</span><span class="identifier">value</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="string">"tigger"</span><span class="special">,</span> <span class="number">14</span><span class="special">);</span>
+ <span class="identifier">map</span><span class="special">.</span><span class="identifier">key</span><span class="special"><</span><span class="identifier">Labrador</span><span class="special">>(</span><span class="string">"max"</span><span class="special">,</span> <span class="number">12</span><span class="special">).</span><span class="identifier">value</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="string">"sooty"</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span>
+
+ <span class="comment">// make a deep copy of both the keys and values in the map
+</span> <span class="identifier">Map</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="identifier">map</span><span class="special">;</span>
+
+ <span class="comment">// can search for any type of animal
+</span> <span class="identifier">assert</span><span class="special">(</span><span class="identifier">copy</span><span class="special">.</span><span class="identifier">find</span><span class="special"><</span><span class="identifier">Animal</span><span class="special">>(</span><span class="string">"spot"</span><span class="special">,</span> <span class="number">12</span><span class="special">)</span> <span class="special">!=</span> <span class="identifier">copy</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">copy</span><span class="special">.</span><span class="identifier">find</span><span class="special"><</span><span class="identifier">Animal</span><span class="special">>(</span><span class="string">"sam"</span><span class="special">,</span> <span class="number">6</span><span class="special">)</span> <span class="special">!=</span> <span class="identifier">copy</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
+
+ <span class="comment">// or, search for specific animal instances
+</span> <span class="identifier">assert</span><span class="special">(</span><span class="identifier">copy</span><span class="special">.</span><span class="identifier">find</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="string">"spot"</span><span class="special">,</span> <span class="number">12</span><span class="special">)</span> <span class="special">!=</span> <span class="identifier">copy</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">copy</span><span class="special">.</span><span class="identifier">find</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="string">"spot"</span><span class="special">,</span> <span class="number">12</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">copy</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">copy</span><span class="special">.</span><span class="identifier">find</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="string">"sam"</span><span class="special">,</span> <span class="number">6</span><span class="special">)</span> <span class="special">!=</span> <span class="identifier">copy</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">copy</span><span class="special">.</span><span class="identifier">find</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="string">"max"</span><span class="special">,</span> <span class="number">12</span><span class="special">)</span> <span class="special">!=</span> <span class="identifier">copy</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">copy</span><span class="special">.</span><span class="identifier">find</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>(</span><span class="string">"fluffy"</span><span class="special">,</span> <span class="number">10</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">copy</span><span class="special">.</span><span class="identifier">end</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>
+ TODO
+ </p>
+</div>
+<div class="section" title="HashMap and HashSet">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.heterogenous_containers.hashmap_and_hashset"></a><a class="link" href="heterogenous_containers.html#cloneable.heterogenous_containers.hashmap_and_hashset" title="HashMap and HashSet">HashMap
+ and HashSet</a>
+</h3></div></div></div>
+<p>
+ These share the same interface as <code class="computeroutput"><span class="identifier">map</span></code>
+ and <code class="computeroutput"><span class="identifier">set</span></code>, but are based on
+ hash tables rather than a tree.
+ </p>
+</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
@@ -138,7 +535,7 @@
</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>
+<a accesskey="p" href="tutorial.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>
</div>
</body>
</html>
Modified: sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial.html
==============================================================================
--- sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial.html (original)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial.html 2009-07-08 16:10:31 EDT (Wed, 08 Jul 2009)
@@ -6,41 +6,41 @@
<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="change_log.html" title="Change Log">
-<link rel="next" href="tutorial/simple_hierarchical_cloning.html" title="Simple Hierarchical Cloning">
+<link rel="prev" href="../index.html" title="Cloneable 0.1">
+<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 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>
+<td align="center">More</td>
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="change_log.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="tutorial/simple_hierarchical_cloning.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+<a accesskey="p" href="../index.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.html"><img src="../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="section" title="Tutorial">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="cloneable.tutorial"></a><a class="link" href="tutorial.html" title="Tutorial"> Tutorial</a>
</h2></div></div></div>
<div class="toc"><dl>
-<dt><span class="section"><a href="tutorial/simple_hierarchical_cloning.html">Simple
+<dt><span class="section"><a href="tutorial.html#cloneable.tutorial.simple_hierarchical_cloning">Simple
Hierarchical Cloning</a></span></dt>
-<dt><span class="section"><a href="tutorial/controlling_construction.html">Controlling
+<dt><span class="section"><a href="tutorial.html#cloneable.tutorial.controlling_construction">Controlling
Construction</a></span></dt>
-<dt><span class="section"><a href="tutorial/using_external_types.html">Using External
+<dt><span class="section"><a href="tutorial.html#cloneable.tutorial.using_external_types">Using External
Types</a></span></dt>
-<dt><span class="section"><a href="tutorial/dealing_with_muliple_sub_objects.html">Dealing
+<dt><span class="section"><a href="tutorial.html#cloneable.tutorial.dealing_with_muliple_sub_objects">Dealing
with Muliple Sub-Objects</a></span></dt>
-<dt><span class="section"><a href="tutorial/customising_the_cloning_process.html">Customising
+<dt><span class="section"><a href="tutorial.html#cloneable.tutorial.customising_the_cloning_process">Customising
the Cloning Process</a></span></dt>
-<dt><span class="section"><a href="tutorial/using_custom_allocators.html">Using Custom
+<dt><span class="section"><a href="tutorial.html#cloneable.tutorial.using_custom_allocators">Using Custom
Allocators</a></span></dt>
-<dt><span class="section">Cloneable Instance</span></dt>
-<dt><span class="section">Cloneable Traits</span></dt>
+<dt><span class="section">Cloneable Instance</span></dt>
+<dt><span class="section">Cloneable Traits</span></dt>
</dl></div>
<p>
This tutorial progresses through the basic usage of the library, demonstrating
@@ -129,7 +129,7 @@
</p>
<div class="note" title="Note"><table border="0" summary="Note">
<tr>
-<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/html/images/note.png"></td>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/html/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
@@ -148,6 +148,676 @@
But we'll get to that later. For now, let's move on to some slightly less trivial
examples.
</p>
+<div class="section" title="Simple Hierarchical Cloning">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.tutorial.simple_hierarchical_cloning"></a><a class="link" href="tutorial.html#cloneable.tutorial.simple_hierarchical_cloning" title="Simple Hierarchical Cloning">Simple
+ Hierarchical Cloning</a>
+</h3></div></div></div>
+<p>
+ In the previous example, we did not supply a base class, so our Cloneable
+ type was given the default <code class="computeroutput"><span class="identifier">base_type</span></code>.
+ Below, we prepare our own base type <code class="computeroutput"><span class="identifier">Animal</span></code>,
+ which of course has a virtual destructor, as well as a means to get a member
+ variable from a derived type:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cloneable</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">std</span><span class="special">;</span>
+
+<span class="keyword">class</span> <span class="identifier">Animal</span>
+<span class="special">{</span>
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">Animal</span><span class="special">()</span> <span class="special">{</span> <span class="special">}</span>
+ <span class="keyword">virtual</span> <span class="identifier">string</span> <span class="identifier">get_name</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">Animal</span></code> doesn't have to derive
+ from anything, or have any special members or methods.
+ </p>
+<p>
+ Now let's use our base class to create a simple type hierarchy:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">Cat</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">></span>
+<span class="special">{</span>
+ <span class="identifier">string</span> <span class="identifier">name</span><span class="special">;</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">Cat</span><span class="special">()</span> <span class="special">{}</span>
+ <span class="identifier">Cat</span><span class="special">(</span><span class="identifier">string</span> <span class="identifier">n</span><span class="special">)</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="identifier">string</span> <span class="identifier">get_name</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">name</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ We derive our <code class="computeroutput"><span class="identifier">Cat</span></code> class from
+ <code class="computeroutput"><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">></span></code>. The first type argument to <code class="computeroutput"><span class="identifier">base</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">></span></code> is the derived type to use for cloning,
+ and the second argument is the common base type of the hierarhcy. As we saw
+ in the first example, if you do not provide your own base type, your Cloneable
+ type will use the base <code class="computeroutput"><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base_type</span></code>.
+ </p>
+<p>
+ Other than that, <code class="computeroutput"><span class="identifier">Cat</span></code> implements
+ the <code class="computeroutput"><span class="identifier">get_name</span></code> pure virtual
+ method derived from the base class <code class="computeroutput"><span class="identifier">Animal</span></code>.
+ </p>
+<p>
+ Now, let's use it:
+ </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">Cat</span> <span class="special">*</span><span class="identifier">cat</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">Cat</span><span class="special">(</span><span class="string">"sam"</span><span class="special">);</span>
+
+ <span class="comment">// clone the cat. returns a pointer to the base class
+</span> <span class="identifier">Animal</span> <span class="special">*</span><span class="identifier">animal</span> <span class="special">=</span> <span class="identifier">cat</span><span class="special">-></span><span class="identifier">clone</span><span class="special">();</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="keyword">typeid</span><span class="special">(*</span><span class="identifier">animal</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">typeid</span><span class="special">(</span><span class="identifier">Cat</span><span class="special">));</span>
+
+ <span class="comment">// downcast to our derived type
+</span> <span class="identifier">Cat</span> <span class="special">*</span><span class="identifier">cloned</span> <span class="special">=</span> <span class="keyword">dynamic_cast</span><span class="special"><</span><span class="identifier">Cat</span> <span class="special">*>(</span><span class="identifier">animal</span><span class="special">);</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">cloned</span><span class="special">-></span><span class="identifier">get_name</span><span class="special">()</span> <span class="special">==</span> <span class="string">"sam"</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>
+<div class="note" title="Note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/html/images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ the <code class="computeroutput"><span class="identifier">clone</span><span class="special">()</span></code>
+ method returns a pointer to the base class of the type hierarchy - in this
+ case, <code class="computeroutput"><span class="identifier">Animal</span></code>.
+ </p></td></tr>
+</table></div>
+<p>
+ We had to use a dynamic cast to down-cast to our derived type. If you know
+ the derived type that you wish to be cloned, you can use the <code class="computeroutput"><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">T</span><span class="special">>()</span></code>
+ method instead and save some typing:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="identifier">Cat</span> <span class="special">*</span><span class="identifier">cloned</span> <span class="special">=</span> <span class="identifier">cat</span><span class="special">-></span><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>();</span>
+</pre>
+<p>
+ </p>
+<p>
+ As we shall soon see, this is also handy when we have choices of which sub-object
+ to clone. Of course, we could also use the free-function <code class="computeroutput"><span class="identifier">clone</span></code>:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">cloneable</span><span class="special">;</span>
+
+<span class="identifier">assert</span><span class="special">(</span><span class="identifier">can_clone_as</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(*</span><span class="identifier">cat</span><span class="special">));</span>
+<span class="identifier">Cat</span> <span class="special">*</span><span class="identifier">cloned</span> <span class="special">=</span> <span class="identifier">clone</span><span class="special">(*</span><span class="identifier">cat</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ We now add other animals to the hierachy, including one that uses multiple
+ inheritance:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">Dog</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">></span>
+<span class="special">{</span>
+<span class="special">};</span>
+
+<span class="keyword">class</span> <span class="identifier">Labrador</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">Dog</span><span class="special">,</span> <span class="keyword">public</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special"><</span><span class="identifier">Labrador</span><span class="special">,</span> <span class="identifier">Animal</span><span class="special">></span>
+<span class="special">{</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">Dog</span></code> is just like a cat, but
+ different <span class="inlinemediaobject"><img src="../images/smiley.png" alt="smiley"></span>. <code class="computeroutput"><span class="identifier">Labrador</span></code>
+ is the first example we have seen that uses multiple inheritance. In this
+ case, we are saying that a Labrador is-a Dog, and is Cloneable as either
+ a Dog or a Labrador. Using these types:
+ </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">Animal</span> <span class="special">*</span><span class="identifier">lab</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">Labrador</span><span class="special">();</span>
+ <span class="identifier">Animal</span> <span class="special">*</span><span class="identifier">lab_as_dog</span> <span class="special">=</span> <span class="identifier">lab</span><span class="special">-></span><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">Dog</span><span class="special">>();</span>
+ <span class="identifier">Animal</span> <span class="special">*</span><span class="identifier">lab_clone</span> <span class="special">=</span> <span class="identifier">lab</span><span class="special">-></span><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">Labrador</span><span class="special">>();</span>
+
+ <span class="identifier">assert</span><span class="special">(</span><span class="keyword">typeid</span><span class="special">(*</span><span class="identifier">lab_as_dog</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">typeid</span><span class="special">(</span><span class="identifier">Dog</span><span class="special">));</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="keyword">typeid</span><span class="special">(*</span><span class="identifier">lab_clone</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">typeid</span><span class="special">(</span><span class="identifier">Labrador</span><span class="special">));</span>
+
+ <span class="identifier">assert</span><span class="special">(!</span><span class="identifier">can_clone_as</span><span class="special"><</span><span class="identifier">Labrador</span><span class="special">>(</span><span class="identifier">lab_as_dog</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>
+ When cloning the <code class="computeroutput"><span class="identifier">Labrador</span></code>
+ class, we must specify which sub-object we wish to duplicate using the <code class="computeroutput"><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">Ty</span><span class="special">></span></code>
+ method.
+ </p>
+<p>
+ It should be noted that when using <code class="computeroutput"><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">Ty</span><span class="special">></span></code>, we actually are making an instance of
+ type <code class="computeroutput"><span class="identifier">Ty</span></code>, rather than making
+ another type and casting up.
+ </p>
+<p>
+ We can also use the Cloneable library to make a new derived instance from
+ a base type:
+ </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">Animal</span> <span class="special">*</span><span class="identifier">cat</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">Cat</span><span class="special">();</span>
+ <span class="identifier">Animal</span> <span class="special">*</span><span class="identifier">new_animal</span> <span class="special">=</span> <span class="identifier">create_new</span><span class="special">(*</span><span class="identifier">cat</span><span class="special">);</span>
+
+ <span class="identifier">assert</span><span class="special">(</span><span class="keyword">typeid</span><span class="special">(*</span><span class="identifier">new_animal</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">typeid</span><span class="special">(</span><span class="identifier">Cat</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>
+ This will create a new derived animal type (not a new base), and return a
+ pointer to the base.
+ </p>
+<p>
+ This is the basics of the cloneability side of the library. But there are
+ a few more details and use-cases to cover before we get to the containers.
+ The first of these details is dealing with types that are not default-constructable.
+ This is a very useful part of the library, as it allows for containers with
+ elements that are not default constructable and do not have assignment operations.
+ We'll get to that in the containers tutorial, but for now let's quickly cover
+ the basics in the next section.
+ </p>
+</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="tutorial.html#cloneable.tutorial.controlling_construction" 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"><</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">></span>
+<span class="special">{</span>
+ <span class="identifier">string</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">string</span> <span class="special">&</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 <code class="computeroutput"><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special"><></span></code>. The order that you give the base-type
+ or tag-types to <code class="computeroutput"><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special"><></span></code> is not important.
+ </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">clone</span><span class="special">(*</span><span class="identifier">p</span><span class="special">);</span> <span class="comment">// or, p->clone_as<T0>();
+</span> <span class="identifier">assert</span><span class="special">(&</span><span class="identifier">q</span><span class="special">-></span><span class="identifier">str</span> <span class="special">==</span> <span class="special">&</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">-></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. As you would expect, if a Cloneable Q type derives from
+ a non-default-constructable type, then Q is also not default-constructable.
+ </p>
+<p>
+ Next, we'll look at how to use existing types that we can't change.
+ </p>
+</div>
+<div class="section" title="Using External Types">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.tutorial.using_external_types"></a><a class="link" href="tutorial.html#cloneable.tutorial.using_external_types" title="Using External Types">Using External
+ Types</a>
+</h3></div></div></div>
+<p>
+ Quite often we find ourselves using classes that are defined in an external
+ library. These are not open to be changed, but we would still like them to
+ be Cloneable. To address this issue, we can use the <code class="computeroutput"><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">adaptor</span><span class="special"><</span><span class="identifier">Type</span><span class="special">,</span><span class="identifier">Base</span><span class="special">></span></code>
+ structure:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">External</span> <span class="special">{</span> <span class="comment">/* hidden impl */</span> <span class="special">};</span> <span class="comment">// for whatever reason, this cannot be modified
+</span>
+<span class="keyword">class</span> <span class="identifier">MyBase</span> <span class="special">{</span> <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">MyBase</span><span class="special">()</span> <span class="special">{</span> <span class="special">}</span> <span class="special">};</span>
+
+<span class="keyword">typedef</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">adaptor</span><span class="special"><</span><span class="identifier">External</span><span class="special">,</span> <span class="identifier">MyBase</span><span class="special">></span> <span class="identifier">MyExternal</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">MyExternal</span> <span class="special">*</span><span class="identifier">ex</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">MyExternal</span><span class="special">();</span>
+ <span class="identifier">MyExternal</span> <span class="special">*</span><span class="identifier">cloned</span> <span class="special">=</span> <span class="identifier">ex</span><span class="special">-></span><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">MyExternal</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>
+ By using the <code class="computeroutput"><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">adaptor</span><span class="special"><</span><span class="identifier">Type</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">></span></code>
+ structure, we create a new type that is cloneable and can be used correctly
+ in heterogenous containers.
+ </p>
+<p>
+ Alternatively of course, we could just make a new structure which either
+ derives from or encapsulates the external class. This will be necessary if
+ you wish to pass construction arguments to the external type, or provide
+ a custom clone method for it. For example:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">Wrapper</span> <span class="special">:</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special"><</span><span class="identifier">Wrapper</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">></span>
+<span class="special">{</span>
+ <span class="identifier">External</span> <span class="special">*</span><span class="identifier">impl</span><span class="special">;</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">Wrapper</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">impl</span><span class="special">(</span><span class="number">0</span><span class="special">)</span> <span class="special">{</span> <span class="special">}</span>
+ <span class="identifier">Wrapper</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Wrapper</span> <span class="special">&</span><span class="identifier">other</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">impl</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">Wrapper</span><span class="special">(*</span><span class="identifier">other</span><span class="special">.</span><span class="identifier">impl</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ There are of course many ways to do this, and how you do it will depend on
+ many factors. Just bear in mind that <code class="computeroutput"><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">adaptor</span><span class="special"><></span></code> is there if you need it.
+ </p>
+<p>
+ Next, we look at how to customise the cloning operation itself, and how we
+ can use our own or other allocators. This is important to understand before
+ we finally get to the heterogenous containers.
+ </p>
+</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="tutorial.html#cloneable.tutorial.dealing_with_muliple_sub_objects" 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"><</span><span class="identifier">T</span><span class="special">></span></code> and
+ <code class="computeroutput"><span class="identifier">create_as</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span></code> methods
+ or functions 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"><</span><span class="identifier">T0</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">T1</span> <span class="special">:</span> <span class="identifier">T0</span><span class="special">,</span> <span class="identifier">base</span><span class="special"><</span><span class="identifier">T1</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">W</span> <span class="special">:</span> <span class="identifier">base</span><span class="special"><</span><span class="identifier">W</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">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"><</span><span class="identifier">T2</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">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="identifier">assert</span><span class="special">(</span><span class="identifier">t2</span><span class="special">-></span><span class="identifier">can_clone_as</span><span class="special"><</span><span class="identifier">W</span><span class="special">>());</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">t2</span><span class="special">-></span><span class="identifier">can_clone_as</span><span class="special"><</span><span class="identifier">T0</span><span class="special">>());</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">t2</span><span class="special">-></span><span class="identifier">can_clone_as</span><span class="special"><</span><span class="identifier">T1</span><span class="special">>());</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">t2</span><span class="special">-></span><span class="identifier">can_clone_as</span><span class="special"><</span><span class="identifier">T2</span><span class="special">>());</span>
+
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">t2</span><span class="special">-></span><span class="identifier">can_create_as</span><span class="special"><</span><span class="identifier">W</span><span class="special">>());</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">t2</span><span class="special">-></span><span class="identifier">can_create_as</span><span class="special"><</span><span class="identifier">T0</span><span class="special">>());</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">t2</span><span class="special">-></span><span class="identifier">can_create_as</span><span class="special"><</span><span class="identifier">T1</span><span class="special">>());</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">t2</span><span class="special">-></span><span class="identifier">can_create_as</span><span class="special"><</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">-></span><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">W</span><span class="special">>();</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">-></span><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">T0</span><span class="special">>();</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">-></span><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">T1</span><span class="special">>();</span>
+ <span class="identifier">T1</span> <span class="special">*</span><span class="identifier">t2_t2</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-></span><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">T2</span><span class="special">>();</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">-></span><span class="identifier">create_as</span><span class="special"><</span><span class="identifier">W</span><span class="special">>();</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">-></span><span class="identifier">create_as</span><span class="special"><</span><span class="identifier">T0</span><span class="special">>();</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">-></span><span class="identifier">create_as</span><span class="special"><</span><span class="identifier">T1</span><span class="special">>();</span>
+ <span class="identifier">T2</span> <span class="special">*</span><span class="identifier">t2_t2_new</span> <span class="special">=</span> <span class="identifier">t2</span><span class="special">-></span><span class="identifier">create_as</span><span class="special"><</span><span class="identifier">T2</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>
+<div class="warning" title="Warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../doc/html/images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ If a sub-type <code class="computeroutput"><span class="identifier">S</span></code> in type
+ <code class="computeroutput"><span class="identifier">T</span></code> is not default-constructabe,
+ an exception of type <code class="computeroutput"><span class="identifier">no_default_construction</span></code>
+ will be thrown if you attempt to default-create a new <code class="computeroutput"><span class="identifier">S</span></code>
+ instance from a <code class="computeroutput"><span class="identifier">T</span></code> instance.
+ </p></td></tr>
+</table></div>
+</div>
+<div class="section" title="Customising the Cloning Process">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.tutorial.customising_the_cloning_process"></a><a class="link" href="tutorial.html#cloneable.tutorial.customising_the_cloning_process" title="Customising the Cloning Process">Customising
+ the Cloning Process</a>
+</h3></div></div></div>
+<p>
+ So far, we have been making clones using the default cloning process. This
+ uses the copy-constructor of a given type T to generate the clone. However,
+ quite often we will want to have greater control over this process, and sometimes
+ we don't want to or cannot use a copy constructor at all.
+ </p>
+<p>
+ Customising the cloning process is a simple matter of providing a <code class="computeroutput"><span class="identifier">make_copy</span></code> method overload in your derived
+ class:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">Foo</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special"><</span><span class="identifier">Foo</span><span class="special">></span>
+<span class="special">{</span>
+ <span class="comment">// over-ride the make_copy method, providing our own means to make a clone
+</span> <span class="identifier">Foo</span> <span class="special">*</span><span class="identifier">make_copy</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="identifier">Foo</span> <span class="special">*</span><span class="identifier">copy</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">Foo</span><span class="special">();</span>
+ <span class="comment">// TODO: write values to copy from this
+</span> <span class="keyword">return</span> <span class="identifier">copy</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ Please ensure that you override the <code class="computeroutput"><span class="identifier">make_copy</span><span class="special">()</span> <span class="keyword">const</span></code> method
+ correctly. It must return a type that is co-variant with the base you used
+ for the derived type, and should be <code class="computeroutput"><span class="keyword">const</span></code>.
+ If you make a mistake on the return type, the compiler will complain. There
+ is a non-const <code class="computeroutput"><span class="identifier">make_copy</span><span class="special">()</span></code> method as well. This will be invoked on
+ a non-const original, then the const <code class="computeroutput"><span class="identifier">make_copy</span><span class="special">()</span> <span class="keyword">const</span></code> will
+ be attempted before finally using the <code class="computeroutput"><span class="identifier">copy_construct</span><span class="special">()</span> <span class="keyword">const</span></code> method.
+ To summarise:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ Attempting to make a copy of a non-const original will invoke <code class="computeroutput"><span class="identifier">make_copy</span><span class="special">()</span></code>
+</li>
+<li class="listitem">
+ If this fails or is not over-ridden, then the <code class="computeroutput"><span class="identifier">make_copy</span><span class="special">()</span> <span class="keyword">const</span></code>
+ method is invoked.
+ </li>
+<li class="listitem">
+ If this fails is or not over-ridden, then <code class="computeroutput"><span class="identifier">copy_construct</span><span class="special">()</span> <span class="keyword">const</span></code>
+ is invoked.
+ </li>
+</ul></div>
+<p>
+ This provides a means for clones to be made that alter the original, if you
+ need to do that. For <code class="computeroutput"><span class="keyword">const</span></code> originals,
+ the process starts from step 2. All of these methods are over-loaded with
+ a similar method that takes an <code class="computeroutput"><span class="identifier">abstract_allocator</span></code>
+ argument.
+ </p>
+<p>
+ Which is a nice segue into the next section. This example used the heap to
+ make clones; we will next see how to make clones using any standard-compliant
+ allocator type.
+ </p>
+</div>
+<div class="section" title="Using Custom Allocators">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.tutorial.using_custom_allocators"></a><a class="link" href="tutorial.html#cloneable.tutorial.using_custom_allocators" title="Using Custom Allocators">Using Custom
+ Allocators</a>
+</h3></div></div></div>
+<p>
+ The entire Cloneable system was designed to support general allocators. This
+ provides more fine-tuned control over cloning and creation operations, and
+ ensures Cloneable types work well in containers.
+ </p>
+<p>
+ When making a new object, sub-object, clone or sub-clone, the underlying
+ <code class="computeroutput"><span class="identifier">abstract_base</span></code> is given a
+ reference to an <code class="computeroutput"><span class="identifier">abstract_allocator</span></code>.
+ This is an interface used to expose a specialised <code class="computeroutput"><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span></code>
+ to the non-specific <code class="computeroutput"><span class="identifier">abstract_base</span></code>.
+ This process is easy to understand with some examples:
+ </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">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">alloc</span><span class="special">;</span>
+ <span class="identifier">Cat</span> <span class="special">*</span><span class="identifier">cat</span> <span class="special">=</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">create</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="identifier">alloc</span><span class="special">);</span> <span class="comment">// create a Cat using the allocator
+</span> <span class="identifier">Cat</span> <span class="special">*</span><span class="identifier">dupe</span> <span class="special">=</span> <span class="identifier">cat</span><span class="special">-></span><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="identifier">alloc</span><span class="special">);</span> <span class="comment">// clone using the same allocator
+</span>
+ <span class="identifier">my_allocator</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">my_alloc</span><span class="special">;</span>
+ <span class="identifier">Cat</span> <span class="special">*</span><span class="identifier">dup2</span> <span class="special">=</span> <span class="identifier">cat</span><span class="special">-></span><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">Cat</span><span class="special">>(</span><span class="identifier">my_alloc</span><span class="special">);</span> <span class="comment">// clone using another allocator
+</span> <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ As you can see, most of the internals can be safely ignored. From this, it
+ becomes clear that if you write a clone override, you should do so for the
+ method that takes an <code class="computeroutput"><span class="identifier">abstract_allocator</span>
+ <span class="special">&</span></code>, rather than just always use
+ the heap:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">Foo</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special"><</span><span class="identifier">Foo</span><span class="special">></span>
+<span class="special">{</span>
+ <span class="comment">// over-ride the make_copy method, providing our own means to make a clone
+</span> <span class="identifier">Foo</span> <span class="special">*</span><span class="identifier">make_copy</span><span class="special">(</span><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">abstract_allocator</span> <span class="special">&</span><span class="identifier">alloc</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="identifier">Foo</span> <span class="special">*</span><span class="identifier">copy</span> <span class="special">=</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">create</span><span class="special"><</span><span class="identifier">Foo</span><span class="special">>(</span><span class="identifier">alloc</span><span class="special">);</span>
+
+ <span class="comment">// write values to copy from this; use alloc for any further required allocations
+</span>
+ <span class="keyword">return</span> <span class="identifier">copy</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ Recall that if your class can be correctly copy-constructed, you do not need
+ to provide a custom clone override at all. If your class only members that
+ have value semantics and can in turn be copy-constructed (including <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">containers</span></code>,
+ and heterogenous::containers), then you do not need to provide any customisation.
+ So don't start by making a custom clone override method. First, check your
+ class to see if it is actually needed. Introducing a <code class="computeroutput"><span class="identifier">make_copy</span><span class="special">()</span></code> method too early or when not needed can
+ create maintenance problems.
+ </p>
+<div class="note" title="Note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/html/images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ if your class contains pointers of any description, or references, then
+ you will in general have to at least provide a sensible copy-constructor,
+ or provide a custom clone override.
+ </p></td></tr>
+</table></div>
+<p>
+ In summary, there are three stages of customisation:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ If your class has types with value semantics, the compiler-generated default
+ copy constructor will suffice.
+ </li>
+<li class="listitem">
+ If your class has types that need explicit construction, making a copy-constructor
+ for your class will suffice to make clones.
+ </li>
+<li class="listitem">
+ If your class has members that contain references, or require allocation,
+ then you should override <code class="computeroutput"><span class="identifier">make_copy</span></code>
+ and construct the members in the copy instance, using the supplied abstract_allocator.
+ </li>
+</ul></div>
+</div>
+<div class="section" title="Cloneable Instance">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="cloneable.tutorial.cloneable_instance"></a><a class="link" href="tutorial.html#cloneable.tutorial.cloneable_instance" title="Cloneable Instance">Cloneable Instance</a>
+</h3></div></div></div>
+<p>
+ <span class="inlinemediaobject"><img src="../images/alert.png" alt="alert"></span> <span class="emphasis"><em>subject to change -- CJS</em></span>
+ </p>
+<p>
+ A structure named <code class="computeroutput"><span class="identifier">instance</span><span class="special"><></span></code> is available within the library for
+ storing instances of cloneable objects.
+ </p>
+<p>
+ This is used by the library to store a pointer to Cloneable objects, along
+ with the allocator that made it. It can be used, for example, to assign from
+ a generalised base to an <code class="computeroutput"><span class="identifier">instance</span><span class="special"><></span></code> without the user needing to manually
+ cast.
+ </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">Foo</span> <span class="special">:</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">base</span><span class="special"><</span><span class="identifier">Foo</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">void</span> <span class="identifier">test</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">list</span><span class="special"><</span><span class="identifier">Base</span><span class="special">></span> <span class="identifier">List</span><span class="special">;</span>
+ <span class="identifier">list</span><span class="special">.</span><span class="identifier">push_back</span><span class="special"><</span><span class="identifier">Foo</span><span class="special">>(</span><span class="number">1</span><span class="special">);</span>
+ <span class="identifier">List</span><span class="special">::</span><span class="identifier">instance</span><span class="special"><</span><span class="identifier">Foo</span><span class="special">></span> <span class="identifier">foo</span> <span class="special">=</span> <span class="identifier">list</span><span class="special">.</span><span class="identifier">front</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The full signature of this type is:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span>
+ <span class="keyword">class</span> <span class="identifier">Derived</span> <span class="special">=</span> <span class="identifier">any_derived_tag</span>
+ <span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Base</span> <span class="special">=</span> <span class="identifier">any_base_tag</span>
+ <span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span> <span class="special">=</span> <span class="identifier">default_clone_allocator</span>
+ <span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Ctor</span> <span class="special">=</span> <span class="identifier">default_construction_tag</span>
+ <span class="special">></span>
+<span class="keyword">struct</span> <span class="identifier">instance</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ But you will rarely need that when used as shown in the example.
+ </p>
+<p>
+ The next section cleans up some housework required for library maintainers,
+ then we finally get to the fun stuff with the containers.
+ </p>
+</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="tutorial.html#cloneable.tutorial.cloneable_traits" 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"><</span><span class="identifier">T</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">U</span> <span class="special">:</span> <span class="identifier">base</span><span class="special"><</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">></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"><</span><span class="identifier">T</span><span class="special">>::</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"><</span><span class="identifier">U</span><span class="special">>::</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"><</span><span class="identifier">V</span><span class="special">>::</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"><</span><span class="identifier">T</span><span class="special">,</span><span class="identifier">Base</span><span class="special">>::</span><span class="identifier">value</span><span class="special">);</span>
+
+<span class="comment">//BOOST_STATIC_ASSERT(cloneable::is_default_constructable<V>::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"><</span><span class="identifier">T</span><span class="special">>::</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"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">value</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ Full details are in traits.hpp.
+ </p>
+</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
@@ -159,7 +829,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="change_log.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="tutorial/simple_hierarchical_cloning.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+<a accesskey="p" href="../index.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.html"><img src="../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/cloneable/libs/cloneable/doc/html/index.html
==============================================================================
--- sandbox/cloneable/libs/cloneable/doc/html/index.html (original)
+++ sandbox/cloneable/libs/cloneable/doc/html/index.html 2009-07-08 16:10:31 EDT (Wed, 08 Jul 2009)
@@ -5,19 +5,19 @@
<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="next" href="cloneable/change_log.html" title="Change Log">
+<link rel="next" href="cloneable/tutorial.html" title="Tutorial">
</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 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>
+<td align="center">More</td>
</tr></table>
<hr>
-<div class="spirit-nav"><a accesskey="n" href="cloneable/change_log.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
+<div class="spirit-nav"><a accesskey="n" href="cloneable/tutorial.html"><img src="../../doc/html/images/next.png" alt="Next"></a></div>
<div class="article" title="Cloneable 0.1">
<div class="titlepage">
<div>
@@ -28,7 +28,7 @@
</h3></div></div></div>
<div><p class="copyright">Copyright © 2009 Christian Schladetsch</p></div>
<div><div class="legalnotice" title="Legal Notice">
-<a name="id663289"></a><p>
+<a name="id649107"></a><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>
@@ -39,43 +39,43 @@
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
-<dt><span class="section"> Change Log</span></dt>
+<dt><span class="section"> Change Log</span></dt>
<dt><span class="section"> Tutorial</span></dt>
<dd><dl>
-<dt><span class="section"><a href="cloneable/tutorial/simple_hierarchical_cloning.html">Simple
+<dt><span class="section"><a href="cloneable/tutorial.html#cloneable.tutorial.simple_hierarchical_cloning">Simple
Hierarchical Cloning</a></span></dt>
-<dt><span class="section"><a href="cloneable/tutorial/controlling_construction.html">Controlling
+<dt><span class="section"><a href="cloneable/tutorial.html#cloneable.tutorial.controlling_construction">Controlling
Construction</a></span></dt>
-<dt><span class="section"><a href="cloneable/tutorial/using_external_types.html">Using External
+<dt><span class="section"><a href="cloneable/tutorial.html#cloneable.tutorial.using_external_types">Using External
Types</a></span></dt>
-<dt><span class="section"><a href="cloneable/tutorial/dealing_with_muliple_sub_objects.html">Dealing
+<dt><span class="section"><a href="cloneable/tutorial.html#cloneable.tutorial.dealing_with_muliple_sub_objects">Dealing
with Muliple Sub-Objects</a></span></dt>
-<dt><span class="section"><a href="cloneable/tutorial/customising_the_cloning_process.html">Customising
+<dt><span class="section"><a href="cloneable/tutorial.html#cloneable.tutorial.customising_the_cloning_process">Customising
the Cloning Process</a></span></dt>
-<dt><span class="section"><a href="cloneable/tutorial/using_custom_allocators.html">Using Custom
+<dt><span class="section"><a href="cloneable/tutorial.html#cloneable.tutorial.using_custom_allocators">Using Custom
Allocators</a></span></dt>
-<dt><span class="section">Cloneable Instance</span></dt>
-<dt><span class="section">Cloneable Traits</span></dt>
+<dt><span class="section">Cloneable Instance</span></dt>
+<dt><span class="section">Cloneable Traits</span></dt>
</dl></dd>
<dt><span class="section">Heterogenous Containers</span></dt>
<dd><dl>
-<dt><span class="section"><a href="cloneable/heterogenous_containers/extended_object_hierarhcy.html">Extended
+<dt><span class="section"><a href="cloneable/heterogenous_containers.html#cloneable.heterogenous_containers.extended_object_hierarhcy">Extended
Object Hierarhcy</a></span></dt>
-<dt><span class="section"><a href="cloneable/heterogenous_containers/container_method_names.html">Container
+<dt><span class="section"><a href="cloneable/heterogenous_containers.html#cloneable.heterogenous_containers.container_method_names">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="cloneable/heterogenous_containers/heterogenous_map.html">Heterogenous
+<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="cloneable/heterogenous_containers.html#cloneable.heterogenous_containers.heterogenous_map">Heterogenous
Map</a></span></dt>
-<dt><span class="section"><a href="cloneable/heterogenous_containers/hashmap_and_hashset.html">HashMap
+<dt><span class="section"><a href="cloneable/heterogenous_containers.html#cloneable.heterogenous_containers.hashmap_and_hashset">HashMap
and HashSet</a></span></dt>
</dl></dd>
</dl>
</div>
<a name="cloneable..motivation"></a><h4>
-<a name="id663315"></a>
+<a name="id649132"></a>
<a class="link" href="index.html#cloneable..motivation">Motivation</a>
</h4>
<p>
@@ -86,7 +86,7 @@
safely clone and query individual object instances.
</p>
<a name="cloneable..description"></a><h4>
-<a name="id663331"></a>
+<a name="id649149"></a>
<a class="link" href="index.html#cloneable..description">Description</a>
</h4>
<p>
@@ -151,12 +151,32 @@
The complete source code for the library, with unit-tests, are available in the
Boost SVN respository here.
</p>
+<div class="section" title="Change Log">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="cloneable.change_log"></a><a class="link" href="index.html#cloneable.change_log" title="Change Log"> Change Log</a>
+</h2></div></div></div>
+<a name="cloneable.change_log.version_0_1"></a><h4>
+<a name="id649257"></a>
+ <a class="link" href="index.html#cloneable.change_log.version_0_1">Version 0.1</a>
+ </h4>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ Associative heterogenous containers
+ </li>
+<li class="listitem">
+ User-defined base classes
+ </li>
+<li class="listitem">
+ Created
+ </li>
+</ul></div>
+</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: July 05, 2009 at 10:42:31 GMT</small></p></td>
+<td align="left"><p><small>Last revised: July 08, 2009 at 20:09:11 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
-<div class="spirit-nav"><a accesskey="n" href="cloneable/change_log.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
+<div class="spirit-nav"><a accesskey="n" href="cloneable/tutorial.html"><img src="../../doc/html/images/next.png" alt="Next"></a></div>
</body>
</html>
Modified: sandbox/cloneable/libs/cloneable/doc/html/standalone_HTML.manifest
==============================================================================
--- sandbox/cloneable/libs/cloneable/doc/html/standalone_HTML.manifest (original)
+++ sandbox/cloneable/libs/cloneable/doc/html/standalone_HTML.manifest 2009-07-08 16:10:31 EDT (Wed, 08 Jul 2009)
@@ -1,20 +1,3 @@
index.html
-cloneable/change_log.html
cloneable/tutorial.html
-cloneable/tutorial/simple_hierarchical_cloning.html
-cloneable/tutorial/controlling_construction.html
-cloneable/tutorial/using_external_types.html
-cloneable/tutorial/dealing_with_muliple_sub_objects.html
-cloneable/tutorial/customising_the_cloning_process.html
-cloneable/tutorial/using_custom_allocators.html
-cloneable/tutorial/cloneable_instance.html
-cloneable/tutorial/cloneable_traits.html
cloneable/heterogenous_containers.html
-cloneable/heterogenous_containers/extended_object_hierarhcy.html
-cloneable/heterogenous_containers/container_method_names.html
-cloneable/heterogenous_containers/list.html
-cloneable/heterogenous_containers/vector.html
-cloneable/heterogenous_containers/set.html
-cloneable/heterogenous_containers/map.html
-cloneable/heterogenous_containers/heterogenous_map.html
-cloneable/heterogenous_containers/hashmap_and_hashset.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