Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54276 - in sandbox/monotonic: boost/monotonic boost/monotonic/container libs/monotonic/test libs/monotonic/test/Tests
From: christian.schladetsch_at_[hidden]
Date: 2009-06-23 06:26:45


Author: cschladetsch
Date: 2009-06-23 06:26:44 EDT (Tue, 23 Jun 2009)
New Revision: 54276
URL: http://svn.boost.org/trac/boost/changeset/54276

Log:
added monotonic::deque, ::chain, and basic tests
Added:
   sandbox/monotonic/boost/monotonic/container/deque.hpp (contents, props changed)
Text files modified:
   sandbox/monotonic/boost/monotonic/container.hpp | 37 +-----------
   sandbox/monotonic/boost/monotonic/container/chain.hpp | 110 ++++++++++++++++++++++++++++-----------
   sandbox/monotonic/boost/monotonic/container/list.hpp | 19 ++++++
   sandbox/monotonic/boost/monotonic/container/map.hpp | 4
   sandbox/monotonic/boost/monotonic/container/set.hpp | 2
   sandbox/monotonic/boost/monotonic/container/vector.hpp | 21 ++++++-
   sandbox/monotonic/boost/monotonic/monotonic.hpp | 2
   sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp | 35 ++++++++++++
   sandbox/monotonic/libs/monotonic/test/monotonic.vcproj | 4 +
   9 files changed, 162 insertions(+), 72 deletions(-)

Modified: sandbox/monotonic/boost/monotonic/container.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/container.hpp (original)
+++ sandbox/monotonic/boost/monotonic/container.hpp 2009-06-23 06:26:44 EDT (Tue, 23 Jun 2009)
@@ -18,19 +18,19 @@
         {
                 namespace detail
                 {
- struct monotonic_container_base { virtual ~monotonic_container_base() { } };
+ struct container_base { virtual ~container_base() { } };
 
                         template <class Impl>
- struct monotonic_container;
+ struct container;
 
                         template <class T>
- struct is_monotonic : mpl::bool_<is_convertible<T *, monotonic_container_base *>::value> { };
+ struct is_monotonic : mpl::bool_<is_convertible<T *, container_base *>::value> { };
                         
                         template <class Impl>
- struct is_monotonic<monotonic_container<Impl> > : mpl::true_ { };
+ struct is_monotonic<container<Impl> > : mpl::true_ { };
 
                         template <class Impl>
- struct monotonic_container : monotonic_container_base
+ struct container : container_base
                         {
                                 typedef Impl Derived;
 
@@ -45,33 +45,6 @@
                                 }
                         };
 
- // match against the standard containers for allocators
-
- template <class T, class U>
- struct is_monotonic<std::list<T, allocator<U> > > : mpl::true_ { };
-
- template <class T, class U>
- struct is_monotonic<std::vector<T, allocator<U> > > : mpl::true_ { };
-
- template <class K, class T, class Pred, class U>
- struct is_monotonic<std::map<K, T, Pred, allocator<U> > > : mpl::true_ { };
-
- template <class T, class Pred, class U>
- struct is_monotonic<std::set<T, Pred, allocator<U> > > : mpl::true_ { };
-
- // match against the standard containers for shared allocators
-
- template <class T, class U>
- struct is_monotonic<std::list<T, shared_allocator<U> > > : mpl::true_ { };
-
- template <class T, class U>
- struct is_monotonic<std::vector<T, shared_allocator<U> > > : mpl::true_ { };
-
- template <class K, class T, class Pred, class U>
- struct is_monotonic<std::map<K, T, Pred, shared_allocator<U> > > : mpl::true_ { };
-
- template <class T, class Pred, class U>
- struct is_monotonic<std::set<T, Pred, shared_allocator<U> > > : mpl::true_ { };
                 }
         }
 }

Modified: sandbox/monotonic/boost/monotonic/container/chain.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/container/chain.hpp (original)
+++ sandbox/monotonic/boost/monotonic/container/chain.hpp 2009-06-23 06:26:44 EDT (Tue, 23 Jun 2009)
@@ -6,11 +6,13 @@
 #ifndef BOOST_MONOTONIC_CHAIN_HPP
 #define BOOST_MONOTONIC_CHAIN_HPP
 
