|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53877 - sandbox/monotonic/libs/monotonic/doc
From: christian.schladetsch_at_[hidden]
Date: 2009-06-13 19:10:23
Author: cschladetsch
Date: 2009-06-13 19:10:23 EDT (Sat, 13 Jun 2009)
New Revision: 53877
URL: http://svn.boost.org/trac/boost/changeset/53877
Log:
preamble changed to use std::containers for default.
Text files modified:
sandbox/monotonic/libs/monotonic/doc/index.html | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
Modified: sandbox/monotonic/libs/monotonic/doc/index.html
==============================================================================
--- sandbox/monotonic/libs/monotonic/doc/index.html (original)
+++ sandbox/monotonic/libs/monotonic/doc/index.html 2009-06-13 19:10:23 EDT (Sat, 13 Jun 2009)
@@ -67,21 +67,27 @@
</p>
<h2 id="Proposal">
Quick Example</h2>
+ <p>
+ The following example uses std::containers with the allocator in this library by
+ explicitly declaring the allocator type. An optional and debatable extension to
+ the library includes some basic wrapper types around the std::containers that
+ simplifies the syntax somewhat.</p>
<pre>void shared()<br />{
- // declare the storage that will be shared by the containers
- // it is on the stack here, but can be put on the heap with `new`
- boost::monotonic::inline_storage<10000> storage;<br /> {
- boost::monotonic::map<int, int> map(storage);
+ // declare the storage that will be shared by the various containers.
+ // storage is on the stack here, but can be put on the heap with `new`
+ boost::monotonic::inline_storage<10000> storage;<br /> {
+ std::map<int, int, std::less<int>, boost::monotonic::allocator<int> > map(storage);
map[1] = 2;
map[2] = 4;
- boost::monotonic::vector<char> vec(storage);
+ std::vector<char, boost::monotonic::allocator<char> > vec(storage);
vec.assign('x', 4);
- boost::monotonic::list<char> list(storage);
+ std::list<char, boost::monotonic::allocator<char> > list(storage);
std::copy(vec.begin(), vec.end(), std::back_inserter(list));
- boost::monotonic::set<std::pair<const int, int> set(storage);
+ typedef std::pair<const int, int> pair;
+ std::set<pair, std::less<pair>, boost::monotonic::allocator<pair> > set(storage);
std::copy(map.begin(), map.end(), std::inserter(set));
}
}</pre>
@@ -89,7 +95,7 @@
Proposal
</h2>
<p>
- The source code resides in the boost sandbox.</p>
+ The e source code resides in the boost sandbox.</p>
<p>
This is This is a constant-time, stack-based STL-compliant[1] allocator and storage
system with the following
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