|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54639 - in sandbox/cloneable/libs/cloneable/doc: . html html/cloneable html/cloneable/heterogenous_containers html/cloneable/tutorial
From: christian.schladetsch_at_[hidden]
Date: 2009-07-04 06:00:34
Author: cschladetsch
Date: 2009-07-04 06:00:33 EDT (Sat, 04 Jul 2009)
New Revision: 54639
URL: http://svn.boost.org/trac/boost/changeset/54639
Log:
udpated
Text files modified:
sandbox/cloneable/libs/cloneable/doc/cloneable.qbk | 38 ++++++++++++++----------
sandbox/cloneable/libs/cloneable/doc/html/cloneable/change_log.html | 2
sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers/container_method_names.html | 60 ++++++++++++++++++++++------------------
sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/controlling_construction.html | 6 ++--
sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/simple_hierarchical_cloning.html | 24 ++++++++++------
sandbox/cloneable/libs/cloneable/doc/html/index.html | 4 +-
6 files changed, 76 insertions(+), 58 deletions(-)
Modified: sandbox/cloneable/libs/cloneable/doc/cloneable.qbk
==============================================================================
--- sandbox/cloneable/libs/cloneable/doc/cloneable.qbk (original)
+++ sandbox/cloneable/libs/cloneable/doc/cloneable.qbk 2009-07-04 06:00:33 EDT (Sat, 04 Jul 2009)
@@ -124,7 +124,7 @@
``
Note that `Animal` doesn't have to derive from anything, or have any special members or methods.
-Now let's use out base class to create a simple type hierarchy:
+Now let's use our base class to create a simple type hierarchy:
``
@@ -140,7 +140,10 @@
``
We derive our `Cat` class from `cloneable::base<Cat, Animal>`. The first type argument to `base<...>` is
-the derived type to use for cloning, and the second argument is the common base type of the hierarhcy.
+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 `cloneable::base_type`.
+
Other than that, `Cat` implements the `get_name` pure virtual method derived in the base class `Animal`.
Now, let's use it:
@@ -205,9 +208,11 @@
}
``
-Here we see that class Labrador is-a Dog, and is also cloneable as a Labrador.
-When cloning this class, we specify which sub-object we wish to duplicate.
-when using `clone_as<T>`, we actually are making a type of T, rather than making another type and casting up.
+When cloning the `Labrador` class, we must specify which sub-object we wish to duplicate using the
+`clone_as<Ty>` method.
+
+It should be noted that when using `clone_as<Ty>`, we actually are making a type of `Ty`, rather than
+making another type and casting up.
We can also use the Cloneable library to make a new instance, with no duplication:
@@ -258,8 +263,8 @@
`T0` 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 `no_default_construction_tag`
-type as a parameter to cloneable::base<>. The order that you give the base-type or tag-types
-to cloneable::base<> is not important and is dealt with be the library.
+type as a parameter to `cloneable::base<>`. The order that you give the base-type or tag-types
+to `cloneable::base<>` is not important and is dealt with correctly by the library.
Putting this type to use:
@@ -659,29 +664,30 @@
container.find<Ty>(a0, a1,..., an);
``
-This creates a new object of type `Ty`, constructed with the provided arguments, and searches for it
-in the container. But, I'm getting a little ahead of ourselves here - more on associative containers later; let's
-look at that syntax again.
+This creates a new object of type `Ty`, 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.
-The name for the method to add new objects to heterogenous sequence containers has gone from
+[:[*['["Aside: The name for the method to add new objects to heterogenous sequence containers has gone from
being called `push_back` to `emplace_back` to `push_emplace_back`
and back to `push_back`. Similarly for associative containers the names have varied
from `insert` to `emplace` to `emplace_insert` and back to `insert`.
-
The C++0x containers have emplace methods that insert a new object after a given iterator
location, by passing construction arguments. These are called `emplace` 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 `emplace_back` rather than `push_back`; but the difference is that
-there is no `push_back` in a heterogenous container: everything is always ['emplaced],
-so this is one reason why I've been vasilating over the naming conventions to use.
+there is no `push_back` in a heterogenous container: everything is always emplaced,
+so this is one reason why I've been vasilating over the naming conventions to use]]]
+
+-- CJS
+]
With this in mind, let's visit the first container: the faithful list.
Modified: sandbox/cloneable/libs/cloneable/doc/html/cloneable/change_log.html
==============================================================================
--- sandbox/cloneable/libs/cloneable/doc/html/cloneable/change_log.html (original)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/change_log.html 2009-07-04 06:00:33 EDT (Sat, 04 Jul 2009)
@@ -27,7 +27,7 @@
<a name="cloneable.change_log"></a><a class="link" href="change_log.html" title="Change Log"> Change Log</a>
</h2></div></div></div>
<a name="cloneable.change_log.version_0_1"></a><h4>
-<a name="id652465"></a>
+<a name="id641542"></a>
<a class="link" href="change_log.html#cloneable.change_log.version_0_1">Version 0.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
Modified: sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers/container_method_names.html
==============================================================================
--- sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers/container_method_names.html (original)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers/container_method_names.html 2009-07-04 06:00:33 EDT (Sat, 04 Jul 2009)
@@ -55,39 +55,45 @@
</p>
<p>
This creates a new object of type <code class="computeroutput"><span class="identifier">Ty</span></code>,
- constructed with the provided arguments, and searches for it in the container.
+ 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; let's look at that syntax again.
+ later.
</p>
+<div class="blockquote"><blockquote class="blockquote">
<p>
- The name for the method to add new objects to heterogenous sequence containers
- has gone from being called <code class="computeroutput"><span class="identifier">push_back</span></code>
- to <code class="computeroutput"><span class="identifier">emplace_back</span></code> to <code class="computeroutput"><span class="identifier">push_emplace_back</span></code> and back to <code class="computeroutput"><span class="identifier">push_back</span></code>. Similarly for associative containers
- the names have varied from <code class="computeroutput"><span class="identifier">insert</span></code>
- to <code class="computeroutput"><span class="identifier">emplace</span></code> to <code class="computeroutput"><span class="identifier">emplace_insert</span></code> and back to <code class="computeroutput"><span class="identifier">insert</span></code>.
- </p>
+ </p>
<p>
- The C++0x containers have emplace methods that insert a new object after
- a given iterator location, by passing construction arguments. These are called
- <code class="computeroutput"><span class="identifier">emplace</span></code> methods.
- </p>
+ <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 vasilating over the naming conventions to use</span>”</span></em></span></strong></span>
+ </p>
<p>
- This is similar to the way that objects are added to heterogenous containers,
- but not the same. For all heterogenous containers, the process is to specify
- the type of thing and any creation arguments. There is no need to specify
- an iterator, but there is a need to specify the type explicitly. This is
- different to the C++0x containers, which do not require the type.
- </p>
+ </p>
<p>
- For this reason the names have changed and are yet to be settled. All suggestions
- for the names of the methods, or namespaces, are welcome. I am sure they'll
- end up being called something like <code class="computeroutput"><span class="identifier">emplace_back</span></code>
- rather than <code class="computeroutput"><span class="identifier">push_back</span></code>; but
- the difference is that there is no <code class="computeroutput"><span class="identifier">push_back</span></code>
- in a heterogenous container: everything is always <span class="emphasis"><em>emplaced</em></span>,
- so this is one reason why I've been vasilating over the naming conventions
- to use.
- </p>
+ -- CJS
+ </p>
+<p>
+ </p>
+</blockquote></div>
<p>
With this in mind, let's visit the first container: the faithful list.
</p>
Modified: sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/controlling_construction.html
==============================================================================
--- sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/controlling_construction.html (original)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/controlling_construction.html 2009-07-04 06:00:33 EDT (Sat, 04 Jul 2009)
@@ -49,9 +49,9 @@
reference and as such doesn't have a default constructor. To avoid compile-time
errors when using this type in the Cloneable libray, you must indicate that
it is not default-constructible by passing the <code class="computeroutput"><span class="identifier">no_default_construction_tag</span></code>
- type as a parameter to cloneable::base<>. The order that you give the
- base-type or tag-types to cloneable::base<> is not important and is
- dealt with be the library.
+ 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 and is dealt with
+ correctly by the library.
</p>
<p>
Putting this type to use:
Modified: sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/simple_hierarchical_cloning.html
==============================================================================
--- sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/simple_hierarchical_cloning.html (original)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/simple_hierarchical_cloning.html 2009-07-04 06:00:33 EDT (Sat, 04 Jul 2009)
@@ -54,7 +54,7 @@
<p>
Note that <code class="computeroutput"><span class="identifier">Animal</span></code> doesn't
have to derive from anything, or have any special members or methods. Now
- let's use out base class to create a simple type hierarchy:
+ let's use our base class to create a simple type hierarchy:
</p>
<p>
@@ -75,9 +75,13 @@
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></code>
is the derived type to use for cloning, and the second argument is the common
- base type of the hierarhcy. 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 in the base class <code class="computeroutput"><span class="identifier">Animal</span></code>.
+ 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 in the base class <code class="computeroutput"><span class="identifier">Animal</span></code>.
</p>
<p>
Now, let's use it:
@@ -166,11 +170,13 @@
<p>
</p>
<p>
- Here we see that class Labrador is-a Dog, and is also cloneable as a Labrador.
- When cloning this class, we specify which sub-object we wish to duplicate.
- when using <code class="computeroutput"><span class="identifier">clone_as</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span></code>,
- we actually are making a type of T, rather than making another type and casting
- up.
+ 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 a type of <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 instance, with no duplication:
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-04 06:00:33 EDT (Sat, 04 Jul 2009)
@@ -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="id652367"></a><p>
+<a name="id641444"></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>
@@ -74,7 +74,7 @@
</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 04, 2009 at 09:34:23 GMT</small></p></td>
+<td align="left"><p><small>Last revised: July 04, 2009 at 09:59:48 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
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