Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54010 - in sandbox/monotonic: boost/monotonic libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-17 06:31:48


Author: cschladetsch
Date: 2009-06-17 06:31:47 EDT (Wed, 17 Jun 2009)
New Revision: 54010
URL: http://svn.boost.org/trac/boost/changeset/54010

Log:
renamed from CamelCase

Text files modified:
   sandbox/monotonic/boost/monotonic/allocator.hpp | 6 ++++--
   sandbox/monotonic/boost/monotonic/container.hpp | 22 +++++++++++-----------
   sandbox/monotonic/boost/monotonic/list.hpp | 4 ++--
   sandbox/monotonic/boost/monotonic/map.hpp | 8 ++++----
   sandbox/monotonic/boost/monotonic/vector.hpp | 6 +++---
   sandbox/monotonic/libs/monotonic/test/main.cpp | 19 ++++++++++++++++---
   6 files changed, 40 insertions(+), 25 deletions(-)

Modified: sandbox/monotonic/boost/monotonic/allocator.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/allocator.hpp (original)
+++ sandbox/monotonic/boost/monotonic/allocator.hpp 2009-06-17 06:31:47 EDT (Wed, 17 Jun 2009)
@@ -58,6 +58,8 @@
                                 template <class T, class Alloc>
                                 static void Given(T *ptr, T const &val, Alloc *allocator)
                                 {
+ // unfortunately, there is no requirement for a container to
+ // have a copy-ctor that also passes an allocator.
                                         new (ptr) T(*allocator);
                                         *ptr = val;
                                 }
@@ -142,12 +144,12 @@
 
                         void construct(pointer ptr)
                         {
- detail::Construct<detail::IsMonotonic<T>::value>::Given(ptr, this);
+ detail::Construct<detail::is_monotonic<T>::value>::Given(ptr, this);
                         }
 
                         void construct(pointer ptr, const T& val)
                         {
- detail::Construct<detail::IsMonotonic<T>::value>::Given(ptr, val, this);
+ detail::Construct<detail::is_monotonic<T>::value>::Given(ptr, val, this);
                         }
 
                         void destroy(pointer ptr)

Modified: sandbox/monotonic/boost/monotonic/container.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/container.hpp (original)
+++ sandbox/monotonic/boost/monotonic/container.hpp 2009-06-17 06:31:47 EDT (Wed, 17 Jun 2009)
@@ -18,24 +18,23 @@
         {
                 namespace detail
                 {
- struct MonotonicContainerBase { virtual ~MonotonicContainerBase() { } };
+ struct monotonic_container_base { virtual ~monotonic_container_base() { } };
 
                         template <class Impl>
- struct MonotonicContainer;
+ struct monotonic_container;
 
                         template <class T>
- struct IsMonotonic : boost::mpl::bool_<is_convertible<T *, MonotonicContainerBase *>::value> { };
+ struct is_monotonic : mpl::bool_<is_convertible<T *, monotonic_container_base *>::value> { };
                         
                         template <class Impl>
- struct IsMonotonic<MonotonicContainer<Impl> > : boost::mpl::true_ { };
+ struct is_monotonic<monotonic_container<Impl> > : mpl::true_ { };
 
                         template <class Impl>
- struct MonotonicContainer : MonotonicContainerBase
+ struct monotonic_container : monotonic_container_base
                         {
                                 typedef Impl Derived;
 
- virtual ~MonotonicContainer() { }
- storage_base &GetStorage() const
+ storage_base &get_storage() const
                                 {
                                         Derived const &self = static_cast<Derived const &>(*this);
                                         storage_base *store = self.get_allocator().get_storage();
@@ -46,6 +45,7 @@
                                 }
                         };
 
+ // TODO move to detail::Construct in allocator.hpp
                         template <bool is_monotonic_container, class T>
                         struct Creator
                         {
@@ -66,16 +66,16 @@
                         // match against the standard containers
 
                         template <class T, class U>
- struct IsMonotonic<std::list<T, allocator<U> > > : boost::mpl::true_ { };
+ struct is_monotonic<std::list<T, allocator<U> > > : mpl::true_ { };
 
                         template <class T, class U>
- struct IsMonotonic<std::vector<T, allocator<U> > > : boost::mpl::true_ { };
+ struct is_monotonic<std::vector<T, allocator<U> > > : mpl::true_ { };
 
                         template <class K, class T, class Pred, class U>
- struct IsMonotonic<std::map<K, T, Pred, allocator<U> > > : boost::mpl::true_ { };
+ struct is_monotonic<std::map<K, T, Pred, allocator<U> > > : mpl::true_ { };
 
                         template <class T, class Pred, class U>
- struct IsMonotonic<std::set<T, Pred, allocator<U> > > : boost::mpl::true_ { };
+ struct is_monotonic<std::set<T, Pred, allocator<U> > > : mpl::true_ { };
                 }
         }
 }

