Changes and fixes for Boost 1.37

[SVN r49322]
This commit is contained in:
Ion Gaztañaga
2008-10-13 19:36:50 +00:00
parent 8e236cb98a
commit 2dd87072b7
35 changed files with 2283 additions and 1029 deletions

View File

@@ -34,7 +34,7 @@ struct get_any_node_algo
//! Helper metafunction to define a \c \c any_base_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none> template<class O1 = none, class O2 = none, class O3 = none>
@@ -43,8 +43,14 @@ struct make_any_base_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_any_node_algo<typename packed_options::void_pointer> < get_any_node_algo<typename packed_options::void_pointer>
, typename packed_options::tag , typename packed_options::tag
@@ -70,15 +76,21 @@ struct make_any_base_hook
//! //!
//! \c void_pointer<> is the pointer type that will be used internally in the hook //! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this 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> template<class ...Options>
#else #else
template<class O1, class O2, class O3> template<class O1, class O2, class O3>
#endif #endif
class any_base_hook 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: public:
//! <b>Effects</b>: If link_mode is or \c safe_link //! <b>Effects</b>: If link_mode is or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
@@ -127,7 +139,7 @@ class any_base_hook
//! Helper metafunction to define a \c \c any_member_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none> template<class O1 = none, class O2 = none, class O3 = none>
@@ -136,7 +148,13 @@ struct make_any_member_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_any_node_algo<typename packed_options::void_pointer> < get_any_node_algo<typename packed_options::void_pointer>
@@ -158,15 +176,21 @@ struct make_any_member_hook
//! //!
//! \c void_pointer<> is the pointer type that will be used internally in the hook //! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this 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> template<class ...Options>
#else #else
template<class O1, class O2, class O3> template<class O1, class O2, class O3>
#endif #endif
class any_member_hook 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: public:
//! <b>Effects</b>: If link_mode is or \c safe_link //! <b>Effects</b>: If link_mode is or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.

View File

@@ -31,7 +31,7 @@ namespace intrusive {
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and //! \c constant_time_size<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -323,18 +323,19 @@ class avl_set_impl
{ tree_.swap(other.tree_); } { tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const avl_set_impl &src, Cloner cloner, Disposer disposer) void clone_from(const avl_set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); } { tree_.clone_from(src.tree_, cloner, disposer); }
@@ -996,65 +997,65 @@ class avl_set_impl
/// @endcond /// @endcond
}; };
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y)
#else #else
(const avl_set_impl<Config> &x, const avl_set_impl<Config> &y) (const avl_set_impl<Config> &x, const avl_set_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y)
#else #else
(const avl_set_impl<Config> &x, const avl_set_impl<Config> &y) (const avl_set_impl<Config> &x, const avl_set_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y)
#else #else
(const avl_set_impl<Config> &x, const avl_set_impl<Config> &y) (const avl_set_impl<Config> &x, const avl_set_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y)
#else #else
(const avl_set_impl<Config> &x, const avl_set_impl<Config> &y) (const avl_set_impl<Config> &x, const avl_set_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap 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) (avl_set_impl<T, Options...> &x, avl_set_impl<T, Options...> &y)
#else #else
(avl_set_impl<Config> &x, avl_set_impl<Config> &y) (avl_set_impl<Config> &x, avl_set_impl<Config> &y)
@@ -1063,7 +1064,7 @@ inline void swap
//! Helper metafunction to define a \c avl_set that yields to the same type when the //! Helper metafunction to define a \c avl_set that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -1073,19 +1074,41 @@ struct make_avl_set
{ {
/// @cond /// @cond
typedef avl_set_impl 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class avl_set 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 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: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;
@@ -1134,7 +1157,7 @@ class avl_set
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and //! \c constant_time_size<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -1422,18 +1445,19 @@ class avl_multiset_impl
{ tree_.swap(other.tree_); } { tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const avl_multiset_impl &src, Cloner cloner, Disposer disposer) void clone_from(const avl_multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); } { tree_.clone_from(src.tree_, cloner, disposer); }
@@ -2002,65 +2026,65 @@ class avl_multiset_impl
/// @endcond /// @endcond
}; };
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y)
#else #else
(const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y) (const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y)
#else #else
(const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y) (const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y)
#else #else
(const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y) (const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y)
#else #else
(const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y) (const avl_multiset_impl<Config> &x, const avl_multiset_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap 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) (avl_multiset_impl<T, Options...> &x, avl_multiset_impl<T, Options...> &y)
#else #else
(avl_multiset_impl<Config> &x, avl_multiset_impl<Config> &y) (avl_multiset_impl<Config> &x, avl_multiset_impl<Config> &y)
@@ -2069,7 +2093,7 @@ inline void swap
//! Helper metafunction to define a \c avl_multiset that yields to the same type when the //! Helper metafunction to define a \c avl_multiset that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -2079,19 +2103,41 @@ struct make_avl_multiset
{ {
/// @cond /// @cond
typedef avl_multiset_impl 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class avl_multiset 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 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: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;

View File

@@ -34,7 +34,7 @@ struct get_avl_set_node_algo
//! Helper metafunction to define a \c avl_set_base_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none> template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -43,7 +43,12 @@ struct make_avl_set_base_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_avl_set_node_algo<typename packed_options::void_pointer < get_avl_set_node_algo<typename packed_options::void_pointer
@@ -76,15 +81,21 @@ struct make_avl_set_base_hook
//! //!
//! \c optimize_size<> will tell the hook to optimize the hook for size instead //! \c optimize_size<> will tell the hook to optimize the hook for size instead
//! of speed. //! of speed.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options> template<class ...Options>
#else #else
template<class O1, class O2, class O3, class O4> template<class O1, class O2, class O3, class O4>
#endif #endif
class avl_set_base_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!
@@ -153,7 +164,7 @@ class avl_set_base_hook
//! Helper metafunction to define a \c avl_set_member_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none> template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -162,7 +173,12 @@ struct make_avl_set_member_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_avl_set_node_algo<typename packed_options::void_pointer < get_avl_set_node_algo<typename packed_options::void_pointer
@@ -190,15 +206,21 @@ struct make_avl_set_member_hook
//! //!
//! \c optimize_size<> will tell the hook to optimize the hook for size instead //! \c optimize_size<> will tell the hook to optimize the hook for size instead
//! of speed. //! of speed.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options> template<class ...Options>
#else #else
template<class O1, class O2, class O3, class O4> template<class O1, class O2, class O3, class O4>
#endif #endif
class avl_set_member_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!

View File

@@ -36,20 +36,6 @@ namespace intrusive {
/// @cond /// @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> template <class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize>
struct avl_setopt struct avl_setopt
{ {
@@ -63,13 +49,7 @@ template <class T>
struct avl_set_defaults struct avl_set_defaults
: pack_options : pack_options
< none < none
, base_hook , base_hook<detail::default_avl_set_hook>
< typename detail::eval_if_c
< internal_default_avl_set_hook<T>::value
, get_default_avl_set_hook<T>
, detail::identity<none>
>::type
>
, constant_time_size<true> , constant_time_size<true>
, size_type<std::size_t> , size_type<std::size_t>
, compare<std::less<T> > , compare<std::less<T> >
@@ -91,7 +71,7 @@ struct avl_set_defaults
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and //! \c constant_time_size<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -1055,29 +1035,34 @@ class avltree_impl
} }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const avltree_impl &src, Cloner cloner, Disposer disposer) void clone_from(const avltree_impl &src, Cloner cloner, Disposer disposer)
{ {
this->clear_and_dispose(disposer); this->clear_and_dispose(disposer);
if(!src.empty()){ if(!src.empty()){
detail::exception_disposer<avltree_impl, Disposer>
rollback(*this, disposer);
node_algorithms::clone node_algorithms::clone
(const_node_ptr(&src.priv_header()) (const_node_ptr(&src.priv_header())
,node_ptr(&this->priv_header()) ,node_ptr(&this->priv_header())
,detail::node_cloner<Cloner, avltree_impl>(cloner, this) ,detail::node_cloner<Cloner, avltree_impl>(cloner, this)
,detail::node_disposer<Disposer, avltree_impl>(disposer, this)); ,detail::node_disposer<Disposer, avltree_impl>(disposer, this));
this->priv_size_traits().set_size(src.priv_size_traits().get_size()); this->priv_size_traits().set_size(src.priv_size_traits().get_size());
this->priv_comp() = src.priv_comp();
rollback.release();
} }
} }
@@ -1260,26 +1245,26 @@ class avltree_impl
{ return priv_container_from_end_iterator(it.end_iterator_from_it()); } { 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator< 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) (const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else #else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y) (const avltree_impl<Config> &x, const avltree_impl<Config> &y)
#endif #endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } { 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
bool operator== 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) (const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else #else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y) (const avltree_impl<Config> &x, const avltree_impl<Config> &y)
@@ -1311,65 +1296,65 @@ bool operator==
} }
} }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else #else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y) (const avltree_impl<Config> &x, const avltree_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else #else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y) (const avltree_impl<Config> &x, const avltree_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else #else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y) (const avltree_impl<Config> &x, const avltree_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y)
#else #else
(const avltree_impl<Config> &x, const avltree_impl<Config> &y) (const avltree_impl<Config> &x, const avltree_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap inline void swap
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(avltree_impl<T, Options...> &x, avltree_impl<T, Options...> &y) (avltree_impl<T, Options...> &x, avltree_impl<T, Options...> &y)
#else #else
(avltree_impl<Config> &x, avltree_impl<Config> &y) (avltree_impl<Config> &x, avltree_impl<Config> &y)
@@ -1377,15 +1362,24 @@ inline void swap
{ x.swap(y); } { x.swap(y); }
/// @cond /// @cond
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
, class O3 = none, class O4 = 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 struct make_avltree_opt
{ {
typedef typename pack_options 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 typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits; <T, typename packed_options::value_traits>::type value_traits;
@@ -1400,7 +1394,7 @@ struct make_avltree_opt
//! Helper metafunction to define a \c avltree that yields to the same type when the //! Helper metafunction to define a \c avltree that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -1410,19 +1404,37 @@ struct make_avltree
{ {
/// @cond /// @cond
typedef avltree_impl typedef avltree_impl
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
< typename make_avltree_opt<T, O1, O2, O3, O4>::type < typename make_avltree_opt<T, O1, O2, O3, O4>::type
#else
< typename make_avltree_opt<T, Options...>::type
#endif
> implementation_defined; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class avltree class avltree
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
: public make_avltree<T, O1, O2, O3, O4>::type : public make_avltree<T, O1, O2, O3, O4>::type
#else
: public make_avltree<T, Options...>::type
#endif
{ {
typedef typename make_avltree 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: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;

View File

@@ -682,10 +682,10 @@ class avltree_algorithms
// x is right child // x is right child
// a is left child // a is left child
node_ptr a = NodeTraits::get_left(x_parent); node_ptr a = NodeTraits::get_left(x_parent);
assert(a); BOOST_INTRUSIVE_INVARIANT_ASSERT(a);
if (NodeTraits::get_balance(a) == NodeTraits::positive()) { if (NodeTraits::get_balance(a) == NodeTraits::positive()) {
// a MUST have a right child // 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); rotate_left_right(x_parent, root);
x = NodeTraits::get_parent(x_parent); x = NodeTraits::get_parent(x_parent);
@@ -714,10 +714,10 @@ class avltree_algorithms
// x is left child // x is left child
// a is right child // a is right child
node_ptr a = NodeTraits::get_right(x_parent); node_ptr a = NodeTraits::get_right(x_parent);
assert(a); BOOST_INTRUSIVE_INVARIANT_ASSERT(a);
if (NodeTraits::get_balance(a) == NodeTraits::negative()) { if (NodeTraits::get_balance(a) == NodeTraits::negative()) {
// a MUST have then a left child // 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); rotate_right_left(x_parent, root);
x = NodeTraits::get_parent(x_parent); x = NodeTraits::get_parent(x_parent);
@@ -735,7 +735,7 @@ class avltree_algorithms
} }
} }
else{ else{
assert(false); // never reached BOOST_INTRUSIVE_INVARIANT_ASSERT(false); // never reached
} }
} }
NodeTraits::set_parent(header, root); NodeTraits::set_parent(header, root);
@@ -784,7 +784,7 @@ class avltree_algorithms
break; break;
} }
else{ else{
assert(false); // never reached BOOST_INTRUSIVE_INVARIANT_ASSERT(false); // never reached
} }
} }
NodeTraits::set_parent(header, root); NodeTraits::set_parent(header, root);
@@ -842,7 +842,7 @@ class avltree_algorithms
NodeTraits::set_balance(b, NodeTraits::negative()); NodeTraits::set_balance(b, NodeTraits::negative());
} }
else{ else{
assert(false); // never reached BOOST_INTRUSIVE_INVARIANT_ASSERT(false); // never reached
} }
NodeTraits::set_balance(c, NodeTraits::zero()); NodeTraits::set_balance(c, NodeTraits::zero());
} }
@@ -899,7 +899,7 @@ class avltree_algorithms
NodeTraits::set_balance(b, NodeTraits::zero()); NodeTraits::set_balance(b, NodeTraits::zero());
} }
else{ else{
assert(false); BOOST_INTRUSIVE_INVARIANT_ASSERT(false);
} }
NodeTraits::set_balance(c, NodeTraits::zero()); NodeTraits::set_balance(c, NodeTraits::zero());
} }

