$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r54158 - in sandbox/monotonic: boost/monotonic boost/monotonic/detail libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-21 19:48:08
Author: cschladetsch
Date: 2009-06-21 19:48:08 EDT (Sun, 21 Jun 2009)
New Revision: 54158
URL: http://svn.boost.org/trac/boost/changeset/54158
Log:
added detail/construct.hpp
Added:
   sandbox/monotonic/boost/monotonic/detail/construct.hpp   (contents, props changed)
Text files modified: 
   sandbox/monotonic/boost/monotonic/allocator_base.hpp   |    95 --------------------------------------- 
   sandbox/monotonic/boost/monotonic/config.hpp           |     2                                         
   sandbox/monotonic/libs/monotonic/test/monotonic.vcproj |     4 +                                       
   3 files changed, 7 insertions(+), 94 deletions(-)
Modified: sandbox/monotonic/boost/monotonic/allocator_base.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/allocator_base.hpp	(original)
+++ sandbox/monotonic/boost/monotonic/allocator_base.hpp	2009-06-21 19:48:08 EDT (Sun, 21 Jun 2009)
@@ -6,14 +6,13 @@
 #ifndef BOOST_MONOTONIC_ALLOCATOR_BASE_HPP
 #define BOOST_MONOTONIC_ALLOCATOR_BASE_HPP
 
-//#define BOOST_MONOTONIC_USE_POOLS
-
 #include <boost/assert.hpp>
 #include <boost/type_traits/has_trivial_constructor.hpp>
 #include <boost/type_traits/has_trivial_destructor.hpp>
 
 #include <boost/monotonic/static_storage.hpp>
 #include <boost/monotonic/container.hpp>
+#include <boost/monotonic/detail/construct.hpp>
 
 #ifdef BOOST_MONOTONIC_USE_POOLS
 #	include <boost/monotonic/storage_pool.hpp>
@@ -23,73 +22,6 @@
 {
         namespace monotonic
         {
-		namespace detail
-		{
-			template <bool is_mono_container>
-			struct Construct
-			{
-				template <class T, class Alloc>
-				static void Given(T *ptr, Alloc *allocator)
-				{
-					new (ptr) T();
-				}
-				template <class T, class Alloc>
-				static void Given(T *ptr, T const &val, Alloc *allocator)
-				{
-					new (ptr) T(val);
-				}
-			};
-			template <>
-			struct Construct<true>
-			{
-				template <class T, class Alloc>
-				static void Given(T *ptr, Alloc *allocator)
-				{
-					new (ptr) T(*allocator);
-				}
-				template <class T, class Alloc>
-				static void Given(T *ptr, T const &val, Alloc *allocator)
-				{
-					// unfortunately, there is no requirement for a container to 
-					// have a copy-ctor that also passes an allocator.
-					new (ptr) T(*allocator);
-					*ptr = val;
-				}
-			};
-
-			template <bool is_monotonic_container, class T>
-			struct Create
-			{
-				template <class Storage>
-				static T Given(Storage &)
-				{
-					return T();
-				}
-			};
-			template <class T>
-			struct Create<true, T>
-			{
-				template <class Storage>
-				static T Given(Storage &storage)
-				{
-					return T();//storage);
-				}
-			};
-		}
-		namespace detail
-		{
-			template <size_t A, size_t B>
-			struct miniumum
-			{
-				BOOST_STATIC_CONSTANT(size_t, value = A < B ? A : B);
-			};
-			template <size_t A, size_t B>
-			struct maximum
-			{
-				BOOST_STATIC_CONSTANT(size_t, value = B < A ? A : B);
-			};
-		}
-
                 /// common to other monotonic allocators for type T of type Derived
                 template <class T, class Derived>
                 struct allocator_base
@@ -102,20 +34,9 @@
                         typedef const T &const_reference;
                         typedef T value_type;
 
-			BOOST_STATIC_CONSTANT(size_t, PoolSize = 1000);
                         BOOST_STATIC_CONSTANT(size_t, alignment = boost::aligned_storage<sizeof(T)>::alignment);
-			BOOST_STATIC_CONSTANT(size_t, MinSize = 72);
-			BOOST_STATIC_CONSTANT(size_t, AlignedSize = alignment + sizeof(T));
-
-			BOOST_STATIC_CONSTANT(size_t, Size = sizeof(T));
-			BOOST_STATIC_CONSTANT(size_t, NodeSize1 = (Size + MinSize)/MinSize);
-			BOOST_STATIC_CONSTANT(size_t, NodeSize = NodeSize1*MinSize);
-
-			//typedef storage_pool<T, NodeSize> Pool;
-
                 //private:
                         storage_base *storage;
-			//static Pool pool;
 
                 public:
                         allocator_base(storage_base &store) throw() 
@@ -142,16 +63,7 @@
                         {
                                 BOOST_ASSERT(num > 0);
                                 BOOST_ASSERT(storage != 0);
-#ifdef BOOST_MONOTONIC_USE_POOLS
-				if (pointer ptr = pool.allocate(num))
-				{
-					return ptr;
-				}
-				pool.reserve_pool(storage, std::max<size_t>(8, std::max(num*2, pool.capacity()*2)));
-				return pool.allocate(num);
-#else
                                 return reinterpret_cast<T *>(storage->allocate(num*sizeof(T), alignment));
-#endif
                         }
 
                         void deallocate(pointer, size_type)
@@ -214,11 +126,6 @@
                         }
                 };
 
