Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54496 - in sandbox/monotonic: boost boost/heterogenous libs/monotonic/test/clones
From: christian.schladetsch_at_[hidden]
Date: 2009-06-29 02:46:03


Author: cschladetsch
Date: 2009-06-29 02:46:00 EDT (Mon, 29 Jun 2009)
New Revision: 54496
URL: http://svn.boost.org/trac/boost/changeset/54496

Log:
added comments

Text files modified:
   sandbox/monotonic/boost/any.hpp | 34 +++++++++++++++++-----------------
   sandbox/monotonic/boost/heterogenous/make_clone_allocator.hpp | 22 ++++++++++++----------
   sandbox/monotonic/boost/heterogenous/vector.hpp | 6 +++---
   sandbox/monotonic/libs/monotonic/test/clones/tests.cpp | 2 +-
   4 files changed, 33 insertions(+), 31 deletions(-)

Modified: sandbox/monotonic/boost/any.hpp
==============================================================================
--- sandbox/monotonic/boost/any.hpp (original)
+++ sandbox/monotonic/boost/any.hpp 2009-06-29 02:46:00 EDT (Mon, 29 Jun 2009)
@@ -242,10 +242,10 @@
         }
     };
 
- template<typename ValueType, class Al2>
- ValueType * any_cast(any<Al2> * operand)
+ template<typename ValueType, class Al>
+ ValueType * any_cast(any<Al> * operand)
     {
- typedef any<Al2> any_type;
+ typedef any<Al> any_type;
         typedef typename any_type::template holder<ValueType> holder_type;
         return operand && operand->type() == typeid(ValueType)
                     ? &static_cast<holder_type *>
@@ -253,14 +253,14 @@
                     : 0;
     }
 
- template<typename ValueType, class Al3>
- inline const ValueType * any_cast(const any<Al3> * operand)
+ template<typename ValueType, class Al>
+ inline const ValueType * any_cast(const any<Al> * operand)
     {
- return any_cast<ValueType>(const_cast<any<Al3> *>(operand));
+ return any_cast<ValueType>(const_cast<any<Al> *>(operand));
     }
 
- template<typename ValueType, class Al4>
- ValueType any_cast(any<Al4> & operand)
+ template<typename ValueType, class Al>
+ ValueType any_cast(any<Al> & operand)
     {
         typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref;
 
@@ -280,8 +280,8 @@
         return *result;
     }
 
- template<typename ValueType, class Al5>
- inline ValueType any_cast(const any<Al5> & operand)
+ template<typename ValueType, class Al>
+ inline ValueType any_cast(const any<Al> & operand)
     {
         typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref;
 
@@ -291,7 +291,7 @@
         BOOST_STATIC_ASSERT(!is_reference<nonref>::value);
 #endif
 
- return any_cast<const nonref &>(const_cast<any<Al5> &>(operand));
+ return any_cast<const nonref &>(const_cast<any<Al> &>(operand));
     }
 
     // Note: The "unsafe" versions of any_cast are not part of the
@@ -299,16 +299,16 @@
     // required where we know what type is stored in the any and can't
     // use typeid() comparison, e.g., when our types may travel across
     // different shared libraries.
- template<typename ValueType, class Al6>
- inline ValueType * unsafe_any_cast(any<Al6> * operand)
+ template<typename ValueType, class Al>
+ inline ValueType * unsafe_any_cast(any<Al> * operand)
     {
- return &static_cast<typename any<Al6>::template holder<ValueType> *>(operand->content)->held;
+ return &static_cast<typename any<Al>::template holder<ValueType> *>(operand->content)->held;
     }
 
- template<typename ValueType, class Al7>
- inline const ValueType * unsafe_any_cast(const any<Al7> * operand)
+ template<typename ValueType, class Al>
+ inline const ValueType * unsafe_any_cast(const any<Al> * operand)
     {
- return unsafe_any_cast<ValueType>(const_cast<any<Al7> *>(operand));
+ return unsafe_any_cast<ValueType>(const_cast<any<Al> *>(operand));
     }
 }
 

Modified: sandbox/monotonic/boost/heterogenous/make_clone_allocator.hpp
==============================================================================
--- sandbox/monotonic/boost/heterogenous/make_clone_allocator.hpp (original)
+++ sandbox/monotonic/boost/heterogenous/make_clone_allocator.hpp 2009-06-29 02:46:00 EDT (Mon, 29 Jun 2009)
@@ -26,26 +26,28 @@
 
                                 struct header
                                 {
- header *allocated_ptr;
+ abstract_allocator::pointer allocated_ptr;
                                         size_t num_bytes;
                                 };
 
                                 abstract_allocator::pointer allocate_bytes(size_t num_bytes, size_t alignment)
                                 {
- CharAlloc alloc(*this);
- header head;
- head.num_bytes = sizeof(header) + num_bytes + alignment; // don't need this much, but will do for now
- head.allocated_ptr = (header *)alloc.allocate(head.num_bytes);
- *head.allocated_ptr = head;
- pointer base = head.allocated_ptr + sizeof(header);
- base += calc_padding(base, alignment);
- return base;
+ return 0;
+ //CharAlloc alloc(*this);
+ //header head;
+ //head.num_bytes = sizeof(header) + num_bytes + alignment; // don't need this much, but will do for now
+ //abstract_allocator::pointer char_ptr = alloc.allocate(head.num_bytes);
+ //head.allocated_ptr = (header *)char_ptr;
+ //*head.allocated_ptr = head;
+ //abstract_allocator::pointer base = char_ptr + sizeof(header);
+ //base += calc_padding(base, alignment);
+ //return base;
                                 }
 
                                 void deallocate_bytes(abstract_allocator::pointer ptr, size_t alignment)
                                 {
                                         CharAlloc alloc(*this);
- header *head = ptr - sizeof(head);
+ header *head = reinterpret_cast<header *>(ptr - sizeof(head));
                                         alloc.deallocate(head->allocated_ptr, head->num_bytes);
                                 }
 

Modified: sandbox/monotonic/boost/heterogenous/vector.hpp
==============================================================================
--- sandbox/monotonic/boost/heterogenous/vector.hpp (original)
+++ sandbox/monotonic/boost/heterogenous/vector.hpp 2009-06-29 02:46:00 EDT (Mon, 29 Jun 2009)
@@ -49,7 +49,7 @@
                         */
 
                         template <class Ty, class Fun>
- Fun foreach(Fun fun)
+ Fun for_each(Fun fun)
                         {
                                 BOOST_FOREACH(common_base &b, *this)
                                 {
@@ -62,7 +62,7 @@
                         }
 
                         template <class Ty, class Fun>
- Fun foreach(Fun fun) const
+ Fun for_each(Fun fun) const
                         {
                                 BOOST_FOREACH(const common_base &base, *this)
                                 {
@@ -197,7 +197,7 @@
                                 impl.push_back(ptr);
                         }
 
- allocator_type get_allocator()
+ typename implementation::allocator_type get_allocator()
                         {
                                 return impl.get_allocator();
                         }

Modified: sandbox/monotonic/libs/monotonic/test/clones/tests.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/clones/tests.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/clones/tests.cpp 2009-06-29 02:46:00 EDT (Mon, 29 Jun 2009)
@@ -81,7 +81,7 @@
                 bases.push_back<derived3>(3.14f, -123, "spam");
 
                 // perform functor on each contained object of the given type
- bases.foreach<derived3>(boost::bind(&derived3::print, _1));
+ bases.for_each<derived3>(boost::bind(&derived3::print, _1));
 
                 BOOST_ASSERT(bases.size() == 3);
 


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