Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54457 - sandbox/monotonic/boost/heterogenous
From: christian.schladetsch_at_[hidden]
Date: 2009-06-28 04:37:37


Author: cschladetsch
Date: 2009-06-28 04:37:37 EDT (Sun, 28 Jun 2009)
New Revision: 54457
URL: http://svn.boost.org/trac/boost/changeset/54457

Log:
changed comments

Text files modified:
   sandbox/monotonic/boost/heterogenous/base.hpp | 20 +++++++-------------
   1 files changed, 7 insertions(+), 13 deletions(-)

Modified: sandbox/monotonic/boost/heterogenous/base.hpp
==============================================================================
--- sandbox/monotonic/boost/heterogenous/base.hpp (original)
+++ sandbox/monotonic/boost/heterogenous/base.hpp 2009-06-28 04:37:37 EDT (Sun, 28 Jun 2009)
@@ -14,22 +14,16 @@
 {
         namespace heterogenous
         {
-
- /// base of the given derived type
+ /// base for the given derived type
                 template <class Derived>
- struct base : /*virtual */common_base
+ 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;
- }
+ static size_t alignment; ///< required alignment for allocation
+ mutable derived_type *self_ptr; ///< pointer to derived object in this
 
                 public:
                         base() : self_ptr(0) { }
@@ -38,13 +32,14 @@
                         {
                                 abstract_allocator::pointer bytes = alloc.allocate_bytes(sizeof(derived_type), alignment);
                                 Derived *ptr = reinterpret_cast<Derived *>(bytes);
- self(ptr) = ptr;
+ ptr->this_type::self_ptr = ptr;
                                 return ptr;
                         }
 
                         void deallocate(common_base *object, abstract_allocator &alloc) const
                         {
- alloc.deallocate_bytes(reinterpret_cast<abstract_allocator::pointer>(object));
+ Derived *ptr = static_cast<Derived *>(object);
+ alloc.deallocate_bytes(reinterpret_cast<abstract_allocator::pointer>(ptr));
                         }
 
                         virtual base<Derived> *create(abstract_allocator &alloc) const
@@ -66,7 +61,6 @@
                 template <class Derived>
                 size_t base<Derived>::alignment = aligned_storage<sizeof(Derived)>::alignment;
 
-
         } // namespace heterogenous
 
 } // namespace boost


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