|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54455 - in sandbox/monotonic: boost boost/heterogenous boost/monotonic libs/monotonic/test/clones
From: christian.schladetsch_at_[hidden]
Date: 2009-06-28 04:09:52
Author: cschladetsch
Date: 2009-06-28 04:09:51 EDT (Sun, 28 Jun 2009)
New Revision: 54455
URL: http://svn.boost.org/trac/boost/changeset/54455
Log:
moved abstract allocator to heterogenous namespace
Added:
sandbox/monotonic/boost/heterogenous/abstract_allocator.hpp (contents, props changed)
Removed:
sandbox/monotonic/boost/abstract_allocator.hpp
Text files modified:
sandbox/monotonic/boost/heterogenous/base.hpp | 8 ++++----
sandbox/monotonic/boost/heterogenous/common_base.hpp | 2 +-
sandbox/monotonic/boost/heterogenous/make_cloneable_allocator.hpp | 4 ++--
sandbox/monotonic/boost/heterogenous/vector.hpp | 2 ++
sandbox/monotonic/boost/monotonic/allocator_base.hpp | 8 ++++----
sandbox/monotonic/libs/monotonic/test/clones/clones.vcproj | 6 +++++-
6 files changed, 18 insertions(+), 12 deletions(-)
Deleted: sandbox/monotonic/boost/abstract_allocator.hpp
==============================================================================
--- sandbox/monotonic/boost/abstract_allocator.hpp 2009-06-28 04:09:51 EDT (Sun, 28 Jun 2009)
+++ (empty file)
@@ -1,27 +0,0 @@
-// 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_ABSTRACT_ALLOCATOR_HPP
-#define BOOST_ABSTRACT_ALLOCATOR_HPP
-
-#include <memory>
-
-namespace boost
-{
- /// base class for (wrapped) allocators that may be used with cloneable::base
- struct abstract_allocator
- {
- typedef char *pointer;
-
- virtual pointer allocate_bytes(size_t num_bytes, size_t alignment) = 0;
-
- virtual void deallocate_bytes(pointer) = 0;
- };
-
-} // namespace boost
-
-#endif // BOOST_ABSTRACT_ALLOCATOR_HPP
-
-//EOF
Added: sandbox/monotonic/boost/heterogenous/abstract_allocator.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/heterogenous/abstract_allocator.hpp 2009-06-28 04:09:51 EDT (Sun, 28 Jun 2009)
@@ -0,0 +1,31 @@
+// 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_ABSTRACT_ALLOCATOR_HPP
+#define BOOST_HETEROGENOUS_ABSTRACT_ALLOCATOR_HPP
+
+#include <boost/heterogenous/detail/prefix.hpp>
+
+namespace boost
+{
+ namespace heterogenous
+ {
+ /// base class for (wrapped) allocators that may be used with cloneable::base
+ struct abstract_allocator
+ {
+ typedef char *pointer;
+
+ virtual pointer allocate_bytes(size_t num_bytes, size_t alignment) = 0;
+
+ virtual void deallocate_bytes(pointer) = 0;
+ };
+
+ } // namespace heterogenous
+
+} // namespace boost
+
+#endif // BOOST_HETEROGENOUS_ABSTRACT_ALLOCATOR_HPP
+
+//EOF
Modified: sandbox/monotonic/boost/heterogenous/base.hpp
==============================================================================
--- sandbox/monotonic/boost/heterogenous/base.hpp (original)
+++ sandbox/monotonic/boost/heterogenous/base.hpp 2009-06-28 04:09:51 EDT (Sun, 28 Jun 2009)
@@ -34,9 +34,9 @@
public:
base() : self_ptr(0) { }
- virtual base<Derived> *allocate(boost::abstract_allocator &alloc) const
+ virtual base<Derived> *allocate(abstract_allocator &alloc) const
{
- boost::abstract_allocator::pointer bytes = alloc.allocate_bytes(sizeof(derived_type), alignment);
+ abstract_allocator::pointer bytes = alloc.allocate_bytes(sizeof(derived_type), alignment);
Derived *ptr = reinterpret_cast<Derived *>(bytes);
self(ptr) = ptr;
return ptr;
@@ -47,14 +47,14 @@
alloc.deallocate_bytes(reinterpret_cast<abstract_allocator::pointer>(object));
}
- virtual base<Derived> *create(boost::abstract_allocator &alloc) const
+ virtual base<Derived> *create(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
+ virtual base<Derived> *copy_construct(const common_base &original, abstract_allocator &alloc) const
{
base<Derived> *ptr = allocate(alloc);
new (ptr->self_ptr) Derived(static_cast<const Derived &>(original));
Modified: sandbox/monotonic/boost/heterogenous/common_base.hpp
==============================================================================
--- sandbox/monotonic/boost/heterogenous/common_base.hpp (original)
+++ sandbox/monotonic/boost/heterogenous/common_base.hpp 2009-06-28 04:09:51 EDT (Sun, 28 Jun 2009)
@@ -6,8 +6,8 @@
#ifndef BOOST_HETEROGENOUS_COMMON_BASE_HPP
#define BOOST_HETEROGENOUS_COMMON_BASE_HPP
-#include <boost/abstract_allocator.hpp>
#include <boost/heterogenous/detail/prefix.hpp>
+#include <boost/heterogenous/abstract_allocator.hpp>
namespace boost
{
Modified: sandbox/monotonic/boost/heterogenous/make_cloneable_allocator.hpp
==============================================================================
--- sandbox/monotonic/boost/heterogenous/make_cloneable_allocator.hpp (original)
+++ sandbox/monotonic/boost/heterogenous/make_cloneable_allocator.hpp 2009-06-28 04:09:51 EDT (Sun, 28 Jun 2009)
@@ -21,14 +21,14 @@
{
typedef typename Alloc::template rebind<char>::other CharAlloc;
- boost::abstract_allocator::pointer allocate_bytes(size_t num_bytes, size_t alignment)
+ 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)
+ void deallocate_bytes(abstract_allocator::pointer ptr)
{
CharAlloc alloc;
alloc.deallocate(ptr, 1);
Modified: sandbox/monotonic/boost/heterogenous/vector.hpp
==============================================================================
--- sandbox/monotonic/boost/heterogenous/vector.hpp (original)
+++ sandbox/monotonic/boost/heterogenous/vector.hpp 2009-06-28 04:09:51 EDT (Sun, 28 Jun 2009)
@@ -79,6 +79,7 @@
{
return dynamic_cast<Other *>(&at(n));
}
+
template <class U>
void push_back()
{
@@ -118,6 +119,7 @@
typename allocator_type::template rebind<U>::other alloc(get_allocator());
return alloc.allocate(1);
}
+
template <class U>
U *construct_type()
{
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-28 04:09:51 EDT (Sun, 28 Jun 2009)
@@ -6,7 +6,7 @@
#ifndef BOOST_MONOTONIC_ALLOCATOR_BASE_HPP
#define BOOST_MONOTONIC_ALLOCATOR_BASE_HPP
-#include <boost/abstract_allocator.hpp>
+#include <boost/heterogenous/abstract_allocator.hpp>
#include <boost/assert.hpp>
#include <boost/monotonic/detail/prefix.hpp>
#include <boost/type_traits/has_trivial_constructor.hpp>
@@ -28,7 +28,7 @@
{
/// common to other monotonic allocators for type T of type Derived
template <class T, class Derived>
- struct allocator_base : abstract_allocator
+ struct allocator_base : heterogenous::abstract_allocator
{
typedef size_t size_type;
typedef ptrdiff_t difference_type;
@@ -48,10 +48,10 @@
storage_base *storage;
// override for abstract_allocator
- virtual abstract_allocator::pointer allocate_bytes(size_t num_bytes, size_t alignment)
+ virtual heterogenous::abstract_allocator::pointer allocate_bytes(size_t num_bytes, size_t alignment)
{
void *ptr = storage->allocate(num_bytes, alignment);
- return reinterpret_cast<abstract_allocator::pointer>(ptr);
+ return reinterpret_cast<heterogenous::abstract_allocator::pointer>(ptr);
}
virtual void deallocate_bytes(char * /*bytes*/)
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 04:09:51 EDT (Sun, 28 Jun 2009)
@@ -351,6 +351,10 @@
Name="heterogenous"
>
<File
+ RelativePath="..\..\..\..\boost\heterogenous\abstract_allocator.hpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\boost\heterogenous\allocator.hpp"
>
</File>
@@ -385,7 +389,7 @@
</Filter>
</Filter>
<File
- RelativePath=".\main.cpp"
+ RelativePath=".\tests.cpp"
>
</File>
</Files>
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