View File

@@ -34,7 +34,7 @@ struct get_bs_set_node_algo
//! Helper metafunction to define a \c bs_set_base_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none> template<class O1 = none, class O2 = none, class O3 = none>
@@ -43,7 +43,12 @@ struct make_bs_set_base_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 //Scapegoat trees can't be auto unlink trees
BOOST_STATIC_ASSERT(((int)packed_options::link_mode != (int)auto_unlink)); BOOST_STATIC_ASSERT(((int)packed_options::link_mode != (int)auto_unlink));
@@ -75,15 +80,22 @@ struct make_bs_set_base_hook
//! //!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, //! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_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> template<class ...Options>
#else #else
template<class O1, class O2, class O3> template<class O1, class O2, class O3>
#endif #endif
class bs_set_base_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!
@@ -152,7 +164,7 @@ class bs_set_base_hook
//! Helper metafunction to define a \c bs_set_member_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none> template<class O1 = none, class O2 = none, class O3 = none>
@@ -161,7 +173,13 @@ struct make_bs_set_member_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 //Scapegoat trees can't be auto unlink trees
BOOST_STATIC_ASSERT(((int)packed_options::link_mode != (int)auto_unlink)); BOOST_STATIC_ASSERT(((int)packed_options::link_mode != (int)auto_unlink));
@@ -187,15 +205,21 @@ struct make_bs_set_member_hook
//! //!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, //! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_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> template<class ...Options>
#else #else
template<class O1, class O2, class O3> template<class O1, class O2, class O3>
#endif #endif
class bs_set_member_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!
@@ -262,24 +286,6 @@ class bs_set_member_hook
#endif #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 intrusive
} //namespace boost } //namespace boost

View File

@@ -59,7 +59,7 @@ class circular_slist_algorithms
typedef typename NodeTraits::const_node_ptr const_node_ptr; typedef typename NodeTraits::const_node_ptr const_node_ptr;
typedef NodeTraits node_traits; 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 //! <b>Effects</b>: Constructs an non-used list element, putting the next
//! pointer to null: //! pointer to null:
@@ -128,7 +128,7 @@ class circular_slist_algorithms
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
static void transfer_after(node_ptr p, node_ptr b, node_ptr e); 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 //! <b>Effects</b>: Constructs an empty list, making this_node the only
//! node of the circular list: //! node of the circular list:

View File

@@ -18,6 +18,7 @@
#include <boost/intrusive/detail/assert.hpp> #include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/detail/pointer_to_other.hpp> #include <boost/intrusive/detail/pointer_to_other.hpp>
#include <cstddef> #include <cstddef>
#include <boost/intrusive/detail/mpl.hpp>
namespace boost { namespace boost {
namespace intrusive { namespace intrusive {
@@ -238,6 +239,10 @@ class any_node_traits
template<class VoidPointer> template<class VoidPointer>
class any_algorithms class any_algorithms
{ {
template <class T>
static void function_not_available_for_any_hooks(typename detail::enable_if<detail::is_same<T, bool> >::type)
{}
public: public:
typedef any_node<VoidPointer> node; typedef any_node<VoidPointer> node;
typedef typename boost::pointer_to_other typedef typename boost::pointer_to_other
@@ -269,28 +274,18 @@ class any_algorithms
static bool unique(const_node_ptr node) static bool unique(const_node_ptr node)
{ return 0 == node->node_ptr_1; } { return 0 == node->node_ptr_1; }
#if defined(__EDG__) && defined(__STD_STRICT_ANSI)
// For compilers checking the full source code at compile time, regardless
// of whether the code is instantiated or not, we turn the compile error
// below into a link error.
static void unlink(node_ptr);
static void swap_nodes(node_ptr l, node_ptr r);
#else
static void unlink(node_ptr) static void unlink(node_ptr)
{ {
//Auto-unlink hooks and unlink() call for safe hooks are not //Auto-unlink hooks and unlink() are not available for any hooks
//available for any hooks!!! any_algorithms<VoidPointer>::template function_not_available_for_any_hooks<node_ptr>();
any_algorithms<VoidPointer>::unlink_not_available_for_any_hooks();
} }
static void swap_nodes(node_ptr l, node_ptr r) static void swap_nodes(node_ptr l, node_ptr r)
{ {
//Any nodes have no swap_nodes capability because they don't know //Any nodes have no swap_nodes capability because they don't know
//what algorithm they must use from unlink them from the container //what algorithm they must use to unlink the node from the container
any_algorithms<VoidPointer>::swap_nodes_not_available_for_any_hooks(); any_algorithms<VoidPointer>::template function_not_available_for_any_hooks<node_ptr>();
} }
#endif
}; };
} //namespace intrusive } //namespace intrusive

View File

@@ -18,18 +18,24 @@
#endif #endif
#if !defined(BOOST_INTRUSIVE_INVARIANT_ASSERT) #if !defined(BOOST_INTRUSIVE_INVARIANT_ASSERT)
#include <boost/assert.hpp> #include <boost/assert.hpp>
#define BOOST_INTRUSIVE_INVARIANT_ASSERT BOOST_ASSERT #define BOOST_INTRUSIVE_INVARIANT_ASSERT BOOST_ASSERT
#elif defined(BOOST_INTRUSIVE_INVARIANT_ASSERT_INCLUDE)
#include BOOST_INTRUSIVE_INVARIANT_ASSERT_INCLUDE
#endif #endif
#if !defined(BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT) #if !defined(BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT)
#include <boost/assert.hpp> #include <boost/assert.hpp>
#define BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT BOOST_ASSERT #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 #endif
#if !defined(BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT) #if !defined(BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT)
#include <boost/assert.hpp> #include <boost/assert.hpp>
#define BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT BOOST_ASSERT #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
#endif //BOOST_INTRUSIVE_DETAIL_ASSERT_HPP #endif //BOOST_INTRUSIVE_DETAIL_ASSERT_HPP

View File

@@ -161,6 +161,9 @@ class list_iterator
return 0; return 0;
} }
list_iterator<Container, false> unconst() const
{ return list_iterator<Container, false>(this->pointed_node(), this->get_container()); }
private: private:
struct members struct members
: public detail::select_constptr : public detail::select_constptr

View File

@@ -51,6 +51,12 @@ struct enable_if_c<false, T> {};
template <class Cond, class T = void> template <class Cond, class T = void>
struct enable_if : public enable_if_c<Cond::value, T>{}; 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> template <class T, class U>
class is_convertible class is_convertible
{ {
@@ -127,83 +133,127 @@ struct identity
#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS #define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
#endif #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 (*)( ...));
#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 ...));
#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));
#endif
template <class R , class T0 , class T1 >
yes_type is_function_ptr_tester(R (*)( T0 , T1));
#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));
#endif
template <typename T> template <typename T>
struct is_unary_or_binary_function_impl struct is_unary_or_binary_function_impl
{ { static const bool value = false; };
static T* t;
static const bool value = sizeof(is_function_ptr_tester(t)) == sizeof(yes_type);
};
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 <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 <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 <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 <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> template <typename T>
struct is_unary_or_binary_function_impl<T&> struct is_unary_or_binary_function_impl<T&>
{ { static const bool value = false; };
static const bool value = false;
};
template<typename T> template<typename T>
struct is_unary_or_binary_function 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 //boost::alignment_of yields to 10K lines of preprocessed code, so we
//need an alternative //need an alternative

View File

@@ -128,6 +128,9 @@ class slist_iterator
return 0; 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 const real_value_traits *get_real_value_traits() const
{ {
if(store_container_ptr) if(store_container_ptr)

View File

@@ -1391,14 +1391,14 @@ class tree_algorithms
//Taken from: //Taken from:
//"Tree rebalancing in optimal time and space" //"Tree rebalancing in optimal time and space"
//Quentin F. Stout and Bette L. Warren //Quentin F. Stout and Bette L. Warren
std::size_t len; std::size_t len = 0;
subtree_to_vine(NodeTraits::get_parent(header), &len); subtree_to_vine(NodeTraits::get_parent(header), &len);
vine_to_subtree(NodeTraits::get_parent(header), len); vine_to_subtree(NodeTraits::get_parent(header), len);
} }
static node_ptr rebalance_subtree(node_ptr old_root) 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); node_ptr new_root = subtree_to_vine(old_root, &len);
return vine_to_subtree(new_root, len); return vine_to_subtree(new_root, len);
} }

View File

@@ -0,0 +1,30 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005-2008. 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)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
#define BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)
// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
// passed on the command line, which in turn defines
// __GXX_EXPERIMENTAL_CXX0X__. Note: __GXX_EXPERIMENTAL_CPP0X__ is
// defined by some very early development versions of GCC 4.3; we will
// remove this part of the check in the near future.
# if defined(__GXX_EXPERIMENTAL_CPP0X__) || defined(__GXX_EXPERIMENTAL_CXX0X__)
# define BOOST_INTRUSIVE_RVALUE_REFERENCE
# define BOOST_INTRUSIVE_VARIADIC_TEMPLATES
# endif
#endif
#if defined(BOOST_INTRUSIVE_RVALUE_REFERENCE) && defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
#define BOOST_INTRUSIVE_PERFECT_FORWARDING
#endif
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP

File diff suppressed because it is too large Load Diff

View File

