$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r54450 - in sandbox/monotonic: boost/heterogenous boost/heterogenous/detail libs/monotonic/test/clones
From: christian.schladetsch_at_[hidden]
Date: 2009-06-28 03:21:31
Author: cschladetsch
Date: 2009-06-28 03:21:29 EDT (Sun, 28 Jun 2009)
New Revision: 54450
URL: http://svn.boost.org/trac/boost/changeset/54450
Log:
added 
Added:
   sandbox/monotonic/boost/heterogenous/allocator.hpp   (contents, props changed)
   sandbox/monotonic/boost/heterogenous/base.hpp   (contents, props changed)
   sandbox/monotonic/boost/heterogenous/common_base.hpp   (contents, props changed)
   sandbox/monotonic/boost/heterogenous/detail/
   sandbox/monotonic/boost/heterogenous/detail/prefix.hpp   (contents, props changed)
   sandbox/monotonic/boost/heterogenous/detail/suffix.hpp   (contents, props changed)
   sandbox/monotonic/boost/heterogenous/make_cloneable_allocator.hpp   (contents, props changed)
Text files modified: 
   sandbox/monotonic/boost/heterogenous/vector.hpp            |   134 --------------------------------------- 
   sandbox/monotonic/libs/monotonic/test/clones/clones.vcproj |    28 ++++++++                                
   2 files changed, 29 insertions(+), 133 deletions(-)