-/*
-		template <class T, class Derived>
-		typename allocator_base<T, Derived>::Pool allocator_base<T, Derived>::pool;
-*/
-
         } // namespace monotonic
 
 } // namespace boost
Modified: sandbox/monotonic/boost/monotonic/config.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/config.hpp	(original)
+++ sandbox/monotonic/boost/monotonic/config.hpp	2009-06-21 19:48:08 EDT (Sun, 21 Jun 2009)
@@ -6,6 +6,8 @@
 #ifndef BOOST_MONOTONIC_CONFIG_H
 #define BOOST_MONOTONIC_CONFIG_H
 
+//#define BOOST_MONOTONIC_USE_POOLS
+
 namespace boost
 {
         namespace monotonic
Added: sandbox/monotonic/boost/monotonic/detail/construct.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/monotonic/detail/construct.hpp	2009-06-21 19:48:08 EDT (Sun, 21 Jun 2009)
@@ -0,0 +1,87 @@
+// Copyright (C) 2009 Christian Schladetsch
+//
+//  Distributed under the Boost Software License, Version 1.0. (See accompanying 
+//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_MONOTONIC_ALLOCATOR_DETAIL_CONSTRUCT_HPP
+#define BOOST_MONOTONIC_ALLOCATOR_DETAIL_CONSTRUCT_HPP
+
+namespace boost
+{
+	namespace monotonic
+	{
+		namespace detail
+		{
+			template <bool is_mono_container>
+			struct Construct
+			{
+				template <class T, class Alloc>
+				static void Given(T *ptr, Alloc *allocator)
+				{
+					new (ptr) T();
+				}
+				template <class T, class Alloc>
+				static void Given(T *ptr, T const &val, Alloc *allocator)
+				{
+					new (ptr) T(val);
+				}
+			};
+			template <>
+			struct Construct<true>
+			{
+				template <class T, class Alloc>
+				static void Given(T *ptr, Alloc *allocator)
+				{
+					new (ptr) T(*allocator);
+				}
+				template <class T, class Alloc>
+				static void Given(T *ptr, T const &val, Alloc *allocator)
+				{
+					// unfortunately, there is no requirement for a container to 
+					// have a copy-ctor that also passes an allocator.
+					new (ptr) T(*allocator);
+					*ptr = val;
+				}
+			};
+
+			template <bool is_monotonic_container, class T>
+			struct Create
+			{
+				template <class Storage>
+				static T Given(Storage &)
+				{
+					return T();
+				}
+			};
+			template <class T>
+			struct Create<true, T>
+			{
+				template <class Storage>
+				static T Given(Storage &storage)
+				{
+					return T();//storage);
+				}
+			};
+		}
+		namespace detail
+		{
+			template <size_t A, size_t B>
+			struct miniumum
+			{
+				BOOST_STATIC_CONSTANT(size_t, value = A < B ? A : B);
+			};
+			template <size_t A, size_t B>
+			struct maximum
+			{
+				BOOST_STATIC_CONSTANT(size_t, value = B < A ? A : B);
+			};
+		} // namespace detail
+
+	} // namespace monotonic
+
+} // namespace boost
+
+#endif // BOOST_MONOTONIC_ALLOCATOR_DETAIL_CONSTRUCT_HPP
+
+//EOF
+
Modified: sandbox/monotonic/libs/monotonic/test/monotonic.vcproj
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/monotonic.vcproj	(original)
+++ sandbox/monotonic/libs/monotonic/test/monotonic.vcproj	2009-06-21 19:48:08 EDT (Sun, 21 Jun 2009)
@@ -350,6 +350,10 @@
                                         Name="detail"
 					>
                                         <File
+						RelativePath="..\..\..\boost\monotonic\detail\construct.hpp"
+						>
+					</File>
+					<File
                                                 RelativePath="..\..\..\boost\monotonic\detail\link.hpp"
 						>
                                         </File>