|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54125 - sandbox/monotonic/libs/monotonic/doc
From: christian.schladetsch_at_[hidden]
Date: 2009-06-20 06:06:36
Author: cschladetsch
Date: 2009-06-20 06:06:35 EDT (Sat, 20 Jun 2009)
New Revision: 54125
URL: http://svn.boost.org/trac/boost/changeset/54125
Log:
slight reformatting
Text files modified:
sandbox/monotonic/libs/monotonic/doc/index.html | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 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-20 06:06:35 EDT (Sat, 20 Jun 2009)
@@ -60,33 +60,36 @@
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 />{
+ <pre>void shared()
+{
// declare the storage that will be shared by the various containers.
// storage will use the stack at first, then transparently expand to the heap as needed
- boost::monotonic::storage<> storage;<br /> {
- std::map<int, int, std::less<int>, boost::monotonic::allocator<int> > map(storage);
+ boost::monotonic::storage<> storage;
+ {
+ std::map<int, int, std::less<int>, boost::monotonic::allocator<int> > map;
map[1] = 2;
map[2] = 4;
- std::vector<char, boost::monotonic::allocator<char> > vec(storage);
+ std::vector<char, boost::monotonic::allocator<char> > vec;
vec.assign('x', 4);
- std::list<char, boost::monotonic::allocator<char> > list(storage);
+ std::list<char, boost::monotonic::allocator<char> > list;
std::copy(vec.begin(), vec.end(), std::back_inserter(list));
typedef std::pair<int, int> pair;
- std::set<pair, std::less<pair>, boost::monotonic::allocator<pair> > set(storage);
+ std::set<pair, std::less<pair>, boost::monotonic::allocator<pair> > set;
std::copy(map.begin(), map.end(), std::inserter(set));
}
-}</pre>
+ // all allocations are freed when storage leaves scope
+}
+</pre>
<h2>
Proposal
</h2>
<p>
The source code resides in the boost sandbox.</p>
<p>
- This is a constant-time, STL-compliant[1] allocator and storage
- system with the following
+ This is a constant-time, STL-compliant allocator and storage system with the following
properties: </p>
<ul>
<li>Space for objects is pre-allocated. This can be on the stack, on the heap, or
@@ -334,15 +337,12 @@
<h2>
Notes</h2>
<p>
- [1] It can be argued that the proposed allocator is not in fact "STL-compliant",
+ [1] It has been argued that the proposed allocator is not in fact "STL-compliant",
as it includes a pointer to storage used by the allocator. In truth, the
Standard doesn't state that allocators may not have any local data, only that
STL implementations are free to treat allocators of the same type as having the
- same behavior. In practise, the distinction is largely academic and has had no
- seen impact on this library. All modern STL implementation check for allocators
- to do things like speed up swap methods etc. These all work with monotonic
- allocator as well.</p>
- <h2>
+ same behavior. This proposal conforms to the standard.
+ </p> <h2>
References</h2><ul>
<li>Boost.AlignedStorage</li>
<li>Boost.AutoBuffer. A related service. Attempts to integrate this with STL has so
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