Changeset 54804


Ignore:
Timestamp:
Jul 8, 2009, 7:53:48 PM (9 years ago)
Author:
cschladetsch
Message:

changed to build docs from sandbox

Location:
sandbox/monotonic/libs/monotonic
Files:
20 added
7 edited

Legend:

Unmodified
Added
Removed
  • sandbox/monotonic/libs/monotonic/doc/Jamfile.v2

    r54582 r54804  
    22
    33import boostbook : boostbook ;
    4 using quickbook ;
     4#//using quickbook ;
    55
    6 xml monotonic : monotonic.qbk ;
     6#//xml monotonic : monotonic.qbk ;
    77
    88#path-constant images : ../../../doc/html ;
     
    1111boostbook standalone
    1212    :
    13         monotonic
    14     :
    15         <xsl:param>boost.root=../../../..
    16         <xsl:param>boost.libraries=../../../../libs/libraries.htm
    17         #<xsl:param>html.stylesheet=../../../../doc/html/boostbook.css
    18         <xsl:param>html.stylesheet=boostbook.css
    19         <xsl:param>generate.section.toc.level=3
    20         <xsl:param>chunk.section.depth=2
    21         <xsl:param>chunk.first.sections=1
    22 
    23         #<xsl:param>callout.graphics.path=../../images/callouts//
    24         <format>pdf:<xsl:param>img.src.path=$(images)/
    25         <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
     13        monotonic.xml
    2614    ;
  • sandbox/monotonic/libs/monotonic/doc/html/index.html

    r54786 r54804  
    66<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
    77<link rel="home" href="index.html" title="Monotonic Storage 0.3">
    8 <link rel="next" href="monotonic_storage/intro.html" title="Introduction">
     8<link rel="next" href="monotonic_storage/change_log.html" title="Change Log">
    99</head>
    1010<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
    1111<table cellpadding="2" width="100%"><tr>
    12 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
    13 <td align="center"><a href="../../../../index.html">Home</a></td>
    14 <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
     12<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td>
     13<td align="center"><a href="../../index.html">Home</a></td>
     14<td align="center"><a href="libraries.html">Libraries</a></td>
    1515<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
    1616<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
    17 <td align="center"><a href="../../../../more/index.htm">More</a></td>
     17<td align="center"><a href="../../more/index.htm">More</a></td>
    1818</tr></table>
    1919<hr>
    20 <div class="spirit-nav"><a accesskey="n" href="monotonic_storage/intro.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
     20<div class="spirit-nav"><a accesskey="n" href="monotonic_storage/change_log.html"><img src="../../doc/html/images/next.png" alt="Next"></a></div>
    2121<div class="article" title="Monotonic Storage 0.3">
    2222<div class="titlepage">
     
    2929<div><p class="copyright">Copyright © 2009 Christian Schladetsch</p></div>
    3030<div><div class="legalnotice" title="Legal Notice">
    31 <a name="id670824"></a><p>
     31<a name="id670952"></a><p>
    3232        Distributed under the Boost Software License, Version 1.0. (See accompanying
    3333        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
     
    4040<p><b>Table of Contents</b></p>
    4141<dl>
    42 <dt><span class="section"><a href="monotonic_storage/intro.html"> Introduction</a></span></dt>
     42<dt><span class="section"><a href="index.html#monotonic_storage.intro"> Introduction</a></span></dt>
    4343<dt><span class="section"><a href="monotonic_storage/change_log.html"> Change Log</a></span></dt>
    4444<dt><span class="section"><a href="monotonic_storage/tutorial.html"> Tutorial</a></span></dt>
    4545<dd><dl>
    46 <dt><span class="section"><a href="monotonic_storage/tutorial/basic_usage.html">Basic Usage</a></span></dt>
    47 <dt><span class="section"><a href="monotonic_storage/tutorial/using_multiple_containers.html">Using
     46<dt><span class="section"><a href="monotonic_storage/tutorial.html#monotonic_storage.tutorial.basic_usage">Basic Usage</a></span></dt>
     47<dt><span class="section"><a href="monotonic_storage/tutorial.html#monotonic_storage.tutorial.using_multiple_containers">Using
    4848      Multiple Containers</a></span></dt>
    49 <dt><span class="section"><a href="monotonic_storage/tutorial/using_regions.html">Using Regions</a></span></dt>
    50 <dt><span class="section"><a href="monotonic_storage/tutorial/stack.html">Stack</a></span></dt>
     49<dt><span class="section"><a href="monotonic_storage/tutorial.html#monotonic_storage.tutorial.using_regions">Using Regions</a></span></dt>
     50<dt><span class="section"><a href="monotonic_storage/tutorial.html#monotonic_storage.tutorial.stack">Stack</a></span></dt>
    5151</dl></dd>
    5252<dt><span class="section"><a href="monotonic_storage/containers.html">Containers</a></span></dt>
    53 <dd><dl><dt><span class="section"><a href="monotonic_storage/containers/chain.html">Chain</a></span></dt></dl></dd>
     53<dd><dl><dt><span class="section"><a href="monotonic_storage/containers.html#monotonic_storage.containers.chain">Chain</a></span></dt></dl></dd>
    5454</dl>
     55</div>
     56<div class="section" title="Introduction">
     57<div class="titlepage"><div><div><h2 class="title" style="clear: both">
     58<a name="monotonic_storage.intro"></a><a class="link" href="index.html#monotonic_storage.intro" title="Introduction"> Introduction</a>
     59</h2></div></div></div>
     60<p>
     61      The <span class="bold"><strong>Boost.Monotonic</strong></span> library provides storage,
     62      allocation and container types for use in high-performance and real-time applications.
     63    </p>
     64<p>
     65      The library provides a means for allocation to come from the BSS, stack, or
     66      the heap, or transparently from a combination of the BSS, stack and heap. Allocation
     67      is fast, because de-allocation does nothing
     68      <sup>[<a name="id670993" href="#ftn.id670993" class="footnote">1</a>]</sup>
     69      . As such, the amount of storage used by a monotonic allocator can only ever
     70      increase - hence the name of the library. A LIFO allocation model is also provided.
     71    </p>
     72<p>
     73      Allocation can be <span class="emphasis"><em>regionalised</em></span> by application of user-supplied
     74      'tag types' to specify a logical storage region. A second tag may be used to
     75      specify the <span class="emphasis"><em>access type</em></span> for the region - which can be
     76      either global, guarded by a mutex, or using thread-local storage.
     77    </p>
     78<p>
     79      <span class="bold"><strong>Boost.Monotonic</strong></span> is generally used where performace
     80      is a key concern, but there are many use-cases where use of this library provides
     81      new functionality
     82      <sup>[<a name="id671038" href="#ftn.id671038" class="footnote">2</a>]</sup>
     83      .
     84    </p>
     85<p>
     86      By making deallocation a no-op, allocation of memory resources is extremely
     87      fast. In general, the programmer is required to release storage used at an
     88      appropriate time, however local scoping systems are provided by the library
     89      for the most common use cases.
     90    </p>
     91<p>
     92      Features include:
     93    </p>
     94<div class="itemizedlist"><ul class="itemizedlist" type="disc">
     95<li class="listitem">
     96        fast allocation from the stack
     97      </li>
     98<li class="listitem">
     99        automatic extension to the heap as needed
     100      </li>
     101<li class="listitem">
     102        storage can be segmented into independant regions
     103      </li>
     104<li class="listitem">
     105        support for thread-safe storage, and thread-local storage
     106      </li>
     107<li class="listitem">
     108        storage can be accessed directly, providing a 'first-class stack' system
     109      </li>
     110<li class="listitem">
     111        containers that can use storage from the stack, from the heap, or both the
     112        stack and the heap
     113      </li>
     114</ul></div>
     115</div>
     116<div class="footnotes">
     117<br><hr width="100" align="left">
     118<div class="footnote"><p><sup>[<a name="ftn.id670993" href="#id670993" class="para">1</a>] </sup>
     119          except for <code class="computeroutput"><span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code>
     120        </p></div>
     121<div class="footnote"><p><sup>[<a name="ftn.id671038" href="#id671038" class="para">2</a>] </sup>
     122          such as in self- or mutually-recursive algorithms
     123        </p></div>
    55124</div>
    56125</div>
    57126<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
    58 <td align="left"><p><small>Last revised: July 07, 2009 at 09:33:35 GMT</small></p></td>
     127<td align="left"><p><small>Last revised: July 08, 2009 at 19:50:58 GMT</small></p></td>
    59128<td align="right"><div class="copyright-footer"></div></td>
    60129</tr></table>
    61130<hr>
    62 <div class="spirit-nav"><a accesskey="n" href="monotonic_storage/intro.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
     131<div class="spirit-nav"><a accesskey="n" href="monotonic_storage/change_log.html"><img src="../../doc/html/images/next.png" alt="Next"></a></div>
    63132</body>
    64133</html>
  • sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/change_log.html

    r54786 r54804  
    77<link rel="home" href="../index.html" title="Monotonic Storage 0.3">
    88<link rel="up" href="../index.html" title="Monotonic Storage 0.3">
    9 <link rel="prev" href="intro.html" title="Introduction">
     9<link rel="prev" href="../index.html" title="Monotonic Storage 0.3">
    1010<link rel="next" href="tutorial.html" title="Tutorial">
    1111</head>
    1212<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
    1313<table cellpadding="2" width="100%"><tr>
    14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
    15 <td align="center"><a href="../../../../../index.html">Home</a></td>
    16 <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
     14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
     15<td align="center"><a href="../../../index.html">Home</a></td>
     16<td align="center"><a href="../libraries.html">Libraries</a></td>
    1717<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
    1818<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
    19 <td align="center"><a href="../../../../../more/index.htm">More</a></td>
     19<td align="center"><a href="../../../more/index.htm">More</a></td>
    2020</tr></table>
    2121<hr>
    2222<div class="spirit-nav">
    23 <a accesskey="p" href="intro.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.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
     23<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="tutorial.html"><img src="../../../doc/html/images/next.png" alt="Next"></a>
    2424</div>
    2525<div class="section" title="Change Log">
     
    2828</h2></div></div></div>
    2929<a name="monotonic_storage.change_log.version_0_4"></a><h4>
    30 <a name="id670966"></a>
     30<a name="id671094"></a>
    3131      <a class="link" href="change_log.html#monotonic_storage.change_log.version_0_4">Version 0.4</a>
    3232    </h4>
     
    3535      </li></ul></div>
    3636<a name="monotonic_storage.change_log.version_0_3"></a><h4>
    37 <a name="id670986"></a>
     37<a name="id671114"></a>
    3838      <a class="link" href="change_log.html#monotonic_storage.change_log.version_0_3">Version 0.3</a>
    3939    </h4>
     
    5252<hr>
    5353<div class="spirit-nav">
    54 <a accesskey="p" href="intro.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.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
     54<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="tutorial.html"><img src="../../../doc/html/images/next.png" alt="Next"></a>
    5555</div>
    5656</body>
  • sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/containers.html

    r54786 r54804  
    77<link rel="home" href="../index.html" title="Monotonic Storage 0.3">
    88<link rel="up" href="../index.html" title="Monotonic Storage 0.3">
    9 <link rel="prev" href="tutorial/stack.html" title="Stack">
    10 <link rel="next" href="containers/chain.html" title="Chain">
     9<link rel="prev" href="tutorial.html" title="Tutorial">
    1110</head>
    1211<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
    1312<table cellpadding="2" width="100%"><tr>
    14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
    15 <td align="center"><a href="../../../../../index.html">Home</a></td>
    16 <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
     13<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
     14<td align="center"><a href="../../../index.html">Home</a></td>
     15<td align="center"><a href="../libraries.html">Libraries</a></td>
    1716<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
    1817<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
    19 <td align="center"><a href="../../../../../more/index.htm">More</a></td>
     18<td align="center"><a href="../../../more/index.htm">More</a></td>
    2019</tr></table>
    2120<hr>
    2221<div class="spirit-nav">
    23 <a accesskey="p" href="tutorial/stack.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="containers/chain.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
     22<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>
    2423</div>
    2524<div class="section" title="Containers">
     
    2726<a name="monotonic_storage.containers"></a><a class="link" href="containers.html" title="Containers">Containers</a>
    2827</h2></div></div></div>
    29 <div class="toc"><dl><dt><span class="section"><a href="containers/chain.html">Chain</a></span></dt></dl></div>
     28<div class="toc"><dl><dt><span class="section"><a href="containers.html#monotonic_storage.containers.chain">Chain</a></span></dt></dl></div>
    3029<p>
    3130      Along with an allocator, storage and stack system, the Monotonic library provides
    3231      a set of containers that use stateful monotonic allocators
    33       <sup>[<a name="id677241" href="#ftn.id677241" class="footnote">5</a>]</sup>
     32      <sup>[<a name="id677323" href="#ftn.id677323" class="footnote">5</a>]</sup>
    3433      .
    3534    </p>
     
    7473<div class="note" title="Note"><table border="0" summary="Note">
    7574<tr>
    76 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/html/images/note.png"></td>
     75<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/html/images/note.png"></td>
    7776<th align="left">Note</th>
    7877</tr>
     
    8382      </p></td></tr>
    8483</table></div>
     84<div class="section" title="Chain"><div class="titlepage"><div><div><h3 class="title">
     85<a name="monotonic_storage.containers.chain"></a><a class="link" href="containers.html#monotonic_storage.containers.chain" title="Chain">Chain</a>
     86</h3></div></div></div></div>
    8587<div class="footnotes">
    8688<br><hr width="100" align="left">
    87 <div class="footnote"><p><sup>[<a name="ftn.id677241" href="#id677241" class="para">5</a>] </sup>
     89<div class="footnote"><p><sup>[<a name="ftn.id677323" href="#id677323" class="para">5</a>] </sup>
    8890          these are based on boost::interprocess::containers
    8991        </p></div>
     
    100102<hr>
    101103<div class="spirit-nav">
    102 <a accesskey="p" href="tutorial/stack.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="containers/chain.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
     104<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>
    103105</div>
    104106</body>
  • sandbox/monotonic/libs/monotonic/doc/html/monotonic_storage/tutorial.html

    r54734 r54804  
    88<link rel="up" href="../index.html" title="Monotonic Storage 0.3">
    99<link rel="prev" href="change_log.html" title="Change Log">
    10 <link rel="next" href="tutorial/basic_usage.html" title="Basic Usage">
     10<link rel="next" href="containers.html" title="Containers">
    1111</head>
    1212<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
    1313<table cellpadding="2" width="100%"><tr>
    14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
    15 <td align="center"><a href="../../../../../index.html">Home</a></td>
    16 <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
     14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
     15<td align="center"><a href="../../../index.html">Home</a></td>
     16<td align="center"><a href="../libraries.html">Libraries</a></td>
    1717<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
    1818<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
    19 <td align="center"><a href="../../../../../more/index.htm">More</a></td>
     19<td align="center"><a href="../../../more/index.htm">More</a></td>
    2020</tr></table>
    2121<hr>
    2222<div class="spirit-nav">
    23 <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/basic_usage.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
     23<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="containers.html"><img src="../../../doc/html/images/next.png" alt="Next"></a>
    2424</div>
    2525<div class="section" title="Tutorial">
     
    2828</h2></div></div></div>
    2929<div class="toc"><dl>
    30 <dt><span class="section"><a href="tutorial/basic_usage.html">Basic Usage</a></span></dt>
    31 <dt><span class="section"><a href="tutorial/using_multiple_containers.html">Using
     30<dt><span class="section"><a href="tutorial.html#monotonic_storage.tutorial.basic_usage">Basic Usage</a></span></dt>
     31<dt><span class="section"><a href="tutorial.html#monotonic_storage.tutorial.using_multiple_containers">Using
    3232      Multiple Containers</a></span></dt>
    33 <dt><span class="section"><a href="tutorial/using_regions.html">Using Regions</a></span></dt>
    34 <dt><span class="section"><a href="tutorial/stack.html">Stack</a></span></dt>
     33<dt><span class="section"><a href="tutorial.html#monotonic_storage.tutorial.using_regions">Using Regions</a></span></dt>
     34<dt><span class="section"><a href="tutorial.html#monotonic_storage.tutorial.stack">Stack</a></span></dt>
    3535</dl></div>
    3636<p>
     
    4141      local storage.
    4242    </p>
     43<div class="section" title="Basic Usage">
     44<div class="titlepage"><div><div><h3 class="title">
     45<a name="monotonic_storage.tutorial.basic_usage"></a><a class="link" href="tutorial.html#monotonic_storage.tutorial.basic_usage" title="Basic Usage">Basic Usage</a>
     46</h3></div></div></div>
     47<p>
     48        The following is a very quick introduction to <span class="bold"><strong>Boost.Monotonic</strong></span>:
     49      </p>
     50<p>
     51       
     52</p>
     53<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">monotonic</span><span class="special">/</span><span class="identifier">allocator</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
     54
     55<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">;</span>
     56
     57<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
     58<span class="special">{</span>
     59    <span class="special">{</span>
     60        <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">list</span><span class="special">;</span>
     61        <span class="keyword">for</span> <span class="special">(</span><span class="identifier">size_t</span> <span class="identifier">n</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">n</span> <span class="special">&lt;</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">n</span><span class="special">)</span>
     62            <span class="identifier">list</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">n</span><span class="special">);</span>
     63    <span class="special">}</span>
     64    <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">static_storage</span><span class="special">&lt;&gt;::</span><span class="identifier">release</span><span class="special">();</span>
     65    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
     66<span class="special">}</span>
     67</pre>
     68<p>
     69      </p>
     70<p>
     71        Here we have created a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span></code>
     72        using a monotonic allocator. While we add new elements to the list in the
     73        for-loop, allocation is coming from storage in the default region with default
     74        access. The first 32k of allocation will come from the BSS segment embedded
     75        in the application image (the amount of such storage is configurable), then
     76        once that local storage is exhausted, later allocation requests will be serviced
     77        from the heap. Since de-allocation does nothing in a monotonic allocator,
     78        we must manually release the resources once we are finished, as shown above.
     79      </p>
     80<p>
     81        While this example is trivial, if you were to benchmark it against using
     82        a default <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span></code> you will find that monotonic
     83        allocation is much faster[1].
     84      </p>
     85<p>
     86        This is one of the main reasons for using this library; to provide efficient
     87        storage and allocation for temporary containers.
     88      </p>
     89<p>
     90        We shall now move on to some more interesting examples, including how to
     91        use multiple containers that share the same strorage, using regions, using
     92        local stack-based storage, and dealing with threading issues.
     93      </p>
     94</div>
     95<div class="section" title="Using Multiple Containers">
     96<div class="titlepage"><div><div><h3 class="title">
     97<a name="monotonic_storage.tutorial.using_multiple_containers"></a><a class="link" href="tutorial.html#monotonic_storage.tutorial.using_multiple_containers" title="Using Multiple Containers">Using
     98      Multiple Containers</a>
     99</h3></div></div></div>
     100<p>
     101        In this example, we create a map of ints to vectors of ints, with each container
     102        using a monotonic allocator:
     103      </p>
     104<p>
     105       
     106</p>
     107<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
     108<span class="special">{</span>
     109    <span class="special">{</span>
     110    <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">Vector</span><span class="special">;</span>
     111    <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">Vector</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;,</span> <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="identifier">Vector</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">Map</span><span class="special">;</span>
     112    <span class="identifier">Map</span> <span class="identifier">map</span><span class="special">;</span>
     113    <span class="keyword">for</span> <span class="special">(</span><span class="identifier">size_t</span> <span class="identifier">n</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">n</span> <span class="special">&lt;</span> <span class="number">10000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">n</span><span class="special">)</span>
     114    <span class="special">{</span>
     115            <span class="identifier">map</span><span class="special">[</span><span class="identifier">rand</span><span class="special">()%</span><span class="number">100</span><span class="special">].</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">n</span><span class="special">);</span>
     116    <span class="special">}</span>
     117    <span class="special">}</span>
     118    <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">static_storage</span><span class="special">&lt;&gt;::</span><span class="identifier">release</span><span class="special">();</span>
     119    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
     120<span class="special">};</span>
     121</pre>
     122<p>
     123      </p>
     124<p>
     125        Again, storage will only ever increase, so we must release it after we have
     126        finished using it.
     127      </p>
     128<p>
     129        Benchmarking the performance of this against other allocation schemes[2]
     130        show that monotonic allocation is extremely fast and efficient.
     131      </p>
     132<p>
     133        The key point here is that you can use a <code class="computeroutput"><span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">allocator</span></code>
     134        anywhere that you would otherwise use a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span></code>
     135        or any other STL-compliant custom allocator. Monotonic allocators of the
     136        same type are effectively stateless, and may be default-constructed, used,
     137        and discarded as needed.
     138      </p>
     139<p>
     140        We will deal with stateful monotonic allocators that can use local stack-based
     141        storage in a later section.
     142      </p>
     143</div>
     144<div class="section" title="Using Regions">
     145<div class="titlepage"><div><div><h3 class="title">
     146<a name="monotonic_storage.tutorial.using_regions"></a><a class="link" href="tutorial.html#monotonic_storage.tutorial.using_regions" title="Using Regions">Using Regions</a>
     147</h3></div></div></div>
     148<p>
     149        While it can be useful to have one storage area for all allocations, at times
     150        will will want to segment our memory usage into different <span class="emphasis"><em>regions</em></span>.
     151        This is done by passing a user-supplied <span class="emphasis"><em>region tag type</em></span>
     152        to the type signature of a <code class="computeroutput"><span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">allocator</span></code>,
     153        as shown here:
     154      </p>
     155<p>
     156       
     157</p>
     158<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">my_region_A</span> <span class="special">{</span> <span class="special">};</span>
     159<span class="keyword">struct</span> <span class="identifier">my_region_B</span> <span class="special">{</span> <span class="special">};</span>
     160
     161<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
     162<span class="special">{</span>
     163    <span class="special">{</span>
     164        <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">my_region_A</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">A_list</span><span class="special">;</span>
     165        <span class="identifier">A_list</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="number">1</span><span class="special">);</span>
     166        <span class="special">{</span>
     167             <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">my_region_B</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">B_list</span><span class="special">;</span>
     168             <span class="identifier">B_list</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="number">2</span><span class="special">);</span>
     169        <span class="special">}</span>
     170        <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">static_storage</span><span class="special">&lt;</span><span class="identifier">my_region_B</span><span class="special">&gt;::</span><span class="identifier">release</span><span class="special">();</span>
     171        <span class="identifier">A_list</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="number">3</span><span class="special">);</span>
     172    <span class="special">}</span>
     173    <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">static_storage</span><span class="special">&lt;</span><span class="identifier">my_region_A</span><span class="special">&gt;::</span><span class="identifier">release</span><span class="special">();</span>
     174    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
     175<span class="special">}</span>
     176</pre>
     177<p>
     178      </p>
     179<p>
     180        Here, we have defined two storage regions, designated with the type-tags
     181        <code class="computeroutput"><span class="identifier">my_region_A</span></code> and <code class="computeroutput"><span class="identifier">my_region_B</span></code>. These are passed as the second
     182        type argument to a <code class="computeroutput"><span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">allocator</span></code>
     183        in order to segment out the storage used. These regions are independant of
     184        each other; releasing storage for <code class="computeroutput"><span class="identifier">B_list</span></code>
     185        does not effect the storage for <code class="computeroutput"><span class="identifier">A_list</span></code>.
     186      </p>
     187<p>
     188        Using segmented storage systems helps with logical seperation of resource
     189        usage amoung different sub-systems within an application. It also helps with
     190        ensuring privacy when using local storage, as demonstrated below:
     191      </p>
     192<p>
     193       
     194</p>
     195<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">System</span>
     196<span class="special">{</span>
     197    <span class="keyword">struct</span> <span class="identifier">region</span> <span class="special">{};</span>
     198    <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">Object</span><span class="special">,</span> <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="identifier">Object</span><span class="special">,</span> <span class="identifier">region</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">Objects</span><span class="special">;</span>
     199
     200<span class="keyword">public</span><span class="special">:</span>
     201    <span class="keyword">void</span> <span class="identifier">update</span><span class="special">()</span>
     202    <span class="special">{</span>
     203        <span class="special">{</span>
     204            <span class="identifier">Objects</span> <span class="identifier">objects</span><span class="special">;</span>
     205            <span class="identifier">GatherRelevant</span><span class="special">(</span><span class="identifier">objects</span><span class="special">);</span>
     206            <span class="identifier">Process</span><span class="special">(</span><span class="identifier">objects</span><span class="special">);</span>
     207            <span class="identifier">Update</span><span class="special">(</span><span class="identifier">objects</span><span class="special">);</span>
     208        <span class="special">}</span>
     209        <span class="comment">// reset storage, ready for next update
     210</span>        <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">static_storage</span><span class="special">&lt;</span><span class="identifier">region</span><span class="special">&gt;::</span><span class="identifier">reset</span><span class="special">();</span>
     211    <span class="special">}</span>
     212<span class="special">};</span>
     213</pre>
     214<p>
     215      </p>
     216<p>
     217        We have used a private region-tag <code class="computeroutput"><span class="identifier">region</span></code>
     218        to guarantee that storage used by local containers such as <code class="computeroutput"><span class="identifier">Objects</span></code> is not shared with any other system.
     219      </p>
     220<p>
     221        Note that this is a typical use-case for monotonic allocation, as it uses
     222        a locally defined container which is populated, used and discarded regularly.
     223      </p>
     224</div>
     225<div class="section" title="Stack">
     226<div class="titlepage"><div><div><h3 class="title">
     227<a name="monotonic_storage.tutorial.stack"></a><a class="link" href="tutorial.html#monotonic_storage.tutorial.stack" title="Stack">Stack</a>
     228</h3></div></div></div>
     229<p>
     230        While monotonic allocators use monotonic storage, we can also use this storage
     231        directly and wherever we want efficient resource management. Using a <code class="computeroutput"><span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code>
     232        gives you a first-class C++ stack which you can use at will, pass as an argument
     233        or return as a result
     234        <sup>[<a name="id675924" href="#ftn.id675924" class="footnote">3</a>]</sup>
     235        .
     236      </p>
     237<p>
     238        The general usage pattern is:
     239      </p>
     240<p>
     241       
     242</p>
     243<pre class="programlisting"><span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">stack</span><span class="special">&lt;</span><span class="identifier">Size</span><span class="special">&gt;</span> <span class="identifier">stack</span><span class="special">;</span>
     244<span class="special">{</span>
     245    <span class="identifier">T0</span> <span class="special">&amp;</span><span class="identifier">t0</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">push</span><span class="special">&lt;</span><span class="identifier">T0</span><span class="special">&gt;(..</span><span class="identifier">args</span><span class="special">..);</span>
     246    <span class="identifier">T1</span> <span class="special">&amp;</span><span class="identifier">t1</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">push</span><span class="special">&lt;</span><span class="identifier">T1</span><span class="special">&gt;(..</span><span class="identifier">args</span><span class="special">..);</span>
     247    <span class="special">....</span>
     248    <span class="identifier">Tn</span> <span class="special">&amp;</span><span class="identifier">tn</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">push</span><span class="special">&lt;</span><span class="identifier">Tn</span><span class="special">&gt;(..</span><span class="identifier">args</span><span class="special">..);</span>
     249   
     250    <span class="identifier">stack</span><span class="special">.</span><span class="identifier">pop</span><span class="special">();</span>
     251    <span class="identifier">stack</span><span class="special">.</span><span class="identifier">pop</span><span class="special">();</span>
     252    <span class="special">...</span>
     253<span class="special">}</span>
     254</pre>
     255<p>
     256      </p>
     257<p>
     258        Objects are created in-place using <span class="emphasis"><em>emplace</em></span> semantics.
     259        You just provide the type and construction arguments - your object will be
     260        either on the stack or the heap and you needn't worry either way. Objects
     261        are <span class="emphasis"><em>not</em></span> copied, which means you can safely use types
     262        that do not have default constructors or assignment overloads with <code class="computeroutput"><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code>.
     263      </p>
     264<p>
     265        All objects pushed onto the <code class="computeroutput"><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code> are destroyed when the stack leaves
     266        scope - there is no need to pop them all explicitly. New objects can be added
     267        between <code class="computeroutput"><span class="identifier">push</span></code> and <code class="computeroutput"><span class="identifier">pop</span></code>.
     268      </p>
     269<p>
     270        You can set the amount of C++ machine stack to use by saying <code class="computeroutput"><span class="identifier">stack</span><span class="special">&lt;</span><span class="identifier">num_bytes</span><span class="special">&gt;</span></code>.The
     271        default inline size of a <code class="computeroutput"><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code> object is defined as <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">DefaltSizes</span><span class="special">::</span><span class="identifier">InlineSize</span></code>.
     272      </p>
     273<p>
     274        We can use a <code class="computeroutput"><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code>
     275        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>
     276        by pushing an array of bytes, by using <code class="computeroutput"><span class="identifier">stack</span><span class="special">.</span><span class="identifier">push</span><span class="special">&lt;</span><span class="keyword">char</span> <span class="special">[</span><span class="identifier">N</span><span class="special">]&gt;</span></code> or <code class="computeroutput"><span class="identifier">stack</span><span class="special">.</span><span class="identifier">push</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;</span> <span class="special">&gt;</span></code>
     277        or more generally <code class="computeroutput"><span class="identifier">stack</span><span class="special">.</span><span class="identifier">push_array</span><span class="special">&lt;</span><span class="identifier">Ty</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;</span></code>.
     278      </p>
     279<p>
     280        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>,
     281        the last value added to the stack is destroyed and the stack pointer is set
     282        to the end of the previous object on the stack. Objects are added using correct
     283        machine alignment. Calling <code class="computeroutput"><span class="identifier">pop</span></code>
     284        on an empty stack throws an <code class="computeroutput"><span class="identifier">empty_stack</span></code>
     285        exception.
     286      </p>
     287<div class="note" title="Note"><table border="0" summary="Note">
     288<tr>
     289<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/html/images/note.png"></td>
     290<th align="left">Note</th>
     291</tr>
     292<tr><td align="left" valign="top"><p>
     293          It is best practise to open a new statement block before using a <code class="computeroutput"><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code>
     294          object. This ensures that the objects on the <code class="computeroutput"><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code> still have storage when when they
     295          are automatically deleted
     296        </p></td></tr>
     297</table></div>
     298<p>
     299        We can also iterate over the stack, get the stack size, and clear the stack:
     300      </p>
     301<p>
     302       
     303</p>
     304<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">stack</span><span class="special">&lt;&gt;</span> <span class="identifier">Stack</span><span class="special">;</span>
     305<span class="identifier">Stack</span> <span class="identifier">stack</span><span class="special">;</span>
     306<span class="special">{</span>
     307    <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>
     308   
     309    <span class="identifier">array</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="number">1000</span><span class="special">&gt;</span> <span class="special">&amp;</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">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="number">1000</span><span class="special">&gt;();</span>
     310   
     311    <span class="comment">// number of elements on the stack
     312</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>
     313   
     314    <span class="comment">// number of bytes used
     315</span>    <span class="identifier">size_t</span> <span class="identifier">used_bytes</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">.</span><span class="identifier">bytes_used</span><span class="special">();</span>
     316   
     317    <span class="comment">// iterate over heterogenous elements
     318</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>
     319    <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>
     320    <span class="special">{</span>
     321        <span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">elem</span><span class="special">-&gt;</span><span class="identifier">get_type</span><span class="special">().</span><span class="identifier">name</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">endl</span><span class="special">;</span>
     322        <span class="keyword">if</span> <span class="special">(</span><span class="identifier">elem</span><span class="special">-&gt;</span><span class="identifier">is_type</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;())</span>
     323        <span class="special">{</span>
     324            <span class="keyword">int</span> <span class="identifier">num</span> <span class="special">=</span> <span class="identifier">elem</span><span class="special">-&gt;</span><span class="identifier">get</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;();</span>
     325            <span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">num</span> <span class="special">&lt;&lt;</span> <span class="identifier">endl</span><span class="special">;</span>
     326        <span class="special">}</span>
     327    <span class="special">}</span>
     328   
     329    <span class="comment">// stacks are first-class objects and can be copied, passed
     330</span>    <span class="comment">// as arguments and returned as results
     331</span>    <span class="identifier">Stack</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="identifier">stack</span><span class="special">;</span>
     332<span class="special">}</span>
     333</pre>
     334<p>
     335      </p>
     336<p>
     337        <code class="computeroutput"><span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code>
     338        is just like your very own C++ stack which you can share between objects
     339        and functions and even across process boundaries, independantly of the underlying
     340        machine-based stack. They can be copied and compared and iterated over.
     341      </p>
     342<div class="warning" title="Warning"><table border="0" summary="Warning">
     343<tr>
     344<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../doc/html/images/warning.png"></td>
     345<th align="left">Warning</th>
     346</tr>
     347<tr><td align="left" valign="top"><p>
     348          Copying <code class="computeroutput"><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code>
     349          objects performs a slicing copy. To safely copy general stacks, use <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">cloneable</span><span class="special">::</span><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code>
     350          <sup>[<a name="id677096" href="#ftn.id677096" class="footnote">4</a>]</sup>
     351          instead
     352        </p></td></tr>
     353</table></div>
     354<p>
     355        Unlike the C++ stack, storage for a <code class="computeroutput"><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code> will use the heap when its local
     356        inline stack-based buffer is exhuasted. This makes it ideal for local buffers
     357        that will generally be small enough to fit onto the stack, but with the fallback
     358        safety of transparently using the heap to service later requests for the
     359        cases where that inline buffer is not large enough. This is especially useful
     360        in recursive functions, which can be readily re-written to use a <code class="computeroutput"><span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code>
     361        and thus be divorced from the limitations of the C++ stack.
     362      </p>
     363<div class="note" title="Note"><table border="0" summary="Note">
     364<tr>
     365<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/html/images/note.png"></td>
     366<th align="left">Note</th>
     367</tr>
     368<tr><td align="left" valign="top"><p>
     369          When a <code class="computeroutput"><span class="identifier">stack</span><span class="special">&lt;&gt;</span></code>
     370          goes out of scope, all objects in that stack are destroyed
     371        </p></td></tr>
     372</table></div>
     373<p>
     374        You can use <code class="computeroutput"><span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">enter</span></code> to localise usage of a stack:
     375      </p>
     376<p>
     377       
     378</p>
     379<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Stack</span><span class="special">&gt;</span>
     380<span class="keyword">void</span> <span class="identifier">UseStack</span><span class="special">(</span><span class="identifier">Stack</span> <span class="special">&amp;</span><span class="identifier">stack</span><span class="special">)</span>
     381<span class="special">{</span>
     382        <span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">enter</span> <span class="identifier">local</span><span class="special">(</span><span class="identifier">stack</span><span class="special">);</span>
     383<span class="special">}</span>
     384</pre>
     385<p>
     386      </p>
     387<p>
     388        This ensures that the stack leaves in the same state that it entered, by
     389        <code class="computeroutput"><span class="identifier">pop</span></code>ping until the stack is
     390        balanced. If the stack is smaller when <code class="computeroutput"><span class="identifier">local</span></code>
     391        leaves scope than when it entered scope, it will throw <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">monotonic</span><span class="special">::</span><span class="identifier">uneven_stack</span></code>.
     392      </p>
     393</div>
     394<div class="footnotes">
     395<br><hr width="100" align="left">
     396<div class="footnote"><p><sup>[<a name="ftn.id675924" href="#id675924" class="para">3</a>] </sup>
     397            To avoid slicing copies, use Boost.Cloneable.Stack
     398          </p></div>
     399<div class="footnote"><p><sup>[<a name="ftn.id677096" href="#id677096" class="para">4</a>] </sup>
     400              TODO
     401            </p></div>
     402</div>
    43403</div>
    44404<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
     
    52412<hr>
    53413<div class="spirit-nav">
    54 <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/basic_usage.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
     414<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="containers.html"><img src="../../../doc/html/images/next.png" alt="Next"></a>
    55415</div>
    56416</body>
  • sandbox/monotonic/libs/monotonic/doc/html/standalone_HTML.manifest

    r54734 r54804  
    11index.html
    2 monotonic_storage/intro.html
    32monotonic_storage/change_log.html
    43monotonic_storage/tutorial.html
    5 monotonic_storage/tutorial/basic_usage.html
    6 monotonic_storage/tutorial/using_multiple_containers.html
    7 monotonic_storage/tutorial/using_regions.html
    8 monotonic_storage/tutorial/stack.html
    94monotonic_storage/containers.html
    10 monotonic_storage/containers/chain.html
  • sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp

    r54786 r54804  
    9090BOOST_AUTO_TEST_CASE(test_stack)
    9191{
    92     /*
    9392    monotonic::stack<> stack;
    9493    {
    9594        size_t top = stack.top();
    9695        int &n2 = stack.push<int>();
     96        /*
    9797        float &f0 = stack.push<float>();
    9898        char &n3 = stack.push<char>();
     
    116116        BOOST_ASSERT(top2 == top);
    117117        BOOST_ASSERT(Tracked::count == 0);
    118     }
    119     */
     118        */
     119    }
    120120}
    121121
Note: See TracChangeset for help on using the changeset viewer.