@@ -15,26 +15,12 @@
#include <cstddef> #include <cstddef>
#include <boost/intrusive/link_mode.hpp> #include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/detail/workaround.hpp>
/// @cond /// @cond
//std predeclarations
namespace std{
template<class T>
struct equal_to;
template<class T>
struct less;
} //namespace std{
namespace boost { namespace boost {
//Hash predeclaration
template<class T>
struct hash;
namespace intrusive { namespace intrusive {
struct none; struct none;
@@ -64,6 +50,7 @@ class rbtree_algorithms;
//////////////////////////// ////////////////////////////
//slist //slist
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -72,46 +59,70 @@ template
, class O4 = none , class O4 = none
, class O5 = none , class O5 = none
> >
#else
template<class T, class ...Options>
#endif
class slist; class slist;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
> >
#else
template<class ...Options>
#endif
class slist_base_hook; class slist_base_hook;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
> >
#else
template<class ...Options>
#endif
class slist_member_hook; class slist_member_hook;
//list //list
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
> >
#else
template<class T, class ...Options>
#endif
class list; class list;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
> >
#else
template<class ...Options>
#endif
class list_base_hook; class list_base_hook;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
> >
#else
template<class ...Options>
#endif
class list_member_hook; class list_member_hook;
//rbtree/set/multiset //rbtree/set/multiset
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -119,8 +130,12 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class rbtree; class rbtree;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -128,8 +143,12 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class set; class set;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -137,25 +156,37 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class multiset; class multiset;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class ...Options>
#endif
class set_base_hook; class set_base_hook;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class ...Options>
#endif
class set_member_hook; class set_member_hook;
//splaytree/splay_set/splay_multiset //splaytree/splay_set/splay_multiset
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -163,8 +194,12 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class splaytree; class splaytree;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -172,8 +207,12 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class splay_set; class splay_set;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -181,23 +220,35 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class splay_multiset; class splay_multiset;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
> >
#else
template<class ...Options>
#endif
class splay_set_base_hook; class splay_set_base_hook;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
> >
#else
template<class ...Options>
#endif
class splay_set_member_hook; class splay_set_member_hook;
//avltree/avl_set/avl_multiset //avltree/avl_set/avl_multiset
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -205,8 +256,12 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class avltree; class avltree;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -214,8 +269,12 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class avl_set; class avl_set;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -223,25 +282,37 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class avl_multiset; class avl_multiset;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class ...Options>
#endif
class avl_set_base_hook; class avl_set_base_hook;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class ...Options>
#endif
class avl_set_member_hook; class avl_set_member_hook;
//sgtree/sg_set/sg_multiset //sgtree/sg_set/sg_multiset
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -249,8 +320,12 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class sgtree; class sgtree;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -258,8 +333,12 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class sg_set; class sg_set;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -267,23 +346,36 @@ template
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class T, class ...Options>
#endif
class sg_multiset; class sg_multiset;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
> >
#else
template<class ...Options>
#endif
class bs_set_base_hook; class bs_set_base_hook;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
> >
#else
template<class ...Options>
#endif
class bs_set_member_hook; class bs_set_member_hook;
//hashtable/unordered_set/unordered_multiset //hashtable/unordered_set/unordered_multiset
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -295,9 +387,14 @@ template
, class O7 = none , class O7 = none
, class O8 = none , class O8 = none
, class O9 = none , class O9 = none
, class O10 = none
> >
#else
template<class T, class ...Options>
#endif
class hashtable; class hashtable;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -309,9 +406,14 @@ template
, class O7 = none , class O7 = none
, class O8 = none , class O8 = none
, class O9 = none , class O9 = none
, class O10 = none
> >
#else
template<class T, class ...Options>
#endif
class unordered_set; class unordered_set;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class T < class T
, class O1 = none , class O1 = none
@@ -323,37 +425,57 @@ template
, class O7 = none , class O7 = none
, class O8 = none , class O8 = none
, class O9 = none , class O9 = none
, class O10 = none
> >
#else
template<class T, class ...Options>
#endif
class unordered_multiset; class unordered_multiset;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class ...Options>
#endif
class unordered_set_base_hook; class unordered_set_base_hook;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
, class O4 = none , class O4 = none
> >
#else
template<class ...Options>
#endif
class unordered_set_member_hook; class unordered_set_member_hook;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
> >
#else
template<class ...Options>
#endif
class any_base_hook; class any_base_hook;
#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
template template
< class O1 = none < class O1 = none
, class O2 = none , class O2 = none
, class O3 = none , class O3 = none
> >
#else
template<class ...Options>
#endif
class any_member_hook; class any_member_hook;
} //namespace intrusive { } //namespace intrusive {

View File

@@ -58,7 +58,7 @@ class linear_slist_algorithms
typedef typename NodeTraits::const_node_ptr const_node_ptr; typedef typename NodeTraits::const_node_ptr const_node_ptr;
typedef NodeTraits node_traits; 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 //! <b>Effects</b>: Constructs an non-used list element, putting the next
//! pointer to null: //! pointer to null:
@@ -127,7 +127,7 @@ class linear_slist_algorithms
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
static void transfer_after(node_ptr p, node_ptr b, node_ptr e); 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 //! <b>Effects</b>: Constructs an empty list, making this_node the only
//! node of the circular list: //! node of the circular list:

View File

@@ -35,20 +35,6 @@ namespace intrusive {
/// @cond /// @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> template <class ValueTraits, class SizeType, bool ConstantTimeSize>
struct listopt struct listopt
{ {
@@ -57,17 +43,12 @@ struct listopt
static const bool constant_time_size = ConstantTimeSize; static const bool constant_time_size = ConstantTimeSize;
}; };
template <class T> template <class T>
struct list_defaults struct list_defaults
: pack_options : pack_options
< none < none
, base_hook , base_hook<detail::default_list_hook>
< typename detail::eval_if_c
< internal_default_list_hook<T>::value
, get_default_list_hook<T>
, detail::identity<none>
>::type
>
, constant_time_size<true> , constant_time_size<true>
, size_type<std::size_t> , size_type<std::size_t>
>::type >::type
@@ -85,7 +66,7 @@ struct list_defaults
//! The container supports the following options: //! The container supports the following options:
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<> and \c size_type<>. //! \c constant_time_size<> and \c size_type<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -225,7 +206,7 @@ class list_impl
{ {
this->priv_size_traits().set_size(size_type(0)); this->priv_size_traits().set_size(size_type(0));
node_algorithms::init_header(this->get_root_node()); 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 //! <b>Effects</b>: If it's not a safe-mode or an auto-unlink value_type
@@ -583,7 +564,7 @@ class list_impl
//! //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element. //! erased element.
iterator erase(iterator i) iterator erase(const_iterator i)
{ return this->erase_and_dispose(i, detail::null_disposer()); } { return this->erase_and_dispose(i, detail::null_disposer()); }
//! <b>Requires</b>: b and e must be valid iterators to elements in *this. //! <b>Requires</b>: b and e must be valid iterators to elements in *this.
@@ -601,14 +582,14 @@ class list_impl
//! //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements. //! erased elements.
iterator erase(iterator b, iterator e) iterator erase(const_iterator b, const_iterator e)
{ {
if(safemode_or_autounlink || constant_time_size){ if(safemode_or_autounlink || constant_time_size){
return this->erase_and_dispose(b, e, detail::null_disposer()); return this->erase_and_dispose(b, e, detail::null_disposer());
} }
else{ else{
node_algorithms::unlink(b.pointed_node(), e.pointed_node()); node_algorithms::unlink(b.pointed_node(), e.pointed_node());
return e; return e.unconst();
} }
} }
@@ -628,7 +609,7 @@ class list_impl
//! //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements. //! 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)); BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(b, e) == difference_type(n));
if(safemode_or_autounlink || constant_time_size){ if(safemode_or_autounlink || constant_time_size){
@@ -639,7 +620,7 @@ class list_impl
this->priv_size_traits().set_size(this->priv_size_traits().get_size() - n); this->priv_size_traits().set_size(this->priv_size_traits().get_size() - n);
} }
node_algorithms::unlink(b.pointed_node(), e.pointed_node()); node_algorithms::unlink(b.pointed_node(), e.pointed_node());
return e; return e.unconst();
} }
} }
@@ -658,7 +639,7 @@ class list_impl
//! //!
//! <b>Note</b>: Invalidates the iterators to the erased element. //! <b>Note</b>: Invalidates the iterators to the erased element.
template <class Disposer> 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()); node_ptr to_erase(i.pointed_node());
++i; ++i;
@@ -667,7 +648,7 @@ class list_impl
if(safemode_or_autounlink) if(safemode_or_autounlink)
node_algorithms::init(to_erase); node_algorithms::init(to_erase);
disposer(this->get_real_value_traits().to_value_ptr(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. //! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
@@ -685,7 +666,7 @@ class list_impl
//! //!
//! <b>Note</b>: Invalidates the iterators to the erased elements. //! <b>Note</b>: Invalidates the iterators to the erased elements.
template <class Disposer> 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_ptr bp(b.pointed_node()), ep(e.pointed_node());
node_algorithms::unlink(bp, ep); node_algorithms::unlink(bp, ep);
@@ -697,7 +678,7 @@ class list_impl
disposer(get_real_value_traits().to_value_ptr(to_erase)); disposer(get_real_value_traits().to_value_ptr(to_erase));
this->priv_size_traits().decrement(); this->priv_size_traits().decrement();
} }
return e; return e.unconst();
} }
//! <b>Effects</b>: Erases all the elements of the container. //! <b>Effects</b>: Erases all the elements of the container.
@@ -734,7 +715,7 @@ class list_impl
template <class Disposer> template <class Disposer>
void clear_and_dispose(Disposer 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){ while(it != itend){
node_ptr to_erase(it.pointed_node()); node_ptr to_erase(it.pointed_node());
++it; ++it;
@@ -747,6 +728,7 @@ class list_impl
} }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
@@ -783,7 +765,7 @@ class list_impl
//! <b>Complexity</b>: Constant time. No copy constructors are called. //! <b>Complexity</b>: Constant time. No copy constructors are called.
//! //!
//! <b>Note</b>: Does not affect the validity of iterators and references. //! <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); node_ptr to_insert = this->get_real_value_traits().to_node_ptr(value);
if(safemode_or_autounlink) if(safemode_or_autounlink)
@@ -805,7 +787,7 @@ class list_impl
//! //!
//! <b>Note</b>: Does not affect the validity of iterators and references. //! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator> template<class Iterator>
void insert(iterator p, Iterator b, Iterator e) void insert(const_iterator p, Iterator b, Iterator e)
{ {
for (; b != e; ++b) for (; b != e; ++b)
this->insert(p, *b); this->insert(p, *b);
@@ -830,7 +812,7 @@ class list_impl
void assign(Iterator b, Iterator e) void assign(Iterator b, Iterator e)
{ {
this->clear(); this->clear();
this->insert(this->end(), b, e); this->insert(this->cend(), b, e);
} }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
@@ -853,7 +835,7 @@ class list_impl
void dispose_and_assign(Disposer disposer, Iterator b, Iterator e) void dispose_and_assign(Disposer disposer, Iterator b, Iterator e)
{ {
this->clear_and_dispose(disposer); 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. //! <b>Requires</b>: p must be a valid iterator of *this.
@@ -867,7 +849,7 @@ class list_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of //! <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. //! 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()){ if(!x.empty()){
size_traits &thist = this->priv_size_traits(); size_traits &thist = this->priv_size_traits();
@@ -892,7 +874,7 @@ class list_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this //! <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. //! 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()); node_algorithms::transfer(p.pointed_node(), new_ele.pointed_node());
x.priv_size_traits().decrement(); x.priv_size_traits().decrement();
@@ -912,7 +894,7 @@ class list_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this //! <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. //! 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) if(constant_time_size)
this->splice(p, x, start, end, std::distance(start, end)); this->splice(p, x, start, end, std::distance(start, end));
@@ -933,7 +915,7 @@ class list_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this //! <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. //! 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(n){
if(constant_time_size){ if(constant_time_size){
@@ -988,7 +970,7 @@ class list_impl
list_impl counter[64]; list_impl counter[64];
int fill = 0; int fill = 0;
while(!this->empty()){ while(!this->empty()){
carry.splice(carry.begin(), *this, this->begin()); carry.splice(carry.cbegin(), *this, this->cbegin());
int i = 0; int i = 0;
while(i < fill && !counter[i].empty()) { while(i < fill && !counter[i].empty()) {
carry.merge(counter[i++], p); carry.merge(counter[i++], p);
@@ -1034,13 +1016,13 @@ class list_impl
template<class Predicate> template<class Predicate>
void merge(list_impl& x, Predicate p) void merge(list_impl& x, Predicate p)
{ {
iterator e(this->end()); const_iterator e(this->end());
iterator bx(x.begin()); const_iterator bx(x.begin());
iterator ex(x.end()); 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); size_type n(0);
iterator ix(bx); const_iterator ix(bx);
while(ix != ex && p(*ix, *b)){ while(ix != ex && p(*ix, *b)){
++ix; ++n; ++ix; ++n;
} }
@@ -1116,8 +1098,8 @@ class list_impl
template<class Pred, class Disposer> template<class Pred, class Disposer>
void remove_and_dispose_if(Pred pred, Disposer disposer) void remove_and_dispose_if(Pred pred, Disposer disposer)
{ {
iterator cur(this->begin()); const_iterator cur(this->cbegin());
iterator last(this->end()); const_iterator last(this->cend());
while(cur != last) { while(cur != last) {
if(pred(*cur)){ if(pred(*cur)){
cur = this->erase_and_dispose(cur, disposer); cur = this->erase_and_dispose(cur, disposer);
@@ -1185,11 +1167,11 @@ class list_impl
template<class BinaryPredicate, class Disposer> template<class BinaryPredicate, class Disposer>
void unique_and_dispose(BinaryPredicate pred, Disposer disposer) void unique_and_dispose(BinaryPredicate pred, Disposer disposer)
{ {
iterator itend(this->end()); const_iterator itend(this->cend());
iterator cur(this->begin()); const_iterator cur(this->cbegin());
if(cur != itend){ if(cur != itend){
iterator after(cur); const_iterator after(cur);
++after; ++after;
while(after != itend){ while(after != itend){
if(pred(*cur, *after)){ if(pred(*cur, *after)){
@@ -1284,26 +1266,26 @@ class list_impl
/// @endcond /// @endcond
}; };
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator< 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) (const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else #else
(const list_impl<Config> &x, const list_impl<Config> &y) (const list_impl<Config> &x, const list_impl<Config> &y)
#endif #endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } { 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
bool operator== 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) (const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else #else
(const list_impl<Config> &x, const list_impl<Config> &y) (const list_impl<Config> &x, const list_impl<Config> &y)
@@ -1336,65 +1318,65 @@ bool operator==
} }
} }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else #else
(const list_impl<Config> &x, const list_impl<Config> &y) (const list_impl<Config> &x, const list_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else #else
(const list_impl<Config> &x, const list_impl<Config> &y) (const list_impl<Config> &x, const list_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else #else
(const list_impl<Config> &x, const list_impl<Config> &y) (const list_impl<Config> &x, const list_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else #else
(const list_impl<Config> &x, const list_impl<Config> &y) (const list_impl<Config> &x, const list_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap inline void swap
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(list_impl<T, Options...> &x, list_impl<T, Options...> &y) (list_impl<T, Options...> &x, list_impl<T, Options...> &y)
#else #else
(list_impl<Config> &x, list_impl<Config> &y) (list_impl<Config> &x, list_impl<Config> &y)
@@ -1403,7 +1385,7 @@ inline void swap
//! Helper metafunction to define a \c list that yields to the same type when the //! Helper metafunction to define a \c list that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none, class O3 = none> template<class T, class O1 = none, class O2 = none, class O3 = none>
@@ -1412,7 +1394,14 @@ struct make_list
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits; <T, typename packed_options::value_traits>::type value_traits;
@@ -1430,12 +1419,29 @@ struct make_list
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3> template<class T, class O1, class O2, class O3>
#else
template<class T, class ...Options>
#endif
class list 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 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; typedef typename Base::real_value_traits real_value_traits;
//Assert if passed value traits are compatible with the type //Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value)); BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));

View File

@@ -35,7 +35,7 @@ struct get_list_node_algo
//! Helper metafunction to define a \c \c list_base_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none> template<class O1 = none, class O2 = none, class O3 = none>
@@ -44,7 +44,13 @@ struct make_list_base_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_list_node_algo<typename packed_options::void_pointer> < get_list_node_algo<typename packed_options::void_pointer>
@@ -72,15 +78,21 @@ struct make_list_base_hook
//! //!
//! \c void_pointer<> is the pointer type that will be used internally in the hook //! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this 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> template<class ...Options>
#else #else
template<class O1, class O2, class O3> template<class O1, class O2, class O3>
#endif #endif
class list_base_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!
@@ -149,7 +161,7 @@ class list_base_hook
//! Helper metafunction to define a \c \c list_member_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none> template<class O1 = none, class O2 = none, class O3 = none>
@@ -158,7 +170,13 @@ struct make_list_member_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_list_node_algo<typename packed_options::void_pointer> < get_list_node_algo<typename packed_options::void_pointer>
@@ -181,15 +199,21 @@ struct make_list_member_hook
//! //!
//! \c void_pointer<> is the pointer type that will be used internally in the hook //! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this 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> template<class ...Options>
#else #else
template<class O1, class O2, class O3> template<class O1, class O2, class O3>
#endif #endif
class list_member_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!

View File

@@ -31,6 +31,26 @@ struct member_tag;
namespace detail{ 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> template <class ValueTraits>
struct eval_value_traits struct eval_value_traits
{ {
@@ -116,8 +136,12 @@ struct get_member_node_traits
template<class T, class SupposedValueTraits> template<class T, class SupposedValueTraits>
struct get_value_traits struct get_value_traits
{ {
typedef SupposedValueTraits supposed_value_traits; typedef typename detail::eval_if_c
//...if it's a base hook <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 typedef typename detail::eval_if_c
< internal_base_hook_bool_is_true<supposed_value_traits>::value < internal_base_hook_bool_is_true<supposed_value_traits>::value
//...get it's internal value traits using //...get it's internal value traits using
@@ -336,7 +360,7 @@ struct void_pointer
}; };
//!This option setter specifies the type of //!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 //!base hooks of the same type, so a tag can be used
//!to differentiate two base hooks with otherwise same type //!to differentiate two base hooks with otherwise same type
template<class Tag> template<class Tag>
@@ -509,8 +533,29 @@ struct compare_hash
/// @endcond /// @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 /// @cond
//To-do: pass to variadic templates
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class Prev, class Next> template<class Prev, class Next>
struct do_pack struct do_pack
{ {
@@ -525,7 +570,6 @@ struct do_pack<Prev, none>
typedef Prev type; typedef Prev type;
}; };
template template
< class DefaultOptions < class DefaultOptions
, class O1 = none , class O1 = none
@@ -537,7 +581,8 @@ template
, class O7 = none , class O7 = none
, class O8 = none , class O8 = none
, class O9 = none , class O9 = none
, class Option10 = none , class O10 = none
, class O11 = none
> >
struct pack_options struct pack_options
{ {
@@ -553,29 +598,164 @@ struct pack_options
< typename do_pack < typename do_pack
< typename do_pack < typename do_pack
< typename do_pack < typename do_pack
< DefaultOptions < typename do_pack
, O1 < DefaultOptions
, O1
>::type
, O2
>::type >::type
, O2 , O3
>::type >::type
, O3 , O4
>::type >::type
, O4 , O5
>::type >::type
, O5 , O6
>::type >::type
, O6 , O7
>::type >::type
, O7 , O8
>::type >::type
, O8 , O9
>::type >::type
, O9 , O10
>::type >::type
, Option10 , O11
>::type >::type
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 struct hook_defaults
: public pack_options : public pack_options

View File

@@ -14,6 +14,7 @@
#define BOOST_INTRUSIVE_POINTER_PLUS_BITS_HPP #define BOOST_INTRUSIVE_POINTER_PLUS_BITS_HPP
#include <boost/intrusive/detail/mpl.hpp> //ls_zeros #include <boost/intrusive/detail/mpl.hpp> //ls_zeros
#include <boost/intrusive/detail/assert.hpp> //BOOST_INTRUSIVE_INVARIANT_ASSERT
namespace boost { namespace boost {
namespace intrusive { namespace intrusive {
@@ -28,7 +29,7 @@ struct max_pointer_plus_bits
static const std::size_t value = 0; 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 //!Raw pointers can embed extra bits in the lower bits
//!if the alignment is multiple of 2pow(NumBits). //!if the alignment is multiple of 2pow(NumBits).
template<std::size_t Alignment> template<std::size_t Alignment>
@@ -61,7 +62,7 @@ struct pointer_plus_bits<T*, NumBits>
static void set_pointer(pointer &n, pointer p) 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)); n = pointer(std::size_t(p) | (std::size_t(n) & Mask));
} }
@@ -70,7 +71,7 @@ struct pointer_plus_bits<T*, NumBits>
static void set_bits(pointer &n, std::size_t c) 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); n = pointer(std::size_t(get_pointer(n)) | c);
} }
}; };

View File

@@ -36,20 +36,6 @@ namespace intrusive {
/// @cond /// @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> template <class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize>
struct setopt struct setopt
{ {
@@ -63,13 +49,7 @@ template <class T>
struct set_defaults struct set_defaults
: pack_options : pack_options
< none < none
, base_hook , base_hook<detail::default_set_hook>
< typename detail::eval_if_c
< internal_default_set_hook<T>::value
, get_default_set_hook<T>
, detail::identity<none>
>::type
>
, constant_time_size<true> , constant_time_size<true>
, size_type<std::size_t> , size_type<std::size_t>
, compare<std::less<T> > , compare<std::less<T> >
@@ -91,7 +71,7 @@ struct set_defaults
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and //! \c constant_time_size<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -1055,29 +1035,34 @@ class rbtree_impl
} }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const rbtree_impl &src, Cloner cloner, Disposer disposer) void clone_from(const rbtree_impl &src, Cloner cloner, Disposer disposer)
{ {
this->clear_and_dispose(disposer); this->clear_and_dispose(disposer);
if(!src.empty()){ if(!src.empty()){
detail::exception_disposer<rbtree_impl, Disposer>
rollback(*this, disposer);
node_algorithms::clone node_algorithms::clone
(const_node_ptr(&src.priv_header()) (const_node_ptr(&src.priv_header())
,node_ptr(&this->priv_header()) ,node_ptr(&this->priv_header())
,detail::node_cloner<Cloner, rbtree_impl>(cloner, this) ,detail::node_cloner<Cloner, rbtree_impl>(cloner, this)
,detail::node_disposer<Disposer, rbtree_impl>(disposer, this)); ,detail::node_disposer<Disposer, rbtree_impl>(disposer, this));
this->priv_size_traits().set_size(src.priv_size_traits().get_size()); this->priv_size_traits().set_size(src.priv_size_traits().get_size());
this->priv_comp() = src.priv_comp();
rollback.release();
} }
} }
@@ -1253,26 +1238,26 @@ class rbtree_impl
{ return priv_container_from_end_iterator(it.end_iterator_from_it()); } { 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator< 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) (const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else #else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y) (const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
#endif #endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } { 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
bool operator== 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) (const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else #else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y) (const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
@@ -1304,65 +1289,65 @@ bool operator==
} }
} }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else #else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y) (const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else #else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y) (const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else #else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y) (const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const rbtree_impl<T, Options...> &x, const rbtree_impl<T, Options...> &y)
#else #else
(const rbtree_impl<Config> &x, const rbtree_impl<Config> &y) (const rbtree_impl<Config> &x, const rbtree_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap inline void swap
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(rbtree_impl<T, Options...> &x, rbtree_impl<T, Options...> &y) (rbtree_impl<T, Options...> &x, rbtree_impl<T, Options...> &y)
#else #else
(rbtree_impl<Config> &x, rbtree_impl<Config> &y) (rbtree_impl<Config> &x, rbtree_impl<Config> &y)
@@ -1370,15 +1355,23 @@ inline void swap
{ x.swap(y); } { x.swap(y); }
/// @cond /// @cond
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
, class O3 = none, class O4 = 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 struct make_rbtree_opt
{ {
typedef typename pack_options 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 typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits; <T, typename packed_options::value_traits>::type value_traits;
@@ -1393,7 +1386,7 @@ struct make_rbtree_opt
//! Helper metafunction to define a \c rbtree that yields to the same type when the //! Helper metafunction to define a \c rbtree that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -1403,19 +1396,42 @@ struct make_rbtree
{ {
/// @cond /// @cond
typedef rbtree_impl 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class rbtree 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 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: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;

View File

@@ -32,7 +32,7 @@ namespace intrusive {
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and //! \c constant_time_size<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -324,18 +324,19 @@ class set_impl
{ tree_.swap(other.tree_); } { tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const set_impl &src, Cloner cloner, Disposer disposer) void clone_from(const set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); } { tree_.clone_from(src.tree_, cloner, disposer); }
@@ -997,65 +998,65 @@ class set_impl
/// @endcond /// @endcond
}; };
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const set_impl<T, Options...> &x, const set_impl<T, Options...> &y)
#else #else
(const set_impl<Config> &x, const set_impl<Config> &y) (const set_impl<Config> &x, const set_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const set_impl<T, Options...> &x, const set_impl<T, Options...> &y)
#else #else
(const set_impl<Config> &x, const set_impl<Config> &y) (const set_impl<Config> &x, const set_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const set_impl<T, Options...> &x, const set_impl<T, Options...> &y)
#else #else
(const set_impl<Config> &x, const set_impl<Config> &y) (const set_impl<Config> &x, const set_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const set_impl<T, Options...> &x, const set_impl<T, Options...> &y)
#else #else
(const set_impl<Config> &x, const set_impl<Config> &y) (const set_impl<Config> &x, const set_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap inline void swap
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(set_impl<T, Options...> &x, set_impl<T, Options...> &y) (set_impl<T, Options...> &x, set_impl<T, Options...> &y)
#else #else
(set_impl<Config> &x, set_impl<Config> &y) (set_impl<Config> &x, set_impl<Config> &y)
@@ -1064,7 +1065,7 @@ inline void swap
//! Helper metafunction to define a \c set that yields to the same type when the //! Helper metafunction to define a \c set that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -1074,19 +1075,41 @@ struct make_set
{ {
/// @cond /// @cond
typedef set_impl 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class set 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 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: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;
@@ -1135,7 +1158,7 @@ class set
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and //! \c constant_time_size<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -1423,18 +1446,19 @@ class multiset_impl
{ tree_.swap(other.tree_); } { tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const multiset_impl &src, Cloner cloner, Disposer disposer) void clone_from(const multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); } { tree_.clone_from(src.tree_, cloner, disposer); }
@@ -2018,65 +2042,65 @@ class multiset_impl
/// @endcond /// @endcond
}; };
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const multiset_impl<T, Options...> &x, const multiset_impl<T, Options...> &y)
#else #else
(const multiset_impl<Config> &x, const multiset_impl<Config> &y) (const multiset_impl<Config> &x, const multiset_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const multiset_impl<T, Options...> &x, const multiset_impl<T, Options...> &y)
#else #else
(const multiset_impl<Config> &x, const multiset_impl<Config> &y) (const multiset_impl<Config> &x, const multiset_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const multiset_impl<T, Options...> &x, const multiset_impl<T, Options...> &y)
#else #else
(const multiset_impl<Config> &x, const multiset_impl<Config> &y) (const multiset_impl<Config> &x, const multiset_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const multiset_impl<T, Options...> &x, const multiset_impl<T, Options...> &y)
#else #else
(const multiset_impl<Config> &x, const multiset_impl<Config> &y) (const multiset_impl<Config> &x, const multiset_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap inline void swap
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(multiset_impl<T, Options...> &x, multiset_impl<T, Options...> &y) (multiset_impl<T, Options...> &x, multiset_impl<T, Options...> &y)
#else #else
(multiset_impl<Config> &x, multiset_impl<Config> &y) (multiset_impl<Config> &x, multiset_impl<Config> &y)
@@ -2085,7 +2109,7 @@ inline void swap
//! Helper metafunction to define a \c multiset that yields to the same type when the //! Helper metafunction to define a \c multiset that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -2095,19 +2119,41 @@ struct make_multiset
{ {
/// @cond /// @cond
typedef multiset_impl 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class multiset 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 typedef typename make_multiset<T,
<T, O1, O2, O3, O4>::type Base; #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
Options...
#endif
>::type Base;
public: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;

View File

@@ -35,7 +35,7 @@ struct get_set_node_algo
//! Helper metafunction to define a \c set_base_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none> template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -44,7 +44,13 @@ struct make_set_base_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_set_node_algo<typename packed_options::void_pointer < get_set_node_algo<typename packed_options::void_pointer
@@ -77,15 +83,21 @@ struct make_set_base_hook
//! //!
//! \c optimize_size<> will tell the hook to optimize the hook for size instead //! \c optimize_size<> will tell the hook to optimize the hook for size instead
//! of speed. //! of speed.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options> template<class ...Options>
#else #else
template<class O1, class O2, class O3, class O4> template<class O1, class O2, class O3, class O4>
#endif #endif
class set_base_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!
@@ -154,7 +166,7 @@ class set_base_hook
//! Helper metafunction to define a \c set_member_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none> template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -163,7 +175,13 @@ struct make_set_member_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_set_node_algo<typename packed_options::void_pointer < get_set_node_algo<typename packed_options::void_pointer
@@ -191,15 +209,21 @@ struct make_set_member_hook
//! //!
//! \c optimize_size<> will tell the hook to optimize the hook for size instead //! \c optimize_size<> will tell the hook to optimize the hook for size instead
//! of speed. //! of speed.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options> template<class ...Options>
#else #else
template<class O1, class O2, class O3, class O4> template<class O1, class O2, class O3, class O4>
#endif #endif
class set_member_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!

View File

@@ -31,7 +31,7 @@ namespace intrusive {
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and //! \c constant_time_size<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -323,18 +323,19 @@ class sg_set_impl
{ tree_.swap(other.tree_); } { tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const sg_set_impl &src, Cloner cloner, Disposer disposer) void clone_from(const sg_set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); } { tree_.clone_from(src.tree_, cloner, disposer); }
@@ -1035,65 +1036,65 @@ class sg_set_impl
/// @endcond /// @endcond
}; };
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y)
#else #else
(const sg_set_impl<Config> &x, const sg_set_impl<Config> &y) (const sg_set_impl<Config> &x, const sg_set_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y)
#else #else
(const sg_set_impl<Config> &x, const sg_set_impl<Config> &y) (const sg_set_impl<Config> &x, const sg_set_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y)
#else #else
(const sg_set_impl<Config> &x, const sg_set_impl<Config> &y) (const sg_set_impl<Config> &x, const sg_set_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y)
#else #else
(const sg_set_impl<Config> &x, const sg_set_impl<Config> &y) (const sg_set_impl<Config> &x, const sg_set_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap 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) (sg_set_impl<T, Options...> &x, sg_set_impl<T, Options...> &y)
#else #else
(sg_set_impl<Config> &x, sg_set_impl<Config> &y) (sg_set_impl<Config> &x, sg_set_impl<Config> &y)
@@ -1102,7 +1103,7 @@ inline void swap
//! Helper metafunction to define a \c sg_set that yields to the same type when the //! Helper metafunction to define a \c sg_set that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -1112,19 +1113,42 @@ struct make_sg_set
{ {
/// @cond /// @cond
typedef sg_set_impl 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class sg_set 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 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: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;
@@ -1173,7 +1197,7 @@ class sg_set
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and //! \c constant_time_size<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -1461,18 +1485,19 @@ class sg_multiset_impl
{ tree_.swap(other.tree_); } { tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const sg_multiset_impl &src, Cloner cloner, Disposer disposer) void clone_from(const sg_multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); } { tree_.clone_from(src.tree_, cloner, disposer); }
@@ -2080,65 +2105,65 @@ class sg_multiset_impl
/// @endcond /// @endcond
}; };
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y)
#else #else
(const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y) (const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y)
#else #else
(const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y) (const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y)
#else #else
(const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y) (const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y)
#else #else
(const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y) (const sg_multiset_impl<Config> &x, const sg_multiset_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap 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) (sg_multiset_impl<T, Options...> &x, sg_multiset_impl<T, Options...> &y)
#else #else
(sg_multiset_impl<Config> &x, sg_multiset_impl<Config> &y) (sg_multiset_impl<Config> &x, sg_multiset_impl<Config> &y)
@@ -2147,7 +2172,7 @@ inline void swap
//! Helper metafunction to define a \c sg_multiset that yields to the same type when the //! Helper metafunction to define a \c sg_multiset that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -2157,19 +2182,42 @@ struct make_sg_multiset
{ {
/// @cond /// @cond
typedef sg_multiset_impl 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class sg_multiset 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 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: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;

View File

@@ -151,7 +151,7 @@ struct alpha_holder<false>
void set_alpha(float) void set_alpha(float)
{ //alpha CAN't be changed. { //alpha CAN't be changed.
assert(0); BOOST_INTRUSIVE_INVARIANT_ASSERT(0);
} }
h_alpha_t get_h_alpha_t() const h_alpha_t get_h_alpha_t() const
@@ -176,13 +176,7 @@ template <class T>
struct sg_set_defaults struct sg_set_defaults
: pack_options : pack_options
< none < none
, base_hook , base_hook<detail::default_bs_set_hook>
< typename detail::eval_if_c
< internal_default_bs_set_hook<T>::value
, get_default_bs_set_hook<T>
, detail::identity<none>
>::type
>
, floating_point<true> , floating_point<true>
, size_type<std::size_t> , size_type<std::size_t>
, compare<std::less<T> > , compare<std::less<T> >
@@ -204,7 +198,7 @@ struct sg_set_defaults
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c floating_point<>, \c size_type<> and //! \c floating_point<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -1212,29 +1206,34 @@ class sgtree_impl
} }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const sgtree_impl &src, Cloner cloner, Disposer disposer) void clone_from(const sgtree_impl &src, Cloner cloner, Disposer disposer)
{ {
this->clear_and_dispose(disposer); this->clear_and_dispose(disposer);
if(!src.empty()){ if(!src.empty()){
detail::exception_disposer<sgtree_impl, Disposer>
rollback(*this, disposer);
node_algorithms::clone node_algorithms::clone
(const_node_ptr(&src.priv_header()) (const_node_ptr(&src.priv_header())
,node_ptr(&this->priv_header()) ,node_ptr(&this->priv_header())
,detail::node_cloner<Cloner, sgtree_impl>(cloner, this) ,detail::node_cloner<Cloner, sgtree_impl>(cloner, this)
,detail::node_disposer<Disposer, sgtree_impl>(disposer, this)); ,detail::node_disposer<Disposer, sgtree_impl>(disposer, this));
this->priv_size_traits().set_size(src.priv_size_traits().get_size()); this->priv_size_traits().set_size(src.priv_size_traits().get_size());
this->priv_comp() = src.priv_comp();
rollback.release();
} }
} }
@@ -1469,26 +1468,26 @@ class sgtree_impl
{ return priv_container_from_end_iterator(it.end_iterator_from_it()); } { 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator< 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) (const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else #else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y) (const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
#endif #endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } { 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
bool operator== 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) (const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else #else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y) (const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
@@ -1520,65 +1519,65 @@ bool operator==
} }
} }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else #else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y) (const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else #else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y) (const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else #else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y) (const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const sgtree_impl<T, Options...> &x, const sgtree_impl<T, Options...> &y)
#else #else
(const sgtree_impl<Config> &x, const sgtree_impl<Config> &y) (const sgtree_impl<Config> &x, const sgtree_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap inline void swap
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(sgtree_impl<T, Options...> &x, sgtree_impl<T, Options...> &y) (sgtree_impl<T, Options...> &x, sgtree_impl<T, Options...> &y)
#else #else
(sgtree_impl<Config> &x, sgtree_impl<Config> &y) (sgtree_impl<Config> &x, sgtree_impl<Config> &y)
@@ -1586,15 +1585,22 @@ inline void swap
{ x.swap(y); } { x.swap(y); }
/// @cond /// @cond
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
, class O3 = none, class O4 = none , class O3 = none, class O4 = none>
, class O5 = none, class O6 = none #else
, class O7 = none template<class T, class ...Options>
> #endif
struct make_sgtree_opt struct make_sgtree_opt
{ {
typedef typename pack_options 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 typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits; <T, typename packed_options::value_traits>::type value_traits;
@@ -1609,7 +1615,7 @@ struct make_sgtree_opt
//! Helper metafunction to define a \c sgtree that yields to the same type when the //! Helper metafunction to define a \c sgtree that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -1619,19 +1625,41 @@ struct make_sgtree
{ {
/// @cond /// @cond
typedef sgtree_impl 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class sgtree 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 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: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;

View File

@@ -683,7 +683,7 @@ class sgtree_algorithms
for(std::size_t i = 1; true; ++i){ for(std::size_t i = 1; true; ++i){
bool rebalance = false; bool rebalance = false;
if(i == depth){ if(i == depth){
assert(tree_size == count(s)); BOOST_INTRUSIVE_INVARIANT_ASSERT(tree_size == count(s));
rebalance = true; rebalance = true;
} }
else if(i > h_alpha(size)){ else if(i > h_alpha(size)){

View File

@@ -36,18 +36,6 @@ namespace intrusive {
/// @cond /// @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> template <class ValueTraits, class SizeType, bool ConstantTimeSize, bool Linear, bool CacheLast>
struct slistopt struct slistopt
{ {
@@ -75,13 +63,7 @@ template <class T>
struct slist_defaults struct slist_defaults
: pack_options : pack_options
< none < none
, base_hook , base_hook<detail::default_slist_hook>
< typename detail::eval_if_c
< internal_default_slist_hook<T>::value
, get_default_slist_hook<T>
, detail::identity<none>
>::type
>
, constant_time_size<true> , constant_time_size<true>
, linear<false> , linear<false>
, size_type<std::size_t> , size_type<std::size_t>
@@ -114,7 +96,7 @@ struct slist_defaults
//! the '*_after' functions, ++end() == begin() and previous(begin()) == end() //! the '*_after' functions, ++end() == begin() and previous(begin()) == end()
//! are defined. An new special function "before_begin()" is defined, which returns //! 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() //! 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -300,7 +282,7 @@ class slist_impl
: data_(v_traits) : data_(v_traits)
{ {
this->set_default_constructed_state(); 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 //! <b>Effects</b>: If it's a safe-mode
@@ -346,7 +328,7 @@ class slist_impl
template <class Disposer> template <class Disposer>
void clear_and_dispose(Disposer 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){ while(it != itend){
node_ptr to_erase(it.pointed_node()); node_ptr to_erase(it.pointed_node());
++it; ++it;
@@ -395,7 +377,7 @@ class slist_impl
void push_back(reference value) void push_back(reference value)
{ {
BOOST_STATIC_ASSERT((cache_last != 0)); 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. //! <b>Effects</b>: Erases the first element of the list.
@@ -650,6 +632,7 @@ class slist_impl
{ this->priv_shift_forward(n, detail::bool_<linear>()); } { this->priv_shift_forward(n, detail::bool_<linear>()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
@@ -668,7 +651,7 @@ class slist_impl
this->clear_and_dispose(disposer); this->clear_and_dispose(disposer);
detail::exception_disposer<slist_impl, Disposer> detail::exception_disposer<slist_impl, Disposer>
rollback(*this, disposer); rollback(*this, disposer);
iterator prev(this->before_begin()); const_iterator prev(this->cbefore_begin());
const_iterator b(src.begin()), e(src.end()); const_iterator b(src.begin()), e(src.end());
for(; b != e; ++b){ for(; b != e; ++b){
prev = this->insert_after(prev, *cloner(*b)); prev = this->insert_after(prev, *cloner(*b));
@@ -689,7 +672,7 @@ class slist_impl
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
//! //!
//! <b>Note</b>: Does not affect the validity of iterators and references. //! <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); node_ptr n = get_real_value_traits().to_node_ptr(value);
if(safemode_or_autounlink) if(safemode_or_autounlink)
@@ -716,7 +699,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Does not affect the validity of iterators and references. //! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator> 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) for (; first != last; ++first)
prev_p = this->insert_after(prev_p, *first); prev_p = this->insert_after(prev_p, *first);
@@ -734,7 +717,7 @@ class slist_impl
//! Constant-time if cache_last<> is true and p == end(). //! Constant-time if cache_last<> is true and p == end().
//! //!
//! <b>Note</b>: Does not affect the validity of iterators and references. //! <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); } { return this->insert_after(this->previous(p), value); }
//! <b>Requires</b>: Dereferencing iterator must yield //! <b>Requires</b>: Dereferencing iterator must yield
@@ -752,7 +735,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Does not affect the validity of iterators and references. //! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator> 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); } { return this->insert_after(this->previous(p), b, e); }
//! <b>Effects</b>: Erases the element after the element pointed by prev of //! <b>Effects</b>: Erases the element after the element pointed by prev of
@@ -767,7 +750,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element. //! erased element.
iterator erase_after(iterator prev) iterator erase_after(const_iterator prev)
{ return this->erase_after_and_dispose(prev, detail::null_disposer()); } { return this->erase_after_and_dispose(prev, detail::null_disposer()); }
//! <b>Effects</b>: Erases the range (before_first, last) from //! <b>Effects</b>: Erases the range (before_first, last) from
@@ -783,7 +766,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element. //! 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){ if(safemode_or_autounlink || constant_time_size){
return this->erase_after_and_dispose(before_first, last, detail::null_disposer()); return this->erase_after_and_dispose(before_first, last, detail::null_disposer());
@@ -797,7 +780,7 @@ class slist_impl
} }
} }
node_algorithms::unlink_after(bfp, lp); node_algorithms::unlink_after(bfp, lp);
return last; return last.unconst();
} }
} }
@@ -815,9 +798,9 @@ class slist_impl
//! //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element. //! 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){ if(safemode_or_autounlink){
return this->erase_after(before_first, last); return this->erase_after(before_first, last);
} }
@@ -833,7 +816,7 @@ class slist_impl
if(constant_time_size){ if(constant_time_size){
this->priv_size_traits().set_size(this->priv_size_traits().get_size() - n); this->priv_size_traits().set_size(this->priv_size_traits().get_size() - n);
} }
return last; return last.unconst();
} }
} }
@@ -849,7 +832,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element. //! erased element.
iterator erase(iterator i) iterator erase(const_iterator i)
{ return this->erase_after(this->previous(i)); } { return this->erase_after(this->previous(i)); }
//! <b>Requires</b>: first and last must be valid iterator to elements in *this. //! <b>Requires</b>: first and last must be valid iterator to elements in *this.
@@ -866,7 +849,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements. //! erased elements.
iterator erase(iterator first, iterator last) iterator erase(const_iterator first, const_iterator last)
{ return this->erase_after(this->previous(first), last); } { return this->erase_after(this->previous(first), last); }
//! <b>Effects</b>: Erases the range [first, last) from //! <b>Effects</b>: Erases the range [first, last) from
@@ -883,7 +866,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element. //! 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); } { return this->erase_after(this->previous(first), last, n); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
@@ -901,9 +884,9 @@ class slist_impl
//! //!
//! <b>Note</b>: Invalidates the iterators to the erased element. //! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer> 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; ++it;
node_ptr to_erase(it.pointed_node()); node_ptr to_erase(it.pointed_node());
++it; ++it;
@@ -916,16 +899,16 @@ class slist_impl
node_algorithms::init(to_erase); node_algorithms::init(to_erase);
disposer(get_real_value_traits().to_value_ptr(to_erase)); disposer(get_real_value_traits().to_value_ptr(to_erase));
this->priv_size_traits().decrement(); this->priv_size_traits().decrement();
return it; return it.unconst();
} }
/// @cond /// @cond
template<class Disposer> 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))); BOOST_STATIC_ASSERT(((!cache_last)&&(!constant_time_size)&&(!stateful_value_traits)));
iterator it(prev); const_iterator it(prev);
++it; ++it;
node_ptr to_erase(it.pointed_node()); node_ptr to_erase(it.pointed_node());
++it; ++it;
@@ -934,10 +917,10 @@ class slist_impl
if(safemode_or_autounlink) if(safemode_or_autounlink)
node_algorithms::init(to_erase); node_algorithms::init(to_erase);
disposer(real_value_traits::to_value_ptr(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()); } { return s_erase_after_and_dispose(prev, detail::null_disposer()); }
/// @endcond /// @endcond
@@ -957,7 +940,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Invalidates the iterators to the erased element. //! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer> 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 bfp(before_first.pointed_node()), lp(last.pointed_node());
node_ptr fp(node_traits::get_next(bfp)); node_ptr fp(node_traits::get_next(bfp));
@@ -973,7 +956,7 @@ class slist_impl
if(cache_last && (node_traits::get_next(bfp) == this->get_end_node())){ if(cache_last && (node_traits::get_next(bfp) == this->get_end_node())){
this->set_last_node(bfp); this->set_last_node(bfp);
} }
return last; return last.unconst();
} }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
@@ -992,7 +975,7 @@ class slist_impl
//! <b>Note</b>: Invalidates the iterators (but not the references) to the //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element. //! erased element.
template<class Disposer> 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); } { return this->erase_after_and_dispose(this->previous(i), disposer); }
//! <b>Requires</b>: first and last must be valid iterator to elements in *this. //! <b>Requires</b>: first and last must be valid iterator to elements in *this.
@@ -1013,7 +996,7 @@ class slist_impl
//! <b>Note</b>: Invalidates the iterators (but not the references) to the //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements. //! erased elements.
template<class Disposer> 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); } { return this->erase_after_and_dispose(this->previous(first), last, disposer); }
//! <b>Requires</b>: Dereferencing iterator must yield //! <b>Requires</b>: Dereferencing iterator must yield
@@ -1035,7 +1018,7 @@ class slist_impl
void assign(Iterator b, Iterator e) void assign(Iterator b, Iterator e)
{ {
this->clear(); 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. //! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
@@ -1058,7 +1041,7 @@ class slist_impl
void dispose_and_assign(Disposer disposer, Iterator b, Iterator e) void dispose_and_assign(Disposer disposer, Iterator b, Iterator e)
{ {
this->clear_and_dispose(disposer); 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. //! <b>Requires</b>: prev is an iterator to an element or x.end()/x.before_begin() in x.
@@ -1077,10 +1060,10 @@ class slist_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this //! <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. //! 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()){ 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 prev_n(prev.pointed_node());
node_ptr last_x_n(last_x.pointed_node()); node_ptr last_x_n(last_x.pointed_node());
if(cache_last){ if(cache_last){
@@ -1092,10 +1075,10 @@ class slist_impl
node_algorithms::transfer_after( prev_n, x.before_begin().pointed_node(), last_x_n); 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()); 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)); x.priv_size_traits().set_size(size_type(0));
return last_x; return last_x.unconst();
} }
else{ else{
return prev; return prev.unconst();
} }
} }
@@ -1112,9 +1095,9 @@ class slist_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this //! <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. //! 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); this->splice_after(prev_pos, x, prev_ele, ++elem, 1);
} }
@@ -1133,7 +1116,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this //! <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. //! 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) if(constant_time_size)
this->splice_after(prev_pos, x, before_first, before_last, std::distance(before_first, before_last)); this->splice_after(prev_pos, x, before_first, before_last, std::distance(before_first, before_last));
@@ -1156,7 +1139,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this //! <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. //! 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){ if(n){
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(before_first, before_last) == n); BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(before_first, before_last) == n);
@@ -1188,7 +1171,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this //! <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. //! 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); } { return this->splice_after(this->previous(it), x); }
//! <b>Requires</b>: it p must be a valid iterator of *this. //! <b>Requires</b>: it p must be a valid iterator of *this.
@@ -1205,7 +1188,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this //! <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. //! 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)); } { return this->splice_after(this->previous(pos), x, x.previous(elem)); }
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this //! <b>Requires</b>: pos must be a dereferenceable iterator in *this
@@ -1225,7 +1208,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this //! <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. //! 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)); } { 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 //! <b>Requires</b>: pos must be a dereferenceable iterator in *this
@@ -1244,7 +1227,7 @@ class slist_impl
//! //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this //! <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. //! 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); } { 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>. //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
@@ -1266,10 +1249,10 @@ class slist_impl
slist_impl carry; slist_impl carry;
slist_impl counter[64]; slist_impl counter[64];
int fill = 0; int fill = 0;
iterator last_inserted; const_iterator last_inserted;
while(!this->empty()){ while(!this->empty()){
last_inserted = this->begin(); last_inserted = this->cbegin();
carry.splice_after(carry.before_begin(), *this, this->before_begin()); carry.splice_after(carry.cbefore_begin(), *this, this->cbefore_begin());
int i = 0; int i = 0;
while(i < fill && !counter[i].empty()) { while(i < fill && !counter[i].empty()) {
last_inserted = carry.merge(counter[i++], p); last_inserted = carry.merge(counter[i++], p);
@@ -1277,16 +1260,16 @@ class slist_impl
BOOST_INTRUSIVE_INVARIANT_ASSERT(counter[i].empty()); BOOST_INTRUSIVE_INVARIANT_ASSERT(counter[i].empty());
node_ptr p = node_algorithms::get_previous_node node_ptr p = node_algorithms::get_previous_node
(last_inserted.pointed_node(), carry.end().pointed_node()); (last_inserted.pointed_node(), carry.cend().pointed_node());
iterator last_element(p, this); const_iterator last_element(p, this);
if(constant_time_size){ if(constant_time_size){
counter[i].splice_after( counter[i].before_begin(), carry counter[i].splice_after( counter[i].cbefore_begin(), carry
, carry.before_begin(), last_element , carry.cbefore_begin(), last_element
, carry.size()); , carry.size());
} }
else{ else{
counter[i].splice_after( counter[i].before_begin(), carry counter[i].splice_after( counter[i].cbefore_begin(), carry
, carry.before_begin(), last_element); , carry.cbefore_begin(), last_element);
} }
if(i == fill) if(i == fill)
++fill; ++fill;
@@ -1298,13 +1281,13 @@ class slist_impl
node_ptr p = node_algorithms::get_previous_node node_ptr p = node_algorithms::get_previous_node
(last_inserted.pointed_node(), counter[--fill].end().pointed_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){ 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()); , last_element, counter[fill].size());
} }
else{ 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); , last_element);
} }
} }
@@ -1348,12 +1331,12 @@ class slist_impl
template<class Predicate> template<class Predicate>
iterator merge(slist_impl& x, Predicate p) iterator merge(slist_impl& x, Predicate p)
{ {
iterator a(before_begin()), e(end()), ax(x.before_begin()), ex(x.end()); const_iterator a(cbefore_begin()), e(cend()), ax(x.cbefore_begin()), ex(x.cend());
iterator last_inserted(e); const_iterator last_inserted(e);
iterator a_next; const_iterator a_next;
while(++(a_next = a) != e && !x.empty()) { while(++(a_next = a) != e && !x.empty()) {
iterator ix(ax); const_iterator ix(ax);
iterator cx; const_iterator cx;
size_type n(0); size_type n(0);
while(++(cx = ix) != ex && p(*cx, *a_next)){ while(++(cx = ix) != ex && p(*cx, *a_next)){
++ix; ++n; ++ix; ++n;
@@ -1367,7 +1350,7 @@ class slist_impl
if (!x.empty()){ if (!x.empty()){
last_inserted = this->splice_after(a, x); 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 //! <b>Effects</b>: This function removes all of x's elements and inserts them
@@ -1455,7 +1438,7 @@ class slist_impl
template<class Pred, class Disposer> template<class Pred, class Disposer>
void remove_and_dispose_if(Pred pred, Disposer 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){ while(cur != e){
if (pred(*cur)){ if (pred(*cur)){
@@ -1528,10 +1511,10 @@ class slist_impl
template<class BinaryPredicate, class Disposer> template<class BinaryPredicate, class Disposer>
void unique_and_dispose(BinaryPredicate pred, Disposer disposer) void unique_and_dispose(BinaryPredicate pred, Disposer disposer)
{ {
iterator end_n(this->end()); const_iterator end_n(this->cend());
iterator bcur(this->begin()); const_iterator bcur(this->cbegin());
if(bcur != end_n){ if(bcur != end_n){
iterator cur(bcur); const_iterator cur(bcur);
++cur; ++cur;
while(cur != end_n) { while(cur != end_n) {
if (pred(*bcur, *cur)){ if (pred(*bcur, *cur)){
@@ -1643,7 +1626,7 @@ class slist_impl
const_iterator previous(const_iterator i) const const_iterator previous(const_iterator i) const
{ {
if(cache_last && (i.pointed_node() == this->get_end_node())){ 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 return const_iterator
(node_algorithms::get_previous_node (node_algorithms::get_previous_node
@@ -1760,26 +1743,26 @@ class slist_impl
} }
}; };
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator< 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) (const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else #else
(const slist_impl<Config> &x, const slist_impl<Config> &y) (const slist_impl<Config> &x, const slist_impl<Config> &y)
#endif #endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } { 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
bool operator== 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) (const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else #else
(const slist_impl<Config> &x, const slist_impl<Config> &y) (const slist_impl<Config> &x, const slist_impl<Config> &y)
@@ -1812,65 +1795,65 @@ bool operator==
} }
} }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else #else
(const slist_impl<Config> &x, const slist_impl<Config> &y) (const slist_impl<Config> &x, const slist_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else #else
(const slist_impl<Config> &x, const slist_impl<Config> &y) (const slist_impl<Config> &x, const slist_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else #else
(const slist_impl<Config> &x, const slist_impl<Config> &y) (const slist_impl<Config> &x, const slist_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
#else #else
(const slist_impl<Config> &x, const slist_impl<Config> &y) (const slist_impl<Config> &x, const slist_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap inline void swap
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(slist_impl<T, Options...> &x, slist_impl<T, Options...> &y) (slist_impl<T, Options...> &x, slist_impl<T, Options...> &y)
#else #else
(slist_impl<Config> &x, slist_impl<Config> &y) (slist_impl<Config> &x, slist_impl<Config> &y)
@@ -1879,7 +1862,7 @@ inline void swap
//! Helper metafunction to define a \c slist that yields to the same type when the //! Helper metafunction to define a \c slist that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none, class O3 = none, class O4 = none, class O5 = none> template<class T, class O1 = none, class O2 = none, class O3 = none, class O4 = none, class O5 = none>
@@ -1888,7 +1871,13 @@ struct make_slist
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits; <T, typename packed_options::value_traits>::type value_traits;
typedef slist_impl typedef slist_impl
@@ -1907,12 +1896,29 @@ struct make_slist
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4, class O5> template<class T, class O1, class O2, class O3, class O4, class O5>
#else
template<class T, class ...Options>
#endif
class slist 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 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; typedef typename Base::real_value_traits real_value_traits;
//Assert if passed value traits are compatible with the type //Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value)); BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));

View File

@@ -37,7 +37,7 @@ struct get_slist_node_algo
//! Helper metafunction to define a \c slist_base_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none> template<class O1 = none, class O2 = none, class O3 = none>
@@ -46,7 +46,13 @@ struct make_slist_base_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_slist_node_algo<typename packed_options::void_pointer> < get_slist_node_algo<typename packed_options::void_pointer>
@@ -75,15 +81,21 @@ struct make_slist_base_hook
//! //!
//! \c void_pointer<> is the pointer type that will be used internally in the hook //! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this 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> template<class ...Options>
#else #else
template<class O1, class O2, class O3> template<class O1, class O2, class O3>
#endif #endif
class slist_base_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!
@@ -152,7 +164,7 @@ class slist_base_hook
//! Helper metafunction to define a \c slist_member_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none> template<class O1 = none, class O2 = none, class O3 = none>
@@ -161,7 +173,13 @@ struct make_slist_member_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_slist_node_algo<typename packed_options::void_pointer> < get_slist_node_algo<typename packed_options::void_pointer>
@@ -185,15 +203,21 @@ struct make_slist_member_hook
//! //!
//! \c void_pointer<> is the pointer type that will be used internally in the hook //! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this 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> template<class ...Options>
#else #else
template<class O1, class O2, class O3> template<class O1, class O2, class O3>
#endif #endif
class slist_member_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!

View File

@@ -31,7 +31,7 @@ namespace intrusive {
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and //! \c constant_time_size<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -323,18 +323,19 @@ class splay_set_impl
{ tree_.swap(other.tree_); } { tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const splay_set_impl &src, Cloner cloner, Disposer disposer) void clone_from(const splay_set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); } { tree_.clone_from(src.tree_, cloner, disposer); }
@@ -1072,65 +1073,65 @@ class splay_set_impl
/// @endcond /// @endcond
}; };
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y)
#else #else
(const splay_set_impl<Config> &x, const splay_set_impl<Config> &y) (const splay_set_impl<Config> &x, const splay_set_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y)
#else #else
(const splay_set_impl<Config> &x, const splay_set_impl<Config> &y) (const splay_set_impl<Config> &x, const splay_set_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y)
#else #else
(const splay_set_impl<Config> &x, const splay_set_impl<Config> &y) (const splay_set_impl<Config> &x, const splay_set_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y)
#else #else
(const splay_set_impl<Config> &x, const splay_set_impl<Config> &y) (const splay_set_impl<Config> &x, const splay_set_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap 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) (splay_set_impl<T, Options...> &x, splay_set_impl<T, Options...> &y)
#else #else
(splay_set_impl<Config> &x, splay_set_impl<Config> &y) (splay_set_impl<Config> &x, splay_set_impl<Config> &y)
@@ -1139,7 +1140,7 @@ inline void swap
//! Helper metafunction to define a \c splay_set that yields to the same type when the //! Helper metafunction to define a \c splay_set that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -1149,19 +1150,41 @@ struct make_splay_set
{ {
/// @cond /// @cond
typedef splay_set_impl 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class splay_set 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 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: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;
@@ -1210,7 +1233,7 @@ class splay_set
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and //! \c constant_time_size<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -1498,18 +1521,19 @@ class splay_multiset_impl
{ tree_.swap(other.tree_); } { tree_.swap(other.tree_); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const splay_multiset_impl &src, Cloner cloner, Disposer disposer) void clone_from(const splay_multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); } { tree_.clone_from(src.tree_, cloner, disposer); }
@@ -2154,65 +2178,65 @@ class splay_multiset_impl
/// @endcond /// @endcond
}; };
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y)
#else #else
(const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y) (const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y)
#else #else
(const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y) (const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y)
#else #else
(const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y) (const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y)
#else #else
(const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y) (const splay_multiset_impl<Config> &x, const splay_multiset_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap 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) (splay_multiset_impl<T, Options...> &x, splay_multiset_impl<T, Options...> &y)
#else #else
(splay_multiset_impl<Config> &x, splay_multiset_impl<Config> &y) (splay_multiset_impl<Config> &x, splay_multiset_impl<Config> &y)
@@ -2221,7 +2245,7 @@ inline void swap
//! Helper metafunction to define a \c splay_multiset that yields to the same type when the //! Helper metafunction to define a \c splay_multiset that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -2231,19 +2255,42 @@ struct make_splay_multiset
{ {
/// @cond /// @cond
typedef splay_multiset_impl 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class splay_multiset 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 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: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;

View File

@@ -34,7 +34,7 @@ struct get_splay_set_node_algo
//! Helper metafunction to define a \c splay_set_base_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none> template<class O1 = none, class O2 = none, class O3 = none>
@@ -43,7 +43,13 @@ struct make_splay_set_base_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_splay_set_node_algo<typename packed_options::void_pointer> < get_splay_set_node_algo<typename packed_options::void_pointer>
@@ -72,15 +78,21 @@ struct make_splay_set_base_hook
//! //!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, //! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_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> template<class ...Options>
#else #else
template<class O1, class O2, class O3> template<class O1, class O2, class O3>
#endif #endif
class splay_set_base_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!
@@ -149,7 +161,7 @@ class splay_set_base_hook
//! Helper metafunction to define a \c splay_set_member_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none> template<class O1 = none, class O2 = none, class O3 = none>
@@ -158,7 +170,13 @@ struct make_splay_set_member_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_splay_set_node_algo<typename packed_options::void_pointer> < get_splay_set_node_algo<typename packed_options::void_pointer>
@@ -183,15 +201,21 @@ struct make_splay_set_member_hook
//! //!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, //! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_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> template<class ...Options>
#else #else
template<class O1, class O2, class O3> template<class O1, class O2, class O3>
#endif #endif
class splay_set_member_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!

View File

@@ -35,20 +35,6 @@ namespace intrusive {
/// @cond /// @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> template <class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize>
struct splaysetopt struct splaysetopt
{ {
@@ -62,13 +48,7 @@ template <class T>
struct splay_set_defaults struct splay_set_defaults
: pack_options : pack_options
< none < none
, base_hook , base_hook<detail::default_splay_set_hook>
< typename detail::eval_if_c
< internal_default_splay_set_hook<T>::value
, get_default_splay_set_hook<T>
, detail::identity<none>
>::type
>
, constant_time_size<true> , constant_time_size<true>
, size_type<std::size_t> , size_type<std::size_t>
, compare<std::less<T> > , compare<std::less<T> >
@@ -90,7 +70,7 @@ struct splay_set_defaults
//! \c base_hook<>/member_hook<>/value_traits<>, //! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and //! \c constant_time_size<>, \c size_type<> and
//! \c compare<>. //! \c compare<>.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -1072,29 +1052,34 @@ class splaytree_impl
} }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. //! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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 //! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const splaytree_impl &src, Cloner cloner, Disposer disposer) void clone_from(const splaytree_impl &src, Cloner cloner, Disposer disposer)
{ {
this->clear_and_dispose(disposer); this->clear_and_dispose(disposer);
if(!src.empty()){ if(!src.empty()){
detail::exception_disposer<splaytree_impl, Disposer>
rollback(*this, disposer);
node_algorithms::clone node_algorithms::clone
(const_node_ptr(&src.priv_header()) (const_node_ptr(&src.priv_header())
,node_ptr(&this->priv_header()) ,node_ptr(&this->priv_header())
,detail::node_cloner<Cloner, splaytree_impl>(cloner, this) ,detail::node_cloner<Cloner, splaytree_impl>(cloner, this)
,detail::node_disposer<Disposer, splaytree_impl>(disposer, this)); ,detail::node_disposer<Disposer, splaytree_impl>(disposer, this));
this->priv_size_traits().set_size(src.priv_size_traits().get_size()); this->priv_size_traits().set_size(src.priv_size_traits().get_size());
this->priv_comp() = src.priv_comp();
rollback.release();
} }
} }
@@ -1339,26 +1324,26 @@ class splaytree_impl
{ return priv_container_from_end_iterator(it.end_iterator_from_it()); } { 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator< 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) (const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else #else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y) (const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
#endif #endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } { 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
bool operator== 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) (const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else #else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y) (const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
@@ -1390,65 +1375,65 @@ bool operator==
} }
} }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator!= 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) (const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else #else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y) (const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
#endif #endif
{ return !(x == y); } { return !(x == y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator> 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) (const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else #else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y) (const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
#endif #endif
{ return y < x; } { return y < x; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator<= 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) (const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else #else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y) (const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
#endif #endif
{ return !(y < x); } { return !(y < x); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline bool operator>= 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) (const splaytree_impl<T, Options...> &x, const splaytree_impl<T, Options...> &y)
#else #else
(const splaytree_impl<Config> &x, const splaytree_impl<Config> &y) (const splaytree_impl<Config> &x, const splaytree_impl<Config> &y)
#endif #endif
{ return !(x < y); } { return !(x < y); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
#endif #endif
inline void swap inline void swap
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(splaytree_impl<T, Options...> &x, splaytree_impl<T, Options...> &y) (splaytree_impl<T, Options...> &x, splaytree_impl<T, Options...> &y)
#else #else
(splaytree_impl<Config> &x, splaytree_impl<Config> &y) (splaytree_impl<Config> &x, splaytree_impl<Config> &y)
@@ -1456,15 +1441,23 @@ inline void swap
{ x.swap(y); } { x.swap(y); }
/// @cond /// @cond
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
, class O3 = none, class O4 = none , class O3 = none, class O4 = none>
, class O5 = none, class O6 = none #else
, class O7 = none template<class T, class ...Options>
> #endif
struct make_splaytree_opt struct make_splaytree_opt
{ {
typedef typename pack_options 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 typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits; <T, typename packed_options::value_traits>::type value_traits;
@@ -1479,7 +1472,7 @@ struct make_splaytree_opt
//! Helper metafunction to define a \c splaytree that yields to the same type when the //! Helper metafunction to define a \c splaytree that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
@@ -1489,19 +1482,41 @@ struct make_splaytree
{ {
/// @cond /// @cond
typedef splaytree_impl 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4> template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
class splaytree 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 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: public:
typedef typename Base::value_compare value_compare; typedef typename Base::value_compare value_compare;

View File

@@ -870,7 +870,7 @@ class splaytree_algorithms
if(NodeTraits::get_parent(g) == p) if(NodeTraits::get_parent(g) == p)
NodeTraits::set_parent(g, n); NodeTraits::set_parent(g, n);
else{//must be ( g->right == p ) else{//must be ( g->right == p )
assert(0); BOOST_INTRUSIVE_INVARIANT_ASSERT(0);
NodeTraits::set_right(g, n); NodeTraits::set_right(g, n);
} }
} }

View File

@@ -56,7 +56,7 @@ namespace intrusive {
//! //!
//! Since no automatic rehashing is done, iterators are never invalidated when //! Since no automatic rehashing is done, iterators are never invalidated when
//! inserting or erasing elements. Iterators are only invalidated when rehasing. //! 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -268,18 +268,24 @@ class unordered_set_impl
{ table_.swap(other.table_); } { table_.swap(other.table_); }
//! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const unordered_set_impl &src, Cloner cloner, Disposer disposer) void clone_from(const unordered_set_impl &src, Cloner cloner, Disposer disposer)
{ table_.clone_from(src.table_, cloner, disposer); } { table_.clone_from(src.table_, cloner, disposer); }
@@ -920,6 +926,8 @@ class unordered_set_impl
//! //!
//! <b>Effects</b>: Updates the internal reference with the new bucket erases //! <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.
//!
//! 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. //! <b>Complexity</b>: Average case linear in this->size(), worst case quadratic.
//! //!
@@ -927,6 +935,32 @@ class unordered_set_impl
void rehash(const bucket_traits &new_bucket_traits) void rehash(const bucket_traits &new_bucket_traits)
{ table_.rehash(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 //! <b>Effects</b>: Returns the nearest new bucket count optimized for
//! the container that is bigger than n. This suggestion can be used //! the container that is bigger than n. This suggestion can be used
//! to create bucket arrays with a size that will usually improve //! to create bucket arrays with a size that will usually improve
@@ -954,14 +988,14 @@ class unordered_set_impl
//! Helper metafunction to define an \c unordered_set that yields to the same type when the //! Helper metafunction to define an \c unordered_set that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
, class O3 = none, class O4 = none , class O3 = none, class O4 = none
, class O5 = none, class O6 = none , class O5 = none, class O6 = none
, class O7 = none, class O8 = none , class O7 = none, class O8 = none
, class O9 = none , class O9 = none, class O10= none
> >
#endif #endif
struct make_unordered_set struct make_unordered_set
@@ -969,19 +1003,42 @@ struct make_unordered_set
/// @cond /// @cond
typedef unordered_set_impl typedef unordered_set_impl
< typename make_hashtable_opt < 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #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 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 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 //Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value)); BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));
@@ -1052,7 +1109,7 @@ class unordered_set
//! //!
//! Since no automatic rehashing is done, iterators are never invalidated when //! Since no automatic rehashing is done, iterators are never invalidated when
//! inserting or erasing elements. Iterators are only invalidated when rehasing. //! 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> template<class T, class ...Options>
#else #else
template<class Config> template<class Config>
@@ -1265,18 +1322,24 @@ class unordered_multiset_impl
{ table_.swap(other.table_); } { table_.swap(other.table_); }
//! <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 //! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference ) //! 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). //! calling Disposer::operator()(pointer).
//! //!
//! <b>Complexity</b>: Linear to erased plus inserted elements. //! <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> template <class Cloner, class Disposer>
void clone_from(const unordered_multiset_impl &src, Cloner cloner, Disposer disposer) void clone_from(const unordered_multiset_impl &src, Cloner cloner, Disposer disposer)
{ table_.clone_from(src.table_, cloner, disposer); } { table_.clone_from(src.table_, cloner, disposer); }
@@ -1854,6 +1917,8 @@ class unordered_multiset_impl
//! //!
//! <b>Effects</b>: Updates the internal reference with the new bucket erases //! <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.
//!
//! 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. //! <b>Complexity</b>: Average case linear in this->size(), worst case quadratic.
//! //!
@@ -1861,6 +1926,32 @@ class unordered_multiset_impl
void rehash(const bucket_traits &new_bucket_traits) void rehash(const bucket_traits &new_bucket_traits)
{ table_.rehash(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 //! <b>Effects</b>: Returns the nearest new bucket count optimized for
//! the container that is bigger than n. This suggestion can be used //! the container that is bigger than n. This suggestion can be used
//! to create bucket arrays with a size that will usually improve //! to create bucket arrays with a size that will usually improve
@@ -1888,14 +1979,14 @@ class unordered_multiset_impl
//! Helper metafunction to define an \c unordered_multiset that yields to the same type when the //! Helper metafunction to define an \c unordered_multiset that yields to the same type when the
//! same options (either explicitly or implicitly) are used. //! 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> template<class T, class ...Options>
#else #else
template<class T, class O1 = none, class O2 = none template<class T, class O1 = none, class O2 = none
, class O3 = none, class O4 = none , class O3 = none, class O4 = none
, class O5 = none, class O6 = none , class O5 = none, class O6 = none
, class O7 = none, class O8 = none , class O7 = none, class O8 = none
, class O9 = none , class O9 = none, class O10= none
> >
#endif #endif
struct make_unordered_multiset struct make_unordered_multiset
@@ -1903,19 +1994,42 @@ struct make_unordered_multiset
/// @cond /// @cond
typedef unordered_multiset_impl typedef unordered_multiset_impl
< typename make_hashtable_opt < 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; > implementation_defined;
/// @endcond /// @endcond
typedef implementation_defined type; typedef implementation_defined type;
}; };
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #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 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 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 //Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value)); BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));

View File

@@ -153,7 +153,7 @@ struct get_uset_node_algo
//! Helper metafunction to define a \c unordered_set_base_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none> template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -162,7 +162,13 @@ struct make_unordered_set_base_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_uset_node_algo<typename packed_options::void_pointer < get_uset_node_algo<typename packed_options::void_pointer
@@ -201,15 +207,21 @@ struct make_unordered_set_base_hook
//! \c optimize_multikey<> will tell the hook to store a link to form a group //! \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 //! with other value with the same value to speed up searches and insertions
//! in unordered_multisets with a great number of with equivalent keys. //! 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> template<class ...Options>
#else #else
template<class O1, class O2, class O3, class O4> template<class O1, class O2, class O3, class O4>
#endif #endif
class unordered_set_base_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!
@@ -279,7 +291,7 @@ class unordered_set_base_hook
//! Helper metafunction to define a \c unordered_set_member_hook that yields to the same //! 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. //! 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> template<class ...Options>
#else #else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none> template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
@@ -288,7 +300,13 @@ struct make_unordered_set_member_hook
{ {
/// @cond /// @cond
typedef typename pack_options 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 typedef detail::generic_hook
< get_uset_node_algo< typename packed_options::void_pointer < get_uset_node_algo< typename packed_options::void_pointer
@@ -318,15 +336,21 @@ struct make_unordered_set_member_hook
//! //!
//! \c store_hash<> will tell the hook to store the hash of the value //! \c store_hash<> will tell the hook to store the hash of the value
//! to speed up rehashings. //! to speed up rehashings.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class ...Options> template<class ...Options>
#else #else
template<class O1, class O2, class O3, class O4> template<class O1, class O2, class O3, class O4>
#endif #endif
class unordered_set_member_hook 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 //! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state. //! initializes the node to an unlinked state.
//! //!