Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54670 - in sandbox/cloneable/libs/cloneable/doc/html/cloneable: heterogenous_containers tutorial
From: christian.schladetsch_at_[hidden]
Date: 2009-07-05 06:47:19


Author: cschladetsch
Date: 2009-07-05 06:47:18 EDT (Sun, 05 Jul 2009)
New Revision: 54670
URL: http://svn.boost.org/trac/boost/changeset/54670

Log:
added files

Added:
   sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers/heterogenous_map.html (contents, props changed)
   sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/cloneable_instance.html (contents, props changed)

Added: sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers/heterogenous_map.html
==============================================================================
--- (empty file)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers/heterogenous_map.html 2009-07-05 06:47:18 EDT (Sun, 05 Jul 2009)
@@ -0,0 +1,81 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Heterogenous Map</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
+<link rel="home" href="../../index.html" title="Cloneable 0.1">
+<link rel="up" href="../heterogenous_containers.html" title="Heterogenous Containers">
+<link rel="prev" href="map.html" title="Map">
+<link rel="next" href="hashmap_and_hashset.html" title="HashMap and HashSet">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="map.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../heterogenous_containers.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="hashmap_and_hashset.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</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_map.html" 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">&lt;</span><span class="identifier">Animal</span><span class="special">&gt;</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">&lt;</span><span class="identifier">Dog</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Dog</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Cat</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Cat</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Cat</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Cat</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Labrador</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Cat</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Animal</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Animal</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Dog</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Cat</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Cat</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Dog</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Dog</span><span class="special">&gt;(</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>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2009 Christian Schladetsch<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="map.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../heterogenous_containers.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="hashmap_and_hashset.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/cloneable_instance.html
==============================================================================
--- (empty file)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/cloneable_instance.html 2009-07-05 06:47:18 EDT (Sun, 05 Jul 2009)
@@ -0,0 +1,95 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Cloneable Instance</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
+<link rel="home" href="../../index.html" title="Cloneable 0.1">
+<link rel="up" href="../tutorial.html" title="Tutorial">
+<link rel="prev" href="using_custom_allocators.html" title="Using Custom Allocators">
+<link rel="next" href="cloneable_traits.html" title="Cloneable Traits">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="using_custom_allocators.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="cloneable_traits.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</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="cloneable_instance.html" 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">&lt;&gt;</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">&lt;&gt;</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">&lt;</span><span class="identifier">Foo</span><span class="special">,</span> <span class="identifier">Base</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">};</span>
+
+<span class="keyword">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">&lt;</span><span class="identifier">Base</span><span class="special">&gt;</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">&lt;</span><span class="identifier">Foo</span><span class="special">&gt;(</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">&lt;</span><span class="identifier">Foo</span><span class="special">&gt;</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">&lt;</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">&gt;</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>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2009 Christian Schladetsch<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="using_custom_allocators.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="cloneable_traits.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>


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