Modified: sandbox/monotonic/boost/monotonic/list.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/list.hpp (original)
+++ sandbox/monotonic/boost/monotonic/list.hpp 2009-06-17 06:31:47 EDT (Wed, 17 Jun 2009)
@@ -16,11 +16,11 @@
         {
                 /// A list that uses a monotonic allocator by default
                 template <class T>
- struct list : detail::MonotonicContainer<list<T> >
+ struct list : detail::monotonic_container<list<T> >
                 {
                         typedef allocator<T> Allocator;
                         typedef std::list<T, Allocator> List, Implementation;
- typedef detail::MonotonicContainer<std::list<T, Allocator> > Parent;
+ typedef detail::monotonic_container<std::list<T, Allocator> > Parent;
                         typedef typename List::iterator iterator;
                         typedef typename List::const_iterator const_iterator;
                         typedef typename List::size_type size_type;

Modified: sandbox/monotonic/boost/monotonic/map.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/map.hpp (original)
+++ sandbox/monotonic/boost/monotonic/map.hpp 2009-06-17 06:31:47 EDT (Wed, 17 Jun 2009)
@@ -16,10 +16,10 @@
                 /// A map that uses a monotonic allocator, and respects that allocator
                 /// when creating new referent instances
                 template <class K, class T, class P = std::less<K> >
- struct map : detail::MonotonicContainer<map<K,T,P> >
+ struct map : detail::monotonic_container<map<K,T,P> >
                 {
- typedef detail::MonotonicContainer<map<K,T,P> > Parent;
- typedef detail::Creator<detail::IsMonotonic<T>::value, T> Creator;
+ typedef detail::monotonic_container<map<K,T,P> > Parent;
+ typedef detail::Creator<detail::is_monotonic<T>::value, T> Creator;
 
                         typedef P Predicate;
                         typedef allocator<K> Allocator;
@@ -103,7 +103,7 @@
                                 iterator where = impl.lower_bound(key);
                                 if (where == impl.end() || pred(key, where->first))
                                 {
- where = impl.insert(where, value_type(key, Creator::Create(this->Parent::GetStorage())));
+ where = impl.insert(where, value_type(key, Creator::Create(this->Parent::get_storage())));
                                 }
                                 return where->second;
                         }

Modified: sandbox/monotonic/boost/monotonic/vector.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/vector.hpp (original)
+++ sandbox/monotonic/boost/monotonic/vector.hpp 2009-06-17 06:31:47 EDT (Wed, 17 Jun 2009)
@@ -15,10 +15,10 @@
         {
                 /// a vector that uses a monotonic allocator by default
                 template <class T>
- struct vector : detail::MonotonicContainer<vector<T> >
+ struct vector : detail::monotonic_container<vector<T> >
                 {
- typedef detail::MonotonicContainer<std::vector<T, allocator<T> > > Parent;
- typedef detail::Creator<detail::IsMonotonic<T>::value, T> Creator;
+ typedef detail::monotonic_container<std::vector<T, allocator<T> > > Parent;
+ typedef detail::Creator<detail::is_monotonic<T>::value, T> Creator;
                         typedef allocator<T> Allocator;
                         typedef std::vector<T,Allocator> Vector;
                         typedef typename Vector::iterator iterator;

Modified: sandbox/monotonic/libs/monotonic/test/main.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/main.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/main.cpp 2009-06-17 06:31:47 EDT (Wed, 17 Jun 2009)
@@ -334,8 +334,8 @@
         {
                 typedef std::list<int, monotonic::allocator<int> > List;
                 typedef std::vector<List, monotonic::allocator<List> > Vector;
- BOOST_STATIC_ASSERT(monotonic::detail::IsMonotonic<List>::value);
- BOOST_STATIC_ASSERT(monotonic::detail::IsMonotonic<Vector>::value);
+ BOOST_STATIC_ASSERT(monotonic::detail::is_monotonic<List>::value);
+ BOOST_STATIC_ASSERT(monotonic::detail::is_monotonic<Vector>::value);
                 Vector vec(store);
                 vec.resize(1);
                 BOOST_ASSERT(vec[0].get_allocator().get_storage() == vec.get_allocator().get_storage());
@@ -343,9 +343,22 @@
         }
 
         {
+ typedef std::list<int, monotonic::allocator<int> > List;
+ BOOST_STATIC_ASSERT(monotonic::detail::is_monotonic<List>::value);
+ typedef std::map<int, List, std::less<int>, monotonic::allocator<int> > Map;
+ BOOST_STATIC_ASSERT(monotonic::detail::is_monotonic<Map>::value);
+ Map map(less<int>(), store);
+ //map[42].push_back(123);
+ map.insert(make_pair(42, List(store)));
+ map[42].push_back(123);
+ BOOST_ASSERT(map[42].get_allocator().get_storage() == map.get_allocator().get_storage());
+ }
+
+ {
                 typedef monotonic::list<int> List;
- BOOST_STATIC_ASSERT(monotonic::detail::IsMonotonic<List>::value);
+ BOOST_STATIC_ASSERT(monotonic::detail::is_monotonic<List>::value);
                 typedef monotonic::map<int, List > Map;
+ BOOST_STATIC_ASSERT(monotonic::detail::is_monotonic<Map>::value);
                 Map map(store);
                 map[42].push_back(123);
                 BOOST_ASSERT(map[42].get_allocator().get_storage() == map.get_allocator().get_storage());


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