-#include <boost/monotonic/allocator.hpp>
-#include <boost/utility/iter_range.hpp>
 #include <boost/iterator.hpp>
 #include <boost/iterator/iterator_categories.hpp>
 
+#include <boost/utility/iter_range.hpp>
+#include <boost/monotonic/container/vector.hpp>
+#include <boost/monotonic/container/deque.hpp>
+
 namespace boost
 {
         namespace monotonic
@@ -25,17 +27,16 @@
                 /// this has limited utility outside of the context of a monotonic allocator.
                 /// the reason to use it there is to avoid resizing a vector using a monotonic
                 /// allocator, which is very wasteful. so, the trade-off is slightly slower
- /// access but ability to extend without resizing. then again, given that the
- /// main reason to use a monotonic allocator is speed, there may be limited
- /// application even there.
+ /// access but ability to extend without resizing.
                 ///
- template <class T, size_t ChunkSize = 64>
+ template <class T, size_t ChunkSize = 64, class Region = default_region_tag, class Access = default_access_tag>
                 struct chain
                 {
- typedef chain<T, ChunkSize> Rope;
- typedef allocator<T> Allocator;
- typedef vector<T> Vector;
- typedef list<Vector> Strands;
+ typedef chain<T, ChunkSize,Region,Access> Chain;
+ typedef allocator<T,Region,Access> Allocator;
+ typedef vector<T,Region,Access> Vector;
+ typedef deque<Vector,Region,Access> Strands;
+
                         typedef const_iter_range<Strands> ConstStrandsIterators;
                         typedef iter_range<Strands> StrandsIterators;
                         typedef const_iter_range<Vector> ConstVectorIterators;
@@ -48,19 +49,19 @@
                         template <class R, class S, class V, class Derived>
                         struct iterator_base : boost::iterator<random_access_traversal_tag, T>
                         {
- typedef R Rope;
+ typedef R Chain;
                                 typedef S StrandIterators;
                                 typedef V VectorIterators;
- Rope *parent;
+ Chain *parent;
                                 StrandIterators strand;
                                 VectorIterators vec;
 
                                 iterator_base() { }
- iterator_base(Rope &P)
+ iterator_base(Chain &P)
                                         : parent(&P) { }
- iterator_base(Rope &P, StrandIterators const &S)
+ iterator_base(Chain &P, StrandIterators const &S)
                                         : parent(&P), strand(S) { }
- iterator_base(Rope &P, StrandIterators const &S, VectorIterators const &V)
+ iterator_base(Chain &P, StrandIterators const &S, VectorIterators const &V)
                                         : parent(&P), strand(S), vec(V) { }
                                 Derived &This()
                                 {
@@ -93,15 +94,15 @@
                                         return !(*this == B);
                                 }
                         };
- struct iterator : iterator_base<Rope, StrandsIterators, VectorIterators, iterator>
+ struct iterator : iterator_base<Chain, StrandsIterators, VectorIterators, iterator>
                         {
- typedef iterator_base<Rope, StrandsIterators, VectorIterators, iterator> Parent;
+ typedef iterator_base<Chain, StrandsIterators, VectorIterators, iterator> Parent;
                                 iterator() { }
- iterator(Rope &P)
+ iterator(Chain &P)
                                         : Parent(P) { }
- iterator(Rope &P, StrandsIterators const &S)
+ iterator(Chain &P, StrandsIterators const &S)
                                         : Parent(P, S) { }
- iterator(Rope &P, StrandsIterators const &S, VectorIterators const &V)
+ iterator(Chain &P, StrandsIterators const &S, VectorIterators const &V)
                                         : Parent(P, S, V) { }
                                 T const &operator*() const
                                 {
@@ -113,18 +114,18 @@
                                 }
                         };
                         typedef iterator Iter;
- struct const_iterator : iterator_base<Rope const, ConstStrandsIterators, ConstVectorIterators, const_iterator>
+ struct const_iterator : iterator_base<Chain const, ConstStrandsIterators, ConstVectorIterators, const_iterator>
                         {
- typedef iterator_base<Rope const, ConstStrandsIterators, ConstVectorIterators, const_iterator> Parent;
+ typedef iterator_base<Chain const, ConstStrandsIterators, ConstVectorIterators, const_iterator> Parent;
                                 const_iterator() { }
- const_iterator(Rope const &P)
+ const_iterator(Chain const &P)
                                         : Parent(P) { }
                                 const_iterator(Iter const &X)
                                         : Parent(*X.parent, X.strand, X.vec)
                                 { }
- const_iterator(Rope const &P, ConstStrandsIterators const &S)
+ const_iterator(Chain const &P, ConstStrandsIterators const &S)
                                         : Parent(P, S) { }
- const_iterator(Rope const &P, ConstStrandsIterators const &S, ConstVectorIterators const &V)
+ const_iterator(Chain const &P, ConstStrandsIterators const &S, ConstVectorIterators const &V)
                                         : Parent(P, S, V) { }
                                 T const &operator*() const
                                 {
@@ -138,21 +139,21 @@
 
                 public:
                         chain() { }
- chain(Allocator const &A)
+ chain(Allocator A)
                                 : alloc(A), strands(A) { }
- chain(size_t len, Allocator const &A)
+ chain(size_t len, Allocator A = Allocator())
                                 : alloc(A), strands(A)
                         {
                                 // TODO
                         }
- chain(size_t len, T const &X, Allocator const &A)
+ chain(size_t len, T const &X, Allocator A = Allocator())
                                 : alloc(A), strands(A)
                         {
                                 strands.push_back(Vector(alloc));
                                 strands.back().resize(len, X);
                         }
                         template <class II>
- chain(II F, II L, Allocator const &A)
+ chain(II F, II L, Allocator A = Allocator())
                                 : alloc(A), strands(A)
                         {
                                 strands.push_back(Vector(alloc));
@@ -173,6 +174,10 @@
                                 }
                                 return len;
                         }
+ void clear()
+ {
+ strands.clear();
+ }
                         bool empty() const
                         {
                                 return strands.empty() || size() == 0;
@@ -254,8 +259,51 @@
                                 return at(index);
                         }
                 };
- }
-}
+
+#ifdef WIN32
+// warning C4996: 'std::equal': Function call with parameters that may be unsafe
+# pragma warning(push)
+# pragma warning(disable:4996)
+#endif
+
+ template <class Ty,size_t N,class R,class Acc,class Ty2,size_t N2,class R2,class Acc2>
+ bool operator==(chain<Ty,N,R,Acc> const &A, chain<Ty2,N2,R2,Acc2> const &B)
+ {
+ return A.size() == B.size() && std::equal(A.begin(), A.end(), B.begin());
+ }
+#ifdef WIN32
+# pragma warning(pop)
+#endif
+
+ template <class Ty,size_t N,class R,class Acc,class Ty2,size_t N2,class R2,class Acc2>
+ bool operator!=(chain<Ty,N,R,Acc> const &A, chain<Ty2,N2,R2,Acc2> const &B)
+ {
+ return !(A == B);
+ }
+ template <class Ty,size_t N,class R,class Acc,class Ty2,size_t N2,class R2,class Acc2>
+ bool operator<(chain<Ty,N,R,Acc> const &A, chain<Ty2,N2,R2,Acc2> const &B)
+ {
+ return std::lexicographical_compare(A.begin(), A.end(), B.begin(), B.end());
+ }
+ template <class Ty,size_t N,class R,class Acc,class Ty2,size_t N2,class R2,class Acc2>
+ bool operator>(chain<Ty,N,R,Acc> const &A, chain<Ty2,N2,R2,Acc2> const &B)
+ {
+ return std::lexicographical_compare(B.begin(), B.end(), A.begin(), A.end());
+ }
+ template <class Ty,size_t N,class R,class Acc,class Ty2,size_t N2,class R2,class Acc2>
+ bool operator<=(chain<Ty,N,R,Acc> const &A, chain<Ty2,N2,R2,Acc2> const &B)
+ {
+ return !(A > B);
+ }
+ template <class Ty,size_t N,class R,class Acc,class Ty2,size_t N2,class R2,class Acc2>
+ bool operator>=(chain<Ty,N,R,Acc> const &A, chain<Ty2,N2,R2,Acc2> const &B)
+ {
+ return !(A < B);
+ }
+
+ } // namespace monotonic
+
+} // namespace boost
 
 #endif // BOOST_MONOTONIC_CHAIN_HPP
 

