|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49652 - in sandbox/metagraph: boost/fusion/include boost/fusion/tuple boost/fusion/view/ext_ boost/intrusive boost/intrusive/detail libs/intrusive libs/intrusive/doc libs/intrusive/example libs/intrusive/proj/vc7ide libs/intrusive/proj/vc7ide/_intrusivelib libs/intrusive/proj/vc7ide/custom_bucket_traits libs/intrusive/proj/vc7ide/default_hook libs/intrusive/proj/vc7ide/external_value_traits libs/intrusive/proj/vc7ide/list libs/intrusive/proj/vc7ide/make_functions libs/intrusive/proj/vc7ide/multiset libs/intrusive/proj/vc7ide/perf_test libs/intrusive/proj/vc7ide/set libs/intrusive/proj/vc7ide/slist libs/intrusive/proj/vc7ide/stateful_value_traits libs/intrusive/proj/vc7ide/unordered_multiset libs/intrusive/proj/vc7ide/unordered_set libs/intrusive/proj/vc7ide/virtual_base libs/intrusive/test libs/metagraph/doc
From: gordon_at_[hidden]
Date: 2008-11-08 14:32:44
Author: gordon.woodhull
Date: 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
New Revision: 49652
URL: http://svn.boost.org/trac/boost/changeset/49652
Log:
merging intrusive/fusion changes from trunk
Added:
sandbox/metagraph/boost/intrusive/detail/workaround.hpp
- copied unchanged from r49651, /trunk/boost/intrusive/detail/workaround.hpp
sandbox/metagraph/libs/intrusive/CMakeLists.txt
- copied unchanged from r49651, /trunk/libs/intrusive/CMakeLists.txt
sandbox/metagraph/libs/intrusive/module.cmake
- copied unchanged from r49651, /trunk/libs/intrusive/module.cmake
sandbox/metagraph/libs/intrusive/proj/vc7ide/to-do.txt
- copied unchanged from r49651, /trunk/libs/intrusive/proj/vc7ide/to-do.txt
sandbox/metagraph/libs/metagraph/doc/
Properties modified:
sandbox/metagraph/libs/intrusive/proj/vc7ide/Intrusive.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj (contents, props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/custom_bucket_traits/custom_bucket_traits.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/default_hook/default_hook.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/external_value_traits/external_value_traits.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/list/list.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/make_functions/make_functions.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/multiset/multiset.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/perf_test/perf_test.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/set/set.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/slist/slist.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/stateful_value_traits/stateful_value_traits.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/unordered_multiset/unordered_multiset.vcproj (props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/unordered_set/unordered_set.vcproj (contents, props changed)
sandbox/metagraph/libs/intrusive/proj/vc7ide/virtual_base/virtual_base.vcproj (props changed)
Text files modified:
sandbox/metagraph/boost/fusion/include/end.hpp | 4
sandbox/metagraph/boost/fusion/tuple/tuple.hpp | 2
sandbox/metagraph/boost/fusion/view/ext_/segmented_iterator.hpp | 13
sandbox/metagraph/boost/intrusive/any_hook.hpp | 46 +
sandbox/metagraph/boost/intrusive/avl_set.hpp | 114 +++-
sandbox/metagraph/boost/intrusive/avl_set_hook.hpp | 42 +
sandbox/metagraph/boost/intrusive/avltree.hpp | 98 ++-
sandbox/metagraph/boost/intrusive/avltree_algorithms.hpp | 16
sandbox/metagraph/boost/intrusive/bs_set_hook.hpp | 62 +-
sandbox/metagraph/boost/intrusive/circular_slist_algorithms.hpp | 4
sandbox/metagraph/boost/intrusive/detail/assert.hpp | 18
sandbox/metagraph/boost/intrusive/detail/list_node.hpp | 3
sandbox/metagraph/boost/intrusive/detail/mpl.hpp | 172 ++++--
sandbox/metagraph/boost/intrusive/detail/slist_node.hpp | 3
sandbox/metagraph/boost/intrusive/detail/tree_algorithms.hpp | 4
sandbox/metagraph/boost/intrusive/hashtable.hpp | 892 ++++++++++++++++++++++++++-------------
sandbox/metagraph/boost/intrusive/intrusive_fwd.hpp | 152 ++++++
sandbox/metagraph/boost/intrusive/linear_slist_algorithms.hpp | 4
sandbox/metagraph/boost/intrusive/list.hpp | 146 +++---
sandbox/metagraph/boost/intrusive/list_hook.hpp | 44 +
sandbox/metagraph/boost/intrusive/options.hpp | 214 ++++++++
sandbox/metagraph/boost/intrusive/pointer_plus_bits.hpp | 7
sandbox/metagraph/boost/intrusive/rbtree.hpp | 106 ++--
sandbox/metagraph/boost/intrusive/set.hpp | 116 +++-
sandbox/metagraph/boost/intrusive/set_hook.hpp | 44 +
sandbox/metagraph/boost/intrusive/sg_set.hpp | 116 +++-
sandbox/metagraph/boost/intrusive/sgtree.hpp | 98 ++-
sandbox/metagraph/boost/intrusive/sgtree_algorithms.hpp | 2
sandbox/metagraph/boost/intrusive/slist.hpp | 212 ++++----
sandbox/metagraph/boost/intrusive/slist_hook.hpp | 44 +
sandbox/metagraph/boost/intrusive/splay_set.hpp | 115 +++-
sandbox/metagraph/boost/intrusive/splay_set_hook.hpp | 44 +
sandbox/metagraph/boost/intrusive/splaytree.hpp | 109 ++--
sandbox/metagraph/boost/intrusive/splaytree_algorithms.hpp | 2
sandbox/metagraph/boost/intrusive/unordered_set.hpp | 154 ++++++
sandbox/metagraph/boost/intrusive/unordered_set_hook.hpp | 44 +
sandbox/metagraph/libs/intrusive/doc/intrusive.qbk | 52 +
sandbox/metagraph/libs/intrusive/example/doc_window.cpp | 2
sandbox/metagraph/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj | 3
sandbox/metagraph/libs/intrusive/proj/vc7ide/unordered_set/unordered_set.vcproj | 5
sandbox/metagraph/libs/intrusive/test/default_hook_test.cpp | 37 +
sandbox/metagraph/libs/intrusive/test/list_test.cpp | 310 +++++++++++++
sandbox/metagraph/libs/intrusive/test/set_test.cpp | 1
sandbox/metagraph/libs/intrusive/test/sg_multiset_test.cpp | 12
sandbox/metagraph/libs/intrusive/test/sg_set_test.cpp | 12
sandbox/metagraph/libs/intrusive/test/splay_multiset_test.cpp | 37 +
sandbox/metagraph/libs/intrusive/test/splay_set_test.cpp | 36 +
sandbox/metagraph/libs/intrusive/test/test_macros.hpp | 5
sandbox/metagraph/libs/intrusive/test/unordered_multiset_test.cpp | 390 +++++++++++++---
sandbox/metagraph/libs/intrusive/test/unordered_set_test.cpp | 297 ++++++++++--
50 files changed, 3266 insertions(+), 1199 deletions(-)
Modified: sandbox/metagraph/boost/fusion/include/end.hpp
==============================================================================
--- sandbox/metagraph/boost/fusion/include/end.hpp (original)
+++ sandbox/metagraph/boost/fusion/include/end.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -4,8 +4,8 @@
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)
==============================================================================*/
-#if !defined(FUSION_INCLUDE_BEGIN)
-#define FUSION_INCLUDE_BEGIN
+#if !defined(FUSION_INCLUDE_END)
+#define FUSION_INCLUDE_END
#include <boost/fusion/sequence/intrinsic/end.hpp>
Modified: sandbox/metagraph/boost/fusion/tuple/tuple.hpp
==============================================================================
--- sandbox/metagraph/boost/fusion/tuple/tuple.hpp (original)
+++ sandbox/metagraph/boost/fusion/tuple/tuple.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -16,7 +16,7 @@
#include <boost/fusion/sequence/io.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_const.hpp>
-#include <utility>
+#include <boost/config/no_tr1/utility.hpp>
namespace boost { namespace fusion
{
Modified: sandbox/metagraph/boost/fusion/view/ext_/segmented_iterator.hpp
==============================================================================
--- sandbox/metagraph/boost/fusion/view/ext_/segmented_iterator.hpp (original)
+++ sandbox/metagraph/boost/fusion/view/ext_/segmented_iterator.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -47,6 +47,15 @@
: is_empty<Sequence>
{};
+ ////////////////////////////////////////////////////////////////////////////
+ struct not_is_empty_pred
+ {
+ template<typename Sequence>
+ struct apply
+ : not_<is_empty<Sequence> >
+ {};
+ };
+
struct segmented_range_tag;
////////////////////////////////////////////////////////////////////////////
@@ -64,7 +73,7 @@
// If this is a range of segments, skip over the empty ones
typedef typename mpl::if_<
is_segmented
- , filter_view<Sequence, not_<is_empty<_> > >
+ , filter_view<Sequence, not_is_empty_pred>
, Sequence
>::type sequence_non_ref_type;
@@ -196,7 +205,7 @@
{
typedef typename result_of::segments<Sequence>::type segments;
typedef typename remove_reference<segments>::type sequence;
- typedef typename result_of::begin<filter_view<sequence, not_<is_empty<_> > > >::type begin;
+ typedef typename result_of::begin<filter_view<sequence, not_is_empty_pred> >::type begin;
typedef segmented_range<sequence, begin, true> type;
static type call(Sequence &seq)
Modified: sandbox/metagraph/boost/intrusive/any_hook.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/any_hook.hpp (original)
+++ sandbox/metagraph/boost/intrusive/any_hook.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -34,7 +34,7 @@
//! Helper metafunction to define a \c \c any_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none>
@@ -43,8 +43,14 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3>::type packed_options;
-
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type packed_options;
+
typedef detail::generic_hook
< get_any_node_algo<typename packed_options::void_pointer>
, typename packed_options::tag
@@ -70,15 +76,21 @@
//!
//! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this hook.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3>
#endif
class any_base_hook
- : public make_any_base_hook<O1, O2, O3>::type
+ : public make_any_base_hook
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <O1, O2, O3>
+ #else
+ <Options...>
+ #endif
+ ::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
public:
//! <b>Effects</b>: If link_mode is or \c safe_link
//! initializes the node to an unlinked state.
@@ -127,7 +139,7 @@
//! Helper metafunction to define a \c \c any_member_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none>
@@ -136,7 +148,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3>::type packed_options;
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef detail::generic_hook
< get_any_node_algo<typename packed_options::void_pointer>
@@ -158,15 +176,21 @@
//!
//! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this hook.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3>
#endif
class any_member_hook
- : public make_any_member_hook<O1, O2, O3>::type
+ : public make_any_member_hook
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <O1, O2, O3>
+ #else
+ <Options...>
+ #endif
+ ::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
public:
//! <b>Effects</b>: If link_mode is or \c safe_link
//! initializes the node to an unlinked state.
Modified: sandbox/metagraph/boost/intrusive/avl_set.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/avl_set.hpp (original)
+++ sandbox/metagraph/boost/intrusive/avl_set.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -31,7 +31,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -323,18 +323,19 @@
{ tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const avl_set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
@@ -996,65 +997,65 @@
/// @endcond
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y)
#else
(const avl_set_impl<Config> &x, const avl_set_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y)
#else
(const avl_set_impl<Config> &x, const avl_set_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y)
#else
(const avl_set_impl<Config> &x, const avl_set_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y)
#else
(const avl_set_impl<Config> &x, const avl_set_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(avl_set_impl<T, Options...> &x, avl_set_impl<T, Options...> &y)
#else
(avl_set_impl<Config> &x, avl_set_impl<Config> &y)
@@ -1063,7 +1064,7 @@
//! Helper metafunction to define a \c avl_set that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -1073,19 +1074,41 @@
{
/// @cond
typedef avl_set_impl
- < typename make_avltree_opt<T, O1, O2, O3, O4>::type
+ < typename make_avltree_opt
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <T, O1, O2, O3, O4>
+ #else
+ <T, Options...>
+ #endif
+ ::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class avl_set
- : public make_avl_set<T, O1, O2, O3, O4>::type
+ : public make_avl_set
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <T, O1, O2, O3, O4>
+ #else
+ <T, Options...>
+ #endif
+ ::type
{
typedef typename make_avl_set
- <T, O1, O2, O3, O4>::type Base;
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <T, O1, O2, O3, O4>
+ #else
+ <T, Options...>
+ #endif
+ ::type Base;
public:
typedef typename Base::value_compare value_compare;
@@ -1134,7 +1157,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -1422,18 +1445,19 @@
{ tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws. Basic guarantee.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const avl_multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
@@ -2002,65 +2026,65 @@
/// @endcond
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y)
#else
(const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y)
#else
(const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y)
#else
(const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y)
#else
(const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(avl_multiset_impl<T, Options...> &x, avl_multiset_impl<T, Options...> &y)
#else
(avl_multiset_impl<Config> &x, avl_multiset_impl<Config> &y)
@@ -2069,7 +2093,7 @@
//! Helper metafunction to define a \c avl_multiset that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -2079,19 +2103,41 @@
{
/// @cond
typedef avl_multiset_impl
- < typename make_avltree_opt<T, O1, O2, O3, O4>::type
+ < typename make_avltree_opt
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <T, O1, O2, O3, O4>
+ #else
+ <T, Options...>
+ #endif
+ ::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class avl_multiset
- : public make_avl_multiset<T, O1, O2, O3, O4>::type
+ : public make_avl_multiset<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_avl_multiset
- <T, O1, O2, O3, O4>::type Base;
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <T, O1, O2, O3, O4>
+ #else
+ <T, Options...>
+ #endif
+ ::type Base;
public:
typedef typename Base::value_compare value_compare;
Modified: sandbox/metagraph/boost/intrusive/avl_set_hook.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/avl_set_hook.hpp (original)
+++ sandbox/metagraph/boost/intrusive/avl_set_hook.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -34,7 +34,7 @@
//! Helper metafunction to define a \c avl_set_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -43,7 +43,12 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3, O4>::type packed_options;
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <hook_defaults, O1, O2, O3, O4>
+ #else
+ <hook_defaults, Options...>
+ #endif
+ ::type packed_options;
typedef detail::generic_hook
< get_avl_set_node_algo<typename packed_options::void_pointer
@@ -76,15 +81,21 @@
//!
//! \c optimize_size<> will tell the hook to optimize the hook for size instead
//! of speed.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3, class O4>
#endif
class avl_set_base_hook
- : public make_avl_set_base_hook<O1, O2, O3, O4>::type
+ : public make_avl_set_base_hook
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <O1, O2, O3, O4>
+ #else
+ <Options...>
+ #endif
+ ::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
@@ -153,7 +164,7 @@
//! Helper metafunction to define a \c avl_set_member_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -162,7 +173,12 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3, O4>::type packed_options;
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <hook_defaults, O1, O2, O3, O4>
+ #else
+ <hook_defaults, Options...>
+ #endif
+ ::type packed_options;
typedef detail::generic_hook
< get_avl_set_node_algo<typename packed_options::void_pointer
@@ -190,15 +206,21 @@
//!
//! \c optimize_size<> will tell the hook to optimize the hook for size instead
//! of speed.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3, class O4>
#endif
class avl_set_member_hook
- : public make_avl_set_member_hook<O1, O2, O3, O4>::type
+ : public make_avl_set_member_hook
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <O1, O2, O3, O4>
+ #else
+ <Options...>
+ #endif
+ ::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
Modified: sandbox/metagraph/boost/intrusive/avltree.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/avltree.hpp (original)
+++ sandbox/metagraph/boost/intrusive/avltree.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -36,20 +36,6 @@
/// @cond
-template <class T>
-struct internal_default_avl_set_hook
-{
- template <class U> static detail::one test(...);
- template <class U> static detail::two test(typename U::default_avl_set_hook* = 0);
- static const bool value = sizeof(test<T>(0)) == sizeof(detail::two);
-};
-
-template <class T>
-struct get_default_avl_set_hook
-{
- typedef typename T::default_avl_set_hook type;
-};
-
template <class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize>
struct avl_setopt
{
@@ -63,13 +49,7 @@
struct avl_set_defaults
: pack_options
< none
- , base_hook
- < typename detail::eval_if_c
- < internal_default_avl_set_hook<T>::value
- , get_default_avl_set_hook<T>
- , detail::identity<none>
- >::type
- >
+ , base_hook<detail::default_avl_set_hook>
, constant_time_size<true>
, size_type<std::size_t>
, compare<std::less<T> >
@@ -91,7 +71,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -1055,29 +1035,34 @@
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const avltree_impl &src, Cloner cloner, Disposer disposer)
{
this->clear_and_dispose(disposer);
if(!src.empty()){
+ detail::exception_disposer<avltree_impl, Disposer>
+ rollback(*this, disposer);
node_algorithms::clone
(const_node_ptr(&src.priv_header())
,node_ptr(&this->priv_header())
,detail::node_cloner<Cloner, avltree_impl>(cloner, this)
,detail::node_disposer<Disposer, avltree_impl>(disposer, this));
this->priv_size_traits().set_size(src.priv_size_traits().get_size());
+ this->priv_comp() = src.priv_comp();
+ rollback.release();
}
}
@@ -1260,26 +1245,26 @@
{ return priv_container_from_end_iterator(it.end_iterator_from_it()); }
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y)
#endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
bool operator==
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y)
@@ -1311,65 +1296,65 @@
}
}
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(avltree_impl<T, Options...> &x, avltree_impl<T, Options...> &y)
#else
(avltree_impl<Config> &x, avltree_impl<Config> &y)
@@ -1377,15 +1362,24 @@
{ x.swap(y); }
/// @cond
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1 = none, class O2 = none
, class O3 = none, class O4 = none
- , class O5 = none, class O6 = none
- , class O7 = none
>
+#else
+template<class T, class ...Options>
+#endif
struct make_avltree_opt
{
typedef typename pack_options
- < avl_set_defaults<T>, O1, O2, O3, O4>::type packed_options;
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ < avl_set_defaults<T>, O1, O2, O3, O4>
+ #else
+ < avl_set_defaults<T>, Options...>
+ #endif
+ ::type packed_options;
+
typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits;
@@ -1400,7 +1394,7 @@
//! Helper metafunction to define a \c avltree that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -1410,19 +1404,37 @@
{
/// @cond
typedef avltree_impl
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
< typename make_avltree_opt<T, O1, O2, O3, O4>::type
+ #else
+ < typename make_avltree_opt<T, Options...>::type
+ #endif
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class avltree
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
: public make_avltree<T, O1, O2, O3, O4>::type
+ #else
+ : public make_avltree<T, Options...>::type
+ #endif
{
typedef typename make_avltree
- <T, O1, O2, O3, O4>::type Base;
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <T, O1, O2, O3, O4>
+ #else
+ <T, Options...>
+ #endif
+ ::type Base;
public:
typedef typename Base::value_compare value_compare;
Modified: sandbox/metagraph/boost/intrusive/avltree_algorithms.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/avltree_algorithms.hpp (original)
+++ sandbox/metagraph/boost/intrusive/avltree_algorithms.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -682,10 +682,10 @@
// x is right child
// a is left child
node_ptr a = NodeTraits::get_left(x_parent);
- assert(a);
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(a);
if (NodeTraits::get_balance(a) == NodeTraits::positive()) {
// a MUST have a right child
- assert(NodeTraits::get_right(a));
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(NodeTraits::get_right(a));
rotate_left_right(x_parent, root);
x = NodeTraits::get_parent(x_parent);
@@ -714,10 +714,10 @@
// x is left child
// a is right child
node_ptr a = NodeTraits::get_right(x_parent);
- assert(a);
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(a);
if (NodeTraits::get_balance(a) == NodeTraits::negative()) {
// a MUST have then a left child
- assert(NodeTraits::get_left(a));
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(NodeTraits::get_left(a));
rotate_right_left(x_parent, root);
x = NodeTraits::get_parent(x_parent);
@@ -735,7 +735,7 @@
}
}
else{
- assert(false); // never reached
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(false); // never reached
}
}
NodeTraits::set_parent(header, root);
@@ -784,7 +784,7 @@
break;
}
else{
- assert(false); // never reached
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(false); // never reached
}
}
NodeTraits::set_parent(header, root);
@@ -842,7 +842,7 @@
NodeTraits::set_balance(b, NodeTraits::negative());
}
else{
- assert(false); // never reached
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(false); // never reached
}
NodeTraits::set_balance(c, NodeTraits::zero());
}
@@ -899,7 +899,7 @@
NodeTraits::set_balance(b, NodeTraits::zero());
}
else{
- assert(false);
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(false);
}
NodeTraits::set_balance(c, NodeTraits::zero());
}
Modified: sandbox/metagraph/boost/intrusive/bs_set_hook.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/bs_set_hook.hpp (original)
+++ sandbox/metagraph/boost/intrusive/bs_set_hook.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -34,7 +34,7 @@
//! Helper metafunction to define a \c bs_set_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none>
@@ -43,7 +43,12 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3>::type packed_options;
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ < hook_defaults, O1, O2, O3>
+ #else
+ < hook_defaults, Options...>
+ #endif
+ ::type packed_options;
//Scapegoat trees can't be auto unlink trees
BOOST_STATIC_ASSERT(((int)packed_options::link_mode != (int)auto_unlink));
@@ -75,15 +80,22 @@
//!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_link).
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3>
#endif
class bs_set_base_hook
- : public make_bs_set_base_hook<O1, O2, O3>::type
+ : public make_bs_set_base_hook
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <O1, O2, O3>
+ #else
+ <Options...>
+ #endif
+ ::type
+
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
@@ -152,7 +164,7 @@
//! Helper metafunction to define a \c bs_set_member_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none>
@@ -161,7 +173,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3>::type packed_options;
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ < hook_defaults, O1, O2, O3>
+ #else
+ < hook_defaults, Options...>
+ #endif
+
+ ::type packed_options;
//Scapegoat trees can't be auto unlink trees
BOOST_STATIC_ASSERT(((int)packed_options::link_mode != (int)auto_unlink));
@@ -187,15 +205,21 @@
//!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_link).
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3>
#endif
class bs_set_member_hook
- : public make_bs_set_member_hook<O1, O2, O3>::type
+ : public make_bs_set_member_hook
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <O1, O2, O3>
+ #else
+ <Options...>
+ #endif
+ ::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
@@ -262,24 +286,6 @@
#endif
};
-/// @cond
-
-template <class T>
-struct internal_default_bs_set_hook
-{
- template <class U> static detail::one test(...);
- template <class U> static detail::two test(typename U::default_bs_set_hook* = 0);
- static const bool value = sizeof(test<T>(0)) == sizeof(detail::two);
-};
-
-template <class T>
-struct get_default_bs_set_hook
-{
- typedef typename T::default_bs_set_hook type;
-};
-
-/// @endcond
-
} //namespace intrusive
} //namespace boost
Modified: sandbox/metagraph/boost/intrusive/circular_slist_algorithms.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/circular_slist_algorithms.hpp (original)
+++ sandbox/metagraph/boost/intrusive/circular_slist_algorithms.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -59,7 +59,7 @@
typedef typename NodeTraits::const_node_ptr const_node_ptr;
typedef NodeTraits node_traits;
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: Constructs an non-used list element, putting the next
//! pointer to null:
@@ -128,7 +128,7 @@
//! <b>Throws</b>: Nothing.
static void transfer_after(node_ptr p, node_ptr b, node_ptr e);
- #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: Constructs an empty list, making this_node the only
//! node of the circular list:
Modified: sandbox/metagraph/boost/intrusive/detail/assert.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/detail/assert.hpp (original)
+++ sandbox/metagraph/boost/intrusive/detail/assert.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -18,18 +18,24 @@
#endif
#if !defined(BOOST_INTRUSIVE_INVARIANT_ASSERT)
-#include <boost/assert.hpp>
-#define BOOST_INTRUSIVE_INVARIANT_ASSERT BOOST_ASSERT
+ #include <boost/assert.hpp>
+ #define BOOST_INTRUSIVE_INVARIANT_ASSERT BOOST_ASSERT
+#elif defined(BOOST_INTRUSIVE_INVARIANT_ASSERT_INCLUDE)
+ #include BOOST_INTRUSIVE_INVARIANT_ASSERT_INCLUDE
#endif
#if !defined(BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT)
-#include <boost/assert.hpp>
-#define BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT BOOST_ASSERT
+ #include <boost/assert.hpp>
+ #define BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT BOOST_ASSERT
+#elif defined(BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT_INCLUDE)
+ #include BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT_INCLUDE
#endif
#if !defined(BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT)
-#include <boost/assert.hpp>
-#define BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT BOOST_ASSERT
+ #include <boost/assert.hpp>
+ #define BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT BOOST_ASSERT
+#elif defined(BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT_INCLUDE)
+ #include BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT_INCLUDE
#endif
#endif //BOOST_INTRUSIVE_DETAIL_ASSERT_HPP
Modified: sandbox/metagraph/boost/intrusive/detail/list_node.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/detail/list_node.hpp (original)
+++ sandbox/metagraph/boost/intrusive/detail/list_node.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -161,6 +161,9 @@
return 0;
}
+ list_iterator<Container, false> unconst() const
+ { return list_iterator<Container, false>(this->pointed_node(), this->get_container()); }
+
private:
struct members
: public detail::select_constptr
Modified: sandbox/metagraph/boost/intrusive/detail/mpl.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/detail/mpl.hpp (original)
+++ sandbox/metagraph/boost/intrusive/detail/mpl.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -51,6 +51,12 @@
template <class Cond, class T = void>
struct enable_if : public enable_if_c<Cond::value, T>{};
+template<class F, class Param>
+struct apply
+{
+ typedef typename F::template apply<Param>::type type;
+};
+
template <class T, class U>
class is_convertible
{
@@ -127,83 +133,127 @@
#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
#endif
-no_type BOOST_INTRUSIVE_TT_DECL is_function_ptr_tester(...);
-
-template <class R >
-yes_type is_function_ptr_tester(R (*)());
-
-template <class R >
-yes_type is_function_ptr_tester(R (*)( ...));
+template <typename T>
+struct is_unary_or_binary_function_impl
+{ static const bool value = false; };
+template <typename R>
+struct is_unary_or_binary_function_impl<R (*)()>
+{ static const bool value = true; };
+
+template <typename R>
+struct is_unary_or_binary_function_impl<R (*)(...)>
+{ static const bool value = true; };
+/*
#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
-template <class R >
-yes_type is_function_ptr_tester(R (__stdcall*)());
-template <class R >
-yes_type is_function_ptr_tester(R (__stdcall*)( ...));
-
-template <class R >
-yes_type is_function_ptr_tester(R (__fastcall*)());
-template <class R >
-yes_type is_function_ptr_tester(R (__fastcall*)( ...));
-
-template <class R >
-yes_type is_function_ptr_tester(R (__cdecl*)());
-template <class R >
-yes_type is_function_ptr_tester(R (__cdecl*)( ...));
-#endif
-
-template <class R , class T0 >
-yes_type is_function_ptr_tester(R (*)( T0));
-template <class R , class T0 >
-yes_type is_function_ptr_tester(R (*)( T0 ...));
+template <typename R>
+struct is_unary_or_binary_function_impl<R (__stdcall*)()>
+{ static const bool value = true; };
+
+template <typename R>
+struct is_unary_or_binary_function_impl<R (__stdcall*)(...)>
+{ static const bool value = true; };
+
+template <typename R>
+struct is_unary_or_binary_function_impl<R (__stdcall*)(...)>
+{ static const bool value = true; };
+
+template <typename R>
+struct is_unary_or_binary_function_impl<R (__fastcall*)()>
+{ static const bool value = true; };
+
+template <typename R>
+struct is_unary_or_binary_function_impl<R (__fastcall*)(...)>
+{ static const bool value = true; };
+
+template <typename R>
+struct is_unary_or_binary_function_impl<R (__cdecl*)()>
+{ static const bool value = true; };
+
+template <typename R>
+struct is_unary_or_binary_function_impl<R (__cdecl*)(...)>
+{ static const bool value = true; };
+#endif
+*/
+template <typename R, class T0>
+struct is_unary_or_binary_function_impl<R (*)(T0)>
+{ static const bool value = true; };
+
+template <typename R, class T0>
+struct is_unary_or_binary_function_impl<R (*)(T0...)>
+{ static const bool value = true; };
#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
-template <class R , class T0 >
-yes_type is_function_ptr_tester(R (__stdcall*)( T0));
-template <class R , class T0 >
-yes_type is_function_ptr_tester(R (__stdcall*)( T0 ...));
-
-template <class R , class T0 >
-yes_type is_function_ptr_tester(R (__fastcall*)( T0));
-template <class R , class T0 >
-yes_type is_function_ptr_tester(R (__fastcall*)( T0 ...));
-template <class R , class T0 >
-yes_type is_function_ptr_tester(R (__cdecl*)( T0));
+template <typename R, class T0>
+struct is_unary_or_binary_function_impl<R (__stdcall*)(T0)>
+{ static const bool value = true; };
+/*
+template <typename R, class T0>
+struct is_unary_or_binary_function_impl<R (__stdcall*)(T0...)>
+{ static const bool value = true; };
+
+template <typename R, class T0>
+struct is_unary_or_binary_function_impl<R (__fastcall*)(T0)>
+{ static const bool value = true; };
+
+template <typename R, class T0>
+struct is_unary_or_binary_function_impl<R (__fastcall*)(T0...)>
+{ static const bool value = true; };
+
+template <typename R, class T0>
+struct is_unary_or_binary_function_impl<R (__cdecl*)(T0)>
+{ static const bool value = true; };
+
+template <typename R, class T0>
+struct is_unary_or_binary_function_impl<R (__cdecl*)(T0...)>
+{ static const bool value = true; };
+*/
#endif
-template <class R , class T0 , class T1 >
-yes_type is_function_ptr_tester(R (*)( T0 , T1));
+template <typename R, class T0, class T1>
+struct is_unary_or_binary_function_impl<R (*)(T0, T1)>
+{ static const bool value = true; };
+
+template <typename R, class T0, class T1>
+struct is_unary_or_binary_function_impl<R (*)(T0, T1...)>
+{ static const bool value = true; };
+/*
#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
-template <class R , class T0 , class T1 >
-yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1));
-
-template <class R , class T0 , class T1 >
-yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1));
-template <class R , class T0 , class T1 >
-yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1));
+template <typename R, class T0, class T1>
+struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)>
+{ static const bool value = true; };
+
+template <typename R, class T0, class T1>
+struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1...)>
+{ static const bool value = true; };
+
+template <typename R, class T0, class T1>
+struct is_unary_or_binary_function_impl<R (__fastcall*)(T0, T1)>
+{ static const bool value = true; };
+
+template <typename R, class T0, class T1>
+struct is_unary_or_binary_function_impl<R (__fastcall*)(T0, T1...)>
+{ static const bool value = true; };
+
+template <typename R, class T0, class T1>
+struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1)>
+{ static const bool value = true; };
+
+template <typename R, class T0, class T1>
+struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1...)>
+{ static const bool value = true; };
#endif
-
-template <typename T>
-struct is_unary_or_binary_function_impl
-{
- static T* t;
- static const bool value = sizeof(is_function_ptr_tester(t)) == sizeof(yes_type);
-};
-
+*/
template <typename T>
struct is_unary_or_binary_function_impl<T&>
-{
- static const bool value = false;
-};
+{ static const bool value = false; };
template<typename T>
struct is_unary_or_binary_function
-{
- static const bool value = is_unary_or_binary_function_impl<T>::value;
-};
+{ static const bool value = is_unary_or_binary_function_impl<T>::value; };
//boost::alignment_of yields to 10K lines of preprocessed code, so we
//need an alternative
Modified: sandbox/metagraph/boost/intrusive/detail/slist_node.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/detail/slist_node.hpp (original)
+++ sandbox/metagraph/boost/intrusive/detail/slist_node.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -128,6 +128,9 @@
return 0;
}
+ slist_iterator<Container, false> unconst() const
+ { return slist_iterator<Container, false>(this->pointed_node(), this->get_container()); }
+
const real_value_traits *get_real_value_traits() const
{
if(store_container_ptr)
Modified: sandbox/metagraph/boost/intrusive/detail/tree_algorithms.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/detail/tree_algorithms.hpp (original)
+++ sandbox/metagraph/boost/intrusive/detail/tree_algorithms.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -1391,14 +1391,14 @@
//Taken from:
//"Tree rebalancing in optimal time and space"
//Quentin F. Stout and Bette L. Warren
- std::size_t len;
+ std::size_t len = 0;
subtree_to_vine(NodeTraits::get_parent(header), &len);
vine_to_subtree(NodeTraits::get_parent(header), len);
}
static node_ptr rebalance_subtree(node_ptr old_root)
{
- std::size_t len;
+ std::size_t len = 0;
node_ptr new_root = subtree_to_vine(old_root, &len);
return vine_to_subtree(new_root, len);
}
Modified: sandbox/metagraph/boost/intrusive/hashtable.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/hashtable.hpp (original)
+++ sandbox/metagraph/boost/intrusive/hashtable.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -43,6 +43,50 @@
namespace detail {
+struct hash_bool_flags
+{
+ static const std::size_t unique_keys_pos = 1u;
+ static const std::size_t constant_time_size_pos = 2u;
+ static const std::size_t power_2_buckets_pos = 4u;
+ static const std::size_t cache_begin_pos = 8u;
+ static const std::size_t compare_hash_pos = 16u;
+ static const std::size_t incremental_pos = 32u;
+};
+
+template
+ < class ValueTraits
+ , class Hash
+ , class Equal
+ , class SizeType
+ , class BucketTraits
+ , std::size_t BoolFlags
+ >
+struct usetopt
+{
+ typedef ValueTraits value_traits;
+ typedef Hash hash;
+ typedef Equal equal;
+ typedef SizeType size_type;
+ typedef BucketTraits bucket_traits;
+ static const std::size_t bool_flags = BoolFlags;
+};
+
+template
+ < class UsetOpt
+ , std::size_t BoolMask
+ >
+struct usetopt_mask
+{
+ typedef usetopt
+ <typename UsetOpt::value_traits
+ ,typename UsetOpt::hash
+ ,typename UsetOpt::equal
+ ,typename UsetOpt::size_type
+ ,typename UsetOpt::bucket_traits
+ ,UsetOpt::bool_flags & BoolMask
+ > type;
+};
+
template <class NodeTraits>
struct hash_reduced_slist_node_traits
{
@@ -109,7 +153,6 @@
>::type type;
};
-
template<class SupposedValueTraits>
struct unordered_bucket_impl
{
@@ -173,11 +216,11 @@
template<class Config>
struct bucket_plus_size
: public detail::size_holder
- < Config::constant_time_size
+ < 0 != (Config::bool_flags & hash_bool_flags::constant_time_size_pos)
, typename Config::size_type>
{
typedef detail::size_holder
- < Config::constant_time_size
+ < 0 != (Config::bool_flags & hash_bool_flags::constant_time_size_pos)
, typename Config::size_type> size_traits;
typedef typename Config::bucket_traits bucket_traits;
@@ -188,11 +231,12 @@
};
template<class Config>
-struct bucket_hash_t : public detail::ebo_functor_holder<typename Config::hash>
+struct bucket_hash_t
+ : public detail::ebo_functor_holder<typename Config::hash>
{
typedef typename Config::hash hasher;
typedef detail::size_holder
- < Config::constant_time_size
+ < 0 != (Config::bool_flags & hash_bool_flags::constant_time_size_pos)
, typename Config::size_type> size_traits;
typedef typename Config::bucket_traits bucket_traits;
@@ -236,6 +280,7 @@
template<class Config>
struct hashtable_data_t : public Config::value_traits
{
+ static const std::size_t bool_flags = Config::bool_flags;
typedef typename Config::value_traits value_traits;
typedef typename Config::equal equal;
typedef typename Config::hash hasher;
@@ -243,9 +288,27 @@
hashtable_data_t( const bucket_traits &b_traits, const hasher & h
, const equal &e, const value_traits &val_traits)
- : Config::value_traits(val_traits), bucket_hash_equal_(b_traits, h, e)
+ : Config::value_traits(val_traits), internal_(b_traits, h, e)
{}
- bucket_hash_equal_t<Config, Config::cache_begin> bucket_hash_equal_;
+ typedef typename detail::usetopt_mask
+ < Config
+ , detail::hash_bool_flags::constant_time_size_pos
+ | detail::hash_bool_flags::incremental_pos
+ >::type masked_config_t;
+ struct internal
+ : public detail::size_holder
+ < 0 != (Config::bool_flags & hash_bool_flags::incremental_pos)
+ , typename Config::size_type>
+ {
+ internal(const bucket_traits &b_traits, const hasher & h, const equal &e)
+ : bucket_hash_equal_(b_traits, h, e)
+ {}
+
+ bucket_hash_equal_t
+ < masked_config_t
+ , 0 != (bool_flags & hash_bool_flags::cache_begin_pos)
+ > bucket_hash_equal_;
+ } internal_;
};
struct insert_commit_data_impl
@@ -253,12 +316,154 @@
std::size_t hash;
};
-template <class T>
-struct internal_default_uset_hook
+template<class NodeTraits>
+struct group_functions
{
- template <class U> static detail::one test(...);
- template <class U> static detail::two test(typename U::default_uset_hook* = 0);
- static const bool value = sizeof(test<T>(0)) == sizeof(detail::two);
+ typedef NodeTraits node_traits;
+ typedef unordered_group_adapter<node_traits> group_traits;
+ typedef typename node_traits::node_ptr node_ptr;
+ typedef typename node_traits::node node;
+ typedef typename reduced_slist_node_traits
+ <node_traits>::type reduced_node_traits;
+ typedef typename reduced_node_traits::node_ptr slist_node_ptr;
+ typedef typename reduced_node_traits::node slist_node;
+ typedef circular_slist_algorithms<group_traits> group_algorithms;
+
+ static node_ptr dcast_bucket_ptr(slist_node_ptr p)
+ { return node_ptr(&static_cast<node&>(*p)); }
+
+ static slist_node_ptr priv_get_bucket_before_begin
+ (slist_node_ptr bucket_beg, slist_node_ptr bucket_end, node_ptr p)
+ {
+ //First find the last node of p's group.
+ //This requires checking the first node of the next group or
+ //the bucket node.
+ node_ptr prev_node = p;
+ node_ptr nxt(node_traits::get_next(p));
+ while(!(bucket_beg <= nxt && nxt <= bucket_end) &&
+ (group_traits::get_next(nxt) == prev_node)){
+ prev_node = nxt;
+ nxt = node_traits::get_next(nxt);
+ }
+
+ //If we've reached the bucket node just return it.
+ if(bucket_beg <= nxt && nxt <= bucket_end){
+ return nxt;
+ }
+
+ //Otherwise, iterate using group links until the bucket node
+ node_ptr first_node_of_group = nxt;
+ node_ptr last_node_group = group_traits::get_next(first_node_of_group);
+ slist_node_ptr possible_end = node_traits::get_next(last_node_group);
+
+ while(!(bucket_beg <= possible_end && possible_end <= bucket_end)){
+ first_node_of_group = dcast_bucket_ptr(possible_end);
+ last_node_group = group_traits::get_next(first_node_of_group);
+ possible_end = node_traits::get_next(last_node_group);
+ }
+ return possible_end;
+ }
+
+ static node_ptr priv_get_prev_to_first_in_group(slist_node_ptr bucket_node, node_ptr first_in_group)
+ {
+ //Just iterate using group links and obtain the node
+ //before "first_in_group)"
+ node_ptr prev_node = dcast_bucket_ptr(bucket_node);
+ node_ptr nxt(node_traits::get_next(prev_node));
+ while(nxt != first_in_group){
+ prev_node = group_traits::get_next(nxt);
+ nxt = node_traits::get_next(prev_node);
+ }
+ return prev_node;
+ }
+
+ static node_ptr priv_get_first_in_group_of_last_in_group(node_ptr last_in_group)
+ {
+ //Just iterate using group links and obtain the node
+ //before "last_in_group"
+ node_ptr possible_first = group_traits::get_next(last_in_group);
+ node_ptr possible_first_prev = group_traits::get_next(possible_first);
+ // The deleted node is at the end of the group, so the
+ // node in the group pointing to it is at the beginning
+ // of the group. Find that to change its pointer.
+ while(possible_first_prev != last_in_group){
+ possible_first = possible_first_prev;
+ possible_first_prev = group_traits::get_next(possible_first);
+ }
+ return possible_first;
+ }
+
+
+ static void priv_erase_from_group(slist_node_ptr end_ptr, node_ptr to_erase_ptr, detail::true_)
+ {
+ node_ptr nxt_ptr(node_traits::get_next(to_erase_ptr));
+ node_ptr prev_in_group_ptr(group_traits::get_next(to_erase_ptr));
+ bool last_in_group = (end_ptr == nxt_ptr) ||
+ (group_traits::get_next(nxt_ptr) != to_erase_ptr);
+ bool first_in_group = node_traits::get_next(prev_in_group_ptr) != to_erase_ptr;
+
+ if(first_in_group && last_in_group){
+ group_algorithms::init(to_erase_ptr);
+ }
+ else if(first_in_group){
+ group_algorithms::unlink_after(nxt_ptr);
+ }
+ else if(last_in_group){
+ node_ptr first_in_group =
+ priv_get_first_in_group_of_last_in_group(to_erase_ptr);
+ group_algorithms::unlink_after(first_in_group);
+ }
+ else{
+ group_algorithms::unlink_after(nxt_ptr);
+ }
+ }
+
+ static void priv_erase_from_group(slist_node_ptr, node_ptr, detail::false_)
+ {}
+
+ static node_ptr priv_get_last_in_group(node_ptr first_in_group, detail::true_)
+ { return group_traits::get_next(first_in_group); }
+
+ static node_ptr priv_get_last_in_group(node_ptr n, detail::false_)
+ { return n; }
+};
+
+template<class BucketType, class SplitTraits>
+class incremental_rehash_rollback
+{
+ private:
+ typedef BucketType bucket_type;
+ typedef SplitTraits split_traits;
+
+ incremental_rehash_rollback();
+ incremental_rehash_rollback & operator=(const incremental_rehash_rollback &);
+ incremental_rehash_rollback (const incremental_rehash_rollback &);
+
+ public:
+ incremental_rehash_rollback
+ (bucket_type &source_bucket, bucket_type &destiny_bucket, split_traits &split_traits)
+ : source_bucket_(source_bucket), destiny_bucket_(destiny_bucket)
+ , split_traits_(split_traits), released_(false)
+ {}
+
+ void release()
+ { released_ = true; }
+
+ ~incremental_rehash_rollback()
+ {
+ if(!released_){
+ //If an exception is thrown, just put all moved nodes back in the old bucket
+ //and move back the split mark.
+ destiny_bucket_.splice_after(destiny_bucket_.before_begin(), source_bucket_);
+ split_traits_.decrement();
+ }
+ }
+
+ private:
+ bucket_type &source_bucket_;
+ bucket_type &destiny_bucket_;
+ split_traits &split_traits_;
+ bool released_;
};
} //namespace detail {
@@ -304,50 +509,13 @@
typedef implementation_defined type;
};
-template <class T>
-struct get_default_uset_hook
-{
- typedef typename T::default_uset_hook type;
-};
-
-template < class ValueTraits
- , bool UniqueKeys
- , class Hash
- , class Equal
- , class SizeType
- , bool ConstantTimeSize
- , class BucketTraits
- , bool Power2Buckets
- , bool CacheBegin
- , bool CompareHash
- >
-struct usetopt
-{
- typedef ValueTraits value_traits;
- typedef Hash hash;
- typedef Equal equal;
- typedef SizeType size_type;
- typedef BucketTraits bucket_traits;
- static const bool constant_time_size = ConstantTimeSize;
- static const bool power_2_buckets = Power2Buckets;
- static const bool unique_keys = UniqueKeys;
- static const bool cache_begin = CacheBegin;
- static const bool compare_hash = CompareHash;
-};
-
struct default_bucket_traits;
template <class T>
struct uset_defaults
: pack_options
< none
- , base_hook
- < typename detail::eval_if_c
- < detail::internal_default_uset_hook<T>::value
- , get_default_uset_hook<T>
- , detail::identity<none>
- >::type
- >
+ , base_hook<detail::default_uset_hook>
, constant_time_size<true>
, size_type<std::size_t>
, equal<std::equal_to<T> >
@@ -356,6 +524,7 @@
, power_2_buckets<false>
, cache_begin<false>
, compare_hash<false>
+ , incremental<false>
>::type
{};
@@ -380,7 +549,7 @@
//! The container supports the following options:
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<>
-//! \c bucket_traits<>, power_2_buckets<> and cache_begin<>.
+//! \c bucket_traits<>, power_2_buckets<>, cache_begin<> and incremental<>.
//!
//! hashtable only provides forward iterators but it provides 4 iterator types:
//! iterator and const_iterator to navigate through the whole container and
@@ -397,13 +566,12 @@
//!
//! Since no automatic rehashing is done, iterators are never invalidated when
//! inserting or erasing elements. Iterators are only invalidated when rehashing.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
class hashtable_impl
- : private detail::hashtable_data_t<Config>
{
public:
typedef typename Config::value_traits value_traits;
@@ -455,18 +623,22 @@
<node_ptr, const node>::type const_node_ptr;
typedef typename slist_impl::node_algorithms node_algorithms;
- static const bool constant_time_size = Config::constant_time_size;
static const bool stateful_value_traits = detail::store_cont_ptr_on_it<hashtable_impl>::value;
static const bool store_hash = detail::store_hash_is_true<node_traits>::value;
- static const bool unique_keys = Config::unique_keys;
+
+ static const bool unique_keys = 0 != (Config::bool_flags & detail::hash_bool_flags::unique_keys_pos);
+ static const bool constant_time_size = 0 != (Config::bool_flags & detail::hash_bool_flags::constant_time_size_pos);
+ static const bool cache_begin = 0 != (Config::bool_flags & detail::hash_bool_flags::cache_begin_pos);
+ static const bool compare_hash = 0 != (Config::bool_flags & detail::hash_bool_flags::compare_hash_pos);
+ static const bool incremental = 0 != (Config::bool_flags & detail::hash_bool_flags::incremental_pos);
+ static const bool power_2_buckets = incremental || (0 != (Config::bool_flags & detail::hash_bool_flags::power_2_buckets_pos));
+
static const bool optimize_multikey
= detail::optimize_multikey_is_true<node_traits>::value && !unique_keys;
- static const bool power_2_buckets = Config::power_2_buckets;
- static const bool cache_begin = Config::cache_begin;
- static const bool compare_hash = Config::compare_hash;
/// @cond
private:
+
//Configuration error: compare_hash<> can't be specified without store_hash<>
//See documentation for more explanations
BOOST_STATIC_ASSERT((!compare_hash || store_hash));
@@ -483,7 +655,17 @@
typedef detail::bool_<cache_begin> cache_begin_t;
typedef detail::bool_<power_2_buckets> power_2_buckets_t;
typedef detail::size_holder<constant_time_size, size_type> size_traits;
- typedef detail::hashtable_data_t<Config> base_type;
+ typedef detail::size_holder<incremental, size_type> split_traits;
+ typedef detail::group_functions<node_traits> group_functions_t;
+
+ static const std::size_t hashtable_data_bool_flags_mask =
+ ( detail::hash_bool_flags::cache_begin_pos
+ | detail::hash_bool_flags::constant_time_size_pos
+ | detail::hash_bool_flags::incremental_pos
+ );
+ typedef typename detail::usetopt_mask
+ <Config, hashtable_data_bool_flags_mask>::type masked_config_t;
+ detail::hashtable_data_t<masked_config_t> data_;
template<bool IsConst>
struct downcast_node_to_value
@@ -555,16 +737,16 @@
/// @cond
const real_value_traits &get_real_value_traits(detail::bool_<false>) const
- { return *this; }
+ { return this->data_; }
const real_value_traits &get_real_value_traits(detail::bool_<true>) const
- { return base_type::get_value_traits(*this); }
+ { return data_.get_value_traits(*this); }
real_value_traits &get_real_value_traits(detail::bool_<false>)
- { return *this; }
+ { return this->data_; }
real_value_traits &get_real_value_traits(detail::bool_<true>)
- { return base_type::get_value_traits(*this); }
+ { return data_.get_value_traits(*this); }
/// @endcond
@@ -593,14 +775,16 @@
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
, const value_traits &v_traits = value_traits())
- : base_type(b_traits, hash_func, equal_func, v_traits)
+ : data_(b_traits, hash_func, equal_func, v_traits)
{
priv_initialize_buckets();
this->priv_size_traits().set_size(size_type(0));
- BOOST_INTRUSIVE_INVARIANT_ASSERT(this->priv_buckets_len() != 0);
+ size_type bucket_size = this->priv_buckets_len();
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(bucket_size != 0);
//Check power of two bucket array if the option is activated
BOOST_INTRUSIVE_INVARIANT_ASSERT
- (!power_2_buckets || (0 == (this->priv_buckets_len() & (this->priv_buckets_len()-1))));
+ (!power_2_buckets || (0 == (bucket_size & (bucket_size-1))));
+ priv_split_traits().set_size(bucket_size>>1);
}
//! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set
@@ -620,10 +804,7 @@
//!
//! <b>Throws</b>: Nothing.
iterator begin()
- {
- size_type bucket_num;
- return iterator(this->priv_begin(bucket_num), this);
- }
+ { return iterator(this->priv_begin(), this); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning
//! of the unordered_set.
@@ -643,10 +824,7 @@
//!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
- {
- size_type bucket_num;
- return const_iterator(this->priv_begin(bucket_num), this);
- }
+ { return const_iterator(this->priv_begin(), this); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the unordered_set.
//!
@@ -760,21 +938,32 @@
this->priv_size_traits().set_size(other.priv_size_traits().get_size());
other.priv_size_traits().set_size(backup);
}
+ else if(incremental){
+ size_type backup = this->priv_split_traits().get_size();
+ this->priv_split_traits().set_size(other.priv_split_traits().get_size());
+ other.priv_split_traits().set_size(backup);
+ }
}
- //! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw
+ //! Cloner should yield to nodes that compare equal and produce the same
+ //! hash than the original node.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. The hash function and the equality
+ //! predicate are copied from the source.
//!
- //! If cloner throws, all cloned elements are unlinked and disposed
+ //! If store_hash option is true, this method does not use the hash function.
+ //!
+ //! If any operation throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws. Basic guarantee.
+ //! <b>Throws</b>: If cloner or hasher throw or hash or equality predicate copying
+ //! throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const hashtable_impl &src, Cloner cloner, Disposer disposer)
{
@@ -789,7 +978,7 @@
(!power_2_buckets || (0 == (dst_bucket_count & (dst_bucket_count-1))));
//If src bucket count is bigger or equal, structural copy is possible
- if(src_bucket_count >= dst_bucket_count){
+ if(!incremental && (src_bucket_count >= dst_bucket_count)){
//First clone the first ones
const bucket_ptr src_buckets = src.priv_buckets();
const bucket_ptr dst_buckets = this->priv_buckets();
@@ -813,7 +1002,7 @@
; constructed < src_bucket_count
; ++constructed){
bucket_type &dst_b =
- dst_buckets[priv_hash_to_bucket(constructed, dst_bucket_count)];
+ dst_buckets[priv_hash_to_bucket(constructed, dst_bucket_count, dst_bucket_count)];
bucket_type &src_b = src_buckets[constructed];
for( siterator b(src_b.begin()), e(src_b.end())
; b != e
@@ -822,14 +1011,29 @@
}
}
}
+ this->priv_hasher() = src.priv_hasher();
+ this->priv_equal() = src.priv_equal();
rollback.release();
this->priv_size_traits().set_size(src.priv_size_traits().get_size());
+ this->priv_split_traits().set_size(dst_bucket_count);
priv_insertion_update_cache(0u);
priv_erasure_update_cache();
}
+ else if(store_hash){
+ //Unlike previous cloning algorithm, this can throw
+ //if cloner, hasher or comparison functor throw
+ const_iterator b(src.begin()), e(src.end());
+ detail::exception_disposer<hashtable_impl, Disposer>
+ rollback(*this, disposer);
+ for(; b != e; ++b){
+ std::size_t hash_value = this->priv_stored_or_compute_hash(*b, store_hash_t());;
+ this->priv_insert_equal_with_hash(*cloner(*b), hash_value);
+ }
+ rollback.release();
+ }
else{
//Unlike previous cloning algorithm, this can throw
- //if cloner, the hasher or comparison functor throw
+ //if cloner, hasher or comparison functor throw
const_iterator b(src.begin()), e(src.end());
detail::exception_disposer<hashtable_impl, Disposer>
rollback(*this, disposer);
@@ -848,23 +1052,7 @@
siterator prev;
siterator it = this->priv_find
(value, this->priv_hasher(), this->priv_equal(), bucket_num, hash_value, prev);
- bucket_type &b = this->priv_buckets()[bucket_num];
- bool found_equal = it != priv_invalid_local_it();
- node_ptr n = node_ptr(&priv_value_to_node(value));
- this->priv_store_hash(n, hash_value, store_hash_t());
- if(safemode_or_autounlink)
- BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
- if(!found_equal){
- it = b.before_begin();
- }
- if(optimize_multikey){
- node_ptr first_in_group = found_equal ?
- dcast_bucket_ptr(it.pointed_node()) : node_ptr(0);
- this->priv_insert_in_group(first_in_group, n, optimize_multikey_t());
- }
- priv_insertion_update_cache(bucket_num);
- this->priv_size_traits().increment();
- return iterator(b.insert_after(it, *n), this);
+ return priv_insert_equal_find(value, bucket_num, hash_value, it);
}
template<class Iterator>
@@ -968,7 +1156,7 @@
this->priv_find(key, hash_func, equal_func, bucket_num, commit_data.hash, prev);
bool success = prev_pos == priv_invalid_local_it();
if(success){
- prev_pos = this->priv_buckets()[bucket_num].before_begin();
+ prev_pos = prev;
}
return std::pair<iterator, bool>(iterator(prev_pos, this),success);
}
@@ -1177,8 +1365,8 @@
}
else if(optimize_multikey){
siterator last = bucket_type::s_iterator_to
- (*node_traits::get_next(priv_get_last_in_group
- (dcast_bucket_ptr(it.pointed_node()))));
+ (*node_traits::get_next(group_functions_t::priv_get_last_in_group
+ (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t())));
this->priv_erase_range_impl(bucket_num, prev, last, disposer, count);
}
else{
@@ -1188,7 +1376,7 @@
slist_node_ptr n(it.pointed_node());
const value_type &v = priv_value_from_slist_node(n);
if(compare_hash){
- std::size_t vh = this->priv_stored_hash(v, store_hash_t());
+ std::size_t vh = this->priv_stored_or_compute_hash(v, store_hash_t());
if(h != vh || !equal_func(key, v)){
break;
}
@@ -1676,9 +1864,15 @@
//! or the same as the old bucket array. new_size is the length of the
//! the array pointed by new_buckets. If new_buckets == this->bucket_pointer()
//! n can be bigger or smaller than this->bucket_count().
+ //! 'new_bucket_traits' copy constructor should not throw.
//!
//! <b>Effects</b>: Updates the internal reference with the new bucket erases
- //! the values from the old bucket and inserts then in the new one.
+ //! the values from the old bucket and inserts then in the new one.
+ //! Bucket traits hold by *this is assigned from new_bucket_traits.
+ //! If the container is configured as incremental<>, the split bucket is set
+ //! to the new bucket_len().
+ //!
+ //! If store_hash option is true, this method does not use the hash function.
//!
//! <b>Complexity</b>: Average case linear in this->size(), worst case quadratic.
//!
@@ -1698,7 +1892,7 @@
const bool same_buffer = old_buckets == new_buckets;
//If the new bucket length is a common factor
//of the old one we can avoid hash calculations.
- const bool fast_shrink = (old_buckets_len > new_buckets_len) &&
+ const bool fast_shrink = (!incremental) && (old_buckets_len > new_buckets_len) &&
(power_2_buckets ||(old_buckets_len % new_buckets_len) == 0);
//If we are shrinking the same bucket array and it's
//is a fast shrink, just rehash the last nodes
@@ -1708,7 +1902,9 @@
new_first_bucket_num = priv_get_cache_bucket_num();
}
- //Anti-exception stuff: they destroy the elements if something goes wrong
+ //Anti-exception stuff: they destroy the elements if something goes wrong.
+ //If the source and destination buckets are the same, the second rollback function
+ //is harmless, because all elements have been already unlinked and destroyed
typedef detail::init_disposer<node_algorithms> NodeDisposer;
NodeDisposer node_disp;
detail::exception_array_disposer<bucket_type, NodeDisposer>
@@ -1733,12 +1929,13 @@
siterator i(old_bucket.begin());
for(;i != end; ++i){
const value_type &v = priv_value_from_slist_node(i.pointed_node());
- const std::size_t hash_value = this->priv_stored_hash(v, store_hash_t());
- const size_type new_n = priv_hash_to_bucket(hash_value, new_buckets_len);
+ const std::size_t hash_value = this->priv_stored_or_compute_hash(v, store_hash_t());
+ const size_type new_n = priv_hash_to_bucket(hash_value, new_buckets_len, new_buckets_len);
if(cache_begin && new_n < new_first_bucket_num)
new_first_bucket_num = new_n;
siterator last = bucket_type::s_iterator_to
- (*priv_get_last_in_group(dcast_bucket_ptr(i.pointed_node())));
+ (*group_functions_t::priv_get_last_in_group
+ (dcast_bucket_ptr(i.pointed_node()), optimize_multikey_t()));
if(same_buffer && new_n == n){
before_i = last;
}
@@ -1750,7 +1947,7 @@
}
}
else{
- const size_type new_n = priv_hash_to_bucket(n, new_buckets_len);
+ const size_type new_n = priv_hash_to_bucket(n, new_buckets_len, new_buckets_len);
if(cache_begin && new_n < new_first_bucket_num)
new_first_bucket_num = new_n;
bucket_type &new_b = new_buckets[new_n];
@@ -1764,14 +1961,148 @@
}
this->priv_size_traits().set_size(size_backup);
+ this->priv_split_traits().set_size(new_buckets_len);
this->priv_real_bucket_traits() = new_bucket_traits;
priv_initialize_cache();
priv_insertion_update_cache(new_first_bucket_num);
- //priv_erasure_update_cache();
rollback1.release();
rollback2.release();
}
+ //! <b>Requires</b>:
+ //!
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
+ //! <b>Throws</b>:
+ //!
+ //! <b>Note</b>: this method is only available if incremental<true> option is activated.
+ bool incremental_rehash(bool grow = true)
+ {
+ //This function is only available for containers with incremental hashing
+ BOOST_STATIC_ASSERT(( incremental && power_2_buckets ));
+ size_type split_idx = priv_split_traits().get_size();
+ size_type bucket_len = priv_buckets_len();
+
+ if(grow){
+ //Test if the split variable can be changed
+ if(split_idx >= bucket_len)
+ return false;
+
+ size_type bucket_len = priv_buckets_len();
+ size_type bucket_to_rehash = split_idx - bucket_len/2;
+ bucket_type &old_bucket = this->priv_buckets()[bucket_to_rehash];
+ siterator before_i(old_bucket.before_begin());
+ siterator end(old_bucket.end());
+ siterator i(old_bucket.begin());
+ priv_split_traits().increment();
+
+ //Anti-exception stuff: if an exception is thrown while
+ //moving elements from old_bucket to the target bucket, all moved
+ //elements are moved back to the original one.
+ detail::incremental_rehash_rollback<bucket_type, split_traits> rollback
+ ( this->priv_buckets()[split_idx], old_bucket, priv_split_traits());
+ for(;i != end; ++i){
+ const value_type &v = priv_value_from_slist_node(i.pointed_node());
+ const std::size_t hash_value = this->priv_stored_or_compute_hash(v, store_hash_t());
+ const size_type new_n = priv_hash_to_bucket(hash_value);
+ siterator last = bucket_type::s_iterator_to
+ (*group_functions_t::priv_get_last_in_group
+ (dcast_bucket_ptr(i.pointed_node()), optimize_multikey_t()));
+ if(new_n == bucket_to_rehash){
+ before_i = last;
+ }
+ else{
+ bucket_type &new_b = this->priv_buckets()[new_n];
+ new_b.splice_after(new_b.before_begin(), old_bucket, before_i, last);
+ }
+ i = before_i;
+ }
+ rollback.release();
+ priv_erasure_update_cache();
+ return true;
+ }
+ else{
+ //Test if the split variable can be changed
+ if(split_idx <= bucket_len/2)
+ return false;
+ const size_type target_bucket_num = split_idx - 1 - bucket_len/2;
+ bucket_type &target_bucket = this->priv_buckets()[target_bucket_num];
+ bucket_type &source_bucket = this->priv_buckets()[split_idx-1];
+ target_bucket.splice_after(target_bucket.cbefore_begin(), source_bucket);
+ priv_split_traits().decrement();
+ priv_insertion_update_cache(target_bucket_num);
+ return true;
+ }
+ }
+
+ //! <b>Effects</b>: If new_bucket_traits.bucket_count() is not
+ //! this->bucket_count()/2 or this->bucket_count()*2, or
+ //! this->split_bucket() != new_bucket_traits.bucket_count() returns false
+ //! and does nothing.
+ //!
+ //! Otherwise, copy assigns new_bucket_traits to the internal bucket_traits
+ //! and transfers all the objects from old buckets to the new ones.
+ //!
+ //! <b>Complexity</b>: Linear to size().
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Note</b>: this method is only available if incremental<true> option is activated.
+ bool incremental_rehash(const bucket_traits &new_bucket_traits)
+ {
+ //This function is only available for containers with incremental hashing
+ BOOST_STATIC_ASSERT(( incremental && power_2_buckets ));
+ size_type new_bucket_traits_size = new_bucket_traits.bucket_count();
+ size_type cur_bucket_traits = this->priv_buckets_len();
+ if(new_bucket_traits_size/2 != cur_bucket_traits && new_bucket_traits_size != cur_bucket_traits/2){
+ return false;
+ }
+
+ const size_type split_idx = this->split_count();
+
+ if(new_bucket_traits_size/2 == cur_bucket_traits){
+ //Test if the split variable can be changed
+ if(!(split_idx >= cur_bucket_traits))
+ return false;
+ }
+ else{
+ //Test if the split variable can be changed
+ if(!(split_idx <= cur_bucket_traits/2))
+ return false;
+ }
+
+ const size_type ini_n = priv_get_cache_bucket_num();
+ const bucket_ptr old_buckets = this->priv_buckets();
+ this->priv_real_bucket_traits() = new_bucket_traits;
+ if(new_bucket_traits.bucket_begin() != old_buckets){
+ for(size_type n = ini_n; n < split_idx; ++n){
+ bucket_type &new_bucket = new_bucket_traits.bucket_begin()[n];
+ bucket_type &old_bucket = old_buckets[n];
+ new_bucket.splice_after(new_bucket.cbefore_begin(), old_bucket);
+ }
+ //Put cache to safe position
+ priv_initialize_cache();
+ priv_insertion_update_cache(ini_n);
+ }
+ return true;
+ }
+
+ //! <b>Requires</b>:
+ //!
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
+ //! <b>Throws</b>:
+ size_type split_count() const
+ {
+ //This function is only available if incremental hashing is activated
+ BOOST_STATIC_ASSERT(( incremental && power_2_buckets ));
+ return this->priv_split_traits().get_size();
+ }
+
//! <b>Effects</b>: Returns the nearest new bucket count optimized for
//! the container that is bigger than n. This suggestion can be used
//! to create bucket arrays with a size that will usually improve
@@ -1812,29 +2143,30 @@
/// @cond
private:
- std::size_t priv_hash_to_bucket(std::size_t hash_value) const
- { return priv_hash_to_bucket(hash_value, power_2_buckets_t()); }
-
- std::size_t priv_hash_to_bucket(std::size_t hash_value, detail::bool_<false>) const
- { return hash_value % this->priv_real_bucket_traits().bucket_count(); }
- std::size_t priv_hash_to_bucket(std::size_t hash_value, detail::bool_<true>) const
- { return hash_value & (this->priv_real_bucket_traits().bucket_count() - 1); }
+ std::size_t priv_hash_to_bucket(std::size_t hash_value) const
+ { return priv_hash_to_bucket(hash_value, this->priv_real_bucket_traits().bucket_count(), priv_split_traits().get_size()); }
- std::size_t priv_hash_to_bucket(std::size_t hash_value, std::size_t bucket_len) const
- { return priv_hash_to_bucket(hash_value, bucket_len, power_2_buckets_t()); }
+ std::size_t priv_hash_to_bucket(std::size_t hash_value, std::size_t bucket_len, std::size_t split) const
+ {
+ std::size_t bucket_number = priv_hash_to_bucket_impl(hash_value, bucket_len, power_2_buckets_t());
+ if(incremental)
+ if(bucket_number >= split)
+ bucket_number -= bucket_len/2;
+ return bucket_number;
+ }
- std::size_t priv_hash_to_bucket(std::size_t hash_value, std::size_t bucket_len, detail::bool_<false>) const
+ std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_len, detail::bool_<false>) const
{ return hash_value % bucket_len; }
- std::size_t priv_hash_to_bucket(std::size_t hash_value, std::size_t bucket_len, detail::bool_<true>) const
+ std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_len, detail::bool_<true>) const
{ return hash_value & (bucket_len - 1); }
const key_equal &priv_equal() const
- { return static_cast<const key_equal&>(this->bucket_hash_equal_.get()); }
+ { return static_cast<const key_equal&>(this->data_.internal_.bucket_hash_equal_.get()); }
key_equal &priv_equal()
- { return static_cast<key_equal&>(this->bucket_hash_equal_.get()); }
+ { return static_cast<key_equal&>(this->data_.internal_.bucket_hash_equal_.get()); }
value_type &priv_value_from_slist_node(slist_node_ptr n)
{ return *this->get_real_value_traits().to_value_ptr(dcast_bucket_ptr(n)); }
@@ -1843,16 +2175,16 @@
{ return *this->get_real_value_traits().to_value_ptr(dcast_bucket_ptr(n)); }
const real_bucket_traits &priv_real_bucket_traits(detail::bool_<false>) const
- { return this->bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; }
+ { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; }
const real_bucket_traits &priv_real_bucket_traits(detail::bool_<true>) const
- { return this->bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_.get_bucket_traits(*this); }
+ { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_.get_bucket_traits(*this); }
real_bucket_traits &priv_real_bucket_traits(detail::bool_<false>)
- { return this->bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; }
+ { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; }
real_bucket_traits &priv_real_bucket_traits(detail::bool_<true>)
- { return this->bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_.get_bucket_traits(*this); }
+ { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_.get_bucket_traits(*this); }
const real_bucket_traits &priv_real_bucket_traits() const
{ return this->priv_real_bucket_traits(detail::bool_<external_bucket_traits>()); }
@@ -1861,10 +2193,10 @@
{ return this->priv_real_bucket_traits(detail::bool_<external_bucket_traits>()); }
const hasher &priv_hasher() const
- { return static_cast<const hasher&>(this->bucket_hash_equal_.bucket_hash.get()); }
+ { return static_cast<const hasher&>(this->data_.internal_.bucket_hash_equal_.bucket_hash.get()); }
hasher &priv_hasher()
- { return static_cast<hasher&>(this->bucket_hash_equal_.bucket_hash.get()); }
+ { return static_cast<hasher&>(this->data_.internal_.bucket_hash_equal_.bucket_hash.get()); }
bucket_ptr priv_buckets() const
{ return this->priv_real_bucket_traits().bucket_begin(); }
@@ -1882,10 +2214,16 @@
{ return *this->get_real_value_traits().to_node_ptr(v); }
size_traits &priv_size_traits()
- { return this->bucket_hash_equal_.bucket_hash.bucket_plus_size_; }
+ { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_; }
const size_traits &priv_size_traits() const
- { return this->bucket_hash_equal_.bucket_hash.bucket_plus_size_; }
+ { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_; }
+
+ split_traits &priv_split_traits()
+ { return this->data_.internal_; }
+
+ const split_traits &priv_split_traits() const
+ { return this->data_.internal_; }
template<class Disposer>
void priv_erase_range_impl
@@ -1903,7 +2241,7 @@
++to_erase;
slist_node_ptr end_ptr = end.pointed_node();
while(to_erase != end){
- priv_erase_from_group(end_ptr, dcast_bucket_ptr(to_erase.pointed_node()), optimize_multikey_t());
+ group_functions_t::priv_erase_from_group(end_ptr, dcast_bucket_ptr(to_erase.pointed_node()), optimize_multikey_t());
to_erase = b.erase_after_and_dispose(before_first_it, make_node_disposer(disposer));
++num_erased;
}
@@ -1955,10 +2293,10 @@
static node_ptr dcast_bucket_ptr(typename slist_impl::node_ptr p)
{ return node_ptr(&static_cast<node&>(*p)); }
- std::size_t priv_stored_hash(const value_type &v, detail::true_) const
+ std::size_t priv_stored_or_compute_hash(const value_type &v, detail::true_) const
{ return node_traits::get_hash(this->get_real_value_traits().to_node_ptr(v)); }
- std::size_t priv_stored_hash(const value_type &v, detail::false_) const
+ std::size_t priv_stored_or_compute_hash(const value_type &v, detail::false_) const
{ return priv_hasher()(v); }
std::size_t priv_stored_hash(slist_node_ptr n, detail::true_) const
@@ -2002,10 +2340,10 @@
std::size_t priv_get_bucket_num_hash_dispatch(siterator it, detail::false_)
{ return priv_get_bucket_num_no_hash_store(it, optimize_multikey_t()); }
- std::size_t priv_get_bucket_num_no_hash_store( siterator it, detail::true_)
+ std::size_t priv_get_bucket_num_no_hash_store(siterator it, detail::true_)
{
bucket_ptr f(priv_buckets()), l(f + priv_buckets_len() - 1);
- slist_node_ptr bb = priv_get_bucket_before_begin
+ slist_node_ptr bb = group_functions_t::priv_get_bucket_before_begin
( f->end().pointed_node()
, l->end().pointed_node()
, dcast_bucket_ptr(it.pointed_node()));
@@ -2016,7 +2354,7 @@
return static_cast<size_type>(&b - &*f);
}
- std::size_t priv_get_bucket_num_no_hash_store( siterator it, detail::false_)
+ std::size_t priv_get_bucket_num_no_hash_store(siterator it, detail::false_)
{
bucket_ptr f(priv_buckets()), l(f + priv_buckets_len() - 1);
slist_node_ptr first_ptr(f->cend().pointed_node())
@@ -2035,34 +2373,6 @@
return static_cast<std::size_t>(&b - &*f);
}
- void priv_erase_from_group(slist_node_ptr end_ptr, node_ptr to_erase_ptr, detail::true_)
- {
- node_ptr nxt_ptr(node_traits::get_next(to_erase_ptr));
- node_ptr prev_in_group_ptr(group_traits::get_next(to_erase_ptr));
- bool last_in_group = (end_ptr == nxt_ptr) ||
- (group_traits::get_next(nxt_ptr) != to_erase_ptr);
- bool first_in_group = node_traits::get_next(prev_in_group_ptr) != to_erase_ptr;
-
- if(first_in_group && last_in_group){
- group_algorithms::init(to_erase_ptr);
- }
- else if(first_in_group){
- group_algorithms::unlink_after(nxt_ptr);
- }
- else if(last_in_group){
- node_ptr first_in_group = //possible_first_in_group ? possible_first_in_group :
- priv_get_first_in_group_of_last_in_group(to_erase_ptr);
- group_algorithms::unlink_after(first_in_group);
- //possible_first_in_group = 0;
- }
- else{
- group_algorithms::unlink_after(nxt_ptr);
- }
- }
-
- void priv_erase_from_group(slist_node_ptr, node_ptr, detail::false_)
- {}
-
void priv_init_group(slist_node_ptr n, detail::true_)
{ group_algorithms::init(dcast_bucket_ptr(n)); }
@@ -2083,79 +2393,9 @@
}
}
- static slist_node_ptr priv_get_bucket_before_begin
- (slist_node_ptr bucket_beg, slist_node_ptr bucket_end, node_ptr p)
- {
- //First find the last node of p's group.
- //This requires checking the first node of the next group or
- //the bucket node.
- node_ptr prev_node = p;
- node_ptr nxt(node_traits::get_next(p));
- while(!(bucket_beg <= nxt && nxt <= bucket_end) &&
- (group_traits::get_next(nxt) == prev_node)){
- prev_node = nxt;
- nxt = node_traits::get_next(nxt);
- }
-
- //If we've reached the bucket node just return it.
- if(bucket_beg <= nxt && nxt <= bucket_end){
- return nxt;
- }
-
- //Otherwise, iterate using group links until the bucket node
- node_ptr first_node_of_group = nxt;
- node_ptr last_node_group = group_traits::get_next(first_node_of_group);
- slist_node_ptr possible_end = node_traits::get_next(last_node_group);
-
- while(!(bucket_beg <= possible_end && possible_end <= bucket_end)){
- first_node_of_group = dcast_bucket_ptr(possible_end);
- last_node_group = group_traits::get_next(first_node_of_group);
- possible_end = node_traits::get_next(last_node_group);
- }
- return possible_end;
- }
-
- static node_ptr priv_get_prev_to_first_in_group(slist_node_ptr bucket_node, node_ptr first_in_group)
- {
- //Just iterate using group links and obtain the node
- //before "first_in_group)"
- node_ptr prev_node = dcast_bucket_ptr(bucket_node);
- node_ptr nxt(node_traits::get_next(prev_node));
- while(nxt != first_in_group){
- prev_node = group_traits::get_next(nxt);
- nxt = node_traits::get_next(prev_node);
- }
- return prev_node;
- }
-
- static node_ptr priv_get_first_in_group_of_last_in_group(node_ptr last_in_group)
- {
- //Just iterate using group links and obtain the node
- //before "last_in_group"
- node_ptr possible_first = group_traits::get_next(last_in_group);
- node_ptr possible_first_prev = group_traits::get_next(possible_first);
- // The deleted node is at the end of the group, so the
- // node in the group pointing to it is at the beginning
- // of the group. Find that to change its pointer.
- while(possible_first_prev != last_in_group){
- possible_first = possible_first_prev;
- possible_first_prev = group_traits::get_next(possible_first);
- }
- return possible_first;
- }
-
void priv_insert_in_group(node_ptr, node_ptr, detail::false_)
{}
- static node_ptr priv_get_last_in_group(node_ptr first_in_group)
- { return priv_get_last_in_group(first_in_group, optimize_multikey_t()); }
-
- static node_ptr priv_get_last_in_group(node_ptr first_in_group, detail::true_)
- { return group_traits::get_next(first_in_group); }
-
- static node_ptr priv_get_last_in_group(node_ptr n, detail::false_)
- { return n; }
-
siterator priv_get_previous
(bucket_type &b, siterator i)
{ return priv_get_previous(b, i, optimize_multikey_t()); }
@@ -2166,9 +2406,8 @@
node_ptr elem(dcast_bucket_ptr(i.pointed_node()));
node_ptr prev_in_group(group_traits::get_next(elem));
bool first_in_group = node_traits::get_next(prev_in_group) != elem;
-
typename bucket_type::node &n = first_in_group
- ? *priv_get_prev_to_first_in_group(b.end().pointed_node(), elem)
+ ? *group_functions_t::priv_get_prev_to_first_in_group(b.end().pointed_node(), elem)
: *group_traits::get_next(elem)
;
return bucket_type::s_iterator_to(n);
@@ -2234,15 +2473,15 @@
].before_begin().pointed_node();
}
else{
- bucket_node = priv_get_bucket_before_begin
+ bucket_node = group_functions_t::priv_get_bucket_before_begin
(first_end_ptr, last_end_ptr, start_pos);
}
prev = bucket_type::s_iterator_to
- (*priv_get_prev_to_first_in_group(bucket_node, elem));
+ (*group_functions_t::priv_get_prev_to_first_in_group(bucket_node, elem));
}
else{
if(last_in_group){
- nxt_in_group = priv_get_first_in_group_of_last_in_group(elem);
+ nxt_in_group = group_functions_t::priv_get_first_in_group_of_last_in_group(elem);
}
else{
nxt_in_group = node_traits::get_next(elem);
@@ -2283,32 +2522,29 @@
siterator priv_invalid_local_it() const
{ return priv_invalid_bucket()->end(); }
- siterator priv_begin(size_type &bucket_num) const
- { return priv_begin(bucket_num, cache_begin_t()); }
+ siterator priv_begin() const
+ { return priv_begin(cache_begin_t()); }
- siterator priv_begin(size_type &bucket_num, detail::bool_<false>) const
+ siterator priv_begin(detail::bool_<false>) const
{
size_type n = 0;
size_type buckets_len = this->priv_buckets_len();
for (n = 0; n < buckets_len; ++n){
bucket_type &b = this->priv_buckets()[n];
if(!b.empty()){
- bucket_num = n;
return b.begin();
}
}
- bucket_num = n;
return priv_invalid_local_it();
}
- siterator priv_begin(size_type &bucket_num, detail::bool_<true>) const
+ siterator priv_begin(detail::bool_<true>) const
{
- bucket_num = this->bucket_hash_equal_.cached_begin_ - this->priv_buckets();
- if(this->bucket_hash_equal_.cached_begin_ == priv_invalid_bucket()){
+ if(this->data_.internal_.bucket_hash_equal_.cached_begin_ == priv_invalid_bucket()){
return priv_invalid_local_it();
}
else{
- return this->bucket_hash_equal_.cached_begin_->begin();
+ return this->data_.internal_.bucket_hash_equal_.cached_begin_->begin();
}
}
@@ -2316,7 +2552,7 @@
{ priv_initialize_cache(cache_begin_t()); }
void priv_initialize_cache(detail::bool_<true>)
- { this->bucket_hash_equal_.cached_begin_ = priv_invalid_bucket(); }
+ { this->data_.internal_.bucket_hash_equal_.cached_begin_ = priv_invalid_bucket(); }
void priv_initialize_cache(detail::bool_<false>)
{}
@@ -2327,8 +2563,8 @@
void priv_insertion_update_cache(size_type insertion_bucket, detail::bool_<true>)
{
bucket_ptr p = priv_buckets() + insertion_bucket;
- if(p < this->bucket_hash_equal_.cached_begin_){
- this->bucket_hash_equal_.cached_begin_ = p;
+ if(p < this->data_.internal_.bucket_hash_equal_.cached_begin_){
+ this->data_.internal_.bucket_hash_equal_.cached_begin_ = p;
}
}
@@ -2361,11 +2597,11 @@
priv_initialize_cache();
}
else{
- size_type current_n = this->bucket_hash_equal_.cached_begin_ - priv_buckets();
+ size_type current_n = this->data_.internal_.bucket_hash_equal_.cached_begin_ - priv_buckets();
for( const size_type num_buckets = this->priv_buckets_len()
; current_n < num_buckets
- ; ++current_n, ++this->bucket_hash_equal_.cached_begin_){
- if(!this->bucket_hash_equal_.cached_begin_->empty()){
+ ; ++current_n, ++this->data_.internal_.bucket_hash_equal_.cached_begin_){
+ if(!this->data_.internal_.bucket_hash_equal_.cached_begin_->empty()){
return;
}
}
@@ -2378,8 +2614,8 @@
void priv_swap_cache(detail::bool_<true>, hashtable_impl &other)
{
- std::swap( this->bucket_hash_equal_.cached_begin_
- , other.bucket_hash_equal_.cached_begin_);
+ std::swap( this->data_.internal_.bucket_hash_equal_.cached_begin_
+ , other.data_.internal_.bucket_hash_equal_.cached_begin_);
}
void priv_swap_cache(detail::bool_<false>, hashtable_impl &)
@@ -2389,7 +2625,7 @@
{ return priv_get_cache(cache_begin_t()); }
bucket_ptr priv_get_cache(detail::bool_<true>)
- { return this->bucket_hash_equal_.cached_begin_; }
+ { return this->data_.internal_.bucket_hash_equal_.cached_begin_; }
bucket_ptr priv_get_cache(detail::bool_<false>)
{ return this->priv_buckets(); }
@@ -2398,7 +2634,7 @@
{ priv_set_cache(p, cache_begin_t()); }
void priv_set_cache(bucket_ptr p, detail::bool_<true>)
- { this->bucket_hash_equal_.cached_begin_ = p; }
+ { this->data_.internal_.bucket_hash_equal_.cached_begin_ = p; }
void priv_set_cache(bucket_ptr, detail::bool_<false>)
{}
@@ -2407,7 +2643,7 @@
{ return priv_get_cache_bucket_num(cache_begin_t()); }
size_type priv_get_cache_bucket_num(detail::bool_<true>)
- { return this->bucket_hash_equal_.cached_begin_ - this->priv_buckets(); }
+ { return this->data_.internal_.bucket_hash_equal_.cached_begin_ - this->priv_buckets(); }
size_type priv_get_cache_bucket_num(detail::bool_<false>)
{ return 0u; }
@@ -2420,10 +2656,7 @@
}
void priv_initialize_buckets()
- {
- this->priv_clear_buckets
- ( priv_buckets(), this->priv_buckets_len());
- }
+ { this->priv_clear_buckets(priv_buckets(), this->priv_buckets_len()); }
void priv_clear_buckets(bucket_ptr buckets_ptr, size_type buckets_len)
{
@@ -2444,21 +2677,28 @@
( const KeyType &key, KeyHasher hash_func
, KeyValueEqual equal_func, size_type &bucket_number, std::size_t &h, siterator &previt) const
{
- bucket_number = priv_hash_to_bucket((h = hash_func(key)));
+ h = hash_func(key);
+ return priv_find_with_hash(key, equal_func, bucket_number, h, previt);
+ }
+ template<class KeyType, class KeyValueEqual>
+ siterator priv_find_with_hash
+ ( const KeyType &key, KeyValueEqual equal_func, size_type &bucket_number, const std::size_t h, siterator &previt) const
+ {
+ bucket_number = priv_hash_to_bucket(h);
+ bucket_type &b = this->priv_buckets()[bucket_number];
+ previt = b.before_begin();
if(constant_time_size && this->empty()){
return priv_invalid_local_it();
}
- bucket_type &b = this->priv_buckets()[bucket_number];
- previt = b.before_begin();
siterator it = previt;
++it;
while(it != b.end()){
const value_type &v = priv_value_from_slist_node(it.pointed_node());
if(compare_hash){
- std::size_t vh = this->priv_stored_hash(v, store_hash_t());
+ std::size_t vh = this->priv_stored_or_compute_hash(v, store_hash_t());
if(h == vh && equal_func(key, v)){
return it;
}
@@ -2468,7 +2708,8 @@
}
if(optimize_multikey){
previt = bucket_type::s_iterator_to
- (*priv_get_last_in_group(dcast_bucket_ptr(it.pointed_node())));
+ (*group_functions_t::priv_get_last_in_group
+ (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t()));
it = previt;
}
else{
@@ -2476,10 +2717,45 @@
}
++it;
}
-
+ previt = b.before_begin();
return priv_invalid_local_it();
}
+ iterator priv_insert_equal_with_hash(reference value, std::size_t hash_value)
+ {
+ size_type bucket_num;
+ siterator prev;
+ siterator it = this->priv_find_with_hash
+ (value, this->priv_equal(), bucket_num, hash_value, prev);
+ return priv_insert_equal_find(value, bucket_num, hash_value, it);
+ }
+
+ iterator priv_insert_equal_find(reference value, size_type bucket_num, std::size_t hash_value, siterator it)
+ {
+ bucket_type &b = this->priv_buckets()[bucket_num];
+ bool found_equal = it != priv_invalid_local_it();
+ if(!found_equal){
+ it = b.before_begin();
+ }
+ //Now store hash if needed
+ node_ptr n = node_ptr(&priv_value_to_node(value));
+ this->priv_store_hash(n, hash_value, store_hash_t());
+ //Checks for some modes
+ if(safemode_or_autounlink)
+ BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
+ //Shorcut for optimize_multikey cases
+ if(optimize_multikey){
+ node_ptr first_in_group = found_equal ?
+ dcast_bucket_ptr(it.pointed_node()) : node_ptr(0);
+ this->priv_insert_in_group(first_in_group, n, optimize_multikey_t());
+ }
+ //Update cache and increment size if needed
+ priv_insertion_update_cache(bucket_num);
+ this->priv_size_traits().increment();
+ //Insert the element in the bucket after it
+ return iterator(b.insert_after(it, *n), this);
+ }
+
template<class KeyType, class KeyHasher, class KeyValueEqual>
std::pair<siterator, siterator> priv_equal_range
( const KeyType &key
@@ -2506,8 +2782,8 @@
siterator it = to_return.first;
if(optimize_multikey){
to_return.second = bucket_type::s_iterator_to
- (*node_traits::get_next(priv_get_last_in_group
- (dcast_bucket_ptr(it.pointed_node()))));
+ (*node_traits::get_next(group_functions_t::priv_get_last_in_group
+ (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t())));
count = std::distance(it, to_return.second);
if(to_return.second != b.end()){
bucket_number_second = bucket_number_first;
@@ -2520,7 +2796,7 @@
while(it != b.end()){
const value_type &v = priv_value_from_slist_node(it.pointed_node());
if(compare_hash){
- std::size_t hv = this->priv_stored_hash(v, store_hash_t());
+ std::size_t hv = this->priv_stored_or_compute_hash(v, store_hash_t());
if(hv != h || !equal_func(key, v)){
to_return.second = it;
bucket_number_second = bucket_number_first;
@@ -2556,18 +2832,28 @@
};
/// @cond
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template < class T
, bool UniqueKeys
, class O1 = none, class O2 = none
, class O3 = none, class O4 = none
, class O5 = none, class O6 = none
, class O7 = none, class O8 = none
- , class O9 = none
+ , class O9 = none, class O10= none
>
+#else
+template <class T, bool UniqueKeys, class ...Options>
+#endif
struct make_hashtable_opt
{
typedef typename pack_options
- < uset_defaults<T>, O1, O2, O3, O4, O5, O6, O7, O8, O9>::type packed_options;
+ < uset_defaults<T>,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
+ #else
+ Options...
+ #endif
+ >::type packed_options;
//Real value traits must be calculated from options
typedef typename detail::get_value_traits
@@ -2598,31 +2884,32 @@
, specified_bucket_traits
>::type real_bucket_traits;
- typedef usetopt
+ typedef detail::usetopt
< value_traits
- , UniqueKeys
, typename packed_options::hash
, typename packed_options::equal
, typename packed_options::size_type
- , packed_options::constant_time_size
, real_bucket_traits
- , packed_options::power_2_buckets
- , packed_options::cache_begin
- , packed_options::compare_hash
+ , (std::size_t(UniqueKeys)*detail::hash_bool_flags::unique_keys_pos)
+ | (std::size_t(packed_options::constant_time_size)*detail::hash_bool_flags::constant_time_size_pos)
+ | (std::size_t(packed_options::power_2_buckets)*detail::hash_bool_flags::power_2_buckets_pos)
+ | (std::size_t(packed_options::cache_begin)*detail::hash_bool_flags::cache_begin_pos)
+ | (std::size_t(packed_options::compare_hash)*detail::hash_bool_flags::compare_hash_pos)
+ | (std::size_t(packed_options::incremental)*detail::hash_bool_flags::incremental_pos)
> type;
};
/// @endcond
//! Helper metafunction to define a \c hashtable that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
, class O3 = none, class O4 = none
, class O5 = none, class O6 = none
, class O7 = none, class O8 = none
- , class O9 = none
+ , class O9 = none, class O10= none
>
#endif
struct make_hashtable
@@ -2630,20 +2917,42 @@
/// @cond
typedef hashtable_impl
< typename make_hashtable_opt
- <T, false, O1, O2, O3, O4, O5, O6, O7, O8, O9>::type
+ <T, false,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
-#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
-template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7, class O8, class O9>
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
+
+#if defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+template<class T, class ...Options>
+#else
+template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7, class O8, class O9, class O10>
+#endif
class hashtable
- : public make_hashtable<T, O1, O2, O3, O4, O5, O6, O7, O8, O9>::type
-{
- typedef typename make_hashtable
- <T, O1, O2, O3, O4, O5, O6, O7, O8, O9>::type Base;
+ : public make_hashtable<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
+ #else
+ Options...
+ #endif
+ >::type
+{
+ typedef typename make_hashtable<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
+ #else
+ Options...
+ #endif
+ >::type Base;
public:
typedef typename Base::value_traits value_traits;
@@ -2669,7 +2978,6 @@
#endif
-
} //namespace intrusive
} //namespace boost
Modified: sandbox/metagraph/boost/intrusive/intrusive_fwd.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/intrusive_fwd.hpp (original)
+++ sandbox/metagraph/boost/intrusive/intrusive_fwd.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -15,26 +15,12 @@
#include <cstddef>
#include <boost/intrusive/link_mode.hpp>
+#include <boost/intrusive/detail/workaround.hpp>
/// @cond
-//std predeclarations
-namespace std{
-
-template<class T>
-struct equal_to;
-
-template<class T>
-struct less;
-
-} //namespace std{
-
namespace boost {
-//Hash predeclaration
-template<class T>
-struct hash;
-
namespace intrusive {
struct none;
@@ -64,6 +50,7 @@
////////////////////////////
//slist
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -72,46 +59,70 @@
, class O4 = none
, class O5 = none
>
+#else
+template<class T, class ...Options>
+#endif
class slist;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
>
+#else
+template<class ...Options>
+#endif
class slist_base_hook;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
>
+#else
+template<class ...Options>
+#endif
class slist_member_hook;
//list
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
, class O2 = none
, class O3 = none
>
+#else
+template<class T, class ...Options>
+#endif
class list;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
>
+#else
+template<class ...Options>
+#endif
class list_base_hook;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
>
+#else
+template<class ...Options>
+#endif
class list_member_hook;
//rbtree/set/multiset
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -119,8 +130,12 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class rbtree;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -128,8 +143,12 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class set;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -137,25 +156,37 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class multiset;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
, class O4 = none
>
+#else
+template<class ...Options>
+#endif
class set_base_hook;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
, class O4 = none
>
+#else
+template<class ...Options>
+#endif
class set_member_hook;
//splaytree/splay_set/splay_multiset
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -163,8 +194,12 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class splaytree;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -172,8 +207,12 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class splay_set;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -181,23 +220,35 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class splay_multiset;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
>
+#else
+template<class ...Options>
+#endif
class splay_set_base_hook;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
>
+#else
+template<class ...Options>
+#endif
class splay_set_member_hook;
//avltree/avl_set/avl_multiset
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -205,8 +256,12 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class avltree;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -214,8 +269,12 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class avl_set;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -223,25 +282,37 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class avl_multiset;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
, class O4 = none
>
+#else
+template<class ...Options>
+#endif
class avl_set_base_hook;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
, class O4 = none
>
+#else
+template<class ...Options>
+#endif
class avl_set_member_hook;
//sgtree/sg_set/sg_multiset
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -249,8 +320,12 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class sgtree;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -258,8 +333,12 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class sg_set;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -267,23 +346,36 @@
, class O3 = none
, class O4 = none
>
+#else
+template<class T, class ...Options>
+#endif
class sg_multiset;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
>
+#else
+template<class ...Options>
+#endif
class bs_set_base_hook;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
>
+#else
+template<class ...Options>
+#endif
class bs_set_member_hook;
//hashtable/unordered_set/unordered_multiset
+
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -295,9 +387,14 @@
, class O7 = none
, class O8 = none
, class O9 = none
+ , class O10 = none
>
+#else
+template<class T, class ...Options>
+#endif
class hashtable;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -309,9 +406,14 @@
, class O7 = none
, class O8 = none
, class O9 = none
+ , class O10 = none
>
+#else
+template<class T, class ...Options>
+#endif
class unordered_set;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class T
, class O1 = none
@@ -323,37 +425,57 @@
, class O7 = none
, class O8 = none
, class O9 = none
+ , class O10 = none
>
+#else
+template<class T, class ...Options>
+#endif
class unordered_multiset;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
, class O4 = none
>
+#else
+template<class ...Options>
+#endif
class unordered_set_base_hook;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
, class O4 = none
>
+#else
+template<class ...Options>
+#endif
class unordered_set_member_hook;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
>
+#else
+template<class ...Options>
+#endif
class any_base_hook;
+#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template
< class O1 = none
, class O2 = none
, class O3 = none
>
+#else
+template<class ...Options>
+#endif
class any_member_hook;
} //namespace intrusive {
Modified: sandbox/metagraph/boost/intrusive/linear_slist_algorithms.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/linear_slist_algorithms.hpp (original)
+++ sandbox/metagraph/boost/intrusive/linear_slist_algorithms.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -58,7 +58,7 @@
typedef typename NodeTraits::const_node_ptr const_node_ptr;
typedef NodeTraits node_traits;
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: Constructs an non-used list element, putting the next
//! pointer to null:
@@ -127,7 +127,7 @@
//! <b>Throws</b>: Nothing.
static void transfer_after(node_ptr p, node_ptr b, node_ptr e);
- #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: Constructs an empty list, making this_node the only
//! node of the circular list:
Modified: sandbox/metagraph/boost/intrusive/list.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/list.hpp (original)
+++ sandbox/metagraph/boost/intrusive/list.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -35,20 +35,6 @@
/// @cond
-template <class T>
-struct internal_default_list_hook
-{
- template <class U> static detail::one test(...);
- template <class U> static detail::two test(typename U::default_list_hook* = 0);
- static const bool value = sizeof(test<T>(0)) == sizeof(detail::two);
-};
-
-template <class T>
-struct get_default_list_hook
-{
- typedef typename T::default_list_hook type;
-};
-
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
struct listopt
{
@@ -57,17 +43,12 @@
static const bool constant_time_size = ConstantTimeSize;
};
+
template <class T>
struct list_defaults
: pack_options
< none
- , base_hook
- < typename detail::eval_if_c
- < internal_default_list_hook<T>::value
- , get_default_list_hook<T>
- , detail::identity<none>
- >::type
- >
+ , base_hook<detail::default_list_hook>
, constant_time_size<true>
, size_type<std::size_t>
>::type
@@ -85,7 +66,7 @@
//! The container supports the following options:
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<> and \c size_type<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -225,7 +206,7 @@
{
this->priv_size_traits().set_size(size_type(0));
node_algorithms::init_header(this->get_root_node());
- this->insert(this->end(), b, e);
+ this->insert(this->cend(), b, e);
}
//! <b>Effects</b>: If it's not a safe-mode or an auto-unlink value_type
@@ -583,7 +564,7 @@
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
- iterator erase(iterator i)
+ iterator erase(const_iterator i)
{ return this->erase_and_dispose(i, detail::null_disposer()); }
//! <b>Requires</b>: b and e must be valid iterators to elements in *this.
@@ -601,14 +582,14 @@
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
- iterator erase(iterator b, iterator e)
+ iterator erase(const_iterator b, const_iterator e)
{
if(safemode_or_autounlink || constant_time_size){
return this->erase_and_dispose(b, e, detail::null_disposer());
}
else{
node_algorithms::unlink(b.pointed_node(), e.pointed_node());
- return e;
+ return e.unconst();
}
}
@@ -628,7 +609,7 @@
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
- iterator erase(iterator b, iterator e, difference_type n)
+ iterator erase(const_iterator b, const_iterator e, difference_type n)
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(b, e) == difference_type(n));
if(safemode_or_autounlink || constant_time_size){
@@ -639,7 +620,7 @@
this->priv_size_traits().set_size(this->priv_size_traits().get_size() - n);
}
node_algorithms::unlink(b.pointed_node(), e.pointed_node());
- return e;
+ return e.unconst();
}
}
@@ -658,7 +639,7 @@
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template <class Disposer>
- iterator erase_and_dispose(iterator i, Disposer disposer)
+ iterator erase_and_dispose(const_iterator i, Disposer disposer)
{
node_ptr to_erase(i.pointed_node());
++i;
@@ -667,7 +648,7 @@
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(this->get_real_value_traits().to_value_ptr(to_erase));
- return i;
+ return i.unconst();
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
@@ -685,7 +666,7 @@
//!
//! <b>Note</b>: Invalidates the iterators to the erased elements.
template <class Disposer>
- iterator erase_and_dispose(iterator b, iterator e, Disposer disposer)
+ iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer)
{
node_ptr bp(b.pointed_node()), ep(e.pointed_node());
node_algorithms::unlink(bp, ep);
@@ -697,7 +678,7 @@
disposer(get_real_value_traits().to_value_ptr(to_erase));
this->priv_size_traits().decrement();
}
- return e;
+ return e.unconst();
}
//! <b>Effects</b>: Erases all the elements of the container.
@@ -734,7 +715,7 @@
template <class Disposer>
void clear_and_dispose(Disposer disposer)
{
- iterator it(this->begin()), itend(this->end());
+ const_iterator it(this->begin()), itend(this->end());
while(it != itend){
node_ptr to_erase(it.pointed_node());
++it;
@@ -747,6 +728,7 @@
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
@@ -783,7 +765,7 @@
//! <b>Complexity</b>: Constant time. No copy constructors are called.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- iterator insert(iterator p, reference value)
+ iterator insert(const_iterator p, reference value)
{
node_ptr to_insert = this->get_real_value_traits().to_node_ptr(value);
if(safemode_or_autounlink)
@@ -805,7 +787,7 @@
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator>
- void insert(iterator p, Iterator b, Iterator e)
+ void insert(const_iterator p, Iterator b, Iterator e)
{
for (; b != e; ++b)
this->insert(p, *b);
@@ -830,7 +812,7 @@
void assign(Iterator b, Iterator e)
{
this->clear();
- this->insert(this->end(), b, e);
+ this->insert(this->cend(), b, e);
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
@@ -853,7 +835,7 @@
void dispose_and_assign(Disposer disposer, Iterator b, Iterator e)
{
this->clear_and_dispose(disposer);
- this->insert(this->end(), b, e);
+ this->insert(this->cend(), b, e);
}
//! <b>Requires</b>: p must be a valid iterator of *this.
@@ -867,7 +849,7 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
- void splice(iterator p, list_impl& x)
+ void splice(const_iterator p, list_impl& x)
{
if(!x.empty()){
size_traits &thist = this->priv_size_traits();
@@ -892,7 +874,7 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice(iterator p, list_impl&x, iterator new_ele)
+ void splice(const_iterator p, list_impl&x, const_iterator new_ele)
{
node_algorithms::transfer(p.pointed_node(), new_ele.pointed_node());
x.priv_size_traits().decrement();
@@ -912,7 +894,7 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice(iterator p, list_impl&x, iterator start, iterator end)
+ void splice(const_iterator p, list_impl&x, const_iterator start, const_iterator end)
{
if(constant_time_size)
this->splice(p, x, start, end, std::distance(start, end));
@@ -933,7 +915,7 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice(iterator p, list_impl&x, iterator start, iterator end, difference_type n)
+ void splice(const_iterator p, list_impl&x, const_iterator start, const_iterator end, difference_type n)
{
if(n){
if(constant_time_size){
@@ -988,7 +970,7 @@
list_impl counter[64];
int fill = 0;
while(!this->empty()){
- carry.splice(carry.begin(), *this, this->begin());
+ carry.splice(carry.cbegin(), *this, this->cbegin());
int i = 0;
while(i < fill && !counter[i].empty()) {
carry.merge(counter[i++], p);
@@ -1034,13 +1016,13 @@
template<class Predicate>
void merge(list_impl& x, Predicate p)
{
- iterator e(this->end());
- iterator bx(x.begin());
- iterator ex(x.end());
+ const_iterator e(this->end());
+ const_iterator bx(x.begin());
+ const_iterator ex(x.end());
- for (iterator b = this->begin(); b != e; ++b) {
+ for (const_iterator b = this->cbegin(); b != e; ++b) {
size_type n(0);
- iterator ix(bx);
+ const_iterator ix(bx);
while(ix != ex && p(*ix, *b)){
++ix; ++n;
}
@@ -1116,8 +1098,8 @@
template<class Pred, class Disposer>
void remove_and_dispose_if(Pred pred, Disposer disposer)
{
- iterator cur(this->begin());
- iterator last(this->end());
+ const_iterator cur(this->cbegin());
+ const_iterator last(this->cend());
while(cur != last) {
if(pred(*cur)){
cur = this->erase_and_dispose(cur, disposer);
@@ -1185,11 +1167,11 @@
template<class BinaryPredicate, class Disposer>
void unique_and_dispose(BinaryPredicate pred, Disposer disposer)
{
- iterator itend(this->end());
- iterator cur(this->begin());
+ const_iterator itend(this->cend());
+ const_iterator cur(this->cbegin());
if(cur != itend){
- iterator after(cur);
+ const_iterator after(cur);
++after;
while(after != itend){
if(pred(*cur, *after)){
@@ -1284,26 +1266,26 @@
/// @endcond
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
#endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
bool operator==
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
@@ -1336,65 +1318,65 @@
}
}
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(list_impl<T, Options...> &x, list_impl<T, Options...> &y)
#else
(list_impl<Config> &x, list_impl<Config> &y)
@@ -1403,7 +1385,7 @@
//! Helper metafunction to define a \c list that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none, class O3 = none>
@@ -1412,7 +1394,14 @@
{
/// @cond
typedef typename pack_options
- < list_defaults<T>, O1, O2, O3>::type packed_options;
+ < list_defaults<T>,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type packed_options;
+
typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits;
@@ -1430,12 +1419,29 @@
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3>
+#else
+template<class T, class ...Options>
+#endif
class list
- : public make_list<T, O1, O2, O3>::type
+ : public make_list<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_list
- <T, O1, O2, O3>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type Base;
typedef typename Base::real_value_traits real_value_traits;
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
Modified: sandbox/metagraph/boost/intrusive/list_hook.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/list_hook.hpp (original)
+++ sandbox/metagraph/boost/intrusive/list_hook.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -35,7 +35,7 @@
//! Helper metafunction to define a \c \c list_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none>
@@ -44,7 +44,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3>::type packed_options;
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef detail::generic_hook
< get_list_node_algo<typename packed_options::void_pointer>
@@ -72,15 +78,21 @@
//!
//! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this hook.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3>
#endif
class list_base_hook
- : public make_list_base_hook<O1, O2, O3>::type
+ : public make_list_base_hook
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <O1, O2, O3>
+ #else
+ <Options...>
+ #endif
+ ::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
@@ -149,7 +161,7 @@
//! Helper metafunction to define a \c \c list_member_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none>
@@ -158,7 +170,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3>::type packed_options;
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef detail::generic_hook
< get_list_node_algo<typename packed_options::void_pointer>
@@ -181,15 +199,21 @@
//!
//! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this hook.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3>
#endif
class list_member_hook
- : public make_list_member_hook<O1, O2, O3>::type
+ : public make_list_member_hook
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ <O1, O2, O3>
+ #else
+ <Options...>
+ #endif
+ ::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
Modified: sandbox/metagraph/boost/intrusive/options.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/options.hpp (original)
+++ sandbox/metagraph/boost/intrusive/options.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -31,6 +31,26 @@
namespace detail{
+struct default_hook_tag{};
+
+#define BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER) \
+struct BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER : public default_hook_tag\
+{\
+ template <class T>\
+ struct apply\
+ { typedef typename T::BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER type; };\
+}\
+
+BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_list_hook);
+BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_slist_hook);
+BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_set_hook);
+BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_uset_hook);
+BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_avl_set_hook);
+BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_splay_set_hook);
+BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_bs_set_hook);
+
+#undef BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION
+
template <class ValueTraits>
struct eval_value_traits
{
@@ -116,8 +136,12 @@
template<class T, class SupposedValueTraits>
struct get_value_traits
{
- typedef SupposedValueTraits supposed_value_traits;
- //...if it's a base hook
+ typedef typename detail::eval_if_c
+ <detail::is_convertible<SupposedValueTraits*, detail::default_hook_tag*>::value
+ ,detail::apply<SupposedValueTraits, T>
+ ,detail::identity<SupposedValueTraits>
+ >::type supposed_value_traits;
+ //...if it's a default hook
typedef typename detail::eval_if_c
< internal_base_hook_bool_is_true<supposed_value_traits>::value
//...get it's internal value traits using
@@ -336,7 +360,7 @@
};
//!This option setter specifies the type of
-//!the tag of a base hook. A type can not have two
+//!the tag of a base hook. A type cannot have two
//!base hooks of the same type, so a tag can be used
//!to differentiate two base hooks with otherwise same type
template<class Tag>
@@ -509,8 +533,29 @@
/// @endcond
};
+//!This option setter specifies if the hash container will use incremental
+//!hashing. With incremental hashing the cost of hash table expansion is spread
+//!out across each hash table insertion operation, as opposed to be incurred all at once.
+//!Therefore linear hashing is well suited for interactive applications or real-time
+//!appplications where the worst-case insertion time of non-incremental hash containers
+//!(rehashing the whole bucket array) is not admisible.
+template<bool Enabled>
+struct incremental
+{
+ /// @cond
+ template<class Base>
+ struct pack : Base
+ {
+ static const bool incremental = Enabled;
+ };
+ /// @endcond
+};
+
/// @cond
+//To-do: pass to variadic templates
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+
template<class Prev, class Next>
struct do_pack
{
@@ -525,7 +570,6 @@
typedef Prev type;
};
-
template
< class DefaultOptions
, class O1 = none
@@ -537,7 +581,8 @@
, class O7 = none
, class O8 = none
, class O9 = none
- , class Option10 = none
+ , class O10 = none
+ , class O11 = none
>
struct pack_options
{
@@ -553,29 +598,164 @@
< typename do_pack
< typename do_pack
< typename do_pack
- < DefaultOptions
- , O1
+ < typename do_pack
+ < DefaultOptions
+ , O1
+ >::type
+ , O2
>::type
- , O2
+ , O3
>::type
- , O3
+ , O4
>::type
- , O4
+ , O5
>::type
- , O5
+ , O6
>::type
- , O6
+ , O7
>::type
- , O7
+ , O8
>::type
- , O8
+ , O9
>::type
- , O9
- >::type
- , Option10
+ , O10
+ >::type
+ , O11
>::type
type;
};
+#else
+
+//index_tuple
+template<int... Indexes>
+struct index_tuple{};
+
+//build_number_seq
+template<std::size_t Num, typename Tuple = index_tuple<> >
+struct build_number_seq;
+
+template<std::size_t Num, int... Indexes>
+struct build_number_seq<Num, index_tuple<Indexes...> >
+ : build_number_seq<Num - 1, index_tuple<Indexes..., sizeof...(Indexes)> >
+{};
+
+template<int... Indexes>
+struct build_number_seq<0, index_tuple<Indexes...> >
+{ typedef index_tuple<Indexes...> type; };
+
+template<class ...Types>
+struct typelist
+{};
+
+//invert_typelist
+template<class T>
+struct invert_typelist;
+
+template<int I, typename Tuple>
+struct typelist_element;
+
+template<int I, typename Head, typename... Tail>
+struct typelist_element<I, typelist<Head, Tail...> >
+{
+ typedef typename typelist_element<I-1, typelist<Tail...> >::type type;
+};
+
+template<typename Head, typename... Tail>
+struct typelist_element<0, typelist<Head, Tail...> >
+{
+ typedef Head type;
+};
+
+template<int ...Ints, class ...Types>
+typelist<typename typelist_element<(sizeof...(Types) - 1) - Ints, typelist<Types...> >::type...>
+ inverted_typelist(index_tuple<Ints...>, typelist<Types...>)
+{
+ return typelist<typename typelist_element<(sizeof...(Types) - 1) - Ints, typelist<Types...> >::type...>();
+}
+
+//sizeof_typelist
+template<class Typelist>
+struct sizeof_typelist;
+
+template<class ...Types>
+struct sizeof_typelist< typelist<Types...> >
+{
+ static const std::size_t value = sizeof...(Types);
+};
+
+//invert_typelist_impl
+template<class Typelist, class Indexes>
+struct invert_typelist_impl;
+
+
+template<class Typelist, int ...Ints>
+struct invert_typelist_impl< Typelist, index_tuple<Ints...> >
+{
+ static const std::size_t last_idx = sizeof_typelist<Typelist>::value - 1;
+ typedef typelist
+ <typename typelist_element<last_idx - Ints, Typelist>::type...> type;
+};
+
+template<class Typelist, int Int>
+struct invert_typelist_impl< Typelist, index_tuple<Int> >
+{
+ typedef Typelist type;
+};
+
+template<class Typelist>
+struct invert_typelist_impl< Typelist, index_tuple<> >
+{
+ typedef Typelist type;
+};
+
+//invert_typelist
+template<class Typelist>
+struct invert_typelist;
+
+template<class ...Types>
+struct invert_typelist< typelist<Types...> >
+{
+ typedef typelist<Types...> typelist_t;
+ typedef typename build_number_seq<sizeof...(Types)>::type indexes_t;
+ typedef typename invert_typelist_impl<typelist_t, indexes_t>::type type;
+};
+
+//Do pack
+template<class Typelist>
+struct do_pack;
+
+template<>
+struct do_pack<typelist<> >;
+
+template<class Prev>
+struct do_pack<typelist<Prev> >
+{
+ typedef Prev type;
+};
+
+template<class Prev, class Last>
+struct do_pack<typelist<Prev, Last> >
+{
+ typedef typename Prev::template pack<Last> type;
+};
+
+template<class Prev, class ...Others>
+struct do_pack<typelist<Prev, Others...> >
+{
+ typedef typename Prev::template pack
+ <typename do_pack<typelist<Others...>>::type> type;
+};
+
+
+template<class ...Options>
+struct pack_options
+{
+ typedef typelist<Options...> typelist_t;
+ typedef typename invert_typelist<typelist_t>::type inverted_typelist;
+ typedef typename do_pack<inverted_typelist>::type type;
+};
+
+#endif
struct hook_defaults
: public pack_options
Modified: sandbox/metagraph/boost/intrusive/pointer_plus_bits.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/pointer_plus_bits.hpp (original)
+++ sandbox/metagraph/boost/intrusive/pointer_plus_bits.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -14,6 +14,7 @@
#define BOOST_INTRUSIVE_POINTER_PLUS_BITS_HPP
#include <boost/intrusive/detail/mpl.hpp> //ls_zeros
+#include <boost/intrusive/detail/assert.hpp> //BOOST_INTRUSIVE_INVARIANT_ASSERT
namespace boost {
namespace intrusive {
@@ -28,7 +29,7 @@
static const std::size_t value = 0;
};
-//!This is an specialization for raw pointers.
+//!This is a specialization for raw pointers.
//!Raw pointers can embed extra bits in the lower bits
//!if the alignment is multiple of 2pow(NumBits).
template<std::size_t Alignment>
@@ -61,7 +62,7 @@
static void set_pointer(pointer &n, pointer p)
{
- assert(0 == (std::size_t(p) & Mask));
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(0 == (std::size_t(p) & Mask));
n = pointer(std::size_t(p) | (std::size_t(n) & Mask));
}
@@ -70,7 +71,7 @@
static void set_bits(pointer &n, std::size_t c)
{
- assert(c <= Mask);
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(c <= Mask);
n = pointer(std::size_t(get_pointer(n)) | c);
}
};
Modified: sandbox/metagraph/boost/intrusive/rbtree.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/rbtree.hpp (original)
+++ sandbox/metagraph/boost/intrusive/rbtree.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -36,20 +36,6 @@
/// @cond
-template <class T>
-struct internal_default_set_hook
-{
- template <class U> static detail::one test(...);
- template <class U> static detail::two test(typename U::default_set_hook* = 0);
- static const bool value = sizeof(test<T>(0)) == sizeof(detail::two);
-};
-
-template <class T>
-struct get_default_set_hook
-{
- typedef typename T::default_set_hook type;
-};
-
template <class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize>
struct setopt
{
@@ -63,13 +49,7 @@
struct set_defaults
: pack_options
< none
- , base_hook
- < typename detail::eval_if_c
- < internal_default_set_hook<T>::value
- , get_default_set_hook<T>
- , detail::identity<none>
- >::type
- >
+ , base_hook<detail::default_set_hook>
, constant_time_size<true>
, size_type<std::size_t>
, compare<std::less<T> >
@@ -91,7 +71,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -1055,29 +1035,34 @@
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const rbtree_impl &src, Cloner cloner, Disposer disposer)
{
this->clear_and_dispose(disposer);
if(!src.empty()){
+ detail::exception_disposer<rbtree_impl, Disposer>
+ rollback(*this, disposer);
node_algorithms::clone
(const_node_ptr(&src.priv_header())
,node_ptr(&this->priv_header())
,detail::node_cloner<Cloner, rbtree_impl>(cloner, this)
,detail::node_disposer<Disposer, rbtree_impl>(disposer, this));
this->priv_size_traits().set_size(src.priv_size_traits().get_size());
+ this->priv_comp() = src.priv_comp();
+ rollback.release();
}
}
@@ -1253,26 +1238,26 @@
{ return priv_container_from_end_iterator(it.end_iterator_from_it()); }
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
#endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
bool operator==
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
@@ -1304,65 +1289,65 @@
}
}
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(rbtree_impl<T, Options...> &x, rbtree_impl<T, Options...> &y)
#else
(rbtree_impl<Config> &x, rbtree_impl<Config> &y)
@@ -1370,15 +1355,23 @@
{ x.swap(y); }
/// @cond
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1 = none, class O2 = none
, class O3 = none, class O4 = none
- , class O5 = none, class O6 = none
- , class O7 = none
>
+#else
+template<class T, class ...Options>
+#endif
struct make_rbtree_opt
{
typedef typename pack_options
- < set_defaults<T>, O1, O2, O3, O4>::type packed_options;
+ < set_defaults<T>,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits;
@@ -1393,7 +1386,7 @@
//! Helper metafunction to define a \c rbtree that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -1403,19 +1396,42 @@
{
/// @cond
typedef rbtree_impl
- < typename make_rbtree_opt<T, O1, O2, O3, O4>::type
+ < typename make_rbtree_opt<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class rbtree
- : public make_rbtree<T, O1, O2, O3, O4>::type
+ : public make_rbtree<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_rbtree
- <T, O1, O2, O3, O4>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type Base;
public:
typedef typename Base::value_compare value_compare;
Modified: sandbox/metagraph/boost/intrusive/set.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/set.hpp (original)
+++ sandbox/metagraph/boost/intrusive/set.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -32,7 +32,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -324,18 +324,19 @@
{ tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
@@ -997,65 +998,65 @@
/// @endcond
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const set_impl<T, Options...> &x, const set_impl<T, Options...> &y)
#else
(const set_impl<Config> &x, const set_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const set_impl<T, Options...> &x, const set_impl<T, Options...> &y)
#else
(const set_impl<Config> &x, const set_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const set_impl<T, Options...> &x, const set_impl<T, Options...> &y)
#else
(const set_impl<Config> &x, const set_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const set_impl<T, Options...> &x, const set_impl<T, Options...> &y)
#else
(const set_impl<Config> &x, const set_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(set_impl<T, Options...> &x, set_impl<T, Options...> &y)
#else
(set_impl<Config> &x, set_impl<Config> &y)
@@ -1064,7 +1065,7 @@
//! Helper metafunction to define a \c set that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -1074,19 +1075,41 @@
{
/// @cond
typedef set_impl
- < typename make_rbtree_opt<T, O1, O2, O3, O4>::type
+ < typename make_rbtree_opt<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class set
- : public make_set<T, O1, O2, O3, O4>::type
+ : public make_set<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_set
- <T, O1, O2, O3, O4>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type Base;
public:
typedef typename Base::value_compare value_compare;
@@ -1135,7 +1158,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -1423,18 +1446,19 @@
{ tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws. Basic guarantee.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
@@ -2018,65 +2042,65 @@
/// @endcond
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const multiset_impl<T, Options...> &x, const multiset_impl<T, Options...> &y)
#else
(const multiset_impl<Config> &x, const multiset_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const multiset_impl<T, Options...> &x, const multiset_impl<T, Options...> &y)
#else
(const multiset_impl<Config> &x, const multiset_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const multiset_impl<T, Options...> &x, const multiset_impl<T, Options...> &y)
#else
(const multiset_impl<Config> &x, const multiset_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const multiset_impl<T, Options...> &x, const multiset_impl<T, Options...> &y)
#else
(const multiset_impl<Config> &x, const multiset_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(multiset_impl<T, Options...> &x, multiset_impl<T, Options...> &y)
#else
(multiset_impl<Config> &x, multiset_impl<Config> &y)
@@ -2085,7 +2109,7 @@
//! Helper metafunction to define a \c multiset that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -2095,19 +2119,41 @@
{
/// @cond
typedef multiset_impl
- < typename make_rbtree_opt<T, O1, O2, O3, O4>::type
+ < typename make_rbtree_opt<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class multiset
- : public make_multiset<T, O1, O2, O3, O4>::type
+ : public make_multiset<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
- typedef typename make_multiset
- <T, O1, O2, O3, O4>::type Base;
+ typedef typename make_multiset<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type Base;
public:
typedef typename Base::value_compare value_compare;
Modified: sandbox/metagraph/boost/intrusive/set_hook.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/set_hook.hpp (original)
+++ sandbox/metagraph/boost/intrusive/set_hook.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -35,7 +35,7 @@
//! Helper metafunction to define a \c set_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -44,7 +44,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3, O4>::type packed_options;
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef detail::generic_hook
< get_set_node_algo<typename packed_options::void_pointer
@@ -77,15 +83,21 @@
//!
//! \c optimize_size<> will tell the hook to optimize the hook for size instead
//! of speed.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3, class O4>
#endif
class set_base_hook
- : public make_set_base_hook<O1, O2, O3, O4>::type
+ : public make_set_base_hook<
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
@@ -154,7 +166,7 @@
//! Helper metafunction to define a \c set_member_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -163,7 +175,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3, O4>::type packed_options;
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef detail::generic_hook
< get_set_node_algo<typename packed_options::void_pointer
@@ -191,15 +209,21 @@
//!
//! \c optimize_size<> will tell the hook to optimize the hook for size instead
//! of speed.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3, class O4>
#endif
class set_member_hook
- : public make_set_member_hook<O1, O2, O3, O4>::type
+ : public make_set_member_hook<
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
Modified: sandbox/metagraph/boost/intrusive/sg_set.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/sg_set.hpp (original)
+++ sandbox/metagraph/boost/intrusive/sg_set.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -31,7 +31,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -323,18 +323,19 @@
{ tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const sg_set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
@@ -1035,65 +1036,65 @@
/// @endcond
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y)
#else
(const sg_set_impl<Config> &x, const sg_set_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y)
#else
(const sg_set_impl<Config> &x, const sg_set_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y)
#else
(const sg_set_impl<Config> &x, const sg_set_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y)
#else
(const sg_set_impl<Config> &x, const sg_set_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(sg_set_impl<T, Options...> &x, sg_set_impl<T, Options...> &y)
#else
(sg_set_impl<Config> &x, sg_set_impl<Config> &y)
@@ -1102,7 +1103,7 @@
//! Helper metafunction to define a \c sg_set that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -1112,19 +1113,42 @@
{
/// @cond
typedef sg_set_impl
- < typename make_sgtree_opt<T, O1, O2, O3, O4>::type
+ < typename make_sgtree_opt<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class sg_set
- : public make_sg_set<T, O1, O2, O3, O4>::type
+ : public make_sg_set<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_sg_set
- <T, O1, O2, O3, O4>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type Base;
public:
typedef typename Base::value_compare value_compare;
@@ -1173,7 +1197,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -1461,18 +1485,19 @@
{ tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws. Basic guarantee.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const sg_multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
@@ -2080,65 +2105,65 @@
/// @endcond
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y)
#else
(const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y)
#else
(const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y)
#else
(const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y)
#else
(const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(sg_multiset_impl<T, Options...> &x, sg_multiset_impl<T, Options...> &y)
#else
(sg_multiset_impl<Config> &x, sg_multiset_impl<Config> &y)
@@ -2147,7 +2172,7 @@
//! Helper metafunction to define a \c sg_multiset that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -2157,19 +2182,42 @@
{
/// @cond
typedef sg_multiset_impl
- < typename make_sgtree_opt<T, O1, O2, O3, O4>::type
+ < typename make_sgtree_opt<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class sg_multiset
- : public make_sg_multiset<T, O1, O2, O3, O4>::type
+ : public make_sg_multiset<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_sg_multiset
- <T, O1, O2, O3, O4>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type Base;
public:
typedef typename Base::value_compare value_compare;
Modified: sandbox/metagraph/boost/intrusive/sgtree.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/sgtree.hpp (original)
+++ sandbox/metagraph/boost/intrusive/sgtree.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -24,7 +24,7 @@
#include <functional>
#include <iterator>
#include <utility>
-#include <cmath>
+#include <boost/config/no_tr1/cmath.hpp>
#include <cstddef>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/static_assert.hpp>
@@ -151,7 +151,7 @@
void set_alpha(float)
{ //alpha CAN't be changed.
- assert(0);
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(0);
}
h_alpha_t get_h_alpha_t() const
@@ -176,13 +176,7 @@
struct sg_set_defaults
: pack_options
< none
- , base_hook
- < typename detail::eval_if_c
- < internal_default_bs_set_hook<T>::value
- , get_default_bs_set_hook<T>
- , detail::identity<none>
- >::type
- >
+ , base_hook<detail::default_bs_set_hook>
, floating_point<true>
, size_type<std::size_t>
, compare<std::less<T> >
@@ -204,7 +198,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c floating_point<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -1212,29 +1206,34 @@
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const sgtree_impl &src, Cloner cloner, Disposer disposer)
{
this->clear_and_dispose(disposer);
if(!src.empty()){
+ detail::exception_disposer<sgtree_impl, Disposer>
+ rollback(*this, disposer);
node_algorithms::clone
(const_node_ptr(&src.priv_header())
,node_ptr(&this->priv_header())
,detail::node_cloner<Cloner, sgtree_impl>(cloner, this)
,detail::node_disposer<Disposer, sgtree_impl>(disposer, this));
this->priv_size_traits().set_size(src.priv_size_traits().get_size());
+ this->priv_comp() = src.priv_comp();
+ rollback.release();
}
}
@@ -1469,26 +1468,26 @@
{ return priv_container_from_end_iterator(it.end_iterator_from_it()); }
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
#endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
bool operator==
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
@@ -1520,65 +1519,65 @@
}
}
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(sgtree_impl<T, Options...> &x, sgtree_impl<T, Options...> &y)
#else
(sgtree_impl<Config> &x, sgtree_impl<Config> &y)
@@ -1586,15 +1585,22 @@
{ x.swap(y); }
/// @cond
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1 = none, class O2 = none
- , class O3 = none, class O4 = none
- , class O5 = none, class O6 = none
- , class O7 = none
- >
+ , class O3 = none, class O4 = none>
+#else
+template<class T, class ...Options>
+#endif
struct make_sgtree_opt
{
typedef typename pack_options
- < sg_set_defaults<T>, O1, O2, O3, O4>::type packed_options;
+ < sg_set_defaults<T>,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits;
@@ -1609,7 +1615,7 @@
//! Helper metafunction to define a \c sgtree that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -1619,19 +1625,41 @@
{
/// @cond
typedef sgtree_impl
- < typename make_sgtree_opt<T, O1, O2, O3, O4>::type
+ < typename make_sgtree_opt<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class sgtree
- : public make_sgtree<T, O1, O2, O3, O4>::type
+ : public make_sgtree<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_sgtree
- <T, O1, O2, O3, O4>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type Base;
public:
typedef typename Base::value_compare value_compare;
Modified: sandbox/metagraph/boost/intrusive/sgtree_algorithms.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/sgtree_algorithms.hpp (original)
+++ sandbox/metagraph/boost/intrusive/sgtree_algorithms.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -683,7 +683,7 @@
for(std::size_t i = 1; true; ++i){
bool rebalance = false;
if(i == depth){
- assert(tree_size == count(s));
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(tree_size == count(s));
rebalance = true;
}
else if(i > h_alpha(size)){
Modified: sandbox/metagraph/boost/intrusive/slist.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/slist.hpp (original)
+++ sandbox/metagraph/boost/intrusive/slist.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -36,18 +36,6 @@
/// @cond
-template <class T>
-struct internal_default_slist_hook
-{
- template <class U> static detail::one test(...);
- template <class U> static detail::two test(typename U::default_slist_hook* = 0);
- static const bool value = sizeof(test<T>(0)) == sizeof(detail::two);
-};
-
-template <class T>
-struct get_default_slist_hook
-{ typedef typename T::default_slist_hook type; };
-
template <class ValueTraits, class SizeType, bool ConstantTimeSize, bool Linear, bool CacheLast>
struct slistopt
{
@@ -75,13 +63,7 @@
struct slist_defaults
: pack_options
< none
- , base_hook
- < typename detail::eval_if_c
- < internal_default_slist_hook<T>::value
- , get_default_slist_hook<T>
- , detail::identity<none>
- >::type
- >
+ , base_hook<detail::default_slist_hook>
, constant_time_size<true>
, linear<false>
, size_type<std::size_t>
@@ -114,7 +96,7 @@
//! the '*_after' functions, ++end() == begin() and previous(begin()) == end()
//! are defined. An new special function "before_begin()" is defined, which returns
//! an iterator that points one less the beginning of the list: ++before_begin() == begin()
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -300,7 +282,7 @@
: data_(v_traits)
{
this->set_default_constructed_state();
- this->insert_after(this->before_begin(), b, e);
+ this->insert_after(this->cbefore_begin(), b, e);
}
//! <b>Effects</b>: If it's a safe-mode
@@ -346,7 +328,7 @@
template <class Disposer>
void clear_and_dispose(Disposer disposer)
{
- iterator it(this->begin()), itend(this->end());
+ const_iterator it(this->begin()), itend(this->end());
while(it != itend){
node_ptr to_erase(it.pointed_node());
++it;
@@ -395,7 +377,7 @@
void push_back(reference value)
{
BOOST_STATIC_ASSERT((cache_last != 0));
- this->insert_after(iterator(this->get_last_node(), this), value);
+ this->insert_after(const_iterator(this->get_last_node(), this), value);
}
//! <b>Effects</b>: Erases the first element of the list.
@@ -650,6 +632,7 @@
{ this->priv_shift_forward(n, detail::bool_<linear>()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
@@ -668,7 +651,7 @@
this->clear_and_dispose(disposer);
detail::exception_disposer<slist_impl, Disposer>
rollback(*this, disposer);
- iterator prev(this->before_begin());
+ const_iterator prev(this->cbefore_begin());
const_iterator b(src.begin()), e(src.end());
for(; b != e; ++b){
prev = this->insert_after(prev, *cloner(*b));
@@ -689,7 +672,7 @@
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- iterator insert_after(iterator prev_p, reference value)
+ iterator insert_after(const_iterator prev_p, reference value)
{
node_ptr n = get_real_value_traits().to_node_ptr(value);
if(safemode_or_autounlink)
@@ -716,7 +699,7 @@
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator>
- void insert_after(iterator prev_p, Iterator first, Iterator last)
+ void insert_after(const_iterator prev_p, Iterator first, Iterator last)
{
for (; first != last; ++first)
prev_p = this->insert_after(prev_p, *first);
@@ -734,7 +717,7 @@
//! Constant-time if cache_last<> is true and p == end().
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- iterator insert(iterator p, reference value)
+ iterator insert(const_iterator p, reference value)
{ return this->insert_after(this->previous(p), value); }
//! <b>Requires</b>: Dereferencing iterator must yield
@@ -752,7 +735,7 @@
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator>
- void insert(iterator p, Iterator b, Iterator e)
+ void insert(const_iterator p, Iterator b, Iterator e)
{ return this->insert_after(this->previous(p), b, e); }
//! <b>Effects</b>: Erases the element after the element pointed by prev of
@@ -767,7 +750,7 @@
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
- iterator erase_after(iterator prev)
+ iterator erase_after(const_iterator prev)
{ return this->erase_after_and_dispose(prev, detail::null_disposer()); }
//! <b>Effects</b>: Erases the range (before_first, last) from
@@ -783,7 +766,7 @@
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
- iterator erase_after(iterator before_first, iterator last)
+ iterator erase_after(const_iterator before_first, const_iterator last)
{
if(safemode_or_autounlink || constant_time_size){
return this->erase_after_and_dispose(before_first, last, detail::null_disposer());
@@ -797,7 +780,7 @@
}
}
node_algorithms::unlink_after(bfp, lp);
- return last;
+ return last.unconst();
}
}
@@ -815,9 +798,9 @@
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
- iterator erase_after(iterator before_first, iterator last, difference_type n)
+ iterator erase_after(const_iterator before_first, const_iterator last, difference_type n)
{
- BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(++iterator(before_first), last) == difference_type(n));
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(++const_iterator(before_first), last) == difference_type(n));
if(safemode_or_autounlink){
return this->erase_after(before_first, last);
}
@@ -833,7 +816,7 @@
if(constant_time_size){
this->priv_size_traits().set_size(this->priv_size_traits().get_size() - n);
}
- return last;
+ return last.unconst();
}
}
@@ -849,7 +832,7 @@
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
- iterator erase(iterator i)
+ iterator erase(const_iterator i)
{ return this->erase_after(this->previous(i)); }
//! <b>Requires</b>: first and last must be valid iterator to elements in *this.
@@ -866,7 +849,7 @@
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
- iterator erase(iterator first, iterator last)
+ iterator erase(const_iterator first, const_iterator last)
{ return this->erase_after(this->previous(first), last); }
//! <b>Effects</b>: Erases the range [first, last) from
@@ -883,7 +866,7 @@
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
- iterator erase(iterator first, iterator last, difference_type n)
+ iterator erase(const_iterator first, const_iterator last, difference_type n)
{ return this->erase_after(this->previous(first), last, n); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
@@ -901,9 +884,9 @@
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
- iterator erase_after_and_dispose(iterator prev, Disposer disposer)
+ iterator erase_after_and_dispose(const_iterator prev, Disposer disposer)
{
- iterator it(prev);
+ const_iterator it(prev);
++it;
node_ptr to_erase(it.pointed_node());
++it;
@@ -916,16 +899,16 @@
node_algorithms::init(to_erase);
disposer(get_real_value_traits().to_value_ptr(to_erase));
this->priv_size_traits().decrement();
- return it;
+ return it.unconst();
}
/// @cond
template<class Disposer>
- static iterator s_erase_after_and_dispose(iterator prev, Disposer disposer)
+ static iterator s_erase_after_and_dispose(const_iterator prev, Disposer disposer)
{
BOOST_STATIC_ASSERT(((!cache_last)&&(!constant_time_size)&&(!stateful_value_traits)));
- iterator it(prev);
+ const_iterator it(prev);
++it;
node_ptr to_erase(it.pointed_node());
++it;
@@ -934,10 +917,10 @@
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(real_value_traits::to_value_ptr(to_erase));
- return it;
+ return it.unconst();
}
- static iterator s_erase_after(iterator prev)
+ static iterator s_erase_after(const_iterator prev)
{ return s_erase_after_and_dispose(prev, detail::null_disposer()); }
/// @endcond
@@ -957,7 +940,7 @@
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
- iterator erase_after_and_dispose(iterator before_first, iterator last, Disposer disposer)
+ iterator erase_after_and_dispose(const_iterator before_first, const_iterator last, Disposer disposer)
{
node_ptr bfp(before_first.pointed_node()), lp(last.pointed_node());
node_ptr fp(node_traits::get_next(bfp));
@@ -973,7 +956,7 @@
if(cache_last && (node_traits::get_next(bfp) == this->get_end_node())){
this->set_last_node(bfp);
}
- return last;
+ return last.unconst();
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
@@ -992,7 +975,7 @@
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
template<class Disposer>
- iterator erase_and_dispose(iterator i, Disposer disposer)
+ iterator erase_and_dispose(const_iterator i, Disposer disposer)
{ return this->erase_after_and_dispose(this->previous(i), disposer); }
//! <b>Requires</b>: first and last must be valid iterator to elements in *this.
@@ -1013,7 +996,7 @@
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
template<class Disposer>
- iterator erase_and_dispose(iterator first, iterator last, Disposer disposer)
+ iterator erase_and_dispose(const_iterator first, const_iterator last, Disposer disposer)
{ return this->erase_after_and_dispose(this->previous(first), last, disposer); }
//! <b>Requires</b>: Dereferencing iterator must yield
@@ -1035,7 +1018,7 @@
void assign(Iterator b, Iterator e)
{
this->clear();
- this->insert_after(this->before_begin(), b, e);
+ this->insert_after(this->cbefore_begin(), b, e);
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
@@ -1058,7 +1041,7 @@
void dispose_and_assign(Disposer disposer, Iterator b, Iterator e)
{
this->clear_and_dispose(disposer);
- this->insert_after(this->before_begin(), b, e, disposer);
+ this->insert_after(this->cbefore_begin(), b, e, disposer);
}
//! <b>Requires</b>: prev is an iterator to an element or x.end()/x.before_begin() in x.
@@ -1077,10 +1060,10 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- iterator splice_after(iterator prev, slist_impl &x)
+ iterator splice_after(const_iterator prev, slist_impl &x)
{
if (!x.empty()){
- iterator last_x(x.previous(x.end())); //<- constant time if cache_last is active
+ const_iterator last_x(x.previous(x.end())); //<- constant time if cache_last is active
node_ptr prev_n(prev.pointed_node());
node_ptr last_x_n(last_x.pointed_node());
if(cache_last){
@@ -1092,10 +1075,10 @@
node_algorithms::transfer_after( prev_n, x.before_begin().pointed_node(), last_x_n);
this->priv_size_traits().set_size(this->priv_size_traits().get_size() + x.priv_size_traits().get_size());
x.priv_size_traits().set_size(size_type(0));
- return last_x;
+ return last_x.unconst();
}
else{
- return prev;
+ return prev.unconst();
}
}
@@ -1112,9 +1095,9 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice_after(iterator prev_pos, slist_impl &x, iterator prev_ele)
+ void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator prev_ele)
{
- iterator elem = prev_ele;
+ const_iterator elem = prev_ele;
this->splice_after(prev_pos, x, prev_ele, ++elem, 1);
}
@@ -1133,7 +1116,7 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice_after(iterator prev_pos, slist_impl &x, iterator before_first, iterator before_last)
+ void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_first, const_iterator before_last)
{
if(constant_time_size)
this->splice_after(prev_pos, x, before_first, before_last, std::distance(before_first, before_last));
@@ -1156,7 +1139,7 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice_after(iterator prev_pos, slist_impl &x, iterator before_first, iterator before_last, difference_type n)
+ void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_first, const_iterator before_last, difference_type n)
{
if(n){
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(before_first, before_last) == n);
@@ -1188,7 +1171,7 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- iterator splice(iterator it, slist_impl &x)
+ iterator splice(const_iterator it, slist_impl &x)
{ return this->splice_after(this->previous(it), x); }
//! <b>Requires</b>: it p must be a valid iterator of *this.
@@ -1205,7 +1188,7 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice(iterator pos, slist_impl &x, iterator elem)
+ void splice(const_iterator pos, slist_impl &x, const_iterator elem)
{ return this->splice_after(this->previous(pos), x, x.previous(elem)); }
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this
@@ -1225,7 +1208,7 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice(iterator pos, slist_impl &x, iterator first, iterator last)
+ void splice(const_iterator pos, slist_impl &x, const_iterator first, const_iterator last)
{ return this->splice_after(this->previous(pos), x, x.previous(first), x.previous(last)); }
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this
@@ -1244,7 +1227,7 @@
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice(iterator pos, slist_impl &x, iterator first, iterator last, difference_type n)
+ void splice(const_iterator pos, slist_impl &x, const_iterator first, const_iterator last, difference_type n)
{ return this->splice_after(this->previous(pos), x, x.previous(first), x.previous(last), n); }
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
@@ -1266,10 +1249,10 @@
slist_impl carry;
slist_impl counter[64];
int fill = 0;
- iterator last_inserted;
+ const_iterator last_inserted;
while(!this->empty()){
- last_inserted = this->begin();
- carry.splice_after(carry.before_begin(), *this, this->before_begin());
+ last_inserted = this->cbegin();
+ carry.splice_after(carry.cbefore_begin(), *this, this->cbefore_begin());
int i = 0;
while(i < fill && !counter[i].empty()) {
last_inserted = carry.merge(counter[i++], p);
@@ -1277,16 +1260,16 @@
BOOST_INTRUSIVE_INVARIANT_ASSERT(counter[i].empty());
node_ptr p = node_algorithms::get_previous_node
- (last_inserted.pointed_node(), carry.end().pointed_node());
- iterator last_element(p, this);
+ (last_inserted.pointed_node(), carry.cend().pointed_node());
+ const_iterator last_element(p, this);
if(constant_time_size){
- counter[i].splice_after( counter[i].before_begin(), carry
- , carry.before_begin(), last_element
+ counter[i].splice_after( counter[i].cbefore_begin(), carry
+ , carry.cbefore_begin(), last_element
, carry.size());
}
else{
- counter[i].splice_after( counter[i].before_begin(), carry
- , carry.before_begin(), last_element);
+ counter[i].splice_after( counter[i].cbefore_begin(), carry
+ , carry.cbefore_begin(), last_element);
}
if(i == fill)
++fill;
@@ -1298,13 +1281,13 @@
node_ptr p = node_algorithms::get_previous_node
(last_inserted.pointed_node(), counter[--fill].end().pointed_node());
- iterator last_element(p, this);
+ const_iterator last_element(p, this);
if(constant_time_size){
- this->splice_after( before_begin(), counter[fill], counter[fill].before_begin()
+ this->splice_after( cbefore_begin(), counter[fill], counter[fill].cbefore_begin()
, last_element, counter[fill].size());
}
else{
- this->splice_after( before_begin(), counter[fill], counter[fill].before_begin()
+ this->splice_after( cbefore_begin(), counter[fill], counter[fill].cbefore_begin()
, last_element);
}
}
@@ -1348,12 +1331,12 @@
template<class Predicate>
iterator merge(slist_impl& x, Predicate p)
{
- iterator a(before_begin()), e(end()), ax(x.before_begin()), ex(x.end());
- iterator last_inserted(e);
- iterator a_next;
+ const_iterator a(cbefore_begin()), e(cend()), ax(x.cbefore_begin()), ex(x.cend());
+ const_iterator last_inserted(e);
+ const_iterator a_next;
while(++(a_next = a) != e && !x.empty()) {
- iterator ix(ax);
- iterator cx;
+ const_iterator ix(ax);
+ const_iterator cx;
size_type n(0);
while(++(cx = ix) != ex && p(*cx, *a_next)){
++ix; ++n;
@@ -1367,7 +1350,7 @@
if (!x.empty()){
last_inserted = this->splice_after(a, x);
}
- return last_inserted;
+ return last_inserted.unconst();
}
//! <b>Effects</b>: This function removes all of x's elements and inserts them
@@ -1455,7 +1438,7 @@
template<class Pred, class Disposer>
void remove_and_dispose_if(Pred pred, Disposer disposer)
{
- iterator bcur(this->before_begin()), cur(this->begin()), e(this->end());
+ const_iterator bcur(this->before_begin()), cur(this->begin()), e(this->end());
while(cur != e){
if (pred(*cur)){
@@ -1528,10 +1511,10 @@
template<class BinaryPredicate, class Disposer>
void unique_and_dispose(BinaryPredicate pred, Disposer disposer)
{
- iterator end_n(this->end());
- iterator bcur(this->begin());
+ const_iterator end_n(this->cend());
+ const_iterator bcur(this->cbegin());
if(bcur != end_n){
- iterator cur(bcur);
+ const_iterator cur(bcur);
++cur;
while(cur != end_n) {
if (pred(*bcur, *cur)){
@@ -1643,7 +1626,7 @@
const_iterator previous(const_iterator i) const
{
if(cache_last && (i.pointed_node() == this->get_end_node())){
- return iterator(uncast(this->get_last_node()), this);
+ return const_iterator(uncast(this->get_last_node()), this);
}
return const_iterator
(node_algorithms::get_previous_node
@@ -1760,26 +1743,26 @@
}
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else
(const slist_impl<Config> &x, const slist_impl<Config> &y)
#endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
bool operator==
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else
(const slist_impl<Config> &x, const slist_impl<Config> &y)
@@ -1812,65 +1795,65 @@
}
}
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else
(const slist_impl<Config> &x, const slist_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else
(const slist_impl<Config> &x, const slist_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else
(const slist_impl<Config> &x, const slist_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else
(const slist_impl<Config> &x, const slist_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(slist_impl<T, Options...> &x, slist_impl<T, Options...> &y)
#else
(slist_impl<Config> &x, slist_impl<Config> &y)
@@ -1879,7 +1862,7 @@
//! Helper metafunction to define a \c slist that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none, class O3 = none, class O4 = none, class O5 = none>
@@ -1888,7 +1871,13 @@
{
/// @cond
typedef typename pack_options
- < slist_defaults<T>, O1, O2, O3, O4, O5>::type packed_options;
+ < slist_defaults<T>,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits;
typedef slist_impl
@@ -1907,12 +1896,29 @@
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4, class O5>
+#else
+template<class T, class ...Options>
+#endif
class slist
- : public make_slist<T, O1, O2, O3, O4, O5>::type
+ : public make_slist<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_slist
- <T, O1, O2, O3, O4, O5>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5
+ #else
+ Options...
+ #endif
+ >::type Base;
typedef typename Base::real_value_traits real_value_traits;
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
Modified: sandbox/metagraph/boost/intrusive/slist_hook.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/slist_hook.hpp (original)
+++ sandbox/metagraph/boost/intrusive/slist_hook.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -37,7 +37,7 @@
//! Helper metafunction to define a \c slist_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none>
@@ -46,7 +46,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3>::type packed_options;
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef detail::generic_hook
< get_slist_node_algo<typename packed_options::void_pointer>
@@ -75,15 +81,21 @@
//!
//! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this hook.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3>
#endif
class slist_base_hook
- : public make_slist_base_hook<O1, O2, O3>::type
+ : public make_slist_base_hook<
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
@@ -152,7 +164,7 @@
//! Helper metafunction to define a \c slist_member_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none>
@@ -161,7 +173,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3>::type packed_options;
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef detail::generic_hook
< get_slist_node_algo<typename packed_options::void_pointer>
@@ -185,15 +203,21 @@
//!
//! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this hook.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3>
#endif
class slist_member_hook
- : public make_slist_member_hook<O1, O2, O3>::type
+ : public make_slist_member_hook<
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
Modified: sandbox/metagraph/boost/intrusive/splay_set.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/splay_set.hpp (original)
+++ sandbox/metagraph/boost/intrusive/splay_set.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -31,7 +31,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -323,18 +323,19 @@
{ tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const splay_set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
@@ -1072,65 +1073,65 @@
/// @endcond
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y)
#else
(const splay_set_impl<Config> &x, const splay_set_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y)
#else
(const splay_set_impl<Config> &x, const splay_set_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y)
#else
(const splay_set_impl<Config> &x, const splay_set_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y)
#else
(const splay_set_impl<Config> &x, const splay_set_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(splay_set_impl<T, Options...> &x, splay_set_impl<T, Options...> &y)
#else
(splay_set_impl<Config> &x, splay_set_impl<Config> &y)
@@ -1139,7 +1140,7 @@
//! Helper metafunction to define a \c splay_set that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -1149,19 +1150,41 @@
{
/// @cond
typedef splay_set_impl
- < typename make_splaytree_opt<T, O1, O2, O3, O4>::type
+ < typename make_splaytree_opt<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class splay_set
- : public make_splay_set<T, O1, O2, O3, O4>::type
+ : public make_splay_set<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_splay_set
- <T, O1, O2, O3, O4>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type Base;
public:
typedef typename Base::value_compare value_compare;
@@ -1210,7 +1233,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -1498,18 +1521,19 @@
{ tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws. Basic guarantee.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const splay_multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
@@ -2154,65 +2178,65 @@
/// @endcond
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y)
#else
(const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y)
#else
(const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y)
#else
(const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y)
#else
(const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(splay_multiset_impl<T, Options...> &x, splay_multiset_impl<T, Options...> &y)
#else
(splay_multiset_impl<Config> &x, splay_multiset_impl<Config> &y)
@@ -2221,7 +2245,7 @@
//! Helper metafunction to define a \c splay_multiset that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -2231,19 +2255,42 @@
{
/// @cond
typedef splay_multiset_impl
- < typename make_splaytree_opt<T, O1, O2, O3, O4>::type
+ < typename make_splaytree_opt<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class splay_multiset
- : public make_splay_multiset<T, O1, O2, O3, O4>::type
+ : public make_splay_multiset<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_splay_multiset
- <T, O1, O2, O3, O4>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type Base;
public:
typedef typename Base::value_compare value_compare;
Modified: sandbox/metagraph/boost/intrusive/splay_set_hook.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/splay_set_hook.hpp (original)
+++ sandbox/metagraph/boost/intrusive/splay_set_hook.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -34,7 +34,7 @@
//! Helper metafunction to define a \c splay_set_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none>
@@ -43,7 +43,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3>::type packed_options;
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef detail::generic_hook
< get_splay_set_node_algo<typename packed_options::void_pointer>
@@ -72,15 +78,21 @@
//!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_link).
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3>
#endif
class splay_set_base_hook
- : public make_splay_set_base_hook<O1, O2, O3>::type
+ : public make_splay_set_base_hook<
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
@@ -149,7 +161,7 @@
//! Helper metafunction to define a \c splay_set_member_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none>
@@ -158,7 +170,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3>::type packed_options;
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef detail::generic_hook
< get_splay_set_node_algo<typename packed_options::void_pointer>
@@ -183,15 +201,21 @@
//!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_link).
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3>
#endif
class splay_set_member_hook
- : public make_splay_set_member_hook<O1, O2, O3>::type
+ : public make_splay_set_member_hook<
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3
+ #else
+ Options...
+ #endif
+ >::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
Modified: sandbox/metagraph/boost/intrusive/splaytree.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/splaytree.hpp (original)
+++ sandbox/metagraph/boost/intrusive/splaytree.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -35,20 +35,6 @@
/// @cond
-template <class T>
-struct internal_default_splay_set_hook
-{
- template <class U> static detail::one test(...);
- template <class U> static detail::two test(typename U::default_splay_set_hook* = 0);
- static const bool value = sizeof(test<T>(0)) == sizeof(detail::two);
-};
-
-template <class T>
-struct get_default_splay_set_hook
-{
- typedef typename T::default_splay_set_hook type;
-};
-
template <class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize>
struct splaysetopt
{
@@ -62,13 +48,7 @@
struct splay_set_defaults
: pack_options
< none
- , base_hook
- < typename detail::eval_if_c
- < internal_default_splay_set_hook<T>::value
- , get_default_splay_set_hook<T>
- , detail::identity<none>
- >::type
- >
+ , base_hook<detail::default_splay_set_hook>
, constant_time_size<true>
, size_type<std::size_t>
, compare<std::less<T> >
@@ -90,7 +70,7 @@
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -1072,29 +1052,34 @@
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws.
+ //! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const splaytree_impl &src, Cloner cloner, Disposer disposer)
{
this->clear_and_dispose(disposer);
if(!src.empty()){
+ detail::exception_disposer<splaytree_impl, Disposer>
+ rollback(*this, disposer);
node_algorithms::clone
(const_node_ptr(&src.priv_header())
,node_ptr(&this->priv_header())
,detail::node_cloner<Cloner, splaytree_impl>(cloner, this)
,detail::node_disposer<Disposer, splaytree_impl>(disposer, this));
this->priv_size_traits().set_size(src.priv_size_traits().get_size());
+ this->priv_comp() = src.priv_comp();
+ rollback.release();
}
}
@@ -1339,26 +1324,26 @@
{ return priv_container_from_end_iterator(it.end_iterator_from_it()); }
};
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
#endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
bool operator==
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
@@ -1390,65 +1375,65 @@
}
}
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
#endif
{ return !(x == y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
#endif
{ return y < x; }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
#endif
{ return !(y < x); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
#endif
{ return !(x < y); }
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(splaytree_impl<T, Options...> &x, splaytree_impl<T, Options...> &y)
#else
(splaytree_impl<Config> &x, splaytree_impl<Config> &y)
@@ -1456,15 +1441,23 @@
{ x.swap(y); }
/// @cond
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1 = none, class O2 = none
- , class O3 = none, class O4 = none
- , class O5 = none, class O6 = none
- , class O7 = none
- >
+ , class O3 = none, class O4 = none>
+#else
+template<class T, class ...Options>
+#endif
struct make_splaytree_opt
{
typedef typename pack_options
- < splay_set_defaults<T>, O1, O2, O3, O4>::type packed_options;
+ < splay_set_defaults<T>,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits;
@@ -1479,7 +1472,7 @@
//! Helper metafunction to define a \c splaytree that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
@@ -1489,19 +1482,41 @@
{
/// @cond
typedef splaytree_impl
- < typename make_splaytree_opt<T, O1, O2, O3, O4>::type
+ < typename make_splaytree_opt<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
+#else
+template<class T, class ...Options>
+#endif
class splaytree
- : public make_splaytree<T, O1, O2, O3, O4>::type
+ : public make_splaytree<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_splaytree
- <T, O1, O2, O3, O4>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type Base;
public:
typedef typename Base::value_compare value_compare;
Modified: sandbox/metagraph/boost/intrusive/splaytree_algorithms.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/splaytree_algorithms.hpp (original)
+++ sandbox/metagraph/boost/intrusive/splaytree_algorithms.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -870,7 +870,7 @@
if(NodeTraits::get_parent(g) == p)
NodeTraits::set_parent(g, n);
else{//must be ( g->right == p )
- assert(0);
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(0);
NodeTraits::set_right(g, n);
}
}
Modified: sandbox/metagraph/boost/intrusive/unordered_set.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/unordered_set.hpp (original)
+++ sandbox/metagraph/boost/intrusive/unordered_set.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -56,7 +56,7 @@
//!
//! Since no automatic rehashing is done, iterators are never invalidated when
//! inserting or erasing elements. Iterators are only invalidated when rehasing.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -268,18 +268,24 @@
{ table_.swap(other.table_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes that compare equal and produce the same
+ //! hash than the original node.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. The hash function and the equality
+ //! predicate are copied from the source.
//!
- //! If cloner throws, all cloned elements are unlinked and disposed
+ //! If store_hash option is true, this method does not use the hash function.
+ //!
+ //! If any operation throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws. Basic guarantee.
+ //! <b>Throws</b>: If cloner or hasher throw or hash or equality predicate copying
+ //! throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const unordered_set_impl &src, Cloner cloner, Disposer disposer)
{ table_.clone_from(src.table_, cloner, disposer); }
@@ -920,6 +926,8 @@
//!
//! <b>Effects</b>: Updates the internal reference with the new bucket erases
//! the values from the old bucket and inserts then in the new one.
+ //!
+ //! If store_hash option is true, this method does not use the hash function.
//!
//! <b>Complexity</b>: Average case linear in this->size(), worst case quadratic.
//!
@@ -927,6 +935,32 @@
void rehash(const bucket_traits &new_bucket_traits)
{ table_.rehash(new_bucket_traits); }
+ //! <b>Requires</b>:
+ //!
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
+ //! <b>Throws</b>:
+ //!
+ //! <b>Note</b>: this method is only available if incremental<true> option is activated.
+ bool incremental_rehash(bool grow = true)
+ { return table_.incremental_rehash(grow); }
+
+ //! <b>Note</b>: this method is only available if incremental<true> option is activated.
+ bool incremental_rehash(const bucket_traits &new_bucket_traits)
+ { return table_.incremental_rehash(new_bucket_traits); }
+
+ //! <b>Requires</b>:
+ //!
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
+ //! <b>Throws</b>:
+ size_type split_count() const
+ { return table_.split_count(); }
+
//! <b>Effects</b>: Returns the nearest new bucket count optimized for
//! the container that is bigger than n. This suggestion can be used
//! to create bucket arrays with a size that will usually improve
@@ -954,14 +988,14 @@
//! Helper metafunction to define an \c unordered_set that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
, class O3 = none, class O4 = none
, class O5 = none, class O6 = none
, class O7 = none, class O8 = none
- , class O9 = none
+ , class O9 = none, class O10= none
>
#endif
struct make_unordered_set
@@ -969,19 +1003,42 @@
/// @cond
typedef unordered_set_impl
< typename make_hashtable_opt
- <T, true, O1, O2, O3, O4, O5, O6, O7, O8, O9>::type
+ <T, true,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
-template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7, class O8, class O9>
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7, class O8, class O9, class O10>
+#else
+template<class T, class ...Options>
+#endif
class unordered_set
- : public make_unordered_set<T, O1, O2, O3, O4, O5, O6, O7, O8, O9>::type
+ : public make_unordered_set<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_unordered_set
- <T, O1, O2, O3, O4, O5, O6, O7, O8, O9>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
+ #else
+ Options...
+ #endif
+ >::type Base;
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));
@@ -1052,7 +1109,7 @@
//!
//! Since no automatic rehashing is done, iterators are never invalidated when
//! inserting or erasing elements. Iterators are only invalidated when rehasing.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
@@ -1265,18 +1322,24 @@
{ table_.swap(other.table_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
+ //! Cloner should yield to nodes that compare equal and produce the same
+ //! hash than the original node.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
- //! and inserts them on *this.
+ //! and inserts them on *this. The hash function and the equality
+ //! predicate are copied from the source.
//!
- //! If cloner throws, all cloned elements are unlinked and disposed
+ //! If store_hash option is true, this method does not use the hash function.
+ //!
+ //! If any operation throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
- //! <b>Throws</b>: If cloner throws.
+ //! <b>Throws</b>: If cloner or hasher throw or hash or equality predicate copying
+ //! throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const unordered_multiset_impl &src, Cloner cloner, Disposer disposer)
{ table_.clone_from(src.table_, cloner, disposer); }
@@ -1854,6 +1917,8 @@
//!
//! <b>Effects</b>: Updates the internal reference with the new bucket erases
//! the values from the old bucket and inserts then in the new one.
+ //!
+ //! If store_hash option is true, this method does not use the hash function.
//!
//! <b>Complexity</b>: Average case linear in this->size(), worst case quadratic.
//!
@@ -1861,6 +1926,32 @@
void rehash(const bucket_traits &new_bucket_traits)
{ table_.rehash(new_bucket_traits); }
+ //! <b>Requires</b>:
+ //!
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
+ //! <b>Throws</b>:
+ //!
+ //! <b>Note</b>: this method is only available if incremental<true> option is activated.
+ bool incremental_rehash(bool grow = true)
+ { return table_.incremental_rehash(grow); }
+
+ //! <b>Note</b>: this method is only available if incremental<true> option is activated.
+ bool incremental_rehash(const bucket_traits &new_bucket_traits)
+ { return table_.incremental_rehash(new_bucket_traits); }
+
+ //! <b>Requires</b>:
+ //!
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
+ //! <b>Throws</b>:
+ size_type split_count() const
+ { return table_.split_count(); }
+
//! <b>Effects</b>: Returns the nearest new bucket count optimized for
//! the container that is bigger than n. This suggestion can be used
//! to create bucket arrays with a size that will usually improve
@@ -1888,14 +1979,14 @@
//! Helper metafunction to define an \c unordered_multiset that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none
, class O3 = none, class O4 = none
, class O5 = none, class O6 = none
, class O7 = none, class O8 = none
- , class O9 = none
+ , class O9 = none, class O10= none
>
#endif
struct make_unordered_multiset
@@ -1903,19 +1994,42 @@
/// @cond
typedef unordered_multiset_impl
< typename make_hashtable_opt
- <T, false, O1, O2, O3, O4, O5, O6, O7, O8, O9>::type
+ <T, false,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
+ #else
+ Options...
+ #endif
+ >::type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
-template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7, class O8, class O9>
+
+#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7, class O8, class O9, class O10>
+#else
+template<class T, class ...Options>
+#endif
class unordered_multiset
- : public make_unordered_multiset<T, O1, O2, O3, O4, O5, O6, O7, O8, O9>::type
+ : public make_unordered_multiset<T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
+ #else
+ Options...
+ #endif
+ >::type
{
typedef typename make_unordered_multiset
- <T, O1, O2, O3, O4, O5, O6, O7, O8, O9>::type Base;
+ <T,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
+ #else
+ Options...
+ #endif
+ >::type Base;
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));
Modified: sandbox/metagraph/boost/intrusive/unordered_set_hook.hpp
==============================================================================
--- sandbox/metagraph/boost/intrusive/unordered_set_hook.hpp (original)
+++ sandbox/metagraph/boost/intrusive/unordered_set_hook.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -153,7 +153,7 @@
//! Helper metafunction to define a \c unordered_set_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -162,7 +162,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3, O4>::type packed_options;
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef detail::generic_hook
< get_uset_node_algo<typename packed_options::void_pointer
@@ -201,15 +207,21 @@
//! \c optimize_multikey<> will tell the hook to store a link to form a group
//! with other value with the same value to speed up searches and insertions
//! in unordered_multisets with a great number of with equivalent keys.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3, class O4>
#endif
class unordered_set_base_hook
- : public make_unordered_set_base_hook<O1, O2, O3, O4>::type
+ : public make_unordered_set_base_hook<
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
@@ -279,7 +291,7 @@
//! Helper metafunction to define a \c unordered_set_member_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -288,7 +300,13 @@
{
/// @cond
typedef typename pack_options
- < hook_defaults, O1, O2, O3, O4>::type packed_options;
+ < hook_defaults,
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type packed_options;
typedef detail::generic_hook
< get_uset_node_algo< typename packed_options::void_pointer
@@ -318,15 +336,21 @@
//!
//! \c store_hash<> will tell the hook to store the hash of the value
//! to speed up rehashings.
-#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1, class O2, class O3, class O4>
#endif
class unordered_set_member_hook
- : public make_unordered_set_member_hook<O1, O2, O3, O4>::type
+ : public make_unordered_set_member_hook<
+ #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+ >::type
{
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
//!
Modified: sandbox/metagraph/libs/intrusive/doc/intrusive.qbk
==============================================================================
--- sandbox/metagraph/libs/intrusive/doc/intrusive.qbk (original)
+++ sandbox/metagraph/libs/intrusive/doc/intrusive.qbk 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -596,7 +596,7 @@
be configured to use any type of pointer. This configuration information is also
transmitted to the containers, so all the internal pointers used by intrusive containers
configured with these hooks will be smart pointers. As an example,
- [*Boost.Interprocess] defines an mart pointer compatible with shared memory,
+ [*Boost.Interprocess] defines a smart pointer compatible with shared memory,
called `offset_ptr`. [*Boost.Intrusive] can be configured to use this smart pointer
to allow shared memory intrusive containers.
@@ -656,6 +656,15 @@
used in hooks' destructors to check that the hook is in a default state.
If any of these macros is not redefined, the assertion will default to `BOOST_ASSERT`.
+If `BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT` or `BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT`
+is defined and the programmer needs to include a file to configure that assertion, it can define
+`BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT_INCLUDE` or `BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT_INCLUDE`
+with the name of the file to include:
+
+[c++]
+
+ #define BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT MYASSERT
+ #define BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT_INCLUDE <myassert.h>
[endsect]
@@ -1032,8 +1041,9 @@
* [*`optimize_size<bool Enable>`]: The hook will be optimized for size
instead of speed. The hook will embed the color bit of the red-black
tree node in the parent pointer if pointer alignment is even.
- Optimizing the size will reduce speed performance a bit since masking
- operations will be needed to access parent pointer and color attributes.
+ In some platforms, optimizing the size might reduce speed performance a bit
+ since masking operations will be needed to access parent pointer and color attributes,
+ in other platforms this option improves performance due to improved memory locality.
Default: `optimize_size<false>`.
[endsect]
@@ -1283,11 +1293,17 @@
(e.g. strings with a long common predicate) sometimes (specially when the
load factor is high or we have many equivalent elements in an
[classref boost::intrusive::unordered_multiset unordered_multiset] and
- no `optimize_multikey<>` is activatedin the hook)
+ no `optimize_multikey<>` is activated in the hook)
the equality function is a performance problem. Two equal values must have
equal hashes, so comparing the hash values of two elements before using the
comparison functor can speed up some implementations.
+* [*`incremental<bool Enabled>`]: Activates incremental hashing (also known as Linear Hashing).
+ This option implies `power_2_buckets<true>` and the container will require power of two buckets.
+ For more information on incremental hashing, see
+ [@http://en.wikipedia.org/wiki/Linear_hashing `Linear hash` on Wikipedia]
+ Default: `incremental<false>`
+
[endsect]
[section:unordered_set_unordered_multiset_example Example]
@@ -1558,8 +1574,9 @@
* [*`optimize_size<bool Enable>`]: The hook will be optimized for size
instead of speed. The hook will embed the balance bits of the AVL
tree node in the parent pointer if pointer alignment is multiple of 4.
- Optimizing the size will reduce speed performance a bit since masking
- operations will be needed to access parent pointer and balance factor attributes.
+ In some platforms, optimizing the size might reduce speed performance a bit
+ since masking operations will be needed to access parent pointer and balance factor attributes,
+ in other platforms this option improves performance due to improved memory locality.
Default: `optimize_size<false>`.
[endsect]
@@ -1890,7 +1907,7 @@
With multiple ordered and unordered associative containers
([classref boost::intrusive::multiset multiset] and
-[classref boost::intrusive::unordered_multiset unordered_multiset]) there's
+[classref boost::intrusive::unordered_multiset unordered_multiset]) there is
no need for these advanced insertion functions, since insertions are always succesful.
[endsect]
@@ -1982,7 +1999,7 @@
all the constructed elements are disposed using the disposer function object.
-Here's an example of `clone_from`:
+Here is an example of `clone_from`:
[import ../example/doc_clone_from.cpp]
[doc_clone_from]
@@ -2116,7 +2133,7 @@
be inserted container. Additionally, these hooks don't support `unlink()` and
`swap_nodes()` operations for the same reason.
-Here's an example that creates a class with two any hooks, and uses one to insert the
+Here is an example that creates a class with two any hooks, and uses one to insert the
class in a [classref slist] and the other one in a [classref list].
[import ../example/doc_any_hook.cpp]
@@ -2699,7 +2716,7 @@
Instead of using [*Boost.Intrusive] predefined hooks
a user might want to develop customized containers, for example, using nodes that are
optimized for a specific
-application or that are compatible with a a legacy ABI. A user might want
+application or that are compatible with a legacy ABI. A user might want
to have only two additional pointers in his class and insert the class in a doubly
linked list sometimes and in a singly linked list in other situations. You can't
achieve this using [*Boost.Intrusive] predefined hooks. Now, instead of using
@@ -3459,7 +3476,7 @@
[section:performance_results_conclusions Conclusions]
-Intrusive containers can offer performance benefits that can not be achieved with
+Intrusive containers can offer performance benefits that cannot be achieved with
equivalent non-intrusive containers. Memory locality improvements are noticeable
when the objects to be inserted are small. Minimizing memory allocation/deallocation calls is also
an important factor and intrusive containers make this simple if the user allocates
@@ -3471,6 +3488,17 @@
[section:release_notes Release Notes]
+[section:release_notes_boost_1_37_00 Boost 1.37 Release]
+
+* Intrusive now takes advantage of compilers with variadic templates.
+* `clone_from` functions now copy predicates and hash functions of associative containers.
+* Added incremental hashing to unordered containers via `incremental<>` option.
+* Update some function parameters from `iterator` to `const_iterator` in containers
+ to keep up with the draft of the next standard.
+* Added an option to specify include files for intrusive configurable assertion macros.
+
+[endsect]
+
[section:release_notes_boost_1_36_00 Boost 1.36 Release]
* Added `linear<>` and `cache_last<>` options to singly linked lists.
@@ -3512,7 +3540,7 @@
[endsect]
-[section:acknowledgments Acknowledgements]
+[section:acknowledgements Acknowledegements]
[*Olaf Krzikalla] would like to thank:
Modified: sandbox/metagraph/libs/intrusive/example/doc_window.cpp
==============================================================================
--- sandbox/metagraph/libs/intrusive/example/doc_window.cpp (original)
+++ sandbox/metagraph/libs/intrusive/example/doc_window.cpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -21,7 +21,7 @@
//This is a container those value is an abstract class: you can't do this with std::list.
typedef list<Window> win_list;
- //An static intrusive list declaration
+ //A static intrusive list declaration
static win_list all_windows;
//Constructor. Includes this window in the list
Modified: sandbox/metagraph/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj
==============================================================================
--- sandbox/metagraph/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj (original)
+++ sandbox/metagraph/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -267,6 +267,9 @@
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\utilities.hpp">
</File>
+ <File
+ RelativePath="..\..\..\..\..\boost\intrusive\detail\workaround.hpp">
+ </File>
</Filter>
</Filter>
<Filter
Modified: sandbox/metagraph/libs/intrusive/proj/vc7ide/unordered_set/unordered_set.vcproj
==============================================================================
--- sandbox/metagraph/libs/intrusive/proj/vc7ide/unordered_set/unordered_set.vcproj (original)
+++ sandbox/metagraph/libs/intrusive/proj/vc7ide/unordered_set/unordered_set.vcproj 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="7.10"
Name="unordered_set"
- ProjectGUID="{90E701E6-2C91-F4A7-BA6C-A9F3B0949279}"
+ ProjectGUID="{9101EE76-BB6C-2C91-F4B7-A27B94908F19}"
Keyword="Win32Proj">
<Platforms>
<Platform
@@ -21,6 +21,7 @@
Optimization="0"
AdditionalIncludeDirectories="../../../../../"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ GeneratePreprocessedFile="0"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
@@ -116,7 +117,7 @@
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4F3C77F1-B78A-C745-4726-2D752AA322FF}">
+ UniqueIdentifier="{4F3C77F1-B78A-C745-4726-252AD75C322E}">
<File
RelativePath="..\..\..\test\unordered_set_test.cpp">
</File>
Modified: sandbox/metagraph/libs/intrusive/test/default_hook_test.cpp
==============================================================================
--- sandbox/metagraph/libs/intrusive/test/default_hook_test.cpp (original)
+++ sandbox/metagraph/libs/intrusive/test/default_hook_test.cpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -13,6 +13,9 @@
#include <boost/intrusive/slist.hpp>
#include <boost/intrusive/set.hpp>
#include <boost/intrusive/unordered_set.hpp>
+#include <boost/intrusive/splay_set.hpp>
+#include <boost/intrusive/avl_set.hpp>
+#include <boost/intrusive/sg_set.hpp>
#include "smart_ptr.hpp"
#include <vector>
@@ -28,6 +31,12 @@
< void_pointer<smart_ptr<void> >, link_mode<normal_link> >
, public unordered_set_base_hook
< void_pointer<smart_ptr<void> >, link_mode<normal_link> >
+, public avl_set_base_hook
+ < void_pointer<smart_ptr<void> >, link_mode<normal_link> >
+, public splay_set_base_hook
+ < void_pointer<smart_ptr<void> >, link_mode<normal_link> >
+, public bs_set_base_hook
+ < void_pointer<smart_ptr<void> >, link_mode<normal_link> >
{
int int_;
@@ -51,6 +60,9 @@
typedef slist<MyClass> Slist;
typedef set<MyClass> Set;
typedef unordered_set<MyClass> USet;
+typedef avl_set<MyClass> AvlSet;
+typedef splay_set<MyClass> SplaySet;
+typedef sg_set<MyClass> SgSet;
int main()
{
@@ -67,6 +79,9 @@
Slist my_slist;
Set my_set;
USet my_uset(USet::bucket_traits(buckets, 100));
+ AvlSet my_avlset;
+ SplaySet my_splayset;
+ SgSet my_sgset;
//Now insert them in the reverse order
//in the base hook intrusive list
@@ -75,6 +90,9 @@
my_slist.push_front(*it);
my_set.insert(*it);
my_uset.insert(*it);
+ my_avlset.insert(*it);
+ my_splayset.insert(*it);
+ my_sgset.insert(*it);
}
//Now test lists
@@ -82,13 +100,24 @@
List::const_iterator list_it(my_list.cbegin());
Slist::const_iterator slist_it(my_slist.cbegin());
Set::const_reverse_iterator set_rit(my_set.crbegin());
+ AvlSet::const_reverse_iterator avl_set_rit(my_avlset.crbegin());
+ SplaySet::const_reverse_iterator splay_set_rit(my_splayset.crbegin());
+ SgSet::const_reverse_iterator sg_set_rit(my_sgset.crbegin());
+
VectRit vect_it(values.rbegin()), vect_itend(values.rend());
//Test the objects inserted in the base hook list
- for(; vect_it != vect_itend; ++vect_it, ++list_it, ++slist_it, ++set_rit){
- if(&*list_it != &*vect_it) return 1;
- if(&*slist_it != &*vect_it) return 1;
- if(&*set_rit != &*vect_it) return 1;
+ for(; vect_it != vect_itend
+ ; ++vect_it, ++list_it
+ , ++slist_it, ++set_rit
+ , ++avl_set_rit, ++splay_set_rit
+ , ++sg_set_rit){
+ if(&*list_it != &*vect_it) return 1;
+ if(&*slist_it != &*vect_it) return 1;
+ if(&*set_rit != &*vect_it) return 1;
+ if(&*avl_set_rit != &*vect_it) return 1;
+ if(&*splay_set_rit != &*vect_it)return 1;
+ if(&*sg_set_rit != &*vect_it) return 1;
if(my_uset.find(*set_rit) == my_uset.cend()) return 1;
}
}
Modified: sandbox/metagraph/libs/intrusive/test/list_test.cpp
==============================================================================
--- sandbox/metagraph/libs/intrusive/test/list_test.cpp (original)
+++ sandbox/metagraph/libs/intrusive/test/list_test.cpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -13,6 +13,7 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/list.hpp>
+
#include <boost/intrusive/detail/pointer_to_other.hpp>
#include "itestvalue.hpp"
#include "smart_ptr.hpp"
@@ -446,13 +447,12 @@
>
>::type
>::test_all(data);
-/*
- test_list<stateful_value_traits
- < value_type
- , list_node_traits<VoidPointer>
- , safe_link>
- >::test_all(data);
-*/
+
+// test_list<stateful_value_traits
+// < value_type
+// , list_node_traits<VoidPointer>
+// , safe_link>
+// >::test_all(data);
test_list < typename detail::get_base_value_traits
< value_type
, typename value_type::list_auto_base_hook_t
@@ -467,13 +467,13 @@
>
>::type
>::test_all(data);
-/*
- test_list<stateful_value_traits
- < value_type
- , list_node_traits<VoidPointer>
- , auto_unlink>
- >::test_all(data);
-*/
+
+// test_list<stateful_value_traits
+// < value_type
+// , list_node_traits<VoidPointer>
+// , auto_unlink>
+// >::test_all(data);
+
return 0;
}
};
@@ -488,3 +488,285 @@
return boost::report_errors();
}
#include <boost/intrusive/detail/config_end.hpp>
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+#include <cstddef>
+
+
+////////////////////////////////////////////////////
+// Builds an index_tuple<0, 1, 2, ..., Num-1>, that will
+// be used to "unpack" into comma-separated values
+// in a function call.
+////////////////////////////////////////////////////
+
+template<int... Indexes>
+struct index_tuple{};
+
+template<std::size_t Num, typename Tuple = index_tuple<> >
+struct build_number_seq;
+
+template<std::size_t Num, int... Indexes>
+struct build_number_seq<Num, index_tuple<Indexes...> >
+ : build_number_seq<Num - 1, index_tuple<Indexes..., sizeof...(Indexes)> >
+{};
+
+template<int... Indexes>
+struct build_number_seq<0, index_tuple<Indexes...> >
+{ typedef index_tuple<Indexes...> type; };
+
+template<class ...Types>
+struct typelist
+{};
+
+template<class T>
+struct invert_typelist;
+
+template<int I, typename Tuple>
+struct typelist_element;
+
+template<int I, typename Head, typename... Tail>
+struct typelist_element<I, typelist<Head, Tail...> >
+{
+ typedef typename typelist_element<I-1, typelist<Tail...> >::type type;
+};
+
+template<typename Head, typename... Tail>
+struct typelist_element<0, typelist<Head, Tail...> >
+{
+ typedef Head type;
+};
+
+template<int ...Ints, class ...Types>
+typelist<typename typelist_element<(sizeof...(Types) - 1) - Ints, typelist<Types...> >::type...>
+ inverted_typelist(index_tuple<Ints...>, typelist<Types...>)
+{
+ return typelist<typename typelist_element<(sizeof...(Types) - 1) - Ints, typelist<Types...> >::type...>();
+}
+
+
+template<class Typelist>
+struct sizeof_typelist;
+
+template<class ...Types>
+struct sizeof_typelist< typelist<Types...> >
+{
+ static const std::size_t value = sizeof...(Types);
+};
+
+//invert_typelist_impl
+template<class Typelist, class Indexes>
+struct invert_typelist_impl;
+
+
+template<class Typelist, int ...Ints>
+struct invert_typelist_impl< Typelist, index_tuple<Ints...> >
+{
+ static const std::size_t last_idx = sizeof_typelist<Typelist>::value - 1;
+ typedef typelist
+ <typename typelist_element<last_idx - Ints, Typelist>::type...> type;
+};
+
+template<class Typelist, int Int>
+struct invert_typelist_impl< Typelist, index_tuple<Int> >
+{
+ typedef Typelist type;
+};
+
+template<class Typelist>
+struct invert_typelist_impl< Typelist, index_tuple<> >
+{
+ typedef Typelist type;
+};
+
+//invert_typelist
+template<class Typelist>
+struct invert_typelist;
+
+template<class ...Types>
+struct invert_typelist< typelist<Types...> >
+{
+ typedef typelist<Types...> typelist_t;
+ typedef typename build_number_seq<sizeof...(Types)>::type indexes_t;
+ typedef typename invert_typelist_impl<typelist_t, indexes_t>::type type;
+};
+
+struct none
+{
+ template<class Base>
+ struct pack : Base
+ { };
+};
+
+//!This option setter specifies the type of
+//!a void pointer. This will instruct the hook
+//!to use this type of pointer instead of the
+//!default one
+template<class VoidPointer>
+struct void_pointer
+{
+/// @cond
+ template<class Base>
+ struct pack : Base
+ {
+ typedef VoidPointer void_pointer;
+ };
+/// @endcond
+};
+
+//!This option setter specifies the type of
+//!the tag of a base hook. A type cannot have two
+//!base hooks of the same type, so a tag can be used
+//!to differentiate two base hooks with otherwise same type
+template<class Tag>
+struct tag
+{
+/// @cond
+ template<class Base>
+ struct pack : Base
+ {
+ typedef Tag tag;
+ };
+/// @endcond
+};
+
+
+//!This option setter specifies if the hook
+//!should be optimized for size instead of for speed.
+template<bool Enabled>
+struct optimize_size
+{
+/// @cond
+ template<class Base>
+ struct pack : Base
+ {
+ static const bool optimize_size = Enabled;
+ };
+/// @endcond
+};
+
+//!This option setter specifies if the list container should
+//!use a linear implementation instead of a circular one.
+template<bool Enabled>
+struct linear
+{
+/// @cond
+ template<class Base>
+ struct pack : Base
+ {
+ static const bool linear = Enabled;
+ };
+/// @endcond
+};
+
+//!This option setter specifies if the list container should
+//!use a linear implementation instead of a circular one.
+template<bool Enabled>
+struct cache_last
+{
+/// @cond
+ template<class Base>
+ struct pack : Base
+ {
+ static const bool cache_last = Enabled;
+ };
+/// @endcond
+};
+
+
+
+template<class Typelist>
+struct do_pack;
+
+template<>
+struct do_pack<typelist<> >;
+
+template<class Prev>
+struct do_pack<typelist<Prev> >
+{
+ typedef Prev type;
+};
+
+template<class Prev, class Last>
+struct do_pack<typelist<Prev, Last> >
+{
+ typedef typename Prev::template pack<Last> type;
+};
+
+template<class Prev, class ...Others>
+struct do_pack<typelist<Prev, Others...> >
+{
+ typedef typename Prev::template pack
+ <typename do_pack<typelist<Others...>>::type> type;
+};
+
+
+template<class ...Options>
+struct pack_options
+{
+ typedef typelist<Options...> typelist_t;
+ typedef typename invert_typelist<typelist_t>::type inverted_typelist;
+ typedef typename do_pack<inverted_typelist>::type type;
+};
+
+struct hook_defaults
+ : public pack_options
+ < none
+ , void_pointer<void*>
+ , tag<int>
+ , optimize_size<false>
+ , linear<false>
+ >::type
+{};
+
+
+#include <iostream>
+#include <typeinfo>
+
+struct S
+{};
+
+int main()
+{
+ {
+ typedef typelist<int, float, double> typelist_t;
+ typedef invert_typelist<typelist_t>::type inverted_typelist;
+ std::cout << "original: " << typeid(typelist_t).name() << std::endl;
+ std::cout << "inverted: " << typeid(inverted_typelist).name() << std::endl;
+ }
+ {
+ typedef typelist<int> typelist_t;
+ typedef invert_typelist<typelist_t>::type inverted_typelist;
+ std::cout << "original: " << typeid(typelist_t).name() << std::endl;
+ std::cout << "inverted: " << typeid(inverted_typelist).name() << std::endl;
+ }
+ {
+ typedef typelist<> typelist_t;
+ typedef invert_typelist<typelist_t>::type inverted_typelist;
+ std::cout << "original: " << typeid(typelist_t).name() << std::endl;
+ std::cout << "inverted: " << typeid(inverted_typelist).name() << std::endl;
+ }
+ {
+ typedef pack_options<S, none>::type options_t;
+ std::cout << "options_t " << typeid(options_t).name() << std::endl;
+ }
+ {
+ typedef pack_options<S, none, none>::type options_t;
+ std::cout << "options_t " << typeid(options_t).name() << std::endl;
+ }
+
+ hook_defaults h;
+ return 1;
+}
+*/
\ No newline at end of file
Modified: sandbox/metagraph/libs/intrusive/test/set_test.cpp
==============================================================================
--- sandbox/metagraph/libs/intrusive/test/set_test.cpp (original)
+++ sandbox/metagraph/libs/intrusive/test/set_test.cpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -108,7 +108,6 @@
int main( int, char* [] )
{
-
test_main_template<void*, false>()();
test_main_template<boost::intrusive::smart_ptr<void>, false>()();
test_main_template<void*, true>()();
Modified: sandbox/metagraph/libs/intrusive/test/sg_multiset_test.cpp
==============================================================================
--- sandbox/metagraph/libs/intrusive/test/sg_multiset_test.cpp (original)
+++ sandbox/metagraph/libs/intrusive/test/sg_multiset_test.cpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -18,8 +18,18 @@
namespace boost { namespace intrusive { namespace test {
+#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
-struct has_rebalance<boost::intrusive::sg_multiset<T, O1, O2, O3, O4> >
+#else
+template<class T, class ...Options>
+#endif
+struct has_rebalance<boost::intrusive::sg_multiset<T,
+ #if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+> >
{
static const bool value = true;
};
Modified: sandbox/metagraph/libs/intrusive/test/sg_set_test.cpp
==============================================================================
--- sandbox/metagraph/libs/intrusive/test/sg_set_test.cpp (original)
+++ sandbox/metagraph/libs/intrusive/test/sg_set_test.cpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -17,8 +17,18 @@
namespace boost { namespace intrusive { namespace test {
+#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
-struct has_rebalance<boost::intrusive::sg_set<T, O1, O2, O3, O4> >
+#else
+template<class T, class ...Options>
+#endif
+struct has_rebalance<boost::intrusive::sg_set<T,
+ #if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+> >
{
static const bool value = true;
};
Modified: sandbox/metagraph/libs/intrusive/test/splay_multiset_test.cpp
==============================================================================
--- sandbox/metagraph/libs/intrusive/test/splay_multiset_test.cpp (original)
+++ sandbox/metagraph/libs/intrusive/test/splay_multiset_test.cpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -19,20 +19,51 @@
namespace boost { namespace intrusive { namespace test {
+#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
-struct has_const_overloads<boost::intrusive::splay_multiset<T, O1, O2, O3, O4> >
+#else
+template<class T, class ...Options>
+#endif
+struct has_const_overloads<boost::intrusive::splay_multiset<
+#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+T, O1, O2, O3, O4
+#else
+T, Options...
+#endif
+>
+>
{
static const bool value = false;
};
+#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
-struct has_splay<boost::intrusive::splay_multiset<T, O1, O2, O3, O4> >
+#else
+template<class T, class ...Options>
+#endif
+struct has_splay<boost::intrusive::splay_multiset<T,
+ #if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+> >
{
static const bool value = true;
};
+#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
-struct has_rebalance<boost::intrusive::splay_multiset<T, O1, O2, O3, O4> >
+#else
+template<class T, class ...Options>
+#endif
+struct has_rebalance<boost::intrusive::splay_multiset<T,
+ #if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+> >
{
static const bool value = true;
};
Modified: sandbox/metagraph/libs/intrusive/test/splay_set_test.cpp
==============================================================================
--- sandbox/metagraph/libs/intrusive/test/splay_set_test.cpp (original)
+++ sandbox/metagraph/libs/intrusive/test/splay_set_test.cpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -17,20 +17,50 @@
namespace boost { namespace intrusive { namespace test {
+#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
-struct has_const_overloads<boost::intrusive::splay_set<T, O1, O2, O3, O4> >
+#else
+template<class T, class ...Options>
+#endif
+struct has_const_overloads<boost::intrusive::splay_set<T,
+ #if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+> >
{
static const bool value = false;
};
+#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
-struct has_splay<boost::intrusive::splay_set<T, O1, O2, O3, O4> >
+#else
+template<class T, class ...Options>
+#endif
+struct has_splay<boost::intrusive::splay_set<T,
+ #if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+> >
{
static const bool value = true;
};
+#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4>
-struct has_rebalance<boost::intrusive::splay_set<T, O1, O2, O3, O4> >
+#else
+template<class T, class ...Options>
+#endif
+struct has_rebalance<boost::intrusive::splay_set<T,
+ #if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+ O1, O2, O3, O4
+ #else
+ Options...
+ #endif
+> >
{
static const bool value = true;
};
Modified: sandbox/metagraph/libs/intrusive/test/test_macros.hpp
==============================================================================
--- sandbox/metagraph/libs/intrusive/test/test_macros.hpp (original)
+++ sandbox/metagraph/libs/intrusive/test/test_macros.hpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -15,10 +15,7 @@
#define TEST_INTRUSIVE_SEQUENCE( INTVALUES, ITERATOR )\
{ \
- const int init_values_size = sizeof(INTVALUES)/sizeof(INTVALUES[0]); \
- std::vector<int> expected; \
- expected.assign(&INTVALUES[0], &INTVALUES[0] + init_values_size); \
- BOOST_TEST (std::equal(expected.begin(), expected.end(), ITERATOR) ); \
+ BOOST_TEST (std::equal(&INTVALUES[0], &INTVALUES[0] + sizeof(INTVALUES)/sizeof(INTVALUES[0]), ITERATOR) ); \
}
#define TEST_INTRUSIVE_SEQUENCE_EXPECTED( EXPECTEDVECTOR, ITERATOR )\
Modified: sandbox/metagraph/libs/intrusive/test/unordered_multiset_test.cpp
==============================================================================
--- sandbox/metagraph/libs/intrusive/test/unordered_multiset_test.cpp (original)
+++ sandbox/metagraph/libs/intrusive/test/unordered_multiset_test.cpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -25,9 +25,9 @@
using namespace boost::intrusive;
-static const std::size_t BucketSize = 11;
+static const std::size_t BucketSize = 8;
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
struct test_unordered_multiset
{
typedef typename ValueTraits::value_type value_type;
@@ -35,14 +35,16 @@
static void test_sort(std::vector<value_type>& values);
static void test_insert(std::vector<value_type>& values);
static void test_swap(std::vector<value_type>& values);
- static void test_rehash(std::vector<value_type>& values);
+ static void test_rehash(std::vector<value_type>& values, detail::true_);
+ static void test_rehash(std::vector<value_type>& values, detail::false_);
static void test_find(std::vector<value_type>& values);
static void test_impl();
static void test_clone(std::vector<value_type>& values);
};
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_all (std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>::
+ test_all (std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -51,6 +53,7 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_multiset_type;
{
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
@@ -71,15 +74,16 @@
test_sort(values);
test_insert(values);
test_swap(values);
- test_rehash(values);
+ test_rehash(values, detail::bool_<Incremental>());
test_find(values);
test_impl();
test_clone(values);
}
//test case due to an error in tree implementation:
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_impl()
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
+ ::test_impl()
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -88,6 +92,7 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
@@ -110,8 +115,9 @@
}
//test: constructor, iterator, clear, reverse_iterator, front, back, size:
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_sort(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
+ ::test_sort(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -120,21 +126,29 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
typename unordered_multiset_type::bucket_type buckets [BucketSize];
unordered_multiset_type testset1(values.begin(), values.end(), bucket_traits(buckets, BucketSize));
- { int init_values [] = { 1, 2, 2, 3, 4, 5 };
- TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ if(Incremental){
+ { int init_values [] = { 4, 5, 1, 2, 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ }
+ else{
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ }
testset1.clear();
BOOST_TEST (testset1.empty());
}
-
+
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_insert(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
+ ::test_insert(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -143,54 +157,100 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
typedef typename unordered_multiset_type::iterator iterator;
- {
- typename unordered_multiset_type::bucket_type buckets [BucketSize];
- unordered_multiset_type testset(bucket_traits(buckets, BucketSize));
-
- testset.insert(&values[0] + 2, &values[0] + 5);
-
- const unordered_multiset_type& const_testset = testset;
- { int init_values [] = { 1, 4, 5 };
- TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
-
- typename unordered_multiset_type::iterator i = testset.begin();
- BOOST_TEST (i->value_ == 1);
-
- i = testset.insert (values[0]);
- BOOST_TEST (&*i == &values[0]);
-
- i = testset.iterator_to (values[2]);
- BOOST_TEST (&*i == &values[2]);
- testset.erase(i);
-
- { int init_values [] = { 1, 3, 5 };
- TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
- testset.clear();
- testset.insert(&values[0], &values[0] + values.size());
+ typename unordered_multiset_type::bucket_type buckets [BucketSize];
+ unordered_multiset_type testset(bucket_traits(buckets, BucketSize));
- { int init_values [] = { 1, 2, 2, 3, 4, 5 };
- TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+ testset.insert(&values[0] + 2, &values[0] + 5);
- BOOST_TEST (testset.erase(1) == 1);
- BOOST_TEST (testset.erase(2) == 2);
- BOOST_TEST (testset.erase(3) == 1);
- BOOST_TEST (testset.erase(4) == 1);
- BOOST_TEST (testset.erase(5) == 1);
- BOOST_TEST (testset.empty() == true);
+ const unordered_multiset_type& const_testset = testset;
- //Now with a single bucket
- typename unordered_multiset_type::bucket_type single_bucket[1];
- unordered_multiset_type testset2(bucket_traits(single_bucket, 1));
- testset2.insert(&values[0], &values[0] + values.size());
- BOOST_TEST (testset2.erase(5) == 1);
- BOOST_TEST (testset2.erase(2) == 2);
- BOOST_TEST (testset2.erase(1) == 1);
- BOOST_TEST (testset2.erase(4) == 1);
- BOOST_TEST (testset2.erase(3) == 1);
- BOOST_TEST (testset2.empty() == true);
+ if(Incremental){
+ {
+ { int init_values [] = { 4, 5, 1 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+
+ typename unordered_multiset_type::iterator i = testset.begin();
+ BOOST_TEST (i->value_ == 4);
+
+ i = testset.insert (values[0]);
+ BOOST_TEST (&*i == &values[0]);
+
+ i = testset.iterator_to (values[2]);
+ BOOST_TEST (&*i == &values[2]);
+ testset.erase(i);
+
+ { int init_values [] = { 5, 1, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+ testset.clear();
+ testset.insert(&values[0], &values[0] + values.size());
+
+ { int init_values [] = { 4, 5, 1, 2, 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+
+ BOOST_TEST (testset.erase(1) == 1);
+ BOOST_TEST (testset.erase(2) == 2);
+ BOOST_TEST (testset.erase(3) == 1);
+ BOOST_TEST (testset.erase(4) == 1);
+ BOOST_TEST (testset.erase(5) == 1);
+ BOOST_TEST (testset.empty() == true);
+
+ //Now with a single bucket
+ typename unordered_multiset_type::bucket_type single_bucket[1];
+ unordered_multiset_type testset2(bucket_traits(single_bucket, 1));
+ testset2.insert(&values[0], &values[0] + values.size());
+ BOOST_TEST (testset2.erase(5) == 1);
+ BOOST_TEST (testset2.erase(2) == 2);
+ BOOST_TEST (testset2.erase(1) == 1);
+ BOOST_TEST (testset2.erase(4) == 1);
+ BOOST_TEST (testset2.erase(3) == 1);
+ BOOST_TEST (testset2.empty() == true);
+ }
+ }
+ else{
+ {
+ { int init_values [] = { 1, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+
+ typename unordered_multiset_type::iterator i = testset.begin();
+ BOOST_TEST (i->value_ == 1);
+
+ i = testset.insert (values[0]);
+ BOOST_TEST (&*i == &values[0]);
+
+ i = testset.iterator_to (values[2]);
+ BOOST_TEST (&*i == &values[2]);
+ testset.erase(i);
+
+ { int init_values [] = { 1, 3, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+ testset.clear();
+ testset.insert(&values[0], &values[0] + values.size());
+
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+
+ BOOST_TEST (testset.erase(1) == 1);
+ BOOST_TEST (testset.erase(2) == 2);
+ BOOST_TEST (testset.erase(3) == 1);
+ BOOST_TEST (testset.erase(4) == 1);
+ BOOST_TEST (testset.erase(5) == 1);
+ BOOST_TEST (testset.empty() == true);
+
+ //Now with a single bucket
+ typename unordered_multiset_type::bucket_type single_bucket[1];
+ unordered_multiset_type testset2(bucket_traits(single_bucket, 1));
+ testset2.insert(&values[0], &values[0] + values.size());
+ BOOST_TEST (testset2.erase(5) == 1);
+ BOOST_TEST (testset2.erase(2) == 2);
+ BOOST_TEST (testset2.erase(1) == 1);
+ BOOST_TEST (testset2.erase(4) == 1);
+ BOOST_TEST (testset2.erase(3) == 1);
+ BOOST_TEST (testset2.empty() == true);
+ }
}
{
//Now erase just one per loop
@@ -270,11 +330,12 @@
}
}
}
-}
+}
//test: insert (seq-version), swap, erase (seq-version), size:
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_swap(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>::
+ test_swap(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -283,17 +344,30 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
typename unordered_multiset_type::bucket_type buckets [BucketSize];
- {
- typename unordered_multiset_type::bucket_type buckets2 [BucketSize];
- unordered_multiset_type testset1(&values[0], &values[0] + 2, bucket_traits(buckets, BucketSize));
- unordered_multiset_type testset2(bucket_traits(buckets2, BucketSize));
- testset2.insert (&values[0] + 2, &values[0] + 6);
- testset1.swap (testset2);
+ typename unordered_multiset_type::bucket_type buckets2 [BucketSize];
+ unordered_multiset_type testset1(&values[0], &values[0] + 2, bucket_traits(buckets, BucketSize));
+ unordered_multiset_type testset2(bucket_traits(buckets2, BucketSize));
+
+ testset2.insert (&values[0] + 2, &values[0] + 6);
+ testset1.swap (testset2);
+ if(Incremental){
+ { int init_values [] = { 4, 5, 1, 2 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ { int init_values [] = { 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset2.begin() ); }
+ testset1.erase (testset1.iterator_to(values[4]), testset1.end());
+ BOOST_TEST (testset1.size() == 1);
+ // BOOST_TEST (&testset1.front() == &values[3]);
+ BOOST_TEST (&*testset1.begin() == &values[2]);
+ }
+ else{
{ int init_values [] = { 1, 2, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
@@ -306,9 +380,141 @@
}
}
+
+
//test: rehash:
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_rehash(std::vector<typename ValueTraits::value_type>& values)
+
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
+ ::test_rehash(std::vector<typename ValueTraits::value_type>& values, detail::true_)
+{
+ typedef typename ValueTraits::value_type value_type;
+ typedef unordered_multiset
+ <value_type
+ , value_traits<ValueTraits>
+ , constant_time_size<value_type::constant_time_size>
+ , cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
+ , incremental<Incremental>
+ > unordered_multiset_type;
+ typedef typename unordered_multiset_type::bucket_traits bucket_traits;
+ //Build a uset
+ typename unordered_multiset_type::bucket_type buckets1 [BucketSize];
+ typename unordered_multiset_type::bucket_type buckets2 [BucketSize*2];
+ unordered_multiset_type testset1(&values[0], &values[0] + values.size(), bucket_traits(buckets1, BucketSize));
+ //Test current state
+ BOOST_TEST(testset1.split_count() == BucketSize/2);
+ { int init_values [] = { 4, 5, 1, 2, 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Incremental rehash step
+ BOOST_TEST (testset1.incremental_rehash() == true);
+ BOOST_TEST(testset1.split_count() == (BucketSize/2+1));
+ { int init_values [] = { 5, 1, 2, 2, 3, 4 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Rest of incremental rehashes should lead to the same sequence
+ for(std::size_t split_bucket = testset1.split_count(); split_bucket != BucketSize; ++split_bucket){
+ BOOST_TEST (testset1.incremental_rehash() == true);
+ BOOST_TEST(testset1.split_count() == (split_bucket+1));
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ }
+ //This incremental rehash should fail because we've reached the end of the bucket array
+ BOOST_TEST (testset1.incremental_rehash() == false);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //
+ //Try incremental hashing specifying a new bucket traits pointing to the same array
+ //
+ //This incremental rehash should fail because the new size is not twice the original
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets1, BucketSize)) == false);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //This incremental rehash should success because the new size is twice the original
+ //and split_count is the same as the old bucket count
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets1, BucketSize*2)) == true);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //This incremental rehash should also success because the new size is half the original
+ //and split_count is the same as the new bucket count
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets1, BucketSize)) == true);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //
+ //Try incremental hashing specifying a new bucket traits pointing to the same array
+ //
+ //This incremental rehash should fail because the new size is not twice the original
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets2, BucketSize)) == false);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //This incremental rehash should success because the new size is twice the original
+ //and split_count is the same as the old bucket count
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets2, BucketSize*2)) == true);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //This incremental rehash should also success because the new size is half the original
+ //and split_count is the same as the new bucket count
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets1, BucketSize)) == true);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //Full shrink rehash
+ testset1.rehash(bucket_traits(buckets1, 4));
+ BOOST_TEST (testset1.size() == values.size());
+ BOOST_TEST (testset1.incremental_rehash() == false);
+ { int init_values [] = { 4, 5, 1, 2, 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Full shrink rehash again
+ testset1.rehash(bucket_traits(buckets1, 2));
+ BOOST_TEST (testset1.size() == values.size());
+ BOOST_TEST (testset1.incremental_rehash() == false);
+ { int init_values [] = { 2, 2, 4, 3, 5, 1 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Full growing rehash
+ testset1.rehash(bucket_traits(buckets1, BucketSize));
+ BOOST_TEST (testset1.size() == values.size());
+ BOOST_TEST (testset1.incremental_rehash() == false);
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Incremental rehash shrinking
+ //First incremental rehashes should lead to the same sequence
+ for(std::size_t split_bucket = testset1.split_count(); split_bucket > 6; --split_bucket){
+ BOOST_TEST (testset1.incremental_rehash(false) == true);
+ BOOST_TEST(testset1.split_count() == (split_bucket-1));
+ { int init_values [] = { 1, 2, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ }
+ //Incremental rehash step
+ BOOST_TEST (testset1.incremental_rehash(false) == true);
+ BOOST_TEST(testset1.split_count() == (BucketSize/2+1));
+ { int init_values [] = { 5, 1, 2, 2, 3, 4 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Incremental rehash step 2
+ BOOST_TEST (testset1.incremental_rehash(false) == true);
+ BOOST_TEST(testset1.split_count() == (BucketSize/2));
+ { int init_values [] = { 4, 5, 1, 2, 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //This incremental rehash should fail because we've reached the half of the bucket array
+ BOOST_TEST(testset1.incremental_rehash(false) == false);
+ BOOST_TEST(testset1.split_count() == BucketSize/2);
+ { int init_values [] = { 4, 5, 1, 2, 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+}
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
+ ::test_rehash(std::vector<typename ValueTraits::value_type>& values, detail::false_)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -317,6 +523,7 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
@@ -325,36 +532,37 @@
typename unordered_multiset_type::bucket_type buckets3 [BucketSize*2];
unordered_multiset_type testset1(&values[0], &values[0] + 6, bucket_traits(buckets1, BucketSize));
- BOOST_TEST (testset1.size() == 6);
+ BOOST_TEST (testset1.size() == values.size());
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
testset1.rehash(bucket_traits(buckets2, 2));
- BOOST_TEST (testset1.size() == 6);
+ BOOST_TEST (testset1.size() == values.size());
{ int init_values [] = { 4, 2, 2, 5, 3, 1 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
testset1.rehash(bucket_traits(buckets3, BucketSize*2));
- BOOST_TEST (testset1.size() == 6);
+ BOOST_TEST (testset1.size() == values.size());
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
//Now rehash reducing the buckets
testset1.rehash(bucket_traits(buckets3, 2));
- BOOST_TEST (testset1.size() == 6);
+ BOOST_TEST (testset1.size() == values.size());
{ int init_values [] = { 4, 2, 2, 5, 3, 1 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
//Now rehash increasing the buckets
testset1.rehash(bucket_traits(buckets3, BucketSize*2));
- BOOST_TEST (testset1.size() == 6);
+ BOOST_TEST (testset1.size() == values.size());
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
}
//test: find, equal_range (lower_bound, upper_bound):
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_find(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>::
+ test_find(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -363,6 +571,7 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
@@ -387,8 +596,8 @@
}
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
::test_clone(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
@@ -398,6 +607,7 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
{
@@ -442,7 +652,7 @@
unordered_multiset_type testset2 (bucket_traits(buckets2, BucketSize*2));
testset2.clone_from(testset1, test::new_cloner<value_type>(), test::delete_disposer<value_type>());
- //Ordering is not guarantee in the cloning so insert data in a set and test
+ //Ordering is not guaranteed in the cloning so insert data in a set and test
std::multiset<typename ValueTraits::value_type>
src(testset1.begin(), testset1.end());
std::multiset<typename ValueTraits::value_type>
@@ -453,7 +663,7 @@
}
}
-template<class VoidPointer, bool constant_time_size>
+template<class VoidPointer, bool constant_time_size, bool Incremental>
class test_main_template
{
public:
@@ -471,6 +681,7 @@
>::type
, true
, false
+ , Incremental
>::test_all(data);
test_unordered_multiset < typename detail::get_member_value_traits
@@ -482,14 +693,15 @@
>::type
, false
, false
+ , Incremental
>::test_all(data);
return 0;
}
};
-template<class VoidPointer>
-class test_main_template<VoidPointer, false>
+template<class VoidPointer, bool Incremental>
+class test_main_template<VoidPointer, false, Incremental>
{
public:
int operator()()
@@ -506,6 +718,7 @@
>::type
, true
, false
+ , Incremental
>::test_all(data);
test_unordered_multiset < typename detail::get_member_value_traits
@@ -517,6 +730,7 @@
>::type
, false
, false
+ , Incremental
>::test_all(data);
test_unordered_multiset < typename detail::get_base_value_traits
@@ -525,6 +739,7 @@
>::type
, true
, true
+ , Incremental
>::test_all(data);
test_unordered_multiset < typename detail::get_member_value_traits
@@ -536,6 +751,7 @@
>::type
, false
, true
+ , Incremental
>::test_all(data);
return 0;
}
@@ -543,10 +759,14 @@
int main( int, char* [] )
{
- test_main_template<void*, false>()();
- test_main_template<smart_ptr<void>, false>()();
- test_main_template<void*, true>()();
- test_main_template<smart_ptr<void>, true>()();
+ test_main_template<void*, false, true>()();
+ test_main_template<smart_ptr<void>, false, true>()();
+ test_main_template<void*, true, true>()();
+ test_main_template<smart_ptr<void>, true, true>()();
+ test_main_template<void*, false, false>()();
+ test_main_template<smart_ptr<void>, false, false>()();
+ test_main_template<void*, true, true>()();
+ test_main_template<smart_ptr<void>, true, false>()();
return boost::report_errors();
}
Modified: sandbox/metagraph/libs/intrusive/test/unordered_set_test.cpp
==============================================================================
--- sandbox/metagraph/libs/intrusive/test/unordered_set_test.cpp (original)
+++ sandbox/metagraph/libs/intrusive/test/unordered_set_test.cpp 2008-11-08 14:32:39 EST (Sat, 08 Nov 2008)
@@ -24,9 +24,9 @@
using namespace boost::intrusive;
-static const std::size_t BucketSize = 11;
+static const std::size_t BucketSize = 8;
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
struct test_unordered_set
{
typedef typename ValueTraits::value_type value_type;
@@ -34,14 +34,16 @@
static void test_sort(std::vector<value_type>& values);
static void test_insert(std::vector<value_type>& values);
static void test_swap(std::vector<value_type>& values);
- static void test_rehash(std::vector<value_type>& values);
+ static void test_rehash(std::vector<value_type>& values, detail::true_);
+ static void test_rehash(std::vector<value_type>& values, detail::false_);
static void test_find(std::vector<value_type>& values);
static void test_impl();
static void test_clone(std::vector<value_type>& values);
};
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_all(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
+ test_all(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -50,6 +52,7 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
{
@@ -70,15 +73,15 @@
test_sort(values);
test_insert(values);
test_swap(values);
- test_rehash(values);
+ test_rehash(values, detail::bool_<Incremental>());
test_find(values);
test_impl();
test_clone(values);
}
//test case due to an error in tree implementation:
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_impl()
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::test_impl()
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -87,6 +90,7 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
@@ -107,8 +111,9 @@
}
//test: constructor, iterator, clear, reverse_iterator, front, back, size:
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_sort(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
+ test_sort(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -117,23 +122,31 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
typename unordered_set_type::bucket_type buckets [BucketSize];
unordered_set_type testset1(values.begin(), values.end(), bucket_traits(buckets, BucketSize));
-
BOOST_TEST (5 == std::distance(testset1.begin(), testset1.end()));
- { int init_values [] = { 1, 2, 3, 4, 5 };
- TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ if(Incremental){
+ { int init_values [] = { 4, 5, 1, 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ }
+ else{
+ { int init_values [] = { 1, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ }
testset1.clear();
BOOST_TEST (testset1.empty());
}
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_insert(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
+ test_insert(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -142,6 +155,7 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
@@ -150,27 +164,47 @@
testset.insert(&values[0] + 2, &values[0] + 5);
const unordered_set_type& const_testset = testset;
- { int init_values [] = { 1, 4, 5 };
- TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+ if(Incremental)
+ {
+ { int init_values [] = { 4, 5, 1 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+ typename unordered_set_type::iterator i = testset.begin();
+ BOOST_TEST (i->value_ == 4);
+
+ i = testset.insert(values[0]).first;
+ BOOST_TEST (&*i == &values[0]);
- typename unordered_set_type::iterator i = testset.begin();
- BOOST_TEST (i->value_ == 1);
+ i = testset.iterator_to (values[2]);
+ BOOST_TEST (&*i == &values[2]);
- i = testset.insert(values[0]).first;
- BOOST_TEST (&*i == &values[0]);
+ testset.erase (i);
- i = testset.iterator_to (values[2]);
- BOOST_TEST (&*i == &values[2]);
+ { int init_values [] = { 5, 1, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+ }
+ else{
+ { int init_values [] = { 1, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+ typename unordered_set_type::iterator i = testset.begin();
+ BOOST_TEST (i->value_ == 1);
+
+ i = testset.insert(values[0]).first;
+ BOOST_TEST (&*i == &values[0]);
+
+ i = testset.iterator_to (values[2]);
+ BOOST_TEST (&*i == &values[2]);
- testset.erase (i);
+ testset.erase (i);
- { int init_values [] = { 1, 3, 5 };
- TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+ { int init_values [] = { 1, 3, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
+ }
}
//test: insert (seq-version), swap, erase (seq-version), size:
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_swap(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
+ test_swap(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -179,6 +213,7 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
@@ -190,20 +225,30 @@
testset2.insert (&values[0] + 2, &values[0] + 6);
testset1.swap (testset2);
- { int init_values [] = { 1, 2, 4, 5 };
+ if(Incremental){
+ { int init_values [] = { 4, 5, 1, 2 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ { int init_values [] = { 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset2.begin() ); }
+ testset1.erase (testset1.iterator_to(values[4]), testset1.end());
+ BOOST_TEST (testset1.size() == 1);
+ BOOST_TEST (&*testset1.begin() == &values[2]);
+ }
+ else{
+ { int init_values [] = { 1, 2, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
- { int init_values [] = { 2, 3 };
+ { int init_values [] = { 2, 3 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset2.begin() ); }
-
- testset1.erase (testset1.iterator_to(values[5]), testset1.end());
- BOOST_TEST (testset1.size() == 1);
- // BOOST_TEST (&testset1.front() == &values[3]);
- BOOST_TEST (&*testset1.begin() == &values[3]);
+ testset1.erase (testset1.iterator_to(values[5]), testset1.end());
+ BOOST_TEST (testset1.size() == 1);
+ BOOST_TEST (&*testset1.begin() == &values[3]);
+ }
}
//test: rehash:
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_rehash(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
+ test_rehash(std::vector<typename ValueTraits::value_type>& values, detail::true_)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -212,6 +257,137 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
+ > unordered_set_type;
+ typedef typename unordered_set_type::bucket_traits bucket_traits;
+ //Build a uset
+ typename unordered_set_type::bucket_type buckets1 [BucketSize];
+ typename unordered_set_type::bucket_type buckets2 [BucketSize*2];
+ unordered_set_type testset1(&values[0], &values[0] + 6, bucket_traits(buckets1, BucketSize));
+ //Test current state
+ BOOST_TEST(testset1.split_count() == BucketSize/2);
+ { int init_values [] = { 4, 5, 1, 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Incremental rehash step
+ BOOST_TEST (testset1.incremental_rehash() == true);
+ BOOST_TEST(testset1.split_count() == (BucketSize/2+1));
+ { int init_values [] = { 5, 1, 2, 3, 4 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Rest of incremental rehashes should lead to the same sequence
+ for(std::size_t split_bucket = testset1.split_count(); split_bucket != BucketSize; ++split_bucket){
+ BOOST_TEST (testset1.incremental_rehash() == true);
+ BOOST_TEST(testset1.split_count() == (split_bucket+1));
+ { int init_values [] = { 1, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ }
+ //This incremental rehash should fail because we've reached the end of the bucket array
+ BOOST_TEST(testset1.incremental_rehash() == false);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //
+ //Try incremental hashing specifying a new bucket traits pointing to the same array
+ //
+ //This incremental rehash should fail because the new size is not twice the original
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets1, BucketSize)) == false);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //This incremental rehash should success because the new size is twice the original
+ //and split_count is the same as the old bucket count
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets1, BucketSize*2)) == true);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //This incremental rehash should also success because the new size is half the original
+ //and split_count is the same as the new bucket count
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets1, BucketSize)) == true);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //
+ //Try incremental hashing specifying a new bucket traits pointing to the same array
+ //
+ //This incremental rehash should fail because the new size is not twice the original
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets2, BucketSize)) == false);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //This incremental rehash should success because the new size is twice the original
+ //and split_count is the same as the old bucket count
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets2, BucketSize*2)) == true);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //This incremental rehash should also success because the new size is half the original
+ //and split_count is the same as the new bucket count
+ BOOST_TEST(testset1.incremental_rehash(bucket_traits(buckets1, BucketSize)) == true);
+ BOOST_TEST(testset1.split_count() == BucketSize);
+ { int init_values [] = { 1, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+
+ //Full shrink rehash
+ testset1.rehash(bucket_traits(buckets1, 4));
+ BOOST_TEST (testset1.size() == values.size()-1);
+ BOOST_TEST (testset1.incremental_rehash() == false);
+ { int init_values [] = { 4, 5, 1, 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Full shrink rehash again
+ testset1.rehash(bucket_traits(buckets1, 2));
+ BOOST_TEST (testset1.size() == values.size()-1);
+ BOOST_TEST (testset1.incremental_rehash() == false);
+ { int init_values [] = { 2, 4, 3, 5, 1 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Full growing rehash
+ testset1.rehash(bucket_traits(buckets1, BucketSize));
+ BOOST_TEST (testset1.size() == values.size()-1);
+ BOOST_TEST (testset1.incremental_rehash() == false);
+ { int init_values [] = { 1, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Incremental rehash shrinking
+ //First incremental rehashes should lead to the same sequence
+ for(std::size_t split_bucket = testset1.split_count(); split_bucket > 6; --split_bucket){
+ BOOST_TEST (testset1.incremental_rehash(false) == true);
+ BOOST_TEST(testset1.split_count() == (split_bucket-1));
+ { int init_values [] = { 1, 2, 3, 4, 5 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ }
+ //Incremental rehash step
+ BOOST_TEST (testset1.incremental_rehash(false) == true);
+ BOOST_TEST(testset1.split_count() == (BucketSize/2+1));
+ { int init_values [] = { 5, 1, 2, 3, 4 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //Incremental rehash step 2
+ BOOST_TEST (testset1.incremental_rehash(false) == true);
+ BOOST_TEST(testset1.split_count() == (BucketSize/2));
+ { int init_values [] = { 4, 5, 1, 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+ //This incremental rehash should fail because we've reached the half of the bucket array
+ BOOST_TEST(testset1.incremental_rehash(false) == false);
+ BOOST_TEST(testset1.split_count() == BucketSize/2);
+ { int init_values [] = { 4, 5, 1, 2, 3 };
+ TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
+}
+
+//test: rehash:
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
+ test_rehash(std::vector<typename ValueTraits::value_type>& values, detail::false_)
+{
+ typedef typename ValueTraits::value_type value_type;
+ typedef unordered_set
+ <value_type
+ , value_traits<ValueTraits>
+ , constant_time_size<value_type::constant_time_size>
+ , cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
@@ -220,37 +396,38 @@
typename unordered_set_type::bucket_type buckets3 [BucketSize*2];
unordered_set_type testset1(&values[0], &values[0] + 6, bucket_traits(buckets1, BucketSize));
- BOOST_TEST (testset1.size() == 5);
+ BOOST_TEST (testset1.size() == values.size()-1);
{ int init_values [] = { 1, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
testset1.rehash(bucket_traits(buckets2, 2));
- BOOST_TEST (testset1.size() == 5);
+ BOOST_TEST (testset1.size() == values.size()-1);
{ int init_values [] = { 4, 2, 5, 3, 1 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
testset1.rehash(bucket_traits(buckets3, BucketSize*2));
- BOOST_TEST (testset1.size() == 5);
+ BOOST_TEST (testset1.size() == values.size()-1);
{ int init_values [] = { 1, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
//Now rehash reducing the buckets
testset1.rehash(bucket_traits(buckets3, 2));
- BOOST_TEST (testset1.size() == 5);
+ BOOST_TEST (testset1.size() == values.size()-1);
{ int init_values [] = { 4, 2, 5, 3, 1 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
//Now rehash increasing the buckets
testset1.rehash(bucket_traits(buckets3, BucketSize*2));
- BOOST_TEST (testset1.size() == 5);
+ BOOST_TEST (testset1.size() == values.size()-1);
{ int init_values [] = { 1, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
}
//test: find, equal_range (lower_bound, upper_bound):
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_find(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
+ test_find(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -259,6 +436,7 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
@@ -281,8 +459,8 @@
BOOST_TEST (testset.find (cmp_val) == testset.end());
}
-template<class ValueTraits, bool CacheBegin, bool CompareHash>
-void test_unordered_set<ValueTraits, CacheBegin, CompareHash>
+template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>
::test_clone(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
@@ -292,6 +470,7 @@
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
, compare_hash<CompareHash>
+ , incremental<Incremental>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
{
@@ -319,7 +498,7 @@
unordered_set_type testset2 (bucket_traits(buckets2, BucketSize));
testset2.clone_from(testset1, test::new_cloner<value_type>(), test::delete_disposer<value_type>());
- //Ordering is not guarantee in the cloning so insert data in a set and test
+ //Ordering is not guaranteed in the cloning so insert data in a set and test
std::set<typename ValueTraits::value_type>
src(testset1.begin(), testset1.end());
std::set<typename ValueTraits::value_type>
@@ -347,7 +526,7 @@
}
}
-template<class VoidPointer, bool constant_time_size>
+template<class VoidPointer, bool constant_time_size, bool incremental>
class test_main_template
{
public:
@@ -365,6 +544,7 @@
>::type
, true
, false
+ , incremental
>::test_all(data);
test_unordered_set < typename detail::get_member_value_traits
< value_type
@@ -375,14 +555,15 @@
>::type
, false
, false
+ , incremental
>::test_all(data);
return 0;
}
};
-template<class VoidPointer>
-class test_main_template<VoidPointer, false>
+template<class VoidPointer, bool incremental>
+class test_main_template<VoidPointer, false, incremental>
{
public:
int operator()()
@@ -399,6 +580,7 @@
>::type
, true
, false
+ , incremental
>::test_all(data);
test_unordered_set < typename detail::get_member_value_traits
@@ -410,6 +592,7 @@
>::type
, false
, false
+ , incremental
>::test_all(data);
test_unordered_set < typename detail::get_base_value_traits
@@ -418,6 +601,7 @@
>::type
, true
, true
+ , incremental
>::test_all(data);
test_unordered_set < typename detail::get_member_value_traits
@@ -429,6 +613,7 @@
>::type
, false
, true
+ , incremental
>::test_all(data);
return 0;
}
@@ -436,10 +621,14 @@
int main( int, char* [] )
{
- test_main_template<void*, false>()();
- test_main_template<smart_ptr<void>, false>()();
- test_main_template<void*, true>()();
- test_main_template<smart_ptr<void>, true>()();
+ test_main_template<void*, false, true>()();
+ test_main_template<smart_ptr<void>, false, true>()();
+ test_main_template<void*, true, true>()();
+ test_main_template<smart_ptr<void>, true, true>()();
+ test_main_template<void*, false, false>()();
+ test_main_template<smart_ptr<void>, false, false>()();
+ test_main_template<void*, true, true>()();
+ test_main_template<smart_ptr<void>, true, false>()();
return boost::report_errors();
}
#include <boost/intrusive/detail/config_end.hpp>
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