Added: sandbox/monotonic/boost/heterogenous/allocator.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/heterogenous/allocator.hpp	2009-06-28 03:21:29 EDT (Sun, 28 Jun 2009)
@@ -0,0 +1,52 @@
+// 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_HETEROGENOUS_ALLOCATOR_HPP
+#define BOOST_HETEROGENOUS_ALLOCATOR_HPP
+
+#include <boost/heterogenous/detail/prefix.hpp>
+
+namespace boost
+{
+	namespace heterogenous
+	{
+		/// a cloning allocator
+		struct allocator
+		{
+			template <class Base>
+			static Base* allocate_clone( const Base& object )
+			{
+				throw;
+			}
+
+			template <class Base>
+			static void deallocate_clone( const Base* clone )
+			{
+				throw;
+			}
+
+			template <class Base, class Alloc>
+			static Base* allocate_clone(const Base& object, Alloc &alloc )
+			{
+				// calling copy_construct must be disabled at compile-time for types that are not boost::is_convertible<cloneable::base<U> *, U*>
+				return object.copy_construct(object, alloc);
+			}
+
+			template <class Base, class Alloc>
+			static void deallocate_clone(const Base *object, Alloc &alloc )
+			{
+				object->deallocate(const_cast<Base *>(object), alloc);
+			}
+		};
+
+	} // namespace heterogenous
+
+} // namespace boost
+
+#include <boost/heterogenous/detail/suffix.hpp>
+
+#endif // BOOST_HETEROGENOUS_ALLOCATOR_HPP
+
+//EOF
Added: sandbox/monotonic/boost/heterogenous/base.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/heterogenous/base.hpp	2009-06-28 03:21:29 EDT (Sun, 28 Jun 2009)
@@ -0,0 +1,76 @@
+// 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_HETEROGENOUS_BASE_HPP
+#define BOOST_HETEROGENOUS_BASE_HPP
+
+#include <boost/heterogenous/detail/prefix.hpp>
+
+namespace boost
+{
+	namespace heterogenous
+	{
+
+		/// base of the given derived type
+		template <class Derived>
+		struct base : common_base
+		{
+			typedef Derived derived_type;
+			typedef base<derived_type> this_type;
+
+		private:
+			static size_t alignment;
+			mutable derived_type *self_ptr;
+
+			derived_type *&self(derived_type *ptr) const
+			{
+				return ptr->this_type::self_ptr;
+			}
+
+		public:
+			base() : self_ptr(0) { }
+
+			virtual base<Derived> *allocate(boost::abstract_allocator &alloc) const 
+			{
+				boost::abstract_allocator::pointer bytes = alloc.allocate_bytes(sizeof(derived_type), alignment);
+				Derived *ptr = reinterpret_cast<Derived *>(bytes);
+				self(ptr) = ptr;
+				return ptr;
+			}
+
+			void deallocate(common_base *object, abstract_allocator &alloc) const
+			{
+				alloc.deallocate_bytes(reinterpret_cast<abstract_allocator::pointer>(object));
+			}
+
+			virtual base<Derived> *create(boost::abstract_allocator &alloc) const 
+			{
+				base<Derived> *ptr = allocate(alloc);
+				new (ptr->self_ptr) Derived();
+				return ptr;
+			}
+
+			virtual base<Derived> *copy_construct(const common_base &original, boost::abstract_allocator &alloc) const 
+			{ 
+				base<Derived> *ptr = allocate(alloc);
+				new (ptr->self_ptr) Derived(static_cast<const Derived &>(original));
+				return ptr;
+			}
+		};
+
+		/// ensure correct alignment when allocating derived instances
+		template <class Derived>
+		size_t base<Derived>::alignment = aligned_storage<sizeof(Derived)>::alignment;
+
+
+	} // namespace heterogenous
+
+} // namespace boost
+
+#include <boost/heterogenous/detail/suffix.hpp>
+
+#endif // BOOST_HETEROGENOUS_BASE_HPP
+
+//EOF
Added: sandbox/monotonic/boost/heterogenous/common_base.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/heterogenous/common_base.hpp	2009-06-28 03:21:29 EDT (Sun, 28 Jun 2009)
@@ -0,0 +1,34 @@
+// 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_HETEROGENOUS_COMMON_BASE_HPP
+#define BOOST_HETEROGENOUS_COMMON_BASE_HPP
+
+#include <boost/heterogenous/detail/prefix.hpp>
+
+namespace boost
+{
+	namespace heterogenous
+	{
+		/// common base for all base types for hierachies
+		struct common_base
+		{
+			virtual ~common_base() { }
+
+			virtual common_base *allocate(abstract_allocator &alloc) const = 0;
+			virtual void deallocate(common_base *, abstract_allocator &alloc) const = 0;
+			virtual common_base *create(abstract_allocator &alloc) const = 0;
+			virtual common_base *copy_construct(const common_base &original, abstract_allocator &alloc) const = 0;
+		};
+
+	} // namespace heterogenous
+
+} // namespace boost
+
+#include <boost/heterogenous/detail/suffix.hpp>
+
+#endif // BOOST_HETEROGENOUS_COMMON_BASE_HPP
+
+//EOF
Added: sandbox/monotonic/boost/heterogenous/detail/prefix.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/heterogenous/detail/prefix.hpp	2009-06-28 03:21:29 EDT (Sun, 28 Jun 2009)
@@ -0,0 +1,10 @@
+// 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)
+
+#ifdef BOOST_CONFIG_HPP
+#include <boost/config.hpp>
+#endif
+
+//EOF
Added: sandbox/monotonic/boost/heterogenous/detail/suffix.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/heterogenous/detail/suffix.hpp	2009-06-28 03:21:29 EDT (Sun, 28 Jun 2009)
@@ -0,0 +1,6 @@
+// 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)
+
+//EOF
Added: sandbox/monotonic/boost/heterogenous/make_cloneable_allocator.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/heterogenous/make_cloneable_allocator.hpp	2009-06-28 03:21:29 EDT (Sun, 28 Jun 2009)
@@ -0,0 +1,66 @@
+// 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_HETEROGENOUS_MAKE_CLONEABLE_ALLOCATOR_HPP
+#define BOOST_HETEROGENOUS_MAKE_CLONEABLE_ALLOCATOR_HPP
+
+#include <boost/heterogenous/detail/prefix.hpp>
+
+namespace boost
+{
+	namespace heterogenous
+	{
+
+		namespace impl
+		{
+			template <class Alloc>
+			struct cloneable_allocator : Alloc, boost::abstract_allocator
+			{
+				typedef typename Alloc::template rebind<char>::other CharAlloc;
+
+				boost::abstract_allocator::pointer allocate_bytes(size_t num_bytes, size_t alignment)
+				{
+					CharAlloc alloc;
+					// todo: alignment; this is done already for monotonic, copy that here
+					return alloc.allocate(num_bytes);
+				}
+
+				void deallocate_bytes(boost::abstract_allocator::pointer ptr)
+				{
+					CharAlloc alloc;
+					alloc.deallocate(ptr, 1);
+				}
+			};
+
+			template <class Alloc, bool>
+			struct make_cloneable_allocator
+			{		
+				typedef cloneable_allocator<Alloc> type;
+			};
+
+			template <class Alloc>
+			struct make_cloneable_allocator<Alloc, true>
+			{
+				typedef Alloc type;
+			};
+		}
+
+		template <class Alloc>
+		struct make_cloneable_allocator
+		{
+			typedef boost::is_convertible<Alloc *, boost::abstract_allocator *> is_convertible;
+			BOOST_STATIC_CONSTANT(bool, is_cloneable = is_convertible::value);
+			typedef typename impl::make_cloneable_allocator<Alloc, is_cloneable>::type type;
+		};
+
+	} // namespace heterogenous
+
+} // namespace boost
+
+#include <boost/heterogenous/detail/suffix.hpp>
+
+#endif // BOOST_HETEROGENOUS_MAKE_CLONEABLE_ALLOCATOR_HPP
+
+//EOF
Modified: sandbox/monotonic/boost/heterogenous/vector.hpp
==============================================================================
--- sandbox/monotonic/boost/heterogenous/vector.hpp	(original)
+++ sandbox/monotonic/boost/heterogenous/vector.hpp	2009-06-28 03:21:29 EDT (Sun, 28 Jun 2009)
@@ -15,139 +15,7 @@
 {
         namespace heterogenous
         {
-		/// common base for all base types for hierachies
-		struct common_base
-		{
-			virtual ~common_base() { }
-
-			virtual common_base *allocate(abstract_allocator &alloc) const = 0;
-			virtual void deallocate(common_base *, abstract_allocator &alloc) const = 0;
-			virtual common_base *create(abstract_allocator &alloc) const = 0;
-			virtual common_base *copy_construct(const common_base &original, abstract_allocator &alloc) const = 0;
-		};
-
-		/// base of the given derived type
-		template <class Derived>
-		struct base : common_base
-		{
-			typedef Derived derived_type;
-			typedef base<derived_type> this_type;
-
-		private:
-			static size_t alignment;
-			mutable derived_type *self_ptr;
-
-			derived_type *&self(derived_type *ptr) const
-			{
-				return ptr->this_type::self_ptr;
-			}
-
-		public:
-			base() : self_ptr(0) { }
-
-			virtual base<Derived> *allocate(boost::abstract_allocator &alloc) const 
-			{
-				boost::abstract_allocator::pointer bytes = alloc.allocate_bytes(sizeof(derived_type), alignment);
-				Derived *ptr = reinterpret_cast<Derived *>(bytes);
-				self(ptr) = ptr;
-				return ptr;
-			}
-
-			void deallocate(common_base *object, abstract_allocator &alloc) const
-			{
-				alloc.deallocate_bytes(reinterpret_cast<abstract_allocator::pointer>(object));
-			}
-
-			virtual base<Derived> *create(boost::abstract_allocator &alloc) const 
-			{
-				base<Derived> *ptr = allocate(alloc);
-				new (ptr->self_ptr) Derived();
-				return ptr;
-			}
-
-			virtual base<Derived> *copy_construct(const common_base &original, boost::abstract_allocator &alloc) const 
-			{ 
-				base<Derived> *ptr = allocate(alloc);
-				new (ptr->self_ptr) Derived(static_cast<const Derived &>(original));
-				return ptr;
-			}
-		};
-
-		/// ensure correct alignment when allocating derived instances
-		template <class Derived>
-		size_t base<Derived>::alignment = aligned_storage<sizeof(Derived)>::alignment;
-
-		/// a cloning allocator
-		struct allocator
-		{
-			template <class Base>
-			static Base* allocate_clone( const Base& object )
-			{
-				throw;
-			}
-
-			template <class Base>
-			static void deallocate_clone( const Base* clone )
-			{
-				throw;
-			}
-
-			template <class Base, class Alloc>
-			static Base* allocate_clone(const Base& object, Alloc &alloc )
-			{
-				// calling copy_construct must be disabled at compile-time for types that are not boost::is_convertible<cloneable::base<U> *, U*>
-				return object.copy_construct(object, alloc);
-			}
-
-			template <class Base, class Alloc>
-			static void deallocate_clone(const Base *object, Alloc &alloc )
-			{
-				object->deallocate(const_cast<Base *>(object), alloc);
-			}
-		};
-
-		namespace impl
-		{
-			template <class Alloc>
-			struct cloneable_allocator : Alloc, boost::abstract_allocator
-			{
-				typedef typename Alloc::template rebind<char>::other CharAlloc;
-
-				boost::abstract_allocator::pointer allocate_bytes(size_t num_bytes, size_t alignment)
-				{
-					CharAlloc alloc;
-					// todo: alignment; this is done already for monotonic, copy that here
-					return alloc.allocate(num_bytes);
-				}
-
-				void deallocate_bytes(boost::abstract_allocator::pointer ptr)
-				{
-					CharAlloc alloc;
-					alloc.deallocate(ptr, 1);
-				}
-			};
-
-			template <class Alloc, bool>
-			struct make_cloneable_allocator
-			{		
-				typedef cloneable_allocator<Alloc> type;
-			};
-
-			template <class Alloc>
-			struct make_cloneable_allocator<Alloc, true>
-			{
-				typedef Alloc type;
-			};
-		}
-
-		template <class Alloc>
-		struct make_cloneable_allocator
-		{
-			typedef boost::is_convertible<Alloc *, boost::abstract_allocator *> is_convertible;
-			BOOST_STATIC_CONSTANT(bool, is_cloneable = is_convertible::value);
-			typedef typename impl::make_cloneable_allocator<Alloc, is_cloneable>::type type;
-		};
-
+		/// a vector of heterogenous objects
                 template <class Alloc = make_cloneable_allocator<std::allocator<char> >, class Base = common_base >
                 struct vector
                 {
Modified: sandbox/monotonic/libs/monotonic/test/clones/clones.vcproj
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/clones/clones.vcproj	(original)
+++ sandbox/monotonic/libs/monotonic/test/clones/clones.vcproj	2009-06-28 03:21:29 EDT (Sun, 28 Jun 2009)
@@ -351,9 +351,37 @@
                                 Name="heterogenous"
 				>
                                 <File
+					RelativePath="..\..\..\..\boost\heterogenous\allocator.hpp"
+					>
+				</File>
+				<File
+					RelativePath="..\..\..\..\boost\heterogenous\base.hpp"
+					>
+				</File>
+				<File
+					RelativePath="..\..\..\..\boost\heterogenous\common_base.hpp"
+					>
+				</File>
+				<File
+					RelativePath="..\..\..\..\boost\heterogenous\make_cloneable_allocator.hpp"
+					>
+				</File>
+				<File
                                         RelativePath="..\..\..\..\boost\heterogenous\vector.hpp"
 					>
                                 </File>
+				<Filter
+					Name="detail"
+					>
+					<File
+						RelativePath="..\..\..\..\boost\heterogenous\detail\prefix.hpp"
+						>
+					</File>
+					<File
+						RelativePath="..\..\..\..\boost\heterogenous\detail\suffix.hpp"
+						>
+					</File>
+				</Filter>
                         </Filter>
                 </Filter>
                 <File