Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53991 - in sandbox/monotonic: boost/monotonic libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-16 23:38:11


Author: cschladetsch
Date: 2009-06-16 23:38:10 EDT (Tue, 16 Jun 2009)
New Revision: 53991
URL: http://svn.boost.org/trac/boost/changeset/53991

Log:
added easier parameterisation of static_storage_base

Text files modified:
   sandbox/monotonic/boost/monotonic/static_storage.h | 27 +++++++++++++++++++++++----
   sandbox/monotonic/libs/monotonic/test/main.cpp | 2 +-
   2 files changed, 24 insertions(+), 5 deletions(-)

Modified: sandbox/monotonic/boost/monotonic/static_storage.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/static_storage.h (original)
+++ sandbox/monotonic/boost/monotonic/static_storage.h 2009-06-16 23:38:10 EDT (Tue, 16 Jun 2009)
@@ -12,11 +12,29 @@
 {
         namespace monotonic
         {
- template <class Storage>
+ /// a globally available storage buffer
+ template <size_t InlineSize = 64*1024
+ , size_t MinHeapIncrement = 2*1024*1024
+ , class Al = std::allocator<char>
+ , template <size_t, size_t, class> class Storage = storage
+ >
+ struct static_storage_base;
+
+ template <size_t InlineSize, size_t MinHeapIncrement, class Al, template <size_t, size_t, class> class Storage>
                 struct static_storage_base : storage_base
                 {
- Storage global;
+ typedef Storage<InlineSize, MinHeapIncrement, Al> StorageType;
+ private:
+ StorageType global;
 
+ public:
+ static_storage_base()
+ {
+ }
+ static_storage_base(StorageType const &store)
+ : global(store)
+ {
+ }
                         void reset()
                         {
                                 global.reset();
@@ -43,9 +61,10 @@
                         }
                 };
 
+ /// 'static_storage' will be used by a default-constructed monotonic::allocator
+ extern static_storage_base<> static_storage;
 
- extern static_storage_base<storage<> > static_storage;
- //extern static_storage_base<shared_storage<> > static_shared_storage;
+ //extern static_storage_base<8*1024, 8*1024*1024, > static_shared_storage;
         }
 }
 

Modified: sandbox/monotonic/libs/monotonic/test/main.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/main.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/main.cpp 2009-06-16 23:38:10 EDT (Tue, 16 Jun 2009)
@@ -285,7 +285,7 @@
 
 namespace boost { namespace monotonic {
 
-static_storage_base<storage<> > static_storage;
+static_storage_base<> static_storage;
 
 //storage<> static_storage_base<storage<> >::global;
 


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