|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54620 - in sandbox/cloneable: boost/cloneable boost/cloneable/detail libs/cloneable/test
From: christian.schladetsch_at_[hidden]
Date: 2009-07-03 18:35:51
Author: cschladetsch
Date: 2009-07-03 18:35:50 EDT (Fri, 03 Jul 2009)
New Revision: 54620
URL: http://svn.boost.org/trac/boost/changeset/54620
Log:
added associative_container_base<>
Added:
sandbox/cloneable/boost/cloneable/detail/associative_container_base.hpp (contents, props changed)
sandbox/cloneable/boost/cloneable/detail/sequence_container_base.hpp (contents, props changed)
Text files modified:
sandbox/cloneable/boost/cloneable/detail/container_base.hpp | 193 +--------------------------------------
sandbox/cloneable/boost/cloneable/list.hpp | 20 +--
sandbox/cloneable/boost/cloneable/map.hpp | 107 +++++++++------------
sandbox/cloneable/boost/cloneable/set.hpp | 89 ++++++++----------
sandbox/cloneable/boost/cloneable/vector.hpp | 19 +--
sandbox/cloneable/libs/cloneable/test/cloneable.vcproj | 8 +
6 files changed, 122 insertions(+), 314 deletions(-)
Added: sandbox/cloneable/boost/cloneable/detail/associative_container_base.hpp
==============================================================================
--- (empty file)
+++ sandbox/cloneable/boost/cloneable/detail/associative_container_base.hpp 2009-07-03 18:35:50 EDT (Fri, 03 Jul 2009)
@@ -0,0 +1,109 @@
+// 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_CLONEABLE_DETAIL_ASSOCIATIVE_CONTAINER_BASE_HPP
+#define BOOST_CLONEABLE_DETAIL_ASSOCIATIVE_CONTAINER_BASE_HPP
+
+#include <boost/cloneable/detail/prefix.hpp>
+#include <boost/cloneable/detail/container_base.hpp>
+#include <boost/cloneable/base.hpp>
+
+namespace boost
+{
+ namespace cloneable
+ {
+ namespace detail
+ {
+ template <class Cont, class Pred, class Base, class Alloc>
+ struct associative_container_base
+ : container_base<Cont,Base,Alloc>
+ {
+ typedef container_base<Cont,Base,Alloc> parent_type;
+ typedef Pred predicate_type;
+
+ using parent_type::container_type;
+ using parent_type::base_type;
+ using parent_type::abstract_base_type;
+ using parent_type::allocator_type;
+ using parent_type::validate;
+ using parent_type::new_instance;
+ using parent_type::instance;
+
+ using parent_type::iterator;
+ using parent_type::const_iterator;
+ using parent_type::reference;
+ using parent_type::const_reference;
+ using parent_type::value_type;
+
+ private:
+ predicate_type predicate;
+ container_type container;
+
+ protected:
+ const container_type &impl() const
+ {
+ return container;
+ }
+ container_type &impl()
+ {
+ return container;
+ }
+
+ public:
+ associative_container_base()
+ {
+ }
+ associative_container_base(predicate_type p)
+ : predicate(p), container(p)
+ {
+ }
+ associative_container_base(allocator_type &a)
+ : parent_type(a), container(a)
+ {
+ }
+ associative_container_base(predicate_type p, allocator_type &a)
+ : parent_type(a), predicate(p), container(p,a)
+ {
+ }
+
+ size_t size() const
+ {
+ return impl().size();
+ }
+ bool empty() const
+ {
+ return impl().empty();
+ }
+
+ iterator begin()
+ {
+ return impl().begin();
+ }
+ iterator end()
+ {
+ return impl().end();
+ }
+ const_iterator begin() const
+ {
+ return impl().begin();
+ }
+ const_iterator end() const
+ {
+ return impl().end();
+ }
+
+ };
+
+ } // namespace detail
+
+ } // namespace cloneable
+
+} // namespace boost
+
+#include <boost/cloneable/detail/suffix.hpp>
+
+#endif // BOOST_CLONEABLE_DETAIL_ASSOCIATIVE_CONTAINER_BASE_HPP
+
+//EOF
Modified: sandbox/cloneable/boost/cloneable/detail/container_base.hpp
==============================================================================
--- sandbox/cloneable/boost/cloneable/detail/container_base.hpp (original)
+++ sandbox/cloneable/boost/cloneable/detail/container_base.hpp 2009-07-03 18:35:50 EDT (Fri, 03 Jul 2009)
@@ -18,14 +18,21 @@
namespace detail
{
/// common functionality for all containers using the given base and allocator types
- template <class Base, class Alloc>
+ template <class Cont, class Base, class Alloc>
struct container_base
{
+ typedef Cont container_type;
typedef Base base_type;
typedef abstract_base<base_type> abstract_base_type;
typedef typename detail::make_clone_allocator<Alloc>::type allocator_type;
typedef instance_base<Base, allocator_type> instance_base_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::reference reference;
+ typedef typename container_type::const_reference const_reference;
+ typedef typename container_type::iterator iterator;
+ typedef typename container_type::const_iterator const_iterator;
+
/// ensures that the given type T is a valid type for this container.
/// this provides better information from errors than otherwise.
template <class T>
@@ -61,6 +68,7 @@
allocator_type alloc;
protected:
+
template <class U>
instance<U> new_instance()
{
@@ -95,193 +103,10 @@
{
return alloc;
}
- };
- template <class Cont, class Base, class Alloc>
- struct sequence_container_base : container_base<Base,Alloc>
- {
- typedef Cont container_type;
- typedef container_base<Base,Alloc> parent_type;
- using parent_type::base_type;
- using parent_type::abstract_base_type;
- using parent_type::allocator_type;
- using parent_type::validate;
- using parent_type::new_instance;
- using parent_type::instance;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::reference reference;
- typedef typename container_type::const_reference const_reference;
- typedef typename container_type::iterator iterator;
- typedef typename container_type::const_iterator const_iterator;
-
- private:
- container_type container;
-
- protected:
- const container_type &impl() const
- {
- return container;
- }
- container_type &impl()
- {
- return container;
- }
-
- public:
- sequence_container_base()
- : container(get_allocator())
- {
- }
- sequence_container_base(allocator_type &a)
- : parent_type(a), container(get_allocator())
- {
- }
-
- size_t size() const
- {
- return container.size();
- }
-
- template <class Ty, class Fun>
- Fun for_each(Fun fun)
- {
- BOOST_FOREACH(base_type &b, *this)
- {
- if (Ty *ptr = dynamic_cast<Ty *>(&b))
- {
- fun(*ptr);
- }
- }
- return fun;
- }
-
- template <class Ty, class Fun>
- Fun for_each(Fun fun) const
- {
- BOOST_FOREACH(const base_type &base, *this)
- {
- if (Ty *ptr = dynamic_cast<Ty *>(&base))
- {
- fun(*ptr);
- }
- }
- return fun;
- }
-
- bool empty() const
- {
- return impl().empty();
- }
-
- iterator begin()
- {
- return impl().begin();
- }
- iterator end()
- {
- return impl().end();
- }
- const_iterator begin() const
- {
- return impl().begin();
- }
- const_iterator end() const
- {
- return impl().end();
- }
-
- reference back()
- {
- return impl().back();
- }
- const_reference back() const
- {
- return impl().back();
- }
- reference front()
- {
- return impl().front();
- }
- const_reference front() const
- {
- return impl().front();
- }
-
- template <class Other>
- Other &back_as()
- {
- BOOST_STATIC_ASSERT(is_cloneable<Other>::value);
- Other *ptr = dynamic_cast<Other *>(back());
- if (ptr == 0)
- throw std::bad_cast();
- return *ptr;
- }
- template <class Other>
- Other &front_as()
- {
- BOOST_STATIC_ASSERT(is_cloneable<Other>::value);
- Other *ptr = dynamic_cast<Other *>(front());
- if (ptr == 0)
- throw std::bad_cast();
- return *ptr;
- }
-
- // TODO: use variadic arguments or BOOST_PP to pass ctor args
- template <class U>
- void push_back()
- {
- impl().push_back(new_instance<typename validate<U>::type>().to_abstract());
- }
- template <class U, class A0>
- void push_back(A0 a0)
- {
- impl().push_back(new_instance<typename validate<U>::type>(a0).to_abstract());
- }
- template <class U, class A0, class A1>
- void push_back(A0 a0, A1 a1)
- {
- impl().push_back(new_instance<typename validate<U>::type>(a0,a1).to_abstract());
- }
- template <class U, class A0, class A1, class A2>
- void push_back(A0 a0, A1 a1, A2 a2)
- {
- impl().push_back(new_instance<typename validate<U>::type>(a0,a1,a2).to_abstract());
- }
-
-
- template <class U>
- void push_front()
- {
- impl().push_front(new_instance<typename validate<U>::type>().to_abstract());
- }
- template <class U, class A0>
- void push_front(A0 a0)
- {
- impl().push_front(new_instance<typename validate<U>::type>(a0).to_abstract());
- }
- template <class U, class A0, class A1>
- void push_front(A0 a0, A1 a1)
- {
- impl().push_front(new_instance<typename validate<U>::type>(a0,a1).to_abstract());
- }
- template <class U, class A0, class A1, class A2>
- void push_front(A0 a0, A1 a1, A2 a2)
- {
- impl().push_front(new_instance<typename validate<U>::type>(a0,a1,a2).to_abstract());
- }
};
- template <class Cont, class Base, class Alloc>
- bool operator==(const sequence_container_base<Cont,Base,Alloc> &left, const sequence_container_base<Cont,Base,Alloc> &right)
- {
- return left.size() == right.size() && std::equal(left.begin(), left.end(), right.begin());
- }
- template <class Cont, class Base, class Alloc>
- bool operator<(const sequence_container_base<Cont,Base,Alloc> &left, const sequence_container_base<Cont,Base,Alloc> &right)
- {
- return std::lexicographical_compare(left.begin(), left.end(), right.begin(), right.end());
- }
} // namespace detail
} // namespace cloneable
Added: sandbox/cloneable/boost/cloneable/detail/sequence_container_base.hpp
==============================================================================
--- (empty file)
+++ sandbox/cloneable/boost/cloneable/detail/sequence_container_base.hpp 2009-07-03 18:35:50 EDT (Fri, 03 Jul 2009)
@@ -0,0 +1,215 @@
+// 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_CLONEABLE_DETAIL_SEQUENCE_CONTAINER_BASE_HPP
+#define BOOST_CLONEABLE_DETAIL_SEQUENCE_CONTAINER_BASE_HPP
+
+#include <boost/cloneable/detail/prefix.hpp>
+#include <boost/cloneable/detail/container_base.hpp>
+#include <boost/cloneable/base.hpp>
+
+namespace boost
+{
+ namespace cloneable
+ {
+ namespace detail
+ {
+ template <class Cont, class Base, class Alloc>
+ struct sequence_container_base : container_base<Cont,Base,Alloc>
+ {
+ typedef Cont container_type;
+ typedef container_base<Cont,Base,Alloc> parent_type;
+ using parent_type::base_type;
+ using parent_type::abstract_base_type;
+ using parent_type::allocator_type;
+ using parent_type::validate;
+ using parent_type::new_instance;
+ using parent_type::instance;
+
+ using parent_type::iterator;
+ using parent_type::const_iterator;
+ using parent_type::reference;
+ using parent_type::const_reference;
+ using parent_type::value_type;
+
+ private:
+ container_type container;
+
+ protected:
+ const container_type &impl() const
+ {
+ return container;
+ }
+ container_type &impl()
+ {
+ return container;
+ }
+
+ public:
+ sequence_container_base()
+ {
+ }
+ sequence_container_base(allocator_type &a)
+ : container(a)
+ {
+ }
+
+ size_t size() const
+ {
+ return container.size();
+ }
+
+ template <class Ty, class Fun>
+ Fun for_each(Fun fun)
+ {
+ BOOST_FOREACH(base_type &b, *this)
+ {
+ if (Ty *ptr = dynamic_cast<Ty *>(&b))
+ {
+ fun(*ptr);
+ }
+ }
+ return fun;
+ }
+
+ template <class Ty, class Fun>
+ Fun for_each(Fun fun) const
+ {
+ BOOST_FOREACH(const base_type &base, *this)
+ {
+ if (Ty *ptr = dynamic_cast<Ty *>(&base))
+ {
+ fun(*ptr);
+ }
+ }
+ return fun;
+ }
+
+ bool empty() const
+ {
+ return impl().empty();
+ }
+
+ iterator begin()
+ {
+ return impl().begin();
+ }
+ iterator end()
+ {
+ return impl().end();
+ }
+ const_iterator begin() const
+ {
+ return impl().begin();
+ }
+ const_iterator end() const
+ {
+ return impl().end();
+ }
+
+ reference back()
+ {
+ return impl().back();
+ }
+ const_reference back() const
+ {
+ return impl().back();
+ }
+ reference front()
+ {
+ return impl().front();
+ }
+ const_reference front() const
+ {
+ return impl().front();
+ }
+
+ template <class Other>
+ Other &back_as()
+ {
+ BOOST_STATIC_ASSERT(is_cloneable<Other>::value);
+ Other *ptr = dynamic_cast<Other *>(back());
+ if (ptr == 0)
+ throw std::bad_cast();
+ return *ptr;
+ }
+ template <class Other>
+ Other &front_as()
+ {
+ BOOST_STATIC_ASSERT(is_cloneable<Other>::value);
+ Other *ptr = dynamic_cast<Other *>(front());
+ if (ptr == 0)
+ throw std::bad_cast();
+ return *ptr;
+ }
+
+ // TODO: use variadic arguments or BOOST_PP to pass ctor args
+ template <class U>
+ void push_back()
+ {
+ impl().push_back(new_instance<typename validate<U>::type>().to_abstract());
+ }
+ template <class U, class A0>
+ void push_back(A0 a0)
+ {
+ impl().push_back(new_instance<typename validate<U>::type>(a0).to_abstract());
+ }
+ template <class U, class A0, class A1>
+ void push_back(A0 a0, A1 a1)
+ {
+ impl().push_back(new_instance<typename validate<U>::type>(a0,a1).to_abstract());
+ }
+ template <class U, class A0, class A1, class A2>
+ void push_back(A0 a0, A1 a1, A2 a2)
+ {
+ impl().push_back(new_instance<typename validate<U>::type>(a0,a1,a2).to_abstract());
+ }
+
+
+ template <class U>
+ void push_front()
+ {
+ impl().push_front(new_instance<typename validate<U>::type>().to_abstract());
+ }
+ template <class U, class A0>
+ void push_front(A0 a0)
+ {
+ impl().push_front(new_instance<typename validate<U>::type>(a0).to_abstract());
+ }
+ template <class U, class A0, class A1>
+ void push_front(A0 a0, A1 a1)
+ {
+ impl().push_front(new_instance<typename validate<U>::type>(a0,a1).to_abstract());
+ }
+ template <class U, class A0, class A1, class A2>
+ void push_front(A0 a0, A1 a1, A2 a2)
+ {
+ impl().push_front(new_instance<typename validate<U>::type>(a0,a1,a2).to_abstract());
+ }
+ };
+
+
+ template <class Cont, class Base, class Alloc>
+ bool operator==(const sequence_container_base<Cont,Base,Alloc> &left, const sequence_container_base<Cont,Base,Alloc> &right)
+ {
+ return left.size() == right.size() && std::equal(left.begin(), left.end(), right.begin());
+ }
+
+ template <class Cont, class Base, class Alloc>
+ bool operator<(const sequence_container_base<Cont,Base,Alloc> &left, const sequence_container_base<Cont,Base,Alloc> &right)
+ {
+ return std::lexicographical_compare(left.begin(), left.end(), right.begin(), right.end());
+ }
+ } // namespace detail
+
+ } // namespace cloneable
+
+} // namespace boost
+
+#include <boost/cloneable/detail/suffix.hpp>
+
+#endif // BOOST_CLONEABLE_DETAIL_SEQUENCE_CONTAINER_BASE_HPP
+
+//EOF
Modified: sandbox/cloneable/boost/cloneable/list.hpp
==============================================================================
--- sandbox/cloneable/boost/cloneable/list.hpp (original)
+++ sandbox/cloneable/boost/cloneable/list.hpp 2009-07-03 18:35:50 EDT (Fri, 03 Jul 2009)
@@ -9,10 +9,8 @@
#include <boost/ptr_container/ptr_list.hpp>
#include <boost/foreach.hpp>
-#include <boost/cloneable/detail/container_base.hpp>
-#include <boost/cloneable/base.hpp>
-#include <boost/cloneable/instance.hpp>
#include <boost/cloneable/detail/prefix.hpp>
+#include <boost/cloneable/detail/sequence_container_base.hpp>
namespace boost
{
@@ -38,16 +36,16 @@
, Base
, Alloc>
parent_type;
- typedef typename parent_type::base_type base_type;
- typedef typename parent_type::abstract_base_type abstract_base_type;
- typedef typename parent_type::allocator_type allocator_type;
+ using parent_type::base_type;
+ using parent_type::abstract_base_type;
+ using parent_type::allocator_type;
using parent_type::validate;
using parent_type::new_instance;
- typedef typename parent_type::value_type value_type;
- typedef typename parent_type::reference reference;
- typedef typename parent_type::const_reference const_reference;
- typedef typename parent_type::iterator iterator;
- typedef typename parent_type::const_iterator const_iterator;
+ using parent_type::value_type;
+ using parent_type::reference;
+ using parent_type::const_reference;
+ using parent_type::iterator;
+ using parent_type::const_iterator;
public:
list()
Modified: sandbox/cloneable/boost/cloneable/map.hpp
==============================================================================
--- sandbox/cloneable/boost/cloneable/map.hpp (original)
+++ sandbox/cloneable/boost/cloneable/map.hpp 2009-07-03 18:35:50 EDT (Fri, 03 Jul 2009)
@@ -10,7 +10,7 @@
#include <boost/foreach.hpp>
#include <boost/cloneable/detail/make_clone_allocator.hpp>
-#include <boost/cloneable/detail/container_base.hpp>
+#include <boost/cloneable/detail/associative_container_base.hpp>
namespace boost
{
@@ -20,51 +20,66 @@
// TODO: move to boost/heterogenous/map
template <class Base, class Pred, class Alloc>
struct map
- : detail::container_base<Base, Alloc>
+ : detail::associative_container_base<
+ ptr_map<
+ abstract_base<Base>
+ , abstract_base<Base>
+ , Pred
+ , allocator
+ , typename detail::make_clone_allocator<Alloc>::type>
+ , Pred
+ , Base
+ , Alloc>
{
- typedef detail::container_base<Base,Alloc> parent_type;
+ typedef detail::associative_container_base<
+ ptr_map<
+ abstract_base<Base>
+ , abstract_base<Base>
+ , Pred
+ , allocator
+ , typename detail::make_clone_allocator<Alloc>::type>
+ , Pred
+ , Base
+ , Alloc>
+ parent_type;
+
+ typedef typename parent_type::container_type container_type;
typedef typename parent_type::base_type base_type;
typedef typename parent_type::abstract_base_type abstract_base_type;
typedef typename parent_type::allocator_type allocator_type;
- using parent_type::validate;
- using parent_type::new_instance;
+ typedef typename parent_type::value_type value_type;
+ typedef typename parent_type::reference reference;
+ typedef typename parent_type::const_reference const_reference;
+ typedef typename parent_type::iterator iterator;
+ typedef typename parent_type::const_iterator const_iterator;
- typedef Pred predicate_type;
- typedef ptr_map<abstract_base_type, abstract_base_type, Pred, allocator, allocator_type> implementation;
+ using parent_type::new_instance;
+ using parent_type::validate;
- typedef typename implementation::value_type value_type;
- typedef typename implementation::reference reference;
- typedef typename implementation::const_reference const_reference;
- typedef typename implementation::iterator iterator;
- typedef typename implementation::const_iterator const_iterator;
- typedef typename implementation::key_type key_type;
- typedef typename implementation::mapped_type mapped_type;
+ typedef typename container_type::key_type key_type;
+ typedef typename container_type::mapped_type mapped_type;
typedef map<Base, Pred, Alloc> this_type;
- private:
- implementation impl;
-
public:
map()
- : impl(predicate_type(), get_allocator())
{
}
map(allocator_type &a)
- : parent_type(a), impl(predicate_type(), get_allocator())
+ : parent_type(a)
{
}
- template <class II>
- map(II F, II L)
- : impl(F,L, get_allocator())
- {
- }
- template <class II>
- map(II F, II L, allocator_type &a)
- : parent_type(a), impl(F,L, get_allocator())
- {
- }
+ //template <class II>
+ //map(II F, II L)
+ // : impl(F,L, get_allocator())
+ //{
+ //}
+ //template <class II>
+ //map(II F, II L, allocator_type &a)
+ // : parent_type(a), impl(F,L, get_allocator())
+ //{
+ //}
private:
typedef std::pair<iterator, bool> map_insert_result;
@@ -133,11 +148,11 @@
template <class A, class B>
map_insert_result insert(A a, B b)
{
- return map_insert_result();// impl.insert(std::make_pair(a, b));
+ return map_insert_result();// impl().insert(std::make_pair(a, b));
}
void insert(value_type x)
{
- impl.insert(x);
+ impl().insert(x);
}
public:
@@ -199,32 +214,6 @@
return fun;
}
- size_t size() const
- {
- return impl.size();
- }
- bool empty() const
- {
- return impl.empty();
- }
-
- iterator begin()
- {
- return impl.begin();
- }
- iterator end()
- {
- return impl.end();
- }
- const_iterator begin() const
- {
- return impl.begin();
- }
- const_iterator end() const
- {
- return impl.end();
- }
-
template <class K>
iterator find()
{
@@ -234,7 +223,7 @@
k.release();
}
BOOST_SCOPE_EXIT_END
- return impl.find(k.to_abstract());
+ return impl().find(k.to_abstract());
}
template <class K, class A0>
@@ -246,7 +235,7 @@
k.release();
}
BOOST_SCOPE_EXIT_END
- return impl.find(k.to_abstract());
+ return impl().find(k.to_abstract());
}
//reference operator[](key_type const &key)
Modified: sandbox/cloneable/boost/cloneable/set.hpp
==============================================================================
--- sandbox/cloneable/boost/cloneable/set.hpp (original)
+++ sandbox/cloneable/boost/cloneable/set.hpp 2009-07-03 18:35:50 EDT (Fri, 03 Jul 2009)
@@ -21,38 +21,52 @@
// TODO: move to boost/heterogenous/set.hpp, or boost/cloneable/containers/set.hpp
template <class Base, class Pred, class Alloc>
struct set
- : detail::container_base<Base, Alloc>
+ : detail::associative_container_base<
+ ptr_set<
+ abstract_base<Base>
+ , Pred
+ , allocator
+ , typename detail::make_clone_allocator<Alloc>::type>
+ , Pred
+ , Base
+ , Alloc>
{
- typedef detail::container_base<Base,Alloc> parent_type;
+ typedef detail::associative_container_base<
+ ptr_set<
+ abstract_base<Base>
+ , Pred
+ , allocator
+ , typename detail::make_clone_allocator<Alloc>::type>
+ , Pred
+ , Base
+ , Alloc>
+ parent_type;
+
+ typedef typename parent_type::container_type container_type;
typedef typename parent_type::base_type base_type;
typedef typename parent_type::abstract_base_type abstract_base_type;
typedef typename parent_type::allocator_type allocator_type;
- using parent_type::validate;
- using parent_type::new_instance;
+ typedef typename parent_type::value_type value_type;
+ typedef typename parent_type::reference reference;
+ typedef typename parent_type::const_reference const_reference;
+ typedef typename parent_type::iterator iterator;
+ typedef typename parent_type::const_iterator const_iterator;
- typedef Pred predicate_type;
- typedef ptr_set<abstract_base_type, predicate_type, allocator, allocator_type> implementation;
+ using parent_type::new_instance;
+ using parent_type::validate;
- typedef typename implementation::value_type value_type;
- typedef typename implementation::reference reference;
- typedef typename implementation::const_reference const_reference;
- typedef typename implementation::iterator iterator;
- typedef typename implementation::const_iterator const_iterator;
typedef set<Base, Pred, Alloc> this_type;
- private:
- implementation impl;
-
public:
set()
- : impl(predicate_type(), get_allocator())
{
}
set(allocator_type &a)
- : parent_type(a), impl(predicate_type(), get_allocator())
+ : parent_type(a)
{
}
+ /*
template <class II>
set(II F, II L)
: impl(F, L, get_allocator())
@@ -64,6 +78,7 @@
: parent_type(a), impl(F, L, get_allocator())
{
}
+ */
public:
typedef std::pair<iterator, bool> insert_result;
@@ -83,7 +98,7 @@
template <class U>
emplace_result<U> emplace(instance<U> value)
{
- insert_result result = impl.insert(value.to_abstract());
+ insert_result result = impl().insert(value.to_abstract());
if (!result.second)
value.release();
return emplace_result<U>(value, result);
@@ -120,33 +135,7 @@
}
}
- size_t size() const
- {
- return impl.size();
- }
- bool empty() const
- {
- return impl.empty();
- }
-
- iterator begin()
- {
- return impl.begin();
- }
- iterator end()
- {
- return impl.end();
- }
- const_iterator begin() const
- {
- return impl.begin();
- }
- const_iterator end() const
- {
- return impl.end();
- }
-
- struct impl
+ struct detail
{
template <class U>
struct find
@@ -190,12 +179,12 @@
template <class A0>
static iterator given(this_type *cont, A0 a0)
{
- return cont->impl.find(default_key(base_type(a0)));
+ return cont->impl().find(default_key(base_type(a0)));
}
template <class A0, class A1>
static iterator given(this_type *cont, A0 a0, A1 a1)
{
- return cont->impl.find(default_key(base_type(a0, a1)));
+ return cont->impl().find(default_key(base_type(a0, a1)));
}
};
};
@@ -204,19 +193,19 @@
{
if (!value.exists())
return end();
- iterator found = impl.find(*value.to_abstract());
- if (found == impl.end())
+ iterator found = impl().find(*value.to_abstract());
+ if (found == impl().end())
return found;
std::type_info const &found_type = found->get_type();
if (found_type == typeid(U))
return found;
- return impl.end();
+ return impl().end();
}
template <class U, class A0>
iterator find(A0 a0)
{
- return impl::find<U>::given(this, a0);
+ return detail::find<U>::given(this, a0);
}
};
Modified: sandbox/cloneable/boost/cloneable/vector.hpp
==============================================================================
--- sandbox/cloneable/boost/cloneable/vector.hpp (original)
+++ sandbox/cloneable/boost/cloneable/vector.hpp 2009-07-03 18:35:50 EDT (Fri, 03 Jul 2009)
@@ -10,8 +10,7 @@
#include <boost/foreach.hpp>
#include <boost/cloneable/detail/prefix.hpp>
-#include <boost/cloneable/detail/container_base.hpp>
-#include <boost/cloneable/base.hpp>
+#include <boost/cloneable/detail/sequence_container_base.hpp>
namespace boost
{
@@ -34,16 +33,16 @@
, Base
, Alloc>
parent_type;
- typedef typename parent_type::base_type base_type;
- typedef typename parent_type::abstract_base_type abstract_base_type;
- typedef typename parent_type::allocator_type allocator_type;
+ using parent_type::base_type;
+ using parent_type::abstract_base_type;
+ using parent_type::allocator_type;
using parent_type::validate;
using parent_type::new_instance;
- typedef typename parent_type::value_type value_type;
- typedef typename parent_type::reference reference;
- typedef typename parent_type::const_reference const_reference;
- typedef typename parent_type::iterator iterator;
- typedef typename parent_type::const_iterator const_iterator;
+ using parent_type::value_type;
+ using parent_type::reference;
+ using parent_type::const_reference;
+ using parent_type::iterator;
+ using parent_type::const_iterator;
public:
Modified: sandbox/cloneable/libs/cloneable/test/cloneable.vcproj
==============================================================================
--- sandbox/cloneable/libs/cloneable/test/cloneable.vcproj (original)
+++ sandbox/cloneable/libs/cloneable/test/cloneable.vcproj 2009-07-03 18:35:50 EDT (Fri, 03 Jul 2009)
@@ -335,9 +335,17 @@
Name="detail"
>
<File
+ RelativePath="..\..\..\boost\cloneable\detail\associative_container_base.hpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\boost\cloneable\detail\container_base.hpp"
>
</File>
+ <File
+ RelativePath="..\..\..\boost\cloneable\detail\sequence_container_base.hpp"
+ >
+ </File>
</Filter>
</Filter>
</Filter>
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