|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54736 - in sandbox/monotonic/libs/monotonic/doc: . html html/monotonic_storage html/monotonic_storage/tutorial
From: christian.schladetsch_at_[hidden]
Date: 2009-07-06 18:48:11
Author: cschladetsch
Date: 2009-07-06 18:48:08 EDT (Mon, 06 Jul 2009)
New Revision: 54736
URL: http://svn.boost.org/trac/boost/changeset/54736
Log:
updated docs
Text files modified:
sandbox/monotonic/libs/monotonic/doc/html/index.html | 4 +-
sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/change_log.html | 4 +-
sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/containers.html | 4 +-
sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/tutorial/stack.html | 45 ++++++++++++++++++++++++----------------
sandbox/monotonic/libs/monotonic/doc/monotonic.qbk | 41 ++++++++++++++++++++----------------
5 files changed, 56 insertions(+), 42 deletions(-)
Modified: sandbox/monotonic/libs/monotonic/doc/html/index.html
==============================================================================
--- sandbox/monotonic/libs/monotonic/doc/html/index.html (original)
+++ sandbox/monotonic/libs/monotonic/doc/html/index.html 2009-07-06 18:48:08 EDT (Mon, 06 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="id659902"></a><p>
+<a name="id667547"></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>
@@ -55,7 +55,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 06, 2009 at 22:36:04 GMT</small></p></td>
+<td align="left"><p><small>Last revised: July 06, 2009 at 22:47:08 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/change_log.html
==============================================================================
--- sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/change_log.html (original)
+++ sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/change_log.html 2009-07-06 18:48:08 EDT (Mon, 06 Jul 2009)
@@ -27,14 +27,14 @@
<a name="monotonic_storage.change_log"></a><a class="link" href="change_log.html" title="Change Log"> Change Log</a>
</h2></div></div></div>
<a name="monotonic_storage.change_log.version_0_4"></a><h4>
-<a name="id660007"></a>
+<a name="id667653"></a>
<a class="link" href="change_log.html#monotonic_storage.change_log.version_0_4">Version 0.4</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
Added reclaimable storage
</li></ul></div>
<a name="monotonic_storage.change_log.version_0_3"></a><h4>
-<a name="id660028"></a>
+<a name="id667673"></a>
<a class="link" href="change_log.html#monotonic_storage.change_log.version_0_3">Version 0.3</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
Modified: sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/containers.html
==============================================================================
--- sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/containers.html (original)
+++ sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/containers.html 2009-07-06 18:48:08 EDT (Mon, 06 Jul 2009)
@@ -30,7 +30,7 @@
<p>
Along with an allocator, storage and stack system, the Monotonic library provides
a set of containers that use stateful monotonic allocators
- <sup>[<a name="id665771" href="#ftn.id665771" class="footnote">1</a>]</sup>
+ <sup>[<a name="id673522" href="#ftn.id673522" class="footnote">1</a>]</sup>
.
</p>
<p>
@@ -84,7 +84,7 @@
</table></div>
<div class="footnotes">
<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a name="ftn.id665771" href="#id665771" class="para">1</a>] </sup>
+<div class="footnote"><p><sup>[<a name="ftn.id673522" href="#id673522" class="para">1</a>] </sup>
these are based on boost::interprocess::containers
</p></div>
</div>
Modified: sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/tutorial/stack.html
==============================================================================
--- sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/tutorial/stack.html (original)
+++ sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/tutorial/stack.html 2009-07-06 18:48:08 EDT (Mon, 06 Jul 2009)
@@ -59,6 +59,13 @@
as a platform-independant <code class="computeroutput"><span class="identifier">alloca</span><span class="special">(</span><span class="identifier">size</span><span class="special">)</span></code>
by pushing an array of bytes, as shown above.
</p>
+<p>
+ When we call <code class="computeroutput"><span class="identifier">stack</span><span class="special">.</span><span class="identifier">pop</span><span class="special">()</span></code>,
+ the last value added to the stack is destroyed and the stack pointer is set
+ to the start of the previous object on the stack. Calling <code class="computeroutput"><span class="identifier">pop</span></code>
+ on an empty stack throws an <code class="computeroutput"><span class="identifier">empty_stack</span></code>
+ exception.
+ </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>
@@ -81,24 +88,26 @@
<span class="special">{</span>
<span class="special">...</span> <span class="identifier">add</span> <span class="identifier">objects</span> <span class="identifier">to</span> <span class="identifier">the</span> <span class="identifier">stack</span> <span class="special">...</span>
- <span class="identifier">size_t</span> <span class="identifier">size</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span>
- <span class="identifier">Stack</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">elem</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
- <span class="keyword">for</span> <span class="special">(;</span> <span class="identifier">elem</span> <span class="special">!=</span> <span class="identifier">end</span><span class="special">;</span> <span class="special">++</span><span class="identifier">elem</span><span class="special">)</span>
- <span class="special">{</span>
- <span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">elem</span><span class="special">-></span><span class="identifier">get_type</span><span class="special">().</span><span class="identifier">name</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">endl</span><span class="special">;</span>
- <span class="keyword">if</span> <span class="special">(</span><span class="identifier">elem</span><span class="special">-></span><span class="identifier">is_type</span><span class="special"><</span><span class="keyword">int</span><span class="special">>())</span>
- <span class="special">{</span>
- <span class="keyword">int</span> <span class="identifier">num</span> <span class="special">=</span> <span class="identifier">elem</span><span class="special">-></span><span class="identifier">get</span><span class="special"><</span><span class="keyword">int</span><span class="special">>();</span>
- <span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">num</span> <span class="special"><<</span> <span class="identifier">endl</span><span class="special">;</span>
- <span class="special">}</span>
- <span class="special">}</span>
-
- <span class="comment">// stacks are first-class objects and can be copied, passed
-</span> <span class="comment">// as arguments and returned as results
-</span> <span class="identifier">Stack</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">;</span>
-
- <span class="comment">// unecessary in this case; will be cleared when stack leaves scope
-</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">clear</span><span class="special">();</span>
+ <span class="identifier">array</span><span class="special"><</span><span class="keyword">char</span><span class="special">,</span> <span class="number">1000</span><span class="special">></span> <span class="special">&</span><span class="identifier">bytes</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">push_array</span><span class="special"><</span><span class="keyword">char</span><span class="special">,</span> <span class="number">1000</span><span class="special">>();</span>
+
+ <span class="identifier">size_t</span> <span class="identifier">size</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span>
+ <span class="identifier">Stack</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">elem</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
+ <span class="keyword">for</span> <span class="special">(;</span> <span class="identifier">elem</span> <span class="special">!=</span> <span class="identifier">end</span><span class="special">;</span> <span class="special">++</span><span class="identifier">elem</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">elem</span><span class="special">-></span><span class="identifier">get_type</span><span class="special">().</span><span class="identifier">name</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">endl</span><span class="special">;</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">elem</span><span class="special">-></span><span class="identifier">is_type</span><span class="special"><</span><span class="keyword">int</span><span class="special">>())</span>
+ <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">num</span> <span class="special">=</span> <span class="identifier">elem</span><span class="special">-></span><span class="identifier">get</span><span class="special"><</span><span class="keyword">int</span><span class="special">>();</span>
+ <span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">num</span> <span class="special"><<</span> <span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+
+ <span class="comment">// stacks are first-class objects and can be copied, passed
+</span> <span class="comment">// as arguments and returned as results
+</span> <span class="identifier">Stack</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">;</span>
+
+ <span class="comment">// unecessary in this case; will be cleared when stack leaves scope
+</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">clear</span><span class="special">();</span>
<span class="special">}</span>
</pre>
<p>
Modified: sandbox/monotonic/libs/monotonic/doc/monotonic.qbk
==============================================================================
--- sandbox/monotonic/libs/monotonic/doc/monotonic.qbk (original)
+++ sandbox/monotonic/libs/monotonic/doc/monotonic.qbk 2009-07-06 18:48:08 EDT (Mon, 06 Jul 2009)
@@ -292,6 +292,9 @@
We can use a `stack<>` as a platform-independant `alloca(size)` by pushing an array of bytes, as shown above.
+When we call `stack.pop()`, the last value added to the stack is destroyed and the stack pointer is set to
+the start of the previous object on the stack. Calling `pop` on an empty stack throws an `empty_stack` exception.
+
[note It is best practise to open a new statement block before using a `stack<>` object. This ensures that the objects
on the `stack<>` still have storage when when they are automatically deleted]
@@ -303,24 +306,26 @@
{
... add objects to the stack ...
- size_t size = stack.size();
- Stack::const_iterator elem = stack.begin(), end = stack.end();
- for (; elem != end; ++elem)
- {
- cout << elem->get_type().name() << endl;
- if (elem->is_type<int>())
- {
- int num = elem->get<int>();
- cout << num << endl;
- }
- }
-
- // stacks are first-class objects and can be copied, passed
- // as arguments and returned as results
- Stack copy = stack;
-
- // unecessary in this case; will be cleared when stack leaves scope
- stack.clear();
+ array<char, 1000> &bytes = stack.push_array<char, 1000>();
+
+ size_t size = stack.size();
+ Stack::const_iterator elem = stack.begin(), end = stack.end();
+ for (; elem != end; ++elem)
+ {
+ cout << elem->get_type().name() << endl;
+ if (elem->is_type<int>())
+ {
+ int num = elem->get<int>();
+ cout << num << endl;
+ }
+ }
+
+ // stacks are first-class objects and can be copied, passed
+ // as arguments and returned as results
+ Stack copy = stack;
+
+ // unecessary in this case; will be cleared when stack leaves scope
+ stack.clear();
}
``
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