Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54554 - sandbox/cloneable/boost/cloneable
From: christian.schladetsch_at_[hidden]
Date: 2009-06-30 20:25:36


Author: cschladetsch
Date: 2009-06-30 20:25:34 EDT (Tue, 30 Jun 2009)
New Revision: 54554
URL: http://svn.boost.org/trac/boost/changeset/54554

Log:
updated comments

Text files modified:
   sandbox/cloneable/boost/cloneable/base.hpp | 11 +++++------
   sandbox/cloneable/boost/cloneable/clone.hpp | 5 ++++-
   sandbox/cloneable/boost/cloneable/forward_declarations.hpp | 2 ++
   sandbox/cloneable/boost/cloneable/traits.hpp | 9 +++++----
   4 files changed, 16 insertions(+), 11 deletions(-)

Modified: sandbox/cloneable/boost/cloneable/base.hpp
==============================================================================
--- sandbox/cloneable/boost/cloneable/base.hpp (original)
+++ sandbox/cloneable/boost/cloneable/base.hpp 2009-06-30 20:25:34 EDT (Tue, 30 Jun 2009)
@@ -14,7 +14,7 @@
 {
         namespace cloneable
         {
- namespace detail
+ namespace impl
                 {
                         template <class Derived, class HasDefaultCtor>
                         struct create_new
@@ -32,15 +32,14 @@
                         template <class Derived>
                         struct create_new<Derived, no_default_construction>
                         {
- template <class Ty, class Alloc>
- static Derived *given(Ty *self, Alloc &alloc, size_t alignment)
+ template <class Self, class Alloc>
+ static Derived *given(Self *self, Alloc &alloc, size_t alignment)
                                 {
                                         throw no_default_construction();
                                 }
                         };
- }
 
- struct is_cloneable_tag { };
+ } // namespace impl
 
                 /// base for the given derived type, using the given base class
                 template <class Derived, class Base, class DefaultCtor>
@@ -78,7 +77,7 @@
 
                         virtual this_type *create_new(abstract_allocator &alloc) const
                         {
- return detail::create_new<Derived, DefaultCtor>::given(this, alloc, alignment);
+ return impl::create_new<Derived, DefaultCtor>::given(this, alloc, alignment);
                         }
 
                         virtual this_type *copy_construct(abstract_allocator &alloc) const

Modified: sandbox/cloneable/boost/cloneable/clone.hpp
==============================================================================
--- sandbox/cloneable/boost/cloneable/clone.hpp (original)
+++ sandbox/cloneable/boost/cloneable/clone.hpp 2009-06-30 20:25:34 EDT (Tue, 30 Jun 2009)
@@ -43,14 +43,17 @@
                                         return original.clone_as<T>(alloc);
                                 }
                         };
- }
 
+ } // namespace impl
+
+ /// free-function clone that works for cloneable and also default types
                 template <class T>
                 T *clone(const T &original)
                 {
                         return impl::clone<is_cloneable<T>::value>::given(original);
                 }
 
+ /// free-function clone that works for cloneable and also default types, given allocator
                 template <class T, class Alloc>
                 T *clone(const T &original, Alloc &alloc)
                 {

Modified: sandbox/cloneable/boost/cloneable/forward_declarations.hpp
==============================================================================
--- sandbox/cloneable/boost/cloneable/forward_declarations.hpp (original)
+++ sandbox/cloneable/boost/cloneable/forward_declarations.hpp 2009-06-30 20:25:34 EDT (Tue, 30 Jun 2009)
@@ -32,6 +32,8 @@
                 template <class Base = default_base_type, class DefaultCtor = default_construction>
                 struct abstract_base;
 
+ struct is_cloneable_tag { };
+
                 /// a structure derived from this, with type Derived, is correctly
                 /// cloneable from a base pointer, given an abstract_allocator.
                 template <

Modified: sandbox/cloneable/boost/cloneable/traits.hpp
==============================================================================
--- sandbox/cloneable/boost/cloneable/traits.hpp (original)
+++ sandbox/cloneable/boost/cloneable/traits.hpp 2009-06-30 20:25:34 EDT (Tue, 30 Jun 2009)
@@ -9,7 +9,6 @@
 #include <boost/mpl/bool.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/cloneable/detail/prefix.hpp>
-#include <boost/cloneable/base.hpp>
 
 namespace boost
 {
@@ -20,12 +19,13 @@
                         template <class T, bool>
                         struct traits
                         {
- BOOST_STATIC_CONSTANT(bool, is_cloneable = false);
- BOOST_STATIC_CONSTANT(bool, has_default_ctor = false); // this really should be ternary: yes, no or unknown
                                 typedef T derived_type;
                                 typedef T base_type;
                                 typedef unknown_construction default_constructable_type;
                                 typedef T abstract_base_type;
+
+ BOOST_STATIC_CONSTANT(bool, is_cloneable = false);
+ BOOST_STATIC_CONSTANT(bool, has_default_ctor = false); // this really should be ternary: yes, no or unknown
                         };
 
                         template <class T>
@@ -43,7 +43,8 @@
 
                         template <class T>
                         struct get_traits : traits<T, is_convertible<T *, is_cloneable_tag *>::value> { };
- }
+
+ } // namespace impl
 
                 template <class T>
                 struct traits : impl::get_traits<T> { };


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