|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54660 - in sandbox/cloneable/libs/cloneable: doc doc/html doc/html/cloneable doc/html/cloneable/heterogenous_containers doc/html/cloneable/tutorial test
From: christian.schladetsch_at_[hidden]
Date: 2009-07-04 20:15:53
Author: cschladetsch
Date: 2009-07-04 20:15:52 EDT (Sat, 04 Jul 2009)
New Revision: 54660
URL: http://svn.boost.org/trac/boost/changeset/54660
Log:
udpated docs
Text files modified:
sandbox/cloneable/libs/cloneable/doc/cloneable.qbk | 23 +++++++++++++++--------
sandbox/cloneable/libs/cloneable/doc/html/cloneable/change_log.html | 2 +-
sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers/map.html | 22 +++++++++++++++-------
sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/cloneable_traits.html | 2 +-
sandbox/cloneable/libs/cloneable/doc/html/index.html | 4 ++--
sandbox/cloneable/libs/cloneable/test/tests.cpp | 24 +++++++++++++++---------
6 files changed, 49 insertions(+), 28 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 20:15:52 EDT (Sat, 04 Jul 2009)
@@ -587,11 +587,10 @@
BOOST_STATIC_ASSERT(!cloneable::is_default_constructable<T>::value);
``
-More details are in the `clonable::traits<T>` structure. [@boost:/libs/cloneable/boost/cloneable/traits.hpp traits.hpp]
+Full details are in [@boost:/boost/cloneable/traits.hpp traits.hpp].
[endsect]
-
[endsect]
[section Heterogenous Containers]
@@ -883,16 +882,24 @@
{
typedef heterogenous::map<Animal> Map;
Map map;
- Map::value_type pair0 = map.key<Dog>("spot", 12).value<Dog>("rover", 8).value;
- Map::value_type pair1 = map.key<Cat>("sam", 6).value<Cat>("sooty", 10).value;
- Map::value_type pair2 = map.key<Cat>("fluffy", 10).value<Cat>("tigger", 14).value;
- Map::value_type pair3 = map.key<Labrador>("max", 12).value<Cat>("sooty", 3).value;
+ map.key<Dog>("spot", 12).value<Dog>("rover", 8);
+ map.key<Cat>("sam", 6).value<Cat>("sooty", 10);
+ map.key<Cat>("fluffy", 10).value<Cat>("tigger", 14);
+ map.key<Labrador>("max", 12).value<Cat>("sooty", 3);
+ // make a deep copy of both the keys and values in the map
Map copy = map;
- Map::iterator found_pair0 = map.find<Cat>("sam", 6);
+ // can search for any type of animal
+ assert(copy.find<Animal>("spot", 12) != copy.end());
+ assert(copy.find<Animal>("sam", 6) != copy.end());
- assert(&found_pair0->first == pair1.first);
+ // or, search for specific animal instances
+ assert(copy.find<Dog>("spot", 12) != copy.end());
+ assert(copy.find<Cat>("spot", 12) == copy.end());
+ assert(copy.find<Cat>("sam", 6) != copy.end());
+ assert(copy.find<Dog>("max", 12) != copy.end());
+ assert(copy.find<Dog>("fluffy", 10) == copy.end());
return 0;
}
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 20:15:52 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="id687458"></a>
+<a name="id684182"></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">
Modified: sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers/map.html
==============================================================================
--- sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers/map.html (original)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/heterogenous_containers/map.html 2009-07-04 20:15:52 EDT (Sat, 04 Jul 2009)
@@ -36,16 +36,24 @@
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">heterogenous</span><span class="special">::</span><span class="identifier">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">value_type</span> <span class="identifier">pair0</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">value</span><span class="special">;</span>
- <span class="identifier">Map</span><span class="special">::</span><span class="identifier">value_type</span> <span class="identifier">pair1</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">value</span><span class="special">;</span>
- <span class="identifier">Map</span><span class="special">::</span><span class="identifier">value_type</span> <span class="identifier">pair2</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">value</span><span class="special">;</span>
- <span class="identifier">Map</span><span class="special">::</span><span class="identifier">value_type</span> <span class="identifier">pair3</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="identifier">value</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="identifier">Map</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="identifier">map</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="identifier">Map</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">found_pair0</span> <span class="special">=</span> <span class="identifier">map</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="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="identifier">assert</span><span class="special">(&</span><span class="identifier">found_pair0</span><span class="special">-></span><span class="identifier">first</span> <span class="special">==</span> <span class="identifier">pair1</span><span class="special">.</span><span class="identifier">first</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>
Modified: sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/cloneable_traits.html
==============================================================================
--- sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/cloneable_traits.html (original)
+++ sandbox/cloneable/libs/cloneable/doc/html/cloneable/tutorial/cloneable_traits.html 2009-07-04 20:15:52 EDT (Sat, 04 Jul 2009)
@@ -53,7 +53,7 @@
<p>
</p>
<p>
- Full details are in traits.hpp
+ Full details are in traits.hpp.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
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 20:15:52 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="id687319"></a><p>
+<a name="id684042"></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 23:19:19 GMT</small></p></td>
+<td align="left"><p><small>Last revised: July 05, 2009 at 00:14:51 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/cloneable/libs/cloneable/test/tests.cpp
==============================================================================
--- sandbox/cloneable/libs/cloneable/test/tests.cpp (original)
+++ sandbox/cloneable/libs/cloneable/test/tests.cpp 2009-07-04 20:15:52 EDT (Sat, 04 Jul 2009)
@@ -593,6 +593,14 @@
int number;
my_base(int n = 0) : number(n) { }
virtual ~my_base() { }
+ bool operator==(my_base const &other) const
+ {
+ return number == other.number;
+ }
+ bool operator!=(my_base const &other) const
+ {
+ return number != other.number;
+ }
bool operator<(my_base const &other) const
{
return number < other.number;
@@ -632,7 +640,7 @@
BOOST_AUTO_TEST_CASE(test_map)
{
- return;
+ //return;
using namespace map_test;
M2 m2;
const abstract_base<map_test::my_base> &ab2 = m2;
@@ -644,19 +652,19 @@
typedef cloneable::map<map_test::my_base> Map;
Map map;
map.key<M2>().value<M3>();
+ BOOST_ASSERT(map.size() == 1);
Map::iterator a = map.find<M2>();
+ BOOST_ASSERT(a != map.end());
map.key<M0>(42).value<M1>("foo");
- map.key<M2>().value<M3>();
+ BOOST_ASSERT(map.size() == 2);
Map::iterator iter = map.find<M0>(42);
-
BOOST_ASSERT(iter!= map.end());
- M1 *m1 = dynamic_cast<M1 *>(iter->second);
- BOOST_ASSERT(m1 != 0);
- BOOST_ASSERT(m1->str == "foo");
- Map copy = map;
+ map.key<M2>().value<M3>();
+
+// Map copy = map;
}
BOOST_AUTO_TEST_CASE(test_hash)
@@ -765,5 +773,3 @@
}
//EOF
-
-
\ No newline at end of file
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