Added: sandbox/monotonic/boost/monotonic/container/deque.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/monotonic/container/deque.hpp 2009-06-23 06:26:44 EDT (Tue, 23 Jun 2009)
@@ -0,0 +1,185 @@
+// Copyright (C) 2009 Christian Schladetsch
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_MONOTONIC_DEQUE_HPP
+#define BOOST_MONOTONIC_DEQUE_HPP
+
+#include <deque>
+#include <boost/monotonic/container.hpp>
+
+namespace boost
+{
+ namespace monotonic
+ {
+ /// a vector that uses a monotonic allocator in the given region, with given access system
+ template <class T, class Region = default_region_tag, class Access = default_access_tag>
+ struct deque : detail::container<deque<T,Region,Access> >
+ {
+ typedef allocator<T,Region,Access> Allocator;
+ typedef detail::container<std::vector<T, Allocator > > Parent;
+ typedef detail::Create<detail::is_monotonic<T>::value, T> Create;
+ typedef std::deque<T,Allocator> Impl;
+
+ typedef typename Impl::iterator iterator;
+ typedef typename Impl::const_iterator const_iterator;
+ typedef typename Impl::size_type size_type;
+ typedef typename Impl::value_type value_type;
+ typedef typename Impl::reference reference;
+ typedef typename Impl::const_reference const_reference;
+
+ private:
+ Impl impl;
+
+ public:
+ deque() { }
+ deque(Allocator A)
+ : impl(A) { }
+ deque(size_t N, T const &X, Allocator A = Allocator())
+ : impl(N,X,A) { }
+ template <class II>
+ deque(II F, II L, Allocator A = Allocator())
+ : impl(F,L,A) { }
+
+ Allocator get_allocator() const
+ {
+ return impl.get_allocator();
+ }
+ Impl const &get_impl() const
+ {
+ return impl;
+ }
+ Impl &get_impl()
+ {
+ return impl;
+ }
+ bool empty() const
+ {
+ return impl.empty();
+ }
+ size_type size() const
+ {
+ return impl.size();
+ }
+ void resize(size_type size)
+ {
+ impl.resize(size);//, Creator::Create(GetStorage()));
+ }
+ void reserve(size_type size)
+ {
+ impl.reserve(size);
+ }
+ size_type capacity() const
+ {
+ return impl.capacity();
+ }
+ reference at(size_type index)
+ {
+ return impl.at(index);
+ }
+ const_reference at(size_type index) const
+ {
+ return impl.at(index);
+ }
+ reference operator[](size_type index)
+ {
+ return impl[index];
+ }
+ const_reference operator[](size_type index) const
+ {
+ return impl[index];
+ }
+ void push_back(value_type const &value)
+ {
+ impl.push_back(value);
+ }
+ void pop_back()
+ {
+ impl.pop_back();
+ }
+ void push_front(value_type const &value)
+ {
+ impl.push_front(value);
+ }
+ void pop_front()
+ {
+ impl.pop_front();
+ }
+ iterator begin()
+ {
+ return impl.begin();
+ }
+ iterator end()
+ {
+ return impl.end();
+ }
+ const_iterator begin() const
+ {
+ return impl.begin();
+ }
+ const_iterator end() const
+ {
+ return impl.end();
+ }
+ value_type const &front() const
+ {
+ return impl.front();
+ }
+ value_type &front()
+ {
+ return impl.front();
+ }
+ value_type const &back() const
+ {
+ return impl.back();
+ }
+ value_type &back()
+ {
+ return impl.back();
+ }
+
+ void swap(deque &other)
+ {
+ impl.swap(other.impl);
+ }
+ };
+
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator==(deque<Ty,R,Acc> const &A, deque<Ty2,R2,Acc2> const &B)
+ {
+ return A.size() == B.size() && std::equal(A.begin(), A.end(), B.begin());
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator!=(deque<Ty,R,Acc> const &A, deque<Ty2,R2,Acc2> const &B)
+ {
+ return !(A == B);
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator<(deque<Ty,R,Acc> const &A, deque<Ty2,R2,Acc2> const &B)
+ {
+ return std::lexicographical_compare(A.begin(), A.end(), B.begin(), B.end());
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator>(deque<Ty,R,Acc> const &A, deque<Ty2,R2,Acc2> const &B)
+ {
+ return std::lexicographical_compare(B.begin(), B.end(), A.begin(), A.end());
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator<=(deque<Ty,R,Acc> const &A, deque<Ty2,R2,Acc2> const &B)
+ {
+ return !(A > B);
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator>=(deque<Ty,R,Acc> const &A, deque<Ty2,R2,Acc2> const &B)
+ {
+ return !(A < B);
+ }
+
+ } // namespace monotonic
+
+} // namespace boost
+
+#endif // BOOST_MONOTONIC_DEQUE_HPP
+
+//EOF

Modified: sandbox/monotonic/boost/monotonic/container/list.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/container/list.hpp (original)
+++ sandbox/monotonic/boost/monotonic/container/list.hpp 2009-06-23 06:26:44 EDT (Tue, 23 Jun 2009)
@@ -16,11 +16,11 @@
         {
                 /// A list that uses a monotonic allocator with the given region and access
                 template <class T, class Region = default_region_tag, class Access = default_access_tag>
- struct list : detail::monotonic_container<list<T,Region,Access> >
+ struct list : detail::container<list<T,Region,Access> >
                 {
                         typedef allocator<T,Region,Access> Allocator;
                         typedef std::list<T, Allocator> List, Implementation;
- typedef detail::monotonic_container<std::list<T, Allocator> > Parent;
+ typedef detail::container<std::list<T, Allocator> > Parent;
 
                         typedef typename List::iterator iterator;
                         typedef typename List::const_iterator const_iterator;
@@ -124,6 +124,21 @@
                 {
                         return std::lexicographical_compare(A.begin(), A.end(), B.begin(), B.end());
                 }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator>(list<Ty,R,Acc> const &A, list<Ty2,R2,Acc2> const &B)
+ {
+ return std::lexicographical_compare(B.begin(), B.end(), A.begin(), A.end());
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator<=(list<Ty,R,Acc> const &A, list<Ty2,R2,Acc2> const &B)
+ {
+ return !(A > B);
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator>=(list<Ty,R,Acc> const &A, list<Ty2,R2,Acc2> const &B)
+ {
+ return !(A < B);
+ }
 
         } // namespace monotonic
 

Modified: sandbox/monotonic/boost/monotonic/container/map.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/container/map.hpp (original)
+++ sandbox/monotonic/boost/monotonic/container/map.hpp 2009-06-23 06:26:44 EDT (Tue, 23 Jun 2009)
@@ -20,11 +20,11 @@
                         , class P = std::less<K> // predicate
                         , class Access = default_access_tag // access type
>
- struct map : detail::monotonic_container<map<K,T,Region,P,Access> >
+ struct map : detail::container<map<K,T,Region,P,Access> >
                 {
                         typedef P Predicate;
                         typedef allocator<K,Region,Access> Allocator;
- typedef detail::monotonic_container<map<K,T,Region,P,Access> > Parent;
+ typedef detail::container<map<K,T,Region,P,Access> > Parent;
                         typedef detail::Create<detail::is_monotonic<T>::value, T> Create;
 
                         typedef std::map<K,T,P,Allocator > Map, Implementation;

Modified: sandbox/monotonic/boost/monotonic/container/set.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/container/set.hpp (original)
+++ sandbox/monotonic/boost/monotonic/container/set.hpp 2009-06-23 06:26:44 EDT (Tue, 23 Jun 2009)
@@ -19,7 +19,7 @@
                         , class Region = default_region_tag // allocation region
                         , class P = std::less<T> // predicate
                         , class Access = default_access_tag> // access type
- struct set : detail::monotonic_container<set<T,Region,P,Access> >
+ struct set : detail::container<set<T,Region,P,Access> >
                 {
                         typedef allocator<T,Region,Access> Allocator;
                         typedef P Predicate;

Modified: sandbox/monotonic/boost/monotonic/container/vector.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/container/vector.hpp (original)
+++ sandbox/monotonic/boost/monotonic/container/vector.hpp 2009-06-23 06:26:44 EDT (Tue, 23 Jun 2009)
@@ -15,10 +15,10 @@
         {
                 /// a vector that uses a monotonic allocator in the given region, with given access system
                 template <class T, class Region = default_region_tag, class Access = default_access_tag>
- struct vector : detail::monotonic_container<vector<T,Region,Access> >
+ struct vector : detail::container<vector<T,Region,Access> >
                 {
                         typedef allocator<T,Region,Access> Allocator;
- typedef detail::monotonic_container<std::vector<T, Allocator > > Parent;
+ typedef detail::container<std::vector<T, Allocator > > Parent;
                         typedef detail::Create<detail::is_monotonic<T>::value, T> Create;
                         typedef std::vector<T,Allocator> Impl;
 
@@ -147,12 +147,25 @@
                 {
                         return !(A == B);
                 }
-
                 template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
                 bool operator<(vector<Ty,R,Acc> const &A, vector<Ty2,R2,Acc2> const &B)
                 {
                         return std::lexicographical_compare(A.begin(), A.end(), B.begin(), B.end());
-
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator>(vector<Ty,R,Acc> const &A, vector<Ty2,R2,Acc2> const &B)
+ {
+ return std::lexicographical_compare(B.begin(), B.end(), A.begin(), A.end());
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator<=(vector<Ty,R,Acc> const &A, vector<Ty2,R2,Acc2> const &B)
+ {
+ return !(A > B);
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator>=(vector<Ty,R,Acc> const &A, vector<Ty2,R2,Acc2> const &B)
+ {
+ return !(A < B);
                 }
 
         } // namespace monotonic

Modified: sandbox/monotonic/boost/monotonic/monotonic.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/monotonic.hpp (original)
+++ sandbox/monotonic/boost/monotonic/monotonic.hpp 2009-06-23 06:26:44 EDT (Tue, 23 Jun 2009)
@@ -20,6 +20,8 @@
 #include <boost/monotonic/container/list.hpp>
 #include <boost/monotonic/container/set.hpp>
 #include <boost/monotonic/container/map.hpp>
+#include <boost/monotonic/container/deque.hpp>
+#include <boost/monotonic/container/chain.hpp>
 
 namespace boost
 {

Modified: sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp 2009-06-23 06:26:44 EDT (Tue, 23 Jun 2009)
@@ -99,6 +99,41 @@
         monotonic::static_storage<region1>::reset();
 }
 
+BOOST_AUTO_TEST_CASE(test_deque)
+{
+ monotonic::deque<int, region0> deq0;
+ monotonic::deque<int, region1> deq1;
+
+ deq0.push_back(42);
+ deq1.push_back(42);
+ BOOST_ASSERT(deq0 == deq1);
+
+ monotonic::static_storage<region0>::reset();
+ monotonic::static_storage<region1>::reset();
+}
+
+
+BOOST_AUTO_TEST_CASE(test_chain)
+{
+ monotonic::chain<int, 16, region0> deq0;
+ monotonic::chain<int, 16, region1> deq1;
+
+ deq0.push_back(1);
+ deq1.push_back(1);
+ BOOST_ASSERT(deq0 == deq1);
+
+ deq1.push_back(2);
+ deq1.push_back(3);
+ BOOST_ASSERT(deq0 != deq1);
+
+ int sum = 0;
+ BOOST_FOREACH(int n, deq1)
+ sum += n;
+ BOOST_CHECK(sum == 6);
+
+ monotonic::static_storage<region0>::reset();
+ monotonic::static_storage<region1>::reset();
+}
 
 BOOST_AUTO_TEST_CASE(test_local)
 {

Modified: sandbox/monotonic/libs/monotonic/test/monotonic.vcproj
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/monotonic.vcproj (original)
+++ sandbox/monotonic/libs/monotonic/test/monotonic.vcproj 2009-06-23 06:26:44 EDT (Tue, 23 Jun 2009)
@@ -322,6 +322,10 @@
>
                                         </File>
                                         <File
+ RelativePath="..\..\..\boost\monotonic\container\deque.hpp"
+ >
+ </File>
+ <File
                                                 RelativePath="..\..\..\boost\monotonic\container\inline_clone_allocator.hpp"
>
                                         </File>


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