|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54430 - sandbox/monotonic/boost
From: christian.schladetsch_at_[hidden]
Date: 2009-06-28 01:42:30
Author: cschladetsch
Date: 2009-06-28 01:42:29 EDT (Sun, 28 Jun 2009)
New Revision: 54430
URL: http://svn.boost.org/trac/boost/changeset/54430
Log:
changed comments
Text files modified:
sandbox/monotonic/boost/cloneable.hpp | 24 +++++++++++-------------
1 files changed, 11 insertions(+), 13 deletions(-)
Modified: sandbox/monotonic/boost/cloneable.hpp
==============================================================================
--- sandbox/monotonic/boost/cloneable.hpp (original)
+++ sandbox/monotonic/boost/cloneable.hpp 2009-06-28 01:42:29 EDT (Sun, 28 Jun 2009)
@@ -65,40 +65,38 @@
}
};
+ /// 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 U >
- static U* allocate_clone( const U& r )
+ template <class Base>
+ static Base* allocate_clone( const Base& object )
{
throw;
}
- template< class U >
- static void deallocate_clone( const U* clone )
+ template <class Base>
+ static void deallocate_clone( const Base* clone )
{
//throw;
}
- // idea: pass allocator to the clone_allocator.
- // allocator rebind could be done in the ptr_container.
// calling this must be disabled at compile-time for types that are not boost::is_convertible<cloneable::base<U> *, U*>
- template< class U, class Alloc >
- static U* allocate_clone( const U& r, Alloc &alloc )
+ template <class Base, class Alloc>
+ static Base* allocate_clone(const Base& object, Alloc &alloc )
{
- U *ptr = r.copy_construct(r, alloc);
- return ptr;
+ return object.copy_construct(object, alloc);
}
// this is not even needed?
- template< class U, class Alloc >
- static U* deallocate_clone( const U* r, Alloc &alloc )
+ template <class Base, class Alloc>
+ static void deallocate_clone(Base &object, Alloc &alloc )
{
typename Alloc::template rebind<U>::other my_alloc(alloc);
- my_alloc.deallocate(const_cast<U *>(r));
+ my_alloc.deallocate(&object);
}
};
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