|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54260 - in sandbox/monotonic: boost/monotonic libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-23 00:44:45
Author: cschladetsch
Date: 2009-06-23 00:44:41 EDT (Tue, 23 Jun 2009)
New Revision: 54260
URL: http://svn.boost.org/trac/boost/changeset/54260
Log:
resurrected local<>
Text files modified:
sandbox/monotonic/boost/monotonic/local.hpp | 66 ++++++---------------------------------
sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp | 8 ----
2 files changed, 11 insertions(+), 63 deletions(-)
Modified: sandbox/monotonic/boost/monotonic/local.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/local.hpp (original)
+++ sandbox/monotonic/boost/monotonic/local.hpp 2009-06-23 00:44:41 EDT (Tue, 23 Jun 2009)
@@ -12,75 +12,31 @@
{
namespace monotonic
{
- /*
- /// sets the global storage on construction, releases and returns to previous
- /// storage on destruction
- template <class Region, class Storage>
- struct local// : storage_base
+ /// RIIA for storage
+ template <class Region, class Access = default_access_tag>
+ struct local
{
- private:
- //Storage store;
- storage_base *old;
-
- public:
local()
{
- old = set_storage(get_region_storage<Region>());
}
~local()
{
- release_storage();
- if (old)
- set_storage(*old);
- else
- default_storage();
+ release();
}
-
- //Storage &get_storage()
- //{
- // return store;
- //}
- //Storage const &get_storage() const
- //{
- // return store;
- //}
static void reset()
{
- get_region_storage<Region>().reset();
+ get_storage().reset();
}
static void release()
{
- get_region_storage<Region>().release();
+ get_storage().release();
+ }
+ static storage_base &get_storage()
+ {
+ return ::boost::monotonic::get_storage<Region,Access>();
}
-
- //template <class T>
- //allocator<T> make_allocator()
- //{
- // return allocator<T>(store);
- //}
-
- //// the number of bytes to allocate, and the alignment to use
- //void *allocate(size_t num_bytes, size_t alignment)
- //{
- // return store.allocate(num_bytes, alignment);
- //}
-
- //size_t max_size() const
- //{
- // return store.max_size();
- //}
-
- //size_t used() const
- //{
- // return store.used();
- //}
-
- //size_t remaining() const
- //{
- // return store.remaining();
- //}
};
-*/
+
} // namespace monotonic
} // namespace boost
Modified: sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp 2009-06-23 00:44:41 EDT (Tue, 23 Jun 2009)
@@ -457,12 +457,4 @@
return 0;
}
-namespace boost
-{
- namespace monotonic
- {
-// storage_base *current_storage = &get_region_storage<default_region_tag>();
- }
-}
-
//EOF
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