mirror of
https://github.com/boostorg/intrusive.git
synced 2025-08-04 06:54:44 +02:00
Trailing whitespaces
[SVN r78517]
This commit is contained in:
@@ -50,7 +50,7 @@ struct make_any_base_hook
|
|||||||
Options...
|
Options...
|
||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::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
|
||||||
@@ -63,13 +63,13 @@ struct make_any_base_hook
|
|||||||
|
|
||||||
//! Derive a class from this hook in order to store objects of that class
|
//! Derive a class from this hook in order to store objects of that class
|
||||||
//! in an intrusive container.
|
//! in an intrusive container.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c tag<>, \c void_pointer<> and
|
//! The hook admits the following options: \c tag<>, \c void_pointer<> and
|
||||||
//! \c link_mode<>.
|
//! \c link_mode<>.
|
||||||
//!
|
//!
|
||||||
//! \c tag<> defines a tag to identify the node.
|
//! \c tag<> defines a tag to identify the node.
|
||||||
//! The same tag value can be used in different classes, but if a class is
|
//! The same tag value can be used in different classes, but if a class is
|
||||||
//! derived from more than one \c any_base_hook, then each \c any_base_hook needs its
|
//! derived from more than one \c any_base_hook, then each \c any_base_hook needs its
|
||||||
//! unique tag.
|
//! unique tag.
|
||||||
//!
|
//!
|
||||||
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, \c safe_link).
|
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, \c safe_link).
|
||||||
@@ -94,27 +94,27 @@ class any_base_hook
|
|||||||
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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
any_base_hook();
|
any_base_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
any_base_hook(const any_base_hook& );
|
any_base_hook(const any_base_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
any_base_hook& operator=(const any_base_hook& );
|
any_base_hook& operator=(const any_base_hook& );
|
||||||
@@ -122,17 +122,17 @@ class any_base_hook
|
|||||||
//! <b>Effects</b>: If link_mode is \c normal_link, the destructor does
|
//! <b>Effects</b>: If link_mode is \c normal_link, the destructor does
|
||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in a container an assertion is raised.
|
//! object is stored in a container an assertion is raised.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~any_base_hook();
|
~any_base_hook();
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link.
|
//! <b>Precondition</b>: link_mode must be \c safe_link.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c container::iterator_to
|
//! otherwise. This function can be used to test whether \c container::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -148,7 +148,7 @@ struct make_any_member_hook
|
|||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< hook_defaults,
|
< hook_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3
|
O1, O2, O3
|
||||||
#else
|
#else
|
||||||
@@ -168,10 +168,10 @@ struct make_any_member_hook
|
|||||||
|
|
||||||
//! Store this hook in a class to be inserted
|
//! Store this hook in a class to be inserted
|
||||||
//! in an intrusive container.
|
//! in an intrusive container.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c void_pointer<> and
|
//! The hook admits the following options: \c void_pointer<> and
|
||||||
//! \c link_mode<>.
|
//! \c link_mode<>.
|
||||||
//!
|
//!
|
||||||
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link or \c safe_link).
|
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link or \c safe_link).
|
||||||
//!
|
//!
|
||||||
//! \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
|
||||||
@@ -194,27 +194,27 @@ class any_member_hook
|
|||||||
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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
any_member_hook();
|
any_member_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
any_member_hook(const any_member_hook& );
|
any_member_hook(const any_member_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
any_member_hook& operator=(const any_member_hook& );
|
any_member_hook& operator=(const any_member_hook& );
|
||||||
@@ -222,17 +222,17 @@ class any_member_hook
|
|||||||
//! <b>Effects</b>: If link_mode is \c normal_link, the destructor does
|
//! <b>Effects</b>: If link_mode is \c normal_link, the destructor does
|
||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in a container an assertion is raised.
|
//! object is stored in a container an assertion is raised.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~any_member_hook();
|
~any_member_hook();
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link.
|
//! <b>Precondition</b>: link_mode must be \c safe_link.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c container::iterator_to
|
//! otherwise. This function can be used to test whether \c container::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -336,8 +336,8 @@ struct any_to_unordered_set_hook
|
|||||||
{};
|
{};
|
||||||
|
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -61,16 +61,16 @@ struct make_avl_set_base_hook
|
|||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Derive a class from avl_set_base_hook in order to store objects in
|
//! Derive a class from avl_set_base_hook in order to store objects in
|
||||||
//! in an avl_set/avl_multiset. avl_set_base_hook holds the data necessary to maintain
|
//! in an avl_set/avl_multiset. avl_set_base_hook holds the data necessary to maintain
|
||||||
//! the avl_set/avl_multiset and provides an appropriate value_traits class for avl_set/avl_multiset.
|
//! the avl_set/avl_multiset and provides an appropriate value_traits class for avl_set/avl_multiset.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
|
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
|
||||||
//! \c link_mode<> and \c optimize_size<>.
|
//! \c link_mode<> and \c optimize_size<>.
|
||||||
//!
|
//!
|
||||||
//! \c tag<> defines a tag to identify the node.
|
//! \c tag<> defines a tag to identify the node.
|
||||||
//! The same tag value can be used in different classes, but if a class is
|
//! The same tag value can be used in different classes, but if a class is
|
||||||
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
||||||
//! unique tag.
|
//! unique tag.
|
||||||
//!
|
//!
|
||||||
//! \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
|
||||||
@@ -99,27 +99,27 @@ class avl_set_base_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
avl_set_base_hook();
|
avl_set_base_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
avl_set_base_hook(const avl_set_base_hook& );
|
avl_set_base_hook(const avl_set_base_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
avl_set_base_hook& operator=(const avl_set_base_hook& );
|
avl_set_base_hook& operator=(const avl_set_base_hook& );
|
||||||
@@ -128,37 +128,37 @@ class avl_set_base_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in a set an assertion is raised. If link_mode is
|
//! object is stored in a set an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~avl_set_base_hook();
|
~avl_set_base_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(avl_set_base_hook &other);
|
void swap_nodes(avl_set_base_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c set::iterator_to
|
//! otherwise. This function can be used to test whether \c set::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -195,7 +195,7 @@ struct make_avl_set_member_hook
|
|||||||
//! Put a public data member avl_set_member_hook in order to store objects of this class in
|
//! Put a public data member avl_set_member_hook in order to store objects of this class in
|
||||||
//! an avl_set/avl_multiset. avl_set_member_hook holds the data necessary for maintaining the
|
//! an avl_set/avl_multiset. avl_set_member_hook holds the data necessary for maintaining the
|
||||||
//! avl_set/avl_multiset and provides an appropriate value_traits class for avl_set/avl_multiset.
|
//! avl_set/avl_multiset and provides an appropriate value_traits class for avl_set/avl_multiset.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c void_pointer<>,
|
//! The hook admits the following options: \c void_pointer<>,
|
||||||
//! \c link_mode<> and \c optimize_size<>.
|
//! \c link_mode<> and \c optimize_size<>.
|
||||||
//!
|
//!
|
||||||
@@ -225,27 +225,27 @@ class avl_set_member_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
avl_set_member_hook();
|
avl_set_member_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
avl_set_member_hook(const avl_set_member_hook& );
|
avl_set_member_hook(const avl_set_member_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
avl_set_member_hook& operator=(const avl_set_member_hook& );
|
avl_set_member_hook& operator=(const avl_set_member_hook& );
|
||||||
@@ -254,43 +254,43 @@ class avl_set_member_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in a set an assertion is raised. If link_mode is
|
//! object is stored in a set an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~avl_set_member_hook();
|
~avl_set_member_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(avl_set_member_hook &other);
|
void swap_nodes(avl_set_member_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c set::iterator_to
|
//! otherwise. This function can be used to test whether \c set::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -45,25 +45,25 @@ namespace intrusive {
|
|||||||
//! <b>Static functions</b>:
|
//! <b>Static functions</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static balance get_balance(const_node_ptr n);</tt>
|
//! <tt>static balance get_balance(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_balance(node_ptr n, balance b);</tt>
|
//! <tt>static void set_balance(node_ptr n, balance b);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static balance negative();</tt>
|
//! <tt>static balance negative();</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static balance zero();</tt>
|
//! <tt>static balance zero();</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static balance positive();</tt>
|
//! <tt>static balance positive();</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class avltree_algorithms
|
class avltree_algorithms
|
||||||
@@ -88,7 +88,7 @@ class avltree_algorithms
|
|||||||
avltree_node_cloner(F f)
|
avltree_node_cloner(F f)
|
||||||
: base_t(f)
|
: base_t(f)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
node_ptr operator()(const node_ptr &p)
|
node_ptr operator()(const node_ptr &p)
|
||||||
{
|
{
|
||||||
node_ptr n = base_t::get()(p);
|
node_ptr n = base_t::get()(p);
|
||||||
@@ -120,27 +120,27 @@ class avltree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
||||||
//! links to the second tree and header2 will have links to the first tree.
|
//! links to the second tree and header2 will have links to the first tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
||||||
{ return tree_algorithms::swap_tree(header1, header2); }
|
{ return tree_algorithms::swap_tree(header1, header2); }
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -149,22 +149,22 @@ class avltree_algorithms
|
|||||||
{
|
{
|
||||||
if(node1 == node2)
|
if(node1 == node2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
||||||
swap_nodes(node1, header1, node2, header2);
|
swap_nodes(node1, header1, node2, header2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees with header header1 and header2.
|
//! of two trees with header header1 and header2.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -176,20 +176,20 @@ class avltree_algorithms
|
|||||||
tree_algorithms::swap_nodes(node1, header1, node2, header2);
|
tree_algorithms::swap_nodes(node1, header1, node2, header2);
|
||||||
//Swap balance
|
//Swap balance
|
||||||
balance c = NodeTraits::get_balance(node1);
|
balance c = NodeTraits::get_balance(node1);
|
||||||
NodeTraits::set_balance(node1, NodeTraits::get_balance(node2));
|
NodeTraits::set_balance(node1, NodeTraits::get_balance(node2));
|
||||||
NodeTraits::set_balance(node2, c);
|
NodeTraits::set_balance(node2, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! and new_node must not be inserted in a tree.
|
//! and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -205,14 +205,14 @@ class avltree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! with header "header" and new_node must not be inserted in a tree.
|
//! with header "header" and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -222,15 +222,15 @@ class avltree_algorithms
|
|||||||
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
|
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
tree_algorithms::replace_node(node_to_be_replaced, header, new_node);
|
tree_algorithms::replace_node(node_to_be_replaced, header, new_node);
|
||||||
NodeTraits::set_balance(new_node, NodeTraits::get_balance(node_to_be_replaced));
|
NodeTraits::set_balance(new_node, NodeTraits::get_balance(node_to_be_replaced));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a tree node but not the header.
|
//! <b>Requires</b>: node is a tree node but not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
|
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
//! <b>Complexity</b>: Average complexity is constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void unlink(const node_ptr & node)
|
static void unlink(const node_ptr & node)
|
||||||
{
|
{
|
||||||
@@ -243,14 +243,14 @@ class avltree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header of a tree.
|
//! <b>Requires</b>: header is the header of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
||||||
//! updates the header link to the new leftmost node.
|
//! updates the header link to the new leftmost node.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
//! <b>Complexity</b>: Average complexity is constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function breaks the tree and the tree can
|
//! <b>Notes</b>: This function breaks the tree and the tree can
|
||||||
//! only be used for more unlink_leftmost_without_rebalance calls.
|
//! only be used for more unlink_leftmost_without_rebalance calls.
|
||||||
//! This function is normally used to achieve a step by step
|
//! This function is normally used to achieve a step by step
|
||||||
@@ -260,51 +260,51 @@ class avltree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
||||||
//! by init(...).
|
//! by init(...).
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool unique(const const_node_ptr & node)
|
static bool unique(const const_node_ptr & node)
|
||||||
{ return tree_algorithms::unique(node); }
|
{ return tree_algorithms::unique(node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t count(const const_node_ptr & node)
|
static std::size_t count(const const_node_ptr & node)
|
||||||
{ return tree_algorithms::count(node); }
|
{ return tree_algorithms::count(node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header node of the tree.
|
//! <b>Requires</b>: header is the header node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes above the header.
|
//! <b>Effects</b>: Returns the number of nodes above the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t size(const const_node_ptr & header)
|
static std::size_t size(const const_node_ptr & header)
|
||||||
{ return tree_algorithms::size(header); }
|
{ return tree_algorithms::size(header); }
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the header.
|
//! <b>Requires</b>: p is a node from the tree except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the next node of the tree.
|
//! <b>Effects</b>: Returns the next node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr next_node(const node_ptr & p)
|
static node_ptr next_node(const node_ptr & p)
|
||||||
{ return tree_algorithms::next_node(p); }
|
{ return tree_algorithms::next_node(p); }
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the previous node of the tree.
|
//! <b>Effects</b>: Returns the previous node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr prev_node(const node_ptr & p)
|
static node_ptr prev_node(const node_ptr & p)
|
||||||
{ return tree_algorithms::prev_node(p); }
|
{ return tree_algorithms::prev_node(p); }
|
||||||
@@ -312,9 +312,9 @@ class avltree_algorithms
|
|||||||
//! <b>Requires</b>: node must not be part of any tree.
|
//! <b>Requires</b>: node must not be part of any tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: After the function unique(node) == true.
|
//! <b>Effects</b>: After the function unique(node) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
@@ -325,25 +325,25 @@ class avltree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
||||||
//! unique(header) == true.
|
//! unique(header) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
static void init_header(const node_ptr & header)
|
static void init_header(const node_ptr & header)
|
||||||
{
|
{
|
||||||
tree_algorithms::init_header(header);
|
tree_algorithms::init_header(header);
|
||||||
NodeTraits::set_balance(header, NodeTraits::zero());
|
NodeTraits::set_balance(header, NodeTraits::zero());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header must be the header of a tree, z a node
|
//! <b>Requires</b>: header must be the header of a tree, z a node
|
||||||
//! of that tree and z != header.
|
//! of that tree and z != header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
|
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Amortized constant time.
|
//! <b>Complexity</b>: Amortized constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr erase(const node_ptr & header, const node_ptr & z)
|
static node_ptr erase(const node_ptr & header, const node_ptr & z)
|
||||||
{
|
{
|
||||||
@@ -361,18 +361,18 @@ class avltree_algorithms
|
|||||||
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
||||||
//! take a node_ptr and shouldn't throw.
|
//! take a node_ptr and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: First empties target tree calling
|
//! <b>Effects</b>: First empties target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
||||||
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
||||||
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
||||||
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template <class Cloner, class Disposer>
|
template <class Cloner, class Disposer>
|
||||||
static void clone
|
static void clone
|
||||||
@@ -385,13 +385,13 @@ class avltree_algorithms
|
|||||||
//! <b>Requires</b>: "disposer" must be an object function
|
//! <b>Requires</b>: "disposer" must be an object function
|
||||||
//! taking a node_ptr parameter and shouldn't throw.
|
//! taking a node_ptr parameter and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Empties the target tree calling
|
//! <b>Effects</b>: Empties the target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template<class Disposer>
|
template<class Disposer>
|
||||||
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
||||||
@@ -407,7 +407,7 @@ class avltree_algorithms
|
|||||||
//! not exist.
|
//! not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr lower_bound
|
static node_ptr lower_bound
|
||||||
@@ -423,7 +423,7 @@ class avltree_algorithms
|
|||||||
//! than "key" according to "comp" or "header" if that element does not exist.
|
//! than "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr upper_bound
|
static node_ptr upper_bound
|
||||||
@@ -439,7 +439,7 @@ class avltree_algorithms
|
|||||||
//! "key" according to "comp" or "header" if that element does not exist.
|
//! "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr find
|
static node_ptr find
|
||||||
@@ -457,7 +457,7 @@ class avltree_algorithms
|
|||||||
//! if they there are no equivalent elements.
|
//! if they there are no equivalent elements.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> equal_range
|
static std::pair<node_ptr, node_ptr> equal_range
|
||||||
@@ -471,10 +471,10 @@ class avltree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
||||||
//! according to "comp".
|
//! according to "comp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||||
//! most logarithmic.
|
//! most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal_upper_bound
|
static node_ptr insert_equal_upper_bound
|
||||||
@@ -492,10 +492,10 @@ class avltree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
|
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
|
||||||
//! according to "comp".
|
//! according to "comp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||||
//! most logarithmic.
|
//! most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal_lower_bound
|
static node_ptr insert_equal_lower_bound
|
||||||
@@ -511,14 +511,14 @@ class avltree_algorithms
|
|||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
|
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
|
||||||
//! the "header"'s tree.
|
//! the "header"'s tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
||||||
//! where it will be inserted. If "hint" is the upper_bound
|
//! where it will be inserted. If "hint" is the upper_bound
|
||||||
//! the insertion takes constant time (two comparisons in the worst case).
|
//! the insertion takes constant time (two comparisons in the worst case).
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
||||||
//! constant time if new_node is inserted immediately before "hint".
|
//! constant time if new_node is inserted immediately before "hint".
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal
|
static node_ptr insert_equal
|
||||||
@@ -534,13 +534,13 @@ class avltree_algorithms
|
|||||||
//! "pos" must be an iterator pointing to the successor to "new_node"
|
//! "pos" must be an iterator pointing to the successor to "new_node"
|
||||||
//! once inserted according to the order of already inserted nodes. This function does not
|
//! once inserted according to the order of already inserted nodes. This function does not
|
||||||
//! check "pos" and this precondition must be guaranteed by the caller.
|
//! check "pos" and this precondition must be guaranteed by the caller.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
||||||
//! tree invariants might be broken.
|
//! tree invariants might be broken.
|
||||||
static node_ptr insert_before
|
static node_ptr insert_before
|
||||||
@@ -554,13 +554,13 @@ class avltree_algorithms
|
|||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! <b>Requires</b>: "header" must be the header node of a tree.
|
||||||
//! "new_node" must be, according to the used ordering no less than the
|
//! "new_node" must be, according to the used ordering no less than the
|
||||||
//! greatest inserted key.
|
//! greatest inserted key.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
//! tree invariants are broken. This function is slightly faster than
|
||||||
//! using "insert_before".
|
//! using "insert_before".
|
||||||
@@ -573,13 +573,13 @@ class avltree_algorithms
|
|||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! <b>Requires</b>: "header" must be the header node of a tree.
|
||||||
//! "new_node" must be, according to the used ordering, no greater than the
|
//! "new_node" must be, according to the used ordering, no greater than the
|
||||||
//! lowest inserted key.
|
//! lowest inserted key.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
//! tree invariants are broken. This function is slightly faster than
|
||||||
//! using "insert_before".
|
//! using "insert_before".
|
||||||
@@ -593,7 +593,7 @@ class avltree_algorithms
|
|||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
//! KeyNodePtrCompare is a function object that induces a strict weak
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
||||||
//! tree according to "comp" and obtains the needed information to realize
|
//! tree according to "comp" and obtains the needed information to realize
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
//! a constant-time node insertion if there is no equivalent node.
|
||||||
@@ -604,11 +604,11 @@ class avltree_algorithms
|
|||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
//! be used with the "insert_commit" function to achieve a constant-time
|
||||||
//! insertion function.
|
//! insertion function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
//! a node is expensive and the user does not want to have two equivalent nodes
|
||||||
//! in the tree: if there is an equivalent value
|
//! in the tree: if there is an equivalent value
|
||||||
@@ -634,12 +634,12 @@ class avltree_algorithms
|
|||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
||||||
//! "hint" is node from the "header"'s tree.
|
//! "hint" is node from the "header"'s tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
||||||
//! tree according to "comp" using "hint" as a hint to where it should be
|
//! tree according to "comp" using "hint" as a hint to where it should be
|
||||||
//! inserted and obtains the needed information to realize
|
//! inserted and obtains the needed information to realize
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
//! a constant-time node insertion if there is no equivalent node.
|
||||||
//! If "hint" is the upper_bound the function has constant time
|
//! If "hint" is the upper_bound the function has constant time
|
||||||
//! complexity (two comparisons in the worst case).
|
//! complexity (two comparisons in the worst case).
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: If there is an equivalent value
|
//! <b>Returns</b>: If there is an equivalent value
|
||||||
@@ -648,12 +648,12 @@ class avltree_algorithms
|
|||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
//! be used with the "insert_commit" function to achieve a constant-time
|
||||||
//! insertion function.
|
//! insertion function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
|
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
|
||||||
//! amortized constant time if new_node should be inserted immediately before "hint".
|
//! amortized constant time if new_node should be inserted immediately before "hint".
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
//! a node is expensive and the user does not want to have two equivalent nodes
|
||||||
//! in the tree: if there is an equivalent value
|
//! in the tree: if there is an equivalent value
|
||||||
@@ -678,16 +678,16 @@ class avltree_algorithms
|
|||||||
//! "commit_data" must have been obtained from a previous call to
|
//! "commit_data" must have been obtained from a previous call to
|
||||||
//! "insert_unique_check". No objects should have been inserted or erased
|
//! "insert_unique_check". No objects should have been inserted or erased
|
||||||
//! from the set between the "insert_unique_check" that filled "commit_data"
|
//! from the set between the "insert_unique_check" that filled "commit_data"
|
||||||
//! and the call to "insert_commit".
|
//! and the call to "insert_commit".
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
||||||
//! from the "commit_data" that a previous "insert_check" filled.
|
//! from the "commit_data" that a previous "insert_check" filled.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
||||||
//! previously executed to fill "commit_data". No value should be inserted or
|
//! previously executed to fill "commit_data". No value should be inserted or
|
||||||
//! erased between the "insert_check" and "insert_commit" calls.
|
//! erased between the "insert_check" and "insert_commit" calls.
|
||||||
@@ -703,7 +703,7 @@ class avltree_algorithms
|
|||||||
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr get_header(const node_ptr & n)
|
static node_ptr get_header(const node_ptr & n)
|
||||||
{ return tree_algorithms::get_header(n); }
|
{ return tree_algorithms::get_header(n); }
|
||||||
@@ -712,11 +712,11 @@ class avltree_algorithms
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node of a tree.
|
//! <b>Requires</b>: p is a node of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if p is the header of the tree.
|
//! <b>Effects</b>: Returns true if p is the header of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool is_header(const const_node_ptr & p)
|
static bool is_header(const const_node_ptr & p)
|
||||||
{ return NodeTraits::get_balance(p) == NodeTraits::zero() && tree_algorithms::is_header(p); }
|
{ return NodeTraits::get_balance(p) == NodeTraits::zero() && tree_algorithms::is_header(p); }
|
||||||
@@ -727,7 +727,7 @@ class avltree_algorithms
|
|||||||
for (node_ptr root = NodeTraits::get_parent(header); x != root; root = NodeTraits::get_parent(header)) {
|
for (node_ptr root = NodeTraits::get_parent(header); x != root; root = NodeTraits::get_parent(header)) {
|
||||||
const balance x_parent_balance = NodeTraits::get_balance(x_parent);
|
const balance x_parent_balance = NodeTraits::get_balance(x_parent);
|
||||||
if(x_parent_balance == NodeTraits::zero()){
|
if(x_parent_balance == NodeTraits::zero()){
|
||||||
NodeTraits::set_balance(x_parent,
|
NodeTraits::set_balance(x_parent,
|
||||||
(x == NodeTraits::get_right(x_parent) ? NodeTraits::negative() : NodeTraits::positive()));
|
(x == NodeTraits::get_right(x_parent) ? NodeTraits::negative() : NodeTraits::positive()));
|
||||||
break; // the height didn't change, let's stop here
|
break; // the height didn't change, let's stop here
|
||||||
}
|
}
|
||||||
@@ -935,8 +935,8 @@ class avltree_algorithms
|
|||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -63,16 +63,16 @@ struct make_bs_set_base_hook
|
|||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Derive a class from bs_set_base_hook in order to store objects in
|
//! Derive a class from bs_set_base_hook in order to store objects in
|
||||||
//! in a bs_set/bs_multiset. bs_set_base_hook holds the data necessary to maintain
|
//! in a bs_set/bs_multiset. bs_set_base_hook holds the data necessary to maintain
|
||||||
//! the bs_set/bs_multiset and provides an appropriate value_traits class for bs_set/bs_multiset.
|
//! the bs_set/bs_multiset and provides an appropriate value_traits class for bs_set/bs_multiset.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
|
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
|
||||||
//! \c link_mode<>.
|
//! \c link_mode<>.
|
||||||
//!
|
//!
|
||||||
//! \c tag<> defines a tag to identify the node.
|
//! \c tag<> defines a tag to identify the node.
|
||||||
//! The same tag value can be used in different classes, but if a class is
|
//! The same tag value can be used in different classes, but if a class is
|
||||||
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
||||||
//! unique tag.
|
//! unique tag.
|
||||||
//!
|
//!
|
||||||
//! \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
|
||||||
@@ -99,27 +99,27 @@ class bs_set_base_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
bs_set_base_hook();
|
bs_set_base_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
bs_set_base_hook(const bs_set_base_hook& );
|
bs_set_base_hook(const bs_set_base_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
bs_set_base_hook& operator=(const bs_set_base_hook& );
|
bs_set_base_hook& operator=(const bs_set_base_hook& );
|
||||||
@@ -128,37 +128,37 @@ class bs_set_base_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in a set an assertion is raised. If link_mode is
|
//! object is stored in a set an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~bs_set_base_hook();
|
~bs_set_base_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(bs_set_base_hook &other);
|
void swap_nodes(bs_set_base_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c set::iterator_to
|
//! otherwise. This function can be used to test whether \c set::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -198,7 +198,7 @@ struct make_bs_set_member_hook
|
|||||||
//! Put a public data member bs_set_member_hook in order to store objects of this class in
|
//! Put a public data member bs_set_member_hook in order to store objects of this class in
|
||||||
//! a bs_set/bs_multiset. bs_set_member_hook holds the data necessary for maintaining the
|
//! a bs_set/bs_multiset. bs_set_member_hook holds the data necessary for maintaining the
|
||||||
//! bs_set/bs_multiset and provides an appropriate value_traits class for bs_set/bs_multiset.
|
//! bs_set/bs_multiset and provides an appropriate value_traits class for bs_set/bs_multiset.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c void_pointer<>, \c link_mode<>.
|
//! The hook admits the following options: \c void_pointer<>, \c link_mode<>.
|
||||||
//!
|
//!
|
||||||
//! \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
|
||||||
@@ -224,27 +224,27 @@ class bs_set_member_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
bs_set_member_hook();
|
bs_set_member_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
bs_set_member_hook(const bs_set_member_hook& );
|
bs_set_member_hook(const bs_set_member_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
bs_set_member_hook& operator=(const bs_set_member_hook& );
|
bs_set_member_hook& operator=(const bs_set_member_hook& );
|
||||||
@@ -253,43 +253,43 @@ class bs_set_member_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in a set an assertion is raised. If link_mode is
|
//! object is stored in a set an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~bs_set_member_hook();
|
~bs_set_member_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(bs_set_member_hook &other);
|
void swap_nodes(bs_set_member_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c set::iterator_to
|
//! otherwise. This function can be used to test whether \c set::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -40,11 +40,11 @@ namespace intrusive {
|
|||||||
//! <b>Static functions</b>:
|
//! <b>Static functions</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_previous(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_previous(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_previous(node_ptr n, node_ptr prev);</tt>
|
//! <tt>static void set_previous(node_ptr n, node_ptr prev);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_next(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_next(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_next(node_ptr n, node_ptr next);</tt>
|
//! <tt>static void set_next(node_ptr n, node_ptr next);</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class circular_list_algorithms
|
class circular_list_algorithms
|
||||||
@@ -57,9 +57,9 @@ class circular_list_algorithms
|
|||||||
|
|
||||||
//! <b>Effects</b>: Constructs an non-used list element, so that
|
//! <b>Effects</b>: Constructs an non-used list element, so that
|
||||||
//! inited(this_node) == true
|
//! inited(this_node) == true
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void init(const node_ptr &this_node)
|
static void init(const node_ptr &this_node)
|
||||||
{
|
{
|
||||||
@@ -69,20 +69,20 @@ class circular_list_algorithms
|
|||||||
|
|
||||||
//! <b>Effects</b>: Returns true is "this_node" is in a non-used state
|
//! <b>Effects</b>: Returns true is "this_node" is in a non-used state
|
||||||
//! as if it was initialized by the "init" function.
|
//! as if it was initialized by the "init" function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool inited(const const_node_ptr &this_node)
|
static bool inited(const const_node_ptr &this_node)
|
||||||
{ return !NodeTraits::get_next(this_node); }
|
{ return !NodeTraits::get_next(this_node); }
|
||||||
|
|
||||||
//! <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:
|
||||||
//! <tt>NodeTraits::get_next(this_node) == NodeTraits::get_previous(this_node)
|
//! <tt>NodeTraits::get_next(this_node) == NodeTraits::get_previous(this_node)
|
||||||
//! == this_node</tt>.
|
//! == this_node</tt>.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void init_header(const node_ptr &this_node)
|
static void init_header(const node_ptr &this_node)
|
||||||
{
|
{
|
||||||
@@ -92,12 +92,12 @@ class circular_list_algorithms
|
|||||||
|
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true is "this_node" is the only node of a circular list:
|
//! <b>Effects</b>: Returns true is "this_node" is the only node of a circular list:
|
||||||
//! <tt>return NodeTraits::get_next(this_node) == this_node</tt>
|
//! <tt>return NodeTraits::get_next(this_node) == this_node</tt>
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool unique(const const_node_ptr &this_node)
|
static bool unique(const const_node_ptr &this_node)
|
||||||
{
|
{
|
||||||
@@ -106,14 +106,14 @@ class circular_list_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes in a circular list. If the circular list
|
//! <b>Effects</b>: Returns the number of nodes in a circular list. If the circular list
|
||||||
//! is empty, returns 1.
|
//! is empty, returns 1.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear
|
//! <b>Complexity</b>: Linear
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t count(const const_node_ptr &this_node)
|
static std::size_t count(const const_node_ptr &this_node)
|
||||||
{
|
{
|
||||||
std::size_t result = 0;
|
std::size_t result = 0;
|
||||||
const_node_ptr p = this_node;
|
const_node_ptr p = this_node;
|
||||||
@@ -125,11 +125,11 @@ class circular_list_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the node from the circular list.
|
//! <b>Effects</b>: Unlinks the node from the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr unlink(const node_ptr &this_node)
|
static node_ptr unlink(const node_ptr &this_node)
|
||||||
{
|
{
|
||||||
@@ -146,11 +146,11 @@ class circular_list_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: b and e must be nodes of the same circular list or an empty range.
|
//! <b>Requires</b>: b and e must be nodes of the same circular list or an empty range.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the node [b, e) from the circular list.
|
//! <b>Effects</b>: Unlinks the node [b, e) from the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void unlink(const node_ptr &b, const node_ptr &e)
|
static void unlink(const node_ptr &b, const node_ptr &e)
|
||||||
{
|
{
|
||||||
@@ -162,11 +162,11 @@ class circular_list_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: nxt_node must be a node of a circular list.
|
//! <b>Requires</b>: nxt_node must be a node of a circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Links this_node before nxt_node in the circular list.
|
//! <b>Effects</b>: Links this_node before nxt_node in the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void link_before(const node_ptr &nxt_node, const node_ptr &this_node)
|
static void link_before(const node_ptr &nxt_node, const node_ptr &this_node)
|
||||||
{
|
{
|
||||||
@@ -181,11 +181,11 @@ class circular_list_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: prev_node must be a node of a circular list.
|
//! <b>Requires</b>: prev_node must be a node of a circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Links this_node after prev_node in the circular list.
|
//! <b>Effects</b>: Links this_node after prev_node in the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void link_after(const node_ptr &prev_node, const node_ptr &this_node)
|
static void link_after(const node_ptr &prev_node, const node_ptr &this_node)
|
||||||
{
|
{
|
||||||
@@ -201,13 +201,13 @@ class circular_list_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: this_node and other_node must be nodes inserted
|
//! <b>Requires</b>: this_node and other_node must be nodes inserted
|
||||||
//! in circular lists or be empty circular lists.
|
//! in circular lists or be empty circular lists.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps the position of the nodes: this_node is inserted in
|
//! <b>Effects</b>: Swaps the position of the nodes: this_node is inserted in
|
||||||
//! other_nodes position in the second circular list and the other_node is inserted
|
//! other_nodes position in the second circular list and the other_node is inserted
|
||||||
//! in this_node's position in the first circular list.
|
//! in this_node's position in the first circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
/*
|
/*
|
||||||
static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node)
|
static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node)
|
||||||
@@ -248,22 +248,22 @@ class circular_list_algorithms
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Watanabe version
|
//Watanabe version
|
||||||
private:
|
private:
|
||||||
static void swap_prev(const node_ptr &this_node, const node_ptr &other_node)
|
static void swap_prev(const node_ptr &this_node, const node_ptr &other_node)
|
||||||
{
|
{
|
||||||
node_ptr temp(NodeTraits::get_previous(this_node));
|
node_ptr temp(NodeTraits::get_previous(this_node));
|
||||||
NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node));
|
NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node));
|
||||||
NodeTraits::set_previous(other_node, temp);
|
NodeTraits::set_previous(other_node, temp);
|
||||||
}
|
}
|
||||||
static void swap_next(const node_ptr &this_node, const node_ptr &other_node)
|
static void swap_next(const node_ptr &this_node, const node_ptr &other_node)
|
||||||
{
|
{
|
||||||
node_ptr temp(NodeTraits::get_next(this_node));
|
node_ptr temp(NodeTraits::get_next(this_node));
|
||||||
NodeTraits::set_next(this_node, NodeTraits::get_next(other_node));
|
NodeTraits::set_next(this_node, NodeTraits::get_next(other_node));
|
||||||
NodeTraits::set_next(other_node, temp);
|
NodeTraits::set_next(other_node, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node)
|
static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node)
|
||||||
{
|
{
|
||||||
if (other_node == this_node)
|
if (other_node == this_node)
|
||||||
return;
|
return;
|
||||||
@@ -276,15 +276,15 @@ class circular_list_algorithms
|
|||||||
init_header(other_node);
|
init_header(other_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
node_ptr next_this(NodeTraits::get_next(this_node));
|
node_ptr next_this(NodeTraits::get_next(this_node));
|
||||||
node_ptr prev_this(NodeTraits::get_previous(this_node));
|
node_ptr prev_this(NodeTraits::get_previous(this_node));
|
||||||
node_ptr next_other(NodeTraits::get_next(other_node));
|
node_ptr next_other(NodeTraits::get_next(other_node));
|
||||||
node_ptr prev_other(NodeTraits::get_previous(other_node));
|
node_ptr prev_other(NodeTraits::get_previous(other_node));
|
||||||
//these first two swaps must happen before the other two
|
//these first two swaps must happen before the other two
|
||||||
swap_prev(next_this, next_other);
|
swap_prev(next_this, next_other);
|
||||||
swap_next(prev_this, prev_other);
|
swap_next(prev_this, prev_other);
|
||||||
swap_next(this_node, other_node);
|
swap_next(this_node, other_node);
|
||||||
swap_prev(this_node, other_node);
|
swap_prev(this_node, other_node);
|
||||||
|
|
||||||
if(this_inited){
|
if(this_inited){
|
||||||
init(other_node);
|
init(other_node);
|
||||||
@@ -295,14 +295,14 @@ class circular_list_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: b and e must be nodes of the same circular list or an empty range.
|
//! <b>Requires</b>: b and e must be nodes of the same circular list or an empty range.
|
||||||
//! and p must be a node of a different circular list or may not be an iterator in
|
//! and p must be a node of a different circular list or may not be an iterator in
|
||||||
// [b, e).
|
// [b, e).
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Removes the nodes from [b, e) range from their circular list and inserts
|
//! <b>Effects</b>: Removes the nodes from [b, e) range from their circular list and inserts
|
||||||
//! them before p in p's circular list.
|
//! them before p in p's circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void transfer(const node_ptr &p, const node_ptr &b, const node_ptr &e)
|
static void transfer(const node_ptr &p, const node_ptr &b, const node_ptr &e)
|
||||||
{
|
{
|
||||||
@@ -321,13 +321,13 @@ class circular_list_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: i must a node of a circular list
|
//! <b>Requires</b>: i must a node of a circular list
|
||||||
//! and p must be a node of a different circular list.
|
//! and p must be a node of a different circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Removes the node i from its circular list and inserts
|
//! <b>Effects</b>: Removes the node i from its circular list and inserts
|
||||||
//! it before p in p's circular list.
|
//! it before p in p's circular list.
|
||||||
//! If p == i or p == NodeTraits::get_next(i), this function is a null operation.
|
//! If p == i or p == NodeTraits::get_next(i), this function is a null operation.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void transfer(const node_ptr &p, const node_ptr &i)
|
static void transfer(const node_ptr &p, const node_ptr &i)
|
||||||
{
|
{
|
||||||
@@ -345,16 +345,16 @@ class circular_list_algorithms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Effects</b>: Reverses the order of elements in the list.
|
//! <b>Effects</b>: Reverses the order of elements in the list.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: This function is linear time.
|
//! <b>Complexity</b>: This function is linear time.
|
||||||
static void reverse(const node_ptr &p)
|
static void reverse(const node_ptr &p)
|
||||||
{
|
{
|
||||||
node_ptr f(NodeTraits::get_next(p));
|
node_ptr f(NodeTraits::get_next(p));
|
||||||
node_ptr i(NodeTraits::get_next(f)), e(p);
|
node_ptr i(NodeTraits::get_next(f)), e(p);
|
||||||
|
|
||||||
while(i != e) {
|
while(i != e) {
|
||||||
node_ptr n = i;
|
node_ptr n = i;
|
||||||
i = NodeTraits::get_next(i);
|
i = NodeTraits::get_next(i);
|
||||||
@@ -364,9 +364,9 @@ class circular_list_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Effects</b>: Moves the node p n positions towards the end of the list.
|
//! <b>Effects</b>: Moves the node p n positions towards the end of the list.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of moved positions.
|
//! <b>Complexity</b>: Linear to the number of moved positions.
|
||||||
static void move_backwards(const node_ptr &p, std::size_t n)
|
static void move_backwards(const node_ptr &p, std::size_t n)
|
||||||
{
|
{
|
||||||
@@ -384,9 +384,9 @@ class circular_list_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Effects</b>: Moves the node p n positions towards the beginning of the list.
|
//! <b>Effects</b>: Moves the node p n positions towards the beginning of the list.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of moved positions.
|
//! <b>Complexity</b>: Linear to the number of moved positions.
|
||||||
static void move_forward(const node_ptr &p, std::size_t n)
|
static void move_forward(const node_ptr &p, std::size_t n)
|
||||||
{
|
{
|
||||||
@@ -405,8 +405,8 @@ class circular_list_algorithms
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ namespace intrusive {
|
|||||||
//! <b>Static functions</b>:
|
//! <b>Static functions</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_next(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_next(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_next(node_ptr n, node_ptr next);</tt>
|
//! <tt>static void set_next(node_ptr n, node_ptr next);</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class circular_slist_algorithms
|
class circular_slist_algorithms
|
||||||
@@ -64,37 +64,37 @@ class circular_slist_algorithms
|
|||||||
//! <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:
|
||||||
//! <tt>NodeTraits::get_next(this_node) == node_ptr()</tt>
|
//! <tt>NodeTraits::get_next(this_node) == node_ptr()</tt>
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void init(node_ptr this_node);
|
static void init(node_ptr this_node);
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true is "this_node" is the only node of a circular list:
|
//! <b>Effects</b>: Returns true is "this_node" is the only node of a circular list:
|
||||||
//! or it's a not inserted node:
|
//! or it's a not inserted node:
|
||||||
//! <tt>return node_ptr() == NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node</tt>
|
//! <tt>return node_ptr() == NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node</tt>
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool unique(const_node_ptr this_node);
|
static bool unique(const_node_ptr this_node);
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns true is "this_node" has the same state as
|
//! <b>Effects</b>: Returns true is "this_node" has the same state as
|
||||||
//! if it was inited using "init(node_ptr)"
|
//! if it was inited using "init(node_ptr)"
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool inited(const_node_ptr this_node);
|
static bool inited(const_node_ptr this_node);
|
||||||
|
|
||||||
//! <b>Requires</b>: prev_node must be in a circular list or be an empty circular list.
|
//! <b>Requires</b>: prev_node must be in a circular list or be an empty circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the next node of prev_node from the circular list.
|
//! <b>Effects</b>: Unlinks the next node of prev_node from the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void unlink_after(node_ptr prev_node);
|
static void unlink_after(node_ptr prev_node);
|
||||||
|
|
||||||
@@ -103,28 +103,28 @@ class circular_slist_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the range (prev_node, last_node) from the circular list.
|
//! <b>Effects</b>: Unlinks the range (prev_node, last_node) from the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void unlink_after(node_ptr prev_node, node_ptr last_node);
|
static void unlink_after(node_ptr prev_node, node_ptr last_node);
|
||||||
|
|
||||||
//! <b>Requires</b>: prev_node must be a node of a circular list.
|
//! <b>Requires</b>: prev_node must be a node of a circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Links this_node after prev_node in the circular list.
|
//! <b>Effects</b>: Links this_node after prev_node in the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void link_after(node_ptr prev_node, node_ptr this_node);
|
static void link_after(node_ptr prev_node, node_ptr this_node);
|
||||||
|
|
||||||
//! <b>Requires</b>: b and e must be nodes of the same circular list or an empty range.
|
//! <b>Requires</b>: b and e must be nodes of the same circular list or an empty range.
|
||||||
//! and p must be a node of a different circular list.
|
//! and p must be a node of a different circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Removes the nodes from (b, e] range from their circular list and inserts
|
//! <b>Effects</b>: Removes the nodes from (b, e] range from their circular list and inserts
|
||||||
//! them after p in p's circular list.
|
//! them after p in p's circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <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);
|
||||||
|
|
||||||
@@ -133,53 +133,53 @@ class circular_slist_algorithms
|
|||||||
//! <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:
|
||||||
//! <tt>NodeTraits::get_next(this_node) == this_node</tt>.
|
//! <tt>NodeTraits::get_next(this_node) == this_node</tt>.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void init_header(const node_ptr &this_node)
|
static void init_header(const node_ptr &this_node)
|
||||||
{ NodeTraits::set_next(this_node, this_node); }
|
{ NodeTraits::set_next(this_node, this_node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node and prev_init_node must be in the same circular list.
|
//! <b>Requires</b>: this_node and prev_init_node must be in the same circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the previous node of this_node in the circular list starting.
|
//! <b>Effects</b>: Returns the previous node of this_node in the circular list starting.
|
||||||
//! the search from prev_init_node. The first node checked for equality
|
//! the search from prev_init_node. The first node checked for equality
|
||||||
//! is NodeTraits::get_next(prev_init_node).
|
//! is NodeTraits::get_next(prev_init_node).
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of elements between prev_init_node and this_node.
|
//! <b>Complexity</b>: Linear to the number of elements between prev_init_node and this_node.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr get_previous_node(const node_ptr &prev_init_node, const node_ptr &this_node)
|
static node_ptr get_previous_node(const node_ptr &prev_init_node, const node_ptr &this_node)
|
||||||
{ return base_t::get_previous_node(prev_init_node, this_node); }
|
{ return base_t::get_previous_node(prev_init_node, this_node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the previous node of this_node in the circular list.
|
//! <b>Effects</b>: Returns the previous node of this_node in the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of elements in the circular list.
|
//! <b>Complexity</b>: Linear to the number of elements in the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr get_previous_node(const node_ptr & this_node)
|
static node_ptr get_previous_node(const node_ptr & this_node)
|
||||||
{ return base_t::get_previous_node(this_node, this_node); }
|
{ return base_t::get_previous_node(this_node, this_node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the previous node of the previous node of this_node in the circular list.
|
//! <b>Effects</b>: Returns the previous node of the previous node of this_node in the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of elements in the circular list.
|
//! <b>Complexity</b>: Linear to the number of elements in the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr get_previous_previous_node(const node_ptr & this_node)
|
static node_ptr get_previous_previous_node(const node_ptr & this_node)
|
||||||
{ return get_previous_previous_node(this_node, this_node); }
|
{ return get_previous_previous_node(this_node, this_node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node and prev_prev_init_node must be in the same circular list.
|
//! <b>Requires</b>: this_node and prev_prev_init_node must be in the same circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the previous node of the previous node of this_node in the
|
//! <b>Effects</b>: Returns the previous node of the previous node of this_node in the
|
||||||
//! circular list starting. the search from prev_init_node. The first node checked
|
//! circular list starting. the search from prev_init_node. The first node checked
|
||||||
//! for equality is NodeTraits::get_next((NodeTraits::get_next(prev_prev_init_node)).
|
//! for equality is NodeTraits::get_next((NodeTraits::get_next(prev_prev_init_node)).
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of elements in the circular list.
|
//! <b>Complexity</b>: Linear to the number of elements in the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr get_previous_previous_node(const node_ptr & prev_prev_init_node, const node_ptr & this_node)
|
static node_ptr get_previous_previous_node(const node_ptr & prev_prev_init_node, const node_ptr & this_node)
|
||||||
{
|
{
|
||||||
@@ -195,14 +195,14 @@ class circular_slist_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes in a circular list. If the circular list
|
//! <b>Effects</b>: Returns the number of nodes in a circular list. If the circular list
|
||||||
//! is empty, returns 1.
|
//! is empty, returns 1.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear
|
//! <b>Complexity</b>: Linear
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t count(const const_node_ptr & this_node)
|
static std::size_t count(const const_node_ptr & this_node)
|
||||||
{
|
{
|
||||||
std::size_t result = 0;
|
std::size_t result = 0;
|
||||||
const_node_ptr p = this_node;
|
const_node_ptr p = this_node;
|
||||||
@@ -214,11 +214,11 @@ class circular_slist_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node must be in a circular list, be an empty circular list or be inited.
|
//! <b>Requires</b>: this_node must be in a circular list, be an empty circular list or be inited.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the node from the circular list.
|
//! <b>Effects</b>: Unlinks the node from the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of elements in the circular list
|
//! <b>Complexity</b>: Linear to the number of elements in the circular list
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void unlink(const node_ptr & this_node)
|
static void unlink(const node_ptr & this_node)
|
||||||
{
|
{
|
||||||
@@ -227,24 +227,24 @@ class circular_slist_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: nxt_node must be a node of a circular list.
|
//! <b>Requires</b>: nxt_node must be a node of a circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Links this_node before nxt_node in the circular list.
|
//! <b>Effects</b>: Links this_node before nxt_node in the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of elements in the circular list.
|
//! <b>Complexity</b>: Linear to the number of elements in the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void link_before (const node_ptr & nxt_node, const node_ptr & this_node)
|
static void link_before (const node_ptr & nxt_node, const node_ptr & this_node)
|
||||||
{ base_t::link_after(get_previous_node(nxt_node), this_node); }
|
{ base_t::link_after(get_previous_node(nxt_node), this_node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node and other_node must be nodes inserted
|
//! <b>Requires</b>: this_node and other_node must be nodes inserted
|
||||||
//! in circular lists or be empty circular lists.
|
//! in circular lists or be empty circular lists.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps the position of the nodes: this_node is inserted in
|
//! <b>Effects</b>: Swaps the position of the nodes: this_node is inserted in
|
||||||
//! other_nodes position in the second circular list and the other_node is inserted
|
//! other_nodes position in the second circular list and the other_node is inserted
|
||||||
//! in this_node's position in the first circular list.
|
//! in this_node's position in the first circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to number of elements of both lists
|
//! <b>Complexity</b>: Linear to number of elements of both lists
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void swap_nodes(const node_ptr & this_node, const node_ptr & other_node)
|
static void swap_nodes(const node_ptr & this_node, const node_ptr & other_node)
|
||||||
{
|
{
|
||||||
@@ -279,14 +279,14 @@ class circular_slist_algorithms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Effects</b>: Reverses the order of elements in the list.
|
//! <b>Effects</b>: Reverses the order of elements in the list.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: This function is linear to the contained elements.
|
//! <b>Complexity</b>: This function is linear to the contained elements.
|
||||||
static void reverse(const node_ptr & p)
|
static void reverse(const node_ptr & p)
|
||||||
{
|
{
|
||||||
node_ptr i = NodeTraits::get_next(p), e(p);
|
node_ptr i = NodeTraits::get_next(p), e(p);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
node_ptr nxt(NodeTraits::get_next(i));
|
node_ptr nxt(NodeTraits::get_next(i));
|
||||||
if (nxt == e)
|
if (nxt == e)
|
||||||
@@ -301,7 +301,7 @@ class circular_slist_algorithms
|
|||||||
//! Null if n leads to no movement.
|
//! Null if n leads to no movement.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
|
//! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
|
||||||
static node_ptr move_backwards(const node_ptr & p, std::size_t n)
|
static node_ptr move_backwards(const node_ptr & p, std::size_t n)
|
||||||
{
|
{
|
||||||
@@ -348,12 +348,12 @@ class circular_slist_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Effects</b>: Moves the node p n positions towards the beginning of the list.
|
//! <b>Effects</b>: Moves the node p n positions towards the beginning of the list.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: The previous node of p after the function if there has been any movement,
|
//! <b>Returns</b>: The previous node of p after the function if there has been any movement,
|
||||||
//! Null if n leads equals to no movement.
|
//! Null if n leads equals to no movement.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
|
//! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
|
||||||
static node_ptr move_forward(const node_ptr & p, std::size_t n)
|
static node_ptr move_forward(const node_ptr & p, std::size_t n)
|
||||||
{
|
{
|
||||||
@@ -382,7 +382,7 @@ class circular_slist_algorithms
|
|||||||
std::size_t new_before_last_pos = (distance - (n % distance))% distance;
|
std::size_t new_before_last_pos = (distance - (n % distance))% distance;
|
||||||
//If the shift is a multiple of the size there is nothing to do
|
//If the shift is a multiple of the size there is nothing to do
|
||||||
if(!new_before_last_pos) return node_ptr();
|
if(!new_before_last_pos) return node_ptr();
|
||||||
|
|
||||||
for( new_last = p
|
for( new_last = p
|
||||||
; new_before_last_pos--
|
; new_before_last_pos--
|
||||||
; new_last = node_traits::get_next(new_last)){
|
; new_last = node_traits::get_next(new_last)){
|
||||||
@@ -397,8 +397,8 @@ class circular_slist_algorithms
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@ struct derivation_value_traits
|
|||||||
static const_node_ptr to_node_ptr(const_reference value)
|
static const_node_ptr to_node_ptr(const_reference value)
|
||||||
{ return node_ptr(&value); }
|
{ return node_ptr(&value); }
|
||||||
|
|
||||||
static pointer to_value_ptr(const node_ptr &n)
|
static pointer to_value_ptr(const node_ptr &n)
|
||||||
{
|
{
|
||||||
// This still fails in gcc < 4.4 so forget about it
|
// This still fails in gcc < 4.4 so forget about it
|
||||||
// using ::boost::static_pointer_cast;
|
// using ::boost::static_pointer_cast;
|
||||||
@@ -64,7 +64,7 @@ struct derivation_value_traits
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#endif //BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP
|
#endif //BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#include <boost/intrusive/detail/assert.hpp>
|
#include <boost/intrusive/detail/assert.hpp>
|
||||||
#include <boost/intrusive/pointer_traits.hpp>
|
#include <boost/intrusive/pointer_traits.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <boost/intrusive/detail/mpl.hpp>
|
#include <boost/intrusive/detail/mpl.hpp>
|
||||||
#include <boost/pointer_cast.hpp>
|
#include <boost/pointer_cast.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
@@ -100,10 +100,10 @@ struct any_unordered_node_traits
|
|||||||
{ n->node_ptr_2 = prev; }
|
{ n->node_ptr_2 = prev; }
|
||||||
|
|
||||||
static std::size_t get_hash(const const_node_ptr & n)
|
static std::size_t get_hash(const const_node_ptr & n)
|
||||||
{ return n->size_t_1; }
|
{ return n->size_t_1; }
|
||||||
|
|
||||||
static void set_hash(const node_ptr & n, std::size_t h)
|
static void set_hash(const node_ptr & n, std::size_t h)
|
||||||
{ n->size_t_1 = h; }
|
{ n->size_t_1 = h; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -255,9 +255,9 @@ class any_algorithms
|
|||||||
//! <b>Requires</b>: node must not be part of any tree.
|
//! <b>Requires</b>: node must not be part of any tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: After the function unique(node) == true.
|
//! <b>Effects</b>: After the function unique(node) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
@@ -265,9 +265,9 @@ class any_algorithms
|
|||||||
{ node->node_ptr_1 = 0; };
|
{ node->node_ptr_1 = 0; };
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns true if node is in the same state as if called init(node)
|
//! <b>Effects</b>: Returns true if node is in the same state as if called init(node)
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool inited(const const_node_ptr & node)
|
static bool inited(const const_node_ptr & node)
|
||||||
{ return !node->node_ptr_1; };
|
{ return !node->node_ptr_1; };
|
||||||
@@ -289,8 +289,8 @@ class any_algorithms
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef BOOST_INTRUSIVE_DETAIL_ASSERT_HPP
|
#ifndef BOOST_INTRUSIVE_DETAIL_ASSERT_HPP
|
||||||
#define BOOST_INTRUSIVE_DETAIL_ASSERT_HPP
|
#define BOOST_INTRUSIVE_DETAIL_ASSERT_HPP
|
||||||
|
|
||||||
#if defined(_MSC_VER)&&(_MSC_VER>=1200)
|
#if defined(_MSC_VER)&&(_MSC_VER>=1200)
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@@ -172,13 +172,13 @@ struct avltree_node_traits
|
|||||||
, OptimizeSize &&
|
, OptimizeSize &&
|
||||||
max_pointer_plus_bits
|
max_pointer_plus_bits
|
||||||
< VoidPointer
|
< VoidPointer
|
||||||
, detail::alignment_of<compact_avltree_node<VoidPointer> >::value
|
, detail::alignment_of<compact_avltree_node<VoidPointer> >::value
|
||||||
>::value >= 2u
|
>::value >= 2u
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -44,11 +44,11 @@ class common_slist_algorithms
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_header(const node_ptr & this_node)
|
static void init_header(const node_ptr & this_node)
|
||||||
{ NodeTraits::set_next(this_node, this_node); }
|
{ NodeTraits::set_next(this_node, this_node); }
|
||||||
|
|
||||||
static void init(const node_ptr & this_node)
|
static void init(const node_ptr & this_node)
|
||||||
{ NodeTraits::set_next(this_node, node_ptr()); }
|
{ NodeTraits::set_next(this_node, node_ptr()); }
|
||||||
|
|
||||||
static bool unique(const const_node_ptr & this_node)
|
static bool unique(const const_node_ptr & this_node)
|
||||||
{
|
{
|
||||||
@@ -56,7 +56,7 @@ class common_slist_algorithms
|
|||||||
return !next || next == this_node;
|
return !next || next == this_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool inited(const const_node_ptr & this_node)
|
static bool inited(const const_node_ptr & this_node)
|
||||||
{ return !NodeTraits::get_next(this_node); }
|
{ return !NodeTraits::get_next(this_node); }
|
||||||
|
|
||||||
static void unlink_after(const node_ptr & prev_node)
|
static void unlink_after(const node_ptr & prev_node)
|
||||||
@@ -80,7 +80,7 @@ class common_slist_algorithms
|
|||||||
NodeTraits::set_next(bp, b);
|
NodeTraits::set_next(bp, b);
|
||||||
NodeTraits::set_next(be, p);
|
NodeTraits::set_next(be, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void transfer_after(const node_ptr & bp, const node_ptr & bb, const node_ptr & be)
|
static void transfer_after(const node_ptr & bp, const node_ptr & bb, const node_ptr & be)
|
||||||
{
|
{
|
||||||
if (bp != bb && bp != be && bb != be) {
|
if (bp != bb && bp != be && bb != be) {
|
||||||
@@ -95,8 +95,8 @@ class common_slist_algorithms
|
|||||||
};
|
};
|
||||||
|
|
||||||
} //namespace detail
|
} //namespace detail
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -20,10 +20,10 @@
|
|||||||
#pragma warning (push)
|
#pragma warning (push)
|
||||||
//
|
//
|
||||||
//'function' : resolved overload was found by argument-dependent lookup
|
//'function' : resolved overload was found by argument-dependent lookup
|
||||||
//A function found by argument-dependent lookup (Koenig lookup) was eventually
|
//A function found by argument-dependent lookup (Koenig lookup) was eventually
|
||||||
//chosen by overload resolution.
|
//chosen by overload resolution.
|
||||||
//
|
//
|
||||||
//In Visual C++ .NET and earlier compilers, a different function would have
|
//In Visual C++ .NET and earlier compilers, a different function would have
|
||||||
//been called. To pick the original function, use an explicitly qualified name.
|
//been called. To pick the original function, use an explicitly qualified name.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Copyright 2007 Alexandre Courpron
|
// Copyright 2007 Alexandre Courpron
|
||||||
//
|
//
|
||||||
// Permission to use, copy, modify, redistribute and sell this software,
|
// Permission to use, copy, modify, redistribute and sell this software,
|
||||||
// provided that this copyright notice appears on all copies of the software.
|
// provided that this copyright notice appears on all copies of the software.
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ namespace function_detector {
|
|||||||
public : \
|
public : \
|
||||||
static const int check = NotFound + (sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
|
static const int check = NotFound + (sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
|
||||||
};\
|
};\
|
||||||
}}} //namespace boost::intrusive::function_detector {
|
}}} //namespace boost::intrusive::function_detector {
|
||||||
|
|
||||||
#define BOOST_INTRUSIVE_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
|
#define BOOST_INTRUSIVE_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
|
||||||
::boost::intrusive::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
|
::boost::intrusive::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
|
||||||
|
@@ -143,7 +143,7 @@ class generic_hook
|
|||||||
typedef Tag tag;
|
typedef Tag tag;
|
||||||
typedef typename GetNodeAlgorithms::type::node_traits node_traits;
|
typedef typename GetNodeAlgorithms::type::node_traits node_traits;
|
||||||
static const bool is_base_hook = !detail::is_same<Tag, member_tag>::value;
|
static const bool is_base_hook = !detail::is_same<Tag, member_tag>::value;
|
||||||
static const bool safemode_or_autounlink =
|
static const bool safemode_or_autounlink =
|
||||||
(int)link_mode == (int)auto_unlink || (int)link_mode == (int)safe_link;
|
(int)link_mode == (int)auto_unlink || (int)link_mode == (int)safe_link;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -163,14 +163,14 @@ class generic_hook
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generic_hook(const generic_hook& )
|
generic_hook(const generic_hook& )
|
||||||
{
|
{
|
||||||
if(boost_intrusive_tags::safemode_or_autounlink){
|
if(boost_intrusive_tags::safemode_or_autounlink){
|
||||||
node_algorithms::init(this->this_ptr());
|
node_algorithms::init(this->this_ptr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generic_hook& operator=(const generic_hook& )
|
generic_hook& operator=(const generic_hook& )
|
||||||
{ return *this; }
|
{ return *this; }
|
||||||
|
|
||||||
~generic_hook()
|
~generic_hook()
|
||||||
@@ -179,13 +179,13 @@ class generic_hook
|
|||||||
(*this, detail::link_dispatch<boost_intrusive_tags::link_mode>());
|
(*this, detail::link_dispatch<boost_intrusive_tags::link_mode>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap_nodes(generic_hook &other)
|
void swap_nodes(generic_hook &other)
|
||||||
{
|
{
|
||||||
node_algorithms::swap_nodes
|
node_algorithms::swap_nodes
|
||||||
(this->this_ptr(), other.this_ptr());
|
(this->this_ptr(), other.this_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_linked() const
|
bool is_linked() const
|
||||||
{
|
{
|
||||||
//is_linked() can be only used in safe-mode or auto-unlink
|
//is_linked() can be only used in safe-mode or auto-unlink
|
||||||
BOOST_STATIC_ASSERT(( boost_intrusive_tags::safemode_or_autounlink ));
|
BOOST_STATIC_ASSERT(( boost_intrusive_tags::safemode_or_autounlink ));
|
||||||
@@ -201,8 +201,8 @@ class generic_hook
|
|||||||
};
|
};
|
||||||
|
|
||||||
} //namespace detail
|
} //namespace detail
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/move.hpp>
|
||||||
|
|
||||||
//Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and
|
//Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and
|
||||||
//wrong SFINAE for GCC 4.2/4.3
|
//wrong SFINAE for GCC 4.2/4.3
|
||||||
#if defined(__GNUC__) && !defined(__clang__) && ((__GNUC__*100 + __GNUC_MINOR__*10) >= 340) && ((__GNUC__*100 + __GNUC_MINOR__*10) <= 430)
|
#if defined(__GNUC__) && !defined(__clang__) && ((__GNUC__*100 + __GNUC_MINOR__*10) >= 340) && ((__GNUC__*100 + __GNUC_MINOR__*10) <= 430)
|
||||||
#define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED
|
#define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
|
struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
|
||||||
<Fun, true BOOST_PP_ENUM_TRAILING(BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()), BOOST_INTRUSIVE_PP_IDENTITY, void)>
|
<Fun, true BOOST_PP_ENUM_TRAILING(BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()), BOOST_INTRUSIVE_PP_IDENTITY, void)>
|
||||||
{
|
{
|
||||||
//Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and
|
//Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and
|
||||||
//wrong SFINAE for GCC 4.2/4.3
|
//wrong SFINAE for GCC 4.2/4.3
|
||||||
static const bool value = true;
|
static const bool value = true;
|
||||||
};
|
};
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
|
|
||||||
//Special case for 0 args
|
//Special case for 0 args
|
||||||
template< class F
|
template< class F
|
||||||
, std::size_t N =
|
, std::size_t N =
|
||||||
sizeof((boost::move_detail::declval<F>().
|
sizeof((boost::move_detail::declval<F>().
|
||||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))>
|
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))>
|
||||||
struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
|
struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
|
||||||
@@ -156,9 +156,9 @@
|
|||||||
static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>
|
static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>
|
||||||
Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*);
|
Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*);
|
||||||
|
|
||||||
template <class U>
|
template <class U>
|
||||||
static boost_intrusive_has_member_function_callable_with::no_type Test(...);
|
static boost_intrusive_has_member_function_callable_with::no_type Test(...);
|
||||||
|
|
||||||
static const bool value = sizeof(Test< Fun >(0))
|
static const bool value = sizeof(Test< Fun >(0))
|
||||||
== sizeof(boost_intrusive_has_member_function_callable_with::yes_type);
|
== sizeof(boost_intrusive_has_member_function_callable_with::yes_type);
|
||||||
};
|
};
|
||||||
@@ -196,7 +196,7 @@
|
|||||||
|
|
||||||
//Special case for 0 args
|
//Special case for 0 args
|
||||||
template< class F
|
template< class F
|
||||||
, std::size_t N =
|
, std::size_t N =
|
||||||
sizeof((boost::move_detail::declval<F>().
|
sizeof((boost::move_detail::declval<F>().
|
||||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))>
|
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))>
|
||||||
struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
|
struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
|
||||||
@@ -222,9 +222,9 @@
|
|||||||
static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
|
static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
|
||||||
<U> Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*);
|
<U> Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*);
|
||||||
|
|
||||||
template <class U>
|
template <class U>
|
||||||
static boost_intrusive_has_member_function_callable_with::no_type Test(...);
|
static boost_intrusive_has_member_function_callable_with::no_type Test(...);
|
||||||
|
|
||||||
static const bool value = sizeof(Test< Fun >(0))
|
static const bool value = sizeof(Test< Fun >(0))
|
||||||
== sizeof(boost_intrusive_has_member_function_callable_with::yes_type);
|
== sizeof(boost_intrusive_has_member_function_callable_with::yes_type);
|
||||||
};
|
};
|
||||||
|
@@ -40,7 +40,7 @@ struct prime_list_holder
|
|||||||
|
|
||||||
template<int Dummy>
|
template<int Dummy>
|
||||||
const std::size_t prime_list_holder<Dummy>::prime_list[] = {
|
const std::size_t prime_list_holder<Dummy>::prime_list[] = {
|
||||||
3ul, 7ul, 11ul, 17ul, 29ul,
|
3ul, 7ul, 11ul, 17ul, 29ul,
|
||||||
53ul, 97ul, 193ul, 389ul, 769ul,
|
53ul, 97ul, 193ul, 389ul, 769ul,
|
||||||
1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
|
1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
|
||||||
49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
|
49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
|
||||||
@@ -180,9 +180,9 @@ class hashtable_iterator
|
|||||||
{ return hashtable_iterator<Container, false>(this->slist_it(), this->get_container()); }
|
{ return hashtable_iterator<Container, false>(this->slist_it(), this->get_container()); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
hashtable_iterator& operator++()
|
hashtable_iterator& operator++()
|
||||||
{ this->increment(); return *this; }
|
{ this->increment(); return *this; }
|
||||||
|
|
||||||
hashtable_iterator operator++(int)
|
hashtable_iterator operator++(int)
|
||||||
{
|
{
|
||||||
hashtable_iterator result (*this);
|
hashtable_iterator result (*this);
|
||||||
@@ -219,7 +219,7 @@ class hashtable_iterator
|
|||||||
size_type buckets_len = cont->bucket_count();
|
size_type buckets_len = cont->bucket_count();
|
||||||
|
|
||||||
++slist_it_;
|
++slist_it_;
|
||||||
if(buckets[0].cend().pointed_node() <= slist_it_.pointed_node() &&
|
if(buckets[0].cend().pointed_node() <= slist_it_.pointed_node() &&
|
||||||
slist_it_.pointed_node()<= buckets[buckets_len].cend().pointed_node() ){
|
slist_it_.pointed_node()<= buckets[buckets_len].cend().pointed_node() ){
|
||||||
//Now get the bucket_impl from the iterator
|
//Now get the bucket_impl from the iterator
|
||||||
const bucket_type &b = static_cast<const bucket_type&>
|
const bucket_type &b = static_cast<const bucket_type&>
|
||||||
|
@@ -57,7 +57,7 @@ struct list_node_traits
|
|||||||
{ n->next_ = next; }
|
{ n->next_ = next; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// list_iterator provides some basic functions for a
|
// list_iterator provides some basic functions for a
|
||||||
// node oriented bidirectional iterator:
|
// node oriented bidirectional iterator:
|
||||||
template<class Container, bool IsConst>
|
template<class Container, bool IsConst>
|
||||||
class list_iterator
|
class list_iterator
|
||||||
@@ -76,7 +76,7 @@ class list_iterator
|
|||||||
typedef typename node_traits::node_ptr node_ptr;
|
typedef typename node_traits::node_ptr node_ptr;
|
||||||
typedef typename pointer_traits<node_ptr>::
|
typedef typename pointer_traits<node_ptr>::
|
||||||
template rebind_pointer<void>::type void_pointer;
|
template rebind_pointer<void>::type void_pointer;
|
||||||
static const bool store_container_ptr =
|
static const bool store_container_ptr =
|
||||||
detail::store_cont_ptr_on_it<Container>::value;
|
detail::store_cont_ptr_on_it<Container>::value;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -103,14 +103,14 @@ class list_iterator
|
|||||||
{ members_.nodeptr_ = node; return static_cast<list_iterator&>(*this); }
|
{ members_.nodeptr_ = node; return static_cast<list_iterator&>(*this); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
list_iterator& operator++()
|
list_iterator& operator++()
|
||||||
{
|
{
|
||||||
node_ptr p = node_traits::get_next(members_.nodeptr_);
|
node_ptr p = node_traits::get_next(members_.nodeptr_);
|
||||||
members_.nodeptr_ = p;
|
members_.nodeptr_ = p;
|
||||||
//members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
|
//members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
|
||||||
return static_cast<list_iterator&> (*this);
|
return static_cast<list_iterator&> (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_iterator operator++(int)
|
list_iterator operator++(int)
|
||||||
{
|
{
|
||||||
list_iterator result (*this);
|
list_iterator result (*this);
|
||||||
@@ -118,12 +118,12 @@ class list_iterator
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_iterator& operator--()
|
list_iterator& operator--()
|
||||||
{
|
{
|
||||||
members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_);
|
members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_);
|
||||||
return static_cast<list_iterator&> (*this);
|
return static_cast<list_iterator&> (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_iterator operator--(int)
|
list_iterator operator--(int)
|
||||||
{
|
{
|
||||||
list_iterator result (*this);
|
list_iterator result (*this);
|
||||||
@@ -182,8 +182,8 @@ class list_iterator
|
|||||||
} members_;
|
} members_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -127,7 +127,7 @@ struct identity
|
|||||||
#if defined(BOOST_MSVC) || defined(__BORLANDC_)
|
#if defined(BOOST_MSVC) || defined(__BORLANDC_)
|
||||||
#define BOOST_INTRUSIVE_TT_DECL __cdecl
|
#define BOOST_INTRUSIVE_TT_DECL __cdecl
|
||||||
#else
|
#else
|
||||||
#define BOOST_INTRUSIVE_TT_DECL
|
#define BOOST_INTRUSIVE_TT_DECL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(UNDER_CE)
|
#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(UNDER_CE)
|
||||||
@@ -346,9 +346,9 @@ struct ls_zeros<1>
|
|||||||
static const std::size_t value = 0;
|
static const std::size_t value = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace detail
|
} //namespace detail
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#include <boost/intrusive/detail/config_begin.hpp>
|
#include <boost/intrusive/detail/config_begin.hpp>
|
||||||
#include <boost/intrusive/detail/workaround.hpp>
|
#include <boost/intrusive/detail/workaround.hpp>
|
||||||
|
|
||||||
#include <boost/preprocessor/iteration/local.hpp>
|
#include <boost/preprocessor/iteration/local.hpp>
|
||||||
#include <boost/preprocessor/punctuation/paren_if.hpp>
|
#include <boost/preprocessor/punctuation/paren_if.hpp>
|
||||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||||
#include <boost/preprocessor/control/expr_if.hpp>
|
#include <boost/preprocessor/control/expr_if.hpp>
|
||||||
|
@@ -164,13 +164,13 @@ struct rbtree_node_traits
|
|||||||
, OptimizeSize &&
|
, OptimizeSize &&
|
||||||
(max_pointer_plus_bits
|
(max_pointer_plus_bits
|
||||||
< VoidPointer
|
< VoidPointer
|
||||||
, detail::alignment_of<compact_rbtree_node<VoidPointer> >::value
|
, detail::alignment_of<compact_rbtree_node<VoidPointer> >::value
|
||||||
>::value >= 1)
|
>::value >= 1)
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -43,13 +43,13 @@ struct slist_node_traits
|
|||||||
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
||||||
|
|
||||||
static const node_ptr &get_next(const const_node_ptr & n)
|
static const node_ptr &get_next(const const_node_ptr & n)
|
||||||
{ return n->next_; }
|
{ return n->next_; }
|
||||||
|
|
||||||
static void set_next(const node_ptr & n, const node_ptr & next)
|
static void set_next(const node_ptr & n, const node_ptr & next)
|
||||||
{ n->next_ = next; }
|
{ n->next_ = next; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// slist_iterator provides some basic functions for a
|
// slist_iterator provides some basic functions for a
|
||||||
// node oriented bidirectional iterator:
|
// node oriented bidirectional iterator:
|
||||||
template<class Container, bool IsConst>
|
template<class Container, bool IsConst>
|
||||||
class slist_iterator
|
class slist_iterator
|
||||||
@@ -68,7 +68,7 @@ class slist_iterator
|
|||||||
typedef typename node_traits::node_ptr node_ptr;
|
typedef typename node_traits::node_ptr node_ptr;
|
||||||
typedef typename pointer_traits
|
typedef typename pointer_traits
|
||||||
<node_ptr>::template rebind_pointer <void>::type void_pointer;
|
<node_ptr>::template rebind_pointer <void>::type void_pointer;
|
||||||
static const bool store_container_ptr =
|
static const bool store_container_ptr =
|
||||||
detail::store_cont_ptr_on_it<Container>::value;
|
detail::store_cont_ptr_on_it<Container>::value;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -95,12 +95,12 @@ class slist_iterator
|
|||||||
{ members_.nodeptr_ = node; return static_cast<slist_iterator&>(*this); }
|
{ members_.nodeptr_ = node; return static_cast<slist_iterator&>(*this); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
slist_iterator& operator++()
|
slist_iterator& operator++()
|
||||||
{
|
{
|
||||||
members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
|
members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
|
||||||
return static_cast<slist_iterator&> (*this);
|
return static_cast<slist_iterator&> (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
slist_iterator operator++(int)
|
slist_iterator operator++(int)
|
||||||
{
|
{
|
||||||
slist_iterator result (*this);
|
slist_iterator result (*this);
|
||||||
@@ -155,8 +155,8 @@ class slist_iterator
|
|||||||
} members_;
|
} members_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ class transform_iterator
|
|||||||
{ return members_.m_it; }
|
{ return members_.m_it; }
|
||||||
|
|
||||||
//Constructors
|
//Constructors
|
||||||
transform_iterator& operator++()
|
transform_iterator& operator++()
|
||||||
{ increment(); return *this; }
|
{ increment(); return *this; }
|
||||||
|
|
||||||
transform_iterator operator++(int)
|
transform_iterator operator++(int)
|
||||||
|
@@ -25,20 +25,20 @@ namespace intrusive {
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
//! This is an implementation of a binary search tree.
|
//! This is an implementation of a binary search tree.
|
||||||
//! A node in the search tree has references to its children and its parent. This
|
//! A node in the search tree has references to its children and its parent. This
|
||||||
//! is to allow traversal of the whole tree from a given node making the
|
//! is to allow traversal of the whole tree from a given node making the
|
||||||
//! implementation of iterator a pointer to a node.
|
//! implementation of iterator a pointer to a node.
|
||||||
//! At the top of the tree a node is used specially. This node's parent pointer
|
//! At the top of the tree a node is used specially. This node's parent pointer
|
||||||
//! is pointing to the root of the tree. Its left pointer points to the
|
//! is pointing to the root of the tree. Its left pointer points to the
|
||||||
//! leftmost node in the tree and the right pointer to the rightmost one.
|
//! leftmost node in the tree and the right pointer to the rightmost one.
|
||||||
//! This node is used to represent the end-iterator.
|
//! This node is used to represent the end-iterator.
|
||||||
//!
|
//!
|
||||||
//! +---------+
|
//! +---------+
|
||||||
//! header------------------------------>| |
|
//! header------------------------------>| |
|
||||||
//! | |
|
//! | |
|
||||||
//! +----------(left)--------| |--------(right)---------+
|
//! +----------(left)--------| |--------(right)---------+
|
||||||
//! | +---------+ |
|
//! | +---------+ |
|
||||||
//! | | |
|
//! | | |
|
||||||
//! | | (parent) |
|
//! | | (parent) |
|
||||||
//! | | |
|
//! | | |
|
||||||
//! | | |
|
//! | | |
|
||||||
@@ -61,10 +61,10 @@ namespace detail {
|
|||||||
//! | | | | | |
|
//! | | | | | |
|
||||||
//! | | | | | |
|
//! | | | | | |
|
||||||
//! | +---+-----+ +-----+---+ +---+-----+ +-----+---+ |
|
//! | +---+-----+ +-----+---+ +---+-----+ +-----+---+ |
|
||||||
//! +-->| | | | | | | |<--+
|
//! +-->| | | | | | | |<--+
|
||||||
//! | A | | C | | E | | G |
|
//! | A | | C | | E | | G |
|
||||||
//! | | | | | | | |
|
//! | | | | | | | |
|
||||||
//! +---------+ +---------+ +---------+ +---------+
|
//! +---------+ +---------+ +---------+ +---------+
|
||||||
//!
|
//!
|
||||||
|
|
||||||
//! tree_algorithms is configured with a NodeTraits class, which encapsulates the
|
//! tree_algorithms is configured with a NodeTraits class, which encapsulates the
|
||||||
@@ -82,15 +82,15 @@ namespace detail {
|
|||||||
//! <b>Static functions</b>:
|
//! <b>Static functions</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class tree_algorithms
|
class tree_algorithms
|
||||||
@@ -153,11 +153,11 @@ class tree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: 'node' is a node of the tree or an node initialized
|
//! <b>Requires</b>: 'node' is a node of the tree or an node initialized
|
||||||
//! by init(...) or init_node.
|
//! by init(...) or init_node.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if the node is initialized by init() or init_node().
|
//! <b>Effects</b>: Returns true if the node is initialized by init() or init_node().
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool unique(const const_node_ptr & node)
|
static bool unique(const const_node_ptr & node)
|
||||||
{ return !NodeTraits::get_parent(node); }
|
{ return !NodeTraits::get_parent(node); }
|
||||||
@@ -175,15 +175,15 @@ class tree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -192,22 +192,22 @@ class tree_algorithms
|
|||||||
{
|
{
|
||||||
if(node1 == node2)
|
if(node1 == node2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node_ptr header1(get_header(node1)), header2(get_header(node2));
|
node_ptr header1(get_header(node1)), header2(get_header(node2));
|
||||||
swap_nodes(node1, header1, node2, header2);
|
swap_nodes(node1, header1, node2, header2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees with header header1 and header2.
|
//! of two trees with header header1 and header2.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -216,8 +216,8 @@ class tree_algorithms
|
|||||||
{
|
{
|
||||||
if(node1 == node2)
|
if(node1 == node2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//node1 and node2 must not be header nodes
|
//node1 and node2 must not be header nodes
|
||||||
//BOOST_INTRUSIVE_INVARIANT_ASSERT((header1 != node1 && header2 != node2));
|
//BOOST_INTRUSIVE_INVARIANT_ASSERT((header1 != node1 && header2 != node2));
|
||||||
if(header1 != header2){
|
if(header1 != header2){
|
||||||
//Update header1 if necessary
|
//Update header1 if necessary
|
||||||
@@ -347,14 +347,14 @@ class tree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! and new_node must not be inserted in a tree.
|
//! and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -370,14 +370,14 @@ class tree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! with header "header" and new_node must not be inserted in a tree.
|
//! with header "header" and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -388,7 +388,7 @@ class tree_algorithms
|
|||||||
{
|
{
|
||||||
if(node_to_be_replaced == new_node)
|
if(node_to_be_replaced == new_node)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Update header if necessary
|
//Update header if necessary
|
||||||
if(node_to_be_replaced == NodeTraits::get_left(header)){
|
if(node_to_be_replaced == NodeTraits::get_left(header)){
|
||||||
NodeTraits::set_left(header, new_node);
|
NodeTraits::set_left(header, new_node);
|
||||||
@@ -428,11 +428,11 @@ class tree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: 'node' is a node from the tree except the header.
|
//! <b>Requires</b>: 'node' is a node from the tree except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the next node of the tree.
|
//! <b>Effects</b>: Returns the next node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr next_node(const node_ptr & node)
|
static node_ptr next_node(const node_ptr & node)
|
||||||
{
|
{
|
||||||
@@ -452,11 +452,11 @@ class tree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: 'node' is a node from the tree except the leftmost node.
|
//! <b>Requires</b>: 'node' is a node from the tree except the leftmost node.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the previous node of the tree.
|
//! <b>Effects</b>: Returns the previous node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr prev_node(const node_ptr & node)
|
static node_ptr prev_node(const node_ptr & node)
|
||||||
{
|
{
|
||||||
@@ -479,11 +479,11 @@ class tree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: 'node' is a node of a tree but not the header.
|
//! <b>Requires</b>: 'node' is a node of a tree but not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the minimum node of the subtree starting at p.
|
//! <b>Effects</b>: Returns the minimum node of the subtree starting at p.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic to the size of the subtree.
|
//! <b>Complexity</b>: Logarithmic to the size of the subtree.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr minimum (const node_ptr & node)
|
static node_ptr minimum (const node_ptr & node)
|
||||||
{
|
{
|
||||||
@@ -497,11 +497,11 @@ class tree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: 'node' is a node of a tree but not the header.
|
//! <b>Requires</b>: 'node' is a node of a tree but not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the maximum node of the subtree starting at p.
|
//! <b>Effects</b>: Returns the maximum node of the subtree starting at p.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic to the size of the subtree.
|
//! <b>Complexity</b>: Logarithmic to the size of the subtree.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr maximum(const node_ptr & node)
|
static node_ptr maximum(const node_ptr & node)
|
||||||
{
|
{
|
||||||
@@ -517,9 +517,9 @@ class tree_algorithms
|
|||||||
//! <b>Requires</b>: 'node' must not be part of any tree.
|
//! <b>Requires</b>: 'node' must not be part of any tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: After the function unique(node) == true.
|
//! <b>Effects</b>: After the function unique(node) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
@@ -527,17 +527,17 @@ class tree_algorithms
|
|||||||
{
|
{
|
||||||
NodeTraits::set_parent(node, node_ptr());
|
NodeTraits::set_parent(node, node_ptr());
|
||||||
NodeTraits::set_left(node, node_ptr());
|
NodeTraits::set_left(node, node_ptr());
|
||||||
NodeTraits::set_right(node, node_ptr());
|
NodeTraits::set_right(node, node_ptr());
|
||||||
};
|
};
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns true if node is in the same state as if called init(node)
|
//! <b>Effects</b>: Returns true if node is in the same state as if called init(node)
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool inited(const const_node_ptr & node)
|
static bool inited(const const_node_ptr & node)
|
||||||
{
|
{
|
||||||
return !NodeTraits::get_parent(node) &&
|
return !NodeTraits::get_parent(node) &&
|
||||||
!NodeTraits::get_left(node) &&
|
!NodeTraits::get_left(node) &&
|
||||||
!NodeTraits::get_right(node) ;
|
!NodeTraits::get_right(node) ;
|
||||||
};
|
};
|
||||||
@@ -546,9 +546,9 @@ class tree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
||||||
//! unique(header) == true.
|
//! unique(header) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
@@ -556,19 +556,19 @@ class tree_algorithms
|
|||||||
{
|
{
|
||||||
NodeTraits::set_parent(header, node_ptr());
|
NodeTraits::set_parent(header, node_ptr());
|
||||||
NodeTraits::set_left(header, header);
|
NodeTraits::set_left(header, header);
|
||||||
NodeTraits::set_right(header, header);
|
NodeTraits::set_right(header, header);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "disposer" must be an object function
|
//! <b>Requires</b>: "disposer" must be an object function
|
||||||
//! taking a node_ptr parameter and shouldn't throw.
|
//! taking a node_ptr parameter and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Empties the target tree calling
|
//! <b>Effects</b>: Empties the target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template<class Disposer>
|
template<class Disposer>
|
||||||
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
||||||
@@ -581,14 +581,14 @@ class tree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header of a tree.
|
//! <b>Requires</b>: header is the header of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
||||||
//! updates the header link to the new leftmost node.
|
//! updates the header link to the new leftmost node.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
//! <b>Complexity</b>: Average complexity is constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function breaks the tree and the tree can
|
//! <b>Notes</b>: This function breaks the tree and the tree can
|
||||||
//! only be used for more unlink_leftmost_without_rebalance calls.
|
//! only be used for more unlink_leftmost_without_rebalance calls.
|
||||||
//! This function is normally used to achieve a step by step
|
//! This function is normally used to achieve a step by step
|
||||||
@@ -624,11 +624,11 @@ class tree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t count(const const_node_ptr & subtree)
|
static std::size_t count(const const_node_ptr & subtree)
|
||||||
{
|
{
|
||||||
@@ -660,11 +660,11 @@ class tree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t size(const const_node_ptr & header)
|
static std::size_t size(const const_node_ptr & header)
|
||||||
{
|
{
|
||||||
@@ -677,18 +677,18 @@ class tree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
||||||
//! links to the second tree and header2 will have links to the first tree.
|
//! links to the second tree and header2 will have links to the first tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
||||||
{
|
{
|
||||||
if(header1 == header2)
|
if(header1 == header2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node_ptr tmp;
|
node_ptr tmp;
|
||||||
|
|
||||||
//Parent swap
|
//Parent swap
|
||||||
@@ -734,7 +734,7 @@ class tree_algorithms
|
|||||||
(NodeTraits::get_parent(p_left) != p ||
|
(NodeTraits::get_parent(p_left) != p ||
|
||||||
NodeTraits::get_parent(p_right) != p ))
|
NodeTraits::get_parent(p_right) != p ))
|
||||||
//When tree size > 1 headers can't be leftmost's
|
//When tree size > 1 headers can't be leftmost's
|
||||||
//and rightmost's parent
|
//and rightmost's parent
|
||||||
)){
|
)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -750,7 +750,7 @@ class tree_algorithms
|
|||||||
//! "key" according to "comp" or "header" if that element does not exist.
|
//! "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr find
|
static node_ptr find
|
||||||
@@ -772,7 +772,7 @@ class tree_algorithms
|
|||||||
//! if they there are no equivalent elements.
|
//! if they there are no equivalent elements.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> equal_range
|
static std::pair<node_ptr, node_ptr> equal_range
|
||||||
@@ -829,7 +829,7 @@ class tree_algorithms
|
|||||||
//! not exist.
|
//! not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr lower_bound
|
static node_ptr lower_bound
|
||||||
@@ -858,7 +858,7 @@ class tree_algorithms
|
|||||||
//! than "key" according to "comp" or "header" if that element does not exist.
|
//! than "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr upper_bound
|
static node_ptr upper_bound
|
||||||
@@ -882,16 +882,16 @@ class tree_algorithms
|
|||||||
//! "commit_data" must have been obtained from a previous call to
|
//! "commit_data" must have been obtained from a previous call to
|
||||||
//! "insert_unique_check". No objects should have been inserted or erased
|
//! "insert_unique_check". No objects should have been inserted or erased
|
||||||
//! from the set between the "insert_unique_check" that filled "commit_data"
|
//! from the set between the "insert_unique_check" that filled "commit_data"
|
||||||
//! and the call to "insert_commit".
|
//! and the call to "insert_commit".
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
||||||
//! from the "commit_data" that a previous "insert_check" filled.
|
//! from the "commit_data" that a previous "insert_check" filled.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
||||||
//! previously executed to fill "commit_data". No value should be inserted or
|
//! previously executed to fill "commit_data". No value should be inserted or
|
||||||
//! erased between the "insert_check" and "insert_commit" calls.
|
//! erased between the "insert_check" and "insert_commit" calls.
|
||||||
@@ -929,7 +929,7 @@ class tree_algorithms
|
|||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
//! KeyNodePtrCompare is a function object that induces a strict weak
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
||||||
//! tree according to "comp" and obtains the needed information to realize
|
//! tree according to "comp" and obtains the needed information to realize
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
//! a constant-time node insertion if there is no equivalent node.
|
||||||
@@ -940,11 +940,11 @@ class tree_algorithms
|
|||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
//! be used with the "insert_commit" function to achieve a constant-time
|
||||||
//! insertion function.
|
//! insertion function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
//! a node is expensive and the user does not want to have two equivalent nodes
|
||||||
//! in the tree: if there is an equivalent value
|
//! in the tree: if there is an equivalent value
|
||||||
@@ -976,7 +976,7 @@ class tree_algorithms
|
|||||||
while(x){
|
while(x){
|
||||||
++depth;
|
++depth;
|
||||||
y = x;
|
y = x;
|
||||||
x = (left_child = comp(key, x)) ?
|
x = (left_child = comp(key, x)) ?
|
||||||
NodeTraits::get_left(x) : (prev = y, NodeTraits::get_right(x));
|
NodeTraits::get_left(x) : (prev = y, NodeTraits::get_right(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1026,7 +1026,7 @@ class tree_algorithms
|
|||||||
{
|
{
|
||||||
if(hint == header || !comp(hint, new_node)){
|
if(hint == header || !comp(hint, new_node)){
|
||||||
node_ptr prev(hint);
|
node_ptr prev(hint);
|
||||||
if(hint == NodeTraits::get_left(header) ||
|
if(hint == NodeTraits::get_left(header) ||
|
||||||
!comp(new_node, (prev = prev_node(hint)))){
|
!comp(new_node, (prev = prev_node(hint)))){
|
||||||
bool link_left = unique(header) || !NodeTraits::get_left(hint);
|
bool link_left = unique(header) || !NodeTraits::get_left(hint);
|
||||||
commit_data.link_left = link_left;
|
commit_data.link_left = link_left;
|
||||||
@@ -1147,13 +1147,13 @@ class tree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: 'node' can't be a header node.
|
//! <b>Requires</b>: 'node' can't be a header node.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Calculates the depth of a node: the depth of a
|
//! <b>Effects</b>: Calculates the depth of a node: the depth of a
|
||||||
//! node is the length (number of edges) of the path from the root
|
//! node is the length (number of edges) of the path from the root
|
||||||
//! to that node. (The root node is at depth 0.)
|
//! to that node. (The root node is at depth 0.)
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic to the number of nodes in the tree.
|
//! <b>Complexity</b>: Logarithmic to the number of nodes in the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t depth(const const_node_ptr & node)
|
static std::size_t depth(const const_node_ptr & node)
|
||||||
{
|
{
|
||||||
@@ -1171,18 +1171,18 @@ class tree_algorithms
|
|||||||
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
||||||
//! take a node_ptr and shouldn't throw.
|
//! take a node_ptr and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: First empties target tree calling
|
//! <b>Effects</b>: First empties target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
||||||
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
||||||
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
||||||
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template <class Cloner, class Disposer>
|
template <class Cloner, class Disposer>
|
||||||
static void clone
|
static void clone
|
||||||
@@ -1247,7 +1247,7 @@ class tree_algorithms
|
|||||||
leftmost = insertion_point;
|
leftmost = insertion_point;
|
||||||
}
|
}
|
||||||
//Then clone right nodes
|
//Then clone right nodes
|
||||||
else if( NodeTraits::get_right(current) &&
|
else if( NodeTraits::get_right(current) &&
|
||||||
!NodeTraits::get_right(insertion_point)){
|
!NodeTraits::get_right(insertion_point)){
|
||||||
current = NodeTraits::get_right(current);
|
current = NodeTraits::get_right(current);
|
||||||
node_ptr temp = insertion_point;
|
node_ptr temp = insertion_point;
|
||||||
@@ -1300,21 +1300,21 @@ class tree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node of a tree.
|
//! <b>Requires</b>: p is a node of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if p is a left child.
|
//! <b>Effects</b>: Returns true if p is a left child.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool is_left_child(const node_ptr & p)
|
static bool is_left_child(const node_ptr & p)
|
||||||
{ return NodeTraits::get_left(NodeTraits::get_parent(p)) == p; }
|
{ return NodeTraits::get_left(NodeTraits::get_parent(p)) == p; }
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node of a tree.
|
//! <b>Requires</b>: p is a node of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if p is a right child.
|
//! <b>Effects</b>: Returns true if p is a right child.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool is_right_child(const node_ptr & p)
|
static bool is_right_child(const node_ptr & p)
|
||||||
{ return NodeTraits::get_right(NodeTraits::get_parent(p)) == p; }
|
{ return NodeTraits::get_right(NodeTraits::get_parent(p)) == p; }
|
||||||
@@ -1449,7 +1449,7 @@ class tree_algorithms
|
|||||||
if(!old_root) return node_ptr();
|
if(!old_root) return node_ptr();
|
||||||
|
|
||||||
//To avoid irregularities in the algorithm (old_root can be a
|
//To avoid irregularities in the algorithm (old_root can be a
|
||||||
//left or right child or even the root of the tree) just put the
|
//left or right child or even the root of the tree) just put the
|
||||||
//root as the right child of its parent. Before doing this backup
|
//root as the right child of its parent. Before doing this backup
|
||||||
//information to restore the original relationship after
|
//information to restore the original relationship after
|
||||||
//the algorithm is applied.
|
//the algorithm is applied.
|
||||||
@@ -1521,7 +1521,7 @@ class tree_algorithms
|
|||||||
if(!old_root) return old_root;
|
if(!old_root) return old_root;
|
||||||
|
|
||||||
//To avoid irregularities in the algorithm (old_root can be
|
//To avoid irregularities in the algorithm (old_root can be
|
||||||
//left or right child or even the root of the tree) just put the
|
//left or right child or even the root of the tree) just put the
|
||||||
//root as the right child of its parent. First obtain
|
//root as the right child of its parent. First obtain
|
||||||
//information to restore the original relationship after
|
//information to restore the original relationship after
|
||||||
//the algorithm is applied.
|
//the algorithm is applied.
|
||||||
@@ -1536,7 +1536,7 @@ class tree_algorithms
|
|||||||
//Put old_root as right child
|
//Put old_root as right child
|
||||||
NodeTraits::set_right(super_root, old_root);
|
NodeTraits::set_right(super_root, old_root);
|
||||||
|
|
||||||
//Start the compression algorithm
|
//Start the compression algorithm
|
||||||
node_ptr even_parent = super_root;
|
node_ptr even_parent = super_root;
|
||||||
node_ptr new_root = old_root;
|
node_ptr new_root = old_root;
|
||||||
|
|
||||||
@@ -1578,7 +1578,7 @@ class tree_algorithms
|
|||||||
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr get_root(const node_ptr & node)
|
static node_ptr get_root(const node_ptr & node)
|
||||||
{
|
{
|
||||||
@@ -1609,7 +1609,7 @@ class tree_algorithms
|
|||||||
while(x){
|
while(x){
|
||||||
++depth;
|
++depth;
|
||||||
y = x;
|
y = x;
|
||||||
x = comp(new_node, x) ?
|
x = comp(new_node, x) ?
|
||||||
NodeTraits::get_left(x) : NodeTraits::get_right(x);
|
NodeTraits::get_left(x) : NodeTraits::get_right(x);
|
||||||
}
|
}
|
||||||
link_left = (y == h) || comp(new_node, y);
|
link_left = (y == h) || comp(new_node, y);
|
||||||
@@ -1618,7 +1618,7 @@ class tree_algorithms
|
|||||||
while(x){
|
while(x){
|
||||||
++depth;
|
++depth;
|
||||||
y = x;
|
y = x;
|
||||||
x = !comp(x, new_node) ?
|
x = !comp(x, new_node) ?
|
||||||
NodeTraits::get_left(x) : NodeTraits::get_right(x);
|
NodeTraits::get_left(x) : NodeTraits::get_right(x);
|
||||||
}
|
}
|
||||||
link_left = (y == h) || !comp(y, new_node);
|
link_left = (y == h) || !comp(y, new_node);
|
||||||
@@ -1689,8 +1689,8 @@ class tree_algorithms
|
|||||||
};
|
};
|
||||||
|
|
||||||
} //namespace detail {
|
} //namespace detail {
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@ struct tree_node_traits
|
|||||||
// //
|
// //
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// tree_iterator provides some basic functions for a
|
// tree_iterator provides some basic functions for a
|
||||||
// node oriented bidirectional iterator:
|
// node oriented bidirectional iterator:
|
||||||
template<class Container, bool IsConst>
|
template<class Container, bool IsConst>
|
||||||
class tree_iterator
|
class tree_iterator
|
||||||
@@ -86,7 +86,7 @@ class tree_iterator
|
|||||||
typedef typename node_traits::node_ptr node_ptr;
|
typedef typename node_traits::node_ptr node_ptr;
|
||||||
typedef typename pointer_traits<node_ptr>::template
|
typedef typename pointer_traits<node_ptr>::template
|
||||||
rebind_pointer<void>::type void_pointer;
|
rebind_pointer<void>::type void_pointer;
|
||||||
static const bool store_container_ptr =
|
static const bool store_container_ptr =
|
||||||
detail::store_cont_ptr_on_it<Container>::value;
|
detail::store_cont_ptr_on_it<Container>::value;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -114,12 +114,12 @@ class tree_iterator
|
|||||||
{ members_.nodeptr_ = nodeptr; return static_cast<tree_iterator&>(*this); }
|
{ members_.nodeptr_ = nodeptr; return static_cast<tree_iterator&>(*this); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
tree_iterator& operator++()
|
tree_iterator& operator++()
|
||||||
{
|
{
|
||||||
members_.nodeptr_ = node_algorithms::next_node(members_.nodeptr_);
|
members_.nodeptr_ = node_algorithms::next_node(members_.nodeptr_);
|
||||||
return static_cast<tree_iterator&> (*this);
|
return static_cast<tree_iterator&> (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
tree_iterator operator++(int)
|
tree_iterator operator++(int)
|
||||||
{
|
{
|
||||||
tree_iterator result (*this);
|
tree_iterator result (*this);
|
||||||
@@ -127,12 +127,12 @@ class tree_iterator
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
tree_iterator& operator--()
|
tree_iterator& operator--()
|
||||||
{
|
{
|
||||||
members_.nodeptr_ = node_algorithms::prev_node(members_.nodeptr_);
|
members_.nodeptr_ = node_algorithms::prev_node(members_.nodeptr_);
|
||||||
return static_cast<tree_iterator&> (*this);
|
return static_cast<tree_iterator&> (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
tree_iterator operator--(int)
|
tree_iterator operator--(int)
|
||||||
{
|
{
|
||||||
tree_iterator result (*this);
|
tree_iterator result (*this);
|
||||||
@@ -182,8 +182,8 @@ class tree_iterator
|
|||||||
} members_;
|
} members_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -200,7 +200,7 @@ struct key_nodeptr_comp
|
|||||||
key_nodeptr_comp(KeyValueCompare kcomp, const Container *cont)
|
key_nodeptr_comp(KeyValueCompare kcomp, const Container *cont)
|
||||||
: base_t(kcomp), cont_(cont)
|
: base_t(kcomp), cont_(cont)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct is_node_ptr
|
struct is_node_ptr
|
||||||
{
|
{
|
||||||
@@ -236,7 +236,7 @@ struct node_cloner
|
|||||||
typedef typename real_value_traits::node_ptr node_ptr;
|
typedef typename real_value_traits::node_ptr node_ptr;
|
||||||
typedef typename real_value_traits::const_node_ptr const_node_ptr;
|
typedef typename real_value_traits::const_node_ptr const_node_ptr;
|
||||||
typedef detail::ebo_functor_holder<F> base_t;
|
typedef detail::ebo_functor_holder<F> base_t;
|
||||||
enum { safemode_or_autounlink =
|
enum { safemode_or_autounlink =
|
||||||
(int)real_value_traits::link_mode == (int)auto_unlink ||
|
(int)real_value_traits::link_mode == (int)auto_unlink ||
|
||||||
(int)real_value_traits::link_mode == (int)safe_link };
|
(int)real_value_traits::link_mode == (int)safe_link };
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ struct node_disposer
|
|||||||
typedef typename real_value_traits::node_ptr node_ptr;
|
typedef typename real_value_traits::node_ptr node_ptr;
|
||||||
typedef detail::ebo_functor_holder<F> base_t;
|
typedef detail::ebo_functor_holder<F> base_t;
|
||||||
typedef typename Container::node_algorithms node_algorithms;
|
typedef typename Container::node_algorithms node_algorithms;
|
||||||
enum { safemode_or_autounlink =
|
enum { safemode_or_autounlink =
|
||||||
(int)real_value_traits::link_mode == (int)auto_unlink ||
|
(int)real_value_traits::link_mode == (int)auto_unlink ||
|
||||||
(int)real_value_traits::link_mode == (int)safe_link };
|
(int)real_value_traits::link_mode == (int)safe_link };
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ struct base_hook_traits
|
|||||||
|
|
||||||
static const link_mode_type link_mode = LinkMode;
|
static const link_mode_type link_mode = LinkMode;
|
||||||
|
|
||||||
static pointer to_value_ptr(const node_ptr & n)
|
static pointer to_value_ptr(const node_ptr & n)
|
||||||
{
|
{
|
||||||
return pointer_traits<pointer>::pointer_to
|
return pointer_traits<pointer>::pointer_to
|
||||||
(static_cast<reference>(static_cast<node_holder_reference>(*n)));
|
(static_cast<reference>(static_cast<node_holder_reference>(*n)));
|
||||||
@@ -504,7 +504,7 @@ inline std::size_t floor_log2 (std::size_t x)
|
|||||||
|
|
||||||
std::size_t n = x;
|
std::size_t n = x;
|
||||||
std::size_t log2 = 0;
|
std::size_t log2 = 0;
|
||||||
|
|
||||||
for(std::size_t shift = Bits >> 1; shift; shift >>= 1){
|
for(std::size_t shift = Bits >> 1; shift; shift >>= 1){
|
||||||
std::size_t tmp = n >> shift;
|
std::size_t tmp = n >> shift;
|
||||||
if (tmp)
|
if (tmp)
|
||||||
@@ -655,7 +655,7 @@ struct node_to_value
|
|||||||
, detail::store_cont_ptr_on_it<Container>::value
|
, detail::store_cont_ptr_on_it<Container>::value
|
||||||
>::type
|
>::type
|
||||||
{
|
{
|
||||||
static const bool store_container_ptr =
|
static const bool store_container_ptr =
|
||||||
detail::store_cont_ptr_on_it<Container>::value;
|
detail::store_cont_ptr_on_it<Container>::value;
|
||||||
|
|
||||||
typedef typename Container::real_value_traits real_value_traits;
|
typedef typename Container::real_value_traits real_value_traits;
|
||||||
@@ -871,8 +871,8 @@ class reverse_iterator
|
|||||||
};
|
};
|
||||||
|
|
||||||
} //namespace detail
|
} //namespace detail
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,7 @@ namespace intrusive {
|
|||||||
//! <b>Static functions</b>:
|
//! <b>Static functions</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_next(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_next(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_next(node_ptr n, node_ptr next);</tt>
|
//! <tt>static void set_next(node_ptr n, node_ptr next);</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class linear_slist_algorithms
|
class linear_slist_algorithms
|
||||||
@@ -63,37 +63,37 @@ class linear_slist_algorithms
|
|||||||
//! <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:
|
||||||
//! <tt>NodeTraits::get_next(this_node) == node_ptr()</tt>
|
//! <tt>NodeTraits::get_next(this_node) == node_ptr()</tt>
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void init(const node_ptr & this_node);
|
static void init(const node_ptr & this_node);
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
//! <b>Requires</b>: this_node must be in a circular list or be an empty circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true is "this_node" is the only node of a circular list:
|
//! <b>Effects</b>: Returns true is "this_node" is the only node of a circular list:
|
||||||
//! or it's a not inserted node:
|
//! or it's a not inserted node:
|
||||||
//! <tt>return node_ptr() == NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node</tt>
|
//! <tt>return node_ptr() == NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node</tt>
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool unique(const_node_ptr this_node);
|
static bool unique(const_node_ptr this_node);
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns true is "this_node" has the same state as if
|
//! <b>Effects</b>: Returns true is "this_node" has the same state as if
|
||||||
//! it was inited using "init(node_ptr)"
|
//! it was inited using "init(node_ptr)"
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool inited(const_node_ptr this_node);
|
static bool inited(const_node_ptr this_node);
|
||||||
|
|
||||||
//! <b>Requires</b>: prev_node must be in a circular list or be an empty circular list.
|
//! <b>Requires</b>: prev_node must be in a circular list or be an empty circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the next node of prev_node from the circular list.
|
//! <b>Effects</b>: Unlinks the next node of prev_node from the circular list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void unlink_after(const node_ptr & prev_node);
|
static void unlink_after(const node_ptr & prev_node);
|
||||||
|
|
||||||
@@ -102,28 +102,28 @@ class linear_slist_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the range (prev_node, last_node) from the linear list.
|
//! <b>Effects</b>: Unlinks the range (prev_node, last_node) from the linear list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void unlink_after(const node_ptr & prev_node, const node_ptr & last_node);
|
static void unlink_after(const node_ptr & prev_node, const node_ptr & last_node);
|
||||||
|
|
||||||
//! <b>Requires</b>: prev_node must be a node of a linear list.
|
//! <b>Requires</b>: prev_node must be a node of a linear list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Links this_node after prev_node in the linear list.
|
//! <b>Effects</b>: Links this_node after prev_node in the linear list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void link_after(const node_ptr & prev_node, const node_ptr & this_node);
|
static void link_after(const node_ptr & prev_node, const node_ptr & this_node);
|
||||||
|
|
||||||
//! <b>Requires</b>: b and e must be nodes of the same linear list or an empty range.
|
//! <b>Requires</b>: b and e must be nodes of the same linear list or an empty range.
|
||||||
//! and p must be a node of a different linear list.
|
//! and p must be a node of a different linear list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Removes the nodes from (b, e] range from their linear list and inserts
|
//! <b>Effects</b>: Removes the nodes from (b, e] range from their linear list and inserts
|
||||||
//! them after p in p's linear list.
|
//! them after p in p's linear list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void transfer_after(const node_ptr & p, const node_ptr & b, const node_ptr & e);
|
static void transfer_after(const node_ptr & p, const node_ptr & b, const node_ptr & e);
|
||||||
|
|
||||||
@@ -132,34 +132,34 @@ class linear_slist_algorithms
|
|||||||
//! <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:
|
||||||
//! <tt>NodeTraits::get_next(this_node) == this_node</tt>.
|
//! <tt>NodeTraits::get_next(this_node) == this_node</tt>.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void init_header(const node_ptr & this_node)
|
static void init_header(const node_ptr & this_node)
|
||||||
{ NodeTraits::set_next(this_node, node_ptr ()); }
|
{ NodeTraits::set_next(this_node, node_ptr ()); }
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node and prev_init_node must be in the same linear list.
|
//! <b>Requires</b>: this_node and prev_init_node must be in the same linear list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the previous node of this_node in the linear list starting.
|
//! <b>Effects</b>: Returns the previous node of this_node in the linear list starting.
|
||||||
//! the search from prev_init_node. The first node checked for equality
|
//! the search from prev_init_node. The first node checked for equality
|
||||||
//! is NodeTraits::get_next(prev_init_node).
|
//! is NodeTraits::get_next(prev_init_node).
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of elements between prev_init_node and this_node.
|
//! <b>Complexity</b>: Linear to the number of elements between prev_init_node and this_node.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr get_previous_node(const node_ptr & prev_init_node, const node_ptr & this_node)
|
static node_ptr get_previous_node(const node_ptr & prev_init_node, const node_ptr & this_node)
|
||||||
{ return base_t::get_previous_node(prev_init_node, this_node); }
|
{ return base_t::get_previous_node(prev_init_node, this_node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: this_node must be in a linear list or be an empty linear list.
|
//! <b>Requires</b>: this_node must be in a linear list or be an empty linear list.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes in a linear list. If the linear list
|
//! <b>Effects</b>: Returns the number of nodes in a linear list. If the linear list
|
||||||
//! is empty, returns 1.
|
//! is empty, returns 1.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear
|
//! <b>Complexity</b>: Linear
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t count(const const_node_ptr & this_node)
|
static std::size_t count(const const_node_ptr & this_node)
|
||||||
{
|
{
|
||||||
std::size_t result = 0;
|
std::size_t result = 0;
|
||||||
const_node_ptr p = this_node;
|
const_node_ptr p = this_node;
|
||||||
@@ -172,12 +172,12 @@ class linear_slist_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: this_node and other_node must be nodes inserted
|
//! <b>Requires</b>: this_node and other_node must be nodes inserted
|
||||||
//! in linear lists or be empty linear lists.
|
//! in linear lists or be empty linear lists.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Moves all the nodes previously chained after this_node after other_node
|
//! <b>Effects</b>: Moves all the nodes previously chained after this_node after other_node
|
||||||
//! and vice-versa.
|
//! and vice-versa.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void swap_trailing_nodes(const node_ptr & this_node, const node_ptr & other_node)
|
static void swap_trailing_nodes(const node_ptr & this_node, const node_ptr & other_node)
|
||||||
{
|
{
|
||||||
@@ -187,17 +187,17 @@ class linear_slist_algorithms
|
|||||||
NodeTraits::set_next(other_node, this_nxt);
|
NodeTraits::set_next(other_node, this_nxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Effects</b>: Reverses the order of elements in the list.
|
//! <b>Effects</b>: Reverses the order of elements in the list.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: The new first node of the list.
|
//! <b>Returns</b>: The new first node of the list.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: This function is linear to the contained elements.
|
//! <b>Complexity</b>: This function is linear to the contained elements.
|
||||||
static node_ptr reverse(const node_ptr & p)
|
static node_ptr reverse(const node_ptr & p)
|
||||||
{
|
{
|
||||||
if(!p) return node_ptr();
|
if(!p) return node_ptr();
|
||||||
node_ptr i = NodeTraits::get_next(p);
|
node_ptr i = NodeTraits::get_next(p);
|
||||||
node_ptr first(p);
|
node_ptr first(p);
|
||||||
while(i){
|
while(i){
|
||||||
node_ptr nxti(NodeTraits::get_next(i));
|
node_ptr nxti(NodeTraits::get_next(i));
|
||||||
@@ -213,9 +213,9 @@ class linear_slist_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: A pair containing the new first and last node of the list or
|
//! <b>Returns</b>: A pair containing the new first and last node of the list or
|
||||||
//! if there has been any movement, a null pair if n leads to no movement.
|
//! if there has been any movement, a null pair if n leads to no movement.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
|
//! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
|
||||||
static std::pair<node_ptr, node_ptr> move_first_n_backwards(const node_ptr & p, std::size_t n)
|
static std::pair<node_ptr, node_ptr> move_first_n_backwards(const node_ptr & p, std::size_t n)
|
||||||
{
|
{
|
||||||
@@ -255,7 +255,7 @@ class linear_slist_algorithms
|
|||||||
if(!end_found){
|
if(!end_found){
|
||||||
old_last = base_t::get_previous_node(first, node_ptr());
|
old_last = base_t::get_previous_node(first, node_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Now link p after the new last node
|
//Now link p after the new last node
|
||||||
NodeTraits::set_next(old_last, p);
|
NodeTraits::set_next(old_last, p);
|
||||||
NodeTraits::set_next(new_last, node_ptr());
|
NodeTraits::set_next(new_last, node_ptr());
|
||||||
@@ -268,9 +268,9 @@ class linear_slist_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: A pair containing the new first and last node of the list or
|
//! <b>Returns</b>: A pair containing the new first and last node of the list or
|
||||||
//! if there has been any movement, a null pair if n leads to no movement.
|
//! if there has been any movement, a null pair if n leads to no movement.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
|
//! <b>Complexity</b>: Linear to the number of elements plus the number moved positions.
|
||||||
static std::pair<node_ptr, node_ptr> move_first_n_forward(const node_ptr & p, std::size_t n)
|
static std::pair<node_ptr, node_ptr> move_first_n_forward(const node_ptr & p, std::size_t n)
|
||||||
{
|
{
|
||||||
@@ -300,7 +300,7 @@ class linear_slist_algorithms
|
|||||||
//If the shift is a multiple of the size there is nothing to do
|
//If the shift is a multiple of the size there is nothing to do
|
||||||
if(!new_before_last_pos)
|
if(!new_before_last_pos)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for( new_last = p
|
for( new_last = p
|
||||||
; --new_before_last_pos
|
; --new_before_last_pos
|
||||||
; new_last = node_traits::get_next(new_last)){
|
; new_last = node_traits::get_next(new_last)){
|
||||||
@@ -319,8 +319,8 @@ class linear_slist_algorithms
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ enum link_mode_type{
|
|||||||
//!the container without using any function provided by the containers.
|
//!the container without using any function provided by the containers.
|
||||||
auto_unlink
|
auto_unlink
|
||||||
};
|
};
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#endif //BOOST_INTRUSIVE_VALUE_LINK_TYPE_HPP
|
#endif //BOOST_INTRUSIVE_VALUE_LINK_TYPE_HPP
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -44,7 +44,7 @@ struct make_list_base_hook
|
|||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< hook_defaults,
|
< hook_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3
|
O1, O2, O3
|
||||||
#else
|
#else
|
||||||
@@ -64,13 +64,13 @@ struct make_list_base_hook
|
|||||||
|
|
||||||
//! Derive a class from this hook in order to store objects of that class
|
//! Derive a class from this hook in order to store objects of that class
|
||||||
//! in an list.
|
//! in an list.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c tag<>, \c void_pointer<> and
|
//! The hook admits the following options: \c tag<>, \c void_pointer<> and
|
||||||
//! \c link_mode<>.
|
//! \c link_mode<>.
|
||||||
//!
|
//!
|
||||||
//! \c tag<> defines a tag to identify the node.
|
//! \c tag<> defines a tag to identify the node.
|
||||||
//! The same tag value can be used in different classes, but if a class is
|
//! The same tag value can be used in different classes, but if a class is
|
||||||
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
||||||
//! unique tag.
|
//! unique tag.
|
||||||
//!
|
//!
|
||||||
//! \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,
|
||||||
@@ -96,27 +96,27 @@ class list_base_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
list_base_hook();
|
list_base_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
list_base_hook(const list_base_hook& );
|
list_base_hook(const list_base_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
list_base_hook& operator=(const list_base_hook& );
|
list_base_hook& operator=(const list_base_hook& );
|
||||||
@@ -125,37 +125,37 @@ class list_base_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in an list an assertion is raised. If link_mode is
|
//! object is stored in an list an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~list_base_hook();
|
~list_base_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(list_base_hook &other);
|
void swap_nodes(list_base_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c list::iterator_to
|
//! otherwise. This function can be used to test whether \c list::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -171,7 +171,7 @@ struct make_list_member_hook
|
|||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< hook_defaults,
|
< hook_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3
|
O1, O2, O3
|
||||||
#else
|
#else
|
||||||
@@ -191,10 +191,10 @@ struct make_list_member_hook
|
|||||||
|
|
||||||
//! Store this hook in a class to be inserted
|
//! Store this hook in a class to be inserted
|
||||||
//! in an list.
|
//! in an list.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c void_pointer<> and
|
//! The hook admits the following options: \c void_pointer<> and
|
||||||
//! \c link_mode<>.
|
//! \c link_mode<>.
|
||||||
//!
|
//!
|
||||||
//! \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).
|
||||||
//!
|
//!
|
||||||
@@ -218,27 +218,27 @@ class list_member_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
list_member_hook();
|
list_member_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
list_member_hook(const list_member_hook& );
|
list_member_hook(const list_member_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
list_member_hook& operator=(const list_member_hook& );
|
list_member_hook& operator=(const list_member_hook& );
|
||||||
@@ -247,43 +247,43 @@ class list_member_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in an list an assertion is raised. If link_mode is
|
//! object is stored in an list an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~list_member_hook();
|
~list_member_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(list_member_hook &other);
|
void swap_nodes(list_member_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c list::iterator_to
|
//! otherwise. This function can be used to test whether \c list::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
@@ -54,17 +54,17 @@ struct member_value_traits
|
|||||||
static pointer to_value_ptr(const node_ptr &n)
|
static pointer to_value_ptr(const node_ptr &n)
|
||||||
{
|
{
|
||||||
return pointer(detail::parent_from_member<value_type, node>
|
return pointer(detail::parent_from_member<value_type, node>
|
||||||
(boost::intrusive::detail::to_raw_pointer(n), PtrToMember));
|
(boost::intrusive::detail::to_raw_pointer(n), PtrToMember));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const_pointer to_value_ptr(const const_node_ptr &n)
|
static const_pointer to_value_ptr(const const_node_ptr &n)
|
||||||
{
|
{
|
||||||
return pointer(detail::parent_from_member<value_type, node>
|
return pointer(detail::parent_from_member<value_type, node>
|
||||||
(boost::intrusive::detail::to_raw_pointer(n), PtrToMember));
|
(boost::intrusive::detail::to_raw_pointer(n), PtrToMember));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#endif //BOOST_INTRUSIVE_MEMBER_VALUE_TRAITS_HPP
|
#endif //BOOST_INTRUSIVE_MEMBER_VALUE_TRAITS_HPP
|
||||||
|
@@ -245,7 +245,7 @@ struct compare
|
|||||||
//!alpha value that does not need floating-point operations.
|
//!alpha value that does not need floating-point operations.
|
||||||
//!
|
//!
|
||||||
//!If activated, the fixed alpha value is 1/sqrt(2). This
|
//!If activated, the fixed alpha value is 1/sqrt(2). This
|
||||||
//!option also saves some space in the container since
|
//!option also saves some space in the container since
|
||||||
//!the alpha value and some additional data does not need
|
//!the alpha value and some additional data does not need
|
||||||
//!to be stored in the container.
|
//!to be stored in the container.
|
||||||
//!
|
//!
|
||||||
@@ -567,7 +567,7 @@ struct compare_hash
|
|||||||
|
|
||||||
//!This option setter specifies if the hash container will use incremental
|
//!This option setter specifies if the hash container will use incremental
|
||||||
//!hashing. With incremental hashing the cost of hash table expansion is spread
|
//!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.
|
//!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
|
//!Therefore linear hashing is well suited for interactive applications or real-time
|
||||||
//!appplications where the worst-case insertion time of non-incremental hash containers
|
//!appplications where the worst-case insertion time of non-incremental hash containers
|
||||||
//!(rehashing the whole bucket array) is not admisible.
|
//!(rehashing the whole bucket array) is not admisible.
|
||||||
@@ -651,9 +651,9 @@ struct pack_options
|
|||||||
, O9
|
, O9
|
||||||
>::type
|
>::type
|
||||||
, O10
|
, O10
|
||||||
>::type
|
>::type
|
||||||
, O11
|
, O11
|
||||||
>::type
|
>::type
|
||||||
type;
|
type;
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
@@ -666,7 +666,7 @@ struct index_tuple{};
|
|||||||
template<std::size_t Num, typename Tuple = index_tuple<> >
|
template<std::size_t Num, typename Tuple = index_tuple<> >
|
||||||
struct build_number_seq;
|
struct build_number_seq;
|
||||||
|
|
||||||
template<std::size_t Num, int... Indexes>
|
template<std::size_t Num, int... Indexes>
|
||||||
struct build_number_seq<Num, index_tuple<Indexes...> >
|
struct build_number_seq<Num, index_tuple<Indexes...> >
|
||||||
: build_number_seq<Num - 1, index_tuple<Indexes..., sizeof...(Indexes)> >
|
: build_number_seq<Num - 1, index_tuple<Indexes..., sizeof...(Indexes)> >
|
||||||
{};
|
{};
|
||||||
|
@@ -20,7 +20,7 @@ namespace intrusive {
|
|||||||
|
|
||||||
//! Given a pointer to a member and its corresponding pointer to data member,
|
//! Given a pointer to a member and its corresponding pointer to data member,
|
||||||
//! this function returns the pointer of the parent containing that member.
|
//! this function returns the pointer of the parent containing that member.
|
||||||
//! Note: this function does not work with pointer to members that rely on
|
//! Note: this function does not work with pointer to members that rely on
|
||||||
//! virtual inheritance.
|
//! virtual inheritance.
|
||||||
template<class Parent, class Member>
|
template<class Parent, class Member>
|
||||||
inline Parent *get_parent_from_member(Member *member, const Member Parent::* ptr_to_member)
|
inline Parent *get_parent_from_member(Member *member, const Member Parent::* ptr_to_member)
|
||||||
@@ -28,7 +28,7 @@ inline Parent *get_parent_from_member(Member *member, const Member Parent::* ptr
|
|||||||
|
|
||||||
//! Given a const pointer to a member and its corresponding const pointer to data member,
|
//! Given a const pointer to a member and its corresponding const pointer to data member,
|
||||||
//! this function returns the const pointer of the parent containing that member.
|
//! this function returns the const pointer of the parent containing that member.
|
||||||
//! Note: this function does not work with pointer to members that rely on
|
//! Note: this function does not work with pointer to members that rely on
|
||||||
//! virtual inheritance.
|
//! virtual inheritance.
|
||||||
template<class Parent, class Member>
|
template<class Parent, class Member>
|
||||||
inline const Parent *get_parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
|
inline const Parent *get_parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
|
||||||
|
@@ -63,7 +63,7 @@ struct pointer_plus_bits<T*, NumBits>
|
|||||||
static void set_pointer(pointer &n, pointer p)
|
static void set_pointer(pointer &n, pointer p)
|
||||||
{
|
{
|
||||||
BOOST_INTRUSIVE_INVARIANT_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));
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::size_t get_bits(pointer n)
|
static std::size_t get_bits(pointer n)
|
||||||
@@ -76,7 +76,7 @@ struct pointer_plus_bits<T*, NumBits>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#endif //BOOST_INTRUSIVE_POINTER_PLUS_BITS_HPP
|
#endif //BOOST_INTRUSIVE_POINTER_PLUS_BITS_HPP
|
||||||
|
@@ -52,7 +52,7 @@ struct pointer_traits
|
|||||||
typedef unspecified_type difference_type;
|
typedef unspecified_type difference_type;
|
||||||
|
|
||||||
//!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is
|
//!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is
|
||||||
//!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or
|
//!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or
|
||||||
//!more type arguments ; otherwise, the instantiation of rebind is ill-formed.
|
//!more type arguments ; otherwise, the instantiation of rebind is ill-formed.
|
||||||
//!
|
//!
|
||||||
//!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre>
|
//!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre>
|
||||||
@@ -60,7 +60,7 @@ struct pointer_traits
|
|||||||
template <class U> using rebind = unspecified;
|
template <class U> using rebind = unspecified;
|
||||||
|
|
||||||
//!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is
|
//!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is
|
||||||
//!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or
|
//!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or
|
||||||
//!more type arguments ; otherwise, the instantiation of rebind is ill-formed.
|
//!more type arguments ; otherwise, the instantiation of rebind is ill-formed.
|
||||||
//!
|
//!
|
||||||
typedef element_type &reference;
|
typedef element_type &reference;
|
||||||
@@ -232,7 +232,7 @@ struct pointer_traits<T*>
|
|||||||
|
|
||||||
template <class U> struct rebind_pointer
|
template <class U> struct rebind_pointer
|
||||||
{ typedef U* type; };
|
{ typedef U* type; };
|
||||||
|
|
||||||
//! <b>Returns</b>: addressof(r)
|
//! <b>Returns</b>: addressof(r)
|
||||||
//!
|
//!
|
||||||
static pointer pointer_to(reference r)
|
static pointer pointer_to(reference r)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// The internal implementation of red-black trees is based on that of SGI STL
|
// The internal implementation of red-black trees is based on that of SGI STL
|
||||||
// stl_tree.h file:
|
// stl_tree.h file:
|
||||||
//
|
//
|
||||||
// Copyright (c) 1996,1997
|
// Copyright (c) 1996,1997
|
||||||
// Silicon Graphics Computer Systems, Inc.
|
// Silicon Graphics Computer Systems, Inc.
|
||||||
@@ -36,14 +36,14 @@
|
|||||||
// representations about the suitability of this software for any
|
// representations about the suitability of this software for any
|
||||||
// purpose. It is provided "as is" without express or implied warranty.
|
// purpose. It is provided "as is" without express or implied warranty.
|
||||||
//
|
//
|
||||||
// The tree destruction algorithm is based on Julienne Walker and The EC Team code:
|
// The tree destruction algorithm is based on Julienne Walker and The EC Team code:
|
||||||
//
|
//
|
||||||
// This code is in the public domain. Anyone may use it or change it in any way that
|
// This code is in the public domain. Anyone may use it or change it in any way that
|
||||||
// they see fit. The author assumes no responsibility for damages incurred through
|
// they see fit. The author assumes no responsibility for damages incurred through
|
||||||
// use of the original code or any variations thereof.
|
// use of the original code or any variations thereof.
|
||||||
//
|
//
|
||||||
// It is requested, but not required, that due credit is given to the original author
|
// It is requested, but not required, that due credit is given to the original author
|
||||||
// and anyone who has modified the code through a header comment, such as this one.
|
// and anyone who has modified the code through a header comment, such as this one.
|
||||||
|
|
||||||
#ifndef BOOST_INTRUSIVE_RBTREE_ALGORITHMS_HPP
|
#ifndef BOOST_INTRUSIVE_RBTREE_ALGORITHMS_HPP
|
||||||
#define BOOST_INTRUSIVE_RBTREE_ALGORITHMS_HPP
|
#define BOOST_INTRUSIVE_RBTREE_ALGORITHMS_HPP
|
||||||
@@ -61,17 +61,17 @@
|
|||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
|
|
||||||
//! rbtree_algorithms provides basic algorithms to manipulate
|
//! rbtree_algorithms provides basic algorithms to manipulate
|
||||||
//! nodes forming a red-black tree. The insertion and deletion algorithms are
|
//! nodes forming a red-black tree. The insertion and deletion algorithms are
|
||||||
//! based on those in Cormen, Leiserson, and Rivest, Introduction to Algorithms
|
//! based on those in Cormen, Leiserson, and Rivest, Introduction to Algorithms
|
||||||
//! (MIT Press, 1990), except that
|
//! (MIT Press, 1990), except that
|
||||||
//!
|
//!
|
||||||
//! (1) the header node is maintained with links not only to the root
|
//! (1) the header node is maintained with links not only to the root
|
||||||
//! but also to the leftmost node of the tree, to enable constant time
|
//! but also to the leftmost node of the tree, to enable constant time
|
||||||
//! begin(), and to the rightmost node of the tree, to enable linear time
|
//! begin(), and to the rightmost node of the tree, to enable linear time
|
||||||
//! performance when used with the generic set algorithms (set_union,
|
//! performance when used with the generic set algorithms (set_union,
|
||||||
//! etc.);
|
//! etc.);
|
||||||
//!
|
//!
|
||||||
//! (2) when a node being deleted has two children its successor node is
|
//! (2) when a node being deleted has two children its successor node is
|
||||||
//! relinked into its place, rather than copied, so that the only
|
//! relinked into its place, rather than copied, so that the only
|
||||||
//! pointers invalidated are those referring to the deleted node.
|
//! pointers invalidated are those referring to the deleted node.
|
||||||
@@ -93,23 +93,23 @@ namespace intrusive {
|
|||||||
//! <b>Static functions</b>:
|
//! <b>Static functions</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static color get_color(const_node_ptr n);</tt>
|
//! <tt>static color get_color(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_color(node_ptr n, color c);</tt>
|
//! <tt>static void set_color(node_ptr n, color c);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static color black();</tt>
|
//! <tt>static color black();</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static color red();</tt>
|
//! <tt>static color red();</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class rbtree_algorithms
|
class rbtree_algorithms
|
||||||
@@ -135,7 +135,7 @@ class rbtree_algorithms
|
|||||||
rbtree_node_cloner(F f)
|
rbtree_node_cloner(F f)
|
||||||
: base_t(f)
|
: base_t(f)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
node_ptr operator()(const node_ptr & p)
|
node_ptr operator()(const node_ptr & p)
|
||||||
{
|
{
|
||||||
node_ptr n = base_t::get()(p);
|
node_ptr n = base_t::get()(p);
|
||||||
@@ -172,27 +172,27 @@ class rbtree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
||||||
//! links to the second tree and header2 will have links to the first tree.
|
//! links to the second tree and header2 will have links to the first tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
||||||
{ return tree_algorithms::swap_tree(header1, header2); }
|
{ return tree_algorithms::swap_tree(header1, header2); }
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -201,22 +201,22 @@ class rbtree_algorithms
|
|||||||
{
|
{
|
||||||
if(node1 == node2)
|
if(node1 == node2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
||||||
swap_nodes(node1, header1, node2, header2);
|
swap_nodes(node1, header1, node2, header2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees with header header1 and header2.
|
//! of two trees with header header1 and header2.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -228,20 +228,20 @@ class rbtree_algorithms
|
|||||||
tree_algorithms::swap_nodes(node1, header1, node2, header2);
|
tree_algorithms::swap_nodes(node1, header1, node2, header2);
|
||||||
//Swap color
|
//Swap color
|
||||||
color c = NodeTraits::get_color(node1);
|
color c = NodeTraits::get_color(node1);
|
||||||
NodeTraits::set_color(node1, NodeTraits::get_color(node2));
|
NodeTraits::set_color(node1, NodeTraits::get_color(node2));
|
||||||
NodeTraits::set_color(node2, c);
|
NodeTraits::set_color(node2, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! and new_node must not be inserted in a tree.
|
//! and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -257,14 +257,14 @@ class rbtree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! with header "header" and new_node must not be inserted in a tree.
|
//! with header "header" and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -274,15 +274,15 @@ class rbtree_algorithms
|
|||||||
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
|
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
tree_algorithms::replace_node(node_to_be_replaced, header, new_node);
|
tree_algorithms::replace_node(node_to_be_replaced, header, new_node);
|
||||||
NodeTraits::set_color(new_node, NodeTraits::get_color(node_to_be_replaced));
|
NodeTraits::set_color(new_node, NodeTraits::get_color(node_to_be_replaced));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a tree node but not the header.
|
//! <b>Requires</b>: node is a tree node but not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
|
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
//! <b>Complexity</b>: Average complexity is constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void unlink(const node_ptr & node)
|
static void unlink(const node_ptr & node)
|
||||||
{
|
{
|
||||||
@@ -295,14 +295,14 @@ class rbtree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header of a tree.
|
//! <b>Requires</b>: header is the header of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
||||||
//! updates the header link to the new leftmost node.
|
//! updates the header link to the new leftmost node.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
//! <b>Complexity</b>: Average complexity is constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function breaks the tree and the tree can
|
//! <b>Notes</b>: This function breaks the tree and the tree can
|
||||||
//! only be used for more unlink_leftmost_without_rebalance calls.
|
//! only be used for more unlink_leftmost_without_rebalance calls.
|
||||||
//! This function is normally used to achieve a step by step
|
//! This function is normally used to achieve a step by step
|
||||||
@@ -312,51 +312,51 @@ class rbtree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
||||||
//! by init(...).
|
//! by init(...).
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool unique(const const_node_ptr & node)
|
static bool unique(const const_node_ptr & node)
|
||||||
{ return tree_algorithms::unique(node); }
|
{ return tree_algorithms::unique(node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t count(const const_node_ptr & node)
|
static std::size_t count(const const_node_ptr & node)
|
||||||
{ return tree_algorithms::count(node); }
|
{ return tree_algorithms::count(node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header node of the tree.
|
//! <b>Requires</b>: header is the header node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes above the header.
|
//! <b>Effects</b>: Returns the number of nodes above the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t size(const const_node_ptr & header)
|
static std::size_t size(const const_node_ptr & header)
|
||||||
{ return tree_algorithms::size(header); }
|
{ return tree_algorithms::size(header); }
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the header.
|
//! <b>Requires</b>: p is a node from the tree except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the next node of the tree.
|
//! <b>Effects</b>: Returns the next node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr next_node(const node_ptr & p)
|
static node_ptr next_node(const node_ptr & p)
|
||||||
{ return tree_algorithms::next_node(p); }
|
{ return tree_algorithms::next_node(p); }
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the previous node of the tree.
|
//! <b>Effects</b>: Returns the previous node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr prev_node(const node_ptr & p)
|
static node_ptr prev_node(const node_ptr & p)
|
||||||
{ return tree_algorithms::prev_node(p); }
|
{ return tree_algorithms::prev_node(p); }
|
||||||
@@ -364,9 +364,9 @@ class rbtree_algorithms
|
|||||||
//! <b>Requires</b>: node must not be part of any tree.
|
//! <b>Requires</b>: node must not be part of any tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: After the function unique(node) == true.
|
//! <b>Effects</b>: After the function unique(node) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
@@ -377,25 +377,25 @@ class rbtree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
||||||
//! unique(header) == true.
|
//! unique(header) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
static void init_header(const node_ptr & header)
|
static void init_header(const node_ptr & header)
|
||||||
{
|
{
|
||||||
tree_algorithms::init_header(header);
|
tree_algorithms::init_header(header);
|
||||||
NodeTraits::set_color(header, NodeTraits::red());
|
NodeTraits::set_color(header, NodeTraits::red());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header must be the header of a tree, z a node
|
//! <b>Requires</b>: header must be the header of a tree, z a node
|
||||||
//! of that tree and z != header.
|
//! of that tree and z != header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
|
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Amortized constant time.
|
//! <b>Complexity</b>: Amortized constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr erase(const node_ptr & header, const node_ptr & z)
|
static node_ptr erase(const node_ptr & header, const node_ptr & z)
|
||||||
{
|
{
|
||||||
@@ -415,18 +415,18 @@ class rbtree_algorithms
|
|||||||
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
||||||
//! take a node_ptr and shouldn't throw.
|
//! take a node_ptr and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: First empties target tree calling
|
//! <b>Effects</b>: First empties target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
||||||
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
||||||
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
||||||
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template <class Cloner, class Disposer>
|
template <class Cloner, class Disposer>
|
||||||
static void clone
|
static void clone
|
||||||
@@ -439,13 +439,13 @@ class rbtree_algorithms
|
|||||||
//! <b>Requires</b>: "disposer" must be an object function
|
//! <b>Requires</b>: "disposer" must be an object function
|
||||||
//! taking a node_ptr parameter and shouldn't throw.
|
//! taking a node_ptr parameter and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Empties the target tree calling
|
//! <b>Effects</b>: Empties the target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template<class Disposer>
|
template<class Disposer>
|
||||||
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
||||||
@@ -461,7 +461,7 @@ class rbtree_algorithms
|
|||||||
//! not exist.
|
//! not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr lower_bound
|
static node_ptr lower_bound
|
||||||
@@ -477,7 +477,7 @@ class rbtree_algorithms
|
|||||||
//! than "key" according to "comp" or "header" if that element does not exist.
|
//! than "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr upper_bound
|
static node_ptr upper_bound
|
||||||
@@ -493,7 +493,7 @@ class rbtree_algorithms
|
|||||||
//! "key" according to "comp" or "header" if that element does not exist.
|
//! "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr find
|
static node_ptr find
|
||||||
@@ -511,7 +511,7 @@ class rbtree_algorithms
|
|||||||
//! if they there are no equivalent elements.
|
//! if they there are no equivalent elements.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> equal_range
|
static std::pair<node_ptr, node_ptr> equal_range
|
||||||
@@ -525,10 +525,10 @@ class rbtree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
||||||
//! according to "comp".
|
//! according to "comp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||||
//! most logarithmic.
|
//! most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal_upper_bound
|
static node_ptr insert_equal_upper_bound
|
||||||
@@ -546,10 +546,10 @@ class rbtree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
|
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
|
||||||
//! according to "comp".
|
//! according to "comp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||||
//! most logarithmic.
|
//! most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal_lower_bound
|
static node_ptr insert_equal_lower_bound
|
||||||
@@ -565,14 +565,14 @@ class rbtree_algorithms
|
|||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
|
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
|
||||||
//! the "header"'s tree.
|
//! the "header"'s tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
||||||
//! where it will be inserted. If "hint" is the upper_bound
|
//! where it will be inserted. If "hint" is the upper_bound
|
||||||
//! the insertion takes constant time (two comparisons in the worst case).
|
//! the insertion takes constant time (two comparisons in the worst case).
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
||||||
//! constant time if new_node is inserted immediately before "hint".
|
//! constant time if new_node is inserted immediately before "hint".
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal
|
static node_ptr insert_equal
|
||||||
@@ -588,13 +588,13 @@ class rbtree_algorithms
|
|||||||
//! "pos" must be an iterator pointing to the successor to "new_node"
|
//! "pos" must be an iterator pointing to the successor to "new_node"
|
||||||
//! once inserted according to the order of already inserted nodes. This function does not
|
//! once inserted according to the order of already inserted nodes. This function does not
|
||||||
//! check "pos" and this precondition must be guaranteed by the caller.
|
//! check "pos" and this precondition must be guaranteed by the caller.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
||||||
//! tree invariants might be broken.
|
//! tree invariants might be broken.
|
||||||
static node_ptr insert_before
|
static node_ptr insert_before
|
||||||
@@ -608,13 +608,13 @@ class rbtree_algorithms
|
|||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! <b>Requires</b>: "header" must be the header node of a tree.
|
||||||
//! "new_node" must be, according to the used ordering no less than the
|
//! "new_node" must be, according to the used ordering no less than the
|
||||||
//! greatest inserted key.
|
//! greatest inserted key.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
//! tree invariants are broken. This function is slightly faster than
|
||||||
//! using "insert_before".
|
//! using "insert_before".
|
||||||
@@ -627,13 +627,13 @@ class rbtree_algorithms
|
|||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! <b>Requires</b>: "header" must be the header node of a tree.
|
||||||
//! "new_node" must be, according to the used ordering, no greater than the
|
//! "new_node" must be, according to the used ordering, no greater than the
|
||||||
//! lowest inserted key.
|
//! lowest inserted key.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
//! tree invariants are broken. This function is slightly faster than
|
||||||
//! using "insert_before".
|
//! using "insert_before".
|
||||||
@@ -647,7 +647,7 @@ class rbtree_algorithms
|
|||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
//! KeyNodePtrCompare is a function object that induces a strict weak
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
||||||
//! tree according to "comp" and obtains the needed information to realize
|
//! tree according to "comp" and obtains the needed information to realize
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
//! a constant-time node insertion if there is no equivalent node.
|
||||||
@@ -658,11 +658,11 @@ class rbtree_algorithms
|
|||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
//! be used with the "insert_commit" function to achieve a constant-time
|
||||||
//! insertion function.
|
//! insertion function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
//! a node is expensive and the user does not want to have two equivalent nodes
|
||||||
//! in the tree: if there is an equivalent value
|
//! in the tree: if there is an equivalent value
|
||||||
@@ -688,12 +688,12 @@ class rbtree_algorithms
|
|||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
||||||
//! "hint" is node from the "header"'s tree.
|
//! "hint" is node from the "header"'s tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
||||||
//! tree according to "comp" using "hint" as a hint to where it should be
|
//! tree according to "comp" using "hint" as a hint to where it should be
|
||||||
//! inserted and obtains the needed information to realize
|
//! inserted and obtains the needed information to realize
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
//! a constant-time node insertion if there is no equivalent node.
|
||||||
//! If "hint" is the upper_bound the function has constant time
|
//! If "hint" is the upper_bound the function has constant time
|
||||||
//! complexity (two comparisons in the worst case).
|
//! complexity (two comparisons in the worst case).
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: If there is an equivalent value
|
//! <b>Returns</b>: If there is an equivalent value
|
||||||
@@ -702,12 +702,12 @@ class rbtree_algorithms
|
|||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
//! be used with the "insert_commit" function to achieve a constant-time
|
||||||
//! insertion function.
|
//! insertion function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
|
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
|
||||||
//! amortized constant time if new_node should be inserted immediately before "hint".
|
//! amortized constant time if new_node should be inserted immediately before "hint".
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
//! a node is expensive and the user does not want to have two equivalent nodes
|
||||||
//! in the tree: if there is an equivalent value
|
//! in the tree: if there is an equivalent value
|
||||||
@@ -732,16 +732,16 @@ class rbtree_algorithms
|
|||||||
//! "commit_data" must have been obtained from a previous call to
|
//! "commit_data" must have been obtained from a previous call to
|
||||||
//! "insert_unique_check". No objects should have been inserted or erased
|
//! "insert_unique_check". No objects should have been inserted or erased
|
||||||
//! from the set between the "insert_unique_check" that filled "commit_data"
|
//! from the set between the "insert_unique_check" that filled "commit_data"
|
||||||
//! and the call to "insert_commit".
|
//! and the call to "insert_commit".
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
||||||
//! from the "commit_data" that a previous "insert_check" filled.
|
//! from the "commit_data" that a previous "insert_check" filled.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
||||||
//! previously executed to fill "commit_data". No value should be inserted or
|
//! previously executed to fill "commit_data". No value should be inserted or
|
||||||
//! erased between the "insert_check" and "insert_commit" calls.
|
//! erased between the "insert_check" and "insert_commit" calls.
|
||||||
@@ -757,7 +757,7 @@ class rbtree_algorithms
|
|||||||
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr get_header(const node_ptr & n)
|
static node_ptr get_header(const node_ptr & n)
|
||||||
{ return tree_algorithms::get_header(n); }
|
{ return tree_algorithms::get_header(n); }
|
||||||
@@ -766,17 +766,17 @@ class rbtree_algorithms
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node of a tree.
|
//! <b>Requires</b>: p is a node of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if p is the header of the tree.
|
//! <b>Effects</b>: Returns true if p is the header of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool is_header(const const_node_ptr & p)
|
static bool is_header(const const_node_ptr & p)
|
||||||
{
|
{
|
||||||
return NodeTraits::get_color(p) == NodeTraits::red() &&
|
return NodeTraits::get_color(p) == NodeTraits::red() &&
|
||||||
tree_algorithms::is_header(p);
|
tree_algorithms::is_header(p);
|
||||||
//return NodeTraits::get_color(p) == NodeTraits::red() &&
|
//return NodeTraits::get_color(p) == NodeTraits::red() &&
|
||||||
// NodeTraits::get_parent(NodeTraits::get_parent(p)) == p;
|
// NodeTraits::get_parent(NodeTraits::get_parent(p)) == p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -797,7 +797,7 @@ class rbtree_algorithms
|
|||||||
NodeTraits::set_color(w, NodeTraits::red());
|
NodeTraits::set_color(w, NodeTraits::red());
|
||||||
x = x_parent;
|
x = x_parent;
|
||||||
x_parent = NodeTraits::get_parent(x_parent);
|
x_parent = NodeTraits::get_parent(x_parent);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(NodeTraits::get_right(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()){
|
if(NodeTraits::get_right(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()){
|
||||||
NodeTraits::set_color(NodeTraits::get_left(w), NodeTraits::black());
|
NodeTraits::set_color(NodeTraits::get_left(w), NodeTraits::black());
|
||||||
@@ -902,8 +902,8 @@ class rbtree_algorithms
|
|||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -44,7 +44,7 @@ struct make_set_base_hook
|
|||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< hook_defaults,
|
< hook_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3, O4
|
O1, O2, O3, O4
|
||||||
#else
|
#else
|
||||||
@@ -63,16 +63,16 @@ struct make_set_base_hook
|
|||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Derive a class from set_base_hook in order to store objects in
|
//! Derive a class from set_base_hook in order to store objects in
|
||||||
//! in a set/multiset. set_base_hook holds the data necessary to maintain
|
//! in a set/multiset. set_base_hook holds the data necessary to maintain
|
||||||
//! the set/multiset and provides an appropriate value_traits class for set/multiset.
|
//! the set/multiset and provides an appropriate value_traits class for set/multiset.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
|
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
|
||||||
//! \c link_mode<> and \c optimize_size<>.
|
//! \c link_mode<> and \c optimize_size<>.
|
||||||
//!
|
//!
|
||||||
//! \c tag<> defines a tag to identify the node.
|
//! \c tag<> defines a tag to identify the node.
|
||||||
//! The same tag value can be used in different classes, but if a class is
|
//! The same tag value can be used in different classes, but if a class is
|
||||||
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
||||||
//! unique tag.
|
//! unique tag.
|
||||||
//!
|
//!
|
||||||
//! \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
|
||||||
@@ -101,27 +101,27 @@ class set_base_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
set_base_hook();
|
set_base_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
set_base_hook(const set_base_hook& );
|
set_base_hook(const set_base_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
set_base_hook& operator=(const set_base_hook& );
|
set_base_hook& operator=(const set_base_hook& );
|
||||||
@@ -130,37 +130,37 @@ class set_base_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in a set an assertion is raised. If link_mode is
|
//! object is stored in a set an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~set_base_hook();
|
~set_base_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(set_base_hook &other);
|
void swap_nodes(set_base_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c set::iterator_to
|
//! otherwise. This function can be used to test whether \c set::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -176,7 +176,7 @@ struct make_set_member_hook
|
|||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< hook_defaults,
|
< hook_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3, O4
|
O1, O2, O3, O4
|
||||||
#else
|
#else
|
||||||
@@ -198,7 +198,7 @@ struct make_set_member_hook
|
|||||||
//! Put a public data member set_member_hook in order to store objects of this class in
|
//! Put a public data member set_member_hook in order to store objects of this class in
|
||||||
//! a set/multiset. set_member_hook holds the data necessary for maintaining the
|
//! a set/multiset. set_member_hook holds the data necessary for maintaining the
|
||||||
//! set/multiset and provides an appropriate value_traits class for set/multiset.
|
//! set/multiset and provides an appropriate value_traits class for set/multiset.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c void_pointer<>,
|
//! The hook admits the following options: \c void_pointer<>,
|
||||||
//! \c link_mode<> and \c optimize_size<>.
|
//! \c link_mode<> and \c optimize_size<>.
|
||||||
//!
|
//!
|
||||||
@@ -228,27 +228,27 @@ class set_member_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
set_member_hook();
|
set_member_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
set_member_hook(const set_member_hook& );
|
set_member_hook(const set_member_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
set_member_hook& operator=(const set_member_hook& );
|
set_member_hook& operator=(const set_member_hook& );
|
||||||
@@ -257,43 +257,43 @@ class set_member_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in a set an assertion is raised. If link_mode is
|
//! object is stored in a set an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~set_member_hook();
|
~set_member_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(set_member_hook &other);
|
void swap_nodes(set_member_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c set::iterator_to
|
//! otherwise. This function can be used to test whether \c set::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -45,15 +45,15 @@ namespace intrusive {
|
|||||||
//! <b>Static functions</b>:
|
//! <b>Static functions</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class sgtree_algorithms
|
class sgtree_algorithms
|
||||||
@@ -90,27 +90,27 @@ class sgtree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
||||||
//! links to the second tree and header2 will have links to the first tree.
|
//! links to the second tree and header2 will have links to the first tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
||||||
{ return tree_algorithms::swap_tree(header1, header2); }
|
{ return tree_algorithms::swap_tree(header1, header2); }
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -119,22 +119,22 @@ class sgtree_algorithms
|
|||||||
{
|
{
|
||||||
if(node1 == node2)
|
if(node1 == node2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
||||||
swap_nodes(node1, header1, node2, header2);
|
swap_nodes(node1, header1, node2, header2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees with header header1 and header2.
|
//! of two trees with header header1 and header2.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -144,14 +144,14 @@ class sgtree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! and new_node must not be inserted in a tree.
|
//! and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -167,14 +167,14 @@ class sgtree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! with header "header" and new_node must not be inserted in a tree.
|
//! with header "header" and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -185,11 +185,11 @@ class sgtree_algorithms
|
|||||||
{ tree_algorithms::replace_node(node_to_be_replaced, header, new_node); }
|
{ tree_algorithms::replace_node(node_to_be_replaced, header, new_node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a tree node but not the header.
|
//! <b>Requires</b>: node is a tree node but not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
|
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
//! <b>Complexity</b>: Average complexity is constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void unlink(const node_ptr & node)
|
static void unlink(const node_ptr & node)
|
||||||
{
|
{
|
||||||
@@ -202,14 +202,14 @@ class sgtree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header of a tree.
|
//! <b>Requires</b>: header is the header of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
||||||
//! updates the header link to the new leftmost node.
|
//! updates the header link to the new leftmost node.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
//! <b>Complexity</b>: Average complexity is constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function breaks the tree and the tree can
|
//! <b>Notes</b>: This function breaks the tree and the tree can
|
||||||
//! only be used for more unlink_leftmost_without_rebalance calls.
|
//! only be used for more unlink_leftmost_without_rebalance calls.
|
||||||
//! This function is normally used to achieve a step by step
|
//! This function is normally used to achieve a step by step
|
||||||
@@ -219,51 +219,51 @@ class sgtree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
||||||
//! by init(...).
|
//! by init(...).
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool unique(const const_node_ptr & node)
|
static bool unique(const const_node_ptr & node)
|
||||||
{ return tree_algorithms::unique(node); }
|
{ return tree_algorithms::unique(node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t count(const const_node_ptr & node)
|
static std::size_t count(const const_node_ptr & node)
|
||||||
{ return tree_algorithms::count(node); }
|
{ return tree_algorithms::count(node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header node of the tree.
|
//! <b>Requires</b>: header is the header node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes above the header.
|
//! <b>Effects</b>: Returns the number of nodes above the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t size(const const_node_ptr & header)
|
static std::size_t size(const const_node_ptr & header)
|
||||||
{ return tree_algorithms::size(header); }
|
{ return tree_algorithms::size(header); }
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the header.
|
//! <b>Requires</b>: p is a node from the tree except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the next node of the tree.
|
//! <b>Effects</b>: Returns the next node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr next_node(const node_ptr & p)
|
static node_ptr next_node(const node_ptr & p)
|
||||||
{ return tree_algorithms::next_node(p); }
|
{ return tree_algorithms::next_node(p); }
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the previous node of the tree.
|
//! <b>Effects</b>: Returns the previous node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr prev_node(const node_ptr & p)
|
static node_ptr prev_node(const node_ptr & p)
|
||||||
{ return tree_algorithms::prev_node(p); }
|
{ return tree_algorithms::prev_node(p); }
|
||||||
@@ -271,9 +271,9 @@ class sgtree_algorithms
|
|||||||
//! <b>Requires</b>: node must not be part of any tree.
|
//! <b>Requires</b>: node must not be part of any tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: After the function unique(node) == true.
|
//! <b>Effects</b>: After the function unique(node) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
@@ -284,9 +284,9 @@ class sgtree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
||||||
//! unique(header) == true.
|
//! unique(header) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
@@ -297,9 +297,9 @@ class sgtree_algorithms
|
|||||||
//! of that tree and z != header.
|
//! of that tree and z != header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
|
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Amortized constant time.
|
//! <b>Complexity</b>: Amortized constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
template<class AlphaByMaxSize>
|
template<class AlphaByMaxSize>
|
||||||
static node_ptr erase(const node_ptr & header, const node_ptr & z, std::size_t tree_size, std::size_t &max_tree_size, AlphaByMaxSize alpha_by_maxsize)
|
static node_ptr erase(const node_ptr & header, const node_ptr & z, std::size_t tree_size, std::size_t &max_tree_size, AlphaByMaxSize alpha_by_maxsize)
|
||||||
@@ -307,7 +307,7 @@ class sgtree_algorithms
|
|||||||
//typename tree_algorithms::data_for_rebalance info;
|
//typename tree_algorithms::data_for_rebalance info;
|
||||||
tree_algorithms::erase(header, z);
|
tree_algorithms::erase(header, z);
|
||||||
--tree_size;
|
--tree_size;
|
||||||
if (tree_size > 0 &&
|
if (tree_size > 0 &&
|
||||||
tree_size < alpha_by_maxsize(max_tree_size)){
|
tree_size < alpha_by_maxsize(max_tree_size)){
|
||||||
tree_algorithms::rebalance(header);
|
tree_algorithms::rebalance(header);
|
||||||
max_tree_size = tree_size;
|
max_tree_size = tree_size;
|
||||||
@@ -319,18 +319,18 @@ class sgtree_algorithms
|
|||||||
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
||||||
//! take a node_ptr and shouldn't throw.
|
//! take a node_ptr and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: First empties target tree calling
|
//! <b>Effects</b>: First empties target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
||||||
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
||||||
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
||||||
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template <class Cloner, class Disposer>
|
template <class Cloner, class Disposer>
|
||||||
static void clone
|
static void clone
|
||||||
@@ -342,13 +342,13 @@ class sgtree_algorithms
|
|||||||
//! <b>Requires</b>: "disposer" must be an object function
|
//! <b>Requires</b>: "disposer" must be an object function
|
||||||
//! taking a node_ptr parameter and shouldn't throw.
|
//! taking a node_ptr parameter and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Empties the target tree calling
|
//! <b>Effects</b>: Empties the target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template<class Disposer>
|
template<class Disposer>
|
||||||
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
||||||
@@ -364,7 +364,7 @@ class sgtree_algorithms
|
|||||||
//! not exist.
|
//! not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr lower_bound
|
static node_ptr lower_bound
|
||||||
@@ -380,7 +380,7 @@ class sgtree_algorithms
|
|||||||
//! than "key" according to "comp" or "header" if that element does not exist.
|
//! than "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr upper_bound
|
static node_ptr upper_bound
|
||||||
@@ -396,7 +396,7 @@ class sgtree_algorithms
|
|||||||
//! "key" according to "comp" or "header" if that element does not exist.
|
//! "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr find
|
static node_ptr find
|
||||||
@@ -414,7 +414,7 @@ class sgtree_algorithms
|
|||||||
//! if they there are no equivalent elements.
|
//! if they there are no equivalent elements.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> equal_range
|
static std::pair<node_ptr, node_ptr> equal_range
|
||||||
@@ -428,10 +428,10 @@ class sgtree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
||||||
//! according to "comp".
|
//! according to "comp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||||
//! most logarithmic.
|
//! most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare, class H_Alpha>
|
template<class NodePtrCompare, class H_Alpha>
|
||||||
static node_ptr insert_equal_upper_bound
|
static node_ptr insert_equal_upper_bound
|
||||||
@@ -451,10 +451,10 @@ class sgtree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
|
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
|
||||||
//! according to "comp".
|
//! according to "comp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||||
//! most logarithmic.
|
//! most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare, class H_Alpha>
|
template<class NodePtrCompare, class H_Alpha>
|
||||||
static node_ptr insert_equal_lower_bound
|
static node_ptr insert_equal_lower_bound
|
||||||
@@ -472,14 +472,14 @@ class sgtree_algorithms
|
|||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
|
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
|
||||||
//! the "header"'s tree.
|
//! the "header"'s tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
||||||
//! where it will be inserted. If "hint" is the upper_bound
|
//! where it will be inserted. If "hint" is the upper_bound
|
||||||
//! the insertion takes constant time (two comparisons in the worst case).
|
//! the insertion takes constant time (two comparisons in the worst case).
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
||||||
//! constant time if new_node is inserted immediately before "hint".
|
//! constant time if new_node is inserted immediately before "hint".
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare, class H_Alpha>
|
template<class NodePtrCompare, class H_Alpha>
|
||||||
static node_ptr insert_equal
|
static node_ptr insert_equal
|
||||||
@@ -496,7 +496,7 @@ class sgtree_algorithms
|
|||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
//! KeyNodePtrCompare is a function object that induces a strict weak
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
||||||
//! tree according to "comp" and obtains the needed information to realize
|
//! tree according to "comp" and obtains the needed information to realize
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
//! a constant-time node insertion if there is no equivalent node.
|
||||||
@@ -507,11 +507,11 @@ class sgtree_algorithms
|
|||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
//! be used with the "insert_commit" function to achieve a constant-time
|
||||||
//! insertion function.
|
//! insertion function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
//! a node is expensive and the user does not want to have two equivalent nodes
|
||||||
//! in the tree: if there is an equivalent value
|
//! in the tree: if there is an equivalent value
|
||||||
@@ -532,7 +532,7 @@ class sgtree_algorithms
|
|||||||
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
|
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
|
||||||
{
|
{
|
||||||
std::size_t depth;
|
std::size_t depth;
|
||||||
std::pair<node_ptr, bool> ret =
|
std::pair<node_ptr, bool> ret =
|
||||||
tree_algorithms::insert_unique_check(header, key, comp, commit_data, &depth);
|
tree_algorithms::insert_unique_check(header, key, comp, commit_data, &depth);
|
||||||
commit_data.depth = depth;
|
commit_data.depth = depth;
|
||||||
return ret;
|
return ret;
|
||||||
@@ -544,13 +544,13 @@ class sgtree_algorithms
|
|||||||
//! "pos" must be an iterator pointing to the successor to "new_node"
|
//! "pos" must be an iterator pointing to the successor to "new_node"
|
||||||
//! once inserted according to the order of already inserted nodes. This function does not
|
//! once inserted according to the order of already inserted nodes. This function does not
|
||||||
//! check "pos" and this precondition must be guaranteed by the caller.
|
//! check "pos" and this precondition must be guaranteed by the caller.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
||||||
//! tree invariants might be broken.
|
//! tree invariants might be broken.
|
||||||
template<class H_Alpha>
|
template<class H_Alpha>
|
||||||
@@ -567,13 +567,13 @@ class sgtree_algorithms
|
|||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! <b>Requires</b>: "header" must be the header node of a tree.
|
||||||
//! "new_node" must be, according to the used ordering no less than the
|
//! "new_node" must be, according to the used ordering no less than the
|
||||||
//! greatest inserted key.
|
//! greatest inserted key.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
//! tree invariants are broken. This function is slightly faster than
|
||||||
//! using "insert_before".
|
//! using "insert_before".
|
||||||
@@ -589,13 +589,13 @@ class sgtree_algorithms
|
|||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! <b>Requires</b>: "header" must be the header node of a tree.
|
||||||
//! "new_node" must be, according to the used ordering, no greater than the
|
//! "new_node" must be, according to the used ordering, no greater than the
|
||||||
//! lowest inserted key.
|
//! lowest inserted key.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
//! tree invariants are broken. This function is slightly faster than
|
||||||
//! using "insert_before".
|
//! using "insert_before".
|
||||||
@@ -613,12 +613,12 @@ class sgtree_algorithms
|
|||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
||||||
//! "hint" is node from the "header"'s tree.
|
//! "hint" is node from the "header"'s tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
||||||
//! tree according to "comp" using "hint" as a hint to where it should be
|
//! tree according to "comp" using "hint" as a hint to where it should be
|
||||||
//! inserted and obtains the needed information to realize
|
//! inserted and obtains the needed information to realize
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
//! a constant-time node insertion if there is no equivalent node.
|
||||||
//! If "hint" is the upper_bound the function has constant time
|
//! If "hint" is the upper_bound the function has constant time
|
||||||
//! complexity (two comparisons in the worst case).
|
//! complexity (two comparisons in the worst case).
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: If there is an equivalent value
|
//! <b>Returns</b>: If there is an equivalent value
|
||||||
@@ -627,12 +627,12 @@ class sgtree_algorithms
|
|||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
//! be used with the "insert_commit" function to achieve a constant-time
|
||||||
//! insertion function.
|
//! insertion function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
|
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
|
||||||
//! amortized constant time if new_node should be inserted immediately before "hint".
|
//! amortized constant time if new_node should be inserted immediately before "hint".
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
//! a node is expensive and the user does not want to have two equivalent nodes
|
||||||
//! in the tree: if there is an equivalent value
|
//! in the tree: if there is an equivalent value
|
||||||
@@ -653,7 +653,7 @@ class sgtree_algorithms
|
|||||||
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
|
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
|
||||||
{
|
{
|
||||||
std::size_t depth;
|
std::size_t depth;
|
||||||
std::pair<node_ptr, bool> ret =
|
std::pair<node_ptr, bool> ret =
|
||||||
tree_algorithms::insert_unique_check
|
tree_algorithms::insert_unique_check
|
||||||
(header, hint, key, comp, commit_data, &depth);
|
(header, hint, key, comp, commit_data, &depth);
|
||||||
commit_data.depth = depth;
|
commit_data.depth = depth;
|
||||||
@@ -664,16 +664,16 @@ class sgtree_algorithms
|
|||||||
//! "commit_data" must have been obtained from a previous call to
|
//! "commit_data" must have been obtained from a previous call to
|
||||||
//! "insert_unique_check". No objects should have been inserted or erased
|
//! "insert_unique_check". No objects should have been inserted or erased
|
||||||
//! from the set between the "insert_unique_check" that filled "commit_data"
|
//! from the set between the "insert_unique_check" that filled "commit_data"
|
||||||
//! and the call to "insert_commit".
|
//! and the call to "insert_commit".
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
||||||
//! from the "commit_data" that a previous "insert_check" filled.
|
//! from the "commit_data" that a previous "insert_check" filled.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
||||||
//! previously executed to fill "commit_data". No value should be inserted or
|
//! previously executed to fill "commit_data". No value should be inserted or
|
||||||
//! erased between the "insert_check" and "insert_commit" calls.
|
//! erased between the "insert_check" and "insert_commit" calls.
|
||||||
@@ -687,23 +687,23 @@ class sgtree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header must be the header of a tree.
|
//! <b>Requires</b>: header must be the header of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Rebalances the tree.
|
//! <b>Effects</b>: Rebalances the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear.
|
//! <b>Complexity</b>: Linear.
|
||||||
static void rebalance(const node_ptr & header)
|
static void rebalance(const node_ptr & header)
|
||||||
{ tree_algorithms::rebalance(header); }
|
{ tree_algorithms::rebalance(header); }
|
||||||
|
|
||||||
//! <b>Requires</b>: old_root is a node of a tree.
|
//! <b>Requires</b>: old_root is a node of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
|
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: The new root of the subtree.
|
//! <b>Returns</b>: The new root of the subtree.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear.
|
//! <b>Complexity</b>: Linear.
|
||||||
static node_ptr rebalance_subtree(const node_ptr & old_root)
|
static node_ptr rebalance_subtree(const node_ptr & old_root)
|
||||||
{ return tree_algorithms::rebalance_subtree(old_root); }
|
{ return tree_algorithms::rebalance_subtree(old_root); }
|
||||||
@@ -713,7 +713,7 @@ class sgtree_algorithms
|
|||||||
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr get_header(const node_ptr & n)
|
static node_ptr get_header(const node_ptr & n)
|
||||||
{ return tree_algorithms::get_header(n); }
|
{ return tree_algorithms::get_header(n); }
|
||||||
@@ -722,11 +722,11 @@ class sgtree_algorithms
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node of a tree.
|
//! <b>Requires</b>: p is a node of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if p is the header of the tree.
|
//! <b>Effects</b>: Returns true if p is the header of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool is_header(const const_node_ptr & p)
|
static bool is_header(const const_node_ptr & p)
|
||||||
{ return tree_algorithms::is_header(p); }
|
{ return tree_algorithms::is_header(p); }
|
||||||
@@ -774,8 +774,8 @@ class sgtree_algorithms
|
|||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,7 @@ struct make_slist_base_hook
|
|||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< hook_defaults,
|
< hook_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3
|
O1, O2, O3
|
||||||
#else
|
#else
|
||||||
@@ -64,16 +64,16 @@ struct make_slist_base_hook
|
|||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Derive a class from slist_base_hook in order to store objects in
|
//! Derive a class from slist_base_hook in order to store objects in
|
||||||
//! in an list. slist_base_hook holds the data necessary to maintain the
|
//! in an list. slist_base_hook holds the data necessary to maintain the
|
||||||
//! list and provides an appropriate value_traits class for list.
|
//! list and provides an appropriate value_traits class for list.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c tag<>, \c void_pointer<> and
|
//! The hook admits the following options: \c tag<>, \c void_pointer<> and
|
||||||
//! \c link_mode<>.
|
//! \c link_mode<>.
|
||||||
//!
|
//!
|
||||||
//! \c tag<> defines a tag to identify the node.
|
//! \c tag<> defines a tag to identify the node.
|
||||||
//! The same tag value can be used in different classes, but if a class is
|
//! The same tag value can be used in different classes, but if a class is
|
||||||
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
||||||
//! unique tag.
|
//! unique tag.
|
||||||
//!
|
//!
|
||||||
//! \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,
|
||||||
@@ -99,27 +99,27 @@ class slist_base_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
slist_base_hook();
|
slist_base_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
slist_base_hook(const slist_base_hook& );
|
slist_base_hook(const slist_base_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
slist_base_hook& operator=(const slist_base_hook& );
|
slist_base_hook& operator=(const slist_base_hook& );
|
||||||
@@ -128,37 +128,37 @@ class slist_base_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in an slist an assertion is raised. If link_mode is
|
//! object is stored in an slist an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~slist_base_hook();
|
~slist_base_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(slist_base_hook &other);
|
void swap_nodes(slist_base_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c slist::iterator_to
|
//! otherwise. This function can be used to test whether \c slist::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -174,7 +174,7 @@ struct make_slist_member_hook
|
|||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< hook_defaults,
|
< hook_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3
|
O1, O2, O3
|
||||||
#else
|
#else
|
||||||
@@ -193,12 +193,12 @@ struct make_slist_member_hook
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Put a public data member slist_member_hook in order to store objects of this class in
|
//! Put a public data member slist_member_hook in order to store objects of this class in
|
||||||
//! an list. slist_member_hook holds the data necessary for maintaining the list and
|
//! an list. slist_member_hook holds the data necessary for maintaining the list and
|
||||||
//! provides an appropriate value_traits class for list.
|
//! provides an appropriate value_traits class for list.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c void_pointer<> and
|
//! The hook admits the following options: \c void_pointer<> and
|
||||||
//! \c link_mode<>.
|
//! \c link_mode<>.
|
||||||
//!
|
//!
|
||||||
//! \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).
|
||||||
//!
|
//!
|
||||||
@@ -222,27 +222,27 @@ class slist_member_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
slist_member_hook();
|
slist_member_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
slist_member_hook(const slist_member_hook& );
|
slist_member_hook(const slist_member_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
slist_member_hook& operator=(const slist_member_hook& );
|
slist_member_hook& operator=(const slist_member_hook& );
|
||||||
@@ -251,43 +251,43 @@ class slist_member_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in an slist an assertion is raised. If link_mode is
|
//! object is stored in an slist an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~slist_member_hook();
|
~slist_member_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(slist_member_hook &other);
|
void swap_nodes(slist_member_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c slist::iterator_to
|
//! otherwise. This function can be used to test whether \c slist::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -43,7 +43,7 @@ struct make_splay_set_base_hook
|
|||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< hook_defaults,
|
< hook_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3
|
O1, O2, O3
|
||||||
#else
|
#else
|
||||||
@@ -61,16 +61,16 @@ struct make_splay_set_base_hook
|
|||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Derive a class from splay_set_base_hook in order to store objects in
|
//! Derive a class from splay_set_base_hook in order to store objects in
|
||||||
//! in a splay_set/splay_multiset. splay_set_base_hook holds the data necessary to maintain
|
//! in a splay_set/splay_multiset. splay_set_base_hook holds the data necessary to maintain
|
||||||
//! the splay_set/splay_multiset and provides an appropriate value_traits class for splay_set/splay_multiset.
|
//! the splay_set/splay_multiset and provides an appropriate value_traits class for splay_set/splay_multiset.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
|
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
|
||||||
//! \c link_mode<> and \c optimize_size<>.
|
//! \c link_mode<> and \c optimize_size<>.
|
||||||
//!
|
//!
|
||||||
//! \c tag<> defines a tag to identify the node.
|
//! \c tag<> defines a tag to identify the node.
|
||||||
//! The same tag value can be used in different classes, but if a class is
|
//! The same tag value can be used in different classes, but if a class is
|
||||||
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
||||||
//! unique tag.
|
//! unique tag.
|
||||||
//!
|
//!
|
||||||
//! \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
|
||||||
@@ -96,27 +96,27 @@ class splay_set_base_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
splay_set_base_hook();
|
splay_set_base_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
splay_set_base_hook(const splay_set_base_hook& );
|
splay_set_base_hook(const splay_set_base_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
splay_set_base_hook& operator=(const splay_set_base_hook& );
|
splay_set_base_hook& operator=(const splay_set_base_hook& );
|
||||||
@@ -125,37 +125,37 @@ class splay_set_base_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in a set an assertion is raised. If link_mode is
|
//! object is stored in a set an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~splay_set_base_hook();
|
~splay_set_base_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(splay_set_base_hook &other);
|
void swap_nodes(splay_set_base_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c set::iterator_to
|
//! otherwise. This function can be used to test whether \c set::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -171,7 +171,7 @@ struct make_splay_set_member_hook
|
|||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< hook_defaults,
|
< hook_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3
|
O1, O2, O3
|
||||||
#else
|
#else
|
||||||
@@ -193,7 +193,7 @@ struct make_splay_set_member_hook
|
|||||||
//! class in a splay_set/splay_multiset. splay_set_member_hook holds the data
|
//! class in a splay_set/splay_multiset. splay_set_member_hook holds the data
|
||||||
//! necessary for maintaining the splay_set/splay_multiset and provides an appropriate
|
//! necessary for maintaining the splay_set/splay_multiset and provides an appropriate
|
||||||
//! value_traits class for splay_set/splay_multiset.
|
//! value_traits class for splay_set/splay_multiset.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c void_pointer<>,
|
//! The hook admits the following options: \c void_pointer<>,
|
||||||
//! \c link_mode<> and \c optimize_size<>.
|
//! \c link_mode<> and \c optimize_size<>.
|
||||||
//!
|
//!
|
||||||
@@ -220,27 +220,27 @@ class splay_set_member_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
splay_set_member_hook();
|
splay_set_member_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
splay_set_member_hook(const splay_set_member_hook& );
|
splay_set_member_hook(const splay_set_member_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
splay_set_member_hook& operator=(const splay_set_member_hook& );
|
splay_set_member_hook& operator=(const splay_set_member_hook& );
|
||||||
@@ -249,43 +249,43 @@ class splay_set_member_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in a set an assertion is raised. If link_mode is
|
//! object is stored in a set an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~splay_set_member_hook();
|
~splay_set_member_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(splay_set_member_hook &other);
|
void swap_nodes(splay_set_member_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c set::iterator_to
|
//! otherwise. This function can be used to test whether \c set::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@
|
|||||||
// Here is the header of the file used as base code:
|
// Here is the header of the file used as base code:
|
||||||
//
|
//
|
||||||
// splay_tree.h -- implementation of a STL complatible splay tree.
|
// splay_tree.h -- implementation of a STL complatible splay tree.
|
||||||
//
|
//
|
||||||
// Copyright (c) 2004 Ralf Mattethat
|
// Copyright (c) 2004 Ralf Mattethat
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Permission to copy, use, modify, sell and distribute this software
|
||||||
@@ -24,22 +24,22 @@
|
|||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
// Please send questions, comments, complaints, performance data, etc to
|
// Please send questions, comments, complaints, performance data, etc to
|
||||||
// ralf.mattethat@teknologisk.dk
|
// ralf.mattethat@teknologisk.dk
|
||||||
//
|
//
|
||||||
// Requirements for element type
|
// Requirements for element type
|
||||||
// * must be copy-constructible
|
// * must be copy-constructible
|
||||||
// * destructor must not throw exception
|
// * destructor must not throw exception
|
||||||
//
|
//
|
||||||
// Methods marked with note A only throws an exception if the evaluation of the
|
// Methods marked with note A only throws an exception if the evaluation of the
|
||||||
// predicate throws an exception. If an exception is thrown the call has no
|
// predicate throws an exception. If an exception is thrown the call has no
|
||||||
// effect on the containers state
|
// effect on the containers state
|
||||||
//
|
//
|
||||||
// Methods marked with note B only throws an exception if the coppy constructor
|
// Methods marked with note B only throws an exception if the coppy constructor
|
||||||
// or assignment operator of the predicate throws an exception. If an exception
|
// or assignment operator of the predicate throws an exception. If an exception
|
||||||
// is thrown the call has no effect on the containers state
|
// is thrown the call has no effect on the containers state
|
||||||
//
|
//
|
||||||
// iterators are only invalidated, if the element pointed to by the iterator
|
// iterators are only invalidated, if the element pointed to by the iterator
|
||||||
// is deleted. The same goes for element references
|
// is deleted. The same goes for element references
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -95,8 +95,8 @@ struct splaydown_rollback
|
|||||||
|
|
||||||
//! A splay tree is an implementation of a binary search tree. The tree is
|
//! A splay tree is an implementation of a binary search tree. The tree is
|
||||||
//! self balancing using the splay algorithm as described in
|
//! self balancing using the splay algorithm as described in
|
||||||
//!
|
//!
|
||||||
//! "Self-Adjusting Binary Search Trees
|
//! "Self-Adjusting Binary Search Trees
|
||||||
//! by Daniel Dominic Sleator and Robert Endre Tarjan
|
//! by Daniel Dominic Sleator and Robert Endre Tarjan
|
||||||
//! AT&T Bell Laboratories, Murray Hill, NJ
|
//! AT&T Bell Laboratories, Murray Hill, NJ
|
||||||
//! Journal of the ACM, Vol 32, no 3, July 1985, pp 652-686
|
//! Journal of the ACM, Vol 32, no 3, July 1985, pp 652-686
|
||||||
@@ -116,15 +116,15 @@ struct splaydown_rollback
|
|||||||
//! <b>Static functions</b>:
|
//! <b>Static functions</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class splaytree_algorithms
|
class splaytree_algorithms
|
||||||
@@ -159,11 +159,11 @@ class splaytree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
||||||
//! by init(...).
|
//! by init(...).
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool unique(const const_node_ptr & node)
|
static bool unique(const const_node_ptr & node)
|
||||||
{ return tree_algorithms::unique(node); }
|
{ return tree_algorithms::unique(node); }
|
||||||
@@ -173,15 +173,15 @@ class splaytree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -190,22 +190,22 @@ class splaytree_algorithms
|
|||||||
{
|
{
|
||||||
if(node1 == node2)
|
if(node1 == node2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
||||||
swap_nodes(node1, header1, node2, header2);
|
swap_nodes(node1, header1, node2, header2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees with header header1 and header2.
|
//! of two trees with header header1 and header2.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -215,14 +215,14 @@ class splaytree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! and new_node must not be inserted in a tree.
|
//! and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -238,14 +238,14 @@ class splaytree_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! with header "header" and new_node must not be inserted in a tree.
|
//! with header "header" and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -256,21 +256,21 @@ class splaytree_algorithms
|
|||||||
{ tree_algorithms::replace_node(node_to_be_replaced, header, new_node); }
|
{ tree_algorithms::replace_node(node_to_be_replaced, header, new_node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the header.
|
//! <b>Requires</b>: p is a node from the tree except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the next node of the tree.
|
//! <b>Effects</b>: Returns the next node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr next_node(const node_ptr & p)
|
static node_ptr next_node(const node_ptr & p)
|
||||||
{ return tree_algorithms::next_node(p); }
|
{ return tree_algorithms::next_node(p); }
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the previous node of the tree.
|
//! <b>Effects</b>: Returns the previous node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr prev_node(const node_ptr & p)
|
static node_ptr prev_node(const node_ptr & p)
|
||||||
{ return tree_algorithms::prev_node(p); }
|
{ return tree_algorithms::prev_node(p); }
|
||||||
@@ -278,9 +278,9 @@ class splaytree_algorithms
|
|||||||
//! <b>Requires</b>: node must not be part of any tree.
|
//! <b>Requires</b>: node must not be part of any tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: After the function unique(node) == true.
|
//! <b>Effects</b>: After the function unique(node) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
@@ -291,9 +291,9 @@ class splaytree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
||||||
//! unique(header) == true.
|
//! unique(header) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
@@ -303,46 +303,46 @@ class splaytree_algorithms
|
|||||||
//! <b>Requires</b>: "disposer" must be an object function
|
//! <b>Requires</b>: "disposer" must be an object function
|
||||||
//! taking a node_ptr parameter and shouldn't throw.
|
//! taking a node_ptr parameter and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Empties the target tree calling
|
//! <b>Effects</b>: Empties the target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template<class Disposer>
|
template<class Disposer>
|
||||||
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
||||||
{ tree_algorithms::clear_and_dispose(header, disposer); }
|
{ tree_algorithms::clear_and_dispose(header, disposer); }
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t count(const const_node_ptr & node)
|
static std::size_t count(const const_node_ptr & node)
|
||||||
{ return tree_algorithms::count(node); }
|
{ return tree_algorithms::count(node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header node of the tree.
|
//! <b>Requires</b>: header is the header node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes above the header.
|
//! <b>Effects</b>: Returns the number of nodes above the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t size(const const_node_ptr & header)
|
static std::size_t size(const const_node_ptr & header)
|
||||||
{ return tree_algorithms::size(header); }
|
{ return tree_algorithms::size(header); }
|
||||||
|
|
||||||
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
||||||
//! links to the second tree and header2 will have links to the first tree.
|
//! links to the second tree and header2 will have links to the first tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
||||||
{ return tree_algorithms::swap_tree(header1, header2); }
|
{ return tree_algorithms::swap_tree(header1, header2); }
|
||||||
@@ -351,16 +351,16 @@ class splaytree_algorithms
|
|||||||
//! "commit_data" must have been obtained from a previous call to
|
//! "commit_data" must have been obtained from a previous call to
|
||||||
//! "insert_unique_check". No objects should have been inserted or erased
|
//! "insert_unique_check". No objects should have been inserted or erased
|
||||||
//! from the set between the "insert_unique_check" that filled "commit_data"
|
//! from the set between the "insert_unique_check" that filled "commit_data"
|
||||||
//! and the call to "insert_commit".
|
//! and the call to "insert_commit".
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
||||||
//! from the "commit_data" that a previous "insert_check" filled.
|
//! from the "commit_data" that a previous "insert_check" filled.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
||||||
//! previously executed to fill "commit_data". No value should be inserted or
|
//! previously executed to fill "commit_data". No value should be inserted or
|
||||||
//! erased between the "insert_check" and "insert_commit" calls.
|
//! erased between the "insert_check" and "insert_commit" calls.
|
||||||
@@ -372,7 +372,7 @@ class splaytree_algorithms
|
|||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
//! KeyNodePtrCompare is a function object that induces a strict weak
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
||||||
//! tree according to "comp" and obtains the needed information to realize
|
//! tree according to "comp" and obtains the needed information to realize
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
//! a constant-time node insertion if there is no equivalent node.
|
||||||
@@ -383,11 +383,11 @@ class splaytree_algorithms
|
|||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
//! be used with the "insert_commit" function to achieve a constant-time
|
||||||
//! insertion function.
|
//! insertion function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
//! a node is expensive and the user does not want to have two equivalent nodes
|
||||||
//! in the tree: if there is an equivalent value
|
//! in the tree: if there is an equivalent value
|
||||||
@@ -432,7 +432,7 @@ class splaytree_algorithms
|
|||||||
//! "key" according to "comp" or "header" if that element does not exist.
|
//! "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr find
|
static node_ptr find
|
||||||
@@ -457,7 +457,7 @@ class splaytree_algorithms
|
|||||||
//! if they there are no equivalent elements.
|
//! if they there are no equivalent elements.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> equal_range
|
static std::pair<node_ptr, node_ptr> equal_range
|
||||||
@@ -483,7 +483,7 @@ class splaytree_algorithms
|
|||||||
//! not exist.
|
//! not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr lower_bound
|
static node_ptr lower_bound
|
||||||
@@ -506,7 +506,7 @@ class splaytree_algorithms
|
|||||||
//! than "key" according to "comp" or "header" if that element does not exist.
|
//! than "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr upper_bound
|
static node_ptr upper_bound
|
||||||
@@ -525,14 +525,14 @@ class splaytree_algorithms
|
|||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
|
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
|
||||||
//! the "header"'s tree.
|
//! the "header"'s tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
||||||
//! where it will be inserted. If "hint" is the upper_bound
|
//! where it will be inserted. If "hint" is the upper_bound
|
||||||
//! the insertion takes constant time (two comparisons in the worst case).
|
//! the insertion takes constant time (two comparisons in the worst case).
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
||||||
//! constant time if new_node is inserted immediately before "hint".
|
//! constant time if new_node is inserted immediately before "hint".
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal
|
static node_ptr insert_equal
|
||||||
@@ -548,13 +548,13 @@ class splaytree_algorithms
|
|||||||
//! "pos" must be an iterator pointing to the successor to "new_node"
|
//! "pos" must be an iterator pointing to the successor to "new_node"
|
||||||
//! once inserted according to the order of already inserted nodes. This function does not
|
//! once inserted according to the order of already inserted nodes. This function does not
|
||||||
//! check "pos" and this precondition must be guaranteed by the caller.
|
//! check "pos" and this precondition must be guaranteed by the caller.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
||||||
//! tree invariants might be broken.
|
//! tree invariants might be broken.
|
||||||
static node_ptr insert_before
|
static node_ptr insert_before
|
||||||
@@ -568,13 +568,13 @@ class splaytree_algorithms
|
|||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! <b>Requires</b>: "header" must be the header node of a tree.
|
||||||
//! "new_node" must be, according to the used ordering no less than the
|
//! "new_node" must be, according to the used ordering no less than the
|
||||||
//! greatest inserted key.
|
//! greatest inserted key.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
//! tree invariants are broken. This function is slightly faster than
|
||||||
//! using "insert_before".
|
//! using "insert_before".
|
||||||
@@ -587,13 +587,13 @@ class splaytree_algorithms
|
|||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! <b>Requires</b>: "header" must be the header node of a tree.
|
||||||
//! "new_node" must be, according to the used ordering, no greater than the
|
//! "new_node" must be, according to the used ordering, no greater than the
|
||||||
//! lowest inserted key.
|
//! lowest inserted key.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
//! tree invariants are broken. This function is slightly faster than
|
||||||
//! using "insert_before".
|
//! using "insert_before".
|
||||||
@@ -610,10 +610,10 @@ class splaytree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
||||||
//! according to "comp".
|
//! according to "comp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||||
//! most logarithmic.
|
//! most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal_upper_bound
|
static node_ptr insert_equal_upper_bound
|
||||||
@@ -630,10 +630,10 @@ class splaytree_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
|
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
|
||||||
//! according to "comp".
|
//! according to "comp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||||
//! most logarithmic.
|
//! most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal_lower_bound
|
static node_ptr insert_equal_lower_bound
|
||||||
@@ -647,18 +647,18 @@ class splaytree_algorithms
|
|||||||
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
||||||
//! take a node_ptr and shouldn't throw.
|
//! take a node_ptr and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: First empties target tree calling
|
//! <b>Effects</b>: First empties target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
||||||
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
||||||
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
||||||
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template <class Cloner, class Disposer>
|
template <class Cloner, class Disposer>
|
||||||
static void clone
|
static void clone
|
||||||
@@ -723,13 +723,13 @@ class splaytree_algorithms
|
|||||||
node_ptr t(header);
|
node_ptr t(header);
|
||||||
|
|
||||||
if( n == t ) return;
|
if( n == t ) return;
|
||||||
|
|
||||||
for( ;; ){
|
for( ;; ){
|
||||||
node_ptr p(NodeTraits::get_parent(n));
|
node_ptr p(NodeTraits::get_parent(n));
|
||||||
node_ptr g(NodeTraits::get_parent(p));
|
node_ptr g(NodeTraits::get_parent(p));
|
||||||
|
|
||||||
if( p == t ) break;
|
if( p == t ) break;
|
||||||
|
|
||||||
if( g == t ){
|
if( g == t ){
|
||||||
// zig
|
// zig
|
||||||
rotate(n);
|
rotate(n);
|
||||||
@@ -841,23 +841,23 @@ class splaytree_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header must be the header of a tree.
|
//! <b>Requires</b>: header must be the header of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Rebalances the tree.
|
//! <b>Effects</b>: Rebalances the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear.
|
//! <b>Complexity</b>: Linear.
|
||||||
static void rebalance(const node_ptr & header)
|
static void rebalance(const node_ptr & header)
|
||||||
{ tree_algorithms::rebalance(header); }
|
{ tree_algorithms::rebalance(header); }
|
||||||
|
|
||||||
//! <b>Requires</b>: old_root is a node of a tree.
|
//! <b>Requires</b>: old_root is a node of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
|
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: The new root of the subtree.
|
//! <b>Returns</b>: The new root of the subtree.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear.
|
//! <b>Complexity</b>: Linear.
|
||||||
static node_ptr rebalance_subtree(const node_ptr & old_root)
|
static node_ptr rebalance_subtree(const node_ptr & old_root)
|
||||||
{ return tree_algorithms::rebalance_subtree(old_root); }
|
{ return tree_algorithms::rebalance_subtree(old_root); }
|
||||||
@@ -868,7 +868,7 @@ class splaytree_algorithms
|
|||||||
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr get_header(const node_ptr & n)
|
static node_ptr get_header(const node_ptr & n)
|
||||||
{ return tree_algorithms::get_header(n); }
|
{ return tree_algorithms::get_header(n); }
|
||||||
@@ -926,10 +926,10 @@ class splaytree_algorithms
|
|||||||
{
|
{
|
||||||
node_ptr p = NodeTraits::get_parent(n);
|
node_ptr p = NodeTraits::get_parent(n);
|
||||||
node_ptr g = NodeTraits::get_parent(p);
|
node_ptr g = NodeTraits::get_parent(p);
|
||||||
//Test if g is header before breaking tree
|
//Test if g is header before breaking tree
|
||||||
//invariants that would make is_header invalid
|
//invariants that would make is_header invalid
|
||||||
bool g_is_header = is_header(g);
|
bool g_is_header = is_header(g);
|
||||||
|
|
||||||
if(NodeTraits::get_left(p) == n){
|
if(NodeTraits::get_left(p) == n){
|
||||||
NodeTraits::set_left(p, NodeTraits::get_right(n));
|
NodeTraits::set_left(p, NodeTraits::get_right(n));
|
||||||
if(NodeTraits::get_left(p) != node_ptr())
|
if(NodeTraits::get_left(p) != node_ptr())
|
||||||
@@ -965,8 +965,8 @@ class splaytree_algorithms
|
|||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -28,15 +28,15 @@
|
|||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
|
|
||||||
//! treap_algorithms provides basic algorithms to manipulate
|
//! treap_algorithms provides basic algorithms to manipulate
|
||||||
//! nodes forming a treap.
|
//! nodes forming a treap.
|
||||||
//!
|
//!
|
||||||
//! (1) the header node is maintained with links not only to the root
|
//! (1) the header node is maintained with links not only to the root
|
||||||
//! but also to the leftmost node of the tree, to enable constant time
|
//! but also to the leftmost node of the tree, to enable constant time
|
||||||
//! begin(), and to the rightmost node of the tree, to enable linear time
|
//! begin(), and to the rightmost node of the tree, to enable linear time
|
||||||
//! performance when used with the generic set algorithms (set_union,
|
//! performance when used with the generic set algorithms (set_union,
|
||||||
//! etc.);
|
//! etc.);
|
||||||
//!
|
//!
|
||||||
//! (2) when a node being deleted has two children its successor node is
|
//! (2) when a node being deleted has two children its successor node is
|
||||||
//! relinked into its place, rather than copied, so that the only
|
//! relinked into its place, rather than copied, so that the only
|
||||||
//! pointers invalidated are those referring to the deleted node.
|
//! pointers invalidated are those referring to the deleted node.
|
||||||
@@ -56,15 +56,15 @@ namespace intrusive {
|
|||||||
//! <b>Static functions</b>:
|
//! <b>Static functions</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
|
||||||
//!
|
//!
|
||||||
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class treap_algorithms
|
class treap_algorithms
|
||||||
@@ -92,7 +92,7 @@ class treap_algorithms
|
|||||||
tree_algorithms::erase(header_, z_);
|
tree_algorithms::erase(header_, z_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void release()
|
void release()
|
||||||
{ remove_it_ = false; }
|
{ remove_it_ = false; }
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ class treap_algorithms
|
|||||||
rotate_up_n(header_, p_, n_);
|
rotate_up_n(header_, p_, n_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void release()
|
void release()
|
||||||
{ remove_it_ = false; }
|
{ remove_it_ = false; }
|
||||||
|
|
||||||
@@ -170,27 +170,27 @@ class treap_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
||||||
//! links to the second tree and header2 will have links to the first tree.
|
//! links to the second tree and header2 will have links to the first tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
||||||
{ return tree_algorithms::swap_tree(header1, header2); }
|
{ return tree_algorithms::swap_tree(header1, header2); }
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees.
|
//! of two trees.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -199,22 +199,22 @@ class treap_algorithms
|
|||||||
{
|
{
|
||||||
if(node1 == node2)
|
if(node1 == node2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
||||||
swap_nodes(node1, header1, node2, header2);
|
swap_nodes(node1, header1, node2, header2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
||||||
//! of two trees with header header1 and header2.
|
//! of two trees with header header1 and header2.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
//! in the position node2 before the function. node2 will be inserted in the
|
||||||
//! position node1 had before the function.
|
//! position node1 had before the function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
//! node1 and node2 are not equivalent according to the ordering rules.
|
||||||
//!
|
//!
|
||||||
@@ -224,14 +224,14 @@ class treap_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! and new_node must not be inserted in a tree.
|
//! and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -247,14 +247,14 @@ class treap_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
||||||
//! with header "header" and new_node must not be inserted in a tree.
|
//! with header "header" and new_node must not be inserted in a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
//! tree with new_node. The tree does not need to be rebalanced
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
//! <b>Note</b>: This function will break container ordering invariants if
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
//! new_node is not equivalent to node_to_be_replaced according to the
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
//! ordering rules. This function is faster than erasing and inserting
|
||||||
@@ -265,11 +265,11 @@ class treap_algorithms
|
|||||||
{ tree_algorithms::replace_node(node_to_be_replaced, header, new_node); }
|
{ tree_algorithms::replace_node(node_to_be_replaced, header, new_node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a tree node but not the header.
|
//! <b>Requires</b>: node is a tree node but not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
|
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
//! <b>Complexity</b>: Average complexity is constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "pcomp" throws, strong guarantee
|
//! <b>Throws</b>: If "pcomp" throws, strong guarantee
|
||||||
template<class NodePtrPriorityCompare>
|
template<class NodePtrPriorityCompare>
|
||||||
static void unlink(const node_ptr & node, NodePtrPriorityCompare pcomp)
|
static void unlink(const node_ptr & node, NodePtrPriorityCompare pcomp)
|
||||||
@@ -283,14 +283,14 @@ class treap_algorithms
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header of a tree.
|
//! <b>Requires</b>: header is the header of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
||||||
//! updates the header link to the new leftmost node.
|
//! updates the header link to the new leftmost node.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
//! <b>Complexity</b>: Average complexity is constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function breaks the tree and the tree can
|
//! <b>Notes</b>: This function breaks the tree and the tree can
|
||||||
//! only be used for more unlink_leftmost_without_rebalance calls.
|
//! only be used for more unlink_leftmost_without_rebalance calls.
|
||||||
//! This function is normally used to achieve a step by step
|
//! This function is normally used to achieve a step by step
|
||||||
@@ -300,51 +300,51 @@ class treap_algorithms
|
|||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
||||||
//! by init(...).
|
//! by init(...).
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool unique(const const_node_ptr & node)
|
static bool unique(const const_node_ptr & node)
|
||||||
{ return tree_algorithms::unique(node); }
|
{ return tree_algorithms::unique(node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t count(const const_node_ptr & node)
|
static std::size_t count(const const_node_ptr & node)
|
||||||
{ return tree_algorithms::count(node); }
|
{ return tree_algorithms::count(node); }
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header node of the tree.
|
//! <b>Requires</b>: header is the header node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the number of nodes above the header.
|
//! <b>Effects</b>: Returns the number of nodes above the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear time.
|
//! <b>Complexity</b>: Linear time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static std::size_t size(const const_node_ptr & header)
|
static std::size_t size(const const_node_ptr & header)
|
||||||
{ return tree_algorithms::size(header); }
|
{ return tree_algorithms::size(header); }
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the header.
|
//! <b>Requires</b>: p is a node from the tree except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the next node of the tree.
|
//! <b>Effects</b>: Returns the next node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr next_node(const node_ptr & p)
|
static node_ptr next_node(const node_ptr & p)
|
||||||
{ return tree_algorithms::next_node(p); }
|
{ return tree_algorithms::next_node(p); }
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns the previous node of the tree.
|
//! <b>Effects</b>: Returns the previous node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average constant time.
|
//! <b>Complexity</b>: Average constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr prev_node(const node_ptr & p)
|
static node_ptr prev_node(const node_ptr & p)
|
||||||
{ return tree_algorithms::prev_node(p); }
|
{ return tree_algorithms::prev_node(p); }
|
||||||
@@ -352,9 +352,9 @@ class treap_algorithms
|
|||||||
//! <b>Requires</b>: node must not be part of any tree.
|
//! <b>Requires</b>: node must not be part of any tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: After the function unique(node) == true.
|
//! <b>Effects</b>: After the function unique(node) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
@@ -365,9 +365,9 @@ class treap_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
||||||
//! unique(header) == true.
|
//! unique(header) == true.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
@@ -380,9 +380,9 @@ class treap_algorithms
|
|||||||
//! of that tree and z != header.
|
//! of that tree and z != header.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
|
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Amortized constant time.
|
//! <b>Complexity</b>: Amortized constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
|
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
|
||||||
template<class NodePtrPriorityCompare>
|
template<class NodePtrPriorityCompare>
|
||||||
static node_ptr erase(const node_ptr & header, const node_ptr & z, NodePtrPriorityCompare pcomp)
|
static node_ptr erase(const node_ptr & header, const node_ptr & z, NodePtrPriorityCompare pcomp)
|
||||||
@@ -397,18 +397,18 @@ class treap_algorithms
|
|||||||
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
||||||
//! take a node_ptr and shouldn't throw.
|
//! take a node_ptr and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: First empties target tree calling
|
//! <b>Effects</b>: First empties target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
||||||
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
||||||
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
||||||
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template <class Cloner, class Disposer>
|
template <class Cloner, class Disposer>
|
||||||
static void clone
|
static void clone
|
||||||
@@ -420,13 +420,13 @@ class treap_algorithms
|
|||||||
//! <b>Requires</b>: "disposer" must be an object function
|
//! <b>Requires</b>: "disposer" must be an object function
|
||||||
//! taking a node_ptr parameter and shouldn't throw.
|
//! taking a node_ptr parameter and shouldn't throw.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Empties the target tree calling
|
//! <b>Effects</b>: Empties the target tree calling
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
||||||
//! except the header.
|
//! except the header.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
||||||
//! number of elements of tree target tree when calling this function.
|
//! number of elements of tree target tree when calling this function.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
||||||
template<class Disposer>
|
template<class Disposer>
|
||||||
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
||||||
@@ -442,7 +442,7 @@ class treap_algorithms
|
|||||||
//! not exist.
|
//! not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr lower_bound
|
static node_ptr lower_bound
|
||||||
@@ -458,7 +458,7 @@ class treap_algorithms
|
|||||||
//! than "key" according to "comp" or "header" if that element does not exist.
|
//! than "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr upper_bound
|
static node_ptr upper_bound
|
||||||
@@ -474,7 +474,7 @@ class treap_algorithms
|
|||||||
//! "key" according to "comp" or "header" if that element does not exist.
|
//! "key" according to "comp" or "header" if that element does not exist.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr find
|
static node_ptr find
|
||||||
@@ -492,7 +492,7 @@ class treap_algorithms
|
|||||||
//! if they there are no equivalent elements.
|
//! if they there are no equivalent elements.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> equal_range
|
static std::pair<node_ptr, node_ptr> equal_range
|
||||||
@@ -509,10 +509,10 @@ class treap_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
||||||
//! according to "comp" and rotates the tree according to "pcomp".
|
//! according to "comp" and rotates the tree according to "pcomp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||||
//! most logarithmic.
|
//! most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throw or "pcomp" throw.
|
//! <b>Throws</b>: If "comp" throw or "pcomp" throw.
|
||||||
template<class NodePtrCompare, class NodePtrPriorityCompare>
|
template<class NodePtrCompare, class NodePtrPriorityCompare>
|
||||||
static node_ptr insert_equal_upper_bound
|
static node_ptr insert_equal_upper_bound
|
||||||
@@ -534,10 +534,10 @@ class treap_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
||||||
//! according to "comp" and rotates the tree according to "pcomp".
|
//! according to "comp" and rotates the tree according to "pcomp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||||
//! most logarithmic.
|
//! most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
template<class NodePtrCompare, class NodePtrPriorityCompare>
|
template<class NodePtrCompare, class NodePtrPriorityCompare>
|
||||||
static node_ptr insert_equal_lower_bound
|
static node_ptr insert_equal_lower_bound
|
||||||
@@ -557,7 +557,7 @@ class treap_algorithms
|
|||||||
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
|
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
|
||||||
//! ordering compatible with the one used to create the
|
//! ordering compatible with the one used to create the
|
||||||
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
|
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
||||||
//! where it will be inserted. If "hint" is the upper_bound
|
//! where it will be inserted. If "hint" is the upper_bound
|
||||||
//! the insertion takes constant time (two comparisons in the worst case).
|
//! the insertion takes constant time (two comparisons in the worst case).
|
||||||
@@ -565,7 +565,7 @@ class treap_algorithms
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
||||||
//! constant time if new_node is inserted immediately before "hint".
|
//! constant time if new_node is inserted immediately before "hint".
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throw or "pcomp" throw.
|
//! <b>Throws</b>: If "comp" throw or "pcomp" throw.
|
||||||
template<class NodePtrCompare, class NodePtrPriorityCompare>
|
template<class NodePtrCompare, class NodePtrPriorityCompare>
|
||||||
static node_ptr insert_equal
|
static node_ptr insert_equal
|
||||||
@@ -585,14 +585,14 @@ class treap_algorithms
|
|||||||
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
|
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
|
||||||
//! ordering compatible with the one used to create the
|
//! ordering compatible with the one used to create the
|
||||||
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
|
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos"
|
//! <b>Effects</b>: Inserts new_node into the tree before "pos"
|
||||||
//! and rotates the tree according to "pcomp".
|
//! and rotates the tree according to "pcomp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
|
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
||||||
//! tree invariants might be broken.
|
//! tree invariants might be broken.
|
||||||
template<class NodePtrPriorityCompare>
|
template<class NodePtrPriorityCompare>
|
||||||
@@ -611,14 +611,14 @@ class treap_algorithms
|
|||||||
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
|
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
|
||||||
//! ordering compatible with the one used to create the
|
//! ordering compatible with the one used to create the
|
||||||
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
|
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts x into the tree in the last position
|
//! <b>Effects</b>: Inserts x into the tree in the last position
|
||||||
//! and rotates the tree according to "pcomp".
|
//! and rotates the tree according to "pcomp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
|
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
//! tree invariants are broken. This function is slightly faster than
|
||||||
//! using "insert_before".
|
//! using "insert_before".
|
||||||
@@ -636,14 +636,14 @@ class treap_algorithms
|
|||||||
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
|
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
|
||||||
//! ordering compatible with the one used to create the
|
//! ordering compatible with the one used to create the
|
||||||
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
|
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts x into the tree in the first position
|
//! <b>Effects</b>: Inserts x into the tree in the first position
|
||||||
//! and rotates the tree according to "pcomp".
|
//! and rotates the tree according to "pcomp".
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant-time.
|
//! <b>Complexity</b>: Constant-time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
|
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
|
||||||
//!
|
//!
|
||||||
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
//! tree invariants are broken. This function is slightly faster than
|
||||||
//! using "insert_before".
|
//! using "insert_before".
|
||||||
@@ -659,7 +659,7 @@ class treap_algorithms
|
|||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
//! KeyNodePtrCompare is a function object that induces a strict weak
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
||||||
//! tree according to "comp" and obtains the needed information to realize
|
//! tree according to "comp" and obtains the needed information to realize
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
//! a constant-time node insertion if there is no equivalent node.
|
||||||
@@ -670,11 +670,11 @@ class treap_algorithms
|
|||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
//! be used with the "insert_commit" function to achieve a constant-time
|
||||||
//! insertion function.
|
//! insertion function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
//! a node is expensive and the user does not want to have two equivalent nodes
|
||||||
//! in the tree: if there is an equivalent value
|
//! in the tree: if there is an equivalent value
|
||||||
@@ -707,12 +707,12 @@ class treap_algorithms
|
|||||||
//! ordering compatible with the strict weak ordering used to create the
|
//! ordering compatible with the strict weak ordering used to create the
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
||||||
//! "hint" is node from the "header"'s tree.
|
//! "hint" is node from the "header"'s tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
||||||
//! tree according to "comp" using "hint" as a hint to where it should be
|
//! tree according to "comp" using "hint" as a hint to where it should be
|
||||||
//! inserted and obtains the needed information to realize
|
//! inserted and obtains the needed information to realize
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
//! a constant-time node insertion if there is no equivalent node.
|
||||||
//! If "hint" is the upper_bound the function has constant time
|
//! If "hint" is the upper_bound the function has constant time
|
||||||
//! complexity (two comparisons in the worst case).
|
//! complexity (two comparisons in the worst case).
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: If there is an equivalent value
|
//! <b>Returns</b>: If there is an equivalent value
|
||||||
@@ -721,12 +721,12 @@ class treap_algorithms
|
|||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
//! be used with the "insert_commit" function to achieve a constant-time
|
||||||
//! insertion function.
|
//! insertion function.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
|
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
|
||||||
//! amortized constant time if new_node should be inserted immediately before "hint".
|
//! amortized constant time if new_node should be inserted immediately before "hint".
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
//! <b>Throws</b>: If "comp" throws.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
//! a node is expensive and the user does not want to have two equivalent nodes
|
||||||
//! in the tree: if there is an equivalent value
|
//! in the tree: if there is an equivalent value
|
||||||
@@ -757,16 +757,16 @@ class treap_algorithms
|
|||||||
//! "commit_data" must have been obtained from a previous call to
|
//! "commit_data" must have been obtained from a previous call to
|
||||||
//! "insert_unique_check". No objects should have been inserted or erased
|
//! "insert_unique_check". No objects should have been inserted or erased
|
||||||
//! from the set between the "insert_unique_check" that filled "commit_data"
|
//! from the set between the "insert_unique_check" that filled "commit_data"
|
||||||
//! and the call to "insert_commit".
|
//! and the call to "insert_commit".
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
||||||
//! from the "commit_data" that a previous "insert_check" filled.
|
//! from the "commit_data" that a previous "insert_check" filled.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant time.
|
//! <b>Complexity</b>: Constant time.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
||||||
//! previously executed to fill "commit_data". No value should be inserted or
|
//! previously executed to fill "commit_data". No value should be inserted or
|
||||||
//! erased between the "insert_check" and "insert_commit" calls.
|
//! erased between the "insert_check" and "insert_commit" calls.
|
||||||
@@ -782,7 +782,7 @@ class treap_algorithms
|
|||||||
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
//! <b>Complexity</b>: Logarithmic.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static node_ptr get_header(const node_ptr & n)
|
static node_ptr get_header(const node_ptr & n)
|
||||||
{ return tree_algorithms::get_header(n); }
|
{ return tree_algorithms::get_header(n); }
|
||||||
@@ -791,11 +791,11 @@ class treap_algorithms
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node of a tree.
|
//! <b>Requires</b>: p is a node of a tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Effects</b>: Returns true if p is the header of the tree.
|
//! <b>Effects</b>: Returns true if p is the header of the tree.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
static bool is_header(const const_node_ptr & p)
|
static bool is_header(const const_node_ptr & p)
|
||||||
{
|
{
|
||||||
@@ -887,8 +887,8 @@ class treap_algorithms
|
|||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -40,7 +40,7 @@ struct trivial_value_traits
|
|||||||
static const const_pointer &to_value_ptr(const const_node_ptr &n) { return n; }
|
static const const_pointer &to_value_ptr(const const_node_ptr &n) { return n; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#endif //BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP
|
#endif //BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -95,10 +95,10 @@ struct unordered_node_traits
|
|||||||
{ n->prev_in_group_ = prev; }
|
{ n->prev_in_group_ = prev; }
|
||||||
|
|
||||||
static std::size_t get_hash(const const_node_ptr & n)
|
static std::size_t get_hash(const const_node_ptr & n)
|
||||||
{ return n->hash_; }
|
{ return n->hash_; }
|
||||||
|
|
||||||
static void set_hash(const node_ptr & n, std::size_t h)
|
static void set_hash(const node_ptr & n, std::size_t h)
|
||||||
{ n->hash_ = h; }
|
{ n->hash_ = h; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
@@ -147,12 +147,12 @@ struct get_uset_node_algo
|
|||||||
{
|
{
|
||||||
typedef typename detail::if_c
|
typedef typename detail::if_c
|
||||||
< (StoreHash || OptimizeMultiKey)
|
< (StoreHash || OptimizeMultiKey)
|
||||||
, unordered_node_traits<VoidPointer, StoreHash, OptimizeMultiKey>
|
, unordered_node_traits<VoidPointer, StoreHash, OptimizeMultiKey>
|
||||||
, slist_node_traits<VoidPointer>
|
, slist_node_traits<VoidPointer>
|
||||||
>::type node_traits_type;
|
>::type node_traits_type;
|
||||||
typedef typename detail::if_c
|
typedef typename detail::if_c
|
||||||
< OptimizeMultiKey
|
< OptimizeMultiKey
|
||||||
, unordered_algorithms<node_traits_type>
|
, unordered_algorithms<node_traits_type>
|
||||||
, circular_slist_algorithms<node_traits_type>
|
, circular_slist_algorithms<node_traits_type>
|
||||||
>::type type;
|
>::type type;
|
||||||
};
|
};
|
||||||
@@ -169,7 +169,7 @@ struct make_unordered_set_base_hook
|
|||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< hook_defaults,
|
< hook_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3, O4
|
O1, O2, O3, O4
|
||||||
#else
|
#else
|
||||||
@@ -190,16 +190,16 @@ struct make_unordered_set_base_hook
|
|||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Derive a class from unordered_set_base_hook in order to store objects in
|
//! Derive a class from unordered_set_base_hook in order to store objects in
|
||||||
//! in an unordered_set/unordered_multi_set. unordered_set_base_hook holds the data necessary to maintain
|
//! in an unordered_set/unordered_multi_set. unordered_set_base_hook holds the data necessary to maintain
|
||||||
//! the unordered_set/unordered_multi_set and provides an appropriate value_traits class for unordered_set/unordered_multi_set.
|
//! the unordered_set/unordered_multi_set and provides an appropriate value_traits class for unordered_set/unordered_multi_set.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
|
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
|
||||||
//! \c link_mode<>, \c store_hash<> and \c optimize_multikey<>.
|
//! \c link_mode<>, \c store_hash<> and \c optimize_multikey<>.
|
||||||
//!
|
//!
|
||||||
//! \c tag<> defines a tag to identify the node.
|
//! \c tag<> defines a tag to identify the node.
|
||||||
//! The same tag value can be used in different classes, but if a class is
|
//! The same tag value can be used in different classes, but if a class is
|
||||||
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
||||||
//! unique tag.
|
//! unique tag.
|
||||||
//!
|
//!
|
||||||
//! \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
|
||||||
@@ -232,27 +232,27 @@ class unordered_set_base_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
unordered_set_base_hook();
|
unordered_set_base_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
unordered_set_base_hook(const unordered_set_base_hook& );
|
unordered_set_base_hook(const unordered_set_base_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
unordered_set_base_hook& operator=(const unordered_set_base_hook& );
|
unordered_set_base_hook& operator=(const unordered_set_base_hook& );
|
||||||
@@ -261,37 +261,37 @@ class unordered_set_base_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in an unordered_set an assertion is raised. If link_mode is
|
//! object is stored in an unordered_set an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~unordered_set_base_hook();
|
~unordered_set_base_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(unordered_set_base_hook &other);
|
void swap_nodes(unordered_set_base_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c unordered_set::iterator_to
|
//! otherwise. This function can be used to test whether \c unordered_set::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -308,7 +308,7 @@ struct make_unordered_set_member_hook
|
|||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< hook_defaults,
|
< hook_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3, O4
|
O1, O2, O3, O4
|
||||||
#else
|
#else
|
||||||
@@ -332,7 +332,7 @@ struct make_unordered_set_member_hook
|
|||||||
//! Put a public data member unordered_set_member_hook in order to store objects of this class in
|
//! Put a public data member unordered_set_member_hook in order to store objects of this class in
|
||||||
//! an unordered_set/unordered_multi_set. unordered_set_member_hook holds the data necessary for maintaining the
|
//! an unordered_set/unordered_multi_set. unordered_set_member_hook holds the data necessary for maintaining the
|
||||||
//! unordered_set/unordered_multi_set and provides an appropriate value_traits class for unordered_set/unordered_multi_set.
|
//! unordered_set/unordered_multi_set and provides an appropriate value_traits class for unordered_set/unordered_multi_set.
|
||||||
//!
|
//!
|
||||||
//! The hook admits the following options: \c void_pointer<>,
|
//! The hook admits the following options: \c void_pointer<>,
|
||||||
//! \c link_mode<> and \c store_hash<>.
|
//! \c link_mode<> and \c store_hash<>.
|
||||||
//!
|
//!
|
||||||
@@ -362,27 +362,27 @@ class unordered_set_member_hook
|
|||||||
public:
|
public:
|
||||||
//! <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.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
unordered_set_member_hook();
|
unordered_set_member_hook();
|
||||||
|
|
||||||
//! <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. The argument is ignored.
|
//! initializes the node to an unlinked state. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing a copy-constructor
|
//! <b>Rationale</b>: Providing a copy-constructor
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
unordered_set_member_hook(const unordered_set_member_hook& );
|
unordered_set_member_hook(const unordered_set_member_hook& );
|
||||||
|
|
||||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
//!
|
//!
|
||||||
//! <b>Rationale</b>: Providing an assignment operator
|
//! <b>Rationale</b>: Providing an assignment operator
|
||||||
//! makes classes using the hook STL-compliant without forcing the
|
//! makes classes using the hook STL-compliant without forcing the
|
||||||
//! user to do some additional work. \c swap can be used to emulate
|
//! user to do some additional work. \c swap can be used to emulate
|
||||||
//! move-semantics.
|
//! move-semantics.
|
||||||
unordered_set_member_hook& operator=(const unordered_set_member_hook& );
|
unordered_set_member_hook& operator=(const unordered_set_member_hook& );
|
||||||
@@ -391,43 +391,43 @@ class unordered_set_member_hook
|
|||||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||||
//! object is stored in an unordered_set an assertion is raised. If link_mode is
|
//! object is stored in an unordered_set an assertion is raised. If link_mode is
|
||||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
~unordered_set_member_hook();
|
~unordered_set_member_hook();
|
||||||
|
|
||||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||||
//! related to those nodes in one or two containers. That is, if the node
|
//! related to those nodes in one or two containers. That is, if the node
|
||||||
//! this is part of the element e1, the node x is part of the element e2
|
//! this is part of the element e1, the node x is part of the element e2
|
||||||
//! and both elements are included in the containers s1 and s2, then after
|
//! and both elements are included in the containers s1 and s2, then after
|
||||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||||
//! at the position of e1. If one element is not in a container, then
|
//! at the position of e1. If one element is not in a container, then
|
||||||
//! after the swap-operation the other element is not in a container.
|
//! after the swap-operation the other element is not in a container.
|
||||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void swap_nodes(unordered_set_member_hook &other);
|
void swap_nodes(unordered_set_member_hook &other);
|
||||||
|
|
||||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||||
//! otherwise. This function can be used to test whether \c unordered_set::iterator_to
|
//! otherwise. This function can be used to test whether \c unordered_set::iterator_to
|
||||||
//! will return a valid iterator.
|
//! will return a valid iterator.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
bool is_linked() const;
|
bool is_linked() const;
|
||||||
|
|
||||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||||
//!
|
//!
|
||||||
//! <b>Throws</b>: Nothing.
|
//! <b>Throws</b>: Nothing.
|
||||||
void unlink();
|
void unlink();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user